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,45 +1,68 @@
1
1
  #!/usr/bin/env node
2
- import * as Layer from "effect/Layer";
3
2
  import * as Effect$1 from "effect/Effect";
4
3
  import { Effect } from "effect/Effect";
5
4
  import * as Context from "effect/Context";
6
- import "@effect/platform/FileSystem";
7
- import "@effect/platform/Path";
5
+ import * as Layer from "effect/Layer";
8
6
  import * as S from "effect/Schema";
9
- import * as effect_Types0 from "effect/Types";
10
- import * as effect_Cause0 from "effect/Cause";
11
7
  import { Types } from "effect";
8
+ import "@effect/platform/FileSystem";
9
+ import "@effect/platform/Path";
12
10
 
13
- //#region src/resource.d.ts
14
- interface Resource<Type extends string = string, ID$1 extends string = string, Props = unknown, Attrs = unknown> {
15
- id: ID$1;
16
- type: Type;
17
- props: Props;
18
- attr: Attrs;
19
- parent: unknown;
20
- new (): Resource<Type, ID$1, Props, Attrs>;
11
+ //#region src/diff.d.ts
12
+ type Diff = {
13
+ action: "noop";
14
+ deleteFirst?: undefined;
15
+ stables?: undefined;
16
+ } | {
17
+ action: "update";
18
+ deleteFirst?: undefined;
19
+ /** properties that won't change as part of this update */
20
+ stables?: string[];
21
+ } | {
22
+ action: "replace";
23
+ deleteFirst?: boolean;
24
+ stables?: undefined;
25
+ };
26
+ //#endregion
27
+ //#region src/data.d.ts
28
+ type Primitive = never | undefined | null | boolean | number | string | bigint | symbol;
29
+ //#endregion
30
+ //#region src/output.d.ts
31
+ interface Output<A = any, Src$1 extends Resource = any, Req$1 = any> {
32
+ readonly kind: string;
33
+ readonly src: Src$1;
34
+ readonly req: Req$1;
35
+ apply<B>(fn: (value: A) => B): Output.Of<B, Src$1, Req$1>;
36
+ effect<B, Req2$1>(fn: (value: A) => Effect$1.Effect<B, never, Req2$1>): Output.Of<B, Src$1, Req$1 | Req2$1>;
21
37
  }
22
- interface ResourceTags<R extends Resource> {
23
- of<S$1 extends ProviderService<R>>(service: S$1): S$1;
24
- tag: Context.TagClass<Provider<R>, R["type"], ProviderService<R>>;
25
- effect<Err, Req>(eff: Effect<ProviderService<R>, Err, Req>): Layer.Layer<Provider<R>, Err, Req>;
26
- succeed(service: ProviderService<R>): Layer.Layer<Provider<R>>;
38
+ declare namespace Output {
39
+ type Of<A, Src$1 extends Resource = any, Req$1 = never> = [Extract<A, object>] extends [never] ? Output<A, Src$1, Req$1> : [Extract<A, any[]>] extends [never] ? Object$1<{ [attr in keyof A]: A[attr] }, Src$1, Req$1> : Array<Extract<A, any[]>, Src$1, Req$1>;
27
40
  }
28
- declare const Resource: <Ctor extends (id: string, props: any) => Resource>(type: ReturnType<Ctor>["type"]) => Ctor & {
29
- new (): ReturnType<Ctor> & {
30
- parent: ReturnType<Ctor>;
31
- };
32
- type: ReturnType<Ctor>["type"];
33
- provider: ResourceTags<ReturnType<Ctor>>;
34
- } & {
35
- type: ReturnType<Ctor>["type"];
36
- provider: ResourceTags<ReturnType<Ctor>>;
41
+ type Object$1<A, Src$1 extends Resource, Req$1 = any> = Output<A, Src$1, Req$1> & { [Prop in keyof Exclude<A, undefined>]-?: Output.Of<Exclude<A, undefined>[Prop] | Extract<A, undefined>, Src$1, Req$1> };
42
+ type Array<A extends any[], Src$1 extends Resource, Req$1 = any> = Output<A, Src$1, Req$1> & { [i in Extract<keyof A, number>]: Output.Of<A[i], Src$1, Req$1> };
43
+ //#endregion
44
+ //#region src/input.d.ts
45
+ type Function = (...args: any[]) => any;
46
+ type Constructor = new (...args: any[]) => any;
47
+ type PolicyLike = {
48
+ kind: "alchemy/Policy";
37
49
  };
50
+ type Input<T> = T | (T extends S.Schema<any> ? never : Output<T, any, any> | (T extends Primitive ? never : T extends any[] ? number extends T["length"] ? Input<T[number]>[] : Inputs<T> : T extends object ? { [K in keyof T]: Input<T[K]> } : never));
51
+ declare namespace Input {
52
+ type Resolve<T> = T extends Output<infer U> ? U : T extends Primitive | Constructor | Function | S.Schema<any> | PolicyLike ? T : T extends any[] ? ResolveArray<T> : T extends Record<string, any> ? { [k in keyof T]: Input.Resolve<T[k]> } : never;
53
+ type ResolveArray<T extends any[]> = number extends T["length"] ? Resolve<T[number]>[] : ResolveTuple<T>;
54
+ type ResolveTuple<T extends any[], Accum extends any[] = []> = T extends [infer H, ...infer Tail] ? ResolveTuple<Tail, [...Accum, Input.Resolve<H>]> : Accum;
55
+ type ResolveProps<Props$1 extends Record<string, any>> = { [k in keyof Props$1]: Input.Resolve<Props$1[k]> };
56
+ type ResolveOpaque<T> = true extends IsOut<T> ? ResolveOut<T> : Resolve<T>;
57
+ type IsOut<T> = T extends Output<infer U> ? true : never;
58
+ type ResolveOut<T> = T extends Output<infer U> ? U : never;
59
+ }
60
+ type Inputs<T extends any[], Out extends any[] = []> = T extends [infer H, ...infer T] ? Inputs<T, [...Out, Input<H>]> : Out;
38
61
  //#endregion
39
62
  //#region src/service.d.ts
40
- interface IService<ID$1 extends string = string, F extends Runtime = Runtime, Handler extends RuntimeHandler = RuntimeHandler, Props extends RuntimeProps<F, any> = RuntimeProps<F, any>, Attr = (F & {
41
- props: Props;
42
- })["attr"]> extends Resource<F["type"], ID$1, Props, Attr> {
63
+ interface IService<ID$1 extends string = string, F extends IRuntime = IRuntime, Handler extends RuntimeHandler = RuntimeHandler, Props$1 extends RuntimeProps<F, any> = RuntimeProps<F, any>, Attr = (F & {
64
+ props: Props$1;
65
+ })["attr"], Base = unknown> extends IResource<F["type"], ID$1, Props$1, Attr, F> {
43
66
  kind: "Service";
44
67
  type: F["type"];
45
68
  id: ID$1;
@@ -54,193 +77,130 @@ interface IService<ID$1 extends string = string, F extends Runtime = Runtime, Ha
54
77
  * An Effect that produces a handler stripped of its Infrastructure-time-only Capabilities.
55
78
  */
56
79
  handler: Effect<(...inputs: Parameters<Handler>) => Effect<Effect.Success<ReturnType<Handler>>, Effect.Error<ReturnType<Handler>>, never>, never, Exclude<Effect.Context<ReturnType<Handler>>, Capability>>;
57
- props: Props;
80
+ props: Props$1;
58
81
  /** @internal phantom type of this resource's output attributes */
59
82
  attr: Attr;
60
83
  /** @internal phantom type of this resource's parent */
61
84
  parent: unknown;
85
+ new (): Service<ID$1, F, Handler, Props$1, Attr, Base>;
62
86
  }
63
- interface Service<ID$1 extends string = string, F extends Runtime = Runtime, Handler extends RuntimeHandler = RuntimeHandler, Props extends RuntimeProps<F, any> = RuntimeProps<F, any>, Attr = (F & {
64
- props: Props;
65
- })["attr"]> extends IService<ID$1, F, Handler, Props, Attr>, Resource<F["type"], ID$1, Props, Attr> {}
66
- //#endregion
67
- //#region src/event.d.ts
68
- type ApplyStatus = "pending" | "creating" | "created" | "updating" | "updated" | "deleting" | "deleted" | "success" | "fail";
69
- type ApplyEvent = AnnotateEvent | StatusChangeEvent;
70
- interface AnnotateEvent {
71
- kind: "annotate";
72
- id: string;
73
- message: string;
74
- }
75
- interface StatusChangeEvent {
76
- kind: "status-change";
77
- id: string;
78
- type: string;
79
- status: ApplyStatus;
80
- message?: string;
81
- bindingId?: string;
82
- }
83
- //#endregion
84
- //#region src/apply.d.ts
85
- interface PlanStatusSession {
86
- emit: (event: ApplyEvent) => Effect$1.Effect<void>;
87
- done: () => Effect$1.Effect<void>;
88
- }
89
- interface ScopedPlanStatusSession extends PlanStatusSession {
90
- note: (note: string) => Effect$1.Effect<void>;
91
- }
92
- declare const PlanStatusReporter_base: Context.TagClass<PlanStatusReporter, "PlanStatusReporter", {
93
- start(plan: Plan): Effect$1.Effect<PlanStatusSession, never>;
94
- }>;
95
- declare class PlanStatusReporter extends PlanStatusReporter_base {}
87
+ interface Service<ID$1 extends string = string, F extends IRuntime = IRuntime, Handler extends RuntimeHandler = RuntimeHandler, Props$1 extends RuntimeProps<F, any> = RuntimeProps<F, any>, Attr = (F & {
88
+ props: Props$1;
89
+ })["attr"], Base = unknown> extends IService<ID$1, F, Handler, Props$1, Attr, Base> {}
96
90
  //#endregion
97
91
  //#region src/provider.d.ts
98
- type Provider<R extends Resource> = Context.TagClass<Provider<R>, R["type"], ProviderService<R>>;
99
- type Diff = {
100
- action: "update" | "noop";
101
- deleteFirst?: undefined;
102
- } | {
103
- action: "replace";
104
- deleteFirst?: boolean;
105
- };
92
+ interface Provider<R extends Resource | Service> extends Context.TagClass<Provider<R>, R["type"], ProviderService<any>> {}
106
93
  type BindingData<Res extends Resource> = [Res] extends [Runtime] ? Res["binding"][] : any[];
94
+ type Props<Res extends Resource> = Input.ResolveOpaque<Res["props"]>;
107
95
  interface ProviderService<Res extends Resource = Resource> {
108
96
  read?(input: {
109
97
  id: string;
110
- olds: Res["props"] | undefined;
98
+ olds: Props<Res> | undefined;
111
99
  output: Res["attr"] | undefined;
112
100
  session: ScopedPlanStatusSession;
113
101
  bindings: BindingData<Res>;
114
102
  }): Effect$1.Effect<Res["attr"] | undefined, any, never>;
115
103
  diff?(input: {
116
104
  id: string;
117
- olds: Res["props"];
105
+ olds: Props<Res>;
118
106
  news: Res["props"];
119
107
  output: Res["attr"];
120
108
  }): Effect$1.Effect<Diff | void, never, never>;
121
109
  precreate?(input: {
122
110
  id: string;
123
- news: Res["props"];
111
+ news: Props<Res>;
124
112
  session: ScopedPlanStatusSession;
125
113
  }): Effect$1.Effect<Res["attr"], any, never>;
126
114
  create(input: {
127
115
  id: string;
128
- news: Res["props"];
116
+ news: Props<Res>;
129
117
  session: ScopedPlanStatusSession;
130
118
  bindings: BindingData<Res>;
131
119
  }): Effect$1.Effect<Res["attr"], any, never>;
132
120
  update(input: {
133
121
  id: string;
134
- news: Res["props"];
135
- olds: Res["props"];
122
+ news: Props<Res>;
123
+ olds: Props<Res>;
136
124
  output: Res["attr"];
137
125
  session: ScopedPlanStatusSession;
138
126
  bindings: BindingData<Res>;
139
127
  }): Effect$1.Effect<Res["attr"], any, never>;
140
128
  delete(input: {
141
129
  id: string;
142
- olds: Res["props"];
130
+ olds: Props<Res>;
143
131
  output: Res["attr"];
144
132
  session: ScopedPlanStatusSession;
145
133
  bindings: BindingData<Res>;
146
134
  }): Effect$1.Effect<void, any, never>;
147
135
  }
148
136
  //#endregion
149
- //#region src/binding.d.ts
150
- type AnyBinding<F extends Runtime = any> = Binding<F, any, any, any, string, boolean>;
151
- interface Binding<Run extends Runtime<any, any, any>, Cap extends Capability = Capability, Props = any, Attr extends Run["binding"] = any, Tag extends string = Cap["type"], IsCustom extends boolean = (Cap["type"] extends Tag ? false : true)> {
152
- runtime: Run;
153
- capability: Cap;
154
- tag: Tag;
155
- props: Props;
156
- attr: Attr;
157
- isCustom: IsCustom;
158
- }
159
- /** Tag for a Service that can bind a Capability to a Runtime */
160
- interface Bind<F extends Runtime, Cap extends Capability, Tag extends string> extends Context.Tag<`${F["type"]}(${Cap["type"]}, ${Tag})`, BindingService<F, Extract<Extract<Cap["resource"], Resource>["parent"], Resource>, F["props"]>> {
137
+ //#region src/resource.d.ts
138
+ type AnyResource = Resource<string, string, any, any>;
139
+ interface IResource<Type extends string = string, ID$1 extends string = string, Props$1 = unknown, Attrs = unknown, Base = unknown> {
140
+ id: ID$1;
141
+ type: Type;
142
+ Props: unknown;
143
+ props: Props$1;
144
+ base: Base;
161
145
  /** @internal phantom */
162
- name: Tag;
146
+ attr: Attrs;
163
147
  }
164
- declare const Binding: {
165
- <F extends (resource: any, props?: any) => AnyBinding & {
166
- isCustom: true;
167
- }>(runtime: ReturnType<F>["runtime"], type: ReturnType<F>["capability"]["type"], tag: ReturnType<F>["tag"]): F & BindingDeclaration<ReturnType<F>["runtime"], F>;
168
- <F extends (resource: any, props?: any) => AnyBinding & {
169
- isCustom: false;
170
- }>(runtime: ReturnType<F>["runtime"], type: ReturnType<F>["capability"]["type"]): F & BindingDeclaration<ReturnType<F>["runtime"], F>;
171
- };
172
- interface BindingDeclaration<Run extends Runtime, F extends (target: any, props?: any) => AnyBinding<Run>, Tag extends string = ReturnType<F>["tag"], Cap extends Capability = ReturnType<F>["capability"]> {
173
- provider: {
174
- effect<Err, Req>(eff: Effect<BindingService<Run, Parameters<F>[0], Parameters<F>[1], ReturnType<F>["attr"]>, Err, Req>): Layer.Layer<Bind<Run, Cap, Tag>, Err, Req>;
175
- succeed(service: BindingService<Run, Parameters<F>[0], Parameters<F>[1], ReturnType<F>["attr"]>): Layer.Layer<Bind<Run, Cap, Tag>>;
176
- };
148
+ interface Resource<Type extends string = string, ID$1 extends string = string, Props$1 = unknown, Attrs = unknown, Base = unknown> extends IResource<Type, ID$1, Props$1, Attrs, Base> {
149
+ new (): Resource<Type, ID$1, Props$1, Attrs, Base>;
177
150
  }
178
- interface BindingDiffProps<Source extends Resource = Resource, Target extends Resource = Resource, Props = any, Attr = any> {
179
- source: {
180
- id: string;
181
- props: Source["props"];
182
- oldProps?: Source["props"];
183
- oldAttr?: Source["attr"];
184
- };
185
- props: Props;
186
- attr: Attr | undefined;
187
- target: {
188
- id: string;
189
- props: Target["props"];
190
- oldProps?: Target["props"];
191
- oldAttr?: Target["attr"];
192
- };
151
+ interface ResourceTags<R extends Resource<string, string, any, any>> {
152
+ of<S$1 extends ProviderService<R>>(service: S$1): S$1;
153
+ tag: Provider<R>;
154
+ effect<Err, Req$1>(eff: Effect<ProviderService<R>, Err, Req$1>): Layer.Layer<Provider<R>, Err, Req$1>;
155
+ succeed(service: ProviderService<R>): Layer.Layer<Provider<R>>;
193
156
  }
194
- interface BindingAttachProps<Source extends Resource, Target extends Resource, Props, Attr> {
195
- source: {
196
- id: string;
197
- attr: Source["attr"];
198
- props: Source["props"];
199
- };
200
- props: Props;
201
- attr: Attr | undefined;
202
- target: {
203
- id: string;
204
- props: Target["props"];
205
- attr: Target["attr"];
157
+ declare const Resource: <Ctor extends (id: string, props: any) => Resource>(type: ReturnType<Ctor>["type"]) => Ctor & {
158
+ new (): ReturnType<Ctor> & {
159
+ parent: ReturnType<Ctor>;
206
160
  };
161
+ type: ReturnType<Ctor>["type"];
162
+ parent: ReturnType<Ctor>;
163
+ provider: ResourceTags<ReturnType<Ctor>>;
164
+ } & {
165
+ type: ReturnType<Ctor>["type"];
166
+ provider: ResourceTags<ReturnType<Ctor>>;
167
+ };
168
+ //#endregion
169
+ //#region src/runtime.d.ts
170
+ type RuntimeHandler<Inputs$1 extends any[] = any[], Output$1 = any, Err = any, Req$1 = any> = (...inputs: Inputs$1) => Effect$1.Effect<Output$1, Err, Req$1>;
171
+ declare namespace RuntimeHandler {
172
+ type Caps<H$1 extends RuntimeHandler | unknown> = Extract<Effect$1.Effect.Context<ReturnType<Extract<H$1, RuntimeHandler>>>, Capability>;
207
173
  }
208
- interface BindingReattachProps<Source extends Resource, Target extends Resource, Props, Attr> {
209
- source: {
210
- id: string;
211
- attr: Source["attr"];
212
- props: Source["props"];
213
- };
214
- props: Props;
215
- attr: Attr;
216
- target: {
217
- id: string;
218
- props: Target["props"];
219
- attr: Target["attr"];
174
+ declare namespace Runtime {
175
+ type Binding<F, Cap> = F extends {
176
+ readonly Binding: unknown;
177
+ } ? (F & {
178
+ readonly cap: Cap;
179
+ })["Binding"] : {
180
+ readonly F: F;
181
+ readonly cap: Types.Contravariant<Cap>;
220
182
  };
221
183
  }
222
- interface BindingDetachProps<Source extends Resource, Target extends Resource, Props, Attr> {
223
- source: {
224
- id: string;
225
- attr: Source["attr"];
226
- props: Source["props"];
227
- };
228
- props: Props;
229
- attr: Attr | undefined;
230
- target: {
231
- id: string;
232
- props: Target["props"];
233
- attr: Target["attr"];
234
- };
184
+ interface RuntimeProps<Run extends IRuntime, Req$1> {
185
+ bindings: Policy<Run, Extract<Req$1, Capability>, unknown>;
235
186
  }
236
- type BindingService<Target extends Runtime = any, Source extends Resource = Resource, Props = any, Attr extends Target["binding"] = any, DiffReq = never, PreReattachReq = never, AttachReq = never, ReattachReq = never, DetachReq = never, PostAttachReq = never> = {
237
- diff?: (props: BindingDiffProps<Source, Target, Props>) => Effect<Diff, never, DiffReq>;
238
- preattach?: (props: BindingAttachProps<Source, Target, Props, Attr>) => Effect<Partial<Target["attr"]>, never, PreReattachReq>;
239
- attach: (props: BindingAttachProps<Source, Target, Props, Attr>) => Effect<Attr, never, AttachReq> | Attr;
240
- postattach?: (props: BindingAttachProps<Source, Target, Props, Attr>) => Effect<Omit<Attr, keyof Target["binding"]>, never, PostAttachReq>;
241
- reattach?: (props: BindingReattachProps<Source, Target, Props, Attr>) => Effect<Attr, never, ReattachReq> | Attr;
242
- detach?: (props: BindingDetachProps<Source, Target, Props, Attr>) => Effect<void, never, DetachReq> | void;
243
- };
187
+ interface IRuntime<Type extends string = string, Handler = unknown, Props$1 = unknown> extends IResource<Type, string, Props$1> {
188
+ type: Type;
189
+ props: Props$1;
190
+ handler: Handler;
191
+ binding: unknown;
192
+ /** @internal phantom */
193
+ capability: unknown;
194
+ }
195
+ interface Runtime<Type extends string = string, Handler = unknown, Props$1 = unknown> extends IRuntime<Type, Handler, Props$1>, Resource<Type, string, Props$1> {
196
+ provider: ResourceTags<this>;
197
+ <const ID$1 extends string, Inputs$1 extends any[], Output$1, Err, Req$1, Handler extends RuntimeHandler<Inputs$1, Output$1, Err, Req$1>>(id: ID$1, {
198
+ handle
199
+ }: {
200
+ handle: Handler;
201
+ }): <const Props$1 extends this["props"]>(props: Props$1) => Service<ID$1, this, Handler, Props$1>;
202
+ }
203
+ declare const Runtime: <const Type extends string>(type: Type) => <Self extends Runtime>() => Self;
244
204
  //#endregion
245
205
  //#region src/policy.d.ts
246
206
  /**
@@ -252,7 +212,8 @@ type BindingService<Target extends Runtime = any, Source extends Resource = Reso
252
212
  *
253
213
  * A Policy is invariant over the set of Capabilities to ensure least-privilege.
254
214
  */
255
- interface Policy<F extends Runtime, in out Capabilities, Tags = unknown> {
215
+ interface Policy<F extends IRuntime, in out Capabilities, Tags = unknown> {
216
+ readonly kind: "alchemy/Policy";
256
217
  readonly runtime: F;
257
218
  readonly tags: Tags[];
258
219
  readonly capabilities: Capabilities[];
@@ -300,9 +261,9 @@ declare namespace Capability {
300
261
  resource: c["resource"];
301
262
  constraint: Constraint.Simplify<c["constraint"]>;
302
263
  })["Reduce"] : never;
303
- type KeysWithNever<T> = { [K in keyof T]: T[K] extends never | Policy.AnyOf<never> ? K : never }[keyof T];
264
+ type KeysWithNever<T> = { [K in keyof T]: T[K$1] extends never | Policy.AnyOf<never> ? K$1 : never }[keyof T];
304
265
  type DropIrrelevant<T> = T extends any ? { [k in keyof Omit<T, KeysWithNever<T>>]: Omit<T, KeysWithNever<T>>[k] } : never;
305
- type Get<T, K extends string | number | symbol> = T extends { [k in K]: infer V } ? V : never;
266
+ type Get<T, K$1 extends string | number | symbol> = T extends { [k in K$1]: infer V } ? V : never;
306
267
  type Keys<T> = T extends any ? keyof T : never;
307
268
  type BoxPolicy<T> = [T] extends [{
308
269
  anyOf: (infer U)[];
@@ -312,44 +273,102 @@ declare namespace Capability {
312
273
  }
313
274
  }
314
275
  //#endregion
315
- //#region src/runtime.d.ts
316
- type RuntimeHandler<Inputs extends any[] = any[], Output = any, Err = any, Req = any> = (...inputs: Inputs) => Effect$1.Effect<Output, Err, Req>;
317
- declare namespace RuntimeHandler {
318
- type Caps<H extends RuntimeHandler | unknown> = Extract<Effect$1.Effect.Context<ReturnType<Extract<H, RuntimeHandler>>>, Capability>;
276
+ //#region src/binding.d.ts
277
+ type AnyBinding<F extends IRuntime = any> = Binding<F, any, any, any, string, boolean>;
278
+ interface Binding<Run extends IRuntime<any, any, any>, Cap extends Capability = Capability, Props$1 = any, Attr extends Run["binding"] = any, Tag extends string = Cap["type"], IsCustom extends boolean = (Cap["type"] extends Tag ? false : true)> {
279
+ runtime: Run;
280
+ capability: Cap;
281
+ tag: Tag;
282
+ props: Props$1;
283
+ attr: Attr;
284
+ isCustom: IsCustom;
319
285
  }
320
- declare namespace Runtime {
321
- type Binding<F, Cap> = F extends {
322
- readonly Binding: unknown;
323
- } ? (F & {
324
- readonly cap: Cap;
325
- })["Binding"] : {
326
- readonly F: F;
327
- readonly cap: Types.Contravariant<Cap>;
286
+ /** Tag for a Service that can bind a Capability to a Runtime */
287
+ interface Bind<F extends IRuntime, Cap extends Capability, Tag extends string> extends Context.Tag<`${F["type"]}(${Cap["type"]}, ${Tag})`, BindingService<F, Extract<Extract<Cap["resource"], Resource>["base"], Resource>, F["props"]>> {
288
+ /** @internal phantom */
289
+ name: Tag;
290
+ }
291
+ declare const Binding: {
292
+ <F extends (resource: any, props?: any) => AnyBinding & {
293
+ isCustom: true;
294
+ }>(runtime: ReturnType<F>["runtime"], type: ReturnType<F>["capability"]["type"], tag: ReturnType<F>["tag"]): F & BindingDeclaration<ReturnType<F>["runtime"], F>;
295
+ <F extends (resource: any, props?: any) => AnyBinding & {
296
+ isCustom: false;
297
+ }>(runtime: ReturnType<F>["runtime"], type: ReturnType<F>["capability"]["type"]): F & BindingDeclaration<ReturnType<F>["runtime"], F>;
298
+ };
299
+ interface BindingDeclaration<Run extends IRuntime, F extends (target: any, props?: any) => AnyBinding<Run>, Tag extends string = ReturnType<F>["tag"], Cap extends Capability = ReturnType<F>["capability"]> {
300
+ provider: {
301
+ effect<Err, Req$1>(eff: Effect<BindingService<Run, Parameters<F>[0], Parameters<F>[1], ReturnType<F>["attr"]>, Err, Req$1>): Layer.Layer<Bind<Run, Cap, Tag>, Err, Req$1>;
302
+ succeed(service: BindingService<Run, Parameters<F>[0], Parameters<F>[1], ReturnType<F>["attr"]>): Layer.Layer<Bind<Run, Cap, Tag>>;
328
303
  };
329
304
  }
330
- interface RuntimeProps<Run extends Runtime, Req> {
331
- bindings: Policy<Run, Extract<Req, Capability>, unknown>;
305
+ interface BindingDiffProps<Source extends IResource = IResource, Target extends IResource = IResource, Props$1 = any, Attr = any> {
306
+ source: {
307
+ id: string;
308
+ props: Source["props"];
309
+ oldProps?: Source["props"];
310
+ oldAttr?: Source["attr"];
311
+ };
312
+ props: Props$1;
313
+ attr: Attr | undefined;
314
+ target: {
315
+ id: string;
316
+ props: Target["props"];
317
+ oldProps?: Target["props"];
318
+ oldAttr?: Target["attr"];
319
+ };
332
320
  }
333
- interface Runtime<Type extends string = string, Handler = unknown, Props = unknown> extends Resource<Type, string, Props, unknown> {
334
- type: Type;
335
- props: Props;
336
- handler: Handler;
337
- binding: unknown;
338
- /** @internal phantom */
339
- capability: unknown;
340
- <const ID$1 extends string, Inputs extends any[], Output, Err, Req, Handler extends RuntimeHandler<Inputs, Output, Err, Req>>(id: ID$1, {
341
- handle
342
- }: {
343
- handle: Handler;
344
- }): <const Props extends this["props"]>(props: Props) => Service<ID$1, this, Handler, Props>;
321
+ interface BindingAttachProps<Source extends IResource, Target extends IResource, Props$1, Attr> {
322
+ source: {
323
+ id: string;
324
+ attr: Source["attr"];
325
+ props: Source["props"];
326
+ };
327
+ props: Props$1;
328
+ attr: Attr | undefined;
329
+ target: {
330
+ id: string;
331
+ props: Target["props"];
332
+ attr: Target["attr"];
333
+ };
334
+ }
335
+ interface BindingReattachProps<Source extends IResource, Target extends IResource, Props$1, Attr> {
336
+ source: {
337
+ id: string;
338
+ attr: Source["attr"];
339
+ props: Source["props"];
340
+ };
341
+ props: Props$1;
342
+ attr: Attr;
343
+ target: {
344
+ id: string;
345
+ props: Target["props"];
346
+ attr: Target["attr"];
347
+ };
348
+ }
349
+ interface BindingDetachProps<Source extends IResource, Target extends IResource, Props$1, Attr> {
350
+ source: {
351
+ id: string;
352
+ attr: Source["attr"];
353
+ props: Source["props"];
354
+ };
355
+ props: Props$1;
356
+ attr: Attr | undefined;
357
+ target: {
358
+ id: string;
359
+ props: Target["props"];
360
+ attr: Target["attr"];
361
+ };
345
362
  }
346
- declare const Runtime: <const Type extends string>(type: Type) => <Self extends Runtime>() => Self & {
347
- provider: ResourceTags<Self>;
363
+ type BindingService<Target extends IRuntime = any, Source extends IResource = IResource, Props$1 = any, Attr extends Target["binding"] = any, DiffReq = never, PreReattachReq = never, AttachReq = never, ReattachReq = never, DetachReq = never, PostAttachReq = never> = {
364
+ diff?: (props: BindingDiffProps<Source, Target, Props$1>) => Effect<Diff, never, DiffReq>;
365
+ preattach?: (props: BindingAttachProps<Source, Target, Props$1, Attr>) => Effect<Partial<Target["attr"]>, never, PreReattachReq>;
366
+ attach: (props: BindingAttachProps<Source, Target, Props$1, Attr>) => Effect<Attr, never, AttachReq> | Attr;
367
+ postattach?: (props: BindingAttachProps<Source, Target, Props$1, Attr>) => Effect<Omit<Attr, keyof Target["binding"]>, never, PostAttachReq>;
368
+ reattach?: (props: BindingReattachProps<Source, Target, Props$1, Attr>) => Effect<Attr, never, ReattachReq> | Attr;
369
+ detach?: (props: BindingDetachProps<Source, Target, Props$1, Attr>) => Effect<void, never, DetachReq> | void;
348
370
  };
349
371
  //#endregion
350
- //#region src/phase.d.ts
351
- type Phase = "update" | "destroy";
352
- //#endregion
353
372
  //#region src/plan.d.ts
354
373
  /**
355
374
  * A node in the plan that represents a binding operation acting on a resource.
@@ -380,70 +399,92 @@ type NoopBind<B extends AnyBinding = AnyBinding> = {
380
399
  /**
381
400
  * A node in the plan that represents a resource CRUD operation.
382
401
  */
383
- type CRUD<R extends Resource = Resource> = Create<R> | Update<R> | Delete<R> | Replace<R> | NoopUpdate<R>;
384
- type Create<R extends Resource> = {
402
+ type CRUD<R extends Resource = AnyResource> = Create<R> | Update<R> | Delete<R> | Replace<R> | NoopUpdate<R>;
403
+ type Create<R extends Resource = AnyResource> = {
385
404
  action: "create";
386
405
  resource: R;
387
406
  news: any;
388
- provider: ProviderService;
407
+ provider: ProviderService<R>;
389
408
  attributes: R["attr"];
390
409
  bindings: BindNode[];
391
410
  };
392
- type Update<R extends Resource> = {
411
+ type Update<R extends Resource = AnyResource> = {
393
412
  action: "update";
394
413
  resource: R;
395
414
  olds: any;
396
415
  news: any;
397
416
  output: any;
398
- provider: ProviderService;
417
+ provider: ProviderService<R>;
399
418
  attributes: R["attr"];
400
419
  bindings: BindNode[];
401
420
  };
402
- type Delete<R extends Resource> = {
421
+ type Delete<R extends Resource = AnyResource> = {
403
422
  action: "delete";
404
423
  resource: R;
405
424
  olds: any;
406
425
  output: any;
407
- provider: ProviderService;
426
+ provider: ProviderService<R>;
408
427
  bindings: BindNode[];
409
428
  attributes: R["attr"];
410
429
  downstream: string[];
411
430
  };
412
- type NoopUpdate<R extends Resource> = {
431
+ type NoopUpdate<R extends Resource = AnyResource> = {
413
432
  action: "noop";
414
433
  resource: R;
415
434
  attributes: R["attr"];
416
435
  bindings: BindNode[];
417
436
  };
418
- type Replace<R extends Resource> = {
437
+ type Replace<R extends Resource = AnyResource> = {
419
438
  action: "replace";
420
439
  resource: R;
421
440
  olds: any;
422
441
  news: any;
423
442
  output: any;
424
- provider: ProviderService;
443
+ provider: ProviderService<R>;
425
444
  bindings: BindNode[];
426
445
  attributes: R["attr"];
427
446
  deleteFirst?: boolean;
428
447
  };
429
- type Plan = {
430
- phase: Phase;
431
- resources: { [id in string]: CRUD };
448
+ type IPlan = {
449
+ resources: { [id in string]: CRUD<any> };
432
450
  deletions: { [id in string]?: Delete<Resource> };
433
451
  };
434
452
  //#endregion
435
- //#region src/approve.d.ts
436
- declare const PlanRejected_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
437
- readonly _tag: "PlanRejected";
438
- } & Readonly<A>;
439
- declare class PlanRejected extends PlanRejected_base<{}> {}
440
- declare const PlanReviewer_base: Context.TagClass<PlanReviewer, "PlanReviewer", {
441
- approve: <P$1 extends Plan>(plan: P$1) => Effect$1.Effect<void, PlanRejected>;
442
- }>;
443
- declare class PlanReviewer extends PlanReviewer_base {}
453
+ //#region src/event.d.ts
454
+ type ApplyStatus = "pending" | "creating" | "created" | "updating" | "updated" | "deleting" | "deleted" | "success" | "fail";
455
+ type ApplyEvent = AnnotateEvent | StatusChangeEvent;
456
+ interface AnnotateEvent {
457
+ kind: "annotate";
458
+ id: string;
459
+ message: string;
460
+ }
461
+ interface StatusChangeEvent {
462
+ kind: "status-change";
463
+ id: string;
464
+ type: string;
465
+ status: ApplyStatus;
466
+ message?: string;
467
+ bindingId?: string;
468
+ }
469
+ //#endregion
470
+ //#region src/cli/service.d.ts
471
+ interface PlanStatusSession {
472
+ emit: (event: ApplyEvent) => Effect$1.Effect<void>;
473
+ done: () => Effect$1.Effect<void>;
474
+ }
475
+ interface ScopedPlanStatusSession extends PlanStatusSession {
476
+ note: (note: string) => Effect$1.Effect<void>;
477
+ }
478
+ interface CLIService {
479
+ approvePlan: <P$1 extends IPlan>(plan: P$1) => Effect$1.Effect<boolean>;
480
+ displayPlan: <P$1 extends IPlan>(plan: P$1) => Effect$1.Effect<void>;
481
+ startApplySession: <P$1 extends IPlan>(plan: P$1) => Effect$1.Effect<PlanStatusSession>;
482
+ }
483
+ declare const CLI_base: Context.TagClass<CLI, "CLIService", CLIService>;
484
+ declare class CLI extends CLI_base {}
444
485
  //#endregion
445
- //#region src/cli/index.d.ts
446
- declare const layer: Layer.Layer<PlanReviewer | PlanStatusReporter, never, never>;
486
+ //#region src/cli/ink-service.d.ts
487
+ declare const inkCLI: () => Layer.Layer<CLI, never, never>;
447
488
  //#endregion
448
- export { layer };
489
+ export { CLI, CLIService, PlanStatusSession, ScopedPlanStatusSession, inkCLI };
449
490
  //# sourceMappingURL=index.d.ts.map