alchemy 0.1.14 → 0.1.16

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.
Files changed (222) hide show
  1. package/lib/apply.js +1 -1
  2. package/lib/apply.js.map +1 -1
  3. package/lib/destroy.js +9 -3
  4. package/lib/destroy.js.map +1 -1
  5. package/package.json +1 -2
  6. package/src/apply.ts +1 -1
  7. package/src/aws/table.ts +30 -8
  8. package/src/cloudflare/kv-namespace.ts +34 -15
  9. package/src/cloudflare/worker.ts +66 -41
  10. package/src/destroy.ts +15 -10
  11. package/src/utils/retry.ts +1 -0
  12. package/README.md +0 -334
  13. package/lib/$.d.ts +0 -12
  14. package/lib/$.d.ts.map +0 -1
  15. package/lib/$.js +0 -42
  16. package/lib/$.js.map +0 -1
  17. package/lib/alchemize.d.ts +0 -43
  18. package/lib/alchemize.d.ts.map +0 -1
  19. package/lib/alchemize.js +0 -112
  20. package/lib/alchemize.js.map +0 -1
  21. package/lib/apply.d.ts +0 -23
  22. package/lib/aws/account-id.d.ts +0 -5
  23. package/lib/aws/account-id.d.ts.map +0 -1
  24. package/lib/aws/account-id.js +0 -10
  25. package/lib/aws/account-id.js.map +0 -1
  26. package/lib/aws/bucket.d.ts +0 -21
  27. package/lib/aws/bucket.d.ts.map +0 -1
  28. package/lib/aws/bucket.js +0 -114
  29. package/lib/aws/bucket.js.map +0 -1
  30. package/lib/aws/function.d.ts +0 -53
  31. package/lib/aws/function.d.ts.map +0 -1
  32. package/lib/aws/function.js +0 -195
  33. package/lib/aws/function.js.map +0 -1
  34. package/lib/aws/index.d.ts +0 -9
  35. package/lib/aws/index.d.ts.map +0 -1
  36. package/lib/aws/index.js +0 -9
  37. package/lib/aws/index.js.map +0 -1
  38. package/lib/aws/oidc/github-oidc-provider.d.ts +0 -11
  39. package/lib/aws/oidc/github-oidc-provider.d.ts.map +0 -1
  40. package/lib/aws/oidc/github-oidc-provider.js +0 -22
  41. package/lib/aws/oidc/github-oidc-provider.js.map +0 -1
  42. package/lib/aws/oidc/index.d.ts +0 -3
  43. package/lib/aws/oidc/index.d.ts.map +0 -1
  44. package/lib/aws/oidc/index.js +0 -3
  45. package/lib/aws/oidc/index.js.map +0 -1
  46. package/lib/aws/oidc/oidc-provider.d.ts +0 -60
  47. package/lib/aws/oidc/oidc-provider.d.ts.map +0 -1
  48. package/lib/aws/oidc/oidc-provider.js +0 -140
  49. package/lib/aws/oidc/oidc-provider.js.map +0 -1
  50. package/lib/aws/policy.d.ts +0 -46
  51. package/lib/aws/policy.d.ts.map +0 -1
  52. package/lib/aws/policy.js +0 -139
  53. package/lib/aws/policy.js.map +0 -1
  54. package/lib/aws/queue.d.ts +0 -62
  55. package/lib/aws/queue.d.ts.map +0 -1
  56. package/lib/aws/queue.js +0 -167
  57. package/lib/aws/queue.js.map +0 -1
  58. package/lib/aws/role.d.ts +0 -27
  59. package/lib/aws/role.d.ts.map +0 -1
  60. package/lib/aws/role.js +0 -197
  61. package/lib/aws/role.js.map +0 -1
  62. package/lib/aws/ses.d.ts +0 -75
  63. package/lib/aws/ses.d.ts.map +0 -1
  64. package/lib/aws/ses.js +0 -189
  65. package/lib/aws/ses.js.map +0 -1
  66. package/lib/aws/table.d.ts +0 -26
  67. package/lib/aws/table.d.ts.map +0 -1
  68. package/lib/aws/table.js +0 -142
  69. package/lib/aws/table.js.map +0 -1
  70. package/lib/cloudflare/api.d.ts +0 -88
  71. package/lib/cloudflare/api.d.ts.map +0 -1
  72. package/lib/cloudflare/api.js +0 -184
  73. package/lib/cloudflare/api.js.map +0 -1
  74. package/lib/cloudflare/asset-manifest.d.ts +0 -15
  75. package/lib/cloudflare/asset-manifest.d.ts.map +0 -1
  76. package/lib/cloudflare/asset-manifest.js +0 -2
  77. package/lib/cloudflare/asset-manifest.js.map +0 -1
  78. package/lib/cloudflare/auth.d.ts +0 -52
  79. package/lib/cloudflare/auth.d.ts.map +0 -1
  80. package/lib/cloudflare/auth.js +0 -114
  81. package/lib/cloudflare/auth.js.map +0 -1
  82. package/lib/cloudflare/bindings.d.ts +0 -259
  83. package/lib/cloudflare/bindings.d.ts.map +0 -1
  84. package/lib/cloudflare/bindings.js +0 -2
  85. package/lib/cloudflare/bindings.js.map +0 -1
  86. package/lib/cloudflare/durable-object-namespace.d.ts +0 -20
  87. package/lib/cloudflare/durable-object-namespace.d.ts.map +0 -1
  88. package/lib/cloudflare/durable-object-namespace.js +0 -21
  89. package/lib/cloudflare/durable-object-namespace.js.map +0 -1
  90. package/lib/cloudflare/generate-asset-manifest.d.ts +0 -3
  91. package/lib/cloudflare/generate-asset-manifest.d.ts.map +0 -1
  92. package/lib/cloudflare/generate-asset-manifest.js +0 -69
  93. package/lib/cloudflare/generate-asset-manifest.js.map +0 -1
  94. package/lib/cloudflare/index.d.ts +0 -7
  95. package/lib/cloudflare/index.d.ts.map +0 -1
  96. package/lib/cloudflare/index.js +0 -7
  97. package/lib/cloudflare/index.js.map +0 -1
  98. package/lib/cloudflare/kv-namespace.d.ts +0 -64
  99. package/lib/cloudflare/kv-namespace.d.ts.map +0 -1
  100. package/lib/cloudflare/kv-namespace.js +0 -97
  101. package/lib/cloudflare/kv-namespace.js.map +0 -1
  102. package/lib/cloudflare/state.d.ts +0 -83
  103. package/lib/cloudflare/state.d.ts.map +0 -1
  104. package/lib/cloudflare/state.js +0 -109
  105. package/lib/cloudflare/state.js.map +0 -1
  106. package/lib/cloudflare/static-site-router.d.ts +0 -19
  107. package/lib/cloudflare/static-site-router.d.ts.map +0 -1
  108. package/lib/cloudflare/static-site-router.js +0 -110
  109. package/lib/cloudflare/static-site-router.js.map +0 -1
  110. package/lib/cloudflare/static-site.d.ts +0 -166
  111. package/lib/cloudflare/static-site.d.ts.map +0 -1
  112. package/lib/cloudflare/static-site.js +0 -150
  113. package/lib/cloudflare/static-site.js.map +0 -1
  114. package/lib/cloudflare/types.d.ts +0 -52
  115. package/lib/cloudflare/types.d.ts.map +0 -1
  116. package/lib/cloudflare/types.js +0 -21
  117. package/lib/cloudflare/types.js.map +0 -1
  118. package/lib/cloudflare/upload-asset-manifest.d.ts +0 -12
  119. package/lib/cloudflare/upload-asset-manifest.d.ts.map +0 -1
  120. package/lib/cloudflare/upload-asset-manifest.js +0 -55
  121. package/lib/cloudflare/upload-asset-manifest.js.map +0 -1
  122. package/lib/cloudflare/worker-metadata.d.ts +0 -130
  123. package/lib/cloudflare/worker-metadata.d.ts.map +0 -1
  124. package/lib/cloudflare/worker-metadata.js +0 -2
  125. package/lib/cloudflare/worker-metadata.js.map +0 -1
  126. package/lib/cloudflare/worker-migration.d.ts +0 -110
  127. package/lib/cloudflare/worker-migration.d.ts.map +0 -1
  128. package/lib/cloudflare/worker-migration.js +0 -11
  129. package/lib/cloudflare/worker-migration.js.map +0 -1
  130. package/lib/cloudflare/worker.d.ts +0 -108
  131. package/lib/cloudflare/worker.d.ts.map +0 -1
  132. package/lib/cloudflare/worker.js +0 -384
  133. package/lib/cloudflare/worker.js.map +0 -1
  134. package/lib/destroy.d.ts +0 -19
  135. package/lib/error.d.ts +0 -2
  136. package/lib/error.d.ts.map +0 -1
  137. package/lib/error.js +0 -13
  138. package/lib/error.js.map +0 -1
  139. package/lib/esbuild.d.ts +0 -152
  140. package/lib/esbuild.d.ts.map +0 -1
  141. package/lib/esbuild.js +0 -67
  142. package/lib/esbuild.js.map +0 -1
  143. package/lib/fs.d.ts +0 -12
  144. package/lib/fs.d.ts.map +0 -1
  145. package/lib/fs.js +0 -41
  146. package/lib/fs.js.map +0 -1
  147. package/lib/github/client.d.ts +0 -34
  148. package/lib/github/client.d.ts.map +0 -1
  149. package/lib/github/client.js +0 -91
  150. package/lib/github/client.js.map +0 -1
  151. package/lib/github/index.d.ts +0 -2
  152. package/lib/github/index.d.ts.map +0 -1
  153. package/lib/github/index.js +0 -2
  154. package/lib/github/index.js.map +0 -1
  155. package/lib/github/secret.d.ts +0 -46
  156. package/lib/github/secret.d.ts.map +0 -1
  157. package/lib/github/secret.js +0 -103
  158. package/lib/github/secret.js.map +0 -1
  159. package/lib/global.d.ts +0 -16
  160. package/lib/global.d.ts.map +0 -1
  161. package/lib/global.js +0 -42
  162. package/lib/global.js.map +0 -1
  163. package/lib/index.d.ts +0 -10
  164. package/lib/index.d.ts.map +0 -1
  165. package/lib/index.js +0 -9
  166. package/lib/index.js.map +0 -1
  167. package/lib/input.d.ts +0 -6
  168. package/lib/input.d.ts.map +0 -1
  169. package/lib/input.js +0 -2
  170. package/lib/input.js.map +0 -1
  171. package/lib/main.d.ts +0 -3
  172. package/lib/main.d.ts.map +0 -1
  173. package/lib/main.js +0 -32
  174. package/lib/main.js.map +0 -1
  175. package/lib/output.d.ts +0 -24
  176. package/lib/output.d.ts.map +0 -1
  177. package/lib/output.js +0 -23
  178. package/lib/output.js.map +0 -1
  179. package/lib/print.d.ts +0 -7
  180. package/lib/print.d.ts.map +0 -1
  181. package/lib/print.js +0 -10
  182. package/lib/print.js.map +0 -1
  183. package/lib/resource.d.ts +0 -71
  184. package/lib/resource.d.ts.map +0 -1
  185. package/lib/resource.js +0 -276
  186. package/lib/resource.js.map +0 -1
  187. package/lib/scope.d.ts +0 -18
  188. package/lib/scope.d.ts.map +0 -1
  189. package/lib/scope.js +0 -30
  190. package/lib/scope.js.map +0 -1
  191. package/lib/slug.d.ts +0 -2
  192. package/lib/slug.d.ts.map +0 -1
  193. package/lib/slug.js +0 -4
  194. package/lib/slug.js.map +0 -1
  195. package/lib/state.d.ts +0 -40
  196. package/lib/state.d.ts.map +0 -1
  197. package/lib/state.js +0 -73
  198. package/lib/state.js.map +0 -1
  199. package/lib/stripe/index.d.ts +0 -4
  200. package/lib/stripe/index.d.ts.map +0 -1
  201. package/lib/stripe/index.js +0 -4
  202. package/lib/stripe/index.js.map +0 -1
  203. package/lib/stripe/price.d.ts +0 -109
  204. package/lib/stripe/price.d.ts.map +0 -1
  205. package/lib/stripe/price.js +0 -112
  206. package/lib/stripe/price.js.map +0 -1
  207. package/lib/stripe/product.d.ts +0 -86
  208. package/lib/stripe/product.d.ts.map +0 -1
  209. package/lib/stripe/product.js +0 -90
  210. package/lib/stripe/product.js.map +0 -1
  211. package/lib/stripe/webhook.d.ts +0 -73
  212. package/lib/stripe/webhook.d.ts.map +0 -1
  213. package/lib/stripe/webhook.js +0 -94
  214. package/lib/stripe/webhook.js.map +0 -1
  215. package/lib/utils/content-type.d.ts +0 -8
  216. package/lib/utils/content-type.d.ts.map +0 -1
  217. package/lib/utils/content-type.js +0 -41
  218. package/lib/utils/content-type.js.map +0 -1
  219. package/lib/utils/retry.d.ts +0 -13
  220. package/lib/utils/retry.d.ts.map +0 -1
  221. package/lib/utils/retry.js +0 -31
  222. package/lib/utils/retry.js.map +0 -1
