alchemy 2.0.0-beta.2 → 2.0.0-beta.test-export-fix-3
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/bin/{alchemy-effect.js → alchemy.js} +173 -173
- package/bin/alchemy.js.map +1 -0
- package/bin/{alchemy-effect.sh → alchemy.sh} +2 -2
- package/lib/cli/index.js +169 -169
- package/lib/cli/index.js.map +1 -1
- package/package.json +75 -67
- package/src/AWS/AGENTS.md +10 -10
- package/src/AWS/Assets.ts +1 -1
- package/src/AWS/Credentials.ts +0 -1
- package/src/AWS/DynamoDB/Table.ts +63 -10
- package/src/AWS/EC2/hosted.ts +1 -1
- package/src/AWS/ECS/Task.ts +1 -1
- package/src/AWS/Kinesis/Stream.ts +44 -8
- package/src/AWS/Lambda/Function.ts +218 -10
- package/src/AWS/S3/Bucket.ts +26 -19
- package/src/AWS/S3/BucketNotifications.ts +1 -1
- package/src/AWS/SNS/Topic.ts +47 -10
- package/src/AWS/SQS/Queue.ts +66 -0
- package/src/Cloudflare/Container/Container.ts +122 -0
- package/src/Cloudflare/Container/ContainerApplication.ts +6 -3
- package/src/Cloudflare/Container/ContainerBinding.ts +2 -4
- package/src/Cloudflare/Container/StartContainer.ts +1 -1
- package/src/Cloudflare/D1/D1Database.ts +23 -4
- package/src/Cloudflare/KV/KVNamespace.ts +25 -0
- package/src/Cloudflare/Providers.ts +1 -6
- package/src/Cloudflare/R2/R2Bucket.ts +45 -2
- package/src/Cloudflare/Website/StaticSite.ts +79 -6
- package/src/Cloudflare/Website/Vite.ts +67 -13
- package/src/Cloudflare/Workers/Assets.ts +170 -207
- package/src/Cloudflare/Workers/DurableObjectNamespace.ts +629 -0
- package/src/Cloudflare/Workers/DurableObjectState.ts +63 -0
- package/src/Cloudflare/Workers/DurableObjectStorage.ts +256 -0
- package/src/Cloudflare/Workers/DynamicWorkerLoader.ts +66 -7
- package/src/Cloudflare/Workers/InferEnv.ts +11 -7
- package/src/Cloudflare/Workers/Rpc.ts +13 -2
- package/src/Cloudflare/Workers/ScheduledEvents.ts +185 -0
- package/src/Cloudflare/Workers/WebSocket.ts +1 -1
- package/src/Cloudflare/Workers/Worker.ts +406 -49
- package/src/Cloudflare/Workers/Workflow.ts +53 -11
- package/src/Cloudflare/Workers/index.ts +4 -1
- package/src/Construct.ts +2 -2
- package/src/GitHub/Comment.ts +224 -0
- package/src/GitHub/Secret.ts +257 -0
- package/src/GitHub/Variable.ts +166 -0
- package/src/GitHub/index.ts +3 -0
- package/src/Kubernetes/client.ts +2 -2
- package/src/Output.ts +1 -1
- package/src/Platform.ts +1 -1
- package/src/Provider.ts +1 -1
- package/src/Test/Vitest.ts +4 -3
- package/src/Util/PlatformServices.ts +21 -0
- package/src/Util/dedent.ts +59 -0
- package/src/Util/index.ts +1 -0
- package/bin/alchemy-effect.js.map +0 -1
- package/src/Cloudflare/Workers/DurableObject.ts +0 -527
- package/src/Daemon/Client.ts +0 -116
- package/src/Daemon/Config.ts +0 -28
- package/src/Daemon/Errors.ts +0 -48
- package/src/Daemon/Lock.ts +0 -162
- package/src/Daemon/ProcessRegistry.ts +0 -284
- package/src/Daemon/RpcSchema.ts +0 -43
- package/src/Daemon/RpcServer.ts +0 -231
- package/src/Daemon/index.ts +0 -27
- package/src/Spawn.ts +0 -23
- /package/bin/{alchemy-effect.ts → alchemy.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alchemy",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.test-export-fix-3",
|
|
4
4
|
"homepage": "https://alchemy.run",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Sam Goodwin <sam@alchemy.run>",
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
"directory": "alchemy"
|
|
11
11
|
},
|
|
12
12
|
"bin": {
|
|
13
|
-
"alchemy": "bin/alchemy
|
|
14
|
-
"alchemy-effect": "bin/alchemy-effect.sh"
|
|
13
|
+
"alchemy": "bin/alchemy.sh"
|
|
15
14
|
},
|
|
16
15
|
"files": [
|
|
17
16
|
"bin",
|
|
@@ -20,181 +19,187 @@
|
|
|
20
19
|
],
|
|
21
20
|
"type": "module",
|
|
22
21
|
"sideEffects": false,
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "tsdown --watch",
|
|
24
|
+
"build": "bun bundle && bun pm pack",
|
|
25
|
+
"bundle": "tsdown",
|
|
26
|
+
"bundle:watch": "tsdown --watch",
|
|
27
|
+
"publish:npm": "cp ../README.md . && bun publish && rm README.md",
|
|
28
|
+
"test:benchmark": "tsx --tsconfig tsconfig.test.json test/types.benchmark.ts"
|
|
29
|
+
},
|
|
23
30
|
"exports": {
|
|
24
31
|
".": {
|
|
25
|
-
"types": "./src/index.d.ts",
|
|
26
32
|
"bun": "./src/index.ts",
|
|
27
33
|
"worker": "./src/index.ts",
|
|
28
|
-
"import": "./lib/index.js"
|
|
34
|
+
"import": "./lib/index.js",
|
|
35
|
+
"types": "./src/index.d.ts"
|
|
29
36
|
},
|
|
30
37
|
"./*": {
|
|
31
|
-
"types": "./src/*.d.ts",
|
|
32
38
|
"bun": "./src/*.ts",
|
|
39
|
+
"import": "./lib/*.js",
|
|
33
40
|
"worker": "./src/*.ts",
|
|
34
|
-
"
|
|
41
|
+
"types": "./src/*.d.ts"
|
|
35
42
|
},
|
|
36
43
|
"./Agent": {
|
|
37
|
-
"types": "./src/Agent/index.d.ts",
|
|
38
44
|
"bun": "./src/Agent/index.ts",
|
|
39
45
|
"worker": "./src/Agent/index.ts",
|
|
40
|
-
"import": "./lib/Agent/index.js"
|
|
46
|
+
"import": "./lib/Agent/index.js",
|
|
47
|
+
"types": "./src/Agent/index.d.ts"
|
|
41
48
|
},
|
|
42
49
|
"./AWS": {
|
|
43
|
-
"types": "./src/AWS/index.d.ts",
|
|
44
50
|
"bun": "./src/AWS/index.ts",
|
|
45
51
|
"worker": "./src/AWS/index.ts",
|
|
46
|
-
"import": "./lib/AWS/index.js"
|
|
52
|
+
"import": "./lib/AWS/index.js",
|
|
53
|
+
"types": "./src/AWS/index.d.ts"
|
|
47
54
|
},
|
|
48
55
|
"./AWS/*": {
|
|
49
|
-
"types": "./src/AWS/*/index.d.ts",
|
|
50
56
|
"bun": "./src/AWS/*/index.ts",
|
|
51
57
|
"worker": "./src/AWS/*/index.ts",
|
|
52
|
-
"import": "./lib/AWS/*/index.js"
|
|
58
|
+
"import": "./lib/AWS/*/index.js",
|
|
59
|
+
"types": "./src/AWS/*/index.d.ts"
|
|
53
60
|
},
|
|
54
61
|
"./AWS/Credentials": {
|
|
55
|
-
"types": "./src/AWS/Credentials/index.d.ts",
|
|
56
62
|
"bun": "./src/AWS/Credentials/index.ts",
|
|
57
63
|
"worker": "./src/AWS/Credentials/index.ts",
|
|
58
|
-
"import": "./lib/AWS/Credentials/index.js"
|
|
64
|
+
"import": "./lib/AWS/Credentials/index.js",
|
|
65
|
+
"types": "./src/AWS/Credentials/index.d.ts"
|
|
59
66
|
},
|
|
60
67
|
"./AWS/Endpoint": {
|
|
61
|
-
"types": "./src/AWS/Endpoint/index.d.ts",
|
|
62
68
|
"bun": "./src/AWS/Endpoint/index.ts",
|
|
63
69
|
"worker": "./src/AWS/Endpoint/index.ts",
|
|
64
|
-
"import": "./lib/AWS/Endpoint/index.js"
|
|
70
|
+
"import": "./lib/AWS/Endpoint/index.js",
|
|
71
|
+
"types": "./src/AWS/Endpoint/index.d.ts"
|
|
65
72
|
},
|
|
66
73
|
"./AWS/Region": {
|
|
67
|
-
"types": "./src/AWS/Region/index.d.ts",
|
|
68
74
|
"bun": "./src/AWS/Region/index.ts",
|
|
69
75
|
"worker": "./src/AWS/Region/index.ts",
|
|
70
|
-
"import": "./lib/AWS/Region/index.js"
|
|
76
|
+
"import": "./lib/AWS/Region/index.js",
|
|
77
|
+
"types": "./src/AWS/Region/index.d.ts"
|
|
71
78
|
},
|
|
72
79
|
"./AWS/Profile": {
|
|
73
|
-
"types": "./src/AWS/Profile/index.d.ts",
|
|
74
80
|
"bun": "./src/AWS/Profile/index.ts",
|
|
75
81
|
"worker": "./src/AWS/Profile/index.ts",
|
|
76
|
-
"import": "./lib/AWS/Profile/index.js"
|
|
82
|
+
"import": "./lib/AWS/Profile/index.js",
|
|
83
|
+
"types": "./src/AWS/Profile/index.d.ts"
|
|
77
84
|
},
|
|
78
85
|
"./AWS/Lambda/*": {
|
|
79
|
-
"types": "./src/AWS/Lambda/*.d.ts",
|
|
80
86
|
"bun": "./src/AWS/Lambda/*.ts",
|
|
81
87
|
"worker": "./src/AWS/Lambda/*.ts",
|
|
82
|
-
"import": "./lib/AWS/Lambda/*.js"
|
|
88
|
+
"import": "./lib/AWS/Lambda/*.js",
|
|
89
|
+
"types": "./src/AWS/Lambda/*.d.ts"
|
|
83
90
|
},
|
|
84
91
|
"./Build": {
|
|
85
|
-
"types": "./src/Build/index.d.ts",
|
|
86
92
|
"bun": "./src/Build/index.ts",
|
|
87
93
|
"worker": "./src/Build/index.ts",
|
|
88
|
-
"import": "./lib/Build/index.js"
|
|
94
|
+
"import": "./lib/Build/index.js",
|
|
95
|
+
"types": "./src/Build/index.d.ts"
|
|
89
96
|
},
|
|
90
97
|
"./Construct": {
|
|
91
|
-
"types": "./src/Construct/index.d.ts",
|
|
92
98
|
"bun": "./src/Construct/index.ts",
|
|
93
99
|
"worker": "./src/Construct/index.ts",
|
|
94
|
-
"import": "./lib/Construct/index.js"
|
|
100
|
+
"import": "./lib/Construct/index.js",
|
|
101
|
+
"types": "./src/Construct/index.d.ts"
|
|
95
102
|
},
|
|
96
103
|
"./Bundle": {
|
|
97
|
-
"types": "./src/Bundle/index.d.ts",
|
|
98
104
|
"bun": "./src/Bundle/index.ts",
|
|
99
105
|
"worker": "./src/Bundle/index.ts",
|
|
100
|
-
"import": "./lib/Bundle/index.js"
|
|
106
|
+
"import": "./lib/Bundle/index.js",
|
|
107
|
+
"types": "./src/Bundle/index.d.ts"
|
|
101
108
|
},
|
|
102
109
|
"./ContentType": {
|
|
103
|
-
"types": "./src/ContentType.d.ts",
|
|
104
110
|
"bun": "./src/ContentType.ts",
|
|
105
111
|
"worker": "./src/ContentType.ts",
|
|
106
|
-
"import": "./lib/ContentType.js"
|
|
112
|
+
"import": "./lib/ContentType.js",
|
|
113
|
+
"types": "./src/ContentType.d.ts"
|
|
107
114
|
},
|
|
108
115
|
"./Cloudflare": {
|
|
109
|
-
"types": "./src/Cloudflare/index.d.ts",
|
|
110
116
|
"bun": "./src/Cloudflare/index.ts",
|
|
111
117
|
"worker": "./src/Cloudflare/index.ts",
|
|
112
|
-
"import": "./lib/Cloudflare/index.js"
|
|
118
|
+
"import": "./lib/Cloudflare/index.js",
|
|
119
|
+
"types": "./src/Cloudflare/index.d.ts"
|
|
113
120
|
},
|
|
114
121
|
"./Cloudflare/Live": {
|
|
115
|
-
"types": "./src/Cloudflare/Live.d.ts",
|
|
116
122
|
"bun": "./src/Cloudflare/Live.ts",
|
|
117
123
|
"worker": "./src/Cloudflare/Live.ts",
|
|
118
|
-
"import": "./lib/Cloudflare/Live.js"
|
|
124
|
+
"import": "./lib/Cloudflare/Live.js",
|
|
125
|
+
"types": "./src/Cloudflare/Live.d.ts"
|
|
119
126
|
},
|
|
120
127
|
"./Cloudflare/*": {
|
|
121
|
-
"types": "./src/Cloudflare/*/index.d.ts",
|
|
122
128
|
"bun": "./src/Cloudflare/*/index.ts",
|
|
123
129
|
"worker": "./src/Cloudflare/*/index.ts",
|
|
124
|
-
"import": "./lib/Cloudflare/*/index.js"
|
|
130
|
+
"import": "./lib/Cloudflare/*/index.js",
|
|
131
|
+
"types": "./src/Cloudflare/*/index.d.ts"
|
|
132
|
+
},
|
|
133
|
+
"./GitHub": {
|
|
134
|
+
"bun": "./src/GitHub/index.ts",
|
|
135
|
+
"worker": "./src/GitHub/index.ts",
|
|
136
|
+
"import": "./lib/GitHub/index.js",
|
|
137
|
+
"types": "./src/GitHub/index.d.ts"
|
|
125
138
|
},
|
|
126
139
|
"./Endpoint": {
|
|
127
|
-
"types": "./src/Endpoint/index.d.ts",
|
|
128
140
|
"bun": "./src/Endpoint/index.ts",
|
|
129
141
|
"worker": "./src/Endpoint/index.ts",
|
|
130
|
-
"import": "./lib/Endpoint/index.js"
|
|
142
|
+
"import": "./lib/Endpoint/index.js",
|
|
143
|
+
"types": "./src/Endpoint/index.d.ts"
|
|
131
144
|
},
|
|
132
145
|
"./Kubernetes": {
|
|
133
|
-
"types": "./src/Kubernetes/index.d.ts",
|
|
134
146
|
"bun": "./src/Kubernetes/index.ts",
|
|
135
147
|
"worker": "./src/Kubernetes/index.ts",
|
|
136
|
-
"import": "./lib/Kubernetes/index.js"
|
|
148
|
+
"import": "./lib/Kubernetes/index.js",
|
|
149
|
+
"types": "./src/Kubernetes/index.d.ts"
|
|
137
150
|
},
|
|
138
151
|
"./Output": {
|
|
139
|
-
"types": "./src/Output.d.ts",
|
|
140
152
|
"bun": "./src/Output.ts",
|
|
141
153
|
"worker": "./src/Output.ts",
|
|
142
|
-
"import": "./lib/Output.js"
|
|
154
|
+
"import": "./lib/Output.js",
|
|
155
|
+
"types": "./src/Output.d.ts"
|
|
143
156
|
},
|
|
144
157
|
"./Process": {
|
|
145
|
-
"types": "./src/Process/index.d.ts",
|
|
146
158
|
"bun": "./src/Process/index.ts",
|
|
147
159
|
"worker": "./src/Process/index.ts",
|
|
148
|
-
"import": "./lib/Process/index.js"
|
|
160
|
+
"import": "./lib/Process/index.js",
|
|
161
|
+
"types": "./src/Process/index.d.ts"
|
|
149
162
|
},
|
|
150
163
|
"./SQLite": {
|
|
151
|
-
"types": "./src/SQLite/index.d.ts",
|
|
152
164
|
"bun": "./src/SQLite/index.ts",
|
|
153
165
|
"worker": "./src/SQLite/index.ts",
|
|
154
|
-
"import": "./lib/SQLite/index.js"
|
|
166
|
+
"import": "./lib/SQLite/index.js",
|
|
167
|
+
"types": "./src/SQLite/index.d.ts"
|
|
155
168
|
},
|
|
156
169
|
"./TUI": {
|
|
157
|
-
"types": "./src/TUI/index.d.ts",
|
|
158
170
|
"bun": "./src/TUI/index.ts",
|
|
159
171
|
"worker": "./src/TUI/index.ts",
|
|
160
|
-
"import": "./lib/TUI/index.js"
|
|
172
|
+
"import": "./lib/TUI/index.js",
|
|
173
|
+
"types": "./src/TUI/index.d.ts"
|
|
161
174
|
},
|
|
162
175
|
"./Server": {
|
|
163
|
-
"types": "./src/Server/index.d.ts",
|
|
164
176
|
"bun": "./src/Server/index.ts",
|
|
165
177
|
"worker": "./src/Server/index.ts",
|
|
166
|
-
"import": "./lib/Server/index.js"
|
|
178
|
+
"import": "./lib/Server/index.js",
|
|
179
|
+
"types": "./src/Server/index.d.ts"
|
|
167
180
|
},
|
|
168
181
|
"./State": {
|
|
169
|
-
"types": "./src/State/index.d.ts",
|
|
170
182
|
"bun": "./src/State/index.ts",
|
|
171
183
|
"worker": "./src/State/index.ts",
|
|
172
|
-
"import": "./lib/State/index.js"
|
|
184
|
+
"import": "./lib/State/index.js",
|
|
185
|
+
"types": "./src/State/index.d.ts"
|
|
173
186
|
},
|
|
174
187
|
"./Test/Bun": {
|
|
175
|
-
"types": "./src/Test/Bun.d.ts",
|
|
176
188
|
"bun": "./src/Test/Bun.ts",
|
|
177
189
|
"worker": "./src/Test/Bun.ts",
|
|
178
|
-
"import": "./lib/Test/Bun.js"
|
|
190
|
+
"import": "./lib/Test/Bun.js",
|
|
191
|
+
"types": "./src/Test/Bun.d.ts"
|
|
179
192
|
},
|
|
180
193
|
"./Util": {
|
|
181
|
-
"types": "./src/Util/index.d.ts",
|
|
182
194
|
"bun": "./src/Util/index.ts",
|
|
183
195
|
"worker": "./src/Util/index.ts",
|
|
184
|
-
"import": "./lib/Util/index.js"
|
|
196
|
+
"import": "./lib/Util/index.js",
|
|
197
|
+
"types": "./src/Util/index.d.ts"
|
|
185
198
|
}
|
|
186
199
|
},
|
|
187
200
|
"publishConfig": {
|
|
188
201
|
"access": "public"
|
|
189
202
|
},
|
|
190
|
-
"scripts": {
|
|
191
|
-
"dev": "tsdown --watch",
|
|
192
|
-
"build": "bun bundle && bun pm pack",
|
|
193
|
-
"bundle": "tsdown",
|
|
194
|
-
"bundle:watch": "tsdown --watch",
|
|
195
|
-
"publish:npm": "cp ../README.md . && bun publish && rm README.md",
|
|
196
|
-
"test:benchmark": "tsx --tsconfig tsconfig.test.json test/types.benchmark.ts"
|
|
197
|
-
},
|
|
198
203
|
"dependencies": {
|
|
199
204
|
"@ai-sdk/anthropic": "^3.0.31",
|
|
200
205
|
"@ai-sdk/openai": "^3.0.23",
|
|
@@ -202,15 +207,17 @@
|
|
|
202
207
|
"@aws-sdk/credential-providers": "^3.0.0",
|
|
203
208
|
"@distilled.cloud/aws": "^0.10.0",
|
|
204
209
|
"@distilled.cloud/cloudflare": "^0.10.0",
|
|
205
|
-
"@distilled.cloud/cloudflare-rolldown-plugin": "0.
|
|
206
|
-
"@distilled.cloud/cloudflare-vite-plugin": "0.
|
|
210
|
+
"@distilled.cloud/cloudflare-rolldown-plugin": "0.3.0",
|
|
211
|
+
"@distilled.cloud/cloudflare-vite-plugin": "0.2.0",
|
|
207
212
|
"@distilled.cloud/core": "^0.10.0",
|
|
208
213
|
"@effect/vitest": "4.0.0-beta.48",
|
|
209
214
|
"@libsql/client": "^0.17.0",
|
|
215
|
+
"@octokit/rest": "^22.0.1",
|
|
210
216
|
"@smithy/node-config-provider": "^4.0.0",
|
|
211
217
|
"@smithy/shared-ini-file-loader": "^4.3.4",
|
|
212
218
|
"@smithy/types": "^4.8.1",
|
|
213
219
|
"@types/aws-lambda": "^8.10.152",
|
|
220
|
+
"@types/libsodium-wrappers": "^0.8.2",
|
|
214
221
|
"ai": "^6.0.62",
|
|
215
222
|
"aws4fetch": "^1.0.20",
|
|
216
223
|
"capnp-es": "^0.0.14",
|
|
@@ -219,6 +226,7 @@
|
|
|
219
226
|
"fast-xml-parser": "^5.3.4",
|
|
220
227
|
"ignore": "^7.0.5",
|
|
221
228
|
"jszip": "^3.10.1",
|
|
229
|
+
"libsodium-wrappers": "^0.8.3",
|
|
222
230
|
"rolldown": "1.0.0-rc.13",
|
|
223
231
|
"solid-js": "latest",
|
|
224
232
|
"sonda": "^0.11.1",
|
package/src/AWS/AGENTS.md
CHANGED
|
@@ -51,7 +51,7 @@ Bindings are:
|
|
|
51
51
|
|
|
52
52
|
- one file per operation
|
|
53
53
|
- `Binding.Service` + `Binding.Policy`
|
|
54
|
-
- usually named `alchemy
|
|
54
|
+
- usually named `alchemy/src/AWS/<Service>/<Operation>.ts`
|
|
55
55
|
|
|
56
56
|
### 2. Resource
|
|
57
57
|
|
|
@@ -73,10 +73,10 @@ Use an event source when the service can push records/events into a runtime.
|
|
|
73
73
|
|
|
74
74
|
This always has two layers:
|
|
75
75
|
|
|
76
|
-
1. Service-level abstraction in `alchemy
|
|
76
|
+
1. Service-level abstraction in `alchemy/src/AWS/<Service>/...`
|
|
77
77
|
2. Runtime-specific implementation in places like:
|
|
78
|
-
- `alchemy
|
|
79
|
-
- `alchemy
|
|
78
|
+
- `alchemy/src/AWS/Lambda/...`
|
|
79
|
+
- `alchemy/src/Process/...`
|
|
80
80
|
|
|
81
81
|
Examples:
|
|
82
82
|
|
|
@@ -248,8 +248,8 @@ Example:
|
|
|
248
248
|
|
|
249
249
|
After each binding/resource implementation, update:
|
|
250
250
|
|
|
251
|
-
1. `alchemy
|
|
252
|
-
2. `alchemy
|
|
251
|
+
1. `alchemy/src/AWS/<Service>/index.ts`
|
|
252
|
+
2. `alchemy/src/AWS/Providers.ts`
|
|
253
253
|
|
|
254
254
|
If registration is missing, audit should flag it.
|
|
255
255
|
|
|
@@ -257,7 +257,7 @@ If registration is missing, audit should flag it.
|
|
|
257
257
|
|
|
258
258
|
Every implemented binding should have a corresponding `describe("<BindingName>")` block in:
|
|
259
259
|
|
|
260
|
-
- `alchemy
|
|
260
|
+
- `alchemy/test/AWS/<Service>/Bindings.test.ts`
|
|
261
261
|
|
|
262
262
|
Examples:
|
|
263
263
|
|
|
@@ -282,7 +282,7 @@ Deterministic rule:
|
|
|
282
282
|
|
|
283
283
|
Use a real Lambda fixture in:
|
|
284
284
|
|
|
285
|
-
- `alchemy
|
|
285
|
+
- `alchemy/test/AWS/<Service>/handler.ts`
|
|
286
286
|
|
|
287
287
|
Pattern:
|
|
288
288
|
|
|
@@ -412,8 +412,8 @@ Required shape:
|
|
|
412
412
|
- `Table` keeps stream state in its attributes, but does not accept `streamSpecification` as a plain input prop
|
|
413
413
|
- stream enablement is requested through the table binding contract
|
|
414
414
|
- the public helper is `streams(table).process(...)`
|
|
415
|
-
- the service-level abstraction lives in `alchemy
|
|
416
|
-
- the Lambda runtime implementation lives in `alchemy
|
|
415
|
+
- the service-level abstraction lives in `alchemy/src/AWS/DynamoDB/Stream.ts`
|
|
416
|
+
- the Lambda runtime implementation lives in `alchemy/src/AWS/Lambda/TableEventSource.ts`
|
|
417
417
|
|
|
418
418
|
Why this pattern exists:
|
|
419
419
|
|
package/src/AWS/Assets.ts
CHANGED
|
@@ -152,7 +152,7 @@ export const assetsLayer = Layer.effect(
|
|
|
152
152
|
if (Option.isNone(maybeBucket)) {
|
|
153
153
|
return yield* Effect.fail(
|
|
154
154
|
new Error(
|
|
155
|
-
"Assets bucket not found. Run 'alchemy
|
|
155
|
+
"Assets bucket not found. Run 'alchemy bootstrap' to create it.",
|
|
156
156
|
),
|
|
157
157
|
);
|
|
158
158
|
}
|
package/src/AWS/Credentials.ts
CHANGED
|
@@ -7,7 +7,6 @@ import * as Effect from "effect/Effect";
|
|
|
7
7
|
import * as Layer from "effect/Layer";
|
|
8
8
|
import * as Option from "effect/Option";
|
|
9
9
|
import { Profile } from "./Profile.ts";
|
|
10
|
-
|
|
11
10
|
import { StageConfig } from "./StageConfig.ts";
|
|
12
11
|
|
|
13
12
|
export { Credentials } from "@distilled.cloud/aws/Credentials";
|
|
@@ -115,7 +115,9 @@ export interface Table extends Resource<
|
|
|
115
115
|
* @section Creating Tables
|
|
116
116
|
* @example Basic Table
|
|
117
117
|
* ```typescript
|
|
118
|
-
*
|
|
118
|
+
* import * as DynamoDB from "alchemy/AWS/DynamoDB";
|
|
119
|
+
*
|
|
120
|
+
* const table = yield* DynamoDB.Table("UsersTable", {
|
|
119
121
|
* partitionKey: "pk",
|
|
120
122
|
* attributes: {
|
|
121
123
|
* pk: "S",
|
|
@@ -125,7 +127,7 @@ export interface Table extends Resource<
|
|
|
125
127
|
*
|
|
126
128
|
* @example Table with Sort Key and TTL
|
|
127
129
|
* ```typescript
|
|
128
|
-
* const table = yield* Table("SessionsTable", {
|
|
130
|
+
* const table = yield* DynamoDB.Table("SessionsTable", {
|
|
129
131
|
* partitionKey: "userId",
|
|
130
132
|
* sortKey: "sessionId",
|
|
131
133
|
* attributes: {
|
|
@@ -140,18 +142,69 @@ export interface Table extends Resource<
|
|
|
140
142
|
* });
|
|
141
143
|
* ```
|
|
142
144
|
*
|
|
143
|
-
* @
|
|
144
|
-
* @example Read an Item
|
|
145
|
+
* @example Table with Global Secondary Index
|
|
145
146
|
* ```typescript
|
|
146
|
-
* const
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
* pk:
|
|
147
|
+
* const table = yield* DynamoDB.Table("OrdersTable", {
|
|
148
|
+
* partitionKey: "pk",
|
|
149
|
+
* sortKey: "sk",
|
|
150
|
+
* attributes: {
|
|
151
|
+
* pk: "S",
|
|
152
|
+
* sk: "S",
|
|
153
|
+
* gsi1pk: "S",
|
|
154
|
+
* gsi1sk: "S",
|
|
151
155
|
* },
|
|
152
|
-
*
|
|
156
|
+
* globalSecondaryIndexes: [{
|
|
157
|
+
* IndexName: "GSI1",
|
|
158
|
+
* KeySchema: [
|
|
159
|
+
* { AttributeName: "gsi1pk", KeyType: "HASH" },
|
|
160
|
+
* { AttributeName: "gsi1sk", KeyType: "RANGE" },
|
|
161
|
+
* ],
|
|
162
|
+
* Projection: { ProjectionType: "ALL" },
|
|
163
|
+
* }],
|
|
153
164
|
* });
|
|
154
165
|
* ```
|
|
166
|
+
*
|
|
167
|
+
* @section Runtime Operations
|
|
168
|
+
* Bind DynamoDB operations in the init phase and use them in runtime
|
|
169
|
+
* handlers. Bindings inject the table name and grant scoped IAM
|
|
170
|
+
* permissions automatically.
|
|
171
|
+
*
|
|
172
|
+
* @example Read and write items
|
|
173
|
+
* ```typescript
|
|
174
|
+
* // init
|
|
175
|
+
* const getItem = yield* DynamoDB.GetItem.bind(table);
|
|
176
|
+
* const putItem = yield* DynamoDB.PutItem.bind(table);
|
|
177
|
+
*
|
|
178
|
+
* return {
|
|
179
|
+
* fetch: Effect.gen(function* () {
|
|
180
|
+
* // runtime
|
|
181
|
+
* yield* putItem({
|
|
182
|
+
* Item: { pk: { S: "user#123" }, name: { S: "Alice" } },
|
|
183
|
+
* });
|
|
184
|
+
* const result = yield* getItem({
|
|
185
|
+
* Key: { pk: { S: "user#123" } },
|
|
186
|
+
* });
|
|
187
|
+
* return yield* HttpServerResponse.json(result.Item);
|
|
188
|
+
* }),
|
|
189
|
+
* };
|
|
190
|
+
* ```
|
|
191
|
+
*
|
|
192
|
+
* @section DynamoDB Streams
|
|
193
|
+
* Process change data capture events from a DynamoDB table using a
|
|
194
|
+
* Lambda event source mapping. The stream is enabled automatically
|
|
195
|
+
* through the binding contract.
|
|
196
|
+
*
|
|
197
|
+
* @example Process table changes
|
|
198
|
+
* ```typescript
|
|
199
|
+
* // init
|
|
200
|
+
* yield* DynamoDB.streams(table, {
|
|
201
|
+
* StreamViewType: "NEW_AND_OLD_IMAGES",
|
|
202
|
+
* }).process(
|
|
203
|
+
* Effect.fn(function* (record) {
|
|
204
|
+
* yield* Effect.log(`${record.eventName}: ${JSON.stringify(record.dynamodb)}`);
|
|
205
|
+
* }),
|
|
206
|
+
* );
|
|
207
|
+
* ```
|
|
155
208
|
*/
|
|
156
209
|
export const Table = Resource<Table>("AWS.DynamoDB.Table");
|
|
157
210
|
|
package/src/AWS/EC2/hosted.ts
CHANGED
|
@@ -223,7 +223,7 @@ export const createEc2HostedSupport = ({
|
|
|
223
223
|
virtualEntryPlugin(
|
|
224
224
|
(importPath) => `
|
|
225
225
|
import { NodeServices } from "@effect/platform-node";
|
|
226
|
-
import { Stack } from "alchemy
|
|
226
|
+
import { Stack } from "alchemy/Stack";
|
|
227
227
|
import * as Config from "effect/Config";
|
|
228
228
|
import * as ConfigProvider from "effect/ConfigProvider";
|
|
229
229
|
import * as Credentials from "@distilled.cloud/aws/Credentials";
|
package/src/AWS/ECS/Task.ts
CHANGED
|
@@ -486,7 +486,7 @@ export const TaskProvider = () =>
|
|
|
486
486
|
virtualEntryPlugin(
|
|
487
487
|
(importPath) => `
|
|
488
488
|
import { NodeServices } from "@effect/platform-node";
|
|
489
|
-
import { Stack } from "alchemy
|
|
489
|
+
import { Stack } from "alchemy/Stack";
|
|
490
490
|
import * as Config from "effect/Config";
|
|
491
491
|
import * as ConfigProvider from "effect/ConfigProvider";
|
|
492
492
|
import * as Credentials from "@distilled.cloud/aws/Credentials";
|
|
@@ -170,32 +170,68 @@ export interface Stream extends Resource<
|
|
|
170
170
|
*
|
|
171
171
|
* `Stream` owns the stream's lifecycle and mutable control-plane configuration,
|
|
172
172
|
* including retention, encryption, monitoring, warm throughput, record size, tags,
|
|
173
|
-
* and stream resource policy.
|
|
173
|
+
* and stream resource policy. A stream name is auto-generated from the app,
|
|
174
|
+
* stage, and logical ID unless you provide one explicitly.
|
|
174
175
|
*
|
|
175
176
|
* @section Creating Streams
|
|
176
177
|
* @example On-Demand Stream
|
|
177
178
|
* ```typescript
|
|
178
|
-
*
|
|
179
|
+
* import * as Kinesis from "alchemy/AWS/Kinesis";
|
|
180
|
+
*
|
|
181
|
+
* const stream = yield* Kinesis.Stream("OrdersStream");
|
|
179
182
|
* ```
|
|
180
183
|
*
|
|
181
184
|
* @example Provisioned Stream
|
|
182
185
|
* ```typescript
|
|
183
|
-
* const stream = yield* Stream("AnalyticsStream", {
|
|
186
|
+
* const stream = yield* Kinesis.Stream("AnalyticsStream", {
|
|
184
187
|
* streamMode: "PROVISIONED",
|
|
185
188
|
* shardCount: 2,
|
|
186
189
|
* retentionPeriodHours: 48,
|
|
187
190
|
* });
|
|
188
191
|
* ```
|
|
189
192
|
*
|
|
193
|
+
* @example Encrypted Stream
|
|
194
|
+
* ```typescript
|
|
195
|
+
* const stream = yield* Kinesis.Stream("SecureStream", {
|
|
196
|
+
* encryption: true,
|
|
197
|
+
* kmsKeyId: "alias/my-key",
|
|
198
|
+
* });
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
190
201
|
* @section Runtime Producers
|
|
191
|
-
*
|
|
202
|
+
* Bind producer operations in the init phase and use them in runtime
|
|
203
|
+
* handlers.
|
|
204
|
+
*
|
|
205
|
+
* @example Put a record from a handler
|
|
192
206
|
* ```typescript
|
|
207
|
+
* // init
|
|
193
208
|
* const putRecord = yield* Kinesis.PutRecord.bind(stream);
|
|
194
209
|
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
210
|
+
* return {
|
|
211
|
+
* fetch: Effect.gen(function* () {
|
|
212
|
+
* // runtime
|
|
213
|
+
* yield* putRecord({
|
|
214
|
+
* PartitionKey: "order-123",
|
|
215
|
+
* Data: new TextEncoder().encode(JSON.stringify({ orderId: "123" })),
|
|
216
|
+
* });
|
|
217
|
+
* return HttpServerResponse.text("Sent");
|
|
218
|
+
* }),
|
|
219
|
+
* };
|
|
220
|
+
* ```
|
|
221
|
+
*
|
|
222
|
+
* @section Event Sources
|
|
223
|
+
* Process records from a Kinesis stream using a Lambda event source
|
|
224
|
+
* mapping.
|
|
225
|
+
*
|
|
226
|
+
* @example Process stream records
|
|
227
|
+
* ```typescript
|
|
228
|
+
* // init
|
|
229
|
+
* yield* Kinesis.records(stream).process(
|
|
230
|
+
* Effect.fn(function* (record) {
|
|
231
|
+
* const data = new TextDecoder().decode(record.data);
|
|
232
|
+
* yield* Effect.log(`Received: ${data}`);
|
|
233
|
+
* }),
|
|
234
|
+
* );
|
|
199
235
|
* ```
|
|
200
236
|
*/
|
|
201
237
|
export const Stream = Resource<Stream>("AWS.Kinesis.Stream");
|