@cloudflare/config 0.4.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 +136 -1
- package/dist/index.mjs +91 -76
- package/package.json +3 -3
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
|
|
@@ -767,4 +902,4 @@ declare function loadAndValidateConfig(configPath: string, ctx: ConfigContext, o
|
|
|
767
902
|
include?: string[];
|
|
768
903
|
}): Promise<LoadAndValidateConfigResult>;
|
|
769
904
|
//#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 };
|
|
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 };
|
package/dist/index.mjs
CHANGED
|
@@ -28,6 +28,50 @@ const AssetsSchema = z.strictObject({
|
|
|
28
28
|
]).optional(),
|
|
29
29
|
runWorkerFirst: z.union([z.array(z.string()), z.boolean()]).optional()
|
|
30
30
|
});
|
|
31
|
+
const BrowserBindingSchema = z.strictObject({
|
|
32
|
+
type: z.literal("browser"),
|
|
33
|
+
remote: z.boolean().optional()
|
|
34
|
+
});
|
|
35
|
+
const WorkerBindingSchema = z.strictObject({
|
|
36
|
+
type: z.literal("worker"),
|
|
37
|
+
workerName: z.string(),
|
|
38
|
+
exportName: z.string().optional(),
|
|
39
|
+
props: z.record(z.string(), z.unknown()).optional(),
|
|
40
|
+
remote: z.boolean().optional()
|
|
41
|
+
});
|
|
42
|
+
const D1BindingSchema = z.strictObject({
|
|
43
|
+
type: z.literal("d1"),
|
|
44
|
+
name: z.string().optional(),
|
|
45
|
+
id: z.string().optional(),
|
|
46
|
+
remote: z.boolean().optional()
|
|
47
|
+
});
|
|
48
|
+
const KVBindingSchema = z.strictObject({
|
|
49
|
+
type: z.literal("kv"),
|
|
50
|
+
id: z.string().optional(),
|
|
51
|
+
remote: z.boolean().optional()
|
|
52
|
+
});
|
|
53
|
+
const QueueBindingSchema = z.strictObject({
|
|
54
|
+
type: z.literal("queue"),
|
|
55
|
+
name: z.string().optional(),
|
|
56
|
+
deliveryDelay: z.number().optional(),
|
|
57
|
+
remote: z.boolean().optional()
|
|
58
|
+
});
|
|
59
|
+
const R2BindingSchema = z.strictObject({
|
|
60
|
+
type: z.literal("r2"),
|
|
61
|
+
name: z.string().optional(),
|
|
62
|
+
jurisdiction: z.string().optional(),
|
|
63
|
+
remote: z.boolean().optional()
|
|
64
|
+
});
|
|
65
|
+
const FlagshipBindingSchema = z.strictObject({
|
|
66
|
+
type: z.literal("flagship"),
|
|
67
|
+
id: z.string().optional(),
|
|
68
|
+
remote: z.boolean().optional()
|
|
69
|
+
});
|
|
70
|
+
const HyperdriveBindingSchema = z.strictObject({
|
|
71
|
+
type: z.literal("hyperdrive"),
|
|
72
|
+
id: z.string(),
|
|
73
|
+
localConnectionString: z.string().optional()
|
|
74
|
+
});
|
|
31
75
|
const KnownBindingSchema = z.discriminatedUnion("type", [
|
|
32
76
|
z.strictObject({
|
|
33
77
|
type: z.literal("agent-memory"),
|
|
@@ -58,16 +102,8 @@ const KnownBindingSchema = z.discriminatedUnion("type", [
|
|
|
58
102
|
remote: z.boolean().optional()
|
|
59
103
|
}),
|
|
60
104
|
z.strictObject({ type: z.literal("assets") }),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
remote: z.boolean().optional()
|
|
64
|
-
}),
|
|
65
|
-
z.strictObject({
|
|
66
|
-
type: z.literal("d1"),
|
|
67
|
-
name: z.string().optional(),
|
|
68
|
-
id: z.string().optional(),
|
|
69
|
-
remote: z.boolean().optional()
|
|
70
|
-
}),
|
|
105
|
+
BrowserBindingSchema,
|
|
106
|
+
D1BindingSchema,
|
|
71
107
|
z.strictObject({
|
|
72
108
|
type: z.literal("dispatch-namespace"),
|
|
73
109
|
namespace: z.string().optional(),
|
|
@@ -82,16 +118,8 @@ const KnownBindingSchema = z.discriminatedUnion("type", [
|
|
|
82
118
|
workerName: z.string(),
|
|
83
119
|
exportName: z.string()
|
|
84
120
|
}),
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
id: z.string().optional(),
|
|
88
|
-
remote: z.boolean().optional()
|
|
89
|
-
}),
|
|
90
|
-
z.strictObject({
|
|
91
|
-
type: z.literal("hyperdrive"),
|
|
92
|
-
id: z.string(),
|
|
93
|
-
localConnectionString: z.string().optional()
|
|
94
|
-
}),
|
|
121
|
+
FlagshipBindingSchema,
|
|
122
|
+
HyperdriveBindingSchema,
|
|
95
123
|
z.strictObject({
|
|
96
124
|
type: z.literal("images"),
|
|
97
125
|
remote: z.boolean().optional()
|
|
@@ -100,11 +128,7 @@ const KnownBindingSchema = z.discriminatedUnion("type", [
|
|
|
100
128
|
type: z.literal("json"),
|
|
101
129
|
value: z.json()
|
|
102
130
|
}),
|
|
103
|
-
|
|
104
|
-
type: z.literal("kv"),
|
|
105
|
-
id: z.string().optional(),
|
|
106
|
-
remote: z.boolean().optional()
|
|
107
|
-
}),
|
|
131
|
+
KVBindingSchema,
|
|
108
132
|
z.strictObject({
|
|
109
133
|
type: z.literal("logfwdr"),
|
|
110
134
|
destination: z.string()
|
|
@@ -123,12 +147,7 @@ const KnownBindingSchema = z.discriminatedUnion("type", [
|
|
|
123
147
|
name: z.string(),
|
|
124
148
|
remote: z.boolean().optional()
|
|
125
149
|
}),
|
|
126
|
-
|
|
127
|
-
type: z.literal("queue"),
|
|
128
|
-
name: z.string().optional(),
|
|
129
|
-
deliveryDelay: z.number().optional(),
|
|
130
|
-
remote: z.boolean().optional()
|
|
131
|
-
}),
|
|
150
|
+
QueueBindingSchema,
|
|
132
151
|
z.strictObject({
|
|
133
152
|
type: z.literal("rate-limit"),
|
|
134
153
|
namespace: z.string(),
|
|
@@ -137,12 +156,7 @@ const KnownBindingSchema = z.discriminatedUnion("type", [
|
|
|
137
156
|
period: z.union([z.literal(10), z.literal(60)])
|
|
138
157
|
})
|
|
139
158
|
}),
|
|
140
|
-
|
|
141
|
-
type: z.literal("r2"),
|
|
142
|
-
name: z.string().optional(),
|
|
143
|
-
jurisdiction: z.string().optional(),
|
|
144
|
-
remote: z.boolean().optional()
|
|
145
|
-
}),
|
|
159
|
+
R2BindingSchema,
|
|
146
160
|
z.strictObject({ type: z.literal("secret") }),
|
|
147
161
|
z.strictObject({
|
|
148
162
|
type: z.literal("secrets-store-secret"),
|
|
@@ -191,13 +205,7 @@ const KnownBindingSchema = z.discriminatedUnion("type", [
|
|
|
191
205
|
type: z.literal("web-search"),
|
|
192
206
|
remote: z.boolean().optional()
|
|
193
207
|
}),
|
|
194
|
-
|
|
195
|
-
type: z.literal("worker"),
|
|
196
|
-
workerName: z.string(),
|
|
197
|
-
exportName: z.string().optional(),
|
|
198
|
-
props: z.record(z.string(), z.unknown()).optional(),
|
|
199
|
-
remote: z.boolean().optional()
|
|
200
|
-
}),
|
|
208
|
+
WorkerBindingSchema,
|
|
201
209
|
z.strictObject({ type: z.literal("worker-loader") })
|
|
202
210
|
]);
|
|
203
211
|
const UnsafeBindingSchema = z.looseObject({
|
|
@@ -239,7 +247,7 @@ const SINGLETON_BINDING_TYPES = new Set([
|
|
|
239
247
|
"web-search"
|
|
240
248
|
]);
|
|
241
249
|
const listFormatter = new Intl.ListFormat("en-US");
|
|
242
|
-
|
|
250
|
+
function validateSingletonBindings(env, ctx) {
|
|
243
251
|
const seen = /* @__PURE__ */ new Set();
|
|
244
252
|
const duplicates = /* @__PURE__ */ new Set();
|
|
245
253
|
for (const binding of Object.values(env)) {
|
|
@@ -253,37 +261,44 @@ const EnvSchema = z.record(z.string(), BindingSchema).superRefine((env, ctx) =>
|
|
|
253
261
|
code: "custom",
|
|
254
262
|
message: `${listFormatter.format([...duplicates].sort())} bindings can only be defined once`
|
|
255
263
|
});
|
|
256
|
-
}
|
|
264
|
+
}
|
|
265
|
+
const EnvSchema = z.record(z.string(), BindingSchema).superRefine(validateSingletonBindings).optional();
|
|
266
|
+
const DurableObjectCreatedExportSchema = z.strictObject({
|
|
267
|
+
type: z.literal("durable-object"),
|
|
268
|
+
state: z.literal("created").optional(),
|
|
269
|
+
storage: z.enum(["sqlite", "legacy-kv"])
|
|
270
|
+
});
|
|
271
|
+
const DurableObjectDeletedExportSchema = z.strictObject({
|
|
272
|
+
type: z.literal("durable-object"),
|
|
273
|
+
state: z.literal("deleted")
|
|
274
|
+
});
|
|
275
|
+
const DurableObjectRenamedExportSchema = z.strictObject({
|
|
276
|
+
type: z.literal("durable-object"),
|
|
277
|
+
state: z.literal("renamed"),
|
|
278
|
+
renamedTo: z.string()
|
|
279
|
+
});
|
|
280
|
+
const DurableObjectTransferredExportSchema = z.strictObject({
|
|
281
|
+
type: z.literal("durable-object"),
|
|
282
|
+
state: z.literal("transferred"),
|
|
283
|
+
transferredTo: z.string()
|
|
284
|
+
});
|
|
285
|
+
const DurableObjectExpectingTransferExportSchema = z.strictObject({
|
|
286
|
+
type: z.literal("durable-object"),
|
|
287
|
+
state: z.literal("expecting-transfer"),
|
|
288
|
+
storage: z.enum(["sqlite", "legacy-kv"]),
|
|
289
|
+
transferFrom: z.string()
|
|
290
|
+
});
|
|
291
|
+
const WorkerEntrypointExportSchema = z.strictObject({
|
|
292
|
+
type: z.literal("worker"),
|
|
293
|
+
cache: z.strictObject({ enabled: z.boolean() }).optional()
|
|
294
|
+
});
|
|
257
295
|
const ExportSchema = z.union([
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
type: z.literal("durable-object"),
|
|
265
|
-
state: z.literal("deleted")
|
|
266
|
-
}),
|
|
267
|
-
z.strictObject({
|
|
268
|
-
type: z.literal("durable-object"),
|
|
269
|
-
state: z.literal("renamed"),
|
|
270
|
-
renamedTo: z.string()
|
|
271
|
-
}),
|
|
272
|
-
z.strictObject({
|
|
273
|
-
type: z.literal("durable-object"),
|
|
274
|
-
state: z.literal("transferred"),
|
|
275
|
-
transferredTo: z.string()
|
|
276
|
-
}),
|
|
277
|
-
z.strictObject({
|
|
278
|
-
type: z.literal("durable-object"),
|
|
279
|
-
state: z.literal("expecting-transfer"),
|
|
280
|
-
storage: z.enum(["sqlite", "legacy-kv"]),
|
|
281
|
-
transferFrom: z.string()
|
|
282
|
-
}),
|
|
283
|
-
z.strictObject({
|
|
284
|
-
type: z.literal("worker"),
|
|
285
|
-
cache: z.strictObject({ enabled: z.boolean() }).optional()
|
|
286
|
-
})
|
|
296
|
+
DurableObjectCreatedExportSchema,
|
|
297
|
+
DurableObjectDeletedExportSchema,
|
|
298
|
+
DurableObjectRenamedExportSchema,
|
|
299
|
+
DurableObjectTransferredExportSchema,
|
|
300
|
+
DurableObjectExpectingTransferExportSchema,
|
|
301
|
+
WorkerEntrypointExportSchema
|
|
287
302
|
]);
|
|
288
303
|
const LimitsSchema = z.strictObject({
|
|
289
304
|
cpuMs: z.number().optional(),
|
|
@@ -3691,4 +3706,4 @@ async function loadAndValidateConfig(configPath, ctx, options) {
|
|
|
3691
3706
|
}
|
|
3692
3707
|
|
|
3693
3708
|
//#endregion
|
|
3694
|
-
export { ConfigExportsSchema, InputWorkerSchema, ModuleTypeSchema, OutputWorkerSchema, SettingsSchema, bindings, convertToWranglerConfig, defineSettings, defineWorker, exports$1 as exports, generateTypes, loadAndValidateConfig, loadConfig, registerConfigHooks, resolveExportDefinition, triggers };
|
|
3709
|
+
export { AssetsSchema, BindingSchema, BrowserBindingSchema, ConfigExportsSchema, D1BindingSchema, DurableObjectCreatedExportSchema, DurableObjectDeletedExportSchema, DurableObjectExpectingTransferExportSchema, DurableObjectRenamedExportSchema, DurableObjectTransferredExportSchema, ExportSchema, FlagshipBindingSchema, HyperdriveBindingSchema, InputWorkerSchema, KVBindingSchema, KnownBindingSchema, ModuleTypeSchema, OutputWorkerSchema, QueueBindingSchema, R2BindingSchema, SettingsSchema, TailConsumerSchema, UnsafeBindingSchema, WorkerBindingSchema, WorkerEntrypointExportSchema, bindings, convertToWranglerConfig, defineSettings, defineWorker, exports$1 as exports, generateTypes, loadAndValidateConfig, loadConfig, registerConfigHooks, resolveExportDefinition, triggers, validateSingletonBindings };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Definitions and utilities for configuring Cloudflare Workers and related products. This is not yet stable enough for external use — APIs may change without notice.",
|
|
5
5
|
"homepage": "https://github.com/cloudflare/workers-sdk/tree/main/packages/config#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"zod": "4.4.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@cloudflare/workers-types": "^5.
|
|
34
|
+
"@cloudflare/workers-types": "^5.20260804.1",
|
|
35
35
|
"ts-dedent": "^2.2.0",
|
|
36
36
|
"tsdown": "0.16.3",
|
|
37
37
|
"typescript": "5.8.3",
|
|
38
38
|
"vitest": "4.1.0",
|
|
39
39
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
40
|
-
"@cloudflare/workers-utils": "0.
|
|
40
|
+
"@cloudflare/workers-utils": "0.31.2"
|
|
41
41
|
},
|
|
42
42
|
"workers-sdk": {
|
|
43
43
|
"prerelease": true
|