@cloudflare/config 0.4.0 → 0.6.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
|
@@ -1,8 +1,66 @@
|
|
|
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-
|
|
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-CwG0JcrK.mjs";
|
|
2
2
|
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,90 @@ 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
|
+
container: z.ZodOptional<z.ZodString>;
|
|
226
|
+
}, z.core.$strict>;
|
|
227
|
+
declare const DurableObjectDeletedExportSchema: z.ZodObject<{
|
|
228
|
+
type: z.ZodLiteral<"durable-object">;
|
|
229
|
+
state: z.ZodLiteral<"deleted">;
|
|
230
|
+
}, z.core.$strict>;
|
|
231
|
+
declare const DurableObjectRenamedExportSchema: z.ZodObject<{
|
|
232
|
+
type: z.ZodLiteral<"durable-object">;
|
|
233
|
+
state: z.ZodLiteral<"renamed">;
|
|
234
|
+
renamedTo: z.ZodString;
|
|
235
|
+
}, z.core.$strict>;
|
|
236
|
+
declare const DurableObjectTransferredExportSchema: z.ZodObject<{
|
|
237
|
+
type: z.ZodLiteral<"durable-object">;
|
|
238
|
+
state: z.ZodLiteral<"transferred">;
|
|
239
|
+
transferredTo: z.ZodString;
|
|
240
|
+
}, z.core.$strict>;
|
|
241
|
+
declare const DurableObjectExpectingTransferExportSchema: z.ZodObject<{
|
|
242
|
+
type: z.ZodLiteral<"durable-object">;
|
|
243
|
+
state: z.ZodLiteral<"expecting-transfer">;
|
|
244
|
+
storage: z.ZodEnum<{
|
|
245
|
+
sqlite: "sqlite";
|
|
246
|
+
"legacy-kv": "legacy-kv";
|
|
247
|
+
}>;
|
|
248
|
+
transferFrom: z.ZodString;
|
|
249
|
+
container: z.ZodOptional<z.ZodString>;
|
|
250
|
+
}, z.core.$strict>;
|
|
251
|
+
declare const WorkerEntrypointExportSchema: z.ZodObject<{
|
|
252
|
+
type: z.ZodLiteral<"worker">;
|
|
253
|
+
cache: z.ZodOptional<z.ZodObject<{
|
|
254
|
+
enabled: z.ZodBoolean;
|
|
255
|
+
}, z.core.$strict>>;
|
|
256
|
+
}, z.core.$strict>;
|
|
257
|
+
declare const ExportSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
258
|
+
type: z.ZodLiteral<"durable-object">;
|
|
259
|
+
state: z.ZodOptional<z.ZodLiteral<"created">>;
|
|
260
|
+
container: z.ZodOptional<z.ZodString>;
|
|
261
|
+
storage: z.ZodLiteral<"sqlite">;
|
|
262
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
263
|
+
type: z.ZodLiteral<"durable-object">;
|
|
264
|
+
state: z.ZodOptional<z.ZodLiteral<"created">>;
|
|
265
|
+
storage: z.ZodLiteral<"legacy-kv">;
|
|
266
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
267
|
+
type: z.ZodLiteral<"durable-object">;
|
|
268
|
+
state: z.ZodLiteral<"deleted">;
|
|
269
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
270
|
+
type: z.ZodLiteral<"durable-object">;
|
|
271
|
+
state: z.ZodLiteral<"renamed">;
|
|
272
|
+
renamedTo: z.ZodString;
|
|
273
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
274
|
+
type: z.ZodLiteral<"durable-object">;
|
|
275
|
+
state: z.ZodLiteral<"transferred">;
|
|
276
|
+
transferredTo: z.ZodString;
|
|
277
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
278
|
+
type: z.ZodLiteral<"durable-object">;
|
|
279
|
+
state: z.ZodLiteral<"expecting-transfer">;
|
|
280
|
+
transferFrom: z.ZodString;
|
|
281
|
+
container: z.ZodOptional<z.ZodString>;
|
|
282
|
+
storage: z.ZodLiteral<"sqlite">;
|
|
283
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
284
|
+
type: z.ZodLiteral<"durable-object">;
|
|
285
|
+
state: z.ZodLiteral<"expecting-transfer">;
|
|
286
|
+
transferFrom: z.ZodString;
|
|
287
|
+
storage: z.ZodLiteral<"legacy-kv">;
|
|
288
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
289
|
+
type: z.ZodLiteral<"worker">;
|
|
290
|
+
cache: z.ZodOptional<z.ZodObject<{
|
|
291
|
+
enabled: z.ZodBoolean;
|
|
292
|
+
}, z.core.$strict>>;
|
|
293
|
+
}, z.core.$strict>]>;
|
|
294
|
+
declare const TailConsumerSchema: z.ZodObject<{
|
|
295
|
+
workerName: z.ZodString;
|
|
296
|
+
streaming: z.ZodOptional<z.ZodBoolean>;
|
|
297
|
+
}, z.core.$strict>;
|
|
156
298
|
/**
|
|
157
299
|
* Input Worker schema — the shape that user-authored `cloudflare.config.ts`
|
|
158
300
|
* files are validated against. Adds an optional `entrypoint` field to the
|
|
@@ -264,10 +406,12 @@ declare const InputWorkerSchema: z.ZodObject<{
|
|
|
264
406
|
exports: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
265
407
|
type: z.ZodLiteral<"durable-object">;
|
|
266
408
|
state: z.ZodOptional<z.ZodLiteral<"created">>;
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
409
|
+
container: z.ZodOptional<z.ZodString>;
|
|
410
|
+
storage: z.ZodLiteral<"sqlite">;
|
|
411
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
412
|
+
type: z.ZodLiteral<"durable-object">;
|
|
413
|
+
state: z.ZodOptional<z.ZodLiteral<"created">>;
|
|
414
|
+
storage: z.ZodLiteral<"legacy-kv">;
|
|
271
415
|
}, z.core.$strict>, z.ZodObject<{
|
|
272
416
|
type: z.ZodLiteral<"durable-object">;
|
|
273
417
|
state: z.ZodLiteral<"deleted">;
|
|
@@ -282,11 +426,14 @@ declare const InputWorkerSchema: z.ZodObject<{
|
|
|
282
426
|
}, z.core.$strict>, z.ZodObject<{
|
|
283
427
|
type: z.ZodLiteral<"durable-object">;
|
|
284
428
|
state: z.ZodLiteral<"expecting-transfer">;
|
|
285
|
-
storage: z.ZodEnum<{
|
|
286
|
-
sqlite: "sqlite";
|
|
287
|
-
"legacy-kv": "legacy-kv";
|
|
288
|
-
}>;
|
|
289
429
|
transferFrom: z.ZodString;
|
|
430
|
+
container: z.ZodOptional<z.ZodString>;
|
|
431
|
+
storage: z.ZodLiteral<"sqlite">;
|
|
432
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
433
|
+
type: z.ZodLiteral<"durable-object">;
|
|
434
|
+
state: z.ZodLiteral<"expecting-transfer">;
|
|
435
|
+
transferFrom: z.ZodString;
|
|
436
|
+
storage: z.ZodLiteral<"legacy-kv">;
|
|
290
437
|
}, z.core.$strict>, z.ZodObject<{
|
|
291
438
|
type: z.ZodLiteral<"worker">;
|
|
292
439
|
cache: z.ZodOptional<z.ZodObject<{
|
|
@@ -426,10 +573,12 @@ declare const ConfigExportsSchema: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUn
|
|
|
426
573
|
exports: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
427
574
|
type: z.ZodLiteral<"durable-object">;
|
|
428
575
|
state: z.ZodOptional<z.ZodLiteral<"created">>;
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
576
|
+
container: z.ZodOptional<z.ZodString>;
|
|
577
|
+
storage: z.ZodLiteral<"sqlite">;
|
|
578
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
579
|
+
type: z.ZodLiteral<"durable-object">;
|
|
580
|
+
state: z.ZodOptional<z.ZodLiteral<"created">>;
|
|
581
|
+
storage: z.ZodLiteral<"legacy-kv">;
|
|
433
582
|
}, z.core.$strict>, z.ZodObject<{
|
|
434
583
|
type: z.ZodLiteral<"durable-object">;
|
|
435
584
|
state: z.ZodLiteral<"deleted">;
|
|
@@ -444,11 +593,14 @@ declare const ConfigExportsSchema: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUn
|
|
|
444
593
|
}, z.core.$strict>, z.ZodObject<{
|
|
445
594
|
type: z.ZodLiteral<"durable-object">;
|
|
446
595
|
state: z.ZodLiteral<"expecting-transfer">;
|
|
447
|
-
storage: z.ZodEnum<{
|
|
448
|
-
sqlite: "sqlite";
|
|
449
|
-
"legacy-kv": "legacy-kv";
|
|
450
|
-
}>;
|
|
451
596
|
transferFrom: z.ZodString;
|
|
597
|
+
container: z.ZodOptional<z.ZodString>;
|
|
598
|
+
storage: z.ZodLiteral<"sqlite">;
|
|
599
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
600
|
+
type: z.ZodLiteral<"durable-object">;
|
|
601
|
+
state: z.ZodLiteral<"expecting-transfer">;
|
|
602
|
+
transferFrom: z.ZodString;
|
|
603
|
+
storage: z.ZodLiteral<"legacy-kv">;
|
|
452
604
|
}, z.core.$strict>, z.ZodObject<{
|
|
453
605
|
type: z.ZodLiteral<"worker">;
|
|
454
606
|
cache: z.ZodOptional<z.ZodObject<{
|
|
@@ -592,10 +744,12 @@ declare const OutputWorkerSchema: z.ZodObject<{
|
|
|
592
744
|
exports: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
593
745
|
type: z.ZodLiteral<"durable-object">;
|
|
594
746
|
state: z.ZodOptional<z.ZodLiteral<"created">>;
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
747
|
+
container: z.ZodOptional<z.ZodString>;
|
|
748
|
+
storage: z.ZodLiteral<"sqlite">;
|
|
749
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
750
|
+
type: z.ZodLiteral<"durable-object">;
|
|
751
|
+
state: z.ZodOptional<z.ZodLiteral<"created">>;
|
|
752
|
+
storage: z.ZodLiteral<"legacy-kv">;
|
|
599
753
|
}, z.core.$strict>, z.ZodObject<{
|
|
600
754
|
type: z.ZodLiteral<"durable-object">;
|
|
601
755
|
state: z.ZodLiteral<"deleted">;
|
|
@@ -610,11 +764,14 @@ declare const OutputWorkerSchema: z.ZodObject<{
|
|
|
610
764
|
}, z.core.$strict>, z.ZodObject<{
|
|
611
765
|
type: z.ZodLiteral<"durable-object">;
|
|
612
766
|
state: z.ZodLiteral<"expecting-transfer">;
|
|
613
|
-
storage: z.ZodEnum<{
|
|
614
|
-
sqlite: "sqlite";
|
|
615
|
-
"legacy-kv": "legacy-kv";
|
|
616
|
-
}>;
|
|
617
767
|
transferFrom: z.ZodString;
|
|
768
|
+
container: z.ZodOptional<z.ZodString>;
|
|
769
|
+
storage: z.ZodLiteral<"sqlite">;
|
|
770
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
771
|
+
type: z.ZodLiteral<"durable-object">;
|
|
772
|
+
state: z.ZodLiteral<"expecting-transfer">;
|
|
773
|
+
transferFrom: z.ZodString;
|
|
774
|
+
storage: z.ZodLiteral<"legacy-kv">;
|
|
618
775
|
}, z.core.$strict>, z.ZodObject<{
|
|
619
776
|
type: z.ZodLiteral<"worker">;
|
|
620
777
|
cache: z.ZodOptional<z.ZodObject<{
|
|
@@ -767,4 +924,4 @@ declare function loadAndValidateConfig(configPath: string, ctx: ConfigContext, o
|
|
|
767
924
|
include?: string[];
|
|
768
925
|
}): Promise<LoadAndValidateConfigResult>;
|
|
769
926
|
//#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 };
|
|
927
|
+
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as triggers, i as exports$1, n as defineWorker, o as bindings, r as resolveExportDefinition, t as defineSettings } from "./public-
|
|
1
|
+
import { a as triggers, i as exports$1, n as defineWorker, o as bindings, r as resolveExportDefinition, t as defineSettings } from "./public-CgtRnd2s.mjs";
|
|
2
2
|
import * as nodeModule from "node:module";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
@@ -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,52 @@ 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
|
+
container: z.string().optional()
|
|
271
|
+
});
|
|
272
|
+
const DurableObjectDeletedExportSchema = z.strictObject({
|
|
273
|
+
type: z.literal("durable-object"),
|
|
274
|
+
state: z.literal("deleted")
|
|
275
|
+
});
|
|
276
|
+
const DurableObjectRenamedExportSchema = z.strictObject({
|
|
277
|
+
type: z.literal("durable-object"),
|
|
278
|
+
state: z.literal("renamed"),
|
|
279
|
+
renamedTo: z.string()
|
|
280
|
+
});
|
|
281
|
+
const DurableObjectTransferredExportSchema = z.strictObject({
|
|
282
|
+
type: z.literal("durable-object"),
|
|
283
|
+
state: z.literal("transferred"),
|
|
284
|
+
transferredTo: z.string()
|
|
285
|
+
});
|
|
286
|
+
const DurableObjectExpectingTransferExportSchema = z.strictObject({
|
|
287
|
+
type: z.literal("durable-object"),
|
|
288
|
+
state: z.literal("expecting-transfer"),
|
|
289
|
+
storage: z.enum(["sqlite", "legacy-kv"]),
|
|
290
|
+
transferFrom: z.string(),
|
|
291
|
+
container: z.string().optional()
|
|
292
|
+
});
|
|
293
|
+
const WorkerEntrypointExportSchema = z.strictObject({
|
|
294
|
+
type: z.literal("worker"),
|
|
295
|
+
cache: z.strictObject({ enabled: z.boolean() }).optional()
|
|
296
|
+
});
|
|
297
|
+
const DurableObjectCreatedSqliteExportSchema = DurableObjectCreatedExportSchema.extend({ storage: z.literal("sqlite") });
|
|
298
|
+
const DurableObjectCreatedLegacyKvExportSchema = DurableObjectCreatedExportSchema.omit({ container: true }).extend({ storage: z.literal("legacy-kv") });
|
|
299
|
+
const DurableObjectExpectingTransferSqliteExportSchema = DurableObjectExpectingTransferExportSchema.extend({ storage: z.literal("sqlite") });
|
|
300
|
+
const DurableObjectExpectingTransferLegacyKvExportSchema = DurableObjectExpectingTransferExportSchema.omit({ container: true }).extend({ storage: z.literal("legacy-kv") });
|
|
257
301
|
const ExportSchema = z.union([
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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
|
-
})
|
|
302
|
+
DurableObjectCreatedSqliteExportSchema,
|
|
303
|
+
DurableObjectCreatedLegacyKvExportSchema,
|
|
304
|
+
DurableObjectDeletedExportSchema,
|
|
305
|
+
DurableObjectRenamedExportSchema,
|
|
306
|
+
DurableObjectTransferredExportSchema,
|
|
307
|
+
DurableObjectExpectingTransferSqliteExportSchema,
|
|
308
|
+
DurableObjectExpectingTransferLegacyKvExportSchema,
|
|
309
|
+
WorkerEntrypointExportSchema
|
|
287
310
|
]);
|
|
288
311
|
const LimitsSchema = z.strictObject({
|
|
289
312
|
cpuMs: z.number().optional(),
|
|
@@ -544,17 +567,54 @@ var __name = (target, value) => __defProp(target, "name", {
|
|
|
544
567
|
});
|
|
545
568
|
|
|
546
569
|
//#endregion
|
|
547
|
-
//#region ../workers-utils/dist/chunk-
|
|
570
|
+
//#region ../workers-utils/dist/chunk-QFKPUV4H.mjs
|
|
571
|
+
function hasKnownExportType(entry) {
|
|
572
|
+
const type = entry?.type;
|
|
573
|
+
return type === "durable-object" || type === "worker";
|
|
574
|
+
}
|
|
575
|
+
__name(hasKnownExportType, "hasKnownExportType");
|
|
548
576
|
function partitionExports(exports$2) {
|
|
549
577
|
const partitioned = {
|
|
550
578
|
"durable-object": {},
|
|
551
579
|
worker: {}
|
|
552
580
|
};
|
|
553
581
|
if (exports$2 === void 0) return partitioned;
|
|
554
|
-
for (const [name, entry] of Object.entries(exports$2))
|
|
582
|
+
for (const [name, entry] of Object.entries(exports$2)) {
|
|
583
|
+
if (!hasKnownExportType(entry)) continue;
|
|
584
|
+
partitioned[entry.type][name] = entry;
|
|
585
|
+
}
|
|
555
586
|
return partitioned;
|
|
556
587
|
}
|
|
557
588
|
__name(partitionExports, "partitionExports");
|
|
589
|
+
function getDurableObjectExports(exports$2) {
|
|
590
|
+
return partitionExports(exports$2)["durable-object"];
|
|
591
|
+
}
|
|
592
|
+
__name(getDurableObjectExports, "getDurableObjectExports");
|
|
593
|
+
function hasDurableObjectExports(exports$2) {
|
|
594
|
+
return Object.keys(getDurableObjectExports(exports$2)).length > 0;
|
|
595
|
+
}
|
|
596
|
+
__name(hasDurableObjectExports, "hasDurableObjectExports");
|
|
597
|
+
function getContainerNameToClassNameMap(exports$2) {
|
|
598
|
+
const containerNameToClassName = /* @__PURE__ */ new Map();
|
|
599
|
+
for (const [className, entry] of Object.entries(getDurableObjectExports(exports$2))) if ("container" in entry && typeof entry.container === "string" && !containerNameToClassName.has(entry.container)) containerNameToClassName.set(entry.container, className);
|
|
600
|
+
return containerNameToClassName;
|
|
601
|
+
}
|
|
602
|
+
__name(getContainerNameToClassNameMap, "getContainerNameToClassNameMap");
|
|
603
|
+
function resolveContainerClassName(container, exports$2) {
|
|
604
|
+
if (container.class_name !== void 0) return container.class_name;
|
|
605
|
+
if (container.name === void 0) return;
|
|
606
|
+
return getContainerNameToClassNameMap(exports$2).get(container.name);
|
|
607
|
+
}
|
|
608
|
+
__name(resolveContainerClassName, "resolveContainerClassName");
|
|
609
|
+
function getContainerDurableObjectClassNames(containers, exports$2) {
|
|
610
|
+
const classNames = /* @__PURE__ */ new Set();
|
|
611
|
+
for (const container of containers ?? []) {
|
|
612
|
+
const className = resolveContainerClassName(container, exports$2);
|
|
613
|
+
if (className !== void 0) classNames.add(className);
|
|
614
|
+
}
|
|
615
|
+
return classNames;
|
|
616
|
+
}
|
|
617
|
+
__name(getContainerDurableObjectClassNames, "getContainerDurableObjectClassNames");
|
|
558
618
|
var UserError = class extends Error {
|
|
559
619
|
static {
|
|
560
620
|
__name(this, "UserError");
|
|
@@ -3435,7 +3495,8 @@ function convertExports(config, result) {
|
|
|
3435
3495
|
case "created":
|
|
3436
3496
|
converted[exportName] = {
|
|
3437
3497
|
type: "durable-object",
|
|
3438
|
-
storage: value.storage
|
|
3498
|
+
storage: value.storage,
|
|
3499
|
+
...value.storage === "sqlite" && value.container !== void 0 && { container: value.container }
|
|
3439
3500
|
};
|
|
3440
3501
|
break;
|
|
3441
3502
|
case "deleted":
|
|
@@ -3463,7 +3524,8 @@ function convertExports(config, result) {
|
|
|
3463
3524
|
type: "durable-object",
|
|
3464
3525
|
state: "expecting-transfer",
|
|
3465
3526
|
storage: value.storage,
|
|
3466
|
-
transfer_from: value.transferFrom
|
|
3527
|
+
transfer_from: value.transferFrom,
|
|
3528
|
+
...value.storage === "sqlite" && value.container !== void 0 && { container: value.container }
|
|
3467
3529
|
};
|
|
3468
3530
|
break;
|
|
3469
3531
|
}
|
|
@@ -3691,4 +3753,4 @@ async function loadAndValidateConfig(configPath, ctx, options) {
|
|
|
3691
3753
|
}
|
|
3692
3754
|
|
|
3693
3755
|
//#endregion
|
|
3694
|
-
export { ConfigExportsSchema, InputWorkerSchema, ModuleTypeSchema, OutputWorkerSchema, SettingsSchema, bindings, convertToWranglerConfig, defineSettings, defineWorker, exports$1 as exports, generateTypes, loadAndValidateConfig, loadConfig, registerConfigHooks, resolveExportDefinition, triggers };
|
|
3756
|
+
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 };
|
|
@@ -193,6 +193,7 @@ function worker(options = {}) {
|
|
|
193
193
|
* export default defineWorker({
|
|
194
194
|
* exports: {
|
|
195
195
|
* MyDurableObject: exports.durableObject({ storage: "sqlite" }),
|
|
196
|
+
* MyContainerDO: exports.durableObject({ storage: "sqlite", container: "my-container" }),
|
|
196
197
|
* OldClass: exports.durableObject({ state: "deleted" }),
|
|
197
198
|
* OldName: exports.durableObject({ state: "renamed", renamedTo: "NewName" }),
|
|
198
199
|
* Outgoing: exports.durableObject({ state: "transferred", transferredTo: "target-worker" }),
|
|
@@ -859,6 +859,27 @@ interface Triggers {
|
|
|
859
859
|
declare const triggers: Triggers;
|
|
860
860
|
//#endregion
|
|
861
861
|
//#region src/exports.d.ts
|
|
862
|
+
/**
|
|
863
|
+
* Storage backend for the Durable Object.
|
|
864
|
+
*
|
|
865
|
+
* Containers are only supported on the SQLite storage engine, so `container` is
|
|
866
|
+
* only offered alongside `storage: "sqlite"`.
|
|
867
|
+
*/
|
|
868
|
+
type DurableObjectStorageOptions = {
|
|
869
|
+
/**
|
|
870
|
+
* Selects the SQLite-backed storage engine (recommended for new
|
|
871
|
+
* classes).
|
|
872
|
+
*/
|
|
873
|
+
storage: "sqlite";
|
|
874
|
+
/**
|
|
875
|
+
* Attach a container to this Durable Object, by container name. The
|
|
876
|
+
* name must match an entry in the top level `containers` array.
|
|
877
|
+
*/
|
|
878
|
+
container?: string;
|
|
879
|
+
} | {
|
|
880
|
+
/** Selects the legacy key-value storage engine. */
|
|
881
|
+
storage: "legacy-kv";
|
|
882
|
+
};
|
|
862
883
|
/**
|
|
863
884
|
* Declares a provisioned Durable Object class exported from this Worker.
|
|
864
885
|
*
|
|
@@ -867,17 +888,9 @@ declare const triggers: Triggers;
|
|
|
867
888
|
*
|
|
868
889
|
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
|
|
869
890
|
*/
|
|
870
|
-
|
|
891
|
+
type DurableObjectCreatedExportOptions = {
|
|
871
892
|
state?: "created";
|
|
872
|
-
|
|
873
|
-
* Storage backend for the Durable Object.
|
|
874
|
-
*
|
|
875
|
-
* - `"sqlite"`: selects the SQLite-backed storage engine
|
|
876
|
-
* (recommended for new classes).
|
|
877
|
-
* - `"legacy-kv"`: selects the legacy key-value storage engine.
|
|
878
|
-
*/
|
|
879
|
-
storage: "sqlite" | "legacy-kv";
|
|
880
|
-
}
|
|
893
|
+
} & DurableObjectStorageOptions;
|
|
881
894
|
/**
|
|
882
895
|
* Retire a provisioned Durable Object namespace whose class has
|
|
883
896
|
* been removed from code.
|
|
@@ -917,17 +930,16 @@ interface DurableObjectTransferredExportOptions {
|
|
|
917
930
|
* Prepare to receive cross-Worker Durable Object transfer.
|
|
918
931
|
* Once the source Worker's `transferred` export is deployed, this entry becomes a normal live `durable-object` export.
|
|
919
932
|
*/
|
|
920
|
-
|
|
933
|
+
type DurableObjectExpectingTransferExportOptions = {
|
|
921
934
|
state: "expecting-transfer";
|
|
922
|
-
storage: "sqlite" | "legacy-kv";
|
|
923
935
|
/**
|
|
924
936
|
* The source Worker for the two-phase cross-Worker transfer.
|
|
925
937
|
*/
|
|
926
938
|
transferFrom: string;
|
|
927
|
-
}
|
|
928
|
-
|
|
939
|
+
} & DurableObjectStorageOptions;
|
|
940
|
+
type DurableObjectCreatedExport = DurableObjectCreatedExportOptions & {
|
|
929
941
|
type: "durable-object";
|
|
930
|
-
}
|
|
942
|
+
};
|
|
931
943
|
interface DurableObjectDeletedExport extends DurableObjectDeletedExportOptions {
|
|
932
944
|
type: "durable-object";
|
|
933
945
|
}
|
|
@@ -937,9 +949,9 @@ interface DurableObjectRenamedExport extends DurableObjectRenamedExportOptions {
|
|
|
937
949
|
interface DurableObjectTransferredExport extends DurableObjectTransferredExportOptions {
|
|
938
950
|
type: "durable-object";
|
|
939
951
|
}
|
|
940
|
-
|
|
952
|
+
type DurableObjectExpectingTransferExport = DurableObjectExpectingTransferExportOptions & {
|
|
941
953
|
type: "durable-object";
|
|
942
|
-
}
|
|
954
|
+
};
|
|
943
955
|
type DurableObjectExportOptions = DurableObjectCreatedExportOptions | DurableObjectDeletedExportOptions | DurableObjectRenamedExportOptions | DurableObjectTransferredExportOptions | DurableObjectExpectingTransferExportOptions;
|
|
944
956
|
type DurableObjectExports = DurableObjectCreatedExport | DurableObjectDeletedExport | DurableObjectRenamedExport | DurableObjectTransferredExport | DurableObjectExpectingTransferExport;
|
|
945
957
|
interface WorkerEntrypointExportOptions {
|
|
@@ -996,6 +1008,7 @@ interface Exports {
|
|
|
996
1008
|
* export default defineWorker({
|
|
997
1009
|
* exports: {
|
|
998
1010
|
* MyDurableObject: exports.durableObject({ storage: "sqlite" }),
|
|
1011
|
+
* MyContainerDO: exports.durableObject({ storage: "sqlite", container: "my-container" }),
|
|
999
1012
|
* OldClass: exports.durableObject({ state: "deleted" }),
|
|
1000
1013
|
* OldName: exports.durableObject({ state: "renamed", renamedTo: "NewName" }),
|
|
1001
1014
|
* Outgoing: exports.durableObject({ state: "transferred", transferredTo: "target-worker" }),
|
package/dist/public.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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, 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-
|
|
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, 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-CwG0JcrK.mjs";
|
|
2
2
|
export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, Bindings, BrowserBinding, ConfigContext, D1Binding, DispatchNamespaceBinding, DurableObjectBinding, DurableObjectCreatedExport, DurableObjectDeletedExport, DurableObjectExpectingTransferExport, DurableObjectRenamedExport, DurableObjectTransferredExport, EmailTrigger, Exports, FetchTrigger, FlagshipBinding, HyperdriveBinding, ImagesBinding, InferDurableNamespaces, InferEnv, InferMainModule, JsonBinding, KvBinding, LogfwdrBinding, MediaBinding, MtlsCertificateBinding, PipelineBinding, QueueBinding, QueueConsumerTrigger, R2Binding, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, SettingsConfig, SettingsConfigInput, 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, defineSettings, defineWorker, exports, triggers };
|
package/dist/public.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as triggers, i as exports, n as defineWorker, o as bindings, t as defineSettings } from "./public-
|
|
1
|
+
import { a as triggers, i as exports, n as defineWorker, o as bindings, t as defineSettings } from "./public-CgtRnd2s.mjs";
|
|
2
2
|
|
|
3
3
|
export { bindings, defineSettings, defineWorker, exports, triggers };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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.20260815.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
|
-
"@cloudflare/workers-
|
|
40
|
-
"@cloudflare/workers-
|
|
39
|
+
"@cloudflare/workers-utils": "0.33.1",
|
|
40
|
+
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
41
41
|
},
|
|
42
42
|
"workers-sdk": {
|
|
43
43
|
"prerelease": true
|