@datadog/mobile-react-native 2.1.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DatadogSDKReactNative.podspec +8 -7
- package/android/build.gradle +5 -4
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +2 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +11 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdLogsImplementation.kt +5 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdRumImplementation.kt +3 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +64 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +164 -4
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +6 -354
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkNativeInitialization.kt +351 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkReactNativePackage.kt +5 -3
- package/android/src/main/kotlin/com/datadog/reactnative/DdTraceImplementation.kt +10 -0
- package/android/src/main/kotlin/com/datadog/reactnative/JSONFileReader.kt +20 -0
- package/android/src/main/kotlin/com/datadog/reactnative/ProxyAuthenticator.kt +4 -1
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +10 -0
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdLogs.kt +3 -2
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt +5 -2
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdSdk.kt +3 -2
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkConfigurationTest.kt +196 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkNativeInitializationTest.kt +181 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +12 -271
- package/android/src/test/kotlin/com/datadog/reactnative/DdTraceTest.kt +10 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +28 -1
- package/android/src/test/kotlin/com/datadog/tools/unit/MapExt.kt +24 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/ActionEventForgeryFactory.kt +1 -1
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +9 -1
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/ResourceEventForgeryFactory.kt +1 -1
- package/android/src/test/resources/input/complete-configuration.json +48 -0
- package/android/src/test/resources/input/malformed-configuration.json +5 -0
- package/android/src/test/resources/input/minimal-configuration.json +8 -0
- package/datadog-configuration.gradle +57 -0
- package/datadog-configuration.schema.json +200 -0
- package/ios/Sources/DatadogSDKWrapper.swift +22 -19
- package/ios/Sources/DdLogsImplementation.swift +14 -0
- package/ios/Sources/DdSdk.h +2 -0
- package/ios/Sources/DdSdk.mm +6 -1
- package/ios/Sources/DdSdkConfiguration.swift +47 -56
- package/ios/Sources/DdSdkImplementation.swift +10 -279
- package/ios/Sources/DdSdkNativeInitialization.swift +218 -0
- package/ios/Sources/DdTraceImplementation.swift +3 -1
- package/ios/Sources/GlobalState.swift +1 -1
- package/ios/Sources/JSONFileReader.swift +28 -0
- package/ios/Sources/RNDdSdkConfiguration.swift +227 -9
- package/ios/Sources/SdkVersion.swift +10 -0
- package/lib/commonjs/DdSdkReactNative.js +24 -66
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +24 -4
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/ProxyConfiguration.js +15 -2
- package/lib/commonjs/ProxyConfiguration.js.map +1 -1
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeModulesTypes.js +2 -2
- package/lib/commonjs/nativeModulesTypes.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js +214 -0
- package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +1 -0
- package/lib/commonjs/types.js +10 -2
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdSdkReactNative.js +23 -65
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +22 -4
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/ProxyConfiguration.js +15 -2
- package/lib/module/ProxyConfiguration.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeModulesTypes.js +2 -2
- package/lib/module/nativeModulesTypes.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js +197 -0
- package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +1 -0
- package/lib/module/types.js +10 -2
- package/lib/module/types.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/DdSdkReactNative.d.ts +0 -9
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +43 -3
- package/lib/typescript/ProxyConfiguration.d.ts +4 -12
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/nativeModulesTypes.d.ts +2 -2
- package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts +2 -1
- package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts +31 -0
- package/lib/typescript/types.d.ts +29 -3
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +7 -4
- package/src/DdSdkReactNative.tsx +58 -101
- package/src/DdSdkReactNativeConfiguration.tsx +26 -7
- package/src/ProxyConfiguration.tsx +17 -3
- package/src/__tests__/DdSdkReactNative.test.tsx +134 -112
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +19 -10
- package/src/__tests__/mock.test.ts +0 -9
- package/src/index.tsx +2 -0
- package/src/nativeModulesTypes.ts +1 -1
- package/src/sdk/DatadogProvider/DatadogProvider.tsx +3 -1
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +12 -5
- package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +1 -2
- package/src/sdk/FileBasedConfiguration/FileBasedConfiguration.ts +235 -0
- package/src/sdk/FileBasedConfiguration/__tests__/FileBasedConfiguration.test.ts +245 -0
- package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/configuration-all-fields.json +22 -0
- package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/malformed-configuration.json +5 -0
- package/src/types.tsx +21 -2
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["VitalsUpdateFrequency","UploadFrequency","BatchSize","isLegacyFirstPartyHost","firstPartyHost","formatFirstPartyHosts","firstPartyHosts","map","host","match","propagatorTypes","PropagatorType","DATADOG","TRACECONTEXT","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","longTaskThresholdMs","nativeLongTaskThresholdMs","nativeViewTracking","nativeInteractionTracking","getFirstPartyHosts","getAdditionalConfig","trackingConsent","TrackingConsent","GRANTED","telemetrySampleRate","vitalsUpdateFrequency","AVERAGE","logEventMapper","errorEventMapper","resourceEventMapper","actionEventMapper","trackFrustrations","uploadFrequency","batchSize","MEDIUM","trackBackgroundEvents","getCustomEndpoints","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","actionNameAttribute","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;;;;;;AAQA;;AAMA;;;;IAEYA,q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FpB,GADqB,EAKrByB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,qBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACY;AAFpB,GADqB,EAKrBJ,gBALqB,CAAzB;AAQA,SAAOA,gBAAP;AACH,CA7EM;;;;AA+EA,MAAMK,4BAAN,SAA2CvB,6BAA3C,CAAyE;AAAA;AAAA;;AAAA,gDAC5BwB,kBAAkB,CAACC,IADS;AAAA;;AAAA;;;IAIpED,kB;;;WAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,kCAAAA,kB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { ProxyConfiguration } from './ProxyConfiguration';\nimport type { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport type { LogEventMapper } from './logs/types';\nimport type { ActionEventMapper } from './rum/eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper';\nimport type { FirstPartyHost } from './rum/types';\nimport { PropagatorType } from './rum/types';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nexport enum UploadFrequency {\n /**\n * Upload data every 1000ms.\n */\n FREQUENT = 'FREQUENT',\n /**\n * Upload data every 5000ms.\n */\n AVERAGE = 'AVERAGE',\n /**\n * Upload data every 10000ms.\n */\n RARE = 'RARE'\n}\n\nexport enum BatchSize {\n /**\n * Upload less frequent, larger batches of data\n */\n LARGE = 'LARGE',\n /**\n * Use default size for batches of data\n */\n MEDIUM = 'MEDIUM',\n /**\n * Upload more frequent, smaller batches of data\n */\n SMALL = 'SMALL'\n}\n\nexport type FirstPartyHostsConfiguration = (\n | FirstPartyHost\n | LegacyFirstPartyHost\n)[];\n\nexport type LegacyFirstPartyHost = string;\n\nconst isLegacyFirstPartyHost = (\n firstPartyHost: FirstPartyHost | LegacyFirstPartyHost\n): firstPartyHost is LegacyFirstPartyHost => {\n return typeof firstPartyHost === 'string';\n};\n\nexport type CustomEndpoints = {\n rum?: string;\n logs?: string;\n trace?: string;\n};\n\n/**\n * Defaults legacy first party hosts format to Datadog first party hosts to keep\n * retro-compatibility before OTel support was introduced.\n */\nexport const formatFirstPartyHosts = (\n firstPartyHosts: FirstPartyHostsConfiguration\n): FirstPartyHost[] => {\n return firstPartyHosts.map(host => {\n if (isLegacyFirstPartyHost(host)) {\n return {\n match: host,\n propagatorTypes: [\n PropagatorType.DATADOG,\n PropagatorType.TRACECONTEXT\n ]\n };\n }\n return host;\n });\n};\n\nconst DEFAULTS = {\n nativeCrashReportEnabled: false,\n sessionSamplingRate: 100.0,\n resourceTracingSamplingRate: 20.0,\n site: 'US1',\n longTaskThresholdMs: 0,\n nativeLongTaskThresholdMs: 200,\n nativeViewTracking: false,\n nativeInteractionTracking: false,\n getFirstPartyHosts: () => [],\n getAdditionalConfig: () => ({}),\n trackingConsent: TrackingConsent.GRANTED,\n telemetrySampleRate: 20.0,\n vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE,\n logEventMapper: null,\n errorEventMapper: null,\n resourceEventMapper: null,\n actionEventMapper: null,\n trackFrustrations: true,\n uploadFrequency: UploadFrequency.AVERAGE,\n batchSize: BatchSize.MEDIUM,\n trackBackgroundEvents: false,\n getCustomEndpoints: () => ({})\n};\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n /**\n * Enables crash reporting for native platforms (iOS, Android). Default `false`.\n */\n public nativeCrashReportEnabled: boolean =\n DEFAULTS.nativeCrashReportEnabled;\n /**\n * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.\n */\n public sampleRate?: number;\n /**\n * Percentage of sampled RUM sessions. Range `0`-`100`.\n */\n public sessionSamplingRate: number = DEFAULTS.sessionSamplingRate;\n /**\n * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.\n */\n public resourceTracingSamplingRate: number =\n DEFAULTS.resourceTracingSamplingRate;\n public site: string = DEFAULTS.site;\n /**\n * Verbosity for internal SDK logging.\n * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.\n */\n public verbosity: SdkVerbosity | undefined = undefined;\n /**\n * Enables native views tracking.\n * Set to `true` if you use a custom navigation system relying on native views.\n */\n public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;\n /**\n * Enables native interaction tracking.\n * Set to `true` if you want to track interactions on native screens.\n */\n public nativeInteractionTracking: boolean =\n DEFAULTS.nativeInteractionTracking;\n public proxyConfig?: ProxyConfiguration = undefined;\n public serviceName?: string = undefined;\n /**\n * List of your backends hosts to enable tracing with.\n * Regular expressions are NOT supported.\n *\n * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.\n */\n public firstPartyHosts: FirstPartyHostsConfiguration = DEFAULTS.getFirstPartyHosts();\n /**\n * Overrides the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.\n */\n public version?: string;\n /**\n * Add a suffix to the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * A dash (`-`) will be automatically added between the version and the suffix\n */\n public versionSuffix?: string;\n\n /**\n * The sampling rate for Internal Telemetry (info related to the work of the\n * SDK internals).\n *\n * The sampling rate must be a value between 0 and 100. A value of 0 means no\n * telemetry will be sent, 100 means all telemetry will be sent. When\n * `telemetrySampleRate` is not set, the default value from the iOS and\n * Android SDK is used, which is 20.\n */\n public telemetrySampleRate: number = DEFAULTS.telemetrySampleRate;\n\n /**\n * The threshold for native long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables native long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `200`.\n */\n public nativeLongTaskThresholdMs: number | false =\n DEFAULTS.nativeLongTaskThresholdMs;\n\n /**\n * The threshold for javascript long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables javascript long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `0`\n */\n public longTaskThresholdMs: number | false = DEFAULTS.longTaskThresholdMs;\n\n /**\n * Sets the preferred frequency for collecting mobile vitals.\n */\n public vitalsUpdateFrequency: VitalsUpdateFrequency =\n DEFAULTS.vitalsUpdateFrequency;\n\n /**\n * Enables tracking of frustration signals (error taps). Defaults to `true`.\n */\n public trackFrustrations: boolean = DEFAULTS.trackFrustrations;\n\n /**\n * Sets the preferred frequency for uploading batches of data.\n */\n public uploadFrequency: UploadFrequency = DEFAULTS.uploadFrequency;\n\n /**\n * Defines the Datadog SDK policy when batching data together before uploading it to Datadog servers.\n * Smaller batches mean smaller but more network requests, whereas larger batches mean fewer but larger network requests.\n */\n public batchSize: BatchSize = DEFAULTS.batchSize;\n\n /**\n * Enables tracking of RUM event when no RUM View is active.\n *\n * By default, background events are not tracked. Enabling this feature might increase the\n * number of sessions tracked and impact your billing.\n */\n public trackBackgroundEvents: boolean = DEFAULTS.trackBackgroundEvents;\n\n /**\n * Specifies a custom prop to name RUM actions on elements having an `onPress` prop.\n *\n * For example if you set it to `testID`, the value of the `testID` prop is used as a custom action name:\n *\n * ```js\n * <TouchableOpacity testID=\"Dismiss notification\" onPress={() => dismiss()}>\n * ```\n *\n * `dd-action-name` is favored when both attributes are present on an element.\n */\n public actionNameAttribute?: string;\n\n public logEventMapper: LogEventMapper | null = DEFAULTS.logEventMapper;\n\n public errorEventMapper: ErrorEventMapper | null =\n DEFAULTS.errorEventMapper;\n\n public resourceEventMapper: ResourceEventMapper | null =\n DEFAULTS.resourceEventMapper;\n\n public actionEventMapper: ActionEventMapper | null =\n DEFAULTS.actionEventMapper;\n\n public additionalConfig: {\n [k: string]: any;\n } = DEFAULTS.getAdditionalConfig();\n\n public customEndpoints: CustomEndpoints = DEFAULTS.getCustomEndpoints();\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent\n ) {}\n}\n\n/**\n * Auto Instrumentation configuration passed to DatadogProvider.\n * Does not include default values.\n */\nexport type AutoInstrumentationConfiguration = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts?: FirstPartyHostsConfiguration;\n readonly resourceTracingSamplingRate?: number;\n readonly trackErrors: boolean;\n readonly logEventMapper?: LogEventMapper | null;\n readonly errorEventMapper?: ErrorEventMapper | null;\n readonly resourceEventMapper?: ResourceEventMapper | null;\n readonly actionEventMapper?: ActionEventMapper | null;\n readonly actionNameAttribute?: string;\n};\n\n/**\n * Parameters needed to start auto instrumentation. Includes default values.\n */\nexport type AutoInstrumentationParameters = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts: FirstPartyHostsConfiguration;\n readonly resourceTracingSamplingRate: number;\n readonly trackErrors: boolean;\n readonly logEventMapper: LogEventMapper | null;\n readonly errorEventMapper: ErrorEventMapper | null;\n readonly resourceEventMapper: ResourceEventMapper | null;\n readonly actionEventMapper: ActionEventMapper | null;\n readonly actionNameAttribute?: string;\n};\n\n/**\n * We could use `Proxy` instead of this function, but `Proxy` is not available on\n * the older android jsc that can still be used.\n */\nexport const addDefaultValuesToAutoInstrumentationConfiguration = (\n features: AutoInstrumentationConfiguration\n): AutoInstrumentationParameters => {\n return {\n ...features,\n firstPartyHosts:\n features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),\n resourceTracingSamplingRate:\n features.resourceTracingSamplingRate === undefined\n ? DEFAULTS.resourceTracingSamplingRate\n : features.resourceTracingSamplingRate,\n logEventMapper:\n features.logEventMapper === undefined\n ? DEFAULTS.logEventMapper\n : features.logEventMapper,\n errorEventMapper:\n features.errorEventMapper === undefined\n ? DEFAULTS.errorEventMapper\n : features.errorEventMapper,\n resourceEventMapper:\n features.resourceEventMapper === undefined\n ? DEFAULTS.resourceEventMapper\n : features.resourceEventMapper,\n actionEventMapper:\n features.actionEventMapper === undefined\n ? DEFAULTS.actionEventMapper\n : features.actionEventMapper\n };\n};\n\nexport type PartialInitializationConfiguration = {\n readonly clientToken: string;\n readonly env: string;\n readonly applicationId: string;\n readonly sessionSamplingRate?: number;\n readonly site?: string;\n readonly verbosity?: SdkVerbosity | undefined;\n readonly nativeViewTracking?: boolean;\n readonly nativeInteractionTracking?: boolean;\n readonly proxyConfig?: ProxyConfiguration;\n readonly serviceName?: string;\n readonly version?: string;\n versionSuffix?: string;\n readonly additionalConfig?: { [k: string]: any };\n readonly trackingConsent?: TrackingConsent;\n readonly longTaskThresholdMs?: number | false;\n readonly nativeLongTaskThresholdMs?: number | false;\n readonly nativeCrashReportEnabled?: boolean;\n readonly telemetrySampleRate?: number;\n readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;\n readonly trackFrustrations?: boolean;\n readonly uploadFrequency?: UploadFrequency;\n readonly batchSize?: BatchSize;\n readonly trackBackgroundEvents?: boolean;\n readonly customEndpoints?: CustomEndpoints;\n};\n\nconst setConfigurationAttribute = <\n AttributeName extends keyof DdSdkReactNativeConfiguration\n>(\n attribute: {\n value?: DdSdkReactNativeConfiguration[AttributeName];\n name: AttributeName;\n },\n configuration: DdSdkReactNativeConfiguration\n) => {\n if (attribute.value !== undefined) {\n configuration[attribute.name] = attribute.value;\n }\n};\n\nexport const buildConfigurationFromPartialConfiguration = (\n features: AutoInstrumentationConfiguration,\n configuration: PartialInitializationConfiguration\n): DdSdkReactNativeConfiguration => {\n const {\n clientToken,\n env,\n applicationId,\n ...remainingConfiguration\n } = configuration;\n const SdkConfiguration = new DdSdkReactNativeConfiguration(\n clientToken,\n env,\n applicationId,\n features.trackInteractions,\n features.trackResources,\n features.trackErrors,\n configuration.trackingConsent\n );\n\n (Object.keys(\n remainingConfiguration\n ) as (keyof typeof remainingConfiguration)[]).forEach(name => {\n setConfigurationAttribute(\n { value: remainingConfiguration[name], name },\n SdkConfiguration\n );\n });\n\n setConfigurationAttribute(\n {\n name: 'resourceTracingSamplingRate',\n value: features.resourceTracingSamplingRate\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n { name: 'firstPartyHosts', value: features.firstPartyHosts },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'logEventMapper',\n value: features.logEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'errorEventMapper',\n value: features.errorEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'resourceEventMapper',\n value: features.resourceEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionEventMapper',\n value: features.actionEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionNameAttribute',\n value: features.actionNameAttribute\n },\n SdkConfiguration\n );\n\n return SdkConfiguration;\n};\n\nexport class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {\n public initializationMode: InitializationMode = InitializationMode.SYNC;\n}\n\nexport enum InitializationMode {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC'\n}\n\nexport type InitializationModeForTelemetry =\n | 'LEGACY'\n | 'SYNC'\n | 'ASYNC'\n | 'PARTIAL';\n"]}
|
|
1
|
+
{"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["VitalsUpdateFrequency","UploadFrequency","BatchSize","isLegacyFirstPartyHost","firstPartyHost","formatFirstPartyHosts","firstPartyHosts","map","host","match","propagatorTypes","PropagatorType","DATADOG","TRACECONTEXT","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","longTaskThresholdMs","nativeLongTaskThresholdMs","nativeViewTracking","nativeInteractionTracking","getFirstPartyHosts","getAdditionalConfiguration","trackingConsent","TrackingConsent","GRANTED","telemetrySampleRate","vitalsUpdateFrequency","AVERAGE","logEventMapper","errorEventMapper","resourceEventMapper","actionEventMapper","trackFrustrations","uploadFrequency","batchSize","MEDIUM","trackBackgroundEvents","getCustomEndpoints","bundleLogsWithRum","bundleLogsWithTraces","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","actionNameAttribute","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;;;;;;AAQA;;AAMA;;;;IAEYA,qB;;;WAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;GAAAA,qB,qCAAAA,qB;;IAOAC,e;;;WAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;GAAAA,e,+BAAAA,e;;IAeAC,S;;;WAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;GAAAA,S,yBAAAA,S;;AAsBZ,MAAMC,sBAAsB,GACxBC,cAD2B,IAEc;AACzC,SAAO,OAAOA,cAAP,KAA0B,QAAjC;AACH,CAJD;;AAYA;AACA;AACA;AACA;AACO,MAAMC,qBAAqB,GAC9BC,eADiC,IAEd;AACnB,SAAOA,eAAe,CAACC,GAAhB,CAAoBC,IAAI,IAAI;AAC/B,QAAIL,sBAAsB,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,kBAAkB,CAACC,IADS;AAAA;;AAAA;;;IAIpED,kB;;;WAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,kCAAAA,kB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { ProxyConfiguration } from './ProxyConfiguration';\nimport type { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport type { LogEventMapper } from './logs/types';\nimport type { ActionEventMapper } from './rum/eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper';\nimport type { FirstPartyHost } from './rum/types';\nimport { PropagatorType } from './rum/types';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nexport enum UploadFrequency {\n /**\n * Upload data every 1000ms.\n */\n FREQUENT = 'FREQUENT',\n /**\n * Upload data every 5000ms.\n */\n AVERAGE = 'AVERAGE',\n /**\n * Upload data every 10000ms.\n */\n RARE = 'RARE'\n}\n\nexport enum BatchSize {\n /**\n * Upload less frequent, larger batches of data\n */\n LARGE = 'LARGE',\n /**\n * Use default size for batches of data\n */\n MEDIUM = 'MEDIUM',\n /**\n * Upload more frequent, smaller batches of data\n */\n SMALL = 'SMALL'\n}\n\nexport type FirstPartyHostsConfiguration = (\n | FirstPartyHost\n | LegacyFirstPartyHost\n)[];\n\nexport type LegacyFirstPartyHost = string;\n\nconst isLegacyFirstPartyHost = (\n firstPartyHost: FirstPartyHost | LegacyFirstPartyHost\n): firstPartyHost is LegacyFirstPartyHost => {\n return typeof firstPartyHost === 'string';\n};\n\nexport type CustomEndpoints = {\n rum?: string;\n logs?: string;\n trace?: string;\n};\n\n/**\n * Defaults legacy first party hosts format to Datadog first party hosts to keep\n * retro-compatibility before OTel support was introduced.\n */\nexport const formatFirstPartyHosts = (\n firstPartyHosts: FirstPartyHostsConfiguration\n): FirstPartyHost[] => {\n return firstPartyHosts.map(host => {\n if (isLegacyFirstPartyHost(host)) {\n return {\n match: host,\n propagatorTypes: [\n PropagatorType.DATADOG,\n PropagatorType.TRACECONTEXT\n ]\n };\n }\n return host;\n });\n};\n\nexport const DEFAULTS = {\n nativeCrashReportEnabled: false,\n sessionSamplingRate: 100.0,\n resourceTracingSamplingRate: 20.0,\n site: 'US1',\n longTaskThresholdMs: 0,\n nativeLongTaskThresholdMs: 200,\n nativeViewTracking: false,\n nativeInteractionTracking: false,\n getFirstPartyHosts: () => [],\n getAdditionalConfiguration: () => ({}),\n trackingConsent: TrackingConsent.GRANTED,\n telemetrySampleRate: 20.0,\n vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE,\n logEventMapper: null,\n errorEventMapper: null,\n resourceEventMapper: null,\n actionEventMapper: null,\n trackFrustrations: true,\n uploadFrequency: UploadFrequency.AVERAGE,\n batchSize: BatchSize.MEDIUM,\n trackBackgroundEvents: false,\n getCustomEndpoints: () => ({}),\n bundleLogsWithRum: true,\n bundleLogsWithTraces: true\n};\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n /**\n * Enables crash reporting for native platforms (iOS, Android). Default `false`.\n */\n public nativeCrashReportEnabled: boolean =\n DEFAULTS.nativeCrashReportEnabled;\n /**\n * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.\n */\n public sampleRate?: number;\n /**\n * Percentage of sampled RUM sessions. Range `0`-`100`.\n */\n public sessionSamplingRate: number = DEFAULTS.sessionSamplingRate;\n /**\n * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.\n */\n public resourceTracingSamplingRate: number =\n DEFAULTS.resourceTracingSamplingRate;\n public site: string = DEFAULTS.site;\n /**\n * Verbosity for internal SDK logging.\n * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.\n */\n public verbosity: SdkVerbosity | undefined = undefined;\n /**\n * Enables native views tracking.\n * Set to `true` if you use a custom navigation system relying on native views.\n */\n public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;\n /**\n * Enables native interaction tracking.\n * Set to `true` if you want to track interactions on native screens.\n */\n public nativeInteractionTracking: boolean =\n DEFAULTS.nativeInteractionTracking;\n public proxyConfig?: ProxyConfiguration = undefined;\n public serviceName?: string = undefined;\n /**\n * List of your backends hosts to enable tracing with.\n * Regular expressions are NOT supported.\n *\n * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.\n */\n public firstPartyHosts: FirstPartyHostsConfiguration = DEFAULTS.getFirstPartyHosts();\n /**\n * Overrides the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.\n */\n public version?: string;\n /**\n * Add a suffix to the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * A dash (`-`) will be automatically added between the version and the suffix\n */\n public versionSuffix?: string;\n\n /**\n * The sampling rate for Internal Telemetry (info related to the work of the\n * SDK internals).\n *\n * The sampling rate must be a value between 0 and 100. A value of 0 means no\n * telemetry will be sent, 100 means all telemetry will be sent. When\n * `telemetrySampleRate` is not set, the default value from the iOS and\n * Android SDK is used, which is 20.\n */\n public telemetrySampleRate: number = DEFAULTS.telemetrySampleRate;\n\n /**\n * The threshold for native long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables native long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `200`.\n */\n public nativeLongTaskThresholdMs: number | false =\n DEFAULTS.nativeLongTaskThresholdMs;\n\n /**\n * The threshold for javascript long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables javascript long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `0`\n */\n public longTaskThresholdMs: number | false = DEFAULTS.longTaskThresholdMs;\n\n /**\n * Sets the preferred frequency for collecting mobile vitals.\n */\n public vitalsUpdateFrequency: VitalsUpdateFrequency =\n DEFAULTS.vitalsUpdateFrequency;\n\n /**\n * Enables tracking of frustration signals (error taps). Defaults to `true`.\n */\n public trackFrustrations: boolean = DEFAULTS.trackFrustrations;\n\n /**\n * Sets the preferred frequency for uploading batches of data.\n */\n public uploadFrequency: UploadFrequency = DEFAULTS.uploadFrequency;\n\n /**\n * Defines the Datadog SDK policy when batching data together before uploading it to Datadog servers.\n * Smaller batches mean smaller but more network requests, whereas larger batches mean fewer but larger network requests.\n */\n public batchSize: BatchSize = DEFAULTS.batchSize;\n\n /**\n * Enables tracking of RUM event when no RUM View is active.\n *\n * By default, background events are not tracked. Enabling this feature might increase the\n * number of sessions tracked and impact your billing.\n */\n public trackBackgroundEvents: boolean = DEFAULTS.trackBackgroundEvents;\n\n /**\n * Enables RUM correlation with logs.\n *\n * By default, RUM is enabled for logs.\n */\n public bundleLogsWithRum: boolean = DEFAULTS.bundleLogsWithRum;\n\n /**\n * Enables Traces correlation with logs.\n *\n * By default, Traces is enabled for logs.\n */\n public bundleLogsWithTraces: boolean = DEFAULTS.bundleLogsWithTraces;\n\n /**\n * Specifies a custom prop to name RUM actions on elements having an `onPress` prop.\n *\n * For example if you set it to `testID`, the value of the `testID` prop is used as a custom action name:\n *\n * ```js\n * <TouchableOpacity testID=\"Dismiss notification\" onPress={() => dismiss()}>\n * ```\n *\n * `dd-action-name` is favored when both attributes are present on an element.\n */\n public actionNameAttribute?: string;\n\n public logEventMapper: LogEventMapper | null = DEFAULTS.logEventMapper;\n\n public errorEventMapper: ErrorEventMapper | null =\n DEFAULTS.errorEventMapper;\n\n public resourceEventMapper: ResourceEventMapper | null =\n DEFAULTS.resourceEventMapper;\n\n public actionEventMapper: ActionEventMapper | null =\n DEFAULTS.actionEventMapper;\n\n public additionalConfiguration: {\n [k: string]: any;\n } = DEFAULTS.getAdditionalConfiguration();\n\n public customEndpoints: CustomEndpoints = DEFAULTS.getCustomEndpoints();\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent\n ) {}\n}\n\n/**\n * Auto Instrumentation configuration passed to DatadogProvider.\n * Does not include default values.\n */\nexport type AutoInstrumentationConfiguration = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts?: FirstPartyHostsConfiguration;\n readonly resourceTracingSamplingRate?: number;\n readonly trackErrors: boolean;\n readonly logEventMapper?: LogEventMapper | null;\n readonly errorEventMapper?: ErrorEventMapper | null;\n readonly resourceEventMapper?: ResourceEventMapper | null;\n readonly actionEventMapper?: ActionEventMapper | null;\n readonly actionNameAttribute?: string;\n};\n\n/**\n * Parameters needed to start auto instrumentation. Includes default values.\n */\nexport type AutoInstrumentationParameters = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts: FirstPartyHostsConfiguration;\n readonly resourceTracingSamplingRate: number;\n readonly trackErrors: boolean;\n readonly logEventMapper: LogEventMapper | null;\n readonly errorEventMapper: ErrorEventMapper | null;\n readonly resourceEventMapper: ResourceEventMapper | null;\n readonly actionEventMapper: ActionEventMapper | null;\n readonly actionNameAttribute?: string;\n};\n\n/**\n * We could use `Proxy` instead of this function, but `Proxy` is not available on\n * the older android jsc that can still be used.\n */\nexport const addDefaultValuesToAutoInstrumentationConfiguration = (\n features: AutoInstrumentationConfiguration\n): AutoInstrumentationParameters => {\n return {\n ...features,\n firstPartyHosts:\n features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),\n resourceTracingSamplingRate:\n features.resourceTracingSamplingRate === undefined\n ? DEFAULTS.resourceTracingSamplingRate\n : features.resourceTracingSamplingRate,\n logEventMapper:\n features.logEventMapper === undefined\n ? DEFAULTS.logEventMapper\n : features.logEventMapper,\n errorEventMapper:\n features.errorEventMapper === undefined\n ? DEFAULTS.errorEventMapper\n : features.errorEventMapper,\n resourceEventMapper:\n features.resourceEventMapper === undefined\n ? DEFAULTS.resourceEventMapper\n : features.resourceEventMapper,\n actionEventMapper:\n features.actionEventMapper === undefined\n ? DEFAULTS.actionEventMapper\n : features.actionEventMapper\n };\n};\n\nexport type PartialInitializationConfiguration = {\n readonly clientToken: string;\n readonly env: string;\n readonly applicationId: string;\n readonly sessionSamplingRate?: number;\n readonly site?: string;\n readonly verbosity?: SdkVerbosity | undefined;\n readonly nativeViewTracking?: boolean;\n readonly nativeInteractionTracking?: boolean;\n readonly proxyConfig?: ProxyConfiguration;\n readonly serviceName?: string;\n readonly version?: string;\n versionSuffix?: string;\n readonly additionalConfiguration?: { [k: string]: any };\n readonly trackingConsent?: TrackingConsent;\n readonly longTaskThresholdMs?: number | false;\n readonly nativeLongTaskThresholdMs?: number | false;\n readonly nativeCrashReportEnabled?: boolean;\n readonly telemetrySampleRate?: number;\n readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;\n readonly trackFrustrations?: boolean;\n readonly uploadFrequency?: UploadFrequency;\n readonly batchSize?: BatchSize;\n readonly trackBackgroundEvents?: boolean;\n readonly customEndpoints?: CustomEndpoints;\n readonly bundleLogsWithRum?: boolean;\n readonly bundleLogsWithTraces?: boolean;\n};\n\nconst setConfigurationAttribute = <\n AttributeName extends keyof DdSdkReactNativeConfiguration\n>(\n attribute: {\n value?: DdSdkReactNativeConfiguration[AttributeName];\n name: AttributeName;\n },\n configuration: DdSdkReactNativeConfiguration\n) => {\n if (attribute.value !== undefined) {\n configuration[attribute.name] = attribute.value;\n }\n};\n\nexport const buildConfigurationFromPartialConfiguration = (\n features: AutoInstrumentationConfiguration,\n configuration: PartialInitializationConfiguration\n): DdSdkReactNativeConfiguration => {\n const {\n clientToken,\n env,\n applicationId,\n ...remainingConfiguration\n } = configuration;\n const SdkConfiguration = new DdSdkReactNativeConfiguration(\n clientToken,\n env,\n applicationId,\n features.trackInteractions,\n features.trackResources,\n features.trackErrors,\n configuration.trackingConsent\n );\n\n (Object.keys(\n remainingConfiguration\n ) as (keyof typeof remainingConfiguration)[]).forEach(name => {\n setConfigurationAttribute(\n { value: remainingConfiguration[name], name },\n SdkConfiguration\n );\n });\n\n setConfigurationAttribute(\n {\n name: 'resourceTracingSamplingRate',\n value: features.resourceTracingSamplingRate\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n { name: 'firstPartyHosts', value: features.firstPartyHosts },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'logEventMapper',\n value: features.logEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'errorEventMapper',\n value: features.errorEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'resourceEventMapper',\n value: features.resourceEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionEventMapper',\n value: features.actionEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionNameAttribute',\n value: features.actionNameAttribute\n },\n SdkConfiguration\n );\n\n return SdkConfiguration;\n};\n\nexport class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {\n public initializationMode: InitializationMode = InitializationMode.SYNC;\n}\n\nexport enum InitializationMode {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC'\n}\n\nexport type InitializationModeForTelemetry =\n | 'LEGACY'\n | 'SYNC'\n | 'ASYNC'\n | 'PARTIAL'\n | 'FILE';\n"]}
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ProxyType = exports.ProxyConfiguration = void 0;
|
|
7
7
|
|
|
8
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* Proxy server configuration.
|
|
10
12
|
*/
|
|
@@ -35,8 +37,19 @@ class ProxyConfiguration {
|
|
|
35
37
|
this.type = type;
|
|
36
38
|
this.address = address;
|
|
37
39
|
this.port = port;
|
|
38
|
-
|
|
39
|
-
this
|
|
40
|
+
|
|
41
|
+
_defineProperty(this, "username", void 0);
|
|
42
|
+
|
|
43
|
+
_defineProperty(this, "password", void 0);
|
|
44
|
+
|
|
45
|
+
if (username && password) {
|
|
46
|
+
if (type === ProxyType.SOCKS) {
|
|
47
|
+
console.warn("SOCKS proxy configuration doesn't support Basic authentication.");
|
|
48
|
+
} else {
|
|
49
|
+
this.username = username;
|
|
50
|
+
this.password = password;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
40
53
|
}
|
|
41
54
|
|
|
42
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ProxyConfiguration.tsx"],"names":["ProxyConfiguration","constructor","type","address","port","username","password","ProxyType"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["ProxyConfiguration.tsx"],"names":["ProxyConfiguration","constructor","type","address","port","username","password","ProxyType","SOCKS","console","warn"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA,MAAMA,kBAAN,CAAyB;AAIrBC,EAAAA,WAAW;AACP;AACR;AACA;AACiBC,EAAAA,IAJF;AAKP;AACR;AACA;AACiBC,EAAAA,OARF;AASP;AACR;AACA;AACiBC,EAAAA,IAZF;AAaP;AACR;AACA;AACA;AACA;AACQC,EAAAA,QAlBO;AAmBP;AACR;AACA;AACQC,EAAAA,QAtBO,EAuBT;AAAA,SAnBWJ,IAmBX,GAnBWA,IAmBX;AAAA,SAfWC,OAeX,GAfWA,OAeX;AAAA,SAXWC,IAWX,GAXWA,IAWX;;AAAA;;AAAA;;AACE,QAAIC,QAAQ,IAAIC,QAAhB,EAA0B;AACtB,UAAIJ,IAAI,KAAKK,SAAS,CAACC,KAAvB,EAA8B;AAC1BC,QAAAA,OAAO,CAACC,IAAR,CACI,iEADJ;AAGH,OAJD,MAIO;AACH,aAAKL,QAAL,GAAgBA,QAAhB;AACA,aAAKC,QAAL,GAAgBA,QAAhB;AACH;AACJ;AACJ;;AAtCoB;;;IAyCpBC,S;;;WAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;GAAAA,S,yBAAAA,S","sourcesContent":["/**\n * Proxy server configuration.\n */\nclass ProxyConfiguration {\n username?: string;\n password?: string;\n\n constructor(\n /**\n * Proxy type.\n */\n readonly type: ProxyType,\n /**\n * Proxy address. Can be either in the IP address format, ex. \"1.1.1.1\", or hostname, ex. \"example.com\".\n */\n readonly address: string,\n /**\n * Proxy port.\n */\n readonly port: number,\n /**\n * Username for Basic authentication scheme.\n *\n * Note: \"SOCKS + authentication\" scheme is not supported.\n */\n username?: string,\n /**\n * Password for Basic authentication scheme.\n */\n password?: string\n ) {\n if (username && password) {\n if (type === ProxyType.SOCKS) {\n console.warn(\n \"SOCKS proxy configuration doesn't support Basic authentication.\"\n );\n } else {\n this.username = username;\n this.password = password;\n }\n }\n }\n}\n\nenum ProxyType {\n HTTP = 'http',\n HTTPS = 'https',\n SOCKS = 'socks'\n}\n\nexport { ProxyConfiguration, ProxyType };\n"]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -129,6 +129,12 @@ Object.defineProperty(exports, "DatadogProvider", {
|
|
|
129
129
|
return _DatadogProvider.DatadogProvider;
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
|
+
Object.defineProperty(exports, "FileBasedConfiguration", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function () {
|
|
135
|
+
return _FileBasedConfiguration.FileBasedConfiguration;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
132
138
|
Object.defineProperty(exports, "DdTrace", {
|
|
133
139
|
enumerable: true,
|
|
134
140
|
get: function () {
|
|
@@ -158,5 +164,7 @@ var _types = require("./rum/types");
|
|
|
158
164
|
|
|
159
165
|
var _DatadogProvider = require("./sdk/DatadogProvider/DatadogProvider");
|
|
160
166
|
|
|
167
|
+
var _FileBasedConfiguration = require("./sdk/FileBasedConfiguration/FileBasedConfiguration");
|
|
168
|
+
|
|
161
169
|
var _DdTrace = require("./trace/DdTrace");
|
|
162
170
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport {\n DatadogProviderConfiguration,\n DdSdkReactNativeConfiguration,\n InitializationMode,\n VitalsUpdateFrequency,\n UploadFrequency,\n BatchSize\n} from './DdSdkReactNativeConfiguration';\nimport { DdSdkReactNative } from './DdSdkReactNative';\nimport { InternalLog } from './InternalLog';\nimport { ProxyConfiguration, ProxyType } from './ProxyConfiguration';\nimport { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport { DdLogs } from './logs/DdLogs';\nimport { DdRum } from './rum/DdRum';\nimport {\n DATADOG_GRAPH_QL_OPERATION_TYPE_HEADER,\n DATADOG_GRAPH_QL_OPERATION_NAME_HEADER,\n DATADOG_GRAPH_QL_VARIABLES_HEADER\n} from './rum/instrumentation/resourceTracking/graphql/graphqlHeaders';\nimport { RumActionType, ErrorSource, PropagatorType } from './rum/types';\nimport { DatadogProvider } from './sdk/DatadogProvider/DatadogProvider';\nimport { FileBasedConfiguration } from './sdk/FileBasedConfiguration/FileBasedConfiguration';\nimport { DdTrace } from './trace/DdTrace';\n\nexport {\n DatadogProvider,\n DatadogProviderConfiguration,\n FileBasedConfiguration,\n InitializationMode,\n DdLogs,\n DdTrace,\n DdRum,\n RumActionType,\n ErrorSource,\n DdSdkReactNativeConfiguration,\n DdSdkReactNative,\n InternalLog,\n ProxyConfiguration,\n ProxyType,\n TrackingConsent,\n SdkVerbosity,\n VitalsUpdateFrequency,\n PropagatorType,\n UploadFrequency,\n BatchSize,\n DATADOG_GRAPH_QL_OPERATION_TYPE_HEADER,\n DATADOG_GRAPH_QL_OPERATION_NAME_HEADER,\n DATADOG_GRAPH_QL_VARIABLES_HEADER\n};\n"]}
|
|
@@ -28,7 +28,7 @@ exports.DdNativeSdkConfiguration = void 0;
|
|
|
28
28
|
* A configuration object to initialize Datadog's features.
|
|
29
29
|
*/
|
|
30
30
|
class DdNativeSdkConfiguration {
|
|
31
|
-
constructor(clientToken, env, applicationId, nativeCrashReportEnabled, sampleRate, site, trackingConsent,
|
|
31
|
+
constructor(clientToken, env, applicationId, nativeCrashReportEnabled, sampleRate, site, trackingConsent, additionalConfiguration) {
|
|
32
32
|
this.clientToken = clientToken;
|
|
33
33
|
this.env = env;
|
|
34
34
|
this.applicationId = applicationId;
|
|
@@ -36,7 +36,7 @@ class DdNativeSdkConfiguration {
|
|
|
36
36
|
this.sampleRate = sampleRate;
|
|
37
37
|
this.site = site;
|
|
38
38
|
this.trackingConsent = trackingConsent;
|
|
39
|
-
this.
|
|
39
|
+
this.additionalConfiguration = additionalConfiguration;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["nativeModulesTypes.ts"],"names":["DdNativeSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","sampleRate","site","trackingConsent","
|
|
1
|
+
{"version":3,"sources":["nativeModulesTypes.ts"],"names":["DdNativeSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","sampleRate","site","trackingConsent","additionalConfiguration"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACO,MAAMA,wBAAN,CAA+B;AAClCC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,UALF,EAMEC,IANF,EAOEC,eAPF,EAQEC,uBARF,EAST;AAAA,SARWP,WAQX,GARWA,WAQX;AAAA,SAPWC,GAOX,GAPWA,GAOX;AAAA,SANWC,aAMX,GANWA,aAMX;AAAA,SALWC,wBAKX,GALWA,wBAKX;AAAA,SAJWC,UAIX,GAJWA,UAIX;AAAA,SAHWC,IAGX,GAHWA,IAGX;AAAA,SAFWC,eAEX,GAFWA,eAEX;AAAA,SADWC,uBACX,GADWA,uBACX;AAAE;;AAV8B;AAatC;AACA;AACA","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { Spec as NativeDdLogs } from './specs/NativeDdLogs';\nimport type { Spec as NativeDdRum } from './specs/NativeDdRum';\nimport type { Spec as NativeDdSdk } from './specs/NativeDdSdk';\nimport type { Spec as NativeDdTrace } from './specs/NativeDdTrace';\n\n/**\n * In this file, native modules types extend the specs for TurboModules.\n * As we cannot use enums or classes in the specs, we override methods using them here.\n */\n\n/**\n * The entry point to use Datadog's Logs feature.\n */\nexport type DdNativeLogsType = NativeDdLogs;\n\n/**\n * The entry point to use Datadog's Trace feature.\n */\nexport type DdNativeTraceType = NativeDdTrace;\n\n/**\n * A configuration object to initialize Datadog's features.\n */\nexport class DdNativeSdkConfiguration {\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly nativeCrashReportEnabled: boolean,\n readonly sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfiguration: object\n ) {}\n}\n\n/**\n * The entry point to initialize Datadog's features.\n */\nexport interface DdNativeSdkType extends NativeDdSdk {\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: DdNativeSdkConfiguration): Promise<void>;\n}\n\ntype ActionType = 'TAP' | 'SCROLL' | 'SWIPE' | 'BACK' | 'CUSTOM';\n\ntype ResourceKind =\n | 'image'\n | 'xhr'\n | 'beacon'\n | 'css'\n | 'document'\n | 'fetch'\n | 'font'\n | 'js'\n | 'media'\n | 'other'\n | 'native';\n\ntype ErrorSource = 'NETWORK' | 'SOURCE' | 'CONSOLE' | 'WEBVIEW' | 'CUSTOM';\n\n/**\n * The entry point to use Datadog's RUM feature.\n */\nexport interface DdNativeRumType extends NativeDdRum {\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: ActionType,\n name: string,\n context: object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(\n type: ActionType,\n name: string,\n context: object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Add a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addAction(\n type: ActionType,\n name: string,\n context: object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: ResourceKind,\n size: number,\n context: object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: ErrorSource,\n stacktrace: string,\n context: object,\n timestampMs: number\n ): Promise<void>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DatadogProvider.tsx"],"names":["isInitialized","isConfigurationPartial","configuration","DatadogProviderConfiguration","DdSdkReactNativeConfiguration","console","warn","initializeDatadog","onInitialization","DdSdkReactNative","_initializeFromDatadogProvider","error","InternalLog","log","SdkVerbosity","WARN","DatadogProvider","children","_enableFeaturesFromDatadogProvider","initialize","_initializeFromDatadogProviderWithConfigurationAsync","__internalResetIsInitializedForTesting"],"mappings":";;;;;;;AAKA;;AAGA;;AAQA;;AACA;;AACA;;;;AAlBA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"sources":["DatadogProvider.tsx"],"names":["isInitialized","isConfigurationPartial","configuration","DatadogProviderConfiguration","DdSdkReactNativeConfiguration","console","warn","initializeDatadog","onInitialization","DdSdkReactNative","_initializeFromDatadogProvider","error","InternalLog","log","SdkVerbosity","WARN","DatadogProvider","children","_enableFeaturesFromDatadogProvider","initialize","_initializeFromDatadogProviderWithConfigurationAsync","__internalResetIsInitializedForTesting"],"mappings":";;;;;;;AAKA;;AAGA;;AAQA;;AACA;;AACA;;;;AAlBA;AACA;AACA;AACA;AACA;AAiBA,IAAIA,aAAa,GAAG,KAApB;;AAyBA,MAAMC,sBAAsB,GACxBC,aAD2B,IAIyB;AACpD,MAAIA,aAAa,YAAYC,2DAA7B,EAA2D;AACvD,WAAO,KAAP;AACH;;AACD,MAAID,aAAa,YAAYE,4DAA7B,EAA4D;AACxD;AACAC,IAAAA,OAAO,CAACC,IAAR,CACI,iHADJ;AAGA,WAAO,KAAP;AACH;;AACD,SAAO,IAAP;AACH,CAhBD;;AAkBA,MAAMC,iBAAiB,GAAG,OACtBL,aADsB,EAEtBM,gBAFsB,KAGrB;AACD,QAAMC,mCAAiBC,8BAAjB,CAAgDR,aAAhD,CAAN;;AACA,MAAIM,gBAAJ,EAAsB;AAClB,QAAI;AACAA,MAAAA,gBAAgB;AACnB,KAFD,CAEE,OAAOG,KAAP,EAAc;AACZC,+BAAYC,GAAZ,CACK,2CAA0CF,KAAM,EADrD,EAEIG,2BAAaC,IAFjB;AAIH;AACJ;AACJ,CAfD;AAiBA;AACA;AACA;;;AACO,MAAMC,eAAmD,GAAG,CAAC;AAChEC,EAAAA,QADgE;AAEhEf,EAAAA,aAFgE;AAGhEM,EAAAA;AAHgE,CAAD,KAI7D;AACF,MAAI,CAACR,aAAL,EAAoB;AAChB;AACA;AACA;AACA;AACA,QAAIC,sBAAsB,CAACC,aAAD,CAA1B,EAA2C;AACvCO,yCAAiBS,kCAAjB,CAAoDhB,aAApD;;AACAc,MAAAA,eAAe,CAACR,gBAAhB,GAAmCA,gBAAnC;AACH,KAHD,MAGO;AACHD,MAAAA,iBAAiB,CAACL,aAAD,EAAgBM,gBAAhB,CAAjB;AACH;;AACDR,IAAAA,aAAa,GAAG,IAAhB;AACH;;AAED,sBAAO,4DAAGiB,QAAH,CAAP;AACH,CApBM;AAsBP;AACA;AACA;AACA;;;;;AACAD,eAAe,CAACG,UAAhB,GAA6B,MACzBjB,aADyB,IAExB;AACD,QAAMO,mCAAiBW,oDAAjB,CACFlB,aADE,CAAN;;AAGA,MAAIc,eAAe,CAACR,gBAApB,EAAsC;AAClCQ,IAAAA,eAAe,CAACR,gBAAhB;AACH;AACJ,CATD;;AAWO,MAAMa,sCAAsC,GAAG,MAAM;AACxDrB,EAAAA,aAAa,GAAG,KAAhB;AACH,CAFM","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\nimport React from 'react';\nimport type { PropsWithChildren } from 'react';\n\nimport {\n DatadogProviderConfiguration,\n DdSdkReactNativeConfiguration\n} from '../../DdSdkReactNativeConfiguration';\nimport type {\n PartialInitializationConfiguration,\n AutoInstrumentationConfiguration\n} from '../../DdSdkReactNativeConfiguration';\nimport { DdSdkReactNative } from '../../DdSdkReactNative';\nimport { InternalLog } from '../../InternalLog';\nimport { SdkVerbosity } from '../../SdkVerbosity';\nimport type { FileBasedConfiguration } from '../FileBasedConfiguration/FileBasedConfiguration';\n\nlet isInitialized = false;\n\ntype Props = PropsWithChildren<{\n /**\n * If a `DatadogProviderConfiguration` instance is passed, the SDK will start tracking errors, resources and actions and sending events.\n *\n * If a `AutoInstrumentationConfiguration` object is passed, the SDK will start tracking errors, resources and actions. To start sending events, call `DatadogProvider.initialize`.\n */\n configuration:\n | DatadogProviderConfiguration\n | AutoInstrumentationConfiguration\n | FileBasedConfiguration;\n /**\n * Callback to be run once the SDK starts sending events.\n */\n onInitialization?: () => void;\n}>;\n\ntype StaticProperties = {\n initialize: (\n configuration: PartialInitializationConfiguration\n ) => Promise<void>;\n onInitialization?: () => void;\n};\n\nconst isConfigurationPartial = (\n configuration:\n | DatadogProviderConfiguration\n | AutoInstrumentationConfiguration\n): configuration is AutoInstrumentationConfiguration => {\n if (configuration instanceof DatadogProviderConfiguration) {\n return false;\n }\n if (configuration instanceof DdSdkReactNativeConfiguration) {\n // Not using InternalLog here as it is not yet instantiated\n console.warn(\n 'A DdSdkReactNativeConfiguration was passed to DatadogProvider. Please use DatadogProviderConfiguration instead.'\n );\n return false;\n }\n return true;\n};\n\nconst initializeDatadog = async (\n configuration: DatadogProviderConfiguration,\n onInitialization?: () => void\n) => {\n await DdSdkReactNative._initializeFromDatadogProvider(configuration);\n if (onInitialization) {\n try {\n onInitialization();\n } catch (error) {\n InternalLog.log(\n `Error running onInitialization callback ${error}`,\n SdkVerbosity.WARN\n );\n }\n }\n};\n\n/**\n * Set up the Datadog React Native SDK.\n */\nexport const DatadogProvider: React.FC<Props> & StaticProperties = ({\n children,\n configuration,\n onInitialization\n}) => {\n if (!isInitialized) {\n // Here we cannot use a useEffect hook since it would be called after\n // the first render. Thus, we wouldn't enable auto-instrumentation on\n // the elements rendered in this first render and what happens during\n // the first render.\n if (isConfigurationPartial(configuration)) {\n DdSdkReactNative._enableFeaturesFromDatadogProvider(configuration);\n DatadogProvider.onInitialization = onInitialization;\n } else {\n initializeDatadog(configuration, onInitialization);\n }\n isInitialized = true;\n }\n\n return <>{children}</>;\n};\n\n/**\n * Initialize the Datadog SDK to start sending RUM events, logs and traces,\n * then execute onInitialization callback if any was provided.\n */\nDatadogProvider.initialize = async (\n configuration: PartialInitializationConfiguration\n) => {\n await DdSdkReactNative._initializeFromDatadogProviderWithConfigurationAsync(\n configuration\n );\n if (DatadogProvider.onInitialization) {\n DatadogProvider.onInitialization();\n }\n};\n\nexport const __internalResetIsInitializedForTesting = () => {\n isInitialized = false;\n};\n"]}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.formatPropagatorType = exports.getJSONConfiguration = exports.FileBasedConfiguration = void 0;
|
|
7
|
+
|
|
8
|
+
var _DdSdkReactNativeConfiguration = require("../../DdSdkReactNativeConfiguration");
|
|
9
|
+
|
|
10
|
+
var _SdkVerbosity = require("../../SdkVerbosity");
|
|
11
|
+
|
|
12
|
+
var _TrackingConsent = require("../../TrackingConsent");
|
|
13
|
+
|
|
14
|
+
var _types = require("../../rum/types");
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
18
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
19
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
20
|
+
*/
|
|
21
|
+
class FileBasedConfiguration extends _DdSdkReactNativeConfiguration.DatadogProviderConfiguration {
|
|
22
|
+
constructor(params) {
|
|
23
|
+
const configuration = getJSONConfiguration(params === null || params === void 0 ? void 0 : params.configuration);
|
|
24
|
+
super(configuration.clientToken, configuration.env, configuration.applicationId, configuration.trackInteractions, configuration.trackResources, configuration.trackErrors, configuration.trackingConsent);
|
|
25
|
+
this.longTaskThresholdMs = configuration.longTaskThresholdMs || _DdSdkReactNativeConfiguration.DEFAULTS.longTaskThresholdMs;
|
|
26
|
+
this.verbosity = configuration.verbosity;
|
|
27
|
+
this.actionNameAttribute = configuration.actionNameAttribute;
|
|
28
|
+
this.resourceTracingSamplingRate = configuration.resourceTracingSamplingRate || _DdSdkReactNativeConfiguration.DEFAULTS.resourceTracingSamplingRate;
|
|
29
|
+
this.firstPartyHosts = configuration.firstPartyHosts || _DdSdkReactNativeConfiguration.DEFAULTS.getFirstPartyHosts();
|
|
30
|
+
this.errorEventMapper = (params === null || params === void 0 ? void 0 : params.errorEventMapper) || _DdSdkReactNativeConfiguration.DEFAULTS.errorEventMapper;
|
|
31
|
+
this.resourceEventMapper = (params === null || params === void 0 ? void 0 : params.resourceEventMapper) || _DdSdkReactNativeConfiguration.DEFAULTS.resourceEventMapper;
|
|
32
|
+
this.actionEventMapper = (params === null || params === void 0 ? void 0 : params.actionEventMapper) || _DdSdkReactNativeConfiguration.DEFAULTS.actionEventMapper;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
exports.FileBasedConfiguration = FileBasedConfiguration;
|
|
38
|
+
|
|
39
|
+
const resolveJSONConfiguration = userSpecifiedConfiguration => {
|
|
40
|
+
if (userSpecifiedConfiguration === undefined || userSpecifiedConfiguration === null) {
|
|
41
|
+
try {
|
|
42
|
+
// This corresponds to a file located at the root of a RN project.
|
|
43
|
+
// /!\ We have to write the require this way as dynamic requires are not supported by Hermes.
|
|
44
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
45
|
+
const jsonContent = require('../../../../../../datadog-configuration.json');
|
|
46
|
+
|
|
47
|
+
if (typeof jsonContent !== 'object' || !jsonContent['configuration']) {
|
|
48
|
+
console.error(`Failed to parse the Datadog configuration file located at the root of the project.
|
|
49
|
+
Your configuration must validate the node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json JSON schema.
|
|
50
|
+
You can use VSCode to check your configuration by adding the following line to your JSON file:
|
|
51
|
+
{
|
|
52
|
+
"$schema": "./node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json",
|
|
53
|
+
}`);
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return jsonContent.configuration;
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.error(`Failed to read Datadog configuration file at the root of the project.
|
|
60
|
+
If you don't have a datadog-configuration.json file at the same level as your node_modules directory,\
|
|
61
|
+
please use the following syntax:\n
|
|
62
|
+
new FileBasedConfiguration({configuration: require('./file/to/configuration-file.json')})
|
|
63
|
+
`);
|
|
64
|
+
return {};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (typeof userSpecifiedConfiguration !== 'object' || !userSpecifiedConfiguration['configuration']) {
|
|
69
|
+
console.error(`Failed to parse the Datadog configuration file you provided.
|
|
70
|
+
Your configuration must validate the node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json JSON schema.
|
|
71
|
+
You can use VSCode to check your configuration by adding the following line to your JSON file:
|
|
72
|
+
{
|
|
73
|
+
"$schema": "./node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json",
|
|
74
|
+
}`);
|
|
75
|
+
return {};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return userSpecifiedConfiguration['configuration'];
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const getJSONConfiguration = userSpecifiedConfiguration => {
|
|
82
|
+
const configuration = resolveJSONConfiguration(userSpecifiedConfiguration);
|
|
83
|
+
return {
|
|
84
|
+
clientToken: configuration.clientToken,
|
|
85
|
+
env: configuration.env,
|
|
86
|
+
applicationId: configuration.applicationId,
|
|
87
|
+
trackInteractions: configuration.trackInteractions,
|
|
88
|
+
trackResources: configuration.trackResources,
|
|
89
|
+
trackErrors: configuration.trackErrors,
|
|
90
|
+
trackingConsent: buildTrackingConsent(configuration.trackingConsent),
|
|
91
|
+
longTaskThresholdMs: configuration.longTaskThresholdMs,
|
|
92
|
+
verbosity: buildSdkVerbosity(configuration.verbosity),
|
|
93
|
+
actionNameAttribute: configuration.actionNameAttribute,
|
|
94
|
+
resourceTracingSamplingRate: configuration.resourceTracingSamplingRate,
|
|
95
|
+
firstPartyHosts: buildFirstPartyHosts(configuration.firstPartyHosts)
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
exports.getJSONConfiguration = getJSONConfiguration;
|
|
100
|
+
|
|
101
|
+
const buildFirstPartyHosts = firstPartyHosts => {
|
|
102
|
+
if (!firstPartyHosts) {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
try {
|
|
107
|
+
return firstPartyHosts.map(({
|
|
108
|
+
match,
|
|
109
|
+
propagatorTypes
|
|
110
|
+
}) => ({
|
|
111
|
+
match,
|
|
112
|
+
propagatorTypes: propagatorTypes.map(formatPropagatorType)
|
|
113
|
+
}));
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.error(`Failed to parse the first party hosts from the Datadog configuration file you provided:
|
|
116
|
+
${error.message}
|
|
117
|
+
The first party hosts will not be set for this session.
|
|
118
|
+
`);
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const formatPropagatorType = propagatorType => {
|
|
124
|
+
switch (propagatorType.toLowerCase()) {
|
|
125
|
+
case 'b3':
|
|
126
|
+
{
|
|
127
|
+
return _types.PropagatorType.B3;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
case 'b3multi':
|
|
131
|
+
{
|
|
132
|
+
return _types.PropagatorType.B3MULTI;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
case 'datadog':
|
|
136
|
+
{
|
|
137
|
+
return _types.PropagatorType.DATADOG;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
case 'tracecontext':
|
|
141
|
+
{
|
|
142
|
+
return _types.PropagatorType.TRACECONTEXT;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
default:
|
|
146
|
+
{
|
|
147
|
+
throw new Error(`Failed to parse propagator type ${propagatorType}.`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
exports.formatPropagatorType = formatPropagatorType;
|
|
153
|
+
|
|
154
|
+
const buildTrackingConsent = trackingConsent => {
|
|
155
|
+
if (trackingConsent === undefined) {
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
switch (trackingConsent.toLowerCase()) {
|
|
160
|
+
case 'granted':
|
|
161
|
+
{
|
|
162
|
+
return _TrackingConsent.TrackingConsent.GRANTED;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
case 'pending':
|
|
166
|
+
{
|
|
167
|
+
return _TrackingConsent.TrackingConsent.PENDING;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
case 'not_granted':
|
|
171
|
+
{
|
|
172
|
+
return _TrackingConsent.TrackingConsent.NOT_GRANTED;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
default:
|
|
176
|
+
{
|
|
177
|
+
return _DdSdkReactNativeConfiguration.DEFAULTS.trackingConsent;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const buildSdkVerbosity = verbosity => {
|
|
183
|
+
if (verbosity === undefined) {
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
switch (verbosity.toLowerCase()) {
|
|
188
|
+
case 'debug':
|
|
189
|
+
{
|
|
190
|
+
return _SdkVerbosity.SdkVerbosity.DEBUG;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
case 'info':
|
|
194
|
+
{
|
|
195
|
+
return _SdkVerbosity.SdkVerbosity.INFO;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
case 'warn':
|
|
199
|
+
{
|
|
200
|
+
return _SdkVerbosity.SdkVerbosity.WARN;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
case 'error':
|
|
204
|
+
{
|
|
205
|
+
return _SdkVerbosity.SdkVerbosity.ERROR;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
default:
|
|
209
|
+
{
|
|
210
|
+
return undefined;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
//# sourceMappingURL=FileBasedConfiguration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FileBasedConfiguration.ts"],"names":["FileBasedConfiguration","DatadogProviderConfiguration","constructor","params","configuration","getJSONConfiguration","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","trackingConsent","longTaskThresholdMs","DEFAULTS","verbosity","actionNameAttribute","resourceTracingSamplingRate","firstPartyHosts","getFirstPartyHosts","errorEventMapper","resourceEventMapper","actionEventMapper","resolveJSONConfiguration","userSpecifiedConfiguration","undefined","jsonContent","require","console","error","buildTrackingConsent","buildSdkVerbosity","buildFirstPartyHosts","map","match","propagatorTypes","formatPropagatorType","message","propagatorType","toLowerCase","PropagatorType","B3","B3MULTI","DATADOG","TRACECONTEXT","Error","TrackingConsent","GRANTED","PENDING","NOT_GRANTED","SdkVerbosity","DEBUG","INFO","WARN","ERROR"],"mappings":";;;;;;;AAOA;;AAIA;;AACA;;AAIA;;AAhBA;AACA;AACA;AACA;AACA;AAcO,MAAMA,sBAAN,SAAqCC,2DAArC,CAAkE;AACrEC,EAAAA,WAAW,CAACC,MAAD,EAKR;AACC,UAAMC,aAAa,GAAGC,oBAAoB,CAACF,MAAD,aAACA,MAAD,uBAACA,MAAM,CAAEC,aAAT,CAA1C;AACA,UACIA,aAAa,CAACE,WADlB,EAEIF,aAAa,CAACG,GAFlB,EAGIH,aAAa,CAACI,aAHlB,EAIIJ,aAAa,CAACK,iBAJlB,EAKIL,aAAa,CAACM,cALlB,EAMIN,aAAa,CAACO,WANlB,EAOIP,aAAa,CAACQ,eAPlB;AASA,SAAKC,mBAAL,GACIT,aAAa,CAACS,mBAAd,IAAqCC,wCAASD,mBADlD;AAEA,SAAKE,SAAL,GAAiBX,aAAa,CAACW,SAA/B;AACA,SAAKC,mBAAL,GAA2BZ,aAAa,CAACY,mBAAzC;AACA,SAAKC,2BAAL,GACIb,aAAa,CAACa,2BAAd,IACAH,wCAASG,2BAFb;AAGA,SAAKC,eAAL,GACId,aAAa,CAACc,eAAd,IAAiCJ,wCAASK,kBAAT,EADrC;AAEA,SAAKC,gBAAL,GACI,CAAAjB,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAEiB,gBAAR,KAA4BN,wCAASM,gBADzC;AAEA,SAAKC,mBAAL,GACI,CAAAlB,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAEkB,mBAAR,KAA+BP,wCAASO,mBAD5C;AAEA,SAAKC,iBAAL,GACI,CAAAnB,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA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cAAe,GADhD,CAAN;AAGH;AAjBL;AAmBH,CAtBM;;;;AAwBP,MAAMR,oBAAoB,GACtBlB,eADyB,IAEK;AAC9B,MAAIA,eAAe,KAAKa,SAAxB,EAAmC;AAC/B,WAAOA,SAAP;AACH;;AACD,UAAQb,eAAe,CAAC2B,WAAhB,EAAR;AACI,SAAK,SAAL;AAAgB;AACZ,eAAOO,iCAAgBC,OAAvB;AACH;;AACD,SAAK,SAAL;AAAgB;AACZ,eAAOD,iCAAgBE,OAAvB;AACH;;AACD,SAAK,aAAL;AAAoB;AAChB,eAAOF,iCAAgBG,WAAvB;AACH;;AACD;AAAS;AACL,eAAOnC,wCAASF,eAAhB;AACH;AAZL;AAcH,CApBD;;AAsBA,MAAMmB,iBAAiB,GACnBhB,SADsB,IAEK;AAC3B,MAAIA,SAAS,KAAKU,SAAlB,EAA6B;AACzB,WAAOA,SAAP;AACH;;AACD,UAAQV,SAAS,CAACwB,WAAV,EAAR;AACI,SAAK,OAAL;AAAc;AACV,eAAOW,2BAAaC,KAApB;AACH;;AACD,SAAK,MAAL;AAAa;AACT,eAAOD,2BAAaE,IAApB;AACH;;AACD,SAAK,MAAL;AAAa;AACT,eAAOF,2BAAaG,IAApB;AACH;;AACD,SAAK,OAAL;AAAc;AACV,eAAOH,2BAAaI,KAApB;AACH;;AACD;AAAS;AACL,eAAO7B,SAAP;AACH;AAfL;AAiBH,CAvBD","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { FirstPartyHostsConfiguration } from '../../DdSdkReactNativeConfiguration';\nimport {\n DatadogProviderConfiguration,\n DEFAULTS\n} from '../../DdSdkReactNativeConfiguration';\nimport { SdkVerbosity } from '../../SdkVerbosity';\nimport { TrackingConsent } from '../../TrackingConsent';\nimport type { ActionEventMapper } from '../../rum/eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from '../../rum/eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from '../../rum/eventMappers/resourceEventMapper';\nimport { PropagatorType } from '../../rum/types';\n\nexport class FileBasedConfiguration extends DatadogProviderConfiguration {\n constructor(params?: {\n configuration?: unknown;\n errorEventMapper?: ErrorEventMapper;\n resourceEventMapper?: ResourceEventMapper;\n actionEventMapper?: ActionEventMapper;\n }) {\n const configuration = getJSONConfiguration(params?.configuration);\n super(\n configuration.clientToken,\n configuration.env,\n configuration.applicationId,\n configuration.trackInteractions,\n configuration.trackResources,\n configuration.trackErrors,\n configuration.trackingConsent\n );\n this.longTaskThresholdMs =\n configuration.longTaskThresholdMs || DEFAULTS.longTaskThresholdMs;\n this.verbosity = configuration.verbosity;\n this.actionNameAttribute = configuration.actionNameAttribute;\n this.resourceTracingSamplingRate =\n configuration.resourceTracingSamplingRate ||\n DEFAULTS.resourceTracingSamplingRate;\n this.firstPartyHosts =\n configuration.firstPartyHosts || DEFAULTS.getFirstPartyHosts();\n this.errorEventMapper =\n params?.errorEventMapper || DEFAULTS.errorEventMapper;\n this.resourceEventMapper =\n params?.resourceEventMapper || DEFAULTS.resourceEventMapper;\n this.actionEventMapper =\n params?.actionEventMapper || DEFAULTS.actionEventMapper;\n }\n}\n\nconst resolveJSONConfiguration = (\n userSpecifiedConfiguration: unknown\n): Record<string, any> => {\n if (\n userSpecifiedConfiguration === undefined ||\n userSpecifiedConfiguration === null\n ) {\n try {\n // This corresponds to a file located at the root of a RN project.\n // /!\\ We have to write the require this way as dynamic requires are not supported by Hermes.\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n const jsonContent = require('../../../../../../datadog-configuration.json');\n\n if (\n typeof jsonContent !== 'object' ||\n !jsonContent['configuration']\n ) {\n console.error(`Failed to parse the Datadog configuration file located at the root of the project.\nYour configuration must validate the node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json JSON schema.\nYou can use VSCode to check your configuration by adding the following line to your JSON file:\n{\n \"$schema\": \"./node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json\",\n}`);\n\n return {};\n }\n\n return jsonContent.configuration as Record<string, any>;\n } catch (error) {\n console.error(`Failed to read Datadog configuration file at the root of the project.\nIf you don't have a datadog-configuration.json file at the same level as your node_modules directory,\\\nplease use the following syntax:\\n\nnew FileBasedConfiguration({configuration: require('./file/to/configuration-file.json')})\n`);\n return {};\n }\n }\n if (\n typeof userSpecifiedConfiguration !== 'object' ||\n !(userSpecifiedConfiguration as any)['configuration']\n ) {\n console.error(`Failed to parse the Datadog configuration file you provided.\nYour configuration must validate the node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json JSON schema.\nYou can use VSCode to check your configuration by adding the following line to your JSON file:\n{\n \"$schema\": \"./node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json\",\n}`);\n\n return {};\n }\n\n return (userSpecifiedConfiguration as any)['configuration'] as Record<\n string,\n any\n >;\n};\n\nexport const getJSONConfiguration = (\n userSpecifiedConfiguration: unknown\n): {\n clientToken: string;\n env: string;\n applicationId: string;\n trackInteractions: boolean | undefined;\n trackResources: boolean | undefined;\n trackErrors: boolean | undefined;\n trackingConsent: TrackingConsent | undefined;\n longTaskThresholdMs: number | undefined;\n verbosity: SdkVerbosity | undefined;\n actionNameAttribute: string | undefined;\n resourceTracingSamplingRate: number | undefined;\n firstPartyHosts: FirstPartyHostsConfiguration | undefined;\n} => {\n const configuration = resolveJSONConfiguration(userSpecifiedConfiguration);\n\n return {\n clientToken: configuration.clientToken,\n env: configuration.env,\n applicationId: configuration.applicationId,\n trackInteractions: configuration.trackInteractions,\n trackResources: configuration.trackResources,\n trackErrors: configuration.trackErrors,\n trackingConsent: buildTrackingConsent(configuration.trackingConsent),\n longTaskThresholdMs: configuration.longTaskThresholdMs,\n verbosity: buildSdkVerbosity(configuration.verbosity),\n actionNameAttribute: configuration.actionNameAttribute,\n resourceTracingSamplingRate: configuration.resourceTracingSamplingRate,\n firstPartyHosts: buildFirstPartyHosts(configuration.firstPartyHosts)\n };\n};\n\nconst buildFirstPartyHosts = (\n firstPartyHosts: { match: string; propagatorTypes: string[] }[] | undefined\n): FirstPartyHostsConfiguration | undefined => {\n if (!firstPartyHosts) {\n return undefined;\n }\n\n try {\n return firstPartyHosts.map(({ match, propagatorTypes }) => ({\n match,\n propagatorTypes: propagatorTypes.map(formatPropagatorType)\n }));\n } catch (error) {\n console.error(`Failed to parse the first party hosts from the Datadog configuration file you provided:\n${(error as any).message}\nThe first party hosts will not be set for this session.\n`);\n return undefined;\n }\n};\n\nexport const formatPropagatorType = (\n propagatorType: string\n): PropagatorType => {\n switch (propagatorType.toLowerCase()) {\n case 'b3': {\n return PropagatorType.B3;\n }\n case 'b3multi': {\n return PropagatorType.B3MULTI;\n }\n case 'datadog': {\n return PropagatorType.DATADOG;\n }\n case 'tracecontext': {\n return PropagatorType.TRACECONTEXT;\n }\n default: {\n throw new Error(\n `Failed to parse propagator type ${propagatorType}.`\n );\n }\n }\n};\n\nconst buildTrackingConsent = (\n trackingConsent: string | undefined\n): TrackingConsent | undefined => {\n if (trackingConsent === undefined) {\n return undefined;\n }\n switch (trackingConsent.toLowerCase()) {\n case 'granted': {\n return TrackingConsent.GRANTED;\n }\n case 'pending': {\n return TrackingConsent.PENDING;\n }\n case 'not_granted': {\n return TrackingConsent.NOT_GRANTED;\n }\n default: {\n return DEFAULTS.trackingConsent;\n }\n }\n};\n\nconst buildSdkVerbosity = (\n verbosity: string | undefined\n): SdkVerbosity | undefined => {\n if (verbosity === undefined) {\n return undefined;\n }\n switch (verbosity.toLowerCase()) {\n case 'debug': {\n return SdkVerbosity.DEBUG;\n }\n case 'info': {\n return SdkVerbosity.INFO;\n }\n case 'warn': {\n return SdkVerbosity.WARN;\n }\n case 'error': {\n return SdkVerbosity.ERROR;\n }\n default: {\n return undefined;\n }\n }\n};\n"]}
|
package/lib/commonjs/types.js
CHANGED
|
@@ -15,7 +15,7 @@ exports.DdSdkConfiguration = void 0;
|
|
|
15
15
|
* A configuration object to initialize Datadog's features.
|
|
16
16
|
*/
|
|
17
17
|
class DdSdkConfiguration {
|
|
18
|
-
constructor(clientToken, env, applicationId, nativeCrashReportEnabled, nativeLongTaskThresholdMs, longTaskThresholdMs, sampleRate, site, trackingConsent,
|
|
18
|
+
constructor(clientToken, env, applicationId, nativeCrashReportEnabled, nativeLongTaskThresholdMs, longTaskThresholdMs, sampleRate, site, trackingConsent, additionalConfiguration, telemetrySampleRate, vitalsUpdateFrequency, uploadFrequency, batchSize, trackFrustrations, trackBackgroundEvents, customEndpoints, configurationForTelemetry, nativeViewTracking, nativeInteractionTracking, verbosity, proxyConfig, serviceName, firstPartyHosts, bundleLogsWithRum, bundleLogsWithTraces) {
|
|
19
19
|
this.clientToken = clientToken;
|
|
20
20
|
this.env = env;
|
|
21
21
|
this.applicationId = applicationId;
|
|
@@ -25,7 +25,7 @@ class DdSdkConfiguration {
|
|
|
25
25
|
this.sampleRate = sampleRate;
|
|
26
26
|
this.site = site;
|
|
27
27
|
this.trackingConsent = trackingConsent;
|
|
28
|
-
this.
|
|
28
|
+
this.additionalConfiguration = additionalConfiguration;
|
|
29
29
|
this.telemetrySampleRate = telemetrySampleRate;
|
|
30
30
|
this.vitalsUpdateFrequency = vitalsUpdateFrequency;
|
|
31
31
|
this.uploadFrequency = uploadFrequency;
|
|
@@ -34,6 +34,14 @@ class DdSdkConfiguration {
|
|
|
34
34
|
this.trackBackgroundEvents = trackBackgroundEvents;
|
|
35
35
|
this.customEndpoints = customEndpoints;
|
|
36
36
|
this.configurationForTelemetry = configurationForTelemetry;
|
|
37
|
+
this.nativeViewTracking = nativeViewTracking;
|
|
38
|
+
this.nativeInteractionTracking = nativeInteractionTracking;
|
|
39
|
+
this.verbosity = verbosity;
|
|
40
|
+
this.proxyConfig = proxyConfig;
|
|
41
|
+
this.serviceName = serviceName;
|
|
42
|
+
this.firstPartyHosts = firstPartyHosts;
|
|
43
|
+
this.bundleLogsWithRum = bundleLogsWithRum;
|
|
44
|
+
this.bundleLogsWithTraces = bundleLogsWithTraces;
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["types.tsx"],"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","
|
|
1
|
+
{"version":3,"sources":["types.tsx"],"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","additionalConfiguration","telemetrySampleRate","vitalsUpdateFrequency","uploadFrequency","batchSize","trackFrustrations","trackBackgroundEvents","customEndpoints","configurationForTelemetry","nativeViewTracking","nativeInteractionTracking","verbosity","proxyConfig","serviceName","firstPartyHosts","bundleLogsWithRum","bundleLogsWithTraces"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,kBAAN,CAAyB;AAC5BC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,yBALF,EAMEC,mBANF,EAOEC,UAPF,EAQEC,IARF,EASEC,eATF,EAUEC,uBAVF,EAWEC,mBAXF,EAYEC,qBAZF,EAaEC,eAbF,EAcEC,SAdF,EAeEC,iBAfF,EAgBEC,qBAhBF,EAiBEC,eAjBF,EAsBEC,yBAtBF,EA8BEC,kBA9BF,EA+BEC,yBA/BF,EAgCEC,SAhCF,EAiCEC,WAjCF,EA0CEC,WA1CF,EA2CEC,eA3CF,EA+CEC,iBA/CF,EAgDEC,oBAhDF,EAiDT;AAAA,SAhDWzB,WAgDX,GAhDWA,WAgDX;AAAA,SA/CWC,GA+CX,GA/CWA,GA+CX;AAAA,SA9CWC,aA8CX,GA9CWA,aA8CX;AAAA,SA7CWC,wBA6CX,GA7CWA,wBA6CX;AAAA,SA5CWC,yBA4CX,GA5CWA,yBA4CX;AAAA,SA3CWC,mBA2CX,GA3CWA,mBA2CX;AAAA,SA1CWC,UA0CX,GA1CWA,UA0CX;AAAA,SAzCWC,IAyCX,GAzCWA,IAyCX;AAAA,SAxCWC,eAwCX,GAxCWA,eAwCX;AAAA,SAvCWC,uBAuCX,GAvCWA,uBAuCX;AAAA,SAtCWC,mBAsCX,GAtCWA,mBAsCX;AAAA,SArCWC,qBAqCX,GArCWA,qBAqCX;AAAA,SApCWC,eAoCX,GApCWA,eAoCX;AAAA,SAnCWC,SAmCX,GAnCWA,SAmCX;AAAA,SAlCWC,iBAkCX,GAlCWA,iBAkCX;AAAA,SAjCWC,qBAiCX,GAjCWA,qBAiCX;AAAA,SAhCWC,eAgCX,GAhCWA,eAgCX;AAAA,SA3BWC,yBA2BX,GA3BWA,yBA2BX;AAAA,SAnBWC,kBAmBX,GAnBWA,kBAmBX;AAAA,SAlBWC,yBAkBX,GAlBWA,yBAkBX;AAAA,SAjBWC,SAiBX,GAjBWA,SAiBX;AAAA,SAhBWC,WAgBX,GAhBWA,WAgBX;AAAA,SAPWC,WAOX,GAPWA,WAOX;AAAA,SANWC,eAMX,GANWA,eAMX;AAAA,SAFWC,iBAEX,GAFWA,iBAEX;AAAA,SADWC,oBACX,GADWA,oBACX;AAAE;;AAlDwB;AAqDhC;AACA;AACA","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/**\n * A configuration object to initialize Datadog's features.\n */\nexport class DdSdkConfiguration {\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly nativeCrashReportEnabled: boolean,\n readonly nativeLongTaskThresholdMs: number,\n readonly longTaskThresholdMs: number,\n readonly sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfiguration: object,\n readonly telemetrySampleRate: number,\n readonly vitalsUpdateFrequency: string,\n readonly uploadFrequency: string,\n readonly batchSize: string,\n readonly trackFrustrations: boolean,\n readonly trackBackgroundEvents: boolean,\n readonly customEndpoints: {\n rum?: string;\n trace?: string;\n logs?: string;\n },\n readonly configurationForTelemetry: {\n initializationType: string;\n trackErrors: boolean;\n trackInteractions: boolean;\n trackNetworkRequests: boolean;\n reactVersion: string;\n reactNativeVersion: string;\n },\n readonly nativeViewTracking: boolean,\n readonly nativeInteractionTracking: boolean,\n readonly verbosity: string | undefined,\n readonly proxyConfig:\n | {\n type: string;\n address: string;\n port: number;\n username?: string;\n password?: string;\n }\n | undefined,\n readonly serviceName: string | undefined,\n readonly firstPartyHosts: {\n match: string;\n propagatorTypes: string[];\n }[],\n readonly bundleLogsWithRum: boolean,\n readonly bundleLogsWithTraces: boolean\n ) {}\n}\n\n/**\n * The entry point to initialize Datadog's features.\n */\nexport type DdSdkType = {\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: DdSdkConfiguration): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: object): Promise<void>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Trace feature.\n */\nexport type DdTraceType = {\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context?: object,\n timestampMs?: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n};\n"]}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.
|
|
1
|
+
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.3.0';\n"]}
|