Skip to content

Commit 465f3e5

Browse files
committed
fix callback support
1 parent 0eb9a4e commit 465f3e5

16 files changed

Lines changed: 9188 additions & 11430 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ All notable changes to this project will be documented in this file.
55

66
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
77

8+
9+
## [0.1.17] 2023-07-24
10+
11+
- fix callback support
12+
813
## [0.1.16] 2023-07-17
914

1015
- fix
11-
1216

1317
The latest layer is: `arn:aws:lambda:${your-region-here}:097948374213:layer:baselime-node:12`
1418

examples/sst/package-lock.json

Lines changed: 9124 additions & 11367 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/sst/package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@
1212
"typecheck": "tsc --noEmit"
1313
},
1414
"devDependencies": {
15-
"@tsconfig/node16": "^1.0.4",
16-
"aws-cdk-lib": "2.79.1",
15+
"sst": "^2.22.5",
16+
"aws-cdk-lib": "2.84.0",
1717
"constructs": "10.1.156",
18-
"sst": "^2.13.2",
19-
"typescript": "^5.1.3"
18+
"typescript": "^5.1.6",
19+
"@tsconfig/node16": "^16.1.0"
2020
},
2121
"workspaces": [
2222
"packages/*"
23-
],
24-
"dependencies": {
25-
"@aws-sdk/client-lambda": "^3.370.0"
26-
}
27-
}
23+
]
24+
}

examples/sst/packages/core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"typecheck": "tsc -noEmit"
88
},
99
"devDependencies": {
10-
"vitest": "^0.32.0",
11-
"@types/node": "^20.3.1",
12-
"sst": "^2.13.2"
10+
"vitest": "^0.33.0",
11+
"@types/node": "^20.4.4",
12+
"sst": "^2.22.5"
1313
},
1414
"dependencies": {
1515
"zod": "^3.21.4"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "@tsconfig/node16/tsconfig.json",
33
"compilerOptions": {
4-
"module": "esnext"
4+
"module": "esnext",
5+
"moduleResolution": "node"
56
}
67
}

examples/sst/packages/functions/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"typecheck": "tsc -noEmit"
88
},
99
"devDependencies": {
10-
"@types/node": "^20.3.1",
11-
"@types/aws-lambda": "^8.10.117",
12-
"vitest": "^0.32.0",
13-
"sst": "^2.13.2"
10+
"@types/node": "^20.4.4",
11+
"@types/aws-lambda": "^8.10.119",
12+
"vitest": "^0.33.0",
13+
"sst": "^2.22.5"
1414
}
1515
}
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { EventHandler } from "sst/node/event-bus";
2+
import { Todo } from "@sst/core/todo";
13

2-
3-
export const handler = () => {
4-
console.log("TODO CREATED");
5-
}
4+
export const handler = EventHandler(Todo.Events.Created, async (evt) => {
5+
console.log("Todo created", evt);
6+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { ApiHandler } from "sst/node/api";
2+
3+
export const handler = ApiHandler(async (_evt) => {
4+
return {
5+
statusCode: 200,
6+
body: `Hello world. The time is ${new Date().toISOString()}`,
7+
};
8+
});
Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
import { LambdaClient, ListFunctionsCommand } from "@aws-sdk/client-lambda";
1+
import { ApiHandler } from "sst/node/api";
2+
import { Todo } from "@sst/core/todo";
23

3-
export const handler = async () => {
4-
console.log("TODO LIST", JSON.stringify({ MESSAGE: [{ id: 1, text: "TODO 1" }] }));
5-
const client = new LambdaClient({});
6-
const command = new ListFunctionsCommand({});
7-
const response = await client.send(command);
8-
console.log("response", response)
4+
export const create = ApiHandler(async (_evt) => {
5+
await Todo.create();
6+
7+
return {
8+
statusCode: 200,
9+
body: "Todo created",
10+
};
11+
});
12+
13+
export const list = ApiHandler(async (_evt) => {
914
return {
1015
statusCode: 200,
11-
body: JSON.stringify({ MESSAGE: [{ id: 1, text: "TODO 1" }] }),
12-
}
13-
}
16+
body: JSON.stringify(Todo.list()),
17+
};
18+
});

examples/sst/packages/functions/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"extends": "@tsconfig/node16/tsconfig.json",
33
"compilerOptions": {
44
"module": "esnext",
5+
"moduleResolution": "node",
56
"baseUrl": ".",
67
"paths": {
78
"@sst/core/*": ["../core/src/*"]

0 commit comments

Comments
 (0)