@awsless/cli 0.0.1

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.
Files changed (50) hide show
  1. package/README.MD +487 -0
  2. package/dist/app.json +1 -0
  3. package/dist/app.stage.json +1 -0
  4. package/dist/bin.d.ts +1 -0
  5. package/dist/bin.js +49025 -0
  6. package/dist/build-json-schema.js +1925 -0
  7. package/dist/chunk-2TBBLACH.js +37 -0
  8. package/dist/chunk-3YEPERYO.js +1021 -0
  9. package/dist/chunk-4JFIJMQ6.js +46 -0
  10. package/dist/chunk-5TWBDDXS.js +60 -0
  11. package/dist/chunk-7NRPMOO4.js +876 -0
  12. package/dist/chunk-7XIGSOF4.js +100 -0
  13. package/dist/chunk-DSXFE5X2.js +174 -0
  14. package/dist/chunk-E7FQOYML.js +12 -0
  15. package/dist/chunk-GH475CSF.js +5005 -0
  16. package/dist/chunk-JHYKYQ5P.js +163 -0
  17. package/dist/chunk-LBISIOIM.js +28 -0
  18. package/dist/chunk-RCNT4C4P.js +50 -0
  19. package/dist/chunk-SIAA4J6H.js +21 -0
  20. package/dist/chunk-XNYTWFP6.js +241 -0
  21. package/dist/chunk-Z37AK4IA.js +546 -0
  22. package/dist/chunk-ZKH7AMP3.js +42 -0
  23. package/dist/dist-es-GXHCNXAC.js +489 -0
  24. package/dist/dist-es-J7SL4PXO.js +88 -0
  25. package/dist/dist-es-LL3VAI2X.js +70 -0
  26. package/dist/dist-es-QND3CYLI.js +380 -0
  27. package/dist/dist-es-STVZUSZG.js +21 -0
  28. package/dist/dist-es-TCFHB4OF.js +324 -0
  29. package/dist/dist-es-YFQTZTNE.js +167 -0
  30. package/dist/event-streams-74K5M656.js +244 -0
  31. package/dist/layers/sharp-arm.zip +0 -0
  32. package/dist/loadSso-O7PM54HL.js +592 -0
  33. package/dist/prebuild/icon/HASH +1 -0
  34. package/dist/prebuild/icon/bundle.zip +0 -0
  35. package/dist/prebuild/image/HASH +1 -0
  36. package/dist/prebuild/image/bundle.zip +0 -0
  37. package/dist/prebuild/on-error-log/HASH +1 -0
  38. package/dist/prebuild/on-error-log/bundle.zip +0 -0
  39. package/dist/prebuild/on-failure/HASH +1 -0
  40. package/dist/prebuild/on-failure/bundle.zip +0 -0
  41. package/dist/prebuild/rpc/HASH +1 -0
  42. package/dist/prebuild/rpc/bundle.zip +0 -0
  43. package/dist/prebuild.js +159 -0
  44. package/dist/signin-6SPMGGJN.js +704 -0
  45. package/dist/sso-oidc-5IIWGKXY.js +829 -0
  46. package/dist/stack.json +1 -0
  47. package/dist/stack.stage.json +1 -0
  48. package/dist/sts-6SQWH4BL.js +3788 -0
  49. package/dist/test-global-setup.js +22 -0
  50. package/package.json +120 -0
