wrangler 3.84.1 → 3.86.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.
@@ -22717,12 +22717,12 @@ var require_lodash = __commonJS({
22717
22717
  __name(random, "random");
22718
22718
  var camelCase2 = createCompounder(function(result2, word, index) {
22719
22719
  word = word.toLowerCase();
22720
- return result2 + (index ? capitalize(word) : word);
22720
+ return result2 + (index ? capitalize2(word) : word);
22721
22721
  });
22722
- function capitalize(string) {
22722
+ function capitalize2(string) {
22723
22723
  return upperFirst(toString2(string).toLowerCase());
22724
22724
  }
22725
- __name(capitalize, "capitalize");
22725
+ __name(capitalize2, "capitalize");
22726
22726
  function deburr(string) {
22727
22727
  string = toString2(string);
22728
22728
  return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
@@ -23380,7 +23380,7 @@ var require_lodash = __commonJS({
23380
23380
  lodash.add = add;
23381
23381
  lodash.attempt = attempt;
23382
23382
  lodash.camelCase = camelCase2;
23383
- lodash.capitalize = capitalize;
23383
+ lodash.capitalize = capitalize2;
23384
23384
  lodash.ceil = ceil;
23385
23385
  lodash.clamp = clamp;
23386
23386
  lodash.clone = clone;
@@ -57481,7 +57481,7 @@ var require_parser = __commonJS({
57481
57481
  }
57482
57482
  };
57483
57483
  __name(ParserError, "ParserError");
57484
- var State2 = class {
57484
+ var State = class {
57485
57485
  constructor(parser2) {
57486
57486
  this.parser = parser2;
57487
57487
  this.buf = "";
@@ -57491,7 +57491,7 @@ var require_parser = __commonJS({
57491
57491
  this.resultArr = null;
57492
57492
  }
57493
57493
  };
57494
- __name(State2, "State");
57494
+ __name(State, "State");
57495
57495
  var Parser2 = class {
57496
57496
  constructor() {
57497
57497
  this.pos = 0;
@@ -57503,7 +57503,7 @@ var require_parser = __commonJS({
57503
57503
  this._buf = "";
57504
57504
  this.char = null;
57505
57505
  this.ii = 0;
57506
- this.state = new State2(this.parseStart);
57506
+ this.state = new State(this.parseStart);
57507
57507
  }
57508
57508
  parse(str) {
57509
57509
  if (str.length === 0 || str.length == null)
@@ -57559,7 +57559,7 @@ var require_parser = __commonJS({
57559
57559
  if (returnWith)
57560
57560
  this.next(returnWith);
57561
57561
  this.stack.push(this.state);
57562
- this.state = new State2(fn2);
57562
+ this.state = new State(fn2);
57563
57563
  }
57564
57564
  callNow(fn2, returnWith) {
57565
57565
  this.call(fn2, returnWith);
@@ -111468,10 +111468,10 @@ var require_src6 = __commonJS({
111468
111468
  });
111469
111469
  var import_assert7 = __toModule(require("assert"));
111470
111470
  var import_path21 = __toModule(require("path"));
111471
- var import_util8 = __toModule(require("util"));
111471
+ var import_util9 = __toModule(require("util"));
111472
111472
  var import_worker_threads = __toModule(require("worker_threads"));
111473
111473
  var import_picomatch = __toModule(require_picomatch2());
111474
- var encoder = new import_util8.TextEncoder();
111474
+ var encoder = new import_util9.TextEncoder();
111475
111475
  var numericCompare = new Intl.Collator(void 0, { numeric: true }).compare;
111476
111476
  function arrayCompare(a, b2) {
111477
111477
  const minLength = Math.min(a.length, b2.length);
@@ -132574,7 +132574,7 @@ var require_parser2 = __commonJS({
132574
132574
  }
132575
132575
  };
132576
132576
  __name(ParserError, "ParserError");
132577
- var State2 = class {
132577
+ var State = class {
132578
132578
  constructor(parser2) {
132579
132579
  this.parser = parser2;
132580
132580
  this.buf = "";
@@ -132584,7 +132584,7 @@ var require_parser2 = __commonJS({
132584
132584
  this.resultArr = null;
132585
132585
  }
132586
132586
  };
132587
- __name(State2, "State");
132587
+ __name(State, "State");
132588
132588
  var Parser2 = class {
132589
132589
  constructor() {
132590
132590
  this.pos = 0;
@@ -132596,7 +132596,7 @@ var require_parser2 = __commonJS({
132596
132596
  this._buf = "";
132597
132597
  this.char = null;
132598
132598
  this.ii = 0;
132599
- this.state = new State2(this.parseStart);
132599
+ this.state = new State(this.parseStart);
132600
132600
  }
132601
132601
  parse(str) {
132602
132602
  if (str.length === 0 || str.length == null)
@@ -132652,7 +132652,7 @@ var require_parser2 = __commonJS({
132652
132652
  if (returnWith)
132653
132653
  this.next(returnWith);
132654
132654
  this.stack.push(this.state);
132655
- this.state = new State2(fn2);
132655
+ this.state = new State(fn2);
132656
132656
  }
132657
132657
  callNow(fn2, returnWith) {
132658
132658
  this.call(fn2, returnWith);
@@ -134712,8 +134712,8 @@ var require_src7 = __commonJS({
134712
134712
  var import_assert7 = __toModule(require("assert"));
134713
134713
  var import_fs16 = __toModule(require("fs"));
134714
134714
  var import_path21 = __toModule(require("path"));
134715
- var import_util8 = __toModule(require("util"));
134716
- var log2 = (0, import_util8.debuglog)("mf-watch");
134715
+ var import_util9 = __toModule(require("util"));
134716
+ var log2 = (0, import_util9.debuglog)("mf-watch");
134717
134717
  function withinDir(dir, file) {
134718
134718
  const rel = import_path21.default.relative(dir, file);
134719
134719
  return !!rel && !rel.startsWith("..") && !import_path21.default.isAbsolute(rel);
@@ -136618,8 +136618,8 @@ Make sure you're ${suggestion}.`);
136618
136618
  userAgent = "Cloudflare-Workers";
136619
136619
  }, "Navigator");
136620
136620
  var import_web4 = __toModule(require("stream/web"));
136621
- var import_util8 = __toModule(require("util"));
136622
- var encoder = new import_util8.TextEncoder();
136621
+ var import_util9 = __toModule(require("util"));
136622
+ var encoder = new import_util9.TextEncoder();
136623
136623
  var rangePrefixRegexp = /^ *bytes *=/i;
136624
136624
  var rangeRegexp = /^ *(?<start>\d+)? *- *(?<end>\d+)? *$/;
136625
136625
  function parseRanges(rangeHeader, length) {
@@ -139500,7 +139500,7 @@ var require_src9 = __commonJS({
139500
139500
  });
139501
139501
  var import_shared = __toModule(require_src6());
139502
139502
  var import_web2 = __toModule(require("stream/web"));
139503
- var import_core29 = __toModule(require_src8());
139503
+ var import_core31 = __toModule(require_src8());
139504
139504
  var import_undici29 = __toModule(require_undici2());
139505
139505
  var kEnableEsiTags = Symbol("kEnableEsiTags");
139506
139506
  var HTMLRewriter2 = /* @__PURE__ */ __name(class {
@@ -139518,9 +139518,9 @@ var require_src9 = __commonJS({
139518
139518
  transform(response) {
139519
139519
  const body = response.body;
139520
139520
  if (body === null)
139521
- return new import_core29.Response(body, response);
139521
+ return new import_core31.Response(body, response);
139522
139522
  if (response instanceof import_undici29.Response) {
139523
- response = new import_core29.Response(response.body, response);
139523
+ response = new import_core31.Response(response.body, response);
139524
139524
  }
139525
139525
  let rewriter;
139526
139526
  const transformStream = new import_web2.TransformStream({
@@ -139545,7 +139545,7 @@ var require_src9 = __commonJS({
139545
139545
  const promise = body.pipeTo(transformStream.writable);
139546
139546
  promise.catch(() => {
139547
139547
  }).finally(() => rewriter.free());
139548
- const res = new import_core29.Response(transformStream.readable, response);
139548
+ const res = new import_core31.Response(transformStream.readable, response);
139549
139549
  res.headers.delete("Content-Length");
139550
139550
  return res;
139551
139551
  }
@@ -154577,7 +154577,7 @@ function getLoggerLevel() {
154577
154577
  return fromEnv;
154578
154578
  }
154579
154579
  const expected = Object.keys(LOGGER_LEVELS).map((level) => `"${level}"`).join(" | ");
154580
- logger.warnOnce(
154580
+ logger.once.warn(
154581
154581
  `Unrecognised WRANGLER_LOG value ${JSON.stringify(
154582
154582
  fromEnv
154583
154583
  )}, expected ${expected}, defaulting to "log"...`
@@ -154634,11 +154634,20 @@ var _Logger = class {
154634
154634
  console[method].apply(console, args);
154635
154635
  (_b2 = __privateGet(_Logger, _afterLogHook)) == null ? void 0 : _b2.call(_Logger);
154636
154636
  }
154637
- warnOnce(message) {
154638
- const { warnOnceHistory } = this.constructor;
154639
- if (!warnOnceHistory.has(message)) {
154640
- warnOnceHistory.add(message);
154641
- this.warn(message);
154637
+ get once() {
154638
+ return {
154639
+ info: (...args) => this.doLogOnce("info", args),
154640
+ log: (...args) => this.doLogOnce("log", args),
154641
+ warn: (...args) => this.doLogOnce("warn", args),
154642
+ error: (...args) => this.doLogOnce("error", args)
154643
+ };
154644
+ }
154645
+ doLogOnce(messageLevel, args) {
154646
+ const { onceHistory } = this.constructor;
154647
+ const cacheKey = `${messageLevel}: ${args.join(" ")}`;
154648
+ if (!onceHistory.has(cacheKey)) {
154649
+ onceHistory.add(cacheKey);
154650
+ this.doLog(messageLevel, args);
154642
154651
  }
154643
154652
  }
154644
154653
  doLog(messageLevel, args) {
@@ -154679,7 +154688,7 @@ var Logger = _Logger;
154679
154688
  __name(Logger, "Logger");
154680
154689
  _beforeLogHook = new WeakMap();
154681
154690
  _afterLogHook = new WeakMap();
154682
- __publicField(Logger, "warnOnceHistory", /* @__PURE__ */ new Set());
154691
+ __publicField(Logger, "onceHistory", /* @__PURE__ */ new Set());
154683
154692
  __privateAdd(Logger, _beforeLogHook, void 0);
154684
154693
  __privateAdd(Logger, _afterLogHook, void 0);
154685
154694
  var logger = new Logger();
@@ -155898,7 +155907,7 @@ var import_undici3 = __toESM(require_undici());
155898
155907
 
155899
155908
  // package.json
155900
155909
  var name = "wrangler";
155901
- var version = "3.84.1";
155910
+ var version = "3.86.0";
155902
155911
 
155903
155912
  // src/user/index.ts
155904
155913
  init_import_meta_url();
@@ -161471,6 +161480,7 @@ var friendlyBindingNames = {
161471
161480
  assets: "Assets"
161472
161481
  };
161473
161482
  function printBindings(bindings, context2 = {}) {
161483
+ let hasConnectionStatus = false;
161474
161484
  const truncate4 = /* @__PURE__ */ __name((item) => {
161475
161485
  const s = typeof item === "string" ? item : JSON.stringify(item);
161476
161486
  const maxLength = 40;
@@ -161523,12 +161533,13 @@ function printBindings(bindings, context2 = {}) {
161523
161533
  if (script_name) {
161524
161534
  if (context2.local) {
161525
161535
  const registryDefinition = context2.registry?.[script_name];
161536
+ hasConnectionStatus = true;
161526
161537
  if (registryDefinition && registryDefinition.durableObjects.some(
161527
161538
  (d2) => d2.className === class_name
161528
161539
  )) {
161529
- value += ` (defined in \u{1F7E2} ${script_name})`;
161540
+ value += ` (defined in ${script_name} ${source_default.green("[connected]")})`;
161530
161541
  } else {
161531
- value += ` (defined in \u{1F534} ${script_name})`;
161542
+ value += ` (defined in ${script_name} ${source_default.red("[not connected]")})`;
161532
161543
  }
161533
161544
  } else {
161534
161545
  value += ` (defined in ${script_name})`;
@@ -161669,10 +161680,11 @@ function printBindings(bindings, context2 = {}) {
161669
161680
  }
161670
161681
  if (context2.local) {
161671
161682
  const registryDefinition = context2.registry?.[service];
161683
+ hasConnectionStatus = true;
161672
161684
  if (registryDefinition && (!entrypoint || registryDefinition.entrypointAddresses?.[entrypoint])) {
161673
- value = `\u{1F7E2} ` + value;
161685
+ value = value + " " + source_default.green("[connected]");
161674
161686
  } else {
161675
- value = `\u{1F534} ` + value;
161687
+ value = value + " " + source_default.red("[not connected]");
161676
161688
  }
161677
161689
  }
161678
161690
  return {
@@ -161816,6 +161828,13 @@ function printBindings(bindings, context2 = {}) {
161816
161828
  }).flat(2)
161817
161829
  ].join("\n");
161818
161830
  logger.log(message);
161831
+ if (hasConnectionStatus) {
161832
+ logger.once.info(
161833
+ `
161834
+ Service bindings & durable object bindings connect to other \`wrangler dev\` processes running locally, with their connection status indicated by ${source_default.green("[connected]")} or ${source_default.red("[not connected]")}. For more details, refer to https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/#local-development
161835
+ `
161836
+ );
161837
+ }
161819
161838
  }
161820
161839
  __name(printBindings, "printBindings");
161821
161840
  function withConfig(handler30) {
@@ -163230,7 +163249,6 @@ async function bundleWorker(entry, destination, {
163230
163249
  targetConsumer,
163231
163250
  testScheduled,
163232
163251
  inject: injectOption,
163233
- loader,
163234
163252
  sourcemap,
163235
163253
  plugins,
163236
163254
  isOutfile,
@@ -163388,10 +163406,7 @@ async function bundleWorker(entry, destination, {
163388
163406
  ...define2
163389
163407
  }
163390
163408
  },
163391
- loader: {
163392
- ...COMMON_ESBUILD_OPTIONS.loader,
163393
- ...loader || {}
163394
- },
163409
+ loader: COMMON_ESBUILD_OPTIONS.loader,
163395
163410
  plugins: [
163396
163411
  aliasPlugin,
163397
163412
  moduleCollector.plugin,
@@ -163796,7 +163811,7 @@ function createWorkerUploadForm(worker) {
163796
163811
  metadataBindings.push({
163797
163812
  name: binding,
163798
163813
  type: "pipelines",
163799
- id: pipeline
163814
+ pipeline
163800
163815
  });
163801
163816
  });
163802
163817
  bindings.logfwdr?.bindings.forEach(({ name: name2, destination }) => {
@@ -165813,7 +165828,7 @@ var didWarnMiniflareCronSupport = false;
165813
165828
  var didWarnMiniflareVectorizeSupport = false;
165814
165829
  var didWarnAiAccountUsage = false;
165815
165830
  async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticationSecret) {
165816
- if (config.crons.length > 0) {
165831
+ if (config.crons.length > 0 && !config.testScheduled) {
165817
165832
  if (!didWarnMiniflareCronSupport) {
165818
165833
  didWarnMiniflareCronSupport = true;
165819
165834
  log2.warn(
@@ -166928,7 +166943,7 @@ ${dashLink}`);
166928
166943
  deployments2.push(...updateConsumers);
166929
166944
  }
166930
166945
  if (config.workflows?.length) {
166931
- logger.warnOnce("Workflows is currently in open beta.");
166946
+ logger.once.warn("Workflows is currently in open beta.");
166932
166947
  for (const workflow of config.workflows) {
166933
166948
  deployments2.push(
166934
166949
  fetchResult(`/accounts/${accountId}/workflows/${workflow.name}`, {
@@ -168908,7 +168923,7 @@ async function versionsDeployHandler(args) {
168908
168923
  );
168909
168924
  }
168910
168925
  if (config.workflows?.length) {
168911
- logger.warnOnce("Workflows is currently in open beta.");
168926
+ logger.once.warn("Workflows is currently in open beta.");
168912
168927
  }
168913
168928
  const versionCache = /* @__PURE__ */ new Map();
168914
168929
  const optionalVersionTraffic = parseVersionSpecs(args);
@@ -169713,7 +169728,15 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
169713
169728
  props.compatibilityDate ?? config.compatibility_date,
169714
169729
  props.compatibilityFlags ?? config.compatibility_flags
169715
169730
  ),
169716
- plugins: [logBuildOutput(nodejsCompatMode)]
169731
+ plugins: [logBuildOutput(nodejsCompatMode)],
169732
+ // Pages specific options used by wrangler pages commands
169733
+ entryName: void 0,
169734
+ inject: void 0,
169735
+ isOutfile: void 0,
169736
+ external: void 0,
169737
+ // These options are dev-only
169738
+ testScheduled: void 0,
169739
+ watch: void 0
169717
169740
  }
169718
169741
  );
169719
169742
  for (const module3 of modules) {
@@ -172233,7 +172256,8 @@ async function localPropsToConfigBundle(props) {
172233
172256
  inspect: props.inspect,
172234
172257
  services: props.services,
172235
172258
  serviceBindings,
172236
- bindVectorizeToProd: props.bindVectorizeToProd
172259
+ bindVectorizeToProd: props.bindVectorizeToProd,
172260
+ testScheduled: !!props.testScheduled
172237
172261
  };
172238
172262
  }
172239
172263
  __name(localPropsToConfigBundle, "localPropsToConfigBundle");
@@ -173698,7 +173722,14 @@ function runBuild({
173698
173722
  plugins: [logBuildOutput(nodejsCompatMode, onStart, updateBundle)],
173699
173723
  local,
173700
173724
  projectRoot,
173701
- defineNavigatorUserAgent
173725
+ defineNavigatorUserAgent,
173726
+ // Pages specific options used by wrangler pages commands
173727
+ entryName: void 0,
173728
+ inject: void 0,
173729
+ isOutfile: void 0,
173730
+ external: void 0,
173731
+ // sourcemap defaults to true in dev
173732
+ sourcemap: void 0
173702
173733
  }) : void 0;
173703
173734
  stopWatching = bundleResult?.stop;
173704
173735
  if (noBundle) {
@@ -175076,7 +175107,15 @@ async function runEsbuild({
175076
175107
  doBindings,
175077
175108
  workflowBindings,
175078
175109
  projectRoot,
175079
- defineNavigatorUserAgent
175110
+ defineNavigatorUserAgent,
175111
+ // Pages specific options used by wrangler pages commands
175112
+ entryName: void 0,
175113
+ inject: void 0,
175114
+ isOutfile: void 0,
175115
+ external: void 0,
175116
+ watch: void 0,
175117
+ sourcemap: void 0,
175118
+ plugins: void 0
175080
175119
  }) : void 0;
175081
175120
  const entrypointPath = bundleResult?.resolvedEntryPointPath ?? entry.file;
175082
175121
  return {
@@ -179103,12 +179142,18 @@ var OpenAPI = {
179103
179142
  ENCODE_PATH: void 0
179104
179143
  };
179105
179144
 
179145
+ // src/cloudchamber/client/models/ApplicationAffinityColocation.ts
179146
+ init_import_meta_url();
179147
+
179106
179148
  // src/cloudchamber/client/models/ApplicationMutationError.ts
179107
179149
  init_import_meta_url();
179108
179150
 
179109
179151
  // src/cloudchamber/client/models/AssignIPv4.ts
179110
179152
  init_import_meta_url();
179111
179153
 
179154
+ // src/cloudchamber/client/models/AssignIPv6.ts
179155
+ init_import_meta_url();
179156
+
179112
179157
  // src/cloudchamber/client/models/BadRequestWithCodeError.ts
179113
179158
  init_import_meta_url();
179114
179159
  var BadRequestWithCodeError;
@@ -179119,6 +179164,15 @@ var BadRequestWithCodeError;
179119
179164
  })(error2 = BadRequestWithCodeError2.error || (BadRequestWithCodeError2.error = {}));
179120
179165
  })(BadRequestWithCodeError || (BadRequestWithCodeError = {}));
179121
179166
 
179167
+ // src/cloudchamber/client/models/ContainerNetworkMode.ts
179168
+ init_import_meta_url();
179169
+
179170
+ // src/cloudchamber/client/models/DeploymentCheckKind.ts
179171
+ init_import_meta_url();
179172
+
179173
+ // src/cloudchamber/client/models/DeploymentCheckType.ts
179174
+ init_import_meta_url();
179175
+
179122
179176
  // src/cloudchamber/client/models/DeploymentMutationError.ts
179123
179177
  init_import_meta_url();
179124
179178
  var DeploymentMutationError = /* @__PURE__ */ ((DeploymentMutationError2) => {
@@ -179131,6 +179185,19 @@ var DeploymentMutationError = /* @__PURE__ */ ((DeploymentMutationError2) => {
179131
179185
  return DeploymentMutationError2;
179132
179186
  })(DeploymentMutationError || {});
179133
179187
 
179188
+ // src/cloudchamber/client/models/DeploymentNotFoundError.ts
179189
+ init_import_meta_url();
179190
+ var DeploymentNotFoundError;
179191
+ ((DeploymentNotFoundError2) => {
179192
+ let error2;
179193
+ ((error3) => {
179194
+ error3["DEPLOYMENT_NOT_FOUND"] = "DEPLOYMENT_NOT_FOUND";
179195
+ })(error2 = DeploymentNotFoundError2.error || (DeploymentNotFoundError2.error = {}));
179196
+ })(DeploymentNotFoundError || (DeploymentNotFoundError = {}));
179197
+
179198
+ // src/cloudchamber/client/models/DeploymentPlacementState.ts
179199
+ init_import_meta_url();
179200
+
179134
179201
  // src/cloudchamber/client/models/DeploymentQueuedReason.ts
179135
179202
  init_import_meta_url();
179136
179203
 
@@ -179140,6 +179207,15 @@ init_import_meta_url();
179140
179207
  // src/cloudchamber/client/models/DeploymentType.ts
179141
179208
  init_import_meta_url();
179142
179209
 
179210
+ // src/cloudchamber/client/models/EventName.ts
179211
+ init_import_meta_url();
179212
+
179213
+ // src/cloudchamber/client/models/EventType.ts
179214
+ init_import_meta_url();
179215
+
179216
+ // src/cloudchamber/client/models/HTTPMethod.ts
179217
+ init_import_meta_url();
179218
+
179143
179219
  // src/cloudchamber/client/models/ImageRegistryAlreadyExistsError.ts
179144
179220
  init_import_meta_url();
179145
179221
  var ImageRegistryAlreadyExistsError;
@@ -179183,21 +179259,87 @@ var ImageRegistryNotFoundError;
179183
179259
  // src/cloudchamber/client/models/ImageRegistryPermissions.ts
179184
179260
  init_import_meta_url();
179185
179261
 
179262
+ // src/cloudchamber/client/models/ImageRegistryProtocolAlreadyExists.ts
179263
+ init_import_meta_url();
179264
+ var ImageRegistryProtocolAlreadyExists;
179265
+ ((ImageRegistryProtocolAlreadyExists2) => {
179266
+ let error2;
179267
+ ((error3) => {
179268
+ error3["IMAGE_REGISTRY_PROTOCOL_ALREADY_EXISTS"] = "IMAGE_REGISTRY_PROTOCOL_ALREADY_EXISTS";
179269
+ })(error2 = ImageRegistryProtocolAlreadyExists2.error || (ImageRegistryProtocolAlreadyExists2.error = {}));
179270
+ })(ImageRegistryProtocolAlreadyExists || (ImageRegistryProtocolAlreadyExists = {}));
179271
+
179272
+ // src/cloudchamber/client/models/ImageRegistryProtocolIsReferencedError.ts
179273
+ init_import_meta_url();
179274
+ var ImageRegistryProtocolIsReferencedError;
179275
+ ((ImageRegistryProtocolIsReferencedError2) => {
179276
+ let error2;
179277
+ ((error3) => {
179278
+ error3["IMAGE_REGISTRY_PROTO_IS_REFERENCED"] = "IMAGE_REGISTRY_PROTO_IS_REFERENCED";
179279
+ })(error2 = ImageRegistryProtocolIsReferencedError2.error || (ImageRegistryProtocolIsReferencedError2.error = {}));
179280
+ })(ImageRegistryProtocolIsReferencedError || (ImageRegistryProtocolIsReferencedError = {}));
179281
+
179282
+ // src/cloudchamber/client/models/ImageRegistryProtocolNotFound.ts
179283
+ init_import_meta_url();
179284
+ var ImageRegistryProtocolNotFound;
179285
+ ((ImageRegistryProtocolNotFound2) => {
179286
+ let error2;
179287
+ ((error3) => {
179288
+ error3["IMAGE_REGISTRY_PROTOCOL_NOT_FOUND"] = "IMAGE_REGISTRY_PROTOCOL_NOT_FOUND";
179289
+ })(error2 = ImageRegistryProtocolNotFound2.error || (ImageRegistryProtocolNotFound2.error = {}));
179290
+ })(ImageRegistryProtocolNotFound || (ImageRegistryProtocolNotFound = {}));
179291
+
179186
179292
  // src/cloudchamber/client/models/IPType.ts
179187
179293
  init_import_meta_url();
179188
179294
 
179295
+ // src/cloudchamber/client/models/JobStatusHealth.ts
179296
+ init_import_meta_url();
179297
+
179189
179298
  // src/cloudchamber/client/models/NetworkMode.ts
179190
179299
  init_import_meta_url();
179191
179300
 
179192
179301
  // src/cloudchamber/client/models/NodeGroup.ts
179193
179302
  init_import_meta_url();
179194
179303
 
179304
+ // src/cloudchamber/client/models/PlacementStatusHealth.ts
179305
+ init_import_meta_url();
179306
+
179195
179307
  // src/cloudchamber/client/models/SchedulingPolicy.ts
179196
179308
  init_import_meta_url();
179197
179309
 
179198
- // src/cloudchamber/client/models/State.ts
179310
+ // src/cloudchamber/client/models/SecretAccessType.ts
179199
179311
  init_import_meta_url();
179200
179312
 
179313
+ // src/cloudchamber/client/models/SecretNameAlreadyExists.ts
179314
+ init_import_meta_url();
179315
+ var SecretNameAlreadyExists;
179316
+ ((SecretNameAlreadyExists2) => {
179317
+ let error2;
179318
+ ((error3) => {
179319
+ error3["SECRET_NAME_ALREADY_EXISTS"] = "SECRET_NAME_ALREADY_EXISTS";
179320
+ })(error2 = SecretNameAlreadyExists2.error || (SecretNameAlreadyExists2.error = {}));
179321
+ })(SecretNameAlreadyExists || (SecretNameAlreadyExists = {}));
179322
+
179323
+ // src/cloudchamber/client/models/SecretNotFound.ts
179324
+ init_import_meta_url();
179325
+ var SecretNotFound;
179326
+ ((SecretNotFound2) => {
179327
+ let error2;
179328
+ ((error3) => {
179329
+ error3["SECRET_NAME_NOT_FOUND"] = "SECRET_NAME_NOT_FOUND";
179330
+ })(error2 = SecretNotFound2.error || (SecretNotFound2.error = {}));
179331
+ })(SecretNotFound || (SecretNotFound = {}));
179332
+
179333
+ // src/cloudchamber/client/models/SSHPublicKeyNotFoundError.ts
179334
+ init_import_meta_url();
179335
+ var SSHPublicKeyNotFoundError;
179336
+ ((SSHPublicKeyNotFoundError2) => {
179337
+ let error2;
179338
+ ((error3) => {
179339
+ error3["SSH_PUBLIC_KEY_NOT_FOUND"] = "SSH_PUBLIC_KEY_NOT_FOUND";
179340
+ })(error2 = SSHPublicKeyNotFoundError2.error || (SSHPublicKeyNotFoundError2.error = {}));
179341
+ })(SSHPublicKeyNotFoundError || (SSHPublicKeyNotFoundError = {}));
179342
+
179201
179343
  // src/cloudchamber/client/services/AccountService.ts
179202
179344
  init_import_meta_url();
179203
179345
 
@@ -179516,7 +179658,7 @@ var DeploymentsService = class {
179516
179658
  * @param appId Filter deployments by application id
179517
179659
  * @param location Filter deployments by location
179518
179660
  * @param image Filter deployments by image
179519
- * @param state Filter deployments by deployment state
179661
+ * @param state Filter deployments by placement state
179520
179662
  * @param ipv4 Filter deployments by ipv4 address
179521
179663
  * @param label Filter deployments by label
179522
179664
  * @returns ListDeploymentsV2 List of deployments with their corresponding placements
@@ -179527,7 +179669,7 @@ var DeploymentsService = class {
179527
179669
  method: "GET",
179528
179670
  url: "/deployments/v2",
179529
179671
  query: {
179530
- appId,
179672
+ app_id: appId,
179531
179673
  location,
179532
179674
  image,
179533
179675
  state,
@@ -179551,9 +179693,9 @@ var DeploymentsService = class {
179551
179693
  static getDeploymentV2(deploymentId) {
179552
179694
  return request(OpenAPI, {
179553
179695
  method: "GET",
179554
- url: "/deployments/{deploymentID}/v2",
179696
+ url: "/deployments/{deployment_id}/v2",
179555
179697
  path: {
179556
- deploymentID: deploymentId
179698
+ deployment_id: deploymentId
179557
179699
  },
179558
179700
  errors: {
179559
179701
  400: `Unknown account`,
@@ -179574,9 +179716,9 @@ var DeploymentsService = class {
179574
179716
  static modifyDeploymentV2(deploymentId, requestBody) {
179575
179717
  return request(OpenAPI, {
179576
179718
  method: "PATCH",
179577
- url: "/deployments/{deploymentID}/v2",
179719
+ url: "/deployments/{deployment_id}/v2",
179578
179720
  path: {
179579
- deploymentID: deploymentId
179721
+ deployment_id: deploymentId
179580
179722
  },
179581
179723
  body: requestBody,
179582
179724
  mediaType: "application/json",
@@ -179598,9 +179740,9 @@ var DeploymentsService = class {
179598
179740
  static deleteDeploymentV2(deploymentId) {
179599
179741
  return request(OpenAPI, {
179600
179742
  method: "DELETE",
179601
- url: "/deployments/{deploymentID}/v2",
179743
+ url: "/deployments/{deployment_id}/v2",
179602
179744
  path: {
179603
- deploymentID: deploymentId
179745
+ deployment_id: deploymentId
179604
179746
  },
179605
179747
  errors: {
179606
179748
  400: `Unknown account`,
@@ -179621,9 +179763,9 @@ var DeploymentsService = class {
179621
179763
  static replaceDeployment(placementId, requestBody) {
179622
179764
  return request(OpenAPI, {
179623
179765
  method: "POST",
179624
- url: "/placements/{placementID}",
179766
+ url: "/placements/{placement_id}",
179625
179767
  path: {
179626
- placementID: placementId
179768
+ placement_id: placementId
179627
179769
  },
179628
179770
  body: requestBody,
179629
179771
  mediaType: "application/json",
@@ -179641,12 +179783,86 @@ __name(DeploymentsService, "DeploymentsService");
179641
179783
  // src/cloudchamber/client/services/ImageRegistriesService.ts
179642
179784
  init_import_meta_url();
179643
179785
  var ImageRegistriesService = class {
179786
+ /**
179787
+ * Create an image registry protocol that resolves to multiple domains.
179788
+ * @param requestBody
179789
+ * @returns ImageRegistryProtocol The image registry protocol was created
179790
+ * @throws ApiError
179791
+ */
179792
+ static createImageRegistryProtocol(requestBody) {
179793
+ return request(OpenAPI, {
179794
+ method: "POST",
179795
+ url: "/registries/protos",
179796
+ body: requestBody,
179797
+ mediaType: "application/json",
179798
+ errors: {
179799
+ 400: `Bad Request that contains a specific constant code and details object about the error.`,
179800
+ 403: `The registry that is being added is not allowed`,
179801
+ 409: `Image registry protocol already exists`,
179802
+ 500: `There has been an internal error`
179803
+ }
179804
+ });
179805
+ }
179806
+ /**
179807
+ * List all image registry protocols.
179808
+ * @returns ImageRegistryProtocols The image registry protocols in the account
179809
+ * @throws ApiError
179810
+ */
179811
+ static listImageRegistryProtocols() {
179812
+ return request(OpenAPI, {
179813
+ method: "GET",
179814
+ url: "/registries/protos",
179815
+ errors: {
179816
+ 500: `There has been an internal error`
179817
+ }
179818
+ });
179819
+ }
179820
+ /**
179821
+ * Modify an image registry protocol. The previous list of domains will be replaced by the ones you specify in this endpoint.
179822
+ * @param requestBody
179823
+ * @returns ImageRegistryProtocol The image registry protocol was modified
179824
+ * @throws ApiError
179825
+ */
179826
+ static modifyImageRegistryProtocol(requestBody) {
179827
+ return request(OpenAPI, {
179828
+ method: "PUT",
179829
+ url: "/registries/protos",
179830
+ body: requestBody,
179831
+ mediaType: "application/json",
179832
+ errors: {
179833
+ 400: `Bad Request that contains a specific constant code and details object about the error.`,
179834
+ 403: `The registry that is being added is not allowed`,
179835
+ 404: `Image registry protocol doesn't exist`,
179836
+ 500: `There has been an internal error`
179837
+ }
179838
+ });
179839
+ }
179840
+ /**
179841
+ * Delete an image registry protocol. Be careful, if there is deployments running referencing this protocol they won't be able to pull the image.
179842
+ * @param proto
179843
+ * @returns EmptyResponse Image registry protocol was deleted successfully
179844
+ * @throws ApiError
179845
+ */
179846
+ static deleteImageRegistryProto(proto2) {
179847
+ return request(OpenAPI, {
179848
+ method: "DELETE",
179849
+ url: "/registries/protos/{proto}",
179850
+ path: {
179851
+ proto: proto2
179852
+ },
179853
+ errors: {
179854
+ 400: `The image registry protocol couldn't be deleted because it's referenced by a deployment or application`,
179855
+ 404: `Image registry protocol doesn't exist`,
179856
+ 500: `There has been an internal error`
179857
+ }
179858
+ });
179859
+ }
179644
179860
  /**
179645
179861
  * Get a JWT to pull from the image registry
179646
179862
  * Get a JWT to pull from the image registry specifying its domain
179647
179863
  * @param domain
179648
179864
  * @param requestBody
179649
- * @returns AccountRegistryToken Response that contains the credentials with 'pull' or 'push' permissions to access the registry
179865
+ * @returns AccountRegistryToken Credentials with 'pull' or 'push' permissions to access the registry
179650
179866
  * @throws ApiError
179651
179867
  */
179652
179868
  static generateImageRegistryCredentials(domain2, requestBody) {
@@ -179660,8 +179876,8 @@ var ImageRegistriesService = class {
179660
179876
  mediaType: "application/json",
179661
179877
  errors: {
179662
179878
  400: `Bad Request that contains a specific constant code and details object about the error.`,
179663
- 404: `The response body when the registry that is trying to be found does not exist`,
179664
- 409: `Response that contains the error ImageRegistryIsPublic`,
179879
+ 404: `The image registry does not exist`,
179880
+ 409: `The registry was configured as public, so credentials can not be generated`,
179665
179881
  500: `There has been an internal error`
179666
179882
  }
179667
179883
  });
@@ -179681,7 +179897,7 @@ var ImageRegistriesService = class {
179681
179897
  domain: domain2
179682
179898
  },
179683
179899
  errors: {
179684
- 404: `The response body when the registry that is trying to be found does not exist`,
179900
+ 404: `The image registry does not exist`,
179685
179901
  500: `There has been an internal error`
179686
179902
  }
179687
179903
  });
@@ -179705,7 +179921,7 @@ var ImageRegistriesService = class {
179705
179921
  * Add a new image registry configuration
179706
179922
  * Add a new image registry into your account, so then Cloudflare can pull docker images with public key JWT authentication
179707
179923
  * @param requestBody
179708
- * @returns CustomerImageRegistry The response body when you create a new image registry in an account
179924
+ * @returns CustomerImageRegistry Created a new image registry in the account
179709
179925
  * @throws ApiError
179710
179926
  */
179711
179927
  static createImageRegistry(requestBody) {
@@ -179715,9 +179931,9 @@ var ImageRegistriesService = class {
179715
179931
  body: requestBody,
179716
179932
  mediaType: "application/json",
179717
179933
  errors: {
179718
- 400: `The response body when the input to create a new image registry is malformed`,
179719
- 403: `The response body when the registry that is being added is not allowed`,
179720
- 409: `The response body when the image registry already exists in the account`,
179934
+ 400: `Image registry input is malformed, see the error details`,
179935
+ 403: `The registry that is being added is not allowed`,
179936
+ 409: `The image registry already exists in the account`,
179721
179937
  500: `There has been an internal error`
179722
179938
  }
179723
179939
  });
@@ -179728,6 +179944,9 @@ __name(ImageRegistriesService, "ImageRegistriesService");
179728
179944
  // src/cloudchamber/client/services/IPsService.ts
179729
179945
  init_import_meta_url();
179730
179946
 
179947
+ // src/cloudchamber/client/services/JobsService.ts
179948
+ init_import_meta_url();
179949
+
179731
179950
  // src/cloudchamber/client/services/PlacementsService.ts
179732
179951
  init_import_meta_url();
179733
179952
  var PlacementsService = class {
@@ -179741,9 +179960,9 @@ var PlacementsService = class {
179741
179960
  static listPlacements(deploymentId) {
179742
179961
  return request(OpenAPI, {
179743
179962
  method: "GET",
179744
- url: "/deployments/{deploymentID}/placements",
179963
+ url: "/deployments/{deployment_id}/placements",
179745
179964
  path: {
179746
- deploymentID: deploymentId
179965
+ deployment_id: deploymentId
179747
179966
  },
179748
179967
  errors: {
179749
179968
  400: `Unknown account`,
@@ -179763,9 +179982,9 @@ var PlacementsService = class {
179763
179982
  static getPlacement(placementId) {
179764
179983
  return request(OpenAPI, {
179765
179984
  method: "GET",
179766
- url: "/placements/{placementID}",
179985
+ url: "/placements/{placement_id}",
179767
179986
  path: {
179768
- placementID: placementId
179987
+ placement_id: placementId
179769
179988
  },
179770
179989
  errors: {
179771
179990
  400: `Unknown account`,
@@ -179786,9 +180005,9 @@ var PlacementsService = class {
179786
180005
  static replaceDeployment(placementId, requestBody) {
179787
180006
  return request(OpenAPI, {
179788
180007
  method: "POST",
179789
- url: "/placements/{placementID}",
180008
+ url: "/placements/{placement_id}",
179790
180009
  path: {
179791
- placementID: placementId
180010
+ placement_id: placementId
179792
180011
  },
179793
180012
  body: requestBody,
179794
180013
  mediaType: "application/json",
@@ -179803,6 +180022,9 @@ var PlacementsService = class {
179803
180022
  };
179804
180023
  __name(PlacementsService, "PlacementsService");
179805
180024
 
180025
+ // src/cloudchamber/client/services/SecretsService.ts
180026
+ init_import_meta_url();
180027
+
179806
180028
  // src/cloudchamber/client/services/SshPublicKeysService.ts
179807
180029
  init_import_meta_url();
179808
180030
  var SshPublicKeysService = class {
@@ -179841,6 +180063,27 @@ var SshPublicKeysService = class {
179841
180063
  }
179842
180064
  });
179843
180065
  }
180066
+ /**
180067
+ * Delete SSH public key from the account
180068
+ * Delete an SSH public key from an account.
180069
+ * @param sshPublicKeyName
180070
+ * @returns EmptyResponse SSH Public key was removed successfully
180071
+ * @throws ApiError
180072
+ */
180073
+ static deleteSshPublicKey(sshPublicKeyName) {
180074
+ return request(OpenAPI, {
180075
+ method: "DELETE",
180076
+ url: "/ssh-public-keys/{sshPublicKeyName}",
180077
+ path: {
180078
+ sshPublicKeyName
180079
+ },
180080
+ errors: {
180081
+ 401: `Unauthorized`,
180082
+ 404: `Response body when the SSH public key that is trying to be found does not exist`,
180083
+ 500: `There has been an internal error`
180084
+ }
180085
+ });
180086
+ }
179844
180087
  };
179845
180088
  __name(SshPublicKeysService, "SshPublicKeysService");
179846
180089
 
@@ -180285,6 +180528,35 @@ var processArgument = /* @__PURE__ */ __name(async (args, name2, promptConfig) =
180285
180528
 
180286
180529
  // src/cloudchamber/cli/index.ts
180287
180530
  init_import_meta_url();
180531
+
180532
+ // src/cloudchamber/cli/util.ts
180533
+ init_import_meta_url();
180534
+ function capitalize(str) {
180535
+ return str.length > 0 ? str[0].toUpperCase() + str.substring(1) : str;
180536
+ }
180537
+ __name(capitalize, "capitalize");
180538
+ function statusToColored(status2) {
180539
+ if (!status2) {
180540
+ return bgYellow("PLACING");
180541
+ }
180542
+ const mappings = {
180543
+ pending: bgYellow,
180544
+ placed: bgYellow,
180545
+ running: bgGreen,
180546
+ stopped: bgYellow,
180547
+ stopping: bgYellow,
180548
+ failed: bgRed,
180549
+ unhealthy: bgRed,
180550
+ complete: bgGreen
180551
+ };
180552
+ if (!(status2 in mappings)) {
180553
+ return bgYellow(status2);
180554
+ }
180555
+ return mappings[status2](status2.toUpperCase());
180556
+ }
180557
+ __name(statusToColored, "statusToColored");
180558
+
180559
+ // src/cloudchamber/cli/index.ts
180288
180560
  function pollRegistriesUntilCondition(onRegistries) {
180289
180561
  return new Promise((res, rej) => {
180290
180562
  let errCount = 0;
@@ -180435,20 +180707,21 @@ async function waitForImagePull(deployment) {
180435
180707
  s.stop();
180436
180708
  if (err) {
180437
180709
  crash(err.message);
180438
- return;
180439
180710
  }
180440
180711
  if (eventPlacement.event == void 0 || eventPlacement.event.name === "ImagePullError" && eventPlacement.event.type !== "UserError") {
180441
180712
  checkPlacementStatus(eventPlacement.placement);
180442
180713
  return;
180443
180714
  }
180444
180715
  if (eventPlacement.event.name == "ImagePullError") {
180445
- crash(
180446
- "Your container image couldn't be pulled, (404 not found). Did you specify the correct URL?",
180447
- `Run ${brandColor(
180448
- process.argv0 + " cloudchamber modify " + deployment.id
180449
- )} to change the deployment image`
180450
- );
180451
- return;
180716
+ if (eventPlacement.event.message.includes("404")) {
180717
+ crash(
180718
+ "Your container image couldn't be pulled, (404 not found). Did you specify the correct URL?",
180719
+ `Run ${brandColor(
180720
+ process.argv0 + " cloudchamber modify " + deployment.id
180721
+ )} to change the deployment image`
180722
+ );
180723
+ }
180724
+ crash(capitalize(eventPlacement.event.message));
180452
180725
  }
180453
180726
  updateStatus("Pulled your image");
180454
180727
  log(
@@ -180478,7 +180751,6 @@ async function waitForVMToStart(deployment) {
180478
180751
  s.stop();
180479
180752
  if (err) {
180480
180753
  crash(err.message);
180481
- return;
180482
180754
  }
180483
180755
  if (!eventPlacement.event) {
180484
180756
  checkPlacementStatus(eventPlacement.placement);
@@ -180529,7 +180801,6 @@ async function waitForPlacementInstance(deployment) {
180529
180801
  }
180530
180802
  if (err) {
180531
180803
  crash(err.message);
180532
- return;
180533
180804
  }
180534
180805
  updateStatus(
180535
180806
  "Assigned placement in " + idToLocationName(deployment.location.name)
@@ -181364,26 +181635,6 @@ init_import_meta_url();
181364
181635
  // src/cloudchamber/cli/deployments.ts
181365
181636
  init_import_meta_url();
181366
181637
  var import_process5 = require("process");
181367
-
181368
- // src/cloudchamber/cli/util.ts
181369
- init_import_meta_url();
181370
- function statusToColored(status2) {
181371
- if (!status2) {
181372
- return bgYellow("PLACING");
181373
- }
181374
- const mappings = {
181375
- placing: bgYellow,
181376
- placed: bgYellow,
181377
- running: bgGreen,
181378
- stopped: bgYellow,
181379
- stopping: bgYellow,
181380
- failed: bgRed
181381
- };
181382
- return mappings[status2](status2.toUpperCase());
181383
- }
181384
- __name(statusToColored, "statusToColored");
181385
-
181386
- // src/cloudchamber/cli/deployments.ts
181387
181638
  function ipv6(placement) {
181388
181639
  if (!placement) {
181389
181640
  return yellow("no ipv6 yet");
@@ -181421,10 +181672,10 @@ function version2(deployment) {
181421
181672
  __name(version2, "version");
181422
181673
  function health(placement) {
181423
181674
  if (!placement) {
181424
- return statusToColored("placing");
181675
+ return statusToColored();
181425
181676
  }
181426
181677
  if (!placement.status["health"]) {
181427
- return statusToColored("placing");
181678
+ return statusToColored();
181428
181679
  }
181429
181680
  return statusToColored(placement.status["health"]);
181430
181681
  }
@@ -181847,6 +182098,7 @@ async function listCommand(deploymentArgs, config) {
181847
182098
  __name(listCommand, "listCommand");
181848
182099
  function eventMessage(event, lastEvent) {
181849
182100
  let { message } = event;
182101
+ message = capitalize(message);
181850
182102
  const name2 = event.name;
181851
182103
  const health2 = event.statusChange["health"];
181852
182104
  if (health2 === "failed") {
@@ -182323,7 +182575,7 @@ Alias for "${aliasOf}".`;
182323
182575
  }
182324
182576
  if (def.type === "command") {
182325
182577
  const commandPositionalArgsSuffix = def.positionalArgs?.map((key) => {
182326
- const { demandOption, array } = def.args[key];
182578
+ const { demandOption, array } = def.args?.[key] ?? {};
182327
182579
  return demandOption ? `<${key}${array ? ".." : ""}>` : `[${key}${array ? ".." : ""}]`;
182328
182580
  }).join(" ");
182329
182581
  if (commandPositionalArgsSuffix) {
@@ -182336,14 +182588,15 @@ Alias for "${aliasOf}".`;
182336
182588
  // cast to satisfy typescript overload selection
182337
182589
  /* @__PURE__ */ __name(function builder(subYargs) {
182338
182590
  if (def.type === "command") {
182339
- yargs.options(def.args);
182340
- for (const [key, opt] of Object.entries(def.args)) {
182591
+ const args = def.args ?? {};
182592
+ yargs.options(args);
182593
+ for (const [key, opt] of Object.entries(args)) {
182341
182594
  if (!opt.array) {
182342
182595
  yargs.check(demandSingleValue(key));
182343
182596
  }
182344
182597
  }
182345
182598
  for (const key of def.positionalArgs ?? []) {
182346
- yargs.positional(key, def.args[key]);
182599
+ yargs.positional(key, args[key]);
182347
182600
  }
182348
182601
  } else if (def.type === "namespace") {
182349
182602
  subYargs.command(subHelp);
@@ -182376,7 +182629,12 @@ function createHandler(def) {
182376
182629
  }
182377
182630
  await def.validateArgs?.(args);
182378
182631
  await def.handler(args, {
182379
- config: readConfig(args.config, args),
182632
+ config: readConfig(
182633
+ args.config,
182634
+ args,
182635
+ void 0,
182636
+ !(def.behaviour?.printConfigWarnings ?? true)
182637
+ ),
182380
182638
  errors: { UserError, FatalError },
182381
182639
  logger,
182382
182640
  fetchResult
@@ -187818,7 +188076,7 @@ To learn more about Workers with assets, visit our documentation at https://deve
187818
188076
  );
187819
188077
  }
187820
188078
  if (config.workflows?.length) {
187821
- logger.warnOnce("Workflows is currently in open beta.");
188079
+ logger.once.warn("Workflows is currently in open beta.");
187822
188080
  }
187823
188081
  validateAssetsArgsAndConfig(args, config);
187824
188082
  const assetsOptions = processAssetsArg(args, config);
@@ -189143,7 +189401,7 @@ async function mapBindings(accountId, bindings) {
189143
189401
  ...configObj.pipelines ?? [],
189144
189402
  {
189145
189403
  binding: binding.name,
189146
- pipeline: binding.id
189404
+ pipeline: binding.pipeline
189147
189405
  }
189148
189406
  ];
189149
189407
  break;
@@ -191260,7 +191518,8 @@ defineCommand({
191260
191518
  metadata: {
191261
191519
  description: "Delete workflow - when deleting a workflow, it will also delete it's own instances",
191262
191520
  owner: "Product: Workflows",
191263
- status: "open-beta"
191521
+ status: "open-beta",
191522
+ hidden: true
191264
191523
  },
191265
191524
  args: {
191266
191525
  name: {
@@ -191270,12 +191529,9 @@ defineCommand({
191270
191529
  }
191271
191530
  },
191272
191531
  positionalArgs: ["name"],
191273
- async handler(args, { config }) {
191274
- const accountId = await requireAuth(config);
191275
- await fetchResult(`/accounts/${accountId}/workflows/${args.name}`, {
191276
- method: "DELETE"
191277
- });
191278
- logger.info(`Workflow "${args.name}" was successfully removed`);
191532
+ async handler(args) {
191533
+ logger.info("\u{1F6AB} delete command not yet implement");
191534
+ logger.log(`\u{1F6AB} Workflow "${args.name}" NOT removed`);
191279
191535
  }
191280
191536
  });
191281
191537
 
@@ -191409,7 +191665,7 @@ var validateStatus = /* @__PURE__ */ __name((status2) => {
191409
191665
  defineCommand({
191410
191666
  command: "wrangler workflows instances list",
191411
191667
  metadata: {
191412
- description: "Instance related commands (list, describe, terminate...)",
191668
+ description: "Instance related commands (list, describe, terminate, pause, resume)",
191413
191669
  owner: "Product: Workflows",
191414
191670
  status: "open-beta"
191415
191671
  },
@@ -192463,6 +192719,112 @@ defineCommand({
192463
192719
  }
192464
192720
  });
192465
192721
 
192722
+ // src/workflows/commands/instances/pause.ts
192723
+ init_import_meta_url();
192724
+ defineCommand({
192725
+ command: "wrangler workflows instances pause",
192726
+ metadata: {
192727
+ description: "Pause a workflow instance",
192728
+ owner: "Product: Workflows",
192729
+ status: "open-beta"
192730
+ },
192731
+ positionalArgs: ["name", "id"],
192732
+ args: {
192733
+ name: {
192734
+ describe: "Name of the workflow",
192735
+ type: "string",
192736
+ demandOption: true
192737
+ },
192738
+ id: {
192739
+ describe: "ID of the instance - instead of an UUID you can type 'latest' to get the latest instance and pause it",
192740
+ type: "string",
192741
+ demandOption: true
192742
+ }
192743
+ },
192744
+ async handler(args, { config }) {
192745
+ const accountId = await requireAuth(config);
192746
+ let id = args.id;
192747
+ if (id == "latest") {
192748
+ const instances = (await fetchResult(
192749
+ `/accounts/${accountId}/workflows/${args.name}/instances`
192750
+ )).sort((a, b2) => b2.created_on.localeCompare(a.created_on));
192751
+ if (instances.length == 0) {
192752
+ logger.error(
192753
+ `There are no deployed instances in workflow "${args.name}"`
192754
+ );
192755
+ return;
192756
+ }
192757
+ id = instances[0].id;
192758
+ }
192759
+ await fetchResult(
192760
+ `/accounts/${accountId}/workflows/${args.name}/instances/${id}/status`,
192761
+ {
192762
+ method: "PATCH",
192763
+ headers: {
192764
+ "Content-Type": "application/json"
192765
+ },
192766
+ body: JSON.stringify({ status: "pause" })
192767
+ }
192768
+ );
192769
+ logger.info(
192770
+ `\u23F8\uFE0F The instance "${id}" from ${args.name} was paused successfully`
192771
+ );
192772
+ }
192773
+ });
192774
+
192775
+ // src/workflows/commands/instances/resume.ts
192776
+ init_import_meta_url();
192777
+ defineCommand({
192778
+ command: "wrangler workflows instances resume",
192779
+ metadata: {
192780
+ description: "Resume a workflow instance",
192781
+ owner: "Product: Workflows",
192782
+ status: "open-beta"
192783
+ },
192784
+ positionalArgs: ["name", "id"],
192785
+ args: {
192786
+ name: {
192787
+ describe: "Name of the workflow",
192788
+ type: "string",
192789
+ demandOption: true
192790
+ },
192791
+ id: {
192792
+ describe: "ID of the instance - instead of an UUID you can type 'latest' to get the latest instance and resume it",
192793
+ type: "string",
192794
+ demandOption: true
192795
+ }
192796
+ },
192797
+ async handler(args, { config }) {
192798
+ const accountId = await requireAuth(config);
192799
+ let id = args.id;
192800
+ if (id == "latest") {
192801
+ const instances = (await fetchResult(
192802
+ `/accounts/${accountId}/workflows/${args.name}/instances`
192803
+ )).sort((a, b2) => b2.created_on.localeCompare(a.created_on));
192804
+ if (instances.length == 0) {
192805
+ logger.error(
192806
+ `There are no deployed instances in workflow "${args.name}"`
192807
+ );
192808
+ return;
192809
+ }
192810
+ id = instances[0].id;
192811
+ }
192812
+ await fetchResult(
192813
+ `/accounts/${accountId}/workflows/${args.name}/instances/${id}/status`,
192814
+ {
192815
+ method: "PATCH",
192816
+ headers: {
192817
+ "Content-Type": "application/json"
192818
+ },
192819
+ body: JSON.stringify({ status: "resume" })
192820
+ }
192821
+ );
192822
+ logger.info(
192823
+ `\u{1F504} The instance "${id}" from ${args.name} was resumed successfully`
192824
+ );
192825
+ }
192826
+ });
192827
+
192466
192828
  // src/workflows/index.ts
192467
192829
  defineNamespace({
192468
192830
  command: "wrangler workflows",
@@ -192481,6 +192843,243 @@ defineNamespace({
192481
192843
  }
192482
192844
  });
192483
192845
 
192846
+ // src/user/commands.ts
192847
+ init_import_meta_url();
192848
+
192849
+ // src/user/whoami.ts
192850
+ init_import_meta_url();
192851
+
192852
+ // src/user/membership.ts
192853
+ init_import_meta_url();
192854
+ async function fetchMembershipRoles(accountTag) {
192855
+ const allMemberships = await fetchPagedListResult("/memberships");
192856
+ const membership = allMemberships.find((m2) => m2.account.id === accountTag);
192857
+ return membership?.roles;
192858
+ }
192859
+ __name(fetchMembershipRoles, "fetchMembershipRoles");
192860
+
192861
+ // src/user/whoami.ts
192862
+ async function whoami(accountFilter) {
192863
+ logger.log("Getting User settings...");
192864
+ const user = await getUserInfo();
192865
+ if (!user) {
192866
+ return void logger.log(
192867
+ "You are not authenticated. Please run `wrangler login`."
192868
+ );
192869
+ }
192870
+ if (user.authType === "API Token") {
192871
+ logger.log(
192872
+ "\u2139\uFE0F The API Token is read from the CLOUDFLARE_API_TOKEN in your environment."
192873
+ );
192874
+ }
192875
+ await printUserEmail(user);
192876
+ await printAccountList(user);
192877
+ await printTokenPermissions(user);
192878
+ await printMembershipInfo(user, accountFilter);
192879
+ }
192880
+ __name(whoami, "whoami");
192881
+ function printUserEmail(user) {
192882
+ if (!user.email) {
192883
+ return void logger.log(
192884
+ `\u{1F44B} You are logged in with an ${user.authType}. Unable to retrieve email for this user. Are you missing the \`User->User Details->Read\` permission?`
192885
+ );
192886
+ }
192887
+ logger.log(
192888
+ `\u{1F44B} You are logged in with an ${user.authType}, associated with the email ${source_default.blue(user.email)}.`
192889
+ );
192890
+ }
192891
+ __name(printUserEmail, "printUserEmail");
192892
+ function printAccountList(user) {
192893
+ logger.table(
192894
+ user.accounts.map((account) => ({
192895
+ "Account Name": account.name,
192896
+ "Account ID": account.id
192897
+ }))
192898
+ );
192899
+ }
192900
+ __name(printAccountList, "printAccountList");
192901
+ function printTokenPermissions(user) {
192902
+ const permissions = user.tokenPermissions?.map((scope) => scope.split(":")) ?? [];
192903
+ if (user.authType !== "OAuth Token") {
192904
+ return void logger.log(
192905
+ `\u{1F513} To see token permissions visit https://dash.cloudflare.com/profile/api-tokens.`
192906
+ );
192907
+ }
192908
+ logger.log(
192909
+ `\u{1F513} Token Permissions: If scopes are missing, you may need to logout and re-login.`
192910
+ );
192911
+ logger.log(`Scope (Access)`);
192912
+ for (const [scope, access3] of permissions) {
192913
+ logger.log(`- ${scope} ${access3 ? `(${access3})` : ``}`);
192914
+ }
192915
+ }
192916
+ __name(printTokenPermissions, "printTokenPermissions");
192917
+ async function printMembershipInfo(user, accountFilter) {
192918
+ try {
192919
+ if (!accountFilter) {
192920
+ return;
192921
+ }
192922
+ const eq = /* @__PURE__ */ __name((a, b2) => a.localeCompare(b2, void 0, { sensitivity: "base" }) == 0, "eq");
192923
+ const selectedAccount = user.accounts.find(
192924
+ (a) => eq(a.id, accountFilter) || eq(a.name, accountFilter)
192925
+ );
192926
+ if (!selectedAccount) {
192927
+ return;
192928
+ }
192929
+ const membershipRoles = await fetchMembershipRoles(selectedAccount.id);
192930
+ if (!membershipRoles) {
192931
+ return;
192932
+ }
192933
+ logger.log(
192934
+ `\u{1F3A2} Membership roles in "${selectedAccount.name}": Contact account super admin to change your permissions.`
192935
+ );
192936
+ for (const role of membershipRoles) {
192937
+ logger.log(`- ${role}`);
192938
+ }
192939
+ } catch (e4) {
192940
+ if (isAuthenticationError(e4)) {
192941
+ logger.log(
192942
+ `\u{1F3A2} Unable to get membership roles. Make sure you have permissions to read the account.`
192943
+ );
192944
+ return;
192945
+ } else {
192946
+ throw e4;
192947
+ }
192948
+ }
192949
+ }
192950
+ __name(printMembershipInfo, "printMembershipInfo");
192951
+ async function getUserInfo() {
192952
+ const apiToken = getAPIToken();
192953
+ if (!apiToken) {
192954
+ return;
192955
+ }
192956
+ const tokenPermissions = await getTokenPermissions();
192957
+ const usingEnvAuth = !!getAuthFromEnv();
192958
+ const usingGlobalAuthKey = "authKey" in apiToken;
192959
+ return {
192960
+ apiToken: usingGlobalAuthKey ? apiToken.authKey : apiToken.apiToken,
192961
+ authType: usingGlobalAuthKey ? "Global API Key" : usingEnvAuth ? "API Token" : "OAuth Token",
192962
+ email: "authEmail" in apiToken ? apiToken.authEmail : await getEmail(),
192963
+ accounts: await getAccounts(),
192964
+ tokenPermissions
192965
+ };
192966
+ }
192967
+ __name(getUserInfo, "getUserInfo");
192968
+ async function getEmail() {
192969
+ try {
192970
+ const { email } = await fetchResult("/user");
192971
+ return email;
192972
+ } catch (e4) {
192973
+ const unauthorizedAccess = 9109;
192974
+ if (e4.code === unauthorizedAccess) {
192975
+ return void 0;
192976
+ } else {
192977
+ throw e4;
192978
+ }
192979
+ }
192980
+ }
192981
+ __name(getEmail, "getEmail");
192982
+ async function getAccounts() {
192983
+ return await fetchPagedListResult("/accounts");
192984
+ }
192985
+ __name(getAccounts, "getAccounts");
192986
+ async function getTokenPermissions() {
192987
+ return getScopes();
192988
+ }
192989
+ __name(getTokenPermissions, "getTokenPermissions");
192990
+
192991
+ // src/user/commands.ts
192992
+ defineCommand({
192993
+ command: "wrangler login",
192994
+ metadata: {
192995
+ description: "\u{1F513} Login to Cloudflare",
192996
+ owner: "Workers: Authoring and Testing",
192997
+ status: "stable"
192998
+ },
192999
+ behaviour: {
193000
+ printConfigWarnings: false
193001
+ },
193002
+ args: {
193003
+ "scopes-list": {
193004
+ describe: "List all the available OAuth scopes with descriptions"
193005
+ },
193006
+ browser: {
193007
+ default: true,
193008
+ type: "boolean",
193009
+ describe: "Automatically open the OAuth link in a browser"
193010
+ },
193011
+ scopes: {
193012
+ describe: "Pick the set of applicable OAuth scopes when logging in",
193013
+ array: true,
193014
+ type: "string",
193015
+ requiresArg: true
193016
+ }
193017
+ },
193018
+ async handler(args, { config }) {
193019
+ if (args.scopesList) {
193020
+ listScopes();
193021
+ return;
193022
+ }
193023
+ if (args.scopes) {
193024
+ if (args.scopes.length === 0) {
193025
+ listScopes();
193026
+ return;
193027
+ }
193028
+ if (!validateScopeKeys(args.scopes)) {
193029
+ throw new CommandLineArgsError(
193030
+ `One of ${args.scopes} is not a valid authentication scope. Run "wrangler login --scopes-list" to see the valid scopes.`
193031
+ );
193032
+ }
193033
+ await login({ scopes: args.scopes, browser: args.browser });
193034
+ return;
193035
+ }
193036
+ await login({ browser: args.browser });
193037
+ await sendMetricsEvent("login user", {
193038
+ sendMetrics: config.send_metrics
193039
+ });
193040
+ }
193041
+ });
193042
+ defineCommand({
193043
+ command: "wrangler logout",
193044
+ metadata: {
193045
+ description: "\u{1F6AA} Logout from Cloudflare",
193046
+ owner: "Workers: Authoring and Testing",
193047
+ status: "stable"
193048
+ },
193049
+ behaviour: {
193050
+ printConfigWarnings: false
193051
+ },
193052
+ async handler(_3, { config }) {
193053
+ await logout();
193054
+ await sendMetricsEvent("logout user", {
193055
+ sendMetrics: config.send_metrics
193056
+ });
193057
+ }
193058
+ });
193059
+ defineCommand({
193060
+ command: "wrangler whoami",
193061
+ metadata: {
193062
+ description: "\u{1F575}\uFE0F Retrieve your user information",
193063
+ owner: "Workers: Authoring and Testing",
193064
+ status: "stable"
193065
+ },
193066
+ behaviour: {
193067
+ printConfigWarnings: false
193068
+ },
193069
+ args: {
193070
+ account: {
193071
+ type: "string",
193072
+ describe: "Show membership information for the given account (id or name)."
193073
+ }
193074
+ },
193075
+ async handler(args, { config }) {
193076
+ await whoami(args.account);
193077
+ await sendMetricsEvent("view accounts", {
193078
+ sendMetrics: config.send_metrics
193079
+ });
193080
+ }
193081
+ });
193082
+
192484
193083
  // src/mtls-certificate/cli.ts
192485
193084
  init_import_meta_url();
192486
193085
 
@@ -192832,7 +193431,7 @@ function buildWorkerFromFunctions({
192832
193431
  additionalModules: [],
192833
193432
  moduleCollector,
192834
193433
  inject: [routesModule],
192835
- ...outdir ? { entryName: "index" } : {},
193434
+ ...outdir ? { entryName: "index" } : { entryName: void 0 },
192836
193435
  minify,
192837
193436
  sourcemap,
192838
193437
  watch: watch9,
@@ -192855,7 +193454,13 @@ function buildWorkerFromFunctions({
192855
193454
  targetConsumer: local ? "dev" : "deploy",
192856
193455
  local,
192857
193456
  projectRoot: getPagesProjectRoot(),
192858
- defineNavigatorUserAgent
193457
+ defineNavigatorUserAgent,
193458
+ legacyAssets: void 0,
193459
+ bypassAssetCache: void 0,
193460
+ jsxFactory: void 0,
193461
+ jsxFragment: void 0,
193462
+ tsconfig: void 0,
193463
+ testScheduled: void 0
192859
193464
  });
192860
193465
  }
192861
193466
  __name(buildWorkerFromFunctions, "buildWorkerFromFunctions");
@@ -192929,7 +193534,15 @@ function buildRawWorker({
192929
193534
  targetConsumer: local ? "dev" : "deploy",
192930
193535
  local,
192931
193536
  projectRoot: getPagesProjectRoot(),
192932
- defineNavigatorUserAgent
193537
+ defineNavigatorUserAgent,
193538
+ legacyAssets: void 0,
193539
+ bypassAssetCache: void 0,
193540
+ jsxFactory: void 0,
193541
+ jsxFragment: void 0,
193542
+ tsconfig: void 0,
193543
+ testScheduled: void 0,
193544
+ entryName: void 0,
193545
+ inject: void 0
192933
193546
  });
192934
193547
  }
192935
193548
  __name(buildRawWorker, "buildRawWorker");
@@ -193217,7 +193830,14 @@ function buildPluginFromFunctions({
193217
193830
  targetConsumer: local ? "dev" : "deploy",
193218
193831
  local,
193219
193832
  projectRoot: getPagesProjectRoot(),
193220
- defineNavigatorUserAgent
193833
+ defineNavigatorUserAgent,
193834
+ legacyAssets: void 0,
193835
+ bypassAssetCache: void 0,
193836
+ jsxFactory: void 0,
193837
+ jsxFragment: void 0,
193838
+ tsconfig: void 0,
193839
+ testScheduled: void 0,
193840
+ isOutfile: void 0
193221
193841
  });
193222
193842
  }
193223
193843
  __name(buildPluginFromFunctions, "buildPluginFromFunctions");
@@ -198710,9 +199330,22 @@ async function handler14(args) {
198710
199330
  const config = readConfig(args.config, args);
198711
199331
  const body = createBody3(args);
198712
199332
  try {
198713
- logger.log(`Creating queue ${args.name}.`);
199333
+ logger.log(`\u{1F300} Creating queue '${args.name}'`);
198714
199334
  await createQueue(config, body);
198715
- logger.log(`Created queue ${args.name}.`);
199335
+ logger.log(
199336
+ `\u2705 Created queue '${args.name}'
199337
+
199338
+ Configure your Worker to send messages to this queue:
199339
+
199340
+ [[queues.producers]]
199341
+ queue = "${args.name}"
199342
+ binding = "${getValidBindingName(args.name, "queue")}"
199343
+
199344
+ Configure your Worker to consume messages from this queue:
199345
+
199346
+ [[queues.consumers]]
199347
+ queue = "${args.name}"`
199348
+ );
198716
199349
  } catch (e4) {
198717
199350
  handleFetchError(e4);
198718
199351
  }
@@ -199033,9 +199666,9 @@ function eventNotificationHeaders(apiCredentials, jurisdiction) {
199033
199666
  return headers;
199034
199667
  }
199035
199668
  __name(eventNotificationHeaders, "eventNotificationHeaders");
199036
- async function tableFromNotificationGetResponse(config, response) {
199037
- const reducer = /* @__PURE__ */ __name(async (entry) => {
199038
- const rows = [];
199669
+ function tableFromNotificationGetResponse(response) {
199670
+ const rows = [];
199671
+ for (const entry of response.queues) {
199039
199672
  for (const {
199040
199673
  prefix = "",
199041
199674
  suffix = "",
@@ -199052,14 +199685,8 @@ async function tableFromNotificationGetResponse(config, response) {
199052
199685
  event_type: actions.join(",")
199053
199686
  });
199054
199687
  }
199055
- return rows;
199056
- }, "reducer");
199057
- let tableOutput = [];
199058
- for (const entry of response.queues) {
199059
- const result = await reducer(entry);
199060
- tableOutput = tableOutput.concat(...result);
199061
199688
  }
199062
- return tableOutput;
199689
+ return rows;
199063
199690
  }
199064
199691
  __name(tableFromNotificationGetResponse, "tableFromNotificationGetResponse");
199065
199692
  async function listEventNotificationConfig(apiCredentials, accountId, bucketName, jurisdiction) {
@@ -199147,6 +199774,118 @@ async function deleteEventNotificationConfig(config, apiCredentials, accountId,
199147
199774
  }
199148
199775
  }
199149
199776
  __name(deleteEventNotificationConfig, "deleteEventNotificationConfig");
199777
+ async function attachCustomDomainToBucket(accountId, bucketName, config, jurisdiction) {
199778
+ const headers = {
199779
+ "Content-Type": "application/json"
199780
+ };
199781
+ if (jurisdiction) {
199782
+ headers["cf-r2-jurisdiction"] = jurisdiction;
199783
+ }
199784
+ await fetchResult(
199785
+ `/accounts/${accountId}/r2/buckets/${bucketName}/domains/custom`,
199786
+ {
199787
+ method: "POST",
199788
+ headers,
199789
+ body: JSON.stringify({
199790
+ ...config,
199791
+ enabled: true
199792
+ })
199793
+ }
199794
+ );
199795
+ }
199796
+ __name(attachCustomDomainToBucket, "attachCustomDomainToBucket");
199797
+ async function removeCustomDomainFromBucket(accountId, bucketName, domainName, jurisdiction) {
199798
+ const headers = {};
199799
+ if (jurisdiction) {
199800
+ headers["cf-r2-jurisdiction"] = jurisdiction;
199801
+ }
199802
+ await fetchResult(
199803
+ `/accounts/${accountId}/r2/buckets/${bucketName}/domains/custom/${domainName}`,
199804
+ {
199805
+ method: "DELETE",
199806
+ headers
199807
+ }
199808
+ );
199809
+ }
199810
+ __name(removeCustomDomainFromBucket, "removeCustomDomainFromBucket");
199811
+ function tableFromCustomDomainListResponse(domains) {
199812
+ const rows = [];
199813
+ for (const domainInfo of domains) {
199814
+ rows.push({
199815
+ domain: domainInfo.domain,
199816
+ enabled: domainInfo.enabled ? "Yes" : "No",
199817
+ ownership_status: domainInfo.status.ownership || "(unknown)",
199818
+ ssl_status: domainInfo.status.ssl || "(unknown)",
199819
+ min_tls_version: domainInfo.minTLS || "1.0",
199820
+ zone_id: domainInfo.zoneId || "(none)",
199821
+ zone_name: domainInfo.zoneName || "(none)"
199822
+ });
199823
+ }
199824
+ return rows;
199825
+ }
199826
+ __name(tableFromCustomDomainListResponse, "tableFromCustomDomainListResponse");
199827
+ async function listCustomDomainsOfBucket(accountId, bucketName, jurisdiction) {
199828
+ const headers = {};
199829
+ if (jurisdiction) {
199830
+ headers["cf-r2-jurisdiction"] = jurisdiction;
199831
+ }
199832
+ const result = await fetchResult(`/accounts/${accountId}/r2/buckets/${bucketName}/domains/custom`, {
199833
+ method: "GET",
199834
+ headers
199835
+ });
199836
+ return result.domains;
199837
+ }
199838
+ __name(listCustomDomainsOfBucket, "listCustomDomainsOfBucket");
199839
+ async function configureCustomDomainSettings(accountId, bucketName, domainName, config, jurisdiction) {
199840
+ const headers = {
199841
+ "Content-Type": "application/json"
199842
+ };
199843
+ if (jurisdiction) {
199844
+ headers["cf-r2-jurisdiction"] = jurisdiction;
199845
+ }
199846
+ await fetchResult(
199847
+ `/accounts/${accountId}/r2/buckets/${bucketName}/domains/custom/${domainName}`,
199848
+ {
199849
+ method: "PUT",
199850
+ headers,
199851
+ body: JSON.stringify(config)
199852
+ }
199853
+ );
199854
+ }
199855
+ __name(configureCustomDomainSettings, "configureCustomDomainSettings");
199856
+ async function getR2DevDomain(accountId, bucketName, jurisdiction) {
199857
+ const headers = {};
199858
+ if (jurisdiction) {
199859
+ headers["cf-r2-jurisdiction"] = jurisdiction;
199860
+ }
199861
+ const result = await fetchResult(
199862
+ `/accounts/${accountId}/r2/buckets/${bucketName}/domains/managed`,
199863
+ {
199864
+ method: "GET",
199865
+ headers
199866
+ }
199867
+ );
199868
+ return result;
199869
+ }
199870
+ __name(getR2DevDomain, "getR2DevDomain");
199871
+ async function updateR2DevDomain(accountId, bucketName, enabled, jurisdiction) {
199872
+ const headers = {
199873
+ "Content-Type": "application/json"
199874
+ };
199875
+ if (jurisdiction) {
199876
+ headers["cf-r2-jurisdiction"] = jurisdiction;
199877
+ }
199878
+ const result = await fetchResult(
199879
+ `/accounts/${accountId}/r2/buckets/${bucketName}/domains/managed`,
199880
+ {
199881
+ method: "PUT",
199882
+ headers,
199883
+ body: JSON.stringify({ enabled })
199884
+ }
199885
+ );
199886
+ return result;
199887
+ }
199888
+ __name(updateR2DevDomain, "updateR2DevDomain");
199150
199889
  function isValidR2BucketName(name2) {
199151
199890
  return typeof name2 === "string" && /^[a-zA-Z][a-zA-Z0-9-]*$/.test(name2);
199152
199891
  }
@@ -199198,7 +199937,13 @@ async function Handler16(args) {
199198
199937
  logger.log(`Creating bucket '${fullBucketName}'...`);
199199
199938
  await createR2Bucket(accountId, name2, location, jurisdiction, storageClass);
199200
199939
  logger.log(
199201
- `\u2705 Created bucket '${fullBucketName}' with${location ? ` location hint ${location} and` : ``} default storage class of ${storageClass ? storageClass : `Standard`}.`
199940
+ `\u2705 Created bucket '${fullBucketName}' with${location ? ` location hint ${location} and` : ``} default storage class of ${storageClass ? storageClass : `Standard`}.
199941
+
199942
+ Configure your Worker to write objects to this bucket:
199943
+
199944
+ [[r2_buckets]]
199945
+ bucket_name = "${args.name}"
199946
+ binding = "${getValidBindingName(args.name, "r2")}"`
199202
199947
  );
199203
199948
  await sendMetricsEvent("create r2 bucket", {
199204
199949
  sendMetrics: config.send_metrics
@@ -199206,11 +199951,11 @@ async function Handler16(args) {
199206
199951
  }
199207
199952
  __name(Handler16, "Handler");
199208
199953
 
199209
- // src/r2/notification.ts
199954
+ // src/r2/domain.ts
199210
199955
  init_import_meta_url();
199211
199956
  function ListOptions5(yargs) {
199212
199957
  return yargs.positional("bucket", {
199213
- describe: "The name of the R2 bucket to get event notification rules for",
199958
+ describe: "The name of the R2 bucket whose connected custom domains will be listed",
199214
199959
  type: "string",
199215
199960
  demandOption: true
199216
199961
  }).option("jurisdiction", {
@@ -199222,6 +199967,180 @@ function ListOptions5(yargs) {
199222
199967
  }
199223
199968
  __name(ListOptions5, "ListOptions");
199224
199969
  async function ListHandler5(args) {
199970
+ await printWranglerBanner();
199971
+ const config = readConfig(args.config, args);
199972
+ const accountId = await requireAuth(config);
199973
+ const { bucket, jurisdiction } = args;
199974
+ logger.log(`Listing custom domains connected to bucket '${bucket}'...`);
199975
+ const domains = await listCustomDomainsOfBucket(
199976
+ accountId,
199977
+ bucket,
199978
+ jurisdiction
199979
+ );
199980
+ if (domains.length === 0) {
199981
+ logger.log("There are no custom domains connected to this bucket.");
199982
+ } else {
199983
+ const tableOutput = tableFromCustomDomainListResponse(domains);
199984
+ logger.log(tableOutput.map((x2) => formatLabelledValues(x2)).join("\n\n"));
199985
+ }
199986
+ }
199987
+ __name(ListHandler5, "ListHandler");
199988
+ function AddOptions(yargs) {
199989
+ return yargs.positional("bucket", {
199990
+ describe: "The name of the R2 bucket to connect a custom domain to",
199991
+ type: "string",
199992
+ demandOption: true
199993
+ }).option("domain", {
199994
+ describe: "The custom domain to connect to the R2 bucket",
199995
+ type: "string",
199996
+ demandOption: true
199997
+ }).option("zone-id", {
199998
+ describe: "The zone ID associated with the custom domain",
199999
+ type: "string",
200000
+ demandOption: true
200001
+ }).option("min-tls", {
200002
+ describe: "Set the minimum TLS version for the custom domain (defaults to 1.0 if not set)",
200003
+ choices: ["1.0", "1.1", "1.2", "1.3"],
200004
+ type: "string"
200005
+ }).option("jurisdiction", {
200006
+ describe: "The jurisdiction where the bucket exists",
200007
+ alias: "J",
200008
+ requiresArg: true,
200009
+ type: "string"
200010
+ }).option("force", {
200011
+ describe: "Skip confirmation",
200012
+ type: "boolean",
200013
+ alias: "y",
200014
+ default: false
200015
+ });
200016
+ }
200017
+ __name(AddOptions, "AddOptions");
200018
+ async function AddHandler(args) {
200019
+ await printWranglerBanner();
200020
+ const config = readConfig(args.config, args);
200021
+ const accountId = await requireAuth(config);
200022
+ const { bucket, domain: domain2, zoneId, minTls = "1.0", jurisdiction, force } = args;
200023
+ if (!force) {
200024
+ const confirmedAdd = await confirm(
200025
+ `Are you sure you want to add the custom domain '${domain2}' to bucket '${bucket}'? The contents of your bucket will be made publicly available at 'https://${domain2}'`
200026
+ );
200027
+ if (!confirmedAdd) {
200028
+ logger.log("Add cancelled.");
200029
+ return;
200030
+ }
200031
+ }
200032
+ logger.log(`Connecting custom domain '${domain2}' to bucket '${bucket}'...`);
200033
+ await attachCustomDomainToBucket(
200034
+ accountId,
200035
+ bucket,
200036
+ {
200037
+ domain: domain2,
200038
+ zoneId,
200039
+ minTLS: minTls
200040
+ },
200041
+ jurisdiction
200042
+ );
200043
+ logger.log(`\u2728 Custom domain '${domain2}' connected successfully.`);
200044
+ }
200045
+ __name(AddHandler, "AddHandler");
200046
+ function RemoveOptions(yargs) {
200047
+ return yargs.positional("bucket", {
200048
+ describe: "The name of the R2 bucket to remove the custom domain from",
200049
+ type: "string",
200050
+ demandOption: true
200051
+ }).option("domain", {
200052
+ describe: "The custom domain to remove from the R2 bucket",
200053
+ type: "string",
200054
+ demandOption: true
200055
+ }).option("jurisdiction", {
200056
+ describe: "The jurisdiction where the bucket exists",
200057
+ alias: "J",
200058
+ requiresArg: true,
200059
+ type: "string"
200060
+ }).option("force", {
200061
+ describe: "Skip confirmation",
200062
+ type: "boolean",
200063
+ alias: "y",
200064
+ default: false
200065
+ });
200066
+ }
200067
+ __name(RemoveOptions, "RemoveOptions");
200068
+ async function RemoveHandler(args) {
200069
+ await printWranglerBanner();
200070
+ const config = readConfig(args.config, args);
200071
+ const accountId = await requireAuth(config);
200072
+ const { bucket, domain: domain2, jurisdiction, force } = args;
200073
+ if (!force) {
200074
+ const confirmedRemoval = await confirm(
200075
+ `Are you sure you want to remove the custom domain '${domain2}' from bucket '${bucket}'? Your bucket will no longer be available from 'https://${domain2}'`
200076
+ );
200077
+ if (!confirmedRemoval) {
200078
+ logger.log("Removal cancelled.");
200079
+ return;
200080
+ }
200081
+ }
200082
+ logger.log(`Removing custom domain '${domain2}' from bucket '${bucket}'...`);
200083
+ await removeCustomDomainFromBucket(accountId, bucket, domain2, jurisdiction);
200084
+ logger.log(`Custom domain '${domain2}' removed successfully.`);
200085
+ }
200086
+ __name(RemoveHandler, "RemoveHandler");
200087
+ function UpdateOptions(yargs) {
200088
+ return yargs.positional("bucket", {
200089
+ describe: "The name of the R2 bucket associated with the custom domain to update",
200090
+ type: "string",
200091
+ demandOption: true
200092
+ }).option("domain", {
200093
+ describe: "The custom domain whose settings will be updated",
200094
+ type: "string",
200095
+ demandOption: true
200096
+ }).option("min-tls", {
200097
+ describe: "Update the minimum TLS version for the custom domain",
200098
+ choices: ["1.0", "1.1", "1.2", "1.3"],
200099
+ type: "string"
200100
+ }).option("jurisdiction", {
200101
+ describe: "The jurisdiction where the bucket exists",
200102
+ alias: "J",
200103
+ requiresArg: true,
200104
+ type: "string"
200105
+ });
200106
+ }
200107
+ __name(UpdateOptions, "UpdateOptions");
200108
+ async function UpdateHandler(args) {
200109
+ await printWranglerBanner();
200110
+ const config = readConfig(args.config, args);
200111
+ const accountId = await requireAuth(config);
200112
+ const { bucket, domain: domain2, minTls, jurisdiction } = args;
200113
+ logger.log(`Updating custom domain '${domain2}' for bucket '${bucket}'...`);
200114
+ await configureCustomDomainSettings(
200115
+ accountId,
200116
+ bucket,
200117
+ domain2,
200118
+ {
200119
+ domain: domain2,
200120
+ minTLS: minTls
200121
+ },
200122
+ jurisdiction
200123
+ );
200124
+ logger.log(`\u2728 Custom domain '${domain2}' updated successfully.`);
200125
+ }
200126
+ __name(UpdateHandler, "UpdateHandler");
200127
+
200128
+ // src/r2/notification.ts
200129
+ init_import_meta_url();
200130
+ function ListOptions6(yargs) {
200131
+ return yargs.positional("bucket", {
200132
+ describe: "The name of the R2 bucket to get event notification rules for",
200133
+ type: "string",
200134
+ demandOption: true
200135
+ }).option("jurisdiction", {
200136
+ describe: "The jurisdiction where the bucket exists",
200137
+ alias: "J",
200138
+ requiresArg: true,
200139
+ type: "string"
200140
+ });
200141
+ }
200142
+ __name(ListOptions6, "ListOptions");
200143
+ async function ListHandler6(args) {
199225
200144
  await printWranglerBanner();
199226
200145
  if (args._[3] === "get") {
199227
200146
  logger.warn(
@@ -199238,10 +200157,10 @@ async function ListHandler5(args) {
199238
200157
  bucket,
199239
200158
  jurisdiction
199240
200159
  );
199241
- const tableOutput = await tableFromNotificationGetResponse(config, resp);
200160
+ const tableOutput = tableFromNotificationGetResponse(resp);
199242
200161
  logger.log(tableOutput.map((x2) => formatLabelledValues(x2)).join("\n\n"));
199243
200162
  }
199244
- __name(ListHandler5, "ListHandler");
200163
+ __name(ListHandler6, "ListHandler");
199245
200164
  function CreateOptions4(yargs) {
199246
200165
  return yargs.positional("bucket", {
199247
200166
  describe: "The name of the R2 bucket to create an event notification rule for",
@@ -199347,11 +200266,124 @@ async function DeleteHandler2(args) {
199347
200266
  }
199348
200267
  __name(DeleteHandler2, "DeleteHandler");
199349
200268
 
200269
+ // src/r2/public-dev-url.ts
200270
+ init_import_meta_url();
200271
+ function GetOptions(yargs) {
200272
+ return yargs.positional("bucket", {
200273
+ describe: "The name of the R2 bucket whose r2.dev URL status to retrieve",
200274
+ type: "string",
200275
+ demandOption: true
200276
+ }).option("jurisdiction", {
200277
+ describe: "The jurisdiction where the bucket exists",
200278
+ alias: "J",
200279
+ requiresArg: true,
200280
+ type: "string"
200281
+ });
200282
+ }
200283
+ __name(GetOptions, "GetOptions");
200284
+ async function GetHandler(args) {
200285
+ await printWranglerBanner();
200286
+ const config = readConfig(args.config, args);
200287
+ const accountId = await requireAuth(config);
200288
+ const { bucket, jurisdiction } = args;
200289
+ const devDomain = await getR2DevDomain(accountId, bucket, jurisdiction);
200290
+ if (devDomain.enabled) {
200291
+ logger.log(`Public access is enabled at 'https://${devDomain.domain}'.`);
200292
+ } else {
200293
+ logger.log(`Public access via the r2.dev URL is disabled.`);
200294
+ }
200295
+ }
200296
+ __name(GetHandler, "GetHandler");
200297
+ function EnableOptions(yargs) {
200298
+ return yargs.positional("bucket", {
200299
+ describe: "The name of the R2 bucket to enable public access via its r2.dev URL",
200300
+ type: "string",
200301
+ demandOption: true
200302
+ }).option("jurisdiction", {
200303
+ describe: "The jurisdiction where the bucket exists",
200304
+ alias: "J",
200305
+ requiresArg: true,
200306
+ type: "string"
200307
+ }).option("force", {
200308
+ describe: "Skip confirmation",
200309
+ type: "boolean",
200310
+ alias: "y",
200311
+ default: false
200312
+ });
200313
+ }
200314
+ __name(EnableOptions, "EnableOptions");
200315
+ async function EnableHandler(args) {
200316
+ await printWranglerBanner();
200317
+ const config = readConfig(args.config, args);
200318
+ const accountId = await requireAuth(config);
200319
+ const { bucket, jurisdiction, force } = args;
200320
+ if (!force) {
200321
+ const confirmedAdd = await confirm(
200322
+ `Are you sure you enable public access for bucket '${bucket}'? The contents of your bucket will be made publicly available at its r2.dev URL`
200323
+ );
200324
+ if (!confirmedAdd) {
200325
+ logger.log("Enable cancelled.");
200326
+ return;
200327
+ }
200328
+ }
200329
+ logger.log(`Enabling public access for bucket '${bucket}'...`);
200330
+ const devDomain = await updateR2DevDomain(
200331
+ accountId,
200332
+ bucket,
200333
+ true,
200334
+ jurisdiction
200335
+ );
200336
+ logger.log(`\u2728 Public access enabled at 'https://${devDomain.domain}'.`);
200337
+ }
200338
+ __name(EnableHandler, "EnableHandler");
200339
+ function DisableOptions(yargs) {
200340
+ return yargs.positional("bucket", {
200341
+ describe: "The name of the R2 bucket to disable public access via its r2.dev URL",
200342
+ type: "string",
200343
+ demandOption: true
200344
+ }).option("jurisdiction", {
200345
+ describe: "The jurisdiction where the bucket exists",
200346
+ alias: "J",
200347
+ requiresArg: true,
200348
+ type: "string"
200349
+ }).option("force", {
200350
+ describe: "Skip confirmation",
200351
+ type: "boolean",
200352
+ alias: "y",
200353
+ default: false
200354
+ });
200355
+ }
200356
+ __name(DisableOptions, "DisableOptions");
200357
+ async function DisableHandler(args) {
200358
+ await printWranglerBanner();
200359
+ const config = readConfig(args.config, args);
200360
+ const accountId = await requireAuth(config);
200361
+ const { bucket, jurisdiction, force } = args;
200362
+ if (!force) {
200363
+ const confirmedAdd = await confirm(
200364
+ `Are you sure you disable public access for bucket '${bucket}'? The contents of your bucket will no longer be publicly available at its r2.dev URL`
200365
+ );
200366
+ if (!confirmedAdd) {
200367
+ logger.log("Disable cancelled.");
200368
+ return;
200369
+ }
200370
+ }
200371
+ logger.log(`Disabling public access for bucket '${bucket}'...`);
200372
+ const devDomain = await updateR2DevDomain(
200373
+ accountId,
200374
+ bucket,
200375
+ false,
200376
+ jurisdiction
200377
+ );
200378
+ logger.log(`Public access disabled at 'https://${devDomain.domain}'.`);
200379
+ }
200380
+ __name(DisableHandler, "DisableHandler");
200381
+
199350
200382
  // src/r2/sippy.ts
199351
200383
  init_import_meta_url();
199352
200384
  var NO_SUCH_OBJECT_KEY = 10007;
199353
200385
  var SIPPY_PROVIDER_CHOICES = ["AWS", "GCS"];
199354
- function EnableOptions(yargs) {
200386
+ function EnableOptions2(yargs) {
199355
200387
  return yargs.positional("name", {
199356
200388
  describe: "The name of the bucket",
199357
200389
  type: "string",
@@ -199392,8 +200424,8 @@ function EnableOptions(yargs) {
199392
200424
  string: true
199393
200425
  });
199394
200426
  }
199395
- __name(EnableOptions, "EnableOptions");
199396
- async function EnableHandler(args) {
200427
+ __name(EnableOptions2, "EnableOptions");
200428
+ async function EnableHandler2(args) {
199397
200429
  const isInteractive3 = process.stdin.isTTY;
199398
200430
  const config = readConfig(args.config, args);
199399
200431
  const accountId = await requireAuth(config);
@@ -199540,8 +200572,8 @@ async function EnableHandler(args) {
199540
200572
  await putR2Sippy(accountId, args.name, sippyConfig, args.jurisdiction);
199541
200573
  logger.log(`\u2728 Successfully enabled Sippy on the '${args.name}' bucket.`);
199542
200574
  }
199543
- __name(EnableHandler, "EnableHandler");
199544
- function GetOptions(yargs) {
200575
+ __name(EnableHandler2, "EnableHandler");
200576
+ function GetOptions2(yargs) {
199545
200577
  return yargs.positional("name", {
199546
200578
  describe: "The name of the bucket",
199547
200579
  type: "string",
@@ -199553,8 +200585,8 @@ function GetOptions(yargs) {
199553
200585
  type: "string"
199554
200586
  });
199555
200587
  }
199556
- __name(GetOptions, "GetOptions");
199557
- async function GetHandler(args) {
200588
+ __name(GetOptions2, "GetOptions");
200589
+ async function GetHandler2(args) {
199558
200590
  const config = readConfig(args.config, args);
199559
200591
  const accountId = await requireAuth(config);
199560
200592
  try {
@@ -199572,8 +200604,8 @@ async function GetHandler(args) {
199572
200604
  }
199573
200605
  }
199574
200606
  }
199575
- __name(GetHandler, "GetHandler");
199576
- function DisableOptions(yargs) {
200607
+ __name(GetHandler2, "GetHandler");
200608
+ function DisableOptions2(yargs) {
199577
200609
  return yargs.positional("name", {
199578
200610
  describe: "The name of the bucket",
199579
200611
  type: "string",
@@ -199585,14 +200617,14 @@ function DisableOptions(yargs) {
199585
200617
  type: "string"
199586
200618
  });
199587
200619
  }
199588
- __name(DisableOptions, "DisableOptions");
199589
- async function DisableHandler(args) {
200620
+ __name(DisableOptions2, "DisableOptions");
200621
+ async function DisableHandler2(args) {
199590
200622
  const config = readConfig(args.config, args);
199591
200623
  const accountId = await requireAuth(config);
199592
200624
  await deleteR2Sippy(accountId, args.name, args.jurisdiction);
199593
200625
  logger.log(`\u2728 Successfully disabled Sippy on the '${args.name}' bucket.`);
199594
200626
  }
199595
- __name(DisableHandler, "DisableHandler");
200627
+ __name(DisableHandler2, "DisableHandler");
199596
200628
 
199597
200629
  // src/r2/index.ts
199598
200630
  var CHUNK_SIZE = 1024;
@@ -200054,18 +201086,18 @@ ${key} is ${prettyBytes(objectSize, {
200054
201086
  return sippyYargs.command(
200055
201087
  "enable <name>",
200056
201088
  "Enable Sippy on an R2 bucket",
200057
- EnableOptions,
200058
- EnableHandler
201089
+ EnableOptions2,
201090
+ EnableHandler2
200059
201091
  ).command(
200060
201092
  "disable <name>",
200061
201093
  "Disable Sippy on an R2 bucket",
200062
- DisableOptions,
200063
- DisableHandler
201094
+ DisableOptions2,
201095
+ DisableHandler2
200064
201096
  ).command(
200065
201097
  "get <name>",
200066
201098
  "Check the status of Sippy on an R2 bucket",
200067
- GetOptions,
200068
- GetHandler
201099
+ GetOptions2,
201100
+ GetHandler2
200069
201101
  );
200070
201102
  }
200071
201103
  );
@@ -200076,8 +201108,8 @@ ${key} is ${prettyBytes(objectSize, {
200076
201108
  return r2EvNotifyYargs.command(
200077
201109
  ["list <bucket>", "get <bucket>"],
200078
201110
  "List event notification rules for a bucket",
200079
- ListOptions5,
200080
- ListHandler5
201111
+ ListOptions6,
201112
+ ListHandler6
200081
201113
  ).command(
200082
201114
  "create <bucket>",
200083
201115
  "Create an event notification rule for an R2 bucket",
@@ -200091,6 +201123,55 @@ ${key} is ${prettyBytes(objectSize, {
200091
201123
  );
200092
201124
  }
200093
201125
  );
201126
+ r2BucketYargs.command(
201127
+ "domain",
201128
+ "Manage custom domains for an R2 bucket",
201129
+ (domainYargs) => {
201130
+ return domainYargs.command(
201131
+ "list <bucket>",
201132
+ "List custom domains for an R2 bucket",
201133
+ ListOptions5,
201134
+ ListHandler5
201135
+ ).command(
201136
+ "add <bucket>",
201137
+ "Connect a custom domain to an R2 bucket",
201138
+ AddOptions,
201139
+ AddHandler
201140
+ ).command(
201141
+ "remove <bucket>",
201142
+ "Remove a custom domain from an R2 bucket",
201143
+ RemoveOptions,
201144
+ RemoveHandler
201145
+ ).command(
201146
+ "update <bucket>",
201147
+ "Update settings for a custom domain connected to an R2 bucket",
201148
+ UpdateOptions,
201149
+ UpdateHandler
201150
+ );
201151
+ }
201152
+ );
201153
+ r2BucketYargs.command(
201154
+ "dev-url",
201155
+ "Manage public access via the r2.dev URL for an R2 bucket",
201156
+ (devUrlYargs) => {
201157
+ return devUrlYargs.command(
201158
+ "enable <bucket>",
201159
+ "Enable public access via the r2.dev URL for an R2 bucket",
201160
+ EnableOptions,
201161
+ EnableHandler
201162
+ ).command(
201163
+ "disable <bucket>",
201164
+ "Disable public access via the r2.dev URL for an R2 bucket",
201165
+ DisableOptions,
201166
+ DisableHandler
201167
+ ).command(
201168
+ "get <bucket>",
201169
+ "Get the r2.dev URL and status for an R2 bucket",
201170
+ GetOptions,
201171
+ GetHandler
201172
+ );
201173
+ }
201174
+ );
200094
201175
  return r2BucketYargs;
200095
201176
  });
200096
201177
  }
@@ -200275,7 +201356,6 @@ var secret2 = /* @__PURE__ */ __name((secretYargs) => {
200275
201356
  "delete <key>",
200276
201357
  "Delete a secret variable from a Worker",
200277
201358
  async (yargs) => {
200278
- await printWranglerBanner();
200279
201359
  return yargs.positional("key", {
200280
201360
  describe: "The variable name to be accessible in the Worker",
200281
201361
  type: "string"
@@ -200286,6 +201366,7 @@ var secret2 = /* @__PURE__ */ __name((secretYargs) => {
200286
201366
  });
200287
201367
  },
200288
201368
  async (args) => {
201369
+ await printWranglerBanner();
200289
201370
  const config = readConfig(args.config, args);
200290
201371
  if (config.pages_build_output_dir) {
200291
201372
  throw new UserError(
@@ -207335,7 +208416,7 @@ __name(wrapResolver, "wrapResolver");
207335
208416
  // ../../node_modules/.pnpm/@sentry+node@7.87.0_supports-color@9.2.2/node_modules/@sentry/node/esm/client.js
207336
208417
  init_import_meta_url();
207337
208418
  var os9 = __toESM(require("os"));
207338
- var import_util6 = require("util");
208419
+ var import_util7 = require("util");
207339
208420
  var NodeClient = class extends ServerRuntimeClient {
207340
208421
  /**
207341
208422
  * Creates a new Node SDK instance.
@@ -207354,7 +208435,7 @@ var NodeClient = class extends ServerRuntimeClient {
207354
208435
  version: SDK_VERSION
207355
208436
  };
207356
208437
  options29.transportOptions = {
207357
- textEncoder: new import_util6.TextEncoder(),
208438
+ textEncoder: new import_util7.TextEncoder(),
207358
208439
  ...options29.transportOptions
207359
208440
  };
207360
208441
  const clientOptions = {
@@ -208408,9 +209489,9 @@ var import_child_process2 = require("child_process");
208408
209489
  var import_fs13 = require("fs");
208409
209490
  var os10 = __toESM(require("os"));
208410
209491
  var import_path18 = require("path");
208411
- var import_util7 = require("util");
208412
- var readFileAsync = (0, import_util7.promisify)(import_fs13.readFile);
208413
- var readDirAsync = (0, import_util7.promisify)(import_fs13.readdir);
209492
+ var import_util8 = require("util");
209493
+ var readFileAsync = (0, import_util8.promisify)(import_fs13.readFile);
209494
+ var readDirAsync = (0, import_util8.promisify)(import_fs13.readdir);
208414
209495
  var Context = class {
208415
209496
  /**
208416
209497
  * @inheritDoc
@@ -212270,7 +213351,16 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
212270
213351
  defineNavigatorUserAgent: isNavigatorDefined(
212271
213352
  props.compatibilityDate ?? config.compatibility_date,
212272
213353
  props.compatibilityFlags ?? config.compatibility_flags
212273
- )
213354
+ ),
213355
+ plugins: [logBuildOutput(nodejsCompatMode)],
213356
+ // Pages specific options used by wrangler pages commands
213357
+ entryName: void 0,
213358
+ inject: void 0,
213359
+ isOutfile: void 0,
213360
+ external: void 0,
213361
+ // These options are dev-only
213362
+ testScheduled: void 0,
213363
+ watch: void 0
212274
213364
  }
212275
213365
  );
212276
213366
  for (const module3 of modules) {
@@ -212821,7 +213911,7 @@ async function versionsUploadHandler(args) {
212821
213911
  );
212822
213912
  }
212823
213913
  if (config.workflows?.length) {
212824
- logger.warnOnce("Workflows is currently in open beta.");
213914
+ logger.once.warn("Workflows is currently in open beta.");
212825
213915
  }
212826
213916
  validateAssetsArgsAndConfig(
212827
213917
  {
@@ -213272,148 +214362,6 @@ async function fetchDefaultRollbackVersionId(accountId, workerName) {
213272
214362
  }
213273
214363
  __name(fetchDefaultRollbackVersionId, "fetchDefaultRollbackVersionId");
213274
214364
 
213275
- // src/whoami.ts
213276
- init_import_meta_url();
213277
-
213278
- // src/user/membership.ts
213279
- init_import_meta_url();
213280
- async function fetchMembershipRoles(accountTag) {
213281
- const allMemberships = await fetchPagedListResult("/memberships");
213282
- const membership = allMemberships.find((m2) => m2.account.id === accountTag);
213283
- return membership?.roles;
213284
- }
213285
- __name(fetchMembershipRoles, "fetchMembershipRoles");
213286
-
213287
- // src/whoami.ts
213288
- async function whoami(accountFilter) {
213289
- logger.log("Getting User settings...");
213290
- const user = await getUserInfo();
213291
- if (!user) {
213292
- return void logger.log(
213293
- "You are not authenticated. Please run `wrangler login`."
213294
- );
213295
- }
213296
- if (user.authType === "API Token") {
213297
- logger.log(
213298
- "\u2139\uFE0F The API Token is read from the CLOUDFLARE_API_TOKEN in your environment."
213299
- );
213300
- }
213301
- await printUserEmail(user);
213302
- await printAccountList(user);
213303
- await printTokenPermissions(user);
213304
- await printMembershipInfo(user, accountFilter);
213305
- }
213306
- __name(whoami, "whoami");
213307
- function printUserEmail(user) {
213308
- if (!user.email) {
213309
- return void logger.log(
213310
- `\u{1F44B} You are logged in with an ${user.authType}. Unable to retrieve email for this user. Are you missing the \`User->User Details->Read\` permission?`
213311
- );
213312
- }
213313
- logger.log(
213314
- `\u{1F44B} You are logged in with an ${user.authType}, associated with the email ${source_default.blue(user.email)}.`
213315
- );
213316
- }
213317
- __name(printUserEmail, "printUserEmail");
213318
- function printAccountList(user) {
213319
- logger.table(
213320
- user.accounts.map((account) => ({
213321
- "Account Name": account.name,
213322
- "Account ID": account.id
213323
- }))
213324
- );
213325
- }
213326
- __name(printAccountList, "printAccountList");
213327
- function printTokenPermissions(user) {
213328
- const permissions = user.tokenPermissions?.map((scope) => scope.split(":")) ?? [];
213329
- if (user.authType !== "OAuth Token") {
213330
- return void logger.log(
213331
- `\u{1F513} To see token permissions visit https://dash.cloudflare.com/profile/api-tokens.`
213332
- );
213333
- }
213334
- logger.log(
213335
- `\u{1F513} Token Permissions: If scopes are missing, you may need to logout and re-login.`
213336
- );
213337
- logger.log(`Scope (Access)`);
213338
- for (const [scope, access3] of permissions) {
213339
- logger.log(`- ${scope} ${access3 ? `(${access3})` : ``}`);
213340
- }
213341
- }
213342
- __name(printTokenPermissions, "printTokenPermissions");
213343
- async function printMembershipInfo(user, accountFilter) {
213344
- try {
213345
- if (!accountFilter) {
213346
- return;
213347
- }
213348
- const eq = /* @__PURE__ */ __name((a, b2) => a.localeCompare(b2, void 0, { sensitivity: "base" }) == 0, "eq");
213349
- const selectedAccount = user.accounts.find(
213350
- (a) => eq(a.id, accountFilter) || eq(a.name, accountFilter)
213351
- );
213352
- if (!selectedAccount) {
213353
- return;
213354
- }
213355
- const membershipRoles = await fetchMembershipRoles(selectedAccount.id);
213356
- if (!membershipRoles) {
213357
- return;
213358
- }
213359
- logger.log(
213360
- `\u{1F3A2} Membership roles in "${selectedAccount.name}": Contact account super admin to change your permissions.`
213361
- );
213362
- for (const role of membershipRoles) {
213363
- logger.log(`- ${role}`);
213364
- }
213365
- } catch (e4) {
213366
- if (isAuthenticationError(e4)) {
213367
- logger.log(
213368
- `\u{1F3A2} Unable to get membership roles. Make sure you have permissions to read the account.`
213369
- );
213370
- return;
213371
- } else {
213372
- throw e4;
213373
- }
213374
- }
213375
- }
213376
- __name(printMembershipInfo, "printMembershipInfo");
213377
- async function getUserInfo() {
213378
- const apiToken = getAPIToken();
213379
- if (!apiToken) {
213380
- return;
213381
- }
213382
- const tokenPermissions = await getTokenPermissions();
213383
- const usingEnvAuth = !!getAuthFromEnv();
213384
- const usingGlobalAuthKey = "authKey" in apiToken;
213385
- return {
213386
- apiToken: usingGlobalAuthKey ? apiToken.authKey : apiToken.apiToken,
213387
- authType: usingGlobalAuthKey ? "Global API Key" : usingEnvAuth ? "API Token" : "OAuth Token",
213388
- email: "authEmail" in apiToken ? apiToken.authEmail : await getEmail(),
213389
- accounts: await getAccounts(),
213390
- tokenPermissions
213391
- };
213392
- }
213393
- __name(getUserInfo, "getUserInfo");
213394
- async function getEmail() {
213395
- try {
213396
- const { email } = await fetchResult("/user");
213397
- return email;
213398
- } catch (e4) {
213399
- const unauthorizedAccess = 9109;
213400
- if (e4.code === unauthorizedAccess) {
213401
- return void 0;
213402
- } else {
213403
- throw e4;
213404
- }
213405
- }
213406
- }
213407
- __name(getEmail, "getEmail");
213408
- async function getAccounts() {
213409
- return await fetchPagedListResult("/accounts");
213410
- }
213411
- __name(getAccounts, "getAccounts");
213412
- async function getTokenPermissions() {
213413
- return getScopes();
213414
- }
213415
- __name(getTokenPermissions, "getTokenPermissions");
213416
-
213417
214365
  // src/index.ts
213418
214366
  var resetColor = "\x1B[0m";
213419
214367
  var fgGreenColor = "\x1B[32m";
@@ -213764,83 +214712,9 @@ function createCLIParser(argv) {
213764
214712
  wrangler.command("pipelines", false, (pipelinesYargs) => {
213765
214713
  return pipelines(pipelinesYargs.command(subHelp));
213766
214714
  });
213767
- wrangler.command(
213768
- // this needs scopes as an option?
213769
- "login",
213770
- "\u{1F513} Login to Cloudflare",
213771
- (yargs) => {
213772
- return yargs.option("scopes-list", {
213773
- describe: "List all the available OAuth scopes with descriptions"
213774
- }).option("browser", {
213775
- default: true,
213776
- type: "boolean",
213777
- describe: "Automatically open the OAuth link in a browser"
213778
- }).option("scopes", {
213779
- describe: "Pick the set of applicable OAuth scopes when logging in",
213780
- array: true,
213781
- type: "string",
213782
- requiresArg: true
213783
- });
213784
- },
213785
- async (args) => {
213786
- await printWranglerBanner();
213787
- if (args["scopes-list"]) {
213788
- listScopes();
213789
- return;
213790
- }
213791
- if (args.scopes) {
213792
- if (args.scopes.length === 0) {
213793
- listScopes();
213794
- return;
213795
- }
213796
- if (!validateScopeKeys(args.scopes)) {
213797
- throw new CommandLineArgsError(
213798
- `One of ${args.scopes} is not a valid authentication scope. Run "wrangler login --scopes-list" to see the valid scopes.`
213799
- );
213800
- }
213801
- await login({ scopes: args.scopes, browser: args.browser });
213802
- return;
213803
- }
213804
- await login({ browser: args.browser });
213805
- const config = readConfig(args.config, args);
213806
- await sendMetricsEvent("login user", {
213807
- sendMetrics: config.send_metrics
213808
- });
213809
- }
213810
- );
213811
- wrangler.command(
213812
- // this needs scopes as an option?
213813
- "logout",
213814
- "\u{1F6AA} Logout from Cloudflare",
213815
- () => {
213816
- },
213817
- async (args) => {
213818
- await printWranglerBanner();
213819
- await logout();
213820
- const config = readConfig(void 0, args);
213821
- await sendMetricsEvent("logout user", {
213822
- sendMetrics: config.send_metrics
213823
- });
213824
- }
213825
- );
213826
- wrangler.command(
213827
- "whoami",
213828
- "\u{1F575}\uFE0F Retrieve your user information",
213829
- (yargs) => {
213830
- return yargs.option("account", {
213831
- type: "string",
213832
- describe: "Show membership information for the given account (id or name)."
213833
- });
213834
- },
213835
- async (args) => {
213836
- await printWranglerBanner();
213837
- await whoami(args.account);
213838
- const config = readConfig(void 0, args);
213839
- await sendMetricsEvent("view accounts", {
213840
- sendMetrics: config.send_metrics
213841
- });
213842
- }
213843
- );
214715
+ register2.registerNamespace("login");
214716
+ register2.registerNamespace("logout");
214717
+ register2.registerNamespace("whoami");
213844
214718
  wrangler.command("build", false, buildOptions, buildHandler);
213845
214719
  wrangler.command("config", false, noOpOptions, configHandler);
213846
214720
  wrangler.command(
@@ -215565,7 +216439,18 @@ var BundlerController = class extends Controller {
215565
216439
  defineNavigatorUserAgent: isNavigatorDefined(
215566
216440
  config.compatibilityDate,
215567
216441
  config.compatibilityFlags
215568
- )
216442
+ ),
216443
+ testScheduled: config.dev.testScheduled,
216444
+ plugins: void 0,
216445
+ // Pages specific options used by wrangler pages commands
216446
+ entryName: void 0,
216447
+ inject: void 0,
216448
+ isOutfile: void 0,
216449
+ external: void 0,
216450
+ // We don't use esbuild watching for custom builds
216451
+ watch: void 0,
216452
+ // sourcemap defaults to true in dev
216453
+ sourcemap: void 0
215569
216454
  });
215570
216455
  if (buildAborter.signal.aborted) {
215571
216456
  return;
@@ -215968,7 +216853,7 @@ async function resolveConfig(config, input) {
215968
216853
  }
215969
216854
  validateAssetsArgsAndConfig(resolved);
215970
216855
  const services = extractBindingsOfType("service", resolved.bindings);
215971
- if (services && services.length > 0) {
216856
+ if (services && services.length > 0 && resolved.dev?.remote) {
215972
216857
  logger.warn(
215973
216858
  `This worker is bound to live services: ${services.map(
215974
216859
  (service) => `${service.name} (${service.service}${service.environment ? `@${service.environment}` : ""}${service.entrypoint ? `#${service.entrypoint}` : ""})`
@@ -216183,7 +217068,8 @@ async function convertToConfigBundle(event) {
216183
217068
  inspect: true,
216184
217069
  services: bindings.services,
216185
217070
  serviceBindings: fetchers,
216186
- bindVectorizeToProd: event.config.dev?.bindVectorizeToProd ?? false
217071
+ bindVectorizeToProd: event.config.dev?.bindVectorizeToProd ?? false,
217072
+ testScheduled: !!event.config.dev.testScheduled
216187
217073
  };
216188
217074
  }
216189
217075
  __name(convertToConfigBundle, "convertToConfigBundle");
@@ -216436,7 +217322,9 @@ var ProxyController = class extends Controller {
216436
217322
  this.proxyWorkerOptions = proxyWorkerOptions;
216437
217323
  if (proxyWorkerOptionsChanged) {
216438
217324
  logger.debug("ProxyWorker miniflare options changed, reinstantiating...");
216439
- void this.proxyWorker.setOptions(proxyWorkerOptions);
217325
+ void this.proxyWorker.setOptions(proxyWorkerOptions).catch((error2) => {
217326
+ this.emitErrorEvent("Failed to start ProxyWorker", error2);
217327
+ });
216440
217328
  this.ready = createDeferred(this.ready);
216441
217329
  }
216442
217330
  const { proxyWorker } = this;
@@ -216537,7 +217425,6 @@ var ProxyController = class extends Controller {
216537
217425
  `Failed to send message to ProxyWorker: ${JSON.stringify(message)}`,
216538
217426
  error2
216539
217427
  );
216540
- throw error2;
216541
217428
  }
216542
217429
  }
216543
217430
  async sendMessageToInspectorProxyWorker(message, retries = 3) {
@@ -216562,7 +217449,6 @@ var ProxyController = class extends Controller {
216562
217449
  )}`,
216563
217450
  error2
216564
217451
  );
216565
- throw error2;
216566
217452
  }
216567
217453
  }
216568
217454
  // ******************
@@ -217059,25 +217945,7 @@ var DevEnv = class extends import_node_events6.EventEmitter {
217059
217945
  logger.debug("DevEnv teardown complete");
217060
217946
  }
217061
217947
  emitErrorEvent(ev) {
217062
- if (ev.source === "ProxyController" && ev.reason === "Failed to start ProxyWorker or InspectorProxyWorker") {
217063
- (0, import_node_assert28.default)(ev.data.config);
217064
- const { config } = ev.data;
217065
- const port2 = config.dev?.server?.port;
217066
- const inspectorPort = config.dev?.inspector?.port;
217067
- const randomPorts = [0, void 0];
217068
- if (!randomPorts.includes(port2) || !randomPorts.includes(inspectorPort)) {
217069
- this.config.emitConfigUpdateEvent({
217070
- ...config,
217071
- dev: {
217072
- ...config.dev,
217073
- server: { ...config.dev?.server, port: 0 },
217074
- // override port
217075
- inspector: { ...config.dev?.inspector, port: 0 }
217076
- // override port
217077
- }
217078
- });
217079
- }
217080
- } else if (ev.source === "ProxyController" && (ev.reason.startsWith("Failed to send message to") || ev.reason.startsWith("Could not connect to InspectorProxyWorker"))) {
217948
+ if (ev.source === "ProxyController" && (ev.reason.startsWith("Failed to send message to") || ev.reason.startsWith("Could not connect to InspectorProxyWorker"))) {
217081
217949
  logger.debug(`Error in ${ev.source}: ${ev.reason}
217082
217950
  `, ev.cause);
217083
217951
  logger.debug("=> Error contextual data:", ev.data);