@awsless/awsless 0.0.435 → 0.0.437
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 +293 -172
- package/dist/build-json-schema.js +162 -138
- package/dist/prebuild/rpc/HASH +1 -1
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/stack.json +1 -1
- package/package.json +12 -12
|
@@ -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,61 @@ 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
|
+
minify: true,
|
|
212
|
+
external: []
|
|
213
|
+
})),
|
|
214
|
+
FileCodeSchema,
|
|
215
|
+
BundleCodeSchema
|
|
216
|
+
]).describe("Specify the code of your function.");
|
|
217
|
+
var FnSchema = z6.object({
|
|
218
|
+
code: CodeSchema,
|
|
193
219
|
// node
|
|
194
220
|
handler: HandlerSchema.optional(),
|
|
195
|
-
build: BuildSchema.optional(),
|
|
221
|
+
// build: BuildSchema.optional(),
|
|
222
|
+
// bundle: BundleSchema.optional(),
|
|
196
223
|
// container
|
|
197
224
|
// ...
|
|
198
225
|
runtime: RuntimeSchema.optional(),
|
|
@@ -210,20 +237,25 @@ var FnSchema = z5.object({
|
|
|
210
237
|
environment: EnvironmentSchema.optional(),
|
|
211
238
|
permissions: PermissionsSchema.optional()
|
|
212
239
|
});
|
|
213
|
-
var FunctionSchema =
|
|
240
|
+
var FunctionSchema = z6.union([
|
|
214
241
|
LocalFileSchema.transform((file) => ({
|
|
215
|
-
|
|
242
|
+
code: {
|
|
243
|
+
file,
|
|
244
|
+
minify: true,
|
|
245
|
+
external: []
|
|
246
|
+
}
|
|
216
247
|
})),
|
|
217
248
|
FnSchema
|
|
218
249
|
]);
|
|
219
|
-
var FunctionsSchema =
|
|
220
|
-
var FunctionDefaultSchema =
|
|
250
|
+
var FunctionsSchema = z6.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
|
|
251
|
+
var FunctionDefaultSchema = z6.object({
|
|
221
252
|
runtime: RuntimeSchema.default("nodejs20.x"),
|
|
222
253
|
// node
|
|
223
254
|
handler: HandlerSchema.default("index.default"),
|
|
224
|
-
build: BuildSchema.default({
|
|
225
|
-
|
|
226
|
-
|
|
255
|
+
// build: BuildSchema.default({
|
|
256
|
+
// type: 'simple',
|
|
257
|
+
// minify: true,
|
|
258
|
+
// }),
|
|
227
259
|
// container
|
|
228
260
|
warm: WarmSchema.default(0),
|
|
229
261
|
vpc: VPCSchema.default(false),
|
|
@@ -245,11 +277,11 @@ var FunctionDefaultSchema = z5.object({
|
|
|
245
277
|
}).default({});
|
|
246
278
|
|
|
247
279
|
// src/config/schema/email.ts
|
|
248
|
-
import { z as
|
|
249
|
-
var EmailSchema =
|
|
280
|
+
import { z as z7 } from "zod";
|
|
281
|
+
var EmailSchema = z7.string().email();
|
|
250
282
|
|
|
251
283
|
// src/feature/auth/schema.ts
|
|
252
|
-
var TriggersSchema =
|
|
284
|
+
var TriggersSchema = z8.object({
|
|
253
285
|
beforeToken: FunctionSchema.optional().describe("A pre jwt token generation AWS Lambda trigger."),
|
|
254
286
|
beforeLogin: FunctionSchema.optional().describe("A pre user login AWS Lambda trigger."),
|
|
255
287
|
afterLogin: FunctionSchema.optional().describe("A post user login AWS Lambda trigger."),
|
|
@@ -262,42 +294,42 @@ var TriggersSchema = z7.object({
|
|
|
262
294
|
createChallenge: FunctionSchema.optional().describe("Creates an authentication challenge."),
|
|
263
295
|
verifyChallenge: FunctionSchema.optional().describe("Verifies the authentication challenge response.")
|
|
264
296
|
}).describe("Specifies the configuration for AWS Lambda triggers.");
|
|
265
|
-
var AuthSchema =
|
|
297
|
+
var AuthSchema = z8.record(
|
|
266
298
|
ResourceIdSchema,
|
|
267
|
-
|
|
268
|
-
access:
|
|
299
|
+
z8.object({
|
|
300
|
+
access: z8.boolean().default(false).describe("Give access to every function in this stack to your cognito instance."),
|
|
269
301
|
triggers: TriggersSchema.optional()
|
|
270
302
|
})
|
|
271
303
|
).optional().describe("Define the auth triggers in your stack.");
|
|
272
|
-
var AuthDefaultSchema =
|
|
304
|
+
var AuthDefaultSchema = z8.record(
|
|
273
305
|
ResourceIdSchema,
|
|
274
|
-
|
|
275
|
-
allowUserRegistration:
|
|
276
|
-
messaging:
|
|
306
|
+
z8.object({
|
|
307
|
+
allowUserRegistration: z8.boolean().default(true).describe("Specifies whether users can create an user account or if only the administrator can."),
|
|
308
|
+
messaging: z8.object({
|
|
277
309
|
fromEmail: EmailSchema.describe("Specifies the sender's email address."),
|
|
278
|
-
fromName:
|
|
310
|
+
fromName: z8.string().optional().describe("Specifies the sender's name."),
|
|
279
311
|
replyTo: EmailSchema.optional().describe(
|
|
280
312
|
"The destination to which the receiver of the email should reply."
|
|
281
313
|
)
|
|
282
314
|
}).optional().describe("The email configuration for sending messages."),
|
|
283
315
|
// secret: z.boolean().default(false).describe('Specifies whether you want to generate a client secret.'),
|
|
284
|
-
username:
|
|
285
|
-
emailAlias:
|
|
286
|
-
caseSensitive:
|
|
316
|
+
username: z8.object({
|
|
317
|
+
emailAlias: z8.boolean().default(true).describe("Allow the user email to be used as username."),
|
|
318
|
+
caseSensitive: z8.boolean().default(false).describe(
|
|
287
319
|
"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
320
|
)
|
|
289
321
|
}).default({}).describe("The username policy."),
|
|
290
|
-
password:
|
|
291
|
-
minLength:
|
|
292
|
-
uppercase:
|
|
293
|
-
lowercase:
|
|
294
|
-
numbers:
|
|
295
|
-
symbols:
|
|
322
|
+
password: z8.object({
|
|
323
|
+
minLength: z8.number().int().min(6).max(99).default(12).describe("Required users to have at least the minimum password length."),
|
|
324
|
+
uppercase: z8.boolean().default(true).describe("Required users to use at least one uppercase letter in their password."),
|
|
325
|
+
lowercase: z8.boolean().default(true).describe("Required users to use at least one lowercase letter in their password."),
|
|
326
|
+
numbers: z8.boolean().default(true).describe("Required users to use at least one number in their password."),
|
|
327
|
+
symbols: z8.boolean().default(true).describe("Required users to use at least one symbol in their password."),
|
|
296
328
|
temporaryPasswordValidity: DurationSchema.default("7 days").describe(
|
|
297
329
|
"The duration a temporary password is valid. If the user doesn't sign in during this time, an administrator must reset their password."
|
|
298
330
|
)
|
|
299
331
|
}).default({}).describe("The password policy."),
|
|
300
|
-
validity:
|
|
332
|
+
validity: z8.object({
|
|
301
333
|
idToken: DurationSchema.default("1 hour").describe(
|
|
302
334
|
"The ID token time limit. After this limit expires, your user can't use their ID token."
|
|
303
335
|
),
|
|
@@ -313,8 +345,8 @@ var AuthDefaultSchema = z7.record(
|
|
|
313
345
|
).default({}).describe("Define the authenticatable users in your app.");
|
|
314
346
|
|
|
315
347
|
// src/feature/cache/schema.ts
|
|
316
|
-
import { z as
|
|
317
|
-
var TypeSchema =
|
|
348
|
+
import { z as z9 } from "zod";
|
|
349
|
+
var TypeSchema = z9.enum([
|
|
318
350
|
"t4g.small",
|
|
319
351
|
"t4g.medium",
|
|
320
352
|
"r6g.large",
|
|
@@ -329,29 +361,29 @@ var TypeSchema = z8.enum([
|
|
|
329
361
|
"r6gd.4xlarge",
|
|
330
362
|
"r6gd.8xlarge"
|
|
331
363
|
]);
|
|
332
|
-
var PortSchema =
|
|
333
|
-
var ShardsSchema =
|
|
334
|
-
var ReplicasPerShardSchema =
|
|
335
|
-
var EngineSchema =
|
|
336
|
-
var CachesSchema =
|
|
364
|
+
var PortSchema = z9.number().int().min(1).max(5e4);
|
|
365
|
+
var ShardsSchema = z9.number().int().min(0).max(100);
|
|
366
|
+
var ReplicasPerShardSchema = z9.number().int().min(0).max(5);
|
|
367
|
+
var EngineSchema = z9.enum(["7.0", "6.2"]);
|
|
368
|
+
var CachesSchema = z9.record(
|
|
337
369
|
ResourceIdSchema,
|
|
338
|
-
|
|
370
|
+
z9.object({
|
|
339
371
|
type: TypeSchema.default("t4g.small"),
|
|
340
372
|
port: PortSchema.default(6379),
|
|
341
373
|
shards: ShardsSchema.default(1),
|
|
342
374
|
replicasPerShard: ReplicasPerShardSchema.default(1),
|
|
343
375
|
engine: EngineSchema.default("7.0"),
|
|
344
|
-
dataTiering:
|
|
376
|
+
dataTiering: z9.boolean().default(false)
|
|
345
377
|
})
|
|
346
378
|
).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
|
|
347
379
|
|
|
348
380
|
// src/feature/command/schema.ts
|
|
349
|
-
import { z as
|
|
350
|
-
var CommandSchema =
|
|
351
|
-
|
|
381
|
+
import { z as z10 } from "zod";
|
|
382
|
+
var CommandSchema = z10.union([
|
|
383
|
+
z10.object({
|
|
352
384
|
file: LocalFileSchema,
|
|
353
|
-
handler:
|
|
354
|
-
description:
|
|
385
|
+
handler: z10.string().default("default").describe("The name of the handler that needs to run"),
|
|
386
|
+
description: z10.string().optional().describe("A description of the command")
|
|
355
387
|
// options: z.record(ResourceIdSchema, OptionSchema).optional(),
|
|
356
388
|
// arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
|
|
357
389
|
}),
|
|
@@ -361,22 +393,22 @@ var CommandSchema = z9.union([
|
|
|
361
393
|
description: void 0
|
|
362
394
|
}))
|
|
363
395
|
]);
|
|
364
|
-
var CommandsSchema =
|
|
396
|
+
var CommandsSchema = z10.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
|
|
365
397
|
|
|
366
398
|
// src/feature/config/schema.ts
|
|
367
|
-
import { z as
|
|
368
|
-
var ConfigNameSchema =
|
|
369
|
-
var ConfigsSchema =
|
|
399
|
+
import { z as z11 } from "zod";
|
|
400
|
+
var ConfigNameSchema = z11.string().regex(/[a-z0-9\-]/g, "Invalid config name");
|
|
401
|
+
var ConfigsSchema = z11.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
|
|
370
402
|
|
|
371
403
|
// src/feature/cron/schema/index.ts
|
|
372
|
-
import { z as
|
|
404
|
+
import { z as z13 } from "zod";
|
|
373
405
|
|
|
374
406
|
// src/feature/cron/schema/schedule.ts
|
|
375
|
-
import { z as
|
|
407
|
+
import { z as z12 } from "zod";
|
|
376
408
|
import { awsCronExpressionValidator } from "aws-cron-expression-validator";
|
|
377
|
-
var RateExpressionSchema =
|
|
409
|
+
var RateExpressionSchema = z12.custom(
|
|
378
410
|
(value) => {
|
|
379
|
-
return
|
|
411
|
+
return z12.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
|
|
380
412
|
const [str] = rate.split(" ");
|
|
381
413
|
const number = parseInt(str);
|
|
382
414
|
return number > 0;
|
|
@@ -392,9 +424,9 @@ var RateExpressionSchema = z11.custom(
|
|
|
392
424
|
}
|
|
393
425
|
return `rate(${rate})`;
|
|
394
426
|
});
|
|
395
|
-
var CronExpressionSchema =
|
|
427
|
+
var CronExpressionSchema = z12.custom(
|
|
396
428
|
(value) => {
|
|
397
|
-
return
|
|
429
|
+
return z12.string().safeParse(value).success;
|
|
398
430
|
},
|
|
399
431
|
{ message: "Invalid cron expression" }
|
|
400
432
|
).superRefine((value, ctx) => {
|
|
@@ -403,12 +435,12 @@ var CronExpressionSchema = z11.custom(
|
|
|
403
435
|
} catch (error) {
|
|
404
436
|
if (error instanceof Error) {
|
|
405
437
|
ctx.addIssue({
|
|
406
|
-
code:
|
|
438
|
+
code: z12.ZodIssueCode.custom,
|
|
407
439
|
message: `Invalid cron expression: ${error.message}`
|
|
408
440
|
});
|
|
409
441
|
} else {
|
|
410
442
|
ctx.addIssue({
|
|
411
|
-
code:
|
|
443
|
+
code: z12.ZodIssueCode.custom,
|
|
412
444
|
message: "Invalid cron expression"
|
|
413
445
|
});
|
|
414
446
|
}
|
|
@@ -419,31 +451,31 @@ var CronExpressionSchema = z11.custom(
|
|
|
419
451
|
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
420
452
|
|
|
421
453
|
// src/feature/cron/schema/index.ts
|
|
422
|
-
var CronsSchema =
|
|
454
|
+
var CronsSchema = z13.record(
|
|
423
455
|
ResourceIdSchema,
|
|
424
|
-
|
|
425
|
-
enabled:
|
|
456
|
+
z13.object({
|
|
457
|
+
enabled: z13.boolean().default(true).describe("If the cron is enabled."),
|
|
426
458
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
427
459
|
schedule: ScheduleExpressionSchema.describe(
|
|
428
460
|
'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
|
|
429
461
|
),
|
|
430
|
-
payload:
|
|
462
|
+
payload: z13.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
|
|
431
463
|
})
|
|
432
464
|
).optional().describe(`Define the cron jobs in your stack.`);
|
|
433
465
|
|
|
434
466
|
// src/feature/graphql/schema.ts
|
|
435
|
-
import { z as
|
|
467
|
+
import { z as z14 } from "zod";
|
|
436
468
|
var AuthorizerTtl = DurationSchema.describe(
|
|
437
469
|
`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
470
|
);
|
|
439
|
-
var GraphQLDefaultSchema =
|
|
471
|
+
var GraphQLDefaultSchema = z14.record(
|
|
440
472
|
ResourceIdSchema,
|
|
441
|
-
|
|
473
|
+
z14.object({
|
|
442
474
|
domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
|
|
443
|
-
subDomain:
|
|
444
|
-
auth:
|
|
475
|
+
subDomain: z14.string().optional(),
|
|
476
|
+
auth: z14.union([
|
|
445
477
|
ResourceIdSchema,
|
|
446
|
-
|
|
478
|
+
z14.object({
|
|
447
479
|
authorizer: FunctionSchema,
|
|
448
480
|
ttl: AuthorizerTtl.default("1 hour")
|
|
449
481
|
})
|
|
@@ -455,22 +487,22 @@ var GraphQLDefaultSchema = z13.record(
|
|
|
455
487
|
resolver: LocalFileSchema.optional()
|
|
456
488
|
})
|
|
457
489
|
).describe(`Define the global GraphQL API's.`).optional();
|
|
458
|
-
var GraphQLSchema =
|
|
490
|
+
var GraphQLSchema = z14.record(
|
|
459
491
|
ResourceIdSchema,
|
|
460
|
-
|
|
492
|
+
z14.object({
|
|
461
493
|
// schema: z.union([LocalFileSchema.transform(v => [v]), z.array(LocalFileSchema).min(1)]).optional(),
|
|
462
494
|
schema: LocalFileSchema.describe("The graphql schema file."),
|
|
463
|
-
resolvers:
|
|
495
|
+
resolvers: z14.record(
|
|
464
496
|
// TypeName
|
|
465
|
-
|
|
466
|
-
|
|
497
|
+
z14.string(),
|
|
498
|
+
z14.record(
|
|
467
499
|
// FieldName
|
|
468
|
-
|
|
469
|
-
|
|
500
|
+
z14.string(),
|
|
501
|
+
z14.union([
|
|
470
502
|
FunctionSchema.transform((consumer) => ({
|
|
471
503
|
consumer
|
|
472
504
|
})),
|
|
473
|
-
|
|
505
|
+
z14.object({
|
|
474
506
|
consumer: FunctionSchema,
|
|
475
507
|
resolver: LocalFileSchema.optional()
|
|
476
508
|
})
|
|
@@ -481,34 +513,20 @@ var GraphQLSchema = z13.record(
|
|
|
481
513
|
).describe("Define the schema & resolvers in your stack for your global GraphQL API.").optional();
|
|
482
514
|
|
|
483
515
|
// src/feature/http/schema.ts
|
|
484
|
-
import { z as
|
|
485
|
-
var RouteSchema =
|
|
486
|
-
var HttpDefaultSchema =
|
|
516
|
+
import { z as z15 } from "zod";
|
|
517
|
+
var RouteSchema = z15.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route").transform((v) => v);
|
|
518
|
+
var HttpDefaultSchema = z15.record(
|
|
487
519
|
ResourceIdSchema,
|
|
488
|
-
|
|
520
|
+
z15.object({
|
|
489
521
|
domain: ResourceIdSchema.describe("The domain id to link your API with."),
|
|
490
|
-
subDomain:
|
|
522
|
+
subDomain: z15.string().optional()
|
|
491
523
|
// auth: ResourceIdSchema.optional(),
|
|
492
524
|
})
|
|
493
525
|
).optional().describe("Define your global HTTP API's.");
|
|
494
|
-
var HttpSchema =
|
|
526
|
+
var HttpSchema = z15.record(ResourceIdSchema, z15.record(RouteSchema, FunctionSchema)).optional().describe("Define routes in your stack for your global HTTP API.");
|
|
495
527
|
|
|
496
528
|
// src/feature/instance/schema.ts
|
|
497
529
|
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
530
|
var ImageSchema = z16.string().regex(/^ami\-[0-9a-f]+/).describe("The ID of the AMI.");
|
|
513
531
|
var TypeSchema2 = z16.enum([
|
|
514
532
|
"t3.nano",
|
|
@@ -529,7 +547,7 @@ var TypeSchema2 = z16.enum([
|
|
|
529
547
|
"g4dn.xlarge"
|
|
530
548
|
]).describe(`The instance type.`);
|
|
531
549
|
var CommandSchema2 = z16.string().describe(`The script you want to execute when the instance starts up.`);
|
|
532
|
-
var
|
|
550
|
+
var CodeSchema2 = LocalDirectorySchema.describe(`The code directory that will be deployed to your instance.`);
|
|
533
551
|
var ConnectSchema = z16.boolean().describe("Allows you to connect to all instances with an Instance Connect Endpoint.");
|
|
534
552
|
var EnvironmentSchema2 = z16.record(z16.string(), z16.string()).optional().describe("Environment variable key-value pairs.");
|
|
535
553
|
var ActionSchema2 = z16.string();
|
|
@@ -552,7 +570,7 @@ var InstancesSchema = z16.record(
|
|
|
552
570
|
z16.object({
|
|
553
571
|
image: ImageSchema,
|
|
554
572
|
type: TypeSchema2,
|
|
555
|
-
code:
|
|
573
|
+
code: CodeSchema2,
|
|
556
574
|
user: z16.string().default("ec2-user"),
|
|
557
575
|
command: CommandSchema2.optional(),
|
|
558
576
|
environment: EnvironmentSchema2.optional(),
|
|
@@ -1048,7 +1066,13 @@ var RetryAttemptsSchema2 = z27.number().int().min(0).max(2).describe(
|
|
|
1048
1066
|
);
|
|
1049
1067
|
var TaskSchema = z27.union([
|
|
1050
1068
|
LocalFileSchema.transform((file) => ({
|
|
1051
|
-
consumer: {
|
|
1069
|
+
consumer: {
|
|
1070
|
+
code: {
|
|
1071
|
+
file,
|
|
1072
|
+
minify: true,
|
|
1073
|
+
external: []
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1052
1076
|
retryAttempts: void 0
|
|
1053
1077
|
})),
|
|
1054
1078
|
z27.object({
|
package/dist/prebuild/rpc/HASH
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
78731c42d1c2b6ee145a017c2f6c37bee4d55851
|
|
Binary file
|