wrangler 3.21.0 → 3.22.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 (2) hide show
  1. package/package.json +1 -1
  2. package/wrangler-dist/cli.js +176 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "3.21.0",
3
+ "version": "3.22.0",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -118004,7 +118004,7 @@ var import_undici3 = __toESM(require_undici());
118004
118004
  var import_undici4 = __toESM(require_undici());
118005
118005
 
118006
118006
  // package.json
118007
- var version = "3.21.0";
118007
+ var version = "3.22.0";
118008
118008
  var package_default = {
118009
118009
  name: "wrangler",
118010
118010
  version,
@@ -122852,7 +122852,7 @@ function rewriteNodeCompatBuildFailure(errors, forPages = false) {
122852
122852
  const match = nodeBuiltinResolveErrorText.exec(error.text);
122853
122853
  if (match !== null) {
122854
122854
  const issue = `The package "${match[1]}" wasn't found on the file system but is built into node.`;
122855
- const instructionForUser = `${forPages ? 'Add the "nodejs_compat" compatibility flag to your Pages project' : 'Add "node_compat = true" to your wrangler.toml file'} to enable Node.js compatibility.`;
122855
+ const instructionForUser = `${forPages ? 'Add the "nodejs_compat" compatibility flag to your Pages project' : 'Add "node_compat = true" to your wrangler.toml file'} and make sure to prefix the module name with "node:" to enable Node.js compatibility.`;
122856
122856
  error.notes = [
122857
122857
  {
122858
122858
  location: null,
@@ -131117,6 +131117,9 @@ var handler10 = withConfig(
131117
131117
 
131118
131118
  // src/constellation/index.ts
131119
131119
  function constellation(yargs) {
131120
+ logger.warn(
131121
+ "`wrangler constellation` is deprecated and will be removed in the next major version.\nPlease migrate to Workers AI, learn more here https://developers.cloudflare.com/workers-ai/."
131122
+ );
131120
131123
  return yargs.command("project", "Manage your projects", (constProjYargs) => {
131121
131124
  return constProjYargs.command(
131122
131125
  "list",
@@ -134973,6 +134976,8 @@ var Handler5 = withConfig(
134973
134976
  sum {
134974
134977
  readQueries
134975
134978
  writeQueries
134979
+ rowsRead
134980
+ rowsWritten
134976
134981
  }
134977
134982
  dimensions {
134978
134983
  datetimeHour
@@ -134999,16 +135004,25 @@ var Handler5 = withConfig(
134999
135004
  "Content-Type": "application/json"
135000
135005
  }
135001
135006
  });
135002
- const metrics = { readQueries: 0, writeQueries: 0 };
135007
+ const metrics = {
135008
+ readQueries: 0,
135009
+ writeQueries: 0,
135010
+ rowsRead: 0,
135011
+ rowsWritten: 0
135012
+ };
135003
135013
  if (graphqlResult) {
135004
135014
  graphqlResult.data?.viewer?.accounts[0]?.d1AnalyticsAdaptiveGroups?.forEach(
135005
135015
  (row) => {
135006
135016
  metrics.readQueries += row?.sum?.readQueries ?? 0;
135007
135017
  metrics.writeQueries += row?.sum?.writeQueries ?? 0;
135018
+ metrics.rowsRead += row?.sum?.rowsRead ?? 0;
135019
+ metrics.rowsWritten += row?.sum?.rowsWritten ?? 0;
135008
135020
  }
135009
135021
  );
135010
135022
  output.read_queries_24h = metrics.readQueries;
135011
135023
  output.write_queries_24h = metrics.writeQueries;
135024
+ output.rows_read_24h = metrics.rowsRead;
135025
+ output.rows_written_24h = metrics.rowsWritten;
135012
135026
  }
135013
135027
  }
135014
135028
  if (json) {
@@ -135019,7 +135033,7 @@ var Handler5 = withConfig(
135019
135033
  let value;
135020
135034
  if (k === "database_size") {
135021
135035
  value = prettyBytes(Number(v));
135022
- } else if (k === "read_queries_24h" || k === "write_queries_24h") {
135036
+ } else if (k === "read_queries_24h" || k === "write_queries_24h" || k === "rows_read_24h" || k === "rows_written_24h") {
135023
135037
  value = v.toLocaleString();
135024
135038
  } else {
135025
135039
  value = v;
@@ -144030,7 +144044,16 @@ __name(options19, "options");
144030
144044
  async function handler20(args) {
144031
144045
  const config = readConfig(args.config, args);
144032
144046
  const queues2 = await listQueues(config, args.page);
144033
- logger.log(JSON.stringify(queues2));
144047
+ logger.table(
144048
+ queues2.map((queue) => ({
144049
+ id: queue.queue_id,
144050
+ name: queue.queue_name,
144051
+ created_on: queue.created_on,
144052
+ modified_on: queue.modified_on,
144053
+ producers: queue.producers_total_count.toString(),
144054
+ consumers: queue.consumers_total_count.toString()
144055
+ }))
144056
+ );
144034
144057
  }
144035
144058
  __name(handler20, "handler");
144036
144059
 
@@ -144217,6 +144240,39 @@ async function usingLocalBucket(persistTo, configPath, bucketName, closure) {
144217
144240
  }
144218
144241
  }
144219
144242
  __name(usingLocalBucket, "usingLocalBucket");
144243
+ async function getR2Sippy(accountId, bucketName, jurisdiction) {
144244
+ const headers = {};
144245
+ if (jurisdiction !== void 0) {
144246
+ headers["cf-r2-jurisdiction"] = jurisdiction;
144247
+ }
144248
+ return await fetchResult(
144249
+ `/accounts/${accountId}/r2/buckets/${bucketName}/sippy`,
144250
+ { method: "GET", headers }
144251
+ );
144252
+ }
144253
+ __name(getR2Sippy, "getR2Sippy");
144254
+ async function deleteR2Sippy(accountId, bucketName, jurisdiction) {
144255
+ const headers = {};
144256
+ if (jurisdiction !== void 0) {
144257
+ headers["cf-r2-jurisdiction"] = jurisdiction;
144258
+ }
144259
+ return await fetchResult(
144260
+ `/accounts/${accountId}/r2/buckets/${bucketName}/sippy`,
144261
+ { method: "DELETE", headers }
144262
+ );
144263
+ }
144264
+ __name(deleteR2Sippy, "deleteR2Sippy");
144265
+ async function putR2Sippy(accountId, bucketName, config, jurisdiction) {
144266
+ const headers = {};
144267
+ if (jurisdiction !== void 0) {
144268
+ headers["cf-r2-jurisdiction"] = jurisdiction;
144269
+ }
144270
+ return await fetchResult(
144271
+ `/accounts/${accountId}/r2/buckets/${bucketName}/sippy`,
144272
+ { method: "PUT", body: JSON.stringify(config), headers }
144273
+ );
144274
+ }
144275
+ __name(putR2Sippy, "putR2Sippy");
144220
144276
 
144221
144277
  // src/r2/index.ts
144222
144278
  var CHUNK_SIZE = 1024;
@@ -144629,6 +144685,113 @@ ${key} is ${prettyBytes(objectSize, {
144629
144685
  });
144630
144686
  }
144631
144687
  );
144688
+ r2BucketYargs.command(
144689
+ "sippy",
144690
+ "Manage Sippy incremental migration on an R2 bucket",
144691
+ (sippyYargs) => {
144692
+ return sippyYargs.command(
144693
+ "enable <name>",
144694
+ "Enable Sippy on an R2 bucket",
144695
+ (yargs) => yargs.positional("name", {
144696
+ describe: "The name of the bucket",
144697
+ type: "string",
144698
+ demandOption: true
144699
+ }).option("jurisdiction", {
144700
+ describe: "The jurisdiction where the bucket exists",
144701
+ alias: "J",
144702
+ requiresArg: true,
144703
+ type: "string"
144704
+ }).option("provider", {
144705
+ choices: ["AWS"],
144706
+ default: "AWS",
144707
+ implies: [
144708
+ "bucket",
144709
+ "key-id",
144710
+ "secret-access-key",
144711
+ "r2-key-id",
144712
+ "r2-secret-access-key"
144713
+ ]
144714
+ }).option("bucket", {
144715
+ description: "The name of the upstream bucket",
144716
+ string: true
144717
+ }).option("region", {
144718
+ description: "The region of the upstream bucket",
144719
+ string: true
144720
+ }).option("key-id", {
144721
+ description: "The secret access key id for the upstream bucket",
144722
+ string: true
144723
+ }).option("secret-access-key", {
144724
+ description: "The secret access key for the upstream bucket",
144725
+ string: true
144726
+ }).option("r2-key-id", {
144727
+ description: "The secret access key id for this R2 bucket",
144728
+ string: true
144729
+ }).option("r2-secret-access-key", {
144730
+ description: "The secret access key for this R2 bucket",
144731
+ string: true
144732
+ }),
144733
+ async (args) => {
144734
+ const config = readConfig(args.config, args);
144735
+ const accountId = await requireAuth(config);
144736
+ await putR2Sippy(
144737
+ accountId,
144738
+ args.name,
144739
+ {
144740
+ provider: "AWS",
144741
+ zone: args["region"],
144742
+ bucket: args.bucket ?? "",
144743
+ key_id: args["key-id"] ?? "",
144744
+ access_key: args["secret-access-key"] ?? "",
144745
+ r2_key_id: args["r2-key-id"] ?? "",
144746
+ r2_access_key: args["r2-secret-access-key"] ?? ""
144747
+ },
144748
+ args.jurisdiction
144749
+ );
144750
+ }
144751
+ ).command(
144752
+ "disable <name>",
144753
+ "Disable Sippy on an R2 bucket",
144754
+ (yargs) => yargs.positional("name", {
144755
+ describe: "The name of the bucket",
144756
+ type: "string",
144757
+ demandOption: true
144758
+ }).option("jurisdiction", {
144759
+ describe: "The jurisdiction where the bucket exists",
144760
+ alias: "J",
144761
+ requiresArg: true,
144762
+ type: "string"
144763
+ }),
144764
+ async (args) => {
144765
+ const config = readConfig(args.config, args);
144766
+ const accountId = await requireAuth(config);
144767
+ await deleteR2Sippy(accountId, args.name, args.jurisdiction);
144768
+ }
144769
+ ).command(
144770
+ "get <name>",
144771
+ "Check the status of Sippy on an R2 bucket",
144772
+ (yargs) => yargs.positional("name", {
144773
+ describe: "The name of the bucket",
144774
+ type: "string",
144775
+ demandOption: true
144776
+ }).option("jurisdiction", {
144777
+ describe: "The jurisdiction where the bucket exists",
144778
+ alias: "J",
144779
+ requiresArg: true,
144780
+ type: "string"
144781
+ }),
144782
+ async (args) => {
144783
+ const config = readConfig(args.config, args);
144784
+ const accountId = await requireAuth(config);
144785
+ const sippyBucket = await getR2Sippy(
144786
+ accountId,
144787
+ args.name,
144788
+ args.jurisdiction
144789
+ );
144790
+ logger.log(`Sippy upstream bucket: ${sippyBucket}.`);
144791
+ }
144792
+ );
144793
+ }
144794
+ );
144632
144795
  return r2BucketYargs;
144633
144796
  });
144634
144797
  }
@@ -155188,13 +155351,9 @@ function createCLIParser(argv) {
155188
155351
  wrangler.command("ai", "\u{1F916} Interact with AI models", (aiYargs) => {
155189
155352
  return ai(aiYargs.command(subHelp));
155190
155353
  });
155191
- wrangler.command(
155192
- "constellation",
155193
- "\u{1F916} Interact with Constellation models",
155194
- (aiYargs) => {
155195
- return constellation(aiYargs.command(subHelp));
155196
- }
155197
- );
155354
+ wrangler.command("constellation", false, (aiYargs) => {
155355
+ return constellation(aiYargs.command(subHelp));
155356
+ });
155198
155357
  wrangler.command(
155199
155358
  "vectorize",
155200
155359
  "\u{1F9EE} Interact with Vectorize indexes",
@@ -160287,6 +160446,11 @@ function getBindings(configParam, env5, local, args) {
160287
160446
  return hyperdrive2;
160288
160447
  })
160289
160448
  };
160449
+ if (bindings.constellation && bindings.constellation.length > 0) {
160450
+ logger.warn(
160451
+ "`constellation` is deprecated and will be removed in the next major version.\nPlease migrate to Workers AI, learn more here https://developers.cloudflare.com/workers-ai/."
160452
+ );
160453
+ }
160290
160454
  return bindings;
160291
160455
  }
160292
160456
  __name(getBindings, "getBindings");