@sentry/cloudflare 8.22.0 → 8.23.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/README.md +86 -1
- package/build/cjs/d1.js +157 -0
- package/build/cjs/d1.js.map +1 -0
- package/build/cjs/handler.js +50 -0
- package/build/cjs/handler.js.map +1 -1
- package/build/cjs/index.js +5 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/pages-plugin.js +26 -7
- package/build/cjs/pages-plugin.js.map +1 -1
- package/build/cjs/request.js +4 -28
- package/build/cjs/request.js.map +1 -1
- package/build/cjs/scope-utils.js +33 -0
- package/build/cjs/scope-utils.js.map +1 -0
- package/build/cjs/sdk.js.map +1 -1
- package/build/esm/d1.js +155 -0
- package/build/esm/d1.js.map +1 -0
- package/build/esm/handler.js +50 -0
- package/build/esm/handler.js.map +1 -1
- package/build/esm/index.js +3 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/pages-plugin.js +26 -7
- package/build/esm/pages-plugin.js.map +1 -1
- package/build/esm/request.js +2 -26
- package/build/esm/request.js.map +1 -1
- package/build/esm/scope-utils.js +29 -0
- package/build/esm/scope-utils.js.map +1 -0
- package/build/esm/sdk.js.map +1 -1
- package/build/types/d1.d.ts +17 -0
- package/build/types/d1.d.ts.map +1 -0
- package/build/types/handler.d.ts +2 -2
- package/build/types/handler.d.ts.map +1 -1
- package/build/types/index.d.ts +3 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/pages-plugin.d.ts +18 -6
- package/build/types/pages-plugin.d.ts.map +1 -1
- package/build/types/request.d.ts.map +1 -1
- package/build/types/scope-utils.d.ts +15 -0
- package/build/types/scope-utils.d.ts.map +1 -0
- package/build/types/sdk.d.ts +4 -3
- package/build/types/sdk.d.ts.map +1 -1
- package/build/types-ts3.8/d1.d.ts +17 -0
- package/build/types-ts3.8/handler.d.ts +2 -2
- package/build/types-ts3.8/index.d.ts +3 -1
- package/build/types-ts3.8/pages-plugin.d.ts +18 -6
- package/build/types-ts3.8/scope-utils.d.ts +15 -0
- package/build/types-ts3.8/sdk.d.ts +4 -3
- package/package.json +6 -7
package/build/types/sdk.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { Integration
|
|
1
|
+
import type { Integration } from '@sentry/types';
|
|
2
|
+
import type { CloudflareOptions } from './client';
|
|
2
3
|
import { CloudflareClient } from './client';
|
|
3
4
|
/** Get the default integrations for the Cloudflare SDK. */
|
|
4
|
-
export declare function getDefaultIntegrations(options:
|
|
5
|
+
export declare function getDefaultIntegrations(options: CloudflareOptions): Integration[];
|
|
5
6
|
/**
|
|
6
7
|
* Initializes the cloudflare SDK.
|
|
7
8
|
*/
|
|
8
|
-
export declare function init(options:
|
|
9
|
+
export declare function init(options: CloudflareOptions): CloudflareClient | undefined;
|
|
9
10
|
//# sourceMappingURL=sdk.d.ts.map
|
package/build/types/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAA2B,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAM5C,2DAA2D;AAC3D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,WAAW,EAAE,CAUhF;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,SAAS,CAa7E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { D1Database } from '@cloudflare/workers-types';
|
|
2
|
+
/**
|
|
3
|
+
* Instruments Cloudflare D1 bindings with Sentry.
|
|
4
|
+
*
|
|
5
|
+
* Currently, only prepared statements are instrumented. `db.exec` and `db.batch` are not instrumented.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
*
|
|
9
|
+
* ```js
|
|
10
|
+
* // env.DB is the D1 DB binding configured in your `wrangler.toml`
|
|
11
|
+
* const db = instrumentD1WithSentry(env.DB);
|
|
12
|
+
* // Now you can use the database as usual
|
|
13
|
+
* await db.prepare('SELECT * FROM table WHERE id = ?').bind(1).run();
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function instrumentD1WithSentry(db: D1Database): D1Database;
|
|
17
|
+
//# sourceMappingURL=d1.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
-
import {
|
|
2
|
+
import { CloudflareOptions } from './client';
|
|
3
3
|
/**
|
|
4
4
|
* Extract environment generic from exported handler.
|
|
5
5
|
*/
|
|
@@ -15,6 +15,6 @@ type ExtractEnv<P> = P extends ExportedHandler<infer Env> ? Env : never;
|
|
|
15
15
|
* @param handler {ExportedHandler} The handler to wrap.
|
|
16
16
|
* @returns The wrapped handler.
|
|
17
17
|
*/
|
|
18
|
-
export declare function withSentry<E extends ExportedHandler<any>>(optionsCallback: (env: ExtractEnv<E>) =>
|
|
18
|
+
export declare function withSentry<E extends ExportedHandler<any>>(optionsCallback: (env: ExtractEnv<E>) => CloudflareOptions, handler: E): E;
|
|
19
19
|
export {};
|
|
20
20
|
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export { Breadcrumb, BreadcrumbHint, PolymorphicRequest, Request, SdkInfo, Event, EventHint, ErrorEvent, Exception, Session, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, } from '@sentry/types';
|
|
2
2
|
export { AddRequestDataToEventOptions } from '@sentry/utils';
|
|
3
3
|
export { CloudflareOptions } from './client';
|
|
4
|
-
export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureFeedback, close, createTransport, lastEventId, flush, getClient, isInitialized, getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, Scope, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setUser, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, startSpan, startInactiveSpan, startSpanManual, startNewTrace, withActiveSpan, getSpanDescendants, continueTrace, metrics, functionToStringIntegration, inboundFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, debugIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, zodErrorsIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToJSON, spanToTraceHeader, spanToBaggageHeader, } from '@sentry/core';
|
|
4
|
+
export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureFeedback, close, createTransport, lastEventId, flush, getClient, isInitialized, getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, Scope, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setUser, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, startSpan, startInactiveSpan, startSpanManual, startNewTrace, withActiveSpan, getSpanDescendants, continueTrace, metrics, functionToStringIntegration, inboundFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, debugIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, zodErrorsIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToJSON, spanToTraceHeader, spanToBaggageHeader, } from '@sentry/core';
|
|
5
5
|
export { withSentry } from './handler';
|
|
6
6
|
export { sentryPagesPlugin } from './pages-plugin';
|
|
7
|
+
export { wrapRequestHandler } from './request';
|
|
7
8
|
export { CloudflareClient } from './client';
|
|
8
9
|
export { getDefaultIntegrations } from './sdk';
|
|
9
10
|
export { fetchIntegration } from './integrations/fetch';
|
|
11
|
+
export { instrumentD1WithSentry } from './d1';
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -5,19 +5,31 @@ import { CloudflareOptions } from './client';
|
|
|
5
5
|
*
|
|
6
6
|
* Initializes the SDK and wraps cloudflare pages requests with SDK instrumentation.
|
|
7
7
|
*
|
|
8
|
-
* @example
|
|
8
|
+
* @example Simple usage
|
|
9
|
+
*
|
|
9
10
|
* ```javascript
|
|
10
11
|
* // functions/_middleware.js
|
|
11
12
|
* import * as Sentry from '@sentry/cloudflare';
|
|
12
13
|
*
|
|
13
14
|
* export const onRequest = Sentry.sentryPagesPlugin({
|
|
14
|
-
*
|
|
15
|
-
*
|
|
15
|
+
* dsn: process.env.SENTRY_DSN,
|
|
16
|
+
* tracesSampleRate: 1.0,
|
|
16
17
|
* });
|
|
17
18
|
* ```
|
|
18
19
|
*
|
|
19
|
-
* @
|
|
20
|
-
*
|
|
20
|
+
* @example Usage with handler function to access context for environmental variables
|
|
21
|
+
*
|
|
22
|
+
* ```javascript
|
|
23
|
+
* import * as Sentry from '@sentry/cloudflare';
|
|
24
|
+
*
|
|
25
|
+
* const const onRequest = Sentry.sentryPagesPlugin((context) => ({
|
|
26
|
+
* dsn: context.env.SENTRY_DSN,
|
|
27
|
+
* tracesSampleRate: 1.0,
|
|
28
|
+
* })
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param handlerOrOptions Configuration options or a function that returns configuration options.
|
|
32
|
+
* @returns A plugin function that can be used in Cloudflare Pages.
|
|
21
33
|
*/
|
|
22
|
-
export declare function sentryPagesPlugin<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown
|
|
34
|
+
export declare function sentryPagesPlugin<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>, PluginParams = any>(handlerOrOptions: CloudflareOptions | ((context: EventPluginContext<Env, Params, Data, PluginParams>) => CloudflareOptions)): PagesPluginFunction<Env, Params, Data, PluginParams>;
|
|
23
35
|
//# sourceMappingURL=pages-plugin.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IncomingRequestCfProperties } from '@cloudflare/workers-types';
|
|
2
|
+
import { Scope } from '@sentry/types';
|
|
3
|
+
/**
|
|
4
|
+
* Set cloud resource context on scope.
|
|
5
|
+
*/
|
|
6
|
+
export declare function addCloudResourceContext(scope: Scope): void;
|
|
7
|
+
/**
|
|
8
|
+
* Set culture context on scope
|
|
9
|
+
*/
|
|
10
|
+
export declare function addCultureContext(scope: Scope, cf: IncomingRequestCfProperties): void;
|
|
11
|
+
/**
|
|
12
|
+
* Set request data on scope
|
|
13
|
+
*/
|
|
14
|
+
export declare function addRequest(scope: Scope, request: Request): void;
|
|
15
|
+
//# sourceMappingURL=scope-utils.d.ts.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Integration
|
|
1
|
+
import { Integration } from '@sentry/types';
|
|
2
|
+
import { CloudflareOptions } from './client';
|
|
2
3
|
import { CloudflareClient } from './client';
|
|
3
4
|
/** Get the default integrations for the Cloudflare SDK. */
|
|
4
|
-
export declare function getDefaultIntegrations(options:
|
|
5
|
+
export declare function getDefaultIntegrations(options: CloudflareOptions): Integration[];
|
|
5
6
|
/**
|
|
6
7
|
* Initializes the cloudflare SDK.
|
|
7
8
|
*/
|
|
8
|
-
export declare function init(options:
|
|
9
|
+
export declare function init(options: CloudflareOptions): CloudflareClient | undefined;
|
|
9
10
|
//# sourceMappingURL=sdk.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/cloudflare",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.23.0",
|
|
4
4
|
"description": "Offical 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",
|
|
@@ -39,18 +39,17 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@sentry/core": "8.
|
|
43
|
-
"@sentry/types": "8.
|
|
44
|
-
"@sentry/utils": "8.
|
|
42
|
+
"@sentry/core": "8.23.0",
|
|
43
|
+
"@sentry/types": "8.23.0",
|
|
44
|
+
"@sentry/utils": "8.23.0"
|
|
45
45
|
},
|
|
46
46
|
"optionalDependencies": {
|
|
47
47
|
"@cloudflare/workers-types": "^4.x"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@cloudflare/workers-types": "^4.
|
|
50
|
+
"@cloudflare/workers-types": "^4.20240725.0",
|
|
51
51
|
"@types/node": "^14.18.0",
|
|
52
|
-
"
|
|
53
|
-
"wrangler": "^3.65.1"
|
|
52
|
+
"wrangler": "^3.67.1"
|
|
54
53
|
},
|
|
55
54
|
"scripts": {
|
|
56
55
|
"build": "run-p build:transpile build:types",
|