@cloudflare/deploy-helpers 0.11.2 → 0.12.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.
@@ -135,7 +135,6 @@ function createWorkerUploadForm(worker, bindings, options) {
135
135
  bindings
136
136
  );
137
137
  const ai_search = extractBindingsOfType("ai_search", bindings);
138
- const websearch = extractBindingsOfType("websearch", bindings)[0];
139
138
  const agent_memory = extractBindingsOfType("agent_memory", bindings);
140
139
  const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
141
140
  const secrets_store_secrets = extractBindingsOfType(
@@ -368,12 +367,6 @@ function createWorkerUploadForm(worker, bindings, options) {
368
367
  instance_name
369
368
  });
370
369
  });
371
- if (websearch !== void 0) {
372
- metadataBindings.push({
373
- name: websearch.binding,
374
- type: "websearch"
375
- });
376
- }
377
370
  agent_memory.forEach(({ binding, namespace }) => {
378
371
  if (options?.dryRun) {
379
372
  namespace ??= INHERIT_SYMBOL;
@@ -1,2 +1,2 @@
1
- export { createWorkerUploadForm, fromMimeType, moduleTypeMimeType } from './chunk-3G6JZQDH.mjs';
1
+ export { createWorkerUploadForm, fromMimeType, moduleTypeMimeType } from './chunk-QBZBEHZB.mjs';
2
2
  import './chunk-Q72B4Q5Z.mjs';
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { S as SharedDeployVersionsProps, D as DeployProps, C as ContainerlessConfig, W as WorkerBuildResult, V as VersionsUploadProps, T as TriggerProps, a as TriggerDeployment, B as BuiltDurableObjectContainerImage } from './context-CruwKULH.mjs';
2
2
  export { b as ContainerDeployConfig, c as DeployHelpersContext, i as initDeployHelpersContext } from './context-CruwKULH.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, DurableObjectContainerApp, ExportsReconciliationErrorDetail, ExportsReconciliationResult, StartDevWorkerInput, CacheOptions, PreviewsConfig } 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, ResolvedDurableObjectContainerApp, DurableObjectContainerApp, ExportsReconciliationErrorDetail, ExportsReconciliationResult, StartDevWorkerInput, Json, CacheOptions, PreviewsConfig } from '@cloudflare/workers-utils';
5
5
  import { FormData } from 'undici';
6
6
  export { createWorkerUploadForm, fromMimeType, moduleTypeMimeType } from './create-worker-upload-form.mjs';
7
7
  import { Options } from '@cspotcode/source-map-support';
@@ -49,7 +49,10 @@ type DeployCallbacks = {
49
49
  } | undefined;
50
50
  namespace: string | undefined;
51
51
  }>) | undefined;
52
- analyseBundle: ((workerBundle: string | FormData) => Promise<Record<string, unknown>>) | undefined;
52
+ /**
53
+ * @deprecated Startup profiling is provided by deploy-helpers automatically.
54
+ */
55
+ analyseBundle?: (workerBundle: string | FormData) => Promise<Record<string, unknown>>;
53
56
  };
