@slicemachine/manager 0.26.3-beta.1 → 0.26.3-beta.3
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/dist/_node_modules/@amplitude/analytics-node/lib/esm/transports/http.cjs +6 -6
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/transports/http.js +4 -4
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/transports/http.js.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.cjs +4 -4
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.js +4 -4
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.js.map +1 -1
- package/dist/errors.cjs +7 -0
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +5 -1
- package/dist/errors.js +7 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/managers/customTypes/CustomTypesManager.cjs +17 -7
- package/dist/managers/customTypes/CustomTypesManager.cjs.map +1 -1
- package/dist/managers/customTypes/CustomTypesManager.js +19 -9
- package/dist/managers/customTypes/CustomTypesManager.js.map +1 -1
- package/package.json +2 -2
- package/src/errors.ts +12 -1
- package/src/index.ts +1 -0
- package/src/managers/customTypes/CustomTypesManager.ts +29 -18
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/constants.cjs +0 -5
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/constants.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/constants.js +0 -5
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/constants.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/debug-build.cjs +0 -5
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/debug-build.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/debug-build.js +0 -5
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/debug-build.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/eventProcessors.cjs +0 -29
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/eventProcessors.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/eventProcessors.js +0 -29
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/eventProcessors.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/exports.cjs +0 -17
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/exports.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/exports.js +0 -17
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/exports.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/hub.cjs +0 -535
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/hub.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/hub.js +0 -535
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/hub.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/scope.cjs +0 -545
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/scope.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/scope.js +0 -545
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/scope.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/session.cjs +0 -109
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/session.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/session.js +0 -109
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/session.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.cjs +0 -50
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.js +0 -50
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.cjs +0 -85
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.js +0 -85
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/getRootSpan.cjs +0 -7
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/getRootSpan.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/getRootSpan.js +0 -7
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/getRootSpan.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/prepareEvent.cjs +0 -35
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/prepareEvent.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/prepareEvent.js +0 -35
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/prepareEvent.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/spanUtils.cjs +0 -39
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/spanUtils.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/spanUtils.js +0 -39
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/spanUtils.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/version.cjs +0 -5
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/version.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/version.js +0 -5
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/version.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/debug-build.cjs +0 -5
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/debug-build.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/debug-build.js +0 -5
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/debug-build.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/is.cjs +0 -15
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/is.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/is.js +0 -15
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/is.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/logger.cjs +0 -69
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/logger.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/logger.js +0 -69
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/logger.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/misc.cjs +0 -34
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/misc.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/misc.js +0 -34
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/misc.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/object.cjs +0 -49
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/object.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/object.js +0 -49
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/object.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/syncpromise.cjs +0 -142
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/syncpromise.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/syncpromise.js +0 -142
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/syncpromise.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/time.cjs +0 -45
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/time.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/time.js +0 -45
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/time.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/worldwide.cjs +0 -18
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/worldwide.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/worldwide.js +0 -18
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/worldwide.js.map +0 -1
- package/dist/lib/checkIsSentryEnabled.d.ts +0 -9
- package/dist/lib/sentryErrorHandlers.cjs +0 -10
- package/dist/lib/sentryErrorHandlers.cjs.map +0 -1
- package/dist/lib/sentryErrorHandlers.d.ts +0 -1
- package/dist/lib/sentryErrorHandlers.js +0 -10
- package/dist/lib/sentryErrorHandlers.js.map +0 -1
- package/src/lib/checkIsSentryEnabled.ts +0 -12
- package/src/lib/sentryErrorHandlers.ts +0 -13
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exports.cjs","sources":["../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/exports.js"],"sourcesContent":["import { logger, uuid4, timestampInSeconds, isThenable, GLOBAL_OBJ } from '@sentry/utils';\nimport { DEFAULT_ENVIRONMENT } from './constants.js';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { getCurrentHub, runWithAsyncContext, getIsolationScope } from './hub.js';\nimport { makeSession, updateSession, closeSession } from './session.js';\nimport { parseEventHintOrCaptureContext } from './utils/prepareEvent.js';\n\n/**\n * Captures an exception event and sends it to Sentry.\n *\n * @param exception The exception to capture.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured Sentry event.\n */\nfunction captureException(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n exception,\n hint,\n) {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().captureException(exception, parseEventHintOrCaptureContext(hint));\n}\n\n/**\n * Captures a message event and sends it to Sentry.\n *\n * @param exception The exception to capture.\n * @param captureContext Define the level of the message or pass in additional data to attach to the message.\n * @returns the id of the captured message.\n */\nfunction captureMessage(\n message,\n // eslint-disable-next-line deprecation/deprecation\n captureContext,\n) {\n // This is necessary to provide explicit scopes upgrade, without changing the original\n // arity of the `captureMessage(message, level)` method.\n const level = typeof captureContext === 'string' ? captureContext : undefined;\n const context = typeof captureContext !== 'string' ? { captureContext } : undefined;\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().captureMessage(message, level, context);\n}\n\n/**\n * Captures a manually created event and sends it to Sentry.\n *\n * @param exception The event to send to Sentry.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured event.\n */\nfunction captureEvent(event, hint) {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().captureEvent(event, hint);\n}\n\n/**\n * Callback to set context information onto the scope.\n * @param callback Callback function that receives Scope.\n *\n * @deprecated Use getCurrentScope() directly.\n */\n// eslint-disable-next-line deprecation/deprecation\nfunction configureScope(callback) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().configureScope(callback);\n}\n\n/**\n * Records a new breadcrumb which will be attached to future events.\n *\n * Breadcrumbs will be added to subsequent events to provide more context on\n * user's actions prior to an error or crash.\n *\n * @param breadcrumb The breadcrumb to record.\n */\n// eslint-disable-next-line deprecation/deprecation\nfunction addBreadcrumb(breadcrumb, hint) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().addBreadcrumb(breadcrumb, hint);\n}\n\n/**\n * Sets context data with the given name.\n * @param name of the context\n * @param context Any kind of data. This data will be normalized.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, deprecation/deprecation\nfunction setContext(name, context) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setContext(name, context);\n}\n\n/**\n * Set an object that will be merged sent as extra data with the event.\n * @param extras Extras object to merge into current context.\n */\n// eslint-disable-next-line deprecation/deprecation\nfunction setExtras(extras) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setExtras(extras);\n}\n\n/**\n * Set key:value that will be sent as extra data with the event.\n * @param key String of extra\n * @param extra Any kind of data. This data will be normalized.\n */\n// eslint-disable-next-line deprecation/deprecation\nfunction setExtra(key, extra) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setExtra(key, extra);\n}\n\n/**\n * Set an object that will be merged sent as tags data with the event.\n * @param tags Tags context object to merge into current context.\n */\n// eslint-disable-next-line deprecation/deprecation\nfunction setTags(tags) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setTags(tags);\n}\n\n/**\n * Set key:value that will be sent as tags data with the event.\n *\n * Can also be used to unset a tag, by passing `undefined`.\n *\n * @param key String key of tag\n * @param value Value of tag\n */\n// eslint-disable-next-line deprecation/deprecation\nfunction setTag(key, value) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setTag(key, value);\n}\n\n/**\n * Updates user context information for future events.\n *\n * @param user User context object to be set in the current context. Pass `null` to unset the user.\n */\n// eslint-disable-next-line deprecation/deprecation\nfunction setUser(user) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setUser(user);\n}\n\n/**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n *\n * This is essentially a convenience function for:\n *\n * pushScope();\n * callback();\n * popScope();\n */\n\n/**\n * Either creates a new active scope, or sets the given scope as active scope in the given callback.\n */\nfunction withScope(\n ...rest\n) {\n // eslint-disable-next-line deprecation/deprecation\n const hub = getCurrentHub();\n\n // If a scope is defined, we want to make this the active scope instead of the default one\n if (rest.length === 2) {\n const [scope, callback] = rest;\n if (!scope) {\n // eslint-disable-next-line deprecation/deprecation\n return hub.withScope(callback);\n }\n\n // eslint-disable-next-line deprecation/deprecation\n return hub.withScope(() => {\n // eslint-disable-next-line deprecation/deprecation\n hub.getStackTop().scope = scope ;\n return callback(scope );\n });\n }\n\n // eslint-disable-next-line deprecation/deprecation\n return hub.withScope(rest[0]);\n}\n\n/**\n * Attempts to fork the current isolation scope and the current scope based on the current async context strategy. If no\n * async context strategy is set, the isolation scope and the current scope will not be forked (this is currently the\n * case, for example, in the browser).\n *\n * Usage of this function in environments without async context strategy is discouraged and may lead to unexpected behaviour.\n *\n * This function is intended for Sentry SDK and SDK integration development. It is not recommended to be used in \"normal\"\n * applications directly because it comes with pitfalls. Use at your own risk!\n *\n * @param callback The callback in which the passed isolation scope is active. (Note: In environments without async\n * context strategy, the currently active isolation scope may change within execution of the callback.)\n * @returns The same value that `callback` returns.\n */\nfunction withIsolationScope(callback) {\n return runWithAsyncContext(() => {\n return callback(getIsolationScope());\n });\n}\n\n/**\n * Forks the current scope and sets the provided span as active span in the context of the provided callback.\n *\n * @param span Spans started in the context of the provided callback will be children of this span.\n * @param callback Execution context in which the provided span will be active. Is passed the newly forked scope.\n * @returns the value returned from the provided callback function.\n */\nfunction withActiveSpan(span, callback) {\n return withScope(scope => {\n // eslint-disable-next-line deprecation/deprecation\n scope.setSpan(span);\n return callback(scope);\n });\n}\n\n/**\n * Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.\n *\n * A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a\n * new child span within the transaction or any span, call the respective `.startChild()` method.\n *\n * Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.\n *\n * The transaction must be finished with a call to its `.end()` method, at which point the transaction with all its\n * finished child spans will be sent to Sentry.\n *\n * NOTE: This function should only be used for *manual* instrumentation. Auto-instrumentation should call\n * `startTransaction` directly on the hub.\n *\n * @param context Properties of the new `Transaction`.\n * @param customSamplingContext Information given to the transaction sampling function (along with context-dependent\n * default values). See {@link Options.tracesSampler}.\n *\n * @returns The transaction which was just started\n *\n * @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.\n */\nfunction startTransaction(\n context,\n customSamplingContext,\n // eslint-disable-next-line deprecation/deprecation\n) {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().startTransaction({ ...context }, customSamplingContext);\n}\n\n/**\n * Create a cron monitor check in and send it to Sentry.\n *\n * @param checkIn An object that describes a check in.\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nfunction captureCheckIn(checkIn, upsertMonitorConfig) {\n const scope = getCurrentScope();\n const client = getClient();\n if (!client) {\n DEBUG_BUILD && logger.warn('Cannot capture check-in. No client defined.');\n } else if (!client.captureCheckIn) {\n DEBUG_BUILD && logger.warn('Cannot capture check-in. Client does not support sending check-ins.');\n } else {\n return client.captureCheckIn(checkIn, upsertMonitorConfig, scope);\n }\n\n return uuid4();\n}\n\n/**\n * Wraps a callback with a cron monitor check in. The check in will be sent to Sentry when the callback finishes.\n *\n * @param monitorSlug The distinct slug of the monitor.\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nfunction withMonitor(\n monitorSlug,\n callback,\n upsertMonitorConfig,\n) {\n const checkInId = captureCheckIn({ monitorSlug, status: 'in_progress' }, upsertMonitorConfig);\n const now = timestampInSeconds();\n\n function finishCheckIn(status) {\n captureCheckIn({ monitorSlug, status, checkInId, duration: timestampInSeconds() - now });\n }\n\n let maybePromiseResult;\n try {\n maybePromiseResult = callback();\n } catch (e) {\n finishCheckIn('error');\n throw e;\n }\n\n if (isThenable(maybePromiseResult)) {\n Promise.resolve(maybePromiseResult).then(\n () => {\n finishCheckIn('ok');\n },\n () => {\n finishCheckIn('error');\n },\n );\n } else {\n finishCheckIn('ok');\n }\n\n return maybePromiseResult;\n}\n\n/**\n * Call `flush()` on the current client, if there is one. See {@link Client.flush}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause\n * the client to wait until all events are sent before resolving the promise.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nasync function flush(timeout) {\n const client = getClient();\n if (client) {\n return client.flush(timeout);\n }\n DEBUG_BUILD && logger.warn('Cannot flush events. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * Call `close()` on the current client, if there is one. See {@link Client.close}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this\n * parameter will cause the client to wait until all events are sent before disabling itself.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nasync function close(timeout) {\n const client = getClient();\n if (client) {\n return client.close(timeout);\n }\n DEBUG_BUILD && logger.warn('Cannot flush events and disable SDK. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * This is the getter for lastEventId.\n *\n * @returns The last event id of a captured event.\n */\nfunction lastEventId() {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().lastEventId();\n}\n\n/**\n * Get the currently active client.\n */\nfunction getClient() {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().getClient();\n}\n\n/**\n * Returns true if Sentry has been properly initialized.\n */\nfunction isInitialized() {\n return !!getClient();\n}\n\n/**\n * Get the currently active scope.\n */\nfunction getCurrentScope() {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().getScope();\n}\n\n/**\n * Start a session on the current isolation scope.\n *\n * @param context (optional) additional properties to be applied to the returned session object\n *\n * @returns the new active session\n */\nfunction startSession(context) {\n const client = getClient();\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n\n const { release, environment = DEFAULT_ENVIRONMENT } = (client && client.getOptions()) || {};\n\n // Will fetch userAgent if called from browser sdk\n const { userAgent } = GLOBAL_OBJ.navigator || {};\n\n const session = makeSession({\n release,\n environment,\n user: currentScope.getUser() || isolationScope.getUser(),\n ...(userAgent && { userAgent }),\n ...context,\n });\n\n // End existing session if there's one\n const currentSession = isolationScope.getSession();\n if (currentSession && currentSession.status === 'ok') {\n updateSession(currentSession, { status: 'exited' });\n }\n\n endSession();\n\n // Afterwards we set the new session on the scope\n isolationScope.setSession(session);\n\n // TODO (v8): Remove this and only use the isolation scope(?).\n // For v7 though, we can't \"soft-break\" people using getCurrentHub().getScope().setSession()\n currentScope.setSession(session);\n\n return session;\n}\n\n/**\n * End the session on the current isolation scope.\n */\nfunction endSession() {\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n\n const session = currentScope.getSession() || isolationScope.getSession();\n if (session) {\n closeSession(session);\n }\n _sendSessionUpdate();\n\n // the session is over; take it off of the scope\n isolationScope.setSession();\n\n // TODO (v8): Remove this and only use the isolation scope(?).\n // For v7 though, we can't \"soft-break\" people using getCurrentHub().getScope().setSession()\n currentScope.setSession();\n}\n\n/**\n * Sends the current Session on the scope\n */\nfunction _sendSessionUpdate() {\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n const client = getClient();\n // TODO (v8): Remove currentScope and only use the isolation scope(?).\n // For v7 though, we can't \"soft-break\" people using getCurrentHub().getScope().setSession()\n const session = currentScope.getSession() || isolationScope.getSession();\n if (session && client && client.captureSession) {\n client.captureSession(session);\n }\n}\n\n/**\n * Sends the current session on the scope to Sentry\n *\n * @param end If set the session will be marked as exited and removed from the scope.\n * Defaults to `false`.\n */\nfunction captureSession(end = false) {\n // both send the update and pull the session from the scope\n if (end) {\n endSession();\n return;\n }\n\n // only send the update\n _sendSessionUpdate();\n}\n\nexport { addBreadcrumb, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, configureScope, endSession, flush, getClient, getCurrentScope, isInitialized, lastEventId, setContext, setExtra, setExtras, setTag, setTags, setUser, startSession, startTransaction, withActiveSpan, withIsolationScope, withMonitor, withScope };\n//# sourceMappingURL=exports.js.map\n"],"names":["getCurrentHub","parseEventHintOrCaptureContext"],"mappings":";;;;AAcA,SAAS,iBAEP,WACA,MACA;AAEA,SAAOA,IAAAA,cAAa,EAAG,iBAAiB,WAAWC,aAAAA,+BAA+B,IAAI,CAAC;AACzF;AAyVA,SAAS,YAAY;AAEnB,SAAOD,IAAAA,cAAa,EAAG,UAAS;AAClC;AAYA,SAAS,kBAAkB;AAEzB,SAAOA,IAAAA,cAAa,EAAG,SAAQ;AACjC;;;;","x_google_ignoreList":[0]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { getCurrentHub } from "./hub.js";
|
|
2
|
-
import { parseEventHintOrCaptureContext } from "./utils/prepareEvent.js";
|
|
3
|
-
function captureException(exception, hint) {
|
|
4
|
-
return getCurrentHub().captureException(exception, parseEventHintOrCaptureContext(hint));
|
|
5
|
-
}
|
|
6
|
-
function getClient() {
|
|
7
|
-
return getCurrentHub().getClient();
|
|
8
|
-
}
|
|
9
|
-
function getCurrentScope() {
|
|
10
|
-
return getCurrentHub().getScope();
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
captureException,
|
|
14
|
-
getClient,
|
|
15
|
-
getCurrentScope
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=exports.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sources":["../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/exports.js"],"sourcesContent":["import { logger, uuid4, timestampInSeconds, isThenable, GLOBAL_OBJ } from '@sentry/utils';\nimport { DEFAULT_ENVIRONMENT } from './constants.js';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { getCurrentHub, runWithAsyncContext, getIsolationScope } from './hub.js';\nimport { makeSession, updateSession, closeSession } from './session.js';\nimport { parseEventHintOrCaptureContext } from './utils/prepareEvent.js';\n\n/**\n * Captures an exception event and sends it to Sentry.\n *\n * @param exception The exception to capture.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured Sentry event.\n */\nfunction captureException(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n exception,\n hint,\n) {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().captureException(exception, parseEventHintOrCaptureContext(hint));\n}\n\n/**\n * Captures a message event and sends it to Sentry.\n *\n * @param exception The exception to capture.\n * @param captureContext Define the level of the message or pass in additional data to attach to the message.\n * @returns the id of the captured message.\n */\nfunction captureMessage(\n message,\n // eslint-disable-next-line deprecation/deprecation\n captureContext,\n) {\n // This is necessary to provide explicit scopes upgrade, without changing the original\n // arity of the `captureMessage(message, level)` method.\n const level = typeof captureContext === 'string' ? captureContext : undefined;\n const context = typeof captureContext !== 'string' ? { captureContext } : undefined;\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().captureMessage(message, level, context);\n}\n\n/**\n * Captures a manually created event and sends it to Sentry.\n *\n * @param exception The event to send to Sentry.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured event.\n */\nfunction captureEvent(event, hint) {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().captureEvent(event, hint);\n}\n\n/**\n * Callback to set context information onto the scope.\n * @param callback Callback function that receives Scope.\n *\n * @deprecated Use getCurrentScope() directly.\n */\n// eslint-disable-next-line deprecation/deprecation\nfunction configureScope(callback) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().configureScope(callback);\n}\n\n/**\n * Records a new breadcrumb which will be attached to future events.\n *\n * Breadcrumbs will be added to subsequent events to provide more context on\n * user's actions prior to an error or crash.\n *\n * @param breadcrumb The breadcrumb to record.\n */\n// eslint-disable-next-line deprecation/deprecation\nfunction addBreadcrumb(breadcrumb, hint) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().addBreadcrumb(breadcrumb, hint);\n}\n\n/**\n * Sets context data with the given name.\n * @param name of the context\n * @param context Any kind of data. This data will be normalized.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, deprecation/deprecation\nfunction setContext(name, context) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setContext(name, context);\n}\n\n/**\n * Set an object that will be merged sent as extra data with the event.\n * @param extras Extras object to merge into current context.\n */\n// eslint-disable-next-line deprecation/deprecation\nfunction setExtras(extras) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setExtras(extras);\n}\n\n/**\n * Set key:value that will be sent as extra data with the event.\n * @param key String of extra\n * @param extra Any kind of data. This data will be normalized.\n */\n// eslint-disable-next-line deprecation/deprecation\nfunction setExtra(key, extra) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setExtra(key, extra);\n}\n\n/**\n * Set an object that will be merged sent as tags data with the event.\n * @param tags Tags context object to merge into current context.\n */\n// eslint-disable-next-line deprecation/deprecation\nfunction setTags(tags) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setTags(tags);\n}\n\n/**\n * Set key:value that will be sent as tags data with the event.\n *\n * Can also be used to unset a tag, by passing `undefined`.\n *\n * @param key String key of tag\n * @param value Value of tag\n */\n// eslint-disable-next-line deprecation/deprecation\nfunction setTag(key, value) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setTag(key, value);\n}\n\n/**\n * Updates user context information for future events.\n *\n * @param user User context object to be set in the current context. Pass `null` to unset the user.\n */\n// eslint-disable-next-line deprecation/deprecation\nfunction setUser(user) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setUser(user);\n}\n\n/**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n *\n * This is essentially a convenience function for:\n *\n * pushScope();\n * callback();\n * popScope();\n */\n\n/**\n * Either creates a new active scope, or sets the given scope as active scope in the given callback.\n */\nfunction withScope(\n ...rest\n) {\n // eslint-disable-next-line deprecation/deprecation\n const hub = getCurrentHub();\n\n // If a scope is defined, we want to make this the active scope instead of the default one\n if (rest.length === 2) {\n const [scope, callback] = rest;\n if (!scope) {\n // eslint-disable-next-line deprecation/deprecation\n return hub.withScope(callback);\n }\n\n // eslint-disable-next-line deprecation/deprecation\n return hub.withScope(() => {\n // eslint-disable-next-line deprecation/deprecation\n hub.getStackTop().scope = scope ;\n return callback(scope );\n });\n }\n\n // eslint-disable-next-line deprecation/deprecation\n return hub.withScope(rest[0]);\n}\n\n/**\n * Attempts to fork the current isolation scope and the current scope based on the current async context strategy. If no\n * async context strategy is set, the isolation scope and the current scope will not be forked (this is currently the\n * case, for example, in the browser).\n *\n * Usage of this function in environments without async context strategy is discouraged and may lead to unexpected behaviour.\n *\n * This function is intended for Sentry SDK and SDK integration development. It is not recommended to be used in \"normal\"\n * applications directly because it comes with pitfalls. Use at your own risk!\n *\n * @param callback The callback in which the passed isolation scope is active. (Note: In environments without async\n * context strategy, the currently active isolation scope may change within execution of the callback.)\n * @returns The same value that `callback` returns.\n */\nfunction withIsolationScope(callback) {\n return runWithAsyncContext(() => {\n return callback(getIsolationScope());\n });\n}\n\n/**\n * Forks the current scope and sets the provided span as active span in the context of the provided callback.\n *\n * @param span Spans started in the context of the provided callback will be children of this span.\n * @param callback Execution context in which the provided span will be active. Is passed the newly forked scope.\n * @returns the value returned from the provided callback function.\n */\nfunction withActiveSpan(span, callback) {\n return withScope(scope => {\n // eslint-disable-next-line deprecation/deprecation\n scope.setSpan(span);\n return callback(scope);\n });\n}\n\n/**\n * Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.\n *\n * A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a\n * new child span within the transaction or any span, call the respective `.startChild()` method.\n *\n * Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.\n *\n * The transaction must be finished with a call to its `.end()` method, at which point the transaction with all its\n * finished child spans will be sent to Sentry.\n *\n * NOTE: This function should only be used for *manual* instrumentation. Auto-instrumentation should call\n * `startTransaction` directly on the hub.\n *\n * @param context Properties of the new `Transaction`.\n * @param customSamplingContext Information given to the transaction sampling function (along with context-dependent\n * default values). See {@link Options.tracesSampler}.\n *\n * @returns The transaction which was just started\n *\n * @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.\n */\nfunction startTransaction(\n context,\n customSamplingContext,\n // eslint-disable-next-line deprecation/deprecation\n) {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().startTransaction({ ...context }, customSamplingContext);\n}\n\n/**\n * Create a cron monitor check in and send it to Sentry.\n *\n * @param checkIn An object that describes a check in.\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nfunction captureCheckIn(checkIn, upsertMonitorConfig) {\n const scope = getCurrentScope();\n const client = getClient();\n if (!client) {\n DEBUG_BUILD && logger.warn('Cannot capture check-in. No client defined.');\n } else if (!client.captureCheckIn) {\n DEBUG_BUILD && logger.warn('Cannot capture check-in. Client does not support sending check-ins.');\n } else {\n return client.captureCheckIn(checkIn, upsertMonitorConfig, scope);\n }\n\n return uuid4();\n}\n\n/**\n * Wraps a callback with a cron monitor check in. The check in will be sent to Sentry when the callback finishes.\n *\n * @param monitorSlug The distinct slug of the monitor.\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nfunction withMonitor(\n monitorSlug,\n callback,\n upsertMonitorConfig,\n) {\n const checkInId = captureCheckIn({ monitorSlug, status: 'in_progress' }, upsertMonitorConfig);\n const now = timestampInSeconds();\n\n function finishCheckIn(status) {\n captureCheckIn({ monitorSlug, status, checkInId, duration: timestampInSeconds() - now });\n }\n\n let maybePromiseResult;\n try {\n maybePromiseResult = callback();\n } catch (e) {\n finishCheckIn('error');\n throw e;\n }\n\n if (isThenable(maybePromiseResult)) {\n Promise.resolve(maybePromiseResult).then(\n () => {\n finishCheckIn('ok');\n },\n () => {\n finishCheckIn('error');\n },\n );\n } else {\n finishCheckIn('ok');\n }\n\n return maybePromiseResult;\n}\n\n/**\n * Call `flush()` on the current client, if there is one. See {@link Client.flush}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause\n * the client to wait until all events are sent before resolving the promise.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nasync function flush(timeout) {\n const client = getClient();\n if (client) {\n return client.flush(timeout);\n }\n DEBUG_BUILD && logger.warn('Cannot flush events. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * Call `close()` on the current client, if there is one. See {@link Client.close}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this\n * parameter will cause the client to wait until all events are sent before disabling itself.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nasync function close(timeout) {\n const client = getClient();\n if (client) {\n return client.close(timeout);\n }\n DEBUG_BUILD && logger.warn('Cannot flush events and disable SDK. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * This is the getter for lastEventId.\n *\n * @returns The last event id of a captured event.\n */\nfunction lastEventId() {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().lastEventId();\n}\n\n/**\n * Get the currently active client.\n */\nfunction getClient() {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().getClient();\n}\n\n/**\n * Returns true if Sentry has been properly initialized.\n */\nfunction isInitialized() {\n return !!getClient();\n}\n\n/**\n * Get the currently active scope.\n */\nfunction getCurrentScope() {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().getScope();\n}\n\n/**\n * Start a session on the current isolation scope.\n *\n * @param context (optional) additional properties to be applied to the returned session object\n *\n * @returns the new active session\n */\nfunction startSession(context) {\n const client = getClient();\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n\n const { release, environment = DEFAULT_ENVIRONMENT } = (client && client.getOptions()) || {};\n\n // Will fetch userAgent if called from browser sdk\n const { userAgent } = GLOBAL_OBJ.navigator || {};\n\n const session = makeSession({\n release,\n environment,\n user: currentScope.getUser() || isolationScope.getUser(),\n ...(userAgent && { userAgent }),\n ...context,\n });\n\n // End existing session if there's one\n const currentSession = isolationScope.getSession();\n if (currentSession && currentSession.status === 'ok') {\n updateSession(currentSession, { status: 'exited' });\n }\n\n endSession();\n\n // Afterwards we set the new session on the scope\n isolationScope.setSession(session);\n\n // TODO (v8): Remove this and only use the isolation scope(?).\n // For v7 though, we can't \"soft-break\" people using getCurrentHub().getScope().setSession()\n currentScope.setSession(session);\n\n return session;\n}\n\n/**\n * End the session on the current isolation scope.\n */\nfunction endSession() {\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n\n const session = currentScope.getSession() || isolationScope.getSession();\n if (session) {\n closeSession(session);\n }\n _sendSessionUpdate();\n\n // the session is over; take it off of the scope\n isolationScope.setSession();\n\n // TODO (v8): Remove this and only use the isolation scope(?).\n // For v7 though, we can't \"soft-break\" people using getCurrentHub().getScope().setSession()\n currentScope.setSession();\n}\n\n/**\n * Sends the current Session on the scope\n */\nfunction _sendSessionUpdate() {\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n const client = getClient();\n // TODO (v8): Remove currentScope and only use the isolation scope(?).\n // For v7 though, we can't \"soft-break\" people using getCurrentHub().getScope().setSession()\n const session = currentScope.getSession() || isolationScope.getSession();\n if (session && client && client.captureSession) {\n client.captureSession(session);\n }\n}\n\n/**\n * Sends the current session on the scope to Sentry\n *\n * @param end If set the session will be marked as exited and removed from the scope.\n * Defaults to `false`.\n */\nfunction captureSession(end = false) {\n // both send the update and pull the session from the scope\n if (end) {\n endSession();\n return;\n }\n\n // only send the update\n _sendSessionUpdate();\n}\n\nexport { addBreadcrumb, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, configureScope, endSession, flush, getClient, getCurrentScope, isInitialized, lastEventId, setContext, setExtra, setExtras, setTag, setTags, setUser, startSession, startTransaction, withActiveSpan, withIsolationScope, withMonitor, withScope };\n//# sourceMappingURL=exports.js.map\n"],"names":[],"mappings":";;AAcA,SAAS,iBAEP,WACA,MACA;AAEA,SAAO,cAAa,EAAG,iBAAiB,WAAW,+BAA+B,IAAI,CAAC;AACzF;AAyVA,SAAS,YAAY;AAEnB,SAAO,cAAa,EAAG,UAAS;AAClC;AAYA,SAAS,kBAAkB;AAEzB,SAAO,cAAa,EAAG,SAAQ;AACjC;","x_google_ignoreList":[0]}
|
|
@@ -1,535 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const constants = require("./constants.cjs");
|
|
4
|
-
const debugBuild = require("./debug-build.cjs");
|
|
5
|
-
const scope = require("./scope.cjs");
|
|
6
|
-
const session = require("./session.cjs");
|
|
7
|
-
const version = require("./version.cjs");
|
|
8
|
-
const worldwide = require("../../utils/esm/worldwide.cjs");
|
|
9
|
-
const is = require("../../utils/esm/is.cjs");
|
|
10
|
-
const misc = require("../../utils/esm/misc.cjs");
|
|
11
|
-
const logger = require("../../utils/esm/logger.cjs");
|
|
12
|
-
const time = require("../../utils/esm/time.cjs");
|
|
13
|
-
const API_VERSION = parseFloat(version.SDK_VERSION);
|
|
14
|
-
const DEFAULT_BREADCRUMBS = 100;
|
|
15
|
-
class Hub {
|
|
16
|
-
/** Is a {@link Layer}[] containing the client and scope */
|
|
17
|
-
/** Contains the last event id of a captured event. */
|
|
18
|
-
/**
|
|
19
|
-
* Creates a new instance of the hub, will push one {@link Layer} into the
|
|
20
|
-
* internal stack on creation.
|
|
21
|
-
*
|
|
22
|
-
* @param client bound to the hub.
|
|
23
|
-
* @param scope bound to the hub.
|
|
24
|
-
* @param version number, higher number means higher priority.
|
|
25
|
-
*
|
|
26
|
-
* @deprecated Instantiation of Hub objects is deprecated and the constructor will be removed in version 8 of the SDK.
|
|
27
|
-
*
|
|
28
|
-
* If you are currently using the Hub for multi-client use like so:
|
|
29
|
-
*
|
|
30
|
-
* ```
|
|
31
|
-
* // OLD
|
|
32
|
-
* const hub = new Hub();
|
|
33
|
-
* hub.bindClient(client);
|
|
34
|
-
* makeMain(hub)
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* instead initialize the client as follows:
|
|
38
|
-
*
|
|
39
|
-
* ```
|
|
40
|
-
* // NEW
|
|
41
|
-
* Sentry.withIsolationScope(() => {
|
|
42
|
-
* Sentry.setCurrentClient(client);
|
|
43
|
-
* client.init();
|
|
44
|
-
* });
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* If you are using the Hub to capture events like so:
|
|
48
|
-
*
|
|
49
|
-
* ```
|
|
50
|
-
* // OLD
|
|
51
|
-
* const client = new Client();
|
|
52
|
-
* const hub = new Hub(client);
|
|
53
|
-
* hub.captureException()
|
|
54
|
-
* ```
|
|
55
|
-
*
|
|
56
|
-
* instead capture isolated events as follows:
|
|
57
|
-
*
|
|
58
|
-
* ```
|
|
59
|
-
* // NEW
|
|
60
|
-
* const client = new Client();
|
|
61
|
-
* const scope = new Scope();
|
|
62
|
-
* scope.setClient(client);
|
|
63
|
-
* scope.captureException();
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
constructor(client, scope$1, isolationScope, _version = API_VERSION) {
|
|
67
|
-
this._version = _version;
|
|
68
|
-
let assignedScope;
|
|
69
|
-
if (!scope$1) {
|
|
70
|
-
assignedScope = new scope.Scope();
|
|
71
|
-
assignedScope.setClient(client);
|
|
72
|
-
} else {
|
|
73
|
-
assignedScope = scope$1;
|
|
74
|
-
}
|
|
75
|
-
let assignedIsolationScope;
|
|
76
|
-
if (!isolationScope) {
|
|
77
|
-
assignedIsolationScope = new scope.Scope();
|
|
78
|
-
assignedIsolationScope.setClient(client);
|
|
79
|
-
} else {
|
|
80
|
-
assignedIsolationScope = isolationScope;
|
|
81
|
-
}
|
|
82
|
-
this._stack = [{ scope: assignedScope }];
|
|
83
|
-
if (client) {
|
|
84
|
-
this.bindClient(client);
|
|
85
|
-
}
|
|
86
|
-
this._isolationScope = assignedIsolationScope;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Checks if this hub's version is older than the given version.
|
|
90
|
-
*
|
|
91
|
-
* @param version A version number to compare to.
|
|
92
|
-
* @return True if the given version is newer; otherwise false.
|
|
93
|
-
*
|
|
94
|
-
* @deprecated This will be removed in v8.
|
|
95
|
-
*/
|
|
96
|
-
isOlderThan(version2) {
|
|
97
|
-
return this._version < version2;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* This binds the given client to the current scope.
|
|
101
|
-
* @param client An SDK client (client) instance.
|
|
102
|
-
*
|
|
103
|
-
* @deprecated Use `initAndBind()` directly, or `setCurrentClient()` and/or `client.init()` instead.
|
|
104
|
-
*/
|
|
105
|
-
bindClient(client) {
|
|
106
|
-
const top = this.getStackTop();
|
|
107
|
-
top.client = client;
|
|
108
|
-
top.scope.setClient(client);
|
|
109
|
-
if (client && client.setupIntegrations) {
|
|
110
|
-
client.setupIntegrations();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* @inheritDoc
|
|
115
|
-
*
|
|
116
|
-
* @deprecated Use `withScope` instead.
|
|
117
|
-
*/
|
|
118
|
-
pushScope() {
|
|
119
|
-
const scope2 = this.getScope().clone();
|
|
120
|
-
this.getStack().push({
|
|
121
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
122
|
-
client: this.getClient(),
|
|
123
|
-
scope: scope2
|
|
124
|
-
});
|
|
125
|
-
return scope2;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* @inheritDoc
|
|
129
|
-
*
|
|
130
|
-
* @deprecated Use `withScope` instead.
|
|
131
|
-
*/
|
|
132
|
-
popScope() {
|
|
133
|
-
if (this.getStack().length <= 1) return false;
|
|
134
|
-
return !!this.getStack().pop();
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* @inheritDoc
|
|
138
|
-
*
|
|
139
|
-
* @deprecated Use `Sentry.withScope()` instead.
|
|
140
|
-
*/
|
|
141
|
-
withScope(callback) {
|
|
142
|
-
const scope2 = this.pushScope();
|
|
143
|
-
let maybePromiseResult;
|
|
144
|
-
try {
|
|
145
|
-
maybePromiseResult = callback(scope2);
|
|
146
|
-
} catch (e) {
|
|
147
|
-
this.popScope();
|
|
148
|
-
throw e;
|
|
149
|
-
}
|
|
150
|
-
if (is.isThenable(maybePromiseResult)) {
|
|
151
|
-
return maybePromiseResult.then(
|
|
152
|
-
(res) => {
|
|
153
|
-
this.popScope();
|
|
154
|
-
return res;
|
|
155
|
-
},
|
|
156
|
-
(e) => {
|
|
157
|
-
this.popScope();
|
|
158
|
-
throw e;
|
|
159
|
-
}
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
this.popScope();
|
|
163
|
-
return maybePromiseResult;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* @inheritDoc
|
|
167
|
-
*
|
|
168
|
-
* @deprecated Use `Sentry.getClient()` instead.
|
|
169
|
-
*/
|
|
170
|
-
getClient() {
|
|
171
|
-
return this.getStackTop().client;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Returns the scope of the top stack.
|
|
175
|
-
*
|
|
176
|
-
* @deprecated Use `Sentry.getCurrentScope()` instead.
|
|
177
|
-
*/
|
|
178
|
-
getScope() {
|
|
179
|
-
return this.getStackTop().scope;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* @deprecated Use `Sentry.getIsolationScope()` instead.
|
|
183
|
-
*/
|
|
184
|
-
getIsolationScope() {
|
|
185
|
-
return this._isolationScope;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Returns the scope stack for domains or the process.
|
|
189
|
-
* @deprecated This will be removed in v8.
|
|
190
|
-
*/
|
|
191
|
-
getStack() {
|
|
192
|
-
return this._stack;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Returns the topmost scope layer in the order domain > local > process.
|
|
196
|
-
* @deprecated This will be removed in v8.
|
|
197
|
-
*/
|
|
198
|
-
getStackTop() {
|
|
199
|
-
return this._stack[this._stack.length - 1];
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* @inheritDoc
|
|
203
|
-
*
|
|
204
|
-
* @deprecated Use `Sentry.captureException()` instead.
|
|
205
|
-
*/
|
|
206
|
-
captureException(exception, hint) {
|
|
207
|
-
const eventId = this._lastEventId = hint && hint.event_id ? hint.event_id : misc.uuid4();
|
|
208
|
-
const syntheticException = new Error("Sentry syntheticException");
|
|
209
|
-
this.getScope().captureException(exception, {
|
|
210
|
-
originalException: exception,
|
|
211
|
-
syntheticException,
|
|
212
|
-
...hint,
|
|
213
|
-
event_id: eventId
|
|
214
|
-
});
|
|
215
|
-
return eventId;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* @inheritDoc
|
|
219
|
-
*
|
|
220
|
-
* @deprecated Use `Sentry.captureMessage()` instead.
|
|
221
|
-
*/
|
|
222
|
-
captureMessage(message, level, hint) {
|
|
223
|
-
const eventId = this._lastEventId = hint && hint.event_id ? hint.event_id : misc.uuid4();
|
|
224
|
-
const syntheticException = new Error(message);
|
|
225
|
-
this.getScope().captureMessage(message, level, {
|
|
226
|
-
originalException: message,
|
|
227
|
-
syntheticException,
|
|
228
|
-
...hint,
|
|
229
|
-
event_id: eventId
|
|
230
|
-
});
|
|
231
|
-
return eventId;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* @inheritDoc
|
|
235
|
-
*
|
|
236
|
-
* @deprecated Use `Sentry.captureEvent()` instead.
|
|
237
|
-
*/
|
|
238
|
-
captureEvent(event, hint) {
|
|
239
|
-
const eventId = hint && hint.event_id ? hint.event_id : misc.uuid4();
|
|
240
|
-
if (!event.type) {
|
|
241
|
-
this._lastEventId = eventId;
|
|
242
|
-
}
|
|
243
|
-
this.getScope().captureEvent(event, { ...hint, event_id: eventId });
|
|
244
|
-
return eventId;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* @inheritDoc
|
|
248
|
-
*
|
|
249
|
-
* @deprecated This will be removed in v8.
|
|
250
|
-
*/
|
|
251
|
-
lastEventId() {
|
|
252
|
-
return this._lastEventId;
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* @inheritDoc
|
|
256
|
-
*
|
|
257
|
-
* @deprecated Use `Sentry.addBreadcrumb()` instead.
|
|
258
|
-
*/
|
|
259
|
-
addBreadcrumb(breadcrumb, hint) {
|
|
260
|
-
const { scope: scope2, client } = this.getStackTop();
|
|
261
|
-
if (!client) return;
|
|
262
|
-
const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } = client.getOptions && client.getOptions() || {};
|
|
263
|
-
if (maxBreadcrumbs <= 0) return;
|
|
264
|
-
const timestamp = time.dateTimestampInSeconds();
|
|
265
|
-
const mergedBreadcrumb = { timestamp, ...breadcrumb };
|
|
266
|
-
const finalBreadcrumb = beforeBreadcrumb ? logger.consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) : mergedBreadcrumb;
|
|
267
|
-
if (finalBreadcrumb === null) return;
|
|
268
|
-
if (client.emit) {
|
|
269
|
-
client.emit("beforeAddBreadcrumb", finalBreadcrumb, hint);
|
|
270
|
-
}
|
|
271
|
-
scope2.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs);
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* @inheritDoc
|
|
275
|
-
* @deprecated Use `Sentry.setUser()` instead.
|
|
276
|
-
*/
|
|
277
|
-
setUser(user) {
|
|
278
|
-
this.getScope().setUser(user);
|
|
279
|
-
this.getIsolationScope().setUser(user);
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* @inheritDoc
|
|
283
|
-
* @deprecated Use `Sentry.setTags()` instead.
|
|
284
|
-
*/
|
|
285
|
-
setTags(tags) {
|
|
286
|
-
this.getScope().setTags(tags);
|
|
287
|
-
this.getIsolationScope().setTags(tags);
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* @inheritDoc
|
|
291
|
-
* @deprecated Use `Sentry.setExtras()` instead.
|
|
292
|
-
*/
|
|
293
|
-
setExtras(extras) {
|
|
294
|
-
this.getScope().setExtras(extras);
|
|
295
|
-
this.getIsolationScope().setExtras(extras);
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* @inheritDoc
|
|
299
|
-
* @deprecated Use `Sentry.setTag()` instead.
|
|
300
|
-
*/
|
|
301
|
-
setTag(key, value) {
|
|
302
|
-
this.getScope().setTag(key, value);
|
|
303
|
-
this.getIsolationScope().setTag(key, value);
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* @inheritDoc
|
|
307
|
-
* @deprecated Use `Sentry.setExtra()` instead.
|
|
308
|
-
*/
|
|
309
|
-
setExtra(key, extra) {
|
|
310
|
-
this.getScope().setExtra(key, extra);
|
|
311
|
-
this.getIsolationScope().setExtra(key, extra);
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* @inheritDoc
|
|
315
|
-
* @deprecated Use `Sentry.setContext()` instead.
|
|
316
|
-
*/
|
|
317
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
318
|
-
setContext(name, context) {
|
|
319
|
-
this.getScope().setContext(name, context);
|
|
320
|
-
this.getIsolationScope().setContext(name, context);
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* @inheritDoc
|
|
324
|
-
*
|
|
325
|
-
* @deprecated Use `getScope()` directly.
|
|
326
|
-
*/
|
|
327
|
-
configureScope(callback) {
|
|
328
|
-
const { scope: scope2, client } = this.getStackTop();
|
|
329
|
-
if (client) {
|
|
330
|
-
callback(scope2);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* @inheritDoc
|
|
335
|
-
*/
|
|
336
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
337
|
-
run(callback) {
|
|
338
|
-
const oldHub = makeMain(this);
|
|
339
|
-
try {
|
|
340
|
-
callback(this);
|
|
341
|
-
} finally {
|
|
342
|
-
makeMain(oldHub);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
* @inheritDoc
|
|
347
|
-
* @deprecated Use `Sentry.getClient().getIntegrationByName()` instead.
|
|
348
|
-
*/
|
|
349
|
-
getIntegration(integration) {
|
|
350
|
-
const client = this.getClient();
|
|
351
|
-
if (!client) return null;
|
|
352
|
-
try {
|
|
353
|
-
return client.getIntegration(integration);
|
|
354
|
-
} catch (_oO) {
|
|
355
|
-
debugBuild.DEBUG_BUILD && logger.logger.warn(`Cannot retrieve integration ${integration.id} from the current Hub`);
|
|
356
|
-
return null;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.
|
|
361
|
-
*
|
|
362
|
-
* A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a
|
|
363
|
-
* new child span within the transaction or any span, call the respective `.startChild()` method.
|
|
364
|
-
*
|
|
365
|
-
* Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.
|
|
366
|
-
*
|
|
367
|
-
* The transaction must be finished with a call to its `.end()` method, at which point the transaction with all its
|
|
368
|
-
* finished child spans will be sent to Sentry.
|
|
369
|
-
*
|
|
370
|
-
* @param context Properties of the new `Transaction`.
|
|
371
|
-
* @param customSamplingContext Information given to the transaction sampling function (along with context-dependent
|
|
372
|
-
* default values). See {@link Options.tracesSampler}.
|
|
373
|
-
*
|
|
374
|
-
* @returns The transaction which was just started
|
|
375
|
-
*
|
|
376
|
-
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
|
|
377
|
-
*/
|
|
378
|
-
startTransaction(context, customSamplingContext) {
|
|
379
|
-
const result = this._callExtensionMethod("startTransaction", context, customSamplingContext);
|
|
380
|
-
if (debugBuild.DEBUG_BUILD && !result) {
|
|
381
|
-
const client = this.getClient();
|
|
382
|
-
if (!client) {
|
|
383
|
-
logger.logger.warn(
|
|
384
|
-
"Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'"
|
|
385
|
-
);
|
|
386
|
-
} else {
|
|
387
|
-
logger.logger.warn(`Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':
|
|
388
|
-
Sentry.addTracingExtensions();
|
|
389
|
-
Sentry.init({...});
|
|
390
|
-
`);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
return result;
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* @inheritDoc
|
|
397
|
-
* @deprecated Use `spanToTraceHeader()` instead.
|
|
398
|
-
*/
|
|
399
|
-
traceHeaders() {
|
|
400
|
-
return this._callExtensionMethod("traceHeaders");
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* @inheritDoc
|
|
404
|
-
*
|
|
405
|
-
* @deprecated Use top level `captureSession` instead.
|
|
406
|
-
*/
|
|
407
|
-
captureSession(endSession = false) {
|
|
408
|
-
if (endSession) {
|
|
409
|
-
return this.endSession();
|
|
410
|
-
}
|
|
411
|
-
this._sendSessionUpdate();
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* @inheritDoc
|
|
415
|
-
* @deprecated Use top level `endSession` instead.
|
|
416
|
-
*/
|
|
417
|
-
endSession() {
|
|
418
|
-
const layer = this.getStackTop();
|
|
419
|
-
const scope2 = layer.scope;
|
|
420
|
-
const session$1 = scope2.getSession();
|
|
421
|
-
if (session$1) {
|
|
422
|
-
session.closeSession(session$1);
|
|
423
|
-
}
|
|
424
|
-
this._sendSessionUpdate();
|
|
425
|
-
scope2.setSession();
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* @inheritDoc
|
|
429
|
-
* @deprecated Use top level `startSession` instead.
|
|
430
|
-
*/
|
|
431
|
-
startSession(context) {
|
|
432
|
-
const { scope: scope2, client } = this.getStackTop();
|
|
433
|
-
const { release, environment = constants.DEFAULT_ENVIRONMENT } = client && client.getOptions() || {};
|
|
434
|
-
const { userAgent } = worldwide.GLOBAL_OBJ.navigator || {};
|
|
435
|
-
const session$1 = session.makeSession({
|
|
436
|
-
release,
|
|
437
|
-
environment,
|
|
438
|
-
user: scope2.getUser(),
|
|
439
|
-
...userAgent && { userAgent },
|
|
440
|
-
...context
|
|
441
|
-
});
|
|
442
|
-
const currentSession = scope2.getSession && scope2.getSession();
|
|
443
|
-
if (currentSession && currentSession.status === "ok") {
|
|
444
|
-
session.updateSession(currentSession, { status: "exited" });
|
|
445
|
-
}
|
|
446
|
-
this.endSession();
|
|
447
|
-
scope2.setSession(session$1);
|
|
448
|
-
return session$1;
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* Returns if default PII should be sent to Sentry and propagated in ourgoing requests
|
|
452
|
-
* when Tracing is used.
|
|
453
|
-
*
|
|
454
|
-
* @deprecated Use top-level `getClient().getOptions().sendDefaultPii` instead. This function
|
|
455
|
-
* only unnecessarily increased API surface but only wrapped accessing the option.
|
|
456
|
-
*/
|
|
457
|
-
shouldSendDefaultPii() {
|
|
458
|
-
const client = this.getClient();
|
|
459
|
-
const options = client && client.getOptions();
|
|
460
|
-
return Boolean(options && options.sendDefaultPii);
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* Sends the current Session on the scope
|
|
464
|
-
*/
|
|
465
|
-
_sendSessionUpdate() {
|
|
466
|
-
const { scope: scope2, client } = this.getStackTop();
|
|
467
|
-
const session2 = scope2.getSession();
|
|
468
|
-
if (session2 && client && client.captureSession) {
|
|
469
|
-
client.captureSession(session2);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* Calls global extension method and binding current instance to the function call
|
|
474
|
-
*/
|
|
475
|
-
// @ts-expect-error Function lacks ending return statement and return type does not include 'undefined'. ts(2366)
|
|
476
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
477
|
-
_callExtensionMethod(method, ...args) {
|
|
478
|
-
const carrier = getMainCarrier();
|
|
479
|
-
const sentry = carrier.__SENTRY__;
|
|
480
|
-
if (sentry && sentry.extensions && typeof sentry.extensions[method] === "function") {
|
|
481
|
-
return sentry.extensions[method].apply(this, args);
|
|
482
|
-
}
|
|
483
|
-
debugBuild.DEBUG_BUILD && logger.logger.warn(`Extension method ${method} couldn't be found, doing nothing.`);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
function getMainCarrier() {
|
|
487
|
-
worldwide.GLOBAL_OBJ.__SENTRY__ = worldwide.GLOBAL_OBJ.__SENTRY__ || {
|
|
488
|
-
extensions: {},
|
|
489
|
-
hub: void 0
|
|
490
|
-
};
|
|
491
|
-
return worldwide.GLOBAL_OBJ;
|
|
492
|
-
}
|
|
493
|
-
function makeMain(hub) {
|
|
494
|
-
const registry = getMainCarrier();
|
|
495
|
-
const oldHub = getHubFromCarrier(registry);
|
|
496
|
-
setHubOnCarrier(registry, hub);
|
|
497
|
-
return oldHub;
|
|
498
|
-
}
|
|
499
|
-
function getCurrentHub() {
|
|
500
|
-
const registry = getMainCarrier();
|
|
501
|
-
if (registry.__SENTRY__ && registry.__SENTRY__.acs) {
|
|
502
|
-
const hub = registry.__SENTRY__.acs.getCurrentHub();
|
|
503
|
-
if (hub) {
|
|
504
|
-
return hub;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
return getGlobalHub(registry);
|
|
508
|
-
}
|
|
509
|
-
function getGlobalHub(registry = getMainCarrier()) {
|
|
510
|
-
if (!hasHubOnCarrier(registry) || // eslint-disable-next-line deprecation/deprecation
|
|
511
|
-
getHubFromCarrier(registry).isOlderThan(API_VERSION)) {
|
|
512
|
-
setHubOnCarrier(registry, new Hub());
|
|
513
|
-
}
|
|
514
|
-
return getHubFromCarrier(registry);
|
|
515
|
-
}
|
|
516
|
-
function hasHubOnCarrier(carrier) {
|
|
517
|
-
return !!(carrier && carrier.__SENTRY__ && carrier.__SENTRY__.hub);
|
|
518
|
-
}
|
|
519
|
-
function getHubFromCarrier(carrier) {
|
|
520
|
-
return worldwide.getGlobalSingleton("hub", () => new Hub(), carrier);
|
|
521
|
-
}
|
|
522
|
-
function setHubOnCarrier(carrier, hub) {
|
|
523
|
-
if (!carrier) return false;
|
|
524
|
-
const __SENTRY__ = carrier.__SENTRY__ = carrier.__SENTRY__ || {};
|
|
525
|
-
__SENTRY__.hub = hub;
|
|
526
|
-
return true;
|
|
527
|
-
}
|
|
528
|
-
exports.API_VERSION = API_VERSION;
|
|
529
|
-
exports.Hub = Hub;
|
|
530
|
-
exports.getCurrentHub = getCurrentHub;
|
|
531
|
-
exports.getHubFromCarrier = getHubFromCarrier;
|
|
532
|
-
exports.getMainCarrier = getMainCarrier;
|
|
533
|
-
exports.makeMain = makeMain;
|
|
534
|
-
exports.setHubOnCarrier = setHubOnCarrier;
|
|
535
|
-
//# sourceMappingURL=hub.cjs.map
|