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

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,155 @@
1
+ import * as functions from "@distilled.cloud/modal/functions";
2
+ import { Platform, type Main, type MainRpc } from "alchemy/Platform";
3
+ import * as Provider from "alchemy/Provider";
4
+ import type { Resource } from "alchemy/Resource";
5
+ import type { HostRuntimeContext, ServerHost } from "alchemy/Runtime/Process";
6
+ import type { ContainerProps } from "./Container.ts";
7
+ import { type RuntimeAttributes } from "./internal/Runtime.ts";
8
+ import type { MountContract } from "./Mounts.ts";
9
+ import type { Providers } from "./Providers.ts";
10
+ import type { DurationInput } from "./SandboxClient.ts";
11
+ export interface ServerProps extends ContainerProps {
12
+ /**
13
+ * Region requests are routed through (`"us-east"`, `"us-west"`, `"eu-west"`,
14
+ * `"ap-south"`, ...). Containers run near it.
15
+ * @default "us-east"
16
+ */
17
+ routingRegion?: string;
18
+ /**
19
+ * Serve without Modal's proxy auth. By default every request needs the
20
+ * `Modal-Key` / `Modal-Secret` headers of a `Modal.WebhookToken`.
21
+ * @default false
22
+ */
23
+ unauthenticated?: boolean;
24
+ /** Serve HTTP/2 to the program. */
25
+ h2?: boolean;
26
+ /**
27
+ * Time in-flight requests get to finish when a container shuts down, at
28
+ * most an hour.
29
+ * @default 0
30
+ */
31
+ exitGracePeriod?: DurationInput;
32
+ /**
33
+ * Concurrent requests per container the autoscaler aims for; may be
34
+ * fractional (`1.5`). `0` turns autoscaling off.
35
+ */
36
+ targetConcurrency?: number;
37
+ /**
38
+ * Most concurrent requests per container; more get `429`.
39
+ * @default unlimited
40
+ */
41
+ maxConcurrency?: number;
42
+ /**
43
+ * Sticky sessions: each session is pinned to one container
44
+ * (`server.sessions.start()` in Modal's clients).
45
+ * @default false
46
+ */
47
+ sessioned?: boolean;
48
+ }
49
+ export interface ServerAttributes extends RuntimeAttributes {
50
+ /** The Server's URL. */
51
+ url: string | undefined;
52
+ /** Region requests are routed through. */
53
+ routingRegion: string;
54
+ /** Whether requests skip Modal's proxy auth. */
55
+ unauthenticated: boolean;
56
+ }
57
+ export type Server = Resource<"Modal.Server", ServerProps, ServerAttributes, {
58
+ env?: Record<string, any>;
59
+ mounts?: MountContract;
60
+ rpcCallers?: string[];
61
+ }, Providers>;
62
+ export type ServerServices = ServerHost;
63
+ /**
64
+ * What the program returns: `fetch` for HTTP, and any other functions,
65
+ * its RPC methods.
66
+ */
67
+ export type ServerShape = Main<ServerServices> | (Exclude<Main<ServerServices>, void> & MainRpc<ServerServices>);
68
+ export type ServerRuntimeContext = HostRuntimeContext;
69
+ /**
70
+ * A Modal Server: your program as a long-running HTTP server on Modal, with
71
+ * low-latency routing through one region and autoscaling on concurrent
72
+ * requests. Use it for APIs, model servers and anything that keeps
73
+ * connections open; use `Modal.Function` with `web` for simple endpoints.
74
+ *
75
+ * Alchemy bundles `main`, builds it into an image on Modal's builder (no
76
+ * Docker) and deploys the Server into its `Modal.App`. Each container starts
77
+ * the program, and Modal routes the Server's URL to its `fetch` handler.
78
+ * Requests need Modal's proxy auth headers unless `unauthenticated` is set:
79
+ * bind `Modal.FetchServer(server)` to call it from another runtime.
80
+ *
81
+ * ### Effect program
82
+ * **Example:** An API server
83
+ * ```typescript
84
+ * // src/Api.ts
85
+ * import * as Modal from "@alchemy.run/modal";
86
+ * import * as Effect from "effect/Effect";
87
+ * import * as HttpServerResponse from "effect/http/HttpServerResponse";
88
+ * import { Backend } from "./Backend.ts";
89
+ *
90
+ * export default class Api extends Modal.Server<Api>()(
91
+ * "Api",
92
+ * { main: import.meta.url, app: Backend, routingRegion: "us-east" },
93
+ * Effect.gen(function* () {
94
+ * return {
95
+ * fetch: Effect.succeed(HttpServerResponse.text("ok")),
96
+ * };
97
+ * }),
98
+ * ) {}
99
+ * ```
100
+ *
101
+ * ### Async program
102
+ * **Example:** A plain HTTP server, no Effect (it runs on Bun)
103
+ * ```typescript
104
+ * // src/Api.ts
105
+ * import * as Modal from "@alchemy.run/modal";
106
+ * import { Backend } from "./Backend.ts";
107
+ *
108
+ * export const Api = Modal.Server("Api", {
109
+ * main: "./src/api-server.ts",
110
+ * app: Backend,
111
+ * unauthenticated: true,
112
+ * env: { GREETING: "hello" },
113
+ * });
114
+ * export type ApiEnv = Modal.InferEnv<typeof Api>;
115
+ * ```
116
+ *
117
+ * ```typescript
118
+ * // src/api-server.ts
119
+ * import type { ApiEnv } from "./Api.ts";
120
+ *
121
+ * const env = process.env as unknown as ApiEnv;
122
+ *
123
+ * Bun.serve({ port: Number(process.env.PORT), fetch: () => new Response(env.GREETING) });
124
+ * ```
125
+ *
126
+ * ### Calling it
127
+ * **Example:** From a Cloudflare Worker, with proxy auth
128
+ * ```typescript
129
+ * const api = yield* Modal.FetchServer(Api);
130
+ * const response = yield* api.fetch(HttpClientRequest.get("/"));
131
+ * ```
132
+ *
133
+ * ### Scaling
134
+ * **Example:** Two warm containers, 20 requests each
135
+ * ```typescript
136
+ * export default class Api extends Modal.Server<Api>()(
137
+ * "Api",
138
+ * {
139
+ * main: import.meta.url,
140
+ * app: Backend,
141
+ * minContainers: 2,
142
+ * targetConcurrency: 20,
143
+ * maxConcurrency: 50,
144
+ * exitGracePeriod: "30 seconds",
145
+ * },
146
+ * program,
147
+ * ) {}
148
+ * ```
149
+ *
150
+ * @resource
151
+ * @product Server
152
+ */
153
+ export declare const Server: Platform<Server, ServerServices, ServerShape, ServerRuntimeContext>;
154
+ export declare const ServerProvider: () => import("effect/Layer").Layer<Provider.Provider<Server>, never, import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("alchemy/Stack").Stack | import("alchemy/Stage").Stage | functions.ModalOpContext>;
155
+ //# sourceMappingURL=Server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Server.d.ts","sources":["../src/Server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,KAAK,IAAI,EAAE,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK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xC;;;GAGG;AACH,MAAM,MAAM,WAAW,GACnB,IAAI,CAAC,cAAc,CAAC,GACpB,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;AACpE,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AACH,eAAO,MAAM,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,oBAAoB,CAMtF,CAAC;AAsCF,eAAO,MAAM,cAAc,sOAsExB,CAAC"}
package/lib/Server.js ADDED
@@ -0,0 +1,184 @@
1
+ import * as functions from "@distilled.cloud/modal/functions";
2
+ import { Platform } from "alchemy/Platform";
3
+ import * as Provider from "alchemy/Provider";
4
+ import * as Effect from "effect/Effect";
5
+ import * as Schedule from "effect/Schedule";
6
+ import { environmentOf, seconds } from "./internal.js";
7
+ import { ENTRYPOINT, RPC_SERVE_ENV } from "./internal/Entrypoint.js";
8
+ import { createModalRuntimeContext } from "./internal/Rpc.js";
9
+ import { resolveContainerProps, runtimeLifecycle, } from "./internal/Runtime.js";
10
+ /**
11
+ * A Modal Server: your program as a long-running HTTP server on Modal, with
12
+ * low-latency routing through one region and autoscaling on concurrent
13
+ * requests. Use it for APIs, model servers and anything that keeps
14
+ * connections open; use `Modal.Function` with `web` for simple endpoints.
15
+ *
16
+ * Alchemy bundles `main`, builds it into an image on Modal's builder (no
17
+ * Docker) and deploys the Server into its `Modal.App`. Each container starts
18
+ * the program, and Modal routes the Server's URL to its `fetch` handler.
19
+ * Requests need Modal's proxy auth headers unless `unauthenticated` is set:
20
+ * bind `Modal.FetchServer(server)` to call it from another runtime.
21
+ *
22
+ * ### Effect program
23
+ * **Example:** An API server
24
+ * ```typescript
25
+ * // src/Api.ts
26
+ * import * as Modal from "@alchemy.run/modal";
27
+ * import * as Effect from "effect/Effect";
28
+ * import * as HttpServerResponse from "effect/http/HttpServerResponse";
29
+ * import { Backend } from "./Backend.ts";
30
+ *
31
+ * export default class Api extends Modal.Server<Api>()(
32
+ * "Api",
33
+ * { main: import.meta.url, app: Backend, routingRegion: "us-east" },
34
+ * Effect.gen(function* () {
35
+ * return {
36
+ * fetch: Effect.succeed(HttpServerResponse.text("ok")),
37
+ * };
38
+ * }),
39
+ * ) {}
40
+ * ```
41
+ *
42
+ * ### Async program
43
+ * **Example:** A plain HTTP server, no Effect (it runs on Bun)
44
+ * ```typescript
45
+ * // src/Api.ts
46
+ * import * as Modal from "@alchemy.run/modal";
47
+ * import { Backend } from "./Backend.ts";
48
+ *
49
+ * export const Api = Modal.Server("Api", {
50
+ * main: "./src/api-server.ts",
51
+ * app: Backend,
52
+ * unauthenticated: true,
53
+ * env: { GREETING: "hello" },
54
+ * });
55
+ * export type ApiEnv = Modal.InferEnv<typeof Api>;
56
+ * ```
57
+ *
58
+ * ```typescript
59
+ * // src/api-server.ts
60
+ * import type { ApiEnv } from "./Api.ts";
61
+ *
62
+ * const env = process.env as unknown as ApiEnv;
63
+ *
64
+ * Bun.serve({ port: Number(process.env.PORT), fetch: () => new Response(env.GREETING) });
65
+ * ```
66
+ *
67
+ * ### Calling it
68
+ * **Example:** From a Cloudflare Worker, with proxy auth
69
+ * ```typescript
70
+ * const api = yield* Modal.FetchServer(Api);
71
+ * const response = yield* api.fetch(HttpClientRequest.get("/"));
72
+ * ```
73
+ *
74
+ * ### Scaling
75
+ * **Example:** Two warm containers, 20 requests each
76
+ * ```typescript
77
+ * export default class Api extends Modal.Server<Api>()(
78
+ * "Api",
79
+ * {
80
+ * main: import.meta.url,
81
+ * app: Backend,
82
+ * minContainers: 2,
83
+ * targetConcurrency: 20,
84
+ * maxConcurrency: 50,
85
+ * exitGracePeriod: "30 seconds",
86
+ * },
87
+ * program,
88
+ * ) {}
89
+ * ```
90
+ *
91
+ * @resource
92
+ * @product Server
93
+ */
94
+ export const Server = Platform("Modal.Server", {
95
+ createRuntimeContext: createModalRuntimeContext("Modal.Server"),
96
+ transformProps: resolveContainerProps,
97
+ });
98
+ const bootstrapEntry = (handler) => (importPath) => `
99
+ import { bootstrap } from "@alchemy.run/modal/Bootstrap";
100
+ import { ${handler} as entrypoint } from ${JSON.stringify(importPath)};
101
+
102
+ await bootstrap(entrypoint);
103
+ `;
104
+ const DEFAULT_REGION = "us-east";
105
+ const definitionOf = (props, context) => {
106
+ const region = props.routingRegion ?? DEFAULT_REGION;
107
+ return {
108
+ implementationName: ENTRYPOINT.server,
109
+ isServer: true,
110
+ isSessioned: props.sessioned ?? false,
111
+ routingRegion: region,
112
+ httpConfig: {
113
+ port: context.port,
114
+ proxyRegions: [region],
115
+ startupTimeout: Math.round(context.startupTimeout),
116
+ exitGracePeriod: Math.round(seconds(props.exitGracePeriod) ?? 0),
117
+ h2Enabled: props.h2 ?? false,
118
+ unauthenticated: props.unauthenticated ?? false,
119
+ },
120
+ maxConcurrentInputs: props.maxConcurrency ?? 0,
121
+ supportedInputFormats: [],
122
+ supportedOutputFormats: [],
123
+ };
124
+ };
125
+ export const ServerProvider = () => Provider.effect(Server, Effect.gen(function* () {
126
+ const lifecycle = yield* runtimeLifecycle({
127
+ type: "Modal.Server",
128
+ definition: (props, context) => {
129
+ const definition = definitionOf(props, context);
130
+ return props.targetConcurrency === undefined
131
+ ? definition
132
+ : {
133
+ ...definition,
134
+ autoscalerSettings: { targetConcurrencyFloat: props.targetConcurrency },
135
+ };
136
+ },
137
+ bootstrap: bootstrapEntry,
138
+ // Behind proxy auth Modal authenticates every request, so the
139
+ // program serves RPC; an unauthenticated Server never does.
140
+ env: (props) => props.unauthenticated ? {} : { [RPC_SERVE_ENV]: "1" },
141
+ });
142
+ /** The Server's URL: Modal assigns it once the App is published. */
143
+ const urlOf = Effect.fn(function* (attributes, published) {
144
+ if (published?.[0])
145
+ return published[0];
146
+ const found = yield* functions
147
+ .getFunction({
148
+ appName: attributes.appName ?? "",
149
+ objectTag: attributes.name,
150
+ environmentName: environmentOf(attributes.environment),
151
+ })
152
+ .pipe(Effect.map((response) => response.handleMetadata?.ExperimentalFlashUrls?.[0]), Effect.repeat({
153
+ schedule: Schedule.spaced("2 seconds"),
154
+ until: (url) => url !== undefined,
155
+ times: 10,
156
+ }));
157
+ return found;
158
+ });
159
+ return {
160
+ stables: lifecycle.stables,
161
+ diff: lifecycle.diff,
162
+ read: Effect.fn(function* ({ output }) {
163
+ const found = yield* lifecycle.read({ output });
164
+ return found === undefined ? undefined : output;
165
+ }),
166
+ reconcile: Effect.fn(function* ({ id, news, output, session, bindings }) {
167
+ const { attributes, metadata } = yield* lifecycle.reconcile({
168
+ id,
169
+ news,
170
+ output,
171
+ session,
172
+ bindings,
173
+ });
174
+ return {
175
+ ...attributes,
176
+ url: yield* urlOf(attributes, metadata?.ExperimentalFlashUrls),
177
+ routingRegion: news.routingRegion ?? DEFAULT_REGION,
178
+ unauthenticated: news.unauthenticated ?? false,
179
+ };
180
+ }),
181
+ delete: lifecycle.delete,
182
+ };
183
+ }));
184
+ //# sourceMappingURL=Server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Server.js","sources":["../src/Server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAA2B,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAG7C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EACL,q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/C,CAAC;QACJ,CAAC,CAAC;QACF,MAAM,EAAE,SAAS,CAAC,MAAM;KACzB,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
@@ -0,0 +1,139 @@
1
+ import * as environment from "@distilled.cloud/modal/environment";
2
+ import * as Provider from "alchemy/Provider";
3
+ import { Resource } from "alchemy/Resource";
4
+ import * as Effect from "effect/Effect";
5
+ import * as Redacted from "effect/Redacted";
6
+ import { type EnvironmentInput } from "./internal.ts";
7
+ import type { Providers } from "./Providers.ts";
8
+ import type { DurationInput } from "./SandboxClient.ts";
9
+ declare const ServiceUserUnexpectedResponse_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
10
+ readonly _tag: "Modal.ServiceUserUnexpectedResponse";
11
+ } & Readonly<A>;
12
+ export declare class ServiceUserUnexpectedResponse extends ServiceUserUnexpectedResponse_base<{
13
+ readonly message: string;
14
+ }> {
15
+ }
16
+ declare const ServiceUsersNotAvailable_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
17
+ readonly _tag: "Modal.ServiceUsersNotAvailable";
18
+ } & Readonly<A>;
19
+ /**
20
+ * The workspace's plan has no service users (Modal's Starter plan). Bindings
21
+ * create one per host; `Modal.DeployerHostIdentity` binds the deployer's token
22
+ * instead.
23
+ */
24
+ export declare class ServiceUsersNotAvailable extends ServiceUsersNotAvailable_base<{
25
+ readonly message: string;
26
+ }> {
27
+ }
28
+ /** A role a scoped service user holds in one environment. */
29
+ export interface ServiceUserEnvironmentRole {
30
+ /** The environment: its name, or a yielded `Modal.Environment`. */
31
+ readonly environment: EnvironmentInput;
32
+ /** `viewer` reads; `contributor` also deploys and writes. */
33
+ readonly role: "viewer" | "contributor";
34
+ }
35
+ export interface ServiceUserProps {
36
+ /**
37
+ * Service user name, unique in the workspace. If omitted, one is generated
38
+ * from the stack, stage and logical ID. Changing it replaces the user (and
39
+ * its token).
40
+ */
41
+ name?: string;
42
+ /**
43
+ * Limit the user to the environments in {@link environments}. An unscoped
44
+ * user acts on the whole workspace. Changing it replaces the user.
45
+ * @default true
46
+ */
47
+ scoped?: boolean;
48
+ /** Roles of a scoped user, per environment. */
49
+ environments?: ServiceUserEnvironmentRole[];
50
+ /**
51
+ * Expire the user's token after this long. Changing it replaces the user.
52
+ * @default never
53
+ */
54
+ expiresIn?: DurationInput;
55
+ }
56
+ export interface ServiceUserAttributes {
57
+ /** Service user ID. */
58
+ serviceUserId: string;
59
+ /** Service user name. */
60
+ name: string;
61
+ /** Token ID (`ak-…`), the `MODAL_TOKEN_ID` of the user. */
62
+ tokenId: string;
63
+ /** Token secret (`as-…`), the `MODAL_TOKEN_SECRET` of the user. */
64
+ tokenSecret: Redacted.Redacted<string>;
65
+ /** Whether the user is limited to its environments. */
66
+ scoped: boolean;
67
+ /** Roles by environment name. */
68
+ environments: Record<string, "viewer" | "contributor">;
69
+ }
70
+ /**
71
+ * A Modal service user: a workspace identity with its own token pair, for
72
+ * CI or another system. A scoped user acts only in the environments you
73
+ * grant it, as a `viewer` or a `contributor`.
74
+ *
75
+ * Modal shows a service user's token secret once, at creation, so a user
76
+ * deleted outside Alchemy is recreated with a new token on the next deploy,
77
+ * and an existing user can't be adopted.
78
+ *
79
+ * ### Creating a service user
80
+ * **Example:** CI that deploys to one environment
81
+ * ```typescript
82
+ * import * as Modal from "@alchemy.run/modal";
83
+ *
84
+ * export const Staging = Modal.Environment("Staging", {});
85
+ * export const Deployer = Modal.ServiceUser("Deployer", {
86
+ * environments: [{ environment: Staging, role: "contributor" }],
87
+ * });
88
+ * ```
89
+ *
90
+ * **Example:** A short-lived, read-only token
91
+ * ```typescript
92
+ * export const Auditor = Modal.ServiceUser("Auditor", {
93
+ * environments: [{ environment: "main", role: "viewer" }],
94
+ * expiresIn: "7 days",
95
+ * });
96
+ * ```
97
+ *
98
+ * ### Using its token
99
+ * **Example:** Hand the pair to a Worker that calls Modal as the user
100
+ * ```typescript
101
+ * import * as Cloudflare from "@alchemy.run/cloudflare";
102
+ * import * as Effect from "effect/Effect";
103
+ *
104
+ * export const Ci = Effect.gen(function* () {
105
+ * const deployer = yield* Deployer;
106
+ * return yield* Cloudflare.Worker("Ci", {
107
+ * main: "./src/ci.ts",
108
+ * env: { MODAL_TOKEN_ID: deployer.tokenId, MODAL_TOKEN_SECRET: deployer.tokenSecret },
109
+ * });
110
+ * });
111
+ * ```
112
+ *
113
+ * @resource
114
+ * @product Workspace
115
+ */
116
+ export declare const ServiceUser: import("alchemy/Resource").ResourceConstructor<ServiceUser, Providers> & Effect.Effect<import("alchemy/Resource").ResourceConstructor<ServiceUser, never>, never, never> & {
117
+ Self: import("alchemy/Self").Self<ServiceUser>;
118
+ Provider: Provider.Provider<ServiceUser>;
119
+ Aliases: readonly string[] | undefined;
120
+ ref(id: string, options?: {
121
+ stage?: string;
122
+ stack?: string;
123
+ }): Effect.Effect<ServiceUser, never, never>;
124
+ } & ((id: string, props: import("./internal/Declared.ts").DeclaredProps<ServiceUserProps>) => Effect.Effect<ServiceUser, never, Providers>);
125
+ export type ServiceUser = Resource<"Modal.ServiceUser", ServiceUserProps, ServiceUserAttributes, {
126
+ /**
127
+ * Roles contributed by bindings: a binding on a host grants the host's
128
+ * service user the role it needs on the bound resource's environment
129
+ * (`undefined` is the workspace default). The strongest role per
130
+ * environment wins.
131
+ */
132
+ environments?: Array<{
133
+ readonly environment: string | undefined;
134
+ readonly role: "viewer" | "contributor";
135
+ }>;
136
+ }, Providers>;
137
+ export declare const ServiceUserProvider: () => import("effect/Layer").Layer<Provider.Provider<ServiceUser>, never, import("alchemy/Stack").Stack | import("alchemy/Stage").Stage | environment.ModalOpContext>;
138
+ export {};
139
+ //# sourceMappingURL=ServiceUser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServiceUser.d.ts","sources":["../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