@sentry/cloudflare 10.34.0 → 10.35.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.
@@ -1,9 +1,26 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
+ /**
4
+ * Cloudflare's version metadata binding structure.
5
+ * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/version-metadata/
6
+ */
7
+
8
+ /**
9
+ * Checks if the value is a valid CF_VERSION_METADATA binding.
10
+ */
11
+ function isVersionMetadata(value) {
12
+ return typeof value === 'object' && value !== null && 'id' in value && typeof value.id === 'string';
13
+ }
14
+
3
15
  /**
4
16
  * Merges the options passed in from the user with the options we read from
5
17
  * the Cloudflare `env` environment variable object.
6
18
  *
19
+ * Release is determined with the following priority (highest to lowest):
20
+ * 1. User-provided release option
21
+ * 2. SENTRY_RELEASE environment variable
22
+ * 3. CF_VERSION_METADATA.id binding (if configured in the wrangler config)
23
+ *
7
24
  * @param userOptions - The options passed in from the user.
8
25
  * @param env - The environment variables.
9
26
  *
@@ -14,7 +31,13 @@ function getFinalOptions(userOptions, env) {
14
31
  return userOptions;
15
32
  }
16
33
 
17
- const release = 'SENTRY_RELEASE' in env && typeof env.SENTRY_RELEASE === 'string' ? env.SENTRY_RELEASE : undefined;
34
+ // Priority: userOptions.release > SENTRY_RELEASE > CF_VERSION_METADATA.id
35
+ const release =
36
+ 'SENTRY_RELEASE' in env && typeof env.SENTRY_RELEASE === 'string'
37
+ ? env.SENTRY_RELEASE
38
+ : 'CF_VERSION_METADATA' in env && isVersionMetadata(env.CF_VERSION_METADATA)
39
+ ? env.CF_VERSION_METADATA.id
40
+ : undefined;
18
41
 
19
42
  return { release, ...userOptions };
20
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sources":["../../src/options.ts"],"sourcesContent":["import type { CloudflareOptions } from './client';\n\n/**\n * Merges the options passed in from the user with the options we read from\n * the Cloudflare `env` environment variable object.\n *\n * @param userOptions - The options passed in from the user.\n * @param env - The environment variables.\n *\n * @returns The final options.\n */\nexport function getFinalOptions(userOptions: CloudflareOptions, env: unknown): CloudflareOptions {\n if (typeof env !== 'object' || env === null) {\n return userOptions;\n }\n\n const release = 'SENTRY_RELEASE' in env && typeof env.SENTRY_RELEASE === 'string' ? env.SENTRY_RELEASE : undefined;\n\n return { release, ...userOptions };\n}\n"],"names":[],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,WAAW,EAAqB,GAAG,EAA8B;AACjG,EAAE,IAAI,OAAO,GAAA,KAAQ,YAAY,GAAA,KAAQ,IAAI,EAAE;AAC/C,IAAI,OAAO,WAAW;AACtB,EAAE;;AAEF,EAAE,MAAM,OAAA,GAAU,oBAAoB,GAAA,IAAO,OAAO,GAAG,CAAC,cAAA,KAAmB,QAAA,GAAW,GAAG,CAAC,cAAA,GAAiB,SAAS;;AAEpH,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,aAAa;AACpC;;;;"}
1
+ {"version":3,"file":"options.js","sources":["../../src/options.ts"],"sourcesContent":["import type { CloudflareOptions } from './client';\n\n/**\n * Cloudflare's version metadata binding structure.\n * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/version-metadata/\n */\ninterface CfVersionMetadata {\n id: string;\n tag?: string;\n timestamp?: string;\n}\n\n/**\n * Checks if the value is a valid CF_VERSION_METADATA binding.\n */\nfunction isVersionMetadata(value: unknown): value is CfVersionMetadata {\n return typeof value === 'object' && value !== null && 'id' in value && typeof value.id === 'string';\n}\n\n/**\n * Merges the options passed in from the user with the options we read from\n * the Cloudflare `env` environment variable object.\n *\n * Release is determined with the following priority (highest to lowest):\n * 1. User-provided release option\n * 2. SENTRY_RELEASE environment variable\n * 3. CF_VERSION_METADATA.id binding (if configured in the wrangler config)\n *\n * @param userOptions - The options passed in from the user.\n * @param env - The environment variables.\n *\n * @returns The final options.\n */\nexport function getFinalOptions(userOptions: CloudflareOptions, env: unknown): CloudflareOptions {\n if (typeof env !== 'object' || env === null) {\n return userOptions;\n }\n\n // Priority: userOptions.release > SENTRY_RELEASE > CF_VERSION_METADATA.id\n const release =\n 'SENTRY_RELEASE' in env && typeof env.SENTRY_RELEASE === 'string'\n ? env.SENTRY_RELEASE\n : 'CF_VERSION_METADATA' in env && isVersionMetadata(env.CF_VERSION_METADATA)\n ? env.CF_VERSION_METADATA.id\n : undefined;\n\n return { release, ...userOptions };\n}\n"],"names":[],"mappings":";;AAEA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA,SAAS,iBAAiB,CAAC,KAAK,EAAuC;AACvE,EAAE,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,UAAU,IAAA,IAAQ,IAAA,IAAQ,SAAS,OAAO,KAAK,CAAC,EAAA,KAAO,QAAQ;AACrG;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,WAAW,EAAqB,GAAG,EAA8B;AACjG,EAAE,IAAI,OAAO,GAAA,KAAQ,YAAY,GAAA,KAAQ,IAAI,EAAE;AAC/C,IAAI,OAAO,WAAW;AACtB,EAAE;;AAEF;AACA,EAAE,MAAM,OAAA;AACR,IAAI,gBAAA,IAAoB,GAAA,IAAO,OAAO,GAAG,CAAC,mBAAmB;AAC7D,QAAQ,GAAG,CAAC;AACZ,QAAQ,yBAAyB,GAAA,IAAO,iBAAiB,CAAC,GAAG,CAAC,mBAAmB;AACjF,UAAU,GAAG,CAAC,mBAAmB,CAAC;AAClC,UAAU,SAAS;;AAEnB,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,aAAa;AACpC;;;;"}
@@ -1,7 +1,24 @@
1
+ /**
2
+ * Cloudflare's version metadata binding structure.
3
+ * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/version-metadata/
4
+ */
5
+
6
+ /**
7
+ * Checks if the value is a valid CF_VERSION_METADATA binding.
8
+ */
9
+ function isVersionMetadata(value) {
10
+ return typeof value === 'object' && value !== null && 'id' in value && typeof value.id === 'string';
11
+ }
12
+
1
13
  /**
2
14
  * Merges the options passed in from the user with the options we read from
3
15
  * the Cloudflare `env` environment variable object.
4
16
  *
17
+ * Release is determined with the following priority (highest to lowest):
18
+ * 1. User-provided release option
19
+ * 2. SENTRY_RELEASE environment variable
20
+ * 3. CF_VERSION_METADATA.id binding (if configured in the wrangler config)
21
+ *
5
22
  * @param userOptions - The options passed in from the user.
6
23
  * @param env - The environment variables.
7
24
  *
@@ -12,7 +29,13 @@ function getFinalOptions(userOptions, env) {
12
29
  return userOptions;
13
30
  }
14
31
 
15
- const release = 'SENTRY_RELEASE' in env && typeof env.SENTRY_RELEASE === 'string' ? env.SENTRY_RELEASE : undefined;
32
+ // Priority: userOptions.release > SENTRY_RELEASE > CF_VERSION_METADATA.id
33
+ const release =
34
+ 'SENTRY_RELEASE' in env && typeof env.SENTRY_RELEASE === 'string'
35
+ ? env.SENTRY_RELEASE
36
+ : 'CF_VERSION_METADATA' in env && isVersionMetadata(env.CF_VERSION_METADATA)
37
+ ? env.CF_VERSION_METADATA.id
38
+ : undefined;
16
39
 
17
40
  return { release, ...userOptions };
18
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sources":["../../src/options.ts"],"sourcesContent":["import type { CloudflareOptions } from './client';\n\n/**\n * Merges the options passed in from the user with the options we read from\n * the Cloudflare `env` environment variable object.\n *\n * @param userOptions - The options passed in from the user.\n * @param env - The environment variables.\n *\n * @returns The final options.\n */\nexport function getFinalOptions(userOptions: CloudflareOptions, env: unknown): CloudflareOptions {\n if (typeof env !== 'object' || env === null) {\n return userOptions;\n }\n\n const release = 'SENTRY_RELEASE' in env && typeof env.SENTRY_RELEASE === 'string' ? env.SENTRY_RELEASE : undefined;\n\n return { release, ...userOptions };\n}\n"],"names":[],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,WAAW,EAAqB,GAAG,EAA8B;AACjG,EAAE,IAAI,OAAO,GAAA,KAAQ,YAAY,GAAA,KAAQ,IAAI,EAAE;AAC/C,IAAI,OAAO,WAAW;AACtB,EAAE;;AAEF,EAAE,MAAM,OAAA,GAAU,oBAAoB,GAAA,IAAO,OAAO,GAAG,CAAC,cAAA,KAAmB,QAAA,GAAW,GAAG,CAAC,cAAA,GAAiB,SAAS;;AAEpH,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,aAAa;AACpC;;;;"}
1
+ {"version":3,"file":"options.js","sources":["../../src/options.ts"],"sourcesContent":["import type { CloudflareOptions } from './client';\n\n/**\n * Cloudflare's version metadata binding structure.\n * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/version-metadata/\n */\ninterface CfVersionMetadata {\n id: string;\n tag?: string;\n timestamp?: string;\n}\n\n/**\n * Checks if the value is a valid CF_VERSION_METADATA binding.\n */\nfunction isVersionMetadata(value: unknown): value is CfVersionMetadata {\n return typeof value === 'object' && value !== null && 'id' in value && typeof value.id === 'string';\n}\n\n/**\n * Merges the options passed in from the user with the options we read from\n * the Cloudflare `env` environment variable object.\n *\n * Release is determined with the following priority (highest to lowest):\n * 1. User-provided release option\n * 2. SENTRY_RELEASE environment variable\n * 3. CF_VERSION_METADATA.id binding (if configured in the wrangler config)\n *\n * @param userOptions - The options passed in from the user.\n * @param env - The environment variables.\n *\n * @returns The final options.\n */\nexport function getFinalOptions(userOptions: CloudflareOptions, env: unknown): CloudflareOptions {\n if (typeof env !== 'object' || env === null) {\n return userOptions;\n }\n\n // Priority: userOptions.release > SENTRY_RELEASE > CF_VERSION_METADATA.id\n const release =\n 'SENTRY_RELEASE' in env && typeof env.SENTRY_RELEASE === 'string'\n ? env.SENTRY_RELEASE\n : 'CF_VERSION_METADATA' in env && isVersionMetadata(env.CF_VERSION_METADATA)\n ? env.CF_VERSION_METADATA.id\n : undefined;\n\n return { release, ...userOptions };\n}\n"],"names":[],"mappings":"AAEA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA,SAAS,iBAAiB,CAAC,KAAK,EAAuC;AACvE,EAAE,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,UAAU,IAAA,IAAQ,IAAA,IAAQ,SAAS,OAAO,KAAK,CAAC,EAAA,KAAO,QAAQ;AACrG;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,WAAW,EAAqB,GAAG,EAA8B;AACjG,EAAE,IAAI,OAAO,GAAA,KAAQ,YAAY,GAAA,KAAQ,IAAI,EAAE;AAC/C,IAAI,OAAO,WAAW;AACtB,EAAE;;AAEF;AACA,EAAE,MAAM,OAAA;AACR,IAAI,gBAAA,IAAoB,GAAA,IAAO,OAAO,GAAG,CAAC,mBAAmB;AAC7D,QAAQ,GAAG,CAAC;AACZ,QAAQ,yBAAyB,GAAA,IAAO,iBAAiB,CAAC,GAAG,CAAC,mBAAmB;AACjF,UAAU,GAAG,CAAC,mBAAmB,CAAC;AAClC,UAAU,SAAS;;AAEnB,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,aAAa;AACpC;;;;"}
@@ -1 +1 @@
1
- {"type":"module","version":"10.34.0","sideEffects":false}
1
+ {"type":"module","version":"10.35.0","sideEffects":false}
@@ -3,6 +3,11 @@ import type { CloudflareOptions } from './client';
3
3
  * Merges the options passed in from the user with the options we read from
