@cloudflare/config 0.14.0 → 0.15.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 +21 -27
- package/dist/index.mjs +33 -7
- package/dist/{public-Mr8YPLNL.d.mts → public-CFsFemEv.d.mts} +27 -17
- package/dist/public.d.mts +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as WorkerConfig, A as SecretsStoreSecretBinding, B as VersionMetadataBinding, C as MediaBinding, Ct as UnwrapConfig, D as R2Binding, E as QueueBinding, F as TypedKvBinding, G as WorkerReference, H as VpcServiceBinding, I as TypedPipelineBinding, J as WorkerConfigExport, K as WorkflowBinding, L as TypedQueueBinding, M as StreamBinding, N as TextBinding, O as RateLimitBinding, P as TypedAiBinding, Q as SettingsConfig, R as UnsafeBinding, S as LogfwdrBinding, St as InferMainModule, T as PipelineBinding, U as WorkerBinding, V as VpcNetworkBinding, W as WorkerLoaderBinding, X as defineWorker, Y as WorkerConfigInput, Z as ContainerConfig, _ as FlagshipBinding, _t as ContainerConfigInput, a as AiBinding, at as Triggers, b as JsonBinding, bt as InferDurableNamespaces, c as AnalyticsEngineDatasetBinding, ct as DurableObjectDeletedExport, d as BindingDevOptions, dt as DurableObjectTransferredExport, et as ConnectTrigger, f as Bindings, ft as Exports, g as DurableObjectBinding, gt as ContainerConfigExport, h as DispatchNamespaceBinding, ht as exports, i as AgentMemoryBinding, it as ScheduledTrigger, j as SendEmailBinding, k as SecretBinding, l as ArtifactsBinding, lt as DurableObjectExpectingTransferExport, m as D1Binding, mt as WorkerEntrypointExportOptions, n as SettingsConfigInput, nt as FetchTrigger, o as AiSearchBinding, ot as triggers, p as BrowserBinding, pt as WorkerEntrypointExport, q as bindings, r as defineSettings, rt as QueueConsumerTrigger, s as AiSearchNamespaceBinding, st as DurableObjectCreatedExport, t as SettingsConfigExport, tt as EmailTrigger, u as AssetsBinding, ut as DurableObjectRenamedExport, v as HyperdriveBinding, vt as defineContainer, w as MtlsCertificateBinding, x as KvBinding, xt as InferEnv, y as ImagesBinding, yt as ConfigContext, z as VectorizeBinding } from "./public-
|
|
1
|
+
import { $ as WorkerConfig, A as SecretsStoreSecretBinding, B as VersionMetadataBinding, C as MediaBinding, Ct as UnwrapConfig, D as R2Binding, E as QueueBinding, F as TypedKvBinding, G as WorkerReference, H as VpcServiceBinding, I as TypedPipelineBinding, J as WorkerConfigExport, K as WorkflowBinding, L as TypedQueueBinding, M as StreamBinding, N as TextBinding, O as RateLimitBinding, P as TypedAiBinding, Q as SettingsConfig, R as UnsafeBinding, S as LogfwdrBinding, St as InferMainModule, T as PipelineBinding, U as WorkerBinding, V as VpcNetworkBinding, W as WorkerLoaderBinding, X as defineWorker, Y as WorkerConfigInput, Z as ContainerConfig, _ as FlagshipBinding, _t as ContainerConfigInput, a as AiBinding, at as Triggers, b as JsonBinding, bt as InferDurableNamespaces, c as AnalyticsEngineDatasetBinding, ct as DurableObjectDeletedExport, d as BindingDevOptions, dt as DurableObjectTransferredExport, et as ConnectTrigger, f as Bindings, ft as Exports, g as DurableObjectBinding, gt as ContainerConfigExport, h as DispatchNamespaceBinding, ht as exports, i as AgentMemoryBinding, it as ScheduledTrigger, j as SendEmailBinding, k as SecretBinding, l as ArtifactsBinding, lt as DurableObjectExpectingTransferExport, m as D1Binding, mt as WorkerEntrypointExportOptions, n as SettingsConfigInput, nt as FetchTrigger, o as AiSearchBinding, ot as triggers, p as BrowserBinding, pt as WorkerEntrypointExport, q as bindings, r as defineSettings, rt as QueueConsumerTrigger, s as AiSearchNamespaceBinding, st as DurableObjectCreatedExport, t as SettingsConfigExport, tt as EmailTrigger, u as AssetsBinding, ut as DurableObjectRenamedExport, v as HyperdriveBinding, vt as defineContainer, w as MtlsCertificateBinding, x as KvBinding, xt as InferEnv, y as ImagesBinding, yt as ConfigContext, z as VectorizeBinding } from "./public-CFsFemEv.mjs";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import { RawConfig } from "@cloudflare/workers-utils";
|
|
4
4
|
|
|
@@ -323,6 +323,7 @@ declare function validateSingletonBindings(env: Record<string, {
|
|
|
323
323
|
declare const InputContainerSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
324
324
|
type: z.ZodLiteral<"container">;
|
|
325
325
|
name: z.ZodString;
|
|
326
|
+
unsafe: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
326
327
|
observability: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
327
328
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
328
329
|
logs: z.ZodOptional<z.ZodObject<{
|
|
@@ -336,7 +337,6 @@ declare const InputContainerSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
336
337
|
}, z.core.$strict>>;
|
|
337
338
|
targetInstanceCount: z.ZodOptional<z.ZodNumber>;
|
|
338
339
|
}, z.core.$strict>]>>;
|
|
339
|
-
unsafe: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
340
340
|
maxInstances: z.ZodDefault<z.ZodNumber>;
|
|
341
341
|
instanceType: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
342
342
|
basic: "basic";
|
|
@@ -398,21 +398,14 @@ declare const InputContainerSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
398
398
|
}, z.core.$strict>, z.ZodObject<{
|
|
399
399
|
type: z.ZodLiteral<"container">;
|
|
400
400
|
name: z.ZodString;
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
405
|
-
}, z.core.$strict>>;
|
|
406
|
-
targetInstancePercentage: z.ZodOptional<z.ZodNumber>;
|
|
407
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
401
|
+
unsafe: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
402
|
+
schedulingPolicy: z.ZodLiteral<"durable-object">;
|
|
403
|
+
observability: z.ZodOptional<z.ZodObject<{
|
|
408
404
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
409
405
|
logs: z.ZodOptional<z.ZodObject<{
|
|
410
406
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
411
407
|
}, z.core.$strict>>;
|
|
412
|
-
|
|
413
|
-
}, z.core.$strict>]>>;
|
|
414
|
-
unsafe: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
415
|
-
schedulingPolicy: z.ZodLiteral<"durable-object">;
|
|
408
|
+
}, z.core.$strict>>;
|
|
416
409
|
images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
417
410
|
dockerfile: z.ZodString;
|
|
418
411
|
buildContext: z.ZodOptional<z.ZodString>;
|
|
@@ -430,6 +423,7 @@ type ParsedInputContainerConfig = z.output<typeof InputContainerSchema>;
|
|
|
430
423
|
declare const OutputContainerSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
431
424
|
type: z.ZodLiteral<"container">;
|
|
432
425
|
name: z.ZodString;
|
|
426
|
+
unsafe: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
433
427
|
observability: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
434
428
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
435
429
|
logs: z.ZodOptional<z.ZodObject<{
|
|
@@ -443,7 +437,6 @@ declare const OutputContainerSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
443
437
|
}, z.core.$strict>>;
|
|
444
438
|
targetInstanceCount: z.ZodOptional<z.ZodNumber>;
|
|
445
439
|
}, z.core.$strict>]>>;
|
|
446
|
-
unsafe: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
447
440
|
maxInstances: z.ZodDefault<z.ZodNumber>;
|
|
448
441
|
instanceType: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
449
442
|
basic: "basic";
|
|
@@ -503,21 +496,14 @@ declare const OutputContainerSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
503
496
|
}, z.core.$strict>, z.ZodObject<{
|
|
504
497
|
type: z.ZodLiteral<"container">;
|
|
505
498
|
name: z.ZodString;
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
510
|
-
}, z.core.$strict>>;
|
|
511
|
-
targetInstancePercentage: z.ZodOptional<z.ZodNumber>;
|
|
512
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
499
|
+
unsafe: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
500
|
+
schedulingPolicy: z.ZodLiteral<"durable-object">;
|
|
501
|
+
observability: z.ZodOptional<z.ZodObject<{
|
|
513
502
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
514
503
|
logs: z.ZodOptional<z.ZodObject<{
|
|
515
504
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
516
505
|
}, z.core.$strict>>;
|
|
517
|
-
|
|
518
|
-
}, z.core.$strict>]>>;
|
|
519
|
-
unsafe: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
520
|
-
schedulingPolicy: z.ZodLiteral<"durable-object">;
|
|
506
|
+
}, z.core.$strict>>;
|
|
521
507
|
images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
522
508
|
reference: z.ZodString;
|
|
523
509
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -783,7 +769,7 @@ declare const InputSettingsSchema: z.ZodObject<{
|
|
|
783
769
|
type ParsedInputSettingsConfig = z.output<typeof InputSettingsSchema>;
|
|
784
770
|
/**
|
|
785
771
|
* Output settings schema — the shape of the top-level `config.json` in the
|
|
786
|
-
* Build Output Specification. Adds the
|
|
772
|
+
* Build Output Specification. Adds the build mode and Preview intent.
|
|
787
773
|
*/
|
|
788
774
|
declare const OutputSettingsSchema: z.ZodObject<{
|
|
789
775
|
type: z.ZodLiteral<"settings">;
|
|
@@ -792,6 +778,7 @@ declare const OutputSettingsSchema: z.ZodObject<{
|
|
|
792
778
|
public: "public";
|
|
793
779
|
"fedramp-high": "fedramp-high";
|
|
794
780
|
}>>;
|
|
781
|
+
isPreview: z.ZodOptional<z.ZodBoolean>;
|
|
795
782
|
mode: z.ZodOptional<z.ZodString>;
|
|
796
783
|
}, z.core.$strict>;
|
|
797
784
|
type ParsedOutputSettingsConfig = z.output<typeof OutputSettingsSchema>;
|
|
@@ -1104,6 +1091,13 @@ type ParsedConfigExports = {
|
|
|
1104
1091
|
default?: ParsedInputWorkerConfig;
|
|
1105
1092
|
settings?: ParsedInputSettingsConfig;
|
|
1106
1093
|
} & Record<string, ParsedInputContainerConfig | ParsedInputWorkerConfig>;
|
|
1094
|
+
/**
|
|
1095
|
+
* Selects the Container exports from a validated project configuration.
|
|
1096
|
+
*
|
|
1097
|
+
* @param config - Validated exports keyed by their JavaScript export names.
|
|
1098
|
+
* @returns Container configurations keyed by those same export names.
|
|
1099
|
+
*/
|
|
1100
|
+
declare function getContainerConfigExports(config: ParsedConfigExports): Record<string, ParsedInputContainerConfig>;
|
|
1107
1101
|
type ConfigParseResult = z.ZodSafeParseSuccess<ParsedConfigExports> | z.ZodSafeParseError<unknown>;
|
|
1108
1102
|
interface LoadAndValidateConfigResult {
|
|
1109
1103
|
/**
|
|
@@ -1130,4 +1124,4 @@ declare function loadAndValidateConfig(configPath: string, ctx: ConfigContext, o
|
|
|
1130
1124
|
include?: string[];
|
|
1131
1125
|
}): Promise<LoadAndValidateConfigResult>;
|
|
1132
1126
|
//#endregion
|
|
1133
|
-
export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, AnalyticsEngineDatasetBindingSchema, ArtifactsBinding, AssetsBinding, AssetsSchema, BindingDevOptions, BindingSchema, Bindings, BrowserBinding, BrowserBindingSchema, ConfigContext, type ConfigParseResult, ConnectTrigger, ContainerConfig, ContainerConfigExport, ContainerConfigInput, 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, InputContainerSchema, InputSettingsSchema, InputWorkerSchema, JsonBinding, KVBindingSchema, KnownBindingSchema, KvBinding, type LoadAndValidateConfigResult, type LoadConfigResult, LogfwdrBinding, MediaBinding, type ModuleType, ModuleTypeSchema, MtlsCertificateBinding, OutputContainerSchema, OutputSettingsSchema, OutputWorkerSchema, type ParsedConfigExports, type ParsedInputContainerConfig, type ParsedInputSettingsConfig, type ParsedInputWorkerConfig, type ParsedOutputContainerConfig, type ParsedOutputSettingsConfig, type ParsedOutputWorkerConfig, PipelineBinding, QueueBinding, QueueBindingSchema, QueueConsumerTrigger, R2Binding, R2BindingSchema, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, SettingsConfig, SettingsConfigExport, SettingsConfigInput, StreamBinding, TailConsumerSchema, TextBinding, Triggers, TypedAiBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, UnsafeBinding, UnsafeBindingSchema, UnwrapConfig, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WorkerBinding, WorkerBindingSchema, WorkerConfig, WorkerConfigExport, WorkerConfigInput, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerEntrypointExportSchema, WorkerLoaderBinding, WorkerReference, WorkflowBinding, bindings, convertToWranglerConfig, defineContainer, defineSettings, defineWorker, exports, generateTypes, loadAndValidateConfig, loadConfig, registerConfigHooks, resolveAndValidateConfigExports, triggers, validateSingletonBindings };
|
|
1127
|
+
export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, AnalyticsEngineDatasetBindingSchema, ArtifactsBinding, AssetsBinding, AssetsSchema, BindingDevOptions, BindingSchema, Bindings, BrowserBinding, BrowserBindingSchema, ConfigContext, type ConfigParseResult, ConnectTrigger, ContainerConfig, ContainerConfigExport, ContainerConfigInput, 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, InputContainerSchema, InputSettingsSchema, InputWorkerSchema, JsonBinding, KVBindingSchema, KnownBindingSchema, KvBinding, type LoadAndValidateConfigResult, type LoadConfigResult, LogfwdrBinding, MediaBinding, type ModuleType, ModuleTypeSchema, MtlsCertificateBinding, OutputContainerSchema, OutputSettingsSchema, OutputWorkerSchema, type ParsedConfigExports, type ParsedInputContainerConfig, type ParsedInputSettingsConfig, type ParsedInputWorkerConfig, type ParsedOutputContainerConfig, type ParsedOutputSettingsConfig, type ParsedOutputWorkerConfig, PipelineBinding, QueueBinding, QueueBindingSchema, QueueConsumerTrigger, R2Binding, R2BindingSchema, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, SettingsConfig, SettingsConfigExport, SettingsConfigInput, StreamBinding, TailConsumerSchema, TextBinding, Triggers, TypedAiBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, UnsafeBinding, UnsafeBindingSchema, UnwrapConfig, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WorkerBinding, WorkerBindingSchema, WorkerConfig, WorkerConfigExport, WorkerConfigInput, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerEntrypointExportSchema, WorkerLoaderBinding, WorkerReference, WorkflowBinding, bindings, convertToWranglerConfig, defineContainer, defineSettings, defineWorker, exports, generateTypes, getContainerConfigExports, loadAndValidateConfig, loadConfig, registerConfigHooks, resolveAndValidateConfigExports, triggers, validateSingletonBindings };
|
package/dist/index.mjs
CHANGED
|
@@ -322,14 +322,14 @@ const ContainerObservabilityBaseSchema = z.strictObject({
|
|
|
322
322
|
enabled: z.boolean().optional(),
|
|
323
323
|
logs: z.strictObject({ enabled: z.boolean().optional() }).optional()
|
|
324
324
|
});
|
|
325
|
-
const
|
|
325
|
+
const StandardContainerObservabilitySchema = z.union([ContainerObservabilityBaseSchema.extend({ targetInstancePercentage: z.number().min(0).max(100).optional() }), ContainerObservabilityBaseSchema.extend({ targetInstanceCount: z.number().int().nonnegative().optional() })]);
|
|
326
326
|
const BaseContainerSchema = z.strictObject({
|
|
327
327
|
type: z.literal("container"),
|
|
328
328
|
name: z.string().min(1),
|
|
329
|
-
observability: ContainerObservabilitySchema.optional(),
|
|
330
329
|
unsafe: z.record(z.string(), z.unknown()).optional()
|
|
331
330
|
});
|
|
332
331
|
const StandardContainerBaseSchema = BaseContainerSchema.extend({
|
|
332
|
+
observability: StandardContainerObservabilitySchema.optional(),
|
|
333
333
|
maxInstances: z.number().int().nonnegative().default(20),
|
|
334
334
|
instanceType: z.union([z.enum([
|
|
335
335
|
"basic",
|
|
@@ -376,7 +376,10 @@ const StandardContainerBaseSchema = BaseContainerSchema.extend({
|
|
|
376
376
|
activeGracePeriod: z.number().nonnegative().optional()
|
|
377
377
|
}).optional()
|
|
378
378
|
});
|
|
379
|
-
const DurableObjectContainerBaseSchema = BaseContainerSchema.extend({
|
|
379
|
+
const DurableObjectContainerBaseSchema = BaseContainerSchema.extend({
|
|
380
|
+
schedulingPolicy: z.literal("durable-object"),
|
|
381
|
+
observability: ContainerObservabilityBaseSchema.optional()
|
|
382
|
+
});
|
|
380
383
|
/**
|
|
381
384
|
* Input Container schema — validates user-authored `cloudflare.config.ts`
|
|
382
385
|
* Container exports. Dockerfiles are built by the consuming build tool.
|
|
@@ -564,9 +567,12 @@ const InputSettingsSchema = z.strictObject({
|
|
|
564
567
|
});
|
|
565
568
|
/**
|
|
566
569
|
* Output settings schema — the shape of the top-level `config.json` in the
|
|
567
|
-
* Build Output Specification. Adds the
|
|
570
|
+
* Build Output Specification. Adds the build mode and Preview intent.
|
|
568
571
|
*/
|
|
569
|
-
const OutputSettingsSchema = InputSettingsSchema.extend({
|
|
572
|
+
const OutputSettingsSchema = InputSettingsSchema.extend({
|
|
573
|
+
isPreview: z.boolean().optional(),
|
|
574
|
+
mode: z.string().optional()
|
|
575
|
+
});
|
|
570
576
|
const DEFAULT_EXPORT_NAME = "default";
|
|
571
577
|
const SETTINGS_EXPORT_NAME = "settings";
|
|
572
578
|
const SUPPORTED_EXPORT_TYPES = new Set([
|
|
@@ -828,10 +834,14 @@ function convertToWranglerConfig(workerConfig, settingsConfig, containerExports
|
|
|
828
834
|
return result;
|
|
829
835
|
}
|
|
830
836
|
function convertContainer(container) {
|
|
831
|
-
if (container.schedulingPolicy === "durable-object") throw new UserError("Durable Object-managed Containers are not currently supported by `convertToWranglerConfig()`.", { telemetryMessage: false });
|
|
832
837
|
const converted = { name: container.name };
|
|
833
838
|
if (container.observability !== void 0) converted.observability = convertContainerObservability(container.observability);
|
|
834
839
|
if (container.unsafe !== void 0) converted.unsafe = container.unsafe;
|
|
840
|
+
if (container.schedulingPolicy === "durable-object") {
|
|
841
|
+
converted.scheduling_policy = "durable_object";
|
|
842
|
+
if (container.images !== void 0) converted.images = Object.fromEntries(Object.entries(container.images).map(([name, image]) => [name, convertDurableObjectContainerImage(image)]));
|
|
843
|
+
return converted;
|
|
844
|
+
}
|
|
835
845
|
converted.image = "dockerfile" in container.image ? container.image.dockerfile : container.image.reference;
|
|
836
846
|
converted.max_instances = container.maxInstances;
|
|
837
847
|
if ("dockerfile" in container.image) {
|
|
@@ -860,6 +870,13 @@ function convertContainer(container) {
|
|
|
860
870
|
}
|
|
861
871
|
return converted;
|
|
862
872
|
}
|
|
873
|
+
function convertDurableObjectContainerImage(image) {
|
|
874
|
+
if ("reference" in image) return { image: image.reference };
|
|
875
|
+
const converted = { dockerfile: image.dockerfile };
|
|
876
|
+
if (image.buildContext !== void 0) converted.build_context = image.buildContext;
|
|
877
|
+
if (image.buildVars !== void 0) converted.build_vars = image.buildVars;
|
|
878
|
+
return converted;
|
|
879
|
+
}
|
|
863
880
|
function convertContainerObservability(observability) {
|
|
864
881
|
const converted = {};
|
|
865
882
|
if (observability.enabled !== void 0) converted.enabled = observability.enabled;
|
|
@@ -1530,6 +1547,15 @@ const CROSS_WORKER_BINDING_TYPES = new Set([
|
|
|
1530
1547
|
"worker",
|
|
1531
1548
|
"workflow"
|
|
1532
1549
|
]);
|
|
1550
|
+
/**
|
|
1551
|
+
* Selects the Container exports from a validated project configuration.
|
|
1552
|
+
*
|
|
1553
|
+
* @param config - Validated exports keyed by their JavaScript export names.
|
|
1554
|
+
* @returns Container configurations keyed by those same export names.
|
|
1555
|
+
*/
|
|
1556
|
+
function getContainerConfigExports(config) {
|
|
1557
|
+
return Object.fromEntries(Object.entries(config).filter((entry) => entry[1]?.type === "container"));
|
|
1558
|
+
}
|
|
1533
1559
|
function isRecord(value) {
|
|
1534
1560
|
return typeof value === "object" && value !== null;
|
|
1535
1561
|
}
|
|
@@ -1759,4 +1785,4 @@ async function loadAndValidateConfig(configPath, ctx, options) {
|
|
|
1759
1785
|
}
|
|
1760
1786
|
|
|
1761
1787
|
//#endregion
|
|
1762
|
-
export { AnalyticsEngineDatasetBindingSchema, AssetsSchema, BindingSchema, BrowserBindingSchema, D1BindingSchema, DurableObjectCreatedExportSchema, DurableObjectDeletedExportSchema, DurableObjectExpectingTransferExportSchema, DurableObjectRenamedExportSchema, DurableObjectTransferredExportSchema, ExportSchema, FlagshipBindingSchema, HyperdriveBindingSchema, InputContainerSchema, InputSettingsSchema, InputWorkerSchema, KVBindingSchema, KnownBindingSchema, ModuleTypeSchema, OutputContainerSchema, OutputSettingsSchema, OutputWorkerSchema, QueueBindingSchema, R2BindingSchema, TailConsumerSchema, UnsafeBindingSchema, WorkerBindingSchema, WorkerEntrypointExportSchema, bindings, convertToWranglerConfig, defineContainer, defineSettings, defineWorker, exports$1 as exports, generateTypes, loadAndValidateConfig, loadConfig, registerConfigHooks, resolveAndValidateConfigExports, triggers, validateSingletonBindings };
|
|
1788
|
+
export { AnalyticsEngineDatasetBindingSchema, AssetsSchema, BindingSchema, BrowserBindingSchema, D1BindingSchema, DurableObjectCreatedExportSchema, DurableObjectDeletedExportSchema, DurableObjectExpectingTransferExportSchema, DurableObjectRenamedExportSchema, DurableObjectTransferredExportSchema, ExportSchema, FlagshipBindingSchema, HyperdriveBindingSchema, InputContainerSchema, InputSettingsSchema, InputWorkerSchema, KVBindingSchema, KnownBindingSchema, ModuleTypeSchema, OutputContainerSchema, OutputSettingsSchema, OutputWorkerSchema, QueueBindingSchema, R2BindingSchema, TailConsumerSchema, UnsafeBindingSchema, WorkerBindingSchema, WorkerEntrypointExportSchema, bindings, convertToWranglerConfig, defineContainer, defineSettings, defineWorker, exports$1 as exports, generateTypes, getContainerConfigExports, loadAndValidateConfig, loadConfig, registerConfigHooks, resolveAndValidateConfigExports, triggers, validateSingletonBindings };
|
|
@@ -212,6 +212,7 @@ type Json = string | number | boolean | null | Json[] | {
|
|
|
212
212
|
//#endregion
|
|
213
213
|
//#region src/definition.d.ts
|
|
214
214
|
interface ConfigContext {
|
|
215
|
+
isPreview: boolean;
|
|
215
216
|
/**
|
|
216
217
|
* The mode the config is being evaluated in.
|
|
217
218
|
* Set via the `--mode` CLI flag.
|
|
@@ -614,6 +615,25 @@ type ContainerImage = {
|
|
|
614
615
|
*/
|
|
615
616
|
reference: string;
|
|
616
617
|
};
|
|
618
|
+
/** Application-wide observability settings shared by all Containers. */
|
|
619
|
+
interface ContainerObservabilityConfig {
|
|
620
|
+
/** Whether observability is enabled. */
|
|
621
|
+
enabled?: boolean;
|
|
622
|
+
logs?: {
|
|
623
|
+
/** Whether log collection is enabled. */
|
|
624
|
+
enabled?: boolean;
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
/** Observability settings for a standard Container application. */
|
|
628
|
+
type StandardContainerObservabilityConfig = ContainerObservabilityConfig & ({
|
|
629
|
+
/** Percentage of Container instances targeted for observability. */
|
|
630
|
+
targetInstancePercentage?: number;
|
|
631
|
+
targetInstanceCount?: never;
|
|
632
|
+
} | {
|
|
633
|
+
targetInstancePercentage?: never;
|
|
634
|
+
/** Number of Container instances targeted for observability. */
|
|
635
|
+
targetInstanceCount?: number;
|
|
636
|
+
});
|
|
617
637
|
/** Fields shared by all Container application configurations. */
|
|
618
638
|
interface BaseContainerConfig {
|
|
619
639
|
/**
|
|
@@ -630,23 +650,6 @@ interface BaseContainerConfig {
|
|
|
630
650
|
* Object's `exports` entry via its `container` field.
|
|
631
651
|
*/
|
|
632
652
|
name: string;
|
|
633
|
-
/** Configures observability for Container instances. */
|
|
634
|
-
observability?: {
|
|
635
|
-
/** Whether observability is enabled. */
|
|
636
|
-
enabled?: boolean;
|
|
637
|
-
logs?: {
|
|
638
|
-
/** Whether log collection is enabled. */
|
|
639
|
-
enabled?: boolean;
|
|
640
|
-
};
|
|
641
|
-
} & ({
|
|
642
|
-
/** Percentage of Container instances targeted for observability. */
|
|
643
|
-
targetInstancePercentage?: number;
|
|
644
|
-
targetInstanceCount?: never;
|
|
645
|
-
} | {
|
|
646
|
-
targetInstancePercentage?: never;
|
|
647
|
-
/** Number of Container instances targeted for observability. */
|
|
648
|
-
targetInstanceCount?: number;
|
|
649
|
-
});
|
|
650
653
|
/**
|
|
651
654
|
* Passed through without client-side validation or transformation.
|
|
652
655
|
*
|
|
@@ -656,6 +659,8 @@ interface BaseContainerConfig {
|
|
|
656
659
|
}
|
|
657
660
|
/** A Container application managed with a standard scheduling policy. */
|
|
658
661
|
interface StandardContainerConfig extends BaseContainerConfig {
|
|
662
|
+
/** Configures observability and optional targeting for Container instances. */
|
|
663
|
+
observability?: StandardContainerObservabilityConfig;
|
|
659
664
|
/** The image to build or deploy. */
|
|
660
665
|
image: ContainerImage;
|
|
661
666
|
/**
|
|
@@ -760,6 +765,11 @@ interface StandardContainerConfig extends BaseContainerConfig {
|
|
|
760
765
|
/** A Container application managed by a Durable Object. */
|
|
761
766
|
interface DurableObjectContainerConfig extends BaseContainerConfig {
|
|
762
767
|
schedulingPolicy: "durable-object";
|
|
768
|
+
/**
|
|
769
|
+
* Configures application-wide observability. Instance targeting is not
|
|
770
|
+
* supported for Durable Object-managed Containers.
|
|
771
|
+
*/
|
|
772
|
+
observability?: ContainerObservabilityConfig;
|
|
763
773
|
/** Named images that the Durable Object can start. */
|
|
764
774
|
images?: Record<string, ContainerImage>;
|
|
765
775
|
}
|
package/dist/public.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as WorkerConfig, A as SecretsStoreSecretBinding, B as VersionMetadataBinding, C as MediaBinding, Ct as UnwrapConfig, D as R2Binding, E as QueueBinding, F as TypedKvBinding, G as WorkerReference, H as VpcServiceBinding, I as TypedPipelineBinding, J as WorkerConfigExport, K as WorkflowBinding, L as TypedQueueBinding, M as StreamBinding, N as TextBinding, O as RateLimitBinding, P as TypedAiBinding, Q as SettingsConfig, R as UnsafeBinding, S as LogfwdrBinding, St as InferMainModule, T as PipelineBinding, U as WorkerBinding, V as VpcNetworkBinding, W as WorkerLoaderBinding, X as defineWorker, Y as WorkerConfigInput, Z as ContainerConfig, _ as FlagshipBinding, _t as ContainerConfigInput, a as AiBinding, at as Triggers, b as JsonBinding, bt as InferDurableNamespaces, c as AnalyticsEngineDatasetBinding, ct as DurableObjectDeletedExport, d as BindingDevOptions, dt as DurableObjectTransferredExport, et as ConnectTrigger, f as Bindings, ft as Exports, g as DurableObjectBinding, gt as ContainerConfigExport, h as DispatchNamespaceBinding, ht as exports, i as AgentMemoryBinding, it as ScheduledTrigger, j as SendEmailBinding, k as SecretBinding, l as ArtifactsBinding, lt as DurableObjectExpectingTransferExport, m as D1Binding, mt as WorkerEntrypointExportOptions, n as SettingsConfigInput, nt as FetchTrigger, o as AiSearchBinding, ot as triggers, p as BrowserBinding, pt as WorkerEntrypointExport, q as bindings, r as defineSettings, rt as QueueConsumerTrigger, s as AiSearchNamespaceBinding, st as DurableObjectCreatedExport, t as SettingsConfigExport, tt as EmailTrigger, u as AssetsBinding, ut as DurableObjectRenamedExport, v as HyperdriveBinding, vt as defineContainer, w as MtlsCertificateBinding, x as KvBinding, xt as InferEnv, y as ImagesBinding, yt as ConfigContext, z as VectorizeBinding } from "./public-
|
|
1
|
+
import { $ as WorkerConfig, A as SecretsStoreSecretBinding, B as VersionMetadataBinding, C as MediaBinding, Ct as UnwrapConfig, D as R2Binding, E as QueueBinding, F as TypedKvBinding, G as WorkerReference, H as VpcServiceBinding, I as TypedPipelineBinding, J as WorkerConfigExport, K as WorkflowBinding, L as TypedQueueBinding, M as StreamBinding, N as TextBinding, O as RateLimitBinding, P as TypedAiBinding, Q as SettingsConfig, R as UnsafeBinding, S as LogfwdrBinding, St as InferMainModule, T as PipelineBinding, U as WorkerBinding, V as VpcNetworkBinding, W as WorkerLoaderBinding, X as defineWorker, Y as WorkerConfigInput, Z as ContainerConfig, _ as FlagshipBinding, _t as ContainerConfigInput, a as AiBinding, at as Triggers, b as JsonBinding, bt as InferDurableNamespaces, c as AnalyticsEngineDatasetBinding, ct as DurableObjectDeletedExport, d as BindingDevOptions, dt as DurableObjectTransferredExport, et as ConnectTrigger, f as Bindings, ft as Exports, g as DurableObjectBinding, gt as ContainerConfigExport, h as DispatchNamespaceBinding, ht as exports, i as AgentMemoryBinding, it as ScheduledTrigger, j as SendEmailBinding, k as SecretBinding, l as ArtifactsBinding, lt as DurableObjectExpectingTransferExport, m as D1Binding, mt as WorkerEntrypointExportOptions, n as SettingsConfigInput, nt as FetchTrigger, o as AiSearchBinding, ot as triggers, p as BrowserBinding, pt as WorkerEntrypointExport, q as bindings, r as defineSettings, rt as QueueConsumerTrigger, s as AiSearchNamespaceBinding, st as DurableObjectCreatedExport, t as SettingsConfigExport, tt as EmailTrigger, u as AssetsBinding, ut as DurableObjectRenamedExport, v as HyperdriveBinding, vt as defineContainer, w as MtlsCertificateBinding, x as KvBinding, xt as InferEnv, y as ImagesBinding, yt as ConfigContext, z as VectorizeBinding } from "./public-CFsFemEv.mjs";
|
|
2
2
|
export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, BindingDevOptions, Bindings, BrowserBinding, ConfigContext, ConnectTrigger, ContainerConfig, ContainerConfigExport, ContainerConfigInput, 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, SettingsConfigExport, SettingsConfigInput, StreamBinding, TextBinding, Triggers, TypedAiBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, UnsafeBinding, UnwrapConfig, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WorkerBinding, WorkerConfig, WorkerConfigExport, WorkerConfigInput, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerLoaderBinding, WorkerReference, WorkflowBinding, bindings, defineContainer, 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.15.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.20260918.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.
|
|
40
|
+
"@cloudflare/workers-utils": "0.40.1"
|
|
41
41
|
},
|
|
42
42
|
"workers-sdk": {
|
|
43
43
|
"prerelease": true
|