@sentry/cloudflare 10.66.0 → 10.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/build/cjs/client.js.map +1 -1
  2. package/build/cjs/defineCloudflareOptions.js +11 -0
  3. package/build/cjs/defineCloudflareOptions.js.map +1 -0
  4. package/build/cjs/durableobject.js +19 -9
  5. package/build/cjs/durableobject.js.map +1 -1
  6. package/build/cjs/index.js +3 -0
  7. package/build/cjs/index.js.map +1 -1
  8. package/build/cjs/instrumentations/instrumentSqlStorage.js +5 -0
  9. package/build/cjs/instrumentations/instrumentSqlStorage.js.map +1 -1
  10. package/build/cjs/instrumentations/instrumentWorkerEntrypoint.js +89 -8
  11. package/build/cjs/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
  12. package/build/cjs/instrumentations/worker/instrumentEnv.js +12 -0
  13. package/build/cjs/instrumentations/worker/instrumentEnv.js.map +1 -1
  14. package/build/cjs/instrumentations/worker/instrumentRateLimit.js +29 -0
  15. package/build/cjs/instrumentations/worker/instrumentRateLimit.js.map +1 -0
  16. package/build/cjs/integrations/tracing/vercelai.js.map +1 -1
  17. package/build/cjs/nodejs_compat/index.js +5 -2
  18. package/build/cjs/nodejs_compat/index.js.map +1 -1
  19. package/build/cjs/nodejs_compat/integrations/tracing/vercelai.js.map +1 -1
  20. package/build/cjs/sdk.js +12 -1
  21. package/build/cjs/sdk.js.map +1 -1
  22. package/build/cjs/utils/internalSqlQuery.js +19 -0
  23. package/build/cjs/utils/internalSqlQuery.js.map +1 -0
  24. package/build/cjs/utils/isBinding.js +8 -0
  25. package/build/cjs/utils/isBinding.js.map +1 -1
  26. package/build/cjs/vite/autoInstrument.js +81 -0
  27. package/build/cjs/vite/autoInstrument.js.map +1 -0
  28. package/build/cjs/vite/index.js +14 -0
  29. package/build/cjs/vite/index.js.map +1 -0
  30. package/build/cjs/vite/instrumentFile.js +31 -0
  31. package/build/cjs/vite/instrumentFile.js.map +1 -0
  32. package/build/cjs/vite/transform.js +144 -0
  33. package/build/cjs/vite/transform.js.map +1 -0
  34. package/build/cjs/vite/workerEntrypoint.js +66 -0
  35. package/build/cjs/vite/workerEntrypoint.js.map +1 -0
  36. package/build/cjs/vite/wranglerConfig.js +54 -0
  37. package/build/cjs/vite/wranglerConfig.js.map +1 -0
  38. package/build/cjs/wrapMethodWithSentry.js +4 -4
  39. package/build/cjs/wrapMethodWithSentry.js.map +1 -1
  40. package/build/esm/client.js.map +1 -1
  41. package/build/esm/defineCloudflareOptions.js +9 -0
  42. package/build/esm/defineCloudflareOptions.js.map +1 -0
  43. package/build/esm/durableobject.js +19 -9
  44. package/build/esm/durableobject.js.map +1 -1
  45. package/build/esm/index.js +2 -1
  46. package/build/esm/index.js.map +1 -1
  47. package/build/esm/instrumentations/instrumentSqlStorage.js +6 -1
  48. package/build/esm/instrumentations/instrumentSqlStorage.js.map +1 -1
  49. package/build/esm/instrumentations/instrumentWorkerEntrypoint.js +89 -8
  50. package/build/esm/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
  51. package/build/esm/instrumentations/worker/instrumentEnv.js +14 -2
  52. package/build/esm/instrumentations/worker/instrumentEnv.js.map +1 -1
  53. package/build/esm/instrumentations/worker/instrumentRateLimit.js +27 -0
  54. package/build/esm/instrumentations/worker/instrumentRateLimit.js.map +1 -0
  55. package/build/esm/integrations/tracing/vercelai.js.map +1 -1
  56. package/build/esm/nodejs_compat/index.js +3 -2
  57. package/build/esm/nodejs_compat/index.js.map +1 -1
  58. package/build/esm/nodejs_compat/integrations/tracing/vercelai.js.map +1 -1
  59. package/build/esm/package.json +1 -1
  60. package/build/esm/sdk.js +13 -2
  61. package/build/esm/sdk.js.map +1 -1
  62. package/build/esm/utils/internalSqlQuery.js +17 -0
  63. package/build/esm/utils/internalSqlQuery.js.map +1 -0
  64. package/build/esm/utils/isBinding.js +7 -1
  65. package/build/esm/utils/isBinding.js.map +1 -1
  66. package/build/esm/vite/autoInstrument.js +79 -0
  67. package/build/esm/vite/autoInstrument.js.map +1 -0
  68. package/build/esm/vite/index.js +12 -0
  69. package/build/esm/vite/index.js.map +1 -0
  70. package/build/esm/vite/instrumentFile.js +27 -0
  71. package/build/esm/vite/instrumentFile.js.map +1 -0
  72. package/build/esm/vite/transform.js +142 -0
  73. package/build/esm/vite/transform.js.map +1 -0
  74. package/build/esm/vite/workerEntrypoint.js +64 -0
  75. package/build/esm/vite/workerEntrypoint.js.map +1 -0
  76. package/build/esm/vite/wranglerConfig.js +52 -0
  77. package/build/esm/vite/wranglerConfig.js.map +1 -0
  78. package/build/esm/wrapMethodWithSentry.js +5 -5
  79. package/build/esm/wrapMethodWithSentry.js.map +1 -1
  80. package/build/types/client.d.ts +31 -2
  81. package/build/types/client.d.ts.map +1 -1
  82. package/build/types/defineCloudflareOptions.d.ts +38 -0
  83. package/build/types/defineCloudflareOptions.d.ts.map +1 -0
  84. package/build/types/durableobject.d.ts.map +1 -1
  85. package/build/types/index.d.ts +2 -1
  86. package/build/types/index.d.ts.map +1 -1
  87. package/build/types/instrumentations/instrumentSqlStorage.d.ts.map +1 -1
  88. package/build/types/instrumentations/instrumentWorkerEntrypoint.d.ts +3 -3
  89. package/build/types/instrumentations/instrumentWorkerEntrypoint.d.ts.map +1 -1
  90. package/build/types/instrumentations/worker/instrumentEnv.d.ts +2 -0
  91. package/build/types/instrumentations/worker/instrumentEnv.d.ts.map +1 -1
  92. package/build/types/instrumentations/worker/instrumentRateLimit.d.ts +6 -0
  93. package/build/types/instrumentations/worker/instrumentRateLimit.d.ts.map +1 -0
  94. package/build/types/integrations/tracing/vercelai.d.ts.map +1 -1
  95. package/build/types/nodejs_compat/index.d.ts +1 -1
  96. package/build/types/nodejs_compat/index.d.ts.map +1 -1
  97. package/build/types/nodejs_compat/integrations/tracing/vercelai.d.ts +1 -8
  98. package/build/types/nodejs_compat/integrations/tracing/vercelai.d.ts.map +1 -1
  99. package/build/types/sdk.d.ts.map +1 -1
  100. package/build/types/utils/internalSqlQuery.d.ts +18 -0
  101. package/build/types/utils/internalSqlQuery.d.ts.map +1 -0
  102. package/build/types/utils/isBinding.d.ts +14 -1
  103. package/build/types/utils/isBinding.d.ts.map +1 -1
  104. package/build/types/vite/autoInstrument.d.ts +21 -0
  105. package/build/types/vite/autoInstrument.d.ts.map +1 -0
  106. package/build/types/vite/index.d.ts +88 -0
  107. package/build/types/vite/index.d.ts.map +1 -0
  108. package/build/types/vite/instrumentFile.d.ts +22 -0
  109. package/build/types/vite/instrumentFile.d.ts.map +1 -0
  110. package/build/types/vite/transform.d.ts +60 -0
  111. package/build/types/vite/transform.d.ts.map +1 -0
  112. package/build/types/vite/workerEntrypoint.d.ts +12 -0
  113. package/build/types/vite/workerEntrypoint.d.ts.map +1 -0
  114. package/build/types/vite/wranglerConfig.d.ts +43 -0
  115. package/build/types/vite/wranglerConfig.d.ts.map +1 -0
  116. package/build/types/wrapMethodWithSentry.d.ts +5 -0
  117. package/build/types/wrapMethodWithSentry.d.ts.map +1 -1
  118. package/build/types-ts3.8/client.d.ts +31 -2
  119. package/build/types-ts3.8/defineCloudflareOptions.d.ts +38 -0
  120. package/build/types-ts3.8/index.d.ts +2 -1
  121. package/build/types-ts3.8/instrumentations/instrumentWorkerEntrypoint.d.ts +3 -3
  122. package/build/types-ts3.8/instrumentations/worker/instrumentEnv.d.ts +2 -0
  123. package/build/types-ts3.8/instrumentations/worker/instrumentRateLimit.d.ts +6 -0
  124. package/build/types-ts3.8/nodejs_compat/index.d.ts +1 -1
  125. package/build/types-ts3.8/nodejs_compat/integrations/tracing/vercelai.d.ts +7 -14
  126. package/build/types-ts3.8/utils/internalSqlQuery.d.ts +18 -0
  127. package/build/types-ts3.8/utils/isBinding.d.ts +14 -1
  128. package/build/types-ts3.8/vite/autoInstrument.d.ts +21 -0
  129. package/build/types-ts3.8/vite/index.d.ts +88 -0
  130. package/build/types-ts3.8/vite/instrumentFile.d.ts +22 -0
  131. package/build/types-ts3.8/vite/transform.d.ts +60 -0
  132. package/build/types-ts3.8/vite/workerEntrypoint.d.ts +12 -0
  133. package/build/types-ts3.8/vite/wranglerConfig.d.ts +43 -0
  134. package/build/types-ts3.8/wrapMethodWithSentry.d.ts +5 -0
  135. package/package.json +19 -5
