@awsless/awsless 0.0.18 → 0.0.19
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/bin.cjs +75 -25
- package/dist/bin.js +75 -25
- package/dist/index.d.ts +199 -13
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -371,6 +371,7 @@ var Function = class extends Resource {
|
|
|
371
371
|
Timeout: this.props.timeout?.toSeconds() ?? 10,
|
|
372
372
|
Architectures: [this.props.architecture ?? "arm64"],
|
|
373
373
|
Role: this.role.arn,
|
|
374
|
+
...this.attr("ReservedConcurrentExecutions", this.props.reserved),
|
|
374
375
|
...this.props.code.toCodeJson(),
|
|
375
376
|
EphemeralStorage: {
|
|
376
377
|
Size: this.props.ephemeralStorageSize?.toMegaBytes() ?? 512
|
|
@@ -947,6 +948,7 @@ var hasOnFailure = (config) => {
|
|
|
947
948
|
var MemorySizeSchema = SizeSchema.refine(sizeMin(Size.megaBytes(128)), "Minimum memory size is 128 MB").refine(sizeMax(Size.gigaBytes(10)), "Minimum memory size is 10 GB");
|
|
948
949
|
var TimeoutSchema = DurationSchema.refine(durationMin(Duration.seconds(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(Duration.minutes(15)), "Maximum timeout duration is 15 minutes");
|
|
949
950
|
var EphemeralStorageSizeSchema = SizeSchema.refine(sizeMin(Size.megaBytes(512)), "Minimum ephemeral storage size is 512 MB").refine(sizeMax(Size.gigaBytes(10)), "Minimum ephemeral storage size is 10 GB");
|
|
951
|
+
var ReservedConcurrentExecutionsSchema = import_zod6.z.number().int().min(0);
|
|
950
952
|
var EnvironmentSchema = import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string()).optional();
|
|
951
953
|
var ArchitectureSchema = import_zod6.z.enum(["x86_64", "arm64"]);
|
|
952
954
|
var RetryAttemptsSchema = import_zod6.z.number().int().min(0).max(2);
|
|
@@ -989,6 +991,10 @@ var FunctionSchema = import_zod6.z.union([
|
|
|
989
991
|
* @default 2
|
|
990
992
|
*/
|
|
991
993
|
retryAttempts: RetryAttemptsSchema.optional(),
|
|
994
|
+
/** The number of simultaneous executions to reserve for the function.
|
|
995
|
+
* You can specify a number from 0.
|
|
996
|
+
*/
|
|
997
|
+
reserved: ReservedConcurrentExecutionsSchema.optional(),
|
|
992
998
|
/** Environment variable key-value pairs.
|
|
993
999
|
* @example
|
|
994
1000
|
* {
|
|
@@ -1034,6 +1040,10 @@ var schema = import_zod6.z.object({
|
|
|
1034
1040
|
* @default 2
|
|
1035
1041
|
*/
|
|
1036
1042
|
retryAttempts: RetryAttemptsSchema.default(2),
|
|
1043
|
+
/** The number of simultaneous executions to reserve for the function.
|
|
1044
|
+
* You can specify a number from 0.
|
|
1045
|
+
*/
|
|
1046
|
+
reserved: ReservedConcurrentExecutionsSchema.optional(),
|
|
1037
1047
|
/** Environment variable key-value pairs.
|
|
1038
1048
|
* @example
|
|
1039
1049
|
* {
|
|
@@ -1074,6 +1084,12 @@ var functionPlugin = definePlugin({
|
|
|
1074
1084
|
retryAttempts: props.retryAttempts,
|
|
1075
1085
|
onFailure: getGlobalOnFailure(ctx)
|
|
1076
1086
|
}).dependsOn(lambda);
|
|
1087
|
+
if (hasOnFailure(ctx.config)) {
|
|
1088
|
+
lambda.addPermissions({
|
|
1089
|
+
actions: ["sqs:SendMessage"],
|
|
1090
|
+
resources: [getGlobalOnFailure(ctx)]
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1077
1093
|
stack.add(invoke, lambda);
|
|
1078
1094
|
}
|
|
1079
1095
|
}
|
|
@@ -1168,7 +1184,7 @@ var cronPlugin = definePlugin({
|
|
|
1168
1184
|
name: "cron",
|
|
1169
1185
|
schema: import_zod7.z.object({
|
|
1170
1186
|
stacks: import_zod7.z.object({
|
|
1171
|
-
/** Define the crons in your stack
|
|
1187
|
+
/** Define the crons in your stack.
|
|
1172
1188
|
* @example
|
|
1173
1189
|
* {
|
|
1174
1190
|
* crons: {
|
|
@@ -1180,7 +1196,7 @@ var cronPlugin = definePlugin({
|
|
|
1180
1196
|
* }
|
|
1181
1197
|
* */
|
|
1182
1198
|
crons: import_zod7.z.record(ResourceIdSchema, import_zod7.z.object({
|
|
1183
|
-
/** The consuming lambda function properties */
|
|
1199
|
+
/** The consuming lambda function properties. */
|
|
1184
1200
|
consumer: FunctionSchema,
|
|
1185
1201
|
/** The scheduling expression.
|
|
1186
1202
|
* @example 'cron(0 20 * * ? *)'
|
|
@@ -1247,7 +1263,8 @@ var Queue = class extends Resource {
|
|
|
1247
1263
|
VisibilityTimeout: this.props.visibilityTimeout?.toSeconds() ?? 30,
|
|
1248
1264
|
...this.props.deadLetterArn ? {
|
|
1249
1265
|
RedrivePolicy: {
|
|
1250
|
-
deadLetterTargetArn: this.props.deadLetterArn
|
|
1266
|
+
deadLetterTargetArn: this.props.deadLetterArn,
|
|
1267
|
+
maxReceiveCount: this.props.maxReceiveCount ?? 100
|
|
1251
1268
|
}
|
|
1252
1269
|
} : {}
|
|
1253
1270
|
};
|
|
@@ -1303,8 +1320,7 @@ var SqsEventSource = class extends Group {
|
|
|
1303
1320
|
sourceArn: props.queueArn,
|
|
1304
1321
|
batchSize: props.batchSize ?? 10,
|
|
1305
1322
|
maxBatchingWindow: props.maxBatchingWindow,
|
|
1306
|
-
maxConcurrency: props.maxConcurrency
|
|
1307
|
-
onFailure: props.onFailure
|
|
1323
|
+
maxConcurrency: props.maxConcurrency
|
|
1308
1324
|
});
|
|
1309
1325
|
lambda.addPermissions({
|
|
1310
1326
|
actions: [
|
|
@@ -1319,6 +1335,14 @@ var SqsEventSource = class extends Group {
|
|
|
1319
1335
|
};
|
|
1320
1336
|
|
|
1321
1337
|
// src/plugins/queue.ts
|
|
1338
|
+
var RetentionPeriodSchema = DurationSchema.refine(durationMin(Duration.minutes(1)), "Minimum retention period is 1 minute").refine(durationMax(Duration.days(14)), "Maximum retention period is 14 days");
|
|
1339
|
+
var VisibilityTimeoutSchema = DurationSchema.refine(durationMax(Duration.hours(12)), "Maximum visibility timeout is 12 hours");
|
|
1340
|
+
var DeliveryDelaySchema = DurationSchema.refine(durationMax(Duration.minutes(15)), "Maximum delivery delay is 15 minutes");
|
|
1341
|
+
var ReceiveMessageWaitTimeSchema = DurationSchema.refine(durationMin(Duration.seconds(1)), "Minimum receive message wait time is 1 second").refine(durationMax(Duration.seconds(20)), "Maximum receive message wait time is 20 seconds");
|
|
1342
|
+
var MaxMessageSizeSchema = SizeSchema.refine(sizeMin(Size.kiloBytes(1)), "Minimum max message size is 1 KB").refine(sizeMax(Size.kiloBytes(256)), "Maximum max message size is 256 KB");
|
|
1343
|
+
var BatchSizeSchema = import_zod8.z.number().int().min(1, "Minimum batch size is 1").max(1e4, "Maximum batch size is 10000");
|
|
1344
|
+
var MaxConcurrencySchema = import_zod8.z.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000");
|
|
1345
|
+
var MaxBatchingWindow = DurationSchema.refine(durationMax(Duration.minutes(5)), "Maximum max batching window is 5 minutes");
|
|
1322
1346
|
var queuePlugin = definePlugin({
|
|
1323
1347
|
name: "queue",
|
|
1324
1348
|
schema: import_zod8.z.object({
|
|
@@ -1326,29 +1350,40 @@ var queuePlugin = definePlugin({
|
|
|
1326
1350
|
/** Define the defaults properties for all queue's in your app. */
|
|
1327
1351
|
queue: import_zod8.z.object({
|
|
1328
1352
|
/** The number of seconds that Amazon SQS retains a message.
|
|
1329
|
-
* You can specify a duration
|
|
1353
|
+
* You can specify a duration from 1 minute to 14 days.
|
|
1330
1354
|
* @default '7 days' */
|
|
1331
|
-
retentionPeriod:
|
|
1355
|
+
retentionPeriod: RetentionPeriodSchema.default("7 days"),
|
|
1332
1356
|
/** The length of time during which a message will be unavailable after a message is delivered from the queue.
|
|
1333
1357
|
* This blocks other components from receiving the same message and gives the initial component time to process and delete the message from the queue.
|
|
1334
|
-
* You can specify a duration
|
|
1358
|
+
* You can specify a duration from 0 to 12 hours.
|
|
1335
1359
|
* @default '30 seconds' */
|
|
1336
|
-
visibilityTimeout:
|
|
1360
|
+
visibilityTimeout: VisibilityTimeoutSchema.default("30 seconds"),
|
|
1337
1361
|
/** The time in seconds for which the delivery of all messages in the queue is delayed.
|
|
1338
|
-
* You can specify a duration
|
|
1362
|
+
* You can specify a duration from 0 to 15 minutes.
|
|
1339
1363
|
* @default '0 seconds' */
|
|
1340
|
-
deliveryDelay:
|
|
1364
|
+
deliveryDelay: DeliveryDelaySchema.default("0 seconds"),
|
|
1341
1365
|
/** Specifies the duration, in seconds,
|
|
1342
1366
|
* that the ReceiveMessage action call waits until a message is in the queue in order to include it in the response,
|
|
1343
1367
|
* rather than returning an empty response if a message isn't yet available.
|
|
1344
|
-
* You can specify
|
|
1345
|
-
*
|
|
1346
|
-
|
|
1347
|
-
receiveMessageWaitTime: DurationSchema.default("0 seconds"),
|
|
1368
|
+
* You can specify a duration from 1 to 20 seconds.
|
|
1369
|
+
* Short polling is used as the default. */
|
|
1370
|
+
receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
|
|
1348
1371
|
/** The limit of how many bytes that a message can contain before Amazon SQS rejects it.
|
|
1349
|
-
* You can specify an size
|
|
1372
|
+
* You can specify an size from 1 KB to 256 KB.
|
|
1350
1373
|
* @default '256 KB' */
|
|
1351
|
-
maxMessageSize:
|
|
1374
|
+
maxMessageSize: MaxMessageSizeSchema.default("256 KB"),
|
|
1375
|
+
/** The maximum number of records in each batch that Lambda pulls from your queue and sends to your function.
|
|
1376
|
+
* 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).
|
|
1377
|
+
* You can specify an integer from 1 to 10000.
|
|
1378
|
+
* @default 10 */
|
|
1379
|
+
batchSize: BatchSizeSchema.default(10),
|
|
1380
|
+
/** Limits the number of concurrent instances that the queue worker can invoke.
|
|
1381
|
+
* You can specify an integer from 2 to 1000. */
|
|
1382
|
+
maxConcurrency: MaxConcurrencySchema.optional(),
|
|
1383
|
+
/** The maximum amount of time, that Lambda spends gathering records before invoking the function.
|
|
1384
|
+
* You can specify an duration from 0 seconds to 5 minutes.
|
|
1385
|
+
* @default '0 seconds' */
|
|
1386
|
+
maxBatchingWindow: MaxBatchingWindow.optional()
|
|
1352
1387
|
}).default({})
|
|
1353
1388
|
}).default({}),
|
|
1354
1389
|
stacks: import_zod8.z.object({
|
|
@@ -1370,26 +1405,38 @@ var queuePlugin = definePlugin({
|
|
|
1370
1405
|
/** The number of seconds that Amazon SQS retains a message.
|
|
1371
1406
|
* You can specify a duration value from 1 minute to 14 days.
|
|
1372
1407
|
* @default '7 days' */
|
|
1373
|
-
retentionPeriod:
|
|
1408
|
+
retentionPeriod: RetentionPeriodSchema.optional(),
|
|
1374
1409
|
/** The length of time during which a message will be unavailable after a message is delivered from the queue.
|
|
1375
1410
|
* This blocks other components from receiving the same message and gives the initial component time to process and delete the message from the queue.
|
|
1376
1411
|
* You can specify a duration value from 0 to 12 hours.
|
|
1377
1412
|
* @default '30 seconds' */
|
|
1378
|
-
visibilityTimeout:
|
|
1413
|
+
visibilityTimeout: VisibilityTimeoutSchema.optional(),
|
|
1379
1414
|
/** The time in seconds for which the delivery of all messages in the queue is delayed.
|
|
1380
1415
|
* You can specify a duration value from 0 to 15 minutes.
|
|
1381
1416
|
* @default '0 seconds' */
|
|
1382
|
-
deliveryDelay:
|
|
1417
|
+
deliveryDelay: DeliveryDelaySchema.optional(),
|
|
1383
1418
|
/** Specifies the duration, in seconds,
|
|
1384
1419
|
* that the ReceiveMessage action call waits until a message is in the queue in order to include it in the response,
|
|
1385
1420
|
* rather than returning an empty response if a message isn't yet available.
|
|
1386
1421
|
* You can specify a duration value from 1 to 20 seconds.
|
|
1387
|
-
*
|
|
1388
|
-
receiveMessageWaitTime:
|
|
1422
|
+
* Short polling is used as the default. */
|
|
1423
|
+
receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
|
|
1389
1424
|
/** The limit of how many bytes that a message can contain before Amazon SQS rejects it.
|
|
1390
1425
|
* You can specify an size value from 1 KB to 256 KB.
|
|
1391
1426
|
* @default '256 KB' */
|
|
1392
|
-
maxMessageSize:
|
|
1427
|
+
maxMessageSize: MaxMessageSizeSchema.optional(),
|
|
1428
|
+
/** The maximum number of records in each batch that Lambda pulls from your queue and sends to your function.
|
|
1429
|
+
* 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).
|
|
1430
|
+
* You can specify an integer from 1 to 10000.
|
|
1431
|
+
* @default 10 */
|
|
1432
|
+
batchSize: BatchSizeSchema.optional(),
|
|
1433
|
+
/** Limits the number of concurrent instances that the queue worker can invoke.
|
|
1434
|
+
* You can specify an integer from 2 to 1000. */
|
|
1435
|
+
maxConcurrency: MaxConcurrencySchema.optional(),
|
|
1436
|
+
/** The maximum amount of time, that Lambda spends gathering records before invoking the function.
|
|
1437
|
+
* You can specify an duration from 0 seconds to 5 minutes.
|
|
1438
|
+
* @default '0 seconds' */
|
|
1439
|
+
maxBatchingWindow: MaxBatchingWindow.optional()
|
|
1393
1440
|
})
|
|
1394
1441
|
])
|
|
1395
1442
|
).optional()
|
|
@@ -1401,12 +1448,15 @@ var queuePlugin = definePlugin({
|
|
|
1401
1448
|
const props = typeof functionOrProps === "string" ? { ...config.defaults.queue, consumer: functionOrProps } : { ...config.defaults.queue, ...functionOrProps };
|
|
1402
1449
|
const queue2 = new Queue(id, {
|
|
1403
1450
|
name: `${config.name}-${stack.name}-${id}`,
|
|
1451
|
+
deadLetterArn: getGlobalOnFailure(ctx),
|
|
1404
1452
|
...props
|
|
1405
1453
|
});
|
|
1406
1454
|
const lambda = toLambdaFunction(ctx, `queue-${id}`, props.consumer);
|
|
1407
1455
|
const source = new SqsEventSource(id, lambda, {
|
|
1408
1456
|
queueArn: queue2.arn,
|
|
1409
|
-
|
|
1457
|
+
batchSize: props.batchSize,
|
|
1458
|
+
maxConcurrency: props.maxConcurrency,
|
|
1459
|
+
maxBatchingWindow: props.maxBatchingWindow
|
|
1410
1460
|
});
|
|
1411
1461
|
stack.add(queue2, lambda, source);
|
|
1412
1462
|
bind((lambda2) => {
|
|
@@ -2655,7 +2705,7 @@ var domainPlugin = definePlugin({
|
|
|
2655
2705
|
name: DomainNameSchema.optional(),
|
|
2656
2706
|
/** The DNS record type. */
|
|
2657
2707
|
type: import_zod15.z.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]),
|
|
2658
|
-
/** The resource record cache time to live (TTL) */
|
|
2708
|
+
/** The resource record cache time to live (TTL). */
|
|
2659
2709
|
ttl: DurationSchema,
|
|
2660
2710
|
/** One or more values that correspond with the value that you specified for the Type property. */
|
|
2661
2711
|
records: import_zod15.z.string().array()
|
package/dist/bin.js
CHANGED
|
@@ -351,6 +351,7 @@ var Function = class extends Resource {
|
|
|
351
351
|
Timeout: this.props.timeout?.toSeconds() ?? 10,
|
|
352
352
|
Architectures: [this.props.architecture ?? "arm64"],
|
|
353
353
|
Role: this.role.arn,
|
|
354
|
+
...this.attr("ReservedConcurrentExecutions", this.props.reserved),
|
|
354
355
|
...this.props.code.toCodeJson(),
|
|
355
356
|
EphemeralStorage: {
|
|
356
357
|
Size: this.props.ephemeralStorageSize?.toMegaBytes() ?? 512
|
|
@@ -924,6 +925,7 @@ var hasOnFailure = (config) => {
|
|
|
924
925
|
var MemorySizeSchema = SizeSchema.refine(sizeMin(Size.megaBytes(128)), "Minimum memory size is 128 MB").refine(sizeMax(Size.gigaBytes(10)), "Minimum memory size is 10 GB");
|
|
925
926
|
var TimeoutSchema = DurationSchema.refine(durationMin(Duration.seconds(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(Duration.minutes(15)), "Maximum timeout duration is 15 minutes");
|
|
926
927
|
var EphemeralStorageSizeSchema = SizeSchema.refine(sizeMin(Size.megaBytes(512)), "Minimum ephemeral storage size is 512 MB").refine(sizeMax(Size.gigaBytes(10)), "Minimum ephemeral storage size is 10 GB");
|
|
928
|
+
var ReservedConcurrentExecutionsSchema = z6.number().int().min(0);
|
|
927
929
|
var EnvironmentSchema = z6.record(z6.string(), z6.string()).optional();
|
|
928
930
|
var ArchitectureSchema = z6.enum(["x86_64", "arm64"]);
|
|
929
931
|
var RetryAttemptsSchema = z6.number().int().min(0).max(2);
|
|
@@ -966,6 +968,10 @@ var FunctionSchema = z6.union([
|
|
|
966
968
|
* @default 2
|
|
967
969
|
*/
|
|
968
970
|
retryAttempts: RetryAttemptsSchema.optional(),
|
|
971
|
+
/** The number of simultaneous executions to reserve for the function.
|
|
972
|
+
* You can specify a number from 0.
|
|
973
|
+
*/
|
|
974
|
+
reserved: ReservedConcurrentExecutionsSchema.optional(),
|
|
969
975
|
/** Environment variable key-value pairs.
|
|
970
976
|
* @example
|
|
971
977
|
* {
|
|
@@ -1011,6 +1017,10 @@ var schema = z6.object({
|
|
|
1011
1017
|
* @default 2
|
|
1012
1018
|
*/
|
|
1013
1019
|
retryAttempts: RetryAttemptsSchema.default(2),
|
|
1020
|
+
/** The number of simultaneous executions to reserve for the function.
|
|
1021
|
+
* You can specify a number from 0.
|
|
1022
|
+
*/
|
|
1023
|
+
reserved: ReservedConcurrentExecutionsSchema.optional(),
|
|
1014
1024
|
/** Environment variable key-value pairs.
|
|
1015
1025
|
* @example
|
|
1016
1026
|
* {
|
|
@@ -1051,6 +1061,12 @@ var functionPlugin = definePlugin({
|
|
|
1051
1061
|
retryAttempts: props.retryAttempts,
|
|
1052
1062
|
onFailure: getGlobalOnFailure(ctx)
|
|
1053
1063
|
}).dependsOn(lambda);
|
|
1064
|
+
if (hasOnFailure(ctx.config)) {
|
|
1065
|
+
lambda.addPermissions({
|
|
1066
|
+
actions: ["sqs:SendMessage"],
|
|
1067
|
+
resources: [getGlobalOnFailure(ctx)]
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1054
1070
|
stack.add(invoke, lambda);
|
|
1055
1071
|
}
|
|
1056
1072
|
}
|
|
@@ -1145,7 +1161,7 @@ var cronPlugin = definePlugin({
|
|
|
1145
1161
|
name: "cron",
|
|
1146
1162
|
schema: z7.object({
|
|
1147
1163
|
stacks: z7.object({
|
|
1148
|
-
/** Define the crons in your stack
|
|
1164
|
+
/** Define the crons in your stack.
|
|
1149
1165
|
* @example
|
|
1150
1166
|
* {
|
|
1151
1167
|
* crons: {
|
|
@@ -1157,7 +1173,7 @@ var cronPlugin = definePlugin({
|
|
|
1157
1173
|
* }
|
|
1158
1174
|
* */
|
|
1159
1175
|
crons: z7.record(ResourceIdSchema, z7.object({
|
|
1160
|
-
/** The consuming lambda function properties */
|
|
1176
|
+
/** The consuming lambda function properties. */
|
|
1161
1177
|
consumer: FunctionSchema,
|
|
1162
1178
|
/** The scheduling expression.
|
|
1163
1179
|
* @example 'cron(0 20 * * ? *)'
|
|
@@ -1224,7 +1240,8 @@ var Queue = class extends Resource {
|
|
|
1224
1240
|
VisibilityTimeout: this.props.visibilityTimeout?.toSeconds() ?? 30,
|
|
1225
1241
|
...this.props.deadLetterArn ? {
|
|
1226
1242
|
RedrivePolicy: {
|
|
1227
|
-
deadLetterTargetArn: this.props.deadLetterArn
|
|
1243
|
+
deadLetterTargetArn: this.props.deadLetterArn,
|
|
1244
|
+
maxReceiveCount: this.props.maxReceiveCount ?? 100
|
|
1228
1245
|
}
|
|
1229
1246
|
} : {}
|
|
1230
1247
|
};
|
|
@@ -1280,8 +1297,7 @@ var SqsEventSource = class extends Group {
|
|
|
1280
1297
|
sourceArn: props.queueArn,
|
|
1281
1298
|
batchSize: props.batchSize ?? 10,
|
|
1282
1299
|
maxBatchingWindow: props.maxBatchingWindow,
|
|
1283
|
-
maxConcurrency: props.maxConcurrency
|
|
1284
|
-
onFailure: props.onFailure
|
|
1300
|
+
maxConcurrency: props.maxConcurrency
|
|
1285
1301
|
});
|
|
1286
1302
|
lambda.addPermissions({
|
|
1287
1303
|
actions: [
|
|
@@ -1296,6 +1312,14 @@ var SqsEventSource = class extends Group {
|
|
|
1296
1312
|
};
|
|
1297
1313
|
|
|
1298
1314
|
// src/plugins/queue.ts
|
|
1315
|
+
var RetentionPeriodSchema = DurationSchema.refine(durationMin(Duration.minutes(1)), "Minimum retention period is 1 minute").refine(durationMax(Duration.days(14)), "Maximum retention period is 14 days");
|
|
1316
|
+
var VisibilityTimeoutSchema = DurationSchema.refine(durationMax(Duration.hours(12)), "Maximum visibility timeout is 12 hours");
|
|
1317
|
+
var DeliveryDelaySchema = DurationSchema.refine(durationMax(Duration.minutes(15)), "Maximum delivery delay is 15 minutes");
|
|
1318
|
+
var ReceiveMessageWaitTimeSchema = DurationSchema.refine(durationMin(Duration.seconds(1)), "Minimum receive message wait time is 1 second").refine(durationMax(Duration.seconds(20)), "Maximum receive message wait time is 20 seconds");
|
|
1319
|
+
var MaxMessageSizeSchema = SizeSchema.refine(sizeMin(Size.kiloBytes(1)), "Minimum max message size is 1 KB").refine(sizeMax(Size.kiloBytes(256)), "Maximum max message size is 256 KB");
|
|
1320
|
+
var BatchSizeSchema = z8.number().int().min(1, "Minimum batch size is 1").max(1e4, "Maximum batch size is 10000");
|
|
1321
|
+
var MaxConcurrencySchema = z8.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000");
|
|
1322
|
+
var MaxBatchingWindow = DurationSchema.refine(durationMax(Duration.minutes(5)), "Maximum max batching window is 5 minutes");
|
|
1299
1323
|
var queuePlugin = definePlugin({
|
|
1300
1324
|
name: "queue",
|
|
1301
1325
|
schema: z8.object({
|
|
@@ -1303,29 +1327,40 @@ var queuePlugin = definePlugin({
|
|
|
1303
1327
|
/** Define the defaults properties for all queue's in your app. */
|
|
1304
1328
|
queue: z8.object({
|
|
1305
1329
|
/** The number of seconds that Amazon SQS retains a message.
|
|
1306
|
-
* You can specify a duration
|
|
1330
|
+
* You can specify a duration from 1 minute to 14 days.
|
|
1307
1331
|
* @default '7 days' */
|
|
1308
|
-
retentionPeriod:
|
|
1332
|
+
retentionPeriod: RetentionPeriodSchema.default("7 days"),
|
|
1309
1333
|
/** The length of time during which a message will be unavailable after a message is delivered from the queue.
|
|
1310
1334
|
* This blocks other components from receiving the same message and gives the initial component time to process and delete the message from the queue.
|
|
1311
|
-
* You can specify a duration
|
|
1335
|
+
* You can specify a duration from 0 to 12 hours.
|
|
1312
1336
|
* @default '30 seconds' */
|
|
1313
|
-
visibilityTimeout:
|
|
1337
|
+
visibilityTimeout: VisibilityTimeoutSchema.default("30 seconds"),
|
|
1314
1338
|
/** The time in seconds for which the delivery of all messages in the queue is delayed.
|
|
1315
|
-
* You can specify a duration
|
|
1339
|
+
* You can specify a duration from 0 to 15 minutes.
|
|
1316
1340
|
* @default '0 seconds' */
|
|
1317
|
-
deliveryDelay:
|
|
1341
|
+
deliveryDelay: DeliveryDelaySchema.default("0 seconds"),
|
|
1318
1342
|
/** Specifies the duration, in seconds,
|
|
1319
1343
|
* that the ReceiveMessage action call waits until a message is in the queue in order to include it in the response,
|
|
1320
1344
|
* rather than returning an empty response if a message isn't yet available.
|
|
1321
|
-
* You can specify
|
|
1322
|
-
*
|
|
1323
|
-
|
|
1324
|
-
receiveMessageWaitTime: DurationSchema.default("0 seconds"),
|
|
1345
|
+
* You can specify a duration from 1 to 20 seconds.
|
|
1346
|
+
* Short polling is used as the default. */
|
|
1347
|
+
receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
|
|
1325
1348
|
/** The limit of how many bytes that a message can contain before Amazon SQS rejects it.
|
|
1326
|
-
* You can specify an size
|
|
1349
|
+
* You can specify an size from 1 KB to 256 KB.
|
|
1327
1350
|
* @default '256 KB' */
|
|
1328
|
-
maxMessageSize:
|
|
1351
|
+
maxMessageSize: MaxMessageSizeSchema.default("256 KB"),
|
|
1352
|
+
/** The maximum number of records in each batch that Lambda pulls from your queue and sends to your function.
|
|
1353
|
+
* 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).
|
|
1354
|
+
* You can specify an integer from 1 to 10000.
|
|
1355
|
+
* @default 10 */
|
|
1356
|
+
batchSize: BatchSizeSchema.default(10),
|
|
1357
|
+
/** Limits the number of concurrent instances that the queue worker can invoke.
|
|
1358
|
+
* You can specify an integer from 2 to 1000. */
|
|
1359
|
+
maxConcurrency: MaxConcurrencySchema.optional(),
|
|
1360
|
+
/** The maximum amount of time, that Lambda spends gathering records before invoking the function.
|
|
1361
|
+
* You can specify an duration from 0 seconds to 5 minutes.
|
|
1362
|
+
* @default '0 seconds' */
|
|
1363
|
+
maxBatchingWindow: MaxBatchingWindow.optional()
|
|
1329
1364
|
}).default({})
|
|
1330
1365
|
}).default({}),
|
|
1331
1366
|
stacks: z8.object({
|
|
@@ -1347,26 +1382,38 @@ var queuePlugin = definePlugin({
|
|
|
1347
1382
|
/** The number of seconds that Amazon SQS retains a message.
|
|
1348
1383
|
* You can specify a duration value from 1 minute to 14 days.
|
|
1349
1384
|
* @default '7 days' */
|
|
1350
|
-
retentionPeriod:
|
|
1385
|
+
retentionPeriod: RetentionPeriodSchema.optional(),
|
|
1351
1386
|
/** The length of time during which a message will be unavailable after a message is delivered from the queue.
|
|
1352
1387
|
* This blocks other components from receiving the same message and gives the initial component time to process and delete the message from the queue.
|
|
1353
1388
|
* You can specify a duration value from 0 to 12 hours.
|
|
1354
1389
|
* @default '30 seconds' */
|
|
1355
|
-
visibilityTimeout:
|
|
1390
|
+
visibilityTimeout: VisibilityTimeoutSchema.optional(),
|
|
1356
1391
|
/** The time in seconds for which the delivery of all messages in the queue is delayed.
|
|
1357
1392
|
* You can specify a duration value from 0 to 15 minutes.
|
|
1358
1393
|
* @default '0 seconds' */
|
|
1359
|
-
deliveryDelay:
|
|
1394
|
+
deliveryDelay: DeliveryDelaySchema.optional(),
|
|
1360
1395
|
/** Specifies the duration, in seconds,
|
|
1361
1396
|
* that the ReceiveMessage action call waits until a message is in the queue in order to include it in the response,
|
|
1362
1397
|
* rather than returning an empty response if a message isn't yet available.
|
|
1363
1398
|
* You can specify a duration value from 1 to 20 seconds.
|
|
1364
|
-
*
|
|
1365
|
-
receiveMessageWaitTime:
|
|
1399
|
+
* Short polling is used as the default. */
|
|
1400
|
+
receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
|
|
1366
1401
|
/** The limit of how many bytes that a message can contain before Amazon SQS rejects it.
|
|
1367
1402
|
* You can specify an size value from 1 KB to 256 KB.
|
|
1368
1403
|
* @default '256 KB' */
|
|
1369
|
-
maxMessageSize:
|
|
1404
|
+
maxMessageSize: MaxMessageSizeSchema.optional(),
|
|
1405
|
+
/** The maximum number of records in each batch that Lambda pulls from your queue and sends to your function.
|
|
1406
|
+
* 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).
|
|
1407
|
+
* You can specify an integer from 1 to 10000.
|
|
1408
|
+
* @default 10 */
|
|
1409
|
+
batchSize: BatchSizeSchema.optional(),
|
|
1410
|
+
/** Limits the number of concurrent instances that the queue worker can invoke.
|
|
1411
|
+
* You can specify an integer from 2 to 1000. */
|
|
1412
|
+
maxConcurrency: MaxConcurrencySchema.optional(),
|
|
1413
|
+
/** The maximum amount of time, that Lambda spends gathering records before invoking the function.
|
|
1414
|
+
* You can specify an duration from 0 seconds to 5 minutes.
|
|
1415
|
+
* @default '0 seconds' */
|
|
1416
|
+
maxBatchingWindow: MaxBatchingWindow.optional()
|
|
1370
1417
|
})
|
|
1371
1418
|
])
|
|
1372
1419
|
).optional()
|
|
@@ -1378,12 +1425,15 @@ var queuePlugin = definePlugin({
|
|
|
1378
1425
|
const props = typeof functionOrProps === "string" ? { ...config.defaults.queue, consumer: functionOrProps } : { ...config.defaults.queue, ...functionOrProps };
|
|
1379
1426
|
const queue2 = new Queue(id, {
|
|
1380
1427
|
name: `${config.name}-${stack.name}-${id}`,
|
|
1428
|
+
deadLetterArn: getGlobalOnFailure(ctx),
|
|
1381
1429
|
...props
|
|
1382
1430
|
});
|
|
1383
1431
|
const lambda = toLambdaFunction(ctx, `queue-${id}`, props.consumer);
|
|
1384
1432
|
const source = new SqsEventSource(id, lambda, {
|
|
1385
1433
|
queueArn: queue2.arn,
|
|
1386
|
-
|
|
1434
|
+
batchSize: props.batchSize,
|
|
1435
|
+
maxConcurrency: props.maxConcurrency,
|
|
1436
|
+
maxBatchingWindow: props.maxBatchingWindow
|
|
1387
1437
|
});
|
|
1388
1438
|
stack.add(queue2, lambda, source);
|
|
1389
1439
|
bind((lambda2) => {
|
|
@@ -2632,7 +2682,7 @@ var domainPlugin = definePlugin({
|
|
|
2632
2682
|
name: DomainNameSchema.optional(),
|
|
2633
2683
|
/** The DNS record type. */
|
|
2634
2684
|
type: z15.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]),
|
|
2635
|
-
/** The resource record cache time to live (TTL) */
|
|
2685
|
+
/** The resource record cache time to live (TTL). */
|
|
2636
2686
|
ttl: DurationSchema,
|
|
2637
2687
|
/** One or more values that correspond with the value that you specified for the Type property. */
|
|
2638
2688
|
records: z15.string().array()
|