@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,159 @@
|
|
|
1
|
+
import type { StackTrace } from '../tracekit'
|
|
2
|
+
import { computeStackTrace } from '../tracekit'
|
|
3
|
+
import { callMonitored } from '../../tools/monitor'
|
|
4
|
+
import { sanitize } from '../../tools/serialisation/sanitize'
|
|
5
|
+
import type { ClocksState } from '../../tools/utils/timeUtils'
|
|
6
|
+
import { noop } from '../../tools/utils/functionUtils'
|
|
7
|
+
import { jsonStringify } from '../../tools/serialisation/jsonStringify'
|
|
8
|
+
import type { ErrorSource, ErrorHandling, RawError, RawErrorCause, ErrorWithCause, NonErrorPrefix } from './error.types'
|
|
9
|
+
|
|
10
|
+
export const NO_ERROR_STACK_PRESENT_MESSAGE = 'No stack, consider using an instance of Error'
|
|
11
|
+
|
|
12
|
+
type RawErrorParams = {
|
|
13
|
+
stackTrace?: StackTrace
|
|
14
|
+
originalError: unknown
|
|
15
|
+
|
|
16
|
+
handlingStack?: string
|
|
17
|
+
startClocks: ClocksState
|
|
18
|
+
nonErrorPrefix: NonErrorPrefix
|
|
19
|
+
source: ErrorSource
|
|
20
|
+
handling: ErrorHandling
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function computeRawError({
|
|
24
|
+
stackTrace,
|
|
25
|
+
originalError,
|
|
26
|
+
handlingStack,
|
|
27
|
+
startClocks,
|
|
28
|
+
nonErrorPrefix,
|
|
29
|
+
source,
|
|
30
|
+
handling,
|
|
31
|
+
}: RawErrorParams): RawError {
|
|
32
|
+
const isErrorInstance = originalError instanceof Error
|
|
33
|
+
|
|
34
|
+
const message = computeMessage(stackTrace, isErrorInstance, nonErrorPrefix, originalError)
|
|
35
|
+
const stack = hasUsableStack(isErrorInstance, stackTrace)
|
|
36
|
+
? toStackTraceString(stackTrace)
|
|
37
|
+
: NO_ERROR_STACK_PRESENT_MESSAGE
|
|
38
|
+
const causes = isErrorInstance ? flattenErrorCauses(originalError as ErrorWithCause, source) : undefined
|
|
39
|
+
const type = stackTrace?.name
|
|
40
|
+
const fingerprint = tryToGetFingerprint(originalError)
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
startClocks,
|
|
44
|
+
source,
|
|
45
|
+
handling,
|
|
46
|
+
handlingStack,
|
|
47
|
+
originalError,
|
|
48
|
+
type,
|
|
49
|
+
message,
|
|
50
|
+
stack,
|
|
51
|
+
causes,
|
|
52
|
+
fingerprint,
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function computeMessage(
|
|
57
|
+
stackTrace: StackTrace | undefined,
|
|
58
|
+
isErrorInstance: boolean,
|
|
59
|
+
nonErrorPrefix: NonErrorPrefix,
|
|
60
|
+
originalError: unknown
|
|
61
|
+
) {
|
|
62
|
+
// Favor stackTrace message only if tracekit has really been able to extract something meaningful (message + name)
|
|
63
|
+
// TODO rework tracekit integration to avoid scattering error building logic
|
|
64
|
+
return stackTrace?.message && stackTrace?.name
|
|
65
|
+
? stackTrace.message
|
|
66
|
+
: !isErrorInstance
|
|
67
|
+
? `${nonErrorPrefix} ${jsonStringify(sanitize(originalError))!}`
|
|
68
|
+
: 'Empty message'
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function hasUsableStack(isErrorInstance: boolean, stackTrace?: StackTrace): stackTrace is StackTrace {
|
|
72
|
+
if (stackTrace === undefined) {
|
|
73
|
+
return false
|
|
74
|
+
}
|
|
75
|
+
if (isErrorInstance) {
|
|
76
|
+
return true
|
|
77
|
+
}
|
|
78
|
+
// handle cases where tracekit return stack = [] or stack = [{url: undefined, line: undefined, column: undefined}]
|
|
79
|
+
// TODO rework tracekit integration to avoid generating those unusable stack
|
|
80
|
+
return stackTrace.stack.length > 0 && (stackTrace.stack.length > 1 || stackTrace.stack[0].url !== undefined)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function tryToGetFingerprint(originalError: unknown) {
|
|
84
|
+
return originalError instanceof Error && 'oo_fingerprint' in originalError
|
|
85
|
+
? String(originalError.oo_fingerprint)
|
|
86
|
+
: undefined
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function toStackTraceString(stack: StackTrace) {
|
|
90
|
+
let result = formatErrorMessage(stack)
|
|
91
|
+
stack.stack.forEach((frame) => {
|
|
92
|
+
const func = frame.func === '?' ? '<anonymous>' : frame.func
|
|
93
|
+
const args = frame.args && frame.args.length > 0 ? `(${frame.args.join(', ')})` : ''
|
|
94
|
+
const line = frame.line ? `:${frame.line}` : ''
|
|
95
|
+
const column = frame.line && frame.column ? `:${frame.column}` : ''
|
|
96
|
+
result += `\n at ${func!}${args} @ ${frame.url!}${line}${column}`
|
|
97
|
+
})
|
|
98
|
+
return result
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function getFileFromStackTraceString(stack: string) {
|
|
102
|
+
return /@ (.+)/.exec(stack)?.[1]
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function formatErrorMessage(stack: StackTrace) {
|
|
106
|
+
return `${stack.name || 'Error'}: ${stack.message!}`
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
Creates a stacktrace without SDK internal frames.
|
|
111
|
+
|
|
112
|
+
Constraints:
|
|
113
|
+
- Has to be called at the utmost position of the call stack.
|
|
114
|
+
- No monitored function should encapsulate it, that is why we need to use callMonitored inside it.
|
|
115
|
+
*/
|
|
116
|
+
export function createHandlingStack(): string {
|
|
117
|
+
/**
|
|
118
|
+
* Skip the two internal frames:
|
|
119
|
+
* - SDK API (console.error, ...)
|
|
120
|
+
* - this function
|
|
121
|
+
* in order to keep only the user calls
|
|
122
|
+
*/
|
|
123
|
+
const internalFramesToSkip = 2
|
|
124
|
+
const error = new Error()
|
|
125
|
+
let formattedStack: string
|
|
126
|
+
|
|
127
|
+
// IE needs to throw the error to fill in the stack trace
|
|
128
|
+
if (!error.stack) {
|
|
129
|
+
try {
|
|
130
|
+
throw error
|
|
131
|
+
} catch (e) {
|
|
132
|
+
noop()
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
callMonitored(() => {
|
|
137
|
+
const stackTrace = computeStackTrace(error)
|
|
138
|
+
stackTrace.stack = stackTrace.stack.slice(internalFramesToSkip)
|
|
139
|
+
formattedStack = toStackTraceString(stackTrace)
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
return formattedStack!
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function flattenErrorCauses(error: ErrorWithCause, parentSource: ErrorSource): RawErrorCause[] | undefined {
|
|
146
|
+
let currentError = error
|
|
147
|
+
const causes: RawErrorCause[] = []
|
|
148
|
+
while (currentError?.cause instanceof Error && causes.length < 10) {
|
|
149
|
+
const stackTrace = computeStackTrace(currentError.cause)
|
|
150
|
+
causes.push({
|
|
151
|
+
message: currentError.cause.message,
|
|
152
|
+
source: parentSource,
|
|
153
|
+
type: stackTrace?.name,
|
|
154
|
+
stack: stackTrace && toStackTraceString(stackTrace),
|
|
155
|
+
})
|
|
156
|
+
currentError = currentError.cause
|
|
157
|
+
}
|
|
158
|
+
return causes.length ? causes : undefined
|
|
159
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ClocksState } from '../../tools/utils/timeUtils'
|
|
2
|
+
|
|
3
|
+
export interface ErrorWithCause extends Error {
|
|
4
|
+
cause?: Error
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type RawErrorCause = {
|
|
8
|
+
message: string
|
|
9
|
+
source: string
|
|
10
|
+
type?: string
|
|
11
|
+
stack?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface RawError {
|
|
15
|
+
startClocks: ClocksState
|
|
16
|
+
message: string
|
|
17
|
+
type?: string
|
|
18
|
+
stack?: string
|
|
19
|
+
source: ErrorSource
|
|
20
|
+
originalError?: unknown
|
|
21
|
+
handling?: ErrorHandling
|
|
22
|
+
handlingStack?: string
|
|
23
|
+
causes?: RawErrorCause[]
|
|
24
|
+
fingerprint?: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const ErrorSource = {
|
|
28
|
+
AGENT: 'agent',
|
|
29
|
+
CONSOLE: 'console',
|
|
30
|
+
CUSTOM: 'custom',
|
|
31
|
+
LOGGER: 'logger',
|
|
32
|
+
NETWORK: 'network',
|
|
33
|
+
SOURCE: 'source',
|
|
34
|
+
REPORT: 'report',
|
|
35
|
+
} as const
|
|
36
|
+
|
|
37
|
+
export const enum NonErrorPrefix {
|
|
38
|
+
UNCAUGHT = 'Uncaught',
|
|
39
|
+
PROVIDED = 'Provided',
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const enum ErrorHandling {
|
|
43
|
+
HANDLED = 'handled',
|
|
44
|
+
UNHANDLED = 'unhandled',
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type ErrorSource = (typeof ErrorSource)[keyof typeof ErrorSource]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Observable } from '../../tools/observable'
|
|
2
|
+
import { clocksNow } from '../../tools/utils/timeUtils'
|
|
3
|
+
import { startUnhandledErrorCollection } from '../tracekit'
|
|
4
|
+
import { computeRawError } from './error'
|
|
5
|
+
import type { RawError } from './error.types'
|
|
6
|
+
import { ErrorHandling, ErrorSource, NonErrorPrefix } from './error.types'
|
|
7
|
+
|
|
8
|
+
export function trackRuntimeError(errorObservable: Observable<RawError>) {
|
|
9
|
+
return startUnhandledErrorCollection((stackTrace, originalError) => {
|
|
10
|
+
errorObservable.notify(
|
|
11
|
+
computeRawError({
|
|
12
|
+
stackTrace,
|
|
13
|
+
originalError,
|
|
14
|
+
startClocks: clocksNow(),
|
|
15
|
+
nonErrorPrefix: NonErrorPrefix.UNCAUGHT,
|
|
16
|
+
source: ErrorSource.SOURCE,
|
|
17
|
+
handling: ErrorHandling.UNHANDLED,
|
|
18
|
+
})
|
|
19
|
+
)
|
|
20
|
+
})
|
|
21
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { setTimeout } from '../../tools/timer'
|
|
2
|
+
import { clocksNow, ONE_MINUTE } from '../../tools/utils/timeUtils'
|
|
3
|
+
import type { RawError } from '../error/error.types'
|
|
4
|
+
import { ErrorSource } from '../error/error.types'
|
|
5
|
+
|
|
6
|
+
export type EventRateLimiter = ReturnType<typeof createEventRateLimiter>
|
|
7
|
+
|
|
8
|
+
export function createEventRateLimiter(
|
|
9
|
+
eventType: string,
|
|
10
|
+
limit: number,
|
|
11
|
+
onLimitReached: (limitError: RawError) => void
|
|
12
|
+
) {
|
|
13
|
+
let eventCount = 0
|
|
14
|
+
let allowNextEvent = false
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
isLimitReached() {
|
|
18
|
+
if (eventCount === 0) {
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
eventCount = 0
|
|
21
|
+
}, ONE_MINUTE)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
eventCount += 1
|
|
25
|
+
if (eventCount <= limit || allowNextEvent) {
|
|
26
|
+
allowNextEvent = false
|
|
27
|
+
return false
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (eventCount === limit + 1) {
|
|
31
|
+
allowNextEvent = true
|
|
32
|
+
try {
|
|
33
|
+
onLimitReached({
|
|
34
|
+
message: `Reached max number of ${eventType}s by minute: ${limit}`,
|
|
35
|
+
source: ErrorSource.AGENT,
|
|
36
|
+
startClocks: clocksNow(),
|
|
37
|
+
})
|
|
38
|
+
} finally {
|
|
39
|
+
allowNextEvent = false
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return true
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type ReportType = DeprecationReport['type'] | InterventionReport['type']
|
|
2
|
+
|
|
3
|
+
export interface DeprecationReport extends Report {
|
|
4
|
+
type: 'deprecation'
|
|
5
|
+
body: DeprecationReportBody
|
|
6
|
+
}
|
|
7
|
+
export interface DeprecationReportBody extends ReportBody {
|
|
8
|
+
id: string
|
|
9
|
+
message: string
|
|
10
|
+
lineNumber: number | null
|
|
11
|
+
columnNumber: number | null
|
|
12
|
+
sourceFile: string | null
|
|
13
|
+
anticipatedRemoval: Date | null
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface InterventionReport extends Report {
|
|
17
|
+
type: 'intervention'
|
|
18
|
+
body: InterventionReportBody
|
|
19
|
+
}
|
|
20
|
+
export interface InterventionReportBody extends ReportBody {
|
|
21
|
+
id: string
|
|
22
|
+
message: string
|
|
23
|
+
lineNumber: number | null
|
|
24
|
+
columnNumber: number | null
|
|
25
|
+
sourceFile: string | null
|
|
26
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { toStackTraceString } from '../error/error'
|
|
2
|
+
import { monitor } from '../../tools/monitor'
|
|
3
|
+
import { mergeObservables, Observable } from '../../tools/observable'
|
|
4
|
+
import { addEventListener, DOM_EVENT } from '../../browser/addEventListener'
|
|
5
|
+
import { includes } from '../../tools/utils/polyfills'
|
|
6
|
+
import { safeTruncate } from '../../tools/utils/stringUtils'
|
|
7
|
+
import type { Configuration } from '../configuration'
|
|
8
|
+
import type { ReportType, InterventionReport, DeprecationReport } from './browser.types'
|
|
9
|
+
|
|
10
|
+
export const RawReportType = {
|
|
11
|
+
intervention: 'intervention',
|
|
12
|
+
deprecation: 'deprecation',
|
|
13
|
+
cspViolation: 'csp_violation',
|
|
14
|
+
} as const
|
|
15
|
+
|
|
16
|
+
export type RawReportType = (typeof RawReportType)[keyof typeof RawReportType]
|
|
17
|
+
|
|
18
|
+
export interface RawReport {
|
|
19
|
+
type: RawReportType
|
|
20
|
+
subtype: string
|
|
21
|
+
message: string
|
|
22
|
+
stack?: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function initReportObservable(configuration: Configuration, apis: RawReportType[]) {
|
|
26
|
+
const observables: Array<Observable<RawReport>> = []
|
|
27
|
+
|
|
28
|
+
if (includes(apis, RawReportType.cspViolation)) {
|
|
29
|
+
observables.push(createCspViolationReportObservable(configuration))
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const reportTypes = apis.filter((api: RawReportType): api is ReportType => api !== RawReportType.cspViolation)
|
|
33
|
+
if (reportTypes.length) {
|
|
34
|
+
observables.push(createReportObservable(reportTypes))
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return mergeObservables<RawReport>(...observables)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function createReportObservable(reportTypes: ReportType[]) {
|
|
41
|
+
const observable = new Observable<RawReport>(() => {
|
|
42
|
+
if (!window.ReportingObserver) {
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const handleReports = monitor((reports: Array<DeprecationReport | InterventionReport>, _: ReportingObserver) =>
|
|
47
|
+
reports.forEach((report) => {
|
|
48
|
+
observable.notify(buildRawReportFromReport(report))
|
|
49
|
+
})
|
|
50
|
+
) as ReportingObserverCallback
|
|
51
|
+
|
|
52
|
+
const observer = new window.ReportingObserver(handleReports, {
|
|
53
|
+
types: reportTypes,
|
|
54
|
+
buffered: true,
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
observer.observe()
|
|
58
|
+
return () => {
|
|
59
|
+
observer.disconnect()
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
return observable
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function createCspViolationReportObservable(configuration: Configuration) {
|
|
67
|
+
const observable = new Observable<RawReport>(() => {
|
|
68
|
+
const { stop } = addEventListener(configuration, document, DOM_EVENT.SECURITY_POLICY_VIOLATION, (event) => {
|
|
69
|
+
observable.notify(buildRawReportFromCspViolation(event))
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
return stop
|
|
73
|
+
})
|
|
74
|
+
return observable
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function buildRawReportFromReport({ type, body }: DeprecationReport | InterventionReport): RawReport {
|
|
78
|
+
return {
|
|
79
|
+
type,
|
|
80
|
+
subtype: body.id,
|
|
81
|
+
message: `${type}: ${body.message}`,
|
|
82
|
+
stack: buildStack(body.id, body.message, body.sourceFile, body.lineNumber, body.columnNumber),
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function buildRawReportFromCspViolation(event: SecurityPolicyViolationEvent): RawReport {
|
|
87
|
+
const type = RawReportType.cspViolation
|
|
88
|
+
const message = `'${event.blockedURI}' blocked by '${event.effectiveDirective}' directive`
|
|
89
|
+
return {
|
|
90
|
+
type: RawReportType.cspViolation,
|
|
91
|
+
subtype: event.effectiveDirective,
|
|
92
|
+
message: `${type}: ${message}`,
|
|
93
|
+
stack: buildStack(
|
|
94
|
+
event.effectiveDirective,
|
|
95
|
+
event.originalPolicy
|
|
96
|
+
? `${message} of the policy "${safeTruncate(event.originalPolicy, 100, '...')}"`
|
|
97
|
+
: 'no policy',
|
|
98
|
+
event.sourceFile,
|
|
99
|
+
event.lineNumber,
|
|
100
|
+
event.columnNumber
|
|
101
|
+
),
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function buildStack(
|
|
106
|
+
name: string,
|
|
107
|
+
message: string,
|
|
108
|
+
sourceFile: string | null,
|
|
109
|
+
lineNumber: number | null,
|
|
110
|
+
columnNumber: number | null
|
|
111
|
+
): string | undefined {
|
|
112
|
+
return sourceFile
|
|
113
|
+
? toStackTraceString({
|
|
114
|
+
name,
|
|
115
|
+
message,
|
|
116
|
+
stack: [
|
|
117
|
+
{
|
|
118
|
+
func: '?',
|
|
119
|
+
url: sourceFile,
|
|
120
|
+
line: lineNumber ?? undefined,
|
|
121
|
+
column: columnNumber ?? undefined,
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
})
|
|
125
|
+
: undefined
|
|
126
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const enum ResourceType {
|
|
2
|
+
DOCUMENT = 'document',
|
|
3
|
+
XHR = 'xhr',
|
|
4
|
+
BEACON = 'beacon',
|
|
5
|
+
FETCH = 'fetch',
|
|
6
|
+
CSS = 'css',
|
|
7
|
+
JS = 'js',
|
|
8
|
+
IMAGE = 'image',
|
|
9
|
+
FONT = 'font',
|
|
10
|
+
MEDIA = 'media',
|
|
11
|
+
OTHER = 'other',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const enum RequestType {
|
|
15
|
+
FETCH = ResourceType.FETCH,
|
|
16
|
+
XHR = ResourceType.XHR,
|
|
17
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { getCookie } from '../../browser/cookie'
|
|
2
|
+
import type { SessionStoreStrategy } from './storeStrategies/sessionStoreStrategy'
|
|
3
|
+
import { SESSION_STORE_KEY } from './storeStrategies/sessionStoreStrategy'
|
|
4
|
+
import type { SessionState } from './sessionState'
|
|
5
|
+
import { expandSessionState, isSessionInExpiredState } from './sessionState'
|
|
6
|
+
|
|
7
|
+
export const OLD_SESSION_COOKIE_NAME = '_oo'
|
|
8
|
+
export const OLD_RUM_COOKIE_NAME = '_oo_r'
|
|
9
|
+
export const OLD_LOGS_COOKIE_NAME = '_oo_l'
|
|
10
|
+
|
|
11
|
+
// duplicate values to avoid dependency issues
|
|
12
|
+
export const RUM_SESSION_KEY = 'rum'
|
|
13
|
+
export const LOGS_SESSION_KEY = 'logs'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* This migration should remain in the codebase as long as older versions are available/live
|
|
17
|
+
* to allow older sdk versions to be upgraded to newer versions without compatibility issues.
|
|
18
|
+
*/
|
|
19
|
+
export function tryOldCookiesMigration(cookieStoreStrategy: SessionStoreStrategy) {
|
|
20
|
+
const sessionString = getCookie(SESSION_STORE_KEY)
|
|
21
|
+
if (!sessionString) {
|
|
22
|
+
const oldSessionId = getCookie(OLD_SESSION_COOKIE_NAME)
|
|
23
|
+
const oldRumType = getCookie(OLD_RUM_COOKIE_NAME)
|
|
24
|
+
const oldLogsType = getCookie(OLD_LOGS_COOKIE_NAME)
|
|
25
|
+
const session: SessionState = {}
|
|
26
|
+
|
|
27
|
+
if (oldSessionId) {
|
|
28
|
+
session.id = oldSessionId
|
|
29
|
+
}
|
|
30
|
+
if (oldLogsType && /^[01]$/.test(oldLogsType)) {
|
|
31
|
+
session[LOGS_SESSION_KEY] = oldLogsType
|
|
32
|
+
}
|
|
33
|
+
if (oldRumType && /^[012]$/.test(oldRumType)) {
|
|
34
|
+
session[RUM_SESSION_KEY] = oldRumType
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!isSessionInExpiredState(session)) {
|
|
38
|
+
expandSessionState(session)
|
|
39
|
+
cookieStoreStrategy.persistSession(session)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { Observable } from '../../tools/observable'
|
|
2
|
+
import type { Context } from '../../tools/serialisation/context'
|
|
3
|
+
import { ValueHistory } from '../../tools/valueHistory'
|
|
4
|
+
import type { RelativeTime } from '../../tools/utils/timeUtils'
|
|
5
|
+
import { relativeNow, clocksOrigin, ONE_MINUTE } from '../../tools/utils/timeUtils'
|
|
6
|
+
import { DOM_EVENT, addEventListener, addEventListeners } from '../../browser/addEventListener'
|
|
7
|
+
import { clearInterval, setInterval } from '../../tools/timer'
|
|
8
|
+
import type { Configuration } from '../configuration'
|
|
9
|
+
import { SESSION_TIME_OUT_DELAY } from './sessionConstants'
|
|
10
|
+
import { startSessionStore } from './sessionStore'
|
|
11
|
+
|
|
12
|
+
export interface SessionManager<TrackingType extends string> {
|
|
13
|
+
findActiveSession: (startTime?: RelativeTime) => SessionContext<TrackingType> | undefined
|
|
14
|
+
renewObservable: Observable<void>
|
|
15
|
+
expireObservable: Observable<void>
|
|
16
|
+
expire: () => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface SessionContext<TrackingType extends string> extends Context {
|
|
20
|
+
id: string
|
|
21
|
+
trackingType: TrackingType
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const VISIBILITY_CHECK_DELAY = ONE_MINUTE
|
|
25
|
+
const SESSION_CONTEXT_TIMEOUT_DELAY = SESSION_TIME_OUT_DELAY
|
|
26
|
+
let stopCallbacks: Array<() => void> = []
|
|
27
|
+
|
|
28
|
+
export function startSessionManager<TrackingType extends string>(
|
|
29
|
+
configuration: Configuration,
|
|
30
|
+
productKey: string,
|
|
31
|
+
computeSessionState: (rawTrackingType?: string) => { trackingType: TrackingType; isTracked: boolean }
|
|
32
|
+
): SessionManager<TrackingType> {
|
|
33
|
+
// TODO - Improve configuration type and remove assertion
|
|
34
|
+
const sessionStore = startSessionStore(configuration.sessionStoreStrategyType!, productKey, computeSessionState)
|
|
35
|
+
stopCallbacks.push(() => sessionStore.stop())
|
|
36
|
+
|
|
37
|
+
const sessionContextHistory = new ValueHistory<SessionContext<TrackingType>>(SESSION_CONTEXT_TIMEOUT_DELAY)
|
|
38
|
+
stopCallbacks.push(() => sessionContextHistory.stop())
|
|
39
|
+
|
|
40
|
+
sessionStore.renewObservable.subscribe(() => {
|
|
41
|
+
sessionContextHistory.add(buildSessionContext(), relativeNow())
|
|
42
|
+
})
|
|
43
|
+
sessionStore.expireObservable.subscribe(() => {
|
|
44
|
+
sessionContextHistory.closeActive(relativeNow())
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
sessionStore.expandOrRenewSession()
|
|
48
|
+
sessionContextHistory.add(buildSessionContext(), clocksOrigin().relative)
|
|
49
|
+
|
|
50
|
+
trackActivity(configuration, () => sessionStore.expandOrRenewSession())
|
|
51
|
+
trackVisibility(configuration, () => sessionStore.expandSession())
|
|
52
|
+
|
|
53
|
+
function buildSessionContext() {
|
|
54
|
+
return {
|
|
55
|
+
id: sessionStore.getSession().id!,
|
|
56
|
+
trackingType: sessionStore.getSession()[productKey] as TrackingType,
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
findActiveSession: (startTime) => sessionContextHistory.find(startTime),
|
|
62
|
+
renewObservable: sessionStore.renewObservable,
|
|
63
|
+
expireObservable: sessionStore.expireObservable,
|
|
64
|
+
expire: sessionStore.expire,
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function stopSessionManager() {
|
|
69
|
+
stopCallbacks.forEach((e) => e())
|
|
70
|
+
stopCallbacks = []
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function trackActivity(configuration: Configuration, expandOrRenewSession: () => void) {
|
|
74
|
+
const { stop } = addEventListeners(
|
|
75
|
+
configuration,
|
|
76
|
+
window,
|
|
77
|
+
[DOM_EVENT.CLICK, DOM_EVENT.TOUCH_START, DOM_EVENT.KEY_DOWN, DOM_EVENT.SCROLL],
|
|
78
|
+
expandOrRenewSession,
|
|
79
|
+
{ capture: true, passive: true }
|
|
80
|
+
)
|
|
81
|
+
stopCallbacks.push(stop)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function trackVisibility(configuration: Configuration, expandSession: () => void) {
|
|
85
|
+
const expandSessionWhenVisible = () => {
|
|
86
|
+
if (document.visibilityState === 'visible') {
|
|
87
|
+
expandSession()
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const { stop } = addEventListener(configuration, document, DOM_EVENT.VISIBILITY_CHANGE, expandSessionWhenVisible)
|
|
92
|
+
stopCallbacks.push(stop)
|
|
93
|
+
|
|
94
|
+
const visibilityCheckInterval = setInterval(expandSessionWhenVisible, VISIBILITY_CHECK_DELAY)
|
|
95
|
+
stopCallbacks.push(() => {
|
|
96
|
+
clearInterval(visibilityCheckInterval)
|
|
97
|
+
})
|
|
98
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { isEmptyObject } from '../../tools/utils/objectUtils'
|
|
2
|
+
import { objectEntries } from '../../tools/utils/polyfills'
|
|
3
|
+
import { dateNow } from '../../tools/utils/timeUtils'
|
|
4
|
+
import { SESSION_EXPIRATION_DELAY } from './sessionConstants'
|
|
5
|
+
|
|
6
|
+
const SESSION_ENTRY_REGEXP = /^([a-z]+)=([a-z0-9-]+)$/
|
|
7
|
+
const SESSION_ENTRY_SEPARATOR = '&'
|
|
8
|
+
|
|
9
|
+
export interface SessionState {
|
|
10
|
+
id?: string
|
|
11
|
+
created?: string
|
|
12
|
+
expire?: string
|
|
13
|
+
lock?: string
|
|
14
|
+
|
|
15
|
+
[key: string]: string | undefined
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function isSessionInExpiredState(session: SessionState) {
|
|
19
|
+
return isEmptyObject(session)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function expandSessionState(session: SessionState) {
|
|
23
|
+
session.expire = String(dateNow() + SESSION_EXPIRATION_DELAY)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function toSessionString(session: SessionState) {
|
|
27
|
+
return objectEntries(session)
|
|
28
|
+
.map(([key, value]) => `${key}=${value as string}`)
|
|
29
|
+
.join(SESSION_ENTRY_SEPARATOR)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function toSessionState(sessionString: string | undefined | null) {
|
|
33
|
+
const session: SessionState = {}
|
|
34
|
+
if (isValidSessionString(sessionString)) {
|
|
35
|
+
sessionString.split(SESSION_ENTRY_SEPARATOR).forEach((entry) => {
|
|
36
|
+
const matches = SESSION_ENTRY_REGEXP.exec(entry)
|
|
37
|
+
if (matches !== null) {
|
|
38
|
+
const [, key, value] = matches
|
|
39
|
+
session[key] = value
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
return session
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function isValidSessionString(sessionString: string | undefined | null): sessionString is string {
|
|
47
|
+
return (
|
|
48
|
+
!!sessionString &&
|
|
49
|
+
(sessionString.indexOf(SESSION_ENTRY_SEPARATOR) !== -1 || SESSION_ENTRY_REGEXP.test(sessionString))
|
|
50
|
+
)
|
|
51
|
+
}
|