alchemy 0.1.11 → 0.1.12

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 (277) hide show
  1. package/README.md +324 -0
  2. package/lib/apply.d.ts +2 -2
  3. package/lib/apply.d.ts.map +1 -1
  4. package/lib/apply.js +2 -2
  5. package/lib/apply.js.map +1 -1
  6. package/lib/aws/index.d.ts +1 -0
  7. package/lib/aws/index.d.ts.map +1 -1
  8. package/lib/aws/index.js +1 -0
  9. package/lib/aws/index.js.map +1 -1
  10. package/lib/aws/ses.d.ts +75 -0
  11. package/lib/aws/ses.d.ts.map +1 -0
  12. package/lib/aws/ses.js +197 -0
  13. package/lib/aws/ses.js.map +1 -0
  14. package/lib/cloudflare/api.d.ts +84 -0
  15. package/lib/cloudflare/api.d.ts.map +1 -0
  16. package/lib/cloudflare/api.js +178 -0
  17. package/lib/cloudflare/api.js.map +1 -0
  18. package/lib/cloudflare/asset-manifest.d.ts +15 -0
  19. package/lib/cloudflare/asset-manifest.d.ts.map +1 -0
  20. package/lib/cloudflare/asset-manifest.js +2 -0
  21. package/lib/cloudflare/asset-manifest.js.map +1 -0
  22. package/lib/cloudflare/auth.d.ts +52 -0
  23. package/lib/cloudflare/auth.d.ts.map +1 -0
  24. package/lib/cloudflare/auth.js +114 -0
  25. package/lib/cloudflare/auth.js.map +1 -0
  26. package/lib/cloudflare/bindings.d.ts +244 -0
  27. package/lib/cloudflare/bindings.d.ts.map +1 -0
  28. package/lib/cloudflare/bindings.js +7 -0
  29. package/lib/cloudflare/bindings.js.map +1 -0
  30. package/lib/cloudflare/generate-asset-manifest.d.ts +3 -0
  31. package/lib/cloudflare/generate-asset-manifest.d.ts.map +1 -0
  32. package/lib/cloudflare/generate-asset-manifest.js +69 -0
  33. package/lib/cloudflare/generate-asset-manifest.js.map +1 -0
  34. package/lib/cloudflare/index.d.ts +6 -0
  35. package/lib/cloudflare/index.d.ts.map +1 -0
  36. package/lib/cloudflare/index.js +6 -0
  37. package/lib/cloudflare/index.js.map +1 -0
  38. package/lib/cloudflare/kv-namespace.d.ts +61 -0
  39. package/lib/cloudflare/kv-namespace.d.ts.map +1 -0
  40. package/lib/cloudflare/kv-namespace.js +93 -0
  41. package/lib/cloudflare/kv-namespace.js.map +1 -0
  42. package/lib/cloudflare/state.d.ts +83 -0
  43. package/lib/cloudflare/state.d.ts.map +1 -0
  44. package/lib/cloudflare/state.js +109 -0
  45. package/lib/cloudflare/state.js.map +1 -0
  46. package/lib/cloudflare/static-site-router.d.ts +10 -0
  47. package/lib/cloudflare/static-site-router.d.ts.map +1 -0
  48. package/lib/cloudflare/static-site-router.js +88 -0
  49. package/lib/cloudflare/static-site-router.js.map +1 -0
  50. package/lib/cloudflare/static-site.d.ts +166 -0
  51. package/lib/cloudflare/static-site.d.ts.map +1 -0
  52. package/lib/cloudflare/static-site.js +152 -0
  53. package/lib/cloudflare/static-site.js.map +1 -0
  54. package/lib/cloudflare/types.d.ts +52 -0
  55. package/lib/cloudflare/types.d.ts.map +1 -0
  56. package/lib/cloudflare/types.js +21 -0
  57. package/lib/cloudflare/types.js.map +1 -0
  58. package/lib/cloudflare/upload-asset-manifest.d.ts +12 -0
  59. package/lib/cloudflare/upload-asset-manifest.d.ts.map +1 -0
  60. package/lib/cloudflare/upload-asset-manifest.js +55 -0
  61. package/lib/cloudflare/upload-asset-manifest.js.map +1 -0
  62. package/lib/cloudflare/worker.d.ts +87 -0
  63. package/lib/cloudflare/worker.d.ts.map +1 -0
  64. package/lib/cloudflare/worker.js +364 -0
  65. package/lib/cloudflare/worker.js.map +1 -0
  66. package/lib/esbuild.d.ts +82 -0
  67. package/lib/esbuild.d.ts.map +1 -1
  68. package/lib/esbuild.js +24 -17
  69. package/lib/esbuild.js.map +1 -1
  70. package/lib/fs.d.ts +1 -1
  71. package/lib/global.d.ts.map +1 -1
  72. package/lib/global.js +3 -1
  73. package/lib/global.js.map +1 -1
  74. package/lib/index.d.ts +0 -1
  75. package/lib/index.d.ts.map +1 -1
  76. package/lib/index.js +0 -1
  77. package/lib/index.js.map +1 -1
  78. package/lib/main.js +1 -1
  79. package/lib/main.js.map +1 -1
  80. package/lib/output.d.ts +17 -13
  81. package/lib/output.d.ts.map +1 -1
  82. package/lib/output.js +2 -2
  83. package/lib/output.js.map +1 -1
  84. package/lib/resource.d.ts +3 -2
  85. package/lib/resource.d.ts.map +1 -1
  86. package/lib/resource.js +2 -2
  87. package/lib/resource.js.map +1 -1
  88. package/lib/utils/content-type.d.ts +8 -0
  89. package/lib/utils/content-type.d.ts.map +1 -0
  90. package/lib/utils/content-type.js +41 -0
  91. package/lib/utils/content-type.js.map +1 -0
  92. package/package.json +26 -8
  93. package/src/apply.ts +5 -5
  94. package/src/aws/index.ts +1 -0
  95. package/src/aws/ses.ts +346 -0
  96. package/src/cloudflare/api.ts +276 -0
  97. package/src/cloudflare/asset-manifest.ts +16 -0
  98. package/src/cloudflare/auth.ts +187 -0
  99. package/src/cloudflare/bindings.ts +286 -0
  100. package/src/cloudflare/generate-asset-manifest.ts +93 -0
  101. package/src/cloudflare/index.ts +5 -0
  102. package/src/cloudflare/kv-namespace.ts +195 -0
  103. package/src/cloudflare/state.ts +138 -0
  104. package/src/cloudflare/static-site-router.ts +108 -0
  105. package/src/cloudflare/static-site.ts +379 -0
  106. package/src/cloudflare/types.ts +71 -0
  107. package/src/cloudflare/upload-asset-manifest.ts +83 -0
  108. package/src/cloudflare/worker.ts +568 -0
  109. package/src/esbuild.ts +31 -22
  110. package/src/global.ts +1 -0
  111. package/src/index.ts +0 -1
  112. package/src/main.ts +1 -1
  113. package/src/output.ts +32 -32
  114. package/src/resource.ts +11 -5
  115. package/src/utils/content-type.ts +42 -0
  116. package/lib/$.d.ts +0 -7
  117. package/lib/$.d.ts.map +0 -1
  118. package/lib/$.js +0 -31
  119. package/lib/$.js.map +0 -1
  120. package/lib/agent/ai.d.ts +0 -40
  121. package/lib/agent/ai.d.ts.map +0 -1
  122. package/lib/agent/ai.js +0 -132
  123. package/lib/agent/ai.js.map +0 -1
  124. package/lib/agent/anthropic.d.ts +0 -9
  125. package/lib/agent/anthropic.d.ts.map +0 -1
  126. package/lib/agent/anthropic.js +0 -25
  127. package/lib/agent/anthropic.js.map +0 -1
  128. package/lib/agent/dependencies.d.ts +0 -4
  129. package/lib/agent/dependencies.d.ts.map +0 -1
  130. package/lib/agent/dependencies.js +0 -48
  131. package/lib/agent/dependencies.js.map +0 -1
  132. package/lib/agent/file-context.d.ts +0 -13
  133. package/lib/agent/file-context.d.ts.map +0 -1
  134. package/lib/agent/file-context.js +0 -6
  135. package/lib/agent/file-context.js.map +0 -1
  136. package/lib/agent/index.d.ts +0 -10
  137. package/lib/agent/index.d.ts.map +0 -1
  138. package/lib/agent/index.js +0 -10
  139. package/lib/agent/index.js.map +0 -1
  140. package/lib/agent/model.d.ts +0 -8
  141. package/lib/agent/model.d.ts.map +0 -1
  142. package/lib/agent/model.js +0 -29
  143. package/lib/agent/model.js.map +0 -1
  144. package/lib/agent/module.d.ts +0 -81
  145. package/lib/agent/module.d.ts.map +0 -1
  146. package/lib/agent/module.js +0 -309
  147. package/lib/agent/module.js.map +0 -1
  148. package/lib/agent/openai.d.ts +0 -6
  149. package/lib/agent/openai.d.ts.map +0 -1
  150. package/lib/agent/openai.js +0 -41
  151. package/lib/agent/openai.js.map +0 -1
  152. package/lib/agent/program.d.ts +0 -12
  153. package/lib/agent/program.d.ts.map +0 -1
  154. package/lib/agent/program.js +0 -21
  155. package/lib/agent/program.js.map +0 -1
  156. package/lib/agent/prompts.d.ts +0 -4
  157. package/lib/agent/prompts.d.ts.map +0 -1
  158. package/lib/agent/prompts.js +0 -11
  159. package/lib/agent/prompts.js.map +0 -1
  160. package/lib/agent/scrape.d.ts +0 -71
  161. package/lib/agent/scrape.d.ts.map +0 -1
  162. package/lib/agent/scrape.js +0 -45
  163. package/lib/agent/scrape.js.map +0 -1
  164. package/lib/aws/auto/docs.d.ts +0 -11
  165. package/lib/aws/auto/docs.d.ts.map +0 -1
  166. package/lib/aws/auto/docs.js +0 -56
  167. package/lib/aws/auto/docs.js.map +0 -1
  168. package/lib/aws/auto/index.d.ts +0 -5
  169. package/lib/aws/auto/index.d.ts.map +0 -1
  170. package/lib/aws/auto/index.js +0 -5
  171. package/lib/aws/auto/index.js.map +0 -1
  172. package/lib/aws/auto/resource.d.ts +0 -24
  173. package/lib/aws/auto/resource.d.ts.map +0 -1
  174. package/lib/aws/auto/resource.js +0 -194
  175. package/lib/aws/auto/resource.js.map +0 -1
  176. package/lib/aws/auto/service.d.ts +0 -10
  177. package/lib/aws/auto/service.d.ts.map +0 -1
  178. package/lib/aws/auto/service.js +0 -34
  179. package/lib/aws/auto/service.js.map +0 -1
  180. package/lib/aws/auto/spec.d.ts +0 -83
  181. package/lib/aws/auto/spec.d.ts.map +0 -1
  182. package/lib/aws/auto/spec.js +0 -58
  183. package/lib/aws/auto/spec.js.map +0 -1
  184. package/lib/markdown/design.d.ts +0 -17
  185. package/lib/markdown/design.d.ts.map +0 -1
  186. package/lib/markdown/design.js +0 -92
  187. package/lib/markdown/design.js.map +0 -1
  188. package/lib/markdown/extract.d.ts +0 -7
  189. package/lib/markdown/extract.d.ts.map +0 -1
  190. package/lib/markdown/extract.js +0 -10
  191. package/lib/markdown/extract.js.map +0 -1
  192. package/lib/markdown/index.d.ts +0 -4
  193. package/lib/markdown/index.d.ts.map +0 -1
  194. package/lib/markdown/index.js +0 -4
  195. package/lib/markdown/index.js.map +0 -1
  196. package/lib/markdown/requirements.d.ts +0 -79
  197. package/lib/markdown/requirements.d.ts.map +0 -1
  198. package/lib/markdown/requirements.js +0 -105
  199. package/lib/markdown/requirements.js.map +0 -1
  200. package/lib/typescript/check-omission.d.ts +0 -2
  201. package/lib/typescript/check-omission.d.ts.map +0 -1
  202. package/lib/typescript/check-omission.js +0 -43
  203. package/lib/typescript/check-omission.js.map +0 -1
  204. package/lib/typescript/debug-type-errors.d.ts +0 -3
  205. package/lib/typescript/debug-type-errors.d.ts.map +0 -1
  206. package/lib/typescript/debug-type-errors.js +0 -35
  207. package/lib/typescript/debug-type-errors.js.map +0 -1
  208. package/lib/typescript/extract.d.ts +0 -7
  209. package/lib/typescript/extract.d.ts.map +0 -1
  210. package/lib/typescript/extract.js +0 -10
  211. package/lib/typescript/extract.js.map +0 -1
  212. package/lib/typescript/index.d.ts +0 -7
  213. package/lib/typescript/index.d.ts.map +0 -1
  214. package/lib/typescript/index.js +0 -7
  215. package/lib/typescript/index.js.map +0 -1
  216. package/lib/typescript/install-dependencies.d.ts +0 -29
  217. package/lib/typescript/install-dependencies.d.ts.map +0 -1
  218. package/lib/typescript/install-dependencies.js +0 -52
  219. package/lib/typescript/install-dependencies.js.map +0 -1
  220. package/lib/typescript/package.d.ts +0 -157
  221. package/lib/typescript/package.d.ts.map +0 -1
  222. package/lib/typescript/package.js +0 -115
  223. package/lib/typescript/package.js.map +0 -1
  224. package/lib/typescript/repair-omissions.d.ts +0 -3
  225. package/lib/typescript/repair-omissions.d.ts.map +0 -1
  226. package/lib/typescript/repair-omissions.js +0 -23
  227. package/lib/typescript/repair-omissions.js.map +0 -1
  228. package/lib/typescript/repair.d.ts +0 -3
  229. package/lib/typescript/repair.d.ts.map +0 -1
  230. package/lib/typescript/repair.js +0 -34
  231. package/lib/typescript/repair.js.map +0 -1
  232. package/lib/typescript/tsconfig.d.ts +0 -469
  233. package/lib/typescript/tsconfig.d.ts.map +0 -1
  234. package/lib/typescript/tsconfig.js +0 -143
  235. package/lib/typescript/tsconfig.js.map +0 -1
  236. package/lib/typescript/typescript.d.ts +0 -107
  237. package/lib/typescript/typescript.d.ts.map +0 -1
  238. package/lib/typescript/typescript.js +0 -180
  239. package/lib/typescript/typescript.js.map +0 -1
  240. package/lib/typescript/validate.d.ts +0 -10
  241. package/lib/typescript/validate.d.ts.map +0 -1
  242. package/lib/typescript/validate.js +0 -49
  243. package/lib/typescript/validate.js.map +0 -1
  244. package/src/$.ts +0 -36
  245. package/src/agent/ai.ts +0 -215
  246. package/src/agent/anthropic.ts +0 -31
  247. package/src/agent/dependencies.ts +0 -62
  248. package/src/agent/file-context.ts +0 -8
  249. package/src/agent/index.ts +0 -9
  250. package/src/agent/model.ts +0 -39
  251. package/src/agent/module.ts +0 -418
  252. package/src/agent/openai.ts +0 -50
  253. package/src/agent/program.md +0 -38
  254. package/src/agent/program.ts +0 -37
  255. package/src/agent/prompts.ts +0 -20
  256. package/src/agent/scrape.ts +0 -47
  257. package/src/aws/auto/cfn.json +0 -225310
  258. package/src/aws/auto/docs.ts +0 -73
  259. package/src/aws/auto/index.ts +0 -4
  260. package/src/aws/auto/resource.ts +0 -269
  261. package/src/aws/auto/service.ts +0 -51
  262. package/src/aws/auto/spec.ts +0 -160
  263. package/src/markdown/design.ts +0 -125
  264. package/src/markdown/extract.ts +0 -9
  265. package/src/markdown/index.ts +0 -3
  266. package/src/markdown/requirements.ts +0 -135
  267. package/src/typescript/check-omission.ts +0 -47
  268. package/src/typescript/debug-type-errors.ts +0 -42
  269. package/src/typescript/extract.ts +0 -9
  270. package/src/typescript/index.ts +0 -6
  271. package/src/typescript/install-dependencies.ts +0 -61
  272. package/src/typescript/package.ts +0 -143
  273. package/src/typescript/repair-omissions.ts +0 -31
  274. package/src/typescript/repair.ts +0 -45
  275. package/src/typescript/tsconfig.ts +0 -170
  276. package/src/typescript/typescript.ts +0 -217
  277. package/src/typescript/validate.ts +0 -73
