@openobserve/browser-core 0.3.3 → 0.4.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cjs/boot/displayAlreadyInitializedError.js +6 -7
- package/cjs/boot/displayAlreadyInitializedError.js.map +1 -1
- package/cjs/boot/init.js +26 -34
- package/cjs/boot/init.js.map +1 -1
- package/cjs/browser/addEventListener.d.ts +10 -8
- package/cjs/browser/addEventListener.js +107 -50
- package/cjs/browser/addEventListener.js.map +1 -1
- package/cjs/browser/browser.types.d.ts +91 -4
- package/cjs/browser/cookie.d.ts +0 -1
- package/cjs/browser/cookie.js +65 -92
- package/cjs/browser/cookie.js.map +1 -1
- package/cjs/browser/cookieAccess.d.ts +16 -0
- package/cjs/browser/cookieAccess.js +114 -0
- package/cjs/browser/cookieAccess.js.map +1 -0
- package/cjs/browser/fetch.d.ts +9 -0
- package/cjs/browser/fetch.js +18 -0
- package/cjs/browser/fetch.js.map +1 -0
- package/cjs/browser/fetchObservable.d.ts +3 -3
- package/cjs/browser/fetchObservable.js +80 -92
- package/cjs/browser/fetchObservable.js.map +1 -1
- package/cjs/browser/pageMayExitObservable.d.ts +1 -2
- package/cjs/browser/pageMayExitObservable.js +41 -40
- package/cjs/browser/pageMayExitObservable.js.map +1 -1
- package/cjs/browser/runOnReadyState.d.ts +2 -3
- package/cjs/browser/runOnReadyState.js +18 -17
- package/cjs/browser/runOnReadyState.js.map +1 -1
- package/cjs/browser/xhrObservable.d.ts +8 -3
- package/cjs/browser/xhrObservable.js +65 -77
- package/cjs/browser/xhrObservable.js.map +1 -1
- package/cjs/domain/allowedTrackingOrigins.d.ts +1 -1
- package/cjs/domain/allowedTrackingOrigins.js +25 -23
- package/cjs/domain/allowedTrackingOrigins.js.map +1 -1
- package/cjs/domain/bufferedData.d.ts +20 -6
- package/cjs/domain/bufferedData.js +41 -19
- package/cjs/domain/bufferedData.js.map +1 -1
- package/cjs/domain/configuration/configuration.d.ts +44 -43
- package/cjs/domain/configuration/configuration.js +122 -125
- package/cjs/domain/configuration/configuration.js.map +1 -1
- package/cjs/domain/configuration/endpointBuilder.d.ts +42 -7
- package/cjs/domain/configuration/endpointBuilder.js +67 -74
- package/cjs/domain/configuration/endpointBuilder.js.map +1 -1
- package/cjs/domain/configuration/index.d.ts +2 -3
- package/cjs/domain/connectivity/connectivity.d.ts +1 -7
- package/cjs/domain/connectivity/connectivity.js +11 -11
- package/cjs/domain/connectivity/connectivity.js.map +1 -1
- package/cjs/domain/console/consoleObservable.d.ts +1 -1
- package/cjs/domain/console/consoleObservable.js +59 -74
- package/cjs/domain/console/consoleObservable.js.map +1 -1
- package/cjs/domain/context/contextConstants.js +24 -15
- package/cjs/domain/context/contextConstants.js.map +1 -1
- package/cjs/domain/context/contextManager.js +49 -54
- package/cjs/domain/context/contextManager.js.map +1 -1
- package/cjs/domain/context/contextUtils.js +11 -12
- package/cjs/domain/context/contextUtils.js.map +1 -1
- package/cjs/domain/context/defineContextMethod.d.ts +2 -2
- package/cjs/domain/context/defineContextMethod.js +15 -16
- package/cjs/domain/context/defineContextMethod.js.map +1 -1
- package/cjs/domain/context/storeContextManager.d.ts +1 -2
- package/cjs/domain/context/storeContextManager.js +30 -33
- package/cjs/domain/context/storeContextManager.js.map +1 -1
- package/cjs/domain/contexts/accountContext.d.ts +2 -2
- package/cjs/domain/contexts/accountContext.js +26 -29
- package/cjs/domain/contexts/accountContext.js.map +1 -1
- package/cjs/domain/contexts/globalContext.d.ts +2 -2
- package/cjs/domain/contexts/globalContext.js +17 -17
- package/cjs/domain/contexts/globalContext.js.map +1 -1
- package/cjs/domain/contexts/tabContext.d.ts +4 -0
- package/cjs/domain/contexts/tabContext.js +27 -0
- package/cjs/domain/contexts/tabContext.js.map +1 -0
- package/cjs/domain/contexts/telemetrySessionContext.d.ts +4 -0
- package/cjs/domain/contexts/telemetrySessionContext.js +17 -0
- package/cjs/domain/contexts/telemetrySessionContext.js.map +1 -0
- package/cjs/domain/contexts/userContext.d.ts +8 -3
- package/cjs/domain/contexts/userContext.js +29 -41
- package/cjs/domain/contexts/userContext.js.map +1 -1
- package/cjs/domain/deflate/deflate.types.js +11 -2
- package/cjs/domain/deflate/deflate.types.js.map +1 -1
- package/cjs/domain/error/error.d.ts +1 -1
- package/cjs/domain/error/error.js +62 -60
- package/cjs/domain/error/error.js.map +1 -1
- package/cjs/domain/error/error.types.d.ts +1 -1
- package/cjs/domain/error/error.types.js +24 -11
- package/cjs/domain/error/error.types.js.map +1 -1
- package/cjs/domain/error/trackRuntimeError.d.ts +3 -2
- package/cjs/domain/error/trackRuntimeError.js +41 -41
- package/cjs/domain/error/trackRuntimeError.js.map +1 -1
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js +33 -38
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -1
- package/cjs/domain/extension/extensionUtils.js +18 -25
- package/cjs/domain/extension/extensionUtils.js.map +1 -1
- package/cjs/domain/intakeSites.d.ts +3 -3
- package/cjs/domain/intakeSites.js +23 -10
- package/cjs/domain/intakeSites.js.map +1 -1
- package/cjs/domain/report/reportObservable.d.ts +1 -2
- package/cjs/domain/report/reportObservable.js +73 -85
- package/cjs/domain/report/reportObservable.js.map +1 -1
- package/cjs/domain/resourceUtils.js +19 -17
- package/cjs/domain/resourceUtils.js.map +1 -1
- package/cjs/domain/sampler.d.ts +11 -0
- package/cjs/domain/sampler.js +40 -0
- package/cjs/domain/sampler.js.map +1 -0
- package/cjs/domain/session/sessionConstants.d.ts +1 -0
- package/cjs/domain/session/sessionConstants.js +19 -13
- package/cjs/domain/session/sessionConstants.js.map +1 -1
- package/cjs/domain/session/sessionManager.d.ts +13 -13
- package/cjs/domain/session/sessionManager.js +219 -193
- package/cjs/domain/session/sessionManager.js.map +1 -1
- package/cjs/domain/session/sessionState.d.ts +10 -1
- package/cjs/domain/session/sessionState.js +70 -55
- package/cjs/domain/session/sessionState.js.map +1 -1
- package/cjs/domain/session/sessionStateValidation.js +7 -8
- package/cjs/domain/session/sessionStateValidation.js.map +1 -1
- package/cjs/domain/session/sessionStore.d.ts +4 -33
- package/cjs/domain/session/sessionStore.js +42 -180
- package/cjs/domain/session/sessionStore.js.map +1 -1
- package/cjs/domain/session/storeStrategies/sessionInCookie.d.ts +7 -11
- package/cjs/domain/session/storeStrategies/sessionInCookie.js +89 -95
- package/cjs/domain/session/storeStrategies/sessionInCookie.js.map +1 -1
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.d.ts +1 -4
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js +39 -38
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -1
- package/cjs/domain/session/storeStrategies/sessionInMemory.d.ts +12 -0
- package/cjs/domain/session/storeStrategies/sessionInMemory.js +35 -0
- package/cjs/domain/session/storeStrategies/sessionInMemory.js.map +1 -0
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.d.ts +16 -7
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js +7 -4
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js.map +1 -1
- package/cjs/domain/synthetics/syntheticsWorkerValues.d.ts +9 -3
- package/cjs/domain/synthetics/syntheticsWorkerValues.js +33 -25
- package/cjs/domain/synthetics/syntheticsWorkerValues.js.map +1 -1
- package/cjs/domain/tags.d.ts +0 -1
- package/cjs/domain/tags.js +22 -58
- package/cjs/domain/tags.js.map +1 -1
- package/cjs/domain/telemetry/rawTelemetryEvent.types.js +8 -7
- package/cjs/domain/telemetry/rawTelemetryEvent.types.js.map +1 -1
- package/cjs/domain/telemetry/telemetry.d.ts +8 -8
- package/cjs/domain/telemetry/telemetry.js +196 -211
- package/cjs/domain/telemetry/telemetry.js.map +1 -1
- package/cjs/domain/telemetry/telemetryEvent.types.d.ts +97 -17
- package/cjs/domain/trackingConsent.d.ts +1 -0
- package/cjs/domain/trackingConsent.js +35 -24
- package/cjs/domain/trackingConsent.js.map +1 -1
- package/cjs/index.d.ts +25 -22
- package/cjs/index.js +281 -194
- package/cjs/tools/abstractLifeCycle.js +19 -26
- package/cjs/tools/abstractLifeCycle.js.map +1 -1
- package/cjs/tools/catchUserErrors.js +12 -12
- package/cjs/tools/catchUserErrors.js.map +1 -1
- package/cjs/tools/display.d.ts +1 -35
- package/cjs/tools/display.js +11 -43
- package/cjs/tools/display.js.map +1 -1
- package/cjs/tools/encoder.js +36 -37
- package/cjs/tools/encoder.js.map +1 -1
- package/cjs/tools/experimentalFeatures.d.ts +1 -4
- package/cjs/tools/experimentalFeatures.js +29 -40
- package/cjs/tools/experimentalFeatures.js.map +1 -1
- package/cjs/tools/getZoneJsOriginalValue.d.ts +1 -1
- package/cjs/tools/getZoneJsOriginalValue.js +22 -25
- package/cjs/tools/getZoneJsOriginalValue.js.map +1 -1
- package/cjs/tools/globalObject.d.ts +16 -15
- package/cjs/tools/globalObject.js +7 -43
- package/cjs/tools/globalObject.js.map +1 -1
- package/cjs/tools/instrumentMethod.d.ts +58 -1
- package/cjs/tools/instrumentMethod.js +174 -112
- package/cjs/tools/instrumentMethod.js.map +1 -1
- package/cjs/tools/matchOption.js +25 -29
- package/cjs/tools/matchOption.js.map +1 -1
- package/cjs/tools/mockable.d.ts +22 -0
- package/cjs/tools/mockable.js +28 -0
- package/cjs/tools/mockable.js.map +1 -0
- package/cjs/tools/monitor.d.ts +5 -7
- package/cjs/tools/monitor.js +13 -58
- package/cjs/tools/monitor.js.map +1 -1
- package/cjs/tools/observable.d.ts +3 -1
- package/cjs/tools/observable.js +75 -85
- package/cjs/tools/observable.js.map +1 -1
- package/cjs/tools/queueMicrotask.js +9 -14
- package/cjs/tools/queueMicrotask.js.map +1 -1
- package/cjs/tools/readBytesFromStream.d.ts +1 -6
- package/cjs/tools/readBytesFromStream.js +18 -25
- package/cjs/tools/readBytesFromStream.js.map +1 -1
- package/cjs/tools/requestIdleCallback.js +22 -29
- package/cjs/tools/requestIdleCallback.js.map +1 -1
- package/cjs/tools/sendToExtension.js +10 -8
- package/cjs/tools/sendToExtension.js.map +1 -1
- package/cjs/tools/serialisation/jsonStringify.js +37 -42
- package/cjs/tools/serialisation/jsonStringify.js.map +1 -1
- package/cjs/tools/serialisation/sanitize.d.ts +1 -0
- package/cjs/tools/serialisation/sanitize.js +111 -167
- package/cjs/tools/serialisation/sanitize.js.map +1 -1
- package/cjs/tools/serialisation/stringify.d.ts +2 -0
- package/cjs/tools/serialisation/stringify.js +18 -0
- package/cjs/tools/serialisation/stringify.js.map +1 -0
- package/cjs/tools/stackTrace/computeStackTrace.js +121 -159
- package/cjs/tools/stackTrace/computeStackTrace.js.map +1 -1
- package/cjs/tools/stackTrace/handlingStack.d.ts +1 -1
- package/cjs/tools/stackTrace/handlingStack.js +39 -38
- package/cjs/tools/stackTrace/handlingStack.js.map +1 -1
- package/cjs/tools/taskQueue.js +40 -49
- package/cjs/tools/taskQueue.js.map +1 -1
- package/cjs/tools/timer.d.ts +2 -1
- package/cjs/tools/timer.js +14 -13
- package/cjs/tools/timer.js.map +1 -1
- package/cjs/tools/utils/arrayUtils.d.ts +1 -0
- package/cjs/tools/utils/arrayUtils.js +17 -13
- package/cjs/tools/utils/arrayUtils.js.map +1 -1
- package/cjs/tools/utils/browserDetection.d.ts +1 -0
- package/cjs/tools/utils/browserDetection.js +25 -23
- package/cjs/tools/utils/browserDetection.js.map +1 -1
- package/cjs/tools/utils/byteUtils.js +20 -28
- package/cjs/tools/utils/byteUtils.js.map +1 -1
- package/cjs/tools/utils/functionUtils.js +33 -40
- package/cjs/tools/utils/functionUtils.js.map +1 -1
- package/cjs/tools/utils/numberUtils.js +15 -14
- package/cjs/tools/utils/numberUtils.js.map +1 -1
- package/cjs/tools/utils/objectUtils.d.ts +2 -0
- package/cjs/tools/utils/objectUtils.js +27 -14
- package/cjs/tools/utils/objectUtils.js.map +1 -1
- package/cjs/tools/utils/polyfills.js +12 -16
- package/cjs/tools/utils/polyfills.js.map +1 -1
- package/cjs/tools/utils/responseUtils.js +11 -12
- package/cjs/tools/utils/responseUtils.js.map +1 -1
- package/cjs/tools/utils/stringUtils.js +56 -77
- package/cjs/tools/utils/stringUtils.js.map +1 -1
- package/cjs/tools/utils/timezone.js +9 -10
- package/cjs/tools/utils/timezone.js.map +1 -1
- package/cjs/tools/utils/urlPolyfill.js +42 -46
- package/cjs/tools/utils/urlPolyfill.js.map +1 -1
- package/cjs/tools/valueHistory.d.ts +9 -1
- package/cjs/tools/valueHistory.js +110 -99
- package/cjs/tools/valueHistory.js.map +1 -1
- package/cjs/transport/batch.js +73 -106
- package/cjs/transport/batch.js.map +1 -1
- package/cjs/transport/eventBridge.d.ts +6 -2
- package/cjs/transport/eventBridge.js +53 -38
- package/cjs/transport/eventBridge.js.map +1 -1
- package/cjs/transport/flushController.d.ts +2 -12
- package/cjs/transport/flushController.js +98 -117
- package/cjs/transport/flushController.js.map +1 -1
- package/cjs/transport/httpRequest.d.ts +0 -1
- package/cjs/transport/httpRequest.js +51 -85
- package/cjs/transport/httpRequest.js.map +1 -1
- package/cjs/transport/index.d.ts +1 -0
- package/cjs/transport/sendWithRetryStrategy.js +133 -146
- package/cjs/transport/sendWithRetryStrategy.js.map +1 -1
- package/esm/boot/displayAlreadyInitializedError.mjs +9 -0
- package/esm/boot/displayAlreadyInitializedError.mjs.map +1 -0
- package/esm/boot/init.mjs +30 -0
- package/esm/boot/init.mjs.map +1 -0
- package/esm/browser/addEventListener.mjs +107 -0
- package/esm/browser/addEventListener.mjs.map +1 -0
- package/esm/browser/cookie.mjs +81 -0
- package/esm/browser/cookie.mjs.map +1 -0
- package/esm/browser/cookieAccess.mjs +111 -0
- package/esm/browser/cookieAccess.mjs.map +1 -0
- package/esm/browser/fetch.mjs +18 -0
- package/esm/browser/fetch.mjs.map +1 -0
- package/esm/browser/fetchObservable.mjs +90 -0
- package/esm/browser/fetchObservable.mjs.map +1 -0
- package/esm/browser/pageMayExitObservable.mjs +44 -0
- package/esm/browser/pageMayExitObservable.mjs.map +1 -0
- package/esm/browser/runOnReadyState.mjs +19 -0
- package/esm/browser/runOnReadyState.mjs.map +1 -0
- package/esm/browser/xhrObservable.mjs +74 -0
- package/esm/browser/xhrObservable.mjs.map +1 -0
- package/esm/domain/allowedTrackingOrigins.mjs +27 -0
- package/esm/domain/allowedTrackingOrigins.mjs.map +1 -0
- package/esm/domain/bufferedData.mjs +43 -0
- package/esm/domain/bufferedData.mjs.map +1 -0
- package/esm/domain/configuration/configuration.mjs +131 -0
- package/esm/domain/configuration/configuration.mjs.map +1 -0
- package/esm/domain/configuration/endpointBuilder.mjs +72 -0
- package/esm/domain/configuration/endpointBuilder.mjs.map +1 -0
- package/esm/domain/connectivity/connectivity.mjs +14 -0
- package/esm/domain/connectivity/connectivity.mjs.map +1 -0
- package/esm/domain/console/consoleObservable.mjs +69 -0
- package/esm/domain/console/consoleObservable.mjs.map +1 -0
- package/esm/domain/context/contextConstants.mjs +25 -0
- package/esm/domain/context/contextConstants.mjs.map +1 -0
- package/esm/domain/context/contextManager.mjs +55 -0
- package/esm/domain/context/contextManager.mjs.map +1 -0
- package/esm/domain/context/contextUtils.mjs +15 -0
- package/esm/domain/context/contextUtils.mjs.map +1 -0
- package/esm/domain/context/defineContextMethod.mjs +19 -0
- package/esm/domain/context/defineContextMethod.mjs.map +1 -0
- package/esm/domain/context/storeContextManager.mjs +36 -0
- package/esm/domain/context/storeContextManager.mjs.map +1 -0
- package/esm/domain/contexts/accountContext.mjs +29 -0
- package/esm/domain/contexts/accountContext.mjs.map +1 -0
- package/esm/domain/contexts/globalContext.mjs +20 -0
- package/esm/domain/contexts/globalContext.mjs.map +1 -0
- package/esm/domain/contexts/tabContext.mjs +27 -0
- package/esm/domain/contexts/tabContext.mjs.map +1 -0
- package/esm/domain/contexts/telemetrySessionContext.mjs +17 -0
- package/esm/domain/contexts/telemetrySessionContext.mjs.map +1 -0
- package/esm/domain/contexts/userContext.mjs +32 -0
- package/esm/domain/contexts/userContext.mjs.map +1 -0
- package/esm/domain/deflate/deflate.types.mjs +12 -0
- package/esm/domain/deflate/deflate.types.mjs.map +1 -0
- package/esm/domain/error/error.mjs +73 -0
- package/esm/domain/error/error.mjs.map +1 -0
- package/esm/domain/error/error.types.mjs +24 -0
- package/esm/domain/error/error.types.mjs.map +1 -0
- package/esm/domain/error/trackRuntimeError.mjs +48 -0
- package/esm/domain/error/trackRuntimeError.mjs.map +1 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.mjs +36 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.mjs.map +1 -0
- package/esm/domain/extension/extensionUtils.mjs +23 -0
- package/esm/domain/extension/extensionUtils.mjs.map +1 -0
- package/esm/domain/intakeSites.mjs +18 -0
- package/esm/domain/intakeSites.mjs.map +1 -0
- package/esm/domain/report/reportObservable.mjs +86 -0
- package/esm/domain/report/reportObservable.mjs.map +1 -0
- package/esm/domain/resourceUtils.mjs +21 -0
- package/esm/domain/resourceUtils.mjs.map +1 -0
- package/esm/domain/sampler.mjs +37 -0
- package/esm/domain/sampler.mjs.map +1 -0
- package/esm/domain/session/sessionConstants.mjs +18 -0
- package/esm/domain/session/sessionConstants.mjs.map +1 -0
- package/esm/domain/session/sessionManager.mjs +225 -0
- package/esm/domain/session/sessionManager.mjs.map +1 -0
- package/esm/domain/session/sessionState.mjs +76 -0
- package/esm/domain/session/sessionState.mjs.map +1 -0
- package/esm/domain/session/sessionStateValidation.mjs +9 -0
- package/esm/domain/session/sessionStateValidation.mjs.map +1 -0
- package/esm/domain/session/sessionStore.mjs +46 -0
- package/esm/domain/session/sessionStore.mjs.map +1 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.mjs +97 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.mjs.map +1 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.mjs +42 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.mjs.map +1 -0
- package/esm/domain/session/storeStrategies/sessionInMemory.mjs +33 -0
- package/esm/domain/session/storeStrategies/sessionInMemory.mjs.map +1 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.mjs +7 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.mjs.map +1 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.mjs +37 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.mjs.map +1 -0
- package/esm/domain/tags.mjs +28 -0
- package/esm/domain/tags.mjs.map +1 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.mjs +10 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.mjs.map +1 -0
- package/esm/domain/telemetry/telemetry.mjs +219 -0
- package/esm/domain/telemetry/telemetry.mjs.map +1 -0
- package/esm/domain/trackingConsent.mjs +38 -0
- package/esm/domain/trackingConsent.mjs.map +1 -0
- package/esm/index.mjs +81 -0
- package/esm/tools/abstractLifeCycle.mjs +21 -0
- package/esm/tools/abstractLifeCycle.mjs.map +1 -0
- package/esm/tools/catchUserErrors.mjs +15 -0
- package/esm/tools/catchUserErrors.mjs.map +1 -0
- package/esm/tools/display.mjs +10 -0
- package/esm/tools/display.mjs.map +1 -0
- package/esm/tools/encoder.mjs +39 -0
- package/esm/tools/encoder.mjs.map +1 -0
- package/esm/tools/experimentalFeatures.mjs +35 -0
- package/esm/tools/experimentalFeatures.mjs.map +1 -0
- package/esm/tools/getZoneJsOriginalValue.mjs +26 -0
- package/esm/tools/getZoneJsOriginalValue.mjs.map +1 -0
- package/esm/tools/globalObject.mjs +7 -0
- package/esm/tools/globalObject.mjs.map +1 -0
- package/esm/tools/instrumentMethod.mjs +178 -0
- package/esm/tools/instrumentMethod.mjs.map +1 -0
- package/esm/tools/matchOption.mjs +30 -0
- package/esm/tools/matchOption.mjs.map +1 -0
- package/esm/tools/mockable.mjs +28 -0
- package/esm/tools/mockable.mjs.map +1 -0
- package/esm/tools/monitor.mjs +13 -0
- package/esm/tools/monitor.mjs.map +1 -0
- package/esm/tools/observable.mjs +77 -0
- package/esm/tools/observable.mjs.map +1 -0
- package/esm/tools/queueMicrotask.mjs +12 -0
- package/esm/tools/queueMicrotask.mjs.map +1 -0
- package/esm/tools/readBytesFromStream.mjs +21 -0
- package/esm/tools/readBytesFromStream.mjs.map +1 -0
- package/esm/tools/requestIdleCallback.mjs +28 -0
- package/esm/tools/requestIdleCallback.mjs.map +1 -0
- package/esm/tools/sendToExtension.mjs +13 -0
- package/esm/tools/sendToExtension.mjs.map +1 -0
- package/esm/tools/serialisation/jsonStringify.mjs +42 -0
- package/esm/tools/serialisation/jsonStringify.mjs.map +1 -0
- package/esm/tools/serialisation/sanitize.mjs +131 -0
- package/esm/tools/serialisation/sanitize.mjs.map +1 -0
- package/esm/tools/serialisation/stringify.mjs +17 -0
- package/esm/tools/serialisation/stringify.mjs.map +1 -0
- package/esm/tools/stackTrace/computeStackTrace.mjs +148 -0
- package/esm/tools/stackTrace/computeStackTrace.mjs.map +1 -0
- package/esm/tools/stackTrace/handlingStack.mjs +45 -0
- package/esm/tools/stackTrace/handlingStack.mjs.map +1 -0
- package/esm/tools/taskQueue.mjs +45 -0
- package/esm/tools/taskQueue.mjs.map +1 -0
- package/esm/tools/timer.mjs +20 -0
- package/esm/tools/timer.mjs.map +1 -0
- package/esm/tools/utils/arrayUtils.mjs +21 -0
- package/esm/tools/utils/arrayUtils.mjs.map +1 -0
- package/esm/tools/utils/browserDetection.mjs +31 -0
- package/esm/tools/utils/browserDetection.mjs.map +1 -0
- package/esm/tools/utils/byteUtils.mjs +23 -0
- package/esm/tools/utils/byteUtils.mjs.map +1 -0
- package/esm/tools/utils/functionUtils.mjs +35 -0
- package/esm/tools/utils/functionUtils.mjs.map +1 -0
- package/esm/tools/utils/numberUtils.mjs +22 -0
- package/esm/tools/utils/numberUtils.mjs.map +1 -0
- package/esm/tools/utils/objectUtils.mjs +31 -0
- package/esm/tools/utils/objectUtils.mjs.map +1 -0
- package/esm/tools/utils/polyfills.mjs +17 -0
- package/esm/tools/utils/polyfills.mjs.map +1 -0
- package/esm/tools/utils/responseUtils.mjs +15 -0
- package/esm/tools/utils/responseUtils.mjs.map +1 -0
- package/esm/tools/utils/stringUtils.mjs +66 -0
- package/esm/tools/utils/stringUtils.mjs.map +1 -0
- package/esm/tools/utils/timezone.mjs +12 -0
- package/esm/tools/utils/timezone.mjs.map +1 -0
- package/esm/tools/utils/urlPolyfill.mjs +51 -0
- package/esm/tools/utils/urlPolyfill.mjs.map +1 -0
- package/esm/tools/valueHistory.mjs +114 -0
- package/esm/tools/valueHistory.mjs.map +1 -0
- package/esm/transport/batch.mjs +77 -0
- package/esm/transport/batch.mjs.map +1 -0
- package/esm/transport/eventBridge.mjs +58 -0
- package/esm/transport/eventBridge.mjs.map +1 -0
- package/esm/transport/flushController.mjs +104 -0
- package/esm/transport/flushController.mjs.map +1 -0
- package/esm/transport/httpRequest.mjs +60 -0
- package/esm/transport/httpRequest.mjs.map +1 -0
- package/esm/transport/sendWithRetryStrategy.mjs +149 -0
- package/esm/transport/sendWithRetryStrategy.mjs.map +1 -0
- package/package.json +16 -5
- package/src/boot/init.ts +2 -2
- package/src/browser/addEventListener.ts +37 -5
- package/src/browser/browser.types.ts +127 -13
- package/src/browser/cookie.ts +21 -27
- package/src/browser/cookieAccess.ts +150 -0
- package/src/browser/fetch.ts +14 -0
- package/src/browser/fetchObservable.ts +22 -22
- package/src/browser/pageMayExitObservable.ts +7 -4
- package/src/browser/runOnReadyState.ts +3 -8
- package/src/browser/xhrObservable.ts +22 -12
- package/src/domain/allowedTrackingOrigins.ts +5 -5
- package/src/domain/bufferedData.ts +41 -14
- package/src/domain/configuration/configuration.ts +87 -72
- package/src/domain/configuration/endpointBuilder.ts +82 -52
- package/src/domain/configuration/index.ts +2 -2
- package/src/domain/connectivity/connectivity.ts +3 -15
- package/src/domain/console/consoleObservable.ts +3 -3
- package/src/domain/context/contextManager.ts +1 -1
- package/src/domain/context/contextUtils.ts +1 -1
- package/src/domain/context/defineContextMethod.ts +3 -3
- package/src/domain/context/storeContextManager.ts +9 -6
- package/src/domain/contexts/accountContext.ts +5 -5
- package/src/domain/contexts/globalContext.ts +4 -5
- package/src/domain/contexts/tabContext.ts +43 -0
- package/src/domain/contexts/telemetrySessionContext.ts +26 -0
- package/src/domain/contexts/userContext.ts +7 -11
- package/src/domain/error/error.ts +53 -23
- package/src/domain/error/error.types.ts +1 -1
- package/src/domain/error/trackRuntimeError.ts +11 -4
- package/src/domain/eventRateLimiter/createEventRateLimiter.ts +1 -1
- package/src/domain/intakeSites.ts +8 -3
- package/src/domain/report/reportObservable.ts +11 -7
- package/src/domain/sampler.ts +64 -0
- package/src/domain/session/sessionConstants.ts +2 -1
- package/src/domain/session/sessionManager.ts +281 -176
- package/src/domain/session/sessionState.ts +64 -8
- package/src/domain/session/sessionStore.ts +57 -223
- package/src/domain/session/storeStrategies/sessionInCookie.ts +121 -107
- package/src/domain/session/storeStrategies/sessionInLocalStorage.ts +33 -21
- package/src/domain/session/storeStrategies/sessionInMemory.ts +55 -0
- package/src/domain/session/storeStrategies/sessionStoreStrategy.ts +28 -6
- package/src/domain/synthetics/syntheticsWorkerValues.ts +44 -13
- package/src/domain/tags.ts +0 -16
- package/src/domain/telemetry/telemetry.ts +38 -34
- package/src/domain/telemetry/telemetryEvent.types.ts +116 -20
- package/src/domain/trackingConsent.ts +18 -3
- package/src/index.ts +51 -31
- package/src/tools/display.ts +2 -50
- package/src/tools/experimentalFeatures.ts +1 -4
- package/src/tools/getZoneJsOriginalValue.ts +3 -3
- package/src/tools/globalObject.ts +27 -41
- package/src/tools/instrumentMethod.ts +230 -20
- package/src/tools/matchOption.ts +3 -1
- package/src/tools/mockable.ts +32 -0
- package/src/tools/monitor.ts +14 -62
- package/src/tools/observable.ts +9 -1
- package/src/tools/queueMicrotask.ts +6 -1
- package/src/tools/readBytesFromStream.ts +3 -12
- package/src/tools/requestIdleCallback.ts +1 -1
- package/src/tools/serialisation/sanitize.ts +67 -65
- package/src/tools/serialisation/stringify.ts +18 -0
- package/src/tools/stackTrace/computeStackTrace.ts +15 -13
- package/src/tools/stackTrace/handlingStack.ts +14 -1
- package/src/tools/taskQueue.ts +5 -3
- package/src/tools/timer.ts +7 -6
- package/src/tools/utils/arrayUtils.ts +7 -0
- package/src/tools/utils/browserDetection.ts +8 -0
- package/src/tools/utils/byteUtils.ts +1 -5
- package/src/tools/utils/functionUtils.ts +2 -2
- package/src/tools/utils/objectUtils.ts +20 -0
- package/src/tools/utils/stringUtils.ts +4 -1
- package/src/tools/utils/urlPolyfill.ts +5 -4
- package/src/tools/valueHistory.ts +39 -6
- package/src/transport/batch.ts +9 -18
- package/src/transport/eventBridge.ts +23 -10
- package/src/transport/flushController.ts +17 -24
- package/src/transport/httpRequest.ts +4 -36
- package/src/transport/index.ts +1 -0
- package/src/transport/sendWithRetryStrategy.ts +1 -1
- package/cjs/browser/browser.types.js +0 -6
- package/cjs/browser/browser.types.js.map +0 -1
- package/cjs/domain/configuration/index.js +0 -16
- package/cjs/domain/configuration/index.js.map +0 -1
- package/cjs/domain/configuration/transportConfiguration.d.ts +0 -20
- package/cjs/domain/configuration/transportConfiguration.js +0 -54
- package/cjs/domain/configuration/transportConfiguration.js.map +0 -1
- package/cjs/domain/connectivity/index.js +0 -18
- package/cjs/domain/connectivity/index.js.map +0 -1
- package/cjs/domain/contexts/rumInternalContext.type.js +0 -3
- package/cjs/domain/contexts/rumInternalContext.type.js.map +0 -1
- package/cjs/domain/deflate/index.js +0 -18
- package/cjs/domain/deflate/index.js.map +0 -1
- package/cjs/domain/report/browser.types.js +0 -3
- package/cjs/domain/report/browser.types.js.map +0 -1
- package/cjs/domain/session/oldCookiesMigration.d.ts +0 -11
- package/cjs/domain/session/oldCookiesMigration.js +0 -40
- package/cjs/domain/session/oldCookiesMigration.js.map +0 -1
- package/cjs/domain/session/sessionStoreOperations.d.ts +0 -12
- package/cjs/domain/session/sessionStoreOperations.js +0 -119
- package/cjs/domain/session/sessionStoreOperations.js.map +0 -1
- package/cjs/domain/telemetry/index.js +0 -28
- package/cjs/domain/telemetry/index.js.map +0 -1
- package/cjs/domain/telemetry/telemetryEvent.types.js +0 -7
- package/cjs/domain/telemetry/telemetryEvent.types.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/tools/abstractHooks.d.ts +0 -24
- package/cjs/tools/abstractHooks.js +0 -41
- package/cjs/tools/abstractHooks.js.map +0 -1
- package/cjs/tools/boundedBuffer.d.ts +0 -16
- package/cjs/tools/boundedBuffer.js +0 -32
- package/cjs/tools/boundedBuffer.js.map +0 -1
- package/cjs/tools/mergeInto.d.ts +0 -25
- package/cjs/tools/mergeInto.js +0 -98
- package/cjs/tools/mergeInto.js.map +0 -1
- package/cjs/tools/serialisation/context.js +0 -3
- package/cjs/tools/serialisation/context.js.map +0 -1
- package/cjs/tools/utils/timeUtils.d.ts +0 -53
- package/cjs/tools/utils/timeUtils.js +0 -101
- package/cjs/tools/utils/timeUtils.js.map +0 -1
- package/cjs/tools/utils/typeUtils.d.ts +0 -4
- package/cjs/tools/utils/typeUtils.js +0 -16
- package/cjs/tools/utils/typeUtils.js.map +0 -1
- package/cjs/transport/index.js +0 -15
- package/cjs/transport/index.js.map +0 -1
- package/esm/boot/displayAlreadyInitializedError.d.ts +0 -2
- package/esm/boot/displayAlreadyInitializedError.js +0 -7
- package/esm/boot/displayAlreadyInitializedError.js.map +0 -1
- package/esm/boot/init.d.ts +0 -14
- package/esm/boot/init.js +0 -35
- package/esm/boot/init.js.map +0 -1
- package/esm/browser/addEventListener.d.ts +0 -87
- package/esm/browser/addEventListener.js +0 -51
- package/esm/browser/addEventListener.js.map +0 -1
- package/esm/browser/browser.types.d.ts +0 -51
- package/esm/browser/browser.types.js +0 -5
- package/esm/browser/browser.types.js.map +0 -1
- package/esm/browser/cookie.d.ts +0 -28
- package/esm/browser/cookie.js +0 -103
- package/esm/browser/cookie.js.map +0 -1
- package/esm/browser/fetchObservable.d.ts +0 -38
- package/esm/browser/fetchObservable.js +0 -99
- package/esm/browser/fetchObservable.js.map +0 -1
- package/esm/browser/pageMayExitObservable.d.ts +0 -14
- package/esm/browser/pageMayExitObservable.js +0 -40
- package/esm/browser/pageMayExitObservable.js.map +0 -1
- package/esm/browser/runOnReadyState.d.ts +0 -5
- package/esm/browser/runOnReadyState.js +0 -16
- package/esm/browser/runOnReadyState.js.map +0 -1
- package/esm/browser/xhrObservable.d.ts +0 -24
- package/esm/browser/xhrObservable.js +0 -83
- package/esm/browser/xhrObservable.js.map +0 -1
- package/esm/domain/allowedTrackingOrigins.d.ts +0 -4
- package/esm/domain/allowedTrackingOrigins.js +0 -21
- package/esm/domain/allowedTrackingOrigins.js.map +0 -1
- package/esm/domain/bufferedData.d.ts +0 -14
- package/esm/domain/bufferedData.js +0 -19
- package/esm/domain/bufferedData.js.map +0 -1
- package/esm/domain/configuration/configuration.d.ts +0 -312
- package/esm/domain/configuration/configuration.js +0 -132
- package/esm/domain/configuration/configuration.js.map +0 -1
- package/esm/domain/configuration/endpointBuilder.d.ts +0 -12
- package/esm/domain/configuration/endpointBuilder.js +0 -77
- package/esm/domain/configuration/endpointBuilder.js.map +0 -1
- package/esm/domain/configuration/index.d.ts +0 -5
- package/esm/domain/configuration/index.js +0 -4
- package/esm/domain/configuration/index.js.map +0 -1
- package/esm/domain/configuration/transportConfiguration.d.ts +0 -20
- package/esm/domain/configuration/transportConfiguration.js +0 -50
- package/esm/domain/configuration/transportConfiguration.js.map +0 -1
- package/esm/domain/connectivity/connectivity.d.ts +0 -14
- package/esm/domain/connectivity/connectivity.js +0 -11
- package/esm/domain/connectivity/connectivity.js.map +0 -1
- package/esm/domain/connectivity/index.d.ts +0 -1
- package/esm/domain/connectivity/index.js +0 -2
- package/esm/domain/connectivity/index.js.map +0 -1
- package/esm/domain/console/consoleObservable.d.ts +0 -21
- package/esm/domain/console/consoleObservable.js +0 -80
- package/esm/domain/console/consoleObservable.js.map +0 -1
- package/esm/domain/context/contextConstants.d.ts +0 -21
- package/esm/domain/context/contextConstants.js +0 -15
- package/esm/domain/context/contextConstants.js.map +0 -1
- package/esm/domain/context/contextManager.d.ts +0 -19
- package/esm/domain/context/contextManager.js +0 -57
- package/esm/domain/context/contextManager.js.map +0 -1
- package/esm/domain/context/contextUtils.d.ts +0 -5
- package/esm/domain/context/contextUtils.js +0 -13
- package/esm/domain/context/contextUtils.js.map +0 -1
- package/esm/domain/context/defineContextMethod.d.ts +0 -6
- package/esm/domain/context/defineContextMethod.js +0 -17
- package/esm/domain/context/defineContextMethod.js.map +0 -1
- package/esm/domain/context/storeContextManager.d.ts +0 -6
- package/esm/domain/context/storeContextManager.js +0 -35
- package/esm/domain/context/storeContextManager.js.map +0 -1
- package/esm/domain/contexts/accountContext.d.ts +0 -26
- package/esm/domain/contexts/accountContext.js +0 -29
- package/esm/domain/contexts/accountContext.js.map +0 -1
- package/esm/domain/contexts/globalContext.d.ts +0 -18
- package/esm/domain/contexts/globalContext.js +0 -17
- package/esm/domain/contexts/globalContext.js.map +0 -1
- package/esm/domain/contexts/rumInternalContext.type.d.ts +0 -14
- package/esm/domain/contexts/rumInternalContext.type.js +0 -2
- package/esm/domain/contexts/rumInternalContext.type.js.map +0 -1
- package/esm/domain/contexts/userContext.d.ts +0 -29
- package/esm/domain/contexts/userContext.js +0 -41
- package/esm/domain/contexts/userContext.js.map +0 -1
- package/esm/domain/deflate/deflate.types.d.ts +0 -40
- package/esm/domain/deflate/deflate.types.js +0 -2
- package/esm/domain/deflate/deflate.types.js.map +0 -1
- package/esm/domain/deflate/index.d.ts +0 -1
- package/esm/domain/deflate/index.js +0 -2
- package/esm/domain/deflate/index.js.map +0 -1
- package/esm/domain/error/error.d.ts +0 -23
- package/esm/domain/error/error.js +0 -65
- package/esm/domain/error/error.js.map +0 -1
- package/esm/domain/error/error.types.d.ts +0 -47
- package/esm/domain/error/error.types.js +0 -10
- package/esm/domain/error/error.types.js.map +0 -1
- package/esm/domain/error/trackRuntimeError.d.ts +0 -11
- package/esm/domain/error/trackRuntimeError.js +0 -43
- package/esm/domain/error/trackRuntimeError.js.map +0 -1
- package/esm/domain/eventRateLimiter/createEventRateLimiter.d.ts +0 -5
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js +0 -38
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js.map +0 -1
- package/esm/domain/extension/extensionUtils.d.ts +0 -10
- package/esm/domain/extension/extensionUtils.js +0 -25
- package/esm/domain/extension/extensionUtils.js.map +0 -1
- package/esm/domain/intakeSites.d.ts +0 -8
- package/esm/domain/intakeSites.js +0 -8
- package/esm/domain/intakeSites.js.map +0 -1
- package/esm/domain/report/browser.types.d.ts +0 -34
- package/esm/domain/report/browser.types.js +0 -2
- package/esm/domain/report/browser.types.js.map +0 -1
- package/esm/domain/report/reportObservable.d.ts +0 -14
- package/esm/domain/report/reportObservable.js +0 -95
- package/esm/domain/report/reportObservable.js.map +0 -1
- package/esm/domain/resourceUtils.d.ts +0 -18
- package/esm/domain/resourceUtils.js +0 -17
- package/esm/domain/resourceUtils.js.map +0 -1
- package/esm/domain/session/oldCookiesMigration.d.ts +0 -11
- package/esm/domain/session/oldCookiesMigration.js +0 -36
- package/esm/domain/session/oldCookiesMigration.js.map +0 -1
- package/esm/domain/session/sessionConstants.d.ts +0 -15
- package/esm/domain/session/sessionConstants.js +0 -13
- package/esm/domain/session/sessionConstants.js.map +0 -1
- package/esm/domain/session/sessionManager.d.ts +0 -28
- package/esm/domain/session/sessionManager.js +0 -196
- package/esm/domain/session/sessionManager.js.map +0 -1
- package/esm/domain/session/sessionState.d.ts +0 -16
- package/esm/domain/session/sessionState.js +0 -60
- package/esm/domain/session/sessionState.js.map +0 -1
- package/esm/domain/session/sessionStateValidation.d.ts +0 -3
- package/esm/domain/session/sessionStateValidation.js +0 -7
- package/esm/domain/session/sessionStateValidation.js.map +0 -1
- package/esm/domain/session/sessionStore.d.ts +0 -38
- package/esm/domain/session/sessionStore.js +0 -179
- package/esm/domain/session/sessionStore.js.map +0 -1
- package/esm/domain/session/sessionStoreOperations.d.ts +0 -12
- package/esm/domain/session/sessionStoreOperations.js +0 -114
- package/esm/domain/session/sessionStoreOperations.js.map +0 -1
- package/esm/domain/session/storeStrategies/sessionInCookie.d.ts +0 -12
- package/esm/domain/session/storeStrategies/sessionInCookie.js +0 -98
- package/esm/domain/session/storeStrategies/sessionInCookie.js.map +0 -1
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.d.ts +0 -6
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js +0 -37
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js.map +0 -1
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.d.ts +0 -16
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.js +0 -2
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.js.map +0 -1
- package/esm/domain/synthetics/syntheticsWorkerValues.d.ts +0 -12
- package/esm/domain/synthetics/syntheticsWorkerValues.js +0 -24
- package/esm/domain/synthetics/syntheticsWorkerValues.js.map +0 -1
- package/esm/domain/tags.d.ts +0 -6
- package/esm/domain/tags.js +0 -60
- package/esm/domain/tags.js.map +0 -1
- package/esm/domain/telemetry/index.d.ts +0 -4
- package/esm/domain/telemetry/index.js +0 -3
- package/esm/domain/telemetry/index.js.map +0 -1
- package/esm/domain/telemetry/rawTelemetryEvent.types.d.ts +0 -18
- package/esm/domain/telemetry/rawTelemetryEvent.types.js +0 -6
- package/esm/domain/telemetry/rawTelemetryEvent.types.js.map +0 -1
- package/esm/domain/telemetry/telemetry.d.ts +0 -56
- package/esm/domain/telemetry/telemetry.js +0 -228
- package/esm/domain/telemetry/telemetry.js.map +0 -1
- package/esm/domain/telemetry/telemetryEvent.types.d.ts +0 -866
- package/esm/domain/telemetry/telemetryEvent.types.js +0 -6
- package/esm/domain/telemetry/telemetryEvent.types.js.map +0 -1
- package/esm/domain/trackingConsent.d.ts +0 -13
- package/esm/domain/trackingConsent.js +0 -24
- package/esm/domain/trackingConsent.js.map +0 -1
- package/esm/index.d.ts +0 -100
- package/esm/index.js +0 -76
- package/esm/index.js.map +0 -1
- package/esm/tools/abstractHooks.d.ts +0 -24
- package/esm/tools/abstractHooks.js +0 -37
- package/esm/tools/abstractHooks.js.map +0 -1
- package/esm/tools/abstractLifeCycle.d.ts +0 -23
- package/esm/tools/abstractLifeCycle.js +0 -24
- package/esm/tools/abstractLifeCycle.js.map +0 -1
- package/esm/tools/boundedBuffer.d.ts +0 -16
- package/esm/tools/boundedBuffer.js +0 -29
- package/esm/tools/boundedBuffer.js.map +0 -1
- package/esm/tools/catchUserErrors.d.ts +0 -1
- package/esm/tools/catchUserErrors.js +0 -12
- package/esm/tools/catchUserErrors.js.map +0 -1
- package/esm/tools/display.d.ts +0 -38
- package/esm/tools/display.js +0 -41
- package/esm/tools/display.js.map +0 -1
- package/esm/tools/encoder.d.ts +0 -54
- package/esm/tools/encoder.js +0 -37
- package/esm/tools/encoder.js.map +0 -1
- package/esm/tools/experimentalFeatures.d.ts +0 -21
- package/esm/tools/experimentalFeatures.js +0 -42
- package/esm/tools/experimentalFeatures.js.map +0 -1
- package/esm/tools/getZoneJsOriginalValue.d.ts +0 -19
- package/esm/tools/getZoneJsOriginalValue.js +0 -26
- package/esm/tools/getZoneJsOriginalValue.js.map +0 -1
- package/esm/tools/globalObject.d.ts +0 -19
- package/esm/tools/globalObject.js +0 -40
- package/esm/tools/globalObject.js.map +0 -1
- package/esm/tools/instrumentMethod.d.ts +0 -75
- package/esm/tools/instrumentMethod.js +0 -114
- package/esm/tools/instrumentMethod.js.map +0 -1
- package/esm/tools/matchOption.d.ts +0 -8
- package/esm/tools/matchOption.js +0 -31
- package/esm/tools/matchOption.js.map +0 -1
- package/esm/tools/mergeInto.d.ts +0 -25
- package/esm/tools/mergeInto.js +0 -93
- package/esm/tools/mergeInto.js.map +0 -1
- package/esm/tools/monitor.d.ts +0 -9
- package/esm/tools/monitor.js +0 -52
- package/esm/tools/monitor.js.map +0 -1
- package/esm/tools/observable.d.ts +0 -30
- package/esm/tools/observable.js +0 -83
- package/esm/tools/observable.js.map +0 -1
- package/esm/tools/queueMicrotask.d.ts +0 -1
- package/esm/tools/queueMicrotask.js +0 -14
- package/esm/tools/queueMicrotask.js.map +0 -1
- package/esm/tools/readBytesFromStream.d.ts +0 -10
- package/esm/tools/readBytesFromStream.js +0 -25
- package/esm/tools/readBytesFromStream.js.map +0 -1
- package/esm/tools/requestIdleCallback.d.ts +0 -12
- package/esm/tools/requestIdleCallback.js +0 -30
- package/esm/tools/requestIdleCallback.js.map +0 -1
- package/esm/tools/sendToExtension.d.ts +0 -3
- package/esm/tools/sendToExtension.js +0 -8
- package/esm/tools/sendToExtension.js.map +0 -1
- package/esm/tools/serialisation/context.d.ts +0 -9
- package/esm/tools/serialisation/context.js +0 -2
- package/esm/tools/serialisation/context.js.map +0 -1
- package/esm/tools/serialisation/jsonStringify.d.ts +0 -13
- package/esm/tools/serialisation/jsonStringify.js +0 -44
- package/esm/tools/serialisation/jsonStringify.js.map +0 -1
- package/esm/tools/serialisation/sanitize.d.ts +0 -18
- package/esm/tools/serialisation/sanitize.js +0 -185
- package/esm/tools/serialisation/sanitize.js.map +0 -1
- package/esm/tools/stackTrace/computeStackTrace.d.ts +0 -25
- package/esm/tools/stackTrace/computeStackTrace.js +0 -183
- package/esm/tools/stackTrace/computeStackTrace.js.map +0 -1
- package/esm/tools/stackTrace/handlingStack.d.ts +0 -10
- package/esm/tools/stackTrace/handlingStack.js +0 -41
- package/esm/tools/stackTrace/handlingStack.js.map +0 -1
- package/esm/tools/taskQueue.d.ts +0 -15
- package/esm/tools/taskQueue.js +0 -50
- package/esm/tools/taskQueue.js.map +0 -1
- package/esm/tools/timer.d.ts +0 -5
- package/esm/tools/timer.js +0 -16
- package/esm/tools/timer.js.map +0 -1
- package/esm/tools/utils/arrayUtils.d.ts +0 -3
- package/esm/tools/utils/arrayUtils.js +0 -15
- package/esm/tools/utils/arrayUtils.js.map +0 -1
- package/esm/tools/utils/browserDetection.d.ts +0 -8
- package/esm/tools/utils/browserDetection.js +0 -28
- package/esm/tools/utils/browserDetection.js.map +0 -1
- package/esm/tools/utils/byteUtils.d.ts +0 -8
- package/esm/tools/utils/byteUtils.js +0 -29
- package/esm/tools/utils/byteUtils.js.map +0 -1
- package/esm/tools/utils/functionUtils.d.ts +0 -8
- package/esm/tools/utils/functionUtils.js +0 -39
- package/esm/tools/utils/functionUtils.js.map +0 -1
- package/esm/tools/utils/numberUtils.d.ts +0 -9
- package/esm/tools/utils/numberUtils.js +0 -18
- package/esm/tools/utils/numberUtils.js.map +0 -1
- package/esm/tools/utils/objectUtils.d.ts +0 -10
- package/esm/tools/utils/objectUtils.js +0 -17
- package/esm/tools/utils/objectUtils.js.map +0 -1
- package/esm/tools/utils/polyfills.d.ts +0 -7
- package/esm/tools/utils/polyfills.js +0 -18
- package/esm/tools/utils/polyfills.js.map +0 -1
- package/esm/tools/utils/responseUtils.d.ts +0 -2
- package/esm/tools/utils/responseUtils.js +0 -13
- package/esm/tools/utils/responseUtils.js.map +0 -1
- package/esm/tools/utils/stringUtils.d.ts +0 -23
- package/esm/tools/utils/stringUtils.js +0 -84
- package/esm/tools/utils/stringUtils.js.map +0 -1
- package/esm/tools/utils/timeUtils.d.ts +0 -53
- package/esm/tools/utils/timeUtils.js +0 -84
- package/esm/tools/utils/timeUtils.js.map +0 -1
- package/esm/tools/utils/timezone.d.ts +0 -1
- package/esm/tools/utils/timezone.js +0 -10
- package/esm/tools/utils/timezone.js.map +0 -1
- package/esm/tools/utils/typeUtils.d.ts +0 -4
- package/esm/tools/utils/typeUtils.js +0 -13
- package/esm/tools/utils/typeUtils.js.map +0 -1
- package/esm/tools/utils/urlPolyfill.d.ts +0 -5
- package/esm/tools/utils/urlPolyfill.js +0 -52
- package/esm/tools/utils/urlPolyfill.js.map +0 -1
- package/esm/tools/valueHistory.d.ts +0 -27
- package/esm/tools/valueHistory.js +0 -100
- package/esm/tools/valueHistory.js.map +0 -1
- package/esm/transport/batch.d.ts +0 -16
- package/esm/transport/batch.js +0 -106
- package/esm/transport/batch.js.map +0 -1
- package/esm/transport/eventBridge.d.ts +0 -21
- package/esm/transport/eventBridge.js +0 -41
- package/esm/transport/eventBridge.js.map +0 -1
- package/esm/transport/flushController.d.ts +0 -65
- package/esm/transport/flushController.js +0 -119
- package/esm/transport/flushController.js.map +0 -1
- package/esm/transport/httpRequest.d.ts +0 -56
- package/esm/transport/httpRequest.js +0 -89
- package/esm/transport/httpRequest.js.map +0 -1
- package/esm/transport/index.d.ts +0 -7
- package/esm/transport/index.js +0 -5
- package/esm/transport/index.js.map +0 -1
- package/esm/transport/sendWithRetryStrategy.d.ts +0 -41
- package/esm/transport/sendWithRetryStrategy.js +0 -158
- package/esm/transport/sendWithRetryStrategy.js.map +0 -1
- package/src/domain/configuration/transportConfiguration.ts +0 -78
- package/src/domain/session/oldCookiesMigration.ts +0 -42
- package/src/domain/session/sessionStoreOperations.ts +0 -131
- package/src/tools/abstractHooks.ts +0 -72
- package/src/tools/boundedBuffer.ts +0 -45
- package/src/tools/mergeInto.ts +0 -177
- package/src/tools/utils/timeUtils.ts +0 -117
- package/src/tools/utils/typeUtils.ts +0 -12
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/domain/session/storeStrategies/sessionStoreStrategy.ts
|
|
2
|
+
const SESSION_STORE_KEY = "_oo_s_v2";
|
|
3
|
+
const LEGACY_SESSION_STORE_KEY = "_oo_s";
|
|
4
|
+
//#endregion
|
|
5
|
+
export { LEGACY_SESSION_STORE_KEY, SESSION_STORE_KEY };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=sessionStoreStrategy.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionStoreStrategy.mjs","names":[],"sources":["../../../../src/domain/session/storeStrategies/sessionStoreStrategy.ts"],"sourcesContent":["import type { CookieOptions } from '../../../browser/cookie'\nimport type { SessionPersistence } from '../sessionConstants'\nimport type { SessionState } from '../sessionState'\nimport type { Observable } from '../../../tools/observable'\n\nexport const SESSION_STORE_KEY = '_oo_s_v2'\nexport const LEGACY_SESSION_STORE_KEY = '_oo_s'\n\nexport const enum CookieApi {\n DOCUMENT_COOKIE,\n COOKIE_STORE,\n}\n\nexport interface CookieSessionStoreStrategyType {\n type: typeof SessionPersistence.COOKIE\n cookieOptions: CookieOptions\n cookieApi: CookieApi\n}\n\nexport type SessionStoreStrategyType =\n | CookieSessionStoreStrategyType\n | { type: typeof SessionPersistence.LOCAL_STORAGE }\n | { type: typeof SessionPersistence.MEMORY }\n\nexport type SessionStateOperation =\n | 'initialize'\n | 'expandOrRenewOnActivity'\n | 'expandOrRenewOnConsent'\n | 'expandOnVisibility'\n | 'initializeOnResume'\n | 'expireOnTimeout'\n | 'expire'\n | 'updateState'\n\nexport interface SessionStoreStrategy {\n setSessionState(fn: (sessionState: SessionState) => SessionState, operation: SessionStateOperation): Promise<void>\n sessionObservable: Observable<SessionState>\n}\n"],"mappings":";AAKA,MAAa,oBAAoB;AACjC,MAAa,2BAA2B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { tryJsonParse } from "../../tools/utils/objectUtils.mjs";
|
|
2
|
+
import { globalObject, isWorkerEnvironment } from "../../tools/globalObject.mjs";
|
|
3
|
+
import { getInitCookie } from "../../browser/cookie.mjs";
|
|
4
|
+
//#region src/domain/synthetics/syntheticsWorkerValues.ts
|
|
5
|
+
const cookieNamePrefix = "openobserve-synthetics-";
|
|
6
|
+
const SYNTHETICS_TEST_ID_COOKIE_NAME = `${cookieNamePrefix}public-id`;
|
|
7
|
+
const SYNTHETICS_RESULT_ID_COOKIE_NAME = `${cookieNamePrefix}result-id`;
|
|
8
|
+
const SYNTHETICS_INJECTS_RUM_COOKIE_NAME = `${cookieNamePrefix}injects-rum`;
|
|
9
|
+
const SYNTHETICS_CONTEXT_COOKIE_NAME = `${cookieNamePrefix}rum-context`;
|
|
10
|
+
function willSyntheticsInjectRum() {
|
|
11
|
+
if (isWorkerEnvironment) return false;
|
|
12
|
+
return Boolean(globalObject._OO_SYNTHETICS_INJECTS_RUM || getInitCookie(SYNTHETICS_INJECTS_RUM_COOKIE_NAME));
|
|
13
|
+
}
|
|
14
|
+
function getSyntheticsContext() {
|
|
15
|
+
const raw = getRawSyntheticsContext();
|
|
16
|
+
return isValidSyntheticsContext(raw) ? raw : void 0;
|
|
17
|
+
}
|
|
18
|
+
function isSyntheticsTest() {
|
|
19
|
+
return Boolean(getSyntheticsContext());
|
|
20
|
+
}
|
|
21
|
+
function getRawSyntheticsContext() {
|
|
22
|
+
const rawGlobal = globalObject._OO_SYNTHETICS_RUM_CONTEXT;
|
|
23
|
+
if (rawGlobal) return rawGlobal;
|
|
24
|
+
const rawCookie = getInitCookie(SYNTHETICS_CONTEXT_COOKIE_NAME);
|
|
25
|
+
if (rawCookie) return tryJsonParse(decodeURIComponent(rawCookie));
|
|
26
|
+
return {
|
|
27
|
+
test_id: window._OO_SYNTHETICS_PUBLIC_ID || getInitCookie(SYNTHETICS_TEST_ID_COOKIE_NAME),
|
|
28
|
+
result_id: window._OO_SYNTHETICS_RESULT_ID || getInitCookie(SYNTHETICS_RESULT_ID_COOKIE_NAME)
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function isValidSyntheticsContext(value) {
|
|
32
|
+
return typeof value === "object" && value !== null && typeof value.test_id === "string" && typeof value.result_id === "string";
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { getSyntheticsContext, isSyntheticsTest, willSyntheticsInjectRum };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=syntheticsWorkerValues.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syntheticsWorkerValues.mjs","names":[],"sources":["../../../src/domain/synthetics/syntheticsWorkerValues.ts"],"sourcesContent":["import { getInitCookie } from '../../browser/cookie'\nimport { globalObject, isWorkerEnvironment } from '../../tools/globalObject'\nimport { tryJsonParse } from '../../tools/utils/objectUtils'\n\nconst cookieNamePrefix = 'openobserve-synthetics-'\nexport const SYNTHETICS_TEST_ID_COOKIE_NAME = `${cookieNamePrefix}public-id`\nexport const SYNTHETICS_RESULT_ID_COOKIE_NAME = `${cookieNamePrefix}result-id`\nexport const SYNTHETICS_INJECTS_RUM_COOKIE_NAME = `${cookieNamePrefix}injects-rum`\nexport const SYNTHETICS_CONTEXT_COOKIE_NAME = `${cookieNamePrefix}rum-context`\n\nexport interface BrowserWindow {\n _OO_SYNTHETICS_PUBLIC_ID?: unknown\n _OO_SYNTHETICS_RESULT_ID?: unknown\n _OO_SYNTHETICS_INJECTS_RUM?: unknown\n _OO_SYNTHETICS_RUM_CONTEXT?: unknown\n}\n\nexport interface SyntheticsContext {\n test_id: string\n result_id: string\n [key: string]: unknown\n}\n\nexport function willSyntheticsInjectRum(): boolean {\n if (isWorkerEnvironment) {\n // We don't expect to run synthetics tests in a worker environment\n return false\n }\n\n return Boolean(\n (globalObject as BrowserWindow)._OO_SYNTHETICS_INJECTS_RUM || getInitCookie(SYNTHETICS_INJECTS_RUM_COOKIE_NAME)\n )\n}\n\nexport function getSyntheticsContext(): SyntheticsContext | undefined {\n const raw = getRawSyntheticsContext()\n return isValidSyntheticsContext(raw) ? raw : undefined\n}\n\nexport function isSyntheticsTest(): boolean {\n return Boolean(getSyntheticsContext())\n}\n\nfunction getRawSyntheticsContext(): unknown {\n const rawGlobal = (globalObject as BrowserWindow)._OO_SYNTHETICS_RUM_CONTEXT\n if (rawGlobal) {\n return rawGlobal\n }\n\n const rawCookie = getInitCookie(SYNTHETICS_CONTEXT_COOKIE_NAME)\n if (rawCookie) {\n return tryJsonParse(decodeURIComponent(rawCookie))\n }\n\n return {\n test_id: (window as BrowserWindow)._OO_SYNTHETICS_PUBLIC_ID || getInitCookie(SYNTHETICS_TEST_ID_COOKIE_NAME),\n result_id:\n (window as BrowserWindow)._OO_SYNTHETICS_RESULT_ID || getInitCookie(SYNTHETICS_RESULT_ID_COOKIE_NAME),\n }\n}\n\nfunction isValidSyntheticsContext(value: unknown): value is SyntheticsContext {\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as Record<string, unknown>).test_id === 'string' &&\n typeof (value as Record<string, unknown>).result_id === 'string'\n )\n}\n"],"mappings":";;;;AAIA,MAAM,mBAAmB;AACzB,MAAa,iCAAiC,GAAG,iBAAiB;AAClE,MAAa,mCAAmC,GAAG,iBAAiB;AACpE,MAAa,qCAAqC,GAAG,iBAAiB;AACtE,MAAa,iCAAiC,GAAG,iBAAiB;AAelE,SAAgB,0BAAmC;CACjD,IAAI,qBAEF,OAAO;CAGT,OAAO,QACJ,aAA+B,8BAA8B,cAAc,kCAAkC,CAChH;AACF;AAEA,SAAgB,uBAAsD;CACpE,MAAM,MAAM,wBAAwB;CACpC,OAAO,yBAAyB,GAAG,IAAI,MAAM,KAAA;AAC/C;AAEA,SAAgB,mBAA4B;CAC1C,OAAO,QAAQ,qBAAqB,CAAC;AACvC;AAEA,SAAS,0BAAmC;CAC1C,MAAM,YAAa,aAA+B;CAClD,IAAI,WACF,OAAO;CAGT,MAAM,YAAY,cAAc,8BAA8B;CAC9D,IAAI,WACF,OAAO,aAAa,mBAAmB,SAAS,CAAC;CAGnD,OAAO;EACL,SAAU,OAAyB,4BAA4B,cAAc,8BAA8B;EAC3G,WACG,OAAyB,4BAA4B,cAAc,gCAAgC;CACxG;AACF;AAEA,SAAS,yBAAyB,OAA4C;CAC5E,OACE,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAAkC,YAAY,YACtD,OAAQ,MAAkC,cAAc;AAE5D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DOCS_ORIGIN, MORE_DETAILS, display } from "../tools/display.mjs";
|
|
2
|
+
//#region src/domain/tags.ts
|
|
3
|
+
const TAG_SIZE_LIMIT = 200;
|
|
4
|
+
function buildTags(configuration) {
|
|
5
|
+
const { env, service, version, datacenter, sdkVersion, variant } = configuration;
|
|
6
|
+
const tags = [buildTag("sdk_version", sdkVersion ?? "7.4.0")];
|
|
7
|
+
if (env) tags.push(buildTag("env", env));
|
|
8
|
+
if (service) tags.push(buildTag("service", service));
|
|
9
|
+
if (version) tags.push(buildTag("version", version));
|
|
10
|
+
if (datacenter) tags.push(buildTag("datacenter", datacenter));
|
|
11
|
+
if (variant) tags.push(buildTag("variant", variant));
|
|
12
|
+
return tags;
|
|
13
|
+
}
|
|
14
|
+
function buildTag(key, rawValue) {
|
|
15
|
+
const tag = rawValue ? `${key}:${rawValue}` : key;
|
|
16
|
+
if (tag.length > 200 || hasForbiddenCharacters(tag)) display.warn(`Tag ${tag} doesn't meet tag requirements and will be sanitized. ${MORE_DETAILS} ${DOCS_ORIGIN}/getting_started/tagging/#defining-tags`);
|
|
17
|
+
return sanitizeTag(tag);
|
|
18
|
+
}
|
|
19
|
+
function sanitizeTag(tag) {
|
|
20
|
+
return tag.replace(/,/g, "_");
|
|
21
|
+
}
|
|
22
|
+
function hasForbiddenCharacters(rawValue) {
|
|
23
|
+
return (/* @__PURE__ */ new RegExp("[^\\p{Ll}\\p{Lo}0-9_:./-]", "u")).test(rawValue);
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { TAG_SIZE_LIMIT, buildTag, buildTags, sanitizeTag };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=tags.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.mjs","names":[],"sources":["../../src/domain/tags.ts"],"sourcesContent":["import { DOCS_ORIGIN, MORE_DETAILS, display } from '../tools/display'\nimport type { Configuration } from './configuration'\n\nexport const TAG_SIZE_LIMIT = 200\n\n// replaced at build time\ndeclare const __BUILD_ENV__SDK_VERSION__: string\n\nexport function buildTags(configuration: Configuration): string[] {\n const { env, service, version, datacenter, sdkVersion, variant } = configuration\n const tags = [buildTag('sdk_version', sdkVersion ?? __BUILD_ENV__SDK_VERSION__)]\n\n if (env) {\n tags.push(buildTag('env', env))\n }\n if (service) {\n tags.push(buildTag('service', service))\n }\n if (version) {\n tags.push(buildTag('version', version))\n }\n if (datacenter) {\n tags.push(buildTag('datacenter', datacenter))\n }\n\n if (variant) {\n tags.push(buildTag('variant', variant))\n }\n\n return tags\n}\n\nexport function buildTag(key: string, rawValue?: string) {\n // See https://docs.datadoghq.com/getting_started/tagging/#defining-tags for tags syntax. Note\n // that the backend may not follow the exact same rules, so we only want to display an informal\n // warning.\n const tag = rawValue ? `${key}:${rawValue}` : key\n\n if (tag.length > TAG_SIZE_LIMIT || hasForbiddenCharacters(tag)) {\n display.warn(\n `Tag ${tag} doesn't meet tag requirements and will be sanitized. ${MORE_DETAILS} ${DOCS_ORIGIN}/getting_started/tagging/#defining-tags`\n )\n }\n\n // Let the backend do most of the sanitization, but still make sure multiple tags can't be crafted\n // by forging a value containing commas.\n return sanitizeTag(tag)\n}\n\nexport function sanitizeTag(tag: string) {\n return tag.replace(/,/g, '_')\n}\n\nfunction hasForbiddenCharacters(rawValue: string) {\n // We use the Unicode property escapes to match any character that is a letter including other languages like Chinese, Japanese, etc.\n // p{Ll} matches a lowercase letter.\n // p{Lo} matches a letter that is neither uppercase nor lowercase (ex: Japanese characters).\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Unicode_character_class_escape#unicode_property_escapes_vs._character_classes\n return new RegExp('[^\\\\p{Ll}\\\\p{Lo}0-9_:./-]', 'u').test(rawValue)\n}\n"],"mappings":";;AAGA,MAAa,iBAAiB;AAK9B,SAAgB,UAAU,eAAwC;CAChE,MAAM,EAAE,KAAK,SAAS,SAAS,YAAY,YAAY,YAAY;CACnE,MAAM,OAAO,CAAC,SAAS,eAAe,cAAA,OAAwC,CAAC;CAE/E,IAAI,KACF,KAAK,KAAK,SAAS,OAAO,GAAG,CAAC;CAEhC,IAAI,SACF,KAAK,KAAK,SAAS,WAAW,OAAO,CAAC;CAExC,IAAI,SACF,KAAK,KAAK,SAAS,WAAW,OAAO,CAAC;CAExC,IAAI,YACF,KAAK,KAAK,SAAS,cAAc,UAAU,CAAC;CAG9C,IAAI,SACF,KAAK,KAAK,SAAS,WAAW,OAAO,CAAC;CAGxC,OAAO;AACT;AAEA,SAAgB,SAAS,KAAa,UAAmB;CAIvD,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,aAAa;CAE9C,IAAI,IAAI,SAAA,OAA2B,uBAAuB,GAAG,GAC3D,QAAQ,KACN,OAAO,IAAI,wDAAwD,aAAa,GAAG,YAAY,wCACjG;CAKF,OAAO,YAAY,GAAG;AACxB;AAEA,SAAgB,YAAY,KAAa;CACvC,OAAO,IAAI,QAAQ,MAAM,GAAG;AAC9B;AAEA,SAAS,uBAAuB,UAAkB;CAKhD,wBAAO,IAAI,OAAO,6BAA6B,GAAG,EAAA,CAAE,KAAK,QAAQ;AACnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rawTelemetryEvent.types.mjs","names":[],"sources":["../../../src/domain/telemetry/rawTelemetryEvent.types.ts"],"sourcesContent":["import type { TelemetryEvent, TelemetryConfigurationEvent, TelemetryUsageEvent } from './telemetryEvent.types'\n\nexport const TelemetryType = {\n LOG: 'log',\n CONFIGURATION: 'configuration',\n USAGE: 'usage',\n} as const\n\nexport const enum StatusType {\n debug = 'debug',\n error = 'error',\n}\n\nexport interface RuntimeEnvInfo {\n is_local_file: boolean\n is_worker: boolean\n}\n\nexport type RawTelemetryEvent = TelemetryEvent['telemetry']\nexport type RawTelemetryConfiguration = TelemetryConfigurationEvent['telemetry']['configuration']\nexport type RawTelemetryUsage = TelemetryUsageEvent['telemetry']['usage']\nexport type RawTelemetryUsageFeature = TelemetryUsageEvent['telemetry']['usage']['feature']\n"],"mappings":";AAEA,MAAa,gBAAgB;CAC3B,KAAK;CACL,eAAe;CACf,OAAO;AACT"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { display } from "../../tools/display.mjs";
|
|
2
|
+
import { performDraw } from "../../tools/utils/numberUtils.mjs";
|
|
3
|
+
import { globalObject, isWorkerEnvironment } from "../../tools/globalObject.mjs";
|
|
4
|
+
import { startMonitorErrorCollection } from "../../tools/monitor.mjs";
|
|
5
|
+
import { BufferedObservable, Observable } from "../../tools/observable.mjs";
|
|
6
|
+
import { INTAKE_SITE_STAGING, INTAKE_SITE_US1_FED, INTAKE_SITE_US2_FED } from "../intakeSites.mjs";
|
|
7
|
+
import { createEndpointBuilder, createReplicaEndpointBuilder } from "../configuration/endpointBuilder.mjs";
|
|
8
|
+
import { getExperimentalFeatures } from "../../tools/experimentalFeatures.mjs";
|
|
9
|
+
import { noop } from "../../tools/utils/functionUtils.mjs";
|
|
10
|
+
import { computeStackTrace } from "../../tools/stackTrace/computeStackTrace.mjs";
|
|
11
|
+
import { toStackTraceString } from "../../tools/stackTrace/handlingStack.mjs";
|
|
12
|
+
import { jsonStringify } from "../../tools/serialisation/jsonStringify.mjs";
|
|
13
|
+
import { NO_ERROR_STACK_PRESENT_MESSAGE, isError } from "../error/error.mjs";
|
|
14
|
+
import "../error/error.types.mjs";
|
|
15
|
+
import { buildTags } from "../tags.mjs";
|
|
16
|
+
import { sendToExtension } from "../../tools/sendToExtension.mjs";
|
|
17
|
+
import { getConnectivity } from "../connectivity/connectivity.mjs";
|
|
18
|
+
import { createHttpRequest } from "../../transport/httpRequest.mjs";
|
|
19
|
+
import { canUseEventBridge, getEventBridge } from "../../transport/eventBridge.mjs";
|
|
20
|
+
import { createPageMayExitObservable } from "../../browser/pageMayExitObservable.mjs";
|
|
21
|
+
import { createBatch } from "../../transport/batch.mjs";
|
|
22
|
+
import { createFlushController } from "../../transport/flushController.mjs";
|
|
23
|
+
import { createIdentityEncoder } from "../../tools/encoder.mjs";
|
|
24
|
+
import { TelemetryType } from "./rawTelemetryEvent.types.mjs";
|
|
25
|
+
import { combine, getDebugMode } from "@openobserve/js-core/util";
|
|
26
|
+
import { clocksNow } from "@openobserve/js-core/time";
|
|
27
|
+
import { DISCARDED } from "@openobserve/js-core/assembly";
|
|
28
|
+
//#region src/domain/telemetry/telemetry.ts
|
|
29
|
+
const ALLOWED_FRAME_URLS = [
|
|
30
|
+
"https://www.datadoghq-browser-agent.com",
|
|
31
|
+
"https://www.datad0g-browser-agent.com",
|
|
32
|
+
"https://d3uc069fcn7uxw.cloudfront.net",
|
|
33
|
+
"https://d20xtzwzcl0ceb.cloudfront.net",
|
|
34
|
+
"http://localhost",
|
|
35
|
+
"<anonymous>"
|
|
36
|
+
];
|
|
37
|
+
let TelemetryService = /* @__PURE__ */ function(TelemetryService) {
|
|
38
|
+
TelemetryService["LOGS"] = "browser-logs-sdk";
|
|
39
|
+
TelemetryService["RUM"] = "browser-rum-sdk";
|
|
40
|
+
return TelemetryService;
|
|
41
|
+
}({});
|
|
42
|
+
let TelemetryMetrics = /* @__PURE__ */ function(TelemetryMetrics) {
|
|
43
|
+
TelemetryMetrics["CUSTOMER_DATA_METRIC_NAME"] = "Customer data measures";
|
|
44
|
+
TelemetryMetrics["REMOTE_CONFIGURATION_METRIC_NAME"] = "remote configuration metrics";
|
|
45
|
+
TelemetryMetrics["RECORDER_INIT_METRICS_TELEMETRY_NAME"] = "Recorder init metrics";
|
|
46
|
+
TelemetryMetrics["SEGMENT_METRICS_TELEMETRY_NAME"] = "Segment network request metrics";
|
|
47
|
+
TelemetryMetrics["INITIAL_VIEW_METRICS_TELEMETRY_NAME"] = "Initial view metrics";
|
|
48
|
+
TelemetryMetrics["SESSION_MANAGER_INIT_METRICS_TELEMETRY_NAME"] = "Session manager init metrics";
|
|
49
|
+
return TelemetryMetrics;
|
|
50
|
+
}({});
|
|
51
|
+
const METRIC_SAMPLE_RATE = 1;
|
|
52
|
+
const TELEMETRY_EXCLUDED_SITES = [INTAKE_SITE_US1_FED, INTAKE_SITE_US2_FED];
|
|
53
|
+
const MAX_TELEMETRY_EVENTS_PER_PAGE = 15;
|
|
54
|
+
let telemetryObservable;
|
|
55
|
+
function getTelemetryObservable() {
|
|
56
|
+
if (!telemetryObservable) telemetryObservable = new BufferedObservable(100);
|
|
57
|
+
return telemetryObservable;
|
|
58
|
+
}
|
|
59
|
+
function startTelemetry(telemetryService, configuration, hook) {
|
|
60
|
+
const observable = new Observable();
|
|
61
|
+
const { enabled, metricsEnabled } = startTelemetryCollection(telemetryService, configuration, hook, observable);
|
|
62
|
+
const { stop } = startTelemetryTransport(configuration, observable);
|
|
63
|
+
return {
|
|
64
|
+
stop,
|
|
65
|
+
enabled,
|
|
66
|
+
metricsEnabled
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function startTelemetryCollection(telemetryService, configuration, hook, observable, metricSampleRate = METRIC_SAMPLE_RATE, maxTelemetryEventsPerPage = MAX_TELEMETRY_EVENTS_PER_PAGE) {
|
|
70
|
+
const alreadySentEventsByKind = {};
|
|
71
|
+
const telemetryEnabled = !TELEMETRY_EXCLUDED_SITES.includes(configuration.site) && performDraw(configuration.telemetrySampleRate);
|
|
72
|
+
const telemetryEnabledPerType = {
|
|
73
|
+
[TelemetryType.LOG]: telemetryEnabled,
|
|
74
|
+
[TelemetryType.CONFIGURATION]: telemetryEnabled && performDraw(configuration.telemetryConfigurationSampleRate),
|
|
75
|
+
[TelemetryType.USAGE]: telemetryEnabled && performDraw(configuration.telemetryUsageSampleRate),
|
|
76
|
+
metric: telemetryEnabled && performDraw(metricSampleRate)
|
|
77
|
+
};
|
|
78
|
+
const runtimeEnvInfo = getRuntimeEnvInfo();
|
|
79
|
+
const telemetryObservable = getTelemetryObservable();
|
|
80
|
+
telemetryObservable.subscribe(({ rawEvent, metricName }) => {
|
|
81
|
+
if (metricName && !telemetryEnabledPerType["metric"] || !telemetryEnabledPerType[rawEvent.type]) return;
|
|
82
|
+
const kind = metricName || rawEvent.status || rawEvent.type;
|
|
83
|
+
let alreadySentEvents = alreadySentEventsByKind[kind];
|
|
84
|
+
if (!alreadySentEvents) alreadySentEvents = alreadySentEventsByKind[kind] = /* @__PURE__ */ new Set();
|
|
85
|
+
if (alreadySentEvents.size >= maxTelemetryEventsPerPage) return;
|
|
86
|
+
const stringifiedEvent = jsonStringify(rawEvent);
|
|
87
|
+
if (alreadySentEvents.has(stringifiedEvent)) return;
|
|
88
|
+
const defaultTelemetryEventAttributes = hook.trigger({ startTime: clocksNow().relative });
|
|
89
|
+
if (defaultTelemetryEventAttributes === DISCARDED) return;
|
|
90
|
+
const event = toTelemetryEvent(defaultTelemetryEventAttributes, telemetryService, rawEvent, runtimeEnvInfo);
|
|
91
|
+
observable.notify(event);
|
|
92
|
+
sendToExtension("telemetry", event);
|
|
93
|
+
alreadySentEvents.add(stringifiedEvent);
|
|
94
|
+
});
|
|
95
|
+
telemetryObservable.unbuffer();
|
|
96
|
+
startMonitorErrorCollection(addTelemetryError);
|
|
97
|
+
return {
|
|
98
|
+
enabled: telemetryEnabled,
|
|
99
|
+
metricsEnabled: telemetryEnabledPerType["metric"]
|
|
100
|
+
};
|
|
101
|
+
function toTelemetryEvent(defaultTelemetryEventAttributes, telemetryService, rawEvent, runtimeEnvInfo) {
|
|
102
|
+
return combine({
|
|
103
|
+
type: "telemetry",
|
|
104
|
+
date: clocksNow().timeStamp,
|
|
105
|
+
service: telemetryService,
|
|
106
|
+
version: "7.4.0",
|
|
107
|
+
source: "browser",
|
|
108
|
+
_oo: { format_version: 2 },
|
|
109
|
+
telemetry: combine(rawEvent, {
|
|
110
|
+
runtime_env: runtimeEnvInfo,
|
|
111
|
+
connectivity: getConnectivity(),
|
|
112
|
+
sdk_setup: "npm"
|
|
113
|
+
}),
|
|
114
|
+
ootags: buildTags(configuration).join(","),
|
|
115
|
+
experimental_features: Array.from(getExperimentalFeatures())
|
|
116
|
+
}, defaultTelemetryEventAttributes);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function startTelemetryTransport(configuration, telemetryObservable) {
|
|
120
|
+
const cleanupTasks = [];
|
|
121
|
+
if (canUseEventBridge()) {
|
|
122
|
+
const bridge = getEventBridge();
|
|
123
|
+
const telemetrySubscription = telemetryObservable.subscribe((event) => bridge.send("internal_telemetry", event));
|
|
124
|
+
cleanupTasks.push(telemetrySubscription.unsubscribe);
|
|
125
|
+
} else {
|
|
126
|
+
const endpoints = [createEndpointBuilder(configuration, "rum")];
|
|
127
|
+
const replicaEndpoint = createReplicaEndpointBuilder(configuration, "rum");
|
|
128
|
+
if (replicaEndpoint && isTelemetryReplicationAllowed(configuration)) endpoints.push(replicaEndpoint);
|
|
129
|
+
const telemetryBatch = createBatch({
|
|
130
|
+
encoder: createIdentityEncoder(),
|
|
131
|
+
request: createHttpRequest(endpoints, noop),
|
|
132
|
+
flushController: createFlushController({
|
|
133
|
+
pageMayExitObservable: createPageMayExitObservable(),
|
|
134
|
+
sessionExpireObservable: new Observable()
|
|
135
|
+
})
|
|
136
|
+
});
|
|
137
|
+
cleanupTasks.push(telemetryBatch.stop);
|
|
138
|
+
const telemetrySubscription = telemetryObservable.subscribe(telemetryBatch.add);
|
|
139
|
+
cleanupTasks.push(telemetrySubscription.unsubscribe);
|
|
140
|
+
}
|
|
141
|
+
return { stop: () => cleanupTasks.forEach((task) => task()) };
|
|
142
|
+
}
|
|
143
|
+
function getRuntimeEnvInfo() {
|
|
144
|
+
return {
|
|
145
|
+
is_local_file: globalObject.location?.protocol === "file:",
|
|
146
|
+
is_worker: isWorkerEnvironment
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Avoid mixing telemetry events from different data centers
|
|
151
|
+
* but keep replicating staging events for reliability
|
|
152
|
+
*/
|
|
153
|
+
function isTelemetryReplicationAllowed(configuration) {
|
|
154
|
+
return configuration.site === INTAKE_SITE_STAGING;
|
|
155
|
+
}
|
|
156
|
+
function addTelemetryDebug(message, context) {
|
|
157
|
+
if (getDebugMode()) display.debug("[Telemetry]", message, context);
|
|
158
|
+
getTelemetryObservable().notify({ rawEvent: {
|
|
159
|
+
type: TelemetryType.LOG,
|
|
160
|
+
message,
|
|
161
|
+
status: "debug",
|
|
162
|
+
...context
|
|
163
|
+
} });
|
|
164
|
+
}
|
|
165
|
+
function addTelemetryError(e, context) {
|
|
166
|
+
getTelemetryObservable().notify({ rawEvent: {
|
|
167
|
+
type: TelemetryType.LOG,
|
|
168
|
+
status: "error",
|
|
169
|
+
...formatError(e),
|
|
170
|
+
...context
|
|
171
|
+
} });
|
|
172
|
+
}
|
|
173
|
+
function addTelemetryConfiguration(configuration) {
|
|
174
|
+
getTelemetryObservable().notify({ rawEvent: {
|
|
175
|
+
type: TelemetryType.CONFIGURATION,
|
|
176
|
+
configuration
|
|
177
|
+
} });
|
|
178
|
+
}
|
|
179
|
+
function addTelemetryMetrics(metricName, context) {
|
|
180
|
+
getTelemetryObservable().notify({
|
|
181
|
+
rawEvent: {
|
|
182
|
+
type: TelemetryType.LOG,
|
|
183
|
+
message: metricName,
|
|
184
|
+
status: "debug",
|
|
185
|
+
...context
|
|
186
|
+
},
|
|
187
|
+
metricName
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
function addTelemetryUsage(usage) {
|
|
191
|
+
getTelemetryObservable().notify({ rawEvent: {
|
|
192
|
+
type: TelemetryType.USAGE,
|
|
193
|
+
usage
|
|
194
|
+
} });
|
|
195
|
+
}
|
|
196
|
+
function formatError(e) {
|
|
197
|
+
if (isError(e)) {
|
|
198
|
+
const stackTrace = computeStackTrace(e);
|
|
199
|
+
return {
|
|
200
|
+
error: {
|
|
201
|
+
kind: stackTrace.name,
|
|
202
|
+
stack: toStackTraceString(scrubCustomerFrames(stackTrace))
|
|
203
|
+
},
|
|
204
|
+
message: stackTrace.message
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
error: { stack: NO_ERROR_STACK_PRESENT_MESSAGE },
|
|
209
|
+
message: `Uncaught ${jsonStringify(e)}`
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function scrubCustomerFrames(stackTrace) {
|
|
213
|
+
stackTrace.stack = stackTrace.stack.filter((frame) => !frame.url || ALLOWED_FRAME_URLS.some((allowedFrameUrl) => frame.url.startsWith(allowedFrameUrl)));
|
|
214
|
+
return stackTrace;
|
|
215
|
+
}
|
|
216
|
+
//#endregion
|
|
217
|
+
export { TelemetryMetrics, TelemetryService, addTelemetryConfiguration, addTelemetryDebug, addTelemetryError, addTelemetryMetrics, addTelemetryUsage, startTelemetry };
|
|
218
|
+
|
|
219
|
+
//# sourceMappingURL=telemetry.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.mjs","names":[],"sources":["../../../src/domain/telemetry/telemetry.ts"],"sourcesContent":["import { clocksNow } from '@openobserve/js-core/time'\nimport { getDebugMode, combine } from '@openobserve/js-core/util'\nimport type { Hook } from '@openobserve/js-core/assembly'\nimport type { RecursivePartial } from '@openobserve/js-core/util'\nimport { DISCARDED } from '@openobserve/js-core/assembly'\nimport type { Context } from '../../tools/serialisation/context'\nimport { NO_ERROR_STACK_PRESENT_MESSAGE, isError } from '../error/error'\nimport { toStackTraceString } from '../../tools/stackTrace/handlingStack'\nimport { getExperimentalFeatures } from '../../tools/experimentalFeatures'\nimport { createEndpointBuilder, createReplicaEndpointBuilder } from '../configuration'\nimport type { Configuration } from '../configuration'\nimport { buildTags } from '../tags'\nimport { INTAKE_SITE_STAGING, INTAKE_SITE_US1_FED, INTAKE_SITE_US2_FED } from '../intakeSites'\nimport { BufferedObservable, Observable } from '../../tools/observable'\nimport { startMonitorErrorCollection } from '../../tools/monitor'\nimport { display } from '../../tools/display'\nimport { sendToExtension } from '../../tools/sendToExtension'\nimport { performDraw } from '../../tools/utils/numberUtils'\nimport { jsonStringify } from '../../tools/serialisation/jsonStringify'\nimport { NonErrorPrefix } from '../error/error.types'\nimport type { StackTrace } from '../../tools/stackTrace/computeStackTrace'\nimport { computeStackTrace } from '../../tools/stackTrace/computeStackTrace'\nimport { getConnectivity } from '../connectivity'\nimport {\n canUseEventBridge,\n createFlushController,\n createHttpRequest,\n getEventBridge,\n createBatch,\n} from '../../transport'\nimport { createIdentityEncoder } from '../../tools/encoder'\nimport { createPageMayExitObservable } from '../../browser/pageMayExitObservable'\nimport { globalObject, isWorkerEnvironment } from '../../tools/globalObject'\nimport { noop } from '../../tools/utils/functionUtils'\nimport type { TelemetryEvent } from './telemetryEvent.types'\nimport type {\n RawTelemetryConfiguration,\n RawTelemetryEvent,\n RuntimeEnvInfo,\n RawTelemetryUsage,\n} from './rawTelemetryEvent.types'\nimport { StatusType, TelemetryType } from './rawTelemetryEvent.types'\n\n// replaced at build time\ndeclare const __BUILD_ENV__SDK_VERSION__: string\ndeclare const __BUILD_ENV__SDK_SETUP__: string\n\nconst ALLOWED_FRAME_URLS = [\n 'https://www.datadoghq-browser-agent.com',\n 'https://www.datad0g-browser-agent.com',\n 'https://d3uc069fcn7uxw.cloudfront.net',\n 'https://d20xtzwzcl0ceb.cloudfront.net',\n 'http://localhost',\n '<anonymous>',\n]\n\nexport const enum TelemetryService {\n LOGS = 'browser-logs-sdk',\n RUM = 'browser-rum-sdk',\n}\n\nexport interface Telemetry {\n stop: () => void\n enabled: boolean\n metricsEnabled: boolean\n}\n\nexport const enum TelemetryMetrics {\n CUSTOMER_DATA_METRIC_NAME = 'Customer data measures',\n REMOTE_CONFIGURATION_METRIC_NAME = 'remote configuration metrics',\n RECORDER_INIT_METRICS_TELEMETRY_NAME = 'Recorder init metrics',\n SEGMENT_METRICS_TELEMETRY_NAME = 'Segment network request metrics',\n INITIAL_VIEW_METRICS_TELEMETRY_NAME = 'Initial view metrics',\n SESSION_MANAGER_INIT_METRICS_TELEMETRY_NAME = 'Session manager init metrics',\n}\n\nconst METRIC_SAMPLE_RATE = 1\n\nconst TELEMETRY_EXCLUDED_SITES: string[] = [INTAKE_SITE_US1_FED, INTAKE_SITE_US2_FED]\nconst MAX_TELEMETRY_EVENTS_PER_PAGE = 15\n\nlet telemetryObservable: BufferedObservable<{ rawEvent: RawTelemetryEvent; metricName?: string }> | undefined\n\nexport function getTelemetryObservable() {\n if (!telemetryObservable) {\n telemetryObservable = new BufferedObservable(100)\n }\n return telemetryObservable\n}\n\nexport function startTelemetry(\n telemetryService: TelemetryService,\n configuration: Configuration,\n hook: Hook<any, any>\n): Telemetry {\n const observable = new Observable<TelemetryEvent & Context>()\n const { enabled, metricsEnabled } = startTelemetryCollection(telemetryService, configuration, hook, observable)\n const { stop } = startTelemetryTransport(configuration, observable)\n return {\n stop,\n enabled,\n metricsEnabled,\n }\n}\n\nexport function startTelemetryCollection(\n telemetryService: TelemetryService,\n configuration: Configuration,\n hook: Hook<any, any>,\n observable: Observable<TelemetryEvent & Context>,\n metricSampleRate = METRIC_SAMPLE_RATE,\n maxTelemetryEventsPerPage = MAX_TELEMETRY_EVENTS_PER_PAGE\n) {\n const alreadySentEventsByKind: Record<string, Set<string>> = {}\n\n const telemetryEnabled =\n !TELEMETRY_EXCLUDED_SITES.includes(configuration.site) && performDraw(configuration.telemetrySampleRate)\n\n const telemetryEnabledPerType = {\n [TelemetryType.LOG]: telemetryEnabled,\n [TelemetryType.CONFIGURATION]: telemetryEnabled && performDraw(configuration.telemetryConfigurationSampleRate),\n [TelemetryType.USAGE]: telemetryEnabled && performDraw(configuration.telemetryUsageSampleRate),\n // not an actual \"type\" but using a single draw for all metrics\n metric: telemetryEnabled && performDraw(metricSampleRate),\n }\n\n const runtimeEnvInfo = getRuntimeEnvInfo()\n const telemetryObservable = getTelemetryObservable()\n telemetryObservable.subscribe(({ rawEvent, metricName }) => {\n if ((metricName && !telemetryEnabledPerType['metric']) || !telemetryEnabledPerType[rawEvent.type!]) {\n return\n }\n\n const kind = metricName || (rawEvent.status as string | undefined) || rawEvent.type!\n let alreadySentEvents = alreadySentEventsByKind[kind]\n if (!alreadySentEvents) {\n alreadySentEvents = alreadySentEventsByKind[kind] = new Set()\n }\n\n if (alreadySentEvents.size >= maxTelemetryEventsPerPage) {\n return\n }\n\n const stringifiedEvent = jsonStringify(rawEvent)!\n if (alreadySentEvents.has(stringifiedEvent)) {\n return\n }\n\n const defaultTelemetryEventAttributes = hook.trigger({\n startTime: clocksNow().relative,\n })\n\n if (defaultTelemetryEventAttributes === DISCARDED) {\n return\n }\n const event = toTelemetryEvent(\n defaultTelemetryEventAttributes as RecursivePartial<TelemetryEvent>,\n telemetryService,\n rawEvent,\n runtimeEnvInfo\n )\n observable.notify(event)\n sendToExtension('telemetry', event)\n alreadySentEvents.add(stringifiedEvent)\n })\n telemetryObservable.unbuffer()\n\n startMonitorErrorCollection(addTelemetryError)\n\n return {\n enabled: telemetryEnabled,\n metricsEnabled: telemetryEnabledPerType['metric'],\n }\n\n function toTelemetryEvent(\n defaultTelemetryEventAttributes: RecursivePartial<TelemetryEvent>,\n telemetryService: TelemetryService,\n rawEvent: RawTelemetryEvent,\n runtimeEnvInfo: RuntimeEnvInfo\n ): TelemetryEvent & Context {\n const clockNow = clocksNow()\n\n const event = {\n type: 'telemetry' as const,\n date: clockNow.timeStamp,\n service: telemetryService,\n version: __BUILD_ENV__SDK_VERSION__,\n source: 'browser' as const,\n _oo: {\n format_version: 2 as const,\n },\n telemetry: combine(rawEvent, {\n runtime_env: runtimeEnvInfo,\n connectivity: getConnectivity(),\n sdk_setup: __BUILD_ENV__SDK_SETUP__,\n }) as TelemetryEvent['telemetry'],\n ootags: buildTags(configuration).join(','),\n experimental_features: Array.from(getExperimentalFeatures()),\n }\n\n return combine(event, defaultTelemetryEventAttributes) as TelemetryEvent & Context\n }\n}\n\nexport function startTelemetryTransport(\n configuration: Configuration,\n telemetryObservable: Observable<TelemetryEvent & Context>\n) {\n const cleanupTasks: Array<() => void> = []\n if (canUseEventBridge()) {\n const bridge = getEventBridge<'internal_telemetry', TelemetryEvent>()!\n const telemetrySubscription = telemetryObservable.subscribe((event) => bridge.send('internal_telemetry', event))\n cleanupTasks.push(telemetrySubscription.unsubscribe)\n } else {\n const endpoints = [createEndpointBuilder(configuration, 'rum')]\n const replicaEndpoint = createReplicaEndpointBuilder(configuration, 'rum')\n if (replicaEndpoint && isTelemetryReplicationAllowed(configuration)) {\n endpoints.push(replicaEndpoint)\n }\n const telemetryBatch = createBatch({\n encoder: createIdentityEncoder(),\n request: createHttpRequest(\n endpoints,\n // Ignore transport errors for telemetry\n noop\n ),\n flushController: createFlushController({\n pageMayExitObservable: createPageMayExitObservable(),\n\n // We don't use an actual session expire observable here, to make telemetry collection\n // independent of the session. This allows to start and send telemetry events earlier.\n sessionExpireObservable: new Observable(),\n }),\n })\n cleanupTasks.push(telemetryBatch.stop)\n const telemetrySubscription = telemetryObservable.subscribe(telemetryBatch.add)\n cleanupTasks.push(telemetrySubscription.unsubscribe)\n }\n\n return {\n stop: () => cleanupTasks.forEach((task) => task()),\n }\n}\n\nfunction getRuntimeEnvInfo(): RuntimeEnvInfo {\n return {\n is_local_file: globalObject.location?.protocol === 'file:',\n is_worker: isWorkerEnvironment,\n }\n}\n\nexport function resetTelemetry() {\n telemetryObservable = undefined\n}\n\n/**\n * Avoid mixing telemetry events from different data centers\n * but keep replicating staging events for reliability\n */\nfunction isTelemetryReplicationAllowed(configuration: Configuration) {\n return configuration.site === INTAKE_SITE_STAGING\n}\n\nexport function addTelemetryDebug(message: string, context?: Context) {\n if (getDebugMode()) {\n display.debug('[Telemetry]', message, context)\n }\n getTelemetryObservable().notify({\n rawEvent: {\n type: TelemetryType.LOG,\n message,\n status: StatusType.debug,\n ...context,\n },\n })\n}\n\nexport function addTelemetryError(e: unknown, context?: Context) {\n getTelemetryObservable().notify({\n rawEvent: {\n type: TelemetryType.LOG,\n status: StatusType.error,\n ...formatError(e),\n ...context,\n },\n })\n}\n\nexport function addTelemetryConfiguration(configuration: RawTelemetryConfiguration) {\n getTelemetryObservable().notify({\n rawEvent: {\n type: TelemetryType.CONFIGURATION,\n configuration,\n },\n })\n}\n\nexport function addTelemetryMetrics(metricName: TelemetryMetrics, context?: Context) {\n getTelemetryObservable().notify({\n rawEvent: {\n type: TelemetryType.LOG,\n message: metricName,\n status: StatusType.debug,\n ...context,\n },\n metricName,\n })\n}\n\nexport function addTelemetryUsage(usage: RawTelemetryUsage) {\n getTelemetryObservable().notify({\n rawEvent: {\n type: TelemetryType.USAGE,\n usage,\n },\n })\n}\n\nexport function formatError(e: unknown) {\n if (isError(e)) {\n const stackTrace = computeStackTrace(e)\n return {\n error: {\n kind: stackTrace.name,\n stack: toStackTraceString(scrubCustomerFrames(stackTrace)),\n },\n message: stackTrace.message!,\n }\n }\n return {\n error: {\n stack: NO_ERROR_STACK_PRESENT_MESSAGE,\n },\n message: `${NonErrorPrefix.UNCAUGHT} ${jsonStringify(e)!}`,\n }\n}\n\nexport function scrubCustomerFrames(stackTrace: StackTrace) {\n stackTrace.stack = stackTrace.stack.filter(\n (frame) => !frame.url || ALLOWED_FRAME_URLS.some((allowedFrameUrl) => frame.url!.startsWith(allowedFrameUrl))\n )\n return stackTrace\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAM,qBAAqB;CACzB;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,IAAkB,mBAAX,yBAAA,kBAAA;CACL,iBAAA,UAAA;CACA,iBAAA,SAAA;;AACF,EAAA,CAAA,CAAA;AAQA,IAAkB,mBAAX,yBAAA,kBAAA;CACL,iBAAA,+BAAA;CACA,iBAAA,sCAAA;CACA,iBAAA,0CAAA;CACA,iBAAA,oCAAA;CACA,iBAAA,yCAAA;CACA,iBAAA,iDAAA;;AACF,EAAA,CAAA,CAAA;AAEA,MAAM,qBAAqB;AAE3B,MAAM,2BAAqC,CAAC,qBAAqB,mBAAmB;AACpF,MAAM,gCAAgC;AAEtC,IAAI;AAEJ,SAAgB,yBAAyB;CACvC,IAAI,CAAC,qBACH,sBAAsB,IAAI,mBAAmB,GAAG;CAElD,OAAO;AACT;AAEA,SAAgB,eACd,kBACA,eACA,MACW;CACX,MAAM,aAAa,IAAI,WAAqC;CAC5D,MAAM,EAAE,SAAS,mBAAmB,yBAAyB,kBAAkB,eAAe,MAAM,UAAU;CAC9G,MAAM,EAAE,SAAS,wBAAwB,eAAe,UAAU;CAClE,OAAO;EACL;EACA;EACA;CACF;AACF;AAEA,SAAgB,yBACd,kBACA,eACA,MACA,YACA,mBAAmB,oBACnB,4BAA4B,+BAC5B;CACA,MAAM,0BAAuD,CAAC;CAE9D,MAAM,mBACJ,CAAC,yBAAyB,SAAS,cAAc,IAAI,KAAK,YAAY,cAAc,mBAAmB;CAEzG,MAAM,0BAA0B;GAC7B,cAAc,MAAM;GACpB,cAAc,gBAAgB,oBAAoB,YAAY,cAAc,gCAAgC;GAC5G,cAAc,QAAQ,oBAAoB,YAAY,cAAc,wBAAwB;EAE7F,QAAQ,oBAAoB,YAAY,gBAAgB;CAC1D;CAEA,MAAM,iBAAiB,kBAAkB;CACzC,MAAM,sBAAsB,uBAAuB;CACnD,oBAAoB,WAAW,EAAE,UAAU,iBAAiB;EAC1D,IAAK,cAAc,CAAC,wBAAwB,aAAc,CAAC,wBAAwB,SAAS,OAC1F;EAGF,MAAM,OAAO,cAAe,SAAS,UAAiC,SAAS;EAC/E,IAAI,oBAAoB,wBAAwB;EAChD,IAAI,CAAC,mBACH,oBAAoB,wBAAwB,wBAAQ,IAAI,IAAI;EAG9D,IAAI,kBAAkB,QAAQ,2BAC5B;EAGF,MAAM,mBAAmB,cAAc,QAAQ;EAC/C,IAAI,kBAAkB,IAAI,gBAAgB,GACxC;EAGF,MAAM,kCAAkC,KAAK,QAAQ,EACnD,WAAW,UAAU,CAAC,CAAC,SACzB,CAAC;EAED,IAAI,oCAAoC,WACtC;EAEF,MAAM,QAAQ,iBACZ,iCACA,kBACA,UACA,cACF;EACA,WAAW,OAAO,KAAK;EACvB,gBAAgB,aAAa,KAAK;EAClC,kBAAkB,IAAI,gBAAgB;CACxC,CAAC;CACD,oBAAoB,SAAS;CAE7B,4BAA4B,iBAAiB;CAE7C,OAAO;EACL,SAAS;EACT,gBAAgB,wBAAwB;CAC1C;CAEA,SAAS,iBACP,iCACA,kBACA,UACA,gBAC0B;EAqB1B,OAAO,QAAQ;GAjBb,MAAM;GACN,MAJe,UAIF,CAAC,CAAC;GACf,SAAS;GACT,SAAA;GACA,QAAQ;GACR,KAAK,EACH,gBAAgB,EAClB;GACA,WAAW,QAAQ,UAAU;IAC3B,aAAa;IACb,cAAc,gBAAgB;IAC9B,WAAA;GACF,CAAC;GACD,QAAQ,UAAU,aAAa,CAAC,CAAC,KAAK,GAAG;GACzC,uBAAuB,MAAM,KAAK,wBAAwB,CAAC;EAG1C,GAAG,+BAA+B;CACvD;AACF;AAEA,SAAgB,wBACd,eACA,qBACA;CACA,MAAM,eAAkC,CAAC;CACzC,IAAI,kBAAkB,GAAG;EACvB,MAAM,SAAS,eAAqD;EACpE,MAAM,wBAAwB,oBAAoB,WAAW,UAAU,OAAO,KAAK,sBAAsB,KAAK,CAAC;EAC/G,aAAa,KAAK,sBAAsB,WAAW;CACrD,OAAO;EACL,MAAM,YAAY,CAAC,sBAAsB,eAAe,KAAK,CAAC;EAC9D,MAAM,kBAAkB,6BAA6B,eAAe,KAAK;EACzE,IAAI,mBAAmB,8BAA8B,aAAa,GAChE,UAAU,KAAK,eAAe;EAEhC,MAAM,iBAAiB,YAAY;GACjC,SAAS,sBAAsB;GAC/B,SAAS,kBACP,WAEA,IACF;GACA,iBAAiB,sBAAsB;IACrC,uBAAuB,4BAA4B;IAInD,yBAAyB,IAAI,WAAW;GAC1C,CAAC;EACH,CAAC;EACD,aAAa,KAAK,eAAe,IAAI;EACrC,MAAM,wBAAwB,oBAAoB,UAAU,eAAe,GAAG;EAC9E,aAAa,KAAK,sBAAsB,WAAW;CACrD;CAEA,OAAO,EACL,YAAY,aAAa,SAAS,SAAS,KAAK,CAAC,EACnD;AACF;AAEA,SAAS,oBAAoC;CAC3C,OAAO;EACL,eAAe,aAAa,UAAU,aAAa;EACnD,WAAW;CACb;AACF;;;;;AAUA,SAAS,8BAA8B,eAA8B;CACnE,OAAO,cAAc,SAAS;AAChC;AAEA,SAAgB,kBAAkB,SAAiB,SAAmB;CACpE,IAAI,aAAa,GACf,QAAQ,MAAM,eAAe,SAAS,OAAO;CAE/C,uBAAuB,CAAC,CAAC,OAAO,EAC9B,UAAU;EACR,MAAM,cAAc;EACpB;EACA,QAAA;EACA,GAAG;CACL,EACF,CAAC;AACH;AAEA,SAAgB,kBAAkB,GAAY,SAAmB;CAC/D,uBAAuB,CAAC,CAAC,OAAO,EAC9B,UAAU;EACR,MAAM,cAAc;EACpB,QAAA;EACA,GAAG,YAAY,CAAC;EAChB,GAAG;CACL,EACF,CAAC;AACH;AAEA,SAAgB,0BAA0B,eAA0C;CAClF,uBAAuB,CAAC,CAAC,OAAO,EAC9B,UAAU;EACR,MAAM,cAAc;EACpB;CACF,EACF,CAAC;AACH;AAEA,SAAgB,oBAAoB,YAA8B,SAAmB;CACnF,uBAAuB,CAAC,CAAC,OAAO;EAC9B,UAAU;GACR,MAAM,cAAc;GACpB,SAAS;GACT,QAAA;GACA,GAAG;EACL;EACA;CACF,CAAC;AACH;AAEA,SAAgB,kBAAkB,OAA0B;CAC1D,uBAAuB,CAAC,CAAC,OAAO,EAC9B,UAAU;EACR,MAAM,cAAc;EACpB;CACF,EACF,CAAC;AACH;AAEA,SAAgB,YAAY,GAAY;CACtC,IAAI,QAAQ,CAAC,GAAG;EACd,MAAM,aAAa,kBAAkB,CAAC;EACtC,OAAO;GACL,OAAO;IACL,MAAM,WAAW;IACjB,OAAO,mBAAmB,oBAAoB,UAAU,CAAC;GAC3D;GACA,SAAS,WAAW;EACtB;CACF;CACA,OAAO;EACL,OAAO,EACL,OAAO,+BACT;EACA,SAAS,YAA8B,cAAc,CAAC;CACxD;AACF;AAEA,SAAgB,oBAAoB,YAAwB;CAC1D,WAAW,QAAQ,WAAW,MAAM,QACjC,UAAU,CAAC,MAAM,OAAO,mBAAmB,MAAM,oBAAoB,MAAM,IAAK,WAAW,eAAe,CAAC,CAC9G;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Observable } from "../tools/observable.mjs";
|
|
2
|
+
//#region src/domain/trackingConsent.ts
|
|
3
|
+
const TrackingConsent = {
|
|
4
|
+
GRANTED: "granted",
|
|
5
|
+
NOT_GRANTED: "not-granted"
|
|
6
|
+
};
|
|
7
|
+
function createTrackingConsentState(currentConsent) {
|
|
8
|
+
const observable = new Observable();
|
|
9
|
+
function isGranted() {
|
|
10
|
+
return currentConsent === TrackingConsent.GRANTED;
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
tryToInit(trackingConsent) {
|
|
14
|
+
if (!currentConsent) currentConsent = trackingConsent;
|
|
15
|
+
},
|
|
16
|
+
onGrantedOnce(fn) {
|
|
17
|
+
if (isGranted()) fn();
|
|
18
|
+
else {
|
|
19
|
+
const subscription = observable.subscribe(() => {
|
|
20
|
+
if (isGranted()) {
|
|
21
|
+
fn();
|
|
22
|
+
subscription.unsubscribe();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
update(trackingConsent) {
|
|
28
|
+
currentConsent = trackingConsent;
|
|
29
|
+
observable.notify();
|
|
30
|
+
},
|
|
31
|
+
isGranted,
|
|
32
|
+
observable
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { TrackingConsent, createTrackingConsentState };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=trackingConsent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackingConsent.mjs","names":[],"sources":["../../src/domain/trackingConsent.ts"],"sourcesContent":["import { Observable } from '../tools/observable'\n\nexport const TrackingConsent = {\n GRANTED: 'granted',\n NOT_GRANTED: 'not-granted',\n} as const\nexport type TrackingConsent = (typeof TrackingConsent)[keyof typeof TrackingConsent]\n\nexport interface TrackingConsentState {\n tryToInit: (trackingConsent: TrackingConsent) => void\n update: (trackingConsent: TrackingConsent) => void\n isGranted: () => boolean\n observable: Observable<void>\n onGrantedOnce: (callback: () => void) => void\n}\n\nexport function createTrackingConsentState(currentConsent?: TrackingConsent): TrackingConsentState {\n const observable = new Observable<void>()\n\n function isGranted() {\n return currentConsent === TrackingConsent.GRANTED\n }\n\n return {\n tryToInit(trackingConsent: TrackingConsent) {\n if (!currentConsent) {\n currentConsent = trackingConsent\n }\n },\n onGrantedOnce(fn) {\n if (isGranted()) {\n fn()\n } else {\n const subscription = observable.subscribe(() => {\n if (isGranted()) {\n fn()\n subscription.unsubscribe()\n }\n })\n }\n },\n update(trackingConsent: TrackingConsent) {\n currentConsent = trackingConsent\n observable.notify()\n },\n isGranted,\n observable,\n }\n}\n"],"mappings":";;AAEA,MAAa,kBAAkB;CAC7B,SAAS;CACT,aAAa;AACf;AAWA,SAAgB,2BAA2B,gBAAwD;CACjG,MAAM,aAAa,IAAI,WAAiB;CAExC,SAAS,YAAY;EACnB,OAAO,mBAAmB,gBAAgB;CAC5C;CAEA,OAAO;EACL,UAAU,iBAAkC;GAC1C,IAAI,CAAC,gBACH,iBAAiB;EAErB;EACA,cAAc,IAAI;GAChB,IAAI,UAAU,GACZ,GAAG;QACE;IACL,MAAM,eAAe,WAAW,gBAAgB;KAC9C,IAAI,UAAU,GAAG;MACf,GAAG;MACH,aAAa,YAAY;KAC3B;IACF,CAAC;GACH;EACF;EACA,OAAO,iBAAkC;GACvC,iBAAiB;GACjB,WAAW,OAAO;EACpB;EACA;EACA;CACF;AACF"}
|
package/esm/index.mjs
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { DOCS_ORIGIN, DOCS_TROUBLESHOOTING, MORE_DETAILS, display } from "./tools/display.mjs";
|
|
2
|
+
import { catchUserErrors } from "./tools/catchUserErrors.mjs";
|
|
3
|
+
import { isNumber, isPercentage, performDraw, round } from "./tools/utils/numberUtils.mjs";
|
|
4
|
+
import { getConstructorName, isEmptyObject, mapValues, objectHasValue, shallowClone, tryJsonParse } from "./tools/utils/objectUtils.mjs";
|
|
5
|
+
import { findAllCommaSeparatedValues, findCommaSeparatedValue, findCommaSeparatedValues, generateUUID, safeTruncate } from "./tools/utils/stringUtils.mjs";
|
|
6
|
+
import { globalObject, isWorkerEnvironment } from "./tools/globalObject.mjs";
|
|
7
|
+
import { buildUrl, getPathName, getPristineWindow, isValidUrl, normalizeUrl } from "./tools/utils/urlPolyfill.mjs";
|
|
8
|
+
import { deleteCookie, getCookie, getInitCookie, resetInitCookies, setCookie } from "./browser/cookie.mjs";
|
|
9
|
+
import { callMonitored, monitor, monitorError, monitored } from "./tools/monitor.mjs";
|
|
10
|
+
import { BufferedObservable, Observable } from "./tools/observable.mjs";
|
|
11
|
+
import { TrackingConsent, createTrackingConsentState } from "./domain/trackingConsent.mjs";
|
|
12
|
+
import { isMatchOption, matchList } from "./tools/matchOption.mjs";
|
|
13
|
+
import { mockable } from "./tools/mockable.mjs";
|
|
14
|
+
import { INTAKE_SITE_EU1, INTAKE_SITE_STAGING, INTAKE_SITE_US1, INTAKE_SITE_US1_FED, INTAKE_SITE_US2_FED, INTAKE_URL_PARAMETERS, isIntakeUrl } from "./domain/intakeSites.mjs";
|
|
15
|
+
import { DefaultPrivacyLevel, TraceContextInjection, isSampleRate, serializeConfiguration, validateAndBuildConfiguration } from "./domain/configuration/configuration.mjs";
|
|
16
|
+
import { buildEndpointUrl, createEndpointBuilder, createReplicaEndpointBuilder } from "./domain/configuration/endpointBuilder.mjs";
|
|
17
|
+
import { ExperimentalFeature, addExperimentalFeatures, getExperimentalFeatures, initFeatureFlags, isExperimentalFeatureEnabled } from "./tools/experimentalFeatures.mjs";
|
|
18
|
+
import { getZoneJsOriginalValue } from "./tools/getZoneJsOriginalValue.mjs";
|
|
19
|
+
import { clearInterval, clearTimeout, setInterval, setTimeout } from "./tools/timer.mjs";
|
|
20
|
+
import { noop, throttle } from "./tools/utils/functionUtils.mjs";
|
|
21
|
+
import { computeStackTrace } from "./tools/stackTrace/computeStackTrace.mjs";
|
|
22
|
+
import { createHandlingStack, formatErrorMessage, toStackTraceString } from "./tools/stackTrace/handlingStack.mjs";
|
|
23
|
+
import { instrumentConstructor, instrumentMethod, instrumentSetter } from "./tools/instrumentMethod.mjs";
|
|
24
|
+
import { DOM_EVENT, addEventListener, addEventListeners, isEventSupported, resetAllowUntrustedEvents, setAllowUntrustedEvents } from "./browser/addEventListener.mjs";
|
|
25
|
+
import { ONE_KIBI_BYTE, ONE_MEBI_BYTE, computeBytesCount, concatBuffers } from "./tools/utils/byteUtils.mjs";
|
|
26
|
+
import { detachToJsonMethod, jsonStringify } from "./tools/serialisation/jsonStringify.mjs";
|
|
27
|
+
import { SANITIZE_DEFAULT_MAX_CHARACTER_COUNT, sanitize } from "./tools/serialisation/sanitize.mjs";
|
|
28
|
+
import { NO_ERROR_STACK_PRESENT_MESSAGE, computeRawError, getFileFromStackTraceString, isError } from "./domain/error/error.mjs";
|
|
29
|
+
import { ErrorHandling, ErrorSource, NonErrorPrefix } from "./domain/error/error.types.mjs";
|
|
30
|
+
import { trackRuntimeError } from "./domain/error/trackRuntimeError.mjs";
|
|
31
|
+
import { defineGlobal, makePublicApi } from "./boot/init.mjs";
|
|
32
|
+
import { displayAlreadyInitializedError } from "./boot/displayAlreadyInitializedError.mjs";
|
|
33
|
+
import { RawReportType, initReportObservable } from "./domain/report/reportObservable.mjs";
|
|
34
|
+
import { TAG_SIZE_LIMIT, buildTag, buildTags, sanitizeTag } from "./domain/tags.mjs";
|
|
35
|
+
import { sendToExtension } from "./tools/sendToExtension.mjs";
|
|
36
|
+
import { getConnectivity } from "./domain/connectivity/connectivity.mjs";
|
|
37
|
+
import { fetch } from "./browser/fetch.mjs";
|
|
38
|
+
import { isServerError, tryToClone } from "./tools/utils/responseUtils.mjs";
|
|
39
|
+
import { createHttpRequest } from "./transport/httpRequest.mjs";
|
|
40
|
+
import { BridgeCapability, bridgeSupports, canUseEventBridge, getEventBridge } from "./transport/eventBridge.mjs";
|
|
41
|
+
import { findLast, objectEntries, objectValues } from "./tools/utils/polyfills.mjs";
|
|
42
|
+
import { PageExitReason, createPageMayExitObservable, isPageExitReason } from "./browser/pageMayExitObservable.mjs";
|
|
43
|
+
import { createBatch } from "./transport/batch.mjs";
|
|
44
|
+
import { FLUSH_DURATION_LIMIT, createFlushController } from "./transport/flushController.mjs";
|
|
45
|
+
import { createIdentityEncoder } from "./tools/encoder.mjs";
|
|
46
|
+
import { TelemetryMetrics, TelemetryService, addTelemetryConfiguration, addTelemetryDebug, addTelemetryError, addTelemetryMetrics, addTelemetryUsage, startTelemetry } from "./domain/telemetry/telemetry.mjs";
|
|
47
|
+
import { isNonEmptyArray, mergeArrays, removeDuplicates, removeItem } from "./tools/utils/arrayUtils.mjs";
|
|
48
|
+
import { CLEAR_OLD_VALUES_INTERVAL, createValueHistory } from "./tools/valueHistory.mjs";
|
|
49
|
+
import { correctedChildSampleRate, isSampled, resetSampleDecisionCache, sampleUsingKnuthFactor } from "./domain/sampler.mjs";
|
|
50
|
+
import { SESSION_NOT_TRACKED, SESSION_TIME_OUT_DELAY, SessionPersistence } from "./domain/session/sessionConstants.mjs";
|
|
51
|
+
import { isCookieStoreSupported } from "./browser/cookieAccess.mjs";
|
|
52
|
+
import { SESSION_STORE_KEY } from "./domain/session/storeStrategies/sessionStoreStrategy.mjs";
|
|
53
|
+
import { MEMORY_SESSION_STORE_KEY } from "./domain/session/storeStrategies/sessionInMemory.mjs";
|
|
54
|
+
import { startSessionManager, startSessionManagerStub, stopSessionManager } from "./domain/session/sessionManager.mjs";
|
|
55
|
+
import { AbstractLifeCycle } from "./tools/abstractLifeCycle.mjs";
|
|
56
|
+
import { createEventRateLimiter } from "./domain/eventRateLimiter/createEventRateLimiter.mjs";
|
|
57
|
+
import { Browser, detectBrowser, detectVersion, isChromium, isSafari } from "./tools/utils/browserDetection.mjs";
|
|
58
|
+
import { asyncRunOnReadyState, runOnReadyState } from "./browser/runOnReadyState.mjs";
|
|
59
|
+
import { initXhrObservable } from "./browser/xhrObservable.mjs";
|
|
60
|
+
import { readBytesFromStream } from "./tools/readBytesFromStream.mjs";
|
|
61
|
+
import { ResponseBodyAction, initFetchObservable } from "./browser/fetchObservable.mjs";
|
|
62
|
+
import { requestIdleCallback } from "./tools/requestIdleCallback.mjs";
|
|
63
|
+
import { MAX_EXECUTION_TIME_ON_TIMEOUT, createTaskQueue } from "./tools/taskQueue.mjs";
|
|
64
|
+
import { initConsoleObservable } from "./domain/console/consoleObservable.mjs";
|
|
65
|
+
import { checkContext } from "./domain/context/contextUtils.mjs";
|
|
66
|
+
import { createContextManager } from "./domain/context/contextManager.mjs";
|
|
67
|
+
import { bufferContextCalls, defineContextMethod } from "./domain/context/defineContextMethod.mjs";
|
|
68
|
+
import { removeStorageListeners, storeContextManager } from "./domain/context/storeContextManager.mjs";
|
|
69
|
+
import { ContextManagerMethod, CustomerContextKey, CustomerDataType } from "./domain/context/contextConstants.mjs";
|
|
70
|
+
import { buildAccountContextManager, startAccountContext } from "./domain/contexts/accountContext.mjs";
|
|
71
|
+
import { startTabContext } from "./domain/contexts/tabContext.mjs";
|
|
72
|
+
import { buildGlobalContextManager, startGlobalContext } from "./domain/contexts/globalContext.mjs";
|
|
73
|
+
import { buildUserContextManager, startUserContext } from "./domain/contexts/userContext.mjs";
|
|
74
|
+
import { getSyntheticsContext, isSyntheticsTest, willSyntheticsInjectRum } from "./domain/synthetics/syntheticsWorkerValues.mjs";
|
|
75
|
+
import { RequestType, ResourceType } from "./domain/resourceUtils.mjs";
|
|
76
|
+
import { BufferedDataType, startBufferingData } from "./domain/bufferedData.mjs";
|
|
77
|
+
import { getTimeZone } from "./tools/utils/timezone.mjs";
|
|
78
|
+
import { safeStringify, safeToString } from "./tools/serialisation/stringify.mjs";
|
|
79
|
+
import { DeflateEncoderStreamId } from "./domain/deflate/deflate.types.mjs";
|
|
80
|
+
import { startTelemetrySessionContext } from "./domain/contexts/telemetrySessionContext.mjs";
|
|
81
|
+
export { AbstractLifeCycle, BridgeCapability, Browser, BufferedDataType, BufferedObservable, CLEAR_OLD_VALUES_INTERVAL, ContextManagerMethod, CustomerContextKey, CustomerDataType, DOCS_ORIGIN, DOCS_TROUBLESHOOTING, DOM_EVENT, DefaultPrivacyLevel, DeflateEncoderStreamId, ErrorHandling, ErrorSource, ExperimentalFeature, FLUSH_DURATION_LIMIT, INTAKE_SITE_EU1, INTAKE_SITE_STAGING, INTAKE_SITE_US1, INTAKE_SITE_US1_FED, INTAKE_SITE_US2_FED, INTAKE_URL_PARAMETERS, MAX_EXECUTION_TIME_ON_TIMEOUT, MEMORY_SESSION_STORE_KEY, MORE_DETAILS, NO_ERROR_STACK_PRESENT_MESSAGE, NonErrorPrefix, ONE_KIBI_BYTE, ONE_MEBI_BYTE, Observable, PageExitReason, RawReportType, RequestType, ResourceType, ResponseBodyAction, SANITIZE_DEFAULT_MAX_CHARACTER_COUNT, SESSION_NOT_TRACKED, SESSION_STORE_KEY, SESSION_TIME_OUT_DELAY, SessionPersistence, TAG_SIZE_LIMIT, TelemetryMetrics, TelemetryService, TraceContextInjection, TrackingConsent, addEventListener, addEventListeners, addExperimentalFeatures, addTelemetryConfiguration, addTelemetryDebug, addTelemetryError, addTelemetryMetrics, addTelemetryUsage, asyncRunOnReadyState, bridgeSupports, bufferContextCalls, buildAccountContextManager, buildEndpointUrl, buildGlobalContextManager, buildTag, buildTags, buildUrl, buildUserContextManager, callMonitored, canUseEventBridge, catchUserErrors, checkContext, clearInterval, clearTimeout, computeBytesCount, computeRawError, computeStackTrace, concatBuffers, correctedChildSampleRate, createBatch, createContextManager, createEndpointBuilder, createEventRateLimiter, createFlushController, createHandlingStack, createHttpRequest, createIdentityEncoder, createPageMayExitObservable, createReplicaEndpointBuilder, createTaskQueue, createTrackingConsentState, createValueHistory, defineContextMethod, defineGlobal, deleteCookie, detachToJsonMethod, detectBrowser, detectVersion, display, displayAlreadyInitializedError, fetch, findAllCommaSeparatedValues, findCommaSeparatedValue, findCommaSeparatedValues, findLast, formatErrorMessage, generateUUID, getConnectivity, getConstructorName, getCookie, getEventBridge, getExperimentalFeatures, getFileFromStackTraceString, getInitCookie, getPathName, getPristineWindow, getSyntheticsContext, getTimeZone, getZoneJsOriginalValue, globalObject, initConsoleObservable, initFeatureFlags, initFetchObservable, initReportObservable, initXhrObservable, instrumentConstructor, instrumentMethod, instrumentSetter, isChromium, isCookieStoreSupported, isEmptyObject, isError, isEventSupported, isExperimentalFeatureEnabled, isIntakeUrl, isMatchOption, isNonEmptyArray, isNumber, isPageExitReason, isPercentage, isSafari, isSampleRate, isSampled, isServerError, isSyntheticsTest, isValidUrl, isWorkerEnvironment, jsonStringify, makePublicApi, mapValues, matchList, mergeArrays, mockable, monitor, monitorError, monitored, noop, normalizeUrl, objectEntries, objectHasValue, objectValues, performDraw, readBytesFromStream, removeDuplicates, removeItem, removeStorageListeners, requestIdleCallback, resetAllowUntrustedEvents, resetInitCookies, resetSampleDecisionCache, round, runOnReadyState, safeStringify, safeToString, safeTruncate, sampleUsingKnuthFactor, sanitize, sanitizeTag, sendToExtension, serializeConfiguration, setAllowUntrustedEvents, setCookie, setInterval, setTimeout, shallowClone, startAccountContext, startBufferingData, startGlobalContext, startSessionManager, startSessionManagerStub, startTabContext, startTelemetry, startTelemetrySessionContext, startUserContext, stopSessionManager, storeContextManager, throttle, toStackTraceString, trackRuntimeError, tryJsonParse, tryToClone, validateAndBuildConfiguration, willSyntheticsInjectRum };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/tools/abstractLifeCycle.ts
|
|
2
|
+
var AbstractLifeCycle = class {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.callbacks = {};
|
|
5
|
+
}
|
|
6
|
+
notify(eventType, data) {
|
|
7
|
+
const eventCallbacks = this.callbacks[eventType];
|
|
8
|
+
if (eventCallbacks) eventCallbacks.forEach((callback) => callback(data));
|
|
9
|
+
}
|
|
10
|
+
subscribe(eventType, callback) {
|
|
11
|
+
if (!this.callbacks[eventType]) this.callbacks[eventType] = [];
|
|
12
|
+
this.callbacks[eventType].push(callback);
|
|
13
|
+
return { unsubscribe: () => {
|
|
14
|
+
this.callbacks[eventType] = this.callbacks[eventType].filter((other) => callback !== other);
|
|
15
|
+
} };
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { AbstractLifeCycle };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=abstractLifeCycle.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstractLifeCycle.mjs","names":[],"sources":["../../src/tools/abstractLifeCycle.ts"],"sourcesContent":["import type { Subscription } from './observable'\n\n/**\n * Type helper to extract event types that have \"void\" data. This allows to call `notify` without a\n * second argument. Ex:\n *\n * ```\n * interface EventMap {\n * foo: void\n * }\n * const LifeCycle = AbstractLifeCycle<EventMap>\n * new LifeCycle().notify('foo')\n * ```\n */\ntype EventTypesWithoutData<EventMap> = {\n [K in keyof EventMap]: EventMap[K] extends void ? K : never\n}[keyof EventMap]\n\n// eslint-disable-next-line no-restricted-syntax\nexport class AbstractLifeCycle<EventMap> {\n private callbacks: { [key in keyof EventMap]?: Array<(data: any) => void> } = {}\n\n notify<EventType extends EventTypesWithoutData<EventMap>>(eventType: EventType): void\n notify<EventType extends keyof EventMap>(eventType: EventType, data: EventMap[EventType]): void\n notify(eventType: keyof EventMap, data?: unknown) {\n const eventCallbacks = this.callbacks[eventType]\n if (eventCallbacks) {\n eventCallbacks.forEach((callback) => callback(data))\n }\n }\n\n subscribe<EventType extends keyof EventMap>(\n eventType: EventType,\n callback: (data: EventMap[EventType]) => void\n ): Subscription {\n if (!this.callbacks[eventType]) {\n this.callbacks[eventType] = []\n }\n this.callbacks[eventType]!.push(callback)\n return {\n unsubscribe: () => {\n this.callbacks[eventType] = this.callbacks[eventType]!.filter((other) => callback !== other)\n },\n }\n }\n}\n"],"mappings":";AAmBA,IAAa,oBAAb,MAAyC;;mBACuC,CAAC;;CAI/E,OAAO,WAA2B,MAAgB;EAChD,MAAM,iBAAiB,KAAK,UAAU;EACtC,IAAI,gBACF,eAAe,SAAS,aAAa,SAAS,IAAI,CAAC;CAEvD;CAEA,UACE,WACA,UACc;EACd,IAAI,CAAC,KAAK,UAAU,YAClB,KAAK,UAAU,aAAa,CAAC;EAE/B,KAAK,UAAU,UAAU,CAAE,KAAK,QAAQ;EACxC,OAAO,EACL,mBAAmB;GACjB,KAAK,UAAU,aAAa,KAAK,UAAU,UAAU,CAAE,QAAQ,UAAU,aAAa,KAAK;EAC7F,EACF;CACF;AACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { display } from "./display.mjs";
|
|
2
|
+
//#region src/tools/catchUserErrors.ts
|
|
3
|
+
function catchUserErrors(fn, errorMsg) {
|
|
4
|
+
return (...args) => {
|
|
5
|
+
try {
|
|
6
|
+
return fn(...args);
|
|
7
|
+
} catch (err) {
|
|
8
|
+
display.error(errorMsg, err);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { catchUserErrors };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=catchUserErrors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catchUserErrors.mjs","names":[],"sources":["../../src/tools/catchUserErrors.ts"],"sourcesContent":["import { display } from './display'\n\nexport function catchUserErrors<Args extends any[], R>(fn: (...args: Args) => R, errorMsg: string) {\n return (...args: Args) => {\n try {\n return fn(...args)\n } catch (err) {\n display.error(errorMsg, err)\n }\n }\n}\n"],"mappings":";;AAEA,SAAgB,gBAAuC,IAA0B,UAAkB;CACjG,QAAQ,GAAG,SAAe;EACxB,IAAI;GACF,OAAO,GAAG,GAAG,IAAI;EACnB,SAAS,KAAK;GACZ,QAAQ,MAAM,UAAU,GAAG;EAC7B;CACF;AACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createDisplay } from "@openobserve/js-core/util";
|
|
2
|
+
//#region src/tools/display.ts
|
|
3
|
+
const display = createDisplay("OpenObserve Browser SDK:");
|
|
4
|
+
const DOCS_ORIGIN = "https://openobserve.ai";
|
|
5
|
+
const DOCS_TROUBLESHOOTING = `${DOCS_ORIGIN}/docs/user-guide/rum/`;
|
|
6
|
+
const MORE_DETAILS = "More details:";
|
|
7
|
+
//#endregion
|
|
8
|
+
export { DOCS_ORIGIN, DOCS_TROUBLESHOOTING, MORE_DETAILS, display };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=display.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.mjs","names":[],"sources":["../../src/tools/display.ts"],"sourcesContent":["/* eslint-disable local-rules/disallow-side-effects */\nimport { createDisplay } from '@openobserve/js-core/util'\n\nexport const display = createDisplay('OpenObserve Browser SDK:')\n\nexport const DOCS_ORIGIN = 'https://openobserve.ai'\nexport const DOCS_TROUBLESHOOTING = `${DOCS_ORIGIN}/docs/user-guide/rum/`\nexport const MORE_DETAILS = 'More details:'\n"],"mappings":";;AAGA,MAAa,UAAU,cAAc,0BAA0B;AAE/D,MAAa,cAAc;AAC3B,MAAa,uBAAuB,GAAG,YAAY;AACnD,MAAa,eAAe"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { computeBytesCount } from "./utils/byteUtils.mjs";
|
|
2
|
+
//#region src/tools/encoder.ts
|
|
3
|
+
function createIdentityEncoder() {
|
|
4
|
+
let output = "";
|
|
5
|
+
let outputBytesCount = 0;
|
|
6
|
+
return {
|
|
7
|
+
isAsync: false,
|
|
8
|
+
get isEmpty() {
|
|
9
|
+
return !output;
|
|
10
|
+
},
|
|
11
|
+
write(data, callback) {
|
|
12
|
+
const additionalEncodedBytesCount = computeBytesCount(data);
|
|
13
|
+
outputBytesCount += additionalEncodedBytesCount;
|
|
14
|
+
output += data;
|
|
15
|
+
if (callback) callback(additionalEncodedBytesCount);
|
|
16
|
+
},
|
|
17
|
+
finish(callback) {
|
|
18
|
+
callback(this.finishSync());
|
|
19
|
+
},
|
|
20
|
+
finishSync() {
|
|
21
|
+
const result = {
|
|
22
|
+
output,
|
|
23
|
+
outputBytesCount,
|
|
24
|
+
rawBytesCount: outputBytesCount,
|
|
25
|
+
pendingData: ""
|
|
26
|
+
};
|
|
27
|
+
output = "";
|
|
28
|
+
outputBytesCount = 0;
|
|
29
|
+
return result;
|
|
30
|
+
},
|
|
31
|
+
estimateEncodedBytesCount(data) {
|
|
32
|
+
return data.length;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { createIdentityEncoder };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=encoder.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoder.mjs","names":[],"sources":["../../src/tools/encoder.ts"],"sourcesContent":["import type { Uint8ArrayBuffer } from './utils/byteUtils'\nimport { computeBytesCount } from './utils/byteUtils'\n\nexport interface Encoder<Output extends string | Uint8ArrayBuffer = string | Uint8ArrayBuffer> {\n /**\n * Whether this encoder might call the provided callbacks asynchronously\n */\n isAsync: boolean\n\n /**\n * Whether some data has been written since the last finish() or finishSync() call\n */\n isEmpty: boolean\n\n /**\n * Write a string to be encoded.\n *\n * This operation can be synchronous or asynchronous depending on the encoder implementation.\n *\n * If specified, the callback will be invoked when the operation finishes, unless the operation is\n * asynchronous and finish() or finishSync() is called in the meantime.\n */\n write(data: string, callback?: (additionalEncodedBytesCount: number) => void): void\n\n /**\n * Waits for pending data to be encoded and resets the encoder state.\n *\n * This operation can be synchronous or asynchronous depending on the encoder implementation.\n *\n * The callback will be invoked when the operation finishes, unless the operation is asynchronous\n * and another call to finish() or finishSync() occurs in the meantime.\n */\n finish(callback: (result: EncoderResult<Output>) => void): void\n\n /**\n * Resets the encoder state then returns the encoded data and any potential pending data directly,\n * discarding all pending write operations and finish() callbacks.\n */\n finishSync(): EncoderResult<Output> & { pendingData: string }\n\n /**\n * Returns a rough estimation of the bytes count if the data was encoded.\n */\n estimateEncodedBytesCount(data: string): number\n}\n\nexport interface EncoderResult<Output extends string | Uint8ArrayBuffer = string | Uint8ArrayBuffer> {\n output: Output\n outputBytesCount: number\n\n /**\n * An encoding type supported by HTTP Content-Encoding, if applicable.\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding#directives\n */\n encoding?: 'deflate'\n\n /**\n * Total bytes count of the input strings encoded to UTF-8.\n */\n rawBytesCount: number\n}\n\nexport function createIdentityEncoder(): Encoder<string> {\n let output = ''\n let outputBytesCount = 0\n\n return {\n isAsync: false,\n\n get isEmpty() {\n return !output\n },\n\n write(data, callback) {\n const additionalEncodedBytesCount = computeBytesCount(data)\n outputBytesCount += additionalEncodedBytesCount\n output += data\n if (callback) {\n callback(additionalEncodedBytesCount)\n }\n },\n\n finish(callback) {\n callback(this.finishSync())\n },\n\n finishSync() {\n const result = {\n output,\n outputBytesCount,\n rawBytesCount: outputBytesCount,\n pendingData: '',\n }\n output = ''\n outputBytesCount = 0\n return result\n },\n\n estimateEncodedBytesCount(data) {\n return data.length\n },\n }\n}\n"],"mappings":";;AA8DA,SAAgB,wBAAyC;CACvD,IAAI,SAAS;CACb,IAAI,mBAAmB;CAEvB,OAAO;EACL,SAAS;EAET,IAAI,UAAU;GACZ,OAAO,CAAC;EACV;EAEA,MAAM,MAAM,UAAU;GACpB,MAAM,8BAA8B,kBAAkB,IAAI;GAC1D,oBAAoB;GACpB,UAAU;GACV,IAAI,UACF,SAAS,2BAA2B;EAExC;EAEA,OAAO,UAAU;GACf,SAAS,KAAK,WAAW,CAAC;EAC5B;EAEA,aAAa;GACX,MAAM,SAAS;IACb;IACA;IACA,eAAe;IACf,aAAa;GACf;GACA,SAAS;GACT,mBAAmB;GACnB,OAAO;EACT;EAEA,0BAA0B,MAAM;GAC9B,OAAO,KAAK;EACd;CACF;AACF"}
|