alchemy 2.0.0-beta.44 → 2.0.0-beta.46
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/bin/exec.js +67 -8
- package/bin/exec.js.map +1 -1
- package/lib/AWS/Lambda/Function.d.ts +17 -0
- package/lib/AWS/Lambda/Function.d.ts.map +1 -1
- package/lib/AWS/Lambda/Function.js +61 -16
- package/lib/AWS/Lambda/Function.js.map +1 -1
- package/lib/AWS/Providers.d.ts +2 -1
- package/lib/AWS/Providers.d.ts.map +1 -1
- package/lib/AWS/Providers.js +3 -1
- package/lib/AWS/Providers.js.map +1 -1
- package/lib/AlchemyContext.d.ts +0 -1
- package/lib/AlchemyContext.d.ts.map +1 -1
- package/lib/AlchemyContext.js.map +1 -1
- package/lib/Apply.js +17 -1
- package/lib/Apply.js.map +1 -1
- package/lib/Auth/AuthProvider.d.ts.map +1 -1
- package/lib/Auth/AuthProvider.js +24 -6
- package/lib/Auth/AuthProvider.js.map +1 -1
- package/lib/Auth/Credentials.d.ts.map +1 -1
- package/lib/Auth/Credentials.js +3 -3
- package/lib/Auth/Credentials.js.map +1 -1
- package/lib/Cli/commands/_shared.d.ts +13 -1
- package/lib/Cli/commands/_shared.d.ts.map +1 -1
- package/lib/Cli/commands/_shared.js +33 -2
- package/lib/Cli/commands/_shared.js.map +1 -1
- package/lib/Cli/commands/cloudflare.d.ts.map +1 -1
- package/lib/Cli/commands/cloudflare.js +5 -1
- package/lib/Cli/commands/cloudflare.js.map +1 -1
- package/lib/Cli/commands/dev.d.ts.map +1 -1
- package/lib/Cli/commands/dev.js +10 -1
- package/lib/Cli/commands/dev.js.map +1 -1
- package/lib/Cli/commands/login.d.ts.map +1 -1
- package/lib/Cli/commands/login.js +19 -5
- package/lib/Cli/commands/login.js.map +1 -1
- package/lib/Cli/commands/profile.d.ts.map +1 -1
- package/lib/Cli/commands/profile.js +7 -27
- package/lib/Cli/commands/profile.js.map +1 -1
- package/lib/Cli/main.d.ts.map +1 -1
- package/lib/Cli/main.js +0 -2
- package/lib/Cli/main.js.map +1 -1
- package/lib/Cloudflare/AiGateway/AiGateway.d.ts +0 -2
- package/lib/Cloudflare/AiGateway/AiGateway.d.ts.map +1 -1
- package/lib/Cloudflare/AiGateway/AiGateway.js +2 -4
- package/lib/Cloudflare/AiGateway/AiGateway.js.map +1 -1
- package/lib/Cloudflare/BrowserRendering/BrowserRendering.d.ts +116 -0
- package/lib/Cloudflare/BrowserRendering/BrowserRendering.d.ts.map +1 -0
- package/lib/Cloudflare/BrowserRendering/BrowserRendering.js +92 -0
- package/lib/Cloudflare/BrowserRendering/BrowserRendering.js.map +1 -0
- package/lib/Cloudflare/BrowserRendering/BrowserRenderingBinding.d.ts +55 -0
- package/lib/Cloudflare/BrowserRendering/BrowserRenderingBinding.d.ts.map +1 -0
- package/lib/Cloudflare/BrowserRendering/BrowserRenderingBinding.js +55 -0
- package/lib/Cloudflare/BrowserRendering/BrowserRenderingBinding.js.map +1 -0
- package/lib/Cloudflare/BrowserRendering/index.d.ts +3 -0
- package/lib/Cloudflare/BrowserRendering/index.d.ts.map +1 -0
- package/lib/Cloudflare/BrowserRendering/index.js +3 -0
- package/lib/Cloudflare/BrowserRendering/index.js.map +1 -0
- package/lib/Cloudflare/Container/Container.d.ts +3 -3
- package/lib/Cloudflare/Container/Container.js +3 -3
- package/lib/Cloudflare/Container/StartContainer.d.ts.map +1 -1
- package/lib/Cloudflare/Container/StartContainer.js.map +1 -1
- package/lib/Cloudflare/D1/D1Database.d.ts +1 -0
- package/lib/Cloudflare/D1/D1Database.d.ts.map +1 -1
- package/lib/Cloudflare/D1/D1Database.js +2 -1
- package/lib/Cloudflare/D1/D1Database.js.map +1 -1
- package/lib/Cloudflare/D1/D1DatabaseBinding.js +1 -1
- package/lib/Cloudflare/D1/D1DatabaseBinding.js.map +1 -1
- package/lib/Cloudflare/Fetcher.d.ts.map +1 -1
- package/lib/Cloudflare/Fetcher.js +0 -2
- package/lib/Cloudflare/Fetcher.js.map +1 -1
- package/lib/Cloudflare/Hyperdrive/Hyperdrive.d.ts +1 -0
- package/lib/Cloudflare/Hyperdrive/Hyperdrive.d.ts.map +1 -1
- package/lib/Cloudflare/Hyperdrive/Hyperdrive.js +3 -0
- package/lib/Cloudflare/Hyperdrive/Hyperdrive.js.map +1 -1
- package/lib/Cloudflare/Hyperdrive/HyperdriveBinding.d.ts +3 -2
- package/lib/Cloudflare/Hyperdrive/HyperdriveBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Hyperdrive/HyperdriveBinding.js +32 -33
- package/lib/Cloudflare/Hyperdrive/HyperdriveBinding.js.map +1 -1
- package/lib/Cloudflare/KV/KVNamespace.d.ts +1 -0
- package/lib/Cloudflare/KV/KVNamespace.d.ts.map +1 -1
- package/lib/Cloudflare/KV/KVNamespace.js +2 -0
- package/lib/Cloudflare/KV/KVNamespace.js.map +1 -1
- package/lib/Cloudflare/Local.js +1 -1
- package/lib/Cloudflare/Local.js.map +1 -1
- package/lib/Cloudflare/Providers.d.ts +2 -1
- package/lib/Cloudflare/Providers.d.ts.map +1 -1
- package/lib/Cloudflare/Providers.js +25 -17
- package/lib/Cloudflare/Providers.js.map +1 -1
- package/lib/Cloudflare/Queue/Queue.d.ts +1 -0
- package/lib/Cloudflare/Queue/Queue.d.ts.map +1 -1
- package/lib/Cloudflare/Queue/Queue.js +1 -0
- package/lib/Cloudflare/Queue/Queue.js.map +1 -1
- package/lib/Cloudflare/Queue/QueueConsumer.d.ts +2 -1
- package/lib/Cloudflare/Queue/QueueConsumer.d.ts.map +1 -1
- package/lib/Cloudflare/Queue/QueueConsumer.js +10 -3
- package/lib/Cloudflare/Queue/QueueConsumer.js.map +1 -1
- package/lib/Cloudflare/Queue/QueueEventSource.d.ts +30 -4
- package/lib/Cloudflare/Queue/QueueEventSource.d.ts.map +1 -1
- package/lib/Cloudflare/Queue/QueueEventSource.js +22 -1
- package/lib/Cloudflare/Queue/QueueEventSource.js.map +1 -1
- package/lib/Cloudflare/R2/R2Bucket.d.ts +1 -0
- package/lib/Cloudflare/R2/R2Bucket.d.ts.map +1 -1
- package/lib/Cloudflare/R2/R2Bucket.js +18 -0
- package/lib/Cloudflare/R2/R2Bucket.js.map +1 -1
- package/lib/Cloudflare/SecretsStore/Secret.d.ts.map +1 -1
- package/lib/Cloudflare/SecretsStore/Secret.js +13 -34
- package/lib/Cloudflare/SecretsStore/Secret.js.map +1 -1
- package/lib/Cloudflare/SecretsStore/SecretBinding.d.ts +3 -2
- package/lib/Cloudflare/SecretsStore/SecretBinding.d.ts.map +1 -1
- package/lib/Cloudflare/SecretsStore/SecretBinding.js +3 -2
- package/lib/Cloudflare/SecretsStore/SecretBinding.js.map +1 -1
- package/lib/Cloudflare/StateStore/Api.d.ts +5 -13
- package/lib/Cloudflare/StateStore/Api.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/Api.js +14 -8
- package/lib/Cloudflare/StateStore/Api.js.map +1 -1
- package/lib/Cloudflare/StateStore/State.d.ts +11 -65
- package/lib/Cloudflare/StateStore/State.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/State.js +320 -343
- package/lib/Cloudflare/StateStore/State.js.map +1 -1
- package/lib/Cloudflare/StateStore/Store.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/Store.js +21 -31
- package/lib/Cloudflare/StateStore/Store.js.map +1 -1
- package/lib/Cloudflare/Vectorize/VectorizeIndex.d.ts +114 -0
- package/lib/Cloudflare/Vectorize/VectorizeIndex.d.ts.map +1 -0
- package/lib/Cloudflare/Vectorize/VectorizeIndex.js +157 -0
- package/lib/Cloudflare/Vectorize/VectorizeIndex.js.map +1 -0
- package/lib/Cloudflare/Vectorize/VectorizeIndexBinding.d.ts +38 -0
- package/lib/Cloudflare/Vectorize/VectorizeIndexBinding.d.ts.map +1 -0
- package/lib/Cloudflare/Vectorize/VectorizeIndexBinding.js +44 -0
- package/lib/Cloudflare/Vectorize/VectorizeIndexBinding.js.map +1 -0
- package/lib/Cloudflare/Vectorize/VectorizeMetadataIndex.d.ts +72 -0
- package/lib/Cloudflare/Vectorize/VectorizeMetadataIndex.d.ts.map +1 -0
- package/lib/Cloudflare/Vectorize/VectorizeMetadataIndex.js +131 -0
- package/lib/Cloudflare/Vectorize/VectorizeMetadataIndex.js.map +1 -0
- package/lib/Cloudflare/Vectorize/index.d.ts +4 -0
- package/lib/Cloudflare/Vectorize/index.d.ts.map +1 -0
- package/lib/Cloudflare/Vectorize/index.js +4 -0
- package/lib/Cloudflare/Vectorize/index.js.map +1 -0
- package/lib/Cloudflare/VpcService/VpcService.d.ts +2 -2
- package/lib/Cloudflare/VpcService/VpcService.d.ts.map +1 -1
- package/lib/Cloudflare/Website/StaticSite.d.ts +5 -5
- package/lib/Cloudflare/Website/StaticSite.d.ts.map +1 -1
- package/lib/Cloudflare/Website/StaticSite.js +3 -0
- package/lib/Cloudflare/Website/StaticSite.js.map +1 -1
- package/lib/Cloudflare/Website/Vite.d.ts +5 -5
- package/lib/Cloudflare/Website/Vite.d.ts.map +1 -1
- package/lib/Cloudflare/Website/Vite.js.map +1 -1
- package/lib/Cloudflare/Workers/Assets.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Assets.js +1 -1
- package/lib/Cloudflare/Workers/Assets.js.map +1 -1
- package/lib/Cloudflare/Workers/DurableObjectBridge.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/DurableObjectBridge.js +4 -2
- package/lib/Cloudflare/Workers/DurableObjectBridge.js.map +1 -1
- package/lib/Cloudflare/Workers/DurableObjectNamespace.d.ts +183 -6
- package/lib/Cloudflare/Workers/DurableObjectNamespace.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/DurableObjectNamespace.js +279 -76
- package/lib/Cloudflare/Workers/DurableObjectNamespace.js.map +1 -1
- package/lib/Cloudflare/Workers/HttpServer.d.ts +6 -4
- package/lib/Cloudflare/Workers/HttpServer.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/HttpServer.js +20 -15
- package/lib/Cloudflare/Workers/HttpServer.js.map +1 -1
- package/lib/Cloudflare/Workers/InferEnv.d.ts +3 -2
- package/lib/Cloudflare/Workers/InferEnv.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts +4 -7
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js +111 -66
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js.map +1 -1
- package/lib/Cloudflare/Workers/Rpc.d.ts +16 -0
- package/lib/Cloudflare/Workers/Rpc.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Rpc.js +22 -0
- package/lib/Cloudflare/Workers/Rpc.js.map +1 -1
- package/lib/Cloudflare/Workers/RpcDurableObjectNamespace.d.ts +285 -0
- package/lib/Cloudflare/Workers/RpcDurableObjectNamespace.d.ts.map +1 -0
- package/lib/Cloudflare/Workers/RpcDurableObjectNamespace.js +288 -0
- package/lib/Cloudflare/Workers/RpcDurableObjectNamespace.js.map +1 -0
- package/lib/Cloudflare/Workers/RpcWorker.d.ts +305 -0
- package/lib/Cloudflare/Workers/RpcWorker.d.ts.map +1 -0
- package/lib/Cloudflare/Workers/RpcWorker.js +350 -0
- package/lib/Cloudflare/Workers/RpcWorker.js.map +1 -0
- package/lib/Cloudflare/Workers/Vite.d.ts +1 -1
- package/lib/Cloudflare/Workers/Vite.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Vite.js +2 -1
- package/lib/Cloudflare/Workers/Vite.js.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +69 -24
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +168 -47
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.d.ts +1 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.js +166 -97
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBinding.d.ts +12 -23
- package/lib/Cloudflare/Workers/WorkerBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBinding.js +3 -0
- package/lib/Cloudflare/Workers/WorkerBinding.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBridge.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBridge.js +5 -2
- package/lib/Cloudflare/Workers/WorkerBridge.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.js +4 -1
- package/lib/Cloudflare/Workers/WorkerBundle.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerRuntimeContext.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerRuntimeContext.js +9 -10
- package/lib/Cloudflare/Workers/WorkerRuntimeContext.js.map +1 -1
- package/lib/Cloudflare/Workers/Workflow.d.ts +5 -3
- package/lib/Cloudflare/Workers/Workflow.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Workflow.js +19 -1
- package/lib/Cloudflare/Workers/Workflow.js.map +1 -1
- package/lib/Cloudflare/Workers/index.d.ts +2 -0
- package/lib/Cloudflare/Workers/index.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/index.js +2 -0
- package/lib/Cloudflare/Workers/index.js.map +1 -1
- package/lib/Cloudflare/index.d.ts +2 -0
- package/lib/Cloudflare/index.d.ts.map +1 -1
- package/lib/Cloudflare/index.js +2 -0
- package/lib/Cloudflare/index.js.map +1 -1
- package/lib/Dependencies.d.ts +10 -0
- package/lib/Dependencies.d.ts.map +1 -0
- package/lib/Dependencies.js +1 -0
- package/lib/Dependencies.js.map +1 -0
- package/lib/Deploy.d.ts +2 -1
- package/lib/Deploy.d.ts.map +1 -1
- package/lib/Deploy.js +2 -2
- package/lib/Deploy.js.map +1 -1
- package/lib/Diff.d.ts +11 -0
- package/lib/Diff.d.ts.map +1 -1
- package/lib/Diff.js +11 -0
- package/lib/Diff.js.map +1 -1
- package/lib/Input.d.ts +2 -1
- package/lib/Input.d.ts.map +1 -1
- package/lib/KeyPair.d.ts +77 -0
- package/lib/KeyPair.d.ts.map +1 -0
- package/lib/KeyPair.js +102 -0
- package/lib/KeyPair.js.map +1 -0
- package/lib/Local/RpcProvider.d.ts +3 -1
- package/lib/Local/RpcProvider.d.ts.map +1 -1
- package/lib/Local/RpcProvider.js +28 -2
- package/lib/Local/RpcProvider.js.map +1 -1
- package/lib/Local/RpcServerEnvironment.js +1 -1
- package/lib/Local/RpcServerEnvironment.js.map +1 -1
- package/lib/Neon/Project.d.ts.map +1 -1
- package/lib/Neon/Project.js +14 -3
- package/lib/Neon/Project.js.map +1 -1
- package/lib/Output.d.ts.map +1 -1
- package/lib/Output.js +9 -2
- package/lib/Output.js.map +1 -1
- package/lib/Phase.d.ts +2 -1
- package/lib/Phase.d.ts.map +1 -1
- package/lib/Phase.js +6 -1
- package/lib/Phase.js.map +1 -1
- package/lib/Plan.d.ts.map +1 -1
- package/lib/Plan.js +14 -3
- package/lib/Plan.js.map +1 -1
- package/lib/Platform.d.ts +8 -6
- package/lib/Platform.d.ts.map +1 -1
- package/lib/Platform.js +33 -3
- package/lib/Platform.js.map +1 -1
- package/lib/Random.d.ts.map +1 -1
- package/lib/Random.js +9 -14
- package/lib/Random.js.map +1 -1
- package/lib/RuntimeContext.d.ts +21 -1
- package/lib/RuntimeContext.d.ts.map +1 -1
- package/lib/RuntimeContext.js +12 -0
- package/lib/RuntimeContext.js.map +1 -1
- package/lib/Stack.d.ts +3 -3
- package/lib/Stack.d.ts.map +1 -1
- package/lib/Stack.js.map +1 -1
- package/lib/State/HttpStateApi.d.ts +2 -2
- package/lib/State/HttpStateStore.d.ts +4 -0
- package/lib/State/HttpStateStore.d.ts.map +1 -1
- package/lib/State/HttpStateStore.js +13 -0
- package/lib/State/HttpStateStore.js.map +1 -1
- package/lib/State/StateEncoding.d.ts +8 -0
- package/lib/State/StateEncoding.d.ts.map +1 -1
- package/lib/State/StateEncoding.js +55 -5
- package/lib/State/StateEncoding.js.map +1 -1
- package/lib/Test/Bun.d.ts.map +1 -1
- package/lib/Test/Bun.js +0 -2
- package/lib/Test/Bun.js.map +1 -1
- package/lib/Test/Vitest.d.ts.map +1 -1
- package/lib/Test/Vitest.js +0 -2
- package/lib/Test/Vitest.js.map +1 -1
- package/lib/Util/Duration.d.ts +14 -0
- package/lib/Util/Duration.d.ts.map +1 -0
- package/lib/Util/Duration.js +18 -0
- package/lib/Util/Duration.js.map +1 -0
- package/lib/Util/index.d.ts +0 -6
- package/lib/Util/index.d.ts.map +1 -1
- package/lib/Util/index.js +0 -6
- package/lib/Util/index.js.map +1 -1
- package/lib/Util/poll.d.ts +30 -0
- package/lib/Util/poll.d.ts.map +1 -0
- package/lib/Util/poll.js +26 -0
- package/lib/Util/poll.js.map +1 -0
- package/lib/Util/types.d.ts +3 -1
- package/lib/Util/types.d.ts.map +1 -1
- package/lib/Util/types.js +5 -1
- package/lib/Util/types.js.map +1 -1
- package/lib/index.d.ts +2 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -3
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +20 -19
- package/src/AWS/Lambda/Function.ts +87 -34
- package/src/AWS/Providers.ts +3 -0
- package/src/AlchemyContext.ts +0 -1
- package/src/Apply.ts +18 -1
- package/src/Auth/AuthProvider.ts +25 -5
- package/src/Auth/Credentials.ts +8 -7
- package/src/Cli/commands/_shared.ts +47 -4
- package/src/Cli/commands/cloudflare.ts +5 -3
- package/src/Cli/commands/dev.ts +13 -1
- package/src/Cli/commands/login.ts +20 -4
- package/src/Cli/commands/profile.ts +24 -34
- package/src/Cli/main.ts +0 -3
- package/src/Cloudflare/AiGateway/AiGateway.ts +2 -6
- package/src/Cloudflare/BrowserRendering/BrowserRendering.ts +132 -0
- package/src/Cloudflare/BrowserRendering/BrowserRenderingBinding.ts +137 -0
- package/src/Cloudflare/BrowserRendering/index.ts +11 -0
- package/src/Cloudflare/Container/Container.ts +3 -3
- package/src/Cloudflare/Container/StartContainer.ts +1 -2
- package/src/Cloudflare/D1/D1Database.ts +4 -1
- package/src/Cloudflare/D1/D1DatabaseBinding.ts +1 -1
- package/src/Cloudflare/Fetcher.ts +0 -2
- package/src/Cloudflare/Hyperdrive/Hyperdrive.ts +5 -0
- package/src/Cloudflare/Hyperdrive/HyperdriveBinding.ts +41 -43
- package/src/Cloudflare/KV/KVNamespace.ts +4 -0
- package/src/Cloudflare/Local.ts +1 -1
- package/src/Cloudflare/Providers.ts +32 -16
- package/src/Cloudflare/Queue/Queue.ts +3 -0
- package/src/Cloudflare/Queue/QueueConsumer.ts +21 -8
- package/src/Cloudflare/Queue/QueueEventSource.ts +33 -5
- package/src/Cloudflare/R2/R2Bucket.ts +26 -0
- package/src/Cloudflare/SecretsStore/Secret.ts +14 -41
- package/src/Cloudflare/SecretsStore/SecretBinding.ts +11 -11
- package/src/Cloudflare/StateStore/Api.ts +15 -15
- package/src/Cloudflare/StateStore/State.ts +468 -468
- package/src/Cloudflare/StateStore/Store.ts +27 -37
- package/src/Cloudflare/Vectorize/VectorizeIndex.ts +261 -0
- package/src/Cloudflare/Vectorize/VectorizeIndexBinding.ts +103 -0
- package/src/Cloudflare/Vectorize/VectorizeMetadataIndex.ts +208 -0
- package/src/Cloudflare/Vectorize/index.ts +3 -0
- package/src/Cloudflare/VpcService/VpcService.ts +2 -2
- package/src/Cloudflare/Website/StaticSite.ts +8 -10
- package/src/Cloudflare/Website/Vite.ts +4 -7
- package/src/Cloudflare/Workers/Assets.ts +1 -1
- package/src/Cloudflare/Workers/DurableObjectBridge.ts +7 -4
- package/src/Cloudflare/Workers/DurableObjectNamespace.ts +380 -121
- package/src/Cloudflare/Workers/HttpServer.ts +31 -25
- package/src/Cloudflare/Workers/InferEnv.ts +15 -8
- package/src/Cloudflare/Workers/LocalWorkerProvider.ts +139 -78
- package/src/Cloudflare/Workers/Rpc.ts +50 -0
- package/src/Cloudflare/Workers/RpcDurableObjectNamespace.ts +502 -0
- package/src/Cloudflare/Workers/RpcWorker.ts +562 -0
- package/src/Cloudflare/Workers/Vite.ts +2 -0
- package/src/Cloudflare/Workers/Worker.ts +274 -93
- package/src/Cloudflare/Workers/WorkerAsyncBindings.ts +165 -103
- package/src/Cloudflare/Workers/WorkerBinding.ts +12 -0
- package/src/Cloudflare/Workers/WorkerBridge.ts +7 -4
- package/src/Cloudflare/Workers/WorkerBundle.ts +4 -1
- package/src/Cloudflare/Workers/WorkerRuntimeContext.ts +8 -15
- package/src/Cloudflare/Workers/Workflow.ts +22 -3
- package/src/Cloudflare/Workers/index.ts +2 -0
- package/src/Cloudflare/index.ts +2 -0
- package/src/Dependencies.ts +10 -0
- package/src/Deploy.ts +3 -1
- package/src/Diff.ts +13 -0
- package/src/Input.ts +2 -0
- package/src/KeyPair.ts +146 -0
- package/src/Local/RpcProvider.ts +45 -1
- package/src/Local/RpcServerEnvironment.ts +1 -1
- package/src/Neon/Project.ts +16 -3
- package/src/Output.ts +8 -2
- package/src/Phase.ts +8 -0
- package/src/Plan.ts +16 -3
- package/src/Platform.ts +74 -27
- package/src/Random.ts +22 -27
- package/src/RuntimeContext.ts +23 -1
- package/src/Stack.ts +3 -3
- package/src/State/HttpStateStore.ts +28 -0
- package/src/State/StateEncoding.ts +58 -7
- package/src/Test/Bun.ts +0 -3
- package/src/Test/Vitest.ts +0 -3
- package/src/Util/Duration.ts +21 -0
- package/src/Util/index.ts +0 -6
- package/src/Util/poll.ts +47 -0
- package/src/Util/types.ts +9 -2
- package/src/index.ts +2 -3
- package/lib/Secret.d.ts +0 -50
- package/lib/Secret.d.ts.map +0 -1
- package/lib/Secret.js +0 -23
- package/lib/Secret.js.map +0 -1
- package/lib/Trait.d.ts +0 -43
- package/lib/Trait.d.ts.map +0 -1
- package/lib/Trait.js +0 -17
- package/lib/Trait.js.map +0 -1
- package/lib/Util/LocalhostDns.d.ts +0 -23
- package/lib/Util/LocalhostDns.d.ts.map +0 -1
- package/lib/Util/LocalhostDns.js +0 -46
- package/lib/Util/LocalhostDns.js.map +0 -1
- package/lib/Util/assert-never.d.ts +0 -12
- package/lib/Util/assert-never.d.ts.map +0 -1
- package/lib/Util/assert-never.js +0 -11
- package/lib/Util/assert-never.js.map +0 -1
- package/lib/Util/class.d.ts +0 -3
- package/lib/Util/class.d.ts.map +0 -1
- package/lib/Util/class.js +0 -1
- package/lib/Util/class.js.map +0 -1
- package/lib/Util/ignore.d.ts +0 -40
- package/lib/Util/ignore.d.ts.map +0 -1
- package/lib/Util/ignore.js +0 -591
- package/lib/Util/ignore.js.map +0 -1
- package/lib/Util/instance.d.ts +0 -4
- package/lib/Util/instance.d.ts.map +0 -1
- package/lib/Util/instance.js +0 -1
- package/lib/Util/instance.js.map +0 -1
- package/lib/Util/pointer.d.ts +0 -5
- package/lib/Util/pointer.d.ts.map +0 -1
- package/lib/Util/pointer.js +0 -1
- package/lib/Util/pointer.js.map +0 -1
- package/lib/Util/schema-to-type.d.ts +0 -42
- package/lib/Util/schema-to-type.d.ts.map +0 -1
- package/lib/Util/schema-to-type.js +0 -364
- package/lib/Util/schema-to-type.js.map +0 -1
- package/lib/Util/todo.d.ts +0 -3
- package/lib/Util/todo.d.ts.map +0 -1
- package/lib/Util/todo.js +0 -3
- package/lib/Util/todo.js.map +0 -1
- package/lib/Variable.d.ts +0 -29
- package/lib/Variable.d.ts.map +0 -1
- package/lib/Variable.js +0 -9
- package/lib/Variable.js.map +0 -1
- package/src/Secret.ts +0 -87
- package/src/Trait.ts +0 -105
- package/src/Util/LocalhostDns.ts +0 -52
- package/src/Util/assert-never.ts +0 -18
- package/src/Util/class.ts +0 -7
- package/src/Util/ignore.ts +0 -815
- package/src/Util/instance.ts +0 -9
- package/src/Util/pointer.ts +0 -5
- package/src/Util/schema-to-type.ts +0 -456
- package/src/Util/todo.ts +0 -4
- package/src/Variable.ts +0 -44
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts an Effect Schema to TypeScript type definitions.
|
|
3
|
-
*
|
|
4
|
-
* This module recursively discovers all named types (like S.Class with identifiers)
|
|
5
|
-
* and generates interface definitions for each.
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
import type * as Schema from "effect/Schema";
|
|
10
|
-
import * as AST from "effect/SchemaAST";
|
|
11
|
-
/**
|
|
12
|
-
* The result of generating TypeScript type definitions.
|
|
13
|
-
*/
|
|
14
|
-
export interface TypeDefinitionResult {
|
|
15
|
-
/**
|
|
16
|
-
* The type expressions for each input schema.
|
|
17
|
-
* Each expression is either an identifier (for named types) or an inline type.
|
|
18
|
-
*/
|
|
19
|
-
readonly exprs: string[];
|
|
20
|
-
/**
|
|
21
|
-
* All type definitions as a single string.
|
|
22
|
-
* Contains all recursively discovered named types, separated by newlines.
|
|
23
|
-
* Types are deduplicated - if multiple schemas reference the same type,
|
|
24
|
-
* it will only appear once.
|
|
25
|
-
*/
|
|
26
|
-
readonly types: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Generates TypeScript type definitions from one or more schemas.
|
|
30
|
-
*
|
|
31
|
-
* All schemas share a single type environment, so types referenced by
|
|
32
|
-
* multiple schemas are only generated once (deduplication).
|
|
33
|
-
*/
|
|
34
|
-
export declare const schemaToType: <Schemas extends Schema.Schema<any>[]>(...schemas: Schemas) => TypeDefinitionResult;
|
|
35
|
-
/**
|
|
36
|
-
* Converts an AST node to a TypeScript type reference or inline type.
|
|
37
|
-
* Returns the identifier/type expression and collects named types.
|
|
38
|
-
*/
|
|
39
|
-
export declare const fromAST: (ast: AST.AST, options?: {
|
|
40
|
-
types?: string[];
|
|
41
|
-
}) => string;
|
|
42
|
-
//# sourceMappingURL=schema-to-type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema-to-type.d.ts","sourceRoot":"","sources":["../../src/Util/schema-to-type.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAEzB;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAC/D,GAAG,SAAS,OAAO,KAClB,oBAcF,CAAC;AAOF;;;GAGG;AACH,eAAO,MAAM,OAAO,GAClB,KAAK,GAAG,CAAC,GAAG,EACZ,UAAU;IAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,KAC7B,MAYF,CAAC"}
|
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts an Effect Schema to TypeScript type definitions.
|
|
3
|
-
*
|
|
4
|
-
* This module recursively discovers all named types (like S.Class with identifiers)
|
|
5
|
-
* and generates interface definitions for each.
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
import * as Predicate from "effect/Predicate";
|
|
10
|
-
import * as AST from "effect/SchemaAST";
|
|
11
|
-
/**
|
|
12
|
-
* Generates TypeScript type definitions from one or more schemas.
|
|
13
|
-
*
|
|
14
|
-
* All schemas share a single type environment, so types referenced by
|
|
15
|
-
* multiple schemas are only generated once (deduplication).
|
|
16
|
-
*/
|
|
17
|
-
export const schemaToType = (...schemas) => {
|
|
18
|
-
const typesMap = {};
|
|
19
|
-
const processing = new Set();
|
|
20
|
-
const exprs = schemas.map((schema) => go(schema.ast, { types: typesMap, processing }, "handle-identifier"));
|
|
21
|
-
const types = Object.values(typesMap).join("\n\n");
|
|
22
|
-
return {
|
|
23
|
-
exprs,
|
|
24
|
-
types,
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Converts an AST node to a TypeScript type reference or inline type.
|
|
29
|
-
* Returns the identifier/type expression and collects named types.
|
|
30
|
-
*/
|
|
31
|
-
export const fromAST = (ast, options) => {
|
|
32
|
-
const typesMap = {};
|
|
33
|
-
const processing = new Set();
|
|
34
|
-
const result = go(ast, { types: typesMap, processing }, "handle-identifier");
|
|
35
|
-
if (options?.types) {
|
|
36
|
-
for (const def of Object.values(typesMap)) {
|
|
37
|
-
options.types.push(def);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return result;
|
|
41
|
-
};
|
|
42
|
-
function getDescription(ast) {
|
|
43
|
-
const desc = AST.resolveDescription(ast);
|
|
44
|
-
if (desc === undefined)
|
|
45
|
-
return undefined;
|
|
46
|
-
if (AST.isString(ast) && desc === "a string")
|
|
47
|
-
return undefined;
|
|
48
|
-
if (AST.isNumber(ast) && desc === "a number")
|
|
49
|
-
return undefined;
|
|
50
|
-
if (AST.isBoolean(ast) && desc === "a boolean")
|
|
51
|
-
return undefined;
|
|
52
|
-
if (AST.isBigInt(ast) && desc === "a bigint")
|
|
53
|
-
return undefined;
|
|
54
|
-
if (AST.isSymbol(ast) && desc === "a symbol")
|
|
55
|
-
return undefined;
|
|
56
|
-
if (AST.isObjectKeyword(ast) &&
|
|
57
|
-
desc === "an object in the TypeScript meaning, i.e. the `object` type")
|
|
58
|
-
return undefined;
|
|
59
|
-
return desc;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Gets the identifier for a named type.
|
|
63
|
-
*
|
|
64
|
-
* Returns an identifier for:
|
|
65
|
-
* - S.Class types (Declarations with typeParameters and encoding)
|
|
66
|
-
* - Any schema with an explicit identifier annotation
|
|
67
|
-
* - Suspended types with identifiers
|
|
68
|
-
*
|
|
69
|
-
* Does NOT return identifier for simple transformations like NumberFromString.
|
|
70
|
-
*/
|
|
71
|
-
function getIdentifier(ast) {
|
|
72
|
-
if (AST.isDeclaration(ast)) {
|
|
73
|
-
return AST.resolveIdentifier(ast);
|
|
74
|
-
}
|
|
75
|
-
if (AST.isSuspend(ast)) {
|
|
76
|
-
const id = AST.resolveIdentifier(ast);
|
|
77
|
-
if (id !== undefined)
|
|
78
|
-
return id;
|
|
79
|
-
const resolved = ast.thunk();
|
|
80
|
-
return getIdentifier(resolved);
|
|
81
|
-
}
|
|
82
|
-
// For schemas with encoding chains (transforms like NumberFromString),
|
|
83
|
-
// don't treat as named types - just use the decoded type
|
|
84
|
-
if (ast.encoding) {
|
|
85
|
-
return undefined;
|
|
86
|
-
}
|
|
87
|
-
return AST.resolveIdentifier(ast);
|
|
88
|
-
}
|
|
89
|
-
function formatComment(description, indent) {
|
|
90
|
-
if (!description)
|
|
91
|
-
return "";
|
|
92
|
-
const lines = description.split("\n");
|
|
93
|
-
if (lines.length === 1) {
|
|
94
|
-
return `${indent}/** ${description} */\n`;
|
|
95
|
-
}
|
|
96
|
-
return `${indent}/**\n${lines.map((line) => `${indent} * ${line}`).join("\n")}\n${indent} */\n`;
|
|
97
|
-
}
|
|
98
|
-
function escapePropertyName(name) {
|
|
99
|
-
if (typeof name === "symbol") {
|
|
100
|
-
return `[${String(name)}]`;
|
|
101
|
-
}
|
|
102
|
-
const str = String(name);
|
|
103
|
-
if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(str)) {
|
|
104
|
-
return str;
|
|
105
|
-
}
|
|
106
|
-
return JSON.stringify(str);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Gets the type body for a named type (S.Class, etc).
|
|
110
|
-
* Navigates through Declarations to find the actual structure.
|
|
111
|
-
*/
|
|
112
|
-
function getTypeBody(ast, options) {
|
|
113
|
-
if (AST.isSuspend(ast)) {
|
|
114
|
-
return getTypeBody(ast.thunk(), options);
|
|
115
|
-
}
|
|
116
|
-
if (AST.isDeclaration(ast)) {
|
|
117
|
-
if (ast.typeParameters.length > 0) {
|
|
118
|
-
return go(ast.typeParameters[0], options, "ignore-identifier");
|
|
119
|
-
}
|
|
120
|
-
return "unknown";
|
|
121
|
-
}
|
|
122
|
-
return go(ast, options, "ignore-identifier");
|
|
123
|
-
}
|
|
124
|
-
function go(ast, options, identifierHandling) {
|
|
125
|
-
// Handle identifier references first
|
|
126
|
-
if (identifierHandling === "handle-identifier") {
|
|
127
|
-
const id = getIdentifier(ast);
|
|
128
|
-
if (id !== undefined) {
|
|
129
|
-
if (options.processing.has(id)) {
|
|
130
|
-
return id;
|
|
131
|
-
}
|
|
132
|
-
if (!(id in options.types)) {
|
|
133
|
-
options.processing.add(id);
|
|
134
|
-
const typeBody = getTypeBody(ast, options);
|
|
135
|
-
if (typeBody.startsWith("{")) {
|
|
136
|
-
options.types[id] = `interface ${id} ${typeBody}`;
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
options.types[id] = `type ${id} = ${typeBody};`;
|
|
140
|
-
}
|
|
141
|
-
options.processing.delete(id);
|
|
142
|
-
}
|
|
143
|
-
return id;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
// For Declarations without identifier (or when ignoring), get the body from typeParameters
|
|
147
|
-
if (AST.isDeclaration(ast) && identifierHandling === "ignore-identifier") {
|
|
148
|
-
if (ast.typeParameters.length > 0) {
|
|
149
|
-
return go(ast.typeParameters[0], options, identifierHandling);
|
|
150
|
-
}
|
|
151
|
-
return "unknown";
|
|
152
|
-
}
|
|
153
|
-
// Handle encoding chains (transformations): use the decoded type
|
|
154
|
-
if (ast.encoding) {
|
|
155
|
-
return go(AST.toType(ast), options, identifierHandling);
|
|
156
|
-
}
|
|
157
|
-
switch (ast._tag) {
|
|
158
|
-
case "Declaration": {
|
|
159
|
-
if (ast.typeParameters.length > 0) {
|
|
160
|
-
const id = getIdentifier(ast);
|
|
161
|
-
if (id) {
|
|
162
|
-
const params = ast.typeParameters
|
|
163
|
-
.map((p) => go(p, options, "handle-identifier"))
|
|
164
|
-
.join(", ");
|
|
165
|
-
return `${id}<${params}>`;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return "unknown";
|
|
169
|
-
}
|
|
170
|
-
case "Literal": {
|
|
171
|
-
const literal = ast.literal;
|
|
172
|
-
if (Predicate.isString(literal)) {
|
|
173
|
-
return JSON.stringify(literal);
|
|
174
|
-
}
|
|
175
|
-
if (Predicate.isNumber(literal)) {
|
|
176
|
-
return String(literal);
|
|
177
|
-
}
|
|
178
|
-
if (Predicate.isBoolean(literal)) {
|
|
179
|
-
return String(literal);
|
|
180
|
-
}
|
|
181
|
-
if (Predicate.isBigInt(literal)) {
|
|
182
|
-
return `${String(literal)}n`;
|
|
183
|
-
}
|
|
184
|
-
return "unknown";
|
|
185
|
-
}
|
|
186
|
-
case "Null":
|
|
187
|
-
return "null";
|
|
188
|
-
case "UniqueSymbol":
|
|
189
|
-
return `typeof ${String(ast.symbol)}`;
|
|
190
|
-
case "Undefined":
|
|
191
|
-
return "undefined";
|
|
192
|
-
case "Void":
|
|
193
|
-
return "void";
|
|
194
|
-
case "Never":
|
|
195
|
-
return "never";
|
|
196
|
-
case "Unknown":
|
|
197
|
-
return "unknown";
|
|
198
|
-
case "Any":
|
|
199
|
-
return "any";
|
|
200
|
-
case "String":
|
|
201
|
-
return "string";
|
|
202
|
-
case "Number":
|
|
203
|
-
return "number";
|
|
204
|
-
case "Boolean":
|
|
205
|
-
return "boolean";
|
|
206
|
-
case "BigInt":
|
|
207
|
-
return "bigint";
|
|
208
|
-
case "Symbol":
|
|
209
|
-
return "symbol";
|
|
210
|
-
case "ObjectKeyword":
|
|
211
|
-
return "object";
|
|
212
|
-
case "Enum": {
|
|
213
|
-
const values = ast.enums.map(([_, value]) => typeof value === "string" ? JSON.stringify(value) : String(value));
|
|
214
|
-
return values.join(" | ");
|
|
215
|
-
}
|
|
216
|
-
case "TemplateLiteral": {
|
|
217
|
-
return formatTemplateLiteral(ast, options);
|
|
218
|
-
}
|
|
219
|
-
case "Arrays": {
|
|
220
|
-
return formatArrays(ast, options);
|
|
221
|
-
}
|
|
222
|
-
case "Objects": {
|
|
223
|
-
return formatObjects(ast, options);
|
|
224
|
-
}
|
|
225
|
-
case "Union": {
|
|
226
|
-
const members = ast.types.map((t) => go(t, options, "handle-identifier"));
|
|
227
|
-
const unique = [...new Set(members)];
|
|
228
|
-
if (unique.length === 1) {
|
|
229
|
-
return unique[0];
|
|
230
|
-
}
|
|
231
|
-
return unique.join(" | ");
|
|
232
|
-
}
|
|
233
|
-
case "Suspend": {
|
|
234
|
-
const id = getIdentifier(ast);
|
|
235
|
-
if (id !== undefined) {
|
|
236
|
-
if (options.processing.has(id)) {
|
|
237
|
-
return id;
|
|
238
|
-
}
|
|
239
|
-
if (!(id in options.types)) {
|
|
240
|
-
options.processing.add(id);
|
|
241
|
-
const typeBody = getTypeBody(ast, options);
|
|
242
|
-
if (typeBody.startsWith("{")) {
|
|
243
|
-
options.types[id] = `interface ${id} ${typeBody}`;
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
options.types[id] = `type ${id} = ${typeBody};`;
|
|
247
|
-
}
|
|
248
|
-
options.processing.delete(id);
|
|
249
|
-
}
|
|
250
|
-
return id;
|
|
251
|
-
}
|
|
252
|
-
const resolved = ast.thunk();
|
|
253
|
-
return go(resolved, options, identifierHandling);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
function formatTemplateLiteral(ast, options) {
|
|
258
|
-
let result = "`";
|
|
259
|
-
for (const part of ast.parts) {
|
|
260
|
-
if (AST.isLiteral(part) && typeof part.literal === "string") {
|
|
261
|
-
result += part.literal;
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
const spanType = formatTemplateLiteralSpan(part, options);
|
|
265
|
-
result += "${" + spanType + "}";
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
result += "`";
|
|
269
|
-
return result;
|
|
270
|
-
}
|
|
271
|
-
function formatTemplateLiteralSpan(type, options) {
|
|
272
|
-
switch (type._tag) {
|
|
273
|
-
case "String":
|
|
274
|
-
return "string";
|
|
275
|
-
case "Number":
|
|
276
|
-
return "number";
|
|
277
|
-
case "Literal":
|
|
278
|
-
return typeof type.literal === "string"
|
|
279
|
-
? JSON.stringify(type.literal)
|
|
280
|
-
: String(type.literal);
|
|
281
|
-
case "TemplateLiteral":
|
|
282
|
-
return formatTemplateLiteral(type, options);
|
|
283
|
-
case "Union":
|
|
284
|
-
return type.types
|
|
285
|
-
.map((t) => formatTemplateLiteralSpan(t, options))
|
|
286
|
-
.join(" | ");
|
|
287
|
-
default:
|
|
288
|
-
return go(type, options, "handle-identifier");
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
function formatArrays(ast, options) {
|
|
292
|
-
const elements = [];
|
|
293
|
-
for (const element of ast.elements) {
|
|
294
|
-
const isOpt = AST.isOptional(element);
|
|
295
|
-
let typeStr;
|
|
296
|
-
if (isOpt && AST.isUnion(element)) {
|
|
297
|
-
const nonUndefined = element.types.filter((t) => !AST.isUndefined(t));
|
|
298
|
-
if (nonUndefined.length === 1) {
|
|
299
|
-
typeStr = go(nonUndefined[0], options, "handle-identifier");
|
|
300
|
-
}
|
|
301
|
-
else if (nonUndefined.length > 1) {
|
|
302
|
-
typeStr = nonUndefined
|
|
303
|
-
.map((t) => go(t, options, "handle-identifier"))
|
|
304
|
-
.join(" | ");
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
typeStr = go(element, options, "handle-identifier");
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
typeStr = go(element, options, "handle-identifier");
|
|
312
|
-
}
|
|
313
|
-
const description = getDescription(element);
|
|
314
|
-
const comment = description ? `/* ${description} */ ` : "";
|
|
315
|
-
if (isOpt) {
|
|
316
|
-
elements.push(`${comment}${typeStr}?`);
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
elements.push(`${comment}${typeStr}`);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
if (ast.rest.length > 0) {
|
|
323
|
-
const restType = go(ast.rest[0], options, "handle-identifier");
|
|
324
|
-
if (ast.elements.length === 0 && ast.rest.length === 1) {
|
|
325
|
-
if (!ast.isMutable) {
|
|
326
|
-
return `readonly ${restType}[]`;
|
|
327
|
-
}
|
|
328
|
-
return `${restType}[]`;
|
|
329
|
-
}
|
|
330
|
-
elements.push(`...${restType}[]`);
|
|
331
|
-
}
|
|
332
|
-
const prefix = !ast.isMutable ? "readonly " : "";
|
|
333
|
-
return `${prefix}[${elements.join(", ")}]`;
|
|
334
|
-
}
|
|
335
|
-
function formatObjects(ast, options) {
|
|
336
|
-
if (ast.propertySignatures.length === 0 && ast.indexSignatures.length === 0) {
|
|
337
|
-
return "{}";
|
|
338
|
-
}
|
|
339
|
-
const lines = [];
|
|
340
|
-
for (const ps of ast.propertySignatures) {
|
|
341
|
-
if (typeof ps.name !== "string" && typeof ps.name !== "number") {
|
|
342
|
-
continue;
|
|
343
|
-
}
|
|
344
|
-
const propName = escapePropertyName(ps.name);
|
|
345
|
-
const typeStr = go(ps.type, options, "handle-identifier");
|
|
346
|
-
const description = getDescription(ps.type);
|
|
347
|
-
const comment = formatComment(description, " ");
|
|
348
|
-
const isMutable = ps.type.context?.isMutable ?? false;
|
|
349
|
-
const readonly = isMutable ? "" : "readonly ";
|
|
350
|
-
const optional = AST.isOptional(ps.type) ? "?" : "";
|
|
351
|
-
lines.push(`${comment} ${readonly}${propName}${optional}: ${typeStr};`);
|
|
352
|
-
}
|
|
353
|
-
for (const is of ast.indexSignatures) {
|
|
354
|
-
const paramType = go(is.parameter, options, "handle-identifier");
|
|
355
|
-
const valueType = go(is.type, options, "handle-identifier");
|
|
356
|
-
const readonly = "readonly ";
|
|
357
|
-
lines.push(` ${readonly}[key: ${paramType}]: ${valueType};`);
|
|
358
|
-
}
|
|
359
|
-
if (lines.length === 0) {
|
|
360
|
-
return "{}";
|
|
361
|
-
}
|
|
362
|
-
return `{\n${lines.join("\n")}\n}`;
|
|
363
|
-
}
|
|
364
|
-
//# sourceMappingURL=schema-to-type.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema-to-type.js","sourceRoot":"","sources":["../../src/Util/schema-to-type.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AAqBxC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,GAAG,OAAgB,EACG,EAAE;IACxB,MAAM,QAAQ,GAA2B,EAAE,CAAC;IAC5C,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IAErC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACnC,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,mBAAmB,CAAC,CACrE,CAAC;IAEF,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEnD,OAAO;QACL,KAAK;QACL,KAAK;KACN,CAAC;AACJ,CAAC,CAAC;AAOF;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,GAAY,EACZ,OAA8B,EACtB,EAAE;IACV,MAAM,QAAQ,GAA2B,EAAE,CAAC;IAC5C,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IACrC,MAAM,MAAM,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,mBAAmB,CAAC,CAAC;IAE7E,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;QACnB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1C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OAAO,EAAE,SAAS,IAAI,KAAK,CAAC;QACtD,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;QAC9C,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAEpD,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,KAAK,QAAQ,GAAG,QAAQ,GAAG,QAAQ,KAAK,OAAO,GAAG,CAAC,CAAC;IAC3E,CAAC;IAED,KAAK,MAAM,EAAE,IAAI,GAAG,CAAC,eAAe,EAAE,CAAC;QACrC,MAAM,SAAS,GAAG,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC;QACjE,MAAM,SAAS,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC;QAC5D,MAAM,QAAQ,GAAG,WAAW,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,KAAK,QAAQ,SAAS,SAAS,MAAM,SAAS,GAAG,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;AACrC,CAAC"}
|
package/lib/Util/todo.d.ts
DELETED
package/lib/Util/todo.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"todo.d.ts","sourceRoot":"","sources":["../../src/Util/todo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,eAAO,MAAM,IAAI,GAAI,UAAU,MAAM,uCACK,CAAC"}
|
package/lib/Util/todo.js
DELETED
package/lib/Util/todo.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"todo.js","sourceRoot":"","sources":["../../src/Util/todo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,OAAgB,EAAE,EAAE,CACvC,MAAM,CAAC,GAAG,CAAC,OAAO,IAAI,iBAAiB,CAAC,CAAC"}
|
package/lib/Variable.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as Config from "effect/Config";
|
|
2
|
-
import * as Effect from "effect/Effect";
|
|
3
|
-
import * as Output from "./Output.ts";
|
|
4
|
-
/**
|
|
5
|
-
* The shapes a {@link variable} can be derived from.
|
|
6
|
-
*/
|
|
7
|
-
export type VariableInput<T, R = never> = T | Effect.Effect<T, any, R> | Config.Config<T>;
|
|
8
|
-
/**
|
|
9
|
-
* Bind a non-secret value into the active {@link RuntimeContext} (e.g. a
|
|
10
|
-
* Cloudflare Worker's `env`) under the given `name`. Counterpart to
|
|
11
|
-
* {@link Secret} for plain (non-redacted) values — the resource provider
|
|
12
|
-
* deploys it as `plain_text` / `json` rather than `secret_text`.
|
|
13
|
-
*
|
|
14
|
-
* The result is an `Output<T>` — `yield*`-ing it returns an `Accessor<T>`
|
|
15
|
-
* that resolves the value at runtime.
|
|
16
|
-
*
|
|
17
|
-
* @example One-arg shortcut — reads `Config.string("DATABASE_URL")`
|
|
18
|
-
* ```ts
|
|
19
|
-
* const url = yield* Alchemy.Variable("DATABASE_URL");
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @example From a literal
|
|
23
|
-
* ```ts
|
|
24
|
-
* const port = yield* Alchemy.Variable("PORT", 3000);
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare function Variable(name: string): Output.Output<string, never>;
|
|
28
|
-
export declare function Variable<T, R = never>(name: string, value: VariableInput<T, R>): Output.Output<T, R>;
|
|
29
|
-
//# sourceMappingURL=Variable.d.ts.map
|
package/lib/Variable.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Variable.d.ts","sourceRoot":"","sources":["../src/Variable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAGtC;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAClC,CAAC,GACD,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,GACxB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAErB;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACrE,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EACnC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GACzB,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
package/lib/Variable.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as Config from "effect/Config";
|
|
2
|
-
import * as Effect from "effect/Effect";
|
|
3
|
-
import * as Output from "./Output.js";
|
|
4
|
-
import { toOutput } from "./Secret.js";
|
|
5
|
-
export function Variable(name, value) {
|
|
6
|
-
const source = value ?? Config.string(name);
|
|
7
|
-
return Output.named(toOutput(source), name);
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=Variable.js.map
|
package/lib/Variable.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Variable.js","sourceRoot":"","sources":["../src/Variable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAkCvC,MAAM,UAAU,QAAQ,CACtB,IAAY,EACZ,KAA2B;IAE3B,MAAM,MAAM,GAAQ,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjD,OAAO,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAO,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;AACpD,CAAC"}
|
package/src/Secret.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import * as Config from "effect/Config";
|
|
2
|
-
import * as Effect from "effect/Effect";
|
|
3
|
-
import * as Redacted from "effect/Redacted";
|
|
4
|
-
import * as Output from "./Output.ts";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The shapes a {@link secret} can be derived from.
|
|
8
|
-
*
|
|
9
|
-
* - `string` — wrapped in `Redacted.make` and bound as a literal.
|
|
10
|
-
* - `Redacted<string>` — bound as-is.
|
|
11
|
-
* - `Effect<string | Redacted<string>>` — resolved at deploy time.
|
|
12
|
-
* - `Config<string | Redacted<string>>` — resolved against the active
|
|
13
|
-
* `ConfigProvider` at deploy time.
|
|
14
|
-
*/
|
|
15
|
-
export type SecretInput<R = never> =
|
|
16
|
-
| string
|
|
17
|
-
| Redacted.Redacted<string>
|
|
18
|
-
| Effect.Effect<string | Redacted.Redacted<string>, any, R>
|
|
19
|
-
| Config.Config<string | Redacted.Redacted<string>>;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Bind a secret value into the active {@link RuntimeContext} (e.g. a
|
|
23
|
-
* Cloudflare Worker's `env`) under the given `name` so the resource
|
|
24
|
-
* provider deploys it as a secret (e.g. `secret_text` for Cloudflare).
|
|
25
|
-
*
|
|
26
|
-
* The result is an `Output<Redacted<string>>` — `yield*`-ing it returns
|
|
27
|
-
* an `Accessor<Redacted<string>>` that resolves the value at runtime.
|
|
28
|
-
*
|
|
29
|
-
* @example One-arg shortcut — reads `Config.redacted("API_KEY")`
|
|
30
|
-
* ```ts
|
|
31
|
-
* const apiKey = yield* Alchemy.Secret("API_KEY");
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* @example From a literal
|
|
35
|
-
* ```ts
|
|
36
|
-
* const apiKey = yield* Alchemy.Secret("API_KEY", "sk-123");
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @example From an Effect
|
|
40
|
-
* ```ts
|
|
41
|
-
* const apiKey = yield* Alchemy.Secret(
|
|
42
|
-
* "API_KEY",
|
|
43
|
-
* Effect.succeed(Redacted.make("sk-123")),
|
|
44
|
-
* );
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* @example From a Config
|
|
48
|
-
* ```ts
|
|
49
|
-
* const apiKey = yield* Alchemy.Secret("API_KEY", Config.redacted("API_KEY"));
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export function Secret(
|
|
53
|
-
name: string,
|
|
54
|
-
): Output.Output<Redacted.Redacted<string>, never>;
|
|
55
|
-
export function Secret<R = never>(
|
|
56
|
-
name: string,
|
|
57
|
-
value: SecretInput<R>,
|
|
58
|
-
): Output.Output<Redacted.Redacted<string>, R>;
|
|
59
|
-
export function Secret<R = never>(
|
|
60
|
-
name: string,
|
|
61
|
-
value?: SecretInput<R>,
|
|
62
|
-
): Output.Output<Redacted.Redacted<string>, R> {
|
|
63
|
-
const source = value ?? Config.redacted(name);
|
|
64
|
-
const base = toOutput<string | Redacted.Redacted<string>, R>(source);
|
|
65
|
-
return Output.named(
|
|
66
|
-
base.pipe(
|
|
67
|
-
Output.map((v) => (Redacted.isRedacted(v) ? v : Redacted.make(v))),
|
|
68
|
-
) as Output.Output<Redacted.Redacted<string>, R>,
|
|
69
|
-
name,
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/** @internal */
|
|
74
|
-
export const toOutput = <T, R = never>(
|
|
75
|
-
source: T | Effect.Effect<T, any, R> | Config.Config<T> | Output.Output<T, R>,
|
|
76
|
-
): Output.Output<T, R> => {
|
|
77
|
-
if (Output.isOutput(source)) {
|
|
78
|
-
return source;
|
|
79
|
-
}
|
|
80
|
-
if (Config.isConfig(source)) {
|
|
81
|
-
return Output.asOutput(source as any) as Output.Output<T, R>;
|
|
82
|
-
}
|
|
83
|
-
if (Effect.isEffect(source)) {
|
|
84
|
-
return Output.asOutput(source as any) as Output.Output<T, R>;
|
|
85
|
-
}
|
|
86
|
-
return Output.asOutput(source as T) as Output.Output<T, R>;
|
|
87
|
-
};
|