alchemy 2.0.0-beta.46 → 2.0.0-beta.48
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 +18 -10
- package/bin/exec.js.map +1 -1
- package/lib/AWS/Lambda/BucketEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/BucketEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/EventBridgeEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/EventBridgeEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/QueueEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/QueueEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/StreamEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/StreamEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/TableEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/TableEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/TopicEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/TopicEventSource.d.ts.map +1 -1
- package/lib/Apply.js +2 -2
- package/lib/Apply.js.map +1 -1
- package/lib/Cli/commands/_shared.d.ts +7 -1
- package/lib/Cli/commands/_shared.d.ts.map +1 -1
- package/lib/Cli/commands/_shared.js +1 -0
- package/lib/Cli/commands/_shared.js.map +1 -1
- package/lib/Cli/commands/cloudflare.d.ts +4 -1
- package/lib/Cli/commands/cloudflare.d.ts.map +1 -1
- package/lib/Cli/commands/cloudflare.js +274 -1
- package/lib/Cli/commands/cloudflare.js.map +1 -1
- package/lib/Cli/commands/login.d.ts +1 -1
- package/lib/Cli/commands/login.d.ts.map +1 -1
- package/lib/Cli/commands/login.js +45 -42
- package/lib/Cli/commands/login.js.map +1 -1
- package/lib/Cli/commands/logs.js +1 -1
- package/lib/Cli/commands/logs.js.map +1 -1
- package/lib/Cli/commands/state.js +1 -1
- package/lib/Cli/commands/state.js.map +1 -1
- package/lib/Cli/commands/tail.js +1 -1
- package/lib/Cli/commands/tail.js.map +1 -1
- package/lib/Cloudflare/AiGateway/AiGateway.d.ts +112 -1
- package/lib/Cloudflare/AiGateway/AiGateway.d.ts.map +1 -1
- package/lib/Cloudflare/AiGateway/AiGateway.js +114 -2
- package/lib/Cloudflare/AiGateway/AiGateway.js.map +1 -1
- package/lib/Cloudflare/AiGateway/AiGatewayBinding.d.ts +43 -10
- package/lib/Cloudflare/AiGateway/AiGatewayBinding.d.ts.map +1 -1
- package/lib/Cloudflare/AiGateway/AiGatewayBinding.js +38 -10
- package/lib/Cloudflare/AiGateway/AiGatewayBinding.js.map +1 -1
- package/lib/Cloudflare/AiGateway/LanguageModel.d.ts +35 -0
- package/lib/Cloudflare/AiGateway/LanguageModel.d.ts.map +1 -0
- package/lib/Cloudflare/AiGateway/LanguageModel.js +576 -0
- package/lib/Cloudflare/AiGateway/LanguageModel.js.map +1 -0
- package/lib/Cloudflare/AiGateway/index.d.ts +1 -0
- package/lib/Cloudflare/AiGateway/index.d.ts.map +1 -1
- package/lib/Cloudflare/AiGateway/index.js +1 -0
- package/lib/Cloudflare/AiGateway/index.js.map +1 -1
- package/lib/Cloudflare/ApiToken/AccountApiToken.d.ts +40 -2
- package/lib/Cloudflare/ApiToken/AccountApiToken.d.ts.map +1 -1
- package/lib/Cloudflare/ApiToken/AccountApiToken.js +49 -6
- package/lib/Cloudflare/ApiToken/AccountApiToken.js.map +1 -1
- package/lib/Cloudflare/ApiToken/Common.d.ts +26 -3
- package/lib/Cloudflare/ApiToken/Common.d.ts.map +1 -1
- package/lib/Cloudflare/ApiToken/Common.js +8 -0
- package/lib/Cloudflare/ApiToken/Common.js.map +1 -1
- package/lib/Cloudflare/ApiToken/UserApiToken.d.ts +38 -2
- package/lib/Cloudflare/ApiToken/UserApiToken.d.ts.map +1 -1
- package/lib/Cloudflare/ApiToken/UserApiToken.js +47 -6
- package/lib/Cloudflare/ApiToken/UserApiToken.js.map +1 -1
- package/lib/Cloudflare/Browser/Browser.d.ts +121 -0
- package/lib/Cloudflare/Browser/Browser.d.ts.map +1 -0
- package/lib/Cloudflare/{BrowserRendering/BrowserRendering.js → Browser/Browser.js} +19 -26
- package/lib/Cloudflare/Browser/Browser.js.map +1 -0
- package/lib/Cloudflare/Browser/BrowserBinding.d.ts +55 -0
- package/lib/Cloudflare/Browser/BrowserBinding.d.ts.map +1 -0
- package/lib/Cloudflare/{BrowserRendering/BrowserRenderingBinding.js → Browser/BrowserBinding.js} +11 -11
- package/lib/Cloudflare/Browser/BrowserBinding.js.map +1 -0
- package/lib/Cloudflare/Browser/index.d.ts +3 -0
- package/lib/Cloudflare/Browser/index.d.ts.map +1 -0
- package/lib/Cloudflare/Browser/index.js +3 -0
- package/lib/Cloudflare/Browser/index.js.map +1 -0
- package/lib/Cloudflare/Container/ContainerBinding.d.ts +2 -1
- package/lib/Cloudflare/Container/ContainerBinding.d.ts.map +1 -1
- 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/Email/EmailRouting.d.ts +1 -1
- package/lib/Cloudflare/Email/EmailRouting.d.ts.map +1 -1
- package/lib/Cloudflare/Email/EmailRouting.js +1 -1
- package/lib/Cloudflare/Email/EmailRouting.js.map +1 -1
- package/lib/Cloudflare/Email/EmailRule.d.ts +1 -1
- package/lib/Cloudflare/Email/EmailRule.d.ts.map +1 -1
- package/lib/Cloudflare/Email/EmailRule.js +1 -1
- package/lib/Cloudflare/Email/EmailRule.js.map +1 -1
- package/lib/Cloudflare/Images/Images.d.ts +32 -23
- package/lib/Cloudflare/Images/Images.d.ts.map +1 -1
- package/lib/Cloudflare/Images/Images.js +10 -13
- package/lib/Cloudflare/Images/Images.js.map +1 -1
- package/lib/Cloudflare/Providers.d.ts.map +1 -1
- package/lib/Cloudflare/Providers.js +10 -3
- package/lib/Cloudflare/Providers.js.map +1 -1
- package/lib/Cloudflare/R2/R2Bucket.d.ts +1 -1
- package/lib/Cloudflare/R2/R2Bucket.d.ts.map +1 -1
- package/lib/Cloudflare/R2/R2Bucket.js +13 -7
- package/lib/Cloudflare/R2/R2Bucket.js.map +1 -1
- package/lib/Cloudflare/RateLimit/RateLimit.d.ts +132 -0
- package/lib/Cloudflare/RateLimit/RateLimit.d.ts.map +1 -0
- package/lib/Cloudflare/RateLimit/RateLimit.js +80 -0
- package/lib/Cloudflare/RateLimit/RateLimit.js.map +1 -0
- package/lib/Cloudflare/RateLimit/RateLimitBinding.d.ts +30 -0
- package/lib/Cloudflare/RateLimit/RateLimitBinding.d.ts.map +1 -0
- package/lib/Cloudflare/RateLimit/RateLimitBinding.js +50 -0
- package/lib/Cloudflare/RateLimit/RateLimitBinding.js.map +1 -0
- package/lib/Cloudflare/RateLimit/index.d.ts +3 -0
- package/lib/Cloudflare/RateLimit/index.d.ts.map +1 -0
- package/lib/Cloudflare/RateLimit/index.js +3 -0
- package/lib/Cloudflare/RateLimit/index.js.map +1 -0
- package/lib/Cloudflare/SecretsStore/Secret.d.ts +2 -1
- package/lib/Cloudflare/SecretsStore/Secret.d.ts.map +1 -1
- package/lib/Cloudflare/SecretsStore/Secret.js +7 -4
- package/lib/Cloudflare/SecretsStore/Secret.js.map +1 -1
- package/lib/Cloudflare/StateStore/State.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/State.js +82 -78
- package/lib/Cloudflare/StateStore/State.js.map +1 -1
- package/lib/Cloudflare/Tunnel/Tunnel.d.ts +27 -0
- package/lib/Cloudflare/Tunnel/Tunnel.d.ts.map +1 -1
- package/lib/Cloudflare/Tunnel/Tunnel.js +27 -0
- package/lib/Cloudflare/Tunnel/Tunnel.js.map +1 -1
- package/lib/Cloudflare/Tunnel/TunnelBinding.d.ts +48 -0
- package/lib/Cloudflare/Tunnel/TunnelBinding.d.ts.map +1 -0
- package/lib/Cloudflare/Tunnel/TunnelBinding.js +56 -0
- package/lib/Cloudflare/Tunnel/TunnelBinding.js.map +1 -0
- package/lib/Cloudflare/Tunnel/TunnelRead.d.ts +83 -0
- package/lib/Cloudflare/Tunnel/TunnelRead.d.ts.map +1 -0
- package/lib/Cloudflare/Tunnel/TunnelRead.js +79 -0
- package/lib/Cloudflare/Tunnel/TunnelRead.js.map +1 -0
- package/lib/Cloudflare/Tunnel/TunnelReadWrite.d.ts +70 -0
- package/lib/Cloudflare/Tunnel/TunnelReadWrite.d.ts.map +1 -0
- package/lib/Cloudflare/Tunnel/TunnelReadWrite.js +63 -0
- package/lib/Cloudflare/Tunnel/TunnelReadWrite.js.map +1 -0
- package/lib/Cloudflare/Tunnel/TunnelWrite.d.ts +92 -0
- package/lib/Cloudflare/Tunnel/TunnelWrite.d.ts.map +1 -0
- package/lib/Cloudflare/Tunnel/TunnelWrite.js +88 -0
- package/lib/Cloudflare/Tunnel/TunnelWrite.js.map +1 -0
- package/lib/Cloudflare/Tunnel/index.d.ts +4 -0
- package/lib/Cloudflare/Tunnel/index.d.ts.map +1 -1
- package/lib/Cloudflare/Tunnel/index.js +4 -0
- package/lib/Cloudflare/Tunnel/index.js.map +1 -1
- package/lib/Cloudflare/Vectorize/VectorizeIndex.js +1 -0
- package/lib/Cloudflare/Vectorize/VectorizeIndex.js.map +1 -1
- package/lib/Cloudflare/VpcService/VpcService.d.ts +1 -1
- package/lib/Cloudflare/VpcService/VpcService.d.ts.map +1 -1
- package/lib/Cloudflare/VpcService/VpcService.js.map +1 -1
- package/lib/Cloudflare/Workers/DurableObjectBridge.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/DurableObjectBridge.js +10 -1
- package/lib/Cloudflare/Workers/DurableObjectBridge.js.map +1 -1
- package/lib/Cloudflare/Workers/DynamicWorkerLoader.d.ts +119 -11
- package/lib/Cloudflare/Workers/DynamicWorkerLoader.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/DynamicWorkerLoader.js +88 -9
- package/lib/Cloudflare/Workers/DynamicWorkerLoader.js.map +1 -1
- package/lib/Cloudflare/Workers/InferEnv.d.ts +1 -1
- package/lib/Cloudflare/Workers/InferEnv.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js +15 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js.map +1 -1
- package/lib/Cloudflare/Workers/Rpc.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Rpc.js +20 -2
- package/lib/Cloudflare/Workers/Rpc.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.js +18 -2
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBinding.d.ts +5 -3
- package/lib/Cloudflare/Workers/WorkerBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBinding.js +1 -1
- 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 +20 -2
- package/lib/Cloudflare/Workers/WorkerBridge.js.map +1 -1
- package/lib/Cloudflare/Zaraz/ZarazConfig.d.ts +1 -1
- package/lib/Cloudflare/Zaraz/ZarazConfig.d.ts.map +1 -1
- package/lib/Cloudflare/Zaraz/ZarazConfig.js +1 -1
- package/lib/Cloudflare/Zaraz/ZarazConfig.js.map +1 -1
- package/lib/Cloudflare/Zone/Zone.d.ts +170 -0
- package/lib/Cloudflare/Zone/Zone.d.ts.map +1 -0
- package/lib/Cloudflare/Zone/Zone.js +180 -0
- package/lib/Cloudflare/Zone/Zone.js.map +1 -0
- package/lib/Cloudflare/Zone/index.d.ts +3 -0
- package/lib/Cloudflare/Zone/index.d.ts.map +1 -0
- package/lib/Cloudflare/Zone/index.js +3 -0
- package/lib/Cloudflare/Zone/index.js.map +1 -0
- package/lib/Cloudflare/Zone/lookup.d.ts +33 -0
- package/lib/Cloudflare/Zone/lookup.d.ts.map +1 -0
- package/lib/Cloudflare/{Zone.js → Zone/lookup.js} +2 -2
- package/lib/Cloudflare/Zone/lookup.js.map +1 -0
- package/lib/Cloudflare/index.d.ts +3 -1
- package/lib/Cloudflare/index.d.ts.map +1 -1
- package/lib/Cloudflare/index.js +3 -1
- package/lib/Cloudflare/index.js.map +1 -1
- package/lib/Output.js +2 -2
- package/lib/Output.js.map +1 -1
- package/lib/Plan.d.ts +2 -2
- package/lib/Plan.d.ts.map +1 -1
- package/lib/Plan.js +3 -3
- package/lib/Plan.js.map +1 -1
- package/lib/Platform.d.ts +5 -5
- package/lib/Platform.d.ts.map +1 -1
- package/lib/Platform.js.map +1 -1
- package/lib/RemovalPolicy.js +2 -2
- package/lib/RemovalPolicy.js.map +1 -1
- package/lib/Resource.d.ts +14 -1
- package/lib/Resource.d.ts.map +1 -1
- package/lib/Resource.js +3 -2
- package/lib/Resource.js.map +1 -1
- package/lib/Stack.d.ts.map +1 -1
- package/lib/Stack.js +6 -0
- package/lib/Stack.js.map +1 -1
- package/lib/State/InMemoryState.d.ts +2 -1
- package/lib/State/InMemoryState.d.ts.map +1 -1
- package/lib/State/InMemoryState.js +3 -3
- package/lib/State/InMemoryState.js.map +1 -1
- package/lib/State/LocalState.d.ts.map +1 -1
- package/lib/State/LocalState.js +5 -1
- package/lib/State/LocalState.js.map +1 -1
- package/lib/State/State.d.ts +2 -2
- package/lib/State/State.d.ts.map +1 -1
- package/lib/State/State.js.map +1 -1
- package/lib/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/Apply.ts +2 -2
- package/src/Cli/commands/_shared.ts +7 -1
- package/src/Cli/commands/cloudflare.ts +394 -1
- package/src/Cli/commands/login.ts +69 -60
- package/src/Cli/commands/logs.ts +1 -1
- package/src/Cli/commands/state.ts +1 -1
- package/src/Cli/commands/tail.ts +1 -1
- package/src/Cloudflare/AiGateway/AiGateway.ts +114 -2
- package/src/Cloudflare/AiGateway/AiGatewayBinding.ts +52 -10
- package/src/Cloudflare/AiGateway/LanguageModel.ts +907 -0
- package/src/Cloudflare/AiGateway/index.ts +1 -0
- package/src/Cloudflare/ApiToken/AccountApiToken.ts +60 -7
- package/src/Cloudflare/ApiToken/Common.ts +32 -3
- package/src/Cloudflare/ApiToken/UserApiToken.ts +58 -7
- package/src/Cloudflare/Browser/Browser.ts +140 -0
- package/src/Cloudflare/Browser/BrowserBinding.ts +128 -0
- package/src/Cloudflare/Browser/index.ts +11 -0
- package/src/Cloudflare/D1/D1Database.ts +6 -2
- package/src/Cloudflare/Email/EmailRouting.ts +1 -1
- package/src/Cloudflare/Email/EmailRule.ts +6 -6
- package/src/Cloudflare/Images/Images.ts +40 -27
- package/src/Cloudflare/Providers.ts +15 -3
- package/src/Cloudflare/R2/R2Bucket.ts +17 -9
- package/src/Cloudflare/RateLimit/RateLimit.ts +160 -0
- package/src/Cloudflare/RateLimit/RateLimitBinding.ts +90 -0
- package/src/Cloudflare/RateLimit/index.ts +2 -0
- package/src/Cloudflare/SecretsStore/Secret.ts +12 -6
- package/src/Cloudflare/StateStore/State.ts +113 -107
- package/src/Cloudflare/Tunnel/Tunnel.ts +27 -0
- package/src/Cloudflare/Tunnel/TunnelBinding.ts +114 -0
- package/src/Cloudflare/Tunnel/TunnelRead.ts +168 -0
- package/src/Cloudflare/Tunnel/TunnelReadWrite.ts +88 -0
- package/src/Cloudflare/Tunnel/TunnelWrite.ts +194 -0
- package/src/Cloudflare/Tunnel/index.ts +4 -0
- package/src/Cloudflare/Vectorize/VectorizeIndex.ts +2 -1
- package/src/Cloudflare/VpcService/VpcService.ts +4 -2
- package/src/Cloudflare/Workers/DurableObjectBridge.ts +10 -1
- package/src/Cloudflare/Workers/DynamicWorkerLoader.ts +139 -13
- package/src/Cloudflare/Workers/InferEnv.ts +19 -15
- package/src/Cloudflare/Workers/LocalWorkerProvider.ts +26 -3
- package/src/Cloudflare/Workers/Rpc.ts +38 -9
- package/src/Cloudflare/Workers/WorkerAsyncBindings.ts +16 -2
- package/src/Cloudflare/Workers/WorkerBinding.ts +6 -2
- package/src/Cloudflare/Workers/WorkerBridge.ts +20 -2
- package/src/Cloudflare/Zaraz/ZarazConfig.ts +1 -1
- package/src/Cloudflare/Zone/Zone.ts +349 -0
- package/src/Cloudflare/Zone/index.ts +2 -0
- package/src/Cloudflare/{Zone.ts → Zone/lookup.ts} +16 -3
- package/src/Cloudflare/index.ts +3 -1
- package/src/Output.ts +2 -2
- package/src/Plan.ts +4 -4
- package/src/Platform.ts +8 -12
- package/src/RemovalPolicy.ts +2 -2
- package/src/Resource.ts +18 -1
- package/src/Stack.ts +6 -0
- package/src/State/InMemoryState.ts +87 -85
- package/src/State/LocalState.ts +15 -1
- package/src/State/State.ts +5 -4
- package/lib/Cloudflare/BrowserRendering/BrowserRendering.d.ts +0 -116
- package/lib/Cloudflare/BrowserRendering/BrowserRendering.d.ts.map +0 -1
- package/lib/Cloudflare/BrowserRendering/BrowserRendering.js.map +0 -1
- package/lib/Cloudflare/BrowserRendering/BrowserRenderingBinding.d.ts +0 -55
- package/lib/Cloudflare/BrowserRendering/BrowserRenderingBinding.d.ts.map +0 -1
- package/lib/Cloudflare/BrowserRendering/BrowserRenderingBinding.js.map +0 -1
- package/lib/Cloudflare/BrowserRendering/index.d.ts +0 -3
- package/lib/Cloudflare/BrowserRendering/index.d.ts.map +0 -1
- package/lib/Cloudflare/BrowserRendering/index.js +0 -3
- package/lib/Cloudflare/BrowserRendering/index.js.map +0 -1
- package/lib/Cloudflare/Zone.d.ts +0 -14
- package/lib/Cloudflare/Zone.d.ts.map +0 -1
- package/lib/Cloudflare/Zone.js.map +0 -1
- package/src/Cloudflare/BrowserRendering/BrowserRendering.ts +0 -132
- package/src/Cloudflare/BrowserRendering/BrowserRenderingBinding.ts +0 -137
- package/src/Cloudflare/BrowserRendering/index.ts +0 -11
|
@@ -9,7 +9,7 @@ import { isYieldableEffectLike } from "../../Util/effect.ts";
|
|
|
9
9
|
import type { AiGateway } from "../AiGateway/AiGateway.ts";
|
|
10
10
|
import { AnalyticsEngineDataset } from "../AnalyticsEngine/AnalyticsEngineDataset.ts";
|
|
11
11
|
import { Artifacts } from "../Artifacts/Artifacts.ts";
|
|
12
|
-
import {
|
|
12
|
+
import { Browser } from "../Browser/Browser.ts";
|
|
13
13
|
import type { D1Database } from "../D1/D1Database.ts";
|
|
14
14
|
import { SendEmail } from "../Email/SendEmail.ts";
|
|
15
15
|
import { Hyperdrive } from "../Hyperdrive/Hyperdrive.ts";
|
|
@@ -17,9 +17,11 @@ import { Images } from "../Images/Images.ts";
|
|
|
17
17
|
import type { KVNamespace } from "../KV/KVNamespace.ts";
|
|
18
18
|
import type { Queue } from "../Queue/Queue.ts";
|
|
19
19
|
import type { R2Bucket } from "../R2/R2Bucket.ts";
|
|
20
|
+
import type { RateLimit } from "../RateLimit/RateLimit.ts";
|
|
20
21
|
import type { VectorizeIndex } from "../Vectorize/VectorizeIndex.ts";
|
|
21
22
|
import type { Assets } from "./Assets.ts";
|
|
22
23
|
import type { DurableObjectNamespaceLike } from "./DurableObjectNamespace.ts";
|
|
24
|
+
import type { DynamicWorkerLoader } from "./DynamicWorkerLoader.ts";
|
|
23
25
|
import { makeRpcStub } from "./Rpc.ts";
|
|
24
26
|
import { isWorker, Worker, WorkerEnvironment } from "./Worker.ts";
|
|
25
27
|
|
|
@@ -48,11 +50,13 @@ export type WorkerBindingResource =
|
|
|
48
50
|
| AnalyticsEngineDataset
|
|
49
51
|
| SendEmail
|
|
50
52
|
| Artifacts
|
|
51
|
-
|
|
|
53
|
+
| RateLimit
|
|
54
|
+
| Browser
|
|
52
55
|
| Images
|
|
53
56
|
| Hyperdrive
|
|
54
57
|
| VectorizeIndex
|
|
55
58
|
| Worker
|
|
59
|
+
| DynamicWorkerLoader
|
|
56
60
|
| DurableObjectNamespaceLike<any>;
|
|
57
61
|
|
|
58
62
|
export type WorkerBindings = {
|
|
@@ -141,8 +141,17 @@ export const makeWorkerBridge = (
|
|
|
141
141
|
),
|
|
142
142
|
);
|
|
143
143
|
}
|
|
144
|
+
const result = dispatcher(...args);
|
|
145
|
+
// A streaming RPC method returns a `Stream` directly rather
|
|
146
|
+
// than an `Effect`. Lift it into the success channel so the
|
|
147
|
+
// inner effect resolves to the `Stream` and `handleRpcExit`
|
|
148
|
+
// can encode it as a stream envelope. Anything else is the
|
|
149
|
+
// `Effect` it claims to be (its resolved value may itself be
|
|
150
|
+
// a `Stream`, which `handleRpcExit` also handles).
|
|
144
151
|
return Effect.succeed([
|
|
145
|
-
|
|
152
|
+
Stream.isStream(result)
|
|
153
|
+
? Effect.succeed(result)
|
|
154
|
+
: (result as Effect.Effect<any>),
|
|
146
155
|
Context.empty(),
|
|
147
156
|
] as const);
|
|
148
157
|
}),
|
|
@@ -274,7 +283,16 @@ export const makeRpcProxy = (
|
|
|
274
283
|
),
|
|
275
284
|
);
|
|
276
285
|
}
|
|
277
|
-
|
|
286
|
+
const result = dispatcher(...args);
|
|
287
|
+
// A streaming RPC method returns a `Stream` directly rather than
|
|
288
|
+
// an `Effect`. Lift it into the success channel so the resulting
|
|
289
|
+
// `Exit.value` is the `Stream` and `handleRpcExit` can encode it
|
|
290
|
+
// as a stream envelope. Anything else is the `Effect` it claims
|
|
291
|
+
// to be and is run normally (its resolved value may itself be a
|
|
292
|
+
// `Stream`, which `handleRpcExit` also handles).
|
|
293
|
+
return Stream.isStream(result)
|
|
294
|
+
? Effect.succeed(result)
|
|
295
|
+
: (result as Effect.Effect<any>);
|
|
278
296
|
}),
|
|
279
297
|
processEvent,
|
|
280
298
|
)
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "../../Util/data.ts";
|
|
11
11
|
import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
|
|
12
12
|
import type { Providers } from "../Providers.ts";
|
|
13
|
-
import { resolveZoneId, type ZoneReference } from "../Zone.ts";
|
|
13
|
+
import { resolveZoneId, type ZoneReference } from "../Zone/index.ts";
|
|
14
14
|
import { defineZarazEvents } from "./ZarazEventTypes.ts";
|
|
15
15
|
|
|
16
16
|
export type ZarazWorkflow = zaraz.GetWorkflowResponse;
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import * as zones from "@distilled.cloud/cloudflare/zones";
|
|
2
|
+
import * as Array from "effect/Array";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Equivalence from "effect/Equivalence";
|
|
5
|
+
import { Unowned } from "../../AdoptPolicy.ts";
|
|
6
|
+
import { isResolved } from "../../Diff.ts";
|
|
7
|
+
import * as Provider from "../../Provider.ts";
|
|
8
|
+
import { Resource } from "../../Resource.ts";
|
|
9
|
+
import { stripNullFields } from "../../Util/data.ts";
|
|
10
|
+
import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
|
|
11
|
+
import type { Providers } from "../Providers.ts";
|
|
12
|
+
import { findZoneByName } from "./lookup.ts";
|
|
13
|
+
|
|
14
|
+
export type ZoneType = "full" | "partial" | "secondary" | "internal";
|
|
15
|
+
export type ZoneStatus = "initializing" | "pending" | "active" | "moved";
|
|
16
|
+
|
|
17
|
+
/** Metadata about the zone (Cloudflare `meta`). */
|
|
18
|
+
export type ZoneMeta = {
|
|
19
|
+
/** @deprecated Always `false`. */
|
|
20
|
+
cdnOnly: boolean | undefined;
|
|
21
|
+
/** Number of allowed custom certificates. */
|
|
22
|
+
customCertificateQuota: number | undefined;
|
|
23
|
+
/** @deprecated Always `true`. */
|
|
24
|
+
dnsOnly: boolean | undefined;
|
|
25
|
+
/** Whether the zone is on Cloudflare's Foundation DNS plan. */
|
|
26
|
+
foundationDns: boolean | undefined;
|
|
27
|
+
/** Number of allowed Page Rules. */
|
|
28
|
+
pageRuleQuota: number | undefined;
|
|
29
|
+
/** Whether the zone has been flagged for phishing. */
|
|
30
|
+
phishingDetected: boolean | undefined;
|
|
31
|
+
/** Onboarding step the zone is currently on. */
|
|
32
|
+
step: number | undefined;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** The owner of the zone (Cloudflare `owner`). */
|
|
36
|
+
export type ZoneOwner = {
|
|
37
|
+
/** Owner identifier. */
|
|
38
|
+
id: string | undefined;
|
|
39
|
+
/** Owner name. */
|
|
40
|
+
name: string | undefined;
|
|
41
|
+
/** Owner type (e.g. `user`, `organization`). */
|
|
42
|
+
type: string | undefined;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** An organizational unit (tenant) the zone belongs to. */
|
|
46
|
+
export type ZoneTenant = {
|
|
47
|
+
/** Tenant identifier. */
|
|
48
|
+
id: string | undefined;
|
|
49
|
+
/** Tenant name. */
|
|
50
|
+
name: string | undefined;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** The immediate parent organizational unit of the zone. */
|
|
54
|
+
export type ZoneTenantUnit = {
|
|
55
|
+
/** Tenant unit identifier. */
|
|
56
|
+
id: string | undefined;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Common shape returned by a managed {@link Zone} resource — anything that
|
|
61
|
+
* needs to point at a Cloudflare Zone can accept this.
|
|
62
|
+
*
|
|
63
|
+
* Mirrors Cloudflare's zone object. `zoneId` and `accountId` are Alchemy's
|
|
64
|
+
* flattened identifiers (Cloudflare exposes these as `id` and `account.id`);
|
|
65
|
+
* every other field keeps Cloudflare's own (camelCased) name.
|
|
66
|
+
*/
|
|
67
|
+
export type ZoneAttributes = {
|
|
68
|
+
/** Zone identifier (Cloudflare `id`). Stable across updates. */
|
|
69
|
+
zoneId: string;
|
|
70
|
+
/** The fully-qualified domain name (e.g. `example.com`). */
|
|
71
|
+
name: string;
|
|
72
|
+
/** Identifier of the account the zone belongs to (Cloudflare `account.id`). */
|
|
73
|
+
accountId: string;
|
|
74
|
+
/** Name of the account the zone belongs to (Cloudflare `account.name`). */
|
|
75
|
+
accountName: string | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Zone type. A full zone hosts its DNS at Cloudflare; a partial zone is a
|
|
78
|
+
* partner/CNAME setup.
|
|
79
|
+
*/
|
|
80
|
+
type: ZoneType;
|
|
81
|
+
/** The zone status on Cloudflare. */
|
|
82
|
+
status: ZoneStatus | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Whether the zone is DNS-only (Cloudflare's proxy/security features
|
|
85
|
+
* disabled).
|
|
86
|
+
*/
|
|
87
|
+
paused: boolean;
|
|
88
|
+
/** The name servers Cloudflare assigns to the zone. */
|
|
89
|
+
nameServers: string[];
|
|
90
|
+
/** The original name servers before the domain moved to Cloudflare. */
|
|
91
|
+
originalNameServers: string[] | undefined;
|
|
92
|
+
/** Custom (vanity) name servers. Business/Enterprise plans only. */
|
|
93
|
+
vanityNameServers: string[] | undefined;
|
|
94
|
+
/** The last time proof of ownership was detected and the zone activated. */
|
|
95
|
+
activatedOn: string | undefined;
|
|
96
|
+
/** When the zone was created. */
|
|
97
|
+
createdOn: string;
|
|
98
|
+
/**
|
|
99
|
+
* The interval (in seconds) until development mode expires (positive) or
|
|
100
|
+
* since it last expired (negative). `0` if never enabled.
|
|
101
|
+
*/
|
|
102
|
+
developmentMode: number;
|
|
103
|
+
/** When the zone was last modified. */
|
|
104
|
+
modifiedOn: string;
|
|
105
|
+
/** The DNS host at the time of switching to Cloudflare. */
|
|
106
|
+
originalDnshost: string | undefined;
|
|
107
|
+
/** The registrar for the domain at the time of switching to Cloudflare. */
|
|
108
|
+
originalRegistrar: string | undefined;
|
|
109
|
+
/** Allows the customer to use a custom apex (tenants-only configuration). */
|
|
110
|
+
cnameSuffix: string | undefined;
|
|
111
|
+
/** Verification key for partial zone setup. */
|
|
112
|
+
verificationKey: string | undefined;
|
|
113
|
+
/** Metadata about the zone. */
|
|
114
|
+
meta: ZoneMeta;
|
|
115
|
+
/** The owner of the zone. */
|
|
116
|
+
owner: ZoneOwner;
|
|
117
|
+
/** The root organizational unit (tenant) the zone belongs to. */
|
|
118
|
+
tenant: ZoneTenant | undefined;
|
|
119
|
+
/** The immediate parent organizational unit of the zone. */
|
|
120
|
+
tenantUnit: ZoneTenantUnit | undefined;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export type ZoneProps = {
|
|
124
|
+
/**
|
|
125
|
+
* The fully-qualified zone name (e.g. `example.com`). Stable — changing it
|
|
126
|
+
* triggers a replacement.
|
|
127
|
+
*/
|
|
128
|
+
name: string;
|
|
129
|
+
/**
|
|
130
|
+
* Zone type. Full zones host their own DNS at Cloudflare; partial zones are
|
|
131
|
+
* partner/CNAME setups.
|
|
132
|
+
* @default "full"
|
|
133
|
+
*/
|
|
134
|
+
type?: ZoneType;
|
|
135
|
+
/**
|
|
136
|
+
* Pause Cloudflare's proxy on the zone (DNS-only).
|
|
137
|
+
* @default false
|
|
138
|
+
*/
|
|
139
|
+
paused?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Custom (vanity) name servers. Business/Enterprise only.
|
|
142
|
+
*/
|
|
143
|
+
vanityNameServers?: string[];
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export type Zone = Resource<
|
|
147
|
+
"Cloudflare.Zone",
|
|
148
|
+
ZoneProps,
|
|
149
|
+
ZoneAttributes,
|
|
150
|
+
never,
|
|
151
|
+
Providers
|
|
152
|
+
>;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* A Cloudflare Zone (DNS domain) managed by Alchemy.
|
|
156
|
+
*
|
|
157
|
+
* Zones default to **retain** on removal — destroying the stack does NOT
|
|
158
|
+
* delete the zone in Cloudflare. Opt in to actual deletion by wrapping the
|
|
159
|
+
* resource (or the whole stack) in {@link destroy}() from
|
|
160
|
+
* `alchemy/RemovalPolicy`.
|
|
161
|
+
*
|
|
162
|
+
* @section Creating a Zone
|
|
163
|
+
* @example Create a new zone
|
|
164
|
+
* ```typescript
|
|
165
|
+
* const zone = yield* Cloudflare.Zone("MyZone", {
|
|
166
|
+
* name: "example.com",
|
|
167
|
+
* });
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* @example Allow destruction
|
|
171
|
+
* ```typescript
|
|
172
|
+
* import { destroy } from "alchemy/RemovalPolicy";
|
|
173
|
+
* yield* Cloudflare.Zone("MyZone", { name: "example.com" }).pipe(destroy());
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
* @section Adopting an existing Zone
|
|
177
|
+
* @example Take over a zone that already exists in Cloudflare
|
|
178
|
+
* ```typescript
|
|
179
|
+
* import { adopt } from "alchemy/AdoptPolicy";
|
|
180
|
+
* // A zone carries no ownership markers, so the engine refuses to take over a
|
|
181
|
+
* // pre-existing zone unless you opt in with `adopt(true)`.
|
|
182
|
+
* const zone = yield* Cloudflare.Zone("MyZone", {
|
|
183
|
+
* name: "example.com",
|
|
184
|
+
* }).pipe(adopt(true));
|
|
185
|
+
* // zone.zoneId, zone.nameServers, zone.accountId, ...
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
export const Zone = Resource<Zone>("Cloudflare.Zone", {
|
|
189
|
+
defaultRemovalPolicy: "retain",
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
export const ZoneProvider = () =>
|
|
193
|
+
Provider.effect(
|
|
194
|
+
Zone,
|
|
195
|
+
Effect.gen(function* () {
|
|
196
|
+
const { accountId } = yield* CloudflareEnvironment;
|
|
197
|
+
const get = yield* zones.getZone;
|
|
198
|
+
const create = yield* zones.createZone;
|
|
199
|
+
const patch = yield* zones.patchZone;
|
|
200
|
+
const del = yield* zones.deleteZone;
|
|
201
|
+
|
|
202
|
+
return {
|
|
203
|
+
stables: ["name", "zoneId", "accountId"],
|
|
204
|
+
diff: Effect.fn(function* ({ news, output }) {
|
|
205
|
+
if (!output) return undefined;
|
|
206
|
+
if (!isResolved(news)) return undefined;
|
|
207
|
+
if (news.name !== output.name) {
|
|
208
|
+
return { action: "replace" } as const;
|
|
209
|
+
}
|
|
210
|
+
const desiredType = news.type ?? "full";
|
|
211
|
+
const desiredPaused = news.paused ?? false;
|
|
212
|
+
const desiredVanity = news.vanityNameServers ?? [];
|
|
213
|
+
if (
|
|
214
|
+
desiredType !== output.type ||
|
|
215
|
+
desiredPaused !== output.paused ||
|
|
216
|
+
!stringArrayEq(desiredVanity, output.vanityNameServers ?? [])
|
|
217
|
+
) {
|
|
218
|
+
return { action: "update" } as const;
|
|
219
|
+
}
|
|
220
|
+
return undefined;
|
|
221
|
+
}),
|
|
222
|
+
read: Effect.fn(function* ({ output, olds }) {
|
|
223
|
+
const name = output?.name ?? olds?.name;
|
|
224
|
+
// Owned path: we have persisted state (our own zoneId) — refresh it.
|
|
225
|
+
if (output?.zoneId) {
|
|
226
|
+
const result = yield* get({ zoneId: output.zoneId }).pipe(
|
|
227
|
+
Effect.catch(() => Effect.succeed(undefined)),
|
|
228
|
+
);
|
|
229
|
+
if (result) return toZoneAttributes(result, accountId);
|
|
230
|
+
}
|
|
231
|
+
// Adoption path: no state of our own, but a zone with this name
|
|
232
|
+
// already exists in the cloud. Cloudflare zones carry no ownership
|
|
233
|
+
// markers we can inspect, so we cannot prove we created it — brand
|
|
234
|
+
// it `Unowned` so the engine refuses to take over unless `adopt` is
|
|
235
|
+
// set.
|
|
236
|
+
if (name) {
|
|
237
|
+
const match = yield* findZoneByName({ accountId, name });
|
|
238
|
+
if (!match) return undefined;
|
|
239
|
+
const result = yield* get({ zoneId: match.id });
|
|
240
|
+
return Unowned(toZoneAttributes(result, accountId));
|
|
241
|
+
}
|
|
242
|
+
return undefined;
|
|
243
|
+
}),
|
|
244
|
+
reconcile: Effect.fn(function* ({ news, output }) {
|
|
245
|
+
// 1. Observe — do we have a live zone for this name?
|
|
246
|
+
let zoneId = output?.zoneId;
|
|
247
|
+
if (!zoneId) {
|
|
248
|
+
const match = yield* findZoneByName({
|
|
249
|
+
accountId,
|
|
250
|
+
name: news.name,
|
|
251
|
+
});
|
|
252
|
+
zoneId = match?.id;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// 2. Ensure — create if missing.
|
|
256
|
+
if (!zoneId) {
|
|
257
|
+
zoneId = yield* create({
|
|
258
|
+
account: { id: accountId },
|
|
259
|
+
name: news.name,
|
|
260
|
+
type: news.type ?? "full",
|
|
261
|
+
}).pipe(
|
|
262
|
+
Effect.map((created) => created.id),
|
|
263
|
+
// A concurrent deploy (or a prior crashed run) may have created
|
|
264
|
+
// the zone between our observe and create — recover by resolving
|
|
265
|
+
// its id rather than failing the reconcile.
|
|
266
|
+
Effect.catchTag("ZoneAlreadyExists", () =>
|
|
267
|
+
findZoneByName({ accountId, name: news.name }).pipe(
|
|
268
|
+
Effect.flatMap((match) =>
|
|
269
|
+
match
|
|
270
|
+
? Effect.succeed(match.id)
|
|
271
|
+
: Effect.fail(
|
|
272
|
+
new Error(
|
|
273
|
+
`Cloudflare reported zone ${news.name} already exists but it could not be found`,
|
|
274
|
+
),
|
|
275
|
+
),
|
|
276
|
+
),
|
|
277
|
+
),
|
|
278
|
+
),
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// 3. Sync — apply mutable settings (type/paused/vanity NS).
|
|
283
|
+
const observed = yield* get({ zoneId });
|
|
284
|
+
const desiredType = news.type ?? "full";
|
|
285
|
+
const desiredPaused = news.paused ?? false;
|
|
286
|
+
const desiredVanity = news.vanityNameServers ?? [];
|
|
287
|
+
const needsPatch =
|
|
288
|
+
(observed.type ?? "full") !== desiredType ||
|
|
289
|
+
(observed.paused ?? false) !== desiredPaused ||
|
|
290
|
+
!stringArrayEq(observed.vanityNameServers ?? [], desiredVanity);
|
|
291
|
+
|
|
292
|
+
if (needsPatch) {
|
|
293
|
+
yield* patch({
|
|
294
|
+
zoneId,
|
|
295
|
+
type: desiredType,
|
|
296
|
+
paused: desiredPaused,
|
|
297
|
+
vanityNameServers: desiredVanity,
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const final = yield* get({ zoneId });
|
|
302
|
+
return toZoneAttributes(final, accountId);
|
|
303
|
+
}),
|
|
304
|
+
delete: Effect.fn(function* ({ output }) {
|
|
305
|
+
if (!output.zoneId) return;
|
|
306
|
+
yield* del({ zoneId: output.zoneId }).pipe(
|
|
307
|
+
// Zone already gone — idempotent delete.
|
|
308
|
+
Effect.catchTag("InvalidZoneIdentifier", () => Effect.void),
|
|
309
|
+
);
|
|
310
|
+
}),
|
|
311
|
+
};
|
|
312
|
+
}),
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
/** @internal — shape a distilled zones API result into `ZoneAttributes`. */
|
|
316
|
+
export const toZoneAttributes = (
|
|
317
|
+
result: zones.GetZoneResponse,
|
|
318
|
+
fallbackAccountId: string,
|
|
319
|
+
): ZoneAttributes => {
|
|
320
|
+
// Cloudflare returns `null` for absent fields; drop them so every optional
|
|
321
|
+
// attribute is simply `undefined` (matching `ZoneAttributes`).
|
|
322
|
+
const z = stripNullFields(result);
|
|
323
|
+
return {
|
|
324
|
+
zoneId: z.id,
|
|
325
|
+
name: z.name,
|
|
326
|
+
accountId: z.account.id ?? fallbackAccountId,
|
|
327
|
+
accountName: z.account.name,
|
|
328
|
+
type: z.type ?? "full",
|
|
329
|
+
status: z.status,
|
|
330
|
+
paused: z.paused ?? false,
|
|
331
|
+
nameServers: z.nameServers,
|
|
332
|
+
originalNameServers: z.originalNameServers,
|
|
333
|
+
vanityNameServers: z.vanityNameServers,
|
|
334
|
+
activatedOn: z.activatedOn,
|
|
335
|
+
createdOn: z.createdOn,
|
|
336
|
+
developmentMode: z.developmentMode,
|
|
337
|
+
modifiedOn: z.modifiedOn,
|
|
338
|
+
originalDnshost: z.originalDnshost,
|
|
339
|
+
originalRegistrar: z.originalRegistrar,
|
|
340
|
+
cnameSuffix: z.cnameSuffix,
|
|
341
|
+
verificationKey: z.verificationKey,
|
|
342
|
+
meta: z.meta,
|
|
343
|
+
owner: z.owner,
|
|
344
|
+
tenant: z.tenant,
|
|
345
|
+
tenantUnit: z.tenantUnit,
|
|
346
|
+
} as ZoneAttributes;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
const stringArrayEq = Array.makeEquivalence(Equivalence.String);
|
|
@@ -4,6 +4,13 @@ import {
|
|
|
4
4
|
} from "@distilled.cloud/cloudflare/Credentials";
|
|
5
5
|
import * as Effect from "effect/Effect";
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Reference to an existing Cloudflare Zone. Accepts:
|
|
9
|
+
* - a zone id (32 hex characters),
|
|
10
|
+
* - a zone name (`example.com`), or
|
|
11
|
+
* - a `{ zoneId, name? }` object (e.g. the output of a `Zone` resource or
|
|
12
|
+
* {@link importZone}).
|
|
13
|
+
*/
|
|
7
14
|
export type ZoneReference = string | { zoneId: string; name?: string };
|
|
8
15
|
|
|
9
16
|
export const isZoneId = (zone: string): boolean => /^[a-f0-9]{32}$/i.test(zone);
|
|
@@ -36,19 +43,25 @@ export const resolveZoneId = ({
|
|
|
36
43
|
);
|
|
37
44
|
});
|
|
38
45
|
|
|
46
|
+
type ZoneListItem = {
|
|
47
|
+
id: string;
|
|
48
|
+
name: string;
|
|
49
|
+
account: { id?: string | null };
|
|
50
|
+
};
|
|
51
|
+
|
|
39
52
|
type ZoneListResponse = {
|
|
40
53
|
success: boolean;
|
|
41
54
|
errors?: { message?: string }[];
|
|
42
|
-
result?:
|
|
55
|
+
result?: ZoneListItem[];
|
|
43
56
|
};
|
|
44
57
|
|
|
45
|
-
const findZoneByName = ({
|
|
58
|
+
export const findZoneByName = ({
|
|
46
59
|
accountId,
|
|
47
60
|
name,
|
|
48
61
|
}: {
|
|
49
62
|
accountId: string;
|
|
50
63
|
name: string;
|
|
51
|
-
}) =>
|
|
64
|
+
}): Effect.Effect<ZoneListItem | undefined, Error, Credentials> =>
|
|
52
65
|
Effect.gen(function* () {
|
|
53
66
|
const credentialsEffect = yield* Credentials;
|
|
54
67
|
const credentials = yield* credentialsEffect;
|
package/src/Cloudflare/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ export * from "./AiGateway/index.ts";
|
|
|
2
2
|
export * from "./AnalyticsEngine/index.ts";
|
|
3
3
|
export * from "./ApiToken/index.ts";
|
|
4
4
|
export * from "./Artifacts/index.ts";
|
|
5
|
-
export * from "./
|
|
5
|
+
export * from "./Browser/index.ts";
|
|
6
6
|
export * from "./CloudflareEnvironment.ts";
|
|
7
7
|
export * from "./Container/index.ts";
|
|
8
8
|
export * from "./D1/index.ts";
|
|
@@ -15,6 +15,7 @@ export * from "./KV/index.ts";
|
|
|
15
15
|
export * from "./Providers.ts";
|
|
16
16
|
export * from "./Queue/index.ts";
|
|
17
17
|
export * from "./R2/index.ts";
|
|
18
|
+
export * from "./RateLimit/index.ts";
|
|
18
19
|
export * from "./SecretsStore/index.ts";
|
|
19
20
|
export * from "./StateStore/index.ts";
|
|
20
21
|
export * from "./Tunnel/index.ts";
|
|
@@ -24,3 +25,4 @@ export * from "./Website/index.ts";
|
|
|
24
25
|
export * from "./Workers/index.ts";
|
|
25
26
|
export * from "./Workers/RpcAsync.ts";
|
|
26
27
|
export * from "./Zaraz/index.ts";
|
|
28
|
+
export * from "./Zone/index.ts";
|
package/src/Output.ts
CHANGED
|
@@ -549,7 +549,7 @@ export const evaluate: <A, Req = never>(
|
|
|
549
549
|
} else if (isNamedExpr(expr)) {
|
|
550
550
|
return yield* evaluate(expr.expr, upstream);
|
|
551
551
|
} else if (isRefExpr(expr)) {
|
|
552
|
-
const state = yield* State.State;
|
|
552
|
+
const state = yield* yield* State.State;
|
|
553
553
|
const stack = expr.stack ?? (yield* Stack).name;
|
|
554
554
|
const stage = expr.stage ?? (yield* Stage);
|
|
555
555
|
const resource = yield* state.get({
|
|
@@ -572,7 +572,7 @@ export const evaluate: <A, Req = never>(
|
|
|
572
572
|
// task's output value, otherwise undefined.
|
|
573
573
|
return (resource as any).attr ?? (resource as any).output;
|
|
574
574
|
} else if (isStackRefExpr(expr)) {
|
|
575
|
-
const state = yield* State.State;
|
|
575
|
+
const state = yield* yield* State.State;
|
|
576
576
|
const stack = expr.stack;
|
|
577
577
|
const stage = expr.stage ?? (yield* Stage);
|
|
578
578
|
const output = yield* state.getOutput({ stack, stage });
|
package/src/Plan.ts
CHANGED
|
@@ -4,6 +4,7 @@ import * as Effect from "effect/Effect";
|
|
|
4
4
|
import * as Option from "effect/Option";
|
|
5
5
|
import * as Redacted from "effect/Redacted";
|
|
6
6
|
import { asEffect } from ".//Util/types.ts";
|
|
7
|
+
import { isAction, type ActionLike } from "./Action.ts";
|
|
7
8
|
import {
|
|
8
9
|
AdoptPolicy,
|
|
9
10
|
OwnedBySomeoneElse,
|
|
@@ -41,19 +42,18 @@ import {
|
|
|
41
42
|
} from "./Resource.ts";
|
|
42
43
|
import { type StackSpec } from "./Stack.ts";
|
|
43
44
|
import {
|
|
45
|
+
isActionState,
|
|
44
46
|
State,
|
|
47
|
+
type ActionState,
|
|
45
48
|
type CreatedResourceState,
|
|
46
49
|
type CreatingResourceState,
|
|
47
|
-
isActionState,
|
|
48
50
|
type RanActionState,
|
|
49
51
|
type ReplacedResourceState,
|
|
50
52
|
type ReplacingResourceState,
|
|
51
53
|
type ResourceState,
|
|
52
|
-
type ActionState,
|
|
53
54
|
type UpdatedResourceState,
|
|
54
55
|
type UpdatingReourceState,
|
|
55
56
|
} from "./State/index.ts";
|
|
56
|
-
import { isAction, type ActionLike } from "./Action.ts";
|
|
57
57
|
import { hashInput } from "./Util/hash.ts";
|
|
58
58
|
import { findCycleMembers } from "./Util/scc.ts";
|
|
59
59
|
|
|
@@ -236,7 +236,7 @@ export const make = <A>(
|
|
|
236
236
|
): Effect.Effect<Plan<A>, never, State> =>
|
|
237
237
|
// @ts-expect-error
|
|
238
238
|
Effect.gen(function* () {
|
|
239
|
-
const state = yield* State;
|
|
239
|
+
const state = yield* yield* State;
|
|
240
240
|
|
|
241
241
|
const resources = Object.values(stack.resources);
|
|
242
242
|
const actions = Object.values(stack.actions ?? {});
|
package/src/Platform.ts
CHANGED
|
@@ -66,11 +66,7 @@ export interface Platform<
|
|
|
66
66
|
MainShape,
|
|
67
67
|
RuntimeContext extends BaseRuntimeContext,
|
|
68
68
|
BaseShape = {},
|
|
69
|
-
> extends Effect.Effect<
|
|
70
|
-
Resource & RuntimeContext,
|
|
71
|
-
never,
|
|
72
|
-
Services | PlatformServices
|
|
73
|
-
> {
|
|
69
|
+
> extends Effect.Effect<Resource & RuntimeContext, never, Resource> {
|
|
74
70
|
Type: Resource["Type"];
|
|
75
71
|
Provider: Provider<Resource>;
|
|
76
72
|
|
|
@@ -91,7 +87,7 @@ export interface Platform<
|
|
|
91
87
|
Self,
|
|
92
88
|
never,
|
|
93
89
|
| Resource["Providers"]
|
|
94
|
-
| Exclude<PropsReq | InitReq, Services | PlatformServices>
|
|
90
|
+
| Exclude<PropsReq | InitReq, Services | PlatformServices | Resource>
|
|
95
91
|
>;
|
|
96
92
|
new (_: never): MakeShape<Shape, BaseShape>;
|
|
97
93
|
of(shape: Shape & MainShape): MakeShape<Shape, BaseShape>;
|
|
@@ -101,7 +97,7 @@ export interface Platform<
|
|
|
101
97
|
<
|
|
102
98
|
Shape extends MainShape,
|
|
103
99
|
PropsReq = never,
|
|
104
|
-
InitReq extends Services | PlatformServices = never,
|
|
100
|
+
InitReq extends Services | PlatformServices | Resource = never,
|
|
105
101
|
>(
|
|
106
102
|
id: string,
|
|
107
103
|
props:
|
|
@@ -113,7 +109,7 @@ export interface Platform<
|
|
|
113
109
|
never,
|
|
114
110
|
| Resource["Providers"]
|
|
115
111
|
| PropsReq
|
|
116
|
-
| Exclude<InitReq, Services | PlatformServices>
|
|
112
|
+
| Exclude<InitReq, Services | PlatformServices | Resource>
|
|
117
113
|
> & {
|
|
118
114
|
new (_: never): MakeShape<Shape, BaseShape>;
|
|
119
115
|
};
|
|
@@ -127,23 +123,23 @@ export interface Platform<
|
|
|
127
123
|
never,
|
|
128
124
|
Resource["Providers"] | PropsReq
|
|
129
125
|
> & {
|
|
130
|
-
make<InitReq extends Services | PlatformServices = never>(
|
|
126
|
+
make<InitReq extends Services | PlatformServices | Resource = never>(
|
|
131
127
|
impl: Effect.Effect<Shape, ConfigError.ConfigError, InitReq>,
|
|
132
128
|
): Layer.Layer<
|
|
133
129
|
Self,
|
|
134
130
|
never,
|
|
135
131
|
| Resource["Providers"]
|
|
136
|
-
| Exclude<PropsReq | InitReq, Services | PlatformServices>
|
|
132
|
+
| Exclude<PropsReq | InitReq, Services | PlatformServices | Resource>
|
|
137
133
|
>;
|
|
138
134
|
new (_: never): MakeShape<Shape, BaseShape>;
|
|
139
|
-
} & (<InitReq extends Services | PlatformServices = never>(
|
|
135
|
+
} & (<InitReq extends Services | PlatformServices | Resource = never>(
|
|
140
136
|
impl: Effect.Effect<Shape, never, InitReq>,
|
|
141
137
|
) => Effect.Effect<
|
|
142
138
|
Resource & Rpc<Self>,
|
|
143
139
|
never,
|
|
144
140
|
| Resource["Providers"]
|
|
145
141
|
| PropsReq
|
|
146
|
-
| Exclude<InitReq, Services | PlatformServices>
|
|
142
|
+
| Exclude<InitReq, Services | PlatformServices | Resource>
|
|
147
143
|
>);
|
|
148
144
|
};
|
|
149
145
|
// <PropsReq = never, InitReq extends Services | PlatformServices = never>(
|
package/src/RemovalPolicy.ts
CHANGED
|
@@ -17,7 +17,7 @@ export const retain: {
|
|
|
17
17
|
): <R, Req2 = never>(
|
|
18
18
|
a: Effect.Effect<R, never, Req2>,
|
|
19
19
|
) => Effect.Effect<R, never, Req | Req2>;
|
|
20
|
-
} = ((enabled: boolean | Effect.Effect<boolean, never, any>) =>
|
|
20
|
+
} = ((enabled: boolean | Effect.Effect<boolean, never, any> = true) =>
|
|
21
21
|
(eff: Effect.Effect<any, never, any>) =>
|
|
22
22
|
eff.pipe(
|
|
23
23
|
typeof enabled === "boolean"
|
|
@@ -39,7 +39,7 @@ export const destroy: {
|
|
|
39
39
|
): <R, Req2 = never>(
|
|
40
40
|
a: Effect.Effect<R, never, Req2>,
|
|
41
41
|
) => Effect.Effect<R, never, Req | Req2>;
|
|
42
|
-
} = ((enabled: boolean | Effect.Effect<boolean, never, any>) =>
|
|
42
|
+
} = ((enabled: boolean | Effect.Effect<boolean, never, any> = true) =>
|
|
43
43
|
(eff: Effect.Effect<any, never, any>) =>
|
|
44
44
|
eff.pipe(
|
|
45
45
|
typeof enabled === "boolean"
|