@sentry/cloudflare 9.15.0 → 9.16.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 (54) hide show
  1. package/build/cjs/durableobject.js +213 -0
  2. package/build/cjs/durableobject.js.map +1 -0
  3. package/build/cjs/handler.js +56 -66
  4. package/build/cjs/handler.js.map +1 -1
  5. package/build/cjs/index.js +5 -0
  6. package/build/cjs/index.js.map +1 -1
  7. package/build/cjs/instrument.js +27 -0
  8. package/build/cjs/instrument.js.map +1 -0
  9. package/build/cjs/logs/exports.js +213 -0
  10. package/build/cjs/logs/exports.js.map +1 -0
  11. package/build/cjs/options.js +23 -0
  12. package/build/cjs/options.js.map +1 -0
  13. package/build/cjs/request.js +12 -0
  14. package/build/cjs/request.js.map +1 -1
  15. package/build/cjs/sdk.js +1 -0
  16. package/build/cjs/sdk.js.map +1 -1
  17. package/build/esm/durableobject.js +211 -0
  18. package/build/esm/durableobject.js.map +1 -0
  19. package/build/esm/handler.js +56 -66
  20. package/build/esm/handler.js.map +1 -1
  21. package/build/esm/index.js +4 -1
  22. package/build/esm/index.js.map +1 -1
  23. package/build/esm/instrument.js +24 -0
  24. package/build/esm/instrument.js.map +1 -0
  25. package/build/esm/logs/exports.js +206 -0
  26. package/build/esm/logs/exports.js.map +1 -0
  27. package/build/esm/options.js +21 -0
  28. package/build/esm/options.js.map +1 -0
  29. package/build/esm/package.json +1 -1
  30. package/build/esm/request.js +13 -1
  31. package/build/esm/request.js.map +1 -1
  32. package/build/esm/sdk.js +1 -0
  33. package/build/esm/sdk.js.map +1 -1
  34. package/build/types/durableobject.d.ts +38 -0
  35. package/build/types/durableobject.d.ts.map +1 -0
  36. package/build/types/handler.d.ts +2 -7
  37. package/build/types/handler.d.ts.map +1 -1
  38. package/build/types/index.d.ts +3 -1
  39. package/build/types/index.d.ts.map +1 -1
  40. package/build/types/instrument.d.ts +9 -0
  41. package/build/types/instrument.d.ts.map +1 -0
  42. package/build/types/logs/exports.d.ts +169 -0
  43. package/build/types/logs/exports.d.ts.map +1 -0
  44. package/build/types/options.d.ts +12 -0
  45. package/build/types/options.d.ts.map +1 -0
  46. package/build/types/request.d.ts.map +1 -1
  47. package/build/types/sdk.d.ts.map +1 -1
  48. package/build/types-ts3.8/durableobject.d.ts +38 -0
  49. package/build/types-ts3.8/handler.d.ts +2 -7
  50. package/build/types-ts3.8/index.d.ts +4 -1
  51. package/build/types-ts3.8/instrument.d.ts +9 -0
  52. package/build/types-ts3.8/logs/exports.d.ts +169 -0
  53. package/build/types-ts3.8/options.d.ts +12 -0
  54. package/package.json +2 -2
@@ -1,9 +1,5 @@
1
- import type { ExportedHandler } from '@cloudflare/workers-types';
1
+ /// <reference types="@cloudflare/workers-types" />
2
2
  import type { CloudflareOptions } from './client';
3
- /**
4
- * Extract environment generic from exported handler.
5
- */
6
- type ExtractEnv<P> = P extends ExportedHandler<infer Env> ? Env : never;
7
3
  /**
8
4
  * Wrapper for Cloudflare handlers.
9
5
  *
@@ -15,6 +11,5 @@ type ExtractEnv<P> = P extends ExportedHandler<infer Env> ? Env : never;
15
11
  * @param handler {ExportedHandler} The handler to wrap.
16
12
  * @returns The wrapped handler.
17
13
  */
