@awsless/cli 0.0.22 → 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
 
@@ -5191,16 +5164,22 @@ import { relative as relative5 } from "path";
5191
5164
  import { seconds as seconds7, toSeconds as toSeconds6 } from "@awsless/duration";
5192
5165
  import { toBytes } from "@awsless/size";
5193
5166
  var typeGenCode4 = `
5194
- import { SendMessageOptions, SendMessageBatchOptions, BatchItem } from '@awsless/sqs'
5167
+ import {
5168
+ SendMessageOptions,
5169
+ SendMessageBatchOptions,
5170
+ BatchItem,
5171
+ } from '@awsless/sqs'
5195
5172
  import type { Mock } from 'vitest'
5196
5173
 
5197
5174
  type Func = (...args: any[]) => any
5198
5175
  type Payload<F extends Func> = Parameters<F>[0]['Records'][number]['body']
5199
5176
 
5177
+ type Required<T> = T & { groupId: string; deduplicationId: string }
5178
+
5200
5179
  type Send<Name extends string, F extends Func> = {
5201
5180
  readonly name: Name
5202
- batch(items:BatchItem<Payload<F>>[], options?:Omit<SendMessageBatchOptions, 'queue' | 'items'>): Promise<void>
5203
- (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>
5204
5183
  }
5205
5184
 
5206
5185
  type MockHandle<F extends Func> = (payload: Parameters<F>[0]) => void
@@ -5220,12 +5199,12 @@ var queueFeature = defineFeature({
5220
5199
  const mockResponse = new TypeObject(2);
5221
5200
  for (const [name, props] of Object.entries(stack.queues || {})) {
5222
5201
  const varName = camelCase5(`${stack.name}-${name}`);
5223
- const queueName = formatLocalResourceName({
5202
+ const queueName = `${formatLocalResourceName({
5224
5203
  appName: ctx.appConfig.name,
5225
5204
  stackName: stack.name,
5226
5205
  resourceType: "queue",
5227
5206
  resourceName: name
5228
- });
5207
+ })}.fifo`;
5229
5208
  if (typeof props === "object" && props.consumer && "file" in props.consumer.code) {
5230
5209
  const relFile = relative5(directories.types, props.consumer.code.file);
5231
5210
  gen.addImport(varName, relFile);
@@ -5248,32 +5227,25 @@ var queueFeature = defineFeature({
5248
5227
  gen.addInterface("QueueMockResponse", mockResponses);
5249
5228
  await ctx.write("queue.d.ts", gen, true);
5250
5229
  },
5251
- onApp(ctx) {
5252
- },
5253
5230
  onStack(ctx) {
5254
5231
  for (const [id, local] of Object.entries(ctx.stackConfig.queues || {})) {
5255
5232
  const props = deepmerge3(ctx.appConfig.defaults.queue, typeof local === "object" ? local : {});
5256
5233
  const group = new Group11(ctx.stack, "queue", id);
5257
- const name = formatLocalResourceName({
5234
+ const baseName = formatLocalResourceName({
5258
5235
  appName: ctx.app.name,
5259
5236
  stackName: ctx.stack.name,
5260
5237
  resourceType: "queue",
5261
5238
  resourceName: id
5262
5239
  });
5263
- const onFailure = ctx.shared.get("on-failure", "queue-arn");
5264
5240
  const queue2 = new aws12.sqs.Queue(group, "queue", {
5265
- name,
5266
- delaySeconds: toSeconds6(props.deliveryDelay),
5241
+ name: `${baseName}.fifo`,
5267
5242
  visibilityTimeoutSeconds: toSeconds6(props.visibilityTimeout),
5268
5243
  receiveWaitTimeSeconds: toSeconds6(props.receiveMessageWaitTime ?? seconds7(0)),
5269
5244
  messageRetentionSeconds: toSeconds6(props.retentionPeriod),
5270
5245
  maxMessageSize: toBytes(props.maxMessageSize),
5271
- redrivePolicy: onFailure.pipe(
5272
- (arn) => JSON.stringify({
5273
- deadLetterTargetArn: arn,
5274
- maxReceiveCount: props.retryAttempts + 1
5275
- })
5276
- )
5246
+ fifoQueue: true,
5247
+ deduplicationScope: "messageGroup",
5248
+ fifoThroughputLimit: "perMessageGroupId"
5277
5249
  });
5278
5250
  if (local.consumer) {
5279
5251
  const lambdaConsumer = createLambdaFunction(group, ctx, `queue`, id, local.consumer);
@@ -5285,10 +5257,7 @@ var queueFeature = defineFeature({
5285
5257
  functionName: lambdaConsumer.lambda.functionName,
5286
5258
  eventSourceArn: queue2.arn,
5287
5259
  batchSize: props.batchSize,
5288
- maximumBatchingWindowInSeconds: props.maxBatchingWindow && toSeconds6(props.maxBatchingWindow),
5289
- scalingConfig: {
5290
- maximumConcurrency: props.maxConcurrency
5291
- }
5260
+ maximumBatchingWindowInSeconds: props.maxBatchingWindow && toSeconds6(props.maxBatchingWindow)
5292
5261
  },
5293
5262
  {
5294
5263
  dependsOn: [lambdaConsumer.policy]
@@ -5296,7 +5265,6 @@ var queueFeature = defineFeature({
5296
5265
  );
5297
5266
  lambdaConsumer.addPermission({
5298
5267
  actions: [
5299
- //
5300
5268
  "sqs:ReceiveMessage",
5301
5269
  "sqs:DeleteMessage",
5302
5270
  "sqs:GetQueueAttributes"
@@ -7825,8 +7793,11 @@ var jobFeature = defineFeature({
7825
7793
  });
7826
7794
 
7827
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";
7828
7798
  import { Group as Group28 } from "@terraforge/core";
7829
7799
  import { aws as aws29 } from "@terraforge/aws";
7800
+ import { constantCase as constantCase14 } from "change-case";
7830
7801
 
7831
7802
  // src/feature/instance/util.ts
7832
7803
  import { toDays as toDays11, toSeconds as toSeconds10 } from "@awsless/duration";
@@ -8222,12 +8193,40 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
8222
8193
  if ("permissions" in local && local.permissions) {
8223
8194
  statements.push(...local.permissions);
8224
8195
  }
8225
- return { name, task: task2, service, policy, code, group };
8196
+ return { name, task: task2, service, policy, code, group, addPermission };
8226
8197
  };
8227
8198
 
8228
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
+ `;
8229
8208
  var instanceFeature = defineFeature({
8230
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
+ },
8231
8230
  onBefore(ctx) {
8232
8231
  const group = new Group28(ctx.base, "instance", "asset");
8233
8232
  const bucket = new aws29.s3.Bucket(group, "bucket", {
@@ -8265,7 +8264,29 @@ var instanceFeature = defineFeature({
8265
8264
  onStack(ctx) {
8266
8265
  for (const [id, props] of Object.entries(ctx.stackConfig.instances ?? {})) {
8267
8266
  const group = new Group28(ctx.stack, "instance", id);
8268
- 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);
8269
8290
  }
8270
8291
  }
8271
8292
  });
@@ -8273,9 +8294,9 @@ var instanceFeature = defineFeature({
8273
8294
  // src/feature/metric/index.ts
8274
8295
  import { Group as Group29 } from "@terraforge/core";
8275
8296
  import { aws as aws30 } from "@terraforge/aws";
8276
- import { kebabCase as kebabCase8, constantCase as constantCase14 } from "change-case";
8277
- import { toSeconds as toSeconds11 } from "@awsless/duration";
8278
- var typeGenCode11 = `
8297
+ import { kebabCase as kebabCase8, constantCase as constantCase15 } from "change-case";
8298
+ import { toSeconds as toSeconds12 } from "@awsless/duration";
8299
+ var typeGenCode12 = `
8279
8300
  import { type PutDataProps, putData, batchPutData } from '@awsless/cloudwatch'
8280
8301
  import { type Duration } from '@awsless/duration'
8281
8302
  import { type Size } from '@awsless/size'
@@ -8323,7 +8344,7 @@ var metricFeature = defineFeature({
8323
8344
  resources2.addType(stack.name, stackResources);
8324
8345
  }
8325
8346
  resources2.addType("batch", "Batch");
8326
- gen.addCode(typeGenCode11);
8347
+ gen.addCode(typeGenCode12);
8327
8348
  gen.addInterface("MetricResources", resources2);
8328
8349
  await ctx.write("metric.d.ts", gen, true);
8329
8350
  },
@@ -8341,7 +8362,7 @@ var metricFeature = defineFeature({
8341
8362
  });
8342
8363
  for (const [id, props] of Object.entries(ctx.stackConfig.metrics ?? {})) {
8343
8364
  const group = new Group29(ctx.stack, "metric", id);
8344
- ctx.addEnv(`METRIC_${constantCase14(id)}`, props.type);
8365
+ ctx.addEnv(`METRIC_${constantCase15(id)}`, props.type);
8345
8366
  for (const alarmId in props.alarms ?? []) {
8346
8367
  const alarmGroup = new Group29(group, "alarm", alarmId);
8347
8368
  const alarmName = kebabCase8(`${id}-${alarmId}`);
@@ -8382,7 +8403,7 @@ var metricFeature = defineFeature({
8382
8403
  alarmDescription: alarmProps.description,
8383
8404
  statistic: alarmProps.where.stat,
8384
8405
  threshold: alarmProps.where.value,
8385
- period: toSeconds11(alarmProps.period),
8406
+ period: toSeconds12(alarmProps.period),
8386
8407
  evaluationPeriods: alarmProps.minDataPoints,
8387
8408
  comparisonOperator: alarmProps.where.op,
8388
8409
  alarmActions: [alarmAction]
@@ -8401,10 +8422,10 @@ var metricFeature = defineFeature({
8401
8422
  });
8402
8423
 
8403
8424
  // src/feature/router/index.ts
8404
- 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";
8405
8426
  import { Future, Group as Group30 } from "@terraforge/core";
8406
8427
  import { aws as aws31 } from "@terraforge/aws";
8407
- import { camelCase as camelCase9, constantCase as constantCase15 } from "change-case";
8428
+ import { camelCase as camelCase9, constantCase as constantCase16 } from "change-case";
8408
8429
 
8409
8430
  // src/feature/router/router-code.ts
8410
8431
  var getViewerRequestFunctionCode = (props) => {
@@ -8695,9 +8716,9 @@ var routerFeature = defineFeature({
8695
8716
  });
8696
8717
  const cache = new aws31.cloudfront.CachePolicy(group, "cache", {
8697
8718
  name,
8698
- minTtl: toSeconds12(seconds10(0)),
8699
- maxTtl: toSeconds12(days10(365)),
8700
- defaultTtl: toSeconds12(days10(0)),
8719
+ minTtl: toSeconds13(seconds11(0)),
8720
+ maxTtl: toSeconds13(days11(365)),
8721
+ defaultTtl: toSeconds13(days11(0)),
8701
8722
  parametersInCacheKeyAndForwardedToOrigin: {
8702
8723
  enableAcceptEncodingBrotli: true,
8703
8724
  enableAcceptEncodingGzip: true,
@@ -8747,7 +8768,7 @@ var routerFeature = defineFeature({
8747
8768
  name,
8748
8769
  corsConfig: {
8749
8770
  originOverride: props.cors?.override ?? true,
8750
- accessControlMaxAgeSec: toSeconds12(props.cors?.maxAge ?? years(1)),
8771
+ accessControlMaxAgeSec: toSeconds13(props.cors?.maxAge ?? years(1)),
8751
8772
  accessControlAllowHeaders: { items: props.cors?.headers ?? ["*"] },
8752
8773
  accessControlAllowMethods: { items: props.cors?.methods ?? ["ALL"] },
8753
8774
  accessControlAllowOrigins: { items: props.cors?.origins ?? ["*"] },
@@ -8772,7 +8793,7 @@ var routerFeature = defineFeature({
8772
8793
  strictTransportSecurity: {
8773
8794
  override: true,
8774
8795
  preload: true,
8775
- accessControlMaxAgeSec: toSeconds12(years(1)),
8796
+ accessControlMaxAgeSec: toSeconds13(years(1)),
8776
8797
  includeSubdomains: true
8777
8798
  },
8778
8799
  xssProtection: {
@@ -8804,7 +8825,7 @@ var routerFeature = defineFeature({
8804
8825
  rateBasedStatement: {
8805
8826
  limit: wafSettingsConfig.rateLimiter.limit,
8806
8827
  aggregateKeyType: "IP",
8807
- evaluationWindowSec: toSeconds12(wafSettingsConfig.rateLimiter.window)
8828
+ evaluationWindowSec: toSeconds13(wafSettingsConfig.rateLimiter.window)
8808
8829
  }
8809
8830
  },
8810
8831
  action: {
@@ -8894,12 +8915,12 @@ var routerFeature = defineFeature({
8894
8915
  rule: wafRules,
8895
8916
  captchaConfig: {
8896
8917
  immunityTimeProperty: {
8897
- immunityTime: toSeconds12(wafSettingsConfig.captchaImmunityTime)
8918
+ immunityTime: toSeconds13(wafSettingsConfig.captchaImmunityTime)
8898
8919
  }
8899
8920
  },
8900
8921
  challengeConfig: {
8901
8922
  immunityTimeProperty: {
8902
- immunityTime: toSeconds12(wafSettingsConfig.challengeImmunityTime)
8923
+ immunityTime: toSeconds13(wafSettingsConfig.challengeImmunityTime)
8903
8924
  }
8904
8925
  },
8905
8926
  visibilityConfig: {
@@ -8955,7 +8976,7 @@ var routerFeature = defineFeature({
8955
8976
  }
8956
8977
  return {
8957
8978
  errorCode: Number(errorCode),
8958
- errorCachingMinTtl: item.minTTL ? toSeconds12(item.minTTL) : void 0,
8979
+ errorCachingMinTtl: item.minTTL ? toSeconds13(item.minTTL) : void 0,
8959
8980
  responseCode: item.statusCode?.toString() ?? errorCode,
8960
8981
  responsePagePath: item.path
8961
8982
  };
@@ -9042,7 +9063,7 @@ var routerFeature = defineFeature({
9042
9063
  evaluateTargetHealth: false
9043
9064
  }
9044
9065
  });
9045
- ctx.bind(`ROUTER_${constantCase15(id)}_ENDPOINT`, domainName);
9066
+ ctx.bind(`ROUTER_${constantCase16(id)}_ENDPOINT`, domainName);
9046
9067
  }
9047
9068
  }
9048
9069
  }
@@ -10982,7 +11003,7 @@ var auth = (program2) => {
10982
11003
  // src/cli/command/bind.ts
10983
11004
  import { log as log24 } from "@awsless/clui";
10984
11005
  import chalk4 from "chalk";
10985
- import { constantCase as constantCase16 } from "change-case";
11006
+ import { constantCase as constantCase17 } from "change-case";
10986
11007
  var bind = (program2) => {
10987
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) => {
10988
11009
  await layout("bind", async ({ appConfig, stackConfigs }) => {
@@ -11009,10 +11030,10 @@ var bind = (program2) => {
11009
11030
  const configList = opts.config ?? [];
11010
11031
  const configs = {};
11011
11032
  for (const name of configList) {
11012
- configs[`CONFIG_${constantCase16(name)}`] = name;
11033
+ configs[`CONFIG_${constantCase17(name)}`] = name;
11013
11034
  }
11014
11035
  if (configList.length ?? 0 > 0) {
11015
- 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"));
11016
11037
  }
11017
11038
  if (commands11.length === 0) {
11018
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