@openobserve/browser-core 0.2.11-rc1 → 0.2.11
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/cjs/boot/init.js +1 -1
- package/cjs/boot/init.js.map +1 -1
- package/cjs/browser/addEventListener.d.ts +4 -12
- package/cjs/browser/addEventListener.js +8 -50
- package/cjs/browser/addEventListener.js.map +1 -1
- package/cjs/browser/cookie.d.ts +0 -7
- package/cjs/browser/cookie.js +2 -19
- package/cjs/browser/cookie.js.map +1 -1
- package/cjs/browser/fetchObservable.js +19 -14
- package/cjs/browser/fetchObservable.js.map +1 -1
- package/cjs/browser/pageExitObservable.js +7 -6
- package/cjs/browser/pageExitObservable.js.map +1 -1
- package/cjs/browser/runOnReadyState.js +1 -1
- package/cjs/browser/runOnReadyState.js.map +1 -1
- package/cjs/browser/xhrObservable.d.ts +2 -1
- package/cjs/browser/xhrObservable.js +34 -26
- package/cjs/browser/xhrObservable.js.map +1 -1
- package/cjs/domain/configuration/configuration.d.ts +12 -17
- package/cjs/domain/configuration/configuration.js +9 -8
- package/cjs/domain/configuration/configuration.js.map +1 -1
- package/cjs/domain/configuration/endpointBuilder.d.ts +10 -6
- package/cjs/domain/configuration/endpointBuilder.js +33 -23
- package/cjs/domain/configuration/endpointBuilder.js.map +1 -1
- package/cjs/domain/configuration/index.d.ts +1 -2
- package/cjs/domain/configuration/index.js +1 -3
- package/cjs/domain/configuration/index.js.map +1 -1
- package/cjs/domain/configuration/tags.js.map +1 -1
- package/cjs/domain/configuration/transportConfiguration.js +1 -1
- package/cjs/domain/configuration/transportConfiguration.js.map +1 -1
- package/cjs/domain/console/consoleObservable.js +7 -4
- package/cjs/domain/console/consoleObservable.js.map +1 -1
- package/cjs/domain/deflate/index.d.ts +1 -0
- package/cjs/domain/{connectivity → deflate}/index.js +1 -1
- package/cjs/domain/deflate/index.js.map +1 -0
- package/cjs/domain/deflate/types.d.ts +26 -0
- package/cjs/domain/error/error.d.ts +1 -1
- package/cjs/domain/error/error.js +3 -3
- package/cjs/domain/error/error.js.map +1 -1
- package/cjs/domain/error/error.types.d.ts +2 -2
- package/cjs/domain/error/error.types.js.map +1 -1
- package/cjs/domain/error/trackRuntimeError.d.ts +0 -8
- package/cjs/domain/error/trackRuntimeError.js +6 -39
- package/cjs/domain/error/trackRuntimeError.js.map +1 -1
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -1
- package/cjs/domain/report/browser.types.d.ts +0 -10
- package/cjs/domain/report/reportObservable.d.ts +0 -2
- package/cjs/domain/report/reportObservable.js +7 -7
- package/cjs/domain/report/reportObservable.js.map +1 -1
- package/cjs/domain/session/oldCookiesMigration.js +4 -4
- package/cjs/domain/session/oldCookiesMigration.js.map +1 -1
- package/cjs/domain/session/sessionManager.js +2 -2
- package/cjs/domain/session/sessionManager.js.map +1 -1
- package/cjs/domain/session/sessionState.js.map +1 -1
- package/cjs/domain/session/sessionStore.js.map +1 -1
- package/cjs/domain/session/sessionStoreOperations.d.ts +5 -0
- package/cjs/domain/session/sessionStoreOperations.js +14 -6
- package/cjs/domain/session/sessionStoreOperations.js.map +1 -1
- package/cjs/domain/session/storeStrategies/sessionInCookie.js +2 -13
- package/cjs/domain/session/storeStrategies/sessionInCookie.js.map +1 -1
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js +0 -1
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -1
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.d.ts +0 -1
- package/cjs/domain/synthetics/syntheticsWorkerValues.js +3 -3
- package/cjs/domain/synthetics/syntheticsWorkerValues.js.map +1 -1
- package/cjs/domain/telemetry/rawTelemetryEvent.types.d.ts +0 -4
- package/cjs/domain/telemetry/telemetry.d.ts +1 -5
- package/cjs/domain/telemetry/telemetry.js +6 -17
- package/cjs/domain/telemetry/telemetry.js.map +1 -1
- package/cjs/domain/telemetry/telemetryEvent.types.d.ts +2 -18
- package/cjs/domain/tracekit/computeStackTrace.d.ts +5 -0
- package/cjs/domain/{error → tracekit}/computeStackTrace.js +4 -28
- 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/{context/contextConstants.js → tracekit/types.js} +1 -1
- package/cjs/domain/tracekit/types.js.map +1 -0
- package/cjs/domain/user/user.js.map +1 -1
- package/cjs/index.d.ts +63 -0
- package/cjs/index.js +155 -0
- package/cjs/index.js.map +1 -0
- package/cjs/tools/abstractLifeCycle.js.map +1 -1
- package/cjs/tools/boundedBuffer.js.map +1 -1
- package/cjs/tools/catchUserErrors.js.map +1 -1
- package/cjs/tools/display.d.ts +2 -2
- package/cjs/tools/display.js +17 -13
- package/cjs/tools/display.js.map +1 -1
- package/cjs/tools/experimentalFeatures.d.ts +5 -3
- package/cjs/tools/experimentalFeatures.js +4 -2
- package/cjs/tools/experimentalFeatures.js.map +1 -1
- package/cjs/tools/getGlobalObject.js.map +1 -1
- package/cjs/tools/getZoneJsOriginalValue.js.map +1 -1
- package/cjs/tools/instrumentMethod.d.ts +10 -50
- package/cjs/tools/instrumentMethod.js +36 -59
- package/cjs/tools/instrumentMethod.js.map +1 -1
- package/cjs/tools/matchOption.js.map +1 -1
- package/cjs/tools/mergeInto.js.map +1 -1
- package/cjs/tools/monitor.d.ts +2 -1
- package/cjs/tools/monitor.js +6 -6
- package/cjs/tools/monitor.js.map +1 -1
- package/cjs/tools/observable.d.ts +1 -1
- package/cjs/tools/observable.js +3 -2
- package/cjs/tools/observable.js.map +1 -1
- package/cjs/tools/readBytesFromStream.js.map +1 -1
- package/cjs/tools/sendToExtension.js.map +1 -1
- 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 +2 -1
- package/cjs/tools/serialisation/jsonStringify.js.map +1 -1
- package/cjs/tools/serialisation/sanitize.js.map +1 -1
- package/cjs/tools/utils/browserDetection.d.ts +0 -8
- package/cjs/tools/utils/browserDetection.js +3 -33
- package/cjs/tools/utils/browserDetection.js.map +1 -1
- package/cjs/tools/utils/byteUtils.js.map +1 -1
- package/cjs/tools/utils/functionUtils.js.map +1 -1
- package/cjs/tools/utils/objectUtils.js.map +1 -1
- package/cjs/tools/utils/polyfills.js.map +1 -1
- package/cjs/tools/utils/responseUtils.js.map +1 -1
- package/cjs/tools/utils/stringUtils.d.ts +0 -1
- package/cjs/tools/utils/stringUtils.js +4 -31
- package/cjs/tools/utils/stringUtils.js.map +1 -1
- package/cjs/tools/utils/timeUtils.js.map +1 -1
- package/cjs/tools/utils/typeUtils.js.map +1 -1
- package/cjs/tools/utils/urlPolyfill.js.map +1 -1
- package/cjs/tools/valueHistory.js.map +1 -1
- package/cjs/transport/batch.d.ts +3 -5
- package/cjs/transport/batch.js +29 -73
- package/cjs/transport/batch.js.map +1 -1
- package/cjs/transport/eventBridge.js.map +1 -1
- package/cjs/transport/flushController.d.ts +2 -12
- package/cjs/transport/flushController.js +7 -22
- package/cjs/transport/flushController.js.map +1 -1
- package/cjs/transport/httpRequest.d.ts +2 -3
- package/cjs/transport/httpRequest.js +17 -21
- package/cjs/transport/httpRequest.js.map +1 -1
- package/cjs/transport/sendWithRetryStrategy.d.ts +2 -2
- package/cjs/transport/sendWithRetryStrategy.js +9 -9
- package/cjs/transport/sendWithRetryStrategy.js.map +1 -1
- package/cjs/transport/startBatchWithReplica.d.ts +4 -9
- package/cjs/transport/startBatchWithReplica.js +4 -9
- package/cjs/transport/startBatchWithReplica.js.map +1 -1
- package/esm/boot/init.js +1 -1
- package/esm/boot/init.js.map +1 -1
- package/esm/browser/addEventListener.d.ts +4 -12
- package/esm/browser/addEventListener.js +7 -49
- package/esm/browser/addEventListener.js.map +1 -1
- package/esm/browser/cookie.d.ts +0 -7
- package/esm/browser/cookie.js +2 -17
- package/esm/browser/cookie.js.map +1 -1
- package/esm/browser/fetchObservable.js +20 -15
- package/esm/browser/fetchObservable.js.map +1 -1
- package/esm/browser/pageExitObservable.js +8 -7
- package/esm/browser/pageExitObservable.js.map +1 -1
- package/esm/browser/runOnReadyState.js +2 -2
- package/esm/browser/runOnReadyState.js.map +1 -1
- package/esm/browser/xhrObservable.d.ts +2 -1
- package/esm/browser/xhrObservable.js +36 -28
- package/esm/browser/xhrObservable.js.map +1 -1
- package/esm/domain/configuration/configuration.d.ts +12 -17
- package/esm/domain/configuration/configuration.js +9 -8
- package/esm/domain/configuration/configuration.js.map +1 -1
- package/esm/domain/configuration/endpointBuilder.d.ts +10 -6
- package/esm/domain/configuration/endpointBuilder.js +32 -22
- package/esm/domain/configuration/endpointBuilder.js.map +1 -1
- package/esm/domain/configuration/index.d.ts +1 -2
- package/esm/domain/configuration/index.js +0 -1
- package/esm/domain/configuration/index.js.map +1 -1
- package/esm/domain/configuration/tags.js.map +1 -1
- package/esm/domain/configuration/transportConfiguration.js +1 -1
- package/esm/domain/configuration/transportConfiguration.js.map +1 -1
- package/esm/domain/console/consoleObservable.js +5 -2
- package/esm/domain/console/consoleObservable.js.map +1 -1
- package/esm/domain/deflate/types.d.ts +0 -12
- package/esm/domain/error/error.d.ts +1 -1
- package/esm/domain/error/error.js +1 -1
- package/esm/domain/error/error.js.map +1 -1
- package/esm/domain/error/error.types.d.ts +2 -2
- package/esm/domain/error/error.types.js.map +1 -1
- package/esm/domain/error/trackRuntimeError.d.ts +0 -8
- package/esm/domain/error/trackRuntimeError.js +4 -35
- package/esm/domain/error/trackRuntimeError.js.map +1 -1
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -1
- package/esm/domain/report/browser.types.d.ts +0 -10
- package/esm/domain/report/reportObservable.d.ts +0 -2
- package/esm/domain/report/reportObservable.js +8 -8
- package/esm/domain/report/reportObservable.js.map +1 -1
- package/esm/domain/session/oldCookiesMigration.js +5 -5
- package/esm/domain/session/oldCookiesMigration.js.map +1 -1
- package/esm/domain/session/sessionManager.js +3 -3
- package/esm/domain/session/sessionManager.js.map +1 -1
- package/esm/domain/session/sessionState.js.map +1 -1
- package/esm/domain/session/sessionStore.js.map +1 -1
- package/esm/domain/session/sessionStoreOperations.d.ts +5 -0
- package/esm/domain/session/sessionStoreOperations.js +12 -5
- package/esm/domain/session/sessionStoreOperations.js.map +1 -1
- package/esm/domain/session/storeStrategies/sessionInCookie.js +2 -13
- package/esm/domain/session/storeStrategies/sessionInCookie.js.map +1 -1
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js +0 -1
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -1
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.d.ts +0 -1
- package/esm/domain/synthetics/syntheticsWorkerValues.js +4 -4
- package/esm/domain/synthetics/syntheticsWorkerValues.js.map +1 -1
- package/esm/domain/telemetry/rawTelemetryEvent.types.d.ts +0 -4
- package/esm/domain/telemetry/telemetry.d.ts +1 -5
- package/esm/domain/telemetry/telemetry.js +5 -16
- package/esm/domain/telemetry/telemetry.js.map +1 -1
- package/esm/domain/telemetry/telemetryEvent.types.d.ts +2 -18
- package/esm/domain/tracekit/computeStackTrace.d.ts +5 -0
- package/esm/domain/{error → tracekit}/computeStackTrace.js +3 -26
- 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/user.js.map +1 -1
- package/esm/index.d.ts +5 -9
- package/esm/index.js +5 -8
- package/esm/index.js.map +1 -1
- package/esm/tools/abstractLifeCycle.js.map +1 -1
- package/esm/tools/boundedBuffer.js.map +1 -1
- package/esm/tools/catchUserErrors.js.map +1 -1
- package/esm/tools/display.d.ts +2 -2
- package/esm/tools/display.js +15 -12
- package/esm/tools/display.js.map +1 -1
- package/esm/tools/experimentalFeatures.d.ts +5 -3
- package/esm/tools/experimentalFeatures.js +4 -2
- package/esm/tools/experimentalFeatures.js.map +1 -1
- package/esm/tools/getGlobalObject.js.map +1 -1
- package/esm/tools/getZoneJsOriginalValue.js.map +1 -1
- package/esm/tools/instrumentMethod.d.ts +10 -50
- package/esm/tools/instrumentMethod.js +34 -58
- package/esm/tools/instrumentMethod.js.map +1 -1
- package/esm/tools/matchOption.js.map +1 -1
- package/esm/tools/mergeInto.js.map +1 -1
- package/esm/tools/monitor.d.ts +2 -1
- package/esm/tools/monitor.js +7 -7
- package/esm/tools/monitor.js.map +1 -1
- package/esm/tools/observable.d.ts +1 -1
- package/esm/tools/observable.js +3 -2
- package/esm/tools/observable.js.map +1 -1
- package/esm/tools/readBytesFromStream.js.map +1 -1
- package/esm/tools/sendToExtension.js.map +1 -1
- 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 +2 -1
- package/esm/tools/serialisation/jsonStringify.js.map +1 -1
- package/esm/tools/serialisation/sanitize.js.map +1 -1
- package/esm/tools/utils/browserDetection.d.ts +0 -8
- package/esm/tools/utils/browserDetection.js +2 -30
- package/esm/tools/utils/browserDetection.js.map +1 -1
- package/esm/tools/utils/byteUtils.js.map +1 -1
- package/esm/tools/utils/functionUtils.js.map +1 -1
- package/esm/tools/utils/objectUtils.js.map +1 -1
- package/esm/tools/utils/polyfills.js.map +1 -1
- package/esm/tools/utils/responseUtils.js.map +1 -1
- package/esm/tools/utils/stringUtils.d.ts +0 -1
- package/esm/tools/utils/stringUtils.js +3 -29
- package/esm/tools/utils/stringUtils.js.map +1 -1
- package/esm/tools/utils/timeUtils.js.map +1 -1
- package/esm/tools/utils/typeUtils.js.map +1 -1
- package/esm/tools/utils/urlPolyfill.js.map +1 -1
- package/esm/tools/valueHistory.js.map +1 -1
- package/esm/transport/batch.d.ts +3 -5
- package/esm/transport/batch.js +29 -73
- package/esm/transport/batch.js.map +1 -1
- package/esm/transport/eventBridge.js.map +1 -1
- package/esm/transport/flushController.d.ts +2 -12
- package/esm/transport/flushController.js +7 -22
- package/esm/transport/flushController.js.map +1 -1
- package/esm/transport/httpRequest.d.ts +2 -3
- package/esm/transport/httpRequest.js +17 -21
- package/esm/transport/httpRequest.js.map +1 -1
- package/esm/transport/sendWithRetryStrategy.d.ts +2 -2
- package/esm/transport/sendWithRetryStrategy.js +9 -9
- package/esm/transport/sendWithRetryStrategy.js.map +1 -1
- package/esm/transport/startBatchWithReplica.d.ts +4 -9
- package/esm/transport/startBatchWithReplica.js +4 -9
- package/esm/transport/startBatchWithReplica.js.map +1 -1
- package/package.json +1 -1
- package/src/browser/addEventListener.ts +31 -37
- package/src/browser/cookie.ts +2 -21
- package/src/browser/fetchObservable.ts +25 -21
- package/src/browser/pageExitObservable.ts +3 -1
- package/src/browser/xhrObservable.ts +37 -31
- package/src/domain/configuration/configuration.ts +22 -24
- package/src/domain/configuration/endpointBuilder.ts +46 -33
- package/src/domain/configuration/index.ts +1 -2
- package/src/domain/configuration/transportConfiguration.ts +1 -1
- package/src/domain/console/consoleObservable.ts +7 -3
- package/src/domain/deflate/types.ts +0 -14
- package/src/domain/error/error.ts +2 -2
- package/src/domain/error/error.types.ts +2 -11
- package/src/domain/error/trackRuntimeError.ts +12 -44
- package/src/domain/report/browser.types.ts +0 -12
- package/src/domain/report/reportObservable.ts +6 -8
- package/src/domain/session/oldCookiesMigration.ts +5 -5
- package/src/domain/session/sessionStoreOperations.ts +13 -5
- package/src/domain/session/storeStrategies/sessionInCookie.ts +2 -13
- package/src/domain/session/storeStrategies/sessionInLocalStorage.ts +0 -1
- package/src/domain/session/storeStrategies/sessionStoreStrategy.ts +0 -1
- package/src/domain/synthetics/syntheticsWorkerValues.ts +4 -4
- package/src/domain/telemetry/rawTelemetryEvent.types.ts +0 -5
- package/src/domain/telemetry/telemetry.ts +7 -22
- package/src/domain/telemetry/telemetryEvent.types.ts +2 -18
- package/src/domain/{error → tracekit}/computeStackTrace.ts +4 -49
- 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/index.ts +7 -13
- package/src/tools/display.ts +13 -14
- package/src/tools/experimentalFeatures.ts +4 -2
- package/src/tools/instrumentMethod.ts +59 -103
- package/src/tools/mergeInto.ts +16 -16
- package/src/tools/monitor.ts +5 -5
- package/src/tools/observable.ts +5 -3
- package/src/tools/serialisation/contextManager.ts +79 -0
- package/src/tools/serialisation/heavyCustomerDataWarning.ts +26 -0
- package/src/tools/utils/browserDetection.ts +2 -43
- package/src/tools/utils/polyfills.ts +4 -1
- package/src/tools/utils/stringUtils.ts +4 -30
- package/src/transport/batch.ts +31 -86
- package/src/transport/flushController.ts +7 -22
- package/src/transport/httpRequest.ts +16 -23
- package/src/transport/sendWithRetryStrategy.ts +10 -10
- package/src/transport/startBatchWithReplica.ts +6 -22
- package/cjs/domain/connectivity/connectivity.d.ts +0 -13
- package/cjs/domain/connectivity/connectivity.js +0 -14
- package/cjs/domain/connectivity/connectivity.js.map +0 -1
- package/cjs/domain/connectivity/index.d.ts +0 -1
- package/cjs/domain/connectivity/index.js.map +0 -1
- package/cjs/domain/context/contextConstants.d.ts +0 -5
- package/cjs/domain/context/contextConstants.js.map +0 -1
- package/cjs/domain/context/contextManager.d.ts +0 -12
- package/cjs/domain/context/contextManager.js +0 -43
- package/cjs/domain/context/contextManager.js.map +0 -1
- package/cjs/domain/context/customerDataTracker.d.ts +0 -45
- package/cjs/domain/context/customerDataTracker.js +0 -107
- package/cjs/domain/context/customerDataTracker.js.map +0 -1
- package/cjs/domain/context/storeContextManager.d.ts +0 -6
- package/cjs/domain/context/storeContextManager.js +0 -38
- package/cjs/domain/context/storeContextManager.js.map +0 -1
- package/cjs/domain/error/computeStackTrace.d.ts +0 -33
- package/cjs/domain/error/computeStackTrace.js.map +0 -1
- package/cjs/tools/encoder.d.ts +0 -53
- package/cjs/tools/encoder.js +0 -41
- package/cjs/tools/encoder.js.map +0 -1
- package/esm/domain/connectivity/connectivity.d.ts +0 -13
- package/esm/domain/connectivity/connectivity.js +0 -10
- package/esm/domain/connectivity/connectivity.js.map +0 -1
- package/esm/domain/connectivity/index.d.ts +0 -1
- package/esm/domain/connectivity/index.js +0 -2
- package/esm/domain/connectivity/index.js.map +0 -1
- package/esm/domain/context/contextConstants.d.ts +0 -5
- package/esm/domain/context/contextConstants.js +0 -2
- package/esm/domain/context/contextConstants.js.map +0 -1
- package/esm/domain/context/contextManager.d.ts +0 -12
- package/esm/domain/context/contextManager.js +0 -39
- package/esm/domain/context/contextManager.js.map +0 -1
- package/esm/domain/context/customerDataTracker.d.ts +0 -45
- package/esm/domain/context/customerDataTracker.js +0 -102
- package/esm/domain/context/customerDataTracker.js.map +0 -1
- package/esm/domain/context/storeContextManager.d.ts +0 -6
- package/esm/domain/context/storeContextManager.js +0 -32
- package/esm/domain/context/storeContextManager.js.map +0 -1
- package/esm/domain/error/computeStackTrace.d.ts +0 -33
- package/esm/domain/error/computeStackTrace.js.map +0 -1
- package/esm/tools/encoder.d.ts +0 -53
- package/esm/tools/encoder.js +0 -37
- package/esm/tools/encoder.js.map +0 -1
- package/src/domain/connectivity/connectivity.ts +0 -27
- package/src/domain/connectivity/index.ts +0 -1
- package/src/domain/context/contextConstants.ts +0 -5
- package/src/domain/context/contextManager.ts +0 -48
- package/src/domain/context/customerDataTracker.ts +0 -134
- package/src/domain/context/storeContextManager.ts +0 -51
- package/src/tools/encoder.ts +0 -102
|
@@ -24,15 +24,22 @@ export interface InitConfiguration {
|
|
|
24
24
|
// global options
|
|
25
25
|
clientToken: string
|
|
26
26
|
beforeSend?: GenericBeforeSendCallback | undefined
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated use sessionSampleRate instead
|
|
29
|
+
*/
|
|
30
|
+
sampleRate?: number | undefined
|
|
27
31
|
sessionSampleRate?: number | undefined
|
|
28
32
|
telemetrySampleRate?: number | undefined
|
|
29
33
|
silentMultipleInit?: boolean | undefined
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
storeContextsAcrossPages?: boolean | undefined
|
|
34
|
+
trackResources?: boolean | undefined
|
|
35
|
+
trackLongTasks?: boolean | undefined
|
|
33
36
|
|
|
34
37
|
// transport options
|
|
35
|
-
proxy?: string |
|
|
38
|
+
proxy?: string | undefined
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated use `proxy` instead
|
|
41
|
+
*/
|
|
42
|
+
proxyUrl?: string | undefined
|
|
36
43
|
site?: string | undefined
|
|
37
44
|
|
|
38
45
|
// tag and context options
|
|
@@ -41,19 +48,17 @@ export interface InitConfiguration {
|
|
|
41
48
|
version: string | undefined
|
|
42
49
|
|
|
43
50
|
// cookie options
|
|
44
|
-
/**
|
|
45
|
-
* @deprecated use usePartitionedCrossSiteSessionCookie instead
|
|
46
|
-
*/
|
|
47
51
|
useCrossSiteSessionCookie?: boolean | undefined
|
|
48
|
-
usePartitionedCrossSiteSessionCookie?: boolean | undefined
|
|
49
52
|
useSecureSessionCookie?: boolean | undefined
|
|
50
53
|
trackSessionAcrossSubdomains?: boolean | undefined
|
|
51
54
|
|
|
55
|
+
// alternate storage option
|
|
56
|
+
allowFallbackToLocalStorage?: boolean | undefined
|
|
57
|
+
|
|
52
58
|
// internal options
|
|
53
59
|
enableExperimentalFeatures?: string[] | undefined
|
|
54
60
|
replica?: ReplicaUserConfiguration | undefined
|
|
55
61
|
datacenter?: string
|
|
56
|
-
// TODO next major: remove this option and replace usages by proxyFn
|
|
57
62
|
internalAnalyticsSubdomain?: string
|
|
58
63
|
|
|
59
64
|
telemetryConfigurationSampleRate?: number
|
|
@@ -67,12 +72,6 @@ export interface InitConfiguration {
|
|
|
67
72
|
// for this option.
|
|
68
73
|
type GenericBeforeSendCallback = (event: any, context?: any) => unknown
|
|
69
74
|
|
|
70
|
-
/**
|
|
71
|
-
* path: /api/vX/product
|
|
72
|
-
* parameters: xxx=yyy&zzz=aaa
|
|
73
|
-
*/
|
|
74
|
-
type ProxyFn = (options: { path: string; parameters: string }) => string
|
|
75
|
-
|
|
76
75
|
interface ReplicaUserConfiguration {
|
|
77
76
|
applicationId?: string
|
|
78
77
|
clientToken: string
|
|
@@ -87,7 +86,6 @@ export interface Configuration extends TransportConfiguration {
|
|
|
87
86
|
telemetryConfigurationSampleRate: number
|
|
88
87
|
service: string | undefined
|
|
89
88
|
silentMultipleInit: boolean
|
|
90
|
-
allowUntrustedEvents: boolean
|
|
91
89
|
|
|
92
90
|
// Event limits
|
|
93
91
|
eventRateLimiterThreshold: number // Limit the maximum number of actions, errors and logs per minutes
|
|
@@ -106,7 +104,8 @@ export function validateAndBuildConfiguration(initConfiguration: InitConfigurati
|
|
|
106
104
|
return
|
|
107
105
|
}
|
|
108
106
|
|
|
109
|
-
|
|
107
|
+
const sessionSampleRate = initConfiguration.sessionSampleRate ?? initConfiguration.sampleRate
|
|
108
|
+
if (sessionSampleRate !== undefined && !isPercentage(sessionSampleRate)) {
|
|
110
109
|
display.error('Session Sample Rate should be a number between 0 and 100')
|
|
111
110
|
return
|
|
112
111
|
}
|
|
@@ -138,12 +137,11 @@ export function validateAndBuildConfiguration(initConfiguration: InitConfigurati
|
|
|
138
137
|
beforeSend:
|
|
139
138
|
initConfiguration.beforeSend && catchUserErrors(initConfiguration.beforeSend, 'beforeSend threw an error:'),
|
|
140
139
|
sessionStoreStrategyType: selectSessionStoreStrategyType(initConfiguration),
|
|
141
|
-
sessionSampleRate:
|
|
140
|
+
sessionSampleRate: sessionSampleRate ?? 100,
|
|
142
141
|
telemetrySampleRate: initConfiguration.telemetrySampleRate ?? 20,
|
|
143
142
|
telemetryConfigurationSampleRate: initConfiguration.telemetryConfigurationSampleRate ?? 5,
|
|
144
143
|
service: initConfiguration.service,
|
|
145
144
|
silentMultipleInit: !!initConfiguration.silentMultipleInit,
|
|
146
|
-
allowUntrustedEvents: !!initConfiguration.allowUntrustedEvents,
|
|
147
145
|
|
|
148
146
|
/**
|
|
149
147
|
* beacon payload max queue size implementation is 64kb
|
|
@@ -175,19 +173,19 @@ export function validateAndBuildConfiguration(initConfiguration: InitConfigurati
|
|
|
175
173
|
}
|
|
176
174
|
|
|
177
175
|
export function serializeConfiguration(initConfiguration: InitConfiguration): Partial<RawTelemetryConfiguration> {
|
|
176
|
+
const proxy = initConfiguration.proxy ?? initConfiguration.proxyUrl
|
|
178
177
|
return {
|
|
179
|
-
session_sample_rate: initConfiguration.sessionSampleRate,
|
|
178
|
+
session_sample_rate: initConfiguration.sessionSampleRate ?? initConfiguration.sampleRate,
|
|
180
179
|
telemetry_sample_rate: initConfiguration.telemetrySampleRate,
|
|
181
180
|
telemetry_configuration_sample_rate: initConfiguration.telemetryConfigurationSampleRate,
|
|
182
181
|
use_before_send: !!initConfiguration.beforeSend,
|
|
183
182
|
use_cross_site_session_cookie: initConfiguration.useCrossSiteSessionCookie,
|
|
184
|
-
use_partitioned_cross_site_session_cookie: initConfiguration.usePartitionedCrossSiteSessionCookie,
|
|
185
183
|
use_secure_session_cookie: initConfiguration.useSecureSessionCookie,
|
|
186
|
-
use_proxy: !!
|
|
184
|
+
use_proxy: proxy !== undefined ? !!proxy : undefined,
|
|
187
185
|
silent_multiple_init: initConfiguration.silentMultipleInit,
|
|
188
186
|
track_session_across_subdomains: initConfiguration.trackSessionAcrossSubdomains,
|
|
187
|
+
track_resources: initConfiguration.trackResources,
|
|
188
|
+
track_long_task: initConfiguration.trackLongTasks,
|
|
189
189
|
allow_fallback_to_local_storage: !!initConfiguration.allowFallbackToLocalStorage,
|
|
190
|
-
store_contexts_across_pages: !!initConfiguration.storeContextsAcrossPages,
|
|
191
|
-
allow_untrusted_events: !!initConfiguration.allowUntrustedEvents,
|
|
192
190
|
}
|
|
193
191
|
}
|
|
@@ -1,39 +1,51 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RetryInfo, FlushReason } from '../../transport'
|
|
2
2
|
import { timeStampNow } from '../../tools/utils/timeUtils'
|
|
3
3
|
import { normalizeUrl } from '../../tools/utils/urlPolyfill'
|
|
4
4
|
import { ExperimentalFeature, isExperimentalFeatureEnabled } from '../../tools/experimentalFeatures'
|
|
5
5
|
import { generateUUID } from '../../tools/utils/stringUtils'
|
|
6
6
|
import type { InitConfiguration } from './configuration'
|
|
7
|
-
import { INTAKE_SITE_US1 } from './intakeSites'
|
|
7
|
+
import { INTAKE_SITE_AP1, INTAKE_SITE_US1 } from './intakeSites'
|
|
8
8
|
|
|
9
9
|
// replaced at build time
|
|
10
10
|
declare const __BUILD_ENV__SDK_VERSION__: string
|
|
11
11
|
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
export const ENDPOINTS = {
|
|
13
|
+
logs: 'logs',
|
|
14
|
+
rum: 'rum',
|
|
15
|
+
sessionReplay: 'session-replay',
|
|
16
|
+
} as const
|
|
17
|
+
|
|
18
|
+
const INTAKE_TRACKS = {
|
|
19
|
+
logs: 'logs',
|
|
20
|
+
rum: 'rum',
|
|
21
|
+
sessionReplay: 'replay',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type EndpointType = keyof typeof ENDPOINTS
|
|
20
25
|
|
|
21
26
|
export type EndpointBuilder = ReturnType<typeof createEndpointBuilder>
|
|
22
27
|
|
|
23
28
|
export function createEndpointBuilder(
|
|
24
29
|
initConfiguration: InitConfiguration,
|
|
25
|
-
|
|
30
|
+
endpointType: EndpointType,
|
|
26
31
|
configurationTags: string[]
|
|
27
32
|
) {
|
|
28
|
-
const buildUrlWithParameters = createEndpointUrlWithParametersBuilder(initConfiguration,
|
|
33
|
+
const buildUrlWithParameters = createEndpointUrlWithParametersBuilder(initConfiguration, endpointType)
|
|
29
34
|
|
|
30
35
|
return {
|
|
31
|
-
build(api:
|
|
32
|
-
const parameters = buildEndpointParameters(
|
|
36
|
+
build(api: 'xhr' | 'fetch' | 'beacon', flushReason?: FlushReason, retry?: RetryInfo) {
|
|
37
|
+
const parameters = buildEndpointParameters(
|
|
38
|
+
initConfiguration,
|
|
39
|
+
endpointType,
|
|
40
|
+
configurationTags,
|
|
41
|
+
api,
|
|
42
|
+
flushReason,
|
|
43
|
+
retry
|
|
44
|
+
)
|
|
33
45
|
return buildUrlWithParameters(parameters)
|
|
34
46
|
},
|
|
35
47
|
urlPrefix: buildUrlWithParameters(''),
|
|
36
|
-
|
|
48
|
+
endpointType,
|
|
37
49
|
}
|
|
38
50
|
}
|
|
39
51
|
|
|
@@ -44,26 +56,32 @@ export function createEndpointBuilder(
|
|
|
44
56
|
*/
|
|
45
57
|
function createEndpointUrlWithParametersBuilder(
|
|
46
58
|
initConfiguration: InitConfiguration,
|
|
47
|
-
|
|
59
|
+
endpointType: EndpointType
|
|
48
60
|
): (parameters: string) => string {
|
|
49
|
-
const { proxy, apiVersion, organizationIdentifier, insecureHTTP } = initConfiguration
|
|
61
|
+
const { proxy, proxyUrl, apiVersion, organizationIdentifier, insecureHTTP } = initConfiguration
|
|
50
62
|
|
|
51
|
-
const path = `/rum/${apiVersion}/${organizationIdentifier}/${
|
|
63
|
+
const path = `/rum/${apiVersion}/${organizationIdentifier}/${INTAKE_TRACKS[endpointType]}`
|
|
52
64
|
|
|
53
65
|
if (proxy) {
|
|
54
66
|
const normalizedProxyUrl = normalizeUrl(proxy)
|
|
55
|
-
return (parameters) => `${normalizedProxyUrl}?
|
|
67
|
+
return (parameters) => `${normalizedProxyUrl}?ooforward=${encodeURIComponent(`${path}?${parameters}`)}`
|
|
56
68
|
}
|
|
57
|
-
|
|
58
|
-
|
|
69
|
+
|
|
70
|
+
const host = buildEndpointHost(initConfiguration, endpointType)
|
|
71
|
+
|
|
72
|
+
if (proxy === undefined && proxyUrl) {
|
|
73
|
+
// TODO: remove this in a future major.
|
|
74
|
+
const normalizedProxyUrl = normalizeUrl(proxyUrl)
|
|
75
|
+
return (parameters) =>
|
|
76
|
+
`${normalizedProxyUrl}?ooforward=${encodeURIComponent(`https://${host}${path}?${parameters}`)}`
|
|
59
77
|
}
|
|
60
|
-
|
|
78
|
+
|
|
61
79
|
const protocol = insecureHTTP ? 'http' : 'https'
|
|
62
80
|
|
|
63
81
|
return (parameters) => `${protocol}://${host}${path}?${parameters}`
|
|
64
82
|
}
|
|
65
83
|
|
|
66
|
-
function buildEndpointHost(initConfiguration: InitConfiguration) {
|
|
84
|
+
function buildEndpointHost(initConfiguration: InitConfiguration, endpointType: EndpointType) {
|
|
67
85
|
const { site = INTAKE_SITE_US1, internalAnalyticsSubdomain } = initConfiguration
|
|
68
86
|
|
|
69
87
|
return site
|
|
@@ -83,10 +101,11 @@ function buildEndpointHost(initConfiguration: InitConfiguration) {
|
|
|
83
101
|
*/
|
|
84
102
|
function buildEndpointParameters(
|
|
85
103
|
{ clientToken, internalAnalyticsSubdomain }: InitConfiguration,
|
|
86
|
-
|
|
104
|
+
endpointType: EndpointType,
|
|
87
105
|
configurationTags: string[],
|
|
88
|
-
api:
|
|
89
|
-
|
|
106
|
+
api: 'xhr' | 'fetch' | 'beacon',
|
|
107
|
+
flushReason: FlushReason | undefined,
|
|
108
|
+
retry: RetryInfo | undefined
|
|
90
109
|
) {
|
|
91
110
|
const tags = [`sdk_version:${__BUILD_ENV__SDK_VERSION__}`, `api:${api}`].concat(configurationTags)
|
|
92
111
|
if (flushReason && isExperimentalFeatureEnabled(ExperimentalFeature.COLLECT_FLUSH_REASON)) {
|
|
@@ -95,7 +114,6 @@ function buildEndpointParameters(
|
|
|
95
114
|
if (retry) {
|
|
96
115
|
tags.push(`retry_count:${retry.count}`, `retry_after:${retry.lastFailureStatus}`)
|
|
97
116
|
}
|
|
98
|
-
|
|
99
117
|
const parameters = [
|
|
100
118
|
'o2source=browser',
|
|
101
119
|
`o2tags=${encodeURIComponent(tags.join(','))}`,
|
|
@@ -105,14 +123,9 @@ function buildEndpointParameters(
|
|
|
105
123
|
`o2-request-id=${generateUUID()}`,
|
|
106
124
|
]
|
|
107
125
|
|
|
108
|
-
if (
|
|
109
|
-
parameters.push(`o2-evp-encoding=${encoding}`)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (trackType === 'rum') {
|
|
126
|
+
if (endpointType === 'rum') {
|
|
113
127
|
parameters.push(`batch_time=${timeStampNow()}`)
|
|
114
128
|
}
|
|
115
|
-
|
|
116
129
|
if (internalAnalyticsSubdomain) {
|
|
117
130
|
parameters.reverse()
|
|
118
131
|
}
|
|
@@ -5,6 +5,5 @@ export {
|
|
|
5
5
|
validateAndBuildConfiguration,
|
|
6
6
|
serializeConfiguration,
|
|
7
7
|
} from './configuration'
|
|
8
|
-
export { createEndpointBuilder, EndpointBuilder,
|
|
8
|
+
export { createEndpointBuilder, EndpointBuilder, EndpointType } from './endpointBuilder'
|
|
9
9
|
export * from './intakeSites'
|
|
10
|
-
export { computeTransportConfiguration } from './transportConfiguration'
|
|
@@ -42,7 +42,7 @@ function computeEndpointBuilders(initConfiguration: InitConfiguration, tags: str
|
|
|
42
42
|
return {
|
|
43
43
|
logsEndpointBuilder: createEndpointBuilder(initConfiguration, 'logs', tags),
|
|
44
44
|
rumEndpointBuilder: createEndpointBuilder(initConfiguration, 'rum', tags),
|
|
45
|
-
sessionReplayEndpointBuilder: createEndpointBuilder(initConfiguration, '
|
|
45
|
+
sessionReplayEndpointBuilder: createEndpointBuilder(initConfiguration, 'sessionReplay', tags),
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { computeStackTrace } from '../tracekit'
|
|
1
2
|
import { createHandlingStack, formatErrorMessage, toStackTraceString, tryToGetFingerprint } from '../error/error'
|
|
2
3
|
import { mergeObservables, Observable } from '../../tools/observable'
|
|
3
4
|
import { ConsoleApiName, globalConsole } from '../../tools/display'
|
|
@@ -5,7 +6,6 @@ import { callMonitored } from '../../tools/monitor'
|
|
|
5
6
|
import { sanitize } from '../../tools/serialisation/sanitize'
|
|
6
7
|
import { find } from '../../tools/utils/polyfills'
|
|
7
8
|
import { jsonStringify } from '../../tools/serialisation/jsonStringify'
|
|
8
|
-
import { computeStackTrace } from '../error/computeStackTrace'
|
|
9
9
|
|
|
10
10
|
export interface ConsoleLog {
|
|
11
11
|
message: string
|
|
@@ -33,7 +33,7 @@ export function resetConsoleObservable() {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function createConsoleObservable(api: ConsoleApiName) {
|
|
36
|
-
|
|
36
|
+
const observable = new Observable<ConsoleLog>(() => {
|
|
37
37
|
const originalConsoleApi = globalConsole[api]
|
|
38
38
|
|
|
39
39
|
globalConsole[api] = (...params: unknown[]) => {
|
|
@@ -49,10 +49,13 @@ function createConsoleObservable(api: ConsoleApiName) {
|
|
|
49
49
|
globalConsole[api] = originalConsoleApi
|
|
50
50
|
}
|
|
51
51
|
})
|
|
52
|
+
|
|
53
|
+
return observable
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
function buildConsoleLog(params: unknown[], api: ConsoleApiName, handlingStack: string): ConsoleLog {
|
|
55
|
-
|
|
57
|
+
// Todo: remove console error prefix in the next major version
|
|
58
|
+
let message = params.map((param) => formatConsoleParameters(param)).join(' ')
|
|
56
59
|
let stack
|
|
57
60
|
let fingerprint
|
|
58
61
|
|
|
@@ -60,6 +63,7 @@ function buildConsoleLog(params: unknown[], api: ConsoleApiName, handlingStack:
|
|
|
60
63
|
const firstErrorParam = find(params, (param: unknown): param is Error => param instanceof Error)
|
|
61
64
|
stack = firstErrorParam ? toStackTraceString(computeStackTrace(firstErrorParam)) : undefined
|
|
62
65
|
fingerprint = tryToGetFingerprint(firstErrorParam)
|
|
66
|
+
message = `console error: ${message}`
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
return {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { Encoder } from '../../tools/encoder'
|
|
2
|
-
|
|
3
1
|
export type DeflateWorkerAction =
|
|
4
2
|
// Action to send when creating the worker to check if the communication is working correctly.
|
|
5
3
|
// The worker should respond with a 'initialized' response.
|
|
@@ -41,15 +39,3 @@ export type DeflateWorkerResponse =
|
|
|
41
39
|
streamId?: number
|
|
42
40
|
error: Error | string
|
|
43
41
|
}
|
|
44
|
-
|
|
45
|
-
export interface DeflateWorker extends Worker {
|
|
46
|
-
postMessage(message: DeflateWorkerAction): void
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export type DeflateEncoder = Encoder<Uint8Array> & { stop: () => void }
|
|
50
|
-
|
|
51
|
-
export const enum DeflateEncoderStreamId {
|
|
52
|
-
REPLAY = 1,
|
|
53
|
-
RUM = 2,
|
|
54
|
-
RUM_REPLICA = 3,
|
|
55
|
-
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import type { StackTrace } from '../tracekit'
|
|
2
|
+
import { computeStackTrace } from '../tracekit'
|
|
1
3
|
import { callMonitored } from '../../tools/monitor'
|
|
2
4
|
import { sanitize } from '../../tools/serialisation/sanitize'
|
|
3
5
|
import type { ClocksState } from '../../tools/utils/timeUtils'
|
|
4
6
|
import { noop } from '../../tools/utils/functionUtils'
|
|
5
7
|
import { jsonStringify } from '../../tools/serialisation/jsonStringify'
|
|
6
8
|
import type { ErrorSource, ErrorHandling, RawError, RawErrorCause, ErrorWithCause, NonErrorPrefix } from './error.types'
|
|
7
|
-
import type { StackTrace } from './computeStackTrace'
|
|
8
|
-
import { computeStackTrace } from './computeStackTrace'
|
|
9
9
|
|
|
10
10
|
export const NO_ERROR_STACK_PRESENT_MESSAGE = 'No stack, consider using an instance of Error'
|
|
11
11
|
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import type { ClocksState } from '../../tools/utils/timeUtils'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
//
|
|
6
|
-
// Because we still support TS 3.8, we need to declare our own type. We can remove it once we drop
|
|
7
|
-
// support for TS v4.7 and before. The 'cause' property defined by TS needs to be omitted because
|
|
8
|
-
// we define it with a type `unknown` which is incompatible with TS 4.6 and 4.7.
|
|
9
|
-
//
|
|
10
|
-
// [1]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-6/#target-es2022
|
|
11
|
-
// [2]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/#lib-d-ts-updates
|
|
12
|
-
export interface ErrorWithCause extends Omit<Error, 'cause'> {
|
|
13
|
-
cause?: unknown
|
|
3
|
+
export interface ErrorWithCause extends Error {
|
|
4
|
+
cause?: Error
|
|
14
5
|
}
|
|
15
6
|
|
|
16
7
|
export type RawErrorCause = {
|
|
@@ -1,53 +1,21 @@
|
|
|
1
|
-
import { instrumentMethod } from '../../tools/instrumentMethod'
|
|
2
1
|
import type { Observable } from '../../tools/observable'
|
|
3
2
|
import { clocksNow } from '../../tools/utils/timeUtils'
|
|
4
|
-
import
|
|
5
|
-
import { computeStackTrace, computeStackTraceFromOnErrorMessage } from './computeStackTrace'
|
|
3
|
+
import { startUnhandledErrorCollection } from '../tracekit'
|
|
6
4
|
import { computeRawError } from './error'
|
|
7
5
|
import type { RawError } from './error.types'
|
|
8
6
|
import { ErrorHandling, ErrorSource, NonErrorPrefix } from './error.types'
|
|
9
7
|
|
|
10
|
-
export type UnhandledErrorCallback = (stackTrace: StackTrace, originalError?: any) => any
|
|
11
|
-
|
|
12
8
|
export function trackRuntimeError(errorObservable: Observable<RawError>) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const { stop: stopInstrumentingOnError } = instrumentOnError(handleRuntimeError)
|
|
25
|
-
const { stop: stopInstrumentingOnUnhandledRejection } = instrumentUnhandledRejection(handleRuntimeError)
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
stop: () => {
|
|
29
|
-
stopInstrumentingOnError()
|
|
30
|
-
stopInstrumentingOnUnhandledRejection()
|
|
31
|
-
},
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function instrumentOnError(callback: UnhandledErrorCallback) {
|
|
36
|
-
return instrumentMethod(window, 'onerror', ({ parameters: [messageObj, url, line, column, errorObj] }) => {
|
|
37
|
-
let stackTrace
|
|
38
|
-
if (errorObj instanceof Error) {
|
|
39
|
-
stackTrace = computeStackTrace(errorObj)
|
|
40
|
-
} else {
|
|
41
|
-
stackTrace = computeStackTraceFromOnErrorMessage(messageObj, url, line, column)
|
|
42
|
-
}
|
|
43
|
-
callback(stackTrace, errorObj ?? messageObj)
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function instrumentUnhandledRejection(callback: UnhandledErrorCallback) {
|
|
48
|
-
return instrumentMethod(window, 'onunhandledrejection', ({ parameters: [e] }) => {
|
|
49
|
-
const reason = e.reason || 'Empty reason'
|
|
50
|
-
const stack = computeStackTrace(reason)
|
|
51
|
-
callback(stack, reason)
|
|
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
|
+
)
|
|
52
20
|
})
|
|
53
21
|
}
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
export type ReportType = DeprecationReport['type'] | InterventionReport['type']
|
|
2
2
|
|
|
3
|
-
interface Report {
|
|
4
|
-
type: ReportType
|
|
5
|
-
url: string
|
|
6
|
-
body: DeprecationReportBody | InterventionReportBody
|
|
7
|
-
toJSON(): any
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface ReportBody {
|
|
11
|
-
toJSON(): any
|
|
12
|
-
}
|
|
13
|
-
|
|
14
3
|
export interface DeprecationReport extends Report {
|
|
15
4
|
type: 'deprecation'
|
|
16
5
|
body: DeprecationReportBody
|
|
@@ -28,7 +17,6 @@ export interface InterventionReport extends Report {
|
|
|
28
17
|
type: 'intervention'
|
|
29
18
|
body: InterventionReportBody
|
|
30
19
|
}
|
|
31
|
-
|
|
32
20
|
export interface InterventionReportBody extends ReportBody {
|
|
33
21
|
id: string
|
|
34
22
|
message: string
|
|
@@ -19,7 +19,6 @@ export interface RawReport {
|
|
|
19
19
|
type: RawReportType
|
|
20
20
|
subtype: string
|
|
21
21
|
message: string
|
|
22
|
-
originalReport: SecurityPolicyViolationEvent | DeprecationReport | InterventionReport
|
|
23
22
|
stack?: string
|
|
24
23
|
}
|
|
25
24
|
|
|
@@ -39,7 +38,7 @@ export function initReportObservable(configuration: Configuration, apis: RawRepo
|
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
function createReportObservable(reportTypes: ReportType[]) {
|
|
42
|
-
|
|
41
|
+
const observable = new Observable<RawReport>(() => {
|
|
43
42
|
if (!window.ReportingObserver) {
|
|
44
43
|
return
|
|
45
44
|
}
|
|
@@ -60,26 +59,26 @@ function createReportObservable(reportTypes: ReportType[]) {
|
|
|
60
59
|
observer.disconnect()
|
|
61
60
|
}
|
|
62
61
|
})
|
|
62
|
+
|
|
63
|
+
return observable
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
function createCspViolationReportObservable(configuration: Configuration) {
|
|
66
|
-
|
|
67
|
+
const observable = new Observable<RawReport>(() => {
|
|
67
68
|
const { stop } = addEventListener(configuration, document, DOM_EVENT.SECURITY_POLICY_VIOLATION, (event) => {
|
|
68
69
|
observable.notify(buildRawReportFromCspViolation(event))
|
|
69
70
|
})
|
|
70
71
|
|
|
71
72
|
return stop
|
|
72
73
|
})
|
|
74
|
+
return observable
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
function buildRawReportFromReport(
|
|
76
|
-
const { type, body } = report
|
|
77
|
-
|
|
77
|
+
function buildRawReportFromReport({ type, body }: DeprecationReport | InterventionReport): RawReport {
|
|
78
78
|
return {
|
|
79
79
|
type,
|
|
80
80
|
subtype: body.id,
|
|
81
81
|
message: `${type}: ${body.message}`,
|
|
82
|
-
originalReport: report,
|
|
83
82
|
stack: buildStack(body.id, body.message, body.sourceFile, body.lineNumber, body.columnNumber),
|
|
84
83
|
}
|
|
85
84
|
}
|
|
@@ -100,7 +99,6 @@ function buildRawReportFromCspViolation(event: SecurityPolicyViolationEvent): Ra
|
|
|
100
99
|
event.lineNumber,
|
|
101
100
|
event.columnNumber
|
|
102
101
|
),
|
|
103
|
-
originalReport: event,
|
|
104
102
|
}
|
|
105
103
|
}
|
|
106
104
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getCookie } from '../../browser/cookie'
|
|
2
2
|
import type { SessionStoreStrategy } from './storeStrategies/sessionStoreStrategy'
|
|
3
3
|
import { SESSION_STORE_KEY } from './storeStrategies/sessionStoreStrategy'
|
|
4
4
|
import type { SessionState } from './sessionState'
|
|
@@ -17,11 +17,11 @@ export const LOGS_SESSION_KEY = 'logs'
|
|
|
17
17
|
* to allow older sdk versions to be upgraded to newer versions without compatibility issues.
|
|
18
18
|
*/
|
|
19
19
|
export function tryOldCookiesMigration(cookieStoreStrategy: SessionStoreStrategy) {
|
|
20
|
-
const sessionString =
|
|
20
|
+
const sessionString = getCookie(SESSION_STORE_KEY)
|
|
21
21
|
if (!sessionString) {
|
|
22
|
-
const oldSessionId =
|
|
23
|
-
const oldRumType =
|
|
24
|
-
const oldLogsType =
|
|
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
25
|
const session: SessionState = {}
|
|
26
26
|
|
|
27
27
|
if (oldSessionId) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { setTimeout } from '../../tools/timer'
|
|
2
2
|
import { generateUUID } from '../../tools/utils/stringUtils'
|
|
3
|
+
import { isChromium } from '../../tools/utils/browserDetection'
|
|
3
4
|
import type { SessionStoreStrategy } from './storeStrategies/sessionStoreStrategy'
|
|
4
5
|
import type { SessionState } from './sessionState'
|
|
5
6
|
import { expandSessionState, isSessionInExpiredState } from './sessionState'
|
|
@@ -19,7 +20,8 @@ export function processSessionStoreOperations(
|
|
|
19
20
|
sessionStoreStrategy: SessionStoreStrategy,
|
|
20
21
|
numberOfRetries = 0
|
|
21
22
|
) {
|
|
22
|
-
const {
|
|
23
|
+
const { retrieveSession, persistSession, clearSession } = sessionStoreStrategy
|
|
24
|
+
const lockEnabled = isLockEnabled()
|
|
23
25
|
|
|
24
26
|
if (!ongoingOperations) {
|
|
25
27
|
ongoingOperations = operations
|
|
@@ -28,13 +30,13 @@ export function processSessionStoreOperations(
|
|
|
28
30
|
bufferedOperations.push(operations)
|
|
29
31
|
return
|
|
30
32
|
}
|
|
31
|
-
if (
|
|
33
|
+
if (lockEnabled && numberOfRetries >= LOCK_MAX_TRIES) {
|
|
32
34
|
next(sessionStoreStrategy)
|
|
33
35
|
return
|
|
34
36
|
}
|
|
35
37
|
let currentLock: string
|
|
36
38
|
let currentSession = retrieveSession()
|
|
37
|
-
if (
|
|
39
|
+
if (lockEnabled) {
|
|
38
40
|
// if someone has lock, retry later
|
|
39
41
|
if (currentSession.lock) {
|
|
40
42
|
retryLater(operations, sessionStoreStrategy, numberOfRetries)
|
|
@@ -52,7 +54,7 @@ export function processSessionStoreOperations(
|
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
let processedSession = operations.process(currentSession)
|
|
55
|
-
if (
|
|
57
|
+
if (lockEnabled) {
|
|
56
58
|
// if lock corrupted after process, retry later
|
|
57
59
|
currentSession = retrieveSession()
|
|
58
60
|
if (currentSession.lock !== currentLock!) {
|
|
@@ -68,7 +70,7 @@ export function processSessionStoreOperations(
|
|
|
68
70
|
persistSession(processedSession)
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
|
-
if (
|
|
73
|
+
if (lockEnabled) {
|
|
72
74
|
// correctly handle lock around expiration would require to handle this case properly at several levels
|
|
73
75
|
// since we don't have evidence of lock issues around expiration, let's just not do the corruption check for it
|
|
74
76
|
if (!(processedSession && isSessionInExpiredState(processedSession))) {
|
|
@@ -89,6 +91,12 @@ export function processSessionStoreOperations(
|
|
|
89
91
|
next(sessionStoreStrategy)
|
|
90
92
|
}
|
|
91
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Lock strategy allows mitigating issues due to concurrent access to cookie.
|
|
96
|
+
* This issue concerns only chromium browsers and enabling this on firefox increases cookie write failures.
|
|
97
|
+
*/
|
|
98
|
+
export const isLockEnabled = () => isChromium()
|
|
99
|
+
|
|
92
100
|
function retryLater(operations: Operations, sessionStore: SessionStoreStrategy, currentNumberOfRetries: number) {
|
|
93
101
|
setTimeout(() => {
|
|
94
102
|
processSessionStoreOperations(operations, sessionStore, currentNumberOfRetries + 1)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isChromium } from '../../../tools/utils/browserDetection'
|
|
2
1
|
import type { CookieOptions } from '../../../browser/cookie'
|
|
3
2
|
import { getCurrentSite, areCookiesAuthorized, deleteCookie, getCookie, setCookie } from '../../../browser/cookie'
|
|
4
3
|
import type { InitConfiguration } from '../../configuration'
|
|
@@ -16,11 +15,6 @@ export function selectCookieStrategy(initConfiguration: InitConfiguration): Sess
|
|
|
16
15
|
|
|
17
16
|
export function initCookieStrategy(cookieOptions: CookieOptions): SessionStoreStrategy {
|
|
18
17
|
const cookieStore = {
|
|
19
|
-
/**
|
|
20
|
-
* Lock strategy allows mitigating issues due to concurrent access to cookie.
|
|
21
|
-
* This issue concerns only chromium browsers and enabling this on firefox increases cookie write failures.
|
|
22
|
-
*/
|
|
23
|
-
isLockEnabled: isChromium(),
|
|
24
18
|
persistSession: persistSessionCookie(cookieOptions),
|
|
25
19
|
retrieveSession: retrieveSessionCookie,
|
|
26
20
|
clearSession: deleteSessionCookie(cookieOptions),
|
|
@@ -51,13 +45,8 @@ function deleteSessionCookie(options: CookieOptions) {
|
|
|
51
45
|
export function buildCookieOptions(initConfiguration: InitConfiguration) {
|
|
52
46
|
const cookieOptions: CookieOptions = {}
|
|
53
47
|
|
|
54
|
-
cookieOptions.secure =
|
|
55
|
-
|
|
56
|
-
!!initConfiguration.usePartitionedCrossSiteSessionCookie ||
|
|
57
|
-
!!initConfiguration.useCrossSiteSessionCookie
|
|
58
|
-
cookieOptions.crossSite =
|
|
59
|
-
!!initConfiguration.usePartitionedCrossSiteSessionCookie || !!initConfiguration.useCrossSiteSessionCookie
|
|
60
|
-
cookieOptions.partitioned = !!initConfiguration.usePartitionedCrossSiteSessionCookie
|
|
48
|
+
cookieOptions.secure = !!initConfiguration.useSecureSessionCookie || !!initConfiguration.useCrossSiteSessionCookie
|
|
49
|
+
cookieOptions.crossSite = !!initConfiguration.useCrossSiteSessionCookie
|
|
61
50
|
|
|
62
51
|
if (initConfiguration.trackSessionAcrossSubdomains) {
|
|
63
52
|
cookieOptions.domain = getCurrentSite()
|
|
@@ -21,7 +21,6 @@ export function selectLocalStorageStrategy(): SessionStoreStrategyType | undefin
|
|
|
21
21
|
|
|
22
22
|
export function initLocalStorageStrategy(): SessionStoreStrategy {
|
|
23
23
|
return {
|
|
24
|
-
isLockEnabled: false,
|
|
25
24
|
persistSession: persistInLocalStorage,
|
|
26
25
|
retrieveSession: retrieveSessionFromLocalStorage,
|
|
27
26
|
clearSession: clearSessionFromLocalStorage,
|