package/README.md DELETED
@@ -1,334 +0,0 @@
1
- # Alchemy
2
-
3
- Alchemy is a JS-native, embeddable library for the materialization of resource graphs. From Infrastructure-as-Code (IaC) to code generation, Alchemy provides the fundamental building blocks for modeling resources that are Created, Updated and Deleted automatically.
4
-
5
- Unlike similar tools like Pulumi, Terraform, and CloudFormation, Alchemy is implemented in pure ESM-native TypeScript with zero dependencies. It can run in any JavaScript runtime, including the browser.
6
-
7
- [![Demo](./alchemy.gif)](./alchemy.gif)
8
-
9
- # Features
10
-
11
- - **JS-native** - no second language, toolchains, dependencies, processes, services, etc. to lug around.
12
- - **ESM-native** - built exclusively on ESM, with a slight preference for modern JS runtimes like Bun.
13
- - **Embeddable** - runs in any JavaScript/TypeScript environment, including the browser!
14
- - **Extensible** - implement your own resources with a simple function.
15
- - **AI-first** - alchemy actively encourages you to use LLMs to create/copy/fork/modify resources to fit your needs. No more waiting around for a provider to be implemented, just do it yourself in a few minutes.
16
- - **No dependencies** - the `alchemy` core package has 0 required dependencies.
17
- - **No service** - state files are stored locally in your project and can be easily inspected, modified, checked into your repo, etc.
18
- - **No strong opinions** - structure your codebase however you want, store state anywhere - we don't care!
19
-
20
- # Examples
21
-
22
- - LLM-based code generation of all 200+ AWS CloudFormation resources: [examples/generate-aws-cfn/gen.ts](./examples/generate-aws-cfn/gen.ts)
23
- - Deploy an AWS Lambda Function with a DynamoDB Table and IAM Role: [examples/deploy-aws/app.ts](./examples/deploy-aws/)
24
- - Generate a TODO application from a Markdown document: [examples/markdown-program/index.md](./examples/markdown-program/)
25
-
26
- # Getting Started
27
-
28
- An alchemy "app" (if you want to call it that) is just an ordinary TypeScript or JavaScript script. Once you've installed the `alchemy` package, you can start using it however you want.
29
-
30
- ```bash
31
- # I recommend bun, but you can use any JavaScript runtime.
32
- bun add alchemy
33
- ```
34
-
35
- Usually, you'll want to create a script where you'll define your resources.
36
-
37
- ```ts
38
- import { Role } from "alchemy/aws";
39
-
40
- const role = new Role("my-role", {
41
- roleName: "my-role",
42
- assumeRolePolicy: {
43
- Version: "2012-10-17",
44
- Statement: [
45
- {
46
- Effect: "Allow",
47
- // Or whatever principal you want
48
- Principal: { Service: "lambda.amazonaws.com" },
49
- Action: "sts:AssumeRole",
50
- },
51
- ],
52
- },
53
- });
54
- ```
55
-
56
- Then, call `alchemize` at the end to trigger the Create/Update/Delete lifecycle.
57
-
58
- ```ts
59
- await alchemize();
60
- ```
61
-
62
- Finally, run your script.
63
-
64
- ```sh
65
- bun ./my-app.ts
66
- ```
67
-
68
- You'll notice some files show up in your repo:
69
-
70
- ```
71
- .alchemy/
72
- - sam/
73
- - my-role.json
74
- ```
75
-
76
- Go ahead, click on one and take a look. Here's how my role looks:
77
-
78
- ```jsonc
79
- {
80
- "provider": "iam::Role",
81
- "data": {},
82
- "deps": [],
83
- "status": "updated",
84
- "output": {
85
- "roleName": "alchemy-api-lambda-role"
86
- // ..
87
- },
88
- "inputs": [
89
- {
90
- "roleName": "alchemy-api-lambda-role",
91
- "assumeRolePolicy": {
92
- "Version": "2012-10-17"
93
- // ..
94
- }
95
- }
96
- ]
97
- }
98
- ```
99
-
100
- > [!TIP]
101
- > Alchemy goes to great effort to be fully transparent. State is just a JSON file, nothing more. You can inspect it, modify it, commit it to your repo, etc.
102
-
103
- ## `alchemize`
104
-
105
- Calling `alchemize` will create new resources, update modified resources and then delete "orphaned" resources at the end.
106
-
107
- This is equivalent to `terraform apply`, `pulumi up`, `cdk deploy`, etc. except really fast and in your control.
108
-
109
- ## Creating a Resource Provider
110
-
111
- Adding new resources is the whole point of Alchemy, and is therefore very simple.
112
-
113
- A Resource provider is just a function with a globally unique name, e.g. `dynamo::Table`, and an implementation of the Create, Update, Delete lifecycle operations.
114
-
115
- E.g. below we show what a simple `dynamo::Table` provider might look like.
116
-
117
- > [!NOTE]
118
- > See [table.ts](./alchemy/src/components/aws/table.ts) for the full implementation.
119
-
120
- ```ts
121
- interface TableInputs {
122
- name: string;
123
- //..
124
- }
125
- interface TableOutput {
126
- tableArn: string;
127
- }
128
- class Table extends Resource(
129
- "dynamo::Table",
130
- async (ctx: Context<TableOutput>, inputs: TableInputs) => {
131
- if (ctx.event === "create") {
132
- // create logic
133
- } else if (ctx.event === "update") {
134
- // update logic
135
- } else if (ctx.event === "delete") {
136
- // delete logic
137
- }
138
- // ..
139
- return output;
140
- }
141
- ) {}
142
- ```
143
-
144
- > [!TIP]
145
- > Use Cursor or an LLM like Claude/OpenAI to generate the implementation of your resource. I think you'll be pleasantly surprised at how well it works, especially if you provide the API reference docs in your context.
146
-
147
- That's it! Now you can instantiate tables in your app.
148
-
149
- ```ts
150
- const table = new Table("items", {
151
- name: "items",
152
- //..
153
- });
154
-
155
- table.tableArn; // Output<string>
156
- ```
157
-
158
- You may have noticed the odd pattern of extending the result of a function call, `extends Resource(..)`. This is called the "mix-in" pattern and is optional. You are free to just use a `const` instead:
159
-
160
- ```ts
161
- const Table = Resource("dynamo::Table", async (ctx, inputs) => {
162
- //..
163
- });
164
-
165
- const table = new Table("items", {
166
- name: "items",
167
- //..
168
- });
169
- ```
170
-
171
- > [!TIP]
172
- > I recommend using a class so each resource has a type, e.g. `Table`, and a place to add helper/utility methods. Totally optional, though. Knock yourself out.
173
-
174
- ## Lazy Outputs
175
-
176
- A Resource is evaluated lazily (not when you call `new`), so you can't immediately access the value of a property like `tableArn` or `functionArn`. Instead you reference properties using the `Output<T>` interface.
177
-
178
- ```ts
179
- const table = new Table("my-table", { .. });
180
-
181
- const tableArn = table.tableArn; // Output<string>
182
- ```
183
-
184
- Outputs can be chained explicitly and implicitly:
185
-
186
- 1. _Explicitly_ with `.apply`
187
-
188
- ```ts
189
- const tableArn: Output<string> = table.tableArn.apply((arn: string) =>
190
- // do something with the arn string value
191
- arn.replace("table", "arn:aws:dynamodb:")
192
- );
193
- ```
194
-
195
- 2. _Implicitly_ chained
196
-
197
- ```ts
198
- const tableArn = table.attributeDefinitions[0].attributeName; // Output<string>
199
- // equivalent to:
200
- // table.apply(t => t.attributeDefinitions[0].attributeName);
201
- ```
202
-
203
- > [!NOTE]
204
- > Output is inspired by Pulumi, with a little extra added sugar.
205
-
206
- ## `apply` and `destroy`
207
-
208
- Calling `alchemize` is optional. Any object in your graph (`Resource` or `Output<T>`) can be "applied" or "destroyed" individually and programmatically.
209
-
210
- Say, you've got some two resources, a `Role` and a `Function`.
211
-
212
- ```ts
213
- const role = new Role("my-role", {
214
- name: "my-role",
215
- //..
216
- });
217
-
218
- const func = new Function("my-function", {
219
- name: "my-function",
220
- role: role.roleArn,
221
- //..
222
- });
223
- ```
224
-
225
- Each of these Resources is known as a "sub-graph".
226
-
227
- In this case we have `Role` (a 1-node graph, `Role`), and `Function` (a 2-node graph, `Role → Function`).
228
-
229
- Each sub-graph can be "applied" or "destroyed" individually using the `apply` and `destroy` functions:
230
-
231
- ```ts
232
- import { apply, destroy } from "alchemy";
233
-
234
- // will create Role and then Function (in that order)
235
- const { functionArn } = await apply(func);
236
-
237
- // you can destroy it right after if you want ☠️
238
- await destroy(func); // will delete just the Function
239
-
240
- // destroy deletes the resource and any downstream dependencies
241
- // so, if you want to delete Role AND Function, you should call destroy(role)
242
- await destroy(role); // will delete Role and then Function
243
- ```
244
-
245
- ## Destroying the app
246
-
247
- To destroy the whole app (aka. the whole graph), you can call `alchemize` with the `mode: "destroy"` option. This will delete all resources in the specified or default stage.
248
-
249
- ```ts
250
- await alchemize({ mode: "destroy", stage: <optional> });
251
- ```
252
-
253
- > [!TIP]
254
- > Alchemy is designed to have the minimum number of opinions as possible. This "embeddable" design is so that you can implement your own tools around Alchemy, e.g. a CLI or UI, instead of being stuck with a specific tool.
255
- >
256
- > ```ts
257
- > await alchemize({
258
- > // decide the mode/stage however you want, e.g. a CLI parser
259
- > mode: process.argv[2] === "destroy" ? "destroy" : "up",
260
- > stage: process.argv[3],
261
- > });
262
- > ```
263
-
264
- ## "Stage" and State
265
-
266
- > [!NOTE]
267
- > Stage is inspired by [SST](https://sst.dev)'s stage concept.
268
-
269
- Alchemy supports a "stage" concept to help isolate different environments from each other. E.g. a `"user"` or `"dev"` or `"prod"` stage.
270
-
271
- By default, the stage is assumed to be your user name (a sensible default for local development).
272
-
273
- To override the stage, you have three options:
274
-
275
- 1. Pass the `stage` option to `alchemize`/`apply`/`destroy` (recommended)
276
-
277
- ```ts
278
- // alchemize the entire app
279
- await alchemize({ stage: "production" });
280
-
281
- // apply a single resource
282
- await apply(func, { stage: "production" });
283
- ```
284
-
285
- 2. Config in `./alchemy.ts` (up to you if you want to have a global config). See the [alchemy.ts section](#global-values-and-the-alchemy-ts-config-file) for more details.
286
-
287
- ```ts
288
- export default {
289
- defaultStage: "production",
290
- };
291
- ```
292
-
293
- 3. Set the `ALCHEMY_STAGE` environment variable (not recommended, but available as an escape hatch)
294
-
295
- ```sh
296
- ALCHEMY_STAGE=production bun ./my-app.ts
297
- ```
298
-
299
- Each Resource "provider" can access the stage it's being deployed to via the `ctx.stage` property.
300
-
301
- ```ts
302
- class Table extends Resource("dynamo::Table", async (ctx, inputs) => {
303
- ctx.stage; // "production"
304
- });
305
- ```
306
-
307
- > [!CAUTION]
308
- > It is up to you to ensure that the physical names of resources don't conflict - alchemy does not (yet) offer any help or opinions here. You must decide on physical names, but you're free to add name generation logic to your resources if you so desire.
309
- >
310
- > ```ts
311
- > class Table extends Resource("dynamo::Table", async (ctx, inputs) => {
312
- > const tableName = `${ctx.stage}-${inputs.tableName}`;
313
- >
314
- > // ..
315
- > });
316
- > ```
317
-
318
- ## Global values and the `alchemy.ts` config file.
319
-
320
- Alchemy looks for a `${cwd}/alchemy.ts` file and imports it if it finds it. This can be useful for emulating SST's `sst.config.ts` file as a convention for global configuration.
321
-
322
- It supports overriding the `defaultStage` (instead of defaulting to your username) and providing a custom `stateStore` (instead of writing to the local file system).
323
-
324
- ```ts
325
- import type { Config } from "alchemy";
326
-
327
- export default {
328
- defaultStage: "dev",
329
- stateStore: myCustomStateStore,
330
- } satisfies Config;
331
- ```
332
-
333
- > [!NOTE]
334
- > See [global.ts](./alchemy/src/global.ts).
package/lib/$.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import type { Input } from "./input";
2
- import { type Output } from "./output";
3
- export type $<T> = T extends undefined | null | boolean | number | string | symbol | bigint ? Input<T> : T extends (...args: infer Args extends any[]) => infer R ? (...args: {
4
- [i in keyof Args]: $<Args[i]>;
5
- }) => Output<Awaited<R>> : T extends any[] ? $array<T> : $object<T>;
6
- type $object<T> = {
7
- [i in keyof T]: $<T[i]>;
8
- };
9
- type $array<T extends any[]> = T extends [infer First, ...infer Rest] ? [$<First>, ...$object<Rest>] : [];
10
- export declare function $<T>(value: T): $<T>;
11
- export {};
12
- //# sourceMappingURL=$.d.ts.map
package/lib/$.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"$.d.ts","sourceRoot":"","sources":["../src/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,MAAM,EAAe,MAAM,UAAU,CAAC;AAGpD,MAAM,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAChB,SAAS,GACT,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,KAAK,CAAC,CAAC,CAAC,GACR,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,IAAI,SAAS,GAAG,EAAE,KAAK,MAAM,CAAC,GACtD,CACE,GAAG,IAAI,EAAE;KACN,CAAC,IAAI,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CAC9B,KACE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GACvB,CAAC,SAAS,GAAG,EAAE,GACb,MAAM,CAAC,CAAC,CAAC,GACT,OAAO,CAAC,CAAC,CAAC,CAAC;AAEnB,KAAK,OAAO,CAAC,CAAC,IAAI;KACf,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACxB,CAAC;AACF,KAAK,MAAM,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,GACjE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAC5B,EAAE,CAAC;AAEP,wBAAgB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAsCnC"}
package/lib/$.js DELETED
@@ -1,42 +0,0 @@
1
- import { OutputChain } from "./output";
2
- import { getScope } from "./scope";
3
- export function $(value) {
4
- return new Proxy(() => { }, {
5
- apply: (_, thisArg, args) => {
6
- const target = value;
7
- let argsOutput;
8
- for (const arg of args) {
9
- if (arg instanceof OutputChain) {
10
- if (argsOutput) {
11
- argsOutput = arg.apply((arg) => argsOutput.apply((...args) => [...args, arg]));
12
- }
13
- else {
14
- argsOutput = arg.apply((arg) => [arg]);
15
- }
16
- }
17
- else {
18
- if (argsOutput) {
19
- argsOutput = argsOutput.apply((args) => [...args, arg]);
20
- }
21
- else {
22
- argsOutput = new OutputChain({}, () => [arg]);
23
- }
24
- }
25
- }
26
- const scope = getScope();
27
- const output = argsOutput
28
- ? argsOutput.apply((args) => target(...args))
29
- : new OutputChain({}, () => target());
30
- scope.callbacks.push(output);
31
- return $(output);
32
- },
33
- get: (_, prop) => {
34
- const target = value;
35
- if (target instanceof OutputChain) {
36
- return $(target.apply((t) => t[prop]));
37
- }
38
- return $(target[prop]);
39
- },
40
- });
41
- }
42
- //# sourceMappingURL=$.js.map
package/lib/$.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"$.js","sourceRoot":"","sources":["../src/$.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AA4BnC,MAAM,UAAU,CAAC,CAAI,KAAQ;IAC3B,OAAO,IAAI,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,EAAE;QACzB,KAAK,EAAE,CAAC,CAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;YAC7B,MAAM,MAAM,GAAG,KAAgC,CAAC;YAChD,IAAI,UAAqC,CAAC;YAC1C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACvB,IAAI,GAAG,YAAY,WAAW,EAAE,CAAC;oBAC/B,IAAI,UAAU,EAAE,CAAC;wBACf,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAC7B,UAAW,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC,CAC/C,CAAC;oBACJ,CAAC;yBAAM,CAAC;wBACN,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;oBACzC,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,IAAI,UAAU,EAAE,CAAC;wBACf,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;oBAC1D,CAAC;yBAAM,CAAC;wBACN,UAAU,GAAG,IAAI,WAAW,CAAC,EAAS,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;oBACvD,CAAC;gBACH,CAAC;YACH,CAAC;YAED,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;YACzB,MAAM,MAAM,GAAG,UAAU;gBACvB,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;gBAC7C,CAAC,CAAC,IAAI,WAAW,CAAC,EAAS,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;YAC/C,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC7B,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC;QACD,GAAG,EAAE,CAAC,CAAM,EAAE,IAAI,EAAE,EAAE;YACpB,MAAM,MAAM,GAAG,KAAY,CAAC;YAC5B,IAAI,MAAM,YAAY,WAAW,EAAE,CAAC;gBAClC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACzC,CAAC;YACD,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACzB,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -1,43 +0,0 @@
1
- import { type Scope } from "./scope";
2
- import type { StateStoreType } from "./state";
3
- export interface AlchemizeOptions {
4
- /**
5
- * Determines whether the resources will be created/updated or deleted.
6
- *
7
- * @default "up"
8
- */
9
- mode?: "up" | "destroy";
10
- /**
11
- * Name to scope the resource state under (e.g. `.alchemy/{stage}/..`).
12
- *
13
- * @default - your POSIX username
14
- */
15
- stage?: string;
16
- /**
17
- * If true, will not prune resources that were dropped from the root stack.
18
- *
19
- * @default true
20
- */
21
- destroyOrphans?: boolean;
22
- /**
23
- * A custom state store to use instead of the default file system store.
24
- */
25
- stateStore?: StateStoreType;
26
- /**
27
- * A custom scope to use instead of the default root scope.
28
- */
29
- scope?: Scope;
30
- /**
31
- * If true, will not print any Create/Update/Delete messages.
32
- *
33
- * @default false
34
- */
35
- quiet?: boolean;
36
- }
37
- /**
38
- * Explicitly finalize the program by deleting any resources that were dropped from the root stack.
39
- *
40
- * By default, this will be called when
41
- */
42
- export declare function alchemize(options?: AlchemizeOptions): Promise<void>;
43
- //# sourceMappingURL=alchemize.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"alchemize.d.ts","sourceRoot":"","sources":["../src/alchemize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,KAAK,EAAY,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IACxB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB,iBAsIzD"}
package/lib/alchemize.js DELETED
@@ -1,112 +0,0 @@
1
- import { evaluate } from "./apply";
2
- import { destroy } from "./destroy";
3
- import { defaultStage, defaultStateStore, providers } from "./global";
4
- import { getScope } from "./scope";
5
- /**
6
- * Explicitly finalize the program by deleting any resources that were dropped from the root stack.
7
- *
8
- * By default, this will be called when
9
- */
10
- export async function alchemize(options) {
11
- const scope = options?.scope ?? getScope();
12
- const nodes = scope.nodes;
13
- const stage = options?.stage ?? defaultStage;
14
- const stateStore = new (options?.stateStore ?? defaultStateStore)(scope.getScopePath(stage));
15
- const callbacks = scope.callbacks;
16
- if (nodes.size > 0) {
17
- await stateStore.init?.();
18
- }
19
- // Track in-progress deletions to avoid duplicate work
20
- const deletionPromises = new Map();
21
- const priorStates = await stateStore.all();
22
- const priorIDs = Object.keys(priorStates);
23
- const mode = options?.mode ?? "up";
24
- if (mode === "up") {
25
- await Promise.allSettled(Array.from(nodes.values())
26
- .reverse()
27
- .map((node) => evaluate(node.resource, {
28
- stage,
29
- scope,
30
- stateStore,
31
- quiet: options?.quiet,
32
- })));
33
- if (options?.destroyOrphans === false) {
34
- return;
35
- }
36
- await Promise.all(callbacks.map((callback) => evaluate(callback, {
37
- stage,
38
- scope,
39
- stateStore,
40
- quiet: options?.quiet,
41
- })));
42
- }
43
- const aliveIDs = new Set(mode === "up"
44
- ? nodes.keys()
45
- : // There are no alive resources in destroy mode
46
- []);
47
- const orphanIDs = Array.from(priorIDs).filter((id) => !aliveIDs.has(id));
48
- const orphanStates = Object.fromEntries(orphanIDs.map((id) => [id, priorStates[id]]));
49
- // compute a map of resourceID -> upstream dependencies (resources that depend on it)
50
- const orphanGraph = {};
51
- for (const [orphanID, orphanState] of Object.entries(orphanStates)) {
52
- orphanGraph[orphanID] ??= new Set();
53
- for (const dep of orphanState.deps) {
54
- (orphanGraph[dep] ??= new Set()).add(orphanID);
55
- }
56
- }
57
- // Start deletion from each orphan that has no dependents (nothing depends on it)
58
- await Promise.all(orphanIDs
59
- .filter((id) => orphanGraph[id].size === 0)
60
- .map((id) => deleteOrphan(id)));
61
- const remaining = await stateStore.count();
62
- if (remaining === 0) {
63
- await stateStore.deinit?.();
64
- }
65
- // Recursively delete orphans in dependency order
66
- async function deleteOrphan(orphanID) {
67
- // Return existing deletion promise if this orphan is already being deleted
68
- const existing = deletionPromises.get(orphanID);
69
- if (existing) {
70
- return existing;
71
- }
72
- // Create promise immediately to prevent race conditions
73
- let resolve;
74
- let reject;
75
- const promise = new Promise((res, rej) => {
76
- resolve = res;
77
- reject = rej;
78
- });
79
- deletionPromises.set(orphanID, promise);
80
- try {
81
- const orphanState = orphanStates[orphanID];
82
- // First delete this resource
83
- const providerType = orphanState.provider;
84
- const provider = providers.get(providerType);
85
- if (!provider) {
86
- throw new Error(`No provider found for ${providerType}. Did you forget to import it?`);
87
- }
88
- if (!options?.quiet) {
89
- console.log("Destroy:", orphanID);
90
- }
91
- await destroy(stage, scope, orphanID, orphanState, provider, stateStore, {
92
- quiet: options?.quiet,
93
- });
94
- // After this resource is deleted, we can delete its dependencies if they're orphans
95
- if (orphanState.deps.length > 0) {
96
- await Promise.all(orphanState.deps
97
- .filter((dep) => orphanIDs.includes(dep)) // Only delete if it's an orphan
98
- .map((dep) => deleteOrphan(dep)));
99
- }
100
- resolve();
101
- }
102
- catch (error) {
103
- reject(error);
104
- }
105
- return promise;
106
- }
107
- }
108
- if (process.env.ALCHEMY_NO_DEPLOY !== "true") {
109
- // Listen for signals or events
110
- process.on("exit", () => alchemize());
111
- }
112
- //# sourceMappingURL=alchemize.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"alchemize.js","sourceRoot":"","sources":["../src/alchemize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAc,QAAQ,EAAE,MAAM,SAAS,CAAC;AAsC/C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAA0B;IACxD,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC1B,MAAM,KAAK,G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BAChC,MAAM,OAAO,CAAC,GAAG,CACf,WAAW,CAAC,IAAI;qBACb,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,gCAAgC;qBACzE,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CACnC,CAAC;YACJ,CAAC;YAED,OAAQ,EAAE,CAAC;QACb,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC;AAED,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,KAAK,MAAM,EAAE,CAAC;IAC7C,+BAA+B;IAC/B,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;AACxC,CAAC"}
package/lib/apply.d.ts DELETED
@@ -1,23 +0,0 @@
1
- import { type Output, type Resolved } from "./output";
2
- import { type Scope as IScope } from "./scope";
3
- import type { StateStore } from "./state";
4
- export interface ApplyOptions {
5
- stage: string;
6
- scope: IScope;
7
- stateStore: StateStore;
8
- quiet?: boolean;
9
- }
10
- /**
11
- * Apply a sub-graph to produce a resource.
12
- * @param output A sub-graph that produces a resource.
13
- * @returns The resource properties.
14
- */
15
- export declare function apply<T>(output: T, options?: Partial<ApplyOptions>): Promise<Resolved<T>>;
16
- declare class Evaluated<T> {
17
- readonly value: T;
18
- readonly deps: string[];
19
- constructor(value: T, deps?: string[]);
20
- }
21
- export declare function evaluate<T>(output: T | Output<T>, options: ApplyOptions): Promise<Evaluated<T>>;
22
- export {};
23
- //# sourceMappingURL=apply.d.ts.map
@@ -1,5 +0,0 @@
1
- /**
2
- * Helper to get the current AWS account ID
3
- */
4
- export declare function getAccountId(): Promise<string>;
5
- //# sourceMappingURL=account-id.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"account-id.d.ts","sourceRoot":"","sources":["../../src/aws/account-id.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAGpD"}
@@ -1,10 +0,0 @@
1
- import { GetCallerIdentityCommand, STSClient } from "@aws-sdk/client-sts";
2
- const sts = new STSClient({});
3
- /**
4
- * Helper to get the current AWS account ID
5
- */
6
- export async function getAccountId() {
7
- const identity = await sts.send(new GetCallerIdentityCommand({}));
8
- return identity.Account;
9
- }
10
- //# sourceMappingURL=account-id.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"account-id.js","sourceRoot":"","sources":["../../src/aws/account-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE1E,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC;AAE9B;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,wBAAwB,CAAC,EAAE,CAAC,CAAC,CAAC;IAClE,OAAO,QAAQ,CAAC,OAAQ,CAAC;AAC3B,CAAC"}
@@ -1,21 +0,0 @@
1
- export interface BucketProps {
2
- bucketName: string;
3
- tags?: Record<string, string>;
4
- }
5
- export interface BucketOutput extends BucketProps {
6
- id: string;
7
- arn: string;
8
- bucketDomainName: string;
9
- bucketRegionalDomainName?: string;
10
- hostedZoneId?: string;
11
- region?: string;
12
- websiteEndpoint?: string;
13
- websiteDomain?: string;
14
- versioningEnabled?: boolean;
15
- acl?: string;
16
- }
17
- declare const Bucket_base: import("../resource").Provider<"s3::Bucket", [props: BucketProps], BucketProps>;
18
- export declare class Bucket extends Bucket_base {
19
- }
20
- export {};
21
- //# sourceMappingURL=bucket.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bucket.d.ts","sourceRoot":"","sources":["../../src/aws/bucket.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;IACzB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;;AAED,qBAAa,MAAO,SAAQ,WA0G3B;CAAG"}