54
57
  type DeployResult = {
55
58
  sourceMapSize?: number;
@@ -61,6 +64,7 @@ type DeployResult = {
61
64
  };
62
65
  declare function deploy(props: DeployProps, config: ContainerlessConfig, buildResult: WorkerBuildResult, callbacks: DeployCallbacks): Promise<DeployResult>;
63
66
 
67
+ /** Compatibility callback shape for existing deploy-helpers consumers. */
64
68
  type VersionsUploadCallbacks = Pick<DeployCallbacks, "analyseBundle">;
65
69
  type VersionsUploadResult = {
66
70
  versionId: string | null;
@@ -70,7 +74,7 @@ type VersionsUploadResult = {
70
74
  versionPreviewAliasUrl?: string | undefined;
71
75
  bundleSize?: BundleSize;
72
76
  };
73
- declare function versionsUpload(props: VersionsUploadProps, config: ContainerlessConfig, buildResult: WorkerBuildResult, callbacks: VersionsUploadCallbacks): Promise<VersionsUploadResult>;
77
+ declare function versionsUpload(props: VersionsUploadProps, config: ContainerlessConfig, buildResult: WorkerBuildResult, callbacks?: VersionsUploadCallbacks): Promise<VersionsUploadResult>;
74
78
 
75
79
  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.";
76
80
  declare function triggersDeploy(props: TriggerProps): Promise<string[] | void>;
@@ -236,7 +240,7 @@ declare function ensureQueuesExistByConfig(config: Config, accountId: string, in
236
240
  /**
237
241
  * Parse placement out of a Config
238
242
  */
239
- declare function parseConfigPlacement(config: Config): CfPlacement | undefined;
243
+ declare function parseConfigPlacement(placement: Config["placement"]): CfPlacement | undefined;
240
244
 
241
245
  /**
242
246
  This is the error code from the Cloudflare API signaling that a worker could not be found on the target account
@@ -482,11 +486,12 @@ declare function applyServiceAndEnvironmentTags(config: Config, tags: string[]):
482
486
  declare function warnOnErrorUpdatingServiceAndEnvironmentTags(): void;
483
487
  declare function tagsAreEqual(a: string[], b: string[]): boolean;
484
488
 
489
+ type AnalyseBundle = (bundle: FormData | string) => Promise<unknown>;
485
490
  declare function helpIfErrorIsSizeOrScriptStartup(err: unknown, dependencies: {
486
491
  [path: string]: {
487
492
  bytesInOutput: number;
488
493
  };
489
- }, workerBundle: FormData | string, projectRoot: string | undefined, analyseBundle?: (bundle: FormData | string) => Promise<unknown>): Promise<string | null>;
494
+ }, workerBundle: FormData | string, projectRoot: string | undefined, analyseBundle?: AnalyseBundle): Promise<string | null>;
490
495
  /**
491
496
  * Returns a formatted error message that describes the script size error.
492
497
  * It includes the largest dependencies if available.
@@ -500,7 +505,7 @@ declare function diagnoseScriptSizeError(err: ParseError, dependencies: {
500
505
  * Returns a formatted error message that describes the startup error.
501
506
  * If profiling is successful, it will include a link to the generated CPU profile.
502
507
  */
503
- declare function diagnoseStartupError(err: ParseError, workerBundle: FormData | string, projectRoot: string | undefined, analyseBundle?: (bundle: FormData | string) => Promise<unknown>): Promise<string>;
508
+ declare function diagnoseStartupError(err: ParseError, workerBundle: FormData | string, projectRoot: string | undefined, analyseBundle?: AnalyseBundle): Promise<string>;
504
509
 
505
510
  type Percentage = number;
506
511
  type UUID = string;
@@ -689,6 +694,8 @@ type DeployDurableObjectContainerApplicationsArgs = {
689
694
  versionId: string;
690
695
  accountId: string;
691
696
  scriptName: string;
697
+ /** Version uploads may initialize a missing application, but never update one. */
698
+ updateExisting?: boolean;
692
699
  };
693
700
  type PrepareDurableObjectContainerApplicationsArgs = {
694
701
  accountId: string | undefined;
@@ -696,12 +703,19 @@ type PrepareDurableObjectContainerApplicationsArgs = {
696
703
  dryRun: boolean;
697
704
  scriptName: string;
698
705
  };
699
- type DurableObjectContainerApplication = Pick<DurableObjectContainerApp, "class_name" | "name">;
706
+ type DurableObjectContainerApplication = Pick<ResolvedDurableObjectContainerApp, "class_name" | "name">;
700
707
  type VersionedDurableObjectContainerApplication = DurableObjectContainerApplication & {
701
708
  namespaceId?: string;
702
709
  };
703
710
  type PreparedContainerImages = Record<string, Record<string, string>>;
704
711
  declare function createDurableObjectContainerApplication(application: DurableObjectContainerApplication, namespaceId: string): Promise<void>;
712
+ /**
713
+ * Read managed application identities from selected Worker versions.
714
+ *
715
+ * Versions must agree on class/name associations and known namespace IDs.
716
+ * Application-wide settings are deliberately not read from local config or
717
+ * restored with a Worker version.
718
+ */
705
719
  declare function getVersionedDurableObjectContainerApplications(versions: ApiVersion[], scriptName: string): VersionedDurableObjectContainerApplication[];
706
720
  /** Resolve every versioned application's namespace without creating applications. */
707
721
  declare function resolveVersionedDurableObjectContainerApplications(config: Config, { applications, accountId, scriptName, allowMissingNamespaces, }: {
@@ -710,14 +724,27 @@ declare function resolveVersionedDurableObjectContainerApplications(config: Conf
710
724
  scriptName: string;
711
725
  allowMissingNamespaces?: boolean;
712
726
  }): Promise<VersionedDurableObjectContainerApplication[]>;
713
- /** Create applications only after every deployed namespace has been resolved. */
727
+ /**
728
+ * Ensure selected versions have applications after every namespace is resolved.
729
+ *
730
+ * Existing settings are preserved. Missing applications are created with API
731
+ * defaults, so rolling back a Worker never rolls back application-wide settings.
732
+ */
714
733
  declare function deployVersionedDurableObjectContainerApplications(config: Config, args: {
715
734
  applications: VersionedDurableObjectContainerApplication[];
716
735
  accountId: string;
717
736
  scriptName: string;
718
737
  }): Promise<void>;
738
+ /** Validate managed classes and prepare their named images before Worker upload. */
719
739
  declare function prepareDurableObjectContainerApplications(config: ContainerlessConfig, durableObjectContainerConfig: DurableObjectContainerApp[], builtImages: BuiltDurableObjectContainerImage[], { accountId, dryRun, scriptName, dispatchNamespace, }: PrepareDurableObjectContainerApplicationsArgs): Promise<PreparedContainerImages>;
720
- declare function deployDurableObjectContainerApplications(config: ContainerlessConfig, durableObjectContainerConfig: DurableObjectContainerApp[], { versionId, accountId, scriptName, dispatchNamespace, }: DeployDurableObjectContainerApplicationsArgs): Promise<void>;
740
+ /**
741
+ * Apply explicit application settings after an uploaded Worker's namespaces exist.
742
+ *
743
+ * Resolve all namespaces before writing. Normal deployments initialize missing
744
+ * applications and patch supplied changes; `updateExisting: false` makes version
745
+ * uploads create-only. Omitted settings and root Worker observability are ignored.
746
+ */
747
+ declare function deployDurableObjectContainerApplications(config: ContainerlessConfig, durableObjectContainerConfig: DurableObjectContainerApp[], { versionId, accountId, scriptName, dispatchNamespace, updateExisting, }: DeployDurableObjectContainerApplicationsArgs): Promise<void>;
721
748
 
722
749
  type ResolveExportsUploadPayloadProps = Parameters<typeof resolveDoLifecyclePayload>[0];
723
750
  declare function resolveExportsUploadPayload(props: ResolveExportsUploadPayloadProps): Promise<{
@@ -841,7 +868,7 @@ declare function getSettings(complianceConfig: ComplianceConfig, accountId: stri
841
868
  interface Binding {
842
869
  type: string;
843
870
  text?: string;
844
- json?: unknown;
871
+ json?: Json;
845
872
  namespace_id?: string;
846
873
  workflow_name?: string;
847
874
  destination_address?: string;
@@ -852,9 +879,13 @@ interface Binding {
852
879
  database_id?: string;
853
880
  database_name?: string;
854
881
  bucket_name?: string;
882
+ jurisdiction?: string;
855
883
  index_name?: string;
884
+ instance_name?: string;
856
885
  id?: string;
857
886
  service?: string;
887
+ environment?: string;
888
+ cross_account_grant?: string;
858
889
  dataset?: string;
859
890
  namespace?: string;
860
891
  outbound?: {
@@ -940,6 +971,7 @@ type CreatePreviewDeploymentRequestParams = {
940
971
  };
941
972
  compatibility_date?: string;
942
973
  compatibility_flags?: string[];
974
+ exports?: CfWorkerInit["exports"];
943
975
  annotations?: {
944
976
  "workers/commit_sha"?: string;
945
977
  "workers/message"?: string;
@@ -951,7 +983,7 @@ type CreatePreviewDeploymentRequestParams = {
951
983
  };
952
984
  migrations?: CfWorkerInit["migrations"];
953
985
  limits?: CfUserLimits;
954
- placement?: CfPlacement;
986
+ placement?: CfPlacement | null;
955
987
  cache?: CacheOptions;
956
988
  env?: EnvBindings;
957
989
  containers?: Array<{
@@ -1092,6 +1124,9 @@ type PreviewArgs = {
1092
1124
  ignoreBaseConfig: boolean;
1093
1125
  workerName?: string;
1094
1126
  "worker-name"?: string;
1127
+ secretsFile?: string;
1128
+ /** Parsed `--var` args. CLI-only vars; config vars flow separately via `extractConfigBindings(config)`. */
1129
+ cliVars?: Record<string, string>;
1095
1130
  };
1096
1131
  type PreviewAssetsOptions = {
1097
1132
  directory: string;
@@ -1115,6 +1150,9 @@ type PreviewResult = {
1115
1150
  isNewPreview: boolean;
1116
1151
  };
1117
1152
  type PreviewCallbacks = {
1153
+ productionBindingsExpectedInPreview?: Record<string, {
1154
+ type: string;
1155
+ }>;
1118
1156
  getNormalizedContainerOptions: ((config: Config, args: {
1119
1157
  containersRollout?: "gradual" | "immediate" | "none";
1120
1158
  dryRun?: boolean;