@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,106 @@
1
+ import * as app from "@distilled.cloud/modal/app";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
+ import { makeModalBinding } from "./BindingHttp.js";
5
+ import { operations, stringMap, timestampOf } from "./internal.js";
6
+ import { ReadApp } from "./ReadApp.js";
7
+ const STREAM = {
8
+ stdout: "FILE_DESCRIPTOR_STDOUT",
9
+ stderr: "FILE_DESCRIPTOR_STDERR",
10
+ info: "FILE_DESCRIPTOR_INFO",
11
+ };
12
+ const streamOf = (fd) => fd === STREAM.stdout
13
+ ? "stdout"
14
+ : fd === STREAM.stderr
15
+ ? "stderr"
16
+ : fd === STREAM.info
17
+ ? "info"
18
+ : undefined;
19
+ const filterOf = (filter) => ({
20
+ functionId: filter.functionId,
21
+ functionCallId: filter.functionCallId,
22
+ taskId: filter.containerId,
23
+ sandboxId: filter.sandboxId,
24
+ searchText: filter.search,
25
+ source: filter.stream ? STREAM[filter.stream] : undefined,
26
+ });
27
+ /** The operations the client calls, resolved by `ModalBindings.withCredentials`. */
28
+ const ReadAppOps = operations({
29
+ fetchLogs: app.appFetchLogs,
30
+ getLogs: app.appGetLogs,
31
+ countLogs: app.appCountLogs,
32
+ info: app.appGetInfo,
33
+ lifecycle: app.appGetLifecycle,
34
+ layout: app.appGetLayout,
35
+ deployments: app.appDeploymentHistory,
36
+ });
37
+ /**
38
+ * {@link ReadApp} over Modal's API. Grants the host's identity (a scoped
39
+ * `Modal.ServiceUser`) the `viewer` role on the App's environment.
40
+ *
41
+ * @layer
42
+ * @product App
43
+ * @provides Modal.ReadApp
44
+ */
45
+ export const ReadAppHttp = Layer.effect(ReadApp, makeModalBinding({
46
+ tag: "Modal.ReadApp",
47
+ operations: ReadAppOps,
48
+ role: "viewer",
49
+ make: Effect.fn(function* (target, ops) {
50
+ const appId = yield* target.appId;
51
+ return {
52
+ logs: (query) => Effect.flatMap(appId, (id) => ops.fetchLogs({
53
+ appId: id,
54
+ since: timestampOf(query.since),
55
+ until: timestampOf(query.until ?? Date.now()),
56
+ limit: query.limit,
57
+ ...filterOf(query),
58
+ })).pipe(Effect.map((response) => (response.batches ?? []).flatMap((batch) => (batch.items ?? []).map((line) => ({
59
+ data: line.data ?? "",
60
+ timestamp: line.timestamp,
61
+ stream: streamOf(line.fileDescriptor),
62
+ functionId: batch.functionId,
63
+ functionCallId: line.functionCallId,
64
+ containerId: line.containerId ?? batch.taskId,
65
+ sandboxId: batch.sandboxId,
66
+ }))))),
67
+ tail: (query = {}) => Effect.flatMap(appId, (id) => ops.getLogs({
68
+ appId: id,
69
+ timeout: query.timeout ?? 10,
70
+ lastEntryId: query.cursor,
71
+ functionId: query.functionId,
72
+ functionCallId: query.functionCallId,
73
+ taskId: query.containerId,
74
+ sandboxId: query.sandboxId,
75
+ searchText: query.search,
76
+ fileDescriptor: query.stream ? STREAM[query.stream] : undefined,
77
+ })).pipe(Effect.map(({ items }) => ({
78
+ lines: items.flatMap((batch) => (batch.items ?? []).map((line) => ({
79
+ data: line.data ?? "",
80
+ timestamp: line.timestamp,
81
+ stream: streamOf(line.fileDescriptor),
82
+ functionId: batch.functionId,
83
+ functionCallId: line.functionCallId,
84
+ containerId: line.containerId ?? batch.taskId,
85
+ sandboxId: batch.sandboxId,
86
+ }))),
87
+ cursor: items.findLast((batch) => batch.entryId)?.entryId ?? query.cursor,
88
+ }))),
89
+ logCount: (query) => Effect.flatMap(appId, (id) => ops.countLogs({
90
+ appId: id,
91
+ since: timestampOf(query.since),
92
+ until: timestampOf(query.until ?? Date.now()),
93
+ bucketSecs: query.bucketSecs,
94
+ ...filterOf(query),
95
+ })),
96
+ info: () => Effect.flatMap(appId, (id) => ops.info({ appId: id })),
97
+ lifecycle: () => Effect.flatMap(appId, (id) => ops.lifecycle({ appId: id })).pipe(Effect.map((response) => response.lifecycle)),
98
+ layout: () => Effect.flatMap(appId, (id) => ops.layout({ appId: id })).pipe(Effect.map(({ appLayout }) => ({
99
+ functionIds: stringMap(appLayout?.functionIds),
100
+ classIds: stringMap(appLayout?.classIds),
101
+ }))),
102
+ deployments: () => Effect.flatMap(appId, (id) => ops.deployments({ appId: id })),
103
+ };
104
+ }),
105
+ }));
106
+ //# sourceMappingURL=ReadAppHttp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadAppHttp.js","sources":["../src/ReadAppHttp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,4BAA4B,CAAC;AAClD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,OAAO,EAAsD,MAAM,cAAc,CAAC;AAE3F,MAAM,MAAM,GAAG;IACb,MAAM,EAAE,wBAAwB;IAChC,MAAM,EAAE,wBAAwB;IAChC,IAAI,EAAE,sBAAsB;CACpB,CAAC;AAEX,MAAM,QAAQ,GAAG,CAAC,EAAsB,EAAwB,EAAE,CAChE,EAAE,KAAK,MAAM,CAAC,MAAM;IAClB,CAAC,CAAC,QAAQ;IACV,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,MAAM;QACpB,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,IAAI;YAClB,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,SAAS,CAAC;AAEpB,MAAM,QAAQ,GAAG,CAAC,MAAoB,EAAE,EAAE,CAAC,CAAC;IAC1C,UAAU,EAAE,MAAM,CAAC,UAAU;IAC7B,cAAc,EAAE,MAAM,CAAC,cAAc;IACrC,MAAM,EAAE,MAAM,CAAC,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,UAAU,EAAE,MAAM,CAAC,MAAM;IACzB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,S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AAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAC9D,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAC7C;YACH,MAAM,EAAE,GAAG,EAAE,CACX,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAC3D,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC7B,WAAW,EAAE,SAAS,CAAC,SAAS,EAAE,WAAW,CAAC;gBAC9C,QAAQ,EAAE,SAAS,CAAC,SAAS,EAAE,QAAQ,CAAC;aACzC,CAAC,CAAC,CACJ;YACH,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;SAC7D,CAAC;IACxB,CAAC,CAAC;CACH,CAAC,CACH,CAAC"}
@@ -0,0 +1,39 @@
1
+ import * as Binding from "alchemy/Binding";
2
+ import type * as Effect from "effect/Effect";
3
+ import type { Dict } from "./Dict.ts";
4
+ import type { ReadDictClient } from "./DictClient.ts";
5
+ export type { ReadDictClient } from "./DictClient.ts";
6
+ /**
7
+ * Read a Modal Dict from any runtime: get, contains, len and entries. Keys and values are JSON.
8
+ *
9
+ * ### Bind a dict
10
+ * **Example:** From a Cloudflare Worker
11
+ * ```typescript
12
+ * import * as Cloudflare from "@alchemy.run/cloudflare";
13
+ * import * as Modal from "@alchemy.run/modal";
14
+ * import * as Effect from "effect/Effect";
15
+ * import * as HttpServerResponse from "effect/http/HttpServerResponse";
16
+ * import { Results } from "./Storage.ts";
17
+ *
18
+ * export default class Api extends Cloudflare.Worker<Api>()(
19
+ * "Api",
20
+ * { main: import.meta.url },
21
+ * Effect.gen(function* () {
22
+ * const dict = yield* Modal.ReadDict(Results);
23
+ * return {
24
+ * fetch: Effect.gen(function* () {
25
+ * const last = yield* dict.get("last-run");
26
+ * return yield* HttpServerResponse.json(last ?? null);
27
+ * }).pipe(Effect.orDie),
28
+ * };
29
+ * }).pipe(Effect.provide(Modal.ReadDictHttp)),
30
+ * ) {}
31
+ * ```
32
+ *
33
+ * @binding
34
+ * @product Dict
35
+ */
36
+ export interface ReadDict extends Binding.Service<ReadDict, "Modal.ReadDict", (dict: Dict) => Effect.Effect<ReadDictClient>> {
37
+ }
38
+ export declare const ReadDict: ReadDict;
39
+ //# sourceMappingURL=ReadDict.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadDict.d.ts","sources":["../src/ReadDict.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,QAAS,SAAQ,OAAO,CAAC,OAAO,CAC/C,QAAQ,EACR,gBAAgB,EAChB,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAC9C;CAAG;AAEJ,eAAO,MAAM,QAAQ,UAA8C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import * as Binding from "alchemy/Binding";
2
+ export const ReadDict = Binding.Service("Modal.ReadDict");
3
+ //# sourceMappingURL=ReadDict.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadDict.js","sources":["../src/ReadDict.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AA2C3C,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAW,gBAAgB,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import * as Layer from "effect/Layer";
2
+ import { ReadDict } from "./ReadDict.ts";
3
+ /**
4
+ * {@link ReadDict} over Modal's API. Grants the host's identity (a scoped
5
+ * `Modal.ServiceUser`) the `viewer` role on the dict's environment.
6
+ *
7
+ * @layer
8
+ * @product Dict
9
+ * @provides Modal.ReadDict
10
+ */
11
+ export declare const ReadDictHttp: Layer.Layer<ReadDict, never, never>;
12
+ //# sourceMappingURL=ReadDictHttp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadDictHttp.d.ts","sources":["../src/ReadDictHttp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,qCAWxB,CAAC"}
@@ -0,0 +1,23 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Layer from "effect/Layer";
3
+ import { makeModalBinding } from "./BindingHttp.js";
4
+ import { DictOps, makeReadDictClient } from "./DictClient.js";
5
+ import { ReadDict } from "./ReadDict.js";
6
+ /**
7
+ * {@link ReadDict} over Modal's API. Grants the host's identity (a scoped
8
+ * `Modal.ServiceUser`) the `viewer` role on the dict's environment.
9
+ *
10
+ * @layer
11
+ * @product Dict
12
+ * @provides Modal.ReadDict
13
+ */
14
+ export const ReadDictHttp = Layer.effect(ReadDict, makeModalBinding({
15
+ tag: "Modal.ReadDict",
16
+ operations: DictOps,
17
+ role: "viewer",
18
+ make: Effect.fn(function* (dict, ops) {
19
+ const dictId = yield* dict.dictId;
20
+ return makeReadDictClient(dictId, ops);
21
+ }),
22
+ }));
23
+ //# sourceMappingURL=ReadDictHttp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadDictHttp.js","sources":["../src/ReadDictHttp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CACtC,QAAQ,EACR,gBAAgB,CAAC;IACf,GAAG,EAAE,gBAAgB;IACrB,UAAU,EAAE,OAAO;IACnB,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAU,EAAE,GAAG;QACxC,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;QAClC,OAAO,kBAAkB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACzC,CAAC,CAAC;CACH,CAAC,CACH,CAAC"}
@@ -0,0 +1,73 @@
1
+ import type * as functions from "@distilled.cloud/modal/functions";
2
+ import * as Binding from "alchemy/Binding";
3
+ import type { RuntimeContext } from "alchemy/RuntimeContext";
4
+ import type * as Effect from "effect/Effect";
5
+ import type { FunctionLookupError } from "./FunctionTarget.ts";
6
+ import type { OpError } from "./internal.ts";
7
+ import type { FunctionTarget } from "./InvokeFunction.ts";
8
+ import type { ReadFunctionOps } from "./ReadFunctionHttp.ts";
9
+ import type { Server } from "./Server.ts";
10
+ /** A time range: `Date`s, ISO strings, or epoch milliseconds. */
11
+ export interface TimeRange {
12
+ readonly since: Date | string | number;
13
+ readonly until?: Date | string | number;
14
+ }
15
+ /** Observe a function: load, call counts and metrics. */
16
+ export interface FunctionReader {
17
+ /** Inputs waiting and running, and the containers serving them, right now. */
18
+ stats(): Effect.Effect<{
19
+ readonly backlog: number;
20
+ readonly runningInputs: number;
21
+ readonly containers: number;
22
+ readonly inputHeadroom: number;
23
+ }, FunctionLookupError | OpError<ReadFunctionOps, "currentStats">, RuntimeContext>;
24
+ /** Input outcomes, latency percentiles and container counts over a time range. */
25
+ timeRangeStats(range: TimeRange & {
26
+ readonly containerId?: string;
27
+ }): Effect.Effect<functions.FunctionGetTimeRangeStatsResponse, FunctionLookupError | OpError<ReadFunctionOps, "timeRangeStats">, RuntimeContext>;
28
+ /** Metric series (`containers`, `calls`) over a time range. */
29
+ metrics(range: TimeRange & {
30
+ /** Seconds per bucket. @default 3600 */
31
+ readonly bucketSecs?: number;
32
+ readonly groups?: ReadonlyArray<string>;
33
+ }): Effect.Effect<functions.FunctionGetMetricsResponse, FunctionLookupError | OpError<ReadFunctionOps, "metrics">, RuntimeContext>;
34
+ /** Calls started per time bucket. */
35
+ callCount(range: TimeRange & {
36
+ /** Seconds per bucket. @default 3600 */
37
+ readonly bucketSecs?: number;
38
+ }): Effect.Effect<functions.FunctionCallCountResponse, FunctionLookupError | OpError<ReadFunctionOps, "callCount">, RuntimeContext>;
39
+ /** The inputs of one call, by outcome. */
40
+ callInfo(call: {
41
+ readonly functionCallId: string;
42
+ }): Effect.Effect<functions.FunctionCallGetInfoResponse, FunctionLookupError | OpError<ReadFunctionOps, "callInfo">, RuntimeContext>;
43
+ /** The autoscaler settings in effect. */
44
+ autoscaler(): Effect.Effect<functions.AutoscalerSettings | undefined, FunctionLookupError | OpError<ReadFunctionOps, "schedulingParams">, RuntimeContext>;
45
+ }
46
+ /**
47
+ * Read a Modal Function's (or Server's) live state from any runtime:
48
+ * backlog and running inputs, call counts, outcome counts, latency
49
+ * percentiles and metric series. Bind a resource of the Stack, or a function
50
+ * deployed with `modal deploy` by name.
51
+ *
52
+ * ### Watch the backlog
53
+ * **Example:** Shed load when the queue is long
54
+ * ```typescript
55
+ * const embed = yield* Modal.ReadFunction(Embed);
56
+ * const { backlog } = yield* embed.stats();
57
+ * if (backlog > 100) return HttpServerResponse.text("busy", { status: 503 });
58
+ * ```
59
+ *
60
+ * ### History
61
+ * **Example:** Failures in the last hour
62
+ * ```typescript
63
+ * const stats = yield* embed.timeRangeStats({ since: new Date(Date.now() - 3_600_000) });
64
+ * yield* Effect.log(`${stats.inputFailureCount} failed of ${stats.inputSuccessCount}`);
65
+ * ```
66
+ *
67
+ * @binding
68
+ * @product Function
69
+ */
70
+ export interface ReadFunction extends Binding.Service<ReadFunction, "Modal.ReadFunction", (target: FunctionTarget | Server) => Effect.Effect<FunctionReader>> {
71
+ }
72
+ export declare const ReadFunction: ReadFunction;
73
+ //# sourceMappingURL=ReadFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadFunction.d.ts","sources":["../src/ReadFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,SAAS,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,iEAAiE;AACjE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IACvC,QAAQ,CAAC,KAAK,CAAC,EAA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IAC1C,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;KACjC,GAAG,MAAM,CAAC,MAAM,CACf,SAAS,CAAC,2BAA2B,EACrC,mBAAmB,GAAG,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC,EAC1D,cAAc,CACf,CAAC;IACF,yCAAyC;IACzC,UAAU,IAAI,MAAM,CAAC,MAAM,CACzB,SAAS,CAAC,kBAAkB,GAAG,SAAS,EACxC,mBAAmB,GAAG,OAAO,CAAC,eAAe,EAAE,kBAAkB,CAAC,EAClE,cAAc,CACf,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,YAAa,SAAQ,OAAO,CAAC,OAAO,CACnD,YAAY,EACZ,oBAAoB,EACpB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CACnE;CAAG;AAEJ,eAAO,MAAM,YAAY,cAAsD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import * as Binding from "alchemy/Binding";
2
+ export const ReadFunction = Binding.Service("Modal.ReadFunction");
3
+ //# sourceMappingURL=ReadFunction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadFunction.js","sources":["../src/ReadFunction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAyG3C,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAe,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import * as functions from "@distilled.cloud/modal/functions";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
+ import { ReadFunction } from "./ReadFunction.ts";
5
+ /** The operations the client calls, resolved by `ModalBindings.withCredentials`. */
6
+ declare const ReadFunctionOps: Effect.Effect<{
7
+ readonly currentStats: (input: functions.FunctionGetCurrentStatsRequest) => Effect.Effect<functions.FunctionGetCurrentStatsResponse, functions.FunctionGetCurrentStatsError, never>;
8
+ readonly timeRangeStats: (input: functions.FunctionGetTimeRangeStatsRequest) => Effect.Effect<functions.FunctionGetTimeRangeStatsResponse, functions.FunctionGetTimeRangeStatsError, never>;
9
+ readonly metrics: (input: functions.FunctionGetMetricsRequest) => Effect.Effect<functions.FunctionGetMetricsResponse, functions.ModalOpError, never>;
10
+ readonly callCount: (input: functions.FunctionCallCountRequest) => Effect.Effect<functions.FunctionCallCountResponse, functions.ModalOpError, never>;
11
+ readonly callInfo: (input: functions.FunctionCallGetInfoRequest) => Effect.Effect<functions.FunctionCallGetInfoResponse, functions.FunctionCallGetInfoError, never>;
12
+ readonly schedulingParams: (input: functions.FunctionGetSchedulingParamsRequest) => Effect.Effect<functions.FunctionGetSchedulingParamsResponse, functions.FunctionGetSchedulingParamsError, never>;
13
+ }, never, import("./internal.ts").OperationServices>;
14
+ export type ReadFunctionOps = Effect.Success<typeof ReadFunctionOps>;
15
+ /**
16
+ * {@link ReadFunction} over Modal's API. Grants the host's identity (a scoped
17
+ * `Modal.ServiceUser`) the `viewer` role on the function's environment.
18
+ *
19
+ * @layer
20
+ * @product Function
21
+ * @provides Modal.ReadFunction
22
+ */
23
+ export declare const ReadFunctionHttp: Layer.Layer<ReadFunction, never, never>;
24
+ export {};
25
+ //# sourceMappingURL=ReadFunctionHttp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadFunctionHttp.d.ts","sources":["../src/ReadFunctionHttp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,kCAAkC,CAAC;AAC9D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AAMtE,oFAAoF;AACpF,QAAA,MAAM,eAAe;;;;;;;oDAOnB,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,eAAe,CAAC,CAAC;AAErE;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,yCA0D5B,CAAC"}
@@ -0,0 +1,63 @@
1
+ import * as functions from "@distilled.cloud/modal/functions";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
+ import { makeFunctionBinding } from "./FunctionTarget.js";
5
+ import { operations, timestampOf } from "./internal.js";
6
+ import { ReadFunction } from "./ReadFunction.js";
7
+ /** Bucket width when a query doesn't set one: Modal requires a positive one. */
8
+ const DEFAULT_BUCKET_SECS = 3600;
9
+ /** The operations the client calls, resolved by `ModalBindings.withCredentials`. */
10
+ const ReadFunctionOps = operations({
11
+ currentStats: functions.functionGetCurrentStats,
12
+ timeRangeStats: functions.functionGetTimeRangeStats,
13
+ metrics: functions.functionGetMetrics,
14
+ callCount: functions.functionCallCount,
15
+ callInfo: functions.functionCallGetInfo,
16
+ schedulingParams: functions.functionGetSchedulingParams,
17
+ });
18
+ /**
19
+ * {@link ReadFunction} over Modal's API. Grants the host's identity (a scoped
20
+ * `Modal.ServiceUser`) the `viewer` role on the function's environment.
21
+ *
22
+ * @layer
23
+ * @product Function
24
+ * @provides Modal.ReadFunction
25
+ */
26
+ export const ReadFunctionHttp = Layer.effect(ReadFunction, makeFunctionBinding({
27
+ tag: "Modal.ReadFunction",
28
+ operations: ReadFunctionOps,
29
+ role: "viewer",
30
+ make: ({ functionId }, ops, _target) => Effect.succeed({
31
+ stats: () => Effect.flatMap(functionId, (id) => ops.currentStats({ functionId: id })).pipe(Effect.map((stats) => ({
32
+ backlog: stats.backlog ?? 0,
33
+ runningInputs: stats.numRunningInputs ?? 0,
34
+ containers: stats.numTotalTasks ?? 0,
35
+ inputHeadroom: stats.inputHeadroom ?? 0,
36
+ }))),
37
+ timeRangeStats: (range) => Effect.flatMap(functionId, (id) => ops.timeRangeStats({
38
+ functionId: id,
39
+ since: timestampOf(range.since),
40
+ until: timestampOf(range.until ?? Date.now()),
41
+ containerId: range.containerId,
42
+ })),
43
+ metrics: (range) => Effect.flatMap(functionId, (id) => ops.metrics({
44
+ functionId: id,
45
+ since: timestampOf(range.since),
46
+ until: timestampOf(range.until ?? Date.now()),
47
+ bucketSecs: range.bucketSecs ?? DEFAULT_BUCKET_SECS,
48
+ groups: range.groups ? [...range.groups] : undefined,
49
+ })),
50
+ callCount: (range) => Effect.flatMap(functionId, (id) => ops.callCount({
51
+ functionId: id,
52
+ since: timestampOf(range.since),
53
+ until: timestampOf(range.until ?? Date.now()),
54
+ bucketSecs: range.bucketSecs ?? DEFAULT_BUCKET_SECS,
55
+ })),
56
+ callInfo: (call) => Effect.flatMap(functionId, (id) => ops.callInfo({
57
+ functionId: id,
58
+ functionCallId: call.functionCallId,
59
+ })),
60
+ autoscaler: () => Effect.flatMap(functionId, (id) => ops.schedulingParams({ functionId: id })).pipe(Effect.map((response) => response.autoscalerConfiguration?.settings)),
61
+ }),
62
+ }));
63
+ //# sourceMappingURL=ReadFunctionHttp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadFunctionHttp.js","sources":["../src/ReadFunctionHttp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,kCAAkC,CAAC;AAC9D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AAGtE,gFAAgF;AAChF,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC,oFAAoF;AACpF,MAAM,eAAe,GAAG,UAAU,CAAC;IACjC,YAAY,EAAE,SAAS,CAAC,uBAAuB;IAC/C,cAAc,EAAE,SAAS,CAAC,yBAAyB;IACnD,OAAO,EAAE,SAAS,CAAC,kBAAkB;IACrC,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AE,CAAC,CAAC,CAAC,IAAI,CAC/E,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,uBAAuB,EAAE,QAAQ,CAAC,CACrE;KACqB,CAAC;CAC9B,CAAC,CACH,CAAC"}
@@ -0,0 +1,39 @@
1
+ import * as Binding from "alchemy/Binding";
2
+ import type * as Effect from "effect/Effect";
3
+ import type { Queue } from "./Queue.ts";
4
+ import type { ReadQueueClient } from "./QueueClient.ts";
5
+ export type { ReadQueueClient } from "./QueueClient.ts";
6
+ /**
7
+ * Take items from a Modal Queue from any runtime: take (removes), peek and len. Items are JSON.
8
+ *
9
+ * ### Bind a queue
10
+ * **Example:** From a Cloudflare Worker
11
+ * ```typescript
12
+ * import * as Cloudflare from "@alchemy.run/cloudflare";
13
+ * import * as Modal from "@alchemy.run/modal";
14
+ * import * as Effect from "effect/Effect";
15
+ * import * as HttpServerResponse from "effect/http/HttpServerResponse";
16
+ * import { Jobs } from "./Storage.ts";
17
+ *
18
+ * export default class Api extends Cloudflare.Worker<Api>()(
19
+ * "Api",
20
+ * { main: import.meta.url },
21
+ * Effect.gen(function* () {
22
+ * const queue = yield* Modal.ReadQueue(Jobs);
23
+ * return {
24
+ * fetch: Effect.gen(function* () {
25
+ * const [job] = yield* queue.take({ timeout: "5 seconds" });
26
+ * return yield* HttpServerResponse.json(job ?? null);
27
+ * }).pipe(Effect.orDie),
28
+ * };
29
+ * }).pipe(Effect.provide(Modal.ReadQueueHttp)),
30
+ * ) {}
31
+ * ```
32
+ *
33
+ * @binding
34
+ * @product Queue
35
+ */
36
+ export interface ReadQueue extends Binding.Service<ReadQueue, "Modal.ReadQueue", (queue: Queue) => Effect.Effect<ReadQueueClient>> {
37
+ }
38
+ export declare const ReadQueue: ReadQueue;
39
+ //# sourceMappingURL=ReadQueue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadQueue.d.ts","sources":["../src/ReadQueue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,SAAU,SAAQ,OAAO,CAAC,OAAO,CAChD,SAAS,EACT,iBAAiB,EACjB,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CACjD;CAAG;AAEJ,eAAO,MAAM,SAAS,WAAgD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import * as Binding from "alchemy/Binding";
2
+ export const ReadQueue = Binding.Service("Modal.ReadQueue");
3
+ //# sourceMappingURL=ReadQueue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadQueue.js","sources":["../src/ReadQueue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AA2C3C,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAY,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import * as Layer from "effect/Layer";
2
+ import { ReadQueue } from "./ReadQueue.ts";
3
+ /**
4
+ * {@link ReadQueue} over Modal's API. Grants the host's identity (a scoped
5
+ * `Modal.ServiceUser`) the `contributor` role on the queue's environment.
6
+ *
7
+ * @layer
8
+ * @product Queue
9
+ * @provides Modal.ReadQueue
10
+ */
11
+ export declare const ReadQueueHttp: Layer.Layer<ReadQueue, never, never>;
12
+ //# sourceMappingURL=ReadQueueHttp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadQueueHttp.d.ts","sources":["../src/ReadQueueHttp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,sCAWzB,CAAC"}
@@ -0,0 +1,23 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Layer from "effect/Layer";
3
+ import { makeModalBinding } from "./BindingHttp.js";
4
+ import { QueueOps, makeReadQueueClient } from "./QueueClient.js";
5
+ import { ReadQueue } from "./ReadQueue.js";
6
+ /**
7
+ * {@link ReadQueue} over Modal's API. Grants the host's identity (a scoped
8
+ * `Modal.ServiceUser`) the `contributor` role on the queue's environment.
9
+ *
10
+ * @layer
11
+ * @product Queue
12
+ * @provides Modal.ReadQueue
13
+ */
14
+ export const ReadQueueHttp = Layer.effect(ReadQueue, makeModalBinding({
15
+ tag: "Modal.ReadQueue",
16
+ operations: QueueOps,
17
+ role: "contributor",
18
+ make: Effect.fn(function* (queue, ops) {
19
+ const queueId = yield* queue.queueId;
20
+ return makeReadQueueClient(queueId, ops);
21
+ }),
22
+ }));
23
+ //# sourceMappingURL=ReadQueueHttp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadQueueHttp.js","sources":["../src/ReadQueueHttp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CACvC,SAAS,EACT,gBAAgB,CAAC;IACf,GAAG,EAAE,iBAAiB;IACtB,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAY,EAAE,GAAG;QAC1C,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;QACrC,OAAO,mBAAmB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC3C,CAAC,CAAC;CACH,CAAC,CACH,CAAC"}
@@ -0,0 +1,72 @@
1
+ import type * as server from "@distilled.cloud/modal/server";
2
+ import * as Binding from "alchemy/Binding";
3
+ import type { RuntimeContext } from "alchemy/RuntimeContext";
4
+ import type * as Effect from "effect/Effect";
5
+ import type { FunctionLookupError } from "./FunctionTarget.ts";
6
+ import type { OpError } from "./internal.ts";
7
+ import type { TimeRange } from "./ReadFunction.ts";
8
+ import type { ReadServerOps } from "./ReadServerHttp.ts";
9
+ import type { Server } from "./Server.ts";
10
+ /** One request a Server handled. */
11
+ export interface ServerRequest {
12
+ readonly route: string | undefined;
13
+ readonly timestamp: string | undefined;
14
+ readonly containerId: string | undefined;
15
+ readonly durationSeconds: number | undefined;
16
+ readonly status: number | undefined;
17
+ }
18
+ /** A container serving a Server's requests. */
19
+ export interface ServerContainer {
20
+ readonly containerId: string;
21
+ readonly host: string | undefined;
22
+ readonly port: number | undefined;
23
+ }
24
+ /** Observe a Server: requests, status codes, latency and containers. */
25
+ export interface ServerReader {
26
+ /** Request counts by status code, latency percentiles and inference stats over a time range. */
27
+ stats(range: TimeRange & {
28
+ readonly containerId?: string;
29
+ }): Effect.Effect<server.ServerGetTimeRangeStatsResponse, FunctionLookupError | OpError<ReadServerOps, "stats">, RuntimeContext>;
30
+ /**
31
+ * Requests the Server handled: the most recent `limit` (newest first, last
32
+ * seven days), or those in a time range (oldest first).
33
+ */
34
+ requests(query: {
35
+ readonly limit: number;
36
+ } | TimeRange): Effect.Effect<ReadonlyArray<ServerRequest>, FunctionLookupError | OpError<ReadServerOps, "requests">, RuntimeContext>;
37
+ /** Requests per time bucket. */
38
+ requestCount(range: TimeRange & {
39
+ readonly bucketSecs?: number;
40
+ }): Effect.Effect<server.ServerCountRequestsResponse, FunctionLookupError | OpError<ReadServerOps, "requestCount">, RuntimeContext>;
41
+ /** Metric series (`containers`, `requests`) over a time range. */
42
+ metrics(range: TimeRange & {
43
+ readonly bucketSecs?: number;
44
+ readonly groups?: ReadonlyArray<string>;
45
+ }): Effect.Effect<server.ServerGetMetricsResponse, FunctionLookupError | OpError<ReadServerOps, "metrics">, RuntimeContext>;
46
+ /** Containers registered to serve requests right now. */
47
+ containers(): Effect.Effect<ReadonlyArray<ServerContainer>, FunctionLookupError | OpError<ReadServerOps, "containers">, RuntimeContext>;
48
+ }
49
+ /**
50
+ * Read a `Modal.Server`'s traffic from any runtime: request log, status
51
+ * codes, latency percentiles, metric series and live containers.
52
+ *
53
+ * ### Error rate
54
+ * **Example:** 5xx responses in the last ten minutes
55
+ * ```typescript
56
+ * const api = yield* Modal.ReadServer(Api);
57
+ * const stats = yield* api.stats({ since: new Date(Date.now() - 600_000) });
58
+ * ```
59
+ *
60
+ * ### Recent requests
61
+ * **Example:** The last 20 requests
62
+ * ```typescript
63
+ * const recent = yield* api.requests({ limit: 20 });
64
+ * ```
65
+ *
66
+ * @binding
67
+ * @product Server
68
+ */
69
+ export interface ReadServer extends Binding.Service<ReadServer, "Modal.ReadServer", (server: Server) => Effect.Effect<ServerReader>> {
70
+ }
71
+ export declare const ReadServer: ReadServer;
72
+ //# sourceMappingURL=ReadServer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadServer.d.ts","sources":["../src/ReadServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAA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AAG,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,EACxD,cAAc,CACf,CAAC;IACF,gCAAgC;IAChC,YAAY,CACV,KAAK,EAAE,SAAS,GAAG;QAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAClD,MAAM,CAAC,MAAM,CACd,MAAM,CAAC,2BAA2B,EAClC,mBAAmB,GAAG,OAAO,CAAC,aAAa,EAAE,cAAc,CAAC,EAC5D,cAAc,CACf,CAAC;IACF,kEAAkE;IAClE,OAAO,CACL,KAAK,EAAE,SAAS,GAAG;QAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;KAAE,GAC3F,MAAM,CAAC,MAAM,CACd,MAAM,CAAC,wBAAwB,EAC/B,mBAAmB,GAAG,OAAO,CAAC,aAAa,EAAE,SAAS,CAAC,EACvD,cAAc,CACf,CAAC;IACF,yDAAyD;IACzD,UAAU,IAAI,MAAM,CAAC,MAAM,CACzB,aAAa,CAAC,eAAe,CAAC,EAC9B,mBAAmB,GAAG,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,EAC1D,cAAc,CACf,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,UAAW,SAAQ,OAAO,CAAC,OAAO,CACjD,UAAU,EACV,kBAAkB,EAClB,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAChD;CAAG;AAEJ,eAAO,MAAM,UAAU,YAAkD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import * as Binding from "alchemy/Binding";
2
+ export const ReadServer = Binding.Service("Modal.ReadServer");
3
+ //# sourceMappingURL=ReadServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadServer.js","sources":["../src/ReadServer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAgG3C,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAa,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import * as flash from "@distilled.cloud/modal/flash";
2
+ import * as server from "@distilled.cloud/modal/server";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Layer from "effect/Layer";
5
+ import { ReadServer } from "./ReadServer.ts";
6
+ /** The operations the client calls, resolved by `ModalBindings.withCredentials`. */
7
+ declare const ReadServerOps: Effect.Effect<{
8
+ readonly stats: (input: server.ServerGetTimeRangeStatsRequest) => Effect.Effect<server.ServerGetTimeRangeStatsResponse, server.ServerGetTimeRangeStatsError, never>;
9
+ readonly requests: (input: server.FetchServerRequestRequest) => Effect.Effect<server.FetchServerRequestResponse, server.FetchServerRequestError, never>;
10
+ readonly requestCount: (input: server.ServerCountRequestsRequest) => Effect.Effect<server.ServerCountRequestsResponse, flash.ModalOpError, never>;
11
+ readonly metrics: (input: server.ServerGetMetricsRequest) => Effect.Effect<server.ServerGetMetricsResponse, flash.ModalOpError, never>;
12
+ readonly containers: (input: flash.ListFlashContainerRequest) => Effect.Effect<flash.ListFlashContainerResponse, flash.ModalOpError, never>;
13
+ }, never, import("./internal.ts").OperationServices>;
14
+ export type ReadServerOps = Effect.Success<typeof ReadServerOps>;
15
+ /**
16
+ * {@link ReadServer} over Modal's API. Grants the host's identity (a scoped
17
+ * `Modal.ServiceUser`) the `viewer` role on the server's environment.
18
+ *
19
+ * @layer
20
+ * @product Server
21
+ * @provides Modal.ReadServer
22
+ */
23
+ export declare const ReadServerHttp: Layer.Layer<ReadServer, never, never>;
24
+ export {};
25
+ //# sourceMappingURL=ReadServerHttp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadServerHttp.d.ts","sources":["../src/ReadServerHttp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,8BAA8B,CAAC;AACtD,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AACxD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAqB,MAAM,iBAAiB,CAAC;AAGhE,oFAAoF;AACpF,QAAA,MAAM,aAAa;;;;;;oDAMjB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,aAAa,CAAC,CAAC;AAEjE;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,uCAwE1B,CAAC"}