@openobserve/browser-core 0.2.12-beta.21 → 0.2.12-beta.23
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 +1 -1
- package/cjs/boot/init.d.ts +1 -1
- package/cjs/boot/init.js +1 -1
- package/cjs/browser/addEventListener.d.ts +1 -1
- package/cjs/browser/addEventListener.js +1 -1
- package/cjs/domain/configuration/configuration.js +5 -4
- package/cjs/domain/configuration/configuration.js.map +1 -1
- package/cjs/domain/configuration/endpointBuilder.js +21 -12
- package/cjs/domain/configuration/endpointBuilder.js.map +1 -1
- package/cjs/domain/context/storeContextManager.js +1 -1
- package/cjs/domain/tags.js +1 -1
- package/cjs/domain/telemetry/telemetry.js +2 -2
- 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 +81 -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 +1 -1
- package/src/boot/displayAlreadyInitializedError.ts +1 -1
- package/src/boot/init.ts +1 -1
- package/src/browser/addEventListener.ts +2 -2
- package/src/domain/configuration/configuration.ts +6 -5
- package/src/domain/configuration/endpointBuilder.ts +25 -15
- package/src/domain/context/storeContextManager.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deflate.types.js","sourceRoot":"","sources":["../../../src/domain/deflate/deflate.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './deflate.types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/deflate/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ClocksState } from '../../tools/utils/timeUtils';
|
|
2
|
+
import type { Context } from '../../tools/serialisation/context';
|
|
3
|
+
import type { StackTrace } from '../../tools/stackTrace/computeStackTrace';
|
|
4
|
+
import type { ErrorSource, ErrorHandling, RawError, RawErrorCause, ErrorWithCause, NonErrorPrefix } from './error.types';
|
|
5
|
+
export declare const NO_ERROR_STACK_PRESENT_MESSAGE = "No stack, consider using an instance of Error";
|
|
6
|
+
interface RawErrorParams {
|
|
7
|
+
stackTrace?: StackTrace;
|
|
8
|
+
originalError: unknown;
|
|
9
|
+
handlingStack?: string;
|
|
10
|
+
componentStack?: string;
|
|
11
|
+
startClocks: ClocksState;
|
|
12
|
+
nonErrorPrefix: NonErrorPrefix;
|
|
13
|
+
useFallbackStack?: boolean;
|
|
14
|
+
source: ErrorSource;
|
|
15
|
+
handling: ErrorHandling;
|
|
16
|
+
}
|
|
17
|
+
export declare function computeRawError({ stackTrace, originalError, handlingStack, componentStack, startClocks, nonErrorPrefix, useFallbackStack, source, handling, }: RawErrorParams): RawError;
|
|
18
|
+
export declare function tryToGetFingerprint(originalError: unknown): string | undefined;
|
|
19
|
+
export declare function tryToGetErrorContext(originalError: unknown): Context | undefined;
|
|
20
|
+
export declare function getFileFromStackTraceString(stack: string): string | undefined;
|
|
21
|
+
export declare function isError(error: unknown): error is Error;
|
|
22
|
+
export declare function flattenErrorCauses(error: ErrorWithCause, parentSource: ErrorSource): RawErrorCause[] | undefined;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { sanitize } from '../../tools/serialisation/sanitize';
|
|
2
|
+
import { jsonStringify } from '../../tools/serialisation/jsonStringify';
|
|
3
|
+
import { computeStackTrace } from '../../tools/stackTrace/computeStackTrace';
|
|
4
|
+
import { toStackTraceString } from '../../tools/stackTrace/handlingStack';
|
|
5
|
+
export const NO_ERROR_STACK_PRESENT_MESSAGE = 'No stack, consider using an instance of Error';
|
|
6
|
+
export function computeRawError({ stackTrace, originalError, handlingStack, componentStack, startClocks, nonErrorPrefix, useFallbackStack = true, source, handling, }) {
|
|
7
|
+
const isErrorInstance = isError(originalError);
|
|
8
|
+
if (!stackTrace && isErrorInstance) {
|
|
9
|
+
stackTrace = computeStackTrace(originalError);
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
startClocks,
|
|
13
|
+
source,
|
|
14
|
+
handling,
|
|
15
|
+
handlingStack,
|
|
16
|
+
componentStack,
|
|
17
|
+
originalError,
|
|
18
|
+
type: stackTrace ? stackTrace.name : undefined,
|
|
19
|
+
message: computeMessage(stackTrace, isErrorInstance, nonErrorPrefix, originalError),
|
|
20
|
+
stack: stackTrace ? toStackTraceString(stackTrace) : useFallbackStack ? NO_ERROR_STACK_PRESENT_MESSAGE : undefined,
|
|
21
|
+
causes: isErrorInstance ? flattenErrorCauses(originalError, source) : undefined,
|
|
22
|
+
fingerprint: tryToGetFingerprint(originalError),
|
|
23
|
+
context: tryToGetErrorContext(originalError),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function computeMessage(stackTrace, isErrorInstance, nonErrorPrefix, originalError) {
|
|
27
|
+
// Favor stackTrace message only if tracekit has really been able to extract something meaningful (message + name)
|
|
28
|
+
// TODO rework tracekit integration to avoid scattering error building logic
|
|
29
|
+
return (stackTrace === null || stackTrace === void 0 ? void 0 : stackTrace.message) && (stackTrace === null || stackTrace === void 0 ? void 0 : stackTrace.name)
|
|
30
|
+
? stackTrace.message
|
|
31
|
+
: !isErrorInstance
|
|
32
|
+
? `${nonErrorPrefix} ${jsonStringify(sanitize(originalError))}`
|
|
33
|
+
: 'Empty message';
|
|
34
|
+
}
|
|
35
|
+
export function tryToGetFingerprint(originalError) {
|
|
36
|
+
return isError(originalError) && 'oo_fingerprint' in originalError ? String(originalError.oo_fingerprint) : undefined;
|
|
37
|
+
}
|
|
38
|
+
export function tryToGetErrorContext(originalError) {
|
|
39
|
+
if (originalError !== null && typeof originalError === 'object' && 'dd_context' in originalError) {
|
|
40
|
+
return originalError.dd_context;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export function getFileFromStackTraceString(stack) {
|
|
44
|
+
var _a;
|
|
45
|
+
return (_a = /@ (.+)/.exec(stack)) === null || _a === void 0 ? void 0 : _a[1];
|
|
46
|
+
}
|
|
47
|
+
export function isError(error) {
|
|
48
|
+
return error instanceof Error || Object.prototype.toString.call(error) === '[object Error]';
|
|
49
|
+
}
|
|
50
|
+
export function flattenErrorCauses(error, parentSource) {
|
|
51
|
+
let currentError = error;
|
|
52
|
+
const causes = [];
|
|
53
|
+
while (isError(currentError === null || currentError === void 0 ? void 0 : currentError.cause) && causes.length < 10) {
|
|
54
|
+
const stackTrace = computeStackTrace(currentError.cause);
|
|
55
|
+
causes.push({
|
|
56
|
+
message: currentError.cause.message,
|
|
57
|
+
source: parentSource,
|
|
58
|
+
type: stackTrace === null || stackTrace === void 0 ? void 0 : stackTrace.name,
|
|
59
|
+
stack: stackTrace && toStackTraceString(stackTrace),
|
|
60
|
+
});
|
|
61
|
+
currentError = currentError.cause;
|
|
62
|
+
}
|
|
63
|
+
return causes.length ? causes : undefined;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/domain/error/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAA;AAG7D,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAEvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAA;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAA;AAGzE,MAAM,CAAC,MAAM,8BAA8B,GAAG,+CAA+C,CAAA;AAc7F,MAAM,UAAU,eAAe,CAAC,EAC9B,UAAU,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,EACX,cAAc,EACd,gBAAgB,GAAG,IAAI,EACvB,MAAM,EACN,QAAQ,GACO;IACf,MAAM,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;IAC9C,IAAI,CAAC,UAAU,IAAI,eAAe,EAAE,CAAC;QACnC,UAAU,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAA;IAC/C,CAAC;IAED,OAAO;QACL,WAAW;QACX,MAAM;QACN,QAAQ;QACR,aAAa;QACb,cAAc;QACd,aAAa;QACb,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;QAC9C,OAAO,EAAE,cAAc,CAAC,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,CAAC;QACnF,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,kBAAkB,CAAC,UAAU,CAA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,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,KAAc;IACpC,OAAO,KAAK,YAAY,KAAK,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,gBAAgB,CAAA;AAC7F,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAqB,EAAE,YAAyB;IACjF,IAAI,YAAY,GAAG,KAAK,CAAA;IACxB,MAAM,MAAM,GAAoB,EAAE,CAAA;IAClC,OAAO,OAAO,CAAC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QAC1D,MAAM,UAAU,GAAG,iBAAiB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;QACxD,MAAM,CAAC,IAAI,CAAC;YACV,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,OAAO;YACnC,MAAM,EAAE,YAAY;YACpB,IAAI,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI;YACtB,KAAK,EAAE,UAAU,IAAI,kBAAkB,CAAC,UAAU,CAAC;SACpD,CAAC,CAAA;QACF,YAAY,GAAG,YAAY,CAAC,KAAK,CAAA;IACnC,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;AAC3C,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Context } from '../../tools/serialisation/context';
|
|
2
|
+
import type { ClocksState } from '../../tools/utils/timeUtils';
|
|
3
|
+
export interface ErrorWithCause extends Omit<Error, 'cause'> {
|
|
4
|
+
cause?: unknown;
|
|
5
|
+
}
|
|
6
|
+
export interface RawErrorCause {
|
|
7
|
+
message: string;
|
|
8
|
+
source: ErrorSource;
|
|
9
|
+
type?: string;
|
|
10
|
+
stack?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface Csp {
|
|
13
|
+
disposition: 'enforce' | 'report';
|
|
14
|
+
}
|
|
15
|
+
export interface RawError {
|
|
16
|
+
startClocks: ClocksState;
|
|
17
|
+
message: string;
|
|
18
|
+
type?: string;
|
|
19
|
+
stack?: string;
|
|
20
|
+
source: ErrorSource;
|
|
21
|
+
originalError?: unknown;
|
|
22
|
+
handling?: ErrorHandling;
|
|
23
|
+
handlingStack?: string;
|
|
24
|
+
componentStack?: string;
|
|
25
|
+
causes?: RawErrorCause[];
|
|
26
|
+
fingerprint?: string;
|
|
27
|
+
csp?: Csp;
|
|
28
|
+
context?: Context;
|
|
29
|
+
}
|
|
30
|
+
export declare const ErrorSource: {
|
|
31
|
+
readonly AGENT: "agent";
|
|
32
|
+
readonly CONSOLE: "console";
|
|
33
|
+
readonly CUSTOM: "custom";
|
|
34
|
+
readonly LOGGER: "logger";
|
|
35
|
+
readonly NETWORK: "network";
|
|
36
|
+
readonly SOURCE: "source";
|
|
37
|
+
readonly REPORT: "report";
|
|
38
|
+
};
|
|
39
|
+
export declare const enum NonErrorPrefix {
|
|
40
|
+
UNCAUGHT = "Uncaught",
|
|
41
|
+
PROVIDED = "Provided"
|
|
42
|
+
}
|
|
43
|
+
export declare const enum ErrorHandling {
|
|
44
|
+
HANDLED = "handled",
|
|
45
|
+
UNHANDLED = "unhandled"
|
|
46
|
+
}
|
|
47
|
+
export type ErrorSource = (typeof ErrorSource)[keyof typeof ErrorSource];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.types.js","sourceRoot":"","sources":["../../../src/domain/error/error.types.ts"],"names":[],"mappings":"AA2CA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACR,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Observable } from '../../tools/observable';
|
|
2
|
+
import type { StackTrace } from '../../tools/stackTrace/computeStackTrace';
|
|
3
|
+
import type { RawError } from './error.types';
|
|
4
|
+
export type UnhandledErrorCallback = (originalError: unknown, stackTrace?: StackTrace) => any;
|
|
5
|
+
export declare function trackRuntimeError(): Observable<RawError>;
|
|
6
|
+
export declare function instrumentOnError(callback: UnhandledErrorCallback): {
|
|
7
|
+
stop: typeof import("../..").noop;
|
|
8
|
+
};
|
|
9
|
+
export declare function instrumentUnhandledRejection(callback: UnhandledErrorCallback): {
|
|
10
|
+
stop: typeof import("../..").noop;
|
|
11
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { instrumentMethod } from '../../tools/instrumentMethod';
|
|
2
|
+
import { Observable } from '../../tools/observable';
|
|
3
|
+
import { clocksNow } from '../../tools/utils/timeUtils';
|
|
4
|
+
import { computeStackTraceFromOnErrorMessage } from '../../tools/stackTrace/computeStackTrace';
|
|
5
|
+
import { getGlobalObject } from '../../tools/globalObject';
|
|
6
|
+
import { computeRawError, isError } from './error';
|
|
7
|
+
import { ErrorSource } from './error.types';
|
|
8
|
+
export function trackRuntimeError() {
|
|
9
|
+
return new Observable((observer) => {
|
|
10
|
+
const handleRuntimeError = (originalError, stackTrace) => {
|
|
11
|
+
const rawError = computeRawError({
|
|
12
|
+
stackTrace,
|
|
13
|
+
originalError,
|
|
14
|
+
startClocks: clocksNow(),
|
|
15
|
+
nonErrorPrefix: "Uncaught" /* NonErrorPrefix.UNCAUGHT */,
|
|
16
|
+
source: ErrorSource.SOURCE,
|
|
17
|
+
handling: "unhandled" /* ErrorHandling.UNHANDLED */,
|
|
18
|
+
});
|
|
19
|
+
observer.notify(rawError);
|
|
20
|
+
};
|
|
21
|
+
const { stop: stopInstrumentingOnError } = instrumentOnError(handleRuntimeError);
|
|
22
|
+
const { stop: stopInstrumentingOnUnhandledRejection } = instrumentUnhandledRejection(handleRuntimeError);
|
|
23
|
+
return () => {
|
|
24
|
+
stopInstrumentingOnError();
|
|
25
|
+
stopInstrumentingOnUnhandledRejection();
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export function instrumentOnError(callback) {
|
|
30
|
+
return instrumentMethod(getGlobalObject(), 'onerror', ({ parameters: [messageObj, url, line, column, errorObj] }) => {
|
|
31
|
+
let stackTrace;
|
|
32
|
+
if (!isError(errorObj)) {
|
|
33
|
+
stackTrace = computeStackTraceFromOnErrorMessage(messageObj, url, line, column);
|
|
34
|
+
}
|
|
35
|
+
callback(errorObj !== null && errorObj !== void 0 ? errorObj : messageObj, stackTrace);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export function instrumentUnhandledRejection(callback) {
|
|
39
|
+
return instrumentMethod(getGlobalObject(), 'onunhandledrejection', ({ parameters: [e] }) => {
|
|
40
|
+
callback(e.reason || 'Empty reason');
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=trackRuntimeError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackRuntimeError.js","sourceRoot":"","sources":["../../../src/domain/error/trackRuntimeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAEvD,OAAO,EAAE,mCAAmC,EAAE,MAAM,0CAA0C,CAAA;AAC9F,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAElD,OAAO,EAAiB,WAAW,EAAkB,MAAM,eAAe,CAAA;AAI1E,MAAM,UAAU,iBAAiB;IAC/B,OAAO,IAAI,UAAU,CAAW,CAAC,QAAQ,EAAE,EAAE;QAC3C,MAAM,kBAAkB,GAAG,CAAC,aAAs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,CAAC,EAAE,EAAE,EAAE;QACzF,QAAQ,CAAC,CAAC,CAAC,MAAM,IAAI,cAAc,CAAC,CAAA;IACtC,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RawError } from '../error/error.types';
|
|
2
|
+
export type EventRateLimiter = ReturnType<typeof createEventRateLimiter>;
|
|
3
|
+
export declare function createEventRateLimiter(eventType: string, onLimitReached: (limitError: RawError) => void, limit?: number): {
|
|
4
|
+
isLimitReached(): boolean;
|
|
5
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { setTimeout } from '../../tools/timer';
|
|
2
|
+
import { clocksNow, ONE_MINUTE } from '../../tools/utils/timeUtils';
|
|
3
|
+
import { ErrorSource } from '../error/error.types';
|
|
4
|
+
// Limit the maximum number of actions, errors and logs per minutes
|
|
5
|
+
const EVENT_RATE_LIMIT = 3000;
|
|
6
|
+
export function createEventRateLimiter(eventType, onLimitReached, limit = EVENT_RATE_LIMIT) {
|
|
7
|
+
let eventCount = 0;
|
|
8
|
+
let allowNextEvent = false;
|
|
9
|
+
return {
|
|
10
|
+
isLimitReached() {
|
|
11
|
+
if (eventCount === 0) {
|
|
12
|
+
setTimeout(() => {
|
|
13
|
+
eventCount = 0;
|
|
14
|
+
}, ONE_MINUTE);
|
|
15
|
+
}
|
|
16
|
+
eventCount += 1;
|
|
17
|
+
if (eventCount <= limit || allowNextEvent) {
|
|
18
|
+
allowNextEvent = false;
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (eventCount === limit + 1) {
|
|
22
|
+
allowNextEvent = true;
|
|
23
|
+
try {
|
|
24
|
+
onLimitReached({
|
|
25
|
+
message: `Reached max number of ${eventType}s by minute: ${limit}`,
|
|
26
|
+
source: ErrorSource.AGENT,
|
|
27
|
+
startClocks: clocksNow(),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
allowNextEvent = false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=createEventRateLimiter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createEventRateLimiter.js","sourceRoot":"","sources":["../../../src/domain/eventRateLimiter/createEventRateLimiter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAIlD,mEAAmE;AACnE,MAAM,gBAAgB,GAAG,IAAI,CAAA;AAE7B,MAAM,UAAU,sBAAsB,CACpC,SAAiB,EACjB,cAA8C,EAC9C,KAAK,GAAG,gBAAgB;IAExB,IAAI,UAAU,GAAG,CAAC,CAAA;IAClB,IAAI,cAAc,GAAG,KAAK,CAAA;IAE1B,OAAO;QACL,cAAc;YACZ,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;gBACrB,UAAU,CAAC,GAAG,EAAE;oBACd,UAAU,GAAG,CAAC,CAAA;gBAChB,CAAC,EAAE,UAAU,CAAC,CAAA;YAChB,CAAC;YAED,UAAU,IAAI,CAAC,CAAA;YACf,IAAI,UAAU,IAAI,KAAK,IAAI,cAAc,EAAE,CAAC;gBAC1C,cAAc,GAAG,KAAK,CAAA;gBACtB,OAAO,KAAK,CAAA;YACd,CAAC;YAED,IAAI,UAAU,KAAK,KAAK,GAAG,CAAC,EAAE,CAAC;gBAC7B,cAAc,GAAG,IAAI,CAAA;gBACrB,IAAI,CAAC;oBACH,cAAc,CAAC;wBACb,OAAO,EAAE,yBAAyB,SAAS,gBAAgB,KAAK,EAAE;wBAClE,MAAM,EAAE,WAAW,CAAC,KAAK;wBACzB,WAAW,EAAE,SAAS,EAAE;qBACzB,CAAC,CAAA;gBACJ,CAAC;wBAAS,CAAC;oBACT,cAAc,GAAG,KAAK,CAAA;gBACxB,CAAC;YACH,CAAC;YAED,OAAO,IAAI,CAAA;QACb,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const EXTENSION_PREFIXES: string[];
|
|
2
|
+
export declare function containsExtensionUrl(str: string): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Utility function to detect if the SDK is being initialized in an unsupported browser extension environment.
|
|
5
|
+
*
|
|
6
|
+
* @param windowLocation - The current window location to check
|
|
7
|
+
* @param stack - The error stack to check for extension URLs
|
|
8
|
+
* @returns true if running in an unsupported browser extension environment
|
|
9
|
+
*/
|
|
10
|
+
export declare function isUnsupportedExtensionEnvironment(windowLocation: string, stack?: string): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const EXTENSION_PREFIXES = ['chrome-extension://', 'moz-extension://'];
|
|
2
|
+
export function containsExtensionUrl(str) {
|
|
3
|
+
return EXTENSION_PREFIXES.some((prefix) => str.includes(prefix));
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Utility function to detect if the SDK is being initialized in an unsupported browser extension environment.
|
|
7
|
+
*
|
|
8
|
+
* @param windowLocation - The current window location to check
|
|
9
|
+
* @param stack - The error stack to check for extension URLs
|
|
10
|
+
* @returns true if running in an unsupported browser extension environment
|
|
11
|
+
*/
|
|
12
|
+
export function isUnsupportedExtensionEnvironment(windowLocation, stack = '') {
|
|
13
|
+
// If the page itself is an extension page.
|
|
14
|
+
if (containsExtensionUrl(windowLocation)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
// Since we generate the error on the init, we check the 2nd frame line.
|
|
18
|
+
const frameLines = stack.split('\n').filter((line) => {
|
|
19
|
+
const trimmedLine = line.trim();
|
|
20
|
+
return trimmedLine.length && /^at\s+|@/.test(trimmedLine);
|
|
21
|
+
});
|
|
22
|
+
const target = frameLines[1] || '';
|
|
23
|
+
return containsExtensionUrl(target);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=extensionUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensionUtils.js","sourceRoot":"","sources":["../../../src/domain/extension/extensionUtils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,CAAA;AAE7E,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;AAClE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iCAAiC,CAAC,cAAsB,EAAE,QAAgB,EAAE;IAC1F,2CAA2C;IAC3C,IAAI,oBAAoB,CAAC,cAAc,CAAC,EAAE,CAAC;QACzC,OAAO,KAAK,CAAA;IACd,CAAC;IAED,wEAAwE;IACxE,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QACnD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;QAC/B,OAAO,WAAW,CAAC,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IAC3D,CAAC,CAAC,CAAA;IACF,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IAElC,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAA;AACrC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type Site = 'datadoghq.com' | 'us3.datadoghq.com' | 'us5.datadoghq.com' | 'datadoghq.eu' | 'ddog-gov.com' | 'ap1.datadoghq.com' | 'ap2.datadoghq.com' | (string & {});
|
|
2
|
+
export declare const INTAKE_SITE_STAGING: Site;
|
|
3
|
+
export declare const INTAKE_SITE_FED_STAGING: Site;
|
|
4
|
+
export declare const INTAKE_SITE_US1: Site;
|
|
5
|
+
export declare const INTAKE_SITE_EU1: Site;
|
|
6
|
+
export declare const INTAKE_SITE_US1_FED: Site;
|
|
7
|
+
export declare const PCI_INTAKE_HOST_US1 = "pci.browser-intake-datadoghq.com";
|
|
8
|
+
export declare const INTAKE_URL_PARAMETERS: string[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const INTAKE_SITE_STAGING = 'datad0g.com';
|
|
2
|
+
export const INTAKE_SITE_FED_STAGING = 'dd0g-gov.com';
|
|
3
|
+
export const INTAKE_SITE_US1 = 'datadoghq.com';
|
|
4
|
+
export const INTAKE_SITE_EU1 = 'datadoghq.eu';
|
|
5
|
+
export const INTAKE_SITE_US1_FED = 'ddog-gov.com';
|
|
6
|
+
export const PCI_INTAKE_HOST_US1 = 'pci.browser-intake-datadoghq.com';
|
|
7
|
+
export const INTAKE_URL_PARAMETERS = ['ddsource', 'dd-api-key', 'dd-request-id'];
|
|
8
|
+
//# sourceMappingURL=intakeSites.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intakeSites.js","sourceRoot":"","sources":["../../src/domain/intakeSites.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,mBAAmB,GAAS,aAAa,CAAA;AACtD,MAAM,CAAC,MAAM,uBAAuB,GAAS,cAAc,CAAA;AAC3D,MAAM,CAAC,MAAM,eAAe,GAAS,eAAe,CAAA;AACpD,MAAM,CAAC,MAAM,eAAe,GAAS,cAAc,CAAA;AACnD,MAAM,CAAC,MAAM,mBAAmB,GAAS,cAAc,CAAA;AAEvD,MAAM,CAAC,MAAM,mBAAmB,GAAG,kCAAkC,CAAA;AACrE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,UAAU,EAAE,YAAY,EAAE,eAAe,CAAC,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type ReportType = DeprecationReport['type'] | InterventionReport['type'];
|
|
2
|
+
interface Report {
|
|
3
|
+
type: ReportType;
|
|
4
|
+
url: string;
|
|
5
|
+
body: DeprecationReportBody | InterventionReportBody;
|
|
6
|
+
toJSON(): any;
|
|
7
|
+
}
|
|
8
|
+
interface ReportBody {
|
|
9
|
+
toJSON(): any;
|
|
10
|
+
}
|
|
11
|
+
export interface DeprecationReport extends Report {
|
|
12
|
+
type: 'deprecation';
|
|
13
|
+
body: DeprecationReportBody;
|
|
14
|
+
}
|
|
15
|
+
export interface DeprecationReportBody extends ReportBody {
|
|
16
|
+
id: string;
|
|
17
|
+
message: string;
|
|
18
|
+
lineNumber: number | null;
|
|
19
|
+
columnNumber: number | null;
|
|
20
|
+
sourceFile: string | null;
|
|
21
|
+
anticipatedRemoval: Date | null;
|
|
22
|
+
}
|
|
23
|
+
export interface InterventionReport extends Report {
|
|
24
|
+
type: 'intervention';
|
|
25
|
+
body: InterventionReportBody;
|
|
26
|
+
}
|
|
27
|
+
export interface InterventionReportBody extends ReportBody {
|
|
28
|
+
id: string;
|
|
29
|
+
message: string;
|
|
30
|
+
lineNumber: number | null;
|
|
31
|
+
columnNumber: number | null;
|
|
32
|
+
sourceFile: string | null;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.types.js","sourceRoot":"","sources":["../../../src/domain/report/browser.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Observable } from '../../tools/observable';
|
|
2
|
+
import type { Configuration } from '../configuration';
|
|
3
|
+
import type { RawError } from '../error/error.types';
|
|
4
|
+
import type { InterventionReport, DeprecationReport } from './browser.types';
|
|
5
|
+
export declare const RawReportType: {
|
|
6
|
+
readonly intervention: "intervention";
|
|
7
|
+
readonly deprecation: "deprecation";
|
|
8
|
+
readonly cspViolation: "csp_violation";
|
|
9
|
+
};
|
|
10
|
+
export type RawReportType = (typeof RawReportType)[keyof typeof RawReportType];
|
|
11
|
+
export type RawReportError = RawError & {
|
|
12
|
+
originalError: SecurityPolicyViolationEvent | DeprecationReport | InterventionReport;
|
|
13
|
+
};
|
|
14
|
+
export declare function initReportObservable(configuration: Configuration, apis: RawReportType[]): Observable<RawReportError>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { toStackTraceString } from '../../tools/stackTrace/handlingStack';
|
|
2
|
+
import { monitor } from '../../tools/monitor';
|
|
3
|
+
import { mergeObservables, Observable } from '../../tools/observable';
|
|
4
|
+
import { addEventListener } from '../../browser/addEventListener';
|
|
5
|
+
import { safeTruncate } from '../../tools/utils/stringUtils';
|
|
6
|
+
import { ErrorSource } from '../error/error.types';
|
|
7
|
+
import { clocksNow } from '../../tools/utils/timeUtils';
|
|
8
|
+
export const RawReportType = {
|
|
9
|
+
intervention: 'intervention',
|
|
10
|
+
deprecation: 'deprecation',
|
|
11
|
+
cspViolation: 'csp_violation',
|
|
12
|
+
};
|
|
13
|
+
export function initReportObservable(configuration, apis) {
|
|
14
|
+
const observables = [];
|
|
15
|
+
if (apis.includes(RawReportType.cspViolation)) {
|
|
16
|
+
observables.push(createCspViolationReportObservable(configuration));
|
|
17
|
+
}
|
|
18
|
+
const reportTypes = apis.filter((api) => api !== RawReportType.cspViolation);
|
|
19
|
+
if (reportTypes.length) {
|
|
20
|
+
observables.push(createReportObservable(reportTypes));
|
|
21
|
+
}
|
|
22
|
+
return mergeObservables(...observables);
|
|
23
|
+
}
|
|
24
|
+
function createReportObservable(reportTypes) {
|
|
25
|
+
return new Observable((observable) => {
|
|
26
|
+
if (!window.ReportingObserver) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const handleReports = monitor((reports, _) => reports.forEach((report) => observable.notify(buildRawReportErrorFromReport(report))));
|
|
30
|
+
const observer = new window.ReportingObserver(handleReports, {
|
|
31
|
+
types: reportTypes,
|
|
32
|
+
buffered: true,
|
|
33
|
+
});
|
|
34
|
+
observer.observe();
|
|
35
|
+
return () => {
|
|
36
|
+
observer.disconnect();
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function createCspViolationReportObservable(configuration) {
|
|
41
|
+
return new Observable((observable) => {
|
|
42
|
+
const { stop } = addEventListener(configuration, document, "securitypolicyviolation" /* DOM_EVENT.SECURITY_POLICY_VIOLATION */, (event) => {
|
|
43
|
+
observable.notify(buildRawReportErrorFromCspViolation(event));
|
|
44
|
+
});
|
|
45
|
+
return stop;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function buildRawReportErrorFromReport(report) {
|
|
49
|
+
const { type, body } = report;
|
|
50
|
+
return buildRawReportError({
|
|
51
|
+
type: body.id,
|
|
52
|
+
message: `${type}: ${body.message}`,
|
|
53
|
+
originalError: report,
|
|
54
|
+
stack: buildStack(body.id, body.message, body.sourceFile, body.lineNumber, body.columnNumber),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function buildRawReportErrorFromCspViolation(event) {
|
|
58
|
+
const message = `'${event.blockedURI}' blocked by '${event.effectiveDirective}' directive`;
|
|
59
|
+
return buildRawReportError({
|
|
60
|
+
type: event.effectiveDirective,
|
|
61
|
+
message: `${RawReportType.cspViolation}: ${message}`,
|
|
62
|
+
originalError: event,
|
|
63
|
+
csp: {
|
|
64
|
+
disposition: event.disposition,
|
|
65
|
+
},
|
|
66
|
+
stack: buildStack(event.effectiveDirective, event.originalPolicy
|
|
67
|
+
? `${message} of the policy "${safeTruncate(event.originalPolicy, 100, '...')}"`
|
|
68
|
+
: 'no policy', event.sourceFile, event.lineNumber, event.columnNumber),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function buildRawReportError(partial) {
|
|
72
|
+
return {
|
|
73
|
+
startClocks: clocksNow(),
|
|
74
|
+
source: ErrorSource.REPORT,
|
|
75
|
+
handling: "unhandled" /* ErrorHandling.UNHANDLED */,
|
|
76
|
+
...partial,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function buildStack(name, message, sourceFile, lineNumber, columnNumber) {
|
|
80
|
+
return sourceFile
|
|
81
|
+
? toStackTraceString({
|
|
82
|
+
name,
|
|
83
|
+
message,
|
|
84
|
+
stack: [
|
|
85
|
+
{
|
|
86
|
+
func: '?',
|
|
87
|
+
url: sourceFile,
|
|
88
|
+
line: lineNumber !== null && lineNumber !== void 0 ? lineNumber : undefined,
|
|
89
|
+
column: columnNumber !== null && columnNumber !== void 0 ? columnNumber : undefined,
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
})
|
|
93
|
+
: undefined;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=reportObservable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reportObservable.js","sourceRoot":"","sources":["../../../src/domain/report/reportObservable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACrE,OAAO,EAAE,gBAAgB,EAAa,MAAM,gCAAgC,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAG5D,OAAO,EAAiB,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAGvD,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,YAAY,EAAE,cAAc;IAC5B,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,eAAe;CACrB,CAAA;AAQV,MAAM,UAAU,oBAAoB,CAAC,aAA4B,EAAE,IAAqB;IACtF,MAAM,WAAW,GAAsC,EAAE,CAAA;IAEzD,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9C,WAAW,CAAC,IAAI,CAAC,kCAAkC,CAAC,aAAa,CAAC,CAAC,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;QACxB,MAAM,EAAE,WAAW,CAAC,MAAM;QAC1B,QAAQ,2CAAyB;QACjC,GAAG,OAAO;KACX,CAAA;AACH,CAAC;AAED,SAAS,UAAU,CACjB,IAAY,EACZ,OAAe,EACf,UAAyB,EACzB,UAAyB,EACzB,YAA2B;IAE3B,OAAO,UAAU;QACf,CAAC,CAAC,kBAAkB,CAAC;YACjB,IAAI;YACJ,OAAO;YACP,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,GAAG;oBACT,GAAG,EAAE,UAAU;oBACf,IAAI,EAAE,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,SAAS;oBAC7B,MAAM,EAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,SAAS;iBAClC;aACF;SACF,CAAC;QACJ,CAAC,CAAC,SAAS,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const ResourceType: {
|
|
2
|
+
readonly DOCUMENT: "document";
|
|
3
|
+
readonly XHR: "xhr";
|
|
4
|
+
readonly BEACON: "beacon";
|
|
5
|
+
readonly FETCH: "fetch";
|
|
6
|
+
readonly CSS: "css";
|
|
7
|
+
readonly JS: "js";
|
|
8
|
+
readonly IMAGE: "image";
|
|
9
|
+
readonly FONT: "font";
|
|
10
|
+
readonly MEDIA: "media";
|
|
11
|
+
readonly OTHER: "other";
|
|
12
|
+
};
|
|
13
|
+
export type ResourceType = (typeof ResourceType)[keyof typeof ResourceType];
|
|
14
|
+
export declare const RequestType: {
|
|
15
|
+
readonly FETCH: "fetch";
|
|
16
|
+
readonly XHR: "xhr";
|
|
17
|
+
};
|
|
18
|
+
export type RequestType = (typeof RequestType)[keyof typeof RequestType];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const ResourceType = {
|
|
2
|
+
DOCUMENT: 'document',
|
|
3
|
+
XHR: 'xhr',
|
|
4
|
+
BEACON: 'beacon',
|
|
5
|
+
FETCH: 'fetch',
|
|
6
|
+
CSS: 'css',
|
|
7
|
+
JS: 'js',
|
|
8
|
+
IMAGE: 'image',
|
|
9
|
+
FONT: 'font',
|
|
10
|
+
MEDIA: 'media',
|
|
11
|
+
OTHER: 'other',
|
|
12
|
+
};
|
|
13
|
+
export const RequestType = {
|
|
14
|
+
FETCH: ResourceType.FETCH,
|
|
15
|
+
XHR: ResourceType.XHR,
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=resourceUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceUtils.js","sourceRoot":"","sources":["../../src/domain/resourceUtils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,QAAQ,EAAE,UAAU;IACpB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,IAAI;IACR,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CACN,CAAA;AAIV,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,KAAK,EAAE,YAAY,CAAC,KAAK;IACzB,GAAG,EAAE,YAAY,CAAC,GAAG;CACb,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SessionStoreStrategy } from './storeStrategies/sessionStoreStrategy';
|
|
2
|
+
export declare const OLD_SESSION_COOKIE_NAME = "_oo";
|
|
3
|
+
export declare const OLD_RUM_COOKIE_NAME = "_oo_r";
|
|
4
|
+
export declare const OLD_LOGS_COOKIE_NAME = "_oo_l";
|
|
5
|
+
export declare const RUM_SESSION_KEY = "rum";
|
|
6
|
+
export declare const LOGS_SESSION_KEY = "logs";
|
|
7
|
+
/**
|
|
8
|
+
* This migration should remain in the codebase as long as older versions are available/live
|
|
9
|
+
* to allow older sdk versions to be upgraded to newer versions without compatibility issues.
|
|
10
|
+
*/
|
|
11
|
+
export declare function tryOldCookiesMigration(cookieStoreStrategy: SessionStoreStrategy): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { getInitCookie } from '../../browser/cookie';
|
|
2
|
+
import { SESSION_STORE_KEY } from './storeStrategies/sessionStoreStrategy';
|
|
3
|
+
import { expandSessionState, isSessionStarted } from './sessionState';
|
|
4
|
+
export const OLD_SESSION_COOKIE_NAME = '_oo';
|
|
5
|
+
export const OLD_RUM_COOKIE_NAME = '_oo_r';
|
|
6
|
+
export const OLD_LOGS_COOKIE_NAME = '_oo_l';
|
|
7
|
+
// duplicate values to avoid dependency issues
|
|
8
|
+
export const RUM_SESSION_KEY = 'rum';
|
|
9
|
+
export const LOGS_SESSION_KEY = 'logs';
|
|
10
|
+
/**
|
|
11
|
+
* This migration should remain in the codebase as long as older versions are available/live
|
|
12
|
+
* to allow older sdk versions to be upgraded to newer versions without compatibility issues.
|
|
13
|
+
*/
|
|
14
|
+
export function tryOldCookiesMigration(cookieStoreStrategy) {
|
|
15
|
+
const sessionString = getInitCookie(SESSION_STORE_KEY);
|
|
16
|
+
if (!sessionString) {
|
|
17
|
+
const oldSessionId = getInitCookie(OLD_SESSION_COOKIE_NAME);
|
|
18
|
+
const oldRumType = getInitCookie(OLD_RUM_COOKIE_NAME);
|
|
19
|
+
const oldLogsType = getInitCookie(OLD_LOGS_COOKIE_NAME);
|
|
20
|
+
const session = {};
|
|
21
|
+
if (oldSessionId) {
|
|
22
|
+
session.id = oldSessionId;
|
|
23
|
+
}
|
|
24
|
+
if (oldLogsType && /^[01]$/.test(oldLogsType)) {
|
|
25
|
+
session[LOGS_SESSION_KEY] = oldLogsType;
|
|
26
|
+
}
|
|
27
|
+
if (oldRumType && /^[012]$/.test(oldRumType)) {
|
|
28
|
+
session[RUM_SESSION_KEY] = oldRumType;
|
|
29
|
+
}
|
|
30
|
+
if (isSessionStarted(session)) {
|
|
31
|
+
expandSessionState(session);
|
|
32
|
+
cookieStoreStrategy.persistSession(session);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=oldCookiesMigration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oldCookiesMigration.js","sourceRoot":"","sources":["../../../src/domain/session/oldCookiesMigration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAE1E,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAErE,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,CAAA;AAC5C,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAA;AAC1C,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAA;AAE3C,8CAA8C;AAC9C,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAA;AACpC,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAA;AAEtC;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,mBAAyC;IAC9E,MAAM,aAAa,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAA;IACtD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,YAAY,GAAG,aAAa,CAAC,uBAAuB,CAAC,CAAA;QAC3D,MAAM,UAAU,GAAG,aAAa,CAAC,mBAAmB,CAAC,CAAA;QACrD,MAAM,WAAW,GAAG,aAAa,CAAC,oBAAoB,CAAC,CAAA;QACvD,MAAM,OAAO,GAAiB,EAAE,CAAA;QAEhC,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,CAAC,EAAE,GAAG,YAAY,CAAA;QAC3B,CAAC;QACD,IAAI,WAAW,IAAI,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YAC9C,OAAO,CAAC,gBAAgB,CAAC,GAAG,WAAW,CAAA;QACzC,CAAC;QACD,IAAI,UAAU,IAAI,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7C,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAA;QACvC,CAAC;QAED,IAAI,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9B,kBAAkB,CAAC,OAAO,CAAC,CAAA;YAC3B,mBAAmB,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;QAC7C,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const SESSION_TIME_OUT_DELAY: number;
|
|
2
|
+
export declare const SESSION_EXPIRATION_DELAY: number;
|
|
3
|
+
export declare const SESSION_COOKIE_EXPIRATION_DELAY: number;
|
|
4
|
+
export declare const SESSION_NOT_TRACKED = "0";
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare const SessionPersistence: {
|
|
9
|
+
readonly COOKIE: "cookie";
|
|
10
|
+
readonly LOCAL_STORAGE: "local-storage";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @inline
|
|
14
|
+
*/
|
|
15
|
+
export type SessionPersistence = (typeof SessionPersistence)[keyof typeof SessionPersistence];
|