@awsless/cli 0.0.21 → 0.0.23

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.js CHANGED
@@ -1179,7 +1179,7 @@ var LogRetentionSchema = DurationSchema.refine(
1179
1179
  (duration) => {
1180
1180
  return validLogRetentionDays.includes(toDays(duration));
1181
1181
  },
1182
- `Invalid log retention. Valid days are: ${validLogRetentionDays.map((days11) => `${days11}`).join(", ")}`
1182
+ `Invalid log retention. Valid days are: ${validLogRetentionDays.map((days12) => `${days12}`).join(", ")}`
1183
1183
  ).describe("The log retention duration.");
1184
1184
  var LogSchema = z15.union([
1185
1185
  z15.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
@@ -1399,70 +1399,41 @@ var PubSubSchema = z20.record(
1399
1399
  import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
1400
1400
  import { kibibytes } from "@awsless/size";
1401
1401
  import { z as z21 } from "zod";
1402
- var RetentionPeriodSchema = DurationSchema.refine(
1403
- durationMin(minutes2(1)),
1404
- "Minimum retention period is 1 minute"
1405
- ).refine(durationMax(days2(14)), "Maximum retention period is 14 days").describe(
1402
+ var RetentionPeriodSchema = DurationSchema.refine(durationMin(minutes2(1)), "Minimum retention period is 1 minute").refine(durationMax(days2(14)), "Maximum retention period is 14 days").describe(
1406
1403
  "The number of seconds that Amazon SQS retains a message. You can specify a duration from 1 minute to 14 days."
1407
1404
  );
1408
1405
  var VisibilityTimeoutSchema = DurationSchema.refine(
1409
1406
  durationMax(hours(12)),
1410
1407
  "Maximum visibility timeout is 12 hours"
1411
1408
  ).describe(
1412
- "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."
1413
- );
1414
- var DeliveryDelaySchema = DurationSchema.refine(
1415
- durationMax(minutes2(15)),
1416
- "Maximum delivery delay is 15 minutes"
1417
- ).describe(
1418
- "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."
1409
+ "The length of time during which a message will be unavailable after a message is delivered from the queue. You can specify a duration from 0 to 12 hours."
1419
1410
  );
1420
1411
  var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
1421
1412
  durationMin(seconds2(1)),
1422
1413
  "Minimum receive message wait time is 1 second"
1423
- ).refine(durationMax(seconds2(20)), "Maximum receive message wait time is 20 seconds").describe(
1424
- "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."
1425
- );
1426
- 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(
1427
- "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."
1428
- );
1429
- var BatchSizeSchema = z21.number().int().min(1, "Minimum batch size is 1").max(1e4, "Maximum batch size is 10000").describe(
1430
- "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."
1431
- );
1432
- var MaxConcurrencySchema = z21.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000").describe(
1433
- "Limits the number of concurrent instances that the queue worker can invoke. You can specify an integer from 2 to 1000."
1434
- );
1414
+ ).refine(durationMax(seconds2(20)), "Maximum receive message wait time is 20 seconds").describe("Long-polling wait time. You can specify a duration from 1 to 20 seconds.");
1415
+ 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("Message size limit. You can specify a size from 1 KB to 256 KB.");
1435
1416
  var MaxBatchingWindow = DurationSchema.refine(
1436
1417
  durationMax(minutes2(5)),
1437
1418
  "Maximum max batching window is 5 minutes"
1438
- ).describe(
1439
- "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."
1440
- );
1441
- var RetryAttemptsSchema3 = z21.number().int().min(0).max(999).describe(
1442
- "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 999."
1443
- );
1419
+ ).describe("How long Lambda gathers records before invoking the consumer. From 0 seconds to 5 minutes.");
1420
+ var BatchSizeSchema = z21.number().int().min(1, "Minimum batch size is 1").max(10, "FIFO queues support a maximum batch size of 10").describe("The maximum number of records per batch. FIFO queues are capped at 10.");
1444
1421
  var QueueDefaultSchema = z21.object({
1445
1422
  retentionPeriod: RetentionPeriodSchema.default("7 days"),
1446
- visibilityTimeout: VisibilityTimeoutSchema.default("30 seconds"),
1447
- deliveryDelay: DeliveryDelaySchema.default("0 seconds"),
1423
+ visibilityTimeout: VisibilityTimeoutSchema.default("2 minutes"),
1448
1424
  receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
1449
1425
  maxMessageSize: MaxMessageSizeSchema.default("256 KB"),
1450
1426
  batchSize: BatchSizeSchema.default(10),
1451
- maxConcurrency: MaxConcurrencySchema.optional(),
1452
- maxBatchingWindow: MaxBatchingWindow.optional(),
1453
- retryAttempts: RetryAttemptsSchema3.default(2)
1427
+ maxBatchingWindow: MaxBatchingWindow.optional()
1454
1428
  }).default({});
