@cloudflare/config 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -3,6 +3,64 @@ import * as z from "zod";
3
3
  import { RawConfig } from "@cloudflare/workers-utils";
4
4
 
5
5
  //#region src/schema.d.ts
6
+ declare const AssetsSchema: z.ZodObject<{
7
+ htmlHandling: z.ZodOptional<z.ZodEnum<{
8
+ "auto-trailing-slash": "auto-trailing-slash";
9
+ "drop-trailing-slash": "drop-trailing-slash";
10
+ "force-trailing-slash": "force-trailing-slash";
11
+ none: "none";
12
+ }>>;
13
+ notFoundHandling: z.ZodOptional<z.ZodEnum<{
14
+ none: "none";
15
+ "single-page-application": "single-page-application";
16
+ "404-page": "404-page";
17
+ }>>;
18
+ runWorkerFirst: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodBoolean]>>;
19
+ }, z.core.$strict>;
20
+ declare const BrowserBindingSchema: z.ZodObject<{
21
+ type: z.ZodLiteral<"browser">;
22
+ remote: z.ZodOptional<z.ZodBoolean>;
23
+ }, z.core.$strict>;
24
+ declare const WorkerBindingSchema: z.ZodObject<{
25
+ type: z.ZodLiteral<"worker">;
26
+ workerName: z.ZodString;
27
+ exportName: z.ZodOptional<z.ZodString>;
28
+ props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
29
+ remote: z.ZodOptional<z.ZodBoolean>;
30
+ }, z.core.$strict>;
31
+ declare const D1BindingSchema: z.ZodObject<{
32
+ type: z.ZodLiteral<"d1">;
33
+ name: z.ZodOptional<z.ZodString>;
34
+ id: z.ZodOptional<z.ZodString>;
35
+ remote: z.ZodOptional<z.ZodBoolean>;
36
+ }, z.core.$strict>;
37
+ declare const KVBindingSchema: z.ZodObject<{
38
+ type: z.ZodLiteral<"kv">;
39
+ id: z.ZodOptional<z.ZodString>;
40
+ remote: z.ZodOptional<z.ZodBoolean>;
41
+ }, z.core.$strict>;
42
+ declare const QueueBindingSchema: z.ZodObject<{
43
+ type: z.ZodLiteral<"queue">;
44
+ name: z.ZodOptional<z.ZodString>;
45
+ deliveryDelay: z.ZodOptional<z.ZodNumber>;
46
+ remote: z.ZodOptional<z.ZodBoolean>;
47
+ }, z.core.$strict>;
48
+ declare const R2BindingSchema: z.ZodObject<{
49
+ type: z.ZodLiteral<"r2">;
50
+ name: z.ZodOptional<z.ZodString>;
51
+ jurisdiction: z.ZodOptional<z.ZodString>;
52
+ remote: z.ZodOptional<z.ZodBoolean>;
53
+ }, z.core.$strict>;
54
+ declare const FlagshipBindingSchema: z.ZodObject<{
55
+ type: z.ZodLiteral<"flagship">;
56
+ id: z.ZodOptional<z.ZodString>;
57
+ remote: z.ZodOptional<z.ZodBoolean>;
58
+ }, z.core.$strict>;
59
+ declare const HyperdriveBindingSchema: z.ZodObject<{
60
+ type: z.ZodLiteral<"hyperdrive">;
61
+ id: z.ZodString;
62
+ localConnectionString: z.ZodOptional<z.ZodString>;
63
+ }, z.core.$strict>;
6
64
  declare const KnownBindingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7
65
  type: z.ZodLiteral<"agent-memory">;
8
66
  namespace: z.ZodString;
@@ -153,6 +211,83 @@ declare const UnsafeBindingSchema: z.ZodObject<{
153
211
  }, z.core.$loose>;
154
212
  type BindingInput = z.input<typeof KnownBindingSchema> | z.input<typeof UnsafeBindingSchema>;
155
213
  type BindingOutput = z.output<typeof KnownBindingSchema> | z.output<typeof UnsafeBindingSchema>;
