@alchemy.run/fly 0.0.0 → 2.0.0-beta.85

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 +57 -4
  3. package/lib/App.d.ts +230 -0
  4. package/lib/App.d.ts.map +1 -0
  5. package/lib/App.js +338 -0
  6. package/lib/App.js.map +1 -0
  7. package/lib/AuthProvider.d.ts +22 -0
  8. package/lib/AuthProvider.d.ts.map +1 -0
  9. package/lib/AuthProvider.js +48 -0
  10. package/lib/AuthProvider.js.map +1 -0
  11. package/lib/BindService.d.ts +159 -0
  12. package/lib/BindService.d.ts.map +1 -0
  13. package/lib/BindService.js +222 -0
  14. package/lib/BindService.js.map +1 -0
  15. package/lib/Bootstrap.d.ts +8 -0
  16. package/lib/Bootstrap.d.ts.map +1 -0
  17. package/lib/Bootstrap.js +41 -0
  18. package/lib/Bootstrap.js.map +1 -0
  19. package/lib/Bucket.d.ts +278 -0
  20. package/lib/Bucket.d.ts.map +1 -0
  21. package/lib/Bucket.js +658 -0
  22. package/lib/Bucket.js.map +1 -0
  23. package/lib/BucketBinding.d.ts +33 -0
  24. package/lib/BucketBinding.d.ts.map +1 -0
  25. package/lib/BucketBinding.js +70 -0
  26. package/lib/BucketBinding.js.map +1 -0
  27. package/lib/Catalog.d.ts +28 -0
  28. package/lib/Catalog.d.ts.map +1 -0
  29. package/lib/Catalog.js +31 -0
  30. package/lib/Catalog.js.map +1 -0
  31. package/lib/Certificate.d.ts +189 -0
  32. package/lib/Certificate.d.ts.map +1 -0
  33. package/lib/Certificate.js +380 -0
  34. package/lib/Certificate.js.map +1 -0
  35. package/lib/Checkpoint.d.ts +55 -0
  36. package/lib/Checkpoint.d.ts.map +1 -0
  37. package/lib/Checkpoint.js +3 -0
  38. package/lib/Checkpoint.js.map +1 -0
  39. package/lib/CheckpointHttp.d.ts +22 -0
  40. package/lib/CheckpointHttp.d.ts.map +1 -0
  41. package/lib/CheckpointHttp.js +53 -0
  42. package/lib/CheckpointHttp.js.map +1 -0
  43. package/lib/ConnectPostgres.d.ts +58 -0
  44. package/lib/ConnectPostgres.d.ts.map +1 -0
  45. package/lib/ConnectPostgres.js +13 -0
  46. package/lib/ConnectPostgres.js.map +1 -0
  47. package/lib/ConnectPostgresHttp.d.ts +26 -0
  48. package/lib/ConnectPostgresHttp.d.ts.map +1 -0
  49. package/lib/ConnectPostgresHttp.js +57 -0
  50. package/lib/ConnectPostgresHttp.js.map +1 -0
  51. package/lib/Contributions.d.ts +7 -0
  52. package/lib/Contributions.d.ts.map +1 -0
  53. package/lib/Contributions.js +6 -0
  54. package/lib/Contributions.js.map +1 -0
  55. package/lib/Credentials.d.ts +33 -0
  56. package/lib/Credentials.d.ts.map +1 -0
  57. package/lib/Credentials.js +55 -0
  58. package/lib/Credentials.js.map +1 -0
  59. package/lib/Decrypt.d.ts +52 -0
  60. package/lib/Decrypt.d.ts.map +1 -0
  61. package/lib/Decrypt.js +3 -0
  62. package/lib/Decrypt.js.map +1 -0
  63. package/lib/DecryptHttp.d.ts +22 -0
  64. package/lib/DecryptHttp.d.ts.map +1 -0
  65. package/lib/DecryptHttp.js +43 -0
  66. package/lib/DecryptHttp.js.map +1 -0
  67. package/lib/DeleteObject.d.ts +29 -0
  68. package/lib/DeleteObject.d.ts.map +1 -0
  69. package/lib/DeleteObject.js +3 -0
  70. package/lib/DeleteObject.js.map +1 -0
  71. package/lib/DeleteObjectHttp.d.ts +12 -0
  72. package/lib/DeleteObjectHttp.d.ts.map +1 -0
  73. package/lib/DeleteObjectHttp.js +17 -0
  74. package/lib/DeleteObjectHttp.js.map +1 -0
  75. package/lib/Deployment.d.ts +51 -0
  76. package/lib/Deployment.d.ts.map +1 -0
  77. package/lib/Deployment.js +62 -0
  78. package/lib/Deployment.js.map +1 -0
  79. package/lib/DeploymentImages.d.ts +18 -0
  80. package/lib/DeploymentImages.d.ts.map +1 -0
  81. package/lib/DeploymentImages.js +61 -0
  82. package/lib/DeploymentImages.js.map +1 -0
  83. package/lib/DeploymentState.d.ts +17 -0
  84. package/lib/DeploymentState.d.ts.map +1 -0
  85. package/lib/DeploymentState.js +87 -0
  86. package/lib/DeploymentState.js.map +1 -0
  87. package/lib/Encrypt.d.ts +50 -0
  88. package/lib/Encrypt.d.ts.map +1 -0
  89. package/lib/Encrypt.js +3 -0
  90. package/lib/Encrypt.js.map +1 -0
  91. package/lib/EncryptHttp.d.ts +22 -0
  92. package/lib/EncryptHttp.d.ts.map +1 -0
  93. package/lib/EncryptHttp.js +39 -0
  94. package/lib/EncryptHttp.js.map +1 -0
  95. package/lib/Environment.d.ts +45 -0
  96. package/lib/Environment.d.ts.map +1 -0
  97. package/lib/Environment.js +43 -0
  98. package/lib/Environment.js.map +1 -0
  99. package/lib/Errors.d.ts +18 -0
  100. package/lib/Errors.d.ts.map +1 -0
  101. package/lib/Errors.js +13 -0
  102. package/lib/Errors.js.map +1 -0
  103. package/lib/Exec.d.ts +41 -0
  104. package/lib/Exec.d.ts.map +1 -0
  105. package/lib/Exec.js +3 -0
  106. package/lib/Exec.js.map +1 -0
  107. package/lib/ExecHttp.d.ts +22 -0
  108. package/lib/ExecHttp.d.ts.map +1 -0
  109. package/lib/ExecHttp.js +39 -0
  110. package/lib/ExecHttp.js.map +1 -0
  111. package/lib/GetObject.d.ts +34 -0
  112. package/lib/GetObject.d.ts.map +1 -0
  113. package/lib/GetObject.js +3 -0
  114. package/lib/GetObject.js.map +1 -0
  115. package/lib/GetObjectHttp.d.ts +12 -0
  116. package/lib/GetObjectHttp.d.ts.map +1 -0
  117. package/lib/GetObjectHttp.js +17 -0
  118. package/lib/GetObjectHttp.js.map +1 -0
  119. package/lib/GetSecret.d.ts +44 -0
  120. package/lib/GetSecret.d.ts.map +1 -0
  121. package/lib/GetSecret.js +3 -0
  122. package/lib/GetSecret.js.map +1 -0
  123. package/lib/GetSecretHttp.d.ts +22 -0
  124. package/lib/GetSecretHttp.d.ts.map +1 -0
  125. package/lib/GetSecretHttp.js +50 -0
  126. package/lib/GetSecretHttp.js.map +1 -0
  127. package/lib/HeadObject.d.ts +29 -0
  128. package/lib/HeadObject.d.ts.map +1 -0
  129. package/lib/HeadObject.js +3 -0
  130. package/lib/HeadObject.js.map +1 -0
  131. package/lib/HeadObjectHttp.d.ts +12 -0
  132. package/lib/HeadObjectHttp.d.ts.map +1 -0
  133. package/lib/HeadObjectHttp.js +17 -0
  134. package/lib/HeadObjectHttp.js.map +1 -0
  135. package/lib/IpAssignment.d.ts +258 -0
  136. package/lib/IpAssignment.d.ts.map +1 -0
  137. package/lib/IpAssignment.js +376 -0
  138. package/lib/IpAssignment.js.map +1 -0
  139. package/lib/ListObjectsV2.d.ts +29 -0
  140. package/lib/ListObjectsV2.d.ts.map +1 -0
  141. package/lib/ListObjectsV2.js +3 -0
  142. package/lib/ListObjectsV2.js.map +1 -0
  143. package/lib/ListObjectsV2Http.d.ts +12 -0
  144. package/lib/ListObjectsV2Http.d.ts.map +1 -0
  145. package/lib/ListObjectsV2Http.js +17 -0
  146. package/lib/ListObjectsV2Http.js.map +1 -0
  147. package/lib/ListSecrets.d.ts +53 -0
  148. package/lib/ListSecrets.d.ts.map +1 -0
  149. package/lib/ListSecrets.js +3 -0
  150. package/lib/ListSecrets.js.map +1 -0
  151. package/lib/ListSecretsHttp.d.ts +22 -0
  152. package/lib/ListSecretsHttp.d.ts.map +1 -0
  153. package/lib/ListSecretsHttp.js +35 -0
  154. package/lib/ListSecretsHttp.js.map +1 -0
  155. package/lib/Machine.d.ts +802 -0
  156. package/lib/Machine.d.ts.map +1 -0
  157. package/lib/Machine.js +773 -0
  158. package/lib/Machine.js.map +1 -0
  159. package/lib/MachineContainers.d.ts +44 -0
  160. package/lib/MachineContainers.d.ts.map +1 -0
  161. package/lib/MachineContainers.js +115 -0
  162. package/lib/MachineContainers.js.map +1 -0
  163. package/lib/Metadata.d.ts +109 -0
  164. package/lib/Metadata.d.ts.map +1 -0
  165. package/lib/Metadata.js +159 -0
  166. package/lib/Metadata.js.map +1 -0
  167. package/lib/MountVolume.d.ts +295 -0
  168. package/lib/MountVolume.d.ts.map +1 -0
  169. package/lib/MountVolume.js +20 -0
  170. package/lib/MountVolume.js.map +1 -0
  171. package/lib/Postgres.d.ts +298 -0
  172. package/lib/Postgres.d.ts.map +1 -0
  173. package/lib/Postgres.js +508 -0
  174. package/lib/Postgres.js.map +1 -0
  175. package/lib/PostgresMigrations.d.ts +20 -0
  176. package/lib/PostgresMigrations.d.ts.map +1 -0
  177. package/lib/PostgresMigrations.js +58 -0
  178. package/lib/PostgresMigrations.js.map +1 -0
  179. package/lib/Providers.d.ts +38 -0
  180. package/lib/Providers.d.ts.map +1 -0
  181. package/lib/Providers.js +95 -0
  182. package/lib/Providers.js.map +1 -0
  183. package/lib/PutObject.d.ts +35 -0
  184. package/lib/PutObject.d.ts.map +1 -0
  185. package/lib/PutObject.js +3 -0
  186. package/lib/PutObject.js.map +1 -0
  187. package/lib/PutObjectHttp.d.ts +12 -0
  188. package/lib/PutObjectHttp.d.ts.map +1 -0
  189. package/lib/PutObjectHttp.js +17 -0
  190. package/lib/PutObjectHttp.js.map +1 -0
  191. package/lib/ReadRedis.d.ts +26 -0
  192. package/lib/ReadRedis.d.ts.map +1 -0
  193. package/lib/ReadRedis.js +3 -0
  194. package/lib/ReadRedis.js.map +1 -0
  195. package/lib/ReadRedisHttp.d.ts +11 -0
  196. package/lib/ReadRedisHttp.d.ts.map +1 -0
  197. package/lib/ReadRedisHttp.js +15 -0
  198. package/lib/ReadRedisHttp.js.map +1 -0
  199. package/lib/ReadWriteRedis.d.ts +29 -0
  200. package/lib/ReadWriteRedis.d.ts.map +1 -0
  201. package/lib/ReadWriteRedis.js +3 -0
  202. package/lib/ReadWriteRedis.js.map +1 -0
  203. package/lib/ReadWriteRedisHttp.d.ts +11 -0
  204. package/lib/ReadWriteRedisHttp.d.ts.map +1 -0
  205. package/lib/ReadWriteRedisHttp.js +15 -0
  206. package/lib/ReadWriteRedisHttp.js.map +1 -0
  207. package/lib/Redis.d.ts +252 -0
  208. package/lib/Redis.d.ts.map +1 -0
  209. package/lib/Redis.js +611 -0
  210. package/lib/Redis.js.map +1 -0
  211. package/lib/RedisBinding.d.ts +7 -0
  212. package/lib/RedisBinding.d.ts.map +1 -0
  213. package/lib/RedisBinding.js +53 -0
  214. package/lib/RedisBinding.js.map +1 -0
  215. package/lib/RedisHttp.d.ts +8 -0
  216. package/lib/RedisHttp.d.ts.map +1 -0
  217. package/lib/RedisHttp.js +11 -0
  218. package/lib/RedisHttp.js.map +1 -0
  219. package/lib/Region.d.ts +16 -0
  220. package/lib/Region.d.ts.map +1 -0
  221. package/lib/Region.js +13 -0
  222. package/lib/Region.js.map +1 -0
  223. package/lib/Secret.d.ts +190 -0
  224. package/lib/Secret.d.ts.map +1 -0
  225. package/lib/Secret.js +310 -0
  226. package/lib/Secret.js.map +1 -0
  227. package/lib/SecretHttp.d.ts +54 -0
  228. package/lib/SecretHttp.d.ts.map +1 -0
  229. package/lib/SecretHttp.js +66 -0
  230. package/lib/SecretHttp.js.map +1 -0
  231. package/lib/SecretKey.d.ts +164 -0
  232. package/lib/SecretKey.d.ts.map +1 -0
  233. package/lib/SecretKey.js +277 -0
  234. package/lib/SecretKey.js.map +1 -0
  235. package/lib/SecretKeyHttp.d.ts +14 -0
  236. package/lib/SecretKeyHttp.d.ts.map +1 -0
  237. package/lib/SecretKeyHttp.js +5 -0
  238. package/lib/SecretKeyHttp.js.map +1 -0
  239. package/lib/Service.d.ts +1017 -0
  240. package/lib/Service.d.ts.map +1 -0
  241. package/lib/Service.js +1430 -0
  242. package/lib/Service.js.map +1 -0
  243. package/lib/Sign.d.ts +36 -0
  244. package/lib/Sign.d.ts.map +1 -0
  245. package/lib/Sign.js +3 -0
  246. package/lib/Sign.js.map +1 -0
  247. package/lib/SignHttp.d.ts +22 -0
  248. package/lib/SignHttp.d.ts.map +1 -0
  249. package/lib/SignHttp.js +36 -0
  250. package/lib/SignHttp.js.map +1 -0
  251. package/lib/Sprite.d.ts +283 -0
  252. package/lib/Sprite.d.ts.map +1 -0
  253. package/lib/Sprite.js +471 -0
  254. package/lib/Sprite.js.map +1 -0
  255. package/lib/SpriteHttp.d.ts +25 -0
  256. package/lib/SpriteHttp.d.ts.map +1 -0
  257. package/lib/SpriteHttp.js +33 -0
  258. package/lib/SpriteHttp.js.map +1 -0
  259. package/lib/Verify.d.ts +37 -0
  260. package/lib/Verify.d.ts.map +1 -0
  261. package/lib/Verify.js +3 -0
  262. package/lib/Verify.js.map +1 -0
  263. package/lib/VerifyHttp.d.ts +22 -0
  264. package/lib/VerifyHttp.d.ts.map +1 -0
  265. package/lib/VerifyHttp.js +38 -0
  266. package/lib/VerifyHttp.js.map +1 -0
  267. package/lib/Volume.d.ts +53 -0
  268. package/lib/Volume.d.ts.map +1 -0
  269. package/lib/Volume.js +188 -0
  270. package/lib/Volume.js.map +1 -0
  271. package/lib/VolumeSnapshot.d.ts +135 -0
  272. package/lib/VolumeSnapshot.d.ts.map +1 -0
  273. package/lib/VolumeSnapshot.js +213 -0
  274. package/lib/VolumeSnapshot.js.map +1 -0
  275. package/lib/Website/AssetDeployment.d.ts +43 -0
  276. package/lib/Website/AssetDeployment.d.ts.map +1 -0
  277. package/lib/Website/AssetDeployment.js +162 -0
  278. package/lib/Website/AssetDeployment.js.map +1 -0
  279. package/lib/Website/Astro.d.ts +89 -0
  280. package/lib/Website/Astro.d.ts.map +1 -0
  281. package/lib/Website/Astro.js +54 -0
  282. package/lib/Website/Astro.js.map +1 -0
  283. package/lib/Website/Foldkit.d.ts +52 -0
  284. package/lib/Website/Foldkit.d.ts.map +1 -0
  285. package/lib/Website/Foldkit.js +45 -0
  286. package/lib/Website/Foldkit.js.map +1 -0
  287. package/lib/Website/FrameworkSite.d.ts +212 -0
  288. package/lib/Website/FrameworkSite.d.ts.map +1 -0
  289. package/lib/Website/FrameworkSite.js +205 -0
  290. package/lib/Website/FrameworkSite.js.map +1 -0
  291. package/lib/Website/Nextjs.d.ts +54 -0
  292. package/lib/Website/Nextjs.d.ts.map +1 -0
  293. package/lib/Website/Nextjs.js +46 -0
  294. package/lib/Website/Nextjs.js.map +1 -0
  295. package/lib/Website/Nuxt.d.ts +51 -0
  296. package/lib/Website/Nuxt.d.ts.map +1 -0
  297. package/lib/Website/Nuxt.js +36 -0
  298. package/lib/Website/Nuxt.js.map +1 -0
  299. package/lib/Website/Octane.d.ts +49 -0
  300. package/lib/Website/Octane.d.ts.map +1 -0
  301. package/lib/Website/Octane.js +39 -0
  302. package/lib/Website/Octane.js.map +1 -0
  303. package/lib/Website/ReactRouter.d.ts +80 -0
  304. package/lib/Website/ReactRouter.d.ts.map +1 -0
  305. package/lib/Website/ReactRouter.js +70 -0
  306. package/lib/Website/ReactRouter.js.map +1 -0
  307. package/lib/Website/SolidStart.d.ts +93 -0
  308. package/lib/Website/SolidStart.d.ts.map +1 -0
  309. package/lib/Website/SolidStart.js +71 -0
  310. package/lib/Website/SolidStart.js.map +1 -0
  311. package/lib/Website/StaticSite.d.ts +162 -0
  312. package/lib/Website/StaticSite.d.ts.map +1 -0
  313. package/lib/Website/StaticSite.js +180 -0
  314. package/lib/Website/StaticSite.js.map +1 -0
  315. package/lib/Website/SvelteKit.d.ts +52 -0
  316. package/lib/Website/SvelteKit.d.ts.map +1 -0
  317. package/lib/Website/SvelteKit.js +37 -0
  318. package/lib/Website/SvelteKit.js.map +1 -0
  319. package/lib/Website/TanStackStart.d.ts +76 -0
  320. package/lib/Website/TanStackStart.d.ts.map +1 -0
  321. package/lib/Website/TanStackStart.js +66 -0
  322. package/lib/Website/TanStackStart.js.map +1 -0
  323. package/lib/Website/Vinext.d.ts +73 -0
  324. package/lib/Website/Vinext.d.ts.map +1 -0
  325. package/lib/Website/Vinext.js +67 -0
  326. package/lib/Website/Vinext.js.map +1 -0
  327. package/lib/Website/Vite.d.ts +112 -0
  328. package/lib/Website/Vite.d.ts.map +1 -0
  329. package/lib/Website/Vite.js +100 -0
  330. package/lib/Website/Vite.js.map +1 -0
  331. package/lib/Website/Vocs.d.ts +52 -0
  332. package/lib/Website/Vocs.d.ts.map +1 -0
  333. package/lib/Website/Vocs.js +38 -0
  334. package/lib/Website/Vocs.js.map +1 -0
  335. package/lib/Website/Waku.d.ts +64 -0
  336. package/lib/Website/Waku.d.ts.map +1 -0
  337. package/lib/Website/Waku.js +39 -0
  338. package/lib/Website/Waku.js.map +1 -0
  339. package/lib/Website/index.d.ts +17 -0
  340. package/lib/Website/index.d.ts.map +1 -0
  341. package/lib/Website/index.js +17 -0
  342. package/lib/Website/index.js.map +1 -0
  343. package/lib/WriteCertificates.d.ts +63 -0
  344. package/lib/WriteCertificates.d.ts.map +1 -0
  345. package/lib/WriteCertificates.js +3 -0
  346. package/lib/WriteCertificates.js.map +1 -0
  347. package/lib/WriteCertificatesHttp.d.ts +25 -0
  348. package/lib/WriteCertificatesHttp.d.ts.map +1 -0
  349. package/lib/WriteCertificatesHttp.js +67 -0
  350. package/lib/WriteCertificatesHttp.js.map +1 -0
  351. package/lib/WriteRedis.d.ts +26 -0
  352. package/lib/WriteRedis.d.ts.map +1 -0
  353. package/lib/WriteRedis.js +3 -0
  354. package/lib/WriteRedis.js.map +1 -0
  355. package/lib/WriteRedisHttp.d.ts +11 -0
  356. package/lib/WriteRedisHttp.d.ts.map +1 -0
  357. package/lib/WriteRedisHttp.js +15 -0
  358. package/lib/WriteRedisHttp.js.map +1 -0
  359. package/lib/WriteSecret.d.ts +68 -0
  360. package/lib/WriteSecret.d.ts.map +1 -0
  361. package/lib/WriteSecret.js +4 -0
  362. package/lib/WriteSecret.js.map +1 -0
  363. package/lib/WriteSecretHttp.d.ts +26 -0
  364. package/lib/WriteSecretHttp.d.ts.map +1 -0
  365. package/lib/WriteSecretHttp.js +54 -0
  366. package/lib/WriteSecretHttp.js.map +1 -0
  367. package/lib/bluegreen.d.ts +36 -0
  368. package/lib/bluegreen.d.ts.map +1 -0
  369. package/lib/bluegreen.js +460 -0
  370. package/lib/bluegreen.js.map +1 -0
  371. package/lib/hosted.d.ts +171 -0
  372. package/lib/hosted.d.ts.map +1 -0
  373. package/lib/hosted.js +458 -0
  374. package/lib/hosted.js.map +1 -0
  375. package/lib/index.d.ts +65 -0
  376. package/lib/index.d.ts.map +1 -0
  377. package/lib/index.js +63 -0
  378. package/lib/index.js.map +1 -0
  379. package/lib/internal/RemoteBuilder.d.ts +28 -0
  380. package/lib/internal/RemoteBuilder.d.ts.map +1 -0
  381. package/lib/internal/RemoteBuilder.js +158 -0
  382. package/lib/internal/RemoteBuilder.js.map +1 -0
  383. package/lib/leases.d.ts +53 -0
  384. package/lib/leases.d.ts.map +1 -0
  385. package/lib/leases.js +279 -0
  386. package/lib/leases.js.map +1 -0
  387. package/lib/ports.d.ts +51 -0
  388. package/lib/ports.d.ts.map +1 -0
  389. package/lib/ports.js +123 -0
  390. package/lib/ports.js.map +1 -0
  391. package/lib/replicas.d.ts +270 -0
  392. package/lib/replicas.d.ts.map +1 -0
  393. package/lib/replicas.js +969 -0
  394. package/lib/replicas.js.map +1 -0
  395. package/lib/rpc.d.ts +35 -0
  396. package/lib/rpc.d.ts.map +1 -0
  397. package/lib/rpc.js +113 -0
  398. package/lib/rpc.js.map +1 -0
  399. package/package.json +83 -3
  400. package/src/App.ts +514 -0
  401. package/src/AuthProvider.ts +68 -0
  402. package/src/BindService.ts +303 -0
  403. package/src/Bootstrap.ts +66 -0
  404. package/src/Bucket.ts +918 -0
  405. package/src/BucketBinding.ts +128 -0
  406. package/src/Catalog.ts +43 -0
  407. package/src/Certificate.ts +548 -0
  408. package/src/Checkpoint.ts +69 -0
  409. package/src/CheckpointHttp.ts +66 -0
  410. package/src/ConnectPostgres.ts +68 -0
  411. package/src/ConnectPostgresHttp.ts +77 -0
  412. package/src/Contributions.ts +9 -0
  413. package/src/Credentials.ts +75 -0
  414. package/src/Decrypt.ts +62 -0
  415. package/src/DecryptHttp.ts +52 -0
  416. package/src/DeleteObject.ts +43 -0
  417. package/src/DeleteObjectHttp.ts +20 -0
  418. package/src/Deployment.ts +121 -0
  419. package/src/DeploymentImages.ts +84 -0
  420. package/src/DeploymentState.ts +104 -0
  421. package/src/Encrypt.ts +60 -0
  422. package/src/EncryptHttp.ts +48 -0
  423. package/src/Environment.ts +81 -0
  424. package/src/Errors.ts +14 -0
  425. package/src/Exec.ts +50 -0
  426. package/src/ExecHttp.ts +47 -0
  427. package/src/GetObject.ts +48 -0
  428. package/src/GetObjectHttp.ts +20 -0
  429. package/src/GetSecret.ts +48 -0
  430. package/src/GetSecretHttp.ts +60 -0
  431. package/src/HeadObject.ts +43 -0
  432. package/src/HeadObjectHttp.ts +20 -0
  433. package/src/IpAssignment.ts +522 -0
  434. package/src/ListObjectsV2.ts +43 -0
  435. package/src/ListObjectsV2Http.ts +20 -0
  436. package/src/ListSecrets.ts +57 -0
  437. package/src/ListSecretsHttp.ts +43 -0
  438. package/src/Machine.ts +1270 -0
  439. package/src/MachineContainers.ts +152 -0
  440. package/src/Metadata.ts +195 -0
  441. package/src/MountVolume.ts +315 -0
  442. package/src/Postgres.ts +777 -0
  443. package/src/PostgresMigrations.ts +93 -0
  444. package/src/Providers.ts +155 -0
  445. package/src/PutObject.ts +49 -0
  446. package/src/PutObjectHttp.ts +20 -0
  447. package/src/ReadRedis.ts +31 -0
  448. package/src/ReadRedisHttp.ts +18 -0
  449. package/src/ReadWriteRedis.ts +33 -0
  450. package/src/ReadWriteRedisHttp.ts +18 -0
  451. package/src/Redis.ts +823 -0
  452. package/src/RedisBinding.ts +64 -0
  453. package/src/RedisHttp.ts +14 -0
  454. package/src/Region.ts +44 -0
  455. package/src/Secret.ts +405 -0
  456. package/src/SecretHttp.ts +149 -0
  457. package/src/SecretKey.ts +389 -0
  458. package/src/SecretKeyHttp.ts +23 -0
  459. package/src/Service.ts +1968 -0
  460. package/src/Sign.ts +46 -0
  461. package/src/SignHttp.ts +44 -0
  462. package/src/Sprite.ts +673 -0
  463. package/src/SpriteHttp.ts +50 -0
  464. package/src/Verify.ts +47 -0
  465. package/src/VerifyHttp.ts +46 -0
  466. package/src/Volume.ts +264 -0
  467. package/src/VolumeSnapshot.ts +321 -0
  468. package/src/Website/AssetDeployment.ts +292 -0
  469. package/src/Website/Astro.ts +92 -0
  470. package/src/Website/Foldkit.ts +54 -0
  471. package/src/Website/FrameworkSite.ts +449 -0
  472. package/src/Website/Nextjs.ts +50 -0
  473. package/src/Website/Nuxt.ts +48 -0
  474. package/src/Website/Octane.ts +44 -0
  475. package/src/Website/ReactRouter.ts +76 -0
  476. package/src/Website/SolidStart.ts +90 -0
  477. package/src/Website/StaticSite.ts +295 -0
  478. package/src/Website/SvelteKit.ts +49 -0
  479. package/src/Website/TanStackStart.ts +72 -0
  480. package/src/Website/Vinext.ts +79 -0
  481. package/src/Website/Vite.ts +121 -0
  482. package/src/Website/Vocs.ts +50 -0
  483. package/src/Website/Waku.ts +65 -0
  484. package/src/Website/index.ts +16 -0
  485. package/src/WriteCertificates.ts +90 -0
  486. package/src/WriteCertificatesHttp.ts +93 -0
  487. package/src/WriteRedis.ts +31 -0
  488. package/src/WriteRedisHttp.ts +18 -0
  489. package/src/WriteSecret.ts +86 -0
  490. package/src/WriteSecretHttp.ts +71 -0
  491. package/src/bluegreen.ts +711 -0
  492. package/src/globals.d.ts +2 -0
  493. package/src/hosted.ts +667 -0
  494. package/src/index.ts +64 -0
  495. package/src/internal/RemoteBuilder.ts +242 -0
  496. package/src/leases.ts +437 -0
  497. package/src/ports.ts +177 -0
  498. package/src/replicas.ts +1480 -0
  499. package/src/rpc.ts +136 -0
