@sentry/cloudflare 8.21.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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +99 -0
  3. package/build/cjs/async.js +73 -0
  4. package/build/cjs/async.js.map +1 -0
  5. package/build/cjs/client.js +35 -0
  6. package/build/cjs/client.js.map +1 -0
  7. package/build/cjs/handler.js +126 -0
  8. package/build/cjs/handler.js.map +1 -0
  9. package/build/cjs/index.js +76 -0
  10. package/build/cjs/index.js.map +1 -0
  11. package/build/cjs/integrations/fetch.js +139 -0
  12. package/build/cjs/integrations/fetch.js.map +1 -0
  13. package/build/cjs/sdk.js +42 -0
  14. package/build/cjs/sdk.js.map +1 -0
  15. package/build/cjs/transport.js +97 -0
  16. package/build/cjs/transport.js.map +1 -0
  17. package/build/cjs/vendor/stacktrace.js +49 -0
  18. package/build/cjs/vendor/stacktrace.js.map +1 -0
  19. package/build/esm/async.js +71 -0
  20. package/build/esm/async.js.map +1 -0
  21. package/build/esm/client.js +33 -0
  22. package/build/esm/client.js.map +1 -0
  23. package/build/esm/handler.js +124 -0
  24. package/build/esm/handler.js.map +1 -0
  25. package/build/esm/index.js +6 -0
  26. package/build/esm/index.js.map +1 -0
  27. package/build/esm/integrations/fetch.js +137 -0
  28. package/build/esm/integrations/fetch.js.map +1 -0
  29. package/build/esm/package.json +1 -0
  30. package/build/esm/sdk.js +39 -0
  31. package/build/esm/sdk.js.map +1 -0
  32. package/build/esm/transport.js +94 -0
  33. package/build/esm/transport.js.map +1 -0
  34. package/build/esm/vendor/stacktrace.js +46 -0
  35. package/build/esm/vendor/stacktrace.js.map +1 -0
  36. package/build/types/async.d.ts +8 -0
  37. package/build/types/async.d.ts.map +1 -0
  38. package/build/types/client.d.ts +34 -0
  39. package/build/types/client.d.ts.map +1 -0
  40. package/build/types/debug-build.d.ts +7 -0
  41. package/build/types/debug-build.d.ts.map +1 -0
  42. package/build/types/handler.d.ts +20 -0
  43. package/build/types/handler.d.ts.map +1 -0
  44. package/build/types/index.d.ts +9 -0
  45. package/build/types/index.d.ts.map +1 -0
  46. package/build/types/integrations/fetch.d.ts +17 -0
  47. package/build/types/integrations/fetch.d.ts.map +1 -0
  48. package/build/types/sdk.d.ts +9 -0
  49. package/build/types/sdk.d.ts.map +1 -0
  50. package/build/types/transport.d.ts +37 -0
  51. package/build/types/transport.d.ts.map +1 -0
  52. package/build/types/vendor/stacktrace.d.ts +11 -0
  53. package/build/types/vendor/stacktrace.d.ts.map +1 -0
  54. package/build/types-ts3.8/async.d.ts +8 -0
  55. package/build/types-ts3.8/client.d.ts +34 -0
  56. package/build/types-ts3.8/debug-build.d.ts +7 -0
  57. package/build/types-ts3.8/handler.d.ts +20 -0
  58. package/build/types-ts3.8/index.d.ts +9 -0
  59. package/build/types-ts3.8/integrations/fetch.d.ts +17 -0
  60. package/build/types-ts3.8/sdk.d.ts +9 -0
  61. package/build/types-ts3.8/transport.d.ts +37 -0
  62. package/build/types-ts3.8/vendor/stacktrace.d.ts +11 -0
  63. package/package.json +80 -0