214
+ declare const BindingSchema: z.ZodType<BindingOutput, BindingInput>;
215
+ declare function validateSingletonBindings(env: Record<string, {
216
+ type: string;
217
+ }>, ctx: z.RefinementCtx): void;
218
+ declare const DurableObjectCreatedExportSchema: z.ZodObject<{
219
+ type: z.ZodLiteral<"durable-object">;
220
+ state: z.ZodOptional<z.ZodLiteral<"created">>;
221
+ storage: z.ZodEnum<{
222
+ sqlite: "sqlite";
223
+ "legacy-kv": "legacy-kv";
224
+ }>;
225
+ }, z.core.$strict>;
226
+ declare const DurableObjectDeletedExportSchema: z.ZodObject<{
227
+ type: z.ZodLiteral<"durable-object">;
228
+ state: z.ZodLiteral<"deleted">;
229
+ }, z.core.$strict>;
230
+ declare const DurableObjectRenamedExportSchema: z.ZodObject<{
231
+ type: z.ZodLiteral<"durable-object">;
232
+ state: z.ZodLiteral<"renamed">;
233
+ renamedTo: z.ZodString;
234
+ }, z.core.$strict>;
235
+ declare const DurableObjectTransferredExportSchema: z.ZodObject<{
236
+ type: z.ZodLiteral<"durable-object">;
237
+ state: z.ZodLiteral<"transferred">;
238
+ transferredTo: z.ZodString;
239
+ }, z.core.$strict>;
240
+ declare const DurableObjectExpectingTransferExportSchema: z.ZodObject<{
241
+ type: z.ZodLiteral<"durable-object">;
242
+ state: z.ZodLiteral<"expecting-transfer">;
243
+ storage: z.ZodEnum<{
244
+ sqlite: "sqlite";
245
+ "legacy-kv": "legacy-kv";
246
+ }>;
247
+ transferFrom: z.ZodString;
248
+ }, z.core.$strict>;
249
+ declare const WorkerEntrypointExportSchema: z.ZodObject<{
250
+ type: z.ZodLiteral<"worker">;
251
+ cache: z.ZodOptional<z.ZodObject<{
252
+ enabled: z.ZodBoolean;
253
+ }, z.core.$strict>>;
254
+ }, z.core.$strict>;
255
+ declare const ExportSchema: z.ZodUnion<readonly [z.ZodObject<{
256
+ type: z.ZodLiteral<"durable-object">;
257
+ state: z.ZodOptional<z.ZodLiteral<"created">>;
258
+ storage: z.ZodEnum<{
259
+ sqlite: "sqlite";
260
+ "legacy-kv": "legacy-kv";
261
+ }>;
262
+ }, z.core.$strict>, z.ZodObject<{
263
+ type: z.ZodLiteral<"durable-object">;
264
+ state: z.ZodLiteral<"deleted">;
265
+ }, z.core.$strict>, z.ZodObject<{
266
+ type: z.ZodLiteral<"durable-object">;
267
+ state: z.ZodLiteral<"renamed">;
268
+ renamedTo: z.ZodString;
269
+ }, z.core.$strict>, z.ZodObject<{
270
+ type: z.ZodLiteral<"durable-object">;
271
+ state: z.ZodLiteral<"transferred">;
272
+ transferredTo: z.ZodString;
273
+ }, z.core.$strict>, z.ZodObject<{
274
+ type: z.ZodLiteral<"durable-object">;
275
+ state: z.ZodLiteral<"expecting-transfer">;
276
+ storage: z.ZodEnum<{
277
+ sqlite: "sqlite";
278
+ "legacy-kv": "legacy-kv";
279
+ }>;
280
+ transferFrom: z.ZodString;
281
+ }, z.core.$strict>, z.ZodObject<{
282
+ type: z.ZodLiteral<"worker">;
283
+ cache: z.ZodOptional<z.ZodObject<{
284
+ enabled: z.ZodBoolean;
285
+ }, z.core.$strict>>;
286
+ }, z.core.$strict>]>;
287
+ declare const TailConsumerSchema: z.ZodObject<{
288
+ workerName: z.ZodString;
289
+ streaming: z.ZodOptional<z.ZodBoolean>;
290
+ }, z.core.$strict>;
156
291
  /**
157
292
  * Input Worker schema — the shape that user-authored `cloudflare.config.ts`
158
293
  * files are validated against. Adds an optional `entrypoint` field to the
@@ -482,8 +617,8 @@ declare const ModuleTypeSchema: z.ZodEnum<{
482
617
  }>;
483
618
  type ModuleType = z.output<typeof ModuleTypeSchema>;
484
619
  /**
485
- * Output Worker schema — the shape of `worker.config.json` in the
486
- * Build Output API. Adds an optional `manifest` field to the
620
+ * Output Worker schema — the shape of the Worker's `config.json` in the
621
+ * Build Output Specification. Adds an optional `manifest` field to the
487
622
  * base schema.
488
623
  */
