@alchemy.run/modal 0.0.0 → 2.0.0-beta.87

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 (499) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +96 -4
  3. package/lib/App.d.ts +143 -0
  4. package/lib/App.d.ts.map +1 -0
  5. package/lib/App.js +198 -0
  6. package/lib/App.js.map +1 -0
  7. package/lib/AuthProvider.d.ts +53 -0
  8. package/lib/AuthProvider.d.ts.map +1 -0
  9. package/lib/AuthProvider.js +209 -0
  10. package/lib/AuthProvider.js.map +1 -0
  11. package/lib/BindingHttp.d.ts +56 -0
  12. package/lib/BindingHttp.d.ts.map +1 -0
  13. package/lib/BindingHttp.js +50 -0
  14. package/lib/BindingHttp.js.map +1 -0
  15. package/lib/Blob.d.ts +34 -0
  16. package/lib/Blob.d.ts.map +1 -0
  17. package/lib/Blob.js +59 -0
  18. package/lib/Blob.js.map +1 -0
  19. package/lib/Bootstrap.d.ts +8 -0
  20. package/lib/Bootstrap.d.ts.map +1 -0
  21. package/lib/Bootstrap.js +26 -0
  22. package/lib/Bootstrap.js.map +1 -0
  23. package/lib/Cbor.d.ts +10 -0
  24. package/lib/Cbor.d.ts.map +1 -0
  25. package/lib/Cbor.js +177 -0
  26. package/lib/Cbor.js.map +1 -0
  27. package/lib/ConnectSandbox.d.ts +64 -0
  28. package/lib/ConnectSandbox.d.ts.map +1 -0
  29. package/lib/ConnectSandbox.js +33 -0
  30. package/lib/ConnectSandbox.js.map +1 -0
  31. package/lib/Container.d.ts +124 -0
  32. package/lib/Container.d.ts.map +1 -0
  33. package/lib/Container.js +1 -0
  34. package/lib/Container.js.map +1 -0
  35. package/lib/Contributions.d.ts +7 -0
  36. package/lib/Contributions.d.ts.map +1 -0
  37. package/lib/Contributions.js +6 -0
  38. package/lib/Contributions.js.map +1 -0
  39. package/lib/CreateDict.d.ts +83 -0
  40. package/lib/CreateDict.d.ts.map +1 -0
  41. package/lib/CreateDict.js +3 -0
  42. package/lib/CreateDict.js.map +1 -0
  43. package/lib/CreateDictHttp.d.ts +33 -0
  44. package/lib/CreateDictHttp.d.ts.map +1 -0
  45. package/lib/CreateDictHttp.js +67 -0
  46. package/lib/CreateDictHttp.js.map +1 -0
  47. package/lib/CreateImage.d.ts +98 -0
  48. package/lib/CreateImage.d.ts.map +1 -0
  49. package/lib/CreateImage.js +3 -0
  50. package/lib/CreateImage.js.map +1 -0
  51. package/lib/CreateImageHttp.d.ts +51 -0
  52. package/lib/CreateImageHttp.d.ts.map +1 -0
  53. package/lib/CreateImageHttp.js +87 -0
  54. package/lib/CreateImageHttp.js.map +1 -0
  55. package/lib/CreateQueue.d.ts +83 -0
  56. package/lib/CreateQueue.d.ts.map +1 -0
  57. package/lib/CreateQueue.js +3 -0
  58. package/lib/CreateQueue.js.map +1 -0
  59. package/lib/CreateQueueHttp.d.ts +31 -0
  60. package/lib/CreateQueueHttp.d.ts.map +1 -0
  61. package/lib/CreateQueueHttp.js +67 -0
  62. package/lib/CreateQueueHttp.js.map +1 -0
  63. package/lib/CreateSandbox.d.ts +186 -0
  64. package/lib/CreateSandbox.d.ts.map +1 -0
  65. package/lib/CreateSandbox.js +3 -0
  66. package/lib/CreateSandbox.js.map +1 -0
  67. package/lib/CreateSandboxHttp.d.ts +17 -0
  68. package/lib/CreateSandboxHttp.d.ts.map +1 -0
  69. package/lib/CreateSandboxHttp.js +117 -0
  70. package/lib/CreateSandboxHttp.js.map +1 -0
  71. package/lib/CreateSecret.d.ts +95 -0
  72. package/lib/CreateSecret.d.ts.map +1 -0
  73. package/lib/CreateSecret.js +3 -0
  74. package/lib/CreateSecret.js.map +1 -0
  75. package/lib/CreateSecretHttp.d.ts +24 -0
  76. package/lib/CreateSecretHttp.d.ts.map +1 -0
  77. package/lib/CreateSecretHttp.js +60 -0
  78. package/lib/CreateSecretHttp.js.map +1 -0
  79. package/lib/CreateVolume.d.ts +84 -0
  80. package/lib/CreateVolume.d.ts.map +1 -0
  81. package/lib/CreateVolume.js +3 -0
  82. package/lib/CreateVolume.js.map +1 -0
  83. package/lib/CreateVolumeHttp.d.ts +32 -0
  84. package/lib/CreateVolumeHttp.d.ts.map +1 -0
  85. package/lib/CreateVolumeHttp.js +69 -0
  86. package/lib/CreateVolumeHttp.js.map +1 -0
  87. package/lib/Credentials.d.ts +32 -0
  88. package/lib/Credentials.d.ts.map +1 -0
  89. package/lib/Credentials.js +44 -0
  90. package/lib/Credentials.js.map +1 -0
  91. package/lib/Dict.d.ts +147 -0
  92. package/lib/Dict.d.ts.map +1 -0
  93. package/lib/Dict.js +175 -0
  94. package/lib/Dict.js.map +1 -0
  95. package/lib/DictClient.d.ts +55 -0
  96. package/lib/DictClient.d.ts.map +1 -0
  97. package/lib/DictClient.js +89 -0
  98. package/lib/DictClient.js.map +1 -0
  99. package/lib/Domain.d.ts +86 -0
  100. package/lib/Domain.d.ts.map +1 -0
  101. package/lib/Domain.js +113 -0
  102. package/lib/Domain.js.map +1 -0
  103. package/lib/Endpoint.d.ts +181 -0
  104. package/lib/Endpoint.d.ts.map +1 -0
  105. package/lib/Endpoint.js +283 -0
  106. package/lib/Endpoint.js.map +1 -0
  107. package/lib/Environment.d.ts +174 -0
  108. package/lib/Environment.d.ts.map +1 -0
  109. package/lib/Environment.js +244 -0
  110. package/lib/Environment.js.map +1 -0
  111. package/lib/FetchServer.d.ts +105 -0
  112. package/lib/FetchServer.d.ts.map +1 -0
  113. package/lib/FetchServer.js +3 -0
  114. package/lib/FetchServer.js.map +1 -0
  115. package/lib/FetchServerHttp.d.ts +21 -0
  116. package/lib/FetchServerHttp.d.ts.map +1 -0
  117. package/lib/FetchServerHttp.js +84 -0
  118. package/lib/FetchServerHttp.js.map +1 -0
  119. package/lib/Function.d.ts +236 -0
  120. package/lib/Function.d.ts.map +1 -0
  121. package/lib/Function.js +273 -0
  122. package/lib/Function.js.map +1 -0
  123. package/lib/FunctionAutoscaler.d.ts +99 -0
  124. package/lib/FunctionAutoscaler.d.ts.map +1 -0
  125. package/lib/FunctionAutoscaler.js +136 -0
  126. package/lib/FunctionAutoscaler.js.map +1 -0
  127. package/lib/FunctionTarget.d.ts +61 -0
  128. package/lib/FunctionTarget.d.ts.map +1 -0
  129. package/lib/FunctionTarget.js +136 -0
  130. package/lib/FunctionTarget.js.map +1 -0
  131. package/lib/Image.d.ts +159 -0
  132. package/lib/Image.d.ts.map +1 -0
  133. package/lib/Image.js +203 -0
  134. package/lib/Image.js.map +1 -0
  135. package/lib/ImageBuild.d.ts +108 -0
  136. package/lib/ImageBuild.d.ts.map +1 -0
  137. package/lib/ImageBuild.js +157 -0
  138. package/lib/ImageBuild.js.map +1 -0
  139. package/lib/ImagePlan.d.ts +31 -0
  140. package/lib/ImagePlan.d.ts.map +1 -0
  141. package/lib/ImagePlan.js +70 -0
  142. package/lib/ImagePlan.js.map +1 -0
  143. package/lib/InferEnv.d.ts +26 -0
  144. package/lib/InferEnv.d.ts.map +1 -0
  145. package/lib/InferEnv.js +1 -0
  146. package/lib/InferEnv.js.map +1 -0
  147. package/lib/InvokeFunction.d.ts +186 -0
  148. package/lib/InvokeFunction.d.ts.map +1 -0
  149. package/lib/InvokeFunction.js +10 -0
  150. package/lib/InvokeFunction.js.map +1 -0
  151. package/lib/InvokeFunctionHttp.d.ts +39 -0
  152. package/lib/InvokeFunctionHttp.d.ts.map +1 -0
  153. package/lib/InvokeFunctionHttp.js +210 -0
  154. package/lib/InvokeFunctionHttp.js.map +1 -0
  155. package/lib/ModalBindings.d.ts +138 -0
  156. package/lib/ModalBindings.d.ts.map +1 -0
  157. package/lib/ModalBindings.js +223 -0
  158. package/lib/ModalBindings.js.map +1 -0
  159. package/lib/MountBucket.d.ts +80 -0
  160. package/lib/MountBucket.d.ts.map +1 -0
  161. package/lib/MountBucket.js +44 -0
  162. package/lib/MountBucket.js.map +1 -0
  163. package/lib/MountVolume.d.ts +77 -0
  164. package/lib/MountVolume.d.ts.map +1 -0
  165. package/lib/MountVolume.js +41 -0
  166. package/lib/MountVolume.js.map +1 -0
  167. package/lib/Mounts.d.ts +134 -0
  168. package/lib/Mounts.d.ts.map +1 -0
  169. package/lib/Mounts.js +87 -0
  170. package/lib/Mounts.js.map +1 -0
  171. package/lib/PersistentSandbox.d.ts +75 -0
  172. package/lib/PersistentSandbox.d.ts.map +1 -0
  173. package/lib/PersistentSandbox.js +93 -0
  174. package/lib/PersistentSandbox.js.map +1 -0
  175. package/lib/Providers.d.ts +23 -0
  176. package/lib/Providers.d.ts.map +1 -0
  177. package/lib/Providers.js +64 -0
  178. package/lib/Providers.js.map +1 -0
  179. package/lib/Proxy.d.ts +94 -0
  180. package/lib/Proxy.d.ts.map +1 -0
  181. package/lib/Proxy.js +132 -0
  182. package/lib/Proxy.js.map +1 -0
  183. package/lib/Queue.d.ts +147 -0
  184. package/lib/Queue.d.ts.map +1 -0
  185. package/lib/Queue.js +177 -0
  186. package/lib/Queue.js.map +1 -0
  187. package/lib/QueueClient.d.ts +64 -0
  188. package/lib/QueueClient.d.ts.map +1 -0
  189. package/lib/QueueClient.js +73 -0
  190. package/lib/QueueClient.js.map +1 -0
  191. package/lib/ReadApp.d.ts +85 -0
  192. package/lib/ReadApp.d.ts.map +1 -0
  193. package/lib/ReadApp.js +3 -0
  194. package/lib/ReadApp.js.map +1 -0
  195. package/lib/ReadAppHttp.d.ts +26 -0
  196. package/lib/ReadAppHttp.d.ts.map +1 -0
  197. package/lib/ReadAppHttp.js +106 -0
  198. package/lib/ReadAppHttp.js.map +1 -0
  199. package/lib/ReadDict.d.ts +39 -0
  200. package/lib/ReadDict.d.ts.map +1 -0
  201. package/lib/ReadDict.js +3 -0
  202. package/lib/ReadDict.js.map +1 -0
  203. package/lib/ReadDictHttp.d.ts +12 -0
  204. package/lib/ReadDictHttp.d.ts.map +1 -0
  205. package/lib/ReadDictHttp.js +23 -0
  206. package/lib/ReadDictHttp.js.map +1 -0
  207. package/lib/ReadFunction.d.ts +73 -0
  208. package/lib/ReadFunction.d.ts.map +1 -0
  209. package/lib/ReadFunction.js +3 -0
  210. package/lib/ReadFunction.js.map +1 -0
  211. package/lib/ReadFunctionHttp.d.ts +25 -0
  212. package/lib/ReadFunctionHttp.d.ts.map +1 -0
  213. package/lib/ReadFunctionHttp.js +63 -0
  214. package/lib/ReadFunctionHttp.js.map +1 -0
  215. package/lib/ReadQueue.d.ts +39 -0
  216. package/lib/ReadQueue.d.ts.map +1 -0
  217. package/lib/ReadQueue.js +3 -0
  218. package/lib/ReadQueue.js.map +1 -0
  219. package/lib/ReadQueueHttp.d.ts +12 -0
  220. package/lib/ReadQueueHttp.d.ts.map +1 -0
  221. package/lib/ReadQueueHttp.js +23 -0
  222. package/lib/ReadQueueHttp.js.map +1 -0
  223. package/lib/ReadServer.d.ts +72 -0
  224. package/lib/ReadServer.d.ts.map +1 -0
  225. package/lib/ReadServer.js +3 -0
  226. package/lib/ReadServer.js.map +1 -0
  227. package/lib/ReadServerHttp.d.ts +25 -0
  228. package/lib/ReadServerHttp.d.ts.map +1 -0
  229. package/lib/ReadServerHttp.js +70 -0
  230. package/lib/ReadServerHttp.js.map +1 -0
  231. package/lib/ReadVolume.d.ts +40 -0
  232. package/lib/ReadVolume.d.ts.map +1 -0
  233. package/lib/ReadVolume.js +3 -0
  234. package/lib/ReadVolume.js.map +1 -0
  235. package/lib/ReadVolumeHttp.d.ts +12 -0
  236. package/lib/ReadVolumeHttp.d.ts.map +1 -0
  237. package/lib/ReadVolumeHttp.js +24 -0
  238. package/lib/ReadVolumeHttp.js.map +1 -0
  239. package/lib/ReadWriteDict.d.ts +39 -0
  240. package/lib/ReadWriteDict.d.ts.map +1 -0
  241. package/lib/ReadWriteDict.js +3 -0
  242. package/lib/ReadWriteDict.js.map +1 -0
  243. package/lib/ReadWriteDictHttp.d.ts +12 -0
  244. package/lib/ReadWriteDictHttp.d.ts.map +1 -0
  245. package/lib/ReadWriteDictHttp.js +23 -0
  246. package/lib/ReadWriteDictHttp.js.map +1 -0
  247. package/lib/ReadWriteQueue.d.ts +40 -0
  248. package/lib/ReadWriteQueue.d.ts.map +1 -0
  249. package/lib/ReadWriteQueue.js +3 -0
  250. package/lib/ReadWriteQueue.js.map +1 -0
  251. package/lib/ReadWriteQueueHttp.d.ts +12 -0
  252. package/lib/ReadWriteQueueHttp.d.ts.map +1 -0
  253. package/lib/ReadWriteQueueHttp.js +23 -0
  254. package/lib/ReadWriteQueueHttp.js.map +1 -0
  255. package/lib/ReadWriteVolume.d.ts +40 -0
  256. package/lib/ReadWriteVolume.d.ts.map +1 -0
  257. package/lib/ReadWriteVolume.js +3 -0
  258. package/lib/ReadWriteVolume.js.map +1 -0
  259. package/lib/ReadWriteVolumeHttp.d.ts +12 -0
  260. package/lib/ReadWriteVolumeHttp.d.ts.map +1 -0
  261. package/lib/ReadWriteVolumeHttp.js +24 -0
  262. package/lib/ReadWriteVolumeHttp.js.map +1 -0
  263. package/lib/RuntimeOwner.d.ts +39 -0
  264. package/lib/RuntimeOwner.d.ts.map +1 -0
  265. package/lib/RuntimeOwner.js +85 -0
  266. package/lib/RuntimeOwner.js.map +1 -0
  267. package/lib/Sandbox.d.ts +215 -0
  268. package/lib/Sandbox.d.ts.map +1 -0
  269. package/lib/Sandbox.js +278 -0
  270. package/lib/Sandbox.js.map +1 -0
  271. package/lib/SandboxClient.d.ts +748 -0
  272. package/lib/SandboxClient.d.ts.map +1 -0
  273. package/lib/SandboxClient.js +710 -0
  274. package/lib/SandboxClient.js.map +1 -0
  275. package/lib/ScaleFunction.d.ts +54 -0
  276. package/lib/ScaleFunction.d.ts.map +1 -0
  277. package/lib/ScaleFunction.js +3 -0
  278. package/lib/ScaleFunction.js.map +1 -0
  279. package/lib/ScaleFunctionHttp.d.ts +21 -0
  280. package/lib/ScaleFunctionHttp.d.ts.map +1 -0
  281. package/lib/ScaleFunctionHttp.js +39 -0
  282. package/lib/ScaleFunctionHttp.js.map +1 -0
  283. package/lib/Secret.d.ts +170 -0
  284. package/lib/Secret.d.ts.map +1 -0
  285. package/lib/Secret.js +196 -0
  286. package/lib/Secret.js.map +1 -0
  287. package/lib/Server.d.ts +155 -0
  288. package/lib/Server.d.ts.map +1 -0
  289. package/lib/Server.js +184 -0
  290. package/lib/Server.js.map +1 -0
  291. package/lib/ServiceUser.d.ts +139 -0
  292. package/lib/ServiceUser.d.ts.map +1 -0
  293. package/lib/ServiceUser.js +210 -0
  294. package/lib/ServiceUser.js.map +1 -0
  295. package/lib/Volume.d.ts +170 -0
  296. package/lib/Volume.d.ts.map +1 -0
  297. package/lib/Volume.js +220 -0
  298. package/lib/Volume.js.map +1 -0
  299. package/lib/VolumeClient.d.ts +53 -0
  300. package/lib/VolumeClient.d.ts.map +1 -0
  301. package/lib/VolumeClient.js +22 -0
  302. package/lib/VolumeClient.js.map +1 -0
  303. package/lib/VolumeFiles.d.ts +94 -0
  304. package/lib/VolumeFiles.d.ts.map +1 -0
  305. package/lib/VolumeFiles.js +139 -0
  306. package/lib/VolumeFiles.js.map +1 -0
  307. package/lib/WebhookToken.d.ts +102 -0
  308. package/lib/WebhookToken.d.ts.map +1 -0
  309. package/lib/WebhookToken.js +176 -0
  310. package/lib/WebhookToken.js.map +1 -0
  311. package/lib/WorkspaceSettings.d.ts +70 -0
  312. package/lib/WorkspaceSettings.d.ts.map +1 -0
  313. package/lib/WorkspaceSettings.js +105 -0
  314. package/lib/WorkspaceSettings.js.map +1 -0
  315. package/lib/WriteApp.d.ts +38 -0
  316. package/lib/WriteApp.d.ts.map +1 -0
  317. package/lib/WriteApp.js +3 -0
  318. package/lib/WriteApp.js.map +1 -0
  319. package/lib/WriteAppHttp.d.ts +23 -0
  320. package/lib/WriteAppHttp.d.ts.map +1 -0
  321. package/lib/WriteAppHttp.js +36 -0
  322. package/lib/WriteAppHttp.js.map +1 -0
  323. package/lib/WriteDict.d.ts +39 -0
  324. package/lib/WriteDict.d.ts.map +1 -0
  325. package/lib/WriteDict.js +3 -0
  326. package/lib/WriteDict.js.map +1 -0
  327. package/lib/WriteDictHttp.d.ts +12 -0
  328. package/lib/WriteDictHttp.d.ts.map +1 -0
  329. package/lib/WriteDictHttp.js +23 -0
  330. package/lib/WriteDictHttp.js.map +1 -0
  331. package/lib/WriteQueue.d.ts +39 -0
  332. package/lib/WriteQueue.d.ts.map +1 -0
  333. package/lib/WriteQueue.js +3 -0
  334. package/lib/WriteQueue.js.map +1 -0
  335. package/lib/WriteQueueHttp.d.ts +12 -0
  336. package/lib/WriteQueueHttp.d.ts.map +1 -0
  337. package/lib/WriteQueueHttp.js +23 -0
  338. package/lib/WriteQueueHttp.js.map +1 -0
  339. package/lib/WriteSecret.d.ts +53 -0
  340. package/lib/WriteSecret.d.ts.map +1 -0
  341. package/lib/WriteSecret.js +3 -0
  342. package/lib/WriteSecret.js.map +1 -0
  343. package/lib/WriteSecretHttp.d.ts +23 -0
  344. package/lib/WriteSecretHttp.d.ts.map +1 -0
  345. package/lib/WriteSecretHttp.js +44 -0
  346. package/lib/WriteSecretHttp.js.map +1 -0
  347. package/lib/WriteVolume.d.ts +39 -0
  348. package/lib/WriteVolume.d.ts.map +1 -0
  349. package/lib/WriteVolume.js +3 -0
  350. package/lib/WriteVolume.js.map +1 -0
  351. package/lib/WriteVolumeHttp.d.ts +12 -0
  352. package/lib/WriteVolumeHttp.d.ts.map +1 -0
  353. package/lib/WriteVolumeHttp.js +24 -0
  354. package/lib/WriteVolumeHttp.js.map +1 -0
  355. package/lib/index.d.ts +80 -0
  356. package/lib/index.d.ts.map +1 -0
  357. package/lib/index.js +78 -0
  358. package/lib/index.js.map +1 -0
  359. package/lib/internal/Declared.d.ts +29 -0
  360. package/lib/internal/Declared.d.ts.map +1 -0
  361. package/lib/internal/Declared.js +31 -0
  362. package/lib/internal/Declared.js.map +1 -0
  363. package/lib/internal/Deploy.d.ts +110 -0
  364. package/lib/internal/Deploy.d.ts.map +1 -0
  365. package/lib/internal/Deploy.js +230 -0
  366. package/lib/internal/Deploy.js.map +1 -0
  367. package/lib/internal/Entrypoint.d.ts +52 -0
  368. package/lib/internal/Entrypoint.d.ts.map +1 -0
  369. package/lib/internal/Entrypoint.js +193 -0
  370. package/lib/internal/Entrypoint.js.map +1 -0
  371. package/lib/internal/Rpc.d.ts +17 -0
  372. package/lib/internal/Rpc.d.ts.map +1 -0
  373. package/lib/internal/Rpc.js +49 -0
  374. package/lib/internal/Rpc.js.map +1 -0
  375. package/lib/internal/RpcAuth.d.ts +41 -0
  376. package/lib/internal/RpcAuth.d.ts.map +1 -0
  377. package/lib/internal/RpcAuth.js +100 -0
  378. package/lib/internal/RpcAuth.js.map +1 -0
  379. package/lib/internal/Runtime.d.ts +127 -0
  380. package/lib/internal/Runtime.d.ts.map +1 -0
  381. package/lib/internal/Runtime.js +246 -0
  382. package/lib/internal/Runtime.js.map +1 -0
  383. package/lib/internal/Tags.d.ts +19 -0
  384. package/lib/internal/Tags.d.ts.map +1 -0
  385. package/lib/internal/Tags.js +33 -0
  386. package/lib/internal/Tags.js.map +1 -0
  387. package/lib/internal/TcpConnect.d.ts +12 -0
  388. package/lib/internal/TcpConnect.d.ts.map +1 -0
  389. package/lib/internal/TcpConnect.js +46 -0
  390. package/lib/internal/TcpConnect.js.map +1 -0
  391. package/lib/internal/Transport.d.ts +13 -0
  392. package/lib/internal/Transport.d.ts.map +1 -0
  393. package/lib/internal/Transport.js +16 -0
  394. package/lib/internal/Transport.js.map +1 -0
  395. package/lib/internal.d.ts +71 -0
  396. package/lib/internal.d.ts.map +1 -0
  397. package/lib/internal.js +102 -0
  398. package/lib/internal.js.map +1 -0
  399. package/package.json +59 -3
  400. package/src/App.ts +262 -0
  401. package/src/AuthProvider.ts +295 -0
  402. package/src/BindingHttp.ts +112 -0
  403. package/src/Blob.ts +71 -0
  404. package/src/Bootstrap.ts +52 -0
  405. package/src/Cbor.ts +158 -0
  406. package/src/ConnectSandbox.ts +99 -0
  407. package/src/Container.ts +121 -0
  408. package/src/Contributions.ts +9 -0
  409. package/src/CreateDict.ts +95 -0
  410. package/src/CreateDictHttp.ts +91 -0
  411. package/src/CreateImage.ts +105 -0
  412. package/src/CreateImageHttp.ts +117 -0
  413. package/src/CreateQueue.ts +95 -0
  414. package/src/CreateQueueHttp.ts +91 -0
  415. package/src/CreateSandbox.ts +228 -0
  416. package/src/CreateSandboxHttp.ts +160 -0
  417. package/src/CreateSecret.ts +109 -0
  418. package/src/CreateSecretHttp.ts +83 -0
  419. package/src/CreateVolume.ts +96 -0
  420. package/src/CreateVolumeHttp.ts +93 -0
  421. package/src/Credentials.ts +74 -0
  422. package/src/Dict.ts +245 -0
  423. package/src/DictClient.ts +166 -0
  424. package/src/Domain.ts +147 -0
  425. package/src/Endpoint.ts +406 -0
  426. package/src/Environment.ts +373 -0
  427. package/src/FetchServer.ts +126 -0
  428. package/src/FetchServerHttp.ts +110 -0
  429. package/src/Function.ts +397 -0
  430. package/src/FunctionAutoscaler.ts +210 -0
  431. package/src/FunctionTarget.ts +181 -0
  432. package/src/Image.ts +281 -0
  433. package/src/ImageBuild.ts +228 -0
  434. package/src/ImagePlan.ts +78 -0
  435. package/src/InferEnv.ts +27 -0
  436. package/src/InvokeFunction.ts +211 -0
  437. package/src/InvokeFunctionHttp.ts +316 -0
  438. package/src/ModalBindings.ts +310 -0
  439. package/src/MountBucket.ts +137 -0
  440. package/src/MountVolume.ts +113 -0
  441. package/src/Mounts.ts +230 -0
  442. package/src/PersistentSandbox.ts +142 -0
  443. package/src/Providers.ts +100 -0
  444. package/src/Proxy.ts +191 -0
  445. package/src/Queue.ts +258 -0
  446. package/src/QueueClient.ts +149 -0
  447. package/src/ReadApp.ts +101 -0
  448. package/src/ReadAppHttp.ts +142 -0
  449. package/src/ReadDict.ts +44 -0
  450. package/src/ReadDictHttp.ts +27 -0
  451. package/src/ReadFunction.ts +107 -0
  452. package/src/ReadFunctionHttp.ts +91 -0
  453. package/src/ReadQueue.ts +44 -0
  454. package/src/ReadQueueHttp.ts +27 -0
  455. package/src/ReadServer.ts +98 -0
  456. package/src/ReadServerHttp.ts +101 -0
  457. package/src/ReadVolume.ts +45 -0
  458. package/src/ReadVolumeHttp.ts +28 -0
  459. package/src/ReadWriteDict.ts +44 -0
  460. package/src/ReadWriteDictHttp.ts +27 -0
  461. package/src/ReadWriteQueue.ts +45 -0
  462. package/src/ReadWriteQueueHttp.ts +27 -0
  463. package/src/ReadWriteVolume.ts +45 -0
  464. package/src/ReadWriteVolumeHttp.ts +28 -0
  465. package/src/RuntimeOwner.ts +111 -0
  466. package/src/Sandbox.ts +402 -0
  467. package/src/SandboxClient.ts +1404 -0
  468. package/src/ScaleFunction.ts +70 -0
  469. package/src/ScaleFunctionHttp.ts +54 -0
  470. package/src/Secret.ts +296 -0
  471. package/src/Server.ts +285 -0
  472. package/src/ServiceUser.ts +295 -0
  473. package/src/Volume.ts +320 -0
  474. package/src/VolumeClient.ts +108 -0
  475. package/src/VolumeFiles.ts +194 -0
  476. package/src/WebhookToken.ts +230 -0
  477. package/src/WorkspaceSettings.ts +160 -0
  478. package/src/WriteApp.ts +43 -0
  479. package/src/WriteAppHttp.ts +51 -0
  480. package/src/WriteDict.ts +44 -0
  481. package/src/WriteDictHttp.ts +27 -0
  482. package/src/WriteQueue.ts +44 -0
  483. package/src/WriteQueueHttp.ts +27 -0
  484. package/src/WriteSecret.ts +60 -0
  485. package/src/WriteSecretHttp.ts +56 -0
  486. package/src/WriteVolume.ts +44 -0
  487. package/src/WriteVolumeHttp.ts +28 -0
  488. package/src/globals.d.ts +2 -0
  489. package/src/index.ts +85 -0
  490. package/src/internal/Declared.ts +80 -0
  491. package/src/internal/Deploy.ts +309 -0
  492. package/src/internal/Entrypoint.ts +198 -0
  493. package/src/internal/Rpc.ts +59 -0
  494. package/src/internal/RpcAuth.ts +132 -0
  495. package/src/internal/Runtime.ts +386 -0
  496. package/src/internal/Tags.ts +44 -0
  497. package/src/internal/TcpConnect.ts +78 -0
  498. package/src/internal/Transport.ts +25 -0
  499. package/src/internal.ts +147 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TcpConnect.js","sources":["../../src/internal/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CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CACtD,CACF,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type * as HttpClient from "effect/http/HttpClient";
