@awsless/awsless 0.0.472 → 0.0.473

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
@@ -1271,7 +1271,8 @@ var SitesSchema = z28.record(
1271
1271
  static: z28.union([LocalDirectorySchema, z28.boolean()]).optional().describe(
1272
1272
  "Specifies the path to the static files directory. Additionally you can also pass `true` when you don't have local static files, but still want to make an S3 bucket."
1273
1273
  ),
1274
- ssr: FunctionSchema.optional().describe("Specifies the ssr file."),
1274
+ ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server."),
1275
+ // envPrefix: z.string().optional().describe('Specifies a prefix for all '),
1275
1276
  origin: z28.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
1276
1277
  // bind: z.object({
1277
1278
  // auth:
@@ -1412,6 +1413,7 @@ var StoresSchema = z29.union([
1412
1413
  ]).optional().describe("Define the stores in your stack.");
1413
1414
 
1414
1415
  // src/feature/table/schema.ts
1416
+ import { minutes as minutes4, seconds as seconds4 } from "@awsless/duration";
1415
1417
  import { z as z30 } from "zod";
1416
1418
  var KeySchema = z30.string().min(1).max(255);
1417
1419
  var TablesSchema = z30.record(
@@ -1428,13 +1430,68 @@ var TablesSchema = z30.record(
1428
1430
  ),
1429
1431
  class: z30.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
1430
1432
  pointInTimeRecovery: z30.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
1431
- timeToLiveAttribute: KeySchema.optional().describe(
1432
- "The name of the TTL attribute used to store the expiration time for items in the table. To update this property, you must first disable TTL and then enable TTL with the new attribute name."
1433
+ ttl: KeySchema.optional().describe(
1434
+ [
1435
+ "The name of the TTL attribute used to store the expiration time for items in the table.",
1436
+ "To update this property, you must first disable TTL and then enable TTL with the new attribute name."
1437
+ ].join("\n")
1433
1438
  ),
1434
1439
  // deletionProtection: DeletionProtectionSchema.optional(),
1435
1440
  stream: z30.object({
1436
1441
  type: z30.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
1437
- "When an item in the table is modified, stream.type determines what information is written to the stream for this table. Valid values are:\n- keys-only - Only the key attributes of the modified item are written to the stream.\n- new-image - The entire item, as it appears after it was modified, is written to the stream.\n- old-image - The entire item, as it appeared before it was modified, is written to the stream.\n- new-and-old-images - Both the new and the old item images of the item are written to the stream."
1442
+ [
1443
+ "When an item in the table is modified, you can determines what information is written to the stream for this table.",
1444
+ "Valid values are:",
1445
+ "- keys-only - Only the key attributes of the modified item are written to the stream.",
1446
+ "- new-image - The entire item, as it appears after it was modified, is written to the stream.",
1447
+ "- old-image - The entire item, as it appeared before it was modified, is written to the stream.",
1448
+ "- new-and-old-images - Both the new and the old item images of the item are written to the stream."
1449
+ ].join("\n")
1450
+ ),
1451
+ batchSize: z30.number().min(1).max(1e4).default(1).describe(
1452
+ [
1453
+ "The maximum number of records in each batch that Lambda pulls from your stream and sends to your function.",
1454
+ "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).",
1455
+ "You can specify a number from 1 to 10000."
1456
+ ].join("\n")
1457
+ ),
1458
+ batchWindow: DurationSchema.refine(
1459
+ durationMin(seconds4(1)),
1460
+ "Minimum batch window duration is 1 second"
1461
+ ).refine(durationMax(minutes4(5)), "Maximum batch window duration is 5 minutes").optional().describe(
1462
+ [
1463
+ "The maximum amount of time that is spend gathering records before invoking the function.",
1464
+ "You can specify a duration from 1 seconds to 5 minutes."
1465
+ ].join("\n")
1466
+ ),
1467
+ // maxRecordAge: DurationSchema.refine(
1468
+ // durationMin(seconds(1)),
1469
+ // 'Minimum record age duration is 1 second'
1470
+ // )
1471
+ // .refine(durationMax(minutes(5)), 'Maximum batch window duration is 5 minutes')
1472
+ // .optional()
1473
+ // .describe(
1474
+ // [
1475
+ // 'Discard records after the specified number of retries.',
1476
+ // 'The default value is -1, which sets the maximum number of retries to infinite.',
1477
+ // 'When maxRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.',
1478
+ // 'You can specify a number from -1 to 10000.',
1479
+ // ].join('\n')
1480
+ // ),
1481
+ retryAttempts: z30.number().min(-1).max(1e4).default(-1).describe(
1482
+ [
1483
+ "Discard records after the specified number of retries.",
1484
+ "The default value is -1, which sets the maximum number of retries to infinite.",
1485
+ "When maxRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.",
1486
+ "You can specify a number from -1 to 10000."
1487
+ ].join("\n")
1488
+ ),
1489
+ concurrencyPerShard: z30.number().min(1).max(10).default(1).describe(
1490
+ [
1491
+ "The number of batches to process concurrently from each shard.",
1492
+ "The default value is 1.",
1493
+ "You can specify a number from 1 to 10."
1494
+ ].join("\n")
1438
1495
  ),
1439
1496
  consumer: FunctionSchema.describe("The consuming lambda function for the stream")
1440
1497
  }).optional().describe(
@@ -2901,7 +2958,7 @@ var cronFeature = defineFeature({
2901
2958
  });
2902
2959
 
2903
2960
  // src/feature/domain/index.ts
2904
- import { minutes as minutes4, toSeconds as toSeconds2 } from "@awsless/duration";
2961
+ import { minutes as minutes5, toSeconds as toSeconds2 } from "@awsless/duration";
2905
2962
  import { $ as $5, Group as Group5 } from "@awsless/formation";
2906
2963
  var domainFeature = defineFeature({
2907
2964
  name: "domain",
@@ -2939,7 +2996,7 @@ var domainFeature = defineFeature({
2939
2996
  zoneId: zone.id,
2940
2997
  name: option(certificate, 0).pipe((r) => r.resourceRecordName),
2941
2998
  type: option(certificate, 0).pipe((r) => r.resourceRecordType),
2942
- ttl: toSeconds2(minutes4(5)),
2999
+ ttl: toSeconds2(minutes5(5)),
2943
3000
  records: [option(certificate, 0).pipe((r) => r.resourceRecordValue)],
2944
3001
  allowOverwrite: true
2945
3002
  });
@@ -2947,7 +3004,7 @@ var domainFeature = defineFeature({
2947
3004
  zoneId: zone.id,
2948
3005
  name: option(certificate, 1).pipe((r) => r.resourceRecordName),
2949
3006
  type: option(certificate, 1).pipe((r) => r.resourceRecordType),
2950
- ttl: toSeconds2(minutes4(5)),
3007
+ ttl: toSeconds2(minutes5(5)),
2951
3008
  records: [option(certificate, 1).pipe((r) => r.resourceRecordValue)],
2952
3009
  allowOverwrite: true
2953
3010
  });
@@ -2975,7 +3032,7 @@ var domainFeature = defineFeature({
2975
3032
  zoneId: zone.id,
2976
3033
  name: option(globalCertificate, 0).pipe((r) => r.resourceRecordName),
2977
3034
  type: option(globalCertificate, 0).pipe((r) => r.resourceRecordType),
2978
- ttl: toSeconds2(minutes4(5)),
3035
+ ttl: toSeconds2(minutes5(5)),
2979
3036
  records: [option(globalCertificate, 0).pipe((r) => r.resourceRecordValue)],
2980
3037
  allowOverwrite: true
2981
3038
  });
@@ -2983,7 +3040,7 @@ var domainFeature = defineFeature({
2983
3040
  zoneId: zone.id,
2984
3041
  name: option(globalCertificate, 1).pipe((r) => r.resourceRecordName),
2985
3042
  type: option(globalCertificate, 1).pipe((r) => r.resourceRecordType),
2986
- ttl: toSeconds2(minutes4(5)),
3043
+ ttl: toSeconds2(minutes5(5)),
2987
3044
  records: [option(globalCertificate, 1).pipe((r) => r.resourceRecordValue)],
2988
3045
  allowOverwrite: true
2989
3046
  });
@@ -3009,7 +3066,7 @@ var domainFeature = defineFeature({
3009
3066
  zoneId: zone.id,
3010
3067
  name: `_amazonses.${props.domain}`,
3011
3068
  type: "TXT",
3012
- ttl: toSeconds2(minutes4(5)),
3069
+ ttl: toSeconds2(minutes5(5)),
3013
3070
  records: [identity.verificationToken]
3014
3071
  });
3015
3072
  const dkim = new $5.aws.ses.DomainDkim(group2, "dkim", {
@@ -3020,7 +3077,7 @@ var domainFeature = defineFeature({
3020
3077
  zoneId: zone.id,
3021
3078
  type: "CNAME",
3022
3079
  name: dkim.dkimTokens.pipe((t) => `${t.at(i)}._domainkey`),
3023
- ttl: toSeconds2(minutes4(5)),
3080
+ ttl: toSeconds2(minutes5(5)),
3024
3081
  records: [dkim.dkimTokens.pipe((t) => `${t.at(i)}.dkim.amazonses.com`)]
3025
3082
  });
3026
3083
  }
@@ -3033,21 +3090,21 @@ var domainFeature = defineFeature({
3033
3090
  zoneId: zone.id,
3034
3091
  name: mailFrom.mailFromDomain,
3035
3092
  type: "MX",
3036
- ttl: toSeconds2(minutes4(5)),
3093
+ ttl: toSeconds2(minutes5(5)),
3037
3094
  records: [`10 feedback-smtp.${ctx.appConfig.region}.amazonses.com`]
3038
3095
  });
3039
3096
  new $5.aws.route53.Record(group2, `SPF`, {
3040
3097
  zoneId: zone.id,
3041
3098
  name: mailFrom.mailFromDomain,
3042
3099
  type: "TXT",
3043
- ttl: toSeconds2(minutes4(5)),
3100
+ ttl: toSeconds2(minutes5(5)),
3044
3101
  records: ["v=spf1 include:amazonses.com -all"]
3045
3102
  });
3046
3103
  new $5.aws.route53.Record(group2, `DMARC`, {
3047
3104
  zoneId: zone.id,
3048
3105
  name: `_dmarc.${props.domain}`,
3049
3106
  type: "TXT",
3050
- ttl: toSeconds2(minutes4(5)),
3107
+ ttl: toSeconds2(minutes5(5)),
3051
3108
  records: ["v=DMARC1; p=none;"]
3052
3109
  });
3053
3110
  const verification = new $5.aws.ses.DomainIdentityVerification(
@@ -3400,7 +3457,7 @@ import { $ as $10, Group as Group10 } from "@awsless/formation";
3400
3457
  import { camelCase as camelCase4, constantCase as constantCase6 } from "change-case";
3401
3458
  import deepmerge3 from "deepmerge";
3402
3459
  import { relative as relative4 } from "path";
3403
- import { seconds as seconds4, toSeconds as toSeconds3 } from "@awsless/duration";
3460
+ import { seconds as seconds5, toSeconds as toSeconds3 } from "@awsless/duration";
3404
3461
  import { toBytes } from "@awsless/size";
3405
3462
  var typeGenCode3 = `
3406
3463
  import { SendMessageOptions, SendMessageBatchOptions, BatchItem } from '@awsless/sqs'
@@ -3471,7 +3528,7 @@ var queueFeature = defineFeature({
3471
3528
  name,
3472
3529
  delaySeconds: toSeconds3(props.deliveryDelay),
3473
3530
  visibilityTimeoutSeconds: toSeconds3(props.visibilityTimeout),
3474
- receiveWaitTimeSeconds: toSeconds3(props.receiveMessageWaitTime ?? seconds4(0)),
3531
+ receiveWaitTimeSeconds: toSeconds3(props.receiveMessageWaitTime ?? seconds5(0)),
3475
3532
  messageRetentionSeconds: toSeconds3(props.retentionPeriod),
3476
3533
  maxMessageSize: toBytes(props.maxMessageSize),
3477
3534
  redrivePolicy: onFailure && onFailure.pipe(
@@ -3631,7 +3688,7 @@ import { dirname as dirname5, join as join10, relative as relative5 } from "path
3631
3688
  import { fileURLToPath } from "node:url";
3632
3689
 
3633
3690
  // src/feature/function/prebuild.ts
3634
- import { days as days3, seconds as seconds5, toDays as toDays4, toSeconds as toSeconds4 } from "@awsless/duration";
3691
+ import { days as days3, seconds as seconds6, toDays as toDays4, toSeconds as toSeconds4 } from "@awsless/duration";
3635
3692
  import { $ as $12, Future as Future2, resolveInputs as resolveInputs2 } from "@awsless/formation";
3636
3693
  import { mebibytes as mebibytes2, toMebibytes as toMebibytes2 } from "@awsless/size";
3637
3694
  import { pascalCase as pascalCase2 } from "change-case";
@@ -3720,7 +3777,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
3720
3777
  // runtime: props.runtime === 'container' ? undefined : props.runtime,
3721
3778
  runtime: props.runtime,
3722
3779
  handler: props.handler,
3723
- timeout: toSeconds4(props.timeout ?? seconds5(10)),
3780
+ timeout: toSeconds4(props.timeout ?? seconds6(10)),
3724
3781
  memorySize: toMebibytes2(props.memorySize ?? mebibytes2(128)),
3725
3782
  architectures: [props.architecture ?? "arm64"],
3726
3783
  layers: props.layers?.map((id2) => ctx.shared.entry("layer", "arn", id2)),
@@ -3805,7 +3862,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
3805
3862
  };
3806
3863
 
3807
3864
  // src/feature/rpc/index.ts
3808
- import { days as days4, seconds as seconds6, toSeconds as toSeconds5 } from "@awsless/duration";
3865
+ import { days as days4, seconds as seconds7, toSeconds as toSeconds5 } from "@awsless/duration";
3809
3866
  var __dirname = dirname5(fileURLToPath(import.meta.url));
3810
3867
  var rpcFeature = defineFeature({
3811
3868
  name: "rpc",
@@ -3970,7 +4027,7 @@ var rpcFeature = defineFeature({
3970
4027
  const certificateArn = props.domain ? ctx.shared.entry("domain", `global-certificate-arn`, props.domain) : void 0;
3971
4028
  const cache = new $13.aws.cloudfront.CachePolicy(group, "cache", {
3972
4029
  name,
3973
- minTtl: toSeconds5(seconds6(1)),
4030
+ minTtl: toSeconds5(seconds7(1)),
3974
4031
  maxTtl: toSeconds5(days4(365)),
3975
4032
  defaultTtl: toSeconds5(days4(1))
3976
4033
  });
@@ -4182,7 +4239,7 @@ var searchFeature = defineFeature({
4182
4239
  });
4183
4240
 
4184
4241
  // src/feature/site/index.ts
4185
- import { days as days5, seconds as seconds7, toSeconds as toSeconds6 } from "@awsless/duration";
4242
+ import { days as days5, seconds as seconds8, toSeconds as toSeconds6 } from "@awsless/duration";
4186
4243
  import { $ as $15, Group as Group15 } from "@awsless/formation";
4187
4244
  import { glob as glob2 } from "glob";
4188
4245
  import { dirname as dirname6, join as join11 } from "path";
@@ -4372,7 +4429,7 @@ var siteFeature = defineFeature({
4372
4429
  }
4373
4430
  const cache = new $15.aws.cloudfront.CachePolicy(group, "cache", {
4374
4431
  name,
4375
- minTtl: toSeconds6(seconds7(1)),
4432
+ minTtl: toSeconds6(seconds8(1)),
4376
4433
  maxTtl: toSeconds6(days5(365)),
4377
4434
  defaultTtl: toSeconds6(days5(1)),
4378
4435
  parametersInCacheKeyAndForwardedToOrigin: {
@@ -4727,6 +4784,7 @@ var storeFeature = defineFeature({
4727
4784
  // src/feature/table/index.ts
4728
4785
  import { $ as $17, Group as Group17 } from "@awsless/formation";
4729
4786
  import { constantCase as constantCase11 } from "change-case";
4787
+ import { toSeconds as toSeconds7 } from "@awsless/duration";
4730
4788
  var tableFeature = defineFeature({
4731
4789
  name: "table",
4732
4790
  async onTypeGen(ctx) {
@@ -4813,8 +4871,8 @@ var tableFeature = defineFeature({
4813
4871
  rangeKey: props.sort,
4814
4872
  attribute: attributeDefinitions(),
4815
4873
  ttl: {
4816
- attributeName: props.timeToLiveAttribute,
4817
- enabled: !!props.timeToLiveAttribute
4874
+ attributeName: props.ttl,
4875
+ enabled: !!props.ttl
4818
4876
  },
4819
4877
  pointInTimeRecovery: {
4820
4878
  enabled: props.pointInTimeRecovery
@@ -4842,11 +4900,14 @@ var tableFeature = defineFeature({
4842
4900
  {
4843
4901
  functionName: result.lambda.functionName,
4844
4902
  eventSourceArn: table2.streamArn,
4845
- batchSize: 100,
4846
- bisectBatchOnFunctionError: true,
4847
- // maximumRetryAttempts: props.stream.
4848
- // retryAttempts: props.stream.consumer.retryAttempts ?? -1,
4849
- parallelizationFactor: 1,
4903
+ // tumblingWindowInSeconds
4904
+ // maximumRecordAgeInSeconds: props.stream.
4905
+ // bisectBatchOnFunctionError: true,
4906
+ batchSize: props.stream.batchSize,
4907
+ maximumBatchingWindowInSeconds: props.stream.batchWindow ? toSeconds7(props.stream.batchWindow) : void 0,
4908
+ maximumRetryAttempts: props.stream.retryAttempts,
4909
+ parallelizationFactor: props.stream.concurrencyPerShard,
4910
+ functionResponseTypes: ["ReportBatchItemFailures"],
4850
4911
  startingPosition: "LATEST",
4851
4912
  destinationConfig: {
4852
4913
  onFailure: onFailure ? { destinationArn: onFailure } : void 0
@@ -858,7 +858,8 @@ var SitesSchema = z28.record(
858
858
  static: z28.union([LocalDirectorySchema, z28.boolean()]).optional().describe(
859
859
  "Specifies the path to the static files directory. Additionally you can also pass `true` when you don't have local static files, but still want to make an S3 bucket."
860
860
  ),
861
- ssr: FunctionSchema.optional().describe("Specifies the ssr file."),
861
+ ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server."),
862
+ // envPrefix: z.string().optional().describe('Specifies a prefix for all '),
862
863
  origin: z28.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
863
864
  // bind: z.object({
864
865
  // auth:
@@ -999,6 +1000,7 @@ var StoresSchema = z29.union([
999
1000
  ]).optional().describe("Define the stores in your stack.");
1000
1001
 
1001
1002
  // src/feature/table/schema.ts
1003
+ import { minutes as minutes4, seconds as seconds4 } from "@awsless/duration";
1002
1004
  import { z as z30 } from "zod";
1003
1005
  var KeySchema = z30.string().min(1).max(255);
1004
1006
  var TablesSchema = z30.record(
@@ -1015,13 +1017,68 @@ var TablesSchema = z30.record(
1015
1017
  ),
1016
1018
  class: z30.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
1017
1019
  pointInTimeRecovery: z30.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
1018
- timeToLiveAttribute: KeySchema.optional().describe(
1019
- "The name of the TTL attribute used to store the expiration time for items in the table. To update this property, you must first disable TTL and then enable TTL with the new attribute name."
1020
+ ttl: KeySchema.optional().describe(
1021
+ [
1022
+ "The name of the TTL attribute used to store the expiration time for items in the table.",
1023
+ "To update this property, you must first disable TTL and then enable TTL with the new attribute name."
1024
+ ].join("\n")
1020
1025
  ),
1021
1026
  // deletionProtection: DeletionProtectionSchema.optional(),
1022
1027
  stream: z30.object({
1023
1028
  type: z30.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
1024
- "When an item in the table is modified, stream.type determines what information is written to the stream for this table. Valid values are:\n- keys-only - Only the key attributes of the modified item are written to the stream.\n- new-image - The entire item, as it appears after it was modified, is written to the stream.\n- old-image - The entire item, as it appeared before it was modified, is written to the stream.\n- new-and-old-images - Both the new and the old item images of the item are written to the stream."
1029
+ [
1030
+ "When an item in the table is modified, you can determines what information is written to the stream for this table.",
1031
+ "Valid values are:",
1032
+ "- keys-only - Only the key attributes of the modified item are written to the stream.",
1033
+ "- new-image - The entire item, as it appears after it was modified, is written to the stream.",
1034
+ "- old-image - The entire item, as it appeared before it was modified, is written to the stream.",
1035
+ "- new-and-old-images - Both the new and the old item images of the item are written to the stream."
1036
+ ].join("\n")
1037
+ ),
1038
+ batchSize: z30.number().min(1).max(1e4).default(1).describe(
1039
+ [
1040
+ "The maximum number of records in each batch that Lambda pulls from your stream and sends to your function.",
1041
+ "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).",
1042
+ "You can specify a number from 1 to 10000."
1043
+ ].join("\n")
1044
+ ),
1045
+ batchWindow: DurationSchema.refine(
1046
+ durationMin(seconds4(1)),
1047
+ "Minimum batch window duration is 1 second"
1048
+ ).refine(durationMax(minutes4(5)), "Maximum batch window duration is 5 minutes").optional().describe(
1049
+ [
1050
+ "The maximum amount of time that is spend gathering records before invoking the function.",
1051
+ "You can specify a duration from 1 seconds to 5 minutes."
1052
+ ].join("\n")
1053
+ ),
1054
+ // maxRecordAge: DurationSchema.refine(
1055
+ // durationMin(seconds(1)),
1056
+ // 'Minimum record age duration is 1 second'
1057
+ // )
1058
+ // .refine(durationMax(minutes(5)), 'Maximum batch window duration is 5 minutes')
1059
+ // .optional()
1060
+ // .describe(
1061
+ // [
1062
+ // 'Discard records after the specified number of retries.',
1063
+ // 'The default value is -1, which sets the maximum number of retries to infinite.',
1064
+ // 'When maxRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.',
1065
+ // 'You can specify a number from -1 to 10000.',
1066
+ // ].join('\n')
1067
+ // ),
1068
+ retryAttempts: z30.number().min(-1).max(1e4).default(-1).describe(
1069
+ [
1070
+ "Discard records after the specified number of retries.",
1071
+ "The default value is -1, which sets the maximum number of retries to infinite.",
1072
+ "When maxRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.",
1073
+ "You can specify a number from -1 to 10000."
1074
+ ].join("\n")
1075
+ ),
1076
+ concurrencyPerShard: z30.number().min(1).max(10).default(1).describe(
1077
+ [
1078
+ "The number of batches to process concurrently from each shard.",
1079
+ "The default value is 1.",
1080
+ "You can specify a number from 1 to 10."
1081
+ ].join("\n")
1025
1082
  ),
1026
1083
  consumer: FunctionSchema.describe("The consuming lambda function for the stream")
1027
1084
  }).optional().describe(
@@ -1 +1 @@
1
- 19645fcec77189d7f564499303ce68d059f8305e
1
+ 3ef5fb4ef69d1fdaa28fdb474186990eba65bd52
Binary file