@@ -0,0 +1 @@
1
+ {"type":"module","sideEffects":false}
@@ -0,0 +1,39 @@
1
+ import { dedupeIntegration, inboundFiltersIntegration, functionToStringIntegration, linkedErrorsIntegration, requestDataIntegration, getIntegrationsToSetup, initAndBind } from '@sentry/core';
2
+ import { stackParserFromStackParserOptions } from '@sentry/utils';
3
+ import { CloudflareClient } from './client.js';
4
+ import { fetchIntegration } from './integrations/fetch.js';
5
+ import { makeCloudflareTransport } from './transport.js';
6
+ import { defaultStackParser } from './vendor/stacktrace.js';
7
+
8
+ /** Get the default integrations for the Cloudflare SDK. */
9
+ function getDefaultIntegrations(_options) {
10
+ return [
11
+ dedupeIntegration(),
12
+ inboundFiltersIntegration(),
13
+ functionToStringIntegration(),
14
+ linkedErrorsIntegration(),
15
+ fetchIntegration(),
16
+ requestDataIntegration(),
17
+ ];
18
+ }
19
+
20
+ /**
21
+ * Initializes the cloudflare SDK.
22
+ */
23
+ function init(options) {
24
+ if (options.defaultIntegrations === undefined) {
25
+ options.defaultIntegrations = getDefaultIntegrations();
26
+ }
27
+
28
+ const clientOptions = {
29
+ ...options,
30
+ stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),
31
+ integrations: getIntegrationsToSetup(options),
32
+ transport: options.transport || makeCloudflareTransport,
33
+ };
34
+
35
+ return initAndBind(CloudflareClient, clientOptions) ;
36
+ }
37
+
38
+ export { getDefaultIntegrations, init };
39
+ //# sourceMappingURL=sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import {\n dedupeIntegration,\n functionToStringIntegration,\n getIntegrationsToSetup,\n inboundFiltersIntegration,\n initAndBind,\n linkedErrorsIntegration,\n requestDataIntegration,\n} from '@sentry/core';\nimport type { Integration, Options } from '@sentry/types';\nimport { stackParserFromStackParserOptions } from '@sentry/utils';\nimport type { CloudflareClientOptions } from './client';\nimport { CloudflareClient } from './client';\n\nimport { fetchIntegration } from './integrations/fetch';\nimport { makeCloudflareTransport } from './transport';\nimport { defaultStackParser } from './vendor/stacktrace';\n\n/** Get the default integrations for the Cloudflare SDK. */\nexport function getDefaultIntegrations(_options: Options): Integration[] {\n return [\n dedupeIntegration(),\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n linkedErrorsIntegration(),\n fetchIntegration(),\n requestDataIntegration(),\n ];\n}\n\n/**\n * Initializes the cloudflare SDK.\n */\nexport function init(options: Options): CloudflareClient | undefined {\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = getDefaultIntegrations(options);\n }\n\n const clientOptions: CloudflareClientOptions = {\n ...options,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup(options),\n transport: options.transport || makeCloudflareTransport,\n };\n\n return initAndBind(CloudflareClient, clientOptions) as CloudflareClient;\n}\n"],"names":[],"mappings":";;;;;;;AAkBA;AACO,SAAS,sBAAsB,CAAC,QAAQ,EAA0B;AACzE,EAAE,OAAO;AACT,IAAI,iBAAiB,EAAE;AACvB,IAAI,yBAAyB,EAAE;AAC/B,IAAI,2BAA2B,EAAE;AACjC,IAAI,uBAAuB,EAAE;AAC7B,IAAI,gBAAgB,EAAE;AACtB,IAAI,sBAAsB,EAAE;AAC5B,GAAG,CAAA;AACH,CAAA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAyC;AACrE,EAAE,IAAI,OAAO,CAAC,mBAAoB,KAAI,SAAS,EAAE;AACjD,IAAI,OAAO,CAAC,mBAAA,GAAsB,sBAAsB,CAAQ,CAAC,CAAA;AACjE,GAAE;AACF;AACA,EAAE,MAAM,aAAa,GAA4B;AACjD,IAAI,GAAG,OAAO;AACd,IAAI,WAAW,EAAE,iCAAiC,CAAC,OAAO,CAAC,WAAA,IAAe,kBAAkB,CAAC;AAC7F,IAAI,YAAY,EAAE,sBAAsB,CAAC,OAAO,CAAC;AACjD,IAAI,SAAS,EAAE,OAAO,CAAC,SAAA,IAAa,uBAAuB;AAC3D,GAAG,CAAA;AACH;AACA,EAAE,OAAO,WAAW,CAAC,gBAAgB,EAAE,aAAa,CAAE,EAAA;AACtD;;;;"}
@@ -0,0 +1,94 @@
1
+ import { createTransport } from '@sentry/core';
2
+ import { SentryError } from '@sentry/utils';
3
+
4
+ const DEFAULT_TRANSPORT_BUFFER_SIZE = 30;
5
+
6
+ /**
7
+ * This is a modified promise buffer that collects tasks until drain is called.
8
+ * We need this in the edge runtime because edge function invocations may not share I/O objects, like fetch requests
9
+ * and responses, and the normal PromiseBuffer inherently buffers stuff inbetween incoming requests.
10
+ *
11
+ * A limitation we need to be aware of is that DEFAULT_TRANSPORT_BUFFER_SIZE is the maximum amount of payloads the
12
+ * SDK can send for a given edge function invocation.
13
+ */
14
+ class IsolatedPromiseBuffer {
15
+ // We just have this field because the promise buffer interface requires it.
16
+ // If we ever remove it from the interface we should also remove it here.
17
+
18
+ constructor(_bufferSize = DEFAULT_TRANSPORT_BUFFER_SIZE) {
19
+ this.$ = [];
20
+ this._taskProducers = [];
21
+ this._bufferSize = _bufferSize;
22
+ }
23
+
24
+ /**
25
+ * @inheritdoc
26
+ */
27
+ add(taskProducer) {
28
+ if (this._taskProducers.length >= this._bufferSize) {
29
+ return Promise.reject(new SentryError('Not adding Promise because buffer limit was reached.'));
30
+ }
31
+
32
+ this._taskProducers.push(taskProducer);
33
+ return Promise.resolve({});
34
+ }
35
+
36
+ /**
37
+ * @inheritdoc
38
+ */
39
+ drain(timeout) {
40
+ const oldTaskProducers = [...this._taskProducers];
41
+ this._taskProducers = [];
42
+
43
+ return new Promise(resolve => {
44
+ const timer = setTimeout(() => {
45
+ if (timeout && timeout > 0) {
46
+ resolve(false);
47
+ }
48
+ }, timeout);
49
+
50
+ // This cannot reject
51
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
52
+ Promise.all(
53
+ oldTaskProducers.map(taskProducer =>
54
+ taskProducer().then(null, () => {
55
+ // catch all failed requests
56
+ }),
57
+ ),
58
+ ).then(() => {
59
+ // resolve to true if all fetch requests settled
60
+ clearTimeout(timer);
61
+ resolve(true);
62
+ });
63
+ });
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Creates a Transport that uses the native fetch API to send events to Sentry.
69
+ */
70
+ function makeCloudflareTransport(options) {
71
+ function makeRequest(request) {
72
+ const requestOptions = {
73
+ body: request.body,
74
+ method: 'POST',
75
+ headers: options.headers,
76
+ ...options.fetchOptions,
77
+ };
78
+
79
+ return fetch(options.url, requestOptions).then(response => {
80
+ return {
81
+ statusCode: response.status,
82
+ headers: {
83
+ 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),
84
+ 'retry-after': response.headers.get('Retry-After'),
85
+ },
86
+ };
87
+ });
88
+ }
89
+
90
+ return createTransport(options, makeRequest, new IsolatedPromiseBuffer(options.bufferSize));
91
+ }
92
+
93
+ export { IsolatedPromiseBuffer, makeCloudflareTransport };
94
+ //# sourceMappingURL=transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.js","sources":["../../src/transport.ts"],"sourcesContent":["import { createTransport } from '@sentry/core';\nimport type { BaseTransportOptions, Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/types';\nimport { SentryError } from '@sentry/utils';\n\nexport interface CloudflareTransportOptions extends BaseTransportOptions {\n /** Fetch API init parameters. */\n fetchOptions?: RequestInit;\n /** Custom headers for the transport. */\n headers?: { [key: string]: string };\n}\n\nconst DEFAULT_TRANSPORT_BUFFER_SIZE = 30;\n\n/**\n * This is a modified promise buffer that collects tasks until drain is called.\n * We need this in the edge runtime because edge function invocations may not share I/O objects, like fetch requests\n * and responses, and the normal PromiseBuffer inherently buffers stuff inbetween incoming requests.\n *\n * A limitation we need to be aware of is that DEFAULT_TRANSPORT_BUFFER_SIZE is the maximum amount of payloads the\n * SDK can send for a given edge function invocation.\n */\nexport class IsolatedPromiseBuffer {\n // We just have this field because the promise buffer interface requires it.\n // If we ever remove it from the interface we should also remove it here.\n public $: Array<PromiseLike<TransportMakeRequestResponse>>;\n\n private _taskProducers: (() => PromiseLike<TransportMakeRequestResponse>)[];\n\n private readonly _bufferSize: number;\n\n public constructor(_bufferSize = DEFAULT_TRANSPORT_BUFFER_SIZE) {\n this.$ = [];\n this._taskProducers = [];\n this._bufferSize = _bufferSize;\n }\n\n /**\n * @inheritdoc\n */\n public add(taskProducer: () => PromiseLike<TransportMakeRequestResponse>): PromiseLike<TransportMakeRequestResponse> {\n if (this._taskProducers.length >= this._bufferSize) {\n return Promise.reject(new SentryError('Not adding Promise because buffer limit was reached.'));\n }\n\n this._taskProducers.push(taskProducer);\n return Promise.resolve({});\n }\n\n /**\n * @inheritdoc\n */\n public drain(timeout?: number): PromiseLike<boolean> {\n const oldTaskProducers = [...this._taskProducers];\n this._taskProducers = [];\n\n return new Promise(resolve => {\n const timer = setTimeout(() => {\n if (timeout && timeout > 0) {\n resolve(false);\n }\n }, timeout);\n\n // This cannot reject\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n Promise.all(\n oldTaskProducers.map(taskProducer =>\n taskProducer().then(null, () => {\n // catch all failed requests\n }),\n ),\n ).then(() => {\n // resolve to true if all fetch requests settled\n clearTimeout(timer);\n resolve(true);\n });\n });\n }\n}\n\n/**\n * Creates a Transport that uses the native fetch API to send events to Sentry.\n */\nexport function makeCloudflareTransport(options: CloudflareTransportOptions): Transport {\n function makeRequest(request: TransportRequest): PromiseLike<TransportMakeRequestResponse> {\n const requestOptions: RequestInit = {\n body: request.body,\n method: 'POST',\n headers: options.headers,\n ...options.fetchOptions,\n };\n\n return fetch(options.url, requestOptions).then(response => {\n return {\n statusCode: response.status,\n headers: {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n },\n };\n });\n }\n\n return createTransport(options, makeRequest, new IsolatedPromiseBuffer(options.bufferSize));\n}\n"],"names":[],"mappings":";;;AAWA,MAAM,6BAAA,GAAgC,EAAE,CAAA;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,qBAAsB,CAAA;AACnC;AACA;;AAOA,GAAS,WAAW,CAAC,WAAY,GAAE,6BAA6B,EAAE;AAClE,IAAI,IAAI,CAAC,CAAE,GAAE,EAAE,CAAA;AACf,IAAI,IAAI,CAAC,cAAe,GAAE,EAAE,CAAA;AAC5B,IAAI,IAAI,CAAC,WAAY,GAAE,WAAW,CAAA;AAClC,GAAE;AACF;AACA;AACA;AACA;AACA,GAAS,GAAG,CAAC,YAAY,EAA8F;AACvH,IAAI,IAAI,IAAI,CAAC,cAAc,CAAC,MAAA,IAAU,IAAI,CAAC,WAAW,EAAE;AACxD,MAAM,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,WAAW,CAAC,sDAAsD,CAAC,CAAC,CAAA;AACpG,KAAI;AACJ;AACA,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;AAC1C,IAAI,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;AAC9B,GAAE;AACF;AACA;AACA;AACA;AACA,GAAS,KAAK,CAAC,OAAO,EAAiC;AACvD,IAAI,MAAM,mBAAmB,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,CAAA;AACrD,IAAI,IAAI,CAAC,cAAe,GAAE,EAAE,CAAA;AAC5B;AACA,IAAI,OAAO,IAAI,OAAO,CAAC,WAAW;AAClC,MAAM,MAAM,KAAM,GAAE,UAAU,CAAC,MAAM;AACrC,QAAQ,IAAI,OAAA,IAAW,OAAQ,GAAE,CAAC,EAAE;AACpC,UAAU,OAAO,CAAC,KAAK,CAAC,CAAA;AACxB,SAAQ;AACR,OAAO,EAAE,OAAO,CAAC,CAAA;AACjB;AACA;AACA;AACA,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,gBAAgB,CAAC,GAAG,CAAC,YAAa;AAC1C,UAAU,YAAY,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM;AAC1C;AACA,WAAW,CAAC;AACZ,SAAS;AACT,OAAO,CAAC,IAAI,CAAC,MAAM;AACnB;AACA,QAAQ,YAAY,CAAC,KAAK,CAAC,CAAA;AAC3B,QAAQ,OAAO,CAAC,IAAI,CAAC,CAAA;AACrB,OAAO,CAAC,CAAA;AACR,KAAK,CAAC,CAAA;AACN,GAAE;AACF,CAAA;AACA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,OAAO,EAAyC;AACxF,EAAE,SAAS,WAAW,CAAC,OAAO,EAA+D;AAC7F,IAAI,MAAM,cAAc,GAAgB;AACxC,MAAM,IAAI,EAAE,OAAO,CAAC,IAAI;AACxB,MAAM,MAAM,EAAE,MAAM;AACpB,MAAM,OAAO,EAAE,OAAO,CAAC,OAAO;AAC9B,MAAM,GAAG,OAAO,CAAC,YAAY;AAC7B,KAAK,CAAA;AACL;AACA,IAAI,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC,YAAY;AAC/D,MAAM,OAAO;AACb,QAAQ,UAAU,EAAE,QAAQ,CAAC,MAAM;AACnC,QAAQ,OAAO,EAAE;AACjB,UAAU,sBAAsB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;AAC9E,UAAU,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;AAC5D,SAAS;AACT,OAAO,CAAA;AACP,KAAK,CAAC,CAAA;AACN,GAAE;AACF;AACA,EAAE,OAAO,eAAe,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,qBAAqB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAA;AAC7F;;;;"}
@@ -0,0 +1,46 @@
1
+ import { createStackParser, nodeStackLineParser, basename } from '@sentry/utils';
2
+
3
+ /**
4
+ * Stack line parser for Cloudflare Workers.
5
+ * This wraps node stack parser and adjusts root paths to match with source maps.
6
+ *
7
+ */
8
+ function workersStackLineParser(getModule) {
9
+ const [arg1, arg2] = nodeStackLineParser(getModule);
10
+
11
+ const fn = line => {
12
+ const result = arg2(line);
13
+ if (result) {
14
+ const filename = result.filename;
15
+ // Workers runtime runs a single bundled file that is always in a virtual root
16
+ result.abs_path = filename !== undefined && !filename.startsWith('/') ? `/${filename}` : filename;
17
+ // There is no way to tell what code is in_app and what comes from dependencies (node_modules), since we have one bundled file.
18
+ // So everything is in_app, unless an error comes from runtime function (ie. JSON.parse), which is determined by the presence of filename.
19
+ result.in_app = filename !== undefined;
20
+ }
21
+ return result;
22
+ };
23
+
24
+ return [arg1, fn];
25
+ }
26
+
27
+ /**
28
+ * Gets the module from filename.
29
+ *
30
+ * @param filename
31
+ * @returns Module name
32
+ */
33
+ function getModule(filename) {
34
+ if (!filename) {
35
+ return;
36
+ }
37
+
38
+ // In Cloudflare Workers there is always only one bundled file
39
+ return basename(filename, '.js');
40
+ }
41
+
42
+ /** Cloudflare Workers stack parser */
43
+ const defaultStackParser = createStackParser(workersStackLineParser(getModule));
44
+
45
+ export { defaultStackParser, getModule };
46
+ //# sourceMappingURL=stacktrace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stacktrace.js","sources":["../../../src/vendor/stacktrace.ts"],"sourcesContent":["// Vendored from https://github.com/robertcepa/toucan-js/blob/036568729e49d0a937de527dc32d73580d9a41b3/packages/toucan-js/src/stacktrace.ts\n// MIT License\n\n// Copyright (c) 2022 Robert Cepa\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nimport type { StackLineParser, StackLineParserFn, StackParser } from '@sentry/types';\nimport { basename, createStackParser, nodeStackLineParser } from '@sentry/utils';\n\ntype GetModuleFn = (filename: string | undefined) => string | undefined;\n\n/**\n * Stack line parser for Cloudflare Workers.\n * This wraps node stack parser and adjusts root paths to match with source maps.\n *\n */\nfunction workersStackLineParser(getModule?: GetModuleFn): StackLineParser {\n const [arg1, arg2] = nodeStackLineParser(getModule);\n\n const fn: StackLineParserFn = line => {\n const result = arg2(line);\n if (result) {\n const filename = result.filename;\n // Workers runtime runs a single bundled file that is always in a virtual root\n result.abs_path = filename !== undefined && !filename.startsWith('/') ? `/${filename}` : filename;\n // There is no way to tell what code is in_app and what comes from dependencies (node_modules), since we have one bundled file.\n // So everything is in_app, unless an error comes from runtime function (ie. JSON.parse), which is determined by the presence of filename.\n result.in_app = filename !== undefined;\n }\n return result;\n };\n\n return [arg1, fn];\n}\n\n/**\n * Gets the module from filename.\n *\n * @param filename\n * @returns Module name\n */\nexport function getModule(filename: string | undefined): string | undefined {\n if (!filename) {\n return;\n }\n\n // In Cloudflare Workers there is always only one bundled file\n return basename(filename, '.js');\n}\n\n/** Cloudflare Workers stack parser */\nexport const defaultStackParser: StackParser = createStackParser(workersStackLineParser(getModule));\n"],"names":[],"mappings":";;AA4BA;AACA;AACA;AACA;AACA;AACA,SAAS,sBAAsB,CAAC,SAAS,EAAiC;AAC1E,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,IAAI,mBAAmB,CAAC,SAAS,CAAC,CAAA;AACrD;AACA,EAAE,MAAM,EAAE,GAAsB,QAAQ;AACxC,IAAI,MAAM,MAAO,GAAE,IAAI,CAAC,IAAI,CAAC,CAAA;AAC7B,IAAI,IAAI,MAAM,EAAE;AAChB,MAAM,MAAM,QAAA,GAAW,MAAM,CAAC,QAAQ,CAAA;AACtC;AACA,MAAM,MAAM,CAAC,QAAS,GAAE,aAAa,SAAA,IAAa,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAE,GAAE,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA,GAAA,QAAA,CAAA;AACA;AACA;AACA,MAAA,MAAA,CAAA,MAAA,GAAA,QAAA,KAAA,SAAA,CAAA;AACA,KAAA;AACA,IAAA,OAAA,MAAA,CAAA;AACA,GAAA,CAAA;AACA;AACA,EAAA,OAAA,CAAA,IAAA,EAAA,EAAA,CAAA,CAAA;AACA,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,SAAA,CAAA,QAAA,EAAA;AACA,EAAA,IAAA,CAAA,QAAA,EAAA;AACA,IAAA,OAAA;AACA,GAAA;AACA;AACA;AACA,EAAA,OAAA,QAAA,CAAA,QAAA,EAAA,KAAA,CAAA,CAAA;AACA,CAAA;AACA;AACA;AACA,MAAA,kBAAA,GAAA,iBAAA,CAAA,sBAAA,CAAA,SAAA,CAAA;;;;"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Sets the async context strategy to use AsyncLocalStorage.
3
+ *
4
+ * AsyncLocalStorage is only avalaible in the cloudflare workers runtime if you set
5
+ * compatibility_flags = ["nodejs_compat"] or compatibility_flags = ["nodejs_als"]
6
+ */
7
+ export declare function setAsyncLocalStorageAsyncContextStrategy(): void;
8
+ //# sourceMappingURL=async.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/async.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,wBAAgB,wCAAwC,IAAI,IAAI,CA2D/D"}
@@ -0,0 +1,34 @@
1
+ import { ServerRuntimeClient } from '@sentry/core';
2
+ import type { ClientOptions, Options } from '@sentry/types';
3
+ import type { CloudflareTransportOptions } from './transport';
4
+ /**
5
+ * The Sentry Cloudflare SDK Client.
6
+ *
7
+ * @see CloudflareClientOptions for documentation on configuration options.
8
+ * @see ServerRuntimeClient for usage documentation.
9
+ */
10
+ export declare class CloudflareClient extends ServerRuntimeClient<CloudflareClientOptions> {
11
+ /**
12
+ * Creates a new Cloudflare SDK instance.
13
+ * @param options Configuration options for this SDK.
14
+ */
15
+ constructor(options: CloudflareClientOptions);
16
+ }
17
+ interface BaseCloudflareOptions {
18
+ }
19
+ /**
20
+ * Configuration options for the Sentry Cloudflare SDK
21
+ *
22
+ * @see @sentry/types Options for more information.
23
+ */
24
+ export interface CloudflareOptions extends Options<CloudflareTransportOptions>, BaseCloudflareOptions {
25
+ }
26
+ /**
27
+ * Configuration options for the Sentry Cloudflare SDK Client class
28
+ *
29
+ * @see CloudflareClient for more information.
30
+ */
31
+ export interface CloudflareClientOptions extends ClientOptions<CloudflareTransportOptions>, BaseCloudflareOptions {
32
+ }
33
+ export {};
34
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAoB,MAAM,cAAc,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,mBAAmB,CAAC,uBAAuB,CAAC;IAChF;;;OAGG;gBACgB,OAAO,EAAE,uBAAuB;CAcpD;AAGD,UAAU,qBAAqB;CAAG;AAElC;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,OAAO,CAAC,0BAA0B,CAAC,EAAE,qBAAqB;CAAG;AAExG;;;;GAIG;AACH,MAAM,WAAW,uBAAwB,SAAQ,aAAa,CAAC,0BAA0B,CAAC,EAAE,qBAAqB;CAAG"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
3
+ *
4
+ * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
5
+ */
6
+ export declare const DEBUG_BUILD: boolean;
7
+ //# sourceMappingURL=debug-build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-build.d.ts","sourceRoot":"","sources":["../../src/debug-build.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,WAAW,SAAkB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { ExportedHandler } from '@cloudflare/workers-types';
2
+ import type { Options } from '@sentry/types';
3
+ /**
4
+ * Extract environment generic from exported handler.
5
+ */
6
+ type ExtractEnv<P> = P extends ExportedHandler<infer Env> ? Env : never;
7
+ /**
8
+ * Wrapper for Cloudflare handlers.
9
+ *
10
+ * Initializes the SDK and wraps the handler with Sentry instrumentation.
11
+ *
12
+ * Automatically instruments the `fetch` method of the handler.
13
+ *
14
+ * @param optionsCallback Function that returns the options for the SDK initialization.
15
+ * @param handler {ExportedHandler} The handler to wrap.
16
+ * @returns The wrapped handler.
17
+ */
18
+ export declare function withSentry<E extends ExportedHandler<any>>(optionsCallback: (env: ExtractEnv<E>) => Options, handler: E): E;
19
+ export {};
20
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,2BAA2B,CAAC;AAYnC,OAAO,KAAK,EAAE,OAAO,EAAyB,MAAM,eAAe,CAAC;AAKpE;;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,OAAO,EAChD,OAAO,EAAE,CAAC,GACT,CAAC,CAgFH"}
@@ -0,0 +1,9 @@
1
+ export type { Breadcrumb, BreadcrumbHint, PolymorphicRequest, Request, SdkInfo, Event, EventHint, ErrorEvent, Exception, Session, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, } from '@sentry/types';
2
+ export type { AddRequestDataToEventOptions } from '@sentry/utils';
3
+ export type { 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';
5
+ export { withSentry } from './handler';
6
+ export { CloudflareClient } from './client';
7
+ export { getDefaultIntegrations } from './sdk';
8
+ export { fetchIntegration } from './integrations/fetch';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,OAAO,EACP,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,eAAe,CAAC;AACvB,YAAY,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAElE,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,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,OAAO,EACP,2BAA2B,EAC3B,yBAAyB,EACzB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACpB,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,EAChC,qCAAqC,EACrC,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,17 @@
1
+ export interface Options {
2
+ /**
3
+ * Whether breadcrumbs should be recorded for requests
4
+ * Defaults to true
5
+ */
6
+ breadcrumbs: boolean;
7
+ /**
8
+ * Function determining whether or not to create spans to track outgoing requests to the given URL.
9
+ * By default, spans will be created for all outgoing requests.
10
+ */
11
+ shouldCreateSpanForRequest?: (url: string) => boolean;
12
+ }
13
+ /**
14
+ * Creates spans and attaches tracing headers to fetch requests.
15
+ */
16
+ export declare const fetchIntegration: (options?: Partial<Options> | undefined) => import("@sentry/types").Integration;
17
+ //# sourceMappingURL=fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/integrations/fetch.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,OAAO;IACtB;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,0BAA0B,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;CACvD;AA6ED;;GAEG;AACH,eAAO,MAAM,gBAAgB,iFAAuC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Integration, Options } from '@sentry/types';
2
+ import { CloudflareClient } from './client';
3
+ /** Get the default integrations for the Cloudflare SDK. */
4
+ export declare function getDefaultIntegrations(_options: Options): Integration[];
5
+ /**
6
+ * Initializes the cloudflare SDK.
7
+ */
8
+ export declare function init(options: Options): CloudflareClient | undefined;
9
+ //# sourceMappingURL=sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAM5C,2DAA2D;AAC3D,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,OAAO,GAAG,WAAW,EAAE,CASvE;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,GAAG,SAAS,CAanE"}
@@ -0,0 +1,37 @@
1
+ /// <reference types="@cloudflare/workers-types" />
2
+ import type { BaseTransportOptions, Transport, TransportMakeRequestResponse } from '@sentry/types';
3
+ export interface CloudflareTransportOptions extends BaseTransportOptions {
4
+ /** Fetch API init parameters. */
5
+ fetchOptions?: RequestInit;
6
+ /** Custom headers for the transport. */
7
+ headers?: {
8
+ [key: string]: string;
9
+ };
10
+ }
11
+ /**
12
+ * This is a modified promise buffer that collects tasks until drain is called.
13
+ * We need this in the edge runtime because edge function invocations may not share I/O objects, like fetch requests
14
+ * and responses, and the normal PromiseBuffer inherently buffers stuff inbetween incoming requests.
15
+ *
16
+ * A limitation we need to be aware of is that DEFAULT_TRANSPORT_BUFFER_SIZE is the maximum amount of payloads the
17
+ * SDK can send for a given edge function invocation.
18
+ */
19
+ export declare class IsolatedPromiseBuffer {
20
+ $: Array<PromiseLike<TransportMakeRequestResponse>>;
21
+ private _taskProducers;
22
+ private readonly _bufferSize;
23
+ constructor(_bufferSize?: number);
24
+ /**
25
+ * @inheritdoc
26
+ */
27
+ add(taskProducer: () => PromiseLike<TransportMakeRequestResponse>): PromiseLike<TransportMakeRequestResponse>;
28
+ /**
29
+ * @inheritdoc
30
+ */
31
+ drain(timeout?: number): PromiseLike<boolean>;
32
+ }
33
+ /**
34
+ * Creates a Transport that uses the native fetch API to send events to Sentry.
35
+ */
36
+ export declare function makeCloudflareTransport(options: CloudflareTransportOptions): Transport;
37
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/transport.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,4BAA4B,EAAoB,MAAM,eAAe,CAAC;AAGrH,MAAM,WAAW,0BAA2B,SAAQ,oBAAoB;IACtE,iCAAiC;IACjC,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,wCAAwC;IACxC,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACrC;AAID;;;;;;;GAOG;AACH,qBAAa,qBAAqB;IAGzB,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC,CAAC;IAE3D,OAAO,CAAC,cAAc,CAAsD;IAE5E,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;gBAElB,WAAW,SAAgC;IAM9D;;OAEG;IACI,GAAG,CAAC,YAAY,EAAE,MAAM,WAAW,CAAC,4BAA4B,CAAC,GAAG,WAAW,CAAC,4BAA4B,CAAC;IASpH;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC;CA0BrD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,0BAA0B,GAAG,SAAS,CAqBtF"}
@@ -0,0 +1,11 @@
1
+ import type { StackParser } from '@sentry/types';
2
+ /**
3
+ * Gets the module from filename.
4
+ *
5
+ * @param filename
6
+ * @returns Module name
7
+ */
8
+ export declare function getModule(filename: string | undefined): string | undefined;
9
+ /** Cloudflare Workers stack parser */
10
+ export declare const defaultStackParser: StackParser;
11
+ //# sourceMappingURL=stacktrace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stacktrace.d.ts","sourceRoot":"","sources":["../../../src/vendor/stacktrace.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAsC,WAAW,EAAE,MAAM,eAAe,CAAC;AA6BrF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAO1E;AAED,sCAAsC;AACtC,eAAO,MAAM,kBAAkB,EAAE,WAAkE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Sets the async context strategy to use AsyncLocalStorage.
3
+ *
4
+ * AsyncLocalStorage is only avalaible in the cloudflare workers runtime if you set
5
+ * compatibility_flags = ["nodejs_compat"] or compatibility_flags = ["nodejs_als"]
6
+ */
7
+ export declare function setAsyncLocalStorageAsyncContextStrategy(): void;
8
+ //# sourceMappingURL=async.d.ts.map
@@ -0,0 +1,34 @@
1
+ import { ServerRuntimeClient } from '@sentry/core';
2
+ import { ClientOptions, Options } from '@sentry/types';
3
+ import { CloudflareTransportOptions } from './transport';
4
+ /**
5
+ * The Sentry Cloudflare SDK Client.
6
+ *
7
+ * @see CloudflareClientOptions for documentation on configuration options.
8
+ * @see ServerRuntimeClient for usage documentation.
9
+ */
10
+ export declare class CloudflareClient extends ServerRuntimeClient<CloudflareClientOptions> {
11
+ /**
12
+ * Creates a new Cloudflare SDK instance.
13
+ * @param options Configuration options for this SDK.
14
+ */
15
+ constructor(options: CloudflareClientOptions);
16
+ }
17
+ interface BaseCloudflareOptions {
18
+ }
19
+ /**
20
+ * Configuration options for the Sentry Cloudflare SDK
21
+ *
22
+ * @see @sentry/types Options for more information.
23
+ */
24
+ export interface CloudflareOptions extends Options<CloudflareTransportOptions>, BaseCloudflareOptions {
25
+ }
26
+ /**
27
+ * Configuration options for the Sentry Cloudflare SDK Client class
28
+ *
29
+ * @see CloudflareClient for more information.
30
+ */
31
+ export interface CloudflareClientOptions extends ClientOptions<CloudflareTransportOptions>, BaseCloudflareOptions {
32
+ }
33
+ export {};
34
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
3
+ *
4
+ * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
5
+ */
6
+ export declare const DEBUG_BUILD: boolean;
7
+ //# sourceMappingURL=debug-build.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { ExportedHandler } from '@cloudflare/workers-types';
2
+ import { Options } from '@sentry/types';
3
+ /**
4
+ * Extract environment generic from exported handler.
5
+ */
6
+ type ExtractEnv<P> = P extends ExportedHandler<infer Env> ? Env : never;
7
+ /**
8
+ * Wrapper for Cloudflare handlers.
9
+ *
10
+ * Initializes the SDK and wraps the handler with Sentry instrumentation.
11
+ *
12
+ * Automatically instruments the `fetch` method of the handler.
13
+ *
14
+ * @param optionsCallback Function that returns the options for the SDK initialization.
15
+ * @param handler {ExportedHandler} The handler to wrap.
16
+ * @returns The wrapped handler.
17
+ */
18
+ export declare function withSentry<E extends ExportedHandler<any>>(optionsCallback: (env: ExtractEnv<E>) => Options, handler: E): E;
19
+ export {};
20
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1,9 @@
1
+ export { Breadcrumb, BreadcrumbHint, PolymorphicRequest, Request, SdkInfo, Event, EventHint, ErrorEvent, Exception, Session, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, } from '@sentry/types';
2
+ export { AddRequestDataToEventOptions } from '@sentry/utils';
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';
5
+ export { withSentry } from './handler';
6
+ export { CloudflareClient } from './client';
7
+ export { getDefaultIntegrations } from './sdk';
8
+ export { fetchIntegration } from './integrations/fetch';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,17 @@
1
+ export interface Options {
2
+ /**
3
+ * Whether breadcrumbs should be recorded for requests
4
+ * Defaults to true
5
+ */
6
+ breadcrumbs: boolean;
7
+ /**
8
+ * Function determining whether or not to create spans to track outgoing requests to the given URL.
9
+ * By default, spans will be created for all outgoing requests.
10
+ */
11
+ shouldCreateSpanForRequest?: (url: string) => boolean;
12
+ }
13
+ /**
14
+ * Creates spans and attaches tracing headers to fetch requests.
15
+ */
16
+ export declare const fetchIntegration: (options?: Partial<Options> | undefined) => import("@sentry/types").Integration;
17
+ //# sourceMappingURL=fetch.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { Integration, Options } from '@sentry/types';
2
+ import { CloudflareClient } from './client';
3
+ /** Get the default integrations for the Cloudflare SDK. */
4
+ export declare function getDefaultIntegrations(_options: Options): Integration[];
5
+ /**
6
+ * Initializes the cloudflare SDK.
7
+ */
8
+ export declare function init(options: Options): CloudflareClient | undefined;
9
+ //# sourceMappingURL=sdk.d.ts.map
@@ -0,0 +1,37 @@
1
+ /// <reference types="@cloudflare/workers-types" />
2
+ import { BaseTransportOptions, Transport, TransportMakeRequestResponse } from '@sentry/types';
3
+ export interface CloudflareTransportOptions extends BaseTransportOptions {
4
+ /** Fetch API init parameters. */
5
+ fetchOptions?: RequestInit;
6
+ /** Custom headers for the transport. */
7
+ headers?: {
8
+ [key: string]: string;
9
+ };
10
+ }
11
+ /**
12
+ * This is a modified promise buffer that collects tasks until drain is called.
13
+ * We need this in the edge runtime because edge function invocations may not share I/O objects, like fetch requests
14
+ * and responses, and the normal PromiseBuffer inherently buffers stuff inbetween incoming requests.
15
+ *
16
+ * A limitation we need to be aware of is that DEFAULT_TRANSPORT_BUFFER_SIZE is the maximum amount of payloads the
17
+ * SDK can send for a given edge function invocation.
18
+ */
19
+ export declare class IsolatedPromiseBuffer {
20
+ $: Array<PromiseLike<TransportMakeRequestResponse>>;
21
+ private _taskProducers;
22
+ private readonly _bufferSize;
23
+ constructor(_bufferSize?: number);
24
+ /**
25
+ * @inheritdoc
26
+ */
27
+ add(taskProducer: () => PromiseLike<TransportMakeRequestResponse>): PromiseLike<TransportMakeRequestResponse>;
28
+ /**
29
+ * @inheritdoc
30
+ */
31
+ drain(timeout?: number): PromiseLike<boolean>;
32
+ }
33
+ /**
34
+ * Creates a Transport that uses the native fetch API to send events to Sentry.
35
+ */
36
+ export declare function makeCloudflareTransport(options: CloudflareTransportOptions): Transport;
37
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { StackParser } from '@sentry/types';
2
+ /**
3
+ * Gets the module from filename.
4
+ *
5
+ * @param filename
6
+ * @returns Module name
7
+ */
8
+ export declare function getModule(filename: string | undefined): string | undefined;
9
+ /** Cloudflare Workers stack parser */
10
+ export declare const defaultStackParser: StackParser;
11
+ //# sourceMappingURL=stacktrace.d.ts.map