wrangler 4.42.1 → 4.42.2

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.42.1",
3
+ "version": "4.42.2",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -54,15 +54,15 @@
54
54
  "esbuild": "0.25.4",
55
55
  "path-to-regexp": "6.3.0",
56
56
  "unenv": "2.0.0-rc.21",
57
- "workerd": "1.20251004.0",
57
+ "workerd": "1.20251008.0",
58
58
  "@cloudflare/kv-asset-handler": "0.4.0",
59
- "miniflare": "4.20251004.0",
60
- "@cloudflare/unenv-preset": "2.7.7"
59
+ "@cloudflare/unenv-preset": "2.7.7",
60
+ "miniflare": "4.20251008.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@aws-sdk/client-s3": "^3.721.0",
64
64
  "@cloudflare/types": "6.18.4",
65
- "@cloudflare/workers-types": "^4.20251004.0",
65
+ "@cloudflare/workers-types": "^4.20251008.0",
66
66
  "@cspotcode/source-map-support": "0.8.1",
67
67
  "@iarna/toml": "^3.0.0",
68
68
  "@sentry/node": "^7.86.0",
@@ -139,16 +139,16 @@
139
139
  "xxhash-wasm": "^1.0.1",
140
140
  "yaml": "^2.8.1",
141
141
  "yargs": "^17.7.2",
142
+ "@cloudflare/cli": "1.1.3",
142
143
  "@cloudflare/containers-shared": "0.2.12",
143
144
  "@cloudflare/eslint-config-shared": "1.1.0",
144
- "@cloudflare/cli": "1.1.3",
145
- "@cloudflare/pages-shared": "^0.13.78",
145
+ "@cloudflare/pages-shared": "^0.13.79",
146
146
  "@cloudflare/workers-shared": "0.18.8",
147
147
  "@cloudflare/workers-tsconfig": "0.0.0",
148
148
  "@cloudflare/workflows-shared": "0.3.7"
149
149
  },
150
150
  "peerDependencies": {
151
- "@cloudflare/workers-types": "^4.20251004.0"
151
+ "@cloudflare/workers-types": "^4.20251008.0"
152
152
  },
153
153
  "peerDependenciesMeta": {
154
154
  "@cloudflare/workers-types": {
@@ -93898,7 +93898,7 @@ var name, version;
93898
93898
  var init_package = __esm({
93899
93899
  "package.json"() {
93900
93900
  name = "wrangler";
93901
- version = "4.42.1";
93901
+ version = "4.42.2";
93902
93902
  }
93903
93903
  });
93904
93904
 
@@ -103871,6 +103871,44 @@ async function upsertR2DataCatalogCredential(complianceConfig, accountId, bucket
103871
103871
  }
103872
103872
  );
103873
103873
  }
