@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
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AbstractHooks } from '../../tools/abstractHooks'
|
|
2
|
+
import { CustomerDataType } from '../context/contextConstants'
|
|
3
|
+
import { storeContextManager } from '../context/storeContextManager'
|
|
4
|
+
import { HookNames } from '../../tools/abstractHooks'
|
|
5
|
+
import { createContextManager } from '../context/contextManager'
|
|
6
|
+
import type { Configuration } from '../configuration'
|
|
7
|
+
|
|
8
|
+
export function startGlobalContext(
|
|
9
|
+
hooks: AbstractHooks,
|
|
10
|
+
configuration: Configuration,
|
|
11
|
+
productKey: string,
|
|
12
|
+
useContextNamespace: boolean
|
|
13
|
+
) {
|
|
14
|
+
const globalContextManager = buildGlobalContextManager()
|
|
15
|
+
|
|
16
|
+
if (configuration.storeContextsAcrossPages) {
|
|
17
|
+
storeContextManager(configuration, globalContextManager, productKey, CustomerDataType.GlobalContext)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
hooks.register(HookNames.Assemble, () => {
|
|
21
|
+
const context = globalContextManager.getContext()
|
|
22
|
+
return useContextNamespace ? { context } : context
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
return globalContextManager
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function buildGlobalContextManager() {
|
|
29
|
+
return createContextManager('global context')
|
|
30
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Context } from '../../tools/serialisation/context'
|
|
2
|
+
|
|
3
|
+
export interface RumInternalContext extends Context {
|
|
4
|
+
application_id: string
|
|
5
|
+
session_id: string | undefined
|
|
6
|
+
view?: {
|
|
7
|
+
id: string
|
|
8
|
+
url: string
|
|
9
|
+
referrer: string
|
|
10
|
+
name?: string
|
|
11
|
+
}
|
|
12
|
+
user_action?: {
|
|
13
|
+
id: string | string[]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { AbstractHooks } from '../../tools/abstractHooks'
|
|
2
|
+
import { CustomerDataType } from '../context/contextConstants'
|
|
3
|
+
import { storeContextManager } from '../context/storeContextManager'
|
|
4
|
+
import { HookNames, SKIPPED } from '../../tools/abstractHooks'
|
|
5
|
+
import { createContextManager } from '../context/contextManager'
|
|
6
|
+
import type { Configuration } from '../configuration'
|
|
7
|
+
import { isEmptyObject } from '../../tools/utils/objectUtils'
|
|
8
|
+
import type { RelativeTime } from '../../tools/utils/timeUtils'
|
|
9
|
+
|
|
10
|
+
export interface User {
|
|
11
|
+
id?: string | undefined
|
|
12
|
+
email?: string | undefined
|
|
13
|
+
name?: string | undefined
|
|
14
|
+
[key: string]: unknown
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function startUserContext(
|
|
18
|
+
hooks: AbstractHooks,
|
|
19
|
+
configuration: Configuration,
|
|
20
|
+
sessionManager: {
|
|
21
|
+
findTrackedSession: (startTime?: RelativeTime) => { anonymousId?: string } | undefined
|
|
22
|
+
},
|
|
23
|
+
productKey: string
|
|
24
|
+
) {
|
|
25
|
+
const userContextManager = buildUserContextManager()
|
|
26
|
+
|
|
27
|
+
if (configuration.storeContextsAcrossPages) {
|
|
28
|
+
storeContextManager(configuration, userContextManager, productKey, CustomerDataType.User)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
hooks.register(HookNames.Assemble, ({ eventType, startTime }) => {
|
|
32
|
+
const user = userContextManager.getContext()
|
|
33
|
+
const session = sessionManager.findTrackedSession(startTime)
|
|
34
|
+
|
|
35
|
+
if (session && session.anonymousId && !user.anonymous_id && !!configuration.trackAnonymousUser) {
|
|
36
|
+
user.anonymous_id = session.anonymousId
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (isEmptyObject(user)) {
|
|
40
|
+
return SKIPPED
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
type: eventType,
|
|
45
|
+
usr: user,
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
hooks.register(HookNames.AssembleTelemetry, ({ startTime }) => ({
|
|
50
|
+
anonymous_id: sessionManager.findTrackedSession(startTime)?.anonymousId,
|
|
51
|
+
}))
|
|
52
|
+
|
|
53
|
+
return userContextManager
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function buildUserContextManager() {
|
|
57
|
+
return createContextManager('user', {
|
|
58
|
+
propertiesConfig: {
|
|
59
|
+
id: { type: 'string' },
|
|
60
|
+
name: { type: 'string' },
|
|
61
|
+
email: { type: 'string' },
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Encoder } from '../../tools/encoder'
|
|
2
|
+
import type { Uint8ArrayBuffer } from '../../tools/utils/byteUtils'
|
|
2
3
|
|
|
3
4
|
export type DeflateWorkerAction =
|
|
4
5
|
// Action to send when creating the worker to check if the communication is working correctly.
|
|
@@ -31,8 +32,8 @@ export type DeflateWorkerResponse =
|
|
|
31
32
|
type: 'wrote'
|
|
32
33
|
id: number
|
|
33
34
|
streamId: number
|
|
34
|
-
result:
|
|
35
|
-
trailer:
|
|
35
|
+
result: Uint8ArrayBuffer
|
|
36
|
+
trailer: Uint8ArrayBuffer
|
|
36
37
|
additionalBytesCount: number
|
|
37
38
|
}
|
|
38
39
|
// Could happen at any time when something goes wrong in the worker
|
|
@@ -46,10 +47,11 @@ export interface DeflateWorker extends Worker {
|
|
|
46
47
|
postMessage(message: DeflateWorkerAction): void
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
export type DeflateEncoder = Encoder<
|
|
50
|
+
export type DeflateEncoder = Encoder<Uint8ArrayBuffer> & { stop: () => void }
|
|
50
51
|
|
|
51
52
|
export const enum DeflateEncoderStreamId {
|
|
52
53
|
REPLAY = 1,
|
|
53
54
|
RUM = 2,
|
|
54
|
-
|
|
55
|
+
TELEMETRY = 4,
|
|
56
|
+
PROFILING = 6,
|
|
55
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './types'
|
|
1
|
+
export * from './deflate.types'
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { callMonitored } from '../../tools/monitor'
|
|
2
1
|
import { sanitize } from '../../tools/serialisation/sanitize'
|
|
3
2
|
import type { ClocksState } from '../../tools/utils/timeUtils'
|
|
4
|
-
import {
|
|
3
|
+
import type { Context } from '../../tools/serialisation/context'
|
|
5
4
|
import { jsonStringify } from '../../tools/serialisation/jsonStringify'
|
|
5
|
+
import type { StackTrace } from '../../tools/stackTrace/computeStackTrace'
|
|
6
|
+
import { computeStackTrace } from '../../tools/stackTrace/computeStackTrace'
|
|
7
|
+
import { toStackTraceString } from '../../tools/stackTrace/handlingStack'
|
|
6
8
|
import type { ErrorSource, ErrorHandling, RawError, RawErrorCause, ErrorWithCause, NonErrorPrefix } from './error.types'
|
|
7
|
-
import type { StackTrace } from './computeStackTrace'
|
|
8
|
-
import { computeStackTrace } from './computeStackTrace'
|
|
9
9
|
|
|
10
10
|
export const NO_ERROR_STACK_PRESENT_MESSAGE = 'No stack, consider using an instance of Error'
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
interface RawErrorParams {
|
|
13
13
|
stackTrace?: StackTrace
|
|
14
14
|
originalError: unknown
|
|
15
|
-
|
|
16
15
|
handlingStack?: string
|
|
16
|
+
componentStack?: string
|
|
17
17
|
startClocks: ClocksState
|
|
18
18
|
nonErrorPrefix: NonErrorPrefix
|
|
19
|
+
useFallbackStack?: boolean
|
|
19
20
|
source: ErrorSource
|
|
20
21
|
handling: ErrorHandling
|
|
21
22
|
}
|
|
@@ -24,32 +25,31 @@ export function computeRawError({
|
|
|
24
25
|
stackTrace,
|
|
25
26
|
originalError,
|
|
26
27
|
handlingStack,
|
|
28
|
+
componentStack,
|
|
27
29
|
startClocks,
|
|
28
30
|
nonErrorPrefix,
|
|
31
|
+
useFallbackStack = true,
|
|
29
32
|
source,
|
|
30
33
|
handling,
|
|
31
34
|
}: RawErrorParams): RawError {
|
|
32
|
-
const isErrorInstance = originalError
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
? toStackTraceString(stackTrace)
|
|
37
|
-
: NO_ERROR_STACK_PRESENT_MESSAGE
|
|
38
|
-
const causes = isErrorInstance ? flattenErrorCauses(originalError as ErrorWithCause, source) : undefined
|
|
39
|
-
const type = stackTrace?.name
|
|
40
|
-
const fingerprint = tryToGetFingerprint(originalError)
|
|
35
|
+
const isErrorInstance = isError(originalError)
|
|
36
|
+
if (!stackTrace && isErrorInstance) {
|
|
37
|
+
stackTrace = computeStackTrace(originalError)
|
|
38
|
+
}
|
|
41
39
|
|
|
42
40
|
return {
|
|
43
41
|
startClocks,
|
|
44
42
|
source,
|
|
45
43
|
handling,
|
|
46
44
|
handlingStack,
|
|
45
|
+
componentStack,
|
|
47
46
|
originalError,
|
|
48
|
-
type,
|
|
49
|
-
message,
|
|
50
|
-
stack,
|
|
51
|
-
causes,
|
|
52
|
-
fingerprint,
|
|
47
|
+
type: stackTrace ? stackTrace.name : undefined,
|
|
48
|
+
message: computeMessage(stackTrace, isErrorInstance, nonErrorPrefix, originalError),
|
|
49
|
+
stack: stackTrace ? toStackTraceString(stackTrace) : useFallbackStack ? NO_ERROR_STACK_PRESENT_MESSAGE : undefined,
|
|
50
|
+
causes: isErrorInstance ? flattenErrorCauses(originalError as ErrorWithCause, source) : undefined,
|
|
51
|
+
fingerprint: tryToGetFingerprint(originalError),
|
|
52
|
+
context: tryToGetErrorContext(originalError),
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -68,84 +68,28 @@ function computeMessage(
|
|
|
68
68
|
: 'Empty message'
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
function hasUsableStack(isErrorInstance: boolean, stackTrace?: StackTrace): stackTrace is StackTrace {
|
|
72
|
-
if (stackTrace === undefined) {
|
|
73
|
-
return false
|
|
74
|
-
}
|
|
75
|
-
if (isErrorInstance) {
|
|
76
|
-
return true
|
|
77
|
-
}
|
|
78
|
-
// handle cases where tracekit return stack = [] or stack = [{url: undefined, line: undefined, column: undefined}]
|
|
79
|
-
// TODO rework tracekit integration to avoid generating those unusable stack
|
|
80
|
-
return stackTrace.stack.length > 0 && (stackTrace.stack.length > 1 || stackTrace.stack[0].url !== undefined)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
71
|
export function tryToGetFingerprint(originalError: unknown) {
|
|
84
|
-
return originalError
|
|
85
|
-
? String(originalError.oo_fingerprint)
|
|
86
|
-
: undefined
|
|
72
|
+
return isError(originalError) && 'oo_fingerprint' in originalError ? String(originalError.oo_fingerprint) : undefined
|
|
87
73
|
}
|
|
88
74
|
|
|
89
|
-
export function
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const args = frame.args && frame.args.length > 0 ? `(${frame.args.join(', ')})` : ''
|
|
94
|
-
const line = frame.line ? `:${frame.line}` : ''
|
|
95
|
-
const column = frame.line && frame.column ? `:${frame.column}` : ''
|
|
96
|
-
result += `\n at ${func!}${args} @ ${frame.url!}${line}${column}`
|
|
97
|
-
})
|
|
98
|
-
return result
|
|
75
|
+
export function tryToGetErrorContext(originalError: unknown) {
|
|
76
|
+
if (originalError !== null && typeof originalError === 'object' && 'dd_context' in originalError) {
|
|
77
|
+
return originalError.dd_context as Context
|
|
78
|
+
}
|
|
99
79
|
}
|
|
100
80
|
|
|
101
81
|
export function getFileFromStackTraceString(stack: string) {
|
|
102
82
|
return /@ (.+)/.exec(stack)?.[1]
|
|
103
83
|
}
|
|
104
84
|
|
|
105
|
-
export function
|
|
106
|
-
return
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
Creates a stacktrace without SDK internal frames.
|
|
111
|
-
|
|
112
|
-
Constraints:
|
|
113
|
-
- Has to be called at the utmost position of the call stack.
|
|
114
|
-
- No monitored function should encapsulate it, that is why we need to use callMonitored inside it.
|
|
115
|
-
*/
|
|
116
|
-
export function createHandlingStack(): string {
|
|
117
|
-
/**
|
|
118
|
-
* Skip the two internal frames:
|
|
119
|
-
* - SDK API (console.error, ...)
|
|
120
|
-
* - this function
|
|
121
|
-
* in order to keep only the user calls
|
|
122
|
-
*/
|
|
123
|
-
const internalFramesToSkip = 2
|
|
124
|
-
const error = new Error()
|
|
125
|
-
let formattedStack: string
|
|
126
|
-
|
|
127
|
-
// IE needs to throw the error to fill in the stack trace
|
|
128
|
-
if (!error.stack) {
|
|
129
|
-
try {
|
|
130
|
-
throw error
|
|
131
|
-
} catch (e) {
|
|
132
|
-
noop()
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
callMonitored(() => {
|
|
137
|
-
const stackTrace = computeStackTrace(error)
|
|
138
|
-
stackTrace.stack = stackTrace.stack.slice(internalFramesToSkip)
|
|
139
|
-
formattedStack = toStackTraceString(stackTrace)
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
return formattedStack!
|
|
85
|
+
export function isError(error: unknown): error is Error {
|
|
86
|
+
return error instanceof Error || Object.prototype.toString.call(error) === '[object Error]'
|
|
143
87
|
}
|
|
144
88
|
|
|
145
89
|
export function flattenErrorCauses(error: ErrorWithCause, parentSource: ErrorSource): RawErrorCause[] | undefined {
|
|
146
90
|
let currentError = error
|
|
147
91
|
const causes: RawErrorCause[] = []
|
|
148
|
-
while (currentError?.cause
|
|
92
|
+
while (isError(currentError?.cause) && causes.length < 10) {
|
|
149
93
|
const stackTrace = computeStackTrace(currentError.cause)
|
|
150
94
|
causes.push({
|
|
151
95
|
message: currentError.cause.message,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Context } from '../../tools/serialisation/context'
|
|
1
2
|
import type { ClocksState } from '../../tools/utils/timeUtils'
|
|
2
3
|
|
|
3
4
|
// TS v4.6 introduced Error.cause[1] typed as `Error`. TS v4.8 changed Error.cause to be
|
|
@@ -13,13 +14,17 @@ export interface ErrorWithCause extends Omit<Error, 'cause'> {
|
|
|
13
14
|
cause?: unknown
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
export
|
|
17
|
+
export interface RawErrorCause {
|
|
17
18
|
message: string
|
|
18
|
-
source:
|
|
19
|
+
source: ErrorSource
|
|
19
20
|
type?: string
|
|
20
21
|
stack?: string
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
export interface Csp {
|
|
25
|
+
disposition: 'enforce' | 'report'
|
|
26
|
+
}
|
|
27
|
+
|
|
23
28
|
export interface RawError {
|
|
24
29
|
startClocks: ClocksState
|
|
25
30
|
message: string
|
|
@@ -29,8 +34,11 @@ export interface RawError {
|
|
|
29
34
|
originalError?: unknown
|
|
30
35
|
handling?: ErrorHandling
|
|
31
36
|
handlingStack?: string
|
|
37
|
+
componentStack?: string
|
|
32
38
|
causes?: RawErrorCause[]
|
|
33
39
|
fingerprint?: string
|
|
40
|
+
csp?: Csp
|
|
41
|
+
context?: Context
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
export const ErrorSource = {
|
|
@@ -1,53 +1,50 @@
|
|
|
1
1
|
import { instrumentMethod } from '../../tools/instrumentMethod'
|
|
2
|
-
import
|
|
2
|
+
import { Observable } from '../../tools/observable'
|
|
3
3
|
import { clocksNow } from '../../tools/utils/timeUtils'
|
|
4
|
-
import type { StackTrace } from '
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import type { StackTrace } from '../../tools/stackTrace/computeStackTrace'
|
|
5
|
+
import { computeStackTraceFromOnErrorMessage } from '../../tools/stackTrace/computeStackTrace'
|
|
6
|
+
import { getGlobalObject } from '../../tools/globalObject'
|
|
7
|
+
import { computeRawError, isError } from './error'
|
|
7
8
|
import type { RawError } from './error.types'
|
|
8
9
|
import { ErrorHandling, ErrorSource, NonErrorPrefix } from './error.types'
|
|
9
10
|
|
|
10
|
-
export type UnhandledErrorCallback = (
|
|
11
|
+
export type UnhandledErrorCallback = (originalError: unknown, stackTrace?: StackTrace) => any
|
|
11
12
|
|
|
12
|
-
export function trackRuntimeError(
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
export function trackRuntimeError() {
|
|
14
|
+
return new Observable<RawError>((observer) => {
|
|
15
|
+
const handleRuntimeError = (originalError: unknown, stackTrace?: StackTrace) => {
|
|
16
|
+
const rawError = computeRawError({
|
|
17
|
+
stackTrace,
|
|
18
|
+
originalError,
|
|
19
|
+
startClocks: clocksNow(),
|
|
20
|
+
nonErrorPrefix: NonErrorPrefix.UNCAUGHT,
|
|
21
|
+
source: ErrorSource.SOURCE,
|
|
22
|
+
handling: ErrorHandling.UNHANDLED,
|
|
23
|
+
})
|
|
24
|
+
observer.notify(rawError)
|
|
25
|
+
}
|
|
26
|
+
const { stop: stopInstrumentingOnError } = instrumentOnError(handleRuntimeError)
|
|
27
|
+
const { stop: stopInstrumentingOnUnhandledRejection } = instrumentUnhandledRejection(handleRuntimeError)
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
stop: () => {
|
|
29
|
+
return () => {
|
|
29
30
|
stopInstrumentingOnError()
|
|
30
31
|
stopInstrumentingOnUnhandledRejection()
|
|
31
|
-
}
|
|
32
|
-
}
|
|
32
|
+
}
|
|
33
|
+
})
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export function instrumentOnError(callback: UnhandledErrorCallback) {
|
|
36
|
-
return instrumentMethod(
|
|
37
|
+
return instrumentMethod(getGlobalObject(), 'onerror', ({ parameters: [messageObj, url, line, column, errorObj] }) => {
|
|
37
38
|
let stackTrace
|
|
38
|
-
if (errorObj
|
|
39
|
-
stackTrace = computeStackTrace(errorObj)
|
|
40
|
-
} else {
|
|
39
|
+
if (!isError(errorObj)) {
|
|
41
40
|
stackTrace = computeStackTraceFromOnErrorMessage(messageObj, url, line, column)
|
|
42
41
|
}
|
|
43
|
-
callback(
|
|
42
|
+
callback(errorObj ?? messageObj, stackTrace)
|
|
44
43
|
})
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
export function instrumentUnhandledRejection(callback: UnhandledErrorCallback) {
|
|
48
|
-
return instrumentMethod(
|
|
49
|
-
|
|
50
|
-
const stack = computeStackTrace(reason)
|
|
51
|
-
callback(stack, reason)
|
|
47
|
+
return instrumentMethod(getGlobalObject(), 'onunhandledrejection', ({ parameters: [e] }) => {
|
|
48
|
+
callback(e.reason || 'Empty reason')
|
|
52
49
|
})
|
|
53
50
|
}
|
|
@@ -5,10 +5,13 @@ import { ErrorSource } from '../error/error.types'
|
|
|
5
5
|
|
|
6
6
|
export type EventRateLimiter = ReturnType<typeof createEventRateLimiter>
|
|
7
7
|
|
|
8
|
+
// Limit the maximum number of actions, errors and logs per minutes
|
|
9
|
+
const EVENT_RATE_LIMIT = 3000
|
|
10
|
+
|
|
8
11
|
export function createEventRateLimiter(
|
|
9
12
|
eventType: string,
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
onLimitReached: (limitError: RawError) => void,
|
|
14
|
+
limit = EVENT_RATE_LIMIT
|
|
12
15
|
) {
|
|
13
16
|
let eventCount = 0
|
|
14
17
|
let allowNextEvent = false
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const EXTENSION_PREFIXES = ['chrome-extension://', 'moz-extension://']
|
|
2
|
+
|
|
3
|
+
export function containsExtensionUrl(str: string): boolean {
|
|
4
|
+
return EXTENSION_PREFIXES.some((prefix) => str.includes(prefix))
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Utility function to detect if the SDK is being initialized in an unsupported browser extension environment.
|
|
9
|
+
*
|
|
10
|
+
* @param windowLocation - The current window location to check
|
|
11
|
+
* @param stack - The error stack to check for extension URLs
|
|
12
|
+
* @returns true if running in an unsupported browser extension environment
|
|
13
|
+
*/
|
|
14
|
+
export function isUnsupportedExtensionEnvironment(windowLocation: string, stack: string = '') {
|
|
15
|
+
// If the page itself is an extension page.
|
|
16
|
+
if (containsExtensionUrl(windowLocation)) {
|
|
17
|
+
return false
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Since we generate the error on the init, we check the 2nd frame line.
|
|
21
|
+
const frameLines = stack.split('\n').filter((line) => {
|
|
22
|
+
const trimmedLine = line.trim()
|
|
23
|
+
return trimmedLine.length && /^at\s+|@/.test(trimmedLine)
|
|
24
|
+
})
|
|
25
|
+
const target = frameLines[1] || ''
|
|
26
|
+
|
|
27
|
+
return containsExtensionUrl(target)
|
|
28
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type Site =
|
|
2
|
+
| 'datadoghq.com'
|
|
3
|
+
| 'us3.datadoghq.com'
|
|
4
|
+
| 'us5.datadoghq.com'
|
|
5
|
+
| 'datadoghq.eu'
|
|
6
|
+
| 'ddog-gov.com'
|
|
7
|
+
| 'ap1.datadoghq.com'
|
|
8
|
+
| 'ap2.datadoghq.com'
|
|
9
|
+
| (string & {})
|
|
10
|
+
|
|
11
|
+
export const INTAKE_SITE_STAGING: Site = 'datad0g.com'
|
|
12
|
+
export const INTAKE_SITE_FED_STAGING: Site = 'dd0g-gov.com'
|
|
13
|
+
export const INTAKE_SITE_US1: Site = 'datadoghq.com'
|
|
14
|
+
export const INTAKE_SITE_EU1: Site = 'datadoghq.eu'
|
|
15
|
+
export const INTAKE_SITE_US1_FED: Site = 'ddog-gov.com'
|
|
16
|
+
|
|
17
|
+
export const PCI_INTAKE_HOST_US1 = 'pci.browser-intake-datadoghq.com'
|
|
18
|
+
export const INTAKE_URL_PARAMETERS = ['ddsource', 'dd-api-key', 'dd-request-id']
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { toStackTraceString } from '
|
|
1
|
+
import { toStackTraceString } from '../../tools/stackTrace/handlingStack'
|
|
2
2
|
import { monitor } from '../../tools/monitor'
|
|
3
3
|
import { mergeObservables, Observable } from '../../tools/observable'
|
|
4
4
|
import { addEventListener, DOM_EVENT } from '../../browser/addEventListener'
|
|
5
|
-
import { includes } from '../../tools/utils/polyfills'
|
|
6
5
|
import { safeTruncate } from '../../tools/utils/stringUtils'
|
|
7
6
|
import type { Configuration } from '../configuration'
|
|
7
|
+
import type { RawError } from '../error/error.types'
|
|
8
|
+
import { ErrorHandling, ErrorSource } from '../error/error.types'
|
|
9
|
+
import { clocksNow } from '../../tools/utils/timeUtils'
|
|
8
10
|
import type { ReportType, InterventionReport, DeprecationReport } from './browser.types'
|
|
9
11
|
|
|
10
12
|
export const RawReportType = {
|
|
@@ -15,18 +17,14 @@ export const RawReportType = {
|
|
|
15
17
|
|
|
16
18
|
export type RawReportType = (typeof RawReportType)[keyof typeof RawReportType]
|
|
17
19
|
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
subtype: string
|
|
21
|
-
message: string
|
|
22
|
-
originalReport: SecurityPolicyViolationEvent | DeprecationReport | InterventionReport
|
|
23
|
-
stack?: string
|
|
20
|
+
export type RawReportError = RawError & {
|
|
21
|
+
originalError: SecurityPolicyViolationEvent | DeprecationReport | InterventionReport
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
export function initReportObservable(configuration: Configuration, apis: RawReportType[]) {
|
|
27
|
-
const observables: Array<Observable<
|
|
25
|
+
const observables: Array<Observable<RawReportError>> = []
|
|
28
26
|
|
|
29
|
-
if (includes(
|
|
27
|
+
if (apis.includes(RawReportType.cspViolation)) {
|
|
30
28
|
observables.push(createCspViolationReportObservable(configuration))
|
|
31
29
|
}
|
|
32
30
|
|
|
@@ -35,19 +33,17 @@ export function initReportObservable(configuration: Configuration, apis: RawRepo
|
|
|
35
33
|
observables.push(createReportObservable(reportTypes))
|
|
36
34
|
}
|
|
37
35
|
|
|
38
|
-
return mergeObservables
|
|
36
|
+
return mergeObservables(...observables)
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
function createReportObservable(reportTypes: ReportType[]) {
|
|
42
|
-
return new Observable<
|
|
40
|
+
return new Observable<RawReportError>((observable) => {
|
|
43
41
|
if (!window.ReportingObserver) {
|
|
44
42
|
return
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
const handleReports = monitor((reports: Array<DeprecationReport | InterventionReport>, _: ReportingObserver) =>
|
|
48
|
-
reports.forEach((report) =>
|
|
49
|
-
observable.notify(buildRawReportFromReport(report))
|
|
50
|
-
})
|
|
46
|
+
reports.forEach((report) => observable.notify(buildRawReportErrorFromReport(report)))
|
|
51
47
|
) as ReportingObserverCallback
|
|
52
48
|
|
|
53
49
|
const observer = new window.ReportingObserver(handleReports, {
|
|
@@ -63,34 +59,35 @@ function createReportObservable(reportTypes: ReportType[]) {
|
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
function createCspViolationReportObservable(configuration: Configuration) {
|
|
66
|
-
return new Observable<
|
|
62
|
+
return new Observable<RawReportError>((observable) => {
|
|
67
63
|
const { stop } = addEventListener(configuration, document, DOM_EVENT.SECURITY_POLICY_VIOLATION, (event) => {
|
|
68
|
-
observable.notify(
|
|
64
|
+
observable.notify(buildRawReportErrorFromCspViolation(event))
|
|
69
65
|
})
|
|
70
66
|
|
|
71
67
|
return stop
|
|
72
68
|
})
|
|
73
69
|
}
|
|
74
70
|
|
|
75
|
-
function
|
|
71
|
+
function buildRawReportErrorFromReport(report: DeprecationReport | InterventionReport): RawReportError {
|
|
76
72
|
const { type, body } = report
|
|
77
73
|
|
|
78
|
-
return {
|
|
79
|
-
type,
|
|
80
|
-
subtype: body.id,
|
|
74
|
+
return buildRawReportError({
|
|
75
|
+
type: body.id,
|
|
81
76
|
message: `${type}: ${body.message}`,
|
|
82
|
-
|
|
77
|
+
originalError: report,
|
|
83
78
|
stack: buildStack(body.id, body.message, body.sourceFile, body.lineNumber, body.columnNumber),
|
|
84
|
-
}
|
|
79
|
+
})
|
|
85
80
|
}
|
|
86
81
|
|
|
87
|
-
function
|
|
88
|
-
const type = RawReportType.cspViolation
|
|
82
|
+
function buildRawReportErrorFromCspViolation(event: SecurityPolicyViolationEvent): RawReportError {
|
|
89
83
|
const message = `'${event.blockedURI}' blocked by '${event.effectiveDirective}' directive`
|
|
90
|
-
return {
|
|
91
|
-
type:
|
|
92
|
-
|
|
93
|
-
|
|
84
|
+
return buildRawReportError({
|
|
85
|
+
type: event.effectiveDirective,
|
|
86
|
+
message: `${RawReportType.cspViolation}: ${message}`,
|
|
87
|
+
originalError: event,
|
|
88
|
+
csp: {
|
|
89
|
+
disposition: event.disposition,
|
|
90
|
+
},
|
|
94
91
|
stack: buildStack(
|
|
95
92
|
event.effectiveDirective,
|
|
96
93
|
event.originalPolicy
|
|
@@ -100,7 +97,15 @@ function buildRawReportFromCspViolation(event: SecurityPolicyViolationEvent): Ra
|
|
|
100
97
|
event.lineNumber,
|
|
101
98
|
event.columnNumber
|
|
102
99
|
),
|
|
103
|
-
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function buildRawReportError(partial: Omit<RawReportError, 'startClocks' | 'source' | 'handling'>): RawReportError {
|
|
104
|
+
return {
|
|
105
|
+
startClocks: clocksNow(),
|
|
106
|
+
source: ErrorSource.REPORT,
|
|
107
|
+
handling: ErrorHandling.UNHANDLED,
|
|
108
|
+
...partial,
|
|
104
109
|
}
|
|
105
110
|
}
|
|
106
111
|
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
export const
|
|
2
|
-
DOCUMENT
|
|
3
|
-
XHR
|
|
4
|
-
BEACON
|
|
5
|
-
FETCH
|
|
6
|
-
CSS
|
|
7
|
-
JS
|
|
8
|
-
IMAGE
|
|
9
|
-
FONT
|
|
10
|
-
MEDIA
|
|
11
|
-
OTHER
|
|
12
|
-
}
|
|
1
|
+
export const ResourceType = {
|
|
2
|
+
DOCUMENT: 'document',
|
|
3
|
+
XHR: 'xhr',
|
|
4
|
+
BEACON: 'beacon',
|
|
5
|
+
FETCH: 'fetch',
|
|
6
|
+
CSS: 'css',
|
|
7
|
+
JS: 'js',
|
|
8
|
+
IMAGE: 'image',
|
|
9
|
+
FONT: 'font',
|
|
10
|
+
MEDIA: 'media',
|
|
11
|
+
OTHER: 'other',
|
|
12
|
+
} as const
|
|
13
13
|
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
export type ResourceType = (typeof ResourceType)[keyof typeof ResourceType]
|
|
15
|
+
|
|
16
|
+
export const RequestType = {
|
|
17
|
+
FETCH: ResourceType.FETCH,
|
|
18
|
+
XHR: ResourceType.XHR,
|
|
19
|
+
} as const
|
|
20
|
+
|
|
21
|
+
export type RequestType = (typeof RequestType)[keyof typeof RequestType]
|