domainkit 0.2.2 → 0.3.1
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/README.md +26 -26
- package/dist/index.d.mts +639 -187
- package/dist/index.mjs +301 -300
- package/dist/index.mjs.map +1 -1
- package/dist/promise.d.mts +464 -0
- package/dist/promise.mjs +636 -0
- package/dist/promise.mjs.map +1 -0
- package/dist/{resolver-CxE-VDw4.mjs → resolver-CvK7JoJM.mjs} +401 -54
- package/dist/resolver-CvK7JoJM.mjs.map +1 -0
- package/dist/{resolver-Dc0hwV-J.d.mts → resolver-uqe1h5Vz.d.mts} +1513 -25
- package/dist/testing.d.mts +4 -5
- package/dist/testing.mjs +17 -3
- package/dist/testing.mjs.map +1 -1
- package/dist/verify-BoWy70ew.mjs +2420 -0
- package/dist/verify-BoWy70ew.mjs.map +1 -0
- package/dist/{verify-Dls29YC-.d.mts → verify-CkgVrwyl.d.mts} +318 -21
- package/package.json +6 -30
- package/dist/auth-BR-19zj-.mjs +0 -738
- package/dist/auth-BR-19zj-.mjs.map +0 -1
- package/dist/auth-g-waCHcz.mjs +0 -671
- package/dist/auth-g-waCHcz.mjs.map +0 -1
- package/dist/authorization-OeaSR47S.mjs +0 -284
- package/dist/authorization-OeaSR47S.mjs.map +0 -1
- package/dist/canonical-json-CpvqGMcr.mjs +0 -57
- package/dist/canonical-json-CpvqGMcr.mjs.map +0 -1
- package/dist/cloudflare-BrZPU9li.d.mts +0 -32
- package/dist/cloudflare-CGmasR8A.mjs +0 -69
- package/dist/cloudflare-CGmasR8A.mjs.map +0 -1
- package/dist/cloudflare.d.mts +0 -3
- package/dist/cloudflare.mjs +0 -2
- package/dist/connection-BfkloPZy.d.mts +0 -186
- package/dist/connection-BwtOwpH6.mjs +0 -195
- package/dist/connection-BwtOwpH6.mjs.map +0 -1
- package/dist/connection-CjNQe_E-.mjs +0 -58
- package/dist/connection-CjNQe_E-.mjs.map +0 -1
- package/dist/connection-api-DNuEZ_jR.d.mts +0 -7
- package/dist/dns-record-BLeqo56C.mjs +0 -289
- package/dist/dns-record-BLeqo56C.mjs.map +0 -1
- package/dist/effect-cloudflare.d.mts +0 -2
- package/dist/effect-cloudflare.mjs +0 -2
- package/dist/effect-vercel.d.mts +0 -2
- package/dist/effect-vercel.mjs +0 -2
- package/dist/effect.d.mts +0 -36
- package/dist/effect.mjs +0 -51
- package/dist/effect.mjs.map +0 -1
- package/dist/index-BHWRTThN.d.mts +0 -159
- package/dist/index-D3PVknwE.d.mts +0 -145
- package/dist/resolver-CxE-VDw4.mjs.map +0 -1
- package/dist/vercel-BsNDu4Np.d.mts +0 -31
- package/dist/vercel-CfoJaaCu.mjs +0 -60
- package/dist/vercel-CfoJaaCu.mjs.map +0 -1
- package/dist/vercel.d.mts +0 -3
- package/dist/vercel.mjs +0 -2
- package/dist/verify-BKbvq7IN.mjs +0 -642
- package/dist/verify-BKbvq7IN.mjs.map +0 -1
- package/dist/zone-discovery-BPnH3sLU.d.mts +0 -1397
- package/dist/zones-DKHTpX9C.mjs +0 -19
- package/dist/zones-DKHTpX9C.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -10,45 +10,44 @@ bound to an approved plan digest and recorded in a receipt that can authorize a
|
|
|
10
10
|
|
|
11
11
|
## Package shape
|
|
12
12
|
|
|
13
|
-
- `domainkit` —
|
|
14
|
-
- `domainkit/
|
|
15
|
-
- `domainkit/cloudflare` and `domainkit/vercel` — Promise provider integrations;
|
|
16
|
-
- `domainkit/effect/cloudflare` and `domainkit/effect/vercel` — Effect provider integrations;
|
|
13
|
+
- `domainkit` — canonical Effect services, programs, schemas, and first-party providers;
|
|
14
|
+
- `domainkit/promise` — secondary Promise facade for foreign runtime boundaries;
|
|
17
15
|
- `domainkit/testing` — in-memory lifecycle capabilities and the provider conformance runner.
|
|
18
16
|
|
|
19
17
|
The package is portable ESM built on Fetch, Web Crypto, and Web APIs. Effect is a peer dependency.
|
|
20
18
|
Promise namespaces delegate to the Effect implementation rather than maintaining another planner,
|
|
21
|
-
authorization engine, or verifier.
|
|
19
|
+
authorization engine, or verifier. There are no provider-specific subpaths: `Cloudflare` and
|
|
20
|
+
`Vercel` are cohesive namespaces on each root.
|
|
22
21
|
|
|
23
22
|
## Plan, approve, and apply
|
|
24
23
|
|
|
25
24
|
```ts
|
|
26
|
-
import {
|
|
25
|
+
import { Effect, Layer } from "effect";
|
|
26
|
+
import { Digest, DnsProvider, Provisioning } from "domainkit";
|
|
27
27
|
|
|
28
|
-
const
|
|
29
|
-
provider,
|
|
28
|
+
const program = Provisioning.create({
|
|
30
29
|
requirements,
|
|
31
30
|
target: Provisioning.Target.ExactZone({ zone: "example.com" }),
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
}).pipe(
|
|
32
|
+
Effect.flatMap(({ plan }) =>
|
|
33
|
+
Provisioning.authorize(plan).pipe(
|
|
34
|
+
Effect.flatMap((authorization) => Provisioning.apply({ authorization, plan })),
|
|
35
|
+
),
|
|
36
|
+
),
|
|
37
|
+
Effect.provide(Layer.merge(Layer.succeed(DnsProvider.Service, provider), Digest.webCryptoLayer)),
|
|
38
|
+
);
|
|
37
39
|
```
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
directly:
|
|
41
|
+
Promise consumers use the explicit secondary entry point at a JavaScript boundary:
|
|
41
42
|
|
|
42
43
|
```ts
|
|
43
|
-
import {
|
|
44
|
-
import { Digest, DnsProvider, Provisioning } from "domainkit/effect";
|
|
44
|
+
import { Provisioning } from "domainkit/promise";
|
|
45
45
|
|
|
46
|
-
const
|
|
46
|
+
const { plan } = await Provisioning.create({
|
|
47
|
+
provider,
|
|
47
48
|
requirements,
|
|
48
49
|
target: Provisioning.Target.ExactZone({ zone: "example.com" }),
|
|
49
|
-
})
|
|
50
|
-
Effect.provide(Layer.merge(Layer.succeed(DnsProvider.Service, provider), Digest.webCryptoLayer)),
|
|
51
|
-
);
|
|
50
|
+
});
|
|
52
51
|
```
|
|
53
52
|
|
|
54
53
|
Use `DiscoverFromDomain` when the host has several authorized provider accounts. `ZoneDiscovery`
|
|
@@ -87,9 +86,10 @@ remains retryable until the provider confirms revocation.
|
|
|
87
86
|
`Verification.observe` is the only verification operation. Public DNS is the default:
|
|
88
87
|
|
|
89
88
|
```ts
|
|
90
|
-
import {
|
|
89
|
+
import { Effect } from "effect";
|
|
90
|
+
import { DnsProvider, Verification } from "domainkit";
|
|
91
91
|
|
|
92
|
-
const result = await Verification.observe({ record });
|
|
92
|
+
const result = await Effect.runPromise(Verification.observe({ record }));
|
|
93
93
|
```
|
|
94
94
|
|
|
95
95
|
The default resolver pool queries Cloudflare and Google concurrently using RFC wire-format DNS over
|
|
@@ -100,10 +100,10 @@ Authoritative-provider observation is opt-in:
|
|
|
100
100
|
|
|
101
101
|
```ts
|
|
102
102
|
const result = await Verification.observe({
|
|
103
|
-
provider: Verification.Provider.Enabled({
|
|
103
|
+
provider: Verification.Provider.Enabled({ zone }),
|
|
104
104
|
publicDns: Verification.PublicDns.Disabled(),
|
|
105
105
|
record,
|
|
106
|
-
});
|
|
106
|
+
}).pipe(Effect.provideService(DnsProvider.Service, provider), Effect.runPromise);
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
When both sources are requested, both must match for `Verified`. Every result is exhaustive and
|
|
@@ -111,7 +111,7 @@ tagged as `NotObserved`, `Pending`, `Mismatch`, `Unavailable`, or `Verified`.
|
|
|
111
111
|
|
|
112
112
|
## Implement a DNS provider
|
|
113
113
|
|
|
114
|
-
Implement the narrow `DnsProvider` contract exported from `domainkit
|
|
114
|
+
Implement the narrow `DnsProvider` contract exported from `domainkit`. Then
|
|
115
115
|
run the deterministic offline contract exported from `domainkit/testing`:
|
|
116
116
|
|
|
117
117
|
```ts
|