@cloudflare/config 0.6.0 → 0.8.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.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-BwQqexwo.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";
|
|
@@ -14,6 +14,7 @@ var __commonJS = (cb, mod) => function() {
|
|
|
14
14
|
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/schema.ts
|
|
17
|
+
const RemoteBindingDevSchema = z.strictObject({ remote: z.boolean().optional() });
|
|
17
18
|
const AssetsSchema = z.strictObject({
|
|
18
19
|
htmlHandling: z.enum([
|
|
19
20
|
"auto-trailing-slash",
|
|
@@ -30,76 +31,80 @@ const AssetsSchema = z.strictObject({
|
|
|
30
31
|
});
|
|
31
32
|
const BrowserBindingSchema = z.strictObject({
|
|
32
33
|
type: z.literal("browser"),
|
|
33
|
-
|
|
34
|
+
dev: RemoteBindingDevSchema.optional()
|
|
34
35
|
});
|
|
35
36
|
const WorkerBindingSchema = z.strictObject({
|
|
36
37
|
type: z.literal("worker"),
|
|
37
38
|
workerName: z.string(),
|
|
38
39
|
exportName: z.string().optional(),
|
|
39
40
|
props: z.record(z.string(), z.unknown()).optional(),
|
|
40
|
-
|
|
41
|
+
dev: RemoteBindingDevSchema.optional()
|
|
41
42
|
});
|
|
42
43
|
const D1BindingSchema = z.strictObject({
|
|
43
44
|
type: z.literal("d1"),
|
|
44
45
|
name: z.string().optional(),
|
|
45
46
|
id: z.string().optional(),
|
|
46
|
-
|
|
47
|
+
dev: RemoteBindingDevSchema.optional()
|
|
47
48
|
});
|
|
48
49
|
const KVBindingSchema = z.strictObject({
|
|
49
50
|
type: z.literal("kv"),
|
|
50
51
|
id: z.string().optional(),
|
|
51
|
-
|
|
52
|
+
dev: RemoteBindingDevSchema.optional()
|
|
52
53
|
});
|
|
53
54
|
const QueueBindingSchema = z.strictObject({
|
|
54
55
|
type: z.literal("queue"),
|
|
55
56
|
name: z.string().optional(),
|
|
56
57
|
deliveryDelay: z.number().optional(),
|
|
57
|
-
|
|
58
|
+
dev: RemoteBindingDevSchema.optional()
|
|
58
59
|
});
|
|
59
60
|
const R2BindingSchema = z.strictObject({
|
|
60
61
|
type: z.literal("r2"),
|
|
61
62
|
name: z.string().optional(),
|
|
62
63
|
jurisdiction: z.string().optional(),
|
|
63
|
-
|
|
64
|
+
dev: RemoteBindingDevSchema.extend({ experimentalS3Credentials: z.object({
|
|
65
|
+
accessKeyId: z.string(),
|
|
66
|
+
secretAccessKey: z.string()
|
|
67
|
+
}).optional() }).optional()
|
|
68
|
+
});
|
|
69
|
+
const AnalyticsEngineDatasetBindingSchema = z.strictObject({
|
|
70
|
+
type: z.literal("analytics-engine-dataset"),
|
|
71
|
+
name: z.string().optional()
|
|
64
72
|
});
|
|
65
73
|
const FlagshipBindingSchema = z.strictObject({
|
|
66
74
|
type: z.literal("flagship"),
|
|
67
75
|
id: z.string().optional(),
|
|
68
|
-
|
|
76
|
+
dev: RemoteBindingDevSchema.optional()
|
|
69
77
|
});
|
|
70
78
|
const HyperdriveBindingSchema = z.strictObject({
|
|
71
79
|
type: z.literal("hyperdrive"),
|
|
72
80
|
id: z.string(),
|
|
73
|
-
|
|
81
|
+
dev: z.strictObject({ connectionString: z.string().optional() }).optional()
|
|
74
82
|
});
|
|
75
83
|
const KnownBindingSchema = z.discriminatedUnion("type", [
|
|
76
84
|
z.strictObject({
|
|
77
85
|
type: z.literal("agent-memory"),
|
|
78
86
|
namespace: z.string(),
|
|
79
|
-
|
|
87
|
+
dev: RemoteBindingDevSchema.optional()
|
|
80
88
|
}),
|
|
81
89
|
z.strictObject({
|
|
82
90
|
type: z.literal("ai"),
|
|
83
|
-
|
|
91
|
+
dev: RemoteBindingDevSchema.optional()
|
|
84
92
|
}),
|
|
85
93
|
z.strictObject({
|
|
86
94
|
type: z.literal("ai-search"),
|
|
87
95
|
name: z.string(),
|
|
88
|
-
|
|
96
|
+
dev: RemoteBindingDevSchema.optional()
|
|
89
97
|
}),
|
|
90
98
|
z.strictObject({
|
|
91
99
|
type: z.literal("ai-search-namespace"),
|
|
92
100
|
namespace: z.string(),
|
|
93
|
-
|
|
94
|
-
}),
|
|
95
|
-
z.strictObject({
|
|
96
|
-
type: z.literal("analytics-engine-dataset"),
|
|
97
|
-
name: z.string().optional()
|
|
101
|
+
dev: RemoteBindingDevSchema.optional()
|
|
98
102
|
}),
|
|
103
|
+
AnalyticsEngineDatasetBindingSchema,
|
|
99
104
|
z.strictObject({
|
|
100
105
|
type: z.literal("artifacts"),
|
|
101
106
|
namespace: z.string(),
|
|
102
|
-
|
|
107
|
+
dev: RemoteBindingDevSchema.optional()
|
|
103
108
|
}),
|
|
104
109
|
z.strictObject({ type: z.literal("assets") }),
|
|
105
110
|
BrowserBindingSchema,
|
|
@@ -111,7 +116,7 @@ const KnownBindingSchema = z.discriminatedUnion("type", [
|
|
|
111
116
|
workerName: z.string(),
|
|
112
117
|
parameters: z.array(z.string()).optional()
|
|
113
118
|
}).optional(),
|
|
114
|
-
|
|
119
|
+
dev: RemoteBindingDevSchema.optional()
|
|
115
120
|
}),
|
|
116
121
|
z.strictObject({
|
|
117
122
|
type: z.literal("durable-object"),
|
|
@@ -122,7 +127,7 @@ const KnownBindingSchema = z.discriminatedUnion("type", [
|
|
|
122
127
|
HyperdriveBindingSchema,
|
|
123
128
|
z.strictObject({
|
|
124
129
|
type: z.literal("images"),
|
|
125
|
-
|
|
130
|
+
dev: RemoteBindingDevSchema.optional()
|
|
126
131
|
}),
|
|
127
132
|
z.strictObject({
|
|
128
133
|
type: z.literal("json"),
|
|
@@ -135,17 +140,17 @@ const KnownBindingSchema = z.discriminatedUnion("type", [
|
|
|
135
140
|
}),
|
|
136
141
|
z.strictObject({
|
|
137
142
|
type: z.literal("media"),
|
|
138
|
-
|
|
143
|
+
dev: RemoteBindingDevSchema.optional()
|
|
139
144
|
}),
|
|
140
145
|
z.strictObject({
|
|
141
146
|
type: z.literal("mtls-certificate"),
|
|
142
147
|
id: z.string(),
|
|
143
|
-
|
|
148
|
+
dev: RemoteBindingDevSchema.optional()
|
|
144
149
|
}),
|
|
145
150
|
z.strictObject({
|
|
146
151
|
type: z.literal("pipeline"),
|
|
147
152
|
name: z.string(),
|
|
148
|
-
|
|
153
|
+
dev: RemoteBindingDevSchema.optional()
|
|
149
154
|
}),
|
|
150
155
|
QueueBindingSchema,
|
|
151
156
|
z.strictObject({
|
|
@@ -168,11 +173,11 @@ const KnownBindingSchema = z.discriminatedUnion("type", [
|
|
|
168
173
|
destinationAddress: z.string().optional(),
|
|
169
174
|
allowedDestinationAddresses: z.array(z.string()).optional(),
|
|
170
175
|
allowedSenderAddresses: z.array(z.string()).optional(),
|
|
171
|
-
|
|
172
|
-
}),
|
|
176
|
+
dev: RemoteBindingDevSchema.optional()
|
|
177
|
+
}).refine((value) => value.destinationAddress === void 0 || value.allowedDestinationAddresses === void 0, { message: "\"send-email\" bindings cannot specify both \"destinationAddress\" and \"allowedDestinationAddresses\"" }),
|
|
173
178
|
z.strictObject({
|
|
174
179
|
type: z.literal("stream"),
|
|
175
|
-
|
|
180
|
+
dev: RemoteBindingDevSchema.optional()
|
|
176
181
|
}),
|
|
177
182
|
z.strictObject({
|
|
178
183
|
type: z.literal("text"),
|
|
@@ -181,29 +186,26 @@ const KnownBindingSchema = z.discriminatedUnion("type", [
|
|
|
181
186
|
z.strictObject({
|
|
182
187
|
type: z.literal("vectorize"),
|
|
183
188
|
name: z.string(),
|
|
184
|
-
|
|
189
|
+
dev: RemoteBindingDevSchema.optional()
|
|
185
190
|
}),
|
|
186
191
|
z.strictObject({ type: z.literal("version-metadata") }),
|
|
187
192
|
z.strictObject({
|
|
188
193
|
type: z.literal("vpc-service"),
|
|
189
194
|
id: z.string(),
|
|
190
|
-
|
|
195
|
+
dev: RemoteBindingDevSchema.optional()
|
|
191
196
|
}),
|
|
192
197
|
z.strictObject({
|
|
193
198
|
type: z.literal("vpc-network"),
|
|
194
199
|
tunnelId: z.string().optional(),
|
|
195
200
|
networkId: z.string().optional(),
|
|
196
|
-
|
|
197
|
-
}).
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
message: hasTunnel ? `"vpc-network" bindings must specify exactly one of "tunnelId" or "networkId", not both` : `"vpc-network" bindings must specify either "tunnelId" or "networkId"`
|
|
202
|
-
});
|
|
203
|
-
}),
|
|
201
|
+
dev: RemoteBindingDevSchema.optional()
|
|
202
|
+
}).refine((value) => value.tunnelId !== void 0 !== (value.networkId !== void 0), { error: ({ input }) => {
|
|
203
|
+
const value = input;
|
|
204
|
+
return value.tunnelId !== void 0 && value.networkId !== void 0 ? `"vpc-network" bindings must specify exactly one of "tunnelId" or "networkId", not both` : `"vpc-network" bindings must specify either "tunnelId" or "networkId"`;
|
|
205
|
+
} }),
|
|
204
206
|
z.strictObject({
|
|
205
207
|
type: z.literal("web-search"),
|
|
206
|
-
|
|
208
|
+
dev: RemoteBindingDevSchema.optional()
|
|
207
209
|
}),
|
|
208
210
|
WorkerBindingSchema,
|
|
209
211
|
z.strictObject({ type: z.literal("worker-loader") })
|
|
@@ -375,6 +377,12 @@ const TriggerSchema = z.discriminatedUnion("type", [
|
|
|
375
377
|
z.strictObject({
|
|
376
378
|
type: z.literal("scheduled"),
|
|
377
379
|
schedule: z.string()
|
|
380
|
+
}),
|
|
381
|
+
z.strictObject({
|
|
382
|
+
type: z.literal("connect"),
|
|
383
|
+
protocol: z.enum(["tcp"]),
|
|
384
|
+
port: z.number(),
|
|
385
|
+
address: z.string().optional()
|
|
378
386
|
})
|
|
379
387
|
]);
|
|
380
388
|
const UnsafeSchema = z.strictObject({
|
|
@@ -421,30 +429,39 @@ const BaseWorkerSchema = z.strictObject({
|
|
|
421
429
|
*/
|
|
422
430
|
const InputWorkerSchema = BaseWorkerSchema.extend({ entrypoint: z.union([z.string(), z.strictObject({ default: z.string() })]).transform((value) => typeof value === "string" ? value : value.default).optional() });
|
|
423
431
|
/**
|
|
424
|
-
*
|
|
432
|
+
* Input settings schema — validates the named `settings` export of a
|
|
425
433
|
* `cloudflare.config.ts`. Holds account/deployment settings shared by the other exports.
|
|
426
434
|
*/
|
|
427
|
-
const
|
|
435
|
+
const InputSettingsSchema = z.strictObject({
|
|
428
436
|
type: z.literal("settings"),
|
|
429
437
|
accountId: z.string().optional(),
|
|
430
438
|
complianceRegion: z.enum(["public", "fedramp-high"]).optional()
|
|
431
439
|
});
|
|
432
440
|
/**
|
|
433
|
-
*
|
|
441
|
+
* Output settings schema — the shape of the top-level `config.json` in the
|
|
442
|
+
* Build Output Specification. Adds the `mode` the build was produced in.
|
|
434
443
|
*/
|
|
435
|
-
const
|
|
444
|
+
const OutputSettingsSchema = InputSettingsSchema.extend({ mode: z.string().optional() });
|
|
436
445
|
const SETTINGS_EXPORT_NAME = "settings";
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
* may only hold a `settings` config.
|
|
443
|
-
*/
|
|
444
|
-
const ConfigExportsSchema = z.record(z.string(), ConfigExportSchema).check((ctx) => {
|
|
446
|
+
const SUPPORTED_EXPORT_TYPES = new Set(["worker", "settings"]);
|
|
447
|
+
function invalidConfigExportMessage(exportName) {
|
|
448
|
+
return `The \`${exportName}\` export is not a supported export type. Move constants, helper functions, and other unsupported exports to a separate module.`;
|
|
449
|
+
}
|
|
450
|
+
const ConfigExportsTypeSchema = z.record(z.string(), z.unknown()).check((ctx) => {
|
|
445
451
|
for (const [key, value] of Object.entries(ctx.value)) {
|
|
452
|
+
const isObject = typeof value === "object" && value !== null;
|
|
453
|
+
const type = isObject && "type" in value ? value.type : void 0;
|
|
454
|
+
if (typeof type !== "string" || !SUPPORTED_EXPORT_TYPES.has(type)) {
|
|
455
|
+
ctx.issues.push({
|
|
456
|
+
code: "custom",
|
|
457
|
+
input: value,
|
|
458
|
+
path: isObject ? [key, "type"] : [key],
|
|
459
|
+
message: invalidConfigExportMessage(key)
|
|
460
|
+
});
|
|
461
|
+
continue;
|
|
462
|
+
}
|
|
446
463
|
const isSettingsName = key === SETTINGS_EXPORT_NAME;
|
|
447
|
-
const isSettingsType =
|
|
464
|
+
const isSettingsType = type === "settings";
|
|
448
465
|
if (isSettingsType && !isSettingsName) ctx.issues.push({
|
|
449
466
|
code: "custom",
|
|
450
467
|
input: value,
|
|
@@ -455,10 +472,19 @@ const ConfigExportsSchema = z.record(z.string(), ConfigExportSchema).check((ctx)
|
|
|
455
472
|
code: "custom",
|
|
456
473
|
input: value,
|
|
457
474
|
path: [key],
|
|
458
|
-
message: `The \`${SETTINGS_EXPORT_NAME}\` export is reserved for a \`settings\` config; found a \`${
|
|
475
|
+
message: `The \`${SETTINGS_EXPORT_NAME}\` export is reserved for a \`settings\` config; found a \`${type}\` config.`
|
|
459
476
|
});
|
|
460
477
|
}
|
|
461
478
|
});
|
|
479
|
+
const ConfigExportsObjectSchema = z.object({ settings: InputSettingsSchema.optional() }).catchall(InputWorkerSchema);
|
|
480
|
+
/**
|
|
481
|
+
* Schema for the resolved config exports, keyed by export
|
|
482
|
+
* name. Each value is discriminated on its `type` field. Reserves the
|
|
483
|
+
* `settings` export name exclusively for settings configs: a `settings`
|
|
484
|
+
* config must live on the `settings` export, and the `settings` export
|
|
485
|
+
* may only hold a `settings` config.
|
|
486
|
+
*/
|
|
487
|
+
const ConfigExportsSchema = ConfigExportsTypeSchema.pipe(ConfigExportsObjectSchema);
|
|
462
488
|
const ModuleTypeSchema = z.enum([
|
|
463
489
|
"esm",
|
|
464
490
|
"cjs",
|
|
@@ -573,43 +599,43 @@ function hasKnownExportType(entry) {
|
|
|
573
599
|
return type === "durable-object" || type === "worker";
|
|
574
600
|
}
|
|
575
601
|
__name(hasKnownExportType, "hasKnownExportType");
|
|
576
|
-
function partitionExports(exports$
|
|
602
|
+
function partitionExports(exports$1$1) {
|
|
577
603
|
const partitioned = {
|
|
578
604
|
"durable-object": {},
|
|
579
605
|
worker: {}
|
|
580
606
|
};
|
|
581
|
-
if (exports$
|
|
582
|
-
for (const [name, entry] of Object.entries(exports$
|
|
607
|
+
if (exports$1$1 === void 0) return partitioned;
|
|
608
|
+
for (const [name, entry] of Object.entries(exports$1$1)) {
|
|
583
609
|
if (!hasKnownExportType(entry)) continue;
|
|
584
610
|
partitioned[entry.type][name] = entry;
|
|
585
611
|
}
|
|
586
612
|
return partitioned;
|
|
587
613
|
}
|
|
588
614
|
__name(partitionExports, "partitionExports");
|
|
589
|
-
function getDurableObjectExports(exports$
|
|
590
|
-
return partitionExports(exports$
|
|
615
|
+
function getDurableObjectExports(exports$1$1) {
|
|
616
|
+
return partitionExports(exports$1$1)["durable-object"];
|
|
591
617
|
}
|
|
592
618
|
__name(getDurableObjectExports, "getDurableObjectExports");
|
|
593
|
-
function hasDurableObjectExports(exports$
|
|
594
|
-
return Object.keys(getDurableObjectExports(exports$
|
|
619
|
+
function hasDurableObjectExports(exports$1$1) {
|
|
620
|
+
return Object.keys(getDurableObjectExports(exports$1$1)).length > 0;
|
|
595
621
|
}
|
|
596
622
|
__name(hasDurableObjectExports, "hasDurableObjectExports");
|
|
597
|
-
function getContainerNameToClassNameMap(exports$
|
|
623
|
+
function getContainerNameToClassNameMap(exports$1$1) {
|
|
598
624
|
const containerNameToClassName = /* @__PURE__ */ new Map();
|
|
599
|
-
for (const [className, entry] of Object.entries(getDurableObjectExports(exports$
|
|
625
|
+
for (const [className, entry] of Object.entries(getDurableObjectExports(exports$1$1))) if ("container" in entry && typeof entry.container === "string" && !containerNameToClassName.has(entry.container)) containerNameToClassName.set(entry.container, className);
|
|
600
626
|
return containerNameToClassName;
|
|
601
627
|
}
|
|
602
628
|
__name(getContainerNameToClassNameMap, "getContainerNameToClassNameMap");
|
|
603
|
-
function resolveContainerClassName(container, exports$
|
|
629
|
+
function resolveContainerClassName(container, exports$1$1) {
|
|
604
630
|
if (container.class_name !== void 0) return container.class_name;
|
|
605
631
|
if (container.name === void 0) return;
|
|
606
|
-
return getContainerNameToClassNameMap(exports$
|
|
632
|
+
return getContainerNameToClassNameMap(exports$1$1).get(container.name);
|
|
607
633
|
}
|
|
608
634
|
__name(resolveContainerClassName, "resolveContainerClassName");
|
|
609
|
-
function getContainerDurableObjectClassNames(containers, exports$
|
|
635
|
+
function getContainerDurableObjectClassNames(containers, exports$1$1) {
|
|
610
636
|
const classNames = /* @__PURE__ */ new Set();
|
|
611
637
|
for (const container of containers ?? []) {
|
|
612
|
-
const className = resolveContainerClassName(container, exports$
|
|
638
|
+
const className = resolveContainerClassName(container, exports$1$1);
|
|
613
639
|
if (className !== void 0) classNames.add(className);
|
|
614
640
|
}
|
|
615
641
|
return classNames;
|
|
@@ -3204,27 +3230,27 @@ function convertBindingsAndAssets(config, result) {
|
|
|
3204
3230
|
agentMemory.push(omitUndefined({
|
|
3205
3231
|
binding: name,
|
|
3206
3232
|
namespace: binding.namespace,
|
|
3207
|
-
remote: binding.remote
|
|
3233
|
+
remote: binding.dev?.remote
|
|
3208
3234
|
}));
|
|
3209
3235
|
break;
|
|
3210
3236
|
case "ai":
|
|
3211
3237
|
result.ai = omitUndefined({
|
|
3212
3238
|
binding: name,
|
|
3213
|
-
remote: binding.remote
|
|
3239
|
+
remote: binding.dev?.remote
|
|
3214
3240
|
});
|
|
3215
3241
|
break;
|
|
3216
3242
|
case "ai-search":
|
|
3217
3243
|
aiSearch.push(omitUndefined({
|
|
3218
3244
|
binding: name,
|
|
3219
3245
|
instance_name: binding.name,
|
|
3220
|
-
remote: binding.remote
|
|
3246
|
+
remote: binding.dev?.remote
|
|
3221
3247
|
}));
|
|
3222
3248
|
break;
|
|
3223
3249
|
case "ai-search-namespace":
|
|
3224
3250
|
aiSearchNamespaces.push(omitUndefined({
|
|
3225
3251
|
binding: name,
|
|
3226
3252
|
namespace: binding.namespace,
|
|
3227
|
-
remote: binding.remote
|
|
3253
|
+
remote: binding.dev?.remote
|
|
3228
3254
|
}));
|
|
3229
3255
|
break;
|
|
3230
3256
|
case "analytics-engine-dataset":
|
|
@@ -3237,7 +3263,7 @@ function convertBindingsAndAssets(config, result) {
|
|
|
3237
3263
|
artifacts.push(omitUndefined({
|
|
3238
3264
|
binding: name,
|
|
3239
3265
|
namespace: binding.namespace,
|
|
3240
|
-
remote: binding.remote
|
|
3266
|
+
remote: binding.dev?.remote
|
|
3241
3267
|
}));
|
|
3242
3268
|
break;
|
|
3243
3269
|
case "assets":
|
|
@@ -3246,7 +3272,7 @@ function convertBindingsAndAssets(config, result) {
|
|
|
3246
3272
|
case "browser":
|
|
3247
3273
|
result.browser = omitUndefined({
|
|
3248
3274
|
binding: name,
|
|
3249
|
-
remote: binding.remote
|
|
3275
|
+
remote: binding.dev?.remote
|
|
3250
3276
|
});
|
|
3251
3277
|
break;
|
|
3252
3278
|
case "d1":
|
|
@@ -3254,7 +3280,7 @@ function convertBindingsAndAssets(config, result) {
|
|
|
3254
3280
|
binding: name,
|
|
3255
3281
|
database_id: binding.id,
|
|
3256
3282
|
database_name: binding.name,
|
|
3257
|
-
remote: binding.remote
|
|
3283
|
+
remote: binding.dev?.remote
|
|
3258
3284
|
}));
|
|
3259
3285
|
break;
|
|
3260
3286
|
case "dispatch-namespace": {
|
|
@@ -3266,7 +3292,7 @@ function convertBindingsAndAssets(config, result) {
|
|
|
3266
3292
|
service: binding.outbound.workerName,
|
|
3267
3293
|
parameters: binding.outbound.parameters
|
|
3268
3294
|
});
|
|
3269
|
-
if (binding.remote !== void 0) entry.remote = binding.remote;
|
|
3295
|
+
if (binding.dev?.remote !== void 0) entry.remote = binding.dev.remote;
|
|
3270
3296
|
dispatchNamespaces.push(entry);
|
|
3271
3297
|
break;
|
|
3272
3298
|
}
|
|
@@ -3281,20 +3307,20 @@ function convertBindingsAndAssets(config, result) {
|
|
|
3281
3307
|
flagship.push(omitUndefined({
|
|
3282
3308
|
binding: name,
|
|
3283
3309
|
app_id: binding.id,
|
|
3284
|
-
remote: binding.remote
|
|
3310
|
+
remote: binding.dev?.remote
|
|
3285
3311
|
}));
|
|
3286
3312
|
break;
|
|
3287
3313
|
case "hyperdrive":
|
|
3288
3314
|
hyperdrive.push(omitUndefined({
|
|
3289
3315
|
binding: name,
|
|
3290
3316
|
id: binding.id,
|
|
3291
|
-
localConnectionString: binding.
|
|
3317
|
+
localConnectionString: binding.dev?.connectionString
|
|
3292
3318
|
}));
|
|
3293
3319
|
break;
|
|
3294
3320
|
case "images":
|
|
3295
3321
|
result.images = omitUndefined({
|
|
3296
3322
|
binding: name,
|
|
3297
|
-
remote: binding.remote
|
|
3323
|
+
remote: binding.dev?.remote
|
|
3298
3324
|
});
|
|
3299
3325
|
break;
|
|
3300
3326
|
case "json":
|
|
@@ -3304,7 +3330,7 @@ function convertBindingsAndAssets(config, result) {
|
|
|
3304
3330
|
kvNamespaces.push(omitUndefined({
|
|
3305
3331
|
binding: name,
|
|
3306
3332
|
id: binding.id,
|
|
3307
|
-
remote: binding.remote
|
|
3333
|
+
remote: binding.dev?.remote
|
|
3308
3334
|
}));
|
|
3309
3335
|
break;
|
|
3310
3336
|
case "logfwdr":
|
|
@@ -3316,21 +3342,21 @@ function convertBindingsAndAssets(config, result) {
|
|
|
3316
3342
|
case "media":
|
|
3317
3343
|
result.media = omitUndefined({
|
|
3318
3344
|
binding: name,
|
|
3319
|
-
remote: binding.remote
|
|
3345
|
+
remote: binding.dev?.remote
|
|
3320
3346
|
});
|
|
3321
3347
|
break;
|
|
3322
3348
|
case "mtls-certificate":
|
|
3323
3349
|
mtlsCertificates.push(omitUndefined({
|
|
3324
3350
|
binding: name,
|
|
3325
3351
|
certificate_id: binding.id,
|
|
3326
|
-
remote: binding.remote
|
|
3352
|
+
remote: binding.dev?.remote
|
|
3327
3353
|
}));
|
|
3328
3354
|
break;
|
|
3329
3355
|
case "pipeline":
|
|
3330
3356
|
pipelines.push(omitUndefined({
|
|
3331
3357
|
binding: name,
|
|
3332
3358
|
stream: binding.name,
|
|
3333
|
-
remote: binding.remote
|
|
3359
|
+
remote: binding.dev?.remote
|
|
3334
3360
|
}));
|
|
3335
3361
|
break;
|
|
3336
3362
|
case "queue":
|
|
@@ -3338,7 +3364,7 @@ function convertBindingsAndAssets(config, result) {
|
|
|
3338
3364
|
binding: name,
|
|
3339
3365
|
queue: binding.name,
|
|
3340
3366
|
delivery_delay: binding.deliveryDelay,
|
|
3341
|
-
remote: binding.remote
|
|
3367
|
+
remote: binding.dev?.remote
|
|
3342
3368
|
}));
|
|
3343
3369
|
break;
|
|
3344
3370
|
case "rate-limit":
|
|
@@ -3348,14 +3374,17 @@ function convertBindingsAndAssets(config, result) {
|
|
|
3348
3374
|
simple: binding.simple
|
|
3349
3375
|
});
|
|
3350
3376
|
break;
|
|
3351
|
-
case "r2":
|
|
3377
|
+
case "r2": {
|
|
3378
|
+
const experimentalS3Credentials = binding.dev?.experimentalS3Credentials;
|
|
3352
3379
|
r2Buckets.push(omitUndefined({
|
|
3353
3380
|
binding: name,
|
|
3354
3381
|
bucket_name: binding.name,
|
|
3355
3382
|
jurisdiction: binding.jurisdiction,
|
|
3356
|
-
remote: binding.remote
|
|
3383
|
+
remote: binding.dev?.remote,
|
|
3384
|
+
local_dev: experimentalS3Credentials === void 0 ? void 0 : { experimental_s3_credentials: experimentalS3Credentials }
|
|
3357
3385
|
}));
|
|
3358
3386
|
break;
|
|
3387
|
+
}
|
|
3359
3388
|
case "secret":
|
|
3360
3389
|
secretsRequired.push(name);
|
|
3361
3390
|
break;
|
|
@@ -3372,13 +3401,13 @@ function convertBindingsAndAssets(config, result) {
|
|
|
3372
3401
|
destination_address: binding.destinationAddress,
|
|
3373
3402
|
allowed_destination_addresses: binding.allowedDestinationAddresses,
|
|
3374
3403
|
allowed_sender_addresses: binding.allowedSenderAddresses,
|
|
3375
|
-
remote: binding.remote
|
|
3404
|
+
remote: binding.dev?.remote
|
|
3376
3405
|
}));
|
|
3377
3406
|
break;
|
|
3378
3407
|
case "stream":
|
|
3379
3408
|
result.stream = omitUndefined({
|
|
3380
3409
|
binding: name,
|
|
3381
|
-
remote: binding.remote
|
|
3410
|
+
remote: binding.dev?.remote
|
|
3382
3411
|
});
|
|
3383
3412
|
break;
|
|
3384
3413
|
case "text":
|
|
@@ -3388,7 +3417,7 @@ function convertBindingsAndAssets(config, result) {
|
|
|
3388
3417
|
vectorize.push(omitUndefined({
|
|
3389
3418
|
binding: name,
|
|
3390
3419
|
index_name: binding.name,
|
|
3391
|
-
remote: binding.remote
|
|
3420
|
+
remote: binding.dev?.remote
|
|
3392
3421
|
}));
|
|
3393
3422
|
break;
|
|
3394
3423
|
case "version-metadata":
|
|
@@ -3398,25 +3427,25 @@ function convertBindingsAndAssets(config, result) {
|
|
|
3398
3427
|
vpcServices.push(omitUndefined({
|
|
3399
3428
|
binding: name,
|
|
3400
3429
|
service_id: binding.id,
|
|
3401
|
-
remote: binding.remote
|
|
3430
|
+
remote: binding.dev?.remote
|
|
3402
3431
|
}));
|
|
3403
3432
|
break;
|
|
3404
3433
|
case "vpc-network":
|
|
3405
3434
|
if (binding.tunnelId !== void 0) vpcNetworks.push(omitUndefined({
|
|
3406
3435
|
binding: name,
|
|
3407
3436
|
tunnel_id: binding.tunnelId,
|
|
3408
|
-
remote: binding.remote
|
|
3437
|
+
remote: binding.dev?.remote
|
|
3409
3438
|
}));
|
|
3410
3439
|
else if (binding.networkId !== void 0) vpcNetworks.push(omitUndefined({
|
|
3411
3440
|
binding: name,
|
|
3412
3441
|
network_id: binding.networkId,
|
|
3413
|
-
remote: binding.remote
|
|
3442
|
+
remote: binding.dev?.remote
|
|
3414
3443
|
}));
|
|
3415
3444
|
break;
|
|
3416
3445
|
case "web-search":
|
|
3417
3446
|
result.websearch = omitUndefined({
|
|
3418
3447
|
binding: name,
|
|
3419
|
-
remote: binding.remote
|
|
3448
|
+
remote: binding.dev?.remote
|
|
3420
3449
|
});
|
|
3421
3450
|
break;
|
|
3422
3451
|
case "worker":
|
|
@@ -3425,7 +3454,7 @@ function convertBindingsAndAssets(config, result) {
|
|
|
3425
3454
|
service: binding.workerName,
|
|
3426
3455
|
entrypoint: binding.exportName,
|
|
3427
3456
|
props: binding.props,
|
|
3428
|
-
remote: binding.remote
|
|
3457
|
+
remote: binding.dev?.remote
|
|
3429
3458
|
}));
|
|
3430
3459
|
break;
|
|
3431
3460
|
case "worker-loader":
|
|
@@ -3539,6 +3568,7 @@ function convertTriggers(config, result) {
|
|
|
3539
3568
|
const crons = [];
|
|
3540
3569
|
const routes = result.routes ? [...result.routes] : [];
|
|
3541
3570
|
const queueConsumers = result.queues?.consumers ? [...result.queues.consumers] : [];
|
|
3571
|
+
const connectHandlers = result.connect ? [...result.connect] : [];
|
|
3542
3572
|
let addresses;
|
|
3543
3573
|
for (const trigger of triggers$1) switch (trigger.type) {
|
|
3544
3574
|
case "email":
|
|
@@ -3571,6 +3601,13 @@ function convertTriggers(config, result) {
|
|
|
3571
3601
|
visibility_timeout_ms: trigger.visibilityTimeoutMs
|
|
3572
3602
|
}));
|
|
3573
3603
|
break;
|
|
3604
|
+
case "connect":
|
|
3605
|
+
connectHandlers.push(omitUndefined({
|
|
3606
|
+
protocol: trigger.protocol,
|
|
3607
|
+
port: trigger.port,
|
|
3608
|
+
address: trigger.address
|
|
3609
|
+
}));
|
|
3610
|
+
break;
|
|
3574
3611
|
}
|
|
3575
3612
|
if (crons.length) result.triggers = { crons };
|
|
3576
3613
|
if (routes.length) result.routes = routes;
|
|
@@ -3578,6 +3615,7 @@ function convertTriggers(config, result) {
|
|
|
3578
3615
|
...result.queues ?? {},
|
|
3579
3616
|
consumers: queueConsumers
|
|
3580
3617
|
};
|
|
3618
|
+
if (connectHandlers.length) result.connect = connectHandlers;
|
|
3581
3619
|
if (addresses !== void 0) result.addresses = addresses;
|
|
3582
3620
|
}
|
|
3583
3621
|
function convertDomains(config, result) {
|
|
@@ -3753,4 +3791,4 @@ async function loadAndValidateConfig(configPath, ctx, options) {
|
|
|
3753
3791
|
}
|
|
3754
3792
|
|
|
3755
3793
|
//#endregion
|
|
3756
|
-
export { AssetsSchema, BindingSchema, BrowserBindingSchema, ConfigExportsSchema, D1BindingSchema, DurableObjectCreatedExportSchema, DurableObjectDeletedExportSchema, DurableObjectExpectingTransferExportSchema, DurableObjectRenamedExportSchema, DurableObjectTransferredExportSchema, ExportSchema, FlagshipBindingSchema, HyperdriveBindingSchema, InputWorkerSchema, KVBindingSchema, KnownBindingSchema, ModuleTypeSchema, OutputWorkerSchema, QueueBindingSchema, R2BindingSchema,
|
|
3794
|
+
export { AnalyticsEngineDatasetBindingSchema, AssetsSchema, BindingSchema, BrowserBindingSchema, ConfigExportsSchema, D1BindingSchema, DurableObjectCreatedExportSchema, DurableObjectDeletedExportSchema, DurableObjectExpectingTransferExportSchema, DurableObjectRenamedExportSchema, DurableObjectTransferredExportSchema, ExportSchema, FlagshipBindingSchema, HyperdriveBindingSchema, InputSettingsSchema, InputWorkerSchema, KVBindingSchema, KnownBindingSchema, ModuleTypeSchema, OutputSettingsSchema, OutputWorkerSchema, QueueBindingSchema, R2BindingSchema, TailConsumerSchema, UnsafeBindingSchema, WorkerBindingSchema, WorkerEntrypointExportSchema, bindings, convertToWranglerConfig, defineSettings, defineWorker, exports$1 as exports, generateTypes, loadAndValidateConfig, loadConfig, registerConfigHooks, resolveExportDefinition, triggers, validateSingletonBindings };
|
|
@@ -146,6 +146,7 @@ const bindings = {
|
|
|
146
146
|
* triggers.scheduled({ schedule: "0 * * * *" }),
|
|
147
147
|
* triggers.scheduled({ schedule: "30 0 * * *" }),
|
|
148
148
|
* triggers.email({ addresses: ["support@example.com"] }),
|
|
149
|
+
* triggers.connect({ protocol: "tcp", port: 5432 }),
|
|
149
150
|
* ],
|
|
150
151
|
* });
|
|
151
152
|
* ```
|
|
@@ -166,6 +167,10 @@ const triggers = {
|
|
|
166
167
|
email: (options) => ({
|
|
167
168
|
type: "email",
|
|
168
169
|
...options
|
|
170
|
+
}),
|
|
171
|
+
connect: (options) => ({
|
|
172
|
+
type: "connect",
|
|
173
|
+
...options
|
|
169
174
|
})
|
|
170
175
|
};
|
|
171
176
|
|