domainkit 0.2.2 → 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.
Files changed (58) hide show
  1. package/README.md +26 -26
  2. package/dist/index.d.mts +639 -187
  3. package/dist/index.mjs +301 -300
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/promise.d.mts +464 -0
  6. package/dist/promise.mjs +636 -0
  7. package/dist/promise.mjs.map +1 -0
  8. package/dist/{resolver-CxE-VDw4.mjs → resolver-CvK7JoJM.mjs} +401 -54
  9. package/dist/resolver-CvK7JoJM.mjs.map +1 -0
  10. package/dist/{resolver-Dc0hwV-J.d.mts → resolver-uqe1h5Vz.d.mts} +1513 -25
  11. package/dist/testing.d.mts +4 -5
  12. package/dist/testing.mjs +17 -3
  13. package/dist/testing.mjs.map +1 -1
  14. package/dist/verify-B00c81-n.mjs +2420 -0
  15. package/dist/verify-B00c81-n.mjs.map +1 -0
  16. package/dist/{verify-Dls29YC-.d.mts → verify-CkgVrwyl.d.mts} +318 -21
  17. package/package.json +6 -30
  18. package/dist/auth-BR-19zj-.mjs +0 -738
  19. package/dist/auth-BR-19zj-.mjs.map +0 -1
  20. package/dist/auth-g-waCHcz.mjs +0 -671
  21. package/dist/auth-g-waCHcz.mjs.map +0 -1
  22. package/dist/authorization-OeaSR47S.mjs +0 -284
  23. package/dist/authorization-OeaSR47S.mjs.map +0 -1
  24. package/dist/canonical-json-CpvqGMcr.mjs +0 -57
  25. package/dist/canonical-json-CpvqGMcr.mjs.map +0 -1
  26. package/dist/cloudflare-BrZPU9li.d.mts +0 -32
  27. package/dist/cloudflare-CGmasR8A.mjs +0 -69
  28. package/dist/cloudflare-CGmasR8A.mjs.map +0 -1
  29. package/dist/cloudflare.d.mts +0 -3
  30. package/dist/cloudflare.mjs +0 -2
  31. package/dist/connection-BfkloPZy.d.mts +0 -186
  32. package/dist/connection-BwtOwpH6.mjs +0 -195
  33. package/dist/connection-BwtOwpH6.mjs.map +0 -1
  34. package/dist/connection-CjNQe_E-.mjs +0 -58
  35. package/dist/connection-CjNQe_E-.mjs.map +0 -1
  36. package/dist/connection-api-DNuEZ_jR.d.mts +0 -7
  37. package/dist/dns-record-BLeqo56C.mjs +0 -289
  38. package/dist/dns-record-BLeqo56C.mjs.map +0 -1
  39. package/dist/effect-cloudflare.d.mts +0 -2
  40. package/dist/effect-cloudflare.mjs +0 -2
  41. package/dist/effect-vercel.d.mts +0 -2
  42. package/dist/effect-vercel.mjs +0 -2
  43. package/dist/effect.d.mts +0 -36
  44. package/dist/effect.mjs +0 -51
  45. package/dist/effect.mjs.map +0 -1
  46. package/dist/index-BHWRTThN.d.mts +0 -159
  47. package/dist/index-D3PVknwE.d.mts +0 -145
  48. package/dist/resolver-CxE-VDw4.mjs.map +0 -1
  49. package/dist/vercel-BsNDu4Np.d.mts +0 -31
  50. package/dist/vercel-CfoJaaCu.mjs +0 -60
  51. package/dist/vercel-CfoJaaCu.mjs.map +0 -1
  52. package/dist/vercel.d.mts +0 -3
  53. package/dist/vercel.mjs +0 -2
  54. package/dist/verify-BKbvq7IN.mjs +0 -642
  55. package/dist/verify-BKbvq7IN.mjs.map +0 -1
  56. package/dist/zone-discovery-BPnH3sLU.d.mts +0 -1397
  57. package/dist/zones-DKHTpX9C.mjs +0 -19
  58. 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` — Promise API for application code;
14
- - `domainkit/effect` — canonical Effect-native services and programs;
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 { Provisioning } from "domainkit";
25
+ import { Effect, Layer } from "effect";
26
+ import { Digest, DnsProvider, Provisioning } from "domainkit";
27
27
 
28
- const { plan } = await Provisioning.create({
29
- provider,
28
+ const program = Provisioning.create({
30
29
  requirements,
31
30
  target: Provisioning.Target.ExactZone({ zone: "example.com" }),
32
- });
33
-
34
- // Present plan.operations to the user before authorizing the exact digest.
35
- const authorization = await Provisioning.authorize(plan);
36
- const receipt = await Provisioning.apply({ authorization, plan, provider });
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
- Effect applications provide the same capabilities as Layers and run the canonical program
40
- directly:
41
+ Promise consumers use the explicit secondary entry point at a JavaScript boundary:
41
42
 
42
43
  ```ts
43
- import { Effect, Layer } from "effect";
44
- import { Digest, DnsProvider, Provisioning } from "domainkit/effect";
44
+ import { Provisioning } from "domainkit/promise";
45
45
 
46
- const program = Provisioning.create({
46
+ const { plan } = await Provisioning.create({
47
+ provider,
47
48
  requirements,
48
49
  target: Provisioning.Target.ExactZone({ zone: "example.com" }),
49
- }).pipe(
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 { Verification } from "domainkit";
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({ provider, zone }),
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` or `domainkit/effect`. Then
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