@cloudflare/deploy-helpers 0.4.0 → 0.5.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.
@@ -40,7 +40,6 @@ var fetchKVGetValue;
40
40
  var confirm;
41
41
  var prompt;
42
42
  var select;
43
- var isNonInteractiveOrCI;
44
43
  function initDeployHelpersContext(ctx) {
45
44
  logger = ctx.logger;
46
45
  fetchResult = ctx.fetchResult;
@@ -50,8 +49,7 @@ function initDeployHelpersContext(ctx) {
50
49
  confirm = ctx.confirm;
51
50
  prompt = ctx.prompt;
52
51
  select = ctx.select;
53
- isNonInteractiveOrCI = ctx.isNonInteractiveOrCI;
54
52
  }
55
53
  __name(initDeployHelpersContext, "initDeployHelpersContext");
56
54
 
57
- export { __commonJS, __name, __require, __toESM, confirm, fetchKVGetValue, fetchListResult, fetchPagedListResult, fetchResult, initDeployHelpersContext, isNonInteractiveOrCI, logger, prompt, select };
55
+ export { __commonJS, __name, __require, __toESM, confirm, fetchKVGetValue, fetchListResult, fetchPagedListResult, fetchResult, initDeployHelpersContext, logger, prompt, select };
@@ -26,7 +26,6 @@ type DeployHelpersContext = {
26
26
  defaultOption?: number;
27
27
  fallbackOption?: number;
28
28
  }) => Promise<Values>;
29
- isNonInteractiveOrCI: () => boolean;
30
29
  };
31
30
  /**
32
31
  * Shared fields produced by merging CLI args with wrangler config.
@@ -60,11 +59,6 @@ type SharedDeployVersionsProps = {
60
59
  keepVars: boolean;
61
60
  /** Merged from --site arg and config.site. */
62
61
  isWorkersSite: boolean;
63
- /**
64
- * Whether to use the deprecated service environments API path.
65
- * True only when config opts in (legacy_env: false) AND --env is specified.
66
- */
67
- useServiceEnvApiPath: boolean;
68
62
  /** From --dry-run arg. */
69
63
  dryRun: boolean;
70
64
  /** From --env arg. */
@@ -148,7 +142,6 @@ type TriggerProps = {
148
142
  env: string | undefined;
149
143
  crons: string[] | undefined;
150
144
  routes: Route[];
151
- useServiceEnvironments: boolean;
152
145
  firstDeploy: boolean;
153
146
  };
154
147
 
@@ -172,11 +165,10 @@ declare let fetchKVGetValue: FetchKVGetValueFetcher;
172
165
  declare let confirm: DeployHelpersContext["confirm"];
173
166
  declare let prompt: DeployHelpersContext["prompt"];
174
167
  declare let select: DeployHelpersContext["select"];
175
- declare let isNonInteractiveOrCI: () => boolean;
176
168
  /**
177
169
  * Set the global context for deploy-helpers. Must be called once at
178
170
  * startup before any deploy-helpers function that needs these values.
179
171
  */
180
172
  declare function initDeployHelpersContext(ctx: DeployHelpersContext): void;
181
173
 
182
- export { type DeployProps as D, type SharedDeployVersionsProps as S, type TriggerProps as T, type VersionsUploadProps as V, type WorkerBuildResult as W, type TriggerDeployment as a, type DeployHelpersContext as b, fetchListResult as c, fetchPagedListResult as d, fetchKVGetValue as e, fetchResult as f, confirm as g, isNonInteractiveOrCI as h, initDeployHelpersContext as i, logger as l, prompt as p, select as s };
174
+ export { type DeployProps as D, type SharedDeployVersionsProps as S, type TriggerProps as T, type VersionsUploadProps as V, type WorkerBuildResult as W, type TriggerDeployment as a, type DeployHelpersContext as b, fetchListResult as c, fetchPagedListResult as d, fetchKVGetValue as e, fetchResult as f, confirm as g, initDeployHelpersContext as i, logger as l, prompt as p, select as s };
@@ -1,2 +1,2 @@
1
- export { g as confirm, e as fetchKVGetValue, c as fetchListResult, d as fetchPagedListResult, f as fetchResult, i as initDeployHelpersContext, h as isNonInteractiveOrCI, l as logger, p as prompt, s as select } from './context-BlrOQtMG.mjs';
1
+ export { g as confirm, e as fetchKVGetValue, c as fetchListResult, d as fetchPagedListResult, f as fetchResult, i as initDeployHelpersContext, l as logger, p as prompt, s as select } from './context-DAPhsIL6.mjs';
2
2
  import '@cloudflare/workers-utils';
