@openobserve/browser-core 0.2.11-rc1 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/boot/init.js +1 -1
- package/cjs/boot/init.js.map +1 -1
- package/cjs/browser/addEventListener.d.ts +4 -12
- package/cjs/browser/addEventListener.js +8 -50
- package/cjs/browser/addEventListener.js.map +1 -1
- package/cjs/browser/cookie.d.ts +0 -7
- package/cjs/browser/cookie.js +2 -19
- package/cjs/browser/cookie.js.map +1 -1
- package/cjs/browser/fetchObservable.js +19 -14
- package/cjs/browser/fetchObservable.js.map +1 -1
- package/cjs/browser/pageExitObservable.js +7 -6
- package/cjs/browser/pageExitObservable.js.map +1 -1
- package/cjs/browser/runOnReadyState.js +1 -1
- package/cjs/browser/runOnReadyState.js.map +1 -1
- package/cjs/browser/xhrObservable.d.ts +2 -1
- package/cjs/browser/xhrObservable.js +34 -26
- package/cjs/browser/xhrObservable.js.map +1 -1
- package/cjs/domain/configuration/configuration.d.ts +12 -17
- package/cjs/domain/configuration/configuration.js +9 -8
- package/cjs/domain/configuration/configuration.js.map +1 -1
- package/cjs/domain/configuration/endpointBuilder.d.ts +10 -6
- package/cjs/domain/configuration/endpointBuilder.js +33 -23
- package/cjs/domain/configuration/endpointBuilder.js.map +1 -1
- package/cjs/domain/configuration/index.d.ts +1 -2
- package/cjs/domain/configuration/index.js +1 -3
- package/cjs/domain/configuration/index.js.map +1 -1
- package/cjs/domain/configuration/tags.js.map +1 -1
- package/cjs/domain/configuration/transportConfiguration.js +1 -1
- package/cjs/domain/configuration/transportConfiguration.js.map +1 -1
- package/cjs/domain/console/consoleObservable.js +7 -4
- package/cjs/domain/console/consoleObservable.js.map +1 -1
- package/cjs/domain/deflate/index.d.ts +1 -0
- package/cjs/domain/{connectivity → deflate}/index.js +1 -1
- package/cjs/domain/deflate/index.js.map +1 -0
- package/cjs/domain/deflate/types.d.ts +26 -0
- package/cjs/domain/error/error.d.ts +1 -1
- package/cjs/domain/error/error.js +3 -3
- package/cjs/domain/error/error.js.map +1 -1
- package/cjs/domain/error/error.types.d.ts +2 -2
- package/cjs/domain/error/error.types.js.map +1 -1
- package/cjs/domain/error/trackRuntimeError.d.ts +0 -8
- package/cjs/domain/error/trackRuntimeError.js +6 -39
- package/cjs/domain/error/trackRuntimeError.js.map +1 -1
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -1
- package/cjs/domain/report/browser.types.d.ts +0 -10
- package/cjs/domain/report/reportObservable.d.ts +0 -2
- package/cjs/domain/report/reportObservable.js +7 -7
- package/cjs/domain/report/reportObservable.js.map +1 -1
- package/cjs/domain/session/oldCookiesMigration.js +4 -4
- package/cjs/domain/session/oldCookiesMigration.js.map +1 -1
- package/cjs/domain/session/sessionManager.js +2 -2
- package/cjs/domain/session/sessionManager.js.map +1 -1
- package/cjs/domain/session/sessionState.js.map +1 -1
- package/cjs/domain/session/sessionStore.js.map +1 -1
- package/cjs/domain/session/sessionStoreOperations.d.ts +5 -0
- package/cjs/domain/session/sessionStoreOperations.js +14 -6
- package/cjs/domain/session/sessionStoreOperations.js.map +1 -1
- package/cjs/domain/session/storeStrategies/sessionInCookie.js +2 -13
- package/cjs/domain/session/storeStrategies/sessionInCookie.js.map +1 -1
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js +0 -1
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -1
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.d.ts +0 -1
- package/cjs/domain/synthetics/syntheticsWorkerValues.js +3 -3
- package/cjs/domain/synthetics/syntheticsWorkerValues.js.map +1 -1
- package/cjs/domain/telemetry/rawTelemetryEvent.types.d.ts +0 -4
- package/cjs/domain/telemetry/telemetry.d.ts +1 -5
- package/cjs/domain/telemetry/telemetry.js +6 -17
- package/cjs/domain/telemetry/telemetry.js.map +1 -1
- package/cjs/domain/telemetry/telemetryEvent.types.d.ts +2 -18
- package/cjs/domain/tracekit/computeStackTrace.d.ts +5 -0
- package/cjs/domain/{error → tracekit}/computeStackTrace.js +4 -28
- package/cjs/domain/tracekit/computeStackTrace.js.map +1 -0
- package/cjs/domain/tracekit/index.d.ts +3 -0
- package/cjs/domain/tracekit/index.js +8 -0
- package/cjs/domain/tracekit/index.js.map +1 -0
- package/cjs/domain/tracekit/tracekit.d.ts +35 -0
- package/cjs/domain/tracekit/tracekit.js +95 -0
- package/cjs/domain/tracekit/tracekit.js.map +1 -0
- package/cjs/domain/tracekit/types.d.ts +44 -0
- package/cjs/domain/{context/contextConstants.js → tracekit/types.js} +1 -1
- package/cjs/domain/tracekit/types.js.map +1 -0
- package/cjs/domain/user/user.js.map +1 -1
- package/cjs/index.d.ts +63 -0
- package/cjs/index.js +155 -0
- package/cjs/index.js.map +1 -0
- package/cjs/tools/abstractLifeCycle.js.map +1 -1
- package/cjs/tools/boundedBuffer.js.map +1 -1
- package/cjs/tools/catchUserErrors.js.map +1 -1
- package/cjs/tools/display.d.ts +2 -2
- package/cjs/tools/display.js +17 -13
- package/cjs/tools/display.js.map +1 -1
- package/cjs/tools/experimentalFeatures.d.ts +5 -3
- package/cjs/tools/experimentalFeatures.js +4 -2
- package/cjs/tools/experimentalFeatures.js.map +1 -1
- package/cjs/tools/getGlobalObject.js.map +1 -1
- package/cjs/tools/getZoneJsOriginalValue.js.map +1 -1
- package/cjs/tools/instrumentMethod.d.ts +10 -50
- package/cjs/tools/instrumentMethod.js +36 -59
- package/cjs/tools/instrumentMethod.js.map +1 -1
- package/cjs/tools/matchOption.js.map +1 -1
- package/cjs/tools/mergeInto.js.map +1 -1
- package/cjs/tools/monitor.d.ts +2 -1
- package/cjs/tools/monitor.js +6 -6
- package/cjs/tools/monitor.js.map +1 -1
- package/cjs/tools/observable.d.ts +1 -1
- package/cjs/tools/observable.js +3 -2
- package/cjs/tools/observable.js.map +1 -1
- package/cjs/tools/readBytesFromStream.js.map +1 -1
- package/cjs/tools/sendToExtension.js.map +1 -1
- package/cjs/tools/serialisation/contextManager.d.ts +21 -0
- package/cjs/tools/serialisation/contextManager.js +70 -0
- package/cjs/tools/serialisation/contextManager.js.map +1 -0
- package/cjs/tools/serialisation/heavyCustomerDataWarning.d.ts +8 -0
- package/cjs/tools/serialisation/heavyCustomerDataWarning.js +18 -0
- package/cjs/tools/serialisation/heavyCustomerDataWarning.js.map +1 -0
- package/cjs/tools/serialisation/jsonStringify.d.ts +2 -1
- package/cjs/tools/serialisation/jsonStringify.js.map +1 -1
- package/cjs/tools/serialisation/sanitize.js.map +1 -1
- package/cjs/tools/utils/browserDetection.d.ts +0 -8
- package/cjs/tools/utils/browserDetection.js +3 -33
- package/cjs/tools/utils/browserDetection.js.map +1 -1
- package/cjs/tools/utils/byteUtils.js.map +1 -1
- package/cjs/tools/utils/functionUtils.js.map +1 -1
- package/cjs/tools/utils/objectUtils.js.map +1 -1
- package/cjs/tools/utils/polyfills.js.map +1 -1
- package/cjs/tools/utils/responseUtils.js.map +1 -1
- package/cjs/tools/utils/stringUtils.d.ts +0 -1
- package/cjs/tools/utils/stringUtils.js +4 -31
- package/cjs/tools/utils/stringUtils.js.map +1 -1
- package/cjs/tools/utils/timeUtils.js.map +1 -1
- package/cjs/tools/utils/typeUtils.js.map +1 -1
- package/cjs/tools/utils/urlPolyfill.js.map +1 -1
- package/cjs/tools/valueHistory.js.map +1 -1
- package/cjs/transport/batch.d.ts +3 -5
- package/cjs/transport/batch.js +29 -73
- package/cjs/transport/batch.js.map +1 -1
- package/cjs/transport/eventBridge.js.map +1 -1
- package/cjs/transport/flushController.d.ts +2 -12
- package/cjs/transport/flushController.js +7 -22
- package/cjs/transport/flushController.js.map +1 -1
- package/cjs/transport/httpRequest.d.ts +2 -3
- package/cjs/transport/httpRequest.js +17 -21
- package/cjs/transport/httpRequest.js.map +1 -1
- package/cjs/transport/sendWithRetryStrategy.d.ts +2 -2
- package/cjs/transport/sendWithRetryStrategy.js +9 -9
- package/cjs/transport/sendWithRetryStrategy.js.map +1 -1
- package/cjs/transport/startBatchWithReplica.d.ts +4 -9
- package/cjs/transport/startBatchWithReplica.js +4 -9
- package/cjs/transport/startBatchWithReplica.js.map +1 -1
- package/esm/boot/init.js +1 -1
- package/esm/boot/init.js.map +1 -1
- package/esm/browser/addEventListener.d.ts +4 -12
- package/esm/browser/addEventListener.js +7 -49
- package/esm/browser/addEventListener.js.map +1 -1
- package/esm/browser/cookie.d.ts +0 -7
- package/esm/browser/cookie.js +2 -17
- package/esm/browser/cookie.js.map +1 -1
- package/esm/browser/fetchObservable.js +20 -15
- package/esm/browser/fetchObservable.js.map +1 -1
- package/esm/browser/pageExitObservable.js +8 -7
- package/esm/browser/pageExitObservable.js.map +1 -1
- package/esm/browser/runOnReadyState.js +2 -2
- package/esm/browser/runOnReadyState.js.map +1 -1
- package/esm/browser/xhrObservable.d.ts +2 -1
- package/esm/browser/xhrObservable.js +36 -28
- package/esm/browser/xhrObservable.js.map +1 -1
- package/esm/domain/configuration/configuration.d.ts +12 -17
- package/esm/domain/configuration/configuration.js +9 -8
- package/esm/domain/configuration/configuration.js.map +1 -1
- package/esm/domain/configuration/endpointBuilder.d.ts +10 -6
- package/esm/domain/configuration/endpointBuilder.js +32 -22
- package/esm/domain/configuration/endpointBuilder.js.map +1 -1
- package/esm/domain/configuration/index.d.ts +1 -2
- package/esm/domain/configuration/index.js +0 -1
- package/esm/domain/configuration/index.js.map +1 -1
- package/esm/domain/configuration/tags.js.map +1 -1
- package/esm/domain/configuration/transportConfiguration.js +1 -1
- package/esm/domain/configuration/transportConfiguration.js.map +1 -1
- package/esm/domain/console/consoleObservable.js +5 -2
- package/esm/domain/console/consoleObservable.js.map +1 -1
- package/esm/domain/deflate/types.d.ts +0 -12
- package/esm/domain/error/error.d.ts +1 -1
- package/esm/domain/error/error.js +1 -1
- package/esm/domain/error/error.js.map +1 -1
- package/esm/domain/error/error.types.d.ts +2 -2
- package/esm/domain/error/error.types.js.map +1 -1
- package/esm/domain/error/trackRuntimeError.d.ts +0 -8
- package/esm/domain/error/trackRuntimeError.js +4 -35
- package/esm/domain/error/trackRuntimeError.js.map +1 -1
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -1
- package/esm/domain/report/browser.types.d.ts +0 -10
- package/esm/domain/report/reportObservable.d.ts +0 -2
- package/esm/domain/report/reportObservable.js +8 -8
- package/esm/domain/report/reportObservable.js.map +1 -1
- package/esm/domain/session/oldCookiesMigration.js +5 -5
- package/esm/domain/session/oldCookiesMigration.js.map +1 -1
- package/esm/domain/session/sessionManager.js +3 -3
- package/esm/domain/session/sessionManager.js.map +1 -1
- package/esm/domain/session/sessionState.js.map +1 -1
- package/esm/domain/session/sessionStore.js.map +1 -1
- package/esm/domain/session/sessionStoreOperations.d.ts +5 -0
- package/esm/domain/session/sessionStoreOperations.js +12 -5
- package/esm/domain/session/sessionStoreOperations.js.map +1 -1
- package/esm/domain/session/storeStrategies/sessionInCookie.js +2 -13
- package/esm/domain/session/storeStrategies/sessionInCookie.js.map +1 -1
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js +0 -1
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -1
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.d.ts +0 -1
- package/esm/domain/synthetics/syntheticsWorkerValues.js +4 -4
- package/esm/domain/synthetics/syntheticsWorkerValues.js.map +1 -1
- package/esm/domain/telemetry/rawTelemetryEvent.types.d.ts +0 -4
- package/esm/domain/telemetry/telemetry.d.ts +1 -5
- package/esm/domain/telemetry/telemetry.js +5 -16
- package/esm/domain/telemetry/telemetry.js.map +1 -1
- package/esm/domain/telemetry/telemetryEvent.types.d.ts +2 -18
- package/esm/domain/tracekit/computeStackTrace.d.ts +5 -0
- package/esm/domain/{error → tracekit}/computeStackTrace.js +3 -26
- package/esm/domain/tracekit/computeStackTrace.js.map +1 -0
- package/esm/domain/tracekit/index.d.ts +3 -0
- package/esm/domain/tracekit/index.js +3 -0
- package/esm/domain/tracekit/index.js.map +1 -0
- package/esm/domain/tracekit/tracekit.d.ts +35 -0
- package/esm/domain/tracekit/tracekit.js +91 -0
- package/esm/domain/tracekit/tracekit.js.map +1 -0
- package/esm/domain/tracekit/types.d.ts +44 -0
- package/esm/domain/tracekit/types.js +2 -0
- package/esm/domain/tracekit/types.js.map +1 -0
- package/esm/domain/user/user.js.map +1 -1
- package/esm/index.d.ts +5 -9
- package/esm/index.js +5 -8
- package/esm/index.js.map +1 -1
- package/esm/tools/abstractLifeCycle.js.map +1 -1
- package/esm/tools/boundedBuffer.js.map +1 -1
- package/esm/tools/catchUserErrors.js.map +1 -1
- package/esm/tools/display.d.ts +2 -2
- package/esm/tools/display.js +15 -12
- package/esm/tools/display.js.map +1 -1
- package/esm/tools/experimentalFeatures.d.ts +5 -3
- package/esm/tools/experimentalFeatures.js +4 -2
- package/esm/tools/experimentalFeatures.js.map +1 -1
- package/esm/tools/getGlobalObject.js.map +1 -1
- package/esm/tools/getZoneJsOriginalValue.js.map +1 -1
- package/esm/tools/instrumentMethod.d.ts +10 -50
- package/esm/tools/instrumentMethod.js +34 -58
- package/esm/tools/instrumentMethod.js.map +1 -1
- package/esm/tools/matchOption.js.map +1 -1
- package/esm/tools/mergeInto.js.map +1 -1
- package/esm/tools/monitor.d.ts +2 -1
- package/esm/tools/monitor.js +7 -7
- package/esm/tools/monitor.js.map +1 -1
- package/esm/tools/observable.d.ts +1 -1
- package/esm/tools/observable.js +3 -2
- package/esm/tools/observable.js.map +1 -1
- package/esm/tools/readBytesFromStream.js.map +1 -1
- package/esm/tools/sendToExtension.js.map +1 -1
- package/esm/tools/serialisation/contextManager.d.ts +21 -0
- package/esm/tools/serialisation/contextManager.js +66 -0
- package/esm/tools/serialisation/contextManager.js.map +1 -0
- package/esm/tools/serialisation/heavyCustomerDataWarning.d.ts +8 -0
- package/esm/tools/serialisation/heavyCustomerDataWarning.js +14 -0
- package/esm/tools/serialisation/heavyCustomerDataWarning.js.map +1 -0
- package/esm/tools/serialisation/jsonStringify.d.ts +2 -1
- package/esm/tools/serialisation/jsonStringify.js.map +1 -1
- package/esm/tools/serialisation/sanitize.js.map +1 -1
- package/esm/tools/utils/browserDetection.d.ts +0 -8
- package/esm/tools/utils/browserDetection.js +2 -30
- package/esm/tools/utils/browserDetection.js.map +1 -1
- package/esm/tools/utils/byteUtils.js.map +1 -1
- package/esm/tools/utils/functionUtils.js.map +1 -1
- package/esm/tools/utils/objectUtils.js.map +1 -1
- package/esm/tools/utils/polyfills.js.map +1 -1
- package/esm/tools/utils/responseUtils.js.map +1 -1
- package/esm/tools/utils/stringUtils.d.ts +0 -1
- package/esm/tools/utils/stringUtils.js +3 -29
- package/esm/tools/utils/stringUtils.js.map +1 -1
- package/esm/tools/utils/timeUtils.js.map +1 -1
- package/esm/tools/utils/typeUtils.js.map +1 -1
- package/esm/tools/utils/urlPolyfill.js.map +1 -1
- package/esm/tools/valueHistory.js.map +1 -1
- package/esm/transport/batch.d.ts +3 -5
- package/esm/transport/batch.js +29 -73
- package/esm/transport/batch.js.map +1 -1
- package/esm/transport/eventBridge.js.map +1 -1
- package/esm/transport/flushController.d.ts +2 -12
- package/esm/transport/flushController.js +7 -22
- package/esm/transport/flushController.js.map +1 -1
- package/esm/transport/httpRequest.d.ts +2 -3
- package/esm/transport/httpRequest.js +17 -21
- package/esm/transport/httpRequest.js.map +1 -1
- package/esm/transport/sendWithRetryStrategy.d.ts +2 -2
- package/esm/transport/sendWithRetryStrategy.js +9 -9
- package/esm/transport/sendWithRetryStrategy.js.map +1 -1
- package/esm/transport/startBatchWithReplica.d.ts +4 -9
- package/esm/transport/startBatchWithReplica.js +4 -9
- package/esm/transport/startBatchWithReplica.js.map +1 -1
- package/package.json +1 -1
- package/src/browser/addEventListener.ts +31 -37
- package/src/browser/cookie.ts +2 -21
- package/src/browser/fetchObservable.ts +25 -21
- package/src/browser/pageExitObservable.ts +3 -1
- package/src/browser/xhrObservable.ts +37 -31
- package/src/domain/configuration/configuration.ts +22 -24
- package/src/domain/configuration/endpointBuilder.ts +46 -33
- package/src/domain/configuration/index.ts +1 -2
- package/src/domain/configuration/transportConfiguration.ts +1 -1
- package/src/domain/console/consoleObservable.ts +7 -3
- package/src/domain/deflate/types.ts +0 -14
- package/src/domain/error/error.ts +2 -2
- package/src/domain/error/error.types.ts +2 -11
- package/src/domain/error/trackRuntimeError.ts +12 -44
- package/src/domain/report/browser.types.ts +0 -12
- package/src/domain/report/reportObservable.ts +6 -8
- package/src/domain/session/oldCookiesMigration.ts +5 -5
- package/src/domain/session/sessionStoreOperations.ts +13 -5
- package/src/domain/session/storeStrategies/sessionInCookie.ts +2 -13
- package/src/domain/session/storeStrategies/sessionInLocalStorage.ts +0 -1
- package/src/domain/session/storeStrategies/sessionStoreStrategy.ts +0 -1
- package/src/domain/synthetics/syntheticsWorkerValues.ts +4 -4
- package/src/domain/telemetry/rawTelemetryEvent.types.ts +0 -5
- package/src/domain/telemetry/telemetry.ts +7 -22
- package/src/domain/telemetry/telemetryEvent.types.ts +2 -18
- package/src/domain/{error → tracekit}/computeStackTrace.ts +4 -49
- package/src/domain/tracekit/index.ts +3 -0
- package/src/domain/tracekit/tracekit.ts +96 -0
- package/src/domain/tracekit/types.ts +47 -0
- package/src/index.ts +7 -13
- package/src/tools/display.ts +13 -14
- package/src/tools/experimentalFeatures.ts +4 -2
- package/src/tools/instrumentMethod.ts +59 -103
- package/src/tools/mergeInto.ts +16 -16
- package/src/tools/monitor.ts +5 -5
- package/src/tools/observable.ts +5 -3
- package/src/tools/serialisation/contextManager.ts +79 -0
- package/src/tools/serialisation/heavyCustomerDataWarning.ts +26 -0
- package/src/tools/utils/browserDetection.ts +2 -43
- package/src/tools/utils/polyfills.ts +4 -1
- package/src/tools/utils/stringUtils.ts +4 -30
- package/src/transport/batch.ts +31 -86
- package/src/transport/flushController.ts +7 -22
- package/src/transport/httpRequest.ts +16 -23
- package/src/transport/sendWithRetryStrategy.ts +10 -10
- package/src/transport/startBatchWithReplica.ts +6 -22
- package/cjs/domain/connectivity/connectivity.d.ts +0 -13
- package/cjs/domain/connectivity/connectivity.js +0 -14
- package/cjs/domain/connectivity/connectivity.js.map +0 -1
- package/cjs/domain/connectivity/index.d.ts +0 -1
- package/cjs/domain/connectivity/index.js.map +0 -1
- package/cjs/domain/context/contextConstants.d.ts +0 -5
- package/cjs/domain/context/contextConstants.js.map +0 -1
- package/cjs/domain/context/contextManager.d.ts +0 -12
- package/cjs/domain/context/contextManager.js +0 -43
- package/cjs/domain/context/contextManager.js.map +0 -1
- package/cjs/domain/context/customerDataTracker.d.ts +0 -45
- package/cjs/domain/context/customerDataTracker.js +0 -107
- package/cjs/domain/context/customerDataTracker.js.map +0 -1
- package/cjs/domain/context/storeContextManager.d.ts +0 -6
- package/cjs/domain/context/storeContextManager.js +0 -38
- package/cjs/domain/context/storeContextManager.js.map +0 -1
- package/cjs/domain/error/computeStackTrace.d.ts +0 -33
- package/cjs/domain/error/computeStackTrace.js.map +0 -1
- package/cjs/tools/encoder.d.ts +0 -53
- package/cjs/tools/encoder.js +0 -41
- package/cjs/tools/encoder.js.map +0 -1
- package/esm/domain/connectivity/connectivity.d.ts +0 -13
- package/esm/domain/connectivity/connectivity.js +0 -10
- package/esm/domain/connectivity/connectivity.js.map +0 -1
- package/esm/domain/connectivity/index.d.ts +0 -1
- package/esm/domain/connectivity/index.js +0 -2
- package/esm/domain/connectivity/index.js.map +0 -1
- package/esm/domain/context/contextConstants.d.ts +0 -5
- package/esm/domain/context/contextConstants.js +0 -2
- package/esm/domain/context/contextConstants.js.map +0 -1
- package/esm/domain/context/contextManager.d.ts +0 -12
- package/esm/domain/context/contextManager.js +0 -39
- package/esm/domain/context/contextManager.js.map +0 -1
- package/esm/domain/context/customerDataTracker.d.ts +0 -45
- package/esm/domain/context/customerDataTracker.js +0 -102
- package/esm/domain/context/customerDataTracker.js.map +0 -1
- package/esm/domain/context/storeContextManager.d.ts +0 -6
- package/esm/domain/context/storeContextManager.js +0 -32
- package/esm/domain/context/storeContextManager.js.map +0 -1
- package/esm/domain/error/computeStackTrace.d.ts +0 -33
- package/esm/domain/error/computeStackTrace.js.map +0 -1
- package/esm/tools/encoder.d.ts +0 -53
- package/esm/tools/encoder.js +0 -37
- package/esm/tools/encoder.js.map +0 -1
- package/src/domain/connectivity/connectivity.ts +0 -27
- package/src/domain/connectivity/index.ts +0 -1
- package/src/domain/context/contextConstants.ts +0 -5
- package/src/domain/context/contextManager.ts +0 -48
- package/src/domain/context/customerDataTracker.ts +0 -134
- package/src/domain/context/storeContextManager.ts +0 -51
- package/src/tools/encoder.ts +0 -102
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cross-browser stack trace computation.
|
|
3
|
-
*
|
|
4
|
-
* Reference implementation: https://github.com/csnover/TraceKit/blob/04530298073c3823de72deb0b97e7b38ca7bcb59/tracekit.js
|
|
5
|
-
*/
|
|
6
|
-
export interface StackFrame {
|
|
7
|
-
url?: string;
|
|
8
|
-
func?: string;
|
|
9
|
-
/** The arguments passed to the function, if known. */
|
|
10
|
-
args?: string[];
|
|
11
|
-
line?: number;
|
|
12
|
-
column?: number;
|
|
13
|
-
/** An array of source code lines; the middle element corresponds to the correct line. */
|
|
14
|
-
context?: string[];
|
|
15
|
-
}
|
|
16
|
-
export interface StackTrace {
|
|
17
|
-
name?: string;
|
|
18
|
-
message?: string;
|
|
19
|
-
url?: string;
|
|
20
|
-
stack: StackFrame[];
|
|
21
|
-
incomplete?: boolean;
|
|
22
|
-
partial?: boolean;
|
|
23
|
-
}
|
|
24
|
-
export declare function computeStackTrace(ex: unknown): StackTrace;
|
|
25
|
-
export declare function computeStackTraceFromOnErrorMessage(messageObj: unknown, url?: string, line?: number, column?: number): {
|
|
26
|
-
name: string | undefined;
|
|
27
|
-
message: string | undefined;
|
|
28
|
-
stack: {
|
|
29
|
-
url: string | undefined;
|
|
30
|
-
column: number | undefined;
|
|
31
|
-
line: number | undefined;
|
|
32
|
-
}[];
|
|
33
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"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E,EAA3D,IAAI,QAAA,EAAE,OAAO,QAAA,CAA8C;IACjE,CAAC;IACD,OAAO,EAAE,IAAI,MAAA,EAAE,OAAO,SAAA,EAAE,CAAA;AAC1B,CAAC"}
|
package/esm/tools/encoder.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
export interface Encoder<Output extends string | Uint8Array = string | Uint8Array> {
|
|
2
|
-
/**
|
|
3
|
-
* Whether this encoder might call the provided callbacks asynchronously
|
|
4
|
-
*/
|
|
5
|
-
isAsync: boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Whether some data has been written since the last finish() or finishSync() call
|
|
8
|
-
*/
|
|
9
|
-
isEmpty: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Write a string to be encoded.
|
|
12
|
-
*
|
|
13
|
-
* This operation can be synchronous or asynchronous depending on the encoder implementation.
|
|
14
|
-
*
|
|
15
|
-
* If specified, the callback will be invoked when the operation finishes, unless the operation is
|
|
16
|
-
* asynchronous and finish() or finishSync() is called in the meantime.
|
|
17
|
-
*/
|
|
18
|
-
write(data: string, callback?: (additionalEncodedBytesCount: number) => void): void;
|
|
19
|
-
/**
|
|
20
|
-
* Waits for pending data to be encoded and resets the encoder state.
|
|
21
|
-
*
|
|
22
|
-
* This operation can be synchronous or asynchronous depending on the encoder implementation.
|
|
23
|
-
*
|
|
24
|
-
* The callback will be invoked when the operation finishes, unless the operation is asynchronous
|
|
25
|
-
* and another call to finish() or finishSync() occurs in the meantime.
|
|
26
|
-
*/
|
|
27
|
-
finish(callback: (result: EncoderResult<Output>) => void): void;
|
|
28
|
-
/**
|
|
29
|
-
* Resets the encoder state then returns the encoded data and any potential pending data directly,
|
|
30
|
-
* discarding all pending write operations and finish() callbacks.
|
|
31
|
-
*/
|
|
32
|
-
finishSync(): EncoderResult<Output> & {
|
|
33
|
-
pendingData: string;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Returns a rough estimation of the bytes count if the data was encoded.
|
|
37
|
-
*/
|
|
38
|
-
estimateEncodedBytesCount(data: string): number;
|
|
39
|
-
}
|
|
40
|
-
export interface EncoderResult<Output extends string | Uint8Array = string | Uint8Array> {
|
|
41
|
-
output: Output;
|
|
42
|
-
outputBytesCount: number;
|
|
43
|
-
/**
|
|
44
|
-
* An encoding type supported by HTTP Content-Encoding, if applicable.
|
|
45
|
-
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding#directives
|
|
46
|
-
*/
|
|
47
|
-
encoding?: 'deflate';
|
|
48
|
-
/**
|
|
49
|
-
* Total bytes count of the input strings encoded to UTF-8.
|
|
50
|
-
*/
|
|
51
|
-
rawBytesCount: number;
|
|
52
|
-
}
|
|
53
|
-
export declare function createIdentityEncoder(): Encoder<string>;
|
package/esm/tools/encoder.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { computeBytesCount } from './utils/byteUtils';
|
|
2
|
-
export function createIdentityEncoder() {
|
|
3
|
-
var output = '';
|
|
4
|
-
var outputBytesCount = 0;
|
|
5
|
-
return {
|
|
6
|
-
isAsync: false,
|
|
7
|
-
get isEmpty() {
|
|
8
|
-
return !output;
|
|
9
|
-
},
|
|
10
|
-
write: function (data, callback) {
|
|
11
|
-
var additionalEncodedBytesCount = computeBytesCount(data);
|
|
12
|
-
outputBytesCount += additionalEncodedBytesCount;
|
|
13
|
-
output += data;
|
|
14
|
-
if (callback) {
|
|
15
|
-
callback(additionalEncodedBytesCount);
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
finish: function (callback) {
|
|
19
|
-
callback(this.finishSync());
|
|
20
|
-
},
|
|
21
|
-
finishSync: function () {
|
|
22
|
-
var result = {
|
|
23
|
-
output: output,
|
|
24
|
-
outputBytesCount: outputBytesCount,
|
|
25
|
-
rawBytesCount: outputBytesCount,
|
|
26
|
-
pendingData: '',
|
|
27
|
-
};
|
|
28
|
-
output = '';
|
|
29
|
-
outputBytesCount = 0;
|
|
30
|
-
return result;
|
|
31
|
-
},
|
|
32
|
-
estimateEncodedBytesCount: function (data) {
|
|
33
|
-
return data.length;
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=encoder.js.map
|
package/esm/tools/encoder.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encoder.js","sourceRoot":"","sources":["../../src/tools/encoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AA6DrD,MAAM,UAAU,qBAAqB;IACnC,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,IAAI,gBAAgB,GAAG,CAAC,CAAA;IAExB,OAAO;QACL,OAAO,EAAE,KAAK;QAEd,IAAI,OAAO;YACT,OAAO,CAAC,MAAM,CAAA;QAChB,CAAC;QAED,KAAK,YAAC,IAAI,EAAE,QAAQ;YAClB,IAAM,2BAA2B,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAA;YAC3D,gBAAgB,IAAI,2BAA2B,CAAA;YAC/C,MAAM,IAAI,IAAI,CAAA;YACd,IAAI,QAAQ,EAAE,CAAC;gBACb,QAAQ,CAAC,2BAA2B,CAAC,CAAA;YACvC,CAAC;QACH,CAAC;QAED,MAAM,YAAC,QAAQ;YACb,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;QAC7B,CAAC;QAED,UAAU;YACR,IAAM,MAAM,GAAG;gBACb,MAAM,QAAA;gBACN,gBAAgB,kBAAA;gBAChB,aAAa,EAAE,gBAAgB;gBAC/B,WAAW,EAAE,EAAE;aAChB,CAAA;YACD,MAAM,GAAG,EAAE,CAAA;YACX,gBAAgB,GAAG,CAAC,CAAA;YACpB,OAAO,MAAM,CAAA;QACf,CAAC;QAED,yBAAyB,YAAC,IAAI;YAC5B,OAAO,IAAI,CAAC,MAAM,CAAA;QACpB,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export type NetworkInterface = 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other' | 'unknown'
|
|
2
|
-
export type EffectiveType = 'slow-2g' | '2g' | '3g' | '4g'
|
|
3
|
-
|
|
4
|
-
interface BrowserNavigator extends Navigator {
|
|
5
|
-
connection?: NetworkInformation
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface NetworkInformation {
|
|
9
|
-
type?: NetworkInterface
|
|
10
|
-
effectiveType?: EffectiveType
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface Connectivity {
|
|
14
|
-
status: 'connected' | 'not_connected'
|
|
15
|
-
interfaces?: NetworkInterface[]
|
|
16
|
-
effective_type?: EffectiveType
|
|
17
|
-
[key: string]: unknown
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function getConnectivity(): Connectivity {
|
|
21
|
-
const navigator = window.navigator as BrowserNavigator
|
|
22
|
-
return {
|
|
23
|
-
status: navigator.onLine ? 'connected' : 'not_connected',
|
|
24
|
-
interfaces: navigator.connection && navigator.connection.type ? [navigator.connection.type] : undefined,
|
|
25
|
-
effective_type: navigator.connection?.effectiveType,
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './connectivity'
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { deepClone } from '../../tools/mergeInto'
|
|
2
|
-
import { getType } from '../../tools/utils/typeUtils'
|
|
3
|
-
import { sanitize } from '../../tools/serialisation/sanitize'
|
|
4
|
-
import type { Context } from '../../tools/serialisation/context'
|
|
5
|
-
import { Observable } from '../../tools/observable'
|
|
6
|
-
import type { CustomerDataTracker } from './customerDataTracker'
|
|
7
|
-
|
|
8
|
-
export type ContextManager = ReturnType<typeof createContextManager>
|
|
9
|
-
|
|
10
|
-
export function createContextManager(customerDataTracker: CustomerDataTracker) {
|
|
11
|
-
let context: Context = {}
|
|
12
|
-
const changeObservable = new Observable<void>()
|
|
13
|
-
|
|
14
|
-
const contextManager = {
|
|
15
|
-
getContext: () => deepClone(context),
|
|
16
|
-
|
|
17
|
-
setContext: (newContext: Context) => {
|
|
18
|
-
if (getType(newContext) === 'object') {
|
|
19
|
-
context = sanitize(newContext)
|
|
20
|
-
customerDataTracker.updateCustomerData(context)
|
|
21
|
-
} else {
|
|
22
|
-
contextManager.clearContext()
|
|
23
|
-
}
|
|
24
|
-
changeObservable.notify()
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
setContextProperty: (key: string, property: any) => {
|
|
28
|
-
context[key] = sanitize(property)
|
|
29
|
-
customerDataTracker.updateCustomerData(context)
|
|
30
|
-
changeObservable.notify()
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
removeContextProperty: (key: string) => {
|
|
34
|
-
delete context[key]
|
|
35
|
-
customerDataTracker.updateCustomerData(context)
|
|
36
|
-
changeObservable.notify()
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
clearContext: () => {
|
|
40
|
-
context = {}
|
|
41
|
-
customerDataTracker.resetCustomerData()
|
|
42
|
-
changeObservable.notify()
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
changeObservable,
|
|
46
|
-
}
|
|
47
|
-
return contextManager
|
|
48
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { ONE_KIBI_BYTE, computeBytesCount } from '../../tools/utils/byteUtils'
|
|
2
|
-
import { throttle } from '../../tools/utils/functionUtils'
|
|
3
|
-
import type { Context } from '../../tools/serialisation/context'
|
|
4
|
-
import { jsonStringify } from '../../tools/serialisation/jsonStringify'
|
|
5
|
-
import { display } from '../../tools/display'
|
|
6
|
-
import { isEmptyObject } from '../../tools/utils/objectUtils'
|
|
7
|
-
import type { CustomerDataType } from './contextConstants'
|
|
8
|
-
|
|
9
|
-
// RUM and logs batch bytes limit is 16KB
|
|
10
|
-
// ensure that we leave room for other event attributes and maintain a decent amount of event per batch
|
|
11
|
-
// (3KB (customer data) + 1KB (other attributes)) * 4 (events per batch) = 16KB
|
|
12
|
-
export const CUSTOMER_DATA_BYTES_LIMIT = 3 * ONE_KIBI_BYTE
|
|
13
|
-
|
|
14
|
-
// We observed that the compression ratio is around 8 in general, but we also want to keep a margin
|
|
15
|
-
// because some data might not be compressed (ex: last view update on page exit). We chose 16KiB
|
|
16
|
-
// because it is also the limit of the 'batchBytesCount' that we use for RUM and Logs data, but this
|
|
17
|
-
// is a bit arbitrary.
|
|
18
|
-
export const CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT = 16 * ONE_KIBI_BYTE
|
|
19
|
-
|
|
20
|
-
export const BYTES_COMPUTATION_THROTTLING_DELAY = 200
|
|
21
|
-
|
|
22
|
-
export type CustomerDataTracker = ReturnType<typeof createCustomerDataTracker>
|
|
23
|
-
export type CustomerDataTrackerManager = ReturnType<typeof createCustomerDataTrackerManager>
|
|
24
|
-
|
|
25
|
-
export const enum CustomerDataCompressionStatus {
|
|
26
|
-
Unknown,
|
|
27
|
-
Enabled,
|
|
28
|
-
Disabled,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function createCustomerDataTrackerManager(
|
|
32
|
-
compressionStatus: CustomerDataCompressionStatus = CustomerDataCompressionStatus.Disabled
|
|
33
|
-
) {
|
|
34
|
-
const customerDataTrackers = new Map<CustomerDataType, CustomerDataTracker>()
|
|
35
|
-
|
|
36
|
-
let alreadyWarned = false
|
|
37
|
-
function checkCustomerDataLimit(initialBytesCount = 0) {
|
|
38
|
-
if (alreadyWarned || compressionStatus === CustomerDataCompressionStatus.Unknown) {
|
|
39
|
-
return
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const bytesCountLimit =
|
|
43
|
-
compressionStatus === CustomerDataCompressionStatus.Disabled
|
|
44
|
-
? CUSTOMER_DATA_BYTES_LIMIT
|
|
45
|
-
: CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT
|
|
46
|
-
|
|
47
|
-
let bytesCount = initialBytesCount
|
|
48
|
-
customerDataTrackers.forEach((tracker) => {
|
|
49
|
-
bytesCount += tracker.getBytesCount()
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
if (bytesCount > bytesCountLimit) {
|
|
53
|
-
displayCustomerDataLimitReachedWarning(bytesCountLimit)
|
|
54
|
-
alreadyWarned = true
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
/**
|
|
60
|
-
* Creates a detached tracker. The manager will not store a reference to that tracker, and the
|
|
61
|
-
* bytes count will be counted independently from other detached trackers.
|
|
62
|
-
*
|
|
63
|
-
* This is particularly useful when we don't know when the tracker will be unused, so we don't
|
|
64
|
-
* leak memory (ex: when used in Logger instances).
|
|
65
|
-
*/
|
|
66
|
-
createDetachedTracker: () => {
|
|
67
|
-
const tracker = createCustomerDataTracker(() => checkCustomerDataLimit(tracker.getBytesCount()))
|
|
68
|
-
return tracker
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Creates a tracker if it doesn't exist, and returns it.
|
|
73
|
-
*/
|
|
74
|
-
getOrCreateTracker: (type: CustomerDataType) => {
|
|
75
|
-
if (!customerDataTrackers.has(type)) {
|
|
76
|
-
customerDataTrackers.set(type, createCustomerDataTracker(checkCustomerDataLimit))
|
|
77
|
-
}
|
|
78
|
-
return customerDataTrackers.get(type)!
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
setCompressionStatus: (newCompressionStatus: CustomerDataCompressionStatus) => {
|
|
82
|
-
if (compressionStatus === CustomerDataCompressionStatus.Unknown) {
|
|
83
|
-
compressionStatus = newCompressionStatus
|
|
84
|
-
checkCustomerDataLimit()
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
getCompressionStatus: () => compressionStatus,
|
|
89
|
-
|
|
90
|
-
stop: () => {
|
|
91
|
-
customerDataTrackers.forEach((tracker) => tracker.stop())
|
|
92
|
-
customerDataTrackers.clear()
|
|
93
|
-
},
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function createCustomerDataTracker(checkCustomerDataLimit: () => void) {
|
|
98
|
-
let bytesCountCache = 0
|
|
99
|
-
|
|
100
|
-
// Throttle the bytes computation to minimize the impact on performance.
|
|
101
|
-
// Especially useful if the user call context APIs synchronously multiple times in a row
|
|
102
|
-
const { throttled: computeBytesCountThrottled, cancel: cancelComputeBytesCount } = throttle((context: Context) => {
|
|
103
|
-
bytesCountCache = computeBytesCount(jsonStringify(context)!)
|
|
104
|
-
checkCustomerDataLimit()
|
|
105
|
-
}, BYTES_COMPUTATION_THROTTLING_DELAY)
|
|
106
|
-
|
|
107
|
-
const resetBytesCount = () => {
|
|
108
|
-
cancelComputeBytesCount()
|
|
109
|
-
bytesCountCache = 0
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return {
|
|
113
|
-
updateCustomerData: (context: Context) => {
|
|
114
|
-
if (isEmptyObject(context)) {
|
|
115
|
-
resetBytesCount()
|
|
116
|
-
} else {
|
|
117
|
-
computeBytesCountThrottled(context)
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
resetCustomerData: resetBytesCount,
|
|
121
|
-
getBytesCount: () => bytesCountCache,
|
|
122
|
-
stop: () => {
|
|
123
|
-
cancelComputeBytesCount()
|
|
124
|
-
},
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function displayCustomerDataLimitReachedWarning(bytesCountLimit: number) {
|
|
129
|
-
display.warn(
|
|
130
|
-
`Customer data exceeds the recommended ${
|
|
131
|
-
bytesCountLimit / ONE_KIBI_BYTE
|
|
132
|
-
}KiB threshold. More details: https://docs.datadoghq.com/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-threshold-warning`
|
|
133
|
-
)
|
|
134
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { addEventListener, DOM_EVENT } from '../../browser/addEventListener'
|
|
2
|
-
import type { Context } from '../../tools/serialisation/context'
|
|
3
|
-
import type { Configuration } from '../configuration'
|
|
4
|
-
import { combine } from '../../tools/mergeInto'
|
|
5
|
-
import type { ContextManager } from './contextManager'
|
|
6
|
-
import type { CustomerDataType } from './contextConstants'
|
|
7
|
-
|
|
8
|
-
const CONTEXT_STORE_KEY_PREFIX = '_oo_c'
|
|
9
|
-
|
|
10
|
-
const storageListeners: Array<{ stop: () => void }> = []
|
|
11
|
-
|
|
12
|
-
export function storeContextManager(
|
|
13
|
-
configuration: Configuration,
|
|
14
|
-
contextManager: ContextManager,
|
|
15
|
-
productKey: string,
|
|
16
|
-
customerDataType: CustomerDataType
|
|
17
|
-
) {
|
|
18
|
-
const storageKey = buildStorageKey(productKey, customerDataType)
|
|
19
|
-
|
|
20
|
-
storageListeners.push(
|
|
21
|
-
addEventListener(configuration, window, DOM_EVENT.STORAGE, ({ key }) => {
|
|
22
|
-
if (storageKey === key) {
|
|
23
|
-
synchronizeWithStorage()
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
)
|
|
27
|
-
contextManager.changeObservable.subscribe(dumpToStorage)
|
|
28
|
-
|
|
29
|
-
contextManager.setContext(combine(getFromStorage(), contextManager.getContext()))
|
|
30
|
-
|
|
31
|
-
function synchronizeWithStorage() {
|
|
32
|
-
contextManager.setContext(getFromStorage())
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function dumpToStorage() {
|
|
36
|
-
localStorage.setItem(storageKey, JSON.stringify(contextManager.getContext()))
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function getFromStorage() {
|
|
40
|
-
const rawContext = localStorage.getItem(storageKey)
|
|
41
|
-
return rawContext !== null ? (JSON.parse(rawContext) as Context) : {}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function buildStorageKey(productKey: string, customerDataType: CustomerDataType) {
|
|
46
|
-
return `${CONTEXT_STORE_KEY_PREFIX}_${productKey}_${customerDataType}`
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function removeStorageListeners() {
|
|
50
|
-
storageListeners.map((listener) => listener.stop())
|
|
51
|
-
}
|
package/src/tools/encoder.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { computeBytesCount } from './utils/byteUtils'
|
|
2
|
-
|
|
3
|
-
export interface Encoder<Output extends string | Uint8Array = string | Uint8Array> {
|
|
4
|
-
/**
|
|
5
|
-
* Whether this encoder might call the provided callbacks asynchronously
|
|
6
|
-
*/
|
|
7
|
-
isAsync: boolean
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Whether some data has been written since the last finish() or finishSync() call
|
|
11
|
-
*/
|
|
12
|
-
isEmpty: boolean
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Write a string to be encoded.
|
|
16
|
-
*
|
|
17
|
-
* This operation can be synchronous or asynchronous depending on the encoder implementation.
|
|
18
|
-
*
|
|
19
|
-
* If specified, the callback will be invoked when the operation finishes, unless the operation is
|
|
20
|
-
* asynchronous and finish() or finishSync() is called in the meantime.
|
|
21
|
-
*/
|
|
22
|
-
write(data: string, callback?: (additionalEncodedBytesCount: number) => void): void
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Waits for pending data to be encoded and resets the encoder state.
|
|
26
|
-
*
|
|
27
|
-
* This operation can be synchronous or asynchronous depending on the encoder implementation.
|
|
28
|
-
*
|
|
29
|
-
* The callback will be invoked when the operation finishes, unless the operation is asynchronous
|
|
30
|
-
* and another call to finish() or finishSync() occurs in the meantime.
|
|
31
|
-
*/
|
|
32
|
-
finish(callback: (result: EncoderResult<Output>) => void): void
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Resets the encoder state then returns the encoded data and any potential pending data directly,
|
|
36
|
-
* discarding all pending write operations and finish() callbacks.
|
|
37
|
-
*/
|
|
38
|
-
finishSync(): EncoderResult<Output> & { pendingData: string }
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Returns a rough estimation of the bytes count if the data was encoded.
|
|
42
|
-
*/
|
|
43
|
-
estimateEncodedBytesCount(data: string): number
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface EncoderResult<Output extends string | Uint8Array = string | Uint8Array> {
|
|
47
|
-
output: Output
|
|
48
|
-
outputBytesCount: number
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* An encoding type supported by HTTP Content-Encoding, if applicable.
|
|
52
|
-
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding#directives
|
|
53
|
-
*/
|
|
54
|
-
encoding?: 'deflate'
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Total bytes count of the input strings encoded to UTF-8.
|
|
58
|
-
*/
|
|
59
|
-
rawBytesCount: number
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export function createIdentityEncoder(): Encoder<string> {
|
|
63
|
-
let output = ''
|
|
64
|
-
let outputBytesCount = 0
|
|
65
|
-
|
|
66
|
-
return {
|
|
67
|
-
isAsync: false,
|
|
68
|
-
|
|
69
|
-
get isEmpty() {
|
|
70
|
-
return !output
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
write(data, callback) {
|
|
74
|
-
const additionalEncodedBytesCount = computeBytesCount(data)
|
|
75
|
-
outputBytesCount += additionalEncodedBytesCount
|
|
76
|
-
output += data
|
|
77
|
-
if (callback) {
|
|
78
|
-
callback(additionalEncodedBytesCount)
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
finish(callback) {
|
|
83
|
-
callback(this.finishSync())
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
finishSync() {
|
|
87
|
-
const result = {
|
|
88
|
-
output,
|
|
89
|
-
outputBytesCount,
|
|
90
|
-
rawBytesCount: outputBytesCount,
|
|
91
|
-
pendingData: '',
|
|
92
|
-
}
|
|
93
|
-
output = ''
|
|
94
|
-
outputBytesCount = 0
|
|
95
|
-
return result
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
estimateEncodedBytesCount(data) {
|
|
99
|
-
return data.length
|
|
100
|
-
},
|
|
101
|
-
}
|
|
102
|
-
}
|