@pratham.raval/browser-core 6.22.3
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/README.md +3 -0
- package/cjs/boot/displayAlreadyInitializedError.d.ts +2 -0
- package/cjs/boot/displayAlreadyInitializedError.js +10 -0
- package/cjs/boot/displayAlreadyInitializedError.js.map +1 -0
- package/cjs/boot/init.d.ts +14 -0
- package/cjs/boot/init.js +39 -0
- package/cjs/boot/init.js.map +1 -0
- package/cjs/browser/addEventListener.d.ts +87 -0
- package/cjs/browser/addEventListener.js +55 -0
- package/cjs/browser/addEventListener.js.map +1 -0
- package/cjs/browser/browser.types.d.ts +51 -0
- package/cjs/browser/browser.types.js +6 -0
- package/cjs/browser/browser.types.js.map +1 -0
- package/cjs/browser/cookie.d.ts +18 -0
- package/cjs/browser/cookie.js +101 -0
- package/cjs/browser/cookie.js.map +1 -0
- package/cjs/browser/fetchObservable.d.ts +25 -0
- package/cjs/browser/fetchObservable.js +79 -0
- package/cjs/browser/fetchObservable.js.map +1 -0
- package/cjs/browser/pageMayExitObservable.d.ts +14 -0
- package/cjs/browser/pageMayExitObservable.js +45 -0
- package/cjs/browser/pageMayExitObservable.js.map +1 -0
- package/cjs/browser/runOnReadyState.d.ts +5 -0
- package/cjs/browser/runOnReadyState.js +20 -0
- package/cjs/browser/runOnReadyState.js.map +1 -0
- package/cjs/browser/xhrObservable.d.ts +23 -0
- package/cjs/browser/xhrObservable.js +83 -0
- package/cjs/browser/xhrObservable.js.map +1 -0
- package/cjs/domain/allowedTrackingOrigins.d.ts +4 -0
- package/cjs/domain/allowedTrackingOrigins.js +25 -0
- package/cjs/domain/allowedTrackingOrigins.js.map +1 -0
- package/cjs/domain/bufferedData.d.ts +14 -0
- package/cjs/domain/bufferedData.js +22 -0
- package/cjs/domain/bufferedData.js.map +1 -0
- package/cjs/domain/configuration/configuration.d.ts +303 -0
- package/cjs/domain/configuration/configuration.js +152 -0
- package/cjs/domain/configuration/configuration.js.map +1 -0
- package/cjs/domain/configuration/endpointBuilder.d.ts +12 -0
- package/cjs/domain/configuration/endpointBuilder.js +78 -0
- package/cjs/domain/configuration/endpointBuilder.js.map +1 -0
- package/cjs/domain/configuration/index.d.ts +5 -0
- package/cjs/domain/configuration/index.js +16 -0
- package/cjs/domain/configuration/index.js.map +1 -0
- package/cjs/domain/configuration/transportConfiguration.d.ts +20 -0
- package/cjs/domain/configuration/transportConfiguration.js +54 -0
- package/cjs/domain/configuration/transportConfiguration.js.map +1 -0
- package/cjs/domain/connectivity/connectivity.d.ts +14 -0
- package/cjs/domain/connectivity/connectivity.js +14 -0
- package/cjs/domain/connectivity/connectivity.js.map +1 -0
- package/cjs/domain/connectivity/index.d.ts +1 -0
- package/cjs/domain/connectivity/index.js +18 -0
- package/cjs/domain/connectivity/index.js.map +1 -0
- package/cjs/domain/console/consoleObservable.d.ts +21 -0
- package/cjs/domain/console/consoleObservable.js +84 -0
- package/cjs/domain/console/consoleObservable.js.map +1 -0
- package/cjs/domain/context/contextConstants.d.ts +21 -0
- package/cjs/domain/context/contextConstants.js +18 -0
- package/cjs/domain/context/contextConstants.js.map +1 -0
- package/cjs/domain/context/contextManager.d.ts +19 -0
- package/cjs/domain/context/contextManager.js +60 -0
- package/cjs/domain/context/contextManager.js.map +1 -0
- package/cjs/domain/context/contextUtils.d.ts +5 -0
- package/cjs/domain/context/contextUtils.js +16 -0
- package/cjs/domain/context/contextUtils.js.map +1 -0
- package/cjs/domain/context/defineContextMethod.d.ts +6 -0
- package/cjs/domain/context/defineContextMethod.js +21 -0
- package/cjs/domain/context/defineContextMethod.js.map +1 -0
- package/cjs/domain/context/storeContextManager.d.ts +6 -0
- package/cjs/domain/context/storeContextManager.js +40 -0
- package/cjs/domain/context/storeContextManager.js.map +1 -0
- package/cjs/domain/contexts/accountContext.d.ts +26 -0
- package/cjs/domain/contexts/accountContext.js +33 -0
- package/cjs/domain/contexts/accountContext.js.map +1 -0
- package/cjs/domain/contexts/globalContext.d.ts +18 -0
- package/cjs/domain/contexts/globalContext.js +21 -0
- package/cjs/domain/contexts/globalContext.js.map +1 -0
- package/cjs/domain/contexts/rumInternalContext.type.d.ts +14 -0
- package/cjs/domain/contexts/rumInternalContext.type.js +3 -0
- package/cjs/domain/contexts/rumInternalContext.type.js.map +1 -0
- package/cjs/domain/contexts/userContext.d.ts +29 -0
- package/cjs/domain/contexts/userContext.js +45 -0
- package/cjs/domain/contexts/userContext.js.map +1 -0
- package/cjs/domain/deflate/deflate.types.d.ts +40 -0
- package/cjs/domain/deflate/deflate.types.js +3 -0
- package/cjs/domain/deflate/deflate.types.js.map +1 -0
- package/cjs/domain/deflate/index.d.ts +1 -0
- package/cjs/domain/deflate/index.js +18 -0
- package/cjs/domain/deflate/index.js.map +1 -0
- package/cjs/domain/error/error.d.ts +23 -0
- package/cjs/domain/error/error.js +74 -0
- package/cjs/domain/error/error.js.map +1 -0
- package/cjs/domain/error/error.types.d.ts +47 -0
- package/cjs/domain/error/error.types.js +13 -0
- package/cjs/domain/error/error.types.js.map +1 -0
- package/cjs/domain/error/trackRuntimeError.d.ts +11 -0
- package/cjs/domain/error/trackRuntimeError.js +48 -0
- package/cjs/domain/error/trackRuntimeError.js.map +1 -0
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.d.ts +5 -0
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js +39 -0
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -0
- package/cjs/domain/extension/extensionUtils.d.ts +10 -0
- package/cjs/domain/extension/extensionUtils.js +30 -0
- package/cjs/domain/extension/extensionUtils.js.map +1 -0
- package/cjs/domain/intakeSites.d.ts +8 -0
- package/cjs/domain/intakeSites.js +11 -0
- package/cjs/domain/intakeSites.js.map +1 -0
- package/cjs/domain/report/browser.types.d.ts +34 -0
- package/cjs/domain/report/browser.types.js +3 -0
- package/cjs/domain/report/browser.types.js.map +1 -0
- package/cjs/domain/report/reportObservable.d.ts +14 -0
- package/cjs/domain/report/reportObservable.js +99 -0
- package/cjs/domain/report/reportObservable.js.map +1 -0
- package/cjs/domain/resourceUtils.d.ts +18 -0
- package/cjs/domain/resourceUtils.js +20 -0
- package/cjs/domain/resourceUtils.js.map +1 -0
- package/cjs/domain/session/oldCookiesMigration.d.ts +11 -0
- package/cjs/domain/session/oldCookiesMigration.js +40 -0
- package/cjs/domain/session/oldCookiesMigration.js.map +1 -0
- package/cjs/domain/session/sessionConstants.d.ts +15 -0
- package/cjs/domain/session/sessionConstants.js +16 -0
- package/cjs/domain/session/sessionConstants.js.map +1 -0
- package/cjs/domain/session/sessionManager.d.ts +28 -0
- package/cjs/domain/session/sessionManager.js +185 -0
- package/cjs/domain/session/sessionManager.js.map +1 -0
- package/cjs/domain/session/sessionState.d.ts +16 -0
- package/cjs/domain/session/sessionState.js +76 -0
- package/cjs/domain/session/sessionState.js.map +1 -0
- package/cjs/domain/session/sessionStateValidation.d.ts +3 -0
- package/cjs/domain/session/sessionStateValidation.js +11 -0
- package/cjs/domain/session/sessionStateValidation.js.map +1 -0
- package/cjs/domain/session/sessionStore.d.ts +38 -0
- package/cjs/domain/session/sessionStore.js +181 -0
- package/cjs/domain/session/sessionStore.js.map +1 -0
- package/cjs/domain/session/sessionStoreOperations.d.ts +12 -0
- package/cjs/domain/session/sessionStoreOperations.js +119 -0
- package/cjs/domain/session/sessionStoreOperations.js.map +1 -0
- package/cjs/domain/session/storeStrategies/sessionInCookie.d.ts +8 -0
- package/cjs/domain/session/storeStrategies/sessionInCookie.js +56 -0
- package/cjs/domain/session/storeStrategies/sessionInCookie.js.map +1 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.d.ts +4 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js +41 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -0
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.d.ts +16 -0
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js +5 -0
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js.map +1 -0
- package/cjs/domain/synthetics/syntheticsWorkerValues.d.ts +12 -0
- package/cjs/domain/synthetics/syntheticsWorkerValues.js +31 -0
- package/cjs/domain/synthetics/syntheticsWorkerValues.js.map +1 -0
- package/cjs/domain/tags.d.ts +6 -0
- package/cjs/domain/tags.js +67 -0
- package/cjs/domain/tags.js.map +1 -0
- package/cjs/domain/telemetry/index.d.ts +4 -0
- package/cjs/domain/telemetry/index.js +28 -0
- package/cjs/domain/telemetry/index.js.map +1 -0
- package/cjs/domain/telemetry/rawTelemetryEvent.types.d.ts +18 -0
- package/cjs/domain/telemetry/rawTelemetryEvent.types.js +9 -0
- package/cjs/domain/telemetry/rawTelemetryEvent.types.js.map +1 -0
- package/cjs/domain/telemetry/telemetry.d.ts +56 -0
- package/cjs/domain/telemetry/telemetry.js +248 -0
- package/cjs/domain/telemetry/telemetry.js.map +1 -0
- package/cjs/domain/telemetry/telemetryEvent.types.d.ts +858 -0
- package/cjs/domain/telemetry/telemetryEvent.types.js +7 -0
- package/cjs/domain/telemetry/telemetryEvent.types.js.map +1 -0
- package/cjs/domain/trackingConsent.d.ts +13 -0
- package/cjs/domain/trackingConsent.js +28 -0
- package/cjs/domain/trackingConsent.js.map +1 -0
- package/cjs/index.d.ts +100 -0
- package/cjs/index.js +193 -0
- package/cjs/index.js.map +1 -0
- package/cjs/tools/abstractHooks.d.ts +24 -0
- package/cjs/tools/abstractHooks.js +41 -0
- package/cjs/tools/abstractHooks.js.map +1 -0
- package/cjs/tools/abstractLifeCycle.d.ts +23 -0
- package/cjs/tools/abstractLifeCycle.js +28 -0
- package/cjs/tools/abstractLifeCycle.js.map +1 -0
- package/cjs/tools/boundedBuffer.d.ts +16 -0
- package/cjs/tools/boundedBuffer.js +32 -0
- package/cjs/tools/boundedBuffer.js.map +1 -0
- package/cjs/tools/catchUserErrors.d.ts +1 -0
- package/cjs/tools/catchUserErrors.js +15 -0
- package/cjs/tools/catchUserErrors.js.map +1 -0
- package/cjs/tools/display.d.ts +38 -0
- package/cjs/tools/display.js +44 -0
- package/cjs/tools/display.js.map +1 -0
- package/cjs/tools/encoder.d.ts +54 -0
- package/cjs/tools/encoder.js +40 -0
- package/cjs/tools/encoder.js.map +1 -0
- package/cjs/tools/experimentalFeatures.d.ts +20 -0
- package/cjs/tools/experimentalFeatures.js +49 -0
- package/cjs/tools/experimentalFeatures.js.map +1 -0
- package/cjs/tools/getZoneJsOriginalValue.d.ts +19 -0
- package/cjs/tools/getZoneJsOriginalValue.js +29 -0
- package/cjs/tools/getZoneJsOriginalValue.js.map +1 -0
- package/cjs/tools/globalObject.d.ts +19 -0
- package/cjs/tools/globalObject.js +44 -0
- package/cjs/tools/globalObject.js.map +1 -0
- package/cjs/tools/instrumentMethod.d.ts +75 -0
- package/cjs/tools/instrumentMethod.js +118 -0
- package/cjs/tools/instrumentMethod.js.map +1 -0
- package/cjs/tools/matchOption.d.ts +8 -0
- package/cjs/tools/matchOption.js +35 -0
- package/cjs/tools/matchOption.js.map +1 -0
- package/cjs/tools/mergeInto.d.ts +25 -0
- package/cjs/tools/mergeInto.js +98 -0
- package/cjs/tools/mergeInto.js.map +1 -0
- package/cjs/tools/monitor.d.ts +9 -0
- package/cjs/tools/monitor.js +62 -0
- package/cjs/tools/monitor.js.map +1 -0
- package/cjs/tools/observable.d.ts +30 -0
- package/cjs/tools/observable.js +89 -0
- package/cjs/tools/observable.js.map +1 -0
- package/cjs/tools/queueMicrotask.d.ts +1 -0
- package/cjs/tools/queueMicrotask.js +17 -0
- package/cjs/tools/queueMicrotask.js.map +1 -0
- package/cjs/tools/readBytesFromStream.d.ts +11 -0
- package/cjs/tools/readBytesFromStream.js +63 -0
- package/cjs/tools/readBytesFromStream.js.map +1 -0
- package/cjs/tools/requestIdleCallback.d.ts +12 -0
- package/cjs/tools/requestIdleCallback.js +35 -0
- package/cjs/tools/requestIdleCallback.js.map +1 -0
- package/cjs/tools/sendToExtension.d.ts +3 -0
- package/cjs/tools/sendToExtension.js +11 -0
- package/cjs/tools/sendToExtension.js.map +1 -0
- package/cjs/tools/serialisation/context.d.ts +9 -0
- package/cjs/tools/serialisation/context.js +3 -0
- package/cjs/tools/serialisation/context.js.map +1 -0
- package/cjs/tools/serialisation/jsonStringify.d.ts +13 -0
- package/cjs/tools/serialisation/jsonStringify.js +48 -0
- package/cjs/tools/serialisation/jsonStringify.js.map +1 -0
- package/cjs/tools/serialisation/sanitize.d.ts +18 -0
- package/cjs/tools/serialisation/sanitize.js +188 -0
- package/cjs/tools/serialisation/sanitize.js.map +1 -0
- package/cjs/tools/stackTrace/computeStackTrace.d.ts +25 -0
- package/cjs/tools/stackTrace/computeStackTrace.js +187 -0
- package/cjs/tools/stackTrace/computeStackTrace.js.map +1 -0
- package/cjs/tools/stackTrace/handlingStack.d.ts +10 -0
- package/cjs/tools/stackTrace/handlingStack.js +46 -0
- package/cjs/tools/stackTrace/handlingStack.js.map +1 -0
- package/cjs/tools/taskQueue.d.ts +15 -0
- package/cjs/tools/taskQueue.js +54 -0
- package/cjs/tools/taskQueue.js.map +1 -0
- package/cjs/tools/timer.d.ts +5 -0
- package/cjs/tools/timer.js +22 -0
- package/cjs/tools/timer.js.map +1 -0
- package/cjs/tools/utils/arrayUtils.d.ts +3 -0
- package/cjs/tools/utils/arrayUtils.js +20 -0
- package/cjs/tools/utils/arrayUtils.js.map +1 -0
- package/cjs/tools/utils/browserDetection.d.ts +8 -0
- package/cjs/tools/utils/browserDetection.js +33 -0
- package/cjs/tools/utils/browserDetection.js.map +1 -0
- package/cjs/tools/utils/byteUtils.d.ts +8 -0
- package/cjs/tools/utils/byteUtils.js +30 -0
- package/cjs/tools/utils/byteUtils.js.map +1 -0
- package/cjs/tools/utils/functionUtils.d.ts +8 -0
- package/cjs/tools/utils/functionUtils.js +43 -0
- package/cjs/tools/utils/functionUtils.js.map +1 -0
- package/cjs/tools/utils/numberUtils.d.ts +9 -0
- package/cjs/tools/utils/numberUtils.js +24 -0
- package/cjs/tools/utils/numberUtils.js.map +1 -0
- package/cjs/tools/utils/objectUtils.d.ts +10 -0
- package/cjs/tools/utils/objectUtils.js +23 -0
- package/cjs/tools/utils/objectUtils.js.map +1 -0
- package/cjs/tools/utils/polyfills.d.ts +7 -0
- package/cjs/tools/utils/polyfills.js +23 -0
- package/cjs/tools/utils/polyfills.js.map +1 -0
- package/cjs/tools/utils/responseUtils.d.ts +2 -0
- package/cjs/tools/utils/responseUtils.js +17 -0
- package/cjs/tools/utils/responseUtils.js.map +1 -0
- package/cjs/tools/utils/stringUtils.d.ts +8 -0
- package/cjs/tools/utils/stringUtils.js +55 -0
- package/cjs/tools/utils/stringUtils.js.map +1 -0
- package/cjs/tools/utils/timeUtils.d.ts +53 -0
- package/cjs/tools/utils/timeUtils.js +101 -0
- package/cjs/tools/utils/timeUtils.js.map +1 -0
- package/cjs/tools/utils/timezone.d.ts +1 -0
- package/cjs/tools/utils/timezone.js +13 -0
- package/cjs/tools/utils/timezone.js.map +1 -0
- package/cjs/tools/utils/typeUtils.d.ts +4 -0
- package/cjs/tools/utils/typeUtils.js +16 -0
- package/cjs/tools/utils/typeUtils.js.map +1 -0
- package/cjs/tools/utils/urlPolyfill.d.ts +5 -0
- package/cjs/tools/utils/urlPolyfill.js +59 -0
- package/cjs/tools/utils/urlPolyfill.js.map +1 -0
- package/cjs/tools/valueHistory.d.ts +27 -0
- package/cjs/tools/valueHistory.js +104 -0
- package/cjs/tools/valueHistory.js.map +1 -0
- package/cjs/transport/batch.d.ts +16 -0
- package/cjs/transport/batch.js +108 -0
- package/cjs/transport/batch.js.map +1 -0
- package/cjs/transport/eventBridge.d.ts +21 -0
- package/cjs/transport/eventBridge.js +46 -0
- package/cjs/transport/eventBridge.js.map +1 -0
- package/cjs/transport/flushController.d.ts +58 -0
- package/cjs/transport/flushController.js +109 -0
- package/cjs/transport/flushController.js.map +1 -0
- package/cjs/transport/httpRequest.d.ts +51 -0
- package/cjs/transport/httpRequest.js +80 -0
- package/cjs/transport/httpRequest.js.map +1 -0
- package/cjs/transport/index.d.ts +7 -0
- package/cjs/transport/index.js +14 -0
- package/cjs/transport/index.js.map +1 -0
- package/cjs/transport/sendWithRetryStrategy.d.ts +41 -0
- package/cjs/transport/sendWithRetryStrategy.js +163 -0
- package/cjs/transport/sendWithRetryStrategy.js.map +1 -0
- package/esm/boot/displayAlreadyInitializedError.d.ts +2 -0
- package/esm/boot/displayAlreadyInitializedError.js +7 -0
- package/esm/boot/displayAlreadyInitializedError.js.map +1 -0
- package/esm/boot/init.d.ts +14 -0
- package/esm/boot/init.js +35 -0
- package/esm/boot/init.js.map +1 -0
- package/esm/browser/addEventListener.d.ts +87 -0
- package/esm/browser/addEventListener.js +51 -0
- package/esm/browser/addEventListener.js.map +1 -0
- package/esm/browser/browser.types.d.ts +51 -0
- package/esm/browser/browser.types.js +5 -0
- package/esm/browser/browser.types.js.map +1 -0
- package/esm/browser/cookie.d.ts +18 -0
- package/esm/browser/cookie.js +91 -0
- package/esm/browser/cookie.js.map +1 -0
- package/esm/browser/fetchObservable.d.ts +25 -0
- package/esm/browser/fetchObservable.js +75 -0
- package/esm/browser/fetchObservable.js.map +1 -0
- package/esm/browser/pageMayExitObservable.d.ts +14 -0
- package/esm/browser/pageMayExitObservable.js +40 -0
- package/esm/browser/pageMayExitObservable.js.map +1 -0
- package/esm/browser/runOnReadyState.d.ts +5 -0
- package/esm/browser/runOnReadyState.js +16 -0
- package/esm/browser/runOnReadyState.js.map +1 -0
- package/esm/browser/xhrObservable.d.ts +23 -0
- package/esm/browser/xhrObservable.js +80 -0
- package/esm/browser/xhrObservable.js.map +1 -0
- package/esm/domain/allowedTrackingOrigins.d.ts +4 -0
- package/esm/domain/allowedTrackingOrigins.js +21 -0
- package/esm/domain/allowedTrackingOrigins.js.map +1 -0
- package/esm/domain/bufferedData.d.ts +14 -0
- package/esm/domain/bufferedData.js +19 -0
- package/esm/domain/bufferedData.js.map +1 -0
- package/esm/domain/configuration/configuration.d.ts +303 -0
- package/esm/domain/configuration/configuration.js +146 -0
- package/esm/domain/configuration/configuration.js.map +1 -0
- package/esm/domain/configuration/endpointBuilder.d.ts +12 -0
- package/esm/domain/configuration/endpointBuilder.js +74 -0
- package/esm/domain/configuration/endpointBuilder.js.map +1 -0
- package/esm/domain/configuration/index.d.ts +5 -0
- package/esm/domain/configuration/index.js +4 -0
- package/esm/domain/configuration/index.js.map +1 -0
- package/esm/domain/configuration/transportConfiguration.d.ts +20 -0
- package/esm/domain/configuration/transportConfiguration.js +50 -0
- package/esm/domain/configuration/transportConfiguration.js.map +1 -0
- package/esm/domain/connectivity/connectivity.d.ts +14 -0
- package/esm/domain/connectivity/connectivity.js +11 -0
- package/esm/domain/connectivity/connectivity.js.map +1 -0
- package/esm/domain/connectivity/index.d.ts +1 -0
- package/esm/domain/connectivity/index.js +2 -0
- package/esm/domain/connectivity/index.js.map +1 -0
- package/esm/domain/console/consoleObservable.d.ts +21 -0
- package/esm/domain/console/consoleObservable.js +80 -0
- package/esm/domain/console/consoleObservable.js.map +1 -0
- package/esm/domain/context/contextConstants.d.ts +21 -0
- package/esm/domain/context/contextConstants.js +15 -0
- package/esm/domain/context/contextConstants.js.map +1 -0
- package/esm/domain/context/contextManager.d.ts +19 -0
- package/esm/domain/context/contextManager.js +57 -0
- package/esm/domain/context/contextManager.js.map +1 -0
- package/esm/domain/context/contextUtils.d.ts +5 -0
- package/esm/domain/context/contextUtils.js +13 -0
- package/esm/domain/context/contextUtils.js.map +1 -0
- package/esm/domain/context/defineContextMethod.d.ts +6 -0
- package/esm/domain/context/defineContextMethod.js +17 -0
- package/esm/domain/context/defineContextMethod.js.map +1 -0
- package/esm/domain/context/storeContextManager.d.ts +6 -0
- package/esm/domain/context/storeContextManager.js +35 -0
- package/esm/domain/context/storeContextManager.js.map +1 -0
- package/esm/domain/contexts/accountContext.d.ts +26 -0
- package/esm/domain/contexts/accountContext.js +29 -0
- package/esm/domain/contexts/accountContext.js.map +1 -0
- package/esm/domain/contexts/globalContext.d.ts +18 -0
- package/esm/domain/contexts/globalContext.js +17 -0
- package/esm/domain/contexts/globalContext.js.map +1 -0
- package/esm/domain/contexts/rumInternalContext.type.d.ts +14 -0
- package/esm/domain/contexts/rumInternalContext.type.js +2 -0
- package/esm/domain/contexts/rumInternalContext.type.js.map +1 -0
- package/esm/domain/contexts/userContext.d.ts +29 -0
- package/esm/domain/contexts/userContext.js +41 -0
- package/esm/domain/contexts/userContext.js.map +1 -0
- package/esm/domain/deflate/deflate.types.d.ts +40 -0
- package/esm/domain/deflate/deflate.types.js +2 -0
- package/esm/domain/deflate/deflate.types.js.map +1 -0
- package/esm/domain/deflate/index.d.ts +1 -0
- package/esm/domain/deflate/index.js +2 -0
- package/esm/domain/deflate/index.js.map +1 -0
- package/esm/domain/error/error.d.ts +23 -0
- package/esm/domain/error/error.js +65 -0
- package/esm/domain/error/error.js.map +1 -0
- package/esm/domain/error/error.types.d.ts +47 -0
- package/esm/domain/error/error.types.js +10 -0
- package/esm/domain/error/error.types.js.map +1 -0
- package/esm/domain/error/trackRuntimeError.d.ts +11 -0
- package/esm/domain/error/trackRuntimeError.js +43 -0
- package/esm/domain/error/trackRuntimeError.js.map +1 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.d.ts +5 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js +36 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -0
- package/esm/domain/extension/extensionUtils.d.ts +10 -0
- package/esm/domain/extension/extensionUtils.js +25 -0
- package/esm/domain/extension/extensionUtils.js.map +1 -0
- package/esm/domain/intakeSites.d.ts +8 -0
- package/esm/domain/intakeSites.js +8 -0
- package/esm/domain/intakeSites.js.map +1 -0
- package/esm/domain/report/browser.types.d.ts +34 -0
- package/esm/domain/report/browser.types.js +2 -0
- package/esm/domain/report/browser.types.js.map +1 -0
- package/esm/domain/report/reportObservable.d.ts +14 -0
- package/esm/domain/report/reportObservable.js +95 -0
- package/esm/domain/report/reportObservable.js.map +1 -0
- package/esm/domain/resourceUtils.d.ts +18 -0
- package/esm/domain/resourceUtils.js +17 -0
- package/esm/domain/resourceUtils.js.map +1 -0
- package/esm/domain/session/oldCookiesMigration.d.ts +11 -0
- package/esm/domain/session/oldCookiesMigration.js +36 -0
- package/esm/domain/session/oldCookiesMigration.js.map +1 -0
- package/esm/domain/session/sessionConstants.d.ts +15 -0
- package/esm/domain/session/sessionConstants.js +13 -0
- package/esm/domain/session/sessionConstants.js.map +1 -0
- package/esm/domain/session/sessionManager.d.ts +28 -0
- package/esm/domain/session/sessionManager.js +180 -0
- package/esm/domain/session/sessionManager.js.map +1 -0
- package/esm/domain/session/sessionState.d.ts +16 -0
- package/esm/domain/session/sessionState.js +66 -0
- package/esm/domain/session/sessionState.js.map +1 -0
- package/esm/domain/session/sessionStateValidation.d.ts +3 -0
- package/esm/domain/session/sessionStateValidation.js +7 -0
- package/esm/domain/session/sessionStateValidation.js.map +1 -0
- package/esm/domain/session/sessionStore.d.ts +38 -0
- package/esm/domain/session/sessionStore.js +175 -0
- package/esm/domain/session/sessionStore.js.map +1 -0
- package/esm/domain/session/sessionStoreOperations.d.ts +12 -0
- package/esm/domain/session/sessionStoreOperations.js +114 -0
- package/esm/domain/session/sessionStoreOperations.js.map +1 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.d.ts +8 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.js +50 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.js.map +1 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.d.ts +4 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js +37 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.d.ts +16 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.js +2 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.js.map +1 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.d.ts +12 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.js +24 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.js.map +1 -0
- package/esm/domain/tags.d.ts +6 -0
- package/esm/domain/tags.js +60 -0
- package/esm/domain/tags.js.map +1 -0
- package/esm/domain/telemetry/index.d.ts +4 -0
- package/esm/domain/telemetry/index.js +3 -0
- package/esm/domain/telemetry/index.js.map +1 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.d.ts +18 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.js +6 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.js.map +1 -0
- package/esm/domain/telemetry/telemetry.d.ts +56 -0
- package/esm/domain/telemetry/telemetry.js +235 -0
- package/esm/domain/telemetry/telemetry.js.map +1 -0
- package/esm/domain/telemetry/telemetryEvent.types.d.ts +858 -0
- package/esm/domain/telemetry/telemetryEvent.types.js +6 -0
- package/esm/domain/telemetry/telemetryEvent.types.js.map +1 -0
- package/esm/domain/trackingConsent.d.ts +13 -0
- package/esm/domain/trackingConsent.js +24 -0
- package/esm/domain/trackingConsent.js.map +1 -0
- package/esm/index.d.ts +100 -0
- package/esm/index.js +76 -0
- package/esm/index.js.map +1 -0
- package/esm/tools/abstractHooks.d.ts +24 -0
- package/esm/tools/abstractHooks.js +37 -0
- package/esm/tools/abstractHooks.js.map +1 -0
- package/esm/tools/abstractLifeCycle.d.ts +23 -0
- package/esm/tools/abstractLifeCycle.js +24 -0
- package/esm/tools/abstractLifeCycle.js.map +1 -0
- package/esm/tools/boundedBuffer.d.ts +16 -0
- package/esm/tools/boundedBuffer.js +29 -0
- package/esm/tools/boundedBuffer.js.map +1 -0
- package/esm/tools/catchUserErrors.d.ts +1 -0
- package/esm/tools/catchUserErrors.js +12 -0
- package/esm/tools/catchUserErrors.js.map +1 -0
- package/esm/tools/display.d.ts +38 -0
- package/esm/tools/display.js +41 -0
- package/esm/tools/display.js.map +1 -0
- package/esm/tools/encoder.d.ts +54 -0
- package/esm/tools/encoder.js +37 -0
- package/esm/tools/encoder.js.map +1 -0
- package/esm/tools/experimentalFeatures.d.ts +20 -0
- package/esm/tools/experimentalFeatures.js +41 -0
- package/esm/tools/experimentalFeatures.js.map +1 -0
- package/esm/tools/getZoneJsOriginalValue.d.ts +19 -0
- package/esm/tools/getZoneJsOriginalValue.js +26 -0
- package/esm/tools/getZoneJsOriginalValue.js.map +1 -0
- package/esm/tools/globalObject.d.ts +19 -0
- package/esm/tools/globalObject.js +40 -0
- package/esm/tools/globalObject.js.map +1 -0
- package/esm/tools/instrumentMethod.d.ts +75 -0
- package/esm/tools/instrumentMethod.js +114 -0
- package/esm/tools/instrumentMethod.js.map +1 -0
- package/esm/tools/matchOption.d.ts +8 -0
- package/esm/tools/matchOption.js +31 -0
- package/esm/tools/matchOption.js.map +1 -0
- package/esm/tools/mergeInto.d.ts +25 -0
- package/esm/tools/mergeInto.js +93 -0
- package/esm/tools/mergeInto.js.map +1 -0
- package/esm/tools/monitor.d.ts +9 -0
- package/esm/tools/monitor.js +52 -0
- package/esm/tools/monitor.js.map +1 -0
- package/esm/tools/observable.d.ts +30 -0
- package/esm/tools/observable.js +83 -0
- package/esm/tools/observable.js.map +1 -0
- package/esm/tools/queueMicrotask.d.ts +1 -0
- package/esm/tools/queueMicrotask.js +14 -0
- package/esm/tools/queueMicrotask.js.map +1 -0
- package/esm/tools/readBytesFromStream.d.ts +11 -0
- package/esm/tools/readBytesFromStream.js +60 -0
- package/esm/tools/readBytesFromStream.js.map +1 -0
- package/esm/tools/requestIdleCallback.d.ts +12 -0
- package/esm/tools/requestIdleCallback.js +30 -0
- package/esm/tools/requestIdleCallback.js.map +1 -0
- package/esm/tools/sendToExtension.d.ts +3 -0
- package/esm/tools/sendToExtension.js +8 -0
- package/esm/tools/sendToExtension.js.map +1 -0
- package/esm/tools/serialisation/context.d.ts +9 -0
- package/esm/tools/serialisation/context.js +2 -0
- package/esm/tools/serialisation/context.js.map +1 -0
- package/esm/tools/serialisation/jsonStringify.d.ts +13 -0
- package/esm/tools/serialisation/jsonStringify.js +44 -0
- package/esm/tools/serialisation/jsonStringify.js.map +1 -0
- package/esm/tools/serialisation/sanitize.d.ts +18 -0
- package/esm/tools/serialisation/sanitize.js +185 -0
- package/esm/tools/serialisation/sanitize.js.map +1 -0
- package/esm/tools/stackTrace/computeStackTrace.d.ts +25 -0
- package/esm/tools/stackTrace/computeStackTrace.js +183 -0
- package/esm/tools/stackTrace/computeStackTrace.js.map +1 -0
- package/esm/tools/stackTrace/handlingStack.d.ts +10 -0
- package/esm/tools/stackTrace/handlingStack.js +41 -0
- package/esm/tools/stackTrace/handlingStack.js.map +1 -0
- package/esm/tools/taskQueue.d.ts +15 -0
- package/esm/tools/taskQueue.js +50 -0
- package/esm/tools/taskQueue.js.map +1 -0
- package/esm/tools/timer.d.ts +5 -0
- package/esm/tools/timer.js +16 -0
- package/esm/tools/timer.js.map +1 -0
- package/esm/tools/utils/arrayUtils.d.ts +3 -0
- package/esm/tools/utils/arrayUtils.js +15 -0
- package/esm/tools/utils/arrayUtils.js.map +1 -0
- package/esm/tools/utils/browserDetection.d.ts +8 -0
- package/esm/tools/utils/browserDetection.js +28 -0
- package/esm/tools/utils/browserDetection.js.map +1 -0
- package/esm/tools/utils/byteUtils.d.ts +8 -0
- package/esm/tools/utils/byteUtils.js +25 -0
- package/esm/tools/utils/byteUtils.js.map +1 -0
- package/esm/tools/utils/functionUtils.d.ts +8 -0
- package/esm/tools/utils/functionUtils.js +39 -0
- package/esm/tools/utils/functionUtils.js.map +1 -0
- package/esm/tools/utils/numberUtils.d.ts +9 -0
- package/esm/tools/utils/numberUtils.js +18 -0
- package/esm/tools/utils/numberUtils.js.map +1 -0
- package/esm/tools/utils/objectUtils.d.ts +10 -0
- package/esm/tools/utils/objectUtils.js +17 -0
- package/esm/tools/utils/objectUtils.js.map +1 -0
- package/esm/tools/utils/polyfills.d.ts +7 -0
- package/esm/tools/utils/polyfills.js +18 -0
- package/esm/tools/utils/polyfills.js.map +1 -0
- package/esm/tools/utils/responseUtils.d.ts +2 -0
- package/esm/tools/utils/responseUtils.js +13 -0
- package/esm/tools/utils/responseUtils.js.map +1 -0
- package/esm/tools/utils/stringUtils.d.ts +8 -0
- package/esm/tools/utils/stringUtils.js +49 -0
- package/esm/tools/utils/stringUtils.js.map +1 -0
- package/esm/tools/utils/timeUtils.d.ts +53 -0
- package/esm/tools/utils/timeUtils.js +84 -0
- package/esm/tools/utils/timeUtils.js.map +1 -0
- package/esm/tools/utils/timezone.d.ts +1 -0
- package/esm/tools/utils/timezone.js +10 -0
- package/esm/tools/utils/timezone.js.map +1 -0
- package/esm/tools/utils/typeUtils.d.ts +4 -0
- package/esm/tools/utils/typeUtils.js +13 -0
- package/esm/tools/utils/typeUtils.js.map +1 -0
- package/esm/tools/utils/urlPolyfill.d.ts +5 -0
- package/esm/tools/utils/urlPolyfill.js +52 -0
- package/esm/tools/utils/urlPolyfill.js.map +1 -0
- package/esm/tools/valueHistory.d.ts +27 -0
- package/esm/tools/valueHistory.js +100 -0
- package/esm/tools/valueHistory.js.map +1 -0
- package/esm/transport/batch.d.ts +16 -0
- package/esm/transport/batch.js +105 -0
- package/esm/transport/batch.js.map +1 -0
- package/esm/transport/eventBridge.d.ts +21 -0
- package/esm/transport/eventBridge.js +41 -0
- package/esm/transport/eventBridge.js.map +1 -0
- package/esm/transport/flushController.d.ts +58 -0
- package/esm/transport/flushController.js +106 -0
- package/esm/transport/flushController.js.map +1 -0
- package/esm/transport/httpRequest.d.ts +51 -0
- package/esm/transport/httpRequest.js +75 -0
- package/esm/transport/httpRequest.js.map +1 -0
- package/esm/transport/index.d.ts +7 -0
- package/esm/transport/index.js +5 -0
- package/esm/transport/index.js.map +1 -0
- package/esm/transport/sendWithRetryStrategy.d.ts +41 -0
- package/esm/transport/sendWithRetryStrategy.js +158 -0
- package/esm/transport/sendWithRetryStrategy.js.map +1 -0
- package/package.json +31 -0
- package/src/boot/displayAlreadyInitializedError.ts +8 -0
- package/src/boot/init.ts +55 -0
- package/src/browser/addEventListener.ts +145 -0
- package/src/browser/browser.types.ts +82 -0
- package/src/browser/cookie.ts +107 -0
- package/src/browser/fetchObservable.ts +127 -0
- package/src/browser/pageMayExitObservable.ts +56 -0
- package/src/browser/runOnReadyState.ts +25 -0
- package/src/browser/xhrObservable.ts +130 -0
- package/src/domain/allowedTrackingOrigins.ts +30 -0
- package/src/domain/bufferedData.ts +32 -0
- package/src/domain/configuration/configuration.ts +472 -0
- package/src/domain/configuration/endpointBuilder.ts +119 -0
- package/src/domain/configuration/index.ts +11 -0
- package/src/domain/configuration/transportConfiguration.ts +78 -0
- package/src/domain/connectivity/connectivity.ts +31 -0
- package/src/domain/connectivity/index.ts +1 -0
- package/src/domain/console/consoleObservable.ts +118 -0
- package/src/domain/context/contextConstants.ts +27 -0
- package/src/domain/context/contextManager.ts +85 -0
- package/src/domain/context/contextUtils.ts +14 -0
- package/src/domain/context/defineContextMethod.ts +31 -0
- package/src/domain/context/storeContextManager.ts +55 -0
- package/src/domain/contexts/accountContext.ts +47 -0
- package/src/domain/contexts/globalContext.ts +30 -0
- package/src/domain/contexts/rumInternalContext.type.ts +15 -0
- package/src/domain/contexts/userContext.ts +64 -0
- package/src/domain/deflate/deflate.types.ts +57 -0
- package/src/domain/deflate/index.ts +1 -0
- package/src/domain/error/error.ts +103 -0
- package/src/domain/error/error.types.ts +64 -0
- package/src/domain/error/trackRuntimeError.ts +50 -0
- package/src/domain/eventRateLimiter/createEventRateLimiter.ts +46 -0
- package/src/domain/extension/extensionUtils.ts +28 -0
- package/src/domain/intakeSites.ts +17 -0
- package/src/domain/report/browser.types.ts +38 -0
- package/src/domain/report/reportObservable.ts +133 -0
- package/src/domain/resourceUtils.ts +21 -0
- package/src/domain/session/README.md +193 -0
- package/src/domain/session/oldCookiesMigration.ts +42 -0
- package/src/domain/session/sessionConstants.ts +19 -0
- package/src/domain/session/sessionManager.ts +244 -0
- package/src/domain/session/sessionState.ts +88 -0
- package/src/domain/session/sessionStateValidation.ts +9 -0
- package/src/domain/session/sessionStore.ts +244 -0
- package/src/domain/session/sessionStoreOperations.ts +131 -0
- package/src/domain/session/storeStrategies/sessionInCookie.ts +85 -0
- package/src/domain/session/storeStrategies/sessionInLocalStorage.ts +44 -0
- package/src/domain/session/storeStrategies/sessionStoreStrategy.ts +16 -0
- package/src/domain/synthetics/syntheticsWorkerValues.ts +38 -0
- package/src/domain/tags.ts +76 -0
- package/src/domain/telemetry/index.ts +22 -0
- package/src/domain/telemetry/rawTelemetryEvent.types.ts +22 -0
- package/src/domain/telemetry/telemetry.ts +345 -0
- package/src/domain/telemetry/telemetryEvent.types.ts +899 -0
- package/src/domain/trackingConsent.ts +34 -0
- package/src/index.ts +164 -0
- package/src/tools/abstractHooks.ts +72 -0
- package/src/tools/abstractLifeCycle.ts +46 -0
- package/src/tools/boundedBuffer.ts +45 -0
- package/src/tools/catchUserErrors.ts +11 -0
- package/src/tools/display.ts +56 -0
- package/src/tools/encoder.ts +103 -0
- package/src/tools/experimentalFeatures.ts +51 -0
- package/src/tools/getZoneJsOriginalValue.ts +38 -0
- package/src/tools/globalObject.ts +51 -0
- package/src/tools/instrumentMethod.ts +170 -0
- package/src/tools/matchOption.ts +31 -0
- package/src/tools/mergeInto.ts +177 -0
- package/src/tools/monitor.ts +72 -0
- package/src/tools/observable.ts +104 -0
- package/src/tools/queueMicrotask.ts +13 -0
- package/src/tools/readBytesFromStream.ts +77 -0
- package/src/tools/requestIdleCallback.ts +40 -0
- package/src/tools/sendToExtension.ts +14 -0
- package/src/tools/serialisation/context.ts +11 -0
- package/src/tools/serialisation/jsonStringify.ts +53 -0
- package/src/tools/serialisation/sanitize.ts +273 -0
- package/src/tools/stackTrace/computeStackTrace.ts +250 -0
- package/src/tools/stackTrace/handlingStack.ts +48 -0
- package/src/tools/taskQueue.ts +63 -0
- package/src/tools/timer.ts +21 -0
- package/src/tools/utils/arrayUtils.ts +15 -0
- package/src/tools/utils/browserDetection.ts +39 -0
- package/src/tools/utils/byteUtils.ts +35 -0
- package/src/tools/utils/functionUtils.ts +45 -0
- package/src/tools/utils/numberUtils.ts +20 -0
- package/src/tools/utils/objectUtils.ts +19 -0
- package/src/tools/utils/polyfills.ts +23 -0
- package/src/tools/utils/responseUtils.ts +12 -0
- package/src/tools/utils/stringUtils.ts +52 -0
- package/src/tools/utils/timeUtils.ts +117 -0
- package/src/tools/utils/timezone.ts +9 -0
- package/src/tools/utils/typeUtils.ts +12 -0
- package/src/tools/utils/urlPolyfill.ts +56 -0
- package/src/tools/valueHistory.ts +151 -0
- package/src/transport/batch.ts +144 -0
- package/src/transport/eventBridge.ts +61 -0
- package/src/transport/flushController.ts +144 -0
- package/src/transport/httpRequest.ts +164 -0
- package/src/transport/index.ts +7 -0
- package/src/transport/sendWithRetryStrategy.ts +222 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { InstrumentedMethodCall } from '../tools/instrumentMethod'
|
|
2
|
+
import { instrumentMethod } from '../tools/instrumentMethod'
|
|
3
|
+
import { Observable } from '../tools/observable'
|
|
4
|
+
import type { Duration, ClocksState } from '../tools/utils/timeUtils'
|
|
5
|
+
import { elapsed, clocksNow, timeStampNow } from '../tools/utils/timeUtils'
|
|
6
|
+
import { normalizeUrl } from '../tools/utils/urlPolyfill'
|
|
7
|
+
import { shallowClone } from '../tools/utils/objectUtils'
|
|
8
|
+
import type { Configuration } from '../domain/configuration'
|
|
9
|
+
import { addEventListener } from './addEventListener'
|
|
10
|
+
|
|
11
|
+
export interface XhrOpenContext {
|
|
12
|
+
state: 'open'
|
|
13
|
+
method: string
|
|
14
|
+
url: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface XhrStartContext extends Omit<XhrOpenContext, 'state'> {
|
|
18
|
+
state: 'start'
|
|
19
|
+
startClocks: ClocksState
|
|
20
|
+
isAborted: boolean
|
|
21
|
+
xhr: XMLHttpRequest
|
|
22
|
+
handlingStack?: string
|
|
23
|
+
body?: unknown
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface XhrCompleteContext extends Omit<XhrStartContext, 'state'> {
|
|
27
|
+
state: 'complete'
|
|
28
|
+
duration: Duration
|
|
29
|
+
status: number
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type XhrContext = XhrOpenContext | XhrStartContext | XhrCompleteContext
|
|
33
|
+
|
|
34
|
+
let xhrObservable: Observable<XhrContext> | undefined
|
|
35
|
+
const xhrContexts = new WeakMap<XMLHttpRequest, XhrContext>()
|
|
36
|
+
|
|
37
|
+
export function initXhrObservable(configuration: Configuration) {
|
|
38
|
+
if (!xhrObservable) {
|
|
39
|
+
xhrObservable = createXhrObservable(configuration)
|
|
40
|
+
}
|
|
41
|
+
return xhrObservable
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function createXhrObservable(configuration: Configuration) {
|
|
45
|
+
return new Observable<XhrContext>((observable) => {
|
|
46
|
+
const { stop: stopInstrumentingStart } = instrumentMethod(XMLHttpRequest.prototype, 'open', openXhr)
|
|
47
|
+
|
|
48
|
+
const { stop: stopInstrumentingSend } = instrumentMethod(
|
|
49
|
+
XMLHttpRequest.prototype,
|
|
50
|
+
'send',
|
|
51
|
+
(call) => {
|
|
52
|
+
sendXhr(call, configuration, observable)
|
|
53
|
+
},
|
|
54
|
+
{ computeHandlingStack: true }
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
const { stop: stopInstrumentingAbort } = instrumentMethod(XMLHttpRequest.prototype, 'abort', abortXhr)
|
|
58
|
+
|
|
59
|
+
return () => {
|
|
60
|
+
stopInstrumentingStart()
|
|
61
|
+
stopInstrumentingSend()
|
|
62
|
+
stopInstrumentingAbort()
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function openXhr({ target: xhr, parameters: [method, url] }: InstrumentedMethodCall<XMLHttpRequest, 'open'>) {
|
|
68
|
+
xhrContexts.set(xhr, {
|
|
69
|
+
state: 'open',
|
|
70
|
+
method: String(method).toUpperCase(),
|
|
71
|
+
url: normalizeUrl(String(url)),
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function sendXhr(
|
|
76
|
+
{ target: xhr, parameters: [body], handlingStack }: InstrumentedMethodCall<XMLHttpRequest, 'send'>,
|
|
77
|
+
configuration: Configuration,
|
|
78
|
+
observable: Observable<XhrContext>
|
|
79
|
+
) {
|
|
80
|
+
const context = xhrContexts.get(xhr)
|
|
81
|
+
if (!context) {
|
|
82
|
+
return
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const startContext = context as XhrStartContext
|
|
86
|
+
startContext.state = 'start'
|
|
87
|
+
startContext.startClocks = clocksNow()
|
|
88
|
+
startContext.isAborted = false
|
|
89
|
+
startContext.xhr = xhr
|
|
90
|
+
startContext.handlingStack = handlingStack
|
|
91
|
+
startContext.body = body
|
|
92
|
+
|
|
93
|
+
let hasBeenReported = false
|
|
94
|
+
|
|
95
|
+
const { stop: stopInstrumentingOnReadyStateChange } = instrumentMethod(xhr, 'onreadystatechange', () => {
|
|
96
|
+
if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
97
|
+
// Try to report the XHR as soon as possible, because the XHR may be mutated by the
|
|
98
|
+
// application during a future event. For example, Angular is calling .abort() on
|
|
99
|
+
// completed requests during an onreadystatechange event, so the status becomes '0'
|
|
100
|
+
// before the request is collected.
|
|
101
|
+
onEnd()
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
const onEnd = () => {
|
|
106
|
+
unsubscribeLoadEndListener()
|
|
107
|
+
stopInstrumentingOnReadyStateChange()
|
|
108
|
+
if (hasBeenReported) {
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
hasBeenReported = true
|
|
112
|
+
|
|
113
|
+
const completeContext = context as XhrCompleteContext
|
|
114
|
+
completeContext.state = 'complete'
|
|
115
|
+
completeContext.duration = elapsed(startContext.startClocks.timeStamp, timeStampNow())
|
|
116
|
+
completeContext.status = xhr.status
|
|
117
|
+
observable.notify(shallowClone(completeContext))
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const { stop: unsubscribeLoadEndListener } = addEventListener(configuration, xhr, 'loadend', onEnd)
|
|
121
|
+
|
|
122
|
+
observable.notify(startContext)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function abortXhr({ target: xhr }: InstrumentedMethodCall<XMLHttpRequest, 'abort'>) {
|
|
126
|
+
const context = xhrContexts.get(xhr) as XhrStartContext | undefined
|
|
127
|
+
if (context) {
|
|
128
|
+
context.isAborted = true
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { display } from '../tools/display'
|
|
2
|
+
import { matchList } from '../tools/matchOption'
|
|
3
|
+
import type { InitConfiguration } from './configuration'
|
|
4
|
+
import { isUnsupportedExtensionEnvironment } from './extension/extensionUtils'
|
|
5
|
+
|
|
6
|
+
export const ERROR_DOES_NOT_HAVE_ALLOWED_TRACKING_ORIGIN =
|
|
7
|
+
'Running the Browser SDK in a Web extension content script is forbidden unless the `allowedTrackingOrigins` option is provided.'
|
|
8
|
+
export const ERROR_NOT_ALLOWED_TRACKING_ORIGIN = 'SDK initialized on a non-allowed domain.'
|
|
9
|
+
|
|
10
|
+
export function isAllowedTrackingOrigins(
|
|
11
|
+
configuration: InitConfiguration,
|
|
12
|
+
errorStack: string,
|
|
13
|
+
windowOrigin = typeof location !== 'undefined' ? location.origin : ''
|
|
14
|
+
): boolean {
|
|
15
|
+
const allowedTrackingOrigins = configuration.allowedTrackingOrigins
|
|
16
|
+
if (!allowedTrackingOrigins) {
|
|
17
|
+
if (isUnsupportedExtensionEnvironment(windowOrigin, errorStack)) {
|
|
18
|
+
display.error(ERROR_DOES_NOT_HAVE_ALLOWED_TRACKING_ORIGIN)
|
|
19
|
+
|
|
20
|
+
return false
|
|
21
|
+
}
|
|
22
|
+
return true
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const isAllowed = matchList(allowedTrackingOrigins, windowOrigin)
|
|
26
|
+
if (!isAllowed) {
|
|
27
|
+
display.error(ERROR_NOT_ALLOWED_TRACKING_ORIGIN)
|
|
28
|
+
}
|
|
29
|
+
return isAllowed
|
|
30
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BufferedObservable } from '../tools/observable'
|
|
2
|
+
import type { RawError } from './error/error.types'
|
|
3
|
+
import { trackRuntimeError } from './error/trackRuntimeError'
|
|
4
|
+
|
|
5
|
+
const BUFFER_LIMIT = 500
|
|
6
|
+
|
|
7
|
+
export const enum BufferedDataType {
|
|
8
|
+
RUNTIME_ERROR,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface BufferedData {
|
|
12
|
+
type: BufferedDataType.RUNTIME_ERROR
|
|
13
|
+
error: RawError
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function startBufferingData(trackRuntimeErrorImpl = trackRuntimeError) {
|
|
17
|
+
const observable = new BufferedObservable<BufferedData>(BUFFER_LIMIT)
|
|
18
|
+
|
|
19
|
+
const runtimeErrorSubscription = trackRuntimeErrorImpl().subscribe((error) => {
|
|
20
|
+
observable.notify({
|
|
21
|
+
type: BufferedDataType.RUNTIME_ERROR,
|
|
22
|
+
error,
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
observable,
|
|
28
|
+
stop: () => {
|
|
29
|
+
runtimeErrorSubscription.unsubscribe()
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import { catchUserErrors } from '../../tools/catchUserErrors'
|
|
2
|
+
import { DOCS_ORIGIN, MORE_DETAILS, display } from '../../tools/display'
|
|
3
|
+
import type { RawTelemetryConfiguration } from '../telemetry'
|
|
4
|
+
import type { Duration } from '../../tools/utils/timeUtils'
|
|
5
|
+
import { ONE_SECOND } from '../../tools/utils/timeUtils'
|
|
6
|
+
import { isPercentage } from '../../tools/utils/numberUtils'
|
|
7
|
+
import { ONE_KIBI_BYTE } from '../../tools/utils/byteUtils'
|
|
8
|
+
import { objectHasValue } from '../../tools/utils/objectUtils'
|
|
9
|
+
import { selectSessionStoreStrategyType } from '../session/sessionStore'
|
|
10
|
+
import type { SessionStoreStrategyType } from '../session/storeStrategies/sessionStoreStrategy'
|
|
11
|
+
import { TrackingConsent } from '../trackingConsent'
|
|
12
|
+
import type { SessionPersistence } from '../session/sessionConstants'
|
|
13
|
+
import type { MatchOption } from '../../tools/matchOption'
|
|
14
|
+
import { isAllowedTrackingOrigins } from '../allowedTrackingOrigins'
|
|
15
|
+
import type { Site } from '../intakeSites'
|
|
16
|
+
import { isWorkerEnvironment } from '../../tools/globalObject'
|
|
17
|
+
import type { TransportConfiguration } from './transportConfiguration'
|
|
18
|
+
import { computeTransportConfiguration } from './transportConfiguration'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Default privacy level for the browser SDK.
|
|
22
|
+
*
|
|
23
|
+
* [Replay Privacy Options](https://docs.datadoghq.com/real_user_monitoring/session_replay/browser/privacy_options) for further information.
|
|
24
|
+
*/
|
|
25
|
+
export const DefaultPrivacyLevel = {
|
|
26
|
+
ALLOW: 'allow',
|
|
27
|
+
MASK: 'mask',
|
|
28
|
+
MASK_USER_INPUT: 'mask-user-input',
|
|
29
|
+
MASK_UNLESS_ALLOWLISTED: 'mask-unless-allowlisted',
|
|
30
|
+
} as const
|
|
31
|
+
export type DefaultPrivacyLevel = (typeof DefaultPrivacyLevel)[keyof typeof DefaultPrivacyLevel]
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Trace context injection option.
|
|
35
|
+
*
|
|
36
|
+
* See [Connect RUM and Traces](https://docs.datadoghq.com/real_user_monitoring/platform/connect_rum_and_traces/?tab=browserrum) for further information.
|
|
37
|
+
*/
|
|
38
|
+
export const TraceContextInjection = {
|
|
39
|
+
ALL: 'all',
|
|
40
|
+
SAMPLED: 'sampled',
|
|
41
|
+
} as const
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Trace context injection option.
|
|
45
|
+
*
|
|
46
|
+
* See [Connect RUM and Traces](https://docs.datadoghq.com/real_user_monitoring/platform/connect_rum_and_traces/?tab=browserrum) for further information.
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
49
|
+
export type TraceContextInjection = (typeof TraceContextInjection)[keyof typeof TraceContextInjection]
|
|
50
|
+
|
|
51
|
+
export interface InitConfiguration {
|
|
52
|
+
/**
|
|
53
|
+
* The client token for Datadog. Required for authenticating your application with Datadog.
|
|
54
|
+
*
|
|
55
|
+
* @category Authentication
|
|
56
|
+
*/
|
|
57
|
+
clientToken: string
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A callback function that can be used to modify events before they are sent to Datadog.
|
|
61
|
+
*
|
|
62
|
+
* @category Data Collection
|
|
63
|
+
*/
|
|
64
|
+
beforeSend?: GenericBeforeSendCallback | undefined
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The percentage of sessions tracked. A value between 0 and 100.
|
|
68
|
+
*
|
|
69
|
+
* @category Data Collection
|
|
70
|
+
* @defaultValue 100
|
|
71
|
+
*/
|
|
72
|
+
sessionSampleRate?: number | undefined
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The percentage of telemetry events sent. A value between 0 and 100.
|
|
76
|
+
*
|
|
77
|
+
* @category Data Collection
|
|
78
|
+
* @defaultValue 20
|
|
79
|
+
*/
|
|
80
|
+
telemetrySampleRate?: number | undefined
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Initialization fails silently if the RUM Browser SDK is already initialized on the page.
|
|
84
|
+
*
|
|
85
|
+
* @defaultValue false
|
|
86
|
+
*/
|
|
87
|
+
silentMultipleInit?: boolean | undefined
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Which storage strategy to use for persisting sessions. Can be either 'cookie' or 'local-storage'.
|
|
91
|
+
*
|
|
92
|
+
* Important: If you are using the RUM and Logs Browser SDKs, this option must be configured with identical values
|
|
93
|
+
*
|
|
94
|
+
* @category Session Persistence
|
|
95
|
+
* @defaultValue "cookie"
|
|
96
|
+
*/
|
|
97
|
+
sessionPersistence?: SessionPersistence | undefined
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Allows the use of localStorage when cookies cannot be set. This enables the RUM Browser SDK to run in environments that do not provide cookie support.
|
|
101
|
+
*
|
|
102
|
+
* Important: If you are using the RUM and Logs Browser SDKs, this option must be configured with identical values
|
|
103
|
+
* See [Monitor Electron Applications Using the Browser SDK](https://docs.datadoghq.com/real_user_monitoring/guide/monitor-electron-applications-using-browser-sdk) for further information.
|
|
104
|
+
*
|
|
105
|
+
* @category Session Persistence
|
|
106
|
+
* @deprecated use `sessionPersistence: local-storage` where you want to use localStorage instead
|
|
107
|
+
*/
|
|
108
|
+
allowFallbackToLocalStorage?: boolean | undefined
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Allow listening to DOM events dispatched programmatically ([untrusted events](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted)). Enabling this option can be useful if you heavily rely on programmatic events, such as in an automated UI test environment.
|
|
112
|
+
*
|
|
113
|
+
* @defaultValue false
|
|
114
|
+
*/
|
|
115
|
+
allowUntrustedEvents?: boolean | undefined
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Store global context and user context in localStorage to preserve them along the user navigation.
|
|
119
|
+
* See [Contexts life cycle](https://docs.datadoghq.com/real_user_monitoring/browser/advanced_configuration/?tab=npm#contexts-life-cycle) for further information.
|
|
120
|
+
*
|
|
121
|
+
* @defaultValue false
|
|
122
|
+
*/
|
|
123
|
+
storeContextsAcrossPages?: boolean | undefined
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Set the initial user tracking consent state.
|
|
127
|
+
* See [User tracking consent](https://docs.datadoghq.com/real_user_monitoring/browser/advanced_configuration/?tab=npm#user-tracking-consent) for further information.
|
|
128
|
+
*
|
|
129
|
+
* @category Privacy
|
|
130
|
+
* @defaultValue granted
|
|
131
|
+
*/
|
|
132
|
+
trackingConsent?: TrackingConsent | undefined
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* List of origins where the SDK is allowed to run when used in a browser extension context.
|
|
136
|
+
* Matches urls against the extensions origin.
|
|
137
|
+
* If not provided and the SDK is running in a browser extension, the SDK will not run.
|
|
138
|
+
*/
|
|
139
|
+
allowedTrackingOrigins?: MatchOption[] | undefined
|
|
140
|
+
|
|
141
|
+
// transport options
|
|
142
|
+
/**
|
|
143
|
+
* Optional proxy URL, for example: https://www.proxy.com/path.
|
|
144
|
+
* See [Proxy Your Browser RUM Data](https://docs.datadoghq.com/real_user_monitoring/guide/proxy-rum-data) for further information.
|
|
145
|
+
*
|
|
146
|
+
* @category Transport
|
|
147
|
+
*/
|
|
148
|
+
proxy?: string | ProxyFn | undefined
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The Datadog [site](https://docs.datadoghq.com/getting_started/site) parameter of your organization.
|
|
152
|
+
*
|
|
153
|
+
* @category Transport
|
|
154
|
+
* @defaultValue datadoghq.com
|
|
155
|
+
*/
|
|
156
|
+
site?: Site | undefined
|
|
157
|
+
|
|
158
|
+
// tag and context options
|
|
159
|
+
/**
|
|
160
|
+
* The service name for your application. Follows the [tag syntax requirements](https://docs.datadoghq.com/getting_started/tagging/#define-tags).
|
|
161
|
+
*
|
|
162
|
+
* @category Data Collection
|
|
163
|
+
*/
|
|
164
|
+
service?: string | undefined | null
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The application’s environment, for example: prod, pre-prod, and staging. Follows the [tag syntax requirements](https://docs.datadoghq.com/getting_started/tagging/#define-tags).
|
|
168
|
+
*
|
|
169
|
+
* @category Data Collection
|
|
170
|
+
*/
|
|
171
|
+
env?: string | undefined | null
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* The application’s version, for example: 1.2.3, 6c44da20, and 2020.02.13. Follows the [tag syntax requirements](https://docs.datadoghq.com/getting_started/tagging/#define-tags).
|
|
175
|
+
*
|
|
176
|
+
* @category Data Collection
|
|
177
|
+
*/
|
|
178
|
+
version?: string | undefined | null
|
|
179
|
+
|
|
180
|
+
// cookie options
|
|
181
|
+
/**
|
|
182
|
+
* Use a partitioned secure cross-site session cookie. This allows the RUM Browser SDK to run when the site is loaded from another one (iframe). Implies `useSecureSessionCookie`.
|
|
183
|
+
*
|
|
184
|
+
* Important: If you are using the RUM and Logs Browser SDKs, this option must be configured with identical values
|
|
185
|
+
*
|
|
186
|
+
* @category Session Persistence
|
|
187
|
+
* @defaultValue false
|
|
188
|
+
*/
|
|
189
|
+
usePartitionedCrossSiteSessionCookie?: boolean | undefined
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Use a secure session cookie. This disables RUM events sent on insecure (non-HTTPS) connections.
|
|
193
|
+
*
|
|
194
|
+
* Important: If you are using the RUM and Logs Browser SDKs, this option must be configured with identical values
|
|
195
|
+
*
|
|
196
|
+
* @category Session Persistence
|
|
197
|
+
* @defaultValue false
|
|
198
|
+
*/
|
|
199
|
+
useSecureSessionCookie?: boolean | undefined
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Preserve the session across subdomains for the same site.
|
|
203
|
+
*
|
|
204
|
+
* Important: If you are using the RUM and Logs Browser SDKs, this option must be configured with identical values
|
|
205
|
+
*
|
|
206
|
+
* @category Session Persistence
|
|
207
|
+
* @defaultValue false
|
|
208
|
+
*/
|
|
209
|
+
trackSessionAcrossSubdomains?: boolean | undefined
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Track anonymous user for the same site and extend cookie expiration date
|
|
213
|
+
*
|
|
214
|
+
* @category Data Collection
|
|
215
|
+
* @defaultValue true
|
|
216
|
+
*/
|
|
217
|
+
trackAnonymousUser?: boolean | undefined
|
|
218
|
+
|
|
219
|
+
// internal options
|
|
220
|
+
/**
|
|
221
|
+
* [Internal option] Enable experimental features
|
|
222
|
+
*
|
|
223
|
+
* @internal
|
|
224
|
+
*/
|
|
225
|
+
enableExperimentalFeatures?: string[] | undefined
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* [Internal option] Configure the dual shipping to another datacenter
|
|
229
|
+
*
|
|
230
|
+
* @internal
|
|
231
|
+
*/
|
|
232
|
+
replica?: ReplicaUserConfiguration | undefined
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* [Internal option] Set the datacenter from where the data is dual shipped
|
|
236
|
+
*
|
|
237
|
+
* @internal
|
|
238
|
+
*/
|
|
239
|
+
datacenter?: string
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* [Internal option] Datadog internal analytics subdomain
|
|
243
|
+
*
|
|
244
|
+
* @internal
|
|
245
|
+
*/
|
|
246
|
+
// TODO next major: remove this option and replace usages by proxyFn
|
|
247
|
+
internalAnalyticsSubdomain?: string
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* [Internal option] The percentage of telemetry configuration sent. A value between 0 and 100.
|
|
251
|
+
*
|
|
252
|
+
* @internal
|
|
253
|
+
* @defaultValue 5
|
|
254
|
+
*/
|
|
255
|
+
telemetryConfigurationSampleRate?: number
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* [Internal option] The percentage of telemetry usage sent. A value between 0 and 100.
|
|
259
|
+
*
|
|
260
|
+
* @internal
|
|
261
|
+
* @defaultValue 5
|
|
262
|
+
*/
|
|
263
|
+
telemetryUsageSampleRate?: number
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* [Internal option] Additional configuration for the SDK.
|
|
267
|
+
*
|
|
268
|
+
* @internal
|
|
269
|
+
*/
|
|
270
|
+
source?: 'browser' | 'flutter' | 'unity' | undefined
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* [Internal option] Additional configuration for the SDK.
|
|
274
|
+
*
|
|
275
|
+
* @internal
|
|
276
|
+
*/
|
|
277
|
+
sdkVersion?: string | undefined
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* [Internal option] Additional configuration for the SDK.
|
|
281
|
+
*
|
|
282
|
+
* @internal
|
|
283
|
+
*/
|
|
284
|
+
variant?: string | undefined
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// This type is only used to build the core configuration. Logs and RUM SDKs are using a proper type
|
|
288
|
+
// for this option.
|
|
289
|
+
type GenericBeforeSendCallback = (event: any, context?: any) => unknown
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* path: /api/vX/product
|
|
293
|
+
* parameters: xxx=yyy&zzz=aaa
|
|
294
|
+
*/
|
|
295
|
+
export type ProxyFn = (options: { path: string; parameters: string }) => string
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* @internal
|
|
299
|
+
*/
|
|
300
|
+
export interface ReplicaUserConfiguration {
|
|
301
|
+
applicationId?: string
|
|
302
|
+
clientToken: string
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface Configuration extends TransportConfiguration {
|
|
306
|
+
// Built from init configuration
|
|
307
|
+
beforeSend: GenericBeforeSendCallback | undefined
|
|
308
|
+
sessionStoreStrategyType: SessionStoreStrategyType | undefined
|
|
309
|
+
sessionSampleRate: number
|
|
310
|
+
telemetrySampleRate: number
|
|
311
|
+
telemetryConfigurationSampleRate: number
|
|
312
|
+
telemetryUsageSampleRate: number
|
|
313
|
+
service?: string | undefined
|
|
314
|
+
version?: string | undefined
|
|
315
|
+
env?: string | undefined
|
|
316
|
+
silentMultipleInit: boolean
|
|
317
|
+
allowUntrustedEvents: boolean
|
|
318
|
+
trackingConsent: TrackingConsent
|
|
319
|
+
storeContextsAcrossPages: boolean
|
|
320
|
+
trackAnonymousUser?: boolean
|
|
321
|
+
// Event limits
|
|
322
|
+
eventRateLimiterThreshold: number // Limit the maximum number of actions, errors and logs per minutes
|
|
323
|
+
maxTelemetryEventsPerPage: number
|
|
324
|
+
|
|
325
|
+
// Batch configuration
|
|
326
|
+
batchBytesLimit: number
|
|
327
|
+
flushTimeout: Duration
|
|
328
|
+
batchMessagesLimit: number
|
|
329
|
+
messageBytesLimit: number
|
|
330
|
+
|
|
331
|
+
// internal
|
|
332
|
+
sdkVersion: string | undefined
|
|
333
|
+
source: 'browser' | 'flutter' | 'unity'
|
|
334
|
+
variant: string | undefined
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function isString(tag: unknown, tagName: string): tag is string | undefined | null {
|
|
338
|
+
if (tag !== undefined && tag !== null && typeof tag !== 'string') {
|
|
339
|
+
display.error(`${tagName} must be defined as a string`)
|
|
340
|
+
return false
|
|
341
|
+
}
|
|
342
|
+
return true
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function isDatadogSite(site: unknown) {
|
|
346
|
+
if (site && typeof site === 'string' && !/(datadog|ddog|datad0g|dd0g)/.test(site)) {
|
|
347
|
+
display.error(`Site should be a valid Datadog site. ${MORE_DETAILS} ${DOCS_ORIGIN}/getting_started/site/.`)
|
|
348
|
+
return false
|
|
349
|
+
}
|
|
350
|
+
return true
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export function isSampleRate(sampleRate: unknown, name: string) {
|
|
354
|
+
if (sampleRate !== undefined && !isPercentage(sampleRate)) {
|
|
355
|
+
display.error(`${name} Sample Rate should be a number between 0 and 100`)
|
|
356
|
+
return false
|
|
357
|
+
}
|
|
358
|
+
return true
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export function validateAndBuildConfiguration(
|
|
362
|
+
initConfiguration: InitConfiguration,
|
|
363
|
+
errorStack?: string
|
|
364
|
+
): Configuration | undefined {
|
|
365
|
+
if (!initConfiguration || !initConfiguration.clientToken) {
|
|
366
|
+
display.error('Client Token is not configured, we will not send any data.')
|
|
367
|
+
return
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
if (
|
|
371
|
+
initConfiguration.allowedTrackingOrigins !== undefined &&
|
|
372
|
+
!Array.isArray(initConfiguration.allowedTrackingOrigins)
|
|
373
|
+
) {
|
|
374
|
+
display.error('Allowed Tracking Origins must be an array')
|
|
375
|
+
return
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
if (
|
|
379
|
+
!isDatadogSite(initConfiguration.site) ||
|
|
380
|
+
!isSampleRate(initConfiguration.sessionSampleRate, 'Session') ||
|
|
381
|
+
!isSampleRate(initConfiguration.telemetrySampleRate, 'Telemetry') ||
|
|
382
|
+
!isSampleRate(initConfiguration.telemetryConfigurationSampleRate, 'Telemetry Configuration') ||
|
|
383
|
+
!isSampleRate(initConfiguration.telemetryUsageSampleRate, 'Telemetry Usage') ||
|
|
384
|
+
!isString(initConfiguration.version, 'Version') ||
|
|
385
|
+
!isString(initConfiguration.env, 'Env') ||
|
|
386
|
+
!isString(initConfiguration.service, 'Service') ||
|
|
387
|
+
!isAllowedTrackingOrigins(initConfiguration, errorStack ?? '')
|
|
388
|
+
) {
|
|
389
|
+
return
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
if (
|
|
393
|
+
initConfiguration.trackingConsent !== undefined &&
|
|
394
|
+
!objectHasValue(TrackingConsent, initConfiguration.trackingConsent)
|
|
395
|
+
) {
|
|
396
|
+
display.error('Tracking Consent should be either "granted" or "not-granted"')
|
|
397
|
+
return
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
return {
|
|
401
|
+
beforeSend:
|
|
402
|
+
initConfiguration.beforeSend && catchUserErrors(initConfiguration.beforeSend, 'beforeSend threw an error:'),
|
|
403
|
+
sessionStoreStrategyType: isWorkerEnvironment ? undefined : selectSessionStoreStrategyType(initConfiguration),
|
|
404
|
+
sessionSampleRate: initConfiguration.sessionSampleRate ?? 100,
|
|
405
|
+
telemetrySampleRate: initConfiguration.telemetrySampleRate ?? 20,
|
|
406
|
+
telemetryConfigurationSampleRate: initConfiguration.telemetryConfigurationSampleRate ?? 5,
|
|
407
|
+
telemetryUsageSampleRate: initConfiguration.telemetryUsageSampleRate ?? 5,
|
|
408
|
+
service: initConfiguration.service ?? undefined,
|
|
409
|
+
env: initConfiguration.env ?? undefined,
|
|
410
|
+
version: initConfiguration.version ?? undefined,
|
|
411
|
+
datacenter: initConfiguration.datacenter ?? undefined,
|
|
412
|
+
silentMultipleInit: !!initConfiguration.silentMultipleInit,
|
|
413
|
+
allowUntrustedEvents: !!initConfiguration.allowUntrustedEvents,
|
|
414
|
+
trackingConsent: initConfiguration.trackingConsent ?? TrackingConsent.GRANTED,
|
|
415
|
+
trackAnonymousUser: initConfiguration.trackAnonymousUser ?? true,
|
|
416
|
+
storeContextsAcrossPages: !!initConfiguration.storeContextsAcrossPages,
|
|
417
|
+
/**
|
|
418
|
+
* beacon payload max queue size implementation is 64kb
|
|
419
|
+
* ensure that we leave room for logs, rum and potential other users
|
|
420
|
+
*/
|
|
421
|
+
batchBytesLimit: 16 * ONE_KIBI_BYTE,
|
|
422
|
+
|
|
423
|
+
eventRateLimiterThreshold: 3000,
|
|
424
|
+
maxTelemetryEventsPerPage: 15,
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* flush automatically, aim to be lower than ALB connection timeout
|
|
428
|
+
* to maximize connection reuse.
|
|
429
|
+
*/
|
|
430
|
+
flushTimeout: (30 * ONE_SECOND) as Duration,
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Logs intake limit. When using the SDK in a Worker Environment, we
|
|
434
|
+
* limit the batch size to 1 to ensure it can be sent in a single event.
|
|
435
|
+
*/
|
|
436
|
+
batchMessagesLimit: isWorkerEnvironment ? 1 : 50,
|
|
437
|
+
messageBytesLimit: 256 * ONE_KIBI_BYTE,
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* The source of the SDK, used for support plugins purposes.
|
|
441
|
+
*/
|
|
442
|
+
variant: initConfiguration.variant,
|
|
443
|
+
sdkVersion: initConfiguration.sdkVersion,
|
|
444
|
+
|
|
445
|
+
...computeTransportConfiguration(initConfiguration),
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
export function serializeConfiguration(initConfiguration: InitConfiguration) {
|
|
450
|
+
return {
|
|
451
|
+
session_sample_rate: initConfiguration.sessionSampleRate,
|
|
452
|
+
telemetry_sample_rate: initConfiguration.telemetrySampleRate,
|
|
453
|
+
telemetry_configuration_sample_rate: initConfiguration.telemetryConfigurationSampleRate,
|
|
454
|
+
telemetry_usage_sample_rate: initConfiguration.telemetryUsageSampleRate,
|
|
455
|
+
use_before_send: !!initConfiguration.beforeSend,
|
|
456
|
+
use_partitioned_cross_site_session_cookie: initConfiguration.usePartitionedCrossSiteSessionCookie,
|
|
457
|
+
use_secure_session_cookie: initConfiguration.useSecureSessionCookie,
|
|
458
|
+
use_proxy: !!initConfiguration.proxy,
|
|
459
|
+
silent_multiple_init: initConfiguration.silentMultipleInit,
|
|
460
|
+
track_session_across_subdomains: initConfiguration.trackSessionAcrossSubdomains,
|
|
461
|
+
track_anonymous_user: initConfiguration.trackAnonymousUser,
|
|
462
|
+
session_persistence: initConfiguration.sessionPersistence,
|
|
463
|
+
allow_fallback_to_local_storage: !!initConfiguration.allowFallbackToLocalStorage,
|
|
464
|
+
store_contexts_across_pages: !!initConfiguration.storeContextsAcrossPages,
|
|
465
|
+
allow_untrusted_events: !!initConfiguration.allowUntrustedEvents,
|
|
466
|
+
tracking_consent: initConfiguration.trackingConsent,
|
|
467
|
+
use_allowed_tracking_origins: Array.isArray(initConfiguration.allowedTrackingOrigins),
|
|
468
|
+
source: initConfiguration.source,
|
|
469
|
+
sdk_version: initConfiguration.sdkVersion,
|
|
470
|
+
variant: initConfiguration.variant,
|
|
471
|
+
} satisfies RawTelemetryConfiguration
|
|
472
|
+
}
|