@@ -30,7 +30,7 @@
30
30
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
31
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
32
  */
33
- import type { D1Database, DurableObjectNamespace, Queue, R2Bucket } from '@cloudflare/workers-types';
33
+ import type { Ai, D1Database, DurableObjectNamespace, Queue, R2Bucket, RateLimit } from '@cloudflare/workers-types';
34
34
  /**
35
35
  * Checks if a value is a JSRPC proxy (service binding).
36
36
  *
@@ -56,9 +56,22 @@ export declare function isQueue(item: unknown): item is Queue;
56
56
  * D1Database has `prepare`, `batch`, and `exec` methods.
57
57
  */
58
58
  export declare function isD1Database(item: unknown): item is D1Database;
59
+ /**
60
+ * Duck-type check for Workers AI bindings.
61
+ * The Ai binding has `run`, `gateway`, and `toMarkdown` methods.
62
+ */
63
+ export declare function isAiBinding(item: unknown): item is Ai;
59
64
  /**
60
65
  * Duck-type check for R2 Bucket bindings.
61
66
  * R2Bucket has `head`, `put`, and `createMultipartUpload` methods.
62
67
  */
63
68
  export declare function isR2Bucket(item: unknown): item is R2Bucket;
69
+ /**
70
+ * Duck-type check for RateLimit bindings.
71
+ * RateLimit only exposes a single `limit` method. Because that is a fairly
72
+ * common method name, this check is intentionally run after the more specific
73
+ * binding checks (Queue, R2, D1) in `instrumentEnv`, so those win when a binding
74
+ * also happens to expose `limit`.
75
+ */
76
+ export declare function isRateLimit(item: unknown): item is RateLimit;
64
77
  //# sourceMappingURL=isBinding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isBinding.d.ts","sourceRoot":"","sources":["../../../src/utils/isBinding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,sBAAsB,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErG;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,OAAO,CAMtD;AAID;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,sBAAsB,CAEtF;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,KAAK,CAEpD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,UAAU,CAQ9D;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,QAAQ,CAQ1D"}
