alchemy 2.0.0-beta.3 → 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} +172 -172
- 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 +60 -61
- 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/ContainerApplication.ts +3 -3
- package/src/Cloudflare/Container/ContainerBinding.ts +2 -4
- package/src/Cloudflare/Container/StartContainer.ts +1 -1
- package/src/Cloudflare/Providers.ts +1 -6
- package/src/Cloudflare/R2/R2Bucket.ts +2 -2
- package/src/Cloudflare/Website/StaticSite.ts +22 -6
- package/src/Cloudflare/Website/Vite.ts +15 -5
- package/src/Cloudflare/Workers/Assets.ts +170 -207
- package/src/Cloudflare/Workers/DurableObjectNamespace.ts +230 -370
- package/src/Cloudflare/Workers/DurableObjectState.ts +63 -0
- package/src/Cloudflare/Workers/DurableObjectStorage.ts +256 -0
- 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 +95 -43
- package/src/Cloudflare/Workers/index.ts +3 -0
- package/src/Construct.ts +2 -2
- package/src/GitHub/Secret.ts +52 -7
- package/src/GitHub/Variable.ts +45 -2
- package/src/Kubernetes/client.ts +2 -2
- package/src/Output.ts +1 -1
- package/src/Platform.ts +1 -1
- package/src/Test/Vitest.ts +4 -3
- package/src/Util/PlatformServices.ts +21 -0
- package/src/Util/dedent.ts +4 -1
- package/bin/alchemy-effect.js.map +0 -1
- 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",
|
|
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",
|
|
@@ -30,172 +29,172 @@
|
|
|
30
29
|
},
|
|
31
30
|
"exports": {
|
|
32
31
|
".": {
|
|
33
|
-
"types": "./src/index.d.ts",
|
|
34
32
|
"bun": "./src/index.ts",
|
|
35
33
|
"worker": "./src/index.ts",
|
|
36
|
-
"import": "./lib/index.js"
|
|
34
|
+
"import": "./lib/index.js",
|
|
35
|
+
"types": "./src/index.d.ts"
|
|
37
36
|
},
|
|
38
37
|
"./*": {
|
|
39
|
-
"types": "./src/*.d.ts",
|
|
40
38
|
"bun": "./src/*.ts",
|
|
39
|
+
"import": "./lib/*.js",
|
|
41
40
|
"worker": "./src/*.ts",
|
|
42
|
-
"
|
|
41
|
+
"types": "./src/*.d.ts"
|
|
43
42
|
},
|
|
44
43
|
"./Agent": {
|
|
45
|
-
"types": "./src/Agent/index.d.ts",
|
|
46
44
|
"bun": "./src/Agent/index.ts",
|
|
47
45
|
"worker": "./src/Agent/index.ts",
|
|
48
|
-
"import": "./lib/Agent/index.js"
|
|
46
|
+
"import": "./lib/Agent/index.js",
|
|
47
|
+
"types": "./src/Agent/index.d.ts"
|
|
49
48
|
},
|
|
50
49
|
"./AWS": {
|
|
51
|
-
"types": "./src/AWS/index.d.ts",
|
|
52
50
|
"bun": "./src/AWS/index.ts",
|
|
53
51
|
"worker": "./src/AWS/index.ts",
|
|
54
|
-
"import": "./lib/AWS/index.js"
|
|
52
|
+
"import": "./lib/AWS/index.js",
|
|
53
|
+
"types": "./src/AWS/index.d.ts"
|
|
55
54
|
},
|
|
56
55
|
"./AWS/*": {
|
|
57
|
-
"types": "./src/AWS/*/index.d.ts",
|
|
58
56
|
"bun": "./src/AWS/*/index.ts",
|
|
59
57
|
"worker": "./src/AWS/*/index.ts",
|
|
60
|
-
"import": "./lib/AWS/*/index.js"
|
|
58
|
+
"import": "./lib/AWS/*/index.js",
|
|
59
|
+
"types": "./src/AWS/*/index.d.ts"
|
|
61
60
|
},
|
|
62
61
|
"./AWS/Credentials": {
|
|
63
|
-
"types": "./src/AWS/Credentials/index.d.ts",
|
|
64
62
|
"bun": "./src/AWS/Credentials/index.ts",
|
|
65
63
|
"worker": "./src/AWS/Credentials/index.ts",
|
|
66
|
-
"import": "./lib/AWS/Credentials/index.js"
|
|
64
|
+
"import": "./lib/AWS/Credentials/index.js",
|
|
65
|
+
"types": "./src/AWS/Credentials/index.d.ts"
|
|
67
66
|
},
|
|
68
67
|
"./AWS/Endpoint": {
|
|
69
|
-
"types": "./src/AWS/Endpoint/index.d.ts",
|
|
70
68
|
"bun": "./src/AWS/Endpoint/index.ts",
|
|
71
69
|
"worker": "./src/AWS/Endpoint/index.ts",
|
|
72
|
-
"import": "./lib/AWS/Endpoint/index.js"
|
|
70
|
+
"import": "./lib/AWS/Endpoint/index.js",
|
|
71
|
+
"types": "./src/AWS/Endpoint/index.d.ts"
|
|
73
72
|
},
|
|
74
73
|
"./AWS/Region": {
|
|
75
|
-
"types": "./src/AWS/Region/index.d.ts",
|
|
76
74
|
"bun": "./src/AWS/Region/index.ts",
|
|
77
75
|
"worker": "./src/AWS/Region/index.ts",
|
|
78
|
-
"import": "./lib/AWS/Region/index.js"
|
|
76
|
+
"import": "./lib/AWS/Region/index.js",
|
|
77
|
+
"types": "./src/AWS/Region/index.d.ts"
|
|
79
78
|
},
|
|
80
79
|
"./AWS/Profile": {
|
|
81
|
-
"types": "./src/AWS/Profile/index.d.ts",
|
|
82
80
|
"bun": "./src/AWS/Profile/index.ts",
|
|
83
81
|
"worker": "./src/AWS/Profile/index.ts",
|
|
84
|
-
"import": "./lib/AWS/Profile/index.js"
|
|
82
|
+
"import": "./lib/AWS/Profile/index.js",
|
|
83
|
+
"types": "./src/AWS/Profile/index.d.ts"
|
|
85
84
|
},
|
|
86
85
|
"./AWS/Lambda/*": {
|
|
87
|
-
"types": "./src/AWS/Lambda/*.d.ts",
|
|
88
86
|
"bun": "./src/AWS/Lambda/*.ts",
|
|
89
87
|
"worker": "./src/AWS/Lambda/*.ts",
|
|
90
|
-
"import": "./lib/AWS/Lambda/*.js"
|
|
88
|
+
"import": "./lib/AWS/Lambda/*.js",
|
|
89
|
+
"types": "./src/AWS/Lambda/*.d.ts"
|
|
91
90
|
},
|
|
92
91
|
"./Build": {
|
|
93
|
-
"types": "./src/Build/index.d.ts",
|
|
94
92
|
"bun": "./src/Build/index.ts",
|
|
95
93
|
"worker": "./src/Build/index.ts",
|
|
96
|
-
"import": "./lib/Build/index.js"
|
|
94
|
+
"import": "./lib/Build/index.js",
|
|
95
|
+
"types": "./src/Build/index.d.ts"
|
|
97
96
|
},
|
|
98
97
|
"./Construct": {
|
|
99
|
-
"types": "./src/Construct/index.d.ts",
|
|
100
98
|
"bun": "./src/Construct/index.ts",
|
|
101
99
|
"worker": "./src/Construct/index.ts",
|
|
102
|
-
"import": "./lib/Construct/index.js"
|
|
100
|
+
"import": "./lib/Construct/index.js",
|
|
101
|
+
"types": "./src/Construct/index.d.ts"
|
|
103
102
|
},
|
|
104
103
|
"./Bundle": {
|
|
105
|
-
"types": "./src/Bundle/index.d.ts",
|
|
106
104
|
"bun": "./src/Bundle/index.ts",
|
|
107
105
|
"worker": "./src/Bundle/index.ts",
|
|
108
|
-
"import": "./lib/Bundle/index.js"
|
|
106
|
+
"import": "./lib/Bundle/index.js",
|
|
107
|
+
"types": "./src/Bundle/index.d.ts"
|
|
109
108
|
},
|
|
110
109
|
"./ContentType": {
|
|
111
|
-
"types": "./src/ContentType.d.ts",
|
|
112
110
|
"bun": "./src/ContentType.ts",
|
|
113
111
|
"worker": "./src/ContentType.ts",
|
|
114
|
-
"import": "./lib/ContentType.js"
|
|
112
|
+
"import": "./lib/ContentType.js",
|
|
113
|
+
"types": "./src/ContentType.d.ts"
|
|
115
114
|
},
|
|
116
115
|
"./Cloudflare": {
|
|
117
|
-
"types": "./src/Cloudflare/index.d.ts",
|
|
118
116
|
"bun": "./src/Cloudflare/index.ts",
|
|
119
117
|
"worker": "./src/Cloudflare/index.ts",
|
|
120
|
-
"import": "./lib/Cloudflare/index.js"
|
|
118
|
+
"import": "./lib/Cloudflare/index.js",
|
|
119
|
+
"types": "./src/Cloudflare/index.d.ts"
|
|
121
120
|
},
|
|
122
121
|
"./Cloudflare/Live": {
|
|
123
|
-
"types": "./src/Cloudflare/Live.d.ts",
|
|
124
122
|
"bun": "./src/Cloudflare/Live.ts",
|
|
125
123
|
"worker": "./src/Cloudflare/Live.ts",
|
|
126
|
-
"import": "./lib/Cloudflare/Live.js"
|
|
124
|
+
"import": "./lib/Cloudflare/Live.js",
|
|
125
|
+
"types": "./src/Cloudflare/Live.d.ts"
|
|
127
126
|
},
|
|
128
127
|
"./Cloudflare/*": {
|
|
129
|
-
"types": "./src/Cloudflare/*/index.d.ts",
|
|
130
128
|
"bun": "./src/Cloudflare/*/index.ts",
|
|
131
129
|
"worker": "./src/Cloudflare/*/index.ts",
|
|
132
|
-
"import": "./lib/Cloudflare/*/index.js"
|
|
130
|
+
"import": "./lib/Cloudflare/*/index.js",
|
|
131
|
+
"types": "./src/Cloudflare/*/index.d.ts"
|
|
133
132
|
},
|
|
134
133
|
"./GitHub": {
|
|
135
|
-
"types": "./src/GitHub/index.d.ts",
|
|
136
134
|
"bun": "./src/GitHub/index.ts",
|
|
137
135
|
"worker": "./src/GitHub/index.ts",
|
|
138
|
-
"import": "./lib/GitHub/index.js"
|
|
136
|
+
"import": "./lib/GitHub/index.js",
|
|
137
|
+
"types": "./src/GitHub/index.d.ts"
|
|
139
138
|
},
|
|
140
139
|
"./Endpoint": {
|
|
141
|
-
"types": "./src/Endpoint/index.d.ts",
|
|
142
140
|
"bun": "./src/Endpoint/index.ts",
|
|
143
141
|
"worker": "./src/Endpoint/index.ts",
|
|
144
|
-
"import": "./lib/Endpoint/index.js"
|
|
142
|
+
"import": "./lib/Endpoint/index.js",
|
|
143
|
+
"types": "./src/Endpoint/index.d.ts"
|
|
145
144
|
},
|
|
146
145
|
"./Kubernetes": {
|
|
147
|
-
"types": "./src/Kubernetes/index.d.ts",
|
|
148
146
|
"bun": "./src/Kubernetes/index.ts",
|
|
149
147
|
"worker": "./src/Kubernetes/index.ts",
|
|
150
|
-
"import": "./lib/Kubernetes/index.js"
|
|
148
|
+
"import": "./lib/Kubernetes/index.js",
|
|
149
|
+
"types": "./src/Kubernetes/index.d.ts"
|
|
151
150
|
},
|
|
152
151
|
"./Output": {
|
|
153
|
-
"types": "./src/Output.d.ts",
|
|
154
152
|
"bun": "./src/Output.ts",
|
|
155
153
|
"worker": "./src/Output.ts",
|
|
156
|
-
"import": "./lib/Output.js"
|
|
154
|
+
"import": "./lib/Output.js",
|
|
155
|
+
"types": "./src/Output.d.ts"
|
|
157
156
|
},
|
|
158
157
|
"./Process": {
|
|
159
|
-
"types": "./src/Process/index.d.ts",
|
|
160
158
|
"bun": "./src/Process/index.ts",
|
|
161
159
|
"worker": "./src/Process/index.ts",
|
|
162
|
-
"import": "./lib/Process/index.js"
|
|
160
|
+
"import": "./lib/Process/index.js",
|
|
161
|
+
"types": "./src/Process/index.d.ts"
|
|
163
162
|
},
|
|
164
163
|
"./SQLite": {
|
|
165
|
-
"types": "./src/SQLite/index.d.ts",
|
|
166
164
|
"bun": "./src/SQLite/index.ts",
|
|
167
165
|
"worker": "./src/SQLite/index.ts",
|
|
168
|
-
"import": "./lib/SQLite/index.js"
|
|
166
|
+
"import": "./lib/SQLite/index.js",
|
|
167
|
+
"types": "./src/SQLite/index.d.ts"
|
|
169
168
|
},
|
|
170
169
|
"./TUI": {
|
|
171
|
-
"types": "./src/TUI/index.d.ts",
|
|
172
170
|
"bun": "./src/TUI/index.ts",
|
|
173
171
|
"worker": "./src/TUI/index.ts",
|
|
174
|
-
"import": "./lib/TUI/index.js"
|
|
172
|
+
"import": "./lib/TUI/index.js",
|
|
173
|
+
"types": "./src/TUI/index.d.ts"
|
|
175
174
|
},
|
|
176
175
|
"./Server": {
|
|
177
|
-
"types": "./src/Server/index.d.ts",
|
|
178
176
|
"bun": "./src/Server/index.ts",
|
|
179
177
|
"worker": "./src/Server/index.ts",
|
|
180
|
-
"import": "./lib/Server/index.js"
|
|
178
|
+
"import": "./lib/Server/index.js",
|
|
179
|
+
"types": "./src/Server/index.d.ts"
|
|
181
180
|
},
|
|
182
181
|
"./State": {
|
|
183
|
-
"types": "./src/State/index.d.ts",
|
|
184
182
|
"bun": "./src/State/index.ts",
|
|
185
183
|
"worker": "./src/State/index.ts",
|
|
186
|
-
"import": "./lib/State/index.js"
|
|
184
|
+
"import": "./lib/State/index.js",
|
|
185
|
+
"types": "./src/State/index.d.ts"
|
|
187
186
|
},
|
|
188
187
|
"./Test/Bun": {
|
|
189
|
-
"types": "./src/Test/Bun.d.ts",
|
|
190
188
|
"bun": "./src/Test/Bun.ts",
|
|
191
189
|
"worker": "./src/Test/Bun.ts",
|
|
192
|
-
"import": "./lib/Test/Bun.js"
|
|
190
|
+
"import": "./lib/Test/Bun.js",
|
|
191
|
+
"types": "./src/Test/Bun.d.ts"
|
|
193
192
|
},
|
|
194
193
|
"./Util": {
|
|
195
|
-
"types": "./src/Util/index.d.ts",
|
|
196
194
|
"bun": "./src/Util/index.ts",
|
|
197
195
|
"worker": "./src/Util/index.ts",
|
|
198
|
-
"import": "./lib/Util/index.js"
|
|
196
|
+
"import": "./lib/Util/index.js",
|
|
197
|
+
"types": "./src/Util/index.d.ts"
|
|
199
198
|
}
|
|
200
199
|
},
|
|
201
200
|
"publishConfig": {
|
|
@@ -208,8 +207,8 @@
|
|
|
208
207
|
"@aws-sdk/credential-providers": "^3.0.0",
|
|
209
208
|
"@distilled.cloud/aws": "^0.10.0",
|
|
210
209
|
"@distilled.cloud/cloudflare": "^0.10.0",
|
|
211
|
-
"@distilled.cloud/cloudflare-rolldown-plugin": "0.
|
|
212
|
-
"@distilled.cloud/cloudflare-vite-plugin": "0.
|
|
210
|
+
"@distilled.cloud/cloudflare-rolldown-plugin": "0.3.0",
|
|
211
|
+
"@distilled.cloud/cloudflare-vite-plugin": "0.2.0",
|
|
213
212
|
"@distilled.cloud/core": "^0.10.0",
|
|
214
213
|
"@effect/vitest": "4.0.0-beta.48",
|
|
215
214
|
"@libsql/client": "^0.17.0",
|
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");
|