@alchemy.run/modal 0.0.0 → 2.0.0-beta.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +96 -4
- package/lib/App.d.ts +143 -0
- package/lib/App.d.ts.map +1 -0
- package/lib/App.js +198 -0
- package/lib/App.js.map +1 -0
- package/lib/AuthProvider.d.ts +53 -0
- package/lib/AuthProvider.d.ts.map +1 -0
- package/lib/AuthProvider.js +209 -0
- package/lib/AuthProvider.js.map +1 -0
- package/lib/BindingHttp.d.ts +56 -0
- package/lib/BindingHttp.d.ts.map +1 -0
- package/lib/BindingHttp.js +50 -0
- package/lib/BindingHttp.js.map +1 -0
- package/lib/Blob.d.ts +34 -0
- package/lib/Blob.d.ts.map +1 -0
- package/lib/Blob.js +59 -0
- package/lib/Blob.js.map +1 -0
- package/lib/Bootstrap.d.ts +8 -0
- package/lib/Bootstrap.d.ts.map +1 -0
- package/lib/Bootstrap.js +26 -0
- package/lib/Bootstrap.js.map +1 -0
- package/lib/Cbor.d.ts +10 -0
- package/lib/Cbor.d.ts.map +1 -0
- package/lib/Cbor.js +177 -0
- package/lib/Cbor.js.map +1 -0
- package/lib/ConnectSandbox.d.ts +64 -0
- package/lib/ConnectSandbox.d.ts.map +1 -0
- package/lib/ConnectSandbox.js +33 -0
- package/lib/ConnectSandbox.js.map +1 -0
- package/lib/Container.d.ts +124 -0
- package/lib/Container.d.ts.map +1 -0
- package/lib/Container.js +1 -0
- package/lib/Container.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/CreateDict.d.ts +83 -0
- package/lib/CreateDict.d.ts.map +1 -0
- package/lib/CreateDict.js +3 -0
- package/lib/CreateDict.js.map +1 -0
- package/lib/CreateDictHttp.d.ts +33 -0
- package/lib/CreateDictHttp.d.ts.map +1 -0
- package/lib/CreateDictHttp.js +67 -0
- package/lib/CreateDictHttp.js.map +1 -0
- package/lib/CreateImage.d.ts +98 -0
- package/lib/CreateImage.d.ts.map +1 -0
- package/lib/CreateImage.js +3 -0
- package/lib/CreateImage.js.map +1 -0
- package/lib/CreateImageHttp.d.ts +51 -0
- package/lib/CreateImageHttp.d.ts.map +1 -0
- package/lib/CreateImageHttp.js +87 -0
- package/lib/CreateImageHttp.js.map +1 -0
- package/lib/CreateQueue.d.ts +83 -0
- package/lib/CreateQueue.d.ts.map +1 -0
- package/lib/CreateQueue.js +3 -0
- package/lib/CreateQueue.js.map +1 -0
- package/lib/CreateQueueHttp.d.ts +31 -0
- package/lib/CreateQueueHttp.d.ts.map +1 -0
- package/lib/CreateQueueHttp.js +67 -0
- package/lib/CreateQueueHttp.js.map +1 -0
- package/lib/CreateSandbox.d.ts +186 -0
- package/lib/CreateSandbox.d.ts.map +1 -0
- package/lib/CreateSandbox.js +3 -0
- package/lib/CreateSandbox.js.map +1 -0
- package/lib/CreateSandboxHttp.d.ts +17 -0
- package/lib/CreateSandboxHttp.d.ts.map +1 -0
- package/lib/CreateSandboxHttp.js +117 -0
- package/lib/CreateSandboxHttp.js.map +1 -0
- package/lib/CreateSecret.d.ts +95 -0
- package/lib/CreateSecret.d.ts.map +1 -0
- package/lib/CreateSecret.js +3 -0
- package/lib/CreateSecret.js.map +1 -0
- package/lib/CreateSecretHttp.d.ts +24 -0
- package/lib/CreateSecretHttp.d.ts.map +1 -0
- package/lib/CreateSecretHttp.js +60 -0
- package/lib/CreateSecretHttp.js.map +1 -0
- package/lib/CreateVolume.d.ts +84 -0
- package/lib/CreateVolume.d.ts.map +1 -0
- package/lib/CreateVolume.js +3 -0
- package/lib/CreateVolume.js.map +1 -0
- package/lib/CreateVolumeHttp.d.ts +32 -0
- package/lib/CreateVolumeHttp.d.ts.map +1 -0
- package/lib/CreateVolumeHttp.js +69 -0
- package/lib/CreateVolumeHttp.js.map +1 -0
- package/lib/Credentials.d.ts +32 -0
- package/lib/Credentials.d.ts.map +1 -0
- package/lib/Credentials.js +44 -0
- package/lib/Credentials.js.map +1 -0
- package/lib/Dict.d.ts +147 -0
- package/lib/Dict.d.ts.map +1 -0
- package/lib/Dict.js +175 -0
- package/lib/Dict.js.map +1 -0
- package/lib/DictClient.d.ts +55 -0
- package/lib/DictClient.d.ts.map +1 -0
- package/lib/DictClient.js +89 -0
- package/lib/DictClient.js.map +1 -0
- package/lib/Domain.d.ts +86 -0
- package/lib/Domain.d.ts.map +1 -0
- package/lib/Domain.js +113 -0
- package/lib/Domain.js.map +1 -0
- package/lib/Endpoint.d.ts +181 -0
- package/lib/Endpoint.d.ts.map +1 -0
- package/lib/Endpoint.js +283 -0
- package/lib/Endpoint.js.map +1 -0
- package/lib/Environment.d.ts +174 -0
- package/lib/Environment.d.ts.map +1 -0
- package/lib/Environment.js +244 -0
- package/lib/Environment.js.map +1 -0
- package/lib/FetchServer.d.ts +105 -0
- package/lib/FetchServer.d.ts.map +1 -0
- package/lib/FetchServer.js +3 -0
- package/lib/FetchServer.js.map +1 -0
- package/lib/FetchServerHttp.d.ts +21 -0
- package/lib/FetchServerHttp.d.ts.map +1 -0
- package/lib/FetchServerHttp.js +84 -0
- package/lib/FetchServerHttp.js.map +1 -0
- package/lib/Function.d.ts +236 -0
- package/lib/Function.d.ts.map +1 -0
- package/lib/Function.js +273 -0
- package/lib/Function.js.map +1 -0
- package/lib/FunctionAutoscaler.d.ts +99 -0
- package/lib/FunctionAutoscaler.d.ts.map +1 -0
- package/lib/FunctionAutoscaler.js +136 -0
- package/lib/FunctionAutoscaler.js.map +1 -0
- package/lib/FunctionTarget.d.ts +61 -0
- package/lib/FunctionTarget.d.ts.map +1 -0
- package/lib/FunctionTarget.js +136 -0
- package/lib/FunctionTarget.js.map +1 -0
- package/lib/Image.d.ts +159 -0
- package/lib/Image.d.ts.map +1 -0
- package/lib/Image.js +203 -0
- package/lib/Image.js.map +1 -0
- package/lib/ImageBuild.d.ts +108 -0
- package/lib/ImageBuild.d.ts.map +1 -0
- package/lib/ImageBuild.js +157 -0
- package/lib/ImageBuild.js.map +1 -0
- package/lib/ImagePlan.d.ts +31 -0
- package/lib/ImagePlan.d.ts.map +1 -0
- package/lib/ImagePlan.js +70 -0
- package/lib/ImagePlan.js.map +1 -0
- package/lib/InferEnv.d.ts +26 -0
- package/lib/InferEnv.d.ts.map +1 -0
- package/lib/InferEnv.js +1 -0
- package/lib/InferEnv.js.map +1 -0
- package/lib/InvokeFunction.d.ts +186 -0
- package/lib/InvokeFunction.d.ts.map +1 -0
- package/lib/InvokeFunction.js +10 -0
- package/lib/InvokeFunction.js.map +1 -0
- package/lib/InvokeFunctionHttp.d.ts +39 -0
- package/lib/InvokeFunctionHttp.d.ts.map +1 -0
- package/lib/InvokeFunctionHttp.js +210 -0
- package/lib/InvokeFunctionHttp.js.map +1 -0
- package/lib/ModalBindings.d.ts +138 -0
- package/lib/ModalBindings.d.ts.map +1 -0
- package/lib/ModalBindings.js +223 -0
- package/lib/ModalBindings.js.map +1 -0
- package/lib/MountBucket.d.ts +80 -0
- package/lib/MountBucket.d.ts.map +1 -0
- package/lib/MountBucket.js +44 -0
- package/lib/MountBucket.js.map +1 -0
- package/lib/MountVolume.d.ts +77 -0
- package/lib/MountVolume.d.ts.map +1 -0
- package/lib/MountVolume.js +41 -0
- package/lib/MountVolume.js.map +1 -0
- package/lib/Mounts.d.ts +134 -0
- package/lib/Mounts.d.ts.map +1 -0
- package/lib/Mounts.js +87 -0
- package/lib/Mounts.js.map +1 -0
- package/lib/PersistentSandbox.d.ts +75 -0
- package/lib/PersistentSandbox.d.ts.map +1 -0
- package/lib/PersistentSandbox.js +93 -0
- package/lib/PersistentSandbox.js.map +1 -0
- package/lib/Providers.d.ts +23 -0
- package/lib/Providers.d.ts.map +1 -0
- package/lib/Providers.js +64 -0
- package/lib/Providers.js.map +1 -0
- package/lib/Proxy.d.ts +94 -0
- package/lib/Proxy.d.ts.map +1 -0
- package/lib/Proxy.js +132 -0
- package/lib/Proxy.js.map +1 -0
- package/lib/Queue.d.ts +147 -0
- package/lib/Queue.d.ts.map +1 -0
- package/lib/Queue.js +177 -0
- package/lib/Queue.js.map +1 -0
- package/lib/QueueClient.d.ts +64 -0
- package/lib/QueueClient.d.ts.map +1 -0
- package/lib/QueueClient.js +73 -0
- package/lib/QueueClient.js.map +1 -0
- package/lib/ReadApp.d.ts +85 -0
- package/lib/ReadApp.d.ts.map +1 -0
- package/lib/ReadApp.js +3 -0
- package/lib/ReadApp.js.map +1 -0
- package/lib/ReadAppHttp.d.ts +26 -0
- package/lib/ReadAppHttp.d.ts.map +1 -0
- package/lib/ReadAppHttp.js +106 -0
- package/lib/ReadAppHttp.js.map +1 -0
- package/lib/ReadDict.d.ts +39 -0
- package/lib/ReadDict.d.ts.map +1 -0
- package/lib/ReadDict.js +3 -0
- package/lib/ReadDict.js.map +1 -0
- package/lib/ReadDictHttp.d.ts +12 -0
- package/lib/ReadDictHttp.d.ts.map +1 -0
- package/lib/ReadDictHttp.js +23 -0
- package/lib/ReadDictHttp.js.map +1 -0
- package/lib/ReadFunction.d.ts +73 -0
- package/lib/ReadFunction.d.ts.map +1 -0
- package/lib/ReadFunction.js +3 -0
- package/lib/ReadFunction.js.map +1 -0
- package/lib/ReadFunctionHttp.d.ts +25 -0
- package/lib/ReadFunctionHttp.d.ts.map +1 -0
- package/lib/ReadFunctionHttp.js +63 -0
- package/lib/ReadFunctionHttp.js.map +1 -0
- package/lib/ReadQueue.d.ts +39 -0
- package/lib/ReadQueue.d.ts.map +1 -0
- package/lib/ReadQueue.js +3 -0
- package/lib/ReadQueue.js.map +1 -0
- package/lib/ReadQueueHttp.d.ts +12 -0
- package/lib/ReadQueueHttp.d.ts.map +1 -0
- package/lib/ReadQueueHttp.js +23 -0
- package/lib/ReadQueueHttp.js.map +1 -0
- package/lib/ReadServer.d.ts +72 -0
- package/lib/ReadServer.d.ts.map +1 -0
- package/lib/ReadServer.js +3 -0
- package/lib/ReadServer.js.map +1 -0
- package/lib/ReadServerHttp.d.ts +25 -0
- package/lib/ReadServerHttp.d.ts.map +1 -0
- package/lib/ReadServerHttp.js +70 -0
- package/lib/ReadServerHttp.js.map +1 -0
- package/lib/ReadVolume.d.ts +40 -0
- package/lib/ReadVolume.d.ts.map +1 -0
- package/lib/ReadVolume.js +3 -0
- package/lib/ReadVolume.js.map +1 -0
- package/lib/ReadVolumeHttp.d.ts +12 -0
- package/lib/ReadVolumeHttp.d.ts.map +1 -0
- package/lib/ReadVolumeHttp.js +24 -0
- package/lib/ReadVolumeHttp.js.map +1 -0
- package/lib/ReadWriteDict.d.ts +39 -0
- package/lib/ReadWriteDict.d.ts.map +1 -0
- package/lib/ReadWriteDict.js +3 -0
- package/lib/ReadWriteDict.js.map +1 -0
- package/lib/ReadWriteDictHttp.d.ts +12 -0
- package/lib/ReadWriteDictHttp.d.ts.map +1 -0
- package/lib/ReadWriteDictHttp.js +23 -0
- package/lib/ReadWriteDictHttp.js.map +1 -0
- package/lib/ReadWriteQueue.d.ts +40 -0
- package/lib/ReadWriteQueue.d.ts.map +1 -0
- package/lib/ReadWriteQueue.js +3 -0
- package/lib/ReadWriteQueue.js.map +1 -0
- package/lib/ReadWriteQueueHttp.d.ts +12 -0
- package/lib/ReadWriteQueueHttp.d.ts.map +1 -0
- package/lib/ReadWriteQueueHttp.js +23 -0
- package/lib/ReadWriteQueueHttp.js.map +1 -0
- package/lib/ReadWriteVolume.d.ts +40 -0
- package/lib/ReadWriteVolume.d.ts.map +1 -0
- package/lib/ReadWriteVolume.js +3 -0
- package/lib/ReadWriteVolume.js.map +1 -0
- package/lib/ReadWriteVolumeHttp.d.ts +12 -0
- package/lib/ReadWriteVolumeHttp.d.ts.map +1 -0
- package/lib/ReadWriteVolumeHttp.js +24 -0
- package/lib/ReadWriteVolumeHttp.js.map +1 -0
- package/lib/RuntimeOwner.d.ts +39 -0
- package/lib/RuntimeOwner.d.ts.map +1 -0
- package/lib/RuntimeOwner.js +85 -0
- package/lib/RuntimeOwner.js.map +1 -0
- package/lib/Sandbox.d.ts +215 -0
- package/lib/Sandbox.d.ts.map +1 -0
- package/lib/Sandbox.js +278 -0
- package/lib/Sandbox.js.map +1 -0
- package/lib/SandboxClient.d.ts +748 -0
- package/lib/SandboxClient.d.ts.map +1 -0
- package/lib/SandboxClient.js +710 -0
- package/lib/SandboxClient.js.map +1 -0
- package/lib/ScaleFunction.d.ts +54 -0
- package/lib/ScaleFunction.d.ts.map +1 -0
- package/lib/ScaleFunction.js +3 -0
- package/lib/ScaleFunction.js.map +1 -0
- package/lib/ScaleFunctionHttp.d.ts +21 -0
- package/lib/ScaleFunctionHttp.d.ts.map +1 -0
- package/lib/ScaleFunctionHttp.js +39 -0
- package/lib/ScaleFunctionHttp.js.map +1 -0
- package/lib/Secret.d.ts +170 -0
- package/lib/Secret.d.ts.map +1 -0
- package/lib/Secret.js +196 -0
- package/lib/Secret.js.map +1 -0
- package/lib/Server.d.ts +155 -0
- package/lib/Server.d.ts.map +1 -0
- package/lib/Server.js +184 -0
- package/lib/Server.js.map +1 -0
- package/lib/ServiceUser.d.ts +139 -0
- package/lib/ServiceUser.d.ts.map +1 -0
- package/lib/ServiceUser.js +210 -0
- package/lib/ServiceUser.js.map +1 -0
- package/lib/Volume.d.ts +170 -0
- package/lib/Volume.d.ts.map +1 -0
- package/lib/Volume.js +220 -0
- package/lib/Volume.js.map +1 -0
- package/lib/VolumeClient.d.ts +53 -0
- package/lib/VolumeClient.d.ts.map +1 -0
- package/lib/VolumeClient.js +22 -0
- package/lib/VolumeClient.js.map +1 -0
- package/lib/VolumeFiles.d.ts +94 -0
- package/lib/VolumeFiles.d.ts.map +1 -0
- package/lib/VolumeFiles.js +139 -0
- package/lib/VolumeFiles.js.map +1 -0
- package/lib/WebhookToken.d.ts +102 -0
- package/lib/WebhookToken.d.ts.map +1 -0
- package/lib/WebhookToken.js +176 -0
- package/lib/WebhookToken.js.map +1 -0
- package/lib/WorkspaceSettings.d.ts +70 -0
- package/lib/WorkspaceSettings.d.ts.map +1 -0
- package/lib/WorkspaceSettings.js +105 -0
- package/lib/WorkspaceSettings.js.map +1 -0
- package/lib/WriteApp.d.ts +38 -0
- package/lib/WriteApp.d.ts.map +1 -0
- package/lib/WriteApp.js +3 -0
- package/lib/WriteApp.js.map +1 -0
- package/lib/WriteAppHttp.d.ts +23 -0
- package/lib/WriteAppHttp.d.ts.map +1 -0
- package/lib/WriteAppHttp.js +36 -0
- package/lib/WriteAppHttp.js.map +1 -0
- package/lib/WriteDict.d.ts +39 -0
- package/lib/WriteDict.d.ts.map +1 -0
- package/lib/WriteDict.js +3 -0
- package/lib/WriteDict.js.map +1 -0
- package/lib/WriteDictHttp.d.ts +12 -0
- package/lib/WriteDictHttp.d.ts.map +1 -0
- package/lib/WriteDictHttp.js +23 -0
- package/lib/WriteDictHttp.js.map +1 -0
- package/lib/WriteQueue.d.ts +39 -0
- package/lib/WriteQueue.d.ts.map +1 -0
- package/lib/WriteQueue.js +3 -0
- package/lib/WriteQueue.js.map +1 -0
- package/lib/WriteQueueHttp.d.ts +12 -0
- package/lib/WriteQueueHttp.d.ts.map +1 -0
- package/lib/WriteQueueHttp.js +23 -0
- package/lib/WriteQueueHttp.js.map +1 -0
- package/lib/WriteSecret.d.ts +53 -0
- package/lib/WriteSecret.d.ts.map +1 -0
- package/lib/WriteSecret.js +3 -0
- package/lib/WriteSecret.js.map +1 -0
- package/lib/WriteSecretHttp.d.ts +23 -0
- package/lib/WriteSecretHttp.d.ts.map +1 -0
- package/lib/WriteSecretHttp.js +44 -0
- package/lib/WriteSecretHttp.js.map +1 -0
- package/lib/WriteVolume.d.ts +39 -0
- package/lib/WriteVolume.d.ts.map +1 -0
- package/lib/WriteVolume.js +3 -0
- package/lib/WriteVolume.js.map +1 -0
- package/lib/WriteVolumeHttp.d.ts +12 -0
- package/lib/WriteVolumeHttp.d.ts.map +1 -0
- package/lib/WriteVolumeHttp.js +24 -0
- package/lib/WriteVolumeHttp.js.map +1 -0
- package/lib/index.d.ts +80 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +78 -0
- package/lib/index.js.map +1 -0
- package/lib/internal/Declared.d.ts +29 -0
- package/lib/internal/Declared.d.ts.map +1 -0
- package/lib/internal/Declared.js +31 -0
- package/lib/internal/Declared.js.map +1 -0
- package/lib/internal/Deploy.d.ts +110 -0
- package/lib/internal/Deploy.d.ts.map +1 -0
- package/lib/internal/Deploy.js +230 -0
- package/lib/internal/Deploy.js.map +1 -0
- package/lib/internal/Entrypoint.d.ts +52 -0
- package/lib/internal/Entrypoint.d.ts.map +1 -0
- package/lib/internal/Entrypoint.js +193 -0
- package/lib/internal/Entrypoint.js.map +1 -0
- package/lib/internal/Rpc.d.ts +17 -0
- package/lib/internal/Rpc.d.ts.map +1 -0
- package/lib/internal/Rpc.js +49 -0
- package/lib/internal/Rpc.js.map +1 -0
- package/lib/internal/RpcAuth.d.ts +41 -0
- package/lib/internal/RpcAuth.d.ts.map +1 -0
- package/lib/internal/RpcAuth.js +100 -0
- package/lib/internal/RpcAuth.js.map +1 -0
- package/lib/internal/Runtime.d.ts +127 -0
- package/lib/internal/Runtime.d.ts.map +1 -0
- package/lib/internal/Runtime.js +246 -0
- package/lib/internal/Runtime.js.map +1 -0
- package/lib/internal/Tags.d.ts +19 -0
- package/lib/internal/Tags.d.ts.map +1 -0
- package/lib/internal/Tags.js +33 -0
- package/lib/internal/Tags.js.map +1 -0
- package/lib/internal/TcpConnect.d.ts +12 -0
- package/lib/internal/TcpConnect.d.ts.map +1 -0
- package/lib/internal/TcpConnect.js +46 -0
- package/lib/internal/TcpConnect.js.map +1 -0
- package/lib/internal/Transport.d.ts +13 -0
- package/lib/internal/Transport.d.ts.map +1 -0
- package/lib/internal/Transport.js +16 -0
- package/lib/internal/Transport.js.map +1 -0
- package/lib/internal.d.ts +71 -0
- package/lib/internal.d.ts.map +1 -0
- package/lib/internal.js +102 -0
- package/lib/internal.js.map +1 -0
- package/package.json +59 -3
- package/src/App.ts +262 -0
- package/src/AuthProvider.ts +295 -0
- package/src/BindingHttp.ts +112 -0
- package/src/Blob.ts +71 -0
- package/src/Bootstrap.ts +52 -0
- package/src/Cbor.ts +158 -0
- package/src/ConnectSandbox.ts +99 -0
- package/src/Container.ts +121 -0
- package/src/Contributions.ts +9 -0
- package/src/CreateDict.ts +95 -0
- package/src/CreateDictHttp.ts +91 -0
- package/src/CreateImage.ts +105 -0
- package/src/CreateImageHttp.ts +117 -0
- package/src/CreateQueue.ts +95 -0
- package/src/CreateQueueHttp.ts +91 -0
- package/src/CreateSandbox.ts +228 -0
- package/src/CreateSandboxHttp.ts +160 -0
- package/src/CreateSecret.ts +109 -0
- package/src/CreateSecretHttp.ts +83 -0
- package/src/CreateVolume.ts +96 -0
- package/src/CreateVolumeHttp.ts +93 -0
- package/src/Credentials.ts +74 -0
- package/src/Dict.ts +245 -0
- package/src/DictClient.ts +166 -0
- package/src/Domain.ts +147 -0
- package/src/Endpoint.ts +406 -0
- package/src/Environment.ts +373 -0
- package/src/FetchServer.ts +126 -0
- package/src/FetchServerHttp.ts +110 -0
- package/src/Function.ts +397 -0
- package/src/FunctionAutoscaler.ts +210 -0
- package/src/FunctionTarget.ts +181 -0
- package/src/Image.ts +281 -0
- package/src/ImageBuild.ts +228 -0
- package/src/ImagePlan.ts +78 -0
- package/src/InferEnv.ts +27 -0
- package/src/InvokeFunction.ts +211 -0
- package/src/InvokeFunctionHttp.ts +316 -0
- package/src/ModalBindings.ts +310 -0
- package/src/MountBucket.ts +137 -0
- package/src/MountVolume.ts +113 -0
- package/src/Mounts.ts +230 -0
- package/src/PersistentSandbox.ts +142 -0
- package/src/Providers.ts +100 -0
- package/src/Proxy.ts +191 -0
- package/src/Queue.ts +258 -0
- package/src/QueueClient.ts +149 -0
- package/src/ReadApp.ts +101 -0
- package/src/ReadAppHttp.ts +142 -0
- package/src/ReadDict.ts +44 -0
- package/src/ReadDictHttp.ts +27 -0
- package/src/ReadFunction.ts +107 -0
- package/src/ReadFunctionHttp.ts +91 -0
- package/src/ReadQueue.ts +44 -0
- package/src/ReadQueueHttp.ts +27 -0
- package/src/ReadServer.ts +98 -0
- package/src/ReadServerHttp.ts +101 -0
- package/src/ReadVolume.ts +45 -0
- package/src/ReadVolumeHttp.ts +28 -0
- package/src/ReadWriteDict.ts +44 -0
- package/src/ReadWriteDictHttp.ts +27 -0
- package/src/ReadWriteQueue.ts +45 -0
- package/src/ReadWriteQueueHttp.ts +27 -0
- package/src/ReadWriteVolume.ts +45 -0
- package/src/ReadWriteVolumeHttp.ts +28 -0
- package/src/RuntimeOwner.ts +111 -0
- package/src/Sandbox.ts +402 -0
- package/src/SandboxClient.ts +1404 -0
- package/src/ScaleFunction.ts +70 -0
- package/src/ScaleFunctionHttp.ts +54 -0
- package/src/Secret.ts +296 -0
- package/src/Server.ts +285 -0
- package/src/ServiceUser.ts +295 -0
- package/src/Volume.ts +320 -0
- package/src/VolumeClient.ts +108 -0
- package/src/VolumeFiles.ts +194 -0
- package/src/WebhookToken.ts +230 -0
- package/src/WorkspaceSettings.ts +160 -0
- package/src/WriteApp.ts +43 -0
- package/src/WriteAppHttp.ts +51 -0
- package/src/WriteDict.ts +44 -0
- package/src/WriteDictHttp.ts +27 -0
- package/src/WriteQueue.ts +44 -0
- package/src/WriteQueueHttp.ts +27 -0
- package/src/WriteSecret.ts +60 -0
- package/src/WriteSecretHttp.ts +56 -0
- package/src/WriteVolume.ts +44 -0
- package/src/WriteVolumeHttp.ts +28 -0
- package/src/globals.d.ts +2 -0
- package/src/index.ts +85 -0
- package/src/internal/Declared.ts +80 -0
- package/src/internal/Deploy.ts +309 -0
- package/src/internal/Entrypoint.ts +198 -0
- package/src/internal/Rpc.ts +59 -0
- package/src/internal/RpcAuth.ts +132 -0
- package/src/internal/Runtime.ts +386 -0
- package/src/internal/Tags.ts +44 -0
- package/src/internal/TcpConnect.ts +78 -0
- package/src/internal/Transport.ts +25 -0
- package/src/internal.ts +147 -0
package/src/WriteApp.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as Binding from "alchemy/Binding";
|
|
2
|
+
import type { RuntimeContext } from "alchemy/RuntimeContext";
|
|
3
|
+
import type * as Effect from "effect/Effect";
|
|
4
|
+
import type { App } from "./App.ts";
|
|
5
|
+
import type { OpError } from "./internal.ts";
|
|
6
|
+
import type { WriteAppOps } from "./WriteAppHttp.ts";
|
|
7
|
+
|
|
8
|
+
/** Change an App's deployment. */
|
|
9
|
+
export interface AppWriter {
|
|
10
|
+
/** Redeploy an earlier version (the previous one by default). */
|
|
11
|
+
rollback(options?: {
|
|
12
|
+
readonly version?: number;
|
|
13
|
+
}): Effect.Effect<void, OpError<WriteAppOps, "rollback">, RuntimeContext>;
|
|
14
|
+
/** Restart every container on the current version, draining the old ones. */
|
|
15
|
+
rollover(): Effect.Effect<void, OpError<WriteAppOps, "rollover">, RuntimeContext>;
|
|
16
|
+
/** Put a staged version into production. */
|
|
17
|
+
promote(version: number): Effect.Effect<void, OpError<WriteAppOps, "promote">, RuntimeContext>;
|
|
18
|
+
/** Stop the App: its functions stop serving and its sandboxes terminate. */
|
|
19
|
+
stop(): Effect.Effect<void, OpError<WriteAppOps, "stop">, RuntimeContext>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Operate a Modal App from any runtime: roll back a bad version, roll the
|
|
24
|
+
* containers over, promote a staged version, or stop it. The next deploy of
|
|
25
|
+
* the Stack publishes its declared version again.
|
|
26
|
+
*
|
|
27
|
+
* ### Roll back
|
|
28
|
+
* **Example:** From an incident webhook
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const backend = yield* Modal.WriteApp(Backend);
|
|
31
|
+
* yield* backend.rollback();
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @binding
|
|
35
|
+
* @product App
|
|
36
|
+
*/
|
|
37
|
+
export interface WriteApp extends Binding.Service<
|
|
38
|
+
WriteApp,
|
|
39
|
+
"Modal.WriteApp",
|
|
40
|
+
(app: App) => Effect.Effect<AppWriter>
|
|
41
|
+
> {}
|
|
42
|
+
|
|
43
|
+
export const WriteApp = Binding.Service<WriteApp>("Modal.WriteApp");
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as app from "@distilled.cloud/modal/app";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import type { App } from "./App.ts";
|
|
5
|
+
import { makeModalBinding } from "./BindingHttp.ts";
|
|
6
|
+
import { operations } from "./internal.ts";
|
|
7
|
+
import { WriteApp, type AppWriter } from "./WriteApp.ts";
|
|
8
|
+
|
|
9
|
+
/** The operations the client calls, resolved by `ModalBindings.withCredentials`. */
|
|
10
|
+
const WriteAppOps = operations({
|
|
11
|
+
rollback: app.appRollback,
|
|
12
|
+
rollover: app.appRollover,
|
|
13
|
+
promote: app.promoteApp,
|
|
14
|
+
stop: app.stopApp,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type WriteAppOps = Effect.Success<typeof WriteAppOps>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* {@link WriteApp} over Modal's API. Grants the host's identity (a scoped
|
|
21
|
+
* `Modal.ServiceUser`) the `contributor` role on the App's environment.
|
|
22
|
+
*
|
|
23
|
+
* @layer
|
|
24
|
+
* @product App
|
|
25
|
+
* @provides Modal.WriteApp
|
|
26
|
+
*/
|
|
27
|
+
export const WriteAppHttp = Layer.effect(
|
|
28
|
+
WriteApp,
|
|
29
|
+
makeModalBinding({
|
|
30
|
+
tag: "Modal.WriteApp",
|
|
31
|
+
operations: WriteAppOps,
|
|
32
|
+
role: "contributor",
|
|
33
|
+
make: Effect.fn(function* (target: App, ops) {
|
|
34
|
+
const appId = yield* target.appId;
|
|
35
|
+
return {
|
|
36
|
+
rollback: (options = {}) =>
|
|
37
|
+
Effect.flatMap(appId, (id) => ops.rollback({ appId: id, version: options.version })).pipe(
|
|
38
|
+
Effect.asVoid,
|
|
39
|
+
),
|
|
40
|
+
rollover: () =>
|
|
41
|
+
Effect.flatMap(appId, (id) => ops.rollover({ appId: id })).pipe(Effect.asVoid),
|
|
42
|
+
promote: (version) =>
|
|
43
|
+
Effect.flatMap(appId, (id) => ops.promote({ appId: id, version })).pipe(Effect.asVoid),
|
|
44
|
+
stop: () =>
|
|
45
|
+
Effect.flatMap(appId, (id) =>
|
|
46
|
+
ops.stop({ appId: id, source: "APP_STOP_SOURCE_CLI" }),
|
|
47
|
+
).pipe(Effect.asVoid),
|
|
48
|
+
} satisfies AppWriter;
|
|
49
|
+
}),
|
|
50
|
+
}),
|
|
51
|
+
);
|
package/src/WriteDict.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as Binding from "alchemy/Binding";
|
|
2
|
+
import type * as Effect from "effect/Effect";
|
|
3
|
+
import type { Dict } from "./Dict.ts";
|
|
4
|
+
import type { WriteDictClient } from "./DictClient.ts";
|
|
5
|
+
|
|
6
|
+
export type { WriteDictClient } from "./DictClient.ts";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Write a Modal Dict from any runtime: put, update, pop and clear. Keys and values are JSON.
|
|
10
|
+
*
|
|
11
|
+
* ### Bind a dict
|
|
12
|
+
* **Example:** From a Cloudflare Worker
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import * as Cloudflare from "@alchemy.run/cloudflare";
|
|
15
|
+
* import * as Modal from "@alchemy.run/modal";
|
|
16
|
+
* import * as Effect from "effect/Effect";
|
|
17
|
+
* import * as HttpServerResponse from "effect/http/HttpServerResponse";
|
|
18
|
+
* import { Results } from "./Storage.ts";
|
|
19
|
+
*
|
|
20
|
+
* export default class Api extends Cloudflare.Worker<Api>()(
|
|
21
|
+
* "Api",
|
|
22
|
+
* { main: import.meta.url },
|
|
23
|
+
* Effect.gen(function* () {
|
|
24
|
+
* const dict = yield* Modal.WriteDict(Results);
|
|
25
|
+
* return {
|
|
26
|
+
* fetch: Effect.gen(function* () {
|
|
27
|
+
* yield* dict.put("last-run", { ok: true });
|
|
28
|
+
* return HttpServerResponse.text("saved");
|
|
29
|
+
* }).pipe(Effect.orDie),
|
|
30
|
+
* };
|
|
31
|
+
* }).pipe(Effect.provide(Modal.WriteDictHttp)),
|
|
32
|
+
* ) {}
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @binding
|
|
36
|
+
* @product Dict
|
|
37
|
+
*/
|
|
38
|
+
export interface WriteDict extends Binding.Service<
|
|
39
|
+
WriteDict,
|
|
40
|
+
"Modal.WriteDict",
|
|
41
|
+
(dict: Dict) => Effect.Effect<WriteDictClient>
|
|
42
|
+
> {}
|
|
43
|
+
|
|
44
|
+
export const WriteDict = Binding.Service<WriteDict>("Modal.WriteDict");
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
import { makeModalBinding } from "./BindingHttp.ts";
|
|
4
|
+
import type { Dict } from "./Dict.ts";
|
|
5
|
+
import { DictOps, makeWriteDictClient } from "./DictClient.ts";
|
|
6
|
+
import { WriteDict } from "./WriteDict.ts";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* {@link WriteDict} over Modal's API. Grants the host's identity (a scoped
|
|
10
|
+
* `Modal.ServiceUser`) the `contributor` role on the dict's environment.
|
|
11
|
+
*
|
|
12
|
+
* @layer
|
|
13
|
+
* @product Dict
|
|
14
|
+
* @provides Modal.WriteDict
|
|
15
|
+
*/
|
|
16
|
+
export const WriteDictHttp = Layer.effect(
|
|
17
|
+
WriteDict,
|
|
18
|
+
makeModalBinding({
|
|
19
|
+
tag: "Modal.WriteDict",
|
|
20
|
+
operations: DictOps,
|
|
21
|
+
role: "contributor",
|
|
22
|
+
make: Effect.fn(function* (dict: Dict, ops) {
|
|
23
|
+
const dictId = yield* dict.dictId;
|
|
24
|
+
return makeWriteDictClient(dictId, ops);
|
|
25
|
+
}),
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as Binding from "alchemy/Binding";
|
|
2
|
+
import type * as Effect from "effect/Effect";
|
|
3
|
+
import type { Queue } from "./Queue.ts";
|
|
4
|
+
import type { WriteQueueClient } from "./QueueClient.ts";
|
|
5
|
+
|
|
6
|
+
export type { WriteQueueClient } from "./QueueClient.ts";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Put items into a Modal Queue from any runtime. Items are JSON, so a Python consumer reads them with `json.loads`.
|
|
10
|
+
*
|
|
11
|
+
* ### Bind a queue
|
|
12
|
+
* **Example:** From a Cloudflare Worker
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import * as Cloudflare from "@alchemy.run/cloudflare";
|
|
15
|
+
* import * as Modal from "@alchemy.run/modal";
|
|
16
|
+
* import * as Effect from "effect/Effect";
|
|
17
|
+
* import * as HttpServerResponse from "effect/http/HttpServerResponse";
|
|
18
|
+
* import { Jobs } from "./Storage.ts";
|
|
19
|
+
*
|
|
20
|
+
* export default class Api extends Cloudflare.Worker<Api>()(
|
|
21
|
+
* "Api",
|
|
22
|
+
* { main: import.meta.url },
|
|
23
|
+
* Effect.gen(function* () {
|
|
24
|
+
* const queue = yield* Modal.WriteQueue(Jobs);
|
|
25
|
+
* return {
|
|
26
|
+
* fetch: Effect.gen(function* () {
|
|
27
|
+
* yield* queue.put({ repo: "alchemy-run/alchemy", command: "pnpm test" });
|
|
28
|
+
* return HttpServerResponse.text("queued");
|
|
29
|
+
* }).pipe(Effect.orDie),
|
|
30
|
+
* };
|
|
31
|
+
* }).pipe(Effect.provide(Modal.WriteQueueHttp)),
|
|
32
|
+
* ) {}
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @binding
|
|
36
|
+
* @product Queue
|
|
37
|
+
*/
|
|
38
|
+
export interface WriteQueue extends Binding.Service<
|
|
39
|
+
WriteQueue,
|
|
40
|
+
"Modal.WriteQueue",
|
|
41
|
+
(queue: Queue) => Effect.Effect<WriteQueueClient>
|
|
42
|
+
> {}
|
|
43
|
+
|
|
44
|
+
export const WriteQueue = Binding.Service<WriteQueue>("Modal.WriteQueue");
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
import { makeModalBinding } from "./BindingHttp.ts";
|
|
4
|
+
import type { Queue } from "./Queue.ts";
|
|
5
|
+
import { QueueOps, makeWriteQueueClient } from "./QueueClient.ts";
|
|
6
|
+
import { WriteQueue } from "./WriteQueue.ts";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* {@link WriteQueue} over Modal's API. Grants the host's identity (a scoped
|
|
10
|
+
* `Modal.ServiceUser`) the `contributor` role on the queue's environment.
|
|
11
|
+
*
|
|
12
|
+
* @layer
|
|
13
|
+
* @product Queue
|
|
14
|
+
* @provides Modal.WriteQueue
|
|
15
|
+
*/
|
|
16
|
+
export const WriteQueueHttp = Layer.effect(
|
|
17
|
+
WriteQueue,
|
|
18
|
+
makeModalBinding({
|
|
19
|
+
tag: "Modal.WriteQueue",
|
|
20
|
+
operations: QueueOps,
|
|
21
|
+
role: "contributor",
|
|
22
|
+
make: Effect.fn(function* (queue: Queue, ops) {
|
|
23
|
+
const queueId = yield* queue.queueId;
|
|
24
|
+
return makeWriteQueueClient(queueId, ops);
|
|
25
|
+
}),
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as Binding from "alchemy/Binding";
|
|
2
|
+
import type { RuntimeContext } from "alchemy/RuntimeContext";
|
|
3
|
+
import type * as Effect from "effect/Effect";
|
|
4
|
+
import type * as Redacted from "effect/Redacted";
|
|
5
|
+
import type { OpError } from "./internal.ts";
|
|
6
|
+
import type { Secret } from "./Secret.ts";
|
|
7
|
+
import type { WriteSecretOps } from "./WriteSecretHttp.ts";
|
|
8
|
+
|
|
9
|
+
/** Replace one secret's variables. */
|
|
10
|
+
export interface WriteSecretClient {
|
|
11
|
+
readonly secretId: Effect.Effect<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Replace the secret's whole variable set. Sandboxes and functions started
|
|
14
|
+
* afterwards see the new values; running ones keep theirs.
|
|
15
|
+
*/
|
|
16
|
+
put(
|
|
17
|
+
env: Record<string, string | Redacted.Redacted<string>>,
|
|
18
|
+
): Effect.Effect<void, OpError<WriteSecretOps, "getInfo" | "update">, RuntimeContext>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Rotate a Modal Secret from any runtime. Modal never returns secret
|
|
23
|
+
* values, so there is no read binding: attach the secret to a sandbox
|
|
24
|
+
* instead, or inject it with an outbound header replacement.
|
|
25
|
+
*
|
|
26
|
+
* ### Rotate a secret
|
|
27
|
+
* **Example:** From a Cloudflare Worker
|
|
28
|
+
* ```typescript
|
|
29
|
+
* import * as Cloudflare from "@alchemy.run/cloudflare";
|
|
30
|
+
* import * as Modal from "@alchemy.run/modal";
|
|
31
|
+
* import * as Effect from "effect/Effect";
|
|
32
|
+
* import * as Redacted from "effect/Redacted";
|
|
33
|
+
* import * as HttpServerResponse from "effect/http/HttpServerResponse";
|
|
34
|
+
* import { OpenAI } from "./Storage.ts";
|
|
35
|
+
*
|
|
36
|
+
* export default class Rotate extends Cloudflare.Worker<Rotate>()(
|
|
37
|
+
* "Rotate",
|
|
38
|
+
* { main: import.meta.url },
|
|
39
|
+
* Effect.gen(function* () {
|
|
40
|
+
* const openai = yield* Modal.WriteSecret(OpenAI);
|
|
41
|
+
* return {
|
|
42
|
+
* fetch: Effect.gen(function* () {
|
|
43
|
+
* yield* openai.put({ OPENAI_API_KEY: Redacted.make("sk-new") });
|
|
44
|
+
* return HttpServerResponse.text("rotated");
|
|
45
|
+
* }).pipe(Effect.orDie),
|
|
46
|
+
* };
|
|
47
|
+
* }).pipe(Effect.provide(Modal.WriteSecretHttp)),
|
|
48
|
+
* ) {}
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @binding
|
|
52
|
+
* @product Secret
|
|
53
|
+
*/
|
|
54
|
+
export interface WriteSecret extends Binding.Service<
|
|
55
|
+
WriteSecret,
|
|
56
|
+
"Modal.WriteSecret",
|
|
57
|
+
(secret: Secret) => Effect.Effect<WriteSecretClient>
|
|
58
|
+
> {}
|
|
59
|
+
|
|
60
|
+
export const WriteSecret = Binding.Service<WriteSecret>("Modal.WriteSecret");
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as secret from "@distilled.cloud/modal/secret";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import * as Redacted from "effect/Redacted";
|
|
5
|
+
import { makeModalBinding } from "./BindingHttp.ts";
|
|
6
|
+
import { operations } from "./internal.ts";
|
|
7
|
+
import type { Secret } from "./Secret.ts";
|
|
8
|
+
import { WriteSecret, type WriteSecretClient } from "./WriteSecret.ts";
|
|
9
|
+
|
|
10
|
+
/** The operations the client calls, resolved by `ModalBindings.withCredentials`. */
|
|
11
|
+
const WriteSecretOps = operations({ getInfo: secret.secretGetInfo, update: secret.updateSecret });
|
|
12
|
+
|
|
13
|
+
export type WriteSecretOps = Effect.Success<typeof WriteSecretOps>;
|
|
14
|
+
|
|
15
|
+
/** A write client over a secret id. */
|
|
16
|
+
export const makeWriteSecretClient = (
|
|
17
|
+
secretId: Effect.Effect<string>,
|
|
18
|
+
ops: WriteSecretOps,
|
|
19
|
+
): WriteSecretClient => ({
|
|
20
|
+
secretId,
|
|
21
|
+
put: (env) =>
|
|
22
|
+
Effect.gen(function* () {
|
|
23
|
+
const id = yield* secretId;
|
|
24
|
+
const { metadata } = yield* ops.getInfo({ secretId: id });
|
|
25
|
+
const values = Object.entries(env).map(([key, value]) => ({
|
|
26
|
+
key,
|
|
27
|
+
value: Redacted.isRedacted(value) ? Redacted.value(value) : value,
|
|
28
|
+
}));
|
|
29
|
+
const removed = (metadata?.keys ?? []).filter((key) => !(key in env));
|
|
30
|
+
yield* ops.update({
|
|
31
|
+
secretId: id,
|
|
32
|
+
updates: [...values, ...removed.map((key) => ({ key }))],
|
|
33
|
+
});
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* {@link WriteSecret} over Modal's API. Grants the host's identity (a scoped
|
|
39
|
+
* `Modal.ServiceUser`) the `contributor` role on the secret's environment.
|
|
40
|
+
*
|
|
41
|
+
* @layer
|
|
42
|
+
* @product Secret
|
|
43
|
+
* @provides Modal.WriteSecret
|
|
44
|
+
*/
|
|
45
|
+
export const WriteSecretHttp = Layer.effect(
|
|
46
|
+
WriteSecret,
|
|
47
|
+
makeModalBinding({
|
|
48
|
+
tag: "Modal.WriteSecret",
|
|
49
|
+
operations: WriteSecretOps,
|
|
50
|
+
role: "contributor",
|
|
51
|
+
make: Effect.fn(function* (resource: Secret, ops) {
|
|
52
|
+
const secretId = yield* resource.secretId;
|
|
53
|
+
return makeWriteSecretClient(secretId, ops);
|
|
54
|
+
}),
|
|
55
|
+
}),
|
|
56
|
+
);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as Binding from "alchemy/Binding";
|
|
2
|
+
import type * as Effect from "effect/Effect";
|
|
3
|
+
import type { Volume } from "./Volume.ts";
|
|
4
|
+
import type { WriteVolumeClient } from "./VolumeClient.ts";
|
|
5
|
+
|
|
6
|
+
export type { WriteVolumeClient } from "./VolumeClient.ts";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Write a Modal Volume's files from any runtime without mounting it: upload, remove and copy files over Modal's volume API. Sandboxes that mount the volume see the changes after they reload it.
|
|
10
|
+
*
|
|
11
|
+
* ### Bind a volume
|
|
12
|
+
* **Example:** Write from a Cloudflare Worker
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import * as Cloudflare from "@alchemy.run/cloudflare";
|
|
15
|
+
* import * as Modal from "@alchemy.run/modal";
|
|
16
|
+
* import * as Effect from "effect/Effect";
|
|
17
|
+
* import * as HttpServerResponse from "effect/http/HttpServerResponse";
|
|
18
|
+
* import { Workspace } from "./Storage.ts";
|
|
19
|
+
*
|
|
20
|
+
* export default class Api extends Cloudflare.Worker<Api>()(
|
|
21
|
+
* "Api",
|
|
22
|
+
* { main: import.meta.url },
|
|
23
|
+
* Effect.gen(function* () {
|
|
24
|
+
* const volume = yield* Modal.WriteVolume(Workspace);
|
|
25
|
+
* return {
|
|
26
|
+
* fetch: Effect.gen(function* () {
|
|
27
|
+
* yield* volume.writeFile("/inbox/task.json", JSON.stringify({ repo: "alchemy" }));
|
|
28
|
+
* return HttpServerResponse.text("written");
|
|
29
|
+
* }).pipe(Effect.orDie),
|
|
30
|
+
* };
|
|
31
|
+
* }).pipe(Effect.provide(Modal.WriteVolumeHttp)),
|
|
32
|
+
* ) {}
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @binding
|
|
36
|
+
* @product Volume
|
|
37
|
+
*/
|
|
38
|
+
export interface WriteVolume extends Binding.Service<
|
|
39
|
+
WriteVolume,
|
|
40
|
+
"Modal.WriteVolume",
|
|
41
|
+
(volume: Volume) => Effect.Effect<WriteVolumeClient>
|
|
42
|
+
> {}
|
|
43
|
+
|
|
44
|
+
export const WriteVolume = Binding.Service<WriteVolume>("Modal.WriteVolume");
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
import { makeModalBinding } from "./BindingHttp.ts";
|
|
4
|
+
import type { Volume } from "./Volume.ts";
|
|
5
|
+
import { makeWriteVolumeClient } from "./VolumeClient.ts";
|
|
6
|
+
import { VolumeFileOps } from "./VolumeFiles.ts";
|
|
7
|
+
import { WriteVolume } from "./WriteVolume.ts";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* {@link WriteVolume} over Modal's volume API. Grants the host's identity (a scoped
|
|
11
|
+
* `Modal.ServiceUser`) the `contributor` role on the volume's environment.
|
|
12
|
+
*
|
|
13
|
+
* @layer
|
|
14
|
+
* @product Volume
|
|
15
|
+
* @provides Modal.WriteVolume
|
|
16
|
+
*/
|
|
17
|
+
export const WriteVolumeHttp = Layer.effect(
|
|
18
|
+
WriteVolume,
|
|
19
|
+
makeModalBinding({
|
|
20
|
+
tag: "Modal.WriteVolume",
|
|
21
|
+
operations: VolumeFileOps,
|
|
22
|
+
role: "contributor",
|
|
23
|
+
make: Effect.fn(function* (volume: Volume, ops) {
|
|
24
|
+
const volumeId = yield* volume.volumeId;
|
|
25
|
+
return makeWriteVolumeClient(volumeId, ops);
|
|
26
|
+
}),
|
|
27
|
+
}),
|
|
28
|
+
);
|
package/src/globals.d.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export * from "./App.ts";
|
|
2
|
+
export * from "./AuthProvider.ts";
|
|
3
|
+
export * from "./ConnectSandbox.ts";
|
|
4
|
+
export * from "./Container.ts";
|
|
5
|
+
export * from "./CreateDict.ts";
|
|
6
|
+
export * from "./CreateDictHttp.ts";
|
|
7
|
+
export * from "./CreateImage.ts";
|
|
8
|
+
export * from "./CreateImageHttp.ts";
|
|
9
|
+
export * from "./CreateQueue.ts";
|
|
10
|
+
export * from "./CreateQueueHttp.ts";
|
|
11
|
+
export * from "./CreateSandbox.ts";
|
|
12
|
+
export * from "./CreateSandboxHttp.ts";
|
|
13
|
+
export * from "./CreateSecret.ts";
|
|
14
|
+
export * from "./CreateSecretHttp.ts";
|
|
15
|
+
export * from "./CreateVolume.ts";
|
|
16
|
+
export * from "./CreateVolumeHttp.ts";
|
|
17
|
+
export * from "./Dict.ts";
|
|
18
|
+
export * from "./Domain.ts";
|
|
19
|
+
export * from "./Endpoint.ts";
|
|
20
|
+
export * from "./Environment.ts";
|
|
21
|
+
export * from "./FetchServer.ts";
|
|
22
|
+
export * from "./FetchServerHttp.ts";
|
|
23
|
+
export * from "./Function.ts";
|
|
24
|
+
export * from "./FunctionAutoscaler.ts";
|
|
25
|
+
export * from "./Image.ts";
|
|
26
|
+
export * from "./ImageBuild.ts";
|
|
27
|
+
export * from "./InvokeFunction.ts";
|
|
28
|
+
export * from "./InvokeFunctionHttp.ts";
|
|
29
|
+
export * from "./Providers.ts";
|
|
30
|
+
export * from "./PersistentSandbox.ts";
|
|
31
|
+
export * from "./MountBucket.ts";
|
|
32
|
+
export * from "./Mounts.ts";
|
|
33
|
+
export * from "./MountVolume.ts";
|
|
34
|
+
export * from "./Proxy.ts";
|
|
35
|
+
export * from "./RuntimeOwner.ts";
|
|
36
|
+
export * from "./Queue.ts";
|
|
37
|
+
export * from "./ReadApp.ts";
|
|
38
|
+
export * from "./ReadAppHttp.ts";
|
|
39
|
+
export * from "./ReadDict.ts";
|
|
40
|
+
export * from "./ReadDictHttp.ts";
|
|
41
|
+
export * from "./ReadFunction.ts";
|
|
42
|
+
export * from "./ReadFunctionHttp.ts";
|
|
43
|
+
export * from "./ReadQueue.ts";
|
|
44
|
+
export * from "./ReadQueueHttp.ts";
|
|
45
|
+
export * from "./ReadServer.ts";
|
|
46
|
+
export * from "./ReadServerHttp.ts";
|
|
47
|
+
export * from "./ReadVolume.ts";
|
|
48
|
+
export * from "./ReadVolumeHttp.ts";
|
|
49
|
+
export * from "./ReadWriteDict.ts";
|
|
50
|
+
export * from "./ReadWriteDictHttp.ts";
|
|
51
|
+
export * from "./ReadWriteQueue.ts";
|
|
52
|
+
export * from "./ReadWriteQueueHttp.ts";
|
|
53
|
+
export * from "./ReadWriteVolume.ts";
|
|
54
|
+
export * from "./ReadWriteVolumeHttp.ts";
|
|
55
|
+
export * from "./Sandbox.ts";
|
|
56
|
+
export * from "./SandboxClient.ts";
|
|
57
|
+
export * from "./ScaleFunction.ts";
|
|
58
|
+
export * from "./ScaleFunctionHttp.ts";
|
|
59
|
+
export * from "./Secret.ts";
|
|
60
|
+
export * from "./Server.ts";
|
|
61
|
+
export * from "./ServiceUser.ts";
|
|
62
|
+
export * from "./Volume.ts";
|
|
63
|
+
export * from "./VolumeFiles.ts";
|
|
64
|
+
export * from "./WebhookToken.ts";
|
|
65
|
+
export * from "./WorkspaceSettings.ts";
|
|
66
|
+
export * from "./WriteApp.ts";
|
|
67
|
+
export * from "./WriteAppHttp.ts";
|
|
68
|
+
export * from "./WriteDict.ts";
|
|
69
|
+
export * from "./WriteDictHttp.ts";
|
|
70
|
+
export * from "./WriteQueue.ts";
|
|
71
|
+
export * from "./WriteQueueHttp.ts";
|
|
72
|
+
export * from "./WriteSecret.ts";
|
|
73
|
+
export * from "./WriteSecretHttp.ts";
|
|
74
|
+
export * from "./WriteVolume.ts";
|
|
75
|
+
export * from "./WriteVolumeHttp.ts";
|
|
76
|
+
export type { InferEnv } from "./InferEnv.ts";
|
|
77
|
+
export {
|
|
78
|
+
Credentials,
|
|
79
|
+
CredentialsFromEnv,
|
|
80
|
+
DEFAULT_API_BASE_URL,
|
|
81
|
+
fromAuthProvider,
|
|
82
|
+
fromToken,
|
|
83
|
+
} from "./Credentials.ts";
|
|
84
|
+
export { DeployerHostIdentity, HostIdentity } from "./ModalBindings.ts";
|
|
85
|
+
export type { DictHandle, DictsClient } from "./CreateDict.ts";
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { PropsInput } from "alchemy/Input";
|
|
2
|
+
import * as Output from "alchemy/Output";
|
|
3
|
+
import { isResource } from "alchemy/Resource";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Redacted from "effect/Redacted";
|
|
6
|
+
import type { Providers } from "../Providers.ts";
|
|
7
|
+
|
|
8
|
+
type Leaf =
|
|
9
|
+
| string
|
|
10
|
+
| number
|
|
11
|
+
| boolean
|
|
12
|
+
| bigint
|
|
13
|
+
| symbol
|
|
14
|
+
| null
|
|
15
|
+
| undefined
|
|
16
|
+
| Redacted.Redacted<any>
|
|
17
|
+
| Uint8Array
|
|
18
|
+
| Date
|
|
19
|
+
| ((...args: any[]) => any);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A prop value, or the declaration of a resource that has it: `app: Backend`
|
|
23
|
+
* instead of `app: yield* Backend`, at any depth.
|
|
24
|
+
*/
|
|
25
|
+
export type Declared<T> = T extends Leaf
|
|
26
|
+
? T
|
|
27
|
+
: T extends Output.Output<any>
|
|
28
|
+
? T
|
|
29
|
+
: T extends ReadonlyArray<infer U>
|
|
30
|
+
? Declared<U>[] | Effect.Effect<T, never, Providers>
|
|
31
|
+
: { [K in keyof T]: Declared<T[K]> } | Effect.Effect<T, never, Providers>;
|
|
32
|
+
|
|
33
|
+
/** Props where any value may be a resource declaration. */
|
|
34
|
+
export type DeclaredProps<P> = { [K in keyof PropsInput<P>]: Declared<PropsInput<P>[K]> };
|
|
35
|
+
|
|
36
|
+
const isPlain = (value: unknown): value is Record<string, unknown> =>
|
|
37
|
+
typeof value === "object" &&
|
|
38
|
+
value !== null &&
|
|
39
|
+
(Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);
|
|
40
|
+
|
|
41
|
+
/** A declaration still to be yielded: an Effect that isn't an Output or a resource. */
|
|
42
|
+
const isDeclaration = (value: unknown): value is Effect.Effect<unknown, never, Providers> =>
|
|
43
|
+
Effect.isEffect(value) && !Output.isOutput(value) && !isResource(value);
|
|
44
|
+
|
|
45
|
+
const hasDeclarations = (value: unknown): boolean =>
|
|
46
|
+
isDeclaration(value) ||
|
|
47
|
+
(Array.isArray(value) && value.some(hasDeclarations)) ||
|
|
48
|
+
(isPlain(value) && !isResource(value) && Object.values(value).some(hasDeclarations));
|
|
49
|
+
|
|
50
|
+
/** Yield every declaration in `value`, at any depth. */
|
|
51
|
+
export const resolveDeclarations = (value: unknown): Effect.Effect<unknown, never, Providers> =>
|
|
52
|
+
isDeclaration(value)
|
|
53
|
+
? value
|
|
54
|
+
: Array.isArray(value)
|
|
55
|
+
? Effect.forEach(value, resolveDeclarations)
|
|
56
|
+
: isPlain(value) && !isResource(value) && hasDeclarations(value)
|
|
57
|
+
? Effect.map(
|
|
58
|
+
Effect.forEach(Object.entries(value), ([key, entry]) =>
|
|
59
|
+
Effect.map(resolveDeclarations(entry), (resolved) => [key, resolved] as const),
|
|
60
|
+
),
|
|
61
|
+
Object.fromEntries,
|
|
62
|
+
)
|
|
63
|
+
: Effect.succeed(value);
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Let a resource's props hold declarations of other resources, which are
|
|
67
|
+
* yielded when the resource is: `Modal.Image("Node", { app: Backend })`.
|
|
68
|
+
* Props without declarations are passed through unchanged.
|
|
69
|
+
*/
|
|
70
|
+
export const declarable =
|
|
71
|
+
<R extends { readonly Props: any }>() =>
|
|
72
|
+
<C extends object>(
|
|
73
|
+
resource: C,
|
|
74
|
+
): C & ((id: string, props: DeclaredProps<R["Props"]>) => Effect.Effect<R, never, Providers>) =>
|
|
75
|
+
new Proxy(resource as C & ((...args: unknown[]) => unknown), {
|
|
76
|
+
apply: (target, self, args: unknown[]) =>
|
|
77
|
+
typeof args[0] === "string" && hasDeclarations(args[1])
|
|
78
|
+
? Reflect.apply(target, self, [args[0], resolveDeclarations(args[1])])
|
|
79
|
+
: Reflect.apply(target, self, args),
|
|
80
|
+
}) as never;
|