wrangler 4.3.0 → 4.4.1

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.
@@ -76441,13 +76441,14 @@ ${invalidHeaderRulesList}`
76441
76441
  }
76442
76442
  const rules = {};
76443
76443
  for (const rule of headers.rules) {
76444
- rules[rule.path] = {};
76444
+ const configuredRule = {};
76445
76445
  if (Object.keys(rule.headers).length) {
76446
- rules[rule.path].set = rule.headers;
76446
+ configuredRule.set = rule.headers;
76447
76447
  }
76448
76448
  if (rule.unsetHeaders.length) {
76449
- rules[rule.path].unset = rule.unsetHeaders;
76449
+ configuredRule.unset = rule.unsetHeaders;
76450
76450
  }
76451
+ rules[rule.path] = configuredRule;
76451
76452
  }
76452
76453
  return {
76453
76454
  headers: {
@@ -76598,26 +76599,29 @@ var init_validateURL = __esm({
76598
76599
  });
76599
76600
 
76600
76601
  // ../workers-shared/utils/configuration/parseHeaders.ts
76601
- function parseHeaders(input) {
76602
+ function parseHeaders(input, {
76603
+ maxRules = MAX_HEADER_RULES,
76604
+ maxLineLength = MAX_LINE_LENGTH
76605
+ } = {}) {
76602
76606
  const lines = input.split("\n");
76603
76607
  const rules = [];
76604
76608
  const invalid = [];
76605
76609
  let rule = void 0;
76606
76610
  for (let i5 = 0; i5 < lines.length; i5++) {
76607
- const line = lines[i5].trim();
76611
+ const line = (lines[i5] || "").trim();
76608
76612
  if (line.length === 0 || line.startsWith("#")) {
76609
76613
  continue;
76610
76614
  }
76611
- if (line.length > MAX_LINE_LENGTH) {
76615
+ if (line.length > maxLineLength) {
76612
76616
  invalid.push({
76613
- message: `Ignoring line ${i5 + 1} as it exceeds the maximum allowed length of ${MAX_LINE_LENGTH}.`
76617
+ message: `Ignoring line ${i5 + 1} as it exceeds the maximum allowed length of ${maxLineLength}.`
76614
76618
  });
76615
76619
  continue;
76616
76620
  }
76617
76621
  if (LINE_IS_PROBABLY_A_PATH.test(line)) {
76618
- if (rules.length >= MAX_HEADER_RULES) {
76622
+ if (rules.length >= maxRules) {
76619
76623
  invalid.push({
76620
- message: `Maximum number of rules supported is ${MAX_HEADER_RULES}. Skipping remaining ${lines.length - i5} lines of file.`
76624
+ message: `Maximum number of rules supported is ${maxRules}. Skipping remaining ${lines.length - i5} lines of file.`
76621
76625
  });
76622
76626
  break;
76623
76627
  }
@@ -76675,7 +76679,7 @@ function parseHeaders(input) {
76675
76679
  continue;
76676
76680
  }
76677
76681
  const [rawName, ...rawValue] = line.split(HEADER_SEPARATOR);
76678
- const name2 = rawName.trim().toLowerCase();
76682
+ const name2 = (rawName || "").trim().toLowerCase();
76679
76683
  if (name2.includes(" ")) {
76680
76684
  invalid.push({
76681
76685
  line,
@@ -76745,7 +76749,11 @@ var init_parseHeaders = __esm({
76745
76749
  });
76746
76750
 
76747
76751
  // ../workers-shared/utils/configuration/parseRedirects.ts
76748
- function parseRedirects(input) {
76752
+ function parseRedirects(input, {
76753
+ maxStaticRules = MAX_STATIC_REDIRECT_RULES,
76754
+ maxDynamicRules = MAX_DYNAMIC_REDIRECT_RULES,
76755
+ maxLineLength = MAX_LINE_LENGTH
76756
+ } = {}) {
76749
76757
  const lines = input.split("\n");
76750
76758
  const rules = [];
76751
76759
  const seen_paths = /* @__PURE__ */ new Set();
@@ -76754,13 +76762,13 @@ function parseRedirects(input) {
76754
76762
  let dynamicRules = 0;
76755
76763
  let canCreateStaticRule = true;
76756
76764
  for (let i5 = 0; i5 < lines.length; i5++) {
76757
- const line = lines[i5].trim();
76765
+ const line = (lines[i5] || "").trim();
76758
76766
  if (line.length === 0 || line.startsWith("#")) {
76759
76767
  continue;
76760
76768
  }
76761
- if (line.length > MAX_LINE_LENGTH) {
76769
+ if (line.length > maxLineLength) {
76762
76770
  invalid.push({
76763
- message: `Ignoring line ${i5 + 1} as it exceeds the maximum allowed length of ${MAX_LINE_LENGTH}.`
76771
+ message: `Ignoring line ${i5 + 1} as it exceeds the maximum allowed length of ${maxLineLength}.`
76764
76772
  });
76765
76773
  continue;
76766
76774
  }
@@ -76786,18 +76794,18 @@ function parseRedirects(input) {
76786
76794
  const from = fromResult[0];
76787
76795
  if (canCreateStaticRule && !from.match(SPLAT_REGEX) && !from.match(PLACEHOLDER_REGEX)) {
76788
76796
  staticRules += 1;
76789
- if (staticRules > MAX_STATIC_REDIRECT_RULES) {
76797
+ if (staticRules > maxStaticRules) {
76790
76798
  invalid.push({
76791
- message: `Maximum number of static rules supported is ${MAX_STATIC_REDIRECT_RULES}. Skipping line.`
76799
+ message: `Maximum number of static rules supported is ${maxStaticRules}. Skipping line.`
76792
76800
  });
76793
76801
  continue;
76794
76802
  }
76795
76803
  } else {
76796
76804
  dynamicRules += 1;
76797
76805
  canCreateStaticRule = false;
76798
- if (dynamicRules > MAX_DYNAMIC_REDIRECT_RULES) {
76806
+ if (dynamicRules > maxDynamicRules) {
76799
76807
  invalid.push({
76800
- message: `Maximum number of dynamic rules supported is ${MAX_DYNAMIC_REDIRECT_RULES}. Skipping remaining ${lines.length - i5} lines of file.`
76808
+ message: `Maximum number of dynamic rules supported is ${maxDynamicRules}. Skipping remaining ${lines.length - i5} lines of file.`
76801
76809
  });
76802
76810
  break;
76803
76811
  }
@@ -81177,7 +81185,7 @@ var import_undici3 = __toESM(require_undici());
81177
81185
 
81178
81186
  // package.json
81179
81187
  var name = "wrangler";
81180
- var version = "4.3.0";
81188
+ var version = "4.4.1";
81181
81189
 
81182
81190
  // src/environment-variables/misc-variables.ts
81183
81191
  init_import_meta_url();
@@ -90160,7 +90168,8 @@ var DefaultScopes = {
90160
90168
  "ssl_certs:write": "See and manage mTLS certificates for your account",
90161
90169
  "ai:write": "See and change Workers AI catalog and assets",
90162
90170
  "queues:write": "See and change Cloudflare Queues settings and data",
90163
- "pipelines:write": "See and change Cloudflare Pipelines configurations and data"
90171
+ "pipelines:write": "See and change Cloudflare Pipelines configurations and data",
90172
+ "secrets_store:write": "See and change secrets + stores within the Secrets Store"
90164
90173
  };
90165
90174
  var OptionalScopes = {
90166
90175
  "cloudchamber:write": "Manage Cloudchamber"
@@ -93050,7 +93059,6 @@ async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticati
93050
93059
  liveReload: config.liveReload,
93051
93060
  upstream,
93052
93061
  unsafeProxySharedSecret: proxyToUserWorkerAuthenticationSecret,
93053
- unsafeEnableAssetsRpc: getFlag("ASSETS_RPC"),
93054
93062
  log: log2,
93055
93063
  verbose: logger.loggerLevel === "debug",
93056
93064
  handleRuntimeStdio,
@@ -112096,7 +112104,7 @@ async function getNetworkInput(args) {
112096
112104
  label: "Include IPv4",
112097
112105
  type: "confirm"
112098
112106
  });
112099
- return ipv4 === true ? { assign_ipv4: "predefined" /* PREDEFINED */ } : void 0;
112107
+ return ipv4 === true ? { assign_ipv4: "predefined" /* PREDEFINED */ } : { assign_ipv6: "predefined" /* PREDEFINED */ };
112100
112108
  }
112101
112109
  __name(getNetworkInput, "getNetworkInput");
112102
112110
 
@@ -112488,7 +112496,7 @@ async function createCommand2(args, config) {
112488
112496
  }
112489
112497
  const keysToAdd = args.allSshKeys ? (await pollSSHKeysUntilCondition(() => true)).map((key) => key.id) : [];
112490
112498
  const useIpv4 = args.ipv4 ?? config.cloudchamber.ipv4;
112491
- const network = useIpv4 === true ? { assign_ipv4: "predefined" /* PREDEFINED */ } : void 0;
112499
+ const network = useIpv4 === true ? { assign_ipv4: "predefined" /* PREDEFINED */ } : { assign_ipv6: "predefined" /* PREDEFINED */ };
112492
112500
  const deployment = await DeploymentsService.createDeploymentV2({
112493
112501
  image: body.image,
112494
112502
  location: body.location,
@@ -114338,8 +114346,7 @@ function createHandler(def) {
114338
114346
  await def.validateArgs?.(args);
114339
114347
  const experimentalFlags = def.behaviour?.overrideExperimentalFlags ? def.behaviour?.overrideExperimentalFlags(args) : {
114340
114348
  MULTIWORKER: false,
114341
- RESOURCES_PROVISION: args.experimentalProvision ?? false,
114342
- ASSETS_RPC: false
114349
+ RESOURCES_PROVISION: args.experimentalProvision ?? false
114343
114350
  };
114344
114351
  await run(
114345
114352
  experimentalFlags,
@@ -116714,9 +116721,13 @@ async function verifyWorkerMatchesCITag(accountId, workerName, configPath) {
116714
116721
  throw new FatalError(
116715
116722
  `The name in your ${configFileName(configPath)} file (${workerName}) must match the name of your Worker. Please update the name field in your ${configFileName(configPath)} file.`
116716
116723
  );
116724
+ } else if (e7 instanceof APIError) {
116725
+ throw new FatalError(
116726
+ "An error occurred while trying to validate that the Worker name matches what is expected by the build system.\n" + e7.message + "\n" + e7.notes.map((note) => note.text).join("\n")
116727
+ );
116717
116728
  } else {
116718
116729
  throw new FatalError(
116719
- "Wrangler cannot validate that your Worker name matches what is expected by the build system. Please retry the build."
116730
+ "Wrangler cannot validate that your Worker name matches what is expected by the build system. Please retry the build. If the problem persists, please contact support."
116720
116731
  );
116721
116732
  }
116722
116733
  }
@@ -116984,8 +116995,7 @@ var deployCommand = createCommand({
116984
116995
  useConfigRedirectIfAvailable: true,
116985
116996
  overrideExperimentalFlags: /* @__PURE__ */ __name((args) => ({
116986
116997
  MULTIWORKER: false,
116987
- RESOURCES_PROVISION: args.experimentalProvision ?? false,
116988
- ASSETS_RPC: false
116998
+ RESOURCES_PROVISION: args.experimentalProvision ?? false
116989
116999
  }), "overrideExperimentalFlags")
116990
117000
  },
116991
117001
  validateArgs(args) {
@@ -123011,7 +123021,7 @@ var Handler14 = /* @__PURE__ */ __name(async (args) => {
123011
123021
  }
123012
123022
  if (args.env) {
123013
123023
  throw new FatalError(
123014
- "Pages does not support targeting an environment with the --env flag. Use the --branch flag to target your production or preview branch",
123024
+ "Pages does not support targeting an environment with the --env flag during local development.",
123015
123025
  1
123016
123026
  );
123017
123027
  }
@@ -123360,8 +123370,7 @@ ${JSON.stringify(defaultRoutesJSONSpec, null, 2)}`
123360
123370
  const devServer = await run(
123361
123371
  {
123362
123372
  MULTIWORKER: Array.isArray(args.config),
123363
- RESOURCES_PROVISION: false,
123364
- ASSETS_RPC: false
123373
+ RESOURCES_PROVISION: false
123365
123374
  },
123366
123375
  () => startDev({
123367
123376
  script: scriptEntrypoint,
@@ -123430,8 +123439,7 @@ ${JSON.stringify(defaultRoutesJSONSpec, null, 2)}`
123430
123439
  config: Array.isArray(args.config) ? args.config : void 0,
123431
123440
  site: void 0,
123432
123441
  siteInclude: void 0,
123433
- siteExclude: void 0,
123434
- experimentalAssetsRpc: false
123442
+ siteExclude: void 0
123435
123443
  })
123436
123444
  );
123437
123445
  sendMetricsEvent("run pages dev");
@@ -132963,6 +132971,662 @@ var r2BucketSippyGetCommand = createCommand({
132963
132971
  }
132964
132972
  });
132965
132973
 
132974
+ // src/secrets-store/index.ts
132975
+ init_import_meta_url();
132976
+ var secretsStoreNamespace = createNamespace({
132977
+ metadata: {
132978
+ description: `\u{1F510} Manage the Secrets Store`,
132979
+ status: "alpha",
132980
+ owner: "Product: SSL"
132981
+ }
132982
+ });
132983
+ var secretsStoreStoreNamespace = createNamespace({
132984
+ metadata: {
132985
+ description: "\u{1F510} Manage Stores within the Secrets Store",
132986
+ status: "alpha",
132987
+ owner: "Product: SSL"
132988
+ }
132989
+ });
132990
+ var secretsStoreSecretNamespace = createNamespace({
132991
+ metadata: {
132992
+ description: "\u{1F510} Manage Secrets within the Secrets Store",
132993
+ status: "alpha",
132994
+ owner: "Product: SSL"
132995
+ }
132996
+ });
132997
+
132998
+ // src/secrets-store/commands.ts
132999
+ init_import_meta_url();
133000
+
133001
+ // src/secrets-store/client.ts
133002
+ init_import_meta_url();
133003
+ async function createStore(accountId, body) {
133004
+ return await fetchResult(`/accounts/${accountId}/secrets_store/stores`, {
133005
+ method: "POST",
133006
+ body: JSON.stringify(body)
133007
+ });
133008
+ }
133009
+ __name(createStore, "createStore");
133010
+ async function deleteStore(accountId, storeId) {
133011
+ return await fetchResult(
133012
+ `/accounts/${accountId}/secrets_store/stores/${storeId}`,
133013
+ {
133014
+ method: "DELETE"
133015
+ }
133016
+ );
133017
+ }
133018
+ __name(deleteStore, "deleteStore");
133019
+ async function listStores(accountId, urlParams) {
133020
+ return await fetchResult(
133021
+ `/accounts/${accountId}/secrets_store/stores`,
133022
+ {
133023
+ method: "GET"
133024
+ },
133025
+ urlParams
133026
+ );
133027
+ }
133028
+ __name(listStores, "listStores");
133029
+ async function listSecrets(accountId, storeId, urlParams) {
133030
+ return await fetchResult(
133031
+ `/accounts/${accountId}/secrets_store/stores/${storeId}/secrets`,
133032
+ {
133033
+ method: "GET"
133034
+ },
133035
+ urlParams
133036
+ );
133037
+ }
133038
+ __name(listSecrets, "listSecrets");
133039
+ async function getSecret(accountId, storeId, secretId) {
133040
+ return await fetchResult(
133041
+ `/accounts/${accountId}/secrets_store/stores/${storeId}/secrets/${secretId}`,
133042
+ {
133043
+ method: "GET"
133044
+ }
133045
+ );
133046
+ }
133047
+ __name(getSecret, "getSecret");
133048
+ async function createSecret(accountId, storeId, body) {
133049
+ return await fetchResult(
133050
+ `/accounts/${accountId}/secrets_store/stores/${storeId}/secrets`,
133051
+ {
133052
+ method: "POST",
133053
+ body: JSON.stringify([body])
133054
+ }
133055
+ );
133056
+ }
133057
+ __name(createSecret, "createSecret");
133058
+ async function updateSecret(accountId, storeId, secretId, body) {
133059
+ return await fetchResult(
133060
+ `/accounts/${accountId}/secrets_store/stores/${storeId}/secrets/${secretId}`,
133061
+ {
133062
+ method: "PATCH",
133063
+ body: JSON.stringify(body)
133064
+ }
133065
+ );
133066
+ }
133067
+ __name(updateSecret, "updateSecret");
133068
+ async function deleteSecret(accountId, storeId, secretId) {
133069
+ return await fetchResult(
133070
+ `/accounts/${accountId}/secrets_store/stores/${storeId}/secrets/${secretId}`,
133071
+ {
133072
+ method: "DELETE"
133073
+ }
133074
+ );
133075
+ }
133076
+ __name(deleteSecret, "deleteSecret");
133077
+ async function duplicateSecret(accountId, storeId, secretId, body) {
133078
+ return await fetchResult(
133079
+ `/accounts/${accountId}/secrets_store/stores/${storeId}/secrets/${secretId}/duplicate`,
133080
+ {
133081
+ method: "POST",
133082
+ body: JSON.stringify(body)
133083
+ }
133084
+ );
133085
+ }
133086
+ __name(duplicateSecret, "duplicateSecret");
133087
+
133088
+ // src/secrets-store/commands.ts
133089
+ var secretsStoreStoreCreateCommand = createCommand({
133090
+ metadata: {
133091
+ description: "Create a store within an account",
133092
+ status: "alpha",
133093
+ owner: "Product: SSL"
133094
+ },
133095
+ positionalArgs: ["name"],
133096
+ args: {
133097
+ name: {
133098
+ type: "string",
133099
+ description: "Name of the store",
133100
+ demandOption: true,
133101
+ requiresArg: true
133102
+ },
133103
+ remote: {
133104
+ type: "boolean",
133105
+ description: "Execute command against remote Secrets Store",
133106
+ default: false
133107
+ }
133108
+ },
133109
+ async handler(args, { config }) {
133110
+ let store;
133111
+ logger.log(`\u{1F510} Creating store... (Name: ${args.name})`);
133112
+ if (args.remote) {
133113
+ const accountId = config.account_id || await getAccountId();
133114
+ store = await createStore(accountId, { name: args.name });
133115
+ } else {
133116
+ logger.log(`Local mode enabled, this command is a no-op.`);
133117
+ return;
133118
+ }
133119
+ logger.log(`\u2705 Created store! (Name: ${args.name}, ID: ${store.id})`);
133120
+ }
133121
+ });
133122
+ var secretsStoreStoreDeleteCommand = createCommand({
133123
+ metadata: {
133124
+ description: "Delete a store within an account",
133125
+ status: "alpha",
133126
+ owner: "Product: SSL"
133127
+ },
133128
+ positionalArgs: ["store-id"],
133129
+ args: {
133130
+ "store-id": {
133131
+ type: "string",
133132
+ description: "ID of the store",
133133
+ demandOption: true,
133134
+ requiresArg: true
133135
+ },
133136
+ remote: {
133137
+ type: "boolean",
133138
+ description: "Execute command against remote Secrets Store",
133139
+ default: false
133140
+ }
133141
+ },
133142
+ async handler(args, { config }) {
133143
+ logger.log(`\u{1F510} Deleting store... (Name: ${args.storeId})`);
133144
+ if (args.remote) {
133145
+ const accountId = config.account_id || await getAccountId();
133146
+ await deleteStore(accountId, args.storeId);
133147
+ } else {
133148
+ logger.log(`Local mode enabled, this command is a no-op.`);
133149
+ return;
133150
+ }
133151
+ logger.log(`\u2705 Deleted store! (ID: ${args.storeId})`);
133152
+ }
133153
+ });
133154
+ var secretsStoreStoreListCommand = createCommand({
133155
+ metadata: {
133156
+ description: "List stores within an account",
133157
+ status: "alpha",
133158
+ owner: "Product: SSL"
133159
+ },
133160
+ args: {
133161
+ page: {
133162
+ describe: 'Page number of stores listing results, can configure page size using "per-page"',
133163
+ type: "number",
133164
+ default: 1
133165
+ },
133166
+ "per-page": {
133167
+ describe: "Number of stores to show per page",
133168
+ type: "number",
133169
+ default: 10
133170
+ },
133171
+ remote: {
133172
+ type: "boolean",
133173
+ description: "Execute command against remote Secrets Store",
133174
+ default: false
133175
+ }
133176
+ },
133177
+ async handler(args, { config }) {
133178
+ const urlParams = new URLSearchParams();
133179
+ urlParams.set("per_page", args.perPage.toString());
133180
+ urlParams.set("page", args.page.toString());
133181
+ logger.log(`\u{1F510} Listing stores...`);
133182
+ let stores;
133183
+ if (args.remote) {
133184
+ const accountId = config.account_id || await getAccountId();
133185
+ stores = await listStores(accountId, urlParams);
133186
+ } else {
133187
+ throw new UserError(
133188
+ "No local dev version of this command available, need to include --remote in command",
133189
+ { telemetryMessage: true }
133190
+ );
133191
+ }
133192
+ if (stores.length === 0) {
133193
+ throw new UserError("List request returned no stores.", {
133194
+ telemetryMessage: true
133195
+ });
133196
+ } else {
133197
+ const prettierStores = stores.sort((a5, b6) => a5.name.localeCompare(b6.name)).map((store) => ({
133198
+ Name: store.name,
133199
+ ID: store.id,
133200
+ AccountID: store.account_id,
133201
+ Created: new Date(store.created).toLocaleString(),
133202
+ Modified: new Date(store.modified).toLocaleString()
133203
+ }));
133204
+ logger.table(prettierStores);
133205
+ }
133206
+ }
133207
+ });
133208
+ var secretsStoreSecretListCommand = createCommand({
133209
+ metadata: {
133210
+ description: "List secrets within a store",
133211
+ status: "alpha",
133212
+ owner: "Product: SSL"
133213
+ },
133214
+ positionalArgs: ["store-id"],
133215
+ args: {
133216
+ "store-id": {
133217
+ describe: "ID of the store in which to list secrets",
133218
+ type: "string",
133219
+ demandOption: true,
133220
+ requiresArg: true
133221
+ },
133222
+ page: {
133223
+ describe: 'Page number of secrets listing results, can configure page size using "per-page"',
133224
+ type: "number",
133225
+ default: 1
133226
+ },
133227
+ "per-page": {
133228
+ describe: "Number of secrets to show per page",
133229
+ type: "number",
133230
+ default: 10
133231
+ },
133232
+ remote: {
133233
+ type: "boolean",
133234
+ description: "Execute command against remote Secrets Store",
133235
+ default: false
133236
+ }
133237
+ },
133238
+ async handler(args, { config }) {
133239
+ const urlParams = new URLSearchParams();
133240
+ urlParams.set("per_page", args.perPage.toString());
133241
+ urlParams.set("page", args.page.toString());
133242
+ logger.log(
133243
+ `\u{1F510} Listing secrets... (store-id: ${args.storeId}, page: ${args.page}, per-page: ${args.perPage})`
133244
+ );
133245
+ let secrets;
133246
+ if (args.remote) {
133247
+ const accountId = config.account_id || await getAccountId();
133248
+ secrets = await listSecrets(accountId, args.storeId, urlParams);
133249
+ } else {
133250
+ throw new UserError(
133251
+ "No local dev version of this command available, need to include --remote in command",
133252
+ { telemetryMessage: true }
133253
+ );
133254
+ }
133255
+ if (secrets.length === 0) {
133256
+ throw new FatalError("List request returned no secrets.", 1, {
133257
+ telemetryMessage: true
133258
+ });
133259
+ } else {
133260
+ const prettierSecrets = secrets.map((secret2) => ({
133261
+ Name: secret2.name,
133262
+ ID: secret2.id,
133263
+ Comment: secret2.comment,
133264
+ Scopes: secret2.scopes.join(", "),
133265
+ Status: secret2.status === "active" ? "active " : "pending",
133266
+ Created: new Date(secret2.created).toLocaleString(),
133267
+ Modified: new Date(secret2.modified).toLocaleString()
133268
+ }));
133269
+ logger.table(prettierSecrets);
133270
+ }
133271
+ }
133272
+ });
133273
+ var secretsStoreSecretGetCommand = createCommand({
133274
+ metadata: {
133275
+ description: "Get a secret within a store",
133276
+ status: "alpha",
133277
+ owner: "Product: SSL"
133278
+ },
133279
+ positionalArgs: ["store-id"],
133280
+ args: {
133281
+ "store-id": {
133282
+ describe: "ID of the store in which the secret resides",
133283
+ type: "string",
133284
+ demandOption: true,
133285
+ requiresArg: true
133286
+ },
133287
+ "secret-id": {
133288
+ describe: "ID of the secret to retrieve",
133289
+ type: "string",
133290
+ demandOption: true,
133291
+ requiresArg: true
133292
+ },
133293
+ remote: {
133294
+ type: "boolean",
133295
+ description: "Execute command against remote Secrets Store",
133296
+ default: false
133297
+ }
133298
+ },
133299
+ async handler(args, { config }) {
133300
+ logger.log(`\u{1F510} Getting secret... (ID: ${args.secretId})`);
133301
+ let secret2;
133302
+ if (args.remote) {
133303
+ const accountId = config.account_id || await getAccountId();
133304
+ secret2 = await getSecret(accountId, args.storeId, args.secretId);
133305
+ } else {
133306
+ throw new UserError(
133307
+ "No local dev version of this command available, need to include --remote in command",
133308
+ { telemetryMessage: true }
133309
+ );
133310
+ }
133311
+ const prettierSecret = [
133312
+ {
133313
+ Name: secret2.name,
133314
+ ID: secret2.id,
133315
+ StoreID: secret2.store_id,
133316
+ Comment: secret2.comment,
133317
+ Scopes: secret2.scopes.join(", "),
133318
+ Status: secret2.status === "active" ? "active " : "pending",
133319
+ Created: new Date(secret2.created).toLocaleString(),
133320
+ Modified: new Date(secret2.modified).toLocaleString()
133321
+ }
133322
+ ];
133323
+ logger.table(prettierSecret);
133324
+ }
133325
+ });
133326
+ var secretsStoreSecretCreateCommand = createCommand({
133327
+ metadata: {
133328
+ description: "Create a secret within a store",
133329
+ status: "alpha",
133330
+ owner: "Product: SSL"
133331
+ },
133332
+ positionalArgs: ["store-id"],
133333
+ args: {
133334
+ "store-id": {
133335
+ describe: "ID of the store in which the secret resides",
133336
+ type: "string",
133337
+ requiresArg: true,
133338
+ demandOption: true
133339
+ },
133340
+ name: {
133341
+ describe: "Name of the secret",
133342
+ type: "string",
133343
+ requiresArg: true,
133344
+ demandOption: true
133345
+ },
133346
+ value: {
133347
+ describe: "Value of the secret (Note: Only for testing. Not secure as this will leave secret value in plain-text in terminal history, exclude this flag and use automatic prompt instead)",
133348
+ type: "string"
133349
+ },
133350
+ scopes: {
133351
+ describe: 'Scopes for the secret (comma-separated list of scopes eg:"workers")',
133352
+ type: "string",
133353
+ requiresArg: true,
133354
+ demandOption: true
133355
+ },
133356
+ comment: {
133357
+ describe: "Comment for the secret",
133358
+ type: "string"
133359
+ },
133360
+ remote: {
133361
+ type: "boolean",
133362
+ description: "Execute command against remote Secrets Store",
133363
+ default: false
133364
+ }
133365
+ },
133366
+ async handler(args, { config }) {
133367
+ let secretValue = "";
133368
+ if (!args.value) {
133369
+ const isInteractive3 = process.stdin.isTTY;
133370
+ secretValue = trimTrailingWhitespace(
133371
+ isInteractive3 ? await prompt("Enter a secret value:", { isSecret: true }) : await readFromStdin()
133372
+ );
133373
+ } else {
133374
+ secretValue = args.value;
133375
+ }
133376
+ if (!secretValue) {
133377
+ throw new UserError("Need to pass in a value when creating a secret.");
133378
+ }
133379
+ logger.log(
133380
+ `
133381
+ \u{1F510} Creating secret... (Name: ${args.name}, Value: REDACTED, Scopes: ${args.scopes}, Comment: ${args.comment})`
133382
+ );
133383
+ let secrets;
133384
+ if (args.remote) {
133385
+ const accountId = config.account_id || await getAccountId();
133386
+ secrets = await createSecret(accountId, args.storeId, {
133387
+ name: args.name,
133388
+ value: secretValue,
133389
+ scopes: args.scopes.split(","),
133390
+ comment: args.comment
133391
+ });
133392
+ } else {
133393
+ throw new UserError(
133394
+ "No local dev version of this command available, need to include --remote in command",
133395
+ { telemetryMessage: true }
133396
+ );
133397
+ }
133398
+ if (secrets.length === 0) {
133399
+ throw new FatalError("Failed to create a secret.", 1, {
133400
+ telemetryMessage: true
133401
+ });
133402
+ }
133403
+ const secret2 = secrets[0];
133404
+ logger.log(`\u2705 Created secret! (ID: ${secret2.id})`);
133405
+ const prettierSecret = [
133406
+ {
133407
+ Name: secret2.name,
133408
+ ID: secret2.id,
133409
+ StoreID: secret2.store_id,
133410
+ Comment: secret2.comment,
133411
+ Scopes: secret2.scopes.join(", "),
133412
+ Status: secret2.status,
133413
+ Created: new Date(secret2.created).toLocaleString(),
133414
+ Modified: new Date(secret2.modified).toLocaleString()
133415
+ }
133416
+ ];
133417
+ logger.table(prettierSecret);
133418
+ }
133419
+ });
133420
+ var secretsStoreSecretUpdateCommand = createCommand({
133421
+ metadata: {
133422
+ description: "Update a secret within a store",
133423
+ status: "alpha",
133424
+ owner: "Product: SSL"
133425
+ },
133426
+ positionalArgs: ["store-id"],
133427
+ args: {
133428
+ "store-id": {
133429
+ describe: "ID of the store in which the secret resides",
133430
+ type: "string",
133431
+ requiresArg: true,
133432
+ demandOption: true
133433
+ },
133434
+ "secret-id": {
133435
+ describe: "ID of the secret to update",
133436
+ type: "string",
133437
+ requiresArg: true,
133438
+ demandOption: true
133439
+ },
133440
+ value: {
133441
+ describe: "Updated value of the secret (Note: Only for testing. Not secure as this will leave secret value in plain-text in terminal history, exclude this flag and use automatic prompt instead)",
133442
+ type: "string"
133443
+ },
133444
+ scopes: {
133445
+ describe: 'Updated scopes for the secret (comma-separated list of scopes eg:"workers")',
133446
+ type: "string"
133447
+ },
133448
+ comment: {
133449
+ describe: "Updated comment for the secret",
133450
+ type: "string"
133451
+ },
133452
+ remote: {
133453
+ type: "boolean",
133454
+ description: "Execute command against remote Secrets Store",
133455
+ default: false
133456
+ }
133457
+ },
133458
+ async handler(args, { config }) {
133459
+ let secretValue = "";
133460
+ if (!args.value) {
133461
+ const confirmValueUpdate = await confirm(
133462
+ "Do you want to update the secret value?",
133463
+ { defaultValue: false }
133464
+ );
133465
+ if (confirmValueUpdate) {
133466
+ const isInteractive3 = process.stdin.isTTY;
133467
+ secretValue = trimTrailingWhitespace(
133468
+ isInteractive3 ? await prompt("Enter a secret value:", { isSecret: true }) : await readFromStdin()
133469
+ );
133470
+ }
133471
+ } else {
133472
+ secretValue = args.value;
133473
+ }
133474
+ if (!secretValue && !args.scopes && !args.comment) {
133475
+ throw new UserError(
133476
+ "Need to pass in a new field using `--value`, `--scopes`, or `--comment` to update a secret."
133477
+ );
133478
+ }
133479
+ logger.log(`\u{1F510} Updating secret... (ID: ${args.secretId})`);
133480
+ let secret2;
133481
+ if (args.remote) {
133482
+ const accountId = config.account_id || await getAccountId();
133483
+ secret2 = await updateSecret(accountId, args.storeId, args.secretId, {
133484
+ ...secretValue && { value: secretValue },
133485
+ ...args.scopes && { scopes: args.scopes.split(",") },
133486
+ ...args.comment && { comment: args.comment }
133487
+ });
133488
+ } else {
133489
+ throw new UserError(
133490
+ "No local dev version of this command available, need to include --remote in command",
133491
+ { telemetryMessage: true }
133492
+ );
133493
+ }
133494
+ logger.log(`\u2705 Updated secret! (ID: ${secret2.id})`);
133495
+ const prettierSecret = [
133496
+ {
133497
+ Name: secret2.name,
133498
+ ID: secret2.id,
133499
+ StoreID: secret2.store_id,
133500
+ Comment: secret2.comment,
133501
+ Scopes: secret2.scopes.join(", "),
133502
+ Status: secret2.status,
133503
+ Created: new Date(secret2.created).toLocaleString(),
133504
+ Modified: new Date(secret2.modified).toLocaleString()
133505
+ }
133506
+ ];
133507
+ logger.table(prettierSecret);
133508
+ }
133509
+ });
133510
+ var secretsStoreSecretDeleteCommand = createCommand({
133511
+ metadata: {
133512
+ description: "Delete a secret within a store",
133513
+ status: "alpha",
133514
+ owner: "Product: SSL"
133515
+ },
133516
+ positionalArgs: ["store-id"],
133517
+ args: {
133518
+ "store-id": {
133519
+ describe: "ID of the store in which the secret resides",
133520
+ type: "string",
133521
+ requiresArg: true,
133522
+ demandOption: true
133523
+ },
133524
+ "secret-id": {
133525
+ describe: "ID of the secret to delete",
133526
+ type: "string",
133527
+ requiresArg: true,
133528
+ demandOption: true
133529
+ },
133530
+ remote: {
133531
+ type: "boolean",
133532
+ description: "Execute command against remote Secrets Store",
133533
+ default: false
133534
+ }
133535
+ },
133536
+ async handler(args, { config }) {
133537
+ logger.log(`\u{1F510} Deleting secret... (ID: ${args.secretId})`);
133538
+ if (args.remote) {
133539
+ const accountId = config.account_id || await getAccountId();
133540
+ await deleteSecret(accountId, args.storeId, args.secretId);
133541
+ } else {
133542
+ throw new UserError(
133543
+ "No local dev version of this command available, need to include --remote in command",
133544
+ { telemetryMessage: true }
133545
+ );
133546
+ }
133547
+ logger.log(`\u2705 Deleted secret! (ID: ${args.secretId})`);
133548
+ }
133549
+ });
133550
+ var secretsStoreSecretDuplicateCommand = createCommand({
133551
+ metadata: {
133552
+ description: "Duplicate a secret within a store",
133553
+ status: "alpha",
133554
+ owner: "Product: SSL"
133555
+ },
133556
+ positionalArgs: ["store-id"],
133557
+ args: {
133558
+ "store-id": {
133559
+ describe: "ID of the store in which the secret resides",
133560
+ type: "string",
133561
+ requiresArg: true,
133562
+ demandOption: true
133563
+ },
133564
+ "secret-id": {
133565
+ describe: "ID of the secret to duplicate the secret value of",
133566
+ type: "string",
133567
+ requiresArg: true,
133568
+ demandOption: true
133569
+ },
133570
+ name: {
133571
+ describe: "Name of the new secret",
133572
+ type: "string",
133573
+ requiresArg: true,
133574
+ demandOption: true
133575
+ },
133576
+ scopes: {
133577
+ describe: "Scopes for the new secret",
133578
+ type: "string",
133579
+ requiresArg: true,
133580
+ demandOption: true
133581
+ },
133582
+ comment: {
133583
+ describe: "Comment for the new secret",
133584
+ type: "string"
133585
+ },
133586
+ remote: {
133587
+ type: "boolean",
133588
+ description: "Execute command against remote Secrets Store",
133589
+ default: false
133590
+ }
133591
+ },
133592
+ async handler(args, { config }) {
133593
+ logger.log(`\u{1F510} Duplicating secret... (ID: ${args.secretId})`);
133594
+ let duplicatedSecret;
133595
+ if (args.remote) {
133596
+ const accountId = config.account_id || await getAccountId();
133597
+ duplicatedSecret = await duplicateSecret(
133598
+ accountId,
133599
+ args.storeId,
133600
+ args.secretId,
133601
+ {
133602
+ name: args.name,
133603
+ scopes: args.scopes.split(","),
133604
+ comment: args.comment || ""
133605
+ }
133606
+ );
133607
+ } else {
133608
+ throw new UserError(
133609
+ "No local dev version of this command available, need to include --remote in command",
133610
+ { telemetryMessage: true }
133611
+ );
133612
+ }
133613
+ logger.log(`\u2705 Duplicated secret! (ID: ${duplicatedSecret.id})`);
133614
+ const prettierSecret = [
133615
+ {
133616
+ Name: duplicatedSecret.name,
133617
+ ID: duplicatedSecret.id,
133618
+ StoreID: duplicatedSecret.store_id,
133619
+ Comment: duplicatedSecret.comment,
133620
+ Scopes: duplicatedSecret.scopes.join(", "),
133621
+ Status: duplicatedSecret.status,
133622
+ Created: new Date(duplicatedSecret.created).toLocaleString(),
133623
+ Modified: new Date(duplicatedSecret.modified).toLocaleString()
133624
+ }
133625
+ ];
133626
+ logger.table(prettierSecret);
133627
+ }
133628
+ });
133629
+
132966
133630
  // src/sentry/index.ts
132967
133631
  init_import_meta_url();
132968
133632
 
@@ -146234,8 +146898,7 @@ var versionsUploadCommand = createCommand({
146234
146898
  useConfigRedirectIfAvailable: true,
146235
146899
  overrideExperimentalFlags: /* @__PURE__ */ __name((args) => ({
146236
146900
  MULTIWORKER: false,
146237
- RESOURCES_PROVISION: args.experimentalProvision ?? false,
146238
- ASSETS_RPC: false
146901
+ RESOURCES_PROVISION: args.experimentalProvision ?? false
146239
146902
  }), "overrideExperimentalFlags")
146240
146903
  },
146241
146904
  handler: /* @__PURE__ */ __name(async function versionsUploadHandler(args, { config }) {
@@ -146930,9 +147593,15 @@ var workflowsDeleteCommand = createCommand({
146930
147593
  }
146931
147594
  },
146932
147595
  positionalArgs: ["name"],
146933
- async handler(args) {
146934
- logger.info("\u{1F6AB} delete command not yet implement");
146935
- logger.log(`\u{1F6AB} Workflow "${args.name}" NOT removed`);
147596
+ async handler(args, { config }) {
147597
+ const accountId = await requireAuth(config);
147598
+ await fetchResult(`/accounts/${accountId}/workflows/${args.name}`, {
147599
+ method: "DELETE"
147600
+ });
147601
+ logger.log(
147602
+ `\u2705 Workflow "${args.name}" removed successfully.
147603
+ Note that running instances might take a few minutes to be properly terminated.`
147604
+ );
146936
147605
  }
146937
147606
  });
146938
147607
 
@@ -148205,6 +148874,65 @@ var workflowsInstancesTerminateCommand = createCommand({
148205
148874
  }
148206
148875
  });
148207
148876
 
148877
+ // src/workflows/commands/instances/terminate-all.ts
148878
+ init_import_meta_url();
148879
+ var workflowsInstancesTerminateAllCommand = createCommand({
148880
+ metadata: {
148881
+ description: "Terminate all workflow instances",
148882
+ owner: "Product: Workflows",
148883
+ status: "open-beta",
148884
+ hidden: true
148885
+ },
148886
+ positionalArgs: ["name"],
148887
+ args: {
148888
+ name: {
148889
+ describe: "Name of the workflow",
148890
+ type: "string",
148891
+ demandOption: true
148892
+ },
148893
+ status: {
148894
+ describe: "Filter instances to be terminated by status",
148895
+ type: "string"
148896
+ }
148897
+ },
148898
+ validateArgs: /* @__PURE__ */ __name((args) => {
148899
+ const validStatusToTerminate = [
148900
+ "queued",
148901
+ "running",
148902
+ "paused",
148903
+ "waitingForPause",
148904
+ "waiting"
148905
+ ];
148906
+ if (args.status !== void 0 && !validStatusToTerminate.includes(args.status)) {
148907
+ throw new CommandLineArgsError(
148908
+ `Provided status "${args.status}" is not valid, it must be one of the following: ${validStatusToTerminate.join(", ")}.`
148909
+ );
148910
+ }
148911
+ }, "validateArgs"),
148912
+ async handler(args, { config }) {
148913
+ const accountId = await requireAuth(config);
148914
+ const maybeURLQueryString = args.status !== void 0 ? new URLSearchParams({
148915
+ status: args.status
148916
+ }) : void 0;
148917
+ const result = await fetchResult(
148918
+ `/accounts/${accountId}/workflows/${args.name}/instances/terminate`,
148919
+ {
148920
+ method: "PUT"
148921
+ },
148922
+ maybeURLQueryString
148923
+ );
148924
+ if (result.status === "ok") {
148925
+ logger.info(
148926
+ `\u{1F977} A job to terminate instances from Workflow "${args.name}" ${args.status !== void 0 ? `with status "${args.status}"` : ""} has been started. It might take a few minutes to complete.`
148927
+ );
148928
+ return;
148929
+ }
148930
+ logger.info(
148931
+ `\u{1F977} A job to terminate instances from Workflow "${args.name}" ${args.status !== void 0 ? `with status "${args.status}"` : ""} is already running. It might take a few minutes to complete.`
148932
+ );
148933
+ }
148934
+ });
148935
+
148208
148936
  // src/workflows/commands/list.ts
148209
148937
  init_import_meta_url();
148210
148938
  var workflowsListCommand = createCommand({
@@ -148822,6 +149550,54 @@ function createCLIParser(argv) {
148822
149550
  wrangler.command("ai", "\u{1F916} Manage AI models", (aiYargs) => {
148823
149551
  return ai(aiYargs.command(subHelp));
148824
149552
  });
149553
+ registry.define([
149554
+ { command: "wrangler secrets-store", definition: secretsStoreNamespace },
149555
+ {
149556
+ command: "wrangler secrets-store store",
149557
+ definition: secretsStoreStoreNamespace
149558
+ },
149559
+ {
149560
+ command: "wrangler secrets-store store create",
149561
+ definition: secretsStoreStoreCreateCommand
149562
+ },
149563
+ {
149564
+ command: "wrangler secrets-store store delete",
149565
+ definition: secretsStoreStoreDeleteCommand
149566
+ },
149567
+ {
149568
+ command: "wrangler secrets-store store list",
149569
+ definition: secretsStoreStoreListCommand
149570
+ },
149571
+ {
149572
+ command: "wrangler secrets-store secret",
149573
+ definition: secretsStoreSecretNamespace
149574
+ },
149575
+ {
149576
+ command: "wrangler secrets-store secret create",
149577
+ definition: secretsStoreSecretCreateCommand
149578
+ },
149579
+ {
149580
+ command: "wrangler secrets-store secret list",
149581
+ definition: secretsStoreSecretListCommand
149582
+ },
149583
+ {
149584
+ command: "wrangler secrets-store secret get",
149585
+ definition: secretsStoreSecretGetCommand
149586
+ },
149587
+ {
149588
+ command: "wrangler secrets-store secret update",
149589
+ definition: secretsStoreSecretUpdateCommand
149590
+ },
149591
+ {
149592
+ command: "wrangler secrets-store secret delete",
149593
+ definition: secretsStoreSecretDeleteCommand
149594
+ },
149595
+ {
149596
+ command: "wrangler secrets-store secret duplicate",
149597
+ definition: secretsStoreSecretDuplicateCommand
149598
+ }
149599
+ ]);
149600
+ registry.registerNamespace("cert");
148825
149601
  registry.define([
148826
149602
  {
148827
149603
  command: "wrangler workflows",
@@ -148859,6 +149635,10 @@ function createCLIParser(argv) {
148859
149635
  command: "wrangler workflows instances terminate",
148860
149636
  definition: workflowsInstancesTerminateCommand
148861
149637
  },
149638
+ {
149639
+ command: "wrangler workflows instances terminate-all",
149640
+ definition: workflowsInstancesTerminateAllCommand
149641
+ },
148862
149642
  {
148863
149643
  command: "wrangler workflows instances pause",
148864
149644
  definition: workflowsInstancesPauseCommand
@@ -150484,9 +151264,10 @@ ${resolvedAssetsPath}`,
150484
151264
  const headers = maybeGetFile(path62.join(resolvedAssetsPath, HEADERS_FILENAME));
150485
151265
  const assetConfig = {
150486
151266
  html_handling: config.assets?.html_handling,
150487
- not_found_handling: config.assets?.not_found_handling
151267
+ not_found_handling: config.assets?.not_found_handling,
150488
151268
  // The _redirects and _headers files are parsed in Miniflare in dev and parsing is not required for deploy
150489
- // Similarly, `compatibility_date` and `compatibility_flags` are populated by Miniflare from the Worker definition and also are not required for deploy
151269
+ compatibility_date: config.compatibility_date,
151270
+ compatibility_flags: config.compatibility_flags
150490
151271
  };
150491
151272
  return {
150492
151273
  directory: resolvedAssetsPath,
@@ -150935,8 +151716,7 @@ var dev = createCommand({
150935
151716
  provideConfig: false,
150936
151717
  overrideExperimentalFlags: /* @__PURE__ */ __name((args) => ({
150937
151718
  MULTIWORKER: Array.isArray(args.config),
150938
- RESOURCES_PROVISION: args.experimentalProvision ?? false,
150939
- ASSETS_RPC: args.experimentalAssetsRpc
151719
+ RESOURCES_PROVISION: args.experimentalProvision ?? false
150940
151720
  }), "overrideExperimentalFlags")
150941
151721
  },
150942
151722
  metadata: {
@@ -151152,13 +151932,6 @@ var dev = createCommand({
151152
151932
  type: "boolean",
151153
151933
  describe: "Use a local lower-fidelity implementation of the Images binding",
151154
151934
  default: false
151155
- },
151156
- "experimental-assets-rpc": {
151157
- alias: "x-assets-rpc",
151158
- type: "boolean",
151159
- describe: "Support JSRPC bindings to Workers + Assets projects",
151160
- default: false,
151161
- hidden: true
151162
151935
  }
151163
151936
  },
151164
151937
  async validateArgs(args) {
@@ -151814,15 +152587,13 @@ unstable_dev()'s behaviour will likely change in future releases`
151814
152587
  experimentalVectorizeBindToProd: vectorizeBindToProd ?? false,
151815
152588
  experimentalImagesLocalMode: imagesLocalMode ?? false,
151816
152589
  enableIpc: options33?.experimental?.enableIpc,
151817
- nodeCompat: void 0,
151818
- experimentalAssetsRpc: false
152590
+ nodeCompat: void 0
151819
152591
  };
151820
152592
  const devServer = await run(
151821
152593
  {
151822
152594
  // TODO: can we make this work?
151823
152595
  MULTIWORKER: false,
151824
- RESOURCES_PROVISION: false,
151825
- ASSETS_RPC: false
152596
+ RESOURCES_PROVISION: false
151826
152597
  },
151827
152598
  () => startDev(devOptions)
151828
152599
  );
@@ -153776,8 +154547,7 @@ async function getPlatformProxy(options33 = {}) {
153776
154547
  const miniflareOptions = await run(
153777
154548
  {
153778
154549
  MULTIWORKER: false,
153779
- RESOURCES_PROVISION: false,
153780
- ASSETS_RPC: false
154550
+ RESOURCES_PROVISION: false
153781
154551
  },
153782
154552
  () => getMiniflareOptionsFromConfig(rawConfig, env6, options33)
153783
154553
  );