wrangler 4.5.1 → 4.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.5.1",
3
+ "version": "4.6.0",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -135,8 +135,8 @@
135
135
  "xdg-app-paths": "^8.3.0",
136
136
  "xxhash-wasm": "^1.0.1",
137
137
  "yargs": "^17.7.2",
138
- "@cloudflare/eslint-config-worker": "1.1.0",
139
138
  "@cloudflare/cli": "1.1.1",
139
+ "@cloudflare/eslint-config-worker": "1.1.0",
140
140
  "@cloudflare/pages-shared": "^0.13.20",
141
141
  "@cloudflare/workers-shared": "0.17.1",
142
142
  "@cloudflare/workers-tsconfig": "0.0.0"
@@ -81185,7 +81185,7 @@ var import_undici3 = __toESM(require_undici());
81185
81185
 
81186
81186
  // package.json
81187
81187
  var name = "wrangler";
81188
- var version = "4.5.1";
81188
+ var version = "4.6.0";
81189
81189
 
81190
81190
  // src/environment-variables/misc-variables.ts
81191
81191
  init_import_meta_url();
@@ -101782,6 +101782,24 @@ async function putR2Sippy(accountId, bucketName, params, jurisdiction) {
101782
101782
  );
101783
101783
  }
101784
101784
  __name(putR2Sippy, "putR2Sippy");
101785
+ async function getR2Catalog(accountId, bucketName) {
101786
+ return await fetchResult(`/accounts/${accountId}/r2-catalog/${bucketName}`, {
101787
+ method: "GET"
101788
+ });
101789
+ }
101790
+ __name(getR2Catalog, "getR2Catalog");
101791
+ async function enableR2Catalog(accountId, bucketName) {
101792
+ return await fetchResult(`/accounts/${accountId}/r2-catalog/${bucketName}`, {
101793
+ method: "POST"
101794
+ });
101795
+ }
101796
+ __name(enableR2Catalog, "enableR2Catalog");
101797
+ async function disableR2Catalog(accountId, bucketName) {
101798
+ return await fetchResult(`/accounts/${accountId}/r2-catalog/${bucketName}`, {
101799
+ method: "DELETE"
101800
+ });
101801
+ }
101802
+ __name(disableR2Catalog, "disableR2Catalog");
101785
101803
  var actionsForEventCategories = {
101786
101804
  "object-create": ["PutObject", "CompleteMultipartUpload", "CopyObject"],
101787
101805
  "object-delete": ["DeleteObject", "LifecycleDeletion"]
@@ -117459,6 +117477,26 @@ function capitalizeScheme(scheme) {
117459
117477
  }
117460
117478
  }
117461
117479
  __name(capitalizeScheme, "capitalizeScheme");
117480
+ function formatCachingOptions(cachingOptions) {
117481
+ switch (cachingOptions?.disabled) {
117482
+ case false: {
117483
+ if (cachingOptions.stale_while_revalidate === 0) {
117484
+ return `max_age: ${cachingOptions.max_age}, stale_while_revalidate: disabled`;
117485
+ } else {
117486
+ return `max_age: ${cachingOptions.max_age}, stale_while_revalidate: ${cachingOptions.stale_while_revalidate}`;
117487
+ }
117488
+ }
117489
+ case void 0: {
117490
+ return "enabled";
117491
+ }
117492
+ case true: {
117493
+ return "disabled";
117494
+ }
117495
+ default:
117496
+ return JSON.stringify(cachingOptions);
117497
+ }
117498
+ }
117499
+ __name(formatCachingOptions, "formatCachingOptions");
117462
117500
 
117463
117501
  // src/hyperdrive/create.ts
117464
117502
  function options4(commonYargs) {
@@ -117554,7 +117592,7 @@ async function handler7(args) {
117554
117592
  port: database.origin.port?.toString() ?? "",
117555
117593
  scheme: capitalizeScheme(database.origin.scheme),
117556
117594
  database: database.origin.database ?? "",
117557
- caching: JSON.stringify(database.caching),
117595
+ caching: formatCachingOptions(database.caching),
117558
117596
  mtls: JSON.stringify(database.mtls)
117559
117597
  }))
117560
117598
  );
@@ -131013,6 +131051,121 @@ var r2BucketDeleteCommand = createCommand({
131013
131051
  }
131014
131052
  });
131015
131053
 