1
+ {"version":3,"file":"isBinding.d.ts","sourceRoot":"","sources":["../../../src/utils/isBinding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,UAAU,EAAE,sBAAsB,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEpH;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,OAAO,CAMtD;AAID;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,sBAAsB,CAEtF;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,KAAK,CAEpD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,UAAU,CAQ9D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,EAAE,CAQrD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,QAAQ,CAQ1D;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,SAAS,CAE5D"}
@@ -0,0 +1,21 @@
1
+ import { type ProgramBody } from './transform';
2
+ export declare function sentryCloudflareAutoInstrumentPlugin(): {
3
+ name: string;
4
+ configResolved(config: {
5
+ root: string;
6
+ logger?: {
7
+ warn(msg: string): void;
8
+ };
9
+ }): void;
10
+ transform(this: {
11
+ parse(code: string): ProgramBody;
12
+ warn?(msg: string): void;
13
+ environment?: {
14
+ name?: string;
15
+ };
16
+ }, code: string, id: string): {
17
+ code: string;
18
+ map: unknown;
19
+ } | undefined;
20
+ };
21
+ //# sourceMappingURL=autoInstrument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autoInstrument.d.ts","sourceRoot":"","sources":["../../../src/vite/autoInstrument.ts"],"names":[],"mappings":"AACA,OAAO,EAAwD,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAcrG,wBAAgB,oCAAoC;;2BAUzB;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,CAAA;KAAE,GAAG,IAAI;oBAyB5E;QAAE,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;QAAC,IAAI,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,WAAW,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,QAC/F,MAAM,MACR,MAAM,GACT;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS;EA6DhD"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Options for {@link sentryCloudflareVitePlugin}.
3
+ */
4
+ export interface SentryCloudflareVitePluginOptions {
5
+ /**
6
+ * Experimental options that may change or be removed without notice.
7
+ */
8
+ _experimental?: {
9
+ /**
10
+ * Enables build-time automatic instrumentation of supported dependencies
11
+ * (e.g. database clients like `mysql`) so the Sentry Cloudflare SDK can
12
+ * trace them without monkey-patching, which wouldn't work in workerd anyway.
13
+ *
14
+ * When enabled, the plugin injects `diagnostics_channel.tracingChannel`
15
+ * calls into the bundled packages and, next to each, a snippet that
16
+ * registers the matching Sentry channel-subscriber factory on the global
17
+ * marker, which the SDK picks up in `Sentry.withSentry()`. Both `vite build`
18
+ * and `vite dev` are instrumented.
19
+ *
20
+ * @default false
21
+ * @experimental May change or be removed in any release.
22
+ */
23
+ useDiagnosticsChannelInjection?: boolean;
24
+ /**
25
+ * Automatically wraps your Worker at build time so you don't have to edit
26
+ * your entry: the plugin reads your wrangler config, wraps the default
27
+ * export with `Sentry.withSentry()` (sourcing options from a co-located
28
+ * `instrument.*` file, falling back to env), and wraps any configured
29
+ * Durable Object class with `instrumentDurableObjectWithSentry`. Both
30
+ * `vite build` and `vite dev` are instrumented.
31
+ *
32
+ * @default false
33
+ * @experimental May change or be removed in any release.
34
+ */
35
+ autoInstrumentation?: boolean;
36
+ };
37
+ }
38
+ /**
39
+ * Sentry Vite plugin for Cloudflare Workers.
40
+ *
41
+ * Add this plugin to your Vite configuration to enable additional Sentry
42
+ * instrumentation for Cloudflare Workers built with Vite. Configure the Sentry
43
+ * SDK in your Worker as usual with `Sentry.withSentry()`.
44
+ *
45
+ * Currently, the only functionality is the experimental
46
+ * `_experimental.useDiagnosticsChannelInjection` option, which traces supported
47
+ * dependencies (such as database clients) without changing your application
48
+ * code. Without it, the plugin is a no-op.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * // vite.config.ts
53
+ * import { cloudflare } from '@cloudflare/vite-plugin';
54
+ * import { sentryCloudflareVitePlugin } from '@sentry/cloudflare/vite';
55
+ * import { defineConfig } from 'vite';
56
+ *
57
+ * export default defineConfig({
58
+ * plugins: [
59
+ * cloudflare(),
60
+ * sentryCloudflareVitePlugin({
61
+ * _experimental: {
62
+ * useDiagnosticsChannelInjection: true,
63
+ * },
64
+ * }),
65
+ * ],
66
+ * });
67
+ * ```
68
+ */
69
+ export declare function sentryCloudflareVitePlugin(options?: SentryCloudflareVitePluginOptions): ({
70
+ name: string;
71
+ configResolved(config: {
72
+ root: string;
73
+ logger?: {
74
+ warn(msg: string): void;
75
+ };
76
+ }): void;
77
+ transform(this: {
78
+ parse(code: string): import("./transform").ProgramBody;
79
+ warn?(msg: string): void;
80
+ environment?: {
81
+ name?: string;
82
+ };
83
+ }, code: string, id: string): {
84
+ code: string;
85
+ map: unknown;
86
+ } | undefined;
87
+ } | import("vite").Plugin<any>)[];
88
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vite/index.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD;;OAEG;IACH,aAAa,CAAC,EAAE;QACd;;;;;;;;;;;;;WAaG;QACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;QACzC;;;;;;;;;;WAUG;QACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;KAC/B,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,GAAE,iCAAsC;;;;cAvDpC,CAAC;;;;;;YAoB7B,CAAA;mBAKf,CAAC;gBAAQ,CAAC;;;;;;kCAqCpB"}
@@ -0,0 +1,22 @@
1
+ export declare const ENV_FALLBACK_OPTIONS_FN = "() => undefined";
2
+ /**
3
+ * Locate the conventional `instrument.server.*` module sitting next to the
4
+ * worker entry file. Returns its absolute path, or `undefined` when absent.
5
+ */
6
+ export declare function resolveInstrumentFile(entryFilePath: string): string | undefined;
7
+ /**
8
+ * Build the `optionsFn` reference and `import` statement for the instrument
9
+ * module whose **default export** is the options callback
10
+ * `(env) => CloudflareOptions`.
11
+ *
12
+ * The import is emitted relative to `entryFilePath` because it is injected into
13
+ * the entry file's source. The file extension is kept: extensionless specifiers
14
+ * only resolve for extensions in Vite's default `resolve.extensions` (which
15
+ * excludes `.cjs`), and keeping it makes our probe order authoritative when
16
+ * several `instrument.server.*` files coexist.
17
+ */
18
+ export declare function buildOptionsImport(entryFilePath: string, instrumentFilePath: string): {
19
+ optionsFn: string;
20
+ importStmt: string;
21
+ };
22
+ //# sourceMappingURL=instrumentFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentFile.d.ts","sourceRoot":"","sources":["../../../src/vite/instrumentFile.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,oBAAoB,CAAC;AAWzD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO/E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,MAAM,GACzB;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAQ3C"}
@@ -0,0 +1,60 @@
1
+ import MagicString from 'magic-string';
2
+ export interface BaseNode {
3
+ type: string;
4
+ start: number;
5
+ end: number;
6
+ }
7
+ export interface ProgramBody {
8
+ body: BaseNode[];
9
+ }
10
+ /**
11
+ * The kind of Sentry wrapper to apply to an exported class.
12
+ *
13
+ * `durableObject` and `workflow` are keyed by name from the wrangler config
14
+ * (`durable_objects.bindings`, `workflows`), since those class names are
15
+ * authoritative there. `workerEntrypoint` is different: a worker's own
16
+ * entrypoints aren't enumerated in its config, so they're detected structurally
17
+ * (a class extending `WorkerEntrypoint` from `cloudflare:workers`), with the
18
+ * config providing only a fallback for self-bound entrypoints whose base class
19
+ * lives in another module.
20
+ */
21
+ export type ClassWrapperKind = 'durableObject' | 'workflow' | 'workerEntrypoint';
22
+ export interface TransformContext {
23
+ /**
24
+ * Exported class name → the kind of Sentry wrapper to apply. Populated from
25
+ * the wrangler config, so the transform can wrap by name without resolving
26
+ * each class's base type.
27
+ */
28
+ classWrappers: Map<string, ClassWrapperKind>;
29
+ optionsFn: string;
30
+ /** Import statement prepended when `optionsFn` references a separate module. */
31
+ optionsImport?: string;
32
+ }
33
+ export interface TransformResult {
34
+ code: string;
35
+ map: ReturnType<MagicString['generateMap']>;
36
+ /**
37
+ * The configured class names that were actually wrapped. Lets the plugin warn
38
+ * about configured classes it could not find, instead of silently leaving
39
+ * them uninstrumented.
40
+ */
41
+ wrappedClasses: Set<string>;
42
+ }
43
+ /**
44
+ * Rewrite the worker entry source to wrap its default export with `withSentry`
45
+ * and any configured class export with its matching Sentry wrapper (see
46
+ * {@link TransformContext.classWrappers}, e.g. Durable Object classes with
47
+ * `instrumentDurableObjectWithSentry`).
48
+ *
49
+ * Handles both `export class MyDO {}` and the specifier form
50
+ * (`class MyDO {}` … `export { MyDO }` / `export { Foo as MyDO }`).
51
+ * Re-exports from other modules (`export { MyDO } from './do'`) cannot be
52
+ * wrapped here and are left alone — the plugin warns about them via
53
+ * {@link TransformResult.wrappedClasses}.
54
+ *
55
+ * Exported (rather than inlined into the plugin) so it can be unit-tested with a
56
+ * plain AST and no Vite context. Returns `undefined` when nothing was wrapped and
57
+ * there are no already-manually-wrapped classes to report.
58
+ */
59
+ export declare function applyAutoInstrumentTransforms(code: string, ast: ProgramBody, ctx: TransformContext): TransformResult | undefined;
60
+ //# sourceMappingURL=transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/vite/transform.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,cAAc,CAAC;AAOvC,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,EAAE,CAAC;CAClB;AAuDD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG,UAAU,GAAG,kBAAkB,CAAC;AAajF,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,gFAAgF;IAChF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;IAC5C;;;;OAIG;IACH,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,gBAAgB,GACpB,eAAe,GAAG,SAAS,CA6C7B"}
@@ -0,0 +1,12 @@
1
+ import type { ProgramBody } from './transform';
2
+ /**
3
+ * Find top-level classes that (transitively, within this module) extend
4
+ * `WorkerEntrypoint` imported from `cloudflare:workers`. esbuild has already
5
+ * stripped TypeScript by transform time, so a superclass is a plain identifier
6
+ * (`extends WorkerEntrypoint`) or member access (`extends cf.WorkerEntrypoint`).
7
+ *
8
+ * Only same-file base chains are resolvable here; a base class imported from
9
+ * another module is invisible and relies on the config self-binding fallback.
10
+ */
11
+ export declare function detectWorkerEntrypointClasses(ast: ProgramBody): Set<string>;
12
+ //# sourceMappingURL=workerEntrypoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workerEntrypoint.d.ts","sourceRoot":"","sources":["../../../src/vite/workerEntrypoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,aAAa,CAAC;AA0CzD;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CA8B3E"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The slice of the wrangler configuration the auto-instrument plugin cares
3
+ * about. `main` is an absolute path (wrangler resolves it against the config
4
+ * file's directory).
5
+ */
6
+ export interface WranglerConfig {
7
+ main?: string;
8
+ durableObjects: Array<{
9
+ name: string;
10
+ className: string;
11
+ }>;
12
+ workflows: Array<{
13
+ name: string;
14
+ className: string;
15
+ }>;
16
+ /**
17
+ * Named `WorkerEntrypoint` exports this worker binds to itself via a service
18
+ * binding (`services[]` whose `service` is this worker's own `name`). Only
19
+ * self-bindings appear here: a service binding's `entrypoint` otherwise names
20
+ * an export on a *different* worker, which this build can't wrap.
21
+ */
22
+ workerEntrypoints: string[];
23
+ }
24
+ /**
25
+ * Locate and resolve the wrangler configuration via wrangler's own
26
+ * `unstable_readConfig` — the API `@cloudflare/vite-plugin` uses.
27
+ *
28
+ * We only locate the file (probing `wrangler.json`, `.jsonc`, `.toml` inside
29
+ * `root` with wrangler's own precedence, since it discovers from `cwd` rather
30
+ * than an arbitrary root); wrangler then parses it, flattens the active
31
+ * environment (honoring `CLOUDFLARE_ENV`), and resolves `main` to an absolute
32
+ * path. Durable Object and Workflow bindings are the active environment's,
33
+ * matching what the deployed Worker actually binds.
34
+ *
35
+ * Returns `undefined` when no config file is found or it can't be read/parsed
36
+ * (the caller warns and disables auto-instrumentation rather than failing the
37
+ * whole build).
38
+ */
39
+ export declare function resolveWranglerConfig(root: string, explicitPath?: string): {
40
+ config: WranglerConfig;
41
+ configDir: string;
42
+ } | undefined;
43
+ //# sourceMappingURL=wranglerConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wranglerConfig.d.ts","sourceRoot":"","sources":["../../../src/vite/wranglerConfig.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3D,SAAS,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtD;;;;;OAKG;IACH,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,MAAM,GACpB;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CA2B3D"}
@@ -20,6 +20,11 @@ type MethodWrapperOptions = {
20
20
  * @default false
21
21
  */
22
22
  startNewTrace?: boolean;
23
+ /**
24
+ * The trace origin identifying which instrumentation created the span, e.g. `auto.faas.cloudflare.durable_object`.
25
+ * Used both as the span's `sentry.origin` attribute and as the `mechanism.type` for captured exceptions.
26
+ */
27
+ origin: string;
23
28
  };
24
29
  export type UncheckedMethod = (...args: any[]) => any;
25
30
  type OriginalMethod = UncheckedMethod;
@@ -1 +1 @@
1
- {"version":3,"file":"wrapMethodWithSentry.d.ts","sourceRoot":"","sources":["../../src/wrapMethodWithSentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAgBtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAOlD,oFAAoF;AACpF,UAAU,8BAA+B,SAAQ,kBAAkB;IACjE,eAAe,CAAC,EAAE,oBAAoB,CAAC;CACxC;AAyBD,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,EAAE,gBAAgB,GAAG,8BAA8B,CAAC;IAC3D;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAGF,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AACtD,KAAK,cAAc,GAAG,eAAe,CAAC;AAEtC;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,cAAc,EAC3D,cAAc,EAAE,oBAAoB,EACpC,OAAO,EAAE,CAAC,EACV,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,EAC3C,MAAM,CAAC,EAAE,IAAI,GACZ,CAAC,CAuJH"}
1
+ {"version":3,"file":"wrapMethodWithSentry.d.ts","sourceRoot":"","sources":["../../src/wrapMethodWithSentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAgBtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAQlD,oFAAoF;AACpF,UAAU,8BAA+B,SAAQ,kBAAkB;IACjE,eAAe,CAAC,EAAE,oBAAoB,CAAC;CACxC;AAyBD,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,EAAE,gBAAgB,GAAG,8BAA8B,CAAC;IAC3D;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AACtD,KAAK,cAAc,GAAG,eAAe,CAAC;AAEtC;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,cAAc,EAC3D,cAAc,EAAE,oBAAoB,EACpC,OAAO,EAAE,CAAC,EACV,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,EAC3C,MAAM,CAAC,EAAE,IAAI,GACZ,CAAC,CA0JH"}
@@ -71,9 +71,9 @@ interface BaseCloudflareOptions {
71
71
  * When enabled, trace context (sentry-trace + baggage) is propagated across:
72
72
  * - `stub.fetch()` calls to Durable Objects (via HTTP headers)
73
73
  * - Service binding `fetch()` calls (via HTTP headers)
74
- * - RPC method calls to Durable Objects (via trailing argument)
74
+ * - RPC method calls to Durable Objects and WorkerEntrypoints (via trailing argument)
75
75
  *
76
- * When enabled on the **receiver side** (DurableObject), the SDK will also:
76
+ * When enabled on the **receiver side** (DurableObject or WorkerEntrypoint), the SDK will also:
77
77
  * - Extract and continue traces from incoming RPC calls
78
78
  * - Create spans for each RPC method invocation
79
79
  * - Capture errors thrown by RPC methods
@@ -100,9 +100,38 @@ interface BaseCloudflareOptions {
100
100
  * }),
101
101
  * MyDOBase,
102
102
  * );
103
+ *
104
+ * // WorkerEntrypoint side (receiver)
105
+ * export const MyEntrypoint = Sentry.withSentry(
106
+ * env => ({ dsn: env.SENTRY_DSN, enableRpcTracePropagation: true }),
107
+ * MyEntrypointBase,
108
+ * );
103
109
  * ```
104
110
  */
105
111
  enableRpcTracePropagation?: boolean;
112
+ /**
113
+ * Table names that should stay instrumented even though they match the reserved `cf_` prefix used
114
+ * by Durable Object frameworks (`agents`, `partyserver`, ...) for their internal SQLite tables.
115
+ *
116
+ * By default, `exec` queries against `cf_`-prefixed tables are treated as framework noise and no
117
+ * `db.query` span is created for them. If one of your own tables happens to use this prefix, add it
118
+ * here to opt it back into instrumentation. Entries are matched against each table name in the
119
+ * query summary — strings must match exactly, while regular expressions give you prefix/pattern
120
+ * matching.
121
+ *
122
+ * @default []
123
+ * @example
124
+ * ```ts
125
+ * export default Sentry.withSentry(
126
+ * (env) => ({
127
+ * dsn: env.SENTRY_DSN,
128
+ * durableObjectSqlSpanAllowlist: ['cf_my_table', /^cf_reports_/],
129
+ * }),
130
+ * handler,
131
+ * );
132
+ * ```
133
+ */
134
+ durableObjectSqlSpanAllowlist?: Array<string | RegExp>;
106
135
  /**
107
136
  * @deprecated Use `enableRpcTracePropagation` instead. This option will be removed in a future major version.
108
137
  *
@@ -0,0 +1,38 @@
1
+ import { env as cloudflareEnv } from 'cloudflare:workers';
2
+ import { CloudflareOptions } from './client';
3
+ /**
4
+ * Define the Sentry options for a Cloudflare Worker in a dedicated module.
5
+ *
6
+ * This is the recommended way to configure the SDK when using the Vite plugin's
7
+ * auto-instrumentation: place an `instrument.server.{ts,js,mjs}` file next to
8
+ * the worker entry whose **default export** is the result of this function. The
9
+ * plugin picks it up automatically and hands it to `withSentry`.
10
+ *
11
+ * Unlike Node's `Sentry.init(...)`, the options cannot be applied at module
12
+ * load time on Cloudflare: the DSN and other settings typically come from the
13
+ * per-request `env`, which only exists inside the handler. Pass a callback to
14
+ * read from `env`, or a static object when no `env` access is needed — either
15
+ * way you get full type-checking and autocomplete on {@link CloudflareOptions}.
16
+ *
17
+ * At runtime this is a thin pass-through; it only normalizes a static object
18
+ * into a callback so the plugin always imports a `(env) => options` function.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * // src/instrument.server.ts
23
+ * import { defineCloudflareOptions } from '@sentry/cloudflare';
24
+ *
25
+ * export default defineCloudflareOptions((env) => ({
26
+ * dsn: env.SENTRY_DSN,
27
+ * tracesSampleRate: 1.0,
28
+ * }));
29
+ * ```
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * // Static options — no `env` access needed
34
+ * export default defineCloudflareOptions({ tracesSampleRate: 1.0 });
35
+ * ```
36
+ */
37
+ export declare function defineCloudflareOptions<Env = typeof cloudflareEnv>(optionsOrCallback: CloudflareOptions | ((env: Env) => CloudflareOptions | undefined)): (env: Env) => CloudflareOptions | undefined;
38
+ //# sourceMappingURL=defineCloudflareOptions.d.ts.map
@@ -1,7 +1,8 @@
1
1
  export { Breadcrumb, BreadcrumbHint, PolymorphicRequest, RequestEventData, SdkInfo, Event, EventHint, ErrorEvent, Exception, FeatureFlagsIntegration, Session, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, Metric, ExclusiveEventHintOrCaptureContext, CaptureContext, } from '@sentry/core';
2
2
  export { CloudflareOptions } from './client';
3
- export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureFeedback, close, createTransport, lastEventId, flush, getClient, isInitialized, isEnabled, getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, Scope, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setAttribute, setAttributes, setUser, setConversationId, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, bindScopeToEmitter, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentAnthropicAiClient, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, instrumentPostgresJsSql, zodErrorsIntegration, consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToJSON, spanToTraceHeader, spanToBaggageHeader, updateSpanName, wrapMcpServerWithSentry, consoleLoggingIntegration, createConsolaReporter, createLangChainCallbackHandler, instrumentLangChainEmbeddings, featureFlagsIntegration, growthbookIntegration, logger, metrics, withStreamedSpan, spanStreamingIntegration, instrumentLangGraph, instrumentCreateReactAgent, } from '@sentry/core';
3
+ export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureFeedback, close, createTransport, lastEventId, flush, getClient, isInitialized, isEnabled, getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, Scope, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setAttribute, setAttributes, setUser, setConversationId, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, bindScopeToEmitter, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentAnthropicAiClient, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, instrumentPostgresJsSql, zodErrorsIntegration, consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToJSON, spanToTraceHeader, spanToBaggageHeader, updateSpanName, wrapMcpServerWithSentry, consoleLoggingIntegration, createConsolaReporter, createLangChainCallbackHandler, instrumentLangChainEmbeddings, featureFlagsIntegration, growthbookIntegration, logger, metrics, withStreamedSpan, spanStreamingIntegration, instrumentStateGraph, instrumentLangGraph, instrumentCreateReactAgent, } from '@sentry/core';
4
4
  export { withSentry } from './withSentry';
5
+ export { defineCloudflareOptions } from './defineCloudflareOptions';
5
6
  export { instrumentDurableObjectWithSentry } from './durableobject';
6
7
  export { sentryPagesPlugin } from './pages-plugin';
7
8
  export { wrapRequestHandler } from './request';
@@ -1,6 +1,6 @@
1
- import { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
1
+ import { WorkerEntrypoint } from 'cloudflare:workers';
2
2
  import { CloudflareOptions } from '../client';
3
- export type WorkerEntrypointConstructor<Env = typeof cloudflareEnv, Props = {}> = new (ctx: ExecutionContext, env: typeof cloudflareEnv) => InstanceType<typeof WorkerEntrypoint<Env, Props>>;
3
+ export type WorkerEntrypointConstructor<Env = unknown, Props = {}> = new (ctx: ExecutionContext, env: any) => InstanceType<typeof WorkerEntrypoint<Env, Props>>;
4
4
  /**
5
5
  * Instruments a WorkerEntrypoint class to capture errors and performance data.
6
6
  *
@@ -38,5 +38,5 @@ export type WorkerEntrypointConstructor<Env = typeof cloudflareEnv, Props = {}>
38
38
  * );
39
39
  * ```
40
40
  */
41
- export declare function instrumentWorkerEntrypoint<T extends WorkerEntrypointConstructor>(optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined, WorkerEntrypointClass: T): T;
41
+ export declare function instrumentWorkerEntrypoint<Env, Props, T extends InstanceType<typeof WorkerEntrypoint<Env, Props>>, C extends new (ctx: ExecutionContext, env: Env) => T>(optionsCallback: (env: Env) => CloudflareOptions | undefined, WorkerEntrypointClass: C): C;
42
42
  //# sourceMappingURL=instrumentWorkerEntrypoint.d.ts.map
@@ -8,6 +8,8 @@ import { CloudflareOptions } from '../../client';
8
8
  * - Service bindings / JSRPC proxies
9
9
  * - Queue producers (via `send` + `sendBatch` duck-typing)
10
10
  * - R2 Buckets (via `head` + `put` + `createMultipartUpload` duck-typing)
11
+ * - Rate limiters (via `limit` duck-typing)
12
+ * - Workers AI (via `run` + `gateway` + `toMarkdown` duck-typing)
11
13
  *
12
14
  * @param env - The Cloudflare env object to instrument
13
15
  * @param options - Optional CloudflareOptions to control RPC trace propagation
@@ -0,0 +1,6 @@
1
+ import { RateLimit } from '@cloudflare/workers-types';
2
+ /**
3
+ * Wraps a Cloudflare rate limiter binding to create a span on each `limit()` call.
4
+ */
5
+ export declare function instrumentRateLimit<T extends RateLimit>(rateLimit: T, bindingName: string): T;
6
+ //# sourceMappingURL=instrumentRateLimit.d.ts.map
@@ -1,4 +1,4 @@
1
1
  export * from '../index';
2
- export { prismaIntegration } from '@sentry/node';
2
+ export { prismaIntegration } from '@sentry/server-utils';
3
3
  export { vercelAIIntegration } from './integrations/tracing/vercelai';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,16 +1,10 @@
1
- /**
2
- * This is a copy of the Vercel AI integration from the Cloudflare SDK (src/integrations/tracing/vercelai.ts).
3
- *
4
- * The only difference is that it includes tracing channel support
5
- * because the default Vercel AI integration needs `nodejs_als`, while this one uses `nodejs_compat`.
6
- */
7
- interface VercelAiOptions {
8
- /**
9
- * Enable or disable truncation of recorded input messages.
10
- * Defaults to `true`.
11
- */
12
- enableTruncation?: boolean;
13
- }
1
+ /*
2
+ * This is a copy of the Vercel AI integration from the Cloudflare SDK (src/integrations/tracing/vercelai.ts).
3
+ *
4
+ * The only difference is that it includes tracing channel support
5
+ * because the default Vercel AI integration needs `nodejs_als`, while this one uses `nodejs_compat`.
6
+ */
7
+ import { VercelAiOptions } from '@sentry/server-utils';
14
8
  /**
15
9
  * Adds Sentry tracing instrumentation for the [ai](https://www.npmjs.com/package/ai) library.
16
10
  * This integration is not enabled by default, you need to manually add it.
@@ -40,5 +34,4 @@ interface VercelAiOptions {
40
34
  export declare const vercelAIIntegration: (options?: VercelAiOptions | undefined) => import("@sentry/core").Integration & {
41
35
  name: string;
42
36
  };
43
- export {};
44
37
  //# sourceMappingURL=vercelai.d.ts.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Cloudflare frameworks that build on Durable Objects (`agents`, `partyserver`, ...) manage their
3
+ * own internal SQLite tables, all namespaced with a `cf_` prefix — e.g. `cf_agents_schedules`,
4
+ * `cf_agent_state`, `cf_ai_chat_stream_chunks`. Queries against them (schedule polling, chat-stream
5
+ * persistence, state bookkeeping) are framework implementation details that otherwise flood traces
6
+ * with dozens of zero-signal `db.query` spans per request. The exact set of tables even varies
7
+ * between framework versions, so we match the reserved prefix rather than an enumerated list.
8
+ *
9
+ * The `cf_` prefix is a reserved convention for framework-managed tables, so user tables should not
10
+ * use it. In case a user table does collide with the prefix, the `durableObjectSqlSpanAllowlist`
11
+ * option lets them opt those tables back into instrumentation.
12
+ *
13
+ * The check operates on the query summary produced by `getSqlQuerySummary` (`{operation} {table} ...`,
14
+ * the same value used as the span name), so table targets are already isolated from the rest of the
15
+ * query.
16
+ */
17
+ export declare function targetsCloudflareInternalTable(querySummary: string | undefined, allowlist?: Array<string | RegExp>): boolean;
18
+ //# sourceMappingURL=internalSqlQuery.d.ts.map
@@ -30,7 +30,7 @@
30
30
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
31
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
32
  */
33
- import { D1Database, DurableObjectNamespace, Queue, R2Bucket } from '@cloudflare/workers-types';
33
+ import { Ai, D1Database, DurableObjectNamespace, Queue, R2Bucket, RateLimit } from '@cloudflare/workers-types';
34
34
  /**
35
35
  * Checks if a value is a JSRPC proxy (service binding).
36
36
  *
@@ -56,9 +56,22 @@ export declare function isQueue(item: unknown): item is Queue;
56
56
  * D1Database has `prepare`, `batch`, and `exec` methods.
57
57
  */
58
58
  export declare function isD1Database(item: unknown): item is D1Database;
59
+ /**
60
+ * Duck-type check for Workers AI bindings.
61
+ * The Ai binding has `run`, `gateway`, and `toMarkdown` methods.
62
+ */
63
+ export declare function isAiBinding(item: unknown): item is Ai;
59
64
  /**
60
65
  * Duck-type check for R2 Bucket bindings.
61
66
  * R2Bucket has `head`, `put`, and `createMultipartUpload` methods.
62
67
  */
63
68
  export declare function isR2Bucket(item: unknown): item is R2Bucket;
69
+ /**
70
+ * Duck-type check for RateLimit bindings.
71
+ * RateLimit only exposes a single `limit` method. Because that is a fairly
72
+ * common method name, this check is intentionally run after the more specific
73
+ * binding checks (Queue, R2, D1) in `instrumentEnv`, so those win when a binding
74
+ * also happens to expose `limit`.
75
+ */
76
+ export declare function isRateLimit(item: unknown): item is RateLimit;
64
77
  //# sourceMappingURL=isBinding.d.ts.map
@@ -0,0 +1,21 @@
1
+ import { ProgramBody } from './transform';
2
+ export declare function sentryCloudflareAutoInstrumentPlugin(): {
3
+ name: string;
4
+ configResolved(config: {
5
+ root: string;
6
+ logger?: {
7
+ warn(msg: string): void;
8
+ };
9
+ }): void;
10
+ transform(this: {
11
+ parse(code: string): ProgramBody;
12
+ warn?(msg: string): void;
13
+ environment?: {
14
+ name?: string;
15
+ };
16
+ }, code: string, id: string): {
17
+ code: string;
18
+ map: unknown;
19
+ } | undefined;
20
+ };
21
+ //# sourceMappingURL=autoInstrument.d.ts.map