@datadog/mobile-react-native 2.14.1 → 3.0.1
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 +6 -6
- package/README.md +23 -13
- package/android/build.gradle +10 -11
- package/android/gradle.properties +1 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +36 -93
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +46 -59
- package/android/src/main/kotlin/com/datadog/reactnative/DdLogsImplementation.kt +2 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdRumImplementation.kt +98 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +125 -75
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +199 -90
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +151 -24
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkNativeInitialization.kt +57 -33
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkReactNativePackage.kt +2 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdTelemetry.kt +96 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdTraceImplementation.kt +20 -19
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdRum.kt +100 -1
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdSdk.kt +68 -14
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt +94 -0
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdSdk.kt +70 -11
- package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +58 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkNativeInitializationTest.kt +63 -43
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +2024 -1199
- package/android/src/test/kotlin/com/datadog/reactnative/DdTraceTest.kt +44 -40
- package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +60 -91
- package/android/src/test/kotlin/com/datadog/tools/unit/MockRumMonitor.kt +34 -14
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +47 -43
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/TelemetryConfigurationEventForgeryFactory.kt +0 -1
- package/android/src/test/resources/input/complete-configuration.json +32 -28
- package/android/src/test/resources/input/malformed-configuration.json +1 -1
- package/android/src/test/resources/input/minimal-configuration.json +4 -2
- package/datadog-configuration.schema.json +187 -139
- package/ios/Sources/AnyEncodable.swift +14 -7
- package/ios/Sources/Attributes.swift +0 -7
- package/ios/Sources/DatadogSDKWrapper.swift +12 -128
- package/ios/Sources/DdLogsImplementation.swift +9 -39
- package/ios/Sources/DdRum.mm +89 -1
- package/ios/Sources/DdRumImplementation.swift +79 -0
- package/ios/Sources/DdSdk.mm +76 -11
- package/ios/Sources/DdSdkConfiguration.swift +159 -117
- package/ios/Sources/DdSdkImplementation.swift +235 -82
- package/ios/Sources/DdSdkNativeInitialization.swift +116 -80
- package/ios/Sources/DdTelemetry.swift +49 -0
- package/ios/Sources/GlobalState.swift +1 -1
- package/ios/Sources/RNDdSdkConfiguration.swift +334 -172
- package/ios/Sources/SdkVersion.swift +1 -1
- package/jest/mock.js +43 -4
- package/lib/commonjs/DdAttributes.js.map +1 -0
- package/lib/commonjs/DdSdkReactNative.js +159 -56
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/InternalLog.js +1 -1
- package/lib/commonjs/config/DatadogProviderConfiguration.js +25 -0
- package/lib/commonjs/config/DatadogProviderConfiguration.js.map +1 -0
- package/lib/commonjs/config/FileBasedConfiguration.js +349 -0
- package/lib/commonjs/config/FileBasedConfiguration.js.map +1 -0
- package/lib/commonjs/config/FileBasedConfiguration.type.js +6 -0
- package/lib/commonjs/config/FileBasedConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js +51 -0
- package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js.map +1 -0
- package/lib/commonjs/config/async/PartialInitializationConfiguration.js +6 -0
- package/lib/commonjs/config/async/PartialInitializationConfiguration.js.map +1 -0
- package/lib/commonjs/config/async/asyncInitializationHelper.js +44 -0
- package/lib/commonjs/config/async/asyncInitializationHelper.js.map +1 -0
- package/lib/commonjs/config/features/CoreConfiguration.js +104 -0
- package/lib/commonjs/config/features/CoreConfiguration.js.map +1 -0
- package/lib/commonjs/config/features/CoreConfiguration.type.js +6 -0
- package/lib/commonjs/config/features/CoreConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/features/CoreConfigurationNative.js +38 -0
- package/lib/commonjs/config/features/CoreConfigurationNative.js.map +1 -0
- package/lib/commonjs/config/features/LogsConfiguration.js +36 -0
- package/lib/commonjs/config/features/LogsConfiguration.js.map +1 -0
- package/lib/commonjs/config/features/LogsConfiguration.type.js +6 -0
- package/lib/commonjs/config/features/LogsConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/features/LogsConfigurationNative.js +2 -0
- package/lib/commonjs/config/features/LogsConfigurationNative.js.map +1 -0
- package/lib/commonjs/config/features/RumConfiguration.js +120 -0
- package/lib/commonjs/config/features/RumConfiguration.js.map +1 -0
- package/lib/commonjs/config/features/RumConfiguration.type.js +6 -0
- package/lib/commonjs/config/features/RumConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/features/RumConfigurationNative.js +2 -0
- package/lib/commonjs/config/features/RumConfigurationNative.js.map +1 -0
- package/lib/commonjs/config/features/TraceConfiguration.js +24 -0
- package/lib/commonjs/config/features/TraceConfiguration.js.map +1 -0
- package/lib/commonjs/config/features/TraceConfiguration.type.js +2 -0
- package/lib/commonjs/config/features/TraceConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/features/TraceConfigurationNative.js +2 -0
- package/lib/commonjs/config/features/TraceConfigurationNative.js.map +1 -0
- package/lib/commonjs/config/types/BatchProcessingLevel.js +30 -0
- package/lib/commonjs/config/types/BatchProcessingLevel.js.map +1 -0
- package/lib/commonjs/config/types/BatchSize.js +31 -0
- package/lib/commonjs/config/types/BatchSize.js.map +1 -0
- package/lib/commonjs/config/types/InitializationMode.js +17 -0
- package/lib/commonjs/config/types/InitializationMode.js.map +1 -0
- package/lib/commonjs/config/types/InitializationModeForTelemetry.js +2 -0
- package/lib/commonjs/config/types/InitializationModeForTelemetry.js.map +1 -0
- package/lib/commonjs/{ProxyConfiguration.js → config/types/ProxyConfiguration.js} +6 -0
- package/lib/commonjs/config/types/ProxyConfiguration.js.map +1 -0
- package/lib/commonjs/config/types/SdkVerbosity.js.map +1 -0
- package/lib/commonjs/config/types/TrackingConsent.js.map +1 -0
- package/lib/commonjs/config/types/UploadFrequency.js +30 -0
- package/lib/commonjs/config/types/UploadFrequency.js.map +1 -0
- package/lib/commonjs/config/types/VitalsUpdateFrequency.js +19 -0
- package/lib/commonjs/config/types/VitalsUpdateFrequency.js.map +1 -0
- package/lib/commonjs/config/types/index.js +68 -0
- package/lib/commonjs/config/types/index.js.map +1 -0
- package/lib/commonjs/index.js +51 -21
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/logs/DdLogs.js +13 -9
- package/lib/commonjs/logs/DdLogs.js.map +1 -1
- package/lib/commonjs/logs/eventMapper.js +4 -1
- package/lib/commonjs/logs/eventMapper.js.map +1 -1
- package/lib/commonjs/nativeModulesTypes.js +0 -45
- package/lib/commonjs/nativeModulesTypes.js.map +1 -1
- package/lib/commonjs/rum/DdRum.js +56 -28
- package/lib/commonjs/rum/DdRum.js.map +1 -1
- package/lib/commonjs/rum/helper.js +63 -0
- package/lib/commonjs/rum/helper.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +14 -18
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js +15 -25
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +15 -5
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +34 -22
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js +21 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +16 -3
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +10 -12
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js +6 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +41 -47
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js +62 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/headers.js +36 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/headers.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +19 -8
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js +90 -48
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +1 -1
- package/lib/commonjs/rum/types.js +1 -9
- package/lib/commonjs/rum/types.js.map +1 -1
- package/lib/commonjs/sdk/AccountInfoSingleton/AccountInfoSingleton.js +46 -0
- package/lib/commonjs/sdk/AccountInfoSingleton/AccountInfoSingleton.js.map +1 -0
- package/lib/commonjs/sdk/AccountInfoSingleton/types.js +2 -0
- package/lib/commonjs/sdk/AccountInfoSingleton/types.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/attributesEncoding.js +51 -0
- package/lib/commonjs/sdk/AttributesEncoding/attributesEncoding.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/defaultEncoders.js +140 -0
- package/lib/commonjs/sdk/AttributesEncoding/defaultEncoders.js.map +1 -0
- package/lib/commonjs/{utils → sdk/AttributesEncoding}/errorUtils.js +39 -22
- package/lib/commonjs/sdk/AttributesEncoding/errorUtils.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/helpers.js +123 -0
- package/lib/commonjs/sdk/AttributesEncoding/helpers.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/types.js +2 -0
- package/lib/commonjs/sdk/AttributesEncoding/types.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/utils.js +36 -0
- package/lib/commonjs/sdk/AttributesEncoding/utils.js.map +1 -0
- package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js +27 -1
- package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
- package/lib/commonjs/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js +3 -3
- package/lib/commonjs/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js.map +1 -1
- package/lib/commonjs/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.js +1 -1
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js +4 -4
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js +10 -9
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/DatadogProviderState.js +28 -0
- package/lib/commonjs/sdk/DatadogProvider/DatadogProviderState.js.map +1 -0
- package/lib/commonjs/sdk/DdSdk.js +4 -2
- package/lib/commonjs/sdk/DdSdk.js.map +1 -1
- package/lib/commonjs/sdk/DdSdkInternal.js +86 -0
- package/lib/commonjs/sdk/DdSdkInternal.js.map +1 -0
- package/lib/commonjs/sdk/EventMappers/EventMapper.js +6 -3
- package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/commonjs/sdk/GlobalState/GlobalState.js +5 -11
- package/lib/commonjs/sdk/GlobalState/GlobalState.js.map +1 -1
- package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js +6 -1
- package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
- package/lib/commonjs/specs/NativeDdRum.js.map +1 -1
- package/lib/commonjs/specs/NativeDdSdk.js.map +1 -1
- package/lib/commonjs/trace/DdTrace.js +7 -5
- package/lib/commonjs/trace/DdTrace.js.map +1 -1
- package/lib/commonjs/types.js +19 -46
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/longTasksUtils.js.map +1 -1
- package/lib/commonjs/utils/singletonUtils.js +21 -0
- package/lib/commonjs/utils/singletonUtils.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdAttributes.js.map +1 -0
- package/lib/module/DdSdkReactNative.js +155 -52
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/InternalLog.js +1 -1
- package/lib/module/InternalLog.js.map +1 -1
- package/lib/module/config/DatadogProviderConfiguration.js +18 -0
- package/lib/module/config/DatadogProviderConfiguration.js.map +1 -0
- package/lib/module/config/FileBasedConfiguration.js +341 -0
- package/lib/module/config/FileBasedConfiguration.js.map +1 -0
- package/lib/module/config/FileBasedConfiguration.type.js +2 -0
- package/lib/module/config/FileBasedConfiguration.type.js.map +1 -0
- package/lib/module/config/async/AutoInstrumentationConfiguration.js +45 -0
- package/lib/module/config/async/AutoInstrumentationConfiguration.js.map +1 -0
- package/lib/module/config/async/PartialInitializationConfiguration.js +2 -0
- package/lib/module/config/async/PartialInitializationConfiguration.js.map +1 -0
- package/lib/module/config/async/asyncInitializationHelper.js +36 -0
- package/lib/module/config/async/asyncInitializationHelper.js.map +1 -0
- package/lib/module/config/features/CoreConfiguration.js +98 -0
- package/lib/module/config/features/CoreConfiguration.js.map +1 -0
- package/lib/module/config/features/CoreConfiguration.type.js +2 -0
- package/lib/module/config/features/CoreConfiguration.type.js.map +1 -0
- package/lib/module/config/features/CoreConfigurationNative.js +31 -0
- package/lib/module/config/features/CoreConfigurationNative.js.map +1 -0
- package/lib/module/config/features/LogsConfiguration.js +30 -0
- package/lib/module/config/features/LogsConfiguration.js.map +1 -0
- package/lib/module/config/features/LogsConfiguration.type.js +2 -0
- package/lib/module/config/features/LogsConfiguration.type.js.map +1 -0
- package/lib/module/config/features/LogsConfigurationNative.js +2 -0
- package/lib/module/config/features/LogsConfigurationNative.js.map +1 -0
- package/lib/module/config/features/RumConfiguration.js +114 -0
- package/lib/module/config/features/RumConfiguration.js.map +1 -0
- package/lib/module/config/features/RumConfiguration.type.js +2 -0
- package/lib/module/config/features/RumConfiguration.type.js.map +1 -0
- package/lib/module/config/features/RumConfigurationNative.js +2 -0
- package/lib/module/config/features/RumConfigurationNative.js.map +1 -0
- package/lib/module/config/features/TraceConfiguration.js +18 -0
- package/lib/module/config/features/TraceConfiguration.js.map +1 -0
- package/lib/module/config/features/TraceConfiguration.type.js +2 -0
- package/lib/module/config/features/TraceConfiguration.type.js.map +1 -0
- package/lib/module/config/features/TraceConfigurationNative.js +2 -0
- package/lib/module/config/features/TraceConfigurationNative.js.map +1 -0
- package/lib/module/config/types/BatchProcessingLevel.js +25 -0
- package/lib/module/config/types/BatchProcessingLevel.js.map +1 -0
- package/lib/module/config/types/BatchSize.js +26 -0
- package/lib/module/config/types/BatchSize.js.map +1 -0
- package/lib/module/config/types/InitializationMode.js +11 -0
- package/lib/module/config/types/InitializationMode.js.map +1 -0
- package/lib/module/config/types/InitializationModeForTelemetry.js +2 -0
- package/lib/module/config/types/InitializationModeForTelemetry.js.map +1 -0
- package/lib/module/{ProxyConfiguration.js → config/types/ProxyConfiguration.js} +6 -0
- package/lib/module/config/types/ProxyConfiguration.js.map +1 -0
- package/lib/module/config/types/SdkVerbosity.js.map +1 -0
- package/lib/module/config/types/TrackingConsent.js.map +1 -0
- package/lib/module/config/types/UploadFrequency.js +25 -0
- package/lib/module/config/types/UploadFrequency.js.map +1 -0
- package/lib/module/config/types/VitalsUpdateFrequency.js +13 -0
- package/lib/module/config/types/VitalsUpdateFrequency.js.map +1 -0
- package/lib/module/config/types/index.js +15 -0
- package/lib/module/config/types/index.js.map +1 -0
- package/lib/module/index.js +13 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/logs/DdLogs.js +13 -9
- package/lib/module/logs/DdLogs.js.map +1 -1
- package/lib/module/logs/eventMapper.js +4 -1
- package/lib/module/logs/eventMapper.js.map +1 -1
- package/lib/module/nativeModulesTypes.js +1 -43
- package/lib/module/nativeModulesTypes.js.map +1 -1
- package/lib/module/rum/DdRum.js +54 -26
- package/lib/module/rum/DdRum.js.map +1 -1
- package/lib/module/rum/helper.js +49 -0
- package/lib/module/rum/helper.js.map +1 -0
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js +14 -18
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js +15 -24
- package/lib/module/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +15 -5
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +33 -21
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js +22 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +13 -2
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +10 -11
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js +2 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +27 -33
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js +54 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/headers.js +30 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/headers.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +14 -3
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js +90 -48
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
- package/lib/module/rum/types.js +0 -9
- package/lib/module/rum/types.js.map +1 -1
- package/lib/module/sdk/AccountInfoSingleton/AccountInfoSingleton.js +39 -0
- package/lib/module/sdk/AccountInfoSingleton/AccountInfoSingleton.js.map +1 -0
- package/lib/module/sdk/AccountInfoSingleton/types.js +2 -0
- package/lib/module/sdk/AccountInfoSingleton/types.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/attributesEncoding.js +46 -0
- package/lib/module/sdk/AttributesEncoding/attributesEncoding.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/defaultEncoders.js +134 -0
- package/lib/module/sdk/AttributesEncoding/defaultEncoders.js.map +1 -0
- package/lib/module/{utils → sdk/AttributesEncoding}/errorUtils.js +37 -20
- package/lib/module/sdk/AttributesEncoding/errorUtils.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/helpers.js +115 -0
- package/lib/module/sdk/AttributesEncoding/helpers.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/types.js +2 -0
- package/lib/module/sdk/AttributesEncoding/types.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/utils.js +28 -0
- package/lib/module/sdk/AttributesEncoding/utils.js.map +1 -0
- package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js +27 -1
- package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
- package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js +2 -2
- package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js.map +1 -1
- package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.js +1 -1
- package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js +4 -4
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js +9 -8
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/DatadogProviderState.js +21 -0
- package/lib/module/sdk/DatadogProvider/DatadogProviderState.js.map +1 -0
- package/lib/module/sdk/DdSdk.js +4 -4
- package/lib/module/sdk/DdSdk.js.map +1 -1
- package/lib/module/sdk/DdSdkInternal.js +80 -0
- package/lib/module/sdk/DdSdkInternal.js.map +1 -0
- package/lib/module/sdk/EventMappers/EventMapper.js +6 -3
- package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/module/sdk/GlobalState/GlobalState.js +5 -10
- package/lib/module/sdk/GlobalState/GlobalState.js.map +1 -1
- package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js +6 -1
- package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
- package/lib/module/specs/NativeDdRum.js.map +1 -1
- package/lib/module/specs/NativeDdSdk.js.map +1 -1
- package/lib/module/trace/DdTrace.js +7 -6
- package/lib/module/trace/DdTrace.js.map +1 -1
- package/lib/module/types.js +22 -42
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/longTasksUtils.js.map +1 -1
- package/lib/module/utils/singletonUtils.js +14 -0
- package/lib/module/utils/singletonUtils.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/DdAttributes.d.ts.map +1 -0
- package/lib/typescript/DdSdkReactNative.d.ts +49 -12
- package/lib/typescript/DdSdkReactNative.d.ts.map +1 -1
- package/lib/typescript/InternalLog.d.ts +1 -1
- package/lib/typescript/InternalLog.d.ts.map +1 -1
- package/lib/typescript/config/DatadogProviderConfiguration.d.ts +12 -0
- package/lib/typescript/config/DatadogProviderConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/FileBasedConfiguration.d.ts +17 -0
- package/lib/typescript/config/FileBasedConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/FileBasedConfiguration.type.d.ts +52 -0
- package/lib/typescript/config/FileBasedConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts +60 -0
- package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts +47 -0
- package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/async/asyncInitializationHelper.d.ts +5 -0
- package/lib/typescript/config/async/asyncInitializationHelper.d.ts.map +1 -0
- package/lib/typescript/config/features/CoreConfiguration.d.ts +52 -0
- package/lib/typescript/config/features/CoreConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/features/CoreConfiguration.type.d.ts +90 -0
- package/lib/typescript/config/features/CoreConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/features/CoreConfigurationNative.d.ts +54 -0
- package/lib/typescript/config/features/CoreConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/config/features/LogsConfiguration.d.ts +17 -0
- package/lib/typescript/config/features/LogsConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/features/LogsConfiguration.type.d.ts +24 -0
- package/lib/typescript/config/features/LogsConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/features/LogsConfigurationNative.d.ts +6 -0
- package/lib/typescript/config/features/LogsConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/config/features/RumConfiguration.d.ts +66 -0
- package/lib/typescript/config/features/RumConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/features/RumConfiguration.type.d.ts +131 -0
- package/lib/typescript/config/features/RumConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/features/RumConfigurationNative.d.ts +25 -0
- package/lib/typescript/config/features/RumConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/config/features/TraceConfiguration.d.ts +10 -0
- package/lib/typescript/config/features/TraceConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/features/TraceConfiguration.type.d.ts +11 -0
- package/lib/typescript/config/features/TraceConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/features/TraceConfigurationNative.d.ts +4 -0
- package/lib/typescript/config/features/TraceConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/config/types/BatchProcessingLevel.d.ts +18 -0
- package/lib/typescript/config/types/BatchProcessingLevel.d.ts.map +1 -0
- package/lib/typescript/config/types/BatchSize.d.ts +19 -0
- package/lib/typescript/config/types/BatchSize.d.ts.map +1 -0
- package/lib/typescript/config/types/InitializationMode.d.ts +5 -0
- package/lib/typescript/config/types/InitializationMode.d.ts.map +1 -0
- package/lib/typescript/config/types/InitializationModeForTelemetry.d.ts +2 -0
- package/lib/typescript/config/types/InitializationModeForTelemetry.d.ts.map +1 -0
- package/lib/typescript/config/types/ProxyConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/types/SdkVerbosity.d.ts.map +1 -0
- package/lib/typescript/config/types/TrackingConsent.d.ts.map +1 -0
- package/lib/typescript/config/types/UploadFrequency.d.ts +18 -0
- package/lib/typescript/config/types/UploadFrequency.d.ts.map +1 -0
- package/lib/typescript/config/types/VitalsUpdateFrequency.d.ts +7 -0
- package/lib/typescript/config/types/VitalsUpdateFrequency.d.ts.map +1 -0
- package/lib/typescript/config/types/index.d.ts +10 -0
- package/lib/typescript/config/types/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +20 -9
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/logs/DdLogs.d.ts +2 -1
- package/lib/typescript/logs/DdLogs.d.ts.map +1 -1
- package/lib/typescript/logs/eventMapper.d.ts +3 -2
- package/lib/typescript/logs/eventMapper.d.ts.map +1 -1
- package/lib/typescript/logs/types.d.ts +1 -16
- package/lib/typescript/logs/types.d.ts.map +1 -1
- package/lib/typescript/nativeModulesTypes.d.ts +2 -15
- package/lib/typescript/nativeModulesTypes.d.ts.map +1 -1
- package/lib/typescript/rum/DdRum.d.ts +10 -1
- package/lib/typescript/rum/DdRum.d.ts.map +1 -1
- package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +1 -1
- package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts.map +1 -1
- package/lib/typescript/rum/helper.d.ts +10 -0
- package/lib/typescript/rum/helper.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts +6 -6
- package/lib/typescript/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts +7 -0
- package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +12 -6
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts +8 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +5 -17
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.d.ts +20 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +3 -24
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.d.ts +12 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/headers.d.ts +24 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/headers.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts +2 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts.map +1 -1
- package/lib/typescript/rum/types.d.ts +47 -7
- package/lib/typescript/rum/types.d.ts.map +1 -1
- package/lib/typescript/sdk/AccountInfoSingleton/AccountInfoSingleton.d.ts +15 -0
- package/lib/typescript/sdk/AccountInfoSingleton/AccountInfoSingleton.d.ts.map +1 -0
- package/lib/typescript/sdk/AccountInfoSingleton/types.d.ts +6 -0
- package/lib/typescript/sdk/AccountInfoSingleton/types.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/attributesEncoding.d.ts +13 -0
- package/lib/typescript/sdk/AttributesEncoding/attributesEncoding.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/defaultEncoders.d.ts +33 -0
- package/lib/typescript/sdk/AttributesEncoding/defaultEncoders.d.ts.map +1 -0
- package/lib/typescript/{utils → sdk/AttributesEncoding}/errorUtils.d.ts +4 -4
- package/lib/typescript/sdk/AttributesEncoding/errorUtils.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/helpers.d.ts +17 -0
- package/lib/typescript/sdk/AttributesEncoding/helpers.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/types.d.ts +21 -0
- package/lib/typescript/sdk/AttributesEncoding/types.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/utils.d.ts +7 -0
- package/lib/typescript/sdk/AttributesEncoding/utils.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts +5 -1
- package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts.map +1 -1
- package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts +4 -3
- package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts.map +1 -1
- package/lib/typescript/sdk/DatadogProvider/DatadogProviderState.d.ts +9 -0
- package/lib/typescript/sdk/DatadogProvider/DatadogProviderState.d.ts.map +1 -0
- package/lib/typescript/sdk/DdSdk.d.ts +2 -3
- package/lib/typescript/sdk/DdSdk.d.ts.map +1 -1
- package/lib/typescript/sdk/DdSdkInternal.d.ts +39 -0
- package/lib/typescript/sdk/DdSdkInternal.d.ts.map +1 -0
- package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +3 -1
- package/lib/typescript/sdk/EventMappers/EventMapper.d.ts.map +1 -1
- package/lib/typescript/sdk/GlobalState/GlobalState.d.ts +3 -3
- package/lib/typescript/sdk/GlobalState/GlobalState.d.ts.map +1 -1
- package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +2 -1
- package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts.map +1 -1
- package/lib/typescript/sdk/UserInfoSingleton/types.d.ts +1 -2
- package/lib/typescript/sdk/UserInfoSingleton/types.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdRum.d.ts +45 -0
- package/lib/typescript/specs/NativeDdRum.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdSdk.d.ts +34 -6
- package/lib/typescript/specs/NativeDdSdk.d.ts.map +1 -1
- package/lib/typescript/trace/DdTrace.d.ts +1 -2
- package/lib/typescript/trace/DdTrace.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +74 -92
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils/longTasksUtils.d.ts +1 -1
- package/lib/typescript/utils/longTasksUtils.d.ts.map +1 -1
- package/lib/typescript/utils/singletonUtils.d.ts +2 -0
- package/lib/typescript/utils/singletonUtils.d.ts.map +1 -0
- package/lib/typescript/version.d.ts +1 -1
- package/lib/typescript/version.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/DdSdkReactNative.tsx +246 -104
- package/src/InternalLog.tsx +1 -1
- package/src/__tests__/DdSdkReactNative.test.tsx +415 -207
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +237 -153
- package/src/__tests__/InternalLog.test.tsx +1 -1
- package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +2 -2
- package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +139 -216
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +10 -7
- package/src/config/DatadogProviderConfiguration.ts +17 -0
- package/src/config/FileBasedConfiguration.ts +464 -0
- package/src/config/FileBasedConfiguration.type.ts +66 -0
- package/src/config/__tests__/FileBasedConfiguration.test.ts +334 -0
- package/src/config/__tests__/__fixtures__/configuration-all-fields.json +57 -0
- package/src/config/__tests__/__fixtures__/malformed-configuration.json +4 -0
- package/src/config/async/AutoInstrumentationConfiguration.ts +126 -0
- package/src/config/async/PartialInitializationConfiguration.ts +58 -0
- package/src/config/async/asyncInitializationHelper.tsx +51 -0
- package/src/config/features/CoreConfiguration.ts +130 -0
- package/src/config/features/CoreConfiguration.type.ts +119 -0
- package/src/config/features/CoreConfigurationNative.ts +50 -0
- package/src/config/features/LogsConfiguration.ts +38 -0
- package/src/config/features/LogsConfiguration.type.ts +33 -0
- package/src/config/features/LogsConfigurationNative.ts +10 -0
- package/src/config/features/RumConfiguration.ts +137 -0
- package/src/config/features/RumConfiguration.type.ts +164 -0
- package/src/config/features/RumConfigurationNative.ts +26 -0
- package/src/config/features/TraceConfiguration.ts +24 -0
- package/src/config/features/TraceConfiguration.type.ts +17 -0
- package/src/config/features/TraceConfigurationNative.ts +8 -0
- package/src/config/types/BatchProcessingLevel.ts +23 -0
- package/src/config/types/BatchSize.ts +24 -0
- package/src/config/types/InitializationMode.ts +9 -0
- package/src/config/types/InitializationModeForTelemetry.ts +11 -0
- package/src/{ProxyConfiguration.tsx → config/types/ProxyConfiguration.ts} +6 -0
- package/src/config/types/UploadFrequency.tsx +23 -0
- package/src/config/types/VitalsUpdateFrequency.ts +11 -0
- package/src/config/types/index.ts +15 -0
- package/src/index.tsx +33 -16
- package/src/logs/DdLogs.ts +14 -13
- package/src/logs/__tests__/DdLogs.test.ts +60 -107
- package/src/logs/__tests__/eventMapper.test.ts +1 -1
- package/src/logs/eventMapper.ts +5 -4
- package/src/logs/types.ts +1 -20
- package/src/nativeModulesTypes.ts +2 -17
- package/src/rum/DdRum.ts +139 -42
- package/src/rum/__tests__/DdRum.test.ts +217 -47
- package/src/rum/eventMappers/errorEventMapper.ts +1 -1
- package/src/rum/helper.ts +62 -0
- package/src/rum/instrumentation/DdRumErrorTracking.tsx +20 -38
- package/src/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.ts +20 -32
- package/src/rum/instrumentation/interactionTracking/DdEventsInterceptor.tsx +1 -1
- package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +18 -5
- package/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.tsx +44 -23
- package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +2 -2
- package/src/rum/instrumentation/resourceTracking/__tests__/__utils__/XMLHttpRequestMock.ts +44 -23
- package/src/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.ts +24 -1
- package/src/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.tsx +17 -2
- package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/distributedTracing.test.ts +327 -1
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.tsx +22 -31
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.ts +29 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.ts +54 -35
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.ts +80 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/distributedTracing/headers.ts +29 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.ts +19 -7
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts +177 -119
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/baggageHeaderUtils.test.ts +85 -13
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.ts +110 -52
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.ts +1 -1
- package/src/rum/types.ts +68 -8
- package/src/sdk/AccountInfoSingleton/AccountInfoSingleton.ts +49 -0
- package/src/sdk/AccountInfoSingleton/__tests__/AccountInfoSingleton.test.ts +90 -0
- package/src/sdk/AccountInfoSingleton/types.ts +11 -0
- package/src/sdk/AttributesEncoding/__tests__/attributesEncoding.test.ts +518 -0
- package/src/sdk/AttributesEncoding/__tests__/defaultEncoders.test.ts +198 -0
- package/src/sdk/AttributesEncoding/attributesEncoding.ts +56 -0
- package/src/sdk/AttributesEncoding/defaultEncoders.ts +175 -0
- package/src/{utils → sdk/AttributesEncoding}/errorUtils.ts +50 -22
- package/src/sdk/AttributesEncoding/helpers.ts +176 -0
- package/src/sdk/AttributesEncoding/types.ts +33 -0
- package/src/sdk/AttributesEncoding/utils.ts +31 -0
- package/src/sdk/AttributesSingleton/AttributesSingleton.ts +25 -1
- package/src/sdk/AttributesSingleton/__tests__/AttributesSingleton.test.ts +52 -8
- package/src/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.tsx +2 -2
- package/src/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.tsx +1 -1
- package/src/sdk/DatadogInternalBridge/__tests__/DdSdkNativeBridge.test.tsx +1 -1
- package/src/sdk/DatadogProvider/Buffer/BoundedBuffer.ts +4 -4
- package/src/sdk/DatadogProvider/Buffer/__tests__/BoundedBuffer.test.ts +5 -5
- package/src/sdk/DatadogProvider/DatadogProvider.tsx +12 -16
- package/src/sdk/DatadogProvider/DatadogProviderState.ts +30 -0
- package/src/sdk/DatadogProvider/__tests__/__utils__/renderWithProvider.tsx +18 -7
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +59 -33
- package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +26 -10
- package/src/sdk/DdSdk.ts +8 -5
- package/src/sdk/DdSdkInternal.ts +121 -0
- package/src/sdk/EventMappers/EventMapper.ts +9 -4
- package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +3 -3
- package/src/sdk/GlobalState/GlobalState.tsx +10 -11
- package/src/sdk/UserInfoSingleton/UserInfoSingleton.ts +9 -2
- package/src/sdk/UserInfoSingleton/__tests__/UserInfoSingleton.test.ts +46 -9
- package/src/sdk/UserInfoSingleton/types.ts +1 -4
- package/src/specs/NativeDdRum.ts +65 -0
- package/src/specs/NativeDdSdk.ts +40 -6
- package/src/trace/DdTrace.ts +11 -7
- package/src/trace/__tests__/DdTrace.test.ts +7 -8
- package/src/types.tsx +97 -76
- package/src/utils/__tests__/errorUtils.test.ts +1 -1
- package/src/utils/__tests__/singletonUtils.test.ts +75 -0
- package/src/utils/longTasksUtils.ts +1 -3
- package/src/utils/singletonUtils.ts +17 -0
- package/src/version.ts +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +0 -412
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +0 -1
- package/lib/commonjs/ProxyConfiguration.js.map +0 -1
- package/lib/commonjs/SdkVerbosity.js.map +0 -1
- package/lib/commonjs/TrackingConsent.js.map +0 -1
- package/lib/commonjs/rum/DdAttributes.js.map +0 -1
- package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js +0 -185
- package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +0 -1
- package/lib/commonjs/utils/argsUtils.js +0 -41
- package/lib/commonjs/utils/argsUtils.js.map +0 -1
- package/lib/commonjs/utils/errorUtils.js.map +0 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +0 -403
- package/lib/module/DdSdkReactNativeConfiguration.js.map +0 -1
- package/lib/module/ProxyConfiguration.js.map +0 -1
- package/lib/module/SdkVerbosity.js.map +0 -1
- package/lib/module/TrackingConsent.js.map +0 -1
- package/lib/module/rum/DdAttributes.js.map +0 -1
- package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js +0 -176
- package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +0 -1
- package/lib/module/utils/argsUtils.js +0 -35
- package/lib/module/utils/argsUtils.js.map +0 -1
- package/lib/module/utils/errorUtils.js.map +0 -1
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +0 -376
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts.map +0 -1
- package/lib/typescript/ProxyConfiguration.d.ts.map +0 -1
- package/lib/typescript/SdkVerbosity.d.ts.map +0 -1
- package/lib/typescript/TrackingConsent.d.ts.map +0 -1
- package/lib/typescript/rum/DdAttributes.d.ts.map +0 -1
- package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts +0 -34
- package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts.map +0 -1
- package/lib/typescript/utils/argsUtils.d.ts +0 -8
- package/lib/typescript/utils/argsUtils.d.ts.map +0 -1
- package/lib/typescript/utils/errorUtils.d.ts.map +0 -1
- package/src/DdSdkReactNativeConfiguration.tsx +0 -582
- package/src/sdk/FileBasedConfiguration/FileBasedConfiguration.ts +0 -241
- package/src/sdk/FileBasedConfiguration/__tests__/FileBasedConfiguration.test.ts +0 -255
- package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/configuration-all-fields.json +0 -27
- package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/malformed-configuration.json +0 -5
- package/src/utils/__tests__/argsUtils.test.ts +0 -66
- package/src/utils/argsUtils.ts +0 -41
- /package/lib/commonjs/{rum/DdAttributes.js → DdAttributes.js} +0 -0
- /package/lib/commonjs/{SdkVerbosity.js → config/types/SdkVerbosity.js} +0 -0
- /package/lib/commonjs/{TrackingConsent.js → config/types/TrackingConsent.js} +0 -0
- /package/lib/module/{rum/DdAttributes.js → DdAttributes.js} +0 -0
- /package/lib/module/{SdkVerbosity.js → config/types/SdkVerbosity.js} +0 -0
- /package/lib/module/{TrackingConsent.js → config/types/TrackingConsent.js} +0 -0
- /package/lib/typescript/{rum/DdAttributes.d.ts → DdAttributes.d.ts} +0 -0
- /package/lib/typescript/{ProxyConfiguration.d.ts → config/types/ProxyConfiguration.d.ts} +0 -0
- /package/lib/typescript/{SdkVerbosity.d.ts → config/types/SdkVerbosity.d.ts} +0 -0
- /package/lib/typescript/{TrackingConsent.d.ts → config/types/TrackingConsent.d.ts} +0 -0
- /package/src/{rum/DdAttributes.ts → DdAttributes.ts} +0 -0
- /package/src/{SdkVerbosity.tsx → config/types/SdkVerbosity.ts} +0 -0
- /package/src/{TrackingConsent.tsx → config/types/TrackingConsent.ts} +0 -0
|
@@ -5,7 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.formatBaggageHeader = formatBaggageHeader;
|
|
7
7
|
var _InternalLog = require("../../../../../InternalLog");
|
|
8
|
-
var _SdkVerbosity = require("../../../../../SdkVerbosity");
|
|
8
|
+
var _SdkVerbosity = require("../../../../../config/types/SdkVerbosity");
|
|
9
|
+
var _headers = require("../../distributedTracing/headers");
|
|
9
10
|
/*
|
|
10
11
|
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
11
12
|
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
@@ -34,7 +35,7 @@ function formatBaggageHeader(entries) {
|
|
|
34
35
|
const formattedParts = [];
|
|
35
36
|
for (const rawEntry of entries) {
|
|
36
37
|
if (!rawEntry.includes('=')) {
|
|
37
|
-
_InternalLog.InternalLog.log('XHRProxy: Dropped invalid baggage header entry - expected format "key=value".', _SdkVerbosity.SdkVerbosity.
|
|
38
|
+
_InternalLog.InternalLog.log('XHRProxy: Dropped invalid baggage header entry - expected format "key=value".', _SdkVerbosity.SdkVerbosity.ERROR);
|
|
38
39
|
continue;
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -42,16 +43,27 @@ function formatBaggageHeader(entries) {
|
|
|
42
43
|
const [mainPart, ...rawProperties] = rawEntry.split(';');
|
|
43
44
|
const idx = mainPart.indexOf('=');
|
|
44
45
|
if (idx <= 0) {
|
|
45
|
-
_InternalLog.InternalLog.log("XHRProxy: Dropped invalid baggage header entry - no '=' or empty key", _SdkVerbosity.SdkVerbosity.
|
|
46
|
+
_InternalLog.InternalLog.log("XHRProxy: Dropped invalid baggage header entry - no '=' or empty key", _SdkVerbosity.SdkVerbosity.ERROR);
|
|
46
47
|
continue;
|
|
47
48
|
}
|
|
48
49
|
const rawKey = mainPart.slice(0, idx).trim();
|
|
49
50
|
const rawValue = mainPart.slice(idx + 1).trim();
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const isDatadogKey = isDatadogPropertyKey(rawKey);
|
|
52
|
+
let encodedValue;
|
|
53
|
+
if (isDatadogKey) {
|
|
54
|
+
// Only encode datadog-specific properties
|
|
55
|
+
encodedValue = isDatadogKey ? encodeValue(rawValue) : rawValue;
|
|
56
|
+
} else {
|
|
57
|
+
if (!TOKEN_REGEX.test(rawKey)) {
|
|
58
|
+
_InternalLog.InternalLog.log('XHRProxy: invalid baggage header keys detected (not RFC 7230-compliant); functionality may be affected.', _SdkVerbosity.SdkVerbosity.WARN);
|
|
59
|
+
}
|
|
60
|
+
if (!isCompliantBaggageValue(rawValue)) {
|
|
61
|
+
_InternalLog.InternalLog.log('XHRProxy: invalid baggage header value detected (not RFC-compliant); functionality may be affected.', _SdkVerbosity.SdkVerbosity.WARN);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// non-datadog properties are not encoded
|
|
65
|
+
encodedValue = rawValue;
|
|
53
66
|
}
|
|
54
|
-
const encodedValue = encodeValue(rawValue);
|
|
55
67
|
|
|
56
68
|
// Handle properties
|
|
57
69
|
const properties = [];
|
|
@@ -65,8 +77,7 @@ function formatBaggageHeader(entries) {
|
|
|
65
77
|
// Property with no value (key1=value1;prop1; ... )
|
|
66
78
|
const propKey = trimmed.trim();
|
|
67
79
|
if (!TOKEN_REGEX.test(propKey)) {
|
|
68
|
-
_InternalLog.InternalLog.log('XHRProxy:
|
|
69
|
-
continue;
|
|
80
|
+
_InternalLog.InternalLog.log('XHRProxy: invalid baggage header property key detected (not RFC 7230-compliant); functionality may be affected.', _SdkVerbosity.SdkVerbosity.WARN);
|
|
70
81
|
}
|
|
71
82
|
properties.push(propKey);
|
|
72
83
|
} else {
|
|
@@ -74,8 +85,7 @@ function formatBaggageHeader(entries) {
|
|
|
74
85
|
const propKey = trimmed.slice(0, eqIdx).trim();
|
|
75
86
|
const propVal = trimmed.slice(eqIdx + 1).trim();
|
|
76
87
|
if (!TOKEN_REGEX.test(propKey)) {
|
|
77
|
-
_InternalLog.InternalLog.log('XHRProxy:
|
|
78
|
-
continue;
|
|
88
|
+
_InternalLog.InternalLog.log('XHRProxy: invalid baggage header key-value property key detected (not RFC 7230-compliant); functionality may be affected.', _SdkVerbosity.SdkVerbosity.WARN);
|
|
79
89
|
}
|
|
80
90
|
properties.push(`${propKey}=${encodeValue(propVal)}`);
|
|
81
91
|
}
|
|
@@ -89,47 +99,13 @@ function formatBaggageHeader(entries) {
|
|
|
89
99
|
return null;
|
|
90
100
|
}
|
|
91
101
|
const headerValue = formattedParts.join(',');
|
|
92
|
-
const byteLength =
|
|
102
|
+
const byteLength = Buffer.byteLength(headerValue, 'utf8');
|
|
93
103
|
if (byteLength > MAX_BYTES) {
|
|
94
104
|
_InternalLog.InternalLog.log(`Baggage header too large: ${byteLength} bytes > ${MAX_BYTES} - entries may be dropped (https://www.w3.org/TR/baggage/#limits)`, _SdkVerbosity.SdkVerbosity.WARN);
|
|
95
105
|
}
|
|
96
106
|
return headerValue;
|
|
97
107
|
}
|
|
98
108
|
|
|
99
|
-
/**
|
|
100
|
-
* Returns the number of bytes needed to encode a string in UTF-8.
|
|
101
|
-
*
|
|
102
|
-
* Useful as a lightweight alternative to Node.js `Buffer.byteLength()`
|
|
103
|
-
* for older environments that do not support it.
|
|
104
|
-
*
|
|
105
|
-
* @param text - The input string.
|
|
106
|
-
* @returns The UTF-8 byte length of the string.
|
|
107
|
-
*/
|
|
108
|
-
function utf8ByteLength(text) {
|
|
109
|
-
let byteLength = text.length;
|
|
110
|
-
for (let i = text.length - 1; i >= 0; i--) {
|
|
111
|
-
const code = text.charCodeAt(i);
|
|
112
|
-
|
|
113
|
-
// 2-byte characters (U+0080 to U+07FF)
|
|
114
|
-
if (code > 0x7f && code <= 0x7ff) {
|
|
115
|
-
byteLength++;
|
|
116
|
-
}
|
|
117
|
-
// 3-byte characters (U+0800 to U+FFFF)
|
|
118
|
-
else if (code > 0x7ff && code <= 0xffff) {
|
|
119
|
-
byteLength += 2;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Handle surrogate pairs (4-byte characters, e.g. emoji)
|
|
123
|
-
// These characters already count as 2 in the initial length
|
|
124
|
-
// Encountering the low surrogate already accounts for the full 4 bytes
|
|
125
|
-
// (2 from the initial length + 2 for the 3-byte characters logic above)
|
|
126
|
-
if (code >= 0xdc00 && code <= 0xdfff) {
|
|
127
|
-
i--; // prevents double counting the same character by skipping high surrogate
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return byteLength;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
109
|
/**
|
|
134
110
|
* Returns a set of valid baggage header characters.
|
|
135
111
|
*/
|
|
@@ -148,13 +124,25 @@ function getBaggageHeaderSafeChars() {
|
|
|
148
124
|
return safeChars;
|
|
149
125
|
}
|
|
150
126
|
|
|
151
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Checks if the given key is a Datadog-specific baggage property key.
|
|
129
|
+
* @param key the baggage property key.
|
|
130
|
+
* @returns true if the key is Datadog-specific, false otherwise.
|
|
131
|
+
*/
|
|
132
|
+
function isDatadogPropertyKey(key) {
|
|
133
|
+
return key === _headers.DD_RUM_SESSION_ID_TAG || key === _headers.DD_RUM_USER_ID_TAG || key === _headers.DD_RUM_ACCOUNT_ID_TAG;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
152
137
|
* Percent-encode all characters outside baggage-octet range.
|
|
138
|
+
* @param raw The raw baggage value.
|
|
139
|
+
* @returns the encoded baggage value.
|
|
153
140
|
*/
|
|
154
141
|
function encodeValue(raw) {
|
|
142
|
+
const decoded = tryDecodeValue(raw);
|
|
155
143
|
const safeChars = getBaggageHeaderSafeChars();
|
|
156
144
|
let result = '';
|
|
157
|
-
for (const ch of Array.from(
|
|
145
|
+
for (const ch of Array.from(decoded)) {
|
|
158
146
|
if (safeChars.has(ch)) {
|
|
159
147
|
result += ch;
|
|
160
148
|
} else {
|
|
@@ -166,4 +154,58 @@ function encodeValue(raw) {
|
|
|
166
154
|
}
|
|
167
155
|
return result;
|
|
168
156
|
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Try to decode the given baggage value, to avoid double-encoding.
|
|
160
|
+
* @param rawValue The raw baggage value.
|
|
161
|
+
* @returns the decoded value, or the original raw value if decoding fails.
|
|
162
|
+
*/
|
|
163
|
+
function tryDecodeValue(rawValue) {
|
|
164
|
+
try {
|
|
165
|
+
// Try interpreting it as already-encoded
|
|
166
|
+
return decodeURIComponent(rawValue);
|
|
167
|
+
} catch {
|
|
168
|
+
return rawValue;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Check if a character is a hexadecimal digit.
|
|
174
|
+
* @param ch The character to check.
|
|
175
|
+
* @returns true if the character is a hexadecimal digit, false otherwise.
|
|
176
|
+
*/
|
|
177
|
+
function isHexDigit(ch) {
|
|
178
|
+
return ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f';
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Check if a raw baggage value is RFC-compliant:
|
|
183
|
+
* - characters are in baggage-octet, OR
|
|
184
|
+
* - part of a valid %HH percent-encoded sequence.
|
|
185
|
+
*/
|
|
186
|
+
function isCompliantBaggageValue(raw) {
|
|
187
|
+
const safeChars = getBaggageHeaderSafeChars();
|
|
188
|
+
for (let i = 0; i < raw.length; i++) {
|
|
189
|
+
const ch = raw[i];
|
|
190
|
+
|
|
191
|
+
// Directly allowed character
|
|
192
|
+
if (safeChars.has(ch)) {
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Percent-encoded triplet: %HH
|
|
197
|
+
if (ch === '%' && i + 2 < raw.length) {
|
|
198
|
+
const h1 = raw[i + 1];
|
|
199
|
+
const h2 = raw[i + 2];
|
|
200
|
+
if (isHexDigit(h1) && isHexDigit(h2)) {
|
|
201
|
+
i += 2; // skip the two hex digits
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Not safe and not a valid %HH
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
169
211
|
//# sourceMappingURL=baggageHeaderUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_InternalLog","require","_SdkVerbosity","MAX_MEMBERS","MAX_BYTES","TOKEN_REGEX","baggageHeaderSafeChars","formatBaggageHeader","entries","formattedParts","rawEntry","includes","InternalLog","log","SdkVerbosity","
|
|
1
|
+
{"version":3,"names":["_InternalLog","require","_SdkVerbosity","_headers","MAX_MEMBERS","MAX_BYTES","TOKEN_REGEX","baggageHeaderSafeChars","formatBaggageHeader","entries","formattedParts","rawEntry","includes","InternalLog","log","SdkVerbosity","ERROR","mainPart","rawProperties","split","idx","indexOf","rawKey","slice","trim","rawValue","isDatadogKey","isDatadogPropertyKey","encodedValue","encodeValue","test","WARN","isCompliantBaggageValue","properties","rawProperty","trimmed","eqIdx","propKey","push","propVal","joinedProps","length","join","headerValue","byteLength","Buffer","getBaggageHeaderSafeChars","safeChars","Set","c","add","String","fromCharCode","key","DD_RUM_SESSION_ID_TAG","DD_RUM_USER_ID_TAG","DD_RUM_ACCOUNT_ID_TAG","raw","decoded","tryDecodeValue","result","ch","Array","from","has","utf8Bytes","value","toString","toUpperCase","padStart","decodeURIComponent","isHexDigit","i","h1","h2"],"sourceRoot":"../../../../../../../src","sources":["rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.ts"],"mappings":";;;;;;AAMA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AARA;AACA;AACA;AACA;AACA;;AAUA;AACA,MAAMG,WAAW,GAAG,EAAE;;AAEtB;AACA,MAAMC,SAAS,GAAG,IAAI;;AAEtB;AACA,MAAMC,WAAW,GAAG,gCAAgC;;AAEpD;AACA;AACA;AACA,IAAIC,sBAA+C;;AAEnD;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAACC,OAAoB,EAAiB;EACrE,MAAMC,cAAwB,GAAG,EAAE;EAEnC,KAAK,MAAMC,QAAQ,IAAIF,OAAO,EAAE;IAC5B,IAAI,CAACE,QAAQ,CAACC,QAAQ,CAAC,GAAG,CAAC,EAAE;MACzBC,wBAAW,CAACC,GAAG,CACX,+EAA+E,EAC/EC,0BAAY,CAACC,KACjB,CAAC;MACD;IACJ;;IAEA;IACA,MAAM,CAACC,QAAQ,EAAE,GAAGC,aAAa,CAAC,GAAGP,QAAQ,CAACQ,KAAK,CAAC,GAAG,CAAC;IACxD,MAAMC,GAAG,GAAGH,QAAQ,CAACI,OAAO,CAAC,GAAG,CAAC;IACjC,IAAID,GAAG,IAAI,CAAC,EAAE;MACVP,wBAAW,CAACC,GAAG,CACX,sEAAsE,EACtEC,0BAAY,CAACC,KACjB,CAAC;MACD;IACJ;IAEA,MAAMM,MAAM,GAAGL,QAAQ,CAACM,KAAK,CAAC,CAAC,EAAEH,GAAG,CAAC,CAACI,IAAI,CAAC,CAAC;IAC5C,MAAMC,QAAQ,GAAGR,QAAQ,CAACM,KAAK,CAACH,GAAG,GAAG,CAAC,CAAC,CAACI,IAAI,CAAC,CAAC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;AACA,SAASD,cAAcA,CAAClC,QAAgB,EAAU;EAC9C,IAAI;IACA;IACA,OAAO6C,kBAAkB,CAAC7C,QAAQ,CAAC;EACvC,CAAC,CAAC,MAAM;IACJ,OAAOA,QAAQ;EACnB;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS8C,UAAUA,CAACV,EAAU,EAAW;EACrC,OACKA,EAAE,IAAI,GAAG,IAAIA,EAAE,IAAI,GAAG,IACtBA,EAAE,IAAI,GAAG,IAAIA,EAAE,IAAI,GAAI,IACvBA,EAAE,IAAI,GAAG,IAAIA,EAAE,IAAI,GAAI;AAEhC;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS7B,uBAAuBA,CAACyB,GAAW,EAAW;EACnD,MAAMV,SAAS,GAAGD,yBAAyB,CAAC,CAAC;EAE7C,KAAK,IAAI0B,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGf,GAAG,CAAChB,MAAM,EAAE+B,CAAC,EAAE,EAAE;IACjC,MAAMX,EAAE,GAAGJ,GAAG,CAACe,CAAC,CAAC;;IAEjB;IACA,IAAIzB,SAAS,CAACiB,GAAG,CAACH,EAAE,CAAC,EAAE;MACnB;IACJ;;IAEA;IACA,IAAIA,EAAE,KAAK,GAAG,IAAIW,CAAC,GAAG,CAAC,GAAGf,GAAG,CAAChB,MAAM,EAAE;MAClC,MAAMgC,EAAE,GAAGhB,GAAG,CAACe,CAAC,GAAG,CAAC,CAAC;MACrB,MAAME,EAAE,GAAGjB,GAAG,CAACe,CAAC,GAAG,CAAC,CAAC;MACrB,IAAID,UAAU,CAACE,EAAE,CAAC,IAAIF,UAAU,CAACG,EAAE,CAAC,EAAE;QAClCF,CAAC,IAAI,CAAC,CAAC,CAAC;QACR;MACJ;IACJ;;IAEA;IACA,OAAO,KAAK;EAChB;EAEA,OAAO,IAAI;AACf","ignoreList":[]}
|
package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.RESOURCE_SIZE_ERROR_MESSAGE = void 0;
|
|
7
7
|
exports.calculateResponseSize = calculateResponseSize;
|
|
8
8
|
var _InternalLog = require("../../../../../InternalLog");
|
|
9
|
-
var _SdkVerbosity = require("../../../../../SdkVerbosity");
|
|
9
|
+
var _SdkVerbosity = require("../../../../../config/types/SdkVerbosity");
|
|
10
10
|
/*
|
|
11
11
|
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
12
12
|
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.RumActionType = exports.PropagatorType = exports.
|
|
6
|
+
exports.RumActionType = exports.PropagatorType = exports.ActionSource = void 0;
|
|
7
7
|
/*
|
|
8
8
|
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
9
9
|
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
@@ -28,14 +28,6 @@ let RumActionType = exports.RumActionType = /*#__PURE__*/function (RumActionType
|
|
|
28
28
|
RumActionType["CUSTOM"] = "CUSTOM";
|
|
29
29
|
return RumActionType;
|
|
30
30
|
}({});
|
|
31
|
-
let ErrorSource = exports.ErrorSource = /*#__PURE__*/function (ErrorSource) {
|
|
32
|
-
ErrorSource["NETWORK"] = "NETWORK";
|
|
33
|
-
ErrorSource["SOURCE"] = "SOURCE";
|
|
34
|
-
ErrorSource["CONSOLE"] = "CONSOLE";
|
|
35
|
-
ErrorSource["WEBVIEW"] = "WEBVIEW";
|
|
36
|
-
ErrorSource["CUSTOM"] = "CUSTOM";
|
|
37
|
-
return ErrorSource;
|
|
38
|
-
}({});
|
|
39
31
|
/**
|
|
40
32
|
* Type of instrumentation on the host.
|
|
41
33
|
* - DATADOG: Datadog’s propagator (`x-datadog-*`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RumActionType","exports","
|
|
1
|
+
{"version":3,"names":["RumActionType","exports","PropagatorType","ActionSource"],"sourceRoot":"../../../src","sources":["rum/types.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AAoQA;AACA;AACA;AAFA,IAGYA,aAAa,GAAAC,OAAA,CAAAD,aAAA,0BAAbA,aAAa;EACrB;EADQA,aAAa;EAGrB;EAHQA,aAAa;EAKrB;EALQA,aAAa;EAOrB;EAPQA,aAAa;EASrB;EATQA,aAAa;EAAA,OAAbA,aAAa;AAAA;AA0BzB;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAOYE,cAAc,GAAAD,OAAA,CAAAC,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAAA,IAOdC,YAAY,GAAAF,OAAA,CAAAE,YAAA,0BAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AccountInfoSingleton = void 0;
|
|
7
|
+
var _helper = require("../../rum/helper");
|
|
8
|
+
/*
|
|
9
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
10
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
11
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
class AccountInfoProvider {
|
|
15
|
+
accountInfo = undefined;
|
|
16
|
+
setAccountInfo = accountInfo => {
|
|
17
|
+
this.accountInfo = accountInfo;
|
|
18
|
+
(0, _helper.setCachedAccountId)(this.accountInfo.id);
|
|
19
|
+
};
|
|
20
|
+
addAccountExtraInfo = extraInfo => {
|
|
21
|
+
if (!this.accountInfo) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
this.accountInfo.extraInfo = {
|
|
25
|
+
...this.accountInfo.extraInfo,
|
|
26
|
+
...extraInfo
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
getAccountInfo = () => {
|
|
30
|
+
return this.accountInfo;
|
|
31
|
+
};
|
|
32
|
+
clearAccountInfo = () => {
|
|
33
|
+
this.accountInfo = undefined;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
class AccountInfoSingleton {
|
|
37
|
+
static accountInfoProvider = new AccountInfoProvider();
|
|
38
|
+
static getInstance = () => {
|
|
39
|
+
return AccountInfoSingleton.accountInfoProvider;
|
|
40
|
+
};
|
|
41
|
+
static reset = () => {
|
|
42
|
+
AccountInfoSingleton.accountInfoProvider = new AccountInfoProvider();
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
exports.AccountInfoSingleton = AccountInfoSingleton;
|
|
46
|
+
//# sourceMappingURL=AccountInfoSingleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_helper","require","AccountInfoProvider","accountInfo","undefined","setAccountInfo","setCachedAccountId","id","addAccountExtraInfo","extraInfo","getAccountInfo","clearAccountInfo","AccountInfoSingleton","accountInfoProvider","getInstance","reset","exports"],"sourceRoot":"../../../../src","sources":["sdk/AccountInfoSingleton/AccountInfoSingleton.ts"],"mappings":";;;;;;AAMA,IAAAA,OAAA,GAAAC,OAAA;AANA;AACA;AACA;AACA;AACA;;AAMA,MAAMC,mBAAmB,CAAC;EACdC,WAAW,GAA4BC,SAAS;EAExDC,cAAc,GAAIF,WAAwB,IAAK;IAC3C,IAAI,CAACA,WAAW,GAAGA,WAAW;IAC9B,IAAAG,0BAAkB,EAAC,IAAI,CAACH,WAAW,CAACI,EAAE,CAAC;EAC3C,CAAC;EAEDC,mBAAmB,GAAIC,SAAmC,IAAK;IAC3D,IAAI,CAAC,IAAI,CAACN,WAAW,EAAE;MACnB;IACJ;IAEA,IAAI,CAACA,WAAW,CAACM,SAAS,GAAG;MACzB,GAAG,IAAI,CAACN,WAAW,CAACM,SAAS;MAC7B,GAAGA;IACP,CAAC;EACL,CAAC;EAEDC,cAAc,GAAGA,CAAA,KAA+B;IAC5C,OAAO,IAAI,CAACP,WAAW;EAC3B,CAAC;EAEDQ,gBAAgB,GAAGA,CAAA,KAAM;IACrB,IAAI,CAACR,WAAW,GAAGC,SAAS;EAChC,CAAC;AACL;AAEO,MAAMQ,oBAAoB,CAAC;EAC9B,OAAeC,mBAAmB,GAAG,IAAIX,mBAAmB,CAAC,CAAC;EAE9D,OAAOY,WAAW,GAAGA,CAAA,KAA2B;IAC5C,OAAOF,oBAAoB,CAACC,mBAAmB;EACnD,CAAC;EAED,OAAOE,KAAK,GAAGA,CAAA,KAAM;IACjBH,oBAAoB,CAACC,mBAAmB,GAAG,IAAIX,mBAAmB,CAAC,CAAC;EACxE,CAAC;AACL;AAACc,OAAA,CAAAJ,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["sdk/AccountInfoSingleton/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.encodeAttributes = encodeAttributes;
|
|
7
|
+
var _DdSdk = require("../DdSdk");
|
|
8
|
+
var _defaultEncoders = require("./defaultEncoders");
|
|
9
|
+
var _helpers = require("./helpers");
|
|
10
|
+
var _utils = require("./utils");
|
|
11
|
+
/*
|
|
12
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
13
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
14
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Encodes arbitrary input into a flat dictionary of attributes.
|
|
19
|
+
* - Objects are flattened using dot syntax. Max depth handling is done on the native layer by the
|
|
20
|
+
* Android and iOS SDKs.
|
|
21
|
+
* - We assume the input does not always conform to Record<string, Encodable> and we:
|
|
22
|
+
* - Fallback to { context: givenValue } if a primitive is passed
|
|
23
|
+
* - Apply built-in and consumer encoders to all values
|
|
24
|
+
* - Drop values of unsupported types
|
|
25
|
+
* - Internal SDK attributes (starting with '_dd.') are preserved as-is without flattening
|
|
26
|
+
*/
|
|
27
|
+
function encodeAttributes(input) {
|
|
28
|
+
const result = {};
|
|
29
|
+
const allEncoders = [..._DdSdk.DdSdk.attributeEncoders, ..._defaultEncoders.builtInEncoders];
|
|
30
|
+
const context = {
|
|
31
|
+
numOfAttributes: 0
|
|
32
|
+
};
|
|
33
|
+
if ((0, _utils.isPlainObject)(input)) {
|
|
34
|
+
for (const [k, v] of Object.entries(input)) {
|
|
35
|
+
// Internal SDK attributes (starting with '_dd.') should not be flattened
|
|
36
|
+
// as they have a specific structure expected by the native SDK
|
|
37
|
+
if (k.startsWith('_dd.')) {
|
|
38
|
+
result[k] = v;
|
|
39
|
+
context.numOfAttributes++;
|
|
40
|
+
} else {
|
|
41
|
+
(0, _helpers.encodeAttributesInPlace)(v, result, [k], allEncoders, context);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
// Fallback for primitive values passed as root
|
|
46
|
+
(0, _helpers.encodeAttributesInPlace)(input, result, ['context'], allEncoders, context);
|
|
47
|
+
(0, _utils.warn)('Warning: attributes root should be an object.\n' + 'Received a primitive/array instead, which will be wrapped under the "context" key.');
|
|
48
|
+
}
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=attributesEncoding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_DdSdk","require","_defaultEncoders","_helpers","_utils","encodeAttributes","input","result","allEncoders","DdSdk","attributeEncoders","builtInEncoders","context","numOfAttributes","isPlainObject","k","v","Object","entries","startsWith","encodeAttributesInPlace","warn"],"sourceRoot":"../../../../src","sources":["sdk/AttributesEncoding/attributesEncoding.ts"],"mappings":";;;;;;AAMA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAZA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,gBAAgBA,CAACC,KAAc,EAA6B;EACxE,MAAMC,MAAiC,GAAG,CAAC,CAAC;EAC5C,MAAMC,WAAW,GAAG,CAAC,GAAGC,YAAK,CAACC,iBAAiB,EAAE,GAAGC,gCAAe,CAAC;EACpE,MAAMC,OAAsB,GAAG;IAAEC,eAAe,EAAE;EAAE,CAAC;EACrD,IAAI,IAAAC,oBAAa,EAACR,KAAK,CAAC,EAAE;IACtB,KAAK,MAAM,CAACS,CAAC,EAAEC,CAAC,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACZ,KAAK,CAAC,EAAE;MACxC;MACA;MACA,IAAIS,CAAC,CAACI,UAAU,CAAC,MAAM,CAAC,EAAE;QACtBZ,MAAM,CAACQ,CAAC,CAAC,GAAGC,CAAc;QAC1BJ,OAAO,CAACC,eAAe,EAAE;MAC7B,CAAC,MAAM;QACH,IAAAO,gCAAuB,EAACJ,CAAC,EAAET,MAAM,EAAE,CAACQ,CAAC,CAAC,EAAEP,WAAW,EAAEI,OAAO,CAAC;MACjE;IACJ;EACJ,CAAC,MAAM;IACH;IACA,IAAAQ,gCAAuB,EACnBd,KAAK,EACLC,MAAM,EACN,CAAC,SAAS,CAAC,EACXC,WAAW,EACXI,OACJ,CAAC;IACD,IAAAS,WAAI,EACA,iDAAiD,GAC7C,oFACR,CAAC;EACL;EAEA,OAAOd,MAAM;AACjB","ignoreList":[]}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.stringEncoder = exports.numberEncoder = exports.nullishEncoder = exports.mapEncoder = exports.errorEncoder = exports.dateEncoder = exports.builtInEncoders = exports.booleanEncoder = exports.arrayEncoder = void 0;
|
|
7
|
+
var _DdSdk = require("../DdSdk");
|
|
8
|
+
var _errorUtils = require("./errorUtils");
|
|
9
|
+
var _helpers = require("./helpers");
|
|
10
|
+
var _utils = require("./utils");
|
|
11
|
+
/*
|
|
12
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
13
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
14
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/* ----------------------------------------
|
|
18
|
+
* Built-in encoders
|
|
19
|
+
* -------------------------------------- */
|
|
20
|
+
|
|
21
|
+
/** Primitives: keep them explicit so the full pipeline is used uniformly. */
|
|
22
|
+
const stringEncoder = exports.stringEncoder = {
|
|
23
|
+
check: v => typeof v === 'string',
|
|
24
|
+
encode: v => v
|
|
25
|
+
};
|
|
26
|
+
const numberEncoder = exports.numberEncoder = {
|
|
27
|
+
check: v => typeof v === 'number',
|
|
28
|
+
encode: v => Number.isFinite(v) ? v : undefined // drop non-finite
|
|
29
|
+
};
|
|
30
|
+
const booleanEncoder = exports.booleanEncoder = {
|
|
31
|
+
check: v => typeof v === 'boolean',
|
|
32
|
+
encode: v => v
|
|
33
|
+
};
|
|
34
|
+
const nullishEncoder = exports.nullishEncoder = {
|
|
35
|
+
check: v => v === null || v === undefined,
|
|
36
|
+
encode: v => v
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Array encoder:
|
|
41
|
+
* - Sanitizes each item through the encoder pipeline.
|
|
42
|
+
* - Returns the sanitized array (it may later be flattened by the visitor if it still contains objects).
|
|
43
|
+
*/
|
|
44
|
+
const arrayEncoder = exports.arrayEncoder = {
|
|
45
|
+
check: Array.isArray,
|
|
46
|
+
encode: arr => arr.map(x => (0, _helpers.sanitizeForJson)(x, [..._DdSdk.DdSdk.attributeEncoders, ...builtInEncoders]))
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Default Datadog Date Encoder.
|
|
51
|
+
* This does not make assumptions on format; uses String(date).
|
|
52
|
+
*/
|
|
53
|
+
const dateEncoder = exports.dateEncoder = {
|
|
54
|
+
check: v => v instanceof Date,
|
|
55
|
+
encode: d => String(d)
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Extended Error Encoder.
|
|
60
|
+
* Serializes name, message, stack, and cause (ES2022+) for Error objects.
|
|
61
|
+
* If the error has other enumerable properties, they are included and sanitized.
|
|
62
|
+
*/
|
|
63
|
+
const errorEncoder = exports.errorEncoder = {
|
|
64
|
+
check: v => v instanceof Error,
|
|
65
|
+
encode: e => {
|
|
66
|
+
const extraAttributes = {};
|
|
67
|
+
|
|
68
|
+
// In React Native, some errors have extra fields we want to capture
|
|
69
|
+
if (e && typeof e === 'object') {
|
|
70
|
+
const allEncoders = [..._DdSdk.DdSdk.attributeEncoders, ...builtInEncoders];
|
|
71
|
+
(0, _helpers.encodeAttributesInPlace)(e, extraAttributes, [], allEncoders);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Remove fields that are duplicated in the dedicated fields below
|
|
75
|
+
if ('stacktrace' in e) {
|
|
76
|
+
delete extraAttributes['stacktrace'];
|
|
77
|
+
} else if ('stack' in e) {
|
|
78
|
+
delete extraAttributes['stack'];
|
|
79
|
+
} else if ('componentStack' in e) {
|
|
80
|
+
delete extraAttributes['componentStack'];
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
...extraAttributes,
|
|
84
|
+
name: (0, _errorUtils.getErrorName)(e),
|
|
85
|
+
message: (0, _errorUtils.getErrorMessage)(e),
|
|
86
|
+
stack: (0, _errorUtils.getErrorStackTrace)(e),
|
|
87
|
+
cause: e.cause
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Map encoder:
|
|
94
|
+
* - Converts Map into an array of entries.
|
|
95
|
+
* - Each entry is { key: string, keyType: string, value: Encodable }.
|
|
96
|
+
* - Keys are stringified with type info to reduce collision risk.
|
|
97
|
+
* - Entries with un-stringifiable keys are dropped (with a warning).
|
|
98
|
+
*/
|
|
99
|
+
const mapEncoder = exports.mapEncoder = {
|
|
100
|
+
check: v => v instanceof Map,
|
|
101
|
+
encode: map => {
|
|
102
|
+
const entries = [];
|
|
103
|
+
for (const [k, v] of map.entries()) {
|
|
104
|
+
try {
|
|
105
|
+
const keyType = typeof k;
|
|
106
|
+
let keyStr;
|
|
107
|
+
if (k === null) {
|
|
108
|
+
keyStr = 'null';
|
|
109
|
+
} else if (k === undefined) {
|
|
110
|
+
keyStr = 'undefined';
|
|
111
|
+
} else if (keyType === 'string' || keyType === 'number' || keyType === 'boolean' || keyType === 'bigint') {
|
|
112
|
+
keyStr = String(k);
|
|
113
|
+
} else if (typeof k === 'symbol') {
|
|
114
|
+
keyStr = k.description ? `Symbol(${k.description})` : 'Symbol';
|
|
115
|
+
} else if (typeof k === 'object' || typeof k === 'function') {
|
|
116
|
+
// Try to get a descriptive form
|
|
117
|
+
if (typeof k.toString === 'function') {
|
|
118
|
+
keyStr = k.toString();
|
|
119
|
+
} else {
|
|
120
|
+
keyStr = Object.prototype.toString.call(k); // e.g. "[object Object]"
|
|
121
|
+
}
|
|
122
|
+
} else {
|
|
123
|
+
(0, _utils.warn)(`Dropping Map entry: unsupported key type "${keyType}".`);
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const allEncoders = [..._DdSdk.DdSdk.attributeEncoders, ...builtInEncoders];
|
|
127
|
+
entries.push({
|
|
128
|
+
key: keyStr,
|
|
129
|
+
keyType,
|
|
130
|
+
value: (0, _helpers.sanitizeForJson)(v, allEncoders)
|
|
131
|
+
});
|
|
132
|
+
} catch (err) {
|
|
133
|
+
(0, _utils.warn)(`Failed to encode Map key: ${k}. ERROR: ${String(err)}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return entries;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const builtInEncoders = exports.builtInEncoders = [stringEncoder, numberEncoder, booleanEncoder, nullishEncoder, arrayEncoder, dateEncoder, errorEncoder, mapEncoder];
|
|
140
|
+
//# sourceMappingURL=defaultEncoders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_DdSdk","require","_errorUtils","_helpers","_utils","stringEncoder","exports","check","v","encode","numberEncoder","Number","isFinite","undefined","booleanEncoder","nullishEncoder","arrayEncoder","Array","isArray","arr","map","x","sanitizeForJson","DdSdk","attributeEncoders","builtInEncoders","dateEncoder","Date","d","String","errorEncoder","Error","e","extraAttributes","allEncoders","encodeAttributesInPlace","name","getErrorName","message","getErrorMessage","stack","getErrorStackTrace","cause","mapEncoder","Map","entries","k","keyType","keyStr","description","toString","Object","prototype","call","warn","push","key","value","err"],"sourceRoot":"../../../../src","sources":["sdk/AttributesEncoding/defaultEncoders.ts"],"mappings":";;;;;;AASA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAlBA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAYA;AACO,MAAMI,aAAuC,GAAAC,OAAA,CAAAD,aAAA,GAAG;EACnDE,KAAK,EAAGC,CAAC,IAAkB,OAAOA,CAAC,KAAK,QAAQ;EAChDC,MAAM,EAAED,CAA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Ae,GAAAnB,OAAA,CAAAmB,eAAA,GAAG,CAC3BpB,aAAa,EACbK,aAAa,EACbI,cAAc,EACdC,cAAc,EACdC,YAAY,EACZU,WAAW,EACXI,YAAY,EACZa,UAAU,CACb","ignoreList":[]}
|
|
@@ -3,27 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getErrorStackTrace = exports.getErrorName = exports.getErrorMessage = exports.
|
|
6
|
+
exports.getErrorStackTrace = exports.getErrorName = exports.getErrorMessage = exports.ERROR_EMPTY_STACKTRACE = exports.ERROR_EMPTY_MESSAGE = exports.ERROR_DEFAULT_NAME = void 0;
|
|
7
7
|
/*
|
|
8
8
|
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
9
9
|
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
10
10
|
* Copyright 2016-Present Datadog, Inc.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const DEFAULT_ERROR_NAME = exports.DEFAULT_ERROR_NAME = 'Error';
|
|
16
|
-
const getErrorMessage = error => {
|
|
17
|
-
let message = EMPTY_MESSAGE;
|
|
18
|
-
if (error === undefined || error === null) {
|
|
19
|
-
message = EMPTY_MESSAGE;
|
|
20
|
-
} else if (typeof error === 'object' && 'message' in error) {
|
|
21
|
-
message = String(error.message);
|
|
22
|
-
} else {
|
|
23
|
-
message = String(error);
|
|
24
|
-
}
|
|
25
|
-
return message;
|
|
26
|
-
};
|
|
12
|
+
const ERROR_EMPTY_STACKTRACE = exports.ERROR_EMPTY_STACKTRACE = '';
|
|
13
|
+
const ERROR_EMPTY_MESSAGE = exports.ERROR_EMPTY_MESSAGE = 'Unknown Error';
|
|
14
|
+
const ERROR_DEFAULT_NAME = exports.ERROR_DEFAULT_NAME = 'Error';
|
|
27
15
|
|
|
28
16
|
/**
|
|
29
17
|
* Will extract the stack from the error, taking the first key found among:
|
|
@@ -33,14 +21,13 @@ const getErrorMessage = error => {
|
|
|
33
21
|
* In last resort and if `sourceURL`, `line` and `column` are present, it will
|
|
34
22
|
* generate a stack from this information.
|
|
35
23
|
*/
|
|
36
|
-
exports.getErrorMessage = getErrorMessage;
|
|
37
24
|
const getErrorStackTrace = error => {
|
|
38
|
-
let stack =
|
|
25
|
+
let stack = ERROR_EMPTY_STACKTRACE;
|
|
39
26
|
try {
|
|
40
27
|
if (error === undefined || error === null) {
|
|
41
|
-
stack =
|
|
28
|
+
stack = ERROR_EMPTY_STACKTRACE;
|
|
42
29
|
} else if (typeof error === 'string') {
|
|
43
|
-
stack =
|
|
30
|
+
stack = ERROR_EMPTY_STACKTRACE;
|
|
44
31
|
} else if (typeof error === 'object') {
|
|
45
32
|
if ('stacktrace' in error) {
|
|
46
33
|
stack = String(error.stacktrace);
|
|
@@ -58,10 +45,40 @@ const getErrorStackTrace = error => {
|
|
|
58
45
|
return stack;
|
|
59
46
|
};
|
|
60
47
|
exports.getErrorStackTrace = getErrorStackTrace;
|
|
48
|
+
const getErrorMessage = error => {
|
|
49
|
+
if (error == null) {
|
|
50
|
+
return ERROR_EMPTY_MESSAGE;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// If it's an actual Error (or subclass)
|
|
54
|
+
if (error instanceof Error) {
|
|
55
|
+
// Prefer .message if defined, otherwise fallback to .toString()
|
|
56
|
+
return error.message || error.toString() || ERROR_EMPTY_MESSAGE;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// If it's an object with a message property (not necessarily Error)
|
|
60
|
+
if (typeof error === 'object' && 'message' in error && typeof error.message === 'string') {
|
|
61
|
+
return error.message || ERROR_EMPTY_MESSAGE;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// If it’s a primitive (string, number, boolean, symbol)
|
|
65
|
+
if (typeof error === 'string' || typeof error === 'number' || typeof error === 'boolean' || typeof error === 'symbol') {
|
|
66
|
+
return String(error);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// If it has its own toString (not the default Object one)
|
|
70
|
+
if (typeof error?.toString === 'function' && error.toString !== Object.prototype.toString) {
|
|
71
|
+
return error.toString();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Fallback
|
|
75
|
+
return ERROR_EMPTY_MESSAGE;
|
|
76
|
+
};
|
|
77
|
+
exports.getErrorMessage = getErrorMessage;
|
|
61
78
|
const getErrorName = error => {
|
|
62
79
|
try {
|
|
63
80
|
if (typeof error !== 'object' || error === null) {
|
|
64
|
-
return
|
|
81
|
+
return ERROR_DEFAULT_NAME;
|
|
65
82
|
}
|
|
66
83
|
if (typeof error.name === 'string') {
|
|
67
84
|
return error.name;
|
|
@@ -69,7 +86,7 @@ const getErrorName = error => {
|
|
|
69
86
|
} catch (e) {
|
|
70
87
|
// Do nothing
|
|
71
88
|
}
|
|
72
|
-
return
|
|
89
|
+
return ERROR_DEFAULT_NAME;
|
|
73
90
|
};
|
|
74
91
|
exports.getErrorName = getErrorName;
|
|
75
92
|
//# sourceMappingURL=errorUtils.js.map
|