18
- export declare function withSentry<E extends ExportedHandler<any>>(optionsCallback: (env: ExtractEnv<E>) => CloudflareOptions, handler: E): E;
19
- export {};
14
+ export declare function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown>(optionsCallback: (env: Env) => CloudflareOptions, handler: ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata>): ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata>;
20
15
  //# sourceMappingURL=handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,2BAA2B,CAAC;AAUnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAKlD;;GAEG;AACH,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,eAAe,CAAC,MAAM,GAAG,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC;AAExE;;;;;;;;;;GAUG;AAEH,wBAAgB,UAAU,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,CAAC,EACvD,eAAe,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,iBAAiB,EAC1D,OAAO,EAAE,CAAC,GACT,CAAC,CAyDH"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/handler.ts"],"names":[],"mappings":";AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAOlD;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,GAAG,GAAG,OAAO,EAAE,mBAAmB,GAAG,OAAO,EAAE,cAAc,GAAG,OAAO,EAC/F,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,iBAAiB,EAChD,OAAO,EAAE,eAAe,CAAC,GAAG,EAAE,mBAAmB,EAAE,cAAc,CAAC,GACjE,eAAe,CAAC,GAAG,EAAE,mBAAmB,EAAE,cAAc,CAAC,CAkE3D"}
@@ -1,7 +1,9 @@
1
1
  export type { Breadcrumb, BreadcrumbHint, PolymorphicRequest, RequestEventData, SdkInfo, Event, EventHint, ErrorEvent, Exception, Session, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, } from '@sentry/core';
2
2
  export type { CloudflareOptions } from './client';
3
- 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, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, 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, } from '@sentry/core';
3
+ 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, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, 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, } from '@sentry/core';
4
+ export * as logger from './logs/exports';
4
5
  export { withSentry } from './handler';
6
+ export { instrumentDurableObjectWithSentry } from './durableobject';
5
7
  export { sentryPagesPlugin } from './pages-plugin';
6
8
  export { wrapRequestHandler } from './request';
7
9
  export { CloudflareClient } from './client';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,OAAO,EACP,aAAa,EACb,IAAI,EACJ,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,GACL,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,KAAK,EACL,eAAe,EACf,WAAW,EACX,KAAK,EACL,SAAS,EACT,aAAa,EACb,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,yBAAyB,EACzB,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,cAAc,EACd,aAAa,EACb,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,2BAA2B,EAE3B,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,EAChC,qCAAqC,EACrC,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,sBAAsB,EAAE,MAAM,MAAM,CAAC;AAE9C,OAAO,EAAE,wCAAwC,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,OAAO,EACP,aAAa,EACb,IAAI,EACJ,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,GACL,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,KAAK,EACL,eAAe,EACf,WAAW,EACX,KAAK,EACL,SAAS,EACT,aAAa,EACb,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,yBAAyB,EACzB,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,cAAc,EACd,aAAa,EACb,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,2BAA2B,EAE3B,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,EAChC,qCAAqC,EACrC,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,sBAAsB,EAAE,MAAM,MAAM,CAAC;AAE9C,OAAO,EAAE,wCAAwC,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Mark an object as instrumented.
