@openobserve/browser-core 0.2.8
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/LICENSE +201 -0
- package/README.md +3 -0
- package/cjs/boot/init.d.ts +5 -0
- package/cjs/boot/init.js +36 -0
- package/cjs/boot/init.js.map +1 -0
- package/cjs/browser/addEventListener.d.ts +76 -0
- package/cjs/browser/addEventListener.js +52 -0
- package/cjs/browser/addEventListener.js.map +1 -0
- package/cjs/browser/cookie.d.ts +10 -0
- package/cjs/browser/cookie.js +69 -0
- package/cjs/browser/cookie.js.map +1 -0
- package/cjs/browser/fetchObservable.d.ts +23 -0
- package/cjs/browser/fetchObservable.js +74 -0
- package/cjs/browser/fetchObservable.js.map +1 -0
- package/cjs/browser/pageExitObservable.d.ts +14 -0
- package/cjs/browser/pageExitObservable.js +58 -0
- package/cjs/browser/pageExitObservable.js.map +1 -0
- package/cjs/browser/runOnReadyState.d.ts +2 -0
- package/cjs/browser/runOnReadyState.js +15 -0
- package/cjs/browser/runOnReadyState.js.map +1 -0
- package/cjs/browser/types.d.ts +19 -0
- package/cjs/browser/types.js +6 -0
- package/cjs/browser/types.js.map +1 -0
- package/cjs/browser/xhrObservable.d.ts +22 -0
- package/cjs/browser/xhrObservable.js +93 -0
- package/cjs/browser/xhrObservable.js.map +1 -0
- package/cjs/domain/configuration/configuration.d.ts +67 -0
- package/cjs/domain/configuration/configuration.js +95 -0
- package/cjs/domain/configuration/configuration.js.map +1 -0
- package/cjs/domain/configuration/endpointBuilder.d.ts +14 -0
- package/cjs/domain/configuration/endpointBuilder.js +94 -0
- package/cjs/domain/configuration/endpointBuilder.js.map +1 -0
- package/cjs/domain/configuration/index.d.ts +3 -0
- package/cjs/domain/configuration/index.js +25 -0
- package/cjs/domain/configuration/index.js.map +1 -0
- package/cjs/domain/configuration/intakeSites.d.ts +5 -0
- package/cjs/domain/configuration/intakeSites.js +9 -0
- package/cjs/domain/configuration/intakeSites.js.map +1 -0
- package/cjs/domain/configuration/tags.d.ts +4 -0
- package/cjs/domain/configuration/tags.js +39 -0
- package/cjs/domain/configuration/tags.js.map +1 -0
- package/cjs/domain/configuration/transportConfiguration.d.ts +16 -0
- package/cjs/domain/configuration/transportConfiguration.js +42 -0
- package/cjs/domain/configuration/transportConfiguration.js.map +1 -0
- package/cjs/domain/console/consoleObservable.d.ts +11 -0
- package/cjs/domain/console/consoleObservable.js +75 -0
- package/cjs/domain/console/consoleObservable.js.map +1 -0
- package/cjs/domain/deflate/index.d.ts +1 -0
- package/cjs/domain/deflate/index.js +18 -0
- package/cjs/domain/deflate/index.js.map +1 -0
- package/cjs/domain/deflate/types.d.ts +26 -0
- package/cjs/domain/deflate/types.js +3 -0
- package/cjs/domain/deflate/types.js.map +1 -0
- package/cjs/domain/error/error.d.ts +28 -0
- package/cjs/domain/error/error.js +131 -0
- package/cjs/domain/error/error.js.map +1 -0
- package/cjs/domain/error/error.types.d.ts +40 -0
- package/cjs/domain/error/error.types.js +13 -0
- package/cjs/domain/error/error.types.js.map +1 -0
- package/cjs/domain/error/trackRuntimeError.d.ts +5 -0
- package/cjs/domain/error/trackRuntimeError.js +21 -0
- package/cjs/domain/error/trackRuntimeError.js.map +1 -0
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.d.ts +5 -0
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js +40 -0
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -0
- package/cjs/domain/report/browser.types.d.ts +24 -0
- package/cjs/domain/report/browser.types.js +3 -0
- package/cjs/domain/report/browser.types.js.map +1 -0
- package/cjs/domain/report/reportObservable.d.ts +15 -0
- package/cjs/domain/report/reportObservable.js +94 -0
- package/cjs/domain/report/reportObservable.js.map +1 -0
- package/cjs/domain/resourceUtils.d.ts +16 -0
- package/cjs/domain/resourceUtils.js +3 -0
- package/cjs/domain/resourceUtils.js.map +1 -0
- package/cjs/domain/session/oldCookiesMigration.d.ts +11 -0
- package/cjs/domain/session/oldCookiesMigration.js +40 -0
- package/cjs/domain/session/oldCookiesMigration.js.map +1 -0
- package/cjs/domain/session/sessionConstants.d.ts +2 -0
- package/cjs/domain/session/sessionConstants.js +7 -0
- package/cjs/domain/session/sessionConstants.js.map +1 -0
- package/cjs/domain/session/sessionManager.d.ts +20 -0
- package/cjs/domain/session/sessionManager.js +65 -0
- package/cjs/domain/session/sessionManager.js.map +1 -0
- package/cjs/domain/session/sessionState.d.ts +11 -0
- package/cjs/domain/session/sessionState.js +45 -0
- package/cjs/domain/session/sessionState.js.map +1 -0
- package/cjs/domain/session/sessionStore.d.ts +34 -0
- package/cjs/domain/session/sessionStore.js +144 -0
- package/cjs/domain/session/sessionStore.js.map +1 -0
- package/cjs/domain/session/sessionStoreOperations.d.ts +15 -0
- package/cjs/domain/session/sessionStoreOperations.js +104 -0
- package/cjs/domain/session/sessionStoreOperations.js.map +1 -0
- package/cjs/domain/session/storeStrategies/sessionInCookie.d.ts +6 -0
- package/cjs/domain/session/storeStrategies/sessionInCookie.js +48 -0
- package/cjs/domain/session/storeStrategies/sessionInCookie.js.map +1 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.d.ts +3 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js +40 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -0
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.d.ts +14 -0
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js +5 -0
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js.map +1 -0
- package/cjs/domain/synthetics/syntheticsWorkerValues.d.ts +11 -0
- package/cjs/domain/synthetics/syntheticsWorkerValues.js +22 -0
- package/cjs/domain/synthetics/syntheticsWorkerValues.js.map +1 -0
- package/cjs/domain/telemetry/index.d.ts +3 -0
- package/cjs/domain/telemetry/index.js +28 -0
- package/cjs/domain/telemetry/index.js.map +1 -0
- package/cjs/domain/telemetry/rawTelemetryEvent.types.d.ts +11 -0
- package/cjs/domain/telemetry/rawTelemetryEvent.types.js +8 -0
- package/cjs/domain/telemetry/rawTelemetryEvent.types.js.map +1 -0
- package/cjs/domain/telemetry/telemetry.d.ts +112 -0
- package/cjs/domain/telemetry/telemetry.js +146 -0
- package/cjs/domain/telemetry/telemetry.js.map +1 -0
- package/cjs/domain/telemetry/telemetryEvent.types.d.ts +375 -0
- package/cjs/domain/telemetry/telemetryEvent.types.js +7 -0
- package/cjs/domain/telemetry/telemetryEvent.types.js.map +1 -0
- package/cjs/domain/tracekit/computeStackTrace.d.ts +5 -0
- package/cjs/domain/tracekit/computeStackTrace.js +118 -0
- package/cjs/domain/tracekit/computeStackTrace.js.map +1 -0
- package/cjs/domain/tracekit/index.d.ts +3 -0
- package/cjs/domain/tracekit/index.js +8 -0
- package/cjs/domain/tracekit/index.js.map +1 -0
- package/cjs/domain/tracekit/tracekit.d.ts +35 -0
- package/cjs/domain/tracekit/tracekit.js +95 -0
- package/cjs/domain/tracekit/tracekit.js.map +1 -0
- package/cjs/domain/tracekit/types.d.ts +44 -0
- package/cjs/domain/tracekit/types.js +3 -0
- package/cjs/domain/tracekit/types.js.map +1 -0
- package/cjs/domain/user/index.d.ts +2 -0
- package/cjs/domain/user/index.js +19 -0
- package/cjs/domain/user/index.js.map +1 -0
- package/cjs/domain/user/user.d.ts +12 -0
- package/cjs/domain/user/user.js +35 -0
- package/cjs/domain/user/user.js.map +1 -0
- package/cjs/domain/user/user.types.d.ts +6 -0
- package/cjs/domain/user/user.types.js +3 -0
- package/cjs/domain/user/user.types.js.map +1 -0
- package/cjs/index.d.ts +63 -0
- package/cjs/index.js +155 -0
- package/cjs/index.js.map +1 -0
- package/cjs/tools/abstractLifeCycle.d.ts +23 -0
- package/cjs/tools/abstractLifeCycle.js +29 -0
- package/cjs/tools/abstractLifeCycle.js.map +1 -0
- package/cjs/tools/boundedBuffer.d.ts +5 -0
- package/cjs/tools/boundedBuffer.js +22 -0
- package/cjs/tools/boundedBuffer.js.map +1 -0
- package/cjs/tools/catchUserErrors.d.ts +1 -0
- package/cjs/tools/catchUserErrors.js +20 -0
- package/cjs/tools/catchUserErrors.js.map +1 -0
- package/cjs/tools/display.d.ts +35 -0
- package/cjs/tools/display.js +45 -0
- package/cjs/tools/display.js.map +1 -0
- package/cjs/tools/experimentalFeatures.d.ts +24 -0
- package/cjs/tools/experimentalFeatures.js +47 -0
- package/cjs/tools/experimentalFeatures.js.map +1 -0
- package/cjs/tools/getGlobalObject.d.ts +4 -0
- package/cjs/tools/getGlobalObject.js +37 -0
- package/cjs/tools/getGlobalObject.js.map +1 -0
- package/cjs/tools/getZoneJsOriginalValue.d.ts +19 -0
- package/cjs/tools/getZoneJsOriginalValue.js +30 -0
- package/cjs/tools/getZoneJsOriginalValue.js.map +1 -0
- package/cjs/tools/instrumentMethod.d.ts +19 -0
- package/cjs/tools/instrumentMethod.js +83 -0
- package/cjs/tools/instrumentMethod.js.map +1 -0
- package/cjs/tools/matchOption.d.ts +8 -0
- package/cjs/tools/matchOption.js +38 -0
- package/cjs/tools/matchOption.js.map +1 -0
- package/cjs/tools/mergeInto.d.ts +25 -0
- package/cjs/tools/mergeInto.js +105 -0
- package/cjs/tools/mergeInto.js.map +1 -0
- package/cjs/tools/monitor.d.ts +9 -0
- package/cjs/tools/monitor.js +76 -0
- package/cjs/tools/monitor.js.map +1 -0
- package/cjs/tools/observable.d.ts +12 -0
- package/cjs/tools/observable.js +44 -0
- package/cjs/tools/observable.js.map +1 -0
- package/cjs/tools/readBytesFromStream.d.ts +11 -0
- package/cjs/tools/readBytesFromStream.js +64 -0
- package/cjs/tools/readBytesFromStream.js.map +1 -0
- package/cjs/tools/sendToExtension.d.ts +3 -0
- package/cjs/tools/sendToExtension.js +11 -0
- package/cjs/tools/sendToExtension.js.map +1 -0
- package/cjs/tools/serialisation/context.d.ts +6 -0
- package/cjs/tools/serialisation/context.js +3 -0
- package/cjs/tools/serialisation/context.js.map +1 -0
- package/cjs/tools/serialisation/contextManager.d.ts +21 -0
- package/cjs/tools/serialisation/contextManager.js +70 -0
- package/cjs/tools/serialisation/contextManager.js.map +1 -0
- package/cjs/tools/serialisation/heavyCustomerDataWarning.d.ts +8 -0
- package/cjs/tools/serialisation/heavyCustomerDataWarning.js +18 -0
- package/cjs/tools/serialisation/heavyCustomerDataWarning.js.map +1 -0
- package/cjs/tools/serialisation/jsonStringify.d.ts +14 -0
- package/cjs/tools/serialisation/jsonStringify.js +49 -0
- package/cjs/tools/serialisation/jsonStringify.js.map +1 -0
- package/cjs/tools/serialisation/sanitize.d.ts +18 -0
- package/cjs/tools/serialisation/sanitize.js +185 -0
- package/cjs/tools/serialisation/sanitize.js.map +1 -0
- package/cjs/tools/timer.d.ts +5 -0
- package/cjs/tools/timer.js +23 -0
- package/cjs/tools/timer.js.map +1 -0
- package/cjs/tools/utils/arrayUtils.d.ts +1 -0
- package/cjs/tools/utils/arrayUtils.js +11 -0
- package/cjs/tools/utils/arrayUtils.js.map +1 -0
- package/cjs/tools/utils/browserDetection.d.ts +2 -0
- package/cjs/tools/utils/browserDetection.js +12 -0
- package/cjs/tools/utils/browserDetection.js.map +1 -0
- package/cjs/tools/utils/byteUtils.d.ts +4 -0
- package/cjs/tools/utils/byteUtils.js +31 -0
- package/cjs/tools/utils/byteUtils.js.map +1 -0
- package/cjs/tools/utils/functionUtils.d.ts +9 -0
- package/cjs/tools/utils/functionUtils.js +48 -0
- package/cjs/tools/utils/functionUtils.js.map +1 -0
- package/cjs/tools/utils/numberUtils.d.ts +8 -0
- package/cjs/tools/utils/numberUtils.js +24 -0
- package/cjs/tools/utils/numberUtils.js.map +1 -0
- package/cjs/tools/utils/objectUtils.d.ts +10 -0
- package/cjs/tools/utils/objectUtils.js +26 -0
- package/cjs/tools/utils/objectUtils.js.map +1 -0
- package/cjs/tools/utils/polyfills.d.ts +24 -0
- package/cjs/tools/utils/polyfills.js +110 -0
- package/cjs/tools/utils/polyfills.js.map +1 -0
- package/cjs/tools/utils/responseUtils.d.ts +2 -0
- package/cjs/tools/utils/responseUtils.js +18 -0
- package/cjs/tools/utils/responseUtils.js.map +1 -0
- package/cjs/tools/utils/stringUtils.d.ts +7 -0
- package/cjs/tools/utils/stringUtils.js +32 -0
- package/cjs/tools/utils/stringUtils.js.map +1 -0
- package/cjs/tools/utils/timeUtils.d.ts +57 -0
- package/cjs/tools/utils/timeUtils.js +99 -0
- package/cjs/tools/utils/timeUtils.js.map +1 -0
- package/cjs/tools/utils/typeUtils.d.ts +4 -0
- package/cjs/tools/utils/typeUtils.js +17 -0
- package/cjs/tools/utils/typeUtils.js.map +1 -0
- package/cjs/tools/utils/urlPolyfill.d.ts +14 -0
- package/cjs/tools/utils/urlPolyfill.js +92 -0
- package/cjs/tools/utils/urlPolyfill.js.map +1 -0
- package/cjs/tools/valueHistory.d.ts +50 -0
- package/cjs/tools/valueHistory.js +106 -0
- package/cjs/tools/valueHistory.js.map +1 -0
- package/cjs/transport/batch.d.ts +19 -0
- package/cjs/transport/batch.js +79 -0
- package/cjs/transport/batch.js.map +1 -0
- package/cjs/transport/eventBridge.d.ts +12 -0
- package/cjs/transport/eventBridge.js +34 -0
- package/cjs/transport/eventBridge.js.map +1 -0
- package/cjs/transport/flushController.d.ts +48 -0
- package/cjs/transport/flushController.js +97 -0
- package/cjs/transport/flushController.js.map +1 -0
- package/cjs/transport/httpRequest.d.ts +37 -0
- package/cjs/transport/httpRequest.js +91 -0
- package/cjs/transport/httpRequest.js.map +1 -0
- package/cjs/transport/index.d.ts +4 -0
- package/cjs/transport/index.js +13 -0
- package/cjs/transport/index.js.map +1 -0
- package/cjs/transport/sendWithRetryStrategy.d.ts +39 -0
- package/cjs/transport/sendWithRetryStrategy.js +151 -0
- package/cjs/transport/sendWithRetryStrategy.js.map +1 -0
- package/cjs/transport/startBatchWithReplica.d.ts +15 -0
- package/cjs/transport/startBatchWithReplica.js +37 -0
- package/cjs/transport/startBatchWithReplica.js.map +1 -0
- package/esm/boot/init.d.ts +5 -0
- package/esm/boot/init.js +31 -0
- package/esm/boot/init.js.map +1 -0
- package/esm/browser/addEventListener.d.ts +76 -0
- package/esm/browser/addEventListener.js +47 -0
- package/esm/browser/addEventListener.js.map +1 -0
- package/esm/browser/cookie.d.ts +10 -0
- package/esm/browser/cookie.js +61 -0
- package/esm/browser/cookie.js.map +1 -0
- package/esm/browser/fetchObservable.d.ts +23 -0
- package/esm/browser/fetchObservable.js +70 -0
- package/esm/browser/fetchObservable.js.map +1 -0
- package/esm/browser/pageExitObservable.d.ts +14 -0
- package/esm/browser/pageExitObservable.js +53 -0
- package/esm/browser/pageExitObservable.js.map +1 -0
- package/esm/browser/runOnReadyState.d.ts +2 -0
- package/esm/browser/runOnReadyState.js +11 -0
- package/esm/browser/runOnReadyState.js.map +1 -0
- package/esm/browser/types.d.ts +19 -0
- package/esm/browser/types.js +5 -0
- package/esm/browser/types.js.map +1 -0
- package/esm/browser/xhrObservable.d.ts +22 -0
- package/esm/browser/xhrObservable.js +89 -0
- package/esm/browser/xhrObservable.js.map +1 -0
- package/esm/domain/configuration/configuration.d.ts +67 -0
- package/esm/domain/configuration/configuration.js +90 -0
- package/esm/domain/configuration/configuration.js.map +1 -0
- package/esm/domain/configuration/endpointBuilder.d.ts +14 -0
- package/esm/domain/configuration/endpointBuilder.js +90 -0
- package/esm/domain/configuration/endpointBuilder.js.map +1 -0
- package/esm/domain/configuration/index.d.ts +3 -0
- package/esm/domain/configuration/index.js +4 -0
- package/esm/domain/configuration/index.js.map +1 -0
- package/esm/domain/configuration/intakeSites.d.ts +5 -0
- package/esm/domain/configuration/intakeSites.js +6 -0
- package/esm/domain/configuration/intakeSites.js.map +1 -0
- package/esm/domain/configuration/tags.d.ts +4 -0
- package/esm/domain/configuration/tags.js +34 -0
- package/esm/domain/configuration/tags.js.map +1 -0
- package/esm/domain/configuration/transportConfiguration.d.ts +16 -0
- package/esm/domain/configuration/transportConfiguration.js +38 -0
- package/esm/domain/configuration/transportConfiguration.js.map +1 -0
- package/esm/domain/console/consoleObservable.d.ts +11 -0
- package/esm/domain/console/consoleObservable.js +70 -0
- package/esm/domain/console/consoleObservable.js.map +1 -0
- package/esm/domain/deflate/index.d.ts +1 -0
- package/esm/domain/deflate/index.js +2 -0
- package/esm/domain/deflate/index.js.map +1 -0
- package/esm/domain/deflate/types.d.ts +26 -0
- package/esm/domain/deflate/types.js +2 -0
- package/esm/domain/deflate/types.js.map +1 -0
- package/esm/domain/error/error.d.ts +28 -0
- package/esm/domain/error/error.js +121 -0
- package/esm/domain/error/error.js.map +1 -0
- package/esm/domain/error/error.types.d.ts +40 -0
- package/esm/domain/error/error.types.js +10 -0
- package/esm/domain/error/error.types.js.map +1 -0
- package/esm/domain/error/trackRuntimeError.d.ts +5 -0
- package/esm/domain/error/trackRuntimeError.js +17 -0
- package/esm/domain/error/trackRuntimeError.js.map +1 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.d.ts +5 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js +36 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -0
- package/esm/domain/report/browser.types.d.ts +24 -0
- package/esm/domain/report/browser.types.js +2 -0
- package/esm/domain/report/browser.types.js.map +1 -0
- package/esm/domain/report/reportObservable.d.ts +15 -0
- package/esm/domain/report/reportObservable.js +90 -0
- package/esm/domain/report/reportObservable.js.map +1 -0
- package/esm/domain/resourceUtils.d.ts +16 -0
- package/esm/domain/resourceUtils.js +2 -0
- package/esm/domain/resourceUtils.js.map +1 -0
- package/esm/domain/session/oldCookiesMigration.d.ts +11 -0
- package/esm/domain/session/oldCookiesMigration.js +36 -0
- package/esm/domain/session/oldCookiesMigration.js.map +1 -0
- package/esm/domain/session/sessionConstants.d.ts +2 -0
- package/esm/domain/session/sessionConstants.js +4 -0
- package/esm/domain/session/sessionConstants.js.map +1 -0
- package/esm/domain/session/sessionManager.d.ts +20 -0
- package/esm/domain/session/sessionManager.js +60 -0
- package/esm/domain/session/sessionManager.js.map +1 -0
- package/esm/domain/session/sessionState.d.ts +11 -0
- package/esm/domain/session/sessionState.js +38 -0
- package/esm/domain/session/sessionState.js.map +1 -0
- package/esm/domain/session/sessionStore.d.ts +34 -0
- package/esm/domain/session/sessionStore.js +139 -0
- package/esm/domain/session/sessionStore.js.map +1 -0
- package/esm/domain/session/sessionStoreOperations.d.ts +15 -0
- package/esm/domain/session/sessionStoreOperations.js +99 -0
- package/esm/domain/session/sessionStoreOperations.js.map +1 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.d.ts +6 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.js +42 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.js.map +1 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.d.ts +3 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js +35 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.d.ts +14 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.js +2 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.js.map +1 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.d.ts +11 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.js +16 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.js.map +1 -0
- package/esm/domain/telemetry/index.d.ts +3 -0
- package/esm/domain/telemetry/index.js +4 -0
- package/esm/domain/telemetry/index.js.map +1 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.d.ts +11 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.js +5 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.js.map +1 -0
- package/esm/domain/telemetry/telemetry.d.ts +112 -0
- package/esm/domain/telemetry/telemetry.js +134 -0
- package/esm/domain/telemetry/telemetry.js.map +1 -0
- package/esm/domain/telemetry/telemetryEvent.types.d.ts +375 -0
- package/esm/domain/telemetry/telemetryEvent.types.js +6 -0
- package/esm/domain/telemetry/telemetryEvent.types.js.map +1 -0
- package/esm/domain/tracekit/computeStackTrace.d.ts +5 -0
- package/esm/domain/tracekit/computeStackTrace.js +114 -0
- package/esm/domain/tracekit/computeStackTrace.js.map +1 -0
- package/esm/domain/tracekit/index.d.ts +3 -0
- package/esm/domain/tracekit/index.js +3 -0
- package/esm/domain/tracekit/index.js.map +1 -0
- package/esm/domain/tracekit/tracekit.d.ts +35 -0
- package/esm/domain/tracekit/tracekit.js +91 -0
- package/esm/domain/tracekit/tracekit.js.map +1 -0
- package/esm/domain/tracekit/types.d.ts +44 -0
- package/esm/domain/tracekit/types.js +2 -0
- package/esm/domain/tracekit/types.js.map +1 -0
- package/esm/domain/user/index.d.ts +2 -0
- package/esm/domain/user/index.js +3 -0
- package/esm/domain/user/index.js.map +1 -0
- package/esm/domain/user/user.d.ts +12 -0
- package/esm/domain/user/user.js +30 -0
- package/esm/domain/user/user.js.map +1 -0
- package/esm/domain/user/user.types.d.ts +6 -0
- package/esm/domain/user/user.types.js +2 -0
- package/esm/domain/user/user.types.js.map +1 -0
- package/esm/index.d.ts +63 -0
- package/esm/index.js +61 -0
- package/esm/index.js.map +1 -0
- package/esm/tools/abstractLifeCycle.d.ts +23 -0
- package/esm/tools/abstractLifeCycle.js +26 -0
- package/esm/tools/abstractLifeCycle.js.map +1 -0
- package/esm/tools/boundedBuffer.d.ts +5 -0
- package/esm/tools/boundedBuffer.js +19 -0
- package/esm/tools/boundedBuffer.js.map +1 -0
- package/esm/tools/catchUserErrors.d.ts +1 -0
- package/esm/tools/catchUserErrors.js +16 -0
- package/esm/tools/catchUserErrors.js.map +1 -0
- package/esm/tools/display.d.ts +35 -0
- package/esm/tools/display.js +41 -0
- package/esm/tools/display.js.map +1 -0
- package/esm/tools/experimentalFeatures.d.ts +24 -0
- package/esm/tools/experimentalFeatures.js +40 -0
- package/esm/tools/experimentalFeatures.js.map +1 -0
- package/esm/tools/getGlobalObject.d.ts +4 -0
- package/esm/tools/getGlobalObject.js +33 -0
- package/esm/tools/getGlobalObject.js.map +1 -0
- package/esm/tools/getZoneJsOriginalValue.d.ts +19 -0
- package/esm/tools/getZoneJsOriginalValue.js +26 -0
- package/esm/tools/getZoneJsOriginalValue.js.map +1 -0
- package/esm/tools/instrumentMethod.d.ts +19 -0
- package/esm/tools/instrumentMethod.js +77 -0
- package/esm/tools/instrumentMethod.js.map +1 -0
- package/esm/tools/matchOption.d.ts +8 -0
- package/esm/tools/matchOption.js +33 -0
- package/esm/tools/matchOption.js.map +1 -0
- package/esm/tools/mergeInto.d.ts +25 -0
- package/esm/tools/mergeInto.js +99 -0
- package/esm/tools/mergeInto.js.map +1 -0
- package/esm/tools/monitor.d.ts +9 -0
- package/esm/tools/monitor.js +66 -0
- package/esm/tools/monitor.js.map +1 -0
- package/esm/tools/observable.d.ts +12 -0
- package/esm/tools/observable.js +40 -0
- package/esm/tools/observable.js.map +1 -0
- package/esm/tools/readBytesFromStream.d.ts +11 -0
- package/esm/tools/readBytesFromStream.js +60 -0
- package/esm/tools/readBytesFromStream.js.map +1 -0
- package/esm/tools/sendToExtension.d.ts +3 -0
- package/esm/tools/sendToExtension.js +7 -0
- package/esm/tools/sendToExtension.js.map +1 -0
- package/esm/tools/serialisation/context.d.ts +6 -0
- package/esm/tools/serialisation/context.js +2 -0
- package/esm/tools/serialisation/context.js.map +1 -0
- package/esm/tools/serialisation/contextManager.d.ts +21 -0
- package/esm/tools/serialisation/contextManager.js +66 -0
- package/esm/tools/serialisation/contextManager.js.map +1 -0
- package/esm/tools/serialisation/heavyCustomerDataWarning.d.ts +8 -0
- package/esm/tools/serialisation/heavyCustomerDataWarning.js +14 -0
- package/esm/tools/serialisation/heavyCustomerDataWarning.js.map +1 -0
- package/esm/tools/serialisation/jsonStringify.d.ts +14 -0
- package/esm/tools/serialisation/jsonStringify.js +44 -0
- package/esm/tools/serialisation/jsonStringify.js.map +1 -0
- package/esm/tools/serialisation/sanitize.d.ts +18 -0
- package/esm/tools/serialisation/sanitize.js +181 -0
- package/esm/tools/serialisation/sanitize.js.map +1 -0
- package/esm/tools/timer.d.ts +5 -0
- package/esm/tools/timer.js +16 -0
- package/esm/tools/timer.js.map +1 -0
- package/esm/tools/utils/arrayUtils.d.ts +1 -0
- package/esm/tools/utils/arrayUtils.js +7 -0
- package/esm/tools/utils/arrayUtils.js.map +1 -0
- package/esm/tools/utils/browserDetection.d.ts +2 -0
- package/esm/tools/utils/browserDetection.js +7 -0
- package/esm/tools/utils/browserDetection.js.map +1 -0
- package/esm/tools/utils/byteUtils.d.ts +4 -0
- package/esm/tools/utils/byteUtils.js +26 -0
- package/esm/tools/utils/byteUtils.js.map +1 -0
- package/esm/tools/utils/functionUtils.d.ts +9 -0
- package/esm/tools/utils/functionUtils.js +43 -0
- package/esm/tools/utils/functionUtils.js.map +1 -0
- package/esm/tools/utils/numberUtils.d.ts +8 -0
- package/esm/tools/utils/numberUtils.js +17 -0
- package/esm/tools/utils/numberUtils.js.map +1 -0
- package/esm/tools/utils/objectUtils.d.ts +10 -0
- package/esm/tools/utils/objectUtils.js +19 -0
- package/esm/tools/utils/objectUtils.js.map +1 -0
- package/esm/tools/utils/polyfills.d.ts +24 -0
- package/esm/tools/utils/polyfills.js +95 -0
- package/esm/tools/utils/polyfills.js.map +1 -0
- package/esm/tools/utils/responseUtils.d.ts +2 -0
- package/esm/tools/utils/responseUtils.js +13 -0
- package/esm/tools/utils/responseUtils.js.map +1 -0
- package/esm/tools/utils/stringUtils.d.ts +7 -0
- package/esm/tools/utils/stringUtils.js +26 -0
- package/esm/tools/utils/stringUtils.js.map +1 -0
- package/esm/tools/utils/timeUtils.d.ts +57 -0
- package/esm/tools/utils/timeUtils.js +82 -0
- package/esm/tools/utils/timeUtils.js.map +1 -0
- package/esm/tools/utils/typeUtils.d.ts +4 -0
- package/esm/tools/utils/typeUtils.js +13 -0
- package/esm/tools/utils/typeUtils.js.map +1 -0
- package/esm/tools/utils/urlPolyfill.d.ts +14 -0
- package/esm/tools/utils/urlPolyfill.js +80 -0
- package/esm/tools/utils/urlPolyfill.js.map +1 -0
- package/esm/tools/valueHistory.d.ts +50 -0
- package/esm/tools/valueHistory.js +103 -0
- package/esm/tools/valueHistory.js.map +1 -0
- package/esm/transport/batch.d.ts +19 -0
- package/esm/transport/batch.js +76 -0
- package/esm/transport/batch.js.map +1 -0
- package/esm/transport/eventBridge.d.ts +12 -0
- package/esm/transport/eventBridge.js +29 -0
- package/esm/transport/eventBridge.js.map +1 -0
- package/esm/transport/flushController.d.ts +48 -0
- package/esm/transport/flushController.js +93 -0
- package/esm/transport/flushController.js.map +1 -0
- package/esm/transport/httpRequest.d.ts +37 -0
- package/esm/transport/httpRequest.js +85 -0
- package/esm/transport/httpRequest.js.map +1 -0
- package/esm/transport/index.d.ts +4 -0
- package/esm/transport/index.js +5 -0
- package/esm/transport/index.js.map +1 -0
- package/esm/transport/sendWithRetryStrategy.d.ts +39 -0
- package/esm/transport/sendWithRetryStrategy.js +146 -0
- package/esm/transport/sendWithRetryStrategy.js.map +1 -0
- package/esm/transport/startBatchWithReplica.d.ts +15 -0
- package/esm/transport/startBatchWithReplica.js +33 -0
- package/esm/transport/startBatchWithReplica.js.map +1 -0
- package/package.json +26 -0
- package/src/boot/init.ts +41 -0
- package/src/browser/addEventListener.ts +136 -0
- package/src/browser/cookie.ts +71 -0
- package/src/browser/fetchObservable.ts +112 -0
- package/src/browser/pageExitObservable.ts +69 -0
- package/src/browser/runOnReadyState.ts +15 -0
- package/src/browser/types.ts +40 -0
- package/src/browser/xhrObservable.ts +127 -0
- package/src/domain/configuration/configuration.ts +191 -0
- package/src/domain/configuration/endpointBuilder.ts +134 -0
- package/src/domain/configuration/index.ts +9 -0
- package/src/domain/configuration/intakeSites.ts +5 -0
- package/src/domain/configuration/tags.ts +43 -0
- package/src/domain/configuration/transportConfiguration.ts +71 -0
- package/src/domain/console/consoleObservable.ts +86 -0
- package/src/domain/deflate/index.ts +1 -0
- package/src/domain/deflate/types.ts +41 -0
- package/src/domain/error/error.ts +159 -0
- package/src/domain/error/error.types.ts +47 -0
- package/src/domain/error/trackRuntimeError.ts +21 -0
- package/src/domain/eventRateLimiter/createEventRateLimiter.ts +46 -0
- package/src/domain/report/browser.types.ts +26 -0
- package/src/domain/report/reportObservable.ts +126 -0
- package/src/domain/resourceUtils.ts +17 -0
- package/src/domain/session/oldCookiesMigration.ts +42 -0
- package/src/domain/session/sessionConstants.ts +4 -0
- package/src/domain/session/sessionManager.ts +98 -0
- package/src/domain/session/sessionState.ts +51 -0
- package/src/domain/session/sessionStore.ts +185 -0
- package/src/domain/session/sessionStoreOperations.ts +112 -0
- package/src/domain/session/storeStrategies/sessionInCookie.ts +56 -0
- package/src/domain/session/storeStrategies/sessionInLocalStorage.ts +41 -0
- package/src/domain/session/storeStrategies/sessionStoreStrategy.ts +12 -0
- package/src/domain/synthetics/syntheticsWorkerValues.ts +27 -0
- package/src/domain/telemetry/index.ts +14 -0
- package/src/domain/telemetry/rawTelemetryEvent.types.ts +14 -0
- package/src/domain/telemetry/telemetry.ts +195 -0
- package/src/domain/telemetry/telemetryEvent.types.ts +382 -0
- package/src/domain/tracekit/computeStackTrace.ts +141 -0
- package/src/domain/tracekit/index.ts +3 -0
- package/src/domain/tracekit/tracekit.ts +96 -0
- package/src/domain/tracekit/types.ts +47 -0
- package/src/domain/user/index.ts +2 -0
- package/src/domain/user/user.ts +33 -0
- package/src/domain/user/user.types.ts +6 -0
- package/src/index.ts +128 -0
- package/src/tools/abstractLifeCycle.ts +45 -0
- package/src/tools/boundedBuffer.ts +17 -0
- package/src/tools/catchUserErrors.ts +11 -0
- package/src/tools/display.ts +51 -0
- package/src/tools/experimentalFeatures.ts +43 -0
- package/src/tools/getGlobalObject.ts +31 -0
- package/src/tools/getZoneJsOriginalValue.ts +38 -0
- package/src/tools/instrumentMethod.ts +109 -0
- package/src/tools/matchOption.ts +32 -0
- package/src/tools/mergeInto.ts +177 -0
- package/src/tools/monitor.ts +68 -0
- package/src/tools/observable.ts +40 -0
- package/src/tools/readBytesFromStream.ts +77 -0
- package/src/tools/sendToExtension.ts +12 -0
- package/src/tools/serialisation/context.ts +8 -0
- package/src/tools/serialisation/contextManager.ts +79 -0
- package/src/tools/serialisation/heavyCustomerDataWarning.ts +26 -0
- package/src/tools/serialisation/jsonStringify.ts +53 -0
- package/src/tools/serialisation/sanitize.ts +255 -0
- package/src/tools/timer.ts +21 -0
- package/src/tools/utils/arrayUtils.ts +7 -0
- package/src/tools/utils/browserDetection.ts +7 -0
- package/src/tools/utils/byteUtils.ts +29 -0
- package/src/tools/utils/functionUtils.ts +47 -0
- package/src/tools/utils/numberUtils.ts +19 -0
- package/src/tools/utils/objectUtils.ts +21 -0
- package/src/tools/utils/polyfills.ts +127 -0
- package/src/tools/utils/responseUtils.ts +12 -0
- package/src/tools/utils/stringUtils.ts +28 -0
- package/src/tools/utils/timeUtils.ts +112 -0
- package/src/tools/utils/typeUtils.ts +12 -0
- package/src/tools/utils/urlPolyfill.ts +86 -0
- package/src/tools/valueHistory.ts +120 -0
- package/src/transport/batch.ts +92 -0
- package/src/transport/eventBridge.ts +42 -0
- package/src/transport/flushController.ts +129 -0
- package/src/transport/httpRequest.ts +150 -0
- package/src/transport/index.ts +4 -0
- package/src/transport/sendWithRetryStrategy.ts +203 -0
- package/src/transport/startBatchWithReplica.ts +52 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { getType } from './utils/typeUtils'
|
|
2
|
+
|
|
3
|
+
type Merged<TDestination, TSource> =
|
|
4
|
+
// case 1 - source is undefined - return destination
|
|
5
|
+
TSource extends undefined
|
|
6
|
+
? TDestination
|
|
7
|
+
: // case 2 - destination is undefined - return source
|
|
8
|
+
TDestination extends undefined
|
|
9
|
+
? TSource
|
|
10
|
+
: // case 3 - source is an array - see if it merges or overwrites
|
|
11
|
+
TSource extends any[]
|
|
12
|
+
? TDestination extends any[]
|
|
13
|
+
? TDestination & TSource
|
|
14
|
+
: TSource
|
|
15
|
+
: // case 4 - source is an object - see if it merges or overwrites
|
|
16
|
+
TSource extends object
|
|
17
|
+
? TDestination extends object
|
|
18
|
+
? TDestination extends any[]
|
|
19
|
+
? TSource
|
|
20
|
+
: TDestination & TSource
|
|
21
|
+
: TSource
|
|
22
|
+
: // case 5 - cannot merge - return source
|
|
23
|
+
TSource
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Iterate over source and affect its sub values into destination, recursively.
|
|
27
|
+
* If the source and destination can't be merged, return source.
|
|
28
|
+
*/
|
|
29
|
+
export function mergeInto<D, S>(
|
|
30
|
+
destination: D,
|
|
31
|
+
source: S,
|
|
32
|
+
circularReferenceChecker = createCircularReferenceChecker()
|
|
33
|
+
): Merged<D, S> {
|
|
34
|
+
// ignore the source if it is undefined
|
|
35
|
+
if (source === undefined) {
|
|
36
|
+
return destination as Merged<D, S>
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (typeof source !== 'object' || source === null) {
|
|
40
|
+
// primitive values - just return source
|
|
41
|
+
return source as Merged<D, S>
|
|
42
|
+
} else if (source instanceof Date) {
|
|
43
|
+
return new Date(source.getTime()) as unknown as Merged<D, S>
|
|
44
|
+
} else if (source instanceof RegExp) {
|
|
45
|
+
const flags =
|
|
46
|
+
source.flags ||
|
|
47
|
+
// old browsers compatibility
|
|
48
|
+
[
|
|
49
|
+
source.global ? 'g' : '',
|
|
50
|
+
source.ignoreCase ? 'i' : '',
|
|
51
|
+
source.multiline ? 'm' : '',
|
|
52
|
+
source.sticky ? 'y' : '',
|
|
53
|
+
source.unicode ? 'u' : '',
|
|
54
|
+
].join('')
|
|
55
|
+
return new RegExp(source.source, flags) as unknown as Merged<D, S>
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (circularReferenceChecker.hasAlreadyBeenSeen(source)) {
|
|
59
|
+
// remove circular references
|
|
60
|
+
return undefined as unknown as Merged<D, S>
|
|
61
|
+
} else if (Array.isArray(source)) {
|
|
62
|
+
const merged: any[] = Array.isArray(destination) ? destination : []
|
|
63
|
+
for (let i = 0; i < source.length; ++i) {
|
|
64
|
+
merged[i] = mergeInto(merged[i], source[i], circularReferenceChecker)
|
|
65
|
+
}
|
|
66
|
+
return merged as unknown as Merged<D, S>
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const merged = getType(destination) === 'object' ? (destination as Record<any, any>) : {}
|
|
70
|
+
for (const key in source) {
|
|
71
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
72
|
+
merged[key] = mergeInto(merged[key], source[key], circularReferenceChecker)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return merged as unknown as Merged<D, S>
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A simplistic implementation of a deep clone algorithm.
|
|
80
|
+
* Caveats:
|
|
81
|
+
* - It doesn't maintain prototype chains - don't use with instances of custom classes.
|
|
82
|
+
* - It doesn't handle Map and Set
|
|
83
|
+
*/
|
|
84
|
+
export function deepClone<T>(value: T): T {
|
|
85
|
+
return mergeInto(undefined, value) as T
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
type Combined<A, B> = A extends null ? B : B extends null ? A : Merged<A, B>
|
|
89
|
+
|
|
90
|
+
/*
|
|
91
|
+
* Performs a deep merge of objects and arrays.
|
|
92
|
+
* - Arguments won't be mutated
|
|
93
|
+
* - Object and arrays in the output value are de-referenced ("deep cloned")
|
|
94
|
+
* - Arrays values are merged index by index
|
|
95
|
+
* - Objects are merged by keys
|
|
96
|
+
* - Values get replaced, unless undefined
|
|
97
|
+
*/
|
|
98
|
+
export function combine<A, B>(a: A, b: B): Combined<A, B>
|
|
99
|
+
export function combine<A, B, C>(a: A, b: B, c: C): Combined<Combined<A, B>, C>
|
|
100
|
+
export function combine<A, B, C, D>(a: A, b: B, c: C, d: D): Combined<Combined<Combined<A, B>, C>, D>
|
|
101
|
+
export function combine<A, B, C, D, E>(
|
|
102
|
+
a: A,
|
|
103
|
+
b: B,
|
|
104
|
+
c: C,
|
|
105
|
+
d: D,
|
|
106
|
+
e: E
|
|
107
|
+
): Combined<Combined<Combined<Combined<A, B>, C>, D>, E>
|
|
108
|
+
export function combine<A, B, C, D, E, F>(
|
|
109
|
+
a: A,
|
|
110
|
+
b: B,
|
|
111
|
+
c: C,
|
|
112
|
+
d: D,
|
|
113
|
+
e: E,
|
|
114
|
+
f: F
|
|
115
|
+
): Combined<Combined<Combined<Combined<Combined<A, B>, C>, D>, E>, F>
|
|
116
|
+
export function combine<A, B, C, D, E, F, G>(
|
|
117
|
+
a: A,
|
|
118
|
+
b: B,
|
|
119
|
+
c: C,
|
|
120
|
+
d: D,
|
|
121
|
+
e: E,
|
|
122
|
+
f: F,
|
|
123
|
+
g: G
|
|
124
|
+
): Combined<Combined<Combined<Combined<Combined<Combined<A, B>, C>, D>, E>, F>, G>
|
|
125
|
+
export function combine<A, B, C, D, E, F, G, H>(
|
|
126
|
+
a: A,
|
|
127
|
+
b: B,
|
|
128
|
+
c: C,
|
|
129
|
+
d: D,
|
|
130
|
+
e: E,
|
|
131
|
+
f: F,
|
|
132
|
+
g: G,
|
|
133
|
+
h: H
|
|
134
|
+
): Combined<Combined<Combined<Combined<Combined<Combined<Combined<A, B>, C>, D>, E>, F>, G>, H>
|
|
135
|
+
export function combine(...sources: any[]): unknown {
|
|
136
|
+
let destination: any
|
|
137
|
+
|
|
138
|
+
for (const source of sources) {
|
|
139
|
+
// Ignore any undefined or null sources.
|
|
140
|
+
if (source === undefined || source === null) {
|
|
141
|
+
continue
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
destination = mergeInto(destination, source)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return destination as unknown
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
interface CircularReferenceChecker {
|
|
151
|
+
hasAlreadyBeenSeen(value: any): boolean
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function createCircularReferenceChecker(): CircularReferenceChecker {
|
|
155
|
+
if (typeof WeakSet !== 'undefined') {
|
|
156
|
+
const set: WeakSet<any> = new WeakSet()
|
|
157
|
+
return {
|
|
158
|
+
hasAlreadyBeenSeen(value) {
|
|
159
|
+
const has = set.has(value)
|
|
160
|
+
if (!has) {
|
|
161
|
+
set.add(value)
|
|
162
|
+
}
|
|
163
|
+
return has
|
|
164
|
+
},
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const array: any[] = []
|
|
168
|
+
return {
|
|
169
|
+
hasAlreadyBeenSeen(value) {
|
|
170
|
+
const has = array.indexOf(value) >= 0
|
|
171
|
+
if (!has) {
|
|
172
|
+
array.push(value)
|
|
173
|
+
}
|
|
174
|
+
return has
|
|
175
|
+
},
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ConsoleApiName, display } from './display'
|
|
2
|
+
|
|
3
|
+
let onMonitorErrorCollected: undefined | ((error: unknown) => void)
|
|
4
|
+
let debugMode = false
|
|
5
|
+
|
|
6
|
+
export function startMonitorErrorCollection(newOnMonitorErrorCollected: (error: unknown) => void) {
|
|
7
|
+
onMonitorErrorCollected = newOnMonitorErrorCollected
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function setDebugMode(newDebugMode: boolean) {
|
|
11
|
+
debugMode = newDebugMode
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function resetMonitor() {
|
|
15
|
+
onMonitorErrorCollected = undefined
|
|
16
|
+
debugMode = false
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function monitored<T extends (...params: any[]) => unknown>(
|
|
20
|
+
_: any,
|
|
21
|
+
__: string,
|
|
22
|
+
descriptor: TypedPropertyDescriptor<T>
|
|
23
|
+
) {
|
|
24
|
+
const originalMethod = descriptor.value!
|
|
25
|
+
descriptor.value = function (this: any, ...args: Parameters<T>) {
|
|
26
|
+
const decorated = onMonitorErrorCollected ? monitor(originalMethod) : originalMethod
|
|
27
|
+
return decorated.apply(this, args) as ReturnType<T>
|
|
28
|
+
} as T
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function monitor<T extends (...args: any[]) => any>(fn: T): T {
|
|
32
|
+
return function (this: any) {
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
34
|
+
return callMonitored(fn, this, arguments as unknown as Parameters<T>)
|
|
35
|
+
} as unknown as T // consider output type has input type
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function callMonitored<T extends (...args: any[]) => any>(
|
|
39
|
+
fn: T,
|
|
40
|
+
context: ThisParameterType<T>,
|
|
41
|
+
args: Parameters<T>
|
|
42
|
+
): ReturnType<T> | undefined
|
|
43
|
+
export function callMonitored<T extends (this: void) => any>(fn: T): ReturnType<T> | undefined
|
|
44
|
+
export function callMonitored<T extends (...args: any[]) => any>(
|
|
45
|
+
fn: T,
|
|
46
|
+
context?: any,
|
|
47
|
+
args?: any
|
|
48
|
+
): ReturnType<T> | undefined {
|
|
49
|
+
try {
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
51
|
+
return fn.apply(context, args)
|
|
52
|
+
} catch (e) {
|
|
53
|
+
displayIfDebugEnabled(ConsoleApiName.error, e)
|
|
54
|
+
if (onMonitorErrorCollected) {
|
|
55
|
+
try {
|
|
56
|
+
onMonitorErrorCollected(e)
|
|
57
|
+
} catch (e) {
|
|
58
|
+
displayIfDebugEnabled(ConsoleApiName.error, e)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function displayIfDebugEnabled(api: ConsoleApiName, ...args: any[]) {
|
|
65
|
+
if (debugMode) {
|
|
66
|
+
display(api, '[MONITOR]', ...args)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface Subscription {
|
|
2
|
+
unsubscribe: () => void
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export class Observable<T> {
|
|
6
|
+
private observers: Array<(data: T) => void> = []
|
|
7
|
+
private onLastUnsubscribe?: () => void
|
|
8
|
+
|
|
9
|
+
constructor(private onFirstSubscribe?: () => (() => void) | void) {}
|
|
10
|
+
|
|
11
|
+
subscribe(f: (data: T) => void): Subscription {
|
|
12
|
+
if (!this.observers.length && this.onFirstSubscribe) {
|
|
13
|
+
this.onLastUnsubscribe = this.onFirstSubscribe() || undefined
|
|
14
|
+
}
|
|
15
|
+
this.observers.push(f)
|
|
16
|
+
return {
|
|
17
|
+
unsubscribe: () => {
|
|
18
|
+
this.observers = this.observers.filter((other) => f !== other)
|
|
19
|
+
if (!this.observers.length && this.onLastUnsubscribe) {
|
|
20
|
+
this.onLastUnsubscribe()
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
notify(data: T) {
|
|
27
|
+
this.observers.forEach((observer) => observer(data))
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function mergeObservables<T>(...observables: Array<Observable<T>>) {
|
|
32
|
+
const globalObservable = new Observable<T>(() => {
|
|
33
|
+
const subscriptions: Subscription[] = observables.map((observable) =>
|
|
34
|
+
observable.subscribe((data) => globalObservable.notify(data))
|
|
35
|
+
)
|
|
36
|
+
return () => subscriptions.forEach((subscription) => subscription.unsubscribe())
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
return globalObservable
|
|
40
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { monitor } from './monitor'
|
|
2
|
+
import { noop } from './utils/functionUtils'
|
|
3
|
+
|
|
4
|
+
type Options = {
|
|
5
|
+
bytesLimit: number
|
|
6
|
+
collectStreamBody?: boolean
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Read bytes from a ReadableStream until at least `limit` bytes have been read (or until the end of
|
|
10
|
+
* the stream). The callback is invoked with the at most `limit` bytes, and indicates that the limit
|
|
11
|
+
* has been exceeded if more bytes were available.
|
|
12
|
+
*/
|
|
13
|
+
export function readBytesFromStream(
|
|
14
|
+
stream: ReadableStream<Uint8Array>,
|
|
15
|
+
callback: (error?: Error, bytes?: Uint8Array, limitExceeded?: boolean) => void,
|
|
16
|
+
options: Options
|
|
17
|
+
) {
|
|
18
|
+
const reader = stream.getReader()
|
|
19
|
+
const chunks: Uint8Array[] = []
|
|
20
|
+
let readBytesCount = 0
|
|
21
|
+
|
|
22
|
+
readMore()
|
|
23
|
+
|
|
24
|
+
function readMore() {
|
|
25
|
+
reader.read().then(
|
|
26
|
+
monitor((result: ReadableStreamReadResult<Uint8Array>) => {
|
|
27
|
+
if (result.done) {
|
|
28
|
+
onDone()
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (options.collectStreamBody) {
|
|
33
|
+
chunks.push(result.value)
|
|
34
|
+
}
|
|
35
|
+
readBytesCount += result.value.length
|
|
36
|
+
|
|
37
|
+
if (readBytesCount > options.bytesLimit) {
|
|
38
|
+
onDone()
|
|
39
|
+
} else {
|
|
40
|
+
readMore()
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
43
|
+
monitor((error) => callback(error))
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function onDone() {
|
|
48
|
+
reader.cancel().catch(
|
|
49
|
+
// we don't care if cancel fails, but we still need to catch the error to avoid reporting it
|
|
50
|
+
// as an unhandled rejection
|
|
51
|
+
noop
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
let bytes: Uint8Array | undefined
|
|
55
|
+
let limitExceeded: boolean | undefined
|
|
56
|
+
if (options.collectStreamBody) {
|
|
57
|
+
let completeBuffer: Uint8Array
|
|
58
|
+
if (chunks.length === 1) {
|
|
59
|
+
// optimization: if the response is small enough to fit in a single buffer (provided by the browser), just
|
|
60
|
+
// use it directly.
|
|
61
|
+
completeBuffer = chunks[0]
|
|
62
|
+
} else {
|
|
63
|
+
// else, we need to copy buffers into a larger buffer to concatenate them.
|
|
64
|
+
completeBuffer = new Uint8Array(readBytesCount)
|
|
65
|
+
let offset = 0
|
|
66
|
+
chunks.forEach((chunk) => {
|
|
67
|
+
completeBuffer.set(chunk, offset)
|
|
68
|
+
offset += chunk.length
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
bytes = completeBuffer.slice(0, options.bytesLimit)
|
|
72
|
+
limitExceeded = completeBuffer.length > options.bytesLimit
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
callback(undefined, bytes, limitExceeded)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface BrowserWindow {
|
|
2
|
+
__ooBrowserSdkExtensionCallback?: (message: unknown) => void
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
type ExtensionMessageType = 'logs' | 'record' | 'rum' | 'telemetry'
|
|
6
|
+
|
|
7
|
+
export function sendToExtension(type: ExtensionMessageType, payload: unknown) {
|
|
8
|
+
const callback = (window as BrowserWindow).__ooBrowserSdkExtensionCallback
|
|
9
|
+
if (callback) {
|
|
10
|
+
callback({ type, payload })
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface Context {
|
|
2
|
+
[x: string]: ContextValue
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export type ContextValue = string | number | boolean | Context | ContextArray | undefined | null
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
8
|
+
export interface ContextArray extends Array<ContextValue> {}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { computeBytesCount } from '../utils/byteUtils'
|
|
2
|
+
import { throttle } from '../utils/functionUtils'
|
|
3
|
+
import { deepClone } from '../mergeInto'
|
|
4
|
+
import { getType } from '../utils/typeUtils'
|
|
5
|
+
import { jsonStringify } from './jsonStringify'
|
|
6
|
+
import { sanitize } from './sanitize'
|
|
7
|
+
import { warnIfCustomerDataLimitReached } from './heavyCustomerDataWarning'
|
|
8
|
+
import type { CustomerDataType } from './heavyCustomerDataWarning'
|
|
9
|
+
import type { Context, ContextValue } from './context'
|
|
10
|
+
|
|
11
|
+
export const BYTES_COMPUTATION_THROTTLING_DELAY = 200
|
|
12
|
+
|
|
13
|
+
export type ContextManager = ReturnType<typeof createContextManager>
|
|
14
|
+
|
|
15
|
+
export function createContextManager(customerDataType: CustomerDataType, computeBytesCountImpl = computeBytesCount) {
|
|
16
|
+
let context: Context = {}
|
|
17
|
+
let bytesCountCache: number
|
|
18
|
+
let alreadyWarned = false
|
|
19
|
+
|
|
20
|
+
// Throttle the bytes computation to minimize the impact on performance.
|
|
21
|
+
// Especially useful if the user call context APIs synchronously multiple times in a row
|
|
22
|
+
const { throttled: computeBytesCountThrottled } = throttle((context: Context) => {
|
|
23
|
+
bytesCountCache = computeBytesCountImpl(jsonStringify(context)!)
|
|
24
|
+
if (!alreadyWarned) {
|
|
25
|
+
alreadyWarned = warnIfCustomerDataLimitReached(bytesCountCache, customerDataType)
|
|
26
|
+
}
|
|
27
|
+
}, BYTES_COMPUTATION_THROTTLING_DELAY)
|
|
28
|
+
|
|
29
|
+
const contextManager = {
|
|
30
|
+
getBytesCount: () => bytesCountCache,
|
|
31
|
+
/** @deprecated use getContext instead */
|
|
32
|
+
get: () => context,
|
|
33
|
+
|
|
34
|
+
/** @deprecated use setContextProperty instead */
|
|
35
|
+
add: (key: string, value: any) => {
|
|
36
|
+
context[key] = value as ContextValue
|
|
37
|
+
computeBytesCountThrottled(context)
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
/** @deprecated renamed to removeContextProperty */
|
|
41
|
+
remove: (key: string) => {
|
|
42
|
+
delete context[key]
|
|
43
|
+
computeBytesCountThrottled(context)
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
/** @deprecated use setContext instead */
|
|
47
|
+
set: (newContext: object) => {
|
|
48
|
+
context = newContext as Context
|
|
49
|
+
computeBytesCountThrottled(context)
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
getContext: () => deepClone(context),
|
|
53
|
+
|
|
54
|
+
setContext: (newContext: Context) => {
|
|
55
|
+
if (getType(newContext) === 'object') {
|
|
56
|
+
context = sanitize(newContext)
|
|
57
|
+
computeBytesCountThrottled(context)
|
|
58
|
+
} else {
|
|
59
|
+
contextManager.clearContext()
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
setContextProperty: (key: string, property: any) => {
|
|
64
|
+
context[key] = sanitize(property)
|
|
65
|
+
computeBytesCountThrottled(context)
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
removeContextProperty: (key: string) => {
|
|
69
|
+
delete context[key]
|
|
70
|
+
computeBytesCountThrottled(context)
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
clearContext: () => {
|
|
74
|
+
context = {}
|
|
75
|
+
bytesCountCache = 0
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
return contextManager
|
|
79
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ONE_KIBI_BYTE } from '../utils/byteUtils'
|
|
2
|
+
import { display } from '../display'
|
|
3
|
+
|
|
4
|
+
// RUM and logs batch bytes limit is 16KB
|
|
5
|
+
// ensure that we leave room for other event attributes and maintain a decent amount of event per batch
|
|
6
|
+
// (3KB (customer data) + 1KB (other attributes)) * 4 (events per batch) = 16KB
|
|
7
|
+
export const CUSTOMER_DATA_BYTES_LIMIT = 3 * ONE_KIBI_BYTE
|
|
8
|
+
|
|
9
|
+
export const enum CustomerDataType {
|
|
10
|
+
FeatureFlag = 'feature flag evaluation',
|
|
11
|
+
User = 'user',
|
|
12
|
+
GlobalContext = 'global context',
|
|
13
|
+
LoggerContext = 'logger context',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function warnIfCustomerDataLimitReached(bytesCount: number, customerDataType: CustomerDataType): boolean {
|
|
17
|
+
if (bytesCount > CUSTOMER_DATA_BYTES_LIMIT) {
|
|
18
|
+
display.warn(
|
|
19
|
+
`The ${customerDataType} data exceeds the recommended ${
|
|
20
|
+
CUSTOMER_DATA_BYTES_LIMIT / ONE_KIBI_BYTE
|
|
21
|
+
}KiB threshold. More details: https://docs.datadoghq.com/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-3kib-warning`
|
|
22
|
+
)
|
|
23
|
+
return true
|
|
24
|
+
}
|
|
25
|
+
return false
|
|
26
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { noop } from '../utils/functionUtils'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Custom implementation of JSON.stringify that ignores some toJSON methods. We need to do that
|
|
5
|
+
* because some sites badly override toJSON on certain objects. Removing all toJSON methods from
|
|
6
|
+
* nested values would be too costly, so we just detach them from the root value, and native classes
|
|
7
|
+
* used to build JSON values (Array and Object).
|
|
8
|
+
*
|
|
9
|
+
* Note: this still assumes that JSON.stringify is correct.
|
|
10
|
+
*/
|
|
11
|
+
export function jsonStringify(
|
|
12
|
+
value: unknown,
|
|
13
|
+
replacer?: Array<string | number>,
|
|
14
|
+
space?: string | number
|
|
15
|
+
): string | undefined {
|
|
16
|
+
if (typeof value !== 'object' || value === null) {
|
|
17
|
+
return JSON.stringify(value)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Note: The order matter here. We need to detach toJSON methods on parent classes before their
|
|
21
|
+
// subclasses.
|
|
22
|
+
const restoreObjectPrototypeToJson = detachToJsonMethod(Object.prototype)
|
|
23
|
+
const restoreArrayPrototypeToJson = detachToJsonMethod(Array.prototype)
|
|
24
|
+
const restoreValuePrototypeToJson = detachToJsonMethod(Object.getPrototypeOf(value))
|
|
25
|
+
const restoreValueToJson = detachToJsonMethod(value)
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
return JSON.stringify(value, replacer, space)
|
|
29
|
+
} catch {
|
|
30
|
+
return '<error: unable to serialize object>'
|
|
31
|
+
} finally {
|
|
32
|
+
restoreObjectPrototypeToJson()
|
|
33
|
+
restoreArrayPrototypeToJson()
|
|
34
|
+
restoreValuePrototypeToJson()
|
|
35
|
+
restoreValueToJson()
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ObjectWithToJsonMethod {
|
|
40
|
+
toJSON?: () => unknown
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function detachToJsonMethod(value: object) {
|
|
44
|
+
const object = value as ObjectWithToJsonMethod
|
|
45
|
+
const objectToJson = object.toJSON
|
|
46
|
+
if (objectToJson) {
|
|
47
|
+
delete object.toJSON
|
|
48
|
+
return () => {
|
|
49
|
+
object.toJSON = objectToJson
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return noop
|
|
53
|
+
}
|