@@ -0,0 +1,171 @@
1
+ import type { Docker } from "@alchemy.run/docker/Docker";
2
+ import type { FlyMachineService } from "@distilled.cloud/fly-io/machines";
3
+ import * as machines from "@distilled.cloud/fly-io/machines";
4
+ import * as Bundle from "alchemy/Bundle/Bundle";
5
+ import { type PackageInstall } from "alchemy/Bundle/InstalledPackages";
6
+ import type { ResourceBinding } from "alchemy/Resource";
7
+ import { type HostRuntimeContext } from "alchemy/Runtime/Process";
8
+ import { extraFileDestination, type ExtraFile } from "alchemy/Util/extraFiles";
9
+ import * as Effect from "effect/Effect";
10
+ import * as FileSystem from "effect/FileSystem";
11
+ import * as Path from "effect/Path";
12
+ import type * as rolldown from "rolldown";
13
+ import type { BoundTarget, DiskSpec, ServiceBinding } from "./MountVolume.ts";
14
+ export type FlyHostRuntimeContext = HostRuntimeContext;
15
+ /**
16
+ * Container runtime context for Fly hosts. It also serves the program's RPC
17
+ * methods to bound callers (see {@link serveFlyRpc}) and boots the HTTP
18
+ * server for a program that exposes methods but no `fetch`.
19
+ */
20
+ export declare const createFlyHostRuntimeContext: (type: string) => (id: string) => HostRuntimeContext;
21
+ export declare const FLY_REGISTRY = "registry.fly.io";
22
+ export declare const DEFAULT_BASE_IMAGE = "node:26-slim";
23
+ export declare const DEFAULT_PORT = 3000;
24
+ export declare const MACHINE_PLATFORM = "linux/amd64";
25
+ export interface FlyBuildOptions extends Bundle.BundleConfig {
26
+ /**
27
+ * Native or Node-only packages to install into the Machine image with
28
+ * `npm install` instead of bundling them. Same `build.install` shape as
29
+ * Lambda.
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * build: { install: ["sharp"] }
34
+ * ```
35
+ */
36
+ readonly install?: PackageInstall;
37
+ /**
38
+ * Build the image on Fly's remote builders (Depot), as `fly deploy` does,
39
+ * instead of with the local Docker engine. Only the build context is
40
+ * uploaded; the builder pulls the base image and pushes the result to
41
+ * `registry.fly.io` next to it. Set `false` to build and push locally.
42
+ * Either way, the local `docker buildx` client drives the build.
43
+ *
44
+ * @default true
45
+ */
46
+ readonly remote?: boolean;
47
+ }
48
+ export type { ExtraFile };
49
+ export interface HostedProgramProps {
50
+ main: string;
51
+ handler?: string;
52
+ port?: number;
53
+ image?: string;
54
+ env?: Record<string, any>;
55
+ isExternal?: boolean;
56
+ build?: FlyBuildOptions;
57
+ /**
58
+ * Extra host directories baked into the image (framework client
59
+ * assets, Next.js `.next`, …). Hashed into `code.hash` so asset
60
+ * changes rebuild the image.
61
+ */
62
+ extraFiles?: ReadonlyArray<ExtraFile>;
63
+ }
64
+ export { extraFileDestination };
65
+ declare const DeployTokenMissing_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 & {
66
+ readonly _tag: "Fly.DeployTokenMissing";
67
+ } & Readonly<A>;
68
+ export declare class DeployTokenMissing extends DeployTokenMissing_base<{
69
+ appName: string;
70
+ }> {
71
+ }
72
+ /** Unwrap env inputs while preserving serialized RuntimeContext markers. */
73
+ export declare const plainEnvValue: (value: unknown) => string | undefined;
74
+ export declare const toEnvRecord: (env: Record<string, any> | undefined) => Record<string, string>;
75
+ export declare const collectBindingState: (bindings: readonly ResourceBinding<ServiceBinding>[]) => {
76
+ env: Record<string, string>;
77
+ mounts: DiskSpec[];
78
+ redis: {
79
+ name: string;
80
+ id?: string;
81
+ }[];
82
+ buckets: {
83
+ name: string;
84
+ id?: string;
85
+ values?: Record<string, string>;
86
+ }[];
87
+ postgres: {
88
+ clusterId: string;
89
+ variableName?: string;
90
+ }[];
91
+ targets: BoundTarget[];
92
+ };
93
+ /**
94
+ * HTTP 80 → HTTPS redirect plus HTTPS 443 for public Services. Private
95
+ * (Flycast-only) Services publish plain HTTP on 80: Fly issues no
96
+ * certificate for `.flycast`, so a redirect to HTTPS would break callers.
97
+ */
98
+ export declare const defaultHttpServices: (port: number, count?: number, isPublic?: boolean) => FlyMachineService[];
99
+ export declare const createFlyHostedSupport: ({ stackName, stage, virtualEntryPlugin, docker, dotAlchemy, }: {
100
+ stackName: string;
101
+ stage: string;
102
+ virtualEntryPlugin: (content: (importPath: string) => string) => rolldown.Plugin;
103
+ docker: Docker["Service"];
104
+ dotAlchemy: string;
105
+ }) => {
106
+ alchemyEnv: {
107
+ ALCHEMY_STACK_NAME: string;
108
+ ALCHEMY_STAGE: string;
109
+ ALCHEMY_PHASE: string;
110
+ HOST: string;
111
+ };
112
+ bundleProgram: (props: HostedProgramProps) => Effect.Effect<{
113
+ files: {
114
+ path: string;
115
+ content: Uint8Array<ArrayBufferLike>;
116
+ }[];
117
+ hash: string;
118
+ }, Bundle.BundleError | import("effect/PlatformError").PlatformError, FileSystem.FileSystem | Path.Path>;
119
+ computeCodeHash: (props: HostedProgramProps) => Effect.Effect<{
120
+ bundled: {
121
+ files: {
122
+ path: string;
123
+ content: Uint8Array<ArrayBufferLike>;
124
+ }[];
125
+ hash: string;
126
+ };
127
+ dockerfile: string;
128
+ codeHash: string;
129
+ packageJson: string | undefined;
130
+ entryRel: string | undefined;
131
+ }, Bundle.BundleError | import("effect/PlatformError").PlatformError, import("effect/process/ChildProcessSpawner").ChildProcessSpawner | FileSystem.FileSystem | Path.Path>;
132
+ resolveImage: (input: {
133
+ id: string;
134
+ appName: string;
135
+ props: HostedProgramProps;
136
+ previousHash?: string;
137
+ session?: {
138
+ note: (message: string) => Effect.Effect<void>;
139
+ };
140
+ }) => Effect.Effect<{
141
+ imageRef: string;
142
+ codeHash: string;
143
+ }, any, import("effect/process/ChildProcessSpawner").ChildProcessSpawner | FileSystem.FileSystem | Path.Path | import("alchemy/Stack").Stack | import("alchemy/Stage").Stage | machines.FlyIoOpContext>;
144
+ hash: (props: HostedProgramProps) => Effect.Effect<string, Bundle.BundleError | import("effect/PlatformError").PlatformError, import("effect/process/ChildProcessSpawner").ChildProcessSpawner | FileSystem.FileSystem | Path.Path>;
145
+ };
146
+ /**
147
+ * Bundle a Sprite program the same way {@link createFlyHostedSupport}
148
+ * bundles a Service — rolldown + Node bootstrap — without building a
149
+ * Docker image. The provider writes the files onto the Sprite.
150
+ */
151
+ export declare const createSpriteHostedSupport: ({ stackName, stage, virtualEntryPlugin, }: {
152
+ stackName: string;
153
+ stage: string;
154
+ virtualEntryPlugin: (content: (importPath: string) => string) => rolldown.Plugin;
155
+ }) => {
156
+ alchemyEnv: {
157
+ ALCHEMY_STACK_NAME: string;
158
+ ALCHEMY_STAGE: string;
159
+ ALCHEMY_PHASE: string;
160
+ HOST: string;
161
+ };
162
+ bundleProgram: (props: HostedProgramProps) => Effect.Effect<{
163
+ files: {
164
+ path: string;
165
+ content: Uint8Array<ArrayBufferLike>;
166
+ }[];
167
+ hash: string;
168
+ }, Bundle.BundleError | import("effect/PlatformError").PlatformError, FileSystem.FileSystem | Path.Path>;
169
+ hash: (props: HostedProgramProps) => Effect.Effect<string, Bundle.BundleError | import("effect/PlatformError").PlatformError, FileSystem.FileSystem | Path.Path>;
170
+ };
171
+ //# sourceMappingURL=hosted.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted.d.ts","sourceRoot":"","sources":["../src/hosted.ts"],"names":[],"mappings":"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"}
package/lib/hosted.js ADDED
@@ -0,0 +1,458 @@
1
+ import * as machines from "@distilled.cloud/fly-io/machines";
2
+ import * as Bundle from "alchemy/Bundle/Bundle";
3
+ import { matchesPackageRoot, normalizeInstallTargets, resolvePackageInstallIdentity, } from "alchemy/Bundle/InstalledPackages";
4
+ import { findCwdForBundle, getStableContextDir, resolveMainPath } from "alchemy/Bundle/TempRoot";
5
+ import { safeHttpEffect } from "alchemy/Http";
6
+ import { createContainerRuntimeContext } from "alchemy/Runtime/Process";
7
+ import { copyExtraFiles, contextRootOf, extraFileDestination, hashExtraFiles, isContextRootDest, posixRelUnder, resolveExtraSource, } from "alchemy/Util/extraFiles";
8
+ import { sha256, sha256Object } from "alchemy/Util/sha256";
9
+ import * as Data from "effect/Data";
10
+ import * as Effect from "effect/Effect";
11
+ import * as FileSystem from "effect/FileSystem";
12
+ import * as Path from "effect/Path";
13
+ import * as Redacted from "effect/Redacted";
14
+ import * as Schedule from "effect/Schedule";
15
+ import { buildOnRemoteBuilder } from "./internal/RemoteBuilder.js";
16
+ import { rpcMethodsOf, serveFlyRpc } from "./rpc.js";
17
+ /**
18
+ * Container runtime context for Fly hosts. It also serves the program's RPC
19
+ * methods to bound callers (see {@link serveFlyRpc}) and boots the HTTP
20
+ * server for a program that exposes methods but no `fetch`.
21
+ */
22
+ export const createFlyHostRuntimeContext = (type) => (id) => {
23
+ const base = createContainerRuntimeContext(type)(id);
24
+ const serveBase = base.serve;
25
+ const serve = (handler, options) => {
26
+ const shape = options?.shape;
27
+ const methods = rpcMethodsOf(shape);
28
+ // `safeHttpEffect` also resolves a `fetch` given as an Effect that
29
+ // builds the handler.
30
+ const wrapped = serveFlyRpc(methods, safeHttpEffect(handler));
31
+ const boots = shape === undefined || shape.fetch !== undefined || Object.keys(methods).length > 0;
32
+ return serveBase(wrapped, boots ? { shape: { ...shape, fetch: shape?.fetch ?? wrapped } } : options);
33
+ };
34
+ return Object.assign(base, { serve });
35
+ };
36
+ export const FLY_REGISTRY = "registry.fly.io";
37
+ export const DEFAULT_BASE_IMAGE = "node:26-slim";
38
+ export const DEFAULT_PORT = 3000;
39
+ export const MACHINE_PLATFORM = "linux/amd64";
40
+ export { extraFileDestination };
41
+ const matchesConfiguredExternal = (external, moduleId, parentId, isResolved) => {
42
+ if (external === undefined)
43
+ return false;
44
+ if (typeof external === "function") {
45
+ return external(moduleId, parentId, isResolved) === true;
46
+ }
47
+ const matchers = Array.isArray(external) ? external : [external];
48
+ return matchers.some((matcher) => typeof matcher === "string" ? matcher === moduleId : matcher.test(moduleId));
49
+ };
50
+ export class DeployTokenMissing extends Data.TaggedError("Fly.DeployTokenMissing") {
51
+ }
52
+ /**
53
+ * The generated entry for `Fly.Service` / `Fly.Sprite` machines: a shim
54
+ * importing only `@alchemy.run/fly/Bootstrap` plus the user's `main` —
55
+ * see that module for why the entry never imports alchemy's own
56
+ * dependencies. The runtime flag is raised BEFORE the user's module is
57
+ * evaluated (hence the dynamic import) so its module-scope code sees it.
58
+ */
59
+ const makeBunBootstrap = (handler) => (importPath) => `
60
+ import { bootstrap } from "@alchemy.run/fly/Bootstrap";
61
+
62
+ globalThis.__ALCHEMY_RUNTIME__ = true;
63
+ const { ${handler}: entrypoint } = await import(${JSON.stringify(importPath)});
64
+
65
+ await bootstrap(entrypoint);
66
+ `;
67
+ /** Unwrap env inputs while preserving serialized RuntimeContext markers. */
68
+ export const plainEnvValue = (value) => {
69
+ if (value === undefined || value === null)
70
+ return undefined;
71
+ if (Redacted.isRedacted(value))
72
+ return value.pipe(Redacted.value, plainEnvValue);
73
+ if (typeof value === "string") {
74
+ return value.length > 0 ? value : undefined;
75
+ }
76
+ if (typeof value === "number" || typeof value === "boolean") {
77
+ return String(value);
78
+ }
79
+ return undefined;
80
+ };
81
+ export const toEnvRecord = (env) => Object.fromEntries(Object.entries(env ?? {}).flatMap(([key, value]) => {
82
+ const raw = plainEnvValue(value);
83
+ return raw === undefined ? [] : [[key, raw]];
84
+ }));
85
+ const coerceBindingName = (value) => {
86
+ const direct = plainEnvValue(value);
87
+ if (direct !== undefined)
88
+ return direct;
89
+ if (value != null && typeof value === "object") {
90
+ const record = value;
91
+ return (coerceBindingName(record.name) ??
92
+ coerceBindingName(record.id) ??
93
+ coerceBindingName(record.addOnId));
94
+ }
95
+ return undefined;
96
+ };
97
+ export const collectBindingState = (bindings) => {
98
+ const active = bindings.filter((binding) => binding.action !== "delete");
99
+ const env = toEnvRecord(active
100
+ .map((binding) => binding?.data?.env)
101
+ .reduce((acc, value) => ({ ...acc, ...value }), {}));
102
+ const mounts = [];
103
+ const seen = new Set();
104
+ const redis = [];
105
+ const buckets = [];
106
+ const postgres = [];
107
+ const targets = [];
108
+ for (const binding of active) {
109
+ const target = binding?.data?.target;
110
+ if (target !== undefined)
111
+ targets.push(target);
112
+ for (const mount of binding?.data?.mounts ?? []) {
113
+ if (seen.has(mount.path))
114
+ continue;
115
+ seen.add(mount.path);
116
+ mounts.push(mount);
117
+ }
118
+ const attached = binding?.data?.redis;
119
+ const redisName = coerceBindingName(attached?.name);
120
+ const redisId = coerceBindingName(attached?.id);
121
+ if (redisName !== undefined || redisId !== undefined) {
122
+ redis.push({ name: redisName ?? "", id: redisId });
123
+ }
124
+ const bucket = binding?.data?.bucket;
125
+ const bucketName = coerceBindingName(bucket?.name);
126
+ const bucketId = coerceBindingName(bucket?.id) ?? coerceBindingName(bucket?.addOnId);
127
+ if (bucketName !== undefined || bucketId !== undefined) {
128
+ // The bound Bucket's attributes carry the create-time Tigris
129
+ // credentials, which Fly's add-on lookup often returns empty.
130
+ const values = {};
131
+ for (const [key, value] of [
132
+ ["BUCKET_NAME", bucket?.bucketName],
133
+ ["AWS_ACCESS_KEY_ID", bucket?.accessKeyId],
134
+ ["AWS_SECRET_ACCESS_KEY", bucket?.secretAccessKey],
135
+ ["AWS_ENDPOINT_URL_S3", bucket?.endpoint],
136
+ ["AWS_REGION", bucket?.region],
137
+ ]) {
138
+ const plain = plainEnvValue(value);
139
+ if (plain !== undefined)
140
+ values[key] = plain;
141
+ }
142
+ buckets.push({ name: bucketName ?? "", id: bucketId, values });
143
+ }
144
+ const pg = binding?.data?.postgres;
145
+ const clusterId = coerceBindingName(pg?.clusterId);
146
+ if (clusterId !== undefined) {
147
+ postgres.push({
148
+ clusterId,
149
+ variableName: typeof pg?.variableName === "string" && pg.variableName.length > 0
150
+ ? pg.variableName
151
+ : undefined,
152
+ });
153
+ }
154
+ }
155
+ return { env, mounts, redis, buckets, postgres, targets };
156
+ };
157
+ /**
158
+ * HTTP 80 → HTTPS redirect plus HTTPS 443 for public Services. Private
159
+ * (Flycast-only) Services publish plain HTTP on 80: Fly issues no
160
+ * certificate for `.flycast`, so a redirect to HTTPS would break callers.
161
+ */
162
+ export const defaultHttpServices = (port, count = 1, isPublic = true) => [
163
+ {
164
+ protocol: "tcp",
165
+ internal_port: port,
166
+ autostart: true,
167
+ autostop: "off",
168
+ min_machines_running: count,
169
+ ports: isPublic
170
+ ? [
171
+ { port: 80, handlers: ["http"], force_https: true },
172
+ { port: 443, handlers: ["tls", "http"] },
173
+ ]
174
+ : [{ port: 80, handlers: ["http"] }],
175
+ // Wait until the process is listening before the proxy sends traffic.
176
+ // Without this, fly.dev hangs (status 0) while Node is still booting.
177
+ checks: [{ type: "tcp", port, interval: "10s", timeout: "2s", grace_period: "30s" }],
178
+ },
179
+ ];
180
+ const sanitizeImageRepo = (id) => {
181
+ const lowered = id
182
+ .toLowerCase()
183
+ .replace(/[^a-z0-9_.-]+/g, "-")
184
+ .replace(/^-+|-+$/g, "");
185
+ return lowered.length === 0 ? "service" : lowered;
186
+ };
187
+ const generateDockerfile = (props, hasChunks, install, entryRel) => {
188
+ const port = props.port ?? DEFAULT_PORT;
189
+ const lines = [`FROM ${props.image ?? DEFAULT_BASE_IMAGE}`, `WORKDIR /app`];
190
+ if (install !== undefined && Object.keys(install).length > 0) {
191
+ lines.push(`COPY package.json /app/package.json`, `RUN npm install --omit=dev --no-fund --no-audit`);
192
+ }
193
+ if (props.isExternal === true) {
194
+ lines.push(`COPY . /app`);
195
+ const entry = entryRel !== undefined && entryRel.length > 0 ? entryRel : "serve-node.mjs";
196
+ lines.push(`ENV PORT=${String(port)}`, `ENV HOST=0.0.0.0`, `EXPOSE ${String(port)}`, `ENTRYPOINT ["node", ${JSON.stringify(`/app/${entry}`)}]`);
197
+ return `${lines.join("\n")}\n`;
198
+ }
199
+ lines.push(`COPY index.mjs /app/index.mjs`);
200
+ if (hasChunks) {
201
+ lines.push(`COPY *.js /app/`);
202
+ }
203
+ const seen = new Set();
204
+ for (const extra of props.extraFiles ?? []) {
205
+ const dest = extraFileDestination(extra.dest);
206
+ if (isContextRootDest(dest) || seen.has(dest))
207
+ continue;
208
+ seen.add(dest);
209
+ lines.push(`COPY ${dest} /app/${dest}`);
210
+ }
211
+ lines.push(`ENV PORT=${String(port)}`, `ENV HOST=0.0.0.0`, `EXPOSE ${String(port)}`, `ENTRYPOINT ["node", "/app/index.mjs"]`);
212
+ return `${lines.join("\n")}\n`;
213
+ };
214
+ const installManifest = (dependencies) => `${JSON.stringify({ private: true, type: "module", dependencies }, null, 2)}\n`;
215
+ export const createFlyHostedSupport = ({ stackName, stage, virtualEntryPlugin, docker, dotAlchemy, }) => {
216
+ const alchemyEnv = {
217
+ ALCHEMY_STACK_NAME: stackName,
218
+ ALCHEMY_STAGE: stage,
219
+ ALCHEMY_PHASE: "runtime",
220
+ HOST: "0.0.0.0",
221
+ };
222
+ const bundleProgram = Effect.fn(function* (props) {
223
+ const handler = props.handler ?? "default";
224
+ const realMain = yield* resolveMainPath(props.main);
225
+ const cwd = yield* findCwdForBundle(realMain);
226
+ const bootstrap = makeBunBootstrap(handler);
227
+ const requested = yield* normalizeInstallTargets(props.build?.install);
228
+ const installRoots = new Set(Object.keys(requested));
229
+ const configuredExternal = props.build?.input?.external;
230
+ const buildBundle = Effect.fn(function* (entry, plugins) {
231
+ return yield* Bundle.build({
232
+ ...props.build?.input,
233
+ input: entry,
234
+ cwd,
235
+ platform: "node",
236
+ external: (moduleId, parentId, isResolved) => {
237
+ if (moduleId === "bun" || moduleId.startsWith("bun:"))
238
+ return true;
239
+ for (const root of installRoots) {
240
+ if (matchesPackageRoot(moduleId, root))
241
+ return true;
242
+ }
243
+ return matchesConfiguredExternal(configuredExternal, moduleId, parentId, isResolved);
244
+ },
245
+ resolve: {
246
+ conditionNames: [...Bundle.NODE_CONDITION_NAMES],
247
+ ...props.build?.input?.resolve,
248
+ },
249
+ plugins: [props.build?.input?.plugins, plugins],
250
+ }, {
251
+ ...props.build?.output,
252
+ format: "esm",
253
+ sourcemap: props.build?.output?.sourcemap ?? false,
254
+ entryFileNames: "index.mjs",
255
+ strictExecutionOrder: true,
256
+ keepNames: true,
257
+ }, props.build);
258
+ });
259
+ if (props.isExternal === true) {
260
+ const fs = yield* FileSystem.FileSystem;
261
+ const path = yield* Path.Path;
262
+ const bytes = yield* fs.readFile(realMain);
263
+ const hash = yield* sha256(bytes);
264
+ return { files: [{ path: path.basename(realMain), content: bytes }], hash };
265
+ }
266
+ const bundleOutput = yield* buildBundle(realMain, virtualEntryPlugin(bootstrap));
267
+ const files = bundleOutput.files.map((file) => ({
268
+ path: file.path,
269
+ content: typeof file.content === "string" ? new TextEncoder().encode(file.content) : file.content,
270
+ }));
271
+ return { files, hash: bundleOutput.hash };
272
+ });
273
+ const computeCodeHash = Effect.fn(function* (props) {
274
+ const bundled = yield* bundleProgram(props);
275
+ const realMain = yield* resolveMainPath(props.main);
276
+ const cwd = yield* findCwdForBundle(realMain);
277
+ const path = yield* Path.Path;
278
+ const requested = yield* normalizeInstallTargets(props.build?.install);
279
+ const identity = Object.keys(requested).length > 0
280
+ ? yield* resolvePackageInstallIdentity({ cwd, requested })
281
+ : undefined;
282
+ const install = identity !== undefined && Object.keys(identity.resolved).length > 0
283
+ ? identity.resolved
284
+ : undefined;
285
+ const packageJson = install === undefined ? undefined : installManifest(install);
286
+ const extras = (props.extraFiles ?? []).map((file) => ({
287
+ source: file.source,
288
+ dest: file.dest,
289
+ }));
290
+ const root = contextRootOf(realMain, extras, path, (source) => resolveExtraSource(source, path));
291
+ const entryRel = props.isExternal === true
292
+ ? (posixRelUnder(root, realMain, path) ?? path.basename(realMain))
293
+ : undefined;
294
+ const dockerfile = generateDockerfile(props, bundled.files.length > 1, install, entryRel);
295
+ const extraFiles = yield* hashExtraFiles(props.extraFiles);
296
+ const codeHash = (yield* sha256Object({
297
+ bundleHash: bundled.hash,
298
+ dockerfile,
299
+ packageJson,
300
+ extraFiles,
301
+ extraFilesIncludesNodeModules: true,
302
+ })).slice(0, 16);
303
+ return { bundled, dockerfile, codeHash, packageJson, entryRel };
304
+ });
305
+ const imageExists = (imageRef) => docker.image.inspect(imageRef).pipe(Effect.map(() => true), Effect.catchReason("PlatformError", "NotFound", () => Effect.succeed(false)));
306
+ const pushBackoff = Schedule.exponential("2 seconds");
307
+ /**
308
+ * Bundle `main`, content-hash the image, build it when missing, and
309
+ * push to `registry.fly.io/{appName}:{logicalId}-{hash}` using an
310
+ * app deploy token. When `previousHash` matches, skip build and push.
311
+ *
312
+ * Fly's registry is app-scoped (`/v2/{app}/...`). A nested
313
+ * `{app}/{image}` repository 404s on blob upload.
314
+ */
315
+ const resolveImage = Effect.fn(function* (input) {
316
+ const note = input.session?.note ?? ((_message) => Effect.void);
317
+ yield* note(`Bundling ${input.id} program...`);
318
+ const { bundled, dockerfile, codeHash, packageJson } = yield* computeCodeHash(input.props);
319
+ yield* note(`Hashed ${input.id} (${codeHash})`);
320
+ const repo = sanitizeImageRepo(input.id);
321
+ const imageRef = `${FLY_REGISTRY}/${input.appName}:${repo}-${codeHash}`;
322
+ if (input.previousHash === codeHash) {
323
+ return { imageRef, codeHash };
324
+ }
325
+ const minted = yield* machines.createAppDeployToken({ app_name: input.appName });
326
+ const token = minted.token === undefined || Redacted.isRedacted(minted.token)
327
+ ? minted.token
328
+ : Redacted.make(minted.token);
329
+ if (token === undefined || Redacted.value(token).length === 0) {
330
+ return yield* new DeployTokenMissing({ appName: input.appName });
331
+ }
332
+ const registry = { server: FLY_REGISTRY, username: "x", password: token };
333
+ const materialize = Effect.gen(function* () {
334
+ const realMain = yield* resolveMainPath(input.props.main);
335
+ const contextDir = yield* getStableContextDir(realMain, dotAlchemy, `${input.id}-image`);
336
+ const fs = yield* FileSystem.FileSystem;
337
+ const path = yield* Path.Path;
338
+ const files = input.props.isExternal === true
339
+ ? packageJson !== undefined
340
+ ? [{ path: "package.json", content: new TextEncoder().encode(packageJson) }]
341
+ : []
342
+ : [
343
+ ...bundled.files.map((file, index) => ({
344
+ path: index === 0 ? "index.mjs" : file.path,
345
+ content: file.content,
346
+ })),
347
+ ...(packageJson !== undefined
348
+ ? [{ path: "package.json", content: new TextEncoder().encode(packageJson) }]
349
+ : []),
350
+ ];
351
+ yield* docker.materialize({ context: contextDir, dockerfile, files });
352
+ yield* copyExtraFiles(contextDir, input.props.extraFiles);
353
+ if (input.props.isExternal === true) {
354
+ const extras = (input.props.extraFiles ?? []).map((file) => ({
355
+ source: file.source,
356
+ dest: file.dest,
357
+ }));
358
+ const root = contextRootOf(realMain, extras, path, (source) => resolveExtraSource(source, path));
359
+ const entryRel = posixRelUnder(root, realMain, path) ?? path.basename(realMain);
360
+ const dest = path.join(contextDir, entryRel);
361
+ if (!(yield* fs.exists(dest).pipe(Effect.orElseSucceed(() => false)))) {
362
+ yield* fs.makeDirectory(path.dirname(dest), { recursive: true });
363
+ yield* fs.copy(realMain, dest, { overwrite: true });
364
+ }
365
+ }
366
+ return contextDir;
367
+ });
368
+ if (input.props.build?.remote !== false) {
369
+ const contextDir = yield* materialize;
370
+ yield* note(`Building ${imageRef} on a Fly remote builder...`);
371
+ yield* buildOnRemoteBuilder({
372
+ docker,
373
+ appName: input.appName,
374
+ contextDir,
375
+ imageRef,
376
+ platform: MACHINE_PLATFORM,
377
+ registry,
378
+ note,
379
+ });
380
+ yield* note(`Pushed ${imageRef}`);
381
+ return { imageRef, codeHash };
382
+ }
383
+ if (!(yield* imageExists(imageRef))) {
384
+ const contextDir = yield* materialize;
385
+ yield* note(`Building container image ${imageRef}...`);
386
+ yield* docker.image.build({ context: contextDir, tag: imageRef, platform: MACHINE_PLATFORM });
387
+ yield* note(`Built ${imageRef}`);
388
+ }
389
+ yield* note(`Pushing ${imageRef}...`);
390
+ yield* docker.image
391
+ .push(imageRef, registry)
392
+ .pipe(Effect.retry({ times: 3, schedule: pushBackoff }));
393
+ yield* note(`Pushed ${imageRef}`);
394
+ return { imageRef, codeHash };
395
+ });
396
+ const hash = Effect.fn(function* (props) {
397
+ const { codeHash } = yield* computeCodeHash(props);
398
+ return codeHash;
399
+ });
400
+ return { alchemyEnv, bundleProgram, computeCodeHash, resolveImage, hash };
401
+ };
402
+ /**
403
+ * Bundle a Sprite program the same way {@link createFlyHostedSupport}
404
+ * bundles a Service — rolldown + Node bootstrap — without building a
405
+ * Docker image. The provider writes the files onto the Sprite.
406
+ */
407
+ export const createSpriteHostedSupport = ({ stackName, stage, virtualEntryPlugin, }) => {
408
+ const alchemyEnv = {
409
+ ALCHEMY_STACK_NAME: stackName,
410
+ ALCHEMY_STAGE: stage,
411
+ ALCHEMY_PHASE: "runtime",
412
+ HOST: "0.0.0.0",
413
+ };
414
+ const bundleProgram = Effect.fn(function* (props) {
415
+ const handler = props.handler ?? "default";
416
+ const realMain = yield* resolveMainPath(props.main);
417
+ const cwd = yield* findCwdForBundle(realMain);
418
+ const bootstrap = makeBunBootstrap(handler);
419
+ const buildBundle = Effect.fn(function* (entry, plugins) {
420
+ return yield* Bundle.build({
421
+ ...props.build?.input,
422
+ input: entry,
423
+ cwd,
424
+ platform: "node",
425
+ external: [
426
+ "bun",
427
+ "bun:*",
428
+ ...(props.build?.input?.external ?? []),
429
+ ],
430
+ resolve: {
431
+ conditionNames: [...Bundle.NODE_CONDITION_NAMES],
432
+ ...props.build?.input?.resolve,
433
+ },
434
+ plugins: [props.build?.input?.plugins, plugins],
435
+ }, {
436
+ ...props.build?.output,
437
+ format: "esm",
438
+ sourcemap: props.build?.output?.sourcemap ?? false,
439
+ minify: props.build?.output?.minify ?? false,
440
+ entryFileNames: "index.mjs",
441
+ }, props.build);
442
+ });
443
+ const bundleOutput = props.isExternal
444
+ ? yield* buildBundle(realMain)
445
+ : yield* buildBundle(realMain, virtualEntryPlugin(bootstrap));
446
+ const files = bundleOutput.files.map((file) => ({
447
+ path: file.path,
448
+ content: typeof file.content === "string" ? new TextEncoder().encode(file.content) : file.content,
449
+ }));
450
+ return { files, hash: bundleOutput.hash };
451
+ });
452
+ const hash = Effect.fn(function* (props) {
453
+ const bundled = yield* bundleProgram(props);
454
+ return (yield* sha256Object({ bundleHash: bundled.hash })).slice(0, 16);
455
+ });
456
+ return { alchemyEnv, bundleProgram, hash };
457
+ };
458
+ //# sourceMappingURL=hosted.js.map