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CAAC,cAAc,CAAC,EAAE,CAAC;SAC5C;KACF;IAED,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE;QACvE,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;KACtD;IAED,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,qBAAe,CAAC,oBAAc,EAAE,EAAE,oBAAa,EAAE,CAAC,CAAC;KACpD;IAED,kBAAW,CAAC,mBAAU,EAAE,OAAO,CAAC,CAAC;AACnC,CAAC;AA9BD,oBA8BC;AAED;;;;GAIG;AACH,SAAgB,WAAW;IACzB,OAAO,oBAAa,EAAE,CAAC,WAAW,EAAE,CAAC;AACvC,CAAC;AAFD,kCAEC;AAED;;;;;GAKG;AACH,SAAsB,KAAK,CAAC,OAAgB;;;;YACpC,MAAM,GAAG,oBAAa,EAAE,CAAC,SAAS,EAAc,CAAC;YACvD,IAAI,MAAM,EAAE;gBACV,sBAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAC;aAC9B;YACD,sBAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAC;;;CAC9B;AAND,sBAMC;AAED;;;;;GAKG;AACH,SAAsB,KAAK,CAAC,OAAgB;;;;YACpC,MAAM,GAAG,oBAAa,EAAE,CAAC,SAAS,EAAc,CAAC;YACvD,IAAI,MAAM,EAAE;gBACV,sBAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAC;aAC9B;YACD,sBAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAC;;;CAC9B;AAND,sBAMC","sourcesContent":["import { getCurrentHub, initAndBind, Integrations as CoreIntegrations } from '@sentry/core';\nimport { getMainCarrier, setHubOnCarrier } from '@sentry/hub';\nimport { getGlobalObject } from '@sentry/utils';\nimport * as domain from 'domain';\n\nimport { NodeOptions } from './backend';\nimport { NodeClient } from './client';\nimport { Console, Http, LinkedErrors, OnUncaughtException, OnUnhandledRejection } from './integrations';\n\nexport const defaultIntegrations = [\n // Common\n new CoreIntegrations.InboundFilters(),\n new CoreIntegrations.FunctionToString(),\n // Native Wrappers\n new Console(),\n new Http(),\n // Global Handlers\n new OnUncaughtException(),\n new OnUnhandledRejection(),\n // Misc\n new LinkedErrors(),\n];\n\n/**\n * The Sentry Node SDK Client.\n *\n * To use this SDK, call the {@link init} function as early as possible in the\n * main entry module. To set context information or send manual events, use the\n * provided methods.\n *\n * @example\n * ```\n *\n * const { init } = require('@sentry/node');\n *\n * init({\n * dsn: '__DSN__',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n *\n * const { configureScope } = require('@sentry/node');\n * configureScope((scope: Scope) => {\n * scope.setExtra({ battery: 0.7 });\n * scope.setTag({ user_mode: 'admin' });\n * scope.setUser({ id: '4711' });\n * });\n * ```\n *\n * @example\n * ```\n *\n * const { addBreadcrumb } = require('@sentry/node');\n * addBreadcrumb({\n * message: 'My Breadcrumb',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n *\n * const Sentry = require('@sentry/node');\n * Sentry.captureMessage('Hello, world!');\n * Sentry.captureException(new Error('Good bye'));\n * Sentry.captureEvent({\n * message: 'Manual',\n * stacktrace: [\n * // ...\n * ],\n * });\n * ```\n *\n * @see {@link NodeOptions} for documentation on configuration options.\n */\nexport function init(options: NodeOptions = {}): void {\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = defaultIntegrations;\n }\n\n if (options.dsn === undefined && process.env.SENTRY_DSN) {\n options.dsn = process.env.SENTRY_DSN;\n }\n\n if (options.release === undefined) {\n const global = getGlobalObject<Window>();\n // Prefer env var over global\n if (process.env.SENTRY_RELEASE) {\n options.release = process.env.SENTRY_RELEASE;\n }\n // This supports the variable that sentry-webpack-plugin injects\n else if (global.SENTRY_RELEASE && global.SENTRY_RELEASE.id) {\n options.release = global.SENTRY_RELEASE.id;\n }\n }\n\n if (options.environment === undefined && process.env.SENTRY_ENVIRONMENT) {\n options.environment = process.env.SENTRY_ENVIRONMENT;\n }\n\n if (domain.active) {\n setHubOnCarrier(getMainCarrier(), getCurrentHub());\n }\n\n initAndBind(NodeClient, options);\n}\n\n/**\n * This is the getter for lastEventId.\n *\n * @returns The last event id of a captured event.\n */\nexport function lastEventId(): string | undefined {\n return getCurrentHub().lastEventId();\n}\n\n/**\n * A promise that resolves when all current events have been sent.\n * If you provide a timeout and the queue takes longer to drain the promise returns false.\n *\n * @param timeout Maximum time in ms the client should wait.\n */\nexport async function flush(timeout?: number): Promise<boolean> {\n const client = getCurrentHub().getClient<NodeClient>();\n if (client) {\n return client.flush(timeout);\n }\n return Promise.reject(false);\n}\n\n/**\n * A promise that resolves when all current events have been sent.\n * If you provide a timeout and the queue takes longer to drain the promise returns false.\n *\n * @param timeout Maximum time in ms the client should wait.\n */\nexport async function close(timeout?: number): Promise<boolean> {\n const client = getCurrentHub().getClient<NodeClient>();\n if (client) {\n return client.close(timeout);\n }\n return Promise.reject(false);\n}\n"]}
\No newline at end of file