package/dist/context.mjs CHANGED
@@ -1 +1 @@
1
- export { confirm, fetchKVGetValue, fetchListResult, fetchPagedListResult, fetchResult, initDeployHelpersContext, isNonInteractiveOrCI, logger, prompt, select } from './chunk-N72KNDFF.mjs';
1
+ export { confirm, fetchKVGetValue, fetchListResult, fetchPagedListResult, fetchResult, initDeployHelpersContext, logger, prompt, select } from './chunk-HE3NAOND.mjs';
package/dist/index.d.mts CHANGED
@@ -1,8 +1,7 @@
1
- import { S as SharedDeployVersionsProps, D as DeployProps, W as WorkerBuildResult, V as VersionsUploadProps, T as TriggerProps, a as TriggerDeployment } from './context-BlrOQtMG.mjs';
2
- export { b as DeployHelpersContext, i as initDeployHelpersContext } from './context-BlrOQtMG.mjs';
3
- export { InputWorkerSchema, ModuleType, OutputWorkerSchema, ParsedInputWorkerConfig, ParsedOutputWorkerConfig, convertToWranglerConfig } from '@cloudflare/config';
1
+ import { S as SharedDeployVersionsProps, D as DeployProps, W as WorkerBuildResult, V as VersionsUploadProps, T as TriggerProps, a as TriggerDeployment } from './context-DAPhsIL6.mjs';
2
+ export { b as DeployHelpersContext, i as initDeployHelpersContext } from './context-DAPhsIL6.mjs';
4
3
  import * as _cloudflare_workers_utils from '@cloudflare/workers-utils';
5
- import { ComplianceConfig, Config, AssetsOptions, LegacyAssetPaths, Route, ZoneIdRoute, ZoneNameRoute, CustomDomainRoute, CfPlacement, Binding, RawConfig, ConfigBindingFieldName, CfCapnp, CfModuleType, CfWorkerInit, CfScriptFormat, CfModule, ParseError, WorkerMetadataBinding, CfUserLimits, TailConsumer, StreamingTailConsumer, Observability, ExportsReconciliationResult, ExportsReconciliationErrorDetail, StartDevWorkerInput, CfTailConsumer, ContainerApp } from '@cloudflare/workers-utils';
4
+ import { ComplianceConfig, Config, AssetsOptions, LegacyAssetPaths, Route, ZoneIdRoute, ZoneNameRoute, CustomDomainRoute, CfPlacement, Binding as Binding$1, RawConfig, ConfigBindingFieldName, CfCapnp, CfModuleType, CfWorkerInit, CfScriptFormat, CfModule, ParseError, WorkerMetadataBinding, CfUserLimits, TailConsumer, StreamingTailConsumer, Observability, ExportsReconciliationResult, ExportsReconciliationErrorDetail, StartDevWorkerInput, CfTailConsumer, ContainerApp, CacheOptions } from '@cloudflare/workers-utils';
6
5
  import { ContainerNormalizedConfig, ImageURIConfig } from '@cloudflare/containers-shared';
7
6
  import { FormData } from 'undici';
8
7
  import { Options } from '@cspotcode/source-map-support';
@@ -141,10 +140,9 @@ declare function renderRoute(route: Route): string;
141
140
  /**
142
141
  * Associate the newly deployed Worker with the given routes.
143
142
  */
