@cloudflare/config 0.2.1 → 0.4.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/dist/index.d.mts +212 -68
- package/dist/index.mjs +912 -934
- package/dist/{public-mmLmXmLK.mjs → public-D2QZv1n6.mjs} +46 -6
- package/dist/{public-m7PNfSwY.d.mts → public-myuV_kLK.d.mts} +107 -42
- package/dist/public.d.mts +2 -2
- package/dist/public.mjs +2 -2
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as RateLimitBinding, A as AgentMemoryBinding, B as DispatchNamespaceBinding, C as exports, D as ScheduledTrigger, E as QueueConsumerTrigger, F as ArtifactsBinding, G as JsonBinding, H as FlagshipBinding, I as AssetsBinding, J as MediaBinding, K as KvBinding, L as Bindings, M as AiSearchBinding, N as AiSearchNamespaceBinding, O as Triggers, P as AnalyticsEngineDatasetBinding, Q as R2Binding, R as BrowserBinding, S as WorkerEntrypointExportOptions, T as FetchTrigger, U as HyperdriveBinding, V as DurableObjectBinding, W as ImagesBinding, X as PipelineBinding, Y as MtlsCertificateBinding, Z as QueueBinding, _ as DurableObjectExpectingTransferExport, _t as WebSearchBinding, a as InferMainModule, at as TypedAiBinding, b as Exports, bt as WorkflowBinding, c as WorkerConfigExport, ct as TypedPipelineBinding, d as SettingsConfig, dt as TypedWorkflowBinding, et as SecretBinding, f as WorkerConfig, ft as UnsafeBinding, g as DurableObjectDeletedExport, gt as VpcServiceBinding, h as DurableObjectCreatedExport, ht as VpcNetworkBinding, i as InferEnv, it as TextBinding, j as AiBinding, k as triggers, l as WorkerConfigInput, lt as TypedQueueBinding, m as resolveExportDefinition, mt as VersionMetadataBinding, n as defineSettings, nt as SendEmailBinding, o as UnwrapConfig, ot as TypedDurableObjectBinding, p as ConfigContext, pt as VectorizeBinding, q as LogfwdrBinding, r as InferDurableNamespaces, rt as StreamBinding, s as TypedWorkerDefinition, st as TypedKvBinding, t as SettingsConfigInput, tt as SecretsStoreSecretBinding, u as defineWorker, ut as TypedWorkerBinding, v as DurableObjectRenamedExport, vt as WorkerBinding, w as EmailTrigger, x as WorkerEntrypointExport, xt as bindings, y as DurableObjectTransferredExport, yt as WorkerLoaderBinding, z as D1Binding } from "./public-myuV_kLK.mjs";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import { RawConfig } from "@cloudflare/workers-utils";
|
|
4
4
|
|
|
@@ -37,7 +37,7 @@ declare const KnownBindingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
37
37
|
remote: z.ZodOptional<z.ZodBoolean>;
|
|
38
38
|
}, z.core.$strict>, z.ZodObject<{
|
|
39
39
|
type: z.ZodLiteral<"dispatch-namespace">;
|
|
40
|
-
namespace: z.ZodString
|
|
40
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
41
41
|
outbound: z.ZodOptional<z.ZodObject<{
|
|
42
42
|
workerName: z.ZodString;
|
|
43
43
|
parameters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -49,7 +49,7 @@ declare const KnownBindingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
49
49
|
exportName: z.ZodString;
|
|
50
50
|
}, z.core.$strict>, z.ZodObject<{
|
|
51
51
|
type: z.ZodLiteral<"flagship">;
|
|
52
|
-
id: z.ZodString
|
|
52
|
+
id: z.ZodOptional<z.ZodString>;
|
|
53
53
|
remote: z.ZodOptional<z.ZodBoolean>;
|
|
54
54
|
}, z.core.$strict>, z.ZodObject<{
|
|
55
55
|
type: z.ZodLiteral<"hyperdrive">;
|
|
@@ -81,7 +81,7 @@ declare const KnownBindingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
81
81
|
remote: z.ZodOptional<z.ZodBoolean>;
|
|
82
82
|
}, z.core.$strict>, z.ZodObject<{
|
|
83
83
|
type: z.ZodLiteral<"queue">;
|
|
84
|
-
name: z.ZodString
|
|
84
|
+
name: z.ZodOptional<z.ZodString>;
|
|
85
85
|
deliveryDelay: z.ZodOptional<z.ZodNumber>;
|
|
86
86
|
remote: z.ZodOptional<z.ZodBoolean>;
|
|
87
87
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -159,8 +159,8 @@ type BindingOutput = z.output<typeof KnownBindingSchema> | z.output<typeof Unsaf
|
|
|
159
159
|
* base schema.
|
|
160
160
|
*/
|
|
161
161
|
declare const InputWorkerSchema: z.ZodObject<{
|
|
162
|
+
type: z.ZodLiteral<"worker">;
|
|
162
163
|
name: z.ZodString;
|
|
163
|
-
accountId: z.ZodOptional<z.ZodString>;
|
|
164
164
|
compatibilityDate: z.ZodString;
|
|
165
165
|
compatibilityFlags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
166
166
|
assets: z.ZodOptional<z.ZodObject<{
|
|
@@ -247,10 +247,168 @@ declare const InputWorkerSchema: z.ZodObject<{
|
|
|
247
247
|
}, z.core.$strict>>;
|
|
248
248
|
workersDev: z.ZodOptional<z.ZodBoolean>;
|
|
249
249
|
previewUrls: z.ZodOptional<z.ZodBoolean>;
|
|
250
|
+
firstPartyWorker: z.ZodOptional<z.ZodBoolean>;
|
|
251
|
+
unsafe: z.ZodOptional<z.ZodObject<{
|
|
252
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
253
|
+
capnp: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
254
|
+
basePath: z.ZodString;
|
|
255
|
+
sourceSchemas: z.ZodArray<z.ZodString>;
|
|
256
|
+
compiledSchema: z.ZodOptional<z.ZodNever>;
|
|
257
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
258
|
+
basePath: z.ZodOptional<z.ZodNever>;
|
|
259
|
+
sourceSchemas: z.ZodOptional<z.ZodNever>;
|
|
260
|
+
compiledSchema: z.ZodString;
|
|
261
|
+
}, z.core.$strict>]>>;
|
|
262
|
+
}, z.core.$strict>>;
|
|
263
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<BindingOutput, BindingInput, z.core.$ZodTypeInternals<BindingOutput, BindingInput>>>>;
|
|
264
|
+
exports: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
265
|
+
type: z.ZodLiteral<"durable-object">;
|
|
266
|
+
state: z.ZodOptional<z.ZodLiteral<"created">>;
|
|
267
|
+
storage: z.ZodEnum<{
|
|
268
|
+
sqlite: "sqlite";
|
|
269
|
+
"legacy-kv": "legacy-kv";
|
|
270
|
+
}>;
|
|
271
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
272
|
+
type: z.ZodLiteral<"durable-object">;
|
|
273
|
+
state: z.ZodLiteral<"deleted">;
|
|
274
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
275
|
+
type: z.ZodLiteral<"durable-object">;
|
|
276
|
+
state: z.ZodLiteral<"renamed">;
|
|
277
|
+
renamedTo: z.ZodString;
|
|
278
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
279
|
+
type: z.ZodLiteral<"durable-object">;
|
|
280
|
+
state: z.ZodLiteral<"transferred">;
|
|
281
|
+
transferredTo: z.ZodString;
|
|
282
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
283
|
+
type: z.ZodLiteral<"durable-object">;
|
|
284
|
+
state: z.ZodLiteral<"expecting-transfer">;
|
|
285
|
+
storage: z.ZodEnum<{
|
|
286
|
+
sqlite: "sqlite";
|
|
287
|
+
"legacy-kv": "legacy-kv";
|
|
288
|
+
}>;
|
|
289
|
+
transferFrom: z.ZodString;
|
|
290
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
291
|
+
type: z.ZodLiteral<"worker">;
|
|
292
|
+
cache: z.ZodOptional<z.ZodObject<{
|
|
293
|
+
enabled: z.ZodBoolean;
|
|
294
|
+
}, z.core.$strict>>;
|
|
295
|
+
}, z.core.$strict>]>>>;
|
|
296
|
+
entrypoint: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
297
|
+
default: z.ZodString;
|
|
298
|
+
}, z.core.$strict>]>, z.ZodTransform<string, string | {
|
|
299
|
+
default: string;
|
|
300
|
+
}>>>;
|
|
301
|
+
}, z.core.$strict>;
|
|
302
|
+
type ParsedInputWorkerConfig = z.output<typeof InputWorkerSchema>;
|
|
303
|
+
/**
|
|
304
|
+
* Settings schema — validates the named `settings` export of a
|
|
305
|
+
* `cloudflare.config.ts`. Holds account/deployment settings shared by the other exports.
|
|
306
|
+
*/
|
|
307
|
+
declare const SettingsSchema: z.ZodObject<{
|
|
308
|
+
type: z.ZodLiteral<"settings">;
|
|
309
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
250
310
|
complianceRegion: z.ZodOptional<z.ZodEnum<{
|
|
251
311
|
public: "public";
|
|
252
312
|
"fedramp-high": "fedramp-high";
|
|
253
313
|
}>>;
|
|
314
|
+
}, z.core.$strict>;
|
|
315
|
+
type ParsedSettingsConfig = z.output<typeof SettingsSchema>;
|
|
316
|
+
/**
|
|
317
|
+
* Schema for the resolved config exports, keyed by export
|
|
318
|
+
* name. Each value is discriminated on its `type` field. Reserves the
|
|
319
|
+
* `settings` export name exclusively for settings configs: a `settings`
|
|
320
|
+
* config must live on the `settings` export, and the `settings` export
|
|
321
|
+
* may only hold a `settings` config.
|
|
322
|
+
*/
|
|
323
|
+
declare const ConfigExportsSchema: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
324
|
+
type: z.ZodLiteral<"worker">;
|
|
325
|
+
name: z.ZodString;
|
|
326
|
+
compatibilityDate: z.ZodString;
|
|
327
|
+
compatibilityFlags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
328
|
+
assets: z.ZodOptional<z.ZodObject<{
|
|
329
|
+
htmlHandling: z.ZodOptional<z.ZodEnum<{
|
|
330
|
+
"auto-trailing-slash": "auto-trailing-slash";
|
|
331
|
+
"drop-trailing-slash": "drop-trailing-slash";
|
|
332
|
+
"force-trailing-slash": "force-trailing-slash";
|
|
333
|
+
none: "none";
|
|
334
|
+
}>>;
|
|
335
|
+
notFoundHandling: z.ZodOptional<z.ZodEnum<{
|
|
336
|
+
none: "none";
|
|
337
|
+
"single-page-application": "single-page-application";
|
|
338
|
+
"404-page": "404-page";
|
|
339
|
+
}>>;
|
|
340
|
+
runWorkerFirst: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodBoolean]>>;
|
|
341
|
+
}, z.core.$strict>>;
|
|
342
|
+
domains: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
343
|
+
triggers: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
344
|
+
type: z.ZodLiteral<"email">;
|
|
345
|
+
addresses: z.ZodArray<z.ZodString>;
|
|
346
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
347
|
+
type: z.ZodLiteral<"fetch">;
|
|
348
|
+
pattern: z.ZodString;
|
|
349
|
+
zone: z.ZodOptional<z.ZodString>;
|
|
350
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
351
|
+
type: z.ZodLiteral<"queue">;
|
|
352
|
+
name: z.ZodString;
|
|
353
|
+
deadLetterQueue: z.ZodOptional<z.ZodString>;
|
|
354
|
+
maxBatchSize: z.ZodOptional<z.ZodNumber>;
|
|
355
|
+
maxBatchTimeout: z.ZodOptional<z.ZodNumber>;
|
|
356
|
+
maxConcurrency: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
357
|
+
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
358
|
+
retryDelay: z.ZodOptional<z.ZodNumber>;
|
|
359
|
+
visibilityTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
360
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
361
|
+
type: z.ZodLiteral<"scheduled">;
|
|
362
|
+
schedule: z.ZodString;
|
|
363
|
+
}, z.core.$strict>], "type">>>;
|
|
364
|
+
tailConsumers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
365
|
+
workerName: z.ZodString;
|
|
366
|
+
streaming: z.ZodOptional<z.ZodBoolean>;
|
|
367
|
+
}, z.core.$strict>>>;
|
|
368
|
+
cache: z.ZodOptional<z.ZodObject<{
|
|
369
|
+
enabled: z.ZodBoolean;
|
|
370
|
+
crossVersionCache: z.ZodOptional<z.ZodBoolean>;
|
|
371
|
+
}, z.core.$strict>>;
|
|
372
|
+
placement: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
373
|
+
mode: z.ZodEnum<{
|
|
374
|
+
off: "off";
|
|
375
|
+
smart: "smart";
|
|
376
|
+
}>;
|
|
377
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
378
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
379
|
+
mode: z.ZodOptional<z.ZodLiteral<"targeted">>;
|
|
380
|
+
region: z.ZodString;
|
|
381
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
382
|
+
mode: z.ZodOptional<z.ZodLiteral<"targeted">>;
|
|
383
|
+
host: z.ZodString;
|
|
384
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
385
|
+
mode: z.ZodOptional<z.ZodLiteral<"targeted">>;
|
|
386
|
+
hostname: z.ZodString;
|
|
387
|
+
}, z.core.$strict>]>>;
|
|
388
|
+
limits: z.ZodOptional<z.ZodObject<{
|
|
389
|
+
cpuMs: z.ZodOptional<z.ZodNumber>;
|
|
390
|
+
subrequests: z.ZodOptional<z.ZodNumber>;
|
|
391
|
+
}, z.core.$strict>>;
|
|
392
|
+
logpush: z.ZodOptional<z.ZodBoolean>;
|
|
393
|
+
observability: z.ZodOptional<z.ZodObject<{
|
|
394
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
395
|
+
headSamplingRate: z.ZodOptional<z.ZodNumber>;
|
|
396
|
+
logs: z.ZodOptional<z.ZodObject<{
|
|
397
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
398
|
+
headSamplingRate: z.ZodOptional<z.ZodNumber>;
|
|
399
|
+
invocationLogs: z.ZodOptional<z.ZodBoolean>;
|
|
400
|
+
persist: z.ZodOptional<z.ZodBoolean>;
|
|
401
|
+
destinations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
402
|
+
}, z.core.$strict>>;
|
|
403
|
+
traces: z.ZodOptional<z.ZodObject<{
|
|
404
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
405
|
+
headSamplingRate: z.ZodOptional<z.ZodNumber>;
|
|
406
|
+
persist: z.ZodOptional<z.ZodBoolean>;
|
|
407
|
+
destinations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
408
|
+
}, z.core.$strict>>;
|
|
409
|
+
}, z.core.$strict>>;
|
|
410
|
+
workersDev: z.ZodOptional<z.ZodBoolean>;
|
|
411
|
+
previewUrls: z.ZodOptional<z.ZodBoolean>;
|
|
254
412
|
firstPartyWorker: z.ZodOptional<z.ZodBoolean>;
|
|
255
413
|
unsafe: z.ZodOptional<z.ZodObject<{
|
|
256
414
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -302,8 +460,15 @@ declare const InputWorkerSchema: z.ZodObject<{
|
|
|
302
460
|
}, z.core.$strict>]>, z.ZodTransform<string, string | {
|
|
303
461
|
default: string;
|
|
304
462
|
}>>>;
|
|
305
|
-
}, z.core.$strict
|
|
306
|
-
type
|
|
463
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
464
|
+
type: z.ZodLiteral<"settings">;
|
|
465
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
466
|
+
complianceRegion: z.ZodOptional<z.ZodEnum<{
|
|
467
|
+
public: "public";
|
|
468
|
+
"fedramp-high": "fedramp-high";
|
|
469
|
+
}>>;
|
|
470
|
+
}, z.core.$strict>], "type">>;
|
|
471
|
+
type ParsedConfigExports = z.output<typeof ConfigExportsSchema>;
|
|
307
472
|
declare const ModuleTypeSchema: z.ZodEnum<{
|
|
308
473
|
json: "json";
|
|
309
474
|
text: "text";
|
|
@@ -317,13 +482,13 @@ declare const ModuleTypeSchema: z.ZodEnum<{
|
|
|
317
482
|
}>;
|
|
318
483
|
type ModuleType = z.output<typeof ModuleTypeSchema>;
|
|
319
484
|
/**
|
|
320
|
-
* Output Worker schema — the shape of `
|
|
321
|
-
* Build Output
|
|
485
|
+
* Output Worker schema — the shape of the Worker's `config.json` in the
|
|
486
|
+
* Build Output Specification. Adds an optional `manifest` field to the
|
|
322
487
|
* base schema.
|
|
323
488
|
*/
|
|
324
489
|
declare const OutputWorkerSchema: z.ZodObject<{
|
|
490
|
+
type: z.ZodLiteral<"worker">;
|
|
325
491
|
name: z.ZodString;
|
|
326
|
-
accountId: z.ZodOptional<z.ZodString>;
|
|
327
492
|
compatibilityDate: z.ZodString;
|
|
328
493
|
compatibilityFlags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
329
494
|
assets: z.ZodOptional<z.ZodObject<{
|
|
@@ -410,10 +575,6 @@ declare const OutputWorkerSchema: z.ZodObject<{
|
|
|
410
575
|
}, z.core.$strict>>;
|
|
411
576
|
workersDev: z.ZodOptional<z.ZodBoolean>;
|
|
412
577
|
previewUrls: z.ZodOptional<z.ZodBoolean>;
|
|
413
|
-
complianceRegion: z.ZodOptional<z.ZodEnum<{
|
|
414
|
-
public: "public";
|
|
415
|
-
"fedramp-high": "fedramp-high";
|
|
416
|
-
}>>;
|
|
417
578
|
firstPartyWorker: z.ZodOptional<z.ZodBoolean>;
|
|
418
579
|
unsafe: z.ZodOptional<z.ZodObject<{
|
|
419
580
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -479,50 +640,6 @@ declare const OutputWorkerSchema: z.ZodObject<{
|
|
|
479
640
|
}, z.core.$strict>;
|
|
480
641
|
type ParsedOutputWorkerConfig = z.output<typeof OutputWorkerSchema>;
|
|
481
642
|
//#endregion
|
|
482
|
-
//#region src/build-output.d.ts
|
|
483
|
-
/**
|
|
484
|
-
* Initial draft version of the Build Output API.
|
|
485
|
-
*
|
|
486
|
-
* Will move to `v1` when the spec stabilises.
|
|
487
|
-
*/
|
|
488
|
-
declare const BUILD_OUTPUT_VERSION = "v0";
|
|
489
|
-
/**
|
|
490
|
-
* Project-relative root.
|
|
491
|
-
*/
|
|
492
|
-
declare const BUILD_OUTPUT_ROOT = ".cloudflare/output";
|
|
493
|
-
/**
|
|
494
|
-
* Filename of the per-Worker config.
|
|
495
|
-
*/
|
|
496
|
-
declare const WORKER_CONFIG_FILENAME = "worker.config.json";
|
|
497
|
-
/**
|
|
498
|
-
* Clean the build output directory.
|
|
499
|
-
*/
|
|
500
|
-
declare function cleanBuildOutputDir(root: string): Promise<void>;
|
|
501
|
-
/**
|
|
502
|
-
* Absolute path to the Workers output directory.
|
|
503
|
-
*/
|
|
504
|
-
declare function getWorkersDir(root: string): string;
|
|
505
|
-
/**
|
|
506
|
-
* Absolute path to the config file for a given Worker.
|
|
507
|
-
*/
|
|
508
|
-
declare function getWorkerConfigPath(root: string, workerName: string): string;
|
|
509
|
-
/**
|
|
510
|
-
* Absolute path to the bundle directory for a given Worker.
|
|
511
|
-
*/
|
|
512
|
-
declare function getWorkerBundleDir(root: string, workerName: string): string;
|
|
513
|
-
/**
|
|
514
|
-
* Absolute path to the assets directory for a given Worker.
|
|
515
|
-
*/
|
|
516
|
-
declare function getWorkerAssetsDir(root: string, workerName: string): string;
|
|
517
|
-
/**
|
|
518
|
-
* Write the output `worker.config.json` for a given Worker to the Build
|
|
519
|
-
* Output API tree.
|
|
520
|
-
*
|
|
521
|
-
* - Workers mode: `manifest` is provided (bundle/ present on disk).
|
|
522
|
-
* - Assets-only mode: `manifest` is omitted (no bundle/ directory).
|
|
523
|
-
*/
|
|
524
|
-
declare function writeOutputWorkerConfig(root: string, parsedConfig: ParsedInputWorkerConfig, manifest?: ParsedOutputWorkerConfig["manifest"]): Promise<void>;
|
|
525
|
-
//#endregion
|
|
526
643
|
//#region src/generate.d.ts
|
|
527
644
|
interface GenerateTypesOptions {
|
|
528
645
|
/** Path to the config file (relative to the generated `.d.ts`). */
|
|
@@ -565,10 +682,12 @@ declare function generateTypes({
|
|
|
565
682
|
* The caller is responsible for unwrapping any function/promise wrapper around
|
|
566
683
|
* the config and validating it against `InputWorkerSchema` before passing it in.
|
|
567
684
|
*
|
|
568
|
-
* @param
|
|
685
|
+
* @param workerConfig The parsed (post-validation) Worker config.
|
|
686
|
+
* @param settingsConfig The optional parsed settings config, whose fields
|
|
687
|
+
* are merged onto the result.
|
|
569
688
|
* @returns The corresponding Wrangler `RawConfig`.
|
|
570
689
|
*/
|
|
571
|
-
declare function convertToWranglerConfig(
|
|
690
|
+
declare function convertToWranglerConfig(workerConfig: ParsedInputWorkerConfig, settingsConfig?: ParsedSettingsConfig): RawConfig;
|
|
572
691
|
//#endregion
|
|
573
692
|
//#region src/load.d.ts
|
|
574
693
|
/**
|
|
@@ -583,18 +702,26 @@ declare function convertToWranglerConfig(config: ParsedInputWorkerConfig): RawCo
|
|
|
583
702
|
/**
|
|
584
703
|
* Dynamically import a worker config file from disk.
|
|
585
704
|
*
|
|
586
|
-
* Returns the module's
|
|
587
|
-
* imported during resolution. Callers
|
|
588
|
-
* function/promise wrappers around
|
|
589
|
-
*
|
|
705
|
+
* Returns all of the module's exports (keyed by export name, including
|
|
706
|
+
* `default`), plus the set of file paths imported during resolution. Callers
|
|
707
|
+
* are responsible for unwrapping function/promise/definition wrappers around
|
|
708
|
+
* each export and validating them.
|
|
590
709
|
*
|
|
591
710
|
* @param configPath Filesystem path to the config file. Relative paths are
|
|
592
711
|
* resolved against `process.cwd()`.
|
|
712
|
+
* @param options.include When provided, only exports whose names are listed
|
|
713
|
+
* survive into the returned `exports` map. Filtering happens before any
|
|
714
|
+
* resolution or validation.
|
|
593
715
|
*/
|
|
594
|
-
declare function loadConfig(configPath: string
|
|
716
|
+
declare function loadConfig(configPath: string, options?: {
|
|
717
|
+
include?: string[];
|
|
718
|
+
}): Promise<LoadConfigResult>;
|
|
595
719
|
interface LoadConfigResult {
|
|
596
|
-
/**
|
|
597
|
-
|
|
720
|
+
/**
|
|
721
|
+
* All exports of the config module, keyed by export name (including
|
|
722
|
+
* `default`). Filtered by `options.include` when provided.
|
|
723
|
+
*/
|
|
724
|
+
exports: Record<string, unknown>;
|
|
598
725
|
/**
|
|
599
726
|
* Absolute file paths imported while resolving the config.
|
|
600
727
|
* `cf-worker` entrypoints are NOT included — they are
|
|
@@ -623,4 +750,21 @@ interface LoadConfigResult {
|
|
|
623
750
|
*/
|
|
624
751
|
declare function registerConfigHooks(): () => void;
|
|
625
752
|
//#endregion
|
|
626
|
-
|
|
753
|
+
//#region src/config-loader.d.ts
|
|
754
|
+
interface LoadAndValidateConfigResult {
|
|
755
|
+
/**
|
|
756
|
+
* Zod result for the validated exports record, keyed by JS export name.
|
|
757
|
+
* Consumers format `result.error` themselves.
|
|
758
|
+
*/
|
|
759
|
+
result: z.ZodSafeParseResult<ParsedConfigExports>;
|
|
760
|
+
/** Transitive deps imported while resolving the config (node_modules excluded). */
|
|
761
|
+
dependencies: Set<string>;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Load a `cloudflare.config.ts`, resolve all exports, and validate against {@link ConfigExportsSchema}.
|
|
765
|
+
*/
|
|
766
|
+
declare function loadAndValidateConfig(configPath: string, ctx: ConfigContext, options?: {
|
|
767
|
+
include?: string[];
|
|
768
|
+
}): Promise<LoadAndValidateConfigResult>;
|
|
769
|
+
//#endregion
|
|
770
|
+
export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, Bindings, BrowserBinding, ConfigContext, ConfigExportsSchema, D1Binding, DispatchNamespaceBinding, DurableObjectBinding, DurableObjectCreatedExport, DurableObjectDeletedExport, DurableObjectExpectingTransferExport, DurableObjectRenamedExport, DurableObjectTransferredExport, EmailTrigger, Exports, FetchTrigger, FlagshipBinding, HyperdriveBinding, ImagesBinding, InferDurableNamespaces, InferEnv, InferMainModule, InputWorkerSchema, JsonBinding, KvBinding, type LoadAndValidateConfigResult, type LoadConfigResult, LogfwdrBinding, MediaBinding, type ModuleType, ModuleTypeSchema, MtlsCertificateBinding, OutputWorkerSchema, type ParsedConfigExports, type ParsedInputWorkerConfig, type ParsedOutputWorkerConfig, type ParsedSettingsConfig, PipelineBinding, QueueBinding, QueueConsumerTrigger, R2Binding, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, SettingsConfig, SettingsConfigInput, SettingsSchema, StreamBinding, TextBinding, Triggers, TypedAiBinding, TypedDurableObjectBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, TypedWorkerBinding, TypedWorkerDefinition, TypedWorkflowBinding, UnsafeBinding, UnwrapConfig, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WebSearchBinding, WorkerBinding, WorkerConfig, WorkerConfigExport, WorkerConfigInput, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerLoaderBinding, WorkflowBinding, bindings, convertToWranglerConfig, defineSettings, defineWorker, exports, generateTypes, loadAndValidateConfig, loadConfig, registerConfigHooks, resolveExportDefinition, triggers };
|