File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed
packages/core/src/domain/configuration Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -223,7 +223,7 @@ export interface InitConfiguration {
223223 *
224224 * @internal
225225 */
226- source ?: 'browser' | 'flutter' | undefined
226+ source ?: 'browser' | 'flutter' | 'unity' | undefined
227227
228228 /**
229229 * [Internal option] Additional configuration for the SDK.
@@ -286,7 +286,7 @@ export interface Configuration extends TransportConfiguration {
286286
287287 // internal
288288 sdkVersion : string | undefined
289- source : 'browser' | 'flutter'
289+ source : 'browser' | 'flutter' | 'unity'
290290 variant : string | undefined
291291}
292292
Original file line number Diff line number Diff line change @@ -158,10 +158,16 @@ describe('endpointBuilder', () => {
158158 expect ( endpoint ) . toContain ( 'ddsource=browser' )
159159 } )
160160
161- it ( 'should source when provided' , ( ) => {
161+ it ( 'should use flutter source when provided' , ( ) => {
162162 const config = { ...initConfiguration , source : 'flutter' as const }
163163 const endpoint = createEndpointBuilder ( config , 'rum' ) . build ( 'fetch' , DEFAULT_PAYLOAD )
164164 expect ( endpoint ) . toContain ( 'ddsource=flutter' )
165165 } )
166+
167+ it ( 'should use unity source when provided' , ( ) => {
168+ const config = { ...initConfiguration , source : 'unity' as const }
169+ const endpoint = createEndpointBuilder ( config , 'rum' ) . build ( 'fetch' , DEFAULT_PAYLOAD )
170+ expect ( endpoint ) . toContain ( 'ddsource=unity' )
171+ } )
166172 } )
167173} )
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export interface TransportConfiguration {
1313 datacenter ?: string | undefined
1414 replica ?: ReplicaConfiguration
1515 site : Site
16- source : 'browser' | 'flutter'
16+ source : 'browser' | 'flutter' | 'unity'
1717}
1818
1919export interface ReplicaConfiguration {
@@ -23,7 +23,7 @@ export interface ReplicaConfiguration {
2323
2424export function computeTransportConfiguration ( initConfiguration : InitConfiguration ) : TransportConfiguration {
2525 const site = initConfiguration . site || INTAKE_SITE_US1
26- const source = initConfiguration . source === 'flutter' ? 'flutter' : 'browser'
26+ const source = validateSource ( initConfiguration . source )
2727
2828 const endpointBuilders = computeEndpointBuilders ( { ...initConfiguration , site, source } )
2929 const replicaConfiguration = computeReplicaConfiguration ( { ...initConfiguration , site, source } )
@@ -36,6 +36,13 @@ export function computeTransportConfiguration(initConfiguration: InitConfigurati
3636 }
3737}
3838
39+ function validateSource ( source : string | undefined ) {
40+ if ( source === 'flutter' || source === 'unity' ) {
41+ return source
42+ }
43+ return 'browser'
44+ }
45+
3946function computeEndpointBuilders ( initConfiguration : InitConfiguration ) {
4047 return {
4148 logsEndpointBuilder : createEndpointBuilder ( initConfiguration , 'logs' ) ,
You can’t perform that action at this time.
0 commit comments