wrangler 3.84.1 → 3.85.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
  }
@@ -155898,7 +155898,7 @@ var import_undici3 = __toESM(require_undici());
155898
155898
 
155899
155899
  // package.json
155900
155900
  var name = "wrangler";
155901
- var version = "3.84.1";
155901
+ var version = "3.85.0";
155902
155902
 
155903
155903
  // src/user/index.ts
155904
155904
  init_import_meta_url();
@@ -163230,7 +163230,6 @@ async function bundleWorker(entry, destination, {
163230
163230
  targetConsumer,
163231
163231
  testScheduled,
163232
163232
  inject: injectOption,
163233
- loader,
163234
163233
  sourcemap,
163235
163234
  plugins,
163236
163235
  isOutfile,
@@ -163388,10 +163387,7 @@ async function bundleWorker(entry, destination, {
163388
163387
  ...define2
163389
163388
  }
163390
163389
  },
163391
- loader: {
163392
- ...COMMON_ESBUILD_OPTIONS.loader,
163393
- ...loader || {}
163394
- },
163390
+ loader: COMMON_ESBUILD_OPTIONS.loader,
163395
163391
  plugins: [
163396
163392
  aliasPlugin,
163397
163393
  moduleCollector.plugin,
@@ -163796,7 +163792,7 @@ function createWorkerUploadForm(worker) {
163796
163792
  metadataBindings.push({
163797
163793
  name: binding,
163798
163794
  type: "pipelines",
163799
- id: pipeline
163795
+ pipeline
163800
163796
  });
163801
163797
  });
163802
163798
  bindings.logfwdr?.bindings.forEach(({ name: name2, destination }) => {
@@ -165813,7 +165809,7 @@ var didWarnMiniflareCronSupport = false;
165813
165809
  var didWarnMiniflareVectorizeSupport = false;
165814
165810
  var didWarnAiAccountUsage = false;
165815
165811
  async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticationSecret) {
165816
- if (config.crons.length > 0) {
165812
+ if (config.crons.length > 0 && !config.testScheduled) {
165817
165813
  if (!didWarnMiniflareCronSupport) {
165818
165814
  didWarnMiniflareCronSupport = true;
165819
165815
  log2.warn(
@@ -169713,7 +169709,15 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
169713
169709
  props.compatibilityDate ?? config.compatibility_date,
169714
169710
  props.compatibilityFlags ?? config.compatibility_flags
169715
169711
  ),
169716
- plugins: [logBuildOutput(nodejsCompatMode)]
169712
+ plugins: [logBuildOutput(nodejsCompatMode)],
169713
+ // Pages specific options used by wrangler pages commands
169714
+ entryName: void 0,
169715
+ inject: void 0,
169716
+ isOutfile: void 0,
169717
+ external: void 0,
169718
+ // These options are dev-only
169719
+ testScheduled: void 0,
169720
+ watch: void 0
169717
169721
  }
169718
169722
  );
169719
169723
  for (const module3 of modules) {
@@ -172233,7 +172237,8 @@ async function localPropsToConfigBundle(props) {
172233
172237
  inspect: props.inspect,
172234
172238
  services: props.services,
172235
172239
  serviceBindings,
172236
- bindVectorizeToProd: props.bindVectorizeToProd
172240
+ bindVectorizeToProd: props.bindVectorizeToProd,
172241
+ testScheduled: !!props.testScheduled
172237
172242
  };
172238
172243
  }
172239
172244
  __name(localPropsToConfigBundle, "localPropsToConfigBundle");
@@ -173698,7 +173703,14 @@ function runBuild({
173698
173703
  plugins: [logBuildOutput(nodejsCompatMode, onStart, updateBundle)],
173699
173704
  local,
173700
173705
  projectRoot,
173701
- defineNavigatorUserAgent
173706
+ defineNavigatorUserAgent,
173707
+ // Pages specific options used by wrangler pages commands
173708
+ entryName: void 0,
173709
+ inject: void 0,
173710
+ isOutfile: void 0,
173711
+ external: void 0,
173712
+ // sourcemap defaults to true in dev
173713
+ sourcemap: void 0
173702
173714
  }) : void 0;
173703
173715
  stopWatching = bundleResult?.stop;
173704
173716
  if (noBundle) {
@@ -175076,7 +175088,15 @@ async function runEsbuild({
175076
175088
  doBindings,
175077
175089
  workflowBindings,
175078
175090
  projectRoot,
175079
- defineNavigatorUserAgent
175091
+ defineNavigatorUserAgent,
175092
+ // Pages specific options used by wrangler pages commands
175093
+ entryName: void 0,
175094
+ inject: void 0,
175095
+ isOutfile: void 0,
175096
+ external: void 0,
175097
+ watch: void 0,
175098
+ sourcemap: void 0,
175099
+ plugins: void 0
175080
175100
  }) : void 0;
175081
175101
  const entrypointPath = bundleResult?.resolvedEntryPointPath ?? entry.file;
175082
175102
  return {
@@ -179103,12 +179123,18 @@ var OpenAPI = {
179103
179123
  ENCODE_PATH: void 0
179104
179124
  };
179105
179125
 
179126
+ // src/cloudchamber/client/models/ApplicationAffinityColocation.ts
179127
+ init_import_meta_url();
179128
+
179106
179129
  // src/cloudchamber/client/models/ApplicationMutationError.ts
179107
179130
  init_import_meta_url();
179108
179131
 
179109
179132
  // src/cloudchamber/client/models/AssignIPv4.ts
179110
179133
  init_import_meta_url();
179111
179134
 
179135
+ // src/cloudchamber/client/models/AssignIPv6.ts
179136
+ init_import_meta_url();
179137
+
179112
179138
  // src/cloudchamber/client/models/BadRequestWithCodeError.ts
179113
179139
  init_import_meta_url();
179114
179140
  var BadRequestWithCodeError;
@@ -179119,6 +179145,15 @@ var BadRequestWithCodeError;
179119
179145
  })(error2 = BadRequestWithCodeError2.error || (BadRequestWithCodeError2.error = {}));
179120
179146
  })(BadRequestWithCodeError || (BadRequestWithCodeError = {}));
179121
179147
 
179148
+ // src/cloudchamber/client/models/ContainerNetworkMode.ts
179149
+ init_import_meta_url();
179150
+
179151
+ // src/cloudchamber/client/models/DeploymentCheckKind.ts
179152
+ init_import_meta_url();
179153
+
179154
+ // src/cloudchamber/client/models/DeploymentCheckType.ts
179155
+ init_import_meta_url();
179156
+
179122
179157
  // src/cloudchamber/client/models/DeploymentMutationError.ts
179123
179158
  init_import_meta_url();
179124
179159
  var DeploymentMutationError = /* @__PURE__ */ ((DeploymentMutationError2) => {
@@ -179131,6 +179166,19 @@ var DeploymentMutationError = /* @__PURE__ */ ((DeploymentMutationError2) => {
179131
179166
  return DeploymentMutationError2;
179132
179167
  })(DeploymentMutationError || {});
179133
179168
 
179169
+ // src/cloudchamber/client/models/DeploymentNotFoundError.ts
179170
+ init_import_meta_url();
179171
+ var DeploymentNotFoundError;
179172
+ ((DeploymentNotFoundError2) => {
179173
+ let error2;
179174
+ ((error3) => {
179175
+ error3["DEPLOYMENT_NOT_FOUND"] = "DEPLOYMENT_NOT_FOUND";
179176
+ })(error2 = DeploymentNotFoundError2.error || (DeploymentNotFoundError2.error = {}));
179177
+ })(DeploymentNotFoundError || (DeploymentNotFoundError = {}));
179178
+
179179
+ // src/cloudchamber/client/models/DeploymentPlacementState.ts
179180
+ init_import_meta_url();
179181
+
179134
179182
  // src/cloudchamber/client/models/DeploymentQueuedReason.ts
179135
179183
  init_import_meta_url();
179136
179184
 
@@ -179140,6 +179188,15 @@ init_import_meta_url();
179140
179188
  // src/cloudchamber/client/models/DeploymentType.ts
179141
179189
  init_import_meta_url();
179142
179190
 
179191
+ // src/cloudchamber/client/models/EventName.ts
179192
+ init_import_meta_url();
179193
+
179194
+ // src/cloudchamber/client/models/EventType.ts
179195
+ init_import_meta_url();
179196
+
179197
+ // src/cloudchamber/client/models/HTTPMethod.ts
179198
+ init_import_meta_url();
179199
+
179143
179200
  // src/cloudchamber/client/models/ImageRegistryAlreadyExistsError.ts
179144
179201
  init_import_meta_url();
179145
179202
  var ImageRegistryAlreadyExistsError;
@@ -179183,20 +179240,86 @@ var ImageRegistryNotFoundError;
179183
179240
  // src/cloudchamber/client/models/ImageRegistryPermissions.ts
179184
179241
  init_import_meta_url();
179185
179242
 
179243
+ // src/cloudchamber/client/models/ImageRegistryProtocolAlreadyExists.ts
179244
+ init_import_meta_url();
179245
+ var ImageRegistryProtocolAlreadyExists;
179246
+ ((ImageRegistryProtocolAlreadyExists2) => {
179247
+ let error2;
179248
+ ((error3) => {
179249
+ error3["IMAGE_REGISTRY_PROTOCOL_ALREADY_EXISTS"] = "IMAGE_REGISTRY_PROTOCOL_ALREADY_EXISTS";
179250
+ })(error2 = ImageRegistryProtocolAlreadyExists2.error || (ImageRegistryProtocolAlreadyExists2.error = {}));
179251
+ })(ImageRegistryProtocolAlreadyExists || (ImageRegistryProtocolAlreadyExists = {}));
179252
+
179253
+ // src/cloudchamber/client/models/ImageRegistryProtocolIsReferencedError.ts
179254
+ init_import_meta_url();
179255
+ var ImageRegistryProtocolIsReferencedError;
179256
+ ((ImageRegistryProtocolIsReferencedError2) => {
179257
+ let error2;
179258
+ ((error3) => {
179259
+ error3["IMAGE_REGISTRY_PROTO_IS_REFERENCED"] = "IMAGE_REGISTRY_PROTO_IS_REFERENCED";
179260
+ })(error2 = ImageRegistryProtocolIsReferencedError2.error || (ImageRegistryProtocolIsReferencedError2.error = {}));
179261
+ })(ImageRegistryProtocolIsReferencedError || (ImageRegistryProtocolIsReferencedError = {}));
179262
+
179263
+ // src/cloudchamber/client/models/ImageRegistryProtocolNotFound.ts
179264
+ init_import_meta_url();
179265
+ var ImageRegistryProtocolNotFound;
179266
+ ((ImageRegistryProtocolNotFound2) => {
179267
+ let error2;
179268
+ ((error3) => {
179269
+ error3["IMAGE_REGISTRY_PROTOCOL_NOT_FOUND"] = "IMAGE_REGISTRY_PROTOCOL_NOT_FOUND";
179270
+ })(error2 = ImageRegistryProtocolNotFound2.error || (ImageRegistryProtocolNotFound2.error = {}));
179271
+ })(ImageRegistryProtocolNotFound || (ImageRegistryProtocolNotFound = {}));
179272
+
179186
179273
  // src/cloudchamber/client/models/IPType.ts
179187
179274
  init_import_meta_url();
179188
179275
 
179276
+ // src/cloudchamber/client/models/JobStatusHealth.ts
179277
+ init_import_meta_url();
179278
+
179189
179279
  // src/cloudchamber/client/models/NetworkMode.ts
179190
179280
  init_import_meta_url();
179191
179281
 
179192
179282
  // src/cloudchamber/client/models/NodeGroup.ts
179193
179283
  init_import_meta_url();
179194
179284
 
179285
+ // src/cloudchamber/client/models/PlacementStatusHealth.ts
179286
+ init_import_meta_url();
179287
+
179195
179288
  // src/cloudchamber/client/models/SchedulingPolicy.ts
179196
179289
  init_import_meta_url();
179197
179290
 
179198
- // src/cloudchamber/client/models/State.ts
179291
+ // src/cloudchamber/client/models/SecretAccessType.ts
179292
+ init_import_meta_url();
179293
+
179294
+ // src/cloudchamber/client/models/SecretNameAlreadyExists.ts
179295
+ init_import_meta_url();
179296
+ var SecretNameAlreadyExists;
179297
+ ((SecretNameAlreadyExists2) => {
179298
+ let error2;
179299
+ ((error3) => {
179300
+ error3["SECRET_NAME_ALREADY_EXISTS"] = "SECRET_NAME_ALREADY_EXISTS";
179301
+ })(error2 = SecretNameAlreadyExists2.error || (SecretNameAlreadyExists2.error = {}));
179302
+ })(SecretNameAlreadyExists || (SecretNameAlreadyExists = {}));
179303
+
179304
+ // src/cloudchamber/client/models/SecretNotFound.ts
179305
+ init_import_meta_url();
179306
+ var SecretNotFound;
179307
+ ((SecretNotFound2) => {
179308
+ let error2;
179309
+ ((error3) => {
179310
+ error3["SECRET_NAME_NOT_FOUND"] = "SECRET_NAME_NOT_FOUND";
179311
+ })(error2 = SecretNotFound2.error || (SecretNotFound2.error = {}));
179312
+ })(SecretNotFound || (SecretNotFound = {}));
179313
+
179314
+ // src/cloudchamber/client/models/SSHPublicKeyNotFoundError.ts
179199
179315
  init_import_meta_url();
179316
+ var SSHPublicKeyNotFoundError;
179317
+ ((SSHPublicKeyNotFoundError2) => {
179318
+ let error2;
179319
+ ((error3) => {
179320
+ error3["SSH_PUBLIC_KEY_NOT_FOUND"] = "SSH_PUBLIC_KEY_NOT_FOUND";
179321
+ })(error2 = SSHPublicKeyNotFoundError2.error || (SSHPublicKeyNotFoundError2.error = {}));
179322
+ })(SSHPublicKeyNotFoundError || (SSHPublicKeyNotFoundError = {}));
179200
179323
 
179201
179324
  // src/cloudchamber/client/services/AccountService.ts
179202
179325
  init_import_meta_url();
@@ -179516,7 +179639,7 @@ var DeploymentsService = class {
179516
179639
  * @param appId Filter deployments by application id
179517
179640
  * @param location Filter deployments by location
179518
179641
  * @param image Filter deployments by image
179519
- * @param state Filter deployments by deployment state
179642
+ * @param state Filter deployments by placement state
179520
179643
  * @param ipv4 Filter deployments by ipv4 address
179521
179644
  * @param label Filter deployments by label
179522
179645
  * @returns ListDeploymentsV2 List of deployments with their corresponding placements
@@ -179527,7 +179650,7 @@ var DeploymentsService = class {
179527
179650
  method: "GET",
179528
179651
  url: "/deployments/v2",
179529
179652
  query: {
179530
- appId,
179653
+ app_id: appId,
179531
179654
  location,
179532
179655
  image,
179533
179656
  state,
@@ -179551,9 +179674,9 @@ var DeploymentsService = class {
179551
179674
  static getDeploymentV2(deploymentId) {
179552
179675
  return request(OpenAPI, {
179553
179676
  method: "GET",
179554
- url: "/deployments/{deploymentID}/v2",
179677
+ url: "/deployments/{deployment_id}/v2",
179555
179678
  path: {
179556
- deploymentID: deploymentId
179679
+ deployment_id: deploymentId
179557
179680
  },
179558
179681
  errors: {
179559
179682
  400: `Unknown account`,
@@ -179574,9 +179697,9 @@ var DeploymentsService = class {
179574
179697
  static modifyDeploymentV2(deploymentId, requestBody) {
179575
179698
  return request(OpenAPI, {
179576
179699
  method: "PATCH",
179577
- url: "/deployments/{deploymentID}/v2",
179700
+ url: "/deployments/{deployment_id}/v2",
179578
179701
  path: {
179579
- deploymentID: deploymentId
179702
+ deployment_id: deploymentId
179580
179703
  },
179581
179704
  body: requestBody,
179582
179705
  mediaType: "application/json",
@@ -179598,9 +179721,9 @@ var DeploymentsService = class {
179598
179721
  static deleteDeploymentV2(deploymentId) {
179599
179722
  return request(OpenAPI, {
179600
179723
  method: "DELETE",
179601
- url: "/deployments/{deploymentID}/v2",
179724
+ url: "/deployments/{deployment_id}/v2",
179602
179725
  path: {
179603
- deploymentID: deploymentId
179726
+ deployment_id: deploymentId
179604
179727
  },
179605
179728
  errors: {
179606
179729
  400: `Unknown account`,
@@ -179621,9 +179744,9 @@ var DeploymentsService = class {
179621
179744
  static replaceDeployment(placementId, requestBody) {
179622
179745
  return request(OpenAPI, {
179623
179746
  method: "POST",
179624
- url: "/placements/{placementID}",
179747
+ url: "/placements/{placement_id}",
179625
179748
  path: {
179626
- placementID: placementId
179749
+ placement_id: placementId
179627
179750
  },
179628
179751
  body: requestBody,
179629
179752
  mediaType: "application/json",
@@ -179641,12 +179764,86 @@ __name(DeploymentsService, "DeploymentsService");
179641
179764
  // src/cloudchamber/client/services/ImageRegistriesService.ts
179642
179765
  init_import_meta_url();
179643
179766
  var ImageRegistriesService = class {
179767
+ /**
179768
+ * Create an image registry protocol that resolves to multiple domains.
179769
+ * @param requestBody
179770
+ * @returns ImageRegistryProtocol The image registry protocol was created
179771
+ * @throws ApiError
179772
+ */
179773
+ static createImageRegistryProtocol(requestBody) {
179774
+ return request(OpenAPI, {
179775
+ method: "POST",
179776
+ url: "/registries/protos",
179777
+ body: requestBody,
179778
+ mediaType: "application/json",
179779
+ errors: {
179780
+ 400: `Bad Request that contains a specific constant code and details object about the error.`,
179781
+ 403: `The registry that is being added is not allowed`,
179782
+ 409: `Image registry protocol already exists`,
179783
+ 500: `There has been an internal error`
179784
+ }
179785
+ });
179786
+ }
179787
+ /**
179788
+ * List all image registry protocols.
179789
+ * @returns ImageRegistryProtocols The image registry protocols in the account
179790
+ * @throws ApiError
179791
+ */
179792
+ static listImageRegistryProtocols() {
179793
+ return request(OpenAPI, {
179794
+ method: "GET",
179795
+ url: "/registries/protos",
179796
+ errors: {
179797
+ 500: `There has been an internal error`
179798
+ }
179799
+ });
179800
+ }
179801
+ /**
179802
+ * Modify an image registry protocol. The previous list of domains will be replaced by the ones you specify in this endpoint.
179803
+ * @param requestBody
179804
+ * @returns ImageRegistryProtocol The image registry protocol was modified
179805
+ * @throws ApiError
179806
+ */
179807
+ static modifyImageRegistryProtocol(requestBody) {
179808
+ return request(OpenAPI, {
179809
+ method: "PUT",
179810
+ url: "/registries/protos",
179811
+ body: requestBody,
179812
+ mediaType: "application/json",
179813
+ errors: {
179814
+ 400: `Bad Request that contains a specific constant code and details object about the error.`,
179815
+ 403: `The registry that is being added is not allowed`,
179816
+ 404: `Image registry protocol doesn't exist`,
179817
+ 500: `There has been an internal error`
179818
+ }
179819
+ });
179820
+ }
179821
+ /**
179822
+ * Delete an image registry protocol. Be careful, if there is deployments running referencing this protocol they won't be able to pull the image.
179823
+ * @param proto
179824
+ * @returns EmptyResponse Image registry protocol was deleted successfully
179825
+ * @throws ApiError
179826
+ */
179827
+ static deleteImageRegistryProto(proto2) {
179828
+ return request(OpenAPI, {
179829
+ method: "DELETE",
179830
+ url: "/registries/protos/{proto}",
179831
+ path: {
179832
+ proto: proto2
179833
+ },
179834
+ errors: {
179835
+ 400: `The image registry protocol couldn't be deleted because it's referenced by a deployment or application`,
179836
+ 404: `Image registry protocol doesn't exist`,
179837
+ 500: `There has been an internal error`
179838
+ }
179839
+ });
179840
+ }
179644
179841
  /**
179645
179842
  * Get a JWT to pull from the image registry
179646
179843
  * Get a JWT to pull from the image registry specifying its domain
179647
179844
  * @param domain
179648
179845
  * @param requestBody
179649
- * @returns AccountRegistryToken Response that contains the credentials with 'pull' or 'push' permissions to access the registry
179846
+ * @returns AccountRegistryToken Credentials with 'pull' or 'push' permissions to access the registry
179650
179847
  * @throws ApiError
179651
179848
  */
179652
179849
  static generateImageRegistryCredentials(domain2, requestBody) {
@@ -179660,8 +179857,8 @@ var ImageRegistriesService = class {
179660
179857
  mediaType: "application/json",
179661
179858
  errors: {
179662
179859
  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`,
179860
+ 404: `The image registry does not exist`,
179861
+ 409: `The registry was configured as public, so credentials can not be generated`,
179665
179862
  500: `There has been an internal error`
179666
179863
  }
179667
179864
  });
@@ -179681,7 +179878,7 @@ var ImageRegistriesService = class {
179681
179878
  domain: domain2
179682
179879
  },
179683
179880
  errors: {
179684
- 404: `The response body when the registry that is trying to be found does not exist`,
179881
+ 404: `The image registry does not exist`,
179685
179882
  500: `There has been an internal error`
179686
179883
  }
179687
179884
  });
@@ -179705,7 +179902,7 @@ var ImageRegistriesService = class {
179705
179902
  * Add a new image registry configuration
179706
179903
  * Add a new image registry into your account, so then Cloudflare can pull docker images with public key JWT authentication
179707
179904
  * @param requestBody
179708
- * @returns CustomerImageRegistry The response body when you create a new image registry in an account
179905
+ * @returns CustomerImageRegistry Created a new image registry in the account
179709
179906
  * @throws ApiError
179710
179907
  */
179711
179908
  static createImageRegistry(requestBody) {
@@ -179715,9 +179912,9 @@ var ImageRegistriesService = class {
179715
179912
  body: requestBody,
179716
179913
  mediaType: "application/json",
179717
179914
  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`,
179915
+ 400: `Image registry input is malformed, see the error details`,
179916
+ 403: `The registry that is being added is not allowed`,
179917
+ 409: `The image registry already exists in the account`,
179721
179918
  500: `There has been an internal error`
179722
179919
  }
179723
179920
  });
@@ -179728,6 +179925,9 @@ __name(ImageRegistriesService, "ImageRegistriesService");
179728
179925
  // src/cloudchamber/client/services/IPsService.ts
179729
179926
  init_import_meta_url();
179730
179927
 
179928
+ // src/cloudchamber/client/services/JobsService.ts
179929
+ init_import_meta_url();
179930
+
179731
179931
  // src/cloudchamber/client/services/PlacementsService.ts
179732
179932
  init_import_meta_url();
179733
179933
  var PlacementsService = class {
@@ -179741,9 +179941,9 @@ var PlacementsService = class {
179741
179941
  static listPlacements(deploymentId) {
179742
179942
  return request(OpenAPI, {
179743
179943
  method: "GET",
179744
- url: "/deployments/{deploymentID}/placements",
179944
+ url: "/deployments/{deployment_id}/placements",
179745
179945
  path: {
179746
- deploymentID: deploymentId
179946
+ deployment_id: deploymentId
179747
179947
  },
179748
179948
  errors: {
179749
179949
  400: `Unknown account`,
@@ -179763,9 +179963,9 @@ var PlacementsService = class {
179763
179963
  static getPlacement(placementId) {
179764
179964
  return request(OpenAPI, {
179765
179965
  method: "GET",
179766
- url: "/placements/{placementID}",
179966
+ url: "/placements/{placement_id}",
179767
179967
  path: {
179768
- placementID: placementId
179968
+ placement_id: placementId
179769
179969
  },
179770
179970
  errors: {
179771
179971
  400: `Unknown account`,
@@ -179786,9 +179986,9 @@ var PlacementsService = class {
179786
179986
  static replaceDeployment(placementId, requestBody) {
179787
179987
  return request(OpenAPI, {
179788
179988
  method: "POST",
179789
- url: "/placements/{placementID}",
179989
+ url: "/placements/{placement_id}",
179790
179990
  path: {
179791
- placementID: placementId
179991
+ placement_id: placementId
179792
179992
  },
179793
179993
  body: requestBody,
179794
179994
  mediaType: "application/json",
@@ -179803,6 +180003,9 @@ var PlacementsService = class {
179803
180003
  };
179804
180004
  __name(PlacementsService, "PlacementsService");
179805
180005
 
180006
+ // src/cloudchamber/client/services/SecretsService.ts
180007
+ init_import_meta_url();
180008
+
179806
180009
  // src/cloudchamber/client/services/SshPublicKeysService.ts
179807
180010
  init_import_meta_url();
179808
180011
  var SshPublicKeysService = class {
@@ -179841,6 +180044,27 @@ var SshPublicKeysService = class {
179841
180044
  }
179842
180045
  });
179843
180046
  }
180047
+ /**
180048
+ * Delete SSH public key from the account
180049
+ * Delete an SSH public key from an account.
180050
+ * @param sshPublicKeyName
180051
+ * @returns EmptyResponse SSH Public key was removed successfully
180052
+ * @throws ApiError
180053
+ */
180054
+ static deleteSshPublicKey(sshPublicKeyName) {
180055
+ return request(OpenAPI, {
180056
+ method: "DELETE",
180057
+ url: "/ssh-public-keys/{sshPublicKeyName}",
180058
+ path: {
180059
+ sshPublicKeyName
180060
+ },
180061
+ errors: {
180062
+ 401: `Unauthorized`,
180063
+ 404: `Response body when the SSH public key that is trying to be found does not exist`,
180064
+ 500: `There has been an internal error`
180065
+ }
180066
+ });
180067
+ }
179844
180068
  };
179845
180069
  __name(SshPublicKeysService, "SshPublicKeysService");
179846
180070
 
@@ -180285,6 +180509,35 @@ var processArgument = /* @__PURE__ */ __name(async (args, name2, promptConfig) =
180285
180509
 
180286
180510
  // src/cloudchamber/cli/index.ts
180287
180511
  init_import_meta_url();
180512
+
180513
+ // src/cloudchamber/cli/util.ts
180514
+ init_import_meta_url();
180515
+ function capitalize(str) {
180516
+ return str.length > 0 ? str[0].toUpperCase() + str.substring(1) : str;
180517
+ }
180518
+ __name(capitalize, "capitalize");
180519
+ function statusToColored(status2) {
180520
+ if (!status2) {
180521
+ return bgYellow("PLACING");
180522
+ }
180523
+ const mappings = {
180524
+ pending: bgYellow,
180525
+ placed: bgYellow,
180526
+ running: bgGreen,
180527
+ stopped: bgYellow,
180528
+ stopping: bgYellow,
180529
+ failed: bgRed,
180530
+ unhealthy: bgRed,
180531
+ complete: bgGreen
180532
+ };
180533
+ if (!(status2 in mappings)) {
180534
+ return bgYellow(status2);
180535
+ }
180536
+ return mappings[status2](status2.toUpperCase());
180537
+ }
180538
+ __name(statusToColored, "statusToColored");
180539
+
180540
+ // src/cloudchamber/cli/index.ts
180288
180541
  function pollRegistriesUntilCondition(onRegistries) {
180289
180542
  return new Promise((res, rej) => {
180290
180543
  let errCount = 0;
@@ -180435,20 +180688,21 @@ async function waitForImagePull(deployment) {
180435
180688
  s.stop();
180436
180689
  if (err) {
180437
180690
  crash(err.message);
180438
- return;
180439
180691
  }
180440
180692
  if (eventPlacement.event == void 0 || eventPlacement.event.name === "ImagePullError" && eventPlacement.event.type !== "UserError") {
180441
180693
  checkPlacementStatus(eventPlacement.placement);
180442
180694
  return;
180443
180695
  }
180444
180696
  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;
180697
+ if (eventPlacement.event.message.includes("404")) {
180698
+ crash(
180699
+ "Your container image couldn't be pulled, (404 not found). Did you specify the correct URL?",
180700
+ `Run ${brandColor(
180701
+ process.argv0 + " cloudchamber modify " + deployment.id
180702
+ )} to change the deployment image`
180703
+ );
180704
+ }
180705
+ crash(capitalize(eventPlacement.event.message));
180452
180706
  }
180453
180707
  updateStatus("Pulled your image");
180454
180708
  log(
@@ -180478,7 +180732,6 @@ async function waitForVMToStart(deployment) {
180478
180732
  s.stop();
180479
180733
  if (err) {
180480
180734
  crash(err.message);
180481
- return;
180482
180735
  }
180483
180736
  if (!eventPlacement.event) {
180484
180737
  checkPlacementStatus(eventPlacement.placement);
@@ -180529,7 +180782,6 @@ async function waitForPlacementInstance(deployment) {
180529
180782
  }
180530
180783
  if (err) {
180531
180784
  crash(err.message);
180532
- return;
180533
180785
  }
180534
180786
  updateStatus(
180535
180787
  "Assigned placement in " + idToLocationName(deployment.location.name)
@@ -181364,26 +181616,6 @@ init_import_meta_url();
181364
181616
  // src/cloudchamber/cli/deployments.ts
181365
181617
  init_import_meta_url();
181366
181618
  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
181619
  function ipv6(placement) {
181388
181620
  if (!placement) {
181389
181621
  return yellow("no ipv6 yet");
@@ -181421,10 +181653,10 @@ function version2(deployment) {
181421
181653
  __name(version2, "version");
181422
181654
  function health(placement) {
181423
181655
  if (!placement) {
181424
- return statusToColored("placing");
181656
+ return statusToColored();
181425
181657
  }
181426
181658
  if (!placement.status["health"]) {
181427
- return statusToColored("placing");
181659
+ return statusToColored();
181428
181660
  }
181429
181661
  return statusToColored(placement.status["health"]);
181430
181662
  }
@@ -181847,6 +182079,7 @@ async function listCommand(deploymentArgs, config) {
181847
182079
  __name(listCommand, "listCommand");
181848
182080
  function eventMessage(event, lastEvent) {
181849
182081
  let { message } = event;
182082
+ message = capitalize(message);
181850
182083
  const name2 = event.name;
181851
182084
  const health2 = event.statusChange["health"];
181852
182085
  if (health2 === "failed") {
@@ -182323,7 +182556,7 @@ Alias for "${aliasOf}".`;
182323
182556
  }
182324
182557
  if (def.type === "command") {
182325
182558
  const commandPositionalArgsSuffix = def.positionalArgs?.map((key) => {
182326
- const { demandOption, array } = def.args[key];
182559
+ const { demandOption, array } = def.args?.[key] ?? {};
182327
182560
  return demandOption ? `<${key}${array ? ".." : ""}>` : `[${key}${array ? ".." : ""}]`;
182328
182561
  }).join(" ");
182329
182562
  if (commandPositionalArgsSuffix) {
@@ -182336,14 +182569,15 @@ Alias for "${aliasOf}".`;
182336
182569
  // cast to satisfy typescript overload selection
182337
182570
  /* @__PURE__ */ __name(function builder(subYargs) {
182338
182571
  if (def.type === "command") {
182339
- yargs.options(def.args);
182340
- for (const [key, opt] of Object.entries(def.args)) {
182572
+ const args = def.args ?? {};
182573
+ yargs.options(args);
182574
+ for (const [key, opt] of Object.entries(args)) {
182341
182575
  if (!opt.array) {
182342
182576
  yargs.check(demandSingleValue(key));
182343
182577
  }
182344
182578
  }
182345
182579
  for (const key of def.positionalArgs ?? []) {
182346
- yargs.positional(key, def.args[key]);
182580
+ yargs.positional(key, args[key]);
182347
182581
  }
182348
182582
  } else if (def.type === "namespace") {
182349
182583
  subYargs.command(subHelp);
@@ -182376,7 +182610,12 @@ function createHandler(def) {
182376
182610
  }
182377
182611
  await def.validateArgs?.(args);
182378
182612
  await def.handler(args, {
182379
- config: readConfig(args.config, args),
182613
+ config: readConfig(
182614
+ args.config,
182615
+ args,
182616
+ void 0,
182617
+ !(def.behaviour?.printConfigWarnings ?? true)
182618
+ ),
182380
182619
  errors: { UserError, FatalError },
182381
182620
  logger,
182382
182621
  fetchResult
@@ -189143,7 +189382,7 @@ async function mapBindings(accountId, bindings) {
189143
189382
  ...configObj.pipelines ?? [],
189144
189383
  {
189145
189384
  binding: binding.name,
189146
- pipeline: binding.id
189385
+ pipeline: binding.pipeline
189147
189386
  }
189148
189387
  ];
189149
189388
  break;
@@ -191260,7 +191499,8 @@ defineCommand({
191260
191499
  metadata: {
191261
191500
  description: "Delete workflow - when deleting a workflow, it will also delete it's own instances",
191262
191501
  owner: "Product: Workflows",
191263
- status: "open-beta"
191502
+ status: "open-beta",
191503
+ hidden: true
191264
191504
  },
191265
191505
  args: {
191266
191506
  name: {
@@ -191270,12 +191510,9 @@ defineCommand({
191270
191510
  }
191271
191511
  },
191272
191512
  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`);
191513
+ async handler(args) {
191514
+ logger.info("\u{1F6AB} delete command not yet implement");
191515
+ logger.log(`\u{1F6AB} Workflow "${args.name}" NOT removed`);
191279
191516
  }
191280
191517
  });
191281
191518
 
@@ -191409,7 +191646,7 @@ var validateStatus = /* @__PURE__ */ __name((status2) => {
191409
191646
  defineCommand({
191410
191647
  command: "wrangler workflows instances list",
191411
191648
  metadata: {
191412
- description: "Instance related commands (list, describe, terminate...)",
191649
+ description: "Instance related commands (list, describe, terminate, pause, resume)",
191413
191650
  owner: "Product: Workflows",
191414
191651
  status: "open-beta"
191415
191652
  },
@@ -192454,11 +192691,117 @@ defineCommand({
192454
192691
  headers: {
192455
192692
  "Content-Type": "application/json"
192456
192693
  },
192457
- body: JSON.stringify({ status: "terminate" })
192694
+ body: JSON.stringify({ status: "terminate" })
192695
+ }
192696
+ );
192697
+ logger.info(
192698
+ `\u{1F977} The instance "${id}" from ${args.name} was terminated successfully`
192699
+ );
192700
+ }
192701
+ });
192702
+
192703
+ // src/workflows/commands/instances/pause.ts
192704
+ init_import_meta_url();
192705
+ defineCommand({
192706
+ command: "wrangler workflows instances pause",
192707
+ metadata: {
192708
+ description: "Pause a workflow instance",
192709
+ owner: "Product: Workflows",
192710
+ status: "open-beta"
192711
+ },
192712
+ positionalArgs: ["name", "id"],
192713
+ args: {
192714
+ name: {
192715
+ describe: "Name of the workflow",
192716
+ type: "string",
192717
+ demandOption: true
192718
+ },
192719
+ id: {
192720
+ describe: "ID of the instance - instead of an UUID you can type 'latest' to get the latest instance and pause it",
192721
+ type: "string",
192722
+ demandOption: true
192723
+ }
192724
+ },
192725
+ async handler(args, { config }) {
192726
+ const accountId = await requireAuth(config);
192727
+ let id = args.id;
192728
+ if (id == "latest") {
192729
+ const instances = (await fetchResult(
192730
+ `/accounts/${accountId}/workflows/${args.name}/instances`
192731
+ )).sort((a, b2) => b2.created_on.localeCompare(a.created_on));
192732
+ if (instances.length == 0) {
192733
+ logger.error(
192734
+ `There are no deployed instances in workflow "${args.name}"`
192735
+ );
192736
+ return;
192737
+ }
192738
+ id = instances[0].id;
192739
+ }
192740
+ await fetchResult(
192741
+ `/accounts/${accountId}/workflows/${args.name}/instances/${id}/status`,
192742
+ {
192743
+ method: "PATCH",
192744
+ headers: {
192745
+ "Content-Type": "application/json"
192746
+ },
192747
+ body: JSON.stringify({ status: "pause" })
192748
+ }
192749
+ );
192750
+ logger.info(
192751
+ `\u23F8\uFE0F The instance "${id}" from ${args.name} was paused successfully`
192752
+ );
192753
+ }
192754
+ });
192755
+
192756
+ // src/workflows/commands/instances/resume.ts
192757
+ init_import_meta_url();
192758
+ defineCommand({
192759
+ command: "wrangler workflows instances resume",
192760
+ metadata: {
192761
+ description: "Resume a workflow instance",
192762
+ owner: "Product: Workflows",
192763
+ status: "open-beta"
192764
+ },
192765
+ positionalArgs: ["name", "id"],
192766
+ args: {
192767
+ name: {
192768
+ describe: "Name of the workflow",
192769
+ type: "string",
192770
+ demandOption: true
192771
+ },
192772
+ id: {
192773
+ describe: "ID of the instance - instead of an UUID you can type 'latest' to get the latest instance and resume it",
192774
+ type: "string",
192775
+ demandOption: true
192776
+ }
192777
+ },
192778
+ async handler(args, { config }) {
192779
+ const accountId = await requireAuth(config);
192780
+ let id = args.id;
192781
+ if (id == "latest") {
192782
+ const instances = (await fetchResult(
192783
+ `/accounts/${accountId}/workflows/${args.name}/instances`
192784
+ )).sort((a, b2) => b2.created_on.localeCompare(a.created_on));
192785
+ if (instances.length == 0) {
192786
+ logger.error(
192787
+ `There are no deployed instances in workflow "${args.name}"`
192788
+ );
192789
+ return;
192790
+ }
192791
+ id = instances[0].id;
192792
+ }
192793
+ await fetchResult(
192794
+ `/accounts/${accountId}/workflows/${args.name}/instances/${id}/status`,
192795
+ {
192796
+ method: "PATCH",
192797
+ headers: {
192798
+ "Content-Type": "application/json"
192799
+ },
192800
+ body: JSON.stringify({ status: "resume" })
192458
192801
  }
192459
192802
  );
192460
192803
  logger.info(
192461
- `\u{1F977} The instance "${id}" from ${args.name} was terminated successfully`
192804
+ `\u{1F504} The instance "${id}" from ${args.name} was resumed successfully`
192462
192805
  );
192463
192806
  }
192464
192807
  });
@@ -192481,6 +192824,243 @@ defineNamespace({
192481
192824
  }
192482
192825
  });
192483
192826
 
192827
+ // src/user/commands.ts
192828
+ init_import_meta_url();
192829
+
192830
+ // src/user/whoami.ts
192831
+ init_import_meta_url();
192832
+
192833
+ // src/user/membership.ts
192834
+ init_import_meta_url();
192835
+ async function fetchMembershipRoles(accountTag) {
192836
+ const allMemberships = await fetchPagedListResult("/memberships");
192837
+ const membership = allMemberships.find((m2) => m2.account.id === accountTag);
192838
+ return membership?.roles;
192839
+ }
192840
+ __name(fetchMembershipRoles, "fetchMembershipRoles");
192841
+
192842
+ // src/user/whoami.ts
192843
+ async function whoami(accountFilter) {
192844
+ logger.log("Getting User settings...");
192845
+ const user = await getUserInfo();
192846
+ if (!user) {
192847
+ return void logger.log(
192848
+ "You are not authenticated. Please run `wrangler login`."
192849
+ );
192850
+ }
192851
+ if (user.authType === "API Token") {
192852
+ logger.log(
192853
+ "\u2139\uFE0F The API Token is read from the CLOUDFLARE_API_TOKEN in your environment."
192854
+ );
192855
+ }
192856
+ await printUserEmail(user);
192857
+ await printAccountList(user);
192858
+ await printTokenPermissions(user);
192859
+ await printMembershipInfo(user, accountFilter);
192860
+ }
192861
+ __name(whoami, "whoami");
192862
+ function printUserEmail(user) {
192863
+ if (!user.email) {
192864
+ return void logger.log(
192865
+ `\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?`
192866
+ );
192867
+ }
192868
+ logger.log(
192869
+ `\u{1F44B} You are logged in with an ${user.authType}, associated with the email ${source_default.blue(user.email)}.`
192870
+ );
192871
+ }
192872
+ __name(printUserEmail, "printUserEmail");
192873
+ function printAccountList(user) {
192874
+ logger.table(
192875
+ user.accounts.map((account) => ({
192876
+ "Account Name": account.name,
192877
+ "Account ID": account.id
192878
+ }))
192879
+ );
192880
+ }
192881
+ __name(printAccountList, "printAccountList");
192882
+ function printTokenPermissions(user) {
192883
+ const permissions = user.tokenPermissions?.map((scope) => scope.split(":")) ?? [];
192884
+ if (user.authType !== "OAuth Token") {
192885
+ return void logger.log(
192886
+ `\u{1F513} To see token permissions visit https://dash.cloudflare.com/profile/api-tokens.`
192887
+ );
192888
+ }
192889
+ logger.log(
192890
+ `\u{1F513} Token Permissions: If scopes are missing, you may need to logout and re-login.`
192891
+ );
192892
+ logger.log(`Scope (Access)`);
192893
+ for (const [scope, access3] of permissions) {
192894
+ logger.log(`- ${scope} ${access3 ? `(${access3})` : ``}`);
192895
+ }
192896
+ }
192897
+ __name(printTokenPermissions, "printTokenPermissions");
192898
+ async function printMembershipInfo(user, accountFilter) {
192899
+ try {
192900
+ if (!accountFilter) {
192901
+ return;
192902
+ }
192903
+ const eq = /* @__PURE__ */ __name((a, b2) => a.localeCompare(b2, void 0, { sensitivity: "base" }) == 0, "eq");
192904
+ const selectedAccount = user.accounts.find(
192905
+ (a) => eq(a.id, accountFilter) || eq(a.name, accountFilter)
192906
+ );
192907
+ if (!selectedAccount) {
192908
+ return;
192909
+ }
192910
+ const membershipRoles = await fetchMembershipRoles(selectedAccount.id);
192911
+ if (!membershipRoles) {
192912
+ return;
192913
+ }
192914
+ logger.log(
192915
+ `\u{1F3A2} Membership roles in "${selectedAccount.name}": Contact account super admin to change your permissions.`
192916
+ );
192917
+ for (const role of membershipRoles) {
192918
+ logger.log(`- ${role}`);
192919
+ }
192920
+ } catch (e4) {
192921
+ if (isAuthenticationError(e4)) {
192922
+ logger.log(
192923
+ `\u{1F3A2} Unable to get membership roles. Make sure you have permissions to read the account.`
192924
+ );
192925
+ return;
192926
+ } else {
192927
+ throw e4;
192928
+ }
192929
+ }
192930
+ }
192931
+ __name(printMembershipInfo, "printMembershipInfo");
192932
+ async function getUserInfo() {
192933
+ const apiToken = getAPIToken();
192934
+ if (!apiToken) {
192935
+ return;
192936
+ }
192937
+ const tokenPermissions = await getTokenPermissions();
192938
+ const usingEnvAuth = !!getAuthFromEnv();
192939
+ const usingGlobalAuthKey = "authKey" in apiToken;
192940
+ return {
192941
+ apiToken: usingGlobalAuthKey ? apiToken.authKey : apiToken.apiToken,
192942
+ authType: usingGlobalAuthKey ? "Global API Key" : usingEnvAuth ? "API Token" : "OAuth Token",
192943
+ email: "authEmail" in apiToken ? apiToken.authEmail : await getEmail(),
192944
+ accounts: await getAccounts(),
192945
+ tokenPermissions
192946
+ };
192947
+ }
192948
+ __name(getUserInfo, "getUserInfo");
192949
+ async function getEmail() {
192950
+ try {
192951
+ const { email } = await fetchResult("/user");
192952
+ return email;
192953
+ } catch (e4) {
192954
+ const unauthorizedAccess = 9109;
192955
+ if (e4.code === unauthorizedAccess) {
192956
+ return void 0;
192957
+ } else {
192958
+ throw e4;
192959
+ }
192960
+ }
192961
+ }
192962
+ __name(getEmail, "getEmail");
192963
+ async function getAccounts() {
192964
+ return await fetchPagedListResult("/accounts");
192965
+ }
192966
+ __name(getAccounts, "getAccounts");
192967
+ async function getTokenPermissions() {
192968
+ return getScopes();
192969
+ }
192970
+ __name(getTokenPermissions, "getTokenPermissions");
192971
+
192972
+ // src/user/commands.ts
192973
+ defineCommand({
192974
+ command: "wrangler login",
192975
+ metadata: {
192976
+ description: "\u{1F513} Login to Cloudflare",
192977
+ owner: "Workers: Authoring and Testing",
192978
+ status: "stable"
192979
+ },
192980
+ behaviour: {
192981
+ printConfigWarnings: false
192982
+ },
192983
+ args: {
192984
+ "scopes-list": {
192985
+ describe: "List all the available OAuth scopes with descriptions"
192986
+ },
192987
+ browser: {
192988
+ default: true,
192989
+ type: "boolean",
192990
+ describe: "Automatically open the OAuth link in a browser"
192991
+ },
192992
+ scopes: {
192993
+ describe: "Pick the set of applicable OAuth scopes when logging in",
192994
+ array: true,
192995
+ type: "string",
192996
+ requiresArg: true
192997
+ }
192998
+ },
192999
+ async handler(args, { config }) {
193000
+ if (args.scopesList) {
193001
+ listScopes();
193002
+ return;
193003
+ }
193004
+ if (args.scopes) {
193005
+ if (args.scopes.length === 0) {
193006
+ listScopes();
193007
+ return;
193008
+ }
193009
+ if (!validateScopeKeys(args.scopes)) {
193010
+ throw new CommandLineArgsError(
193011
+ `One of ${args.scopes} is not a valid authentication scope. Run "wrangler login --scopes-list" to see the valid scopes.`
193012
+ );
193013
+ }
193014
+ await login({ scopes: args.scopes, browser: args.browser });
193015
+ return;
193016
+ }
193017
+ await login({ browser: args.browser });
193018
+ await sendMetricsEvent("login user", {
193019
+ sendMetrics: config.send_metrics
193020
+ });
193021
+ }
193022
+ });
193023
+ defineCommand({
193024
+ command: "wrangler logout",
193025
+ metadata: {
193026
+ description: "\u{1F6AA} Logout from Cloudflare",
193027
+ owner: "Workers: Authoring and Testing",
193028
+ status: "stable"
193029
+ },
193030
+ behaviour: {
193031
+ printConfigWarnings: false
193032
+ },
193033
+ async handler(_3, { config }) {
193034
+ await logout();
193035
+ await sendMetricsEvent("logout user", {
193036
+ sendMetrics: config.send_metrics
193037
+ });
193038
+ }
193039
+ });
193040
+ defineCommand({
193041
+ command: "wrangler whoami",
193042
+ metadata: {
193043
+ description: "\u{1F575}\uFE0F Retrieve your user information",
193044
+ owner: "Workers: Authoring and Testing",
193045
+ status: "stable"
193046
+ },
193047
+ behaviour: {
193048
+ printConfigWarnings: false
193049
+ },
193050
+ args: {
193051
+ account: {
193052
+ type: "string",
193053
+ describe: "Show membership information for the given account (id or name)."
193054
+ }
193055
+ },
193056
+ async handler(args, { config }) {
193057
+ await whoami(args.account);
193058
+ await sendMetricsEvent("view accounts", {
193059
+ sendMetrics: config.send_metrics
193060
+ });
193061
+ }
193062
+ });
193063
+
192484
193064
  // src/mtls-certificate/cli.ts
192485
193065
  init_import_meta_url();
192486
193066
 
@@ -192832,7 +193412,7 @@ function buildWorkerFromFunctions({
192832
193412
  additionalModules: [],
192833
193413
  moduleCollector,
192834
193414
  inject: [routesModule],
192835
- ...outdir ? { entryName: "index" } : {},
193415
+ ...outdir ? { entryName: "index" } : { entryName: void 0 },
192836
193416
  minify,
192837
193417
  sourcemap,
192838
193418
  watch: watch9,
@@ -192855,7 +193435,13 @@ function buildWorkerFromFunctions({
192855
193435
  targetConsumer: local ? "dev" : "deploy",
192856
193436
  local,
192857
193437
  projectRoot: getPagesProjectRoot(),
192858
- defineNavigatorUserAgent
193438
+ defineNavigatorUserAgent,
193439
+ legacyAssets: void 0,
193440
+ bypassAssetCache: void 0,
193441
+ jsxFactory: void 0,
193442
+ jsxFragment: void 0,
193443
+ tsconfig: void 0,
193444
+ testScheduled: void 0
192859
193445
  });
192860
193446
  }
192861
193447
  __name(buildWorkerFromFunctions, "buildWorkerFromFunctions");
@@ -192929,7 +193515,15 @@ function buildRawWorker({
192929
193515
  targetConsumer: local ? "dev" : "deploy",
192930
193516
  local,
192931
193517
  projectRoot: getPagesProjectRoot(),
192932
- defineNavigatorUserAgent
193518
+ defineNavigatorUserAgent,
193519
+ legacyAssets: void 0,
193520
+ bypassAssetCache: void 0,
193521
+ jsxFactory: void 0,
193522
+ jsxFragment: void 0,
193523
+ tsconfig: void 0,
193524
+ testScheduled: void 0,
193525
+ entryName: void 0,
193526
+ inject: void 0
192933
193527
  });
192934
193528
  }
192935
193529
  __name(buildRawWorker, "buildRawWorker");
@@ -193217,7 +193811,14 @@ function buildPluginFromFunctions({
193217
193811
  targetConsumer: local ? "dev" : "deploy",
193218
193812
  local,
193219
193813
  projectRoot: getPagesProjectRoot(),
193220
- defineNavigatorUserAgent
193814
+ defineNavigatorUserAgent,
193815
+ legacyAssets: void 0,
193816
+ bypassAssetCache: void 0,
193817
+ jsxFactory: void 0,
193818
+ jsxFragment: void 0,
193819
+ tsconfig: void 0,
193820
+ testScheduled: void 0,
193821
+ isOutfile: void 0
193221
193822
  });
193222
193823
  }
193223
193824
  __name(buildPluginFromFunctions, "buildPluginFromFunctions");
@@ -199033,9 +199634,9 @@ function eventNotificationHeaders(apiCredentials, jurisdiction) {
199033
199634
  return headers;
199034
199635
  }
199035
199636
  __name(eventNotificationHeaders, "eventNotificationHeaders");
199036
- async function tableFromNotificationGetResponse(config, response) {
199037
- const reducer = /* @__PURE__ */ __name(async (entry) => {
199038
- const rows = [];
199637
+ function tableFromNotificationGetResponse(response) {
199638
+ const rows = [];
199639
+ for (const entry of response.queues) {
199039
199640
  for (const {
199040
199641
  prefix = "",
199041
199642
  suffix = "",
@@ -199052,14 +199653,8 @@ async function tableFromNotificationGetResponse(config, response) {
199052
199653
  event_type: actions.join(",")
199053
199654
  });
199054
199655
  }
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
199656
  }
199062
- return tableOutput;
199657
+ return rows;
199063
199658
  }
199064
199659
  __name(tableFromNotificationGetResponse, "tableFromNotificationGetResponse");
199065
199660
  async function listEventNotificationConfig(apiCredentials, accountId, bucketName, jurisdiction) {
@@ -199147,6 +199742,85 @@ async function deleteEventNotificationConfig(config, apiCredentials, accountId,
199147
199742
  }
199148
199743
  }
199149
199744
  __name(deleteEventNotificationConfig, "deleteEventNotificationConfig");
199745
+ async function attachCustomDomainToBucket(accountId, bucketName, config, jurisdiction) {
199746
+ const headers = {
199747
+ "Content-Type": "application/json"
199748
+ };
199749
+ if (jurisdiction) {
199750
+ headers["cf-r2-jurisdiction"] = jurisdiction;
199751
+ }
199752
+ await fetchResult(
199753
+ `/accounts/${accountId}/r2/buckets/${bucketName}/domains/custom`,
199754
+ {
199755
+ method: "POST",
199756
+ headers,
199757
+ body: JSON.stringify({
199758
+ ...config,
199759
+ enabled: true
199760
+ })
199761
+ }
199762
+ );
199763
+ }
199764
+ __name(attachCustomDomainToBucket, "attachCustomDomainToBucket");
199765
+ async function removeCustomDomainFromBucket(accountId, bucketName, domainName, jurisdiction) {
199766
+ const headers = {};
199767
+ if (jurisdiction) {
199768
+ headers["cf-r2-jurisdiction"] = jurisdiction;
199769
+ }
199770
+ await fetchResult(
199771
+ `/accounts/${accountId}/r2/buckets/${bucketName}/domains/custom/${domainName}`,
199772
+ {
199773
+ method: "DELETE",
199774
+ headers
199775
+ }
199776
+ );
199777
+ }
199778
+ __name(removeCustomDomainFromBucket, "removeCustomDomainFromBucket");
199779
+ function tableFromCustomDomainListResponse(domains) {
199780
+ const rows = [];
199781
+ for (const domainInfo of domains) {
199782
+ rows.push({
199783
+ domain: domainInfo.domain,
199784
+ enabled: domainInfo.enabled ? "Yes" : "No",
199785
+ ownership_status: domainInfo.status.ownership || "(unknown)",
199786
+ ssl_status: domainInfo.status.ssl || "(unknown)",
199787
+ min_tls_version: domainInfo.minTLS || "1.0",
199788
+ zone_id: domainInfo.zoneId || "(none)",
199789
+ zone_name: domainInfo.zoneName || "(none)"
199790
+ });
199791
+ }
199792
+ return rows;
199793
+ }
199794
+ __name(tableFromCustomDomainListResponse, "tableFromCustomDomainListResponse");
199795
+ async function listCustomDomainsOfBucket(accountId, bucketName, jurisdiction) {
199796
+ const headers = {};
199797
+ if (jurisdiction) {
199798
+ headers["cf-r2-jurisdiction"] = jurisdiction;
199799
+ }
199800
+ const result = await fetchResult(`/accounts/${accountId}/r2/buckets/${bucketName}/domains/custom`, {
199801
+ method: "GET",
199802
+ headers
199803
+ });
199804
+ return result.domains;
199805
+ }
199806
+ __name(listCustomDomainsOfBucket, "listCustomDomainsOfBucket");
199807
+ async function configureCustomDomainSettings(accountId, bucketName, domainName, config, jurisdiction) {
199808
+ const headers = {
199809
+ "Content-Type": "application/json"
199810
+ };
199811
+ if (jurisdiction) {
199812
+ headers["cf-r2-jurisdiction"] = jurisdiction;
199813
+ }
199814
+ await fetchResult(
199815
+ `/accounts/${accountId}/r2/buckets/${bucketName}/domains/custom/${domainName}`,
199816
+ {
199817
+ method: "PUT",
199818
+ headers,
199819
+ body: JSON.stringify(config)
199820
+ }
199821
+ );
199822
+ }
199823
+ __name(configureCustomDomainSettings, "configureCustomDomainSettings");
199150
199824
  function isValidR2BucketName(name2) {
199151
199825
  return typeof name2 === "string" && /^[a-zA-Z][a-zA-Z0-9-]*$/.test(name2);
199152
199826
  }
@@ -199206,11 +199880,11 @@ async function Handler16(args) {
199206
199880
  }
199207
199881
  __name(Handler16, "Handler");
199208
199882
 
199209
- // src/r2/notification.ts
199883
+ // src/r2/domain.ts
199210
199884
  init_import_meta_url();
199211
199885
  function ListOptions5(yargs) {
199212
199886
  return yargs.positional("bucket", {
199213
- describe: "The name of the R2 bucket to get event notification rules for",
199887
+ describe: "The name of the R2 bucket whose connected custom domains will be listed",
199214
199888
  type: "string",
199215
199889
  demandOption: true
199216
199890
  }).option("jurisdiction", {
@@ -199222,6 +199896,180 @@ function ListOptions5(yargs) {
199222
199896
  }
199223
199897
  __name(ListOptions5, "ListOptions");
199224
199898
  async function ListHandler5(args) {
199899
+ await printWranglerBanner();
199900
+ const config = readConfig(args.config, args);
199901
+ const accountId = await requireAuth(config);
199902
+ const { bucket, jurisdiction } = args;
199903
+ logger.log(`Listing custom domains connected to bucket '${bucket}'...`);
199904
+ const domains = await listCustomDomainsOfBucket(
199905
+ accountId,
199906
+ bucket,
199907
+ jurisdiction
199908
+ );
199909
+ if (domains.length === 0) {
199910
+ logger.log("There are no custom domains connected to this bucket.");
199911
+ } else {
199912
+ const tableOutput = tableFromCustomDomainListResponse(domains);
199913
+ logger.log(tableOutput.map((x2) => formatLabelledValues(x2)).join("\n\n"));
199914
+ }
199915
+ }
199916
+ __name(ListHandler5, "ListHandler");
199917
+ function AddOptions(yargs) {
199918
+ return yargs.positional("bucket", {
199919
+ describe: "The name of the R2 bucket to connect a custom domain to",
199920
+ type: "string",
199921
+ demandOption: true
199922
+ }).option("domain", {
199923
+ describe: "The custom domain to connect to the R2 bucket",
199924
+ type: "string",
199925
+ demandOption: true
199926
+ }).option("zone-id", {
199927
+ describe: "The zone ID associated with the custom domain",
199928
+ type: "string",
199929
+ demandOption: true
199930
+ }).option("min-tls", {
199931
+ describe: "Set the minimum TLS version for the custom domain (defaults to 1.0 if not set)",
199932
+ choices: ["1.0", "1.1", "1.2", "1.3"],
199933
+ type: "string"
199934
+ }).option("jurisdiction", {
199935
+ describe: "The jurisdiction where the bucket exists",
199936
+ alias: "J",
199937
+ requiresArg: true,
199938
+ type: "string"
199939
+ }).option("force", {
199940
+ describe: "Skip confirmation",
199941
+ type: "boolean",
199942
+ alias: "y",
199943
+ default: false
199944
+ });
199945
+ }
199946
+ __name(AddOptions, "AddOptions");
199947
+ async function AddHandler(args) {
199948
+ await printWranglerBanner();
199949
+ const config = readConfig(args.config, args);
199950
+ const accountId = await requireAuth(config);
199951
+ const { bucket, domain: domain2, zoneId, minTls = "1.0", jurisdiction, force } = args;
199952
+ if (!force) {
199953
+ const confirmedAdd = await confirm(
199954
+ `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}'`
199955
+ );
199956
+ if (!confirmedAdd) {
199957
+ logger.log("Add cancelled.");
199958
+ return;
199959
+ }
199960
+ }
199961
+ logger.log(`Connecting custom domain '${domain2}' to bucket '${bucket}'...`);
199962
+ await attachCustomDomainToBucket(
199963
+ accountId,
199964
+ bucket,
199965
+ {
199966
+ domain: domain2,
199967
+ zoneId,
199968
+ minTLS: minTls
199969
+ },
199970
+ jurisdiction
199971
+ );
199972
+ logger.log(`\u2728 Custom domain '${domain2}' connected successfully.`);
199973
+ }
199974
+ __name(AddHandler, "AddHandler");
199975
+ function RemoveOptions(yargs) {
199976
+ return yargs.positional("bucket", {
199977
+ describe: "The name of the R2 bucket to remove the custom domain from",
199978
+ type: "string",
199979
+ demandOption: true
199980
+ }).option("domain", {
199981
+ describe: "The custom domain to remove from the R2 bucket",
199982
+ type: "string",
199983
+ demandOption: true
199984
+ }).option("jurisdiction", {
199985
+ describe: "The jurisdiction where the bucket exists",
199986
+ alias: "J",
199987
+ requiresArg: true,
199988
+ type: "string"
199989
+ }).option("force", {
199990
+ describe: "Skip confirmation",
199991
+ type: "boolean",
199992
+ alias: "y",
199993
+ default: false
199994
+ });
199995
+ }
199996
+ __name(RemoveOptions, "RemoveOptions");
199997
+ async function RemoveHandler(args) {
199998
+ await printWranglerBanner();
199999
+ const config = readConfig(args.config, args);
200000
+ const accountId = await requireAuth(config);
200001
+ const { bucket, domain: domain2, jurisdiction, force } = args;
200002
+ if (!force) {
200003
+ const confirmedRemoval = await confirm(
200004
+ `Are you sure you want to remove the custom domain '${domain2}' from bucket '${bucket}'? Your bucket will no longer be available from 'https://${domain2}'`
200005
+ );
200006
+ if (!confirmedRemoval) {
200007
+ logger.log("Removal cancelled.");
200008
+ return;
200009
+ }
200010
+ }
200011
+ logger.log(`Removing custom domain '${domain2}' from bucket '${bucket}'...`);
200012
+ await removeCustomDomainFromBucket(accountId, bucket, domain2, jurisdiction);
200013
+ logger.log(`Custom domain '${domain2}' removed successfully.`);
200014
+ }
200015
+ __name(RemoveHandler, "RemoveHandler");
200016
+ function UpdateOptions(yargs) {
200017
+ return yargs.positional("bucket", {
200018
+ describe: "The name of the R2 bucket associated with the custom domain to update",
200019
+ type: "string",
200020
+ demandOption: true
200021
+ }).option("domain", {
200022
+ describe: "The custom domain whose settings will be updated",
200023
+ type: "string",
200024
+ demandOption: true
200025
+ }).option("min-tls", {
200026
+ describe: "Update the minimum TLS version for the custom domain",
200027
+ choices: ["1.0", "1.1", "1.2", "1.3"],
200028
+ type: "string"
200029
+ }).option("jurisdiction", {
200030
+ describe: "The jurisdiction where the bucket exists",
200031
+ alias: "J",
200032
+ requiresArg: true,
200033
+ type: "string"
200034
+ });
200035
+ }
200036
+ __name(UpdateOptions, "UpdateOptions");
200037
+ async function UpdateHandler(args) {
200038
+ await printWranglerBanner();
200039
+ const config = readConfig(args.config, args);
200040
+ const accountId = await requireAuth(config);
200041
+ const { bucket, domain: domain2, minTls, jurisdiction } = args;
200042
+ logger.log(`Updating custom domain '${domain2}' for bucket '${bucket}'...`);
200043
+ await configureCustomDomainSettings(
200044
+ accountId,
200045
+ bucket,
200046
+ domain2,
200047
+ {
200048
+ domain: domain2,
200049
+ minTLS: minTls
200050
+ },
200051
+ jurisdiction
200052
+ );
200053
+ logger.log(`\u2728 Custom domain '${domain2}' updated successfully.`);
200054
+ }
200055
+ __name(UpdateHandler, "UpdateHandler");
200056
+
200057
+ // src/r2/notification.ts
200058
+ init_import_meta_url();
200059
+ function ListOptions6(yargs) {
200060
+ return yargs.positional("bucket", {
200061
+ describe: "The name of the R2 bucket to get event notification rules for",
200062
+ type: "string",
200063
+ demandOption: true
200064
+ }).option("jurisdiction", {
200065
+ describe: "The jurisdiction where the bucket exists",
200066
+ alias: "J",
200067
+ requiresArg: true,
200068
+ type: "string"
200069
+ });
200070
+ }
200071
+ __name(ListOptions6, "ListOptions");
200072
+ async function ListHandler6(args) {
199225
200073
  await printWranglerBanner();
199226
200074
  if (args._[3] === "get") {
199227
200075
  logger.warn(
@@ -199238,10 +200086,10 @@ async function ListHandler5(args) {
199238
200086
  bucket,
199239
200087
  jurisdiction
199240
200088
  );
199241
- const tableOutput = await tableFromNotificationGetResponse(config, resp);
200089
+ const tableOutput = tableFromNotificationGetResponse(resp);
199242
200090
  logger.log(tableOutput.map((x2) => formatLabelledValues(x2)).join("\n\n"));
199243
200091
  }
199244
- __name(ListHandler5, "ListHandler");
200092
+ __name(ListHandler6, "ListHandler");
199245
200093
  function CreateOptions4(yargs) {
199246
200094
  return yargs.positional("bucket", {
199247
200095
  describe: "The name of the R2 bucket to create an event notification rule for",
@@ -200076,8 +200924,8 @@ ${key} is ${prettyBytes(objectSize, {
200076
200924
  return r2EvNotifyYargs.command(
200077
200925
  ["list <bucket>", "get <bucket>"],
200078
200926
  "List event notification rules for a bucket",
200079
- ListOptions5,
200080
- ListHandler5
200927
+ ListOptions6,
200928
+ ListHandler6
200081
200929
  ).command(
200082
200930
  "create <bucket>",
200083
200931
  "Create an event notification rule for an R2 bucket",
@@ -200091,6 +200939,33 @@ ${key} is ${prettyBytes(objectSize, {
200091
200939
  );
200092
200940
  }
200093
200941
  );
200942
+ r2BucketYargs.command(
200943
+ "domain",
200944
+ "Manage custom domains for an R2 bucket",
200945
+ (domainYargs) => {
200946
+ return domainYargs.command(
200947
+ "list <bucket>",
200948
+ "List custom domains for an R2 bucket",
200949
+ ListOptions5,
200950
+ ListHandler5
200951
+ ).command(
200952
+ "add <bucket>",
200953
+ "Connect a custom domain to an R2 bucket",
200954
+ AddOptions,
200955
+ AddHandler
200956
+ ).command(
200957
+ "remove <bucket>",
200958
+ "Remove a custom domain from an R2 bucket",
200959
+ RemoveOptions,
200960
+ RemoveHandler
200961
+ ).command(
200962
+ "update <bucket>",
200963
+ "Update settings for a custom domain connected to an R2 bucket",
200964
+ UpdateOptions,
200965
+ UpdateHandler
200966
+ );
200967
+ }
200968
+ );
200094
200969
  return r2BucketYargs;
200095
200970
  });
200096
200971
  }
@@ -200275,7 +201150,6 @@ var secret2 = /* @__PURE__ */ __name((secretYargs) => {
200275
201150
  "delete <key>",
200276
201151
  "Delete a secret variable from a Worker",
200277
201152
  async (yargs) => {
200278
- await printWranglerBanner();
200279
201153
  return yargs.positional("key", {
200280
201154
  describe: "The variable name to be accessible in the Worker",
200281
201155
  type: "string"
@@ -200286,6 +201160,7 @@ var secret2 = /* @__PURE__ */ __name((secretYargs) => {
200286
201160
  });
200287
201161
  },
200288
201162
  async (args) => {
201163
+ await printWranglerBanner();
200289
201164
  const config = readConfig(args.config, args);
200290
201165
  if (config.pages_build_output_dir) {
200291
201166
  throw new UserError(
@@ -207335,7 +208210,7 @@ __name(wrapResolver, "wrapResolver");
207335
208210
  // ../../node_modules/.pnpm/@sentry+node@7.87.0_supports-color@9.2.2/node_modules/@sentry/node/esm/client.js
207336
208211
  init_import_meta_url();
207337
208212
  var os9 = __toESM(require("os"));
207338
- var import_util6 = require("util");
208213
+ var import_util7 = require("util");
207339
208214
  var NodeClient = class extends ServerRuntimeClient {
207340
208215
  /**
207341
208216
  * Creates a new Node SDK instance.
@@ -207354,7 +208229,7 @@ var NodeClient = class extends ServerRuntimeClient {
207354
208229
  version: SDK_VERSION
207355
208230
  };
207356
208231
  options29.transportOptions = {
207357
- textEncoder: new import_util6.TextEncoder(),
208232
+ textEncoder: new import_util7.TextEncoder(),
207358
208233
  ...options29.transportOptions
207359
208234
  };
207360
208235
  const clientOptions = {
@@ -208408,9 +209283,9 @@ var import_child_process2 = require("child_process");
208408
209283
  var import_fs13 = require("fs");
208409
209284
  var os10 = __toESM(require("os"));
208410
209285
  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);
209286
+ var import_util8 = require("util");
209287
+ var readFileAsync = (0, import_util8.promisify)(import_fs13.readFile);
209288
+ var readDirAsync = (0, import_util8.promisify)(import_fs13.readdir);
208414
209289
  var Context = class {
208415
209290
  /**
208416
209291
  * @inheritDoc
@@ -212270,7 +213145,16 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
212270
213145
  defineNavigatorUserAgent: isNavigatorDefined(
212271
213146
  props.compatibilityDate ?? config.compatibility_date,
212272
213147
  props.compatibilityFlags ?? config.compatibility_flags
212273
- )
213148
+ ),
213149
+ plugins: [logBuildOutput(nodejsCompatMode)],
213150
+ // Pages specific options used by wrangler pages commands
213151
+ entryName: void 0,
213152
+ inject: void 0,
213153
+ isOutfile: void 0,
213154
+ external: void 0,
213155
+ // These options are dev-only
213156
+ testScheduled: void 0,
213157
+ watch: void 0
212274
213158
  }
212275
213159
  );
212276
213160
  for (const module3 of modules) {
@@ -213272,148 +214156,6 @@ async function fetchDefaultRollbackVersionId(accountId, workerName) {
213272
214156
  }
213273
214157
  __name(fetchDefaultRollbackVersionId, "fetchDefaultRollbackVersionId");
213274
214158
 
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
214159
  // src/index.ts
213418
214160
  var resetColor = "\x1B[0m";
213419
214161
  var fgGreenColor = "\x1B[32m";
@@ -213764,83 +214506,9 @@ function createCLIParser(argv) {
213764
214506
  wrangler.command("pipelines", false, (pipelinesYargs) => {
213765
214507
  return pipelines(pipelinesYargs.command(subHelp));
213766
214508
  });
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
- );
214509
+ register2.registerNamespace("login");
214510
+ register2.registerNamespace("logout");
214511
+ register2.registerNamespace("whoami");
213844
214512
  wrangler.command("build", false, buildOptions, buildHandler);
213845
214513
  wrangler.command("config", false, noOpOptions, configHandler);
213846
214514
  wrangler.command(
@@ -215565,7 +216233,18 @@ var BundlerController = class extends Controller {
215565
216233
  defineNavigatorUserAgent: isNavigatorDefined(
215566
216234
  config.compatibilityDate,
215567
216235
  config.compatibilityFlags
215568
- )
216236
+ ),
216237
+ testScheduled: config.dev.testScheduled,
216238
+ plugins: void 0,
216239
+ // Pages specific options used by wrangler pages commands
216240
+ entryName: void 0,
216241
+ inject: void 0,
216242
+ isOutfile: void 0,
216243
+ external: void 0,
216244
+ // We don't use esbuild watching for custom builds
216245
+ watch: void 0,
216246
+ // sourcemap defaults to true in dev
216247
+ sourcemap: void 0
215569
216248
  });
215570
216249
  if (buildAborter.signal.aborted) {
215571
216250
  return;
@@ -216183,7 +216862,8 @@ async function convertToConfigBundle(event) {
216183
216862
  inspect: true,
216184
216863
  services: bindings.services,
216185
216864
  serviceBindings: fetchers,
216186
- bindVectorizeToProd: event.config.dev?.bindVectorizeToProd ?? false
216865
+ bindVectorizeToProd: event.config.dev?.bindVectorizeToProd ?? false,
216866
+ testScheduled: !!event.config.dev.testScheduled
216187
216867
  };
216188
216868
  }
216189
216869
  __name(convertToConfigBundle, "convertToConfigBundle");