@cloudflare/deploy-helpers 0.11.0 → 0.11.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.
@@ -1,3 +1,4 @@
1
+ import { ContainerNormalizedConfig, BuiltContainerDeployment } from '@cloudflare/containers-shared';
1
2
  import { FetchResultFetcher, FetchListResultFetcher, FetchPagedListResultFetcher, FetchKVGetValueFetcher, Logger, Entry, ValidatedAssetsOptions, LegacyAssetPaths, Route, Config, CfModule, CfWorkerSourceMap, CfModuleType } from '@cloudflare/workers-utils';
2
3
 
3
4
  /**
@@ -107,6 +108,10 @@ type DeployProps = SharedDeployVersionsProps & {
107
108
  oldAssetTtl: number | undefined;
108
109
  /** From --containers-rollout arg. Deploy-only. */
109
110
  containersRollout: "immediate" | "gradual" | "none" | undefined;
111
+ /** Normalized Wrangler container configuration, resolved before calling deploy-helpers. */
112
+ normalisedContainerConfig: ContainerNormalizedConfig[];
113
+ /** Dockerfile container images built by the caller before invoking deploy-helpers. */
114
+ builtContainerDeployments: BuiltContainerDeployment[];
110
115
  /**
111
116
  * When true, an existing Worker with the same name aborts the deploy instead
112
117
  * of updating it, because this run cannot confirm the local project owns the
@@ -137,6 +142,7 @@ type WorkerBuildResult = {
137
142
  };
138
143
  interface TriggerDeployment {
139
144
  targets: string[];
145
+ changed?: boolean;
140
146
  category?: string;
141
147
  resource?: string;
142
148
  error?: Error;
@@ -1,2 +1,3 @@
1
- export { c as confirm, f as fetchKVGetValue, d as fetchListResult, e as fetchPagedListResult, g as fetchResult, i as initDeployHelpersContext, l as logger, p as prompt, s as select } from './context-nFHuelHB.mjs';
1
+ export { c as confirm, f as fetchKVGetValue, d as fetchListResult, e as fetchPagedListResult, g as fetchResult, i as initDeployHelpersContext, l as logger, p as prompt, s as select } from './context-Bo-P841x.mjs';
2
2
  import '@cloudflare/workers-utils';
3
+ import '@cloudflare/containers-shared';
package/dist/index.d.mts CHANGED
@@ -1,13 +1,13 @@
1
- import { S as SharedDeployVersionsProps, D as DeployProps, W as WorkerBuildResult, V as VersionsUploadProps, T as TriggerProps, a as TriggerDeployment } from './context-nFHuelHB.mjs';
2
- export { b as DeployHelpersContext, i as initDeployHelpersContext } from './context-nFHuelHB.mjs';
1
+ import { S as SharedDeployVersionsProps, D as DeployProps, W as WorkerBuildResult, V as VersionsUploadProps, T as TriggerProps, a as TriggerDeployment } from './context-Bo-P841x.mjs';
2
+ export { b as DeployHelpersContext, i as initDeployHelpersContext } from './context-Bo-P841x.mjs';
3
3
  import * as _cloudflare_workers_utils from '@cloudflare/workers-utils';
4
- import { CfModule, Config, AssetsOptions, ComplianceConfig, LegacyAssetPaths, Route, ZoneIdRoute, ZoneNameRoute, CustomDomainRoute, CfPlacement, Binding as Binding$1, RawConfig, CfCapnp, CfScriptFormat, ParseError, WorkerMetadataBinding, CfUserLimits, CfWorkerInit, TailConsumer, StreamingTailConsumer, Observability, ExportsReconciliationErrorDetail, ExportsReconciliationResult, StartDevWorkerInput, CacheOptions, PreviewsConfig } from '@cloudflare/workers-utils';
5
- import { ContainerNormalizedConfig, ImageURIConfig } from '@cloudflare/containers-shared';
4
+ import { CfModule, Config, AssetsOptions, ComplianceConfig, LegacyAssetPaths, Route, ZoneIdRoute, ZoneNameRoute, CustomDomainRoute, CfPlacement, Binding as Binding$1, RawConfig, CfCapnp, CfScriptFormat, ParseError, WorkerMetadataBinding, CfUserLimits, CfWorkerInit, TailConsumer, StreamingTailConsumer, Observability, DurableObjectContainerApp, ExportsReconciliationErrorDetail, ExportsReconciliationResult, StartDevWorkerInput, CacheOptions, PreviewsConfig } from '@cloudflare/workers-utils';
6
5
  import { FormData } from 'undici';
7
6
  export { createWorkerUploadForm, fromMimeType, moduleTypeMimeType } from './create-worker-upload-form.mjs';
8
7
  import { Options } from '@cspotcode/source-map-support';
9
8
  import Protocol from 'devtools-protocol';
10
9
  import { NodeJSCompatMode } from 'miniflare';
10
+ import { ContainerNormalizedConfig } from '@cloudflare/containers-shared';
11
11
 
12
12
  interface BundleSize {
13
13
  size: number;
@@ -40,7 +40,7 @@ declare function resolveAssetOptions({ assetsDir, main }: Pick<SharedDeployVersi
40
40
  /**
41
41
  * Wrangler-specific functions injected into `deploy()`. These remain in
42
42
  * wrangler because they depend on wrangler-only systems (account selection,
43
- * metrics, the dev-mode worker registry, container orchestration, etc.).
43
+ * metrics, the dev-mode worker registry, etc.).
44
44
  */
