alchemy 2.0.0-beta.47 → 2.0.0-beta.49
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 +28 -5
- 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/AdoptPolicy.js +1 -1
- package/lib/AdoptPolicy.js.map +1 -1
- package/lib/Binding.d.ts +5 -1
- package/lib/Binding.d.ts.map +1 -1
- package/lib/Binding.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/Cloudflare/AiGateway/AiGateway.d.ts +1 -1
- package/lib/Cloudflare/AiGateway/AiGateway.d.ts.map +1 -1
- package/lib/Cloudflare/AiGateway/AiGateway.js +2 -1
- package/lib/Cloudflare/AiGateway/AiGateway.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 +36 -4
- 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/Dns/DnsBinding.d.ts +52 -0
- package/lib/Cloudflare/Dns/DnsBinding.d.ts.map +1 -0
- package/lib/Cloudflare/Dns/DnsBinding.js +59 -0
- package/lib/Cloudflare/Dns/DnsBinding.js.map +1 -0
- package/lib/Cloudflare/Dns/DnsRead.d.ts +80 -0
- package/lib/Cloudflare/Dns/DnsRead.d.ts.map +1 -0
- package/lib/Cloudflare/Dns/DnsRead.js +70 -0
- package/lib/Cloudflare/Dns/DnsRead.js.map +1 -0
- package/lib/Cloudflare/Dns/DnsReadWrite.d.ts +79 -0
- package/lib/Cloudflare/Dns/DnsReadWrite.d.ts.map +1 -0
- package/lib/Cloudflare/Dns/DnsReadWrite.js +72 -0
- package/lib/Cloudflare/Dns/DnsReadWrite.js.map +1 -0
- package/lib/Cloudflare/Dns/DnsWrite.d.ts +113 -0
- package/lib/Cloudflare/Dns/DnsWrite.d.ts.map +1 -0
- package/lib/Cloudflare/Dns/DnsWrite.js +100 -0
- package/lib/Cloudflare/Dns/DnsWrite.js.map +1 -0
- package/lib/Cloudflare/Dns/index.d.ts +5 -0
- package/lib/Cloudflare/Dns/index.d.ts.map +1 -0
- package/lib/Cloudflare/Dns/index.js +5 -0
- package/lib/Cloudflare/Dns/index.js.map +1 -0
- 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/Hyperdrive/Hyperdrive.d.ts +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/KV/KVNamespace.d.ts +1 -1
- package/lib/Cloudflare/Providers.d.ts.map +1 -1
- package/lib/Cloudflare/Providers.js +14 -3
- package/lib/Cloudflare/Providers.js.map +1 -1
- package/lib/Cloudflare/Queue/Queue.d.ts +1 -1
- package/lib/Cloudflare/R2/R2Bucket.d.ts +2 -2
- 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 +3 -2
- 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/Api.d.ts +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.d.ts +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/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.js +2 -0
- package/lib/Cloudflare/Workers/LocalWorkerProvider.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 +7 -5
- 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/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 +4 -1
- package/lib/Cloudflare/index.d.ts.map +1 -1
- package/lib/Cloudflare/index.js +4 -1
- package/lib/Cloudflare/index.js.map +1 -1
- package/lib/Output.d.ts +13 -1
- package/lib/Output.d.ts.map +1 -1
- package/lib/Output.js +43 -11
- package/lib/Output.js.map +1 -1
- package/lib/Plan.d.ts.map +1 -1
- package/lib/Plan.js +8 -0
- 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 +5 -2
- 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 +15 -2
- package/lib/Resource.d.ts.map +1 -1
- package/lib/Resource.js +3 -2
- package/lib/Resource.js.map +1 -1
- package/lib/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/AdoptPolicy.ts +1 -1
- package/src/Binding.ts +5 -1
- package/src/Cli/commands/cloudflare.ts +394 -1
- package/src/Cloudflare/AiGateway/AiGateway.ts +2 -1
- package/src/Cloudflare/ApiToken/AccountApiToken.ts +60 -7
- package/src/Cloudflare/ApiToken/Common.ts +45 -6
- 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/Dns/DnsBinding.ts +123 -0
- package/src/Cloudflare/Dns/DnsRead.ts +129 -0
- package/src/Cloudflare/Dns/DnsReadWrite.ts +99 -0
- package/src/Cloudflare/Dns/DnsWrite.ts +209 -0
- package/src/Cloudflare/Dns/index.ts +4 -0
- 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 +22 -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/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/DynamicWorkerLoader.ts +139 -13
- package/src/Cloudflare/Workers/InferEnv.ts +19 -15
- package/src/Cloudflare/Workers/LocalWorkerProvider.ts +13 -2
- package/src/Cloudflare/Workers/WorkerAsyncBindings.ts +16 -2
- package/src/Cloudflare/Workers/WorkerBinding.ts +6 -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 +4 -1
- package/src/Output.ts +67 -11
- package/src/Plan.ts +9 -0
- package/src/Platform.ts +19 -15
- package/src/RemovalPolicy.ts +2 -2
- package/src/Resource.ts +19 -2
- 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
|
@@ -40,21 +40,25 @@ export type GetBindingType<T> =
|
|
|
40
40
|
? AnalyticsEngineDataset
|
|
41
41
|
: T extends Cloudflare.Artifacts
|
|
42
42
|
? Artifacts
|
|
43
|
-
: T extends Cloudflare.
|
|
44
|
-
?
|
|
45
|
-
: T extends Cloudflare.
|
|
46
|
-
?
|
|
47
|
-
: T extends Cloudflare.
|
|
48
|
-
?
|
|
49
|
-
: T extends Cloudflare.
|
|
50
|
-
?
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
43
|
+
: T extends Cloudflare.RateLimit
|
|
44
|
+
? RateLimit
|
|
45
|
+
: T extends Cloudflare.Images
|
|
46
|
+
? ImagesBinding
|
|
47
|
+
: T extends Cloudflare.Browser
|
|
48
|
+
? Fetcher
|
|
49
|
+
: T extends Cloudflare.Hyperdrive
|
|
50
|
+
? Hyperdrive
|
|
51
|
+
: T extends Cloudflare.DynamicWorkerLoader
|
|
52
|
+
? Cloudflare.DynamicWorkerLoaderBinding
|
|
53
|
+
: T extends Cloudflare.DurableObjectNamespaceLike
|
|
54
|
+
? DurableObjectNamespace<
|
|
55
|
+
Exclude<T["Shape"], undefined>
|
|
56
|
+
>
|
|
57
|
+
: T extends Redacted<any>
|
|
58
|
+
? // redacteds are always stored as secret_text, so are always string
|
|
59
|
+
// we JSON.stringify when not a Redacted<string>
|
|
60
|
+
string
|
|
61
|
+
: T;
|
|
58
62
|
|
|
59
63
|
/**
|
|
60
64
|
* Cloudflare service-binding wire shape for an Effect-native Worker.
|
|
@@ -595,8 +595,19 @@ const toRuntimeAssets = (
|
|
|
595
595
|
directory: "directory" in assets ? assets.directory : assets.path,
|
|
596
596
|
headers: assets.config?.headers,
|
|
597
597
|
redirects: assets.config?.redirects,
|
|
598
|
-
|
|
599
|
-
|
|
598
|
+
// Distilled widened generated string enums to open unions (`string & {}`);
|
|
599
|
+
// the API only ever returns the known variants here.
|
|
600
|
+
htmlHandling: assets.config?.htmlHandling as
|
|
601
|
+
| "none"
|
|
602
|
+
| "auto-trailing-slash"
|
|
603
|
+
| "force-trailing-slash"
|
|
604
|
+
| "drop-trailing-slash"
|
|
605
|
+
| undefined,
|
|
606
|
+
notFoundHandling: assets.config?.notFoundHandling as
|
|
607
|
+
| "none"
|
|
608
|
+
| "404-page"
|
|
609
|
+
| "single-page-application"
|
|
610
|
+
| undefined,
|
|
600
611
|
runWorkerFirst: assets.config?.runWorkerFirst,
|
|
601
612
|
serveDirectly: assets.config?.serveDirectly,
|
|
602
613
|
};
|
|
@@ -10,7 +10,7 @@ import { asEffect } from "../../Util/types.ts";
|
|
|
10
10
|
import { isAiGateway } from "../AiGateway/AiGateway.ts";
|
|
11
11
|
import { isAnalyticsEngineDataset } from "../AnalyticsEngine/AnalyticsEngineDataset.ts";
|
|
12
12
|
import { isArtifacts } from "../Artifacts/Artifacts.ts";
|
|
13
|
-
import {
|
|
13
|
+
import { isBrowser } from "../Browser/Browser.ts";
|
|
14
14
|
import { isD1Database } from "../D1/D1Database.ts";
|
|
15
15
|
import { isSendEmail } from "../Email/SendEmail.ts";
|
|
16
16
|
import { isHyperdrive } from "../Hyperdrive/Hyperdrive.ts";
|
|
@@ -19,9 +19,11 @@ import { isImages } from "../Images/Images.ts";
|
|
|
19
19
|
import { isKVNamespace } from "../KV/KVNamespace.ts";
|
|
20
20
|
import { isQueue } from "../Queue/Queue.ts";
|
|
21
21
|
import { isR2Bucket } from "../R2/R2Bucket.ts";
|
|
22
|
+
import { isRateLimit } from "../RateLimit/RateLimit.ts";
|
|
22
23
|
import { isVectorizeIndex } from "../Vectorize/VectorizeIndex.ts";
|
|
23
24
|
import { isAssets } from "./Assets.ts";
|
|
24
25
|
import { isDurableObjectNamespaceLike } from "./DurableObjectNamespace.ts";
|
|
26
|
+
import { isDynamicWorkerLoader } from "./DynamicWorkerLoader.ts";
|
|
25
27
|
import type { WorkerBindingProps } from "./Worker.ts";
|
|
26
28
|
import { isWorker, type Worker, type WorkerProps } from "./Worker.ts";
|
|
27
29
|
import type { WorkerBinding, WorkerBindingResource } from "./WorkerBinding.ts";
|
|
@@ -119,7 +121,7 @@ const toBinding = (
|
|
|
119
121
|
type: "images",
|
|
120
122
|
name: bindingName,
|
|
121
123
|
};
|
|
122
|
-
} else if (
|
|
124
|
+
} else if (isBrowser(binding)) {
|
|
123
125
|
return {
|
|
124
126
|
type: "browser",
|
|
125
127
|
name: bindingName,
|
|
@@ -130,6 +132,13 @@ const toBinding = (
|
|
|
130
132
|
name: bindingName,
|
|
131
133
|
dataset: binding.dataset,
|
|
132
134
|
};
|
|
135
|
+
} else if (isRateLimit(binding)) {
|
|
136
|
+
return {
|
|
137
|
+
type: "ratelimit",
|
|
138
|
+
name: bindingName,
|
|
139
|
+
namespaceId: binding.namespaceId,
|
|
140
|
+
simple: binding.simple,
|
|
141
|
+
};
|
|
133
142
|
} else if (isSendEmail(binding)) {
|
|
134
143
|
return {
|
|
135
144
|
type: "send_email",
|
|
@@ -197,6 +206,11 @@ const toBinding = (
|
|
|
197
206
|
name: bindingName,
|
|
198
207
|
indexName: binding.indexName,
|
|
199
208
|
};
|
|
209
|
+
} else if (isDynamicWorkerLoader(binding)) {
|
|
210
|
+
return {
|
|
211
|
+
type: "worker_loader",
|
|
212
|
+
name: bindingName,
|
|
213
|
+
} as any;
|
|
200
214
|
} else {
|
|
201
215
|
return {
|
|
202
216
|
type: "json",
|
|
@@ -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 = {
|
|
@@ -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,10 +2,11 @@ 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";
|
|
9
|
+
export * from "./Dns/index.ts";
|
|
9
10
|
export * from "./EdgeSession.ts";
|
|
10
11
|
export * from "./Fetcher.ts";
|
|
11
12
|
export * from "./Email/index.ts";
|
|
@@ -15,6 +16,7 @@ export * from "./KV/index.ts";
|
|
|
15
16
|
export * from "./Providers.ts";
|
|
16
17
|
export * from "./Queue/index.ts";
|
|
17
18
|
export * from "./R2/index.ts";
|
|
19
|
+
export * from "./RateLimit/index.ts";
|
|
18
20
|
export * from "./SecretsStore/index.ts";
|
|
19
21
|
export * from "./StateStore/index.ts";
|
|
20
22
|
export * from "./Tunnel/index.ts";
|
|
@@ -24,3 +26,4 @@ export * from "./Website/index.ts";
|
|
|
24
26
|
export * from "./Workers/index.ts";
|
|
25
27
|
export * from "./Workers/RpcAsync.ts";
|
|
26
28
|
export * from "./Zaraz/index.ts";
|
|
29
|
+
export * from "./Zone/index.ts";
|