3
+ */
4
+ export declare function markAsInstrumented<T>(obj: T): void;
5
+ /**
6
+ * Check if an object is instrumented.
7
+ */
8
+ export declare function isInstrumented<T>(obj: T): boolean | undefined;
9
+ //# sourceMappingURL=instrument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrument.d.ts","sourceRoot":"","sources":["../../src/instrument.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAMlD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,GAAG,SAAS,CAM7D"}
@@ -0,0 +1,169 @@
1
+ import type { Log, ParameterizedString } from '@sentry/core';
2
+ /**
3
+ * @summary Capture a log with the `trace` level. Requires `_experiments.enableLogs` to be enabled.
4
+ *
5
+ * @param message - The message to log.
6
+ * @param attributes - Arbitrary structured data that stores information about the log - e.g., { userId: 100, route: '/dashboard' }.
7
+ *
8
+ * @example
9
+ *
10
+ * ```
11
+ * Sentry.logger.trace('User clicked submit button', {
12
+ * buttonId: 'submit-form',
13
+ * formId: 'user-profile',
14
+ * timestamp: Date.now()
15
+ * });
16
+ * ```
17
+ *
18
+ * @example With template strings
19
+ *
20
+ * ```
21
+ * Sentry.logger.trace(Sentry.logger.fmt`User ${user} navigated to ${page}`, {
22
+ * userId: '123',
23
+ * sessionId: 'abc-xyz'
24
+ * });
25
+ * ```
26
+ */
27
+ export declare function trace(message: ParameterizedString, attributes?: Log['attributes']): void;
28
+ /**
29
+ * @summary Capture a log with the `debug` level. Requires `_experiments.enableLogs` to be enabled.
30
+ *
31
+ * @param message - The message to log.
32
+ * @param attributes - Arbitrary structured data that stores information about the log - e.g., { component: 'Header', state: 'loading' }.
33
+ *
34
+ * @example
35
+ *
36
+ * ```
37
+ * Sentry.logger.debug('Component mounted', {
38
+ * component: 'UserProfile',
39
+ * props: { userId: 123 },
40
+ * renderTime: 150
41
+ * });
42
+ * ```
43
+ *
44
+ * @example With template strings
45
+ *
46
+ * ```
47
+ * Sentry.logger.debug(Sentry.logger.fmt`API request to ${endpoint} failed`, {
48
+ * statusCode: 404,
49
+ * requestId: 'req-123',
50
+ * duration: 250
51
+ * });
52
+ * ```
53
+ */
54
+ export declare function debug(message: ParameterizedString, attributes?: Log['attributes']): void;
55
+ /**
56
+ * @summary Capture a log with the `info` level. Requires `_experiments.enableLogs` to be enabled.
57
+ *
58
+ * @param message - The message to log.
59
+ * @param attributes - Arbitrary structured data that stores information about the log - e.g., { feature: 'checkout', status: 'completed' }.
60
+ *
61
+ * @example
62
+ *
63
+ * ```
64
+ * Sentry.logger.info('User completed checkout', {
65
+ * orderId: 'order-123',
66
+ * amount: 99.99,
67
+ * paymentMethod: 'credit_card'
68
+ * });
69
+ * ```
70
+ *
71
+ * @example With template strings
72
+ *
73
+ * ```
74
+ * Sentry.logger.info(Sentry.logger.fmt`User ${user} updated profile picture`, {
75
+ * userId: 'user-123',
76
+ * imageSize: '2.5MB',
77
+ * timestamp: Date.now()
78
+ * });
79
+ * ```
80
+ */
81
+ export declare function info(message: ParameterizedString, attributes?: Log['attributes']): void;
82
+ /**
83
+ * @summary Capture a log with the `warn` level. Requires `_experiments.enableLogs` to be enabled.
84
+ *
85
+ * @param message - The message to log.
86
+ * @param attributes - Arbitrary structured data that stores information about the log - e.g., { browser: 'Chrome', version: '91.0' }.
87
+ *
88
+ * @example
89
+ *
90
+ * ```
91
+ * Sentry.logger.warn('Browser compatibility issue detected', {
92
+ * browser: 'Safari',
93
+ * version: '14.0',
94
+ * feature: 'WebRTC',
95
+ * fallback: 'enabled'
96
+ * });
97
+ * ```
98
+ *
99
+ * @example With template strings
100
+ *
101
+ * ```
102
+ * Sentry.logger.warn(Sentry.logger.fmt`API endpoint ${endpoint} is deprecated`, {
103
+ * recommendedEndpoint: '/api/v2/users',
104
+ * sunsetDate: '2024-12-31',
105
+ * clientVersion: '1.2.3'
106
+ * });
107
+ * ```
108
+ */
109
+ export declare function warn(message: ParameterizedString, attributes?: Log['attributes']): void;
110
+ /**
111
+ * @summary Capture a log with the `error` level. Requires `_experiments.enableLogs` to be enabled.
112
+ *
113
+ * @param message - The message to log.
114
+ * @param attributes - Arbitrary structured data that stores information about the log - e.g., { error: 'NetworkError', url: '/api/data' }.
115
+ *
116
+ * @example
117
+ *
118
+ * ```
119
+ * Sentry.logger.error('Failed to load user data', {
120
+ * error: 'NetworkError',
121
+ * url: '/api/users/123',
122
+ * statusCode: 500,
123
+ * retryCount: 3
124
+ * });
125
+ * ```
126
+ *
127
+ * @example With template strings
128
+ *
129
+ * ```
130
+ * Sentry.logger.error(Sentry.logger.fmt`Payment processing failed for order ${orderId}`, {
131
+ * error: 'InsufficientFunds',
132
+ * amount: 100.00,
133
+ * currency: 'USD',
134
+ * userId: 'user-456'
135
+ * });
136
+ * ```
137
+ */
138
+ export declare function error(message: ParameterizedString, attributes?: Log['attributes']): void;
139
+ /**
140
+ * @summary Capture a log with the `fatal` level. Requires `_experiments.enableLogs` to be enabled.
141
+ *
142
+ * @param message - The message to log.
143
+ * @param attributes - Arbitrary structured data that stores information about the log - e.g., { appState: 'corrupted', sessionId: 'abc-123' }.
144
+ *
145
+ * @example
146
+ *
147
+ * ```
148
+ * Sentry.logger.fatal('Application state corrupted', {
149
+ * lastKnownState: 'authenticated',
150
+ * sessionId: 'session-123',
151
+ * timestamp: Date.now(),
152
+ * recoveryAttempted: true
153
+ * });
154
+ * ```
155
+ *
156
+ * @example With template strings
157
+ *
158
+ * ```
159
+ * Sentry.logger.fatal(Sentry.logger.fmt`Critical system failure in ${service}`, {
160
+ * service: 'payment-processor',
161
+ * errorCode: 'CRITICAL_FAILURE',
162
+ * affectedUsers: 150,
163
+ * timestamp: Date.now()
164
+ * });
165
+ * ```
166
+ */
167
+ export declare function fatal(message: ParameterizedString, attributes?: Log['attributes']): void;
168
+ export { fmt } from '@sentry/core';
169
+ //# sourceMappingURL=exports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/logs/exports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAoB,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAoB/E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,IAAI,CAExF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,IAAI,CAExF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,IAAI,CAEvF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,IAAI,CAEvF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,IAAI,CAExF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,IAAI,CAExF;AAED,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { CloudflareOptions } from './client';
2
+ /**
3
+ * Merges the options passed in from the user with the options we read from
4
+ * the Cloudflare `env` environment variable object.
5
+ *
6
+ * @param userOptions - The options passed in from the user.
7
+ * @param env - The environment variables.
8
+ *
9
+ * @returns The final options.
10
+ */
11
+ export declare function getFinalOptions(userOptions: CloudflareOptions, env: unknown): CloudflareOptions;
12
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,iBAAiB,EAAE,GAAG,EAAE,OAAO,GAAG,iBAAiB,CAQ/F"}
@@ -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;AAgB/F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAIlD,UAAU,4BAA4B;IACpC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,2BAA2B,CAAC,OAAO,CAAC,CAAC,CAAC;IAChE,OAAO,EAAE,gBAAgB,CAAC;CAC3B;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,CAyEnB"}
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;AAgB/F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAIlD,UAAU,4BAA4B;IACpC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,2BAA2B,CAAC,OAAO,CAAC,CAAC,CAAC;IAChE,OAAO,EAAE,gBAAgB,CAAC;CAC3B;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,CAqFnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAYhD,OAAO,KAAK,EAA2B,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAK5C,2DAA2D;AAC3D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,WAAW,EAAE,CAahF;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,SAAS,CAa7E"}
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAYhD,OAAO,KAAK,EAA2B,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAK5C,2DAA2D;AAC3D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,WAAW,EAAE,CAchF;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,SAAS,CAa7E"}
@@ -0,0 +1,38 @@
1
+ /// <reference types="@cloudflare/workers-types" />
2
+ import { DurableObject } from 'cloudflare:workers';
3
+ import { CloudflareOptions } from './client';
4
+ /**
5
+ * Instruments a Durable Object class to capture errors and performance data.
6
+ *
7
+ * Instruments the following methods:
8
+ * - fetch
9
+ * - alarm
10
+ * - webSocketMessage
11
+ * - webSocketClose
12
+ * - webSocketError
13
+ *
14
+ * as well as any other public RPC methods on the Durable Object instance.
15
+ *
16
+ * @param optionsCallback Function that returns the options for the SDK initialization.
17
+ * @param DurableObjectClass The Durable Object class to instrument.
18
+ * @returns The instrumented Durable Object class.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * class MyDurableObjectBase extends DurableObject {
23
+ * constructor(ctx: DurableObjectState, env: Env) {
24
+ * super(ctx, env);
25
+ * }
26
+ * }
27
+ *
28
+ * export const MyDurableObject = instrumentDurableObjectWithSentry(
29
+ * env => ({
30
+ * dsn: env.SENTRY_DSN,
31
+ * tracesSampleRate: 1.0,
32
+ * }),
33
+ * MyDurableObjectBase,
34
+ * );
35
+ * ```
36
+ */
37
+ export declare function instrumentDurableObjectWithSentry<E, T extends DurableObject<E>>(optionsCallback: (env: E) => CloudflareOptions, DurableObjectClass: new (state: DurableObjectState, env: E) => T): new (state: DurableObjectState, env: E) => T;
38
+ //# sourceMappingURL=durableobject.d.ts.map
@@ -1,9 +1,5 @@
1
- import { ExportedHandler } from '@cloudflare/workers-types';
1
+ /// <reference types="@cloudflare/workers-types" />
2
2
  import { CloudflareOptions } from './client';
