@sentry/cloudflare 10.70.0 → 11.0.0-alpha.1
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/README.md +3 -7
- package/build/cjs/{sdk.js → dev/baseSdk.js} +27 -17
- package/build/cjs/dev/baseSdk.js.map +1 -0
- package/build/cjs/dev/client.js.map +1 -0
- package/build/cjs/dev/debug-build.js.map +1 -0
- package/build/cjs/dev/defineCloudflareOptions.js.map +1 -0
- package/build/cjs/{durableobject.js → dev/durableobject.js} +21 -20
- package/build/cjs/dev/durableobject.js.map +1 -0
- package/build/cjs/dev/flush.js.map +1 -0
- package/build/cjs/{index.js → dev/index.js} +16 -17
- package/build/cjs/{index.js.map → dev/index.js.map} +1 -1
- package/build/cjs/dev/instrument.js.map +1 -0
- package/build/cjs/dev/instrumentations/agents/index.js.map +1 -0
- package/build/cjs/dev/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -0
- package/build/cjs/dev/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -0
- package/build/cjs/dev/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/agents/types.js +4 -4
- package/build/cjs/dev/instrumentations/agents/types.js.map +1 -0
- package/build/cjs/dev/instrumentations/instrumentDurableObjectNamespace.js.map +1 -0
- package/build/cjs/dev/instrumentations/instrumentDurableObjectStorage.js.map +1 -0
- package/build/cjs/dev/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -0
- package/build/cjs/dev/instrumentations/instrumentSqlStorage.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/instrumentWorkerEntrypoint.js +3 -3
- package/build/cjs/dev/instrumentations/instrumentWorkerEntrypoint.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentD1.js +0 -4
- package/build/cjs/dev/instrumentations/worker/instrumentD1.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentEmail.js +3 -1
- package/build/cjs/dev/instrumentations/worker/instrumentEmail.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentEnv.js +3 -4
- package/build/cjs/dev/instrumentations/worker/instrumentEnv.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentFetch.js +9 -3
- package/build/cjs/dev/instrumentations/worker/instrumentFetch.js.map +1 -0
- package/build/cjs/dev/instrumentations/worker/instrumentFetcher.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentQueue.js +3 -2
- package/build/cjs/dev/instrumentations/worker/instrumentQueue.js.map +1 -0
- package/build/cjs/dev/instrumentations/worker/instrumentQueueProducer.js.map +1 -0
- package/build/cjs/dev/instrumentations/worker/instrumentR2.js.map +1 -0
- package/build/cjs/dev/instrumentations/worker/instrumentRateLimit.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentScheduled.js +3 -1
- package/build/cjs/dev/instrumentations/worker/instrumentScheduled.js.map +1 -0
- package/build/cjs/dev/instrumentations/worker/instrumentTail.js.map +1 -0
- package/build/cjs/{integrations → dev/integrations}/fetch.js +1 -1
- package/build/cjs/dev/integrations/fetch.js.map +1 -0
- package/build/cjs/{integrations → dev/integrations}/httpServer.js +5 -4
- package/build/cjs/dev/integrations/httpServer.js.map +1 -0
- package/build/cjs/dev/integrations/spotlight.js.map +1 -0
- package/build/cjs/{nodejs_compat → dev}/integrations/tracing/vercelai.js +6 -6
- package/build/cjs/dev/integrations/tracing/vercelai.js.map +1 -0
- package/build/cjs/dev/opentelemetry/tracer.js.map +1 -0
- package/build/cjs/{options.js → dev/options.js} +8 -0
- package/build/cjs/dev/options.js.map +1 -0
- package/build/cjs/{pages-plugin.js → dev/pages-plugin.js} +8 -3
- package/build/cjs/dev/pages-plugin.js.map +1 -0
- package/build/cjs/{request.js → dev/request.js} +20 -10
- package/build/cjs/dev/request.js.map +1 -0
- package/build/cjs/dev/scope-utils.js.map +1 -0
- package/build/cjs/dev/sdk.js +19 -0
- package/build/cjs/dev/sdk.js.map +1 -0
- package/build/cjs/dev/transport.js.map +1 -0
- package/build/cjs/{utils → dev/utils}/instrumentContext.js +8 -13
- package/build/cjs/dev/utils/instrumentContext.js.map +1 -0
- package/build/cjs/dev/utils/internalSqlQuery.js.map +1 -0
- package/build/cjs/dev/utils/internalStorageKey.js.map +1 -0
- package/build/cjs/dev/utils/invocationScope.js.map +1 -0
- package/build/cjs/dev/utils/isBinding.js.map +1 -0
- package/build/cjs/dev/utils/isCloudflareClass.js.map +1 -0
- package/build/cjs/dev/utils/rpcMeta.js.map +1 -0
- package/build/cjs/dev/utils/streaming.js.map +1 -0
- package/build/cjs/dev/utils/traceLinks.js.map +1 -0
- package/build/cjs/dev/vendor/stacktrace.js.map +1 -0
- package/build/cjs/dev/vite/agentClass.js.map +1 -0
- package/build/cjs/dev/vite/autoInstrument.js.map +1 -0
- package/build/cjs/{vite → dev/vite}/index.js +4 -2
- package/build/cjs/dev/vite/index.js.map +1 -0
- package/build/cjs/dev/vite/instrumentFile.js.map +1 -0
- package/build/cjs/dev/vite/moduleShape.js.map +1 -0
- package/build/cjs/dev/vite/transform.js.map +1 -0
- package/build/cjs/dev/vite/workerEntrypoint.js.map +1 -0
- package/build/cjs/dev/vite/wranglerConfig.js.map +1 -0
- package/build/cjs/{withSentry.js → dev/withSentry.js} +2 -19
- package/build/cjs/dev/withSentry.js.map +1 -0
- package/build/cjs/{workflows.js → dev/workflows.js} +8 -3
- package/build/cjs/dev/workflows.js.map +1 -0
- package/build/cjs/dev/wrapMethodWithSentry.js.map +1 -0
- package/build/cjs/prod/baseSdk.js +73 -0
- package/build/cjs/prod/baseSdk.js.map +1 -0
- package/build/cjs/prod/client.js +122 -0
- package/build/cjs/prod/client.js.map +1 -0
- package/build/cjs/prod/debug-build.js +6 -0
- package/build/cjs/prod/debug-build.js.map +1 -0
- package/build/cjs/prod/defineCloudflareOptions.js +11 -0
- package/build/cjs/prod/defineCloudflareOptions.js.map +1 -0
- package/build/cjs/prod/durableobject.js +234 -0
- package/build/cjs/prod/durableobject.js.map +1 -0
- package/build/cjs/prod/flush.js +87 -0
- package/build/cjs/prod/flush.js.map +1 -0
- package/build/cjs/{nodejs_compat → prod}/index.js +34 -37
- package/build/cjs/{nodejs_compat → prod}/index.js.map +1 -1
- package/build/cjs/prod/instrument.js +52 -0
- package/build/cjs/prod/instrument.js.map +1 -0
- package/build/cjs/prod/instrumentations/agents/index.js +16 -0
- package/build/cjs/prod/instrumentations/agents/index.js.map +1 -0
- package/build/cjs/prod/instrumentations/agents/instrumentAgentCallableRpc.js +52 -0
- package/build/cjs/prod/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -0
- package/build/cjs/prod/instrumentations/agents/instrumentAgentRequestConversation.js +19 -0
- package/build/cjs/prod/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -0
- package/build/cjs/prod/instrumentations/agents/instrumentChatAgentConversation.js +31 -0
- package/build/cjs/prod/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -0
- package/build/cjs/prod/instrumentations/agents/types.js +77 -0
- package/build/cjs/prod/instrumentations/agents/types.js.map +1 -0
- package/build/cjs/prod/instrumentations/instrumentDurableObjectNamespace.js +41 -0
- package/build/cjs/prod/instrumentations/instrumentDurableObjectNamespace.js.map +1 -0
- package/build/cjs/prod/instrumentations/instrumentDurableObjectStorage.js +72 -0
- package/build/cjs/prod/instrumentations/instrumentDurableObjectStorage.js.map +1 -0
- package/build/cjs/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js +40 -0
- package/build/cjs/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -0
- package/build/cjs/prod/instrumentations/instrumentSqlStorage.js +42 -0
- package/build/cjs/prod/instrumentations/instrumentSqlStorage.js.map +1 -0
- package/build/cjs/prod/instrumentations/instrumentWorkerEntrypoint.js +139 -0
- package/build/cjs/prod/instrumentations/instrumentWorkerEntrypoint.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentD1.js +161 -0
- package/build/cjs/prod/instrumentations/worker/instrumentD1.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentEmail.js +63 -0
- package/build/cjs/prod/instrumentations/worker/instrumentEmail.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentEnv.js +90 -0
- package/build/cjs/prod/instrumentations/worker/instrumentEnv.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentFetch.js +54 -0
- package/build/cjs/prod/instrumentations/worker/instrumentFetch.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentFetcher.js +24 -0
- package/build/cjs/prod/instrumentations/worker/instrumentFetcher.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentQueue.js +82 -0
- package/build/cjs/prod/instrumentations/worker/instrumentQueue.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentQueueProducer.js +80 -0
- package/build/cjs/prod/instrumentations/worker/instrumentQueueProducer.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentR2.js +124 -0
- package/build/cjs/prod/instrumentations/worker/instrumentR2.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentRateLimit.js +29 -0
- package/build/cjs/prod/instrumentations/worker/instrumentRateLimit.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentScheduled.js +78 -0
- package/build/cjs/prod/instrumentations/worker/instrumentScheduled.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentTail.js +60 -0
- package/build/cjs/prod/instrumentations/worker/instrumentTail.js.map +1 -0
- package/build/cjs/prod/integrations/fetch.js +119 -0
- package/build/cjs/prod/integrations/fetch.js.map +1 -0
- package/build/cjs/prod/integrations/httpServer.js +36 -0
- package/build/cjs/prod/integrations/httpServer.js.map +1 -0
- package/build/cjs/prod/integrations/spotlight.js +64 -0
- package/build/cjs/prod/integrations/spotlight.js.map +1 -0
- package/build/cjs/{integrations → prod/integrations}/tracing/vercelai.js +5 -5
- package/build/cjs/prod/integrations/tracing/vercelai.js.map +1 -0
- package/build/cjs/prod/opentelemetry/tracer.js +49 -0
- package/build/cjs/prod/opentelemetry/tracer.js.map +1 -0
- package/build/cjs/prod/options.js +33 -0
- package/build/cjs/prod/options.js.map +1 -0
- package/build/cjs/prod/pages-plugin.js +24 -0
- package/build/cjs/prod/pages-plugin.js.map +1 -0
- package/build/cjs/prod/request.js +132 -0
- package/build/cjs/prod/request.js.map +1 -0
- package/build/cjs/prod/scope-utils.js +22 -0
- package/build/cjs/prod/scope-utils.js.map +1 -0
- package/build/cjs/prod/sdk.js +19 -0
- package/build/cjs/prod/sdk.js.map +1 -0
- package/build/cjs/prod/transport.js +75 -0
- package/build/cjs/prod/transport.js.map +1 -0
- package/build/cjs/prod/utils/instrumentContext.js +63 -0
- package/build/cjs/prod/utils/instrumentContext.js.map +1 -0
- package/build/cjs/prod/utils/internalSqlQuery.js +25 -0
- package/build/cjs/prod/utils/internalSqlQuery.js.map +1 -0
- package/build/cjs/prod/utils/internalStorageKey.js +44 -0
- package/build/cjs/prod/utils/internalStorageKey.js.map +1 -0
- package/build/cjs/prod/utils/invocationScope.js +12 -0
- package/build/cjs/prod/utils/invocationScope.js.map +1 -0
- package/build/cjs/prod/utils/isBinding.js +37 -0
- package/build/cjs/prod/utils/isBinding.js.map +1 -0
- package/build/cjs/prod/utils/isCloudflareClass.js +23 -0
- package/build/cjs/prod/utils/isCloudflareClass.js.map +1 -0
- package/build/cjs/prod/utils/rpcMeta.js +39 -0
- package/build/cjs/prod/utils/rpcMeta.js.map +1 -0
- package/build/cjs/prod/utils/streaming.js +16 -0
- package/build/cjs/prod/utils/streaming.js.map +1 -0
- package/build/cjs/prod/utils/traceLinks.js +54 -0
- package/build/cjs/prod/utils/traceLinks.js.map +1 -0
- package/build/cjs/prod/vendor/stacktrace.js +28 -0
- package/build/cjs/prod/vendor/stacktrace.js.map +1 -0
- package/build/cjs/prod/vite/agentClass.js +114 -0
- package/build/cjs/prod/vite/agentClass.js.map +1 -0
- package/build/cjs/prod/vite/autoInstrument.js +94 -0
- package/build/cjs/prod/vite/autoInstrument.js.map +1 -0
- package/build/cjs/prod/vite/index.js +16 -0
- package/build/cjs/prod/vite/index.js.map +1 -0
- package/build/cjs/prod/vite/instrumentFile.js +31 -0
- package/build/cjs/prod/vite/instrumentFile.js.map +1 -0
- package/build/cjs/prod/vite/moduleShape.js +231 -0
- package/build/cjs/prod/vite/moduleShape.js.map +1 -0
- package/build/cjs/prod/vite/transform.js +149 -0
- package/build/cjs/prod/vite/transform.js.map +1 -0
- package/build/cjs/prod/vite/workerEntrypoint.js +66 -0
- package/build/cjs/prod/vite/workerEntrypoint.js.map +1 -0
- package/build/cjs/prod/vite/wranglerConfig.js +54 -0
- package/build/cjs/prod/vite/wranglerConfig.js.map +1 -0
- package/build/cjs/prod/withSentry.js +29 -0
- package/build/cjs/prod/withSentry.js.map +1 -0
- package/build/cjs/prod/workflows.js +139 -0
- package/build/cjs/prod/workflows.js.map +1 -0
- package/build/cjs/prod/wrapMethodWithSentry.js +134 -0
- package/build/cjs/prod/wrapMethodWithSentry.js.map +1 -0
- package/build/esm/{sdk.js → dev/baseSdk.js} +26 -17
- package/build/esm/dev/baseSdk.js.map +1 -0
- package/build/esm/dev/client.js.map +1 -0
- package/build/esm/dev/debug-build.js.map +1 -0
- package/build/esm/dev/defineCloudflareOptions.js.map +1 -0
- package/build/esm/{durableobject.js → dev/durableobject.js} +21 -20
- package/build/esm/dev/durableobject.js.map +1 -0
- package/build/esm/dev/flush.js.map +1 -0
- package/build/esm/dev/index.js +15 -0
- package/build/esm/{index.js.map → dev/index.js.map} +1 -1
- package/build/esm/dev/instrument.js.map +1 -0
- package/build/esm/dev/instrumentations/agents/index.js.map +1 -0
- package/build/esm/dev/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -0
- package/build/esm/dev/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -0
- package/build/esm/dev/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/agents/types.js +2 -2
- package/build/esm/dev/instrumentations/agents/types.js.map +1 -0
- package/build/esm/dev/instrumentations/instrumentDurableObjectNamespace.js.map +1 -0
- package/build/esm/dev/instrumentations/instrumentDurableObjectStorage.js.map +1 -0
- package/build/esm/dev/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -0
- package/build/esm/dev/instrumentations/instrumentSqlStorage.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/instrumentWorkerEntrypoint.js +2 -2
- package/build/esm/dev/instrumentations/instrumentWorkerEntrypoint.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentD1.js +1 -4
- package/build/esm/dev/instrumentations/worker/instrumentD1.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentEmail.js +3 -1
- package/build/esm/dev/instrumentations/worker/instrumentEmail.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentEnv.js +3 -4
- package/build/esm/dev/instrumentations/worker/instrumentEnv.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentFetch.js +10 -4
- package/build/esm/dev/instrumentations/worker/instrumentFetch.js.map +1 -0
- package/build/esm/dev/instrumentations/worker/instrumentFetcher.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentQueue.js +4 -3
- package/build/esm/dev/instrumentations/worker/instrumentQueue.js.map +1 -0
- package/build/esm/dev/instrumentations/worker/instrumentQueueProducer.js.map +1 -0
- package/build/esm/dev/instrumentations/worker/instrumentR2.js.map +1 -0
- package/build/esm/dev/instrumentations/worker/instrumentRateLimit.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentScheduled.js +3 -1
- package/build/esm/dev/instrumentations/worker/instrumentScheduled.js.map +1 -0
- package/build/esm/dev/instrumentations/worker/instrumentTail.js.map +1 -0
- package/build/esm/{integrations → dev/integrations}/fetch.js +1 -1
- package/build/esm/dev/integrations/fetch.js.map +1 -0
- package/build/esm/{integrations → dev/integrations}/httpServer.js +5 -4
- package/build/esm/dev/integrations/httpServer.js.map +1 -0
- package/build/esm/dev/integrations/spotlight.js.map +1 -0
- package/build/esm/{integrations → dev/integrations}/tracing/vercelai.js +5 -5
- package/build/esm/dev/integrations/tracing/vercelai.js.map +1 -0
- package/build/esm/dev/opentelemetry/tracer.js.map +1 -0
- package/build/esm/{options.js → dev/options.js} +8 -0
- package/build/esm/dev/options.js.map +1 -0
- package/build/esm/dev/package.json +1 -0
- package/build/esm/{pages-plugin.js → dev/pages-plugin.js} +8 -3
- package/build/esm/dev/pages-plugin.js.map +1 -0
- package/build/esm/{request.js → dev/request.js} +21 -12
- package/build/esm/dev/request.js.map +1 -0
- package/build/esm/dev/scope-utils.js.map +1 -0
- package/build/esm/dev/sdk.js +16 -0
- package/build/esm/dev/sdk.js.map +1 -0
- package/build/esm/dev/transport.js.map +1 -0
- package/build/esm/{utils → dev/utils}/instrumentContext.js +8 -13
- package/build/esm/dev/utils/instrumentContext.js.map +1 -0
- package/build/esm/dev/utils/internalSqlQuery.js.map +1 -0
- package/build/esm/dev/utils/internalStorageKey.js.map +1 -0
- package/build/esm/dev/utils/invocationScope.js.map +1 -0
- package/build/esm/dev/utils/isBinding.js.map +1 -0
- package/build/esm/dev/utils/isCloudflareClass.js.map +1 -0
- package/build/esm/dev/utils/rpcMeta.js.map +1 -0
- package/build/esm/dev/utils/streaming.js.map +1 -0
- package/build/esm/{utils → dev/utils}/traceLinks.js +1 -1
- package/build/esm/dev/utils/traceLinks.js.map +1 -0
- package/build/esm/dev/vendor/stacktrace.js.map +1 -0
- package/build/esm/dev/vite/agentClass.js.map +1 -0
- package/build/esm/dev/vite/autoInstrument.js.map +1 -0
- package/build/esm/{vite → dev/vite}/index.js +4 -2
- package/build/esm/dev/vite/index.js.map +1 -0
- package/build/esm/dev/vite/instrumentFile.js.map +1 -0
- package/build/esm/dev/vite/moduleShape.js.map +1 -0
- package/build/esm/dev/vite/transform.js.map +1 -0
- package/build/esm/dev/vite/workerEntrypoint.js.map +1 -0
- package/build/esm/dev/vite/wranglerConfig.js.map +1 -0
- package/build/esm/{withSentry.js → dev/withSentry.js} +1 -18
- package/build/esm/dev/withSentry.js.map +1 -0
- package/build/esm/{workflows.js → dev/workflows.js} +7 -2
- package/build/esm/dev/workflows.js.map +1 -0
- package/build/esm/dev/wrapMethodWithSentry.js.map +1 -0
- package/build/esm/prod/baseSdk.js +69 -0
- package/build/esm/prod/baseSdk.js.map +1 -0
- package/build/esm/prod/client.js +120 -0
- package/build/esm/prod/client.js.map +1 -0
- package/build/esm/prod/debug-build.js +4 -0
- package/build/esm/prod/debug-build.js.map +1 -0
- package/build/esm/prod/defineCloudflareOptions.js +9 -0
- package/build/esm/prod/defineCloudflareOptions.js.map +1 -0
- package/build/esm/prod/durableobject.js +229 -0
- package/build/esm/prod/durableobject.js.map +1 -0
- package/build/esm/prod/flush.js +83 -0
- package/build/esm/prod/flush.js.map +1 -0
- package/build/esm/prod/index.js +15 -0
- package/build/esm/{nodejs_compat → prod}/index.js.map +1 -1
- package/build/esm/prod/instrument.js +48 -0
- package/build/esm/prod/instrument.js.map +1 -0
- package/build/esm/prod/instrumentations/agents/index.js +14 -0
- package/build/esm/prod/instrumentations/agents/index.js.map +1 -0
- package/build/esm/prod/instrumentations/agents/instrumentAgentCallableRpc.js +50 -0
- package/build/esm/prod/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -0
- package/build/esm/prod/instrumentations/agents/instrumentAgentRequestConversation.js +17 -0
- package/build/esm/prod/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -0
- package/build/esm/prod/instrumentations/agents/instrumentChatAgentConversation.js +29 -0
- package/build/esm/prod/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -0
- package/build/esm/prod/instrumentations/agents/types.js +69 -0
- package/build/esm/prod/instrumentations/agents/types.js.map +1 -0
- package/build/esm/prod/instrumentations/instrumentDurableObjectNamespace.js +38 -0
- package/build/esm/prod/instrumentations/instrumentDurableObjectNamespace.js.map +1 -0
- package/build/esm/prod/instrumentations/instrumentDurableObjectStorage.js +70 -0
- package/build/esm/prod/instrumentations/instrumentDurableObjectStorage.js.map +1 -0
- package/build/esm/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js +38 -0
- package/build/esm/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -0
- package/build/esm/prod/instrumentations/instrumentSqlStorage.js +40 -0
- package/build/esm/prod/instrumentations/instrumentSqlStorage.js.map +1 -0
- package/build/esm/prod/instrumentations/instrumentWorkerEntrypoint.js +137 -0
- package/build/esm/prod/instrumentations/instrumentWorkerEntrypoint.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentD1.js +159 -0
- package/build/esm/prod/instrumentations/worker/instrumentD1.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentEmail.js +61 -0
- package/build/esm/prod/instrumentations/worker/instrumentEmail.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentEnv.js +88 -0
- package/build/esm/prod/instrumentations/worker/instrumentEnv.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentFetch.js +51 -0
- package/build/esm/prod/instrumentations/worker/instrumentFetch.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentFetcher.js +22 -0
- package/build/esm/prod/instrumentations/worker/instrumentFetcher.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentQueue.js +79 -0
- package/build/esm/prod/instrumentations/worker/instrumentQueue.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentQueueProducer.js +78 -0
- package/build/esm/prod/instrumentations/worker/instrumentQueueProducer.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentR2.js +122 -0
- package/build/esm/prod/instrumentations/worker/instrumentR2.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentRateLimit.js +27 -0
- package/build/esm/prod/instrumentations/worker/instrumentRateLimit.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentScheduled.js +75 -0
- package/build/esm/prod/instrumentations/worker/instrumentScheduled.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentTail.js +57 -0
- package/build/esm/prod/instrumentations/worker/instrumentTail.js.map +1 -0
- package/build/esm/prod/integrations/fetch.js +117 -0
- package/build/esm/prod/integrations/fetch.js.map +1 -0
- package/build/esm/prod/integrations/httpServer.js +33 -0
- package/build/esm/prod/integrations/httpServer.js.map +1 -0
- package/build/esm/prod/integrations/spotlight.js +61 -0
- package/build/esm/prod/integrations/spotlight.js.map +1 -0
- package/build/esm/prod/integrations/tracing/vercelai.js +16 -0
- package/build/esm/prod/integrations/tracing/vercelai.js.map +1 -0
- package/build/esm/prod/opentelemetry/tracer.js +47 -0
- package/build/esm/prod/opentelemetry/tracer.js.map +1 -0
- package/build/esm/prod/options.js +31 -0
- package/build/esm/prod/options.js.map +1 -0
- package/build/esm/prod/package.json +1 -0
- package/build/esm/prod/pages-plugin.js +22 -0
- package/build/esm/prod/pages-plugin.js.map +1 -0
- package/build/esm/prod/request.js +129 -0
- package/build/esm/prod/request.js.map +1 -0
- package/build/esm/prod/scope-utils.js +18 -0
- package/build/esm/prod/scope-utils.js.map +1 -0
- package/build/esm/prod/sdk.js +16 -0
- package/build/esm/prod/sdk.js.map +1 -0
- package/build/esm/prod/transport.js +72 -0
- package/build/esm/prod/transport.js.map +1 -0
- package/build/esm/prod/utils/instrumentContext.js +61 -0
- package/build/esm/prod/utils/instrumentContext.js.map +1 -0
- package/build/esm/prod/utils/internalSqlQuery.js +23 -0
- package/build/esm/prod/utils/internalSqlQuery.js.map +1 -0
- package/build/esm/prod/utils/internalStorageKey.js +41 -0
- package/build/esm/prod/utils/internalStorageKey.js.map +1 -0
- package/build/esm/prod/utils/invocationScope.js +10 -0
- package/build/esm/prod/utils/invocationScope.js.map +1 -0
- package/build/esm/prod/utils/isBinding.js +29 -0
- package/build/esm/prod/utils/isBinding.js.map +1 -0
- package/build/esm/prod/utils/isCloudflareClass.js +21 -0
- package/build/esm/prod/utils/isCloudflareClass.js.map +1 -0
- package/build/esm/prod/utils/rpcMeta.js +35 -0
- package/build/esm/prod/utils/rpcMeta.js.map +1 -0
- package/build/esm/prod/utils/streaming.js +14 -0
- package/build/esm/prod/utils/streaming.js.map +1 -0
- package/build/esm/prod/utils/traceLinks.js +49 -0
- package/build/esm/prod/utils/traceLinks.js.map +1 -0
- package/build/esm/prod/vendor/stacktrace.js +25 -0
- package/build/esm/prod/vendor/stacktrace.js.map +1 -0
- package/build/esm/prod/vite/agentClass.js +111 -0
- package/build/esm/prod/vite/agentClass.js.map +1 -0
- package/build/esm/prod/vite/autoInstrument.js +92 -0
- package/build/esm/prod/vite/autoInstrument.js.map +1 -0
- package/build/esm/prod/vite/index.js +14 -0
- package/build/esm/prod/vite/index.js.map +1 -0
- package/build/esm/prod/vite/instrumentFile.js +27 -0
- package/build/esm/prod/vite/instrumentFile.js.map +1 -0
- package/build/esm/prod/vite/moduleShape.js +227 -0
- package/build/esm/prod/vite/moduleShape.js.map +1 -0
- package/build/esm/prod/vite/transform.js +147 -0
- package/build/esm/prod/vite/transform.js.map +1 -0
- package/build/esm/prod/vite/workerEntrypoint.js +64 -0
- package/build/esm/prod/vite/workerEntrypoint.js.map +1 -0
- package/build/esm/prod/vite/wranglerConfig.js +52 -0
- package/build/esm/prod/vite/wranglerConfig.js.map +1 -0
- package/build/esm/prod/withSentry.js +27 -0
- package/build/esm/prod/withSentry.js.map +1 -0
- package/build/esm/prod/workflows.js +136 -0
- package/build/esm/prod/workflows.js.map +1 -0
- package/build/esm/prod/wrapMethodWithSentry.js +132 -0
- package/build/esm/prod/wrapMethodWithSentry.js.map +1 -0
- package/build/types/baseSdk.d.ts +28 -0
- package/build/types/baseSdk.d.ts.map +1 -0
- package/build/types/client.d.ts +12 -39
- package/build/types/client.d.ts.map +1 -1
- package/build/types/defineCloudflareOptions.d.ts +2 -2
- package/build/types/defineCloudflareOptions.d.ts.map +1 -1
- package/build/types/durableobject.d.ts +5 -4
- package/build/types/durableobject.d.ts.map +1 -1
- package/build/types/index.d.ts +3 -5
- package/build/types/index.d.ts.map +1 -1
- package/build/types/instrumentations/agents/types.d.ts.map +1 -1
- package/build/types/instrumentations/instrumentDurableObjectStorage.d.ts.map +1 -1
- package/build/types/instrumentations/instrumentSqlStorage.d.ts.map +1 -1
- package/build/types/instrumentations/instrumentWorkerEntrypoint.d.ts +2 -1
- package/build/types/instrumentations/instrumentWorkerEntrypoint.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentD1.d.ts +0 -16
- package/build/types/instrumentations/worker/instrumentD1.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentEmail.d.ts +2 -2
- package/build/types/instrumentations/worker/instrumentEmail.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentEnv.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentFetch.d.ts +2 -2
- package/build/types/instrumentations/worker/instrumentFetch.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentQueue.d.ts +2 -2
- package/build/types/instrumentations/worker/instrumentQueue.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentScheduled.d.ts +2 -2
- package/build/types/instrumentations/worker/instrumentScheduled.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentTail.d.ts +2 -2
- package/build/types/instrumentations/worker/instrumentTail.d.ts.map +1 -1
- package/build/types/integrations/httpServer.d.ts.map +1 -1
- package/build/types/integrations/spotlight.d.ts +1 -1
- package/build/types/integrations/tracing/vercelai.d.ts +2 -10
- package/build/types/integrations/tracing/vercelai.d.ts.map +1 -1
- package/build/types/options.d.ts.map +1 -1
- package/build/types/pages-plugin.d.ts +1 -1
- package/build/types/pages-plugin.d.ts.map +1 -1
- package/build/types/request.d.ts +17 -2
- package/build/types/request.d.ts.map +1 -1
- package/build/types/sdk.d.ts +8 -3
- package/build/types/sdk.d.ts.map +1 -1
- package/build/types/transport.d.ts.map +1 -1
- package/build/types/types.d.ts +85 -0
- package/build/types/types.d.ts.map +1 -0
- package/build/types/utils/instrumentContext.d.ts.map +1 -1
- package/build/types/utils/isCloudflareClass.d.ts +1 -1
- package/build/types/utils/isCloudflareClass.d.ts.map +1 -1
- package/build/types/vite/autoInstrument.d.ts.map +1 -1
- package/build/types/vite/index.d.ts +37 -61
- package/build/types/vite/index.d.ts.map +1 -1
- package/build/types/withSentry.d.ts +2 -2
- package/build/types/withSentry.d.ts.map +1 -1
- package/build/types/workflows.d.ts +5 -4
- package/build/types/workflows.d.ts.map +1 -1
- package/package.json +28 -51
- package/build/cjs/async.js +0 -63
- package/build/cjs/async.js.map +0 -1
- package/build/cjs/client.js.map +0 -1
- package/build/cjs/debug-build.js.map +0 -1
- package/build/cjs/defineCloudflareOptions.js.map +0 -1
- package/build/cjs/durableobject.js.map +0 -1
- package/build/cjs/flush.js.map +0 -1
- package/build/cjs/instrument.js.map +0 -1
- package/build/cjs/instrumentations/agents/index.js.map +0 -1
- package/build/cjs/instrumentations/agents/instrumentAgentCallableRpc.js.map +0 -1
- package/build/cjs/instrumentations/agents/instrumentAgentRequestConversation.js.map +0 -1
- package/build/cjs/instrumentations/agents/instrumentChatAgentConversation.js.map +0 -1
- package/build/cjs/instrumentations/agents/types.js.map +0 -1
- package/build/cjs/instrumentations/instrumentDurableObjectNamespace.js.map +0 -1
- package/build/cjs/instrumentations/instrumentDurableObjectStorage.js.map +0 -1
- package/build/cjs/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +0 -1
- package/build/cjs/instrumentations/instrumentSqlStorage.js.map +0 -1
- package/build/cjs/instrumentations/instrumentWorkerEntrypoint.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentD1.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentEmail.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentEnv.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentFetch.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentFetcher.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentQueue.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentQueueProducer.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentR2.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentRateLimit.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentScheduled.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentTail.js.map +0 -1
- package/build/cjs/integrations/fetch.js.map +0 -1
- package/build/cjs/integrations/hono.js +0 -52
- package/build/cjs/integrations/hono.js.map +0 -1
- package/build/cjs/integrations/httpServer.js.map +0 -1
- package/build/cjs/integrations/spotlight.js.map +0 -1
- package/build/cjs/integrations/tracing/vercelai.js.map +0 -1
- package/build/cjs/nodejs_compat/integrations/tracing/vercelai.js.map +0 -1
- package/build/cjs/opentelemetry/tracer.js.map +0 -1
- package/build/cjs/options.js.map +0 -1
- package/build/cjs/pages-plugin.js.map +0 -1
- package/build/cjs/request.js.map +0 -1
- package/build/cjs/scope-utils.js.map +0 -1
- package/build/cjs/sdk.js.map +0 -1
- package/build/cjs/transport.js.map +0 -1
- package/build/cjs/utils/instrumentContext.js.map +0 -1
- package/build/cjs/utils/internalSqlQuery.js.map +0 -1
- package/build/cjs/utils/internalStorageKey.js.map +0 -1
- package/build/cjs/utils/invocationScope.js.map +0 -1
- package/build/cjs/utils/isBinding.js.map +0 -1
- package/build/cjs/utils/isCloudflareClass.js.map +0 -1
- package/build/cjs/utils/rpcMeta.js.map +0 -1
- package/build/cjs/utils/rpcOptions.js +0 -26
- package/build/cjs/utils/rpcOptions.js.map +0 -1
- package/build/cjs/utils/streaming.js.map +0 -1
- package/build/cjs/utils/traceLinks.js.map +0 -1
- package/build/cjs/vendor/stacktrace.js.map +0 -1
- package/build/cjs/vite/agentClass.js.map +0 -1
- package/build/cjs/vite/autoInstrument.js.map +0 -1
- package/build/cjs/vite/index.js.map +0 -1
- package/build/cjs/vite/instrumentFile.js.map +0 -1
- package/build/cjs/vite/moduleShape.js.map +0 -1
- package/build/cjs/vite/transform.js.map +0 -1
- package/build/cjs/vite/workerEntrypoint.js.map +0 -1
- package/build/cjs/vite/wranglerConfig.js.map +0 -1
- package/build/cjs/withSentry.js.map +0 -1
- package/build/cjs/workflows.js.map +0 -1
- package/build/cjs/wrapMethodWithSentry.js.map +0 -1
- package/build/esm/async.js +0 -61
- package/build/esm/async.js.map +0 -1
- package/build/esm/client.js.map +0 -1
- package/build/esm/debug-build.js.map +0 -1
- package/build/esm/defineCloudflareOptions.js.map +0 -1
- package/build/esm/durableobject.js.map +0 -1
- package/build/esm/flush.js.map +0 -1
- package/build/esm/index.js +0 -17
- package/build/esm/instrument.js.map +0 -1
- package/build/esm/instrumentations/agents/index.js.map +0 -1
- package/build/esm/instrumentations/agents/instrumentAgentCallableRpc.js.map +0 -1
- package/build/esm/instrumentations/agents/instrumentAgentRequestConversation.js.map +0 -1
- package/build/esm/instrumentations/agents/instrumentChatAgentConversation.js.map +0 -1
- package/build/esm/instrumentations/agents/types.js.map +0 -1
- package/build/esm/instrumentations/instrumentDurableObjectNamespace.js.map +0 -1
- package/build/esm/instrumentations/instrumentDurableObjectStorage.js.map +0 -1
- package/build/esm/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +0 -1
- package/build/esm/instrumentations/instrumentSqlStorage.js.map +0 -1
- package/build/esm/instrumentations/instrumentWorkerEntrypoint.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentD1.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentEmail.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentEnv.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentFetch.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentFetcher.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentQueue.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentQueueProducer.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentR2.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentRateLimit.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentScheduled.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentTail.js.map +0 -1
- package/build/esm/integrations/fetch.js.map +0 -1
- package/build/esm/integrations/hono.js +0 -49
- package/build/esm/integrations/hono.js.map +0 -1
- package/build/esm/integrations/httpServer.js.map +0 -1
- package/build/esm/integrations/spotlight.js.map +0 -1
- package/build/esm/integrations/tracing/vercelai.js.map +0 -1
- package/build/esm/nodejs_compat/index.js +0 -18
- package/build/esm/nodejs_compat/integrations/tracing/vercelai.js +0 -16
- package/build/esm/nodejs_compat/integrations/tracing/vercelai.js.map +0 -1
- package/build/esm/opentelemetry/tracer.js.map +0 -1
- package/build/esm/options.js.map +0 -1
- package/build/esm/package.json +0 -1
- package/build/esm/pages-plugin.js.map +0 -1
- package/build/esm/request.js.map +0 -1
- package/build/esm/scope-utils.js.map +0 -1
- package/build/esm/sdk.js.map +0 -1
- package/build/esm/transport.js.map +0 -1
- package/build/esm/utils/instrumentContext.js.map +0 -1
- package/build/esm/utils/internalSqlQuery.js.map +0 -1
- package/build/esm/utils/internalStorageKey.js.map +0 -1
- package/build/esm/utils/invocationScope.js.map +0 -1
- package/build/esm/utils/isBinding.js.map +0 -1
- package/build/esm/utils/isCloudflareClass.js.map +0 -1
- package/build/esm/utils/rpcMeta.js.map +0 -1
- package/build/esm/utils/rpcOptions.js +0 -24
- package/build/esm/utils/rpcOptions.js.map +0 -1
- package/build/esm/utils/streaming.js.map +0 -1
- package/build/esm/utils/traceLinks.js.map +0 -1
- package/build/esm/vendor/stacktrace.js.map +0 -1
- package/build/esm/vite/agentClass.js.map +0 -1
- package/build/esm/vite/autoInstrument.js.map +0 -1
- package/build/esm/vite/index.js.map +0 -1
- package/build/esm/vite/instrumentFile.js.map +0 -1
- package/build/esm/vite/moduleShape.js.map +0 -1
- package/build/esm/vite/transform.js.map +0 -1
- package/build/esm/vite/workerEntrypoint.js.map +0 -1
- package/build/esm/vite/wranglerConfig.js.map +0 -1
- package/build/esm/withSentry.js.map +0 -1
- package/build/esm/workflows.js.map +0 -1
- package/build/esm/wrapMethodWithSentry.js.map +0 -1
- package/build/types/async.d.ts +0 -11
- package/build/types/async.d.ts.map +0 -1
- package/build/types/integrations/hono.d.ts +0 -42
- package/build/types/integrations/hono.d.ts.map +0 -1
- package/build/types/nodejs_compat/index.d.ts +0 -4
- package/build/types/nodejs_compat/index.d.ts.map +0 -1
- package/build/types/nodejs_compat/integrations/tracing/vercelai.d.ts +0 -37
- package/build/types/nodejs_compat/integrations/tracing/vercelai.d.ts.map +0 -1
- package/build/types/utils/rpcOptions.d.ts +0 -13
- package/build/types/utils/rpcOptions.d.ts.map +0 -1
- package/build/types-ts3.8/async.d.ts +0 -11
- package/build/types-ts3.8/client.d.ts +0 -203
- package/build/types-ts3.8/debug-build.d.ts +0 -7
- package/build/types-ts3.8/defineCloudflareOptions.d.ts +0 -38
- package/build/types-ts3.8/durableobject.d.ts +0 -127
- package/build/types-ts3.8/executionContext.d.ts +0 -13
- package/build/types-ts3.8/flush.d.ts +0 -47
- package/build/types-ts3.8/index.d.ts +0 -19
- package/build/types-ts3.8/instrument.d.ts +0 -20
- package/build/types-ts3.8/instrumentations/agents/index.d.ts +0 -25
- package/build/types-ts3.8/instrumentations/agents/instrumentAgentCallableRpc.d.ts +0 -14
- package/build/types-ts3.8/instrumentations/agents/instrumentAgentRequestConversation.d.ts +0 -16
- package/build/types-ts3.8/instrumentations/agents/instrumentChatAgentConversation.d.ts +0 -23
- package/build/types-ts3.8/instrumentations/agents/types.d.ts +0 -94
- package/build/types-ts3.8/instrumentations/instrumentDurableObjectNamespace.d.ts +0 -13
- package/build/types-ts3.8/instrumentations/instrumentDurableObjectStorage.d.ts +0 -19
- package/build/types-ts3.8/instrumentations/instrumentDurableObjectSyncKvStorage.d.ts +0 -3
- package/build/types-ts3.8/instrumentations/instrumentSqlStorage.d.ts +0 -9
- package/build/types-ts3.8/instrumentations/instrumentWorkerEntrypoint.d.ts +0 -42
- package/build/types-ts3.8/instrumentations/worker/instrumentD1.d.ts +0 -19
- package/build/types-ts3.8/instrumentations/worker/instrumentEmail.d.ts +0 -8
- package/build/types-ts3.8/instrumentations/worker/instrumentEnv.d.ts +0 -18
- package/build/types-ts3.8/instrumentations/worker/instrumentFetch.d.ts +0 -12
- package/build/types-ts3.8/instrumentations/worker/instrumentFetcher.d.ts +0 -10
- package/build/types-ts3.8/instrumentations/worker/instrumentQueue.d.ts +0 -12
- package/build/types-ts3.8/instrumentations/worker/instrumentQueueProducer.d.ts +0 -10
- package/build/types-ts3.8/instrumentations/worker/instrumentR2.d.ts +0 -9
- package/build/types-ts3.8/instrumentations/worker/instrumentRateLimit.d.ts +0 -6
- package/build/types-ts3.8/instrumentations/worker/instrumentScheduled.d.ts +0 -12
- package/build/types-ts3.8/instrumentations/worker/instrumentTail.d.ts +0 -12
- package/build/types-ts3.8/integrations/fetch.d.ts +0 -19
- package/build/types-ts3.8/integrations/hono.d.ts +0 -42
- package/build/types-ts3.8/integrations/httpServer.d.ts +0 -63
- package/build/types-ts3.8/integrations/spotlight.d.ts +0 -22
- package/build/types-ts3.8/integrations/tracing/vercelai.d.ts +0 -47
- package/build/types-ts3.8/nodejs_compat/index.d.ts +0 -4
- package/build/types-ts3.8/nodejs_compat/integrations/tracing/vercelai.d.ts +0 -37
- package/build/types-ts3.8/opentelemetry/tracer.d.ts +0 -6
- package/build/types-ts3.8/options.d.ts +0 -17
- package/build/types-ts3.8/pages-plugin.d.ts +0 -34
- package/build/types-ts3.8/request.d.ts +0 -25
- package/build/types-ts3.8/scope-utils.d.ts +0 -15
- package/build/types-ts3.8/sdk.d.ts +0 -10
- package/build/types-ts3.8/transport.d.ts +0 -34
- package/build/types-ts3.8/utils/instrumentContext.d.ts +0 -16
- package/build/types-ts3.8/utils/internalSqlQuery.d.ts +0 -20
- package/build/types-ts3.8/utils/internalStorageKey.d.ts +0 -22
- package/build/types-ts3.8/utils/invocationScope.d.ts +0 -24
- package/build/types-ts3.8/utils/isBinding.d.ts +0 -77
- package/build/types-ts3.8/utils/isCloudflareClass.d.ts +0 -30
- package/build/types-ts3.8/utils/rpcMeta.d.ts +0 -23
- package/build/types-ts3.8/utils/rpcOptions.d.ts +0 -13
- package/build/types-ts3.8/utils/streaming.d.ts +0 -17
- package/build/types-ts3.8/utils/traceLinks.d.ts +0 -28
- package/build/types-ts3.8/vendor/stacktrace.d.ts +0 -11
- package/build/types-ts3.8/vite/agentClass.d.ts +0 -41
- package/build/types-ts3.8/vite/autoInstrument.d.ts +0 -22
- package/build/types-ts3.8/vite/index.d.ts +0 -98
- package/build/types-ts3.8/vite/instrumentFile.d.ts +0 -22
- package/build/types-ts3.8/vite/moduleShape.d.ts +0 -52
- package/build/types-ts3.8/vite/transform.d.ts +0 -65
- package/build/types-ts3.8/vite/workerEntrypoint.d.ts +0 -12
- package/build/types-ts3.8/vite/wranglerConfig.d.ts +0 -43
- package/build/types-ts3.8/withSentry.d.ts +0 -16
- package/build/types-ts3.8/workflows.d.ts +0 -25
- package/build/types-ts3.8/wrapMethodWithSentry.d.ts +0 -43
- /package/build/cjs/{client.js → dev/client.js} +0 -0
- /package/build/cjs/{debug-build.js → dev/debug-build.js} +0 -0
- /package/build/cjs/{defineCloudflareOptions.js → dev/defineCloudflareOptions.js} +0 -0
- /package/build/cjs/{flush.js → dev/flush.js} +0 -0
- /package/build/cjs/{instrument.js → dev/instrument.js} +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/agents/index.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/agents/instrumentAgentCallableRpc.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/agents/instrumentAgentRequestConversation.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/agents/instrumentChatAgentConversation.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/instrumentDurableObjectNamespace.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/instrumentDurableObjectStorage.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/instrumentDurableObjectSyncKvStorage.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/instrumentSqlStorage.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentFetcher.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentQueueProducer.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentR2.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentRateLimit.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentTail.js +0 -0
- /package/build/cjs/{integrations → dev/integrations}/spotlight.js +0 -0
- /package/build/cjs/{opentelemetry → dev/opentelemetry}/tracer.js +0 -0
- /package/build/cjs/{scope-utils.js → dev/scope-utils.js} +0 -0
- /package/build/cjs/{transport.js → dev/transport.js} +0 -0
- /package/build/cjs/{utils → dev/utils}/internalSqlQuery.js +0 -0
- /package/build/cjs/{utils → dev/utils}/internalStorageKey.js +0 -0
- /package/build/cjs/{utils → dev/utils}/invocationScope.js +0 -0
- /package/build/cjs/{utils → dev/utils}/isBinding.js +0 -0
- /package/build/cjs/{utils → dev/utils}/isCloudflareClass.js +0 -0
- /package/build/cjs/{utils → dev/utils}/rpcMeta.js +0 -0
- /package/build/cjs/{utils → dev/utils}/streaming.js +0 -0
- /package/build/cjs/{utils → dev/utils}/traceLinks.js +0 -0
- /package/build/cjs/{vendor → dev/vendor}/stacktrace.js +0 -0
- /package/build/cjs/{vite → dev/vite}/agentClass.js +0 -0
- /package/build/cjs/{vite → dev/vite}/autoInstrument.js +0 -0
- /package/build/cjs/{vite → dev/vite}/instrumentFile.js +0 -0
- /package/build/cjs/{vite → dev/vite}/moduleShape.js +0 -0
- /package/build/cjs/{vite → dev/vite}/transform.js +0 -0
- /package/build/cjs/{vite → dev/vite}/workerEntrypoint.js +0 -0
- /package/build/cjs/{vite → dev/vite}/wranglerConfig.js +0 -0
- /package/build/cjs/{wrapMethodWithSentry.js → dev/wrapMethodWithSentry.js} +0 -0
- /package/build/esm/{client.js → dev/client.js} +0 -0
- /package/build/esm/{debug-build.js → dev/debug-build.js} +0 -0
- /package/build/esm/{defineCloudflareOptions.js → dev/defineCloudflareOptions.js} +0 -0
- /package/build/esm/{flush.js → dev/flush.js} +0 -0
- /package/build/esm/{instrument.js → dev/instrument.js} +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/agents/index.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/agents/instrumentAgentCallableRpc.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/agents/instrumentAgentRequestConversation.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/agents/instrumentChatAgentConversation.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/instrumentDurableObjectNamespace.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/instrumentDurableObjectStorage.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/instrumentDurableObjectSyncKvStorage.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/instrumentSqlStorage.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentFetcher.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentQueueProducer.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentR2.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentRateLimit.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentTail.js +0 -0
- /package/build/esm/{integrations → dev/integrations}/spotlight.js +0 -0
- /package/build/esm/{opentelemetry → dev/opentelemetry}/tracer.js +0 -0
- /package/build/esm/{scope-utils.js → dev/scope-utils.js} +0 -0
- /package/build/esm/{transport.js → dev/transport.js} +0 -0
- /package/build/esm/{utils → dev/utils}/internalSqlQuery.js +0 -0
- /package/build/esm/{utils → dev/utils}/internalStorageKey.js +0 -0
- /package/build/esm/{utils → dev/utils}/invocationScope.js +0 -0
- /package/build/esm/{utils → dev/utils}/isBinding.js +0 -0
- /package/build/esm/{utils → dev/utils}/isCloudflareClass.js +0 -0
- /package/build/esm/{utils → dev/utils}/rpcMeta.js +0 -0
- /package/build/esm/{utils → dev/utils}/streaming.js +0 -0
- /package/build/esm/{vendor → dev/vendor}/stacktrace.js +0 -0
- /package/build/esm/{vite → dev/vite}/agentClass.js +0 -0
- /package/build/esm/{vite → dev/vite}/autoInstrument.js +0 -0
- /package/build/esm/{vite → dev/vite}/instrumentFile.js +0 -0
- /package/build/esm/{vite → dev/vite}/moduleShape.js +0 -0
- /package/build/esm/{vite → dev/vite}/transform.js +0 -0
- /package/build/esm/{vite → dev/vite}/workerEntrypoint.js +0 -0
- /package/build/esm/{vite → dev/vite}/wranglerConfig.js +0 -0
- /package/build/esm/{wrapMethodWithSentry.js → dev/wrapMethodWithSentry.js} +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { trace } from '@opentelemetry/api';
|
|
2
|
+
import { startInactiveSpan, startSpanManual } from '@sentry/core';
|
|
3
|
+
|
|
4
|
+
function setupOpenTelemetryTracer() {
|
|
5
|
+
trace.setGlobalTracerProvider(new SentryCloudflareTraceProvider());
|
|
6
|
+
}
|
|
7
|
+
class SentryCloudflareTraceProvider {
|
|
8
|
+
constructor() {
|
|
9
|
+
this._tracers = /* @__PURE__ */ new Map();
|
|
10
|
+
}
|
|
11
|
+
getTracer(name, version, options) {
|
|
12
|
+
const key = `${name}@${version || ""}:${options?.schemaUrl || ""}`;
|
|
13
|
+
if (!this._tracers.has(key)) {
|
|
14
|
+
this._tracers.set(key, new SentryCloudflareTracer());
|
|
15
|
+
}
|
|
16
|
+
return this._tracers.get(key);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
class SentryCloudflareTracer {
|
|
20
|
+
startSpan(name, options) {
|
|
21
|
+
return startInactiveSpan({
|
|
22
|
+
...options,
|
|
23
|
+
name,
|
|
24
|
+
attributes: {
|
|
25
|
+
...options?.attributes,
|
|
26
|
+
"sentry.cloudflare_tracer": true
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
startActiveSpan(name, options, context, fn) {
|
|
31
|
+
const opts = typeof options === "object" && options !== null ? options : {};
|
|
32
|
+
const spanOpts = {
|
|
33
|
+
...opts,
|
|
34
|
+
name,
|
|
35
|
+
attributes: {
|
|
36
|
+
...opts.attributes,
|
|
37
|
+
"sentry.cloudflare_tracer": true
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const callback = typeof options === "function" ? options : typeof context === "function" ? context : typeof fn === "function" ? fn : () => {
|
|
41
|
+
};
|
|
42
|
+
return startSpanManual(spanOpts, callback);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { setupOpenTelemetryTracer };
|
|
47
|
+
//# sourceMappingURL=tracer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracer.js","sources":["../../../../src/opentelemetry/tracer.ts"],"sourcesContent":["import type { Context, Span, SpanOptions, Tracer, TracerProvider } from '@opentelemetry/api';\nimport { trace } from '@opentelemetry/api';\nimport { startInactiveSpan, startSpanManual } from '@sentry/core';\n\n/**\n * Set up a mock OTEL tracer to allow inter-op with OpenTelemetry emitted spans.\n * This is not perfect but handles easy/common use cases.\n */\nexport function setupOpenTelemetryTracer(): void {\n trace.setGlobalTracerProvider(new SentryCloudflareTraceProvider());\n}\n\nclass SentryCloudflareTraceProvider implements TracerProvider {\n private readonly _tracers: Map<string, Tracer> = new Map();\n\n public getTracer(name: string, version?: string, options?: { schemaUrl?: string }): Tracer {\n const key = `${name}@${version || ''}:${options?.schemaUrl || ''}`;\n if (!this._tracers.has(key)) {\n this._tracers.set(key, new SentryCloudflareTracer());\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._tracers.get(key)!;\n }\n}\n\nclass SentryCloudflareTracer implements Tracer {\n public startSpan(name: string, options?: SpanOptions): Span {\n return startInactiveSpan({\n ...options,\n name,\n attributes: {\n ...options?.attributes,\n 'sentry.cloudflare_tracer': true,\n },\n });\n }\n\n /**\n * NOTE: This does not handle `context` being passed in. It will always put spans on the current scope.\n */\n public startActiveSpan<F extends (span: Span) => unknown>(name: string, fn: F): ReturnType<F>;\n public startActiveSpan<F extends (span: Span) => unknown>(name: string, options: SpanOptions, fn: F): ReturnType<F>;\n public startActiveSpan<F extends (span: Span) => unknown>(\n name: string,\n options: SpanOptions,\n context: Context,\n fn: F,\n ): ReturnType<F>;\n public startActiveSpan<F extends (span: Span) => unknown>(\n name: string,\n options: unknown,\n context?: unknown,\n fn?: F,\n ): ReturnType<F> {\n const opts = (typeof options === 'object' && options !== null ? options : {}) as SpanOptions;\n\n const spanOpts = {\n ...opts,\n name,\n attributes: {\n ...opts.attributes,\n 'sentry.cloudflare_tracer': true,\n },\n };\n\n const callback = (\n typeof options === 'function'\n ? options\n : typeof context === 'function'\n ? context\n : typeof fn === 'function'\n ? fn\n : () => {}\n ) as F;\n\n // In OTEL the semantic matches `startSpanManual` because spans are not auto-ended\n return startSpanManual(spanOpts, callback) as ReturnType<F>;\n }\n}\n"],"names":[],"mappings":";;;AAQO,SAAS,wBAAA,GAAiC;AAC/C,EAAA,KAAA,CAAM,uBAAA,CAAwB,IAAI,6BAAA,EAA+B,CAAA;AACnE;AAEA,MAAM,6BAAA,CAAwD;AAAA,EAA9D,WAAA,GAAA;AACE,IAAA,IAAA,CAAiB,QAAA,uBAAoC,GAAA,EAAI;AAAA,EAAA;AAAA,EAElD,SAAA,CAAU,IAAA,EAAc,OAAA,EAAkB,OAAA,EAA0C;AACzF,IAAA,MAAM,GAAA,GAAM,GAAG,IAAI,CAAA,CAAA,EAAI,WAAW,EAAE,CAAA,CAAA,EAAI,OAAA,EAAS,SAAA,IAAa,EAAE,CAAA,CAAA;AAChE,IAAA,IAAI,CAAC,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,GAAG,CAAA,EAAG;AAC3B,MAAA,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,GAAA,EAAK,IAAI,wBAAwB,CAAA;AAAA,IACrD;AAGA,IAAA,OAAO,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,GAAG,CAAA;AAAA,EAC9B;AACF;AAEA,MAAM,sBAAA,CAAyC;AAAA,EACtC,SAAA,CAAU,MAAc,OAAA,EAA6B;AAC1D,IAAA,OAAO,iBAAA,CAAkB;AAAA,MACvB,GAAG,OAAA;AAAA,MACH,IAAA;AAAA,MACA,UAAA,EAAY;AAAA,QACV,GAAG,OAAA,EAAS,UAAA;AAAA,QACZ,0BAAA,EAA4B;AAAA;AAC9B,KACD,CAAA;AAAA,EACH;AAAA,EAaO,eAAA,CACL,IAAA,EACA,OAAA,EACA,OAAA,EACA,EAAA,EACe;AACf,IAAA,MAAM,OAAQ,OAAO,OAAA,KAAY,YAAY,OAAA,KAAY,IAAA,GAAO,UAAU,EAAC;AAE3E,IAAA,MAAM,QAAA,GAAW;AAAA,MACf,GAAG,IAAA;AAAA,MACH,IAAA;AAAA,MACA,UAAA,EAAY;AAAA,QACV,GAAG,IAAA,CAAK,UAAA;AAAA,QACR,0BAAA,EAA4B;AAAA;AAC9B,KACF;AAEA,IAAA,MAAM,QAAA,GACJ,OAAO,OAAA,KAAY,UAAA,GACf,OAAA,GACA,OAAO,OAAA,KAAY,UAAA,GACjB,OAAA,GACA,OAAO,EAAA,KAAO,UAAA,GACZ,KACA,MAAM;AAAA,IAAC,CAAA;AAIjB,IAAA,OAAO,eAAA,CAAgB,UAAU,QAAQ,CAAA;AAAA,EAC3C;AACF;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { envToBool, isObjectLike } from '@sentry/core';
|
|
2
|
+
|
|
3
|
+
function isVersionMetadata(value) {
|
|
4
|
+
return isObjectLike(value) && "id" in value && typeof value.id === "string";
|
|
5
|
+
}
|
|
6
|
+
function getEnvVar(env, varName) {
|
|
7
|
+
return isObjectLike(env) && varName in env && typeof env[varName] === "string" ? env[varName] : void 0;
|
|
8
|
+
}
|
|
9
|
+
function getFinalOptions(userOptions = {}, env) {
|
|
10
|
+
if (typeof env !== "object" || env === null) {
|
|
11
|
+
return userOptions;
|
|
12
|
+
}
|
|
13
|
+
const release = "SENTRY_RELEASE" in env && typeof env.SENTRY_RELEASE === "string" ? env.SENTRY_RELEASE : "CF_VERSION_METADATA" in env && isVersionMetadata(env.CF_VERSION_METADATA) ? env.CF_VERSION_METADATA.id : void 0;
|
|
14
|
+
const tracesSampleRate = userOptions.tracesSampleRate ?? parseFloat(getEnvVar(env, "SENTRY_TRACES_SAMPLE_RATE") ?? "");
|
|
15
|
+
return {
|
|
16
|
+
release,
|
|
17
|
+
...userOptions,
|
|
18
|
+
dsn: userOptions.dsn ?? getEnvVar(env, "SENTRY_DSN"),
|
|
19
|
+
environment: userOptions.environment ?? getEnvVar(env, "SENTRY_ENVIRONMENT"),
|
|
20
|
+
tracesSampleRate: isFinite(tracesSampleRate) ? tracesSampleRate : void 0,
|
|
21
|
+
debug: userOptions.debug ?? envToBool(getEnvVar(env, "SENTRY_DEBUG")),
|
|
22
|
+
tunnel: userOptions.tunnel ?? getEnvVar(env, "SENTRY_TUNNEL"),
|
|
23
|
+
traceLifecycle: userOptions.traceLifecycle ?? getTraceLifecycleFromEnv(getEnvVar(env, "SENTRY_TRACE_LIFECYCLE"))
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function getTraceLifecycleFromEnv(envVar) {
|
|
27
|
+
return envVar === "stream" || envVar === "static" ? envVar : void 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { getFinalOptions };
|
|
31
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sources":["../../../src/options.ts"],"sourcesContent":["import { isObjectLike, envToBool } from '@sentry/core';\nimport type { CloudflareOptions } from './client';\n\n/**\n * Cloudflare's version metadata binding structure.\n * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/version-metadata/\n */\ninterface CfVersionMetadata {\n id: string;\n tag?: string;\n timestamp?: string;\n}\n\n/**\n * Checks if the value is a valid CF_VERSION_METADATA binding.\n */\nfunction isVersionMetadata(value: unknown): value is CfVersionMetadata {\n return isObjectLike(value) && 'id' in value && typeof value.id === 'string';\n}\n\nfunction getEnvVar<T extends Record<string, unknown>>(env: unknown, varName: keyof T): string | undefined {\n return isObjectLike(env) && varName in env && typeof (env as T)[varName] === 'string'\n ? ((env as T)[varName] as string)\n : undefined;\n}\n\n/**\n * Merges the options passed in from the user with the options we read from\n * the Cloudflare `env` environment variable object.\n *\n * Release is determined with the following priority (highest to lowest):\n * 1. User-provided release option\n * 2. SENTRY_RELEASE environment variable\n * 3. CF_VERSION_METADATA.id binding (if configured in the wrangler config)\n *\n * @param userOptions - The options passed in from the user.\n * @param env - The environment variables.\n *\n * @returns The final options.\n */\nexport function getFinalOptions(userOptions: CloudflareOptions = {}, env: unknown): CloudflareOptions {\n if (typeof env !== 'object' || env === null) {\n return userOptions;\n }\n\n // Priority: userOptions.release > SENTRY_RELEASE > CF_VERSION_METADATA.id\n const release =\n 'SENTRY_RELEASE' in env && typeof env.SENTRY_RELEASE === 'string'\n ? env.SENTRY_RELEASE\n : 'CF_VERSION_METADATA' in env && isVersionMetadata(env.CF_VERSION_METADATA)\n ? env.CF_VERSION_METADATA.id\n : undefined;\n\n const tracesSampleRate =\n userOptions.tracesSampleRate ?? parseFloat(getEnvVar(env, 'SENTRY_TRACES_SAMPLE_RATE') ?? '');\n\n // Spotlight precedence (mirrors node-core's getSpotlightConfig):\n // - false or explicit string from options: use as-is\n // - true: enable, but prefer a custom URL from the env var if set\n // - undefined: defer entirely to the env var (bool or URL)\n /*! rollup-include-development-only */\n const spotlight = getSpotlightFromEnv(userOptions.spotlight, getEnvVar(env, 'SENTRY_SPOTLIGHT'));\n /*! rollup-include-development-only-end */\n\n return {\n release,\n ...userOptions,\n dsn: userOptions.dsn ?? getEnvVar(env, 'SENTRY_DSN'),\n environment: userOptions.environment ?? getEnvVar(env, 'SENTRY_ENVIRONMENT'),\n tracesSampleRate: isFinite(tracesSampleRate) ? tracesSampleRate : undefined,\n debug: userOptions.debug ?? envToBool(getEnvVar(env, 'SENTRY_DEBUG')),\n tunnel: userOptions.tunnel ?? getEnvVar(env, 'SENTRY_TUNNEL'),\n traceLifecycle: userOptions.traceLifecycle ?? getTraceLifecycleFromEnv(getEnvVar(env, 'SENTRY_TRACE_LIFECYCLE')),\n /*! rollup-include-development-only */\n spotlight,\n /*! rollup-include-development-only-end */\n };\n}\n\n/**\n * Resolve the spotlight option from a user-supplied value and an env binding string.\n * Mirrors node-core's `getSpotlightConfig` precedence:\n * - `false` or explicit string from options → use as-is\n * - `true` → enable, but prefer a custom URL from the env var if set\n * - `undefined` → defer entirely to the env var (bool or URL)\n */\nfunction getSpotlightFromEnv(\n optionsSpotlight: boolean | string | undefined,\n envVar: string | undefined,\n): boolean | string | undefined {\n if (optionsSpotlight === false) {\n return false;\n }\n if (typeof optionsSpotlight === 'string') {\n return optionsSpotlight;\n }\n\n // optionsSpotlight is true or undefined\n const envBool = envToBool(envVar, { strict: true });\n const envUrl = envBool === null && envVar ? envVar : undefined;\n\n return optionsSpotlight === true\n ? (envUrl ?? true) // true: use env URL if present, otherwise true\n : (envBool ?? envUrl); // undefined: use env var (bool or URL)\n}\n\nfunction getTraceLifecycleFromEnv(envVar: string | undefined): 'static' | 'stream' | undefined {\n return envVar === 'stream' || envVar === 'static' ? envVar : undefined;\n}\n"],"names":[],"mappings":";;AAgBA,SAAS,kBAAkB,KAAA,EAA4C;AACrE,EAAA,OAAO,aAAa,KAAK,CAAA,IAAK,QAAQ,KAAA,IAAS,OAAO,MAAM,EAAA,KAAO,QAAA;AACrE;AAEA,SAAS,SAAA,CAA6C,KAAc,OAAA,EAAsC;AACxG,EAAA,OAAO,YAAA,CAAa,GAAG,CAAA,IAAK,OAAA,IAAW,GAAA,IAAO,OAAQ,GAAA,CAAU,OAAO,CAAA,KAAM,QAAA,GACvE,GAAA,CAAU,OAAO,CAAA,GACnB,MAAA;AACN;AAgBO,SAAS,eAAA,CAAgB,WAAA,GAAiC,EAAC,EAAG,GAAA,EAAiC;AACpG,EAAA,IAAI,OAAO,GAAA,KAAQ,QAAA,IAAY,GAAA,KAAQ,IAAA,EAAM;AAC3C,IAAA,OAAO,WAAA;AAAA,EACT;AAGA,EAAA,MAAM,UACJ,gBAAA,IAAoB,GAAA,IAAO,OAAO,GAAA,CAAI,mBAAmB,QAAA,GACrD,GAAA,CAAI,cAAA,GACJ,qBAAA,IAAyB,OAAO,iBAAA,CAAkB,GAAA,CAAI,mBAAmB,CAAA,GACvE,GAAA,CAAI,oBAAoB,EAAA,GACxB,MAAA;AAER,EAAA,MAAM,gBAAA,GACJ,YAAY,gBAAA,IAAoB,UAAA,CAAW,UAAU,GAAA,EAAK,2BAA2B,KAAK,EAAE,CAAA;AAM9F,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,GAAG,WAAA;AAAA,IACH,GAAA,EAAK,WAAA,CAAY,GAAA,IAAO,SAAA,CAAU,KAAK,YAAY,CAAA;AAAA,IACnD,WAAA,EAAa,WAAA,CAAY,WAAA,IAAe,SAAA,CAAU,KAAK,oBAAoB,CAAA;AAAA,IAC3E,gBAAA,EAAkB,QAAA,CAAS,gBAAgB,CAAA,GAAI,gBAAA,GAAmB,MAAA;AAAA,IAClE,OAAO,WAAA,CAAY,KAAA,IAAS,UAAU,SAAA,CAAU,GAAA,EAAK,cAAc,CAAC,CAAA;AAAA,IACpE,MAAA,EAAQ,WAAA,CAAY,MAAA,IAAU,SAAA,CAAU,KAAK,eAAe,CAAA;AAAA,IAC5D,gBAAgB,WAAA,CAAY,cAAA,IAAkB,yBAAyB,SAAA,CAAU,GAAA,EAAK,wBAAwB,CAAC;AAAA,GAC/G;AACJ;AA6BA,SAAS,yBAAyB,MAAA,EAA6D;AAC7F,EAAA,OAAO,MAAA,KAAW,QAAA,IAAY,MAAA,KAAW,QAAA,GAAW,MAAA,GAAS,MAAA;AAC/D;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module","version":"11.0.0-alpha.1","sideEffects":false}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { setAsyncLocalStorageAsyncContextStrategy } from '@sentry/server-utils/no-diagnostic-channels';
|
|
2
|
+
import { wrapRequestHandlerWithInit } from './request.js';
|
|
3
|
+
import { init } from './sdk.js';
|
|
4
|
+
|
|
5
|
+
function sentryPagesPlugin(handlerOrOptions) {
|
|
6
|
+
setAsyncLocalStorageAsyncContextStrategy();
|
|
7
|
+
return (context) => {
|
|
8
|
+
if (context.request.method === "OPTIONS" || context.request.method === "HEAD") {
|
|
9
|
+
return context.next();
|
|
10
|
+
}
|
|
11
|
+
const options = typeof handlerOrOptions === "function" ? handlerOrOptions(context) : handlerOrOptions;
|
|
12
|
+
const executionContext = { ...context, props: {} };
|
|
13
|
+
return wrapRequestHandlerWithInit(
|
|
14
|
+
{ options, request: context.request, context: executionContext },
|
|
15
|
+
() => context.next(),
|
|
16
|
+
init
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { sentryPagesPlugin };
|
|
22
|
+
//# sourceMappingURL=pages-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pages-plugin.js","sources":["../../../src/pages-plugin.ts"],"sourcesContent":["import { setAsyncLocalStorageAsyncContextStrategy } from '@sentry/server-utils/no-diagnostic-channels';\nimport type { CloudflareOptions } from './client';\nimport type { ExecutionContextCompat } from './executionContext';\nimport { wrapRequestHandlerWithInit } from './request';\nimport { init } from './sdk';\n\n/**\n * Plugin middleware for Cloudflare Pages.\n *\n * Initializes the SDK and wraps cloudflare pages requests with SDK instrumentation.\n *\n * @example Simple usage\n *\n * ```javascript\n * // functions/_middleware.js\n * import * as Sentry from '@sentry/cloudflare';\n *\n * export const onRequest = Sentry.sentryPagesPlugin({\n * dsn: process.env.SENTRY_DSN,\n * tracesSampleRate: 1.0,\n * });\n * ```\n *\n * @example Usage with handler function to access context for environmental variables\n *\n * ```javascript\n * import * as Sentry from '@sentry/cloudflare';\n *\n * const const onRequest = Sentry.sentryPagesPlugin((context) => ({\n * dsn: context.env.SENTRY_DSN,\n * tracesSampleRate: 1.0,\n * })\n * ```\n *\n * @param handlerOrOptions Configuration options or a function that returns configuration options.\n * @returns A plugin function that can be used in Cloudflare Pages.\n */\nexport function sentryPagesPlugin<\n // oxlint-disable-next-line typescript/no-explicit-any\n Env = any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Params extends string = any,\n Data extends Record<string, unknown> = Record<string, unknown>,\n // Although it is not ideal to use `any` here, it makes usage more flexible for different setups.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n PluginParams = any,\n>(\n handlerOrOptions:\n | CloudflareOptions\n | ((context: EventPluginContext<Env, Params, Data, PluginParams>) => CloudflareOptions),\n): PagesPluginFunction<Env, Params, Data, PluginParams> {\n setAsyncLocalStorageAsyncContextStrategy();\n return context => {\n if (context.request.method === 'OPTIONS' || context.request.method === 'HEAD') {\n return context.next();\n }\n\n const options = typeof handlerOrOptions === 'function' ? handlerOrOptions(context) : handlerOrOptions;\n // A Pages `EventPluginContext` is not a Workers `ExecutionContext`, but `wrapRequestHandler` only\n // uses `waitUntil` and a `'storage' in context` check, both of which this satisfies.\n const executionContext = { ...context, props: {} } as unknown as ExecutionContextCompat;\n return wrapRequestHandlerWithInit(\n { options, request: context.request, context: executionContext },\n () => context.next(),\n init,\n );\n };\n}\n"],"names":[],"mappings":";;;;AAqCO,SAAS,kBAUd,gBAAA,EAGsD;AACtD,EAAA,wCAAA,EAAyC;AACzC,EAAA,OAAO,CAAA,OAAA,KAAW;AAChB,IAAA,IAAI,QAAQ,OAAA,CAAQ,MAAA,KAAW,aAAa,OAAA,CAAQ,OAAA,CAAQ,WAAW,MAAA,EAAQ;AAC7E,MAAA,OAAO,QAAQ,IAAA,EAAK;AAAA,IACtB;AAEA,IAAA,MAAM,UAAU,OAAO,gBAAA,KAAqB,UAAA,GAAa,gBAAA,CAAiB,OAAO,CAAA,GAAI,gBAAA;AAGrF,IAAA,MAAM,mBAAmB,EAAE,GAAG,OAAA,EAAS,KAAA,EAAO,EAAC,EAAE;AACjD,IAAA,OAAO,0BAAA;AAAA,MACL,EAAE,OAAA,EAAS,OAAA,EAAS,OAAA,CAAQ,OAAA,EAAS,SAAS,gBAAA,EAAiB;AAAA,MAC/D,MAAM,QAAQ,IAAA,EAAK;AAAA,MACnB;AAAA,KACF;AAAA,EACF,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { parseStringToURLObject, getHttpSpanDetailsFromUrlObject, httpHeadersToSpanAttributes, winterCGHeadersToDict, SEMANTIC_ATTRIBUTE_SENTRY_OP, captureException, continueTrace, startSpanManual, setHttpStatus } from '@sentry/core';
|
|
2
|
+
import { captureIncomingRequestBody } from './integrations/httpServer.js';
|
|
3
|
+
import { initBaseSdk } from './baseSdk.js';
|
|
4
|
+
import { getOriginalWaitUntil, flushAndDispose } from './flush.js';
|
|
5
|
+
import { addCloudResourceContext, addRequest, addCultureContext } from './scope-utils.js';
|
|
6
|
+
import { withInvocationIsolationScope } from './utils/invocationScope.js';
|
|
7
|
+
import { classifyResponseStreaming } from './utils/streaming.js';
|
|
8
|
+
|
|
9
|
+
function getRequestErrorMechanismType(context) {
|
|
10
|
+
return context && "storage" in context ? "auto.faas.cloudflare.durable_object" : "auto.http.cloudflare";
|
|
11
|
+
}
|
|
12
|
+
function wrapRequestHandler(wrapperOptions, handler) {
|
|
13
|
+
return wrapRequestHandlerWithInit(wrapperOptions, handler, initBaseSdk);
|
|
14
|
+
}
|
|
15
|
+
function wrapRequestHandlerWithInit(wrapperOptions, handler, initSdk) {
|
|
16
|
+
return withInvocationIsolationScope(async (isolationScope) => {
|
|
17
|
+
const { options, request, captureErrors = true } = wrapperOptions;
|
|
18
|
+
const context = wrapperOptions.context;
|
|
19
|
+
const waitUntil = context ? getOriginalWaitUntil(context).bind(context) : void 0;
|
|
20
|
+
const errorMechanismType = getRequestErrorMechanismType(context);
|
|
21
|
+
const client = initSdk({ ...options, ctx: context });
|
|
22
|
+
isolationScope.setClient(client);
|
|
23
|
+
const urlObject = parseStringToURLObject(request.url);
|
|
24
|
+
const [name, attributes] = getHttpSpanDetailsFromUrlObject(
|
|
25
|
+
urlObject,
|
|
26
|
+
"server",
|
|
27
|
+
"auto.http.cloudflare",
|
|
28
|
+
request,
|
|
29
|
+
void 0,
|
|
30
|
+
client
|
|
31
|
+
);
|
|
32
|
+
const contentLength = request.headers.get("content-length");
|
|
33
|
+
if (contentLength) {
|
|
34
|
+
attributes["http.request.body.size"] = parseInt(contentLength, 10);
|
|
35
|
+
}
|
|
36
|
+
const userAgentHeader = request.headers.get("user-agent");
|
|
37
|
+
if (userAgentHeader) {
|
|
38
|
+
attributes["user_agent.original"] = userAgentHeader;
|
|
39
|
+
}
|
|
40
|
+
if (client) {
|
|
41
|
+
Object.assign(
|
|
42
|
+
attributes,
|
|
43
|
+
httpHeadersToSpanAttributes(winterCGHeadersToDict(request.headers), client.getDataCollectionOptions())
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] = "http.server";
|
|
47
|
+
addCloudResourceContext(isolationScope);
|
|
48
|
+
addRequest(isolationScope, request);
|
|
49
|
+
if (request.cf) {
|
|
50
|
+
addCultureContext(isolationScope, request.cf);
|
|
51
|
+
if (typeof request.cf.httpProtocol === "string") {
|
|
52
|
+
attributes["network.protocol.name"] = request.cf.httpProtocol;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (request.method === "OPTIONS" || request.method === "HEAD") {
|
|
56
|
+
try {
|
|
57
|
+
return await handler();
|
|
58
|
+
} catch (e) {
|
|
59
|
+
if (captureErrors) {
|
|
60
|
+
captureException(e, { mechanism: { handled: false, type: errorMechanismType } });
|
|
61
|
+
}
|
|
62
|
+
throw e;
|
|
63
|
+
} finally {
|
|
64
|
+
waitUntil?.(flushAndDispose(client));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (client) {
|
|
68
|
+
await captureIncomingRequestBody(client, request);
|
|
69
|
+
}
|
|
70
|
+
return continueTrace(
|
|
71
|
+
{ sentryTrace: request.headers.get("sentry-trace") || "", baggage: request.headers.get("baggage") },
|
|
72
|
+
() => {
|
|
73
|
+
return startSpanManual({ name, attributes }, async (span) => {
|
|
74
|
+
let res;
|
|
75
|
+
try {
|
|
76
|
+
res = await handler();
|
|
77
|
+
setHttpStatus(span, res.status);
|
|
78
|
+
} catch (e) {
|
|
79
|
+
span.end();
|
|
80
|
+
if (captureErrors) {
|
|
81
|
+
captureException(e, { mechanism: { handled: false, type: errorMechanismType } });
|
|
82
|
+
}
|
|
83
|
+
waitUntil?.(flushAndDispose(client));
|
|
84
|
+
throw e;
|
|
85
|
+
}
|
|
86
|
+
const classification = classifyResponseStreaming(res);
|
|
87
|
+
if (classification.isStreaming && res.body) {
|
|
88
|
+
try {
|
|
89
|
+
let ended = false;
|
|
90
|
+
const endSpanOnce = () => {
|
|
91
|
+
if (ended) return;
|
|
92
|
+
ended = true;
|
|
93
|
+
span.end();
|
|
94
|
+
waitUntil?.(flushAndDispose(client));
|
|
95
|
+
};
|
|
96
|
+
const transform = new TransformStream({
|
|
97
|
+
flush() {
|
|
98
|
+
endSpanOnce();
|
|
99
|
+
},
|
|
100
|
+
cancel() {
|
|
101
|
+
endSpanOnce();
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
return new Response(res.body.pipeThrough(transform), {
|
|
105
|
+
status: res.status,
|
|
106
|
+
statusText: res.statusText,
|
|
107
|
+
headers: res.headers
|
|
108
|
+
});
|
|
109
|
+
} catch {
|
|
110
|
+
span.end();
|
|
111
|
+
waitUntil?.(flushAndDispose(client));
|
|
112
|
+
return res;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
span.end();
|
|
116
|
+
if (res.status === 101) {
|
|
117
|
+
waitUntil?.(client?.flush(2e3));
|
|
118
|
+
} else {
|
|
119
|
+
waitUntil?.(flushAndDispose(client));
|
|
120
|
+
}
|
|
121
|
+
return res;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export { wrapRequestHandler, wrapRequestHandlerWithInit };
|
|
129
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.js","sources":["../../../src/request.ts"],"sourcesContent":["import type { CfProperties, IncomingRequestCfProperties } from '@cloudflare/workers-types';\nimport {\n captureException,\n continueTrace,\n getHttpSpanDetailsFromUrlObject,\n httpHeadersToSpanAttributes,\n parseStringToURLObject,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n setHttpStatus,\n startSpanManual,\n winterCGHeadersToDict,\n} from '@sentry/core';\nimport { captureIncomingRequestBody } from './integrations/httpServer';\nimport { initBaseSdk } from './baseSdk';\nimport type { CloudflareClient, CloudflareOptions } from './client';\nimport type { ExecutionContextCompat } from './executionContext';\nimport { flushAndDispose, getOriginalWaitUntil } from './flush';\nimport { addCloudResourceContext, addCultureContext, addRequest } from './scope-utils';\nimport { withInvocationIsolationScope } from './utils/invocationScope';\nimport { classifyResponseStreaming } from './utils/streaming';\n\nfunction getRequestErrorMechanismType(context: ExecutionContextCompat | undefined): string {\n // Durable Object fetch handlers use DO state as context (see instrumentDurableObjectWithSentry)\n return context && 'storage' in context ? 'auto.faas.cloudflare.durable_object' : 'auto.http.cloudflare';\n}\n\ninterface RequestHandlerWrapperOptions {\n options: CloudflareOptions;\n request: Request<unknown, IncomingRequestCfProperties<unknown> | CfProperties<unknown>>;\n context: ExecutionContextCompat | undefined;\n /**\n * If true, errors will be captured, rethrown and sent to Sentry.\n * Otherwise, errors are rethrown but not captured.\n *\n * You most likely don't want to set this to `false`, if you use `wrapRequestHandler` directly.\n * This is primarily meant as an escape hatch for higher-level SDKs relying on additional error\n * capturing mechanisms where this wrapper captures errors too early or too generally.\n *\n * @default true\n */\n captureErrors?: boolean;\n}\n\ntype InitSdk = (options: CloudflareOptions) => CloudflareClient | undefined;\n\n/**\n * Wraps a cloudflare request handler in Sentry instrumentation.\n *\n * The client is set up with the default integrations that work without the `nodejs_compat`\n * compatibility flag, so that this also works on runtimes that cannot enable it (e.g. Shopify\n * Oxygen). On a runtime that has `nodejs_compat`, pass `defaultIntegrations:\n * getDefaultIntegrations(options)` in `options` to get the full set instead.\n */\nexport function wrapRequestHandler(\n wrapperOptions: RequestHandlerWrapperOptions,\n handler: (...args: unknown[]) => Response | Promise<Response>,\n): Promise<Response> {\n return wrapRequestHandlerWithInit(wrapperOptions, handler, initBaseSdk);\n}\n\n/**\n * Same as {@link wrapRequestHandler}, but with the SDK initialization injected.\n *\n * Wrappers that are only reachable from the main entry point — where `nodejs_compat` is a\n * requirement anyway — pass `init` from `sdk.ts` to get the full default integrations.\n *\n * @internal\n */\nexport function wrapRequestHandlerWithInit(\n wrapperOptions: RequestHandlerWrapperOptions,\n handler: (...args: unknown[]) => Response | Promise<Response>,\n initSdk: InitSdk,\n): Promise<Response> {\n return withInvocationIsolationScope(async isolationScope => {\n const { options, request, captureErrors = true } = wrapperOptions;\n const context = wrapperOptions.context;\n\n // Use getOriginalWaitUntil to get the un-instrumented waitUntil function.\n // This is crucial to avoid deadlock: the flush lock mechanism wraps waitUntil\n // to track pending tasks. If we use the instrumented version for flushAndDispose,\n // it acquires the lock, then flushAndDispose tries to wait for the same lock,\n // creating a deadlock.\n const waitUntil = context ? getOriginalWaitUntil(context).bind(context) : undefined;\n const errorMechanismType = getRequestErrorMechanismType(context);\n\n const client = initSdk({ ...options, ctx: context });\n isolationScope.setClient(client);\n\n const urlObject = parseStringToURLObject(request.url);\n const [name, attributes] = getHttpSpanDetailsFromUrlObject(\n urlObject,\n 'server',\n 'auto.http.cloudflare',\n request,\n undefined,\n client,\n );\n\n const contentLength = request.headers.get('content-length');\n if (contentLength) {\n attributes['http.request.body.size'] = parseInt(contentLength, 10);\n }\n\n const userAgentHeader = request.headers.get('user-agent');\n if (userAgentHeader) {\n attributes['user_agent.original'] = userAgentHeader;\n }\n\n if (client) {\n Object.assign(\n attributes,\n httpHeadersToSpanAttributes(winterCGHeadersToDict(request.headers), client.getDataCollectionOptions()),\n );\n }\n\n attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] = 'http.server';\n\n addCloudResourceContext(isolationScope);\n addRequest(isolationScope, request);\n if (request.cf) {\n addCultureContext(isolationScope, request.cf);\n\n if (typeof request.cf.httpProtocol === 'string') {\n attributes['network.protocol.name'] = request.cf.httpProtocol;\n }\n }\n\n // Do not capture spans for OPTIONS and HEAD requests\n if (request.method === 'OPTIONS' || request.method === 'HEAD') {\n try {\n return await handler();\n } catch (e) {\n if (captureErrors) {\n captureException(e, { mechanism: { handled: false, type: errorMechanismType } });\n }\n throw e;\n } finally {\n waitUntil?.(flushAndDispose(client));\n }\n }\n\n if (client) {\n await captureIncomingRequestBody(client, request);\n }\n\n return continueTrace(\n { sentryTrace: request.headers.get('sentry-trace') || '', baggage: request.headers.get('baggage') },\n () => {\n // Note: This span will not have a duration unless I/O happens in the handler. This is\n // because of how the cloudflare workers runtime works.\n // See: https://developers.cloudflare.com/workers/runtime-apis/performance/\n\n // Use startSpanManual to control when span ends (needed for streaming responses)\n return startSpanManual({ name, attributes }, async span => {\n let res: Response;\n\n try {\n res = await handler();\n setHttpStatus(span, res.status);\n\n // After the handler runs, the span name might have been updated by nested instrumentation\n // (e.g., Remix parameterizing routes). The span should already have the correct name\n // from that instrumentation, so we don't need to do anything here.\n } catch (e) {\n span.end();\n if (captureErrors) {\n captureException(e, { mechanism: { handled: false, type: errorMechanismType } });\n }\n waitUntil?.(flushAndDispose(client));\n throw e;\n }\n\n // Classify response to detect actual streaming\n const classification = classifyResponseStreaming(res);\n\n if (classification.isStreaming && res.body) {\n try {\n let ended = false;\n\n const endSpanOnce = (): void => {\n if (ended) return;\n\n ended = true;\n span.end();\n waitUntil?.(flushAndDispose(client));\n };\n\n const transform = new TransformStream({\n flush() {\n // Source stream completed normally.\n endSpanOnce();\n },\n cancel() {\n // Client disconnected (or downstream cancelled). The `cancel`\n // is being called while the response is still considered\n // active, so this is a safe place to end the span.\n endSpanOnce();\n },\n });\n\n return new Response(res.body.pipeThrough(transform), {\n status: res.status,\n statusText: res.statusText,\n headers: res.headers,\n });\n } catch {\n span.end();\n waitUntil?.(flushAndDispose(client));\n return res;\n }\n }\n\n // Non-streaming response - end span immediately and return original\n span.end();\n\n // Don't dispose for protocol upgrades (101 Switching Protocols) - the connection stays alive.\n // This includes WebSocket upgrades where webSocketMessage/webSocketClose handlers\n // will still be called and may need the client to capture errors.\n if (res.status === 101) {\n waitUntil?.(client?.flush(2000));\n } else {\n waitUntil?.(flushAndDispose(client));\n }\n return res;\n });\n },\n );\n });\n}\n"],"names":[],"mappings":";;;;;;;;AAqBA,SAAS,6BAA6B,OAAA,EAAqD;AAEzF,EAAA,OAAO,OAAA,IAAW,SAAA,IAAa,OAAA,GAAU,qCAAA,GAAwC,sBAAA;AACnF;AA6BO,SAAS,kBAAA,CACd,gBACA,OAAA,EACmB;AACnB,EAAA,OAAO,0BAAA,CAA2B,cAAA,EAAgB,OAAA,EAAS,WAAW,CAAA;AACxE;AAUO,SAAS,0BAAA,CACd,cAAA,EACA,OAAA,EACA,OAAA,EACmB;AACnB,EAAA,OAAO,4BAAA,CAA6B,OAAM,cAAA,KAAkB;AAC1D,IAAA,MAAM,EAAE,OAAA,EAAS,OAAA,EAAS,aAAA,GAAgB,MAAK,GAAI,cAAA;AACnD,IAAA,MAAM,UAAU,cAAA,CAAe,OAAA;AAO/B,IAAA,MAAM,YAAY,OAAA,GAAU,oBAAA,CAAqB,OAAO,CAAA,CAAE,IAAA,CAAK,OAAO,CAAA,GAAI,MAAA;AAC1E,IAAA,MAAM,kBAAA,GAAqB,6BAA6B,OAAO,CAAA;AAE/D,IAAA,MAAM,SAAS,OAAA,CAAQ,EAAE,GAAG,OAAA,EAAS,GAAA,EAAK,SAAS,CAAA;AACnD,IAAA,cAAA,CAAe,UAAU,MAAM,CAAA;AAE/B,IAAA,MAAM,SAAA,GAAY,sBAAA,CAAuB,OAAA,CAAQ,GAAG,CAAA;AACpD,IAAA,MAAM,CAAC,IAAA,EAAM,UAAU,CAAA,GAAI,+BAAA;AAAA,MACzB,SAAA;AAAA,MACA,QAAA;AAAA,MACA,sBAAA;AAAA,MACA,OAAA;AAAA,MACA,MAAA;AAAA,MACA;AAAA,KACF;AAEA,IAAA,MAAM,aAAA,GAAgB,OAAA,CAAQ,OAAA,CAAQ,GAAA,CAAI,gBAAgB,CAAA;AAC1D,IAAA,IAAI,aAAA,EAAe;AACjB,MAAA,UAAA,CAAW,wBAAwB,CAAA,GAAI,QAAA,CAAS,aAAA,EAAe,EAAE,CAAA;AAAA,IACnE;AAEA,IAAA,MAAM,eAAA,GAAkB,OAAA,CAAQ,OAAA,CAAQ,GAAA,CAAI,YAAY,CAAA;AACxD,IAAA,IAAI,eAAA,EAAiB;AACnB,MAAA,UAAA,CAAW,qBAAqB,CAAA,GAAI,eAAA;AAAA,IACtC;AAEA,IAAA,IAAI,MAAA,EAAQ;AACV,MAAA,MAAA,CAAO,MAAA;AAAA,QACL,UAAA;AAAA,QACA,4BAA4B,qBAAA,CAAsB,OAAA,CAAQ,OAAO,CAAA,EAAG,MAAA,CAAO,0BAA0B;AAAA,OACvG;AAAA,IACF;AAEA,IAAA,UAAA,CAAW,4BAA4B,CAAA,GAAI,aAAA;AAE3C,IAAA,uBAAA,CAAwB,cAAc,CAAA;AACtC,IAAA,UAAA,CAAW,gBAAgB,OAAO,CAAA;AAClC,IAAA,IAAI,QAAQ,EAAA,EAAI;AACd,MAAA,iBAAA,CAAkB,cAAA,EAAgB,QAAQ,EAAE,CAAA;AAE5C,MAAA,IAAI,OAAO,OAAA,CAAQ,EAAA,CAAG,YAAA,KAAiB,QAAA,EAAU;AAC/C,QAAA,UAAA,CAAW,uBAAuB,CAAA,GAAI,OAAA,CAAQ,EAAA,CAAG,YAAA;AAAA,MACnD;AAAA,IACF;AAGA,IAAA,IAAI,OAAA,CAAQ,MAAA,KAAW,SAAA,IAAa,OAAA,CAAQ,WAAW,MAAA,EAAQ;AAC7D,MAAA,IAAI;AACF,QAAA,OAAO,MAAM,OAAA,EAAQ;AAAA,MACvB,SAAS,CAAA,EAAG;AACV,QAAA,IAAI,aAAA,EAAe;AACjB,UAAA,gBAAA,CAAiB,CAAA,EAAG,EAAE,SAAA,EAAW,EAAE,SAAS,KAAA,EAAO,IAAA,EAAM,kBAAA,EAAmB,EAAG,CAAA;AAAA,QACjF;AACA,QAAA,MAAM,CAAA;AAAA,MACR,CAAA,SAAE;AACA,QAAA,SAAA,GAAY,eAAA,CAAgB,MAAM,CAAC,CAAA;AAAA,MACrC;AAAA,IACF;AAEA,IAAA,IAAI,MAAA,EAAQ;AACV,MAAA,MAAM,0BAAA,CAA2B,QAAQ,OAAO,CAAA;AAAA,IAClD;AAEA,IAAA,OAAO,aAAA;AAAA,MACL,EAAE,WAAA,EAAa,OAAA,CAAQ,OAAA,CAAQ,GAAA,CAAI,cAAc,CAAA,IAAK,EAAA,EAAI,OAAA,EAAS,OAAA,CAAQ,OAAA,CAAQ,GAAA,CAAI,SAAS,CAAA,EAAE;AAAA,MAClG,MAAM;AAMJ,QAAA,OAAO,gBAAgB,EAAE,IAAA,EAAM,UAAA,EAAW,EAAG,OAAM,IAAA,KAAQ;AACzD,UAAA,IAAI,GAAA;AAEJ,UAAA,IAAI;AACF,YAAA,GAAA,GAAM,MAAM,OAAA,EAAQ;AACpB,YAAA,aAAA,CAAc,IAAA,EAAM,IAAI,MAAM,CAAA;AAAA,UAKhC,SAAS,CAAA,EAAG;AACV,YAAA,IAAA,CAAK,GAAA,EAAI;AACT,YAAA,IAAI,aAAA,EAAe;AACjB,cAAA,gBAAA,CAAiB,CAAA,EAAG,EAAE,SAAA,EAAW,EAAE,SAAS,KAAA,EAAO,IAAA,EAAM,kBAAA,EAAmB,EAAG,CAAA;AAAA,YACjF;AACA,YAAA,SAAA,GAAY,eAAA,CAAgB,MAAM,CAAC,CAAA;AACnC,YAAA,MAAM,CAAA;AAAA,UACR;AAGA,UAAA,MAAM,cAAA,GAAiB,0BAA0B,GAAG,CAAA;AAEpD,UAAA,IAAI,cAAA,CAAe,WAAA,IAAe,GAAA,CAAI,IAAA,EAAM;AAC1C,YAAA,IAAI;AACF,cAAA,IAAI,KAAA,GAAQ,KAAA;AAEZ,cAAA,MAAM,cAAc,MAAY;AAC9B,gBAAA,IAAI,KAAA,EAAO;AAEX,gBAAA,KAAA,GAAQ,IAAA;AACR,gBAAA,IAAA,CAAK,GAAA,EAAI;AACT,gBAAA,SAAA,GAAY,eAAA,CAAgB,MAAM,CAAC,CAAA;AAAA,cACrC,CAAA;AAEA,cAAA,MAAM,SAAA,GAAY,IAAI,eAAA,CAAgB;AAAA,gBACpC,KAAA,GAAQ;AAEN,kBAAA,WAAA,EAAY;AAAA,gBACd,CAAA;AAAA,gBACA,MAAA,GAAS;AAIP,kBAAA,WAAA,EAAY;AAAA,gBACd;AAAA,eACD,CAAA;AAED,cAAA,OAAO,IAAI,QAAA,CAAS,GAAA,CAAI,IAAA,CAAK,WAAA,CAAY,SAAS,CAAA,EAAG;AAAA,gBACnD,QAAQ,GAAA,CAAI,MAAA;AAAA,gBACZ,YAAY,GAAA,CAAI,UAAA;AAAA,gBAChB,SAAS,GAAA,CAAI;AAAA,eACd,CAAA;AAAA,YACH,CAAA,CAAA,MAAQ;AACN,cAAA,IAAA,CAAK,GAAA,EAAI;AACT,cAAA,SAAA,GAAY,eAAA,CAAgB,MAAM,CAAC,CAAA;AACnC,cAAA,OAAO,GAAA;AAAA,YACT;AAAA,UACF;AAGA,UAAA,IAAA,CAAK,GAAA,EAAI;AAKT,UAAA,IAAI,GAAA,CAAI,WAAW,GAAA,EAAK;AACtB,YAAA,SAAA,GAAY,MAAA,EAAQ,KAAA,CAAM,GAAI,CAAC,CAAA;AAAA,UACjC,CAAA,MAAO;AACL,YAAA,SAAA,GAAY,eAAA,CAAgB,MAAM,CAAC,CAAA;AAAA,UACrC;AACA,UAAA,OAAO,GAAA;AAAA,QACT,CAAC,CAAA;AAAA,MACH;AAAA,KACF;AAAA,EACF,CAAC,CAAA;AACH;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { winterCGRequestToRequestData } from '@sentry/core';
|
|
2
|
+
|
|
3
|
+
function addCloudResourceContext(scope) {
|
|
4
|
+
scope.setContext("cloud_resource", {
|
|
5
|
+
"cloud.provider": "cloudflare"
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
function addCultureContext(scope, cf) {
|
|
9
|
+
scope.setContext("culture", {
|
|
10
|
+
timezone: cf.timezone
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function addRequest(scope, request) {
|
|
14
|
+
scope.setSDKProcessingMetadata({ normalizedRequest: winterCGRequestToRequestData(request) });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { addCloudResourceContext, addCultureContext, addRequest };
|
|
18
|
+
//# sourceMappingURL=scope-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-utils.js","sources":["../../../src/scope-utils.ts"],"sourcesContent":["import type { CfProperties, IncomingRequestCfProperties } from '@cloudflare/workers-types';\nimport type { Scope } from '@sentry/core';\nimport { winterCGRequestToRequestData } from '@sentry/core';\n\n/**\n * Set cloud resource context on scope.\n */\nexport function addCloudResourceContext(scope: Scope): void {\n scope.setContext('cloud_resource', {\n 'cloud.provider': 'cloudflare',\n });\n}\n\n/**\n * Set culture context on scope\n */\nexport function addCultureContext(scope: Scope, cf: IncomingRequestCfProperties | CfProperties): void {\n scope.setContext('culture', {\n timezone: cf.timezone,\n });\n}\n\n/**\n * Set request data on scope\n */\nexport function addRequest(scope: Scope, request: Request): void {\n scope.setSDKProcessingMetadata({ normalizedRequest: winterCGRequestToRequestData(request) });\n}\n"],"names":[],"mappings":";;AAOO,SAAS,wBAAwB,KAAA,EAAoB;AAC1D,EAAA,KAAA,CAAM,WAAW,gBAAA,EAAkB;AAAA,IACjC,gBAAA,EAAkB;AAAA,GACnB,CAAA;AACH;AAKO,SAAS,iBAAA,CAAkB,OAAc,EAAA,EAAsD;AACpG,EAAA,KAAA,CAAM,WAAW,SAAA,EAAW;AAAA,IAC1B,UAAU,EAAA,CAAG;AAAA,GACd,CAAA;AACH;AAKO,SAAS,UAAA,CAAW,OAAc,OAAA,EAAwB;AAC/D,EAAA,KAAA,CAAM,yBAAyB,EAAE,iBAAA,EAAmB,4BAAA,CAA6B,OAAO,GAAG,CAAA;AAC7F;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { vercelAIIntegration } from './integrations/tracing/vercelai.js';
|
|
2
|
+
import { getBaseDefaultIntegrations, initWithDefaultIntegrations } from './baseSdk.js';
|
|
3
|
+
|
|
4
|
+
function getDefaultIntegrations(options) {
|
|
5
|
+
return [
|
|
6
|
+
...getBaseDefaultIntegrations(options),
|
|
7
|
+
// Subscribes to the `ai` SDK's native `node:diagnostics_channel` telemetry channel.
|
|
8
|
+
vercelAIIntegration()
|
|
9
|
+
];
|
|
10
|
+
}
|
|
11
|
+
function init(options) {
|
|
12
|
+
return initWithDefaultIntegrations(options, getDefaultIntegrations);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { getDefaultIntegrations, init };
|
|
16
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../../src/sdk.ts"],"sourcesContent":["import type { Integration } from '@sentry/core';\nimport { vercelAIIntegration } from './integrations/tracing/vercelai';\nimport { getBaseDefaultIntegrations, initWithDefaultIntegrations } from './baseSdk';\nimport type { CloudflareClient, CloudflareOptions } from './client';\n\n/**\n * Get the default integrations for the Cloudflare SDK.\n *\n * This is the full set and requires the `nodejs_compat` compatibility flag. Runtimes that cannot\n * enable it (e.g. Shopify Oxygen) go through `wrapRequestHandler`, which only sets up\n * `getBaseDefaultIntegrations`.\n */\nexport function getDefaultIntegrations(options: CloudflareOptions): Integration[] {\n return [\n ...getBaseDefaultIntegrations(options),\n // Subscribes to the `ai` SDK's native `node:diagnostics_channel` telemetry channel.\n vercelAIIntegration(),\n ];\n}\n\n/**\n * Initializes the cloudflare SDK.\n */\nexport function init(options: CloudflareOptions): CloudflareClient | undefined {\n return initWithDefaultIntegrations(options, getDefaultIntegrations);\n}\n"],"names":[],"mappings":";;;AAYO,SAAS,uBAAuB,OAAA,EAA2C;AAChF,EAAA,OAAO;AAAA,IACL,GAAG,2BAA2B,OAAO,CAAA;AAAA;AAAA,IAErC,mBAAA;AAAoB,GACtB;AACF;AAKO,SAAS,KAAK,OAAA,EAA0D;AAC7E,EAAA,OAAO,2BAAA,CAA4B,SAAS,sBAAsB,CAAA;AACpE;;;;"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createTransport, suppressTracing, SENTRY_BUFFER_FULL_ERROR } from '@sentry/core';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_TRANSPORT_BUFFER_SIZE = 30;
|
|
4
|
+
class IsolatedPromiseBuffer {
|
|
5
|
+
constructor(_bufferSize = DEFAULT_TRANSPORT_BUFFER_SIZE) {
|
|
6
|
+
this.$ = [];
|
|
7
|
+
this._taskProducers = [];
|
|
8
|
+
this._bufferSize = _bufferSize;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @inheritdoc
|
|
12
|
+
*/
|
|
13
|
+
add(taskProducer) {
|
|
14
|
+
if (this._taskProducers.length >= this._bufferSize) {
|
|
15
|
+
return Promise.reject(SENTRY_BUFFER_FULL_ERROR);
|
|
16
|
+
}
|
|
17
|
+
this._taskProducers.push(taskProducer);
|
|
18
|
+
return Promise.resolve({});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @inheritdoc
|
|
22
|
+
*/
|
|
23
|
+
drain(timeout) {
|
|
24
|
+
const oldTaskProducers = [...this._taskProducers];
|
|
25
|
+
this._taskProducers = [];
|
|
26
|
+
return new Promise((resolve) => {
|
|
27
|
+
const timer = setTimeout(() => {
|
|
28
|
+
if (timeout && timeout > 0) {
|
|
29
|
+
resolve(false);
|
|
30
|
+
}
|
|
31
|
+
}, timeout);
|
|
32
|
+
Promise.all(
|
|
33
|
+
oldTaskProducers.map(
|
|
34
|
+
(taskProducer) => taskProducer().then(null, () => {
|
|
35
|
+
})
|
|
36
|
+
)
|
|
37
|
+
).then(() => {
|
|
38
|
+
clearTimeout(timer);
|
|
39
|
+
resolve(true);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function makeCloudflareTransport(options) {
|
|
45
|
+
function makeRequest(request) {
|
|
46
|
+
const requestOptions = {
|
|
47
|
+
body: request.body,
|
|
48
|
+
method: "POST",
|
|
49
|
+
headers: options.headers,
|
|
50
|
+
...options.fetchOptions
|
|
51
|
+
};
|
|
52
|
+
return suppressTracing(() => {
|
|
53
|
+
return (options.fetch ?? fetch)(options.url, requestOptions).then(async (response) => {
|
|
54
|
+
try {
|
|
55
|
+
await response.text();
|
|
56
|
+
} catch {
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
statusCode: response.status,
|
|
60
|
+
headers: {
|
|
61
|
+
"x-sentry-rate-limits": response.headers.get("X-Sentry-Rate-Limits"),
|
|
62
|
+
"retry-after": response.headers.get("Retry-After")
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return createTransport(options, makeRequest, new IsolatedPromiseBuffer(options.bufferSize));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { IsolatedPromiseBuffer, makeCloudflareTransport };
|
|
72
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sources":["../../../src/transport.ts"],"sourcesContent":["import type { BaseTransportOptions, Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core';\nimport { createTransport, SENTRY_BUFFER_FULL_ERROR, suppressTracing } from '@sentry/core';\n\nexport interface CloudflareTransportOptions extends BaseTransportOptions {\n /** Custom fetch function to use. This allows usage of things like Workers VPC */\n fetch?: typeof fetch;\n /** Fetch API init parameters. */\n fetchOptions?: RequestInit;\n}\n\nconst DEFAULT_TRANSPORT_BUFFER_SIZE = 30;\n\n/**\n * This is a modified promise buffer that collects tasks until drain is called.\n * We need this in the edge runtime because edge function invocations may not share I/O objects, like fetch requests\n * and responses, and the normal PromiseBuffer inherently buffers stuff inbetween incoming requests.\n *\n * A limitation we need to be aware of is that DEFAULT_TRANSPORT_BUFFER_SIZE is the maximum amount of payloads the\n * SDK can send for a given edge function invocation.\n */\nexport class IsolatedPromiseBuffer {\n // We just have this field because the promise buffer interface requires it.\n // If we ever remove it from the interface we should also remove it here.\n public $: Array<PromiseLike<TransportMakeRequestResponse>>;\n\n private _taskProducers: (() => PromiseLike<TransportMakeRequestResponse>)[];\n\n private readonly _bufferSize: number;\n\n public constructor(_bufferSize = DEFAULT_TRANSPORT_BUFFER_SIZE) {\n this.$ = [];\n this._taskProducers = [];\n this._bufferSize = _bufferSize;\n }\n\n /**\n * @inheritdoc\n */\n public add(taskProducer: () => PromiseLike<TransportMakeRequestResponse>): PromiseLike<TransportMakeRequestResponse> {\n if (this._taskProducers.length >= this._bufferSize) {\n return Promise.reject(SENTRY_BUFFER_FULL_ERROR);\n }\n\n this._taskProducers.push(taskProducer);\n return Promise.resolve({});\n }\n\n /**\n * @inheritdoc\n */\n public drain(timeout?: number): PromiseLike<boolean> {\n const oldTaskProducers = [...this._taskProducers];\n this._taskProducers = [];\n\n return new Promise(resolve => {\n const timer = setTimeout(() => {\n if (timeout && timeout > 0) {\n resolve(false);\n }\n }, timeout);\n\n // This cannot reject\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n Promise.all(\n oldTaskProducers.map(taskProducer =>\n taskProducer().then(null, () => {\n // catch all failed requests\n }),\n ),\n ).then(() => {\n // resolve to true if all fetch requests settled\n clearTimeout(timer);\n resolve(true);\n });\n });\n }\n}\n\n/**\n * Creates a Transport that uses the native fetch API to send events to Sentry.\n */\nexport function makeCloudflareTransport(options: CloudflareTransportOptions): Transport {\n function makeRequest(request: TransportRequest): PromiseLike<TransportMakeRequestResponse> {\n const requestOptions: RequestInit = {\n body: request.body as BodyInit,\n method: 'POST',\n headers: options.headers,\n ...options.fetchOptions,\n };\n\n return suppressTracing(() => {\n return (options.fetch ?? fetch)(options.url, requestOptions).then(async response => {\n // Consume the response body to satisfy Cloudflare Workers' fetch requirements.\n // The runtime requires all fetch response bodies to be read or explicitly canceled\n // to prevent connection stalls and potential deadlocks. We read the body as text\n // even though we don't use the content, as Sentry's response information is in the headers.\n // See: https://github.com/getsentry/sentry-javascript/issues/18534\n try {\n await response.text();\n } catch {\n // no-op\n }\n\n return {\n statusCode: response.status,\n headers: {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n },\n };\n });\n });\n }\n\n return createTransport(options, makeRequest, new IsolatedPromiseBuffer(options.bufferSize));\n}\n"],"names":[],"mappings":";;AAUA,MAAM,6BAAA,GAAgC,EAAA;AAU/B,MAAM,qBAAA,CAAsB;AAAA,EAS1B,WAAA,CAAY,cAAc,6BAAA,EAA+B;AAC9D,IAAA,IAAA,CAAK,IAAI,EAAC;AACV,IAAA,IAAA,CAAK,iBAAiB,EAAC;AACvB,IAAA,IAAA,CAAK,WAAA,GAAc,WAAA;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA,EAKO,IAAI,YAAA,EAA0G;AACnH,IAAA,IAAI,IAAA,CAAK,cAAA,CAAe,MAAA,IAAU,IAAA,CAAK,WAAA,EAAa;AAClD,MAAA,OAAO,OAAA,CAAQ,OAAO,wBAAwB,CAAA;AAAA,IAChD;AAEA,IAAA,IAAA,CAAK,cAAA,CAAe,KAAK,YAAY,CAAA;AACrC,IAAA,OAAO,OAAA,CAAQ,OAAA,CAAQ,EAAE,CAAA;AAAA,EAC3B;AAAA;AAAA;AAAA;AAAA,EAKO,MAAM,OAAA,EAAwC;AACnD,IAAA,MAAM,gBAAA,GAAmB,CAAC,GAAG,IAAA,CAAK,cAAc,CAAA;AAChD,IAAA,IAAA,CAAK,iBAAiB,EAAC;AAEvB,IAAA,OAAO,IAAI,QAAQ,CAAA,OAAA,KAAW;AAC5B,MAAA,MAAM,KAAA,GAAQ,WAAW,MAAM;AAC7B,QAAA,IAAI,OAAA,IAAW,UAAU,CAAA,EAAG;AAC1B,UAAA,OAAA,CAAQ,KAAK,CAAA;AAAA,QACf;AAAA,MACF,GAAG,OAAO,CAAA;AAIV,MAAA,OAAA,CAAQ,GAAA;AAAA,QACN,gBAAA,CAAiB,GAAA;AAAA,UAAI,CAAA,YAAA,KACnB,YAAA,EAAa,CAAE,IAAA,CAAK,MAAM,MAAM;AAAA,UAEhC,CAAC;AAAA;AACH,OACF,CAAE,KAAK,MAAM;AAEX,QAAA,YAAA,CAAa,KAAK,CAAA;AAClB,QAAA,OAAA,CAAQ,IAAI,CAAA;AAAA,MACd,CAAC,CAAA;AAAA,IACH,CAAC,CAAA;AAAA,EACH;AACF;AAKO,SAAS,wBAAwB,OAAA,EAAgD;AACtF,EAAA,SAAS,YAAY,OAAA,EAAsE;AACzF,IAAA,MAAM,cAAA,GAA8B;AAAA,MAClC,MAAM,OAAA,CAAQ,IAAA;AAAA,MACd,MAAA,EAAQ,MAAA;AAAA,MACR,SAAS,OAAA,CAAQ,OAAA;AAAA,MACjB,GAAG,OAAA,CAAQ;AAAA,KACb;AAEA,IAAA,OAAO,gBAAgB,MAAM;AAC3B,MAAA,OAAA,CAAQ,OAAA,CAAQ,SAAS,KAAA,EAAO,OAAA,CAAQ,KAAK,cAAc,CAAA,CAAE,IAAA,CAAK,OAAM,QAAA,KAAY;AAMlF,QAAA,IAAI;AACF,UAAA,MAAM,SAAS,IAAA,EAAK;AAAA,QACtB,CAAA,CAAA,MAAQ;AAAA,QAER;AAEA,QAAA,OAAO;AAAA,UACL,YAAY,QAAA,CAAS,MAAA;AAAA,UACrB,OAAA,EAAS;AAAA,YACP,sBAAA,EAAwB,QAAA,CAAS,OAAA,CAAQ,GAAA,CAAI,sBAAsB,CAAA;AAAA,YACnE,aAAA,EAAe,QAAA,CAAS,OAAA,CAAQ,GAAA,CAAI,aAAa;AAAA;AACnD,SACF;AAAA,MACF,CAAC,CAAA;AAAA,IACH,CAAC,CAAA;AAAA,EACH;AAEA,EAAA,OAAO,gBAAgB,OAAA,EAAS,WAAA,EAAa,IAAI,qBAAA,CAAsB,OAAA,CAAQ,UAAU,CAAC,CAAA;AAC5F;;;;"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { instrumentDurableObjectStorage } from '../instrumentations/instrumentDurableObjectStorage.js';
|
|
2
|
+
|
|
3
|
+
function instrumentContext(ctx) {
|
|
4
|
+
if (!ctx) return ctx;
|
|
5
|
+
const overrides = /* @__PURE__ */ new Map();
|
|
6
|
+
const contextPrototype = Object.getPrototypeOf(ctx);
|
|
7
|
+
const prototypeMethodNames = Object.getOwnPropertyNames(contextPrototype);
|
|
8
|
+
const ownPropertyNames = Object.getOwnPropertyNames(ctx);
|
|
9
|
+
const instrumented = /* @__PURE__ */ new Set(["constructor"]);
|
|
10
|
+
const descriptors = {};
|
|
11
|
+
for (const methodName of [...ownPropertyNames, ...prototypeMethodNames]) {
|
|
12
|
+
if (instrumented.has(methodName) || typeof ctx[methodName] !== "function") {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
instrumented.add(methodName);
|
|
16
|
+
descriptors[methodName] = makeOverridableDescriptor(overrides, ctx, methodName);
|
|
17
|
+
}
|
|
18
|
+
if ("storage" in ctx && ctx.storage) {
|
|
19
|
+
const originalStorage = ctx.storage;
|
|
20
|
+
const waitUntil = "waitUntil" in ctx && typeof ctx.waitUntil === "function" ? ctx.waitUntil.bind(ctx) : void 0;
|
|
21
|
+
let instrumentedStorage;
|
|
22
|
+
descriptors.storage = {
|
|
23
|
+
configurable: true,
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: () => {
|
|
26
|
+
if (!instrumentedStorage) {
|
|
27
|
+
instrumentedStorage = instrumentDurableObjectStorage(originalStorage, waitUntil);
|
|
28
|
+
}
|
|
29
|
+
return instrumentedStorage;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
descriptors.originalStorage = {
|
|
33
|
+
configurable: true,
|
|
34
|
+
enumerable: false,
|
|
35
|
+
get: () => originalStorage
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return Object.create(ctx, descriptors);
|
|
39
|
+
}
|
|
40
|
+
function makeOverridableDescriptor(store, ctx, method) {
|
|
41
|
+
return {
|
|
42
|
+
configurable: true,
|
|
43
|
+
enumerable: true,
|
|
44
|
+
set: (newValue) => {
|
|
45
|
+
if (typeof newValue == "function") {
|
|
46
|
+
store.set(method, newValue);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
Reflect.set(ctx, method, newValue);
|
|
50
|
+
},
|
|
51
|
+
get: () => {
|
|
52
|
+
if (store.has(method)) return store.get(method);
|
|
53
|
+
const methodFunction = Reflect.get(ctx, method);
|
|
54
|
+
if (typeof methodFunction !== "function") return methodFunction;
|
|
55
|
+
return methodFunction.bind(ctx);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { instrumentContext };
|
|
61
|
+
//# sourceMappingURL=instrumentContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentContext.js","sources":["../../../../src/utils/instrumentContext.ts"],"sourcesContent":["import { type DurableObjectState, type DurableObjectStorage, type ExecutionContext } from '@cloudflare/workers-types';\nimport { instrumentDurableObjectStorage } from '../instrumentations/instrumentDurableObjectStorage';\n\ntype ContextType = ExecutionContext | DurableObjectState;\ntype OverridesStore<T extends ContextType> = Map<keyof T, (...args: unknown[]) => unknown>;\n\n/**\n * Instruments an execution context or DurableObjectState with Sentry tracing.\n *\n * Creates a copy of the context that:\n * - Allows overriding of methods (e.g., waitUntil)\n * - For DurableObjectState: instruments storage operations (get, put, delete, list, etc.)\n * to create Sentry spans automatically\n *\n * @param ctx - The execution context or DurableObjectState to instrument\n * @returns An instrumented copy of the context\n */\nexport function instrumentContext<T extends ContextType>(ctx: T): T {\n if (!ctx) return ctx;\n\n const overrides: OverridesStore<T> = new Map();\n const contextPrototype = Object.getPrototypeOf(ctx);\n const prototypeMethodNames = Object.getOwnPropertyNames(contextPrototype) as unknown as (keyof T)[];\n const ownPropertyNames = Object.getOwnPropertyNames(ctx) as unknown as (keyof T)[];\n const instrumented = new Set<unknown>(['constructor']);\n const descriptors: PropertyDescriptorMap = {};\n\n for (const methodName of [...ownPropertyNames, ...prototypeMethodNames]) {\n if (instrumented.has(methodName) || typeof ctx[methodName] !== 'function') {\n continue;\n }\n\n instrumented.add(methodName);\n descriptors[methodName as string] = makeOverridableDescriptor(overrides, ctx, methodName);\n }\n\n // Check if this is a DurableObjectState context with a storage property\n // If so, wrap the storage with instrumentation\n if ('storage' in ctx && ctx.storage) {\n const originalStorage = ctx.storage;\n const waitUntil = 'waitUntil' in ctx && typeof ctx.waitUntil === 'function' ? ctx.waitUntil.bind(ctx) : undefined;\n let instrumentedStorage: DurableObjectStorage | undefined;\n descriptors.storage = {\n configurable: true,\n enumerable: true,\n get: () => {\n if (!instrumentedStorage) {\n instrumentedStorage = instrumentDurableObjectStorage(originalStorage, waitUntil);\n }\n return instrumentedStorage;\n },\n };\n // Expose the original uninstrumented storage for internal Sentry operations\n // This avoids creating spans for internal storage operations\n descriptors.originalStorage = {\n configurable: true,\n enumerable: false,\n get: () => originalStorage,\n };\n }\n\n return Object.create(ctx, descriptors);\n}\n\n/**\n * Creates a property descriptor that allows overriding of a method on the given context object.\n *\n * This descriptor supports property overriding with functions only. It delegates method calls to\n * the provided store if an override exists or to the original method on the context otherwise.\n *\n * @param {OverridesStore<ContextType>} store - The storage for overridden methods specific to the context type.\n * @param {ContextType} ctx - The context object that contains the method to be overridden.\n * @param {keyof ContextType} method - The method on the context object to create the overridable descriptor for.\n * @return {PropertyDescriptor} A property descriptor enabling the overriding of the specified method.\n */\nfunction makeOverridableDescriptor<T extends ContextType>(\n store: OverridesStore<T>,\n ctx: T,\n method: keyof T,\n): PropertyDescriptor {\n return {\n configurable: true,\n enumerable: true,\n set: newValue => {\n if (typeof newValue == 'function') {\n store.set(method, newValue);\n return;\n }\n Reflect.set(ctx, method, newValue);\n },\n\n get: () => {\n if (store.has(method)) return store.get(method);\n const methodFunction = Reflect.get(ctx, method);\n if (typeof methodFunction !== 'function') return methodFunction;\n // We should do bind() to make sure that the method is bound to the context object - otherwise it will not work\n return methodFunction.bind(ctx);\n },\n };\n}\n"],"names":[],"mappings":";;AAiBO,SAAS,kBAAyC,GAAA,EAAW;AAClE,EAAA,IAAI,CAAC,KAAK,OAAO,GAAA;AAEjB,EAAA,MAAM,SAAA,uBAAmC,GAAA,EAAI;AAC7C,EAAA,MAAM,gBAAA,GAAmB,MAAA,CAAO,cAAA,CAAe,GAAG,CAAA;AAClD,EAAA,MAAM,oBAAA,GAAuB,MAAA,CAAO,mBAAA,CAAoB,gBAAgB,CAAA;AACxE,EAAA,MAAM,gBAAA,GAAmB,MAAA,CAAO,mBAAA,CAAoB,GAAG,CAAA;AACvD,EAAA,MAAM,YAAA,mBAAe,IAAI,GAAA,CAAa,CAAC,aAAa,CAAC,CAAA;AACrD,EAAA,MAAM,cAAqC,EAAC;AAE5C,EAAA,KAAA,MAAW,cAAc,CAAC,GAAG,gBAAA,EAAkB,GAAG,oBAAoB,CAAA,EAAG;AACvE,IAAA,IAAI,YAAA,CAAa,IAAI,UAAU,CAAA,IAAK,OAAO,GAAA,CAAI,UAAU,MAAM,UAAA,EAAY;AACzE,MAAA;AAAA,IACF;AAEA,IAAA,YAAA,CAAa,IAAI,UAAU,CAAA;AAC3B,IAAA,WAAA,CAAY,UAAoB,CAAA,GAAI,yBAAA,CAA0B,SAAA,EAAW,KAAK,UAAU,CAAA;AAAA,EAC1F;AAIA,EAAA,IAAI,SAAA,IAAa,GAAA,IAAO,GAAA,CAAI,OAAA,EAAS;AACnC,IAAA,MAAM,kBAAkB,GAAA,CAAI,OAAA;AAC5B,IAAA,MAAM,SAAA,GAAY,WAAA,IAAe,GAAA,IAAO,OAAO,GAAA,CAAI,SAAA,KAAc,UAAA,GAAa,GAAA,CAAI,SAAA,CAAU,IAAA,CAAK,GAAG,CAAA,GAAI,MAAA;AACxG,IAAA,IAAI,mBAAA;AACJ,IAAA,WAAA,CAAY,OAAA,GAAU;AAAA,MACpB,YAAA,EAAc,IAAA;AAAA,MACd,UAAA,EAAY,IAAA;AAAA,MACZ,KAAK,MAAM;AACT,QAAA,IAAI,CAAC,mBAAA,EAAqB;AACxB,UAAA,mBAAA,GAAsB,8BAAA,CAA+B,iBAAiB,SAAS,CAAA;AAAA,QACjF;AACA,QAAA,OAAO,mBAAA;AAAA,MACT;AAAA,KACF;AAGA,IAAA,WAAA,CAAY,eAAA,GAAkB;AAAA,MAC5B,YAAA,EAAc,IAAA;AAAA,MACd,UAAA,EAAY,KAAA;AAAA,MACZ,KAAK,MAAM;AAAA,KACb;AAAA,EACF;AAEA,EAAA,OAAO,MAAA,CAAO,MAAA,CAAO,GAAA,EAAK,WAAW,CAAA;AACvC;AAaA,SAAS,yBAAA,CACP,KAAA,EACA,GAAA,EACA,MAAA,EACoB;AACpB,EAAA,OAAO;AAAA,IACL,YAAA,EAAc,IAAA;AAAA,IACd,UAAA,EAAY,IAAA;AAAA,IACZ,KAAK,CAAA,QAAA,KAAY;AACf,MAAA,IAAI,OAAO,YAAY,UAAA,EAAY;AACjC,QAAA,KAAA,CAAM,GAAA,CAAI,QAAQ,QAAQ,CAAA;AAC1B,QAAA;AAAA,MACF;AACA,MAAA,OAAA,CAAQ,GAAA,CAAI,GAAA,EAAK,MAAA,EAAQ,QAAQ,CAAA;AAAA,IACnC,CAAA;AAAA,IAEA,KAAK,MAAM;AACT,MAAA,IAAI,MAAM,GAAA,CAAI,MAAM,GAAG,OAAO,KAAA,CAAM,IAAI,MAAM,CAAA;AAC9C,MAAA,MAAM,cAAA,GAAiB,OAAA,CAAQ,GAAA,CAAI,GAAA,EAAK,MAAM,CAAA;AAC9C,MAAA,IAAI,OAAO,cAAA,KAAmB,UAAA,EAAY,OAAO,cAAA;AAEjD,MAAA,OAAO,cAAA,CAAe,KAAK,GAAG,CAAA;AAAA,IAChC;AAAA,GACF;AACF;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { stringMatchesSomePattern } from '@sentry/core';
|
|
2
|
+
|
|
3
|
+
function targetsCloudflareInternalTable(querySummary, allowlist, queryText) {
|
|
4
|
+
if (!querySummary) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
const indexedTable = queryText ? CREATE_INDEX_TABLE_RE.exec(queryText)?.groups?.["table"] : void 0;
|
|
8
|
+
if (indexedTable) {
|
|
9
|
+
return isCloudflareInternalTable(indexedTable, allowlist);
|
|
10
|
+
}
|
|
11
|
+
const [, ...tables] = querySummary.split(" ");
|
|
12
|
+
return tables.some((table) => isCloudflareInternalTable(table, allowlist));
|
|
13
|
+
}
|
|
14
|
+
const CREATE_INDEX_TABLE_RE = /^\s*CREATE\s+(?:UNIQUE\s+)?INDEX(?:\s+IF\s+(?:NOT\s+)?EXISTS)?\s+[^\s(,;)]+\s+ON\s+(?<table>[^\s(,;)]+)/i;
|
|
15
|
+
function isCloudflareInternalTable(table, allowlist) {
|
|
16
|
+
if (!table.toLowerCase().startsWith("cf_")) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return !allowlist?.length || !stringMatchesSomePattern(table, allowlist, true);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { targetsCloudflareInternalTable };
|
|
23
|
+
//# sourceMappingURL=internalSqlQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internalSqlQuery.js","sources":["../../../../src/utils/internalSqlQuery.ts"],"sourcesContent":["import { stringMatchesSomePattern } from '@sentry/core';\n\n/**\n * Cloudflare frameworks that build on Durable Objects (`agents`, `partyserver`, ...) manage their\n * own internal SQLite tables, all namespaced with a `cf_` prefix — e.g. `cf_agents_schedules`,\n * `cf_agent_state`, `cf_ai_chat_stream_chunks`. Queries against them (schedule polling, chat-stream\n * persistence, state bookkeeping) are framework implementation details that otherwise flood traces\n * with dozens of zero-signal `db.query` spans per request. The exact set of tables even varies\n * between framework versions, so we match the reserved prefix rather than an enumerated list.\n *\n * The `cf_` prefix is a reserved convention for framework-managed tables, so user tables should not\n * use it. In case a user table does collide with the prefix, the `durableObjectSqlSpanAllowlist`\n * option lets them opt those tables back into instrumentation.\n *\n * The check operates on the query summary produced by `getSqlQuerySummary` (`{operation} {table} ...`,\n * the same value used as the span name), so table targets are already isolated from the rest of the\n * query. The one exception is `CREATE INDEX`: its summary carries the index name, not the indexed\n * table (upstream OTel convention), so the `cf_` target only appears in the ON clause of the full\n * statement, which `queryText` is needed for.\n */\nexport function targetsCloudflareInternalTable(\n querySummary: string | undefined,\n allowlist?: Array<string | RegExp>,\n queryText?: string,\n): boolean {\n if (!querySummary) {\n return false;\n }\n\n const indexedTable = queryText ? CREATE_INDEX_TABLE_RE.exec(queryText)?.groups?.['table'] : undefined;\n if (indexedTable) {\n return isCloudflareInternalTable(indexedTable, allowlist);\n }\n\n const [, ...tables] = querySummary.split(' ');\n\n return tables.some(table => isCloudflareInternalTable(table, allowlist));\n}\n\n// `CREATE [UNIQUE] INDEX [IF NOT EXISTS] <name> ON <table>` — the IF EXISTS shape mirrors DDL_RE\n// in @sentry/core.\nconst CREATE_INDEX_TABLE_RE =\n /^\\s*CREATE\\s+(?:UNIQUE\\s+)?INDEX(?:\\s+IF\\s+(?:NOT\\s+)?EXISTS)?\\s+[^\\s(,;)]+\\s+ON\\s+(?<table>[^\\s(,;)]+)/i;\n\nfunction isCloudflareInternalTable(table: string, allowlist?: Array<string | RegExp>): boolean {\n if (!table.toLowerCase().startsWith('cf_')) {\n return false;\n }\n\n // A table on the allowlist is treated as a user table and stays instrumented, even though it\n // matches the reserved prefix.\n return !allowlist?.length || !stringMatchesSomePattern(table, allowlist, true);\n}\n"],"names":[],"mappings":";;AAoBO,SAAS,8BAAA,CACd,YAAA,EACA,SAAA,EACA,SAAA,EACS;AACT,EAAA,IAAI,CAAC,YAAA,EAAc;AACjB,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAM,YAAA,GAAe,YAAY,qBAAA,CAAsB,IAAA,CAAK,SAAS,CAAA,EAAG,MAAA,GAAS,OAAO,CAAA,GAAI,MAAA;AAC5F,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,OAAO,yBAAA,CAA0B,cAAc,SAAS,CAAA;AAAA,EAC1D;AAEA,EAAA,MAAM,GAAG,GAAG,MAAM,CAAA,GAAI,YAAA,CAAa,MAAM,GAAG,CAAA;AAE5C,EAAA,OAAO,OAAO,IAAA,CAAK,CAAA,KAAA,KAAS,yBAAA,CAA0B,KAAA,EAAO,SAAS,CAAC,CAAA;AACzE;AAIA,MAAM,qBAAA,GACJ,0GAAA;AAEF,SAAS,yBAAA,CAA0B,OAAe,SAAA,EAA6C;AAC7F,EAAA,IAAI,CAAC,KAAA,CAAM,WAAA,EAAY,CAAE,UAAA,CAAW,KAAK,CAAA,EAAG;AAC1C,IAAA,OAAO,KAAA;AAAA,EACT;AAIA,EAAA,OAAO,CAAC,SAAA,EAAW,MAAA,IAAU,CAAC,wBAAA,CAAyB,KAAA,EAAO,WAAW,IAAI,CAAA;AAC/E;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { stringMatchesSomePattern } from '@sentry/core';
|
|
2
|
+
|
|
3
|
+
function targetsCloudflareInternalKey(key, allowlist) {
|
|
4
|
+
if (!key) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
const isFrameworkKey = key.startsWith("cf_") || key.startsWith("cf:") || key.startsWith("__ps_") || key.startsWith("/");
|
|
8
|
+
if (!isFrameworkKey) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
return !allowlist?.length || !stringMatchesSomePattern(key, allowlist, true);
|
|
12
|
+
}
|
|
13
|
+
function getStorageKeys(methodName, args) {
|
|
14
|
+
const [first] = args;
|
|
15
|
+
if (methodName === "get" || methodName === "delete") {
|
|
16
|
+
if (typeof first === "string") {
|
|
17
|
+
return [first];
|
|
18
|
+
}
|
|
19
|
+
if (Array.isArray(first)) {
|
|
20
|
+
return first.filter((k) => typeof k === "string");
|
|
21
|
+
}
|
|
22
|
+
return void 0;
|
|
23
|
+
}
|
|
24
|
+
if (methodName === "put") {
|
|
25
|
+
if (typeof first === "string") {
|
|
26
|
+
return [first];
|
|
27
|
+
}
|
|
28
|
+
if (first && typeof first === "object" && !Array.isArray(first)) {
|
|
29
|
+
return Object.keys(first);
|
|
30
|
+
}
|
|
31
|
+
return void 0;
|
|
32
|
+
}
|
|
33
|
+
if (methodName === "list") {
|
|
34
|
+
const prefix = first && typeof first === "object" ? first.prefix : void 0;
|
|
35
|
+
return typeof prefix === "string" ? [prefix] : void 0;
|
|
36
|
+
}
|
|
37
|
+
return void 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { getStorageKeys, targetsCloudflareInternalKey };
|
|
41
|
+
//# sourceMappingURL=internalStorageKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internalStorageKey.js","sources":["../../../../src/utils/internalStorageKey.ts"],"sourcesContent":["import { stringMatchesSomePattern } from '@sentry/core';\n\n/**\n * Cloudflare frameworks that build on Durable Objects (`agents`, `partyserver`, ...) also manage\n * their own internal KV entries alongside their internal SQLite tables, namespaced with a reserved\n * prefix — e.g. `cf_agents_state`, `cf_agents_mcp_servers`, `__ps_name`. Reads/writes of these\n * (message persistence, MCP connection bookkeeping, name hydration) are framework implementation\n * details that otherwise flood traces with dozens of zero-signal `durable_object_storage_*` spans\n * per request, so we match the reserved prefixes rather than an enumerated list. This mirrors the\n * `cf_` convention used for internal SQL tables (see `targetsCloudflareInternalTable`).\n *\n * The prefixes are a reserved convention for framework-managed entries, so user keys should not use\n * them. In case a user key does collide, the `durableObjectStorageSpanAllowlist` option lets them\n * opt those keys back into instrumentation.\n */\nexport function targetsCloudflareInternalKey(key: string | undefined, allowlist?: Array<string | RegExp>): boolean {\n if (!key) {\n return false;\n }\n\n // Framework-managed KV namespaces:\n // - `cf_` — agents / ai-chat internal state (mirrors the internal SQL table convention)\n // - `cf:` — agents chat-recovery entries (`cf:chat-recovery:*`, `cf:chat:*`); the same reserved\n // `cf` namespace, but colon-separated instead of underscore-separated\n // - `__ps_` — partyserver internals (e.g. `__ps_name`)\n // - `/` — MCP OAuth client state (`/<clientName>/<serverId>/{token,client_info,state,...}`),\n // read on every MCP tool call. User keys on an Agent rarely use a leading slash; if one does,\n // the allowlist opts it back in.\n const isFrameworkKey =\n key.startsWith('cf_') || key.startsWith('cf:') || key.startsWith('__ps_') || key.startsWith('/');\n if (!isFrameworkKey) {\n return false;\n }\n\n // A key on the allowlist is treated as a user key and stays instrumented, even though it matches\n // a reserved prefix.\n return !allowlist?.length || !stringMatchesSomePattern(key, allowlist, true);\n}\n\n/**\n * Extracts the KV keys a Durable Object storage call targets, so the caller can decide whether the\n * operation only touches framework-internal entries. Returns `undefined` when the keys can't be\n * determined from the arguments (e.g. `list()` without a prefix), in which case the call is treated\n * as user work and stays instrumented.\n */\nexport function getStorageKeys(methodName: string, args: unknown[]): string[] | undefined {\n const [first] = args;\n\n if (methodName === 'get' || methodName === 'delete') {\n // get(key) / get(keys[]) / delete(key) / delete(keys[])\n if (typeof first === 'string') {\n return [first];\n }\n if (Array.isArray(first)) {\n return first.filter((k): k is string => typeof k === 'string');\n }\n return undefined;\n }\n\n if (methodName === 'put') {\n // put(key, value) or put({ key: value, ... })\n if (typeof first === 'string') {\n return [first];\n }\n if (first && typeof first === 'object' && !Array.isArray(first)) {\n return Object.keys(first);\n }\n return undefined;\n }\n\n if (methodName === 'list') {\n // list({ prefix })\n const prefix = first && typeof first === 'object' ? (first as { prefix?: unknown }).prefix : undefined;\n return typeof prefix === 'string' ? [prefix] : undefined;\n }\n\n return undefined;\n}\n"],"names":[],"mappings":";;AAeO,SAAS,4BAAA,CAA6B,KAAyB,SAAA,EAA6C;AACjH,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA,OAAO,KAAA;AAAA,EACT;AAUA,EAAA,MAAM,cAAA,GACJ,GAAA,CAAI,UAAA,CAAW,KAAK,KAAK,GAAA,CAAI,UAAA,CAAW,KAAK,CAAA,IAAK,IAAI,UAAA,CAAW,OAAO,CAAA,IAAK,GAAA,CAAI,WAAW,GAAG,CAAA;AACjG,EAAA,IAAI,CAAC,cAAA,EAAgB;AACnB,IAAA,OAAO,KAAA;AAAA,EACT;AAIA,EAAA,OAAO,CAAC,SAAA,EAAW,MAAA,IAAU,CAAC,wBAAA,CAAyB,GAAA,EAAK,WAAW,IAAI,CAAA;AAC7E;AAQO,SAAS,cAAA,CAAe,YAAoB,IAAA,EAAuC;AACxF,EAAA,MAAM,CAAC,KAAK,CAAA,GAAI,IAAA;AAEhB,EAAA,IAAI,UAAA,KAAe,KAAA,IAAS,UAAA,KAAe,QAAA,EAAU;AAEnD,IAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,MAAA,OAAO,CAAC,KAAK,CAAA;AAAA,IACf;AACA,IAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxB,MAAA,OAAO,MAAM,MAAA,CAAO,CAAC,CAAA,KAAmB,OAAO,MAAM,QAAQ,CAAA;AAAA,IAC/D;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,IAAI,eAAe,KAAA,EAAO;AAExB,IAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,MAAA,OAAO,CAAC,KAAK,CAAA;AAAA,IACf;AACA,IAAA,IAAI,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,IAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AAC/D,MAAA,OAAO,MAAA,CAAO,KAAK,KAAK,CAAA;AAAA,IAC1B;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,IAAI,eAAe,MAAA,EAAQ;AAEzB,IAAA,MAAM,SAAS,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,GAAY,MAA+B,MAAA,GAAS,MAAA;AAC7F,IAAA,OAAO,OAAO,MAAA,KAAW,QAAA,GAAW,CAAC,MAAM,CAAA,GAAI,MAAA;AAAA,EACjD;AAEA,EAAA,OAAO,MAAA;AACT;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getIsolationScope, getDefaultIsolationScope, withIsolationScope } from '@sentry/core';
|
|
2
|
+
|
|
3
|
+
function withInvocationIsolationScope(callback) {
|
|
4
|
+
const isolationScope = getIsolationScope();
|
|
5
|
+
const newIsolationScope = isolationScope === getDefaultIsolationScope() ? isolationScope.clone() : isolationScope;
|
|
6
|
+
return withIsolationScope(newIsolationScope, () => callback(newIsolationScope));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { withInvocationIsolationScope };
|
|
10
|
+
//# sourceMappingURL=invocationScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invocationScope.js","sources":["../../../../src/utils/invocationScope.ts"],"sourcesContent":["import { getDefaultIsolationScope, getIsolationScope, type Scope, withIsolationScope } from '@sentry/core';\n\n/**\n * Runs `callback` on the isolation scope for the current invocation.\n *\n * An instrumented handler is either the entry point of an invocation or reentrant — reached from\n * another instrumented handler already serving the same invocation (a Durable Object method calling\n * its own `fetch`, an RPC method reaching a sibling method). Only the entry point may fork:\n *\n * - Forking at the entry point is mandatory. `setUser`/`setTag` write to the isolation scope, and a\n * Durable Object's isolation scope outlives the invocation that touched it, so without a fork one\n * invocation's user and tags reappear on the next invocation's events in the same isolate.\n * Forking clones, so request data set by an enclosing wrapper is still inherited.\n * - Forking again when reentrant would be wrong. Everything below the entry point is one logical\n * unit of work: a nested call must see what the caller set and be able to add to it, the way it\n * would if the SDK were not wrapping it at all.\n *\n * The AsyncLocalStorage strategy hands the default isolation scope back whenever no invocation is in\n * flight, and a forked one while inside `withIsolationScope`. Reference-comparing against the default\n * is therefore enough to tell the two cases apart. The stack fallback does not fork, so it reports the\n * default scope even inside an invocation; there the fork degrades to a no-op, which the stack strategy\n * tolerates. This matches the approach used by `patchEventHandler` in Nuxt.\n */\nexport function withInvocationIsolationScope<T>(callback: (scope: Scope) => T): T {\n const isolationScope = getIsolationScope();\n\n const newIsolationScope = isolationScope === getDefaultIsolationScope() ? isolationScope.clone() : isolationScope;\n\n return withIsolationScope(newIsolationScope, () => callback(newIsolationScope));\n}\n"],"names":[],"mappings":";;AAuBO,SAAS,6BAAgC,QAAA,EAAkC;AAChF,EAAA,MAAM,iBAAiB,iBAAA,EAAkB;AAEzC,EAAA,MAAM,oBAAoB,cAAA,KAAmB,wBAAA,EAAyB,GAAI,cAAA,CAAe,OAAM,GAAI,cAAA;AAEnG,EAAA,OAAO,kBAAA,CAAmB,iBAAA,EAAmB,MAAM,QAAA,CAAS,iBAAiB,CAAC,CAAA;AAChF;;;;"}
|