import { S as SharedDeployVersionsProps, D as DeployProps, W as WorkerBuildResult, V as VersionsUploadProps, T as TriggerProps, a as TriggerDeployment } from './context-2uDdhwGj.mjs'; export { b as DeployHelpersContext, i as initDeployHelpersContext } from './context-2uDdhwGj.mjs'; import * as _cloudflare_workers_utils from '@cloudflare/workers-utils'; import { ComplianceConfig, Config, AssetsOptions, LegacyAssetPaths, Route, ZoneIdRoute, ZoneNameRoute, CustomDomainRoute, CfPlacement, Binding as Binding$1, RawConfig, ConfigBindingFieldName, CfCapnp, CfScriptFormat, CfModule, ParseError, WorkerMetadataBinding, CfUserLimits, TailConsumer, StreamingTailConsumer, Observability, CfWorkerInit, ExportsReconciliationResult, ExportsReconciliationErrorDetail, StartDevWorkerInput, CfTailConsumer, ContainerApp, CacheOptions } from '@cloudflare/workers-utils'; import { ContainerNormalizedConfig, ImageURIConfig } from '@cloudflare/containers-shared'; import { FormData } from 'undici'; export { createWorkerUploadForm, fromMimeType, moduleTypeMimeType } from './create-worker-upload-form.mjs'; import { Options } from '@cspotcode/source-map-support'; import Protocol from 'devtools-protocol'; import { NodeJSCompatMode, WorkerRegistry } from 'miniflare'; type AssetManifest = { [path: string]: { hash: string; size: number; }; }; type AssetUploadStats = { assetUploadDurationMs: number; assetUploadIsBulk: boolean; assetUploadFileCount: number; assetUploadTotalBytes: number; }; type AssetsUploadResult = { jwt: string; assetUploadStats: AssetUploadStats; }; declare const syncAssets: (complianceConfig: ComplianceConfig, accountId: string | undefined, assetDirectory: string, scriptName: string, dispatchNamespace?: string) => Promise; declare function getEdgeKvUploadConcurrency(jwt: string): number; declare const buildAssetManifest: (dir: string) => Promise; declare function resolveAssetOptions({ assetsDir, main }: Pick, config: Config): AssetsOptions | undefined; /** * Wrangler-specific functions injected into `deploy()`. These remain in * wrangler because they depend on wrangler-only systems (account selection, * metrics, the dev-mode worker registry, container orchestration, etc.). */ type DeployCallbacks = { syncWorkersSite: ((complianceConfig: ComplianceConfig, accountId: string | undefined, scriptName: string, siteAssets: LegacyAssetPaths | undefined, preview: boolean, dryRun: boolean | undefined, oldAssetTTL: number | undefined) => Promise<{ manifest: { [filePath: string]: string; } | undefined; namespace: string | undefined; }>) | undefined; getNormalizedContainerOptions: ((config: Config, args: { containersRollout?: "gradual" | "immediate" | "none"; dryRun?: boolean; }) => Promise) | undefined; buildContainer: ((containerConfig: Exclude, imageTag: string, dryRun: boolean, pathToDocker: string, verifyDockerIsRunning: boolean) => Promise) | undefined; deployContainers: ((config: Config, normalisedContainerConfig: ContainerNormalizedConfig[], args: { versionId: string; accountId: string; scriptName: string; }) => Promise) | undefined; analyseBundle: ((workerBundle: string | FormData) => Promise>) | undefined; }; declare function deploy(props: DeployProps, config: Config, buildResult: WorkerBuildResult, callbacks: DeployCallbacks): Promise<{ sourceMapSize?: number; versionId: string | null; workerTag: string | null; assetUploadStats?: AssetUploadStats; targets?: string[]; }>; type VersionsUploadCallbacks = Pick; declare function versionsUpload(props: VersionsUploadProps, config: Config, buildResult: WorkerBuildResult, callbacks: VersionsUploadCallbacks): Promise<{ versionId: string | null; workerTag: string | null; assetUploadStats?: AssetUploadStats; versionPreviewUrl?: string | undefined; versionPreviewAliasUrl?: string | undefined; }>; declare function triggersDeploy(props: TriggerProps): Promise; declare function getSubdomainValues(config_workers_dev: boolean | undefined, config_preview_urls: boolean | undefined, routes: Route[]): { workers_dev: boolean; preview_urls?: boolean; }; declare function getSubdomainValuesAPIMock(config_workers_dev: boolean | undefined, config_preview_urls: boolean | undefined, routes: Route[]): { workers_dev: boolean; preview_urls: boolean; }; type WorkersDevSubdomainRegistrationContext = "workers_dev" | "workflows"; type GetWorkersDevSubdomainOptions = { configPath?: string | undefined; abortSignal?: AbortSignal | undefined; registrationContext?: WorkersDevSubdomainRegistrationContext | undefined; }; /** * Gets the .(fed.)workers.dev URL for the given account. */ declare function getWorkersDevSubdomain(complianceConfig: ComplianceConfig, accountId: string, options?: GetWorkersDevSubdomainOptions): Promise; interface Zone { id: string; host: string; } type ZoneIdCache = Map>; declare function getZoneForRoute(complianceConfig: ComplianceConfig, from: { route: Route; accountId: string; }, zoneIdCache?: ZoneIdCache): Promise; /** * Given something that resembles a host, try to infer a zone id from it. * * It's hard to get a 'valid' domain from a string, so we don't even try to validate TLDs, etc. * For each domain-like part of the host (e.g. w.x.y.z) try to get a zone id for it by * lopping off subdomains until we get a hit from the API. */ declare function getZoneIdFromHost(complianceConfig: ComplianceConfig, from: { host: string; accountId: string; }, zoneIdCache?: ZoneIdCache): Promise; type RouteObject = ZoneIdRoute | ZoneNameRoute | CustomDomainRoute; type CustomDomain = { id: string; zone_id: string; zone_name: string; hostname: string; service: string; environment: string; enabled: boolean; previews_enabled: boolean; }; type UpdatedCustomDomain = CustomDomain & { modified: boolean; }; type ConflictingCustomDomain = CustomDomain & { external_dns_record_id?: string | null; external_cert_id?: string; }; type CustomDomainChangeset = { added: CustomDomain[]; removed: CustomDomain[]; updated: UpdatedCustomDomain[]; conflicting: ConflictingCustomDomain[]; }; declare function renderRoute(route: Route): string; /** * Associate the newly deployed Worker with the given routes. */ declare function publishRoutes(complianceConfig: ComplianceConfig, routes: Route[], { workerUrl, scriptName, accountId, }: { workerUrl: string; scriptName: string; accountId: string; }): Promise; declare function publishCustomDomains(complianceConfig: ComplianceConfig, workerUrl: string, accountId: string, domains: Array): Promise; interface PostQueueBody { queue_name: string; settings?: QueueSettings; } interface QueueSettings { delivery_delay?: number; delivery_paused?: boolean; message_retention_period?: number; } interface PostQueueResponse { queue_id: string; queue_name: string; settings?: QueueSettings; created_on: string; modified_on: string; } interface QueueResponse { queue_id: string; queue_name: string; created_on: string; modified_on: string; producers: Producer[]; producers_total_count: number; consumers: Consumer[]; consumers_total_count: number; settings?: QueueSettings; } interface ScriptReference { namespace?: string; script?: string; service?: string; environment?: string; } type Producer = ScriptReference & { type: string; bucket_name?: string; }; type Consumer = ScriptReference & { dead_letter_queue?: string; settings: ConsumerSettings; consumer_id: string; bucket_name?: string; type: string; }; interface TypedConsumerResponse extends Consumer { queue_name: string; created_on: string; } interface PostTypedConsumerBody { type: string; script_name?: string; environment_name?: string; settings: ConsumerSettings; dead_letter_queue?: string; } interface ConsumerSettings { batch_size?: number; max_retries?: number; max_wait_time_ms?: number; max_concurrency?: number | null; visibility_timeout_ms?: number; retry_delay?: number; } interface PurgeQueueBody { delete_messages_permanently: boolean; } interface PurgeQueueResponse { started_at: string; complete: boolean; } declare function listQueues(complianceConfig: ComplianceConfig, accountId: string, page?: number, name?: string): Promise; declare function getQueue(complianceConfig: ComplianceConfig, accountId: string, queueName: string): Promise; declare function postConsumer(complianceConfig: ComplianceConfig, accountId: string, queueName: string, body: PostTypedConsumerBody): Promise; declare function putConsumerById(complianceConfig: ComplianceConfig, accountId: string, queueId: string, consumerId: string, body: PostTypedConsumerBody): Promise; declare function putConsumer(complianceConfig: ComplianceConfig, accountId: string, queueName: string, scriptName: string, envName: string | undefined, body: PostTypedConsumerBody): Promise; declare function deletePullConsumer(complianceConfig: ComplianceConfig, accountId: string, queueName: string): Promise; declare function listConsumers(complianceConfig: ComplianceConfig, accountId: string, queueName: string): Promise; declare function deleteWorkerConsumer(complianceConfig: ComplianceConfig, accountId: string, queueName: string, scriptName: string, envName: string | undefined): Promise; declare function updateQueueConsumers(complianceConfig: ComplianceConfig, accountId: string, scriptName: string, config: Config): Promise[]>; declare function ensureQueuesExistByConfig(config: Config, accountId: string, includeProducers?: boolean, scriptName?: string): Promise; /** * Parse placement out of a Config */ declare function parseConfigPlacement(config: Config): CfPlacement | undefined; /** This is the error code from the Cloudflare API signaling that a worker could not be found on the target account */ declare const WORKER_NOT_FOUND_ERR_CODE: 10007; /** This is the error code from the Cloudflare API signaling that a worker environment (legacy) could not be found on the target account */ declare const WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE: 10090; /** This is the error message from the Cloudflare API signaling that a worker could not be found on the target account */ declare const workerNotFoundErrorMessage = "This Worker does not exist on your account."; /** * Given an error from the Cloudflare API discerns whether it is caused by a worker that could not be found on the target account * * @param error The error object * @returns true if the object represents an error from the Cloudflare API caused by a not found worker, false otherwise */ declare function isWorkerNotFoundError(error: unknown): boolean; /** * Cloudflare API error codes used by deploy-helpers. */ /** The inherit binding references a binding that does not exist on the previous version. */ declare const INVALID_INHERIT_BINDING_CODE: 10057; /** * Blocking-error code for declarative DO exports reconciliation failures. * Used to distinguish the reconciliation error envelope from other 4xx upload * errors so we can render the structured per-class details. */ declare const EXPORTS_RECONCILIATION_ERROR_CODE = 100402; /** * Blocking-error code returned by EWC when a multi-version (percentage-split) * deployment contains versions with divergent declarative DO `exports`. All * versions in a percentage-split deploy must agree on the end-state, otherwise * traffic on one branch could route to code referencing unprovisioned (or * just-deleted) DO namespaces. Single-version (100%) deploys are unaffected. * Resolution: deploy the version that changes `exports` at 100% first, then * run the percentage-split deploy. */ declare const INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE = 100405; /** * Blocking-error code returned by EWC when a `wrangler versions upload` payload * contains an actor binding (`durable_objects.bindings`) that references a * Durable Object class declared in `exports` but not yet provisioned. * Declarative `exports` reconcile when the version is *deployed*, so the * namespace must exist before a binding can reference it. This is the * exports-aware sibling of `ErrActorBindingDependsOnMigration` (10123) that * already exists for the legacy `migrations` flow. * Resolution: stage the new class via `ctx.exports.` (no binding) * on `versions upload` and add the binding at deploy time, or use * `wrangler deploy` to provision and bind in one step. */ declare const ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE = 100406; /** Workflows API code for `workflow.cron_requires_paid_plan`. */ declare const WORKFLOW_CRON_REQUIRES_PAID_PLAN_CODE = 10208; type SecretsValidationOptions = { type: "deploy"; workerExists: boolean; } | { type: "upload"; }; /** * When `secrets.required` is defined in config, validate the secrets exist on the Worker. * For deploy, if the Worker doesn't exist yet, fail immediately. * For upload, always add inherit bindings — the API handles the case where * the Worker doesn't exist (versions upload cannot create new Workers). * Secrets already provided (e.g. via --secrets-file) are excluded since * they are part of the upload and don't need to be inherited. */ declare function addRequiredSecretsInheritBindings(config: Config, bindings: Record, options: SecretsValidationOptions): void; /** * Reformats API errors for strict inherit binding validation failures into * user-friendly messages listing the missing required secrets. * The API returns all missing inherit bindings at once, each as a separate * error in response.errors, which maps to individual err.notes entries. */ declare function handleMissingSecretsError(err: unknown, config: Config, options: SecretsValidationOptions): void; type JsonLike = string | number | boolean | null | JsonLike[] | undefined | { [id: string]: JsonLike; }; /** * Given two objects A and B that are Json serializable this function computes the difference between them * * The difference object includes: * - fields in object B but not in object A included as `` * - fields in object A but not in object B included as `` * - fields present in both objects but modified as `: { __old: , __new: }` * * Additionally the difference object contains a `toString` method that can be used to generate a string representation * of the difference between the two objects (to be presented to users) * * @param jsonObjA The first target object * @param jsonObjB The second target object * @returns An object representing the diff between the two objects, or null if the objects are equal */ declare function diffJsonObjects(jsonObjA: Record, jsonObjB: Record): Record | null; /** * Given a diff object (generated by `diffJsonObjects`) this function computes whether the * difference is non-destructive, i.e. if the second object only contained additions to the * first one and no removal nor modifications. * * @param diff The difference object to use (generated by `diffJsonObjects`) * @returns `true` if the difference is non-destructive, `false` if it is */ declare function isNonDestructive(diff: JsonLike): boolean; /** * A modified value in json-diff is represented as an object with two properties: * `__old` and `__new`. Where the former contains the old version of the value and * the latter the new one. * This utility, given an arbitrary value, discerns whether the value represents the * diff of a modified value. * * @param value The target value to check * @returns True if the value represents a value modified, false otherwise */ declare function isModifiedDiffValue(value: unknown): value is { __old: T; __new: T; }; /** * Object representing the difference of two configuration objects. */ type ConfigDiff = { /** The actual (raw) computed diff of the two objects */ diff: Record | null; /** * Flag indicating whether the difference includes some destructive changes. * * In other words, if the second config is not applying any change or only adding options, such diff is considered non destructive, on the other hand if the config is removing or modifying values it is considered destructive instead. */ nonDestructive: boolean; }; /** * Computes the difference between a remote representation of a Worker's config and a local configuration. * * @param remoteConfig The remote representation of a Worker's config * @param localResolvedConfig The local (resolved) config * @returns Object containing the diffing information */ declare function getRemoteConfigDiff(remoteConfig: RawConfig, localResolvedConfig: Config): ConfigDiff; /** * Given a config diff generates a patch object that can be passed to `experimental_patchConfig` to revert the * changes in the config object that are described by the config diff. * * If the config is for a specific target environment, only the environment config object will be targeted for the patch. * * @param configDiff The target config diff * @param targetEnvironment the target environment if any * @returns The patch object to pass to `experimental_patchConfig` to revert the changes */ declare function getConfigPatch(configDiff: { diff: Record | null; nonDestructive: boolean; }["diff"], targetEnvironment?: string | undefined): RawConfig; declare function validateFileSecrets(content: unknown, jsonFilePath: string): content is Record; /** Error thrown when no input is provided to parseBulkInputToObject */ declare class NoInputError extends Error { constructor(); } /** Result from parsing bulk secret input without nullable values, including metadata for analytics */ type BulkInputResult = { content: Record; secretSource: "file" | "stdin"; secretFormat: "json" | "dotenv"; }; /** Result from parsing bulk secret input with nullable values, including metadata for analytics */ type BulkInputNullableResult = { content: Record; secretSource: "file" | "stdin"; secretFormat: "json" | "dotenv"; }; /** Override for callers that need non-nullable */ declare function parseBulkInputToObject(input?: string, includeNull?: false): Promise; /** Override for callers that need nullable */ declare function parseBulkInputToObject(input?: string, includeNull?: true): Promise; interface ConvertBindingsOptions { /** * Use preview IDs (preview_id, preview_bucket_name, preview_database_id) instead of production IDs when resolving a binding ID. * This means that the rest of Wrangler does not need to be aware of preview IDs, and can just use regular IDs. */ usePreviewIds?: boolean; /** * Exclude bindings that Pages doesn't support */ pages?: boolean; } /** * Convert Config to the Record format for consistent internal use. */ declare function convertConfigToBindings(config: Partial>, options?: ConvertBindingsOptions): Record; declare function isUnsafeBindingType(type: string): type is `unsafe_${string}`; /** * What configuration key does this binding use for referring to it's binding name? */ declare const nameBindings: readonly ["durable_object_namespace", "logfwdr", "ratelimit", "unsafe_ratelimit", "send_email"]; type FlatBinding = Extract & (Type extends (typeof nameBindings)[number] ? { name: string; } : { binding: string; }); declare function extractBindingsOfType(type: Type, bindings: Record | undefined): FlatBinding[]; /** * Get bindings from a Config object in the standard Record format. */ declare function getBindings(config: Config | undefined, options?: { pages?: boolean; }): Record; declare function handleUnsafeCapnp(capnp: CfCapnp): Buffer; /** * Inject bindings into the Worker to support Workers Sites. These are injected at the last minute so that * they don't display in the output of `printBindings()` */ declare function addWorkersSitesBindings(bindings: Record, namespace: string | undefined, manifest: { [filePath: string]: string; } | undefined, format: CfScriptFormat): { [x: string]: Binding$1; }; declare function deployWfpUserWorker(dispatchNamespace: string, versionId: string | null): void; declare function getDeployConfirmFunction(options: { strictMode?: boolean; }): (text: string) => Promise; /** * Sanitizes a branch name to create a valid DNS label alias. * Converts to lowercase, replaces invalid chars with dashes, removes consecutive dashes. */ declare function sanitizeBranchName(branchName: string): string; /** * Creates a truncated alias with hash suffix when the branch name is too long. * Hash from original branch name to preserve uniqueness. */ declare function createTruncatedAlias(branchName: string, sanitizedAlias: string, availableSpace: number): string | undefined; /** * Generates a preview alias based on the current git branch. * Alias must be <= 63 characters, alphanumeric + dashes only, and start with a letter. * Returns undefined if not in a git directory or requirements cannot be met. */ declare function generatePreviewAlias(scriptName: string): string | undefined; type RetrieveSourceMapFunction = NonNullable; declare function maybeRetrieveFileSourceMap(filePath?: string): ReturnType; declare function getSourceMappedStack(details: Protocol.Runtime.ExceptionDetails): string; declare function getSourceMappedString(value: string, retrieveSourceMap?: RetrieveSourceMapFunction): string; declare function printBundleSize(main: { name: string; content: string; }, modules: CfModule[]): Promise; /** * Computes and validates the Node.js compatibility mode we are running. * * NOTES: * - The v2 mode is configured via `nodejs_compat_v2` compat flag or via `nodejs_compat` plus a compatibility date of Sept 23rd. 2024 or later. * - See `EnvironmentInheritable` for `noBundle`. * * @param compatibilityDateStr The compatibility date * @param compatibilityFlags The compatibility flags * @param noBundle Whether to skip internal build steps and directly deploy script * */ declare function validateNodeCompatMode(compatibilityDateStr: string | undefined, // Default to some arbitrary old date compatibilityFlags: string[], { noBundle, }: { noBundle?: boolean; }): NodeJSCompatMode; declare const validateRoutes: (routes: Route[], assets: AssetsOptions | undefined) => void; declare function hasDefinedEnvironments(config: Config): boolean; declare function applyServiceAndEnvironmentTags(config: Config, tags: string[]): string[]; declare function warnOnErrorUpdatingServiceAndEnvironmentTags(): void; declare function tagsAreEqual(a: string[], b: string[]): boolean; declare function helpIfErrorIsSizeOrScriptStartup(err: unknown, dependencies: { [path: string]: { bytesInOutput: number; }; }, workerBundle: FormData | string, projectRoot: string | undefined, analyseBundle?: (bundle: FormData | string) => Promise): Promise; /** * Returns a formatted error message that describes the script size error. * It includes the largest dependencies if available. */ declare function diagnoseScriptSizeError(err: ParseError, dependencies: { [path: string]: { bytesInOutput: number; }; }): string; /** * Returns a formatted error message that describes the startup error. * If profiling is successful, it will include a link to the generated CPU profile. */ declare function diagnoseStartupError(err: ParseError, workerBundle: FormData | string, projectRoot: string | undefined, analyseBundle?: (bundle: FormData | string) => Promise): Promise; type Percentage = number; type UUID = string; type VersionId = UUID; type ApiDeployment = { id: string; source: "api" | string; strategy: "percentage" | string; author_email: string; annotations?: Record; created_on: string; versions: Array<{ version_id: VersionId; percentage: Percentage; }>; }; type ApiVersion = { id: VersionId; number: number; metadata: { created_on: string; modified_on: string; source: "api" | string; author_id: string; author_email: string; }; annotations?: { "workers/triggered_by"?: "upload" | string; "workers/message"?: string; "workers/tag"?: string; }; resources: { bindings: WorkerMetadataBinding[]; script: { etag: string; handlers: string[] | null; placement_mode?: "smart"; last_deployed_from: string; }; script_runtime: { compatibility_date?: string; compatibility_flags?: string[]; usage_model: "bundled" | "unbound" | "standard"; limits: CfUserLimits; }; }; startup_time_ms?: number; }; type VersionCache = Map; declare function fetchVersion(complianceConfig: ComplianceConfig, accountId: string, workerName: string, versionId: VersionId, versionCache: VersionCache | undefined): Promise; declare function fetchVersions(complianceConfig: ComplianceConfig, accountId: string, workerName: string, versionCache: VersionCache | undefined, versionIds: VersionId[]): Promise; declare function fetchLatestDeployments(complianceConfig: ComplianceConfig, accountId: string, workerName: string): Promise; declare function fetchLatestDeployment(complianceConfig: ComplianceConfig, accountId: string, workerName: string): Promise; declare function fetchDeploymentVersions(complianceConfig: ComplianceConfig, accountId: string, workerName: string, deployment: ApiDeployment | undefined, versionCache: VersionCache): Promise<[ApiVersion[], Map]>; declare function fetchDeployableVersions(complianceConfig: ComplianceConfig, accountId: string, workerName: string, versionCache: VersionCache): Promise; declare function createDeployment(complianceConfig: ComplianceConfig, accountId: string, workerName: string, versionTraffic: Map, message: string | undefined, force: boolean | undefined): Promise<{ id: string; }>; type NonVersionedScriptSettings = { logpush: boolean; tags: string[] | null; tail_consumers: TailConsumer[]; streaming_tail_consumers: StreamingTailConsumer[]; observability: Observability; }; declare function patchNonVersionedScriptSettings(complianceConfig: ComplianceConfig, accountId: string, workerName: string, settings: Partial): Promise>; type Workflow = { name: string; id: string; created_on: string; modified_on: string; script_name: string; class_name: string; }; interface WorkflowConflict { name: string; currentOwner: string; } declare const WORKFLOW_NOT_FOUND_CODE = 10200; declare function checkWorkflowConflicts(config: Config, accountId: string, scriptName: string): Promise<{ hasConflicts: false; } | { hasConflicts: true; conflicts: WorkflowConflict[]; message: string; }>; type CustomDomainsRes = { id: string; zone_id: string; zone_name: string; hostname: string; service: string; environment: string; cert_id: string; enabled: boolean; previews_enabled: boolean; }[]; type WorkerSubdomainRes = { enabled: boolean; previews_enabled: boolean; }; type CronTriggersRes = { schedules: { cron: string; created_on: Date; modified_on: Date; }[]; }; type RoutesRes = { id: string; pattern: string; zone_name: string; script: string; }[]; /** * Downloads all information required to construct a Wrangler config file for a Worker from the API */ declare function fetchWorkerConfig(accountId: string, workerName: string, environment: string): Promise<{ bindings: _cloudflare_workers_utils.WorkerMetadataBinding[]; routes: RoutesRes; customDomains: CustomDomainsRes; subdomainStatus: WorkerSubdomainRes; serviceEnvMetadata: { environment: string; created_on: string; modified_on: string; script: { id: string; tag: string; tags: string[]; etag: string; handlers: string[]; modified_on: string; created_on: string; migration_tag: string; usage_model: "bundled" | "unbound"; limits: { cpu_ms: number; subrequests: number; }; compatibility_date: string; compatibility_flags: string[]; last_deployed_from?: "wrangler" | "dash" | "api"; placement_mode?: "smart"; tail_consumers?: _cloudflare_workers_utils.TailConsumer[]; observability?: _cloudflare_workers_utils.Observability; }; }; cronTriggers: CronTriggersRes; }>; /** * Downloads all the remote information we can gather for a worker and from them generates a raw configuration object that * approximates what a wrangler config object for the worker was/would have been. */ declare function downloadWorkerConfig(workerName: string, environment: string, entrypoint: string, accountId: string): Promise; /** * For a given Worker + migrations config, figure out which migrations * to upload based on the current migration tag of the deployed Worker. */ declare function getMigrationsToUpload(scriptName: string, props: { accountId: string | undefined; config: Config; dispatchNamespace: string | undefined; }): Promise; /** * Resolve which Durable Object lifecycle payload to send with the upload. */ declare function resolveDoLifecyclePayload(props: { scriptName: string; isDryRun: boolean | undefined; accountId: string | undefined; config: Config; dispatchNamespace: string | undefined; }): Promise<{ migrations: CfWorkerInit["migrations"]; exports: CfWorkerInit["exports"]; }>; type ResolveExportsUploadPayloadProps = Parameters[0]; declare function resolveExportsUploadPayload(props: ResolveExportsUploadPayloadProps): Promise<{ migrations: CfWorkerInit["migrations"]; exports: CfWorkerInit["exports"]; }>; /** * Render the success-side `exports_reconciliation` envelope to the logger. * Emits nothing when the result has no entries to report (so a re-deploy * with no DO changes doesn't add noise to the deploy output). * * Warnings are rendered prominently; info and removable-entry hints are lower * visibility. */ declare function renderExportsReconciliationSuccess(result: ExportsReconciliationResult): void; /** * Format the structured reconciliation error details from the upload error * envelope's `meta.details` field. Returns a multi-line string suitable for * inclusion in a `UserError`'s message or notes. Each per-class entry is * rendered with a red ✘ prefix, the scenario tag, the message, and any * optional suggestion / referencing-scripts metadata. */ declare function renderExportsReconciliationError(details: ExportsReconciliationErrorDetail[]): string; /** * Type guard for `meta.details` extracted from an `APIError`'s `meta` field. * Validate the array shape so the renderer can rely on the typed fields. */ declare function isExportsReconciliationErrorDetails(value: unknown): value is ExportsReconciliationErrorDetail[]; /** * Build the user-facing error message for EWC code 100405 * (inconsistent declarative DO `exports` across versions in a * percentage-split deployment). * * The server's own message is already actionable; we augment it with a * concrete next-step that points back at `wrangler versions deploy` and a * link to the gradual-deployments docs. */ declare function renderInconsistentExportsAcrossVersionsError(serverMessage: string): string; /** * Build the user-facing error message for EWC code 100406 * (an actor binding references a Durable Object class declared in `exports` * but not yet provisioned, on `wrangler versions upload`). * * EWC's own message is already fully actionable — it names the offending * binding and class and spells out both remediations (deploy to provision, or * drop the binding and use `ctx.exports.`). We surface it verbatim * rather than re-deriving a less specific message client-side. The fallback is * only used in the unlikely event the server sends an empty message. */ declare function renderBindingDependsOnExportError(serverMessage: string): string; declare function verifyWorkerMatchesCITag(complianceConfig: ComplianceConfig, accountId: string, workerName: string, configPath: string | undefined): Promise; declare function fetchSecrets(config: Config, scriptName: string, accountId: string): Promise<{ name: string; type: string; }[]>; declare function checkRemoteSecretsOverride(config: Config, scriptName: string, accountId: string): Promise<{ override: false; } | { override: true; deployErrorMessage: string; }>; declare function confirmLatestDeploymentOverwrite(config: Config, accountId: string, scriptName: string): Promise; declare function printVersions(versions: ApiVersion[], traffic: Map): void; type PrintContext = { log?: (message: string) => void; registry?: WorkerRegistry | null; local?: boolean; isMultiWorker?: boolean; remoteBindingsDisabled?: boolean; name?: string; provisioning?: boolean; warnIfNoBindings?: boolean; unsafeMetadata?: Record; }; /** * Print all the bindings a worker would have access to. * Accepts StartDevWorkerInput["bindings"] format */ declare function printBindings(bindings: StartDevWorkerInput["bindings"], tailConsumers?: CfTailConsumer[], streamingTailConsumers?: CfTailConsumer[], containers?: ContainerApp[], context?: PrintContext): void; /** * Validates the user's `remote` setting for a given binding against the * binding type's local-development capabilities (sourced from * {@link getBindingLocalSupport}). Throws `UserError` for invalid combinations * and emits warnings for valid-but-noteworthy ones. */ declare function warnOrError(type: Binding$1["type"], remote: boolean | undefined): void; declare const hashFile: (filepath: string) => string; declare const decodeJwtPayload: (token: string) => any; declare const isJwtExpired: (token: string) => boolean | undefined; /** * A single npm package dependency entry, matching the upload API schema * see: https://developers.cloudflare.com/api/resources/workers/subresources/scripts/methods/update. */ type PackageDependency = { /** The npm package name, e.g. "lodash" or "@cloudflare/workers-types". */ name: string; /** The version constraint as written in package.json, e.g. "^4.17.21". */ packageJsonVersion: string; /** The exact version resolved and installed by the package manager, e.g. "4.17.22". */ installedVersion: string; }; /** * Collects npm package dependency metadata from the project's package.json. * * Reads both `dependencies` and `devDependencies`, resolves each package's * installed version from node_modules, and filters out: * - Workspace packages (version prefixed with `workspace:`) * - Pnpm catalog packages (version prefixed with `catalog:`) * - Local packages (version prefixed with `file:` or `link:`) * - Packages whose installed version cannot be resolved * - Packages matching any pattern in `excludePackages` * * The result is capped at {@link MAX_PACKAGE_DEPENDENCIES} entries. * * @param projectPath - Path to the project directory (where package.json is located) * @param excludePackages - Optional list of package name patterns (glob-style with * `*` wildcards) to exclude from the collected dependencies * @returns An array of package dependency entries, or `undefined` if package.json * cannot be read or no valid dependencies are found */ declare function collectPackageDependencies(projectPath: string, excludePackages?: string[]): Promise; type Settings = { bindings: Array; }; declare function provisionBindings(bindings: StartDevWorkerInput["bindings"], accountId: string, scriptName: string, autoCreate: boolean, config: Config, options: { skipConfigWriteback?: boolean; }): Promise; declare function getSettings(complianceConfig: ComplianceConfig, accountId: string, scriptName: string): Promise; interface Binding { type: string; text?: string; json?: unknown; namespace_id?: string; workflow_name?: string; destination_address?: string; allowed_destination_addresses?: string[]; allowed_sender_addresses?: string[]; queue_name?: string; delivery_delay?: number; database_id?: string; database_name?: string; bucket_name?: string; index_name?: string; id?: string; service?: string; dataset?: string; namespace?: string; outbound?: { worker: { service: string; environment?: string; }; params?: Array<{ name: string; }>; }; certificate_id?: string; pipeline?: string; stream?: string; store_id?: string; secret_name?: string; simple?: { limit: number; period: 10 | 60; }; service_id?: string; staging?: boolean; enable_timer?: boolean; app_id?: string; entrypoint?: string; class_name?: string; script_name?: string; } type EnvBindings = Record; interface PreviewResource { id: string; name: string; slug: string; urls?: string[]; worker_name: string; tags?: string[]; observability?: Observability; logpush?: boolean; tail_consumers?: Array<{ name: string; }>; created_on: string; updated_on: string; } interface DeploymentResource { id: string; preview_id: string; preview_name: string; migration_tag?: string; urls?: string[]; compatibility_date?: string; compatibility_flags?: string[]; limits?: CfUserLimits; placement?: CfPlacement; cache?: CacheOptions; env?: EnvBindings; created_on: string; } type CreatePreviewDeploymentRequestParams = { main_module?: string; modules?: Array<{ name: string; content_type: string; content_base64: string; }>; assets?: { jwt: string; config: { html_handling?: string; not_found_handling?: string; run_worker_first?: string[] | boolean; }; }; compatibility_date?: string; compatibility_flags?: string[]; annotations?: { "workers/message"?: string; "workers/tag"?: string; }; migrations?: CfWorkerInit["migrations"]; limits?: CfUserLimits; placement?: CfPlacement; cache?: CacheOptions; env?: EnvBindings; }; type CreatePreviewRequestParams = { name: string; observability?: Observability; logpush?: boolean; tail_consumers?: Array<{ name: string; }>; }; type UpdatePreviewRequestParams = Omit; type PreviewRequestOptions = { ignoreDefaults?: boolean; }; type PreviewDefaults = { observability?: Observability; logpush?: boolean; limits?: CfUserLimits; placement?: CfPlacement; cache?: CacheOptions; tail_consumers?: Array<{ name: string; }>; env?: EnvBindings; }; type PreviewDefaultsPatch = Partial> & { env?: Record; }; declare function getPreview(config: Config, accountId: string, workerName: string, previewIdentifier: string): Promise; declare function createPreview(config: Config, accountId: string, workerName: string, request: CreatePreviewRequestParams, options?: PreviewRequestOptions): Promise; declare function editPreview(config: Config, accountId: string, workerName: string, previewIdentifier: string, request: UpdatePreviewRequestParams, options?: PreviewRequestOptions): Promise; declare function deletePreview(config: Config, accountId: string, workerName: string, previewIdentifier: string): Promise; declare function getPreviewDeployment(config: Config, accountId: string, workerName: string, previewIdentifier: string, deploymentIdentifier: string): Promise; declare function createPreviewDeployment(config: Config, accountId: string, workerName: string, previewIdentifier: string, request: Partial, options?: PreviewRequestOptions): Promise; declare function getWorkerPreviewDefaults(config: Config, accountId: string, workerName: string): Promise; declare function editWorkerPreviewDefaults(config: Config, accountId: string, workerName: string, previewDefaults: PreviewDefaultsPatch): Promise; declare function getBranchName(): string | undefined; declare function shouldUseCIMetadataFallback(): boolean; declare function getHeadCommitRef(): string | undefined; declare function getHeadCommitMessage(): string | undefined; declare function resolveWorkerName(args: { workerName?: string; "worker-name"?: string; }, config: Config): string; /** * Get a human-readable display value for a binding. * Used by both preview deployment and Previews settings formatting. */ declare function getBindingValue(binding: Binding): string; declare function extractConfigBindings(config: Config): EnvBindings; declare function assemblePreviewScriptSettings(config: Config): Record; declare function assemblePreviewDefaults(config: Config): PreviewDefaults; type PreviewArgs = { script?: string; name?: string; tag?: string; message?: string; json?: boolean; ignoreDefaults: boolean; workerName?: string; "worker-name"?: string; }; type PreviewAssetsOptions = { directory: string; assetConfig: { html_handling?: string; not_found_handling?: string; }; run_worker_first?: string[] | boolean; _headers?: string; _redirects?: string; }; type PreviewDeleteArgs = { name?: string; skipConfirmation?: boolean; workerName?: string; "worker-name"?: string; }; type PreviewResult = { preview: PreviewResource; deployment: DeploymentResource; isNewPreview: boolean; }; /** * Full preview create/update + deployment orchestration. * The wrangler handler calls this after auth + build. */ declare function preview(accountId: string, args: PreviewArgs, config: Config, buildResult: WorkerBuildResult, assetsOptions: PreviewAssetsOptions | undefined): Promise; /** * Delete a preview and all its deployments. */ declare function previewDelete(accountId: string, args: PreviewDeleteArgs, config: Config): Promise; type MergedBinding = Binding & { fromConfig: boolean; }; declare function formatAlignedRows(rows: Array<[string, string, boolean]>, indent?: string): string[]; declare function formatBindings(env: Record, indent?: string, options?: { showSourceMarker?: boolean; }): string[]; declare function formatPreviewsSettings(workerName: string, previewDefaults: PreviewDefaults): string; /** * Deep merge two objects. Source overwrites target. * Arrays are treated as terminal values and replaced wholesale. */ declare function mergeDeep(target: T, source: Partial): T; type PreviewSettingsArgs = { json?: boolean; workerName?: string; "worker-name"?: string; }; type PreviewSettingsUpdateArgs = { skipConfirmation?: boolean; workerName?: string; "worker-name"?: string; }; /** * Fetch and display the current Previews settings for a Worker. */ declare function previewSettingsGet(accountId: string, args: PreviewSettingsArgs, config: Config): Promise; /** * Merge local config with remote Previews settings, diff, confirm, and apply. */ declare function previewSettingsUpdate(accountId: string, args: PreviewSettingsUpdateArgs, config: Config): Promise; /** * Remove ANSI escape codes from a string. */ declare function stripAnsi(str: string): string; /** * Return the display width of a string by ignoring ANSI escape codes. */ declare function visibleLength(str: string): number; /** * Pad a string with trailing spaces to match the target visible width. * ANSI escape codes in `str` are ignored when computing width. */ declare function padToVisibleWidth(str: string, width: number): string; type DrawBoxOptions = { footerLines?: string[]; connectToChild?: boolean; }; /** * Draw a standalone box around the provided lines. * * Options: * - `footerLines`: additional lines appended at the bottom of the content area * - `connectToChild`: render a bottom connector for visual linkage to a child box */ declare function drawBox(contentLines: string[], options?: DrawBoxOptions): string; type DrawConnectedChildBoxOptions = { indent?: string; footerLines?: string[]; connectorLineIndex?: number; }; /** * Draw a child box that visually connects to an upstream parent box. * * Options: * - `indent`: left indentation before the connector and box (default: two spaces) * - `footerLines`: additional lines appended at the bottom of the content area * - `connectorLineIndex`: line index where the horizontal connector joins the box */ declare function drawConnectedChildBox(contentLines: string[], options?: DrawConnectedChildBoxOptions): string; 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, 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, 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, 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 };