@openobserve/browser-core 0.2.12-beta.9 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/boot/displayAlreadyInitializedError.d.ts +2 -0
- package/cjs/boot/displayAlreadyInitializedError.js +10 -0
- package/cjs/boot/displayAlreadyInitializedError.js.map +1 -0
- package/cjs/boot/init.d.ts +14 -0
- package/cjs/boot/init.js +39 -0
- package/cjs/boot/init.js.map +1 -0
- package/cjs/browser/addEventListener.d.ts +87 -0
- package/cjs/browser/addEventListener.js +55 -0
- package/cjs/browser/addEventListener.js.map +1 -0
- package/cjs/browser/browser.types.d.ts +51 -0
- package/cjs/browser/browser.types.js +6 -0
- package/cjs/browser/browser.types.js.map +1 -0
- package/cjs/browser/cookie.d.ts +28 -0
- package/cjs/browser/cookie.js +114 -0
- package/cjs/browser/cookie.js.map +1 -0
- package/cjs/browser/fetchObservable.d.ts +38 -0
- package/cjs/browser/fetchObservable.js +103 -0
- package/cjs/browser/fetchObservable.js.map +1 -0
- package/cjs/browser/pageMayExitObservable.d.ts +14 -0
- package/cjs/browser/pageMayExitObservable.js +45 -0
- package/cjs/browser/pageMayExitObservable.js.map +1 -0
- package/cjs/browser/runOnReadyState.d.ts +5 -0
- package/cjs/browser/runOnReadyState.js +20 -0
- package/cjs/browser/runOnReadyState.js.map +1 -0
- package/cjs/browser/xhrObservable.d.ts +24 -0
- package/cjs/browser/xhrObservable.js +86 -0
- package/cjs/browser/xhrObservable.js.map +1 -0
- package/cjs/domain/allowedTrackingOrigins.d.ts +4 -0
- package/cjs/domain/allowedTrackingOrigins.js +25 -0
- package/cjs/domain/allowedTrackingOrigins.js.map +1 -0
- package/cjs/domain/bufferedData.d.ts +14 -0
- package/cjs/domain/bufferedData.js +22 -0
- package/cjs/domain/bufferedData.js.map +1 -0
- package/cjs/domain/configuration/configuration.d.ts +312 -0
- package/cjs/domain/configuration/configuration.js +138 -0
- package/cjs/domain/configuration/configuration.js.map +1 -0
- package/cjs/domain/configuration/endpointBuilder.d.ts +12 -0
- package/cjs/domain/configuration/endpointBuilder.js +81 -0
- package/cjs/domain/configuration/endpointBuilder.js.map +1 -0
- package/cjs/domain/configuration/index.d.ts +5 -0
- package/cjs/domain/configuration/index.js +16 -0
- package/cjs/domain/configuration/index.js.map +1 -0
- package/cjs/domain/configuration/transportConfiguration.d.ts +20 -0
- package/cjs/domain/configuration/transportConfiguration.js +54 -0
- package/cjs/domain/configuration/transportConfiguration.js.map +1 -0
- package/cjs/domain/connectivity/connectivity.d.ts +14 -0
- package/cjs/domain/connectivity/connectivity.js +14 -0
- package/cjs/domain/connectivity/connectivity.js.map +1 -0
- package/cjs/domain/connectivity/index.d.ts +1 -0
- package/cjs/domain/connectivity/index.js +18 -0
- package/cjs/domain/connectivity/index.js.map +1 -0
- package/cjs/domain/console/consoleObservable.d.ts +21 -0
- package/cjs/domain/console/consoleObservable.js +84 -0
- package/cjs/domain/console/consoleObservable.js.map +1 -0
- package/cjs/domain/context/contextConstants.d.ts +21 -0
- package/cjs/domain/context/contextConstants.js +18 -0
- package/cjs/domain/context/contextConstants.js.map +1 -0
- package/cjs/domain/context/contextManager.d.ts +19 -0
- package/cjs/domain/context/contextManager.js +60 -0
- package/cjs/domain/context/contextManager.js.map +1 -0
- package/cjs/domain/context/contextUtils.d.ts +5 -0
- package/cjs/domain/context/contextUtils.js +16 -0
- package/cjs/domain/context/contextUtils.js.map +1 -0
- package/cjs/domain/context/defineContextMethod.d.ts +6 -0
- package/cjs/domain/context/defineContextMethod.js +21 -0
- package/cjs/domain/context/defineContextMethod.js.map +1 -0
- package/cjs/domain/context/storeContextManager.d.ts +6 -0
- package/cjs/domain/context/storeContextManager.js +40 -0
- package/cjs/domain/context/storeContextManager.js.map +1 -0
- package/cjs/domain/contexts/accountContext.d.ts +26 -0
- package/cjs/domain/contexts/accountContext.js +33 -0
- package/cjs/domain/contexts/accountContext.js.map +1 -0
- package/cjs/domain/contexts/globalContext.d.ts +18 -0
- package/cjs/domain/contexts/globalContext.js +21 -0
- package/cjs/domain/contexts/globalContext.js.map +1 -0
- package/cjs/domain/contexts/rumInternalContext.type.d.ts +14 -0
- package/cjs/domain/contexts/rumInternalContext.type.js +3 -0
- package/cjs/domain/contexts/rumInternalContext.type.js.map +1 -0
- package/cjs/domain/contexts/userContext.d.ts +29 -0
- package/cjs/domain/contexts/userContext.js +45 -0
- package/cjs/domain/contexts/userContext.js.map +1 -0
- package/cjs/domain/deflate/deflate.types.d.ts +40 -0
- package/cjs/domain/deflate/deflate.types.js +3 -0
- package/cjs/domain/deflate/deflate.types.js.map +1 -0
- package/cjs/domain/deflate/index.d.ts +1 -0
- package/cjs/domain/deflate/index.js +18 -0
- package/cjs/domain/deflate/index.js.map +1 -0
- package/cjs/domain/error/error.d.ts +23 -0
- package/cjs/domain/error/error.js +74 -0
- package/cjs/domain/error/error.js.map +1 -0
- package/cjs/domain/error/error.types.d.ts +47 -0
- package/cjs/domain/error/error.types.js +13 -0
- package/cjs/domain/error/error.types.js.map +1 -0
- package/cjs/domain/error/trackRuntimeError.d.ts +11 -0
- package/cjs/domain/error/trackRuntimeError.js +48 -0
- package/cjs/domain/error/trackRuntimeError.js.map +1 -0
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.d.ts +5 -0
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js +41 -0
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -0
- package/cjs/domain/extension/extensionUtils.d.ts +10 -0
- package/cjs/domain/extension/extensionUtils.js +30 -0
- package/cjs/domain/extension/extensionUtils.js.map +1 -0
- package/cjs/domain/intakeSites.d.ts +8 -0
- package/cjs/domain/intakeSites.js +11 -0
- package/cjs/domain/intakeSites.js.map +1 -0
- package/cjs/domain/report/browser.types.d.ts +34 -0
- package/cjs/domain/report/browser.types.js +3 -0
- package/cjs/domain/report/browser.types.js.map +1 -0
- package/cjs/domain/report/reportObservable.d.ts +14 -0
- package/cjs/domain/report/reportObservable.js +99 -0
- package/cjs/domain/report/reportObservable.js.map +1 -0
- package/cjs/domain/resourceUtils.d.ts +18 -0
- package/cjs/domain/resourceUtils.js +20 -0
- package/cjs/domain/resourceUtils.js.map +1 -0
- package/cjs/domain/session/oldCookiesMigration.d.ts +11 -0
- package/cjs/domain/session/oldCookiesMigration.js +40 -0
- package/cjs/domain/session/oldCookiesMigration.js.map +1 -0
- package/cjs/domain/session/sessionConstants.d.ts +15 -0
- package/cjs/domain/session/sessionConstants.js +16 -0
- package/cjs/domain/session/sessionConstants.js.map +1 -0
- package/cjs/domain/session/sessionManager.d.ts +28 -0
- package/cjs/domain/session/sessionManager.js +201 -0
- package/cjs/domain/session/sessionManager.js.map +1 -0
- package/cjs/domain/session/sessionState.d.ts +16 -0
- package/cjs/domain/session/sessionState.js +70 -0
- package/cjs/domain/session/sessionState.js.map +1 -0
- package/cjs/domain/session/sessionStateValidation.d.ts +3 -0
- package/cjs/domain/session/sessionStateValidation.js +11 -0
- package/cjs/domain/session/sessionStateValidation.js.map +1 -0
- package/cjs/domain/session/sessionStore.d.ts +38 -0
- package/cjs/domain/session/sessionStore.js +185 -0
- package/cjs/domain/session/sessionStore.js.map +1 -0
- package/cjs/domain/session/sessionStoreOperations.d.ts +12 -0
- package/cjs/domain/session/sessionStoreOperations.js +119 -0
- package/cjs/domain/session/sessionStoreOperations.js.map +1 -0
- package/cjs/domain/session/storeStrategies/sessionInCookie.d.ts +12 -0
- package/cjs/domain/session/storeStrategies/sessionInCookie.js +104 -0
- package/cjs/domain/session/storeStrategies/sessionInCookie.js.map +1 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.d.ts +6 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js +42 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -0
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.d.ts +16 -0
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js +5 -0
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js.map +1 -0
- package/cjs/domain/synthetics/syntheticsWorkerValues.d.ts +12 -0
- package/cjs/domain/synthetics/syntheticsWorkerValues.js +31 -0
- package/cjs/domain/synthetics/syntheticsWorkerValues.js.map +1 -0
- package/cjs/domain/tags.d.ts +6 -0
- package/cjs/domain/tags.js +67 -0
- package/cjs/domain/tags.js.map +1 -0
- package/cjs/domain/telemetry/index.d.ts +4 -0
- package/cjs/domain/telemetry/index.js +28 -0
- package/cjs/domain/telemetry/index.js.map +1 -0
- package/cjs/domain/telemetry/rawTelemetryEvent.types.d.ts +18 -0
- package/cjs/domain/telemetry/rawTelemetryEvent.types.js +9 -0
- package/cjs/domain/telemetry/rawTelemetryEvent.types.js.map +1 -0
- package/cjs/domain/telemetry/telemetry.d.ts +56 -0
- package/cjs/domain/telemetry/telemetry.js +241 -0
- package/cjs/domain/telemetry/telemetry.js.map +1 -0
- package/cjs/domain/telemetry/telemetryEvent.types.d.ts +866 -0
- package/cjs/domain/telemetry/telemetryEvent.types.js +7 -0
- package/cjs/domain/telemetry/telemetryEvent.types.js.map +1 -0
- package/cjs/domain/trackingConsent.d.ts +13 -0
- package/cjs/domain/trackingConsent.js +28 -0
- package/cjs/domain/trackingConsent.js.map +1 -0
- package/cjs/index.d.ts +100 -0
- package/cjs/index.js +194 -0
- package/cjs/index.js.map +1 -0
- package/cjs/tools/abstractHooks.d.ts +24 -0
- package/cjs/tools/abstractHooks.js +41 -0
- package/cjs/tools/abstractHooks.js.map +1 -0
- package/cjs/tools/abstractLifeCycle.d.ts +23 -0
- package/cjs/tools/abstractLifeCycle.js +28 -0
- package/cjs/tools/abstractLifeCycle.js.map +1 -0
- package/cjs/tools/boundedBuffer.d.ts +16 -0
- package/cjs/tools/boundedBuffer.js +32 -0
- package/cjs/tools/boundedBuffer.js.map +1 -0
- package/cjs/tools/catchUserErrors.d.ts +1 -0
- package/cjs/tools/catchUserErrors.js +15 -0
- package/cjs/tools/catchUserErrors.js.map +1 -0
- package/cjs/tools/display.d.ts +38 -0
- package/cjs/tools/display.js +44 -0
- package/cjs/tools/display.js.map +1 -0
- package/cjs/tools/encoder.d.ts +54 -0
- package/cjs/tools/encoder.js +40 -0
- package/cjs/tools/encoder.js.map +1 -0
- package/cjs/tools/experimentalFeatures.d.ts +21 -0
- package/cjs/tools/experimentalFeatures.js +50 -0
- package/cjs/tools/experimentalFeatures.js.map +1 -0
- package/cjs/tools/getZoneJsOriginalValue.d.ts +19 -0
- package/cjs/tools/getZoneJsOriginalValue.js +29 -0
- package/cjs/tools/getZoneJsOriginalValue.js.map +1 -0
- package/cjs/tools/globalObject.d.ts +19 -0
- package/cjs/tools/globalObject.js +44 -0
- package/cjs/tools/globalObject.js.map +1 -0
- package/cjs/tools/instrumentMethod.d.ts +75 -0
- package/cjs/tools/instrumentMethod.js +118 -0
- package/cjs/tools/instrumentMethod.js.map +1 -0
- package/cjs/tools/matchOption.d.ts +8 -0
- package/cjs/tools/matchOption.js +35 -0
- package/cjs/tools/matchOption.js.map +1 -0
- package/cjs/tools/mergeInto.d.ts +25 -0
- package/cjs/tools/mergeInto.js +98 -0
- package/cjs/tools/mergeInto.js.map +1 -0
- package/cjs/tools/monitor.d.ts +9 -0
- package/cjs/tools/monitor.js +62 -0
- package/cjs/tools/monitor.js.map +1 -0
- package/cjs/tools/observable.d.ts +30 -0
- package/cjs/tools/observable.js +89 -0
- package/cjs/tools/observable.js.map +1 -0
- package/cjs/tools/queueMicrotask.d.ts +1 -0
- package/cjs/tools/queueMicrotask.js +17 -0
- package/cjs/tools/queueMicrotask.js.map +1 -0
- package/cjs/tools/readBytesFromStream.d.ts +10 -0
- package/cjs/tools/readBytesFromStream.js +28 -0
- package/cjs/tools/readBytesFromStream.js.map +1 -0
- package/cjs/tools/requestIdleCallback.d.ts +12 -0
- package/cjs/tools/requestIdleCallback.js +35 -0
- package/cjs/tools/requestIdleCallback.js.map +1 -0
- package/cjs/tools/sendToExtension.d.ts +3 -0
- package/cjs/tools/sendToExtension.js +11 -0
- package/cjs/tools/sendToExtension.js.map +1 -0
- package/cjs/tools/serialisation/context.d.ts +9 -0
- package/cjs/tools/serialisation/context.js +3 -0
- package/cjs/tools/serialisation/context.js.map +1 -0
- package/cjs/tools/serialisation/jsonStringify.d.ts +13 -0
- package/cjs/tools/serialisation/jsonStringify.js +48 -0
- package/cjs/tools/serialisation/jsonStringify.js.map +1 -0
- package/cjs/tools/serialisation/sanitize.d.ts +18 -0
- package/cjs/tools/serialisation/sanitize.js +188 -0
- package/cjs/tools/serialisation/sanitize.js.map +1 -0
- package/cjs/tools/stackTrace/computeStackTrace.d.ts +25 -0
- package/cjs/tools/stackTrace/computeStackTrace.js +187 -0
- package/cjs/tools/stackTrace/computeStackTrace.js.map +1 -0
- package/cjs/tools/stackTrace/handlingStack.d.ts +10 -0
- package/cjs/tools/stackTrace/handlingStack.js +46 -0
- package/cjs/tools/stackTrace/handlingStack.js.map +1 -0
- package/cjs/tools/taskQueue.d.ts +15 -0
- package/cjs/tools/taskQueue.js +54 -0
- package/cjs/tools/taskQueue.js.map +1 -0
- package/cjs/tools/timer.d.ts +5 -0
- package/cjs/tools/timer.js +22 -0
- package/cjs/tools/timer.js.map +1 -0
- package/cjs/tools/utils/arrayUtils.d.ts +3 -0
- package/cjs/tools/utils/arrayUtils.js +20 -0
- package/cjs/tools/utils/arrayUtils.js.map +1 -0
- package/cjs/tools/utils/browserDetection.d.ts +8 -0
- package/cjs/tools/utils/browserDetection.js +33 -0
- package/cjs/tools/utils/browserDetection.js.map +1 -0
- package/cjs/tools/utils/byteUtils.d.ts +8 -0
- package/cjs/tools/utils/byteUtils.js +34 -0
- package/cjs/tools/utils/byteUtils.js.map +1 -0
- package/cjs/tools/utils/functionUtils.d.ts +8 -0
- package/cjs/tools/utils/functionUtils.js +43 -0
- package/cjs/tools/utils/functionUtils.js.map +1 -0
- package/cjs/tools/utils/numberUtils.d.ts +9 -0
- package/cjs/tools/utils/numberUtils.js +24 -0
- package/cjs/tools/utils/numberUtils.js.map +1 -0
- package/cjs/tools/utils/objectUtils.d.ts +10 -0
- package/cjs/tools/utils/objectUtils.js +23 -0
- package/cjs/tools/utils/objectUtils.js.map +1 -0
- package/cjs/tools/utils/polyfills.d.ts +7 -0
- package/cjs/tools/utils/polyfills.js +23 -0
- package/cjs/tools/utils/polyfills.js.map +1 -0
- package/cjs/tools/utils/responseUtils.d.ts +2 -0
- package/cjs/tools/utils/responseUtils.js +17 -0
- package/cjs/tools/utils/responseUtils.js.map +1 -0
- package/cjs/tools/utils/stringUtils.d.ts +23 -0
- package/cjs/tools/utils/stringUtils.js +91 -0
- package/cjs/tools/utils/stringUtils.js.map +1 -0
- package/cjs/tools/utils/timeUtils.d.ts +53 -0
- package/cjs/tools/utils/timeUtils.js +101 -0
- package/cjs/tools/utils/timeUtils.js.map +1 -0
- package/cjs/tools/utils/timezone.d.ts +1 -0
- package/cjs/tools/utils/timezone.js +13 -0
- package/cjs/tools/utils/timezone.js.map +1 -0
- package/cjs/tools/utils/typeUtils.d.ts +4 -0
- package/cjs/tools/utils/typeUtils.js +16 -0
- package/cjs/tools/utils/typeUtils.js.map +1 -0
- package/cjs/tools/utils/urlPolyfill.d.ts +5 -0
- package/cjs/tools/utils/urlPolyfill.js +59 -0
- package/cjs/tools/utils/urlPolyfill.js.map +1 -0
- package/cjs/tools/valueHistory.d.ts +27 -0
- package/cjs/tools/valueHistory.js +104 -0
- package/cjs/tools/valueHistory.js.map +1 -0
- package/cjs/transport/batch.d.ts +16 -0
- package/cjs/transport/batch.js +110 -0
- package/cjs/transport/batch.js.map +1 -0
- package/cjs/transport/eventBridge.d.ts +21 -0
- package/cjs/transport/eventBridge.js +46 -0
- package/cjs/transport/eventBridge.js.map +1 -0
- package/cjs/transport/flushController.d.ts +65 -0
- package/cjs/transport/flushController.js +123 -0
- package/cjs/transport/flushController.js.map +1 -0
- package/cjs/transport/httpRequest.d.ts +56 -0
- package/cjs/transport/httpRequest.js +95 -0
- package/cjs/transport/httpRequest.js.map +1 -0
- package/cjs/transport/index.d.ts +7 -0
- package/cjs/transport/index.js +15 -0
- package/cjs/transport/index.js.map +1 -0
- package/cjs/transport/sendWithRetryStrategy.d.ts +41 -0
- package/cjs/transport/sendWithRetryStrategy.js +163 -0
- package/cjs/transport/sendWithRetryStrategy.js.map +1 -0
- package/esm/boot/displayAlreadyInitializedError.d.ts +2 -0
- package/esm/boot/displayAlreadyInitializedError.js +7 -0
- package/esm/boot/displayAlreadyInitializedError.js.map +1 -0
- package/esm/boot/init.d.ts +14 -0
- package/esm/boot/init.js +35 -0
- package/esm/boot/init.js.map +1 -0
- package/esm/browser/addEventListener.d.ts +87 -0
- package/esm/browser/addEventListener.js +51 -0
- package/esm/browser/addEventListener.js.map +1 -0
- package/esm/browser/browser.types.d.ts +51 -0
- package/esm/browser/browser.types.js +5 -0
- package/esm/browser/browser.types.js.map +1 -0
- package/esm/browser/cookie.d.ts +28 -0
- package/esm/browser/cookie.js +103 -0
- package/esm/browser/cookie.js.map +1 -0
- package/esm/browser/fetchObservable.d.ts +38 -0
- package/esm/browser/fetchObservable.js +99 -0
- package/esm/browser/fetchObservable.js.map +1 -0
- package/esm/browser/pageMayExitObservable.d.ts +14 -0
- package/esm/browser/pageMayExitObservable.js +40 -0
- package/esm/browser/pageMayExitObservable.js.map +1 -0
- package/esm/browser/runOnReadyState.d.ts +5 -0
- package/esm/browser/runOnReadyState.js +16 -0
- package/esm/browser/runOnReadyState.js.map +1 -0
- package/esm/browser/xhrObservable.d.ts +24 -0
- package/esm/browser/xhrObservable.js +83 -0
- package/esm/browser/xhrObservable.js.map +1 -0
- package/esm/domain/allowedTrackingOrigins.d.ts +4 -0
- package/esm/domain/allowedTrackingOrigins.js +21 -0
- package/esm/domain/allowedTrackingOrigins.js.map +1 -0
- package/esm/domain/bufferedData.d.ts +14 -0
- package/esm/domain/bufferedData.js +19 -0
- package/esm/domain/bufferedData.js.map +1 -0
- package/esm/domain/configuration/configuration.d.ts +312 -0
- package/esm/domain/configuration/configuration.js +132 -0
- package/esm/domain/configuration/configuration.js.map +1 -0
- package/esm/domain/configuration/endpointBuilder.d.ts +12 -0
- package/esm/domain/configuration/endpointBuilder.js +77 -0
- package/esm/domain/configuration/endpointBuilder.js.map +1 -0
- package/esm/domain/configuration/index.d.ts +5 -0
- package/esm/domain/configuration/index.js +4 -0
- package/esm/domain/configuration/index.js.map +1 -0
- package/esm/domain/configuration/transportConfiguration.d.ts +20 -0
- package/esm/domain/configuration/transportConfiguration.js +50 -0
- package/esm/domain/configuration/transportConfiguration.js.map +1 -0
- package/esm/domain/connectivity/connectivity.d.ts +14 -0
- package/esm/domain/connectivity/connectivity.js +11 -0
- package/esm/domain/connectivity/connectivity.js.map +1 -0
- package/esm/domain/connectivity/index.d.ts +1 -0
- package/esm/domain/connectivity/index.js +2 -0
- package/esm/domain/connectivity/index.js.map +1 -0
- package/esm/domain/console/consoleObservable.d.ts +21 -0
- package/esm/domain/console/consoleObservable.js +80 -0
- package/esm/domain/console/consoleObservable.js.map +1 -0
- package/esm/domain/context/contextConstants.d.ts +21 -0
- package/esm/domain/context/contextConstants.js +15 -0
- package/esm/domain/context/contextConstants.js.map +1 -0
- package/esm/domain/context/contextManager.d.ts +19 -0
- package/esm/domain/context/contextManager.js +57 -0
- package/esm/domain/context/contextManager.js.map +1 -0
- package/esm/domain/context/contextUtils.d.ts +5 -0
- package/esm/domain/context/contextUtils.js +13 -0
- package/esm/domain/context/contextUtils.js.map +1 -0
- package/esm/domain/context/defineContextMethod.d.ts +6 -0
- package/esm/domain/context/defineContextMethod.js +17 -0
- package/esm/domain/context/defineContextMethod.js.map +1 -0
- package/esm/domain/context/storeContextManager.d.ts +6 -0
- package/esm/domain/context/storeContextManager.js +35 -0
- package/esm/domain/context/storeContextManager.js.map +1 -0
- package/esm/domain/contexts/accountContext.d.ts +26 -0
- package/esm/domain/contexts/accountContext.js +29 -0
- package/esm/domain/contexts/accountContext.js.map +1 -0
- package/esm/domain/contexts/globalContext.d.ts +18 -0
- package/esm/domain/contexts/globalContext.js +17 -0
- package/esm/domain/contexts/globalContext.js.map +1 -0
- package/esm/domain/contexts/rumInternalContext.type.d.ts +14 -0
- package/esm/domain/contexts/rumInternalContext.type.js +2 -0
- package/esm/domain/contexts/rumInternalContext.type.js.map +1 -0
- package/esm/domain/contexts/userContext.d.ts +29 -0
- package/esm/domain/contexts/userContext.js +41 -0
- package/esm/domain/contexts/userContext.js.map +1 -0
- package/esm/domain/deflate/deflate.types.d.ts +40 -0
- package/esm/domain/deflate/deflate.types.js +2 -0
- package/esm/domain/deflate/deflate.types.js.map +1 -0
- package/esm/domain/deflate/index.d.ts +1 -0
- package/esm/domain/deflate/index.js +2 -0
- package/esm/domain/deflate/index.js.map +1 -0
- package/esm/domain/error/error.d.ts +23 -0
- package/esm/domain/error/error.js +65 -0
- package/esm/domain/error/error.js.map +1 -0
- package/esm/domain/error/error.types.d.ts +47 -0
- package/esm/domain/error/error.types.js +10 -0
- package/esm/domain/error/error.types.js.map +1 -0
- package/esm/domain/error/trackRuntimeError.d.ts +11 -0
- package/esm/domain/error/trackRuntimeError.js +43 -0
- package/esm/domain/error/trackRuntimeError.js.map +1 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.d.ts +5 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js +38 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -0
- package/esm/domain/extension/extensionUtils.d.ts +10 -0
- package/esm/domain/extension/extensionUtils.js +25 -0
- package/esm/domain/extension/extensionUtils.js.map +1 -0
- package/esm/domain/intakeSites.d.ts +8 -0
- package/esm/domain/intakeSites.js +8 -0
- package/esm/domain/intakeSites.js.map +1 -0
- package/esm/domain/report/browser.types.d.ts +34 -0
- package/esm/domain/report/browser.types.js +2 -0
- package/esm/domain/report/browser.types.js.map +1 -0
- package/esm/domain/report/reportObservable.d.ts +14 -0
- package/esm/domain/report/reportObservable.js +95 -0
- package/esm/domain/report/reportObservable.js.map +1 -0
- package/esm/domain/resourceUtils.d.ts +18 -0
- package/esm/domain/resourceUtils.js +17 -0
- package/esm/domain/resourceUtils.js.map +1 -0
- package/esm/domain/session/oldCookiesMigration.d.ts +11 -0
- package/esm/domain/session/oldCookiesMigration.js +36 -0
- package/esm/domain/session/oldCookiesMigration.js.map +1 -0
- package/esm/domain/session/sessionConstants.d.ts +15 -0
- package/esm/domain/session/sessionConstants.js +13 -0
- package/esm/domain/session/sessionConstants.js.map +1 -0
- package/esm/domain/session/sessionManager.d.ts +28 -0
- package/esm/domain/session/sessionManager.js +196 -0
- package/esm/domain/session/sessionManager.js.map +1 -0
- package/esm/domain/session/sessionState.d.ts +16 -0
- package/esm/domain/session/sessionState.js +60 -0
- package/esm/domain/session/sessionState.js.map +1 -0
- package/esm/domain/session/sessionStateValidation.d.ts +3 -0
- package/esm/domain/session/sessionStateValidation.js +7 -0
- package/esm/domain/session/sessionStateValidation.js.map +1 -0
- package/esm/domain/session/sessionStore.d.ts +38 -0
- package/esm/domain/session/sessionStore.js +179 -0
- package/esm/domain/session/sessionStore.js.map +1 -0
- package/esm/domain/session/sessionStoreOperations.d.ts +12 -0
- package/esm/domain/session/sessionStoreOperations.js +114 -0
- package/esm/domain/session/sessionStoreOperations.js.map +1 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.d.ts +12 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.js +98 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.js.map +1 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.d.ts +6 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js +37 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.d.ts +16 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.js +2 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.js.map +1 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.d.ts +12 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.js +24 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.js.map +1 -0
- package/esm/domain/tags.d.ts +6 -0
- package/esm/domain/tags.js +60 -0
- package/esm/domain/tags.js.map +1 -0
- package/esm/domain/telemetry/index.d.ts +4 -0
- package/esm/domain/telemetry/index.js +3 -0
- package/esm/domain/telemetry/index.js.map +1 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.d.ts +18 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.js +6 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.js.map +1 -0
- package/esm/domain/telemetry/telemetry.d.ts +56 -0
- package/esm/domain/telemetry/telemetry.js +228 -0
- package/esm/domain/telemetry/telemetry.js.map +1 -0
- package/esm/domain/telemetry/telemetryEvent.types.d.ts +866 -0
- package/esm/domain/telemetry/telemetryEvent.types.js +6 -0
- package/esm/domain/telemetry/telemetryEvent.types.js.map +1 -0
- package/esm/domain/trackingConsent.d.ts +13 -0
- package/esm/domain/trackingConsent.js +24 -0
- package/esm/domain/trackingConsent.js.map +1 -0
- package/esm/index.d.ts +100 -0
- package/esm/index.js +76 -0
- package/esm/index.js.map +1 -0
- package/esm/tools/abstractHooks.d.ts +24 -0
- package/esm/tools/abstractHooks.js +37 -0
- package/esm/tools/abstractHooks.js.map +1 -0
- package/esm/tools/abstractLifeCycle.d.ts +23 -0
- package/esm/tools/abstractLifeCycle.js +24 -0
- package/esm/tools/abstractLifeCycle.js.map +1 -0
- package/esm/tools/boundedBuffer.d.ts +16 -0
- package/esm/tools/boundedBuffer.js +29 -0
- package/esm/tools/boundedBuffer.js.map +1 -0
- package/esm/tools/catchUserErrors.d.ts +1 -0
- package/esm/tools/catchUserErrors.js +12 -0
- package/esm/tools/catchUserErrors.js.map +1 -0
- package/esm/tools/display.d.ts +38 -0
- package/esm/tools/display.js +41 -0
- package/esm/tools/display.js.map +1 -0
- package/esm/tools/encoder.d.ts +54 -0
- package/esm/tools/encoder.js +37 -0
- package/esm/tools/encoder.js.map +1 -0
- package/esm/tools/experimentalFeatures.d.ts +21 -0
- package/esm/tools/experimentalFeatures.js +42 -0
- package/esm/tools/experimentalFeatures.js.map +1 -0
- package/esm/tools/getZoneJsOriginalValue.d.ts +19 -0
- package/esm/tools/getZoneJsOriginalValue.js +26 -0
- package/esm/tools/getZoneJsOriginalValue.js.map +1 -0
- package/esm/tools/globalObject.d.ts +19 -0
- package/esm/tools/globalObject.js +40 -0
- package/esm/tools/globalObject.js.map +1 -0
- package/esm/tools/instrumentMethod.d.ts +75 -0
- package/esm/tools/instrumentMethod.js +114 -0
- package/esm/tools/instrumentMethod.js.map +1 -0
- package/esm/tools/matchOption.d.ts +8 -0
- package/esm/tools/matchOption.js +31 -0
- package/esm/tools/matchOption.js.map +1 -0
- package/esm/tools/mergeInto.d.ts +25 -0
- package/esm/tools/mergeInto.js +93 -0
- package/esm/tools/mergeInto.js.map +1 -0
- package/esm/tools/monitor.d.ts +9 -0
- package/esm/tools/monitor.js +52 -0
- package/esm/tools/monitor.js.map +1 -0
- package/esm/tools/observable.d.ts +30 -0
- package/esm/tools/observable.js +83 -0
- package/esm/tools/observable.js.map +1 -0
- package/esm/tools/queueMicrotask.d.ts +1 -0
- package/esm/tools/queueMicrotask.js +14 -0
- package/esm/tools/queueMicrotask.js.map +1 -0
- package/esm/tools/readBytesFromStream.d.ts +10 -0
- package/esm/tools/readBytesFromStream.js +25 -0
- package/esm/tools/readBytesFromStream.js.map +1 -0
- package/esm/tools/requestIdleCallback.d.ts +12 -0
- package/esm/tools/requestIdleCallback.js +30 -0
- package/esm/tools/requestIdleCallback.js.map +1 -0
- package/esm/tools/sendToExtension.d.ts +3 -0
- package/esm/tools/sendToExtension.js +8 -0
- package/esm/tools/sendToExtension.js.map +1 -0
- package/esm/tools/serialisation/context.d.ts +9 -0
- package/esm/tools/serialisation/context.js +2 -0
- package/esm/tools/serialisation/context.js.map +1 -0
- package/esm/tools/serialisation/jsonStringify.d.ts +13 -0
- package/esm/tools/serialisation/jsonStringify.js +44 -0
- package/esm/tools/serialisation/jsonStringify.js.map +1 -0
- package/esm/tools/serialisation/sanitize.d.ts +18 -0
- package/esm/tools/serialisation/sanitize.js +185 -0
- package/esm/tools/serialisation/sanitize.js.map +1 -0
- package/esm/tools/stackTrace/computeStackTrace.d.ts +25 -0
- package/esm/tools/stackTrace/computeStackTrace.js +183 -0
- package/esm/tools/stackTrace/computeStackTrace.js.map +1 -0
- package/esm/tools/stackTrace/handlingStack.d.ts +10 -0
- package/esm/tools/stackTrace/handlingStack.js +41 -0
- package/esm/tools/stackTrace/handlingStack.js.map +1 -0
- package/esm/tools/taskQueue.d.ts +15 -0
- package/esm/tools/taskQueue.js +50 -0
- package/esm/tools/taskQueue.js.map +1 -0
- package/esm/tools/timer.d.ts +5 -0
- package/esm/tools/timer.js +16 -0
- package/esm/tools/timer.js.map +1 -0
- package/esm/tools/utils/arrayUtils.d.ts +3 -0
- package/esm/tools/utils/arrayUtils.js +15 -0
- package/esm/tools/utils/arrayUtils.js.map +1 -0
- package/esm/tools/utils/browserDetection.d.ts +8 -0
- package/esm/tools/utils/browserDetection.js +28 -0
- package/esm/tools/utils/browserDetection.js.map +1 -0
- package/esm/tools/utils/byteUtils.d.ts +8 -0
- package/esm/tools/utils/byteUtils.js +29 -0
- package/esm/tools/utils/byteUtils.js.map +1 -0
- package/esm/tools/utils/functionUtils.d.ts +8 -0
- package/esm/tools/utils/functionUtils.js +39 -0
- package/esm/tools/utils/functionUtils.js.map +1 -0
- package/esm/tools/utils/numberUtils.d.ts +9 -0
- package/esm/tools/utils/numberUtils.js +18 -0
- package/esm/tools/utils/numberUtils.js.map +1 -0
- package/esm/tools/utils/objectUtils.d.ts +10 -0
- package/esm/tools/utils/objectUtils.js +17 -0
- package/esm/tools/utils/objectUtils.js.map +1 -0
- package/esm/tools/utils/polyfills.d.ts +7 -0
- package/esm/tools/utils/polyfills.js +18 -0
- package/esm/tools/utils/polyfills.js.map +1 -0
- package/esm/tools/utils/responseUtils.d.ts +2 -0
- package/esm/tools/utils/responseUtils.js +13 -0
- package/esm/tools/utils/responseUtils.js.map +1 -0
- package/esm/tools/utils/stringUtils.d.ts +23 -0
- package/esm/tools/utils/stringUtils.js +84 -0
- package/esm/tools/utils/stringUtils.js.map +1 -0
- package/esm/tools/utils/timeUtils.d.ts +53 -0
- package/esm/tools/utils/timeUtils.js +84 -0
- package/esm/tools/utils/timeUtils.js.map +1 -0
- package/esm/tools/utils/timezone.d.ts +1 -0
- package/esm/tools/utils/timezone.js +10 -0
- package/esm/tools/utils/timezone.js.map +1 -0
- package/esm/tools/utils/typeUtils.d.ts +4 -0
- package/esm/tools/utils/typeUtils.js +13 -0
- package/esm/tools/utils/typeUtils.js.map +1 -0
- package/esm/tools/utils/urlPolyfill.d.ts +5 -0
- package/esm/tools/utils/urlPolyfill.js +52 -0
- package/esm/tools/utils/urlPolyfill.js.map +1 -0
- package/esm/tools/valueHistory.d.ts +27 -0
- package/esm/tools/valueHistory.js +100 -0
- package/esm/tools/valueHistory.js.map +1 -0
- package/esm/transport/batch.d.ts +16 -0
- package/esm/transport/batch.js +106 -0
- package/esm/transport/batch.js.map +1 -0
- package/esm/transport/eventBridge.d.ts +21 -0
- package/esm/transport/eventBridge.js +41 -0
- package/esm/transport/eventBridge.js.map +1 -0
- package/esm/transport/flushController.d.ts +65 -0
- package/esm/transport/flushController.js +119 -0
- package/esm/transport/flushController.js.map +1 -0
- package/esm/transport/httpRequest.d.ts +56 -0
- package/esm/transport/httpRequest.js +89 -0
- package/esm/transport/httpRequest.js.map +1 -0
- package/esm/transport/index.d.ts +7 -0
- package/esm/transport/index.js +5 -0
- package/esm/transport/index.js.map +1 -0
- package/esm/transport/sendWithRetryStrategy.d.ts +41 -0
- package/esm/transport/sendWithRetryStrategy.js +158 -0
- package/esm/transport/sendWithRetryStrategy.js.map +1 -0
- package/package.json +2 -2
- package/src/boot/displayAlreadyInitializedError.spec.ts +18 -0
- package/src/boot/displayAlreadyInitializedError.ts +1 -1
- package/src/boot/init.spec.ts +50 -0
- package/src/boot/init.ts +1 -1
- package/src/browser/addEventListener.spec.ts +141 -0
- package/src/browser/addEventListener.ts +2 -2
- package/src/browser/cookie.spec.ts +53 -0
- package/src/browser/fetchObservable.spec.ts +334 -0
- package/src/browser/pageMayExitObservable.spec.ts +56 -0
- package/src/browser/xhrObservable.spec.ts +405 -0
- package/src/domain/allowedTrackingOrigins.spec.ts +210 -0
- package/src/domain/bufferedData.spec.ts +34 -0
- package/src/domain/configuration/configuration.spec.ts +236 -0
- package/src/domain/configuration/configuration.ts +6 -5
- package/src/domain/configuration/endpointBuilder.spec.ts +173 -0
- package/src/domain/configuration/endpointBuilder.ts +18 -12
- package/src/domain/configuration/transportConfiguration.spec.ts +130 -0
- package/src/domain/connectivity/connectivity.spec.ts +50 -0
- package/src/domain/console/consoleObservable.spec.ts +151 -0
- package/src/domain/context/contextManager.spec.ts +152 -0
- package/src/domain/context/contextUtils.spec.ts +26 -0
- package/src/domain/context/storeContextManager.spec.ts +103 -0
- package/src/domain/context/storeContextManager.ts +1 -1
- package/src/domain/contexts/accountContext.spec.ts +99 -0
- package/src/domain/contexts/globalContext.spec.ts +88 -0
- package/src/domain/contexts/userContext.spec.ts +156 -0
- package/src/domain/error/error.spec.ts +294 -0
- package/src/domain/error/trackRuntimeError.spec.ts +343 -0
- package/src/domain/eventRateLimiter/createEventRateLimiter.spec.ts +119 -0
- package/src/domain/extension/extensionUtils.spec.ts +47 -0
- package/src/domain/report/reportObservable.spec.ts +71 -0
- package/src/domain/session/oldCookiesMigration.spec.ts +76 -0
- package/src/domain/session/sessionManager.spec.ts +684 -0
- package/src/domain/session/sessionState.spec.ts +88 -0
- package/src/domain/session/sessionStore.spec.ts +647 -0
- package/src/domain/session/sessionStoreOperations.spec.ts +234 -0
- package/src/domain/session/storeStrategies/sessionInCookie.spec.ts +228 -0
- package/src/domain/session/storeStrategies/sessionInLocalStorage.spec.ts +75 -0
- package/src/domain/synthetics/syntheticsWorkerValues.spec.ts +82 -0
- package/src/domain/tags.spec.ts +74 -0
- package/src/domain/telemetry/telemetry.spec.ts +494 -0
- package/src/domain/trackingConsent.spec.ts +44 -0
- package/src/tools/abstractHooks.spec.ts +76 -0
- package/src/tools/abstractLifeCycle.spec.ts +46 -0
- package/src/tools/boundedBuffer.spec.ts +40 -0
- package/src/tools/catchUserErrors.spec.ts +20 -0
- package/src/tools/display.ts +3 -3
- package/src/tools/encoder.spec.ts +112 -0
- package/src/tools/experimentalFeatures.spec.ts +60 -0
- package/src/tools/getZoneJsOriginalValue.spec.ts +36 -0
- package/src/tools/instrumentMethod.spec.ts +381 -0
- package/src/tools/matchOption.spec.ts +41 -0
- package/src/tools/mergeInto.spec.ts +198 -0
- package/src/tools/monitor.spec.ts +172 -0
- package/src/tools/observable.spec.ts +259 -0
- package/src/tools/queueMicrotask.spec.ts +24 -0
- package/src/tools/readBytesFromStream.spec.ts +62 -0
- package/src/tools/requestIdleCallback.spec.ts +65 -0
- package/src/tools/serialisation/jsonStringify.spec.ts +76 -0
- package/src/tools/serialisation/sanitize.spec.ts +284 -0
- package/src/tools/stackTrace/capturedExceptions.specHelper.ts +316 -0
- package/src/tools/stackTrace/computeStackTrace.spec.ts +1007 -0
- package/src/tools/stackTrace/handlingStack.spec.ts +20 -0
- package/src/tools/taskQueue.spec.ts +60 -0
- package/src/tools/timer.spec.ts +76 -0
- package/src/tools/utils/browserDetection.spec.ts +120 -0
- package/src/tools/utils/byteUtils.spec.ts +29 -0
- package/src/tools/utils/functionUtils.spec.ts +229 -0
- package/src/tools/utils/numberUtils.spec.ts +27 -0
- package/src/tools/utils/stringUtils.spec.ts +74 -0
- package/src/tools/utils/typeUtils.spec.ts +25 -0
- package/src/tools/utils/urlPolyfill.spec.ts +55 -0
- package/src/tools/valueHistory.spec.ts +180 -0
- package/src/transport/batch.spec.ts +261 -0
- package/src/transport/eventBridge.spec.ts +90 -0
- package/src/transport/flushController.spec.ts +267 -0
- package/src/transport/httpRequest.spec.ts +400 -0
- package/src/transport/httpRequest.ts +3 -3
- package/src/transport/sendWithRetryStrategy.spec.ts +393 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import type { RumEvent } from '../../../../rum-core/src'
|
|
2
|
+
import { EXHAUSTIVE_INIT_CONFIGURATION, SERIALIZED_EXHAUSTIVE_INIT_CONFIGURATION } from '../../../test'
|
|
3
|
+
import type { ExtractTelemetryConfiguration, MapInitConfigurationKey } from '../../../test'
|
|
4
|
+
import { DOCS_ORIGIN, MORE_DETAILS, display } from '../../tools/display'
|
|
5
|
+
import {
|
|
6
|
+
ExperimentalFeature,
|
|
7
|
+
isExperimentalFeatureEnabled,
|
|
8
|
+
resetExperimentalFeatures,
|
|
9
|
+
} from '../../tools/experimentalFeatures'
|
|
10
|
+
import { SessionPersistence } from '../session/sessionConstants'
|
|
11
|
+
import { TrackingConsent } from '../trackingConsent'
|
|
12
|
+
import type { InitConfiguration } from './configuration'
|
|
13
|
+
import { serializeConfiguration, validateAndBuildConfiguration } from './configuration'
|
|
14
|
+
|
|
15
|
+
describe('validateAndBuildConfiguration', () => {
|
|
16
|
+
const clientToken = 'some_client_token'
|
|
17
|
+
|
|
18
|
+
let displaySpy: jasmine.Spy<typeof display.error>
|
|
19
|
+
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
displaySpy = spyOn(display, 'error')
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
resetExperimentalFeatures()
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
describe('experimentalFeatures', () => {
|
|
29
|
+
const TEST_FEATURE_FLAG = 'foo' as ExperimentalFeature
|
|
30
|
+
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
;(ExperimentalFeature as any).FOO = TEST_FEATURE_FLAG
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
afterEach(() => {
|
|
36
|
+
delete (ExperimentalFeature as any).FOO
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('ignores unknown experimental features', () => {
|
|
40
|
+
validateAndBuildConfiguration({
|
|
41
|
+
clientToken,
|
|
42
|
+
enableExperimentalFeatures: ['bar', undefined as any, null as any, 11 as any],
|
|
43
|
+
})
|
|
44
|
+
expect(isExperimentalFeatureEnabled('bar' as any)).toBeFalse()
|
|
45
|
+
expect(isExperimentalFeatureEnabled(undefined as any)).toBeFalse()
|
|
46
|
+
expect(isExperimentalFeatureEnabled(null as any)).toBeFalse()
|
|
47
|
+
expect(isExperimentalFeatureEnabled(11 as any)).toBeFalse()
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
describe('validate init configuration', () => {
|
|
52
|
+
it('requires the InitConfiguration to be defined', () => {
|
|
53
|
+
expect(validateAndBuildConfiguration(undefined as unknown as InitConfiguration)).toBeUndefined()
|
|
54
|
+
expect(displaySpy).toHaveBeenCalledOnceWith('Client Token is not configured, we will not send any data.')
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it('requires clientToken to be defined', () => {
|
|
58
|
+
expect(validateAndBuildConfiguration({} as unknown as InitConfiguration)).toBeUndefined()
|
|
59
|
+
expect(displaySpy).toHaveBeenCalledOnceWith('Client Token is not configured, we will not send any data.')
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it("shouldn't display any error if the configuration is correct", () => {
|
|
63
|
+
validateAndBuildConfiguration({ clientToken: 'yes' })
|
|
64
|
+
expect(displaySpy).not.toHaveBeenCalled()
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
it('requires sessionSampleRate to be a percentage', () => {
|
|
68
|
+
expect(
|
|
69
|
+
validateAndBuildConfiguration({ clientToken, sessionSampleRate: 'foo' } as unknown as InitConfiguration)
|
|
70
|
+
).toBeUndefined()
|
|
71
|
+
expect(displaySpy).toHaveBeenCalledOnceWith('Session Sample Rate should be a number between 0 and 100')
|
|
72
|
+
|
|
73
|
+
displaySpy.calls.reset()
|
|
74
|
+
expect(
|
|
75
|
+
validateAndBuildConfiguration({ clientToken, sessionSampleRate: 200 } as unknown as InitConfiguration)
|
|
76
|
+
).toBeUndefined()
|
|
77
|
+
expect(displaySpy).toHaveBeenCalledOnceWith('Session Sample Rate should be a number between 0 and 100')
|
|
78
|
+
|
|
79
|
+
displaySpy.calls.reset()
|
|
80
|
+
validateAndBuildConfiguration({ clientToken: 'yes', sessionSampleRate: 1 })
|
|
81
|
+
expect(displaySpy).not.toHaveBeenCalled()
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it('requires telemetrySampleRate to be a percentage', () => {
|
|
85
|
+
expect(
|
|
86
|
+
validateAndBuildConfiguration({ clientToken, telemetrySampleRate: 'foo' } as unknown as InitConfiguration)
|
|
87
|
+
).toBeUndefined()
|
|
88
|
+
expect(displaySpy).toHaveBeenCalledOnceWith('Telemetry Sample Rate should be a number between 0 and 100')
|
|
89
|
+
|
|
90
|
+
displaySpy.calls.reset()
|
|
91
|
+
expect(
|
|
92
|
+
validateAndBuildConfiguration({ clientToken, telemetrySampleRate: 200 } as unknown as InitConfiguration)
|
|
93
|
+
).toBeUndefined()
|
|
94
|
+
expect(displaySpy).toHaveBeenCalledOnceWith('Telemetry Sample Rate should be a number between 0 and 100')
|
|
95
|
+
|
|
96
|
+
displaySpy.calls.reset()
|
|
97
|
+
validateAndBuildConfiguration({ clientToken: 'yes', telemetrySampleRate: 1 })
|
|
98
|
+
expect(displaySpy).not.toHaveBeenCalled()
|
|
99
|
+
})
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
describe('sessionStoreStrategyType', () => {
|
|
103
|
+
it('is present in the returned configuration', () => {
|
|
104
|
+
const configuration = validateAndBuildConfiguration({ clientToken })
|
|
105
|
+
expect(configuration!.sessionStoreStrategyType).toEqual({
|
|
106
|
+
type: SessionPersistence.COOKIE,
|
|
107
|
+
cookieOptions: { secure: false, crossSite: false, partitioned: false },
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
describe('beforeSend', () => {
|
|
113
|
+
it('should be undefined when beforeSend is missing on user configuration', () => {
|
|
114
|
+
const configuration = validateAndBuildConfiguration({ clientToken })!
|
|
115
|
+
expect(configuration.beforeSend).toBeUndefined()
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
it('should return the same result as the original', () => {
|
|
119
|
+
const beforeSend = (event: RumEvent) => {
|
|
120
|
+
if (event.view.url === '/foo') {
|
|
121
|
+
return false
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const configuration = validateAndBuildConfiguration({ clientToken, beforeSend })!
|
|
125
|
+
expect(configuration.beforeSend!({ view: { url: '/foo' } }, {})).toBeFalse()
|
|
126
|
+
expect(configuration.beforeSend!({ view: { url: '/bar' } }, {})).toBeUndefined()
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
it('should catch errors and log them', () => {
|
|
130
|
+
const myError = 'Ooops!'
|
|
131
|
+
const beforeSend = () => {
|
|
132
|
+
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
|
133
|
+
throw myError
|
|
134
|
+
}
|
|
135
|
+
const configuration = validateAndBuildConfiguration({ clientToken, beforeSend })!
|
|
136
|
+
expect(configuration.beforeSend!(null, {})).toBeUndefined()
|
|
137
|
+
expect(displaySpy).toHaveBeenCalledWith('beforeSend threw an error:', myError)
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
describe('allowUntrustedEvents', () => {
|
|
142
|
+
it('defaults to false', () => {
|
|
143
|
+
expect(validateAndBuildConfiguration({ clientToken: 'yes' })!.allowUntrustedEvents).toBeFalse()
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
it('is set to provided value', () => {
|
|
147
|
+
expect(
|
|
148
|
+
validateAndBuildConfiguration({ clientToken: 'yes', allowUntrustedEvents: true })!.allowUntrustedEvents
|
|
149
|
+
).toBeTrue()
|
|
150
|
+
expect(
|
|
151
|
+
validateAndBuildConfiguration({ clientToken: 'yes', allowUntrustedEvents: false })!.allowUntrustedEvents
|
|
152
|
+
).toBeFalse()
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
it('the provided value is cast to boolean', () => {
|
|
156
|
+
expect(
|
|
157
|
+
validateAndBuildConfiguration({ clientToken: 'yes', allowUntrustedEvents: 'foo' as any })!.allowUntrustedEvents
|
|
158
|
+
).toBeTrue()
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
describe('trackingConsent', () => {
|
|
163
|
+
it('defaults to "granted"', () => {
|
|
164
|
+
expect(validateAndBuildConfiguration({ clientToken: 'yes' })!.trackingConsent).toBe(TrackingConsent.GRANTED)
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
it('is set to provided value', () => {
|
|
168
|
+
expect(
|
|
169
|
+
validateAndBuildConfiguration({ clientToken: 'yes', trackingConsent: TrackingConsent.NOT_GRANTED })!
|
|
170
|
+
.trackingConsent
|
|
171
|
+
).toBe(TrackingConsent.NOT_GRANTED)
|
|
172
|
+
expect(
|
|
173
|
+
validateAndBuildConfiguration({ clientToken: 'yes', trackingConsent: TrackingConsent.GRANTED })!.trackingConsent
|
|
174
|
+
).toBe(TrackingConsent.GRANTED)
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
it('rejects invalid values', () => {
|
|
178
|
+
expect(validateAndBuildConfiguration({ clientToken: 'yes', trackingConsent: 'foo' as any })).toBeUndefined()
|
|
179
|
+
expect(displaySpy).toHaveBeenCalledOnceWith('Tracking Consent should be either "granted" or "not-granted"')
|
|
180
|
+
})
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
describe('site parameter validation', () => {
|
|
184
|
+
it('should validate the site parameter', () => {
|
|
185
|
+
validateAndBuildConfiguration({ clientToken, site: 'foo.com' as any })
|
|
186
|
+
expect(displaySpy).toHaveBeenCalledOnceWith(
|
|
187
|
+
`Site should be a valid Datadog site. ${MORE_DETAILS} ${DOCS_ORIGIN}/getting_started/site/.`
|
|
188
|
+
)
|
|
189
|
+
})
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
describe('env parameter validation', () => {
|
|
193
|
+
it('should validate the env parameter', () => {
|
|
194
|
+
validateAndBuildConfiguration({ clientToken, env: false as any })
|
|
195
|
+
expect(displaySpy).toHaveBeenCalledOnceWith('Env must be defined as a string')
|
|
196
|
+
})
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
describe('service parameter validation', () => {
|
|
200
|
+
it('should validate the service parameter', () => {
|
|
201
|
+
validateAndBuildConfiguration({ clientToken, service: 1 as any })
|
|
202
|
+
expect(displaySpy).toHaveBeenCalledOnceWith('Service must be defined as a string')
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
it('should not reject null', () => {
|
|
206
|
+
const configuration = validateAndBuildConfiguration({ clientToken, service: null })
|
|
207
|
+
expect(displaySpy).not.toHaveBeenCalled()
|
|
208
|
+
expect(configuration!.service).toBeUndefined()
|
|
209
|
+
})
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
describe('version parameter validation', () => {
|
|
213
|
+
it('should validate the version parameter', () => {
|
|
214
|
+
validateAndBuildConfiguration({ clientToken, version: 0 as any })
|
|
215
|
+
expect(displaySpy).toHaveBeenCalledOnceWith('Version must be defined as a string')
|
|
216
|
+
})
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
describe('allowedTrackingOrigins parameter validation', () => {
|
|
220
|
+
it('should validate the allowedTrackingOrigins parameter', () => {
|
|
221
|
+
validateAndBuildConfiguration({ clientToken, allowedTrackingOrigins: 'foo' as any })
|
|
222
|
+
expect(displaySpy).toHaveBeenCalledOnceWith('Allowed Tracking Origins must be an array')
|
|
223
|
+
})
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
describe('serializeConfiguration', () => {
|
|
227
|
+
it('should serialize the configuration', () => {
|
|
228
|
+
// By specifying the type here, we can ensure that serializeConfiguration is returning an
|
|
229
|
+
// object containing all expected properties.
|
|
230
|
+
const serializedConfiguration: ExtractTelemetryConfiguration<MapInitConfigurationKey<keyof InitConfiguration>> =
|
|
231
|
+
serializeConfiguration(EXHAUSTIVE_INIT_CONFIGURATION)
|
|
232
|
+
|
|
233
|
+
expect(serializedConfiguration).toEqual(SERIALIZED_EXHAUSTIVE_INIT_CONFIGURATION)
|
|
234
|
+
})
|
|
235
|
+
})
|
|
236
|
+
})
|
|
@@ -348,11 +348,12 @@ function isString(tag: unknown, tagName: string): tag is string | undefined | nu
|
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
function isDatadogSite(site: unknown) {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
351
|
+
return true;
|
|
352
|
+
// if (site && typeof site === 'string' && !/(datadog|ddog|datad0g|dd0g)/.test(site)) {
|
|
353
|
+
// display.error(`Site should be a valid Datadog site. ${MORE_DETAILS} ${DOCS_ORIGIN}/getting_started/site/.`)
|
|
354
|
+
// return false
|
|
355
|
+
// }
|
|
356
|
+
// return true
|
|
356
357
|
}
|
|
357
358
|
|
|
358
359
|
export function isSampleRate(sampleRate: unknown, name: string) {
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { Payload } from '../../transport'
|
|
2
|
+
import type { InitConfiguration } from './configuration'
|
|
3
|
+
import { createEndpointBuilder } from './endpointBuilder'
|
|
4
|
+
|
|
5
|
+
const DEFAULT_PAYLOAD = {} as Payload
|
|
6
|
+
|
|
7
|
+
describe('endpointBuilder', () => {
|
|
8
|
+
const clientToken = 'some_client_token'
|
|
9
|
+
let initConfiguration: InitConfiguration
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
initConfiguration = { clientToken, apiVersion: 'v1', organizationIdentifier: 'xyz', insecureHTTP: false }
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
describe('query parameters', () => {
|
|
16
|
+
it('should add intake query parameters', () => {
|
|
17
|
+
expect(createEndpointBuilder(initConfiguration, 'rum').build('fetch', DEFAULT_PAYLOAD)).toMatch(
|
|
18
|
+
`&o2-api-key=${clientToken}&o2-evp-origin-version=(.*)&o2-evp-origin=browser&o2-request-id=(.*)`
|
|
19
|
+
)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('should add batch_time for rum endpoint', () => {
|
|
23
|
+
expect(createEndpointBuilder(initConfiguration, 'rum').build('fetch', DEFAULT_PAYLOAD)).toContain('&batch_time=')
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('should not add batch_time for logs and replay endpoints', () => {
|
|
27
|
+
expect(createEndpointBuilder(initConfiguration, 'logs').build('fetch', DEFAULT_PAYLOAD)).not.toContain(
|
|
28
|
+
'&batch_time='
|
|
29
|
+
)
|
|
30
|
+
expect(createEndpointBuilder(initConfiguration, 'replay').build('fetch', DEFAULT_PAYLOAD)).not.toContain(
|
|
31
|
+
'&batch_time='
|
|
32
|
+
)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('should add the provided encoding', () => {
|
|
36
|
+
expect(
|
|
37
|
+
createEndpointBuilder(initConfiguration, 'rum').build('fetch', { ...DEFAULT_PAYLOAD, encoding: 'deflate' })
|
|
38
|
+
).toContain('&dd-evp-encoding=deflate')
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it('should not start with o2source for internal analytics mode', () => {
|
|
42
|
+
const url = createEndpointBuilder({ ...initConfiguration, internalAnalyticsSubdomain: 'foo' }, 'rum').build(
|
|
43
|
+
'fetch',
|
|
44
|
+
DEFAULT_PAYLOAD
|
|
45
|
+
)
|
|
46
|
+
expect(url).not.toContain('/rum?o2source')
|
|
47
|
+
expect(url).toContain('o2source=browser')
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('accepts extra parameters', () => {
|
|
51
|
+
const extraParameters = ['application.id=1234', 'application.version=1.0.0']
|
|
52
|
+
const url = createEndpointBuilder(initConfiguration, 'rum', extraParameters).build('fetch', DEFAULT_PAYLOAD)
|
|
53
|
+
expect(url).toContain('application.id=1234')
|
|
54
|
+
expect(url).toContain('application.version=1.0.0')
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
describe('proxy configuration', () => {
|
|
59
|
+
it('should replace the intake endpoint by the proxy and set the intake path and parameters in the attribute ooforward', () => {
|
|
60
|
+
expect(
|
|
61
|
+
createEndpointBuilder({ ...initConfiguration, proxy: 'https://proxy.io/path' }, 'rum').build(
|
|
62
|
+
'fetch',
|
|
63
|
+
DEFAULT_PAYLOAD
|
|
64
|
+
)
|
|
65
|
+
).toMatch(
|
|
66
|
+
`https://proxy.io/path\\?ooforward=${encodeURIComponent(
|
|
67
|
+
`/rum/v2/rum?o2source=(.*)&o2-api-key=${clientToken}` +
|
|
68
|
+
'&o2-evp-origin-version=(.*)&o2-evp-origin=browser&o2-request-id=(.*)&batch_time=(.*)'
|
|
69
|
+
)}`
|
|
70
|
+
)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
it('normalizes the proxy url', () => {
|
|
74
|
+
const endpoint = createEndpointBuilder({ ...initConfiguration, proxy: '/path' }, 'rum').build(
|
|
75
|
+
'fetch',
|
|
76
|
+
DEFAULT_PAYLOAD
|
|
77
|
+
)
|
|
78
|
+
expect(endpoint.startsWith(`${location.origin}/path?ooforward`)).toBeTrue()
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
it('should allow to fully control the proxy url', () => {
|
|
82
|
+
const proxyFn = (options: { path: string; parameters: string }) =>
|
|
83
|
+
`https://proxy.io/prefix${options.path}/suffix?${options.parameters}`
|
|
84
|
+
expect(
|
|
85
|
+
createEndpointBuilder({ ...initConfiguration, proxy: proxyFn }, 'rum').build('fetch', DEFAULT_PAYLOAD)
|
|
86
|
+
).toMatch(
|
|
87
|
+
`https://proxy.io/prefix/api/v2/rum/suffix\\?oosource=(.*)&o2-api-key=${clientToken}&o2-evp-origin-version=(.*)&o2-evp-origin=browser&o2-request-id=(.*)&batch_time=(.*)`
|
|
88
|
+
)
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
describe('_o2 attributes', () => {
|
|
93
|
+
it('should contain api', () => {
|
|
94
|
+
expect(createEndpointBuilder(initConfiguration, 'rum').build('fetch', DEFAULT_PAYLOAD)).toContain('_o2.api=fetch')
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
it('should contain retry infos', () => {
|
|
98
|
+
expect(
|
|
99
|
+
createEndpointBuilder(initConfiguration, 'rum').build('fetch', {
|
|
100
|
+
...DEFAULT_PAYLOAD,
|
|
101
|
+
retry: {
|
|
102
|
+
count: 5,
|
|
103
|
+
lastFailureStatus: 408,
|
|
104
|
+
},
|
|
105
|
+
})
|
|
106
|
+
).toContain('_oo.retry_count=5&_oo.retry_after=408')
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
it('should not contain any _oo attributes for non rum endpoints', () => {
|
|
110
|
+
expect(
|
|
111
|
+
createEndpointBuilder(initConfiguration, 'logs').build('fetch', {
|
|
112
|
+
...DEFAULT_PAYLOAD,
|
|
113
|
+
retry: {
|
|
114
|
+
count: 5,
|
|
115
|
+
lastFailureStatus: 408,
|
|
116
|
+
},
|
|
117
|
+
})
|
|
118
|
+
).not.toContain('_o2.api=fetch&_o2.retry_count=5&_o2.retry_after=408')
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
describe('PCI compliance intake with option', () => {
|
|
123
|
+
it('should return PCI compliance intake endpoint if site is us1', () => {
|
|
124
|
+
const config: InitConfiguration & { usePciIntake?: boolean } = {
|
|
125
|
+
clientToken,
|
|
126
|
+
usePciIntake: true,
|
|
127
|
+
site: 'datadoghq.com',
|
|
128
|
+
}
|
|
129
|
+
expect(createEndpointBuilder(config, 'logs').build('fetch', DEFAULT_PAYLOAD)).toContain(
|
|
130
|
+
'https://pci.browser-intake-datadoghq.com'
|
|
131
|
+
)
|
|
132
|
+
})
|
|
133
|
+
it('should not return PCI compliance intake endpoint if site is not us1', () => {
|
|
134
|
+
const config: InitConfiguration & { usePciIntake?: boolean } = {
|
|
135
|
+
clientToken,
|
|
136
|
+
usePciIntake: true,
|
|
137
|
+
site: 'ap1.datadoghq.com',
|
|
138
|
+
}
|
|
139
|
+
expect(createEndpointBuilder(config, 'logs').build('fetch', DEFAULT_PAYLOAD)).not.toContain(
|
|
140
|
+
'https://pci.browser-intake-datadoghq.com'
|
|
141
|
+
)
|
|
142
|
+
})
|
|
143
|
+
it('should not return PCI compliance intake endpoint if and site is us1 and track is not logs', () => {
|
|
144
|
+
const config: InitConfiguration & { usePciIntake?: boolean } = {
|
|
145
|
+
clientToken,
|
|
146
|
+
usePciIntake: true,
|
|
147
|
+
site: 'datadoghq.com',
|
|
148
|
+
}
|
|
149
|
+
expect(createEndpointBuilder(config, 'rum').build('fetch', DEFAULT_PAYLOAD)).not.toContain(
|
|
150
|
+
'https://pci.browser-intake-datadoghq.com'
|
|
151
|
+
)
|
|
152
|
+
})
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
describe('source configuration', () => {
|
|
156
|
+
it('should use the default source when no configuration is provided', () => {
|
|
157
|
+
const endpoint = createEndpointBuilder(initConfiguration, 'rum').build('fetch', DEFAULT_PAYLOAD)
|
|
158
|
+
expect(endpoint).toContain('ddsource=browser')
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
it('should use flutter source when provided', () => {
|
|
162
|
+
const config = { ...initConfiguration, source: 'flutter' as const }
|
|
163
|
+
const endpoint = createEndpointBuilder(config, 'rum').build('fetch', DEFAULT_PAYLOAD)
|
|
164
|
+
expect(endpoint).toContain('ddsource=flutter')
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
it('should use unity source when provided', () => {
|
|
168
|
+
const config = { ...initConfiguration, source: 'unity' as const }
|
|
169
|
+
const endpoint = createEndpointBuilder(config, 'rum').build('fetch', DEFAULT_PAYLOAD)
|
|
170
|
+
expect(endpoint).toContain('ddsource=unity')
|
|
171
|
+
})
|
|
172
|
+
})
|
|
173
|
+
})
|
|
@@ -25,7 +25,7 @@ export function createEndpointBuilder(
|
|
|
25
25
|
extraParameters?: string[]
|
|
26
26
|
) {
|
|
27
27
|
const buildUrlWithParameters = createEndpointUrlWithParametersBuilder(initConfiguration, trackType)
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
return {
|
|
30
30
|
build(api: ApiType, payload: Payload) {
|
|
31
31
|
const parameters = buildEndpointParameters(initConfiguration, trackType, api, payload, extraParameters)
|
|
@@ -44,19 +44,20 @@ function createEndpointUrlWithParametersBuilder(
|
|
|
44
44
|
initConfiguration: InitConfiguration,
|
|
45
45
|
trackType: TrackType
|
|
46
46
|
): (parameters: string) => string {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
const path = `/rum/${apiVersion}/${organizationIdentifier}/${INTAKE_TRACKS[trackType]}`
|
|
47
|
+
// const path = `/api/v2/${trackType}`
|
|
48
|
+
const { proxy, apiVersion, organizationIdentifier, insecureHTTP } = initConfiguration
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
const path = `/rum/${apiVersion}/${organizationIdentifier}/${trackType}`
|
|
51
|
+
if (typeof proxy === 'string') {
|
|
52
52
|
const normalizedProxyUrl = normalizeUrl(proxy)
|
|
53
|
-
return (parameters) => `${normalizedProxyUrl}?
|
|
53
|
+
return (parameters) => `${normalizedProxyUrl}?o2forward=${encodeURIComponent(`${path}?${parameters}`)}`
|
|
54
54
|
}
|
|
55
55
|
if (typeof proxy === 'function') {
|
|
56
56
|
return (parameters) => proxy({ path, parameters })
|
|
57
57
|
}
|
|
58
58
|
const host = buildEndpointHost(trackType, initConfiguration)
|
|
59
|
-
|
|
59
|
+
const protocol = insecureHTTP ? 'http' : 'https'
|
|
60
|
+
return (parameters) => `${protocol}://${host}${path}?${parameters}`
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
export function buildEndpointHost(
|
|
@@ -66,6 +67,11 @@ export function buildEndpointHost(
|
|
|
66
67
|
const { site = INTAKE_SITE_US1, internalAnalyticsSubdomain } = initConfiguration
|
|
67
68
|
|
|
68
69
|
return site
|
|
70
|
+
|
|
71
|
+
if (trackType === 'logs' && initConfiguration.usePciIntake && site === INTAKE_SITE_US1) {
|
|
72
|
+
return PCI_INTAKE_HOST_US1
|
|
73
|
+
}
|
|
74
|
+
|
|
69
75
|
if (internalAnalyticsSubdomain && site === INTAKE_SITE_US1) {
|
|
70
76
|
return `${internalAnalyticsSubdomain}.${INTAKE_SITE_US1}`
|
|
71
77
|
}
|
|
@@ -91,7 +97,7 @@ function buildEndpointParameters(
|
|
|
91
97
|
extraParameters: string[] = []
|
|
92
98
|
) {
|
|
93
99
|
const parameters = [
|
|
94
|
-
|
|
100
|
+
`o2source=${source}`,
|
|
95
101
|
`o2-api-key=${clientToken}`,
|
|
96
102
|
`o2-evp-origin-version=${encodeURIComponent(__BUILD_ENV__SDK_VERSION__)}`,
|
|
97
103
|
'o2-evp-origin=browser',
|
|
@@ -99,14 +105,14 @@ function buildEndpointParameters(
|
|
|
99
105
|
].concat(extraParameters)
|
|
100
106
|
|
|
101
107
|
if (encoding) {
|
|
102
|
-
parameters.push(`
|
|
108
|
+
parameters.push(`o2-evp-encoding=${encoding}`)
|
|
103
109
|
}
|
|
104
110
|
|
|
105
111
|
if (trackType === 'rum') {
|
|
106
|
-
parameters.push(`batch_time=${timeStampNow()}`, `
|
|
112
|
+
parameters.push(`batch_time=${timeStampNow()}`, `_o2.api=${api}`)
|
|
107
113
|
|
|
108
114
|
if (retry) {
|
|
109
|
-
parameters.push(`
|
|
115
|
+
parameters.push(`_o2.retry_count=${retry.count}`, `_o2.retry_after=${retry.lastFailureStatus}`)
|
|
110
116
|
}
|
|
111
117
|
}
|
|
112
118
|
|
|
@@ -115,4 +121,4 @@ function buildEndpointParameters(
|
|
|
115
121
|
}
|
|
116
122
|
|
|
117
123
|
return parameters.join('&')
|
|
118
|
-
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { INTAKE_SITE_FED_STAGING } from '../intakeSites'
|
|
2
|
+
import type { Payload } from '../../transport'
|
|
3
|
+
import { computeTransportConfiguration, isIntakeUrl } from './transportConfiguration'
|
|
4
|
+
|
|
5
|
+
const DEFAULT_PAYLOAD = {} as Payload
|
|
6
|
+
|
|
7
|
+
describe('transportConfiguration', () => {
|
|
8
|
+
const clientToken = 'some_client_token'
|
|
9
|
+
const internalAnalyticsSubdomain = 'ia-rum-intake'
|
|
10
|
+
const intakeParameters = 'ddsource=browser&dd-api-key=xxxx&dd-request-id=1234567890'
|
|
11
|
+
|
|
12
|
+
describe('site', () => {
|
|
13
|
+
it('should use US site by default', () => {
|
|
14
|
+
const configuration = computeTransportConfiguration({ clientToken })
|
|
15
|
+
expect(configuration.rumEndpointBuilder.build('fetch', DEFAULT_PAYLOAD)).toContain('openobserve.ai')
|
|
16
|
+
expect(configuration.site).toBe('openobserve.ai')
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('should use logs intake domain for fed staging', () => {
|
|
20
|
+
const configuration = computeTransportConfiguration({ clientToken, site: INTAKE_SITE_FED_STAGING })
|
|
21
|
+
expect(configuration.rumEndpointBuilder.build('fetch', DEFAULT_PAYLOAD)).toContain(
|
|
22
|
+
'http-intake.logs.dd0g-gov.com'
|
|
23
|
+
)
|
|
24
|
+
expect(configuration.site).toBe(INTAKE_SITE_FED_STAGING)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('should use site value when set', () => {
|
|
28
|
+
const configuration = computeTransportConfiguration({ clientToken, site: 'openobserve.ai' })
|
|
29
|
+
expect(configuration.rumEndpointBuilder.build('fetch', DEFAULT_PAYLOAD)).toContain('openobserve.ai')
|
|
30
|
+
expect(configuration.site).toBe('openobserve.ai')
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
describe('internalAnalyticsSubdomain', () => {
|
|
35
|
+
it('should use internal analytics subdomain value when set for openobserve.ai site', () => {
|
|
36
|
+
const configuration = computeTransportConfiguration({
|
|
37
|
+
clientToken,
|
|
38
|
+
internalAnalyticsSubdomain,
|
|
39
|
+
})
|
|
40
|
+
expect(configuration.rumEndpointBuilder.build('fetch', DEFAULT_PAYLOAD)).toContain(internalAnalyticsSubdomain)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('should not use internal analytics subdomain value when set for other sites', () => {
|
|
44
|
+
const configuration = computeTransportConfiguration({
|
|
45
|
+
clientToken,
|
|
46
|
+
site: 'us3.datadoghq.com',
|
|
47
|
+
internalAnalyticsSubdomain,
|
|
48
|
+
})
|
|
49
|
+
expect(configuration.rumEndpointBuilder.build('fetch', DEFAULT_PAYLOAD)).not.toContain(internalAnalyticsSubdomain)
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it('adds the replica application id to the rum replica endpoint', () => {
|
|
54
|
+
const replicaApplicationId = 'replica-application-id'
|
|
55
|
+
const configuration = computeTransportConfiguration({
|
|
56
|
+
clientToken,
|
|
57
|
+
replica: {
|
|
58
|
+
clientToken: 'replica-client-token',
|
|
59
|
+
applicationId: replicaApplicationId,
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
expect(configuration.replica!.rumEndpointBuilder.build('fetch', DEFAULT_PAYLOAD)).toContain(
|
|
63
|
+
`application.id=${replicaApplicationId}`
|
|
64
|
+
)
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
describe('isIntakeUrl', () => {
|
|
68
|
+
const v1IntakePath = `/v1/input/${clientToken}`
|
|
69
|
+
;[
|
|
70
|
+
{ expectSubdomain: true, site: 'api.openobserve.ai', intakeDomain: 'api.openobserve.ai' },
|
|
71
|
+
].forEach(({ site, intakeDomain, expectSubdomain }) => {
|
|
72
|
+
it(`should detect intake request for ${site} site`, () => {
|
|
73
|
+
const configuration = computeTransportConfiguration({ clientToken, site })
|
|
74
|
+
|
|
75
|
+
expect(configuration.isIntakeUrl(`https://${intakeDomain}/rum/v2/rum?xxx`)).toBe(expectSubdomain)
|
|
76
|
+
expect(configuration.isIntakeUrl(`https://${intakeDomain}/rum/v2/logs?xxx`)).toBe(expectSubdomain)
|
|
77
|
+
expect(configuration.isIntakeUrl(`https://${intakeDomain}/rum/v2/replay?xxx`)).toBe(
|
|
78
|
+
expectSubdomain
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
expect(configuration.isIntakeUrl(`https://${intakeDomain}/rum/v2/rum?xxx`)).toBe(!expectSubdomain)
|
|
82
|
+
expect(configuration.isIntakeUrl(`https://${intakeDomain}/rum/v2/logs?xxx`)).toBe(!expectSubdomain)
|
|
83
|
+
expect(configuration.isIntakeUrl(`https://${intakeDomain}/rum/v2/replay?xxx`)).toBe(!expectSubdomain)
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
it('should detect internal analytics intake request for openobserve.ai site', () => {
|
|
88
|
+
const configuration = computeTransportConfiguration({
|
|
89
|
+
clientToken,
|
|
90
|
+
internalAnalyticsSubdomain,
|
|
91
|
+
})
|
|
92
|
+
expect(configuration.isIntakeUrl(`https://api.openobserve.ai/rum/v2/rum?xxx`)).toBe(true)
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
it('should not detect non intake request', () => {
|
|
96
|
+
expect(isIntakeUrl('https://www.foo.com')).toBe(false)
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
describe('proxy configuration', () => {
|
|
100
|
+
it('should detect proxy intake request', () => {
|
|
101
|
+
expect(
|
|
102
|
+
isIntakeUrl(`https://www.proxy.com/?ooforward=${encodeURIComponent(`/api/v2/rum?${intakeParameters}`)}`)
|
|
103
|
+
).toBe(true)
|
|
104
|
+
expect(
|
|
105
|
+
isIntakeUrl(
|
|
106
|
+
`https://www.proxy.com/custom/path?ooforward=${encodeURIComponent(`/api/v2/rum?${intakeParameters}`)}`
|
|
107
|
+
)
|
|
108
|
+
).toBe(true)
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it('should not detect request done on the same host as the proxy', () => {
|
|
112
|
+
expect(isIntakeUrl('https://www.proxy.com/foo')).toBe(false)
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
;[
|
|
116
|
+
{ site: 'openobserve.ai' },
|
|
117
|
+
].forEach(({ site }) => {
|
|
118
|
+
it(`should detect replica intake request for site ${site}`, () => {
|
|
119
|
+
expect(isIntakeUrl(`https://${internalAnalyticsSubdomain}.openobserve.ai/api/v2/rum?${intakeParameters}`)).toBe(
|
|
120
|
+
true
|
|
121
|
+
)
|
|
122
|
+
expect(isIntakeUrl(`https://${internalAnalyticsSubdomain}.openobserve.ai/api/v2/logs?${intakeParameters}`)).toBe(
|
|
123
|
+
true
|
|
124
|
+
)
|
|
125
|
+
expect(
|
|
126
|
+
isIntakeUrl(`https://${internalAnalyticsSubdomain}.openobserve.ai/api/v2/replay?${intakeParameters}`)
|
|
127
|
+
).toBe(true)
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
})
|