2
+ import * as Layer from "effect/Layer";
3
+ /** Whether this code runs on workerd (a Cloudflare Worker or Durable Object). */
4
+ export declare const isWorkerd: () => boolean;
5
+ /**
6
+ * How Modal calls leave this runtime: `fetch`, and on a Cloudflare Worker,
7
+ * distilled's `cloudflare:sockets` gRPC transport. `api.modal.com` is behind
8
+ * Cloudflare, and a Worker's `fetch` to it takes Cloudflare's internal
9
+ * Worker-to-site path, which resets Modal's gRPC upstream (`grpc-status: 14`).
10
+ * Other HTTP calls (blob uploads, the user's own endpoints) keep `fetch`.
11
+ */
12
+ export declare const ModalTransport: Layer.Layer<HttpClient.HttpClient>;
13
+ //# sourceMappingURL=Transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transport.d.ts","sources":["../../src/internal/Transport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,iFAAiF;AACjF,eAAO,MAAM,SAAS,QAAO,OACqD,CAAC;AAEnF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAM7D,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { GrpcTransport } from "@distilled.cloud/core/grpc-transport";
2
+ import * as CloudflareSockets from "@distilled.cloud/core/grpc-transport-cloudflare-sockets";
3
+ import * as Effect from "effect/Effect";
4
+ import * as FetchHttpClient from "effect/http/FetchHttpClient";
5
+ import * as Layer from "effect/Layer";
6
+ /** Whether this code runs on workerd (a Cloudflare Worker or Durable Object). */
7
+ export const isWorkerd = () => typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers";
8
+ /**
9
+ * How Modal calls leave this runtime: `fetch`, and on a Cloudflare Worker,
10
+ * distilled's `cloudflare:sockets` gRPC transport. `api.modal.com` is behind
11
+ * Cloudflare, and a Worker's `fetch` to it takes Cloudflare's internal
12
+ * Worker-to-site path, which resets Modal's gRPC upstream (`grpc-status: 14`).
13
+ * Other HTTP calls (blob uploads, the user's own endpoints) keep `fetch`.
14
+ */
15
+ export const ModalTransport = Layer.mergeAll(FetchHttpClient.layer, Layer.effect(GrpcTransport, Effect.sync(() => (isWorkerd() ? CloudflareSockets.client : undefined))));
16
+ //# sourceMappingURL=Transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transport.js","sources":["../../src/internal/Transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,KAAK,iBAAiB,MAAM,yDAAyD,CAAC;AAC7F,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAE/D,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,iFAAiF;AACjF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAY,EAAE,CACrC,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,SAAS,KAAK,oBAAoB,CAAC;AAEnF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAuC,KAAK,CAAC,QAAQ,CAC9E,eAAe,CAAC,KAAK,EACrB,KAAK,CAAC,MAAM,CACV,aAAa,EACb,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CACxE,CACF,CAAC"}
@@ -0,0 +1,71 @@
1
+ import type { Credentials } from "@distilled.cloud/modal/Credentials";
2
+ import * as environment from "@distilled.cloud/modal/environment";
3
+ import type { ListPagination } from "@distilled.cloud/modal/volume";
4
+ import * as Effect from "effect/Effect";
5
+ import type * as HttpClient from "effect/http/HttpClient";
6
+ /**
7
+ * Modal object names: letters, digits, `-`, `.` and `_`, shorter than 64
8
+ * characters. Names are unique per environment and kind.
9
+ */
10
+ export declare const objectName: (id: string, name: string | undefined, maxLength?: number) => Effect.Effect<string, never, import("alchemy/ResourceContext").ResourceContext | import("alchemy/Stack").Stack | import("alchemy/Stage").Stage>;
11
+ /**
12
+ * The environment a Modal call targets. Modal resolves an empty name to the
13
+ * workspace's default environment, so `undefined` stays `""` on the wire and
14
+ * `undefined` in attributes.
15
+ */
16
+ export declare const environmentOf: (name: string | undefined) => string;
17
+ /** Seconds of a duration given as seconds or a `"10 minutes"`-style string. */
18
+ export declare const seconds: (value: number | string | undefined) => number | undefined;
19
+ /**
20
+ * Every item of a Modal `List*` call. Modal pages by creation time: each
21
+ * request takes `maxObjects` and `createdBefore`, the creation time of the
22
+ * oldest item seen so far.
23
+ */
24
+ export declare const listAll: <T, E, R>(fetch: (pagination: ListPagination) => Effect.Effect<ReadonlyArray<T>, E, R>, createdAt: (item: T) => number | undefined, pageSize?: number) => Effect.Effect<T[], E, R>;
25
+ /**
26
+ * The names of every environment in the workspace, for `list` operations that
27
+ * enumerate objects across environments.
28
+ */
29
+ export declare const environmentNames: Effect.Effect<string[], environment.ModalOpError, environment.ModalOpContext>;
30
+ /** A wire `map<string, string>` without the absent entries proto3 JSON allows. */
31
+ export declare const stringMap: (map: Readonly<Record<string, string | undefined>> | undefined) => Record<string, string>;
32
+ /**
33
+ * Whether a name was generated by `createPhysicalName` (it ends in a
34
+ * 16-character base32 instance suffix, or an 8-character truncation hash plus
35
+ * the suffix). Modal objects other than Apps and Sandboxes have no tags, so
36
+ * `list` (and `alchemy nuke`) only enumerate objects with generated names
37
+ * and the objects runtimes created (`isRuntimeName`); objects given an
38
+ * explicit `name` are never swept.
39
+ */
40
+ export declare const isGeneratedName: (name: string | undefined) => boolean;
41
+ /**
42
+ * An environment by name, or a `Modal.Environment` (yielded: `yield* Agents`)
43
+ * whose name is used.
44
+ */
45
+ export type EnvironmentInput = string | {
46
+ readonly name: string;
47
+ };
48
+ /** The environment name an {@link EnvironmentInput} resolved to. */
49
+ export declare const envNameOf: (value: unknown) => string | undefined;
50
+ /** A protobuf `Timestamp` (RFC 3339) for a `Date`, ISO string or epoch milliseconds. */
51
+ export declare const timestampOf: (value: Date | string | number) => string;
52
+ /**
53
+ * Resolve a record of distilled operations into their call functions, like
54
+ * `Effect.all` over Effects. An operation is yieldable (`yield* op` captures
55
+ * the current context and returns a requirement-free call) but isn't an
56
+ * Effect value at runtime, so `Effect.all({ put: queue.putQueue })` fails.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const QueueOps = operations({ put: queue.putQueue, get: queue.getQueue });
61
+ * const { put } = yield* ModalBindings.withCredentials(QueueOps);
62
+ * ```
63
+ */
64
+ export declare const operations: <const Ops extends Record<string, Effect.Effect<unknown, never, OperationServices>>>(ops: Ops) => Effect.Effect<{ readonly [K in keyof Ops]: Effect.Success<Ops[K]>; }, never, OperationServices>;
65
+ /** The error of a resolved distilled call (or any function returning an Effect). */
66
+ export type ErrorOf<F> = F extends (...args: any[]) => Effect.Effect<any, infer E, any> ? E : never;
67
+ /** The error of operation `K` of a resolved operations record. */
68
+ export type OpError<Ops, K extends keyof Ops> = ErrorOf<Ops[K]>;
69
+ /** What a distilled Modal operation needs to run: credentials and an HTTP client. */
70
+ export type OperationServices = Credentials | HttpClient.HttpClient;
71
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,KAAK,WAAW,MAAM,oCAAoC,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACx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AAwF;AACxF,eAAO,MAAM,WAAW,UAAW,IAAI,GAAG,MAAM,GAAG,MAAM,KAAG,MACO,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,GACrB,KAAK,CAAC,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,OAE7E,GAAG,KACP,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAE,EAAE,KAAK,EAAE,iBAAiB,CAK5F,CAAC;AAEL,oFAAoF;AACpF,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEpG,kEAAkE;AAClE,MAAM,MAAM,OAAO,CAAC,GAAG,EAAE,CAAC,SAAS,MAAM,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhE,qFAAqF;AACrF,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC"}
@@ -0,0 +1,102 @@
1
+ import * as environment from "@distilled.cloud/modal/environment";
2
+ import { createPhysicalName } from "alchemy/PhysicalName";
3
+ import * as Effect from "effect/Effect";
4
+ /**
5
+ * Modal object names: letters, digits, `-`, `.` and `_`, shorter than 64
6
+ * characters. Names are unique per environment and kind.
7
+ */
8
+ export const objectName = (id, name, maxLength = 63) => name !== undefined ? Effect.succeed(name) : createPhysicalName({ id, maxLength, delimiter: "-" });
9
+ /**
10
+ * The environment a Modal call targets. Modal resolves an empty name to the
11
+ * workspace's default environment, so `undefined` stays `""` on the wire and
12
+ * `undefined` in attributes.
13
+ */
14
+ export const environmentOf = (name) => name ?? "";
15
+ /** Seconds of a duration given as seconds or a `"10 minutes"`-style string. */
16
+ export const seconds = (value) => {
17
+ if (value === undefined)
18
+ return undefined;
19
+ if (typeof value === "number")
20
+ return value;
21
+ const match = /^\s*(\d+(?:\.\d+)?)\s*(ms|millis|milliseconds?|s|secs?|seconds?|m|mins?|minutes?|h|hours?)\s*$/i.exec(value);
22
+ if (!match)
23
+ return Number(value);
24
+ const n = Number(match[1]);
25
+ const unit = match[2].toLowerCase();
26
+ if (unit.startsWith("ms") || unit.startsWith("milli"))
27
+ return n / 1000;
28
+ if (unit.startsWith("h"))
29
+ return n * 3600;
30
+ if (unit.startsWith("m"))
31
+ return n * 60;
32
+ return n;
33
+ };
34
+ /**
35
+ * Every item of a Modal `List*` call. Modal pages by creation time: each
36
+ * request takes `maxObjects` and `createdBefore`, the creation time of the
37
+ * oldest item seen so far.
38
+ */
39
+ export const listAll = Effect.fn(function* (fetch, createdAt, pageSize = 100) {
40
+ const all = [];
41
+ let before;
42
+ for (let page = 0; page < 1_000; page++) {
43
+ const items = yield* fetch({ maxObjects: pageSize, createdBefore: before });
44
+ all.push(...items);
45
+ if (items.length < pageSize)
46
+ break;
47
+ const oldest = Math.min(...items.map((item) => createdAt(item) ?? Number.POSITIVE_INFINITY));
48
+ if (!Number.isFinite(oldest) || oldest === before)
49
+ break;
50
+ before = oldest;
51
+ }
52
+ return all;
53
+ });
54
+ /**
55
+ * The names of every environment in the workspace, for `list` operations that
56
+ * enumerate objects across environments.
57
+ */
58
+ export const environmentNames = Effect.gen(function* () {
59
+ const response = yield* environment.listEnvironment({});
60
+ return (response.items ?? []).flatMap((item) => (item.name ? [item.name] : []));
61
+ });
62
+ /** A wire `map<string, string>` without the absent entries proto3 JSON allows. */
63
+ export const stringMap = (map) => Object.fromEntries(Object.entries(map ?? {}).flatMap(([key, value]) => value === undefined ? [] : [[key, value]]));
64
+ /**
65
+ * Whether a name was generated by `createPhysicalName` (it ends in a
66
+ * 16-character base32 instance suffix, or an 8-character truncation hash plus
67
+ * the suffix). Modal objects other than Apps and Sandboxes have no tags, so
68
+ * `list` (and `alchemy nuke`) only enumerate objects with generated names
69
+ * and the objects runtimes created (`isRuntimeName`); objects given an
70
+ * explicit `name` are never swept.
71
+ */
72
+ export const isGeneratedName = (name) => name !== undefined && /-[a-z2-7]{16}$/.test(name);
73
+ /** The environment name an {@link EnvironmentInput} resolved to. */
74
+ export const envNameOf = (value) => typeof value === "string"
75
+ ? value || undefined
76
+ : typeof value === "object" &&
77
+ value !== null &&
78
+ "name" in value &&
79
+ typeof value.name === "string"
80
+ ? value.name
81
+ : undefined;
82
+ /** A protobuf `Timestamp` (RFC 3339) for a `Date`, ISO string or epoch milliseconds. */
83
+ export const timestampOf = (value) => typeof value === "string" ? value : new Date(value).toISOString();
84
+ /**
85
+ * Resolve a record of distilled operations into their call functions, like
86
+ * `Effect.all` over Effects. An operation is yieldable (`yield* op` captures
87
+ * the current context and returns a requirement-free call) but isn't an
88
+ * Effect value at runtime, so `Effect.all({ put: queue.putQueue })` fails.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * const QueueOps = operations({ put: queue.putQueue, get: queue.getQueue });
93
+ * const { put } = yield* ModalBindings.withCredentials(QueueOps);
94
+ * ```
95
+ */
96
+ export const operations = (ops) => Effect.gen(function* () {
97
+ const resolved = {};
98
+ for (const [key, op] of Object.entries(ops))
99
+ resolved[key] = yield* op;
100
+ return resolved;
101
+ });
102
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sources":["../src/internal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,oCAAoC,CAAC;AAElE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAAU,EA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AAE,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;IACvE,OAAO,QAAiE,CAAC;AAC3E,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy.run/modal",
3
- "version": "0.0.0",
3
+ "version": "2.0.0-beta.87",
4
4
  "description": "Modal sandboxes, images, volumes, dicts, queues and secrets for Alchemy.",
