@openobserve/browser-core 0.2.11 → 0.2.12-beta.4
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 +44 -35
- package/src/browser/{types.ts → browser.types.ts} +42 -0
- package/src/browser/cookie.ts +69 -15
- package/src/browser/fetchObservable.ts +97 -42
- package/src/browser/{pageExitObservable.ts → pageMayExitObservable.ts} +11 -24
- package/src/browser/runOnReadyState.ts +14 -4
- package/src/browser/xhrObservable.ts +45 -38
- package/src/domain/allowedTrackingOrigins.ts +30 -0
- package/src/domain/bufferedData.ts +32 -0
- package/src/domain/configuration/configuration.ts +366 -95
- package/src/domain/configuration/endpointBuilder.ts +48 -64
- package/src/domain/configuration/index.ts +6 -4
- package/src/domain/configuration/transportConfiguration.ts +42 -35
- package/src/domain/connectivity/connectivity.ts +31 -0
- package/src/domain/connectivity/index.ts +1 -0
- package/src/domain/console/consoleObservable.ts +59 -27
- package/src/domain/context/contextConstants.ts +27 -0
- package/src/domain/context/contextManager.ts +85 -0
- package/src/domain/context/contextUtils.ts +14 -0
- package/src/domain/context/defineContextMethod.ts +31 -0
- package/src/domain/context/storeContextManager.ts +55 -0
- 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} +18 -2
- package/src/domain/deflate/index.ts +1 -1
- package/src/domain/error/error.ts +28 -84
- package/src/domain/error/error.types.ts +21 -4
- package/src/domain/error/trackRuntimeError.ts +37 -8
- 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/browser.types.ts +12 -0
- package/src/domain/report/reportObservable.ts +37 -30
- package/src/domain/resourceUtils.ts +20 -16
- package/src/domain/session/README.md +193 -0
- package/src/domain/session/oldCookiesMigration.ts +7 -7
- 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 +51 -32
- package/src/domain/session/storeStrategies/sessionInCookie.ts +113 -23
- package/src/domain/session/storeStrategies/sessionInLocalStorage.ts +11 -8
- package/src/domain/session/storeStrategies/sessionStoreStrategy.ts +6 -2
- package/src/domain/synthetics/syntheticsWorkerValues.ts +15 -4
- package/src/domain/tags.ts +76 -0
- package/src/domain/telemetry/index.ts +12 -4
- package/src/domain/telemetry/rawTelemetryEvent.types.ts +11 -3
- package/src/domain/telemetry/telemetry.ts +242 -98
- package/src/domain/telemetry/telemetryEvent.types.ts +530 -5
- package/src/domain/trackingConsent.ts +34 -0
- package/src/index.ts +92 -55
- 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 +18 -13
- package/src/tools/encoder.ts +103 -0
- package/src/tools/experimentalFeatures.ts +18 -9
- package/src/tools/getZoneJsOriginalValue.ts +1 -1
- package/src/tools/{getGlobalObject.ts → globalObject.ts} +20 -0
- package/src/tools/instrumentMethod.ts +127 -66
- package/src/tools/matchOption.ts +1 -2
- package/src/tools/mergeInto.ts +16 -16
- package/src/tools/monitor.ts +14 -10
- package/src/tools/observable.ts +79 -15
- 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/tools/stackTrace/computeStackTrace.ts +250 -0
- 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 +35 -3
- 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 -110
- package/src/tools/utils/responseUtils.ts +1 -1
- package/src/tools/utils/stringUtils.ts +62 -4
- 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 +113 -61
- package/src/transport/eventBridge.ts +24 -5
- package/src/transport/flushController.ts +44 -23
- package/src/transport/httpRequest.ts +99 -71
- package/src/transport/index.ts +7 -4
- package/src/transport/sendWithRetryStrategy.ts +60 -41
- 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 -76
- package/cjs/browser/addEventListener.js +0 -52
- package/cjs/browser/addEventListener.js.map +0 -1
- package/cjs/browser/cookie.d.ts +0 -10
- package/cjs/browser/cookie.js +0 -69
- package/cjs/browser/cookie.js.map +0 -1
- package/cjs/browser/fetchObservable.d.ts +0 -23
- package/cjs/browser/fetchObservable.js +0 -74
- package/cjs/browser/fetchObservable.js.map +0 -1
- package/cjs/browser/pageExitObservable.d.ts +0 -14
- package/cjs/browser/pageExitObservable.js +0 -58
- 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 -22
- package/cjs/browser/xhrObservable.js +0 -93
- package/cjs/browser/xhrObservable.js.map +0 -1
- package/cjs/domain/configuration/configuration.d.ts +0 -67
- package/cjs/domain/configuration/configuration.js +0 -95
- package/cjs/domain/configuration/configuration.js.map +0 -1
- package/cjs/domain/configuration/endpointBuilder.d.ts +0 -14
- package/cjs/domain/configuration/endpointBuilder.js +0 -94
- package/cjs/domain/configuration/endpointBuilder.js.map +0 -1
- package/cjs/domain/configuration/index.d.ts +0 -3
- package/cjs/domain/configuration/index.js +0 -25
- 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/console/consoleObservable.d.ts +0 -11
- package/cjs/domain/console/consoleObservable.js +0 -75
- package/cjs/domain/console/consoleObservable.js.map +0 -1
- package/cjs/domain/deflate/index.d.ts +0 -1
- package/cjs/domain/deflate/index.js +0 -18
- package/cjs/domain/deflate/index.js.map +0 -1
- package/cjs/domain/deflate/types.d.ts +0 -26
- package/cjs/domain/deflate/types.js +0 -3
- package/cjs/domain/deflate/types.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 -5
- package/cjs/domain/error/trackRuntimeError.js +0 -21
- 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 -24
- 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 -15
- 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 -15
- package/cjs/domain/session/sessionStoreOperations.js +0 -104
- 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 -48
- 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 -40
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js.map +0 -1
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.d.ts +0 -14
- 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 -11
- 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 -112
- package/cjs/domain/telemetry/telemetry.js +0 -146
- package/cjs/domain/telemetry/telemetry.js.map +0 -1
- package/cjs/domain/telemetry/telemetryEvent.types.d.ts +0 -375
- package/cjs/domain/telemetry/telemetryEvent.types.js +0 -7
- package/cjs/domain/telemetry/telemetryEvent.types.js.map +0 -1
- package/cjs/domain/tracekit/computeStackTrace.d.ts +0 -5
- package/cjs/domain/tracekit/computeStackTrace.js +0 -118
- package/cjs/domain/tracekit/computeStackTrace.js.map +0 -1
- package/cjs/domain/tracekit/index.d.ts +0 -3
- package/cjs/domain/tracekit/index.js +0 -8
- package/cjs/domain/tracekit/index.js.map +0 -1
- package/cjs/domain/tracekit/tracekit.d.ts +0 -35
- package/cjs/domain/tracekit/tracekit.js +0 -95
- package/cjs/domain/tracekit/tracekit.js.map +0 -1
- package/cjs/domain/tracekit/types.d.ts +0 -44
- package/cjs/domain/tracekit/types.js +0 -3
- package/cjs/domain/tracekit/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/index.d.ts +0 -63
- package/cjs/index.js +0 -155
- package/cjs/index.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 -45
- package/cjs/tools/display.js.map +0 -1
- package/cjs/tools/experimentalFeatures.d.ts +0 -24
- package/cjs/tools/experimentalFeatures.js +0 -47
- 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 -19
- package/cjs/tools/instrumentMethod.js +0 -83
- 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 -9
- 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 -44
- 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/contextManager.d.ts +0 -21
- package/cjs/tools/serialisation/contextManager.js +0 -70
- package/cjs/tools/serialisation/contextManager.js.map +0 -1
- package/cjs/tools/serialisation/heavyCustomerDataWarning.d.ts +0 -8
- package/cjs/tools/serialisation/heavyCustomerDataWarning.js +0 -18
- package/cjs/tools/serialisation/heavyCustomerDataWarning.js.map +0 -1
- package/cjs/tools/serialisation/jsonStringify.d.ts +0 -14
- 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 -2
- package/cjs/tools/utils/browserDetection.js +0 -12
- 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 -7
- package/cjs/tools/utils/stringUtils.js +0 -32
- 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 -19
- package/cjs/transport/batch.js +0 -79
- 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 -48
- package/cjs/transport/flushController.js +0 -97
- package/cjs/transport/flushController.js.map +0 -1
- package/cjs/transport/httpRequest.d.ts +0 -37
- package/cjs/transport/httpRequest.js +0 -91
- 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 -15
- package/cjs/transport/startBatchWithReplica.js +0 -37
- 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 -76
- package/esm/browser/addEventListener.js +0 -47
- package/esm/browser/addEventListener.js.map +0 -1
- package/esm/browser/cookie.d.ts +0 -10
- package/esm/browser/cookie.js +0 -61
- package/esm/browser/cookie.js.map +0 -1
- package/esm/browser/fetchObservable.d.ts +0 -23
- package/esm/browser/fetchObservable.js +0 -70
- package/esm/browser/fetchObservable.js.map +0 -1
- package/esm/browser/pageExitObservable.d.ts +0 -14
- package/esm/browser/pageExitObservable.js +0 -53
- 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 -22
- package/esm/browser/xhrObservable.js +0 -89
- package/esm/browser/xhrObservable.js.map +0 -1
- package/esm/domain/configuration/configuration.d.ts +0 -67
- package/esm/domain/configuration/configuration.js +0 -90
- package/esm/domain/configuration/configuration.js.map +0 -1
- package/esm/domain/configuration/endpointBuilder.d.ts +0 -14
- package/esm/domain/configuration/endpointBuilder.js +0 -90
- package/esm/domain/configuration/endpointBuilder.js.map +0 -1
- package/esm/domain/configuration/index.d.ts +0 -3
- package/esm/domain/configuration/index.js +0 -4
- 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/console/consoleObservable.d.ts +0 -11
- package/esm/domain/console/consoleObservable.js +0 -70
- package/esm/domain/console/consoleObservable.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 -26
- package/esm/domain/deflate/types.js +0 -2
- package/esm/domain/deflate/types.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 -5
- package/esm/domain/error/trackRuntimeError.js +0 -17
- 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 -24
- 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 -15
- 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 -15
- package/esm/domain/session/sessionStoreOperations.js +0 -99
- 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 -42
- 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 -35
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js.map +0 -1
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.d.ts +0 -14
- 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 -11
- 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 -112
- package/esm/domain/telemetry/telemetry.js +0 -134
- package/esm/domain/telemetry/telemetry.js.map +0 -1
- package/esm/domain/telemetry/telemetryEvent.types.d.ts +0 -375
- package/esm/domain/telemetry/telemetryEvent.types.js +0 -6
- package/esm/domain/telemetry/telemetryEvent.types.js.map +0 -1
- package/esm/domain/tracekit/computeStackTrace.d.ts +0 -5
- package/esm/domain/tracekit/computeStackTrace.js +0 -114
- package/esm/domain/tracekit/computeStackTrace.js.map +0 -1
- package/esm/domain/tracekit/index.d.ts +0 -3
- package/esm/domain/tracekit/index.js +0 -3
- package/esm/domain/tracekit/index.js.map +0 -1
- package/esm/domain/tracekit/tracekit.d.ts +0 -35
- package/esm/domain/tracekit/tracekit.js +0 -91
- package/esm/domain/tracekit/tracekit.js.map +0 -1
- package/esm/domain/tracekit/types.d.ts +0 -44
- package/esm/domain/tracekit/types.js +0 -2
- package/esm/domain/tracekit/types.js.map +0 -1
- package/esm/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 -63
- package/esm/index.js +0 -61
- 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 -41
- package/esm/tools/display.js.map +0 -1
- package/esm/tools/experimentalFeatures.d.ts +0 -24
- package/esm/tools/experimentalFeatures.js +0 -40
- 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 -19
- package/esm/tools/instrumentMethod.js +0 -77
- 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 -9
- 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 -40
- 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/contextManager.d.ts +0 -21
- package/esm/tools/serialisation/contextManager.js +0 -66
- package/esm/tools/serialisation/contextManager.js.map +0 -1
- package/esm/tools/serialisation/heavyCustomerDataWarning.d.ts +0 -8
- package/esm/tools/serialisation/heavyCustomerDataWarning.js +0 -14
- package/esm/tools/serialisation/heavyCustomerDataWarning.js.map +0 -1
- package/esm/tools/serialisation/jsonStringify.d.ts +0 -14
- 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 -2
- package/esm/tools/utils/browserDetection.js +0 -7
- 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 -7
- package/esm/tools/utils/stringUtils.js +0 -26
- 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 -19
- package/esm/transport/batch.js +0 -76
- 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 -48
- package/esm/transport/flushController.js +0 -93
- package/esm/transport/flushController.js.map +0 -1
- package/esm/transport/httpRequest.d.ts +0 -37
- package/esm/transport/httpRequest.js +0 -85
- 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 -15
- package/esm/transport/startBatchWithReplica.js +0 -33
- 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/tracekit/computeStackTrace.ts +0 -141
- package/src/domain/tracekit/index.ts +0 -3
- package/src/domain/tracekit/tracekit.ts +0 -96
- package/src/domain/tracekit/types.ts +0 -47
- package/src/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/tools/serialisation/contextManager.ts +0 -79
- package/src/tools/serialisation/heavyCustomerDataWarning.ts +0 -26
- package/src/transport/startBatchWithReplica.ts +0 -52
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Batch } from './batch';
|
|
2
|
-
import { createHttpRequest } from './httpRequest';
|
|
3
|
-
import { createFlushController } from './flushController';
|
|
4
|
-
export function startBatchWithReplica(configuration, primary, replica, reportError, pageExitObservable, sessionExpireObservable) {
|
|
5
|
-
var primaryBatch = createBatch(configuration, primary.endpoint);
|
|
6
|
-
var replicaBatch = replica && createBatch(configuration, replica.endpoint);
|
|
7
|
-
function createBatch(configuration, endpointBuilder) {
|
|
8
|
-
return new Batch(createHttpRequest(configuration, endpointBuilder, configuration.batchBytesLimit, reportError), createFlushController({
|
|
9
|
-
messagesLimit: configuration.batchMessagesLimit,
|
|
10
|
-
bytesLimit: configuration.batchBytesLimit,
|
|
11
|
-
durationLimit: configuration.flushTimeout,
|
|
12
|
-
pageExitObservable: pageExitObservable,
|
|
13
|
-
sessionExpireObservable: sessionExpireObservable,
|
|
14
|
-
}), configuration.messageBytesLimit);
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
flushObservable: primaryBatch.flushController.flushObservable,
|
|
18
|
-
add: function (message, replicated) {
|
|
19
|
-
if (replicated === void 0) { replicated = true; }
|
|
20
|
-
primaryBatch.add(message);
|
|
21
|
-
if (replicaBatch && replicated) {
|
|
22
|
-
replicaBatch.add(replica.transformMessage ? replica.transformMessage(message) : message);
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
upsert: function (message, key) {
|
|
26
|
-
primaryBatch.upsert(message, key);
|
|
27
|
-
if (replicaBatch) {
|
|
28
|
-
replicaBatch.upsert(replica.transformMessage ? replica.transformMessage(message) : message, key);
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=startBatchWithReplica.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"startBatchWithReplica.js","sourceRoot":"","sources":["../../src/transport/startBatchWithReplica.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAEzD,MAAM,UAAU,qBAAqB,CACnC,aAA4B,EAC5B,OAAsC,EACtC,OAAwF,EACxF,WAAsC,EACtC,kBAA6C,EAC7C,uBAAyC;IAEzC,IAAM,YAAY,GAAG,WAAW,CAAC,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;IACjE,IAAM,YAAY,GAAG,OAAO,IAAI,WAAW,CAAC,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;IAE5E,SAAS,WAAW,CAAC,aAA4B,EAAE,eAAgC;QACjF,OAAO,IAAI,KAAK,CACd,iBAAiB,CAAC,aAAa,EAAE,eAAe,EAAE,aAAa,CAAC,eAAe,EAAE,WAAW,CAAC,EAC7F,qBAAqB,CAAC;YACpB,aAAa,EAAE,aAAa,CAAC,kBAAkB;YAC/C,UAAU,EAAE,aAAa,CAAC,eAAe;YACzC,aAAa,EAAE,aAAa,CAAC,YAAY;YACzC,kBAAkB,oBAAA;YAClB,uBAAuB,yBAAA;SACxB,CAAC,EACF,aAAa,CAAC,iBAAiB,CAChC,CAAA;IACH,CAAC;IAED,OAAO;QACL,eAAe,EAAE,YAAY,CAAC,eAAe,CAAC,eAAe;QAE7D,GAAG,YAAC,OAAU,EAAE,UAAiB;YAAjB,2BAAA,EAAA,iBAAiB;YAC/B,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACzB,IAAI,YAAY,IAAI,UAAU,EAAE;gBAC9B,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;aACzF;QACH,CAAC;QAED,MAAM,EAAE,UAAC,OAAU,EAAE,GAAW;YAC9B,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;YACjC,IAAI,YAAY,EAAE;gBAChB,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;aACjG;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export const INTAKE_SITE_STAGING = 'alpha1-api.dev.zinclabs.dev'
|
|
2
|
-
export const INTAKE_SITE_US1 = 'api.openobserve.ai'
|
|
3
|
-
export const INTAKE_SITE_EU1 = 'api.openobserve.ai'
|
|
4
|
-
export const INTAKE_SITE_AP1 = 'api.openobserve.ai'
|
|
5
|
-
export const INTAKE_SITE_US1_FED = 'api.openobserve.ai'
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { display } from '../../tools/display'
|
|
2
|
-
import type { InitConfiguration } from './configuration'
|
|
3
|
-
|
|
4
|
-
export const TAG_SIZE_LIMIT = 200
|
|
5
|
-
|
|
6
|
-
export function buildTags(configuration: InitConfiguration): string[] {
|
|
7
|
-
const { env, service, version, datacenter } = configuration
|
|
8
|
-
const tags = []
|
|
9
|
-
|
|
10
|
-
if (env) {
|
|
11
|
-
tags.push(buildTag('env', env))
|
|
12
|
-
}
|
|
13
|
-
if (service) {
|
|
14
|
-
tags.push(buildTag('service', service))
|
|
15
|
-
}
|
|
16
|
-
if (version) {
|
|
17
|
-
tags.push(buildTag('version', version))
|
|
18
|
-
}
|
|
19
|
-
if (datacenter) {
|
|
20
|
-
tags.push(buildTag('datacenter', datacenter))
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return tags
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const FORBIDDEN_CHARACTERS = /[^a-z0-9_:./-]/
|
|
27
|
-
|
|
28
|
-
export function buildTag(key: string, rawValue: string) {
|
|
29
|
-
// See https://docs.datadoghq.com/getting_started/tagging/#defining-tags for tags syntax. Note
|
|
30
|
-
// that the backend may not follow the exact same rules, so we only want to display an informal
|
|
31
|
-
// warning.
|
|
32
|
-
const valueSizeLimit = TAG_SIZE_LIMIT - key.length - 1
|
|
33
|
-
|
|
34
|
-
if (rawValue.length > valueSizeLimit || FORBIDDEN_CHARACTERS.test(rawValue)) {
|
|
35
|
-
display.warn(`${key} value doesn't meet tag requirements and will be sanitized`)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Let the backend do most of the sanitization, but still make sure multiple tags can't be crafted
|
|
39
|
-
// by forging a value containing commas.
|
|
40
|
-
const sanitizedValue = rawValue.replace(/,/g, '_')
|
|
41
|
-
|
|
42
|
-
return `${key}:${sanitizedValue}`
|
|
43
|
-
}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { startsWith } from '../../tools/utils/polyfills'
|
|
2
|
-
import type { StackTrace, StackFrame } from './types'
|
|
3
|
-
|
|
4
|
-
const UNKNOWN_FUNCTION = '?'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Computes a stack trace for an exception.
|
|
8
|
-
*/
|
|
9
|
-
export function computeStackTrace(ex: unknown): StackTrace {
|
|
10
|
-
const stack: StackFrame[] = []
|
|
11
|
-
|
|
12
|
-
let stackProperty = tryToGetString(ex, 'stack')
|
|
13
|
-
const exString = String(ex)
|
|
14
|
-
if (stackProperty && startsWith(stackProperty, exString)) {
|
|
15
|
-
stackProperty = stackProperty.slice(exString.length)
|
|
16
|
-
}
|
|
17
|
-
if (stackProperty) {
|
|
18
|
-
stackProperty.split('\n').forEach((line) => {
|
|
19
|
-
const stackFrame =
|
|
20
|
-
parseChromeLine(line) || parseChromeAnonymousLine(line) || parseWinLine(line) || parseGeckoLine(line)
|
|
21
|
-
if (stackFrame) {
|
|
22
|
-
if (!stackFrame.func && stackFrame.line) {
|
|
23
|
-
stackFrame.func = UNKNOWN_FUNCTION
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
stack.push(stackFrame)
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
message: tryToGetString(ex, 'message'),
|
|
33
|
-
name: tryToGetString(ex, 'name'),
|
|
34
|
-
stack,
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const fileUrl = '((?:file|https?|blob|chrome-extension|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)'
|
|
38
|
-
const filePosition = '(?::(\\d+))'
|
|
39
|
-
const CHROME_LINE_RE = new RegExp(`^\\s*at (.*?) ?\\(${fileUrl}${filePosition}?${filePosition}?\\)?\\s*$`, 'i')
|
|
40
|
-
|
|
41
|
-
const CHROME_EVAL_RE = new RegExp(`\\((\\S*)${filePosition}${filePosition}\\)`)
|
|
42
|
-
|
|
43
|
-
function parseChromeLine(line: string): StackFrame | undefined {
|
|
44
|
-
const parts = CHROME_LINE_RE.exec(line)
|
|
45
|
-
|
|
46
|
-
if (!parts) {
|
|
47
|
-
return
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const isNative = parts[2] && parts[2].indexOf('native') === 0 // start of line
|
|
51
|
-
const isEval = parts[2] && parts[2].indexOf('eval') === 0 // start of line
|
|
52
|
-
const submatch = CHROME_EVAL_RE.exec(parts[2])
|
|
53
|
-
|
|
54
|
-
if (isEval && submatch) {
|
|
55
|
-
// throw out eval line/column and use top-most line/column number
|
|
56
|
-
parts[2] = submatch[1] // url
|
|
57
|
-
parts[3] = submatch[2] // line
|
|
58
|
-
parts[4] = submatch[3] // column
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
args: isNative ? [parts[2]] : [],
|
|
63
|
-
column: parts[4] ? +parts[4] : undefined,
|
|
64
|
-
func: parts[1] || UNKNOWN_FUNCTION,
|
|
65
|
-
line: parts[3] ? +parts[3] : undefined,
|
|
66
|
-
url: !isNative ? parts[2] : undefined,
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const CHROME_ANONYMOUS_FUNCTION_RE = new RegExp(`^\\s*at ?${fileUrl}${filePosition}?${filePosition}??\\s*$`, 'i')
|
|
71
|
-
|
|
72
|
-
function parseChromeAnonymousLine(line: string): StackFrame | undefined {
|
|
73
|
-
const parts = CHROME_ANONYMOUS_FUNCTION_RE.exec(line)
|
|
74
|
-
|
|
75
|
-
if (!parts) {
|
|
76
|
-
return
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
args: [],
|
|
81
|
-
column: parts[3] ? +parts[3] : undefined,
|
|
82
|
-
func: UNKNOWN_FUNCTION,
|
|
83
|
-
line: parts[2] ? +parts[2] : undefined,
|
|
84
|
-
url: parts[1],
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const WINJS_LINE_RE =
|
|
89
|
-
/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i
|
|
90
|
-
|
|
91
|
-
function parseWinLine(line: string): StackFrame | undefined {
|
|
92
|
-
const parts = WINJS_LINE_RE.exec(line)
|
|
93
|
-
if (!parts) {
|
|
94
|
-
return
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return {
|
|
98
|
-
args: [],
|
|
99
|
-
column: parts[4] ? +parts[4] : undefined,
|
|
100
|
-
func: parts[1] || UNKNOWN_FUNCTION,
|
|
101
|
-
line: +parts[3],
|
|
102
|
-
url: parts[2],
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const GECKO_LINE_RE =
|
|
107
|
-
/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i
|
|
108
|
-
const GECKO_EVAL_RE = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i
|
|
109
|
-
|
|
110
|
-
function parseGeckoLine(line: string): StackFrame | undefined {
|
|
111
|
-
const parts = GECKO_LINE_RE.exec(line)
|
|
112
|
-
if (!parts) {
|
|
113
|
-
return
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const isEval = parts[3] && parts[3].indexOf(' > eval') > -1
|
|
117
|
-
const submatch = GECKO_EVAL_RE.exec(parts[3])
|
|
118
|
-
|
|
119
|
-
if (isEval && submatch) {
|
|
120
|
-
// throw out eval line/column and use top-most line number
|
|
121
|
-
parts[3] = submatch[1]
|
|
122
|
-
parts[4] = submatch[2]
|
|
123
|
-
parts[5] = undefined! // no column when eval
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return {
|
|
127
|
-
args: parts[2] ? parts[2].split(',') : [],
|
|
128
|
-
column: parts[5] ? +parts[5] : undefined,
|
|
129
|
-
func: parts[1] || UNKNOWN_FUNCTION,
|
|
130
|
-
line: parts[4] ? +parts[4] : undefined,
|
|
131
|
-
url: parts[3],
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function tryToGetString(candidate: unknown, property: string) {
|
|
136
|
-
if (typeof candidate !== 'object' || !candidate || !(property in candidate)) {
|
|
137
|
-
return undefined
|
|
138
|
-
}
|
|
139
|
-
const value = (candidate as { [k: string]: unknown })[property]
|
|
140
|
-
return typeof value === 'string' ? value : undefined
|
|
141
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { instrumentMethodAndCallOriginal } from '../../tools/instrumentMethod'
|
|
2
|
-
import { computeStackTrace } from './computeStackTrace'
|
|
3
|
-
import type { UnhandledErrorCallback, StackTrace } from './types'
|
|
4
|
-
|
|
5
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types
|
|
6
|
-
const ERROR_TYPES_RE =
|
|
7
|
-
/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Cross-browser collection of unhandled errors
|
|
11
|
-
*
|
|
12
|
-
* Supports:
|
|
13
|
-
* - Firefox: full stack trace with line numbers, plus column number
|
|
14
|
-
* on top frame; column number is not guaranteed
|
|
15
|
-
* - Opera: full stack trace with line and column numbers
|
|
16
|
-
* - Chrome: full stack trace with line and column numbers
|
|
17
|
-
* - Safari: line and column number for the top frame only; some frames
|
|
18
|
-
* may be missing, and column number is not guaranteed
|
|
19
|
-
* - IE: line and column number for the top frame only; some frames
|
|
20
|
-
* may be missing, and column number is not guaranteed
|
|
21
|
-
*
|
|
22
|
-
* In theory, TraceKit should work on all of the following versions:
|
|
23
|
-
* - IE5.5+ (only 8.0 tested)
|
|
24
|
-
* - Firefox 0.9+ (only 3.5+ tested)
|
|
25
|
-
* - Opera 7+ (only 10.50 tested; versions 9 and earlier may require
|
|
26
|
-
* Exceptions Have Stacktrace to be enabled in opera:config)
|
|
27
|
-
* - Safari 3+ (only 4+ tested)
|
|
28
|
-
* - Chrome 1+ (only 5+ tested)
|
|
29
|
-
* - Konqueror 3.5+ (untested)
|
|
30
|
-
*
|
|
31
|
-
* Tries to catch all unhandled errors and report them to the
|
|
32
|
-
* callback.
|
|
33
|
-
*
|
|
34
|
-
* Callbacks receive a StackTrace object as described in the
|
|
35
|
-
* computeStackTrace docs.
|
|
36
|
-
*
|
|
37
|
-
* @memberof TraceKit
|
|
38
|
-
* @namespace
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
export function startUnhandledErrorCollection(callback: UnhandledErrorCallback) {
|
|
42
|
-
const { stop: stopInstrumentingOnError } = instrumentOnError(callback)
|
|
43
|
-
const { stop: stopInstrumentingOnUnhandledRejection } = instrumentUnhandledRejection(callback)
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
stop: () => {
|
|
47
|
-
stopInstrumentingOnError()
|
|
48
|
-
stopInstrumentingOnUnhandledRejection()
|
|
49
|
-
},
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Install a global onerror handler
|
|
55
|
-
*/
|
|
56
|
-
function instrumentOnError(callback: UnhandledErrorCallback) {
|
|
57
|
-
return instrumentMethodAndCallOriginal(window, 'onerror', {
|
|
58
|
-
before(this: any, messageObj: unknown, url?: string, line?: number, column?: number, errorObj?: unknown) {
|
|
59
|
-
let stackTrace: StackTrace
|
|
60
|
-
if (errorObj instanceof Error) {
|
|
61
|
-
stackTrace = computeStackTrace(errorObj)
|
|
62
|
-
} else {
|
|
63
|
-
const stack = [{ url, column, line }]
|
|
64
|
-
const { name, message } = tryToParseMessage(messageObj)
|
|
65
|
-
stackTrace = {
|
|
66
|
-
name,
|
|
67
|
-
message,
|
|
68
|
-
stack,
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
callback(stackTrace, errorObj ?? messageObj)
|
|
72
|
-
},
|
|
73
|
-
})
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function tryToParseMessage(messageObj: unknown) {
|
|
77
|
-
let name
|
|
78
|
-
let message
|
|
79
|
-
if ({}.toString.call(messageObj) === '[object String]') {
|
|
80
|
-
;[, name, message] = ERROR_TYPES_RE.exec(messageObj as string)!
|
|
81
|
-
}
|
|
82
|
-
return { name, message }
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Install a global onunhandledrejection handler
|
|
87
|
-
*/
|
|
88
|
-
function instrumentUnhandledRejection(callback: UnhandledErrorCallback) {
|
|
89
|
-
return instrumentMethodAndCallOriginal(window, 'onunhandledrejection', {
|
|
90
|
-
before(e: PromiseRejectionEvent) {
|
|
91
|
-
const reason = e.reason || 'Empty reason'
|
|
92
|
-
const stack = computeStackTrace(reason)
|
|
93
|
-
callback(stack, reason)
|
|
94
|
-
},
|
|
95
|
-
})
|
|
96
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export interface BrowserError extends Error {
|
|
2
|
-
sourceURL?: string
|
|
3
|
-
fileName?: string
|
|
4
|
-
line?: string | number
|
|
5
|
-
lineNumber?: string | number
|
|
6
|
-
description?: string
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type UnhandledErrorCallback = (stack: StackTrace, errorObject?: any) => any
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* An object representing a single stack frame.
|
|
13
|
-
* @typedef {Object} StackFrame
|
|
14
|
-
* @property {string=} url The JavaScript or HTML file URL.
|
|
15
|
-
* @property {string=} func The function name, or empty for anonymous functions (if guessing did not work).
|
|
16
|
-
* @property {string[]=} args The arguments passed to the function, if known.
|
|
17
|
-
* @property {number=} line The line number, if known.
|
|
18
|
-
* @property {number=} column The column number, if known.
|
|
19
|
-
* @property {string[]=} context An array of source code lines; the middle element corresponds to the correct line#.
|
|
20
|
-
* @memberof TraceKit
|
|
21
|
-
*/
|
|
22
|
-
export interface StackFrame {
|
|
23
|
-
url?: string
|
|
24
|
-
func?: string
|
|
25
|
-
args?: string[]
|
|
26
|
-
line?: number
|
|
27
|
-
column?: number
|
|
28
|
-
context?: string[]
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* An object representing a JavaScript stack trace.
|
|
33
|
-
* @typedef {Object} StackTrace
|
|
34
|
-
* @property {string=} name The name of the thrown exception.
|
|
35
|
-
* @property {string} message The exception error message.
|
|
36
|
-
* @property {StackFrame[]} stack An array of stack frames.
|
|
37
|
-
* -- method used to collect the stack trace.
|
|
38
|
-
* @memberof TraceKit
|
|
39
|
-
*/
|
|
40
|
-
export interface StackTrace {
|
|
41
|
-
name?: string
|
|
42
|
-
message?: string
|
|
43
|
-
url?: string
|
|
44
|
-
stack: StackFrame[]
|
|
45
|
-
incomplete?: boolean
|
|
46
|
-
partial?: boolean
|
|
47
|
-
}
|
package/src/domain/user/index.ts
DELETED
package/src/domain/user/user.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Context } from '../../tools/serialisation/context'
|
|
2
|
-
import { display } from '../../tools/display'
|
|
3
|
-
import { getType } from '../../tools/utils/typeUtils'
|
|
4
|
-
import { assign } from '../../tools/utils/polyfills'
|
|
5
|
-
import type { User } from './user.types'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Clone input data and ensure known user properties (id, name, email)
|
|
9
|
-
* are strings, as defined here:
|
|
10
|
-
* https://docs.datadoghq.com/logs/log_configuration/attributes_naming_convention/#user-related-attributes
|
|
11
|
-
*/
|
|
12
|
-
export function sanitizeUser(newUser: Context): Context {
|
|
13
|
-
// We shallow clone only to prevent mutation of user data.
|
|
14
|
-
const user = assign({}, newUser)
|
|
15
|
-
const keys = ['id', 'name', 'email']
|
|
16
|
-
keys.forEach((key) => {
|
|
17
|
-
if (key in user) {
|
|
18
|
-
user[key] = String(user[key])
|
|
19
|
-
}
|
|
20
|
-
})
|
|
21
|
-
return user
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Simple check to ensure user is valid
|
|
26
|
-
*/
|
|
27
|
-
export function checkUser(newUser: User): boolean {
|
|
28
|
-
const isValid = getType(newUser) === 'object'
|
|
29
|
-
if (!isValid) {
|
|
30
|
-
display.error('Unsupported user:', newUser)
|
|
31
|
-
}
|
|
32
|
-
return isValid
|
|
33
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { computeBytesCount } from '../utils/byteUtils'
|
|
2
|
-
import { throttle } from '../utils/functionUtils'
|
|
3
|
-
import { deepClone } from '../mergeInto'
|
|
4
|
-
import { getType } from '../utils/typeUtils'
|
|
5
|
-
import { jsonStringify } from './jsonStringify'
|
|
6
|
-
import { sanitize } from './sanitize'
|
|
7
|
-
import { warnIfCustomerDataLimitReached } from './heavyCustomerDataWarning'
|
|
8
|
-
import type { CustomerDataType } from './heavyCustomerDataWarning'
|
|
9
|
-
import type { Context, ContextValue } from './context'
|
|
10
|
-
|
|
11
|
-
export const BYTES_COMPUTATION_THROTTLING_DELAY = 200
|
|
12
|
-
|
|
13
|
-
export type ContextManager = ReturnType<typeof createContextManager>
|
|
14
|
-
|
|
15
|
-
export function createContextManager(customerDataType: CustomerDataType, computeBytesCountImpl = computeBytesCount) {
|
|
16
|
-
let context: Context = {}
|
|
17
|
-
let bytesCountCache: number
|
|
18
|
-
let alreadyWarned = false
|
|
19
|
-
|
|
20
|
-
// Throttle the bytes computation to minimize the impact on performance.
|
|
21
|
-
// Especially useful if the user call context APIs synchronously multiple times in a row
|
|
22
|
-
const { throttled: computeBytesCountThrottled } = throttle((context: Context) => {
|
|
23
|
-
bytesCountCache = computeBytesCountImpl(jsonStringify(context)!)
|
|
24
|
-
if (!alreadyWarned) {
|
|
25
|
-
alreadyWarned = warnIfCustomerDataLimitReached(bytesCountCache, customerDataType)
|
|
26
|
-
}
|
|
27
|
-
}, BYTES_COMPUTATION_THROTTLING_DELAY)
|
|
28
|
-
|
|
29
|
-
const contextManager = {
|
|
30
|
-
getBytesCount: () => bytesCountCache,
|
|
31
|
-
/** @deprecated use getContext instead */
|
|
32
|
-
get: () => context,
|
|
33
|
-
|
|
34
|
-
/** @deprecated use setContextProperty instead */
|
|
35
|
-
add: (key: string, value: any) => {
|
|
36
|
-
context[key] = value as ContextValue
|
|
37
|
-
computeBytesCountThrottled(context)
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
/** @deprecated renamed to removeContextProperty */
|
|
41
|
-
remove: (key: string) => {
|
|
42
|
-
delete context[key]
|
|
43
|
-
computeBytesCountThrottled(context)
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
/** @deprecated use setContext instead */
|
|
47
|
-
set: (newContext: object) => {
|
|
48
|
-
context = newContext as Context
|
|
49
|
-
computeBytesCountThrottled(context)
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
getContext: () => deepClone(context),
|
|
53
|
-
|
|
54
|
-
setContext: (newContext: Context) => {
|
|
55
|
-
if (getType(newContext) === 'object') {
|
|
56
|
-
context = sanitize(newContext)
|
|
57
|
-
computeBytesCountThrottled(context)
|
|
58
|
-
} else {
|
|
59
|
-
contextManager.clearContext()
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
setContextProperty: (key: string, property: any) => {
|
|
64
|
-
context[key] = sanitize(property)
|
|
65
|
-
computeBytesCountThrottled(context)
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
removeContextProperty: (key: string) => {
|
|
69
|
-
delete context[key]
|
|
70
|
-
computeBytesCountThrottled(context)
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
clearContext: () => {
|
|
74
|
-
context = {}
|
|
75
|
-
bytesCountCache = 0
|
|
76
|
-
},
|
|
77
|
-
}
|
|
78
|
-
return contextManager
|
|
79
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ONE_KIBI_BYTE } from '../utils/byteUtils'
|
|
2
|
-
import { display } from '../display'
|
|
3
|
-
|
|
4
|
-
// RUM and logs batch bytes limit is 16KB
|
|
5
|
-
// ensure that we leave room for other event attributes and maintain a decent amount of event per batch
|
|
6
|
-
// (3KB (customer data) + 1KB (other attributes)) * 4 (events per batch) = 16KB
|
|
7
|
-
export const CUSTOMER_DATA_BYTES_LIMIT = 3 * ONE_KIBI_BYTE
|
|
8
|
-
|
|
9
|
-
export const enum CustomerDataType {
|
|
10
|
-
FeatureFlag = 'feature flag evaluation',
|
|
11
|
-
User = 'user',
|
|
12
|
-
GlobalContext = 'global context',
|
|
13
|
-
LoggerContext = 'logger context',
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function warnIfCustomerDataLimitReached(bytesCount: number, customerDataType: CustomerDataType): boolean {
|
|
17
|
-
if (bytesCount > CUSTOMER_DATA_BYTES_LIMIT) {
|
|
18
|
-
display.warn(
|
|
19
|
-
`The ${customerDataType} data exceeds the recommended ${
|
|
20
|
-
CUSTOMER_DATA_BYTES_LIMIT / ONE_KIBI_BYTE
|
|
21
|
-
}KiB threshold. More details: https://docs.datadoghq.com/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-3kib-warning`
|
|
22
|
-
)
|
|
23
|
-
return true
|
|
24
|
-
}
|
|
25
|
-
return false
|
|
26
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { Configuration, EndpointBuilder } from '../domain/configuration'
|
|
2
|
-
import type { Context } from '../tools/serialisation/context'
|
|
3
|
-
import type { Observable } from '../tools/observable'
|
|
4
|
-
import type { PageExitEvent } from '../browser/pageExitObservable'
|
|
5
|
-
import type { RawError } from '../domain/error/error.types'
|
|
6
|
-
import { Batch } from './batch'
|
|
7
|
-
import { createHttpRequest } from './httpRequest'
|
|
8
|
-
import { createFlushController } from './flushController'
|
|
9
|
-
|
|
10
|
-
export function startBatchWithReplica<T extends Context>(
|
|
11
|
-
configuration: Configuration,
|
|
12
|
-
primary: { endpoint: EndpointBuilder },
|
|
13
|
-
replica: { endpoint: EndpointBuilder; transformMessage?: (message: T) => T } | undefined,
|
|
14
|
-
reportError: (error: RawError) => void,
|
|
15
|
-
pageExitObservable: Observable<PageExitEvent>,
|
|
16
|
-
sessionExpireObservable: Observable<void>
|
|
17
|
-
) {
|
|
18
|
-
const primaryBatch = createBatch(configuration, primary.endpoint)
|
|
19
|
-
const replicaBatch = replica && createBatch(configuration, replica.endpoint)
|
|
20
|
-
|
|
21
|
-
function createBatch(configuration: Configuration, endpointBuilder: EndpointBuilder) {
|
|
22
|
-
return new Batch(
|
|
23
|
-
createHttpRequest(configuration, endpointBuilder, configuration.batchBytesLimit, reportError),
|
|
24
|
-
createFlushController({
|
|
25
|
-
messagesLimit: configuration.batchMessagesLimit,
|
|
26
|
-
bytesLimit: configuration.batchBytesLimit,
|
|
27
|
-
durationLimit: configuration.flushTimeout,
|
|
28
|
-
pageExitObservable,
|
|
29
|
-
sessionExpireObservable,
|
|
30
|
-
}),
|
|
31
|
-
configuration.messageBytesLimit
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
flushObservable: primaryBatch.flushController.flushObservable,
|
|
37
|
-
|
|
38
|
-
add(message: T, replicated = true) {
|
|
39
|
-
primaryBatch.add(message)
|
|
40
|
-
if (replicaBatch && replicated) {
|
|
41
|
-
replicaBatch.add(replica.transformMessage ? replica.transformMessage(message) : message)
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
upsert: (message: T, key: string) => {
|
|
46
|
-
primaryBatch.upsert(message, key)
|
|
47
|
-
if (replicaBatch) {
|
|
48
|
-
replicaBatch.upsert(replica.transformMessage ? replica.transformMessage(message) : message, key)
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
}
|
|
52
|
-
}
|