File: D:/HostingSpaces/SBogers10/shop.komma.nl/node_modules/@sentry/core/dist/baseclient.js.map
{"version":3,"file":"baseclient.js","sourceRoot":"","sources":["../src/baseclient.ts"],"names":[],"mappings":";;AAAA,8BAA8B;AAC9B,mCAAoC;AAEpC,uCAUuB;AAGvB,6CAAoE;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH;IAoBE;;;;;OAKG;IACH,oBAAsB,YAAgC,EAAE,OAAU;QAZlE,kCAAkC;QACxB,kBAAa,GAAqB,EAAE,CAAC;QAE/C,6CAA6C;QACnC,gBAAW,GAAY,KAAK,CAAC;QASrC,IAAI,CAAC,QAAQ,GAAG,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAExB,IAAI,OAAO,CAAC,GAAG,EAAE;YACf,IAAI,CAAC,IAAI,GAAG,IAAI,WAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SAClC;IACH,CAAC;IAED;;OAEG;IACH,iHAAiH;IAC1G,qCAAgB,GAAvB,UAAwB,SAAc,EAAE,IAAgB,EAAE,KAAa;QAAvE,iBAYC;QAXC,IAAI,OAAO,GAAuB,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC;QACxD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAExB,mEAAmE;QACnE,IAAI,CAAC,WAAW,EAAE;aACf,kBAAkB,CAAC,SAAS,EAAE,IAAI,CAAC;aACnC,IAAI,CAAC,UAAA,KAAK;YACT,OAAO,GAAG,KAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QAEL,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACI,mCAAc,GAArB,UAAsB,OAAe,EAAE,KAAgB,EAAE,IAAgB,EAAE,KAAa;QAAxF,iBAcC;QAbC,IAAI,OAAO,GAAuB,IAAI,IAAI,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gC,CAAC;oBAE9C,IAAI,UAAU,KAAK,IAAI,EAAE;wBACvB,cAAM,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;wBACjE,OAAO,CAAC,IAAI,CAAC,CAAC;wBACd,OAAO;qBACR;oBAED,mCAAmC;oBACnC,KAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;oBAC5B,OAAO,CAAC,UAAU,CAAC,CAAC;iBACrB;YACH,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,EAAE,UAAA,MAAM;gBAChB,KAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE;oBAC5B,IAAI,EAAE;wBACJ,UAAU,EAAE,IAAI;qBACjB;oBACD,iBAAiB,EAAE,MAAe;iBACnC,CAAC,CAAC;gBACH,MAAM,CACJ,gIAA8H,MAAQ,CACvI,CAAC;YACJ,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACK,2CAAsB,GAA9B,UACE,UAAqC,EACrC,OAA+B,EAC/B,MAAgC;QAHlC,iBAkBC;QAbC,UAAU;aACP,IAAI,CAAC,UAAA,cAAc;YAClB,IAAI,cAAc,KAAK,IAAI,EAAE;gBAC3B,MAAM,CAAC,oDAAoD,CAAC,CAAC;gBAC7D,OAAO;aACR;YACD,mCAAmC;YACnC,KAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;YAChC,OAAO,CAAC,cAAc,CAAC,CAAC;QAC1B,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,EAAE,UAAA,CAAC;YACX,MAAM,CAAC,8BAA4B,CAAG,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACP,CAAC;IACH,iBAAC;AAAD,CAAC,AA/bD,IA+bC;AA/bqB,gCAAU","sourcesContent":["/* eslint-disable max-lines */\nimport { Scope } from '@sentry/hub';\nimport { Client, Event, EventHint, Integration, IntegrationClass, Options, Severity } from '@sentry/types';\nimport {\n Dsn,\n isPrimitive,\n isThenable,\n logger,\n normalize,\n SyncPromise,\n timestampWithMs,\n truncate,\n uuid4,\n} from '@sentry/utils';\n\nimport { Backend, BackendClass } from './basebackend';\nimport { IntegrationIndex, setupIntegrations } from './integration';\n\n/**\n * Base implementation for all JavaScript SDK clients.\n *\n * Call the constructor with the corresponding backend constructor and options\n * specific to the client subclass. To access these options later, use\n * {@link Client.getOptions}. Also, the Backend instance is available via\n * {@link Client.getBackend}.\n *\n * If a Dsn is specified in the options, it will be parsed and stored. Use\n * {@link Client.getDsn} to retrieve the Dsn at any moment. In case the Dsn is\n * invalid, the constructor will throw a {@link SentryException}. Note that\n * without a valid Dsn, the SDK will not send any events to Sentry.\n *\n * Before sending an event via the backend, it is passed through\n * {@link BaseClient.prepareEvent} to add SDK information and scope data\n * (breadcrumbs and context). To add more custom information, override this\n * method and extend the resulting prepared event.\n *\n * To issue automatically created events (e.g. via instrumentation), use\n * {@link Client.captureEvent}. It will prepare the event and pass it through\n * the callback lifecycle. To issue auto-breadcrumbs, use\n * {@link Client.addBreadcrumb}.\n *\n * @example\n * class NodeClient extends BaseClient<NodeBackend, NodeOptions> {\n * public constructor(options: NodeOptions) {\n * super(NodeBackend, options);\n * }\n *\n * // ...\n * }\n */\nexport abstract class BaseClient<B extends Backend, O extends Options> implements Client<O> {\n /**\n * The backend used to physically interact in the environment. Usually, this\n * will correspond to the client. When composing SDKs, however, the Backend\n * from the root SDK will be used.\n */\n protected readonly _backend: B;\n\n /** Options passed to the SDK. */\n protected readonly _options: O;\n\n /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */\n protected readonly _dsn?: Dsn;\n\n /** Array of used integrations. */\n protected _integrations: IntegrationIndex = {};\n\n /** Is the client still processing a call? */\n protected _processing: boolean = false;\n\n /**\n * Initializes this client instance.\n *\n * @param backendClass A constructor function to create the backend.\n * @param options Options for the client.\n */\n protected constructor(backendClass: BackendClass<B, O>, options: O) {\n this._backend = new backendClass(options);\n this._options = options;\n\n if (options.dsn) {\n this._dsn = new Dsn(options.dsn);\n }\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public captureException(exception: any, hint?: EventHint, scope?: Scope): string | undefined {\n let eventId: string | undefined = hint && hint.event_id;\n this._processing = true;\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._getBackend()\n .eventFromException(exception, hint)\n .then(event => {\n eventId = this.captureEvent(event, hint, scope);\n });\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public captureMessage(message: string, level?: Severity, hint?: EventHint, scope?: Scope): string | undefined {\n let eventId: string | undefined = hint && hint.event_id;\n this._processing = true;\n\n const promisedEvent = isPrimitive(message)\n ? this._getBackend().eventFromMessage(`${message}`, level, hint)\n : this._getBackend().eventFromException(message, hint);\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n promisedEvent.then(event => {\n eventId = this.captureEvent(event, hint, scope);\n });\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public captureEvent(event: Event, hint?: EventHint, scope?: Scope): string | undefined {\n let eventId: string | undefined = hint && hint.event_id;\n this._processing = true;\n\n this._processEvent(event, hint, scope)\n .then(finalEvent => {\n // We need to check for finalEvent in case beforeSend returned null\n eventId = finalEvent && finalEvent.event_id;\n this._processing = false;\n })\n .then(null, reason => {\n logger.error(reason);\n this._processing = false;\n });\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public getDsn(): Dsn | undefined {\n return this._dsn;\n }\n\n /**\n * @inheritDoc\n */\n public getOptions(): O {\n return this._options;\n }\n\n /**\n * @inheritDoc\n */\n public flush(timeout?: number): PromiseLike<boolean> {\n return this._isClientProcessing(timeout).then(status => {\n clearInterval(status.interval);\n return this._getBackend()\n .getTransport()\n .close(timeout)\n .then(transportFlushed => status.ready && transportFlushed);\n });\n }\n\n /**\n * @inheritDoc\n */\n public close(timeout?: number): PromiseLike<boolean> {\n return this.flush(timeout).then(result => {\n this.getOptions().enabled = false;\n return result;\n });\n }\n\n /**\n * Sets up the integrations\n */\n public setupIntegrations(): void {\n if (this._isEnabled()) {\n this._integrations = setupIntegrations(this._options);\n }\n }\n\n /**\n * @inheritDoc\n */\n public getIntegration<T extends Integration>(integration: IntegrationClass<T>): T | null {\n try {\n return (this._integrations[integration.id] as T) || null;\n } catch (_oO) {\n logger.warn(`Cannot retrieve integration ${integration.id} from the current Client`);\n return null;\n }\n }\n\n /** Waits for the client to be done with processing. */\n protected _isClientProcessing(timeout?: number): PromiseLike<{ ready: boolean; interval: number }> {\n return new SyncPromise<{ ready: boolean; interval: number }>(resolve => {\n let ticked: number = 0;\n const tick: number = 1;\n\n let interval = 0;\n clearInterval(interval);\n\n interval = (setInterval(() => {\n if (!this._processing) {\n resolve({\n interval,\n ready: true,\n });\n } else {\n ticked += tick;\n if (timeout && ticked >= timeout) {\n resolve({\n interval,\n ready: false,\n });\n }\n }\n }, tick) as unknown) as number;\n });\n }\n\n /** Returns the current backend. */\n protected _getBackend(): B {\n return this._backend;\n }\n\n /** Determines whether this SDK is enabled and a valid Dsn is present. */\n protected _isEnabled(): boolean {\n return this.getOptions().enabled !== false && this._dsn !== undefined;\n }\n\n /**\n * Adds common information to events.\n *\n * The information includes release and environment from `options`,\n * breadcrumbs and context (extra, tags and user) from the scope.\n *\n * Information that is already present in the event is never overwritten. For\n * nested objects, such as the context, keys are merged.\n *\n * @param event The original event.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A new event with more information.\n */\n protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null> {\n const { normalizeDepth = 3 } = this.getOptions();\n const prepared: Event = {\n ...event,\n event_id: event.event_id || (hint && hint.event_id ? hint.event_id : uuid4()),\n timestamp: event.timestamp || timestampWithMs(),\n };\n\n this._applyClientOptions(prepared);\n this._applyIntegrationsMetadata(prepared);\n\n // If we have scope given to us, use it as the base for further modifications.\n // This allows us to prevent unnecessary copying of data if `captureContext` is not provided.\n let finalScope = scope;\n if (hint && hint.captureContext) {\n finalScope = Scope.clone(finalScope).update(hint.captureContext);\n }\n\n // We prepare the result here with a resolved Event.\n let result = SyncPromise.resolve<Event | null>(prepared);\n\n // This should be the last thing called, since we want that\n // {@link Hub.addEventProcessor} gets the finished prepared event.\n if (finalScope) {\n // In case we have a hub we reassign it.\n result = finalScope.applyToEvent(prepared, hint);\n }\n\n return result.then(evt => {\n if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {\n return this._normalizeEvent(evt, normalizeDepth);\n }\n return evt;\n });\n }\n\n /**\n * Applies `normalize` function on necessary `Event` attributes to make them safe for serialization.\n * Normalized keys:\n * - `breadcrumbs.data`\n * - `user`\n * - `contexts`\n * - `extra`\n * @param event Event\n * @returns Normalized event\n */\n protected _normalizeEvent(event: Event | null, depth: number): Event | null {\n if (!event) {\n return null;\n }\n\n const normalized = {\n ...event,\n ...(event.breadcrumbs && {\n breadcrumbs: event.breadcrumbs.map(b => ({\n ...b,\n ...(b.data && {\n data: normalize(b.data, depth),\n }),\n })),\n }),\n ...(event.user && {\n user: normalize(event.user, depth),\n }),\n ...(event.contexts && {\n contexts: normalize(event.contexts, depth),\n }),\n ...(event.extra && {\n extra: normalize(event.extra, depth),\n }),\n };\n // event.contexts.trace stores information about a Transaction. Similarly,\n // event.spans[] stores information about child Spans. Given that a\n // Transaction is conceptually a Span, normalization should apply to both\n // Transactions and Spans consistently.\n // For now the decision is to skip normalization of Transactions and Spans,\n // so this block overwrites the normalized event to add back the original\n // Transaction information prior to normalization.\n if (event.contexts && event.contexts.trace) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n normalized.contexts.trace = event.contexts.trace;\n }\n return normalized;\n }\n\n /**\n * Enhances event using the client configuration.\n * It takes care of all \"static\" values like environment, release and `dist`,\n * as well as truncating overly long values.\n * @param event event instance to be enhanced\n */\n protected _applyClientOptions(event: Event): void {\n const { environment, release, dist, maxValueLength = 250 } = this.getOptions();\n\n if (event.environment === undefined && environment !== undefined) {\n event.environment = environment;\n }\n\n if (event.release === undefined && release !== undefined) {\n event.release = release;\n }\n\n if (event.dist === undefined && dist !== undefined) {\n event.dist = dist;\n }\n\n if (event.message) {\n event.message = truncate(event.message, maxValueLength);\n }\n\n const exception = event.exception && event.exception.values && event.exception.values[0];\n if (exception && exception.value) {\n exception.value = truncate(exception.value, maxValueLength);\n }\n\n const request = event.request;\n if (request && request.url) {\n request.url = truncate(request.url, maxValueLength);\n }\n }\n\n /**\n * This function adds all used integrations to the SDK info in the event.\n * @param sdkInfo The sdkInfo of the event that will be filled with all integrations.\n */\n protected _applyIntegrationsMetadata(event: Event): void {\n const sdkInfo = event.sdk;\n const integrationsArray = Object.keys(this._integrations);\n if (sdkInfo && integrationsArray.length > 0) {\n sdkInfo.integrations = integrationsArray;\n }\n }\n\n /**\n * Tells the backend to send this event\n * @param event The Sentry event to send\n */\n protected _sendEvent(event: Event): void {\n this._getBackend().sendEvent(event);\n }\n\n /**\n * Processes an event (either error or message) and sends it to Sentry.\n *\n * This also adds breadcrumbs and context information to the event. However,\n * platform specific meta data (such as the User's IP address) must be added\n * by the SDK implementor.\n *\n *\n * @param event The event to send to Sentry.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.\n */\n protected _processEvent(event: Event, hint?: EventHint, scope?: Scope): PromiseLike<Event> {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { beforeSend, sampleRate } = this.getOptions();\n\n if (!this._isEnabled()) {\n return SyncPromise.reject('SDK not enabled, will not send event.');\n }\n\n const isTransaction = event.type === 'transaction';\n // 1.0 === 100% events are sent\n // 0.0 === 0% events are sent\n // Sampling for transaction happens somewhere else\n if (!isTransaction && typeof sampleRate === 'number' && Math.random() > sampleRate) {\n return SyncPromise.reject('This event has been sampled, will not send event.');\n }\n\n return new SyncPromise((resolve, reject) => {\n this._prepareEvent(event, scope, hint)\n .then(prepared => {\n if (prepared === null) {\n reject('An event processor returned null, will not send event.');\n return;\n }\n\n let finalEvent: Event | null = prepared;\n\n const isInternalException =\n hint && hint.data && (hint.data as { [key: string]: unknown }).__sentry__ === true;\n // We skip beforeSend in case of transactions\n if (isInternalException || !beforeSend || isTransaction) {\n this._sendEvent(finalEvent);\n resolve(finalEvent);\n return;\n }\n\n const beforeSendResult = beforeSend(prepared, hint);\n if (typeof beforeSendResult === 'undefined') {\n logger.error('`beforeSend` method has to return `null` or a valid event.');\n } else if (isThenable(beforeSendResult)) {\n this._handleAsyncBeforeSend(beforeSendResult as PromiseLike<Event | null>, resolve, reject);\n } else {\n finalEvent = beforeSendResult as Event | null;\n\n if (finalEvent === null) {\n logger.log('`beforeSend` returned `null`, will not send event.');\n resolve(null);\n return;\n }\n\n // From here on we are really async\n this._sendEvent(finalEvent);\n resolve(finalEvent);\n }\n })\n .then(null, reason => {\n this.captureException(reason, {\n data: {\n __sentry__: true,\n },\n originalException: reason as Error,\n });\n reject(\n `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\\nReason: ${reason}`,\n );\n });\n });\n }\n\n /**\n * Resolves before send Promise and calls resolve/reject on parent SyncPromise.\n */\n private _handleAsyncBeforeSend(\n beforeSend: PromiseLike<Event | null>,\n resolve: (event: Event) => void,\n reject: (reason: string) => void,\n ): void {\n beforeSend\n .then(processedEvent => {\n if (processedEvent === null) {\n reject('`beforeSend` returned `null`, will not send event.');\n return;\n }\n // From here on we are really async\n this._sendEvent(processedEvent);\n resolve(processedEvent);\n })\n .then(null, e => {\n reject(`beforeSend rejected with ${e}`);\n });\n }\n}\n"]}