@openobserve/browser-core 0.2.11-rc1 → 0.2.12-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -5
- package/src/boot/displayAlreadyInitializedError.ts +8 -0
- package/src/boot/init.ts +29 -15
- package/src/browser/addEventListener.ts +13 -10
- package/src/browser/{types.ts → browser.types.ts} +42 -0
- package/src/browser/cookie.ts +49 -14
- package/src/browser/fetchObservable.ts +80 -21
- package/src/browser/{pageExitObservable.ts → pageMayExitObservable.ts} +11 -22
- package/src/browser/runOnReadyState.ts +14 -4
- package/src/browser/xhrObservable.ts +17 -4
- package/src/domain/allowedTrackingOrigins.ts +30 -0
- package/src/domain/bufferedData.ts +32 -0
- package/src/domain/configuration/configuration.ts +352 -83
- package/src/domain/configuration/endpointBuilder.ts +29 -32
- package/src/domain/configuration/index.ts +6 -5
- package/src/domain/configuration/transportConfiguration.ts +42 -35
- package/src/domain/connectivity/connectivity.ts +5 -1
- package/src/domain/console/consoleObservable.ts +57 -21
- package/src/domain/context/contextConstants.ts +22 -0
- package/src/domain/context/contextManager.ts +48 -11
- package/src/domain/context/contextUtils.ts +14 -0
- package/src/domain/context/defineContextMethod.ts +31 -0
- package/src/domain/context/storeContextManager.ts +7 -3
- package/src/domain/contexts/accountContext.ts +47 -0
- package/src/domain/contexts/globalContext.ts +30 -0
- package/src/domain/contexts/rumInternalContext.type.ts +15 -0
- package/src/domain/contexts/userContext.ts +64 -0
- package/src/domain/deflate/{types.ts → deflate.types.ts} +6 -4
- package/src/domain/deflate/index.ts +1 -1
- package/src/domain/error/error.ts +28 -84
- package/src/domain/error/error.types.ts +10 -2
- package/src/domain/error/trackRuntimeError.ts +29 -32
- package/src/domain/eventRateLimiter/createEventRateLimiter.ts +5 -2
- package/src/domain/extension/extensionUtils.ts +28 -0
- package/src/domain/intakeSites.ts +18 -0
- package/src/domain/report/reportObservable.ts +35 -30
- package/src/domain/resourceUtils.ts +20 -16
- package/src/domain/session/README.md +193 -0
- package/src/domain/session/oldCookiesMigration.ts +2 -2
- package/src/domain/session/sessionConstants.ts +16 -1
- package/src/domain/session/sessionManager.ts +179 -15
- package/src/domain/session/sessionState.ts +49 -17
- package/src/domain/session/sessionStateValidation.ts +9 -0
- package/src/domain/session/sessionStore.ts +118 -55
- package/src/domain/session/sessionStoreOperations.ts +47 -20
- package/src/domain/session/storeStrategies/sessionInCookie.ts +105 -26
- package/src/domain/session/storeStrategies/sessionInLocalStorage.ts +10 -8
- package/src/domain/session/storeStrategies/sessionStoreStrategy.ts +5 -2
- package/src/domain/synthetics/syntheticsWorkerValues.ts +13 -2
- package/src/domain/tags.ts +76 -0
- package/src/domain/telemetry/index.ts +12 -4
- package/src/domain/telemetry/rawTelemetryEvent.types.ts +6 -3
- package/src/domain/telemetry/telemetry.ts +235 -106
- package/src/domain/telemetry/telemetryEvent.types.ts +514 -5
- package/src/domain/trackingConsent.ts +34 -0
- package/src/index.ts +90 -59
- package/src/tools/abstractHooks.ts +72 -0
- package/src/tools/abstractLifeCycle.ts +1 -0
- package/src/tools/boundedBuffer.ts +36 -8
- package/src/tools/display.ts +4 -0
- package/src/tools/encoder.ts +3 -2
- package/src/tools/experimentalFeatures.ts +18 -7
- package/src/tools/getZoneJsOriginalValue.ts +1 -1
- package/src/tools/{getGlobalObject.ts → globalObject.ts} +20 -0
- package/src/tools/instrumentMethod.ts +58 -41
- package/src/tools/matchOption.ts +1 -2
- package/src/tools/monitor.ts +11 -7
- package/src/tools/observable.ts +78 -12
- package/src/tools/queueMicrotask.ts +13 -0
- package/src/tools/readBytesFromStream.ts +24 -64
- package/src/tools/requestIdleCallback.ts +40 -0
- package/src/tools/sendToExtension.ts +3 -1
- package/src/tools/serialisation/context.ts +4 -1
- package/src/tools/serialisation/sanitize.ts +32 -14
- package/src/{domain/error → tools/stackTrace}/computeStackTrace.ts +72 -8
- package/src/tools/stackTrace/handlingStack.ts +48 -0
- package/src/tools/taskQueue.ts +63 -0
- package/src/tools/timer.ts +1 -1
- package/src/tools/utils/arrayUtils.ts +11 -3
- package/src/tools/utils/browserDetection.ts +0 -9
- package/src/tools/utils/byteUtils.ts +13 -2
- package/src/tools/utils/functionUtils.ts +0 -2
- package/src/tools/utils/numberUtils.ts +2 -1
- package/src/tools/utils/objectUtils.ts +1 -3
- package/src/tools/utils/polyfills.ts +6 -107
- package/src/tools/utils/responseUtils.ts +1 -1
- package/src/tools/utils/stringUtils.ts +34 -2
- package/src/tools/utils/timeUtils.ts +18 -13
- package/src/tools/utils/timezone.ts +9 -0
- package/src/tools/utils/urlPolyfill.ts +29 -59
- package/src/tools/valueHistory.ts +66 -35
- package/src/transport/batch.ts +77 -80
- package/src/transport/eventBridge.ts +24 -5
- package/src/transport/flushController.ts +27 -21
- package/src/transport/httpRequest.ts +92 -71
- package/src/transport/index.ts +7 -4
- package/src/transport/sendWithRetryStrategy.ts +55 -36
- package/cjs/boot/init.d.ts +0 -5
- package/cjs/boot/init.js +0 -36
- package/cjs/boot/init.js.map +0 -1
- package/cjs/browser/addEventListener.d.ts +0 -84
- package/cjs/browser/addEventListener.js +0 -94
- package/cjs/browser/addEventListener.js.map +0 -1
- package/cjs/browser/cookie.d.ts +0 -17
- package/cjs/browser/cookie.js +0 -86
- package/cjs/browser/cookie.js.map +0 -1
- package/cjs/browser/fetchObservable.d.ts +0 -23
- package/cjs/browser/fetchObservable.js +0 -69
- package/cjs/browser/fetchObservable.js.map +0 -1
- package/cjs/browser/pageExitObservable.d.ts +0 -14
- package/cjs/browser/pageExitObservable.js +0 -57
- package/cjs/browser/pageExitObservable.js.map +0 -1
- package/cjs/browser/runOnReadyState.d.ts +0 -2
- package/cjs/browser/runOnReadyState.js +0 -15
- package/cjs/browser/runOnReadyState.js.map +0 -1
- package/cjs/browser/types.d.ts +0 -19
- package/cjs/browser/types.js +0 -6
- package/cjs/browser/types.js.map +0 -1
- package/cjs/browser/xhrObservable.d.ts +0 -21
- package/cjs/browser/xhrObservable.js +0 -85
- package/cjs/browser/xhrObservable.js.map +0 -1
- package/cjs/domain/configuration/configuration.d.ts +0 -72
- package/cjs/domain/configuration/configuration.js +0 -94
- package/cjs/domain/configuration/configuration.js.map +0 -1
- package/cjs/domain/configuration/endpointBuilder.d.ts +0 -10
- package/cjs/domain/configuration/endpointBuilder.js +0 -84
- package/cjs/domain/configuration/endpointBuilder.js.map +0 -1
- package/cjs/domain/configuration/index.d.ts +0 -4
- package/cjs/domain/configuration/index.js +0 -27
- package/cjs/domain/configuration/index.js.map +0 -1
- package/cjs/domain/configuration/intakeSites.d.ts +0 -5
- package/cjs/domain/configuration/intakeSites.js +0 -9
- package/cjs/domain/configuration/intakeSites.js.map +0 -1
- package/cjs/domain/configuration/tags.d.ts +0 -4
- package/cjs/domain/configuration/tags.js +0 -39
- package/cjs/domain/configuration/tags.js.map +0 -1
- package/cjs/domain/configuration/transportConfiguration.d.ts +0 -16
- package/cjs/domain/configuration/transportConfiguration.js +0 -42
- package/cjs/domain/configuration/transportConfiguration.js.map +0 -1
- 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 +0 -18
- package/cjs/domain/connectivity/index.js.map +0 -1
- package/cjs/domain/console/consoleObservable.d.ts +0 -11
- package/cjs/domain/console/consoleObservable.js +0 -72
- package/cjs/domain/console/consoleObservable.js.map +0 -1
- package/cjs/domain/context/contextConstants.d.ts +0 -5
- package/cjs/domain/context/contextConstants.js +0 -3
- 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/deflate/types.d.ts +0 -0
- package/cjs/domain/deflate/types.js +0 -3
- package/cjs/domain/deflate/types.js.map +0 -1
- package/cjs/domain/error/computeStackTrace.d.ts +0 -33
- package/cjs/domain/error/computeStackTrace.js +0 -142
- package/cjs/domain/error/computeStackTrace.js.map +0 -1
- package/cjs/domain/error/error.d.ts +0 -28
- package/cjs/domain/error/error.js +0 -131
- package/cjs/domain/error/error.js.map +0 -1
- package/cjs/domain/error/error.types.d.ts +0 -40
- package/cjs/domain/error/error.types.js +0 -13
- package/cjs/domain/error/error.types.js.map +0 -1
- package/cjs/domain/error/trackRuntimeError.d.ts +0 -13
- package/cjs/domain/error/trackRuntimeError.js +0 -54
- package/cjs/domain/error/trackRuntimeError.js.map +0 -1
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.d.ts +0 -5
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js +0 -40
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js.map +0 -1
- package/cjs/domain/report/browser.types.d.ts +0 -34
- package/cjs/domain/report/browser.types.js +0 -3
- package/cjs/domain/report/browser.types.js.map +0 -1
- package/cjs/domain/report/reportObservable.d.ts +0 -17
- package/cjs/domain/report/reportObservable.js +0 -94
- package/cjs/domain/report/reportObservable.js.map +0 -1
- package/cjs/domain/resourceUtils.d.ts +0 -16
- package/cjs/domain/resourceUtils.js +0 -3
- package/cjs/domain/resourceUtils.js.map +0 -1
- package/cjs/domain/session/oldCookiesMigration.d.ts +0 -11
- package/cjs/domain/session/oldCookiesMigration.js +0 -40
- package/cjs/domain/session/oldCookiesMigration.js.map +0 -1
- package/cjs/domain/session/sessionConstants.d.ts +0 -2
- package/cjs/domain/session/sessionConstants.js +0 -7
- package/cjs/domain/session/sessionConstants.js.map +0 -1
- package/cjs/domain/session/sessionManager.d.ts +0 -20
- package/cjs/domain/session/sessionManager.js +0 -65
- package/cjs/domain/session/sessionManager.js.map +0 -1
- package/cjs/domain/session/sessionState.d.ts +0 -11
- package/cjs/domain/session/sessionState.js +0 -45
- package/cjs/domain/session/sessionState.js.map +0 -1
- package/cjs/domain/session/sessionStore.d.ts +0 -34
- package/cjs/domain/session/sessionStore.js +0 -144
- package/cjs/domain/session/sessionStore.js.map +0 -1
- package/cjs/domain/session/sessionStoreOperations.d.ts +0 -10
- package/cjs/domain/session/sessionStoreOperations.js +0 -96
- package/cjs/domain/session/sessionStoreOperations.js.map +0 -1
- package/cjs/domain/session/storeStrategies/sessionInCookie.d.ts +0 -6
- package/cjs/domain/session/storeStrategies/sessionInCookie.js +0 -59
- package/cjs/domain/session/storeStrategies/sessionInCookie.js.map +0 -1
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.d.ts +0 -3
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js +0 -41
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js.map +0 -1
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.d.ts +0 -15
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js +0 -5
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js.map +0 -1
- package/cjs/domain/synthetics/syntheticsWorkerValues.d.ts +0 -11
- package/cjs/domain/synthetics/syntheticsWorkerValues.js +0 -22
- package/cjs/domain/synthetics/syntheticsWorkerValues.js.map +0 -1
- package/cjs/domain/telemetry/index.d.ts +0 -3
- package/cjs/domain/telemetry/index.js +0 -28
- package/cjs/domain/telemetry/index.js.map +0 -1
- package/cjs/domain/telemetry/rawTelemetryEvent.types.d.ts +0 -15
- package/cjs/domain/telemetry/rawTelemetryEvent.types.js +0 -8
- package/cjs/domain/telemetry/rawTelemetryEvent.types.js.map +0 -1
- package/cjs/domain/telemetry/telemetry.d.ts +0 -116
- package/cjs/domain/telemetry/telemetry.js +0 -157
- package/cjs/domain/telemetry/telemetry.js.map +0 -1
- package/cjs/domain/telemetry/telemetryEvent.types.d.ts +0 -391
- package/cjs/domain/telemetry/telemetryEvent.types.js +0 -7
- package/cjs/domain/telemetry/telemetryEvent.types.js.map +0 -1
- package/cjs/domain/user/index.d.ts +0 -2
- package/cjs/domain/user/index.js +0 -19
- package/cjs/domain/user/index.js.map +0 -1
- package/cjs/domain/user/user.d.ts +0 -12
- package/cjs/domain/user/user.js +0 -35
- package/cjs/domain/user/user.js.map +0 -1
- package/cjs/domain/user/user.types.d.ts +0 -6
- package/cjs/domain/user/user.types.js +0 -3
- package/cjs/domain/user/user.types.js.map +0 -1
- package/cjs/tools/abstractLifeCycle.d.ts +0 -23
- package/cjs/tools/abstractLifeCycle.js +0 -29
- package/cjs/tools/abstractLifeCycle.js.map +0 -1
- package/cjs/tools/boundedBuffer.d.ts +0 -5
- package/cjs/tools/boundedBuffer.js +0 -22
- package/cjs/tools/boundedBuffer.js.map +0 -1
- package/cjs/tools/catchUserErrors.d.ts +0 -1
- package/cjs/tools/catchUserErrors.js +0 -20
- package/cjs/tools/catchUserErrors.js.map +0 -1
- package/cjs/tools/display.d.ts +0 -35
- package/cjs/tools/display.js +0 -41
- package/cjs/tools/display.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/cjs/tools/experimentalFeatures.d.ts +0 -22
- package/cjs/tools/experimentalFeatures.js +0 -45
- package/cjs/tools/experimentalFeatures.js.map +0 -1
- package/cjs/tools/getGlobalObject.d.ts +0 -4
- package/cjs/tools/getGlobalObject.js +0 -37
- package/cjs/tools/getGlobalObject.js.map +0 -1
- package/cjs/tools/getZoneJsOriginalValue.d.ts +0 -19
- package/cjs/tools/getZoneJsOriginalValue.js +0 -30
- package/cjs/tools/getZoneJsOriginalValue.js.map +0 -1
- package/cjs/tools/instrumentMethod.d.ts +0 -59
- package/cjs/tools/instrumentMethod.js +0 -106
- package/cjs/tools/instrumentMethod.js.map +0 -1
- package/cjs/tools/matchOption.d.ts +0 -8
- package/cjs/tools/matchOption.js +0 -38
- package/cjs/tools/matchOption.js.map +0 -1
- package/cjs/tools/mergeInto.d.ts +0 -25
- package/cjs/tools/mergeInto.js +0 -105
- package/cjs/tools/mergeInto.js.map +0 -1
- package/cjs/tools/monitor.d.ts +0 -8
- package/cjs/tools/monitor.js +0 -76
- package/cjs/tools/monitor.js.map +0 -1
- package/cjs/tools/observable.d.ts +0 -12
- package/cjs/tools/observable.js +0 -43
- package/cjs/tools/observable.js.map +0 -1
- package/cjs/tools/readBytesFromStream.d.ts +0 -11
- package/cjs/tools/readBytesFromStream.js +0 -64
- package/cjs/tools/readBytesFromStream.js.map +0 -1
- package/cjs/tools/sendToExtension.d.ts +0 -3
- package/cjs/tools/sendToExtension.js +0 -11
- package/cjs/tools/sendToExtension.js.map +0 -1
- package/cjs/tools/serialisation/context.d.ts +0 -6
- package/cjs/tools/serialisation/context.js +0 -3
- package/cjs/tools/serialisation/context.js.map +0 -1
- package/cjs/tools/serialisation/jsonStringify.d.ts +0 -13
- package/cjs/tools/serialisation/jsonStringify.js +0 -49
- package/cjs/tools/serialisation/jsonStringify.js.map +0 -1
- package/cjs/tools/serialisation/sanitize.d.ts +0 -18
- package/cjs/tools/serialisation/sanitize.js +0 -185
- package/cjs/tools/serialisation/sanitize.js.map +0 -1
- package/cjs/tools/timer.d.ts +0 -5
- package/cjs/tools/timer.js +0 -23
- package/cjs/tools/timer.js.map +0 -1
- package/cjs/tools/utils/arrayUtils.d.ts +0 -1
- package/cjs/tools/utils/arrayUtils.js +0 -11
- package/cjs/tools/utils/arrayUtils.js.map +0 -1
- package/cjs/tools/utils/browserDetection.d.ts +0 -10
- package/cjs/tools/utils/browserDetection.js +0 -42
- package/cjs/tools/utils/browserDetection.js.map +0 -1
- package/cjs/tools/utils/byteUtils.d.ts +0 -4
- package/cjs/tools/utils/byteUtils.js +0 -31
- package/cjs/tools/utils/byteUtils.js.map +0 -1
- package/cjs/tools/utils/functionUtils.d.ts +0 -9
- package/cjs/tools/utils/functionUtils.js +0 -48
- package/cjs/tools/utils/functionUtils.js.map +0 -1
- package/cjs/tools/utils/numberUtils.d.ts +0 -8
- package/cjs/tools/utils/numberUtils.js +0 -24
- package/cjs/tools/utils/numberUtils.js.map +0 -1
- package/cjs/tools/utils/objectUtils.d.ts +0 -10
- package/cjs/tools/utils/objectUtils.js +0 -26
- package/cjs/tools/utils/objectUtils.js.map +0 -1
- package/cjs/tools/utils/polyfills.d.ts +0 -24
- package/cjs/tools/utils/polyfills.js +0 -110
- package/cjs/tools/utils/polyfills.js.map +0 -1
- package/cjs/tools/utils/responseUtils.d.ts +0 -2
- package/cjs/tools/utils/responseUtils.js +0 -18
- package/cjs/tools/utils/responseUtils.js.map +0 -1
- package/cjs/tools/utils/stringUtils.d.ts +0 -8
- package/cjs/tools/utils/stringUtils.js +0 -59
- package/cjs/tools/utils/stringUtils.js.map +0 -1
- package/cjs/tools/utils/timeUtils.d.ts +0 -57
- package/cjs/tools/utils/timeUtils.js +0 -99
- package/cjs/tools/utils/timeUtils.js.map +0 -1
- package/cjs/tools/utils/typeUtils.d.ts +0 -4
- package/cjs/tools/utils/typeUtils.js +0 -17
- package/cjs/tools/utils/typeUtils.js.map +0 -1
- package/cjs/tools/utils/urlPolyfill.d.ts +0 -14
- package/cjs/tools/utils/urlPolyfill.js +0 -92
- package/cjs/tools/utils/urlPolyfill.js.map +0 -1
- package/cjs/tools/valueHistory.d.ts +0 -50
- package/cjs/tools/valueHistory.js +0 -106
- package/cjs/tools/valueHistory.js.map +0 -1
- package/cjs/transport/batch.d.ts +0 -21
- package/cjs/transport/batch.js +0 -123
- package/cjs/transport/batch.js.map +0 -1
- package/cjs/transport/eventBridge.d.ts +0 -12
- package/cjs/transport/eventBridge.js +0 -34
- package/cjs/transport/eventBridge.js.map +0 -1
- package/cjs/transport/flushController.d.ts +0 -58
- package/cjs/transport/flushController.js +0 -112
- package/cjs/transport/flushController.js.map +0 -1
- package/cjs/transport/httpRequest.d.ts +0 -38
- package/cjs/transport/httpRequest.js +0 -95
- package/cjs/transport/httpRequest.js.map +0 -1
- package/cjs/transport/index.d.ts +0 -4
- package/cjs/transport/index.js +0 -13
- package/cjs/transport/index.js.map +0 -1
- package/cjs/transport/sendWithRetryStrategy.d.ts +0 -39
- package/cjs/transport/sendWithRetryStrategy.js +0 -151
- package/cjs/transport/sendWithRetryStrategy.js.map +0 -1
- package/cjs/transport/startBatchWithReplica.d.ts +0 -20
- package/cjs/transport/startBatchWithReplica.js +0 -42
- package/cjs/transport/startBatchWithReplica.js.map +0 -1
- package/esm/boot/init.d.ts +0 -5
- package/esm/boot/init.js +0 -31
- package/esm/boot/init.js.map +0 -1
- package/esm/browser/addEventListener.d.ts +0 -84
- package/esm/browser/addEventListener.js +0 -89
- package/esm/browser/addEventListener.js.map +0 -1
- package/esm/browser/cookie.d.ts +0 -17
- package/esm/browser/cookie.js +0 -76
- package/esm/browser/cookie.js.map +0 -1
- package/esm/browser/fetchObservable.d.ts +0 -23
- package/esm/browser/fetchObservable.js +0 -65
- package/esm/browser/fetchObservable.js.map +0 -1
- package/esm/browser/pageExitObservable.d.ts +0 -14
- package/esm/browser/pageExitObservable.js +0 -52
- package/esm/browser/pageExitObservable.js.map +0 -1
- package/esm/browser/runOnReadyState.d.ts +0 -2
- package/esm/browser/runOnReadyState.js +0 -11
- package/esm/browser/runOnReadyState.js.map +0 -1
- package/esm/browser/types.d.ts +0 -19
- package/esm/browser/types.js +0 -5
- package/esm/browser/types.js.map +0 -1
- package/esm/browser/xhrObservable.d.ts +0 -21
- package/esm/browser/xhrObservable.js +0 -81
- package/esm/browser/xhrObservable.js.map +0 -1
- package/esm/domain/configuration/configuration.d.ts +0 -72
- package/esm/domain/configuration/configuration.js +0 -89
- package/esm/domain/configuration/configuration.js.map +0 -1
- package/esm/domain/configuration/endpointBuilder.d.ts +0 -10
- package/esm/domain/configuration/endpointBuilder.js +0 -80
- package/esm/domain/configuration/endpointBuilder.js.map +0 -1
- package/esm/domain/configuration/index.d.ts +0 -4
- package/esm/domain/configuration/index.js +0 -5
- package/esm/domain/configuration/index.js.map +0 -1
- package/esm/domain/configuration/intakeSites.d.ts +0 -5
- package/esm/domain/configuration/intakeSites.js +0 -6
- package/esm/domain/configuration/intakeSites.js.map +0 -1
- package/esm/domain/configuration/tags.d.ts +0 -4
- package/esm/domain/configuration/tags.js +0 -34
- package/esm/domain/configuration/tags.js.map +0 -1
- package/esm/domain/configuration/transportConfiguration.d.ts +0 -16
- package/esm/domain/configuration/transportConfiguration.js +0 -38
- package/esm/domain/configuration/transportConfiguration.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/console/consoleObservable.d.ts +0 -11
- package/esm/domain/console/consoleObservable.js +0 -67
- package/esm/domain/console/consoleObservable.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/deflate/index.d.ts +0 -1
- package/esm/domain/deflate/index.js +0 -2
- package/esm/domain/deflate/index.js.map +0 -1
- package/esm/domain/deflate/types.d.ts +0 -38
- package/esm/domain/deflate/types.js +0 -2
- package/esm/domain/deflate/types.js.map +0 -1
- package/esm/domain/error/computeStackTrace.d.ts +0 -33
- package/esm/domain/error/computeStackTrace.js +0 -137
- package/esm/domain/error/computeStackTrace.js.map +0 -1
- package/esm/domain/error/error.d.ts +0 -28
- package/esm/domain/error/error.js +0 -121
- package/esm/domain/error/error.js.map +0 -1
- package/esm/domain/error/error.types.d.ts +0 -40
- package/esm/domain/error/error.types.js +0 -10
- package/esm/domain/error/error.types.js.map +0 -1
- package/esm/domain/error/trackRuntimeError.d.ts +0 -13
- package/esm/domain/error/trackRuntimeError.js +0 -48
- package/esm/domain/error/trackRuntimeError.js.map +0 -1
- package/esm/domain/eventRateLimiter/createEventRateLimiter.d.ts +0 -5
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js +0 -36
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js.map +0 -1
- package/esm/domain/report/browser.types.d.ts +0 -34
- package/esm/domain/report/browser.types.js +0 -2
- package/esm/domain/report/browser.types.js.map +0 -1
- package/esm/domain/report/reportObservable.d.ts +0 -17
- package/esm/domain/report/reportObservable.js +0 -90
- package/esm/domain/report/reportObservable.js.map +0 -1
- package/esm/domain/resourceUtils.d.ts +0 -16
- package/esm/domain/resourceUtils.js +0 -2
- package/esm/domain/resourceUtils.js.map +0 -1
- package/esm/domain/session/oldCookiesMigration.d.ts +0 -11
- package/esm/domain/session/oldCookiesMigration.js +0 -36
- package/esm/domain/session/oldCookiesMigration.js.map +0 -1
- package/esm/domain/session/sessionConstants.d.ts +0 -2
- package/esm/domain/session/sessionConstants.js +0 -4
- package/esm/domain/session/sessionConstants.js.map +0 -1
- package/esm/domain/session/sessionManager.d.ts +0 -20
- package/esm/domain/session/sessionManager.js +0 -60
- package/esm/domain/session/sessionManager.js.map +0 -1
- package/esm/domain/session/sessionState.d.ts +0 -11
- package/esm/domain/session/sessionState.js +0 -38
- package/esm/domain/session/sessionState.js.map +0 -1
- package/esm/domain/session/sessionStore.d.ts +0 -34
- package/esm/domain/session/sessionStore.js +0 -139
- package/esm/domain/session/sessionStore.js.map +0 -1
- package/esm/domain/session/sessionStoreOperations.d.ts +0 -10
- package/esm/domain/session/sessionStoreOperations.js +0 -92
- package/esm/domain/session/sessionStoreOperations.js.map +0 -1
- package/esm/domain/session/storeStrategies/sessionInCookie.d.ts +0 -6
- package/esm/domain/session/storeStrategies/sessionInCookie.js +0 -53
- package/esm/domain/session/storeStrategies/sessionInCookie.js.map +0 -1
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.d.ts +0 -3
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js +0 -36
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js.map +0 -1
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.d.ts +0 -15
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.js +0 -2
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.js.map +0 -1
- package/esm/domain/synthetics/syntheticsWorkerValues.d.ts +0 -11
- package/esm/domain/synthetics/syntheticsWorkerValues.js +0 -16
- package/esm/domain/synthetics/syntheticsWorkerValues.js.map +0 -1
- package/esm/domain/telemetry/index.d.ts +0 -3
- package/esm/domain/telemetry/index.js +0 -4
- package/esm/domain/telemetry/index.js.map +0 -1
- package/esm/domain/telemetry/rawTelemetryEvent.types.d.ts +0 -15
- package/esm/domain/telemetry/rawTelemetryEvent.types.js +0 -5
- package/esm/domain/telemetry/rawTelemetryEvent.types.js.map +0 -1
- package/esm/domain/telemetry/telemetry.d.ts +0 -116
- package/esm/domain/telemetry/telemetry.js +0 -145
- package/esm/domain/telemetry/telemetry.js.map +0 -1
- package/esm/domain/telemetry/telemetryEvent.types.d.ts +0 -391
- package/esm/domain/telemetry/telemetryEvent.types.js +0 -6
- package/esm/domain/telemetry/telemetryEvent.types.js.map +0 -1
- package/esm/domain/user/index.d.ts +0 -2
- package/esm/domain/user/index.js +0 -3
- package/esm/domain/user/index.js.map +0 -1
- package/esm/domain/user/user.d.ts +0 -12
- package/esm/domain/user/user.js +0 -30
- package/esm/domain/user/user.js.map +0 -1
- package/esm/domain/user/user.types.d.ts +0 -6
- package/esm/domain/user/user.types.js +0 -2
- package/esm/domain/user/user.types.js.map +0 -1
- package/esm/index.d.ts +0 -67
- package/esm/index.js +0 -64
- package/esm/index.js.map +0 -1
- package/esm/tools/abstractLifeCycle.d.ts +0 -23
- package/esm/tools/abstractLifeCycle.js +0 -26
- package/esm/tools/abstractLifeCycle.js.map +0 -1
- package/esm/tools/boundedBuffer.d.ts +0 -5
- package/esm/tools/boundedBuffer.js +0 -19
- package/esm/tools/boundedBuffer.js.map +0 -1
- package/esm/tools/catchUserErrors.d.ts +0 -1
- package/esm/tools/catchUserErrors.js +0 -16
- package/esm/tools/catchUserErrors.js.map +0 -1
- package/esm/tools/display.d.ts +0 -35
- package/esm/tools/display.js +0 -38
- package/esm/tools/display.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/esm/tools/experimentalFeatures.d.ts +0 -22
- package/esm/tools/experimentalFeatures.js +0 -38
- package/esm/tools/experimentalFeatures.js.map +0 -1
- package/esm/tools/getGlobalObject.d.ts +0 -4
- package/esm/tools/getGlobalObject.js +0 -33
- package/esm/tools/getGlobalObject.js.map +0 -1
- package/esm/tools/getZoneJsOriginalValue.d.ts +0 -19
- package/esm/tools/getZoneJsOriginalValue.js +0 -26
- package/esm/tools/getZoneJsOriginalValue.js.map +0 -1
- package/esm/tools/instrumentMethod.d.ts +0 -59
- package/esm/tools/instrumentMethod.js +0 -101
- package/esm/tools/instrumentMethod.js.map +0 -1
- package/esm/tools/matchOption.d.ts +0 -8
- package/esm/tools/matchOption.js +0 -33
- package/esm/tools/matchOption.js.map +0 -1
- package/esm/tools/mergeInto.d.ts +0 -25
- package/esm/tools/mergeInto.js +0 -99
- package/esm/tools/mergeInto.js.map +0 -1
- package/esm/tools/monitor.d.ts +0 -8
- package/esm/tools/monitor.js +0 -66
- package/esm/tools/monitor.js.map +0 -1
- package/esm/tools/observable.d.ts +0 -12
- package/esm/tools/observable.js +0 -39
- package/esm/tools/observable.js.map +0 -1
- package/esm/tools/readBytesFromStream.d.ts +0 -11
- package/esm/tools/readBytesFromStream.js +0 -60
- package/esm/tools/readBytesFromStream.js.map +0 -1
- package/esm/tools/sendToExtension.d.ts +0 -3
- package/esm/tools/sendToExtension.js +0 -7
- package/esm/tools/sendToExtension.js.map +0 -1
- package/esm/tools/serialisation/context.d.ts +0 -6
- package/esm/tools/serialisation/context.js +0 -2
- package/esm/tools/serialisation/context.js.map +0 -1
- package/esm/tools/serialisation/jsonStringify.d.ts +0 -13
- package/esm/tools/serialisation/jsonStringify.js +0 -44
- package/esm/tools/serialisation/jsonStringify.js.map +0 -1
- package/esm/tools/serialisation/sanitize.d.ts +0 -18
- package/esm/tools/serialisation/sanitize.js +0 -181
- package/esm/tools/serialisation/sanitize.js.map +0 -1
- package/esm/tools/timer.d.ts +0 -5
- package/esm/tools/timer.js +0 -16
- package/esm/tools/timer.js.map +0 -1
- package/esm/tools/utils/arrayUtils.d.ts +0 -1
- package/esm/tools/utils/arrayUtils.js +0 -7
- package/esm/tools/utils/arrayUtils.js.map +0 -1
- package/esm/tools/utils/browserDetection.d.ts +0 -10
- package/esm/tools/utils/browserDetection.js +0 -35
- package/esm/tools/utils/browserDetection.js.map +0 -1
- package/esm/tools/utils/byteUtils.d.ts +0 -4
- package/esm/tools/utils/byteUtils.js +0 -26
- package/esm/tools/utils/byteUtils.js.map +0 -1
- package/esm/tools/utils/functionUtils.d.ts +0 -9
- package/esm/tools/utils/functionUtils.js +0 -43
- package/esm/tools/utils/functionUtils.js.map +0 -1
- package/esm/tools/utils/numberUtils.d.ts +0 -8
- package/esm/tools/utils/numberUtils.js +0 -17
- package/esm/tools/utils/numberUtils.js.map +0 -1
- package/esm/tools/utils/objectUtils.d.ts +0 -10
- package/esm/tools/utils/objectUtils.js +0 -19
- package/esm/tools/utils/objectUtils.js.map +0 -1
- package/esm/tools/utils/polyfills.d.ts +0 -24
- package/esm/tools/utils/polyfills.js +0 -95
- package/esm/tools/utils/polyfills.js.map +0 -1
- package/esm/tools/utils/responseUtils.d.ts +0 -2
- package/esm/tools/utils/responseUtils.js +0 -13
- package/esm/tools/utils/responseUtils.js.map +0 -1
- package/esm/tools/utils/stringUtils.d.ts +0 -8
- package/esm/tools/utils/stringUtils.js +0 -52
- package/esm/tools/utils/stringUtils.js.map +0 -1
- package/esm/tools/utils/timeUtils.d.ts +0 -57
- package/esm/tools/utils/timeUtils.js +0 -82
- package/esm/tools/utils/timeUtils.js.map +0 -1
- package/esm/tools/utils/typeUtils.d.ts +0 -4
- package/esm/tools/utils/typeUtils.js +0 -13
- package/esm/tools/utils/typeUtils.js.map +0 -1
- package/esm/tools/utils/urlPolyfill.d.ts +0 -14
- package/esm/tools/utils/urlPolyfill.js +0 -80
- package/esm/tools/utils/urlPolyfill.js.map +0 -1
- package/esm/tools/valueHistory.d.ts +0 -50
- package/esm/tools/valueHistory.js +0 -103
- package/esm/tools/valueHistory.js.map +0 -1
- package/esm/transport/batch.d.ts +0 -21
- package/esm/transport/batch.js +0 -120
- package/esm/transport/batch.js.map +0 -1
- package/esm/transport/eventBridge.d.ts +0 -12
- package/esm/transport/eventBridge.js +0 -29
- package/esm/transport/eventBridge.js.map +0 -1
- package/esm/transport/flushController.d.ts +0 -58
- package/esm/transport/flushController.js +0 -108
- package/esm/transport/flushController.js.map +0 -1
- package/esm/transport/httpRequest.d.ts +0 -38
- package/esm/transport/httpRequest.js +0 -89
- package/esm/transport/httpRequest.js.map +0 -1
- package/esm/transport/index.d.ts +0 -4
- package/esm/transport/index.js +0 -5
- package/esm/transport/index.js.map +0 -1
- package/esm/transport/sendWithRetryStrategy.d.ts +0 -39
- package/esm/transport/sendWithRetryStrategy.js +0 -146
- package/esm/transport/sendWithRetryStrategy.js.map +0 -1
- package/esm/transport/startBatchWithReplica.d.ts +0 -20
- package/esm/transport/startBatchWithReplica.js +0 -38
- package/esm/transport/startBatchWithReplica.js.map +0 -1
- package/src/domain/configuration/intakeSites.ts +0 -5
- package/src/domain/configuration/tags.ts +0 -43
- package/src/domain/context/customerDataTracker.ts +0 -134
- package/src/domain/user/index.ts +0 -2
- package/src/domain/user/user.ts +0 -33
- package/src/domain/user/user.types.ts +0 -6
- package/src/transport/startBatchWithReplica.ts +0 -68
package/src/index.ts
CHANGED
|
@@ -1,120 +1,151 @@
|
|
|
1
|
+
export type { Configuration, InitConfiguration, EndpointBuilder, ProxyFn } from './domain/configuration'
|
|
1
2
|
export {
|
|
2
|
-
Configuration,
|
|
3
|
-
InitConfiguration,
|
|
4
3
|
validateAndBuildConfiguration,
|
|
5
4
|
DefaultPrivacyLevel,
|
|
6
|
-
|
|
5
|
+
TraceContextInjection,
|
|
7
6
|
serializeConfiguration,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
INTAKE_SITE_EU1,
|
|
7
|
+
isSampleRate,
|
|
8
|
+
buildEndpointHost,
|
|
9
|
+
isIntakeUrl,
|
|
12
10
|
} from './domain/configuration'
|
|
11
|
+
export * from './domain/intakeSites'
|
|
12
|
+
export type { TrackingConsentState } from './domain/trackingConsent'
|
|
13
|
+
export { TrackingConsent, createTrackingConsentState } from './domain/trackingConsent'
|
|
13
14
|
export {
|
|
14
15
|
isExperimentalFeatureEnabled,
|
|
15
16
|
addExperimentalFeatures,
|
|
16
17
|
resetExperimentalFeatures,
|
|
17
18
|
getExperimentalFeatures,
|
|
19
|
+
initFeatureFlags,
|
|
18
20
|
ExperimentalFeature,
|
|
19
21
|
} from './tools/experimentalFeatures'
|
|
20
22
|
export { trackRuntimeError } from './domain/error/trackRuntimeError'
|
|
21
|
-
export {
|
|
23
|
+
export type { StackTrace } from './tools/stackTrace/computeStackTrace'
|
|
24
|
+
export { computeStackTrace } from './tools/stackTrace/computeStackTrace'
|
|
25
|
+
export type { PublicApi } from './boot/init'
|
|
22
26
|
export { defineGlobal, makePublicApi } from './boot/init'
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
|
|
27
|
+
export { displayAlreadyInitializedError } from './boot/displayAlreadyInitializedError'
|
|
28
|
+
export { initReportObservable, RawReportType } from './domain/report/reportObservable'
|
|
29
|
+
export type {
|
|
26
30
|
Telemetry,
|
|
27
31
|
RawTelemetryEvent,
|
|
28
32
|
RawTelemetryConfiguration,
|
|
29
|
-
addTelemetryDebug,
|
|
30
|
-
addTelemetryError,
|
|
31
|
-
startFakeTelemetry,
|
|
32
|
-
resetTelemetry,
|
|
33
33
|
TelemetryEvent,
|
|
34
34
|
TelemetryErrorEvent,
|
|
35
35
|
TelemetryDebugEvent,
|
|
36
36
|
TelemetryConfigurationEvent,
|
|
37
|
+
TelemetryUsageEvent,
|
|
38
|
+
RawTelemetryUsage,
|
|
39
|
+
RawTelemetryUsageFeature,
|
|
40
|
+
} from './domain/telemetry'
|
|
41
|
+
export {
|
|
42
|
+
startTelemetry,
|
|
43
|
+
addTelemetryDebug,
|
|
44
|
+
addTelemetryError,
|
|
45
|
+
resetTelemetry,
|
|
37
46
|
TelemetryService,
|
|
38
|
-
|
|
47
|
+
TelemetryMetrics,
|
|
39
48
|
addTelemetryConfiguration,
|
|
49
|
+
addTelemetryUsage,
|
|
50
|
+
addTelemetryMetrics,
|
|
40
51
|
} from './domain/telemetry'
|
|
41
|
-
export { monitored, monitor, callMonitored, setDebugMode } from './tools/monitor'
|
|
42
|
-
export {
|
|
43
|
-
export {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// Exposed for tests
|
|
47
|
-
stopSessionManager,
|
|
48
|
-
} from './domain/session/sessionManager'
|
|
52
|
+
export { monitored, monitor, callMonitored, setDebugMode, monitorError } from './tools/monitor'
|
|
53
|
+
export type { Subscription } from './tools/observable'
|
|
54
|
+
export { Observable, BufferedObservable } from './tools/observable'
|
|
55
|
+
export type { SessionManager } from './domain/session/sessionManager'
|
|
56
|
+
export { startSessionManager, stopSessionManager } from './domain/session/sessionManager'
|
|
49
57
|
export {
|
|
50
58
|
SESSION_TIME_OUT_DELAY, // Exposed for tests
|
|
59
|
+
SESSION_NOT_TRACKED,
|
|
60
|
+
SessionPersistence,
|
|
51
61
|
} from './domain/session/sessionConstants'
|
|
62
|
+
export type { BandwidthStats, HttpRequest, HttpRequestEvent, Payload, FlushEvent, FlushReason } from './transport'
|
|
52
63
|
export {
|
|
53
|
-
HttpRequest,
|
|
54
|
-
Payload,
|
|
55
64
|
createHttpRequest,
|
|
56
65
|
canUseEventBridge,
|
|
57
66
|
getEventBridge,
|
|
58
|
-
|
|
67
|
+
bridgeSupports,
|
|
68
|
+
BridgeCapability,
|
|
69
|
+
createBatch,
|
|
59
70
|
createFlushController,
|
|
60
|
-
|
|
61
|
-
FlushReason,
|
|
71
|
+
FLUSH_DURATION_LIMIT,
|
|
62
72
|
} from './transport'
|
|
63
73
|
export * from './tools/display'
|
|
64
|
-
export { Encoder, EncoderResult
|
|
74
|
+
export type { Encoder, EncoderResult } from './tools/encoder'
|
|
75
|
+
export { createIdentityEncoder } from './tools/encoder'
|
|
65
76
|
export * from './tools/utils/urlPolyfill'
|
|
66
77
|
export * from './tools/utils/timeUtils'
|
|
67
78
|
export * from './tools/utils/arrayUtils'
|
|
68
79
|
export * from './tools/serialisation/sanitize'
|
|
69
|
-
export * from './tools/
|
|
80
|
+
export * from './tools/globalObject'
|
|
70
81
|
export { AbstractLifeCycle } from './tools/abstractLifeCycle'
|
|
71
82
|
export * from './domain/eventRateLimiter/createEventRateLimiter'
|
|
72
83
|
export * from './tools/utils/browserDetection'
|
|
73
84
|
export { sendToExtension } from './tools/sendToExtension'
|
|
74
|
-
export { runOnReadyState } from './browser/runOnReadyState'
|
|
85
|
+
export { runOnReadyState, asyncRunOnReadyState } from './browser/runOnReadyState'
|
|
75
86
|
export { getZoneJsOriginalValue } from './tools/getZoneJsOriginalValue'
|
|
76
|
-
export {
|
|
87
|
+
export type { InstrumentedMethodCall } from './tools/instrumentMethod'
|
|
88
|
+
export { instrumentMethod, instrumentSetter } from './tools/instrumentMethod'
|
|
77
89
|
export {
|
|
78
90
|
computeRawError,
|
|
79
|
-
createHandlingStack,
|
|
80
|
-
toStackTraceString,
|
|
81
91
|
getFileFromStackTraceString,
|
|
92
|
+
isError,
|
|
82
93
|
NO_ERROR_STACK_PRESENT_MESSAGE,
|
|
83
94
|
} from './domain/error/error'
|
|
84
95
|
export { NonErrorPrefix } from './domain/error/error.types'
|
|
85
|
-
export { Context, ContextArray, ContextValue } from './tools/serialisation/context'
|
|
86
|
-
export {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
96
|
+
export type { Context, ContextArray, ContextValue } from './tools/serialisation/context'
|
|
97
|
+
export {
|
|
98
|
+
areCookiesAuthorized,
|
|
99
|
+
getCookie,
|
|
100
|
+
getInitCookie,
|
|
101
|
+
setCookie,
|
|
102
|
+
deleteCookie,
|
|
103
|
+
resetInitCookies,
|
|
104
|
+
} from './browser/cookie'
|
|
105
|
+
export type { CookieStore, WeakRef, WeakRefConstructor } from './browser/browser.types'
|
|
106
|
+
export type { XhrCompleteContext, XhrStartContext } from './browser/xhrObservable'
|
|
107
|
+
export { initXhrObservable } from './browser/xhrObservable'
|
|
108
|
+
export type { FetchResolveContext, FetchStartContext, FetchContext } from './browser/fetchObservable'
|
|
109
|
+
export { initFetchObservable, resetFetchObservable, ResponseBodyAction } from './browser/fetchObservable'
|
|
110
|
+
export type { PageMayExitEvent } from './browser/pageMayExitObservable'
|
|
111
|
+
export { createPageMayExitObservable, PageExitReason, isPageExitReason } from './browser/pageMayExitObservable'
|
|
90
112
|
export * from './browser/addEventListener'
|
|
113
|
+
export { requestIdleCallback } from './tools/requestIdleCallback'
|
|
114
|
+
export * from './tools/taskQueue'
|
|
91
115
|
export * from './tools/timer'
|
|
92
|
-
export {
|
|
93
|
-
export {
|
|
116
|
+
export type { ConsoleLog } from './domain/console/consoleObservable'
|
|
117
|
+
export { initConsoleObservable, resetConsoleObservable } from './domain/console/consoleObservable'
|
|
118
|
+
export type { BoundedBuffer } from './tools/boundedBuffer'
|
|
119
|
+
export { createBoundedBuffer } from './tools/boundedBuffer'
|
|
94
120
|
export { catchUserErrors } from './tools/catchUserErrors'
|
|
95
|
-
export {
|
|
121
|
+
export type { ContextManager } from './domain/context/contextManager'
|
|
122
|
+
export { createContextManager } from './domain/context/contextManager'
|
|
123
|
+
export { defineContextMethod, bufferContextCalls } from './domain/context/defineContextMethod'
|
|
96
124
|
export { storeContextManager, removeStorageListeners } from './domain/context/storeContextManager'
|
|
97
|
-
export {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
} from './
|
|
105
|
-
export {
|
|
106
|
-
export { ValueHistory, ValueHistoryEntry, CLEAR_OLD_VALUES_INTERVAL } from './tools/valueHistory'
|
|
125
|
+
export { startAccountContext, buildAccountContextManager } from './domain/contexts/accountContext'
|
|
126
|
+
export { startGlobalContext, buildGlobalContextManager } from './domain/contexts/globalContext'
|
|
127
|
+
export { startUserContext, buildUserContextManager } from './domain/contexts/userContext'
|
|
128
|
+
export type { User } from './domain/contexts/userContext'
|
|
129
|
+
export type { Account } from './domain/contexts/accountContext'
|
|
130
|
+
export type { RumInternalContext } from './domain/contexts/rumInternalContext.type'
|
|
131
|
+
export { CustomerDataType, CustomerContextKey, ContextManagerMethod } from './domain/context/contextConstants'
|
|
132
|
+
export type { ValueHistory, ValueHistoryEntry } from './tools/valueHistory'
|
|
133
|
+
export { createValueHistory, CLEAR_OLD_VALUES_INTERVAL } from './tools/valueHistory'
|
|
107
134
|
export { readBytesFromStream } from './tools/readBytesFromStream'
|
|
135
|
+
export type { SessionState } from './domain/session/sessionState'
|
|
108
136
|
export { STORAGE_POLL_DELAY } from './domain/session/sessionStore'
|
|
109
137
|
export { SESSION_STORE_KEY } from './domain/session/storeStrategies/sessionStoreStrategy'
|
|
110
138
|
export {
|
|
111
139
|
willSyntheticsInjectRum,
|
|
112
140
|
getSyntheticsTestId,
|
|
113
141
|
getSyntheticsResultId,
|
|
142
|
+
isSyntheticsTest,
|
|
114
143
|
} from './domain/synthetics/syntheticsWorkerValues'
|
|
115
|
-
export {
|
|
144
|
+
export { checkContext } from './domain/context/contextUtils'
|
|
116
145
|
export * from './domain/resourceUtils'
|
|
146
|
+
export * from './domain/bufferedData'
|
|
117
147
|
export * from './tools/utils/polyfills'
|
|
148
|
+
export * from './tools/utils/timezone'
|
|
118
149
|
export * from './tools/utils/numberUtils'
|
|
119
150
|
export * from './tools/utils/byteUtils'
|
|
120
151
|
export * from './tools/utils/objectUtils'
|
|
@@ -125,10 +156,10 @@ export * from './tools/utils/stringUtils'
|
|
|
125
156
|
export * from './tools/matchOption'
|
|
126
157
|
export * from './tools/utils/responseUtils'
|
|
127
158
|
export * from './tools/utils/typeUtils'
|
|
128
|
-
export {
|
|
129
|
-
export { ErrorSource } from './domain/error/error.types'
|
|
130
|
-
export { RawError } from './domain/error/error.types'
|
|
131
|
-
export { RawErrorCause } from './domain/error/error.types'
|
|
132
|
-
export { ErrorWithCause } from './domain/error/error.types'
|
|
159
|
+
export type { RawError, RawErrorCause, ErrorWithCause, Csp } from './domain/error/error.types'
|
|
160
|
+
export { ErrorHandling, ErrorSource } from './domain/error/error.types'
|
|
133
161
|
export * from './domain/deflate'
|
|
134
162
|
export * from './domain/connectivity'
|
|
163
|
+
export * from './tools/stackTrace/handlingStack'
|
|
164
|
+
export * from './tools/abstractHooks'
|
|
165
|
+
export * from './domain/tags'
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { combine } from './mergeInto'
|
|
2
|
+
|
|
3
|
+
export const enum HookNames {
|
|
4
|
+
Assemble,
|
|
5
|
+
AssembleTelemetry,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// This is a workaround for an issue occurring when the Browser SDK is included in a TypeScript
|
|
9
|
+
// project configured with `isolatedModules: true`. Even if the const enum is declared in this
|
|
10
|
+
// module, we cannot use it directly to define the EventMap interface keys (TS error: "Cannot access
|
|
11
|
+
// ambient const enums when the '--isolatedModules' flag is provided.").
|
|
12
|
+
export declare const HookNamesAsConst: {
|
|
13
|
+
ASSEMBLE: HookNames.Assemble
|
|
14
|
+
ASSEMBLE_TELEMETRY: HookNames.AssembleTelemetry
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type RecursivePartial<T> = {
|
|
18
|
+
[P in keyof T]?: T[P] extends Array<infer U>
|
|
19
|
+
? Array<RecursivePartial<U>>
|
|
20
|
+
: T[P] extends object | undefined
|
|
21
|
+
? RecursivePartial<T[P]>
|
|
22
|
+
: T[P]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Discards the event from being sent
|
|
26
|
+
export const DISCARDED = 'DISCARDED'
|
|
27
|
+
// Skips from the assembly of the event
|
|
28
|
+
export const SKIPPED = 'SKIPPED'
|
|
29
|
+
|
|
30
|
+
export type DISCARDED = typeof DISCARDED
|
|
31
|
+
export type SKIPPED = typeof SKIPPED
|
|
32
|
+
|
|
33
|
+
export type AbstractHooks = ReturnType<typeof abstractHooks>
|
|
34
|
+
|
|
35
|
+
export function abstractHooks<T extends { [K in HookNames]: (...args: any[]) => unknown }>() {
|
|
36
|
+
const callbacks: { [K in HookNames]?: Array<T[K]> } = {}
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
register<K extends HookNames>(hookName: K, callback: T[K]) {
|
|
40
|
+
if (!callbacks[hookName]) {
|
|
41
|
+
callbacks[hookName] = []
|
|
42
|
+
}
|
|
43
|
+
callbacks[hookName]!.push(callback)
|
|
44
|
+
return {
|
|
45
|
+
unregister: () => {
|
|
46
|
+
callbacks[hookName] = callbacks[hookName]!.filter((cb) => cb !== callback)
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
triggerHook<K extends HookNames>(
|
|
51
|
+
hookName: K,
|
|
52
|
+
param: Parameters<T[K]>[0]
|
|
53
|
+
): Exclude<ReturnType<T[K]>, SKIPPED> | DISCARDED | undefined {
|
|
54
|
+
const hookCallbacks = callbacks[hookName] || []
|
|
55
|
+
const results: any[] = []
|
|
56
|
+
|
|
57
|
+
for (const callback of hookCallbacks) {
|
|
58
|
+
const result = callback(param)
|
|
59
|
+
if (result === DISCARDED) {
|
|
60
|
+
return DISCARDED
|
|
61
|
+
}
|
|
62
|
+
if (result === SKIPPED) {
|
|
63
|
+
continue
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
results.push(result)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return combine(...(results as [any, any])) as Exclude<ReturnType<T[K]>, SKIPPED>
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -16,6 +16,7 @@ type EventTypesWithoutData<EventMap> = {
|
|
|
16
16
|
[K in keyof EventMap]: EventMap[K] extends void ? K : never
|
|
17
17
|
}[keyof EventMap]
|
|
18
18
|
|
|
19
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
19
20
|
export class AbstractLifeCycle<EventMap> {
|
|
20
21
|
private callbacks: { [key in keyof EventMap]?: Array<(data: any) => void> } = {}
|
|
21
22
|
|
|
@@ -1,17 +1,45 @@
|
|
|
1
|
+
import { removeItem } from './utils/arrayUtils'
|
|
2
|
+
|
|
1
3
|
const BUFFER_LIMIT = 500
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* BoundedBuffer is a deprecated interface.
|
|
7
|
+
*
|
|
8
|
+
* @deprecated Use `BufferedObservable` instead.
|
|
9
|
+
*/
|
|
10
|
+
export interface BoundedBuffer<T = void> {
|
|
11
|
+
add: (callback: (arg: T) => void) => void
|
|
12
|
+
remove: (callback: (arg: T) => void) => void
|
|
13
|
+
drain: (arg: T) => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* createBoundedBuffer creates a BoundedBuffer.
|
|
18
|
+
*
|
|
19
|
+
* @deprecated Use `BufferedObservable` instead.
|
|
20
|
+
*/
|
|
21
|
+
export function createBoundedBuffer<T = void>(): BoundedBuffer<T> {
|
|
22
|
+
const buffer: Array<(arg: T) => void> = []
|
|
5
23
|
|
|
6
|
-
add(callback: () => void) {
|
|
7
|
-
const length =
|
|
24
|
+
const add: BoundedBuffer<T>['add'] = (callback: (arg: T) => void) => {
|
|
25
|
+
const length = buffer.push(callback)
|
|
8
26
|
if (length > BUFFER_LIMIT) {
|
|
9
|
-
|
|
27
|
+
buffer.splice(0, 1)
|
|
10
28
|
}
|
|
11
29
|
}
|
|
12
30
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
31
|
+
const remove: BoundedBuffer<T>['remove'] = (callback: (arg: T) => void) => {
|
|
32
|
+
removeItem(buffer, callback)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const drain = (arg: T) => {
|
|
36
|
+
buffer.forEach((callback) => callback(arg))
|
|
37
|
+
buffer.length = 0
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
add,
|
|
42
|
+
remove,
|
|
43
|
+
drain,
|
|
16
44
|
}
|
|
17
45
|
}
|
package/src/tools/display.ts
CHANGED
|
@@ -50,3 +50,7 @@ export const display: Display = {
|
|
|
50
50
|
warn: originalConsoleMethods.warn.bind(globalConsole, PREFIX),
|
|
51
51
|
error: originalConsoleMethods.error.bind(globalConsole, PREFIX),
|
|
52
52
|
}
|
|
53
|
+
|
|
54
|
+
export const DOCS_ORIGIN = 'https://docs.datadoghq.com'
|
|
55
|
+
export const DOCS_TROUBLESHOOTING = `${DOCS_ORIGIN}/real_user_monitoring/browser/troubleshooting`
|
|
56
|
+
export const MORE_DETAILS = 'More details:'
|
package/src/tools/encoder.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { Uint8ArrayBuffer } from './utils/byteUtils'
|
|
1
2
|
import { computeBytesCount } from './utils/byteUtils'
|
|
2
3
|
|
|
3
|
-
export interface Encoder<Output extends string |
|
|
4
|
+
export interface Encoder<Output extends string | Uint8ArrayBuffer = string | Uint8ArrayBuffer> {
|
|
4
5
|
/**
|
|
5
6
|
* Whether this encoder might call the provided callbacks asynchronously
|
|
6
7
|
*/
|
|
@@ -43,7 +44,7 @@ export interface Encoder<Output extends string | Uint8Array = string | Uint8Arra
|
|
|
43
44
|
estimateEncodedBytesCount(data: string): number
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
export interface EncoderResult<Output extends string |
|
|
47
|
+
export interface EncoderResult<Output extends string | Uint8ArrayBuffer = string | Uint8ArrayBuffer> {
|
|
47
48
|
output: Output
|
|
48
49
|
outputBytesCount: number
|
|
49
50
|
|
|
@@ -9,19 +9,30 @@
|
|
|
9
9
|
*/
|
|
10
10
|
// We want to use a real enum (i.e. not a const enum) here, to be able to check whether an arbitrary
|
|
11
11
|
// string is an expected feature flag
|
|
12
|
+
|
|
13
|
+
import { objectHasValue } from './utils/objectUtils'
|
|
14
|
+
|
|
12
15
|
// eslint-disable-next-line no-restricted-syntax
|
|
13
16
|
export enum ExperimentalFeature {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
DISABLE_REPLAY_INLINE_CSS = 'disable_replay_inline_css',
|
|
20
|
-
WRITABLE_RESOURCE_GRAPHQL = 'writable_resource_graphql',
|
|
17
|
+
TRACK_INTAKE_REQUESTS = 'track_intake_requests',
|
|
18
|
+
USE_TREE_WALKER_FOR_ACTION_NAME = 'use_tree_walker_for_action_name',
|
|
19
|
+
FEATURE_OPERATION_VITAL = 'feature_operation_vital',
|
|
20
|
+
SHORT_SESSION_INVESTIGATION = 'short_session_investigation',
|
|
21
|
+
AVOID_FETCH_KEEPALIVE = 'avoid_fetch_keepalive',
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
const enabledExperimentalFeatures: Set<ExperimentalFeature> = new Set()
|
|
24
25
|
|
|
26
|
+
export function initFeatureFlags(enableExperimentalFeatures: string[] | undefined) {
|
|
27
|
+
if (Array.isArray(enableExperimentalFeatures)) {
|
|
28
|
+
addExperimentalFeatures(
|
|
29
|
+
enableExperimentalFeatures.filter((flag): flag is ExperimentalFeature =>
|
|
30
|
+
objectHasValue(ExperimentalFeature, flag)
|
|
31
|
+
)
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
25
36
|
export function addExperimentalFeatures(enabledFeatures: ExperimentalFeature[]): void {
|
|
26
37
|
enabledFeatures.forEach((flag) => {
|
|
27
38
|
enabledExperimentalFeatures.add(flag)
|
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
* inspired by https://mathiasbynens.be/notes/globalthis
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
// Extend/Create the WorkerGlobalScope interface to avoid issues when used in a non-browser tsconfig environment
|
|
6
|
+
interface WorkerGlobalScope {
|
|
7
|
+
empty: never
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Utility type to enforce that exactly one of the two types is used
|
|
11
|
+
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never }
|
|
12
|
+
type XOR<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U
|
|
13
|
+
|
|
14
|
+
export type GlobalObject = XOR<Window, WorkerGlobalScope>
|
|
15
|
+
|
|
5
16
|
export function getGlobalObject<T = typeof globalThis>(): T {
|
|
6
17
|
if (typeof globalThis === 'object') {
|
|
7
18
|
return globalThis as unknown as T
|
|
@@ -29,3 +40,12 @@ export function getGlobalObject<T = typeof globalThis>(): T {
|
|
|
29
40
|
}
|
|
30
41
|
return globalObject as T
|
|
31
42
|
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Cached reference to the global object so it can be imported and re-used without
|
|
46
|
+
* re-evaluating the heavyweight fallback logic in `getGlobalObject()`.
|
|
47
|
+
*/
|
|
48
|
+
// eslint-disable-next-line local-rules/disallow-side-effects
|
|
49
|
+
export const globalObject = getGlobalObject<GlobalObject>()
|
|
50
|
+
|
|
51
|
+
export const isWorkerEnvironment = 'WorkerGlobalScope' in globalObject
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { setTimeout } from './timer'
|
|
2
2
|
import { callMonitored } from './monitor'
|
|
3
3
|
import { noop } from './utils/functionUtils'
|
|
4
|
+
import { createHandlingStack } from './stackTrace/handlingStack'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Object passed to the callback of an instrumented method call. See `instrumentMethod` for more
|
|
7
8
|
* info.
|
|
8
9
|
*/
|
|
9
|
-
export
|
|
10
|
+
export interface InstrumentedMethodCall<TARGET extends { [key: string]: any }, METHOD extends keyof TARGET> {
|
|
10
11
|
/**
|
|
11
12
|
* The target object on which the method was called.
|
|
12
13
|
*/
|
|
13
14
|
target: TARGET
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
|
-
* The parameters with which the method was called.
|
|
17
|
-
* every time, this property is actually an instance of Argument, not Array, so not all methods
|
|
18
|
-
* are available (like .forEach).
|
|
17
|
+
* The parameters with which the method was called.
|
|
19
18
|
*
|
|
20
19
|
* Note: if needed, parameters can be mutated by the instrumentation
|
|
21
20
|
*/
|
|
@@ -26,6 +25,11 @@ export type InstrumentedMethodCall<TARGET extends { [key: string]: any }, METHOD
|
|
|
26
25
|
* result passed as argument.
|
|
27
26
|
*/
|
|
28
27
|
onPostCall: (callback: PostCallCallback<TARGET, METHOD>) => void
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The stack trace of the method call.
|
|
31
|
+
*/
|
|
32
|
+
handlingStack?: string
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
type PostCallCallback<TARGET extends { [key: string]: any }, METHOD extends keyof TARGET> = (
|
|
@@ -36,11 +40,23 @@ type PostCallCallback<TARGET extends { [key: string]: any }, METHOD extends keyo
|
|
|
36
40
|
* Instruments a method on a object, calling the given callback before the original method is
|
|
37
41
|
* invoked. The callback receives an object with information about the method call.
|
|
38
42
|
*
|
|
43
|
+
* This function makes sure that we are "good citizens" regarding third party instrumentations: when
|
|
44
|
+
* removing the instrumentation, the original method is usually restored, but if a third party
|
|
45
|
+
* instrumentation was set after ours, we keep it in place and just replace our instrumentation with
|
|
46
|
+
* a noop.
|
|
47
|
+
*
|
|
39
48
|
* Note: it is generally better to instrument methods that are "owned" by the object instead of ones
|
|
40
49
|
* that are inherited from the prototype chain. Example:
|
|
41
50
|
* * do: `instrumentMethod(Array.prototype, 'push', ...)`
|
|
42
51
|
* * don't: `instrumentMethod([], 'push', ...)`
|
|
43
52
|
*
|
|
53
|
+
* This method is also used to set event handler properties (ex: window.onerror = ...), as it has
|
|
54
|
+
* the same requirements as instrumenting a method:
|
|
55
|
+
* * if the event handler is already set by a third party, we need to call it and not just blindly
|
|
56
|
+
* override it.
|
|
57
|
+
* * if the event handler is set by a third party after us, we need to keep it in place when
|
|
58
|
+
* removing ours.
|
|
59
|
+
*
|
|
44
60
|
* @example
|
|
45
61
|
*
|
|
46
62
|
* instrumentMethod(window, 'fetch', ({ target, parameters, onPostCall }) => {
|
|
@@ -51,43 +67,31 @@ type PostCallCallback<TARGET extends { [key: string]: any }, METHOD extends keyo
|
|
|
51
67
|
* })
|
|
52
68
|
* })
|
|
53
69
|
*/
|
|
54
|
-
export function instrumentMethod<TARGET extends { [key: string]: any }, METHOD extends keyof TARGET>(
|
|
70
|
+
export function instrumentMethod<TARGET extends { [key: string]: any }, METHOD extends keyof TARGET & string>(
|
|
55
71
|
targetPrototype: TARGET,
|
|
56
72
|
method: METHOD,
|
|
57
|
-
onPreCall: (this: null, callInfos: InstrumentedMethodCall<TARGET, METHOD>) => void
|
|
73
|
+
onPreCall: (this: null, callInfos: InstrumentedMethodCall<TARGET, METHOD>) => void,
|
|
74
|
+
{ computeHandlingStack }: { computeHandlingStack?: boolean } = {}
|
|
58
75
|
) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
let instrumentation = createInstrumentedMethod(original, onPreCall)
|
|
76
|
+
let original = targetPrototype[method]
|
|
62
77
|
|
|
63
|
-
|
|
64
|
-
if (
|
|
65
|
-
|
|
78
|
+
if (typeof original !== 'function') {
|
|
79
|
+
if (method in targetPrototype && method.startsWith('on')) {
|
|
80
|
+
original = noop as TARGET[METHOD]
|
|
81
|
+
} else {
|
|
82
|
+
return { stop: noop }
|
|
66
83
|
}
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
|
|
68
|
-
return instrumentation.apply(this, arguments as unknown as Parameters<TARGET[METHOD]>)
|
|
69
84
|
}
|
|
70
|
-
targetPrototype[method] = instrumentationWrapper as TARGET[METHOD]
|
|
71
85
|
|
|
72
|
-
|
|
73
|
-
stop: () => {
|
|
74
|
-
if (targetPrototype[method] === instrumentationWrapper) {
|
|
75
|
-
targetPrototype[method] = original
|
|
76
|
-
} else {
|
|
77
|
-
instrumentation = original
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
}
|
|
81
|
-
}
|
|
86
|
+
let stopped = false
|
|
82
87
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const parameters = arguments as
|
|
90
|
-
let result
|
|
88
|
+
const instrumentation = function (this: TARGET): ReturnType<TARGET[METHOD]> | undefined {
|
|
89
|
+
if (stopped) {
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
|
|
91
|
+
return original.apply(this, arguments as unknown as Parameters<TARGET[METHOD]>)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const parameters = Array.from(arguments) as Parameters<TARGET[METHOD]>
|
|
91
95
|
|
|
92
96
|
let postCallCallback: PostCallCallback<TARGET, METHOD> | undefined
|
|
93
97
|
|
|
@@ -98,13 +102,12 @@ function createInstrumentedMethod<TARGET extends { [key: string]: any }, METHOD
|
|
|
98
102
|
onPostCall: (callback) => {
|
|
99
103
|
postCallCallback = callback
|
|
100
104
|
},
|
|
105
|
+
handlingStack: computeHandlingStack ? createHandlingStack('instrumented method') : undefined,
|
|
101
106
|
},
|
|
102
107
|
])
|
|
103
108
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
result = original.apply(this, parameters)
|
|
107
|
-
}
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
110
|
+
const result = original.apply(this, parameters)
|
|
108
111
|
|
|
109
112
|
if (postCallCallback) {
|
|
110
113
|
callMonitored(postCallCallback, null, [result])
|
|
@@ -112,7 +115,19 @@ function createInstrumentedMethod<TARGET extends { [key: string]: any }, METHOD
|
|
|
112
115
|
|
|
113
116
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
114
117
|
return result
|
|
115
|
-
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
targetPrototype[method] = instrumentation as TARGET[METHOD]
|
|
121
|
+
|
|
122
|
+
return {
|
|
123
|
+
stop: () => {
|
|
124
|
+
stopped = true
|
|
125
|
+
// If the instrumentation has been removed by a third party, keep the last one
|
|
126
|
+
if (targetPrototype[method] === instrumentation) {
|
|
127
|
+
targetPrototype[method] = original
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
}
|
|
116
131
|
}
|
|
117
132
|
|
|
118
133
|
export function instrumentSetter<TARGET extends { [key: string]: any }, PROPERTY extends keyof TARGET>(
|
|
@@ -125,10 +140,13 @@ export function instrumentSetter<TARGET extends { [key: string]: any }, PROPERTY
|
|
|
125
140
|
return { stop: noop }
|
|
126
141
|
}
|
|
127
142
|
|
|
143
|
+
const stoppedInstrumentation = noop
|
|
128
144
|
let instrumentation = (target: TARGET, value: TARGET[PROPERTY]) => {
|
|
129
145
|
// put hooked setter into event loop to avoid of set latency
|
|
130
146
|
setTimeout(() => {
|
|
131
|
-
|
|
147
|
+
if (instrumentation !== stoppedInstrumentation) {
|
|
148
|
+
after(target, value)
|
|
149
|
+
}
|
|
132
150
|
}, 0)
|
|
133
151
|
}
|
|
134
152
|
|
|
@@ -145,9 +163,8 @@ export function instrumentSetter<TARGET extends { [key: string]: any }, PROPERTY
|
|
|
145
163
|
stop: () => {
|
|
146
164
|
if (Object.getOwnPropertyDescriptor(targetPrototype, property)?.set === instrumentationWrapper) {
|
|
147
165
|
Object.defineProperty(targetPrototype, property, originalDescriptor)
|
|
148
|
-
} else {
|
|
149
|
-
instrumentation = noop
|
|
150
166
|
}
|
|
167
|
+
instrumentation = stoppedInstrumentation
|
|
151
168
|
},
|
|
152
169
|
}
|
|
153
170
|
}
|
package/src/tools/matchOption.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { startsWith } from './utils/polyfills'
|
|
2
1
|
import { display } from './display'
|
|
3
2
|
import { getType } from './utils/typeUtils'
|
|
4
3
|
|
|
@@ -22,7 +21,7 @@ export function matchList(list: MatchOption[], value: string, useStartsWith = fa
|
|
|
22
21
|
} else if (item instanceof RegExp) {
|
|
23
22
|
return item.test(value)
|
|
24
23
|
} else if (typeof item === 'string') {
|
|
25
|
-
return useStartsWith ? startsWith(
|
|
24
|
+
return useStartsWith ? value.startsWith(item) : item === value
|
|
26
25
|
}
|
|
27
26
|
} catch (e) {
|
|
28
27
|
display.error(e)
|