@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,34 @@
|
|
|
1
|
+
import { Observable } from '../tools/observable'
|
|
2
|
+
|
|
3
|
+
export const TrackingConsent = {
|
|
4
|
+
GRANTED: 'granted',
|
|
5
|
+
NOT_GRANTED: 'not-granted',
|
|
6
|
+
} as const
|
|
7
|
+
export type TrackingConsent = (typeof TrackingConsent)[keyof typeof TrackingConsent]
|
|
8
|
+
|
|
9
|
+
export interface TrackingConsentState {
|
|
10
|
+
tryToInit: (trackingConsent: TrackingConsent) => void
|
|
11
|
+
update: (trackingConsent: TrackingConsent) => void
|
|
12
|
+
isGranted: () => boolean
|
|
13
|
+
observable: Observable<void>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function createTrackingConsentState(currentConsent?: TrackingConsent): TrackingConsentState {
|
|
17
|
+
const observable = new Observable<void>()
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
tryToInit(trackingConsent: TrackingConsent) {
|
|
21
|
+
if (!currentConsent) {
|
|
22
|
+
currentConsent = trackingConsent
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
update(trackingConsent: TrackingConsent) {
|
|
26
|
+
currentConsent = trackingConsent
|
|
27
|
+
observable.notify()
|
|
28
|
+
},
|
|
29
|
+
isGranted() {
|
|
30
|
+
return currentConsent === TrackingConsent.GRANTED
|
|
31
|
+
},
|
|
32
|
+
observable,
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
export type { Configuration, InitConfiguration, EndpointBuilder, ProxyFn } from './domain/configuration'
|
|
2
|
+
export {
|
|
3
|
+
validateAndBuildConfiguration,
|
|
4
|
+
DefaultPrivacyLevel,
|
|
5
|
+
TraceContextInjection,
|
|
6
|
+
serializeConfiguration,
|
|
7
|
+
isSampleRate,
|
|
8
|
+
buildEndpointHost,
|
|
9
|
+
isIntakeUrl,
|
|
10
|
+
} from './domain/configuration'
|
|
11
|
+
export * from './domain/intakeSites'
|
|
12
|
+
export type { TrackingConsentState } from './domain/trackingConsent'
|
|
13
|
+
export { TrackingConsent, createTrackingConsentState } from './domain/trackingConsent'
|
|
14
|
+
export {
|
|
15
|
+
isExperimentalFeatureEnabled,
|
|
16
|
+
addExperimentalFeatures,
|
|
17
|
+
resetExperimentalFeatures,
|
|
18
|
+
getExperimentalFeatures,
|
|
19
|
+
initFeatureFlags,
|
|
20
|
+
ExperimentalFeature,
|
|
21
|
+
} from './tools/experimentalFeatures'
|
|
22
|
+
export { trackRuntimeError } from './domain/error/trackRuntimeError'
|
|
23
|
+
export type { StackTrace } from './tools/stackTrace/computeStackTrace'
|
|
24
|
+
export { computeStackTrace } from './tools/stackTrace/computeStackTrace'
|
|
25
|
+
export type { PublicApi } from './boot/init'
|
|
26
|
+
export { defineGlobal, makePublicApi } from './boot/init'
|
|
27
|
+
export { displayAlreadyInitializedError } from './boot/displayAlreadyInitializedError'
|
|
28
|
+
export { initReportObservable, RawReportType } from './domain/report/reportObservable'
|
|
29
|
+
export type {
|
|
30
|
+
Telemetry,
|
|
31
|
+
RawTelemetryEvent,
|
|
32
|
+
RawTelemetryConfiguration,
|
|
33
|
+
TelemetryEvent,
|
|
34
|
+
TelemetryErrorEvent,
|
|
35
|
+
TelemetryDebugEvent,
|
|
36
|
+
TelemetryConfigurationEvent,
|
|
37
|
+
TelemetryUsageEvent,
|
|
38
|
+
RawTelemetryUsage,
|
|
39
|
+
RawTelemetryUsageFeature,
|
|
40
|
+
} from './domain/telemetry'
|
|
41
|
+
export {
|
|
42
|
+
startTelemetry,
|
|
43
|
+
addTelemetryDebug,
|
|
44
|
+
addTelemetryError,
|
|
45
|
+
resetTelemetry,
|
|
46
|
+
TelemetryService,
|
|
47
|
+
TelemetryMetrics,
|
|
48
|
+
addTelemetryConfiguration,
|
|
49
|
+
addTelemetryUsage,
|
|
50
|
+
addTelemetryMetrics,
|
|
51
|
+
} from './domain/telemetry'
|
|
52
|
+
export { monitored, monitor, callMonitored, setDebugMode, monitorError } from './tools/monitor'
|
|
53
|
+
export type { Subscription } from './tools/observable'
|
|
54
|
+
export { Observable, BufferedObservable } from './tools/observable'
|
|
55
|
+
export type { SessionManager } from './domain/session/sessionManager'
|
|
56
|
+
export { startSessionManager, stopSessionManager } from './domain/session/sessionManager'
|
|
57
|
+
export {
|
|
58
|
+
SESSION_TIME_OUT_DELAY, // Exposed for tests
|
|
59
|
+
SESSION_NOT_TRACKED,
|
|
60
|
+
SessionPersistence,
|
|
61
|
+
} from './domain/session/sessionConstants'
|
|
62
|
+
export type { BandwidthStats, HttpRequest, HttpRequestEvent, Payload, FlushEvent, FlushReason } from './transport'
|
|
63
|
+
export {
|
|
64
|
+
createHttpRequest,
|
|
65
|
+
canUseEventBridge,
|
|
66
|
+
getEventBridge,
|
|
67
|
+
bridgeSupports,
|
|
68
|
+
BridgeCapability,
|
|
69
|
+
createBatch,
|
|
70
|
+
createFlushController,
|
|
71
|
+
} from './transport'
|
|
72
|
+
export * from './tools/display'
|
|
73
|
+
export type { Encoder, EncoderResult } from './tools/encoder'
|
|
74
|
+
export { createIdentityEncoder } from './tools/encoder'
|
|
75
|
+
export * from './tools/utils/urlPolyfill'
|
|
76
|
+
export * from './tools/utils/timeUtils'
|
|
77
|
+
export * from './tools/utils/arrayUtils'
|
|
78
|
+
export * from './tools/serialisation/sanitize'
|
|
79
|
+
export * from './tools/globalObject'
|
|
80
|
+
export { AbstractLifeCycle } from './tools/abstractLifeCycle'
|
|
81
|
+
export * from './domain/eventRateLimiter/createEventRateLimiter'
|
|
82
|
+
export * from './tools/utils/browserDetection'
|
|
83
|
+
export { sendToExtension } from './tools/sendToExtension'
|
|
84
|
+
export { runOnReadyState, asyncRunOnReadyState } from './browser/runOnReadyState'
|
|
85
|
+
export { getZoneJsOriginalValue } from './tools/getZoneJsOriginalValue'
|
|
86
|
+
export type { InstrumentedMethodCall } from './tools/instrumentMethod'
|
|
87
|
+
export { instrumentMethod, instrumentSetter } from './tools/instrumentMethod'
|
|
88
|
+
export {
|
|
89
|
+
computeRawError,
|
|
90
|
+
getFileFromStackTraceString,
|
|
91
|
+
isError,
|
|
92
|
+
NO_ERROR_STACK_PRESENT_MESSAGE,
|
|
93
|
+
} from './domain/error/error'
|
|
94
|
+
export { NonErrorPrefix } from './domain/error/error.types'
|
|
95
|
+
export type { Context, ContextArray, ContextValue } from './tools/serialisation/context'
|
|
96
|
+
export {
|
|
97
|
+
areCookiesAuthorized,
|
|
98
|
+
getCookie,
|
|
99
|
+
getInitCookie,
|
|
100
|
+
setCookie,
|
|
101
|
+
deleteCookie,
|
|
102
|
+
resetInitCookies,
|
|
103
|
+
} from './browser/cookie'
|
|
104
|
+
export type { CookieStore, WeakRef, WeakRefConstructor } from './browser/browser.types'
|
|
105
|
+
export type { XhrCompleteContext, XhrStartContext } from './browser/xhrObservable'
|
|
106
|
+
export { initXhrObservable } from './browser/xhrObservable'
|
|
107
|
+
export type { FetchResolveContext, FetchStartContext, FetchContext } from './browser/fetchObservable'
|
|
108
|
+
export { initFetchObservable, resetFetchObservable } from './browser/fetchObservable'
|
|
109
|
+
export type { PageMayExitEvent } from './browser/pageMayExitObservable'
|
|
110
|
+
export { createPageMayExitObservable, PageExitReason, isPageExitReason } from './browser/pageMayExitObservable'
|
|
111
|
+
export * from './browser/addEventListener'
|
|
112
|
+
export { requestIdleCallback } from './tools/requestIdleCallback'
|
|
113
|
+
export * from './tools/taskQueue'
|
|
114
|
+
export * from './tools/timer'
|
|
115
|
+
export type { ConsoleLog } from './domain/console/consoleObservable'
|
|
116
|
+
export { initConsoleObservable, resetConsoleObservable } from './domain/console/consoleObservable'
|
|
117
|
+
export type { BoundedBuffer } from './tools/boundedBuffer'
|
|
118
|
+
export { createBoundedBuffer } from './tools/boundedBuffer'
|
|
119
|
+
export { catchUserErrors } from './tools/catchUserErrors'
|
|
120
|
+
export type { ContextManager } from './domain/context/contextManager'
|
|
121
|
+
export { createContextManager } from './domain/context/contextManager'
|
|
122
|
+
export { defineContextMethod, bufferContextCalls } from './domain/context/defineContextMethod'
|
|
123
|
+
export { storeContextManager, removeStorageListeners } from './domain/context/storeContextManager'
|
|
124
|
+
export { startAccountContext, buildAccountContextManager } from './domain/contexts/accountContext'
|
|
125
|
+
export { startGlobalContext, buildGlobalContextManager } from './domain/contexts/globalContext'
|
|
126
|
+
export { startUserContext, buildUserContextManager } from './domain/contexts/userContext'
|
|
127
|
+
export type { User } from './domain/contexts/userContext'
|
|
128
|
+
export type { Account } from './domain/contexts/accountContext'
|
|
129
|
+
export type { RumInternalContext } from './domain/contexts/rumInternalContext.type'
|
|
130
|
+
export { CustomerDataType, CustomerContextKey, ContextManagerMethod } from './domain/context/contextConstants'
|
|
131
|
+
export type { ValueHistory, ValueHistoryEntry } from './tools/valueHistory'
|
|
132
|
+
export { createValueHistory, CLEAR_OLD_VALUES_INTERVAL } from './tools/valueHistory'
|
|
133
|
+
export { readBytesFromStream } from './tools/readBytesFromStream'
|
|
134
|
+
export type { SessionState } from './domain/session/sessionState'
|
|
135
|
+
export { STORAGE_POLL_DELAY } from './domain/session/sessionStore'
|
|
136
|
+
export { SESSION_STORE_KEY } from './domain/session/storeStrategies/sessionStoreStrategy'
|
|
137
|
+
export {
|
|
138
|
+
willSyntheticsInjectRum,
|
|
139
|
+
getSyntheticsTestId,
|
|
140
|
+
getSyntheticsResultId,
|
|
141
|
+
isSyntheticsTest,
|
|
142
|
+
} from './domain/synthetics/syntheticsWorkerValues'
|
|
143
|
+
export { checkContext } from './domain/context/contextUtils'
|
|
144
|
+
export * from './domain/resourceUtils'
|
|
145
|
+
export * from './domain/bufferedData'
|
|
146
|
+
export * from './tools/utils/polyfills'
|
|
147
|
+
export * from './tools/utils/timezone'
|
|
148
|
+
export * from './tools/utils/numberUtils'
|
|
149
|
+
export * from './tools/utils/byteUtils'
|
|
150
|
+
export * from './tools/utils/objectUtils'
|
|
151
|
+
export * from './tools/utils/functionUtils'
|
|
152
|
+
export * from './tools/serialisation/jsonStringify'
|
|
153
|
+
export * from './tools/mergeInto'
|
|
154
|
+
export * from './tools/utils/stringUtils'
|
|
155
|
+
export * from './tools/matchOption'
|
|
156
|
+
export * from './tools/utils/responseUtils'
|
|
157
|
+
export * from './tools/utils/typeUtils'
|
|
158
|
+
export type { RawError, RawErrorCause, ErrorWithCause, Csp } from './domain/error/error.types'
|
|
159
|
+
export { ErrorHandling, ErrorSource } from './domain/error/error.types'
|
|
160
|
+
export * from './domain/deflate'
|
|
161
|
+
export * from './domain/connectivity'
|
|
162
|
+
export * from './tools/stackTrace/handlingStack'
|
|
163
|
+
export * from './tools/abstractHooks'
|
|
164
|
+
export * from './domain/tags'
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { combine } from './mergeInto'
|
|
2
|
+
|
|
3
|
+
export const enum HookNames {
|
|
4
|
+
Assemble,
|
|
5
|
+
AssembleTelemetry,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// This is a workaround for an issue occurring when the Browser SDK is included in a TypeScript
|
|
9
|
+
// project configured with `isolatedModules: true`. Even if the const enum is declared in this
|
|
10
|
+
// module, we cannot use it directly to define the EventMap interface keys (TS error: "Cannot access
|
|
11
|
+
// ambient const enums when the '--isolatedModules' flag is provided.").
|
|
12
|
+
export declare const HookNamesAsConst: {
|
|
13
|
+
ASSEMBLE: HookNames.Assemble
|
|
14
|
+
ASSEMBLE_TELEMETRY: HookNames.AssembleTelemetry
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type RecursivePartial<T> = {
|
|
18
|
+
[P in keyof T]?: T[P] extends Array<infer U>
|
|
19
|
+
? Array<RecursivePartial<U>>
|
|
20
|
+
: T[P] extends object | undefined
|
|
21
|
+
? RecursivePartial<T[P]>
|
|
22
|
+
: T[P]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Discards the event from being sent
|
|
26
|
+
export const DISCARDED = 'DISCARDED'
|
|
27
|
+
// Skips from the assembly of the event
|
|
28
|
+
export const SKIPPED = 'SKIPPED'
|
|
29
|
+
|
|
30
|
+
export type DISCARDED = typeof DISCARDED
|
|
31
|
+
export type SKIPPED = typeof SKIPPED
|
|
32
|
+
|
|
33
|
+
export type AbstractHooks = ReturnType<typeof abstractHooks>
|
|
34
|
+
|
|
35
|
+
export function abstractHooks<T extends { [K in HookNames]: (...args: any[]) => unknown }>() {
|
|
36
|
+
const callbacks: { [K in HookNames]?: Array<T[K]> } = {}
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
register<K extends HookNames>(hookName: K, callback: T[K]) {
|
|
40
|
+
if (!callbacks[hookName]) {
|
|
41
|
+
callbacks[hookName] = []
|
|
42
|
+
}
|
|
43
|
+
callbacks[hookName]!.push(callback)
|
|
44
|
+
return {
|
|
45
|
+
unregister: () => {
|
|
46
|
+
callbacks[hookName] = callbacks[hookName]!.filter((cb) => cb !== callback)
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
triggerHook<K extends HookNames>(
|
|
51
|
+
hookName: K,
|
|
52
|
+
param: Parameters<T[K]>[0]
|
|
53
|
+
): Exclude<ReturnType<T[K]>, SKIPPED> | DISCARDED | undefined {
|
|
54
|
+
const hookCallbacks = callbacks[hookName] || []
|
|
55
|
+
const results: any[] = []
|
|
56
|
+
|
|
57
|
+
for (const callback of hookCallbacks) {
|
|
58
|
+
const result = callback(param)
|
|
59
|
+
if (result === DISCARDED) {
|
|
60
|
+
return DISCARDED
|
|
61
|
+
}
|
|
62
|
+
if (result === SKIPPED) {
|
|
63
|
+
continue
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
results.push(result)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return combine(...(results as [any, any])) as Exclude<ReturnType<T[K]>, SKIPPED>
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Subscription } from './observable'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Type helper to extract event types that have "void" data. This allows to call `notify` without a
|
|
5
|
+
* second argument. Ex:
|
|
6
|
+
*
|
|
7
|
+
* ```
|
|
8
|
+
* interface EventMap {
|
|
9
|
+
* foo: void
|
|
10
|
+
* }
|
|
11
|
+
* const LifeCycle = AbstractLifeCycle<EventMap>
|
|
12
|
+
* new LifeCycle().notify('foo')
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
type EventTypesWithoutData<EventMap> = {
|
|
16
|
+
[K in keyof EventMap]: EventMap[K] extends void ? K : never
|
|
17
|
+
}[keyof EventMap]
|
|
18
|
+
|
|
19
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
20
|
+
export class AbstractLifeCycle<EventMap> {
|
|
21
|
+
private callbacks: { [key in keyof EventMap]?: Array<(data: any) => void> } = {}
|
|
22
|
+
|
|
23
|
+
notify<EventType extends EventTypesWithoutData<EventMap>>(eventType: EventType): void
|
|
24
|
+
notify<EventType extends keyof EventMap>(eventType: EventType, data: EventMap[EventType]): void
|
|
25
|
+
notify(eventType: keyof EventMap, data?: unknown) {
|
|
26
|
+
const eventCallbacks = this.callbacks[eventType]
|
|
27
|
+
if (eventCallbacks) {
|
|
28
|
+
eventCallbacks.forEach((callback) => callback(data))
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
subscribe<EventType extends keyof EventMap>(
|
|
33
|
+
eventType: EventType,
|
|
34
|
+
callback: (data: EventMap[EventType]) => void
|
|
35
|
+
): Subscription {
|
|
36
|
+
if (!this.callbacks[eventType]) {
|
|
37
|
+
this.callbacks[eventType] = []
|
|
38
|
+
}
|
|
39
|
+
this.callbacks[eventType]!.push(callback)
|
|
40
|
+
return {
|
|
41
|
+
unsubscribe: () => {
|
|
42
|
+
this.callbacks[eventType] = this.callbacks[eventType]!.filter((other) => callback !== other)
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { removeItem } from './utils/arrayUtils'
|
|
2
|
+
|
|
3
|
+
const BUFFER_LIMIT = 500
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* BoundedBuffer is a deprecated interface.
|
|
7
|
+
*
|
|
8
|
+
* @deprecated Use `BufferedObservable` instead.
|
|
9
|
+
*/
|
|
10
|
+
export interface BoundedBuffer<T = void> {
|
|
11
|
+
add: (callback: (arg: T) => void) => void
|
|
12
|
+
remove: (callback: (arg: T) => void) => void
|
|
13
|
+
drain: (arg: T) => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* createBoundedBuffer creates a BoundedBuffer.
|
|
18
|
+
*
|
|
19
|
+
* @deprecated Use `BufferedObservable` instead.
|
|
20
|
+
*/
|
|
21
|
+
export function createBoundedBuffer<T = void>(): BoundedBuffer<T> {
|
|
22
|
+
const buffer: Array<(arg: T) => void> = []
|
|
23
|
+
|
|
24
|
+
const add: BoundedBuffer<T>['add'] = (callback: (arg: T) => void) => {
|
|
25
|
+
const length = buffer.push(callback)
|
|
26
|
+
if (length > BUFFER_LIMIT) {
|
|
27
|
+
buffer.splice(0, 1)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const remove: BoundedBuffer<T>['remove'] = (callback: (arg: T) => void) => {
|
|
32
|
+
removeItem(buffer, callback)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const drain = (arg: T) => {
|
|
36
|
+
buffer.forEach((callback) => callback(arg))
|
|
37
|
+
buffer.length = 0
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
add,
|
|
42
|
+
remove,
|
|
43
|
+
drain,
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { display } from './display'
|
|
2
|
+
|
|
3
|
+
export function catchUserErrors<Args extends any[], R>(fn: (...args: Args) => R, errorMsg: string) {
|
|
4
|
+
return (...args: Args) => {
|
|
5
|
+
try {
|
|
6
|
+
return fn(...args)
|
|
7
|
+
} catch (err) {
|
|
8
|
+
display.error(errorMsg, err)
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* eslint-disable local-rules/disallow-side-effects */
|
|
2
|
+
/**
|
|
3
|
+
* Keep references on console methods to avoid triggering patched behaviors
|
|
4
|
+
*
|
|
5
|
+
* NB: in some setup, console could already be patched by another SDK.
|
|
6
|
+
* In this case, some display messages can be sent by the other SDK
|
|
7
|
+
* but we should be safe from infinite loop nonetheless.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export const ConsoleApiName = {
|
|
11
|
+
log: 'log',
|
|
12
|
+
debug: 'debug',
|
|
13
|
+
info: 'info',
|
|
14
|
+
warn: 'warn',
|
|
15
|
+
error: 'error',
|
|
16
|
+
} as const
|
|
17
|
+
|
|
18
|
+
export type ConsoleApiName = (typeof ConsoleApiName)[keyof typeof ConsoleApiName]
|
|
19
|
+
|
|
20
|
+
interface Display {
|
|
21
|
+
debug: typeof console.debug
|
|
22
|
+
log: typeof console.log
|
|
23
|
+
info: typeof console.info
|
|
24
|
+
warn: typeof console.warn
|
|
25
|
+
error: typeof console.error
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* When building JS bundles, some users might use a plugin[1] or configuration[2] to remove
|
|
30
|
+
* "console.*" references. This causes some issue as we expect `console.*` to be defined.
|
|
31
|
+
* As a workaround, let's use a variable alias, so those expressions won't be taken into account by
|
|
32
|
+
* simple static analysis.
|
|
33
|
+
*
|
|
34
|
+
* [1]: https://babeljs.io/docs/babel-plugin-transform-remove-console/
|
|
35
|
+
* [2]: https://github.com/terser/terser#compress-options (look for drop_console)
|
|
36
|
+
*/
|
|
37
|
+
export const globalConsole = console
|
|
38
|
+
|
|
39
|
+
export const originalConsoleMethods = {} as Display
|
|
40
|
+
Object.keys(ConsoleApiName).forEach((name) => {
|
|
41
|
+
originalConsoleMethods[name as ConsoleApiName] = globalConsole[name as ConsoleApiName]
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const PREFIX = 'Datadog Browser SDK:'
|
|
45
|
+
|
|
46
|
+
export const display: Display = {
|
|
47
|
+
debug: originalConsoleMethods.debug.bind(globalConsole, PREFIX),
|
|
48
|
+
log: originalConsoleMethods.log.bind(globalConsole, PREFIX),
|
|
49
|
+
info: originalConsoleMethods.info.bind(globalConsole, PREFIX),
|
|
50
|
+
warn: originalConsoleMethods.warn.bind(globalConsole, PREFIX),
|
|
51
|
+
error: originalConsoleMethods.error.bind(globalConsole, PREFIX),
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const DOCS_ORIGIN = 'https://docs.datadoghq.com'
|
|
55
|
+
export const DOCS_TROUBLESHOOTING = `${DOCS_ORIGIN}/real_user_monitoring/browser/troubleshooting`
|
|
56
|
+
export const MORE_DETAILS = 'More details:'
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { Uint8ArrayBuffer } from './utils/byteUtils'
|
|
2
|
+
import { computeBytesCount } from './utils/byteUtils'
|
|
3
|
+
|
|
4
|
+
export interface Encoder<Output extends string | Uint8ArrayBuffer = string | Uint8ArrayBuffer> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether this encoder might call the provided callbacks asynchronously
|
|
7
|
+
*/
|
|
8
|
+
isAsync: boolean
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Whether some data has been written since the last finish() or finishSync() call
|
|
12
|
+
*/
|
|
13
|
+
isEmpty: boolean
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Write a string to be encoded.
|
|
17
|
+
*
|
|
18
|
+
* This operation can be synchronous or asynchronous depending on the encoder implementation.
|
|
19
|
+
*
|
|
20
|
+
* If specified, the callback will be invoked when the operation finishes, unless the operation is
|
|
21
|
+
* asynchronous and finish() or finishSync() is called in the meantime.
|
|
22
|
+
*/
|
|
23
|
+
write(data: string, callback?: (additionalEncodedBytesCount: number) => void): void
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Waits for pending data to be encoded and resets the encoder state.
|
|
27
|
+
*
|
|
28
|
+
* This operation can be synchronous or asynchronous depending on the encoder implementation.
|
|
29
|
+
*
|
|
30
|
+
* The callback will be invoked when the operation finishes, unless the operation is asynchronous
|
|
31
|
+
* and another call to finish() or finishSync() occurs in the meantime.
|
|
32
|
+
*/
|
|
33
|
+
finish(callback: (result: EncoderResult<Output>) => void): void
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Resets the encoder state then returns the encoded data and any potential pending data directly,
|
|
37
|
+
* discarding all pending write operations and finish() callbacks.
|
|
38
|
+
*/
|
|
39
|
+
finishSync(): EncoderResult<Output> & { pendingData: string }
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Returns a rough estimation of the bytes count if the data was encoded.
|
|
43
|
+
*/
|
|
44
|
+
estimateEncodedBytesCount(data: string): number
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface EncoderResult<Output extends string | Uint8ArrayBuffer = string | Uint8ArrayBuffer> {
|
|
48
|
+
output: Output
|
|
49
|
+
outputBytesCount: number
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* An encoding type supported by HTTP Content-Encoding, if applicable.
|
|
53
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding#directives
|
|
54
|
+
*/
|
|
55
|
+
encoding?: 'deflate'
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Total bytes count of the input strings encoded to UTF-8.
|
|
59
|
+
*/
|
|
60
|
+
rawBytesCount: number
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function createIdentityEncoder(): Encoder<string> {
|
|
64
|
+
let output = ''
|
|
65
|
+
let outputBytesCount = 0
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
isAsync: false,
|
|
69
|
+
|
|
70
|
+
get isEmpty() {
|
|
71
|
+
return !output
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
write(data, callback) {
|
|
75
|
+
const additionalEncodedBytesCount = computeBytesCount(data)
|
|
76
|
+
outputBytesCount += additionalEncodedBytesCount
|
|
77
|
+
output += data
|
|
78
|
+
if (callback) {
|
|
79
|
+
callback(additionalEncodedBytesCount)
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
finish(callback) {
|
|
84
|
+
callback(this.finishSync())
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
finishSync() {
|
|
88
|
+
const result = {
|
|
89
|
+
output,
|
|
90
|
+
outputBytesCount,
|
|
91
|
+
rawBytesCount: outputBytesCount,
|
|
92
|
+
pendingData: '',
|
|
93
|
+
}
|
|
94
|
+
output = ''
|
|
95
|
+
outputBytesCount = 0
|
|
96
|
+
return result
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
estimateEncodedBytesCount(data) {
|
|
100
|
+
return data.length
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LIMITATION:
|
|
3
|
+
* For NPM setup, this feature flag singleton is shared between RUM and Logs product.
|
|
4
|
+
* This means that an experimental flag set on the RUM product will be set on the Logs product.
|
|
5
|
+
* So keep in mind that in certain configurations, your experimental feature flag may affect other products.
|
|
6
|
+
*
|
|
7
|
+
* FORMAT:
|
|
8
|
+
* All feature flags should be snake_cased
|
|
9
|
+
*/
|
|
10
|
+
// We want to use a real enum (i.e. not a const enum) here, to be able to check whether an arbitrary
|
|
11
|
+
// string is an expected feature flag
|
|
12
|
+
|
|
13
|
+
import { objectHasValue } from './utils/objectUtils'
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
16
|
+
export enum ExperimentalFeature {
|
|
17
|
+
TRACK_INTAKE_REQUESTS = 'track_intake_requests',
|
|
18
|
+
USE_TREE_WALKER_FOR_ACTION_NAME = 'use_tree_walker_for_action_name',
|
|
19
|
+
FEATURE_OPERATION_VITAL = 'feature_operation_vital',
|
|
20
|
+
SHORT_SESSION_INVESTIGATION = 'short_session_investigation',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const enabledExperimentalFeatures: Set<ExperimentalFeature> = new Set()
|
|
24
|
+
|
|
25
|
+
export function initFeatureFlags(enableExperimentalFeatures: string[] | undefined) {
|
|
26
|
+
if (Array.isArray(enableExperimentalFeatures)) {
|
|
27
|
+
addExperimentalFeatures(
|
|
28
|
+
enableExperimentalFeatures.filter((flag): flag is ExperimentalFeature =>
|
|
29
|
+
objectHasValue(ExperimentalFeature, flag)
|
|
30
|
+
)
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function addExperimentalFeatures(enabledFeatures: ExperimentalFeature[]): void {
|
|
36
|
+
enabledFeatures.forEach((flag) => {
|
|
37
|
+
enabledExperimentalFeatures.add(flag)
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function isExperimentalFeatureEnabled(featureName: ExperimentalFeature): boolean {
|
|
42
|
+
return enabledExperimentalFeatures.has(featureName)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function resetExperimentalFeatures(): void {
|
|
46
|
+
enabledExperimentalFeatures.clear()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function getExperimentalFeatures(): Set<ExperimentalFeature> {
|
|
50
|
+
return enabledExperimentalFeatures
|
|
51
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { getGlobalObject } from './globalObject'
|
|
2
|
+
|
|
3
|
+
export interface BrowserWindowWithZoneJs extends Window {
|
|
4
|
+
Zone?: {
|
|
5
|
+
// All Zone.js versions expose the __symbol__ method, but we observed that some website have a
|
|
6
|
+
// 'Zone' global variable unrelated to Zone.js, so let's consider this method optional
|
|
7
|
+
// nonetheless.
|
|
8
|
+
__symbol__?: (name: string) => string
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Gets the original value for a DOM API that was potentially patched by Zone.js.
|
|
14
|
+
*
|
|
15
|
+
* Zone.js[1] is a library that patches a bunch of JS and DOM APIs. It usually stores the original
|
|
16
|
+
* value of the patched functions/constructors/methods in a hidden property prefixed by
|
|
17
|
+
* __zone_symbol__.
|
|
18
|
+
*
|
|
19
|
+
* In multiple occasions, we observed that Zone.js is the culprit of important issues leading to
|
|
20
|
+
* browser resource exhaustion (memory leak, high CPU usage). This method is used as a workaround to
|
|
21
|
+
* use the original DOM API instead of the one patched by Zone.js.
|
|
22
|
+
*
|
|
23
|
+
* [1]: https://github.com/angular/angular/tree/main/packages/zone.js
|
|
24
|
+
*/
|
|
25
|
+
export function getZoneJsOriginalValue<Target, Name extends keyof Target & string>(
|
|
26
|
+
target: Target,
|
|
27
|
+
name: Name
|
|
28
|
+
): Target[Name] {
|
|
29
|
+
const browserWindow = getGlobalObject<BrowserWindowWithZoneJs>()
|
|
30
|
+
let original: Target[Name] | undefined
|
|
31
|
+
if (browserWindow.Zone && typeof browserWindow.Zone.__symbol__ === 'function') {
|
|
32
|
+
original = (target as any)[browserWindow.Zone.__symbol__(name)]
|
|
33
|
+
}
|
|
34
|
+
if (!original) {
|
|
35
|
+
original = target[name]
|
|
36
|
+
}
|
|
37
|
+
return original
|
|
38
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inspired by https://mathiasbynens.be/notes/globalthis
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Extend/Create the WorkerGlobalScope interface to avoid issues when used in a non-browser tsconfig environment
|
|
6
|
+
interface WorkerGlobalScope {
|
|
7
|
+
empty: never
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Utility type to enforce that exactly one of the two types is used
|
|
11
|
+
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never }
|
|
12
|
+
type XOR<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U
|
|
13
|
+
|
|
14
|
+
export type GlobalObject = XOR<Window, WorkerGlobalScope>
|
|
15
|
+
|
|
16
|
+
export function getGlobalObject<T = typeof globalThis>(): T {
|
|
17
|
+
if (typeof globalThis === 'object') {
|
|
18
|
+
return globalThis as unknown as T
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(Object.prototype, '_dd_temp_', {
|
|
21
|
+
get() {
|
|
22
|
+
return this as object
|
|
23
|
+
},
|
|
24
|
+
configurable: true,
|
|
25
|
+
})
|
|
26
|
+
// @ts-ignore _dd_temp is defined using defineProperty
|
|
27
|
+
let globalObject: unknown = _dd_temp_
|
|
28
|
+
// @ts-ignore _dd_temp is defined using defineProperty
|
|
29
|
+
delete Object.prototype._dd_temp_
|
|
30
|
+
if (typeof globalObject !== 'object') {
|
|
31
|
+
// on safari _dd_temp_ is available on window but not globally
|
|
32
|
+
// fallback on other browser globals check
|
|
33
|
+
if (typeof self === 'object') {
|
|
34
|
+
globalObject = self
|
|
35
|
+
} else if (typeof window === 'object') {
|
|
36
|
+
globalObject = window
|
|
37
|
+
} else {
|
|
38
|
+
globalObject = {}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return globalObject as T
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Cached reference to the global object so it can be imported and re-used without
|
|
46
|
+
* re-evaluating the heavyweight fallback logic in `getGlobalObject()`.
|
|
47
|
+
*/
|
|
48
|
+
// eslint-disable-next-line local-rules/disallow-side-effects
|
|
49
|
+
export const globalObject = getGlobalObject<GlobalObject>()
|
|
50
|
+
|
|
51
|
+
export const isWorkerEnvironment = 'WorkerGlobalScope' in globalObject
|