@cloudflare/deploy-helpers 0.12.2 → 0.14.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.
package/dist/index.d.mts CHANGED
@@ -7,6 +7,7 @@ export { createWorkerUploadForm, fromMimeType, moduleTypeMimeType } from './crea
7
7
  import { Options } from '@cspotcode/source-map-support';
8
8
  import Protocol from 'devtools-protocol';
9
9
  import { NodeJSCompatMode } from 'miniflare';
10
+ import { ParsedOutputWorkerConfig, ParsedOutputRootConfig } from '@cloudflare/config';
10
11
  import { ContainerNormalizedConfig } from '@cloudflare/containers-shared';
11
12
 
12
13
  interface BundleSize {
@@ -156,8 +157,10 @@ declare function publishRoutes(complianceConfig: ComplianceConfig, routes: Route
156
157
  }): Promise<string[]>;
157
158
  declare function publishCustomDomains(complianceConfig: ComplianceConfig, workerUrl: string, accountId: string, scriptName: string, domains: Array<RouteObject>): Promise<TriggerDeployment>;
158
159
 
160
+ type QueueJurisdiction = "eu" | "us" | "fedramp";
159
161
  interface PostQueueBody {
160
162
  queue_name: string;
163
+ jurisdiction?: QueueJurisdiction;
161
164
  settings?: QueueSettings;
162
165
  }
