@cloudflare/deploy-helpers 0.21.0 → 0.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from 'node:module';
2
- import { fetchResult, fetchPagedListResult, cliPresentation, logger, confirm, fetchListResult, prompt, select } from './chunk-JXU4CCEI.mjs';
3
- export { initDeployHelpersContext } from './chunk-JXU4CCEI.mjs';
2
+ import { fetchResult, fetchPagedListResult, logger, confirm, fetchListResult, prompt, select } from './chunk-Y4VATABS.mjs';
3
+ export { initDeployHelpersContext } from './chunk-Y4VATABS.mjs';
4
4
  import { createWorkerUploadForm, moduleTypeMimeType } from './chunk-DSGVRFIS.mjs';
5
5
  export { createWorkerUploadForm, fromMimeType, handleUnsafeCapnp, moduleTypeMimeType } from './chunk-DSGVRFIS.mjs';
6
6
  import { __commonJS, __name, __require, __toESM, __export } from './chunk-U6NEESU5.mjs';
@@ -12,7 +12,7 @@ import url2, { URLSearchParams as URLSearchParams$1 } from 'node:url';
12
12
  import * as cli from '@cloudflare/cli-shared-helpers';
13
13
  import { updateStatus, cancel } from '@cloudflare/cli-shared-helpers';
14
14
  import { SchedulingPolicy, ApplicationsService, listDurableObjects, ApiError, resolveImageName, pushImageIfChanged, ContainerImagePreparationsService, ContainerImagePreparationStatus, createDurableObjectNamespaceResolver, initContainersSharedContext, pushBuiltContainerImage, deployContainers, verifyDockerInstalled } from '@cloudflare/containers-shared';
15
- import { INHERIT_SYMBOL, APIError, UserError, getEnvironmentVariableFactory, partitionExports, isNonInteractiveOrCI, getHostFromRoute, retryOnAPIFailure, ParseError, getComplianceRegionSubdomain, configFileName, formatTime, getSubdomainMixedStateCheckDisabled, LOGGER_LEVELS, getResolvedDurableObjectContainerApps, isDurableObjectContainerApp, getDockerPath, validateDurableObjectContainerApplications, getDurableObjectClassNameToUseSQLiteMap, SERVICE_TAG_PREFIX, ENVIRONMENT_TAG_PREFIX, getDurableObjectExports, getWranglerTmpDir, parsePackageJSON, getInstalledPackageVersion, FatalError, readFileSync as readFileSync$1, parseJSON, experimental_readRawConfig, experimental_patchConfig, printBindings, PatchConfigError, COMPLIANCE_REGION_CONFIG_UNKNOWN, constructWranglerConfig, getCIMatchTag, formatConfigSnippet, DEFAULT_COMPAT_DATE, writeOutput, getDurableObjectContainerApps, getBindings, hasDurableObjectExports, parseNonHyphenedUuid, getWorkersCIBranchName, getCIOverrideName, isLiveDurableObjectExport, getBindingTypeFriendlyName, defaultWranglerConfig } from '@cloudflare/workers-utils';
15
+ import { INHERIT_SYMBOL, APIError, UserError, getEnvironmentVariableFactory, partitionExports, isNonInteractiveOrCI, getHostFromRoute, retryOnAPIFailure, ParseError, getComplianceRegionSubdomain, configFileName, formatTime, getSubdomainMixedStateCheckDisabled, LOGGER_LEVELS, getResolvedDurableObjectContainerApps, isDurableObjectContainerApp, getDockerPath, validateDurableObjectContainerApplications, getDurableObjectClassNameToUseSQLiteMap, SERVICE_TAG_PREFIX, ENVIRONMENT_TAG_PREFIX, getDurableObjectExports, getWranglerTmpDir, parsePackageJSON, getInstalledPackageVersion, FatalError, readFileSync as readFileSync$1, parseJSON, experimental_readRawConfig, experimental_patchConfig, printBindings, PatchConfigError, constructWranglerConfig, getCIMatchTag, formatConfigSnippet, DEFAULT_COMPAT_DATE, writeOutput, getDurableObjectContainerApps, getBindings, hasDurableObjectExports, parseNonHyphenedUuid, getWorkersCIBranchName, getCIOverrideName, isLiveDurableObjectExport, getBindingTypeFriendlyName, defaultWranglerConfig } from '@cloudflare/workers-utils';
16
16
  import { Response, FormData } from 'undici';
17
17
  import chalk6 from 'chalk';
18
18
  import PQueue4 from 'p-queue';
@@ -2916,7 +2916,7 @@ function describeConflictOwner(remote) {
2916
2916
  if (remote.source === "wrangler") {
2917
2917
  return remote.owner_worker_name ? `owned by worker "${remote.owner_worker_name}"` : "owned by another Worker";
2918
2918
  }
2919
- return `managed outside ${cliPresentation.displayName}`;
2919
+ return "managed outside this deployment";
2920
2920
  }
2921
2921
  __name(describeConflictOwner, "describeConflictOwner");
2922
2922
  function renderEmailRoutingPlan(plan, workerName) {
@@ -3583,19 +3583,25 @@ async function listQueues(complianceConfig, accountId, page, name) {
3583
3583
  );
3584
3584
  }
3585
3585
  __name(listQueues, "listQueues");