package/README.md ADDED
@@ -0,0 +1,324 @@
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
+ name: "my-role",
42
+ //..
43
+ });
44
+ ```
45
+
46
+ Then, call `alchemize` at the end to trigger the Create/Update/Delete lifecycle.
47
+
48
+ ```ts
49
+ await alchemize();
50
+ ```
51
+
52
+ Finally, run your script.
53
+
54
+ ```sh
55
+ bun ./my-app.ts
56
+ ```
57
+
58
+ You'll notice some files show up in your repo:
59
+
60
+ ```
61
+ .alchemy/
62
+ - sam/
63
+ - my-role.json
64
+ ```
65
+
66
+ Go ahead, click on one and take a look. Here's how my role looks:
67
+
68
+ ```jsonc
69
+ {
70
+ "provider": "iam::Role",
71
+ "data": {},
72
+ "deps": [],
73
+ "status": "updated",
74
+ "output": {
75
+ "roleName": "alchemy-api-lambda-role"
76
+ // ..
77
+ },
78
+ "inputs": [
79
+ {
80
+ "roleName": "alchemy-api-lambda-role",
81
+ "assumeRolePolicy": {
82
+ "Version": "2012-10-17"
83
+ // ..
84
+ }
85
+ }
86
+ ]
87
+ }
88
+ ```
89
+
90
+ > [!TIP]
91
+ > 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.
92
+
93
+ ## `alchemize`
94
+
95
+ Calling `alchemize` will create new resources, update modified resources and then delete "orphaned" resources at the end.
96
+
97
+ This is equivalent to `terraform apply`, `pulumi up`, `cdk deploy`, etc. except really fast and in your control.
98
+
99
+ ## Creating a Resource Provider
100
+
101
+ Adding new resources is the whole point of Alchemy, and is therefore very simple.
102
+
103
+ 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.
104
+
105
+ E.g. below we show what a simple `dynamo::Table` provider might look like.
106
+
107
+ > [!NOTE]
108
+ > See [table.ts](./alchemy/src/components/aws/table.ts) for the full implementation.
109
+
110
+ ```ts
111
+ interface TableInputs {
112
+ name: string;
113
+ //..
114
+ }
115
+ interface TableOutput {
116
+ tableArn: string;
117
+ }
118
+ class Table extends Resource(
119
+ "dynamo::Table",
120
+ async (ctx: Context<TableOutput>, inputs: TableInputs) => {
121
+ if (ctx.event === "create") {
122
+ // create logic
123
+ } else if (ctx.event === "update") {
124
+ // update logic
125
+ } else if (ctx.event === "delete") {
126
+ // delete logic
127
+ }
128
+ // ..
129
+ return output;
130
+ }
131
+ ) {}
132
+ ```
133
+
134
+ > [!TIP]
135
+ > 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.
136
+
137
+ That's it! Now you can instantiate tables in your app.
138
+
139
+ ```ts
140
+ const table = new Table("items", {
141
+ name: "items",
142
+ //..
143
+ });
144
+
145
+ table.tableArn; // Output<string>
146
+ ```
147
+
148
+ 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:
149
+
150
+ ```ts
151
+ const Table = Resource("dynamo::Table", async (ctx, inputs) => {
152
+ //..
153
+ });
154
+
155
+ const table = new Table("items", {
156
+ name: "items",
157
+ //..
158
+ });
159
+ ```
160
+
161
+ > [!TIP]
162
+ > 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.
163
+
164
+ ## Lazy Outputs
165
+
166
+ 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.
167
+
168
+ ```ts
169
+ const table = new Table("my-table", { .. });
170
+
171
+ const tableArn = table.tableArn; // Output<string>
172
+ ```
173
+
174
+ Outputs can be chained explicitly and implicitly:
175
+
176
+ 1. _Explicitly_ with `.apply`
177
+
178
+ ```ts
179
+ const tableArn: Output<string> = table.tableArn.apply((arn: string) =>
180
+ // do something with the arn string value
181
+ arn.replace("table", "arn:aws:dynamodb:")
182
+ );
183
+ ```
184
+
185
+ 2. _Implicitly_ chained
186
+
187
+ ```ts
188
+ const tableArn = table.attributeDefinitions[0].attributeName; // Output<string>
189
+ // equivalent to:
190
+ // table.apply(t => t.attributeDefinitions[0].attributeName);
191
+ ```
192
+
193
+ > [!NOTE]
194
+ > Output is inspired by Pulumi, with a little extra added sugar.
195
+
196
+ ## `apply` and `destroy`
197
+
198
+ Calling `alchemize` is optional. Any object in your graph (`Resource` or `Output<T>`) can be "applied" or "destroyed" individually and programmatically.
199
+
200
+ Say, you've got some two resources, a `Role` and a `Function`.
201
+
202
+ ```ts
203
+ const role = new Role("my-role", {
204
+ name: "my-role",
205
+ //..
206
+ });
207
+
208
+ const func = new Function("my-function", {
209
+ name: "my-function",
210
+ role: role.roleArn,
211
+ //..
212
+ });
213
+ ```
214
+
215
+ Each of these Resources is known as a "sub-graph".
216
+
217
+ In this case we have `Role` (a 1-node graph, `Role`), and `Function` (a 2-node graph, `Role → Function`).
218
+
219
+ Each sub-graph can be "applied" or "destroyed" individually using the `apply` and `destroy` functions:
220
+
221
+ ```ts
222
+ import { apply, destroy } from "alchemy";
223
+
224
+ // will create Role and then Function (in that order)
225
+ const { functionArn } = await apply(func);
226
+
227
+ // you can destroy it right after if you want ☠️
228
+ await destroy(func); // will delete just the Function
229
+
230
+ // destroy deletes the resource and any downstream dependencies
231
+ // so, if you want to delete Role AND Function, you should call destroy(role)
232
+ await destroy(role); // will delete Role and then Function
233
+ ```
234
+
235
+ ## Destroying the app
236
+
237
+ 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.
238
+
239
+ ```ts
240
+ await alchemize({ mode: "destroy", stage: <optional> });
241
+ ```
242
+
243
+ > [!TIP]
244
+ > 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.
245
+ >
246
+ > ```ts
247
+ > await alchemize({
248
+ > // decide the mode/stage however you want, e.g. a CLI parser
249
+ > mode: process.argv[2] === "destroy" ? "destroy" : "up",
250
+ > stage: process.argv[3],
251
+ > });
252
+ > ```
253
+
254
+ ## "Stage" and State
255
+
256
+ > [!NOTE]
257
+ > Stage is inspired by [SST](https://sst.dev)'s stage concept.
258
+
259
+ Alchemy supports a "stage" concept to help isolate different environments from each other. E.g. a `"user"` or `"dev"` or `"prod"` stage.
260
+
261
+ By default, the stage is assumed to be your user name (a sensible default for local development).
262
+
263
+ To override the stage, you have three options:
264
+
265
+ 1. Pass the `stage` option to `alchemize`/`apply`/`destroy` (recommended)
266
+
267
+ ```ts
268
+ // alchemize the entire app
269
+ await alchemize({ stage: "production" });
270
+
271
+ // apply a single resource
272
+ await apply(func, { stage: "production" });
273
+ ```
274
+
275
+ 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.
276
+
277
+ ```ts
278
+ export default {
279
+ defaultStage: "production",
280
+ };
281
+ ```
282
+
283
+ 3. Set the `ALCHEMY_STAGE` environment variable (not recommended, but available as an escape hatch)
284
+
285
+ ```sh
286
+ ALCHEMY_STAGE=production bun ./my-app.ts
287
+ ```
288
+
289
+ Each Resource "provider" can access the stage it's being deployed to via the `ctx.stage` property.
290
+
291
+ ```ts
292
+ class Table extends Resource("dynamo::Table", async (ctx, inputs) => {
293
+ ctx.stage; // "production"
294
+ });
295
+ ```
296
+
297
+ > [!CAUTION]
298
+ > 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.
299
+ >
300
+ > ```ts
301
+ > class Table extends Resource("dynamo::Table", async (ctx, inputs) => {
302
+ > const tableName = `${ctx.stage}-${inputs.tableName}`;
303
+ >
304
+ > // ..
305
+ > });
306
+ > ```
307
+
308
+ ## Global values and the `alchemy.ts` config file.
309
+
310
+ 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.
311
+
312
+ It supports overriding the `defaultStage` (instead of defaulting to your username) and providing a custom `stateStore` (instead of writing to the local file system).
313
+
314
+ ```ts
315
+ import type { Config } from "alchemy";
316
+
317
+ export default {
318
+ defaultStage: "dev",
319
+ stateStore: myCustomStateStore,
320
+ } satisfies Config;
321
+ ```
322
+
323
+ > [!NOTE]
324
+ > See [global.ts](./alchemy/src/global.ts).
package/lib/apply.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Output } from "./output";
1
+ import { type Output, type Resolve } from "./output";
2
2
  import { type Scope as IScope } from "./scope";
3
3
  import type { StateStore } from "./state";
4
4
  export interface ApplyOptions {
@@ -12,7 +12,7 @@ export interface ApplyOptions {
12
12
  * @param output A sub-graph that produces a resource.
13
13
  * @returns The resource properties.
14
14
  */
15
- export declare function apply<T>(output: T | Output<T>, options?: Partial<ApplyOptions>): Promise<T>;
15
+ export declare function apply<T>(output: T, options?: Partial<ApplyOptions>): Promise<Resolve<T>>;
16
16
  declare class Evaluated<T> {
17
17
  readonly value: T;
18
18
  readonly deps: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../src/apply.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAQlC,OAAO,EAAE,KAAK,KAAK,IAAI,MAAM,EAAY,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,KAAK,CAAC,CAAC,EAC3B,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,EACrB,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAC9B,OAAO,CAAC,CAAC,CAAC,CASZ;AAED,cAAM,SAAS,CAAC,CAAC;aAEG,KAAK,EAAE,CAAC;aACR,IAAI,EAAE,MAAM,EAAE;gBADd,KAAK,EAAE,CAAC,EACR,IAAI,GAAE,MAAM,EAAO;CAEtC;AAID,wBAAsB,QAAQ,CAAC,CAAC,EAC9B,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,EACrB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAiFvB"}
1
+ {"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../src/apply.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAe,KAAK,OAAO,EAAE,MAAM,UAAU,CAAC;AAQlE,OAAO,EAAE,KAAK,KAAK,IAAI,MAAM,EAAY,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,KAAK,CAAC,CAAC,EAC3B,MAAM,EAAE,CAAC,EACT,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAC9B,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CASrB;AAED,cAAM,SAAS,CAAC,CAAC;aAEG,KAAK,EAAE,CAAC;aACR,IAAI,EAAE,MAAM,EAAE;gBADd,KAAK,EAAE,CAAC,EACR,IAAI,GAAE,MAAM,EAAO;CAEtC;AAID,wBAAsB,QAAQ,CAAC,CAAC,EAC9B,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,EACrB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAiFvB"}
package/lib/apply.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defaultStage, defaultStateStore } from "./global";
2
- import { Output } from "./output";
2
+ import { OutputChain } from "./output";
3
3
  import { Input, Provider, ResourceID, isResource, } from "./resource";
4
4
  import { getScope } from "./scope";
5
5
  /**
@@ -53,7 +53,7 @@ export async function evaluate(output, options) {
53
53
  }
54
54
  return promise;
55
55
  }
56
- else if (output instanceof Output) {
56
+ else if (output instanceof OutputChain) {
57
57
  const inside = output;
58
58
  const parent = await evaluate(inside.parent, options);
59
59
  const ret = inside.fn(parent.value);
package/lib/apply.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"apply.js","sourceRoot":"","sources":["../src/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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C,CAAC,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAE1E,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,6BAA6B;IAC7B,OAAO,IAAI,SAAS,CAAI,MAAW,CAAC,CAAC;AACvC,CAAC"}
@@ -3,5 +3,6 @@ export * from "./function";
3
3
  export * from "./policy";
4
4
  export * from "./queue";
5
5
  export * from "./role";
6
+ export * from "./ses";
6
7
  export * from "./table";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/aws/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/aws/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC"}
package/lib/aws/index.js CHANGED
@@ -3,5 +3,6 @@ export * from "./function";
3
3
  export * from "./policy";
4
4
  export * from "./queue";
5
5
  export * from "./role";
6
+ export * from "./ses";
6
7
  export * from "./table";
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/aws/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/aws/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,75 @@
1
+ import { type DeliveryOptions, type ReputationOptions, type SendingOptions, type SuppressionOptions, type TrackingOptions } from "@aws-sdk/client-sesv2";
2
+ /**
3
+ * Properties for configuring AWS SES resources
4
+ */
5
+ export interface SESProps {
6
+ /**
7
+ * Name of the configuration set
8
+ */
9
+ configurationSetName?: string;
10
+ /**
11
+ * Email identity to verify (email address or domain)
12
+ */
13
+ emailIdentity?: string;
14
+ /**
15
+ * Whether to enable DKIM signing for the email identity
16
+ */
17
+ enableDkim?: boolean;
18
+ /**
19
+ * Sending options for the configuration set
20
+ */
21
+ sendingOptions?: SendingOptions;
22
+ /**
23
+ * Reputation options for the configuration set
24
+ */
25
+ reputationOptions?: ReputationOptions;
26
+ /**
27
+ * Tracking options for the configuration set
28
+ */
29
+ trackingOptions?: TrackingOptions;
30
+ /**
31
+ * Suppression options for the configuration set
32
+ */
33
+ suppressionOptions?: SuppressionOptions;
34
+ /**
35
+ * Delivery options for the configuration set
36
+ */
37
+ deliveryOptions?: DeliveryOptions;
38
+ /**
39
+ * Tags to apply to the SES resources
40
+ */
41
+ tags?: Record<string, string>;
42
+ }
43
+ /**
44
+ * Output returned after SES resource creation/update
45
+ */
46
+ export interface SESOutput extends SESProps {
47
+ /**
48
+ * Resource ID
49
+ */
50
+ id: string;
51
+ /**
52
+ * ARN of the configuration set if created
53
+ */
54
+ configurationSetArn?: string;
55
+ /**
56
+ * Email identity verification status if an identity was created
57
+ */
58
+ emailIdentityVerificationStatus?: string;
59
+ /**
60
+ * DKIM verification status if DKIM was enabled
61
+ */
62
+ dkimVerificationStatus?: string;
63
+ /**
64
+ * Email identity ARN if an identity was created
65
+ */
66
+ emailIdentityArn?: string;
67
+ }
68
+ declare const SES_base: import("../resource").Provider<"aws::SES", [props: SESProps], SESOutput>;
69
+ /**
70
+ * AWS SES resource for creating and configuring Simple Email Service
71
+ */
72
+ export declare class SES extends SES_base {
73
+ }
74
+ export {};
75
+ //# sourceMappingURL=ses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ses.d.ts","sourceRoot":"","sources":["../../src/aws/ses.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,eAAe,EAKpB,KAAK,iBAAiB,EAEtB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAI/B;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAEtC;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAElC;;OAEG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IAExC;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAElC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,+BAA+B,CAAC,EAAE,MAAM,CAAC;IAEzC;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;;AAED;;GAEG;AACH,qBAAa,GAAI,SAAQ,QAkPxB;CAAG"}