wrangler 4.72.0 → 4.74.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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var assert51 = require('assert');
3
+ var assert52 = require('assert');
4
4
  var module2 = require('module');
5
5
  var path3 = require('path');
6
6
  var fs23 = require('fs');
@@ -52,7 +52,7 @@ function _interopNamespace(e) {
52
52
  return Object.freeze(n);
53
53
  }
54
54
 
55
- var assert51__default = /*#__PURE__*/_interopDefault(assert51);
55
+ var assert52__default = /*#__PURE__*/_interopDefault(assert52);
56
56
  var module2__default = /*#__PURE__*/_interopDefault(module2);
57
57
  var path3__namespace = /*#__PURE__*/_interopNamespace(path3);
58
58
  var fs23__namespace = /*#__PURE__*/_interopNamespace(fs23);
@@ -266,7 +266,7 @@ function isCompatDate(str) {
266
266
  }
267
267
  function formatCompatibilityDate(date) {
268
268
  const compatDate = date.toISOString().slice(0, 10);
269
- assert51__default.default(isCompatDate(compatDate));
269
+ assert52__default.default(isCompatDate(compatDate));
270
270
  return compatDate;
271
271
  }
272
272
  function assertNever(_value) {
@@ -3949,7 +3949,7 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args,
3949
3949
  );
3950
3950
  }
3951
3951
  const envName = args.env ?? getCloudflareEnv();
3952
- assert51__default.default(envName === void 0 || typeof envName === "string");
3952
+ assert52__default.default(envName === void 0 || typeof envName === "string");
3953
3953
  let activeEnv = topLevelEnv;
