@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,144 @@
|
|
|
1
|
+
import { DOCS_TROUBLESHOOTING, MORE_DETAILS, display } from '../tools/display'
|
|
2
|
+
import type { Context } from '../tools/serialisation/context'
|
|
3
|
+
import { objectValues } from '../tools/utils/polyfills'
|
|
4
|
+
import { isPageExitReason } from '../browser/pageMayExitObservable'
|
|
5
|
+
import { jsonStringify } from '../tools/serialisation/jsonStringify'
|
|
6
|
+
import type { Encoder, EncoderResult } from '../tools/encoder'
|
|
7
|
+
import { computeBytesCount } from '../tools/utils/byteUtils'
|
|
8
|
+
import type { HttpRequest, Payload } from './httpRequest'
|
|
9
|
+
import type { FlushController, FlushEvent } from './flushController'
|
|
10
|
+
|
|
11
|
+
export interface Batch {
|
|
12
|
+
flushController: FlushController
|
|
13
|
+
add: (message: Context) => void
|
|
14
|
+
upsert: (message: Context, key: string) => void
|
|
15
|
+
stop: () => void
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function createBatch({
|
|
19
|
+
encoder,
|
|
20
|
+
request,
|
|
21
|
+
flushController,
|
|
22
|
+
messageBytesLimit,
|
|
23
|
+
}: {
|
|
24
|
+
encoder: Encoder
|
|
25
|
+
request: HttpRequest
|
|
26
|
+
flushController: FlushController
|
|
27
|
+
messageBytesLimit: number
|
|
28
|
+
}): Batch {
|
|
29
|
+
let upsertBuffer: { [key: string]: string } = {}
|
|
30
|
+
const flushSubscription = flushController.flushObservable.subscribe((event) => flush(event))
|
|
31
|
+
|
|
32
|
+
function push(serializedMessage: string, estimatedMessageBytesCount: number, key?: string) {
|
|
33
|
+
flushController.notifyBeforeAddMessage(estimatedMessageBytesCount)
|
|
34
|
+
|
|
35
|
+
if (key !== undefined) {
|
|
36
|
+
upsertBuffer[key] = serializedMessage
|
|
37
|
+
flushController.notifyAfterAddMessage()
|
|
38
|
+
} else {
|
|
39
|
+
encoder.write(encoder.isEmpty ? serializedMessage : `\n${serializedMessage}`, (realMessageBytesCount) => {
|
|
40
|
+
flushController.notifyAfterAddMessage(realMessageBytesCount - estimatedMessageBytesCount)
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function hasMessageFor(key?: string): key is string {
|
|
46
|
+
return key !== undefined && upsertBuffer[key] !== undefined
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function remove(key: string) {
|
|
50
|
+
const removedMessage = upsertBuffer[key]
|
|
51
|
+
delete upsertBuffer[key]
|
|
52
|
+
const messageBytesCount = encoder.estimateEncodedBytesCount(removedMessage)
|
|
53
|
+
flushController.notifyAfterRemoveMessage(messageBytesCount)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function addOrUpdate(message: Context, key?: string) {
|
|
57
|
+
const serializedMessage = jsonStringify(message)!
|
|
58
|
+
|
|
59
|
+
const estimatedMessageBytesCount = encoder.estimateEncodedBytesCount(serializedMessage)
|
|
60
|
+
|
|
61
|
+
if (estimatedMessageBytesCount >= messageBytesLimit) {
|
|
62
|
+
display.warn(
|
|
63
|
+
`Discarded a message whose size was bigger than the maximum allowed size ${messageBytesLimit}KB. ${MORE_DETAILS} ${DOCS_TROUBLESHOOTING}/#technical-limitations`
|
|
64
|
+
)
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (hasMessageFor(key)) {
|
|
69
|
+
remove(key)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
push(serializedMessage, estimatedMessageBytesCount, key)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function flush(event: FlushEvent) {
|
|
76
|
+
const upsertMessages = objectValues(upsertBuffer).join('\n')
|
|
77
|
+
upsertBuffer = {}
|
|
78
|
+
|
|
79
|
+
const pageMightExit = isPageExitReason(event.reason)
|
|
80
|
+
const send = pageMightExit ? request.sendOnExit : request.send
|
|
81
|
+
|
|
82
|
+
if (
|
|
83
|
+
pageMightExit &&
|
|
84
|
+
// Note: checking that the encoder is async is not strictly needed, but it's an optimization:
|
|
85
|
+
// if the encoder is async we need to send two requests in some cases (one for encoded data
|
|
86
|
+
// and the other for non-encoded data). But if it's not async, we don't have to worry about
|
|
87
|
+
// it and always send a single request.
|
|
88
|
+
encoder.isAsync
|
|
89
|
+
) {
|
|
90
|
+
const encoderResult = encoder.finishSync()
|
|
91
|
+
|
|
92
|
+
// Send encoded messages
|
|
93
|
+
if (encoderResult.outputBytesCount) {
|
|
94
|
+
send(formatPayloadFromEncoder(encoderResult))
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Send messages that are not yet encoded at this point
|
|
98
|
+
const pendingMessages = [encoderResult.pendingData, upsertMessages].filter(Boolean).join('\n')
|
|
99
|
+
if (pendingMessages) {
|
|
100
|
+
send({
|
|
101
|
+
data: pendingMessages,
|
|
102
|
+
bytesCount: computeBytesCount(pendingMessages),
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
if (upsertMessages) {
|
|
107
|
+
encoder.write(encoder.isEmpty ? upsertMessages : `\n${upsertMessages}`)
|
|
108
|
+
}
|
|
109
|
+
encoder.finish((encoderResult) => {
|
|
110
|
+
send(formatPayloadFromEncoder(encoderResult))
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
flushController,
|
|
117
|
+
add: addOrUpdate,
|
|
118
|
+
upsert: addOrUpdate,
|
|
119
|
+
stop: flushSubscription.unsubscribe,
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function formatPayloadFromEncoder(encoderResult: EncoderResult): Payload {
|
|
124
|
+
let data: string | Blob
|
|
125
|
+
if (typeof encoderResult.output === 'string') {
|
|
126
|
+
data = encoderResult.output
|
|
127
|
+
} else {
|
|
128
|
+
data = new Blob([encoderResult.output], {
|
|
129
|
+
// This will set the 'Content-Type: text/plain' header. Reasoning:
|
|
130
|
+
// * The intake rejects the request if there is no content type.
|
|
131
|
+
// * The browser will issue CORS preflight requests if we set it to 'application/json', which
|
|
132
|
+
// could induce higher intake load (and maybe has other impacts).
|
|
133
|
+
// * Also it's not quite JSON, since we are concatenating multiple JSON objects separated by
|
|
134
|
+
// new lines.
|
|
135
|
+
type: 'text/plain',
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
data,
|
|
141
|
+
bytesCount: encoderResult.outputBytesCount,
|
|
142
|
+
encoding: encoderResult.encoding,
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { getGlobalObject } from '../tools/globalObject'
|
|
2
|
+
import type { DefaultPrivacyLevel } from '../domain/configuration'
|
|
3
|
+
|
|
4
|
+
export interface BrowserWindowWithEventBridge extends Window {
|
|
5
|
+
DatadogEventBridge?: DatadogEventBridge
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface DatadogEventBridge {
|
|
9
|
+
getCapabilities?(): string
|
|
10
|
+
getPrivacyLevel?(): DefaultPrivacyLevel
|
|
11
|
+
getAllowedWebViewHosts(): string
|
|
12
|
+
send(msg: string): void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const enum BridgeCapability {
|
|
16
|
+
RECORDS = 'records',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function getEventBridge<T, E>() {
|
|
20
|
+
const eventBridgeGlobal = getEventBridgeGlobal()
|
|
21
|
+
|
|
22
|
+
if (!eventBridgeGlobal) {
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
getCapabilities() {
|
|
28
|
+
return JSON.parse(eventBridgeGlobal.getCapabilities?.() || '[]') as BridgeCapability[]
|
|
29
|
+
},
|
|
30
|
+
getPrivacyLevel() {
|
|
31
|
+
return eventBridgeGlobal.getPrivacyLevel?.()
|
|
32
|
+
},
|
|
33
|
+
getAllowedWebViewHosts() {
|
|
34
|
+
return JSON.parse(eventBridgeGlobal.getAllowedWebViewHosts()) as string[]
|
|
35
|
+
},
|
|
36
|
+
send(eventType: T, event: E, viewId?: string) {
|
|
37
|
+
const view = viewId ? { id: viewId } : undefined
|
|
38
|
+
eventBridgeGlobal.send(JSON.stringify({ eventType, event, view }))
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function bridgeSupports(capability: BridgeCapability): boolean {
|
|
44
|
+
const bridge = getEventBridge()
|
|
45
|
+
return !!bridge && bridge.getCapabilities().includes(capability)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function canUseEventBridge(currentHost = getGlobalObject<Window>().location?.hostname): boolean {
|
|
49
|
+
const bridge = getEventBridge()
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
!!bridge &&
|
|
53
|
+
bridge
|
|
54
|
+
.getAllowedWebViewHosts()
|
|
55
|
+
.some((allowedHost) => currentHost === allowedHost || currentHost.endsWith(`.${allowedHost}`))
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function getEventBridgeGlobal() {
|
|
60
|
+
return getGlobalObject<BrowserWindowWithEventBridge>().DatadogEventBridge
|
|
61
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { PageMayExitEvent, PageExitReason } from '../browser/pageMayExitObservable'
|
|
2
|
+
import { Observable } from '../tools/observable'
|
|
3
|
+
import type { TimeoutId } from '../tools/timer'
|
|
4
|
+
import { clearTimeout, setTimeout } from '../tools/timer'
|
|
5
|
+
import type { Duration } from '../tools/utils/timeUtils'
|
|
6
|
+
|
|
7
|
+
export type FlushReason = PageExitReason | 'duration_limit' | 'bytes_limit' | 'messages_limit' | 'session_expire'
|
|
8
|
+
|
|
9
|
+
export type FlushController = ReturnType<typeof createFlushController>
|
|
10
|
+
export interface FlushEvent {
|
|
11
|
+
reason: FlushReason
|
|
12
|
+
bytesCount: number
|
|
13
|
+
messagesCount: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface FlushControllerOptions {
|
|
17
|
+
messagesLimit: number
|
|
18
|
+
bytesLimit: number
|
|
19
|
+
durationLimit: Duration
|
|
20
|
+
pageMayExitObservable: Observable<PageMayExitEvent>
|
|
21
|
+
sessionExpireObservable: Observable<void>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Returns a "flush controller", responsible of notifying when flushing a pool of pending data needs
|
|
26
|
+
* to happen. The implementation is designed to support both synchronous and asynchronous usages,
|
|
27
|
+
* but relies on invariants described in each method documentation to keep a coherent state.
|
|
28
|
+
*/
|
|
29
|
+
export function createFlushController({
|
|
30
|
+
messagesLimit,
|
|
31
|
+
bytesLimit,
|
|
32
|
+
durationLimit,
|
|
33
|
+
pageMayExitObservable,
|
|
34
|
+
sessionExpireObservable,
|
|
35
|
+
}: FlushControllerOptions) {
|
|
36
|
+
const pageMayExitSubscription = pageMayExitObservable.subscribe((event) => flush(event.reason))
|
|
37
|
+
const sessionExpireSubscription = sessionExpireObservable.subscribe(() => flush('session_expire'))
|
|
38
|
+
|
|
39
|
+
const flushObservable = new Observable<FlushEvent>(() => () => {
|
|
40
|
+
pageMayExitSubscription.unsubscribe()
|
|
41
|
+
sessionExpireSubscription.unsubscribe()
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
let currentBytesCount = 0
|
|
45
|
+
let currentMessagesCount = 0
|
|
46
|
+
|
|
47
|
+
function flush(flushReason: FlushReason) {
|
|
48
|
+
if (currentMessagesCount === 0) {
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const messagesCount = currentMessagesCount
|
|
53
|
+
const bytesCount = currentBytesCount
|
|
54
|
+
|
|
55
|
+
currentMessagesCount = 0
|
|
56
|
+
currentBytesCount = 0
|
|
57
|
+
cancelDurationLimitTimeout()
|
|
58
|
+
|
|
59
|
+
flushObservable.notify({
|
|
60
|
+
reason: flushReason,
|
|
61
|
+
messagesCount,
|
|
62
|
+
bytesCount,
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let durationLimitTimeoutId: TimeoutId | undefined
|
|
67
|
+
function scheduleDurationLimitTimeout() {
|
|
68
|
+
if (durationLimitTimeoutId === undefined) {
|
|
69
|
+
durationLimitTimeoutId = setTimeout(() => {
|
|
70
|
+
flush('duration_limit')
|
|
71
|
+
}, durationLimit)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function cancelDurationLimitTimeout() {
|
|
76
|
+
clearTimeout(durationLimitTimeoutId)
|
|
77
|
+
durationLimitTimeoutId = undefined
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
flushObservable,
|
|
82
|
+
get messagesCount() {
|
|
83
|
+
return currentMessagesCount
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Notifies that a message will be added to a pool of pending messages waiting to be flushed.
|
|
88
|
+
*
|
|
89
|
+
* This function needs to be called synchronously, right before adding the message, so no flush
|
|
90
|
+
* event can happen after `notifyBeforeAddMessage` and before adding the message.
|
|
91
|
+
*
|
|
92
|
+
* @param estimatedMessageBytesCount - an estimation of the message bytes count once it is
|
|
93
|
+
* actually added.
|
|
94
|
+
*/
|
|
95
|
+
notifyBeforeAddMessage(estimatedMessageBytesCount: number) {
|
|
96
|
+
if (currentBytesCount + estimatedMessageBytesCount >= bytesLimit) {
|
|
97
|
+
flush('bytes_limit')
|
|
98
|
+
}
|
|
99
|
+
// Consider the message to be added now rather than in `notifyAfterAddMessage`, because if no
|
|
100
|
+
// message was added yet and `notifyAfterAddMessage` is called asynchronously, we still want
|
|
101
|
+
// to notify when a flush is needed (for example on page exit).
|
|
102
|
+
currentMessagesCount += 1
|
|
103
|
+
currentBytesCount += estimatedMessageBytesCount
|
|
104
|
+
scheduleDurationLimitTimeout()
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Notifies that a message *was* added to a pool of pending messages waiting to be flushed.
|
|
109
|
+
*
|
|
110
|
+
* This function can be called asynchronously after the message was added, but in this case it
|
|
111
|
+
* should not be called if a flush event occurred in between.
|
|
112
|
+
*
|
|
113
|
+
* @param messageBytesCountDiff - the difference between the estimated message bytes count and
|
|
114
|
+
* its actual bytes count once added to the pool.
|
|
115
|
+
*/
|
|
116
|
+
notifyAfterAddMessage(messageBytesCountDiff = 0) {
|
|
117
|
+
currentBytesCount += messageBytesCountDiff
|
|
118
|
+
|
|
119
|
+
if (currentMessagesCount >= messagesLimit) {
|
|
120
|
+
flush('messages_limit')
|
|
121
|
+
} else if (currentBytesCount >= bytesLimit) {
|
|
122
|
+
flush('bytes_limit')
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Notifies that a message was removed from a pool of pending messages waiting to be flushed.
|
|
128
|
+
*
|
|
129
|
+
* This function needs to be called synchronously, right after removing the message, so no flush
|
|
130
|
+
* event can happen after removing the message and before `notifyAfterRemoveMessage`.
|
|
131
|
+
*
|
|
132
|
+
* @param messageBytesCount - the message bytes count that was added to the pool. Should
|
|
133
|
+
* correspond to the sum of bytes counts passed to `notifyBeforeAddMessage` and
|
|
134
|
+
* `notifyAfterAddMessage`.
|
|
135
|
+
*/
|
|
136
|
+
notifyAfterRemoveMessage(messageBytesCount: number) {
|
|
137
|
+
currentBytesCount -= messageBytesCount
|
|
138
|
+
currentMessagesCount -= 1
|
|
139
|
+
if (currentMessagesCount === 0) {
|
|
140
|
+
cancelDurationLimitTimeout()
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type { EndpointBuilder } from '../domain/configuration'
|
|
2
|
+
import type { Context } from '../tools/serialisation/context'
|
|
3
|
+
import { monitor, monitorError } from '../tools/monitor'
|
|
4
|
+
import type { RawError } from '../domain/error/error.types'
|
|
5
|
+
import { Observable } from '../tools/observable'
|
|
6
|
+
import { newRetryState, sendWithRetryStrategy } from './sendWithRetryStrategy'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Use POST request without content type to:
|
|
10
|
+
* - avoid CORS preflight requests
|
|
11
|
+
* - allow usage of sendBeacon
|
|
12
|
+
*
|
|
13
|
+
* multiple elements are sent separated by \n in order
|
|
14
|
+
* to be parsed correctly without content type header
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export interface HttpRequest<Body extends Payload = Payload> {
|
|
18
|
+
observable: Observable<HttpRequestEvent<Body>>
|
|
19
|
+
send(this: void, payload: Body): void
|
|
20
|
+
sendOnExit(this: void, payload: Body): void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface HttpResponse extends Context {
|
|
24
|
+
status: number
|
|
25
|
+
type?: ResponseType
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface BandwidthStats {
|
|
29
|
+
ongoingByteCount: number
|
|
30
|
+
ongoingRequestCount: number
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type HttpRequestEvent<Body extends Payload = Payload> =
|
|
34
|
+
| {
|
|
35
|
+
// A request to send the given payload failed. (We may retry.)
|
|
36
|
+
type: 'failure'
|
|
37
|
+
bandwidth: BandwidthStats
|
|
38
|
+
payload: Body
|
|
39
|
+
}
|
|
40
|
+
| {
|
|
41
|
+
// The given payload was discarded because the request queue is full.
|
|
42
|
+
type: 'queue-full'
|
|
43
|
+
bandwidth: BandwidthStats
|
|
44
|
+
payload: Body
|
|
45
|
+
}
|
|
46
|
+
| {
|
|
47
|
+
// A request to send the given payload succeeded.
|
|
48
|
+
type: 'success'
|
|
49
|
+
bandwidth: BandwidthStats
|
|
50
|
+
payload: Body
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface Payload {
|
|
54
|
+
data: string | FormData | Blob
|
|
55
|
+
bytesCount: number
|
|
56
|
+
retry?: RetryInfo
|
|
57
|
+
encoding?: 'deflate'
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface RetryInfo {
|
|
61
|
+
count: number
|
|
62
|
+
lastFailureStatus: number
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function createHttpRequest<Body extends Payload = Payload>(
|
|
66
|
+
endpointBuilders: EndpointBuilder[],
|
|
67
|
+
bytesLimit: number,
|
|
68
|
+
reportError: (error: RawError) => void
|
|
69
|
+
): HttpRequest<Body> {
|
|
70
|
+
const observable = new Observable<HttpRequestEvent<Body>>()
|
|
71
|
+
const retryState = newRetryState<Body>()
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
observable,
|
|
75
|
+
send: (payload: Body) => {
|
|
76
|
+
for (const endpointBuilder of endpointBuilders) {
|
|
77
|
+
sendWithRetryStrategy(
|
|
78
|
+
payload,
|
|
79
|
+
retryState,
|
|
80
|
+
(payload, onResponse) => fetchKeepAliveStrategy(endpointBuilder, bytesLimit, payload, onResponse),
|
|
81
|
+
endpointBuilder.trackType,
|
|
82
|
+
reportError,
|
|
83
|
+
observable
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* Since fetch keepalive behaves like regular fetch on Firefox,
|
|
89
|
+
* keep using sendBeaconStrategy on exit
|
|
90
|
+
*/
|
|
91
|
+
sendOnExit: (payload: Body) => {
|
|
92
|
+
for (const endpointBuilder of endpointBuilders) {
|
|
93
|
+
sendBeaconStrategy(endpointBuilder, bytesLimit, payload)
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function sendBeaconStrategy(endpointBuilder: EndpointBuilder, bytesLimit: number, payload: Payload) {
|
|
100
|
+
const canUseBeacon = !!navigator.sendBeacon && payload.bytesCount < bytesLimit
|
|
101
|
+
if (canUseBeacon) {
|
|
102
|
+
try {
|
|
103
|
+
const beaconUrl = endpointBuilder.build('beacon', payload)
|
|
104
|
+
const isQueued = navigator.sendBeacon(beaconUrl, payload.data)
|
|
105
|
+
|
|
106
|
+
if (isQueued) {
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
} catch (e) {
|
|
110
|
+
reportBeaconError(e)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
fetchStrategy(endpointBuilder, payload)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
let hasReportedBeaconError = false
|
|
118
|
+
|
|
119
|
+
function reportBeaconError(e: unknown) {
|
|
120
|
+
if (!hasReportedBeaconError) {
|
|
121
|
+
hasReportedBeaconError = true
|
|
122
|
+
monitorError(e)
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function fetchKeepAliveStrategy(
|
|
127
|
+
endpointBuilder: EndpointBuilder,
|
|
128
|
+
bytesLimit: number,
|
|
129
|
+
payload: Payload,
|
|
130
|
+
onResponse?: (r: HttpResponse) => void
|
|
131
|
+
) {
|
|
132
|
+
const canUseKeepAlive = isKeepAliveSupported() && payload.bytesCount < bytesLimit
|
|
133
|
+
|
|
134
|
+
if (canUseKeepAlive) {
|
|
135
|
+
const fetchUrl = endpointBuilder.build('fetch-keepalive', payload)
|
|
136
|
+
|
|
137
|
+
fetch(fetchUrl, { method: 'POST', body: payload.data, keepalive: true, mode: 'cors' })
|
|
138
|
+
.then(monitor((response: Response) => onResponse?.({ status: response.status, type: response.type })))
|
|
139
|
+
.catch(monitor(() => fetchStrategy(endpointBuilder, payload, onResponse)))
|
|
140
|
+
} else {
|
|
141
|
+
fetchStrategy(endpointBuilder, payload, onResponse)
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function fetchStrategy(
|
|
146
|
+
endpointBuilder: EndpointBuilder,
|
|
147
|
+
payload: Payload,
|
|
148
|
+
onResponse?: (r: HttpResponse) => void
|
|
149
|
+
) {
|
|
150
|
+
const fetchUrl = endpointBuilder.build('fetch', payload)
|
|
151
|
+
|
|
152
|
+
fetch(fetchUrl, { method: 'POST', body: payload.data, mode: 'cors' })
|
|
153
|
+
.then(monitor((response: Response) => onResponse?.({ status: response.status, type: response.type })))
|
|
154
|
+
.catch(monitor(() => onResponse?.({ status: 0 })))
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function isKeepAliveSupported() {
|
|
158
|
+
// Request can throw, cf https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#errors
|
|
159
|
+
try {
|
|
160
|
+
return window.Request && 'keepalive' in new Request('http://a')
|
|
161
|
+
} catch {
|
|
162
|
+
return false
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { BandwidthStats, HttpRequest, HttpRequestEvent, Payload, RetryInfo } from './httpRequest'
|
|
2
|
+
export { createHttpRequest } from './httpRequest'
|
|
3
|
+
export type { BrowserWindowWithEventBridge, DatadogEventBridge } from './eventBridge'
|
|
4
|
+
export { canUseEventBridge, bridgeSupports, getEventBridge, BridgeCapability } from './eventBridge'
|
|
5
|
+
export { createBatch } from './batch'
|
|
6
|
+
export type { FlushController, FlushEvent, FlushReason } from './flushController'
|
|
7
|
+
export { createFlushController } from './flushController'
|