131054
+ // src/r2/catalog.ts
131055
+ init_import_meta_url();
131056
+ var r2BucketCatalogNamespace = createNamespace({
131057
+ metadata: {
131058
+ description: "Manage the data catalog for your R2 buckets - provides an Iceberg REST interface for query engines like Spark, DuckDB, and Trino",
131059
+ status: "open-beta",
131060
+ owner: "Product: R2 Data Catalog"
131061
+ }
131062
+ });
131063
+ var r2BucketCatalogEnableCommand = createCommand({
131064
+ metadata: {
131065
+ description: "Enable the data catalog on an R2 bucket",
131066
+ status: "open-beta",
131067
+ owner: "Product: R2 Data Catalog"
131068
+ },
131069
+ positionalArgs: ["bucket"],
131070
+ args: {
131071
+ bucket: {
131072
+ describe: "The name of the bucket to enable",
131073
+ type: "string",
131074
+ demandOption: true
131075
+ }
131076
+ },
131077
+ async handler(args, { config }) {
131078
+ const accountId = await requireAuth(config);
131079
+ const response = await enableR2Catalog(accountId, args.bucket);
131080
+ let catalogHost;
131081
+ const env6 = getCloudflareApiEnvironmentFromEnv();
131082
+ if (env6 === "staging") {
131083
+ catalogHost = `https://catalog-staging.cloudflarestorage.com/${response.name}`;
131084
+ } else {
131085
+ catalogHost = `https://catalog.cloudflarestorage.com/${response.name}`;
131086
+ }
131087
+ logger.log(
131088
+ `\u2728 Successfully enabled data catalog on bucket '${args.bucket}'.
131089
+
131090
+ Catalog URI: '${catalogHost}'
131091
+
131092
+ Use this Catalog URI with Iceberg-compatible query engines (Spark, DuckDB, Trino, etc.) to query data as tables.
131093
+ Note: You'll need a Cloudflare API token with 'R2 Data Catalog' permission to authenticate your client with this catalog.
131094
+ For more details, refer to: https://developers.cloudflare.com/r2/api/s3/tokens/`
131095
+ );
131096
+ }
131097
+ });
131098
+ var r2BucketCatalogDisableCommand = createCommand({
131099
+ metadata: {
131100
+ description: "Disable the data catalog for an R2 bucket",
131101
+ status: "open-beta",
131102
+ owner: "Product: R2 Data Catalog"
131103
+ },
131104
+ positionalArgs: ["bucket"],
131105
+ args: {
131106
+ bucket: {
131107
+ describe: "The name of the bucket to disable the data catalog for",
131108
+ type: "string",
131109
+ demandOption: true
131110
+ }
131111
+ },
131112
+ async handler(args, { config }) {
131113
+ const accountId = await requireAuth(config);
131114
+ const confirmedDisable = await confirm(
131115
+ `Are you sure you want to disable the data catalog for bucket '${args.bucket}'? This action is irreversible, and you cannot re-enable it on this bucket.`
131116
+ );
131117
+ if (!confirmedDisable) {
131118
+ logger.log("Disable cancelled.");
131119
+ return;
131120
+ }
131121
+ await disableR2Catalog(accountId, args.bucket);
131122
+ logger.log(
131123
+ `Successfully disabled the data catalog on bucket '${args.bucket}'.`
131124
+ );
131125
+ }
131126
+ });
131127
+ var r2BucketCatalogGetCommand = createCommand({
131128
+ metadata: {
131129
+ description: "Get the status of the data catalog for an R2 bucket",
131130
+ status: "open-beta",
131131
+ owner: "Product: R2 Data Catalog"
131132
+ },
131133
+ positionalArgs: ["bucket"],
131134
+ args: {
131135
+ bucket: {
131136
+ describe: "The name of the R2 bucket whose data catalog status to retrieve",
131137
+ type: "string",
131138
+ demandOption: true
131139
+ }
131140
+ },
131141
+ async handler(args, { config }) {
131142
+ const accountId = await requireAuth(config);
131143
+ logger.log(`Getting data catalog status for '${args.bucket}'...`);
131144
+ try {
131145
+ const catalog = await getR2Catalog(accountId, args.bucket);
131146
+ const env6 = getCloudflareApiEnvironmentFromEnv();
131147
+ let catalogHost;
131148
+ if (env6 === "staging") {
131149
+ catalogHost = `https://catalog-staging.cloudflarestorage.com/${catalog.name}`;
131150
+ } else {
131151
+ catalogHost = `https://catalog.cloudflarestorage.com/${catalog.name}`;
131152
+ }
131153
+ const output = {
131154
+ Bucket: args.bucket,
131155
+ "Catalog URI": catalogHost,
131156
+ Status: catalog.status
131157
+ };
131158
+ logger.log(formatLabelledValues(output));
131159
+ } catch (e7) {
131160
+ if (e7 instanceof APIError && e7.code == 40401) {
131161
+ logger.log(`Data catalog isn't enabled for bucket '${args.bucket}'.`);
131162
+ } else {
131163
+ throw e7;
131164
+ }
131165
+ }
131166
+ }
131167
+ });
131168
+
131016
131169
  // src/r2/cors.ts
131017
131170
  init_import_meta_url();
131018
131171
  var import_node_path54 = __toESM(require("node:path"));
@@ -149489,6 +149642,22 @@ function createCLIParser(argv) {
149489
149642
  command: "wrangler r2 bucket sippy get",
149490
149643
  definition: r2BucketSippyGetCommand
149491
149644
  },
149645
+ {
149646
+ command: "wrangler r2 bucket catalog",
149647
+ definition: r2BucketCatalogNamespace
149648
+ },
149649
+ {
149650
+ command: "wrangler r2 bucket catalog enable",
149651
+ definition: r2BucketCatalogEnableCommand
149652
+ },
149653
+ {
149654
+ command: "wrangler r2 bucket catalog disable",
149655
+ definition: r2BucketCatalogDisableCommand
149656
+ },
149657
+ {
149658
+ command: "wrangler r2 bucket catalog get",
149659
+ definition: r2BucketCatalogGetCommand
149660
+ },
149492
149661
  {
149493
149662
  command: "wrangler r2 bucket notification",
149494
149663
  definition: r2BucketNotificationNamespace
@@ -155009,3 +155178,4 @@ yargs-parser/build/lib/index.js:
155009
155178
  * SPDX-License-Identifier: ISC
155010
155179
  *)
155011
155180
  */
155181
+ //# sourceMappingURL=cli.js.map