alchemy-effect 0.2.0 → 0.3.0

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 (428) hide show
  1. package/bin/alchemy-effect.js +55038 -8
  2. package/bin/alchemy-effect.js.map +1 -1
  3. package/bin/alchemy-effect.ts +266 -10
  4. package/lib/$.d.ts +5 -0
  5. package/lib/$.d.ts.map +1 -0
  6. package/lib/$.js +9 -0
  7. package/lib/$.js.map +1 -0
  8. package/lib/app.d.ts +4 -17
  9. package/lib/app.d.ts.map +1 -1
  10. package/lib/app.js +0 -20
  11. package/lib/app.js.map +1 -1
  12. package/lib/apply.d.ts +14 -74
  13. package/lib/apply.d.ts.map +1 -1
  14. package/lib/apply.js +62 -57
  15. package/lib/apply.js.map +1 -1
  16. package/lib/assert-never.d.ts +12 -0
  17. package/lib/assert-never.d.ts.map +1 -0
  18. package/lib/assert-never.js +11 -0
  19. package/lib/assert-never.js.map +1 -0
  20. package/lib/aws/account.d.ts +10 -1
  21. package/lib/aws/account.d.ts.map +1 -1
  22. package/lib/aws/account.js +18 -3
  23. package/lib/aws/account.js.map +1 -1
  24. package/lib/aws/client.d.ts.map +1 -1
  25. package/lib/aws/client.js +0 -1
  26. package/lib/aws/client.js.map +1 -1
  27. package/lib/aws/config.d.ts +15 -0
  28. package/lib/aws/config.d.ts.map +1 -0
  29. package/lib/aws/config.js +1 -0
  30. package/lib/aws/config.js.map +1 -0
  31. package/lib/aws/credentials.d.ts +10 -0
  32. package/lib/aws/credentials.d.ts.map +1 -1
  33. package/lib/aws/credentials.js +73 -47
  34. package/lib/aws/credentials.js.map +1 -1
  35. package/lib/aws/dynamodb/client.d.ts +1 -1
  36. package/lib/aws/dynamodb/client.d.ts.map +1 -1
  37. package/lib/aws/dynamodb/index.d.ts +2 -1
  38. package/lib/aws/dynamodb/index.d.ts.map +1 -1
  39. package/lib/aws/dynamodb/index.js +1 -2
  40. package/lib/aws/dynamodb/index.js.map +1 -1
  41. package/lib/aws/dynamodb/secondary-index.d.ts +5 -4
  42. package/lib/aws/dynamodb/secondary-index.d.ts.map +1 -1
  43. package/lib/aws/dynamodb/table.d.ts +23 -20
  44. package/lib/aws/dynamodb/table.d.ts.map +1 -1
  45. package/lib/aws/dynamodb/table.get-item.d.ts +8 -6
  46. package/lib/aws/dynamodb/table.get-item.d.ts.map +1 -1
  47. package/lib/aws/dynamodb/table.get-item.js +4 -2
  48. package/lib/aws/dynamodb/table.get-item.js.map +1 -1
  49. package/lib/aws/dynamodb/table.js.map +1 -1
  50. package/lib/aws/dynamodb/table.provider.d.ts +3 -4
  51. package/lib/aws/dynamodb/table.provider.d.ts.map +1 -1
  52. package/lib/aws/dynamodb/table.provider.js +17 -29
  53. package/lib/aws/dynamodb/table.provider.js.map +1 -1
  54. package/lib/aws/ec2/client.d.ts +1 -1
  55. package/lib/aws/ec2/client.d.ts.map +1 -1
  56. package/lib/aws/ec2/index.d.ts +3 -0
  57. package/lib/aws/ec2/index.d.ts.map +1 -1
  58. package/lib/aws/ec2/index.js +3 -0
  59. package/lib/aws/ec2/index.js.map +1 -1
  60. package/lib/aws/ec2/subnet.d.ts +175 -0
  61. package/lib/aws/ec2/subnet.d.ts.map +1 -0
  62. package/lib/aws/ec2/subnet.js +4 -0
  63. package/lib/aws/ec2/subnet.js.map +1 -0
  64. package/lib/aws/ec2/subnet.provider.d.ts +4 -0
  65. package/lib/aws/ec2/subnet.provider.d.ts.map +1 -0
  66. package/lib/aws/ec2/subnet.provider.js +250 -0
  67. package/lib/aws/ec2/subnet.provider.js.map +1 -0
  68. package/lib/aws/ec2/vpc.d.ts +12 -8
  69. package/lib/aws/ec2/vpc.d.ts.map +1 -1
  70. package/lib/aws/ec2/vpc.js +1 -0
  71. package/lib/aws/ec2/vpc.js.map +1 -1
  72. package/lib/aws/ec2/vpc.provider.d.ts +3 -4
  73. package/lib/aws/ec2/vpc.provider.d.ts.map +1 -1
  74. package/lib/aws/ec2/vpc.provider.js +11 -26
  75. package/lib/aws/ec2/vpc.provider.js.map +1 -1
  76. package/lib/aws/index.d.ts +16 -19
  77. package/lib/aws/index.d.ts.map +1 -1
  78. package/lib/aws/index.js +7 -10
  79. package/lib/aws/index.js.map +1 -1
  80. package/lib/aws/lambda/consume.d.ts +10 -11
  81. package/lib/aws/lambda/consume.d.ts.map +1 -1
  82. package/lib/aws/lambda/consume.js +3 -3
  83. package/lib/aws/lambda/consume.js.map +1 -1
  84. package/lib/aws/lambda/function.d.ts +7 -7
  85. package/lib/aws/lambda/function.d.ts.map +1 -1
  86. package/lib/aws/lambda/function.handler.d.ts +1 -1
  87. package/lib/aws/lambda/function.handler.d.ts.map +1 -1
  88. package/lib/aws/lambda/function.handler.js.map +1 -1
  89. package/lib/aws/lambda/function.invoke.d.ts +6 -4
  90. package/lib/aws/lambda/function.invoke.d.ts.map +1 -1
  91. package/lib/aws/lambda/function.invoke.js +3 -1
  92. package/lib/aws/lambda/function.invoke.js.map +1 -1
  93. package/lib/aws/lambda/function.js +1 -1
  94. package/lib/aws/lambda/function.js.map +1 -1
  95. package/lib/aws/lambda/function.provider.d.ts +5 -4
  96. package/lib/aws/lambda/function.provider.d.ts.map +1 -1
  97. package/lib/aws/lambda/function.provider.js +16 -14
  98. package/lib/aws/lambda/function.provider.js.map +1 -1
  99. package/lib/aws/lambda/index.d.ts +1 -0
  100. package/lib/aws/lambda/index.d.ts.map +1 -1
  101. package/lib/aws/lambda/index.js +1 -0
  102. package/lib/aws/lambda/index.js.map +1 -1
  103. package/lib/aws/lambda/serve.d.ts +2 -4
  104. package/lib/aws/lambda/serve.d.ts.map +1 -1
  105. package/lib/aws/profile.d.ts +2 -2
  106. package/lib/aws/profile.d.ts.map +1 -1
  107. package/lib/aws/profile.js +1 -1
  108. package/lib/aws/profile.js.map +1 -1
  109. package/lib/aws/region.d.ts +14 -2
  110. package/lib/aws/region.d.ts.map +1 -1
  111. package/lib/aws/region.js +26 -1
  112. package/lib/aws/region.js.map +1 -1
  113. package/lib/aws/sqs/client.d.ts +1 -1
  114. package/lib/aws/sqs/client.d.ts.map +1 -1
  115. package/lib/aws/sqs/index.d.ts +1 -0
  116. package/lib/aws/sqs/index.d.ts.map +1 -1
  117. package/lib/aws/sqs/index.js +1 -0
  118. package/lib/aws/sqs/index.js.map +1 -1
  119. package/lib/aws/sqs/queue.consume.d.ts +1 -1
  120. package/lib/aws/sqs/queue.consume.d.ts.map +1 -1
  121. package/lib/aws/sqs/queue.consume.js +0 -1
  122. package/lib/aws/sqs/queue.consume.js.map +1 -1
  123. package/lib/aws/sqs/queue.d.ts +6 -4
  124. package/lib/aws/sqs/queue.d.ts.map +1 -1
  125. package/lib/aws/sqs/queue.event-source.d.ts +8 -6
  126. package/lib/aws/sqs/queue.event-source.d.ts.map +1 -1
  127. package/lib/aws/sqs/queue.event-source.js +26 -44
  128. package/lib/aws/sqs/queue.event-source.js.map +1 -1
  129. package/lib/aws/sqs/queue.js +1 -1
  130. package/lib/aws/sqs/queue.js.map +1 -1
  131. package/lib/aws/sqs/queue.provider.d.ts +4 -4
  132. package/lib/aws/sqs/queue.provider.d.ts.map +1 -1
  133. package/lib/aws/sqs/queue.provider.js +3 -3
  134. package/lib/aws/sqs/queue.provider.js.map +1 -1
  135. package/lib/aws/sqs/queue.send-message.d.ts +7 -5
  136. package/lib/aws/sqs/queue.send-message.d.ts.map +1 -1
  137. package/lib/aws/sqs/queue.send-message.js +4 -2
  138. package/lib/aws/sqs/queue.send-message.js.map +1 -1
  139. package/lib/binding.d.ts +12 -12
  140. package/lib/binding.d.ts.map +1 -1
  141. package/lib/binding.js.map +1 -1
  142. package/lib/cli/components/ApprovePlan.d.ts +2 -2
  143. package/lib/cli/components/ApprovePlan.d.ts.map +1 -1
  144. package/lib/cli/components/ApprovePlan.js.map +1 -1
  145. package/lib/cli/components/Plan.d.ts +2 -2
  146. package/lib/cli/components/Plan.d.ts.map +1 -1
  147. package/lib/cli/components/Plan.js.map +1 -1
  148. package/lib/cli/components/PlanProgress.d.ts +8 -4
  149. package/lib/cli/components/PlanProgress.d.ts.map +1 -1
  150. package/lib/cli/components/PlanProgress.js +11 -1
  151. package/lib/cli/components/PlanProgress.js.map +1 -1
  152. package/lib/cli/index.d.ts +265 -224
  153. package/lib/cli/index.d.ts.map +1 -1
  154. package/lib/cli/index.js +57 -65
  155. package/lib/cli/index.js.map +1 -1
  156. package/lib/cli/ink-service.d.ts +4 -0
  157. package/lib/cli/ink-service.d.ts.map +1 -0
  158. package/lib/cli/ink-service.js +43 -0
  159. package/lib/cli/ink-service.js.map +1 -0
  160. package/lib/cli/service.d.ts +21 -0
  161. package/lib/cli/service.d.ts.map +1 -0
  162. package/lib/cli/service.js +5 -0
  163. package/lib/cli/service.js.map +1 -0
  164. package/lib/cloudflare/account.d.ts +10 -0
  165. package/lib/cloudflare/account.d.ts.map +1 -0
  166. package/lib/cloudflare/account.js +24 -0
  167. package/lib/cloudflare/account.js.map +1 -0
  168. package/lib/cloudflare/api.d.ts +7 -7
  169. package/lib/cloudflare/api.d.ts.map +1 -1
  170. package/lib/cloudflare/api.js +18 -17
  171. package/lib/cloudflare/api.js.map +1 -1
  172. package/lib/cloudflare/config.d.ts +9 -0
  173. package/lib/cloudflare/config.d.ts.map +1 -0
  174. package/lib/cloudflare/config.js +1 -0
  175. package/lib/cloudflare/config.js.map +1 -0
  176. package/lib/cloudflare/index.d.ts +3 -1
  177. package/lib/cloudflare/index.d.ts.map +1 -1
  178. package/lib/cloudflare/index.js +3 -0
  179. package/lib/cloudflare/index.js.map +1 -1
  180. package/lib/cloudflare/kv/namespace.binding.d.ts +5 -3
  181. package/lib/cloudflare/kv/namespace.binding.d.ts.map +1 -1
  182. package/lib/cloudflare/kv/namespace.binding.js +1 -1
  183. package/lib/cloudflare/kv/namespace.binding.js.map +1 -1
  184. package/lib/cloudflare/kv/namespace.d.ts +3 -2
  185. package/lib/cloudflare/kv/namespace.d.ts.map +1 -1
  186. package/lib/cloudflare/kv/namespace.js.map +1 -1
  187. package/lib/cloudflare/kv/namespace.provider.d.ts +3 -2
  188. package/lib/cloudflare/kv/namespace.provider.d.ts.map +1 -1
  189. package/lib/cloudflare/kv/namespace.provider.js +8 -7
  190. package/lib/cloudflare/kv/namespace.provider.js.map +1 -1
  191. package/lib/cloudflare/live.d.ts +5 -5
  192. package/lib/cloudflare/live.d.ts.map +1 -1
  193. package/lib/cloudflare/live.js +5 -8
  194. package/lib/cloudflare/live.js.map +1 -1
  195. package/lib/cloudflare/r2/bucket.binding.d.ts +5 -3
  196. package/lib/cloudflare/r2/bucket.binding.d.ts.map +1 -1
  197. package/lib/cloudflare/r2/bucket.binding.js +1 -1
  198. package/lib/cloudflare/r2/bucket.binding.js.map +1 -1
  199. package/lib/cloudflare/r2/bucket.d.ts +3 -2
  200. package/lib/cloudflare/r2/bucket.d.ts.map +1 -1
  201. package/lib/cloudflare/r2/bucket.js.map +1 -1
  202. package/lib/cloudflare/r2/bucket.provider.d.ts +3 -2
  203. package/lib/cloudflare/r2/bucket.provider.d.ts.map +1 -1
  204. package/lib/cloudflare/r2/bucket.provider.js +8 -7
  205. package/lib/cloudflare/r2/bucket.provider.js.map +1 -1
  206. package/lib/cloudflare/worker/assets.fetch.d.ts +3 -2
  207. package/lib/cloudflare/worker/assets.fetch.d.ts.map +1 -1
  208. package/lib/cloudflare/worker/assets.fetch.js +2 -1
  209. package/lib/cloudflare/worker/assets.fetch.js.map +1 -1
  210. package/lib/cloudflare/worker/assets.provider.d.ts +1 -1
  211. package/lib/cloudflare/worker/assets.provider.d.ts.map +1 -1
  212. package/lib/cloudflare/worker/index.d.ts +0 -1
  213. package/lib/cloudflare/worker/index.d.ts.map +1 -1
  214. package/lib/cloudflare/worker/worker.d.ts +5 -6
  215. package/lib/cloudflare/worker/worker.d.ts.map +1 -1
  216. package/lib/cloudflare/worker/worker.handler.d.ts +1 -1
  217. package/lib/cloudflare/worker/worker.handler.d.ts.map +1 -1
  218. package/lib/cloudflare/worker/worker.handler.js.map +1 -1
  219. package/lib/cloudflare/worker/worker.js.map +1 -1
  220. package/lib/cloudflare/worker/worker.provider.d.ts +3 -2
  221. package/lib/cloudflare/worker/worker.provider.d.ts.map +1 -1
  222. package/lib/cloudflare/worker/worker.provider.js +7 -6
  223. package/lib/cloudflare/worker/worker.provider.js.map +1 -1
  224. package/lib/cloudflare/worker/worker.serve.d.ts +7 -7
  225. package/lib/cloudflare/worker/worker.serve.d.ts.map +1 -1
  226. package/lib/cloudflare/worker/worker.serve.js.map +1 -1
  227. package/lib/data.d.ts +3 -0
  228. package/lib/data.d.ts.map +1 -0
  229. package/lib/data.js +8 -0
  230. package/lib/data.js.map +1 -0
  231. package/lib/destroy.d.ts +1 -1
  232. package/lib/destroy.d.ts.map +1 -1
  233. package/lib/destroy.js +1 -4
  234. package/lib/destroy.js.map +1 -1
  235. package/lib/diff.d.ts +16 -0
  236. package/lib/diff.d.ts.map +1 -0
  237. package/lib/diff.js +9 -0
  238. package/lib/diff.js.map +1 -0
  239. package/lib/env.d.ts +5 -0
  240. package/lib/env.d.ts.map +1 -1
  241. package/lib/env.js +15 -29
  242. package/lib/env.js.map +1 -1
  243. package/lib/exports.d.ts +9 -0
  244. package/lib/exports.d.ts.map +1 -0
  245. package/lib/exports.js +13 -0
  246. package/lib/exports.js.map +1 -0
  247. package/lib/index.d.ts +10 -2
  248. package/lib/index.d.ts.map +1 -1
  249. package/lib/index.js +10 -5
  250. package/lib/index.js.map +1 -1
  251. package/lib/input.d.ts +32 -0
  252. package/lib/input.d.ts.map +1 -0
  253. package/lib/input.js +1 -0
  254. package/lib/input.js.map +1 -0
  255. package/lib/output.d.ts +143 -0
  256. package/lib/output.d.ts.map +1 -0
  257. package/lib/output.js +269 -0
  258. package/lib/output.js.map +1 -0
  259. package/lib/plan.d.ts +47 -28
  260. package/lib/plan.d.ts.map +1 -1
  261. package/lib/plan.js +257 -151
  262. package/lib/plan.js.map +1 -1
  263. package/lib/policy.d.ts +3 -4
  264. package/lib/policy.d.ts.map +1 -1
  265. package/lib/policy.js +0 -1
  266. package/lib/policy.js.map +1 -1
  267. package/lib/provider.d.ts +14 -16
  268. package/lib/provider.d.ts.map +1 -1
  269. package/lib/ref.d.ts +14 -0
  270. package/lib/ref.d.ts.map +1 -0
  271. package/lib/ref.js +21 -0
  272. package/lib/ref.js.map +1 -0
  273. package/lib/resource.d.ts +11 -6
  274. package/lib/resource.d.ts.map +1 -1
  275. package/lib/resource.js.map +1 -1
  276. package/lib/runtime.d.ts +7 -6
  277. package/lib/runtime.d.ts.map +1 -1
  278. package/lib/runtime.js.map +1 -1
  279. package/lib/service.d.ts +9 -6
  280. package/lib/service.d.ts.map +1 -1
  281. package/lib/service.js.map +1 -1
  282. package/lib/stack.d.ts +60 -0
  283. package/lib/stack.d.ts.map +1 -0
  284. package/lib/stack.js +11 -0
  285. package/lib/stack.js.map +1 -0
  286. package/lib/stage.d.ts +39 -0
  287. package/lib/stage.d.ts.map +1 -0
  288. package/lib/stage.js +32 -0
  289. package/lib/stage.js.map +1 -0
  290. package/lib/state.d.ts +51 -10
  291. package/lib/state.d.ts.map +1 -1
  292. package/lib/state.js +30 -29
  293. package/lib/state.js.map +1 -1
  294. package/lib/test.d.ts +25 -4
  295. package/lib/test.d.ts.map +1 -1
  296. package/lib/test.js +54 -14
  297. package/lib/test.js.map +1 -1
  298. package/lib/tsconfig.test.tsbuildinfo +1 -1
  299. package/lib/type.d.ts +3 -0
  300. package/lib/type.d.ts.map +1 -1
  301. package/lib/unknown.d.ts +4 -0
  302. package/lib/unknown.d.ts.map +1 -0
  303. package/lib/unknown.js +4 -0
  304. package/lib/unknown.js.map +1 -0
  305. package/lib/user.d.ts +3 -0
  306. package/lib/user.d.ts.map +1 -0
  307. package/lib/user.js +3 -0
  308. package/lib/user.js.map +1 -0
  309. package/lib/util.d.ts +6 -0
  310. package/lib/util.d.ts.map +1 -0
  311. package/lib/util.js +9 -0
  312. package/lib/util.js.map +1 -0
  313. package/package.json +18 -12
  314. package/src/$.ts +17 -0
  315. package/src/app.ts +3 -32
  316. package/src/apply.ts +429 -441
  317. package/src/assert-never.ts +18 -0
  318. package/src/aws/account.ts +23 -3
  319. package/src/aws/client.ts +0 -1
  320. package/src/aws/config.ts +16 -0
  321. package/src/aws/credentials.ts +212 -177
  322. package/src/aws/dynamodb/index.ts +3 -3
  323. package/src/aws/dynamodb/table.get-item.ts +5 -9
  324. package/src/aws/dynamodb/table.provider.ts +35 -39
  325. package/src/aws/dynamodb/table.ts +29 -84
  326. package/src/aws/ec2/index.ts +4 -0
  327. package/src/aws/ec2/subnet.provider.ts +358 -0
  328. package/src/aws/ec2/subnet.ts +213 -0
  329. package/src/aws/ec2/vpc.provider.ts +20 -36
  330. package/src/aws/ec2/vpc.ts +19 -8
  331. package/src/aws/index.ts +46 -40
  332. package/src/aws/lambda/consume.ts +8 -7
  333. package/src/aws/lambda/function.handler.ts +1 -1
  334. package/src/aws/lambda/function.invoke.ts +6 -2
  335. package/src/aws/lambda/function.provider.ts +28 -21
  336. package/src/aws/lambda/function.ts +7 -4
  337. package/src/aws/lambda/index.ts +2 -0
  338. package/src/aws/profile.ts +1 -4
  339. package/src/aws/region.ts +42 -3
  340. package/src/aws/sqs/index.ts +2 -0
  341. package/src/aws/sqs/queue.consume.ts +1 -1
  342. package/src/aws/sqs/queue.event-source.ts +29 -55
  343. package/src/aws/sqs/queue.provider.ts +11 -4
  344. package/src/aws/sqs/queue.send-message.ts +5 -8
  345. package/src/aws/sqs/queue.ts +9 -4
  346. package/src/binding.ts +19 -19
  347. package/src/cli/components/ApprovePlan.tsx +2 -2
  348. package/src/cli/components/Plan.tsx +3 -2
  349. package/src/cli/components/PlanProgress.tsx +32 -14
  350. package/src/cli/index.ts +2 -6
  351. package/src/cli/ink-service.tsx +61 -0
  352. package/src/cli/service.ts +23 -0
  353. package/src/cloudflare/account.ts +37 -0
  354. package/src/cloudflare/api.ts +33 -29
  355. package/src/cloudflare/config.ts +7 -0
  356. package/src/cloudflare/index.ts +3 -1
  357. package/src/cloudflare/kv/namespace.binding.ts +3 -1
  358. package/src/cloudflare/kv/namespace.provider.ts +9 -8
  359. package/src/cloudflare/kv/namespace.ts +3 -2
  360. package/src/cloudflare/live.ts +11 -17
  361. package/src/cloudflare/r2/bucket.binding.ts +3 -1
  362. package/src/cloudflare/r2/bucket.provider.ts +9 -8
  363. package/src/cloudflare/r2/bucket.ts +8 -2
  364. package/src/cloudflare/worker/assets.fetch.ts +3 -1
  365. package/src/cloudflare/worker/assets.provider.ts +1 -1
  366. package/src/cloudflare/worker/index.ts +0 -2
  367. package/src/cloudflare/worker/worker.handler.ts +1 -1
  368. package/src/cloudflare/worker/worker.provider.ts +16 -13
  369. package/src/cloudflare/worker/worker.serve.ts +5 -2
  370. package/src/cloudflare/worker/worker.ts +4 -3
  371. package/src/data.ts +18 -0
  372. package/src/destroy.ts +1 -5
  373. package/src/diff.ts +30 -0
  374. package/src/env.ts +20 -32
  375. package/src/exports.ts +21 -0
  376. package/src/index.ts +10 -5
  377. package/src/input.ts +81 -0
  378. package/src/output.ts +518 -0
  379. package/src/plan.ts +380 -192
  380. package/src/policy.ts +3 -5
  381. package/src/provider.ts +25 -23
  382. package/src/ref.ts +48 -0
  383. package/src/resource.ts +20 -6
  384. package/src/runtime.ts +15 -8
  385. package/src/service.ts +11 -7
  386. package/src/stack.ts +116 -0
  387. package/src/stage.ts +85 -0
  388. package/src/state.ts +138 -60
  389. package/src/test.ts +117 -16
  390. package/src/type.ts +4 -0
  391. package/src/unknown.ts +6 -0
  392. package/src/user.ts +4 -0
  393. package/src/util.ts +21 -0
  394. package/lib/approve.d.ts +0 -15
  395. package/lib/approve.d.ts.map +0 -1
  396. package/lib/approve.js +0 -7
  397. package/lib/approve.js.map +0 -1
  398. package/lib/cli/approve.d.ts +0 -4
  399. package/lib/cli/approve.d.ts.map +0 -1
  400. package/lib/cli/approve.js +0 -18
  401. package/lib/cli/approve.js.map +0 -1
  402. package/lib/cli/clack.d.ts +0 -14
  403. package/lib/cli/clack.d.ts.map +0 -1
  404. package/lib/cli/clack.js +0 -12
  405. package/lib/cli/clack.js.map +0 -1
  406. package/lib/cli/main.d.ts +0 -2
  407. package/lib/cli/main.d.ts.map +0 -1
  408. package/lib/cli/main.js +0 -1
  409. package/lib/cli/main.js.map +0 -1
  410. package/lib/cli/plan.d.ts +0 -13
  411. package/lib/cli/plan.d.ts.map +0 -1
  412. package/lib/cli/plan.js +0 -1
  413. package/lib/cli/plan.js.map +0 -1
  414. package/lib/cli/progress.d.ts +0 -7
  415. package/lib/cli/progress.d.ts.map +0 -1
  416. package/lib/cli/progress.js +0 -30
  417. package/lib/cli/progress.js.map +0 -1
  418. package/lib/cli/spinner.d.ts +0 -2
  419. package/lib/cli/spinner.d.ts.map +0 -1
  420. package/lib/cli/spinner.js +0 -13
  421. package/lib/cli/spinner.js.map +0 -1
  422. package/src/approve.ts +0 -13
  423. package/src/cli/approve.tsx +0 -30
  424. package/src/cli/clack.ts +0 -22
  425. package/src/cli/main.ts +0 -0
  426. package/src/cli/plan.ts +0 -16
  427. package/src/cli/progress.tsx +0 -46
  428. package/src/cli/spinner.ts +0 -14
