@awsless/awsless 0.0.549 → 0.0.550

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
@@ -370,7 +370,7 @@ var createWorkSpace = async (props) => {
370
370
  if (process.env.VERBOSE) {
371
371
  enableDebug();
372
372
  }
373
- const aws = await terraform.install("hashicorp", "aws", "5.98.0");
373
+ const aws = await terraform.install("hashicorp", "aws", "6.9.0");
374
374
  const workspace = new WorkSpace({
375
375
  providers: [
376
376
  createLambdaProvider(props),
@@ -998,32 +998,30 @@ var DomainSchema = ResourceIdSchema.describe("The domain id to link your Pubsub
998
998
  var PubSubDefaultSchema = z18.record(
999
999
  ResourceIdSchema,
1000
1000
  z18.object({
1001
- auth: FunctionSchema,
1001
+ auth: FunctionSchema.describe("The authentication function for the pubsub API."),
1002
1002
  domain: DomainSchema.optional(),
1003
- subDomain: z18.string().optional()
1004
- // auth: z.union([
1005
- // ResourceIdSchema,
1006
- // z.object({
1007
- // authorizer: FunctionSchema,
1008
- // // ttl: AuthorizerTtl.default('1 hour'),
1009
- // }),
1010
- // ]),
1011
- // policy: z
1012
- // .object({
1013
- // publish: z.array(z.string()).optional(),
1014
- // subscribe: z.array(z.string()).optional(),
1015
- // })
1016
- // .optional(),
1003
+ subDomain: z18.string().optional(),
1004
+ namespaces: z18.array(z18.string()).optional().describe('The namespaces for the PubSub API. If not set, a single "default" namespace is created.'),
1005
+ logLevel: z18.enum(["none", "info", "error", "debug", "all"]).optional().describe("The logging level for AppSync API. When set, logging is enabled.")
1017
1006
  })
1018
- ).optional().describe("Define the pubsub subscriber in your stack.");
1007
+ ).optional().describe("Define the pubsub API configuration in your stack.");
1019
1008
  var PubSubSchema = z18.record(
1020
1009
  ResourceIdSchema,
1021
1010
  z18.object({
1022
- sql: z18.string().describe("The SQL statement used to query the IOT topic."),
1023
- sqlVersion: z18.enum(["2015-10-08", "2016-03-23", "beta"]).default("2016-03-23").describe("The version of the SQL rules engine to use when evaluating the rule."),
1024
- consumer: FunctionSchema.describe("The consuming lambda function properties.")
1011
+ channels: z18.array(z18.string()).describe("The event channels this subscriber listens to."),
1012
+ filter: z18.object({
1013
+ eventType: z18.string().optional().describe("Filter events by event type.")
1014
+ // Add more filter options as needed
1015
+ // userId: z.string().optional(),
1016
+ // custom: z.record(z.string(), z.any()).optional(),
1017
+ }).optional().describe("Event filtering options."),
1018
+ consumer: FunctionSchema.describe("The consuming lambda function properties."),
1019
+ batchSize: z18.number().int().min(1).max(100).default(1).describe("Number of events to batch before invoking the consumer function."),
1020
+ retryPolicy: z18.object({
1021
+ maxRetries: z18.number().int().min(0).max(3).default(2).describe("Maximum number of retry attempts.")
1022
+ }).optional().describe("Retry policy for failed event processing.")
1025
1023
  })
1026
- ).optional().describe("Define the pubsub subscriber in your stack.");
1024
+ ).optional().describe("Define the pubsub event subscribers in your stack.");
1027
1025
 
1028
1026
  // src/feature/queue/schema.ts
1029
1027
  import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
@@ -1790,8 +1788,7 @@ var StoresSchema = z35.union([
1790
1788
  z35.record(
1791
1789
  ResourceIdSchema,
1792
1790
  z35.object({
1793
- // cors: CorsSchema,
1794
- // deletionProtection: DeletionProtectionSchema.optional(),
1791
+ static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
1795
1792
  versioning: z35.boolean().default(false).describe("Enable versioning of your store."),
1796
1793
  events: z35.object({
1797
1794
  // create
@@ -3977,87 +3974,137 @@ var formatFullDomainName = (config2, id, subDomain) => {
3977
3974
  var pubsubFeature = defineFeature({
3978
3975
  name: "pubsub",
3979
3976
  onApp(ctx) {
3980
- for (const [id, props] of Object.entries(ctx.appConfig.defaults.pubsub ?? {})) {
3977
+ for (const [id, props] of Object.entries(ctx.appConfig.defaults?.pubsub ?? {})) {
3981
3978
  const group = new Group9(ctx.base, "pubsub", id);
3982
- const { lambda } = createLambdaFunction(group, ctx, "pubsub-authorizer", id, props.auth);
3979
+ const shortName = `${ctx.app.name}--${id}`;
3983
3980
  const name = formatGlobalResourceName({
3984
3981
  appName: ctx.app.name,
3985
3982
  resourceType: "pubsub",
3986
3983
  resourceName: id
3987
3984
  });
3988
- const authorizer = new $9.aws.iot.Authorizer(group, "authorizer", {
3989
- name,
3990
- authorizerFunctionArn: lambda.arn,
3991
- status: "ACTIVE",
3992
- signingDisabled: true,
3993
- enableCachingForHttp: false
3985
+ const authGroup = new Group9(group, "auth", "lambda");
3986
+ const { lambda: authLambda } = createLambdaFunction(authGroup, ctx, "pubsub", `${id}-auth`, {
3987
+ ...props.auth,
3988
+ description: `PubSub ${id} authorizer`
3994
3989
  });
3995
- new $9.aws.lambda.Permission(group, "permission", {
3996
- functionName: lambda.functionName,
3997
- action: "lambda:InvokeFunction",
3998
- principal: "iot.amazonaws.com",
3999
- sourceArn: authorizer.arn
3990
+ let loggingRole;
3991
+ if (props.logLevel) {
3992
+ loggingRole = new $9.aws.iam.Role(group, "logging-role", {
3993
+ name: shortId(`${name}-logging-role`),
3994
+ assumeRolePolicy: JSON.stringify({
3995
+ Version: "2012-10-17",
3996
+ Statement: [
3997
+ {
3998
+ Effect: "Allow",
3999
+ Principal: {
4000
+ Service: "appsync.amazonaws.com"
4001
+ },
4002
+ Action: "sts:AssumeRole"
4003
+ }
4004
+ ]
4005
+ })
4006
+ });
4007
+ new $9.aws.iam.RolePolicyAttachment(group, "logs-policy", {
4008
+ role: loggingRole.name,
4009
+ policyArn: "arn:aws:iam::aws:policy/service-role/AWSAppSyncPushToCloudWatchLogs"
4010
+ });
4011
+ }
4012
+ const api = new $9.aws.appsync.Api(group, "api", {
4013
+ name: shortName,
4014
+ eventConfig: [
4015
+ {
4016
+ connectionAuthMode: [{ authType: "AWS_IAM" }, { authType: "AWS_LAMBDA" }],
4017
+ authProvider: [
4018
+ {
4019
+ authType: "AWS_LAMBDA",
4020
+ lambdaAuthorizerConfig: [
4021
+ {
4022
+ authorizerUri: authLambda.arn,
4023
+ authorizerResultTtlInSeconds: 300
4024
+ }
4025
+ ]
4026
+ },
4027
+ {
4028
+ authType: "AWS_IAM"
4029
+ }
4030
+ ],
4031
+ defaultPublishAuthMode: [
4032
+ {
4033
+ authType: "AWS_IAM"
4034
+ }
4035
+ ],
4036
+ defaultSubscribeAuthMode: [
4037
+ {
4038
+ authType: "AWS_LAMBDA"
4039
+ },
4040
+ {
4041
+ authType: "AWS_IAM"
4042
+ }
4043
+ ],
4044
+ logConfig: props.logLevel ? [
4045
+ {
4046
+ logLevel: props.logLevel.toUpperCase(),
4047
+ cloudwatchLogsRoleArn: loggingRole.arn
4048
+ }
4049
+ ] : void 0
4050
+ }
4051
+ ]
4000
4052
  });
4001
- ctx.bind(`PUBSUB_${constantCase5(id)}_AUTHORIZER`, name);
4002
- const endpoint = $9.aws.iot.getEndpoint(group, "endpoint", {
4003
- endpointType: "iot:Data-ATS"
4053
+ const namespaces = props.namespaces ?? ["default"];
4054
+ for (const namespace of namespaces) {
4055
+ new $9.aws.appsync.ChannelNamespace(group, `namespace-${namespace}`, {
4056
+ name: namespace,
4057
+ apiId: api.apiId
4058
+ });
4059
+ }
4060
+ new $9.aws.lambda.Permission(group, "auth-permission", {
4061
+ action: "lambda:InvokeFunction",
4062
+ principal: "appsync.amazonaws.com",
4063
+ functionName: authLambda.functionName,
4064
+ sourceArn: api.apiArn
4004
4065
  });
4005
4066
  if (props.domain) {
4006
4067
  const domainName = formatFullDomainName(ctx.appConfig, props.domain, props.subDomain);
4007
- new $9.aws.iot.DomainConfiguration(group, "domain", {
4008
- name,
4068
+ const zoneId = ctx.shared.entry("domain", `zone-id`, props.domain);
4069
+ const certificateArn = ctx.shared.entry("domain", `certificate-arn`, props.domain);
4070
+ const apiDomain = new $9.aws.appsync.DomainName(group, "domain", {
4009
4071
  domainName,
4010
- serverCertificateArns: [ctx.shared.entry("domain", `certificate-arn`, props.domain)],
4011
- authorizerConfig: {
4012
- defaultAuthorizerName: authorizer.name
4013
- }
4014
- // validationCertificate: ctx.shared.get(`global-certificate-${props.domain}-arn`),
4072
+ certificateArn
4073
+ });
4074
+ new $9.aws.appsync.DomainNameApiAssociation(group, "domain-association", {
4075
+ apiId: api.apiArn,
4076
+ domainName: apiDomain.domainName
4015
4077
  });
4016
4078
  new $9.aws.route53.Record(group, "record", {
4017
- zoneId: ctx.shared.entry("domain", `zone-id`, props.domain),
4018
- name: domainName,
4079
+ zoneId,
4019
4080
  type: "CNAME",
4020
- records: [endpoint.endpointAddress]
4081
+ name: domainName,
4082
+ records: [apiDomain.appsyncDomainName],
4083
+ ttl: 300
4021
4084
  });
4022
- ctx.bind(`PUBSUB_${constantCase5(id)}_ENDPOINT`, domainName);
4085
+ ctx.bind(`PUBSUB_${constantCase5(id)}_ENDPOINT`, `${domainName}/event`);
4086
+ ctx.bind(`PUBSUB_${constantCase5(id)}_REALTIME_ENDPOINT`, `${domainName}/event/realtime`);
4023
4087
  } else {
4024
- ctx.bind(`PUBSUB_${constantCase5(id)}_ENDPOINT`, endpoint.endpointAddress);
4088
+ ctx.bind(
4089
+ `PUBSUB_${constantCase5(id)}_ENDPOINT`,
4090
+ api.dns.pipe((dns) => dns.HTTP)
4091
+ );
4092
+ ctx.bind(
4093
+ `PUBSUB_${constantCase5(id)}_REALTIME_ENDPOINT`,
4094
+ api.dns.pipe((dns) => dns.REALTIME)
4095
+ );
4025
4096
  }
4026
4097
  }
4027
- ctx.addGlobalPermission({
4028
- actions: [`iot:Publish`],
4029
- resources: [
4030
- //
4031
- `arn:aws:iot:${ctx.appConfig.region}:${ctx.accountId}:topic/*`,
4032
- `arn:aws:iot:${ctx.appConfig.region}:${ctx.accountId}:topic/${ctx.app.name}/pubsub/*`
4033
- ]
4034
- });
4035
- },
4036
- onStack(ctx) {
4037
- for (const [id, props] of Object.entries(ctx.stackConfig.pubsub ?? {})) {
4038
- const group = new Group9(ctx.stack, "pubsub", id);
4039
- const { lambda } = createAsyncLambdaFunction(group, ctx, `pubsub`, id, props.consumer);
4040
- const name = formatLocalResourceName({
4041
- appName: ctx.app.name,
4042
- stackName: ctx.stack.name,
4043
- resourceType: "pubsub",
4044
- resourceName: id
4045
- });
4046
- const topic = new $9.aws.iot.TopicRule(group, "rule", {
4047
- name: name.replaceAll("-", "_"),
4048
- enabled: true,
4049
- sql: props.sql,
4050
- sqlVersion: props.sqlVersion,
4051
- lambda: [{ functionArn: lambda.arn }]
4052
- });
4053
- new $9.aws.lambda.Permission(group, "permission", {
4054
- action: "lambda:InvokeFunction",
4055
- principal: "iot.amazonaws.com",
4056
- functionName: lambda.functionName,
4057
- sourceArn: topic.arn
4058
- });
4059
- }
4060
4098
  }
4099
+ // Note: The onStack method would handle channel namespaces and subscriptions
4100
+ // but is commented out for now as it needs to be refactored for AppSync Event API
4101
+ // onStack(ctx) {
4102
+ // // Channel namespaces and event handlers would be configured here
4103
+ // // This would include:
4104
+ // // 1. Creating channel namespaces with their own auth modes (overriding defaults)
4105
+ // // 2. Setting up event handlers (Lambda functions) for specific channels
4106
+ // // 3. Configuring event filtering and routing rules
4107
+ // },
4061
4108
  });
4062
4109
 
4063
4110
  // src/feature/queue/index.ts
@@ -5431,6 +5478,30 @@ var siteFeature = defineFeature({
5431
5478
  import { Group as Group16 } from "@awsless/formation";
5432
5479
  import { kebabCase as kebabCase7 } from "change-case";
5433
5480
  import { $ as $16 } from "@awsless/formation";
5481
+ import { glob as glob3 } from "glob";
5482
+
5483
+ // src/feature/store/util.ts
5484
+ import { contentType as contentType2, lookup as lookup2 } from "mime-types";
5485
+ import { extname as extname3 } from "path";
5486
+ var getCacheControl2 = (file) => {
5487
+ switch (lookup2(file)) {
5488
+ case false:
5489
+ case "text/html":
5490
+ case "application/json":
5491
+ case "application/manifest+json":
5492
+ case "application/manifest":
5493
+ case "text/markdown":
5494
+ return "s-maxage=31536000, max-age=0";
5495
+ default:
5496
+ return `public, max-age=31536000, immutable`;
5497
+ }
5498
+ };
5499
+ var getContentType2 = (file) => {
5500
+ return contentType2(extname3(file)) || "text/html; charset=utf-8";
5501
+ };
5502
+
5503
+ // src/feature/store/index.ts
5504
+ import { join as join12 } from "path";
5434
5505
  var typeGenCode5 = `
5435
5506
  import { Body, PutObjectProps, BodyStream } from '@awsless/s3'
5436
5507
 
@@ -5523,6 +5594,24 @@ var storeFeature = defineFeature({
5523
5594
  import: ctx.import ? name : void 0
5524
5595
  }
5525
5596
  );
5597
+ ctx.onReady(() => {
5598
+ if (typeof props.static === "string" && bucket) {
5599
+ const files = glob3.sync("**", {
5600
+ cwd: props.static,
5601
+ nodir: true
5602
+ });
5603
+ for (const file of files) {
5604
+ new $16.aws.s3.BucketObject(group, file, {
5605
+ bucket: bucket.bucket,
5606
+ key: file,
5607
+ cacheControl: getCacheControl2(file),
5608
+ contentType: getContentType2(file),
5609
+ source: join12(props.static, file),
5610
+ sourceHash: $hash(join12(props.static, file))
5611
+ });
5612
+ }
5613
+ }
5614
+ });
5526
5615
  const eventMap = {
5527
5616
  "created:*": "s3:ObjectCreated:*",
5528
5617
  "created:put": "s3:ObjectCreated:Put",
@@ -6213,12 +6302,12 @@ var layerFeature = defineFeature({
6213
6302
 
6214
6303
  // src/feature/image/index.ts
6215
6304
  import { $ as $23, Group as Group23 } from "@awsless/formation";
6216
- import { join as join12, dirname as dirname8 } from "path";
6305
+ import { join as join13, dirname as dirname8 } from "path";
6217
6306
  import { mebibytes as mebibytes4 } from "@awsless/size";
6218
6307
  import { days as days7, seconds as seconds9, toDays as toDays6, toSeconds as toSeconds8 } from "@awsless/duration";
6219
6308
  import { constantCase as constantCase12 } from "change-case";
6220
6309
  import { fileURLToPath as fileURLToPath2 } from "url";
6221
- import { glob as glob3 } from "glob";
6310
+ import { glob as glob4 } from "glob";
6222
6311
  var __dirname2 = dirname8(fileURLToPath2(import.meta.url));
6223
6312
  var imageFeature = defineFeature({
6224
6313
  name: "image",
@@ -6230,7 +6319,7 @@ var imageFeature = defineFeature({
6230
6319
  return;
6231
6320
  }
6232
6321
  const group = new Group23(ctx.base, "image", "layer");
6233
- const path = join12(__dirname2, "/layers/sharp-arm.zip");
6322
+ const path = join13(__dirname2, "/layers/sharp-arm.zip");
6234
6323
  const layerId = formatGlobalResourceName({
6235
6324
  appName: ctx.appConfig.name,
6236
6325
  resourceType: "layer",
@@ -6313,8 +6402,8 @@ var imageFeature = defineFeature({
6313
6402
  resourceName: "sharp"
6314
6403
  });
6315
6404
  const serverLambda = createPrebuildLambdaFunction(group, ctx, "image", id, {
6316
- bundleFile: join12(__dirname2, "/prebuild/image/bundle.zip"),
6317
- bundleHash: join12(__dirname2, "/prebuild/image/HASH"),
6405
+ bundleFile: join13(__dirname2, "/prebuild/image/bundle.zip"),
6406
+ bundleHash: join13(__dirname2, "/prebuild/image/HASH"),
6318
6407
  memorySize: mebibytes4(512),
6319
6408
  timeout: seconds9(10),
6320
6409
  handler: "index.default",
@@ -6372,7 +6461,7 @@ var imageFeature = defineFeature({
6372
6461
  }
6373
6462
  ctx.onReady(() => {
6374
6463
  if (props.origin.static && s3Origin) {
6375
- const files = glob3.sync("**", {
6464
+ const files = glob4.sync("**", {
6376
6465
  cwd: props.origin.static,
6377
6466
  nodir: true
6378
6467
  });
@@ -6380,8 +6469,8 @@ var imageFeature = defineFeature({
6380
6469
  new $23.aws.s3.BucketObject(group, `static-${file}`, {
6381
6470
  bucket: s3Origin.bucket,
6382
6471
  key: file,
6383
- source: join12(props.origin.static, file),
6384
- sourceHash: $hash(join12(props.origin.static, file))
6472
+ source: join13(props.origin.static, file),
6473
+ sourceHash: $hash(join13(props.origin.static, file))
6385
6474
  });
6386
6475
  }
6387
6476
  }
@@ -6533,12 +6622,12 @@ var imageFeature = defineFeature({
6533
6622
 
6534
6623
  // src/feature/icon/index.ts
6535
6624
  import { $ as $24, Group as Group24 } from "@awsless/formation";
6536
- import { join as join13, dirname as dirname9 } from "path";
6625
+ import { join as join14, dirname as dirname9 } from "path";
6537
6626
  import { mebibytes as mebibytes5 } from "@awsless/size";
6538
6627
  import { days as days8, seconds as seconds10, toDays as toDays7, toSeconds as toSeconds9 } from "@awsless/duration";
6539
6628
  import { constantCase as constantCase13 } from "change-case";
6540
6629
  import { fileURLToPath as fileURLToPath3 } from "url";
6541
- import { glob as glob4 } from "glob";
6630
+ import { glob as glob5 } from "glob";
6542
6631
  var __dirname3 = dirname9(fileURLToPath3(import.meta.url));
6543
6632
  var iconFeature = defineFeature({
6544
6633
  name: "icon",
@@ -6591,8 +6680,8 @@ var iconFeature = defineFeature({
6591
6680
  } : {}
6592
6681
  });
6593
6682
  const serverLambda = createPrebuildLambdaFunction(group, ctx, "icon", id, {
6594
- bundleFile: join13(__dirname3, "/prebuild/icon/bundle.zip"),
6595
- bundleHash: join13(__dirname3, "/prebuild/icon/HASH"),
6683
+ bundleFile: join14(__dirname3, "/prebuild/icon/bundle.zip"),
6684
+ bundleHash: join14(__dirname3, "/prebuild/icon/HASH"),
6596
6685
  memorySize: mebibytes5(512),
6597
6686
  timeout: seconds10(10),
6598
6687
  handler: "index.default",
@@ -6648,7 +6737,7 @@ var iconFeature = defineFeature({
6648
6737
  }
6649
6738
  ctx.onReady(() => {
6650
6739
  if (props.origin.static && s3Origin) {
6651
- const files = glob4.sync("**", {
6740
+ const files = glob5.sync("**", {
6652
6741
  cwd: props.origin.static,
6653
6742
  nodir: true
6654
6743
  });
@@ -6659,8 +6748,8 @@ var iconFeature = defineFeature({
6659
6748
  new $24.aws.s3.BucketObject(group, `static-${file}`, {
6660
6749
  bucket: s3Origin.bucket,
6661
6750
  key: file,
6662
- source: join13(props.origin.static, file),
6663
- sourceHash: $hash(join13(props.origin.static, file))
6751
+ source: join14(props.origin.static, file),
6752
+ sourceHash: $hash(join14(props.origin.static, file))
6664
6753
  });
6665
6754
  }
6666
6755
  }
@@ -6820,15 +6909,15 @@ import { toMebibytes as toMebibytes4 } from "@awsless/size";
6820
6909
  import { generateFileHash as generateFileHash2 } from "@awsless/ts-file-cache";
6821
6910
  import { constantCase as constantCase14, pascalCase as pascalCase3 } from "change-case";
6822
6911
  import deepmerge4 from "deepmerge";
6823
- import { join as join15 } from "path";
6912
+ import { join as join16 } from "path";
6824
6913
 
6825
6914
  // src/feature/instance/build/executable.ts
6826
6915
  import { createHash as createHash4 } from "crypto";
6827
6916
  import { readFile as readFile4 } from "fs/promises";
6828
- import { join as join14 } from "path";
6917
+ import { join as join15 } from "path";
6829
6918
  import { exec as exec2 } from "promisify-child-process";
6830
6919
  var buildExecutable = async (input, outputPath) => {
6831
- const filePath = join14(outputPath, "program");
6920
+ const filePath = join15(outputPath, "program");
6832
6921
  const args = ["build", input, "--compile", "--target", "bun-linux-x64-modern", "--outfile", filePath];
6833
6922
  try {
6834
6923
  await exec2(`bun ${args.join(" ")}`);
@@ -7048,7 +7137,7 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
7048
7137
  healthCheck: props.healthCheck ? {
7049
7138
  command: [
7050
7139
  "CMD-SHELL",
7051
- `curl -f http://${join15("localhost", props.healthCheck.path)} || exit 1`
7140
+ `curl -f http://${join16("localhost", props.healthCheck.path)} || exit 1`
7052
7141
  ],
7053
7142
  interval: toSeconds10(props.healthCheck.interval),
7054
7143
  retries: props.healthCheck.retries,
@@ -8249,13 +8338,13 @@ import wildstring4 from "wildstring";
8249
8338
  import { log as log15 } from "@awsless/clui";
8250
8339
  import chalk4 from "chalk";
8251
8340
  import { mkdir as mkdir4, readFile as readFile6, writeFile as writeFile3 } from "fs/promises";
8252
- import { join as join18 } from "path";
8341
+ import { join as join19 } from "path";
8253
8342
  import wildstring3 from "wildstring";
8254
8343
 
8255
8344
  // src/build/__fingerprint.ts
8256
8345
  import { createHash as createHash5 } from "crypto";
8257
8346
  import { readdir as readdir4, readFile as readFile5, stat as stat4 } from "fs/promises";
8258
- import { basename as basename4, dirname as dirname10, extname as extname3, join as join16 } from "path";
8347
+ import { basename as basename4, dirname as dirname10, extname as extname4, join as join17 } from "path";
8259
8348
  import parseStaticImports from "parse-static-imports";
8260
8349
  var extensions = ["js", "mjs", "jsx", "ts", "mts", "tsx"];
8261
8350
  var generateFileHashes = async (file, hashes) => {
@@ -8276,8 +8365,8 @@ var fingerprintFromDirectory = async (dir) => {
8276
8365
  const hashes = /* @__PURE__ */ new Map();
8277
8366
  const files = await readdir4(dir, { recursive: true });
8278
8367
  for (const file of files) {
8279
- if (extensions.includes(extname3(file).substring(1)) && file.at(0) !== "_") {
8280
- await generateFileHashes(join16(dir, file), hashes);
8368
+ if (extensions.includes(extname4(file).substring(1)) && file.at(0) !== "_") {
8369
+ await generateFileHashes(join17(dir, file), hashes);
8281
8370
  }
8282
8371
  }
8283
8372
  const merge2 = Buffer.concat(Array.from(hashes.values()).sort());
@@ -8291,7 +8380,7 @@ var readModuleFile = (file) => {
8291
8380
  return readFiles([
8292
8381
  file,
8293
8382
  ...extensions.map((exp) => `${file}.${exp}`),
8294
- ...extensions.map((exp) => join16(file, `/index.${exp}`))
8383
+ ...extensions.map((exp) => join17(file, `/index.${exp}`))
8295
8384
  ]);
8296
8385
  }
8297
8386
  return readFile5(file, "utf8");
@@ -8311,7 +8400,7 @@ var readFiles = async (files) => {
8311
8400
  };
8312
8401
  var findDependencies = async (file, code) => {
8313
8402
  const imports = await parseStaticImports(code);
8314
- return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join16(dirname10(file), value) : value);
8403
+ return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join17(dirname10(file), value) : value);
8315
8404
  };
8316
8405
 
8317
8406
  // src/test/reporter.ts
@@ -8391,7 +8480,7 @@ var CustomReporter = class {
8391
8480
  import commonjs2 from "@rollup/plugin-commonjs";
8392
8481
  import json2 from "@rollup/plugin-json";
8393
8482
  import nodeResolve2 from "@rollup/plugin-node-resolve";
8394
- import { dirname as dirname11, join as join17 } from "path";
8483
+ import { dirname as dirname11, join as join18 } from "path";
8395
8484
  import { swc as swc2 } from "rollup-plugin-swc3";
8396
8485
  import { fileURLToPath as fileURLToPath4 } from "url";
8397
8486
  import { configDefaults } from "vitest/config";
@@ -8413,7 +8502,7 @@ var startTest = async (props) => {
8413
8502
  reporters: props.reporter,
8414
8503
  setupFiles: [
8415
8504
  //
8416
- join17(__dirname4, "test-global-setup.js")
8505
+ join18(__dirname4, "test-global-setup.js")
8417
8506
  ]
8418
8507
  // globalSetup: [
8419
8508
  // //
@@ -8503,7 +8592,7 @@ var logTestErrors = (event) => {
8503
8592
  var runTest = async (stack, dir, filters, opts) => {
8504
8593
  await mkdir4(directories.test, { recursive: true });
8505
8594
  const fingerprint = await fingerprintFromDirectory(dir);
8506
- const file = join18(directories.test, `${stack}.json`);
8595
+ const file = join19(directories.test, `${stack}.json`);
8507
8596
  const exists = await fileExist(file);
8508
8597
  if (exists && !process.env.NO_CACHE) {
8509
8598
  const raw = await readFile6(file, { encoding: "utf8" });
@@ -8841,7 +8930,7 @@ import { log as log18 } from "@awsless/clui";
8841
8930
 
8842
8931
  // src/type-gen/generate.ts
8843
8932
  import { mkdir as mkdir5, writeFile as writeFile4 } from "fs/promises";
8844
- import { dirname as dirname12, join as join19, relative as relative7 } from "path";
8933
+ import { dirname as dirname12, join as join20, relative as relative7 } from "path";
8845
8934
  var generateTypes = async (props) => {
8846
8935
  const files = [];
8847
8936
  await Promise.all(
@@ -8850,7 +8939,7 @@ var generateTypes = async (props) => {
8850
8939
  ...props,
8851
8940
  async write(file, data, include = false) {
8852
8941
  const code = data?.toString("utf8");
8853
- const path = join19(directories.types, file);
8942
+ const path = join20(directories.types, file);
8854
8943
  if (code) {
8855
8944
  if (include) {
8856
8945
  files.push(relative7(directories.root, path));
@@ -8864,7 +8953,7 @@ var generateTypes = async (props) => {
8864
8953
  );
8865
8954
  if (files.length) {
8866
8955
  const code = files.map((file) => `/// <reference path='${file}' />`).join("\n");
8867
- await writeFile4(join19(directories.root, `awsless.d.ts`), code);
8956
+ await writeFile4(join20(directories.root, `awsless.d.ts`), code);
8868
8957
  }
8869
8958
  };
8870
8959
 
@@ -390,32 +390,30 @@ var DomainSchema = ResourceIdSchema.describe("The domain id to link your Pubsub
390
390
  var PubSubDefaultSchema = z15.record(
391
391
  ResourceIdSchema,
392
392
  z15.object({
393
- auth: FunctionSchema,
393
+ auth: FunctionSchema.describe("The authentication function for the pubsub API."),
394
394
  domain: DomainSchema.optional(),
395
- subDomain: z15.string().optional()
396
- // auth: z.union([
397
- // ResourceIdSchema,
398
- // z.object({
399
- // authorizer: FunctionSchema,
400
- // // ttl: AuthorizerTtl.default('1 hour'),
401
- // }),
402
- // ]),
403
- // policy: z
404
- // .object({
405
- // publish: z.array(z.string()).optional(),
406
- // subscribe: z.array(z.string()).optional(),
407
- // })
408
- // .optional(),
395
+ subDomain: z15.string().optional(),
396
+ namespaces: z15.array(z15.string()).optional().describe('The namespaces for the PubSub API. If not set, a single "default" namespace is created.'),
397
+ logLevel: z15.enum(["none", "info", "error", "debug", "all"]).optional().describe("The logging level for AppSync API. When set, logging is enabled.")
409
398
  })
410
- ).optional().describe("Define the pubsub subscriber in your stack.");
399
+ ).optional().describe("Define the pubsub API configuration in your stack.");
411
400
  var PubSubSchema = z15.record(
412
401
  ResourceIdSchema,
413
402
  z15.object({
414
- sql: z15.string().describe("The SQL statement used to query the IOT topic."),
415
- sqlVersion: z15.enum(["2015-10-08", "2016-03-23", "beta"]).default("2016-03-23").describe("The version of the SQL rules engine to use when evaluating the rule."),
416
- consumer: FunctionSchema.describe("The consuming lambda function properties.")
403
+ channels: z15.array(z15.string()).describe("The event channels this subscriber listens to."),
404
+ filter: z15.object({
405
+ eventType: z15.string().optional().describe("Filter events by event type.")
406
+ // Add more filter options as needed
407
+ // userId: z.string().optional(),
408
+ // custom: z.record(z.string(), z.any()).optional(),
409
+ }).optional().describe("Event filtering options."),
410
+ consumer: FunctionSchema.describe("The consuming lambda function properties."),
411
+ batchSize: z15.number().int().min(1).max(100).default(1).describe("Number of events to batch before invoking the consumer function."),
412
+ retryPolicy: z15.object({
413
+ maxRetries: z15.number().int().min(0).max(3).default(2).describe("Maximum number of retry attempts.")
414
+ }).optional().describe("Retry policy for failed event processing.")
417
415
  })
418
- ).optional().describe("Define the pubsub subscriber in your stack.");
416
+ ).optional().describe("Define the pubsub event subscribers in your stack.");
419
417
 
420
418
  // src/feature/queue/schema.ts
421
419
  import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
@@ -1182,8 +1180,7 @@ var StoresSchema = z32.union([
1182
1180
  z32.record(
1183
1181
  ResourceIdSchema,
1184
1182
  z32.object({
1185
- // cors: CorsSchema,
1186
- // deletionProtection: DeletionProtectionSchema.optional(),
1183
+ static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
1187
1184
  versioning: z32.boolean().default(false).describe("Enable versioning of your store."),
1188
1185
  events: z32.object({
1189
1186
  // create
Binary file
Binary file
Binary file