@@ -0,0 +1,1925 @@
1
+ // cli/build-json-schema.ts
2
+ import { writeFileSync } from "fs";
3
+ import { join as join2 } from "path";
4
+ import { zodToJsonSchema } from "zod-to-json-schema";
5
+
6
+ // src/config/app.ts
7
+ import { z as z25 } from "zod";
8
+
9
+ // src/feature/alert/schema.ts
10
+ import { kebabCase } from "change-case";
11
+ import { z as z2 } from "zod";
12
+
13
+ // src/config/schema/email.ts
14
+ import { z } from "zod";
15
+ var EmailSchema = z.string().email();
16
+
17
+ // src/feature/alert/schema.ts
18
+ var AlertNameSchema = z2.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid alert name").transform((value) => kebabCase(value)).describe("Define alert name.");
19
+ var AlertsDefaultSchema = z2.record(
20
+ AlertNameSchema,
21
+ z2.union([
22
+ //
23
+ EmailSchema.transform((v) => [v]),
24
+ EmailSchema.array()
25
+ ])
26
+ ).optional().describe("Define the alerts in your app. Alerts are a way to send messages to one or more email addresses.");
27
+
28
+ // src/feature/auth/schema.ts
29
+ import { z as z5 } from "zod";
30
+
31
+ // src/config/schema/resource-id.ts
32
+ import { kebabCase as kebabCase2 } from "change-case";
33
+ import { z as z3 } from "zod";
34
+ var ResourceIdSchema = z3.string().min(3).max(24).regex(/^[a-z0-9\-]+$/i, "Invalid resource ID").transform((value) => kebabCase2(value));
35
+
36
+ // src/config/schema/duration.ts
37
+ import { parse } from "@awsless/duration";
38
+ import { z as z4 } from "zod";
39
+ var DurationSchema = z4.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?|weeks?)$/, "Invalid duration").transform((v) => parse(v));
40
+ var durationMin = (min) => {
41
+ return (duration) => {
42
+ return duration.value >= min.value;
43
+ };
44
+ };
45
+ var durationMax = (max) => {
46
+ return (duration) => {
47
+ return duration.value <= max.value;
48
+ };
49
+ };
50
+
51
+ // src/feature/auth/schema.ts
52
+ var AuthDefaultSchema = z5.record(
53
+ ResourceIdSchema,
54
+ z5.object({
55
+ allowUserRegistration: z5.boolean().default(true).describe("Specifies whether users can create an user account or if only the administrator can."),
56
+ // messaging: z
57
+ // .object({
58
+ // fromEmail: EmailSchema.describe("Specifies the sender's email address."),
59
+ // fromName: z.string().optional().describe("Specifies the sender's name."),
60
+ // replyTo: EmailSchema.optional().describe(
61
+ // 'The destination to which the receiver of the email should reply.'
62
+ // ),
63
+ // })
64
+ // .optional()
65
+ // .describe('The email configuration for sending messages.'),
66
+ // secret: z.boolean().default(false).describe('Specifies whether you want to generate a client secret.'),
67
+ groups: z5.string().array().default([]).describe("Specifies a list of groups that a user can belong to."),
68
+ username: z5.object({
69
+ // emailAlias: z.boolean().default(true).describe('Allow the user email to be used as username.'),
70
+ caseSensitive: z5.boolean().default(false).describe(
71
+ "Specifies whether username case sensitivity will be enabled. When usernames and email addresses are case insensitive, users can sign in as the same user when they enter a different capitalization of their user name."
72
+ )
73
+ }).default({}).describe("The username policy."),
74
+ password: z5.object({
75
+ minLength: z5.number().int().min(6).max(99).default(12).describe("Required users to have at least the minimum password length."),
76
+ uppercase: z5.boolean().default(true).describe("Required users to use at least one uppercase letter in their password."),
77
+ lowercase: z5.boolean().default(true).describe("Required users to use at least one lowercase letter in their password."),
78
+ numbers: z5.boolean().default(true).describe("Required users to use at least one number in their password."),
79
+ symbols: z5.boolean().default(true).describe("Required users to use at least one symbol in their password."),
80
+ temporaryPasswordValidity: DurationSchema.default("7 days").describe(
81
+ "The duration a temporary password is valid. If the user doesn't sign in during this time, an administrator must reset their password."
82
+ )
83
+ }).default({}).describe("The password policy."),
84
+ validity: z5.object({
85
+ idToken: DurationSchema.default("1 hour").describe(
86
+ "The ID token time limit. After this limit expires, your user can't use their ID token."
87
+ ),
88
+ accessToken: DurationSchema.default("1 hour").describe(
89
+ "The access token time limit. After this limit expires, your user can't use their access token."
90
+ ),
91
+ refreshToken: DurationSchema.default("365 days").describe(
92
+ "The refresh token time limit. After this limit expires, your user can't use their refresh token."
93
+ )
94
+ }).default({}).describe("Specifies the validity duration for every JWT token.")
95
+ // triggers: TriggersSchema.optional(),
96
+ })
97
+ ).default({}).describe("Define the authenticatable users in your app.");
98
+
99
+ // src/feature/domain/schema.ts
100
+ import { z as z6 } from "zod";
101
+ var DomainNameSchema = z6.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
102
+ "Enter a fully qualified domain name, for example, www.example.com. You can optionally include a trailing dot. If you omit the trailing dot, Amazon Route 53 assumes that the domain name that you specify is fully qualified. This means that Route 53 treats www.example.com (without a trailing dot) and www.example.com. (with a trailing dot) as identical."
103
+ );
104
+ var DNSTypeSchema = z6.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
105
+ var TTLSchema = DurationSchema.describe("The resource record cache time to live (TTL).");
106
+ var RecordsSchema = z6.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
107
+ var DomainsDefaultSchema = z6.record(
108
+ ResourceIdSchema,
109
+ z6.object({
110
+ domain: DomainNameSchema.describe("Define the domain name"),
111
+ dns: z6.object({
112
+ name: DomainNameSchema.optional(),
113
+ type: DNSTypeSchema,
114
+ ttl: TTLSchema,
115
+ records: RecordsSchema
116
+ }).array().optional().describe("Define the domain dns records")
117
+ })
118
+ ).optional().describe("Define the domains for your application.");
119
+
120
+ // src/feature/function/schema.ts
121
+ import { days, minutes, seconds, toDays } from "@awsless/duration";
122
+ import { gibibytes, mebibytes } from "@awsless/size";
123
+ import { z as z11 } from "zod";
124
+
125
+ // src/config/schema/local-directory.ts
126
+ import { stat } from "fs/promises";
127
+ import { z as z8 } from "zod";
128
+
129
+ // src/config/schema/relative-path.ts
130
+ import { join } from "path";
131
+ import { z as z7 } from "zod";
132
+ var basePath;
133
+ var resolvePath = (path) => {
134
+ if (path.startsWith(".") && basePath) {
135
+ return join(basePath, path);
136
+ }
137
+ return path;
138
+ };
139
+ var RelativePathSchema = z7.string().transform((path) => resolvePath(path));
140
+
141
+ // src/config/schema/local-directory.ts
142
+ var LocalDirectorySchema = z8.union([
143
+ RelativePathSchema.refine(async (path) => {
144
+ try {
145
+ const s = await stat(path);
146
+ return s.isDirectory();
147
+ } catch (error) {
148
+ return false;
149
+ }
150
+ }, `Directory doesn't exist`),
151
+ z8.object({
152
+ nocheck: RelativePathSchema.describe(
153
+ "Specifies a local directory without checking if the directory exists."
154
+ )
155
+ }).transform((v) => v.nocheck)
156
+ ]);
157
+
158
+ // src/config/schema/local-file.ts
159
+ import { stat as stat2 } from "fs/promises";
160
+ import { z as z9 } from "zod";
161
+ var LocalFileSchema = z9.union([
162
+ RelativePathSchema.refine(async (path) => {
163
+ try {
164
+ const s = await stat2(path);
165
+ return s.isFile();
166
+ } catch (error) {
167
+ return false;
168
+ }
169
+ }, `File doesn't exist`),
170
+ z9.object({
171
+ nocheck: RelativePathSchema.describe("Specifies a local file without checking if the file exists.")
172
+ }).transform((v) => v.nocheck)
173
+ ]);
174
+
175
+ // src/config/schema/size.ts
176
+ import { parse as parse2 } from "@awsless/size";
177
+ import { z as z10 } from "zod";
178
+ var SizeSchema = z10.string().regex(/^[0-9]+ (B|KB|MB|GB|TB|PB)$/, "Invalid size").transform((v) => parse2(v));
179
+ var sizeMin = (min) => {
180
+ return (size) => {
181
+ return size.value >= min.value;
182
+ };
183
+ };
184
+ var sizeMax = (max) => {
185
+ return (size) => {
186
+ return size.value <= max.value;
187
+ };
188
+ };
189
+
190
+ // src/feature/function/schema.ts
191
+ var MemorySizeSchema = SizeSchema.refine(sizeMin(mebibytes(128)), "Minimum memory size is 128 MB").refine(sizeMax(gibibytes(10)), "Maximum memory size is 10 GB").describe(
192
+ "The amount of memory available to the function at runtime. Increasing the function memory also increases its CPU allocation. The value can be any multiple of 1 MB. You can specify a size value from 128 MB to 10 GB."
193
+ );
194
+ var TimeoutSchema = DurationSchema.refine(durationMin(seconds(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(minutes(15)), "Maximum timeout duration is 15 minutes").describe(
195
+ "The amount of time that Lambda allows a function to run before stopping it. You can specify a size value from 1 second to 15 minutes."
196
+ );
197
+ var EphemeralStorageSizeSchema = SizeSchema.refine(
198
+ sizeMin(mebibytes(512)),
199
+ "Minimum ephemeral storage size is 512 MB"
200
+ ).refine(sizeMax(gibibytes(10)), "Minimum ephemeral storage size is 10 GB").describe("The size of the function's /tmp directory. You can specify a size value from 512 MB to 10 GB.");
201
+ var ReservedConcurrentExecutionsSchema = z11.number().int().min(0).describe("The number of simultaneous executions to reserve for the function. You can specify a number from 0.");
202
+ var EnvironmentSchema = z11.record(z11.string(), z11.string()).optional().describe("Environment variable key-value pairs.");
203
+ var ArchitectureSchema = z11.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
204
+ var NodeRuntimeSchema = z11.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x", "nodejs24.x"]);
205
+ var ContainerRuntimeSchema = z11.literal("container");
206
+ var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).or(z11.string()).describe("The identifier of the function's runtime.");
207
+ var ActionSchema = z11.string();
208
+ var ActionsSchema = z11.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
209
+ var ArnSchema = z11.string().startsWith("arn:");
210
+ var WildcardSchema = z11.literal("*");
211
+ var ResourceSchema = z11.union([ArnSchema, WildcardSchema]);
212
+ var ResourcesSchema = z11.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
213
+ var PermissionSchema = z11.object({
214
+ effect: z11.enum(["allow", "deny"]).default("allow"),
215
+ actions: ActionsSchema,
216
+ resources: ResourcesSchema
217
+ });
218
+ var PermissionsSchema = z11.union([PermissionSchema.transform((v) => [v]), PermissionSchema.array()]).describe("Add IAM permissions to your function.");
219
+ var WarmSchema = z11.number().int().min(0).max(10).describe("Specify how many functions you want to warm up each 5 minutes. You can specify a number from 0 to 10.");
220
+ var VPCSchema = z11.boolean().describe("Put the function inside your global VPC.");
221
+ var MinifySchema = z11.boolean().describe("Minify the function code.");
222
+ var HandlerSchema = z11.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
223
+ var DescriptionSchema = z11.string().describe("A description of the function.");
224
+ var validLogRetentionDays = [
225
+ ...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
226
+ ...[180, 365, 400, 545, 731, 1096, 1827, 2192],
227
+ ...[2557, 2922, 3288, 3653]
228
+ ];
229
+ var LogRetentionSchema = DurationSchema.refine(
230
+ durationMin(days(0)),
231
+ "Minimum log retention is 0 day, which will disable logging."
232
+ ).refine(
233
+ (duration) => {
234
+ return validLogRetentionDays.includes(toDays(duration));
235
+ },
236
+ `Invalid log retention. Valid days are: ${validLogRetentionDays.map((days5) => `${days5}`).join(", ")}`
237
+ ).describe("The log retention duration.");
238
+ var LogSchema = z11.union([
239
+ z11.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
240
+ LogRetentionSchema.transform((retention) => ({ retention })),
241
+ z11.object({
242
+ // subscription: LogSubscriptionSchema.optional(),
243
+ retention: LogRetentionSchema.optional(),
244
+ format: z11.enum(["text", "json"]).describe(
245
+ `The format in which Lambda sends your function's application and system logs to CloudWatch. Select between plain text and structured JSON.`
246
+ ).optional(),
247
+ system: z11.enum(["debug", "info", "warn"]).describe(
248
+ "Set this property to filter the system logs for your function that Lambda sends to CloudWatch. Lambda only sends system logs at the selected level of detail and lower, where DEBUG is the highest level and WARN is the lowest."
249
+ ).optional(),
250
+ level: z11.enum(["trace", "debug", "info", "warn", "error", "fatal"]).describe(
251
+ "Set this property to filter the application logs for your function that Lambda sends to CloudWatch. Lambda only sends application logs at the selected level of detail and lower, where TRACE is the highest level and FATAL is the lowest."
252
+ ).optional()
253
+ })
254
+ ]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
255
+ var LayersSchema = z11.string().array().describe(
256
+ // `A list of function layers to add to the function's execution environment..`
257
+ `A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.`
258
+ );
259
+ var FileCodeSchema = z11.object({
260
+ file: LocalFileSchema.describe("The file path of the function code."),
261
+ minify: MinifySchema.optional().default(true),
262
+ external: z11.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`),
263
+ importAsString: z11.string().array().optional().describe(`A list of glob patterns, which specifies the files that should be imported as string.`)
264
+ });
265
+ var BundleCodeSchema = z11.object({
266
+ bundle: LocalDirectorySchema.describe("The directory that needs to be bundled.")
267
+ // dir: z.string(),
268
+ // build: z.string(),
269
+ // run: z.string(),
270
+ // cacheKey:
271
+ });
272
+ var CodeSchema = z11.union([
273
+ LocalFileSchema.transform((file) => ({
274
+ file
275
+ })).pipe(FileCodeSchema),
276
+ FileCodeSchema,
277
+ BundleCodeSchema
278
+ ]).describe("Specify the code of your function.");
279
+ var FnSchema = z11.object({
280
+ code: CodeSchema,
281
+ // node
282
+ handler: HandlerSchema.optional(),
283
+ // build: BuildSchema.optional(),
284
+ // bundle: BundleSchema.optional(),
285
+ // container
286
+ // ...
287
+ runtime: RuntimeSchema.optional(),
288
+ description: DescriptionSchema.optional(),
289
+ warm: WarmSchema.optional(),
290
+ vpc: VPCSchema.optional(),
291
+ log: LogSchema.optional(),
292
+ timeout: TimeoutSchema.optional(),
293
+ memorySize: MemorySizeSchema.optional(),
294
+ architecture: ArchitectureSchema.optional(),
295
+ ephemeralStorageSize: EphemeralStorageSizeSchema.optional(),
296
+ // retryAttempts: RetryAttemptsSchema.optional(),
297
+ reserved: ReservedConcurrentExecutionsSchema.optional(),
298
+ layers: LayersSchema.optional(),
299
+ environment: EnvironmentSchema.optional(),
300
+ permissions: PermissionsSchema.optional()
301
+ });
302
+ var FunctionSchema = z11.union([
303
+ LocalFileSchema.transform((code) => ({
304
+ code
305
+ })).pipe(FnSchema),
306
+ FnSchema
307
+ ]);
308
+ var FunctionsSchema = z11.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
309
+ var FunctionDefaultSchema = z11.object({
310
+ runtime: RuntimeSchema.default("nodejs24.x"),
311
+ // node
312
+ handler: HandlerSchema.default("index.default"),
313
+ // build: BuildSchema.default({
314
+ // type: 'simple',
315
+ // minify: true,
316
+ // }),
317
+ // container
318
+ warm: WarmSchema.default(0),
319
+ vpc: VPCSchema.default(false),
320
+ log: LogSchema.default(true).transform((log) => ({
321
+ retention: log.retention ?? days(7),
322
+ level: "level" in log ? log.level : "error",
323
+ system: "system" in log ? log.system : "warn",
324
+ format: "format" in log ? log.format : "json"
325
+ })),
326
+ timeout: TimeoutSchema.default("10 seconds"),
327
+ memorySize: MemorySizeSchema.default("128 MB"),
328
+ architecture: ArchitectureSchema.default("arm64"),
329
+ ephemeralStorageSize: EphemeralStorageSizeSchema.default("512 MB"),
330
+ // retryAttempts: RetryAttemptsSchema.default(2),
331
+ reserved: ReservedConcurrentExecutionsSchema.optional(),
332
+ layers: LayersSchema.optional(),
333
+ environment: EnvironmentSchema.optional(),
334
+ permissions: PermissionsSchema.optional()
335
+ }).default({});
336
+
337
+ // src/feature/layer/schema.ts
338
+ import { z as z13 } from "zod";
339
+
340
+ // src/config/schema/lambda.ts
341
+ import { z as z12 } from "zod";
342
+ var ArchitectureSchema2 = z12.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
343
+ var NodeRuntimeSchema2 = z12.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]).describe("The identifier of the function's runtime.");
344
+
345
+ // src/feature/layer/schema.ts
346
+ var Schema = z13.object({
347
+ file: LocalFileSchema,
348
+ runtimes: NodeRuntimeSchema2.array().optional(),
349
+ architecture: ArchitectureSchema2.optional(),
350
+ packages: z13.string().array().optional().describe(
351
+ "Define the package names that are available bundled in the layer. Those packages are not bundled while bundling the lambda."
352
+ )
353
+ });
354
+ var LayerSchema = z13.record(
355
+ z13.string(),
356
+ z13.union([
357
+ LocalFileSchema.transform((file) => ({
358
+ file,
359
+ description: void 0
360
+ })),
361
+ Schema
362
+ ])
363
+ ).optional().describe("Define the lambda layers in your stack.");
364
+
365
+ // src/feature/task/schema.ts
366
+ import { z as z14 } from "zod";
367
+ var RetryAttemptsSchema = z14.number().int().min(0).max(2).describe(
368
+ "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
369
+ );
370
+ var TaskSchema = z14.union([
371
+ FunctionSchema.transform((consumer) => ({
372
+ consumer,
373
+ retryAttempts: 2
374
+ })),
375
+ z14.object({
376
+ consumer: FunctionSchema,
377
+ retryAttempts: RetryAttemptsSchema.default(2)
378
+ })
379
+ ]);
380
+ var TasksSchema = z14.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
381
+
382
+ // src/feature/on-error-log/schema.ts
383
+ var OnErrorLogDefaultSchema = TaskSchema.optional().describe(
384
+ "Define a subscription on all Lambda functions logs."
385
+ );
386
+
387
+ // src/feature/on-failure/schema.ts
388
+ import { z as z15 } from "zod";
389
+ var NotifySchema = z15.union([
390
+ //
391
+ EmailSchema.transform((v) => [v]),
392
+ EmailSchema.array()
393
+ ]).describe("Receive an email notification when consuming failure entries goes wrong.");
394
+ var OnFailureDefaultSchema = z15.union([
395
+ FunctionSchema.transform((consumer) => ({
396
+ consumer,
397
+ notify: []
398
+ })),
399
+ z15.object({
400
+ consumer: FunctionSchema,
401
+ notify: NotifySchema.optional()
402
+ })
403
+ ]).optional().describe(
404
+ [
405
+ "Defining a onFailure handler will add a global onFailure handler for the following resources:",
406
+ "- Tasks",
407
+ "- Crons",
408
+ "- Queues",
409
+ "- Topics",
410
+ "- Pubsub",
411
+ "- Table streams"
412
+ ].join("\n")
413
+ );
414
+
415
+ // src/feature/pubsub/schema.ts
416
+ import { z as z16 } from "zod";
417
+ var DomainSchema = ResourceIdSchema.describe("The domain id to link your Pubsub API with.");
418
+ var PubSubDefaultSchema = z16.record(
419
+ ResourceIdSchema,
420
+ z16.object({
421
+ auth: FunctionSchema,
422
+ domain: DomainSchema.optional(),
423
+ subDomain: z16.string().optional()
424
+ // auth: z.union([
425
+ // ResourceIdSchema,
426
+ // z.object({
427
+ // authorizer: FunctionSchema,
428
+ // // ttl: AuthorizerTtl.default('1 hour'),
429
+ // }),
430
+ // ]),
431
+ // policy: z
432
+ // .object({
433
+ // publish: z.array(z.string()).optional(),
434
+ // subscribe: z.array(z.string()).optional(),
435
+ // })
436
+ // .optional(),
437
+ })
438
+ ).optional().describe("Define the pubsub subscriber in your stack.");
439
+ var RetryAttemptsSchema2 = z16.number().int().min(0).max(2).describe(
440
+ "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
441
+ );
442
+ var PubSubSchema = z16.record(
443
+ ResourceIdSchema,
444
+ z16.object({
445
+ sql: z16.string().describe("The SQL statement used to query the IOT topic."),
446
+ sqlVersion: z16.enum(["2015-10-08", "2016-03-23", "beta"]).default("2016-03-23").describe("The version of the SQL rules engine to use when evaluating the rule."),
447
+ consumer: FunctionSchema.describe("The consuming lambda function properties."),
448
+ retryAttempts: RetryAttemptsSchema2.default(2)
449
+ })
450
+ ).optional().describe("Define the pubsub subscriber in your stack.");
451
+
452
+ // src/feature/queue/schema.ts
453
+ import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
454
+ import { kibibytes } from "@awsless/size";
455
+ import { z as z17 } from "zod";
456
+ var RetentionPeriodSchema = DurationSchema.refine(
457
+ durationMin(minutes2(1)),
458
+ "Minimum retention period is 1 minute"
459
+ ).refine(durationMax(days2(14)), "Maximum retention period is 14 days").describe(
460
+ "The number of seconds that Amazon SQS retains a message. You can specify a duration from 1 minute to 14 days."
461
+ );
462
+ var VisibilityTimeoutSchema = DurationSchema.refine(
463
+ durationMax(hours(12)),
464
+ "Maximum visibility timeout is 12 hours"
465
+ ).describe(
466
+ "The length of time during which a message will be unavailable after a message is delivered from the queue. This blocks other components from receiving the same message and gives the initial component time to process and delete the message from the queue. You can specify a duration from 0 to 12 hours."
467
+ );
468
+ var DeliveryDelaySchema = DurationSchema.refine(
469
+ durationMax(minutes2(15)),
470
+ "Maximum delivery delay is 15 minutes"
471
+ ).describe(
472
+ "The time in seconds for which the delivery of all messages in the queue is delayed. You can specify a duration from 0 to 15 minutes."
473
+ );
474
+ var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
475
+ durationMin(seconds2(1)),
476
+ "Minimum receive message wait time is 1 second"
477
+ ).refine(durationMax(seconds2(20)), "Maximum receive message wait time is 20 seconds").describe(
478
+ "Specifies the duration, that the ReceiveMessage action call waits until a message is in the queue in order to include it in the response, rather than returning an empty response if a message isn't yet available. You can specify a duration from 1 to 20 seconds. Short polling is used as the default."
479
+ );
480
+ var MaxMessageSizeSchema = SizeSchema.refine(sizeMin(kibibytes(1)), "Minimum max message size is 1 KB").refine(sizeMax(kibibytes(256)), "Maximum max message size is 256 KB").describe(
481
+ "The limit of how many bytes that a message can contain before Amazon SQS rejects it. You can specify an size from 1 KB to 256 KB."
482
+ );
483
+ var BatchSizeSchema = z17.number().int().min(1, "Minimum batch size is 1").max(1e4, "Maximum batch size is 10000").describe(
484
+ "The maximum number of records in each batch that Lambda pulls from your queue and sends to your function. Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB). You can specify an integer from 1 to 10000."
485
+ );
486
+ var MaxConcurrencySchema = z17.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000").describe(
487
+ "Limits the number of concurrent instances that the queue worker can invoke. You can specify an integer from 2 to 1000."
488
+ );
489
+ var MaxBatchingWindow = DurationSchema.refine(
490
+ durationMax(minutes2(5)),
491
+ "Maximum max batching window is 5 minutes"
492
+ ).describe(
493
+ "The maximum amount of time, that Lambda spends gathering records before invoking the function. You can specify an duration from 0 seconds to 5 minutes."
494
+ );
495
+ var RetryAttemptsSchema3 = z17.number().int().min(0).max(999).describe(
496
+ "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 999."
497
+ );
498
+ var QueueDefaultSchema = z17.object({
499
+ retentionPeriod: RetentionPeriodSchema.default("7 days"),
500
+ visibilityTimeout: VisibilityTimeoutSchema.default("30 seconds"),
501
+ deliveryDelay: DeliveryDelaySchema.default("0 seconds"),
502
+ receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
503
+ maxMessageSize: MaxMessageSizeSchema.default("256 KB"),
504
+ batchSize: BatchSizeSchema.default(10),
505
+ maxConcurrency: MaxConcurrencySchema.optional(),
506
+ maxBatchingWindow: MaxBatchingWindow.optional(),
507
+ retryAttempts: RetryAttemptsSchema3.default(2)
508
+ }).default({});
509
+ var QueueSchema = z17.object({
510
+ consumer: FunctionSchema.optional().describe("The consuming lambda function properties."),
511
+ retentionPeriod: RetentionPeriodSchema.optional(),
512
+ visibilityTimeout: VisibilityTimeoutSchema.optional(),
513
+ deliveryDelay: DeliveryDelaySchema.optional(),
514
+ receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
515
+ maxMessageSize: MaxMessageSizeSchema.optional(),
516
+ batchSize: BatchSizeSchema.optional(),
517
+ maxConcurrency: MaxConcurrencySchema.optional(),
518
+ maxBatchingWindow: MaxBatchingWindow.optional(),
519
+ retryAttempts: RetryAttemptsSchema3.optional()
520
+ });
521
+ var QueuesSchema = z17.record(
522
+ ResourceIdSchema,
523
+ z17.union([
524
+ LocalFileSchema.transform((consumer) => ({
525
+ consumer
526
+ })).pipe(QueueSchema),
527
+ QueueSchema
528
+ ])
529
+ ).optional().describe("Define the queues in your stack.");
530
+
531
+ // src/feature/rest/schema.ts
532
+ import { z as z19 } from "zod";
533
+
534
+ // src/config/schema/route.ts
535
+ import { z as z18 } from "zod";
536
+ var RouteSchema = z18.union([
537
+ z18.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS|ANY)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
538
+ z18.literal("$default")
539
+ ]);
540
+
541
+ // src/feature/rest/schema.ts
542
+ var RestDefaultSchema = z19.record(
543
+ ResourceIdSchema,
544
+ z19.object({
545
+ domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
546
+ subDomain: z19.string().optional()
547
+ })
548
+ ).optional().describe("Define your global REST API's.");
549
+ var RestSchema = z19.record(
550
+ ResourceIdSchema,
551
+ z19.record(
552
+ RouteSchema.describe(
553
+ [
554
+ "The REST API route that is comprised by the http method and http path.",
555
+ "The possible http methods are POST, GET,PUT, DELETE, HEAD, OPTIONS, ANY.",
556
+ "Example: GET /posts/{id}"
557
+ ].join("\n")
558
+ ),
559
+ FunctionSchema
560
+ )
561
+ ).optional().describe("Define routes in your stack for your global REST API.");
562
+
563
+ // src/feature/rpc/schema.ts
564
+ import { minutes as minutes4, seconds as seconds3 } from "@awsless/duration";
565
+ import { z as z21 } from "zod";
566
+
567
+ // src/feature/router/schema.ts
568
+ import { days as days3, minutes as minutes3, parse as parse3 } from "@awsless/duration";
569
+ import { z as z20 } from "zod";
570
+ var ErrorResponsePathSchema = z20.string().describe(
571
+ [
572
+ "The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.",
573
+ "- We recommend that you store custom error pages in an Amazon S3 bucket.",
574
+ "If you store custom error pages on an HTTP server and the server starts to return 5xx errors, CloudFront can't get the files that you want to return to viewers because the origin server is unavailable."
575
+ ].join("\n")
576
+ );
577
+ var StatusCodeSchema = z20.number().int().positive().optional().describe(
578
+ [
579
+ "The HTTP status code that you want CloudFront to return to the viewer along with the custom error page.",
580
+ "There are a variety of reasons that you might want CloudFront to return a status code different from the status code that your origin returned to CloudFront, for example:",
581
+ "- Some Internet devices (some firewalls and corporate proxies, for example) intercept HTTP 4xx and 5xx and prevent the response from being returned to the viewer.",
582
+ "If you substitute 200, the response typically won't be intercepted.",
583
+ `- If you don't care about distinguishing among different client errors or server errors, you can specify 400 or 500 as the ResponseCode for all 4xx or 5xx errors.`,
584
+ `- You might want to return a 200 status code (OK) and static website so your customers don't know that your website is down.`
585
+ ].join("\n")
586
+ );
587
+ var MinTTLSchema = DurationSchema.describe(
588
+ "The minimum amount of time, that you want to cache the error response. When this time period has elapsed, CloudFront queries your origin to see whether the problem that caused the error has been resolved and the requested object is now available."
589
+ );
590
+ var ErrorResponseSchema = z20.union([
591
+ ErrorResponsePathSchema,
592
+ z20.object({
593
+ path: ErrorResponsePathSchema,
594
+ statusCode: StatusCodeSchema.optional(),
595
+ minTTL: MinTTLSchema.optional()
596
+ })
597
+ ]).optional();
598
+ var RouteSchema2 = z20.string().regex(/^\//, "Route must start with a slash (/)");
599
+ var VisibilitySchema = z20.boolean().default(false).describe("Whether to enable CloudWatch metrics for the WAF rule.");
600
+ var WafSettingsSchema = z20.object({
601
+ rateLimiter: z20.object({
602
+ limit: z20.number().min(10).max(2e9).default(10).describe(
603
+ "The limit on requests during the specified evaluation window for a single aggregation instance for the rate-based rule."
604
+ ),
605
+ window: z20.union([
606
+ z20.literal("1 minute"),
607
+ z20.literal("2 minutes"),
608
+ z20.literal("5 minutes"),
609
+ z20.literal("10 minutes")
610
+ ]).default("5 minutes").transform((v) => parse3(v)).describe(
611
+ "The amount of time, in seconds, that AWS WAF should include in its request counts, looking back from the current time."
612
+ ),
613
+ visibility: VisibilitySchema
614
+ }).optional().describe(
615
+ "A rate-based rule counts incoming requests and rate limits requests when they are coming at too fast a rate."
616
+ ),
617
+ ddosProtection: z20.object({
618
+ sensitivity: z20.object({
619
+ challenge: z20.enum(["low", "medium", "high"]).default("low").transform((v) => v.toUpperCase()).describe("The sensitivity level for challenge requests."),
620
+ block: z20.enum(["low", "medium", "high"]).default("low").transform((v) => v.toUpperCase()).describe("The sensitivity level for block requests.")
621
+ }),
622
+ exemptUriRegex: z20.string().default("^$"),
623
+ visibility: VisibilitySchema
624
+ }).optional().describe(
625
+ "Provides protection against DDoS attacks targeting the application layer, also known as Layer 7 attacks. Uses 50 WCU."
626
+ ),
627
+ botProtection: z20.object({
628
+ inspectionLevel: z20.enum(["common", "targeted"]).default("common").transform((v) => v.toUpperCase()),
629
+ visibility: VisibilitySchema
630
+ }).optional().describe(
631
+ "Provides protection against automated bots that can consume excess resources, skew business metrics, cause downtime, or perform malicious activities. Bot Control provides additional visibility through Amazon CloudWatch and generates labels that you can use to control bot traffic to your applications. Uses 50 WCU."
632
+ ),
633
+ captchaImmunityTime: DurationSchema.refine(durationMin(minutes3(1)), "Minimum timeout duration is 1 minute").refine(durationMax(days3(3)), "Maximum timeout duration is 3 days").default("5 minutes").describe(
634
+ "The amount of time that a CAPTCHA timestamp is considered valid by AWS WAF. The default setting is 5 minutes."
635
+ ),
636
+ challengeImmunityTime: DurationSchema.refine(durationMin(minutes3(1)), "Minimum timeout duration is 1 minute").refine(durationMax(days3(3)), "Maximum timeout duration is 3 days").default("5 minutes").describe(
637
+ "The amount of time that a challenge timestamp is considered valid by AWS WAF. The default setting is 5 minutes."
638
+ )
639
+ }).describe(
640
+ "WAF settings for the router. Each rule consumes Web ACL capacity units (WCUs). The total WCUs for a web ACL can't exceed 5000. Using over 1500 WCUs affects your costs."
641
+ );
642
+ var RouterDefaultSchema = z20.record(
643
+ ResourceIdSchema,
644
+ z20.object({
645
+ domain: ResourceIdSchema.describe("The domain id to link your Router.").optional(),
646
+ subDomain: z20.string().optional(),
647
+ waf: WafSettingsSchema.optional(),
648
+ geoRestrictions: z20.array(z20.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked."),
649
+ errors: z20.object({
650
+ 400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
651
+ 403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
652
+ 404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
653
+ 405: ErrorResponseSchema.describe("Customize a `405 Method Not Allowed` response."),
654
+ 414: ErrorResponseSchema.describe("Customize a `414 Request-URI` response."),
655
+ 416: ErrorResponseSchema.describe("Customize a `416 Range Not` response."),
656
+ 500: ErrorResponseSchema.describe("Customize a `500 Internal Server` response."),
657
+ 501: ErrorResponseSchema.describe("Customize a `501 Not Implemented` response."),
658
+ 502: ErrorResponseSchema.describe("Customize a `502 Bad Gateway` response."),
659
+ 503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
660
+ 504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
661
+ }).optional().describe("Customize the error responses for specific HTTP status codes."),
662
+ cors: z20.object({
663
+ override: z20.boolean().default(false),
664
+ maxAge: DurationSchema.default("365 days"),
665
+ exposeHeaders: z20.string().array().optional(),
666
+ credentials: z20.boolean().default(false),
667
+ headers: z20.string().array().default(["*"]),
668
+ origins: z20.string().array().default(["*"]),
669
+ methods: z20.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
670
+ }).optional().describe("Specify the cors headers."),
671
+ passwordAuth: z20.object({
672
+ password: z20.string().describe("Password.")
673
+ }).optional().describe("Enable password authentication for the router."),
674
+ basicAuth: z20.object({
675
+ username: z20.string().describe("Basic auth username."),
676
+ password: z20.string().describe("Basic auth password.")
677
+ }).optional().describe("Enable basic authentication for the router."),
678
+ // security: z
679
+ // .object({
680
+ // contentSecurityPolicy: z.object({
681
+ // override: z.boolean().default(false),
682
+ // policy: z.string(),
683
+ // })
684
+ // contentSecurityPolicy?: {
685
+ // override?: boolean
686
+ // contentSecurityPolicy: string
687
+ // }
688
+ // contentTypeOptions?: {
689
+ // override?: boolean
690
+ // }
691
+ // frameOptions?: {
692
+ // override?: boolean
693
+ // frameOption?: 'deny' | 'same-origin'
694
+ // }
695
+ // referrerPolicy?: {
696
+ // override?: boolean
697
+ // referrerPolicy?: (
698
+ // 'no-referrer' |
699
+ // 'no-referrer-when-downgrade' |
700
+ // 'origin' |
701
+ // 'origin-when-cross-origin' |
702
+ // 'same-origin' |
703
+ // 'strict-origin' |
704
+ // 'strict-origin-when-cross-origin' |
705
+ // 'unsafe-url'
706
+ // )
707
+ // }
708
+ // strictTransportSecurity?: {
709
+ // maxAge?: Duration
710
+ // includeSubdomains?: boolean
711
+ // override?: boolean
712
+ // preload?: boolean
713
+ // }
714
+ // xssProtection?: {
715
+ // override?: boolean
716
+ // enable?: boolean
717
+ // modeBlock?: boolean
718
+ // reportUri?: string
719
+ // }
720
+ // })
721
+ // .optional()
722
+ // .describe('Specify the security policy.'),
723
+ cache: z20.object({
724
+ cookies: z20.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
725
+ headers: z20.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
726
+ queries: z20.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
727
+ }).optional().describe(
728
+ "Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
729
+ )
730
+ })
731
+ ).optional().describe(`Define the global Router. Backed by AWS CloudFront.`);
732
+
733
+ // src/feature/rpc/schema.ts
734
+ var TimeoutSchema2 = DurationSchema.refine(durationMin(seconds3(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(minutes4(5)), "Maximum timeout duration is 5 minutes").describe(
735
+ [
736
+ "The amount of time that the RPC lambda is allowed run before stopping it.",
737
+ "You can specify a timeout from 10 second to 5 minutes.",
738
+ "The timeouts of all inner RPC functions will be capped at 80% of this timeout."
739
+ ].join(" ")
740
+ );
741
+ var RpcDefaultSchema = z21.record(
742
+ ResourceIdSchema,
743
+ z21.object({
744
+ // domain: ResourceIdSchema.describe('The domain id to link your RPC API with.').optional(),
745
+ // subDomain: z.string().optional(),
746
+ //
747
+ router: ResourceIdSchema.describe("The router id to link your RPC API with."),
748
+ path: RouteSchema2.describe("The path inside the router to link your RPC API to."),
749
+ auth: FunctionSchema.optional().describe("The authentication handler for your RPC API."),
750
+ log: LogSchema.optional(),
751
+ timeout: TimeoutSchema2.default("1 minutes")
752
+ })
753
+ ).describe(`Define the global RPC API's.`).optional();
754
+ var RpcSchema = z21.record(
755
+ ResourceIdSchema,
756
+ z21.record(
757
+ z21.string(),
758
+ z21.union([
759
+ FunctionSchema.transform((f) => ({
760
+ function: f,
761
+ lock: false
762
+ })),
763
+ z21.object({
764
+ function: FunctionSchema.describe("The RPC function to execute."),
765
+ lock: z21.boolean().describe(
766
+ [
767
+ "Specify if the function should be locked on the `lockKey` returned from the auth function.",
768
+ "An example would be returning the user ID as `lockKey`."
769
+ ].join("\n")
770
+ )
771
+ })
772
+ ])
773
+ ).describe("The queries for your global RPC API.")
774
+ ).describe("Define the schema in your stack for your global RPC API.").optional();
775
+
776
+ // src/feature/instance/schema.ts
777
+ import { days as days4, toDays as toDays2 } from "@awsless/duration";
778
+ import { toMebibytes } from "@awsless/size";
779
+ import { z as z22 } from "zod";
780
+ var CpuSchema = z22.union([z22.literal(0.25), z22.literal(0.5), z22.literal(1), z22.literal(2), z22.literal(4), z22.literal(8), z22.literal(16)]).transform((v) => `${v} vCPU`).describe(
781
+ "The number of virtual CPU units (vCPU) used by the instance. Valid values: 0.25, 0.5, 1, 2, 4, 8, 16 vCPU."
782
+ );
783
+ var validMemorySize = [
784
+ // 0.25 vCPU
785
+ 512,
786
+ 1024,
787
+ 2048,
788
+ // 0.5 vCPU
789
+ 1024,
790
+ 2048,
791
+ 3072,
792
+ 4096,
793
+ // 1 vCPU
794
+ 2048,
795
+ 3072,
796
+ 4096,
797
+ 5120,
798
+ 6144,
799
+ 7168,
800
+ 8192,
801
+ // 2 vCPU
802
+ 4096,
803
+ 5120,
804
+ 6144,
805
+ 7168,
806
+ 8192,
807
+ 9216,
808
+ 10240,
809
+ 11264,
810
+ 12288,
811
+ 13312,
812
+ 14336,
813
+ 15360,
814
+ 16384
815
+ ];
816
+ var MemorySizeSchema2 = SizeSchema.refine(
817
+ (s) => validMemorySize.includes(toMebibytes(s)),
818
+ `Invalid memory size. Allowed sizes: ${validMemorySize.join(", ")} MiB`
819
+ ).describe("The amount of memory (in MiB) used by the instance. Valid memory values depend on the CPU configuration.");
820
+ var HealthCheckSchema = z22.object({
821
+ path: z22.string().describe("The path that the container runs to determine if it is healthy."),
822
+ interval: DurationSchema.describe("The time period in seconds between each health check execution."),
823
+ retries: z22.number().int().min(1).max(10).describe(
824
+ "The number of times to retry a failed health check before the container is considered unhealthy."
825
+ ),
826
+ startPeriod: DurationSchema.describe(
827
+ "The optional grace period to provide containers time to bootstrap before failed health checks count towards the maximum number of retries."
828
+ ),
829
+ timeout: DurationSchema.describe(
830
+ "The time period in seconds to wait for a health check to succeed before it is considered a failure."
831
+ )
832
+ }).describe("The health check command and associated configuration parameters for the container.");
833
+ var EnvironmentSchema2 = z22.record(z22.string(), z22.string()).optional().describe("Environment variable key-value pairs.");
834
+ var ArchitectureSchema3 = z22.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the instance supports.");
835
+ var ActionSchema2 = z22.string();
836
+ var ActionsSchema2 = z22.union([ActionSchema2.transform((v) => [v]), ActionSchema2.array()]);
837
+ var ArnSchema2 = z22.string().startsWith("arn:");
838
+ var WildcardSchema2 = z22.literal("*");
839
+ var ResourceSchema2 = z22.union([ArnSchema2, WildcardSchema2]);
840
+ var ResourcesSchema2 = z22.union([ResourceSchema2.transform((v) => [v]), ResourceSchema2.array()]);
841
+ var PermissionSchema2 = z22.object({
842
+ effect: z22.enum(["allow", "deny"]).default("allow"),
843
+ actions: ActionsSchema2,
844
+ resources: ResourcesSchema2
845
+ });
846
+ var PermissionsSchema2 = z22.union([PermissionSchema2.transform((v) => [v]), PermissionSchema2.array()]).describe("Add IAM permissions to your instance.");
847
+ var DescriptionSchema2 = z22.string().describe("A description of the instance.");
848
+ var ImageSchema = z22.string().optional().describe("The URL of the container image to use.");
849
+ var validLogRetentionDays2 = [
850
+ ...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
851
+ ...[180, 365, 400, 545, 731, 1096, 1827, 2192],
852
+ ...[2557, 2922, 3288, 3653]
853
+ ];
854
+ var LogRetentionSchema2 = DurationSchema.refine(
855
+ durationMin(days4(0)),
856
+ "Minimum log retention is 0 day, which will disable logging."
857
+ ).refine(
858
+ (duration) => {
859
+ return validLogRetentionDays2.includes(toDays2(duration));
860
+ },
861
+ `Invalid log retention. Valid days are: ${validLogRetentionDays2.map((days5) => `${days5}`).join(", ")}`
862
+ ).describe("The log retention duration.");
863
+ var LogSchema2 = z22.union([
864
+ z22.boolean().transform((enabled) => ({ retention: enabled ? days4(7) : days4(0) })),
865
+ LogRetentionSchema2.transform((retention) => ({ retention })),
866
+ z22.object({
867
+ retention: LogRetentionSchema2.optional()
868
+ })
869
+ ]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
870
+ var FileCodeSchema2 = z22.object({
871
+ file: LocalFileSchema.describe("The file path of the instance code.")
872
+ });
873
+ var CodeSchema2 = z22.union([
874
+ LocalFileSchema.transform((file) => ({
875
+ file
876
+ })).pipe(FileCodeSchema2),
877
+ FileCodeSchema2
878
+ ]).describe("Specify the code of your instance.");
879
+ var ISchema = z22.object({
880
+ code: CodeSchema2,
881
+ description: DescriptionSchema2.optional(),
882
+ image: ImageSchema.optional(),
883
+ log: LogSchema2.optional(),
884
+ cpu: CpuSchema.optional(),
885
+ memorySize: MemorySizeSchema2.optional(),
886
+ architecture: ArchitectureSchema3.optional(),
887
+ environment: EnvironmentSchema2.optional(),
888
+ permissions: PermissionsSchema2.optional(),
889
+ healthCheck: HealthCheckSchema.optional()
890
+ // restartPolicy: RestartPolicySchema.optional(),
891
+ });
892
+ var InstanceSchema = z22.union([
893
+ LocalFileSchema.transform((code) => ({
894
+ code
895
+ })).pipe(ISchema),
896
+ ISchema
897
+ ]);
898
+ var InstancesSchema = z22.record(ResourceIdSchema, InstanceSchema).optional().describe("Define the instances in your stack.");
899
+ var InstanceDefaultSchema = z22.object({
900
+ image: ImageSchema.optional(),
901
+ cpu: CpuSchema.default(0.25),
902
+ memorySize: MemorySizeSchema2.default("512 MB"),
903
+ architecture: ArchitectureSchema3.default("arm64"),
904
+ environment: EnvironmentSchema2.optional(),
905
+ permissions: PermissionsSchema2.optional(),
906
+ healthCheck: HealthCheckSchema.optional(),
907
+ // restartPolicy: RestartPolicySchema.default({ enabled: true }),
908
+ log: LogSchema2.default(true).transform((log) => ({
909
+ retention: log.retention ?? days4(7)
910
+ }))
911
+ }).default({});
912
+
913
+ // src/feature/topic/schema.ts
914
+ import { kebabCase as kebabCase3 } from "change-case";
915
+ import { z as z23 } from "zod";
916
+ var TopicNameSchema = z23.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
917
+ var TopicsDefaultSchema = z23.array(TopicNameSchema).refine((topics) => {
918
+ return topics.length === new Set(topics).size;
919
+ }, "Must be a list of unique topic names").optional().describe("Define the event topics for your app.");
920
+ var SubscribersSchema = z23.record(TopicNameSchema, TaskSchema).optional().describe("Define the event topics to subscribe too in your stack.");
921
+
922
+ // src/config/schema/region.ts
923
+ import { z as z24 } from "zod";
924
+ var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
925
+ var AF = ["af-south-1"];
926
+ var AP = [
927
+ "ap-east-1",
928
+ "ap-south-2",
929
+ "ap-southeast-3",
930
+ "ap-southeast-4",
931
+ "ap-south-1",
932
+ "ap-northeast-3",
933
+ "ap-northeast-2",
934
+ "ap-southeast-1",
935
+ "ap-southeast-2",
936
+ "ap-northeast-1"
937
+ ];
938
+ var CA = ["ca-central-1"];
939
+ var EU = [
940
+ "eu-central-1",
941
+ "eu-west-1",
942
+ "eu-west-2",
943
+ "eu-south-1",
944
+ "eu-west-3",
945
+ "eu-south-2",
946
+ "eu-north-1",
947
+ "eu-central-2"
948
+ ];
949
+ var ME = ["me-south-1", "me-central-1"];
950
+ var SA = ["sa-east-1"];
951
+ var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
952
+ var RegionSchema = z24.enum(regions);
953
+
954
+ // src/config/app.ts
955
+ var AppSchema = z25.object({
956
+ $schema: z25.string().optional(),
957
+ name: ResourceIdSchema.describe("App name."),
958
+ region: RegionSchema.describe("The AWS region to deploy to."),
959
+ profile: z25.string().describe("The AWS profile to deploy to."),
960
+ protect: z25.boolean().default(false).describe("Protect your app & stacks from being deleted."),
961
+ removal: z25.enum(["remove", "retain"]).default("remove").describe(
962
+ [
963
+ "Configure how your resources are handled when they have to be removed.",
964
+ "",
965
+ "remove: Removes all underlying resources.",
966
+ "retain: Retains the following resources: stores, tables, auth, searchs, and caches."
967
+ ].join("\n")
968
+ ),
969
+ // stage: z
970
+ // .string()
971
+ // .regex(/^[a-z]+$/)
972
+ // .default('prod')
973
+ // .describe('The deployment stage.'),
974
+ // onFailure: OnFailureSchema,
975
+ defaults: z25.object({
976
+ onFailure: OnFailureDefaultSchema,
977
+ onErrorLog: OnErrorLogDefaultSchema,
978
+ auth: AuthDefaultSchema,
979
+ domains: DomainsDefaultSchema,
980
+ function: FunctionDefaultSchema,
981
+ instance: InstanceDefaultSchema,
982
+ queue: QueueDefaultSchema,
983
+ // graphql: GraphQLDefaultSchema,
984
+ // http: HttpDefaultSchema,
985
+ rest: RestDefaultSchema,
986
+ rpc: RpcDefaultSchema,
987
+ pubsub: PubSubDefaultSchema,
988
+ // table: TableDefaultSchema,
989
+ // store: StoreDefaultSchema,
990
+ alerts: AlertsDefaultSchema,
991
+ topics: TopicsDefaultSchema,
992
+ layers: LayerSchema,
993
+ router: RouterDefaultSchema
994
+ // dataRetention: z.boolean().describe('Configure how your resources are handled on delete.').default(false),
995
+ }).default({}).describe("Default properties")
996
+ });
997
+
998
+ // src/config/stack.ts
999
+ import { z as z40 } from "zod";
1000
+
1001
+ // src/feature/cache/schema.ts
1002
+ import { gibibytes as gibibytes2 } from "@awsless/size";
1003
+ import { z as z26 } from "zod";
1004
+ var StorageSchema = SizeSchema.refine(sizeMin(gibibytes2(1)), "Minimum storage size is 1 GB").refine(
1005
+ sizeMax(gibibytes2(5e3)),
1006
+ "Maximum storage size is 5000 GB"
1007
+ );
1008
+ var MinimumStorageSchema = StorageSchema.describe(
1009
+ "The lower limit for data storage the cache is set to use. You can specify a size value from 1 GB to 5000 GB."
1010
+ );
1011
+ var MaximumStorageSchema = StorageSchema.describe(
1012
+ "The upper limit for data storage the cache is set to use. You can specify a size value from 1 GB to 5000 GB."
1013
+ );
1014
+ var EcpuSchema = z26.number().int().min(1e3).max(15e6);
1015
+ var MinimumEcpuSchema = EcpuSchema.describe(
1016
+ "The minimum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
1017
+ );
1018
+ var MaximumEcpuSchema = EcpuSchema.describe(
1019
+ "The maximum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
1020
+ );
1021
+ var CachesSchema = z26.record(
1022
+ ResourceIdSchema,
1023
+ z26.object({
1024
+ minStorage: MinimumStorageSchema.optional(),
1025
+ maxStorage: MaximumStorageSchema.optional(),
1026
+ minECPU: MinimumEcpuSchema.optional(),
1027
+ maxECPU: MaximumEcpuSchema.optional(),
1028
+ snapshotRetentionLimit: z26.number().int().positive().default(1)
1029
+ })
1030
+ ).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
1031
+
1032
+ // src/feature/command/schema.ts
1033
+ import { z as z27 } from "zod";
1034
+ var CommandSchema = z27.union([
1035
+ z27.object({
1036
+ file: LocalFileSchema,
1037
+ handler: z27.string().default("default").describe("The name of the handler that needs to run"),
1038
+ description: z27.string().optional().describe("A description of the command")
1039
+ // options: z.record(ResourceIdSchema, OptionSchema).optional(),
1040
+ // arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
1041
+ }),
1042
+ LocalFileSchema.transform((file) => ({
1043
+ file,
1044
+ handler: "default",
1045
+ description: void 0
1046
+ }))
1047
+ ]);
1048
+ var CommandsSchema = z27.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
1049
+
1050
+ // src/feature/config/schema.ts
1051
+ import { z as z28 } from "zod";
1052
+ var ConfigNameSchema = z28.string().regex(/[a-z0-9\-]/g, "Invalid config name");
1053
+ var ConfigsSchema = z28.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
1054
+
1055
+ // src/feature/cron/schema/index.ts
1056
+ import { z as z30 } from "zod";
1057
+
1058
+ // src/feature/cron/schema/schedule.ts
1059
+ import { z as z29 } from "zod";
1060
+ import { awsCronExpressionValidator } from "aws-cron-expression-validator";
1061
+ var RateExpressionSchema = z29.custom(
1062
+ (value) => {
1063
+ return z29.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
1064
+ const [str] = rate.split(" ");
1065
+ const number = parseInt(str);
1066
+ return number > 0;
1067
+ }).safeParse(value).success;
1068
+ },
1069
+ { message: "Invalid rate expression" }
1070
+ ).transform((rate) => {
1071
+ const [str] = rate.split(" ");
1072
+ const number = parseInt(str);
1073
+ const more = rate.endsWith("s");
1074
+ if (more && number === 1) {
1075
+ return `rate(${rate.substring(0, rate.length - 1)})`;
1076
+ }
1077
+ return `rate(${rate})`;
1078
+ });
1079
+ var CronExpressionSchema = z29.custom(
1080
+ (value) => {
1081
+ return z29.string().safeParse(value).success;
1082
+ },
1083
+ { message: "Invalid cron expression" }
1084
+ ).superRefine((value, ctx) => {
1085
+ try {
1086
+ awsCronExpressionValidator(value);
1087
+ } catch (error) {
1088
+ if (error instanceof Error) {
1089
+ ctx.addIssue({
1090
+ code: z29.ZodIssueCode.custom,
1091
+ message: `Invalid cron expression: ${error.message}`
1092
+ });
1093
+ } else {
1094
+ ctx.addIssue({
1095
+ code: z29.ZodIssueCode.custom,
1096
+ message: "Invalid cron expression"
1097
+ });
1098
+ }
1099
+ }
1100
+ }).transform((value) => {
1101
+ return `cron(${value.trim()})`;
1102
+ });
1103
+ var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
1104
+
1105
+ // src/feature/cron/schema/index.ts
1106
+ var RetryAttemptsSchema4 = z30.number().int().min(0).max(2).describe(
1107
+ "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
1108
+ );
1109
+ var CronsSchema = z30.record(
1110
+ ResourceIdSchema,
1111
+ z30.object({
1112
+ enabled: z30.boolean().default(true).describe("If the cron is enabled."),
1113
+ consumer: FunctionSchema.describe("The consuming lambda function properties."),
1114
+ schedule: ScheduleExpressionSchema.describe(
1115
+ 'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
1116
+ ),
1117
+ payload: z30.unknown().optional().describe("The JSON payload that will be passed to the consumer."),
1118
+ retryAttempts: RetryAttemptsSchema4.default(2)
1119
+ })
1120
+ ).optional().describe(`Define the cron jobs in your stack.`);
1121
+
1122
+ // src/feature/search/schema.ts
1123
+ import { gibibytes as gibibytes3 } from "@awsless/size";
1124
+ import { z as z31 } from "zod";
1125
+ var VersionSchema = z31.union([
1126
+ //
1127
+ z31.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]),
1128
+ z31.string()
1129
+ ]).describe("Specify the OpenSearch engine version.");
1130
+ var TypeSchema = z31.union([
1131
+ z31.enum([
1132
+ "t3.small",
1133
+ "t3.medium",
1134
+ "m3.medium",
1135
+ "m3.large",
1136
+ "m3.xlarge",
1137
+ "m3.2xlarge",
1138
+ "m4.large",
1139
+ "m4.xlarge",
1140
+ "m4.2xlarge",
1141
+ "m4.4xlarge",
1142
+ "m4.10xlarge",
1143
+ "m5.large",
1144
+ "m5.xlarge",
1145
+ "m5.2xlarge",
1146
+ "m5.4xlarge",
1147
+ "m5.12xlarge",
1148
+ "m5.24xlarge",
1149
+ "r5.large",
1150
+ "r5.xlarge",
1151
+ "r5.2xlarge",
1152
+ "r5.4xlarge",
1153
+ "r5.12xlarge",
1154
+ "r5.24xlarge",
1155
+ "c5.large",
1156
+ "c5.xlarge",
1157
+ "c5.2xlarge",
1158
+ "c5.4xlarge",
1159
+ "c5.9xlarge",
1160
+ "c5.18xlarge",
1161
+ "or1.medium",
1162
+ "or1.large",
1163
+ "or1.xlarge",
1164
+ "or1.2xlarge",
1165
+ "or1.4xlarge",
1166
+ "or1.8xlarge",
1167
+ "or1.12xlarge",
1168
+ "or1.16xlarge",
1169
+ "ultrawarm1.medium",
1170
+ "ultrawarm1.large",
1171
+ "ultrawarm1.xlarge",
1172
+ "r3.large",
1173
+ "r3.xlarge",
1174
+ "r3.2xlarge",
1175
+ "r3.4xlarge",
1176
+ "r3.8xlarge",
1177
+ "i2.xlarge",
1178
+ "i2.2xlarge",
1179
+ "i3.large",
1180
+ "i3.xlarge",
1181
+ "i3.2xlarge",
1182
+ "i3.4xlarge",
1183
+ "i3.8xlarge",
1184
+ "i3.16xlarge",
1185
+ "r6g.large",
1186
+ "r6g.xlarge",
1187
+ "r6g.2xlarge",
1188
+ "r6g.4xlarge",
1189
+ "r6g.8xlarge",
1190
+ "r6g.12xlarge",
1191
+ "m6g.large",
1192
+ "m6g.xlarge",
1193
+ "m6g.2xlarge",
1194
+ "m6g.4xlarge",
1195
+ "m6g.8xlarge",
1196
+ "m6g.12xlarge",
1197
+ "r6gd.large",
1198
+ "r6gd.xlarge",
1199
+ "r6gd.2xlarge",
1200
+ "r6gd.4xlarge",
1201
+ "r6gd.8xlarge",
1202
+ "r6gd.12xlarge",
1203
+ "r6gd.16xlarge"
1204
+ ]),
1205
+ z31.string()
1206
+ ]).describe("Instance type of data nodes in the cluster.");
1207
+ var CountSchema = z31.number().int().min(1).describe("Number of instances in the cluster.");
1208
+ var StorageSizeSchema = SizeSchema.refine(sizeMin(gibibytes3(10)), "Minimum storage size is 10 GB").refine(sizeMax(gibibytes3(100)), "Maximum storage size is 100 GB").describe("The size of the function's /tmp directory. You can specify a size value from 512 MB to 10 GiB.");
1209
+ var SearchsSchema = z31.record(
1210
+ ResourceIdSchema,
1211
+ z31.object({
1212
+ type: TypeSchema.default("t3.small"),
1213
+ count: CountSchema.default(1),
1214
+ version: VersionSchema.default("2.13"),
1215
+ storage: StorageSizeSchema.default("10 GB")
1216
+ // vpc: z.boolean().default(false),
1217
+ // migration: FunctionSchema.optional(),
1218
+ })
1219
+ ).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
1220
+
1221
+ // src/feature/site/schema.ts
1222
+ import { z as z33 } from "zod";
1223
+
1224
+ // src/config/schema/local-entry.ts
1225
+ import { stat as stat3 } from "fs/promises";
1226
+ import { z as z32 } from "zod";
1227
+ var LocalEntrySchema = z32.union([
1228
+ RelativePathSchema.refine(async (path) => {
1229
+ try {
1230
+ const s = await stat3(path);
1231
+ return s.isFile() || s.isDirectory();
1232
+ } catch (error) {
1233
+ return false;
1234
+ }
1235
+ }, `File or directory doesn't exist`),
1236
+ z32.object({
1237
+ nocheck: RelativePathSchema.describe(
1238
+ "Specifies a local file or directory without checking if the file or directory exists."
1239
+ )
1240
+ }).transform((v) => v.nocheck)
1241
+ ]);
1242
+
1243
+ // src/feature/site/schema.ts
1244
+ var SitesSchema = z33.record(
1245
+ ResourceIdSchema,
1246
+ z33.object({
1247
+ router: ResourceIdSchema.describe("The router id to link your site with."),
1248
+ path: RouteSchema2.describe("The path inside the router to link your site to."),
1249
+ build: z33.object({
1250
+ command: z33.string().describe(
1251
+ `Specifies the files and directories to generate the cache key for your custom build command.`
1252
+ ),
1253
+ cacheKey: z33.union([LocalEntrySchema.transform((v) => [v]), LocalEntrySchema.array()]).describe(
1254
+ `Specifies the files and directories to generate the cache key for your custom build command.`
1255
+ ),
1256
+ configs: z33.string().array().optional().describe("Define the config values for your build command.")
1257
+ }).optional().describe(`Specifies the build process for sites that need a build step.`),
1258
+ static: z33.union([LocalDirectorySchema, z33.boolean()]).optional().describe(
1259
+ "Specifies the path to the static files directory. Additionally you can also pass `true` when you don't have local static files, but still want to make an S3 bucket."
1260
+ ),
1261
+ ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server.")
1262
+ })
1263
+ ).optional().describe("Define the sites in your stack.");
1264
+
1265
+ // src/feature/store/schema.ts
1266
+ import { z as z34 } from "zod";
1267
+ var StoresSchema = z34.union([
1268
+ z34.array(ResourceIdSchema).transform((list) => {
1269
+ const stores = {};
1270
+ for (const key of list) {
1271
+ stores[key] = {};
1272
+ }
1273
+ return stores;
1274
+ }),
1275
+ z34.record(
1276
+ ResourceIdSchema,
1277
+ z34.object({
1278
+ static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
1279
+ versioning: z34.boolean().default(false).describe("Enable versioning of your store."),
1280
+ events: z34.object({
1281
+ // create
1282
+ "created:*": TaskSchema.optional().describe(
1283
+ "Subscribe to notifications regardless of the API that was used to create an object."
1284
+ ),
1285
+ "created:put": TaskSchema.optional().describe(
1286
+ "Subscribe to notifications when an object is created using the PUT API operation."
1287
+ ),
1288
+ "created:post": TaskSchema.optional().describe(
1289
+ "Subscribe to notifications when an object is created using the POST API operation."
1290
+ ),
1291
+ "created:copy": TaskSchema.optional().describe(
1292
+ "Subscribe to notifications when an object is created using the COPY API operation."
1293
+ ),
1294
+ "created:upload": TaskSchema.optional().describe(
1295
+ "Subscribe to notifications when an object multipart upload has been completed."
1296
+ ),
1297
+ // remove
1298
+ "removed:*": TaskSchema.optional().describe(
1299
+ "Subscribe to notifications when an object is deleted or a delete marker for a versioned object is created."
1300
+ ),
1301
+ "removed:delete": TaskSchema.optional().describe(
1302
+ "Subscribe to notifications when an object is deleted"
1303
+ ),
1304
+ "removed:marker": TaskSchema.optional().describe(
1305
+ "Subscribe to notifications when a delete marker for a versioned object is created."
1306
+ )
1307
+ }).optional().describe("Describes the store events you want to subscribe too.")
1308
+ })
1309
+ )
1310
+ ]).optional().describe("Define the stores in your stack.");
1311
+
1312
+ // src/feature/icon/schema.ts
1313
+ import { z as z35 } from "zod";
1314
+ var staticOriginSchema = LocalDirectorySchema.describe(
1315
+ "Specifies the path to a local image directory that will be uploaded in S3."
1316
+ );
1317
+ var functionOriginSchema = FunctionSchema.describe(
1318
+ "Specifies the file that will be called when an image isn't found in the (cache) bucket."
1319
+ );
1320
+ var IconsSchema = z35.record(
1321
+ ResourceIdSchema,
1322
+ z35.object({
1323
+ // domain: ResourceIdSchema.describe('The domain id to link your site with.').optional(),
1324
+ // subDomain: z.string().optional(),
1325
+ router: ResourceIdSchema.describe("The router id to link your icon proxy."),
1326
+ path: RouteSchema2.describe("The path inside the router to link your icon proxy to."),
1327
+ log: LogSchema.optional(),
1328
+ cacheDuration: DurationSchema.optional().describe("The cache duration of the cached icons."),
1329
+ preserveIds: z35.boolean().optional().default(false).describe("Preserve the IDs of the icons."),
1330
+ symbols: z35.boolean().optional().default(false).describe(`Convert the SVG's to SVG symbols.`),
1331
+ origin: z35.union([
1332
+ z35.object({
1333
+ static: staticOriginSchema,
1334
+ function: functionOriginSchema.optional()
1335
+ }),
1336
+ z35.object({
1337
+ static: staticOriginSchema.optional(),
1338
+ function: functionOriginSchema
1339
+ })
1340
+ // z.object({
1341
+ // static: staticOriginSchema,
1342
+ // function: functionOriginSchema,
1343
+ // }),
1344
+ ]).describe(
1345
+ "Image transformation will be applied from a base image. Base images orginates from a local directory that will be uploaded to S3 or from a lambda function."
1346
+ )
1347
+ // cors: z
1348
+ // .object({
1349
+ // override: z.boolean().default(true),
1350
+ // maxAge: DurationSchema.default('365 days'),
1351
+ // exposeHeaders: z.string().array().optional(),
1352
+ // credentials: z.boolean().default(false),
1353
+ // headers: z.string().array().default(['*']),
1354
+ // origins: z.string().array().default(['*']),
1355
+ // })
1356
+ // .optional()
1357
+ // .describe('Specify the cors headers.'),
1358
+ // version: z.number().int().min(1).optional().describe('Version of the icon configuration.'),
1359
+ })
1360
+ ).optional().describe("Define an svg icon proxy in your stack. Store, optimize, and deliver svg icons at scale.");
1361
+
1362
+ // src/feature/image/schema.ts
1363
+ import { z as z36 } from "zod";
1364
+ var transformationOptionsSchema = z36.object({
1365
+ width: z36.number().int().positive().optional(),
1366
+ height: z36.number().int().positive().optional(),
1367
+ fit: z36.enum(["cover", "contain", "fill", "inside", "outside"]).optional(),
1368
+ position: z36.enum(["top", "right top", "right", "right bottom", "bottom", "left bottom", "left", "left top", "center"]).optional(),
1369
+ quality: z36.number().int().min(1).max(100).optional()
1370
+ });
1371
+ var staticOriginSchema2 = LocalDirectorySchema.describe(
1372
+ "Specifies the path to a local image directory that will be uploaded in S3."
1373
+ );
1374
+ var functionOriginSchema2 = FunctionSchema.describe(
1375
+ "Specifies the file that will be called when an image isn't found in the (cache) bucket."
1376
+ );
1377
+ var ImagesSchema = z36.record(
1378
+ ResourceIdSchema,
1379
+ z36.object({
1380
+ // domain: ResourceIdSchema.describe('The domain id to link your site with.').optional(),
1381
+ // subDomain: z.string().optional(),
1382
+ router: ResourceIdSchema.describe("The router id to link your image proxy."),
1383
+ path: RouteSchema2.describe("The path inside the router to link your image proxy to."),
1384
+ log: LogSchema.optional(),
1385
+ cacheDuration: DurationSchema.optional().describe("Cache duration of the cached images."),
1386
+ presets: z36.record(z36.string(), transformationOptionsSchema).describe("Named presets for image transformations"),
1387
+ extensions: z36.object({
1388
+ jpg: z36.object({
1389
+ mozjpeg: z36.boolean().optional(),
1390
+ progressive: z36.boolean().optional()
1391
+ }).optional(),
1392
+ webp: z36.object({
1393
+ effort: z36.number().int().min(1).max(10).default(7).optional(),
1394
+ lossless: z36.boolean().optional(),
1395
+ nearLossless: z36.boolean().optional()
1396
+ }).optional(),
1397
+ png: z36.object({
1398
+ compressionLevel: z36.number().int().min(0).max(9).default(6).optional()
1399
+ }).optional()
1400
+ }).refine((data) => {
1401
+ return Object.keys(data).length > 0;
1402
+ }, "At least one extension must be defined.").describe("Specify the allowed extensions."),
1403
+ origin: z36.union([
1404
+ z36.object({
1405
+ static: staticOriginSchema2,
1406
+ function: functionOriginSchema2.optional()
1407
+ }),
1408
+ z36.object({
1409
+ static: staticOriginSchema2.optional(),
1410
+ function: functionOriginSchema2
1411
+ })
1412
+ // z.object({
1413
+ // static: staticOriginSchema,
1414
+ // function: functionOriginSchema,
1415
+ // }),
1416
+ ]).describe(
1417
+ "Specify the origin of your images. Image transformation will be applied from a base image. Base images can be loaded from a S3 bucket (that is synced from a local directory) or dynamicly from a lambda function."
1418
+ )
1419
+ })
1420
+ ).optional().describe("Define an image proxy in your stack. Store, transform, optimize, and deliver images at scale.");
1421
+
1422
+ // src/feature/metric/schema.ts
1423
+ import { z as z37 } from "zod";
1424
+ var ops = {
1425
+ ">": "GreaterThanThreshold",
1426
+ ">=": "GreaterThanOrEqualToThreshold",
1427
+ "<": "LessThanThreshold",
1428
+ "<=": "LessThanOrEqualToThreshold"
1429
+ };
1430
+ var stats = {
1431
+ count: "SampleCount",
1432
+ avg: "Average",
1433
+ sum: "Sum",
1434
+ min: "Minimum",
1435
+ max: "Maximum"
1436
+ };
1437
+ var WhereSchema = z37.union([
1438
+ z37.string().regex(/(count|avg|sum|min|max) (>|>=|<|<=) (\d)/, "Invalid where query").transform((where) => {
1439
+ const [stat4, op, value] = where.split(" ");
1440
+ return { stat: stat4, op, value: parseFloat(value) };
1441
+ }),
1442
+ z37.object({
1443
+ stat: z37.enum(["count", "avg", "sum", "min", "max"]),
1444
+ op: z37.enum([">", ">=", "<", "<="]),
1445
+ value: z37.number()
1446
+ })
1447
+ ]).transform((where) => {
1448
+ return {
1449
+ stat: stats[where.stat],
1450
+ op: ops[where.op],
1451
+ value: where.value
1452
+ };
1453
+ });
1454
+ var AlarmSchema = z37.object({
1455
+ description: z37.string().optional(),
1456
+ where: WhereSchema,
1457
+ period: DurationSchema,
1458
+ minDataPoints: z37.number().int().default(1),
1459
+ trigger: z37.union([EmailSchema.transform((v) => [v]), EmailSchema.array(), FunctionSchema])
1460
+ });
1461
+ var MetricsSchema = z37.record(
1462
+ ResourceIdSchema,
1463
+ z37.object({
1464
+ type: z37.enum(["number", "size", "duration"]),
1465
+ alarms: AlarmSchema.array().optional()
1466
+ })
1467
+ ).optional().describe("Define the metrics in your stack.");
1468
+
1469
+ // src/feature/table/schema.ts
1470
+ import { minutes as minutes5, seconds as seconds4 } from "@awsless/duration";
1471
+ import { z as z38 } from "zod";
1472
+ var KeySchema = z38.string().min(1).max(255);
1473
+ var TablesSchema = z38.record(
1474
+ ResourceIdSchema,
1475
+ z38.object({
1476
+ hash: KeySchema.describe(
1477
+ "Specifies the name of the partition / hash key that makes up the primary key for the table."
1478
+ ),
1479
+ sort: KeySchema.optional().describe(
1480
+ "Specifies the name of the range / sort key that makes up the primary key for the table."
1481
+ ),
1482
+ fields: z38.record(z38.string(), z38.enum(["string", "number", "binary"])).optional().describe(
1483
+ 'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
1484
+ ),
1485
+ class: z38.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
1486
+ pointInTimeRecovery: z38.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
1487
+ ttl: KeySchema.optional().describe(
1488
+ [
1489
+ "The name of the TTL attribute used to store the expiration time for items in the table.",
1490
+ "To update this property, you must first disable TTL and then enable TTL with the new attribute name."
1491
+ ].join("\n")
1492
+ ),
1493
+ // deletionProtection: DeletionProtectionSchema.optional(),
1494
+ stream: z38.object({
1495
+ type: z38.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
1496
+ [
1497
+ "When an item in the table is modified, you can determines what information is written to the stream for this table.",
1498
+ "Valid values are:",
1499
+ "- keys-only - Only the key attributes of the modified item are written to the stream.",
1500
+ "- new-image - The entire item, as it appears after it was modified, is written to the stream.",
1501
+ "- old-image - The entire item, as it appeared before it was modified, is written to the stream.",
1502
+ "- new-and-old-images - Both the new and the old item images of the item are written to the stream."
1503
+ ].join("\n")
1504
+ ),
1505
+ batchSize: z38.number().min(1).max(1e4).default(1).describe(
1506
+ [
1507
+ "The maximum number of records in each batch that Lambda pulls from your stream and sends to your function.",
1508
+ "Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).",
1509
+ "You can specify a number from 1 to 10000."
1510
+ ].join("\n")
1511
+ ),
1512
+ batchWindow: DurationSchema.refine(
1513
+ durationMin(seconds4(1)),
1514
+ "Minimum batch window duration is 1 second"
1515
+ ).refine(durationMax(minutes5(5)), "Maximum batch window duration is 5 minutes").optional().describe(
1516
+ [
1517
+ "The maximum amount of time that is spend gathering records before invoking the function.",
1518
+ "You can specify a duration from 1 seconds to 5 minutes."
1519
+ ].join("\n")
1520
+ ),
1521
+ // maxRecordAge: DurationSchema.refine(
1522
+ // durationMin(seconds(1)),
1523
+ // 'Minimum record age duration is 1 second'
1524
+ // )
1525
+ // .refine(durationMax(minutes(1)), 'Maximum record age duration is 1 minute')
1526
+ // .default('60 seconds')
1527
+ // .describe(
1528
+ // [
1529
+ // 'Discard records older than the specified age.',
1530
+ // 'The maximum valid value for maximum record age is 60s.',
1531
+ // 'The default value is 60s',
1532
+ // ].join('\n')
1533
+ // ),
1534
+ retryAttempts: z38.number().min(-1).max(1e4).default(2).describe(
1535
+ [
1536
+ "Discard records after the specified number of retries.",
1537
+ "-1 will sets the maximum number of retries to infinite.",
1538
+ "When maxRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.",
1539
+ "You can specify a number from -1 to 10000.",
1540
+ "The default value is 2"
1541
+ ].join("\n")
1542
+ ),
1543
+ concurrencyPerShard: z38.number().min(1).max(10).default(1).describe(
1544
+ [
1545
+ "The number of batches to process concurrently from each shard.",
1546
+ "You can specify a number from 1 to 10."
1547
+ ].join("\n")
1548
+ ),
1549
+ consumer: FunctionSchema.describe("The consuming lambda function for the stream")
1550
+ }).optional().describe(
1551
+ "The settings for the DynamoDB table stream, which capture changes to items stored in the table."
1552
+ ),
1553
+ indexes: z38.record(
1554
+ z38.string(),
1555
+ z38.object({
1556
+ hash: z38.union([KeySchema.transform((v) => [v]), KeySchema.array()]).describe(
1557
+ "Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
1558
+ ),
1559
+ sort: z38.union([KeySchema.transform((v) => [v]), KeySchema.array()]).optional().describe(
1560
+ "Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
1561
+ ),
1562
+ projection: z38.enum(["all", "keys-only"]).default("all").describe(
1563
+ [
1564
+ "The set of attributes that are projected into the index:",
1565
+ "- all - All of the table attributes are projected into the index.",
1566
+ "- keys-only - Only the index and primary keys are projected into the index.",
1567
+ '@default "all"'
1568
+ ].join("\n")
1569
+ )
1570
+ })
1571
+ ).optional().describe("Specifies the global secondary indexes to be created on the table.")
1572
+ })
1573
+ ).optional().describe("Define the tables in your stack.");
1574
+
1575
+ // src/feature/test/schema.ts
1576
+ import { z as z39 } from "zod";
1577
+ var TestsSchema = z39.union([
1578
+ //
1579
+ LocalDirectorySchema.transform((v) => [v]),
1580
+ LocalDirectorySchema.array(),
1581
+ z39.literal(false)
1582
+ ]).describe("Define the location of your tests for your stack.").optional();
1583
+
1584
+ // src/config/stack.ts
1585
+ var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
1586
+ var NameSchema = ResourceIdSchema.refine((name) => !["base", "hostedzones"].includes(name), {
1587
+ message: `Stack name can't be a reserved name.`
1588
+ }).describe("Stack name.");
1589
+ var StackSchema = z40.object({
1590
+ $schema: z40.string().optional(),
1591
+ name: NameSchema,
1592
+ depends: DependsSchema,
1593
+ commands: CommandsSchema,
1594
+ // auth: AuthSchema,
1595
+ // http: HttpSchema,
1596
+ rest: RestSchema,
1597
+ rpc: RpcSchema,
1598
+ configs: ConfigsSchema,
1599
+ crons: CronsSchema,
1600
+ caches: CachesSchema,
1601
+ // topics: TopicsSchema,
1602
+ subscribers: SubscribersSchema,
1603
+ functions: FunctionsSchema,
1604
+ instances: InstancesSchema,
1605
+ tasks: TasksSchema,
1606
+ tables: TablesSchema,
1607
+ stores: StoresSchema,
1608
+ // streams: StreamsSchema,
1609
+ queues: QueuesSchema,
1610
+ pubsub: PubSubSchema,
1611
+ searchs: SearchsSchema,
1612
+ sites: SitesSchema,
1613
+ tests: TestsSchema,
1614
+ images: ImagesSchema,
1615
+ icons: IconsSchema,
1616
+ metrics: MetricsSchema
1617
+ });
1618
+
1619
+ // src/config/stage-patch-json-schema.ts
1620
+ var clone = (value) => {
1621
+ return JSON.parse(JSON.stringify(value));
1622
+ };
1623
+ var escapePointerSegment = (value) => {
1624
+ return value.replaceAll("~", "~0").replaceAll("/", "~1");
1625
+ };
1626
+ var escapeRegexSegment = (value) => {
1627
+ return value.replace(/[|\\{}()[\]^$+*?.-]/g, "\\$&");
1628
+ };
1629
+ var makeExactPath = (prefix, segment) => {
1630
+ return `${prefix}/${escapePointerSegment(segment)}`;
1631
+ };
1632
+ var makeExactPattern = (path) => {
1633
+ return `^${path.split("/").map(escapeRegexSegment).join("/")}$`;
1634
+ };
1635
+ var makePatternPath = (prefix, segmentPattern) => {
1636
+ return prefix ? `${prefix}/${segmentPattern}` : `/${segmentPattern}`;
1637
+ };
1638
+ var appendExactPattern = (pattern, segment) => {
1639
+ const base = pattern.slice(1, -1);
1640
+ return `^${base}/${escapeRegexSegment(segment)}$`;
1641
+ };
1642
+ var appendRegexPattern = (pattern, segmentPattern) => {
1643
+ const base = pattern.slice(1, -1);
1644
+ return `^${base}/${segmentPattern}$`;
1645
+ };
1646
+ var mergeSchemas = (schemas) => {
1647
+ const list = schemas.map((schema) => clone(schema));
1648
+ if (list.length === 1) {
1649
+ return list[0];
1650
+ }
1651
+ return {
1652
+ anyOf: list
1653
+ };
1654
+ };
1655
+ var dereference = (schema, root) => {
1656
+ if (typeof schema.$ref !== "string" || !schema.$ref.startsWith("#/")) {
1657
+ return schema;
1658
+ }
1659
+ const target = schema.$ref.slice(2).split("/").map((segment) => segment.replaceAll("~1", "/").replaceAll("~0", "~")).reduce((value, segment) => {
1660
+ if (typeof value === "object" && value !== null) {
1661
+ return value[segment];
1662
+ }
1663
+ return void 0;
1664
+ }, root);
1665
+ if (!target || typeof target !== "object") {
1666
+ return schema;
1667
+ }
1668
+ const { $ref: _, ...rest } = schema;
1669
+ return {
1670
+ ...clone(target),
1671
+ ...rest
1672
+ };
1673
+ };
1674
+ var listBranches = (schema) => {
1675
+ const groups = [schema.anyOf, schema.oneOf, schema.allOf].filter(Boolean);
1676
+ if (groups.length === 0) {
1677
+ return [schema];
1678
+ }
1679
+ return groups.flatMap((group) => group);
1680
+ };
1681
+ var childSegmentPattern = (schema) => {
1682
+ const propertyNameSchema = schema.propertyNames;
1683
+ if (propertyNameSchema && typeof propertyNameSchema.pattern === "string") {
1684
+ return propertyNameSchema.pattern;
1685
+ }
1686
+ const firstPattern = Object.keys(schema.patternProperties ?? {})[0];
1687
+ if (firstPattern) {
1688
+ return firstPattern;
1689
+ }
1690
+ return "[^/]+";
1691
+ };
1692
+ var joinEntries = (entries) => {
1693
+ const map = /* @__PURE__ */ new Map();
1694
+ for (const entry of entries) {
1695
+ const key = [entry.path, entry.pattern ?? "", entry.addOnly ? "1" : "0"].join("|");
1696
+ const previous = map.get(key);
1697
+ if (!previous) {
1698
+ map.set(key, {
1699
+ ...entry,
1700
+ schema: clone(entry.schema)
1701
+ });
1702
+ continue;
1703
+ }
1704
+ previous.schema = mergeSchemas([previous.schema, entry.schema]);
1705
+ }
1706
+ return [...map.values()];
1707
+ };
1708
+ var collectEntries = (schema, pointer = "", pattern = makeExactPattern(pointer), root = schema) => {
1709
+ const resolved = dereference(schema, root);
1710
+ const entries = [
1711
+ {
1712
+ path: pointer,
1713
+ pattern,
1714
+ schema: clone(resolved)
1715
+ }
1716
+ ];
1717
+ for (const branch of listBranches(resolved)) {
1718
+ const branchType = Array.isArray(branch.type) ? branch.type : branch.type ? [branch.type] : [];
1719
+ const isObject = branchType.includes("object") || branch.properties !== void 0 || branch.additionalProperties !== void 0 || branch.patternProperties !== void 0;
1720
+ const isArray = branchType.includes("array") || branch.items !== void 0 || branch.prefixItems !== void 0;
1721
+ if (isObject) {
1722
+ for (const [property, propertySchema] of Object.entries(branch.properties ?? {})) {
1723
+ const path = makeExactPath(pointer, property);
1724
+ entries.push(...collectEntries(propertySchema, path, appendExactPattern(pattern, property), root));
1725
+ }
1726
+ for (const [propertyPattern, propertySchema] of Object.entries(branch.patternProperties ?? {})) {
1727
+ const path = makePatternPath(pointer, propertyPattern);
1728
+ entries.push(...collectEntries(propertySchema, path, appendRegexPattern(pattern, propertyPattern), root));
1729
+ }
1730
+ if (branch.additionalProperties && typeof branch.additionalProperties === "object") {
1731
+ const segmentPattern = childSegmentPattern(branch);
1732
+ const path = makePatternPath(pointer, segmentPattern);
1733
+ entries.push(...collectEntries(branch.additionalProperties, path, appendRegexPattern(pattern, segmentPattern), root));
1734
+ }
1735
+ }
1736
+ if (isArray) {
1737
+ if (Array.isArray(branch.items)) {
1738
+ branch.items.forEach((itemSchema, index) => {
1739
+ entries.push(...collectEntries(itemSchema, `${pointer}/${index}`, appendExactPattern(pattern, `${index}`), root));
1740
+ });
1741
+ } else if (branch.items && typeof branch.items === "object") {
1742
+ entries.push(...collectEntries(branch.items, `${pointer}/\\d+`, appendRegexPattern(pattern, "\\d+"), root));
1743
+ entries.push({
1744
+ path: `${pointer}/-`,
1745
+ pattern: makeExactPattern(`${pointer}/-`),
1746
+ schema: clone(branch.items),
1747
+ addOnly: true
1748
+ });
1749
+ }
1750
+ for (const [index, itemSchema] of (branch.prefixItems ?? []).entries()) {
1751
+ entries.push(...collectEntries(itemSchema, `${pointer}/${index}`, appendExactPattern(pattern, `${index}`), root));
1752
+ }
1753
+ }
1754
+ }
1755
+ return joinEntries(entries);
1756
+ };
1757
+ var pathMatcherSchema = (entry) => {
1758
+ if (entry.pattern && entry.pattern !== makeExactPattern(entry.path)) {
1759
+ return {
1760
+ type: "string",
1761
+ pattern: entry.pattern
1762
+ };
1763
+ }
1764
+ return {
1765
+ type: "string",
1766
+ const: entry.path
1767
+ };
1768
+ };
1769
+ var objectSchema = (properties, required) => {
1770
+ return {
1771
+ type: "object",
1772
+ properties,
1773
+ required,
1774
+ additionalProperties: false
1775
+ };
1776
+ };
1777
+ var conditionalValueSchema = (entry) => {
1778
+ return {
1779
+ if: {
1780
+ type: "object",
1781
+ properties: {
1782
+ path: pathMatcherSchema(entry)
1783
+ },
1784
+ required: ["path"]
1785
+ },
1786
+ then: {
1787
+ properties: {
1788
+ value: clone(entry.schema)
1789
+ }
1790
+ }
1791
+ };
1792
+ };
1793
+ var matchersSchema = (entries) => {
1794
+ return {
1795
+ oneOf: entries.map(pathMatcherSchema)
1796
+ };
1797
+ };
1798
+ var patchOperationSchema = (op, entries) => {
1799
+ const props = {
1800
+ op: {
1801
+ type: "string",
1802
+ const: op
1803
+ },
1804
+ path: matchersSchema(entries)
1805
+ };
1806
+ const required = ["op", "path"];
1807
+ const schema = objectSchema(props, required);
1808
+ switch (op) {
1809
+ case "add":
1810
+ case "replace":
1811
+ case "test":
1812
+ schema.properties = {
1813
+ ...schema.properties,
1814
+ value: {}
1815
+ };
1816
+ schema.required = [...required, "value"];
1817
+ schema.allOf = entries.map(conditionalValueSchema);
1818
+ return schema;
1819
+ case "move":
1820
+ case "copy":
1821
+ schema.properties = {
1822
+ ...schema.properties,
1823
+ from: matchersSchema(entries)
1824
+ };
1825
+ schema.required = ["op", "from", "path"];
1826
+ return schema;
1827
+ default:
1828
+ return schema;
1829
+ }
1830
+ };
1831
+ var normalizeEntry = (entry) => {
1832
+ return {
1833
+ ...entry,
1834
+ pattern: entry.pattern ?? makeExactPattern(entry.path)
1835
+ };
1836
+ };
1837
+ var isSchemaMetadataPath = (entry) => {
1838
+ return entry.path === "/$schema" || entry.path.startsWith("/$schema/");
1839
+ };
1840
+ var createStagePatchJsonSchema = (baseSchema, title) => {
1841
+ const entries = collectEntries(baseSchema).map(normalizeEntry).filter((entry) => !isSchemaMetadataPath(entry));
1842
+ const standardEntries = entries.filter((entry) => !entry.addOnly);
1843
+ const addEntries = entries;
1844
+ const moveCopyEntries = standardEntries.filter((entry) => entry.path !== "");
1845
+ return {
1846
+ $schema: "http://json-schema.org/draft-07/schema#",
1847
+ title,
1848
+ type: "object",
1849
+ additionalProperties: false,
1850
+ properties: {
1851
+ $schema: {
1852
+ type: "string"
1853
+ },
1854
+ operations: {
1855
+ type: "array",
1856
+ items: {
1857
+ oneOf: [
1858
+ patchOperationSchema("add", addEntries),
1859
+ patchOperationSchema("remove", standardEntries),
1860
+ patchOperationSchema("replace", standardEntries),
1861
+ patchOperationSchema("move", moveCopyEntries),
1862
+ patchOperationSchema("copy", moveCopyEntries),
1863
+ patchOperationSchema("test", standardEntries)
1864
+ ]
1865
+ }
1866
+ }
1867
+ },
1868
+ required: ["operations"]
1869
+ };
1870
+ };
1871
+
1872
+ // cli/build-json-schema.ts
1873
+ var generateJsonSchema = (props) => {
1874
+ const file = join2(process.cwd(), `dist/${props.name}.json`);
1875
+ const schema = zodToJsonSchema(props.schema, {
1876
+ name: props.name,
1877
+ // errorMessages: true,
1878
+ markdownDescription: true,
1879
+ pipeStrategy: "input",
1880
+ $refStrategy: "none"
1881
+ });
1882
+ appendDefaults(schema);
1883
+ schema.title = props.title;
1884
+ writeFileSync(file, JSON.stringify(schema));
1885
+ return schema;
1886
+ };
1887
+ var appendDefaults = (object) => {
1888
+ if (Array.isArray(object)) {
1889
+ object.forEach(appendDefaults);
1890
+ }
1891
+ if (typeof object === "object" && object !== null) {
1892
+ if ("default" in object && "type" in object) {
1893
+ if ("description" in object) {
1894
+ object.description += `
1895
+
1896
+ @default ${JSON.stringify(object.default)}`;
1897
+ }
1898
+ if ("markdownDescription" in object) {
1899
+ object.markdownDescription += `
1900
+
1901
+ @default \`\`\`${JSON.stringify(object.default)}\`\`\``;
1902
+ }
1903
+ } else {
1904
+ Object.values(object).forEach(appendDefaults);
1905
+ }
1906
+ }
1907
+ };
1908
+ var appSchema = generateJsonSchema({
1909
+ schema: AppSchema,
1910
+ name: "app",
1911
+ title: "Awsless App Config"
1912
+ });
1913
+ var stackSchema = generateJsonSchema({
1914
+ schema: StackSchema,
1915
+ name: "stack",
1916
+ title: "Awsless Stack Config"
1917
+ });
1918
+ writeFileSync(
1919
+ join2(process.cwd(), "dist/app.stage.json"),
1920
+ JSON.stringify(createStagePatchJsonSchema(appSchema, "Awsless App Stage Patch Config"))
1921
+ );
1922
+ writeFileSync(
1923
+ join2(process.cwd(), "dist/stack.stage.json"),
1924
+ JSON.stringify(createStagePatchJsonSchema(stackSchema, "Awsless Stack Stage Patch Config"))
1925
+ );