@openobserve/browser-core 0.2.9 → 0.2.11-rc1
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 +12 -4
- package/cjs/browser/addEventListener.js +50 -8
- package/cjs/browser/addEventListener.js.map +1 -1
- package/cjs/browser/cookie.d.ts +7 -0
- package/cjs/browser/cookie.js +19 -2
- package/cjs/browser/cookie.js.map +1 -1
- package/cjs/browser/fetchObservable.js +14 -19
- package/cjs/browser/fetchObservable.js.map +1 -1
- package/cjs/browser/pageExitObservable.js +6 -7
- 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 +1 -2
- package/cjs/browser/xhrObservable.js +26 -34
- package/cjs/browser/xhrObservable.js.map +1 -1
- package/cjs/domain/configuration/configuration.d.ts +17 -12
- package/cjs/domain/configuration/configuration.js +8 -9
- package/cjs/domain/configuration/configuration.js.map +1 -1
- package/cjs/domain/configuration/endpointBuilder.d.ts +6 -10
- package/cjs/domain/configuration/endpointBuilder.js +28 -38
- package/cjs/domain/configuration/endpointBuilder.js.map +1 -1
- package/cjs/domain/configuration/index.d.ts +2 -1
- package/cjs/domain/configuration/index.js +3 -1
- 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/connectivity/connectivity.d.ts +13 -0
- package/cjs/domain/connectivity/connectivity.js +14 -0
- package/cjs/domain/connectivity/connectivity.js.map +1 -0
- package/cjs/domain/connectivity/index.d.ts +1 -0
- package/cjs/domain/{deflate → connectivity}/index.js +1 -1
- package/cjs/domain/connectivity/index.js.map +1 -0
- package/cjs/domain/console/consoleObservable.js +4 -7
- package/cjs/domain/console/consoleObservable.js.map +1 -1
- package/cjs/domain/context/contextConstants.d.ts +5 -0
- package/cjs/domain/{tracekit/types.js → context/contextConstants.js} +1 -1
- package/cjs/domain/context/contextConstants.js.map +1 -0
- package/cjs/domain/context/contextManager.d.ts +12 -0
- package/cjs/domain/context/contextManager.js +43 -0
- package/cjs/domain/context/contextManager.js.map +1 -0
- package/cjs/domain/context/customerDataTracker.d.ts +45 -0
- package/cjs/domain/context/customerDataTracker.js +107 -0
- package/cjs/domain/context/customerDataTracker.js.map +1 -0
- package/cjs/domain/context/storeContextManager.d.ts +6 -0
- package/cjs/domain/context/storeContextManager.js +38 -0
- package/cjs/domain/context/storeContextManager.js.map +1 -0
- package/cjs/domain/deflate/types.d.ts +0 -26
- package/cjs/domain/error/computeStackTrace.d.ts +33 -0
- package/cjs/domain/{tracekit → error}/computeStackTrace.js +28 -4
- package/cjs/domain/error/computeStackTrace.js.map +1 -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 +8 -0
- package/cjs/domain/error/trackRuntimeError.js +39 -6
- 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 +10 -0
- package/cjs/domain/report/reportObservable.d.ts +2 -0
- 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 +0 -5
- package/cjs/domain/session/sessionStoreOperations.js +6 -14
- package/cjs/domain/session/sessionStoreOperations.js.map +1 -1
- package/cjs/domain/session/storeStrategies/sessionInCookie.js +13 -2
- package/cjs/domain/session/storeStrategies/sessionInCookie.js.map +1 -1
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js +1 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -1
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.d.ts +1 -0
- 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 +4 -0
- package/cjs/domain/telemetry/telemetry.d.ts +5 -1
- package/cjs/domain/telemetry/telemetry.js +17 -6
- package/cjs/domain/telemetry/telemetry.js.map +1 -1
- package/cjs/domain/telemetry/telemetryEvent.types.d.ts +18 -2
- package/cjs/domain/user/user.js.map +1 -1
- 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 +13 -17
- package/cjs/tools/display.js.map +1 -1
- package/cjs/tools/encoder.d.ts +53 -0
- package/cjs/tools/encoder.js +41 -0
- package/cjs/tools/encoder.js.map +1 -0
- package/cjs/tools/experimentalFeatures.d.ts +3 -5
- package/cjs/tools/experimentalFeatures.js +2 -4
- 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 +50 -10
- package/cjs/tools/instrumentMethod.js +59 -36
- 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 +1 -2
- 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 +2 -3
- 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/jsonStringify.d.ts +1 -2
- 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 +8 -0
- package/cjs/tools/utils/browserDetection.js +33 -3
- 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 +1 -0
- package/cjs/tools/utils/stringUtils.js +31 -4
- 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 +5 -3
- package/cjs/transport/batch.js +73 -29
- package/cjs/transport/batch.js.map +1 -1
- package/cjs/transport/eventBridge.js.map +1 -1
- package/cjs/transport/flushController.d.ts +12 -2
- package/cjs/transport/flushController.js +22 -7
- package/cjs/transport/flushController.js.map +1 -1
- package/cjs/transport/httpRequest.d.ts +3 -2
- package/cjs/transport/httpRequest.js +21 -17
- 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 +9 -4
- package/cjs/transport/startBatchWithReplica.js +9 -4
- 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 +12 -4
- package/esm/browser/addEventListener.js +49 -7
- package/esm/browser/addEventListener.js.map +1 -1
- package/esm/browser/cookie.d.ts +7 -0
- package/esm/browser/cookie.js +17 -2
- package/esm/browser/cookie.js.map +1 -1
- package/esm/browser/fetchObservable.js +15 -20
- package/esm/browser/fetchObservable.js.map +1 -1
- package/esm/browser/pageExitObservable.js +7 -8
- 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 +1 -2
- package/esm/browser/xhrObservable.js +28 -36
- package/esm/browser/xhrObservable.js.map +1 -1
- package/esm/domain/configuration/configuration.d.ts +17 -12
- package/esm/domain/configuration/configuration.js +8 -9
- package/esm/domain/configuration/configuration.js.map +1 -1
- package/esm/domain/configuration/endpointBuilder.d.ts +6 -10
- package/esm/domain/configuration/endpointBuilder.js +27 -37
- package/esm/domain/configuration/endpointBuilder.js.map +1 -1
- package/esm/domain/configuration/index.d.ts +2 -1
- package/esm/domain/configuration/index.js +1 -0
- 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/connectivity/connectivity.d.ts +13 -0
- package/esm/domain/connectivity/connectivity.js +10 -0
- package/esm/domain/connectivity/connectivity.js.map +1 -0
- package/esm/domain/connectivity/index.d.ts +1 -0
- package/esm/domain/connectivity/index.js +2 -0
- package/esm/domain/connectivity/index.js.map +1 -0
- package/esm/domain/console/consoleObservable.js +2 -5
- package/esm/domain/console/consoleObservable.js.map +1 -1
- package/esm/domain/context/contextConstants.d.ts +5 -0
- package/esm/domain/context/contextConstants.js +2 -0
- package/esm/domain/context/contextConstants.js.map +1 -0
- package/esm/domain/context/contextManager.d.ts +12 -0
- package/esm/domain/context/contextManager.js +39 -0
- package/esm/domain/context/contextManager.js.map +1 -0
- package/esm/domain/context/customerDataTracker.d.ts +45 -0
- package/esm/domain/context/customerDataTracker.js +102 -0
- package/esm/domain/context/customerDataTracker.js.map +1 -0
- package/esm/domain/context/storeContextManager.d.ts +6 -0
- package/esm/domain/context/storeContextManager.js +32 -0
- package/esm/domain/context/storeContextManager.js.map +1 -0
- package/esm/domain/deflate/types.d.ts +12 -0
- package/esm/domain/error/computeStackTrace.d.ts +33 -0
- package/esm/domain/{tracekit → error}/computeStackTrace.js +26 -3
- package/esm/domain/error/computeStackTrace.js.map +1 -0
- 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 +8 -0
- package/esm/domain/error/trackRuntimeError.js +35 -4
- 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 +10 -0
- package/esm/domain/report/reportObservable.d.ts +2 -0
- 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 +0 -5
- package/esm/domain/session/sessionStoreOperations.js +5 -12
- package/esm/domain/session/sessionStoreOperations.js.map +1 -1
- package/esm/domain/session/storeStrategies/sessionInCookie.js +13 -2
- package/esm/domain/session/storeStrategies/sessionInCookie.js.map +1 -1
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js +1 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -1
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.d.ts +1 -0
- 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 +4 -0
- package/esm/domain/telemetry/telemetry.d.ts +5 -1
- package/esm/domain/telemetry/telemetry.js +16 -5
- package/esm/domain/telemetry/telemetry.js.map +1 -1
- package/esm/domain/telemetry/telemetryEvent.types.d.ts +18 -2
- package/esm/domain/user/user.js.map +1 -1
- package/esm/index.d.ts +9 -5
- package/esm/index.js +8 -5
- 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 +12 -15
- package/esm/tools/display.js.map +1 -1
- package/esm/tools/encoder.d.ts +53 -0
- package/esm/tools/encoder.js +37 -0
- package/esm/tools/encoder.js.map +1 -0
- package/esm/tools/experimentalFeatures.d.ts +3 -5
- package/esm/tools/experimentalFeatures.js +2 -4
- 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 +50 -10
- package/esm/tools/instrumentMethod.js +58 -34
- 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 +1 -2
- 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 +2 -3
- 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/jsonStringify.d.ts +1 -2
- 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 +8 -0
- package/esm/tools/utils/browserDetection.js +30 -2
- 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 +1 -0
- package/esm/tools/utils/stringUtils.js +29 -3
- 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 +5 -3
- package/esm/transport/batch.js +73 -29
- package/esm/transport/batch.js.map +1 -1
- package/esm/transport/eventBridge.js.map +1 -1
- package/esm/transport/flushController.d.ts +12 -2
- package/esm/transport/flushController.js +22 -7
- package/esm/transport/flushController.js.map +1 -1
- package/esm/transport/httpRequest.d.ts +3 -2
- package/esm/transport/httpRequest.js +21 -17
- 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 +9 -4
- package/esm/transport/startBatchWithReplica.js +9 -4
- package/esm/transport/startBatchWithReplica.js.map +1 -1
- package/package.json +1 -1
- package/src/browser/addEventListener.ts +37 -31
- package/src/browser/cookie.ts +21 -2
- package/src/browser/fetchObservable.ts +21 -25
- package/src/browser/pageExitObservable.ts +1 -3
- package/src/browser/xhrObservable.ts +31 -37
- package/src/domain/configuration/configuration.ts +24 -22
- package/src/domain/configuration/endpointBuilder.ts +40 -53
- package/src/domain/configuration/index.ts +2 -1
- package/src/domain/configuration/transportConfiguration.ts +1 -1
- package/src/domain/connectivity/connectivity.ts +27 -0
- package/src/domain/connectivity/index.ts +1 -0
- package/src/domain/console/consoleObservable.ts +3 -7
- package/src/domain/context/contextConstants.ts +5 -0
- package/src/domain/context/contextManager.ts +48 -0
- package/src/domain/context/customerDataTracker.ts +134 -0
- package/src/domain/context/storeContextManager.ts +51 -0
- package/src/domain/deflate/types.ts +14 -0
- package/src/domain/{tracekit → error}/computeStackTrace.ts +49 -4
- package/src/domain/error/error.ts +2 -2
- package/src/domain/error/error.types.ts +11 -2
- package/src/domain/error/trackRuntimeError.ts +44 -12
- package/src/domain/report/browser.types.ts +12 -0
- package/src/domain/report/reportObservable.ts +8 -6
- package/src/domain/session/oldCookiesMigration.ts +5 -5
- package/src/domain/session/sessionStoreOperations.ts +5 -13
- package/src/domain/session/storeStrategies/sessionInCookie.ts +13 -2
- package/src/domain/session/storeStrategies/sessionInLocalStorage.ts +1 -0
- package/src/domain/session/storeStrategies/sessionStoreStrategy.ts +1 -0
- package/src/domain/synthetics/syntheticsWorkerValues.ts +4 -4
- package/src/domain/telemetry/rawTelemetryEvent.types.ts +5 -0
- package/src/domain/telemetry/telemetry.ts +22 -7
- package/src/domain/telemetry/telemetryEvent.types.ts +18 -2
- package/src/index.ts +13 -7
- package/src/tools/display.ts +14 -13
- package/src/tools/encoder.ts +102 -0
- package/src/tools/experimentalFeatures.ts +2 -4
- package/src/tools/instrumentMethod.ts +103 -59
- package/src/tools/mergeInto.ts +16 -16
- package/src/tools/monitor.ts +5 -5
- package/src/tools/observable.ts +3 -5
- package/src/tools/utils/browserDetection.ts +43 -2
- package/src/tools/utils/polyfills.ts +1 -4
- package/src/tools/utils/stringUtils.ts +30 -4
- package/src/transport/batch.ts +86 -31
- package/src/transport/flushController.ts +22 -7
- package/src/transport/httpRequest.ts +23 -16
- package/src/transport/sendWithRetryStrategy.ts +10 -10
- package/src/transport/startBatchWithReplica.ts +22 -6
- package/cjs/domain/deflate/index.d.ts +0 -1
- package/cjs/domain/deflate/index.js.map +0 -1
- package/cjs/domain/tracekit/computeStackTrace.d.ts +0 -5
- package/cjs/domain/tracekit/computeStackTrace.js.map +0 -1
- package/cjs/domain/tracekit/index.d.ts +0 -3
- package/cjs/domain/tracekit/index.js +0 -8
- package/cjs/domain/tracekit/index.js.map +0 -1
- package/cjs/domain/tracekit/tracekit.d.ts +0 -35
- package/cjs/domain/tracekit/tracekit.js +0 -95
- package/cjs/domain/tracekit/tracekit.js.map +0 -1
- package/cjs/domain/tracekit/types.d.ts +0 -44
- package/cjs/domain/tracekit/types.js.map +0 -1
- package/cjs/index.d.ts +0 -63
- package/cjs/index.js +0 -155
- package/cjs/index.js.map +0 -1
- package/cjs/tools/serialisation/contextManager.d.ts +0 -21
- package/cjs/tools/serialisation/contextManager.js +0 -70
- package/cjs/tools/serialisation/contextManager.js.map +0 -1
- package/cjs/tools/serialisation/heavyCustomerDataWarning.d.ts +0 -8
- package/cjs/tools/serialisation/heavyCustomerDataWarning.js +0 -18
- package/cjs/tools/serialisation/heavyCustomerDataWarning.js.map +0 -1
- package/esm/domain/tracekit/computeStackTrace.d.ts +0 -5
- package/esm/domain/tracekit/computeStackTrace.js.map +0 -1
- package/esm/domain/tracekit/index.d.ts +0 -3
- package/esm/domain/tracekit/index.js +0 -3
- package/esm/domain/tracekit/index.js.map +0 -1
- package/esm/domain/tracekit/tracekit.d.ts +0 -35
- package/esm/domain/tracekit/tracekit.js +0 -91
- package/esm/domain/tracekit/tracekit.js.map +0 -1
- package/esm/domain/tracekit/types.d.ts +0 -44
- package/esm/domain/tracekit/types.js +0 -2
- package/esm/domain/tracekit/types.js.map +0 -1
- package/esm/tools/serialisation/contextManager.d.ts +0 -21
- package/esm/tools/serialisation/contextManager.js +0 -66
- package/esm/tools/serialisation/contextManager.js.map +0 -1
- package/esm/tools/serialisation/heavyCustomerDataWarning.d.ts +0 -8
- package/esm/tools/serialisation/heavyCustomerDataWarning.js +0 -14
- package/esm/tools/serialisation/heavyCustomerDataWarning.js.map +0 -1
- package/src/domain/tracekit/index.ts +0 -3
- package/src/domain/tracekit/tracekit.ts +0 -96
- package/src/domain/tracekit/types.ts +0 -47
- package/src/tools/serialisation/contextManager.ts +0 -79
- package/src/tools/serialisation/heavyCustomerDataWarning.ts +0 -26
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { InstrumentedMethodCall } from '../tools/instrumentMethod'
|
|
2
|
+
import { instrumentMethod } from '../tools/instrumentMethod'
|
|
2
3
|
import { Observable } from '../tools/observable'
|
|
3
|
-
import type { Duration,
|
|
4
|
-
import { elapsed,
|
|
4
|
+
import type { Duration, ClocksState } from '../tools/utils/timeUtils'
|
|
5
|
+
import { elapsed, clocksNow, timeStampNow } from '../tools/utils/timeUtils'
|
|
5
6
|
import { normalizeUrl } from '../tools/utils/urlPolyfill'
|
|
6
7
|
import { shallowClone } from '../tools/utils/objectUtils'
|
|
7
8
|
import type { Configuration } from '../domain/configuration'
|
|
@@ -15,7 +16,6 @@ export interface XhrOpenContext {
|
|
|
15
16
|
|
|
16
17
|
export interface XhrStartContext extends Omit<XhrOpenContext, 'state'> {
|
|
17
18
|
state: 'start'
|
|
18
|
-
startTime: RelativeTime // deprecated
|
|
19
19
|
startClocks: ClocksState
|
|
20
20
|
isAborted: boolean
|
|
21
21
|
xhr: XMLHttpRequest
|
|
@@ -40,20 +40,14 @@ export function initXhrObservable(configuration: Configuration) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
function createXhrObservable(configuration: Configuration) {
|
|
43
|
-
|
|
44
|
-
const { stop: stopInstrumentingStart } =
|
|
45
|
-
before: openXhr,
|
|
46
|
-
})
|
|
43
|
+
return new Observable<XhrContext>((observable) => {
|
|
44
|
+
const { stop: stopInstrumentingStart } = instrumentMethod(XMLHttpRequest.prototype, 'open', openXhr)
|
|
47
45
|
|
|
48
|
-
const { stop: stopInstrumentingSend } =
|
|
49
|
-
|
|
50
|
-
sendXhr.call(this, configuration, observable)
|
|
51
|
-
},
|
|
46
|
+
const { stop: stopInstrumentingSend } = instrumentMethod(XMLHttpRequest.prototype, 'send', (call) => {
|
|
47
|
+
sendXhr(call, configuration, observable)
|
|
52
48
|
})
|
|
53
49
|
|
|
54
|
-
const { stop: stopInstrumentingAbort } =
|
|
55
|
-
before: abortXhr,
|
|
56
|
-
})
|
|
50
|
+
const { stop: stopInstrumentingAbort } = instrumentMethod(XMLHttpRequest.prototype, 'abort', abortXhr)
|
|
57
51
|
|
|
58
52
|
return () => {
|
|
59
53
|
stopInstrumentingStart()
|
|
@@ -61,42 +55,42 @@ function createXhrObservable(configuration: Configuration) {
|
|
|
61
55
|
stopInstrumentingAbort()
|
|
62
56
|
}
|
|
63
57
|
})
|
|
64
|
-
return observable
|
|
65
58
|
}
|
|
66
59
|
|
|
67
|
-
function openXhr(
|
|
68
|
-
xhrContexts.set(
|
|
60
|
+
function openXhr({ target: xhr, parameters: [method, url] }: InstrumentedMethodCall<XMLHttpRequest, 'open'>) {
|
|
61
|
+
xhrContexts.set(xhr, {
|
|
69
62
|
state: 'open',
|
|
70
|
-
method,
|
|
63
|
+
method: String(method).toUpperCase(),
|
|
71
64
|
url: normalizeUrl(String(url)),
|
|
72
65
|
})
|
|
73
66
|
}
|
|
74
67
|
|
|
75
|
-
function sendXhr(
|
|
76
|
-
|
|
68
|
+
function sendXhr(
|
|
69
|
+
{ target: xhr }: InstrumentedMethodCall<XMLHttpRequest, 'send'>,
|
|
70
|
+
configuration: Configuration,
|
|
71
|
+
observable: Observable<XhrContext>
|
|
72
|
+
) {
|
|
73
|
+
const context = xhrContexts.get(xhr)
|
|
77
74
|
if (!context) {
|
|
78
75
|
return
|
|
79
76
|
}
|
|
80
77
|
|
|
81
78
|
const startContext = context as XhrStartContext
|
|
82
79
|
startContext.state = 'start'
|
|
83
|
-
startContext.startTime = relativeNow()
|
|
84
80
|
startContext.startClocks = clocksNow()
|
|
85
81
|
startContext.isAborted = false
|
|
86
|
-
startContext.xhr =
|
|
82
|
+
startContext.xhr = xhr
|
|
87
83
|
|
|
88
84
|
let hasBeenReported = false
|
|
89
85
|
|
|
90
|
-
const { stop: stopInstrumentingOnReadyStateChange } =
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
},
|
|
86
|
+
const { stop: stopInstrumentingOnReadyStateChange } = instrumentMethod(xhr, 'onreadystatechange', () => {
|
|
87
|
+
if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
88
|
+
// Try to report the XHR as soon as possible, because the XHR may be mutated by the
|
|
89
|
+
// application during a future event. For example, Angular is calling .abort() on
|
|
90
|
+
// completed requests during an onreadystatechange event, so the status becomes '0'
|
|
91
|
+
// before the request is collected.
|
|
92
|
+
onEnd()
|
|
93
|
+
}
|
|
100
94
|
})
|
|
101
95
|
|
|
102
96
|
const onEnd = () => {
|
|
@@ -110,17 +104,17 @@ function sendXhr(this: XMLHttpRequest, configuration: Configuration, observable:
|
|
|
110
104
|
const completeContext = context as XhrCompleteContext
|
|
111
105
|
completeContext.state = 'complete'
|
|
112
106
|
completeContext.duration = elapsed(startContext.startClocks.timeStamp, timeStampNow())
|
|
113
|
-
completeContext.status =
|
|
107
|
+
completeContext.status = xhr.status
|
|
114
108
|
observable.notify(shallowClone(completeContext))
|
|
115
109
|
}
|
|
116
110
|
|
|
117
|
-
const { stop: unsubscribeLoadEndListener } = addEventListener(configuration,
|
|
111
|
+
const { stop: unsubscribeLoadEndListener } = addEventListener(configuration, xhr, 'loadend', onEnd)
|
|
118
112
|
|
|
119
113
|
observable.notify(startContext)
|
|
120
114
|
}
|
|
121
115
|
|
|
122
|
-
function abortXhr(
|
|
123
|
-
const context = xhrContexts.get(
|
|
116
|
+
function abortXhr({ target: xhr }: InstrumentedMethodCall<XMLHttpRequest, 'abort'>) {
|
|
117
|
+
const context = xhrContexts.get(xhr) as XhrStartContext | undefined
|
|
124
118
|
if (context) {
|
|
125
119
|
context.isAborted = true
|
|
126
120
|
}
|
|
@@ -24,22 +24,15 @@ 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
|
|
31
27
|
sessionSampleRate?: number | undefined
|
|
32
28
|
telemetrySampleRate?: number | undefined
|
|
33
29
|
silentMultipleInit?: boolean | undefined
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
allowFallbackToLocalStorage?: boolean | undefined
|
|
31
|
+
allowUntrustedEvents?: boolean | undefined
|
|
32
|
+
storeContextsAcrossPages?: boolean | undefined
|
|
36
33
|
|
|
37
34
|
// transport options
|
|
38
|
-
proxy?: string | undefined
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated use `proxy` instead
|
|
41
|
-
*/
|
|
42
|
-
proxyUrl?: string | undefined
|
|
35
|
+
proxy?: string | ProxyFn | undefined
|
|
43
36
|
site?: string | undefined
|
|
44
37
|
|
|
45
38
|
// tag and context options
|
|
@@ -48,17 +41,19 @@ export interface InitConfiguration {
|
|
|
48
41
|
version: string | undefined
|
|
49
42
|
|
|
50
43
|
// cookie options
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated use usePartitionedCrossSiteSessionCookie instead
|
|
46
|
+
*/
|
|
51
47
|
useCrossSiteSessionCookie?: boolean | undefined
|
|
48
|
+
usePartitionedCrossSiteSessionCookie?: boolean | undefined
|
|
52
49
|
useSecureSessionCookie?: boolean | undefined
|
|
53
50
|
trackSessionAcrossSubdomains?: boolean | undefined
|
|
54
51
|
|
|
55
|
-
// alternate storage option
|
|
56
|
-
allowFallbackToLocalStorage?: boolean | undefined
|
|
57
|
-
|
|
58
52
|
// internal options
|
|
59
53
|
enableExperimentalFeatures?: string[] | undefined
|
|
60
54
|
replica?: ReplicaUserConfiguration | undefined
|
|
61
55
|
datacenter?: string
|
|
56
|
+
// TODO next major: remove this option and replace usages by proxyFn
|
|
62
57
|
internalAnalyticsSubdomain?: string
|
|
63
58
|
|
|
64
59
|
telemetryConfigurationSampleRate?: number
|
|
@@ -72,6 +67,12 @@ export interface InitConfiguration {
|
|
|
72
67
|
// for this option.
|
|
73
68
|
type GenericBeforeSendCallback = (event: any, context?: any) => unknown
|
|
74
69
|
|
|
70
|
+
/**
|
|
71
|
+
* path: /api/vX/product
|
|
72
|
+
* parameters: xxx=yyy&zzz=aaa
|
|
73
|
+
*/
|
|
74
|
+
type ProxyFn = (options: { path: string; parameters: string }) => string
|
|
75
|
+
|
|
75
76
|
interface ReplicaUserConfiguration {
|
|
76
77
|
applicationId?: string
|
|
77
78
|
clientToken: string
|
|
@@ -86,6 +87,7 @@ export interface Configuration extends TransportConfiguration {
|
|
|
86
87
|
telemetryConfigurationSampleRate: number
|
|
87
88
|
service: string | undefined
|
|
88
89
|
silentMultipleInit: boolean
|
|
90
|
+
allowUntrustedEvents: boolean
|
|
89
91
|
|
|
90
92
|
// Event limits
|
|
91
93
|
eventRateLimiterThreshold: number // Limit the maximum number of actions, errors and logs per minutes
|
|
@@ -104,8 +106,7 @@ export function validateAndBuildConfiguration(initConfiguration: InitConfigurati
|
|
|
104
106
|
return
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
|
|
108
|
-
if (sessionSampleRate !== undefined && !isPercentage(sessionSampleRate)) {
|
|
109
|
+
if (initConfiguration.sessionSampleRate !== undefined && !isPercentage(initConfiguration.sessionSampleRate)) {
|
|
109
110
|
display.error('Session Sample Rate should be a number between 0 and 100')
|
|
110
111
|
return
|
|
111
112
|
}
|
|
@@ -137,11 +138,12 @@ export function validateAndBuildConfiguration(initConfiguration: InitConfigurati
|
|
|
137
138
|
beforeSend:
|
|
138
139
|
initConfiguration.beforeSend && catchUserErrors(initConfiguration.beforeSend, 'beforeSend threw an error:'),
|
|
139
140
|
sessionStoreStrategyType: selectSessionStoreStrategyType(initConfiguration),
|
|
140
|
-
sessionSampleRate: sessionSampleRate ?? 100,
|
|
141
|
+
sessionSampleRate: initConfiguration.sessionSampleRate ?? 100,
|
|
141
142
|
telemetrySampleRate: initConfiguration.telemetrySampleRate ?? 20,
|
|
142
143
|
telemetryConfigurationSampleRate: initConfiguration.telemetryConfigurationSampleRate ?? 5,
|
|
143
144
|
service: initConfiguration.service,
|
|
144
145
|
silentMultipleInit: !!initConfiguration.silentMultipleInit,
|
|
146
|
+
allowUntrustedEvents: !!initConfiguration.allowUntrustedEvents,
|
|
145
147
|
|
|
146
148
|
/**
|
|
147
149
|
* beacon payload max queue size implementation is 64kb
|
|
@@ -173,19 +175,19 @@ export function validateAndBuildConfiguration(initConfiguration: InitConfigurati
|
|
|
173
175
|
}
|
|
174
176
|
|
|
175
177
|
export function serializeConfiguration(initConfiguration: InitConfiguration): Partial<RawTelemetryConfiguration> {
|
|
176
|
-
const proxy = initConfiguration.proxy ?? initConfiguration.proxyUrl
|
|
177
178
|
return {
|
|
178
|
-
session_sample_rate: initConfiguration.sessionSampleRate
|
|
179
|
+
session_sample_rate: initConfiguration.sessionSampleRate,
|
|
179
180
|
telemetry_sample_rate: initConfiguration.telemetrySampleRate,
|
|
180
181
|
telemetry_configuration_sample_rate: initConfiguration.telemetryConfigurationSampleRate,
|
|
181
182
|
use_before_send: !!initConfiguration.beforeSend,
|
|
182
183
|
use_cross_site_session_cookie: initConfiguration.useCrossSiteSessionCookie,
|
|
184
|
+
use_partitioned_cross_site_session_cookie: initConfiguration.usePartitionedCrossSiteSessionCookie,
|
|
183
185
|
use_secure_session_cookie: initConfiguration.useSecureSessionCookie,
|
|
184
|
-
use_proxy:
|
|
186
|
+
use_proxy: !!initConfiguration.proxy,
|
|
185
187
|
silent_multiple_init: initConfiguration.silentMultipleInit,
|
|
186
188
|
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,
|
|
190
192
|
}
|
|
191
193
|
}
|
|
@@ -1,51 +1,39 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Payload } 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 {
|
|
7
|
+
import { 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
|
-
|
|
20
|
-
rum: 'rum',
|
|
21
|
-
sessionReplay: 'replay',
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export type EndpointType = keyof typeof ENDPOINTS
|
|
12
|
+
export type TrackType = 'logs' | 'rum' | 'replay'
|
|
13
|
+
export type ApiType =
|
|
14
|
+
| 'xhr'
|
|
15
|
+
| 'fetch'
|
|
16
|
+
| 'beacon'
|
|
17
|
+
// 'manual' reflects that the request have been sent manually, outside of the SDK (ex: via curl or
|
|
18
|
+
// a Node.js script).
|
|
19
|
+
| 'manual'
|
|
25
20
|
|
|
26
21
|
export type EndpointBuilder = ReturnType<typeof createEndpointBuilder>
|
|
27
22
|
|
|
28
23
|
export function createEndpointBuilder(
|
|
29
24
|
initConfiguration: InitConfiguration,
|
|
30
|
-
|
|
25
|
+
trackType: TrackType,
|
|
31
26
|
configurationTags: string[]
|
|
32
27
|
) {
|
|
33
|
-
const buildUrlWithParameters = createEndpointUrlWithParametersBuilder(initConfiguration,
|
|
28
|
+
const buildUrlWithParameters = createEndpointUrlWithParametersBuilder(initConfiguration, trackType)
|
|
34
29
|
|
|
35
30
|
return {
|
|
36
|
-
build(api:
|
|
37
|
-
const parameters = buildEndpointParameters(
|
|
38
|
-
initConfiguration,
|
|
39
|
-
endpointType,
|
|
40
|
-
configurationTags,
|
|
41
|
-
api,
|
|
42
|
-
flushReason,
|
|
43
|
-
retry
|
|
44
|
-
)
|
|
31
|
+
build(api: ApiType, payload: Payload) {
|
|
32
|
+
const parameters = buildEndpointParameters(initConfiguration, trackType, configurationTags, api, payload)
|
|
45
33
|
return buildUrlWithParameters(parameters)
|
|
46
34
|
},
|
|
47
35
|
urlPrefix: buildUrlWithParameters(''),
|
|
48
|
-
|
|
36
|
+
trackType,
|
|
49
37
|
}
|
|
50
38
|
}
|
|
51
39
|
|
|
@@ -56,35 +44,29 @@ export function createEndpointBuilder(
|
|
|
56
44
|
*/
|
|
57
45
|
function createEndpointUrlWithParametersBuilder(
|
|
58
46
|
initConfiguration: InitConfiguration,
|
|
59
|
-
|
|
47
|
+
trackType: TrackType
|
|
60
48
|
): (parameters: string) => string {
|
|
61
|
-
const { proxy,
|
|
49
|
+
const { proxy, apiVersion, organizationIdentifier, insecureHTTP } = initConfiguration
|
|
62
50
|
|
|
63
|
-
const path = `/rum/${apiVersion}/${organizationIdentifier}/${
|
|
51
|
+
const path = `/rum/${apiVersion}/${organizationIdentifier}/${trackType}`
|
|
64
52
|
|
|
65
53
|
if (proxy) {
|
|
66
54
|
const normalizedProxyUrl = normalizeUrl(proxy)
|
|
67
|
-
return (parameters) => `${normalizedProxyUrl}?
|
|
55
|
+
return (parameters) => `${normalizedProxyUrl}?o2forward=${encodeURIComponent(`${path}?${parameters}`)}`
|
|
68
56
|
}
|
|
69
|
-
|
|
70
|
-
|
|
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}`)}`
|
|
57
|
+
if (typeof proxy === 'function') {
|
|
58
|
+
return (parameters) => proxy({ path, parameters })
|
|
77
59
|
}
|
|
78
|
-
|
|
60
|
+
const host = buildEndpointHost(initConfiguration)
|
|
79
61
|
const protocol = insecureHTTP ? 'http' : 'https'
|
|
80
62
|
|
|
81
63
|
return (parameters) => `${protocol}://${host}${path}?${parameters}`
|
|
82
64
|
}
|
|
83
65
|
|
|
84
|
-
function buildEndpointHost(initConfiguration: InitConfiguration
|
|
66
|
+
function buildEndpointHost(initConfiguration: InitConfiguration) {
|
|
85
67
|
const { site = INTAKE_SITE_US1, internalAnalyticsSubdomain } = initConfiguration
|
|
86
68
|
|
|
87
|
-
return site
|
|
69
|
+
return site
|
|
88
70
|
if (internalAnalyticsSubdomain && site === INTAKE_SITE_US1) {
|
|
89
71
|
return `${internalAnalyticsSubdomain}.${INTAKE_SITE_US1}`
|
|
90
72
|
}
|
|
@@ -101,11 +83,10 @@ function buildEndpointHost(initConfiguration: InitConfiguration, endpointType: E
|
|
|
101
83
|
*/
|
|
102
84
|
function buildEndpointParameters(
|
|
103
85
|
{ clientToken, internalAnalyticsSubdomain }: InitConfiguration,
|
|
104
|
-
|
|
86
|
+
trackType: TrackType,
|
|
105
87
|
configurationTags: string[],
|
|
106
|
-
api:
|
|
107
|
-
flushReason
|
|
108
|
-
retry: RetryInfo | undefined
|
|
88
|
+
api: ApiType,
|
|
89
|
+
{ retry, flushReason, encoding }: Payload
|
|
109
90
|
) {
|
|
110
91
|
const tags = [`sdk_version:${__BUILD_ENV__SDK_VERSION__}`, `api:${api}`].concat(configurationTags)
|
|
111
92
|
if (flushReason && isExperimentalFeatureEnabled(ExperimentalFeature.COLLECT_FLUSH_REASON)) {
|
|
@@ -114,18 +95,24 @@ function buildEndpointParameters(
|
|
|
114
95
|
if (retry) {
|
|
115
96
|
tags.push(`retry_count:${retry.count}`, `retry_after:${retry.lastFailureStatus}`)
|
|
116
97
|
}
|
|
98
|
+
|
|
117
99
|
const parameters = [
|
|
118
|
-
'
|
|
119
|
-
`
|
|
120
|
-
`
|
|
121
|
-
`
|
|
122
|
-
'
|
|
123
|
-
`
|
|
100
|
+
'o2source=browser',
|
|
101
|
+
`o2tags=${encodeURIComponent(tags.join(','))}`,
|
|
102
|
+
`o2-api-key=${clientToken}`,
|
|
103
|
+
`o2-evp-origin-version=${encodeURIComponent(__BUILD_ENV__SDK_VERSION__)}`,
|
|
104
|
+
'o2-evp-origin=browser',
|
|
105
|
+
`o2-request-id=${generateUUID()}`,
|
|
124
106
|
]
|
|
125
107
|
|
|
126
|
-
if (
|
|
108
|
+
if (encoding) {
|
|
109
|
+
parameters.push(`o2-evp-encoding=${encoding}`)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (trackType === 'rum') {
|
|
127
113
|
parameters.push(`batch_time=${timeStampNow()}`)
|
|
128
114
|
}
|
|
115
|
+
|
|
129
116
|
if (internalAnalyticsSubdomain) {
|
|
130
117
|
parameters.reverse()
|
|
131
118
|
}
|
|
@@ -5,5 +5,6 @@ export {
|
|
|
5
5
|
validateAndBuildConfiguration,
|
|
6
6
|
serializeConfiguration,
|
|
7
7
|
} from './configuration'
|
|
8
|
-
export { createEndpointBuilder, EndpointBuilder,
|
|
8
|
+
export { createEndpointBuilder, EndpointBuilder, TrackType } 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, 'replay', tags),
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type NetworkInterface = 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other' | 'unknown'
|
|
2
|
+
export type EffectiveType = 'slow-2g' | '2g' | '3g' | '4g'
|
|
3
|
+
|
|
4
|
+
interface BrowserNavigator extends Navigator {
|
|
5
|
+
connection?: NetworkInformation
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface NetworkInformation {
|
|
9
|
+
type?: NetworkInterface
|
|
10
|
+
effectiveType?: EffectiveType
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface Connectivity {
|
|
14
|
+
status: 'connected' | 'not_connected'
|
|
15
|
+
interfaces?: NetworkInterface[]
|
|
16
|
+
effective_type?: EffectiveType
|
|
17
|
+
[key: string]: unknown
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function getConnectivity(): Connectivity {
|
|
21
|
+
const navigator = window.navigator as BrowserNavigator
|
|
22
|
+
return {
|
|
23
|
+
status: navigator.onLine ? 'connected' : 'not_connected',
|
|
24
|
+
interfaces: navigator.connection && navigator.connection.type ? [navigator.connection.type] : undefined,
|
|
25
|
+
effective_type: navigator.connection?.effectiveType,
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './connectivity'
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { computeStackTrace } from '../tracekit'
|
|
2
1
|
import { createHandlingStack, formatErrorMessage, toStackTraceString, tryToGetFingerprint } from '../error/error'
|
|
3
2
|
import { mergeObservables, Observable } from '../../tools/observable'
|
|
4
3
|
import { ConsoleApiName, globalConsole } from '../../tools/display'
|
|
@@ -6,6 +5,7 @@ import { callMonitored } from '../../tools/monitor'
|
|
|
6
5
|
import { sanitize } from '../../tools/serialisation/sanitize'
|
|
7
6
|
import { find } from '../../tools/utils/polyfills'
|
|
8
7
|
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
|
+
return new Observable<ConsoleLog>((observable) => {
|
|
37
37
|
const originalConsoleApi = globalConsole[api]
|
|
38
38
|
|
|
39
39
|
globalConsole[api] = (...params: unknown[]) => {
|
|
@@ -49,13 +49,10 @@ function createConsoleObservable(api: ConsoleApiName) {
|
|
|
49
49
|
globalConsole[api] = originalConsoleApi
|
|
50
50
|
}
|
|
51
51
|
})
|
|
52
|
-
|
|
53
|
-
return observable
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
function buildConsoleLog(params: unknown[], api: ConsoleApiName, handlingStack: string): ConsoleLog {
|
|
57
|
-
|
|
58
|
-
let message = params.map((param) => formatConsoleParameters(param)).join(' ')
|
|
55
|
+
const message = params.map((param) => formatConsoleParameters(param)).join(' ')
|
|
59
56
|
let stack
|
|
60
57
|
let fingerprint
|
|
61
58
|
|
|
@@ -63,7 +60,6 @@ function buildConsoleLog(params: unknown[], api: ConsoleApiName, handlingStack:
|
|
|
63
60
|
const firstErrorParam = find(params, (param: unknown): param is Error => param instanceof Error)
|
|
64
61
|
stack = firstErrorParam ? toStackTraceString(computeStackTrace(firstErrorParam)) : undefined
|
|
65
62
|
fingerprint = tryToGetFingerprint(firstErrorParam)
|
|
66
|
-
message = `console error: ${message}`
|
|
67
63
|
}
|
|
68
64
|
|
|
69
65
|
return {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { deepClone } from '../../tools/mergeInto'
|
|
2
|
+
import { getType } from '../../tools/utils/typeUtils'
|
|
3
|
+
import { sanitize } from '../../tools/serialisation/sanitize'
|
|
4
|
+
import type { Context } from '../../tools/serialisation/context'
|
|
5
|
+
import { Observable } from '../../tools/observable'
|
|
6
|
+
import type { CustomerDataTracker } from './customerDataTracker'
|
|
7
|
+
|
|
8
|
+
export type ContextManager = ReturnType<typeof createContextManager>
|
|
9
|
+
|
|
10
|
+
export function createContextManager(customerDataTracker: CustomerDataTracker) {
|
|
11
|
+
let context: Context = {}
|
|
12
|
+
const changeObservable = new Observable<void>()
|
|
13
|
+
|
|
14
|
+
const contextManager = {
|
|
15
|
+
getContext: () => deepClone(context),
|
|
16
|
+
|
|
17
|
+
setContext: (newContext: Context) => {
|
|
18
|
+
if (getType(newContext) === 'object') {
|
|
19
|
+
context = sanitize(newContext)
|
|
20
|
+
customerDataTracker.updateCustomerData(context)
|
|
21
|
+
} else {
|
|
22
|
+
contextManager.clearContext()
|
|
23
|
+
}
|
|
24
|
+
changeObservable.notify()
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
setContextProperty: (key: string, property: any) => {
|
|
28
|
+
context[key] = sanitize(property)
|
|
29
|
+
customerDataTracker.updateCustomerData(context)
|
|
30
|
+
changeObservable.notify()
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
removeContextProperty: (key: string) => {
|
|
34
|
+
delete context[key]
|
|
35
|
+
customerDataTracker.updateCustomerData(context)
|
|
36
|
+
changeObservable.notify()
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
clearContext: () => {
|
|
40
|
+
context = {}
|
|
41
|
+
customerDataTracker.resetCustomerData()
|
|
42
|
+
changeObservable.notify()
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
changeObservable,
|
|
46
|
+
}
|
|
47
|
+
return contextManager
|
|
48
|
+
}
|