5
5
  "keywords": [
6
6
  "agents",
@@ -11,12 +11,68 @@
11
11
  "modal",
12
12
  "sandbox"
13
13
  ],
14
+ "homepage": "https://alchemy.run",
15
+ "bugs": {
16
+ "url": "https://github.com/alchemy-run/alchemy/issues"
17
+ },
14
18
  "license": "Apache-2.0",
15
19
  "author": "Sam Goodwin <sam@alchemy.run>",
16
- "homepage": "https://alchemy.run",
17
20
  "repository": {
18
21
  "type": "git",
19
22
  "url": "git+https://github.com/alchemy-run/alchemy.git",
20
23
  "directory": "packages/modal"
24
+ },
25
+ "files": [
26
+ "lib",
27
+ "src"
28
+ ],
29
+ "type": "module",
30
+ "sideEffects": false,
31
+ "exports": {
32
+ ".": {
33
+ "types": "./lib/index.d.ts",
34
+ "bun": "./src/index.ts",
35
+ "worker": "./src/index.ts",
36
+ "default": "./lib/index.js"
37
+ },
38
+ "./internal/*": null,
39
+ "./internal": null,
40
+ "./*": {
41
+ "types": "./lib/*.d.ts",
42
+ "bun": "./src/*.ts",
43
+ "worker": "./src/*.ts",
44
+ "default": "./lib/*.js"
45
+ },
46
+ "./package.json": "./package.json"
47
+ },
48
+ "publishConfig": {
49
+ "access": "public"
50
+ },
51
+ "dependencies": {
52
+ "@alchemy.run/docker": "2.0.0-beta.87",
53
+ "@distilled.cloud/core": "1.0.0-rc.20",
54
+ "@distilled.cloud/modal": "1.0.0-rc.20",
55
+ "rolldown": "1.2.16"
56
+ },
57
+ "devDependencies": {
58
+ "@effect/platform-node": "^4.1.4",
59
+ "@types/bun": "1.4.3",
60
+ "alchemy": "2.0.0-beta.87",
61
+ "effect": "^4.1.4",
62
+ "typescript": "^7.1.0-dev.20261105.1"
63
+ },
64
+ "peerDependencies": {
65
+ "@effect/platform-node": "^4.1.4",
66
+ "alchemy": "2.0.0-beta.87",
67
+ "effect": "^4.1.4"
68
+ },
69
+ "alchemy": {
70
+ "contributes": [
71
+ "@alchemy.run/modal/Contributions"
72
+ ]
73
+ },
74
+ "scripts": {
75
+ "build": "pnpm -r --filter \"{.}...\" run build:package",
76
+ "build:package": "node scripts/build.ts"
21
77
  }