45
45
  type DeployCallbacks = {
46
46
  syncWorkersSite: ((complianceConfig: ComplianceConfig, accountId: string | undefined, scriptName: string, siteAssets: LegacyAssetPaths | undefined, preview: boolean, dryRun: boolean | undefined, oldAssetTTL: number | undefined) => Promise<{
@@ -49,28 +49,6 @@ type DeployCallbacks = {
49
49
  } | undefined;
50
50
  namespace: string | undefined;
51
51
  }>) | undefined;
52
- getNormalizedContainerOptions: ((config: Config, args: {
53
- containersRollout?: "gradual" | "immediate" | "none";
54
- dryRun?: boolean;
55
- }) => Promise<ContainerNormalizedConfig[]>) | undefined;
56
- buildContainer: ((containerConfig: Exclude<ContainerNormalizedConfig, ImageURIConfig>, imageTag: string, dryRun: boolean, pathToDocker: string, verifyDockerIsRunning: boolean) => Promise<unknown>) | undefined;
57
- deployContainers: ((config: Config, normalisedContainerConfig: ContainerNormalizedConfig[], args: {
58
- versionId: string;
59
- accountId: string;
60
- scriptName: string;
61
- dispatchNamespace?: string;
62
- }) => Promise<void>) | undefined;
63
- prepareDurableObjectContainerApplications: ((config: Config, args: {
64
- dryRun: boolean;
65
- scriptName: string;
66
- dispatchNamespace?: string;
67
- }) => Promise<Record<string, Record<string, string>>>) | undefined;
68
- deployDurableObjectContainerApplications: ((config: Config, args: {
69
- versionId: string;
70
- accountId: string;
71
- scriptName: string;
72
- dispatchNamespace?: string;
73
- }) => Promise<void>) | undefined;
74
52
  analyseBundle: ((workerBundle: string | FormData) => Promise<Record<string, unknown>>) | undefined;
75
53
  };