163
166
  interface QueueSettings {
@@ -175,6 +178,7 @@ interface PostQueueResponse {
175
178
  interface QueueResponse {
176
179
  queue_id: string;
177
180
  queue_name: string;
181
+ jurisdiction?: QueueJurisdiction;
178
182
  created_on: string;
179
183
  modified_on: string;
180
184
  producers: Producer[];
@@ -702,6 +706,8 @@ type PrepareDurableObjectContainerApplicationsArgs = {
702
706
  dispatchNamespace?: string;
703
707
  dryRun: boolean;
704
708
  scriptName: string;
709
+ /** Version uploads cannot initialize applications without named images. */
710
+ requireExistingImageLessApplications?: boolean;
705
711
  };
706
712
  type DurableObjectContainerApplication = Pick<ResolvedDurableObjectContainerApp, "class_name" | "name">;
707
713
  type VersionedDurableObjectContainerApplication = DurableObjectContainerApplication & {
@@ -710,13 +716,24 @@ type VersionedDurableObjectContainerApplication = DurableObjectContainerApplicat
710
716
  type PreparedContainerImages = Record<string, Record<string, string>>;
711
717
  declare function createDurableObjectContainerApplication(application: DurableObjectContainerApplication, namespaceId: string): Promise<void>;
712
718
  /**
713
- * Read managed application identities from selected Worker versions.
719
+ * Read managed application identities from native images on selected Worker versions.
714
720
  *
715
- * Versions must agree on class/name associations and known namespace IDs.
721
+ * Named images identify managed classes. Versions may add or remove images, but
722
+ * must agree on those classes' names and known namespace IDs. Image-less classes
723
+ * rely on applications provisioned by a normal deploy.
716
724
  * Application-wide settings are deliberately not read from local config or
717
725
  * restored with a Worker version.
718
726
  */
719
727
  declare function getVersionedDurableObjectContainerApplications(versions: ApiVersion[], scriptName: string): VersionedDurableObjectContainerApplication[];
728
+ /**
729
+ * Require existing applications for version uploads without named images.
730
+ * These versions carry no managed-policy discriminator, so versions deploy
731
+ * cannot initialize their applications. A normal deploy must provision them first.
732
+ */
733
+ declare function validateImageLessContainerApplicationsForUpload(config: ContainerlessConfig, containers: DurableObjectContainerApp[], { accountId, scriptName }: {
734
+ accountId: string;
735
+ scriptName: string;
736
+ }): Promise<void>;
720
737
  /** Resolve every versioned application's namespace without creating applications. */
721
738
  declare function resolveVersionedDurableObjectContainerApplications(config: Config, { applications, accountId, scriptName, allowMissingNamespaces, }: {
722
739
  applications: VersionedDurableObjectContainerApplication[];
@@ -736,7 +753,7 @@ declare function deployVersionedDurableObjectContainerApplications(config: Confi
736
753
  scriptName: string;
737
754
  }): Promise<void>;
738
755
  /** Validate managed classes and prepare their named images before Worker upload. */
739
- declare function prepareDurableObjectContainerApplications(config: ContainerlessConfig, durableObjectContainerConfig: DurableObjectContainerApp[], builtImages: BuiltDurableObjectContainerImage[], { accountId, dryRun, scriptName, dispatchNamespace, }: PrepareDurableObjectContainerApplicationsArgs): Promise<PreparedContainerImages>;
756
+ declare function prepareDurableObjectContainerApplications(config: ContainerlessConfig, durableObjectContainerConfig: DurableObjectContainerApp[], builtImages: BuiltDurableObjectContainerImage[], { accountId, dryRun, scriptName, dispatchNamespace, requireExistingImageLessApplications, }: PrepareDurableObjectContainerApplicationsArgs): Promise<PreparedContainerImages>;
740
757
  /**
741
758
  * Apply explicit application settings after an uploaded Worker's namespaces exist.
742
759
  *
@@ -885,6 +902,7 @@ interface Binding {
885
902
  id?: string;
886
903
  service?: string;
887
904
  environment?: string;
905
+ props?: Record<string, unknown>;
888
906
  cross_account_grant?: string;
889
907
  dataset?: string;
890
908
  namespace?: string;
@@ -907,6 +925,9 @@ interface Binding {
907
925
  period: 10 | 60;
908
926
  };
909
927
  service_id?: string;
928
+ tunnel_id?: string;
929
+ network_id?: string;
930
+ destination?: string;
910
931
  staging?: boolean;
911
932
  enable_timer?: boolean;
912
933
  app_id?: string;
@@ -1086,6 +1107,7 @@ declare function resolveWorkerName(args: {
1086
1107
  */
1087
1108
  declare function getBindingValue(binding: Binding): string;
1088
1109
  declare function extractConfigBindings(config: Config): EnvBindings;
1110
+ declare function extractBuildOutputBindings(config: RawConfig): EnvBindings;
1089
1111
  /**
1090
1112
  * Returns the DO `class_name`s whose containers this preview owns: the classes
1091
1113
  * the script declares through `migrations` or `exports`, plus the classes bound
@@ -1113,7 +1135,7 @@ declare function getPreviewOwnedContainerClassNames(config: Config, previews: Pr
1113
1135
  * of the composed name.
1114
1136
  */
1115
1137
  declare function previewContainerAppName(parentWorkerName: string, previewSlug: string, className: string): string;
1116
- declare function assemblePreviewScriptSettings(config: Config): Record<string, unknown>;
1138
+ declare function assemblePreviewScriptSettings(config: Config): UpdatePreviewRequestParams;
1117
1139
 
1118
1140
  type PreviewArgs = {
1119
1141
  script?: string;
@@ -1149,6 +1171,19 @@ type PreviewResult = {
1149
1171
  deployment: DeploymentResource;
1150
1172
  isNewPreview: boolean;
1151
1173
  };
1174
+ type PreviewBuildOutputRootConfig = ParsedOutputRootConfig & {
1175
+ buildContext: ParsedOutputRootConfig["buildContext"] & {
1176
+ isPreview: true;
1177
+ };
1178
+ };
1179
+ type PreviewBuildOutput = {
1180
+ workerConfig: ParsedOutputWorkerConfig;
1181
+ rootConfig: PreviewBuildOutputRootConfig;
1182
+ buildResult?: WorkerBuildResult;
1183
+ assets?: Pick<PreviewAssetsOptions, "directory" | "_headers" | "_redirects">;
1184
+ };
1185
+ /** Verify that Build Output was produced with Preview configuration. */
1186
+ declare function assertPreviewBuildOutputRootConfig(rootConfig: ParsedOutputRootConfig | undefined): asserts rootConfig is PreviewBuildOutputRootConfig;
1152
1187
  type PreviewCallbacks = {
1153
1188
  productionBindingsExpectedInPreview?: Record<string, {
1154
1189
  type: string;
@@ -1165,10 +1200,27 @@ type PreviewCallbacks = {
1165
1200
  declare const NO_ACTIVE_PREVIEW_URLS_MESSAGE = "Note: This Preview deployment has no active URLs.";
1166
1201
  declare function formatNoActivePreviewUrlsMessage(config: Config): string;
1167
1202
  /**
1168
- * Full preview create/update + deployment orchestration.
1169
- * The wrangler handler calls this after auth + build.
1203
+ * Upload a Preview from Wrangler configuration.
1204
+ *
1205
+ * Wrangler resolves its Worker name from CLI and config precedence before
1206
+ * entering the shared upload flow. Build Output already contains its final name.
1207
+ *
1208
+ * @param accountId Account that owns the parent Worker.
1209
+ * @param args Wrangler Preview arguments.
1210
+ * @param config Resolved Wrangler configuration.
1211
+ * @param buildResult Compiled Worker code and modules.
1212
+ * @param assetsOptions Static asset configuration and artifacts.
1213
+ * @param callbacks Wrangler container integrations.
1170
1214
  */
1171
1215
  declare function preview(accountId: string, args: PreviewArgs, config: Config, buildResult: WorkerBuildResult, assetsOptions: PreviewAssetsOptions | undefined, callbacks: PreviewCallbacks): Promise<PreviewResult>;
1216
+ /**
1217
+ * Upload a Preview from resolved Build Output configuration.
1218
+ *
1219
+ * @param accountId Account that owns the parent Worker.
1220
+ * @param args Preview name and deployment annotations.
1221
+ * @param buildOutput Exact configuration and artifacts emitted by the build.
1222
+ */
1223
+ declare function previewBuildOutput(accountId: string, args: Pick<PreviewArgs, "name" | "tag" | "message" | "json">, buildOutput: PreviewBuildOutput): Promise<PreviewResult>;
1172
1224
  /**
1173
1225
  * Delete a preview and all its deployments.
1174
1226
  */
@@ -1222,4 +1274,4 @@ type DrawConnectedChildBoxOptions = {
1222
1274
  */
1223
1275
  declare function drawConnectedChildBox(contentLines: string[], options?: DrawConnectedChildBoxOptions): string;
1224
1276
 
1225
- export { ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE, type ApiDeployment, type ApiVersion, type AssetManifest, type AssetUploadStats, type AssetsUploadResult, type Binding, BuiltDurableObjectContainerImage, type BulkInputNullableResult, type BulkInputResult, type BundleSize, type Consumer, type ConsumerSettings, ContainerlessConfig, type CreatePreviewDeploymentRequestParams, type CreatePreviewRequestParams, type CustomDomain, type CustomDomainChangeset, type DeployCallbacks, DeployProps, type DeploymentResource, type DurableObjectContainerApplication, EXPORTS_RECONCILIATION_ERROR_CODE, type EnvBindings, INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE, INVALID_INHERIT_BINDING_CODE, type JsonLike, NO_ACTIVE_PREVIEW_URLS_MESSAGE, NoInputError, type NonVersionedScriptSettings, PREVIEW_DOMAIN_PROVISIONING_NOTE, type PackageDependency, type Percentage, type PostQueueBody, type PostQueueResponse, type PostTypedConsumerBody, type PreparedContainerImages, type PreviewArgs, type PreviewAssetsOptions, type PreviewBaseConfig, type PreviewBaseConfigPatch, type PreviewCallbacks, type PreviewDeleteArgs, type PreviewDeploymentModule, type PreviewRequestOptions, type PreviewResource, type PreviewResult, type Producer, type ProvisionBindingsResult, type PullRequestMetadata, type PurgeQueueBody, type PurgeQueueResponse, type QueueResponse, type QueueSettings, type RetrieveSourceMapFunction, type RouteObject, type ScriptReference, type Settings, SharedDeployVersionsProps, TriggerDeployment, TriggerProps, type TypedConsumerResponse, type UpdatePreviewRequestParams, type VersionCache, type VersionId, type VersionedDurableObjectContainerApplication, type VersionsUploadCallbacks, VersionsUploadProps, WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE, WORKER_NOT_FOUND_ERR_CODE, WORKFLOW_CRON_REQUIRES_PAID_PLAN_CODE, WORKFLOW_NOT_FOUND_CODE, WorkerBuildResult, type Workflow, type WorkflowConflict, type Zone, type ZoneIdCache, addRequiredSecretsInheritBindings, addWorkersSitesBindings, applyServiceAndEnvironmentTags, assemblePreviewScriptSettings, buildAssetManifest, checkRemoteSecretsOverride, checkWorkflowConflicts, collectPackageDependencies, confirmLatestDeploymentOverwrite, createDeployment, createDurableObjectContainerApplication, createPreview, createPreviewDeployment, createPreviewDeploymentForm, createPreviewParentWorker, createTruncatedAlias, decodeJwtPayload, deletePreview, deletePullConsumer, deleteWorkerConsumer, deploy, deployDurableObjectContainerApplications, deployVersionedDurableObjectContainerApplications, deployWfpUserWorker, diagnoseScriptSizeError, diagnoseStartupError, diffJsonObjects, downloadWorkerConfig, drawBox, drawConnectedChildBox, editPreview, ensureQueuesExistByConfig, extractConfigBindings, fetchDeployableVersions, fetchDeploymentVersions, fetchLatestDeployment, fetchLatestDeployments, fetchSecrets, fetchVersion, fetchVersions, fetchWorkerConfig, formatAlignedRows, formatBindings, formatNoActivePreviewUrlsMessage, generatePreviewAlias, getBindingValue, getBranchName, getCommitSha, getConfigPatch, getDeployConfirmFunction, getEdgeKvUploadConcurrency, getHeadCommitMessage, getHeadCommitRef, getMigrationsToUpload, getPreview, getPreviewBaseConfig, getPreviewDeployment, getPreviewOwnedContainerClassNames, getPullRequestMetadata, getQueue, getRemoteConfigDiff, getRepositoryUrl, getSettings, getSize, getSourceMappedStack, getSourceMappedString, getSubdomainValues, getSubdomainValuesAPIMock, getVersionedDurableObjectContainerApplications, getWorkersDevSubdomain, getZoneForRoute, getZoneIdFromHost, handleMissingSecretsError, handleUnsafeCapnp, hasDefinedEnvironments, hashFile, helpIfErrorIsSizeOrScriptStartup, isExportsReconciliationErrorDetails, isJwtExpired, isModifiedDiffValue, isNonDestructive, isWorkerNotFoundError, listConsumers, listQueues, maybeRetrieveFileSourceMap, padToVisibleWidth, parseBulkInputToObject, parseConfigPlacement, patchNonVersionedScriptSettings, patchPreviewBaseConfig, patchPreviewDeployment, postConsumer, prepareDurableObjectContainerApplications, preview, previewContainerAppName, previewDelete, printBundleSize, printVersions, provisionBindings, publishCustomDomains, publishRoutes, putConsumer, putConsumerById, renderBindingDependsOnExportError, renderExportsReconciliationError, renderExportsReconciliationSuccess, renderInconsistentExportsAcrossVersionsError, renderRoute, resolveAssetOptions, resolveDoLifecyclePayload, resolveExportsUploadPayload, resolveVersionedDurableObjectContainerApplications, resolveWorkerName, sanitizeBranchName, shouldUseCIMetadataFallback, stripAnsi, syncAssets, tagsAreEqual, triggersDeploy, updateQueueConsumers, validateEventTriggerTargets, validateFileSecrets, validateNodeCompatMode, validateRoutes, verifyWorkerMatchesCITag, versionsUpload, visibleLength, warnOnErrorUpdatingServiceAndEnvironmentTags, workerNotFoundErrorMessage };
1277
+ export { ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE, type ApiDeployment, type ApiVersion, type AssetManifest, type AssetUploadStats, type AssetsUploadResult, type Binding, BuiltDurableObjectContainerImage, type BulkInputNullableResult, type BulkInputResult, type BundleSize, type Consumer, type ConsumerSettings, ContainerlessConfig, type CreatePreviewDeploymentRequestParams, type CreatePreviewRequestParams, type CustomDomain, type CustomDomainChangeset, type DeployCallbacks, DeployProps, type DeploymentResource, type DurableObjectContainerApplication, EXPORTS_RECONCILIATION_ERROR_CODE, type EnvBindings, INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE, INVALID_INHERIT_BINDING_CODE, type JsonLike, NO_ACTIVE_PREVIEW_URLS_MESSAGE, NoInputError, type NonVersionedScriptSettings, PREVIEW_DOMAIN_PROVISIONING_NOTE, type PackageDependency, type Percentage, type PostQueueBody, type PostQueueResponse, type PostTypedConsumerBody, type PreparedContainerImages, type PreviewArgs, type PreviewAssetsOptions, type PreviewBaseConfig, type PreviewBaseConfigPatch, type PreviewBuildOutput, type PreviewBuildOutputRootConfig, type PreviewCallbacks, type PreviewDeleteArgs, type PreviewDeploymentModule, type PreviewRequestOptions, type PreviewResource, type PreviewResult, type Producer, type ProvisionBindingsResult, type PullRequestMetadata, type PurgeQueueBody, type PurgeQueueResponse, type QueueJurisdiction, type QueueResponse, type QueueSettings, type RetrieveSourceMapFunction, type RouteObject, type ScriptReference, type Settings, SharedDeployVersionsProps, TriggerDeployment, TriggerProps, type TypedConsumerResponse, type UpdatePreviewRequestParams, type VersionCache, type VersionId, type VersionedDurableObjectContainerApplication, type VersionsUploadCallbacks, VersionsUploadProps, WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE, WORKER_NOT_FOUND_ERR_CODE, WORKFLOW_CRON_REQUIRES_PAID_PLAN_CODE, WORKFLOW_NOT_FOUND_CODE, WorkerBuildResult, type Workflow, type WorkflowConflict, type Zone, type ZoneIdCache, addRequiredSecretsInheritBindings, addWorkersSitesBindings, applyServiceAndEnvironmentTags, assemblePreviewScriptSettings, assertPreviewBuildOutputRootConfig, buildAssetManifest, checkRemoteSecretsOverride, checkWorkflowConflicts, collectPackageDependencies, confirmLatestDeploymentOverwrite, createDeployment, createDurableObjectContainerApplication, createPreview, createPreviewDeployment, createPreviewDeploymentForm, createPreviewParentWorker, createTruncatedAlias, decodeJwtPayload, deletePreview, deletePullConsumer, deleteWorkerConsumer, deploy, deployDurableObjectContainerApplications, deployVersionedDurableObjectContainerApplications, deployWfpUserWorker, diagnoseScriptSizeError, diagnoseStartupError, diffJsonObjects, downloadWorkerConfig, drawBox, drawConnectedChildBox, editPreview, ensureQueuesExistByConfig, extractBuildOutputBindings, extractConfigBindings, fetchDeployableVersions, fetchDeploymentVersions, fetchLatestDeployment, fetchLatestDeployments, fetchSecrets, fetchVersion, fetchVersions, fetchWorkerConfig, formatAlignedRows, formatBindings, formatNoActivePreviewUrlsMessage, generatePreviewAlias, getBindingValue, getBranchName, getCommitSha, getConfigPatch, getDeployConfirmFunction, getEdgeKvUploadConcurrency, getHeadCommitMessage, getHeadCommitRef, getMigrationsToUpload, getPreview, getPreviewBaseConfig, getPreviewDeployment, getPreviewOwnedContainerClassNames, getPullRequestMetadata, getQueue, getRemoteConfigDiff, getRepositoryUrl, getSettings, getSize, getSourceMappedStack, getSourceMappedString, getSubdomainValues, getSubdomainValuesAPIMock, getVersionedDurableObjectContainerApplications, getWorkersDevSubdomain, getZoneForRoute, getZoneIdFromHost, handleMissingSecretsError, handleUnsafeCapnp, hasDefinedEnvironments, hashFile, helpIfErrorIsSizeOrScriptStartup, isExportsReconciliationErrorDetails, isJwtExpired, isModifiedDiffValue, isNonDestructive, isWorkerNotFoundError, listConsumers, listQueues, maybeRetrieveFileSourceMap, padToVisibleWidth, parseBulkInputToObject, parseConfigPlacement, patchNonVersionedScriptSettings, patchPreviewBaseConfig, patchPreviewDeployment, postConsumer, prepareDurableObjectContainerApplications, preview, previewBuildOutput, previewContainerAppName, previewDelete, printBundleSize, printVersions, provisionBindings, publishCustomDomains, publishRoutes, putConsumer, putConsumerById, renderBindingDependsOnExportError, renderExportsReconciliationError, renderExportsReconciliationSuccess, renderInconsistentExportsAcrossVersionsError, renderRoute, resolveAssetOptions, resolveDoLifecyclePayload, resolveExportsUploadPayload, resolveVersionedDurableObjectContainerApplications, resolveWorkerName, sanitizeBranchName, shouldUseCIMetadataFallback, stripAnsi, syncAssets, tagsAreEqual, triggersDeploy, updateQueueConsumers, validateEventTriggerTargets, validateFileSecrets, validateImageLessContainerApplicationsForUpload, validateNodeCompatMode, validateRoutes, verifyWorkerMatchesCITag, versionsUpload, visibleLength, warnOnErrorUpdatingServiceAndEnvironmentTags, workerNotFoundErrorMessage };