@neondatabase/config 1.5.1 → 1.7.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/README.md +27 -38
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -1
- package/dist/lib/authored-services.d.ts +36 -0
- package/dist/lib/authored-services.d.ts.map +1 -0
- package/dist/lib/authored-services.js +89 -0
- package/dist/lib/authored-services.js.map +1 -0
- package/dist/lib/define-config.d.ts +19 -14
- package/dist/lib/define-config.d.ts.map +1 -1
- package/dist/lib/define-config.js +34 -18
- package/dist/lib/define-config.js.map +1 -1
- package/dist/lib/diff.d.ts +3 -3
- package/dist/lib/diff.d.ts.map +1 -1
- package/dist/lib/diff.js +41 -23
- package/dist/lib/diff.js.map +1 -1
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +1 -0
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/loader.js +6 -2
- package/dist/lib/loader.js.map +1 -1
- package/dist/lib/neon-api-real.d.ts.map +1 -1
- package/dist/lib/neon-api-real.js +74 -20
- package/dist/lib/neon-api-real.js.map +1 -1
- package/dist/lib/neon-api.d.ts +34 -7
- package/dist/lib/neon-api.d.ts.map +1 -1
- package/dist/lib/schema.d.ts +58 -22
- package/dist/lib/schema.d.ts.map +1 -1
- package/dist/lib/schema.js +85 -44
- package/dist/lib/schema.js.map +1 -1
- package/dist/lib/types.d.ts +116 -41
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js.map +1 -1
- package/dist/v1.d.ts +56 -24
- package/dist/v1.d.ts.map +1 -1
- package/dist/v1.js +4 -2
- package/dist/v1.js.map +1 -1
- package/package.json +1 -1
package/dist/lib/schema.d.ts
CHANGED
|
@@ -120,19 +120,31 @@ declare const functionDefSchema: z.ZodObject<{
|
|
|
120
120
|
dev: z.ZodOptional<z.ZodObject<{
|
|
121
121
|
port: z.ZodOptional<z.ZodNumber>;
|
|
122
122
|
}, z.core.$strict>>;
|
|
123
|
-
triggers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
124
|
-
type: z.ZodLiteral<"schedule">;
|
|
125
|
-
name: z.ZodString;
|
|
126
|
-
cron: z.ZodString;
|
|
127
|
-
functionPath: z.ZodOptional<z.ZodString>;
|
|
128
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
129
|
-
}, z.core.$strict>>>;
|
|
130
123
|
customDomains: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
131
124
|
}, z.core.$strict>;
|
|
132
125
|
/** Static definition of a bucket (existence). Name is the record key. */
|
|
133
126
|
declare const bucketDefSchema: z.ZodObject<{
|
|
134
127
|
access: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"private">, z.ZodLiteral<"public_read">]>>;
|
|
135
128
|
}, z.core.$strict>;
|
|
129
|
+
/**
|
|
130
|
+
* Functions record. Used as both top-level `functions` and `preview.functions`
|
|
131
|
+
* so {@link previewInputSchema} (`schemas.preview`) keeps the same validation
|
|
132
|
+
* when parsed on its own.
|
|
133
|
+
*/
|
|
134
|
+
declare const functionsRecordSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
135
|
+
name: z.ZodString;
|
|
136
|
+
source: z.ZodString;
|
|
137
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
138
|
+
externalPackages: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
139
|
+
name: z.ZodString;
|
|
140
|
+
includeFiles: z.ZodOptional<z.ZodBoolean>;
|
|
141
|
+
}, z.core.$strict>]>>>;
|
|
142
|
+
bundler: z.ZodOptional<z.ZodCustom<FunctionBundlerInput, FunctionBundlerInput>>;
|
|
143
|
+
dev: z.ZodOptional<z.ZodObject<{
|
|
144
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
145
|
+
}, z.core.$strict>>;
|
|
146
|
+
customDomains: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
147
|
+
}, z.core.$strict>>;
|
|
136
148
|
/** Static, beta Preview feature set: AI Gateway toggle + functions/buckets records. */
|
|
137
149
|
declare const previewInputSchema: z.ZodObject<{
|
|
138
150
|
aiGateway: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
@@ -150,13 +162,6 @@ declare const previewInputSchema: z.ZodObject<{
|
|
|
150
162
|
dev: z.ZodOptional<z.ZodObject<{
|
|
151
163
|
port: z.ZodOptional<z.ZodNumber>;
|
|
152
164
|
}, z.core.$strict>>;
|
|
153
|
-
triggers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
154
|
-
type: z.ZodLiteral<"schedule">;
|
|
155
|
-
name: z.ZodString;
|
|
156
|
-
cron: z.ZodString;
|
|
157
|
-
functionPath: z.ZodOptional<z.ZodString>;
|
|
158
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
159
|
-
}, z.core.$strict>>>;
|
|
160
165
|
customDomains: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
161
166
|
}, z.core.$strict>>>;
|
|
162
167
|
buckets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -183,6 +188,10 @@ declare const branchTuningSchema: z.ZodObject<{
|
|
|
183
188
|
suspendTimeout: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodString, z.ZodNumber]>>;
|
|
184
189
|
}, z.core.$strict>>;
|
|
185
190
|
}, z.core.$strict>>;
|
|
191
|
+
functions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
192
|
+
runtime: z.ZodOptional<z.ZodLiteral<"nodejs24">>;
|
|
193
|
+
customDomains: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
194
|
+
}, z.core.$strict>>>;
|
|
186
195
|
preview: z.ZodOptional<z.ZodObject<{
|
|
187
196
|
functions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
188
197
|
runtime: z.ZodOptional<z.ZodLiteral<"nodejs24">>;
|
|
@@ -218,6 +227,40 @@ declare const configInputSchema: z.ZodObject<{
|
|
|
218
227
|
serverTimingEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
219
228
|
}, z.core.$strict>>;
|
|
220
229
|
}, z.core.$strict>]>>;
|
|
230
|
+
aiGateway: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
231
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
232
|
+
}, z.core.$strict>]>>;
|
|
233
|
+
functions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
234
|
+
name: z.ZodString;
|
|
235
|
+
source: z.ZodString;
|
|
236
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
237
|
+
externalPackages: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
238
|
+
name: z.ZodString;
|
|
239
|
+
includeFiles: z.ZodOptional<z.ZodBoolean>;
|
|
240
|
+
}, z.core.$strict>]>>>;
|
|
241
|
+
bundler: z.ZodOptional<z.ZodCustom<FunctionBundlerInput, FunctionBundlerInput>>;
|
|
242
|
+
dev: z.ZodOptional<z.ZodObject<{
|
|
243
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
244
|
+
}, z.core.$strict>>;
|
|
245
|
+
customDomains: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
246
|
+
}, z.core.$strict>>>;
|
|
247
|
+
buckets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
248
|
+
access: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"private">, z.ZodLiteral<"public_read">]>>;
|
|
249
|
+
}, z.core.$strict>>>;
|
|
250
|
+
triggers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
251
|
+
type: z.ZodLiteral<"schedule">;
|
|
252
|
+
function: z.ZodString;
|
|
253
|
+
cron: z.ZodString;
|
|
254
|
+
functionPath: z.ZodOptional<z.ZodString>;
|
|
255
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
256
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
257
|
+
type: z.ZodLiteral<"storage_object_created">;
|
|
258
|
+
function: z.ZodString;
|
|
259
|
+
bucket: z.ZodString;
|
|
260
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
261
|
+
functionPath: z.ZodOptional<z.ZodString>;
|
|
262
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
263
|
+
}, z.core.$strict>], "type">>>;
|
|
221
264
|
preview: z.ZodOptional<z.ZodObject<{
|
|
222
265
|
aiGateway: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
223
266
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -234,13 +277,6 @@ declare const configInputSchema: z.ZodObject<{
|
|
|
234
277
|
dev: z.ZodOptional<z.ZodObject<{
|
|
235
278
|
port: z.ZodOptional<z.ZodNumber>;
|
|
236
279
|
}, z.core.$strict>>;
|
|
237
|
-
triggers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
238
|
-
type: z.ZodLiteral<"schedule">;
|
|
239
|
-
name: z.ZodString;
|
|
240
|
-
cron: z.ZodString;
|
|
241
|
-
functionPath: z.ZodOptional<z.ZodString>;
|
|
242
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
243
|
-
}, z.core.$strict>>>;
|
|
244
280
|
customDomains: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
245
281
|
}, z.core.$strict>>>;
|
|
246
282
|
buckets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -260,5 +296,5 @@ declare const configInputSchema: z.ZodObject<{
|
|
|
260
296
|
*/
|
|
261
297
|
declare function formatZodIssues(error: z.ZodError): string[];
|
|
262
298
|
//#endregion
|
|
263
|
-
export { branchTuningSchema, bucketDefSchema, computeSettingsSchema, configInputSchema, dataApiConfigSchema, dataApiInputSchema, dataApiSettingsSchema, formatZodIssues, functionDefSchema, functionTuningSchema, postgresConfigSchema, previewInputSchema, serviceToggleInputSchema, serviceToggleSchema };
|
|
299
|
+
export { branchTuningSchema, bucketDefSchema, computeSettingsSchema, configInputSchema, dataApiConfigSchema, dataApiInputSchema, dataApiSettingsSchema, formatZodIssues, functionDefSchema, functionTuningSchema, functionsRecordSchema, postgresConfigSchema, previewInputSchema, serviceToggleInputSchema, serviceToggleSchema };
|
|
264
300
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/lib/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/lib/schema.ts"],"mappings":";;;;;;;AAkCA;AAsDG;;;;;;;;;;AAAA;AAtD+B,cAArB,qBAAqB,EAAA,CAAA,CAAA,SAAA,CAAA;EAAA,qBAAA,eAAA,aAAA,CAAA,CAAA,GAAA,CAAA,GAAA,CAAA,GAAA,IAAA,GAAA,GAAA,GAAA,CAAA,GAAA,CAAA,GAAA,CAAA,GAAA,CAAA,GAAA,CAAA,GAAA,CAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,CAAA,CAAA;EAyDrB,qBAAA,eAEX,aAAA,CAAA,CAAA,GAAA,CAAA,GAAA,CAAA,GAAA,IAAA,GAAA,GAAA,GAAA,CAAA,GAAA,CAAA,GAAA,CAAA,GAAA,CAAA,GAAA,CAAA,GAAA,CAAA,GAAA,EAAA,GAA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A,CAAA,CAAA,CAAA;IAHiC,OAAA,eAAA,YAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGjC,GAAA,eAAA,YAAA,CAAA;MAHiC,IAAA,eAAA,YAAA,CAAA;IAAA,CAAA,gBAAA,CAAA,CAAA;IAAA,aAAA,eAAA,WAAA,YAAA,CAAA,CAAA;EAMrB,CAAA,gBAAA,CAAA,CAAA,CAAA;EAIX,OAAA,eAAA,YAAA,YAAA,aAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAkEmB,CAAA,CAAA,YAAA,CAAA,CAAA;GA0ClB,CAAA,CAAA,IAAA,CAAA;;;;;;;;;AA5GD;AAJ6B,iBA+Nf,eAAA,CA/Ne,KAAA,EA+NQ,CAAA,CAAE,QA/NV,CAAA,EAAA,MAAA,EAAA"}
|
package/dist/lib/schema.js
CHANGED
|
@@ -121,12 +121,12 @@ const postgresConfigSchema = z.strictObject({ computeSettings: computeSettingsSc
|
|
|
121
121
|
/**
|
|
122
122
|
* Branch-unique function slug. Mirrors the Neon Functions API path-segment rule
|
|
123
123
|
* (`platform/internal/platform/functions/name.go`): 1–20 lowercase letters and digits.
|
|
124
|
-
* Used as the **key schema** of the `
|
|
124
|
+
* Used as the **key schema** of the `functions` record, so a bad slug fails
|
|
125
125
|
* validation with a path pointing at the offending key and duplicate slugs are impossible
|
|
126
126
|
* by construction (object keys are unique).
|
|
127
127
|
*/
|
|
128
128
|
const functionSlugSchema = z.string().regex(/^[a-z0-9]{1,20}$/, "function slug must be 1-20 lowercase letters and digits (no hyphens or other characters)");
|
|
129
|
-
/** Bucket name: 1–255 chars. Used as the key schema of the `
|
|
129
|
+
/** Bucket name: 1–255 chars. Used as the key schema of the `buckets` record. */
|
|
130
130
|
const bucketNameSchema = z.string().min(1).max(255);
|
|
131
131
|
/**
|
|
132
132
|
* A single function environment-variable value. Must be a defined string: a `process.env.X`
|
|
@@ -162,11 +162,22 @@ const devPortSchema = z.number().int().min(1).max(65535);
|
|
|
162
162
|
const functionDevConfigSchema = z.strictObject({ port: devPortSchema.optional() });
|
|
163
163
|
const functionScheduleTriggerSchema = z.strictObject({
|
|
164
164
|
type: z.literal("schedule"),
|
|
165
|
-
|
|
165
|
+
function: functionSlugSchema,
|
|
166
166
|
cron: z.string().min(1),
|
|
167
167
|
functionPath: z.string().min(1).optional(),
|
|
168
168
|
enabled: z.boolean().optional()
|
|
169
169
|
});
|
|
170
|
+
const functionStorageObjectCreatedTriggerSchema = z.strictObject({
|
|
171
|
+
type: z.literal("storage_object_created"),
|
|
172
|
+
function: functionSlugSchema,
|
|
173
|
+
bucket: bucketNameSchema,
|
|
174
|
+
prefix: z.string().min(1).max(1024).optional(),
|
|
175
|
+
functionPath: z.string().min(1).optional(),
|
|
176
|
+
enabled: z.boolean().optional()
|
|
177
|
+
});
|
|
178
|
+
const functionTriggerSchema = z.discriminatedUnion("type", [functionScheduleTriggerSchema, functionStorageObjectCreatedTriggerSchema]);
|
|
179
|
+
const triggerNameSchema = z.string().min(1).max(255);
|
|
180
|
+
const triggersRecordSchema = z.record(triggerNameSchema, functionTriggerSchema);
|
|
170
181
|
const customDomainSchema = z.string().superRefine((value, ctx) => {
|
|
171
182
|
const message = customDomainValidationError(value);
|
|
172
183
|
if (message) ctx.addIssue({
|
|
@@ -256,7 +267,6 @@ const functionDefSchema = z.strictObject({
|
|
|
256
267
|
externalPackages: functionExternalPackagesSchema.optional(),
|
|
257
268
|
bundler: bundlerSchema.optional(),
|
|
258
269
|
dev: functionDevConfigSchema.optional(),
|
|
259
|
-
triggers: z.array(functionScheduleTriggerSchema).optional(),
|
|
260
270
|
customDomains: customDomainsSchema.optional()
|
|
261
271
|
}).check((ctx) => {
|
|
262
272
|
const entries = ctx.value.externalPackages ?? [];
|
|
@@ -313,49 +323,17 @@ const functionDefSchema = z.strictObject({
|
|
|
313
323
|
});
|
|
314
324
|
/** Static definition of a bucket (existence). Name is the record key. */
|
|
315
325
|
const bucketDefSchema = z.strictObject({ access: z.union([z.literal("private"), z.literal("public_read")]).optional() });
|
|
326
|
+
/**
|
|
327
|
+
* Functions record. Used as both top-level `functions` and `preview.functions`
|
|
328
|
+
* so {@link previewInputSchema} (`schemas.preview`) keeps the same validation
|
|
329
|
+
* when parsed on its own.
|
|
330
|
+
*/
|
|
331
|
+
const functionsRecordSchema = z.record(functionSlugSchema, functionDefSchema);
|
|
316
332
|
/** Static, beta Preview feature set: AI Gateway toggle + functions/buckets records. */
|
|
317
333
|
const previewInputSchema = z.strictObject({
|
|
318
334
|
aiGateway: serviceToggleInputSchema.optional(),
|
|
319
|
-
functions:
|
|
335
|
+
functions: functionsRecordSchema.optional(),
|
|
320
336
|
buckets: z.record(bucketNameSchema, bucketDefSchema).optional()
|
|
321
|
-
}).superRefine((preview, ctx) => {
|
|
322
|
-
const byName = /* @__PURE__ */ new Map();
|
|
323
|
-
for (const [slug, fn] of Object.entries(preview.functions ?? {})) {
|
|
324
|
-
const seenOnFn = /* @__PURE__ */ new Set();
|
|
325
|
-
for (const [index, trigger] of (fn.triggers ?? []).entries()) {
|
|
326
|
-
if (seenOnFn.has(trigger.name)) {
|
|
327
|
-
ctx.addIssue({
|
|
328
|
-
code: "custom",
|
|
329
|
-
path: [
|
|
330
|
-
"functions",
|
|
331
|
-
slug,
|
|
332
|
-
"triggers",
|
|
333
|
-
index,
|
|
334
|
-
"name"
|
|
335
|
-
],
|
|
336
|
-
message: `trigger name "${trigger.name}" is listed more than once on function "${slug}"`
|
|
337
|
-
});
|
|
338
|
-
continue;
|
|
339
|
-
}
|
|
340
|
-
seenOnFn.add(trigger.name);
|
|
341
|
-
const prior = byName.get(trigger.name);
|
|
342
|
-
if (prior !== void 0) {
|
|
343
|
-
ctx.addIssue({
|
|
344
|
-
code: "custom",
|
|
345
|
-
path: [
|
|
346
|
-
"functions",
|
|
347
|
-
slug,
|
|
348
|
-
"triggers",
|
|
349
|
-
index,
|
|
350
|
-
"name"
|
|
351
|
-
],
|
|
352
|
-
message: `trigger name "${trigger.name}" is already used by function "${prior}"`
|
|
353
|
-
});
|
|
354
|
-
continue;
|
|
355
|
-
}
|
|
356
|
-
byName.set(trigger.name, slug);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
337
|
});
|
|
360
338
|
/** Per-function deploy tuning returned by the `branch` closure. */
|
|
361
339
|
const functionTuningSchema = z.strictObject({
|
|
@@ -380,6 +358,7 @@ const branchTuningSchema = z.strictObject({
|
|
|
380
358
|
});
|
|
381
359
|
}),
|
|
382
360
|
postgres: postgresConfigSchema.optional(),
|
|
361
|
+
functions: z.record(functionSlugSchema, functionTuningSchema).optional(),
|
|
383
362
|
preview: previewTuningSchema.optional()
|
|
384
363
|
}).superRefine((cfg, ctx) => {
|
|
385
364
|
validateParentReference({
|
|
@@ -387,6 +366,12 @@ const branchTuningSchema = z.strictObject({
|
|
|
387
366
|
path: ["parent"],
|
|
388
367
|
parent: cfg.parent
|
|
389
368
|
});
|
|
369
|
+
rejectDuplicateHome(ctx, {
|
|
370
|
+
gaPresent: cfg.functions !== void 0,
|
|
371
|
+
previewPresent: cfg.preview?.functions !== void 0,
|
|
372
|
+
gaPath: "functions",
|
|
373
|
+
previewPath: "preview.functions"
|
|
374
|
+
});
|
|
390
375
|
});
|
|
391
376
|
/**
|
|
392
377
|
* The top-level object accepted by `defineConfig`. The `branch` closure is validated
|
|
@@ -396,9 +381,32 @@ const branchTuningSchema = z.strictObject({
|
|
|
396
381
|
const configInputSchema = z.strictObject({
|
|
397
382
|
auth: serviceToggleInputSchema.optional(),
|
|
398
383
|
dataApi: dataApiInputSchema.optional(),
|
|
384
|
+
aiGateway: serviceToggleInputSchema.optional(),
|
|
385
|
+
functions: functionsRecordSchema.optional(),
|
|
386
|
+
buckets: z.record(bucketNameSchema, bucketDefSchema).optional(),
|
|
387
|
+
triggers: triggersRecordSchema.optional(),
|
|
399
388
|
preview: previewInputSchema.optional(),
|
|
400
389
|
branch: z.custom((value) => typeof value === "function", { message: "branch must be a function: `branch: (branch) => ({ … })`" }).optional()
|
|
401
390
|
}).superRefine((cfg, ctx) => {
|
|
391
|
+
rejectDuplicateHome(ctx, {
|
|
392
|
+
gaPresent: cfg.aiGateway !== void 0,
|
|
393
|
+
previewPresent: cfg.preview?.aiGateway !== void 0,
|
|
394
|
+
gaPath: "aiGateway",
|
|
395
|
+
previewPath: "preview.aiGateway"
|
|
396
|
+
});
|
|
397
|
+
rejectDuplicateHome(ctx, {
|
|
398
|
+
gaPresent: cfg.functions !== void 0,
|
|
399
|
+
previewPresent: cfg.preview?.functions !== void 0,
|
|
400
|
+
gaPath: "functions",
|
|
401
|
+
previewPath: "preview.functions"
|
|
402
|
+
});
|
|
403
|
+
rejectDuplicateHome(ctx, {
|
|
404
|
+
gaPresent: cfg.buckets !== void 0,
|
|
405
|
+
previewPresent: cfg.preview?.buckets !== void 0,
|
|
406
|
+
gaPath: "buckets",
|
|
407
|
+
previewPath: "preview.buckets"
|
|
408
|
+
});
|
|
409
|
+
validateAuthoredTriggers(cfg, ctx);
|
|
402
410
|
if (!isToggleEnabledValue(cfg.dataApi)) return;
|
|
403
411
|
if (dataApiAuthProviderValue(cfg.dataApi) !== "neon") return;
|
|
404
412
|
if (!isToggleEnabledValue(cfg.auth)) ctx.addIssue({
|
|
@@ -407,6 +415,39 @@ const configInputSchema = z.strictObject({
|
|
|
407
415
|
message: "dataApi with authProvider \"neon\" requires Neon Auth — set `auth: true` (or `auth: { enabled: true }`), or use `dataApi.authProvider: \"external\"` with your own `jwksUrl`."
|
|
408
416
|
});
|
|
409
417
|
});
|
|
418
|
+
function validateAuthoredTriggers(cfg, ctx) {
|
|
419
|
+
if (cfg.triggers === void 0) return;
|
|
420
|
+
const functions = new Set(Object.keys(cfg.functions ?? cfg.preview?.functions ?? {}));
|
|
421
|
+
const buckets = new Set(Object.keys(cfg.buckets ?? cfg.preview?.buckets ?? {}));
|
|
422
|
+
for (const [name, trigger] of Object.entries(cfg.triggers)) {
|
|
423
|
+
if (!functions.has(trigger.function)) ctx.addIssue({
|
|
424
|
+
code: "custom",
|
|
425
|
+
path: [
|
|
426
|
+
"triggers",
|
|
427
|
+
name,
|
|
428
|
+
"function"
|
|
429
|
+
],
|
|
430
|
+
message: `trigger "${name}" references function "${trigger.function}", which is not declared in functions (or preview.functions)`
|
|
431
|
+
});
|
|
432
|
+
if (trigger.type === "storage_object_created" && !buckets.has(trigger.bucket)) ctx.addIssue({
|
|
433
|
+
code: "custom",
|
|
434
|
+
path: [
|
|
435
|
+
"triggers",
|
|
436
|
+
name,
|
|
437
|
+
"bucket"
|
|
438
|
+
],
|
|
439
|
+
message: `trigger "${name}" references bucket "${trigger.bucket}", which is not declared in buckets (or preview.buckets)`
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
function rejectDuplicateHome(ctx, args) {
|
|
444
|
+
if (!args.gaPresent || !args.previewPresent) return;
|
|
445
|
+
ctx.addIssue({
|
|
446
|
+
code: "custom",
|
|
447
|
+
path: args.gaPath.split("."),
|
|
448
|
+
message: `${args.gaPath} is also declared as ${args.previewPath}. Keep ${args.gaPath} and remove ${args.previewPath}.`
|
|
449
|
+
});
|
|
450
|
+
}
|
|
410
451
|
/**
|
|
411
452
|
* Whether a parsed `auth` / `dataApi` toggle value is enabled: a present object (or `true`)
|
|
412
453
|
* is on unless `enabled` is explicitly `false`. Mirrors `isServiceEnabled` in
|
|
@@ -476,6 +517,6 @@ function normaliseIssueMessage(issue) {
|
|
|
476
517
|
return issue.message;
|
|
477
518
|
}
|
|
478
519
|
//#endregion
|
|
479
|
-
export { branchTuningSchema, bucketDefSchema, computeSettingsSchema, configInputSchema, dataApiConfigSchema, dataApiInputSchema, dataApiSettingsSchema, formatZodIssues, functionDefSchema, functionTuningSchema, postgresConfigSchema, previewInputSchema, serviceToggleInputSchema, serviceToggleSchema };
|
|
520
|
+
export { branchTuningSchema, bucketDefSchema, computeSettingsSchema, configInputSchema, dataApiConfigSchema, dataApiInputSchema, dataApiSettingsSchema, formatZodIssues, functionDefSchema, functionTuningSchema, functionsRecordSchema, postgresConfigSchema, previewInputSchema, serviceToggleInputSchema, serviceToggleSchema };
|
|
480
521
|
|
|
481
522
|
//# sourceMappingURL=schema.js.map
|
package/dist/lib/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":[],"sources":["../../src/lib/schema.ts"],"sourcesContent":["import { z } from \"zod\";\nimport {\n\tcustomDomainValidationError,\n\tnormalizeCustomDomain,\n} from \"./custom-domain.js\";\nimport { parseBranchTtl, parseSuspendTimeout } from \"./duration.js\";\nimport { externalPackageRoot } from \"./external-packages.js\";\nimport { isWildcardPattern, validatePattern } from \"./patterns.js\";\nimport { COMPUTE_UNITS, type FunctionBundlerInput } from \"./types.js\";\n\n/** Autoscaling max from the compute size table; larger sizes are fixed-size only. */\nconst AUTOSCALING_MAX_CU = 16;\n/** Documented ceiling on `max - min` when both bounds are set and differ. */\nconst AUTOSCALING_MAX_RANGE_CU = 8;\n\nconst computeUnitSchema = z.literal(COMPUTE_UNITS, {\n\terror: (issue) =>\n\t\t`must be a compute size Neon offers: 0.25, 0.5, an integer 1-16, or an even integer 18-56 (got ${JSON.stringify(issue.input)})`,\n});\n\n/**\n * Zod schema for {@link import(\"./types.js\").ComputeSettings}.\n *\n * CU values come from {@link COMPUTE_UNITS} (the Console size table). Plan limits are\n * the API's job. Cross-field autoscaling rules apply only when both bounds are set:\n * `min <= max`; if they differ, each bound is ≤ 16 and `max - min` ≤ 8. A single bound\n * cannot be checked against those rules because the other end is the project's default.\n *\n * `suspendTimeout` can be:\n * - `false` (never suspend)\n * - duration string like \"5m\", \"1h\" (must be 60s-604800s when parsed)\n * - number in seconds (60-604800, or -1/0 for special values)\n * - `undefined` (use platform default)\n */\nexport const computeSettingsSchema = z\n\t.strictObject({\n\t\tautoscalingLimitMinCu: computeUnitSchema.optional(),\n\t\tautoscalingLimitMaxCu: computeUnitSchema.optional(),\n\t\tsuspendTimeout: z\n\t\t\t.union([z.literal(false), z.string(), z.number()])\n\t\t\t.optional()\n\t\t\t.superRefine((value, ctx) => {\n\t\t\t\tif (value === undefined) return; // undefined is valid (use platform default)\n\t\t\t\tconst result = parseSuspendTimeout(value);\n\t\t\t\tif (\"error\" in result) {\n\t\t\t\t\tctx.addIssue({\n\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\tmessage: result.error,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}),\n\t})\n\t.superRefine((settings, ctx) => {\n\t\tconst { autoscalingLimitMinCu: min, autoscalingLimitMaxCu: max } =\n\t\t\tsettings;\n\t\tif (min === undefined || max === undefined) return;\n\t\tif (min > max) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"autoscalingLimitMinCu\"],\n\t\t\t\tmessage: `autoscalingLimitMinCu (${min}) must be <= autoscalingLimitMaxCu (${max})`,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (min === max) return;\n\t\tconst overMaxMessage = (field: string, value: number) =>\n\t\t\t`${field} (${value}) exceeds the autoscaling maximum of ${AUTOSCALING_MAX_CU} CU — sizes above ${AUTOSCALING_MAX_CU} are fixed-size only (set autoscalingLimitMinCu = autoscalingLimitMaxCu)`;\n\t\tif (min > AUTOSCALING_MAX_CU) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"autoscalingLimitMinCu\"],\n\t\t\t\tmessage: overMaxMessage(\"autoscalingLimitMinCu\", min),\n\t\t\t});\n\t\t}\n\t\tif (max > AUTOSCALING_MAX_CU) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"autoscalingLimitMaxCu\"],\n\t\t\t\tmessage: overMaxMessage(\"autoscalingLimitMaxCu\", max),\n\t\t\t});\n\t\t}\n\t\tif (max - min > AUTOSCALING_MAX_RANGE_CU) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"autoscalingLimitMaxCu\"],\n\t\t\t\tmessage: `autoscaling range cannot exceed ${AUTOSCALING_MAX_RANGE_CU} CU: min ${min} to max ${max} is a range of ${max - min}`,\n\t\t\t});\n\t\t}\n\t});\n\n/** Object form of a service toggle (`{ enabled?: boolean }`). */\nexport const serviceToggleSchema = z.strictObject({\n\tenabled: z.boolean().optional(),\n});\n\n/** A service toggle as written in a policy: `boolean` or `{ enabled?: boolean }`. */\nexport const serviceToggleInputSchema = z.union([\n\tz.boolean(),\n\tserviceToggleSchema,\n]);\n\n/**\n * Reusable Data API runtime settings (camelCase mirror of the Neon API `DataAPISettings`).\n * `strictObject` so a typo / snake_case key fails loudly instead of being silently dropped.\n */\nexport const dataApiSettingsSchema = z.strictObject({\n\tdbAggregatesEnabled: z.boolean().optional(),\n\tdbAnonRole: z.string().optional(),\n\tdbExtraSearchPath: z.string().optional(),\n\tdbMaxRows: z.number().int().optional(),\n\tdbSchemas: z.array(z.string()).optional(),\n\tjwtRoleClaimKey: z.string().optional(),\n\tjwtCacheMaxLifetime: z.number().int().optional(),\n\topenapiMode: z\n\t\t.union([z.literal(\"ignore-privileges\"), z.literal(\"disabled\")])\n\t\t.optional(),\n\tserverCorsAllowedOrigins: z.string().optional(),\n\tserverTimingEnabled: z.boolean().optional(),\n});\n\n/** Names of the external-IdP-only fields, forbidden when `authProvider` is `\"neon\"`. */\nconst DATA_API_EXTERNAL_ONLY_KEYS = [\n\t\"jwksUrl\",\n\t\"providerName\",\n\t\"jwtAudience\",\n] as const;\n\n/**\n * Object form of the `dataApi` toggle. A single `strictObject` plus a `superRefine` (rather\n * than a discriminated union) so the `\"neon\"` default works without the discriminator being\n * present, and so the \"external-only field with authProvider neon\" error points at the exact\n * offending key — mirroring the `?: never` type-level guard at runtime.\n */\nexport const dataApiConfigSchema = z\n\t.strictObject({\n\t\tenabled: z.boolean().optional(),\n\t\tauthProvider: z\n\t\t\t.union([z.literal(\"neon\"), z.literal(\"external\")])\n\t\t\t.optional(),\n\t\tjwksUrl: z.string().optional(),\n\t\tproviderName: z.string().optional(),\n\t\tjwtAudience: z.string().optional(),\n\t\tsettings: dataApiSettingsSchema.optional(),\n\t})\n\t.superRefine((cfg, ctx) => {\n\t\tconst provider = cfg.authProvider ?? \"neon\";\n\t\tif (provider !== \"neon\") return;\n\t\tfor (const key of DATA_API_EXTERNAL_ONLY_KEYS) {\n\t\t\tif (cfg[key] !== undefined) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tpath: [key],\n\t\t\t\t\tmessage: `${key} is only allowed with authProvider: \"external\" — Neon supplies it for authProvider: \"neon\".`,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n\n/** A `dataApi` toggle as written in a policy: `boolean` or {@link dataApiConfigSchema}. */\nexport const dataApiInputSchema = z.union([z.boolean(), dataApiConfigSchema]);\n\nexport const postgresConfigSchema = z.strictObject({\n\tcomputeSettings: computeSettingsSchema.optional(),\n});\n\n/**\n * Branch-unique function slug. Mirrors the Neon Functions API path-segment rule\n * (`platform/internal/platform/functions/name.go`): 1–20 lowercase letters and digits.\n * Used as the **key schema** of the `preview.functions` record, so a bad slug fails\n * validation with a path pointing at the offending key and duplicate slugs are impossible\n * by construction (object keys are unique).\n */\nconst functionSlugSchema = z\n\t.string()\n\t.regex(\n\t\t/^[a-z0-9]{1,20}$/,\n\t\t\"function slug must be 1-20 lowercase letters and digits (no hyphens or other characters)\",\n\t);\n\n/** Bucket name: 1–255 chars. Used as the key schema of the `preview.buckets` record. */\nconst bucketNameSchema = z.string().min(1).max(255);\n\n/**\n * A single function environment-variable value. Must be a defined string: a `process.env.X`\n * that is unset evaluates to `undefined`, and the bare `z.string()` message for that case\n * (`Invalid input: expected string, received undefined`) gives no hint that an env var is the\n * culprit. The custom `error` replaces *only* the `undefined` case with a message that names\n * the offending function + env key (read from the issue path) and how to fix it; any other\n * wrong type keeps zod's default (`expected string, received number`, …).\n */\nconst functionEnvValueSchema = z.string({\n\terror: (issue) => {\n\t\tif (issue.input !== undefined) return undefined;\n\t\tconst path = issue.path ?? [];\n\t\tconst key = path.length > 0 ? String(path[path.length - 1]) : undefined;\n\t\tconst functionsIndex = path.indexOf(\"functions\");\n\t\tconst slug =\n\t\t\tfunctionsIndex >= 0 && functionsIndex + 1 < path.length\n\t\t\t\t? String(path[functionsIndex + 1])\n\t\t\t\t: undefined;\n\t\tconst subject =\n\t\t\tslug !== undefined && key !== undefined\n\t\t\t\t? `Environment variable \"${key}\" for function \"${slug}\"`\n\t\t\t\t: key !== undefined\n\t\t\t\t\t? `Environment variable \"${key}\"`\n\t\t\t\t\t: \"An environment variable\";\n\t\treturn `${subject} is undefined — its value (typically a \\`process.env.*\\`) is unset. Set it (for example \\`neon deploy --env <file>\\`) or omit the key from neon.ts if you do not want to write it. Do not coerce a missing value to an empty string: that uploads and deletes the live key.`;\n\t},\n});\n\n/**\n * Per-function environment map. Every value must be a defined string (see\n * {@link functionEnvValueSchema}): a `process.env.X` that is unset surfaces as `undefined` and\n * is rejected here (rather than silently shipping `undefined` into the deployment).\n */\nconst functionEnvSchema = z.record(z.string(), functionEnvValueSchema);\n\n/**\n * TCP port for a function's local dev server. Excludes 0 (which means \"any port\" to the OS\n * — `neon dev` expresses \"pick one for me\" by omitting `port`, not by passing 0).\n */\nconst devPortSchema = z.number().int().min(1).max(65535);\n\n/**\n * Local-dev settings for a function (`neon dev` only; never affects deploy). `port` is bound\n * exactly when set (and `neon dev` fails if it is taken), or a free port is found when omitted.\n */\nconst functionDevConfigSchema = z.strictObject({\n\tport: devPortSchema.optional(),\n});\n\nconst functionScheduleTriggerSchema = z.strictObject({\n\ttype: z.literal(\"schedule\"),\n\tname: z.string().min(1).max(255),\n\tcron: z.string().min(1),\n\tfunctionPath: z.string().min(1).optional(),\n\tenabled: z.boolean().optional(),\n});\n\nconst customDomainSchema = z.string().superRefine((value, ctx) => {\n\tconst message = customDomainValidationError(value);\n\tif (message) {\n\t\tctx.addIssue({ code: \"custom\", message });\n\t}\n});\n\nconst customDomainsSchema = z\n\t.array(customDomainSchema)\n\t.superRefine((domains, ctx) => {\n\t\tconst seen = new Set<string>();\n\t\tfor (const [index, domain] of domains.entries()) {\n\t\t\tconst normalized = normalizeCustomDomain(domain);\n\t\t\tif (seen.has(normalized)) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tpath: [index],\n\t\t\t\t\tmessage: `custom domain \"${normalized}\" is listed more than once`,\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseen.add(normalized);\n\t\t}\n\t});\n\n/**\n * The name of a package the bundler must leave alone. Accepts what esbuild's `external`\n * accepts for a package — a bare name, a scope, or a subpath — and rejects a relative or\n * absolute path, which names a local module rather than a dependency and is never the right\n * thing to externalize (the bundle would ship an import of a file that isn't deployed).\n */\nconst externalPackageNameSchema = z\n\t.string()\n\t.min(1)\n\t.refine((value) => !value.startsWith(\".\") && !value.startsWith(\"/\"), {\n\t\terror: 'must be a package name such as \"microsandbox\" or \"@scope/pkg\", not a relative or absolute path',\n\t});\n\n/**\n * An entry whose files are staged has to name one installable package, because the deploy\n * hands its root to `npm install`. esbuild's `external` additionally accepts a `*` wildcard\n * and a bare scope, which name a set rather than a package — legal only when nothing is\n * being installed for them.\n */\nconst stageablePackageName = (value: string): boolean => {\n\t// A protocol (`node:fs`, `npm:pkg`) is a specifier, not something to install.\n\tif (/^[a-z][a-z0-9+.-]*:/i.test(value)) return false;\n\t// An empty segment (`foo//bar`) or a traversal is not a subpath the deploy can act on.\n\tconst segments = value.split(\"/\");\n\tif (segments.some((segment) => segment === \"\" || segment === \"..\")) {\n\t\treturn false;\n\t}\n\treturn isNpmPackageName(externalPackageRoot(value));\n};\n\n/**\n * npm's own rules for a package name, which is what the deploy hands to `npm install`.\n * Deliberately strict: whatever slips through here becomes a subprocess argument.\n */\nconst NPM_NAME_SEGMENT = /^[a-z0-9~][a-z0-9._~-]*$/;\n\nconst isNpmPackageName = (root: string): boolean => {\n\tif (root.length === 0 || root.length > 214) return false;\n\tif (!root.startsWith(\"@\")) return NPM_NAME_SEGMENT.test(root);\n\tconst [scope, name, ...rest] = root.slice(1).split(\"/\");\n\t// A bare scope names every package in it, not one package.\n\tif (rest.length > 0 || name === undefined) return false;\n\treturn NPM_NAME_SEGMENT.test(scope) && NPM_NAME_SEGMENT.test(name);\n};\n\n/**\n * One entry of `externalPackages`. A bare string is the common case and ships the package's\n * files; the object form exists only to turn that off. See {@link FunctionDef.externalPackages}.\n */\nconst externalPackageEntrySchema = z.union([\n\texternalPackageNameSchema,\n\tz.strictObject({\n\t\tname: externalPackageNameSchema,\n\t\tincludeFiles: z.boolean().optional(),\n\t}),\n]);\n\n/**\n * Per-function list of packages esbuild leaves unresolved at deploy time. See\n * {@link FunctionDef.externalPackages}.\n */\nconst functionExternalPackagesSchema = z.array(externalPackageEntrySchema);\n\nconst runtimeSchema = z.literal(\"nodejs24\");\n\nconst bundlerSchema = z.custom<FunctionBundlerInput>(\n\t(value) =>\n\t\tvalue === \"esbuild\" || value === \"none\" || typeof value === \"function\",\n\t{\n\t\tmessage:\n\t\t\t'bundler must be \"esbuild\", \"none\", or a function (fn) => Promise<FunctionBundle>',\n\t},\n);\n\nconst isEsbuildBundler = (\n\tbundler: z.infer<typeof bundlerSchema> | undefined,\n): boolean => bundler === undefined || bundler === \"esbuild\";\n\n/** The declared name of an entry, whichever form it was written in. */\nconst entryName = (\n\tentry: z.infer<typeof externalPackageEntrySchema>,\n): string => (typeof entry === \"string\" ? entry : entry.name);\n\n/** Whether an entry ships its files. Absent means yes — see `FunctionDef.externalPackages`. */\nconst entryIncludesFiles = (\n\tentry: z.infer<typeof externalPackageEntrySchema>,\n): boolean => (typeof entry === \"string\" ? true : entry.includeFiles !== false);\n\n/**\n * Static definition of a function (existence). The slug is the record key (validated by\n * {@link functionSlugSchema}), so it is not a field here. Deploy tuning (`runtime`) lives\n * in the `branch` closure, not here.\n *\n * `externalPackages` entries are checked for contradictions: the same package named twice,\n * or named once bare and once through a subpath with a different `includeFiles`. Both state\n * two intents for one package, and files are staged per package rather than per subpath, so\n * neither can be honoured as written.\n */\nexport const functionDefSchema = z\n\t.strictObject({\n\t\tname: z.string().min(1).max(255),\n\t\tsource: z.string().min(1),\n\t\tenv: functionEnvSchema.optional(),\n\t\texternalPackages: functionExternalPackagesSchema.optional(),\n\t\tbundler: bundlerSchema.optional(),\n\t\tdev: functionDevConfigSchema.optional(),\n\t\ttriggers: z.array(functionScheduleTriggerSchema).optional(),\n\t\tcustomDomains: customDomainsSchema.optional(),\n\t})\n\t.check((ctx) => {\n\t\tconst entries = ctx.value.externalPackages ?? [];\n\n\t\t// Other bundlers own their output, so `externalPackages` would be ignored.\n\t\tif (\n\t\t\tctx.value.externalPackages !== undefined &&\n\t\t\t!isEsbuildBundler(ctx.value.bundler)\n\t\t) {\n\t\t\tctx.issues.push({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tinput: ctx.value.externalPackages,\n\t\t\t\tpath: [\"externalPackages\"],\n\t\t\t\tmessage: `externalPackages only applies to the \"esbuild\" bundler; the \"${\n\t\t\t\t\ttypeof ctx.value.bundler === \"function\"\n\t\t\t\t\t\t? \"custom\"\n\t\t\t\t\t\t: ctx.value.bundler\n\t\t\t\t}\" bundler controls its own output. Remove externalPackages or switch to the esbuild bundler`,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst seenNames = new Map<string, number>();\n\t\tconst rootIntent = new Map<\n\t\t\tstring,\n\t\t\t{ includeFiles: boolean; at: string }\n\t\t>();\n\n\t\tentries.forEach((entry, index) => {\n\t\t\tconst name = entryName(entry);\n\t\t\tconst includeFiles = entryIncludesFiles(entry);\n\n\t\t\tif (includeFiles && !stageablePackageName(name)) {\n\t\t\t\tctx.issues.push({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tinput: entry,\n\t\t\t\t\tpath: [\"externalPackages\", index],\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`\"${name}\" does not name a single installable package, so its files cannot ` +\n\t\t\t\t\t\t`be staged. Name one package, or set includeFiles: false to leave the ` +\n\t\t\t\t\t\t`import unresolved without shipping anything for it`,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst firstIndex = seenNames.get(name);\n\t\t\tif (firstIndex !== undefined) {\n\t\t\t\tctx.issues.push({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tinput: entry,\n\t\t\t\t\tpath: [\"externalPackages\", index],\n\t\t\t\t\tmessage: `\"${name}\" is listed more than once (first at index ${firstIndex})`,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tseenNames.set(name, index);\n\n\t\t\t// Files are installed and traced per package, so two specifiers that resolve to the\n\t\t\t// same package cannot disagree about whether that package's files ship.\n\t\t\tconst root = externalPackageRoot(name);\n\t\t\tconst prior = rootIntent.get(root);\n\t\t\tif (prior !== undefined && prior.includeFiles !== includeFiles) {\n\t\t\t\tctx.issues.push({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tinput: entry,\n\t\t\t\t\tpath: [\"externalPackages\", index],\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`\"${name}\" and \"${prior.at}\" are both part of the \"${root}\" package but disagree ` +\n\t\t\t\t\t\t`about includeFiles; files ship per package, so the whole package either ships or does not`,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trootIntent.set(root, { includeFiles, at: name });\n\t\t});\n\t});\n\n/** Static definition of a bucket (existence). Name is the record key. */\nexport const bucketDefSchema = z.strictObject({\n\taccess: z\n\t\t.union([z.literal(\"private\"), z.literal(\"public_read\")])\n\t\t.optional(),\n});\n\n/** Static, beta Preview feature set: AI Gateway toggle + functions/buckets records. */\nexport const previewInputSchema = z\n\t.strictObject({\n\t\taiGateway: serviceToggleInputSchema.optional(),\n\t\tfunctions: z.record(functionSlugSchema, functionDefSchema).optional(),\n\t\tbuckets: z.record(bucketNameSchema, bucketDefSchema).optional(),\n\t})\n\t.superRefine((preview, ctx) => {\n\t\tconst byName = new Map<string, string>();\n\t\tfor (const [slug, fn] of Object.entries(preview.functions ?? {})) {\n\t\t\tconst seenOnFn = new Set<string>();\n\t\t\tfor (const [index, trigger] of (fn.triggers ?? []).entries()) {\n\t\t\t\tif (seenOnFn.has(trigger.name)) {\n\t\t\t\t\tctx.addIssue({\n\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\tpath: [\"functions\", slug, \"triggers\", index, \"name\"],\n\t\t\t\t\t\tmessage: `trigger name \"${trigger.name}\" is listed more than once on function \"${slug}\"`,\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tseenOnFn.add(trigger.name);\n\t\t\t\tconst prior = byName.get(trigger.name);\n\t\t\t\tif (prior !== undefined) {\n\t\t\t\t\tctx.addIssue({\n\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\tpath: [\"functions\", slug, \"triggers\", index, \"name\"],\n\t\t\t\t\t\tmessage: `trigger name \"${trigger.name}\" is already used by function \"${prior}\"`,\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbyName.set(trigger.name, slug);\n\t\t\t}\n\t\t}\n\t});\n\n/** Per-function deploy tuning returned by the `branch` closure. */\nexport const functionTuningSchema = z.strictObject({\n\truntime: runtimeSchema.optional(),\n\tcustomDomains: customDomainsSchema.optional(),\n});\n\n/** Per-branch Preview tuning. Keys must be slugs declared in the static `preview`. */\nconst previewTuningSchema = z.strictObject({\n\tfunctions: z.record(functionSlugSchema, functionTuningSchema).optional(),\n});\n\n/**\n * The object returned by the `branch` closure. Validated on every `resolveConfig` call so\n * tuning errors point at the concrete branch target that triggered them.\n */\nexport const branchTuningSchema = z\n\t.strictObject({\n\t\tparent: z.string().optional(),\n\t\tprotected: z.boolean().optional(),\n\t\tttl: z\n\t\t\t.union([z.string(), z.number()])\n\t\t\t.optional()\n\t\t\t.superRefine((value, ctx) => {\n\t\t\t\tif (value === undefined) return;\n\t\t\t\tconst result = parseBranchTtl(value);\n\t\t\t\tif (\"error\" in result) {\n\t\t\t\t\tctx.addIssue({ code: \"custom\", message: result.error });\n\t\t\t\t}\n\t\t\t}),\n\t\tpostgres: postgresConfigSchema.optional(),\n\t\tpreview: previewTuningSchema.optional(),\n\t})\n\t.superRefine((cfg, ctx) => {\n\t\tvalidateParentReference({\n\t\t\tctx,\n\t\t\tpath: [\"parent\"],\n\t\t\tparent: cfg.parent,\n\t\t});\n\t});\n\n/**\n * The top-level object accepted by `defineConfig`. The `branch` closure is validated\n * structurally as a function here; its returned tuning is validated per-evaluation by\n * {@link branchTuningSchema} inside `resolveConfig`.\n */\nexport const configInputSchema = z\n\t.strictObject({\n\t\tauth: serviceToggleInputSchema.optional(),\n\t\tdataApi: dataApiInputSchema.optional(),\n\t\tpreview: previewInputSchema.optional(),\n\t\tbranch: z\n\t\t\t.custom<(...args: unknown[]) => unknown>(\n\t\t\t\t(value) => typeof value === \"function\",\n\t\t\t\t{\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"branch must be a function: `branch: (branch) => ({ … })`\",\n\t\t\t\t},\n\t\t\t)\n\t\t\t.optional(),\n\t})\n\t.superRefine((cfg, ctx) => {\n\t\t// A Data API verified by Neon Auth (`authProvider: \"neon\"`, the default) needs Neon\n\t\t// Auth enabled on the same branch so the tokens it verifies actually exist. Enforce\n\t\t// the same invariant the `defineConfig` type-level check expresses, at runtime.\n\t\tif (!isToggleEnabledValue(cfg.dataApi)) return;\n\t\tif (dataApiAuthProviderValue(cfg.dataApi) !== \"neon\") return;\n\t\tif (!isToggleEnabledValue(cfg.auth)) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"auth\"],\n\t\t\t\tmessage:\n\t\t\t\t\t'dataApi with authProvider \"neon\" requires Neon Auth — set `auth: true` (or `auth: { enabled: true }`), or use `dataApi.authProvider: \"external\"` with your own `jwksUrl`.',\n\t\t\t});\n\t\t}\n\t});\n\n/**\n * Whether a parsed `auth` / `dataApi` toggle value is enabled: a present object (or `true`)\n * is on unless `enabled` is explicitly `false`. Mirrors `isServiceEnabled` in\n * `define-config.ts`, operating on the already-validated runtime value.\n */\nfunction isToggleEnabledValue(value: unknown): boolean {\n\tif (value === undefined || value === null) return false;\n\tif (typeof value === \"boolean\") return value;\n\tif (typeof value === \"object\") {\n\t\treturn (value as { enabled?: unknown }).enabled !== false;\n\t}\n\treturn false;\n}\n\n/** Read the (defaulted) `authProvider` from a parsed `dataApi` value. */\nfunction dataApiAuthProviderValue(value: unknown): \"neon\" | \"external\" {\n\tif (value !== null && typeof value === \"object\") {\n\t\tconst provider = (value as { authProvider?: unknown }).authProvider;\n\t\tif (provider === \"external\") return \"external\";\n\t}\n\treturn \"neon\";\n}\n\nfunction validateParentReference(args: {\n\tctx: z.RefinementCtx;\n\tpath: (string | number)[];\n\tparent: string | undefined;\n}): void {\n\tconst { ctx, path, parent } = args;\n\tif (parent === undefined) return;\n\n\tconst patternCheck = validatePattern(parent);\n\tif (\"error\" in patternCheck) {\n\t\tctx.addIssue({ code: \"custom\", path, message: patternCheck.error });\n\t} else if (isWildcardPattern(parent)) {\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath,\n\t\t\tmessage: `parent must be a concrete branch name (no wildcards), got \"${parent}\"`,\n\t\t});\n\t}\n}\n\n/**\n * Convert the structured {@link z.ZodError} produced by `configSchema.safeParse` into the\n * `string[]` shape used by {@link import(\"./errors.js\").ConfigValidationError}.\n *\n * Issue paths are rendered as dot-separated property accesses (`postgres.computeSettings`)\n * and unknown-key issues from `strictObject` are normalised so the message contains the\n * substring \"unknown key\" — keeping pre-zod assertions in test suites and downstream tools\n * stable.\n */\nexport function formatZodIssues(error: z.ZodError): string[] {\n\treturn error.issues.map((issue) => {\n\t\tconst path = renderPath(issue.path);\n\t\tconst message = normaliseIssueMessage(issue);\n\t\treturn path ? `${path}: ${message}` : message;\n\t});\n}\n\nfunction renderPath(path: ReadonlyArray<PropertyKey>): string {\n\tlet out = \"\";\n\tfor (const segment of path) {\n\t\tif (typeof segment === \"number\") out += `[${segment}]`;\n\t\telse if (out === \"\") out += String(segment);\n\t\telse out += `.${String(segment)}`;\n\t}\n\treturn out;\n}\n\nfunction normaliseIssueMessage(issue: z.core.$ZodIssue): string {\n\tif (issue.code === \"unrecognized_keys\") {\n\t\tconst keys = issue.keys ?? [];\n\t\tconst formatted = keys.map((k) => JSON.stringify(k)).join(\", \");\n\t\treturn `unknown key${keys.length === 1 ? \"\" : \"s\"}: ${formatted}`;\n\t}\n\tif (issue.code === \"invalid_key\") {\n\t\t// A record *key* that fails its key schema (e.g. a bad function slug) surfaces in\n\t\t// zod as a single `invalid_key` issue whose own `message` is the generic, useless\n\t\t// \"Invalid key in record\". The actual reason — the function-slug regex rule, say —\n\t\t// lives in the nested key-schema `issues`. Hoist those so the user sees *why* the\n\t\t// key was rejected (the offending key itself is already in the issue `path`).\n\t\tconst reasons = issue.issues\n\t\t\t.map((nested) => nested.message)\n\t\t\t.filter((message) => message.length > 0);\n\t\tif (reasons.length > 0) return reasons.join(\"; \");\n\t}\n\treturn issue.message;\n}\n"],"mappings":";;;;;;;;AAWA,MAAM,qBAAqB;;AAE3B,MAAM,2BAA2B;AAEjC,MAAM,oBAAoB,EAAE,QAAQ,eAAe,EAClD,QAAQ,UACP,iGAAiG,KAAK,UAAU,MAAM,KAAK,EAAE,GAC/H,CAAC;;;;;;;;;;;;;;;AAgBD,MAAa,wBAAwB,EACnC,aAAa;CACb,uBAAuB,kBAAkB,SAAS;CAClD,uBAAuB,kBAAkB,SAAS;CAClD,gBAAgB,EACd,MAAM;EAAC,EAAE,QAAQ,KAAK;EAAG,EAAE,OAAO;EAAG,EAAE,OAAO;CAAC,CAAC,CAAC,CACjD,SAAS,CAAC,CACV,aAAa,OAAO,QAAQ;EAC5B,IAAI,UAAU,KAAA,GAAW;EACzB,MAAM,SAAS,oBAAoB,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AgB,MAAM;CAC3C,IAAI,WAAW,cACd,IAAI,SAAS;EAAE,MAAM;EAAU;EAAM,SAAS,aAAa;CAAM,CAAC;MAC5D,IAAI,kBAAkB,MAAM,GAClC,IAAI,SAAS;EACZ,MAAM;EACN;EACA,SAAS,8DAA8D,OAAO;CAC/E,CAAC;AAEH;;;;;;;;;;AAWA,SAAgB,gBAAgB,OAA6B;CAC5D,OAAO,MAAM,OAAO,KAAK,UAAU;EAClC,MAAM,OAAO,WAAW,MAAM,IAAI;EAClC,MAAM,UAAU,sBAAsB,KAAK;EAC3C,OAAO,OAAO,GAAG,KAAK,IAAI,YAAY;CACvC,CAAC;AACF;AAEA,SAAS,WAAW,MAA0C;CAC7D,IAAI,MAAM;CACV,KAAK,MAAM,WAAW,MACrB,IAAI,OAAO,YAAY,UAAU,OAAO,IAAI,QAAQ;MAC/C,IAAI,QAAQ,IAAI,OAAO,OAAO,OAAO;MACrC,OAAO,IAAI,OAAO,OAAO;CAE/B,OAAO;AACR;AAEA,SAAS,sBAAsB,OAAiC;CAC/D,IAAI,MAAM,SAAS,qBAAqB;EACvC,MAAM,OAAO,MAAM,QAAQ,CAAC;EAC5B,MAAM,YAAY,KAAK,KAAK,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;EAC9D,OAAO,cAAc,KAAK,WAAW,IAAI,KAAK,IAAI,IAAI;CACvD;CACA,IAAI,MAAM,SAAS,eAAe;EAMjC,MAAM,UAAU,MAAM,OACpB,KAAK,WAAW,OAAO,OAAO,CAAC,CAC/B,QAAQ,YAAY,QAAQ,SAAS,CAAC;EACxC,IAAI,QAAQ,SAAS,GAAG,OAAO,QAAQ,KAAK,IAAI;CACjD;CACA,OAAO,MAAM;AACd"}
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../../src/lib/schema.ts"],"sourcesContent":["import { z } from \"zod\";\nimport {\n\tcustomDomainValidationError,\n\tnormalizeCustomDomain,\n} from \"./custom-domain.js\";\nimport { parseBranchTtl, parseSuspendTimeout } from \"./duration.js\";\nimport { externalPackageRoot } from \"./external-packages.js\";\nimport { isWildcardPattern, validatePattern } from \"./patterns.js\";\nimport { COMPUTE_UNITS, type FunctionBundlerInput } from \"./types.js\";\n\n/** Autoscaling max from the compute size table; larger sizes are fixed-size only. */\nconst AUTOSCALING_MAX_CU = 16;\n/** Documented ceiling on `max - min` when both bounds are set and differ. */\nconst AUTOSCALING_MAX_RANGE_CU = 8;\n\nconst computeUnitSchema = z.literal(COMPUTE_UNITS, {\n\terror: (issue) =>\n\t\t`must be a compute size Neon offers: 0.25, 0.5, an integer 1-16, or an even integer 18-56 (got ${JSON.stringify(issue.input)})`,\n});\n\n/**\n * Zod schema for {@link import(\"./types.js\").ComputeSettings}.\n *\n * CU values come from {@link COMPUTE_UNITS} (the Console size table). Plan limits are\n * the API's job. Cross-field autoscaling rules apply only when both bounds are set:\n * `min <= max`; if they differ, each bound is ≤ 16 and `max - min` ≤ 8. A single bound\n * cannot be checked against those rules because the other end is the project's default.\n *\n * `suspendTimeout` can be:\n * - `false` (never suspend)\n * - duration string like \"5m\", \"1h\" (must be 60s-604800s when parsed)\n * - number in seconds (60-604800, or -1/0 for special values)\n * - `undefined` (use platform default)\n */\nexport const computeSettingsSchema = z\n\t.strictObject({\n\t\tautoscalingLimitMinCu: computeUnitSchema.optional(),\n\t\tautoscalingLimitMaxCu: computeUnitSchema.optional(),\n\t\tsuspendTimeout: z\n\t\t\t.union([z.literal(false), z.string(), z.number()])\n\t\t\t.optional()\n\t\t\t.superRefine((value, ctx) => {\n\t\t\t\tif (value === undefined) return; // undefined is valid (use platform default)\n\t\t\t\tconst result = parseSuspendTimeout(value);\n\t\t\t\tif (\"error\" in result) {\n\t\t\t\t\tctx.addIssue({\n\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\tmessage: result.error,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}),\n\t})\n\t.superRefine((settings, ctx) => {\n\t\tconst { autoscalingLimitMinCu: min, autoscalingLimitMaxCu: max } =\n\t\t\tsettings;\n\t\tif (min === undefined || max === undefined) return;\n\t\tif (min > max) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"autoscalingLimitMinCu\"],\n\t\t\t\tmessage: `autoscalingLimitMinCu (${min}) must be <= autoscalingLimitMaxCu (${max})`,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (min === max) return;\n\t\tconst overMaxMessage = (field: string, value: number) =>\n\t\t\t`${field} (${value}) exceeds the autoscaling maximum of ${AUTOSCALING_MAX_CU} CU — sizes above ${AUTOSCALING_MAX_CU} are fixed-size only (set autoscalingLimitMinCu = autoscalingLimitMaxCu)`;\n\t\tif (min > AUTOSCALING_MAX_CU) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"autoscalingLimitMinCu\"],\n\t\t\t\tmessage: overMaxMessage(\"autoscalingLimitMinCu\", min),\n\t\t\t});\n\t\t}\n\t\tif (max > AUTOSCALING_MAX_CU) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"autoscalingLimitMaxCu\"],\n\t\t\t\tmessage: overMaxMessage(\"autoscalingLimitMaxCu\", max),\n\t\t\t});\n\t\t}\n\t\tif (max - min > AUTOSCALING_MAX_RANGE_CU) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"autoscalingLimitMaxCu\"],\n\t\t\t\tmessage: `autoscaling range cannot exceed ${AUTOSCALING_MAX_RANGE_CU} CU: min ${min} to max ${max} is a range of ${max - min}`,\n\t\t\t});\n\t\t}\n\t});\n\n/** Object form of a service toggle (`{ enabled?: boolean }`). */\nexport const serviceToggleSchema = z.strictObject({\n\tenabled: z.boolean().optional(),\n});\n\n/** A service toggle as written in a policy: `boolean` or `{ enabled?: boolean }`. */\nexport const serviceToggleInputSchema = z.union([\n\tz.boolean(),\n\tserviceToggleSchema,\n]);\n\n/**\n * Reusable Data API runtime settings (camelCase mirror of the Neon API `DataAPISettings`).\n * `strictObject` so a typo / snake_case key fails loudly instead of being silently dropped.\n */\nexport const dataApiSettingsSchema = z.strictObject({\n\tdbAggregatesEnabled: z.boolean().optional(),\n\tdbAnonRole: z.string().optional(),\n\tdbExtraSearchPath: z.string().optional(),\n\tdbMaxRows: z.number().int().optional(),\n\tdbSchemas: z.array(z.string()).optional(),\n\tjwtRoleClaimKey: z.string().optional(),\n\tjwtCacheMaxLifetime: z.number().int().optional(),\n\topenapiMode: z\n\t\t.union([z.literal(\"ignore-privileges\"), z.literal(\"disabled\")])\n\t\t.optional(),\n\tserverCorsAllowedOrigins: z.string().optional(),\n\tserverTimingEnabled: z.boolean().optional(),\n});\n\n/** Names of the external-IdP-only fields, forbidden when `authProvider` is `\"neon\"`. */\nconst DATA_API_EXTERNAL_ONLY_KEYS = [\n\t\"jwksUrl\",\n\t\"providerName\",\n\t\"jwtAudience\",\n] as const;\n\n/**\n * Object form of the `dataApi` toggle. A single `strictObject` plus a `superRefine` (rather\n * than a discriminated union) so the `\"neon\"` default works without the discriminator being\n * present, and so the \"external-only field with authProvider neon\" error points at the exact\n * offending key — mirroring the `?: never` type-level guard at runtime.\n */\nexport const dataApiConfigSchema = z\n\t.strictObject({\n\t\tenabled: z.boolean().optional(),\n\t\tauthProvider: z\n\t\t\t.union([z.literal(\"neon\"), z.literal(\"external\")])\n\t\t\t.optional(),\n\t\tjwksUrl: z.string().optional(),\n\t\tproviderName: z.string().optional(),\n\t\tjwtAudience: z.string().optional(),\n\t\tsettings: dataApiSettingsSchema.optional(),\n\t})\n\t.superRefine((cfg, ctx) => {\n\t\tconst provider = cfg.authProvider ?? \"neon\";\n\t\tif (provider !== \"neon\") return;\n\t\tfor (const key of DATA_API_EXTERNAL_ONLY_KEYS) {\n\t\t\tif (cfg[key] !== undefined) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tpath: [key],\n\t\t\t\t\tmessage: `${key} is only allowed with authProvider: \"external\" — Neon supplies it for authProvider: \"neon\".`,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n\n/** A `dataApi` toggle as written in a policy: `boolean` or {@link dataApiConfigSchema}. */\nexport const dataApiInputSchema = z.union([z.boolean(), dataApiConfigSchema]);\n\nexport const postgresConfigSchema = z.strictObject({\n\tcomputeSettings: computeSettingsSchema.optional(),\n});\n\n/**\n * Branch-unique function slug. Mirrors the Neon Functions API path-segment rule\n * (`platform/internal/platform/functions/name.go`): 1–20 lowercase letters and digits.\n * Used as the **key schema** of the `functions` record, so a bad slug fails\n * validation with a path pointing at the offending key and duplicate slugs are impossible\n * by construction (object keys are unique).\n */\nconst functionSlugSchema = z\n\t.string()\n\t.regex(\n\t\t/^[a-z0-9]{1,20}$/,\n\t\t\"function slug must be 1-20 lowercase letters and digits (no hyphens or other characters)\",\n\t);\n\n/** Bucket name: 1–255 chars. Used as the key schema of the `buckets` record. */\nconst bucketNameSchema = z.string().min(1).max(255);\n\n/**\n * A single function environment-variable value. Must be a defined string: a `process.env.X`\n * that is unset evaluates to `undefined`, and the bare `z.string()` message for that case\n * (`Invalid input: expected string, received undefined`) gives no hint that an env var is the\n * culprit. The custom `error` replaces *only* the `undefined` case with a message that names\n * the offending function + env key (read from the issue path) and how to fix it; any other\n * wrong type keeps zod's default (`expected string, received number`, …).\n */\nconst functionEnvValueSchema = z.string({\n\terror: (issue) => {\n\t\tif (issue.input !== undefined) return undefined;\n\t\tconst path = issue.path ?? [];\n\t\tconst key = path.length > 0 ? String(path[path.length - 1]) : undefined;\n\t\tconst functionsIndex = path.indexOf(\"functions\");\n\t\tconst slug =\n\t\t\tfunctionsIndex >= 0 && functionsIndex + 1 < path.length\n\t\t\t\t? String(path[functionsIndex + 1])\n\t\t\t\t: undefined;\n\t\tconst subject =\n\t\t\tslug !== undefined && key !== undefined\n\t\t\t\t? `Environment variable \"${key}\" for function \"${slug}\"`\n\t\t\t\t: key !== undefined\n\t\t\t\t\t? `Environment variable \"${key}\"`\n\t\t\t\t\t: \"An environment variable\";\n\t\treturn `${subject} is undefined — its value (typically a \\`process.env.*\\`) is unset. Set it (for example \\`neon deploy --env <file>\\`) or omit the key from neon.ts if you do not want to write it. Do not coerce a missing value to an empty string: that uploads and deletes the live key.`;\n\t},\n});\n\n/**\n * Per-function environment map. Every value must be a defined string (see\n * {@link functionEnvValueSchema}): a `process.env.X` that is unset surfaces as `undefined` and\n * is rejected here (rather than silently shipping `undefined` into the deployment).\n */\nconst functionEnvSchema = z.record(z.string(), functionEnvValueSchema);\n\n/**\n * TCP port for a function's local dev server. Excludes 0 (which means \"any port\" to the OS\n * — `neon dev` expresses \"pick one for me\" by omitting `port`, not by passing 0).\n */\nconst devPortSchema = z.number().int().min(1).max(65535);\n\n/**\n * Local-dev settings for a function (`neon dev` only; never affects deploy). `port` is bound\n * exactly when set (and `neon dev` fails if it is taken), or a free port is found when omitted.\n */\nconst functionDevConfigSchema = z.strictObject({\n\tport: devPortSchema.optional(),\n});\n\nconst functionScheduleTriggerSchema = z.strictObject({\n\ttype: z.literal(\"schedule\"),\n\tfunction: functionSlugSchema,\n\tcron: z.string().min(1),\n\tfunctionPath: z.string().min(1).optional(),\n\tenabled: z.boolean().optional(),\n});\n\nconst functionStorageObjectCreatedTriggerSchema = z.strictObject({\n\ttype: z.literal(\"storage_object_created\"),\n\tfunction: functionSlugSchema,\n\tbucket: bucketNameSchema,\n\tprefix: z.string().min(1).max(1024).optional(),\n\tfunctionPath: z.string().min(1).optional(),\n\tenabled: z.boolean().optional(),\n});\n\nconst functionTriggerSchema = z.discriminatedUnion(\"type\", [\n\tfunctionScheduleTriggerSchema,\n\tfunctionStorageObjectCreatedTriggerSchema,\n]);\n\nconst triggerNameSchema = z.string().min(1).max(255);\n\nconst triggersRecordSchema = z.record(triggerNameSchema, functionTriggerSchema);\n\nconst customDomainSchema = z.string().superRefine((value, ctx) => {\n\tconst message = customDomainValidationError(value);\n\tif (message) {\n\t\tctx.addIssue({ code: \"custom\", message });\n\t}\n});\n\nconst customDomainsSchema = z\n\t.array(customDomainSchema)\n\t.superRefine((domains, ctx) => {\n\t\tconst seen = new Set<string>();\n\t\tfor (const [index, domain] of domains.entries()) {\n\t\t\tconst normalized = normalizeCustomDomain(domain);\n\t\t\tif (seen.has(normalized)) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tpath: [index],\n\t\t\t\t\tmessage: `custom domain \"${normalized}\" is listed more than once`,\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseen.add(normalized);\n\t\t}\n\t});\n\n/**\n * The name of a package the bundler must leave alone. Accepts what esbuild's `external`\n * accepts for a package — a bare name, a scope, or a subpath — and rejects a relative or\n * absolute path, which names a local module rather than a dependency and is never the right\n * thing to externalize (the bundle would ship an import of a file that isn't deployed).\n */\nconst externalPackageNameSchema = z\n\t.string()\n\t.min(1)\n\t.refine((value) => !value.startsWith(\".\") && !value.startsWith(\"/\"), {\n\t\terror: 'must be a package name such as \"microsandbox\" or \"@scope/pkg\", not a relative or absolute path',\n\t});\n\n/**\n * An entry whose files are staged has to name one installable package, because the deploy\n * hands its root to `npm install`. esbuild's `external` additionally accepts a `*` wildcard\n * and a bare scope, which name a set rather than a package — legal only when nothing is\n * being installed for them.\n */\nconst stageablePackageName = (value: string): boolean => {\n\t// A protocol (`node:fs`, `npm:pkg`) is a specifier, not something to install.\n\tif (/^[a-z][a-z0-9+.-]*:/i.test(value)) return false;\n\t// An empty segment (`foo//bar`) or a traversal is not a subpath the deploy can act on.\n\tconst segments = value.split(\"/\");\n\tif (segments.some((segment) => segment === \"\" || segment === \"..\")) {\n\t\treturn false;\n\t}\n\treturn isNpmPackageName(externalPackageRoot(value));\n};\n\n/**\n * npm's own rules for a package name, which is what the deploy hands to `npm install`.\n * Deliberately strict: whatever slips through here becomes a subprocess argument.\n */\nconst NPM_NAME_SEGMENT = /^[a-z0-9~][a-z0-9._~-]*$/;\n\nconst isNpmPackageName = (root: string): boolean => {\n\tif (root.length === 0 || root.length > 214) return false;\n\tif (!root.startsWith(\"@\")) return NPM_NAME_SEGMENT.test(root);\n\tconst [scope, name, ...rest] = root.slice(1).split(\"/\");\n\t// A bare scope names every package in it, not one package.\n\tif (rest.length > 0 || name === undefined) return false;\n\treturn NPM_NAME_SEGMENT.test(scope) && NPM_NAME_SEGMENT.test(name);\n};\n\n/**\n * One entry of `externalPackages`. A bare string is the common case and ships the package's\n * files; the object form exists only to turn that off. See {@link FunctionDef.externalPackages}.\n */\nconst externalPackageEntrySchema = z.union([\n\texternalPackageNameSchema,\n\tz.strictObject({\n\t\tname: externalPackageNameSchema,\n\t\tincludeFiles: z.boolean().optional(),\n\t}),\n]);\n\n/**\n * Per-function list of packages esbuild leaves unresolved at deploy time. See\n * {@link FunctionDef.externalPackages}.\n */\nconst functionExternalPackagesSchema = z.array(externalPackageEntrySchema);\n\nconst runtimeSchema = z.literal(\"nodejs24\");\n\nconst bundlerSchema = z.custom<FunctionBundlerInput>(\n\t(value) =>\n\t\tvalue === \"esbuild\" || value === \"none\" || typeof value === \"function\",\n\t{\n\t\tmessage:\n\t\t\t'bundler must be \"esbuild\", \"none\", or a function (fn) => Promise<FunctionBundle>',\n\t},\n);\n\nconst isEsbuildBundler = (\n\tbundler: z.infer<typeof bundlerSchema> | undefined,\n): boolean => bundler === undefined || bundler === \"esbuild\";\n\n/** The declared name of an entry, whichever form it was written in. */\nconst entryName = (\n\tentry: z.infer<typeof externalPackageEntrySchema>,\n): string => (typeof entry === \"string\" ? entry : entry.name);\n\n/** Whether an entry ships its files. Absent means yes — see `FunctionDef.externalPackages`. */\nconst entryIncludesFiles = (\n\tentry: z.infer<typeof externalPackageEntrySchema>,\n): boolean => (typeof entry === \"string\" ? true : entry.includeFiles !== false);\n\n/**\n * Static definition of a function (existence). The slug is the record key (validated by\n * {@link functionSlugSchema}), so it is not a field here. Deploy tuning (`runtime`) lives\n * in the `branch` closure, not here.\n *\n * `externalPackages` entries are checked for contradictions: the same package named twice,\n * or named once bare and once through a subpath with a different `includeFiles`. Both state\n * two intents for one package, and files are staged per package rather than per subpath, so\n * neither can be honoured as written.\n */\nexport const functionDefSchema = z\n\t.strictObject({\n\t\tname: z.string().min(1).max(255),\n\t\tsource: z.string().min(1),\n\t\tenv: functionEnvSchema.optional(),\n\t\texternalPackages: functionExternalPackagesSchema.optional(),\n\t\tbundler: bundlerSchema.optional(),\n\t\tdev: functionDevConfigSchema.optional(),\n\t\tcustomDomains: customDomainsSchema.optional(),\n\t})\n\t.check((ctx) => {\n\t\tconst entries = ctx.value.externalPackages ?? [];\n\n\t\t// Other bundlers own their output, so `externalPackages` would be ignored.\n\t\tif (\n\t\t\tctx.value.externalPackages !== undefined &&\n\t\t\t!isEsbuildBundler(ctx.value.bundler)\n\t\t) {\n\t\t\tctx.issues.push({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tinput: ctx.value.externalPackages,\n\t\t\t\tpath: [\"externalPackages\"],\n\t\t\t\tmessage: `externalPackages only applies to the \"esbuild\" bundler; the \"${\n\t\t\t\t\ttypeof ctx.value.bundler === \"function\"\n\t\t\t\t\t\t? \"custom\"\n\t\t\t\t\t\t: ctx.value.bundler\n\t\t\t\t}\" bundler controls its own output. Remove externalPackages or switch to the esbuild bundler`,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst seenNames = new Map<string, number>();\n\t\tconst rootIntent = new Map<\n\t\t\tstring,\n\t\t\t{ includeFiles: boolean; at: string }\n\t\t>();\n\n\t\tentries.forEach((entry, index) => {\n\t\t\tconst name = entryName(entry);\n\t\t\tconst includeFiles = entryIncludesFiles(entry);\n\n\t\t\tif (includeFiles && !stageablePackageName(name)) {\n\t\t\t\tctx.issues.push({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tinput: entry,\n\t\t\t\t\tpath: [\"externalPackages\", index],\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`\"${name}\" does not name a single installable package, so its files cannot ` +\n\t\t\t\t\t\t`be staged. Name one package, or set includeFiles: false to leave the ` +\n\t\t\t\t\t\t`import unresolved without shipping anything for it`,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst firstIndex = seenNames.get(name);\n\t\t\tif (firstIndex !== undefined) {\n\t\t\t\tctx.issues.push({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tinput: entry,\n\t\t\t\t\tpath: [\"externalPackages\", index],\n\t\t\t\t\tmessage: `\"${name}\" is listed more than once (first at index ${firstIndex})`,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tseenNames.set(name, index);\n\n\t\t\t// Files are installed and traced per package, so two specifiers that resolve to the\n\t\t\t// same package cannot disagree about whether that package's files ship.\n\t\t\tconst root = externalPackageRoot(name);\n\t\t\tconst prior = rootIntent.get(root);\n\t\t\tif (prior !== undefined && prior.includeFiles !== includeFiles) {\n\t\t\t\tctx.issues.push({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tinput: entry,\n\t\t\t\t\tpath: [\"externalPackages\", index],\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`\"${name}\" and \"${prior.at}\" are both part of the \"${root}\" package but disagree ` +\n\t\t\t\t\t\t`about includeFiles; files ship per package, so the whole package either ships or does not`,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trootIntent.set(root, { includeFiles, at: name });\n\t\t});\n\t});\n\n/** Static definition of a bucket (existence). Name is the record key. */\nexport const bucketDefSchema = z.strictObject({\n\taccess: z\n\t\t.union([z.literal(\"private\"), z.literal(\"public_read\")])\n\t\t.optional(),\n});\n\n/**\n * Functions record. Used as both top-level `functions` and `preview.functions`\n * so {@link previewInputSchema} (`schemas.preview`) keeps the same validation\n * when parsed on its own.\n */\nexport const functionsRecordSchema = z.record(\n\tfunctionSlugSchema,\n\tfunctionDefSchema,\n);\n\n/** Static, beta Preview feature set: AI Gateway toggle + functions/buckets records. */\nexport const previewInputSchema = z.strictObject({\n\taiGateway: serviceToggleInputSchema.optional(),\n\tfunctions: functionsRecordSchema.optional(),\n\tbuckets: z.record(bucketNameSchema, bucketDefSchema).optional(),\n});\n\n/** Per-function deploy tuning returned by the `branch` closure. */\nexport const functionTuningSchema = z.strictObject({\n\truntime: runtimeSchema.optional(),\n\tcustomDomains: customDomainsSchema.optional(),\n});\n\n/** Per-branch Preview tuning. Keys must be slugs declared in the static `preview`. */\nconst previewTuningSchema = z.strictObject({\n\tfunctions: z.record(functionSlugSchema, functionTuningSchema).optional(),\n});\n\n/**\n * The object returned by the `branch` closure. Validated on every `resolveConfig` call so\n * tuning errors point at the concrete branch target that triggered them.\n */\nexport const branchTuningSchema = z\n\t.strictObject({\n\t\tparent: z.string().optional(),\n\t\tprotected: z.boolean().optional(),\n\t\tttl: z\n\t\t\t.union([z.string(), z.number()])\n\t\t\t.optional()\n\t\t\t.superRefine((value, ctx) => {\n\t\t\t\tif (value === undefined) return;\n\t\t\t\tconst result = parseBranchTtl(value);\n\t\t\t\tif (\"error\" in result) {\n\t\t\t\t\tctx.addIssue({ code: \"custom\", message: result.error });\n\t\t\t\t}\n\t\t\t}),\n\t\tpostgres: postgresConfigSchema.optional(),\n\t\tfunctions: z\n\t\t\t.record(functionSlugSchema, functionTuningSchema)\n\t\t\t.optional(),\n\t\tpreview: previewTuningSchema.optional(),\n\t})\n\t.superRefine((cfg, ctx) => {\n\t\tvalidateParentReference({\n\t\t\tctx,\n\t\t\tpath: [\"parent\"],\n\t\t\tparent: cfg.parent,\n\t\t});\n\t\trejectDuplicateHome(ctx, {\n\t\t\tgaPresent: cfg.functions !== undefined,\n\t\t\tpreviewPresent: cfg.preview?.functions !== undefined,\n\t\t\tgaPath: \"functions\",\n\t\t\tpreviewPath: \"preview.functions\",\n\t\t});\n\t});\n\n/**\n * The top-level object accepted by `defineConfig`. The `branch` closure is validated\n * structurally as a function here; its returned tuning is validated per-evaluation by\n * {@link branchTuningSchema} inside `resolveConfig`.\n */\nexport const configInputSchema = z\n\t.strictObject({\n\t\tauth: serviceToggleInputSchema.optional(),\n\t\tdataApi: dataApiInputSchema.optional(),\n\t\taiGateway: serviceToggleInputSchema.optional(),\n\t\tfunctions: functionsRecordSchema.optional(),\n\t\tbuckets: z.record(bucketNameSchema, bucketDefSchema).optional(),\n\t\ttriggers: triggersRecordSchema.optional(),\n\t\tpreview: previewInputSchema.optional(),\n\t\tbranch: z\n\t\t\t.custom<(...args: unknown[]) => unknown>(\n\t\t\t\t(value) => typeof value === \"function\",\n\t\t\t\t{\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"branch must be a function: `branch: (branch) => ({ … })`\",\n\t\t\t\t},\n\t\t\t)\n\t\t\t.optional(),\n\t})\n\t.superRefine((cfg, ctx) => {\n\t\trejectDuplicateHome(ctx, {\n\t\t\tgaPresent: cfg.aiGateway !== undefined,\n\t\t\tpreviewPresent: cfg.preview?.aiGateway !== undefined,\n\t\t\tgaPath: \"aiGateway\",\n\t\t\tpreviewPath: \"preview.aiGateway\",\n\t\t});\n\t\trejectDuplicateHome(ctx, {\n\t\t\tgaPresent: cfg.functions !== undefined,\n\t\t\tpreviewPresent: cfg.preview?.functions !== undefined,\n\t\t\tgaPath: \"functions\",\n\t\t\tpreviewPath: \"preview.functions\",\n\t\t});\n\t\trejectDuplicateHome(ctx, {\n\t\t\tgaPresent: cfg.buckets !== undefined,\n\t\t\tpreviewPresent: cfg.preview?.buckets !== undefined,\n\t\t\tgaPath: \"buckets\",\n\t\t\tpreviewPath: \"preview.buckets\",\n\t\t});\n\t\tvalidateAuthoredTriggers(cfg, ctx);\n\t\t// A Data API verified by Neon Auth (`authProvider: \"neon\"`, the default) needs Neon\n\t\t// Auth enabled on the same branch so the tokens it verifies actually exist. Enforce\n\t\t// the same invariant the `defineConfig` type-level check expresses, at runtime.\n\t\tif (!isToggleEnabledValue(cfg.dataApi)) return;\n\t\tif (dataApiAuthProviderValue(cfg.dataApi) !== \"neon\") return;\n\t\tif (!isToggleEnabledValue(cfg.auth)) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"auth\"],\n\t\t\t\tmessage:\n\t\t\t\t\t'dataApi with authProvider \"neon\" requires Neon Auth — set `auth: true` (or `auth: { enabled: true }`), or use `dataApi.authProvider: \"external\"` with your own `jwksUrl`.',\n\t\t\t});\n\t\t}\n\t});\n\nfunction validateAuthoredTriggers(\n\tcfg: {\n\t\tfunctions?: Record<string, unknown>;\n\t\tbuckets?: Record<string, unknown>;\n\t\tpreview?: {\n\t\t\tfunctions?: Record<string, unknown>;\n\t\t\tbuckets?: Record<string, unknown>;\n\t\t};\n\t\ttriggers?: Record<string, z.infer<typeof functionTriggerSchema>>;\n\t},\n\tctx: z.RefinementCtx,\n): void {\n\tif (cfg.triggers === undefined) return;\n\tconst functions = new Set(\n\t\tObject.keys(cfg.functions ?? cfg.preview?.functions ?? {}),\n\t);\n\tconst buckets = new Set(\n\t\tObject.keys(cfg.buckets ?? cfg.preview?.buckets ?? {}),\n\t);\n\tfor (const [name, trigger] of Object.entries(cfg.triggers)) {\n\t\tif (!functions.has(trigger.function)) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"triggers\", name, \"function\"],\n\t\t\t\tmessage: `trigger \"${name}\" references function \"${trigger.function}\", which is not declared in functions (or preview.functions)`,\n\t\t\t});\n\t\t}\n\t\tif (\n\t\t\ttrigger.type === \"storage_object_created\" &&\n\t\t\t!buckets.has(trigger.bucket)\n\t\t) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"triggers\", name, \"bucket\"],\n\t\t\t\tmessage: `trigger \"${name}\" references bucket \"${trigger.bucket}\", which is not declared in buckets (or preview.buckets)`,\n\t\t\t});\n\t\t}\n\t}\n}\n\nfunction rejectDuplicateHome(\n\tctx: z.RefinementCtx,\n\targs: {\n\t\tgaPresent: boolean;\n\t\tpreviewPresent: boolean;\n\t\tgaPath: string;\n\t\tpreviewPath: string;\n\t},\n): void {\n\tif (!args.gaPresent || !args.previewPresent) return;\n\tctx.addIssue({\n\t\tcode: \"custom\",\n\t\tpath: args.gaPath.split(\".\"),\n\t\tmessage: `${args.gaPath} is also declared as ${args.previewPath}. Keep ${args.gaPath} and remove ${args.previewPath}.`,\n\t});\n}\n\n/**\n * Whether a parsed `auth` / `dataApi` toggle value is enabled: a present object (or `true`)\n * is on unless `enabled` is explicitly `false`. Mirrors `isServiceEnabled` in\n * `define-config.ts`, operating on the already-validated runtime value.\n */\nfunction isToggleEnabledValue(value: unknown): boolean {\n\tif (value === undefined || value === null) return false;\n\tif (typeof value === \"boolean\") return value;\n\tif (typeof value === \"object\") {\n\t\treturn (value as { enabled?: unknown }).enabled !== false;\n\t}\n\treturn false;\n}\n\n/** Read the (defaulted) `authProvider` from a parsed `dataApi` value. */\nfunction dataApiAuthProviderValue(value: unknown): \"neon\" | \"external\" {\n\tif (value !== null && typeof value === \"object\") {\n\t\tconst provider = (value as { authProvider?: unknown }).authProvider;\n\t\tif (provider === \"external\") return \"external\";\n\t}\n\treturn \"neon\";\n}\n\nfunction validateParentReference(args: {\n\tctx: z.RefinementCtx;\n\tpath: (string | number)[];\n\tparent: string | undefined;\n}): void {\n\tconst { ctx, path, parent } = args;\n\tif (parent === undefined) return;\n\n\tconst patternCheck = validatePattern(parent);\n\tif (\"error\" in patternCheck) {\n\t\tctx.addIssue({ code: \"custom\", path, message: patternCheck.error });\n\t} else if (isWildcardPattern(parent)) {\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath,\n\t\t\tmessage: `parent must be a concrete branch name (no wildcards), got \"${parent}\"`,\n\t\t});\n\t}\n}\n\n/**\n * Convert the structured {@link z.ZodError} produced by `configSchema.safeParse` into the\n * `string[]` shape used by {@link import(\"./errors.js\").ConfigValidationError}.\n *\n * Issue paths are rendered as dot-separated property accesses (`postgres.computeSettings`)\n * and unknown-key issues from `strictObject` are normalised so the message contains the\n * substring \"unknown key\" — keeping pre-zod assertions in test suites and downstream tools\n * stable.\n */\nexport function formatZodIssues(error: z.ZodError): string[] {\n\treturn error.issues.map((issue) => {\n\t\tconst path = renderPath(issue.path);\n\t\tconst message = normaliseIssueMessage(issue);\n\t\treturn path ? `${path}: ${message}` : message;\n\t});\n}\n\nfunction renderPath(path: ReadonlyArray<PropertyKey>): string {\n\tlet out = \"\";\n\tfor (const segment of path) {\n\t\tif (typeof segment === \"number\") out += `[${segment}]`;\n\t\telse if (out === \"\") out += String(segment);\n\t\telse out += `.${String(segment)}`;\n\t}\n\treturn out;\n}\n\nfunction normaliseIssueMessage(issue: z.core.$ZodIssue): string {\n\tif (issue.code === \"unrecognized_keys\") {\n\t\tconst keys = issue.keys ?? [];\n\t\tconst formatted = keys.map((k) => JSON.stringify(k)).join(\", \");\n\t\treturn `unknown key${keys.length === 1 ? \"\" : \"s\"}: ${formatted}`;\n\t}\n\tif (issue.code === \"invalid_key\") {\n\t\t// A record *key* that fails its key schema (e.g. a bad function slug) surfaces in\n\t\t// zod as a single `invalid_key` issue whose own `message` is the generic, useless\n\t\t// \"Invalid key in record\". The actual reason — the function-slug regex rule, say —\n\t\t// lives in the nested key-schema `issues`. Hoist those so the user sees *why* the\n\t\t// key was rejected (the offending key itself is already in the issue `path`).\n\t\tconst reasons = issue.issues\n\t\t\t.map((nested) => nested.message)\n\t\t\t.filter((message) => message.length > 0);\n\t\tif (reasons.length > 0) return reasons.join(\"; \");\n\t}\n\treturn issue.message;\n}\n"],"mappings":";;;;;;;;AAWA,MAAM,qBAAqB;;AAE3B,MAAM,2BAA2B;AAEjC,MAAM,oBAAoB,EAAE,QAAQ,eAAe,EAClD,QAAQ,UACP,iGAAiG,KAAK,UAAU,MAAM,KAAK,EAAE,GAC/H,CAAC;;;;;;;;;;;;;;;AAgBD,MAAa,wBAAwB,EACnC,aAAa;CACb,uBAAuB,kBAAkB,SAAS;CAClD,uBAAuB,kBAAkB,SAAS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