144
- declare function publishRoutes(complianceConfig: ComplianceConfig, routes: Route[], { workerUrl, scriptName, useServiceEnvironments, accountId, }: {
143
+ declare function publishRoutes(complianceConfig: ComplianceConfig, routes: Route[], { workerUrl, scriptName, accountId, }: {
145
144
  workerUrl: string;
146
145
  scriptName: string;
147
- useServiceEnvironments: boolean;
148
146
  accountId: string;
149
147
  }): Promise<string[]>;
150
148
  declare function publishCustomDomains(complianceConfig: ComplianceConfig, workerUrl: string, accountId: string, domains: Array<RouteObject>): Promise<TriggerDeployment>;
@@ -255,16 +253,6 @@ declare const workerNotFoundErrorMessage = "This Worker does not exist on your a
255
253
  */
256
254
  declare function isWorkerNotFoundError(error: unknown): boolean;
257
255
 
258
- /**
259
- * Whether deprecated service environments are enabled.
260
- */
261
- declare function useServiceEnvironments(config: Config | {
262
- legacy_env?: boolean;
263
- legacy: {
264
- useServiceEnvironments?: boolean;
265
- };
266
- }): boolean;
267
-
268
256
  /**
269
257
  * Cloudflare API error codes used by deploy-helpers.
270
258
  */
@@ -316,7 +304,7 @@ type SecretsValidationOptions = {
316
304
  * Secrets already provided (e.g. via --secrets-file) are excluded since
317
305
  * they are part of the upload and don't need to be inherited.
318
306
  */
319
- declare function addRequiredSecretsInheritBindings(config: Config, bindings: Record<string, Binding>, options: SecretsValidationOptions): void;
307
+ declare function addRequiredSecretsInheritBindings(config: Config, bindings: Record<string, Binding$1>, options: SecretsValidationOptions): void;
320
308
  /**
321
309
  * Reformats API errors for strict inherit binding validation failures into
322
310
  * user-friendly messages listing the missing required secrets.
@@ -440,26 +428,26 @@ interface ConvertBindingsOptions {
440
428
  /**
441
429
  * Convert Config to the Record<string, Binding> format for consistent internal use.
442
430
  */
443
- declare function convertConfigToBindings(config: Partial<Pick<Config, ConfigBindingFieldName>>, options?: ConvertBindingsOptions): Record<string, Binding>;
431
+ declare function convertConfigToBindings(config: Partial<Pick<Config, ConfigBindingFieldName>>, options?: ConvertBindingsOptions): Record<string, Binding$1>;
444
432
  declare function isUnsafeBindingType(type: string): type is `unsafe_${string}`;
445
433
  /**
446
434
  * What configuration key does this binding use for referring to it's binding name?
447
435
  */
448
436
  declare const nameBindings: readonly ["durable_object_namespace", "logfwdr", "ratelimit", "unsafe_ratelimit", "send_email"];
449
- type FlatBinding<Type> = Extract<Binding, {
437
+ type FlatBinding<Type> = Extract<Binding$1, {
450
438
  type: Type;
451
439
  }> & (Type extends (typeof nameBindings)[number] ? {
452
440
  name: string;
453
441
  } : {
454
442
  binding: string;
455
443
  });
456
- declare function extractBindingsOfType<Type extends Binding["type"]>(type: Type, bindings: Record<string, Binding> | undefined): FlatBinding<Type>[];
444
+ declare function extractBindingsOfType<Type extends Binding$1["type"]>(type: Type, bindings: Record<string, Binding$1> | undefined): FlatBinding<Type>[];
457
445
  /**
458
446
  * Get bindings from a Config object in the standard Record<string, Binding> format.
459
447
  */
460
448
  declare function getBindings(config: Config | undefined, options?: {
461
449
  pages?: boolean;
462
- }): Record<string, Binding>;
450
+ }): Record<string, Binding$1>;
463
451
 
464
452
  declare function handleUnsafeCapnp(capnp: CfCapnp): Buffer;
465
453
 
@@ -470,7 +458,7 @@ declare function fromMimeType(mimeType: string): CfModuleType;
470
458
  /**
471
459
  * Creates a `FormData` upload from Worker data and bindings
472
460
  */
473
- declare function createWorkerUploadForm(worker: Omit<CfWorkerInit, "bindings" | "rawBindings">, bindings: Record<string, Binding> | undefined, options?: {
461
+ declare function createWorkerUploadForm(worker: Omit<CfWorkerInit, "bindings" | "rawBindings">, bindings: Record<string, Binding$1> | undefined, options?: {
474
462
  dryRun?: true;
475
463
  unsafe?: {
476
464
  metadata?: Record<string, unknown>;
@@ -482,10 +470,10 @@ declare function createWorkerUploadForm(worker: Omit<CfWorkerInit, "bindings" |
482
470
  * Inject bindings into the Worker to support Workers Sites. These are injected at the last minute so that
483
471
  * they don't display in the output of `printBindings()`
484
472
  */
485
- declare function addWorkersSitesBindings(bindings: Record<string, Binding>, namespace: string | undefined, manifest: {
473
+ declare function addWorkersSitesBindings(bindings: Record<string, Binding$1>, namespace: string | undefined, manifest: {
486
474
  [filePath: string]: string;
487
475
  } | undefined, format: CfScriptFormat): {
488
- [x: string]: Binding;
476
+ [x: string]: Binding$1;
489
477
  };
490
478
 
491
479
  declare function deployWfpUserWorker(dispatchNamespace: string, versionId: string | null): void;
@@ -499,10 +487,6 @@ declare function getDeployConfirmFunction(options: {
499
487
  * Converts to lowercase, replaces invalid chars with dashes, removes consecutive dashes.
500
488
  */
501
489
  declare function sanitizeBranchName(branchName: string): string;
502
- /**
503
- * Gets the current branch name from CI environment or git.
504
- */
505
- declare function getBranchName(): string | undefined;
506
490
  /**
507
491
  * Creates a truncated alias with hash suffix when the branch name is too long.
508
492
  * Hash from original branch name to preserve uniqueness.
@@ -733,8 +717,6 @@ declare function downloadWorkerConfig(workerName: string, environment: string, e
733
717
  declare function getMigrationsToUpload(scriptName: string, props: {
734
718
  accountId: string | undefined;
735
719
  config: Config;
736
- useServiceEnvironments: boolean | undefined;
737
- env: string | undefined;
738
720
  dispatchNamespace: string | undefined;
739
721
  }): Promise<CfWorkerInit["migrations"]>;
740
722
  /**
@@ -745,8 +727,6 @@ declare function resolveDoLifecyclePayload(props: {
745
727
  isDryRun: boolean | undefined;
746
728
  accountId: string | undefined;
747
729
  config: Config;
748
- useServiceEnvironments: boolean | undefined;
749
- env: string | undefined;
750
730
  dispatchNamespace: string | undefined;
751
731
  }): Promise<{
752
732
  migrations: CfWorkerInit["migrations"];
@@ -808,11 +788,11 @@ declare function renderBindingDependsOnExportError(serverMessage: string): strin
808
788
 
809
789
  declare function verifyWorkerMatchesCITag(complianceConfig: ComplianceConfig, accountId: string, workerName: string, configPath: string | undefined): Promise<void>;
810
790
 
811
- declare function fetchSecrets(config: Config, scriptName: string, accountId: string, environment: string | undefined): Promise<{
791
+ declare function fetchSecrets(config: Config, scriptName: string, accountId: string): Promise<{
812
792
  name: string;
813
793
  type: string;
814
794
  }[]>;
815
- declare function checkRemoteSecretsOverride(config: Config, scriptName: string, accountId: string, targetEnv: string | undefined): Promise<{
795
+ declare function checkRemoteSecretsOverride(config: Config, scriptName: string, accountId: string): Promise<{
816
796
  override: false;
817
797
  } | {
818
798
  override: true;
@@ -844,7 +824,7 @@ declare function printBindings(bindings: StartDevWorkerInput["bindings"], tailCo
844
824
  * {@link getBindingLocalSupport}). Throws `UserError` for invalid combinations
845
825
  * and emits warnings for valid-but-noteworthy ones.
846
826
  */
847
- declare function warnOrError(type: Binding["type"], remote: boolean | undefined): void;
827
+ declare function warnOrError(type: Binding$1["type"], remote: boolean | undefined): void;
848
828
 
849
829
  declare const hashFile: (filepath: string) => string;
850
830
 
@@ -889,4 +869,273 @@ declare function provisionBindings(bindings: StartDevWorkerInput["bindings"], ac
889
869
  }): Promise<void>;
890
870
  declare function getSettings(complianceConfig: ComplianceConfig, accountId: string, scriptName: string): Promise<Settings>;
891
871
 
892
- export { ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE, type ApiDeployment, type ApiVersion, type AssetManifest, type AssetUploadStats, type AssetsUploadResult, type BulkInputNullableResult, type BulkInputResult, type Consumer, type ConsumerSettings, type CustomDomain, type CustomDomainChangeset, type DeployCallbacks, DeployProps, EXPORTS_RECONCILIATION_ERROR_CODE, INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE, INVALID_INHERIT_BINDING_CODE, type JsonLike, NoInputError, type NonVersionedScriptSettings, type PackageDependency, type Percentage, type PostQueueBody, type PostQueueResponse, type PostTypedConsumerBody, type Producer, type PurgeQueueBody, type PurgeQueueResponse, type QueueResponse, type QueueSettings, type RetrieveSourceMapFunction, type RouteObject, type ScriptReference, type Settings, SharedDeployVersionsProps, TriggerDeployment, TriggerProps, type TypedConsumerResponse, 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, buildAssetManifest, checkRemoteSecretsOverride, checkWorkflowConflicts, collectPackageDependencies, confirmLatestDeploymentOverwrite, convertConfigToBindings, createDeployment, createTruncatedAlias, createWorkerUploadForm, decodeJwtPayload, deletePullConsumer, deleteWorkerConsumer, deploy, deployWfpUserWorker, diagnoseScriptSizeError, diagnoseStartupError, diffJsonObjects, downloadWorkerConfig, ensureQueuesExistByConfig, extractBindingsOfType, fetchDeployableVersions, fetchDeploymentVersions, fetchLatestDeployment, fetchLatestDeployments, fetchSecrets, fetchVersion, fetchVersions, fetchWorkerConfig, fromMimeType, generatePreviewAlias, getBindings, getBranchName, getConfigPatch, getDeployConfirmFunction, getEdgeKvUploadConcurrency, getMigrationsToUpload, getQueue, getRemoteConfigDiff, getSettings, getSourceMappedStack, getSourceMappedString, getSubdomainValues, getSubdomainValuesAPIMock, getWorkersDevSubdomain, getZoneForRoute, getZoneIdFromHost, handleMissingSecretsError, handleUnsafeCapnp, hasDefinedEnvironments, hashFile, helpIfErrorIsSizeOrScriptStartup, isExportsReconciliationErrorDetails, isJwtExpired, isModifiedDiffValue, isNonDestructive, isUnsafeBindingType, isWorkerNotFoundError, listConsumers, listQueues, maybeRetrieveFileSourceMap, moduleTypeMimeType, parseBulkInputToObject, parseConfigPlacement, patchNonVersionedScriptSettings, postConsumer, printBindings, printBundleSize, printVersions, provisionBindings, publishCustomDomains, publishRoutes, putConsumer, putConsumerById, renderBindingDependsOnExportError, renderExportsReconciliationError, renderExportsReconciliationSuccess, renderInconsistentExportsAcrossVersionsError, renderRoute, resolveAssetOptions, resolveDoLifecyclePayload, resolveExportsUploadPayload, sanitizeBranchName, syncAssets, tagsAreEqual, triggersDeploy, updateQueueConsumers, useServiceEnvironments, validateFileSecrets, validateNodeCompatMode, validateRoutes, verifyWorkerMatchesCITag, versionsUpload, warnOnErrorUpdatingServiceAndEnvironmentTags, warnOrError, workerNotFoundErrorMessage };
872
+ interface Binding {
873
+ type: string;
874
+ text?: string;
875
+ json?: unknown;
876
+ namespace_id?: string;
877
+ workflow_name?: string;
878
+ destination_address?: string;
879
+ allowed_destination_addresses?: string[];
880
+ allowed_sender_addresses?: string[];
881
+ queue_name?: string;
882
+ delivery_delay?: number;
883
+ database_id?: string;
884
+ database_name?: string;
885
+ bucket_name?: string;
886
+ index_name?: string;
887
+ id?: string;
888
+ service?: string;
889
+ dataset?: string;
890
+ namespace?: string;
891
+ outbound?: {
892
+ worker: {
893
+ service: string;
894
+ environment?: string;
895
+ };
896
+ params?: Array<{
897
+ name: string;
898
+ }>;
899
+ };
900
+ certificate_id?: string;
901
+ pipeline?: string;
902
+ stream?: string;
903
+ store_id?: string;
904
+ secret_name?: string;
905
+ simple?: {
906
+ limit: number;
907
+ period: 10 | 60;
908
+ };
909
+ service_id?: string;
910
+ staging?: boolean;
911
+ enable_timer?: boolean;
912
+ app_id?: string;
913
+ entrypoint?: string;
914
+ class_name?: string;
915
+ script_name?: string;
916
+ }
917
+ type EnvBindings = Record<string, Binding>;
918
+ interface PreviewResource {
919
+ id: string;
920
+ name: string;
921
+ slug: string;
922
+ urls?: string[];
923
+ worker_name: string;
924
+ tags?: string[];
925
+ observability?: Observability;
926
+ logpush?: boolean;
927
+ tail_consumers?: Array<{
928
+ name: string;
929
+ }>;
930
+ created_on: string;
931
+ updated_on: string;
932
+ }
933
+ interface DeploymentResource {
934
+ id: string;
935
+ preview_id: string;
936
+ preview_name: string;
937
+ migration_tag?: string;
938
+ urls?: string[];
939
+ compatibility_date?: string;
940
+ compatibility_flags?: string[];
941
+ limits?: CfUserLimits;
942
+ placement?: CfPlacement;
943
+ cache?: CacheOptions;
944
+ env?: EnvBindings;
945
+ created_on: string;
946
+ }
947
+ type CreatePreviewDeploymentRequestParams = {
948
+ main_module?: string;
949
+ modules?: Array<{
950
+ name: string;
951
+ content_type: string;
952
+ content_base64: string;
953
+ }>;
954
+ assets?: {
955
+ jwt: string;
956
+ config: {
957
+ html_handling?: string;
958
+ not_found_handling?: string;
959
+ run_worker_first?: string[] | boolean;
960
+ };
961
+ };
962
+ compatibility_date?: string;
963
+ compatibility_flags?: string[];
964
+ annotations?: {
965
+ "workers/message"?: string;
966
+ "workers/tag"?: string;
967
+ };
968
+ migrations?: CfWorkerInit["migrations"];
969
+ limits?: CfUserLimits;
970
+ placement?: CfPlacement;
971
+ cache?: CacheOptions;
972
+ env?: EnvBindings;
973
+ };
974
+ type CreatePreviewRequestParams = {
975
+ name: string;
976
+ observability?: Observability;
977
+ logpush?: boolean;
978
+ tail_consumers?: Array<{
979
+ name: string;
980
+ }>;
981
+ };
982
+ type UpdatePreviewRequestParams = Omit<CreatePreviewRequestParams, "name">;
983
+ type PreviewRequestOptions = {
984
+ ignoreDefaults?: boolean;
985
+ };
986
+ type PreviewDefaults = {
987
+ observability?: Observability;
988
+ logpush?: boolean;
989
+ limits?: CfUserLimits;
990
+ placement?: CfPlacement;
991
+ cache?: CacheOptions;
992
+ tail_consumers?: Array<{
993
+ name: string;
994
+ }>;
995
+ env?: EnvBindings;
996
+ };
997
+ type PreviewDefaultsPatch = Partial<Omit<PreviewDefaults, "env">> & {
998
+ env?: Record<string, Binding | null>;
999
+ };
1000
+ declare function getPreview(config: Config, accountId: string, workerName: string, previewIdentifier: string): Promise<PreviewResource>;
1001
+ declare function createPreview(config: Config, accountId: string, workerName: string, request: CreatePreviewRequestParams, options?: PreviewRequestOptions): Promise<PreviewResource>;
1002
+ declare function editPreview(config: Config, accountId: string, workerName: string, previewIdentifier: string, request: UpdatePreviewRequestParams, options?: PreviewRequestOptions): Promise<PreviewResource>;
1003
+ declare function deletePreview(config: Config, accountId: string, workerName: string, previewIdentifier: string): Promise<void>;
1004
+ declare function getPreviewDeployment(config: Config, accountId: string, workerName: string, previewIdentifier: string, deploymentIdentifier: string): Promise<DeploymentResource>;
1005
+ declare function createPreviewDeployment(config: Config, accountId: string, workerName: string, previewIdentifier: string, request: Partial<CreatePreviewDeploymentRequestParams>, options?: PreviewRequestOptions): Promise<DeploymentResource>;
1006
+ declare function getWorkerPreviewDefaults(config: Config, accountId: string, workerName: string): Promise<PreviewDefaults>;
1007
+ declare function editWorkerPreviewDefaults(config: Config, accountId: string, workerName: string, previewDefaults: PreviewDefaultsPatch): Promise<PreviewDefaults>;
1008
+
1009
+ declare function getBranchName(): string | undefined;
1010
+ declare function shouldUseCIMetadataFallback(): boolean;
1011
+ declare function getHeadCommitRef(): string | undefined;
1012
+ declare function getHeadCommitMessage(): string | undefined;
1013
+ declare function resolveWorkerName(args: {
1014
+ workerName?: string;
1015
+ "worker-name"?: string;
1016
+ }, config: Config): string;
1017
+ /**
1018
+ * Get a human-readable display value for a binding.
1019
+ * Used by both preview deployment and Previews settings formatting.
1020
+ */
1021
+ declare function getBindingValue(binding: Binding): string;
1022
+ declare function extractConfigBindings(config: Config): EnvBindings;
1023
+ declare function assemblePreviewScriptSettings(config: Config): Record<string, unknown>;
1024
+ declare function assemblePreviewDefaults(config: Config): PreviewDefaults;
1025
+
1026
+ type PreviewArgs = {
1027
+ script?: string;
1028
+ name?: string;
1029
+ tag?: string;
1030
+ message?: string;
1031
+ json?: boolean;
1032
+ ignoreDefaults: boolean;
1033
+ workerName?: string;
1034
+ "worker-name"?: string;
1035
+ };
1036
+ type PreviewAssetsOptions = {
1037
+ directory: string;
1038
+ assetConfig: {
1039
+ html_handling?: string;
1040
+ not_found_handling?: string;
1041
+ };
1042
+ run_worker_first?: string[] | boolean;
1043
+ _headers?: string;
1044
+ _redirects?: string;
1045
+ };
1046
+ type PreviewDeleteArgs = {
1047
+ name?: string;
1048
+ skipConfirmation?: boolean;
1049
+ workerName?: string;
1050
+ "worker-name"?: string;
1051
+ };
1052
+ type PreviewResult = {
1053
+ preview: PreviewResource;
1054
+ deployment: DeploymentResource;
1055
+ isNewPreview: boolean;
1056
+ };
1057
+ /**
1058
+ * Full preview create/update + deployment orchestration.
1059
+ * The wrangler handler calls this after auth + build.
1060
+ */
1061
+ declare function preview(accountId: string, args: PreviewArgs, config: Config, buildResult: WorkerBuildResult, assetsOptions: PreviewAssetsOptions | undefined): Promise<PreviewResult>;
1062
+ /**
1063
+ * Delete a preview and all its deployments.
1064
+ */
1065
+ declare function previewDelete(accountId: string, args: PreviewDeleteArgs, config: Config): Promise<void>;
1066
+
1067
+ type MergedBinding = Binding & {
1068
+ fromConfig: boolean;
1069
+ };
1070
+ declare function formatAlignedRows(rows: Array<[string, string, boolean]>, indent?: string): string[];
1071
+ declare function formatBindings(env: Record<string, MergedBinding>, indent?: string, options?: {
1072
+ showSourceMarker?: boolean;
1073
+ }): string[];
1074
+ declare function formatPreviewsSettings(workerName: string, previewDefaults: PreviewDefaults): string;
1075
+
1076
+ /**
1077
+ * Deep merge two objects. Source overwrites target.
1078
+ * Arrays are treated as terminal values and replaced wholesale.
1079
+ */
1080
+ declare function mergeDeep<T>(target: T, source: Partial<T>): T;
1081
+
1082
+ type PreviewSettingsArgs = {
1083
+ json?: boolean;
1084
+ workerName?: string;
1085
+ "worker-name"?: string;
1086
+ };
1087
+ type PreviewSettingsUpdateArgs = {
1088
+ skipConfirmation?: boolean;
1089
+ workerName?: string;
1090
+ "worker-name"?: string;
1091
+ };
1092
+ /**
1093
+ * Fetch and display the current Previews settings for a Worker.
1094
+ */
1095
+ declare function previewSettingsGet(accountId: string, args: PreviewSettingsArgs, config: Config): Promise<void>;
1096
+ /**
1097
+ * Merge local config with remote Previews settings, diff, confirm, and apply.
1098
+ */
1099
+ declare function previewSettingsUpdate(accountId: string, args: PreviewSettingsUpdateArgs, config: Config): Promise<void>;
1100
+
1101
+ /**
1102
+ * Remove ANSI escape codes from a string.
1103
+ */
1104
+ declare function stripAnsi(str: string): string;
1105
+ /**
1106
+ * Return the display width of a string by ignoring ANSI escape codes.
1107
+ */
1108
+ declare function visibleLength(str: string): number;
1109
+ /**
1110
+ * Pad a string with trailing spaces to match the target visible width.
1111
+ * ANSI escape codes in `str` are ignored when computing width.
1112
+ */
1113
+ declare function padToVisibleWidth(str: string, width: number): string;
1114
+ type DrawBoxOptions = {
1115
+ footerLines?: string[];
1116
+ connectToChild?: boolean;
1117
+ };
1118
+ /**
1119
+ * Draw a standalone box around the provided lines.
1120
+ *
1121
+ * Options:
1122
+ * - `footerLines`: additional lines appended at the bottom of the content area
1123
+ * - `connectToChild`: render a bottom connector for visual linkage to a child box
1124
+ */
1125
+ declare function drawBox(contentLines: string[], options?: DrawBoxOptions): string;
1126
+ type DrawConnectedChildBoxOptions = {
1127
+ indent?: string;
1128
+ footerLines?: string[];
1129
+ connectorLineIndex?: number;
1130
+ };
1131
+ /**
1132
+ * Draw a child box that visually connects to an upstream parent box.
1133
+ *
1134
+ * Options:
1135
+ * - `indent`: left indentation before the connector and box (default: two spaces)
1136
+ * - `footerLines`: additional lines appended at the bottom of the content area
1137
+ * - `connectorLineIndex`: line index where the horizontal connector joins the box
1138
+ */
1139
+ declare function drawConnectedChildBox(contentLines: string[], options?: DrawConnectedChildBoxOptions): string;
1140
+
1141
+ export { ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE, type ApiDeployment, type ApiVersion, type AssetManifest, type AssetUploadStats, type AssetsUploadResult, type Binding, type BulkInputNullableResult, type BulkInputResult, 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, NoInputError, type NonVersionedScriptSettings, type PackageDependency, type Percentage, type PostQueueBody, type PostQueueResponse, type PostTypedConsumerBody, type PreviewArgs, type PreviewAssetsOptions, type PreviewDefaults, type PreviewDefaultsPatch, type PreviewDeleteArgs, type PreviewRequestOptions, type PreviewResource, type PreviewResult, type PreviewSettingsArgs, type PreviewSettingsUpdateArgs, type Producer, 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, assemblePreviewDefaults, assemblePreviewScriptSettings, buildAssetManifest, checkRemoteSecretsOverride, checkWorkflowConflicts, collectPackageDependencies, confirmLatestDeploymentOverwrite, convertConfigToBindings, createDeployment, createPreview, createPreviewDeployment, createTruncatedAlias, createWorkerUploadForm, decodeJwtPayload, deletePreview, deletePullConsumer, deleteWorkerConsumer, deploy, deployWfpUserWorker, diagnoseScriptSizeError, diagnoseStartupError, diffJsonObjects, downloadWorkerConfig, drawBox, drawConnectedChildBox, editPreview, editWorkerPreviewDefaults, ensureQueuesExistByConfig, extractBindingsOfType, extractConfigBindings, fetchDeployableVersions, fetchDeploymentVersions, fetchLatestDeployment, fetchLatestDeployments, fetchSecrets, fetchVersion, fetchVersions, fetchWorkerConfig, formatAlignedRows, formatBindings, formatPreviewsSettings, fromMimeType, generatePreviewAlias, getBindingValue, getBindings, getBranchName, getConfigPatch, getDeployConfirmFunction, getEdgeKvUploadConcurrency, getHeadCommitMessage, getHeadCommitRef, getMigrationsToUpload, getPreview, getPreviewDeployment, getQueue, getRemoteConfigDiff, getSettings, getSourceMappedStack, getSourceMappedString, getSubdomainValues, getSubdomainValuesAPIMock, getWorkerPreviewDefaults, getWorkersDevSubdomain, getZoneForRoute, getZoneIdFromHost, handleMissingSecretsError, handleUnsafeCapnp, hasDefinedEnvironments, hashFile, helpIfErrorIsSizeOrScriptStartup, isExportsReconciliationErrorDetails, isJwtExpired, isModifiedDiffValue, isNonDestructive, isUnsafeBindingType, isWorkerNotFoundError, listConsumers, listQueues, maybeRetrieveFileSourceMap, mergeDeep, moduleTypeMimeType, padToVisibleWidth, parseBulkInputToObject, parseConfigPlacement, patchNonVersionedScriptSettings, postConsumer, preview, previewDelete, previewSettingsGet, previewSettingsUpdate, printBindings, printBundleSize, printVersions, provisionBindings, publishCustomDomains, publishRoutes, putConsumer, putConsumerById, renderBindingDependsOnExportError, renderExportsReconciliationError, renderExportsReconciliationSuccess, renderInconsistentExportsAcrossVersionsError, renderRoute, resolveAssetOptions, resolveDoLifecyclePayload, resolveExportsUploadPayload, resolveWorkerName, sanitizeBranchName, shouldUseCIMetadataFallback, stripAnsi, syncAssets, tagsAreEqual, triggersDeploy, updateQueueConsumers, validateFileSecrets, validateNodeCompatMode, validateRoutes, verifyWorkerMatchesCITag, versionsUpload, visibleLength, warnOnErrorUpdatingServiceAndEnvironmentTags, warnOrError, workerNotFoundErrorMessage };