@alchemy.run/modal 0.0.0-stage → 2.0.0-beta.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +100 -2
- 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 +75 -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/lib/Cbor.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal CBOR (RFC 8949) codec for Modal function arguments and results
|
|
3
|
+
* (`DATA_FORMAT_CBOR`): null, booleans, numbers, strings, byte strings,
|
|
4
|
+
* arrays and string-keyed maps. NOT exported from `index.ts`.
|
|
5
|
+
*/
|
|
6
|
+
const enc = new TextEncoder();
|
|
7
|
+
const dec = new TextDecoder();
|
|
8
|
+
class Out {
|
|
9
|
+
bytes = [];
|
|
10
|
+
head(major, n) {
|
|
11
|
+
if (n < 24)
|
|
12
|
+
this.bytes.push((major << 5) | n);
|
|
13
|
+
else if (n < 0x100)
|
|
14
|
+
this.bytes.push((major << 5) | 24, n);
|
|
15
|
+
else if (n < 0x10000)
|
|
16
|
+
this.bytes.push((major << 5) | 25, n >> 8, n & 0xff);
|
|
17
|
+
else if (n < 0x100000000)
|
|
18
|
+
this.bytes.push((major << 5) | 26, (n >>> 24) & 0xff, (n >>> 16) & 0xff, (n >>> 8) & 0xff, n & 0xff);
|
|
19
|
+
else {
|
|
20
|
+
const big = BigInt(n);
|
|
21
|
+
this.bytes.push((major << 5) | 27);
|
|
22
|
+
for (let i = 7; i >= 0; i--)
|
|
23
|
+
this.bytes.push(Number((big >> BigInt(i * 8)) & 0xffn));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const write = (out, value) => {
|
|
28
|
+
if (value === null || value === undefined) {
|
|
29
|
+
out.bytes.push(0xf6);
|
|
30
|
+
}
|
|
31
|
+
else if (value === false) {
|
|
32
|
+
out.bytes.push(0xf4);
|
|
33
|
+
}
|
|
34
|
+
else if (value === true) {
|
|
35
|
+
out.bytes.push(0xf5);
|
|
36
|
+
}
|
|
37
|
+
else if (typeof value === "number") {
|
|
38
|
+
if (Number.isSafeInteger(value)) {
|
|
39
|
+
if (value >= 0)
|
|
40
|
+
out.head(0, value);
|
|
41
|
+
else
|
|
42
|
+
out.head(1, -1 - value);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
const view = new DataView(new ArrayBuffer(8));
|
|
46
|
+
view.setFloat64(0, value);
|
|
47
|
+
out.bytes.push(0xfb, ...new Uint8Array(view.buffer));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else if (typeof value === "bigint") {
|
|
51
|
+
write(out, Number(value));
|
|
52
|
+
}
|
|
53
|
+
else if (typeof value === "string") {
|
|
54
|
+
const bytes = enc.encode(value);
|
|
55
|
+
out.head(3, bytes.length);
|
|
56
|
+
out.bytes.push(...bytes);
|
|
57
|
+
}
|
|
58
|
+
else if (value instanceof Uint8Array) {
|
|
59
|
+
out.head(2, value.length);
|
|
60
|
+
out.bytes.push(...value);
|
|
61
|
+
}
|
|
62
|
+
else if (Array.isArray(value)) {
|
|
63
|
+
out.head(4, value.length);
|
|
64
|
+
for (const item of value)
|
|
65
|
+
write(out, item);
|
|
66
|
+
}
|
|
67
|
+
else if (typeof value === "object") {
|
|
68
|
+
const entries = Object.entries(value).filter(([, v]) => v !== undefined);
|
|
69
|
+
out.head(5, entries.length);
|
|
70
|
+
for (const [key, item] of entries) {
|
|
71
|
+
write(out, key);
|
|
72
|
+
write(out, item);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
throw new TypeError(`Can't encode ${typeof value} as CBOR`);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
/** Encode a value as CBOR. Throws a `TypeError` for functions and symbols. */
|
|
80
|
+
export const encodeCbor = (value) => {
|
|
81
|
+
const out = new Out();
|
|
82
|
+
write(out, value);
|
|
83
|
+
return new Uint8Array(out.bytes);
|
|
84
|
+
};
|
|
85
|
+
/** Decode CBOR. Throws a `RangeError` on malformed input. */
|
|
86
|
+
export const decodeCbor = (bytes) => {
|
|
87
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
88
|
+
let pos = 0;
|
|
89
|
+
const need = (n) => {
|
|
90
|
+
if (pos + n > bytes.length)
|
|
91
|
+
throw new RangeError("Truncated CBOR");
|
|
92
|
+
};
|
|
93
|
+
const length = (info) => {
|
|
94
|
+
if (info < 24)
|
|
95
|
+
return info;
|
|
96
|
+
if (info === 24)
|
|
97
|
+
return (need(1), bytes[pos++]);
|
|
98
|
+
if (info === 25)
|
|
99
|
+
return (need(2), (pos += 2), view.getUint16(pos - 2));
|
|
100
|
+
if (info === 26)
|
|
101
|
+
return (need(4), (pos += 4), view.getUint32(pos - 4));
|
|
102
|
+
if (info === 27)
|
|
103
|
+
return (need(8), (pos += 8), Number(view.getBigUint64(pos - 8)));
|
|
104
|
+
throw new RangeError(`Unsupported CBOR length ${info}`);
|
|
105
|
+
};
|
|
106
|
+
const read = () => {
|
|
107
|
+
need(1);
|
|
108
|
+
const first = bytes[pos++];
|
|
109
|
+
const major = first >> 5;
|
|
110
|
+
const info = first & 31;
|
|
111
|
+
switch (major) {
|
|
112
|
+
case 0:
|
|
113
|
+
return length(info);
|
|
114
|
+
case 1:
|
|
115
|
+
return -1 - length(info);
|
|
116
|
+
case 2: {
|
|
117
|
+
const n = length(info);
|
|
118
|
+
need(n);
|
|
119
|
+
pos += n;
|
|
120
|
+
return bytes.slice(pos - n, pos);
|
|
121
|
+
}
|
|
122
|
+
case 3: {
|
|
123
|
+
const n = length(info);
|
|
124
|
+
need(n);
|
|
125
|
+
pos += n;
|
|
126
|
+
return dec.decode(bytes.subarray(pos - n, pos));
|
|
127
|
+
}
|
|
128
|
+
case 4: {
|
|
129
|
+
const n = length(info);
|
|
130
|
+
return Array.from({ length: n }, read);
|
|
131
|
+
}
|
|
132
|
+
case 5: {
|
|
133
|
+
const n = length(info);
|
|
134
|
+
const out = {};
|
|
135
|
+
for (let i = 0; i < n; i++) {
|
|
136
|
+
const key = read();
|
|
137
|
+
out[String(key)] = read();
|
|
138
|
+
}
|
|
139
|
+
return out;
|
|
140
|
+
}
|
|
141
|
+
case 6:
|
|
142
|
+
length(info);
|
|
143
|
+
return read();
|
|
144
|
+
case 7:
|
|
145
|
+
if (info === 20)
|
|
146
|
+
return false;
|
|
147
|
+
if (info === 21)
|
|
148
|
+
return true;
|
|
149
|
+
if (info === 22 || info === 23)
|
|
150
|
+
return null;
|
|
151
|
+
if (info === 25) {
|
|
152
|
+
need(2);
|
|
153
|
+
pos += 2;
|
|
154
|
+
return view.getFloat16 ? view.getFloat16(pos - 2) : halfToFloat(view.getUint16(pos - 2));
|
|
155
|
+
}
|
|
156
|
+
if (info === 26)
|
|
157
|
+
return (need(4), (pos += 4), view.getFloat32(pos - 4));
|
|
158
|
+
if (info === 27)
|
|
159
|
+
return (need(8), (pos += 8), view.getFloat64(pos - 8));
|
|
160
|
+
throw new RangeError(`Unsupported CBOR simple value ${info}`);
|
|
161
|
+
default:
|
|
162
|
+
throw new RangeError(`Unsupported CBOR major type ${major}`);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
return read();
|
|
166
|
+
};
|
|
167
|
+
const halfToFloat = (h) => {
|
|
168
|
+
const sign = h & 0x8000 ? -1 : 1;
|
|
169
|
+
const exp = (h >> 10) & 0x1f;
|
|
170
|
+
const frac = h & 0x3ff;
|
|
171
|
+
if (exp === 0)
|
|
172
|
+
return sign * 2 ** -14 * (frac / 1024);
|
|
173
|
+
if (exp === 31)
|
|
174
|
+
return frac ? Number.NaN : sign * Number.POSITIVE_INFINITY;
|
|
175
|
+
return sign * 2 ** (exp - 15) * (1 + frac / 1024);
|
|
176
|
+
};
|
|
177
|
+
//# sourceMappingURL=Cbor.js.map
|
package/lib/Cbor.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cbor.js","sources":["../src/Cbor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;AAC9B,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;AAE9B,MAAM,GAAG;IACP,KAAK,GAAa,EAAE,CAAC;IACrB,IAAI,CAAC,KAAa,EAAE,CAAS;QAC3B,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CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;gBACxE,MAAM,IAAI,UAAU,CAAC,iCAAiC,IAAI,EAAE,CAAC,CAAC;YAChE;gBACE,MAAM,IAAI,UAAU,CAAC,+BAA+B,KAAK,EAAE,CAAC,CAAC;QACjE,CAAC;IACH,CAAC,CAAC;IACF,OAAO,IAAI,EAAE,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,CAAS,EAAU,EAAE;IACxC,MAAM,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,MAAM,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAC7B,MAAM,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC;IACvB,IAAI,GAAG,KAAK,CAAC;QAAE,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACtD,IAAI,GAAG,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC,iBAAiB,CAAC;IAC3E,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AACpD,CAAC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as Binding from "alchemy/Binding";
|
|
2
|
+
import type { RuntimeContext } from "alchemy/RuntimeContext";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Layer from "effect/Layer";
|
|
5
|
+
import type { PersistentSandbox } from "./PersistentSandbox.ts";
|
|
6
|
+
import { type PersistentSandboxHandleOf } from "./SandboxClient.ts";
|
|
7
|
+
/**
|
|
8
|
+
* A declared `Modal.PersistentSandbox`, reached from a runtime: its id, and
|
|
9
|
+
* the box's session API.
|
|
10
|
+
*/
|
|
11
|
+
export interface ConnectedPersistentSandbox extends Omit<PersistentSandboxHandleOf<RuntimeContext>, "persistentSandboxId"> {
|
|
12
|
+
/** The box's id (`ps-…`). */
|
|
13
|
+
readonly persistentSandboxId: Effect.Effect<string>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Connect to a declared `Modal.PersistentSandbox` from any runtime. The
|
|
17
|
+
* handle follows Modal's session API: `session()` returns the running
|
|
18
|
+
* session, resuming the box from its last session's filesystem when it's
|
|
19
|
+
* paused, and every session is a full sandbox handle (`exec`, `files`,
|
|
20
|
+
* snapshots).
|
|
21
|
+
*
|
|
22
|
+
* ### Use a persistent box
|
|
23
|
+
* **Example:** From a Cloudflare Worker
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import * as Cloudflare from "@alchemy.run/cloudflare";
|
|
26
|
+
* import * as Modal from "@alchemy.run/modal";
|
|
27
|
+
* import * as Effect from "effect/Effect";
|
|
28
|
+
* import * as HttpServerResponse from "effect/http/HttpServerResponse";
|
|
29
|
+
* import { DevBox } from "./DevBox.ts";
|
|
30
|
+
*
|
|
31
|
+
* export default class Shell extends Cloudflare.Worker<Shell>()(
|
|
32
|
+
* "Shell",
|
|
33
|
+
* { main: import.meta.url, compatibility: { flags: ["nodejs_compat"] } },
|
|
34
|
+
* Effect.gen(function* () {
|
|
35
|
+
* const box = yield* Modal.ConnectSandbox(DevBox);
|
|
36
|
+
* return {
|
|
37
|
+
* fetch: Effect.gen(function* () {
|
|
38
|
+
* const session = yield* box.session();
|
|
39
|
+
* const status = yield* session.exec("git status");
|
|
40
|
+
* return HttpServerResponse.text(status.stdout);
|
|
41
|
+
* }).pipe(Effect.orDie),
|
|
42
|
+
* };
|
|
43
|
+
* }).pipe(Effect.provide(Modal.ConnectSandboxHttp)),
|
|
44
|
+
* ) {}
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @binding
|
|
48
|
+
* @product Sandbox
|
|
49
|
+
*/
|
|
50
|
+
export interface ConnectSandbox extends Binding.Service<ConnectSandbox, "Modal.ConnectSandbox", (box: PersistentSandbox) => Effect.Effect<ConnectedPersistentSandbox>> {
|
|
51
|
+
}
|
|
52
|
+
export declare const ConnectSandbox: ConnectSandbox;
|
|
53
|
+
/**
|
|
54
|
+
* {@link ConnectSandbox} over Modal's API. Grants the runtime's identity the
|
|
55
|
+
* `contributor` role on the box's environment.
|
|
56
|
+
*
|
|
57
|
+
* @layer
|
|
58
|
+
* @product Sandbox
|
|
59
|
+
* @provides Modal.ConnectSandbox
|
|
60
|
+
*/
|
|
61
|
+
export declare const ConnectSandboxHttp: Layer.Layer<ConnectSandbox, never, never>;
|
|
62
|
+
/** {@link ConnectSandboxHttp}: Modal has one transport, so both names provide it. */
|
|
63
|
+
export declare const ConnectSandboxLive: Layer.Layer<ConnectSandbox, never, never>;
|
|
64
|
+
//# sourceMappingURL=ConnectSandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectSandbox.d.ts","sources":["../src/ConnectSandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAEL,KAAK,yBAAyB,EAE/B,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,MAAM,WAAW,0BAA2B,SAAQ,IAAI,CACtD,yBAAyB,CAAC,cAAc,CAAC,EACzC,qBAAqB,CACtB;IACC,6BAA6B;IAC7B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;CACrD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,cAAe,SAAQ,OAAO,CAAC,OAAO,CACrD,cAAc,EACd,sBAAsB,EACtB,CAAC,GAAG,EAAE,iBAAiB,KAAK,MAAM,CAAC,MAAM,CAAC,0BAA0B,CAAC,CACtE;CAAG;AAEJ,eAAO,MAAM,cAAc,gBAA0D,CAAC;AAEtF;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,2CAoB9B,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,kBAAkB,2CAAqB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as Binding from "alchemy/Binding";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import { makeModalBinding } from "./BindingHttp.js";
|
|
5
|
+
import { persistentSandboxHandle, SandboxOps, } from "./SandboxClient.js";
|
|
6
|
+
export const ConnectSandbox = Binding.Service("Modal.ConnectSandbox");
|
|
7
|
+
/**
|
|
8
|
+
* {@link ConnectSandbox} over Modal's API. Grants the runtime's identity the
|
|
9
|
+
* `contributor` role on the box's environment.
|
|
10
|
+
*
|
|
11
|
+
* @layer
|
|
12
|
+
* @product Sandbox
|
|
13
|
+
* @provides Modal.ConnectSandbox
|
|
14
|
+
*/
|
|
15
|
+
export const ConnectSandboxHttp = Layer.effect(ConnectSandbox, makeModalBinding({
|
|
16
|
+
tag: "Modal.ConnectSandbox",
|
|
17
|
+
operations: SandboxOps,
|
|
18
|
+
role: "contributor",
|
|
19
|
+
make: Effect.fn(function* (box, ops) {
|
|
20
|
+
const persistentSandboxId = yield* box.persistentSandboxId;
|
|
21
|
+
const environment = yield* box.environment;
|
|
22
|
+
// The box's identity resolves at runtime, on each call.
|
|
23
|
+
const handle = Effect.map(Effect.all([persistentSandboxId, environment]), ([id, env]) => persistentSandboxHandle(ops, id, { environment: env }));
|
|
24
|
+
return {
|
|
25
|
+
persistentSandboxId,
|
|
26
|
+
session: () => Effect.flatMap(handle, (h) => h.session()),
|
|
27
|
+
terminate: () => Effect.flatMap(handle, (h) => h.terminate()),
|
|
28
|
+
};
|
|
29
|
+
}),
|
|
30
|
+
}));
|
|
31
|
+
/** {@link ConnectSandboxHttp}: Modal has one transport, so both names provide it. */
|
|
32
|
+
export const ConnectSandboxLive = ConnectSandboxHttp;
|
|
33
|
+
//# sourceMappingURL=ConnectSandbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectSandbox.js","sources":["../src/ConnectSandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAE3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EACL,uBAAuB,EAEvB,UAAU,GACX,MAAM,oBAAoB,CAAC;AAuD5B,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAiB,sBAAsB,CAAC,CAAC;AAEtF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAC5C,cAAc,EACd,gBAAgB,CAAC;IACf,GAAG,EAAE,sBAAsB;IAC3B,UAAU,EAAE,UAAU;IACtB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,GAAsB,EAAE,GAAG;QACpD,MAAM,mBAAmB,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,mBAAmB,CAAC;QAC3D,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC;QAC3C,wDAAwD;QACxD,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,CACtF,uBAAuB,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CACvD,CAAC;QACF,OAAO;YACL,mBAAmB;YACnB,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;YACzD,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;SACzB,CAAC;IACzC,CAAC,CAAC;CACH,CAAC,CACH,CAAC;AAEF,qFAAqF;AACrF,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type * as Bundle from "alchemy/Bundle/Bundle";
|
|
2
|
+
import type { PlatformProps } from "alchemy/Platform";
|
|
3
|
+
import type * as Effect from "effect/Effect";
|
|
4
|
+
import type { App } from "./App.ts";
|
|
5
|
+
import type { Mount } from "./Mounts.ts";
|
|
6
|
+
import type { Providers } from "./Providers.ts";
|
|
7
|
+
import type { DurationInput } from "./SandboxClient.ts";
|
|
8
|
+
/** A resource, or the module-scope Effect that declares it. */
|
|
9
|
+
export type Ref<T> = T | Effect.Effect<T, never, Providers>;
|
|
10
|
+
/**
|
|
11
|
+
* Container settings shared by `Modal.Function` and `Modal.Server`: the
|
|
12
|
+
* program, the image it runs on, and Modal's resource, scaling and
|
|
13
|
+
* placement options.
|
|
14
|
+
*/
|
|
15
|
+
export interface ContainerProps extends PlatformProps {
|
|
16
|
+
/**
|
|
17
|
+
* Module entrypoint, bundled into the image. Typically `import.meta.url`.
|
|
18
|
+
* A change to the bundle builds a new image.
|
|
19
|
+
*/
|
|
20
|
+
main: string;
|
|
21
|
+
/** The App the function is deployed in. Changing it replaces the function. */
|
|
22
|
+
app: Ref<App>;
|
|
23
|
+
/**
|
|
24
|
+
* Name of the function in its App, unique per App. Changing it replaces
|
|
25
|
+
* the function.
|
|
26
|
+
* @default the logical ID
|
|
27
|
+
*/
|
|
28
|
+
name?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Base image the bundle runs on. It needs Bun on the `PATH`; Alchemy adds
|
|
31
|
+
* Python (see {@link python}).
|
|
32
|
+
* @default "oven/bun:1"
|
|
33
|
+
*/
|
|
34
|
+
image?: string;
|
|
35
|
+
/** Dockerfile lines run on the base before the bundle is added. */
|
|
36
|
+
commands?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* Standalone Python added to the image. Modal starts every Function
|
|
39
|
+
* container with its Python entrypoint, which then starts the program.
|
|
40
|
+
* Set `false` when the base image already has Python 3.10+ on the `PATH`.
|
|
41
|
+
* @default "3.12"
|
|
42
|
+
*/
|
|
43
|
+
python?: string | false;
|
|
44
|
+
/**
|
|
45
|
+
* Port the program listens on.
|
|
46
|
+
* @default 8000
|
|
47
|
+
*/
|
|
48
|
+
port?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Named export to load from `main`.
|
|
51
|
+
* @default "default"
|
|
52
|
+
*/
|
|
53
|
+
handler?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Extra environment variables for the program. Stored, with the bindings'
|
|
56
|
+
* env, in a Modal Secret attached to the function.
|
|
57
|
+
*/
|
|
58
|
+
env?: Record<string, any>;
|
|
59
|
+
/** Bundler options. */
|
|
60
|
+
build?: Bundle.BundleConfig;
|
|
61
|
+
/** Secrets whose variables the program sees as environment variables. */
|
|
62
|
+
secrets?: Array<Ref<{
|
|
63
|
+
readonly secretId: string;
|
|
64
|
+
}>>;
|
|
65
|
+
/**
|
|
66
|
+
* Volumes and cloud buckets mounted into every container:
|
|
67
|
+
* `{ volume: Data, path: "/data" }`, `{ bucket: Uploads, path: "/uploads", secret: R2Keys }`.
|
|
68
|
+
* `Modal.MountVolume` and `Modal.MountBucket` add more from the program.
|
|
69
|
+
*/
|
|
70
|
+
mounts?: Mount[];
|
|
71
|
+
/** CPU cores to reserve (fractional allowed). */
|
|
72
|
+
cpu?: number;
|
|
73
|
+
/** Most CPU cores a container may use. */
|
|
74
|
+
cpuLimit?: number;
|
|
75
|
+
/** Memory in MiB to reserve. */
|
|
76
|
+
memory?: number;
|
|
77
|
+
/** Most memory in MiB a container may use. */
|
|
78
|
+
memoryLimit?: number;
|
|
79
|
+
/** GPU: `"T4"`, `"L4"`, `"A10G"`, `"A100-80GB"`, `"H100"`, ..., with an optional `":<count>"`. */
|
|
80
|
+
gpu?: string;
|
|
81
|
+
/** Ephemeral disk in MiB. */
|
|
82
|
+
ephemeralDisk?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Most time one input (a call, a request) may run.
|
|
85
|
+
* @default 300 seconds
|
|
86
|
+
*/
|
|
87
|
+
timeout?: DurationInput;
|
|
88
|
+
/**
|
|
89
|
+
* Most time a container may take to start.
|
|
90
|
+
* @default the timeout
|
|
91
|
+
*/
|
|
92
|
+
startupTimeout?: DurationInput;
|
|
93
|
+
/** Containers kept running even with no traffic. @default 0 */
|
|
94
|
+
minContainers?: number;
|
|
95
|
+
/** Most containers running at once. */
|
|
96
|
+
maxContainers?: number;
|
|
97
|
+
/** Idle containers kept on top of demand while the function is busy. */
|
|
98
|
+
bufferContainers?: number;
|
|
99
|
+
/** Seconds of sustained demand before scaling up. */
|
|
100
|
+
scaleupWindow?: number;
|
|
101
|
+
/** Seconds a container may stay idle before it scales down. */
|
|
102
|
+
scaledownWindow?: number;
|
|
103
|
+
/** Regions containers may run in (`"us-east"`, `"eu"`, ...). */
|
|
104
|
+
regions?: string[];
|
|
105
|
+
/** Cloud provider containers run on. */
|
|
106
|
+
cloud?: "aws" | "gcp" | "oci" | "auto";
|
|
107
|
+
/** Run on non-preemptible capacity (costs more). */
|
|
108
|
+
nonpreemptible?: boolean;
|
|
109
|
+
/** A `Modal.Proxy` outbound traffic goes through (static egress IPs). */
|
|
110
|
+
proxy?: Ref<{
|
|
111
|
+
readonly proxyId: string;
|
|
112
|
+
}>;
|
|
113
|
+
/** Block all outbound network access. */
|
|
114
|
+
blockNetwork?: boolean;
|
|
115
|
+
/** Stop the program from calling Modal's API with the container's identity. */
|
|
116
|
+
restrictModalAccess?: boolean;
|
|
117
|
+
/** Snapshot the container's memory after startup, so cold starts restore it. */
|
|
118
|
+
enableMemorySnapshot?: boolean;
|
|
119
|
+
/** Enable IPv6 networking between the function's containers. */
|
|
120
|
+
i6pn?: boolean;
|
|
121
|
+
/** Pin Modal's image builder version (`"2025.06"`). */
|
|
122
|
+
builderVersion?: string;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=Container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Container.d.ts","sources":["../src/Container.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,+DAA+D;AAC/D,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAE5D;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD;;;OAG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EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+DAA+D;IAC/D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,wCAAwC;IACxC,KAAK,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IACvC,oDAAoD;IACpD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,yEAAyE;IACzE,KAAK,CAAC,EAAE,GAAG,CAAC;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1C,yCAAyC;IACzC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,+EAA+E;IAC/E,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gFAAgF;IAChF,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,gEAAgE;IAChE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uDAAuD;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
package/lib/Container.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=Container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Container.js","sources":["../src/Container.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as Contributions from "alchemy/Contributions";
|
|
2
|
+
declare const _default: {
|
|
3
|
+
readonly name: "modal";
|
|
4
|
+
readonly auth: Contributions.Lazy<import("effect/Layer").Layer<never, never, import("alchemy/Auth/Registry").AuthProviders | import("effect/process/ChildProcessSpawner").ChildProcessSpawner | import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("effect/crypto/SecureRandom").SecureRandom>>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
7
|
+
//# sourceMappingURL=Contributions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Contributions.d.ts","sources":["../src/Contributions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,uBAAuB,CAAC;;;;;AAEvD,wBAMG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Contributions.js","sources":["../src/Contributions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,uBAAuB,CAAC;AAEvD,eAAe,aAAa,CAAC,IAAI,CAAC;IAChC,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,aAAa,CAAC,IAAI,CACtB,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,EACjC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAC7B;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
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 { DictsOps } from "./CreateDictHttp.ts";
|
|
5
|
+
import type { ensureDict, lookupDict } from "./Dict.ts";
|
|
6
|
+
import type { DictAttributes } from "./Dict.ts";
|
|
7
|
+
import type { ReadWriteDictClient } from "./DictClient.ts";
|
|
8
|
+
import type { Environment } from "./Environment.ts";
|
|
9
|
+
import type { ErrorOf, OpError } from "./internal.ts";
|
|
10
|
+
/** A dict created or found at runtime: its attributes plus a read-write client. */
|
|
11
|
+
export interface DictHandle extends ReadWriteDictClient {
|
|
12
|
+
readonly dictId: Effect.Effect<string>;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
/** The attributes, to pass where a `Modal.Dict` is accepted (e.g. sandbox mounts). */
|
|
15
|
+
readonly attributes: DictAttributes;
|
|
16
|
+
}
|
|
17
|
+
/** Get, create, list and delete dicts by name in one environment. */
|
|
18
|
+
export interface DictsClientOf<R> {
|
|
19
|
+
/** The dict named `name`, created when missing (Modal's own get-or-create). */
|
|
20
|
+
getOrCreate(name: string): Effect.Effect<DictHandle, ErrorOf<typeof ensureDict>, R>;
|
|
21
|
+
/** The dict named `name`, or `undefined`. */
|
|
22
|
+
get(name: string): Effect.Effect<DictHandle | undefined, ErrorOf<typeof lookupDict>, R>;
|
|
23
|
+
/** Delete the dict named `name` (no-op when missing). */
|
|
24
|
+
delete(name: string): Effect.Effect<void, ErrorOf<typeof lookupDict> | Exclude<OpError<DictsOps, "delete">, {
|
|
25
|
+
readonly _tag: "DictNotFound";
|
|
26
|
+
}>, R>;
|
|
27
|
+
/** Names of every dict in the environment. */
|
|
28
|
+
list(): Effect.Effect<ReadonlyArray<string>, OpError<DictsOps, "list">, R>;
|
|
29
|
+
}
|
|
30
|
+
/** A DictsClient whose calls run inside a deployed runtime. */
|
|
31
|
+
export type DictsClient = DictsClientOf<RuntimeContext>;
|
|
32
|
+
/**
|
|
33
|
+
* Create dicts by name at runtime: one per user, session or task.
|
|
34
|
+
* Modal's native shape is get-or-create by name, so `getOrCreate` is
|
|
35
|
+
* idempotent and safe to call on every request.
|
|
36
|
+
*
|
|
37
|
+
* Bind it to a `Modal.Environment` to keep these runtime objects in their
|
|
38
|
+
* own namespace (or to nothing, for the workspace's default environment).
|
|
39
|
+
* They aren't in Alchemy state: deleting the environment removes them.
|
|
40
|
+
*
|
|
41
|
+
* Objects created at run time are tagged with the stack, stage and binding
|
|
42
|
+
* (`alchemy::stack`, `alchemy::stage`, `alchemy::id`) and are not deleted when
|
|
43
|
+
* the stack is destroyed. A Modal dict has only a name, so the tags become
|
|
44
|
+
* its name prefix, `Modal.runtimePrefix({ stack, stage, id })`: list them
|
|
45
|
+
* with `modal dict list` and delete the ones whose name starts with it.
|
|
46
|
+
*
|
|
47
|
+
* ### One dict per user
|
|
48
|
+
* **Example:** From a Cloudflare Worker
|
|
49
|
+
* ```typescript
|
|
50
|
+
* import * as Cloudflare from "@alchemy.run/cloudflare";
|
|
51
|
+
* import * as Modal from "@alchemy.run/modal";
|
|
52
|
+
* import * as Effect from "effect/Effect";
|
|
53
|
+
* import * as Layer from "effect/Layer";
|
|
54
|
+
* import { HttpServerRequest } from "effect/http/HttpServerRequest";
|
|
55
|
+
* import * as HttpServerResponse from "effect/http/HttpServerResponse";
|
|
56
|
+
* import { Agents, Coder } from "./Coder.ts";
|
|
57
|
+
*
|
|
58
|
+
* export default class Api extends Cloudflare.Worker<Api>()(
|
|
59
|
+
* "Api",
|
|
60
|
+
* { main: import.meta.url },
|
|
61
|
+
* Effect.gen(function* () {
|
|
62
|
+
* const dicts = yield* Modal.CreateDict(Agents);
|
|
63
|
+
* const sandboxes = yield* Modal.CreateSandbox(Coder);
|
|
64
|
+
* return {
|
|
65
|
+
* fetch: Effect.gen(function* () {
|
|
66
|
+
* const request = yield* HttpServerRequest;
|
|
67
|
+
* const user = request.headers["x-user"] ?? "anonymous";
|
|
68
|
+
* const state = yield* dicts.getOrCreate(`state-${user}`);
|
|
69
|
+
* yield* state.put("lastSeen", Date.now());
|
|
70
|
+
* return HttpServerResponse.text("ok");
|
|
71
|
+
* }).pipe(Effect.orDie),
|
|
72
|
+
* };
|
|
73
|
+
* }).pipe(Effect.provide(Layer.mergeAll(Modal.CreateDictHttp, Modal.CreateSandboxHttp))),
|
|
74
|
+
* ) {}
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @binding
|
|
78
|
+
* @product Dict
|
|
79
|
+
*/
|
|
80
|
+
export interface CreateDict extends Binding.Service<CreateDict, "Modal.CreateDict", (environment?: Environment) => Effect.Effect<DictsClient>> {
|
|
81
|
+
}
|
|
82
|
+
export declare const CreateDict: CreateDict;
|
|
83
|
+
//# sourceMappingURL=CreateDict.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateDict.d.ts","sources":["../src/CreateDict.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAA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AAQ,EAAE,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;KAAE,CAAC,EACzE,CAAC,CACF,CAAC;IACF,8CAA8C;IAC9C,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;CAC5E;AAED,+DAA+D;AAC/D,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC,cAAc,CAAC,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,MAAM,WAAW,UAAW,SAAQ,OAAO,CAAC,OAAO,CACjD,UAAU,EACV,kBAAkB,EAClB,CAAC,WAAW,CAAC,EAAE,WAAW,KAAK,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAC1D;CAAG;AAEJ,eAAO,MAAM,UAAU,YAAkD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateDict.js","sources":["../src/CreateDict.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AA8F3C,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAa,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as dict from "@distilled.cloud/modal/dict";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import { CreateDict, type DictsClientOf } from "./CreateDict.ts";
|
|
5
|
+
import { type RuntimeOwner } from "./RuntimeOwner.ts";
|
|
6
|
+
/** The operations the client calls, resolved by `ModalBindings.withCredentials`. */
|
|
7
|
+
export declare const DictsOps: Effect.Effect<{
|
|
8
|
+
readonly getOrCreate: (input: dict.DictGetOrCreateRequest) => Effect.Effect<dict.DictGetOrCreateResponse, dict.DictGetOrCreateError, never>;
|
|
9
|
+
readonly delete: (input: dict.DeleteDictRequest) => Effect.Effect<dict.DeleteDictResponse, dict.DeleteDictError, never>;
|
|
10
|
+
readonly list: import("@distilled.cloud/core/api").PaginatedCall<dict.ListDictRequest, dict.ListDictResponse, dict.ListDictError, never, dict.ListDictResponseDictInfo>;
|
|
11
|
+
readonly client: {
|
|
12
|
+
readonly clearDict: (input: dict.ClearDictRequest) => Effect.Effect<dict.ClearDictResponse, dict.ClearDictError, never>;
|
|
13
|
+
readonly dictContains: (input: dict.DictContainsRequest) => Effect.Effect<dict.DictContainsResponse, dict.DictContainsError, never>;
|
|
14
|
+
readonly dictContents: import("@distilled.cloud/core/api").StreamingCall<dict.DictContentsRequest, dict.DictContentsStream, dict.DictContentsError, never, dict.DictEntry>;
|
|
15
|
+
readonly dictLen: (input: dict.DictLenRequest) => Effect.Effect<dict.DictLenResponse, dict.DictLenError, never>;
|
|
16
|
+
readonly dictPop: (input: dict.DictPopRequest) => Effect.Effect<dict.DictPopResponse, dict.DictPopError, never>;
|
|
17
|
+
readonly getDict: (input: dict.GetDictRequest) => Effect.Effect<dict.GetDictResponse, dict.GetDictError, never>;
|
|
18
|
+
readonly updateDict: (input: dict.UpdateDictRequest) => Effect.Effect<dict.UpdateDictResponse, dict.UpdateDictError, never>;
|
|
19
|
+
};
|
|
20
|
+
}, never, import("./internal.ts").OperationServices>;
|
|
21
|
+
export type DictsOps = Effect.Success<typeof DictsOps>;
|
|
22
|
+
/** A dicts client over an environment name resolved per call. */
|
|
23
|
+
export declare const makeDictsClient: (environment: Effect.Effect<string | undefined>, ops: DictsOps, owner?: Effect.Effect<RuntimeOwner | undefined>) => DictsClientOf<never>;
|
|
24
|
+
/**
|
|
25
|
+
* {@link CreateDict} over Modal's API. Grants the host's identity (a scoped
|
|
26
|
+
* `Modal.ServiceUser`) the `contributor` role on the environment.
|
|
27
|
+
*
|
|
28
|
+
* @layer
|
|
29
|
+
* @product Dict
|
|
30
|
+
* @provides Modal.CreateDict
|
|
31
|
+
*/
|
|
32
|
+
export declare const CreateDictHttp: Layer.Layer<CreateDict, never, never>;
|
|
33
|
+
//# sourceMappingURL=CreateDictHttp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateDictHttp.d.ts","sources":["../src/CreateDictHttp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,6BAA6B,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAmB,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKlF,OAAO,EAAa,KAAK,YAAY,EAA+B,MAAM,mBAAmB,CAAC;AAE9F,oFAAoF;AACpF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;oDAKnB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,QAAQ,CAAC,CAAC;AASvD,iEAAiE;AACjE,eAAO,MAAM,eAAe,gBACb,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC,OACzC,QAAQ,UACN,MAAM,CAAC,MAAM,CAAC,YAAY,GAAG,SAAS,CAAC,KAC7C,aAAa,CAAC,KAAK,CAkCpB,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,uCAa1B,CAAC"}
|