@@ -1,18 +1,19 @@
1
1
  import type { R2 } from "cloudflare/resources";
2
2
  import * as Effect from "effect/Effect";
3
3
  import { App } from "../../app";
4
- import { CloudflareAccountId, CloudflareApi } from "../api";
4
+ import { Account } from "../account.ts";
5
+ import { CloudflareApi } from "../api";
5
6
  import { Bucket, type BucketAttr, type BucketProps } from "./bucket";
6
7
 
7
8
  export const bucketProvider = () =>
8
9
  Bucket.provider.effect(
9
10
  Effect.gen(function* () {
10
11
  const api = yield* CloudflareApi;
11
- const accountId = yield* CloudflareAccountId;
12
+ const accountId = yield* Account;
12
13
  const app = yield* App;
13
14
 
14
- const createName = (id: string, props: BucketProps) =>
15
- props.name ?? `${app.name}-${id}-${app.stage}`.toLowerCase();
15
+ const createName = (id: string, name: string | undefined) =>
16
+ name ?? `${app.name}-${id}-${app.stage}`.toLowerCase();
16
17
 
17
18
  const mapResult = <Props extends BucketProps>(
18
19
  bucket: R2.Bucket,
@@ -30,7 +31,7 @@ export const bucketProvider = () =>
30
31
  Effect.sync(() => {
31
32
  if (
32
33
  output.accountId !== accountId ||
33
- output.name !== createName(id, news) ||
34
+ output.name !== createName(id, news.name) ||
34
35
  output.jurisdiction !== (news.jurisdiction ?? "default") ||
35
36
  olds.locationHint !== news.locationHint
36
37
  ) {
@@ -44,14 +45,14 @@ export const bucketProvider = () =>
44
45
  create: Effect.fnUntraced(function* ({ id, news }) {
45
46
  const bucket = yield* api.r2.buckets.create({
46
47
  account_id: accountId,
47
- name: createName(id, news),
48
+ name: createName(id, news.name),
48
49
  storageClass: news.storageClass,
49
50
  jurisdiction: news.jurisdiction,
50
51
  locationHint: news.locationHint,
51
52
  });
52
53
  return mapResult<BucketProps>(bucket);
53
54
  }),
54
- update: Effect.fnUntraced(function* ({ id, news, output }) {
55
+ update: Effect.fnUntraced(function* ({ news, output }) {
55
56
  const bucket = yield* api.r2.buckets.edit(output.name, {
56
57
  account_id: output.accountId,
57
58
  storage_class: news.storageClass ?? output.storageClass,
@@ -69,7 +70,7 @@ export const bucketProvider = () =>
69
70
  read: Effect.fnUntraced(function* ({ id, output, olds }) {
70
71
  const params = {
71
72
  account_id: output?.accountId ?? accountId,
72
- name: output?.name ?? createName(id, olds ?? {}),
73
+ name: output?.name ?? createName(id, olds?.name),
73
74
  };
74
75
  return yield* api.r2.buckets
75
76
  .get(params.name, { account_id: params.account_id })
@@ -22,12 +22,18 @@ export type BucketAttr<Props extends BucketProps> = {
22
22
  export interface Bucket<
23
23
  ID extends string = string,
24
24
  Props extends BucketProps = BucketProps,
25
- > extends Resource<"Cloudflare.R2.Bucket", ID, Props, BucketAttr<Props>> {}
25
+ > extends Resource<
26
+ "Cloudflare.R2.Bucket",
27
+ ID,
28
+ Props,
29
+ BucketAttr<Props>,
30
+ Bucket
31
+ > {}
26
32
 
27
33
  export const Bucket = Resource<{
28
34
  <const ID extends string, const Props extends BucketProps>(
29
35
  id: ID,
30
- props: Props,
36
+ props?: Props,
31
37
  ): Bucket<ID, Props>;
32
38
  }>("Cloudflare.R2.Bucket");
33
39
 
@@ -1,6 +1,8 @@
1
1
  import type * as runtime from "@cloudflare/workers-types";
2
- import { Binding, declare, type Capability } from "alchemy-effect";
3
2
  import * as Effect from "effect/Effect";
3
+ import { Binding } from "../../binding.ts";
4
+ import type { Capability } from "../../capability.ts";
5
+ import { declare } from "../../policy.ts";
4
6
  import { getCloudflareEnvKey } from "../context.ts";
5
7
  import { Worker } from "./worker.ts";
6
8
 
@@ -2,7 +2,7 @@ import { FileSystem, Path } from "@effect/platform";
2
2
  import type { PlatformError } from "@effect/platform/Error";
3
3
  import { Context, Data, Layer } from "effect";
4
4
  import * as Effect from "effect/Effect";
5
- import type { ScopedPlanStatusSession } from "../../apply.ts";
5
+ import type { ScopedPlanStatusSession } from "../../cli/service.ts";
6
6
  import { sha256 } from "../../sha256.ts";
7
7
  import { CloudflareApi, CloudflareApiError } from "../api.ts";
8
8
  import type { Worker } from "./worker.ts";
@@ -2,5 +2,3 @@ export * from "./assets.fetch.ts";
2
2
  export * from "./worker.handler.ts";
3
3
  export * from "./worker.serve.ts";
4
4
  export * from "./worker.ts";
5
-
6
- export type * as Alchemy from "../../index.ts";
@@ -1,7 +1,7 @@
1
1
  import type * as runtime from "@cloudflare/workers-types";
2
- import type { Capability } from "alchemy-effect";
3
2
  import * as Effect from "effect/Effect";
4
3
  import * as Layer from "effect/Layer";
4
+ import type { Capability } from "../../capability.ts";
5
5
  import { CloudflareContext } from "../context.ts";
6
6
 
7
7
  type Handler = (
@@ -3,11 +3,12 @@ import * as Path from "@effect/platform/Path";
3
3
  import type { Workers } from "cloudflare/resources.mjs";
4
4
  import * as Effect from "effect/Effect";
5
5
  import { App } from "../../app.ts";
6
- import type { ScopedPlanStatusSession } from "../../apply.ts";
6
+ import type { ScopedPlanStatusSession } from "../../cli/service.ts";
7
7
  import { DotAlchemy } from "../../dot-alchemy.ts";
8
8
  import { ESBuild } from "../../esbuild.ts";
9
9
  import { sha256 } from "../../sha256.ts";
10
- import { CloudflareAccountId, CloudflareApi } from "../api.ts";
10
+ import { CloudflareApi } from "../api.ts";
11
+ import { Account } from "../account.ts";
11
12
  import { Assets } from "./assets.provider.ts";
12
13
  import { Worker, type WorkerAttr, type WorkerProps } from "./worker.ts";
13
14
 
@@ -16,7 +17,7 @@ export const workerProvider = () =>
16
17
  Effect.gen(function* () {
17
18
  const app = yield* App;
18
19
  const api = yield* CloudflareApi;
19
- const accountId = yield* CloudflareAccountId;
20
+ const accountId = yield* Account;
20
21
  const { read, upload } = yield* Assets;
21
22
  const { build } = yield* ESBuild;
22
23
  const fs = yield* FileSystem.FileSystem;
@@ -46,8 +47,8 @@ export const workerProvider = () =>
46
47
  yield* Effect.logDebug("setWorkerSubdomain", subdomain);
47
48
  });
48
49
 
49
- const createWorkerName = (id: string, props: WorkerProps | undefined) =>
50
- props?.name ?? `${app.name}-${id}-${app.stage}`.toLowerCase();
50
+ const createWorkerName = (id: string, name: string | undefined) =>
51
+ name ?? `${app.name}-${id}-${app.stage}`.toLowerCase();
51
52
 
52
53
  const prepareAssets = Effect.fnUntraced(function* (
53
54
  assets: WorkerProps["assets"],
@@ -83,7 +84,9 @@ export const workerProvider = () =>
83
84
  };
84
85
  });
85
86
 
86
- const prepareMetadata = Effect.fnUntraced(function* (props: WorkerProps) {
87
+ const prepareMetadata = Effect.fnUntraced(function* (
88
+ props: WorkerProps<any>,
89
+ ) {
87
90
  const metadata: Workers.ScriptUpdateParams.Metadata = {
88
91
  assets: undefined,
89
92
  bindings: [],
@@ -113,13 +116,13 @@ export const workerProvider = () =>
113
116
 
114
117
  const putWorker = Effect.fnUntraced(function* (
115
118
  id: string,
116
- news: WorkerProps,
119
+ news: WorkerProps<any>,
117
120
  bindings: Worker["binding"][],
118
- olds: WorkerProps | undefined,
119
- output: WorkerAttr<WorkerProps> | undefined,
121
+ olds: WorkerProps<any> | undefined,
122
+ output: WorkerAttr<WorkerProps<any>> | undefined,
120
123
  session: ScopedPlanStatusSession,
121
124
  ) {
122
- const name = createWorkerName(id, news);
125
+ const name = createWorkerName(id, news.name);
123
126
  const [assets, bundle, metadata] = yield* Effect.all([
124
127
  prepareAssets(news.assets),
125
128
  prepareBundle(id, news.main),
@@ -180,7 +183,7 @@ export const workerProvider = () =>
180
183
  assets: assets?.hash,
181
184
  bundle: bundle.hash,
182
185
  },
183
- } as WorkerAttr<WorkerProps>;
186
+ } as WorkerAttr<WorkerProps<any>>;
184
187
  });
185
188
 
186
189
  return {
@@ -188,7 +191,7 @@ export const workerProvider = () =>
188
191
  if (output.accountId !== accountId) {
189
192
  return { action: "replace" };
190
193
  }
191
- const workerName = createWorkerName(id, news);
194
+ const workerName = createWorkerName(id, news.name);
192
195
  if (workerName !== output.name) {
193
196
  return { action: "replace" };
194
197
  }
@@ -204,7 +207,7 @@ export const workerProvider = () =>
204
207
  }
205
208
  }),
206
209
  create: Effect.fnUntraced(function* ({ id, news, bindings, session }) {
207
- const name = createWorkerName(id, news);
210
+ const name = createWorkerName(id, news.name);
208
211
  const existing = yield* api.workers.beta.workers
209
212
  .get(name, {
210
213
  account_id: accountId,
@@ -1,7 +1,10 @@
1
- import type * as types from "@cloudflare/workers-types";
1
+ import type { ExecutionContext } from "@cloudflare/workers-types";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Worker from "./worker.ts";
4
4
 
5
+ export type { ExecutionContext };
6
+ export type * from "../../exports.ts";
7
+
5
8
  export const serve =
6
9
  <const ID extends string, Req>(
7
10
  id: ID,
@@ -11,7 +14,7 @@ export const serve =
11
14
  fetch: (
12
15
  request: Request,
13
16
  env: unknown,
14
- ctx: types.ExecutionContext,
17
+ ctx: ExecutionContext,
15
18
  ) => Effect.Effect<Response, never, Req>;
16
19
  },
17
20
  ) =>
@@ -29,7 +29,7 @@ export type WorkerProps<Req = any> = RuntimeProps<
29
29
  assets: string | Worker.AssetsProps;
30
30
  });
31
31
 
32
- export type WorkerAttr<Props extends WorkerProps> = {
32
+ export type WorkerAttr<Props extends WorkerProps<any>> = {
33
33
  id: string;
34
34
  name: Props["name"] extends string ? Props["name"] : string;
35
35
  logpush: Props["logpush"] extends boolean ? Props["logpush"] : boolean;
@@ -48,8 +48,9 @@ export type WorkerAttr<Props extends WorkerProps> = {
48
48
  };
49
49
 
50
50
  export interface Worker extends Runtime<WorkerType> {
51
- props: WorkerProps;
52
- attr: WorkerAttr<Extract<this["props"], WorkerProps>>;
51
+ base: Worker;
52
+ props: WorkerProps<any>;
53
+ attr: WorkerAttr<Extract<this["props"], WorkerProps<any>>>;
53
54
  binding: {
54
55
  bindings: Worker.Binding[];
55
56
  };
package/src/data.ts ADDED
@@ -0,0 +1,18 @@
1
+ export type Primitive =
2
+ | never
3
+ | undefined
4
+ | null
5
+ | boolean
6
+ | number
7
+ | string
8
+ | bigint
9
+ | symbol;
10
+
11
+ export const isPrimitive = (value: any): value is Primitive =>
12
+ value === undefined ||
13
+ value === null ||
14
+ typeof value === "boolean" ||
15
+ typeof value === "number" ||
16
+ typeof value === "string" ||
17
+ typeof value === "symbol" ||
18
+ typeof value === "bigint";
package/src/destroy.ts CHANGED
@@ -1,7 +1,3 @@
1
1
  import { apply } from "./apply.ts";
2
2
 
3
- export const destroy = () =>
4
- apply({
5
- phase: "destroy",
6
- resources: [],
7
- });
3
+ export const destroy = () => apply();
package/src/diff.ts ADDED
@@ -0,0 +1,30 @@
1
+ export type Diff =
2
+ | {
3
+ action: "noop";
4
+ deleteFirst?: undefined;
5
+ stables?: undefined;
6
+ }
7
+ | {
8
+ action: "update";
9
+ deleteFirst?: undefined;
10
+ /** properties that won't change as part of this update */
11
+ stables?: string[];
12
+ }
13
+ | {
14
+ action: "replace";
15
+ deleteFirst?: boolean;
16
+ stables?: undefined;
17
+ };
18
+
19
+ export const somePropsAreDifferent = <Props extends Record<string, any>>(
20
+ olds: Props,
21
+ news: Props,
22
+ props: (keyof Props)[],
23
+ ) => {
24
+ for (const prop of props) {
25
+ if (olds[prop] !== news[prop]) {
26
+ return true;
27
+ }
28
+ }
29
+ return false;
30
+ };
package/src/env.ts CHANGED
@@ -1,9 +1,28 @@
1
+ let _env;
2
+ try {
3
+ // @ts-expect-error
4
+ const { env } = await import("cloudflare:workers");
5
+ _env = env;
6
+ } catch {
7
+ if (typeof process !== "undefined") {
8
+ _env = process.env;
9
+ } else {
10
+ _env = import.meta.env;
11
+ }
12
+ }
13
+
14
+ export interface Env {
15
+ [key: string]: string | undefined;
16
+ }
17
+
18
+ export const env: Env = _env;
19
+
1
20
  export const toEnvKey = <const ID extends string, const Suffix extends string>(
2
21
  id: ID,
3
22
  suffix: Suffix,
4
23
  ) => `${replace(toUpper(id))}_${replace(toUpper(suffix))}` as const;
5
24
 
6
- const toUpper = <const S extends string>(str: S) =>
25
+ export const toUpper = <const S extends string>(str: S) =>
7
26
  str.toUpperCase() as string extends S ? S : Uppercase<S>;
8
27
 
9
28
  const replace = <const S extends string>(str: S) =>
@@ -18,34 +37,3 @@ type Replace<S extends string, Accum extends string = ""> = string extends S
18
37
  ? Replace<Rest, `${Accum}_`>
19
38
  : Replace<Rest, `${Accum}${S}`>
20
39
  : Accum;
21
-
22
- function _test_both_literals() {
23
- const key = toEnvKey("my-id", "my-suffix");
24
- const _: typeof key = "MY_ID_MY_SUFFIX";
25
- // @ts-expect-error
26
- const _err: typeof key = "MY_ID_MY_SUFFIX2";
27
- }
28
- function _test_replace_wide_string() {
29
- const ___ = toUpper(undefined! as string);
30
- const id: string = "my-id";
31
- const key = toEnvKey(id, "my-suffix");
32
- const _: typeof key = "MY_ID_MY_SUFFIX";
33
- const _2: typeof key = `${id}_MY_SUFFIX` as const;
34
- // @ts-expect-error
35
- const _err: typeof key = "MY_ID_MY_SUFFIX2";
36
- // @ts-expect-error
37
- const _err2: typeof key = `${id}_MY_SUFFIX2` as const;
38
- }
39
-
40
- function _test_replace_wide_suffix() {
41
- const ___ = toUpper(undefined! as string);
42
- const id = "my-id";
43
- const suffix = "my-suffix" as string;
44
- const key = toEnvKey(id, suffix);
45
- const _: typeof key = "MY_ID_MY_SUFFIX";
46
- const _2: typeof key = `MY_ID_${suffix}` as const;
47
- // @ts-expect-error
48
- const _err: typeof key = "WRONG_PREFIX_MY_SUFFIX";
49
- // @ts-expect-error
50
- const _err2: typeof key = `WRONG_PREFIX_${suffix}`;
51
- }
package/src/exports.ts ADDED
@@ -0,0 +1,21 @@
1
+ /*
2
+ This file is used to provide a minimal set of exported types required to solve portability
3
+ issues in sub-modules (e.g. cloudflare/worker).
4
+
5
+ Sub-modules are expected to `export type * from "../../exports.ts";` to ensure that the minimal set of types are exported.
6
+
7
+ This is instead of:
8
+ 1. `export type * from "../../index.ts";` which would export too many types
9
+ 2. `export type * as Alchemy from "../../index.ts";` which creates very long, confusing types.
10
+
11
+ TODO(sam): figure out a way to avoid this entirely
12
+ */
13
+
14
+ export type * from "./$.ts";
15
+ export type * from "./binding.ts";
16
+ export type * from "./capability.ts";
17
+ export type * from "./policy.ts";
18
+ export type * from "./provider.ts";
19
+ export type * from "./resource.ts";
20
+ export type * from "./runtime.ts";
21
+ export type * from "./service.ts";
package/src/index.ts CHANGED
@@ -1,22 +1,27 @@
1
+ export * from "./$.ts";
1
2
  export * from "./app.ts";
2
3
  export * from "./apply.ts";
3
- export * from "./approve.ts";
4
4
  export * from "./binding.ts";
5
5
  export * from "./capability.ts";
6
6
  export * from "./destroy.ts";
7
7
  export * from "./dot-alchemy.ts";
8
- export * from "./env.ts";
8
+ export { env, toEnvKey, type Env } from "./env.ts";
9
9
  export * from "./event.ts";
10
+ export * from "./input.ts";
11
+ export * as Output from "./output.ts";
10
12
  export * from "./phase.ts";
11
13
  export * from "./plan.ts";
12
14
  export * from "./policy.ts";
13
15
  export * from "./provider.ts";
14
16
  export * from "./resource.ts";
15
17
  export * from "./runtime.ts";
18
+ export * from "./ref.ts";
16
19
  export * from "./service.ts";
20
+ export * from "./stack.ts";
17
21
  export * from "./type.ts";
22
+ export * from "./unknown.ts";
23
+ export * from "./stage.ts";
24
+ export * from "./user.ts";
25
+ export { assertDefined } from "./util.ts";
18
26
 
19
- // export * as AWS from "./aws/index.ts";
20
- // export * as CLI from "./cli/index.ts";
21
- // export * as Cloudflare from "./cloudflare/index.ts";
22
27
  export * as State from "./state.ts";
package/src/input.ts ADDED
@@ -0,0 +1,81 @@
1
+ import type * as S from "effect/Schema";
2
+ import type { Primitive } from "./data.ts";
3
+ import type { Output } from "./output.ts";
4
+
5
+ export type Function = (...args: any[]) => any;
6
+ export type Constructor = new (...args: any[]) => any;
7
+ export type PolicyLike = { kind: "alchemy/Policy" };
8
+
9
+ export type Input<T> =
10
+ | T
11
+ | (T extends S.Schema<any>
12
+ ? never
13
+ :
14
+ | Output<T, any, any>
15
+ | (T extends Primitive
16
+ ? never
17
+ : T extends any[]
18
+ ? number extends T["length"]
19
+ ? Input<T[number]>[]
20
+ : Inputs<T>
21
+ : T extends object
22
+ ? { [K in keyof T]: Input<T[K]> }
23
+ : never));
24
+
25
+ export type InputProps<
26
+ T extends Record<string, any>,
27
+ Static extends keyof T = never,
28
+ > = {
29
+ [K in keyof T]: K extends Static ? T[K] : Input<T[K]>;
30
+ };
31
+
32
+ export declare namespace Input {
33
+ export type Resolve<T> =
34
+ T extends Output<infer U>
35
+ ? U
36
+ : T extends
37
+ | Primitive
38
+ | Constructor
39
+ | Function
40
+ | S.Schema<any>
41
+ | PolicyLike
42
+ ? T
43
+ : T extends any[]
44
+ ? ResolveArray<T>
45
+ : T extends Record<string, any>
46
+ ? {
47
+ [k in keyof T]: Input.Resolve<T[k]>;
48
+ }
49
+ : never;
50
+
51
+ export type ResolveArray<T extends any[]> = number extends T["length"]
52
+ ? Resolve<T[number]>[]
53
+ : ResolveTuple<T>;
54
+
55
+ export type ResolveTuple<
56
+ T extends any[],
57
+ // TODO(sam): I added the accumulator because it resolved infinite type instantiation
58
+ Accum extends any[] = [],
59
+ > = T extends [infer H, ...infer Tail]
60
+ ? ResolveTuple<Tail, [...Accum, Input.Resolve<H>]>
61
+ : Accum;
62
+
63
+ export type ResolveProps<Props extends Record<string, any>> = {
64
+ [k in keyof Props]: Input.Resolve<Props[k]>;
65
+ };
66
+
67
+ export type ResolveOpaque<T> =
68
+ // use true extends IsOut to avoid distribution in the case where we have an Out<T>
69
+ // because T is a clean type, e.g. Input<SubnetProps> should just be SubnetProps (don't bother resolving the recursive input type variants)
70
+ true extends IsOut<T> ? ResolveOut<T> : Resolve<T>;
71
+ export type IsOut<T> = T extends Output<infer U> ? true : never;
72
+
73
+ export type ResolveOut<T> = T extends Output<infer U> ? U : never;
74
+ }
75
+
76
+ export type Inputs<T extends any[], Out extends any[] = []> = T extends [
77
+ infer H,
78
+ ...infer T,
79
+ ]
80
+ ? Inputs<T, [...Out, Input<H>]>
81
+ : Out;