1455
1429
  var QueueSchema = z21.object({
1456
1430
  consumer: FunctionSchema.optional().describe("The consuming lambda function properties."),
1457
1431
  retentionPeriod: RetentionPeriodSchema.optional(),
1458
1432
  visibilityTimeout: VisibilityTimeoutSchema.optional(),
1459
- deliveryDelay: DeliveryDelaySchema.optional(),
1460
1433
  receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
1461
1434
  maxMessageSize: MaxMessageSizeSchema.optional(),
1462
1435
  batchSize: BatchSizeSchema.optional(),
1463
- maxConcurrency: MaxConcurrencySchema.optional(),
1464
- maxBatchingWindow: MaxBatchingWindow.optional(),
1465
- retryAttempts: RetryAttemptsSchema3.optional()
1436
+ maxBatchingWindow: MaxBatchingWindow.optional()
1466
1437
  });
1467
1438
  var QueuesSchema = z21.record(
1468
1439
  ResourceIdSchema,
@@ -1472,7 +1443,9 @@ var QueuesSchema = z21.record(
1472
1443
  })).pipe(QueueSchema),
1473
1444
  QueueSchema
1474
1445
  ])
1475
- ).optional().describe("Define the queues in your stack.");
1446
+ ).optional().describe(
1447
+ "Define the queues in your stack. Queues are FIFO with required per-message groupId: messages with the same groupId are processed strictly in order; different groupIds parallelize."
1448
+ );
1476
1449
 
1477
1450
  // src/feature/rest/schema.ts
1478
1451
  import { z as z23 } from "zod";
@@ -1792,7 +1765,7 @@ var LogRetentionSchema2 = DurationSchema.refine(
1792
1765
  (duration) => {
1793
1766
  return validLogRetentionDays2.includes(toDays2(duration));
1794
1767
  },
1795
- `Invalid log retention. Valid days are: ${validLogRetentionDays2.map((days11) => `${days11}`).join(", ")}`
1768
+ `Invalid log retention. Valid days are: ${validLogRetentionDays2.map((days12) => `${days12}`).join(", ")}`
1796
1769
  ).describe("The log retention duration.");