3
- /**
4
- * Extract environment generic from exported handler.
5
- */
6
- type ExtractEnv<P> = P extends ExportedHandler<infer Env> ? Env : never;
7
3
  /**
8
4
  * Wrapper for Cloudflare handlers.
9
5
  *
@@ -15,6 +11,5 @@ type ExtractEnv<P> = P extends ExportedHandler<infer Env> ? Env : never;
15
11
  * @param handler {ExportedHandler} The handler to wrap.
16
12
  * @returns The wrapped handler.
17
13
  */
18
- export declare function withSentry<E extends ExportedHandler<any>>(optionsCallback: (env: ExtractEnv<E>) => CloudflareOptions, handler: E): E;
19
- export {};
14
+ export declare function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown>(optionsCallback: (env: Env) => CloudflareOptions, handler: ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata>): ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata>;
20
15
  //# sourceMappingURL=handler.d.ts.map
@@ -1,7 +1,10 @@
1
1
  export { Breadcrumb, BreadcrumbHint, PolymorphicRequest, RequestEventData, SdkInfo, Event, EventHint, ErrorEvent, Exception, Session, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, } from '@sentry/core';
2
2
  export { CloudflareOptions } from './client';
3
- 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, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, 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, } from '@sentry/core';
3
+ 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, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, 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, } from '@sentry/core';
4
+ import * as logger_1 from './logs/exports';
5
+ export { logger_1 as logger };
4
6
  export { withSentry } from './handler';
