{"version":3,"file":"index.js","sources":["../../../src/sdk/index.ts"],"sourcesContent":["import type { Integration, Options } from '@sentry/core';\nimport { applySdkMetadata, hasSpansEnabled } from '@sentry/core';\nimport type { NodeClient } from '@sentry/node-core';\nimport {\n  getDefaultIntegrations as getNodeCoreDefaultIntegrations,\n  init as initNodeCore,\n  validateOpenTelemetrySetup,\n} from '@sentry/node-core';\nimport { httpIntegration } from '../integrations/http';\nimport { nativeNodeFetchIntegration } from '../integrations/node-fetch';\nimport { getAutoPerformanceIntegrations } from '../integrations/tracing';\nimport type { NodeOptions } from '../types';\nimport { initOpenTelemetry } from './initOtel';\n\n/**\n * Get default integrations, excluding performance.\n */\nexport function getDefaultIntegrationsWithoutPerformance(): Integration[] {\n  const nodeCoreIntegrations = getNodeCoreDefaultIntegrations();\n\n  // Filter out the node-core HTTP and NodeFetch integrations and replace them with Node SDK's composite versions\n  return nodeCoreIntegrations\n    .filter(integration => integration.name !== 'Http' && integration.name !== 'NodeFetch')\n    .concat(httpIntegration(), nativeNodeFetchIntegration());\n}\n\n/** Get the default integrations for the Node SDK. */\nexport function getDefaultIntegrations(options: Options): Integration[] {\n  return [\n    ...getDefaultIntegrationsWithoutPerformance(),\n    // We only add performance integrations if tracing is enabled\n    // Note that this means that without tracing enabled, e.g. `expressIntegration()` will not be added\n    // This means that generally request isolation will work (because that is done by httpIntegration)\n    // But `transactionName` will not be set automatically\n    ...(hasSpansEnabled(options) ? getAutoPerformanceIntegrations() : []),\n  ];\n}\n\n/**\n * Initialize Sentry for Node.\n */\nexport function init(options: NodeOptions | undefined = {}): NodeClient | undefined {\n  return _init(options, getDefaultIntegrations);\n}\n\n/**\n * Internal initialization function.\n */\nfunction _init(\n  options: NodeOptions | undefined = {},\n  getDefaultIntegrationsImpl: (options: Options) => Integration[],\n): NodeClient | undefined {\n  applySdkMetadata(options, 'node');\n\n  const client = initNodeCore({\n    ...options,\n    // Only use Node SDK defaults if none provided\n    defaultIntegrations: options.defaultIntegrations ?? getDefaultIntegrationsImpl(options),\n  });\n\n  // Add Node SDK specific OpenTelemetry setup\n  if (client && !options.skipOpenTelemetrySetup) {\n    initOpenTelemetry(client, {\n      spanProcessors: options.openTelemetrySpanProcessors,\n    });\n    validateOpenTelemetrySetup();\n  }\n\n  return client;\n}\n\n/**\n * Initialize Sentry for Node, without any integrations added by default.\n */\nexport function initWithoutDefaultIntegrations(options: NodeOptions | undefined = {}): NodeClient | undefined {\n  return _init(options, () => []);\n}\n"],"names":["getNodeCoreDefaultIntegrations","httpIntegration","nativeNodeFetchIntegration","hasSpansEnabled","getAutoPerformanceIntegrations","applySdkMetadata","initNodeCore","initOpenTelemetry","validateOpenTelemetrySetup"],"mappings":";;;;;;;;;AAcA;AACA;AACA;AACO,SAAS,wCAAwC,GAAkB;AAC1E,EAAE,MAAM,oBAAA,GAAuBA,+BAA8B,EAAE;;AAE/D;AACA,EAAE,OAAO;AACT,KAAK,MAAM,CAAC,WAAA,IAAe,WAAW,CAAC,IAAA,KAAS,UAAU,WAAW,CAAC,IAAA,KAAS,WAAW;AAC1F,KAAK,MAAM,CAACC,oBAAe,EAAE,EAAEC,kCAA0B,EAAE,CAAC;AAC5D;;AAEA;AACO,SAAS,sBAAsB,CAAC,OAAO,EAA0B;AACxE,EAAE,OAAO;AACT,IAAI,GAAG,wCAAwC,EAAE;AACjD;AACA;AACA;AACA;AACA,IAAI,IAAIC,oBAAe,CAAC,OAAO,CAAA,GAAIC,oCAA8B,EAAC,GAAI,EAAE,CAAC;AACzE,GAAG;AACH;;AAEA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,GAA4B,EAAE,EAA0B;AACpF,EAAE,OAAO,KAAK,CAAC,OAAO,EAAE,sBAAsB,CAAC;AAC/C;;AAEA;AACA;AACA;AACA,SAAS,KAAK;AACd,EAAE,OAAO,GAA4B,EAAE;AACvC,EAAE,0BAA0B;AAC5B,EAA0B;AAC1B,EAAEC,qBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC;;AAEnC,EAAE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