3954
3954
  if (envName) {
3955
3955
  if (isRedirectedConfig) {
@@ -4153,7 +4153,7 @@ function normalizeAndValidatePagesBuildOutputDir(configPath, rawPagesDir) {
4153
4153
  }
4154
4154
  }
4155
4155
  function normalizeAndValidateDev(diagnostics, rawDev, args) {
4156
- assert51__default.default(typeof args === "object" && args !== null && !Array.isArray(args));
4156
+ assert52__default.default(typeof args === "object" && args !== null && !Array.isArray(args));
4157
4157
  const {
4158
4158
  localProtocol: localProtocolArg,
4159
4159
  upstreamProtocol: upstreamProtocolArg,
@@ -4161,17 +4161,17 @@ function normalizeAndValidateDev(diagnostics, rawDev, args) {
4161
4161
  enableContainers: enableContainersArg,
4162
4162
  generateTypes: generateTypesArg
4163
4163
  } = args;
4164
- assert51__default.default(
4164
+ assert52__default.default(
4165
4165
  localProtocolArg === void 0 || localProtocolArg === "http" || localProtocolArg === "https"
4166
4166
  );
4167
- assert51__default.default(
4167
+ assert52__default.default(
4168
4168
  upstreamProtocolArg === void 0 || upstreamProtocolArg === "http" || upstreamProtocolArg === "https"
4169
4169
  );
4170
- assert51__default.default(remoteArg === void 0 || typeof remoteArg === "boolean");
4171
- assert51__default.default(
4170
+ assert52__default.default(remoteArg === void 0 || typeof remoteArg === "boolean");
4171
+ assert52__default.default(
4172
4172
  enableContainersArg === void 0 || typeof enableContainersArg === "boolean"
4173
4173
  );
4174
- assert51__default.default(
4174
+ assert52__default.default(
4175
4175
  generateTypesArg === void 0 || typeof generateTypesArg === "boolean"
4176
4176
  );
4177
4177
  const {
@@ -10912,8 +10912,8 @@ var init_esm = __esm({
10912
10912
  mainFilename = __dirname2.substring(0, __dirname2.lastIndexOf("node_modules"));
10913
10913
  esm_default2 = {
10914
10914
  assert: {
10915
- notStrictEqual: assert51.notStrictEqual,
10916
- strictEqual: assert51.strictEqual
10915
+ notStrictEqual: assert52.notStrictEqual,
10916
+ strictEqual: assert52.strictEqual
10917
10917
  },
10918
10918
  cliui: ui,
10919
10919
  findUp: sync_default,
@@ -12005,11 +12005,11 @@ var require_tree = __commonJS({
12005
12005
  var require_util = __commonJS({
12006
12006
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/core/util.js"(exports, module4) {
12007
12007
  init_import_meta_url();
12008
- var assert59 = __require("assert");
12008
+ var assert60 = __require("assert");
12009
12009
  var { kDestroyed, kBodyUsed, kListeners, kBody } = require_symbols();
12010
12010
  var { IncomingMessage } = __require("http");
12011
12011
  var stream2 = __require("stream");
12012
- var net2 = __require("net");
12012
+ var net3 = __require("net");
12013
12013
  var { stringify: stringify4 } = __require("querystring");
12014
12014
  var { EventEmitter: EE } = __require("events");
12015
12015
  var timers = require_timers();
@@ -12026,7 +12026,7 @@ var require_util = __commonJS({
12026
12026
  this[kBodyUsed] = false;
12027
12027
  }
12028
12028
  async *[Symbol.asyncIterator]() {
12029
- assert59(!this[kBodyUsed], "disturbed");
12029
+ assert60(!this[kBodyUsed], "disturbed");
12030
12030
  this[kBodyUsed] = true;
12031
12031
  yield* this[kBody];
12032
12032
  }
@@ -12038,7 +12038,7 @@ var require_util = __commonJS({
12038
12038
  if (isStream2(body)) {
12039
12039
  if (bodyLength(body) === 0) {
12040
12040
  body.on("data", function() {
12041
- assert59(false);
12041
+ assert60(false);
12042
12042
  });
12043
12043
  }
12044
12044
  if (typeof body.readableDidRead !== "boolean") {
@@ -12156,7 +12156,7 @@ var require_util = __commonJS({
12156
12156
  function getHostname(host) {
12157
12157
  if (host[0] === "[") {
12158
12158
  const idx2 = host.indexOf("]");
12159
- assert59(idx2 !== -1);
12159
+ assert60(idx2 !== -1);
12160
12160
  return host.substring(1, idx2);
12161
12161
  }
12162
12162
  const idx = host.indexOf(":");
@@ -12168,9 +12168,9 @@ var require_util = __commonJS({
12168
12168
  if (!host) {
12169
12169
  return null;
12170
12170
  }
12171
- assert59(typeof host === "string");
12171
+ assert60(typeof host === "string");
12172
12172
  const servername = getHostname(host);
12173
- if (net2.isIP(servername)) {
12173
+ if (net3.isIP(servername)) {
12174
12174
  return "";
12175
12175
  }
12176
12176
  return servername;
@@ -12725,7 +12725,7 @@ var require_util = __commonJS({
12725
12725
  function errorRequest(client, request4, err) {
12726
12726
  try {
12727
12727
  request4.onError(err);
12728
- assert59(request4.aborted);
12728
+ assert60(request4.aborted);
12729
12729
  } catch (err2) {
12730
12730
  client.emit("error", err2);
12731
12731
  }
@@ -13128,7 +13128,7 @@ var require_request = __commonJS({
13128
13128
  InvalidArgumentError,
13129
13129
  NotSupportedError
13130
13130
  } = require_errors();
13131
- var assert59 = __require("assert");
13131
+ var assert60 = __require("assert");
13132
13132
  var {
13133
13133
  isValidHTTPToken,
13134
13134
  isValidHeaderValue,
@@ -13308,8 +13308,8 @@ var require_request = __commonJS({
13308
13308
  }
13309
13309
  }
13310
13310
  onConnect(abort) {
13311
- assert59(!this.aborted);
13312
- assert59(!this.completed);
13311
+ assert60(!this.aborted);
13312
+ assert60(!this.completed);
13313
13313
  if (this.error) {
13314
13314
  abort(this.error);
13315
13315
  } else {
@@ -13321,8 +13321,8 @@ var require_request = __commonJS({
13321
13321
  return this[kHandler].onResponseStarted?.();
13322
13322
  }
13323
13323
  onHeaders(statusCode, headers, resume, statusText) {
13324
- assert59(!this.aborted);
13325
- assert59(!this.completed);
13324
+ assert60(!this.aborted);
13325
+ assert60(!this.completed);
13326
13326
  if (channels.headers.hasSubscribers) {
13327
13327
  channels.headers.publish({ request: this, response: { statusCode, headers, statusText } });
13328
13328
  }
@@ -13333,8 +13333,8 @@ var require_request = __commonJS({
13333
13333
  }
13334
13334
  }
13335
13335
  onData(chunk) {
13336
- assert59(!this.aborted);
13337
- assert59(!this.completed);
13336
+ assert60(!this.aborted);
13337
+ assert60(!this.completed);
13338
13338
  if (channels.bodyChunkReceived.hasSubscribers) {
13339
13339
  channels.bodyChunkReceived.publish({ request: this, chunk });
13340
13340
  }
@@ -13346,14 +13346,14 @@ var require_request = __commonJS({
13346
13346
  }
13347
13347
  }
13348
13348
  onUpgrade(statusCode, headers, socket) {
13349
- assert59(!this.aborted);
13350
- assert59(!this.completed);
13349
+ assert60(!this.aborted);
13350
+ assert60(!this.completed);
13351
13351
  return this[kHandler].onUpgrade(statusCode, headers, socket);
13352
13352
  }
13353
13353
  onComplete(trailers) {
13354
13354
  this.onFinally();
13355
- assert59(!this.aborted);
13356
- assert59(!this.completed);
13355
+ assert60(!this.aborted);
13356
+ assert60(!this.completed);
13357
13357
  this.completed = true;
13358
13358
  if (channels.trailers.hasSubscribers) {
13359
13359
  channels.trailers.publish({ request: this, trailers });
@@ -13815,8 +13815,8 @@ var require_dispatcher_base = __commonJS({
13815
13815
  var require_connect = __commonJS({
13816
13816
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/core/connect.js"(exports, module4) {
13817
13817
  init_import_meta_url();
13818
- var net2 = __require("net");
13819
- var assert59 = __require("assert");
13818
+ var net3 = __require("net");
13819
+ var assert60 = __require("assert");
13820
13820
  var util3 = require_util();
13821
13821
  var { InvalidArgumentError } = require_errors();
13822
13822
  var tls;
@@ -13865,7 +13865,7 @@ var require_connect = __commonJS({
13865
13865
  }
13866
13866
  servername = servername || options.servername || util3.getServerName(host) || null;
13867
13867
  const sessionKey = servername || hostname2;
13868
- assert59(sessionKey);
13868
+ assert60(sessionKey);
13869
13869
  const session = customSession || sessionCache.get(sessionKey) || null;
13870
13870
  port = port || 443;
13871
13871
  socket = tls.connect({
@@ -13885,9 +13885,9 @@ var require_connect = __commonJS({
13885
13885
  sessionCache.set(sessionKey, session2);
13886
13886
  });
13887
13887
  } else {
13888
- assert59(!httpSocket, "httpSocket can only be sent on TLS update");
13888
+ assert60(!httpSocket, "httpSocket can only be sent on TLS update");
13889
13889
  port = port || 80;
13890
- socket = net2.connect({
13890
+ socket = net3.connect({
13891
13891
  highWaterMark: 64 * 1024,
13892
13892
  // Same as nodejs fs streams.
13893
13893
  ...options,
@@ -14885,7 +14885,7 @@ var require_encoding = __commonJS({
14885
14885
  var require_infra = __commonJS({
14886
14886
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/web/infra/index.js"(exports, module4) {
14887
14887
  init_import_meta_url();
14888
- var assert59 = __require("assert");
14888
+ var assert60 = __require("assert");
14889
14889
  var { utf8DecodeBytes } = require_encoding();
14890
14890
  function collectASequenceOfCodePoints(condition, input, position) {
14891
14891
  let result = "";
@@ -14956,7 +14956,7 @@ var require_infra = __commonJS({
14956
14956
  __name(isomorphicDecode, "isomorphicDecode");
14957
14957
  var invalidIsomorphicEncodeValueRegex = /[^\x00-\xFF]/;
14958
14958
  function isomorphicEncode(input) {
14959
- assert59(!invalidIsomorphicEncodeValueRegex.test(input));
14959
+ assert60(!invalidIsomorphicEncodeValueRegex.test(input));
14960
14960
  return input;
14961
14961
  }
14962
14962
  __name(isomorphicEncode, "isomorphicEncode");
@@ -14985,7 +14985,7 @@ var require_infra = __commonJS({
14985
14985
  if (result === void 0) {
14986
14986
  throw new TypeError("Value is not JSON serializable");
14987
14987
  }
14988
- assert59(typeof result === "string");
14988
+ assert60(typeof result === "string");
14989
14989
  return result;
14990
14990
  }
14991
14991
  __name(serializeJavascriptValueToJSONString, "serializeJavascriptValueToJSONString");
@@ -15008,14 +15008,14 @@ var require_infra = __commonJS({
15008
15008
  var require_data_url = __commonJS({
15009
15009
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/web/fetch/data-url.js"(exports, module4) {
15010
15010
  init_import_meta_url();
15011
- var assert59 = __require("assert");
15011
+ var assert60 = __require("assert");
15012
15012
  var { forgivingBase64, collectASequenceOfCodePoints, collectASequenceOfCodePointsFast, isomorphicDecode, removeASCIIWhitespace, removeChars } = require_infra();
15013
15013
  var encoder = new TextEncoder();
15014
15014
  var HTTP_TOKEN_CODEPOINTS = /^[-!#$%&'*+.^_|~A-Za-z0-9]+$/u;
15015
15015
  var HTTP_WHITESPACE_REGEX = /[\u000A\u000D\u0009\u0020]/u;
15016
15016
  var HTTP_QUOTED_STRING_TOKENS = /^[\u0009\u0020-\u007E\u0080-\u00FF]+$/u;
15017
15017
  function dataURLProcessor(dataURL) {
15018
- assert59(dataURL.protocol === "data:");
15018
+ assert60(dataURL.protocol === "data:");
15019
15019
  let input = URLSerializer(dataURL, true);
15020
15020
  input = input.slice(5);
15021
15021
  const position = { position: 0 };
@@ -15187,7 +15187,7 @@ var require_data_url = __commonJS({
15187
15187
  function collectAnHTTPQuotedString(input, position, extractValue3 = false) {
15188
15188
  const positionStart = position.position;
15189
15189
  let value = "";
15190
- assert59(input[position.position] === '"');
15190
+ assert60(input[position.position] === '"');
15191
15191
  position.position++;
15192
15192
  while (true) {
15193
15193
  value += collectASequenceOfCodePoints(
@@ -15208,7 +15208,7 @@ var require_data_url = __commonJS({
15208
15208
  value += input[position.position];
15209
15209
  position.position++;
15210
15210
  } else {
15211
- assert59(quoteOrBackslash === '"');
15211
+ assert60(quoteOrBackslash === '"');
15212
15212
  break;
15213
15213
  }
15214
15214
  }
@@ -15219,7 +15219,7 @@ var require_data_url = __commonJS({
15219
15219
  }
15220
15220
  __name(collectAnHTTPQuotedString, "collectAnHTTPQuotedString");
15221
15221
  function serializeAMimeType(mimeType) {
15222
- assert59(mimeType !== "failure");
15222
+ assert60(mimeType !== "failure");
15223
15223
  const { parameters, essence } = mimeType;
15224
15224
  let serialization = essence;
15225
15225
  for (let [name2, value] of parameters.entries()) {
@@ -15993,7 +15993,7 @@ var require_util2 = __commonJS({
15993
15993
  var { collectAnHTTPQuotedString, parseMIMEType } = require_data_url();
15994
15994
  var { performance: performance2 } = __require("perf_hooks");
15995
15995
  var { ReadableStreamFrom, isValidHTTPToken, normalizedMethodRecordsBase } = require_util();
15996
- var assert59 = __require("assert");
15996
+ var assert60 = __require("assert");
15997
15997
  var { isUint8Array } = __require("util/types");
15998
15998
  var { webidl } = require_webidl();
15999
15999
  var { isomorphicEncode, collectASequenceOfCodePoints, removeChars } = require_infra();
@@ -16196,7 +16196,7 @@ var require_util2 = __commonJS({
16196
16196
  __name(clonePolicyContainer, "clonePolicyContainer");
16197
16197
  function determineRequestsReferrer(request4) {
16198
16198
  const policy = request4.referrerPolicy;
16199
- assert59(policy);
16199
+ assert60(policy);
16200
16200
  let referrerSource = null;
16201
16201
  if (request4.referrer === "client") {
16202
16202
  const globalOrigin = getGlobalOrigin();
@@ -16260,7 +16260,7 @@ var require_util2 = __commonJS({
16260
16260
  }
16261
16261
  __name(determineRequestsReferrer, "determineRequestsReferrer");
16262
16262
  function stripURLForReferrer(url4, originOnly = false) {
16263
- assert59(webidl.is.URL(url4));
16263
+ assert60(webidl.is.URL(url4));
16264
16264
  url4 = new URL(url4);
16265
16265
  if (urlIsLocal(url4)) {
16266
16266
  return "no-referrer";
@@ -16524,7 +16524,7 @@ var require_util2 = __commonJS({
16524
16524
  }
16525
16525
  __name(readAllBytes, "readAllBytes");
16526
16526
  function urlIsLocal(url4) {
16527
- assert59("protocol" in url4);
16527
+ assert60("protocol" in url4);
16528
16528
  const protocol = url4.protocol;
16529
16529
  return protocol === "about:" || protocol === "blob:" || protocol === "data:";
16530
16530
  }
@@ -16534,7 +16534,7 @@ var require_util2 = __commonJS({
16534
16534
  }
16535
16535
  __name(urlHasHttpsScheme, "urlHasHttpsScheme");
16536
16536
  function urlIsHttpHttpsScheme(url4) {
16537
- assert59("protocol" in url4);
16537
+ assert60("protocol" in url4);
16538
16538
  const protocol = url4.protocol;
16539
16539
  return protocol === "http:" || protocol === "https:";
16540
16540
  }
@@ -16707,7 +16707,7 @@ var require_util2 = __commonJS({
16707
16707
  continue;
16708
16708
  }
16709
16709
  } else {
16710
- assert59(input.charCodeAt(position.position) === 44);
16710
+ assert60(input.charCodeAt(position.position) === 44);
16711
16711
  position.position++;
16712
16712
  }
16713
16713
  }
@@ -16967,7 +16967,7 @@ var require_formdata_parser = __commonJS({
16967
16967
  var { HTTP_TOKEN_CODEPOINTS } = require_data_url();
16968
16968
  var { makeEntry } = require_formdata();
16969
16969
  var { webidl } = require_webidl();
16970
- var assert59 = __require("assert");
16970
+ var assert60 = __require("assert");
16971
16971
  var { isomorphicDecode } = require_infra();
16972
16972
  var { utf8DecodeBytes } = require_encoding();
16973
16973
  var dd = Buffer.from("--");
@@ -16996,7 +16996,7 @@ var require_formdata_parser = __commonJS({
16996
16996
  }
16997
16997
  __name(validateBoundary, "validateBoundary");
16998
16998
  function multipartFormDataParser(input, mimeType) {
16999
- assert59(mimeType !== "failure" && mimeType.essence === "multipart/form-data");
16999
+ assert60(mimeType !== "failure" && mimeType.essence === "multipart/form-data");
17000
17000
  const boundaryString = mimeType.parameters.get("boundary");
17001
17001
  if (boundaryString === void 0) {
17002
17002
  throw parsingError("missing boundary in content-type header");
@@ -17052,8 +17052,8 @@ var require_formdata_parser = __commonJS({
17052
17052
  } else {
17053
17053
  value = utf8DecodeBytes(Buffer.from(body));
17054
17054
  }
17055
- assert59(webidl.is.USVString(name2));
17056
- assert59(typeof value === "string" && webidl.is.USVString(value) || webidl.is.File(value));
17055
+ assert60(webidl.is.USVString(name2));
17056
+ assert60(typeof value === "string" && webidl.is.USVString(value) || webidl.is.File(value));
17057
17057
  entryList.push(makeEntry(name2, value, filename));
17058
17058
  }
17059
17059
  }
@@ -17328,7 +17328,7 @@ var require_body = __commonJS({
17328
17328
  } = require_util2();
17329
17329
  var { FormData: FormData13, setFormDataState } = require_formdata();
17330
17330
  var { webidl } = require_webidl();
17331
- var assert59 = __require("assert");
17331
+ var assert60 = __require("assert");
17332
17332
  var { isErrored, isDisturbed } = __require("stream");
17333
17333
  var { isArrayBuffer: isArrayBuffer3 } = __require("util/types");
17334
17334
  var { serializeAMimeType } = require_data_url();
@@ -17368,7 +17368,7 @@ var require_body = __commonJS({
17368
17368
  type: "bytes"
17369
17369
  });
17370
17370
  }
17371
- assert59(webidl.is.ReadableStream(stream2));
17371
+ assert60(webidl.is.ReadableStream(stream2));
17372
17372
  let action = null;
17373
17373
  let source = null;
17374
17374
  let length = null;
@@ -17486,8 +17486,8 @@ Content-Type: ${value.type || "application/octet-stream"}\r
17486
17486
  __name(extractBody, "extractBody");
17487
17487
  function safelyExtractBody(object, keepalive = false) {
17488
17488
  if (webidl.is.ReadableStream(object)) {
17489
- assert59(!util3.isDisturbed(object), "The body has already been consumed.");
17490
- assert59(!object.locked, "The stream is locked.");
17489
+ assert60(!util3.isDisturbed(object), "The body has already been consumed.");
17490
+ assert60(!object.locked, "The stream is locked.");
17491
17491
  }
17492
17492
  return extractBody(object, keepalive);
17493
17493
  }
@@ -17624,7 +17624,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r
17624
17624
  var require_client_h1 = __commonJS({
17625
17625
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/dispatcher/client-h1.js"(exports, module4) {
17626
17626
  init_import_meta_url();
17627
- var assert59 = __require("assert");
17627
+ var assert60 = __require("assert");
17628
17628
  var util3 = require_util();
17629
17629
  var { channels } = require_diagnostics();
17630
17630
  var timers = require_timers();
@@ -17715,7 +17715,7 @@ var require_client_h1 = __commonJS({
17715
17715
  * @returns {number}
17716
17716
  */
17717
17717
  wasm_on_status: /* @__PURE__ */ __name((p7, at3, len) => {
17718
- assert59(currentParser.ptr === p7);
17718
+ assert60(currentParser.ptr === p7);
17719
17719
  const start = at3 - currentBufferPtr + currentBufferRef.byteOffset;
17720
17720
  return currentParser.onStatus(new FastBuffer(currentBufferRef.buffer, start, len));
17721
17721
  }, "wasm_on_status"),
@@ -17724,7 +17724,7 @@ var require_client_h1 = __commonJS({
17724
17724
  * @returns {number}
17725
17725
  */
17726
17726
  wasm_on_message_begin: /* @__PURE__ */ __name((p7) => {
17727
- assert59(currentParser.ptr === p7);
17727
+ assert60(currentParser.ptr === p7);
17728
17728
  return currentParser.onMessageBegin();
17729
17729
  }, "wasm_on_message_begin"),
17730
17730
  /**
@@ -17734,7 +17734,7 @@ var require_client_h1 = __commonJS({
17734
17734
  * @returns {number}
17735
17735
  */
17736
17736
  wasm_on_header_field: /* @__PURE__ */ __name((p7, at3, len) => {
17737
- assert59(currentParser.ptr === p7);
17737
+ assert60(currentParser.ptr === p7);
17738
17738
  const start = at3 - currentBufferPtr + currentBufferRef.byteOffset;
17739
17739
  return currentParser.onHeaderField(new FastBuffer(currentBufferRef.buffer, start, len));
17740
17740
  }, "wasm_on_header_field"),
@@ -17745,7 +17745,7 @@ var require_client_h1 = __commonJS({
17745
17745
  * @returns {number}
17746
17746
  */
17747
17747
  wasm_on_header_value: /* @__PURE__ */ __name((p7, at3, len) => {
17748
- assert59(currentParser.ptr === p7);
17748
+ assert60(currentParser.ptr === p7);
17749
17749
  const start = at3 - currentBufferPtr + currentBufferRef.byteOffset;
17750
17750
  return currentParser.onHeaderValue(new FastBuffer(currentBufferRef.buffer, start, len));
17751
17751
  }, "wasm_on_header_value"),
@@ -17757,7 +17757,7 @@ var require_client_h1 = __commonJS({
17757
17757
  * @returns {number}
17758
17758
  */
17759
17759
  wasm_on_headers_complete: /* @__PURE__ */ __name((p7, statusCode, upgrade, shouldKeepAlive) => {
17760
- assert59(currentParser.ptr === p7);
17760
+ assert60(currentParser.ptr === p7);
17761
17761
  return currentParser.onHeadersComplete(statusCode, upgrade === 1, shouldKeepAlive === 1);
17762
17762
  }, "wasm_on_headers_complete"),
17763
17763
  /**
@@ -17767,7 +17767,7 @@ var require_client_h1 = __commonJS({
17767
17767
  * @returns {number}
17768
17768
  */
17769
17769
  wasm_on_body: /* @__PURE__ */ __name((p7, at3, len) => {
17770
- assert59(currentParser.ptr === p7);
17770
+ assert60(currentParser.ptr === p7);
17771
17771
  const start = at3 - currentBufferPtr + currentBufferRef.byteOffset;
17772
17772
  return currentParser.onBody(new FastBuffer(currentBufferRef.buffer, start, len));
17773
17773
  }, "wasm_on_body"),
@@ -17776,7 +17776,7 @@ var require_client_h1 = __commonJS({
17776
17776
  * @returns {number}
17777
17777
  */
17778
17778
  wasm_on_message_complete: /* @__PURE__ */ __name((p7) => {
17779
- assert59(currentParser.ptr === p7);
17779
+ assert60(currentParser.ptr === p7);
17780
17780
  return currentParser.onMessageComplete();
17781
17781
  }, "wasm_on_message_complete")
17782
17782
  }
@@ -17851,10 +17851,10 @@ var require_client_h1 = __commonJS({
17851
17851
  if (this.socket.destroyed || !this.paused) {
17852
17852
  return;
17853
17853
  }
17854
- assert59(this.ptr != null);
17855
- assert59(currentParser === null);
17854
+ assert60(this.ptr != null);
17855
+ assert60(currentParser === null);
17856
17856
  this.llhttp.llhttp_resume(this.ptr);
17857
- assert59(this.timeoutType === TIMEOUT_BODY);
17857
+ assert60(this.timeoutType === TIMEOUT_BODY);
17858
17858
  if (this.timeout) {
17859
17859
  if (this.timeout.refresh) {
17860
17860
  this.timeout.refresh();
@@ -17877,9 +17877,9 @@ var require_client_h1 = __commonJS({
17877
17877
  * @param {Buffer} chunk
17878
17878
  */
17879
17879
  execute(chunk) {
17880
- assert59(currentParser === null);
17881
- assert59(this.ptr != null);
17882
- assert59(!this.paused);
17880
+ assert60(currentParser === null);
17881
+ assert60(this.ptr != null);
17882
+ assert60(!this.paused);
17883
17883
  const { socket, llhttp } = this;
17884
17884
  if (chunk.length > currentBufferSize) {
17885
17885
  if (currentBufferPtr) {
@@ -17921,8 +17921,8 @@ var require_client_h1 = __commonJS({
17921
17921
  }
17922
17922
  }
17923
17923
  destroy() {
17924
- assert59(currentParser === null);
17925
- assert59(this.ptr != null);
17924
+ assert60(currentParser === null);
17925
+ assert60(this.ptr != null);
17926
17926
  this.llhttp.llhttp_free(this.ptr);
17927
17927
  this.ptr = null;
17928
17928
  this.timeout && timers.clearTimeout(this.timeout);
@@ -18008,14 +18008,14 @@ var require_client_h1 = __commonJS({
18008
18008
  */
18009
18009
  onUpgrade(head) {
18010
18010
  const { upgrade, client, socket, headers, statusCode } = this;
18011
- assert59(upgrade);
18012
- assert59(client[kSocket] === socket);
18013
- assert59(!socket.destroyed);
18014
- assert59(!this.paused);
18015
- assert59((headers.length & 1) === 0);
18011
+ assert60(upgrade);
18012
+ assert60(client[kSocket] === socket);
18013
+ assert60(!socket.destroyed);
18014
+ assert60(!this.paused);
18015
+ assert60((headers.length & 1) === 0);
18016
18016
  const request4 = client[kQueue][client[kRunningIdx]];
18017
- assert59(request4);
18018
- assert59(request4.upgrade || request4.method === "CONNECT");
18017
+ assert60(request4);
18018
+ assert60(request4.upgrade || request4.method === "CONNECT");
18019
18019
  this.statusCode = 0;
18020
18020
  this.statusText = "";
18021
18021
  this.shouldKeepAlive = false;
@@ -18053,8 +18053,8 @@ var require_client_h1 = __commonJS({
18053
18053
  if (!request4) {
18054
18054
  return -1;
18055
18055
  }
18056
- assert59(!this.upgrade);
18057
- assert59(this.statusCode < 200);
18056
+ assert60(!this.upgrade);
18057
+ assert60(this.statusCode < 200);
18058
18058
  if (statusCode === 100) {
18059
18059
  util3.destroy(socket, new SocketError("bad response", util3.getSocketInfo(socket)));
18060
18060
  return -1;
@@ -18063,7 +18063,7 @@ var require_client_h1 = __commonJS({
18063
18063
  util3.destroy(socket, new SocketError("bad upgrade", util3.getSocketInfo(socket)));
18064
18064
  return -1;
18065
18065
  }
18066
- assert59(this.timeoutType === TIMEOUT_HEADERS);
18066
+ assert60(this.timeoutType === TIMEOUT_HEADERS);
18067
18067
  this.statusCode = statusCode;
18068
18068
  this.shouldKeepAlive = shouldKeepAlive || // Override llhttp value which does not allow keepAlive for HEAD.
18069
18069
  request4.method === "HEAD" && !socket[kReset2] && this.connection.toLowerCase() === "keep-alive";
@@ -18076,16 +18076,16 @@ var require_client_h1 = __commonJS({
18076
18076
  }
18077
18077
  }
18078
18078
  if (request4.method === "CONNECT") {
18079
- assert59(client[kRunning] === 1);
18079
+ assert60(client[kRunning] === 1);
18080
18080
  this.upgrade = true;
18081
18081
  return 2;
18082
18082
  }
18083
18083
  if (upgrade) {
18084
- assert59(client[kRunning] === 1);
18084
+ assert60(client[kRunning] === 1);
18085
18085
  this.upgrade = true;
18086
18086
  return 2;
18087
18087
  }
18088
- assert59((this.headers.length & 1) === 0);
18088
+ assert60((this.headers.length & 1) === 0);
18089
18089
  this.headers = [];
18090
18090
  this.headersSize = 0;
18091
18091
  if (this.shouldKeepAlive && client[kPipelining]) {
@@ -18132,14 +18132,14 @@ var require_client_h1 = __commonJS({
18132
18132
  return -1;
18133
18133
  }
18134
18134
  const request4 = client[kQueue][client[kRunningIdx]];
18135
- assert59(request4);
18136
- assert59(this.timeoutType === TIMEOUT_BODY);
18135
+ assert60(request4);
18136
+ assert60(this.timeoutType === TIMEOUT_BODY);
18137
18137
  if (this.timeout) {
18138
18138
  if (this.timeout.refresh) {
18139
18139
  this.timeout.refresh();
18140
18140
  }
18141
18141
  }
18142
- assert59(statusCode >= 200);
18142
+ assert60(statusCode >= 200);
18143
18143
  if (maxResponseSize > -1 && this.bytesRead + buf.length > maxResponseSize) {
18144
18144
  util3.destroy(socket, new ResponseExceededMaxSizeError());
18145
18145
  return -1;
@@ -18161,10 +18161,10 @@ var require_client_h1 = __commonJS({
18161
18161
  if (upgrade) {
18162
18162
  return 0;
18163
18163
  }
18164
- assert59(statusCode >= 100);
18165
- assert59((this.headers.length & 1) === 0);
18164
+ assert60(statusCode >= 100);
18165
+ assert60((this.headers.length & 1) === 0);
18166
18166
  const request4 = client[kQueue][client[kRunningIdx]];
18167
- assert59(request4);
18167
+ assert60(request4);
18168
18168
  this.statusCode = 0;
18169
18169
  this.statusText = "";
18170
18170
  this.bytesRead = 0;
@@ -18183,7 +18183,7 @@ var require_client_h1 = __commonJS({
18183
18183
  request4.onComplete(headers);
18184
18184
  client[kQueue][client[kRunningIdx]++] = null;
18185
18185
  if (socket[kWriting]) {
18186
- assert59(client[kRunning] === 0);
18186
+ assert60(client[kRunning] === 0);
18187
18187
  util3.destroy(socket, new InformationalError("reset"));
18188
18188
  return constants4.ERROR.PAUSED;
18189
18189
  } else if (!shouldKeepAlive) {
@@ -18204,7 +18204,7 @@ var require_client_h1 = __commonJS({
18204
18204
  const { socket, timeoutType, client, paused } = parser2.deref();
18205
18205
  if (timeoutType === TIMEOUT_HEADERS) {
18206
18206
  if (!socket[kWriting] || socket.writableNeedDrain || client[kRunning] > 1) {
18207
- assert59(!paused, "cannot be paused while waiting for headers");
18207
+ assert60(!paused, "cannot be paused while waiting for headers");
18208
18208
  util3.destroy(socket, new HeadersTimeoutError());
18209
18209
  }
18210
18210
  } else if (timeoutType === TIMEOUT_BODY) {
@@ -18212,7 +18212,7 @@ var require_client_h1 = __commonJS({
18212
18212
  util3.destroy(socket, new BodyTimeoutError());
18213
18213
  }
18214
18214
  } else if (timeoutType === TIMEOUT_KEEP_ALIVE) {
18215
- assert59(client[kRunning] === 0 && client[kKeepAliveTimeoutValue]);
18215
+ assert60(client[kRunning] === 0 && client[kKeepAliveTimeoutValue]);
18216
18216
  util3.destroy(socket, new InformationalError("socket idle timeout"));
18217
18217
  }
18218
18218
  }
@@ -18291,7 +18291,7 @@ var require_client_h1 = __commonJS({
18291
18291
  }
18292
18292
  __name(connectH1, "connectH1");
18293
18293
  function onHttpSocketError(err) {
18294
- assert59(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
18294
+ assert60(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
18295
18295
  const parser2 = this[kParser];
18296
18296
  if (err.code === "ECONNRESET" && parser2.statusCode && !parser2.shouldKeepAlive) {
18297
18297
  parser2.onMessageComplete();
@@ -18328,7 +18328,7 @@ var require_client_h1 = __commonJS({
18328
18328
  client[kSocket] = null;
18329
18329
  client[kHTTPContext] = null;
18330
18330
  if (client.destroyed) {
18331
- assert59(client[kPending] === 0);
18331
+ assert60(client[kPending] === 0);
18332
18332
  const requests = client[kQueue].splice(client[kRunningIdx]);
18333
18333
  for (let i7 = 0; i7 < requests.length; i7++) {
18334
18334
  const request4 = requests[i7];
@@ -18340,7 +18340,7 @@ var require_client_h1 = __commonJS({
18340
18340
  util3.errorRequest(client, request4, err);
18341
18341
  }
18342
18342
  client[kPendingIdx] = client[kRunningIdx];
18343
- assert59(client[kRunning] === 0);
18343
+ assert60(client[kRunning] === 0);
18344
18344
  client.emit("disconnect", client[kUrl], [client], err);
18345
18345
  client[kResume]();
18346
18346
  }
@@ -18496,13 +18496,13 @@ upgrade: ${upgrade}\r
18496
18496
  } else if (util3.isIterable(body)) {
18497
18497
  writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload);
18498
18498
  } else {
18499
- assert59(false);
18499
+ assert60(false);
18500
18500
  }
18501
18501
  return true;
18502
18502
  }
18503
18503
  __name(writeH1, "writeH1");
18504
18504
  function writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload) {
18505
- assert59(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
18505
+ assert60(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
18506
18506
  let finished = false;
18507
18507
  const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header });
18508
18508
  const onData = /* @__PURE__ */ __name(function(chunk) {
@@ -18539,7 +18539,7 @@ upgrade: ${upgrade}\r
18539
18539
  return;
18540
18540
  }
18541
18541
  finished = true;
18542
- assert59(socket.destroyed || socket[kWriting] && client[kRunning] <= 1);
18542
+ assert60(socket.destroyed || socket[kWriting] && client[kRunning] <= 1);
18543
18543
  socket.off("drain", onDrain).off("error", onFinished);
18544
18544
  body.removeListener("data", onData).removeListener("end", onFinished).removeListener("close", onClose);
18545
18545
  if (!err) {
@@ -18579,12 +18579,12 @@ upgrade: ${upgrade}\r
18579
18579
  \r
18580
18580
  `, "latin1");
18581
18581
  } else {
18582
- assert59(contentLength === null, "no body must not have content length");
18582
+ assert60(contentLength === null, "no body must not have content length");
18583
18583
  socket.write(`${header}\r
18584
18584
  `, "latin1");
18585
18585
  }
18586
18586
  } else if (util3.isBuffer(body)) {
18587
- assert59(contentLength === body.byteLength, "buffer body must have content length");
18587
+ assert60(contentLength === body.byteLength, "buffer body must have content length");
18588
18588
  socket.cork();
18589
18589
  socket.write(`${header}content-length: ${contentLength}\r
18590
18590
  \r
@@ -18604,7 +18604,7 @@ upgrade: ${upgrade}\r
18604
18604
  }
18605
18605
  __name(writeBuffer, "writeBuffer");
18606
18606
  async function writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload) {
18607
- assert59(contentLength === body.size, "blob body must have content length");
18607
+ assert60(contentLength === body.size, "blob body must have content length");
18608
18608
  try {
18609
18609
  if (contentLength != null && contentLength !== body.size) {
18610
18610
  throw new RequestContentLengthMismatchError();
@@ -18628,7 +18628,7 @@ upgrade: ${upgrade}\r
18628
18628
  }
18629
18629
  __name(writeBlob, "writeBlob");
18630
18630
  async function writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload) {
18631
- assert59(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined");
18631
+ assert60(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined");
18632
18632
  let callback = null;
18633
18633
  function onDrain() {
18634
18634
  if (callback) {
@@ -18639,7 +18639,7 @@ upgrade: ${upgrade}\r
18639
18639
  }
18640
18640
  __name(onDrain, "onDrain");
18641
18641
  const waitForDrain = /* @__PURE__ */ __name(() => new Promise((resolve31, reject) => {
18642
- assert59(callback === null);
18642
+ assert60(callback === null);
18643
18643
  if (socket[kError]) {
18644
18644
  reject(socket[kError]);
18645
18645
  } else {
@@ -18792,7 +18792,7 @@ ${len.toString(16)}\r
18792
18792
  const { socket, client, abort } = this;
18793
18793
  socket[kWriting] = false;
18794
18794
  if (err) {
18795
- assert59(client[kRunning] <= 1, "pipeline should only contain this request");
18795
+ assert60(client[kRunning] <= 1, "pipeline should only contain this request");
18796
18796
  abort(err);
18797
18797
  }
18798
18798
  }
@@ -18805,7 +18805,7 @@ ${len.toString(16)}\r
18805
18805
  var require_client_h2 = __commonJS({
18806
18806
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/dispatcher/client-h2.js"(exports, module4) {
18807
18807
  init_import_meta_url();
18808
- var assert59 = __require("assert");
18808
+ var assert60 = __require("assert");
18809
18809
  var { pipeline } = __require("stream");
18810
18810
  var util3 = require_util();
18811
18811
  var {
@@ -18985,7 +18985,7 @@ var require_client_h2 = __commonJS({
18985
18985
  }
18986
18986
  __name(onHttp2RemoteSettings, "onHttp2RemoteSettings");
18987
18987
  function onHttp2SessionError(err) {
18988
- assert59(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
18988
+ assert60(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
18989
18989
  this[kSocket][kError] = err;
18990
18990
  this[kClient][kOnError](err);
18991
18991
  }
@@ -19018,7 +19018,7 @@ var require_client_h2 = __commonJS({
19018
19018
  util3.errorRequest(client, request4, err);
19019
19019
  client[kPendingIdx] = client[kRunningIdx];
19020
19020
  }
19021
- assert59(client[kRunning] === 0);
19021
+ assert60(client[kRunning] === 0);
19022
19022
  client.emit("disconnect", client[kUrl], [client], err);
19023
19023
  client.emit("connectionError", client[kUrl], [client], err);
19024
19024
  client[kResume]();
@@ -19031,7 +19031,7 @@ var require_client_h2 = __commonJS({
19031
19031
  client[kSocket] = null;
19032
19032
  client[kHTTPContext] = null;
19033
19033
  if (client.destroyed) {
19034
- assert59(client[kPending] === 0);
19034
+ assert60(client[kPending] === 0);
19035
19035
  const requests = client[kQueue].splice(client[kRunningIdx]);
19036
19036
  for (let i7 = 0; i7 < requests.length; i7++) {
19037
19037
  const request4 = requests[i7];
@@ -19049,13 +19049,13 @@ var require_client_h2 = __commonJS({
19049
19049
  this[kHTTP2Session].destroy(err);
19050
19050
  }
19051
19051
  client[kPendingIdx] = client[kRunningIdx];
19052
- assert59(client[kRunning] === 0);
19052
+ assert60(client[kRunning] === 0);
19053
19053
  client.emit("disconnect", client[kUrl], [client], err);
19054
19054
  client[kResume]();
19055
19055
  }
19056
19056
  __name(onHttp2SocketClose, "onHttp2SocketClose");
19057
19057
  function onHttp2SocketError(err) {
19058
- assert59(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
19058
+ assert60(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
19059
19059
  this[kError] = err;
19060
19060
  this[kClient][kOnError](err);
19061
19061
  }
@@ -19212,7 +19212,7 @@ var require_client_h2 = __commonJS({
19212
19212
  process.emitWarning(new RequestContentLengthMismatchError());
19213
19213
  }
19214
19214
  if (contentLength != null) {
19215
- assert59(body || contentLength === 0, "no body must not have content length");
19215
+ assert60(body || contentLength === 0, "no body must not have content length");
19216
19216
  headers[HTTP2_HEADER_CONTENT_LENGTH] = `${contentLength}`;
19217
19217
  }
19218
19218
  session.ref();
@@ -19379,7 +19379,7 @@ var require_client_h2 = __commonJS({
19379
19379
  expectsPayload
19380
19380
  );
19381
19381
  } else {
19382
- assert59(false);
19382
+ assert60(false);
19383
19383
  }
19384
19384
  }
19385
19385
  }
@@ -19387,7 +19387,7 @@ var require_client_h2 = __commonJS({
19387
19387
  function writeBuffer(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) {
19388
19388
  try {
19389
19389
  if (body != null && util3.isBuffer(body)) {
19390
- assert59(contentLength === body.byteLength, "buffer body must have content length");
19390
+ assert60(contentLength === body.byteLength, "buffer body must have content length");
19391
19391
  h2stream.cork();
19392
19392
  h2stream.write(body);
19393
19393
  h2stream.uncork();
@@ -19405,7 +19405,7 @@ var require_client_h2 = __commonJS({
19405
19405
  }
19406
19406
  __name(writeBuffer, "writeBuffer");
19407
19407
  function writeStream(abort, socket, expectsPayload, h2stream, body, client, request4, contentLength) {
19408
- assert59(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
19408
+ assert60(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
19409
19409
  const pipe = pipeline(
19410
19410
  body,
19411
19411
  h2stream,
@@ -19431,7 +19431,7 @@ var require_client_h2 = __commonJS({
19431
19431
  }
19432
19432
  __name(writeStream, "writeStream");
19433
19433
  async function writeBlob(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) {
19434
- assert59(contentLength === body.size, "blob body must have content length");
19434
+ assert60(contentLength === body.size, "blob body must have content length");
19435
19435
  try {
19436
19436
  if (contentLength != null && contentLength !== body.size) {
19437
19437
  throw new RequestContentLengthMismatchError();
@@ -19453,7 +19453,7 @@ var require_client_h2 = __commonJS({
19453
19453
  }
19454
19454
  __name(writeBlob, "writeBlob");
19455
19455
  async function writeIterable(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) {
19456
- assert59(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined");
19456
+ assert60(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined");
19457
19457
  let callback = null;
19458
19458
  function onDrain() {
19459
19459
  if (callback) {
@@ -19464,7 +19464,7 @@ var require_client_h2 = __commonJS({
19464
19464
  }
19465
19465
  __name(onDrain, "onDrain");
19466
19466
  const waitForDrain = /* @__PURE__ */ __name(() => new Promise((resolve31, reject) => {
19467
- assert59(callback === null);
19467
+ assert60(callback === null);
19468
19468
  if (socket[kError]) {
19469
19469
  reject(socket[kError]);
19470
19470
  } else {
@@ -19504,8 +19504,8 @@ var require_client_h2 = __commonJS({
19504
19504
  var require_client = __commonJS({
19505
19505
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/dispatcher/client.js"(exports, module4) {
19506
19506
  init_import_meta_url();
19507
- var assert59 = __require("assert");
19508
- var net2 = __require("net");
19507
+ var assert60 = __require("assert");
19508
+ var net3 = __require("net");
19509
19509
  var http6 = __require("http");
19510
19510
  var util3 = require_util();
19511
19511
  var { ClientStats } = require_stats();
@@ -19657,7 +19657,7 @@ var require_client = __commonJS({
19657
19657
  if (maxRequestsPerClient != null && (!Number.isInteger(maxRequestsPerClient) || maxRequestsPerClient < 0)) {
19658
19658
  throw new InvalidArgumentError("maxRequestsPerClient must be a positive number");
19659
19659
  }
19660
- if (localAddress != null && (typeof localAddress !== "string" || net2.isIP(localAddress) === 0)) {
19660
+ if (localAddress != null && (typeof localAddress !== "string" || net3.isIP(localAddress) === 0)) {
19661
19661
  throw new InvalidArgumentError("localAddress must be valid string IP address");
19662
19662
  }
19663
19663
  if (maxResponseSize != null && (!Number.isInteger(maxResponseSize) || maxResponseSize < -1)) {
@@ -19796,25 +19796,25 @@ var require_client = __commonJS({
19796
19796
  };
19797
19797
  function onError(client, err) {
19798
19798
  if (client[kRunning] === 0 && err.code !== "UND_ERR_INFO" && err.code !== "UND_ERR_SOCKET") {
19799
- assert59(client[kPendingIdx] === client[kRunningIdx]);
19799
+ assert60(client[kPendingIdx] === client[kRunningIdx]);
19800
19800
  const requests = client[kQueue].splice(client[kRunningIdx]);
19801
19801
  for (let i7 = 0; i7 < requests.length; i7++) {
19802
19802
  const request4 = requests[i7];
19803
19803
  util3.errorRequest(client, request4, err);
19804
19804
  }
19805
- assert59(client[kSize] === 0);
19805
+ assert60(client[kSize] === 0);
19806
19806
  }
19807
19807
  }
19808
19808
  __name(onError, "onError");
19809
19809
  function connect(client) {
19810
- assert59(!client[kConnecting]);
19811
- assert59(!client[kHTTPContext]);
19810
+ assert60(!client[kConnecting]);
19811
+ assert60(!client[kHTTPContext]);
19812
19812
  let { host, hostname: hostname2, protocol, port } = client[kUrl];
19813
19813
  if (hostname2[0] === "[") {
19814
19814
  const idx = hostname2.indexOf("]");
19815
- assert59(idx !== -1);
19815
+ assert60(idx !== -1);
19816
19816
  const ip = hostname2.substring(1, idx);
19817
- assert59(net2.isIPv6(ip));
19817
+ assert60(net3.isIPv6(ip));
19818
19818
  hostname2 = ip;
19819
19819
  }
19820
19820
  client[kConnecting] = true;
@@ -19850,7 +19850,7 @@ var require_client = __commonJS({
19850
19850
  client[kResume]();
19851
19851
  return;
19852
19852
  }
19853
- assert59(socket);
19853
+ assert60(socket);
19854
19854
  try {
19855
19855
  client[kHTTPContext] = socket.alpnProtocol === "h2" ? connectH2(client, socket) : connectH1(client, socket);
19856
19856
  } catch (err2) {
@@ -19905,7 +19905,7 @@ var require_client = __commonJS({
19905
19905
  });
19906
19906
  }
19907
19907
  if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") {
19908
- assert59(client[kRunning] === 0);
19908
+ assert60(client[kRunning] === 0);
19909
19909
  while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) {
19910
19910
  const request4 = client[kQueue][client[kPendingIdx]++];
19911
19911
  util3.errorRequest(client, request4, err);
@@ -19938,7 +19938,7 @@ var require_client = __commonJS({
19938
19938
  function _resume(client, sync) {
19939
19939
  while (true) {
19940
19940
  if (client.destroyed) {
19941
- assert59(client[kPending] === 0);
19941
+ assert60(client[kPending] === 0);
19942
19942
  return;
19943
19943
  }
19944
19944
  if (client[kClosedResolve] && !client[kSize]) {
@@ -21144,7 +21144,7 @@ var require_env_http_proxy_agent = __commonJS({
21144
21144
  var require_retry_handler = __commonJS({
21145
21145
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/handler/retry-handler.js"(exports, module4) {
21146
21146
  init_import_meta_url();
21147
- var assert59 = __require("assert");
21147
+ var assert60 = __require("assert");
21148
21148
  var { kRetryHandlerDefaultRetry } = require_symbols();
21149
21149
  var { RequestRetryError } = require_errors();
21150
21150
  var WrapHandler = require_wrap_handler();
@@ -21331,8 +21331,8 @@ var require_retry_handler = __commonJS({
21331
21331
  });
21332
21332
  }
21333
21333
  const { start, size, end = size ? size - 1 : null } = contentRange;
21334
- assert59(this.start === start, "content-range mismatch");
21335
- assert59(this.end == null || this.end === end, "content-range mismatch");
21334
+ assert60(this.start === start, "content-range mismatch");
21335
+ assert60(this.end == null || this.end === end, "content-range mismatch");
21336
21336
  return;
21337
21337
  }
21338
21338
  if (this.end == null) {
@@ -21349,11 +21349,11 @@ var require_retry_handler = __commonJS({
21349
21349
  return;
21350
21350
  }
21351
21351
  const { start, size, end = size ? size - 1 : null } = range;
21352
- assert59(
21352
+ assert60(
21353
21353
  start != null && Number.isFinite(start),
21354
21354
  "content-range mismatch"
21355
21355
  );
21356
- assert59(end != null && Number.isFinite(end), "invalid content-length");
21356
+ assert60(end != null && Number.isFinite(end), "invalid content-length");
21357
21357
  this.start = start;
21358
21358
  this.end = end;
21359
21359
  }
@@ -21361,8 +21361,8 @@ var require_retry_handler = __commonJS({
21361
21361
  const contentLength = headers["content-length"];
21362
21362
  this.end = contentLength != null ? Number(contentLength) - 1 : null;
21363
21363
  }
21364
- assert59(Number.isFinite(this.start));
21365
- assert59(
21364
+ assert60(Number.isFinite(this.start));
21365
+ assert60(
21366
21366
  this.end == null || Number.isFinite(this.end),
21367
21367
  "invalid content-length"
21368
21368
  );
@@ -21543,7 +21543,7 @@ var require_h2c_client = __commonJS({
21543
21543
  var require_readable = __commonJS({
21544
21544
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/api/readable.js"(exports, module4) {
21545
21545
  init_import_meta_url();
21546
- var assert59 = __require("assert");
21546
+ var assert60 = __require("assert");
21547
21547
  var { Readable: Readable11 } = __require("stream");
21548
21548
  var { RequestAbortedError, NotSupportedError, InvalidArgumentError, AbortError: AbortError2 } = require_errors();
21549
21549
  var util3 = require_util();
@@ -21740,7 +21740,7 @@ var require_readable = __commonJS({
21740
21740
  this[kBody] = ReadableStreamFrom(this);
21741
21741
  if (this[kConsume]) {
21742
21742
  this[kBody].getReader();
21743
- assert59(this[kBody].locked);
21743
+ assert60(this[kBody].locked);
21744
21744
  }
21745
21745
  }
21746
21746
  return this[kBody];
@@ -21811,7 +21811,7 @@ var require_readable = __commonJS({
21811
21811
  }
21812
21812
  __name(isUnusable, "isUnusable");
21813
21813
  function consume(stream2, type) {
21814
- assert59(!stream2[kConsume]);
21814
+ assert60(!stream2[kConsume]);
21815
21815
  return new Promise((resolve31, reject) => {
21816
21816
  if (isUnusable(stream2)) {
21817
21817
  const rState = stream2._readableState;
@@ -21957,7 +21957,7 @@ var require_readable = __commonJS({
21957
21957
  var require_api_request = __commonJS({
21958
21958
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/api/api-request.js"(exports, module4) {
21959
21959
  init_import_meta_url();
21960
- var assert59 = __require("assert");
21960
+ var assert60 = __require("assert");
21961
21961
  var { AsyncResource } = __require("async_hooks");
21962
21962
  var { Readable: Readable11 } = require_readable();
21963
21963
  var { InvalidArgumentError, RequestAbortedError } = require_errors();
@@ -22028,7 +22028,7 @@ var require_api_request = __commonJS({
22028
22028
  abort(this.reason);
22029
22029
  return;
22030
22030
  }
22031
- assert59(this.callback);
22031
+ assert60(this.callback);
22032
22032
  this.abort = abort;
22033
22033
  this.context = context2;
22034
22034
  }
@@ -22194,7 +22194,7 @@ var require_abort_signal = __commonJS({
22194
22194
  var require_api_stream = __commonJS({
22195
22195
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/api/api-stream.js"(exports, module4) {
22196
22196
  init_import_meta_url();
22197
- var assert59 = __require("assert");
22197
+ var assert60 = __require("assert");
22198
22198
  var { finished } = __require("stream");
22199
22199
  var { AsyncResource } = __require("async_hooks");
22200
22200
  var { InvalidArgumentError, InvalidReturnValueError } = require_errors();
@@ -22257,7 +22257,7 @@ var require_api_stream = __commonJS({
22257
22257
  abort(this.reason);
22258
22258
  return;
22259
22259
  }
22260
- assert59(this.callback);
22260
+ assert60(this.callback);
22261
22261
  this.abort = abort;
22262
22262
  this.context = context2;
22263
22263
  }
@@ -22365,7 +22365,7 @@ var require_api_pipeline = __commonJS({
22365
22365
  Duplex: Duplex2,
22366
22366
  PassThrough: PassThrough4
22367
22367
  } = __require("stream");
22368
- var assert59 = __require("assert");
22368
+ var assert60 = __require("assert");
22369
22369
  var { AsyncResource } = __require("async_hooks");
22370
22370
  var {
22371
22371
  InvalidArgumentError,
@@ -22489,7 +22489,7 @@ var require_api_pipeline = __commonJS({
22489
22489
  abort(this.reason);
22490
22490
  return;
22491
22491
  }
22492
- assert59(!res, "pipeline cannot be retried");
22492
+ assert60(!res, "pipeline cannot be retried");
22493
22493
  this.abort = abort;
22494
22494
  this.context = context2;
22495
22495
  }
@@ -22574,7 +22574,7 @@ var require_api_upgrade = __commonJS({
22574
22574
  init_import_meta_url();
22575
22575
  var { InvalidArgumentError, SocketError } = require_errors();
22576
22576
  var { AsyncResource } = __require("async_hooks");
22577
- var assert59 = __require("assert");
22577
+ var assert60 = __require("assert");
22578
22578
  var util3 = require_util();
22579
22579
  var { kHTTP2Stream } = require_symbols();
22580
22580
  var { addSignal, removeSignal } = require_abort_signal();
@@ -22606,7 +22606,7 @@ var require_api_upgrade = __commonJS({
22606
22606
  abort(this.reason);
22607
22607
  return;
22608
22608
  }
22609
- assert59(this.callback);
22609
+ assert60(this.callback);
22610
22610
  this.abort = abort;
22611
22611
  this.context = null;
22612
22612
  }
@@ -22614,7 +22614,7 @@ var require_api_upgrade = __commonJS({
22614
22614
  throw new SocketError("bad upgrade", null);
22615
22615
  }
22616
22616
  onUpgrade(statusCode, rawHeaders, socket) {
22617
- assert59(socket[kHTTP2Stream] === true ? statusCode === 200 : statusCode === 101);
22617
+ assert60(socket[kHTTP2Stream] === true ? statusCode === 200 : statusCode === 101);
22618
22618
  const { callback, opaque, context: context2 } = this;
22619
22619
  removeSignal(this);
22620
22620
  this.callback = null;
@@ -22670,7 +22670,7 @@ var require_api_upgrade = __commonJS({
22670
22670
  var require_api_connect = __commonJS({
22671
22671
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/api/api-connect.js"(exports, module4) {
22672
22672
  init_import_meta_url();
22673
- var assert59 = __require("assert");
22673
+ var assert60 = __require("assert");
22674
22674
  var { AsyncResource } = __require("async_hooks");
22675
22675
  var { InvalidArgumentError, SocketError } = require_errors();
22676
22676
  var util3 = require_util();
@@ -22702,7 +22702,7 @@ var require_api_connect = __commonJS({
22702
22702
  abort(this.reason);
22703
22703
  return;
22704
22704
  }
22705
- assert59(this.callback);
22705
+ assert60(this.callback);
22706
22706
  this.abort = abort;
22707
22707
  this.context = context2;
22708
22708
  }
@@ -24757,7 +24757,7 @@ var require_global2 = __commonJS({
24757
24757
  var require_decorator_handler = __commonJS({
24758
24758
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/handler/decorator-handler.js"(exports, module4) {
24759
24759
  init_import_meta_url();
24760
- var assert59 = __require("assert");
24760
+ var assert60 = __require("assert");
24761
24761
  var WrapHandler = require_wrap_handler();
24762
24762
  module4.exports = class DecoratorHandler {
24763
24763
  static {
@@ -24777,25 +24777,25 @@ var require_decorator_handler = __commonJS({
24777
24777
  this.#handler.onRequestStart?.(...args);
24778
24778
  }
24779
24779
  onRequestUpgrade(...args) {
24780
- assert59(!this.#onCompleteCalled);
24781
- assert59(!this.#onErrorCalled);
24780
+ assert60(!this.#onCompleteCalled);
24781
+ assert60(!this.#onErrorCalled);
24782
24782
  return this.#handler.onRequestUpgrade?.(...args);
24783
24783
  }
24784
24784
  onResponseStart(...args) {
24785
- assert59(!this.#onCompleteCalled);
24786
- assert59(!this.#onErrorCalled);
24787
- assert59(!this.#onResponseStartCalled);
24785
+ assert60(!this.#onCompleteCalled);
24786
+ assert60(!this.#onErrorCalled);
24787
+ assert60(!this.#onResponseStartCalled);
24788
24788
  this.#onResponseStartCalled = true;
24789
24789
  return this.#handler.onResponseStart?.(...args);
24790
24790
  }
24791
24791
  onResponseData(...args) {
24792
- assert59(!this.#onCompleteCalled);
24793
- assert59(!this.#onErrorCalled);
24792
+ assert60(!this.#onCompleteCalled);
24793
+ assert60(!this.#onErrorCalled);
24794
24794
  return this.#handler.onResponseData?.(...args);
24795
24795
  }
24796
24796
  onResponseEnd(...args) {
24797
- assert59(!this.#onCompleteCalled);
24798
- assert59(!this.#onErrorCalled);
24797
+ assert60(!this.#onCompleteCalled);
24798
+ assert60(!this.#onErrorCalled);
24799
24799
  this.#onCompleteCalled = true;
24800
24800
  return this.#handler.onResponseEnd?.(...args);
24801
24801
  }
@@ -24818,7 +24818,7 @@ var require_redirect_handler = __commonJS({
24818
24818
  init_import_meta_url();
24819
24819
  var util3 = require_util();
24820
24820
  var { kBodyUsed } = require_symbols();
24821
- var assert59 = __require("assert");
24821
+ var assert60 = __require("assert");
24822
24822
  var { InvalidArgumentError } = require_errors();
24823
24823
  var EE = __require("events");
24824
24824
  var redirectableStatusCodes = [300, 301, 302, 303, 307, 308];
@@ -24834,7 +24834,7 @@ var require_redirect_handler = __commonJS({
24834
24834
  this[kBodyUsed] = false;
24835
24835
  }
24836
24836
  async *[Symbol.asyncIterator]() {
24837
- assert59(!this[kBodyUsed], "disturbed");
24837
+ assert60(!this[kBodyUsed], "disturbed");
24838
24838
  this[kBodyUsed] = true;
24839
24839
  yield* this[kBody];
24840
24840
  }
@@ -24864,7 +24864,7 @@ var require_redirect_handler = __commonJS({
24864
24864
  if (util3.isStream(this.opts.body)) {
24865
24865
  if (util3.bodyLength(this.opts.body) === 0) {
24866
24866
  this.opts.body.on("data", function() {
24867
- assert59(false);
24867
+ assert60(false);
24868
24868
  });
24869
24869
  }
24870
24870
  if (typeof this.opts.body.readableDidRead !== "boolean") {
@@ -24970,7 +24970,7 @@ var require_redirect_handler = __commonJS({
24970
24970
  }
24971
24971
  }
24972
24972
  } else {
24973
- assert59(headers == null, "headers must be an object or an array");
24973
+ assert60(headers == null, "headers must be an object or an array");
24974
24974
  }
24975
24975
  return ret;
24976
24976
  }
@@ -26890,7 +26890,7 @@ var require_memory_cache_store = __commonJS({
26890
26890
  var require_cache_revalidation_handler = __commonJS({
26891
26891
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/handler/cache-revalidation-handler.js"(exports, module4) {
26892
26892
  init_import_meta_url();
26893
- var assert59 = __require("assert");
26893
+ var assert60 = __require("assert");
26894
26894
  var CacheRevalidationHandler = class {
26895
26895
  static {
26896
26896
  __name(this, "CacheRevalidationHandler");
@@ -26930,7 +26930,7 @@ var require_cache_revalidation_handler = __commonJS({
26930
26930
  this.#handler.onRequestUpgrade?.(controller, statusCode, headers, socket);
26931
26931
  }
26932
26932
  onResponseStart(controller, statusCode, headers, statusMessage) {
26933
- assert59(this.#callback != null);
26933
+ assert60(this.#callback != null);
26934
26934
  this.#successful = statusCode === 304 || this.#allowErrorStatusCodes && statusCode >= 500 && statusCode <= 504;
26935
26935
  this.#callback(this.#successful, this.#context);
26936
26936
  this.#callback = null;
@@ -26980,7 +26980,7 @@ var require_cache_revalidation_handler = __commonJS({
26980
26980
  var require_cache2 = __commonJS({
26981
26981
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/interceptor/cache.js"(exports, module4) {
26982
26982
  init_import_meta_url();
26983
- var assert59 = __require("assert");
26983
+ var assert60 = __require("assert");
26984
26984
  var { Readable: Readable11 } = __require("stream");
26985
26985
  var util3 = require_util();
26986
26986
  var CacheHandler = require_cache_handler();
@@ -27063,8 +27063,8 @@ var require_cache2 = __commonJS({
27063
27063
  __name(handleUncachedResponse, "handleUncachedResponse");
27064
27064
  function sendCachedValue(handler, opts, result, age, context2, isStale2) {
27065
27065
  const stream2 = util3.isStream(result.body) ? result.body : Readable11.from(result.body ?? []);
27066
- assert59(!stream2.destroyed, "stream should not be destroyed");
27067
- assert59(!stream2.readableDidRead, "stream should not be readableDidRead");
27066
+ assert60(!stream2.destroyed, "stream should not be destroyed");
27067
+ assert60(!stream2.readableDidRead, "stream should not be readableDidRead");
27068
27068
  const controller = {
27069
27069
  resume() {
27070
27070
  stream2.resume();
@@ -28157,7 +28157,7 @@ var require_headers = __commonJS({
28157
28157
  isValidHeaderValue
28158
28158
  } = require_util2();
28159
28159
  var { webidl } = require_webidl();
28160
- var assert59 = __require("assert");
28160
+ var assert60 = __require("assert");
28161
28161
  var util3 = __require("util");
28162
28162
  function isHTTPWhiteSpaceCharCode(code) {
28163
28163
  return code === 10 || code === 13 || code === 9 || code === 32;
@@ -28382,11 +28382,11 @@ var require_headers = __commonJS({
28382
28382
  const iterator = this.headersMap[Symbol.iterator]();
28383
28383
  const firstValue = iterator.next().value;
28384
28384
  array[0] = [firstValue[0], firstValue[1].value];
28385
- assert59(firstValue[1].value !== null);
28385
+ assert60(firstValue[1].value !== null);
28386
28386
  for (let i7 = 1, j7 = 0, right2 = 0, left2 = 0, pivot = 0, x7, value; i7 < size; ++i7) {
28387
28387
  value = iterator.next().value;
28388
28388
  x7 = array[i7] = [value[0], value[1].value];
28389
- assert59(x7[1] !== null);
28389
+ assert60(x7[1] !== null);
28390
28390
  left2 = 0;
28391
28391
  right2 = i7;
28392
28392
  while (left2 < right2) {
@@ -28413,7 +28413,7 @@ var require_headers = __commonJS({
28413
28413
  let i7 = 0;
28414
28414
  for (const { 0: name2, 1: { value } } of this.headersMap) {
28415
28415
  array[i7++] = [name2, value];
28416
- assert59(value !== null);
28416
+ assert60(value !== null);
28417
28417
  }
28418
28418
  return array.sort(compareHeaderName);
28419
28419
  }
@@ -28641,7 +28641,7 @@ var require_response = __commonJS({
28641
28641
  var { webidl } = require_webidl();
28642
28642
  var { URLSerializer } = require_data_url();
28643
28643
  var { kConstruct } = require_symbols();
28644
- var assert59 = __require("assert");
28644
+ var assert60 = __require("assert");
28645
28645
  var { isomorphicEncode, serializeJavascriptValueToJSONString } = require_infra();
28646
28646
  var textEncoder = new TextEncoder("utf-8");
28647
28647
  var Response11 = class _Response {
@@ -28905,7 +28905,7 @@ var require_response = __commonJS({
28905
28905
  return p7 in state2 ? state2[p7] : target[p7];
28906
28906
  },
28907
28907
  set(target, p7, value) {
28908
- assert59(!(p7 in state2));
28908
+ assert60(!(p7 in state2));
28909
28909
  target[p7] = value;
28910
28910
  return true;
28911
28911
  }
@@ -28940,12 +28940,12 @@ var require_response = __commonJS({
28940
28940
  body: null
28941
28941
  });
28942
28942
  } else {
28943
- assert59(false);
28943
+ assert60(false);
28944
28944
  }
28945
28945
  }
28946
28946
  __name(filterResponse, "filterResponse");
28947
28947
  function makeAppropriateNetworkError(fetchParams, err = null) {
28948
- assert59(isCancelled(fetchParams));
28948
+ assert60(isCancelled(fetchParams));
28949
28949
  return isAborted2(fetchParams) ? makeNetworkError(Object.assign(new DOMException("The operation was aborted.", "AbortError"), { cause: err })) : makeNetworkError(Object.assign(new DOMException("Request was cancelled."), { cause: err }));
28950
28950
  }
28951
28951
  __name(makeAppropriateNetworkError, "makeAppropriateNetworkError");
@@ -29079,7 +29079,7 @@ var require_request2 = __commonJS({
29079
29079
  var { webidl } = require_webidl();
29080
29080
  var { URLSerializer } = require_data_url();
29081
29081
  var { kConstruct } = require_symbols();
29082
- var assert59 = __require("assert");
29082
+ var assert60 = __require("assert");
29083
29083
  var { getMaxListeners, setMaxListeners, defaultMaxListeners } = __require("events");
29084
29084
  var kAbortController = Symbol("abortController");
29085
29085
  var requestFinalizer = new FinalizationRegistry(({ signal, abort }) => {
@@ -29159,7 +29159,7 @@ var require_request2 = __commonJS({
29159
29159
  request4 = makeRequest({ urlList: [parsedURL] });
29160
29160
  fallbackMode = "cors";
29161
29161
  } else {
29162
- assert59(webidl.is.Request(input));
29162
+ assert60(webidl.is.Request(input));
29163
29163
  request4 = input.#state;
29164
29164
  signal = input.#signal;
29165
29165
  this.#dispatcher = init4.dispatcher || input.#dispatcher;
@@ -29817,7 +29817,7 @@ var require_request2 = __commonJS({
29817
29817
  var require_subresource_integrity = __commonJS({
29818
29818
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js"(exports, module4) {
29819
29819
  init_import_meta_url();
29820
- var assert59 = __require("assert");
29820
+ var assert60 = __require("assert");
29821
29821
  var { runtimeFeatures } = require_runtime_features();
29822
29822
  var validSRIHashAlgorithmTokenSet = /* @__PURE__ */ new Map([["sha256", 0], ["sha384", 1], ["sha512", 2]]);
29823
29823
  var crypto9;
@@ -29865,7 +29865,7 @@ var require_subresource_integrity = __commonJS({
29865
29865
  const result = [];
29866
29866
  let strongest = null;
29867
29867
  for (const item of metadataList) {
29868
- assert59(isValidSRIHashAlgorithm(item.alg), "Invalid SRI hash algorithm token");
29868
+ assert60(isValidSRIHashAlgorithm(item.alg), "Invalid SRI hash algorithm token");
29869
29869
  if (result.length === 0) {
29870
29870
  result.push(item);
29871
29871
  strongest = item;
@@ -30001,7 +30001,7 @@ var require_fetch = __commonJS({
30001
30001
  createInflate,
30002
30002
  extractMimeType
30003
30003
  } = require_util2();
30004
- var assert59 = __require("assert");
30004
+ var assert60 = __require("assert");
30005
30005
  var { safelyExtractBody, extractBody } = require_body();
30006
30006
  var {
30007
30007
  redirectStatusSet,
@@ -30088,7 +30088,7 @@ var require_fetch = __commonJS({
30088
30088
  requestObject.signal,
30089
30089
  () => {
30090
30090
  locallyAborted = true;
30091
- assert59(controller != null);
30091
+ assert60(controller != null);
30092
30092
  controller.abort(requestObject.signal.reason);
30093
30093
  const realResponse = responseObject?.deref();
30094
30094
  abortFetch(p7, request4, realResponse, requestObject.signal.reason);
@@ -30194,7 +30194,7 @@ var require_fetch = __commonJS({
30194
30194
  dispatcher = getGlobalDispatcher2()
30195
30195
  // undici
30196
30196
  }) {
30197
- assert59(dispatcher);
30197
+ assert60(dispatcher);
30198
30198
  let taskDestination = null;
30199
30199
  let crossOriginIsolatedCapability = false;
30200
30200
  if (request4.client != null) {
@@ -30217,7 +30217,7 @@ var require_fetch = __commonJS({
30217
30217
  taskDestination,
30218
30218
  crossOriginIsolatedCapability
30219
30219
  };
30220
- assert59(!request4.body || request4.body.stream);
30220
+ assert60(!request4.body || request4.body.stream);
30221
30221
  if (request4.window === "client") {
30222
30222
  request4.window = request4.client?.globalObject?.constructor?.name === "Window" ? request4.client : "no-window";
30223
30223
  }
@@ -30305,7 +30305,7 @@ var require_fetch = __commonJS({
30305
30305
  } else if (request4.responseTainting === "opaque") {
30306
30306
  response = filterResponse(response, "opaque");
30307
30307
  } else {
30308
- assert59(false);
30308
+ assert60(false);
30309
30309
  }
30310
30310
  }
30311
30311
  let internalResponse = response.status === 0 ? response : response.internalResponse;
@@ -30538,7 +30538,7 @@ var require_fetch = __commonJS({
30538
30538
  } else if (request4.redirect === "follow") {
30539
30539
  response = await httpRedirectFetch(fetchParams, response);
30540
30540
  } else {
30541
- assert59(false);
30541
+ assert60(false);
30542
30542
  }
30543
30543
  }
30544
30544
  response.timingInfo = timingInfo;
@@ -30592,7 +30592,7 @@ var require_fetch = __commonJS({
30592
30592
  request4.headersList.delete("host", true);
30593
30593
  }
30594
30594
  if (request4.body != null) {
30595
- assert59(request4.body.source != null);
30595
+ assert60(request4.body.source != null);
30596
30596
  request4.body = safelyExtractBody(request4.body.source)[0];
30597
30597
  }
30598
30598
  const timingInfo = fetchParams.timingInfo;
@@ -30716,7 +30716,7 @@ var require_fetch = __commonJS({
30716
30716
  }
30717
30717
  __name(httpNetworkOrCacheFetch, "httpNetworkOrCacheFetch");
30718
30718
  async function httpNetworkFetch(fetchParams, includeCredentials = false, forceNewConnection = false) {
30719
- assert59(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed);
30719
+ assert60(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed);
30720
30720
  fetchParams.controller.connection = {
30721
30721
  abort: null,
30722
30722
  destroyed: false,
@@ -31026,7 +31026,7 @@ var require_fetch = __commonJS({
31026
31026
  var require_util3 = __commonJS({
31027
31027
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/web/cache/util.js"(exports, module4) {
31028
31028
  init_import_meta_url();
31029
- var assert59 = __require("assert");
31029
+ var assert60 = __require("assert");
31030
31030
  var { URLSerializer } = require_data_url();
31031
31031
  var { isValidHeaderName } = require_util2();
31032
31032
  function urlEquals(A4, B4, excludeFragment = false) {
@@ -31036,7 +31036,7 @@ var require_util3 = __commonJS({
31036
31036
  }
31037
31037
  __name(urlEquals, "urlEquals");
31038
31038
  function getFieldValues(header) {
31039
- assert59(header !== null);
31039
+ assert60(header !== null);
31040
31040
  const values = [];
31041
31041
  for (let value of header.split(",")) {
31042
31042
  value = value.trim();
@@ -31058,7 +31058,7 @@ var require_util3 = __commonJS({
31058
31058
  var require_cache3 = __commonJS({
31059
31059
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/web/cache/cache.js"(exports, module4) {
31060
31060
  init_import_meta_url();
31061
- var assert59 = __require("assert");
31061
+ var assert60 = __require("assert");
31062
31062
  var { kConstruct } = require_symbols();
31063
31063
  var { urlEquals, getFieldValues } = require_util3();
31064
31064
  var { kEnumerableProperty, isDisturbed } = require_util();
@@ -31311,7 +31311,7 @@ var require_cache3 = __commonJS({
31311
31311
  return false;
31312
31312
  }
31313
31313
  } else {
31314
- assert59(typeof request4 === "string");
31314
+ assert60(typeof request4 === "string");
31315
31315
  r9 = getRequestState(new Request7(request4));
31316
31316
  }
31317
31317
  const operations = [];
@@ -31422,7 +31422,7 @@ var require_cache3 = __commonJS({
31422
31422
  }
31423
31423
  for (const requestResponse of requestResponses) {
31424
31424
  const idx = cache6.indexOf(requestResponse);
31425
- assert59(idx !== -1);
31425
+ assert60(idx !== -1);
31426
31426
  cache6.splice(idx, 1);
31427
31427
  }
31428
31428
  } else if (operation.type === "put") {
@@ -31454,7 +31454,7 @@ var require_cache3 = __commonJS({
31454
31454
  requestResponses = this.#queryCache(operation.request);
31455
31455
  for (const requestResponse of requestResponses) {
31456
31456
  const idx = cache6.indexOf(requestResponse);
31457
- assert59(idx !== -1);
31457
+ assert60(idx !== -1);
31458
31458
  cache6.splice(idx, 1);
31459
31459
  }
31460
31460
  cache6.push([operation.request, operation.response]);
@@ -31917,7 +31917,7 @@ var require_parse = __commonJS({
31917
31917
  var { collectASequenceOfCodePointsFast } = require_infra();
31918
31918
  var { maxNameValuePairSize, maxAttributeValueSize } = require_constants4();
31919
31919
  var { isCTLExcludingHtab } = require_util4();
31920
- var assert59 = __require("assert");
31920
+ var assert60 = __require("assert");
31921
31921
  var { unescape: qsUnescape } = __require("querystring");
31922
31922
  function parseSetCookie(header) {
31923
31923
  if (isCTLExcludingHtab(header)) {
@@ -31961,7 +31961,7 @@ var require_parse = __commonJS({
31961
31961
  if (unparsedAttributes.length === 0) {
31962
31962
  return cookieAttributeList;
31963
31963
  }
31964
- assert59(unparsedAttributes[0] === ";");
31964
+ assert60(unparsedAttributes[0] === ";");
31965
31965
  unparsedAttributes = unparsedAttributes.slice(1);
31966
31966
  let cookieAv = "";
31967
31967
  if (unparsedAttributes.includes(";")) {
@@ -32836,7 +32836,7 @@ var require_connection = __commonJS({
32836
32836
  var { Headers: Headers5, getHeadersList } = require_headers();
32837
32837
  var { getDecodeSplit } = require_util2();
32838
32838
  var { WebsocketFrameSend } = require_frame();
32839
- var assert59 = __require("assert");
32839
+ var assert60 = __require("assert");
32840
32840
  var { runtimeFeatures } = require_runtime_features();
32841
32841
  var crypto9 = runtimeFeatures.has("crypto") ? __require("crypto") : null;
32842
32842
  var warningEmitted2 = false;
@@ -32941,7 +32941,7 @@ var require_connection = __commonJS({
32941
32941
  if (reason.length !== 0 && code === null) {
32942
32942
  code = 1e3;
32943
32943
  }
32944
- assert59(code === null || Number.isInteger(code));
32944
+ assert60(code === null || Number.isInteger(code));
32945
32945
  if (code === null && reason.length === 0) {
32946
32946
  frame.frameData = emptyBuffer;
32947
32947
  } else if (code !== null && reason === null) {
@@ -33045,7 +33045,7 @@ var require_receiver = __commonJS({
33045
33045
  "../../node_modules/.pnpm/undici@7.18.2/node_modules/undici/lib/web/websocket/receiver.js"(exports, module4) {
33046
33046
  init_import_meta_url();
33047
33047
  var { Writable: Writable5 } = __require("stream");
33048
- var assert59 = __require("assert");
33048
+ var assert60 = __require("assert");
33049
33049
  var { parserStates, opcodes, states, emptyBuffer, sentCloseFrameState } = require_constants5();
33050
33050
  var {
33051
33051
  isValidStatusCode,
@@ -33285,7 +33285,7 @@ var require_receiver = __commonJS({
33285
33285
  return output;
33286
33286
  }
33287
33287
  parseCloseBody(data) {
33288
- assert59(data.length !== 1);
33288
+ assert60(data.length !== 1);
33289
33289
  let code;
33290
33290
  if (data.length >= 2) {
33291
33291
  code = data.readUInt16BE(0);
@@ -35768,6 +35768,345 @@ var init_OpenAPI = __esm({
35768
35768
  }
35769
35769
  });
35770
35770
 
35771
+ // ../containers-shared/src/client/core/request.ts
35772
+ var isDefined, isString2, isStringWithValue, isBlob, base64, getQueryString, getUrl, getFormData, resolve6, getHeaders, getRequestBody, isResponseSchemaV4, parseResponseSchemaV4, sendRequest, getResponseHeader, getResponseBody, catchErrorCodes, executeRequest, buildApiResult, request, requestPaginated, debugLogRequest, debugLogResponse;
35773
+ var init_request = __esm({
35774
+ "../containers-shared/src/client/core/request.ts"() {
35775
+ init_import_meta_url();
35776
+ init_ApiError();
35777
+ init_CancelablePromise();
35778
+ isDefined = /* @__PURE__ */ __name((value) => {
35779
+ return value !== void 0 && value !== null;
35780
+ }, "isDefined");
35781
+ isString2 = /* @__PURE__ */ __name((value) => {
35782
+ return typeof value === "string";
35783
+ }, "isString");
35784
+ isStringWithValue = /* @__PURE__ */ __name((value) => {
35785
+ return isString2(value) && value !== "";
35786
+ }, "isStringWithValue");
35787
+ isBlob = /* @__PURE__ */ __name((value) => {
35788
+ return typeof value === "object" && typeof value.type === "string" && typeof value.stream === "function" && typeof value.arrayBuffer === "function" && typeof value.constructor === "function" && typeof value.constructor.name === "string" && /^(Blob|File)$/.test(value.constructor.name) && /^(Blob|File)$/.test(value[Symbol.toStringTag]);
35789
+ }, "isBlob");
35790
+ base64 = /* @__PURE__ */ __name((str) => {
35791
+ try {
35792
+ return btoa(str);
35793
+ } catch (err) {
35794
+ return Buffer.from(str).toString("base64");
35795
+ }
35796
+ }, "base64");
35797
+ getQueryString = /* @__PURE__ */ __name((params) => {
35798
+ const qs = [];
35799
+ const append = /* @__PURE__ */ __name((key, value) => {
35800
+ qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
35801
+ }, "append");
35802
+ const process12 = /* @__PURE__ */ __name((key, value) => {
35803
+ if (isDefined(value)) {
35804
+ if (Array.isArray(value)) {
35805
+ value.forEach((v8) => {
35806
+ process12(key, v8);
35807
+ });
35808
+ } else if (typeof value === "object") {
35809
+ Object.entries(value).forEach(([k7, v8]) => {
35810
+ process12(`${key}[${k7}]`, v8);
35811
+ });
35812
+ } else {
35813
+ append(key, value);
35814
+ }
35815
+ }
35816
+ }, "process");
35817
+ Object.entries(params).forEach(([key, value]) => {
35818
+ process12(key, value);
35819
+ });
35820
+ if (qs.length > 0) {
35821
+ return `?${qs.join("&")}`;
35822
+ }
35823
+ return "";
35824
+ }, "getQueryString");
35825
+ getUrl = /* @__PURE__ */ __name((config, options) => {
35826
+ const encoder = config.ENCODE_PATH || encodeURI;
35827
+ const path82 = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring2, group) => {
35828
+ if (options.path?.hasOwnProperty(group)) {
35829
+ return encoder(String(options.path[group]));
35830
+ }
35831
+ return substring2;
35832
+ });
35833
+ const url4 = `${config.BASE}${path82}`;
35834
+ if (options.query) {
35835
+ return `${url4}${getQueryString(options.query)}`;
35836
+ }
35837
+ return url4;
35838
+ }, "getUrl");
35839
+ getFormData = /* @__PURE__ */ __name((options) => {
35840
+ if (options.formData) {
35841
+ const formData = new FormData();
35842
+ const process12 = /* @__PURE__ */ __name(async (key, value) => {
35843
+ if (isString2(value)) {
35844
+ formData.append(key, value);
35845
+ } else {
35846
+ formData.append(key, JSON.stringify(value));
35847
+ }
35848
+ }, "process");
35849
+ Object.entries(options.formData).filter(([_5, value]) => isDefined(value)).forEach(([key, value]) => {
35850
+ if (Array.isArray(value)) {
35851
+ value.forEach((v8) => process12(key, v8));
35852
+ } else {
35853
+ process12(key, value);
35854
+ }
35855
+ });
35856
+ return formData;
35857
+ }
35858
+ return void 0;
35859
+ }, "getFormData");
35860
+ resolve6 = /* @__PURE__ */ __name(async (options, resolver) => {
35861
+ if (typeof resolver === "function") {
35862
+ return resolver(options);
35863
+ }
35864
+ return resolver;
35865
+ }, "resolve");
35866
+ getHeaders = /* @__PURE__ */ __name(async (config, options) => {
35867
+ const token = await resolve6(options, config.TOKEN);
35868
+ const username = await resolve6(options, config.USERNAME);
35869
+ const password = await resolve6(options, config.PASSWORD);
35870
+ const additionalHeaders = await resolve6(options, config.HEADERS);
35871
+ const headers = Object.entries({
35872
+ Accept: "application/json",
35873
+ ...additionalHeaders,
35874
+ ...options.headers
35875
+ }).filter(([_5, value]) => isDefined(value)).reduce(
35876
+ (headers2, [key, value]) => ({
35877
+ ...headers2,
35878
+ [key]: String(value)
35879
+ }),
35880
+ {}
35881
+ );
35882
+ if (isStringWithValue(token)) {
35883
+ headers["Authorization"] = `Bearer ${token}`;
35884
+ }
35885
+ if (isStringWithValue(username) && isStringWithValue(password)) {
35886
+ const credentials = base64(`${username}:${password}`);
35887
+ headers["Authorization"] = `Basic ${credentials}`;
35888
+ }
35889
+ if (options.body) {
35890
+ if (options.mediaType) {
35891
+ headers["Content-Type"] = options.mediaType;
35892
+ } else if (isBlob(options.body)) {
35893
+ headers["Content-Type"] = options.body.type || "application/octet-stream";
35894
+ } else if (isString2(options.body)) {
35895
+ headers["Content-Type"] = "text/plain";
35896
+ } else {
35897
+ headers["Content-Type"] = "application/json";
35898
+ }
35899
+ }
35900
+ return new Headers(headers);
35901
+ }, "getHeaders");
35902
+ getRequestBody = /* @__PURE__ */ __name((options) => {
35903
+ if (options.body !== void 0) {
35904
+ if (options.mediaType?.includes("/json")) {
35905
+ return JSON.stringify(options.body);
35906
+ } else if (isString2(options.body) || isBlob(options.body)) {
35907
+ return options.body;
35908
+ } else {
35909
+ return JSON.stringify(options.body);
35910
+ }
35911
+ }
35912
+ return void 0;
35913
+ }, "getRequestBody");
35914
+ isResponseSchemaV4 = /* @__PURE__ */ __name((config, _options) => {
35915
+ return config.BASE.endsWith("/containers");
35916
+ }, "isResponseSchemaV4");
35917
+ parseResponseSchemaV4 = /* @__PURE__ */ __name((url4, response, responseHeader, responseBody) => {
35918
+ const fetchResult2 = typeof responseBody === "object" ? responseBody : JSON.parse(responseBody);
35919
+ const ok = response.ok && fetchResult2.success;
35920
+ let result;
35921
+ if (ok) {
35922
+ if (fetchResult2.result !== void 0) {
35923
+ result = fetchResult2.result;
35924
+ } else {
35925
+ result = {};
35926
+ }
35927
+ } else {
35928
+ result = { error: fetchResult2.errors?.[0]?.message };
35929
+ }
35930
+ return {
35931
+ url: url4,
35932
+ ok,
35933
+ status: response.status,
35934
+ statusText: response.statusText,
35935
+ body: responseHeader ?? result
35936
+ };
35937
+ }, "parseResponseSchemaV4");
35938
+ sendRequest = /* @__PURE__ */ __name(async (config, options, url4, body, formData, headers, onCancel) => {
35939
+ const controller = new AbortController();
35940
+ const request4 = {
35941
+ headers,
35942
+ body: body ?? formData,
35943
+ method: options.method,
35944
+ signal: controller.signal
35945
+ };
35946
+ if (config.WITH_CREDENTIALS) {
35947
+ request4.credentials = config.CREDENTIALS;
35948
+ }
35949
+ onCancel(() => controller.abort());
35950
+ return await fetch(url4, request4);
35951
+ }, "sendRequest");
35952
+ getResponseHeader = /* @__PURE__ */ __name((response, responseHeader) => {
35953
+ if (responseHeader) {
35954
+ const content = response.headers.get(responseHeader);
35955
+ if (isString2(content)) {
35956
+ return content;
35957
+ }
35958
+ }
35959
+ return void 0;
35960
+ }, "getResponseHeader");
35961
+ getResponseBody = /* @__PURE__ */ __name(async (response) => {
35962
+ if (response.status !== 204) {
35963
+ try {
35964
+ const contentType = response.headers.get("Content-Type");
35965
+ if (contentType) {
35966
+ const jsonTypes = ["application/json", "application/problem+json"];
35967
+ const isJSON = jsonTypes.some(
35968
+ (type) => contentType.toLowerCase().startsWith(type)
35969
+ );
35970
+ if (isJSON) {
35971
+ return await response.json();
35972
+ } else {
35973
+ return await response.text();
35974
+ }
35975
+ }
35976
+ } catch (error2) {
35977
+ console.error(error2);
35978
+ }
35979
+ }
35980
+ return void 0;
35981
+ }, "getResponseBody");
35982
+ catchErrorCodes = /* @__PURE__ */ __name((options, result) => {
35983
+ const errors = {
35984
+ 400: "Bad Request",
35985
+ 401: "Unauthorized",
35986
+ 403: "Forbidden",
35987
+ 404: "Not Found",
35988
+ 500: "Internal Server Error",
35989
+ 502: "Bad Gateway",
35990
+ 503: "Service Unavailable",
35991
+ ...options.errors
35992
+ };
35993
+ const error2 = errors[result.status];
35994
+ if (error2) {
35995
+ throw new ApiError(options, result, error2);
35996
+ }
35997
+ if (!result.ok) {
35998
+ throw new ApiError(options, result, "Generic Error");
35999
+ }
36000
+ }, "catchErrorCodes");
36001
+ executeRequest = /* @__PURE__ */ __name(async (config, options, onCancel) => {
36002
+ const url4 = getUrl(config, options);
36003
+ const formData = getFormData(options);
36004
+ const body = getRequestBody(options);
36005
+ const headers = await getHeaders(config, options);
36006
+ debugLogRequest(config, url4, headers, formData ?? body ?? {});
36007
+ if (onCancel.isCancelled) {
36008
+ return null;
36009
+ }
36010
+ const response = await sendRequest(
36011
+ config,
36012
+ options,
36013
+ url4,
36014
+ body,
36015
+ formData,
36016
+ headers,
36017
+ onCancel
36018
+ );
36019
+ const responseBody = await getResponseBody(response);
36020
+ const responseHeader = getResponseHeader(response, options.responseHeader);
36021
+ return { url: url4, response, responseBody, responseHeader };
36022
+ }, "executeRequest");
36023
+ buildApiResult = /* @__PURE__ */ __name((config, options, req) => {
36024
+ if (isResponseSchemaV4(config, options)) {
36025
+ return parseResponseSchemaV4(
36026
+ req.url,
36027
+ req.response,
36028
+ req.responseHeader,
36029
+ req.responseBody
36030
+ );
36031
+ }
36032
+ return {
36033
+ url: req.url,
36034
+ ok: req.response.ok,
36035
+ status: req.response.status,
36036
+ statusText: req.response.statusText,
36037
+ body: req.responseHeader ?? req.responseBody
36038
+ };
36039
+ }, "buildApiResult");
36040
+ request = /* @__PURE__ */ __name((config, options) => {
36041
+ return new CancelablePromise(async (resolve31, reject, onCancel) => {
36042
+ try {
36043
+ const req = await executeRequest(config, options, onCancel);
36044
+ if (!req) {
36045
+ return;
36046
+ }
36047
+ const result = buildApiResult(config, options, req);
36048
+ debugLogResponse(config, result);
36049
+ catchErrorCodes(options, result);
36050
+ resolve31(result.body);
36051
+ } catch (error2) {
36052
+ reject(error2);
36053
+ }
36054
+ });
36055
+ }, "request");
36056
+ requestPaginated = /* @__PURE__ */ __name((config, options) => {
36057
+ return new CancelablePromise(async (resolve31, reject, onCancel) => {
36058
+ try {
36059
+ const req = await executeRequest(config, options, onCancel);
36060
+ if (!req) {
36061
+ return;
36062
+ }
36063
+ const result = buildApiResult(config, options, req);
36064
+ debugLogResponse(config, result);
36065
+ catchErrorCodes(options, result);
36066
+ let resultInfo;
36067
+ if (isResponseSchemaV4(config, options)) {
36068
+ const fetchResult2 = typeof req.responseBody === "object" ? req.responseBody : JSON.parse(req.responseBody);
36069
+ resultInfo = fetchResult2.result_info;
36070
+ }
36071
+ resolve31({
36072
+ data: result.body,
36073
+ resultInfo
36074
+ });
36075
+ } catch (error2) {
36076
+ reject(error2);
36077
+ }
36078
+ });
36079
+ }, "requestPaginated");
36080
+ debugLogRequest = /* @__PURE__ */ __name(async (config, url4, headers, body) => {
36081
+ config.LOGGER?.debug(`-- START CF API REQUEST: ${url4}`);
36082
+ const logHeaders2 = new Headers(headers);
36083
+ logHeaders2.delete("Authorization");
36084
+ config.LOGGER?.debugWithSanitization(
36085
+ "HEADERS:",
36086
+ JSON.stringify(logHeaders2, null, 2)
36087
+ );
36088
+ config.LOGGER?.debugWithSanitization(
36089
+ "BODY:",
36090
+ JSON.stringify(
36091
+ body instanceof FormData ? await new Response(body).text() : body,
36092
+ null,
36093
+ 2
36094
+ )
36095
+ );
36096
+ config.LOGGER?.debug("-- END CF API REQUEST");
36097
+ }, "debugLogRequest");
36098
+ debugLogResponse = /* @__PURE__ */ __name((config, response) => {
36099
+ config.LOGGER?.debug(
36100
+ "-- START CF API RESPONSE:",
36101
+ response.statusText,
36102
+ response.status
36103
+ );
36104
+ config.LOGGER?.debugWithSanitization("RESPONSE:", response.body);
36105
+ config.LOGGER?.debug("-- END CF API RESPONSE");
36106
+ }, "debugLogResponse");
36107
+ }
36108
+ });
36109
+
35771
36110
  // ../containers-shared/src/client/models/ApplicationAffinityColocation.ts
35772
36111
  var init_ApplicationAffinityColocation = __esm({
35773
36112
  "../containers-shared/src/client/models/ApplicationAffinityColocation.ts"() {
@@ -36225,315 +36564,6 @@ var init_UpdateApplicationRolloutRequest = __esm({
36225
36564
  }
36226
36565
  });
36227
36566
 
36228
- // ../containers-shared/src/client/core/request.ts
36229
- var isDefined, isString2, isStringWithValue, isBlob, base64, getQueryString, getUrl, getFormData, resolve6, getHeaders, getRequestBody, isResponseSchemaV4, parseResponseSchemaV4, sendRequest, getResponseHeader, getResponseBody, catchErrorCodes, request, debugLogRequest, debugLogResponse;
36230
- var init_request = __esm({
36231
- "../containers-shared/src/client/core/request.ts"() {
36232
- init_import_meta_url();
36233
- init_ApiError();
36234
- init_CancelablePromise();
36235
- isDefined = /* @__PURE__ */ __name((value) => {
36236
- return value !== void 0 && value !== null;
36237
- }, "isDefined");
36238
- isString2 = /* @__PURE__ */ __name((value) => {
36239
- return typeof value === "string";
36240
- }, "isString");
36241
- isStringWithValue = /* @__PURE__ */ __name((value) => {
36242
- return isString2(value) && value !== "";
36243
- }, "isStringWithValue");
36244
- isBlob = /* @__PURE__ */ __name((value) => {
36245
- return typeof value === "object" && typeof value.type === "string" && typeof value.stream === "function" && typeof value.arrayBuffer === "function" && typeof value.constructor === "function" && typeof value.constructor.name === "string" && /^(Blob|File)$/.test(value.constructor.name) && /^(Blob|File)$/.test(value[Symbol.toStringTag]);
36246
- }, "isBlob");
36247
- base64 = /* @__PURE__ */ __name((str) => {
36248
- try {
36249
- return btoa(str);
36250
- } catch (err) {
36251
- return Buffer.from(str).toString("base64");
36252
- }
36253
- }, "base64");
36254
- getQueryString = /* @__PURE__ */ __name((params) => {
36255
- const qs = [];
36256
- const append = /* @__PURE__ */ __name((key, value) => {
36257
- qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
36258
- }, "append");
36259
- const process12 = /* @__PURE__ */ __name((key, value) => {
36260
- if (isDefined(value)) {
36261
- if (Array.isArray(value)) {
36262
- value.forEach((v8) => {
36263
- process12(key, v8);
36264
- });
36265
- } else if (typeof value === "object") {
36266
- Object.entries(value).forEach(([k7, v8]) => {
36267
- process12(`${key}[${k7}]`, v8);
36268
- });
36269
- } else {
36270
- append(key, value);
36271
- }
36272
- }
36273
- }, "process");
36274
- Object.entries(params).forEach(([key, value]) => {
36275
- process12(key, value);
36276
- });
36277
- if (qs.length > 0) {
36278
- return `?${qs.join("&")}`;
36279
- }
36280
- return "";
36281
- }, "getQueryString");
36282
- getUrl = /* @__PURE__ */ __name((config, options) => {
36283
- const encoder = config.ENCODE_PATH || encodeURI;
36284
- const path82 = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring2, group) => {
36285
- if (options.path?.hasOwnProperty(group)) {
36286
- return encoder(String(options.path[group]));
36287
- }
36288
- return substring2;
36289
- });
36290
- const url4 = `${config.BASE}${path82}`;
36291
- if (options.query) {
36292
- return `${url4}${getQueryString(options.query)}`;
36293
- }
36294
- return url4;
36295
- }, "getUrl");
36296
- getFormData = /* @__PURE__ */ __name((options) => {
36297
- if (options.formData) {
36298
- const formData = new FormData();
36299
- const process12 = /* @__PURE__ */ __name(async (key, value) => {
36300
- if (isString2(value)) {
36301
- formData.append(key, value);
36302
- } else {
36303
- formData.append(key, JSON.stringify(value));
36304
- }
36305
- }, "process");
36306
- Object.entries(options.formData).filter(([_5, value]) => isDefined(value)).forEach(([key, value]) => {
36307
- if (Array.isArray(value)) {
36308
- value.forEach((v8) => process12(key, v8));
36309
- } else {
36310
- process12(key, value);
36311
- }
36312
- });
36313
- return formData;
36314
- }
36315
- return void 0;
36316
- }, "getFormData");
36317
- resolve6 = /* @__PURE__ */ __name(async (options, resolver) => {
36318
- if (typeof resolver === "function") {
36319
- return resolver(options);
36320
- }
36321
- return resolver;
36322
- }, "resolve");
36323
- getHeaders = /* @__PURE__ */ __name(async (config, options) => {
36324
- const token = await resolve6(options, config.TOKEN);
36325
- const username = await resolve6(options, config.USERNAME);
36326
- const password = await resolve6(options, config.PASSWORD);
36327
- const additionalHeaders = await resolve6(options, config.HEADERS);
36328
- const headers = Object.entries({
36329
- Accept: "application/json",
36330
- ...additionalHeaders,
36331
- ...options.headers
36332
- }).filter(([_5, value]) => isDefined(value)).reduce(
36333
- (headers2, [key, value]) => ({
36334
- ...headers2,
36335
- [key]: String(value)
36336
- }),
36337
- {}
36338
- );
36339
- if (isStringWithValue(token)) {
36340
- headers["Authorization"] = `Bearer ${token}`;
36341
- }
36342
- if (isStringWithValue(username) && isStringWithValue(password)) {
36343
- const credentials = base64(`${username}:${password}`);
36344
- headers["Authorization"] = `Basic ${credentials}`;
36345
- }
36346
- if (options.body) {
36347
- if (options.mediaType) {
36348
- headers["Content-Type"] = options.mediaType;
36349
- } else if (isBlob(options.body)) {
36350
- headers["Content-Type"] = options.body.type || "application/octet-stream";
36351
- } else if (isString2(options.body)) {
36352
- headers["Content-Type"] = "text/plain";
36353
- } else {
36354
- headers["Content-Type"] = "application/json";
36355
- }
36356
- }
36357
- return new Headers(headers);
36358
- }, "getHeaders");
36359
- getRequestBody = /* @__PURE__ */ __name((options) => {
36360
- if (options.body !== void 0) {
36361
- if (options.mediaType?.includes("/json")) {
36362
- return JSON.stringify(options.body);
36363
- } else if (isString2(options.body) || isBlob(options.body)) {
36364
- return options.body;
36365
- } else {
36366
- return JSON.stringify(options.body);
36367
- }
36368
- }
36369
- return void 0;
36370
- }, "getRequestBody");
36371
- isResponseSchemaV4 = /* @__PURE__ */ __name((config, _options) => {
36372
- return config.BASE.endsWith("/containers");
36373
- }, "isResponseSchemaV4");
36374
- parseResponseSchemaV4 = /* @__PURE__ */ __name((url4, response, responseHeader, responseBody) => {
36375
- const fetchResult2 = typeof responseBody === "object" ? responseBody : JSON.parse(responseBody);
36376
- const ok = response.ok && fetchResult2.success;
36377
- let result;
36378
- if (ok) {
36379
- if (fetchResult2.result !== void 0) {
36380
- result = fetchResult2.result;
36381
- } else {
36382
- result = {};
36383
- }
36384
- } else {
36385
- result = { error: fetchResult2.errors?.[0]?.message };
36386
- }
36387
- return {
36388
- url: url4,
36389
- ok,
36390
- status: response.status,
36391
- statusText: response.statusText,
36392
- body: responseHeader ?? result
36393
- };
36394
- }, "parseResponseSchemaV4");
36395
- sendRequest = /* @__PURE__ */ __name(async (config, options, url4, body, formData, headers, onCancel) => {
36396
- const controller = new AbortController();
36397
- const request4 = {
36398
- headers,
36399
- body: body ?? formData,
36400
- method: options.method,
36401
- signal: controller.signal
36402
- };
36403
- if (config.WITH_CREDENTIALS) {
36404
- request4.credentials = config.CREDENTIALS;
36405
- }
36406
- onCancel(() => controller.abort());
36407
- return await fetch(url4, request4);
36408
- }, "sendRequest");
36409
- getResponseHeader = /* @__PURE__ */ __name((response, responseHeader) => {
36410
- if (responseHeader) {
36411
- const content = response.headers.get(responseHeader);
36412
- if (isString2(content)) {
36413
- return content;
36414
- }
36415
- }
36416
- return void 0;
36417
- }, "getResponseHeader");
36418
- getResponseBody = /* @__PURE__ */ __name(async (response) => {
36419
- if (response.status !== 204) {
36420
- try {
36421
- const contentType = response.headers.get("Content-Type");
36422
- if (contentType) {
36423
- const jsonTypes = ["application/json", "application/problem+json"];
36424
- const isJSON = jsonTypes.some(
36425
- (type) => contentType.toLowerCase().startsWith(type)
36426
- );
36427
- if (isJSON) {
36428
- return await response.json();
36429
- } else {
36430
- return await response.text();
36431
- }
36432
- }
36433
- } catch (error2) {
36434
- console.error(error2);
36435
- }
36436
- }
36437
- return void 0;
36438
- }, "getResponseBody");
36439
- catchErrorCodes = /* @__PURE__ */ __name((options, result) => {
36440
- const errors = {
36441
- 400: "Bad Request",
36442
- 401: "Unauthorized",
36443
- 403: "Forbidden",
36444
- 404: "Not Found",
36445
- 500: "Internal Server Error",
36446
- 502: "Bad Gateway",
36447
- 503: "Service Unavailable",
36448
- ...options.errors
36449
- };
36450
- const error2 = errors[result.status];
36451
- if (error2) {
36452
- throw new ApiError(options, result, error2);
36453
- }
36454
- if (!result.ok) {
36455
- throw new ApiError(options, result, "Generic Error");
36456
- }
36457
- }, "catchErrorCodes");
36458
- request = /* @__PURE__ */ __name((config, options) => {
36459
- return new CancelablePromise(async (resolve31, reject, onCancel) => {
36460
- try {
36461
- const url4 = getUrl(config, options);
36462
- const formData = getFormData(options);
36463
- const body = getRequestBody(options);
36464
- const headers = await getHeaders(config, options);
36465
- debugLogRequest(config, url4, headers, formData ?? body ?? {});
36466
- if (!onCancel.isCancelled) {
36467
- const response = await sendRequest(
36468
- config,
36469
- options,
36470
- url4,
36471
- body,
36472
- formData,
36473
- headers,
36474
- onCancel
36475
- );
36476
- const responseBody = await getResponseBody(response);
36477
- const responseHeader = getResponseHeader(
36478
- response,
36479
- options.responseHeader
36480
- );
36481
- let result;
36482
- if (isResponseSchemaV4(config, options)) {
36483
- result = parseResponseSchemaV4(
36484
- url4,
36485
- response,
36486
- responseHeader,
36487
- responseBody
36488
- );
36489
- } else {
36490
- result = {
36491
- url: url4,
36492
- ok: response.ok,
36493
- status: response.status,
36494
- statusText: response.statusText,
36495
- body: responseHeader ?? responseBody
36496
- };
36497
- }
36498
- debugLogResponse(config, result);
36499
- catchErrorCodes(options, result);
36500
- resolve31(result.body);
36501
- }
36502
- } catch (error2) {
36503
- reject(error2);
36504
- }
36505
- });
36506
- }, "request");
36507
- debugLogRequest = /* @__PURE__ */ __name(async (config, url4, headers, body) => {
36508
- config.LOGGER?.debug(`-- START CF API REQUEST: ${url4}`);
36509
- const logHeaders2 = new Headers(headers);
36510
- logHeaders2.delete("Authorization");
36511
- config.LOGGER?.debugWithSanitization(
36512
- "HEADERS:",
36513
- JSON.stringify(logHeaders2, null, 2)
36514
- );
36515
- config.LOGGER?.debugWithSanitization(
36516
- "BODY:",
36517
- JSON.stringify(
36518
- body instanceof FormData ? await new Response(body).text() : body,
36519
- null,
36520
- 2
36521
- )
36522
- );
36523
- config.LOGGER?.debug("-- END CF API REQUEST");
36524
- }, "debugLogRequest");
36525
- debugLogResponse = /* @__PURE__ */ __name((config, response) => {
36526
- config.LOGGER?.debug(
36527
- "-- START CF API RESPONSE:",
36528
- response.statusText,
36529
- response.status
36530
- );
36531
- config.LOGGER?.debugWithSanitization("RESPONSE:", response.body);
36532
- config.LOGGER?.debug("-- END CF API RESPONSE");
36533
- }, "debugLogResponse");
36534
- }
36535
- });
36536
-
36537
36567
  // ../containers-shared/src/client/services/AccountService.ts
36538
36568
  var AccountService;
36539
36569
  var init_AccountService = __esm({
@@ -37024,6 +37054,33 @@ var init_ApplicationsService = __esm({
37024
37054
  }
37025
37055
  });
37026
37056
  }
37057
+ /**
37058
+ * List container instances for a given application
37059
+ * Returns instances and optional durable object instances with pagination support
37060
+ * @param applicationId
37061
+ * @param perPage Number of results per page
37062
+ * @param pageToken Token for fetching the next page
37063
+ * @returns PaginatedResult<DashApplicationInstances> Paginated list of instances
37064
+ * @throws ApiError
37065
+ */
37066
+ static listDashApplicationInstances(applicationId, perPage, pageToken) {
37067
+ return requestPaginated(OpenAPI, {
37068
+ method: "GET",
37069
+ url: "/dash/applications/{application_id}/instances",
37070
+ path: {
37071
+ application_id: applicationId
37072
+ },
37073
+ query: {
37074
+ per_page: perPage,
37075
+ page_token: pageToken
37076
+ },
37077
+ errors: {
37078
+ 401: `Unauthorized`,
37079
+ 404: `Application not found`,
37080
+ 500: `Internal error`
37081
+ }
37082
+ });
37083
+ }
37027
37084
  };
37028
37085
  }
37029
37086
  });
@@ -37788,6 +37845,7 @@ var init_client = __esm({
37788
37845
  init_ApiError();
37789
37846
  init_CancelablePromise();
37790
37847
  init_OpenAPI();
37848
+ init_request();
37791
37849
  init_ApplicationAffinityColocation();
37792
37850
  init_ApplicationAffinityHardwareGeneration();
37793
37851
  init_ApplicationMutationError();
@@ -38370,7 +38428,7 @@ var init_images = __esm({
38370
38428
  init_login();
38371
38429
  init_registry2();
38372
38430
  init_utils();
38373
- DEFAULT_CONTAINER_EGRESS_INTERCEPTOR_IMAGE = "cloudflare/proxy-everything:3f5e832@sha256:816255f5b6ebdc2cdcddb578d803121e7ee9cfe178442da07725d75a66cdcf37";
38431
+ DEFAULT_CONTAINER_EGRESS_INTERCEPTOR_IMAGE = "cloudflare/proxy-everything:233db0f@sha256:f159d9e1b0f28bc01bd106f38d62479c018d050e3f95b365c5f9b5f83f60df82";
38374
38432
  __name(getEgressInterceptorImage, "getEgressInterceptorImage");
38375
38433
  __name(pullEgressInterceptorImage, "pullEgressInterceptorImage");
38376
38434
  __name(pullImage, "pullImage");
@@ -38502,8 +38560,8 @@ function createDeferred(previousDeferred) {
38502
38560
  resolve31 = _resolve;
38503
38561
  reject = _reject;
38504
38562
  });
38505
- assert51__default.default(resolve31);
38506
- assert51__default.default(reject);
38563
+ assert52__default.default(resolve31);
38564
+ assert52__default.default(reject);
38507
38565
  previousDeferred?.resolve(newPromise);
38508
38566
  return {
38509
38567
  promise: newPromise,
@@ -42224,7 +42282,7 @@ var require_signal_exit = __commonJS({
42224
42282
  };
42225
42283
  };
42226
42284
  } else {
42227
- assert59 = __require("assert");
42285
+ assert60 = __require("assert");
42228
42286
  signals = require_signals();
42229
42287
  isWin = /^win/i.test(process12.platform);
42230
42288
  EE = __require("events");
@@ -42247,7 +42305,7 @@ var require_signal_exit = __commonJS({
42247
42305
  return function() {
42248
42306
  };
42249
42307
  }
42250
- assert59.equal(typeof cb2, "function", "a callback must be provided for exit handler");
42308
+ assert60.equal(typeof cb2, "function", "a callback must be provided for exit handler");
42251
42309
  if (loaded === false) {
42252
42310
  load();
42253
42311
  }
@@ -42353,7 +42411,7 @@ var require_signal_exit = __commonJS({
42353
42411
  }
42354
42412
  }, "processEmit");
42355
42413
  }
42356
- var assert59;
42414
+ var assert60;
42357
42415
  var signals;
42358
42416
  var isWin;
42359
42417
  var EE;
@@ -49897,7 +49955,7 @@ function getSourceMappingPrepareStackTrace(retrieveSourceMap) {
49897
49955
  }
49898
49956
  });
49899
49957
  sourceMappingPrepareStackTrace = Error.prepareStackTrace;
49900
- assert51__default.default(sourceMappingPrepareStackTrace !== void 0);
49958
+ assert52__default.default(sourceMappingPrepareStackTrace !== void 0);
49901
49959
  Error.prepareStackTrace = originalPrepareStackTrace;
49902
49960
  return sourceMappingPrepareStackTrace;
49903
49961
  }
@@ -49940,7 +49998,7 @@ function getSourceMappedString(value, retrieveSourceMap) {
49940
49998
  }
49941
49999
  const callSiteLine = callSiteLines[i7][0];
49942
50000
  const callSiteAtIndex = callSiteLine.indexOf("at");
49943
- assert51__default.default(callSiteAtIndex !== -1);
50001
+ assert52__default.default(callSiteAtIndex !== -1);
49944
50002
  const callSiteLineLeftPad = callSiteLine.substring(0, callSiteAtIndex);
49945
50003
  value = value.replace(
49946
50004
  callSiteLine,
@@ -51091,7 +51149,7 @@ var name, version;
51091
51149
  var init_package = __esm({
51092
51150
  "package.json"() {
51093
51151
  name = "wrangler";
51094
- version = "4.72.0";
51152
+ version = "4.74.0";
51095
51153
  }
51096
51154
  });
51097
51155
 
@@ -52195,7 +52253,7 @@ function buildMiniflareBindingOptions(config, remoteProxyConnectionString) {
52195
52253
  (b11) => isUnsafeServiceBindingWithDevCfg(b11[1])
52196
52254
  );
52197
52255
  for (const [name2, unsafeBinding] of unsafeBindingsWithLocalDev) {
52198
- assert51__default.default(isUnsafeServiceBindingWithDevCfg(unsafeBinding));
52256
+ assert52__default.default(isUnsafeServiceBindingWithDevCfg(unsafeBinding));
52199
52257
  const {
52200
52258
  type,
52201
52259
  dev: {
@@ -52401,7 +52459,7 @@ function buildMiniflareBindingOptions(config, remoteProxyConnectionString) {
52401
52459
  };
52402
52460
  }
52403
52461
  function getDefaultPersistRoot(localPersistencePath) {
52404
- if (localPersistencePath !== null) {
52462
+ if (localPersistencePath !== false) {
52405
52463
  const v3Path = path3__namespace.default.join(localPersistencePath, "v3");
52406
52464
  return v3Path;
52407
52465
  }
@@ -52489,7 +52547,7 @@ async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticati
52489
52547
  return options;
52490
52548
  }
52491
52549
  function getImageNameFromDOClassName(options) {
52492
- assert51__default.default(
52550
+ assert52__default.default(
52493
52551
  options.containerBuildId,
52494
52552
  "Build ID should be set if containers are defined and enabled"
52495
52553
  );
@@ -52898,8 +52956,8 @@ function readConfig(args, options = {}) {
52898
52956
  redirected
52899
52957
  } = exports.experimental_readRawConfig(args, options);
52900
52958
  if (redirected) {
52901
- assert51__default.default(configPath, "Redirected config found without a configPath");
52902
- assert51__default.default(
52959
+ assert52__default.default(configPath, "Redirected config found without a configPath");
52960
+ assert52__default.default(
52903
52961
  deployConfigPath,
52904
52962
  "Redirected config found without a deployConfigPath"
52905
52963
  );
@@ -52934,8 +52992,8 @@ function readPagesConfig(args, options = {}) {
52934
52992
  try {
52935
52993
  ({ rawConfig, configPath, userConfigPath, deployConfigPath, redirected } = exports.experimental_readRawConfig(args, options));
52936
52994
  if (redirected) {
52937
- assert51__default.default(configPath, "Redirected config found without a configPath");
52938
- assert51__default.default(
52995
+ assert52__default.default(configPath, "Redirected config found without a configPath");
52996
+ assert52__default.default(
52939
52997
  deployConfigPath,
52940
52998
  "Redirected config found without a deployConfigPath"
52941
52999
  );
@@ -122162,7 +122220,7 @@ function createCloudflareClient(complianceConfig) {
122162
122220
  }
122163
122221
  async function performApiFetch(complianceConfig, resource, init4 = {}, queryParams, abortSignal, apiToken) {
122164
122222
  const method = init4.method ?? "GET";
122165
- assert51__default.default(
122223
+ assert52__default.default(
122166
122224
  resource.startsWith("/"),
122167
122225
  `CF API fetch - resource path must start with a "/" but got "${resource}"`
122168
122226
  );
@@ -122739,7 +122797,7 @@ function isReturningFromAuthServer(query) {
122739
122797
  );
122740
122798
  throw new ErrorInvalidReturnedStateParam();
122741
122799
  }
122742
- assert51__default.default(!Array.isArray(code));
122800
+ assert52__default.default(!Array.isArray(code));
122743
122801
  state2.authorizationCode = code;
122744
122802
  state2.hasAuthCodeBeenExchangedForAccessToken = false;
122745
122803
  return true;
@@ -122965,13 +123023,13 @@ async function getOauthToken(options) {
122965
123023
  if (error2 || closeErr) {
122966
123024
  reject(error2 || closeErr);
122967
123025
  } else {
122968
- assert51__default.default(token);
123026
+ assert52__default.default(token);
122969
123027
  resolve31(token);
122970
123028
  }
122971
123029
  });
122972
123030
  }
122973
123031
  __name(finish, "finish");
122974
- assert51__default.default(req.url, "This request doesn't have a URL");
123032
+ assert52__default.default(req.url, "This request doesn't have a URL");
122975
123033
  const { pathname, query } = Url__default.default.parse(req.url, true);
122976
123034
  if (req.method !== "GET") {
122977
123035
  return res.end("OK");
@@ -125216,7 +125274,7 @@ var init_esm6 = __esm({
125216
125274
  function dedent3(strings, ...values) {
125217
125275
  const raw = String.raw({ raw: strings }, ...values);
125218
125276
  let lines = raw.split("\n");
125219
- assert51__default.default(lines.length > 0);
125277
+ assert52__default.default(lines.length > 0);
125220
125278
  if (lines[lines.length - 1].trim() === "") {
125221
125279
  lines = lines.slice(0, lines.length - 1);
125222
125280
  }
@@ -125396,12 +125454,12 @@ function getEntryPointFromMetafile(entryFile, metafile) {
125396
125454
  );
125397
125455
  if (entryPoints.length !== 1) {
125398
125456
  const entryPointList = entryPoints.map(([_input, output]) => output.entryPoint).join("\n");
125399
- assert51__default.default(
125457
+ assert52__default.default(
125400
125458
  entryPoints.length > 0,
125401
125459
  `Cannot find entry-point "${entryFile}" in generated bundle.
125402
125460
  ${entryPointList}`
125403
125461
  );
125404
- assert51__default.default(
125462
+ assert52__default.default(
125405
125463
  entryPoints.length < 2,
125406
125464
  `More than one entry-point found for generated bundle.
125407
125465
  ${entryPointList}`
@@ -125665,9 +125723,9 @@ function handleNodeJSGlobals(build5, inject, polyfill2) {
125665
125723
  }));
125666
125724
  build5.onLoad({ filter: UNENV_VIRTUAL_MODULE_RE }, ({ path: path82 }) => {
125667
125725
  const module4 = virtualModulePathToSpecifier.get(path82);
125668
- assert51__default.default(module4, `Expected ${path82} to be mapped to a module specifier`);
125726
+ assert52__default.default(module4, `Expected ${path82} to be mapped to a module specifier`);
125669
125727
  const injects = injectsByModule.get(module4);
125670
- assert51__default.default(injects, `Expected ${module4} to inject values`);
125728
+ assert52__default.default(injects, `Expected ${module4} to inject values`);
125671
125729
  const imports = injects.map(
125672
125730
  ({ exportName, importName }) => importName === exportName ? exportName : `${exportName} as ${importName}`
125673
125731
  );
@@ -129743,10 +129801,10 @@ var init_CommandRegistry = __esm({
129743
129801
  * console.log(subtree); // Output: empty Map if 'wrangler hello' has no further subcommands
129744
129802
  */
129745
129803
  #resolveDefinitionNode(node2) {
129746
- assert51__default.default(node2.definition);
129804
+ assert52__default.default(node2.definition);
129747
129805
  const chain2 = this.#resolveDefinitionChain(node2.definition);
129748
129806
  const resolvedDef = chain2.find((def) => def.type !== "alias");
129749
- assert51__default.default(resolvedDef);
129807
+ assert52__default.default(resolvedDef);
129750
129808
  const { subtree } = node2.definition.type !== "alias" ? node2 : this.#findNodeFor(resolvedDef.command) ?? node2;
129751
129809
  const definition = {
129752
129810
  // take all properties from the resolved alias
@@ -138712,6 +138770,311 @@ var init_containers = __esm({
138712
138770
  });
138713
138771
  }
138714
138772
  });
138773
+ function onKeyPress(callback, options) {
138774
+ const stream2 = new Stream.PassThrough();
138775
+ process.stdin.pipe(stream2);
138776
+ let rl;
138777
+ if (isInteractive2()) {
138778
+ rl = S__default.default.createInterface({
138779
+ input: stream2,
138780
+ ...options
138781
+ });
138782
+ S__default.default.emitKeypressEvents(stream2, rl);
138783
+ process.stdin.setRawMode(true);
138784
+ }
138785
+ const handler = /* @__PURE__ */ __name(async (_char, key) => {
138786
+ if (key) {
138787
+ callback(key);
138788
+ }
138789
+ }, "handler");
138790
+ stream2.on("keypress", handler);
138791
+ return () => {
138792
+ if (isInteractive2()) {
138793
+ process.stdin.setRawMode(false);
138794
+ }
138795
+ rl?.close();
138796
+ stream2.off("keypress", handler);
138797
+ stream2.destroy();
138798
+ };
138799
+ }
138800
+ var init_onKeyPress = __esm({
138801
+ "src/utils/onKeyPress.ts"() {
138802
+ init_import_meta_url();
138803
+ init_is_interactive();
138804
+ __name(onKeyPress, "onKeyPress");
138805
+ }
138806
+ });
138807
+
138808
+ // src/containers/instances.ts
138809
+ function deriveInstanceState(instance) {
138810
+ const status2 = instance.current_placement?.status;
138811
+ if (!status2) {
138812
+ return "unknown";
138813
+ }
138814
+ const raw = status2.container_status ?? status2.health;
138815
+ switch (raw) {
138816
+ case "placed":
138817
+ return "provisioning";
138818
+ case "running":
138819
+ case "failed":
138820
+ case "stopping":
138821
+ case "stopped":
138822
+ case "unhealthy":
138823
+ return raw;
138824
+ default:
138825
+ return "unknown";
138826
+ }
138827
+ }
138828
+ function colorState(state2) {
138829
+ switch (state2) {
138830
+ case "running":
138831
+ return green(state2);
138832
+ case "failed":
138833
+ case "unhealthy":
138834
+ case "stopped":
138835
+ case "stopping":
138836
+ return red(state2);
138837
+ default:
138838
+ return state2;
138839
+ }
138840
+ }
138841
+ function buildInstanceRows(data) {
138842
+ const doList = data.durable_objects ?? [];
138843
+ if (doList.length === 0) {
138844
+ return data.instances.map((instance) => ({ instance }));
138845
+ }
138846
+ const instanceByDeploymentId = /* @__PURE__ */ new Map();
138847
+ for (const inst of data.instances) {
138848
+ instanceByDeploymentId.set(inst.id, inst);
138849
+ }
138850
+ return doList.map((doInst) => ({
138851
+ instance: doInst.deployment_id ? instanceByDeploymentId.get(doInst.deployment_id) : void 0,
138852
+ durableObject: doInst
138853
+ }));
138854
+ }
138855
+ async function fetchPage(applicationId, perPage, pageToken) {
138856
+ try {
138857
+ const page = await ApplicationsService.listDashApplicationInstances(
138858
+ applicationId,
138859
+ perPage,
138860
+ pageToken
138861
+ );
138862
+ return {
138863
+ data: page.data,
138864
+ nextPageToken: page.resultInfo?.next_page_token
138865
+ };
138866
+ } catch (err) {
138867
+ if (!(err instanceof Error)) {
138868
+ throw err;
138869
+ }
138870
+ if (err instanceof ApiError) {
138871
+ if (err.status === 400 || err.status === 404) {
138872
+ throw new UserError(
138873
+ `There has been an error fetching instances.
138874
+ ${err.body.error}
138875
+ Use \`wrangler containers list\` to view your containers and corresponding IDs.`
138876
+ );
138877
+ }
138878
+ throw new Error(
138879
+ `There has been an unknown error fetching instances.
138880
+ ${JSON.stringify(err.body)}`
138881
+ );
138882
+ }
138883
+ throw new Error(
138884
+ `There has been an internal error fetching instances.
138885
+ ${err.message}`
138886
+ );
138887
+ }
138888
+ }
138889
+ function rowsToJsonOutput(rows) {
138890
+ const hasDurableObjects = rows.some((r9) => r9.durableObject);
138891
+ if (hasDurableObjects) {
138892
+ return rows.map((row) => {
138893
+ const state2 = row.instance ? deriveInstanceState(row.instance) : "inactive";
138894
+ return {
138895
+ id: row.durableObject?.id ?? row.instance?.id ?? null,
138896
+ name: row.durableObject?.name ?? null,
138897
+ state: state2,
138898
+ location: row.instance?.location ?? null,
138899
+ version: row.instance?.app_version ?? null,
138900
+ created: row.instance?.created_at ?? row.durableObject?.assigned_at ?? null
138901
+ };
138902
+ });
138903
+ }
138904
+ return rows.map((row) => {
138905
+ const state2 = row.instance ? deriveInstanceState(row.instance) : "unknown";
138906
+ return {
138907
+ id: row.instance?.id ?? null,
138908
+ state: state2,
138909
+ location: row.instance?.location ?? null,
138910
+ version: row.instance?.app_version ?? null,
138911
+ created: row.instance?.created_at ?? null
138912
+ };
138913
+ });
138914
+ }
138915
+ function renderTable(rows) {
138916
+ const hasDurableObjects = rows.some((r9) => r9.durableObject);
138917
+ if (hasDurableObjects) {
138918
+ logger.table(
138919
+ rows.map((row) => {
138920
+ const state2 = row.instance ? deriveInstanceState(row.instance) : "inactive";
138921
+ return {
138922
+ INSTANCE: row.durableObject?.id ?? row.instance?.id ?? "-",
138923
+ NAME: row.durableObject?.name ?? "-",
138924
+ STATE: colorState(state2),
138925
+ LOCATION: row.instance?.location ?? "-",
138926
+ VERSION: row.instance ? String(row.instance.app_version) : "-",
138927
+ CREATED: row.instance?.created_at ?? row.durableObject?.assigned_at ?? "-"
138928
+ };
138929
+ })
138930
+ );
138931
+ } else {
138932
+ logger.table(
138933
+ rows.map((row) => {
138934
+ const state2 = row.instance ? deriveInstanceState(row.instance) : "unknown";
138935
+ return {
138936
+ INSTANCE: row.instance?.id ?? "-",
138937
+ STATE: colorState(state2),
138938
+ LOCATION: row.instance?.location ?? "-",
138939
+ VERSION: row.instance ? String(row.instance.app_version) : "-",
138940
+ CREATED: row.instance?.created_at ?? "-"
138941
+ };
138942
+ })
138943
+ );
138944
+ }
138945
+ }
138946
+ async function instancesCommand(args) {
138947
+ const uuidRegex2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
138948
+ if (!uuidRegex2.test(args.ID)) {
138949
+ throw new UserError(
138950
+ `Expected an application ID but got ${args.ID}. Use \`wrangler containers list\` to view your containers and corresponding IDs.`
138951
+ );
138952
+ }
138953
+ if (args.json || isNonInteractiveOrCI()) {
138954
+ try {
138955
+ const { data } = await fetchPage(args.ID);
138956
+ const rows = buildInstanceRows(data);
138957
+ const jsonRows = rowsToJsonOutput(rows);
138958
+ if (jsonRows.length === 0 && !args.json) {
138959
+ logger.log(
138960
+ "No instances found for this application. The application may not have any running containers."
138961
+ );
138962
+ return;
138963
+ }
138964
+ logger.json(jsonRows);
138965
+ return;
138966
+ } catch (err) {
138967
+ if (args.json) {
138968
+ const message = err instanceof Error ? err.message : "Unknown error";
138969
+ throw new JsonFriendlyFatalError(JSON.stringify({ error: message }));
138970
+ }
138971
+ throw err;
138972
+ }
138973
+ }
138974
+ const { start, stop } = spinner();
138975
+ let pageToken;
138976
+ let totalShown = 0;
138977
+ let stopped = false;
138978
+ do {
138979
+ start("Loading instances");
138980
+ const { data, nextPageToken } = await fetchPage(
138981
+ args.ID,
138982
+ args.perPage,
138983
+ pageToken
138984
+ );
138985
+ stop();
138986
+ const rows = buildInstanceRows(data);
138987
+ if (rows.length === 0 && totalShown === 0) {
138988
+ logger.log(
138989
+ "No instances found for this application. The application may not have any running containers."
138990
+ );
138991
+ return;
138992
+ }
138993
+ if (rows.length > 0) {
138994
+ renderTable(rows);
138995
+ totalShown += rows.length;
138996
+ }
138997
+ pageToken = nextPageToken;
138998
+ if (pageToken) {
138999
+ logger.log(
139000
+ dim(
139001
+ `Showing ${totalShown} instances. Press Enter to load ${args.perPage} more, or q/Esc to stop.`
139002
+ )
139003
+ );
139004
+ await new Promise((resolve31) => {
139005
+ const cleanup = onKeyPress(
139006
+ (key) => {
139007
+ if (key.name === "return") {
139008
+ cleanup();
139009
+ resolve31();
139010
+ } else if (key.name === "escape" || key.name === "q" || key.name === "c" && key.ctrl) {
139011
+ cleanup();
139012
+ stopped = true;
139013
+ resolve31();
139014
+ }
139015
+ },
139016
+ { escapeCodeTimeout: 25 }
139017
+ );
139018
+ });
139019
+ }
139020
+ } while (pageToken && !stopped);
139021
+ }
139022
+ var instancesArgs, containersInstancesCommand;
139023
+ var init_instances2 = __esm({
139024
+ "src/containers/instances.ts"() {
139025
+ init_import_meta_url();
139026
+ init_colors();
139027
+ init_interactive();
139028
+ init_containers_shared();
139029
+ init_dist();
139030
+ init_common();
139031
+ init_create_command();
139032
+ init_is_interactive();
139033
+ init_logger();
139034
+ init_onKeyPress();
139035
+ init_containers2();
139036
+ __name(deriveInstanceState, "deriveInstanceState");
139037
+ __name(colorState, "colorState");
139038
+ __name(buildInstanceRows, "buildInstanceRows");
139039
+ __name(fetchPage, "fetchPage");
139040
+ __name(rowsToJsonOutput, "rowsToJsonOutput");
139041
+ __name(renderTable, "renderTable");
139042
+ instancesArgs = {
139043
+ ID: {
139044
+ describe: "ID of the application to list instances for",
139045
+ type: "string",
139046
+ demandOption: true
139047
+ },
139048
+ "per-page": {
139049
+ describe: "Number of instances per page",
139050
+ type: "number",
139051
+ default: 25
139052
+ },
139053
+ json: {
139054
+ describe: "Return output as clean JSON",
139055
+ type: "boolean",
139056
+ default: false
139057
+ }
139058
+ };
139059
+ __name(instancesCommand, "instancesCommand");
139060
+ containersInstancesCommand = createCommand({
139061
+ metadata: {
139062
+ description: "List container instances for an application",
139063
+ status: "open beta",
139064
+ owner: "Product: Cloudchamber"
139065
+ },
139066
+ behaviour: {
139067
+ printBanner: /* @__PURE__ */ __name((args) => !args.json && !isNonInteractiveOrCI(), "printBanner")
139068
+ },
139069
+ args: instancesArgs,
139070
+ positionalArgs: ["ID"],
139071
+ async handler(args, { config }) {
139072
+ await fillOpenAPIConfiguration(config, containersScope);
139073
+ await instancesCommand(args);
139074
+ }
139075
+ });
139076
+ }
139077
+ });
138715
139078
 
138716
139079
  // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/stream.js
138717
139080
  var require_stream = __commonJS({
@@ -141051,7 +141414,7 @@ var require_websocket2 = __commonJS({
141051
141414
  var EventEmitter5 = __require("events");
141052
141415
  var https3 = __require("https");
141053
141416
  var http6 = __require("http");
141054
- var net2 = __require("net");
141417
+ var net3 = __require("net");
141055
141418
  var tls = __require("tls");
141056
141419
  var { randomBytes: randomBytes2, createHash: createHash8 } = __require("crypto");
141057
141420
  var { Duplex: Duplex2, Readable: Readable11 } = __require("stream");
@@ -141787,13 +142150,13 @@ var require_websocket2 = __commonJS({
141787
142150
  __name(emitErrorAndClose, "emitErrorAndClose");
141788
142151
  function netConnect(options) {
141789
142152
  options.path = options.socketPath;
141790
- return net2.connect(options);
142153
+ return net3.connect(options);
141791
142154
  }
141792
142155
  __name(netConnect, "netConnect");
141793
142156
  function tlsConnect(options) {
141794
142157
  options.path = void 0;
141795
142158
  if (!options.servername && options.servername !== "") {
141796
- options.servername = net2.isIP(options.host) ? "" : options.host;
142159
+ options.servername = net3.isIP(options.host) ? "" : options.host;
141797
142160
  }
141798
142161
  return tls.connect(options);
141799
142162
  }
@@ -142589,7 +142952,7 @@ function buildSshArgs(sshArgs) {
142589
142952
  }
142590
142953
  return flags2;
142591
142954
  }
142592
- var containersSshCommand;
142955
+ var sshArgDefs, containersSshCommand;
142593
142956
  var init_ssh = __esm({
142594
142957
  "src/containers/ssh.ts"() {
142595
142958
  init_import_meta_url();
@@ -142602,6 +142965,70 @@ var init_ssh = __esm({
142602
142965
  init_create_command();
142603
142966
  init_logger();
142604
142967
  init_containers2();
142968
+ sshArgDefs = {
142969
+ ID: {
142970
+ describe: "ID of the container instance",
142971
+ type: "string",
142972
+ demandOption: true
142973
+ },
142974
+ cipher: {
142975
+ describe: "Sets `ssh -c`: Select the cipher specification for encrypting the session",
142976
+ type: "string",
142977
+ hidden: true,
142978
+ deprecated: true
142979
+ },
142980
+ "log-file": {
142981
+ describe: "Sets `ssh -E`: Append debug logs to log_file instead of standard error",
142982
+ type: "string",
142983
+ hidden: true,
142984
+ deprecated: true
142985
+ },
142986
+ "escape-char": {
142987
+ describe: "Sets `ssh -e`: Set the escape character for sessions with a pty (default: '~')",
142988
+ type: "string",
142989
+ hidden: true,
142990
+ deprecated: true
142991
+ },
142992
+ "config-file": {
142993
+ alias: "F",
142994
+ describe: "Sets `ssh -F`: Specify an alternative per-user ssh configuration file",
142995
+ type: "string",
142996
+ hidden: true,
142997
+ deprecated: true
142998
+ },
142999
+ pkcs11: {
143000
+ describe: "Sets `ssh -I`: Specify the PKCS#11 shared library ssh should use to communicate with a PKCS#11 token providing keys for user authentication",
143001
+ type: "string",
143002
+ hidden: true,
143003
+ deprecated: true
143004
+ },
143005
+ "identity-file": {
143006
+ alias: "i",
143007
+ describe: "Sets `ssh -i`: Select a file from which the identity (private key) for public key authentication is read",
143008
+ type: "string",
143009
+ hidden: true,
143010
+ deprecated: true
143011
+ },
143012
+ "mac-spec": {
143013
+ describe: "Sets `ssh -m`: A comma-separated list of MAC (message authentication code) algorithms, specified in order of preference",
143014
+ type: "string",
143015
+ hidden: true,
143016
+ deprecated: true
143017
+ },
143018
+ option: {
143019
+ alias: "o",
143020
+ describe: "Sets `ssh -o`: Set options in the format used in the ssh configuration file. May be repeated",
143021
+ type: "string",
143022
+ hidden: true,
143023
+ deprecated: true
143024
+ },
143025
+ tag: {
143026
+ describe: "Sets `ssh -P`: Specify a tag name that may be used to select configuration in ssh_config",
143027
+ type: "string",
143028
+ hidden: true,
143029
+ deprecated: true
143030
+ }
143031
+ };
142605
143032
  __name(sshCommand, "sshCommand");
142606
143033
  __name(verifySshInstalled, "verifySshInstalled");
142607
143034
  __name(createSshTcpProxy, "createSshTcpProxy");
@@ -142613,52 +143040,7 @@ var init_ssh = __esm({
142613
143040
  owner: "Product: Cloudchamber",
142614
143041
  hidden: true
142615
143042
  },
142616
- args: {
142617
- ID: {
142618
- describe: "ID of the container instance",
142619
- type: "string",
142620
- demandOption: true
142621
- },
142622
- cipher: {
142623
- describe: "Sets `ssh -c`: Select the cipher specification for encrypting the session",
142624
- type: "string"
142625
- },
142626
- "log-file": {
142627
- describe: "Sets `ssh -E`: Append debug logs to log_file instead of standard error",
142628
- type: "string"
142629
- },
142630
- "escape-char": {
142631
- describe: "Sets `ssh -e`: Set the escape character for sessions with a pty (default: '~')",
142632
- type: "string"
142633
- },
142634
- "config-file": {
142635
- alias: "F",
142636
- describe: "Sets `ssh -F`: Specify an alternative per-user ssh configuration file",
142637
- type: "string"
142638
- },
142639
- pkcs11: {
142640
- describe: "Sets `ssh -I`: Specify the PKCS#11 shared library ssh should use to communicate with a PKCS#11 token providing keys for user authentication",
142641
- type: "string"
142642
- },
142643
- "identity-file": {
142644
- alias: "i",
142645
- describe: "Sets `ssh -i`: Select a file from which the identity (private key) for public key authentication is read",
142646
- type: "string"
142647
- },
142648
- "mac-spec": {
142649
- describe: "Sets `ssh -m`: A comma-separated list of MAC (message authentication code) algorithms, specified in order of preference",
142650
- type: "string"
142651
- },
142652
- option: {
142653
- alias: "o",
142654
- describe: "Sets `ssh -o`: Set options in the format used in the ssh configuration file. May be repeated",
142655
- type: "string"
142656
- },
142657
- tag: {
142658
- describe: "Sets `ssh -P`: Specify a tag name that may be used to select configuration in ssh_config",
142659
- type: "string"
142660
- }
142661
- },
143043
+ args: sshArgDefs,
142662
143044
  positionalArgs: ["ID"],
142663
143045
  async handler(args, { config }) {
142664
143046
  await fillOpenAPIConfiguration(config, containersScope);
@@ -142785,6 +143167,9 @@ var init_client2 = __esm({
142785
143167
  }
142786
143168
  });
142787
143169
  function getLocalPersistencePath(persistTo, { userConfigPath }) {
143170
+ if (persistTo === false) {
143171
+ return false;
143172
+ }
142788
143173
  return persistTo ? (
142789
143174
  // If path specified, always treat it as relative to cwd()
142790
143175
  path3__namespace.default.resolve(process.cwd(), persistTo)
@@ -144045,7 +144430,7 @@ async function deployContainers(config, normalisedContainerConfig, { versionId,
144045
144430
  "Could not deploy container application as durable object was not found in list of bindings"
144046
144431
  );
144047
144432
  }
144048
- assert51__default.default(
144433
+ assert52__default.default(
144049
144434
  targetDurableObject && targetDurableObject.namespace_id !== void 0
144050
144435
  );
144051
144436
  await apply(
@@ -144061,7 +144446,7 @@ async function deployContainers(config, normalisedContainerConfig, { versionId,
144061
144446
  const targetDurableObject = maybeAllDurableObjects.find(
144062
144447
  (durableObject) => durableObject.class === container.class_name && durableObject.script === scriptName
144063
144448
  );
144064
- assert51__default.default(targetDurableObject, "Durable Object not returned from list API");
144449
+ assert52__default.default(targetDurableObject, "Durable Object not returned from list API");
144065
144450
  await apply(
144066
144451
  {
144067
144452
  imageRef,
@@ -145208,6 +145593,7 @@ var init_containers2 = __esm({
145208
145593
  init_import_meta_url();
145209
145594
  init_create_command();
145210
145595
  init_containers();
145596
+ init_instances2();
145211
145597
  init_ssh();
145212
145598
  init_registries();
145213
145599
  init_build3();
@@ -145346,7 +145732,7 @@ var init_config5 = __esm({
145346
145732
  }
145347
145733
  const normalizedContainers = [];
145348
145734
  for (const container of config.containers) {
145349
- assert51__default.default(container.name, "container name should have been set by validation");
145735
+ assert52__default.default(container.name, "container name should have been set by validation");
145350
145736
  const allDOs = getDurableObjectClassNameToUseSQLiteMap(config.migrations);
145351
145737
  if (!allDOs.has(container.class_name) && config.durable_objects.bindings.find(
145352
145738
  (doBinding) => doBinding.class_name === container.class_name
@@ -145425,12 +145811,12 @@ var init_config5 = __esm({
145425
145811
  }
145426
145812
  const maybeDockerfile = isDockerfile(container.image, config.configPath);
145427
145813
  if (maybeDockerfile) {
145428
- assert51__default.default(
145814
+ assert52__default.default(
145429
145815
  path3__namespace.default.isAbsolute(container.image),
145430
145816
  "Dockerfile path should be absolute"
145431
145817
  );
145432
145818
  const imageBuildContext = container.image_build_context ?? path3.dirname(container.image);
145433
- assert51__default.default(
145819
+ assert52__default.default(
145434
145820
  path3__namespace.default.isAbsolute(imageBuildContext),
145435
145821
  "resolved image_build_context should be defined"
145436
145822
  );
@@ -150115,7 +150501,7 @@ function createWorkerUploadForm(worker, bindings, options) {
150115
150501
  const manifestModuleName = "__STATIC_CONTENT_MANIFEST";
150116
150502
  const hasManifest = modules?.some(({ name: name2 }) => name2 === manifestModuleName);
150117
150503
  if (hasManifest && main2.type === "esm") {
150118
- assert51__default.default(modules !== void 0);
150504
+ assert52__default.default(modules !== void 0);
150119
150505
  const subDirs = new Set(
150120
150506
  modules.map((module4) => path3__namespace.default.posix.dirname(module4.name))
150121
150507
  );
@@ -154469,7 +154855,7 @@ var init_t_DYl0qC9V = __esm({
154469
154855
  this.complete(n8);
154470
154856
  }
154471
154857
  setup(a7, o7, s7) {
154472
- switch (assert51__default.default(s7 === `zsh` || s7 === `bash` || s7 === `fish` || s7 === `powershell`, `Unsupported shell`), s7) {
154858
+ switch (assert52__default.default(s7 === `zsh` || s7 === `bash` || s7 === `fish` || s7 === `powershell`, `Unsupported shell`), s7) {
154473
154859
  case `zsh`: {
154474
154860
  let e9 = t2(a7, o7);
154475
154861
  console.log(e9);
@@ -170041,7 +170427,7 @@ async function executeLocally({
170041
170427
  } finally {
170042
170428
  await mf.dispose();
170043
170429
  }
170044
- assert51__default.default(Array.isArray(results));
170430
+ assert52__default.default(Array.isArray(results));
170045
170431
  const allResults = results.map((result) => ({
170046
170432
  results: (result.results ?? []).map(
170047
170433
  (row) => Object.fromEntries(
@@ -170629,7 +171015,8 @@ var init_export2 = __esm({
170629
171015
  },
170630
171016
  table: {
170631
171017
  type: "string",
170632
- description: "Specify which tables to include in export"
171018
+ description: "Specify which tables to include in export",
171019
+ array: true
170633
171020
  },
170634
171021
  "no-schema": {
170635
171022
  type: "boolean",
@@ -170666,7 +171053,7 @@ var init_export2 = __esm({
170666
171053
  `Please specify a file path for --output, not a directory.`
170667
171054
  );
170668
171055
  }
170669
- const tables = table ? Array.isArray(table) ? table : [table] : [];
171056
+ const tables = table ?? [];
170670
171057
  if (remote) {
170671
171058
  return await exportRemotely(config, name2, output, tables, !schema, !data);
170672
171059
  } else {
@@ -172313,7 +172700,7 @@ async function provisionBindings(bindings, accountId, scriptName, autoCreate, co
172313
172700
  requireRemote
172314
172701
  );
172315
172702
  if (pendingResources.length > 0) {
172316
- assert51__default.default(
172703
+ assert52__default.default(
172317
172704
  configPath,
172318
172705
  "Provisioning resources is not possible without a config file"
172319
172706
  );
@@ -172603,7 +172990,7 @@ var init_bindings2 = __esm({
172603
172990
  );
172604
172991
  }
172605
172992
  async isConnectedToExistingResource() {
172606
- assert51__default.default(typeof this.binding.bucket_name !== "symbol");
172993
+ assert52__default.default(typeof this.binding.bucket_name !== "symbol");
172607
172994
  if (!this.binding.bucket_name) {
172608
172995
  return false;
172609
172996
  }
@@ -172697,7 +173084,7 @@ var init_bindings2 = __esm({
172697
173084
  return false;
172698
173085
  }
172699
173086
  async isConnectedToExistingResource() {
172700
- assert51__default.default(typeof this.binding.database_name !== "symbol");
173087
+ assert52__default.default(typeof this.binding.database_name !== "symbol");
172701
173088
  if (!this.binding.database_name) {
172702
173089
  return false;
172703
173090
  }
@@ -173060,7 +173447,7 @@ async function getKVNamespaceId({ namespace, preview, binding, "namespace-id": n
173060
173447
  return { namespaceId: nsId, displayName: formatDisplayName(nsId) };
173061
173448
  } else if (previewIsDefined) {
173062
173449
  if (getFlag("RESOURCES_PROVISION")) {
173063
- assert51__default.default(binding);
173450
+ assert52__default.default(binding);
173064
173451
  const nsId = await getIdFromSettings(config, binding, isLocal2);
173065
173452
  return { namespaceId: nsId, displayName: formatDisplayName(nsId) };
173066
173453
  }
@@ -173071,10 +173458,10 @@ async function getKVNamespaceId({ namespace, preview, binding, "namespace-id": n
173071
173458
  const bindingHasOnlyOneId = configNamespace.id && !configNamespace.preview_id || !configNamespace.id && configNamespace.preview_id;
173072
173459
  if (bindingHasOnlyOneId) {
173073
173460
  const nsId = configNamespace.id || configNamespace.preview_id;
173074
- assert51__default.default(nsId);
173461
+ assert52__default.default(nsId);
173075
173462
  return { namespaceId: nsId, displayName: formatDisplayName(nsId) };
173076
173463
  } else if (getFlag("RESOURCES_PROVISION") && !configNamespace.id && !configNamespace.preview_id) {
173077
- assert51__default.default(binding);
173464
+ assert52__default.default(binding);
173078
173465
  const nsId = await getIdFromSettings(config, binding, isLocal2);
173079
173466
  return { namespaceId: nsId, displayName: formatDisplayName(nsId) };
173080
173467
  } else {
@@ -173325,7 +173712,7 @@ var init_delete3 = __esm({
173325
173712
  logger.log(`--dry-run: exiting now.`);
173326
173713
  return;
173327
173714
  }
173328
- assert51__default.default(accountId, "Missing accountId");
173715
+ assert52__default.default(accountId, "Missing accountId");
173329
173716
  const confirmed = args.force || await confirm(
173330
173717
  `Are you sure you want to delete ${scriptName}? This action cannot be undone.`
173331
173718
  );
@@ -195717,13 +196104,13 @@ var require_esprima2 = __commonJS({
195717
196104
  /***/
195718
196105
  function(module5, exports2) {
195719
196106
  Object.defineProperty(exports2, "__esModule", { value: true });
195720
- function assert59(condition, message) {
196107
+ function assert60(condition, message) {
195721
196108
  if (!condition) {
195722
196109
  throw new Error("ASSERT: " + message);
195723
196110
  }
195724
196111
  }
195725
- __name(assert59, "assert");
195726
- exports2.assert = assert59;
196112
+ __name(assert60, "assert");
196113
+ exports2.assert = assert60;
195727
196114
  },
195728
196115
  /* 10 */
195729
196116
  /***/
@@ -209444,12 +209831,12 @@ var require_lib4 = __commonJS({
209444
209831
  return x7;
209445
209832
  }
209446
209833
  __name(nonNull, "nonNull");
209447
- function assert59(x7) {
209834
+ function assert60(x7) {
209448
209835
  if (!x7) {
209449
209836
  throw new Error("Assert fail");
209450
209837
  }
209451
209838
  }
209452
- __name(assert59, "assert");
209839
+ __name(assert60, "assert");
209453
209840
  var TSErrors = ParseErrorEnum`typescript`({
209454
209841
  AbstractMethodHasImplementation: /* @__PURE__ */ __name(({
209455
209842
  methodName
@@ -210477,7 +210864,7 @@ var require_lib4 = __commonJS({
210477
210864
  return this.finishNode(t12, "TSTypeAnnotation");
210478
210865
  }
210479
210866
  tsParseType() {
210480
- assert59(this.state.inType);
210867
+ assert60(this.state.inType);
210481
210868
  const type = this.tsParseNonConditionalType();
210482
210869
  if (this.state.inDisallowConditionalTypesContext || this.hasPrecedingLineBreak() || !this.eat(81)) {
210483
210870
  return type;
@@ -211525,7 +211912,7 @@ var require_lib4 = __commonJS({
211525
211912
  return arrow.node;
211526
211913
  }
211527
211914
  if (!jsx2) {
211528
- assert59(!this.hasPlugin("jsx"));
211915
+ assert60(!this.hasPlugin("jsx"));
211529
211916
  typeCast = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state2);
211530
211917
  if (!typeCast.error) return typeCast.node;
211531
211918
  }
@@ -216330,7 +216717,7 @@ function checkMinimumAnalogVersion(projectPath) {
216330
216717
  "@analogjs/platform",
216331
216718
  projectPath
216332
216719
  );
216333
- assert51__default.default(
216720
+ assert52__default.default(
216334
216721
  analogJsVersion,
216335
216722
  "Unable to discern the version of the `@analogjs/platform` package"
216336
216723
  );
@@ -216490,7 +216877,7 @@ var init_command3 = __esm({
216490
216877
  __name(quoteShellArgs, "quoteShellArgs");
216491
216878
  }
216492
216879
  });
216493
- var installPackages, installWrangler;
216880
+ var installPackages, getWorkspaceInstallRootFlag, installWrangler;
216494
216881
  var init_packages3 = __esm({
216495
216882
  "src/autoconfig/c3-vendor/packages.ts"() {
216496
216883
  init_import_meta_url();
@@ -216500,6 +216887,7 @@ var init_packages3 = __esm({
216500
216887
  installPackages = /* @__PURE__ */ __name(async (packageManager, packages, config = {}) => {
216501
216888
  const { type } = packageManager;
216502
216889
  const { force, dev: dev2, startText, doneText } = config;
216890
+ const isWorkspaceRoot = config.isWorkspaceRoot ?? false;
216503
216891
  if (packages.length === 0) {
216504
216892
  let cmd2;
216505
216893
  switch (type) {
@@ -216517,9 +216905,11 @@ var init_packages3 = __esm({
216517
216905
  ...cmd2 ? [cmd2] : [],
216518
216906
  ...packages,
216519
216907
  ...type === "pnpm" ? ["--no-frozen-lockfile"] : [],
216520
- ...force === true ? ["--force"] : []
216908
+ ...force === true ? ["--force"] : [],
216909
+ ...getWorkspaceInstallRootFlag(type, isWorkspaceRoot)
216521
216910
  ],
216522
216911
  {
216912
+ cwd: process.cwd(),
216523
216913
  startText,
216524
216914
  doneText,
216525
216915
  silent: true
@@ -216547,7 +216937,8 @@ var init_packages3 = __esm({
216547
216937
  cmd,
216548
216938
  ...saveFlag ? [saveFlag] : [],
216549
216939
  ...packages,
216550
- ...force === true ? ["--force"] : []
216940
+ ...force === true ? ["--force"] : [],
216941
+ ...getWorkspaceInstallRootFlag(type, isWorkspaceRoot)
216551
216942
  ],
216552
216943
  {
216553
216944
  startText,
@@ -216559,7 +216950,7 @@ var init_packages3 = __esm({
216559
216950
  const pkgJsonPath = path3__namespace.default.join(process.cwd(), "package.json");
216560
216951
  const pkgJson = parsePackageJSON(readFileSync(pkgJsonPath), pkgJsonPath);
216561
216952
  const deps = config.dev ? pkgJson.devDependencies : pkgJson.dependencies;
216562
- assert51__default.default(deps, "dependencies should be defined");
216953
+ assert52__default.default(deps, "dependencies should be defined");
216563
216954
  for (const pkg of packages) {
216564
216955
  const versionMarker = pkg.lastIndexOf("@");
216565
216956
  if (versionMarker > 0) {
@@ -216573,10 +216964,25 @@ var init_packages3 = __esm({
216573
216964
  await fs12.writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
216574
216965
  }
216575
216966
  }, "installPackages");
216576
- installWrangler = /* @__PURE__ */ __name(async (packageManager) => {
216967
+ getWorkspaceInstallRootFlag = /* @__PURE__ */ __name((packageManagerType, isWorkspaceRoot) => {
216968
+ if (!isWorkspaceRoot) {
216969
+ return [];
216970
+ }
216971
+ switch (packageManagerType) {
216972
+ case "pnpm":
216973
+ return ["--workspace-root"];
216974
+ case "yarn":
216975
+ return ["-W"];
216976
+ case "npm":
216977
+ case "bun":
216978
+ return [];
216979
+ }
216980
+ }, "getWorkspaceInstallRootFlag");
216981
+ installWrangler = /* @__PURE__ */ __name(async (packageManager, isWorkspaceRoot) => {
216577
216982
  const { type } = packageManager;
216578
216983
  await installPackages(packageManager, [`wrangler@latest`], {
216579
216984
  dev: true,
216985
+ isWorkspaceRoot,
216580
216986
  startText: `Installing wrangler ${dim(
216581
216987
  "A command line tool for building Cloudflare Workers"
216582
216988
  )}`,
@@ -216628,11 +217034,12 @@ async function overrideServerFile() {
216628
217034
  `
216629
217035
  );
216630
217036
  }
216631
- async function installAdditionalDependencies(packageManager) {
217037
+ async function installAdditionalDependencies(packageManager, isWorkspaceRoot) {
216632
217038
  await installPackages(packageManager, ["xhr2"], {
216633
217039
  dev: true,
216634
217040
  startText: "Installing additional dependencies",
216635
- doneText: `${brandColor("installed")}`
217041
+ doneText: `${brandColor("installed")}`,
217042
+ isWorkspaceRoot
216636
217043
  });
216637
217044
  }
216638
217045
  var Angular2;
@@ -216653,12 +217060,13 @@ var init_angular2 = __esm({
216653
217060
  workerName,
216654
217061
  outputDir,
216655
217062
  dryRun,
216656
- packageManager
217063
+ packageManager,
217064
+ isWorkspaceRoot
216657
217065
  }) {
216658
217066
  if (!dryRun) {
216659
217067
  await updateAngularJson(workerName);
216660
217068
  await overrideServerFile();
216661
- await installAdditionalDependencies(packageManager);
217069
+ await installAdditionalDependencies(packageManager, isWorkspaceRoot);
216662
217070
  }
216663
217071
  return {
216664
217072
  wranglerConfig: {
@@ -216676,12 +217084,23 @@ var init_angular2 = __esm({
216676
217084
  __name(installAdditionalDependencies, "installAdditionalDependencies");
216677
217085
  }
216678
217086
  });
217087
+ function getAstroVersion(projectPath) {
217088
+ const packageName = "astro";
217089
+ const astroVersion = getInstalledPackageVersion(packageName, projectPath);
217090
+ assert52__default.default(
217091
+ astroVersion,
217092
+ `Unable to discern the version of the \`${packageName}\` package`
217093
+ );
217094
+ return astroVersion;
217095
+ }
216679
217096
  var Astro2;
216680
217097
  var init_astro2 = __esm({
216681
217098
  "src/autoconfig/frameworks/astro.ts"() {
216682
217099
  init_import_meta_url();
216683
217100
  init_colors();
217101
+ init_semiver();
216684
217102
  init_command3();
217103
+ init_packages2();
216685
217104
  init_frameworks2();
216686
217105
  Astro2 = class extends exports.experimental_AutoConfigFramework {
216687
217106
  static {
@@ -216690,8 +217109,10 @@ var init_astro2 = __esm({
216690
217109
  async configure({
216691
217110
  outputDir,
216692
217111
  dryRun,
216693
- packageManager
217112
+ packageManager,
217113
+ projectPath
216694
217114
  }) {
217115
+ const astroVersion = getAstroVersion(projectPath);
216695
217116
  const { npx } = packageManager;
216696
217117
  if (!dryRun) {
216697
217118
  await runCommand2([npx, "astro", "add", "cloudflare", "-y"], {
@@ -216703,19 +217124,25 @@ var init_astro2 = __esm({
216703
217124
  });
216704
217125
  fs23.writeFileSync("public/.assetsignore", "_worker.js\n_routes.json");
216705
217126
  }
216706
- return {
216707
- wranglerConfig: {
216708
- main: `${outputDir}/_worker.js/index.js`,
216709
- compatibility_flags: ["global_fetch_strictly_public"],
216710
- assets: {
216711
- binding: "ASSETS",
216712
- directory: outputDir
217127
+ if (semiver_default(astroVersion, "6.0.0") < 0) {
217128
+ return {
217129
+ wranglerConfig: {
217130
+ main: `${outputDir}/_worker.js/index.js`,
217131
+ compatibility_flags: ["global_fetch_strictly_public"],
217132
+ assets: {
217133
+ binding: "ASSETS",
217134
+ directory: outputDir
217135
+ }
216713
217136
  }
216714
- }
217137
+ };
217138
+ }
217139
+ return {
217140
+ wranglerConfig: null
216715
217141
  };
216716
217142
  }
216717
217143
  configurationDescription = 'Configuring project for Astro with "astro add cloudflare"';
216718
217144
  };
217145
+ __name(getAstroVersion, "getAstroVersion");
216719
217146
  }
216720
217147
  });
216721
217148
 
@@ -216870,13 +217297,15 @@ var init_nuxt2 = __esm({
216870
217297
  async configure({
216871
217298
  dryRun,
216872
217299
  projectPath,
216873
- packageManager
217300
+ packageManager,
217301
+ isWorkspaceRoot
216874
217302
  }) {
216875
217303
  if (!dryRun) {
216876
217304
  await installPackages(packageManager, ["nitro-cloudflare-dev"], {
216877
217305
  dev: true,
216878
217306
  startText: "Installing the Cloudflare dev module",
216879
- doneText: `${brandColor(`installed`)} ${dim("nitro-cloudflare-dev")}`
217307
+ doneText: `${brandColor(`installed`)} ${dim("nitro-cloudflare-dev")}`,
217308
+ isWorkspaceRoot
216880
217309
  });
216881
217310
  updateNuxtConfig(projectPath);
216882
217311
  }
@@ -217283,13 +217712,13 @@ function transformReactRouterConfig(projectPath, viteEnvironmentKey) {
217283
217712
  }`
217284
217713
  );
217285
217714
  }
217286
- assert51__default.default(node2.type === "ObjectExpression");
217715
+ assert52__default.default(node2.type === "ObjectExpression");
217287
217716
  const futureKey = node2.properties.findIndex(
217288
217717
  (p7) => p7.type === "ObjectProperty" && p7.key.type === "Identifier" && p7.key.name === "future" && p7.value.type === "ObjectExpression"
217289
217718
  );
217290
217719
  if (futureKey !== -1) {
217291
217720
  const future = node2.properties[futureKey];
217292
- assert51__default.default(
217721
+ assert52__default.default(
217293
217722
  future.type === "ObjectProperty" && future.value.type === "ObjectExpression"
217294
217723
  );
217295
217724
  const viteEnvironment = future.value.properties.findIndex(
@@ -217297,7 +217726,7 @@ function transformReactRouterConfig(projectPath, viteEnvironmentKey) {
217297
217726
  );
217298
217727
  if (viteEnvironment !== -1) {
217299
217728
  const prop = future.value.properties[viteEnvironment];
217300
- assert51__default.default(
217729
+ assert52__default.default(
217301
217730
  prop.type === "ObjectProperty" && prop.value.type === "BooleanLiteral"
217302
217731
  );
217303
217732
  prop.value.value = true;
@@ -217363,14 +217792,16 @@ var init_react_router2 = __esm({
217363
217792
  async configure({
217364
217793
  dryRun,
217365
217794
  projectPath,
217366
- packageManager
217795
+ packageManager,
217796
+ isWorkspaceRoot
217367
217797
  }) {
217368
217798
  const viteEnvironmentKey = configPropertyName(projectPath);
217369
217799
  if (!dryRun) {
217370
217800
  await installPackages(packageManager, ["@cloudflare/vite-plugin"], {
217371
217801
  dev: true,
217372
217802
  startText: "Installing the Cloudflare Vite plugin",
217373
- doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
217803
+ doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`,
217804
+ isWorkspaceRoot
217374
217805
  });
217375
217806
  fs23.mkdirSync("workers");
217376
217807
  fs23.writeFileSync(
@@ -217404,7 +217835,8 @@ var init_react_router2 = __esm({
217404
217835
  await installPackages(packageManager, ["isbot"], {
217405
217836
  dev: true,
217406
217837
  startText: "Installing the isbot package",
217407
- doneText: `${brandColor(`installed`)} ${dim("isbot")}`
217838
+ doneText: `${brandColor(`installed`)} ${dim("isbot")}`,
217839
+ isWorkspaceRoot
217408
217840
  });
217409
217841
  if (!fs23.existsSync("app/entry.server.tsx")) {
217410
217842
  fs23.writeFileSync(
@@ -217543,7 +217975,7 @@ function getSolidStartVersion(projectPath) {
217543
217975
  packageName,
217544
217976
  projectPath
217545
217977
  );
217546
- assert51__default.default(
217978
+ assert52__default.default(
217547
217979
  solidStartVersion,
217548
217980
  `Unable to discern the version of the \`${packageName}\` package`
217549
217981
  );
@@ -217631,7 +218063,8 @@ var init_sveltekit = __esm({
217631
218063
  }
217632
218064
  async configure({
217633
218065
  dryRun,
217634
- packageManager
218066
+ packageManager,
218067
+ isWorkspaceRoot
217635
218068
  }) {
217636
218069
  const { dlx } = packageManager;
217637
218070
  if (!dryRun) {
@@ -217655,7 +218088,8 @@ var init_sveltekit = __esm({
217655
218088
  fs23.writeFileSync("static/.assetsignore", "_worker.js\n_routes.json");
217656
218089
  await installPackages(packageManager, [], {
217657
218090
  startText: "Installing packages",
217658
- doneText: `${brandColor("installed")}`
218091
+ doneText: `${brandColor("installed")}`,
218092
+ isWorkspaceRoot
217659
218093
  });
217660
218094
  }
217661
218095
  return {
@@ -217689,13 +218123,15 @@ var init_tanstack = __esm({
217689
218123
  async configure({
217690
218124
  dryRun,
217691
218125
  projectPath,
217692
- packageManager
218126
+ packageManager,
218127
+ isWorkspaceRoot
217693
218128
  }) {
217694
218129
  if (!dryRun) {
217695
218130
  await installPackages(packageManager, ["@cloudflare/vite-plugin"], {
217696
218131
  dev: true,
217697
218132
  startText: "Installing the Cloudflare Vite plugin",
217698
- doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
218133
+ doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`,
218134
+ isWorkspaceRoot
217699
218135
  });
217700
218136
  transformViteConfig(projectPath, { viteEnvironmentName: "ssr" });
217701
218137
  }
@@ -217734,7 +218170,7 @@ function addVikePhotonToVikeConfigExportObject(n8) {
217734
218170
  );
217735
218171
  configObject.properties.push(configTargetProp);
217736
218172
  }
217737
- assert51__default.default(configTargetProp && t4.ArrayExpression.check(configTargetProp.value));
218173
+ assert52__default.default(configTargetProp && t4.ArrayExpression.check(configTargetProp.value));
217738
218174
  if (!configTargetProp.value.elements.some(
217739
218175
  (el) => el?.type === "CallExpression" && el.callee.type === "Identifier" && el.callee.name === vikeConfigExtendsPropName
217740
218176
  )) {
@@ -217800,7 +218236,8 @@ var init_vike2 = __esm({
217800
218236
  async configure({
217801
218237
  projectPath,
217802
218238
  dryRun,
217803
- packageManager
218239
+ packageManager,
218240
+ isWorkspaceRoot
217804
218241
  }) {
217805
218242
  const vikeServerIsInstalled = isPackageInstalled(
217806
218243
  "vike-server",
@@ -217817,11 +218254,13 @@ var init_vike2 = __esm({
217817
218254
  ["vike-photon", "@photonjs/cloudflare"],
217818
218255
  {
217819
218256
  startText: "Installing vike-photon and @photonjs/cloudflare",
217820
- doneText: `${brandColor(`installed`)} photon packages`
218257
+ doneText: `${brandColor(`installed`)} photon packages`,
218258
+ isWorkspaceRoot
217821
218259
  }
217822
218260
  );
217823
218261
  await installPackages(packageManager, ["@cloudflare/vite-plugin"], {
217824
- dev: true
218262
+ dev: true,
218263
+ isWorkspaceRoot
217825
218264
  });
217826
218265
  addVikePhotonToConfigFile(projectPath);
217827
218266
  }
@@ -217865,13 +218304,15 @@ var init_vite2 = __esm({
217865
218304
  async configure({
217866
218305
  dryRun,
217867
218306
  projectPath,
217868
- packageManager
218307
+ packageManager,
218308
+ isWorkspaceRoot
217869
218309
  }) {
217870
218310
  if (!dryRun) {
217871
218311
  await installPackages(packageManager, ["@cloudflare/vite-plugin"], {
217872
218312
  dev: true,
217873
218313
  startText: "Installing the Cloudflare Vite plugin",
217874
- doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
218314
+ doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`,
218315
+ isWorkspaceRoot
217875
218316
  });
217876
218317
  transformViteConfig(projectPath);
217877
218318
  }
@@ -217952,15 +218393,15 @@ async function updateWakuConfig(projectPath) {
217952
218393
  return this.traverse(n8);
217953
218394
  }
217954
218395
  const config = n8.node.arguments[0];
217955
- assert51__default.default(t5.ObjectExpression.check(config));
218396
+ assert52__default.default(t5.ObjectExpression.check(config));
217956
218397
  const viteConfig = config.properties.find(
217957
218398
  (prop) => isViteProp(prop)
217958
218399
  )?.value;
217959
- assert51__default.default(t5.ObjectExpression.check(viteConfig));
218400
+ assert52__default.default(t5.ObjectExpression.check(viteConfig));
217960
218401
  const pluginsProp = viteConfig.properties.find(
217961
218402
  (prop) => isPluginsProp2(prop)
217962
218403
  );
217963
- assert51__default.default(pluginsProp && t5.ArrayExpression.check(pluginsProp.value));
218404
+ assert52__default.default(pluginsProp && t5.ArrayExpression.check(pluginsProp.value));
217964
218405
  if (!pluginsProp.value.elements.some(
217965
218406
  (el) => el?.type === "CallExpression" && el.callee.type === "Identifier" && el.callee.name === "cloudflare"
217966
218407
  )) {
@@ -218021,7 +218462,8 @@ var init_waku2 = __esm({
218021
218462
  async configure({
218022
218463
  dryRun,
218023
218464
  projectPath,
218024
- packageManager
218465
+ packageManager,
218466
+ isWorkspaceRoot
218025
218467
  }) {
218026
218468
  validateMinimumWakuVersion(projectPath);
218027
218469
  if (!dryRun) {
@@ -218031,7 +218473,8 @@ var init_waku2 = __esm({
218031
218473
  {
218032
218474
  dev: true,
218033
218475
  startText: "Installing additional dependencies",
218034
- doneText: `${brandColor("installed")}`
218476
+ doneText: `${brandColor("installed")}`,
218477
+ isWorkspaceRoot
218035
218478
  }
218036
218479
  );
218037
218480
  await createWakuServerFile(projectPath);
@@ -218186,7 +218629,7 @@ function convertDetectedPackageManager(pkgManager) {
218186
218629
  }
218187
218630
  }
218188
218631
  function assertNonConfigured(details) {
218189
- assert51__default.default(
218632
+ assert52__default.default(
218190
218633
  details.configured === false,
218191
218634
  "Error: expected the current project not to be already configured"
218192
218635
  );
@@ -218259,10 +218702,17 @@ async function detectFramework(projectPath, wranglerConfig) {
218259
218702
  captureException(err);
218260
218703
  });
218261
218704
  const buildSettings = await project.getBuildSettings();
218262
- if (project.workspace?.isRoot) {
218263
- throw new UserError(
218264
- "The Wrangler application detection logic has been run in the root of a workspace, this is not supported. Change your working directory to one of the applications in the workspace and try again."
218705
+ const isWorkspaceRoot = !!project.workspace?.isRoot;
218706
+ if (isWorkspaceRoot) {
218707
+ const resolvedProjectPath = path3.resolve(projectPath);
218708
+ const workspaceRootIncludesProject = project.workspace?.packages.some(
218709
+ (pkg) => path3.resolve(pkg.path) === resolvedProjectPath
218265
218710
  );
218711
+ if (!workspaceRootIncludesProject) {
218712
+ throw new UserError(
218713
+ "The Wrangler application detection logic has been run in the root of a workspace instead of targeting a specific project. Change your working directory to one of the applications in the workspace and try again."
218714
+ );
218715
+ }
218266
218716
  }
218267
218717
  const detectedFramework = findDetectedFramework(buildSettings);
218268
218718
  const packageManager = convertDetectedPackageManager(project.packageManager);
@@ -218288,7 +218738,7 @@ async function detectFramework(projectPath, wranglerConfig) {
218288
218738
  packageManager
218289
218739
  };
218290
218740
  }
218291
- return { detectedFramework, packageManager };
218741
+ return { detectedFramework, packageManager, isWorkspaceRoot };
218292
218742
  }
218293
218743
  function findDetectedFramework(settings) {
218294
218744
  if (settings.length === 0) {
@@ -218370,10 +218820,7 @@ async function getDetailsForAutoConfig({
218370
218820
  packageManager: NpmPackageManager
218371
218821
  };
218372
218822
  }
218373
- const { detectedFramework, packageManager } = await detectFramework(
218374
- projectPath,
218375
- wranglerConfig
218376
- );
218823
+ const { detectedFramework, packageManager, isWorkspaceRoot } = await detectFramework(projectPath, wranglerConfig);
218377
218824
  const framework = getFramework2(detectedFramework?.framework?.id);
218378
218825
  const packageJsonPath = path3.resolve(projectPath, "package.json");
218379
218826
  let packageJson;
@@ -218413,7 +218860,8 @@ async function getDetailsForAutoConfig({
218413
218860
  );
218414
218861
  return {
218415
218862
  ...baseDetails,
218416
- configured: true
218863
+ configured: true,
218864
+ isWorkspaceRoot
218417
218865
  };
218418
218866
  }
218419
218867
  if (!outputDir) {
@@ -218446,7 +218894,8 @@ async function getDetailsForAutoConfig({
218446
218894
  return {
218447
218895
  ...baseDetails,
218448
218896
  outputDir,
218449
- configured: false
218897
+ configured: false,
218898
+ isWorkspaceRoot
218450
218899
  };
218451
218900
  }
218452
218901
  function getProjectBuildCommand(detectedFramework, packageManager) {
@@ -218824,7 +219273,7 @@ async function runAutoConfig(autoConfigDetails, autoConfigOptions = {}) {
218824
219273
  autoConfigDetails.framework.id === "cloudflare-pages" ? `The target project seems to be using Cloudflare Pages. Automatically migrating from a Pages project to a Workers one is not yet supported.` : `The detected framework ("${autoConfigDetails.framework.name}") cannot be automatically configured.`
218825
219274
  );
218826
219275
  }
218827
- assert51__default.default(
219276
+ assert52__default.default(
218828
219277
  autoConfigDetails.outputDir,
218829
219278
  "The Output Directory is unexpectedly missing"
218830
219279
  );
@@ -218840,17 +219289,19 @@ async function runAutoConfig(autoConfigDetails, autoConfigOptions = {}) {
218840
219289
  }
218841
219290
  };
218842
219291
  const { packageManager } = autoConfigDetails;
219292
+ const isWorkspaceRoot = autoConfigDetails.isWorkspaceRoot ?? false;
218843
219293
  const dryRunConfigurationResults = await autoConfigDetails.framework.configure({
218844
219294
  outputDir: autoConfigDetails.outputDir,
218845
219295
  projectPath: autoConfigDetails.projectPath,
218846
219296
  workerName: autoConfigDetails.workerName,
219297
+ isWorkspaceRoot,
218847
219298
  dryRun: true,
218848
219299
  packageManager
218849
219300
  });
218850
219301
  const { npx } = packageManager;
218851
219302
  autoConfigSummary = await buildOperationsSummary(
218852
219303
  { ...autoConfigDetails, outputDir: autoConfigDetails.outputDir },
218853
- ensureNodejsCompatIsInConfig({
219304
+ dryRunConfigurationResults.wranglerConfig === null ? null : ensureNodejsCompatIsInConfig({
218854
219305
  ...wranglerConfig,
218855
219306
  ...dryRunConfigurationResults.wranglerConfig
218856
219307
  }),
@@ -218886,12 +219337,13 @@ async function runAutoConfig(autoConfigDetails, autoConfigOptions = {}) {
218886
219337
  ${JSON.stringify(autoConfigDetails, null, 2)}...`
218887
219338
  );
218888
219339
  if (autoConfigSummary.wranglerInstall && enableWranglerInstallation) {
218889
- await installWrangler(packageManager);
219340
+ await installWrangler(packageManager, isWorkspaceRoot);
218890
219341
  }
218891
219342
  const configurationResults = await autoConfigDetails.framework.configure({
218892
219343
  outputDir: autoConfigDetails.outputDir,
218893
219344
  projectPath: autoConfigDetails.projectPath,
218894
219345
  workerName: autoConfigDetails.workerName,
219346
+ isWorkspaceRoot,
218895
219347
  dryRun: false,
218896
219348
  packageManager
218897
219349
  });
@@ -218918,13 +219370,15 @@ ${JSON.stringify(autoConfigDetails, null, 2)}...`
218918
219370
  ) + "\n"
218919
219371
  );
218920
219372
  }
218921
- await saveWranglerJsonc(
218922
- autoConfigDetails.projectPath,
218923
- ensureNodejsCompatIsInConfig({
218924
- ...wranglerConfig,
218925
- ...configurationResults.wranglerConfig
218926
- })
218927
- );
219373
+ if (configurationResults.wranglerConfig !== null) {
219374
+ await saveWranglerJsonc(
219375
+ autoConfigDetails.projectPath,
219376
+ ensureNodejsCompatIsInConfig({
219377
+ ...wranglerConfig,
219378
+ ...configurationResults.wranglerConfig
219379
+ })
219380
+ );
219381
+ }
218928
219382
  addWranglerToGitIgnore(autoConfigDetails.projectPath);
218929
219383
  if (autoConfigDetails.outputDir === autoConfigDetails.projectPath) {
218930
219384
  addWranglerToAssetsIgnore(autoConfigDetails.projectPath);
@@ -219000,7 +219454,9 @@ async function buildOperationsSummary(autoConfigDetails, wranglerConfigToWrite,
219000
219454
  const summary = {
219001
219455
  wranglerInstall: false,
219002
219456
  scripts: {},
219003
- wranglerConfig: wranglerConfigToWrite,
219457
+ ...wranglerConfigToWrite !== null ? {
219458
+ wranglerConfig: wranglerConfigToWrite
219459
+ } : {},
219004
219460
  outputDir: autoConfigDetails.outputDir,
219005
219461
  frameworkId: autoConfigDetails.framework.id,
219006
219462
  buildCommand: projectCommands.build,
@@ -219018,7 +219474,7 @@ async function buildOperationsSummary(autoConfigDetails, wranglerConfigToWrite,
219018
219474
  };
219019
219475
  const containsServerSideCode = (
219020
219476
  // If there is an entrypoint then we know that there is server side code
219021
- !!wranglerConfigToWrite.main
219477
+ !!wranglerConfigToWrite?.main
219022
219478
  );
219023
219479
  if (
219024
219480
  // If there is no server side code, then there is no need to add the cf-typegen script
@@ -219495,7 +219951,7 @@ async function syncWorkersSite(complianceConfig, accountId, scriptName, siteAsse
219495
219951
  logger.log("(Note: doing a dry run, not uploading or deleting anything.)");
219496
219952
  return { manifest: void 0, namespace: void 0 };
219497
219953
  }
219498
- assert51__default.default(accountId, "Missing accountId");
219954
+ assert52__default.default(accountId, "Missing accountId");
219499
219955
  const title = `__${scriptName}-workers_sites_assets${preview ? "_preview" : ""}`;
219500
219956
  const { id: namespace } = await createKVNamespaceIfNotAlreadyExisting(
219501
219957
  complianceConfig,
@@ -219793,7 +220249,7 @@ async function maybeDelegateToOpenNextDeployCommand(projectRoot) {
219793
220249
  "OpenNext project detected, calling `opennextjs-cloudflare deploy`"
219794
220250
  );
219795
220251
  const deployArgIdx = process.argv.findIndex((arg) => arg === "deploy");
219796
- assert51__default.default(deployArgIdx !== -1, "Could not find `deploy` argument");
220252
+ assert52__default.default(deployArgIdx !== -1, "Could not find `deploy` argument");
219797
220253
  const deployArguments = process.argv.slice(deployArgIdx + 1);
219798
220254
  const { npx } = await getPackageManager();
219799
220255
  await runCommand2(
@@ -220156,6 +220612,11 @@ var init_deploy2 = __esm({
220156
220612
  describe: "Experimental: Enables framework detection and automatic configuration when deploying",
220157
220613
  type: "boolean",
220158
220614
  default: true
220615
+ },
220616
+ "secrets-file": {
220617
+ describe: "Path to a file containing secrets to upload with the deployment (JSON or .env format). Secrets from previous deployments will not be deleted - see `--keep-secrets`",
220618
+ type: "string",
220619
+ requiresArg: true
220159
220620
  }
220160
220621
  },
220161
220622
  behaviour: {
@@ -220307,7 +220768,7 @@ var init_deploy2 = __esm({
220307
220768
  );
220308
220769
  }
220309
220770
  if (!args.dryRun) {
220310
- assert51__default.default(accountId, "Missing account ID");
220771
+ assert52__default.default(accountId, "Missing account ID");
220311
220772
  await verifyWorkerMatchesCITag(
220312
220773
  config,
220313
220774
  accountId,
@@ -220354,7 +220815,8 @@ var init_deploy2 = __esm({
220354
220815
  containersRollout: args.containersRollout,
220355
220816
  strict: args.strict,
220356
220817
  tag: args.tag,
220357
- message: args.message
220818
+ message: args.message,
220819
+ secretsFile: args.secretsFile
220358
220820
  });
220359
220821
  writeOutput({
220360
220822
  type: "deploy",
@@ -220588,8 +221050,8 @@ async function runSearch(searchTerm) {
220588
221050
  hitsPerPage: "1",
220589
221051
  getRankingInfo: "0"
220590
221052
  });
220591
- assert51__default.default(id, "Missing Algolia App ID");
220592
- assert51__default.default(key, "Missing Algolia Key");
221053
+ assert52__default.default(id, "Missing Algolia App ID");
221054
+ assert52__default.default(key, "Missing Algolia Key");
220593
221055
  const searchResp = await (0, import_undici15.fetch)(
220594
221056
  `https://${id}-dsn.algolia.net/1/indexes/${index}/query`,
220595
221057
  {
@@ -222223,7 +222685,7 @@ This action is irreversible and will permanently delete all data in the KV names
222223
222685
  }
222224
222686
  namespaceId = namespace.id;
222225
222687
  }
222226
- assert51.strict(namespaceId, "namespaceId should be defined");
222688
+ assert52.strict(namespaceId, "namespaceId should be defined");
222227
222689
  logger.log(`Renaming KV namespace ${namespaceId} to "${args.newName}".`);
222228
222690
  const updatedNamespace = await updateKVNamespace(
222229
222691
  config,
@@ -227481,7 +227943,7 @@ var require_dist5 = __commonJS({
227481
227943
  };
227482
227944
  Object.defineProperty(exports, "__esModule", { value: true });
227483
227945
  exports.Agent = void 0;
227484
- var net2 = __importStar2(__require("net"));
227946
+ var net3 = __importStar2(__require("net"));
227485
227947
  var http6 = __importStar2(__require("http"));
227486
227948
  var https_1 = __require("https");
227487
227949
  __exportStar2(require_helpers(), exports);
@@ -227524,7 +227986,7 @@ var require_dist5 = __commonJS({
227524
227986
  if (!this.sockets[name2]) {
227525
227987
  this.sockets[name2] = [];
227526
227988
  }
227527
- const fakeSocket = new net2.Socket({ writable: false });
227989
+ const fakeSocket = new net3.Socket({ writable: false });
227528
227990
  this.sockets[name2].push(fakeSocket);
227529
227991
  this.totalSocketCount++;
227530
227992
  return fakeSocket;
@@ -227742,7 +228204,7 @@ var require_dist6 = __commonJS({
227742
228204
  };
227743
228205
  Object.defineProperty(exports, "__esModule", { value: true });
227744
228206
  exports.HttpsProxyAgent = void 0;
227745
- var net2 = __importStar2(__require("net"));
228207
+ var net3 = __importStar2(__require("net"));
227746
228208
  var tls = __importStar2(__require("tls"));
227747
228209
  var assert_1 = __importDefault2(__require("assert"));
227748
228210
  var debug_1 = __importDefault2(require_src3());
@@ -227784,14 +228246,14 @@ var require_dist6 = __commonJS({
227784
228246
  const servername = this.connectOpts.servername || this.connectOpts.host;
227785
228247
  socket = tls.connect({
227786
228248
  ...this.connectOpts,
227787
- servername: servername && net2.isIP(servername) ? void 0 : servername
228249
+ servername: servername && net3.isIP(servername) ? void 0 : servername
227788
228250
  });
227789
228251
  } else {
227790
228252
  debug2("Creating `net.Socket`: %o", this.connectOpts);
227791
- socket = net2.connect(this.connectOpts);
228253
+ socket = net3.connect(this.connectOpts);
227792
228254
  }
227793
228255
  const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
227794
- const host = net2.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
228256
+ const host = net3.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
227795
228257
  let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r
227796
228258
  `;
227797
228259
  if (proxy2.username || proxy2.password) {
@@ -227820,13 +228282,13 @@ var require_dist6 = __commonJS({
227820
228282
  return tls.connect({
227821
228283
  ...omit(opts, "host", "path", "port"),
227822
228284
  socket,
227823
- servername: net2.isIP(servername) ? void 0 : servername
228285
+ servername: net3.isIP(servername) ? void 0 : servername
227824
228286
  });
227825
228287
  }
227826
228288
  return socket;
227827
228289
  }
227828
228290
  socket.destroy();
227829
- const fakeSocket = new net2.Socket({ writable: false });
228291
+ const fakeSocket = new net3.Socket({ writable: false });
227830
228292
  fakeSocket.readable = true;
227831
228293
  req.once("socket", (s7) => {
227832
228294
  debug2("Replaying proxy buffer for failed request");
@@ -230052,22 +230514,16 @@ async function parseBulkInputToObject(input) {
230052
230514
  if (input) {
230053
230515
  secretSource = "file";
230054
230516
  const jsonFilePath = path3__namespace.default.resolve(input);
230517
+ const fileContent = readFileSync(jsonFilePath);
230055
230518
  try {
230056
- const fileContent = readFileSync(jsonFilePath);
230057
- try {
230058
- content = parseJSON(fileContent);
230059
- secretFormat = "json";
230060
- } catch (e9) {
230061
- content = (0, import_dotenv2.parse)(fileContent);
230062
- secretFormat = "dotenv";
230063
- if (Object.keys(content).length === 0) {
230064
- throw e9;
230065
- }
230519
+ content = parseJSON(fileContent);
230520
+ secretFormat = "json";
230521
+ } catch {
230522
+ content = (0, import_dotenv2.parse)(fileContent);
230523
+ secretFormat = "dotenv";
230524
+ if (Object.keys(content).length === 0) {
230525
+ throw new UserError(`The contents of "${input}" is not valid.`);
230066
230526
  }
230067
- } catch (e9) {
230068
- throw new FatalError(
230069
- `The contents of "${input}" is not valid JSON: "${e9}"`
230070
- );
230071
230527
  }
230072
230528
  validateFileSecrets(content, input);
230073
230529
  } else {
@@ -263474,7 +263930,7 @@ async function generateR2ServiceToken(accountId, bucketName, pipelineName) {
263474
263930
  const timeoutPromise = promises.setTimeout(12e4, "timeout", { signal });
263475
263931
  const serverPromise = new Promise((resolve31, reject) => {
263476
263932
  const server = http__namespace.default.createServer(async (request4, response) => {
263477
- assert51__default.default(request4.url, "This request doesn't have a URL");
263933
+ assert52__default.default(request4.url, "This request doesn't have a URL");
263478
263934
  if (request4.method !== "GET") {
263479
263935
  response.writeHead(405);
263480
263936
  response.end("Method not allowed.");
@@ -277350,9 +277806,11 @@ var init_create10 = __esm({
277350
277806
  let indexConfig;
277351
277807
  if (args.preset) {
277352
277808
  indexConfig = { preset: args.preset };
277353
- logger.log(
277354
- `Configuring index based for the embedding model ${args.preset}.`
277355
- );
277809
+ if (!args.json) {
277810
+ logger.log(
277811
+ `Configuring index based for the embedding model ${args.preset}.`
277812
+ );
277813
+ }
277356
277814
  } else if (args.dimensions && args.metric) {
277357
277815
  indexConfig = {
277358
277816
  metric: args.metric,
@@ -277363,7 +277821,7 @@ var init_create10 = __esm({
277363
277821
  "\u{1F6A8} You must provide both dimensions and a metric, or a known model preset when creating an index."
277364
277822
  );
277365
277823
  }
277366
- if (args.deprecatedV1) {
277824
+ if (args.deprecatedV1 && !args.json) {
277367
277825
  logger.warn(
277368
277826
  "Creation of legacy Vectorize indexes will be blocked by December 2024"
277369
277827
  );
@@ -277373,7 +277831,9 @@ var init_create10 = __esm({
277373
277831
  description: args.description,
277374
277832
  config: indexConfig
277375
277833
  };
277376
- logger.log(`\u{1F6A7} Creating index: '${args.name}'`);
277834
+ if (!args.json) {
277835
+ logger.log(`\u{1F6A7} Creating index: '${args.name}'`);
277836
+ }
277377
277837
  const indexResult = await createIndex(config, index, args.deprecatedV1);
277378
277838
  let bindingName;
277379
277839
  if (args.deprecatedV1) {
@@ -277382,7 +277842,7 @@ var init_create10 = __esm({
277382
277842
  bindingName = "VECTORIZE";
277383
277843
  }
277384
277844
  if (args.json) {
277385
- logger.log(JSON.stringify(index, null, 2));
277845
+ logger.log(JSON.stringify(indexResult, null, 2));
277386
277846
  return;
277387
277847
  }
277388
277848
  logger.log(
@@ -277752,7 +278212,9 @@ var init_info4 = __esm({
277752
278212
  },
277753
278213
  positionalArgs: ["name"],
277754
278214
  async handler(args, { config }) {
277755
- logger.log(`\u{1F4CB} Fetching index info...`);
278215
+ if (!args.json) {
278216
+ logger.log(`\u{1F4CB} Fetching index info...`);
278217
+ }
277756
278218
  const info = await indexInfo(config, args.name);
277757
278219
  if (args.json) {
277758
278220
  logger.log(JSON.stringify(info, null, 2));
@@ -277844,20 +278306,26 @@ var init_insert = __esm({
277844
278306
  })
277845
278307
  );
277846
278308
  if (args.deprecatedV1) {
277847
- logger.log(`\u2728 Uploading vector batch (${batch.length} vectors)`);
278309
+ if (!args.json) {
278310
+ logger.log(`\u2728 Uploading vector batch (${batch.length} vectors)`);
278311
+ }
277848
278312
  const idxPart = await insertIntoIndexV1(config, args.name, formData);
277849
278313
  vectorInsertCount += idxPart.count;
277850
278314
  } else {
277851
278315
  const mutation = await insertIntoIndex(config, args.name, formData);
277852
278316
  vectorInsertCount += batch.length;
277853
- logger.log(
277854
- `\u2728 Enqueued ${batch.length} vectors into index '${args.name}' for insertion. Mutation changeset identifier: ${mutation.mutationId}`
277855
- );
278317
+ if (!args.json) {
278318
+ logger.log(
278319
+ `\u2728 Enqueued ${batch.length} vectors into index '${args.name}' for insertion. Mutation changeset identifier: ${mutation.mutationId}`
278320
+ );
278321
+ }
277856
278322
  }
277857
278323
  if (vectorInsertCount > VECTORIZE_MAX_UPSERT_VECTOR_RECORDS) {
277858
- logger.warn(
277859
- `\u{1F6A7} While Vectorize is in beta, we've limited uploads to 100k vectors per run. You may run this again with another batch to upload further`
277860
- );
278324
+ if (!args.json) {
278325
+ logger.warn(
278326
+ `\u{1F6A7} While Vectorize is in beta, we've limited uploads to 100k vectors per run. You may run this again with another batch to upload further`
278327
+ );
278328
+ }
277861
278329
  break;
277862
278330
  }
277863
278331
  }
@@ -277912,8 +278380,14 @@ var init_list10 = __esm({
277912
278380
  }
277913
278381
  },
277914
278382
  async handler(args, { config }) {
277915
- logger.log(`\u{1F4CB} Listing Vectorize indexes...`);
278383
+ if (!args.json) {
278384
+ logger.log(`\u{1F4CB} Listing Vectorize indexes...`);
278385
+ }
277916
278386
  const indexes = await listIndexes(config, args.deprecatedV1);
278387
+ if (args.json) {
278388
+ logger.log(JSON.stringify(indexes, null, 2));
278389
+ return;
278390
+ }
277917
278391
  if (indexes.length === 0) {
277918
278392
  logger.warn(`
277919
278393
  You haven't created any indexes on this account.
@@ -277923,10 +278397,6 @@ https://developers.cloudflare.com/vectorize/ to get started.
277923
278397
  `);
277924
278398
  return;
277925
278399
  }
277926
- if (args.json) {
277927
- logger.log(JSON.stringify(indexes, null, 2));
277928
- return;
277929
- }
277930
278400
  logger.table(
277931
278401
  indexes.map((index) => ({
277932
278402
  name: index.name,
@@ -277973,8 +278443,14 @@ var init_listMetadataIndex = __esm({
277973
278443
  },
277974
278444
  positionalArgs: ["name"],
277975
278445
  async handler(args, { config }) {
277976
- logger.log(`\u{1F4CB} Fetching metadata indexes...`);
278446
+ if (!args.json) {
278447
+ logger.log(`\u{1F4CB} Fetching metadata indexes...`);
278448
+ }
277977
278449
  const res = await listMetadataIndex(config, args.name);
278450
+ if (args.json) {
278451
+ logger.log(JSON.stringify(res.metadataIndexes, null, 2));
278452
+ return;
278453
+ }
277978
278454
  if (res.metadataIndexes.length === 0) {
277979
278455
  logger.warn(`
277980
278456
  You haven't created any metadata indexes on this account.
@@ -277984,10 +278460,6 @@ https://developers.cloudflare.com/vectorize/ to get started.
277984
278460
  `);
277985
278461
  return;
277986
278462
  }
277987
- if (args.json) {
277988
- logger.log(JSON.stringify(res.metadataIndexes, null, 2));
277989
- return;
277990
- }
277991
278463
  logger.table(
277992
278464
  res.metadataIndexes.map((index) => ({
277993
278465
  propertyName: index.propertyName,
@@ -278063,14 +278535,14 @@ var init_listVectors = __esm({
278063
278535
  options.cursor = args.cursor;
278064
278536
  }
278065
278537
  const result = await listVectors(config, args.name, options);
278066
- if (result.vectors.length === 0) {
278067
- logger.warn("No vectors found in this index.");
278068
- return;
278069
- }
278070
278538
  if (args.json) {
278071
278539
  logger.log(JSON.stringify(result, null, 2));
278072
278540
  return;
278073
278541
  }
278542
+ if (result.vectors.length === 0) {
278543
+ logger.warn("No vectors found in this index.");
278544
+ return;
278545
+ }
278074
278546
  logger.table(
278075
278547
  result.vectors.map((vector, index) => ({
278076
278548
  "#": (index + 1).toString(),
@@ -278352,14 +278824,18 @@ var init_upsert = __esm({
278352
278824
  {
278353
278825
  const mutation = await upsertIntoIndex(config, args.name, formData);
278354
278826
  vectorUpsertCount += batch.length;
278355
- logger.log(
278356
- `\u2728 Enqueued ${batch.length} vectors into index '${args.name}' for upsertion. Mutation changeset identifier: ${mutation.mutationId}`
278357
- );
278827
+ if (!args.json) {
278828
+ logger.log(
278829
+ `\u2728 Enqueued ${batch.length} vectors into index '${args.name}' for upsertion. Mutation changeset identifier: ${mutation.mutationId}`
278830
+ );
278831
+ }
278358
278832
  }
278359
278833
  if (vectorUpsertCount > VECTORIZE_MAX_UPSERT_VECTOR_RECORDS) {
278360
- logger.warn(
278361
- `\u{1F6A7} While Vectorize is in beta, we've limited uploads to 100k vectors per run. You may run this again with another batch to upload further`
278362
- );
278834
+ if (!args.json) {
278835
+ logger.warn(
278836
+ `\u{1F6A7} While Vectorize is in beta, we've limited uploads to 100k vectors per run. You may run this again with another batch to upload further`
278837
+ );
278838
+ }
278363
278839
  break;
278364
278840
  }
278365
278841
  }
@@ -278521,13 +278997,13 @@ ${ZERO_WIDTH_SPACE} Message: ${version5.annotations?.["workers/message"]
278521
278997
  },
278522
278998
  renderers: {
278523
278999
  submit({ value: versionIds }) {
278524
- assert51__default.default(Array.isArray(versionIds));
279000
+ assert52__default.default(Array.isArray(versionIds));
278525
279001
  const label = brandColor(
278526
279002
  `${versionIds.length} Worker Version(s) selected`
278527
279003
  );
278528
279004
  const versions2 = versionIds?.map((versionId, i7) => {
278529
279005
  const version5 = versionCache.get(versionId);
278530
- assert51__default.default(version5);
279006
+ assert52__default.default(version5);
278531
279007
  return `${grayBar}
278532
279008
  ${leftT} ${white(` Worker Version ${i7 + 1}: `, version5.id)}
278533
279009
  ${grayBar} ${gray(" Created: ", version5.metadata.created_on)}
@@ -279153,7 +279629,7 @@ var init_list12 = __esm({
279153
279629
  const formattedDeployments = deployments.map((deployment) => {
279154
279630
  const formattedVersions = deployment.versions.map((traffic) => {
279155
279631
  const version5 = versionCache.get(traffic.version_id);
279156
- assert51__default.default(version5);
279632
+ assert52__default.default(version5);
279157
279633
  const percentage = brandColor(`(${traffic.percentage}%)`);
279158
279634
  const details = formatLabelledValues(
279159
279635
  {
@@ -279258,7 +279734,7 @@ var init_status3 = __esm({
279258
279734
  );
279259
279735
  const formattedVersions = latestDeployment.versions.map((traffic) => {
279260
279736
  const version5 = versionCache.get(traffic.version_id);
279261
- assert51__default.default(version5);
279737
+ assert52__default.default(version5);
279262
279738
  const percentage = brandColor(`(${traffic.percentage}%)`);
279263
279739
  const details = formatLabelledValues(
279264
279740
  {
@@ -280166,7 +280642,7 @@ var init_log_build_output = __esm({
280166
280642
  });
280167
280643
  async function getMigrationsToUpload(scriptName, props) {
280168
280644
  const { config, accountId } = props;
280169
- assert51__default.default(accountId, "Missing accountId");
280645
+ assert52__default.default(accountId, "Missing accountId");
280170
280646
  let migrations;
280171
280647
  if (config.migrations.length > 0) {
280172
280648
  let script;
@@ -280509,6 +280985,19 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
280509
280985
  props.assetsOptions.directory,
280510
280986
  scriptName
280511
280987
  ) : void 0;
280988
+ if (props.secretsFile) {
280989
+ const secretsResult = await parseBulkInputToObject(props.secretsFile);
280990
+ if (secretsResult) {
280991
+ for (const [secretName, secretValue] of Object.entries(
280992
+ secretsResult.content
280993
+ )) {
280994
+ bindings[secretName] = {
280995
+ type: "secret_text",
280996
+ value: secretValue
280997
+ };
280998
+ }
280999
+ }
281000
+ }
280512
281001
  const placement = parseConfigPlacement(config);
280513
281002
  const entryPointName = path3__namespace.default.basename(resolvedEntryPointPath);
280514
281003
  const main2 = {
@@ -280527,8 +281016,9 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
280527
281016
  compatibility_date: compatibilityDate,
280528
281017
  compatibility_flags: compatibilityFlags,
280529
281018
  keepVars: props.keepVars ?? false,
281019
+ // we never delete secret bindings when uploading, even if we are setting secrets from a file
281020
+ // so inherit all unchanged secrets from the previous Worker Version
280530
281021
  keepSecrets: true,
280531
- // until wrangler.toml specifies secret bindings, we need to inherit from the previous Worker Version
280532
281022
  placement,
280533
281023
  tail_consumers: config.tail_consumers,
280534
281024
  limits: config.limits,
@@ -280574,7 +281064,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
280574
281064
  { unsafeMetadata: config.unsafe?.metadata }
280575
281065
  );
280576
281066
  } else {
280577
- assert51__default.default(accountId, "Missing accountId");
281067
+ assert52__default.default(accountId, "Missing accountId");
280578
281068
  if (getFlag("RESOURCES_PROVISION")) {
280579
281069
  await provisionBindings(
280580
281070
  bindings,
@@ -280799,6 +281289,7 @@ var init_upload5 = __esm({
280799
281289
  init_paths();
280800
281290
  init_client9();
280801
281291
  init_routes6();
281292
+ init_secret();
280802
281293
  init_sourcemap();
280803
281294
  init_user3();
280804
281295
  init_collectKeyValues();
@@ -280966,6 +281457,11 @@ var init_upload5 = __esm({
280966
281457
  default: true,
280967
281458
  hidden: true,
280968
281459
  alias: "x-auto-create"
281460
+ },
281461
+ "secrets-file": {
281462
+ describe: "Path to a file containing secrets to upload with the version (JSON or .env format). Secrets from previous deployments will not be deleted - see `--keep-secrets`",
281463
+ type: "string",
281464
+ requiresArg: true
280969
281465
  }
280970
281466
  },
280971
281467
  behaviour: {
@@ -281036,7 +281532,7 @@ var init_upload5 = __esm({
281036
281532
  }
281037
281533
  const previewAlias = args.previewAlias ?? (getCIGeneratePreviewAlias() === "true" ? generatePreviewAlias(name2) : void 0);
281038
281534
  if (!args.dryRun) {
281039
- assert51__default.default(accountId, "Missing account ID");
281535
+ assert52__default.default(accountId, "Missing account ID");
281040
281536
  await verifyWorkerMatchesCITag(
281041
281537
  config,
281042
281538
  accountId,
@@ -281073,7 +281569,8 @@ var init_upload5 = __esm({
281073
281569
  message: args.message,
281074
281570
  previewAlias,
281075
281571
  experimentalAutoCreate: args.experimentalAutoCreate,
281076
- outFile: args.outfile
281572
+ outFile: args.outfile,
281573
+ secretsFile: args.secretsFile
281077
281574
  });
281078
281575
  writeOutput({
281079
281576
  type: "version-upload",
@@ -281365,8 +281862,49 @@ var init_vpc = __esm({
281365
281862
  };
281366
281863
  }
281367
281864
  });
281368
-
281369
- // src/vpc/validation.ts
281865
+ function validateHostname(hostname2) {
281866
+ const trimmed = hostname2.trim();
281867
+ if (trimmed.length === 0) {
281868
+ throw new UserError("Hostname cannot be empty.");
281869
+ }
281870
+ const errors = [];
281871
+ if (trimmed.length > 253) {
281872
+ errors.push("Hostname is too long. Maximum length is 253 characters.");
281873
+ }
281874
+ const hasScheme = trimmed.includes("://");
281875
+ if (hasScheme) {
281876
+ errors.push(
281877
+ "Hostname must not include a URL scheme (e.g., remove 'https://')."
281878
+ );
281879
+ }
281880
+ const afterScheme = hasScheme ? trimmed.slice(trimmed.indexOf("://") + 3) : trimmed;
281881
+ if (afterScheme.includes("/")) {
281882
+ errors.push(
281883
+ "Hostname must not include a path. Provide only the hostname (e.g., 'api.example.com')."
281884
+ );
281885
+ }
281886
+ const bareValue = trimmed.replace(/^\[|\]$/g, "");
281887
+ const isIpAddress2 = net__default.default.isIPv4(trimmed) || net__default.default.isIPv6(bareValue);
281888
+ if (isIpAddress2) {
281889
+ errors.push(
281890
+ "Hostname must not be an IP address. Use --ipv4 or --ipv6 instead."
281891
+ );
281892
+ }
281893
+ if (!isIpAddress2 && !hasScheme && trimmed.includes(":")) {
281894
+ errors.push(
281895
+ "Hostname must not include a port number. Provide only the hostname and use --http-port or --https-port for ports."
281896
+ );
281897
+ }
281898
+ if (/\s/.test(trimmed)) {
281899
+ errors.push("Hostname must not contain whitespace.");
281900
+ }
281901
+ if (errors.length > 0) {
281902
+ throw new UserError(
281903
+ `Invalid hostname '${trimmed}':
281904
+ ${errors.map((e9) => ` - ${e9}`).join("\n")}`
281905
+ );
281906
+ }
281907
+ }
281370
281908
  function validateRequest(args) {
281371
281909
  const hasIpAddresses = Boolean(args.ipv4 || args.ipv6);
281372
281910
  const hasHostname = Boolean(args.hostname);
@@ -281375,11 +281913,35 @@ function validateRequest(args) {
281375
281913
  "Must specify either IP addresses (--ipv4/--ipv6) or hostname (--hostname)"
281376
281914
  );
281377
281915
  }
281916
+ if (args.ipv4 && !net__default.default.isIPv4(args.ipv4)) {
281917
+ throw new UserError(
281918
+ `Invalid IPv4 address: '${args.ipv4}'. Provide a valid IPv4 address (e.g., '192.168.1.1').`
281919
+ );
281920
+ }
281921
+ if (args.ipv6 && !net__default.default.isIPv6(args.ipv6)) {
281922
+ throw new UserError(
281923
+ `Invalid IPv6 address: '${args.ipv6}'. Provide a valid IPv6 address (e.g., '2001:db8::1').`
281924
+ );
281925
+ }
281926
+ if (hasHostname && args.hostname) {
281927
+ validateHostname(args.hostname);
281928
+ }
281929
+ if (args.resolverIps) {
281930
+ const ips = args.resolverIps.split(",").map((ip) => ip.trim());
281931
+ const invalidIps = ips.filter(
281932
+ (ip) => ip.length > 0 && !net__default.default.isIPv4(ip) && !net__default.default.isIPv6(ip)
281933
+ );
281934
+ if (invalidIps.length > 0) {
281935
+ throw new UserError(
281936
+ `Invalid resolver IP address(es): ${invalidIps.map((ip) => `'${ip}'`).join(", ")}. Provide valid IPv4 or IPv6 addresses.`
281937
+ );
281938
+ }
281939
+ }
281378
281940
  }
281379
281941
  function buildRequest(args) {
281380
281942
  let resolverIpsList = void 0;
281381
281943
  if (args.resolverIps) {
281382
- resolverIpsList = args.resolverIps.split(",").map((ip) => ip.trim());
281944
+ resolverIpsList = args.resolverIps.split(",").map((ip) => ip.trim()).filter((ip) => ip.length > 0);
281383
281945
  }
281384
281946
  const host = {
281385
281947
  ipv4: args.ipv4,
@@ -281412,6 +281974,7 @@ var init_validation3 = __esm({
281412
281974
  init_import_meta_url();
281413
281975
  init_dist();
281414
281976
  init_vpc();
281977
+ __name(validateHostname, "validateHostname");
281415
281978
  __name(validateRequest, "validateRequest");
281416
281979
  __name(buildRequest, "buildRequest");
281417
281980
  }
@@ -286455,6 +287018,10 @@ function createCLIParser(argv) {
286455
287018
  { command: "wrangler containers", definition: containersNamespace },
286456
287019
  { command: "wrangler containers list", definition: containersListCommand },
286457
287020
  { command: "wrangler containers info", definition: containersInfoCommand },
287021
+ {
287022
+ command: "wrangler containers instances",
287023
+ definition: containersInstancesCommand
287024
+ },
286458
287025
  {
286459
287026
  command: "wrangler containers delete",
286460
287027
  definition: containersDeleteCommand
@@ -287396,7 +287963,7 @@ Error: ${errorMessage}
287396
287963
  if (e9.cause instanceof ApiError) {
287397
287964
  logger.error(e9.cause);
287398
287965
  } else {
287399
- assert51__default.default(isAuthenticationError(e9));
287966
+ assert52__default.default(isAuthenticationError(e9));
287400
287967
  logger.error(e9);
287401
287968
  }
287402
287969
  const envAuth = getAuthFromEnv();
@@ -287980,10 +288547,10 @@ var require_difflib = __commonJS({
287980
288547
  "../../node_modules/.pnpm/@ewoudenberg+difflib@0.1.0/node_modules/@ewoudenberg/difflib/lib/difflib.js"(exports) {
287981
288548
  init_import_meta_url();
287982
288549
  (function() {
287983
- var Differ, Heap, IS_CHARACTER_JUNK, IS_LINE_JUNK, SequenceMatcher, _any, _arrayCmp, _calculateRatio, _countLeading, _formatRangeContext, _formatRangeUnified, _has, assert59, contextDiff, floor, getCloseMatches, max, min, ndiff, restore, unifiedDiff, indexOf = [].indexOf;
288550
+ var Differ, Heap, IS_CHARACTER_JUNK, IS_LINE_JUNK, SequenceMatcher, _any, _arrayCmp, _calculateRatio, _countLeading, _formatRangeContext, _formatRangeUnified, _has, assert60, contextDiff, floor, getCloseMatches, max, min, ndiff, restore, unifiedDiff, indexOf = [].indexOf;
287984
288551
  ({ floor, max, min } = Math);
287985
288552
  Heap = require_heap2();
287986
- assert59 = __require("assert");
288553
+ assert60 = __require("assert");
287987
288554
  _calculateRatio = /* @__PURE__ */ __name(function(matches, length) {
287988
288555
  if (length) {
287989
288556
  return 2 * matches / length;
@@ -288554,7 +289121,7 @@ var require_difflib = __commonJS({
288554
289121
  }
288555
289122
  _plainReplace(a7, alo, ahi, b11, blo, bhi) {
288556
289123
  var first, g7, l8, len, len1, line, lines, m7, ref, second;
288557
- assert59(alo < ahi && blo < bhi);
289124
+ assert60(alo < ahi && blo < bhi);
288558
289125
  if (bhi - blo < ahi - alo) {
288559
289126
  first = this._dump("+", b11, blo, bhi);
288560
289127
  second = this._dump("-", a7, alo, ahi);
@@ -290373,10 +290940,10 @@ function populateConfigPatch(diff, patchObj, targetEnvironment) {
290373
290940
  return;
290374
290941
  }
290375
290942
  if (Array.isArray(diff)) {
290376
- assert51__default.default(Array.isArray(patchObj));
290943
+ assert52__default.default(Array.isArray(patchObj));
290377
290944
  return populateConfigPatchArray(diff, patchObj);
290378
290945
  }
290379
- assert51__default.default(!Array.isArray(patchObj));
290946
+ assert52__default.default(!Array.isArray(patchObj));
290380
290947
  return populateConfigPatchObject(diff, patchObj, targetEnvironment);
290381
290948
  }
290382
290949
  function populateConfigPatchArray(diff, patchArray) {
@@ -290756,7 +291323,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
290756
291323
  );
290757
291324
  }
290758
291325
  const scriptName = props.name;
290759
- assert51__default.default(
291326
+ assert52__default.default(
290760
291327
  !config.site || config.site.bucket,
290761
291328
  "A [site] definition requires a `bucket` field with a path to the site's assets directory."
290762
291329
  );
@@ -290936,6 +291503,19 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
290936
291503
  hidden: true
290937
291504
  };
290938
291505
  }
291506
+ if (props.secretsFile) {
291507
+ const secretsResult = await parseBulkInputToObject(props.secretsFile);
291508
+ if (secretsResult) {
291509
+ for (const [secretName, secretValue] of Object.entries(
291510
+ secretsResult.content
291511
+ )) {
291512
+ bindings[secretName] = {
291513
+ type: "secret_text",
291514
+ value: secretValue
291515
+ };
291516
+ }
291517
+ }
291518
+ }
290939
291519
  if (workersSitesAssets.manifest) {
290940
291520
  modules.push({
290941
291521
  name: "__STATIC_CONTENT_MANIFEST",
@@ -290962,8 +291542,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
290962
291542
  compatibility_date: compatibilityDate,
290963
291543
  compatibility_flags: compatibilityFlags,
290964
291544
  keepVars,
290965
- keepSecrets: keepVars,
290966
- // keepVars implies keepSecrets
291545
+ keepSecrets: keepVars || !!props.secretsFile,
290967
291546
  logpush: props.logpush !== void 0 ? props.logpush : config.logpush,
290968
291547
  placement,
290969
291548
  tail_consumers: config.tail_consumers,
@@ -291037,7 +291616,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
291037
291616
  { warnIfNoBindings: true, unsafeMetadata: config.unsafe?.metadata }
291038
291617
  );
291039
291618
  } else {
291040
- assert51__default.default(accountId, "Missing accountId");
291619
+ assert52__default.default(accountId, "Missing accountId");
291041
291620
  if (getFlag("RESOURCES_PROVISION")) {
291042
291621
  await provisionBindings(
291043
291622
  bindings ?? {},
@@ -291247,7 +291826,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
291247
291826
  return { versionId, workerTag };
291248
291827
  }
291249
291828
  if (normalisedContainerConfig.length) {
291250
- assert51__default.default(versionId && accountId);
291829
+ assert52__default.default(versionId && accountId);
291251
291830
  await deployContainers(config, normalisedContainerConfig, {
291252
291831
  versionId,
291253
291832
  accountId,
@@ -291525,6 +292104,7 @@ var init_deploy7 = __esm({
291525
292104
  init_navigator_user_agent();
291526
292105
  init_paths();
291527
292106
  init_client9();
292107
+ init_secret();
291528
292108
  init_sites2();
291529
292109
  init_sourcemap();
291530
292110
  init_deploy5();
@@ -291767,20 +292347,23 @@ var init_assets5 = __esm({
291767
292347
  MAX_UPLOAD_GATEWAY_ERRORS2 = 5;
291768
292348
  MAX_DIFF_LINES2 = 100;
291769
292349
  syncAssets = /* @__PURE__ */ __name(async (complianceConfig, accountId, assetDirectory, scriptName, dispatchNamespace) => {
291770
- assert51__default.default(accountId, "Missing accountId");
292350
+ assert52__default.default(accountId, "Missing accountId");
291771
292351
  logger.info("\u{1F300} Building list of assets...");
291772
292352
  const manifest = await buildAssetManifest(assetDirectory);
291773
292353
  const url4 = dispatchNamespace ? `/accounts/${accountId}/workers/dispatch/namespaces/${dispatchNamespace}/scripts/${scriptName}/assets-upload-session` : `/accounts/${accountId}/workers/scripts/${scriptName}/assets-upload-session`;
291774
292354
  logger.info("\u{1F300} Starting asset upload...");
291775
- const initializeAssetsResponse = await fetchResult(
291776
- complianceConfig,
291777
- url4,
291778
- {
291779
- headers: { "Content-Type": "application/json" },
291780
- method: "POST",
291781
- body: JSON.stringify({ manifest })
291782
- }
291783
- );
292355
+ const initializeAssetsResponse = await fetchResult(complianceConfig, url4, {
292356
+ headers: { "Content-Type": "application/json" },
292357
+ method: "POST",
292358
+ body: JSON.stringify({ manifest })
292359
+ });
292360
+ if (!initializeAssetsResponse) {
292361
+ throw new FatalError(
292362
+ "An unexpected response has been received from the Cloudflare API for assets upload. Please try again.",
292363
+ 1,
292364
+ { telemetryMessage: true }
292365
+ );
292366
+ }
291784
292367
  if (initializeAssetsResponse.buckets.flat().length === 0) {
291785
292368
  if (!initializeAssetsResponse.jwt) {
291786
292369
  throw new FatalError(
@@ -292368,7 +292951,7 @@ var init_dev2 = __esm({
292368
292951
  },
292369
292952
  async handler(args) {
292370
292953
  const devInstance = await startDev(args);
292371
- assert51__default.default(devInstance.devEnv !== void 0);
292954
+ assert52__default.default(devInstance.devEnv !== void 0);
292372
292955
  await events__default.default.once(devInstance.devEnv, "teardown");
292373
292956
  await Promise.all(devInstance.secondary.map((d8) => d8.teardown()));
292374
292957
  if (devInstance.teardownRegistryPromise) {
@@ -292440,7 +293023,7 @@ function runBuild({
292440
293023
  async function updateBundle() {
292441
293024
  const newAdditionalModules = await getAdditionalModules();
292442
293025
  setBundle((previousBundle) => {
292443
- assert51__default.default(
293026
+ assert52__default.default(
292444
293027
  previousBundle,
292445
293028
  "Rebuild triggered with no previous build available"
292446
293029
  );
@@ -292591,7 +293174,7 @@ var init_BundlerController = __esm({
292591
293174
  if (buildAborter.signal.aborted) {
292592
293175
  return;
292593
293176
  }
292594
- assert51__default.default(this.#tmpDir);
293177
+ assert52__default.default(this.#tmpDir);
292595
293178
  if (!config.build?.bundle) {
292596
293179
  const destinationDir = this.#tmpDir.path;
292597
293180
  fs23.writeFileSync(
@@ -292709,7 +293292,7 @@ var init_BundlerController = __esm({
292709
293292
  return;
292710
293293
  }
292711
293294
  const pathsToWatch = config.build.custom.watch;
292712
- assert51__default.default(pathsToWatch, "config.build.custom.watch");
293295
+ assert52__default.default(pathsToWatch, "config.build.custom.watch");
292713
293296
  this.#customBuildWatcher = watch(pathsToWatch, {
292714
293297
  persistent: true,
292715
293298
  // The initial custom build is always done in getEntry()
@@ -292733,7 +293316,7 @@ var init_BundlerController = __esm({
292733
293316
  if (config.build?.custom?.command) {
292734
293317
  return;
292735
293318
  }
292736
- assert51__default.default(this.#tmpDir);
293319
+ assert52__default.default(this.#tmpDir);
292737
293320
  const entry = {
292738
293321
  file: config.entrypoint,
292739
293322
  projectRoot: config.projectRoot,
@@ -293130,7 +293713,7 @@ async function resolveDevConfig(config, input) {
293130
293713
  );
293131
293714
  if (input.dev?.remote) {
293132
293715
  const { accountId } = await auth();
293133
- assert51__default.default(accountId, "Account ID must be provided for remote dev");
293716
+ assert52__default.default(accountId, "Account ID must be provided for remote dev");
293134
293717
  await getZoneIdForPreview(config, { host, routes, accountId });
293135
293718
  }
293136
293719
  const initialIp = input.dev?.server?.hostname ?? config.dev.ip;
@@ -293444,7 +294027,7 @@ var init_ConfigController = __esm({
293444
294027
  return;
293445
294028
  }
293446
294029
  logger.debug(`${path3__namespace.default.basename(configPath)} changed...`);
293447
- assert51__default.default(
294030
+ assert52__default.default(
293448
294031
  this.latestInput,
293449
294032
  "Cannot be watching config without having first set an input"
293450
294033
  );
@@ -293470,7 +294053,7 @@ var init_ConfigController = __esm({
293470
294053
  }
293471
294054
  patch(input) {
293472
294055
  logger.debug("patching config");
293473
- assert51__default.default(
294056
+ assert52__default.default(
293474
294057
  this.latestInput,
293475
294058
  "Cannot call updateConfig without previously calling setConfig"
293476
294059
  );
@@ -293634,7 +294217,7 @@ function maybeGetSourceMappingURL(sourcePath) {
293634
294217
  return;
293635
294218
  }
293636
294219
  const sourceMappingURLMatch = source.substring(sourceMappingURLIndex).match(/^\/\/# sourceMappingURL=(.+)/);
293637
- assert51__default.default(sourceMappingURLMatch !== null);
294220
+ assert52__default.default(sourceMappingURLMatch !== null);
293638
294221
  const sourceMappingURLSpecifier = sourceMappingURLMatch[1];
293639
294222
  const sourceURL = Url.pathToFileURL(sourcePath);
293640
294223
  try {
@@ -293952,7 +294535,7 @@ var init_ProxyController = __esm({
293952
294535
  if (this._torndown) {
293953
294536
  return;
293954
294537
  }
293955
- assert51__default.default(this.latestConfig !== void 0);
294538
+ assert52__default.default(this.latestConfig !== void 0);
293956
294539
  const cert = this.latestConfig.dev?.server?.secure || this.inspectorEnabled && this.latestConfig.dev?.inspector && this.latestConfig.dev?.inspector?.secure ? validateHttpsOptions(
293957
294540
  this.latestConfig.dev.server?.httpsKeyPath,
293958
294541
  this.latestConfig.dev.server?.httpsCertPath
@@ -294012,7 +294595,7 @@ var init_ProxyController = __esm({
294012
294595
  liveReload: false
294013
294596
  };
294014
294597
  if (this.inspectorEnabled) {
294015
- assert51__default.default(this.latestConfig.dev?.inspector);
294598
+ assert52__default.default(this.latestConfig.dev?.inspector);
294016
294599
  proxyWorkerOptions.workers.push({
294017
294600
  name: "InspectorProxyWorker",
294018
294601
  compatibilityDate: "2023-12-18",
@@ -294077,7 +294660,7 @@ var init_ProxyController = __esm({
294077
294660
  inspectorUrl
294078
294661
  ]);
294079
294662
  }).then(([url4, inspectorUrl]) => {
294080
- assert51__default.default(url4);
294663
+ assert52__default.default(url4);
294081
294664
  this.emitReadyEvent(proxyWorker, url4, inspectorUrl);
294082
294665
  }).catch((error2) => {
294083
294666
  if (this._torndown) {
@@ -294094,7 +294677,7 @@ var init_ProxyController = __esm({
294094
294677
  if (this._torndown) {
294095
294678
  return;
294096
294679
  }
294097
- assert51__default.default(
294680
+ assert52__default.default(
294098
294681
  this.latestConfig?.dev.inspector !== false,
294099
294682
  "Trying to reconnect with inspector proxy worker when inspector is disabled"
294100
294683
  );
@@ -294105,7 +294688,7 @@ var init_ProxyController = __esm({
294105
294688
  this.inspectorProxyWorkerWebSocket = createDeferred();
294106
294689
  let webSocket = null;
294107
294690
  try {
294108
- assert51__default.default(this.proxyWorker);
294691
+ assert52__default.default(this.proxyWorker);
294109
294692
  const inspectorProxyWorkerUrl = await this.proxyWorker.unsafeGetDirectURL(
294110
294693
  "InspectorProxyWorker"
294111
294694
  );
@@ -294125,12 +294708,12 @@ var init_ProxyController = __esm({
294125
294708
  this.emitErrorEvent("Could not connect to InspectorProxyWorker", error2);
294126
294709
  return;
294127
294710
  }
294128
- assert51__default.default(
294711
+ assert52__default.default(
294129
294712
  webSocket,
294130
294713
  "Expected webSocket on response from inspectorProxyWorker"
294131
294714
  );
294132
294715
  webSocket.addEventListener("message", (event) => {
294133
- assert51__default.default(typeof event.data === "string");
294716
+ assert52__default.default(typeof event.data === "string");
294134
294717
  this.onInspectorProxyWorkerMessage(JSON.parse(event.data));
294135
294718
  });
294136
294719
  webSocket.addEventListener("close", () => {
@@ -294185,13 +294768,13 @@ var init_ProxyController = __esm({
294185
294768
  if (this._torndown) {
294186
294769
  return;
294187
294770
  }
294188
- assert51__default.default(
294771
+ assert52__default.default(
294189
294772
  this.latestConfig?.dev.inspector !== false,
294190
294773
  "Trying to send message to inspector proxy worker when inspector is disabled"
294191
294774
  );
294192
294775
  try {
294193
294776
  const websocket = await this.reconnectInspectorProxyWorker();
294194
- assert51__default.default(websocket);
294777
+ assert52__default.default(websocket);
294195
294778
  websocket.send(JSON.stringify(message));
294196
294779
  } catch (cause) {
294197
294780
  if (this._torndown) {
@@ -294264,7 +294847,7 @@ var init_ProxyController = __esm({
294264
294847
  }
294265
294848
  }
294266
294849
  onInspectorProxyWorkerMessage(message) {
294267
- assert51__default.default(
294850
+ assert52__default.default(
294268
294851
  this.latestConfig?.dev.inspector !== false,
294269
294852
  "Trying to handle inspector message when inspector is disabled"
294270
294853
  );
@@ -294287,7 +294870,7 @@ var init_ProxyController = __esm({
294287
294870
  }
294288
294871
  }
294289
294872
  async onInspectorProxyWorkerRequest(message) {
294290
- assert51__default.default(
294873
+ assert52__default.default(
294291
294874
  this.latestConfig?.dev.inspector !== false,
294292
294875
  "Trying to handle inspector request when inspector is disabled"
294293
294876
  );
@@ -294308,8 +294891,8 @@ var init_ProxyController = __esm({
294308
294891
  logger.debug("[InspectorProxyWorker]", ...message.args);
294309
294892
  break;
294310
294893
  case "load-network-resource": {
294311
- assert51__default.default(this.latestConfig !== void 0);
294312
- assert51__default.default(this.latestBundle !== void 0);
294894
+ assert52__default.default(this.latestConfig !== void 0);
294895
+ assert52__default.default(this.latestBundle !== void 0);
294313
294896
  let maybeContents;
294314
294897
  if (message.url.startsWith("wrangler-file:")) {
294315
294898
  maybeContents = maybeHandleNetworkLoadResource(
@@ -294563,7 +295146,7 @@ var init_isAbortError = __esm({
294563
295146
  }
294564
295147
  });
294565
295148
  function handlePreviewSessionUploadError(err, accountId) {
294566
- assert51__default.default(err && typeof err === "object");
295149
+ assert52__default.default(err && typeof err === "object");
294567
295150
  if (!isAbortError(err)) {
294568
295151
  if ("code" in err && err.code === 10049) {
294569
295152
  logger.log("Preview token expired, fetching a new one");
@@ -294575,7 +295158,7 @@ function handlePreviewSessionUploadError(err, accountId) {
294575
295158
  return false;
294576
295159
  }
294577
295160
  function handlePreviewSessionCreationError(err, accountId) {
294578
- assert51__default.default(err && typeof err === "object");
295161
+ assert52__default.default(err && typeof err === "object");
294579
295162
  if ("code" in err && err.code === 10063) {
294580
295163
  logger.error(
294581
295164
  `You need to register a workers.dev subdomain before running the dev command in remote mode. You can either enable local mode by pressing l, or register a workers.dev subdomain here: https://dash.cloudflare.com/${accountId}/workers/onboarding`
@@ -295117,7 +295700,7 @@ function createWorkerObject(devEnv) {
295117
295700
  return devEnv.proxy.ready.promise.then((ev) => ev.inspectorUrl);
295118
295701
  },
295119
295702
  get config() {
295120
- assert51__default.default(devEnv.config.latestConfig);
295703
+ assert52__default.default(devEnv.config.latestConfig);
295121
295704
  return devEnv.config.latestConfig;
295122
295705
  },
295123
295706
  async setConfig(config, throwErrors) {
@@ -295132,7 +295715,7 @@ function createWorkerObject(devEnv) {
295132
295715
  return proxyWorker.dispatchFetch(...args);
295133
295716
  },
295134
295717
  async queue(...args) {
295135
- assert51__default.default(
295718
+ assert52__default.default(
295136
295719
  this.config.name,
295137
295720
  "Worker name must be defined to use `Worker.queue()`"
295138
295721
  );
@@ -295141,7 +295724,7 @@ function createWorkerObject(devEnv) {
295141
295724
  return w7.queue(...args);
295142
295725
  },
295143
295726
  async scheduled(...args) {
295144
- assert51__default.default(
295727
+ assert52__default.default(
295145
295728
  this.config.name,
295146
295729
  "Worker name must be defined to use `Worker.scheduled()`"
295147
295730
  );
@@ -295527,7 +296110,7 @@ function getAuthHook(auth, config) {
295527
296110
  }
295528
296111
  function deepStrictEqual(source, target) {
295529
296112
  try {
295530
- assert51__default.default.deepStrictEqual(source, target);
296113
+ assert52__default.default.deepStrictEqual(source, target);
295531
296114
  return true;
295532
296115
  } catch {
295533
296116
  return false;
@@ -295755,7 +296338,7 @@ var init_LocalRuntimeController = __esm({
295755
296338
  }
295756
296339
  if (data.config.containers?.length && data.config.dev.enableContainers && this.#currentContainerBuildId !== data.config.dev.containerBuildId) {
295757
296340
  this.dockerPath = data.config.dev?.dockerPath ?? getDockerPath();
295758
- assert51__default.default(
296341
+ assert52__default.default(
295759
296342
  data.config.dev.containerBuildId,
295760
296343
  "Build ID should be set if containers are enabled and defined"
295761
296344
  );
@@ -295887,7 +296470,7 @@ var init_LocalRuntimeController = __esm({
295887
296470
  if (!this.containerImageTagsSeen.size) {
295888
296471
  return;
295889
296472
  }
295890
- assert51__default.default(
296473
+ assert52__default.default(
295891
296474
  this.dockerPath,
295892
296475
  "Docker path should have been set if containers are enabled"
295893
296476
  );
@@ -295995,7 +296578,7 @@ var init_MultiworkerRuntimeController = __esm({
295995
296578
  }
295996
296579
  #mergedMfOptions() {
295997
296580
  const primary = [...this.#options.values()].find((o7) => o7.primary);
295998
- assert51__default.default(primary !== void 0);
296581
+ assert52__default.default(primary !== void 0);
295999
296582
  const secondary = [...this.#options.values()].filter((o7) => !o7.primary);
296000
296583
  return {
296001
296584
  ...primary.options,
@@ -296030,7 +296613,7 @@ var init_MultiworkerRuntimeController = __esm({
296030
296613
  }
296031
296614
  if (data.config.containers?.length && this.#currentContainerBuildId !== data.config.dev.containerBuildId) {
296032
296615
  logger.log(source_default.dim("\u2394 Preparing container image(s)..."));
296033
- assert51__default.default(
296616
+ assert52__default.default(
296034
296617
  data.config.dev.containerBuildId,
296035
296618
  "Build ID should be set if containers are enabled and defined"
296036
296619
  );
@@ -296202,34 +296785,6 @@ var init_NoOpProxyController = __esm({
296202
296785
  };
296203
296786
  }
296204
296787
  });
296205
- function onKeyPress(callback) {
296206
- const stream2 = new Stream.PassThrough();
296207
- process.stdin.pipe(stream2);
296208
- if (isInteractive2()) {
296209
- S__default.default.emitKeypressEvents(stream2);
296210
- process.stdin.setRawMode(true);
296211
- }
296212
- const handler = /* @__PURE__ */ __name(async (_char, key) => {
296213
- if (key) {
296214
- callback(key);
296215
- }
296216
- }, "handler");
296217
- stream2.on("keypress", handler);
296218
- return () => {
296219
- if (isInteractive2()) {
296220
- process.stdin.setRawMode(false);
296221
- }
296222
- stream2.off("keypress", handler);
296223
- stream2.destroy();
296224
- };
296225
- }
296226
- var init_onKeyPress = __esm({
296227
- "src/utils/onKeyPress.ts"() {
296228
- init_import_meta_url();
296229
- init_is_interactive();
296230
- __name(onKeyPress, "onKeyPress");
296231
- }
296232
- });
296233
296788
  function cli_hotkeys_default(options, render2 = true) {
296234
296789
  function formatInstructions() {
296235
296790
  const instructions = options.filter(
@@ -298495,7 +299050,11 @@ __export(assets_exports5, {
298495
299050
  default: () => generateASSETSBinding
298496
299051
  });
298497
299052
  async function generateASSETSBinding(options) {
298498
- const assetsFetch = options.directory !== void 0 ? await generateAssetsFetch(options.directory, options.log) : invalidAssetsFetch;
299053
+ const assetsFetch = options.directory !== void 0 ? await generateAssetsFetch(
299054
+ options.directory,
299055
+ options.log,
299056
+ options.signal
299057
+ ) : invalidAssetsFetch;
298499
299058
  return async function(miniflareRequest) {
298500
299059
  if (options.proxyPort) {
298501
299060
  try {
@@ -298528,7 +299087,7 @@ async function generateASSETSBinding(options) {
298528
299087
  }
298529
299088
  };
298530
299089
  }
298531
- async function generateAssetsFetch(directory, log2) {
299090
+ async function generateAssetsFetch(directory, log2, signal) {
298532
299091
  directory = path3.resolve(directory);
298533
299092
  const polyfill2 = (await Promise.resolve().then(() => (init_miniflare2(), miniflare_exports2))).default;
298534
299093
  await polyfill2();
@@ -298557,35 +299116,47 @@ async function generateAssetsFetch(directory, log2) {
298557
299116
  redirectsFile,
298558
299117
  logger: log2
298559
299118
  });
298560
- watch([headersFile, redirectsFile], { persistent: true }).on(
298561
- "change",
298562
- (path82) => {
298563
- switch (path82) {
298564
- case headersFile: {
298565
- log2.log("_headers modified. Re-evaluating...");
298566
- const contents = fs23.readFileSync(headersFile).toString();
298567
- headers = parseHeaders(contents);
298568
- break;
298569
- }
298570
- case redirectsFile: {
298571
- log2.log("_redirects modified. Re-evaluating...");
298572
- const contents = fs23.readFileSync(redirectsFile).toString();
298573
- redirects = parseRedirects(contents, {
298574
- htmlHandling: void 0
298575
- // Pages dev server doesn't expose html_handling configuration in this context.
298576
- });
298577
- break;
298578
- }
299119
+ const watcher = watch([headersFile, redirectsFile], {
299120
+ persistent: true
299121
+ }).on("change", (path82) => {
299122
+ switch (path82) {
299123
+ case headersFile: {
299124
+ log2.log("_headers modified. Re-evaluating...");
299125
+ const contents = fs23.readFileSync(headersFile).toString();
299126
+ headers = parseHeaders(contents);
299127
+ break;
298579
299128
  }
298580
- metadata = createMetadataObject({
298581
- redirects,
298582
- headers,
298583
- redirectsFile,
298584
- headersFile,
298585
- logger: log2
299129
+ case redirectsFile: {
299130
+ log2.log("_redirects modified. Re-evaluating...");
299131
+ const contents = fs23.readFileSync(redirectsFile).toString();
299132
+ redirects = parseRedirects(contents, {
299133
+ htmlHandling: void 0
299134
+ // Pages dev server doesn't expose html_handling configuration in this context.
299135
+ });
299136
+ break;
299137
+ }
299138
+ }
299139
+ metadata = createMetadataObject({
299140
+ redirects,
299141
+ headers,
299142
+ redirectsFile,
299143
+ headersFile,
299144
+ logger: log2
299145
+ });
299146
+ });
299147
+ if (signal) {
299148
+ if (signal.aborted) {
299149
+ void watcher.close().catch(() => {
298586
299150
  });
299151
+ } else {
299152
+ signal.addEventListener(
299153
+ "abort",
299154
+ () => void watcher.close().catch(() => {
299155
+ }),
299156
+ { once: true }
299157
+ );
298587
299158
  }
298588
- );
299159
+ }
298589
299160
  const generateResponse = /* @__PURE__ */ __name(async (request4) => {
298590
299161
  const assetKeyEntryMap = /* @__PURE__ */ new Map();
298591
299162
  return await generateHandler2({
@@ -298681,12 +299252,12 @@ var init_assets6 = __esm({
298681
299252
  * by the `fetch()` function before calling `dispatcher.dispatch()`.
298682
299253
  */
298683
299254
  static reinstateHostHeader(headers, host) {
298684
- assert51__default.default(headers, "Expected all proxy requests to contain headers.");
298685
- assert51__default.default(
299255
+ assert52__default.default(headers, "Expected all proxy requests to contain headers.");
299256
+ assert52__default.default(
298686
299257
  !Array.isArray(headers),
298687
299258
  "Expected proxy request headers to be a hash object"
298688
299259
  );
298689
- assert51__default.default(
299260
+ assert52__default.default(
298690
299261
  Object.keys(headers).every((h7) => h7.toLowerCase() !== "host"),
298691
299262
  "Expected Host header to have been deleted."
298692
299263
  );
@@ -298718,7 +299289,7 @@ async function startDev(args) {
298718
299289
  unregisterHotKeys?.();
298719
299290
  accountId = await requireAuth(config);
298720
299291
  if (hotkeysDisplayed) {
298721
- assert51__default.default(devEnv !== void 0);
299292
+ assert52__default.default(devEnv !== void 0);
298722
299293
  unregisterHotKeys = registerDevHotKeys(
298723
299294
  Array.isArray(devEnv) ? devEnv : [devEnv],
298724
299295
  args,
@@ -298880,7 +299451,7 @@ async function setupDevEnv(devEnv, configPath, auth, args) {
298880
299451
  hostname: args.host ?? args.localUpstream,
298881
299452
  secure: args.upstreamProtocol === void 0 ? void 0 : args.upstreamProtocol === "https"
298882
299453
  },
298883
- persist: args.persistTo,
299454
+ persist: args.persist === false ? false : args.persistTo,
298884
299455
  liveReload: args.liveReload,
298885
299456
  testScheduled: args.testScheduled,
298886
299457
  logLevel: args.logLevel,