@awsless/awsless 0.0.218 → 0.0.220

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/README.MD CHANGED
@@ -12,9 +12,14 @@
12
12
 
13
13
  # Features
14
14
 
15
+ - VPC
16
+ - Tests
17
+ - Auth
18
+ - Config
15
19
  - Domains
16
20
  - Sites
17
21
  - Functions
22
+ - Tasks
18
23
  - Database
19
24
  - Tables
20
25
  - Stores
@@ -22,12 +27,12 @@
22
27
  - Searchs
23
28
  - Queues
24
29
  - Topics
25
- - Pubsub
30
+ - Realtime
26
31
  - Crons
27
32
  - API
28
33
  - HTTP
29
34
  - GraphQL
30
-
35
+ - Process Failure Capture
31
36
 
32
37
  ## Domains
33
38
 
@@ -60,6 +65,19 @@ We use AWS Lambda to provide serverless functions.
60
65
  }
61
66
  ```
62
67
 
68
+ ## Tasks
69
+
70
+ We use AWS Async Lambda to provide serverless async tasks.
71
+ Tasks are an lower cost alternative to queues.
72
+
73
+ ```json
74
+ {
75
+ "tasks": {
76
+ "TASK_NAME": "task.ts"
77
+ }
78
+ }
79
+ ```
80
+
63
81
  ## Tables
64
82
 
65
83
  We use AWS DynamoDB to provide serverless tables.
@@ -140,7 +158,7 @@ We use AWS SNS to provide serverless pubsub topics.
140
158
  }
141
159
  ```
142
160
 
143
- ## Pubsub
161
+ ## Realtime
144
162
 
145
163
  We use AWS IoT to provide a serverless mqtt pubsub channel.
146
164
 
package/dist/bin.js CHANGED
@@ -709,7 +709,7 @@ var TopicNameSchema = z22.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Inva
709
709
  var TopicsSchema = z22.array(TopicNameSchema).refine((topics) => {
710
710
  return topics.length === new Set(topics).size;
711
711
  }, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
712
- var SubscribersSchema = z22.record(TopicNameSchema, z22.union([EmailSchema, FunctionSchema])).optional().describe("Define the events to subscribe too in your stack.");
712
+ var SubscribersSchema = z22.record(TopicNameSchema, z22.union([EmailSchema, FunctionSchema])).optional().describe("Define the event topics to subscribe too in your stack.");
713
713
 
714
714
  // src/feature/cron/schema/index.ts
715
715
  import { z as z24 } from "zod";
@@ -2512,11 +2512,10 @@ var functionFeature = defineFeature({
2512
2512
  const resource2 = new TypeObject(2);
2513
2513
  const mock = new TypeObject(2);
2514
2514
  const mockResponse = new TypeObject(2);
2515
- for (const [name, fileOrProps] of Object.entries(stack.functions || {})) {
2515
+ for (const [name, props] of Object.entries(stack.functions || {})) {
2516
2516
  const varName = camelCase3(`${stack.name}-${name}`);
2517
2517
  const funcName = formatLocalResourceName(ctx.appConfig.name, stack.name, "function", name);
2518
- const file = typeof fileOrProps === "string" ? fileOrProps : fileOrProps.file;
2519
- const relFile = relative(directories.types, file);
2518
+ const relFile = relative(directories.types, props.file);
2520
2519
  types2.addImport(varName, relFile);
2521
2520
  resource2.addType(name, `Invoke<'${funcName}', typeof ${varName}>`);
2522
2521
  mock.addType(name, `MockBuilder<typeof ${varName}>`);
@@ -2605,7 +2604,7 @@ var fingerprintFromDirectory = async (dir) => {
2605
2604
  const hashes = /* @__PURE__ */ new Map();
2606
2605
  const files = await readdir2(dir, { recursive: true });
2607
2606
  for (const file of files) {
2608
- if (extensions2.includes(extname3(file).substring(1))) {
2607
+ if (extensions2.includes(extname3(file).substring(1)) && file.at(0) !== "_") {
2609
2608
  await generateFileHashes2(join7(dir, file), hashes);
2610
2609
  }
2611
2610
  }
@@ -4059,11 +4058,10 @@ var taskFeature = defineFeature({
4059
4058
  const resource2 = new TypeObject(2);
4060
4059
  const mock = new TypeObject(2);
4061
4060
  const mockResponse = new TypeObject(2);
4062
- for (const [name, fileOrProps] of Object.entries(stack.functions || {})) {
4061
+ for (const [name, props] of Object.entries(stack.tasks || {})) {
4063
4062
  const varName = camelCase6(`${stack.name}-${name}`);
4064
4063
  const funcName = formatLocalResourceName(ctx.appConfig.name, stack.name, "task", name);
4065
- const file = typeof fileOrProps === "string" ? fileOrProps : fileOrProps.file;
4066
- const relFile = relative4(directories.types, file);
4064
+ const relFile = relative4(directories.types, props.consumer.file);
4067
4065
  types2.addImport(varName, relFile);
4068
4066
  resource2.addType(name, `Invoke<'${funcName}', typeof ${varName}>`);
4069
4067
  mock.addType(name, `MockBuilder<typeof ${varName}>`);
@@ -4083,6 +4081,7 @@ var taskFeature = defineFeature({
4083
4081
  for (const [id, props] of Object.entries(ctx.stackConfig.tasks ?? {})) {
4084
4082
  const group = new Node19(ctx.stack, "task", id);
4085
4083
  const { lambda, policy } = createLambdaFunction(group, ctx, "task", id, props.consumer);
4084
+ lambda.addEnvironment("LOG_VIEWABLE_ERROR", "1");
4086
4085
  const invokeConfig = new aws19.lambda.EventInvokeConfig(group, "config", {
4087
4086
  functionArn: lambda.arn,
4088
4087
  retryAttempts: props.retryAttempts,
@@ -4658,6 +4657,8 @@ var startTest = async (props) => {
4658
4657
  ]
4659
4658
  }
4660
4659
  );
4660
+ console.log("");
4661
+ console.log(result);
4661
4662
  return result;
4662
4663
  };
4663
4664
 
@@ -448,7 +448,7 @@ var TopicNameSchema = z17.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Inva
448
448
  var TopicsSchema = z17.array(TopicNameSchema).refine((topics) => {
449
449
  return topics.length === new Set(topics).size;
450
450
  }, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
451
- var SubscribersSchema = z17.record(TopicNameSchema, z17.union([EmailSchema, FunctionSchema])).optional().describe("Define the events to subscribe too in your stack.");
451
+ var SubscribersSchema = z17.record(TopicNameSchema, z17.union([EmailSchema, FunctionSchema])).optional().describe("Define the event topics to subscribe too in your stack.");
452
452
 
453
453
  // src/feature/cron/schema/index.ts
454
454
  import { z as z19 } from "zod";