@sentry/cloudflare 10.63.0 → 10.64.0

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.
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const core = require('@sentry/core');
4
+ const debugBuild = require('./debug-build.js');
4
5
 
5
6
  const flushLockRegistries = /* @__PURE__ */ new WeakMap();
6
7
  function getOriginalWaitUntil(context) {
@@ -63,12 +64,21 @@ function getOrCreateFlushLockRegistry(context) {
63
64
  return registry;
64
65
  }
65
66
  async function flushAndDispose(client, timeout = 2e3) {
66
- if (!client) {
67
- await core.flush(timeout);
68
- return;
67
+ try {
68
+ if (!client) {
69
+ await core.flush(timeout);
70
+ return;
71
+ }
72
+ await client.flush(timeout);
73
+ } catch (e) {
74
+ debugBuild.DEBUG_BUILD && core.debug.warn("Failed to flush client", e);
75
+ } finally {
76
+ try {
77
+ client?.dispose();
78
+ } catch (e) {
79
+ debugBuild.DEBUG_BUILD && core.debug.warn("Failed to dispose client", e);
80
+ }
69
81
  }
70
- await client.flush(timeout);
71
- client.dispose();
72
82
  }
73
83
 
74
84
  exports.flushAndDispose = flushAndDispose;
@@ -1 +1 @@
1
- {"version":3,"file":"flush.js","sources":["../../src/flush.ts"],"sourcesContent":["import type { ExecutionContext } from '@cloudflare/workers-types';\nimport type { Client } from '@sentry/core';\nimport { flush } from '@sentry/core';\n\ntype FlushLock = {\n readonly ready: Promise<void>;\n readonly finalize: () => Promise<void>;\n};\n\ntype FlushLockRegistry = {\n readonly locks: Set<FlushLockInternal>;\n readonly originalWaitUntil: ExecutionContext['waitUntil'];\n};\n\ntype FlushLockInternal = FlushLock & {\n readonly acquire: () => void;\n readonly release: () => void;\n};\n\nconst flushLockRegistries = new WeakMap<ExecutionContext['waitUntil'], FlushLockRegistry>();\n\n/**\n * Returns the original (un-instrumented) waitUntil function for a context.\n * This should be used when calling waitUntil with flushAndDispose to avoid deadlock.\n *\n * The flush lock mechanism wraps context.waitUntil to track pending tasks.\n * If we call waitUntil(flushAndDispose(client)) through the instrumented version,\n * it creates a deadlock because:\n * 1. The instrumented waitUntil acquires the flush lock\n * 2. flushAndDispose calls client.flush() which waits for the lock to be released\n * 3. The lock won't be released until the waitUntil promise completes\n * 4. The waitUntil promise won't complete until flush() returns\n *\n * By using the original waitUntil for flush operations, we bypass this issue.\n */\nexport function getOriginalWaitUntil(context: ExecutionContext): ExecutionContext['waitUntil'] | undefined {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const currentWaitUntil = context.waitUntil;\n const original = flushLockRegistries.get(currentWaitUntil)?.originalWaitUntil;\n return original ?? currentWaitUntil;\n}\n\n/**\n * Enhances the given execution context by wrapping its `waitUntil` method with a proxy\n * to monitor pending tasks, and provides a flusher function to ensure all tasks\n * have been completed before executing any subsequent logic.\n *\n * @param {ExecutionContext} context - The execution context to be enhanced. If no context is provided, the function returns undefined.\n * @return {FlushLock} Returns a flusher function if a valid context is provided, otherwise undefined.\n */\nexport function makeFlushLock(context: ExecutionContext): FlushLock {\n const registry = getOrCreateFlushLockRegistry(context);\n let resolveAllDone: () => void = () => undefined;\n const allDone = new Promise<void>(res => {\n resolveAllDone = res;\n });\n let pending = 0;\n\n const lock: FlushLockInternal = {\n ready: allDone,\n acquire: () => {\n pending++;\n },\n release: () => {\n if (--pending === 0) {\n registry.locks.delete(lock);\n resolveAllDone();\n }\n },\n finalize: () => {\n if (pending === 0) {\n registry.locks.delete(lock);\n resolveAllDone();\n }\n return allDone;\n },\n };\n\n registry.locks.add(lock);\n return Object.freeze(lock);\n}\n\nfunction getOrCreateFlushLockRegistry(context: ExecutionContext): FlushLockRegistry {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const waitUntil = context.waitUntil;\n const existingRegistry = flushLockRegistries.get(waitUntil);\n\n if (existingRegistry) {\n return existingRegistry;\n }\n\n const originalWaitUntil = context.waitUntil.bind(context) as typeof context.waitUntil;\n const registry: FlushLockRegistry = { locks: new Set(), originalWaitUntil };\n const instrumentedWaitUntil: typeof context.waitUntil = promise => {\n // Snapshot active locks so locks created after this call do not wait for earlier waitUntil work.\n const locks = [...registry.locks];\n\n for (const lock of locks) {\n lock.acquire();\n }\n\n return originalWaitUntil(\n promise.finally(() => {\n for (const lock of locks) {\n lock.release();\n }\n }),\n );\n };\n\n flushLockRegistries.set(instrumentedWaitUntil, registry);\n context.waitUntil = instrumentedWaitUntil;\n\n return registry;\n}\n\n/**\n * Flushes the client and then disposes of it to allow garbage collection.\n * This should be called at the end of each request to prevent memory leaks.\n *\n * @param client - The CloudflareClient instance to flush and dispose\n * @param timeout - Timeout in milliseconds for the flush operation\n * @returns A promise that resolves when flush and dispose are complete\n */\nexport async function flushAndDispose(client: Client | undefined, timeout = 2000): Promise<void> {\n if (!client) {\n await flush(timeout);\n\n return;\n }\n\n await client.flush(timeout);\n client.dispose();\n}\n"],"names":["flush"],"mappings":";;;;AAmBA,MAAM,mBAAA,uBAA0B,OAAA,EAA0D;AAgBnF,SAAS,qBAAqB,OAAA,EAAsE;AAEzG,EAAA,MAAM,mBAAmB,OAAA,CAAQ,SAAA;AACjC,EAAA,MAAM,QAAA,GAAW,mBAAA,CAAoB,GAAA,CAAI,gBAAgB,CAAA,EAAG,iBAAA;AAC5D,EAAA,OAAO,QAAA,IAAY,gBAAA;AACrB;AAUO,SAAS,cAAc,OAAA,EAAsC;AAClE,EAAA,MAAM,QAAA,GAAW,6BAA6B,OAAO,CAAA;AACrD,EAAA,IAAI,iBAA6B,MAAM,MAAA;AACvC,EAAA,MAAM,OAAA,GAAU,IAAI,OAAA,CAAc,CAAA,GAAA,KAAO;AACvC,IAAA,cAAA,GAAiB,GAAA;AAAA,EACnB,CAAC,CAAA;AACD,EAAA,IAAI,OAAA,GAAU,CAAA;AAEd,EAAA,MAAM,IAAA,GAA0B;AAAA,IAC9B,KAAA,EAAO,OAAA;AAAA,IACP,SAAS,MAAM;AACb,MAAA,OAAA,EAAA;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AAA,MACF,CAAC;AAAA,KACH;AAAA,EACF,CAAA;AAEA,EAAA,mBAAA,CAAoB,GAAA,CAAI,uBAAuB,QAAQ,CAAA;AACvD,EAAA,OAAA,CAAQ,SAAA,GAAY,qBAAA;AAEpB,EAAA,OAAO,QAAA;AACT;AAUA,eAAsB,eAAA,CAAgB,MAAA,EAA4B,OAAA,GAAU,GAAA,EAAqB;AAC/F,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,MAAMA,WAAM,OAAO,CAAA;AAEnB,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,MAAA,CAAO,MAAM,OAAO,CAAA;AAC1B,EAAA,MAAA,CAAO,OAAA,EAAQ;AACjB;;;;;;"}
1
+ {"version":3,"file":"flush.js","sources":["../../src/flush.ts"],"sourcesContent":["import type { ExecutionContext } from '@cloudflare/workers-types';\nimport type { Client } from '@sentry/core';\nimport { debug, flush } from '@sentry/core';\nimport { DEBUG_BUILD } from './debug-build';\n\ntype FlushLock = {\n readonly ready: Promise<void>;\n readonly finalize: () => Promise<void>;\n};\n\ntype FlushLockRegistry = {\n readonly locks: Set<FlushLockInternal>;\n readonly originalWaitUntil: ExecutionContext['waitUntil'];\n};\n\ntype FlushLockInternal = FlushLock & {\n readonly acquire: () => void;\n readonly release: () => void;\n};\n\nconst flushLockRegistries = new WeakMap<ExecutionContext['waitUntil'], FlushLockRegistry>();\n\n/**\n * Returns the original (un-instrumented) waitUntil function for a context.\n * This should be used when calling waitUntil with flushAndDispose to avoid deadlock.\n *\n * The flush lock mechanism wraps context.waitUntil to track pending tasks.\n * If we call waitUntil(flushAndDispose(client)) through the instrumented version,\n * it creates a deadlock because:\n * 1. The instrumented waitUntil acquires the flush lock\n * 2. flushAndDispose calls client.flush() which waits for the lock to be released\n * 3. The lock won't be released until the waitUntil promise completes\n * 4. The waitUntil promise won't complete until flush() returns\n *\n * By using the original waitUntil for flush operations, we bypass this issue.\n */\nexport function getOriginalWaitUntil(context: ExecutionContext): ExecutionContext['waitUntil'] | undefined {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const currentWaitUntil = context.waitUntil;\n const original = flushLockRegistries.get(currentWaitUntil)?.originalWaitUntil;\n return original ?? currentWaitUntil;\n}\n\n/**\n * Enhances the given execution context by wrapping its `waitUntil` method with a proxy\n * to monitor pending tasks, and provides a flusher function to ensure all tasks\n * have been completed before executing any subsequent logic.\n *\n * @param {ExecutionContext} context - The execution context to be enhanced. If no context is provided, the function returns undefined.\n * @return {FlushLock} Returns a flusher function if a valid context is provided, otherwise undefined.\n */\nexport function makeFlushLock(context: ExecutionContext): FlushLock {\n const registry = getOrCreateFlushLockRegistry(context);\n let resolveAllDone: () => void = () => undefined;\n const allDone = new Promise<void>(res => {\n resolveAllDone = res;\n });\n let pending = 0;\n\n const lock: FlushLockInternal = {\n ready: allDone,\n acquire: () => {\n pending++;\n },\n release: () => {\n if (--pending === 0) {\n registry.locks.delete(lock);\n resolveAllDone();\n }\n },\n finalize: () => {\n if (pending === 0) {\n registry.locks.delete(lock);\n resolveAllDone();\n }\n return allDone;\n },\n };\n\n registry.locks.add(lock);\n return Object.freeze(lock);\n}\n\nfunction getOrCreateFlushLockRegistry(context: ExecutionContext): FlushLockRegistry {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const waitUntil = context.waitUntil;\n const existingRegistry = flushLockRegistries.get(waitUntil);\n\n if (existingRegistry) {\n return existingRegistry;\n }\n\n const originalWaitUntil = context.waitUntil.bind(context) as typeof context.waitUntil;\n const registry: FlushLockRegistry = { locks: new Set(), originalWaitUntil };\n const instrumentedWaitUntil: typeof context.waitUntil = promise => {\n // Snapshot active locks so locks created after this call do not wait for earlier waitUntil work.\n const locks = [...registry.locks];\n\n for (const lock of locks) {\n lock.acquire();\n }\n\n return originalWaitUntil(\n promise.finally(() => {\n for (const lock of locks) {\n lock.release();\n }\n }),\n );\n };\n\n flushLockRegistries.set(instrumentedWaitUntil, registry);\n context.waitUntil = instrumentedWaitUntil;\n\n return registry;\n}\n\n/**\n * Flushes the client and then disposes of it to allow garbage collection.\n * This should be called at the end of each request to prevent memory leaks.\n *\n * This function never rejects. On Workers, a rejected promise passed to\n * `ctx.waitUntil` marks the whole invocation as `outcome: exception` even when\n * the handler itself completed successfully. Since flush/dispose is internal\n * SDK housekeeping, a failure here must not fail the user's invocation.\n *\n * @param client - The CloudflareClient instance to flush and dispose\n * @param timeout - Timeout in milliseconds for the flush operation\n * @returns A promise that resolves when flush and dispose are complete\n */\nexport async function flushAndDispose(client: Client | undefined, timeout = 2000): Promise<void> {\n try {\n if (!client) {\n await flush(timeout);\n return;\n }\n await client.flush(timeout);\n } catch (e) {\n DEBUG_BUILD && debug.warn('Failed to flush client', e);\n } finally {\n try {\n client?.dispose();\n } catch (e) {\n DEBUG_BUILD && debug.warn('Failed to dispose client', e);\n }\n }\n}\n"],"names":["flush","DEBUG_BUILD","debug"],"mappings":";;;;;AAoBA,MAAM,mBAAA,uBAA0B,OAAA,EAA0D;AAgBnF,SAAS,qBAAqB,OAAA,EAAsE;AAEzG,EAAA,MAAM,mBAAmB,OAAA,CAAQ,SAAA;AACjC,EAAA,MAAM,QAAA,GAAW,mBAAA,CAAoB,GAAA,CAAI,gBAAgB,CAAA,EAAG,iBAAA;AAC5D,EAAA,OAAO,QAAA,IAAY,gBAAA;AACrB;AAUO,SAAS,cAAc,OAAA,EAAsC;AAClE,EAAA,MAAM,QAAA,GAAW,6BAA6B,OAAO,CAAA;AACrD,EAAA,IAAI,iBAA6B,MAAM,MAAA;AACvC,EAAA,MAAM,OAAA,GAAU,IAAI,OAAA,CAAc,CAAA,GAAA,KAAO;AACvC,IAAA,cAAA,GAAiB,GAAA;AAAA,EACnB,CAAC,CAAA;AACD,EAAA,IAAI,OAAA,GAAU,CAAA;AAEd,EAAA,MAAM,IAAA,GAA0B;AAAA,IAC9B,KAAA,EAAO,OAAA;AAAA,IACP,SAAS,MAAM;AACb,MAAA,OAAA,EAAA;AAAA,IACF,CAAA;AAAA,IACA,SAAS,MAAM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AAA;AAEA,EAAA,mBAAA,CAAoB,GAAA,CAAI,uBAAuB,QAAQ,CAAA;AACvD,EAAA,OAAA,CAAQ,SAAA,GAAY,qBAAA;AAEpB,EAAA,OAAO,QAAA;AACT;AAeA,eAAsB,eAAA,CAAgB,MAAA,EAA4B,OAAA,GAAU,GAAA,EAAqB;AAC/F,EAAA,IAAI;AACF,IAAA,IAAI,CAAC,MAAA,EAAQ;AACX,MAAA,MAAMA,WAAM,OAAO,CAAA;AACnB,MAAA;AAAA,IACF;AACA,IAAA,MAAM,MAAA,CAAO,MAAM,OAAO,CAAA;AAAA,EAC5B,SAAS,CAAA,EAAG;AACV,IAAAC,sBAAA,IAAeC,UAAA,CAAM,IAAA,CAAK,wBAAA,EAA0B,CAAC,CAAA;AAAA,EACvD,CAAA,SAAE;AACA,IAAA,IAAI;AACF,MAAA,MAAA,EAAQ,OAAA,EAAQ;AAAA,IAClB,SAAS,CAAA,EAAG;AACV,MAAAD,sBAAA,IAAeC,UAAA,CAAM,IAAA,CAAK,0BAAA,EAA4B,CAAC,CAAA;AAAA,IACzD;AAAA,EACF;AACF;;;;;;"}
@@ -0,0 +1,124 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const node = require('@sentry/node');
4
+ const vercelai = require('./integrations/tracing/vercelai.js');
5
+ const client = require('../client.js');
6
+ const core = require('@sentry/core');
7
+ const fetch = require('../integrations/fetch.js');
8
+ const sdk = require('../sdk.js');
9
+ const hono = require('../integrations/hono.js');
10
+ const httpServer = require('../integrations/httpServer.js');
11
+ const instrumentD1 = require('../instrumentations/worker/instrumentD1.js');
12
+ const durableobject = require('../durableobject.js');
13
+ const workflows = require('../workflows.js');
14
+ const pagesPlugin = require('../pages-plugin.js');
15
+ const async = require('../async.js');
16
+ const withSentry = require('../withSentry.js');
17
+ const request = require('../request.js');
18
+
19
+
20
+
21
+ exports.prismaIntegration = node.prismaIntegration;
22
+ exports.vercelAIIntegration = vercelai.vercelAIIntegration;
23
+ exports.CloudflareClient = client.CloudflareClient;
24
+ exports.SDK_VERSION = core.SDK_VERSION;
25
+ exports.SEMANTIC_ATTRIBUTE_SENTRY_OP = core.SEMANTIC_ATTRIBUTE_SENTRY_OP;
26
+ exports.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN;
27
+ exports.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE = core.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE;
28
+ exports.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE;
29
+ exports.Scope = core.Scope;
30
+ exports.addBreadcrumb = core.addBreadcrumb;
31
+ exports.addEventProcessor = core.addEventProcessor;
32
+ exports.addIntegration = core.addIntegration;
33
+ exports.bindScopeToEmitter = core.bindScopeToEmitter;
34
+ exports.captureCheckIn = core.captureCheckIn;
35
+ exports.captureConsoleIntegration = core.captureConsoleIntegration;
36
+ exports.captureEvent = core.captureEvent;
37
+ exports.captureException = core.captureException;
38
+ exports.captureFeedback = core.captureFeedback;
39
+ exports.captureMessage = core.captureMessage;
40
+ exports.close = core.close;
41
+ exports.consoleIntegration = core.consoleIntegration;
42
+ exports.consoleLoggingIntegration = core.consoleLoggingIntegration;
43
+ exports.continueTrace = core.continueTrace;
44
+ exports.createConsolaReporter = core.createConsolaReporter;
45
+ exports.createLangChainCallbackHandler = core.createLangChainCallbackHandler;
46
+ exports.createTransport = core.createTransport;
47
+ exports.dedupeIntegration = core.dedupeIntegration;
48
+ exports.eventFiltersIntegration = core.eventFiltersIntegration;
49
+ exports.extraErrorDataIntegration = core.extraErrorDataIntegration;
50
+ exports.featureFlagsIntegration = core.featureFlagsIntegration;
51
+ exports.flush = core.flush;
52
+ exports.functionToStringIntegration = core.functionToStringIntegration;
53
+ exports.getActiveSpan = core.getActiveSpan;
54
+ exports.getClient = core.getClient;
55
+ exports.getCurrentScope = core.getCurrentScope;
56
+ exports.getGlobalScope = core.getGlobalScope;
57
+ exports.getIsolationScope = core.getIsolationScope;
58
+ exports.getRootSpan = core.getRootSpan;
59
+ exports.getSpanDescendants = core.getSpanDescendants;
60
+ exports.getSpanStatusFromHttpCode = core.getSpanStatusFromHttpCode;
61
+ exports.getTraceData = core.getTraceData;
62
+ exports.getTraceMetaTags = core.getTraceMetaTags;
63
+ exports.growthbookIntegration = core.growthbookIntegration;
64
+ exports.inboundFiltersIntegration = core.inboundFiltersIntegration;
65
+ exports.instrumentAnthropicAiClient = core.instrumentAnthropicAiClient;
66
+ exports.instrumentCreateReactAgent = core.instrumentCreateReactAgent;
67
+ exports.instrumentGoogleGenAIClient = core.instrumentGoogleGenAIClient;
68
+ exports.instrumentLangChainEmbeddings = core.instrumentLangChainEmbeddings;
69
+ exports.instrumentLangGraph = core.instrumentLangGraph;
70
+ exports.instrumentOpenAiClient = core.instrumentOpenAiClient;
71
+ exports.instrumentPostgresJsSql = core.instrumentPostgresJsSql;
72
+ exports.instrumentSupabaseClient = core.instrumentSupabaseClient;
73
+ exports.isEnabled = core.isEnabled;
74
+ exports.isInitialized = core.isInitialized;
75
+ exports.lastEventId = core.lastEventId;
76
+ exports.linkedErrorsIntegration = core.linkedErrorsIntegration;
77
+ exports.logger = core.logger;
78
+ exports.metrics = core.metrics;
79
+ exports.moduleMetadataIntegration = core.moduleMetadataIntegration;
80
+ exports.requestDataIntegration = core.requestDataIntegration;
81
+ exports.rewriteFramesIntegration = core.rewriteFramesIntegration;
82
+ exports.setAttribute = core.setAttribute;
83
+ exports.setAttributes = core.setAttributes;
84
+ exports.setContext = core.setContext;
85
+ exports.setConversationId = core.setConversationId;
86
+ exports.setCurrentClient = core.setCurrentClient;
87
+ exports.setExtra = core.setExtra;
88
+ exports.setExtras = core.setExtras;
89
+ exports.setHttpStatus = core.setHttpStatus;
90
+ exports.setMeasurement = core.setMeasurement;
91
+ exports.setTag = core.setTag;
92
+ exports.setTags = core.setTags;
93
+ exports.setUser = core.setUser;
94
+ exports.spanStreamingIntegration = core.spanStreamingIntegration;
95
+ exports.spanToBaggageHeader = core.spanToBaggageHeader;
96
+ exports.spanToJSON = core.spanToJSON;
97
+ exports.spanToTraceHeader = core.spanToTraceHeader;
98
+ exports.startInactiveSpan = core.startInactiveSpan;
99
+ exports.startNewTrace = core.startNewTrace;
100
+ exports.startSpan = core.startSpan;
101
+ exports.startSpanManual = core.startSpanManual;
102
+ exports.supabaseIntegration = core.supabaseIntegration;
103
+ exports.suppressTracing = core.suppressTracing;
104
+ exports.trpcMiddleware = core.trpcMiddleware;
105
+ exports.updateSpanName = core.updateSpanName;
106
+ exports.withActiveSpan = core.withActiveSpan;
107
+ exports.withIsolationScope = core.withIsolationScope;
108
+ exports.withMonitor = core.withMonitor;
109
+ exports.withScope = core.withScope;
110
+ exports.withStreamedSpan = core.withStreamedSpan;
111
+ exports.wrapMcpServerWithSentry = core.wrapMcpServerWithSentry;
112
+ exports.zodErrorsIntegration = core.zodErrorsIntegration;
113
+ exports.fetchIntegration = fetch.fetchIntegration;
114
+ exports.getDefaultIntegrations = sdk.getDefaultIntegrations;
115
+ exports.honoIntegration = hono.honoIntegration;
116
+ exports.httpServerIntegration = httpServer.httpServerIntegration;
117
+ exports.instrumentD1WithSentry = instrumentD1.instrumentD1WithSentry;
118
+ exports.instrumentDurableObjectWithSentry = durableobject.instrumentDurableObjectWithSentry;
119
+ exports.instrumentWorkflowWithSentry = workflows.instrumentWorkflowWithSentry;
120
+ exports.sentryPagesPlugin = pagesPlugin.sentryPagesPlugin;
121
+ exports.setAsyncLocalStorageAsyncContextStrategy = async.setAsyncLocalStorageAsyncContextStrategy;
122
+ exports.withSentry = withSentry.withSentry;
123
+ exports.wrapRequestHandler = request.wrapRequestHandler;
124
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,18 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const core = require('@sentry/core');
4
+ const serverUtils = require('@sentry/server-utils');
5
+ const vercelai = require('../../../integrations/tracing/vercelai.js');
6
+
7
+ const _vercelAIIntegration = ((options = {}) => {
8
+ const inner = serverUtils.vercelAiIntegration(options);
9
+ const instrumentation = vercelai.vercelAIIntegration(options);
10
+ return {
11
+ ...inner,
12
+ ...instrumentation
13
+ };
14
+ });
15
+ const vercelAIIntegration = core.defineIntegration(_vercelAIIntegration);
16
+
17
+ exports.vercelAIIntegration = vercelAIIntegration;
18
+ //# sourceMappingURL=vercelai.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vercelai.js","sources":["../../../../../src/nodejs_compat/integrations/tracing/vercelai.ts"],"sourcesContent":["/**\n * This is a copy of the Vercel AI integration from the Cloudflare SDK (src/integrations/tracing/vercelai.ts).\n *\n * The only difference is that it includes tracing channel support\n * because the default Vercel AI integration needs `nodejs_als`, while this one uses `nodejs_compat`.\n */\n\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { vercelAiIntegration as serverUtilsVercelAiIntegration } from '@sentry/server-utils';\nimport { vercelAIIntegration as cloudflareVercelAIIntegration } from '../../../integrations/tracing/vercelai';\n\ninterface VercelAiOptions {\n /**\n * Enable or disable truncation of recorded input messages.\n * Defaults to `true`.\n */\n enableTruncation?: boolean;\n}\n\nconst _vercelAIIntegration = ((options: VercelAiOptions = {}) => {\n const inner = serverUtilsVercelAiIntegration(options);\n const instrumentation = cloudflareVercelAIIntegration(options);\n\n return {\n ...inner,\n ...instrumentation,\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [ai](https://www.npmjs.com/package/ai) library.\n * This integration is not enabled by default, you need to manually add it.\n *\n * For more information, see the [`ai` documentation](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry).\n *\n * You need to enable collecting spans for a specific call by setting\n * `experimental_telemetry.isEnabled` to `true` in the first argument of the function call.\n *\n * ```javascript\n * const result = await generateText({\n * model: openai('gpt-4-turbo'),\n * experimental_telemetry: { isEnabled: true },\n * });\n * ```\n *\n * If you want to collect inputs and outputs for a specific call, you must specifically opt-in to each\n * function call by setting `experimental_telemetry.recordInputs` and `experimental_telemetry.recordOutputs`\n * to `true`.\n *\n * ```javascript\n * const result = await generateText({\n * model: openai('gpt-4-turbo'),\n * experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },\n * });\n */\nexport const vercelAIIntegration = defineIntegration(_vercelAIIntegration);\n"],"names":["serverUtilsVercelAiIntegration","cloudflareVercelAIIntegration","defineIntegration"],"mappings":";;;;;;AAoBA,MAAM,oBAAA,IAAwB,CAAC,OAAA,GAA2B,EAAC,KAAM;AAC/D,EAAA,MAAM,KAAA,GAAQA,gCAA+B,OAAO,CAAA;AACpD,EAAA,MAAM,eAAA,GAAkBC,6BAA8B,OAAO,CAAA;AAE7D,EAAA,OAAO;AAAA,IACL,GAAG,KAAA;AAAA,IACH,GAAG;AAAA,GACL;AACF,CAAA,CAAA;AA4BO,MAAM,mBAAA,GAAsBC,uBAAkB,oBAAoB;;;;"}
@@ -1,4 +1,5 @@
1
- import { flush } from '@sentry/core';
1
+ import { flush, debug } from '@sentry/core';
2
+ import { DEBUG_BUILD } from './debug-build.js';
2
3
 
3
4
  const flushLockRegistries = /* @__PURE__ */ new WeakMap();
4
5
  function getOriginalWaitUntil(context) {
@@ -61,12 +62,21 @@ function getOrCreateFlushLockRegistry(context) {
61
62
  return registry;
62
63
  }
63
64
  async function flushAndDispose(client, timeout = 2e3) {
64
- if (!client) {
65
- await flush(timeout);
66
- return;
65
+ try {
66
+ if (!client) {
67
+ await flush(timeout);
68
+ return;
69
+ }
70
+ await client.flush(timeout);
71
+ } catch (e) {
72
+ DEBUG_BUILD && debug.warn("Failed to flush client", e);
73
+ } finally {
74
+ try {
75
+ client?.dispose();
76
+ } catch (e) {
77
+ DEBUG_BUILD && debug.warn("Failed to dispose client", e);
78
+ }
67
79
  }
68
- await client.flush(timeout);
69
- client.dispose();
70
80
  }
71
81
 
72
82
  export { flushAndDispose, getOriginalWaitUntil, makeFlushLock };
@@ -1 +1 @@
1
- {"version":3,"file":"flush.js","sources":["../../src/flush.ts"],"sourcesContent":["import type { ExecutionContext } from '@cloudflare/workers-types';\nimport type { Client } from '@sentry/core';\nimport { flush } from '@sentry/core';\n\ntype FlushLock = {\n readonly ready: Promise<void>;\n readonly finalize: () => Promise<void>;\n};\n\ntype FlushLockRegistry = {\n readonly locks: Set<FlushLockInternal>;\n readonly originalWaitUntil: ExecutionContext['waitUntil'];\n};\n\ntype FlushLockInternal = FlushLock & {\n readonly acquire: () => void;\n readonly release: () => void;\n};\n\nconst flushLockRegistries = new WeakMap<ExecutionContext['waitUntil'], FlushLockRegistry>();\n\n/**\n * Returns the original (un-instrumented) waitUntil function for a context.\n * This should be used when calling waitUntil with flushAndDispose to avoid deadlock.\n *\n * The flush lock mechanism wraps context.waitUntil to track pending tasks.\n * If we call waitUntil(flushAndDispose(client)) through the instrumented version,\n * it creates a deadlock because:\n * 1. The instrumented waitUntil acquires the flush lock\n * 2. flushAndDispose calls client.flush() which waits for the lock to be released\n * 3. The lock won't be released until the waitUntil promise completes\n * 4. The waitUntil promise won't complete until flush() returns\n *\n * By using the original waitUntil for flush operations, we bypass this issue.\n */\nexport function getOriginalWaitUntil(context: ExecutionContext): ExecutionContext['waitUntil'] | undefined {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const currentWaitUntil = context.waitUntil;\n const original = flushLockRegistries.get(currentWaitUntil)?.originalWaitUntil;\n return original ?? currentWaitUntil;\n}\n\n/**\n * Enhances the given execution context by wrapping its `waitUntil` method with a proxy\n * to monitor pending tasks, and provides a flusher function to ensure all tasks\n * have been completed before executing any subsequent logic.\n *\n * @param {ExecutionContext} context - The execution context to be enhanced. If no context is provided, the function returns undefined.\n * @return {FlushLock} Returns a flusher function if a valid context is provided, otherwise undefined.\n */\nexport function makeFlushLock(context: ExecutionContext): FlushLock {\n const registry = getOrCreateFlushLockRegistry(context);\n let resolveAllDone: () => void = () => undefined;\n const allDone = new Promise<void>(res => {\n resolveAllDone = res;\n });\n let pending = 0;\n\n const lock: FlushLockInternal = {\n ready: allDone,\n acquire: () => {\n pending++;\n },\n release: () => {\n if (--pending === 0) {\n registry.locks.delete(lock);\n resolveAllDone();\n }\n },\n finalize: () => {\n if (pending === 0) {\n registry.locks.delete(lock);\n resolveAllDone();\n }\n return allDone;\n },\n };\n\n registry.locks.add(lock);\n return Object.freeze(lock);\n}\n\nfunction getOrCreateFlushLockRegistry(context: ExecutionContext): FlushLockRegistry {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const waitUntil = context.waitUntil;\n const existingRegistry = flushLockRegistries.get(waitUntil);\n\n if (existingRegistry) {\n return existingRegistry;\n }\n\n const originalWaitUntil = context.waitUntil.bind(context) as typeof context.waitUntil;\n const registry: FlushLockRegistry = { locks: new Set(), originalWaitUntil };\n const instrumentedWaitUntil: typeof context.waitUntil = promise => {\n // Snapshot active locks so locks created after this call do not wait for earlier waitUntil work.\n const locks = [...registry.locks];\n\n for (const lock of locks) {\n lock.acquire();\n }\n\n return originalWaitUntil(\n promise.finally(() => {\n for (const lock of locks) {\n lock.release();\n }\n }),\n );\n };\n\n flushLockRegistries.set(instrumentedWaitUntil, registry);\n context.waitUntil = instrumentedWaitUntil;\n\n return registry;\n}\n\n/**\n * Flushes the client and then disposes of it to allow garbage collection.\n * This should be called at the end of each request to prevent memory leaks.\n *\n * @param client - The CloudflareClient instance to flush and dispose\n * @param timeout - Timeout in milliseconds for the flush operation\n * @returns A promise that resolves when flush and dispose are complete\n */\nexport async function flushAndDispose(client: Client | undefined, timeout = 2000): Promise<void> {\n if (!client) {\n await flush(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{ Client } from '@sentry/core';\nimport { debug, flush } from '@sentry/core';\nimport { DEBUG_BUILD } from './debug-build';\n\ntype FlushLock = {\n readonly ready: Promise<void>;\n readonly finalize: () => Promise<void>;\n};\n\ntype FlushLockRegistry = {\n readonly locks: Set<FlushLockInternal>;\n readonly originalWaitUntil: ExecutionContext['waitUntil'];\n};\n\ntype FlushLockInternal = FlushLock & {\n readonly acquire: () => void;\n readonly release: () => void;\n};\n\nconst flushLockRegistries = new WeakMap<ExecutionContext['waitUntil'], FlushLockRegistry>();\n\n/**\n * Returns the original (un-instrumented) waitUntil function for a context.\n * This should be used when calling waitUntil with flushAndDispose to avoid deadlock.\n *\n * The flush lock mechanism wraps context.waitUntil to track pending tasks.\n * If we call waitUntil(flushAndDispose(client)) through the instrumented version,\n * it creates a deadlock because:\n * 1. The instrumented waitUntil acquires the flush lock\n * 2. flushAndDispose calls client.flush() which waits for the lock to be released\n * 3. The lock won't be released until the waitUntil promise completes\n * 4. The waitUntil promise won't complete until flush() returns\n *\n * By using the original waitUntil for flush operations, we bypass this issue.\n */\nexport function getOriginalWaitUntil(context: ExecutionContext): ExecutionContext['waitUntil'] | undefined {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const currentWaitUntil = context.waitUntil;\n const original = flushLockRegistries.get(currentWaitUntil)?.originalWaitUntil;\n return original ?? currentWaitUntil;\n}\n\n/**\n * Enhances the given execution context by wrapping its `waitUntil` method with a proxy\n * to monitor pending tasks, and provides a flusher function to ensure all tasks\n * have been completed before executing any subsequent logic.\n *\n * @param {ExecutionContext} context - The execution context to be enhanced. If no context is provided, the function returns undefined.\n * @return {FlushLock} Returns a flusher function if a valid context is provided, otherwise undefined.\n */\nexport function makeFlushLock(context: ExecutionContext): FlushLock {\n const registry = getOrCreateFlushLockRegistry(context);\n let resolveAllDone: () => void = () => undefined;\n const allDone = new Promise<void>(res => {\n resolveAllDone = res;\n });\n let pending = 0;\n\n const lock: FlushLockInternal = {\n ready: allDone,\n acquire: () => {\n pending++;\n },\n release: () => {\n if (--pending === 0) {\n registry.locks.delete(lock);\n resolveAllDone();\n }\n },\n finalize: () => {\n if (pending === 0) {\n registry.locks.delete(lock);\n resolveAllDone();\n }\n return allDone;\n },\n };\n\n registry.locks.add(lock);\n return Object.freeze(lock);\n}\n\nfunction getOrCreateFlushLockRegistry(context: ExecutionContext): FlushLockRegistry {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const waitUntil = context.waitUntil;\n const existingRegistry = flushLockRegistries.get(waitUntil);\n\n if (existingRegistry) {\n return existingRegistry;\n }\n\n const originalWaitUntil = context.waitUntil.bind(context) as typeof context.waitUntil;\n const registry: FlushLockRegistry = { locks: new Set(), originalWaitUntil };\n const instrumentedWaitUntil: typeof context.waitUntil = promise => {\n // Snapshot active locks so locks created after this call do not wait for earlier waitUntil work.\n const locks = [...registry.locks];\n\n for (const lock of locks) {\n lock.acquire();\n }\n\n return originalWaitUntil(\n promise.finally(() => {\n for (const lock of locks) {\n lock.release();\n }\n }),\n );\n };\n\n flushLockRegistries.set(instrumentedWaitUntil, registry);\n context.waitUntil = instrumentedWaitUntil;\n\n return registry;\n}\n\n/**\n * Flushes the client and then disposes of it to allow garbage collection.\n * This should be called at the end of each request to prevent memory leaks.\n *\n * This function never rejects. On Workers, a rejected promise passed to\n * `ctx.waitUntil` marks the whole invocation as `outcome: exception` even when\n * the handler itself completed successfully. Since flush/dispose is internal\n * SDK housekeeping, a failure here must not fail the user's invocation.\n *\n * @param client - The CloudflareClient instance to flush and dispose\n * @param timeout - Timeout in milliseconds for the flush operation\n * @returns A promise that resolves when flush and dispose are complete\n */\nexport async function flushAndDispose(client: Client | undefined, timeout = 2000): Promise<void> {\n try {\n if (!client) {\n await flush(timeout);\n return;\n }\n await client.flush(timeout);\n } catch (e) {\n DEBUG_BUILD && debug.warn('Failed to flush client', e);\n } finally {\n try {\n client?.dispose();\n } catch (e) {\n DEBUG_BUILD && debug.warn('Failed to dispose client', e);\n }\n }\n}\n"],"names":[],"mappings":";;;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AClB,SAAS,CAAA,EAAG;AACV,MAAA,WAAA,IAAe,KAAA,CAAM,IAAA,CAAK,0BAAA,EAA4B,CAAC,CAAA;AAAA,IACzD;AAAA,EACF;AACF;;;;"}
@@ -0,0 +1,16 @@
1
+ export { prismaIntegration } from '@sentry/node';
2
+ export { vercelAIIntegration } from './integrations/tracing/vercelai.js';
3
+ export { CloudflareClient } from '../client.js';
4
+ export { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, Scope, addBreadcrumb, addEventProcessor, addIntegration, bindScopeToEmitter, captureCheckIn, captureConsoleIntegration, captureEvent, captureException, captureFeedback, captureMessage, close, consoleIntegration, consoleLoggingIntegration, continueTrace, createConsolaReporter, createLangChainCallbackHandler, createTransport, dedupeIntegration, eventFiltersIntegration, extraErrorDataIntegration, featureFlagsIntegration, flush, functionToStringIntegration, getActiveSpan, getClient, getCurrentScope, getGlobalScope, getIsolationScope, getRootSpan, getSpanDescendants, getSpanStatusFromHttpCode, getTraceData, getTraceMetaTags, growthbookIntegration, inboundFiltersIntegration, instrumentAnthropicAiClient, instrumentCreateReactAgent, instrumentGoogleGenAIClient, instrumentLangChainEmbeddings, instrumentLangGraph, instrumentOpenAiClient, instrumentPostgresJsSql, instrumentSupabaseClient, isEnabled, isInitialized, lastEventId, linkedErrorsIntegration, logger, metrics, moduleMetadataIntegration, requestDataIntegration, rewriteFramesIntegration, setAttribute, setAttributes, setContext, setConversationId, setCurrentClient, setExtra, setExtras, setHttpStatus, setMeasurement, setTag, setTags, setUser, spanStreamingIntegration, spanToBaggageHeader, spanToJSON, spanToTraceHeader, startInactiveSpan, startNewTrace, startSpan, startSpanManual, supabaseIntegration, suppressTracing, trpcMiddleware, updateSpanName, withActiveSpan, withIsolationScope, withMonitor, withScope, withStreamedSpan, wrapMcpServerWithSentry, zodErrorsIntegration } from '@sentry/core';
5
+ export { fetchIntegration } from '../integrations/fetch.js';
6
+ export { getDefaultIntegrations } from '../sdk.js';
7
+ export { honoIntegration } from '../integrations/hono.js';
8
+ export { httpServerIntegration } from '../integrations/httpServer.js';
9
+ export { instrumentD1WithSentry } from '../instrumentations/worker/instrumentD1.js';
10
+ export { instrumentDurableObjectWithSentry } from '../durableobject.js';
11
+ export { instrumentWorkflowWithSentry } from '../workflows.js';
12
+ export { sentryPagesPlugin } from '../pages-plugin.js';
13
+ export { setAsyncLocalStorageAsyncContextStrategy } from '../async.js';
14
+ export { withSentry } from '../withSentry.js';
15
+ export { wrapRequestHandler } from '../request.js';
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
@@ -0,0 +1,16 @@
1
+ import { defineIntegration } from '@sentry/core';
2
+ import { vercelAiIntegration } from '@sentry/server-utils';
3
+ import { vercelAIIntegration as vercelAIIntegration$1 } from '../../../integrations/tracing/vercelai.js';
4
+
5
+ const _vercelAIIntegration = ((options = {}) => {
6
+ const inner = vercelAiIntegration(options);
7
+ const instrumentation = vercelAIIntegration$1(options);
8
+ return {
9
+ ...inner,
10
+ ...instrumentation
11
+ };
12
+ });
13
+ const vercelAIIntegration = defineIntegration(_vercelAIIntegration);
14
+
15
+ export { vercelAIIntegration };
16
+ //# sourceMappingURL=vercelai.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vercelai.js","sources":["../../../../../src/nodejs_compat/integrations/tracing/vercelai.ts"],"sourcesContent":["/**\n * This is a copy of the Vercel AI integration from the Cloudflare SDK (src/integrations/tracing/vercelai.ts).\n *\n * The only difference is that it includes tracing channel support\n * because the default Vercel AI integration needs `nodejs_als`, while this one uses `nodejs_compat`.\n */\n\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { vercelAiIntegration as serverUtilsVercelAiIntegration } from '@sentry/server-utils';\nimport { vercelAIIntegration as cloudflareVercelAIIntegration } from '../../../integrations/tracing/vercelai';\n\ninterface VercelAiOptions {\n /**\n * Enable or disable truncation of recorded input messages.\n * Defaults to `true`.\n */\n enableTruncation?: boolean;\n}\n\nconst _vercelAIIntegration = ((options: VercelAiOptions = {}) => {\n const inner = serverUtilsVercelAiIntegration(options);\n const instrumentation = cloudflareVercelAIIntegration(options);\n\n return {\n ...inner,\n ...instrumentation,\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [ai](https://www.npmjs.com/package/ai) library.\n * This integration is not enabled by default, you need to manually add it.\n *\n * For more information, see the [`ai` documentation](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry).\n *\n * You need to enable collecting spans for a specific call by setting\n * `experimental_telemetry.isEnabled` to `true` in the first argument of the function call.\n *\n * ```javascript\n * const result = await generateText({\n * model: openai('gpt-4-turbo'),\n * experimental_telemetry: { isEnabled: true },\n * });\n * ```\n *\n * If you want to collect inputs and outputs for a specific call, you must specifically opt-in to each\n * function call by setting `experimental_telemetry.recordInputs` and `experimental_telemetry.recordOutputs`\n * to `true`.\n *\n * ```javascript\n * const result = await generateText({\n * model: openai('gpt-4-turbo'),\n * experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },\n * });\n */\nexport const vercelAIIntegration = defineIntegration(_vercelAIIntegration);\n"],"names":["serverUtilsVercelAiIntegration","cloudflareVercelAIIntegration"],"mappings":";;;;AAoBA,MAAM,oBAAA,IAAwB,CAAC,OAAA,GAA2B,EAAC,KAAM;AAC/D,EAAA,MAAM,KAAA,GAAQA,oBAA+B,OAAO,CAAA;AACpD,EAAA,MAAM,eAAA,GAAkBC,sBAA8B,OAAO,CAAA;AAE7D,EAAA,OAAO;AAAA,IACL,GAAG,KAAA;AAAA,IACH,GAAG;AAAA,GACL;AACF,CAAA,CAAA;AA4BO,MAAM,mBAAA,GAAsB,kBAAkB,oBAAoB;;;;"}
@@ -1 +1 @@
1
- {"type":"module","version":"10.63.0","sideEffects":false}
1
+ {"type":"module","version":"10.64.0","sideEffects":false}
@@ -32,6 +32,11 @@ export declare function makeFlushLock(context: ExecutionContext): FlushLock;
32
32
  * Flushes the client and then disposes of it to allow garbage collection.
33
33
  * This should be called at the end of each request to prevent memory leaks.
34
34
  *
35
+ * This function never rejects. On Workers, a rejected promise passed to
36
+ * `ctx.waitUntil` marks the whole invocation as `outcome: exception` even when
37
+ * the handler itself completed successfully. Since flush/dispose is internal
38
+ * SDK housekeeping, a failure here must not fail the user's invocation.
39
+ *
35
40
  * @param client - The CloudflareClient instance to flush and dispose
36
41
  * @param timeout - Timeout in milliseconds for the flush operation
37
42
  * @returns A promise that resolves when flush and dispose are complete
@@ -1 +1 @@
1
- {"version":3,"file":"flush.d.ts","sourceRoot":"","sources":["../../src/flush.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC,CAAC;AAcF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,GAAG,gBAAgB,CAAC,WAAW,CAAC,GAAG,SAAS,CAKzG;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CA8BlE;AAoCD;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,SAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAS/F"}
1
+ {"version":3,"file":"flush.d.ts","sourceRoot":"","sources":["../../src/flush.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC,CAAC;AAcF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,GAAG,gBAAgB,CAAC,WAAW,CAAC,GAAG,SAAS,CAKzG;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CA8BlE;AAoCD;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,SAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB/F"}
@@ -0,0 +1,4 @@
1
+ export * from '../index';
2
+ export { prismaIntegration } from '@sentry/node';
3
+ export { vercelAIIntegration } from './integrations/tracing/vercelai';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/nodejs_compat/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * This is a copy of the Vercel AI integration from the Cloudflare SDK (src/integrations/tracing/vercelai.ts).
3
+ *
4
+ * The only difference is that it includes tracing channel support
5
+ * because the default Vercel AI integration needs `nodejs_als`, while this one uses `nodejs_compat`.
6
+ */
7
+ interface VercelAiOptions {
8
+ /**
9
+ * Enable or disable truncation of recorded input messages.
10
+ * Defaults to `true`.
11
+ */
12
+ enableTruncation?: boolean;
13
+ }
14
+ /**
15
+ * Adds Sentry tracing instrumentation for the [ai](https://www.npmjs.com/package/ai) library.
16
+ * This integration is not enabled by default, you need to manually add it.
17
+ *
18
+ * For more information, see the [`ai` documentation](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry).
19
+ *
20
+ * You need to enable collecting spans for a specific call by setting
21
+ * `experimental_telemetry.isEnabled` to `true` in the first argument of the function call.
22
+ *
23
+ * ```javascript
24
+ * const result = await generateText({
25
+ * model: openai('gpt-4-turbo'),
26
+ * experimental_telemetry: { isEnabled: true },
27
+ * });
28
+ * ```
29
+ *
30
+ * If you want to collect inputs and outputs for a specific call, you must specifically opt-in to each
31
+ * function call by setting `experimental_telemetry.recordInputs` and `experimental_telemetry.recordOutputs`
32
+ * to `true`.
33
+ *
34
+ * ```javascript
35
+ * const result = await generateText({
36
+ * model: openai('gpt-4-turbo'),
37
+ * experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },
38
+ * });
39
+ */
40
+ export declare const vercelAIIntegration: (options?: VercelAiOptions | undefined) => import("@sentry/core").Integration & {
41
+ name: string;
42
+ };
43
+ export {};
44
+ //# sourceMappingURL=vercelai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vercelai.d.ts","sourceRoot":"","sources":["../../../../../src/nodejs_compat/integrations/tracing/vercelai.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,UAAU,eAAe;IACvB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAYD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,mBAAmB;;CAA0C,CAAC"}
@@ -32,6 +32,11 @@ export declare function makeFlushLock(context: ExecutionContext): FlushLock;
32
32
  * Flushes the client and then disposes of it to allow garbage collection.
33
33
  * This should be called at the end of each request to prevent memory leaks.
34
34
  *
35
+ * This function never rejects. On Workers, a rejected promise passed to
36
+ * `ctx.waitUntil` marks the whole invocation as `outcome: exception` even when
37
+ * the handler itself completed successfully. Since flush/dispose is internal
38
+ * SDK housekeeping, a failure here must not fail the user's invocation.
39
+ *
35
40
  * @param client - The CloudflareClient instance to flush and dispose
36
41
  * @param timeout - Timeout in milliseconds for the flush operation
37
42
  * @returns A promise that resolves when flush and dispose are complete
@@ -0,0 +1,4 @@
1
+ export * from '../index';
2
+ export { prismaIntegration } from '@sentry/node';
3
+ export { vercelAIIntegration } from './integrations/tracing/vercelai';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,44 @@
1
+ /**
2
+ * This is a copy of the Vercel AI integration from the Cloudflare SDK (src/integrations/tracing/vercelai.ts).
3
+ *
4
+ * The only difference is that it includes tracing channel support
5
+ * because the default Vercel AI integration needs `nodejs_als`, while this one uses `nodejs_compat`.
6
+ */
7
+ interface VercelAiOptions {
8
+ /**
9
+ * Enable or disable truncation of recorded input messages.
10
+ * Defaults to `true`.
11
+ */
12
+ enableTruncation?: boolean;
13
+ }
14
+ /**
15
+ * Adds Sentry tracing instrumentation for the [ai](https://www.npmjs.com/package/ai) library.
16
+ * This integration is not enabled by default, you need to manually add it.
17
+ *
18
+ * For more information, see the [`ai` documentation](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry).
19
+ *
20
+ * You need to enable collecting spans for a specific call by setting
21
+ * `experimental_telemetry.isEnabled` to `true` in the first argument of the function call.
22
+ *
23
+ * ```javascript
24
+ * const result = await generateText({
25
+ * model: openai('gpt-4-turbo'),
26
+ * experimental_telemetry: { isEnabled: true },
27
+ * });
28
+ * ```
29
+ *
30
+ * If you want to collect inputs and outputs for a specific call, you must specifically opt-in to each
31
+ * function call by setting `experimental_telemetry.recordInputs` and `experimental_telemetry.recordOutputs`
32
+ * to `true`.
33
+ *
34
+ * ```javascript
35
+ * const result = await generateText({
36
+ * model: openai('gpt-4-turbo'),
37
+ * experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },
38
+ * });
39
+ */
40
+ export declare const vercelAIIntegration: (options?: VercelAiOptions | undefined) => import("@sentry/core").Integration & {
41
+ name: string;
42
+ };
43
+ export {};
44
+ //# sourceMappingURL=vercelai.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/cloudflare",
3
- "version": "10.63.0",
3
+ "version": "10.64.0",
4
4
  "description": "Official Sentry SDK for Cloudflare Workers and Pages",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/cloudflare",
@@ -36,6 +36,16 @@
36
36
  "types": "./build/types/request.d.ts",
37
37
  "default": "./build/cjs/request.js"
38
38
  }
39
+ },
40
+ "./nodejs_compat": {
41
+ "import": {
42
+ "types": "./build/types/nodejs_compat/index.d.ts",
43
+ "default": "./build/esm/nodejs_compat/index.js"
44
+ },
45
+ "require": {
46
+ "types": "./build/types/nodejs_compat/index.d.ts",
47
+ "default": "./build/cjs/nodejs_compat/index.js"
48
+ }
39
49
  }
40
50
  },
41
51
  "typesVersions": {
@@ -50,7 +60,9 @@
50
60
  },
51
61
  "dependencies": {
52
62
  "@opentelemetry/api": "^1.9.1",
53
- "@sentry/core": "10.63.0"
63
+ "@sentry/core": "10.64.0",
64
+ "@sentry/node": "10.64.0",
65
+ "@sentry/server-utils": "10.64.0"
54
66
  },
55
67
  "peerDependencies": {
56
68
  "@cloudflare/workers-types": "^4.x"