7
+ export { instrumentDurableObjectWithSentry } from './durableobject';
5
8
  export { sentryPagesPlugin } from './pages-plugin';
6
9
  export { wrapRequestHandler } from './request';
7
10
  export { CloudflareClient } from './client';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Mark an object as instrumented.
3
+ */
4
+ export declare function markAsInstrumented<T>(obj: T): void;
5
+ /**
6
+ * Check if an object is instrumented.
7
+ */
8
+ export declare function isInstrumented<T>(obj: T): boolean | undefined;
9
+ //# sourceMappingURL=instrument.d.ts.map
@@ -0,0 +1,169 @@
1
+ import { Log, ParameterizedString } from '@sentry/core';
2
+ /**
3
+ * @summary Capture a log with the `trace` level. Requires `_experiments.enableLogs` to be enabled.
4
+ *
5
+ * @param message - The message to log.
6
+ * @param attributes - Arbitrary structured data that stores information about the log - e.g., { userId: 100, route: '/dashboard' }.
7
+ *
8
+ * @example
9
+ *
10
+ * ```
11
+ * Sentry.logger.trace('User clicked submit button', {
12
+ * buttonId: 'submit-form',
13
+ * formId: 'user-profile',
14
+ * timestamp: Date.now()
15
+ * });
16
+ * ```
17
+ *
18
+ * @example With template strings
19
+ *
20
+ * ```
21
+ * Sentry.logger.trace(Sentry.logger.fmt`User ${user} navigated to ${page}`, {
22
+ * userId: '123',
23
+ * sessionId: 'abc-xyz'
24
+ * });
25
+ * ```
26
+ */
27
+ export declare function trace(message: ParameterizedString, attributes?: Log['attributes']): void;
28
+ /**
29
+ * @summary Capture a log with the `debug` level. Requires `_experiments.enableLogs` to be enabled.
30
+ *
31
+ * @param message - The message to log.
32
+ * @param attributes - Arbitrary structured data that stores information about the log - e.g., { component: 'Header', state: 'loading' }.
33
+ *
34
+ * @example
35
+ *
36
+ * ```
37
+ * Sentry.logger.debug('Component mounted', {
38
+ * component: 'UserProfile',
39
+ * props: { userId: 123 },
40
+ * renderTime: 150
41
+ * });
42
+ * ```
43
+ *
44
+ * @example With template strings
45
+ *
46
+ * ```
47
+ * Sentry.logger.debug(Sentry.logger.fmt`API request to ${endpoint} failed`, {
48
+ * statusCode: 404,
49
+ * requestId: 'req-123',
50
+ * duration: 250
51
+ * });
52
+ * ```
53
+ */
54
+ export declare function debug(message: ParameterizedString, attributes?: Log['attributes']): void;
55
+ /**
56
+ * @summary Capture a log with the `info` level. Requires `_experiments.enableLogs` to be enabled.
57
+ *
58
+ * @param message - The message to log.
59
+ * @param attributes - Arbitrary structured data that stores information about the log - e.g., { feature: 'checkout', status: 'completed' }.
60
+ *
61
+ * @example
62
+ *
63
+ * ```
64
+ * Sentry.logger.info('User completed checkout', {
65
+ * orderId: 'order-123',
66
+ * amount: 99.99,
67
+ * paymentMethod: 'credit_card'
68
+ * });
69
+ * ```
70
+ *
71
+ * @example With template strings
72
+ *
73
+ * ```
74
+ * Sentry.logger.info(Sentry.logger.fmt`User ${user} updated profile picture`, {
75
+ * userId: 'user-123',
76
+ * imageSize: '2.5MB',
77
+ * timestamp: Date.now()
78
+ * });
79
+ * ```
80
+ */
81
+ export declare function info(message: ParameterizedString, attributes?: Log['attributes']): void;
82
+ /**
83
+ * @summary Capture a log with the `warn` level. Requires `_experiments.enableLogs` to be enabled.
84
+ *
85
+ * @param message - The message to log.
86
+ * @param attributes - Arbitrary structured data that stores information about the log - e.g., { browser: 'Chrome', version: '91.0' }.
87
+ *
88
+ * @example
89
+ *
90
+ * ```
91
+ * Sentry.logger.warn('Browser compatibility issue detected', {
92
+ * browser: 'Safari',
93
+ * version: '14.0',
94
+ * feature: 'WebRTC',
95
+ * fallback: 'enabled'
96
+ * });
97
+ * ```
98
+ *
99
+ * @example With template strings
100
+ *
101
+ * ```
102
+ * Sentry.logger.warn(Sentry.logger.fmt`API endpoint ${endpoint} is deprecated`, {
103
+ * recommendedEndpoint: '/api/v2/users',
104
+ * sunsetDate: '2024-12-31',
105
+ * clientVersion: '1.2.3'
106
+ * });
107
+ * ```
108
+ */
109
+ export declare function warn(message: ParameterizedString, attributes?: Log['attributes']): void;
110
+ /**
111
+ * @summary Capture a log with the `error` level. Requires `_experiments.enableLogs` to be enabled.
112
+ *
113
+ * @param message - The message to log.
114
+ * @param attributes - Arbitrary structured data that stores information about the log - e.g., { error: 'NetworkError', url: '/api/data' }.
115
+ *
116
+ * @example
117
+ *
118
+ * ```
119
+ * Sentry.logger.error('Failed to load user data', {
120
+ * error: 'NetworkError',
121
+ * url: '/api/users/123',
122
+ * statusCode: 500,
123
+ * retryCount: 3
124
+ * });
125
+ * ```
126
+ *
127
+ * @example With template strings
128
+ *
129
+ * ```
130
+ * Sentry.logger.error(Sentry.logger.fmt`Payment processing failed for order ${orderId}`, {
131
+ * error: 'InsufficientFunds',
132
+ * amount: 100.00,
133
+ * currency: 'USD',
134
+ * userId: 'user-456'
135
+ * });
136
+ * ```
137
+ */
138
+ export declare function error(message: ParameterizedString, attributes?: Log['attributes']): void;
139
+ /**
140
+ * @summary Capture a log with the `fatal` level. Requires `_experiments.enableLogs` to be enabled.
141
+ *
142
+ * @param message - The message to log.
143
+ * @param attributes - Arbitrary structured data that stores information about the log - e.g., { appState: 'corrupted', sessionId: 'abc-123' }.
144
+ *
145
+ * @example
146
+ *
147
+ * ```
148
+ * Sentry.logger.fatal('Application state corrupted', {
149
+ * lastKnownState: 'authenticated',
150
+ * sessionId: 'session-123',
151
+ * timestamp: Date.now(),
152
+ * recoveryAttempted: true
153
+ * });
154
+ * ```
155
+ *
156
+ * @example With template strings
157
+ *
158
+ * ```
159
+ * Sentry.logger.fatal(Sentry.logger.fmt`Critical system failure in ${service}`, {
160
+ * service: 'payment-processor',
161
+ * errorCode: 'CRITICAL_FAILURE',
162
+ * affectedUsers: 150,
163
+ * timestamp: Date.now()
164
+ * });
165
+ * ```
166
+ */
167
+ export declare function fatal(message: ParameterizedString, attributes?: Log['attributes']): void;
168
+ export { fmt } from '@sentry/core';
169
+ //# sourceMappingURL=exports.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { CloudflareOptions } from './client';
2
+ /**
3
+ * Merges the options passed in from the user with the options we read from
4
+ * the Cloudflare `env` environment variable object.
5
+ *
6
+ * @param userOptions - The options passed in from the user.
7
+ * @param env - The environment variables.
8
+ *
9
+ * @returns The final options.
10
+ */
11
+ export declare function getFinalOptions(userOptions: CloudflareOptions, env: unknown): CloudflareOptions;
12
+ //# sourceMappingURL=options.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/cloudflare",
3
- "version": "9.15.0",
3
+ "version": "9.16.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,7 +49,7 @@
49
49
  "access": "public"
50
50
  },
51
51
  "dependencies": {
52
- "@sentry/core": "9.15.0"
52
+ "@sentry/core": "9.16.0"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@cloudflare/workers-types": "^4.x"