22
- }
78
+ }
package/src/App.ts ADDED
@@ -0,0 +1,262 @@
1
+ import * as app from "@distilled.cloud/modal/app";
2
+ import { Unowned } from "alchemy/AdoptPolicy";
3
+ import { deepEqual, isResolved } from "alchemy/Diff";
4
+ import * as Provider from "alchemy/Provider";
5
+ import { Resource } from "alchemy/Resource";
6
+ import * as Data from "effect/Data";
7
+ import * as Effect from "effect/Effect";
8
+ import * as Schedule from "effect/Schedule";
9
+ import {
10
+ type EnvironmentInput,
11
+ envNameOf,
12
+ environmentNames,
13
+ environmentOf,
14
+ objectName,
15
+ stringMap,
16
+ } from "./internal.ts";
17
+ import { declarable } from "./internal/Declared.ts";
18
+ import { createModalInternalTags, hasModalAlchemyTags, isAlchemyTagged } from "./internal/Tags.ts";
19
+ import type { Providers } from "./Providers.ts";
20
+
21
+ export class AppUnexpectedResponse extends Data.TaggedError("Modal.AppUnexpectedResponse")<{
22
+ readonly message: string;
23
+ }> {}
24
+
25
+ export interface AppProps {
26
+ /**
27
+ * App name, unique per environment. If omitted, a unique name is generated
28
+ * from the stack, stage and logical ID. Changing it replaces the app.
29
+ */
30
+ name?: string;
31
+ /**
32
+ * Environment the app lives in. Changing it replaces the app.
33
+ * @default the workspace's default environment
34
+ */
35
+ environment?: EnvironmentInput;
36
+ /**
37
+ * Key-value metadata on the app, shown in the Modal dashboard and usable
38
+ * for filtering. Alchemy adds its own `alchemy.*` ownership tags. Keys and values may
39
+ * contain only letters, digits, `.`, `_` and `-`, up to 63 characters.
40
+ */
41
+ tags?: Record<string, string>;
42
+ }
43
+
44
+ export interface AppAttributes {
45
+ /** App ID (`ap-…`). */
46
+ appId: string;
47
+ /** App name. */
48
+ name: string;
49
+ /** Environment name, or `undefined` for the workspace default. */
50
+ environment: string | undefined;
51
+ /** Tags on the app, including Alchemy's ownership tags. */
52
+ tags: Record<string, string>;
53
+ }
54
+
55
+ /**
56
+ * A Modal App: the named, persistent namespace that Functions, Servers,
57
+ * Sandboxes and Images run under. Each `Modal.Function` and `Modal.Server`
58
+ * of the Stack is published into its App, and stopping the App (destroying
59
+ * this resource) stops them and terminates its Sandboxes.
60
+ *
61
+ * An App deployed with Modal's Python client (`modal deploy`) can also be
62
+ * referenced by name from {@link InvokeFunction} and
63
+ * {@link FunctionAutoscaler}.
64
+ *
65
+ * ### Creating an App
66
+ * **Example:** An app for sandboxes
67
+ * ```typescript
68
+ * import * as Modal from "@alchemy.run/modal";
69
+ *
70
+ * export const Coder = Modal.App("Coder", {});
71
+ * ```
72
+ *
73
+ * **Example:** A named, tagged app in an environment
74
+ * ```typescript
75
+ * import * as Modal from "@alchemy.run/modal";
76
+ import * as Schedule from "effect/Schedule";
77
+ *
78
+ * export const Agents = Modal.Environment("Agents", {});
79
+ * export const Coder = Modal.App("Coder", {
80
+ * name: "coder",
81
+ * environment: Agents,
82
+ * tags: { team: "platform" },
83
+ * });
84
+ * ```
85
+ *
86
+ * ### Running sandboxes in it
87
+ * **Example:** Create sandboxes from a Worker
88
+ * ```typescript
89
+ * import * as Cloudflare from "@alchemy.run/cloudflare";
90
+ * import * as Modal from "@alchemy.run/modal";
91
+ * import * as Effect from "effect/Effect";
92
+ import * as Schedule from "effect/Schedule";
93
+ * import * as HttpServerResponse from "effect/http/HttpServerResponse";
94
+ * import { Coder } from "./Coder.ts";
95
+ *
96
+ * export default class Api extends Cloudflare.Worker<Api>()(
97
+ * "Api",
98
+ * { main: import.meta.url },
99
+ * Effect.gen(function* () {
100
+ * const sandboxes = yield* Modal.CreateSandbox(Coder);
101
+ * return {
102
+ * fetch: Effect.gen(function* () {
103
+ * const sandbox = yield* sandboxes.create({ image: "node:22-slim" });
104
+ * const result = yield* sandbox.exec(["node", "--version"]);
105
+ * yield* sandbox.terminate();
106
+ * return HttpServerResponse.text(result.stdout);
107
+ * }).pipe(Effect.orDie),
108
+ * };
109
+ * }).pipe(Effect.provide(Modal.CreateSandboxHttp)),
110
+ * ) {}
111
+ * ```
112
+ *
113
+ * ### Looking up an existing App
114
+ * `App.lookup` references a App Alchemy doesn't manage (created with
115
+ * the Modal CLI or by another stack). It is read during plan/deploy, never
116
+ * created, updated or deleted.
117
+ *
118
+ * **Example:** Reference an existing App
119
+ * ```typescript
120
+ * const app = Modal.App.lookup({ name: "inference" });
121
+ * ```
122
+ *
123
+ * @resource
124
+ * @product App
125
+ */
126
+ export const App = declarable<App>()(Resource<App>("Modal.App"));
127
+
128
+ export type App = Resource<"Modal.App", AppProps, AppAttributes, never, Providers, AppLookup>;
129
+
130
+ /**
131
+ * Props for {@link App.lookup}: find a App this stack
132
+ * doesn't manage by its name.
133
+ */
134
+ export interface AppLookup {
135
+ /** App name. */
136
+ name: string;
137
+ /**
138
+ * Modal environment the object lives in.
139
+ * @default the workspace's default environment
140
+ */
141
+ environment?: string;
142
+ }
143
+
144
+ const isStopped = (state: string | undefined) =>
145
+ state === "APP_STATE_STOPPED" || state === "APP_STATE_STOPPING";
146
+
147
+ export const AppProvider = () =>
148
+ Provider.effect(
149
+ App,
150
+ Effect.gen(function* () {
151
+ const observe = Effect.fn(function* (name: string, env: string | undefined) {
152
+ // Without a creation type, get-or-create only looks the app up
153
+ // (Modal no longer serves `AppLookup`).
154
+ const found = yield* app
155
+ .appGetOrCreate({ appName: name, environmentName: environmentOf(env) })
156
+ .pipe(Effect.catchTag("AppNotFound", () => Effect.undefined));
157
+ if (!found?.appId) return undefined;
158
+ const { tags } = yield* app
159
+ .appGetTags({ appId: found.appId })
160
+ .pipe(Effect.catchTag("AppNotFound", () => Effect.succeed({ tags: undefined })));
161
+ return {
162
+ appId: found.appId,
163
+ name,
164
+ environment: env,
165
+ tags: stringMap(tags),
166
+ } satisfies AppAttributes;
167
+ });
168
+
169
+ return {
170
+ stables: ["appId", "name", "environment"],
171
+ diff: Effect.fn(function* ({ id, news, olds, output }) {
172
+ if (!isResolved(news)) return undefined;
173
+ if (envNameOf(news.environment) !== envNameOf(olds?.environment))
174
+ return { action: "replace" } as const;
175
+ const name = yield* objectName(id, news.name);
176
+ if (output !== undefined && name !== output.name) return { action: "replace" } as const;
177
+ return undefined;
178
+ }),
179
+ lookup: Effect.fn(function* ({ name, environment }) {
180
+ return yield* observe(name, environment);
181
+ }),
182
+
183
+ read: Effect.fn(function* ({ id, olds, output }) {
184
+ const name = output?.name ?? (yield* objectName(id, olds?.name));
185
+ const observed = yield* observe(
186
+ name,
187
+ output?.environment ?? envNameOf(olds?.environment),
188
+ );
189
+ if (!observed) return undefined;
190
+ const ours = yield* hasModalAlchemyTags(id, observed.tags);
191
+ return ours ? observed : Unowned(observed);
192
+ }),
193
+ reconcile: Effect.fn(function* ({ id, news, output, session }) {
194
+ const name = output?.name ?? (yield* objectName(id, news.name));
195
+ // Observe + ensure: get-or-create is idempotent under races.
196
+ let current = yield* observe(name, envNameOf(news.environment));
197
+ if (!current) {
198
+ yield* session.note(`Creating app ${name}...`);
199
+ // Modal rate-limits App creation per workspace; wait it out.
200
+ const created = yield* app
201
+ .appGetOrCreate({
202
+ appName: name,
203
+ environmentName: environmentOf(envNameOf(news.environment)),
204
+ objectCreationType: "OBJECT_CREATION_TYPE_CREATE_IF_MISSING",
205
+ })
206
+ .pipe(
207
+ Effect.retry({
208
+ while: (e) => e._tag === "TooManyRequests",
209
+ schedule: Schedule.spaced("5 seconds"),
210
+ times: 12,
211
+ }),
212
+ );
213
+ if (!created.appId) {
214
+ return yield* new AppUnexpectedResponse({
215
+ message: `Modal returned no id for app ${name}`,
216
+ });
217
+ }
218
+ current = {
219
+ appId: created.appId,
220
+ name,
221
+ environment: envNameOf(news.environment),
222
+ tags: {},
223
+ };
224
+ }
225
+ // Sync tags against the observed tags. Modal stores the map it is
226
+ // given; it has no per-key delete.
227
+ const desired = { ...news.tags, ...(yield* createModalInternalTags(id)) };
228
+ if (!deepEqual(current.tags, desired)) {
229
+ yield* app.appSetTags({ appId: current.appId, tags: desired });
230
+ current = { ...current, tags: desired };
231
+ }
232
+ return current;
233
+ }),
234
+ delete: Effect.fn(function* ({ output }) {
235
+ yield* app
236
+ .stopApp({ appId: output.appId, source: "APP_STOP_SOURCE_CLI" })
237
+ .pipe(Effect.catchTag("AppNotFound", () => Effect.void));
238
+ }),
239
+ list: Effect.fn(function* () {
240
+ const envs = yield* environmentNames;
241
+ const all: AppAttributes[] = [];
242
+ for (const env of envs) {
243
+ const { apps } = yield* app.listApp({ environmentName: env });
244
+ for (const item of apps ?? []) {
245
+ if (!item.appId || isStopped(item.state)) continue;
246
+ const { tags } = yield* app
247
+ .appGetTags({ appId: item.appId })
248
+ .pipe(Effect.catchTag("AppNotFound", () => Effect.succeed({ tags: undefined })));
249
+ if (!isAlchemyTagged(tags)) continue;
250
+ all.push({
251
+ appId: item.appId,
252
+ name: item.name ?? item.description ?? "",
253
+ environment: env,
254
+ tags: stringMap(tags),
255
+ });
256
+ }
257
+ }
258
+ return all;
259
+ }),
260
+ };
261
+ }),
262
+ );