1797
1770
  var LogSchema2 = z26.union([
1798
1771
  z26.boolean().transform((enabled) => ({ retention: enabled ? days4(7) : days4(0) })),
@@ -1933,7 +1906,7 @@ var LogRetentionSchema3 = DurationSchema.refine(
1933
1906
  (duration) => {
1934
1907
  return validLogRetentionDays3.includes(toDays3(duration));
1935
1908
  },
1936
- `Invalid log retention. Valid days are: ${validLogRetentionDays3.map((days11) => `${days11}`).join(", ")}`
1909
+ `Invalid log retention. Valid days are: ${validLogRetentionDays3.map((days12) => `${days12}`).join(", ")}`
1937
1910
  ).describe("The log retention duration.");
1938
1911
  var LogSchema3 = z27.union([
1939
1912
  z27.boolean().transform((enabled) => ({ retention: enabled ? days5(7) : days5(0) })),
@@ -2181,7 +2154,7 @@ var CronExpressionSchema = z34.custom(
2181
2154
  var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
2182
2155
 
2183
2156
  // src/feature/cron/schema/index.ts
2184
- var RetryAttemptsSchema4 = z35.number().int().min(0).max(2).describe(
2157
+ var RetryAttemptsSchema3 = z35.number().int().min(0).max(2).describe(
2185
2158
  "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
2186
2159
  );
2187
2160
  var CronsSchema = z35.record(
@@ -2193,7 +2166,7 @@ var CronsSchema = z35.record(
2193
2166
  'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
2194
2167
  ),
2195
2168
  payload: z35.unknown().optional().describe("The JSON payload that will be passed to the consumer."),
2196
- retryAttempts: RetryAttemptsSchema4.default(2)
2169
+ retryAttempts: RetryAttemptsSchema3.default(2)
2197
2170
  })
2198
2171
  ).optional().describe(`Define the cron jobs in your stack.`);
2199
2172
 
@@ -3917,12 +3890,6 @@ var createLambdaFunction = (parentGroup, ctx, ns, id, local) => {
3917
3890
  });
3918
3891
  let dependsOn = [];
3919
3892
  if (props.vpc) {
3920
- if (props.warm > 1) {
3921
- throw new FileError(
3922
- "stackConfig" in ctx ? ctx.stackConfig.file : "app.json",
3923
- `We can't warm more then 1 lambda in a VPC.`
3924
- );
3925
- }
3926
3893
  dependsOn.push(
3927
3894
  new aws4.iam.RolePolicy(group, "vpc-policy", {
3928
3895
  role: role.name,
@@ -4015,6 +3982,9 @@ var createLambdaFunction = (parentGroup, ctx, ns, id, local) => {
4015
3982
  if ("stackConfig" in ctx) {
4016
3983
  variables.STACK = ctx.stackConfig.name;
4017
3984
  }
3985
+ if (props.vpc) {
3986
+ variables.AWS_USE_DUALSTACK_ENDPOINT = "true";
3987
+ }
4018
3988
  if (props.log.retention.value > 0n) {
4019
3989
  const logGroup = new aws4.cloudwatch.LogGroup(group, "log", {
4020
3990
  // name: lambda.functionName.pipe(name => `/aws/lambda/${name}`),
@@ -5194,16 +5164,22 @@ import { relative as relative5 } from "path";
5194
5164
  import { seconds as seconds7, toSeconds as toSeconds6 } from "@awsless/duration";
5195
5165
  import { toBytes } from "@awsless/size";
5196
5166
  var typeGenCode4 = `
5197
- import { SendMessageOptions, SendMessageBatchOptions, BatchItem } from '@awsless/sqs'
5167
+ import {
5168
+ SendMessageOptions,
5169
+ SendMessageBatchOptions,
5170
+ BatchItem,
5171
+ } from '@awsless/sqs'
5198
5172
  import type { Mock } from 'vitest'
5199
5173
 
5200
5174
  type Func = (...args: any[]) => any
5201
5175
  type Payload<F extends Func> = Parameters<F>[0]['Records'][number]['body']
5202
5176
 
5177
+ type Required<T> = T & { groupId: string; deduplicationId: string }
5178
+
5203
5179
  type Send<Name extends string, F extends Func> = {
5204
5180
  readonly name: Name
5205
- batch(items:BatchItem<Payload<F>>[], options?:Omit<SendMessageBatchOptions, 'queue' | 'items'>): Promise<void>
5206
- (payload: Payload<F>, options?: Omit<SendMessageOptions, 'queue' | 'payload'>): Promise<void>
5181
+ batch(items: Required<BatchItem<Payload<F>>>[], options?: Omit<SendMessageBatchOptions, 'queue' | 'items'>): Promise<void>
5182
+ (payload: Payload<F>, options: Required<Omit<SendMessageOptions, 'queue' | 'payload'>>): Promise<void>
5207
5183
  }
5208
5184
 
5209
5185
  type MockHandle<F extends Func> = (payload: Parameters<F>[0]) => void
@@ -5223,12 +5199,12 @@ var queueFeature = defineFeature({
5223
5199
  const mockResponse = new TypeObject(2);
5224
5200
  for (const [name, props] of Object.entries(stack.queues || {})) {
5225
5201
  const varName = camelCase5(`${stack.name}-${name}`);
5226
- const queueName = formatLocalResourceName({
5202
+ const queueName = `${formatLocalResourceName({
5227
5203
  appName: ctx.appConfig.name,
5228
5204
  stackName: stack.name,
5229
5205
  resourceType: "queue",
5230
5206
  resourceName: name
5231
- });
5207
+ })}.fifo`;
5232
5208
  if (typeof props === "object" && props.consumer && "file" in props.consumer.code) {
5233
5209
  const relFile = relative5(directories.types, props.consumer.code.file);
5234
5210
  gen.addImport(varName, relFile);
@@ -5251,32 +5227,25 @@ var queueFeature = defineFeature({
5251
5227
  gen.addInterface("QueueMockResponse", mockResponses);
5252
5228
  await ctx.write("queue.d.ts", gen, true);
5253
5229
  },
5254
- onApp(ctx) {
5255
- },
5256
5230
  onStack(ctx) {
5257
5231
  for (const [id, local] of Object.entries(ctx.stackConfig.queues || {})) {
5258
5232
  const props = deepmerge3(ctx.appConfig.defaults.queue, typeof local === "object" ? local : {});
5259
5233
  const group = new Group11(ctx.stack, "queue", id);
5260
- const name = formatLocalResourceName({
5234
+ const baseName = formatLocalResourceName({
5261
5235
  appName: ctx.app.name,
5262
5236
  stackName: ctx.stack.name,
5263
5237
  resourceType: "queue",
5264
5238
  resourceName: id
5265
5239
  });
5266
- const onFailure = ctx.shared.get("on-failure", "queue-arn");
5267
5240
  const queue2 = new aws12.sqs.Queue(group, "queue", {
5268
- name,
5269
- delaySeconds: toSeconds6(props.deliveryDelay),
5241
+ name: `${baseName}.fifo`,
5270
5242
  visibilityTimeoutSeconds: toSeconds6(props.visibilityTimeout),
5271
5243
  receiveWaitTimeSeconds: toSeconds6(props.receiveMessageWaitTime ?? seconds7(0)),
5272
5244
  messageRetentionSeconds: toSeconds6(props.retentionPeriod),
5273
5245
  maxMessageSize: toBytes(props.maxMessageSize),
5274
- redrivePolicy: onFailure.pipe(
5275
- (arn) => JSON.stringify({
5276
- deadLetterTargetArn: arn,
5277
- maxReceiveCount: props.retryAttempts + 1
5278
- })
5279
- )
5246
+ fifoQueue: true,
5247
+ deduplicationScope: "messageGroup",
5248
+ fifoThroughputLimit: "perMessageGroupId"
5280
5249
  });
5281
5250
  if (local.consumer) {
5282
5251
  const lambdaConsumer = createLambdaFunction(group, ctx, `queue`, id, local.consumer);
@@ -5288,10 +5257,7 @@ var queueFeature = defineFeature({
5288
5257
  functionName: lambdaConsumer.lambda.functionName,
5289
5258
  eventSourceArn: queue2.arn,
5290
5259
  batchSize: props.batchSize,
5291
- maximumBatchingWindowInSeconds: props.maxBatchingWindow && toSeconds6(props.maxBatchingWindow),
5292
- scalingConfig: {
5293
- maximumConcurrency: props.maxConcurrency
5294
- }
5260
+ maximumBatchingWindowInSeconds: props.maxBatchingWindow && toSeconds6(props.maxBatchingWindow)
5295
5261
  },
5296
5262
  {
5297
5263
  dependsOn: [lambdaConsumer.policy]
@@ -5299,7 +5265,6 @@ var queueFeature = defineFeature({
5299
5265
  );
5300
5266
  lambdaConsumer.addPermission({
5301
5267
  actions: [
5302
- //
5303
5268
  "sqs:ReceiveMessage",
5304
5269
  "sqs:DeleteMessage",
5305
5270
  "sqs:GetQueueAttributes"
@@ -7828,8 +7793,11 @@ var jobFeature = defineFeature({
7828
7793
  });
7829
7794
 
7830
7795
  // src/feature/instance/index.ts
7796
+ import { days as days10, seconds as seconds10, toSeconds as toSeconds11 } from "@awsless/duration";
7797
+ import { kibibytes as kibibytes2, toBytes as toBytes2 } from "@awsless/size";
7831
7798
  import { Group as Group28 } from "@terraforge/core";
7832
7799
  import { aws as aws29 } from "@terraforge/aws";
7800
+ import { constantCase as constantCase14 } from "change-case";
7833
7801
 
7834
7802
  // src/feature/instance/util.ts
7835
7803
  import { toDays as toDays11, toSeconds as toSeconds10 } from "@awsless/duration";
@@ -8225,12 +8193,40 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
8225
8193
  if ("permissions" in local && local.permissions) {
8226
8194
  statements.push(...local.permissions);
8227
8195
  }
8228
- return { name, task: task2, service, policy, code, group };
8196
+ return { name, task: task2, service, policy, code, group, addPermission };
8229
8197
  };
8230
8198
 
8231
8199
  // src/feature/instance/index.ts
8200
+ var typeGenCode11 = `
8201
+ import { SendMessageOptions } from '@awsless/sqs'
8202
+
8203
+ type Send<Name extends string> = {
8204
+ readonly name: Name
8205
+ (payload: unknown, options?: Omit<SendMessageOptions, 'queue' | 'payload' | 'groupId' | 'deduplicationId'>): Promise<void>
8206
+ }
8207
+ `;
8232
8208
  var instanceFeature = defineFeature({
8233
8209
  name: "instance",
8210
+ async onTypeGen(ctx) {
8211
+ const gen = new TypeFile("awsless");
8212
+ const resources2 = new TypeObject(1);
8213
+ for (const stack of ctx.stackConfigs) {
8214
+ const resource = new TypeObject(2);
8215
+ for (const name of Object.keys(stack.instances || {})) {
8216
+ const queueName = formatLocalResourceName({
8217
+ appName: ctx.appConfig.name,
8218
+ stackName: stack.name,
8219
+ resourceType: "instance",
8220
+ resourceName: name
8221
+ });
8222
+ resource.addType(name, `Send<'${queueName}'>`);
8223
+ }
8224
+ resources2.addType(stack.name, resource);
8225
+ }
8226
+ gen.addCode(typeGenCode11);
8227
+ gen.addInterface("InstanceResources", resources2);
8228
+ await ctx.write("instance.d.ts", gen, true);
8229
+ },
8234
8230
  onBefore(ctx) {
8235
8231
  const group = new Group28(ctx.base, "instance", "asset");
8236
8232
  const bucket = new aws29.s3.Bucket(group, "bucket", {
@@ -8268,7 +8264,29 @@ var instanceFeature = defineFeature({
8268
8264
  onStack(ctx) {
8269
8265
  for (const [id, props] of Object.entries(ctx.stackConfig.instances ?? {})) {
8270
8266
  const group = new Group28(ctx.stack, "instance", id);
8271
- createFargateTask(group, ctx, "instance", id, props);
8267
+ const task2 = createFargateTask(group, ctx, "instance", id, props);
8268
+ const queue2 = new aws29.sqs.Queue(group, "queue", {
8269
+ name: task2.name,
8270
+ visibilityTimeoutSeconds: toSeconds11(seconds10(30)),
8271
+ messageRetentionSeconds: toSeconds11(days10(4)),
8272
+ maxMessageSize: toBytes2(kibibytes2(256)),
8273
+ receiveWaitTimeSeconds: toSeconds11(seconds10(20))
8274
+ });
8275
+ task2.addPermission({
8276
+ actions: [
8277
+ "sqs:ReceiveMessage",
8278
+ "sqs:DeleteMessage",
8279
+ "sqs:ChangeMessageVisibility",
8280
+ "sqs:GetQueueAttributes",
8281
+ "sqs:GetQueueUrl"
8282
+ ],
8283
+ resources: [queue2.arn]
8284
+ });
8285
+ ctx.addStackPermission({
8286
+ actions: ["sqs:SendMessage", "sqs:GetQueueUrl", "sqs:GetQueueAttributes"],
8287
+ resources: [queue2.arn]
8288
+ });
8289
+ ctx.addEnv(`INSTANCE_${constantCase14(ctx.stackConfig.name)}_${constantCase14(id)}_URL`, queue2.url);
8272
8290
  }
8273
8291
  }
8274
8292
  });
@@ -8276,9 +8294,9 @@ var instanceFeature = defineFeature({
8276
8294
  // src/feature/metric/index.ts
8277
8295
  import { Group as Group29 } from "@terraforge/core";
8278
8296
  import { aws as aws30 } from "@terraforge/aws";
8279
- import { kebabCase as kebabCase8, constantCase as constantCase14 } from "change-case";
8280
- import { toSeconds as toSeconds11 } from "@awsless/duration";
8281
- var typeGenCode11 = `
8297
+ import { kebabCase as kebabCase8, constantCase as constantCase15 } from "change-case";
8298
+ import { toSeconds as toSeconds12 } from "@awsless/duration";
8299
+ var typeGenCode12 = `
8282
8300
  import { type PutDataProps, putData, batchPutData } from '@awsless/cloudwatch'
8283
8301
  import { type Duration } from '@awsless/duration'
8284
8302
  import { type Size } from '@awsless/size'
@@ -8326,7 +8344,7 @@ var metricFeature = defineFeature({
8326
8344
  resources2.addType(stack.name, stackResources);
8327
8345
  }
8328
8346
  resources2.addType("batch", "Batch");
8329
- gen.addCode(typeGenCode11);
8347
+ gen.addCode(typeGenCode12);
8330
8348
  gen.addInterface("MetricResources", resources2);
8331
8349
  await ctx.write("metric.d.ts", gen, true);
8332
8350
  },
@@ -8344,7 +8362,7 @@ var metricFeature = defineFeature({
8344
8362
  });
8345
8363
  for (const [id, props] of Object.entries(ctx.stackConfig.metrics ?? {})) {
8346
8364
  const group = new Group29(ctx.stack, "metric", id);
8347
- ctx.addEnv(`METRIC_${constantCase14(id)}`, props.type);
8365
+ ctx.addEnv(`METRIC_${constantCase15(id)}`, props.type);
8348
8366
  for (const alarmId in props.alarms ?? []) {
8349
8367
  const alarmGroup = new Group29(group, "alarm", alarmId);
8350
8368
  const alarmName = kebabCase8(`${id}-${alarmId}`);
@@ -8385,7 +8403,7 @@ var metricFeature = defineFeature({
8385
8403
  alarmDescription: alarmProps.description,
8386
8404
  statistic: alarmProps.where.stat,
8387
8405
  threshold: alarmProps.where.value,
8388
- period: toSeconds11(alarmProps.period),
8406
+ period: toSeconds12(alarmProps.period),
8389
8407
  evaluationPeriods: alarmProps.minDataPoints,
8390
8408
  comparisonOperator: alarmProps.where.op,
8391
8409
  alarmActions: [alarmAction]
@@ -8404,10 +8422,10 @@ var metricFeature = defineFeature({
8404
8422
  });
8405
8423
 
8406
8424
  // src/feature/router/index.ts
8407
- import { days as days10, seconds as seconds10, toSeconds as toSeconds12, years } from "@awsless/duration";
8425
+ import { days as days11, seconds as seconds11, toSeconds as toSeconds13, years } from "@awsless/duration";
8408
8426
  import { Future, Group as Group30 } from "@terraforge/core";
8409
8427
  import { aws as aws31 } from "@terraforge/aws";
8410
- import { camelCase as camelCase9, constantCase as constantCase15 } from "change-case";
8428
+ import { camelCase as camelCase9, constantCase as constantCase16 } from "change-case";
8411
8429
 
8412
8430
  // src/feature/router/router-code.ts
8413
8431
  var getViewerRequestFunctionCode = (props) => {
@@ -8698,9 +8716,9 @@ var routerFeature = defineFeature({
8698
8716
  });
8699
8717
  const cache = new aws31.cloudfront.CachePolicy(group, "cache", {
8700
8718
  name,
8701
- minTtl: toSeconds12(seconds10(0)),
8702
- maxTtl: toSeconds12(days10(365)),
8703
- defaultTtl: toSeconds12(days10(0)),
8719
+ minTtl: toSeconds13(seconds11(0)),
8720
+ maxTtl: toSeconds13(days11(365)),
8721
+ defaultTtl: toSeconds13(days11(0)),
8704
8722
  parametersInCacheKeyAndForwardedToOrigin: {
8705
8723
  enableAcceptEncodingBrotli: true,
8706
8724
  enableAcceptEncodingGzip: true,
@@ -8750,7 +8768,7 @@ var routerFeature = defineFeature({
8750
8768
  name,
8751
8769
  corsConfig: {
8752
8770
  originOverride: props.cors?.override ?? true,
8753
- accessControlMaxAgeSec: toSeconds12(props.cors?.maxAge ?? years(1)),
8771
+ accessControlMaxAgeSec: toSeconds13(props.cors?.maxAge ?? years(1)),
8754
8772
  accessControlAllowHeaders: { items: props.cors?.headers ?? ["*"] },
8755
8773
  accessControlAllowMethods: { items: props.cors?.methods ?? ["ALL"] },
8756
8774
  accessControlAllowOrigins: { items: props.cors?.origins ?? ["*"] },
@@ -8775,7 +8793,7 @@ var routerFeature = defineFeature({
8775
8793
  strictTransportSecurity: {
8776
8794
  override: true,
8777
8795
  preload: true,
8778
- accessControlMaxAgeSec: toSeconds12(years(1)),
8796
+ accessControlMaxAgeSec: toSeconds13(years(1)),
8779
8797
  includeSubdomains: true
8780
8798
  },
8781
8799
  xssProtection: {
@@ -8807,7 +8825,7 @@ var routerFeature = defineFeature({
8807
8825
  rateBasedStatement: {
8808
8826
  limit: wafSettingsConfig.rateLimiter.limit,
8809
8827
  aggregateKeyType: "IP",
8810
- evaluationWindowSec: toSeconds12(wafSettingsConfig.rateLimiter.window)
8828
+ evaluationWindowSec: toSeconds13(wafSettingsConfig.rateLimiter.window)
8811
8829
  }
8812
8830
  },
8813
8831
  action: {
@@ -8897,12 +8915,12 @@ var routerFeature = defineFeature({
8897
8915
  rule: wafRules,
8898
8916
  captchaConfig: {
8899
8917
  immunityTimeProperty: {
8900
- immunityTime: toSeconds12(wafSettingsConfig.captchaImmunityTime)
8918
+ immunityTime: toSeconds13(wafSettingsConfig.captchaImmunityTime)
8901
8919
  }
8902
8920
  },
8903
8921
  challengeConfig: {
8904
8922
  immunityTimeProperty: {
8905
- immunityTime: toSeconds12(wafSettingsConfig.challengeImmunityTime)
8923
+ immunityTime: toSeconds13(wafSettingsConfig.challengeImmunityTime)
8906
8924
  }
8907
8925
  },
8908
8926
  visibilityConfig: {
@@ -8958,7 +8976,7 @@ var routerFeature = defineFeature({
8958
8976
  }
8959
8977
  return {
8960
8978
  errorCode: Number(errorCode),
8961
- errorCachingMinTtl: item.minTTL ? toSeconds12(item.minTTL) : void 0,
8979
+ errorCachingMinTtl: item.minTTL ? toSeconds13(item.minTTL) : void 0,
8962
8980
  responseCode: item.statusCode?.toString() ?? errorCode,
8963
8981
  responsePagePath: item.path
8964
8982
  };
@@ -9045,7 +9063,7 @@ var routerFeature = defineFeature({
9045
9063
  evaluateTargetHealth: false
9046
9064
  }
9047
9065
  });
9048
- ctx.bind(`ROUTER_${constantCase15(id)}_ENDPOINT`, domainName);
9066
+ ctx.bind(`ROUTER_${constantCase16(id)}_ENDPOINT`, domainName);
9049
9067
  }
9050
9068
  }
9051
9069
  }
@@ -10985,7 +11003,7 @@ var auth = (program2) => {
10985
11003
  // src/cli/command/bind.ts
10986
11004
  import { log as log24 } from "@awsless/clui";
10987
11005
  import chalk4 from "chalk";
10988
- import { constantCase as constantCase16 } from "change-case";
11006
+ import { constantCase as constantCase17 } from "change-case";
10989
11007
  var bind = (program2) => {
10990
11008
  program2.command("bind").argument("[command...]", "The command to execute").option("--config <string...>", "List of config values that will be accessable", (v) => v.split(",")).description(`Bind your site environment variables to a command`).action(async (commands11 = [], opts) => {
10991
11009
  await layout("bind", async ({ appConfig, stackConfigs }) => {
@@ -11012,10 +11030,10 @@ var bind = (program2) => {
11012
11030
  const configList = opts.config ?? [];
11013
11031
  const configs = {};
11014
11032
  for (const name of configList) {
11015
- configs[`CONFIG_${constantCase16(name)}`] = name;
11033
+ configs[`CONFIG_${constantCase17(name)}`] = name;
11016
11034
  }
11017
11035
  if (configList.length ?? 0 > 0) {
11018
- log24.note("Bind Config", configList.map((v) => color.label(constantCase16(v))).join("\n"));
11036
+ log24.note("Bind Config", configList.map((v) => color.label(constantCase17(v))).join("\n"));
11019
11037
  }
11020
11038
  if (commands11.length === 0) {
11021
11039
  return "No command to execute.";
@@ -453,70 +453,41 @@ var PubSubSchema = z16.record(
453
453
  import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
454
454
  import { kibibytes } from "@awsless/size";
455
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(
456
+ var RetentionPeriodSchema = DurationSchema.refine(durationMin(minutes2(1)), "Minimum retention period is 1 minute").refine(durationMax(days2(14)), "Maximum retention period is 14 days").describe(
460
457
  "The number of seconds that Amazon SQS retains a message. You can specify a duration from 1 minute to 14 days."
461
458
  );
462
459
  var VisibilityTimeoutSchema = DurationSchema.refine(
463
460
  durationMax(hours(12)),
464
461
  "Maximum visibility timeout is 12 hours"
465
462
  ).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."
463
+ "The length of time during which a message will be unavailable after a message is delivered from the queue. You can specify a duration from 0 to 12 hours."
473
464
  );
474
465
  var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
475
466
  durationMin(seconds2(1)),
476
467
  "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
- );
468
+ ).refine(durationMax(seconds2(20)), "Maximum receive message wait time is 20 seconds").describe("Long-polling wait time. You can specify a duration from 1 to 20 seconds.");
469
+ 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("Message size limit. You can specify a size from 1 KB to 256 KB.");
489
470
  var MaxBatchingWindow = DurationSchema.refine(
490
471
  durationMax(minutes2(5)),
491
472
  "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
- );
473
+ ).describe("How long Lambda gathers records before invoking the consumer. From 0 seconds to 5 minutes.");
474
+ var BatchSizeSchema = z17.number().int().min(1, "Minimum batch size is 1").max(10, "FIFO queues support a maximum batch size of 10").describe("The maximum number of records per batch. FIFO queues are capped at 10.");
498
475
  var QueueDefaultSchema = z17.object({
499
476
  retentionPeriod: RetentionPeriodSchema.default("7 days"),
500
- visibilityTimeout: VisibilityTimeoutSchema.default("30 seconds"),
501
- deliveryDelay: DeliveryDelaySchema.default("0 seconds"),
477
+ visibilityTimeout: VisibilityTimeoutSchema.default("2 minutes"),
502
478
  receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
503
479
  maxMessageSize: MaxMessageSizeSchema.default("256 KB"),
504
480
  batchSize: BatchSizeSchema.default(10),
505
- maxConcurrency: MaxConcurrencySchema.optional(),
506
- maxBatchingWindow: MaxBatchingWindow.optional(),
507
- retryAttempts: RetryAttemptsSchema3.default(2)
481
+ maxBatchingWindow: MaxBatchingWindow.optional()
508
482
  }).default({});
509
483
  var QueueSchema = z17.object({
510
484
  consumer: FunctionSchema.optional().describe("The consuming lambda function properties."),
511
485
  retentionPeriod: RetentionPeriodSchema.optional(),
512
486
  visibilityTimeout: VisibilityTimeoutSchema.optional(),
513
- deliveryDelay: DeliveryDelaySchema.optional(),
514
487
  receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
515
488
  maxMessageSize: MaxMessageSizeSchema.optional(),
516
489
  batchSize: BatchSizeSchema.optional(),
517
- maxConcurrency: MaxConcurrencySchema.optional(),
518
- maxBatchingWindow: MaxBatchingWindow.optional(),
519
- retryAttempts: RetryAttemptsSchema3.optional()
490
+ maxBatchingWindow: MaxBatchingWindow.optional()
520
491
  });
521
492
  var QueuesSchema = z17.record(
522
493
  ResourceIdSchema,
@@ -526,7 +497,9 @@ var QueuesSchema = z17.record(
526
497
  })).pipe(QueueSchema),
527
498
  QueueSchema
528
499
  ])
529
- ).optional().describe("Define the queues in your stack.");
500
+ ).optional().describe(
501
+ "Define the queues in your stack. Queues are FIFO with required per-message groupId: messages with the same groupId are processed strictly in order; different groupIds parallelize."
502
+ );
530
503
 
531
504
  // src/feature/rest/schema.ts
532
505
  import { z as z19 } from "zod";
@@ -1235,7 +1208,7 @@ var CronExpressionSchema = z30.custom(
1235
1208
  var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
1236
1209
 
1237
1210
  // src/feature/cron/schema/index.ts
1238
- var RetryAttemptsSchema4 = z31.number().int().min(0).max(2).describe(
1211
+ var RetryAttemptsSchema3 = z31.number().int().min(0).max(2).describe(
1239
1212
  "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
1240
1213
  );
1241
1214
  var CronsSchema = z31.record(
@@ -1247,7 +1220,7 @@ var CronsSchema = z31.record(
1247
1220
  'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
1248
1221
  ),
1249
1222
  payload: z31.unknown().optional().describe("The JSON payload that will be passed to the consumer."),
1250
- retryAttempts: RetryAttemptsSchema4.default(2)
1223
+ retryAttempts: RetryAttemptsSchema3.default(2)
1251
1224
  })
1252
1225
  ).optional().describe(`Define the cron jobs in your stack.`);
1253
1226
 
Binary file
Binary file
Binary file
Binary file