@cloudflare/deploy-helpers 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-NAAB7FBS.mjs +55 -0
- package/dist/context-CUxVlvJf.d.mts +179 -0
- package/dist/context.d.mts +2 -0
- package/dist/context.mjs +1 -0
- package/dist/index.d.mts +612 -148
- package/dist/index.mjs +8430 -2314
- package/dist/metafile-esm.json +1 -1
- package/package.json +24 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,139 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
fetchListResult: FetchListResultFetcher;
|
|
12
|
-
logger: Logger;
|
|
13
|
-
confirm: (text: string, options?: {
|
|
14
|
-
defaultValue?: boolean;
|
|
15
|
-
fallbackValue?: boolean;
|
|
16
|
-
}) => Promise<boolean>;
|
|
17
|
-
prompt: (text: string, options?: {
|
|
18
|
-
defaultValue?: string;
|
|
19
|
-
}) => Promise<string>;
|
|
20
|
-
isNonInteractiveOrCI: () => boolean;
|
|
21
|
-
};
|
|
1
|
+
import { D as DeployProps, W as WorkerBuildResult, V as VersionsUploadProps, T as TriggerProps, a as TriggerDeployment } from './context-CUxVlvJf.mjs';
|
|
2
|
+
export { B as BuildBundleInfo, b as DeployHelpersContext, S as SharedDeployVersionsProps, i as initDeployHelpersContext } from './context-CUxVlvJf.mjs';
|
|
3
|
+
import { ContainerNormalizedConfig, ImageURIConfig } from '@cloudflare/containers-shared';
|
|
4
|
+
import * as _cloudflare_workers_utils from '@cloudflare/workers-utils';
|
|
5
|
+
import { Config, ComplianceConfig, LegacyAssetPaths, Binding, Route, ZoneIdRoute, ZoneNameRoute, CustomDomainRoute, CfPlacement, CfModule, CfWorkerSourceMap, RawConfig, ConfigBindingFieldName, CfCapnp, CfModuleType, CfWorkerInit, CfScriptFormat, AssetsOptions, ParseError, WorkerMetadataBinding, CfUserLimits, TailConsumer, StreamingTailConsumer, Observability, StartDevWorkerInput, CfTailConsumer, ContainerApp } from '@cloudflare/workers-utils';
|
|
6
|
+
import { FormData } from 'undici';
|
|
7
|
+
import { Options } from '@cspotcode/source-map-support';
|
|
8
|
+
import Protocol from 'devtools-protocol';
|
|
9
|
+
import { NodeJSCompatMode, WorkerRegistry } from 'miniflare';
|
|
10
|
+
|
|
22
11
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* Use props for all resolved/merged values. Only access config directly
|
|
27
|
-
* for raw values that aren't merged with CLI args (e.g., config.durable_objects,
|
|
28
|
-
* config.unsafe, config.tail_consumers).
|
|
12
|
+
* Wrangler-specific functions injected into `deploy()`. These remain in
|
|
13
|
+
* wrangler because they depend on wrangler-only systems (account selection,
|
|
14
|
+
* metrics, the dev-mode worker registry, container orchestration, etc.).
|
|
29
15
|
*/
|
|
30
|
-
type
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/** Merged: --jsx-fragment arg || config.jsx_fragment. */
|
|
50
|
-
jsxFragment: string;
|
|
51
|
-
/** Merged: --tsconfig arg ?? config.tsconfig. */
|
|
52
|
-
tsconfig: string | undefined;
|
|
53
|
-
/** Merged: --minify arg ?? config.minify. */
|
|
54
|
-
minify: boolean | undefined;
|
|
55
|
-
/** Merged: !(--bundle arg ?? !config.no_bundle). */
|
|
56
|
-
noBundle: boolean;
|
|
57
|
-
/** Merged: --upload-source-maps arg ?? config.upload_source_maps. */
|
|
58
|
-
uploadSourceMaps: boolean | undefined;
|
|
59
|
-
/** Merged: --keep-vars arg || config.keep_vars. */
|
|
60
|
-
keepVars: boolean;
|
|
61
|
-
/** Merged from --site arg and config.site. */
|
|
62
|
-
isWorkersSite: boolean;
|
|
63
|
-
/** Merged: { ...config.define, ...--define arg }. CLI overrides config. */
|
|
64
|
-
defines: Record<string, string>;
|
|
65
|
-
/** Merged: { ...config.alias, ...--alias arg }. CLI overrides config. */
|
|
66
|
-
alias: Record<string, string>;
|
|
67
|
-
/**
|
|
68
|
-
* Whether to use the deprecated service environments API path.
|
|
69
|
-
* True only when config opts in (legacy_env: false) AND --env is specified.
|
|
70
|
-
*/
|
|
71
|
-
useServiceEnvApiPath: boolean;
|
|
72
|
-
placement: CfPlacement | undefined;
|
|
73
|
-
/** Output directory for the bundled Worker. From --outdir arg or a temp directory. */
|
|
74
|
-
destination: string | EphemeralDirectory;
|
|
75
|
-
/** From --dry-run arg. */
|
|
76
|
-
dryRun: boolean;
|
|
77
|
-
/** From --env arg. */
|
|
78
|
-
env: string | undefined;
|
|
79
|
-
/** From --outdir arg. Already used to derive `destination`, but also needed for outdir README and noBundleWorker. */
|
|
80
|
-
outdir: string | undefined;
|
|
81
|
-
/** From --outfile arg. */
|
|
82
|
-
outfile: string | undefined;
|
|
83
|
-
/** From --tag arg. */
|
|
84
|
-
tag: string | undefined;
|
|
85
|
-
/** From --message arg. */
|
|
86
|
-
message: string | undefined;
|
|
87
|
-
/** From --secrets-file arg. */
|
|
88
|
-
secretsFile: string | undefined;
|
|
89
|
-
/** From collectKeyValues(--var arg). Pre-resolved key-value pairs. */
|
|
90
|
-
var: Record<string, string>;
|
|
91
|
-
/** From --experimental-auto-create arg. */
|
|
92
|
-
experimentalAutoCreate: boolean;
|
|
93
|
-
};
|
|
94
|
-
type DeployProps = SharedDeployVersionsProps & {
|
|
95
|
-
/** Discriminant for DeployProps vs VersionsUploadProps */
|
|
96
|
-
command: "deploy";
|
|
97
|
-
/** Merged from --site arg and config.site. */
|
|
98
|
-
legacyAssetPaths: LegacyAssetPaths | undefined;
|
|
99
|
-
/** Merged: --triggers arg ?? config.triggers.crons. */
|
|
100
|
-
triggers: string[] | undefined;
|
|
101
|
-
/** Merged: --routes arg ?? config.routes ?? config.route. AND --domains and custom_domains*/
|
|
102
|
-
routes: Route[];
|
|
103
|
-
/** Merged: --logpush arg ?? config.logpush. */
|
|
104
|
-
logpush: boolean | undefined;
|
|
105
|
-
containers: ContainerNormalizedConfig[];
|
|
106
|
-
/** From --dispatch-namespace arg. Deploy-only (Workers for Platforms). */
|
|
107
|
-
dispatchNamespace: string | undefined;
|
|
108
|
-
/** From --strict arg. Deploy-only. */
|
|
109
|
-
strict: boolean;
|
|
110
|
-
/** From --metafile arg. Deploy-only. */
|
|
111
|
-
metafile: string | boolean | undefined;
|
|
112
|
-
/** From --old-asset-ttl arg. Deploy-only. */
|
|
113
|
-
oldAssetTtl: number | undefined;
|
|
114
|
-
};
|
|
115
|
-
type VersionsUploadProps = SharedDeployVersionsProps & {
|
|
116
|
-
/** Discriminant for DeployProps vs VersionsUploadProps */
|
|
117
|
-
command: "versions upload";
|
|
118
|
-
/** CLI-only (--preview-alias), or auto-generated from CI branch name. */
|
|
119
|
-
previewAlias: string | undefined;
|
|
120
|
-
};
|
|
121
|
-
interface TriggerDeployment {
|
|
122
|
-
targets: string[];
|
|
123
|
-
error?: Error;
|
|
124
|
-
}
|
|
125
|
-
type TriggerProps = {
|
|
126
|
-
config: Config;
|
|
127
|
-
accountId: string;
|
|
128
|
-
scriptName: string;
|
|
129
|
-
env: string | undefined;
|
|
130
|
-
crons: string[] | undefined;
|
|
131
|
-
routes: Route[];
|
|
132
|
-
useServiceEnvironments: boolean;
|
|
133
|
-
firstDeploy: boolean;
|
|
16
|
+
type DeployCallbacks = {
|
|
17
|
+
syncWorkersSite: ((complianceConfig: ComplianceConfig, accountId: string | undefined, scriptName: string, siteAssets: LegacyAssetPaths | undefined, preview: boolean, dryRun: boolean | undefined, oldAssetTTL: number | undefined) => Promise<{
|
|
18
|
+
manifest: {
|
|
19
|
+
[filePath: string]: string;
|
|
20
|
+
} | undefined;
|
|
21
|
+
namespace: string | undefined;
|
|
22
|
+
}>) | undefined;
|
|
23
|
+
provisionBindings: ((bindings: Record<string, Binding>, accountId: string, scriptName: string, autoCreate: boolean, config: Config, requireRemote?: boolean) => Promise<void>) | undefined;
|
|
24
|
+
getNormalizedContainerOptions: ((config: Config, args: {
|
|
25
|
+
containersRollout?: "gradual" | "immediate" | "none";
|
|
26
|
+
dryRun?: boolean;
|
|
27
|
+
}) => Promise<ContainerNormalizedConfig[]>) | undefined;
|
|
28
|
+
buildContainer: ((containerConfig: Exclude<ContainerNormalizedConfig, ImageURIConfig>, imageTag: string, dryRun: boolean, pathToDocker: string) => Promise<unknown>) | undefined;
|
|
29
|
+
deployContainers: ((config: Config, normalisedContainerConfig: ContainerNormalizedConfig[], args: {
|
|
30
|
+
versionId: string;
|
|
31
|
+
accountId: string;
|
|
32
|
+
scriptName: string;
|
|
33
|
+
}) => Promise<void>) | undefined;
|
|
34
|
+
analyseBundle: ((workerBundle: string | FormData) => Promise<Record<string, unknown>>) | undefined;
|
|
134
35
|
};
|
|
36
|
+
declare function deploy(props: DeployProps, config: Config, buildResult: WorkerBuildResult, callbacks: DeployCallbacks): Promise<{
|
|
37
|
+
sourceMapSize?: number;
|
|
38
|
+
versionId: string | null;
|
|
39
|
+
workerTag: string | null;
|
|
40
|
+
targets?: string[];
|
|
41
|
+
}>;
|
|
135
42
|
|
|
136
|
-
|
|
43
|
+
type VersionsUploadCallbacks = Pick<DeployCallbacks, "provisionBindings" | "analyseBundle">;
|
|
44
|
+
declare function versionsUpload(props: VersionsUploadProps, config: Config, buildResult: WorkerBuildResult, callbacks: VersionsUploadCallbacks): Promise<{
|
|
45
|
+
versionId: string | null;
|
|
46
|
+
workerTag: string | null;
|
|
47
|
+
versionPreviewUrl?: string | undefined;
|
|
48
|
+
versionPreviewAliasUrl?: string | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
|
|
51
|
+
declare function triggersDeploy(props: TriggerProps): Promise<string[] | void>;
|
|
137
52
|
declare function getSubdomainValues(config_workers_dev: boolean | undefined, config_preview_urls: boolean | undefined, routes: Route[]): {
|
|
138
53
|
workers_dev: boolean;
|
|
139
54
|
preview_urls?: boolean;
|
|
@@ -152,7 +67,7 @@ type GetWorkersDevSubdomainOptions = {
|
|
|
152
67
|
/**
|
|
153
68
|
* Gets the <user-subdomain>.(fed.)workers.dev URL for the given account.
|
|
154
69
|
*/
|
|
155
|
-
declare function getWorkersDevSubdomain(complianceConfig: ComplianceConfig, accountId: string,
|
|
70
|
+
declare function getWorkersDevSubdomain(complianceConfig: ComplianceConfig, accountId: string, options?: GetWorkersDevSubdomainOptions): Promise<string>;
|
|
156
71
|
|
|
157
72
|
interface Zone {
|
|
158
73
|
id: string;
|
|
@@ -162,7 +77,7 @@ type ZoneIdCache = Map<string, Promise<string | null>>;
|
|
|
162
77
|
declare function getZoneForRoute(complianceConfig: ComplianceConfig, from: {
|
|
163
78
|
route: Route;
|
|
164
79
|
accountId: string;
|
|
165
|
-
},
|
|
80
|
+
}, zoneIdCache?: ZoneIdCache): Promise<Zone | undefined>;
|
|
166
81
|
/**
|
|
167
82
|
* Given something that resembles a host, try to infer a zone id from it.
|
|
168
83
|
*
|
|
@@ -173,7 +88,7 @@ declare function getZoneForRoute(complianceConfig: ComplianceConfig, from: {
|
|
|
173
88
|
declare function getZoneIdFromHost(complianceConfig: ComplianceConfig, from: {
|
|
174
89
|
host: string;
|
|
175
90
|
accountId: string;
|
|
176
|
-
},
|
|
91
|
+
}, zoneIdCache?: ZoneIdCache): Promise<string>;
|
|
177
92
|
|
|
178
93
|
type RouteObject = ZoneIdRoute | ZoneNameRoute | CustomDomainRoute;
|
|
179
94
|
type CustomDomain = {
|
|
@@ -208,8 +123,8 @@ declare function publishRoutes(complianceConfig: ComplianceConfig, routes: Route
|
|
|
208
123
|
scriptName: string;
|
|
209
124
|
useServiceEnvironments: boolean;
|
|
210
125
|
accountId: string;
|
|
211
|
-
}
|
|
212
|
-
declare function publishCustomDomains(complianceConfig: ComplianceConfig, workerUrl: string, accountId: string, domains: Array<RouteObject
|
|
126
|
+
}): Promise<string[]>;
|
|
127
|
+
declare function publishCustomDomains(complianceConfig: ComplianceConfig, workerUrl: string, accountId: string, domains: Array<RouteObject>): Promise<TriggerDeployment>;
|
|
213
128
|
|
|
214
129
|
interface PostQueueBody {
|
|
215
130
|
queue_name: string;
|
|
@@ -281,14 +196,563 @@ interface PurgeQueueResponse {
|
|
|
281
196
|
started_at: string;
|
|
282
197
|
complete: boolean;
|
|
283
198
|
}
|
|
284
|
-
declare function listQueues(complianceConfig: ComplianceConfig, accountId: string,
|
|
285
|
-
declare function getQueue(complianceConfig: ComplianceConfig, accountId: string, queueName: string
|
|
286
|
-
declare function postConsumer(complianceConfig: ComplianceConfig, accountId: string, queueName: string, body: PostTypedConsumerBody
|
|
287
|
-
declare function putConsumerById(complianceConfig: ComplianceConfig, accountId: string, queueId: string, consumerId: string, body: PostTypedConsumerBody
|
|
288
|
-
declare function putConsumer(complianceConfig: ComplianceConfig, accountId: string, queueName: string, scriptName: string, envName: string | undefined, body: PostTypedConsumerBody
|
|
289
|
-
declare function deletePullConsumer(complianceConfig: ComplianceConfig, accountId: string, queueName: string
|
|
290
|
-
declare function listConsumers(complianceConfig: ComplianceConfig, accountId: string, queueName: string
|
|
291
|
-
declare function deleteWorkerConsumer(complianceConfig: ComplianceConfig, accountId: string, queueName: string, scriptName: string, envName: string | undefined
|
|
292
|
-
declare function updateQueueConsumers(complianceConfig: ComplianceConfig, accountId: string, scriptName: string, config: Config
|
|
293
|
-
|
|
294
|
-
|
|
199
|
+
declare function listQueues(complianceConfig: ComplianceConfig, accountId: string, page?: number, name?: string): Promise<QueueResponse[]>;
|
|
200
|
+
declare function getQueue(complianceConfig: ComplianceConfig, accountId: string, queueName: string): Promise<QueueResponse>;
|
|
201
|
+
declare function postConsumer(complianceConfig: ComplianceConfig, accountId: string, queueName: string, body: PostTypedConsumerBody): Promise<TypedConsumerResponse>;
|
|
202
|
+
declare function putConsumerById(complianceConfig: ComplianceConfig, accountId: string, queueId: string, consumerId: string, body: PostTypedConsumerBody): Promise<TypedConsumerResponse>;
|
|
203
|
+
declare function putConsumer(complianceConfig: ComplianceConfig, accountId: string, queueName: string, scriptName: string, envName: string | undefined, body: PostTypedConsumerBody): Promise<TypedConsumerResponse>;
|
|
204
|
+
declare function deletePullConsumer(complianceConfig: ComplianceConfig, accountId: string, queueName: string): Promise<void>;
|
|
205
|
+
declare function listConsumers(complianceConfig: ComplianceConfig, accountId: string, queueName: string): Promise<Consumer[]>;
|
|
206
|
+
declare function deleteWorkerConsumer(complianceConfig: ComplianceConfig, accountId: string, queueName: string, scriptName: string, envName: string | undefined): Promise<void>;
|
|
207
|
+
declare function updateQueueConsumers(complianceConfig: ComplianceConfig, accountId: string, scriptName: string, config: Config): Promise<Promise<TriggerDeployment>[]>;
|
|
208
|
+
declare function ensureQueuesExistByConfig(config: Config, accountId: string): Promise<void>;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Parse placement out of a Config
|
|
212
|
+
*/
|
|
213
|
+
declare function parseConfigPlacement(config: Config): CfPlacement | undefined;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
This is the error code from the Cloudflare API signaling that a worker could not be found on the target account
|
|
217
|
+
*/
|
|
218
|
+
declare const WORKER_NOT_FOUND_ERR_CODE: 10007;
|
|
219
|
+
/**
|
|
220
|
+
This is the error code from the Cloudflare API signaling that a worker environment (legacy) could not be found on the target account
|
|
221
|
+
*/
|
|
222
|
+
declare const WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE: 10090;
|
|
223
|
+
/**
|
|
224
|
+
This is the error message from the Cloudflare API signaling that a worker could not be found on the target account
|
|
225
|
+
*/
|
|
226
|
+
declare const workerNotFoundErrorMessage = "This Worker does not exist on your account.";
|
|
227
|
+
/**
|
|
228
|
+
* Given an error from the Cloudflare API discerns whether it is caused by a worker that could not be found on the target account
|
|
229
|
+
*
|
|
230
|
+
* @param error The error object
|
|
231
|
+
* @returns true if the object represents an error from the Cloudflare API caused by a not found worker, false otherwise
|
|
232
|
+
*/
|
|
233
|
+
declare function isWorkerNotFoundError(error: unknown): boolean;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Whether deprecated service environments are enabled.
|
|
237
|
+
*/
|
|
238
|
+
declare function useServiceEnvironments(config: Config | {
|
|
239
|
+
legacy_env?: boolean;
|
|
240
|
+
legacy: {
|
|
241
|
+
useServiceEnvironments?: boolean;
|
|
242
|
+
};
|
|
243
|
+
}): boolean;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Cloudflare API error codes used by deploy-helpers.
|
|
247
|
+
*/
|
|
248
|
+
/** The inherit binding references a binding that does not exist on the previous version. */
|
|
249
|
+
declare const INVALID_INHERIT_BINDING_CODE: 10057;
|
|
250
|
+
|
|
251
|
+
type SecretsValidationOptions = {
|
|
252
|
+
type: "deploy";
|
|
253
|
+
workerExists: boolean;
|
|
254
|
+
} | {
|
|
255
|
+
type: "upload";
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* When `secrets.required` is defined in config, validate the secrets exist on the Worker.
|
|
259
|
+
* For deploy, if the Worker doesn't exist yet, fail immediately.
|
|
260
|
+
* For upload, always add inherit bindings — the API handles the case where
|
|
261
|
+
* the Worker doesn't exist (versions upload cannot create new Workers).
|
|
262
|
+
* Secrets already provided (e.g. via --secrets-file) are excluded since
|
|
263
|
+
* they are part of the upload and don't need to be inherited.
|
|
264
|
+
*/
|
|
265
|
+
declare function addRequiredSecretsInheritBindings(config: Config, bindings: Record<string, Binding>, options: SecretsValidationOptions): void;
|
|
266
|
+
/**
|
|
267
|
+
* Reformats API errors for strict inherit binding validation failures into
|
|
268
|
+
* user-friendly messages listing the missing required secrets.
|
|
269
|
+
* The API returns all missing inherit bindings at once, each as a separate
|
|
270
|
+
* error in response.errors, which maps to individual err.notes entries.
|
|
271
|
+
*/
|
|
272
|
+
declare function handleMissingSecretsError(err: unknown, config: Config, options: SecretsValidationOptions): void;
|
|
273
|
+
|
|
274
|
+
interface SourceMapMetadata {
|
|
275
|
+
tmpDir: string;
|
|
276
|
+
entryDirectory: string;
|
|
277
|
+
}
|
|
278
|
+
interface SourceMapBundle {
|
|
279
|
+
sourceMapPath?: string | undefined;
|
|
280
|
+
sourceMapMetadata?: SourceMapMetadata | undefined;
|
|
281
|
+
[key: string]: unknown;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Loads source maps that appear in the given build output.
|
|
285
|
+
*/
|
|
286
|
+
declare function loadSourceMaps(main: CfModule, modules: CfModule[], bundle: SourceMapBundle): CfWorkerSourceMap[];
|
|
287
|
+
/**
|
|
288
|
+
* Attaches a sourcemap, if found, to a JavaScript module.
|
|
289
|
+
*/
|
|
290
|
+
declare function tryAttachSourcemapToModule(module: CfModule): void;
|
|
291
|
+
|
|
292
|
+
type JsonLike = string | number | boolean | null | JsonLike[] | undefined | {
|
|
293
|
+
[id: string]: JsonLike;
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* Given two objects A and B that are Json serializable this function computes the difference between them
|
|
297
|
+
*
|
|
298
|
+
* The difference object includes:
|
|
299
|
+
* - fields in object B but not in object A included as `<fieldKey__added>`
|
|
300
|
+
* - fields in object A but not in object B included as `<fieldKey__deleted>`
|
|
301
|
+
* - fields present in both objects but modified as `<fieldKey>: { __old: <objectAValue>, __new: <objectBValue> }`
|
|
302
|
+
*
|
|
303
|
+
* Additionally the difference object contains a `toString` method that can be used to generate a string representation
|
|
304
|
+
* of the difference between the two objects (to be presented to users)
|
|
305
|
+
*
|
|
306
|
+
* @param jsonObjA The first target object
|
|
307
|
+
* @param jsonObjB The second target object
|
|
308
|
+
* @returns An object representing the diff between the two objects, or null if the objects are equal
|
|
309
|
+
*/
|
|
310
|
+
declare function diffJsonObjects(jsonObjA: Record<string, JsonLike>, jsonObjB: Record<string, JsonLike>): Record<string, JsonLike> | null;
|
|
311
|
+
/**
|
|
312
|
+
* Given a diff object (generated by `diffJsonObjects`) this function computes whether the
|
|
313
|
+
* difference is non-destructive, i.e. if the second object only contained additions to the
|
|
314
|
+
* first one and no removal nor modifications.
|
|
315
|
+
*
|
|
316
|
+
* @param diff The difference object to use (generated by `diffJsonObjects`)
|
|
317
|
+
* @returns `true` if the difference is non-destructive, `false` if it is
|
|
318
|
+
*/
|
|
319
|
+
declare function isNonDestructive(diff: JsonLike): boolean;
|
|
320
|
+
/**
|
|
321
|
+
* A modified value in json-diff is represented as an object with two properties:
|
|
322
|
+
* `__old` and `__new`. Where the former contains the old version of the value and
|
|
323
|
+
* the latter the new one.
|
|
324
|
+
* This utility, given an arbitrary value, discerns whether the value represents the
|
|
325
|
+
* diff of a modified value.
|
|
326
|
+
*
|
|
327
|
+
* @param value The target value to check
|
|
328
|
+
* @returns True if the value represents a value modified, false otherwise
|
|
329
|
+
*/
|
|
330
|
+
declare function isModifiedDiffValue<T extends JsonLike>(value: unknown): value is {
|
|
331
|
+
__old: T;
|
|
332
|
+
__new: T;
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Object representing the difference of two configuration objects.
|
|
337
|
+
*/
|
|
338
|
+
type ConfigDiff = {
|
|
339
|
+
/** The actual (raw) computed diff of the two objects */
|
|
340
|
+
diff: Record<string, JsonLike> | null;
|
|
341
|
+
/**
|
|
342
|
+
* Flag indicating whether the difference includes some destructive changes.
|
|
343
|
+
*
|
|
344
|
+
* 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.
|
|
345
|
+
*/
|
|
346
|
+
nonDestructive: boolean;
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
* Computes the difference between a remote representation of a Worker's config and a local configuration.
|
|
350
|
+
*
|
|
351
|
+
* @param remoteConfig The remote representation of a Worker's config
|
|
352
|
+
* @param localResolvedConfig The local (resolved) config
|
|
353
|
+
* @returns Object containing the diffing information
|
|
354
|
+
*/
|
|
355
|
+
declare function getRemoteConfigDiff(remoteConfig: RawConfig, localResolvedConfig: Config): ConfigDiff;
|
|
356
|
+
/**
|
|
357
|
+
* Given a config diff generates a patch object that can be passed to `experimental_patchConfig` to revert the
|
|
358
|
+
* changes in the config object that are described by the config diff.
|
|
359
|
+
*
|
|
360
|
+
* If the config is for a specific target environment, only the environment config object will be targeted for the patch.
|
|
361
|
+
*
|
|
362
|
+
* @param configDiff The target config diff
|
|
363
|
+
* @param targetEnvironment the target environment if any
|
|
364
|
+
* @returns The patch object to pass to `experimental_patchConfig` to revert the changes
|
|
365
|
+
*/
|
|
366
|
+
declare function getConfigPatch(configDiff: {
|
|
367
|
+
diff: Record<string, JsonLike> | null;
|
|
368
|
+
nonDestructive: boolean;
|
|
369
|
+
}["diff"], targetEnvironment?: string | undefined): RawConfig;
|
|
370
|
+
|
|
371
|
+
declare function validateFileSecrets(content: unknown, jsonFilePath: string): content is Record<string, string | null>;
|
|
372
|
+
/** Error thrown when no input is provided to parseBulkInputToObject */
|
|
373
|
+
declare class NoInputError extends Error {
|
|
374
|
+
constructor();
|
|
375
|
+
}
|
|
376
|
+
/** Result from parsing bulk secret input without nullable values, including metadata for analytics */
|
|
377
|
+
type BulkInputResult = {
|
|
378
|
+
content: Record<string, string>;
|
|
379
|
+
secretSource: "file" | "stdin";
|
|
380
|
+
secretFormat: "json" | "dotenv";
|
|
381
|
+
};
|
|
382
|
+
/** Result from parsing bulk secret input with nullable values, including metadata for analytics */
|
|
383
|
+
type BulkInputNullableResult = {
|
|
384
|
+
content: Record<string, string | null>;
|
|
385
|
+
secretSource: "file" | "stdin";
|
|
386
|
+
secretFormat: "json" | "dotenv";
|
|
387
|
+
};
|
|
388
|
+
/** Override for callers that need non-nullable */
|
|
389
|
+
declare function parseBulkInputToObject(input?: string, includeNull?: false): Promise<BulkInputResult | undefined>;
|
|
390
|
+
/** Override for callers that need nullable */
|
|
391
|
+
declare function parseBulkInputToObject(input?: string, includeNull?: true): Promise<BulkInputNullableResult | undefined>;
|
|
392
|
+
|
|
393
|
+
interface ConvertBindingsOptions {
|
|
394
|
+
/**
|
|
395
|
+
* Use preview IDs (preview_id, preview_bucket_name, preview_database_id) instead of production IDs when resolving a binding ID.
|
|
396
|
+
* This means that the rest of Wrangler does not need to be aware of preview IDs, and can just use regular IDs.
|
|
397
|
+
*/
|
|
398
|
+
usePreviewIds?: boolean;
|
|
399
|
+
/**
|
|
400
|
+
* Exclude bindings that Pages doesn't support
|
|
401
|
+
*/
|
|
402
|
+
pages?: boolean;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Convert Config to the Record<string, Binding> format for consistent internal use.
|
|
406
|
+
*/
|
|
407
|
+
declare function convertConfigToBindings(config: Partial<Pick<Config, ConfigBindingFieldName>>, options?: ConvertBindingsOptions): Record<string, Binding>;
|
|
408
|
+
declare function isUnsafeBindingType(type: string): type is `unsafe_${string}`;
|
|
409
|
+
/**
|
|
410
|
+
* What configuration key does this binding use for referring to it's binding name?
|
|
411
|
+
*/
|
|
412
|
+
declare const nameBindings: readonly ["durable_object_namespace", "logfwdr", "ratelimit", "unsafe_ratelimit", "send_email"];
|
|
413
|
+
type FlatBinding<Type> = Extract<Binding, {
|
|
414
|
+
type: Type;
|
|
415
|
+
}> & (Type extends (typeof nameBindings)[number] ? {
|
|
416
|
+
name: string;
|
|
417
|
+
} : {
|
|
418
|
+
binding: string;
|
|
419
|
+
});
|
|
420
|
+
declare function extractBindingsOfType<Type extends Binding["type"]>(type: Type, bindings: Record<string, Binding> | undefined): FlatBinding<Type>[];
|
|
421
|
+
/**
|
|
422
|
+
* Get bindings from a Config object in the standard Record<string, Binding> format.
|
|
423
|
+
*/
|
|
424
|
+
declare function getBindings(config: Config | undefined, options?: {
|
|
425
|
+
pages?: boolean;
|
|
426
|
+
}): Record<string, Binding>;
|
|
427
|
+
|
|
428
|
+
declare function handleUnsafeCapnp(capnp: CfCapnp): Buffer;
|
|
429
|
+
|
|
430
|
+
declare const moduleTypeMimeType: {
|
|
431
|
+
[type in CfModuleType]: string | undefined;
|
|
432
|
+
};
|
|
433
|
+
declare function fromMimeType(mimeType: string): CfModuleType;
|
|
434
|
+
/**
|
|
435
|
+
* Creates a `FormData` upload from Worker data and bindings
|
|
436
|
+
*/
|
|
437
|
+
declare function createWorkerUploadForm(worker: Omit<CfWorkerInit, "bindings" | "rawBindings">, bindings: Record<string, Binding> | undefined, options?: {
|
|
438
|
+
dryRun?: true;
|
|
439
|
+
unsafe?: {
|
|
440
|
+
metadata?: Record<string, unknown>;
|
|
441
|
+
capnp?: CfCapnp;
|
|
442
|
+
};
|
|
443
|
+
}): FormData;
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Inject bindings into the Worker to support Workers Sites. These are injected at the last minute so that
|
|
447
|
+
* they don't display in the output of `printBindings()`
|
|
448
|
+
*/
|
|
449
|
+
declare function addWorkersSitesBindings(bindings: Record<string, Binding>, namespace: string | undefined, manifest: {
|
|
450
|
+
[filePath: string]: string;
|
|
451
|
+
} | undefined, format: CfScriptFormat): {
|
|
452
|
+
[x: string]: Binding;
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
declare function deployWfpUserWorker(dispatchNamespace: string, versionId: string | null): void;
|
|
456
|
+
|
|
457
|
+
declare function getDeployConfirmFunction(options: {
|
|
458
|
+
strictMode?: boolean;
|
|
459
|
+
}): (text: string) => Promise<boolean>;
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Sanitizes a branch name to create a valid DNS label alias.
|
|
463
|
+
* Converts to lowercase, replaces invalid chars with dashes, removes consecutive dashes.
|
|
464
|
+
*/
|
|
465
|
+
declare function sanitizeBranchName(branchName: string): string;
|
|
466
|
+
/**
|
|
467
|
+
* Gets the current branch name from CI environment or git.
|
|
468
|
+
*/
|
|
469
|
+
declare function getBranchName(): string | undefined;
|
|
470
|
+
/**
|
|
471
|
+
* Creates a truncated alias with hash suffix when the branch name is too long.
|
|
472
|
+
* Hash from original branch name to preserve uniqueness.
|
|
473
|
+
*/
|
|
474
|
+
declare function createTruncatedAlias(branchName: string, sanitizedAlias: string, availableSpace: number): string | undefined;
|
|
475
|
+
/**
|
|
476
|
+
* Generates a preview alias based on the current git branch.
|
|
477
|
+
* Alias must be <= 63 characters, alphanumeric + dashes only, and start with a letter.
|
|
478
|
+
* Returns undefined if not in a git directory or requirements cannot be met.
|
|
479
|
+
*/
|
|
480
|
+
declare function generatePreviewAlias(scriptName: string): string | undefined;
|
|
481
|
+
|
|
482
|
+
type RetrieveSourceMapFunction = NonNullable<Options["retrieveSourceMap"]>;
|
|
483
|
+
declare function maybeRetrieveFileSourceMap(filePath?: string): ReturnType<RetrieveSourceMapFunction>;
|
|
484
|
+
declare function getSourceMappedStack(details: Protocol.Runtime.ExceptionDetails): string;
|
|
485
|
+
declare function getSourceMappedString(value: string, retrieveSourceMap?: RetrieveSourceMapFunction): string;
|
|
486
|
+
|
|
487
|
+
declare function printBundleSize(main: {
|
|
488
|
+
name: string;
|
|
489
|
+
content: string;
|
|
490
|
+
}, modules: CfModule[]): Promise<void>;
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Computes and validates the Node.js compatibility mode we are running.
|
|
494
|
+
*
|
|
495
|
+
* NOTES:
|
|
496
|
+
* - 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.
|
|
497
|
+
* - See `EnvironmentInheritable` for `noBundle`.
|
|
498
|
+
*
|
|
499
|
+
* @param compatibilityDateStr The compatibility date
|
|
500
|
+
* @param compatibilityFlags The compatibility flags
|
|
501
|
+
* @param noBundle Whether to skip internal build steps and directly deploy script
|
|
502
|
+
*
|
|
503
|
+
*/ declare function validateNodeCompatMode(compatibilityDateStr: string | undefined, // Default to some arbitrary old date
|
|
504
|
+
compatibilityFlags: string[], { noBundle, }: {
|
|
505
|
+
noBundle?: boolean;
|
|
506
|
+
}): NodeJSCompatMode;
|
|
507
|
+
|
|
508
|
+
declare const validateRoutes: (routes: Route[], assets: AssetsOptions | undefined) => void;
|
|
509
|
+
|
|
510
|
+
declare function hasDefinedEnvironments(config: Config): boolean;
|
|
511
|
+
declare function applyServiceAndEnvironmentTags(config: Config, tags: string[]): string[];
|
|
512
|
+
declare function warnOnErrorUpdatingServiceAndEnvironmentTags(): void;
|
|
513
|
+
declare function tagsAreEqual(a: string[], b: string[]): boolean;
|
|
514
|
+
|
|
515
|
+
declare function helpIfErrorIsSizeOrScriptStartup(err: unknown, dependencies: {
|
|
516
|
+
[path: string]: {
|
|
517
|
+
bytesInOutput: number;
|
|
518
|
+
};
|
|
519
|
+
}, workerBundle: FormData | string, projectRoot: string | undefined, analyseBundle?: (bundle: FormData | string) => Promise<unknown>): Promise<string | null>;
|
|
520
|
+
/**
|
|
521
|
+
* Returns a formatted error message that describes the script size error.
|
|
522
|
+
* It includes the largest dependencies if available.
|
|
523
|
+
*/
|
|
524
|
+
declare function diagnoseScriptSizeError(err: ParseError, dependencies: {
|
|
525
|
+
[path: string]: {
|
|
526
|
+
bytesInOutput: number;
|
|
527
|
+
};
|
|
528
|
+
}): string;
|
|
529
|
+
/**
|
|
530
|
+
* Returns a formatted error message that describes the startup error.
|
|
531
|
+
* If profiling is successful, it will include a link to the generated CPU profile.
|
|
532
|
+
*/
|
|
533
|
+
declare function diagnoseStartupError(err: ParseError, workerBundle: FormData | string, projectRoot: string | undefined, analyseBundle?: (bundle: FormData | string) => Promise<unknown>): Promise<string>;
|
|
534
|
+
|
|
535
|
+
type Percentage = number;
|
|
536
|
+
type UUID = string;
|
|
537
|
+
type VersionId = UUID;
|
|
538
|
+
type ApiDeployment = {
|
|
539
|
+
id: string;
|
|
540
|
+
source: "api" | string;
|
|
541
|
+
strategy: "percentage" | string;
|
|
542
|
+
author_email: string;
|
|
543
|
+
annotations?: Record<string, string>;
|
|
544
|
+
created_on: string;
|
|
545
|
+
versions: Array<{
|
|
546
|
+
version_id: VersionId;
|
|
547
|
+
percentage: Percentage;
|
|
548
|
+
}>;
|
|
549
|
+
};
|
|
550
|
+
type ApiVersion = {
|
|
551
|
+
id: VersionId;
|
|
552
|
+
number: number;
|
|
553
|
+
metadata: {
|
|
554
|
+
created_on: string;
|
|
555
|
+
modified_on: string;
|
|
556
|
+
source: "api" | string;
|
|
557
|
+
author_id: string;
|
|
558
|
+
author_email: string;
|
|
559
|
+
};
|
|
560
|
+
annotations?: {
|
|
561
|
+
"workers/triggered_by"?: "upload" | string;
|
|
562
|
+
"workers/message"?: string;
|
|
563
|
+
"workers/tag"?: string;
|
|
564
|
+
};
|
|
565
|
+
resources: {
|
|
566
|
+
bindings: WorkerMetadataBinding[];
|
|
567
|
+
script: {
|
|
568
|
+
etag: string;
|
|
569
|
+
handlers: string[] | null;
|
|
570
|
+
placement_mode?: "smart";
|
|
571
|
+
last_deployed_from: string;
|
|
572
|
+
};
|
|
573
|
+
script_runtime: {
|
|
574
|
+
compatibility_date?: string;
|
|
575
|
+
compatibility_flags?: string[];
|
|
576
|
+
usage_model: "bundled" | "unbound" | "standard";
|
|
577
|
+
limits: CfUserLimits;
|
|
578
|
+
};
|
|
579
|
+
};
|
|
580
|
+
startup_time_ms?: number;
|
|
581
|
+
};
|
|
582
|
+
type VersionCache = Map<VersionId, ApiVersion>;
|
|
583
|
+
|
|
584
|
+
declare function fetchVersion(complianceConfig: ComplianceConfig, accountId: string, workerName: string, versionId: VersionId, versionCache: VersionCache | undefined): Promise<ApiVersion>;
|
|
585
|
+
declare function fetchVersions(complianceConfig: ComplianceConfig, accountId: string, workerName: string, versionCache: VersionCache | undefined, versionIds: VersionId[]): Promise<ApiVersion[]>;
|
|
586
|
+
declare function fetchLatestDeployments(complianceConfig: ComplianceConfig, accountId: string, workerName: string): Promise<ApiDeployment[]>;
|
|
587
|
+
declare function fetchLatestDeployment(complianceConfig: ComplianceConfig, accountId: string, workerName: string): Promise<ApiDeployment | undefined>;
|
|
588
|
+
declare function fetchDeploymentVersions(complianceConfig: ComplianceConfig, accountId: string, workerName: string, deployment: ApiDeployment | undefined, versionCache: VersionCache): Promise<[ApiVersion[], Map<VersionId, Percentage>]>;
|
|
589
|
+
declare function fetchDeployableVersions(complianceConfig: ComplianceConfig, accountId: string, workerName: string, versionCache: VersionCache): Promise<ApiVersion[]>;
|
|
590
|
+
declare function createDeployment(complianceConfig: ComplianceConfig, accountId: string, workerName: string, versionTraffic: Map<VersionId, Percentage>, message: string | undefined, force: boolean | undefined): Promise<{
|
|
591
|
+
id: string;
|
|
592
|
+
}>;
|
|
593
|
+
type NonVersionedScriptSettings = {
|
|
594
|
+
logpush: boolean;
|
|
595
|
+
tags: string[] | null;
|
|
596
|
+
tail_consumers: TailConsumer[];
|
|
597
|
+
streaming_tail_consumers: StreamingTailConsumer[];
|
|
598
|
+
observability: Observability;
|
|
599
|
+
};
|
|
600
|
+
declare function patchNonVersionedScriptSettings(complianceConfig: ComplianceConfig, accountId: string, workerName: string, settings: Partial<NonVersionedScriptSettings>): Promise<Partial<NonVersionedScriptSettings>>;
|
|
601
|
+
|
|
602
|
+
type Workflow = {
|
|
603
|
+
name: string;
|
|
604
|
+
id: string;
|
|
605
|
+
created_on: string;
|
|
606
|
+
modified_on: string;
|
|
607
|
+
script_name: string;
|
|
608
|
+
class_name: string;
|
|
609
|
+
};
|
|
610
|
+
interface WorkflowConflict {
|
|
611
|
+
name: string;
|
|
612
|
+
currentOwner: string;
|
|
613
|
+
}
|
|
614
|
+
declare const WORKFLOW_NOT_FOUND_CODE = 10200;
|
|
615
|
+
declare function checkWorkflowConflicts(config: Config, accountId: string, scriptName: string): Promise<{
|
|
616
|
+
hasConflicts: false;
|
|
617
|
+
} | {
|
|
618
|
+
hasConflicts: true;
|
|
619
|
+
conflicts: WorkflowConflict[];
|
|
620
|
+
message: string;
|
|
621
|
+
}>;
|
|
622
|
+
|
|
623
|
+
type CustomDomainsRes = {
|
|
624
|
+
id: string;
|
|
625
|
+
zone_id: string;
|
|
626
|
+
zone_name: string;
|
|
627
|
+
hostname: string;
|
|
628
|
+
service: string;
|
|
629
|
+
environment: string;
|
|
630
|
+
cert_id: string;
|
|
631
|
+
enabled: boolean;
|
|
632
|
+
previews_enabled: boolean;
|
|
633
|
+
}[];
|
|
634
|
+
type WorkerSubdomainRes = {
|
|
635
|
+
enabled: boolean;
|
|
636
|
+
previews_enabled: boolean;
|
|
637
|
+
};
|
|
638
|
+
type CronTriggersRes = {
|
|
639
|
+
schedules: {
|
|
640
|
+
cron: string;
|
|
641
|
+
created_on: Date;
|
|
642
|
+
modified_on: Date;
|
|
643
|
+
}[];
|
|
644
|
+
};
|
|
645
|
+
type RoutesRes = {
|
|
646
|
+
id: string;
|
|
647
|
+
pattern: string;
|
|
648
|
+
zone_name: string;
|
|
649
|
+
script: string;
|
|
650
|
+
}[];
|
|
651
|
+
/**
|
|
652
|
+
* Downloads all information required to construct a Wrangler config file for a Worker from the API
|
|
653
|
+
*/
|
|
654
|
+
declare function fetchWorkerConfig(accountId: string, workerName: string, environment: string): Promise<{
|
|
655
|
+
bindings: _cloudflare_workers_utils.WorkerMetadataBinding[];
|
|
656
|
+
routes: RoutesRes;
|
|
657
|
+
customDomains: CustomDomainsRes;
|
|
658
|
+
subdomainStatus: WorkerSubdomainRes;
|
|
659
|
+
serviceEnvMetadata: {
|
|
660
|
+
environment: string;
|
|
661
|
+
created_on: string;
|
|
662
|
+
modified_on: string;
|
|
663
|
+
script: {
|
|
664
|
+
id: string;
|
|
665
|
+
tag: string;
|
|
666
|
+
tags: string[];
|
|
667
|
+
etag: string;
|
|
668
|
+
handlers: string[];
|
|
669
|
+
modified_on: string;
|
|
670
|
+
created_on: string;
|
|
671
|
+
migration_tag: string;
|
|
672
|
+
usage_model: "bundled" | "unbound";
|
|
673
|
+
limits: {
|
|
674
|
+
cpu_ms: number;
|
|
675
|
+
subrequests: number;
|
|
676
|
+
};
|
|
677
|
+
compatibility_date: string;
|
|
678
|
+
compatibility_flags: string[];
|
|
679
|
+
last_deployed_from?: "wrangler" | "dash" | "api";
|
|
680
|
+
placement_mode?: "smart";
|
|
681
|
+
tail_consumers?: _cloudflare_workers_utils.TailConsumer[];
|
|
682
|
+
observability?: _cloudflare_workers_utils.Observability;
|
|
683
|
+
};
|
|
684
|
+
};
|
|
685
|
+
cronTriggers: CronTriggersRes;
|
|
686
|
+
}>;
|
|
687
|
+
/**
|
|
688
|
+
* Downloads all the remote information we can gather for a worker and from them generates a raw configuration object that
|
|
689
|
+
* approximates what a wrangler config object for the worker was/would have been.
|
|
690
|
+
*/
|
|
691
|
+
declare function downloadWorkerConfig(workerName: string, environment: string, entrypoint: string, accountId: string): Promise<RawConfig>;
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* For a given Worker + migrations config, figure out which migrations
|
|
695
|
+
* to upload based on the current migration tag of the deployed Worker.
|
|
696
|
+
*/
|
|
697
|
+
declare function getMigrationsToUpload(scriptName: string, props: {
|
|
698
|
+
accountId: string | undefined;
|
|
699
|
+
config: Config;
|
|
700
|
+
useServiceEnvironments: boolean | undefined;
|
|
701
|
+
env: string | undefined;
|
|
702
|
+
dispatchNamespace: string | undefined;
|
|
703
|
+
}): Promise<CfWorkerInit["migrations"]>;
|
|
704
|
+
|
|
705
|
+
declare function verifyWorkerMatchesCITag(complianceConfig: ComplianceConfig, accountId: string, workerName: string, configPath: string | undefined): Promise<void>;
|
|
706
|
+
|
|
707
|
+
declare function fetchSecrets(config: Config, accountId: string, environment: string | undefined): Promise<{
|
|
708
|
+
name: string;
|
|
709
|
+
type: string;
|
|
710
|
+
}[]>;
|
|
711
|
+
declare function checkRemoteSecretsOverride(config: Config, accountId: string, targetEnv: string | undefined): Promise<{
|
|
712
|
+
override: false;
|
|
713
|
+
} | {
|
|
714
|
+
override: true;
|
|
715
|
+
deployErrorMessage: string;
|
|
716
|
+
}>;
|
|
717
|
+
|
|
718
|
+
declare function confirmLatestDeploymentOverwrite(config: Config, accountId: string, scriptName: string): Promise<boolean>;
|
|
719
|
+
declare function printVersions(versions: ApiVersion[], traffic: Map<VersionId, Percentage>): void;
|
|
720
|
+
|
|
721
|
+
type PrintContext = {
|
|
722
|
+
log?: (message: string) => void;
|
|
723
|
+
registry?: WorkerRegistry | null;
|
|
724
|
+
local?: boolean;
|
|
725
|
+
isMultiWorker?: boolean;
|
|
726
|
+
remoteBindingsDisabled?: boolean;
|
|
727
|
+
name?: string;
|
|
728
|
+
provisioning?: boolean;
|
|
729
|
+
warnIfNoBindings?: boolean;
|
|
730
|
+
unsafeMetadata?: Record<string, unknown>;
|
|
731
|
+
};
|
|
732
|
+
/**
|
|
733
|
+
* Print all the bindings a worker would have access to.
|
|
734
|
+
* Accepts StartDevWorkerInput["bindings"] format
|
|
735
|
+
*/
|
|
736
|
+
declare function printBindings(bindings: StartDevWorkerInput["bindings"], tailConsumers?: CfTailConsumer[], streamingTailConsumers?: CfTailConsumer[], containers?: ContainerApp[], context?: PrintContext): void;
|
|
737
|
+
/**
|
|
738
|
+
* Validates the user's `remote` setting for a given binding against the
|
|
739
|
+
* binding type's local-development capabilities (sourced from
|
|
740
|
+
* {@link getBindingLocalSupport}). Throws `UserError` for invalid combinations
|
|
741
|
+
* and emits warnings for valid-but-noteworthy ones.
|
|
742
|
+
*/
|
|
743
|
+
declare function warnOrError(type: Binding["type"], remote: boolean | undefined): void;
|
|
744
|
+
|
|
745
|
+
type AssetManifest = {
|
|
746
|
+
[path: string]: {
|
|
747
|
+
hash: string;
|
|
748
|
+
size: number;
|
|
749
|
+
};
|
|
750
|
+
};
|
|
751
|
+
declare const syncAssets: (complianceConfig: ComplianceConfig, accountId: string | undefined, assetDirectory: string, scriptName: string, dispatchNamespace?: string) => Promise<string>;
|
|
752
|
+
declare const buildAssetManifest: (dir: string) => Promise<AssetManifest>;
|
|
753
|
+
|
|
754
|
+
declare const hashFile: (filepath: string) => string;
|
|
755
|
+
|
|
756
|
+
declare const isJwtExpired: (token: string) => boolean | undefined;
|
|
757
|
+
|
|
758
|
+
export { type ApiDeployment, type ApiVersion, type AssetManifest, type BulkInputNullableResult, type BulkInputResult, type Consumer, type ConsumerSettings, type CustomDomain, type CustomDomainChangeset, type DeployCallbacks, DeployProps, INVALID_INHERIT_BINDING_CODE, type JsonLike, NoInputError, type NonVersionedScriptSettings, 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 SourceMapBundle, TriggerDeployment, TriggerProps, type TypedConsumerResponse, type VersionCache, type VersionId, type VersionsUploadCallbacks, VersionsUploadProps, WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE, WORKER_NOT_FOUND_ERR_CODE, WORKFLOW_NOT_FOUND_CODE, WorkerBuildResult, type Workflow, type WorkflowConflict, type Zone, type ZoneIdCache, addRequiredSecretsInheritBindings, addWorkersSitesBindings, applyServiceAndEnvironmentTags, buildAssetManifest, checkRemoteSecretsOverride, checkWorkflowConflicts, confirmLatestDeploymentOverwrite, convertConfigToBindings, createDeployment, createTruncatedAlias, createWorkerUploadForm, deletePullConsumer, deleteWorkerConsumer, deploy, deployWfpUserWorker, diagnoseScriptSizeError, diagnoseStartupError, diffJsonObjects, downloadWorkerConfig, ensureQueuesExistByConfig, extractBindingsOfType, fetchDeployableVersions, fetchDeploymentVersions, fetchLatestDeployment, fetchLatestDeployments, fetchSecrets, fetchVersion, fetchVersions, fetchWorkerConfig, fromMimeType, generatePreviewAlias, getBindings, getBranchName, getConfigPatch, getDeployConfirmFunction, getMigrationsToUpload, getQueue, getRemoteConfigDiff, getSourceMappedStack, getSourceMappedString, getSubdomainValues, getSubdomainValuesAPIMock, getWorkersDevSubdomain, getZoneForRoute, getZoneIdFromHost, handleMissingSecretsError, handleUnsafeCapnp, hasDefinedEnvironments, hashFile, helpIfErrorIsSizeOrScriptStartup, isJwtExpired, isModifiedDiffValue, isNonDestructive, isUnsafeBindingType, isWorkerNotFoundError, listConsumers, listQueues, loadSourceMaps, maybeRetrieveFileSourceMap, moduleTypeMimeType, parseBulkInputToObject, parseConfigPlacement, patchNonVersionedScriptSettings, postConsumer, printBindings, printBundleSize, printVersions, publishCustomDomains, publishRoutes, putConsumer, putConsumerById, renderRoute, sanitizeBranchName, syncAssets, tagsAreEqual, triggersDeploy, tryAttachSourcemapToModule, updateQueueConsumers, useServiceEnvironments, validateFileSecrets, validateNodeCompatMode, validateRoutes, verifyWorkerMatchesCITag, versionsUpload, warnOnErrorUpdatingServiceAndEnvironmentTags, warnOrError, workerNotFoundErrorMessage };
|