76
54
  type DeployResult = {
@@ -83,7 +61,7 @@ type DeployResult = {
83
61
  };
84
62
  declare function deploy(props: DeployProps, config: Config, buildResult: WorkerBuildResult, callbacks: DeployCallbacks): Promise<DeployResult>;
85
63
 
86
- type VersionsUploadCallbacks = Pick<DeployCallbacks, "analyseBundle"> & Partial<Pick<DeployCallbacks, "prepareDurableObjectContainerApplications" | "deployDurableObjectContainerApplications">>;
64
+ type VersionsUploadCallbacks = Pick<DeployCallbacks, "analyseBundle">;
87
65
  type VersionsUploadResult = {
88
66
  versionId: string | null;
89
67
  workerTag: string | null;
@@ -94,6 +72,7 @@ type VersionsUploadResult = {
94
72
  };
95
73
  declare function versionsUpload(props: VersionsUploadProps, config: Config, buildResult: WorkerBuildResult, callbacks: VersionsUploadCallbacks): Promise<VersionsUploadResult>;
96
74
 
75
+ declare const PREVIEW_DOMAIN_PROVISIONING_NOTE = "Note: DNS and TLS certificate provisioning for Preview domains may continue after this deploy. If a new Preview URL does not work immediately, wait a few minutes and retry.";
97
76
  declare function triggersDeploy(props: TriggerProps): Promise<string[] | void>;
98
77
  declare function getSubdomainValues(config_workers_dev: boolean | undefined, config_preview_urls: boolean | undefined, routes: Route[]): {
99
78
  workers_dev: boolean;
@@ -171,7 +150,7 @@ declare function publishRoutes(complianceConfig: ComplianceConfig, routes: Route
171
150
  scriptName: string;
172
151
  accountId: string;
173
152
  }): Promise<string[]>;
174
- declare function publishCustomDomains(complianceConfig: ComplianceConfig, workerUrl: string, accountId: string, domains: Array<RouteObject>): Promise<TriggerDeployment>;
153
+ declare function publishCustomDomains(complianceConfig: ComplianceConfig, workerUrl: string, accountId: string, scriptName: string, domains: Array<RouteObject>): Promise<TriggerDeployment>;
175
154
 
176
155
  interface PostQueueBody {
177
156
  queue_name: string;
@@ -705,6 +684,41 @@ declare function resolveDoLifecyclePayload(props: {
705
684
  exports: CfWorkerInit["exports"];
706
685
  }>;
707
686
 
687
+ type DeployDurableObjectContainerApplicationsArgs = {
688
+ dispatchNamespace?: string;
689
+ versionId: string;
690
+ accountId: string;
691
+ scriptName: string;
692
+ };
693
+ type PrepareDurableObjectContainerApplicationsArgs = {
694
+ accountId: string | undefined;
695
+ dispatchNamespace?: string;
696
+ dryRun: boolean;
697
+ scriptName: string;
698
+ };
699
+ type DurableObjectContainerApplication = Pick<DurableObjectContainerApp, "class_name" | "name">;
700
+ type VersionedDurableObjectContainerApplication = DurableObjectContainerApplication & {
701
+ namespaceId?: string;
702
+ };
703
+ type PreparedContainerImages = Record<string, Record<string, string>>;
704
+ declare function createDurableObjectContainerApplication(application: DurableObjectContainerApplication, namespaceId: string): Promise<void>;
705
+ declare function getVersionedDurableObjectContainerApplications(versions: ApiVersion[], scriptName: string): VersionedDurableObjectContainerApplication[];
706
+ /** Resolve every versioned application's namespace without creating applications. */
707
+ declare function resolveVersionedDurableObjectContainerApplications(config: Config, { applications, accountId, scriptName, allowMissingNamespaces, }: {
708
+ applications: VersionedDurableObjectContainerApplication[];
709
+ accountId: string;
710
+ scriptName: string;
711
+ allowMissingNamespaces?: boolean;
712
+ }): Promise<VersionedDurableObjectContainerApplication[]>;
713
+ /** Create applications only after every deployed namespace has been resolved. */
714
+ declare function deployVersionedDurableObjectContainerApplications(config: Config, args: {
715
+ applications: VersionedDurableObjectContainerApplication[];
716
+ accountId: string;
717
+ scriptName: string;
718
+ }): Promise<void>;
719
+ declare function prepareDurableObjectContainerApplications(config: Config, { accountId, dryRun, scriptName, dispatchNamespace, }: PrepareDurableObjectContainerApplicationsArgs): Promise<PreparedContainerImages>;
720
+ declare function deployDurableObjectContainerApplications(config: Config, { versionId, accountId, scriptName, dispatchNamespace, }: DeployDurableObjectContainerApplicationsArgs): Promise<void>;
721
+
708
722
  type ResolveExportsUploadPayloadProps = Parameters<typeof resolveDoLifecyclePayload>[0];
709
723
  declare function resolveExportsUploadPayload(props: ResolveExportsUploadPayloadProps): Promise<{
710
724
  migrations: CfWorkerInit["migrations"];
@@ -1100,13 +1114,18 @@ type PreviewResult = {
1100
1114
  deployment: DeploymentResource;
1101
1115
  isNewPreview: boolean;
1102
1116
  };
1103
- type PreviewCallbacks = Pick<DeployCallbacks, "getNormalizedContainerOptions"> & {
1117
+ type PreviewCallbacks = {
1118
+ getNormalizedContainerOptions: ((config: Config, args: {
1119
+ containersRollout?: "gradual" | "immediate" | "none";
1120
+ dryRun?: boolean;
1121
+ }) => Promise<ContainerNormalizedConfig[]>) | undefined;
1104
1122
  deployPreviewContainers: ((scopedConfig: Config, normalisedContainerConfig: ContainerNormalizedConfig[], deployment: DeploymentResource, accountId: string, options: {
1105
1123
  quiet: boolean;
1106
1124
  }) => Promise<void>) | undefined;
1107
1125
  verifyContainersScope?: (scopedConfig: Config) => Promise<void>;
1108
1126
  };
1109
- declare const NO_ACTIVE_PREVIEW_URLS_MESSAGE = "Note: This Preview deployment has no active URLs. To get one, enable Preview Deployments on workers.dev or a custom domain. See https://developers.cloudflare.com/workers/previews/custom-domains/ for more information";
1127
+ declare const NO_ACTIVE_PREVIEW_URLS_MESSAGE = "Note: This Preview deployment has no active URLs.";
1128
+ declare function formatNoActivePreviewUrlsMessage(config: Config): string;
1110
1129
  /**
1111
1130
  * Full preview create/update + deployment orchestration.
1112
1131
  * The wrangler handler calls this after auth + build.
@@ -1165,4 +1184,4 @@ type DrawConnectedChildBoxOptions = {
1165
1184
  */
1166
1185
  declare function drawConnectedChildBox(contentLines: string[], options?: DrawConnectedChildBoxOptions): string;
1167
1186
 
1168
- export { ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE, type ApiDeployment, type ApiVersion, type AssetManifest, type AssetUploadStats, type AssetsUploadResult, type Binding, type BulkInputNullableResult, type BulkInputResult, type BundleSize, type Consumer, type ConsumerSettings, type CreatePreviewDeploymentRequestParams, type CreatePreviewRequestParams, type CustomDomain, type CustomDomainChangeset, type DeployCallbacks, DeployProps, type DeploymentResource, 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, type PackageDependency, type Percentage, type PostQueueBody, type PostQueueResponse, type PostTypedConsumerBody, 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 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, createPreview, createPreviewDeployment, createPreviewDeploymentForm, createPreviewParentWorker, createTruncatedAlias, decodeJwtPayload, deletePreview, deletePullConsumer, deleteWorkerConsumer, deploy, deployWfpUserWorker, diagnoseScriptSizeError, diagnoseStartupError, diffJsonObjects, downloadWorkerConfig, drawBox, drawConnectedChildBox, editPreview, ensureQueuesExistByConfig, extractConfigBindings, fetchDeployableVersions, fetchDeploymentVersions, fetchLatestDeployment, fetchLatestDeployments, fetchSecrets, fetchVersion, fetchVersions, fetchWorkerConfig, formatAlignedRows, formatBindings, generatePreviewAlias, getBindingValue, getBranchName, getCommitSha, getConfigPatch, getDeployConfirmFunction, getEdgeKvUploadConcurrency, getHeadCommitMessage, getHeadCommitRef, getMigrationsToUpload, getPreview, getPreviewBaseConfig, getPreviewDeployment, getPreviewOwnedContainerClassNames, getPullRequestMetadata, getQueue, getRemoteConfigDiff, getRepositoryUrl, getSettings, getSize, getSourceMappedStack, getSourceMappedString, getSubdomainValues, getSubdomainValuesAPIMock, getWorkersDevSubdomain, getZoneForRoute, getZoneIdFromHost, handleMissingSecretsError, handleUnsafeCapnp, hasDefinedEnvironments, hashFile, helpIfErrorIsSizeOrScriptStartup, isExportsReconciliationErrorDetails, isJwtExpired, isModifiedDiffValue, isNonDestructive, isWorkerNotFoundError, listConsumers, listQueues, maybeRetrieveFileSourceMap, padToVisibleWidth, parseBulkInputToObject, parseConfigPlacement, patchNonVersionedScriptSettings, patchPreviewBaseConfig, patchPreviewDeployment, postConsumer, preview, previewContainerAppName, previewDelete, printBundleSize, printVersions, provisionBindings, publishCustomDomains, publishRoutes, putConsumer, putConsumerById, renderBindingDependsOnExportError, renderExportsReconciliationError, renderExportsReconciliationSuccess, renderInconsistentExportsAcrossVersionsError, renderRoute, resolveAssetOptions, resolveDoLifecyclePayload, resolveExportsUploadPayload, resolveWorkerName, sanitizeBranchName, shouldUseCIMetadataFallback, stripAnsi, syncAssets, tagsAreEqual, triggersDeploy, updateQueueConsumers, validateEventTriggerTargets, validateFileSecrets, validateNodeCompatMode, validateRoutes, verifyWorkerMatchesCITag, versionsUpload, visibleLength, warnOnErrorUpdatingServiceAndEnvironmentTags, workerNotFoundErrorMessage };
1187
+ export { ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE, type ApiDeployment, type ApiVersion, type AssetManifest, type AssetUploadStats, type AssetsUploadResult, type Binding, type BulkInputNullableResult, type BulkInputResult, type BundleSize, type Consumer, type ConsumerSettings, 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 };