wrangler 4.40.3 → 4.42.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.
@@ -27379,7 +27379,7 @@ async function prepareContainerImagesForDev(args) {
27379
27379
  if (!isCloudflareRegistryLink(options.image_uri)) {
27380
27380
  throw new UserError(
27381
27381
  `Image "${options.image_uri}" is a registry link but does not point to the Cloudflare container registry.
27382
- To use an existing image from another repository, see https://developers.cloudflare.com/containers/image-management/#using-existing-images`
27382
+ To use an existing image from another repository, see https://developers.cloudflare.com/containers/platform-details/image-management/#using-pre-built-container-images`
27383
27383
  );
27384
27384
  }
27385
27385
  const pull = await pullImage(dockerPath, options);
@@ -27414,6 +27414,19 @@ function resolveImageName(accountId, image) {
27414
27414
  if (url4.pathname.startsWith(`/${accountId}`)) {
27415
27415
  return image;
27416
27416
  }
27417
+ const accountIdPattern = /^\/([a-f0-9]{32})\//;
27418
+ const match2 = accountIdPattern.exec(url4.pathname);
27419
+ if (match2) {
27420
+ const foundAccountId = match2[1];
27421
+ if (foundAccountId !== accountId) {
27422
+ throw new Error(
27423
+ `Image "${image}" does not belong to your account
27424
+ Image appears to belong to account: "${foundAccountId}"
27425
+ Current account: "${accountId}"`
27426
+ );
27427
+ }
27428
+ return image;
27429
+ }
27417
27430
  return `${url4.hostname}/${accountId}${url4.pathname}`;
27418
27431
  }
27419
27432
  var init_images = __esm({
@@ -33628,7 +33641,7 @@ function getComplianceRegionSubdomain(complianceConfig) {
33628
33641
  function getStagingSubdomain() {
33629
33642
  return getCloudflareApiEnvironmentFromEnv() === "staging" ? ".staging" : "";
33630
33643
  }
33631
- var import_node_path2, getC3CommandFromEnv, getWranglerSendMetricsFromEnv, getCloudflareApiEnvironmentFromEnv, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, getCloudflareComplianceRegionFromEnv, getCloudflareComplianceRegion, getCloudflareApiBaseUrlFromEnv, getCloudflareApiBaseUrl, getSanitizeLogs, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCIGeneratePreviewAlias, getWorkersCIBranchName, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getRegistryPath, getD1ExtraLocationChoices, getDockerPath, getCloudflareLoadDevVarsFromDotEnv, getCloudflareIncludeProcessEnvFromEnv, getTraceHeader, getDisableConfigWatching;
33644
+ var import_node_path2, getC3CommandFromEnv, getWranglerSendMetricsFromEnv, getWranglerSendErrorReportsFromEnv, getCloudflareApiEnvironmentFromEnv, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, getCloudflareComplianceRegionFromEnv, getCloudflareComplianceRegion, getCloudflareApiBaseUrlFromEnv, getCloudflareApiBaseUrl, getSanitizeLogs, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCIGeneratePreviewAlias, getWorkersCIBranchName, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getRegistryPath, getD1ExtraLocationChoices, getDockerPath, getSubdomainMixedStateCheckDisabled, getCloudflareLoadDevVarsFromDotEnv, getCloudflareIncludeProcessEnvFromEnv, getTraceHeader, getDisableConfigWatching;
33632
33645
  var init_misc_variables = __esm({
33633
33646
  "src/environment-variables/misc-variables.ts"() {
33634
33647
  init_import_meta_url();
@@ -33644,6 +33657,9 @@ var init_misc_variables = __esm({
33644
33657
  getWranglerSendMetricsFromEnv = getBooleanEnvironmentVariableFactory({
33645
33658
  variableName: "WRANGLER_SEND_METRICS"
33646
33659
  });
33660
+ getWranglerSendErrorReportsFromEnv = getBooleanEnvironmentVariableFactory({
33661
+ variableName: "WRANGLER_SEND_ERROR_REPORTS"
33662
+ });
33647
33663
  getCloudflareApiEnvironmentFromEnv = getEnvironmentVariableFactory(
33648
33664
  {
33649
33665
  variableName: "WRANGLER_API_ENVIRONMENT",
@@ -33727,6 +33743,10 @@ var init_misc_variables = __esm({
33727
33743
  return "docker";
33728
33744
  }
33729
33745
  });
33746
+ getSubdomainMixedStateCheckDisabled = getBooleanEnvironmentVariableFactory({
33747
+ variableName: "WRANGLER_DISABLE_SUBDOMAIN_MIXED_STATE_CHECK",
33748
+ defaultValue: false
33749
+ });
33730
33750
  getCloudflareLoadDevVarsFromDotEnv = getBooleanEnvironmentVariableFactory({
33731
33751
  variableName: "CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV",
33732
33752
  defaultValue: true
@@ -34117,6 +34137,7 @@ var init_logger = __esm({
34117
34137
  import_esbuild = require("esbuild");
34118
34138
  init_factory();
34119
34139
  init_misc_variables();
34140
+ init_parse();
34120
34141
  init_log_file();
34121
34142
  LOGGER_LEVELS = {
34122
34143
  none: -1,
@@ -34175,7 +34196,13 @@ var init_logger = __esm({
34175
34196
  info = /* @__PURE__ */ __name((...args) => this.doLog("info", args), "info");
34176
34197
  log = /* @__PURE__ */ __name((...args) => this.doLog("log", args), "log");
34177
34198
  warn = /* @__PURE__ */ __name((...args) => this.doLog("warn", args), "warn");
34178
- error = /* @__PURE__ */ __name((...args) => this.doLog("error", args), "error");
34199
+ error(...args) {
34200
+ if (args.length === 1 && args[0] instanceof ParseError) {
34201
+ this.doLog("error", formatMessage(args[0]));
34202
+ } else {
34203
+ this.doLog("error", args);
34204
+ }
34205
+ }
34179
34206
  table(data, options) {
34180
34207
  const derivedHead = data.length === 0 ? [] : Object.keys(data[0]);
34181
34208
  const wordWrap = options?.wordWrap ?? false;
@@ -34221,7 +34248,7 @@ var init_logger = __esm({
34221
34248
  }
34222
34249
  }
34223
34250
  doLog(messageLevel, args) {
34224
- const message = this.formatMessage(messageLevel, (0, import_node_util.format)(...args));
34251
+ const message = Array.isArray(args) ? this.formatMessage(messageLevel, (0, import_node_util.format)(...args)) : args;
34225
34252
  const inUnitTests = typeof vitest !== "undefined";
34226
34253
  if (!inUnitTests) {
34227
34254
  void appendToDebugLogFile(messageLevel, message);
@@ -93871,7 +93898,7 @@ var name, version;
93871
93898
  var init_package = __esm({
93872
93899
  "package.json"() {
93873
93900
  name = "wrangler";
93874
- version = "4.40.3";
93901
+ version = "4.42.0";
93875
93902
  }
93876
93903
  });
93877
93904
 
@@ -100531,7 +100558,13 @@ var init_check_macos_version = __esm({
100531
100558
  });
100532
100559
 
100533
100560
  // ../cli/index.ts
100534
- var import_process, shapes, status, space, logRaw, log, newline, format6, updateStatus, startSection, endSection, cancel, warn, success, stripAnsi3, linkRegex, crash, error;
100561
+ function setLogLevel(level) {
100562
+ currentLogLevel = level;
100563
+ }
100564
+ function getLogLevel() {
100565
+ return currentLogLevel;
100566
+ }
100567
+ var import_process, shapes, status, space, LOGGER_LEVELS2, currentLogLevel, logRaw, log, newline, format6, updateStatus, startSection, endSection, cancel, warn, success, stripAnsi3, linkRegex, crash, error;
100535
100568
  var init_cli = __esm({
100536
100569
  "../cli/index.ts"() {
100537
100570
  init_import_meta_url();
@@ -100570,9 +100603,23 @@ var init_cli = __esm({
100570
100603
  space = /* @__PURE__ */ __name((n7 = 1) => {
100571
100604
  return hidden("\u200A".repeat(n7));
100572
100605
  }, "space");
100606
+ LOGGER_LEVELS2 = {
100607
+ none: -1,
100608
+ error: 0,
100609
+ warn: 1,
100610
+ info: 2,
100611
+ log: 3,
100612
+ debug: 4
100613
+ };
100614
+ currentLogLevel = "log";
100615
+ __name(setLogLevel, "setLogLevel");
100616
+ __name(getLogLevel, "getLogLevel");
100573
100617
  logRaw = /* @__PURE__ */ __name((msg) => {
100574
- stdout.write(`${msg}
100618
+ const currentLevel = getLogLevel();
100619
+ if (LOGGER_LEVELS2[currentLevel] >= LOGGER_LEVELS2.log) {
100620
+ stdout.write(`${msg}
100575
100621
  `);
100622
+ }
100576
100623
  }, "logRaw");
100577
100624
  log = /* @__PURE__ */ __name((msg) => {
100578
100625
  const lines = msg.split("\n").map((ln) => `${gray(shapes.bar)}${ln.length > 0 ? " " + white(ln) : ""}`);
@@ -100691,7 +100738,8 @@ var init_cli = __esm({
100691
100738
  (0, import_process.exit)(1);
100692
100739
  }, "crash");
100693
100740
  error = /* @__PURE__ */ __name((msg, extra, corner = shapes.corners.bl) => {
100694
- if (msg) {
100741
+ const currentLevel = getLogLevel();
100742
+ if (msg && LOGGER_LEVELS2[currentLevel] >= LOGGER_LEVELS2.error) {
100695
100743
  stderr.write(
100696
100744
  `${gray(corner)} ${status.error} ${dim(msg)}
100697
100745
  ${extra ? space() + extra + "\n" : ""}`
@@ -106289,8 +106337,18 @@ function validateContainerApp(envName, topLevelName, configPath) {
106289
106337
  "instance_type",
106290
106338
  containerAppOptional.instance_type,
106291
106339
  "string",
106292
- ["dev", "basic", "standard"]
106340
+ ALLOWED_INSTANCE_TYPES
106293
106341
  );
106342
+ if (containerAppOptional.instance_type === "dev") {
106343
+ diagnostics.warnings.push(
106344
+ `The "dev" instance_type has been renamed to "lite" and will be removed in a subsequent version. Please update your configuration to use "lite" instead.`
106345
+ );
106346
+ }
106347
+ if (containerAppOptional.instance_type === "standard") {
106348
+ diagnostics.warnings.push(
106349
+ `The "standard" instance_type has been renamed to "standard-1" and will be removed in a subsequent version. Please update your configuration to use "standard-1" instead.`
106350
+ );
106351
+ }
106294
106352
  } else if (validateOptionalProperty(
106295
106353
  diagnostics,
106296
106354
  field,
@@ -106464,7 +106522,7 @@ function isRemoteValid(targetObject, fieldPath, diagnostics) {
106464
106522
  }
106465
106523
  return true;
106466
106524
  }
106467
- var import_node_assert, import_node_path9, ENGLISH, isRoute, isRouteArray, validateTailConsumers, validateAndNormalizeRules, validateTriggers, validateRules, validateRule, validateDefines, validateVars, validateBindingsProperty, validateUnsafeSettings, validateDurableObjectBinding, validateWorkflowBinding, validateCflogfwdrObject, validateCflogfwdrBinding, validateAssetsConfig, validateNamedSimpleBinding, validateAIBinding, validateVersionMetadataBinding, validateUnsafeBinding, validateBindingArray, validateCloudchamberConfig, validateKVBinding, validateSendEmailBinding, validateQueueBinding, validateR2Binding, validateD1Binding, validateVectorizeBinding, validateHyperdriveBinding, validateVpcServiceBinding, validateBindingsHaveUniqueNames, validateServiceBinding, validateAnalyticsEngineBinding, validateWorkerNamespaceBinding, validateMTlsCertificateBinding, validateConsumer, validateCompatibilityDate, validatePipelineBinding, validateSecretsStoreSecretBinding, validateHelloWorldBinding, validateWorkerLoaderBinding, validateRateLimitBinding, validateMigrations, validateObservability;
106525
+ var import_node_assert, import_node_path9, ENGLISH, ALLOWED_INSTANCE_TYPES, isRoute, isRouteArray, validateTailConsumers, validateAndNormalizeRules, validateTriggers, validateRules, validateRule, validateDefines, validateVars, validateBindingsProperty, validateUnsafeSettings, validateDurableObjectBinding, validateWorkflowBinding, validateCflogfwdrObject, validateCflogfwdrBinding, validateAssetsConfig, validateNamedSimpleBinding, validateAIBinding, validateVersionMetadataBinding, validateUnsafeBinding, validateBindingArray, validateCloudchamberConfig, validateKVBinding, validateSendEmailBinding, validateQueueBinding, validateR2Binding, validateD1Binding, validateVectorizeBinding, validateHyperdriveBinding, validateVpcServiceBinding, validateBindingsHaveUniqueNames, validateServiceBinding, validateAnalyticsEngineBinding, validateWorkerNamespaceBinding, validateMTlsCertificateBinding, validateConsumer, validateCompatibilityDate, validatePipelineBinding, validateSecretsStoreSecretBinding, validateHelloWorldBinding, validateWorkerLoaderBinding, validateRateLimitBinding, validateMigrations, validateObservability;
106468
106526
  var init_validation = __esm({
106469
106527
  "src/config/validation.ts"() {
106470
106528
  init_import_meta_url();
@@ -106483,6 +106541,18 @@ var init_validation = __esm({
106483
106541
  init_validation_helpers();
106484
106542
  init_config5();
106485
106543
  ENGLISH = new Intl.ListFormat("en-US");
106544
+ ALLOWED_INSTANCE_TYPES = [
106545
+ "lite",
106546
+ "basic",
106547
+ "standard-1",
106548
+ "standard-2",
106549
+ "standard-3",
106550
+ "standard-4",
106551
+ "dev",
106552
+ // legacy
106553
+ "standard"
106554
+ // legacy
106555
+ ];
106486
106556
  __name(isPagesConfig, "isPagesConfig");
106487
106557
  __name(normalizeAndValidateConfig, "normalizeAndValidateConfig");
106488
106558
  __name(applyPythonConfig, "applyPythonConfig");
@@ -107266,9 +107336,9 @@ Please add a binding for "${configBindingName}" to "env.${envName}.${field}.bind
107266
107336
  });
107267
107337
  });
107268
107338
  if ("instance_type" in value && value.instance_type !== void 0) {
107269
- if (typeof value.instance_type !== "string" || !["dev", "basic", "standard"].includes(value.instance_type)) {
107339
+ if (typeof value.instance_type !== "string" || !ALLOWED_INSTANCE_TYPES.includes(value.instance_type)) {
107270
107340
  diagnostics.errors.push(
107271
- `"instance_type" should be one of 'dev', 'basic', or 'standard', but got ${value.instance_type}`
107341
+ `"instance_type" should be one of 'lite', 'basic', 'standard-1', 'standard-2', 'standard-3', or 'standard-4', but got ${value.instance_type}`
107272
107342
  );
107273
107343
  }
107274
107344
  if ("memory" in value && value.memory !== void 0 || "vcpu" in value && value.vcpu !== void 0) {
@@ -108616,37 +108686,46 @@ function formatConfigSnippet(snippet, configPath, formatted = true) {
108616
108686
  return formatted ? JSON.stringify(snippet, null, 2) : JSON.stringify(snippet);
108617
108687
  }
108618
108688
  }
108619
- async function updateConfigFile(snippet, configPath, env6, offerToUpdate = true) {
108620
- const resource = Object.keys(snippet())[0];
108689
+ async function updateConfigFile(resource, snippet, configPath, env6, defaults2) {
108621
108690
  const envString = env6 ? ` in the "${env6}" environment` : "";
108622
108691
  logger.log(
108623
108692
  `To access your new ${friendlyBindingNames[resource]} in your Worker, add the following snippet to your configuration file${envString}:`
108624
108693
  );
108625
- logger.log(formatConfigSnippet(snippet(), configPath));
108626
- if (configPath && offerToUpdate && configFormat(configPath) === "jsonc") {
108627
- const autoAdd = await select(
108628
- "Would you like Wrangler to add it on your behalf?",
108694
+ logger.log(
108695
+ formatConfigSnippet(
108629
108696
  {
108630
- choices: [
108631
- { title: "Yes", value: "yes" },
108697
+ [resource]: [
108632
108698
  {
108633
- title: "Yes, but let me choose the binding name",
108634
- value: "yes-but"
108635
- },
108636
- { title: "No", value: "no" }
108637
- ],
108638
- defaultOption: 0,
108639
- fallbackOption: 2
108640
- }
108641
- );
108642
- let bindingName;
108643
- if (autoAdd === "yes-but") {
108644
- bindingName = await prompt("What binding name would you like to use?");
108645
- }
108646
- if (autoAdd !== "no") {
108699
+ ...snippet(defaults2?.binding),
108700
+ ...defaults2?.useRemote === true ? { remote: true } : {}
108701
+ }
108702
+ ]
108703
+ },
108704
+ configPath
108705
+ )
108706
+ );
108707
+ if (configPath && configFormat(configPath) === "jsonc") {
108708
+ const writeToConfig = defaults2?.binding ?? defaults2?.updateConfig ?? await confirm("Would you like Wrangler to add it on your behalf?", {
108709
+ defaultValue: true,
108710
+ // We don't want to automatically write to config in CI
108711
+ fallbackValue: false
108712
+ });
108713
+ if (writeToConfig) {
108714
+ const bindingName = defaults2?.binding ?? await prompt("What binding name would you like to use?", {
108715
+ defaultValue: snippet().binding
108716
+ });
108717
+ const useRemote = defaults2?.useRemote ?? (defaults2?.binding || defaults2?.updateConfig ? false : await confirm(
108718
+ "For local dev, do you want to connect to the remote resource instead of a local resource?",
108719
+ { defaultValue: false }
108720
+ ));
108721
+ const configFilePatch = {
108722
+ [resource]: [
108723
+ { ...snippet(bindingName), ...useRemote ? { remote: true } : {} }
108724
+ ]
108725
+ };
108647
108726
  experimental_patchConfig(
108648
108727
  configPath,
108649
- env6 ? { env: { [env6]: snippet(bindingName) } } : snippet(bindingName),
108728
+ env6 ? { env: { [env6]: configFilePatch } } : configFilePatch,
108650
108729
  true
108651
108730
  );
108652
108731
  }
@@ -108720,7 +108799,7 @@ function readPagesConfig(args, options = {}) {
108720
108799
  }
108721
108800
  return config;
108722
108801
  }
108723
- var import_toml3, parseRawConfigFile, experimental_readRawConfig;
108802
+ var import_toml3, sharedResourceCreationArgs, parseRawConfigFile, experimental_readRawConfig;
108724
108803
  var init_config5 = __esm({
108725
108804
  "src/config/index.ts"() {
108726
108805
  init_import_meta_url();
@@ -108738,6 +108817,20 @@ var init_config5 = __esm({
108738
108817
  __name(configFormat, "configFormat");
108739
108818
  __name(configFileName, "configFileName");
108740
108819
  __name(formatConfigSnippet, "formatConfigSnippet");
108820
+ sharedResourceCreationArgs = {
108821
+ "use-remote": {
108822
+ type: "boolean",
108823
+ description: "Use a remote binding when adding the newly created resource to your config"
108824
+ },
108825
+ "update-config": {
108826
+ type: "boolean",
108827
+ description: "Automatically update your config file with the newly added resource"
108828
+ },
108829
+ binding: {
108830
+ type: "string",
108831
+ description: "The binding name of this resource in your Worker"
108832
+ }
108833
+ };
108741
108834
  __name(updateConfigFile, "updateConfigFile");
108742
108835
  __name(readConfig, "readConfig");
108743
108836
  __name(readPagesConfig, "readPagesConfig");
@@ -110372,11 +110465,19 @@ async function fetchInternal(complianceConfig, resource, init4 = {}, queryParams
110372
110465
  logger.debugWithSanitization("RESPONSE:", jsonText);
110373
110466
  logger.debug("-- END CF API RESPONSE");
110374
110467
  if (!jsonText && (response.status === 204 || response.status === 205)) {
110375
- const emptyBody = `{"result": {}, "success": true, "errors": [], "messages": []}`;
110376
- return parseJSON(emptyBody);
110468
+ return {
110469
+ response: {
110470
+ result: {},
110471
+ success: true,
110472
+ errors: [],
110473
+ messages: []
110474
+ },
110475
+ status: response.status
110476
+ };
110377
110477
  }
110378
110478
  try {
110379
- return parseJSON(jsonText);
110479
+ const json = parseJSON(jsonText);
110480
+ return { response: json, status: response.status };
110380
110481
  } catch {
110381
110482
  throw new APIError({
110382
110483
  text: "Received a malformed response from the API",
@@ -110542,22 +110643,15 @@ var init_internal = __esm({
110542
110643
 
110543
110644
  // src/cfetch/index.ts
110544
110645
  async function fetchResult(complianceConfig, resource, init4 = {}, queryParams, abortSignal, apiToken) {
110545
- const json = await fetchInternal(
110546
- complianceConfig,
110547
- resource,
110548
- init4,
110549
- queryParams,
110550
- abortSignal,
110551
- apiToken
110552
- );
110646
+ const { response: json, status: status2 } = await fetchInternal(complianceConfig, resource, init4, queryParams, abortSignal, apiToken);
110553
110647
  if (json.success) {
110554
110648
  return json.result;
110555
110649
  } else {
110556
- throwFetchError(resource, json);
110650
+ throwFetchError(resource, json, status2);
110557
110651
  }
110558
110652
  }
110559
110653
  async function fetchGraphqlResult(complianceConfig, init4 = {}, abortSignal) {
110560
- const json = await fetchInternal(
110654
+ const { response: json } = await fetchInternal(
110561
110655
  complianceConfig,
110562
110656
  "/graphql",
110563
110657
  { ...init4, method: "POST" },
@@ -110580,12 +110674,7 @@ async function fetchListResult(complianceConfig, resource, init4 = {}, queryPara
110580
110674
  queryParams = new import_node_url5.URLSearchParams(queryParams);
110581
110675
  queryParams.set("cursor", cursor);
110582
110676
  }
110583
- const json = await fetchInternal(
110584
- complianceConfig,
110585
- resource,
110586
- init4,
110587
- queryParams
110588
- );
110677
+ const { response: json, status: status2 } = await fetchInternal(complianceConfig, resource, init4, queryParams);
110589
110678
  if (json.success) {
110590
110679
  results.push(...json.result);
110591
110680
  if (hasCursor(json.result_info)) {
@@ -110594,7 +110683,7 @@ async function fetchListResult(complianceConfig, resource, init4 = {}, queryPara
110594
110683
  getMoreResults = false;
110595
110684
  }
110596
110685
  } else {
110597
- throwFetchError(resource, json);
110686
+ throwFetchError(resource, json, status2);
110598
110687
  }
110599
110688
  }
110600
110689
  return results;
@@ -110606,12 +110695,7 @@ async function fetchPagedListResult(complianceConfig, resource, init4 = {}, quer
110606
110695
  while (getMoreResults) {
110607
110696
  queryParams = new import_node_url5.URLSearchParams(queryParams);
110608
110697
  queryParams.set("page", String(page));
110609
- const json = await fetchInternal(
110610
- complianceConfig,
110611
- resource,
110612
- init4,
110613
- queryParams
110614
- );
110698
+ const { response: json, status: status2 } = await fetchInternal(complianceConfig, resource, init4, queryParams);
110615
110699
  if (json.success) {
110616
110700
  results.push(...json.result);
110617
110701
  if (hasMorePages(json.result_info)) {
@@ -110620,7 +110704,7 @@ async function fetchPagedListResult(complianceConfig, resource, init4 = {}, quer
110620
110704
  getMoreResults = false;
110621
110705
  }
110622
110706
  } else {
110623
- throwFetchError(resource, json);
110707
+ throwFetchError(resource, json, status2);
110624
110708
  }
110625
110709
  }
110626
110710
  return results;
@@ -110631,7 +110715,7 @@ function hasMorePages(result_info) {
110631
110715
  const total = result_info?.total_count;
110632
110716
  return page !== void 0 && per_page !== void 0 && total !== void 0 && page * per_page < total;
110633
110717
  }
110634
- function throwFetchError(resource, response) {
110718
+ function throwFetchError(resource, response, status2) {
110635
110719
  if (typeof vitest !== "undefined" && !("errors" in response)) {
110636
110720
  throw response;
110637
110721
  }
@@ -110643,7 +110727,8 @@ function throwFetchError(resource, response) {
110643
110727
  notes: [
110644
110728
  ...response.errors.map((err) => ({ text: renderError(err) })),
110645
110729
  ...response.messages?.map((text) => ({ text })) ?? []
110646
- ]
110730
+ ],
110731
+ status: status2
110647
110732
  });
110648
110733
  const code = response.errors[0]?.code;
110649
110734
  if (code) {
@@ -120333,7 +120418,7 @@ function logStructuredLog({ level, message }, processStream) {
120333
120418
  return logger.info(message);
120334
120419
  }
120335
120420
  if (level === "debug") {
120336
- return logger.debug(message);
120421
+ return logger.info(message);
120337
120422
  }
120338
120423
  if (level === "error") {
120339
120424
  return logger.error(getSourceMappedString(message));
@@ -127051,9 +127136,24 @@ var init_dist2 = __esm({
127051
127136
  // src/cloudchamber/instance-type/instance-type.ts
127052
127137
  async function promptForInstanceType(allowSkipping) {
127053
127138
  let options = [
127054
- { label: "dev: 1/16 vCPU, 256 MiB memory, 2 GB disk", value: "dev" },
127139
+ { label: "lite: 1/16 vCPU, 256 MiB memory, 2 GB disk", value: "lite" },
127055
127140
  { label: "basic: 1/4 vCPU, 1 GiB memory, 4 GB disk", value: "basic" },
127056
- { label: "standard: 1/2 vCPU, 4 GiB memory, 4 GB disk", value: "standard" }
127141
+ {
127142
+ label: "standard-1: 1/2 vCPU, 4 GiB memory, 8 GB disk",
127143
+ value: "standard-1"
127144
+ },
127145
+ {
127146
+ label: "standard-2: 1/2 vCPU, 4 GiB memory, 12 GB disk",
127147
+ value: "standard-2"
127148
+ },
127149
+ {
127150
+ label: "standard-3: 1/2 vCPU, 4 GiB memory, 16 GB disk",
127151
+ value: "standard-3"
127152
+ },
127153
+ {
127154
+ label: "standard-4: 4 vCPU, 4 GiB memory, 20 GB disk",
127155
+ value: "standard-4"
127156
+ }
127057
127157
  ];
127058
127158
  if (allowSkipping) {
127059
127159
  options = [{ label: "Do not set", value: "skip" }].concat(options);
@@ -127066,14 +127166,10 @@ async function promptForInstanceType(allowSkipping) {
127066
127166
  type: "select",
127067
127167
  options
127068
127168
  });
127069
- switch (action) {
127070
- case "dev":
127071
- case "basic":
127072
- case "standard":
127073
- return action;
127074
- default:
127075
- return void 0;
127169
+ if (instanceTypeNames.includes(action)) {
127170
+ return action;
127076
127171
  }
127172
+ return void 0;
127077
127173
  }
127078
127174
  function checkInstanceType(args, config) {
127079
127175
  const instance_type = args.instanceType ?? config.instance_type;
@@ -127085,15 +127181,12 @@ function checkInstanceType(args, config) {
127085
127181
  `Field "instance_type" is mutually exclusive with "memory" and "vcpu". These fields cannot be set together.`
127086
127182
  );
127087
127183
  }
127088
- switch (instance_type) {
127089
- case "dev":
127090
- case "basic":
127091
- case "standard":
127092
- return instance_type;
127093
- default:
127094
- throw new UserError2(
127095
- `"instance_type" field value is expected to be one of "dev", "basic", or "standard", but got "${instance_type}"`
127096
- );
127184
+ if (instanceTypeNames.includes(instance_type)) {
127185
+ return instance_type;
127186
+ } else {
127187
+ throw new UserError2(
127188
+ `"instance_type" field value is expected to be one of 'lite', 'basic', 'standard-1', 'standard-2', 'standard-3', 'standard-4', but got "${instance_type}"`
127189
+ );
127097
127190
  }
127098
127191
  }
127099
127192
  function getInstanceTypeUsage(instanceType) {
@@ -127120,14 +127213,19 @@ function cleanForInstanceType(app) {
127120
127213
  delete app.configuration.vcpu;
127121
127214
  return app;
127122
127215
  }
127123
- var instanceTypes;
127216
+ var instanceTypes, instanceTypeNames;
127124
127217
  var init_instance_type = __esm({
127125
127218
  "src/cloudchamber/instance-type/instance-type.ts"() {
127126
127219
  init_import_meta_url();
127127
127220
  init_interactive();
127128
127221
  init_errors();
127129
127222
  instanceTypes = {
127130
- // dev is the default instance type when REQUIRE_INSTANCE_TYPE is set
127223
+ // lite is the default instance type when REQUIRE_INSTANCE_TYPE is set
127224
+ lite: {
127225
+ vcpu: 0.0625,
127226
+ memory_mib: 256,
127227
+ disk_mb: 2e3
127228
+ },
127131
127229
  dev: {
127132
127230
  vcpu: 0.0625,
127133
127231
  memory_mib: 256,
@@ -127141,9 +127239,30 @@ var init_instance_type = __esm({
127141
127239
  standard: {
127142
127240
  vcpu: 0.5,
127143
127241
  memory_mib: 4096,
127144
- disk_mb: 4e3
127242
+ disk_mb: 8e3
127243
+ },
127244
+ "standard-1": {
127245
+ vcpu: 0.5,
127246
+ memory_mib: 4096,
127247
+ disk_mb: 8e3
127248
+ },
127249
+ "standard-2": {
127250
+ vcpu: 1,
127251
+ memory_mib: 6144,
127252
+ disk_mb: 12e3
127253
+ },
127254
+ "standard-3": {
127255
+ vcpu: 2,
127256
+ memory_mib: 8192,
127257
+ disk_mb: 16e3
127258
+ },
127259
+ "standard-4": {
127260
+ vcpu: 4,
127261
+ memory_mib: 12288,
127262
+ disk_mb: 2e4
127145
127263
  }
127146
127264
  };
127265
+ instanceTypeNames = Object.keys(instanceTypes);
127147
127266
  __name(promptForInstanceType, "promptForInstanceType");
127148
127267
  __name(checkInstanceType, "checkInstanceType");
127149
127268
  __name(getInstanceTypeUsage, "getInstanceTypeUsage");
@@ -137551,7 +137670,7 @@ var init_config6 = __esm({
137551
137670
  const shared = {
137552
137671
  name: container.name,
137553
137672
  class_name: container.class_name,
137554
- max_instances: container.max_instances ?? 1,
137673
+ max_instances: container.max_instances ?? 20,
137555
137674
  scheduling_policy: container.scheduling_policy ?? "default" /* DEFAULT */,
137556
137675
  constraints: {
137557
137676
  // if the tier is -1, then we allow all tiers
@@ -137584,7 +137703,7 @@ var init_config6 = __esm({
137584
137703
  };
137585
137704
  } else if (typeof container.instance_type === "string" || container.instance_type === void 0) {
137586
137705
  instanceTypeOrLimits = {
137587
- instance_type: container.instance_type ?? "dev" /* DEV */
137706
+ instance_type: container.instance_type ?? "lite" /* LITE */
137588
137707
  };
137589
137708
  } else {
137590
137709
  instanceTypeOrLimits = {
@@ -137742,10 +137861,11 @@ var init_create = __esm({
137742
137861
  enam: Eastern North America
137743
137862
 
137744
137863
  `
137745
- }
137864
+ },
137865
+ ...sharedResourceCreationArgs
137746
137866
  },
137747
137867
  positionalArgs: ["name"],
137748
- async handler({ name: name2, location, env: env6 }, { config }) {
137868
+ async handler({ name: name2, location, env: env6, ...args }, { config }) {
137749
137869
  const accountId = await requireAuth(config);
137750
137870
  const db = await createD1Database(config, accountId, name2, location);
137751
137871
  logger.log(
@@ -137753,17 +137873,15 @@ var init_create = __esm({
137753
137873
  );
137754
137874
  logger.log("Created your new D1 database.\n");
137755
137875
  await updateConfigFile(
137876
+ "d1_databases",
137756
137877
  (bindingName) => ({
137757
- d1_databases: [
137758
- {
137759
- binding: getValidBindingName(bindingName ?? db.name, "DB"),
137760
- database_name: db.name,
137761
- database_id: db.uuid
137762
- }
137763
- ]
137878
+ binding: getValidBindingName(bindingName ?? db.name, "DB"),
137879
+ database_name: db.name,
137880
+ database_id: db.uuid
137764
137881
  }),
137765
137882
  config.configPath,
137766
- env6
137883
+ env6,
137884
+ args
137767
137885
  );
137768
137886
  }
137769
137887
  });
@@ -140708,7 +140826,7 @@ async function retryOnAPIFailure(action, backoff = 0, attempts = MAX_ATTEMPTS) {
140708
140826
  } else if (!(err instanceof TypeError)) {
140709
140827
  throw err;
140710
140828
  }
140711
- logger.info(source_default.dim(`Retrying API call after error...`));
140829
+ logger.debug(source_default.dim(`Retrying API call after error...`));
140712
140830
  logger.debug(err);
140713
140831
  if (attempts <= 1) {
140714
140832
  throw err;
@@ -141119,10 +141237,71 @@ function getSubdomainValues(config_workers_dev, config_preview_urls, routes) {
141119
141237
  preview_urls: config_preview_urls ?? defaultPreviewUrls
141120
141238
  };
141121
141239
  }
141240
+ async function validateSubdomainMixedState(props, accountId, scriptName, configFlags, desired, remote, firstDeploy) {
141241
+ const { config } = props;
141242
+ const changed = desired.workers_dev !== remote.workers_dev || desired.preview_urls !== remote.preview_urls;
141243
+ if (!changed) {
141244
+ return desired;
141245
+ }
141246
+ if (getSubdomainMixedStateCheckDisabled()) {
141247
+ return desired;
141248
+ }
141249
+ if (isNonInteractiveOrCI()) {
141250
+ return desired;
141251
+ }
141252
+ if (firstDeploy) {
141253
+ return desired;
141254
+ }
141255
+ if (desired.workers_dev === desired.preview_urls) {
141256
+ return desired;
141257
+ }
141258
+ const userSubdomain = await getWorkersDevSubdomain(
141259
+ config,
141260
+ accountId,
141261
+ config.configPath
141262
+ );
141263
+ const previewUrl = `https://<VERSION_PREFIX>-${scriptName}.${userSubdomain}`;
141264
+ if (!desired.workers_dev && desired.preview_urls) {
141265
+ logger.warn(
141266
+ [
141267
+ "You are disabling the 'workers.dev' subdomain for this Worker, but Preview URLs are still enabled.",
141268
+ "Preview URLs will automatically generate a unique, shareable link for each new version which will be accessible at:",
141269
+ ` ${previewUrl}`,
141270
+ "",
141271
+ "To prevent this Worker from being unintentionally public, you may want to disable the Preview URLs as well by setting `preview_urls = false` in your Wrangler config file."
141272
+ ].join("\n")
141273
+ );
141274
+ }
141275
+ if (desired.workers_dev && !desired.preview_urls) {
141276
+ logger.warn(
141277
+ [
141278
+ "You are enabling the 'workers.dev' subdomain for this Worker, but Preview URLs are still disabled.",
141279
+ "Preview URLs will automatically generate a unique, shareable link for each new version which will be accessible at:",
141280
+ ` ${previewUrl}`,
141281
+ "",
141282
+ "You may want to enable the Preview URLs as well by setting `preview_urls = true` in your Wrangler config file."
141283
+ ].join("\n")
141284
+ );
141285
+ }
141286
+ return desired;
141287
+ }
141122
141288
  async function subdomainDeploy(props, accountId, scriptName, envName, workerUrl, routes, deployments, firstDeploy) {
141123
141289
  const { config } = props;
141124
- const { workers_dev: wantWorkersDev, preview_urls: wantPreviews } = getSubdomainValues(config.workers_dev, config.preview_urls, routes);
141125
141290
  const { enabled: currWorkersDev, previews_enabled: currPreviews } = await fetchResult(config, `${workerUrl}/subdomain`);
141291
+ const desiredSubdomain = await getSubdomainValues(
141292
+ config.workers_dev,
141293
+ config.preview_urls,
141294
+ routes
141295
+ );
141296
+ const { workers_dev: wantWorkersDev, preview_urls: wantPreviews } = await validateSubdomainMixedState(
141297
+ props,
141298
+ accountId,
141299
+ scriptName,
141300
+ config,
141301
+ desiredSubdomain,
141302
+ { workers_dev: currWorkersDev, preview_urls: currPreviews },
141303
+ firstDeploy
141304
+ );
141126
141305
  const workersDevInSync = wantWorkersDev === currWorkersDev;
141127
141306
  const previewsInSync = wantPreviews === currPreviews;
141128
141307
  const allInSync = [workersDevInSync, previewsInSync].every((v8) => v8);
@@ -141154,17 +141333,19 @@ async function subdomainDeploy(props, accountId, scriptName, envName, workerUrl,
141154
141333
  workersDevURL = props.legacyEnv || !props.env ? `${scriptName}.${userSubdomain}` : `${envName}.${scriptName}.${userSubdomain}`;
141155
141334
  }
141156
141335
  if (!allInSync) {
141157
- await fetchResult(config, `${workerUrl}/subdomain`, {
141158
- method: "POST",
141159
- body: JSON.stringify({
141160
- enabled: wantWorkersDev,
141161
- previews_enabled: wantPreviews
141162
- }),
141163
- headers: {
141164
- "Content-Type": "application/json",
141165
- "Cloudflare-Workers-Script-Api-Date": "2025-08-01"
141166
- }
141167
- });
141336
+ await retryOnAPIFailure(
141337
+ async () => fetchResult(config, `${workerUrl}/subdomain`, {
141338
+ method: "POST",
141339
+ body: JSON.stringify({
141340
+ enabled: wantWorkersDev,
141341
+ previews_enabled: wantPreviews
141342
+ }),
141343
+ headers: {
141344
+ "Content-Type": "application/json",
141345
+ "Cloudflare-Workers-Script-Api-Date": "2025-08-01"
141346
+ }
141347
+ })
141348
+ );
141168
141349
  }
141169
141350
  if (workersDevURL) {
141170
141351
  deployments.push(Promise.resolve([workersDevURL]));
@@ -141183,7 +141364,9 @@ var init_deploy3 = __esm({
141183
141364
  init_dist2();
141184
141365
  init_cfetch();
141185
141366
  init_deploy8();
141367
+ init_misc_variables();
141186
141368
  init_errors();
141369
+ init_is_interactive();
141187
141370
  init_logger();
141188
141371
  init_client2();
141189
141372
  init_routes5();
@@ -141191,6 +141374,7 @@ var init_deploy3 = __esm({
141191
141374
  init_zones3();
141192
141375
  __name(triggersDeploy, "triggersDeploy");
141193
141376
  __name(getSubdomainValues, "getSubdomainValues");
141377
+ __name(validateSubdomainMixedState, "validateSubdomainMixedState");
141194
141378
  __name(subdomainDeploy, "subdomainDeploy");
141195
141379
  }
141196
141380
  });
@@ -149476,7 +149660,7 @@ function containerAppToInstanceType(containerApp) {
149476
149660
  };
149477
149661
  }
149478
149662
  if (configuration.disk?.size_mb === void 0 && configuration.vcpu === void 0 && configuration.memory_mib === void 0) {
149479
- return { instance_type: "dev" /* DEV */ };
149663
+ return { instance_type: "lite" /* LITE */ };
149480
149664
  }
149481
149665
  return configuration;
149482
149666
  }
@@ -149551,7 +149735,7 @@ async function apply2(args, config) {
149551
149735
  image: "docker.io/cloudflare/hello-world:1.0",
149552
149736
  instances: 2,
149553
149737
  name: config.name ?? "my-containers-application",
149554
- instance_type: "dev"
149738
+ instance_type: "lite"
149555
149739
  };
149556
149740
  const endConfig = args.env !== void 0 ? {
149557
149741
  env: { [args.env]: { containers: [configuration] } }
@@ -150667,7 +150851,14 @@ function createCommandOptionalYargs(yargs) {
150667
150851
  describe: "ID of the SSH key to add to the deployment"
150668
150852
  }).option("instance-type", {
150669
150853
  requiresArg: true,
150670
- choices: ["dev", "basic", "standard"],
150854
+ choices: [
150855
+ "lite",
150856
+ "basic",
150857
+ "standard-1",
150858
+ "standard-2",
150859
+ "standard-3",
150860
+ "standard-4"
150861
+ ],
150671
150862
  demandOption: false,
150672
150863
  describe: "Instance type to allocate to this deployment"
150673
150864
  }).option("vcpu", {
@@ -155684,10 +155875,15 @@ var init_deploy4 = __esm({
155684
155875
  choices: ["immediate", "gradual"]
155685
155876
  },
155686
155877
  "experimental-deploy-remote-diff-check": {
155687
- describe: `Experimental: Enable The Deployment Remote Diff check`,
155878
+ describe: "Experimental: Enable The Deployment Remote Diff check",
155688
155879
  type: "boolean",
155689
155880
  hidden: true,
155690
155881
  alias: ["x-remote-diff-check"]
155882
+ },
155883
+ strict: {
155884
+ describe: "Enables strict mode for the deploy command, this prevents deployments to occur when there are even small potential risks.",
155885
+ type: "boolean",
155886
+ default: false
155691
155887
  }
155692
155888
  },
155693
155889
  behaviour: {
@@ -155703,7 +155899,7 @@ var init_deploy4 = __esm({
155703
155899
  validateArgs(args) {
155704
155900
  if (args.nodeCompat) {
155705
155901
  throw new UserError2(
155706
- `The --node-compat flag is no longer supported as of Wrangler v4. Instead, use the \`nodejs_compat\` compatibility flag. This includes the functionality from legacy \`node_compat\` polyfills and natively implemented Node.js APIs. See https://developers.cloudflare.com/workers/runtime-apis/nodejs for more information.`,
155902
+ "The --node-compat flag is no longer supported as of Wrangler v4. Instead, use the `nodejs_compat` compatibility flag. This includes the functionality from legacy `node_compat` polyfills and natively implemented Node.js APIs. See https://developers.cloudflare.com/workers/runtime-apis/nodejs for more information.",
155707
155903
  { telemetryMessage: true }
155708
155904
  );
155709
155905
  }
@@ -155811,7 +156007,8 @@ var init_deploy4 = __esm({
155811
156007
  projectRoot,
155812
156008
  dispatchNamespace: args.dispatchNamespace,
155813
156009
  experimentalAutoCreate: args.experimentalAutoCreate,
155814
- containersRollout: args.containersRollout
156010
+ containersRollout: args.containersRollout,
156011
+ strict: args.strict
155815
156012
  });
155816
156013
  writeOutput({
155817
156014
  type: "deploy",
@@ -156659,7 +156856,19 @@ var init_create4 = __esm({
156659
156856
  demandOption: true,
156660
156857
  description: "The name of the Hyperdrive config"
156661
156858
  },
156662
- ...upsertOptions("postgresql")
156859
+ ...upsertOptions("postgresql"),
156860
+ binding: {
156861
+ type: "string",
156862
+ description: "The binding name of this resource in your Worker"
156863
+ },
156864
+ "use-remote": {
156865
+ type: "boolean",
156866
+ description: "Use a remote binding when adding the newly created resource to your config"
156867
+ },
156868
+ "update-config": {
156869
+ type: "boolean",
156870
+ description: "Automatically update your config file with the newly added resource"
156871
+ }
156663
156872
  },
156664
156873
  positionalArgs: ["name"],
156665
156874
  async handler(args, { config }) {
@@ -156676,16 +156885,14 @@ var init_create4 = __esm({
156676
156885
  `\u2705 Created new Hyperdrive ${capitalizeScheme(database.origin.scheme)} config: ${database.id}`
156677
156886
  );
156678
156887
  await updateConfigFile(
156888
+ "hyperdrive",
156679
156889
  (name2) => ({
156680
- hyperdrive: [
156681
- {
156682
- binding: getValidBindingName(name2 ?? "HYPERDRIVE", "HYPERDRIVE"),
156683
- id: database.id
156684
- }
156685
- ]
156890
+ binding: getValidBindingName(name2 ?? "HYPERDRIVE", "HYPERDRIVE"),
156891
+ id: database.id
156686
156892
  }),
156687
156893
  config.configPath,
156688
- args.env
156894
+ args.env,
156895
+ args
156689
156896
  );
156690
156897
  }
156691
156898
  });
@@ -157343,7 +157550,8 @@ var init_kv2 = __esm({
157343
157550
  preview: {
157344
157551
  type: "boolean",
157345
157552
  describe: "Interact with a preview namespace"
157346
- }
157553
+ },
157554
+ ...sharedResourceCreationArgs
157347
157555
  },
157348
157556
  positionalArgs: ["namespace"],
157349
157557
  async handler(args, { sdk }) {
@@ -157364,17 +157572,14 @@ var init_kv2 = __esm({
157364
157572
  logger.log("\u2728 Success!");
157365
157573
  const previewString = args.preview ? "preview_" : "";
157366
157574
  await updateConfigFile(
157575
+ "kv_namespaces",
157367
157576
  (name2) => ({
157368
- kv_namespaces: [
157369
- {
157370
- binding: getValidBindingName(name2 ?? args.namespace, "KV"),
157371
- [`${previewString}id`]: namespaceId
157372
- }
157373
- ]
157577
+ binding: getValidBindingName(name2 ?? args.namespace, "KV"),
157578
+ [`${previewString}id`]: namespaceId
157374
157579
  }),
157375
157580
  config.configPath,
157376
157581
  args.env,
157377
- !args.preview
157582
+ { ...args, updateConfig: preview ? false : args.updateConfig }
157378
157583
  );
157379
157584
  }
157380
157585
  });
@@ -164379,7 +164584,8 @@ var init_deployments4 = __esm({
164379
164584
  hideGlobalFlags: ["config", "env"]
164380
164585
  },
164381
164586
  behaviour: {
164382
- provideConfig: false
164587
+ provideConfig: false,
164588
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
164383
164589
  },
164384
164590
  args: {
164385
164591
  "project-name": {
@@ -199865,18 +200071,14 @@ async function displayUsageExamples(stream2, config, args) {
199865
200071
  Send your first event to stream '${stream2.name}':`);
199866
200072
  logger.log("\nWorker Integration:");
199867
200073
  await updateConfigFile(
200074
+ "pipelines",
199868
200075
  (customBindingName) => ({
199869
- pipelines: [
199870
- {
199871
- pipeline: stream2.id,
199872
- binding: customBindingName ?? bindingName
199873
- }
199874
- ]
200076
+ pipeline: stream2.id,
200077
+ binding: customBindingName ?? bindingName
199875
200078
  }),
199876
200079
  config.configPath,
199877
200080
  args.env,
199878
- false
199879
- // Don't offer to update automatically
200081
+ { updateConfig: false }
199880
200082
  );
199881
200083
  logger.log("\nIn your Worker:");
199882
200084
  logger.log(`await env.${bindingName}.send([${exampleData}]);`);
@@ -200500,6 +200702,9 @@ var init_get2 = __esm({
200500
200702
  owner: "Product: Pipelines",
200501
200703
  status: "open-beta"
200502
200704
  },
200705
+ behaviour: {
200706
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
200707
+ },
200503
200708
  args: {
200504
200709
  pipeline: {
200505
200710
  type: "string",
@@ -200595,6 +200800,9 @@ var init_list5 = __esm({
200595
200800
  owner: "Product: Pipelines",
200596
200801
  status: "open-beta"
200597
200802
  },
200803
+ behaviour: {
200804
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
200805
+ },
200598
200806
  args: {
200599
200807
  page: {
200600
200808
  describe: "Page number for pagination",
@@ -201800,6 +202008,9 @@ var init_get3 = __esm({
201800
202008
  owner: "Product: Pipelines",
201801
202009
  status: "open-beta"
201802
202010
  },
202011
+ behaviour: {
202012
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
202013
+ },
201803
202014
  positionalArgs: ["sink"],
201804
202015
  args: {
201805
202016
  sink: {
@@ -201848,6 +202059,9 @@ var init_list6 = __esm({
201848
202059
  owner: "Product: Pipelines",
201849
202060
  status: "open-beta"
201850
202061
  },
202062
+ behaviour: {
202063
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
202064
+ },
201851
202065
  args: {
201852
202066
  page: {
201853
202067
  describe: "Page number for pagination",
@@ -202092,6 +202306,9 @@ var init_get4 = __esm({
202092
202306
  owner: "Product: Pipelines",
202093
202307
  status: "open-beta"
202094
202308
  },
202309
+ behaviour: {
202310
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
202311
+ },
202095
202312
  positionalArgs: ["stream"],
202096
202313
  args: {
202097
202314
  stream: {
@@ -202136,6 +202353,9 @@ var init_list7 = __esm({
202136
202353
  owner: "Product: Pipelines",
202137
202354
  status: "open-beta"
202138
202355
  },
202356
+ behaviour: {
202357
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
202358
+ },
202139
202359
  args: {
202140
202360
  page: {
202141
202361
  describe: "Page number for pagination",
@@ -203940,6 +204160,9 @@ var init_get5 = __esm({
203940
204160
  owner: "Product: Queues",
203941
204161
  status: "stable"
203942
204162
  },
204163
+ behaviour: {
204164
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
204165
+ },
203943
204166
  positionalArgs: ["queue"],
203944
204167
  args: {
203945
204168
  queue: {
@@ -204001,6 +204224,9 @@ var init_list9 = __esm({
204001
204224
  owner: "Product: Queues",
204002
204225
  status: "stable"
204003
204226
  },
204227
+ behaviour: {
204228
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
204229
+ },
204004
204230
  positionalArgs: ["queue"],
204005
204231
  args: {
204006
204232
  queue: {
@@ -204068,6 +204294,9 @@ var init_update3 = __esm({
204068
204294
  owner: "Product: Queues",
204069
204295
  status: "stable"
204070
204296
  },
204297
+ behaviour: {
204298
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
204299
+ },
204071
204300
  positionalArgs: ["queue"],
204072
204301
  args: {
204073
204302
  queue: {
@@ -204307,7 +204536,8 @@ var init_bucket = __esm({
204307
204536
  alias: "J",
204308
204537
  requiresArg: true,
204309
204538
  type: "string"
204310
- }
204539
+ },
204540
+ ...sharedResourceCreationArgs
204311
204541
  },
204312
204542
  async handler(args, { config }) {
204313
204543
  const accountId = await requireAuth(config);
@@ -204338,16 +204568,14 @@ var init_bucket = __esm({
204338
204568
  logger.log(esm_default2`
204339
204569
  ✅ Created bucket '${fullBucketName}' with${location ? ` location hint ${location} and` : ``} default storage class of ${storageClass ? storageClass : `Standard`}.`);
204340
204570
  await updateConfigFile(
204571
+ "r2_buckets",
204341
204572
  (bindingName) => ({
204342
- r2_buckets: [
204343
- {
204344
- bucket_name: args.name,
204345
- binding: getValidBindingName(bindingName ?? args.name, "r2")
204346
- }
204347
- ]
204573
+ bucket_name: args.name,
204574
+ binding: getValidBindingName(bindingName ?? args.name, "r2")
204348
204575
  }),
204349
204576
  config.configPath,
204350
- args.env
204577
+ args.env,
204578
+ args
204351
204579
  );
204352
204580
  sendMetricsEvent("create r2 bucket", {
204353
204581
  sendMetrics: config.send_metrics
@@ -218291,7 +218519,8 @@ function addBreadcrumb2(message, level = "log") {
218291
218519
  }
218292
218520
  async function captureGlobalException(e8) {
218293
218521
  if (true) {
218294
- sentryReportingAllowed = await confirm(
218522
+ const sendErrorReportsEnvVar = getWranglerSendErrorReportsFromEnv();
218523
+ sentryReportingAllowed = sendErrorReportsEnvVar !== void 0 ? sendErrorReportsEnvVar : await confirm(
218295
218524
  "Would you like to report this error to Cloudflare? Wrangler's output and the error details will be shared with the Wrangler team to help us diagnose and fix the issue.",
218296
218525
  { fallbackValue: false }
218297
218526
  );
@@ -218317,6 +218546,7 @@ var init_sentry = __esm({
218317
218546
  import_undici17 = __toESM(require_undici());
218318
218547
  init_package();
218319
218548
  init_dialogs();
218549
+ init_misc_variables();
218320
218550
  init_logger();
218321
218551
  sentryReportingAllowed = false;
218322
218552
  makeSentry10Transport = /* @__PURE__ */ __name((options) => {
@@ -220313,7 +220543,8 @@ var init_create10 = __esm({
220313
220543
  deprecated: true,
220314
220544
  default: deprecatedV1DefaultFlag,
220315
220545
  description: "Create a deprecated Vectorize V1 index. This is not recommended and indexes created with this option need all other Vectorize operations to have this option enabled."
220316
- }
220546
+ },
220547
+ ...sharedResourceCreationArgs
220317
220548
  },
220318
220549
  positionalArgs: ["name"],
220319
220550
  async handler(args, { config }) {
@@ -220359,16 +220590,14 @@ var init_create10 = __esm({
220359
220590
  `\u2705 Successfully created a new Vectorize index: '${indexResult.name}'`
220360
220591
  );
220361
220592
  await updateConfigFile(
220593
+ "vectorize",
220362
220594
  (name2) => ({
220363
- vectorize: [
220364
- {
220365
- binding: getValidBindingName(name2 ?? bindingName, bindingName),
220366
- index_name: indexResult.name
220367
- }
220368
- ]
220595
+ binding: getValidBindingName(name2 ?? bindingName, bindingName),
220596
+ index_name: indexResult.name
220369
220597
  }),
220370
220598
  config.configPath,
220371
- args.env
220599
+ args.env,
220600
+ args
220372
220601
  );
220373
220602
  }
220374
220603
  });
@@ -222102,7 +222331,7 @@ var init_list12 = __esm({
222102
222331
  }
222103
222332
  },
222104
222333
  behaviour: {
222105
- printBanner: false
222334
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
222106
222335
  },
222107
222336
  handler: /* @__PURE__ */ __name(async function versionsDeploymentsListHandler(args, { config }) {
222108
222337
  sendMetricsEvent(
@@ -222186,7 +222415,6 @@ var init_status3 = __esm({
222186
222415
  init_metrics2();
222187
222416
  init_user3();
222188
222417
  init_render_labelled_values();
222189
- init_wrangler_banner();
222190
222418
  init_api();
222191
222419
  init_list12();
222192
222420
  BLANK_INPUT4 = "-";
@@ -222209,12 +222437,9 @@ var init_status3 = __esm({
222209
222437
  }
222210
222438
  },
222211
222439
  behaviour: {
222212
- printBanner: false
222440
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
222213
222441
  },
222214
222442
  handler: /* @__PURE__ */ __name(async function versionsDeploymentsStatusHandler(args, { config }) {
222215
- if (!args.json) {
222216
- await printWranglerBanner();
222217
- }
222218
222443
  sendMetricsEvent(
222219
222444
  "view latest versioned deployment",
222220
222445
  {},
@@ -229282,6 +229507,13 @@ async function main(argv) {
229282
229507
  (args) => {
229283
229508
  if (Object.keys(LOGGER_LEVELS).includes(args.logLevel)) {
229284
229509
  logger.loggerLevel = args.logLevel;
229510
+ setLogLevel(args.logLevel);
229511
+ }
229512
+ const envLogLevel = getEnvironmentVariableFactory({
229513
+ variableName: "WRANGLER_LOG"
229514
+ })()?.toLowerCase();
229515
+ if (envLogLevel) {
229516
+ setLogLevel(envLogLevel);
229285
229517
  }
229286
229518
  if (recordedCommand) {
229287
229519
  return;
@@ -229346,7 +229578,7 @@ async function main(argv) {
229346
229578
  logger.error(e8.cause);
229347
229579
  } else {
229348
229580
  (0, import_node_assert22.default)(isAuthenticationError(e8));
229349
- logger.log(formatMessage(e8));
229581
+ logger.error(e8);
229350
229582
  }
229351
229583
  const envAuth = getAuthFromEnv();
229352
229584
  if (envAuth !== void 0 && "apiToken" in envAuth) {
@@ -229367,7 +229599,7 @@ async function main(argv) {
229367
229599
  e8.notes.push({
229368
229600
  text: "\nIf you think this is a bug, please open an issue at: https://github.com/cloudflare/workers-sdk/issues/new/choose"
229369
229601
  });
229370
- logger.log(formatMessage(e8));
229602
+ logger.error(e8);
229371
229603
  } else if (e8 instanceof JsonFriendlyFatalError) {
229372
229604
  logger.log(e8.message);
229373
229605
  } else if (e8 instanceof Error && e8.message.includes("Raw mode is not supported on")) {
@@ -229398,7 +229630,7 @@ ${tryRunningItIn}${oneOfThese}`
229398
229630
  error2.notes.push({
229399
229631
  text: "\nIf you think this is a bug, please open an issue at: https://github.com/cloudflare/workers-sdk/issues/new/choose"
229400
229632
  });
229401
- logger.log(formatMessage(error2));
229633
+ logger.error(error2);
229402
229634
  } else {
229403
229635
  if (
229404
229636
  // Is this a StartDevEnv error event? If so, unwrap the cause, which is usually the user-recognisable error
@@ -229512,6 +229744,7 @@ var init_src2 = __esm({
229512
229744
  init_dev2();
229513
229745
  init_dispatch_namespace();
229514
229746
  init_docs();
229747
+ init_factory();
229515
229748
  init_misc_variables();
229516
229749
  init_errors();
229517
229750
  init_hello_world();
@@ -230263,6 +230496,7 @@ Update them to point to this script instead?`;
230263
230496
  return domains.map((domain2) => renderRoute(domain2));
230264
230497
  }
230265
230498
  async function deploy(props) {
230499
+ const deployConfirm = getDeployConfirmFunction(props.strict);
230266
230500
  const { config, accountId, name: name2, entry } = props;
230267
230501
  let workerTag = null;
230268
230502
  let versionId = null;
@@ -230305,7 +230539,7 @@ ${configDiff.diff}
230305
230539
 
230306
230540
  Deploying the Worker will override the remote configuration with your local one.`
230307
230541
  );
230308
- if (!await confirm("Would you like to continue?")) {
230542
+ if (!await deployConfirm("Would you like to continue?")) {
230309
230543
  return { versionId, workerTag };
230310
230544
  }
230311
230545
  }
@@ -230314,7 +230548,7 @@ Deploying the Worker will override the remote configuration with your local one.
230314
230548
  `You are about to publish a Workers Service that was last published via the Cloudflare Dashboard.
230315
230549
  Edits that have been made via the dashboard will be overridden by your local code and config.`
230316
230550
  );
230317
- if (!await confirm("Would you like to continue?")) {
230551
+ if (!await deployConfirm("Would you like to continue?")) {
230318
230552
  return { versionId, workerTag };
230319
230553
  }
230320
230554
  }
@@ -230323,7 +230557,7 @@ Edits that have been made via the dashboard will be overridden by your local cod
230323
230557
  `You are about to publish a Workers Service that was last updated via the script API.
230324
230558
  Edits that have been made via the script API will be overridden by your local code and config.`
230325
230559
  );
230326
- if (!await confirm("Would you like to continue?")) {
230560
+ if (!await deployConfirm("Would you like to continue?")) {
230327
230561
  return { versionId, workerTag };
230328
230562
  }
230329
230563
  }
@@ -230902,7 +231136,7 @@ async function publishRoutesFallback(complianceConfig, routes, {
230902
231136
  { telemetryMessage: true }
230903
231137
  );
230904
231138
  }
230905
- logger.warn(
231139
+ logger.info(
230906
231140
  "The current authentication token does not have 'All Zones' permissions.\nFalling back to using the zone-based API endpoint to update each route individually.\nNote that there is no access to routes associated with zones that the API token does not have permission for.\nExisting routes for this Worker in such zones will not be deleted."
230907
231141
  );
230908
231142
  const deployedRoutes = [];
@@ -231067,6 +231301,19 @@ async function updateQueueConsumers(scriptName, config) {
231067
231301
  }
231068
231302
  return updateConsumers;
231069
231303
  }
231304
+ function getDeployConfirmFunction(strictMode = false) {
231305
+ const nonInteractive = isNonInteractiveOrCI();
231306
+ if (nonInteractive && strictMode) {
231307
+ return async () => {
231308
+ logger.error(
231309
+ "Aborting the deployment operation because of conflicts. To override and deploy anyway remove the `--strict` flag"
231310
+ );
231311
+ process.exitCode = 1;
231312
+ return false;
231313
+ };
231314
+ }
231315
+ return confirm;
231316
+ }
231070
231317
  var import_node_assert23, import_node_fs36, import_node_path56, import_node_url10, import_undici22, validateRoutes3;
231071
231318
  var init_deploy8 = __esm({
231072
231319
  "src/deploy/deploy.ts"() {
@@ -231099,6 +231346,7 @@ var init_deploy8 = __esm({
231099
231346
  init_environments();
231100
231347
  init_errors();
231101
231348
  init_experimental_flags();
231349
+ init_is_interactive();
231102
231350
  init_logger();
231103
231351
  init_metrics2();
231104
231352
  init_navigator_user_agent();
@@ -231178,6 +231426,7 @@ ${mountedAssetRoutes.map((route) => {
231178
231426
  __name(publishRoutesFallback, "publishRoutesFallback");
231179
231427
  __name(isAuthenticationError, "isAuthenticationError");
231180
231428
  __name(updateQueueConsumers, "updateQueueConsumers");
231429
+ __name(getDeployConfirmFunction, "getDeployConfirmFunction");
231181
231430
  }
231182
231431
  });
231183
231432
 
@@ -252412,7 +252661,7 @@ var init_ProxyController = __esm({
252412
252661
 
252413
252662
  // src/utils/isAbortError.ts
252414
252663
  function isAbortError(err) {
252415
- const legacyAbortErroCheck = err.code !== "ABORT_ERR";
252664
+ const legacyAbortErroCheck = err.code == "ABORT_ERR";
252416
252665
  const abortErrorCheck = err instanceof Error && err.name == "AbortError";
252417
252666
  return legacyAbortErroCheck || abortErrorCheck;
252418
252667
  }
@@ -252584,7 +252833,7 @@ var init_create_worker_preview = __esm({
252584
252833
  // src/dev/remote.ts
252585
252834
  function handlePreviewSessionUploadError(err, accountId) {
252586
252835
  (0, import_node_assert30.default)(err && typeof err === "object");
252587
- if (isAbortError(err)) {
252836
+ if (!isAbortError(err)) {
252588
252837
  if ("code" in err && err.code === 10049) {
252589
252838
  logger.log("Preview token expired, fetching a new one");
252590
252839
  return true;
@@ -252597,12 +252846,9 @@ function handlePreviewSessionUploadError(err, accountId) {
252597
252846
  function handlePreviewSessionCreationError(err, accountId) {
252598
252847
  (0, import_node_assert30.default)(err && typeof err === "object");
252599
252848
  if ("code" in err && err.code === 10063) {
252600
- const errorMessage = "Error: You need to register a workers.dev subdomain before running the dev command in remote mode";
252601
- const solutionMessage = "You can either enable local mode by pressing l, or register a workers.dev subdomain here:";
252602
- const onboardingLink = `https://dash.cloudflare.com/${accountId}/workers/onboarding`;
252603
- logger.error(`${errorMessage}
252604
- ${solutionMessage}
252605
- ${onboardingLink}`);
252849
+ logger.error(
252850
+ `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`
252851
+ );
252606
252852
  } else if ("cause" in err && err.cause?.code === "ENOTFOUND") {
252607
252853
  logger.error(
252608
252854
  `Could not access \`${err.cause.hostname}\`. Make sure the domain is set up to be proxied by Cloudflare.
@@ -252610,7 +252856,7 @@ For more details, refer to https://developers.cloudflare.com/workers/configurati
252610
252856
  );
252611
252857
  } else if (err instanceof UserError2) {
252612
252858
  logger.error(err.message);
252613
- } else if (isAbortError(err)) {
252859
+ } else if (!isAbortError(err)) {
252614
252860
  logger.error("Error while creating remote dev session:", err);
252615
252861
  }
252616
252862
  }
@@ -252723,34 +252969,30 @@ async function getWorkerAccountAndContext(props) {
252723
252969
  return { workerAccount, workerContext };
252724
252970
  }
252725
252971
  function handleUserFriendlyError(error2, accountId) {
252726
- switch (error2.code) {
252727
- // code 10021 is a validation error
252728
- case 10021: {
252729
- if (error2.notes[0].text === "binding DB of type d1 must have a valid `id` specified [code: 10021]") {
252730
- const errorMessage = "Error: You must use a real database in the preview_database_id configuration.";
252731
- const solutionMessage = "You can find your databases using 'wrangler d1 list', or read how to develop locally with D1 here:";
252732
- const documentationLink = `https://developers.cloudflare.com/d1/configuration/local-development`;
252972
+ if (error2 instanceof APIError) {
252973
+ switch (error2.code) {
252974
+ // code 10021 is a validation error
252975
+ case 10021: {
252976
+ if (error2.notes[0].text === "binding DB of type d1 must have a valid `id` specified [code: 10021]") {
252977
+ logger.error(
252978
+ `You must use a real database in the preview_database_id configuration. You can find your databases using 'wrangler d1 list', or read how to develop locally with D1 here: https://developers.cloudflare.com/d1/configuration/local-development`
252979
+ );
252980
+ return true;
252981
+ }
252982
+ return false;
252983
+ }
252984
+ // for error 10063 (workers.dev subdomain required)
252985
+ case 10063: {
252986
+ const onboardingLink = accountId ? `https://dash.cloudflare.com/${accountId}/workers/onboarding` : "https://dash.cloudflare.com/?to=/:account/workers/onboarding";
252733
252987
  logger.error(
252734
- `${errorMessage}
252735
- ${solutionMessage}
252736
- ${documentationLink}`
252988
+ `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: ${onboardingLink}`
252737
252989
  );
252738
252990
  return true;
252739
252991
  }
252740
- return false;
252741
- }
252742
- // for error 10063 (workers.dev subdomain required)
252743
- case 10063: {
252744
- const errorMessage = "Error: You need to register a workers.dev subdomain before running the dev command in remote mode";
252745
- const solutionMessage = "You can either enable local mode by pressing l, or register a workers.dev subdomain here:";
252746
- const onboardingLink = accountId ? `https://dash.cloudflare.com/${accountId}/workers/onboarding` : "https://dash.cloudflare.com/?to=/:account/workers/onboarding";
252747
- logger.error(`${errorMessage}
252748
- ${solutionMessage}
252749
- ${onboardingLink}`);
252750
- return true;
252751
- }
252752
- default: {
252753
- return false;
252992
+ default: {
252993
+ logger.error(error2);
252994
+ return true;
252995
+ }
252754
252996
  }
252755
252997
  }
252756
252998
  }
@@ -252767,6 +253009,7 @@ var init_remote = __esm({
252767
253009
  init_dev2();
252768
253010
  init_errors();
252769
253011
  init_logger();
253012
+ init_parse();
252770
253013
  init_sites2();
252771
253014
  init_user3();
252772
253015
  init_isAbortError();
@@ -253241,7 +253484,7 @@ var init_DevEnv = __esm({
253241
253484
  `, ev.cause);
253242
253485
  logger.debug("=> Error contextual data:", ev.data);
253243
253486
  } else if (ev.source === "ConfigController" && ev.cause instanceof ParseError) {
253244
- logger.log(formatMessage(ev.cause));
253487
+ logger.error(ev.cause);
253245
253488
  } else {
253246
253489
  this.emit("error", ev);
253247
253490
  }