3586
- async function getQueue(complianceConfig, accountId, queueName) {
3586
+ async function getQueue(complianceConfig, accountId, queueName, queueCreateCommand) {
3587
3587
  const queues = await listQueues(complianceConfig, accountId, 1, queueName);
3588
3588
  if (queues.length === 0) {
3589
+ const createQueueGuidance = queueCreateCommand ? ` To create it, run: ${queueCreateCommand(queueName)}` : "";
3589
3590
  throw new UserError(
3590
- `Queue "${queueName}" does not exist. To create it, run: ${cliPresentation.commands.queuesCreate} ${queueName}`,
3591
+ `Queue "${queueName}" does not exist.${createQueueGuidance}`,
3591
3592
  { telemetryMessage: "queues lookup missing queue" }
3592
3593
  );
3593
3594
  }
3594
3595
  return queues[0];
3595
3596
  }
3596
3597
  __name(getQueue, "getQueue");
3597
- async function postConsumer(complianceConfig, accountId, queueName, body) {
3598
- const queue = await getQueue(complianceConfig, accountId, queueName);
3598
+ async function postConsumer(complianceConfig, accountId, queueName, body, queueCreateCommand) {
3599
+ const queue = await getQueue(
3600
+ complianceConfig,
3601
+ accountId,
3602
+ queueName,
3603
+ queueCreateCommand
3604
+ );
3599
3605
  return postConsumerById(complianceConfig, accountId, queue.queue_id, body);
3600
3606
  }
3601
3607
  __name(postConsumer, "postConsumer");
@@ -3621,8 +3627,13 @@ async function putConsumerById(complianceConfig, accountId, queueId, consumerId,
3621
3627
  );
3622
3628
  }
3623
3629
  __name(putConsumerById, "putConsumerById");
3624
- async function putConsumer(complianceConfig, accountId, queueName, scriptName, envName, body) {
3625
- const queue = await getQueue(complianceConfig, accountId, queueName);
3630
+ async function putConsumer(complianceConfig, accountId, queueName, scriptName, envName, body, queueCreateCommand) {
3631
+ const queue = await getQueue(
3632
+ complianceConfig,
3633
+ accountId,
3634
+ queueName,
3635
+ queueCreateCommand
3636
+ );
3626
3637
  const targetConsumer = await resolveWorkerConsumerByName(
3627
3638
  complianceConfig,
3628
3639
  accountId,
@@ -3697,8 +3708,13 @@ async function deleteConsumerById(complianceConfig, accountId, queueId, consumer
3697
3708
  );
3698
3709
  }
3699
3710
  __name(deleteConsumerById, "deleteConsumerById");
3700
- async function deletePullConsumer(complianceConfig, accountId, queueName) {
3701
- const queue = await getQueue(complianceConfig, accountId, queueName);
3711
+ async function deletePullConsumer(complianceConfig, accountId, queueName, queueCreateCommand) {
3712
+ const queue = await getQueue(
3713
+ complianceConfig,
3714
+ accountId,
3715
+ queueName,
3716
+ queueCreateCommand
3717
+ );
3702
3718
  const consumer = queue.consumers[0];
3703
3719
  if (consumer?.type !== "http_pull") {
3704
3720
  throw new UserError(`No http_pull consumer exists for queue ${queueName}`, {
@@ -3713,13 +3729,23 @@ async function deletePullConsumer(complianceConfig, accountId, queueName) {
3713
3729
  );
3714
3730
  }
3715
3731
  __name(deletePullConsumer, "deletePullConsumer");
3716
- async function listConsumers(complianceConfig, accountId, queueName) {
3717
- const queue = await getQueue(complianceConfig, accountId, queueName);
3732
+ async function listConsumers(complianceConfig, accountId, queueName, queueCreateCommand) {
3733
+ const queue = await getQueue(
3734
+ complianceConfig,
3735
+ accountId,
3736
+ queueName,
3737
+ queueCreateCommand
3738
+ );
3718
3739
  return queue.consumers;
3719
3740
  }
3720
3741
  __name(listConsumers, "listConsumers");
3721
- async function deleteWorkerConsumer(complianceConfig, accountId, queueName, scriptName, envName) {
3722
- const queue = await getQueue(complianceConfig, accountId, queueName);
3742
+ async function deleteWorkerConsumer(complianceConfig, accountId, queueName, scriptName, envName, queueCreateCommand) {
3743
+ const queue = await getQueue(
3744
+ complianceConfig,
3745
+ accountId,
3746
+ queueName,
3747
+ queueCreateCommand
3748
+ );
3723
3749
  const targetConsumer = await resolveWorkerConsumerByName(
3724
3750
  complianceConfig,
3725
3751
  accountId,
@@ -3735,11 +3761,16 @@ async function deleteWorkerConsumer(complianceConfig, accountId, queueName, scri
3735
3761
  );
3736
3762
  }
3737
3763
  __name(deleteWorkerConsumer, "deleteWorkerConsumer");
3738
- async function updateQueueConsumers(complianceConfig, accountId, scriptName, config2) {
3764
+ async function updateQueueConsumers(complianceConfig, accountId, scriptName, config2, queueCreateCommand) {
3739
3765
  const consumers = config2.queues.consumers || [];
3740
3766
  const updateConsumers = [];
3741
3767
  for (const consumer of consumers) {
3742
- const queue = await getQueue(complianceConfig, accountId, consumer.queue);
3768
+ const queue = await getQueue(
3769
+ complianceConfig,
3770
+ accountId,
3771
+ consumer.queue,
3772
+ queueCreateCommand
3773
+ );
3743
3774
  const body = {
3744
3775
  type: "worker",
3745
3776
  dead_letter_queue: consumer.dead_letter_queue,
@@ -3764,7 +3795,8 @@ async function updateQueueConsumers(complianceConfig, accountId, scriptName, con
3764
3795
  consumer.queue,
3765
3796
  scriptName,
3766
3797
  envName,
3767
- body
3798
+ body,
3799
+ queueCreateCommand
3768
3800
  ).then(
3769
3801
  () => ({ targets: [`Consumer for ${consumer.queue}`] }),
3770
3802
  (error62) => ({ targets: [], error: error62 })
@@ -3773,7 +3805,13 @@ async function updateQueueConsumers(complianceConfig, accountId, scriptName, con
3773
3805
  continue;
3774
3806
  }
3775
3807
  updateConsumers.push(
3776
- postConsumer(complianceConfig, accountId, consumer.queue, body).then(
3808
+ postConsumer(
3809
+ complianceConfig,
3810
+ accountId,
3811
+ consumer.queue,
3812
+ body,
3813
+ queueCreateCommand
3814
+ ).then(
3777
3815
  () => ({
3778
3816
  targets: [`Consumer for ${consumer.queue}`]
3779
3817
  }),
@@ -3791,7 +3829,7 @@ var queuesUrl = /* @__PURE__ */ __name((accountId, queueId) => {
3791
3829
  }
3792
3830
  return url3;
3793
3831
  }, "queuesUrl");
3794
- async function ensureQueuesExistByConfig(config2, accountId, includeProducers = true, scriptName) {
3832
+ async function ensureQueuesExistByConfig(config2, accountId, includeProducers = true, scriptName, queueCreateCommand) {
3795
3833
  const producerNames = (config2.queues.producers || []).flatMap((producer) => {
3796
3834
  if (producer.queue) {
3797
3835
  return [producer.queue];
@@ -3822,8 +3860,9 @@ async function ensureQueuesExistByConfig(config2, accountId, includeProducers =
3822
3860
  const queueSet = new Set(existingQueues);
3823
3861
  for (const queue of queueNames) {
3824
3862
  if (!queueSet.has(queue)) {
3863
+ const createQueueGuidance = queueCreateCommand ? ` To create it, run: ${queueCreateCommand(queue)}` : "";
3825
3864
  throw new UserError(
3826
- `Queue "${queue}" does not exist. To create it, run: ${cliPresentation.commands.queuesCreate} ${queue}`,
3865
+ `Queue "${queue}" does not exist.${createQueueGuidance}`,
3827
3866
  { telemetryMessage: "queues config missing queue" }
3828
3867
  );
3829
3868
  }
@@ -3996,7 +4035,7 @@ async function registerSubdomain(complianceConfig, accountId, configPath, regist
3996
4035
  if (subdomainAvailabilityCheckError.code === 10032) ; else if (subdomainAvailabilityCheckError.code === 10031) {
3997
4036
  if (automaticSubdomain) {
3998
4037
  throw new UserError(
3999
- `${cliPresentation.displayName} could not automatically register "${potentialName}" as your workers.dev subdomain because the name is unavailable. Register a different subdomain at https://dash.cloudflare.com/${accountId}/workers/onboarding.`,
4038
+ `Could not automatically register "${potentialName}" as your workers.dev subdomain because the name is unavailable. Register a different subdomain at https://dash.cloudflare.com/${accountId}/workers/onboarding.`,
4000
4039
  {
4001
4040
  telemetryMessage: "workers dev automatic registration name unavailable"
4002
4041
  }
@@ -4009,7 +4048,7 @@ async function registerSubdomain(complianceConfig, accountId, configPath, regist
4009
4048
  } else {
4010
4049
  if (automaticSubdomain) {
4011
4050
  throw new UserError(
4012
- `${cliPresentation.displayName} could not verify whether "${potentialName}" is available as your \`workers.dev\` subdomain. Register a subdomain at https://dash.cloudflare.com/${accountId}/workers/onboarding.`,
4051
+ `Could not verify whether "${potentialName}" is available as your \`workers.dev\` subdomain. Register a subdomain at https://dash.cloudflare.com/${accountId}/workers/onboarding.`,
4013
4052
  {
4014
4053
  telemetryMessage: "workers dev automatic registration availability check failed"
4015
4054
  }
@@ -4048,7 +4087,7 @@ async function registerSubdomain(complianceConfig, accountId, configPath, regist
4048
4087
  const subdomainCreationError = err;
4049
4088
  if (automaticSubdomain) {
4050
4089
  throw new UserError(
4051
- `${cliPresentation.displayName} could not automatically register "${potentialName}" as your \`workers.dev\` subdomain. Register a subdomain at https://dash.cloudflare.com/${accountId}/workers/onboarding.`,
4090
+ `Could not automatically register "${potentialName}" as your \`workers.dev\` subdomain. Register a subdomain at https://dash.cloudflare.com/${accountId}/workers/onboarding.`,
4052
4091
  {
4053
4092
  telemetryMessage: "workers dev automatic registration creation failed"
4054
4093
  }
@@ -4095,7 +4134,13 @@ async function triggersDeploy(props) {
4095
4134
  const { accountId } = props;
4096
4135
  assert6(accountId);
4097
4136
  if (props.validated !== true) {
4098
- await ensureQueuesExistByConfig(config2, accountId, true, scriptName);
4137
+ await ensureQueuesExistByConfig(
4138
+ config2,
4139
+ accountId,
4140
+ true,
4141
+ scriptName,
4142
+ props.queueCreateCommand
4143
+ );
4099
4144
  }
4100
4145
  const routesOnly = [];
4101
4146
  const customDomainsOnly = [];
@@ -4249,7 +4294,8 @@ ${dashLink}`, {
4249
4294
  config2,
4250
4295
  accountId,
4251
4296
  scriptName,
4252
- config2
4297
+ config2,
4298
+ props.queueCreateCommand
4253
4299
  );
4254
4300
  deployments.push(
4255
4301
  ...consumerUpdates.map(
@@ -4530,9 +4576,8 @@ function getSubdomainValuesAPIMock(config_workers_dev, config_preview_urls, rout
4530
4576
  };
4531
4577
  }
4532
4578
  __name(getSubdomainValuesAPIMock, "getSubdomainValuesAPIMock");
4533
- function renderWorkersDevDefaultWarning(beforeEnabled, afterEnabled) {
4534
- const workersDevField = cliPresentation.configFields.workersDev;
4535
- const workersDevAssignment = `${workersDevField}${cliPresentation.configFieldAssignmentSeparator}${beforeEnabled}`;
4579
+ function renderWorkersDevDefaultWarning(beforeEnabled, afterEnabled, configFile, workersDevConfigFieldName, workersDevConfigAssignment) {
4580
+ const workersDevAssignment = workersDevConfigAssignment(beforeEnabled);
4536
4581
  const status = /* @__PURE__ */ __name((enabled, past) => {
4537
4582
  if (past) {
4538
4583
  return enabled ? "enabled" : "disabled";
@@ -4541,12 +4586,12 @@ function renderWorkersDevDefaultWarning(beforeEnabled, afterEnabled) {
4541
4586
  }
4542
4587
  }, "status");
4543
4588
  return [
4544
- `Because '${workersDevField}' is not in your ${cliPresentation.displayConfigFileName}, it will be ${status(afterEnabled, true)} for this deployment by default.`,
4545
- `To override this setting, you can ${status(beforeEnabled, false)} workers.dev by explicitly setting '${workersDevAssignment}' in your ${cliPresentation.displayConfigFileName}.`
4589
+ `Because '${workersDevConfigFieldName}' is not in your ${configFile}, it will be ${status(afterEnabled, true)} for this deployment by default.`,
4590
+ `To override this setting, you can ${status(beforeEnabled, false)} workers.dev by explicitly setting '${workersDevAssignment}' in your ${configFile}.`
4546
4591
  ].join("\n");
4547
4592
  }
4548
4593
  __name(renderWorkersDevDefaultWarning, "renderWorkersDevDefaultWarning");
4549
- async function validateSubdomainMixedState(scriptName, before, after, previewURLSuffix, firstDeploy) {
4594
+ async function validateSubdomainMixedState(scriptName, before, after, previewURLSuffix, firstDeploy, configFile, previewUrlsConfigAssignment) {
4550
4595
  const changed = after.workers_dev !== before.workers_dev || after.preview_urls !== before.preview_urls;
4551
4596
  if (!changed) {
4552
4597
  return after;
@@ -4571,7 +4616,7 @@ async function validateSubdomainMixedState(scriptName, before, after, previewURL
4571
4616
  "Preview URLs will automatically generate a unique, shareable link for each new version which will be accessible at:",
4572
4617
  ` ${previewUrl}`,
4573
4618
  "",
4574
- `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 ${cliPresentation.displayConfigFileName}.`
4619
+ `To prevent this Worker from being unintentionally public, you may want to disable the Preview URLs as well by setting \`${previewUrlsConfigAssignment(false)}\` in your ${configFile}.`
4575
4620
  ].join("\n")
4576
4621
  );
4577
4622
  }
@@ -4582,7 +4627,7 @@ async function validateSubdomainMixedState(scriptName, before, after, previewURL
4582
4627
  "Preview URLs will automatically generate a unique, shareable link for each new version which will be accessible at:",
4583
4628
  ` ${previewUrl}`,
4584
4629
  "",
4585
- `You may want to enable the Preview URLs as well by setting \`preview_urls = true\` in your ${cliPresentation.displayConfigFileName}.`
4630
+ `You may want to enable the Preview URLs as well by setting \`${previewUrlsConfigAssignment(true)}\` in your ${configFile}.`
4586
4631
  ].join("\n")
4587
4632
  );
4588
4633
  }
@@ -4591,6 +4636,10 @@ async function validateSubdomainMixedState(scriptName, before, after, previewURL
4591
4636
  __name(validateSubdomainMixedState, "validateSubdomainMixedState");
4592
4637
  async function subdomainDeploy(props, accountId, scriptName, workerUrl, routes, deployments, firstDeploy) {
4593
4638
  const { config: config2 } = props;
4639
+ const displayConfigFileName = configFileName(
4640
+ config2.configPath,
4641
+ config2.userConfigPath
4642
+ );
4594
4643
  const { workers_dev: wantWorkersDev, preview_urls: wantPreviews } = getSubdomainValues(config2.workers_dev, config2.preview_urls, routes);
4595
4644
  const before = await getWorkerSubdomain(config2, accountId, scriptName);
4596
4645
  if (wantWorkersDev) {
@@ -4618,7 +4667,15 @@ async function subdomainDeploy(props, accountId, scriptName, workerUrl, routes,
4618
4667
  logger
4619
4668
  );
4620
4669
  if (!firstDeploy && config2.workers_dev == void 0 && after.enabled !== before.enabled) {
4621
- logger.warn(renderWorkersDevDefaultWarning(before.enabled, after.enabled));
4670
+ logger.warn(
4671
+ renderWorkersDevDefaultWarning(
4672
+ before.enabled,
4673
+ after.enabled,
4674
+ displayConfigFileName,
4675
+ props.workersDevConfigFieldName,
4676
+ props.workersDevConfigAssignment
4677
+ )
4678
+ );
4622
4679
  }
4623
4680
  if (!firstDeploy && config2.preview_urls == void 0 && after.previews_enabled !== before.previews_enabled) {
4624
4681
  const status = /* @__PURE__ */ __name((enabled, past) => {
@@ -4630,8 +4687,8 @@ async function subdomainDeploy(props, accountId, scriptName, workerUrl, routes,
4630
4687
  }, "status");
4631
4688
  logger.warn(
4632
4689
  [
4633
- `Because your 'workers.dev' route is ${status(after.enabled, true)} and your 'preview_urls' setting is not in your ${cliPresentation.displayConfigFileName}, Preview URLs will be ${status(after.previews_enabled, true)} for this deployment by default.`,
4634
- `To override this setting, you can ${status(before.previews_enabled, false)} Preview URLs by explicitly setting 'preview_urls = ${before.previews_enabled}' in your ${cliPresentation.displayConfigFileName}.`
4690
+ `Because your 'workers.dev' route is ${status(after.enabled, true)} and your '${props.previewUrlsConfigFieldName}' setting is not in your ${displayConfigFileName}, Preview URLs will be ${status(after.previews_enabled, true)} for this deployment by default.`,
4691
+ `To override this setting, you can ${status(before.previews_enabled, false)} Preview URLs by explicitly setting '${props.previewUrlsConfigAssignment(before.previews_enabled)}' in your ${displayConfigFileName}.`
4635
4692
  ].join("\n")
4636
4693
  );
4637
4694
  }
@@ -4640,7 +4697,9 @@ async function subdomainDeploy(props, accountId, scriptName, workerUrl, routes,
4640
4697
  { workers_dev: before.enabled, preview_urls: before.previews_enabled },
4641
4698
  { workers_dev: after.enabled, preview_urls: after.previews_enabled },
4642
4699
  before.preview_url_suffix,
4643
- firstDeploy
4700
+ firstDeploy,
4701
+ displayConfigFileName,
4702
+ props.previewUrlsConfigAssignment
4644
4703
  );
4645
4704
  return {
4646
4705
  wantWorkersDev,
@@ -6765,21 +6824,23 @@ __name(patchNonVersionedScriptSettings, "patchNonVersionedScriptSettings");
6765
6824
 
6766
6825
  // src/deploy/helpers/confirm-latest-deployment-overwrite.ts
6767
6826
  var BLANK_INPUT = "-";
6768
- async function confirmLatestDeploymentOverwrite(config2, accountId, scriptName) {
6827
+ async function confirmLatestDeploymentOverwrite(config2, accountId, scriptName, deployCommand, versionsDeployCommand) {
6769
6828
  return (await confirmLatestDeploymentOverwriteAndGetLatest(
6770
6829
  config2,
6771
6830
  accountId,
6772
- scriptName
6831
+ scriptName,
6832
+ deployCommand,
6833
+ versionsDeployCommand
6773
6834
  )).confirmed;
6774
6835
  }
6775
6836
  __name(confirmLatestDeploymentOverwrite, "confirmLatestDeploymentOverwrite");
6776
- async function confirmLatestDeploymentOverwriteAndGetLatest(config2, accountId, scriptName) {
6837
+ async function confirmLatestDeploymentOverwriteAndGetLatest(config2, accountId, scriptName, deployCommand, versionsDeployCommand) {
6777
6838
  try {
6778
6839
  const latest = await fetchLatestDeployment(config2, accountId, scriptName);
6779
6840
  if (latest && latest.versions.length >= 2) {
6780
6841
  const versionCache = /* @__PURE__ */ new Map();
6781
6842
  cli.warn(
6782
- `Your last deployment has multiple versions. To progress that deployment use "${cliPresentation.commands.versionsDeploy}" instead.`,
6843
+ `Your last deployment has multiple versions. To progress that deployment use "${versionsDeployCommand}" instead.`,
6783
6844
  { shape: cli.shapes.corners.tl, newlineBefore: false }
6784
6845
  );
6785
6846
  cli.newline();
@@ -6793,7 +6854,7 @@ async function confirmLatestDeploymentOverwriteAndGetLatest(config2, accountId,
6793
6854
  );
6794
6855
  const confirmed = await inputPrompt({
6795
6856
  type: "confirm",
6796
- question: `"${cliPresentation.commands.deploy}" will upload a new version and deploy it globally immediately.
6857
+ question: `"${deployCommand}" will upload a new version and deploy it globally immediately.
6797
6858
  Are you sure you want to continue?`,
6798
6859
  label: "",
6799
6860
  defaultValue: isNonInteractiveOrCI(),
@@ -7098,7 +7159,12 @@ function validateApplicationIdentity(application, namespaceId, existing) {
7098
7159
  }
7099
7160
  }
7100
7161
  __name(validateApplicationIdentity, "validateApplicationIdentity");
7101
- async function validateImageLessContainerApplicationsForUpload(config2, containers, { accountId, scriptName }) {
7162
+ async function validateImageLessContainerApplicationsForUpload(config2, containers, {
7163
+ accountId,
7164
+ scriptName,
7165
+ deployCommand,
7166
+ versionsUploadCommand
7167
+ }) {
7102
7168
  const imageLessContainers = getResolvedDurableObjectContainerApps(
7103
7169
  containers,
7104
7170
  config2.exports
@@ -7123,7 +7189,7 @@ async function validateImageLessContainerApplicationsForUpload(config2, containe
7123
7189
  }
7124
7190
  if (namespace === void 0 || existing === void 0) {
7125
7191
  throw new UserError(
7126
- `Container "${container.name}" has no named images and has not been provisioned. Run \`${cliPresentation.commands.deploy}\` to create its Durable Object-managed application before using \`${cliPresentation.commands.versionsUpload}\`, or configure at least one named image.`,
7192
+ `Container "${container.name}" has no named images and has not been provisioned. Run \`${deployCommand}\` to create its Durable Object-managed application before using \`${versionsUploadCommand}\`, or configure at least one named image.`,
7127
7193
  {
7128
7194
  telemetryMessage: "versions upload image less container application missing"
7129
7195
  }
@@ -7299,12 +7365,14 @@ async function prepareDurableObjectContainerApplications(config2, durableObjectC
7299
7365
  dryRun,
7300
7366
  scriptName,
7301
7367
  dispatchNamespace,
7302
- requireExistingImageLessApplications = false
7368
+ requireExistingImageLessApplications = false,
7369
+ deployCommand,
7370
+ versionsUploadCommand
7303
7371
  }) {
7304
7372
  validateDurableObjectContainerApplications(
7305
7373
  config2,
7306
7374
  durableObjectContainerConfig,
7307
- cliPresentation.displayConfigFileName
7375
+ configFileName(config2.configPath, config2.userConfigPath)
7308
7376
  );
7309
7377
  const managedContainers = getResolvedDurableObjectContainerApps(
7310
7378
  durableObjectContainerConfig,
@@ -7337,10 +7405,15 @@ async function prepareDurableObjectContainerApplications(config2, durableObjectC
7337
7405
  }
7338
7406
  if (!dryRun && requireExistingImageLessApplications) {
7339
7407
  assert6(accountId);
7408
+ assert6(deployCommand, "Expected deploy command for versions upload");
7409
+ assert6(
7410
+ versionsUploadCommand,
7411
+ "Expected versions upload command for versions upload"
7412
+ );
7340
7413
  await validateImageLessContainerApplicationsForUpload(
7341
7414
  config2,
7342
7415
  durableObjectContainerConfig,
7343
- { accountId, scriptName }
7416
+ { accountId, scriptName, deployCommand, versionsUploadCommand }
7344
7417
  );
7345
7418
  }
7346
7419
  const containers = managedContainers.filter(
@@ -7434,7 +7507,7 @@ function applyServiceAndEnvironmentTags(config2, tags) {
7434
7507
  const shouldApplyTags = hasDefinedEnvironments(config2);
7435
7508
  if (shouldApplyTags && !serviceName) {
7436
7509
  logger.warn(
7437
- `No top-level \`name\` has been defined in your ${cliPresentation.displayConfigFileName}. Add a top-level \`name\` to group this Worker together with its sibling environments in the Cloudflare dashboard.`
7510
+ `No top-level \`name\` has been defined in your ${configFileName(config2.configPath, config2.userConfigPath)}. Add a top-level \`name\` to group this Worker together with its sibling environments in the Cloudflare dashboard.`
7438
7511
  );
7439
7512
  }
7440
7513
  const serviceTag = shouldApplyTags && serviceName ? `${SERVICE_TAG_PREFIX}${serviceName}` : null;
@@ -8367,6 +8440,18 @@ var KVHandler = class extends ProvisionResourceHandler {
8367
8440
  }
8368
8441
  };
8369
8442
  var D1Handler = class extends ProvisionResourceHandler {
8443
+ constructor(bindingName, binding, complianceConfig, accountId, d1ListCommand, d1DeleteCommand) {
8444
+ super(
8445
+ "d1",
8446
+ bindingName,
8447
+ binding,
8448
+ "database_id",
8449
+ complianceConfig,
8450
+ accountId
8451
+ );
8452
+ this.d1ListCommand = d1ListCommand;
8453
+ this.d1DeleteCommand = d1DeleteCommand;
8454
+ }
8370
8455
  static {
8371
8456
  __name(this, "D1Handler");
8372
8457
  }
@@ -8377,20 +8462,12 @@ var D1Handler = class extends ProvisionResourceHandler {
8377
8462
  const db = await createD1Database(
8378
8463
  this.complianceConfig,
8379
8464
  this.accountId,
8380
- name
8465
+ name,
8466
+ this.d1ListCommand,
8467
+ this.d1DeleteCommand
8381
8468
  );
8382
8469
  return db.uuid;
8383
8470
  }
8384
- constructor(bindingName, binding, complianceConfig, accountId) {
8385
- super(
8386
- "d1",
8387
- bindingName,
8388
- binding,
8389
- "database_id",
8390
- complianceConfig,
8391
- accountId
8392
- );
8393
- }
8394
8471
  async canInherit(settings) {
8395
8472
  const maybeInherited = settings?.bindings.find(
8396
8473
  (existing) => existing.type === this.type && existing.name === this.bindingName
@@ -8725,12 +8802,19 @@ function isProvisionableBinding(binding) {
8725
8802
  return binding.type in HANDLERS;
8726
8803
  }
8727
8804
  __name(isProvisionableBinding, "isProvisionableBinding");
8728
- function createHandler(bindingName, binding, complianceConfig, accountId) {
8805
+ function createHandler(bindingName, binding, complianceConfig, accountId, d1ListCommand, d1DeleteCommand) {
8729
8806
  switch (binding.type) {
8730
8807
  case "kv_namespace":
8731
8808
  return new KVHandler(bindingName, binding, complianceConfig, accountId);
8732
8809
  case "d1":
8733
- return new D1Handler(bindingName, binding, complianceConfig, accountId);
8810
+ return new D1Handler(
8811
+ bindingName,
8812
+ binding,
8813
+ complianceConfig,
8814
+ accountId,
8815
+ d1ListCommand,
8816
+ d1DeleteCommand
8817
+ );
8734
8818
  case "r2_bucket":
8735
8819
  return new R2Handler(bindingName, binding, complianceConfig, accountId);
8736
8820
  case "ai_search_namespace":
@@ -8792,7 +8876,7 @@ function toConfigBinding(bindingName, binding) {
8792
8876
  }
8793
8877
  }
8794
8878
  __name(toConfigBinding, "toConfigBinding");
8795
- async function collectPendingResources(complianceConfig, accountId, scriptName, bindings) {
8879
+ async function collectPendingResources(complianceConfig, accountId, scriptName, bindings, d1ListCommand, d1DeleteCommand) {
8796
8880
  let settings;
8797
8881
  try {
8798
8882
  settings = await getSettings(complianceConfig, accountId, scriptName);
@@ -8810,7 +8894,9 @@ async function collectPendingResources(complianceConfig, accountId, scriptName,
8810
8894
  bindingName,
8811
8895
  binding,
8812
8896
  complianceConfig,
8813
- accountId
8897
+ accountId,
8898
+ d1ListCommand,
8899
+ d1DeleteCommand
8814
8900
  );
8815
8901
  const resource = {
8816
8902
  binding: bindingName,
@@ -8846,7 +8932,14 @@ async function collectPendingResources(complianceConfig, accountId, scriptName,
8846
8932
  __name(collectPendingResources, "collectPendingResources");
8847
8933
  async function provisionBindings(bindings, accountId, scriptName, autoCreate, config2, options) {
8848
8934
  const configPath = config2.userConfigPath ?? config2.configPath;
8849
- const { pendingResources, resolvedResources, skippedProvisioning } = await collectPendingResources(config2, accountId, scriptName, bindings);
8935
+ const { pendingResources, resolvedResources, skippedProvisioning } = await collectPendingResources(
8936
+ config2,
8937
+ accountId,
8938
+ scriptName,
8939
+ bindings,
8940
+ options.d1ListCommand,
8941
+ options.d1DeleteCommand
8942
+ );
8850
8943
  if (pendingResources.length > 0) {
8851
8944
  assert6(
8852
8945
  configPath,
@@ -9085,7 +9178,7 @@ async function listFlagshipApps(complianceConfig, accountId) {
9085
9178
  );
9086
9179
  }
9087
9180
  __name(listFlagshipApps, "listFlagshipApps");
9088
- async function createD1Database(complianceConfig, accountId, name) {
9181
+ async function createD1Database(complianceConfig, accountId, name, d1ListCommand, d1DeleteCommand) {
9089
9182
  try {
9090
9183
  return await fetchResult(
9091
9184
  complianceConfig,
@@ -9106,15 +9199,18 @@ async function createD1Database(complianceConfig, accountId, name) {
9106
9199
  });
9107
9200
  }
9108
9201
  if (errorCode === 7406) {
9109
- throw new UserError(renderD1DatabaseLimitError(accountId), {
9110
- telemetryMessage: "d1 create database limit reached"
9111
- });
9202
+ throw new UserError(
9203
+ renderD1DatabaseLimitError(accountId, d1ListCommand, d1DeleteCommand),
9204
+ {
9205
+ telemetryMessage: "d1 create database limit reached"
9206
+ }
9207
+ );
9112
9208
  }
9113
9209
  throw e;
9114
9210
  }
9115
9211
  }
9116
9212
  __name(createD1Database, "createD1Database");
9117
- function renderD1DatabaseLimitError(accountId) {
9213
+ function renderD1DatabaseLimitError(accountId, d1ListCommand, d1DeleteCommand) {
9118
9214
  return esm_default`
9119
9215
  You have reached the maximum number of D1 databases for your account.
9120
9216
 
@@ -9125,8 +9221,8 @@ function renderD1DatabaseLimitError(accountId) {
9125
9221
  https://developers.cloudflare.com/d1/
9126
9222
 
9127
9223
  Or free up space:
9128
- To list your existing databases, run: ${cliPresentation.commands.d1List}
9129
- To delete a database, run: ${cliPresentation.commands.d1Delete} <database-name>
9224
+ To list your existing databases, run: ${d1ListCommand}
9225
+ To delete a database, run: ${d1DeleteCommand}
9130
9226
  `;
9131
9227
  }
9132
9228
  __name(renderD1DatabaseLimitError, "renderD1DatabaseLimitError");
@@ -9277,9 +9373,9 @@ function addRequiredSecretsInheritBindings(config2, bindings, options) {
9277
9373
  if (options.type === "deploy" && !options.workerExists) {
9278
9374
  throw new UserError(
9279
9375
  `The following required secrets have not been set: ${inheritedSecrets.join(", ")}
9280
- This Worker does not exist yet, so secrets cannot be set in advance with \`${cliPresentation.commands.secretPut}\`.
9376
+ This Worker does not exist yet, so secrets cannot be set in advance with \`${options.secretPutCommand}\`.
9281
9377
  To deploy a new Worker with secrets, supply them via a secrets file:
9282
- ${cliPresentation.commands.deploy} --secrets-file <path-to-file>
9378
+ ${options.uploadCommand} --secrets-file <path-to-file>
9283
9379
  where the file contains lines in the format \`SECRET_NAME=value\` (or JSON).
9284
9380
  See https://developers.cloudflare.com/workers/configuration/secrets/#secrets-on-deployed-workers for more information.`,
9285
9381
  { telemetryMessage: "required secrets missing before first deploy" }
@@ -9297,12 +9393,11 @@ function handleMissingSecretsError(err, config2, options) {
9297
9393
  const missingSecretNames = err.notes.map((note) => note.text.match(/^inherit binding '(.+?)' is invalid/)).filter((match) => match !== null).map((match) => match[1]).filter((secretName) => config2.secrets?.required?.includes(secretName));
9298
9394
  if (missingSecretNames.length > 0) {
9299
9395
  err.preventReport();
9300
- const secretPutCommand = options.type === "deploy" ? cliPresentation.commands.secretPut : cliPresentation.commands.versionsSecretPut;
9301
- const secretsFileCommand = `${options.type === "deploy" ? cliPresentation.commands.deploy : cliPresentation.commands.versionsUpload} --secrets-file <path-to-file>`;
9396
+ const secretsFileCommand = `${options.uploadCommand} --secrets-file <path-to-file>`;
9302
9397
  const action = options.type === "deploy" ? "deploying" : "uploading";
9303
9398
  throw new UserError(
9304
9399
  `The following required secrets have not been set: ${missingSecretNames.join(", ")}
9305
- Use \`${secretPutCommand} <NAME>\` to set secrets before ${action},
9400
+ Use \`${options.secretPutCommand} <NAME>\` to set secrets before ${action},
9306
9401
  or supply them when ${action} with \`${secretsFileCommand}\`.
9307
9402
  See https://developers.cloudflare.com/workers/configuration/secrets/#secrets-on-deployed-workers for more information.`,
9308
9403
  { telemetryMessage: "required secrets missing during upload or deploy" }
@@ -30101,7 +30196,7 @@ async function checkWorkflowConflicts(config2, accountId, scriptName) {
30101
30196
  const message = `The following workflow(s) already exist and belong to different workers:
30102
30197
  ${conflictList}
30103
30198
 
30104
- Deploying will reassign these workflows to "${scriptName}". Workflow names must be unique per account. If this reassignment is unintended, rename the workflow(s) in your ${cliPresentation.displayConfigFileName}.`;
30199
+ Deploying will reassign these workflows to "${scriptName}". Workflow names must be unique per account. If this reassignment is unintended, rename the workflow(s) in your ${configFileName(config2.configPath, config2.userConfigPath)}.`;
30105
30200
  return { hasConflicts: true, conflicts, message };
30106
30201
  }
30107
30202
  __name(checkWorkflowConflicts, "checkWorkflowConflicts");
@@ -30214,8 +30309,12 @@ function getRemoteConfigDiff(remoteConfig, localResolvedConfig) {
30214
30309
  normalizedLocalConfig
30215
30310
  );
30216
30311
  const diff = diffJsonObjects(
30217
- normalizedRemoteConfig,
30218
- normalizedLocalConfig
30312
+ omitUndefinedProperties(
30313
+ normalizedRemoteConfig
30314
+ ),
30315
+ omitUndefinedProperties(
30316
+ normalizedLocalConfig
30317
+ )
30219
30318
  );
30220
30319
  return {
30221
30320
  diff,
@@ -30223,6 +30322,18 @@ function getRemoteConfigDiff(remoteConfig, localResolvedConfig) {
30223
30322
  };
30224
30323
  }
30225
30324
  __name(getRemoteConfigDiff, "getRemoteConfigDiff");
30325
+ function omitUndefinedProperties(value) {
30326
+ if (Array.isArray(value)) {
30327
+ return value.map(omitUndefinedProperties);
30328
+ }
30329
+ if (value === null || typeof value !== "object") {
30330
+ return value;
30331
+ }
30332
+ return Object.fromEntries(
30333
+ Object.entries(value).filter(([, fieldValue]) => fieldValue !== void 0).map(([key, fieldValue]) => [key, omitUndefinedProperties(fieldValue)])
30334
+ );
30335
+ }
30336
+ __name(omitUndefinedProperties, "omitUndefinedProperties");
30226
30337
  function normalizeLocalResolvedConfigAsRemote(localResolvedConfig) {
30227
30338
  const subdomainValues = getSubdomainValuesAPIMock(
30228
30339
  localResolvedConfig.workers_dev,
@@ -30656,7 +30767,7 @@ function getDeployConfirmFunction(options) {
30656
30767
  return confirm;
30657
30768
  }
30658
30769
  __name(getDeployConfirmFunction, "getDeployConfirmFunction");
30659
- async function fetchWorkerConfig(accountId, workerName, environment) {
30770
+ async function fetchWorkerConfig(complianceConfig, accountId, workerName, environment) {
30660
30771
  const [
30661
30772
  bindings,
30662
30773
  routes,
@@ -30666,27 +30777,27 @@ async function fetchWorkerConfig(accountId, workerName, environment) {
30666
30777
  cronTriggers
30667
30778
  ] = await Promise.all([
30668
30779
  fetchResult(
30669
- COMPLIANCE_REGION_CONFIG_UNKNOWN,
30780
+ complianceConfig,
30670
30781
  `/accounts/${accountId}/workers/services/${workerName}/environments/${environment}/bindings`
30671
30782
  ),
30672
30783
  fetchResult(
30673
- COMPLIANCE_REGION_CONFIG_UNKNOWN,
30784
+ complianceConfig,
30674
30785
  `/accounts/${accountId}/workers/services/${workerName}/environments/${environment}/routes?show_zonename=true`
30675
30786
  ),
30676
30787
  fetchResult(
30677
- COMPLIANCE_REGION_CONFIG_UNKNOWN,
30788
+ complianceConfig,
30678
30789
  `/accounts/${accountId}/workers/domains/records?page=0&per_page=5&service=${workerName}&environment=${environment}`
30679
30790
  ),
30680
30791
  fetchResult(
30681
- COMPLIANCE_REGION_CONFIG_UNKNOWN,
30792
+ complianceConfig,
30682
30793
  `/accounts/${accountId}/workers/services/${workerName}/environments/${environment}/subdomain`
30683
30794
  ),
30684
30795
  fetchResult(
30685
- COMPLIANCE_REGION_CONFIG_UNKNOWN,
30796
+ complianceConfig,
30686
30797
  `/accounts/${accountId}/workers/services/${workerName}/environments/${environment}`
30687
30798
  ),
30688
30799
  fetchResult(
30689
- COMPLIANCE_REGION_CONFIG_UNKNOWN,
30800
+ complianceConfig,
30690
30801
  `/accounts/${accountId}/workers/scripts/${workerName}/schedules`
30691
30802
  )
30692
30803
  ]).catch((e) => {
@@ -30705,7 +30816,7 @@ async function fetchWorkerConfig(accountId, workerName, environment) {
30705
30816
  };
30706
30817
  }
30707
30818
  __name(fetchWorkerConfig, "fetchWorkerConfig");
30708
- async function downloadWorkerConfig(workerName, environment, entrypoint, accountId) {
30819
+ async function downloadWorkerConfig(complianceConfig, workerName, environment, entrypoint, accountId) {
30709
30820
  const {
30710
30821
  bindings,
30711
30822
  routes,
@@ -30713,7 +30824,12 @@ async function downloadWorkerConfig(workerName, environment, entrypoint, account
30713
30824
  subdomainStatus,
30714
30825
  serviceEnvMetadata,
30715
30826
  cronTriggers
30716
- } = await fetchWorkerConfig(accountId, workerName, environment);
30827
+ } = await fetchWorkerConfig(
30828
+ complianceConfig,
30829
+ accountId,
30830
+ workerName,
30831
+ environment
30832
+ );
30717
30833
  return constructWranglerConfig({
30718
30834
  name: workerName,
30719
30835
  entrypoint,
@@ -30780,7 +30896,7 @@ async function verifyWorkerMatchesCITag(complianceConfig, accountId, workerName,
30780
30896
  );
30781
30897
  } else {
30782
30898
  throw new FatalError(
30783
- `${cliPresentation.displayName} cannot validate that your Worker name matches what is expected by the build system. Please retry the build. If the problem persists, please contact support.`,
30899
+ "The Worker name could not be validated against what is expected by the build system. Please retry the build. If the problem persists, please contact support.",
30784
30900
  { telemetryMessage: "ci match tag validation failed" }
30785
30901
  );
30786
30902
  }
@@ -31005,7 +31121,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
31005
31121
  return { ...props, name };
31006
31122
  }
31007
31123
  __name(validateWorkerProps, "validateWorkerProps");
31008
- async function preUploadApiChecks(props, config2) {
31124
+ async function preUploadApiChecks(props, config2, queueCreateCommand) {
31009
31125
  const { accountId, name } = props;
31010
31126
  if (props.dryRun || !accountId || !name) {
31011
31127
  return {
@@ -31045,12 +31161,13 @@ async function preUploadApiChecks(props, config2) {
31045
31161
  tags = script.tags ?? tags;
31046
31162
  if (props.command === "deploy" && props.failIfWorkerNameTaken) {
31047
31163
  throw new UserError(
31048
- `A Worker named "${name}" already exists in your account. This deploy could not confirm that it should update that Worker, so it stopped instead of overwriting it. To update the existing Worker, add a ${cliPresentation.displayConfigFileName} that names "${name}"; to deploy separately, use a different name.`,
31164
+ `A Worker named "${name}" already exists in your account. This deploy could not confirm that it should update that Worker, so it stopped instead of overwriting it. To update the existing Worker, add a ${configFileName(config2.configPath, config2.userConfigPath)} that names "${name}"; to deploy separately, use a different name.`,
31049
31165
  { telemetryMessage: "deploy unverified worker name already exists" }
31050
31166
  );
31051
31167
  }
31052
31168
  if (script.last_deployed_from === "dash") {
31053
31169
  const remoteWorkerConfig = await downloadWorkerConfig(
31170
+ config2,
31054
31171
  name,
31055
31172
  serviceMetaData.default_environment.environment,
31056
31173
  props.entry.file,
@@ -31138,7 +31255,8 @@ Edits that have been made via the script API will be overridden by your local co
31138
31255
  config2,
31139
31256
  accountId,
31140
31257
  !props.resourcesProvision,
31141
- name
31258
+ name,
31259
+ queueCreateCommand
31142
31260
  );
31143
31261
  const wantsWorkersDev = props.command === "deploy" && props.dispatchNamespace === void 0 && getSubdomainValues(config2.workers_dev, config2.preview_urls, props.routes).workers_dev;
31144
31262
  if (!workerExists && wantsWorkersDev) {
@@ -31171,8 +31289,8 @@ function addWorkersSitesBindings(bindings, namespace, manifest, format) {
31171
31289
  __name(addWorkersSitesBindings, "addWorkersSitesBindings");
31172
31290
 
31173
31291
  // src/deploy/deploy.ts
31174
- async function deploy(props, config2, buildResult, callbacks) {
31175
- const result = await deployWorker(props, config2, buildResult, callbacks);
31292
+ async function deploy(props, config2, buildResult, options) {
31293
+ const result = await deployWorker(props, config2, buildResult, options);
31176
31294
  writeOutput({
31177
31295
  type: "deploy",
31178
31296
  version: 1,
@@ -31190,13 +31308,14 @@ async function deploy(props, config2, buildResult, callbacks) {
31190
31308
  return result;
31191
31309
  }
31192
31310
  __name(deploy, "deploy");
31193
- async function deployWorker(props, config2, buildResult, callbacks) {
31311
+ async function deployWorker(props, config2, buildResult, options) {
31194
31312
  const { entry, compatibilityDate, compatibilityFlags, keepVars, accountId } = props;
31195
31313
  const assetsOptions = resolveAssetOptions(props, config2);
31196
31314
  const { name } = validateWorkerProps({ ...props, assetsOptions }, config2);
31197
31315
  const { workerTag, tags, workerExists, aborted: aborted2 } = await preUploadApiChecks(
31198
31316
  props,
31199
- config2
31317
+ config2,
31318
+ options.queueCreateCommand
31200
31319
  );
31201
31320
  if (aborted2) {
31202
31321
  return { versionId: null, workerTag };
@@ -31213,7 +31332,9 @@ async function deployWorker(props, config2, buildResult, callbacks) {
31213
31332
  const confirmation = await confirmLatestDeploymentOverwriteAndGetLatest(
31214
31333
  config2,
31215
31334
  accountId,
31216
- scriptName
31335
+ scriptName,
31336
+ options.deployCommand,
31337
+ options.versionsDeployCommand
31217
31338
  );
31218
31339
  latestDeployment = confirmation.latestDeployment;
31219
31340
  if (!confirmation.confirmed) {
@@ -31282,7 +31403,7 @@ async function deployWorker(props, config2, buildResult, callbacks) {
31282
31403
  if (assetsOptions && isDryRun) {
31283
31404
  await buildAssetManifest(assetsOptions.directory);
31284
31405
  }
31285
- const workersSitesAssets = callbacks.syncWorkersSite ? await callbacks.syncWorkersSite(
31406
+ const workersSitesAssets = options.syncWorkersSite ? await options.syncWorkersSite(
31286
31407
  config2,
31287
31408
  accountId,
31288
31409
  scriptName,
@@ -31314,7 +31435,9 @@ async function deployWorker(props, config2, buildResult, callbacks) {
31314
31435
  }
31315
31436
  addRequiredSecretsInheritBindings(config2, bindings, {
31316
31437
  type: "deploy",
31317
- workerExists
31438
+ workerExists,
31439
+ secretPutCommand: options.secretPutCommand,
31440
+ uploadCommand: options.deployCommand
31318
31441
  });
31319
31442
  if (workersSitesAssets.manifest) {
31320
31443
  modules.push({
@@ -31418,7 +31541,9 @@ async function deployWorker(props, config2, buildResult, callbacks) {
31418
31541
  props.experimentalAutoCreate,
31419
31542
  config2,
31420
31543
  {
31421
- skipConfigWriteback: props.skipProvisioningConfigWriteback
31544
+ skipConfigWriteback: props.skipProvisioningConfigWriteback,
31545
+ d1ListCommand: options.d1ListCommand,
31546
+ d1DeleteCommand: options.d1DeleteCommand
31422
31547
  }
31423
31548
  );
31424
31549
  }
@@ -31584,18 +31709,21 @@ async function deployWorker(props, config2, buildResult, callbacks) {
31584
31709
  workerBundle,
31585
31710
  projectRoot,
31586
31711
  // eslint-disable-next-line @typescript-eslint/no-deprecated -- compatibility callback for existing deploy-helpers consumers
31587
- callbacks.analyseBundle
31712
+ options.analyseBundle
31588
31713
  );
31589
31714
  if (message !== null) {
31590
31715
  logger.error(message);
31591
31716
  }
31592
31717
  handleMissingSecretsError(err, config2, {
31593
- type: "deploy"});
31718
+ type: "deploy",
31719
+ secretPutCommand: options.secretPutCommand,
31720
+ uploadCommand: options.deployCommand
31721
+ });
31594
31722
  if (err instanceof APIError && "code" in err && err.code === 10021 && err.notes.length > 0) {
31595
31723
  err.preventReport();
31596
31724
  if (err.notes[0].text === "binding DB of type d1 must have a valid `id` specified [code: 10021]") {
31597
31725
  throw new UserError(
31598
- `You must use a real database in the database_id configuration. You can find your databases using '${cliPresentation.commands.d1List}', or read how to develop locally with D1 here: https://developers.cloudflare.com/d1/configuration/local-development`,
31726
+ `You must use a real database in the database_id configuration. You can find your databases using '${options.d1ListCommand}', or read how to develop locally with D1 here: https://developers.cloudflare.com/d1/configuration/local-development`,
31599
31727
  { telemetryMessage: "deploy d1 database binding invalid id" }
31600
31728
  );
31601
31729
  }
@@ -31635,7 +31763,6 @@ async function deployWorker(props, config2, buildResult, callbacks) {
31635
31763
  if (shouldDeployContainers) {
31636
31764
  assert6(versionId && accountId);
31637
31765
  initContainersSharedContext({
31638
- cliPresentation,
31639
31766
  logger,
31640
31767
  fetchPagedListResult,
31641
31768
  fetchResult
@@ -31674,7 +31801,10 @@ async function deployWorker(props, config2, buildResult, callbacks) {
31674
31801
  versionId,
31675
31802
  accountId,
31676
31803
  scriptName,
31677
- dispatchNamespace: props.dispatchNamespace
31804
+ dispatchNamespace: props.dispatchNamespace,
31805
+ configFileName: options.configFileName,
31806
+ observabilityTargetPercentageField: options.observabilityTargetPercentageField,
31807
+ observabilityTargetCountField: options.observabilityTargetCountField
31678
31808
  }
31679
31809
  );
31680
31810
  }
@@ -31693,7 +31823,7 @@ async function deployWorker(props, config2, buildResult, callbacks) {
31693
31823
  );
31694
31824
  } catch (error62) {
31695
31825
  throw new UserError(
31696
- `The Worker version was deployed, but ${cliPresentation.displayName} could not finish applying its Durable Object-managed Container application settings. Re-run the same \`${cliPresentation.commands.deploy}\` command to retry and finish deployment.`,
31826
+ `The Worker version was deployed, but its Durable Object-managed Container application settings were not fully applied. Re-run the same \`${options.deployCommand}\` command to retry and finish deployment.`,
31697
31827
  {
31698
31828
  telemetryMessage: "deploy durable object container application creation failed after deployment",
31699
31829
  cause: error62
@@ -31715,7 +31845,12 @@ async function deployWorker(props, config2, buildResult, callbacks) {
31715
31845
  firstDeploy: !workerExists,
31716
31846
  routes: props.routes,
31717
31847
  validated: true,
31718
- dryRun: false
31848
+ dryRun: false,
31849
+ queueCreateCommand: options.queueCreateCommand,
31850
+ workersDevConfigFieldName: options.workersDevConfigFieldName,
31851
+ workersDevConfigAssignment: options.workersDevConfigAssignment,
31852
+ previewUrlsConfigFieldName: options.previewUrlsConfigFieldName,
31853
+ previewUrlsConfigAssignment: options.previewUrlsConfigAssignment
31719
31854
  });
31720
31855
  logger.log("Current Version ID:", versionId);
31721
31856
  return {
@@ -31740,13 +31875,8 @@ function renderBindingDependsOnExportError(serverMessage) {
31740
31875
  __name(renderBindingDependsOnExportError, "renderBindingDependsOnExportError");
31741
31876
 
31742
31877
  // src/deploy/versions-upload.ts
31743
- async function versionsUpload(props, config2, buildResult, callbacks = {}) {
31744
- const result = await uploadWorkerVersion(
31745
- props,
31746
- config2,
31747
- buildResult,
31748
- callbacks
31749
- );
31878
+ async function versionsUpload(props, config2, buildResult, options) {
31879
+ const result = await uploadWorkerVersion(props, config2, buildResult, options);
31750
31880
  writeOutput({
31751
31881
  type: "version-upload",
31752
31882
  version: 1,
@@ -31765,11 +31895,15 @@ async function versionsUpload(props, config2, buildResult, callbacks = {}) {
31765
31895
  return result;
31766
31896
  }
31767
31897
  __name(versionsUpload, "versionsUpload");
31768
- async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
31898
+ async function uploadWorkerVersion(props, config2, buildResult, options) {
31769
31899
  const { entry, compatibilityDate, compatibilityFlags, keepVars, accountId } = props;
31770
31900
  const assetsOptions = resolveAssetOptions(props, config2);
31771
31901
  const { name } = validateWorkerProps(props, config2);
31772
- const { workerTag, tags, aborted: aborted2 } = await preUploadApiChecks(props, config2);
31902
+ const { workerTag, tags, aborted: aborted2 } = await preUploadApiChecks(
31903
+ props,
31904
+ config2,
31905
+ options.queueCreateCommand
31906
+ );
31773
31907
  if (aborted2) {
31774
31908
  return { versionId: null, workerTag };
31775
31909
  }
@@ -31805,7 +31939,7 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
31805
31939
  });
31806
31940
  if (migrations !== void 0) {
31807
31941
  throw new UserError(
31808
- `This Worker has a pending Durable Object migration, which cannot be applied by \`${cliPresentation.commands.versionsUpload}\`. Durable Object migrations must be applied with \`${cliPresentation.commands.deploy}\`. Run \`${cliPresentation.commands.deploy}\` to apply the migration, then retry \`${cliPresentation.commands.versionsUpload}\`.`,
31942
+ `This Worker has a pending Durable Object migration, which cannot be applied by \`${options.versionsUploadCommand}\`. Durable Object migrations must be applied with \`${options.deployCommand}\`. Run \`${options.deployCommand}\` to apply the migration, then retry \`${options.versionsUploadCommand}\`.`,
31809
31943
  { telemetryMessage: "versions upload pending durable object migration" }
31810
31944
  );
31811
31945
  }
@@ -31820,7 +31954,9 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
31820
31954
  accountId,
31821
31955
  dryRun: Boolean(props.dryRun),
31822
31956
  scriptName,
31823
- requireExistingImageLessApplications: true
31957
+ requireExistingImageLessApplications: true,
31958
+ deployCommand: options.deployCommand,
31959
+ versionsUploadCommand: options.versionsUploadCommand
31824
31960
  }
31825
31961
  );
31826
31962
  const assetsUploadResult = assetsOptions && !props.dryRun ? await syncAssets(config2, accountId, assetsOptions.directory, scriptName) : void 0;
@@ -31918,7 +32054,9 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
31918
32054
  props.experimentalAutoCreate,
31919
32055
  config2,
31920
32056
  {
31921
- skipConfigWriteback: props.skipProvisioningConfigWriteback
32057
+ skipConfigWriteback: props.skipProvisioningConfigWriteback,
32058
+ d1ListCommand: options.d1ListCommand,
32059
+ d1DeleteCommand: options.d1DeleteCommand
31922
32060
  }
31923
32061
  );
31924
32062
  }
@@ -31973,12 +32111,16 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
31973
32111
  workerBundle,
31974
32112
  projectRoot,
31975
32113
  // eslint-disable-next-line @typescript-eslint/no-deprecated -- compatibility callback for existing deploy-helpers consumers
31976
- callbacks.analyseBundle
32114
+ options.analyseBundle
31977
32115
  );
31978
32116
  if (message) {
31979
32117
  logger.error(message);
31980
32118
  }
31981
- handleMissingSecretsError(err, config2, { type: "upload" });
32119
+ handleMissingSecretsError(err, config2, {
32120
+ type: "upload",
32121
+ secretPutCommand: options.versionsSecretPutCommand,
32122
+ uploadCommand: options.versionsUploadCommand
32123
+ });
31982
32124
  if (err instanceof ParseError && "code" in err && err.code === 10021 && err.notes.length > 0) {
31983
32125
  const maybeNameToFilePath = /* @__PURE__ */ __name((moduleName) => {
31984
32126
  if (bundleType === "commonjs") {
@@ -32058,8 +32200,8 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
32058
32200
  }
32059
32201
  }
32060
32202
  }
32061
- const cmdVersionsDeploy = blue(cliPresentation.commands.versionsDeploy);
32062
- const cmdTriggersDeploy = blue(cliPresentation.commands.triggersDeploy);
32203
+ const cmdVersionsDeploy = blue(options.versionsDeployCommand);
32204
+ const cmdTriggersDeploy = blue(options.triggersDeployCommand);
32063
32205
  logger.info(
32064
32206
  gray(`
32065
32207
  To deploy this version to production traffic use the command ${cmdVersionsDeploy}
@@ -32196,7 +32338,7 @@ function validateNodeCompatMode(compatibilityDateStr = "2000-01-01", compatibili
32196
32338
  }
32197
32339
  if (noBundle && hasNodejsCompatV2Flag) {
32198
32340
  logger.warn(
32199
- `\`nodejs_compat_v2\` compatibility flag and \`--no-bundle\` can't be used together. If you want to polyfill Node.js built-ins and disable ${cliPresentation.displayName}'s bundling, please polyfill as part of your own bundling process.`
32341
+ "`nodejs_compat_v2` compatibility flag and `--no-bundle` can't be used together. If you want to polyfill Node.js built-ins while disabling bundling, please polyfill as part of your own bundling process."
32200
32342
  );
32201
32343
  }
32202
32344
  return mode;
@@ -32204,7 +32346,7 @@ function validateNodeCompatMode(compatibilityDateStr = "2000-01-01", compatibili
32204
32346
  __name(validateNodeCompatMode, "validateNodeCompatMode");
32205
32347
 
32206
32348
  // src/deploy/helpers/inconsistent-exports.ts
32207
- function renderInconsistentExportsAcrossVersionsError(serverMessage) {
32349
+ function renderInconsistentExportsAcrossVersionsError(serverMessage, versionsDeployAt100Command) {
32208
32350
  return [
32209
32351
  serverMessage,
32210
32352
  "",
@@ -32212,7 +32354,7 @@ function renderInconsistentExportsAcrossVersionsError(serverMessage) {
32212
32354
  "",
32213
32355
  "What to do:",
32214
32356
  " 1. Deploy the version that changes `exports` at 100% first:",
32215
- ` ${cliPresentation.commands.versionsDeployAt(100)}`,
32357
+ ` ${versionsDeployAt100Command}`,
32216
32358
  " 2. Once that deploy is stable, run your percentage-split deploy.",
32217
32359
  "",
32218
32360
  "Learn more: https://developers.cloudflare.com/workers/configuration/versions-and-deployments/gradual-deployments/#gradual-deployments-for-durable-objects"
@@ -33032,9 +33174,9 @@ function getPreviewExports(exports$1) {
33032
33174
  return previewExports;
33033
33175
  }
33034
33176
  __name(getPreviewExports, "getPreviewExports");
33035
- async function prepareContainersForPreview(config2, workerName, previewSlug, callbacks, localImageReferences) {
33177
+ async function prepareContainersForPreview(config2, workerName, previewSlug, options, localImageReferences) {
33036
33178
  const previewContainers = config2.previews?.containers ?? [];
33037
- if (previewContainers.length === 0 || !callbacks.getNormalizedContainerOptions) {
33179
+ if (previewContainers.length === 0 || !options.getNormalizedContainerOptions) {
33038
33180
  return { scopedContainerConfig: void 0, normalisedContainerConfig: [] };
33039
33181
  }
33040
33182
  const scopedContainerConfig = buildPreviewContainerConfig(
@@ -33046,9 +33188,12 @@ async function prepareContainersForPreview(config2, workerName, previewSlug, cal
33046
33188
  if (!scopedContainerConfig) {
33047
33189
  return { scopedContainerConfig: void 0, normalisedContainerConfig: [] };
33048
33190
  }
33049
- const normalisedContainerConfig = await callbacks.getNormalizedContainerOptions(scopedContainerConfig, {
33050
- dryRun: false
33051
- });
33191
+ const normalisedContainerConfig = await options.getNormalizedContainerOptions(
33192
+ scopedContainerConfig,
33193
+ {
33194
+ dryRun: false
33195
+ }
33196
+ );
33052
33197
  const containersNeedingDocker = normalisedContainerConfig.filter(
33053
33198
  (container) => "dockerfile" in container
33054
33199
  );
@@ -33060,8 +33205,8 @@ async function prepareContainersForPreview(config2, workerName, previewSlug, cal
33060
33205
  hint: 'If you cannot run Docker locally, set "image" to a prebuilt registry image instead of a Dockerfile path for the affected entries in "previews.containers".'
33061
33206
  });
33062
33207
  }
33063
- if (callbacks.verifyContainersScope) {
33064
- await callbacks.verifyContainersScope(scopedContainerConfig);
33208
+ if (options.verifyContainersScope) {
33209
+ await options.verifyContainersScope(scopedContainerConfig);
33065
33210
  }
33066
33211
  return { scopedContainerConfig, normalisedContainerConfig };
33067
33212
  }
@@ -33082,7 +33227,7 @@ function formatPreviewConfigUpdate(config2, update) {
33082
33227
  ).trimEnd();
33083
33228
  }
33084
33229
  __name(formatPreviewConfigUpdate, "formatPreviewConfigUpdate");
33085
- function formatNoActivePreviewUrlsMessage(config2) {
33230
+ function formatNoActivePreviewUrlsMessage(config2, deployCommand = "your deploy command", previewCommand = "the preview command") {
33086
33231
  const customDomainRouteEntries = (config2.routes ?? []).filter(isCustomDomainRoute).map((route) => ({ route, singular: false }));
33087
33232
  if (config2.route && isCustomDomainRoute(config2.route)) {
33088
33233
  customDomainRouteEntries.push({ route: config2.route, singular: true });
@@ -33132,7 +33277,7 @@ function formatNoActivePreviewUrlsMessage(config2) {
33132
33277
  }
33133
33278
  const workersDevAlreadyConfigured = config2.preview_urls === true;
33134
33279
  const customDomainAlreadyConfigured = customDomainRoute?.previews_enabled === true;
33135
- const cautionText = workersDevAlreadyConfigured && customDomainAlreadyConfigured ? `Caution: \`${cliPresentation.commands.deploy}\` publishes the code in your current checkout to the deployed Worker. If you have already made this change, confirm it was applied by running \`${cliPresentation.commands.deploy}\` from a clean checkout of your production branch. Then return to your feature branch and run \`${cliPresentation.commands.preview}\` again.` : `Caution: \`${cliPresentation.commands.deploy}\` publishes the code in your current checkout to the deployed Worker, not only these settings. If you use Git, commit the configuration change and run \`${cliPresentation.commands.deploy}\` from a clean checkout of your production branch. Then return to your feature branch and run \`${cliPresentation.commands.preview}\` again.`;
33280
+ const cautionText = workersDevAlreadyConfigured && customDomainAlreadyConfigured ? `Caution: \`${deployCommand}\` publishes the code in your current checkout to the deployed Worker. If you have already made this change, confirm it was applied by running \`${deployCommand}\` from a clean checkout of your production branch. Then return to your feature branch and run \`${previewCommand}\` again.` : `Caution: \`${deployCommand}\` publishes the code in your current checkout to the deployed Worker, not only these settings. If you use Git, commit the configuration change and run \`${deployCommand}\` from a clean checkout of your production branch. Then return to your feature branch and run \`${previewCommand}\` again.`;
33136
33281
  let workersDevInstruction = `Add this to your ${configName}:`;
33137
33282
  if (config2.preview_urls === true) {
33138
33283
  workersDevInstruction = `Your ${configName} already contains:`;
@@ -33388,7 +33533,7 @@ function formatUrlLines(label, urls) {
33388
33533
  ];
33389
33534
  }
33390
33535
  __name(formatUrlLines, "formatUrlLines");
33391
- function formatPreviewDeploymentSummary(config2, previewResource, deployment, isNew, pullRequest) {
33536
+ function formatPreviewDeploymentSummary(config2, previewResource, deployment, isNew, pullRequest, deployCommand, previewCommand) {
33392
33537
  const statusLabel = isNew ? chalk6.green("(new)") : chalk6.dim("(updated)");
33393
33538
  const pullRequestUrl = deployment.annotations?.["workers/pull_request_url"] ?? pullRequest?.url;
33394
33539
  const pullRequestNumber = deployment.annotations?.["workers/pull_request_number"] ?? pullRequest?.number;
@@ -33400,7 +33545,13 @@ function formatPreviewDeploymentSummary(config2, previewResource, deployment, is
33400
33545
  `${chalk6.bold("Pull Request:")} ${pullRequestUrl ?? `#${pullRequestNumber}`}`
33401
33546
  ] : [],
33402
33547
  ...formatUrlLines("Unique Deployment", deployment.urls),
33403
- ...hasActiveUrls ? [] : [formatNoActivePreviewUrlsMessage(config2)]
33548
+ ...hasActiveUrls ? [] : [
33549
+ formatNoActivePreviewUrlsMessage(
33550
+ config2,
33551
+ deployCommand,
33552
+ previewCommand
33553
+ )
33554
+ ]
33404
33555
  ].join("\n");
33405
33556
  }
33406
33557
  __name(formatPreviewDeploymentSummary, "formatPreviewDeploymentSummary");
@@ -33435,7 +33586,7 @@ function previewUrlMatchesCustomDomain(url3, customDomains) {
33435
33586
  }
33436
33587
  }
33437
33588
  __name(previewUrlMatchesCustomDomain, "previewUrlMatchesCustomDomain");
33438
- function logMissingCustomDomainPreviewUrlsWarning(config2, previewResource, deployment) {
33589
+ function logMissingCustomDomainPreviewUrlsWarning(config2, previewResource, deployment, deployCommand = "your deploy command", previewCommand = "the preview command") {
33439
33590
  const customDomains = getPreviewCustomDomainHostnames(config2);
33440
33591
  const urls = [...previewResource.urls ?? [], ...deployment.urls ?? []];
33441
33592
  if (customDomains.length === 0 || urls.length === 0 || urls.some((url3) => previewUrlMatchesCustomDomain(url3, customDomains))) {
@@ -33443,7 +33594,7 @@ function logMissingCustomDomainPreviewUrlsWarning(config2, previewResource, depl
33443
33594
  }
33444
33595
  logger.log("");
33445
33596
  logger.warn(
33446
- `Custom domain Preview URLs are configured, but none are active for this Preview. If you added \`previews_enabled = true\` after your last deployment, run \`${cliPresentation.commands.deploy}\` once to publish the custom domain Preview route, then run \`${cliPresentation.commands.preview}\` again. If you already deployed with that setting, the custom domain may still be provisioning.`
33597
+ `Custom domain Preview URLs are configured, but none are active for this Preview. If you enabled Preview URLs after your last deployment, run \`${deployCommand}\` once to publish the custom domain Preview route, then run \`${previewCommand}\` again. If you already deployed with that setting, the custom domain may still be provisioning.`
33447
33598
  );
33448
33599
  }
33449
33600
  __name(logMissingCustomDomainPreviewUrlsWarning, "logMissingCustomDomainPreviewUrlsWarning");
@@ -33502,7 +33653,7 @@ async function provisionParentWorker(config2, accountId, workerName, json2) {
33502
33653
  );
33503
33654
  }
33504
33655
  __name(provisionParentWorker, "provisionParentWorker");
33505
- async function runPreview(accountId, args, config2, buildResult, assetsOptions, callbacks, workerName, replaceTailConsumersAfterCreate = false, localImageReferences = /* @__PURE__ */ new Map()) {
33656
+ async function runPreview(accountId, args, config2, buildResult, assetsOptions, options, workerName, replaceTailConsumersAfterCreate = false, localImageReferences = /* @__PURE__ */ new Map()) {
33506
33657
  let secrets;
33507
33658
  if (args.secretsFile) {
33508
33659
  secrets = (await parseBulkInputToObject(args.secretsFile))?.content;
@@ -33581,7 +33732,7 @@ async function runPreview(accountId, args, config2, buildResult, assetsOptions,
33581
33732
  config2,
33582
33733
  workerName,
33583
33734
  previewResource.slug,
33584
- callbacks,
33735
+ options,
33585
33736
  localImageReferences
33586
33737
  );
33587
33738
  const deploymentRequest = await assemblePreviewDeploymentSettings(
@@ -33614,9 +33765,9 @@ async function runPreview(accountId, args, config2, buildResult, assetsOptions,
33614
33765
  delete binding.text;
33615
33766
  }
33616
33767
  }
33617
- if (normalisedContainerConfig.length > 0 && scopedContainerConfig && callbacks.deployPreviewContainers) {
33768
+ if (normalisedContainerConfig.length > 0 && scopedContainerConfig && options.deployPreviewContainers) {
33618
33769
  try {
33619
- await callbacks.deployPreviewContainers(
33770
+ await options.deployPreviewContainers(
33620
33771
  scopedContainerConfig,
33621
33772
  normalisedContainerConfig,
33622
33773
  deployment,
@@ -33635,7 +33786,7 @@ async function runPreview(accountId, args, config2, buildResult, assetsOptions,
33635
33786
  JSON.stringify({ preview: previewResource, deployment }, null, 2)
33636
33787
  );
33637
33788
  } else {
33638
- const productionBindingsExpectedInPreview = callbacks.productionBindingsExpectedInPreview ?? {};
33789
+ const productionBindingsExpectedInPreview = options.productionBindingsExpectedInPreview ?? {};
33639
33790
  if (Object.keys(productionBindingsExpectedInPreview).length > 0) {
33640
33791
  const previewBaseConfig = await getPreviewBaseConfig(
33641
33792
  config2,
@@ -33654,31 +33805,35 @@ async function runPreview(accountId, args, config2, buildResult, assetsOptions,
33654
33805
  previewResource,
33655
33806
  deployment,
33656
33807
  isNewPreview,
33657
- pullRequest
33808
+ pullRequest,
33809
+ options.deployCommand,
33810
+ options.previewCommand
33658
33811
  )
33659
33812
  );
33660
33813
  logMissingCustomDomainPreviewUrlsWarning(
33661
33814
  config2,
33662
33815
  previewResource,
33663
- deployment
33816
+ deployment,
33817
+ options.deployCommand,
33818
+ options.previewCommand
33664
33819
  );
33665
33820
  }
33666
33821
  return { preview: previewResource, deployment, isNewPreview };
33667
33822
  }
33668
33823
  __name(runPreview, "runPreview");
33669
- async function preview(accountId, args, config2, buildResult, assetsOptions, callbacks) {
33824
+ async function preview(accountId, args, config2, buildResult, assetsOptions, options) {
33670
33825
  return runPreview(
33671
33826
  accountId,
33672
33827
  args,
33673
33828
  config2,
33674
33829
  buildResult,
33675
33830
  assetsOptions,
33676
- callbacks,
33831
+ options,
33677
33832
  resolveWorkerName(args, config2)
33678
33833
  );
33679
33834
  }
33680
33835
  __name(preview, "preview");
33681
- async function previewBuildOutput(accountId, args, buildOutput, callbacks) {
33836
+ async function previewBuildOutput(accountId, args, buildOutput, options) {
33682
33837
  const { workerConfig, rootConfig, buildResult, assets } = buildOutput;
33683
33838
  assertPreviewBuildOutputRootConfig(rootConfig);
33684
33839
  if (workerConfig.triggers?.length) {
@@ -33720,7 +33875,7 @@ async function previewBuildOutput(accountId, args, buildOutput, callbacks) {
33720
33875
  buildOutput.containers,
33721
33876
  previewContainers
33722
33877
  );
33723
- if (previewContainers.length > 0 && (callbacks?.getNormalizedContainerOptions === void 0 || callbacks.deployPreviewContainers === void 0)) {
33878
+ if (previewContainers.length > 0 && (options?.getNormalizedContainerOptions === void 0 || options.deployPreviewContainers === void 0)) {
33724
33879
  throw new UserError(
33725
33880
  "Preview uploads from Build Output with Containers require container deployment callbacks.",
33726
33881
  {
@@ -33777,7 +33932,7 @@ async function previewBuildOutput(accountId, args, buildOutput, callbacks) {
33777
33932
  previewConfig,
33778
33933
  previewBuildResult,
33779
33934
  assetsOptions,
33780
- callbacks ?? {
33935
+ options ?? {
33781
33936
  getNormalizedContainerOptions: void 0,
33782
33937
  deployPreviewContainers: void 0
33783
33938
  },