import { dedupeIntegration, inboundFiltersIntegration, functionToStringIntegration, conversationIdIntegration, linkedErrorsIntegration, requestDataIntegration, consoleIntegration, GLOBAL_OBJ, getIntegrationsToSetup, stackParserFromStackParserOptions, initAndBind } from '@sentry/core'; import { CloudflareClient } from './client.js'; import { makeFlushLock } from './flush.js'; import { httpServerIntegration } from './integrations/httpServer.js'; import { fetchIntegration } from './integrations/fetch.js'; import { honoIntegration } from './integrations/hono.js'; import { INTEGRATION_NAME, spotlightIntegration } from './integrations/spotlight.js'; import { setupOpenTelemetryTracer } from './opentelemetry/tracer.js'; import { makeCloudflareTransport } from './transport.js'; import { defaultStackParser } from './vendor/stacktrace.js'; function getRegisteredChannelIntegrations() { const registered = GLOBAL_OBJ.__SENTRY_ORCHESTRION__?.integrations; return registered ? [...registered.values()].map((factory) => factory()) : []; } function getDefaultIntegrations(options) { const cookiesEnabled = options.sendDefaultPii || options.dataCollection?.cookies != null; return [ // The Dedupe integration should not be used in workflows because we want to // capture all step failures, even if they are the same error. ...options.enableDedupe === false ? [] : [dedupeIntegration()], // TODO(v11): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration` // eslint-disable-next-line typescript/no-deprecated inboundFiltersIntegration(), functionToStringIntegration(), conversationIdIntegration(), linkedErrorsIntegration(), fetchIntegration(), // eslint-disable-next-line typescript/no-deprecated honoIntegration(), httpServerIntegration(), requestDataIntegration(cookiesEnabled ? void 0 : { include: { cookies: false } }), consoleIntegration(), // The orchestrion diagnostics-channel subscribers (mysql, pg, …). The // `@sentry/cloudflare/vite` plugin injects the channels at build time and, // next to each, a snippet that registers the matching subscriber factory on // the global marker. Read from there instead of importing them so bundles // built without the plugin — where the channels would never fire — don't // ship the code. ...getRegisteredChannelIntegrations() ]; } function init(options) { if (options.defaultIntegrations === void 0) { options.defaultIntegrations = getDefaultIntegrations(options); } const flushLock = options.ctx ? makeFlushLock(options.ctx) : void 0; delete options.ctx; const clientOptions = { ...options, stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser), integrations: getIntegrationsToSetup(options), transport: options.transport || makeCloudflareTransport, flushLock }; if (options.spotlight && !clientOptions.integrations.some(({ name }) => name === INTEGRATION_NAME)) { clientOptions.integrations.push( spotlightIntegration({ sidecarUrl: typeof options.spotlight === "string" ? options.spotlight : void 0 }) ); } if (!options.skipOpenTelemetrySetup) { setupOpenTelemetryTracer(); } return initAndBind(CloudflareClient, clientOptions); } export { getDefaultIntegrations, init }; //# sourceMappingURL=sdk.js.map