4
4
  * the Cloudflare `env` environment variable object.
5
5
  *
6
+ * Release is determined with the following priority (highest to lowest):
7
+ * 1. User-provided release option
8
+ * 2. SENTRY_RELEASE environment variable
9
+ * 3. CF_VERSION_METADATA.id binding (if configured in the wrangler config)
10
+ *
6
11
  * @param userOptions - The options passed in from the user.
7
12
  * @param env - The environment variables.
8
13
  *
@@ -1 +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
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAmBlD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,iBAAiB,EAAE,GAAG,EAAE,OAAO,GAAG,iBAAiB,CAc/F"}
@@ -3,6 +3,11 @@ import { CloudflareOptions } from './client';
3
3
  * Merges the options passed in from the user with the options we read from
4
4
  * the Cloudflare `env` environment variable object.
5
5
  *
6
+ * Release is determined with the following priority (highest to lowest):
7
+ * 1. User-provided release option
8
+ * 2. SENTRY_RELEASE environment variable
9
+ * 3. CF_VERSION_METADATA.id binding (if configured in the wrangler config)
10
+ *
6
11
  * @param userOptions - The options passed in from the user.
7
12
  * @param env - The environment variables.
8
13
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/cloudflare",
3
- "version": "10.34.0",
3
+ "version": "10.35.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",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@opentelemetry/api": "^1.9.0",
53
- "@sentry/core": "10.34.0"
53
+ "@sentry/core": "10.35.0"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@cloudflare/workers-types": "^4.x"