@sentry/cloudflare 10.46.0 → 10.48.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.
- package/build/cjs/durableobject.js +29 -11
- package/build/cjs/durableobject.js.map +1 -1
- package/build/cjs/index.js +2 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/instrument.js +72 -8
- package/build/cjs/instrument.js.map +1 -1
- package/build/cjs/instrumentations/instrumentWorkerEntrypoint.js +101 -0
- package/build/cjs/instrumentations/instrumentWorkerEntrypoint.js.map +1 -0
- package/build/cjs/instrumentations/worker/instrumentEmail.js +14 -12
- package/build/cjs/instrumentations/worker/instrumentEmail.js.map +1 -1
- package/build/cjs/instrumentations/worker/instrumentFetch.js +35 -10
- package/build/cjs/instrumentations/worker/instrumentFetch.js.map +1 -1
- package/build/cjs/instrumentations/worker/instrumentQueue.js +35 -10
- package/build/cjs/instrumentations/worker/instrumentQueue.js.map +1 -1
- package/build/cjs/instrumentations/worker/instrumentScheduled.js +35 -13
- package/build/cjs/instrumentations/worker/instrumentScheduled.js.map +1 -1
- package/build/cjs/instrumentations/worker/instrumentTail.js +33 -10
- package/build/cjs/instrumentations/worker/instrumentTail.js.map +1 -1
- package/build/cjs/request.js +5 -6
- package/build/cjs/request.js.map +1 -1
- package/build/cjs/scope-utils.js.map +1 -1
- package/build/cjs/utils/isCloudflareClass.js +29 -0
- package/build/cjs/utils/isCloudflareClass.js.map +1 -0
- package/build/cjs/withSentry.js +31 -20
- package/build/cjs/withSentry.js.map +1 -1
- package/build/cjs/wrapMethodWithSentry.js +111 -111
- package/build/cjs/wrapMethodWithSentry.js.map +1 -1
- package/build/esm/durableobject.js +30 -12
- package/build/esm/durableobject.js.map +1 -1
- package/build/esm/index.js +1 -1
- package/build/esm/instrument.js +71 -8
- package/build/esm/instrument.js.map +1 -1
- package/build/esm/instrumentations/instrumentWorkerEntrypoint.js +99 -0
- package/build/esm/instrumentations/instrumentWorkerEntrypoint.js.map +1 -0
- package/build/esm/instrumentations/worker/instrumentEmail.js +15 -13
- package/build/esm/instrumentations/worker/instrumentEmail.js.map +1 -1
- package/build/esm/instrumentations/worker/instrumentFetch.js +36 -12
- package/build/esm/instrumentations/worker/instrumentFetch.js.map +1 -1
- package/build/esm/instrumentations/worker/instrumentQueue.js +36 -12
- package/build/esm/instrumentations/worker/instrumentQueue.js.map +1 -1
- package/build/esm/instrumentations/worker/instrumentScheduled.js +36 -15
- package/build/esm/instrumentations/worker/instrumentScheduled.js.map +1 -1
- package/build/esm/instrumentations/worker/instrumentTail.js +34 -12
- package/build/esm/instrumentations/worker/instrumentTail.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/request.js +5 -6
- package/build/esm/request.js.map +1 -1
- package/build/esm/scope-utils.js.map +1 -1
- package/build/esm/utils/isCloudflareClass.js +27 -0
- package/build/esm/utils/isCloudflareClass.js.map +1 -0
- package/build/esm/withSentry.js +32 -21
- package/build/esm/withSentry.js.map +1 -1
- package/build/esm/wrapMethodWithSentry.js +107 -107
- package/build/esm/wrapMethodWithSentry.js.map +1 -1
- package/build/types/durableobject.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/instrument.d.ts +15 -4
- package/build/types/instrument.d.ts.map +1 -1
- package/build/types/instrumentations/instrumentWorkerEntrypoint.d.ts +42 -0
- package/build/types/instrumentations/instrumentWorkerEntrypoint.d.ts.map +1 -0
- package/build/types/instrumentations/worker/instrumentEmail.d.ts +2 -1
- package/build/types/instrumentations/worker/instrumentEmail.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentFetch.d.ts +6 -1
- package/build/types/instrumentations/worker/instrumentFetch.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentQueue.d.ts +6 -1
- package/build/types/instrumentations/worker/instrumentQueue.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentScheduled.d.ts +6 -1
- package/build/types/instrumentations/worker/instrumentScheduled.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentTail.d.ts +6 -1
- package/build/types/instrumentations/worker/instrumentTail.d.ts.map +1 -1
- package/build/types/request.d.ts +3 -3
- package/build/types/request.d.ts.map +1 -1
- package/build/types/scope-utils.d.ts +2 -2
- package/build/types/scope-utils.d.ts.map +1 -1
- package/build/types/utils/isCloudflareClass.d.ts +30 -0
- package/build/types/utils/isCloudflareClass.d.ts.map +1 -0
- package/build/types/withSentry.d.ts +3 -2
- package/build/types/withSentry.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +1 -1
- package/build/types-ts3.8/instrument.d.ts +15 -4
- package/build/types-ts3.8/instrumentations/instrumentWorkerEntrypoint.d.ts +42 -0
- package/build/types-ts3.8/instrumentations/worker/instrumentEmail.d.ts +2 -1
- package/build/types-ts3.8/instrumentations/worker/instrumentFetch.d.ts +6 -1
- package/build/types-ts3.8/instrumentations/worker/instrumentQueue.d.ts +6 -1
- package/build/types-ts3.8/instrumentations/worker/instrumentScheduled.d.ts +6 -1
- package/build/types-ts3.8/instrumentations/worker/instrumentTail.d.ts +6 -1
- package/build/types-ts3.8/request.d.ts +3 -3
- package/build/types-ts3.8/scope-utils.d.ts +2 -2
- package/build/types-ts3.8/utils/isCloudflareClass.d.ts +30 -0
- package/build/types-ts3.8/withSentry.d.ts +3 -2
- package/package.json +3 -3
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
|
|
2
|
+
import type { CloudflareOptions } from '../client';
|
|
3
|
+
export type WorkerEntrypointConstructor<Env = typeof cloudflareEnv, Props = {}> = new (ctx: ExecutionContext, env: typeof cloudflareEnv) => InstanceType<typeof WorkerEntrypoint<Env, Props>>;
|
|
4
|
+
/**
|
|
5
|
+
* Instruments a WorkerEntrypoint class to capture errors and performance data.
|
|
6
|
+
*
|
|
7
|
+
* Instruments the following methods (same as `withSentry` for ExportedHandler):
|
|
8
|
+
* - fetch (HTTP requests)
|
|
9
|
+
* - scheduled (cron triggers)
|
|
10
|
+
* - queue (queue consumers)
|
|
11
|
+
* - email (email handlers)
|
|
12
|
+
* - tail (tail workers)
|
|
13
|
+
*
|
|
14
|
+
* as well as any other public RPC methods on the WorkerEntrypoint instance.
|
|
15
|
+
*
|
|
16
|
+
* @param optionsCallback Function that returns the options for the SDK initialization.
|
|
17
|
+
* @param WorkerEntrypointClass The WorkerEntrypoint class to instrument.
|
|
18
|
+
* @returns The instrumented WorkerEntrypoint class.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* class MyWorkerBase extends WorkerEntrypoint<Env> {
|
|
23
|
+
* async fetch(request: Request): Promise<Response> {
|
|
24
|
+
* return new Response('Hello World!');
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* async myRpcMethod(arg: string): Promise<string> {
|
|
28
|
+
* return `Hello ${arg}!`;
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* export default instrumentWorkerEntrypoint(
|
|
33
|
+
* env => ({
|
|
34
|
+
* dsn: env.SENTRY_DSN,
|
|
35
|
+
* tracesSampleRate: 1.0,
|
|
36
|
+
* }),
|
|
37
|
+
* MyWorkerBase,
|
|
38
|
+
* );
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function instrumentWorkerEntrypoint<T extends WorkerEntrypointConstructor>(optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined, WorkerEntrypointClass: T): T;
|
|
42
|
+
//# sourceMappingURL=instrumentWorkerEntrypoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentWorkerEntrypoint.d.ts","sourceRoot":"","sources":["../../../src/instrumentations/instrumentWorkerEntrypoint.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,IAAI,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAQnD,MAAM,MAAM,2BAA2B,CAAC,GAAG,GAAG,OAAO,aAAa,EAAE,KAAK,GAAG,EAAE,IAAI,KAChF,GAAG,EAAE,gBAAgB,EACrB,GAAG,EAAE,OAAO,aAAa,KACtB,YAAY,CAAC,OAAO,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,2BAA2B,EAC9E,eAAe,EAAE,CAAC,GAAG,EAAE,OAAO,aAAa,KAAK,iBAAiB,GAAG,SAAS,EAC7E,qBAAqB,EAAE,CAAC,GACvB,CAAC,CA+CH"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import type { env as cloudflareEnv } from 'cloudflare:workers';
|
|
2
3
|
import type { CloudflareOptions } from '../../client';
|
|
3
4
|
/**
|
|
4
5
|
* Instruments an email handler for ExportedHandler (env/ctx come from args).
|
|
5
6
|
*/
|
|
6
|
-
export declare function instrumentExportedHandlerEmail<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env:
|
|
7
|
+
export declare function instrumentExportedHandlerEmail<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined): void;
|
|
7
8
|
//# sourceMappingURL=instrumentEmail.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentEmail.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentEmail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,eAAe,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"instrumentEmail.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentEmail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,GAAG,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAQ/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAiDtD;;GAEG;AAEH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACrF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,OAAO,aAAa,KAAK,iBAAiB,GAAG,SAAS,GAC5E,IAAI,CAoBN"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
|
|
2
3
|
import type { CloudflareOptions } from '../../client';
|
|
3
4
|
/**
|
|
4
5
|
* Instruments a fetch handler for ExportedHandler (env/ctx come from args).
|
|
5
6
|
*/
|
|
6
|
-
export declare function instrumentExportedHandlerFetch<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env:
|
|
7
|
+
export declare function instrumentExportedHandlerFetch<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined): void;
|
|
8
|
+
/**
|
|
9
|
+
* Instruments a fetch method for WorkerEntrypoint (options/context already available).
|
|
10
|
+
*/
|
|
11
|
+
export declare function instrumentWorkerEntrypointFetch<T extends WorkerEntrypoint>(instance: T, options: CloudflareOptions, context: ExecutionContext): void;
|
|
7
12
|
//# sourceMappingURL=instrumentFetch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentFetch.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentFetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAMtD;;GAEG;AAEH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACrF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"instrumentFetch.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentFetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,GAAG,IAAI,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAMtD;;GAEG;AAEH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACrF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,OAAO,aAAa,KAAK,iBAAiB,GAAG,SAAS,GAC5E,IAAI,CAoBN;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,CAAC,SAAS,gBAAgB,EACxE,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,gBAAgB,GACxB,IAAI,CAaN"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
|
|
2
3
|
import type { CloudflareOptions } from '../../client';
|
|
3
4
|
/**
|
|
4
5
|
* Instruments a queue handler for ExportedHandler (env/ctx come from args).
|
|
5
6
|
*/
|
|
6
|
-
export declare function instrumentExportedHandlerQueue<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env:
|
|
7
|
+
export declare function instrumentExportedHandlerQueue<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined): void;
|
|
8
|
+
/**
|
|
9
|
+
* Instruments a queue method for WorkerEntrypoint (options/context already available).
|
|
10
|
+
*/
|
|
11
|
+
export declare function instrumentWorkerEntrypointQueue<T extends WorkerEntrypoint>(instance: T, options: CloudflareOptions, context: ExecutionContext): void;
|
|
7
12
|
//# sourceMappingURL=instrumentQueue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentQueue.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentQueue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"instrumentQueue.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentQueue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,GAAG,IAAI,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AASjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAsDtD;;GAEG;AAEH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACrF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,OAAO,aAAa,KAAK,iBAAiB,GAAG,SAAS,GAC5E,IAAI,CAoBN;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,CAAC,SAAS,gBAAgB,EACxE,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,gBAAgB,GACxB,IAAI,CAaN"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
|
|
2
3
|
import type { CloudflareOptions } from '../../client';
|
|
3
4
|
/**
|
|
4
5
|
* Instruments a scheduled handler for ExportedHandler (env/ctx come from args).
|
|
5
6
|
*/
|
|
6
|
-
export declare function instrumentExportedHandlerScheduled<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env:
|
|
7
|
+
export declare function instrumentExportedHandlerScheduled<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined): void;
|
|
8
|
+
/**
|
|
9
|
+
* Instruments a scheduled method for WorkerEntrypoint (options/context already available).
|
|
10
|
+
*/
|
|
11
|
+
export declare function instrumentWorkerEntrypointScheduled<T extends WorkerEntrypoint>(instance: T, options: CloudflareOptions, context: ExecutionContext): void;
|
|
7
12
|
//# sourceMappingURL=instrumentScheduled.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentScheduled.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentScheduled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAuB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"instrumentScheduled.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentScheduled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAuB,MAAM,2BAA2B,CAAC;AACtF,OAAO,KAAK,EAAE,GAAG,IAAI,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAQjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAgDtD;;GAEG;AAEH,wBAAgB,kCAAkC,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACzF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,OAAO,aAAa,KAAK,iBAAiB,GAAG,SAAS,GAC5E,IAAI,CAoBN;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,CAAC,SAAS,gBAAgB,EAC5E,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,gBAAgB,GACxB,IAAI,CAaN"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
|
|
2
3
|
import type { CloudflareOptions } from '../../client';
|
|
3
4
|
/**
|
|
4
5
|
* Instruments a tail handler for ExportedHandler (env/ctx come from args).
|
|
5
6
|
*/
|
|
6
|
-
export declare function instrumentExportedHandlerTail<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env:
|
|
7
|
+
export declare function instrumentExportedHandlerTail<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined): void;
|
|
8
|
+
/**
|
|
9
|
+
* Instruments a tail method for WorkerEntrypoint (options/context already available).
|
|
10
|
+
*/
|
|
11
|
+
export declare function instrumentWorkerEntrypointTail<T extends WorkerEntrypoint>(instance: T, options: CloudflareOptions, context: ExecutionContext): void;
|
|
7
12
|
//# sourceMappingURL=instrumentTail.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentTail.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentTail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"instrumentTail.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentTail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAa,MAAM,2BAA2B,CAAC;AAC5E,OAAO,KAAK,EAAE,GAAG,IAAI,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAgCtD;;GAEG;AAEH,wBAAgB,6BAA6B,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACpF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,OAAO,aAAa,KAAK,iBAAiB,GAAG,SAAS,GAC5E,IAAI,CAoBN;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,gBAAgB,EACvE,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,gBAAgB,GACxB,IAAI,CAWN"}
|
package/build/types/request.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ExecutionContext, IncomingRequestCfProperties } from '@cloudflare/workers-types';
|
|
1
|
+
import type { CfProperties, ExecutionContext, IncomingRequestCfProperties } from '@cloudflare/workers-types';
|
|
2
2
|
import type { CloudflareOptions } from './client';
|
|
3
3
|
interface RequestHandlerWrapperOptions {
|
|
4
4
|
options: CloudflareOptions;
|
|
5
|
-
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
6
|
-
context: ExecutionContext;
|
|
5
|
+
request: Request<unknown, IncomingRequestCfProperties<unknown> | CfProperties<unknown>>;
|
|
6
|
+
context: ExecutionContext | undefined;
|
|
7
7
|
/**
|
|
8
8
|
* If true, errors will be captured, rethrown and sent to Sentry.
|
|
9
9
|
* Otherwise, errors are rethrown but not captured.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAc7G,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAMlD,UAAU,4BAA4B;IACpC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,2BAA2B,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;IACxF,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACtC;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,cAAc,EAAE,4BAA4B,EAC5C,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,GAC5D,OAAO,CAAC,QAAQ,CAAC,CAgJnB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IncomingRequestCfProperties } from '@cloudflare/workers-types';
|
|
1
|
+
import type { CfProperties, IncomingRequestCfProperties } from '@cloudflare/workers-types';
|
|
2
2
|
import type { Scope } from '@sentry/core';
|
|
3
3
|
/**
|
|
4
4
|
* Set cloud resource context on scope.
|
|
@@ -7,7 +7,7 @@ export declare function addCloudResourceContext(scope: Scope): void;
|
|
|
7
7
|
/**
|
|
8
8
|
* Set culture context on scope
|
|
9
9
|
*/
|
|
10
|
-
export declare function addCultureContext(scope: Scope, cf: IncomingRequestCfProperties): void;
|
|
10
|
+
export declare function addCultureContext(scope: Scope, cf: IncomingRequestCfProperties | CfProperties): void;
|
|
11
11
|
/**
|
|
12
12
|
* Set request data on scope
|
|
13
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-utils.d.ts","sourceRoot":"","sources":["../../src/scope-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"scope-utils.d.ts","sourceRoot":"","sources":["../../src/scope-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAG1C;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAI1D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,2BAA2B,GAAG,YAAY,GAAG,IAAI,CAIpG;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAE/D"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DurableObject, WorkflowEntrypoint } from 'cloudflare:workers';
|
|
2
|
+
import type { WorkerEntrypointConstructor } from '../instrumentations/instrumentWorkerEntrypoint';
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a class constructor extends a specific Cloudflare base class.
|
|
5
|
+
*
|
|
6
|
+
* Uses prototype chain walking with constructor names rather than instanceof,
|
|
7
|
+
* so it works in Node at build time without requiring the cloudflare:workers
|
|
8
|
+
* module (which only exists in the Workers runtime).
|
|
9
|
+
*
|
|
10
|
+
* This is used to differentiate between different Cloudflare worker types:
|
|
11
|
+
* - WorkerEntrypoint: Class-based workers (used with instrumentWorkerEntrypoint)
|
|
12
|
+
* - DurableObject: Durable Object classes
|
|
13
|
+
* - Workflow: Workflow classes
|
|
14
|
+
*
|
|
15
|
+
* For ExportedHandler (plain objects), this will return false for all types.
|
|
16
|
+
*
|
|
17
|
+
* @param value - The value to check (typically a class constructor)
|
|
18
|
+
* @param className - The Cloudflare base class name to check against
|
|
19
|
+
* @returns true if the value is a class that extends the specified Cloudflare class
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* isCloudflareClass(MyWorker, 'WorkerEntrypoint') // true if MyWorker extends WorkerEntrypoint
|
|
24
|
+
* isCloudflareClass(MyDO, 'DurableObject') // true if MyDO extends DurableObject
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function isCloudflareClass(value: unknown, className: 'WorkerEntrypoint'): value is WorkerEntrypointConstructor;
|
|
28
|
+
export declare function isCloudflareClass(value: unknown, className: 'DurableObject'): value is new (...args: unknown[]) => DurableObject;
|
|
29
|
+
export declare function isCloudflareClass(value: unknown, className: 'WorkflowEntrypoint'): value is new (...args: unknown[]) => WorkflowEntrypoint;
|
|
30
|
+
//# sourceMappingURL=isCloudflareClass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isCloudflareClass.d.ts","sourceRoot":"","sources":["../../../src/utils/isCloudflareClass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAGlG;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,GAAG,KAAK,IAAI,2BAA2B,CAAC;AACvH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,eAAe,GACzB,KAAK,IAAI,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,aAAa,CAAC;AACtD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,oBAAoB,GAC9B,KAAK,IAAI,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,kBAAkB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { env } from 'cloudflare:workers';
|
|
1
|
+
import type { env as cloudflareEnv } from 'cloudflare:workers';
|
|
2
2
|
import type { CloudflareOptions } from './client';
|
|
3
|
+
import { type WorkerEntrypointConstructor } from './instrumentations/instrumentWorkerEntrypoint';
|
|
3
4
|
/**
|
|
4
5
|
* Wrapper for Cloudflare handlers.
|
|
5
6
|
*
|
|
@@ -11,5 +12,5 @@ import type { CloudflareOptions } from './client';
|
|
|
11
12
|
* @param handler {ExportedHandler} The handler to wrap.
|
|
12
13
|
* @returns The wrapped handler.
|
|
13
14
|
*/
|
|
14
|
-
export declare function withSentry<Env = typeof
|
|
15
|
+
export declare function withSentry<Env = typeof cloudflareEnv, QueueHandlerMessage = unknown, CfHostMetadata = unknown, T extends ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata> | WorkerEntrypointConstructor = ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata>>(optionsCallback: (env: Env) => CloudflareOptions | undefined, handler: T): T;
|
|
15
16
|
//# sourceMappingURL=withSentry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withSentry.d.ts","sourceRoot":"","sources":["../../src/withSentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"withSentry.d.ts","sourceRoot":"","sources":["../../src/withSentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AASlD,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,+CAA+C,CAAC;AAEvD;;;;;;;;;;GAUG;AAGH,wBAAgB,UAAU,CACxB,GAAG,GAAG,OAAO,aAAa,EAC1B,mBAAmB,GAAG,OAAO,EAC7B,cAAc,GAAG,OAAO,EACxB,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,mBAAmB,EAAE,cAAc,CAAC,GAAG,2BAA2B,GAAG,eAAe,CACjH,GAAG,EACH,mBAAmB,EACnB,cAAc,CACf,EACD,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,iBAAiB,GAAG,SAAS,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CA0B7E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
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, setUser, setConversationId, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, 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, featureFlagsIntegration, growthbookIntegration, logger, metrics, instrumentLangGraph, } 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, setUser, setConversationId, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, 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, instrumentLangGraph, } from '@sentry/core';
|
|
4
4
|
export { withSentry } from './withSentry';
|
|
5
5
|
export { instrumentDurableObjectWithSentry } from './durableobject';
|
|
6
6
|
export { sentryPagesPlugin } from './pages-plugin';
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Mark an object as instrumented.
|
|
2
|
+
* Mark an object as instrumented, storing the instrumented version.
|
|
3
|
+
* @param original The original uninstrumented object
|
|
4
|
+
* @param instrumented The instrumented version (defaults to original if not provided)
|
|
3
5
|
*/
|
|
4
|
-
export declare function markAsInstrumented<T>(
|
|
6
|
+
export declare function markAsInstrumented<T>(original: T, instrumented?: T): void;
|
|
5
7
|
/**
|
|
6
|
-
*
|
|
8
|
+
* Get the instrumented version of an object, if available.
|
|
9
|
+
* Returns the instrumented version if the object was previously instrumented,
|
|
10
|
+
* or undefined if not found.
|
|
7
11
|
*/
|
|
8
|
-
export declare function
|
|
12
|
+
export declare function getInstrumented<T>(obj: T): T | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the already-instrumented version of `original` if one exists,
|
|
15
|
+
* otherwise calls `instrumentFn` to create it, marks the mapping, and returns it.
|
|
16
|
+
*
|
|
17
|
+
* @param noMark - If true, skips storing the original→instrumented mapping.
|
|
18
|
+
*/
|
|
19
|
+
export declare function ensureInstrumented<T>(original: T, instrumentFn: (original: T) => T, noMark?: boolean): T;
|
|
9
20
|
//# sourceMappingURL=instrument.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
|
|
2
|
+
import { CloudflareOptions } from '../client';
|
|
3
|
+
export type WorkerEntrypointConstructor<Env = typeof cloudflareEnv, Props = {}> = new (ctx: ExecutionContext, env: typeof cloudflareEnv) => InstanceType<typeof WorkerEntrypoint<Env, Props>>;
|
|
4
|
+
/**
|
|
5
|
+
* Instruments a WorkerEntrypoint class to capture errors and performance data.
|
|
6
|
+
*
|
|
7
|
+
* Instruments the following methods (same as `withSentry` for ExportedHandler):
|
|
8
|
+
* - fetch (HTTP requests)
|
|
9
|
+
* - scheduled (cron triggers)
|
|
10
|
+
* - queue (queue consumers)
|
|
11
|
+
* - email (email handlers)
|
|
12
|
+
* - tail (tail workers)
|
|
13
|
+
*
|
|
14
|
+
* as well as any other public RPC methods on the WorkerEntrypoint instance.
|
|
15
|
+
*
|
|
16
|
+
* @param optionsCallback Function that returns the options for the SDK initialization.
|
|
17
|
+
* @param WorkerEntrypointClass The WorkerEntrypoint class to instrument.
|
|
18
|
+
* @returns The instrumented WorkerEntrypoint class.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* class MyWorkerBase extends WorkerEntrypoint<Env> {
|
|
23
|
+
* async fetch(request: Request): Promise<Response> {
|
|
24
|
+
* return new Response('Hello World!');
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* async myRpcMethod(arg: string): Promise<string> {
|
|
28
|
+
* return `Hello ${arg}!`;
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* export default instrumentWorkerEntrypoint(
|
|
33
|
+
* env => ({
|
|
34
|
+
* dsn: env.SENTRY_DSN,
|
|
35
|
+
* tracesSampleRate: 1.0,
|
|
36
|
+
* }),
|
|
37
|
+
* MyWorkerBase,
|
|
38
|
+
* );
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function instrumentWorkerEntrypoint<T extends WorkerEntrypointConstructor>(optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined, WorkerEntrypointClass: T): T;
|
|
42
|
+
//# sourceMappingURL=instrumentWorkerEntrypoint.d.ts.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import { env as cloudflareEnv } from 'cloudflare:workers';
|
|
2
3
|
import { CloudflareOptions } from '../../client';
|
|
3
4
|
/**
|
|
4
5
|
* Instruments an email handler for ExportedHandler (env/ctx come from args).
|
|
5
6
|
*/
|
|
6
|
-
export declare function instrumentExportedHandlerEmail<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env:
|
|
7
|
+
export declare function instrumentExportedHandlerEmail<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined): void;
|
|
7
8
|
//# sourceMappingURL=instrumentEmail.d.ts.map
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
|
|
2
3
|
import { CloudflareOptions } from '../../client';
|
|
3
4
|
/**
|
|
4
5
|
* Instruments a fetch handler for ExportedHandler (env/ctx come from args).
|
|
5
6
|
*/
|
|
6
|
-
export declare function instrumentExportedHandlerFetch<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env:
|
|
7
|
+
export declare function instrumentExportedHandlerFetch<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined): void;
|
|
8
|
+
/**
|
|
9
|
+
* Instruments a fetch method for WorkerEntrypoint (options/context already available).
|
|
10
|
+
*/
|
|
11
|
+
export declare function instrumentWorkerEntrypointFetch<T extends WorkerEntrypoint>(instance: T, options: CloudflareOptions, context: ExecutionContext): void;
|
|
7
12
|
//# sourceMappingURL=instrumentFetch.d.ts.map
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
|
|
2
3
|
import { CloudflareOptions } from '../../client';
|
|
3
4
|
/**
|
|
4
5
|
* Instruments a queue handler for ExportedHandler (env/ctx come from args).
|
|
5
6
|
*/
|
|
6
|
-
export declare function instrumentExportedHandlerQueue<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env:
|
|
7
|
+
export declare function instrumentExportedHandlerQueue<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined): void;
|
|
8
|
+
/**
|
|
9
|
+
* Instruments a queue method for WorkerEntrypoint (options/context already available).
|
|
10
|
+
*/
|
|
11
|
+
export declare function instrumentWorkerEntrypointQueue<T extends WorkerEntrypoint>(instance: T, options: CloudflareOptions, context: ExecutionContext): void;
|
|
7
12
|
//# sourceMappingURL=instrumentQueue.d.ts.map
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
|
|
2
3
|
import { CloudflareOptions } from '../../client';
|
|
3
4
|
/**
|
|
4
5
|
* Instruments a scheduled handler for ExportedHandler (env/ctx come from args).
|
|
5
6
|
*/
|
|
6
|
-
export declare function instrumentExportedHandlerScheduled<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env:
|
|
7
|
+
export declare function instrumentExportedHandlerScheduled<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined): void;
|
|
8
|
+
/**
|
|
9
|
+
* Instruments a scheduled method for WorkerEntrypoint (options/context already available).
|
|
10
|
+
*/
|
|
11
|
+
export declare function instrumentWorkerEntrypointScheduled<T extends WorkerEntrypoint>(instance: T, options: CloudflareOptions, context: ExecutionContext): void;
|
|
7
12
|
//# sourceMappingURL=instrumentScheduled.d.ts.map
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
|
|
2
3
|
import { CloudflareOptions } from '../../client';
|
|
3
4
|
/**
|
|
4
5
|
* Instruments a tail handler for ExportedHandler (env/ctx come from args).
|
|
5
6
|
*/
|
|
6
|
-
export declare function instrumentExportedHandlerTail<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env:
|
|
7
|
+
export declare function instrumentExportedHandlerTail<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined): void;
|
|
8
|
+
/**
|
|
9
|
+
* Instruments a tail method for WorkerEntrypoint (options/context already available).
|
|
10
|
+
*/
|
|
11
|
+
export declare function instrumentWorkerEntrypointTail<T extends WorkerEntrypoint>(instance: T, options: CloudflareOptions, context: ExecutionContext): void;
|
|
7
12
|
//# sourceMappingURL=instrumentTail.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ExecutionContext, IncomingRequestCfProperties } from '@cloudflare/workers-types';
|
|
1
|
+
import { CfProperties, ExecutionContext, IncomingRequestCfProperties } from '@cloudflare/workers-types';
|
|
2
2
|
import { CloudflareOptions } from './client';
|
|
3
3
|
interface RequestHandlerWrapperOptions {
|
|
4
4
|
options: CloudflareOptions;
|
|
5
|
-
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
6
|
-
context: ExecutionContext;
|
|
5
|
+
request: Request<unknown, IncomingRequestCfProperties<unknown> | CfProperties<unknown>>;
|
|
6
|
+
context: ExecutionContext | undefined;
|
|
7
7
|
/**
|
|
8
8
|
* If true, errors will be captured, rethrown and sent to Sentry.
|
|
9
9
|
* Otherwise, errors are rethrown but not captured.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IncomingRequestCfProperties } from '@cloudflare/workers-types';
|
|
1
|
+
import { CfProperties, IncomingRequestCfProperties } from '@cloudflare/workers-types';
|
|
2
2
|
import { Scope } from '@sentry/core';
|
|
3
3
|
/**
|
|
4
4
|
* Set cloud resource context on scope.
|
|
@@ -7,7 +7,7 @@ export declare function addCloudResourceContext(scope: Scope): void;
|
|
|
7
7
|
/**
|
|
8
8
|
* Set culture context on scope
|
|
9
9
|
*/
|
|
10
|
-
export declare function addCultureContext(scope: Scope, cf: IncomingRequestCfProperties): void;
|
|
10
|
+
export declare function addCultureContext(scope: Scope, cf: IncomingRequestCfProperties | CfProperties): void;
|
|
11
11
|
/**
|
|
12
12
|
* Set request data on scope
|
|
13
13
|
*/
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DurableObject, WorkflowEntrypoint } from 'cloudflare:workers';
|
|
2
|
+
import { WorkerEntrypointConstructor } from '../instrumentations/instrumentWorkerEntrypoint';
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a class constructor extends a specific Cloudflare base class.
|
|
5
|
+
*
|
|
6
|
+
* Uses prototype chain walking with constructor names rather than instanceof,
|
|
7
|
+
* so it works in Node at build time without requiring the cloudflare:workers
|
|
8
|
+
* module (which only exists in the Workers runtime).
|
|
9
|
+
*
|
|
10
|
+
* This is used to differentiate between different Cloudflare worker types:
|
|
11
|
+
* - WorkerEntrypoint: Class-based workers (used with instrumentWorkerEntrypoint)
|
|
12
|
+
* - DurableObject: Durable Object classes
|
|
13
|
+
* - Workflow: Workflow classes
|
|
14
|
+
*
|
|
15
|
+
* For ExportedHandler (plain objects), this will return false for all types.
|
|
16
|
+
*
|
|
17
|
+
* @param value - The value to check (typically a class constructor)
|
|
18
|
+
* @param className - The Cloudflare base class name to check against
|
|
19
|
+
* @returns true if the value is a class that extends the specified Cloudflare class
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* isCloudflareClass(MyWorker, 'WorkerEntrypoint') // true if MyWorker extends WorkerEntrypoint
|
|
24
|
+
* isCloudflareClass(MyDO, 'DurableObject') // true if MyDO extends DurableObject
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function isCloudflareClass(value: unknown, className: 'WorkerEntrypoint'): value is WorkerEntrypointConstructor;
|
|
28
|
+
export declare function isCloudflareClass(value: unknown, className: 'DurableObject'): value is new (...args: unknown[]) => DurableObject;
|
|
29
|
+
export declare function isCloudflareClass(value: unknown, className: 'WorkflowEntrypoint'): value is new (...args: unknown[]) => WorkflowEntrypoint;
|
|
30
|
+
//# sourceMappingURL=isCloudflareClass.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { env } from 'cloudflare:workers';
|
|
1
|
+
import { env as cloudflareEnv } from 'cloudflare:workers';
|
|
2
2
|
import { CloudflareOptions } from './client';
|
|
3
|
+
import { WorkerEntrypointConstructor } from './instrumentations/instrumentWorkerEntrypoint';
|
|
3
4
|
/**
|
|
4
5
|
* Wrapper for Cloudflare handlers.
|
|
5
6
|
*
|
|
@@ -11,5 +12,5 @@ import { CloudflareOptions } from './client';
|
|
|
11
12
|
* @param handler {ExportedHandler} The handler to wrap.
|
|
12
13
|
* @returns The wrapped handler.
|
|
13
14
|
*/
|
|
14
|
-
export declare function withSentry<Env = typeof
|
|
15
|
+
export declare function withSentry<Env = typeof cloudflareEnv, QueueHandlerMessage = unknown, CfHostMetadata = unknown, T extends ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata> | WorkerEntrypointConstructor = ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata>>(optionsCallback: (env: Env) => CloudflareOptions | undefined, handler: T): T;
|
|
15
16
|
//# sourceMappingURL=withSentry.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/cloudflare",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.48.0",
|
|
4
4
|
"description": "Official Sentry SDK for Cloudflare Workers and Pages",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/cloudflare",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@opentelemetry/api": "^1.9.
|
|
53
|
-
"@sentry/core": "10.
|
|
52
|
+
"@opentelemetry/api": "^1.9.1",
|
|
53
|
+
"@sentry/core": "10.48.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@cloudflare/workers-types": "^4.x"
|