489
624
  declare const OutputWorkerSchema: z.ZodObject<{
@@ -640,63 +775,6 @@ declare const OutputWorkerSchema: z.ZodObject<{
640
775
  }, z.core.$strict>;
641
776
  type ParsedOutputWorkerConfig = z.output<typeof OutputWorkerSchema>;
642
777
  //#endregion
643
- //#region src/build-output.d.ts
644
- /**
645
- * Initial draft version of the Build Output API.
646
- *
647
- * Will move to `v1` when the spec stabilises.
648
- */
649
- declare const BUILD_OUTPUT_VERSION = "v0";
650
- /**
651
- * Project-relative root.
652
- */
653
- declare const BUILD_OUTPUT_ROOT = ".cloudflare/output";
654
- /**
655
- * Filename of the top-level (root) config holding shared settings.
656
- */
657
- declare const ROOT_CONFIG_FILENAME = "config.json";
658
- /**
659
- * Filename of the per-Worker config.
660
- */
661
- declare const WORKER_CONFIG_FILENAME = "worker.config.json";
662
- /**
663
- * Absolute path to the top-level `config.json` for the current project.
664
- */
665
- declare function getRootConfigPath(root: string): string;
666
- /**
667
- * Clean the build output directory.
668
- */
669
- declare function cleanBuildOutputDir(root: string): Promise<void>;
670
- /**
671
- * Absolute path to the Workers output directory.
672
- */
673
- declare function getWorkersDir(root: string): string;
674
- /**
675
- * Absolute path to the config file for a given Worker.
676
- */
677
- declare function getWorkerConfigPath(root: string, workerName: string): string;
678
- /**
679
- * Absolute path to the bundle directory for a given Worker.
680
- */
681
- declare function getWorkerBundleDir(root: string, workerName: string): string;
682
- /**
683
- * Absolute path to the assets directory for a given Worker.
684
- */
685
- declare function getWorkerAssetsDir(root: string, workerName: string): string;
686
- /**
687
- * Write the output `worker.config.json` for a given Worker to the Build
688
- * Output API tree.
689
- *
690
- * - Workers mode: `manifest` is provided (bundle/ present on disk).
691
- * - Assets-only mode: `manifest` is omitted (no bundle/ directory).
692
- */
693
- declare function writeOutputWorkerConfig(root: string, parsedConfig: ParsedInputWorkerConfig, manifest?: ParsedOutputWorkerConfig["manifest"]): Promise<void>;
694
- /**
695
- * Write the top-level `config.json` holding shared settings to the Build
696
- * Output API tree.
697
- */
698
- declare function writeRootOutputConfig(root: string, settings: ParsedSettingsConfig): Promise<void>;
699
- //#endregion
700
778
  //#region src/generate.d.ts
701
779
  interface GenerateTypesOptions {
702
780
  /** Path to the config file (relative to the generated `.d.ts`). */
@@ -824,4 +902,4 @@ declare function loadAndValidateConfig(configPath: string, ctx: ConfigContext, o
824
902
  include?: string[];
825
903
  }): Promise<LoadAndValidateConfigResult>;
826
904
  //#endregion
827
- export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, BUILD_OUTPUT_ROOT, BUILD_OUTPUT_VERSION, 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, ROOT_CONFIG_FILENAME, 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, WORKER_CONFIG_FILENAME, WebSearchBinding, WorkerBinding, WorkerConfig, WorkerConfigExport, WorkerConfigInput, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerLoaderBinding, WorkflowBinding, bindings, cleanBuildOutputDir, convertToWranglerConfig, defineSettings, defineWorker, exports, generateTypes, getRootConfigPath, getWorkerAssetsDir, getWorkerBundleDir, getWorkerConfigPath, getWorkersDir, loadAndValidateConfig, loadConfig, registerConfigHooks, resolveExportDefinition, triggers, writeOutputWorkerConfig, writeRootOutputConfig };
905
+ export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, AssetsSchema, BindingSchema, Bindings, BrowserBinding, BrowserBindingSchema, ConfigContext, ConfigExportsSchema, D1Binding, D1BindingSchema, DispatchNamespaceBinding, DurableObjectBinding, DurableObjectCreatedExport, DurableObjectCreatedExportSchema, DurableObjectDeletedExport, DurableObjectDeletedExportSchema, DurableObjectExpectingTransferExport, DurableObjectExpectingTransferExportSchema, DurableObjectRenamedExport, DurableObjectRenamedExportSchema, DurableObjectTransferredExport, DurableObjectTransferredExportSchema, EmailTrigger, ExportSchema, Exports, FetchTrigger, FlagshipBinding, FlagshipBindingSchema, HyperdriveBinding, HyperdriveBindingSchema, ImagesBinding, InferDurableNamespaces, InferEnv, InferMainModule, InputWorkerSchema, JsonBinding, KVBindingSchema, KnownBindingSchema, KvBinding, type LoadAndValidateConfigResult, type LoadConfigResult, LogfwdrBinding, MediaBinding, type ModuleType, ModuleTypeSchema, MtlsCertificateBinding, OutputWorkerSchema, type ParsedConfigExports, type ParsedInputWorkerConfig, type ParsedOutputWorkerConfig, type ParsedSettingsConfig, PipelineBinding, QueueBinding, QueueBindingSchema, QueueConsumerTrigger, R2Binding, R2BindingSchema, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, SettingsConfig, SettingsConfigInput, SettingsSchema, StreamBinding, TailConsumerSchema, TextBinding, Triggers, TypedAiBinding, TypedDurableObjectBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, TypedWorkerBinding, TypedWorkerDefinition, TypedWorkflowBinding, UnsafeBinding, UnsafeBindingSchema, UnwrapConfig, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WebSearchBinding, WorkerBinding, WorkerBindingSchema, WorkerConfig, WorkerConfigExport, WorkerConfigInput, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerEntrypointExportSchema, WorkerLoaderBinding, WorkflowBinding, bindings, convertToWranglerConfig, defineSettings, defineWorker, exports, generateTypes, loadAndValidateConfig, loadConfig, registerConfigHooks, resolveExportDefinition, triggers, validateSingletonBindings };