@cloudflare/config 0.13.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 +27 -27
- package/dist/index.mjs +35 -7
- package/dist/{public-B4i-aaaO.d.mts → public-CFsFemEv.d.mts} +32 -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<{
|
|
@@ -691,6 +677,9 @@ declare const InputWorkerSchema: z.ZodObject<{
|
|
|
691
677
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
692
678
|
headSamplingRate: z.ZodOptional<z.ZodNumber>;
|
|
693
679
|
redactQueryString: z.ZodOptional<z.ZodBoolean>;
|
|
680
|
+
issues: z.ZodOptional<z.ZodObject<{
|
|
681
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
682
|
+
}, z.core.$strict>>;
|
|
694
683
|
logs: z.ZodOptional<z.ZodObject<{
|
|
695
684
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
696
685
|
headSamplingRate: z.ZodOptional<z.ZodNumber>;
|
|
@@ -780,7 +769,7 @@ declare const InputSettingsSchema: z.ZodObject<{
|
|
|
780
769
|
type ParsedInputSettingsConfig = z.output<typeof InputSettingsSchema>;
|
|
781
770
|
/**
|
|
782
771
|
* Output settings schema — the shape of the top-level `config.json` in the
|
|
783
|
-
* Build Output Specification. Adds the
|
|
772
|
+
* Build Output Specification. Adds the build mode and Preview intent.
|
|
784
773
|
*/
|
|
785
774
|
declare const OutputSettingsSchema: z.ZodObject<{
|
|
786
775
|
type: z.ZodLiteral<"settings">;
|
|
@@ -789,6 +778,7 @@ declare const OutputSettingsSchema: z.ZodObject<{
|
|
|
789
778
|
public: "public";
|
|
790
779
|
"fedramp-high": "fedramp-high";
|
|
791
780
|
}>>;
|
|
781
|
+
isPreview: z.ZodOptional<z.ZodBoolean>;
|
|
792
782
|
mode: z.ZodOptional<z.ZodString>;
|
|
793
783
|
}, z.core.$strict>;
|
|
794
784
|
type ParsedOutputSettingsConfig = z.output<typeof OutputSettingsSchema>;
|
|
@@ -890,6 +880,9 @@ declare const OutputWorkerSchema: z.ZodObject<{
|
|
|
890
880
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
891
881
|
headSamplingRate: z.ZodOptional<z.ZodNumber>;
|
|
892
882
|
redactQueryString: z.ZodOptional<z.ZodBoolean>;
|
|
883
|
+
issues: z.ZodOptional<z.ZodObject<{
|
|
884
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
885
|
+
}, z.core.$strict>>;
|
|
893
886
|
logs: z.ZodOptional<z.ZodObject<{
|
|
894
887
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
895
888
|
headSamplingRate: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1098,6 +1091,13 @@ type ParsedConfigExports = {
|
|
|
1098
1091
|
default?: ParsedInputWorkerConfig;
|
|
1099
1092
|
settings?: ParsedInputSettingsConfig;
|
|
1100
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>;
|
|
1101
1101
|
type ConfigParseResult = z.ZodSafeParseSuccess<ParsedConfigExports> | z.ZodSafeParseError<unknown>;
|
|
1102
1102
|
interface LoadAndValidateConfigResult {
|
|
1103
1103
|
/**
|
|
@@ -1124,4 +1124,4 @@ declare function loadAndValidateConfig(configPath: string, ctx: ConfigContext, o
|
|
|
1124
1124
|
include?: string[];
|
|
1125
1125
|
}): Promise<LoadAndValidateConfigResult>;
|
|
1126
1126
|
//#endregion
|
|
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, 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.
|
|
@@ -441,6 +444,7 @@ const ObservabilitySchema = z.strictObject({
|
|
|
441
444
|
enabled: z.boolean().optional(),
|
|
442
445
|
headSamplingRate: z.number().optional(),
|
|
443
446
|
redactQueryString: z.boolean().optional(),
|
|
447
|
+
issues: z.strictObject({ enabled: z.boolean().optional() }).optional(),
|
|
444
448
|
logs: z.strictObject({
|
|
445
449
|
enabled: z.boolean().optional(),
|
|
446
450
|
headSamplingRate: z.number().optional(),
|
|
@@ -563,9 +567,12 @@ const InputSettingsSchema = z.strictObject({
|
|
|
563
567
|
});
|
|
564
568
|
/**
|
|
565
569
|
* Output settings schema — the shape of the top-level `config.json` in the
|
|
566
|
-
* Build Output Specification. Adds the
|
|
570
|
+
* Build Output Specification. Adds the build mode and Preview intent.
|
|
567
571
|
*/
|
|
568
|
-
const OutputSettingsSchema = InputSettingsSchema.extend({
|
|
572
|
+
const OutputSettingsSchema = InputSettingsSchema.extend({
|
|
573
|
+
isPreview: z.boolean().optional(),
|
|
574
|
+
mode: z.string().optional()
|
|
575
|
+
});
|
|
569
576
|
const DEFAULT_EXPORT_NAME = "default";
|
|
570
577
|
const SETTINGS_EXPORT_NAME = "settings";
|
|
571
578
|
const SUPPORTED_EXPORT_TYPES = new Set([
|
|
@@ -827,10 +834,14 @@ function convertToWranglerConfig(workerConfig, settingsConfig, containerExports
|
|
|
827
834
|
return result;
|
|
828
835
|
}
|
|
829
836
|
function convertContainer(container) {
|
|
830
|
-
if (container.schedulingPolicy === "durable-object") throw new UserError("Durable Object-managed Containers are not currently supported by `convertToWranglerConfig()`.", { telemetryMessage: false });
|
|
831
837
|
const converted = { name: container.name };
|
|
832
838
|
if (container.observability !== void 0) converted.observability = convertContainerObservability(container.observability);
|
|
833
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
|
+
}
|
|
834
845
|
converted.image = "dockerfile" in container.image ? container.image.dockerfile : container.image.reference;
|
|
835
846
|
converted.max_instances = container.maxInstances;
|
|
836
847
|
if ("dockerfile" in container.image) {
|
|
@@ -859,6 +870,13 @@ function convertContainer(container) {
|
|
|
859
870
|
}
|
|
860
871
|
return converted;
|
|
861
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
|
+
}
|
|
862
880
|
function convertContainerObservability(observability) {
|
|
863
881
|
const converted = {};
|
|
864
882
|
if (observability.enabled !== void 0) converted.enabled = observability.enabled;
|
|
@@ -904,6 +922,7 @@ function convertObservability(observability) {
|
|
|
904
922
|
if (observability.enabled !== void 0) out.enabled = observability.enabled;
|
|
905
923
|
if (observability.headSamplingRate !== void 0) out.head_sampling_rate = observability.headSamplingRate;
|
|
906
924
|
if (observability.redactQueryString !== void 0) out.redact_query_string = observability.redactQueryString;
|
|
925
|
+
if (observability.issues !== void 0) out.issues = { enabled: observability.issues.enabled };
|
|
907
926
|
if (observability.logs !== void 0) {
|
|
908
927
|
const logs = {};
|
|
909
928
|
const { logs: src } = observability;
|
|
@@ -1528,6 +1547,15 @@ const CROSS_WORKER_BINDING_TYPES = new Set([
|
|
|
1528
1547
|
"worker",
|
|
1529
1548
|
"workflow"
|
|
1530
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
|
+
}
|
|
1531
1559
|
function isRecord(value) {
|
|
1532
1560
|
return typeof value === "object" && value !== null;
|
|
1533
1561
|
}
|
|
@@ -1757,4 +1785,4 @@ async function loadAndValidateConfig(configPath, ctx, options) {
|
|
|
1757
1785
|
}
|
|
1758
1786
|
|
|
1759
1787
|
//#endregion
|
|
1760
|
-
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
|
}
|
|
@@ -929,6 +939,11 @@ interface WorkerConfig {
|
|
|
929
939
|
* @default false
|
|
930
940
|
*/
|
|
931
941
|
redactQueryString?: boolean;
|
|
942
|
+
/** Real-time Issues settings for this Worker. */
|
|
943
|
+
issues?: {
|
|
944
|
+
/** Whether real-time Issues are enabled. */
|
|
945
|
+
enabled?: boolean;
|
|
946
|
+
};
|
|
932
947
|
logs?: {
|
|
933
948
|
enabled?: boolean;
|
|
934
949
|
/** The sampling rate. */
|
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
|
+
"@cloudflare/workers-utils": "0.40.1"
|
|
41
41
|
},
|
|
42
42
|
"workers-sdk": {
|
|
43
43
|
"prerelease": true
|