@awsless/awsless 0.0.435 → 0.0.436
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.json +1 -1
- package/dist/bin.js +275 -166
- package/dist/build-json-schema.js +151 -137
- package/dist/prebuild/rpc/HASH +1 -1
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/stack.json +1 -1
- package/package.json +11 -11
|
@@ -5,7 +5,7 @@ import { zodToJsonSchema } from "zod-to-json-schema";
|
|
|
5
5
|
import { z as z30 } from "zod";
|
|
6
6
|
|
|
7
7
|
// src/feature/auth/schema.ts
|
|
8
|
-
import { z as
|
|
8
|
+
import { z as z8 } from "zod";
|
|
9
9
|
|
|
10
10
|
// src/config/schema/resource-id.ts
|
|
11
11
|
import { paramCase } from "change-case";
|
|
@@ -15,7 +15,7 @@ var ResourceIdSchema = z.string().min(3).max(24).regex(/^[a-z0-9\-]+$/i, "Invali
|
|
|
15
15
|
// src/feature/function/schema.ts
|
|
16
16
|
import { days, minutes, seconds, toDays } from "@awsless/duration";
|
|
17
17
|
import { gibibytes, mebibytes } from "@awsless/size";
|
|
18
|
-
import { z as
|
|
18
|
+
import { z as z6 } from "zod";
|
|
19
19
|
|
|
20
20
|
// src/config/schema/duration.ts
|
|
21
21
|
import { z as z2 } from "zod";
|
|
@@ -32,6 +32,10 @@ var durationMax = (max) => {
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
// src/config/schema/local-directory.ts
|
|
36
|
+
import { stat as stat2 } from "fs/promises";
|
|
37
|
+
import { z as z4 } from "zod";
|
|
38
|
+
|
|
35
39
|
// src/config/schema/local-file.ts
|
|
36
40
|
import { stat } from "fs/promises";
|
|
37
41
|
import { join as join2 } from "path";
|
|
@@ -85,10 +89,20 @@ var LocalFileSchema = z3.string().transform((path) => resolvePath(path)).refine(
|
|
|
85
89
|
}
|
|
86
90
|
}, `File doesn't exist`);
|
|
87
91
|
|
|
92
|
+
// src/config/schema/local-directory.ts
|
|
93
|
+
var LocalDirectorySchema = z4.string().transform((path) => resolvePath(path)).refine(async (path) => {
|
|
94
|
+
try {
|
|
95
|
+
const s = await stat2(path);
|
|
96
|
+
return s.isDirectory();
|
|
97
|
+
} catch (error) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}, `Directory doesn't exist`);
|
|
101
|
+
|
|
88
102
|
// src/config/schema/size.ts
|
|
89
|
-
import { z as
|
|
103
|
+
import { z as z5 } from "zod";
|
|
90
104
|
import { parse as parse2 } from "@awsless/size";
|
|
91
|
-
var SizeSchema =
|
|
105
|
+
var SizeSchema = z5.string().regex(/^[0-9]+ (B|KB|MB|GB|TB|PB)$/, "Invalid size").transform((v) => parse2(v));
|
|
92
106
|
var sizeMin = (min) => {
|
|
93
107
|
return (size) => {
|
|
94
108
|
return size.value >= min.value;
|
|
@@ -111,33 +125,32 @@ var EphemeralStorageSizeSchema = SizeSchema.refine(
|
|
|
111
125
|
sizeMin(mebibytes(512)),
|
|
112
126
|
"Minimum ephemeral storage size is 512 MB"
|
|
113
127
|
).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.");
|
|
114
|
-
var ReservedConcurrentExecutionsSchema =
|
|
115
|
-
var EnvironmentSchema =
|
|
116
|
-
var ArchitectureSchema =
|
|
117
|
-
var RetryAttemptsSchema =
|
|
128
|
+
var ReservedConcurrentExecutionsSchema = z6.number().int().min(0).describe("The number of simultaneous executions to reserve for the function. You can specify a number from 0.");
|
|
129
|
+
var EnvironmentSchema = z6.record(z6.string(), z6.string()).optional().describe("Environment variable key-value pairs.");
|
|
130
|
+
var ArchitectureSchema = z6.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
|
|
131
|
+
var RetryAttemptsSchema = z6.number().int().min(0).max(2).describe(
|
|
118
132
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
119
133
|
);
|
|
120
|
-
var NodeRuntimeSchema =
|
|
121
|
-
var ContainerRuntimeSchema =
|
|
122
|
-
var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema);
|
|
123
|
-
var ActionSchema =
|
|
124
|
-
var ActionsSchema =
|
|
125
|
-
var ArnSchema =
|
|
126
|
-
var WildcardSchema =
|
|
127
|
-
var ResourceSchema =
|
|
128
|
-
var ResourcesSchema =
|
|
129
|
-
var PermissionSchema =
|
|
130
|
-
effect:
|
|
134
|
+
var NodeRuntimeSchema = z6.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]);
|
|
135
|
+
var ContainerRuntimeSchema = z6.literal("container");
|
|
136
|
+
var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).describe("The identifier of the function's runtime.");
|
|
137
|
+
var ActionSchema = z6.string();
|
|
138
|
+
var ActionsSchema = z6.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
|
|
139
|
+
var ArnSchema = z6.string().startsWith("arn:").transform((v) => v);
|
|
140
|
+
var WildcardSchema = z6.literal("*");
|
|
141
|
+
var ResourceSchema = z6.union([ArnSchema, WildcardSchema]);
|
|
142
|
+
var ResourcesSchema = z6.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
|
|
143
|
+
var PermissionSchema = z6.object({
|
|
144
|
+
effect: z6.enum(["allow", "deny"]).default("allow"),
|
|
131
145
|
actions: ActionsSchema,
|
|
132
146
|
resources: ResourcesSchema
|
|
133
147
|
});
|
|
134
|
-
var PermissionsSchema =
|
|
135
|
-
var WarmSchema =
|
|
136
|
-
var VPCSchema =
|
|
137
|
-
var MinifySchema =
|
|
138
|
-
var HandlerSchema =
|
|
139
|
-
var
|
|
140
|
-
var DescriptionSchema = z5.string().describe("A description of the function.");
|
|
148
|
+
var PermissionsSchema = z6.union([PermissionSchema.transform((v) => [v]), PermissionSchema.array()]).describe("Add IAM permissions to your function.");
|
|
149
|
+
var WarmSchema = z6.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.");
|
|
150
|
+
var VPCSchema = z6.boolean().describe("Put the function inside your global VPC.");
|
|
151
|
+
var MinifySchema = z6.boolean().describe("Minify the function code.");
|
|
152
|
+
var HandlerSchema = z6.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
|
|
153
|
+
var DescriptionSchema = z6.string().describe("A description of the function.");
|
|
141
154
|
var validLogRetentionDays = [
|
|
142
155
|
...[1n, 3n, 5n, 7n, 14n, 30n, 60n, 90n, 120n, 150n],
|
|
143
156
|
...[180n, 365n, 400n, 545n, 731n, 1096n, 1827n, 2192n],
|
|
@@ -152,47 +165,59 @@ var LogRetentionSchema = DurationSchema.refine(
|
|
|
152
165
|
},
|
|
153
166
|
`Invalid log retention. Valid days are: ${validLogRetentionDays.map((days3) => `${days3}`).join(", ")}`
|
|
154
167
|
).describe("The log retention duration.");
|
|
155
|
-
var LogSubscriptionSchema =
|
|
168
|
+
var LogSubscriptionSchema = z6.union([
|
|
156
169
|
LocalFileSchema.transform((file) => ({
|
|
157
170
|
file
|
|
158
171
|
})),
|
|
159
|
-
|
|
172
|
+
z6.object({
|
|
160
173
|
subscriber: LocalFileSchema,
|
|
161
|
-
filter:
|
|
174
|
+
filter: z6.string().optional()
|
|
162
175
|
})
|
|
163
176
|
]).describe(
|
|
164
177
|
"Log Subscription allow you to subscribe to a real-time stream of log events and have them delivered to a specific destination"
|
|
165
178
|
);
|
|
166
|
-
var LogSchema =
|
|
167
|
-
|
|
179
|
+
var LogSchema = z6.union([
|
|
180
|
+
z6.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
|
|
168
181
|
LogRetentionSchema.transform((retention) => ({ retention })),
|
|
169
|
-
|
|
182
|
+
z6.object({
|
|
170
183
|
subscription: LogSubscriptionSchema.optional(),
|
|
171
184
|
retention: LogRetentionSchema.optional(),
|
|
172
|
-
format:
|
|
185
|
+
format: z6.enum(["text", "json"]).describe(
|
|
173
186
|
`The format in which Lambda sends your function's application and system logs to CloudWatch. Select between plain text and structured JSON.`
|
|
174
187
|
).optional(),
|
|
175
|
-
system:
|
|
188
|
+
system: z6.enum(["debug", "info", "warn"]).describe(
|
|
176
189
|
"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."
|
|
177
190
|
).optional(),
|
|
178
|
-
level:
|
|
191
|
+
level: z6.enum(["trace", "debug", "info", "warn", "error", "fatal"]).describe(
|
|
179
192
|
"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."
|
|
180
193
|
).optional()
|
|
181
194
|
})
|
|
182
195
|
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
183
|
-
var LayersSchema =
|
|
196
|
+
var LayersSchema = z6.string().array().describe(
|
|
184
197
|
// `A list of function layers to add to the function's execution environment..`
|
|
185
198
|
`A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.`
|
|
186
199
|
);
|
|
187
|
-
var
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
200
|
+
var FileCodeSchema = z6.object({
|
|
201
|
+
file: LocalFileSchema.describe("The file path of the function code."),
|
|
202
|
+
minify: MinifySchema.optional().default(true),
|
|
203
|
+
external: z6.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
|
|
204
|
+
});
|
|
205
|
+
var BundleCodeSchema = z6.object({
|
|
206
|
+
bundle: LocalDirectorySchema.describe("The directory that needs to be bundled.")
|
|
207
|
+
});
|
|
208
|
+
var CodeSchema = z6.union([
|
|
209
|
+
LocalFileSchema.transform((file) => ({
|
|
210
|
+
file
|
|
211
|
+
})),
|
|
212
|
+
FileCodeSchema,
|
|
213
|
+
BundleCodeSchema
|
|
214
|
+
]).describe("Specify the code of your function.");
|
|
215
|
+
var FnSchema = z6.object({
|
|
216
|
+
code: CodeSchema,
|
|
193
217
|
// node
|
|
194
218
|
handler: HandlerSchema.optional(),
|
|
195
|
-
build: BuildSchema.optional(),
|
|
219
|
+
// build: BuildSchema.optional(),
|
|
220
|
+
// bundle: BundleSchema.optional(),
|
|
196
221
|
// container
|
|
197
222
|
// ...
|
|
198
223
|
runtime: RuntimeSchema.optional(),
|
|
@@ -210,20 +235,23 @@ var FnSchema = z5.object({
|
|
|
210
235
|
environment: EnvironmentSchema.optional(),
|
|
211
236
|
permissions: PermissionsSchema.optional()
|
|
212
237
|
});
|
|
213
|
-
var FunctionSchema =
|
|
238
|
+
var FunctionSchema = z6.union([
|
|
214
239
|
LocalFileSchema.transform((file) => ({
|
|
215
|
-
|
|
240
|
+
code: {
|
|
241
|
+
file
|
|
242
|
+
}
|
|
216
243
|
})),
|
|
217
244
|
FnSchema
|
|
218
245
|
]);
|
|
219
|
-
var FunctionsSchema =
|
|
220
|
-
var FunctionDefaultSchema =
|
|
246
|
+
var FunctionsSchema = z6.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
|
|
247
|
+
var FunctionDefaultSchema = z6.object({
|
|
221
248
|
runtime: RuntimeSchema.default("nodejs20.x"),
|
|
222
249
|
// node
|
|
223
250
|
handler: HandlerSchema.default("index.default"),
|
|
224
|
-
build: BuildSchema.default({
|
|
225
|
-
|
|
226
|
-
|
|
251
|
+
// build: BuildSchema.default({
|
|
252
|
+
// type: 'simple',
|
|
253
|
+
// minify: true,
|
|
254
|
+
// }),
|
|
227
255
|
// container
|
|
228
256
|
warm: WarmSchema.default(0),
|
|
229
257
|
vpc: VPCSchema.default(false),
|
|
@@ -245,11 +273,11 @@ var FunctionDefaultSchema = z5.object({
|
|
|
245
273
|
}).default({});
|
|
246
274
|
|
|
247
275
|
// src/config/schema/email.ts
|
|
248
|
-
import { z as
|
|
249
|
-
var EmailSchema =
|
|
276
|
+
import { z as z7 } from "zod";
|
|
277
|
+
var EmailSchema = z7.string().email();
|
|
250
278
|
|
|
251
279
|
// src/feature/auth/schema.ts
|
|
252
|
-
var TriggersSchema =
|
|
280
|
+
var TriggersSchema = z8.object({
|
|
253
281
|
beforeToken: FunctionSchema.optional().describe("A pre jwt token generation AWS Lambda trigger."),
|
|
254
282
|
beforeLogin: FunctionSchema.optional().describe("A pre user login AWS Lambda trigger."),
|
|
255
283
|
afterLogin: FunctionSchema.optional().describe("A post user login AWS Lambda trigger."),
|
|
@@ -262,42 +290,42 @@ var TriggersSchema = z7.object({
|
|
|
262
290
|
createChallenge: FunctionSchema.optional().describe("Creates an authentication challenge."),
|
|
263
291
|
verifyChallenge: FunctionSchema.optional().describe("Verifies the authentication challenge response.")
|
|
264
292
|
}).describe("Specifies the configuration for AWS Lambda triggers.");
|
|
265
|
-
var AuthSchema =
|
|
293
|
+
var AuthSchema = z8.record(
|
|
266
294
|
ResourceIdSchema,
|
|
267
|
-
|
|
268
|
-
access:
|
|
295
|
+
z8.object({
|
|
296
|
+
access: z8.boolean().default(false).describe("Give access to every function in this stack to your cognito instance."),
|
|
269
297
|
triggers: TriggersSchema.optional()
|
|
270
298
|
})
|
|
271
299
|
).optional().describe("Define the auth triggers in your stack.");
|
|
272
|
-
var AuthDefaultSchema =
|
|
300
|
+
var AuthDefaultSchema = z8.record(
|
|
273
301
|
ResourceIdSchema,
|
|
274
|
-
|
|
275
|
-
allowUserRegistration:
|
|
276
|
-
messaging:
|
|
302
|
+
z8.object({
|
|
303
|
+
allowUserRegistration: z8.boolean().default(true).describe("Specifies whether users can create an user account or if only the administrator can."),
|
|
304
|
+
messaging: z8.object({
|
|
277
305
|
fromEmail: EmailSchema.describe("Specifies the sender's email address."),
|
|
278
|
-
fromName:
|
|
306
|
+
fromName: z8.string().optional().describe("Specifies the sender's name."),
|
|
279
307
|
replyTo: EmailSchema.optional().describe(
|
|
280
308
|
"The destination to which the receiver of the email should reply."
|
|
281
309
|
)
|
|
282
310
|
}).optional().describe("The email configuration for sending messages."),
|
|
283
311
|
// secret: z.boolean().default(false).describe('Specifies whether you want to generate a client secret.'),
|
|
284
|
-
username:
|
|
285
|
-
emailAlias:
|
|
286
|
-
caseSensitive:
|
|
312
|
+
username: z8.object({
|
|
313
|
+
emailAlias: z8.boolean().default(true).describe("Allow the user email to be used as username."),
|
|
314
|
+
caseSensitive: z8.boolean().default(false).describe(
|
|
287
315
|
"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."
|
|
288
316
|
)
|
|
289
317
|
}).default({}).describe("The username policy."),
|
|
290
|
-
password:
|
|
291
|
-
minLength:
|
|
292
|
-
uppercase:
|
|
293
|
-
lowercase:
|
|
294
|
-
numbers:
|
|
295
|
-
symbols:
|
|
318
|
+
password: z8.object({
|
|
319
|
+
minLength: z8.number().int().min(6).max(99).default(12).describe("Required users to have at least the minimum password length."),
|
|
320
|
+
uppercase: z8.boolean().default(true).describe("Required users to use at least one uppercase letter in their password."),
|
|
321
|
+
lowercase: z8.boolean().default(true).describe("Required users to use at least one lowercase letter in their password."),
|
|
322
|
+
numbers: z8.boolean().default(true).describe("Required users to use at least one number in their password."),
|
|
323
|
+
symbols: z8.boolean().default(true).describe("Required users to use at least one symbol in their password."),
|
|
296
324
|
temporaryPasswordValidity: DurationSchema.default("7 days").describe(
|
|
297
325
|
"The duration a temporary password is valid. If the user doesn't sign in during this time, an administrator must reset their password."
|
|
298
326
|
)
|
|
299
327
|
}).default({}).describe("The password policy."),
|
|
300
|
-
validity:
|
|
328
|
+
validity: z8.object({
|
|
301
329
|
idToken: DurationSchema.default("1 hour").describe(
|
|
302
330
|
"The ID token time limit. After this limit expires, your user can't use their ID token."
|
|
303
331
|
),
|
|
@@ -313,8 +341,8 @@ var AuthDefaultSchema = z7.record(
|
|
|
313
341
|
).default({}).describe("Define the authenticatable users in your app.");
|
|
314
342
|
|
|
315
343
|
// src/feature/cache/schema.ts
|
|
316
|
-
import { z as
|
|
317
|
-
var TypeSchema =
|
|
344
|
+
import { z as z9 } from "zod";
|
|
345
|
+
var TypeSchema = z9.enum([
|
|
318
346
|
"t4g.small",
|
|
319
347
|
"t4g.medium",
|
|
320
348
|
"r6g.large",
|
|
@@ -329,29 +357,29 @@ var TypeSchema = z8.enum([
|
|
|
329
357
|
"r6gd.4xlarge",
|
|
330
358
|
"r6gd.8xlarge"
|
|
331
359
|
]);
|
|
332
|
-
var PortSchema =
|
|
333
|
-
var ShardsSchema =
|
|
334
|
-
var ReplicasPerShardSchema =
|
|
335
|
-
var EngineSchema =
|
|
336
|
-
var CachesSchema =
|
|
360
|
+
var PortSchema = z9.number().int().min(1).max(5e4);
|
|
361
|
+
var ShardsSchema = z9.number().int().min(0).max(100);
|
|
362
|
+
var ReplicasPerShardSchema = z9.number().int().min(0).max(5);
|
|
363
|
+
var EngineSchema = z9.enum(["7.0", "6.2"]);
|
|
364
|
+
var CachesSchema = z9.record(
|
|
337
365
|
ResourceIdSchema,
|
|
338
|
-
|
|
366
|
+
z9.object({
|
|
339
367
|
type: TypeSchema.default("t4g.small"),
|
|
340
368
|
port: PortSchema.default(6379),
|
|
341
369
|
shards: ShardsSchema.default(1),
|
|
342
370
|
replicasPerShard: ReplicasPerShardSchema.default(1),
|
|
343
371
|
engine: EngineSchema.default("7.0"),
|
|
344
|
-
dataTiering:
|
|
372
|
+
dataTiering: z9.boolean().default(false)
|
|
345
373
|
})
|
|
346
374
|
).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
|
|
347
375
|
|
|
348
376
|
// src/feature/command/schema.ts
|
|
349
|
-
import { z as
|
|
350
|
-
var CommandSchema =
|
|
351
|
-
|
|
377
|
+
import { z as z10 } from "zod";
|
|
378
|
+
var CommandSchema = z10.union([
|
|
379
|
+
z10.object({
|
|
352
380
|
file: LocalFileSchema,
|
|
353
|
-
handler:
|
|
354
|
-
description:
|
|
381
|
+
handler: z10.string().default("default").describe("The name of the handler that needs to run"),
|
|
382
|
+
description: z10.string().optional().describe("A description of the command")
|
|
355
383
|
// options: z.record(ResourceIdSchema, OptionSchema).optional(),
|
|
356
384
|
// arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
|
|
357
385
|
}),
|
|
@@ -361,22 +389,22 @@ var CommandSchema = z9.union([
|
|
|
361
389
|
description: void 0
|
|
362
390
|
}))
|
|
363
391
|
]);
|
|
364
|
-
var CommandsSchema =
|
|
392
|
+
var CommandsSchema = z10.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
|
|
365
393
|
|
|
366
394
|
// src/feature/config/schema.ts
|
|
367
|
-
import { z as
|
|
368
|
-
var ConfigNameSchema =
|
|
369
|
-
var ConfigsSchema =
|
|
395
|
+
import { z as z11 } from "zod";
|
|
396
|
+
var ConfigNameSchema = z11.string().regex(/[a-z0-9\-]/g, "Invalid config name");
|
|
397
|
+
var ConfigsSchema = z11.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
|
|
370
398
|
|
|
371
399
|
// src/feature/cron/schema/index.ts
|
|
372
|
-
import { z as
|
|
400
|
+
import { z as z13 } from "zod";
|
|
373
401
|
|
|
374
402
|
// src/feature/cron/schema/schedule.ts
|
|
375
|
-
import { z as
|
|
403
|
+
import { z as z12 } from "zod";
|
|
376
404
|
import { awsCronExpressionValidator } from "aws-cron-expression-validator";
|
|
377
|
-
var RateExpressionSchema =
|
|
405
|
+
var RateExpressionSchema = z12.custom(
|
|
378
406
|
(value) => {
|
|
379
|
-
return
|
|
407
|
+
return z12.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
|
|
380
408
|
const [str] = rate.split(" ");
|
|
381
409
|
const number = parseInt(str);
|
|
382
410
|
return number > 0;
|
|
@@ -392,9 +420,9 @@ var RateExpressionSchema = z11.custom(
|
|
|
392
420
|
}
|
|
393
421
|
return `rate(${rate})`;
|
|
394
422
|
});
|
|
395
|
-
var CronExpressionSchema =
|
|
423
|
+
var CronExpressionSchema = z12.custom(
|
|
396
424
|
(value) => {
|
|
397
|
-
return
|
|
425
|
+
return z12.string().safeParse(value).success;
|
|
398
426
|
},
|
|
399
427
|
{ message: "Invalid cron expression" }
|
|
400
428
|
).superRefine((value, ctx) => {
|
|
@@ -403,12 +431,12 @@ var CronExpressionSchema = z11.custom(
|
|
|
403
431
|
} catch (error) {
|
|
404
432
|
if (error instanceof Error) {
|
|
405
433
|
ctx.addIssue({
|
|
406
|
-
code:
|
|
434
|
+
code: z12.ZodIssueCode.custom,
|
|
407
435
|
message: `Invalid cron expression: ${error.message}`
|
|
408
436
|
});
|
|
409
437
|
} else {
|
|
410
438
|
ctx.addIssue({
|
|
411
|
-
code:
|
|
439
|
+
code: z12.ZodIssueCode.custom,
|
|
412
440
|
message: "Invalid cron expression"
|
|
413
441
|
});
|
|
414
442
|
}
|
|
@@ -419,31 +447,31 @@ var CronExpressionSchema = z11.custom(
|
|
|
419
447
|
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
420
448
|
|
|
421
449
|
// src/feature/cron/schema/index.ts
|
|
422
|
-
var CronsSchema =
|
|
450
|
+
var CronsSchema = z13.record(
|
|
423
451
|
ResourceIdSchema,
|
|
424
|
-
|
|
425
|
-
enabled:
|
|
452
|
+
z13.object({
|
|
453
|
+
enabled: z13.boolean().default(true).describe("If the cron is enabled."),
|
|
426
454
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
427
455
|
schedule: ScheduleExpressionSchema.describe(
|
|
428
456
|
'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
|
|
429
457
|
),
|
|
430
|
-
payload:
|
|
458
|
+
payload: z13.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
|
|
431
459
|
})
|
|
432
460
|
).optional().describe(`Define the cron jobs in your stack.`);
|
|
433
461
|
|
|
434
462
|
// src/feature/graphql/schema.ts
|
|
435
|
-
import { z as
|
|
463
|
+
import { z as z14 } from "zod";
|
|
436
464
|
var AuthorizerTtl = DurationSchema.describe(
|
|
437
465
|
`The number of seconds a response should be cached for. The maximum value is one hour (3600 seconds). The Lambda function can override this by returning a ttlOverride key in its response.`
|
|
438
466
|
);
|
|
439
|
-
var GraphQLDefaultSchema =
|
|
467
|
+
var GraphQLDefaultSchema = z14.record(
|
|
440
468
|
ResourceIdSchema,
|
|
441
|
-
|
|
469
|
+
z14.object({
|
|
442
470
|
domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
|
|
443
|
-
subDomain:
|
|
444
|
-
auth:
|
|
471
|
+
subDomain: z14.string().optional(),
|
|
472
|
+
auth: z14.union([
|
|
445
473
|
ResourceIdSchema,
|
|
446
|
-
|
|
474
|
+
z14.object({
|
|
447
475
|
authorizer: FunctionSchema,
|
|
448
476
|
ttl: AuthorizerTtl.default("1 hour")
|
|
449
477
|
})
|
|
@@ -455,22 +483,22 @@ var GraphQLDefaultSchema = z13.record(
|
|
|
455
483
|
resolver: LocalFileSchema.optional()
|
|
456
484
|
})
|
|
457
485
|
).describe(`Define the global GraphQL API's.`).optional();
|
|
458
|
-
var GraphQLSchema =
|
|
486
|
+
var GraphQLSchema = z14.record(
|
|
459
487
|
ResourceIdSchema,
|
|
460
|
-
|
|
488
|
+
z14.object({
|
|
461
489
|
// schema: z.union([LocalFileSchema.transform(v => [v]), z.array(LocalFileSchema).min(1)]).optional(),
|
|
462
490
|
schema: LocalFileSchema.describe("The graphql schema file."),
|
|
463
|
-
resolvers:
|
|
491
|
+
resolvers: z14.record(
|
|
464
492
|
// TypeName
|
|
465
|
-
|
|
466
|
-
|
|
493
|
+
z14.string(),
|
|
494
|
+
z14.record(
|
|
467
495
|
// FieldName
|
|
468
|
-
|
|
469
|
-
|
|
496
|
+
z14.string(),
|
|
497
|
+
z14.union([
|
|
470
498
|
FunctionSchema.transform((consumer) => ({
|
|
471
499
|
consumer
|
|
472
500
|
})),
|
|
473
|
-
|
|
501
|
+
z14.object({
|
|
474
502
|
consumer: FunctionSchema,
|
|
475
503
|
resolver: LocalFileSchema.optional()
|
|
476
504
|
})
|
|
@@ -481,34 +509,20 @@ var GraphQLSchema = z13.record(
|
|
|
481
509
|
).describe("Define the schema & resolvers in your stack for your global GraphQL API.").optional();
|
|
482
510
|
|
|
483
511
|
// src/feature/http/schema.ts
|
|
484
|
-
import { z as
|
|
485
|
-
var RouteSchema =
|
|
486
|
-
var HttpDefaultSchema =
|
|
512
|
+
import { z as z15 } from "zod";
|
|
513
|
+
var RouteSchema = z15.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route").transform((v) => v);
|
|
514
|
+
var HttpDefaultSchema = z15.record(
|
|
487
515
|
ResourceIdSchema,
|
|
488
|
-
|
|
516
|
+
z15.object({
|
|
489
517
|
domain: ResourceIdSchema.describe("The domain id to link your API with."),
|
|
490
|
-
subDomain:
|
|
518
|
+
subDomain: z15.string().optional()
|
|
491
519
|
// auth: ResourceIdSchema.optional(),
|
|
492
520
|
})
|
|
493
521
|
).optional().describe("Define your global HTTP API's.");
|
|
494
|
-
var HttpSchema =
|
|
522
|
+
var HttpSchema = z15.record(ResourceIdSchema, z15.record(RouteSchema, FunctionSchema)).optional().describe("Define routes in your stack for your global HTTP API.");
|
|
495
523
|
|
|
496
524
|
// src/feature/instance/schema.ts
|
|
497
525
|
import { z as z16 } from "zod";
|
|
498
|
-
|
|
499
|
-
// src/config/schema/local-directory.ts
|
|
500
|
-
import { stat as stat2 } from "fs/promises";
|
|
501
|
-
import { z as z15 } from "zod";
|
|
502
|
-
var LocalDirectorySchema = z15.string().transform((path) => resolvePath(path)).refine(async (path) => {
|
|
503
|
-
try {
|
|
504
|
-
const s = await stat2(path);
|
|
505
|
-
return s.isDirectory();
|
|
506
|
-
} catch (error) {
|
|
507
|
-
return false;
|
|
508
|
-
}
|
|
509
|
-
}, `Directory doesn't exist`);
|
|
510
|
-
|
|
511
|
-
// src/feature/instance/schema.ts
|
|
512
526
|
var ImageSchema = z16.string().regex(/^ami\-[0-9a-f]+/).describe("The ID of the AMI.");
|
|
513
527
|
var TypeSchema2 = z16.enum([
|
|
514
528
|
"t3.nano",
|
|
@@ -529,7 +543,7 @@ var TypeSchema2 = z16.enum([
|
|
|
529
543
|
"g4dn.xlarge"
|
|
530
544
|
]).describe(`The instance type.`);
|
|
531
545
|
var CommandSchema2 = z16.string().describe(`The script you want to execute when the instance starts up.`);
|
|
532
|
-
var
|
|
546
|
+
var CodeSchema2 = LocalDirectorySchema.describe(`The code directory that will be deployed to your instance.`);
|
|
533
547
|
var ConnectSchema = z16.boolean().describe("Allows you to connect to all instances with an Instance Connect Endpoint.");
|
|
534
548
|
var EnvironmentSchema2 = z16.record(z16.string(), z16.string()).optional().describe("Environment variable key-value pairs.");
|
|
535
549
|
var ActionSchema2 = z16.string();
|
|
@@ -552,7 +566,7 @@ var InstancesSchema = z16.record(
|
|
|
552
566
|
z16.object({
|
|
553
567
|
image: ImageSchema,
|
|
554
568
|
type: TypeSchema2,
|
|
555
|
-
code:
|
|
569
|
+
code: CodeSchema2,
|
|
556
570
|
user: z16.string().default("ec2-user"),
|
|
557
571
|
command: CommandSchema2.optional(),
|
|
558
572
|
environment: EnvironmentSchema2.optional(),
|
package/dist/prebuild/rpc/HASH
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
78731c42d1c2b6ee145a017c2f6c37bee4d55851
|
|
Binary file
|