@alchemy.run/fly 0.0.0-stage → 2.0.0-beta.84
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.
- package/LICENSE +201 -0
- package/README.md +61 -2
- package/lib/App.d.ts +230 -0
- package/lib/App.d.ts.map +1 -0
- package/lib/App.js +340 -0
- package/lib/App.js.map +1 -0
- package/lib/AuthProvider.d.ts +22 -0
- package/lib/AuthProvider.d.ts.map +1 -0
- package/lib/AuthProvider.js +48 -0
- package/lib/AuthProvider.js.map +1 -0
- package/lib/BindService.d.ts +159 -0
- package/lib/BindService.d.ts.map +1 -0
- package/lib/BindService.js +222 -0
- package/lib/BindService.js.map +1 -0
- package/lib/Bootstrap.d.ts +8 -0
- package/lib/Bootstrap.d.ts.map +1 -0
- package/lib/Bootstrap.js +41 -0
- package/lib/Bootstrap.js.map +1 -0
- package/lib/Bucket.d.ts +278 -0
- package/lib/Bucket.d.ts.map +1 -0
- package/lib/Bucket.js +658 -0
- package/lib/Bucket.js.map +1 -0
- package/lib/BucketBinding.d.ts +33 -0
- package/lib/BucketBinding.d.ts.map +1 -0
- package/lib/BucketBinding.js +70 -0
- package/lib/BucketBinding.js.map +1 -0
- package/lib/Catalog.d.ts +28 -0
- package/lib/Catalog.d.ts.map +1 -0
- package/lib/Catalog.js +31 -0
- package/lib/Catalog.js.map +1 -0
- package/lib/Certificate.d.ts +189 -0
- package/lib/Certificate.d.ts.map +1 -0
- package/lib/Certificate.js +380 -0
- package/lib/Certificate.js.map +1 -0
- package/lib/Checkpoint.d.ts +55 -0
- package/lib/Checkpoint.d.ts.map +1 -0
- package/lib/Checkpoint.js +3 -0
- package/lib/Checkpoint.js.map +1 -0
- package/lib/CheckpointHttp.d.ts +22 -0
- package/lib/CheckpointHttp.d.ts.map +1 -0
- package/lib/CheckpointHttp.js +53 -0
- package/lib/CheckpointHttp.js.map +1 -0
- package/lib/ConnectPostgres.d.ts +58 -0
- package/lib/ConnectPostgres.d.ts.map +1 -0
- package/lib/ConnectPostgres.js +13 -0
- package/lib/ConnectPostgres.js.map +1 -0
- package/lib/ConnectPostgresHttp.d.ts +26 -0
- package/lib/ConnectPostgresHttp.d.ts.map +1 -0
- package/lib/ConnectPostgresHttp.js +57 -0
- package/lib/ConnectPostgresHttp.js.map +1 -0
- package/lib/Contributions.d.ts +7 -0
- package/lib/Contributions.d.ts.map +1 -0
- package/lib/Contributions.js +6 -0
- package/lib/Contributions.js.map +1 -0
- package/lib/Credentials.d.ts +33 -0
- package/lib/Credentials.d.ts.map +1 -0
- package/lib/Credentials.js +59 -0
- package/lib/Credentials.js.map +1 -0
- package/lib/Decrypt.d.ts +52 -0
- package/lib/Decrypt.d.ts.map +1 -0
- package/lib/Decrypt.js +3 -0
- package/lib/Decrypt.js.map +1 -0
- package/lib/DecryptHttp.d.ts +22 -0
- package/lib/DecryptHttp.d.ts.map +1 -0
- package/lib/DecryptHttp.js +43 -0
- package/lib/DecryptHttp.js.map +1 -0
- package/lib/DeleteObject.d.ts +29 -0
- package/lib/DeleteObject.d.ts.map +1 -0
- package/lib/DeleteObject.js +3 -0
- package/lib/DeleteObject.js.map +1 -0
- package/lib/DeleteObjectHttp.d.ts +12 -0
- package/lib/DeleteObjectHttp.d.ts.map +1 -0
- package/lib/DeleteObjectHttp.js +17 -0
- package/lib/DeleteObjectHttp.js.map +1 -0
- package/lib/Deployment.d.ts +51 -0
- package/lib/Deployment.d.ts.map +1 -0
- package/lib/Deployment.js +62 -0
- package/lib/Deployment.js.map +1 -0
- package/lib/DeploymentImages.d.ts +18 -0
- package/lib/DeploymentImages.d.ts.map +1 -0
- package/lib/DeploymentImages.js +61 -0
- package/lib/DeploymentImages.js.map +1 -0
- package/lib/DeploymentState.d.ts +17 -0
- package/lib/DeploymentState.d.ts.map +1 -0
- package/lib/DeploymentState.js +87 -0
- package/lib/DeploymentState.js.map +1 -0
- package/lib/Encrypt.d.ts +50 -0
- package/lib/Encrypt.d.ts.map +1 -0
- package/lib/Encrypt.js +3 -0
- package/lib/Encrypt.js.map +1 -0
- package/lib/EncryptHttp.d.ts +22 -0
- package/lib/EncryptHttp.d.ts.map +1 -0
- package/lib/EncryptHttp.js +39 -0
- package/lib/EncryptHttp.js.map +1 -0
- package/lib/Environment.d.ts +45 -0
- package/lib/Environment.d.ts.map +1 -0
- package/lib/Environment.js +43 -0
- package/lib/Environment.js.map +1 -0
- package/lib/Errors.d.ts +18 -0
- package/lib/Errors.d.ts.map +1 -0
- package/lib/Errors.js +13 -0
- package/lib/Errors.js.map +1 -0
- package/lib/Exec.d.ts +41 -0
- package/lib/Exec.d.ts.map +1 -0
- package/lib/Exec.js +3 -0
- package/lib/Exec.js.map +1 -0
- package/lib/ExecHttp.d.ts +22 -0
- package/lib/ExecHttp.d.ts.map +1 -0
- package/lib/ExecHttp.js +39 -0
- package/lib/ExecHttp.js.map +1 -0
- package/lib/GetObject.d.ts +34 -0
- package/lib/GetObject.d.ts.map +1 -0
- package/lib/GetObject.js +3 -0
- package/lib/GetObject.js.map +1 -0
- package/lib/GetObjectHttp.d.ts +12 -0
- package/lib/GetObjectHttp.d.ts.map +1 -0
- package/lib/GetObjectHttp.js +17 -0
- package/lib/GetObjectHttp.js.map +1 -0
- package/lib/GetSecret.d.ts +44 -0
- package/lib/GetSecret.d.ts.map +1 -0
- package/lib/GetSecret.js +3 -0
- package/lib/GetSecret.js.map +1 -0
- package/lib/GetSecretHttp.d.ts +22 -0
- package/lib/GetSecretHttp.d.ts.map +1 -0
- package/lib/GetSecretHttp.js +50 -0
- package/lib/GetSecretHttp.js.map +1 -0
- package/lib/HeadObject.d.ts +29 -0
- package/lib/HeadObject.d.ts.map +1 -0
- package/lib/HeadObject.js +3 -0
- package/lib/HeadObject.js.map +1 -0
- package/lib/HeadObjectHttp.d.ts +12 -0
- package/lib/HeadObjectHttp.d.ts.map +1 -0
- package/lib/HeadObjectHttp.js +17 -0
- package/lib/HeadObjectHttp.js.map +1 -0
- package/lib/IpAssignment.d.ts +258 -0
- package/lib/IpAssignment.d.ts.map +1 -0
- package/lib/IpAssignment.js +376 -0
- package/lib/IpAssignment.js.map +1 -0
- package/lib/ListObjectsV2.d.ts +29 -0
- package/lib/ListObjectsV2.d.ts.map +1 -0
- package/lib/ListObjectsV2.js +3 -0
- package/lib/ListObjectsV2.js.map +1 -0
- package/lib/ListObjectsV2Http.d.ts +12 -0
- package/lib/ListObjectsV2Http.d.ts.map +1 -0
- package/lib/ListObjectsV2Http.js +17 -0
- package/lib/ListObjectsV2Http.js.map +1 -0
- package/lib/ListSecrets.d.ts +53 -0
- package/lib/ListSecrets.d.ts.map +1 -0
- package/lib/ListSecrets.js +3 -0
- package/lib/ListSecrets.js.map +1 -0
- package/lib/ListSecretsHttp.d.ts +22 -0
- package/lib/ListSecretsHttp.d.ts.map +1 -0
- package/lib/ListSecretsHttp.js +35 -0
- package/lib/ListSecretsHttp.js.map +1 -0
- package/lib/Machine.d.ts +802 -0
- package/lib/Machine.d.ts.map +1 -0
- package/lib/Machine.js +773 -0
- package/lib/Machine.js.map +1 -0
- package/lib/MachineContainers.d.ts +44 -0
- package/lib/MachineContainers.d.ts.map +1 -0
- package/lib/MachineContainers.js +115 -0
- package/lib/MachineContainers.js.map +1 -0
- package/lib/Metadata.d.ts +109 -0
- package/lib/Metadata.d.ts.map +1 -0
- package/lib/Metadata.js +159 -0
- package/lib/Metadata.js.map +1 -0
- package/lib/MountVolume.d.ts +295 -0
- package/lib/MountVolume.d.ts.map +1 -0
- package/lib/MountVolume.js +20 -0
- package/lib/MountVolume.js.map +1 -0
- package/lib/Postgres.d.ts +298 -0
- package/lib/Postgres.d.ts.map +1 -0
- package/lib/Postgres.js +508 -0
- package/lib/Postgres.js.map +1 -0
- package/lib/PostgresMigrations.d.ts +35 -0
- package/lib/PostgresMigrations.d.ts.map +1 -0
- package/lib/PostgresMigrations.js +110 -0
- package/lib/PostgresMigrations.js.map +1 -0
- package/lib/Providers.d.ts +38 -0
- package/lib/Providers.d.ts.map +1 -0
- package/lib/Providers.js +95 -0
- package/lib/Providers.js.map +1 -0
- package/lib/PutObject.d.ts +35 -0
- package/lib/PutObject.d.ts.map +1 -0
- package/lib/PutObject.js +3 -0
- package/lib/PutObject.js.map +1 -0
- package/lib/PutObjectHttp.d.ts +12 -0
- package/lib/PutObjectHttp.d.ts.map +1 -0
- package/lib/PutObjectHttp.js +17 -0
- package/lib/PutObjectHttp.js.map +1 -0
- package/lib/ReadRedis.d.ts +26 -0
- package/lib/ReadRedis.d.ts.map +1 -0
- package/lib/ReadRedis.js +3 -0
- package/lib/ReadRedis.js.map +1 -0
- package/lib/ReadRedisHttp.d.ts +11 -0
- package/lib/ReadRedisHttp.d.ts.map +1 -0
- package/lib/ReadRedisHttp.js +15 -0
- package/lib/ReadRedisHttp.js.map +1 -0
- package/lib/ReadWriteRedis.d.ts +29 -0
- package/lib/ReadWriteRedis.d.ts.map +1 -0
- package/lib/ReadWriteRedis.js +3 -0
- package/lib/ReadWriteRedis.js.map +1 -0
- package/lib/ReadWriteRedisHttp.d.ts +11 -0
- package/lib/ReadWriteRedisHttp.d.ts.map +1 -0
- package/lib/ReadWriteRedisHttp.js +15 -0
- package/lib/ReadWriteRedisHttp.js.map +1 -0
- package/lib/Redis.d.ts +252 -0
- package/lib/Redis.d.ts.map +1 -0
- package/lib/Redis.js +608 -0
- package/lib/Redis.js.map +1 -0
- package/lib/RedisBinding.d.ts +7 -0
- package/lib/RedisBinding.d.ts.map +1 -0
- package/lib/RedisBinding.js +53 -0
- package/lib/RedisBinding.js.map +1 -0
- package/lib/RedisHttp.d.ts +8 -0
- package/lib/RedisHttp.d.ts.map +1 -0
- package/lib/RedisHttp.js +8 -0
- package/lib/RedisHttp.js.map +1 -0
- package/lib/Region.d.ts +16 -0
- package/lib/Region.d.ts.map +1 -0
- package/lib/Region.js +13 -0
- package/lib/Region.js.map +1 -0
- package/lib/Secret.d.ts +190 -0
- package/lib/Secret.d.ts.map +1 -0
- package/lib/Secret.js +310 -0
- package/lib/Secret.js.map +1 -0
- package/lib/SecretHttp.d.ts +54 -0
- package/lib/SecretHttp.d.ts.map +1 -0
- package/lib/SecretHttp.js +66 -0
- package/lib/SecretHttp.js.map +1 -0
- package/lib/SecretKey.d.ts +164 -0
- package/lib/SecretKey.d.ts.map +1 -0
- package/lib/SecretKey.js +277 -0
- package/lib/SecretKey.js.map +1 -0
- package/lib/SecretKeyHttp.d.ts +14 -0
- package/lib/SecretKeyHttp.d.ts.map +1 -0
- package/lib/SecretKeyHttp.js +5 -0
- package/lib/SecretKeyHttp.js.map +1 -0
- package/lib/Service.d.ts +1022 -0
- package/lib/Service.d.ts.map +1 -0
- package/lib/Service.js +1397 -0
- package/lib/Service.js.map +1 -0
- package/lib/Sign.d.ts +36 -0
- package/lib/Sign.d.ts.map +1 -0
- package/lib/Sign.js +3 -0
- package/lib/Sign.js.map +1 -0
- package/lib/SignHttp.d.ts +22 -0
- package/lib/SignHttp.d.ts.map +1 -0
- package/lib/SignHttp.js +36 -0
- package/lib/SignHttp.js.map +1 -0
- package/lib/Sprite.d.ts +283 -0
- package/lib/Sprite.d.ts.map +1 -0
- package/lib/Sprite.js +469 -0
- package/lib/Sprite.js.map +1 -0
- package/lib/SpriteHttp.d.ts +25 -0
- package/lib/SpriteHttp.d.ts.map +1 -0
- package/lib/SpriteHttp.js +33 -0
- package/lib/SpriteHttp.js.map +1 -0
- package/lib/Verify.d.ts +37 -0
- package/lib/Verify.d.ts.map +1 -0
- package/lib/Verify.js +3 -0
- package/lib/Verify.js.map +1 -0
- package/lib/VerifyHttp.d.ts +22 -0
- package/lib/VerifyHttp.d.ts.map +1 -0
- package/lib/VerifyHttp.js +38 -0
- package/lib/VerifyHttp.js.map +1 -0
- package/lib/Volume.d.ts +53 -0
- package/lib/Volume.d.ts.map +1 -0
- package/lib/Volume.js +188 -0
- package/lib/Volume.js.map +1 -0
- package/lib/VolumeSnapshot.d.ts +135 -0
- package/lib/VolumeSnapshot.d.ts.map +1 -0
- package/lib/VolumeSnapshot.js +213 -0
- package/lib/VolumeSnapshot.js.map +1 -0
- package/lib/Website/AssetDeployment.d.ts +43 -0
- package/lib/Website/AssetDeployment.d.ts.map +1 -0
- package/lib/Website/AssetDeployment.js +162 -0
- package/lib/Website/AssetDeployment.js.map +1 -0
- package/lib/Website/Astro.d.ts +87 -0
- package/lib/Website/Astro.d.ts.map +1 -0
- package/lib/Website/Astro.js +55 -0
- package/lib/Website/Astro.js.map +1 -0
- package/lib/Website/Foldkit.d.ts +52 -0
- package/lib/Website/Foldkit.d.ts.map +1 -0
- package/lib/Website/Foldkit.js +45 -0
- package/lib/Website/Foldkit.js.map +1 -0
- package/lib/Website/FrameworkSite.d.ts +175 -0
- package/lib/Website/FrameworkSite.d.ts.map +1 -0
- package/lib/Website/FrameworkSite.js +162 -0
- package/lib/Website/FrameworkSite.js.map +1 -0
- package/lib/Website/Nextjs.d.ts +54 -0
- package/lib/Website/Nextjs.d.ts.map +1 -0
- package/lib/Website/Nextjs.js +46 -0
- package/lib/Website/Nextjs.js.map +1 -0
- package/lib/Website/Nuxt.d.ts +51 -0
- package/lib/Website/Nuxt.d.ts.map +1 -0
- package/lib/Website/Nuxt.js +36 -0
- package/lib/Website/Nuxt.js.map +1 -0
- package/lib/Website/Octane.d.ts +49 -0
- package/lib/Website/Octane.d.ts.map +1 -0
- package/lib/Website/Octane.js +39 -0
- package/lib/Website/Octane.js.map +1 -0
- package/lib/Website/ReactRouter.d.ts +80 -0
- package/lib/Website/ReactRouter.d.ts.map +1 -0
- package/lib/Website/ReactRouter.js +70 -0
- package/lib/Website/ReactRouter.js.map +1 -0
- package/lib/Website/SolidStart.d.ts +93 -0
- package/lib/Website/SolidStart.d.ts.map +1 -0
- package/lib/Website/SolidStart.js +71 -0
- package/lib/Website/SolidStart.js.map +1 -0
- package/lib/Website/StaticSite.d.ts +155 -0
- package/lib/Website/StaticSite.d.ts.map +1 -0
- package/lib/Website/StaticSite.js +168 -0
- package/lib/Website/StaticSite.js.map +1 -0
- package/lib/Website/SvelteKit.d.ts +52 -0
- package/lib/Website/SvelteKit.d.ts.map +1 -0
- package/lib/Website/SvelteKit.js +37 -0
- package/lib/Website/SvelteKit.js.map +1 -0
- package/lib/Website/TanStackStart.d.ts +76 -0
- package/lib/Website/TanStackStart.d.ts.map +1 -0
- package/lib/Website/TanStackStart.js +66 -0
- package/lib/Website/TanStackStart.js.map +1 -0
- package/lib/Website/Vinext.d.ts +73 -0
- package/lib/Website/Vinext.d.ts.map +1 -0
- package/lib/Website/Vinext.js +67 -0
- package/lib/Website/Vinext.js.map +1 -0
- package/lib/Website/Vite.d.ts +103 -0
- package/lib/Website/Vite.d.ts.map +1 -0
- package/lib/Website/Vite.js +91 -0
- package/lib/Website/Vite.js.map +1 -0
- package/lib/Website/Vocs.d.ts +52 -0
- package/lib/Website/Vocs.d.ts.map +1 -0
- package/lib/Website/Vocs.js +38 -0
- package/lib/Website/Vocs.js.map +1 -0
- package/lib/Website/Waku.d.ts +64 -0
- package/lib/Website/Waku.d.ts.map +1 -0
- package/lib/Website/Waku.js +39 -0
- package/lib/Website/Waku.js.map +1 -0
- package/lib/Website/index.d.ts +17 -0
- package/lib/Website/index.d.ts.map +1 -0
- package/lib/Website/index.js +17 -0
- package/lib/Website/index.js.map +1 -0
- package/lib/WriteCertificates.d.ts +63 -0
- package/lib/WriteCertificates.d.ts.map +1 -0
- package/lib/WriteCertificates.js +3 -0
- package/lib/WriteCertificates.js.map +1 -0
- package/lib/WriteCertificatesHttp.d.ts +25 -0
- package/lib/WriteCertificatesHttp.d.ts.map +1 -0
- package/lib/WriteCertificatesHttp.js +67 -0
- package/lib/WriteCertificatesHttp.js.map +1 -0
- package/lib/WriteRedis.d.ts +26 -0
- package/lib/WriteRedis.d.ts.map +1 -0
- package/lib/WriteRedis.js +3 -0
- package/lib/WriteRedis.js.map +1 -0
- package/lib/WriteRedisHttp.d.ts +11 -0
- package/lib/WriteRedisHttp.d.ts.map +1 -0
- package/lib/WriteRedisHttp.js +15 -0
- package/lib/WriteRedisHttp.js.map +1 -0
- package/lib/WriteSecret.d.ts +68 -0
- package/lib/WriteSecret.d.ts.map +1 -0
- package/lib/WriteSecret.js +4 -0
- package/lib/WriteSecret.js.map +1 -0
- package/lib/WriteSecretHttp.d.ts +26 -0
- package/lib/WriteSecretHttp.d.ts.map +1 -0
- package/lib/WriteSecretHttp.js +54 -0
- package/lib/WriteSecretHttp.js.map +1 -0
- package/lib/bluegreen.d.ts +36 -0
- package/lib/bluegreen.d.ts.map +1 -0
- package/lib/bluegreen.js +458 -0
- package/lib/bluegreen.js.map +1 -0
- package/lib/hosted.d.ts +172 -0
- package/lib/hosted.d.ts.map +1 -0
- package/lib/hosted.js +458 -0
- package/lib/hosted.js.map +1 -0
- package/lib/index.d.ts +65 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +63 -0
- package/lib/index.js.map +1 -0
- package/lib/internal/RemoteBuilder.d.ts +28 -0
- package/lib/internal/RemoteBuilder.d.ts.map +1 -0
- package/lib/internal/RemoteBuilder.js +145 -0
- package/lib/internal/RemoteBuilder.js.map +1 -0
- package/lib/leases.d.ts +53 -0
- package/lib/leases.d.ts.map +1 -0
- package/lib/leases.js +279 -0
- package/lib/leases.js.map +1 -0
- package/lib/ports.d.ts +51 -0
- package/lib/ports.d.ts.map +1 -0
- package/lib/ports.js +123 -0
- package/lib/ports.js.map +1 -0
- package/lib/replicas.d.ts +270 -0
- package/lib/replicas.d.ts.map +1 -0
- package/lib/replicas.js +969 -0
- package/lib/replicas.js.map +1 -0
- package/lib/rpc.d.ts +35 -0
- package/lib/rpc.d.ts.map +1 -0
- package/lib/rpc.js +113 -0
- package/lib/rpc.js.map +1 -0
- package/package.json +97 -3
- package/src/App.ts +516 -0
- package/src/AuthProvider.ts +68 -0
- package/src/BindService.ts +304 -0
- package/src/Bootstrap.ts +66 -0
- package/src/Bucket.ts +916 -0
- package/src/BucketBinding.ts +128 -0
- package/src/Catalog.ts +43 -0
- package/src/Certificate.ts +548 -0
- package/src/Checkpoint.ts +69 -0
- package/src/CheckpointHttp.ts +66 -0
- package/src/ConnectPostgres.ts +68 -0
- package/src/ConnectPostgresHttp.ts +77 -0
- package/src/Contributions.ts +9 -0
- package/src/Credentials.ts +102 -0
- package/src/Decrypt.ts +62 -0
- package/src/DecryptHttp.ts +52 -0
- package/src/DeleteObject.ts +43 -0
- package/src/DeleteObjectHttp.ts +20 -0
- package/src/Deployment.ts +121 -0
- package/src/DeploymentImages.ts +84 -0
- package/src/DeploymentState.ts +104 -0
- package/src/Encrypt.ts +60 -0
- package/src/EncryptHttp.ts +48 -0
- package/src/Environment.ts +81 -0
- package/src/Errors.ts +14 -0
- package/src/Exec.ts +50 -0
- package/src/ExecHttp.ts +47 -0
- package/src/GetObject.ts +48 -0
- package/src/GetObjectHttp.ts +20 -0
- package/src/GetSecret.ts +48 -0
- package/src/GetSecretHttp.ts +60 -0
- package/src/HeadObject.ts +43 -0
- package/src/HeadObjectHttp.ts +20 -0
- package/src/IpAssignment.ts +522 -0
- package/src/ListObjectsV2.ts +43 -0
- package/src/ListObjectsV2Http.ts +20 -0
- package/src/ListSecrets.ts +57 -0
- package/src/ListSecretsHttp.ts +43 -0
- package/src/Machine.ts +1268 -0
- package/src/MachineContainers.ts +152 -0
- package/src/Metadata.ts +195 -0
- package/src/MountVolume.ts +315 -0
- package/src/Postgres.ts +777 -0
- package/src/PostgresMigrations.ts +153 -0
- package/src/Providers.ts +155 -0
- package/src/PutObject.ts +49 -0
- package/src/PutObjectHttp.ts +20 -0
- package/src/ReadRedis.ts +31 -0
- package/src/ReadRedisHttp.ts +18 -0
- package/src/ReadWriteRedis.ts +33 -0
- package/src/ReadWriteRedisHttp.ts +18 -0
- package/src/Redis.ts +820 -0
- package/src/RedisBinding.ts +64 -0
- package/src/RedisHttp.ts +11 -0
- package/src/Region.ts +44 -0
- package/src/Secret.ts +405 -0
- package/src/SecretHttp.ts +149 -0
- package/src/SecretKey.ts +389 -0
- package/src/SecretKeyHttp.ts +23 -0
- package/src/Service.ts +1934 -0
- package/src/Sign.ts +46 -0
- package/src/SignHttp.ts +44 -0
- package/src/Sprite.ts +671 -0
- package/src/SpriteHttp.ts +50 -0
- package/src/Verify.ts +47 -0
- package/src/VerifyHttp.ts +46 -0
- package/src/Volume.ts +264 -0
- package/src/VolumeSnapshot.ts +321 -0
- package/src/Website/AssetDeployment.ts +294 -0
- package/src/Website/Astro.ts +87 -0
- package/src/Website/Foldkit.ts +54 -0
- package/src/Website/FrameworkSite.ts +363 -0
- package/src/Website/Nextjs.ts +50 -0
- package/src/Website/Nuxt.ts +48 -0
- package/src/Website/Octane.ts +44 -0
- package/src/Website/ReactRouter.ts +76 -0
- package/src/Website/SolidStart.ts +90 -0
- package/src/Website/StaticSite.ts +275 -0
- package/src/Website/SvelteKit.ts +49 -0
- package/src/Website/TanStackStart.ts +72 -0
- package/src/Website/Vinext.ts +79 -0
- package/src/Website/Vite.ts +112 -0
- package/src/Website/Vocs.ts +50 -0
- package/src/Website/Waku.ts +65 -0
- package/src/Website/index.ts +16 -0
- package/src/WriteCertificates.ts +90 -0
- package/src/WriteCertificatesHttp.ts +93 -0
- package/src/WriteRedis.ts +31 -0
- package/src/WriteRedisHttp.ts +18 -0
- package/src/WriteSecret.ts +86 -0
- package/src/WriteSecretHttp.ts +71 -0
- package/src/bluegreen.ts +708 -0
- package/src/globals.d.ts +2 -0
- package/src/hosted.ts +668 -0
- package/src/index.ts +64 -0
- package/src/internal/RemoteBuilder.ts +224 -0
- package/src/leases.ts +437 -0
- package/src/ports.ts +177 -0
- package/src/replicas.ts +1480 -0
- package/src/rpc.ts +136 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { FlyMachineConfig } from "@distilled.cloud/fly-io/machines";
|
|
2
|
+
import { pinsFromConfig, sameImageSet, validObservedImageSet } from "./DeploymentImages.ts";
|
|
3
|
+
import { alchemyMetadataKeys as keys } from "./Metadata.ts";
|
|
4
|
+
|
|
5
|
+
type DeploymentState = { protocol: "legacy" | "1" | "2" } | { protocol: "invalid"; reason: string };
|
|
6
|
+
|
|
7
|
+
/** Observation and reconciliation must agree before treating a Machine as legacy. */
|
|
8
|
+
export const classifyDeploymentState = (machine: {
|
|
9
|
+
config?: FlyMachineConfig;
|
|
10
|
+
}): DeploymentState => {
|
|
11
|
+
const metadata = machine.config?.metadata;
|
|
12
|
+
const protocol = metadata?.[keys.protocol];
|
|
13
|
+
if (protocol !== undefined && protocol !== "1" && protocol !== "2")
|
|
14
|
+
return {
|
|
15
|
+
protocol: "invalid",
|
|
16
|
+
reason: `Unknown deployment protocol ${protocol}.`,
|
|
17
|
+
};
|
|
18
|
+
if (protocol !== "2" && metadata?.[keys.containerImageSet] !== undefined)
|
|
19
|
+
return {
|
|
20
|
+
protocol: "invalid",
|
|
21
|
+
reason: "Container image metadata requires deployment protocol 2.",
|
|
22
|
+
};
|
|
23
|
+
if (protocol === "2")
|
|
24
|
+
return validProtocol2RecoveryMetadata(machine)
|
|
25
|
+
? { protocol }
|
|
26
|
+
: {
|
|
27
|
+
protocol: "invalid",
|
|
28
|
+
reason: "Invalid protocol-2 image set or recovery metadata.",
|
|
29
|
+
};
|
|
30
|
+
if (protocol === "1") {
|
|
31
|
+
const replica = metadata?.[keys.replica] ?? "";
|
|
32
|
+
if (
|
|
33
|
+
!/^(0|[1-9]\d*)$/.test(replica) ||
|
|
34
|
+
!Number.isSafeInteger(Number(replica)) ||
|
|
35
|
+
!["candidate", "promoting", "validating", "active", "retiring"].includes(
|
|
36
|
+
metadata?.[keys.phase] ?? "",
|
|
37
|
+
)
|
|
38
|
+
)
|
|
39
|
+
return {
|
|
40
|
+
protocol: "invalid",
|
|
41
|
+
reason: "Invalid protocol-1 replica index or deployment phase.",
|
|
42
|
+
};
|
|
43
|
+
return { protocol };
|
|
44
|
+
}
|
|
45
|
+
return { protocol: "legacy" };
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** Required recovery fields for a complete protocol-2 generation member. */
|
|
49
|
+
const validProtocol2RecoveryMetadata = (machine: { config?: FlyMachineConfig }): boolean => {
|
|
50
|
+
if (!validObservedImageSet(machine)) return false;
|
|
51
|
+
const recorded = machine.config?.metadata;
|
|
52
|
+
const countText = recorded?.[keys.count] ?? "";
|
|
53
|
+
const sequenceText = recorded?.[keys.sequence] ?? "";
|
|
54
|
+
const replicaText = recorded?.[keys.replica] ?? "";
|
|
55
|
+
const count = Number(countText);
|
|
56
|
+
const index = Number(replicaText);
|
|
57
|
+
const roles = (recorded?.[keys.roles] ?? "").split(",");
|
|
58
|
+
return (
|
|
59
|
+
Boolean(recorded?.[keys.generation]?.trim()) &&
|
|
60
|
+
Boolean(recorded?.[keys.workload]?.trim()) &&
|
|
61
|
+
/^[1-9]\d*$/.test(countText) &&
|
|
62
|
+
Number.isSafeInteger(count) &&
|
|
63
|
+
/^[1-9]\d*$/.test(sequenceText) &&
|
|
64
|
+
Number.isSafeInteger(Number(sequenceText)) &&
|
|
65
|
+
/^(0|[1-9]\d*)$/.test(replicaText) &&
|
|
66
|
+
Number.isSafeInteger(index) &&
|
|
67
|
+
index < count &&
|
|
68
|
+
roles.length === count &&
|
|
69
|
+
roles.includes("run") &&
|
|
70
|
+
roles.every((role) => role === "run" || role === "idle") &&
|
|
71
|
+
recorded?.[keys.role] === roles[index] &&
|
|
72
|
+
["candidate", "promoting", "validating", "active", "retiring"].includes(
|
|
73
|
+
recorded?.[keys.phase] ?? "",
|
|
74
|
+
) &&
|
|
75
|
+
["true", "false"].includes(recorded?.[keys.restored] ?? "")
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/** A partial protocol-2 generation is valid only when every member agrees on its identity. */
|
|
80
|
+
export const validProtocol2Generation = (
|
|
81
|
+
group: readonly { config?: FlyMachineConfig }[],
|
|
82
|
+
): boolean => {
|
|
83
|
+
const first = group[0]?.config?.metadata;
|
|
84
|
+
if (!first || group.length === 0) return false;
|
|
85
|
+
const indices = new Set<string>();
|
|
86
|
+
for (const machine of group) {
|
|
87
|
+
const metadata = machine.config?.metadata;
|
|
88
|
+
const replica = metadata?.[keys.replica];
|
|
89
|
+
if (
|
|
90
|
+
!validProtocol2RecoveryMetadata(machine) ||
|
|
91
|
+
metadata?.[keys.generation] !== first[keys.generation] ||
|
|
92
|
+
metadata?.[keys.count] !== first[keys.count] ||
|
|
93
|
+
metadata?.[keys.sequence] !== first[keys.sequence] ||
|
|
94
|
+
metadata?.[keys.workload] !== first[keys.workload] ||
|
|
95
|
+
metadata?.[keys.roles] !== first[keys.roles] ||
|
|
96
|
+
replica === undefined ||
|
|
97
|
+
indices.has(replica) ||
|
|
98
|
+
!sameImageSet(pinsFromConfig(machine.config), pinsFromConfig(group[0]?.config))
|
|
99
|
+
)
|
|
100
|
+
return false;
|
|
101
|
+
indices.add(replica);
|
|
102
|
+
}
|
|
103
|
+
return true;
|
|
104
|
+
};
|
package/src/Encrypt.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { EncryptSecretKeyError } from "@distilled.cloud/fly-io/machines";
|
|
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 { SecretKey } from "./SecretKey.ts";
|
|
6
|
+
|
|
7
|
+
export interface EncryptRequest {
|
|
8
|
+
/** Bytes to encrypt. */
|
|
9
|
+
plaintext: Uint8Array | ArrayLike<number>;
|
|
10
|
+
/** Optional AEAD associated data. */
|
|
11
|
+
associatedData?: Uint8Array | ArrayLike<number>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface EncryptResult {
|
|
15
|
+
ciphertext: Uint8Array;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Encrypt with a Fly {@link SecretKey} (`nacl_box`, `nacl_secretbox`,
|
|
20
|
+
* `xaes256gcm`, …). The App and key name are fixed by `Encrypt(key)`.
|
|
21
|
+
*
|
|
22
|
+
*
|
|
23
|
+
* ### Encrypt a payload
|
|
24
|
+
* Provide {@link EncryptHttp} on the Action or Service Effect. Fly
|
|
25
|
+
* crypto ops need a KMS token. Org API tokens are typed `Forbidden`.
|
|
26
|
+
*
|
|
27
|
+
* **Example:** Encrypt
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const encrypt = yield* Fly.Encrypt(Box);
|
|
30
|
+
* const { ciphertext } = yield* encrypt({
|
|
31
|
+
* plaintext: new TextEncoder().encode("attack at dawn"),
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* ### Associated data
|
|
36
|
+
* `associatedData` is optional AEAD associated data. {@link Decrypt}
|
|
37
|
+
* must pass the same bytes.
|
|
38
|
+
*
|
|
39
|
+
* **Example:** AEAD
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const { ciphertext } = yield* encrypt({
|
|
42
|
+
* plaintext: bytes,
|
|
43
|
+
* associatedData: nonce,
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @binding
|
|
48
|
+
* @product Secret Key
|
|
49
|
+
*/
|
|
50
|
+
export interface Encrypt extends Binding.Service<
|
|
51
|
+
Encrypt,
|
|
52
|
+
"Fly.Encrypt",
|
|
53
|
+
(
|
|
54
|
+
key: SecretKey,
|
|
55
|
+
) => Effect.Effect<
|
|
56
|
+
(request: EncryptRequest) => Effect.Effect<EncryptResult, EncryptSecretKeyError, RuntimeContext>
|
|
57
|
+
>
|
|
58
|
+
> {}
|
|
59
|
+
|
|
60
|
+
export const Encrypt = Binding.Service<Encrypt>("Fly.Encrypt");
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as machines from "@distilled.cloud/fly-io/machines";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
4
|
+
import * as Layer from "effect/Layer";
|
|
5
|
+
import { CredentialsFromAmbientOrEnv } from "./Credentials.ts";
|
|
6
|
+
import { Encrypt, type EncryptRequest } from "./Encrypt.ts";
|
|
7
|
+
import { base64ToBytes, bytesToBase64, makeHttpSecretKeyBinding } from "./SecretKeyHttp.ts";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* HTTP implementation of {@link Encrypt}. Provide it on the
|
|
11
|
+
* {@link Service} or Action Effect.
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
* ### Provide the layer
|
|
15
|
+
* **Example:** On a Service
|
|
16
|
+
* ```typescript
|
|
17
|
+
* Effect.gen(function* () {
|
|
18
|
+
* const encrypt = yield* Fly.Encrypt(Box);
|
|
19
|
+
* // ...
|
|
20
|
+
* }).pipe(Effect.provide(Fly.EncryptHttp))
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @layer
|
|
24
|
+
* @product Secret Key
|
|
25
|
+
* @provides Fly.Encrypt
|
|
26
|
+
*/
|
|
27
|
+
export const EncryptHttp = Layer.effect(
|
|
28
|
+
Encrypt,
|
|
29
|
+
Effect.suspend(() =>
|
|
30
|
+
makeHttpSecretKeyBinding({
|
|
31
|
+
makeClient: (auth, appName, secretName) =>
|
|
32
|
+
Effect.fn("Fly.Encrypt")(function* (request: EncryptRequest) {
|
|
33
|
+
const res = yield* auth.authorize(
|
|
34
|
+
machines.encryptSecretKey({
|
|
35
|
+
app_name: yield* appName,
|
|
36
|
+
secret_name: yield* secretName,
|
|
37
|
+
plaintext: bytesToBase64(request.plaintext),
|
|
38
|
+
associated_data:
|
|
39
|
+
request.associatedData === undefined
|
|
40
|
+
? undefined
|
|
41
|
+
: bytesToBase64(request.associatedData),
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
44
|
+
return { ciphertext: base64ToBytes(res.ciphertext) };
|
|
45
|
+
}),
|
|
46
|
+
}),
|
|
47
|
+
),
|
|
48
|
+
).pipe(Layer.provide(FetchHttpClient.layer), Layer.provide(CredentialsFromAmbientOrEnv));
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Config } from "@distilled.cloud/fly-io";
|
|
2
|
+
import { Credentials } from "@distilled.cloud/fly-io";
|
|
3
|
+
import * as machines from "@distilled.cloud/fly-io/machines";
|
|
4
|
+
import * as Context from "effect/Context";
|
|
5
|
+
import * as Data from "effect/Data";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
8
|
+
import * as Layer from "effect/Layer";
|
|
9
|
+
|
|
10
|
+
export class FlyOrgNotFound extends Data.TaggedError("Fly.OrgNotFound")<{
|
|
11
|
+
message: string;
|
|
12
|
+
}> {}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Fully-resolved Fly.io environment for a stack.
|
|
16
|
+
*
|
|
17
|
+
* `{ apiKey, apiBaseUrl }` comes from distilled `Credentials`. `orgSlug` is
|
|
18
|
+
* the current token's organization (`getCurrentToken` → `tokens[0].org_slug`),
|
|
19
|
+
* cached for the process. Resolve it inside lifecycle operations with
|
|
20
|
+
* `FlyEnvironment.current`.
|
|
21
|
+
*/
|
|
22
|
+
export type FlyEnvironmentShape = Config & {
|
|
23
|
+
readonly orgSlug: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export class FlyEnvironment extends Context.Service<
|
|
27
|
+
FlyEnvironment,
|
|
28
|
+
Effect.Effect<FlyEnvironmentShape>
|
|
29
|
+
>()("Fly::Environment") {
|
|
30
|
+
static current = FlyEnvironment.use((env) => env);
|
|
31
|
+
readonly kind = "Environment" as const;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Discover the current token's organization slug via `getCurrentToken`.
|
|
36
|
+
* Used by {@link fromCredentials} and by {@link Catalog.currentOrgSlug}.
|
|
37
|
+
*/
|
|
38
|
+
export const resolveOrgSlug = Effect.fn(function* () {
|
|
39
|
+
const info = yield* machines.getCurrentToken({});
|
|
40
|
+
const orgSlug = info.tokens?.[0]?.org_slug;
|
|
41
|
+
if (orgSlug === undefined || orgSlug.length === 0) {
|
|
42
|
+
return yield* new FlyOrgNotFound({
|
|
43
|
+
message: "Fly current token did not include an organization slug.",
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return orgSlug;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Build a `FlyEnvironment` layer from the distilled `Credentials`
|
|
51
|
+
* service. Provide this after `Credentials.fromAuthProvider()`.
|
|
52
|
+
*
|
|
53
|
+
* `orgSlug` is resolved from `getCurrentToken` and cached so App.list /
|
|
54
|
+
* Catalog do not re-hit `/tokens/current` on every call.
|
|
55
|
+
*/
|
|
56
|
+
export const fromCredentials = () =>
|
|
57
|
+
Layer.effect(
|
|
58
|
+
FlyEnvironment,
|
|
59
|
+
Effect.gen(function* () {
|
|
60
|
+
const creds = yield* Credentials;
|
|
61
|
+
const http = yield* HttpClient.HttpClient;
|
|
62
|
+
return yield* creds.pipe(
|
|
63
|
+
Effect.flatMap((resolved) =>
|
|
64
|
+
resolveOrgSlug().pipe(
|
|
65
|
+
Effect.provide(
|
|
66
|
+
Layer.mergeAll(
|
|
67
|
+
Layer.succeed(Credentials, creds),
|
|
68
|
+
Layer.succeed(HttpClient.HttpClient, http),
|
|
69
|
+
),
|
|
70
|
+
),
|
|
71
|
+
Effect.map((orgSlug) => ({
|
|
72
|
+
...resolved,
|
|
73
|
+
orgSlug,
|
|
74
|
+
})),
|
|
75
|
+
),
|
|
76
|
+
),
|
|
77
|
+
Effect.orDie,
|
|
78
|
+
Effect.cached,
|
|
79
|
+
);
|
|
80
|
+
}),
|
|
81
|
+
);
|
package/src/Errors.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as Data from "effect/Data";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A {@link Bucket}'s Tigris credentials could not be resolved when a
|
|
5
|
+
* bound S3 operation ran.
|
|
6
|
+
*
|
|
7
|
+
* Tigris hands out the access key pair once, at add-on creation. If the
|
|
8
|
+
* Bucket attributes reaching the binding carry no key pair — an adopted
|
|
9
|
+
* bucket, or one whose create-only secrets were never persisted — the
|
|
10
|
+
* operation fails with this instead of signing an anonymous request.
|
|
11
|
+
*/
|
|
12
|
+
export class TigrisCredentialsMissing extends Data.TaggedError("Fly.TigrisCredentialsMissing")<{
|
|
13
|
+
name: string;
|
|
14
|
+
}> {}
|
package/src/Exec.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ExecCommandError, ExecResult } from "@distilled.cloud/fly-io/sprites";
|
|
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 { Sprite } from "./Sprite.ts";
|
|
6
|
+
|
|
7
|
+
export interface ExecRequest {
|
|
8
|
+
/** Command and args. */
|
|
9
|
+
cmd: string[];
|
|
10
|
+
/** Explicit path to the executable. */
|
|
11
|
+
path?: string;
|
|
12
|
+
/** Read stdin from {@link body}. */
|
|
13
|
+
stdin?: boolean;
|
|
14
|
+
/** Environment variables as `KEY=VALUE`. */
|
|
15
|
+
env?: string[];
|
|
16
|
+
/** Working directory. */
|
|
17
|
+
dir?: string;
|
|
18
|
+
/** Stdin bytes when {@link stdin} is true. */
|
|
19
|
+
body?: Uint8Array | string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Run a command on a {@link Sprite} via `POST /sprites/{name}/exec`.
|
|
24
|
+
*
|
|
25
|
+
*
|
|
26
|
+
* ### Exec a command
|
|
27
|
+
* Bind the client in init. Provide {@link ExecHttp}. The Sprite name
|
|
28
|
+
* is fixed by `Exec(box)`. Alchemy transports that name and the
|
|
29
|
+
* deployment's org token to the caller automatically.
|
|
30
|
+
*
|
|
31
|
+
* **Example:** List files
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const exec = yield* Fly.Exec(Box);
|
|
34
|
+
* const result = yield* exec({ cmd: ["ls", "-la"] });
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @binding
|
|
38
|
+
* @product Sprite
|
|
39
|
+
*/
|
|
40
|
+
export interface Exec extends Binding.Service<
|
|
41
|
+
Exec,
|
|
42
|
+
"Fly.Exec",
|
|
43
|
+
(
|
|
44
|
+
sprite: Sprite,
|
|
45
|
+
) => Effect.Effect<
|
|
46
|
+
(request: ExecRequest) => Effect.Effect<ExecResult, ExecCommandError, RuntimeContext>
|
|
47
|
+
>
|
|
48
|
+
> {}
|
|
49
|
+
|
|
50
|
+
export const Exec = Binding.Service<Exec>("Fly.Exec");
|
package/src/ExecHttp.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as sprites from "@distilled.cloud/fly-io/sprites";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
4
|
+
import * as Layer from "effect/Layer";
|
|
5
|
+
import { CredentialsFromAmbientOrEnv } from "./Credentials.ts";
|
|
6
|
+
import { Exec, type ExecRequest } from "./Exec.ts";
|
|
7
|
+
import { makeHttpSpriteBinding } from "./SpriteHttp.ts";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* HTTP implementation of {@link Exec}. Provide it on the
|
|
11
|
+
* {@link Sprite}, {@link Service}, or Action Effect.
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
* ### Provide the layer
|
|
15
|
+
* **Example:** On a Sprite
|
|
16
|
+
* ```typescript
|
|
17
|
+
* Effect.gen(function* () {
|
|
18
|
+
* const exec = yield* Fly.Exec(Box);
|
|
19
|
+
* // ...
|
|
20
|
+
* }).pipe(Effect.provide(Fly.ExecHttp))
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @layer
|
|
24
|
+
* @product Sprite
|
|
25
|
+
* @provides Fly.Exec
|
|
26
|
+
*/
|
|
27
|
+
export const ExecHttp = Layer.effect(
|
|
28
|
+
Exec,
|
|
29
|
+
Effect.suspend(() =>
|
|
30
|
+
makeHttpSpriteBinding({
|
|
31
|
+
makeClient: (auth, spriteName) =>
|
|
32
|
+
Effect.fn("Fly.Exec")(function* (request: ExecRequest) {
|
|
33
|
+
return yield* auth.authorize(
|
|
34
|
+
sprites.execCommand({
|
|
35
|
+
name: yield* spriteName,
|
|
36
|
+
cmd: request.cmd,
|
|
37
|
+
path: request.path,
|
|
38
|
+
stdin: request.stdin,
|
|
39
|
+
env: request.env,
|
|
40
|
+
dir: request.dir,
|
|
41
|
+
body: request.body,
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
44
|
+
}),
|
|
45
|
+
}),
|
|
46
|
+
),
|
|
47
|
+
).pipe(Layer.provide(FetchHttpClient.layer), Layer.provide(CredentialsFromAmbientOrEnv));
|
package/src/GetObject.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type * as S3 from "@distilled.cloud/aws/s3";
|
|
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 { Bucket } from "./Bucket.ts";
|
|
6
|
+
import type { TigrisCredentialsMissing } from "./Errors.ts";
|
|
7
|
+
|
|
8
|
+
export interface GetObjectRequest extends Omit<S3.GetObjectRequest, "Bucket"> {}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Runtime binding for Tigris `GetObject` over the S3 API.
|
|
12
|
+
*
|
|
13
|
+
* Bind this operation to a {@link Bucket} in Service init. Provide
|
|
14
|
+
* {@link GetObjectHttp}.
|
|
15
|
+
*
|
|
16
|
+
*
|
|
17
|
+
* ### Reading Objects
|
|
18
|
+
* **Example:** Read an Object and Decode Its Body
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const getObject = yield* Fly.GetObject(Data);
|
|
21
|
+
*
|
|
22
|
+
* const text = yield* getObject({ Key: "hello.txt" }).pipe(
|
|
23
|
+
* Effect.flatMap((result) =>
|
|
24
|
+
* Stream.mkString(Stream.decodeText(result.Body!)),
|
|
25
|
+
* ),
|
|
26
|
+
* );
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @binding
|
|
30
|
+
* @product Bucket
|
|
31
|
+
*/
|
|
32
|
+
export interface GetObject extends Binding.Service<
|
|
33
|
+
GetObject,
|
|
34
|
+
"Fly.GetObject",
|
|
35
|
+
(
|
|
36
|
+
bucket: Bucket,
|
|
37
|
+
) => Effect.Effect<
|
|
38
|
+
(
|
|
39
|
+
request: GetObjectRequest,
|
|
40
|
+
) => Effect.Effect<
|
|
41
|
+
S3.GetObjectOutput,
|
|
42
|
+
S3.GetObjectError | TigrisCredentialsMissing,
|
|
43
|
+
RuntimeContext
|
|
44
|
+
>
|
|
45
|
+
>
|
|
46
|
+
> {}
|
|
47
|
+
|
|
48
|
+
export const GetObject = Binding.Service<GetObject>("Fly.GetObject");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as S3 from "@distilled.cloud/aws/s3";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
import { makeTigrisS3Binding } from "./BucketBinding.ts";
|
|
4
|
+
import { GetObject } from "./GetObject.ts";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* HTTP implementation of {@link GetObject}. Calls distilled S3
|
|
8
|
+
* `getObject` against the Tigris endpoint with the bucket's credentials.
|
|
9
|
+
*
|
|
10
|
+
* @layer
|
|
11
|
+
* @product Bucket
|
|
12
|
+
* @provides Fly.GetObject
|
|
13
|
+
*/
|
|
14
|
+
export const GetObjectHttp = Layer.effect(
|
|
15
|
+
GetObject,
|
|
16
|
+
makeTigrisS3Binding({
|
|
17
|
+
tag: "Fly.GetObject",
|
|
18
|
+
operation: S3.getObject,
|
|
19
|
+
}),
|
|
20
|
+
);
|
package/src/GetSecret.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { AppSecret, GetSecretError } from "@distilled.cloud/fly-io/machines";
|
|
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 { Secret } from "./Secret.ts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Fetch one Fly.io App secret. The App and name are fixed by
|
|
9
|
+
* `GetSecret(secret)`. Calls take no `app_name`.
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* ### Read a secret
|
|
13
|
+
* Bind the client in init. Call it from `fetch` or an Action body.
|
|
14
|
+
* Provide {@link GetSecretHttp}. Alchemy transports the bound App name,
|
|
15
|
+
* secret name, and deployment's org token automatically. There is no
|
|
16
|
+
* need to configure `FLY_SECRET_*` environment variables.
|
|
17
|
+
*
|
|
18
|
+
* Fly only returns plaintext from a Machine in the same App. From a
|
|
19
|
+
* deploy-time Action you get metadata (name, digest, timestamps).
|
|
20
|
+
*
|
|
21
|
+
* **Example:** GetSecret
|
|
22
|
+
* ```typescript
|
|
23
|
+
* export default class Api extends Fly.Service<Api>()(
|
|
24
|
+
* "Api",
|
|
25
|
+
* { app: Site, main: import.meta.url, port: 3000 },
|
|
26
|
+
* Effect.gen(function* () {
|
|
27
|
+
* const get = yield* Fly.GetSecret(ApiToken);
|
|
28
|
+
*
|
|
29
|
+
* return {
|
|
30
|
+
* fetch: Effect.gen(function* () {
|
|
31
|
+
* const got = yield* get().pipe(Effect.orDie);
|
|
32
|
+
* return HttpServerResponse.json({ name: got.name });
|
|
33
|
+
* }),
|
|
34
|
+
* };
|
|
35
|
+
* }).pipe(Effect.provide(Fly.GetSecretHttp)),
|
|
36
|
+
* ) {}
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @binding
|
|
40
|
+
* @product Secret
|
|
41
|
+
*/
|
|
42
|
+
export interface GetSecret extends Binding.Service<
|
|
43
|
+
GetSecret,
|
|
44
|
+
"Fly.GetSecret",
|
|
45
|
+
(secret: Secret) => Effect.Effect<() => Effect.Effect<AppSecret, GetSecretError, RuntimeContext>>
|
|
46
|
+
> {}
|
|
47
|
+
|
|
48
|
+
export const GetSecret = Binding.Service<GetSecret>("Fly.GetSecret");
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as machines from "@distilled.cloud/fly-io/machines";
|
|
2
|
+
import * as Config from "effect/Config";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
5
|
+
import * as Layer from "effect/Layer";
|
|
6
|
+
import * as Redacted from "effect/Redacted";
|
|
7
|
+
import { CredentialsFromAmbientOrEnv } from "./Credentials.ts";
|
|
8
|
+
import { GetSecret } from "./GetSecret.ts";
|
|
9
|
+
import { makeHttpSecretBinding } from "./SecretHttp.ts";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* HTTP implementation of {@link GetSecret}. Provide it on the
|
|
13
|
+
* {@link Service} or Action Effect.
|
|
14
|
+
*
|
|
15
|
+
*
|
|
16
|
+
* ### Provide the layer
|
|
17
|
+
* **Example:** On a Service
|
|
18
|
+
* ```typescript
|
|
19
|
+
* Effect.gen(function* () {
|
|
20
|
+
* const get = yield* Fly.GetSecret(ApiToken);
|
|
21
|
+
* // ...
|
|
22
|
+
* }).pipe(Effect.provide(Fly.GetSecretHttp))
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @layer
|
|
26
|
+
* @product Secret
|
|
27
|
+
* @provides Fly.GetSecret
|
|
28
|
+
*/
|
|
29
|
+
export const GetSecretHttp = Layer.effect(
|
|
30
|
+
GetSecret,
|
|
31
|
+
Effect.suspend(() =>
|
|
32
|
+
makeHttpSecretBinding({
|
|
33
|
+
makeClient: (auth, appName, secretName) =>
|
|
34
|
+
Effect.fn("Fly.GetSecret")(function* () {
|
|
35
|
+
const name = yield* secretName;
|
|
36
|
+
if (globalThis.__ALCHEMY_RUNTIME__) {
|
|
37
|
+
// Fly injects App secrets as env vars on the Machine. Prefer
|
|
38
|
+
// that over getSecret — org tokens still cannot read plaintext
|
|
39
|
+
// from outside the App, and the env is already the source of
|
|
40
|
+
// truth once the secret exists.
|
|
41
|
+
const fromEnv = yield* Config.Redacted(name).pipe(
|
|
42
|
+
Effect.map((value) => ({
|
|
43
|
+
name,
|
|
44
|
+
value: Redacted.value(value),
|
|
45
|
+
})),
|
|
46
|
+
Effect.orElseSucceed(() => undefined),
|
|
47
|
+
);
|
|
48
|
+
if (fromEnv !== undefined) return fromEnv;
|
|
49
|
+
}
|
|
50
|
+
return yield* auth.authorize(
|
|
51
|
+
machines.getSecret({
|
|
52
|
+
app_name: yield* appName,
|
|
53
|
+
secret_name: name,
|
|
54
|
+
show_secrets: globalThis.__ALCHEMY_RUNTIME__ === true,
|
|
55
|
+
}),
|
|
56
|
+
);
|
|
57
|
+
}),
|
|
58
|
+
}),
|
|
59
|
+
),
|
|
60
|
+
).pipe(Layer.provide(FetchHttpClient.layer), Layer.provide(CredentialsFromAmbientOrEnv));
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type * as S3 from "@distilled.cloud/aws/s3";
|
|
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 { Bucket } from "./Bucket.ts";
|
|
6
|
+
import type { TigrisCredentialsMissing } from "./Errors.ts";
|
|
7
|
+
|
|
8
|
+
export interface HeadObjectRequest extends Omit<S3.HeadObjectRequest, "Bucket"> {}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Runtime binding for Tigris `HeadObject` over the S3 API.
|
|
12
|
+
*
|
|
13
|
+
* Bind this operation to a {@link Bucket} in Service init. Provide
|
|
14
|
+
* {@link HeadObjectHttp}.
|
|
15
|
+
*
|
|
16
|
+
*
|
|
17
|
+
* ### Inspecting Objects
|
|
18
|
+
* **Example:** Check an Object's Metadata
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const headObject = yield* Fly.HeadObject(Data);
|
|
21
|
+
* const head = yield* headObject({ Key: "hello.txt" });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @binding
|
|
25
|
+
* @product Bucket
|
|
26
|
+
*/
|
|
27
|
+
export interface HeadObject extends Binding.Service<
|
|
28
|
+
HeadObject,
|
|
29
|
+
"Fly.HeadObject",
|
|
30
|
+
(
|
|
31
|
+
bucket: Bucket,
|
|
32
|
+
) => Effect.Effect<
|
|
33
|
+
(
|
|
34
|
+
request: HeadObjectRequest,
|
|
35
|
+
) => Effect.Effect<
|
|
36
|
+
S3.HeadObjectOutput,
|
|
37
|
+
S3.HeadObjectError | TigrisCredentialsMissing,
|
|
38
|
+
RuntimeContext
|
|
39
|
+
>
|
|
40
|
+
>
|
|
41
|
+
> {}
|
|
42
|
+
|
|
43
|
+
export const HeadObject = Binding.Service<HeadObject>("Fly.HeadObject");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as S3 from "@distilled.cloud/aws/s3";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
import { makeTigrisS3Binding } from "./BucketBinding.ts";
|
|
4
|
+
import { HeadObject } from "./HeadObject.ts";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* HTTP implementation of {@link HeadObject}. Calls distilled S3
|
|
8
|
+
* `headObject` against the Tigris endpoint with the bucket's credentials.
|
|
9
|
+
*
|
|
10
|
+
* @layer
|
|
11
|
+
* @product Bucket
|
|
12
|
+
* @provides Fly.HeadObject
|
|
13
|
+
*/
|
|
14
|
+
export const HeadObjectHttp = Layer.effect(
|
|
15
|
+
HeadObject,
|
|
16
|
+
makeTigrisS3Binding({
|
|
17
|
+
tag: "Fly.HeadObject",
|
|
18
|
+
operation: S3.headObject,
|
|
19
|
+
}),
|
|
20
|
+
);
|