103874
+ async function enableR2CatalogTableCompaction(complianceConfig, accountId, bucketName, namespace, tableName, targetSizeMb) {
103875
+ const body = {
103876
+ compaction: {
103877
+ state: "enabled"
103878
+ }
103879
+ };
103880
+ if (targetSizeMb !== void 0) {
103881
+ body.compaction.target_size_mb = targetSizeMb;
103882
+ }
103883
+ return await fetchResult(
103884
+ complianceConfig,
103885
+ `/accounts/${accountId}/r2-catalog/${bucketName}/namespaces/${namespace}/tables/${tableName}/maintenance-configs`,
103886
+ {
103887
+ method: "POST",
103888
+ body: JSON.stringify(body),
103889
+ headers: {
103890
+ "Content-Type": "application/json"
103891
+ }
103892
+ }
103893
+ );
103894
+ }
103895
+ async function disableR2CatalogTableCompaction(complianceConfig, accountId, bucketName, namespace, tableName) {
103896
+ return await fetchResult(
103897
+ complianceConfig,
103898
+ `/accounts/${accountId}/r2-catalog/${bucketName}/namespaces/${namespace}/tables/${tableName}/maintenance-configs`,
103899
+ {
103900
+ method: "POST",
103901
+ body: JSON.stringify({
103902
+ compaction: {
103903
+ state: "disabled"
103904
+ }
103905
+ }),
103906
+ headers: {
103907
+ "Content-Type": "application/json"
103908
+ }
103909
+ }
103910
+ );
103911
+ }
103874
103912
  function eventNotificationHeaders(apiCredentials, jurisdiction) {
103875
103913
  const headers = {
103876
103914
  "Content-Type": "application/json"
@@ -104408,6 +104446,8 @@ var init_helpers = __esm({
104408
104446
  __name(enableR2CatalogCompaction, "enableR2CatalogCompaction");
104409
104447
  __name(disableR2CatalogCompaction, "disableR2CatalogCompaction");
104410
104448
  __name(upsertR2DataCatalogCredential, "upsertR2DataCatalogCredential");
104449
+ __name(enableR2CatalogTableCompaction, "enableR2CatalogTableCompaction");
104450
+ __name(disableR2CatalogTableCompaction, "disableR2CatalogTableCompaction");
104411
104451
  actionsForEventCategories = {
104412
104452
  "object-create": ["PutObject", "CompleteMultipartUpload", "CopyObject"],
104413
104453
  "object-delete": ["DeleteObject", "LifecycleDeletion"]
@@ -204787,6 +204827,7 @@ var init_catalog = __esm({
204787
204827
  init_create_command();
204788
204828
  init_dialogs();
204789
204829
  init_misc_variables();
204830
+ init_errors();
204790
204831
  init_logger();
204791
204832
  init_parse();
204792
204833
  init_user3();
@@ -204929,17 +204970,27 @@ For more details, refer to: https://developers.cloudflare.com/r2/api/s3/tokens/`
204929
204970
  });
204930
204971
  r2BucketCatalogCompactionEnableCommand = createCommand({
204931
204972
  metadata: {
204932
- description: "Enable automatic file compaction for your R2 data catalog",
204973
+ description: "Enable automatic file compaction for your R2 data catalog or a specific table",
204933
204974
  status: "open-beta",
204934
204975
  owner: "Product: R2 Data Catalog"
204935
204976
  },
204936
- positionalArgs: ["bucket"],
204977
+ positionalArgs: ["bucket", "namespace", "table"],
204937
204978
  args: {
204938
204979
  bucket: {
204939
204980
  describe: "The name of the bucket which contains the catalog",
204940
204981
  type: "string",
204941
204982
  demandOption: true
204942
204983
  },
204984
+ namespace: {
204985
+ describe: "The namespace containing the table (optional, for table-level compaction)",
204986
+ type: "string",
204987
+ demandOption: false
204988
+ },
204989
+ table: {
204990
+ describe: "The name of the table (optional, for table-level compaction)",
204991
+ type: "string",
204992
+ demandOption: false
204993
+ },
204943
204994
  "target-size": {
204944
204995
  describe: "The target size for compacted files in MB (allowed values: 64, 128, 256, 512)",
204945
204996
  type: "number",
@@ -204947,57 +204998,121 @@ For more details, refer to: https://developers.cloudflare.com/r2/api/s3/tokens/`
204947
204998
  default: 128
204948
204999
  },
204949
205000
  token: {
204950
- describe: "A cloudflare api token with access to R2 and R2 Data Catalog which will be used to read/write files for compaction.",
204951
- demandOption: true,
205001
+ describe: "A cloudflare api token with access to R2 and R2 Data Catalog (required for catalog-level compaction settings only)",
205002
+ demandOption: false,
204952
205003
  type: "string"
204953
205004
  }
204954
205005
  },
204955
205006
  async handler(args, { config }) {
204956
205007
  const accountId = await requireAuth(config);
204957
- await upsertR2DataCatalogCredential(
204958
- config,
204959
- accountId,
204960
- args.bucket,
204961
- args.token
204962
- );
204963
- await enableR2CatalogCompaction(
204964
- config,
204965
- accountId,
204966
- args.bucket,
204967
- args.targetSize
204968
- );
204969
- logger.log(
204970
- `\u2728 Successfully enabled file compaction for the data catalog for bucket '${args.bucket}'.`
204971
- );
205008
+ if (args.namespace && !args.table) {
205009
+ throw new UserError2("Table name is required when namespace is specified");
205010
+ }
205011
+ if (!args.namespace && args.table) {
205012
+ throw new UserError2("Namespace is required when table is specified");
205013
+ }
205014
+ if (args.namespace && args.table) {
205015
+ await enableR2CatalogTableCompaction(
205016
+ config,
205017
+ accountId,
205018
+ args.bucket,
205019
+ args.namespace,
205020
+ args.table,
205021
+ args.targetSize !== 128 ? args.targetSize : void 0
205022
+ );
205023
+ logger.log(
205024
+ `\u2728 Successfully enabled file compaction for table '${args.namespace}.${args.table}' in bucket '${args.bucket}'.`
205025
+ );
205026
+ } else {
205027
+ if (!args.token) {
205028
+ throw new UserError2(
205029
+ "Token is required for catalog-level compaction. Use --token flag to provide a Cloudflare API token."
205030
+ );
205031
+ }
205032
+ await upsertR2DataCatalogCredential(
205033
+ config,
205034
+ accountId,
205035
+ args.bucket,
205036
+ args.token
205037
+ );
205038
+ await enableR2CatalogCompaction(
205039
+ config,
205040
+ accountId,
205041
+ args.bucket,
205042
+ args.targetSize
205043
+ );
205044
+ logger.log(
205045
+ `\u2728 Successfully enabled file compaction for the data catalog for bucket '${args.bucket}'.
205046
+
205047
+ Compaction will automatically combine small files into larger ones to improve query performance.
205048
+ For more details, refer to: https://developers.cloudflare.com/r2/data-catalog/about-compaction/`
205049
+ );
205050
+ }
204972
205051
  }
204973
205052
  });
204974
205053
  r2BucketCatalogCompactionDisableCommand = createCommand({
204975
205054
  metadata: {
204976
- description: "Disable automatic file compaction for your R2 data catalog",
205055
+ description: "Disable automatic file compaction for your R2 data catalog or a specific table",
204977
205056
  status: "open-beta",
204978
205057
  owner: "Product: R2 Data Catalog"
204979
205058
  },
204980
- positionalArgs: ["bucket"],
205059
+ positionalArgs: ["bucket", "namespace", "table"],
204981
205060
  args: {
204982
205061
  bucket: {
204983
205062
  describe: "The name of the bucket which contains the catalog",
204984
205063
  type: "string",
204985
205064
  demandOption: true
205065
+ },
205066
+ namespace: {
205067
+ describe: "The namespace containing the table (optional, for table-level compaction)",
205068
+ type: "string",
205069
+ demandOption: false
205070
+ },
205071
+ table: {
205072
+ describe: "The name of the table (optional, for table-level compaction)",
205073
+ type: "string",
205074
+ demandOption: false
204986
205075
  }
204987
205076
  },
204988
205077
  async handler(args, { config }) {
204989
205078
  const accountId = await requireAuth(config);
204990
- const confirmedDisable = await confirm(
204991
- `Are you sure you want to disable file compaction for the data catalog for bucket '${args.bucket}'?`
204992
- );
204993
- if (!confirmedDisable) {
204994
- logger.log("Disable cancelled.");
204995
- return;
205079
+ if (args.namespace && !args.table) {
205080
+ throw new UserError2("Table name is required when namespace is specified");
205081
+ }
205082
+ if (!args.namespace && args.table) {
205083
+ throw new UserError2("Namespace is required when table is specified");
205084
+ }
205085
+ if (args.namespace && args.table) {
205086
+ const confirmedDisable = await confirm(
205087
+ `Are you sure you want to disable file compaction for table '${args.namespace}.${args.table}' in bucket '${args.bucket}'?`
205088
+ );
205089
+ if (!confirmedDisable) {
205090
+ logger.log("Disable cancelled.");
205091
+ return;
205092
+ }
205093
+ await disableR2CatalogTableCompaction(
205094
+ config,
205095
+ accountId,
205096
+ args.bucket,
205097
+ args.namespace,
205098
+ args.table
205099
+ );
205100
+ logger.log(
205101
+ `Successfully disabled file compaction for table '${args.namespace}.${args.table}' in bucket '${args.bucket}'.`
205102
+ );
205103
+ } else {
205104
+ const confirmedDisable = await confirm(
205105
+ `Are you sure you want to disable file compaction for the data catalog for bucket '${args.bucket}'?`
205106
+ );
205107
+ if (!confirmedDisable) {
205108
+ logger.log("Disable cancelled.");
205109
+ return;
205110
+ }
205111
+ await disableR2CatalogCompaction(config, accountId, args.bucket);
205112
+ logger.log(
205113
+ `Successfully disabled file compaction for the data catalog for bucket '${args.bucket}'.`
205114
+ );
204996
205115
  }
204997
- await disableR2CatalogCompaction(config, accountId, args.bucket);
204998
- logger.log(
204999
- `Successfully disabled file compaction for the data catalog for bucket '${args.bucket}'.`
205000
- );
205001
205116
  }
205002
205117
  });
205003
205118
  }
@@ -229966,7 +230081,13 @@ async function checkStartupHandler({
229966
230081
  });
229967
230082
  await (0, import_promises33.writeFile)(outfile, JSON.stringify(await cpuProfileResult));
229968
230083
  log(
229969
- `CPU Profile written to ${outfile}. Load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.`
230084
+ [
230085
+ `CPU Profile has been written to ${outfile}. Load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.`,
230086
+ "",
230087
+ "Note that the CPU Profile was measured on your Worker running locally on your machine, which has a different CPU than when your Worker runs on Cloudflare.",
230088
+ "",
230089
+ "As such, CPU Profile can be used to understand where time is spent at startup, but the overall startup time in the profile should not be expected to exactly match what your Worker's startup time will be when deploying to Cloudflare."
230090
+ ].join("\n")
229970
230091
  );
229971
230092
  }
229972
230093
  async function getEntryValue(entry) {