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.
Files changed (58) hide show
  1. package/README.md +31 -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-BbVzTbCX.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-7_EbKbFM.d.mts → verify-CkgVrwyl.d.mts} +318 -21
  17. package/package.json +6 -30
  18. package/dist/auth-6-KRy1gN.mjs +0 -671
  19. package/dist/auth-6-KRy1gN.mjs.map +0 -1
  20. package/dist/auth-B4jq3yk3.mjs +0 -738
  21. package/dist/auth-B4jq3yk3.mjs.map +0 -1
  22. package/dist/authorization-CQSKKMrW.mjs +0 -255
  23. package/dist/authorization-CQSKKMrW.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-Bg_p-M2c.mjs +0 -69
  27. package/dist/cloudflare-Bg_p-M2c.mjs.map +0 -1
  28. package/dist/cloudflare-FDl5q7Dm.d.mts +0 -32
  29. package/dist/cloudflare.d.mts +0 -3
  30. package/dist/cloudflare.mjs +0 -2
  31. package/dist/connection-BXoSrhZs.mjs +0 -58
  32. package/dist/connection-BXoSrhZs.mjs.map +0 -1
  33. package/dist/connection-CEqadXSm.d.mts +0 -182
  34. package/dist/connection-X3rZhrBZ.mjs +0 -186
  35. package/dist/connection-X3rZhrBZ.mjs.map +0 -1
  36. package/dist/connection-api-DftK7eHo.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 -50
  45. package/dist/effect.mjs.map +0 -1
  46. package/dist/index-B1opsgls.d.mts +0 -159
  47. package/dist/index-Ewc__bQu.d.mts +0 -145
  48. package/dist/resolver-CxE-VDw4.mjs.map +0 -1
  49. package/dist/vercel-BIFpZRPu.mjs +0 -60
  50. package/dist/vercel-BIFpZRPu.mjs.map +0 -1
  51. package/dist/vercel-DgJaUX9D.d.mts +0 -31
  52. package/dist/vercel.d.mts +0 -3
  53. package/dist/vercel.mjs +0 -2
  54. package/dist/verify-Q5RYpnuw.mjs +0 -642
  55. package/dist/verify-Q5RYpnuw.mjs.map +0 -1
  56. package/dist/zone-discovery-BA5I24vu.d.mts +0 -1390
  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`
@@ -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 { Verification } from "domainkit";
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({ provider, zone }),
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` or `domainkit/effect`. Then
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