@cloudflare/config 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # `@cloudflare/config`
2
+
3
+ Definitions and utilities for configuring Cloudflare Workers and related products.
4
+
5
+ This is not yet stable enough for external use — APIs may change without notice.
@@ -0,0 +1,620 @@
1
+ import { $ as TextBinding, A as ArtifactsBinding, B as JsonBinding, C as Triggers, D as AiSearchBinding, E as AiBinding, F as DispatchNamespaceBinding, G as PipelineBinding, H as LogfwdrBinding, I as DurableObjectBinding, J as RateLimitBinding, K as QueueBinding, L as FlagshipBinding, M as Bindings, N as BrowserBinding, O as AiSearchNamespaceBinding, P as D1Binding, Q as StreamBinding, R as HyperdriveBinding, S as ScheduledTrigger, T as AgentMemoryBinding, U as MediaBinding, V as KvBinding, W as MtlsCertificateBinding, X as SecretsStoreSecretBinding, Y as SecretBinding, Z as SendEmailBinding, _ as WorkerEntrypointExport, a as ConfigContext, at as TypedWorkerBinding, b as FetchTrigger, c as defineWorker, ct as VectorizeBinding, d as DurableObjectCreatedExport, dt as VpcServiceBinding, et as TypedAiBinding, f as DurableObjectDeletedExport, ft as WebSearchBinding, g as Exports, gt as bindings, h as DurableObjectTransferredExport, ht as WorkflowBinding, i as UnwrapConfig, it as TypedQueueBinding, j as AssetsBinding, k as AnalyticsEngineDatasetBinding, l as resolveWorkerDefinition, lt as VersionMetadataBinding, m as DurableObjectRenamedExport, mt as WorkerLoaderBinding, n as InferEnv, nt as TypedKvBinding, o as TypedWorkerDefinition, ot as TypedWorkflowBinding, p as DurableObjectExpectingTransferExport, pt as WorkerBinding, q as R2Binding, r as InferMainModule, rt as TypedPipelineBinding, s as UserConfigExport, st as UnsafeBinding, t as InferDurableNamespaces, tt as TypedDurableObjectBinding, u as UserConfig, ut as VpcNetworkBinding, v as WorkerEntrypointExportOptions, w as triggers, x as QueueConsumerTrigger, y as exports, z as ImagesBinding } from "./public-YTdTOrcv.mjs";
2
+ import * as z from "zod";
3
+ import { RawConfig } from "@cloudflare/workers-utils";
4
+
5
+ //#region src/schema.d.ts
6
+ declare const KnownBindingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7
+ type: z.ZodLiteral<"agent-memory">;
8
+ namespace: z.ZodString;
9
+ remote: z.ZodOptional<z.ZodBoolean>;
10
+ }, z.core.$strict>, z.ZodObject<{
11
+ type: z.ZodLiteral<"ai">;
12
+ remote: z.ZodOptional<z.ZodBoolean>;
13
+ }, z.core.$strict>, z.ZodObject<{
14
+ type: z.ZodLiteral<"ai-search">;
15
+ name: z.ZodString;
16
+ remote: z.ZodOptional<z.ZodBoolean>;
17
+ }, z.core.$strict>, z.ZodObject<{
18
+ type: z.ZodLiteral<"ai-search-namespace">;
19
+ namespace: z.ZodString;
20
+ remote: z.ZodOptional<z.ZodBoolean>;
21
+ }, z.core.$strict>, z.ZodObject<{
22
+ type: z.ZodLiteral<"analytics-engine-dataset">;
23
+ name: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strict>, z.ZodObject<{
25
+ type: z.ZodLiteral<"artifacts">;
26
+ namespace: z.ZodString;
27
+ remote: z.ZodOptional<z.ZodBoolean>;
28
+ }, z.core.$strict>, z.ZodObject<{
29
+ type: z.ZodLiteral<"assets">;
30
+ }, z.core.$strict>, z.ZodObject<{
31
+ type: z.ZodLiteral<"browser">;
32
+ remote: z.ZodOptional<z.ZodBoolean>;
33
+ }, z.core.$strict>, z.ZodObject<{
34
+ type: z.ZodLiteral<"d1">;
35
+ name: z.ZodOptional<z.ZodString>;
36
+ id: z.ZodOptional<z.ZodString>;
37
+ remote: z.ZodOptional<z.ZodBoolean>;
38
+ }, z.core.$strict>, z.ZodObject<{
39
+ type: z.ZodLiteral<"dispatch-namespace">;
40
+ namespace: z.ZodString;
41
+ outbound: z.ZodOptional<z.ZodObject<{
42
+ workerName: z.ZodString;
43
+ parameters: z.ZodOptional<z.ZodArray<z.ZodString>>;
44
+ }, z.core.$strict>>;
45
+ remote: z.ZodOptional<z.ZodBoolean>;
46
+ }, z.core.$strict>, z.ZodObject<{
47
+ type: z.ZodLiteral<"durable-object">;
48
+ workerName: z.ZodString;
49
+ exportName: z.ZodString;
50
+ }, z.core.$strict>, z.ZodObject<{
51
+ type: z.ZodLiteral<"flagship">;
52
+ id: z.ZodString;
53
+ remote: z.ZodOptional<z.ZodBoolean>;
54
+ }, z.core.$strict>, z.ZodObject<{
55
+ type: z.ZodLiteral<"hyperdrive">;
56
+ id: z.ZodString;
57
+ localConnectionString: z.ZodOptional<z.ZodString>;
58
+ }, z.core.$strict>, z.ZodObject<{
59
+ type: z.ZodLiteral<"images">;
60
+ remote: z.ZodOptional<z.ZodBoolean>;
61
+ }, z.core.$strict>, z.ZodObject<{
62
+ type: z.ZodLiteral<"json">;
63
+ value: z.ZodJSONSchema;
64
+ }, z.core.$strict>, z.ZodObject<{
65
+ type: z.ZodLiteral<"kv">;
66
+ id: z.ZodOptional<z.ZodString>;
67
+ remote: z.ZodOptional<z.ZodBoolean>;
68
+ }, z.core.$strict>, z.ZodObject<{
69
+ type: z.ZodLiteral<"logfwdr">;
70
+ destination: z.ZodString;
71
+ }, z.core.$strict>, z.ZodObject<{
72
+ type: z.ZodLiteral<"media">;
73
+ remote: z.ZodOptional<z.ZodBoolean>;
74
+ }, z.core.$strict>, z.ZodObject<{
75
+ type: z.ZodLiteral<"mtls-certificate">;
76
+ id: z.ZodString;
77
+ remote: z.ZodOptional<z.ZodBoolean>;
78
+ }, z.core.$strict>, z.ZodObject<{
79
+ type: z.ZodLiteral<"pipeline">;
80
+ name: z.ZodString;
81
+ remote: z.ZodOptional<z.ZodBoolean>;
82
+ }, z.core.$strict>, z.ZodObject<{
83
+ type: z.ZodLiteral<"queue">;
84
+ name: z.ZodString;
85
+ deliveryDelay: z.ZodOptional<z.ZodNumber>;
86
+ remote: z.ZodOptional<z.ZodBoolean>;
87
+ }, z.core.$strict>, z.ZodObject<{
88
+ type: z.ZodLiteral<"rate-limit">;
89
+ namespace: z.ZodString;
90
+ simple: z.ZodObject<{
91
+ limit: z.ZodNumber;
92
+ period: z.ZodUnion<readonly [z.ZodLiteral<10>, z.ZodLiteral<60>]>;
93
+ }, z.core.$strict>;
94
+ }, z.core.$strict>, z.ZodObject<{
95
+ type: z.ZodLiteral<"r2">;
96
+ name: z.ZodOptional<z.ZodString>;
97
+ jurisdiction: z.ZodOptional<z.ZodString>;
98
+ remote: z.ZodOptional<z.ZodBoolean>;
99
+ }, z.core.$strict>, z.ZodObject<{
100
+ type: z.ZodLiteral<"secret">;
101
+ }, z.core.$strict>, z.ZodObject<{
102
+ type: z.ZodLiteral<"secrets-store-secret">;
103
+ storeId: z.ZodString;
104
+ secretName: z.ZodString;
105
+ }, z.core.$strict>, z.ZodObject<{
106
+ type: z.ZodLiteral<"send-email">;
107
+ destinationAddress: z.ZodOptional<z.ZodString>;
108
+ allowedDestinationAddresses: z.ZodOptional<z.ZodArray<z.ZodString>>;
109
+ allowedSenderAddresses: z.ZodOptional<z.ZodArray<z.ZodString>>;
110
+ remote: z.ZodOptional<z.ZodBoolean>;
111
+ }, z.core.$strict>, z.ZodObject<{
112
+ type: z.ZodLiteral<"stream">;
113
+ remote: z.ZodOptional<z.ZodBoolean>;
114
+ }, z.core.$strict>, z.ZodObject<{
115
+ type: z.ZodLiteral<"text">;
116
+ value: z.ZodString;
117
+ }, z.core.$strict>, z.ZodObject<{
118
+ type: z.ZodLiteral<"vectorize">;
119
+ name: z.ZodString;
120
+ remote: z.ZodOptional<z.ZodBoolean>;
121
+ }, z.core.$strict>, z.ZodObject<{
122
+ type: z.ZodLiteral<"version-metadata">;
123
+ }, z.core.$strict>, z.ZodObject<{
124
+ type: z.ZodLiteral<"vpc-service">;
125
+ id: z.ZodString;
126
+ remote: z.ZodOptional<z.ZodBoolean>;
127
+ }, z.core.$strict>, z.ZodObject<{
128
+ type: z.ZodLiteral<"vpc-network">;
129
+ tunnelId: z.ZodOptional<z.ZodString>;
130
+ networkId: z.ZodOptional<z.ZodString>;
131
+ remote: z.ZodOptional<z.ZodBoolean>;
132
+ }, z.core.$strict>, z.ZodObject<{
133
+ type: z.ZodLiteral<"web-search">;
134
+ remote: z.ZodOptional<z.ZodBoolean>;
135
+ }, z.core.$strict>, z.ZodObject<{
136
+ type: z.ZodLiteral<"worker">;
137
+ workerName: z.ZodString;
138
+ exportName: z.ZodOptional<z.ZodString>;
139
+ props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
140
+ remote: z.ZodOptional<z.ZodBoolean>;
141
+ }, z.core.$strict>, z.ZodObject<{
142
+ type: z.ZodLiteral<"worker-loader">;
143
+ }, z.core.$strict>], "type">;
144
+ declare const UnsafeBindingSchema: z.ZodObject<{
145
+ type: z.ZodTemplateLiteral<`unsafe:${string}`>;
146
+ dev: z.ZodOptional<z.ZodObject<{
147
+ plugin: z.ZodObject<{
148
+ package: z.ZodString;
149
+ name: z.ZodString;
150
+ }, z.core.$strict>;
151
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
152
+ }, z.core.$strict>>;
153
+ }, z.core.$loose>;
154
+ type BindingInput = z.input<typeof KnownBindingSchema> | z.input<typeof UnsafeBindingSchema>;
155
+ type BindingOutput = z.output<typeof KnownBindingSchema> | z.output<typeof UnsafeBindingSchema>;
156
+ /**
157
+ * Input Worker schema — the shape that user-authored `cloudflare.config.ts`
158
+ * files are validated against. Adds an optional `entrypoint` field to the
159
+ * base schema.
160
+ */
161
+ declare const InputWorkerSchema: z.ZodObject<{
162
+ name: z.ZodString;
163
+ accountId: z.ZodOptional<z.ZodString>;
164
+ compatibilityDate: z.ZodString;
165
+ compatibilityFlags: z.ZodOptional<z.ZodArray<z.ZodString>>;
166
+ assets: z.ZodOptional<z.ZodObject<{
167
+ htmlHandling: z.ZodOptional<z.ZodEnum<{
168
+ "auto-trailing-slash": "auto-trailing-slash";
169
+ "drop-trailing-slash": "drop-trailing-slash";
170
+ "force-trailing-slash": "force-trailing-slash";
171
+ none: "none";
172
+ }>>;
173
+ notFoundHandling: z.ZodOptional<z.ZodEnum<{
174
+ none: "none";
175
+ "single-page-application": "single-page-application";
176
+ "404-page": "404-page";
177
+ }>>;
178
+ runWorkerFirst: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodBoolean]>>;
179
+ }, z.core.$strict>>;
180
+ domains: z.ZodOptional<z.ZodArray<z.ZodString>>;
181
+ triggers: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
182
+ type: z.ZodLiteral<"fetch">;
183
+ pattern: z.ZodString;
184
+ zone: z.ZodOptional<z.ZodString>;
185
+ }, z.core.$strict>, z.ZodObject<{
186
+ type: z.ZodLiteral<"queue">;
187
+ name: z.ZodString;
188
+ deadLetterQueue: z.ZodOptional<z.ZodString>;
189
+ maxBatchSize: z.ZodOptional<z.ZodNumber>;
190
+ maxBatchTimeout: z.ZodOptional<z.ZodNumber>;
191
+ maxConcurrency: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
192
+ maxRetries: z.ZodOptional<z.ZodNumber>;
193
+ retryDelay: z.ZodOptional<z.ZodNumber>;
194
+ visibilityTimeoutMs: z.ZodOptional<z.ZodNumber>;
195
+ }, z.core.$strict>, z.ZodObject<{
196
+ type: z.ZodLiteral<"scheduled">;
197
+ schedule: z.ZodString;
198
+ }, z.core.$strict>], "type">>>;
199
+ tailConsumers: z.ZodOptional<z.ZodArray<z.ZodObject<{
200
+ workerName: z.ZodString;
201
+ streaming: z.ZodOptional<z.ZodBoolean>;
202
+ }, z.core.$strict>>>;
203
+ cache: z.ZodOptional<z.ZodObject<{
204
+ enabled: z.ZodBoolean;
205
+ crossVersionCache: z.ZodOptional<z.ZodBoolean>;
206
+ }, z.core.$strict>>;
207
+ placement: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
208
+ mode: z.ZodEnum<{
209
+ off: "off";
210
+ smart: "smart";
211
+ }>;
212
+ hint: z.ZodOptional<z.ZodString>;
213
+ }, z.core.$strict>, z.ZodObject<{
214
+ mode: z.ZodOptional<z.ZodLiteral<"targeted">>;
215
+ region: z.ZodString;
216
+ }, z.core.$strict>, z.ZodObject<{
217
+ mode: z.ZodOptional<z.ZodLiteral<"targeted">>;
218
+ host: z.ZodString;
219
+ }, z.core.$strict>, z.ZodObject<{
220
+ mode: z.ZodOptional<z.ZodLiteral<"targeted">>;
221
+ hostname: z.ZodString;
222
+ }, z.core.$strict>]>>;
223
+ limits: z.ZodOptional<z.ZodObject<{
224
+ cpuMs: z.ZodOptional<z.ZodNumber>;
225
+ subrequests: z.ZodOptional<z.ZodNumber>;
226
+ }, z.core.$strict>>;
227
+ logpush: z.ZodOptional<z.ZodBoolean>;
228
+ observability: z.ZodOptional<z.ZodObject<{
229
+ enabled: z.ZodOptional<z.ZodBoolean>;
230
+ headSamplingRate: z.ZodOptional<z.ZodNumber>;
231
+ logs: z.ZodOptional<z.ZodObject<{
232
+ enabled: z.ZodOptional<z.ZodBoolean>;
233
+ headSamplingRate: z.ZodOptional<z.ZodNumber>;
234
+ invocationLogs: z.ZodOptional<z.ZodBoolean>;
235
+ persist: z.ZodOptional<z.ZodBoolean>;
236
+ destinations: z.ZodOptional<z.ZodArray<z.ZodString>>;
237
+ }, z.core.$strict>>;
238
+ traces: z.ZodOptional<z.ZodObject<{
239
+ enabled: z.ZodOptional<z.ZodBoolean>;
240
+ headSamplingRate: z.ZodOptional<z.ZodNumber>;
241
+ persist: z.ZodOptional<z.ZodBoolean>;
242
+ destinations: z.ZodOptional<z.ZodArray<z.ZodString>>;
243
+ }, z.core.$strict>>;
244
+ }, z.core.$strict>>;
245
+ workersDev: z.ZodOptional<z.ZodBoolean>;
246
+ previewUrls: z.ZodOptional<z.ZodBoolean>;
247
+ complianceRegion: z.ZodOptional<z.ZodEnum<{
248
+ public: "public";
249
+ "fedramp-high": "fedramp-high";
250
+ }>>;
251
+ firstPartyWorker: z.ZodOptional<z.ZodBoolean>;
252
+ unsafe: z.ZodOptional<z.ZodObject<{
253
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
254
+ capnp: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
255
+ basePath: z.ZodString;
256
+ sourceSchemas: z.ZodArray<z.ZodString>;
257
+ compiledSchema: z.ZodOptional<z.ZodNever>;
258
+ }, z.core.$strict>, z.ZodObject<{
259
+ basePath: z.ZodOptional<z.ZodNever>;
260
+ sourceSchemas: z.ZodOptional<z.ZodNever>;
261
+ compiledSchema: z.ZodString;
262
+ }, z.core.$strict>]>>;
263
+ }, z.core.$strict>>;
264
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<BindingOutput, BindingInput, z.core.$ZodTypeInternals<BindingOutput, BindingInput>>>>;
265
+ exports: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
266
+ type: z.ZodLiteral<"durable-object">;
267
+ state: z.ZodOptional<z.ZodLiteral<"created">>;
268
+ storage: z.ZodEnum<{
269
+ sqlite: "sqlite";
270
+ "legacy-kv": "legacy-kv";
271
+ }>;
272
+ }, z.core.$strict>, z.ZodObject<{
273
+ type: z.ZodLiteral<"durable-object">;
274
+ state: z.ZodLiteral<"deleted">;
275
+ }, z.core.$strict>, z.ZodObject<{
276
+ type: z.ZodLiteral<"durable-object">;
277
+ state: z.ZodLiteral<"renamed">;
278
+ renamedTo: z.ZodString;
279
+ }, z.core.$strict>, z.ZodObject<{
280
+ type: z.ZodLiteral<"durable-object">;
281
+ state: z.ZodLiteral<"transferred">;
282
+ transferredTo: z.ZodString;
283
+ }, z.core.$strict>, z.ZodObject<{
284
+ type: z.ZodLiteral<"durable-object">;
285
+ state: z.ZodLiteral<"expecting-transfer">;
286
+ storage: z.ZodEnum<{
287
+ sqlite: "sqlite";
288
+ "legacy-kv": "legacy-kv";
289
+ }>;
290
+ transferFrom: z.ZodString;
291
+ }, z.core.$strict>, z.ZodObject<{
292
+ type: z.ZodLiteral<"worker">;
293
+ cache: z.ZodOptional<z.ZodObject<{
294
+ enabled: z.ZodBoolean;
295
+ }, z.core.$strict>>;
296
+ }, z.core.$strict>]>>>;
297
+ entrypoint: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
298
+ default: z.ZodString;
299
+ }, z.core.$strict>]>, z.ZodTransform<string, string | {
300
+ default: string;
301
+ }>>>;
302
+ }, z.core.$strict>;
303
+ type ParsedInputWorkerConfig = z.output<typeof InputWorkerSchema>;
304
+ declare const ModuleTypeSchema: z.ZodEnum<{
305
+ json: "json";
306
+ text: "text";
307
+ esm: "esm";
308
+ cjs: "cjs";
309
+ python: "python";
310
+ "python-requirement": "python-requirement";
311
+ wasm: "wasm";
312
+ data: "data";
313
+ sourcemap: "sourcemap";
314
+ }>;
315
+ type ModuleType = z.output<typeof ModuleTypeSchema>;
316
+ /**
317
+ * Output Worker schema — the shape of `worker.config.json` in the
318
+ * Build Output API. Adds an optional `manifest` field to the
319
+ * base schema.
320
+ */
321
+ declare const OutputWorkerSchema: z.ZodObject<{
322
+ name: z.ZodString;
323
+ accountId: z.ZodOptional<z.ZodString>;
324
+ compatibilityDate: z.ZodString;
325
+ compatibilityFlags: z.ZodOptional<z.ZodArray<z.ZodString>>;
326
+ assets: z.ZodOptional<z.ZodObject<{
327
+ htmlHandling: z.ZodOptional<z.ZodEnum<{
328
+ "auto-trailing-slash": "auto-trailing-slash";
329
+ "drop-trailing-slash": "drop-trailing-slash";
330
+ "force-trailing-slash": "force-trailing-slash";
331
+ none: "none";
332
+ }>>;
333
+ notFoundHandling: z.ZodOptional<z.ZodEnum<{
334
+ none: "none";
335
+ "single-page-application": "single-page-application";
336
+ "404-page": "404-page";
337
+ }>>;
338
+ runWorkerFirst: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodBoolean]>>;
339
+ }, z.core.$strict>>;
340
+ domains: z.ZodOptional<z.ZodArray<z.ZodString>>;
341
+ triggers: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
342
+ type: z.ZodLiteral<"fetch">;
343
+ pattern: z.ZodString;
344
+ zone: z.ZodOptional<z.ZodString>;
345
+ }, z.core.$strict>, z.ZodObject<{
346
+ type: z.ZodLiteral<"queue">;
347
+ name: z.ZodString;
348
+ deadLetterQueue: z.ZodOptional<z.ZodString>;
349
+ maxBatchSize: z.ZodOptional<z.ZodNumber>;
350
+ maxBatchTimeout: z.ZodOptional<z.ZodNumber>;
351
+ maxConcurrency: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
352
+ maxRetries: z.ZodOptional<z.ZodNumber>;
353
+ retryDelay: z.ZodOptional<z.ZodNumber>;
354
+ visibilityTimeoutMs: z.ZodOptional<z.ZodNumber>;
355
+ }, z.core.$strict>, z.ZodObject<{
356
+ type: z.ZodLiteral<"scheduled">;
357
+ schedule: z.ZodString;
358
+ }, z.core.$strict>], "type">>>;
359
+ tailConsumers: z.ZodOptional<z.ZodArray<z.ZodObject<{
360
+ workerName: z.ZodString;
361
+ streaming: z.ZodOptional<z.ZodBoolean>;
362
+ }, z.core.$strict>>>;
363
+ cache: z.ZodOptional<z.ZodObject<{
364
+ enabled: z.ZodBoolean;
365
+ crossVersionCache: z.ZodOptional<z.ZodBoolean>;
366
+ }, z.core.$strict>>;
367
+ placement: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
368
+ mode: z.ZodEnum<{
369
+ off: "off";
370
+ smart: "smart";
371
+ }>;
372
+ hint: z.ZodOptional<z.ZodString>;
373
+ }, z.core.$strict>, z.ZodObject<{
374
+ mode: z.ZodOptional<z.ZodLiteral<"targeted">>;
375
+ region: z.ZodString;
376
+ }, z.core.$strict>, z.ZodObject<{
377
+ mode: z.ZodOptional<z.ZodLiteral<"targeted">>;
378
+ host: z.ZodString;
379
+ }, z.core.$strict>, z.ZodObject<{
380
+ mode: z.ZodOptional<z.ZodLiteral<"targeted">>;
381
+ hostname: z.ZodString;
382
+ }, z.core.$strict>]>>;
383
+ limits: z.ZodOptional<z.ZodObject<{
384
+ cpuMs: z.ZodOptional<z.ZodNumber>;
385
+ subrequests: z.ZodOptional<z.ZodNumber>;
386
+ }, z.core.$strict>>;
387
+ logpush: z.ZodOptional<z.ZodBoolean>;
388
+ observability: z.ZodOptional<z.ZodObject<{
389
+ enabled: z.ZodOptional<z.ZodBoolean>;
390
+ headSamplingRate: z.ZodOptional<z.ZodNumber>;
391
+ logs: z.ZodOptional<z.ZodObject<{
392
+ enabled: z.ZodOptional<z.ZodBoolean>;
393
+ headSamplingRate: z.ZodOptional<z.ZodNumber>;
394
+ invocationLogs: z.ZodOptional<z.ZodBoolean>;
395
+ persist: z.ZodOptional<z.ZodBoolean>;
396
+ destinations: z.ZodOptional<z.ZodArray<z.ZodString>>;
397
+ }, z.core.$strict>>;
398
+ traces: z.ZodOptional<z.ZodObject<{
399
+ enabled: z.ZodOptional<z.ZodBoolean>;
400
+ headSamplingRate: z.ZodOptional<z.ZodNumber>;
401
+ persist: z.ZodOptional<z.ZodBoolean>;
402
+ destinations: z.ZodOptional<z.ZodArray<z.ZodString>>;
403
+ }, z.core.$strict>>;
404
+ }, z.core.$strict>>;
405
+ workersDev: z.ZodOptional<z.ZodBoolean>;
406
+ previewUrls: z.ZodOptional<z.ZodBoolean>;
407
+ complianceRegion: z.ZodOptional<z.ZodEnum<{
408
+ public: "public";
409
+ "fedramp-high": "fedramp-high";
410
+ }>>;
411
+ firstPartyWorker: z.ZodOptional<z.ZodBoolean>;
412
+ unsafe: z.ZodOptional<z.ZodObject<{
413
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
414
+ capnp: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
415
+ basePath: z.ZodString;
416
+ sourceSchemas: z.ZodArray<z.ZodString>;
417
+ compiledSchema: z.ZodOptional<z.ZodNever>;
418
+ }, z.core.$strict>, z.ZodObject<{
419
+ basePath: z.ZodOptional<z.ZodNever>;
420
+ sourceSchemas: z.ZodOptional<z.ZodNever>;
421
+ compiledSchema: z.ZodString;
422
+ }, z.core.$strict>]>>;
423
+ }, z.core.$strict>>;
424
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<BindingOutput, BindingInput, z.core.$ZodTypeInternals<BindingOutput, BindingInput>>>>;
425
+ exports: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
426
+ type: z.ZodLiteral<"durable-object">;
427
+ state: z.ZodOptional<z.ZodLiteral<"created">>;
428
+ storage: z.ZodEnum<{
429
+ sqlite: "sqlite";
430
+ "legacy-kv": "legacy-kv";
431
+ }>;
432
+ }, z.core.$strict>, z.ZodObject<{
433
+ type: z.ZodLiteral<"durable-object">;
434
+ state: z.ZodLiteral<"deleted">;
435
+ }, z.core.$strict>, z.ZodObject<{
436
+ type: z.ZodLiteral<"durable-object">;
437
+ state: z.ZodLiteral<"renamed">;
438
+ renamedTo: z.ZodString;
439
+ }, z.core.$strict>, z.ZodObject<{
440
+ type: z.ZodLiteral<"durable-object">;
441
+ state: z.ZodLiteral<"transferred">;
442
+ transferredTo: z.ZodString;
443
+ }, z.core.$strict>, z.ZodObject<{
444
+ type: z.ZodLiteral<"durable-object">;
445
+ state: z.ZodLiteral<"expecting-transfer">;
446
+ storage: z.ZodEnum<{
447
+ sqlite: "sqlite";
448
+ "legacy-kv": "legacy-kv";
449
+ }>;
450
+ transferFrom: z.ZodString;
451
+ }, z.core.$strict>, z.ZodObject<{
452
+ type: z.ZodLiteral<"worker">;
453
+ cache: z.ZodOptional<z.ZodObject<{
454
+ enabled: z.ZodBoolean;
455
+ }, z.core.$strict>>;
456
+ }, z.core.$strict>]>>>;
457
+ manifest: z.ZodOptional<z.ZodObject<{
458
+ mainModule: z.ZodString;
459
+ modules: z.ZodRecord<z.ZodString, z.ZodObject<{
460
+ type: z.ZodEnum<{
461
+ json: "json";
462
+ text: "text";
463
+ esm: "esm";
464
+ cjs: "cjs";
465
+ python: "python";
466
+ "python-requirement": "python-requirement";
467
+ wasm: "wasm";
468
+ data: "data";
469
+ sourcemap: "sourcemap";
470
+ }>;
471
+ }, z.core.$strict>>;
472
+ }, z.core.$strict>>;
473
+ }, z.core.$strict>;
474
+ type ParsedOutputWorkerConfig = z.output<typeof OutputWorkerSchema>;
475
+ //#endregion
476
+ //#region src/build-output.d.ts
477
+ /**
478
+ * Initial draft version of the Build Output API.
479
+ *
480
+ * Will move to `v1` when the spec stabilises.
481
+ */
482
+ declare const BUILD_OUTPUT_VERSION = "v0";
483
+ /**
484
+ * Project-relative root.
485
+ */
486
+ declare const BUILD_OUTPUT_ROOT = ".cloudflare/output";
487
+ /**
488
+ * Filename of the per-Worker config.
489
+ */
490
+ declare const WORKER_CONFIG_FILENAME = "worker.config.json";
491
+ /**
492
+ * Clean the build output directory.
493
+ */
494
+ declare function cleanBuildOutputDir(root: string): Promise<void>;
495
+ /**
496
+ * Absolute path to the Workers output directory.
497
+ */
498
+ declare function getWorkersDir(root: string): string;
499
+ /**
500
+ * Absolute path to the config file for a given Worker.
501
+ */
502
+ declare function getWorkerConfigPath(root: string, workerName: string): string;
503
+ /**
504
+ * Absolute path to the bundle directory for a given Worker.
505
+ */
506
+ declare function getWorkerBundleDir(root: string, workerName: string): string;
507
+ /**
508
+ * Absolute path to the assets directory for a given Worker.
509
+ */
510
+ declare function getWorkerAssetsDir(root: string, workerName: string): string;
511
+ /**
512
+ * Write the output `worker.config.json` for a given Worker to the Build
513
+ * Output API tree.
514
+ *
515
+ * - Workers mode: `manifest` is provided (bundle/ present on disk).
516
+ * - Assets-only mode: `manifest` is omitted (no bundle/ directory).
517
+ */
518
+ declare function writeOutputWorkerConfig(root: string, parsedConfig: ParsedInputWorkerConfig, manifest?: ParsedOutputWorkerConfig["manifest"]): Promise<void>;
519
+ //#endregion
520
+ //#region src/generate.d.ts
521
+ interface GenerateTypesOptions {
522
+ /** Path to the config file (relative to the generated `.d.ts`). */
523
+ configPath: string;
524
+ /**
525
+ * Package name used in the inline `import("<packageName>")` type expressions
526
+ * for `InferEnv`/`InferDurableNamespaces`/`InferMainModule`/`UnwrapConfig`.
527
+ *
528
+ * Defaults to `"@cloudflare/config"`. Integrations that bundle
529
+ * `@cloudflare/config` (e.g. `@cloudflare/vite-plugin`) should pass their
530
+ * own re-export path here so users don't need to depend on
531
+ * `@cloudflare/config` directly.
532
+ */
533
+ packageName?: string;
534
+ }
535
+ /**
536
+ * Generate the content for worker-configuration.d.ts
537
+ *
538
+ * @example
539
+ * ```typescript
540
+ * import { generateTypes } from "@cloudflare/config";
541
+ * import { writeFileSync } from "node:fs";
542
+ *
543
+ * const content = generateTypes({
544
+ * configPath: "./cloudflare.config.ts",
545
+ * });
546
+ *
547
+ * writeFileSync("worker-configuration.d.ts", content);
548
+ * ```
549
+ */
550
+ declare function generateTypes({
551
+ configPath,
552
+ packageName
553
+ }: GenerateTypesOptions): string;
554
+ //#endregion
555
+ //#region src/convert.d.ts
556
+ /**
557
+ * Convert a parsed `@cloudflare/config` config into a Wrangler `RawConfig`.
558
+ *
559
+ * The caller is responsible for unwrapping any function/promise wrapper around
560
+ * the config and validating it against `InputWorkerSchema` before passing it in.
561
+ *
562
+ * @param config The parsed (post-validation) config.
563
+ * @returns The corresponding Wrangler `RawConfig`.
564
+ */
565
+ declare function convertToWranglerConfig(config: ParsedInputWorkerConfig): RawConfig;
566
+ //#endregion
567
+ //#region src/load.d.ts
568
+ /**
569
+ * @module
570
+ *
571
+ * The no-cache import logic in this file is adapted from `import-without-cache`
572
+ * by Kevin Deng (https://github.com/sxzz/import-without-cache), published under
573
+ * the MIT License and Copyright © 2025-PRESENT Kevin Deng.
574
+ *
575
+ * See https://github.com/sxzz/import-without-cache for the original code.
576
+ */
577
+ /**
578
+ * Dynamically import a worker config file from disk.
579
+ *
580
+ * Returns the module's default export, plus the set of file paths
581
+ * imported during resolution. Callers are responsible for unwrapping
582
+ * function/promise wrappers around the returned value and validating it
583
+ * against `InputWorkerSchema`.
584
+ *
585
+ * @param configPath Filesystem path to the config file. Relative paths are
586
+ * resolved against `process.cwd()`.
587
+ */
588
+ declare function loadConfig(configPath: string): Promise<LoadConfigResult>;
589
+ interface LoadConfigResult {
590
+ /** The default export of the config module */
591
+ config: unknown;
592
+ /**
593
+ * Absolute file paths imported while resolving the config.
594
+ * `cf-worker` entrypoints are NOT included — they are
595
+ * referenced for their specifier only and changes to their source should
596
+ * not trigger a config reload.
597
+ */
598
+ dependencies: Set<string>;
599
+ }
600
+ /**
601
+ * Register Node module hooks for loading Worker configs. Idempotent —
602
+ * repeated calls return the same deregister function.
603
+ *
604
+ * - Handles `with { type: "cf-worker" }` import attributes by synthesising an
605
+ * ES module whose default export is the entrypoint specifier. Relative
606
+ * specifiers (`./`, `../`) are anchored to the importing module and emitted
607
+ * as absolute paths; bare specifiers and virtual-module specifiers pass
608
+ * through unchanged so consumers can apply their own resolution semantics.
609
+ * The referenced module is NOT loaded, is NOT executed, and is NOT added to
610
+ * the dependencies set.
611
+ * - Handles `with { cf: "no-cache" }` import attributes (set internally by
612
+ * `loadConfig`) by tagging the resolved URL with a unique UUID query
613
+ * string so Node treats each import as a fresh module. The UUID is
614
+ * propagated to all transitive imports via the parent URL, ensuring the
615
+ * entire subgraph is re-evaluated. Imports inside `node_modules` are
616
+ * skipped (treated as immutable for config purposes).
617
+ */
618
+ declare function registerConfigHooks(): () => void;
619
+ //#endregion
620
+ export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, BUILD_OUTPUT_ROOT, BUILD_OUTPUT_VERSION, Bindings, BrowserBinding, ConfigContext, D1Binding, DispatchNamespaceBinding, DurableObjectBinding, DurableObjectCreatedExport, DurableObjectDeletedExport, DurableObjectExpectingTransferExport, DurableObjectRenamedExport, DurableObjectTransferredExport, Exports, FetchTrigger, FlagshipBinding, HyperdriveBinding, ImagesBinding, InferDurableNamespaces, InferEnv, InferMainModule, InputWorkerSchema, JsonBinding, KvBinding, type LoadConfigResult, LogfwdrBinding, MediaBinding, type ModuleType, ModuleTypeSchema, MtlsCertificateBinding, OutputWorkerSchema, type ParsedInputWorkerConfig, type ParsedOutputWorkerConfig, PipelineBinding, QueueBinding, QueueConsumerTrigger, R2Binding, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, StreamBinding, TextBinding, Triggers, TypedAiBinding, TypedDurableObjectBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, TypedWorkerBinding, TypedWorkerDefinition, TypedWorkflowBinding, UnsafeBinding, UnwrapConfig, UserConfig, UserConfigExport, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WORKER_CONFIG_FILENAME, WebSearchBinding, WorkerBinding, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerLoaderBinding, WorkflowBinding, bindings, cleanBuildOutputDir, convertToWranglerConfig, defineWorker, exports, generateTypes, getWorkerAssetsDir, getWorkerBundleDir, getWorkerConfigPath, getWorkersDir, loadConfig, registerConfigHooks, resolveWorkerDefinition, triggers, writeOutputWorkerConfig };