domainkit 0.2.1 → 0.3.0
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 +31 -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-BbVzTbCX.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-B00c81-n.mjs +2420 -0
- package/dist/verify-B00c81-n.mjs.map +1 -0
- package/dist/{verify-7_EbKbFM.d.mts → verify-CkgVrwyl.d.mts} +318 -21
- package/package.json +6 -30
- package/dist/auth-6-KRy1gN.mjs +0 -671
- package/dist/auth-6-KRy1gN.mjs.map +0 -1
- package/dist/auth-B4jq3yk3.mjs +0 -738
- package/dist/auth-B4jq3yk3.mjs.map +0 -1
- package/dist/authorization-CQSKKMrW.mjs +0 -255
- package/dist/authorization-CQSKKMrW.mjs.map +0 -1
- package/dist/canonical-json-CpvqGMcr.mjs +0 -57
- package/dist/canonical-json-CpvqGMcr.mjs.map +0 -1
- package/dist/cloudflare-Bg_p-M2c.mjs +0 -69
- package/dist/cloudflare-Bg_p-M2c.mjs.map +0 -1
- package/dist/cloudflare-FDl5q7Dm.d.mts +0 -32
- package/dist/cloudflare.d.mts +0 -3
- package/dist/cloudflare.mjs +0 -2
- package/dist/connection-BXoSrhZs.mjs +0 -58
- package/dist/connection-BXoSrhZs.mjs.map +0 -1
- package/dist/connection-CEqadXSm.d.mts +0 -182
- package/dist/connection-X3rZhrBZ.mjs +0 -186
- package/dist/connection-X3rZhrBZ.mjs.map +0 -1
- package/dist/connection-api-DftK7eHo.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 -50
- package/dist/effect.mjs.map +0 -1
- package/dist/index-B1opsgls.d.mts +0 -159
- package/dist/index-Ewc__bQu.d.mts +0 -145
- package/dist/resolver-CxE-VDw4.mjs.map +0 -1
- package/dist/vercel-BIFpZRPu.mjs +0 -60
- package/dist/vercel-BIFpZRPu.mjs.map +0 -1
- package/dist/vercel-DgJaUX9D.d.mts +0 -31
- package/dist/vercel.d.mts +0 -3
- package/dist/vercel.mjs +0 -2
- package/dist/verify-Q5RYpnuw.mjs +0 -642
- package/dist/verify-Q5RYpnuw.mjs.map +0 -1
- package/dist/zone-discovery-BA5I24vu.d.mts +0 -1390
- 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`
|
|
@@ -62,6 +61,11 @@ or `Redirect`; `Connection.complete` consumes an interactive continuation exactl
|
|
|
62
61
|
implements OAuth and token methods. Vercel implements its installation-code flow without
|
|
63
62
|
mislabeling it as generic OAuth.
|
|
64
63
|
|
|
64
|
+
After a host proves that an existing connected account owns another domain and obtains the owner's
|
|
65
|
+
consent, `Connection.extend` adds that domain to the existing owner grant without repeating provider
|
|
66
|
+
authentication. It preserves earlier domain grants and rejects cross-owner, expired, or revoking
|
|
67
|
+
connections.
|
|
68
|
+
|
|
65
69
|
Cloudflare can discover the selected account from a domain already visible to the credential, so a
|
|
66
70
|
customer does not need to find or type an account ID. Vercel retains explicit personal or team
|
|
67
71
|
context returned by the installation. Both contexts are versioned, non-secret values that can
|
|
@@ -82,9 +86,10 @@ remains retryable until the provider confirms revocation.
|
|
|
82
86
|
`Verification.observe` is the only verification operation. Public DNS is the default:
|
|
83
87
|
|
|
84
88
|
```ts
|
|
85
|
-
import {
|
|
89
|
+
import { Effect } from "effect";
|
|
90
|
+
import { DnsProvider, Verification } from "domainkit";
|
|
86
91
|
|
|
87
|
-
const result = await Verification.observe({ record });
|
|
92
|
+
const result = await Effect.runPromise(Verification.observe({ record }));
|
|
88
93
|
```
|
|
89
94
|
|
|
90
95
|
The default resolver pool queries Cloudflare and Google concurrently using RFC wire-format DNS over
|
|
@@ -95,10 +100,10 @@ Authoritative-provider observation is opt-in:
|
|
|
95
100
|
|
|
96
101
|
```ts
|
|
97
102
|
const result = await Verification.observe({
|
|
98
|
-
provider: Verification.Provider.Enabled({
|
|
103
|
+
provider: Verification.Provider.Enabled({ zone }),
|
|
99
104
|
publicDns: Verification.PublicDns.Disabled(),
|
|
100
105
|
record,
|
|
101
|
-
});
|
|
106
|
+
}).pipe(Effect.provideService(DnsProvider.Service, provider), Effect.runPromise);
|
|
102
107
|
```
|
|
103
108
|
|
|
104
109
|
When both sources are requested, both must match for `Verified`. Every result is exhaustive and
|
|
@@ -106,7 +111,7 @@ tagged as `NotObserved`, `Pending`, `Mismatch`, `Unavailable`, or `Verified`.
|
|
|
106
111
|
|
|
107
112
|
## Implement a DNS provider
|
|
108
113
|
|
|
109
|
-
Implement the narrow `DnsProvider` contract exported from `domainkit
|
|
114
|
+
Implement the narrow `DnsProvider` contract exported from `domainkit`. Then
|
|
110
115
|
run the deterministic offline contract exported from `domainkit/testing`:
|
|
111
116
|
|
|
112
117
|
```ts
|