domainkit 0.1.1 → 0.2.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.
Files changed (67) hide show
  1. package/README.md +87 -83
  2. package/dist/{client-BnD7QLRF.mjs → auth-6-KRy1gN.mjs} +235 -131
  3. package/dist/auth-6-KRy1gN.mjs.map +1 -0
  4. package/dist/{auth-B0owkrpk.mjs → auth-B4jq3yk3.mjs} +212 -20
  5. package/dist/auth-B4jq3yk3.mjs.map +1 -0
  6. package/dist/authorization-CQSKKMrW.mjs +255 -0
  7. package/dist/authorization-CQSKKMrW.mjs.map +1 -0
  8. package/dist/canonical-json-CpvqGMcr.mjs +57 -0
  9. package/dist/canonical-json-CpvqGMcr.mjs.map +1 -0
  10. package/dist/{cloudflare-D0-J2MfP.mjs → cloudflare-Bg_p-M2c.mjs} +26 -3
  11. package/dist/cloudflare-Bg_p-M2c.mjs.map +1 -0
  12. package/dist/cloudflare-FDl5q7Dm.d.mts +32 -0
  13. package/dist/cloudflare.d.mts +3 -3
  14. package/dist/cloudflare.mjs +2 -2
  15. package/dist/connection-BXoSrhZs.mjs +58 -0
  16. package/dist/connection-BXoSrhZs.mjs.map +1 -0
  17. package/dist/connection-CEqadXSm.d.mts +182 -0
  18. package/dist/connection-X3rZhrBZ.mjs +186 -0
  19. package/dist/connection-X3rZhrBZ.mjs.map +1 -0
  20. package/dist/connection-api-DftK7eHo.d.mts +7 -0
  21. package/dist/{dns-record-C_KwGPLf.mjs → dns-record-BLeqo56C.mjs} +23 -3
  22. package/dist/dns-record-BLeqo56C.mjs.map +1 -0
  23. package/dist/effect-cloudflare.d.mts +2 -2
  24. package/dist/effect-cloudflare.mjs +2 -2
  25. package/dist/effect-vercel.d.mts +2 -2
  26. package/dist/effect-vercel.mjs +2 -2
  27. package/dist/effect.d.mts +9 -46
  28. package/dist/effect.mjs +29 -7
  29. package/dist/effect.mjs.map +1 -1
  30. package/dist/{index-D2howbNz.d.mts → index-B1opsgls.d.mts} +53 -6
  31. package/dist/{index-CEzk2gbZ.d.mts → index-Ewc__bQu.d.mts} +58 -7
  32. package/dist/index.d.mts +169 -113
  33. package/dist/index.mjs +201 -139
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/{resolver-BHPsADzE.d.mts → resolver-BbVzTbCX.d.mts} +630 -273
  36. package/dist/resolver-CxE-VDw4.mjs +598 -0
  37. package/dist/resolver-CxE-VDw4.mjs.map +1 -0
  38. package/dist/testing.d.mts +53 -44
  39. package/dist/testing.mjs +379 -107
  40. package/dist/testing.mjs.map +1 -1
  41. package/dist/{vercel-DD89DCqH.mjs → vercel-BIFpZRPu.mjs} +23 -3
  42. package/dist/vercel-BIFpZRPu.mjs.map +1 -0
  43. package/dist/vercel-DgJaUX9D.d.mts +31 -0
  44. package/dist/vercel.d.mts +3 -3
  45. package/dist/vercel.mjs +2 -2
  46. package/dist/verify-7_EbKbFM.d.mts +805 -0
  47. package/dist/verify-Q5RYpnuw.mjs +642 -0
  48. package/dist/verify-Q5RYpnuw.mjs.map +1 -0
  49. package/dist/zone-discovery-BA5I24vu.d.mts +1390 -0
  50. package/dist/zones-DKHTpX9C.mjs +19 -0
  51. package/dist/zones-DKHTpX9C.mjs.map +1 -0
  52. package/package.json +1 -1
  53. package/dist/auth-B0owkrpk.mjs.map +0 -1
  54. package/dist/client-BnD7QLRF.mjs.map +0 -1
  55. package/dist/cloudflare-CprjjXfm.d.mts +0 -23
  56. package/dist/cloudflare-D0-J2MfP.mjs.map +0 -1
  57. package/dist/dns-record-C_KwGPLf.mjs.map +0 -1
  58. package/dist/manifest-CP85ePFn.d.mts +0 -583
  59. package/dist/receipt-CGSnfZQ6.mjs +0 -28
  60. package/dist/receipt-CGSnfZQ6.mjs.map +0 -1
  61. package/dist/resolver-tEXpKxmH.mjs +0 -200
  62. package/dist/resolver-tEXpKxmH.mjs.map +0 -1
  63. package/dist/vercel-D-E2aqb1.d.mts +0 -22
  64. package/dist/vercel-DD89DCqH.mjs.map +0 -1
  65. package/dist/verify-B80xCBh2.d.mts +0 -1407
  66. package/dist/verify-BXOvXE20.mjs +0 -1388
  67. package/dist/verify-BXOvXE20.mjs.map +0 -1
@@ -0,0 +1,182 @@
1
+ import { A as Connection, B as Capability, C as Aggregate, D as Service, E as Interface, F as assertGrant, M as OAuthContinuation, N as Schema$1, Nt as DomainName, P as StoredCredential, R as encode, T as Error, V as CapabilityEvidence, _ as StartResult, a as Authentication, ct as AsyncInterface, d as Error$1, h as Method$1, j as Grant, k as AuthorizationError, l as Continuation, m as InteractiveStart, ot as Value, p as InteractiveFlow$1, r as Source$1, s as BaseInput, t as Candidate, u as ContinuationStore$1, w as DetachResult } from "./zone-discovery-BA5I24vu.mjs";
2
+ import "./connection-api-DftK7eHo.mjs";
3
+ import { Data, Layer } from "effect";
4
+ declare namespace zone_discovery_d_exports {
5
+ export { Candidate, Outcome, Source, discover, toEffectSource };
6
+ }
7
+ interface Source {
8
+ readonly listZones: (name: DomainName) => Promise<ReadonlyArray<Omit<Candidate, "providerId">>>;
9
+ readonly provider: AsyncInterface;
10
+ }
11
+ type Outcome = {
12
+ readonly _tag: "NotFound";
13
+ readonly domain: DomainName;
14
+ } | {
15
+ readonly _tag: "Resolved";
16
+ readonly candidate: Candidate;
17
+ } | {
18
+ readonly _tag: "SelectionRequired";
19
+ readonly candidates: ReadonlyArray<Candidate>;
20
+ };
21
+ declare function discover(input: {
22
+ readonly domain: DomainName;
23
+ readonly sources: ReadonlyArray<Source>;
24
+ }): Promise<Outcome>;
25
+ declare function toEffectSource(source: Source): Source$1;
26
+ declare namespace authorization_lifecycle_d_exports {
27
+ export { Aggregate, DetachResult, Error, Repository, from, layerFrom, toAsync };
28
+ }
29
+ interface Repository {
30
+ readonly bind: (authorizationId: string, binding: Connection) => Promise<Aggregate>;
31
+ readonly connect: (aggregate: Aggregate) => Promise<Aggregate>;
32
+ readonly detach: (input: {
33
+ readonly connectionId: string;
34
+ readonly revoke: (aggregate: Aggregate) => Promise<void>;
35
+ }) => Promise<DetachResult>;
36
+ readonly findByProviderAccount: (providerId: string, providerAccountId: string) => Promise<Aggregate | null>;
37
+ readonly get: (authorizationId: string) => Promise<Aggregate | null>;
38
+ readonly getByConnectionId: (connectionId: string) => Promise<Aggregate | null>;
39
+ readonly promoteEvidence: (authorizationId: string, evidence: ReadonlyArray<CapabilityEvidence>) => Promise<Aggregate>;
40
+ readonly recover: (input: {
41
+ readonly authorizationId: string;
42
+ readonly revoke: (aggregate: Aggregate) => Promise<void>;
43
+ }) => Promise<DetachResult>;
44
+ readonly rotate: (authorizationId: string, credential: StoredCredential, expiresAt: Date | null) => Promise<Aggregate>;
45
+ }
46
+ declare const layerFrom: (repository: Repository) => Layer.Layer<Service>;
47
+ declare const toAsync: (repository: Interface) => Repository;
48
+ declare const from: (repository: Repository) => Repository;
49
+ declare namespace connection_d_exports {
50
+ export { Authentication, AuthorizationError, Connection, StartResult as ConnectionStartResult, ContinuationStore, Error$1 as Error, Grant, InteractiveFlow, Method, OAuthContinuation, Schema$1 as Schema, StartResult, StoredCredential, assertGrant, complete, decode, encode, fromEffectFlow, fromEffectTokenMethod, start, toAsyncContinuations };
51
+ }
52
+ declare function decode(input: unknown): Promise<Connection>;
53
+ type Method = Data.TaggedEnum<{
54
+ Interactive: {
55
+ readonly continuations: ContinuationStore;
56
+ readonly flow: InteractiveFlow;
57
+ readonly ttlMs?: number;
58
+ };
59
+ Token: {
60
+ readonly authenticate: (token: Value) => Promise<Authentication>;
61
+ readonly providerId: string;
62
+ readonly requiredCapabilities: ReadonlyArray<Capability>;
63
+ readonly token: Value;
64
+ };
65
+ }>;
66
+ declare const Method: {
67
+ readonly $is: <Tag extends "Interactive" | "Token">(tag: Tag) => (u: unknown) => u is Extract<{
68
+ readonly _tag: "Interactive";
69
+ readonly continuations: ContinuationStore;
70
+ readonly flow: InteractiveFlow;
71
+ readonly ttlMs?: number;
72
+ }, {
73
+ readonly _tag: Tag;
74
+ }> | Extract<{
75
+ readonly _tag: "Token";
76
+ readonly authenticate: (token: Value) => Promise<Authentication>;
77
+ readonly providerId: string;
78
+ readonly requiredCapabilities: ReadonlyArray<Capability>;
79
+ readonly token: Value;
80
+ }, {
81
+ readonly _tag: Tag;
82
+ }>;
83
+ readonly $match: {
84
+ <Cases extends { readonly [Tag in "Interactive" | "Token"]: (args: Extract<{
85
+ readonly _tag: "Interactive";
86
+ readonly continuations: ContinuationStore;
87
+ readonly flow: InteractiveFlow;
88
+ readonly ttlMs?: number;
89
+ } | {
90
+ readonly _tag: "Token";
91
+ readonly authenticate: (token: Value) => Promise<Authentication>;
92
+ readonly providerId: string;
93
+ readonly requiredCapabilities: ReadonlyArray<Capability>;
94
+ readonly token: Value;
95
+ }, {
96
+ readonly _tag: Tag;
97
+ }>) => any; }>(cases: Cases): (value: {
98
+ readonly _tag: "Interactive";
99
+ readonly continuations: ContinuationStore;
100
+ readonly flow: InteractiveFlow;
101
+ readonly ttlMs?: number;
102
+ } | {
103
+ readonly _tag: "Token";
104
+ readonly authenticate: (token: Value) => Promise<Authentication>;
105
+ readonly providerId: string;
106
+ readonly requiredCapabilities: ReadonlyArray<Capability>;
107
+ readonly token: Value;
108
+ }) => import("effect/Unify").Unify<ReturnType<Cases["Interactive" | "Token"]>>;
109
+ <Cases extends { readonly [Tag in "Interactive" | "Token"]: (args: Extract<{
110
+ readonly _tag: "Interactive";
111
+ readonly continuations: ContinuationStore;
112
+ readonly flow: InteractiveFlow;
113
+ readonly ttlMs?: number;
114
+ } | {
115
+ readonly _tag: "Token";
116
+ readonly authenticate: (token: Value) => Promise<Authentication>;
117
+ readonly providerId: string;
118
+ readonly requiredCapabilities: ReadonlyArray<Capability>;
119
+ readonly token: Value;
120
+ }, {
121
+ readonly _tag: Tag;
122
+ }>) => any; }>(value: {
123
+ readonly _tag: "Interactive";
124
+ readonly continuations: ContinuationStore;
125
+ readonly flow: InteractiveFlow;
126
+ readonly ttlMs?: number;
127
+ } | {
128
+ readonly _tag: "Token";
129
+ readonly authenticate: (token: Value) => Promise<Authentication>;
130
+ readonly providerId: string;
131
+ readonly requiredCapabilities: ReadonlyArray<Capability>;
132
+ readonly token: Value;
133
+ }, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Interactive" | "Token"]>>;
134
+ };
135
+ readonly Interactive: Data.TaggedEnum.ConstructorFrom<{
136
+ readonly _tag: "Interactive";
137
+ readonly continuations: ContinuationStore;
138
+ readonly flow: InteractiveFlow;
139
+ readonly ttlMs?: number;
140
+ }, "_tag">;
141
+ readonly Token: Data.TaggedEnum.ConstructorFrom<{
142
+ readonly _tag: "Token";
143
+ readonly authenticate: (token: Value) => Promise<Authentication>;
144
+ readonly providerId: string;
145
+ readonly requiredCapabilities: ReadonlyArray<Capability>;
146
+ readonly token: Value;
147
+ }, "_tag">;
148
+ };
149
+ interface ContinuationStore {
150
+ readonly consume: (id: string, now: Date) => Promise<Continuation | null>;
151
+ readonly put: (continuation: Continuation) => Promise<void>;
152
+ }
153
+ interface InteractiveFlow {
154
+ readonly complete: (payload: Value, callbackUrl: URL) => Promise<Authentication>;
155
+ readonly method: "integration" | "oauth2";
156
+ readonly providerId: string;
157
+ readonly requiredCapabilities: ReadonlyArray<Capability>;
158
+ readonly start: (continuationId: string) => Promise<InteractiveStart>;
159
+ }
160
+ declare const toAsyncContinuations: (store: ContinuationStore$1) => ContinuationStore;
161
+ /** Adapts an Effect-native provider flow to the Promise facade. */
162
+ declare const fromEffectFlow: (flow: InteractiveFlow$1) => InteractiveFlow;
163
+ /** Adapts an Effect-native token method to the Promise facade. */
164
+ declare function fromEffectTokenMethod(method: Extract<Method$1, {
165
+ readonly _tag: "Token";
166
+ }>): Extract<Method, {
167
+ readonly _tag: "Token";
168
+ }>;
169
+ declare function start(input: BaseInput & {
170
+ readonly method: Method;
171
+ readonly repository: Repository;
172
+ }): Promise<StartResult>;
173
+ declare function complete(input: {
174
+ readonly callbackUrl: URL;
175
+ readonly continuationId: string;
176
+ readonly continuations: ContinuationStore;
177
+ readonly flow: InteractiveFlow;
178
+ readonly repository: Repository;
179
+ }): Promise<Aggregate>;
180
+ //#endregion
181
+ export { Source as a, authorization_lifecycle_d_exports as i, Method as n, zone_discovery_d_exports as o, connection_d_exports as r, InteractiveFlow as t };
182
+ //# sourceMappingURL=connection-CEqadXSm.d.mts.map
@@ -0,0 +1,186 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { M as Service, j as Error } from "./dns-record-BLeqo56C.mjs";
3
+ import { _ as StartResult, g as Method$1, h as Error$1, v as complete$1, y as start$1 } from "./authorization-CQSKKMrW.mjs";
4
+ import { i as assertGrant, n as Grant, o as decode$1, r as Schema$1, s as encode, t as AuthorizationError } from "./connection-BXoSrhZs.mjs";
5
+ import { i as webCryptoLayer } from "./canonical-json-CpvqGMcr.mjs";
6
+ import { Data, Effect, Layer } from "effect";
7
+ //#region src/promise/authorization-lifecycle.ts
8
+ var authorization_lifecycle_exports = /* @__PURE__ */ __exportAll({
9
+ Error: () => Error,
10
+ from: () => from,
11
+ layerFrom: () => layerFrom,
12
+ toAsync: () => toAsync
13
+ });
14
+ const failure = (operation, cause) => cause instanceof Error ? cause : new Error({
15
+ category: "storage",
16
+ message: cause instanceof globalThis.Error ? cause.message : String(cause),
17
+ operation,
18
+ retry: "safe"
19
+ });
20
+ const layerFrom = (repository) => Layer.succeed(Service, {
21
+ bind: Effect.fn("AuthorizationLifecycleRepository.bind")((authorizationId, binding) => Effect.tryPromise({
22
+ try: () => repository.bind(authorizationId, binding),
23
+ catch: (cause) => failure("AuthorizationLifecycleRepository.bind", cause)
24
+ })),
25
+ connect: Effect.fn("AuthorizationLifecycleRepository.connect")((aggregate) => Effect.tryPromise({
26
+ try: () => repository.connect(aggregate),
27
+ catch: (cause) => failure("AuthorizationLifecycleRepository.connect", cause)
28
+ })),
29
+ detach: ({ connectionId, revoke }) => Effect.tryPromise({
30
+ try: () => repository.detach({
31
+ connectionId,
32
+ revoke: (aggregate) => Effect.runPromise(revoke(aggregate))
33
+ }),
34
+ catch: (cause) => failure("AuthorizationLifecycleRepository.detach", cause)
35
+ }),
36
+ findByProviderAccount: Effect.fn("AuthorizationLifecycleRepository.findByProviderAccount")((providerId, providerAccountId) => Effect.tryPromise({
37
+ try: () => repository.findByProviderAccount(providerId, providerAccountId),
38
+ catch: (cause) => failure("AuthorizationLifecycleRepository.findByProviderAccount", cause)
39
+ })),
40
+ get: Effect.fn("AuthorizationLifecycleRepository.get")((authorizationId) => Effect.tryPromise({
41
+ try: () => repository.get(authorizationId),
42
+ catch: (cause) => failure("AuthorizationLifecycleRepository.get", cause)
43
+ })),
44
+ getByConnectionId: Effect.fn("AuthorizationLifecycleRepository.getByConnectionId")((connectionId) => Effect.tryPromise({
45
+ try: () => repository.getByConnectionId(connectionId),
46
+ catch: (cause) => failure("AuthorizationLifecycleRepository.getByConnectionId", cause)
47
+ })),
48
+ promoteEvidence: Effect.fn("AuthorizationLifecycleRepository.promoteEvidence")((authorizationId, evidence) => Effect.tryPromise({
49
+ try: () => repository.promoteEvidence(authorizationId, evidence),
50
+ catch: (cause) => failure("AuthorizationLifecycleRepository.promoteEvidence", cause)
51
+ })),
52
+ recover: ({ authorizationId, revoke }) => Effect.tryPromise({
53
+ try: () => repository.recover({
54
+ authorizationId,
55
+ revoke: (aggregate) => Effect.runPromise(revoke(aggregate))
56
+ }),
57
+ catch: (cause) => failure("AuthorizationLifecycleRepository.recover", cause)
58
+ }),
59
+ rotate: Effect.fn("AuthorizationLifecycleRepository.rotate")((authorizationId, credential, expiresAt) => Effect.tryPromise({
60
+ try: () => repository.rotate(authorizationId, credential, expiresAt),
61
+ catch: (cause) => failure("AuthorizationLifecycleRepository.rotate", cause)
62
+ }))
63
+ });
64
+ const toAsync = (repository) => ({
65
+ bind: (authorizationId, binding) => Effect.runPromise(repository.bind(authorizationId, binding)),
66
+ connect: (aggregate) => Effect.runPromise(repository.connect(aggregate)),
67
+ detach: ({ connectionId, revoke }) => Effect.runPromise(repository.detach({
68
+ connectionId,
69
+ revoke: (aggregate) => Effect.tryPromise(() => revoke(aggregate))
70
+ })),
71
+ findByProviderAccount: (providerId, providerAccountId) => Effect.runPromise(repository.findByProviderAccount(providerId, providerAccountId)),
72
+ get: (authorizationId) => Effect.runPromise(repository.get(authorizationId)),
73
+ getByConnectionId: (connectionId) => Effect.runPromise(repository.getByConnectionId(connectionId)),
74
+ promoteEvidence: (authorizationId, evidence) => Effect.runPromise(repository.promoteEvidence(authorizationId, evidence)),
75
+ recover: ({ authorizationId, revoke }) => Effect.runPromise(repository.recover({
76
+ authorizationId,
77
+ revoke: (aggregate) => Effect.tryPromise(() => revoke(aggregate))
78
+ })),
79
+ rotate: (authorizationId, credential, expiresAt) => Effect.runPromise(repository.rotate(authorizationId, credential, expiresAt))
80
+ });
81
+ const from = (repository) => repository;
82
+ //#endregion
83
+ //#region src/promise/connection.ts
84
+ var connection_exports = /* @__PURE__ */ __exportAll({
85
+ AuthorizationError: () => AuthorizationError,
86
+ Error: () => Error$1,
87
+ Grant: () => Grant,
88
+ Method: () => Method,
89
+ Schema: () => Schema$1,
90
+ StartResult: () => StartResult,
91
+ assertGrant: () => assertGrant,
92
+ complete: () => complete,
93
+ decode: () => decode,
94
+ encode: () => encode,
95
+ fromEffectFlow: () => fromEffectFlow,
96
+ fromEffectTokenMethod: () => fromEffectTokenMethod,
97
+ start: () => start,
98
+ toAsyncContinuations: () => toAsyncContinuations
99
+ });
100
+ function decode(input) {
101
+ return Effect.runPromise(decode$1(input));
102
+ }
103
+ const Method = Data.taggedEnum();
104
+ const connectionFailure = (operation, cause) => cause instanceof Error$1 ? cause : new Error$1({
105
+ category: "provider",
106
+ message: cause instanceof globalThis.Error ? cause.message : String(cause),
107
+ operation,
108
+ retry: "unknown"
109
+ });
110
+ const effectMethod = (method) => method._tag === "Interactive" ? Method$1.Interactive({
111
+ continuations: effectContinuations(method.continuations),
112
+ flow: effectFlow(method.flow),
113
+ ...method.ttlMs === void 0 ? {} : { ttlMs: method.ttlMs }
114
+ }) : Method$1.Token({
115
+ authenticate: (token) => Effect.tryPromise({
116
+ try: () => method.authenticate(token),
117
+ catch: (cause) => connectionFailure("Connection.start", cause)
118
+ }),
119
+ providerId: method.providerId,
120
+ requiredCapabilities: method.requiredCapabilities,
121
+ token: method.token
122
+ });
123
+ const effectContinuations = (store) => ({
124
+ consume: (id, now) => Effect.tryPromise({
125
+ try: () => store.consume(id, now),
126
+ catch: (cause) => connectionFailure("ConnectionContinuations.consume", cause)
127
+ }),
128
+ put: (continuation) => Effect.tryPromise({
129
+ try: () => store.put(continuation),
130
+ catch: (cause) => connectionFailure("ConnectionContinuations.put", cause)
131
+ })
132
+ });
133
+ const toAsyncContinuations = (store) => ({
134
+ consume: (id, now) => Effect.runPromise(store.consume(id, now)),
135
+ put: (continuation) => Effect.runPromise(store.put(continuation))
136
+ });
137
+ const effectFlow = (flow) => ({
138
+ complete: (payload, callbackUrl) => Effect.tryPromise({
139
+ try: () => flow.complete(payload, callbackUrl),
140
+ catch: (cause) => connectionFailure("Connection.complete", cause)
141
+ }),
142
+ method: flow.method,
143
+ providerId: flow.providerId,
144
+ requiredCapabilities: flow.requiredCapabilities,
145
+ start: (continuationId) => Effect.tryPromise({
146
+ try: () => flow.start(continuationId),
147
+ catch: (cause) => connectionFailure("Connection.start", cause)
148
+ })
149
+ });
150
+ /** Adapts an Effect-native provider flow to the Promise facade. */
151
+ const fromEffectFlow = (flow) => ({
152
+ complete: (payload, callbackUrl) => Effect.runPromise(flow.complete(payload, callbackUrl)),
153
+ method: flow.method,
154
+ providerId: flow.providerId,
155
+ requiredCapabilities: flow.requiredCapabilities,
156
+ start: (continuationId) => Effect.runPromise(flow.start(continuationId).pipe(Effect.provide(webCryptoLayer)))
157
+ });
158
+ /** Adapts an Effect-native token method to the Promise facade. */
159
+ function fromEffectTokenMethod(method) {
160
+ return Method.Token({
161
+ authenticate: (token) => Effect.runPromise(method.authenticate(token)),
162
+ providerId: method.providerId,
163
+ requiredCapabilities: method.requiredCapabilities,
164
+ token: method.token
165
+ });
166
+ }
167
+ async function start(input) {
168
+ return Effect.runPromise(start$1({
169
+ authorizedById: input.authorizedById,
170
+ grant: input.grant,
171
+ method: effectMethod(input.method),
172
+ ownerId: input.ownerId
173
+ }).pipe(Effect.provide(Layer.merge(layerFrom(input.repository), webCryptoLayer))));
174
+ }
175
+ async function complete(input) {
176
+ return Effect.runPromise(complete$1({
177
+ callbackUrl: input.callbackUrl,
178
+ continuationId: input.continuationId,
179
+ continuations: effectContinuations(input.continuations),
180
+ flow: effectFlow(input.flow)
181
+ }).pipe(Effect.provide(Layer.merge(layerFrom(input.repository), webCryptoLayer))));
182
+ }
183
+ //#endregion
184
+ export { authorization_lifecycle_exports as i, fromEffectFlow as n, fromEffectTokenMethod as r, connection_exports as t };
185
+
186
+ //# sourceMappingURL=connection-X3rZhrBZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-X3rZhrBZ.mjs","names":["Lifecycle.Error","Lifecycle.Service","Connection.decode","Connect.Error","Connect.start","LifecycleRepository.layerFrom","Connect.complete"],"sources":["../src/promise/authorization-lifecycle.ts","../src/promise/connection.ts"],"sourcesContent":["import { Effect, Layer } from \"effect\";\n\nimport type * as ProviderAuthorization from \"../auth/authorization.ts\";\nimport type * as Connection from \"../auth/connection.ts\";\nimport * as Lifecycle from \"../auth/lifecycle-repository.ts\";\n\nexport interface Repository {\n readonly bind: (\n authorizationId: string,\n binding: Connection.Connection,\n ) => Promise<Lifecycle.Aggregate>;\n readonly connect: (aggregate: Lifecycle.Aggregate) => Promise<Lifecycle.Aggregate>;\n readonly detach: (input: {\n readonly connectionId: string;\n readonly revoke: (aggregate: Lifecycle.Aggregate) => Promise<void>;\n }) => Promise<Lifecycle.DetachResult>;\n readonly findByProviderAccount: (\n providerId: string,\n providerAccountId: string,\n ) => Promise<Lifecycle.Aggregate | null>;\n readonly get: (authorizationId: string) => Promise<Lifecycle.Aggregate | null>;\n readonly getByConnectionId: (connectionId: string) => Promise<Lifecycle.Aggregate | null>;\n readonly promoteEvidence: (\n authorizationId: string,\n evidence: ReadonlyArray<ProviderAuthorization.CapabilityEvidence>,\n ) => Promise<Lifecycle.Aggregate>;\n readonly recover: (input: {\n readonly authorizationId: string;\n readonly revoke: (aggregate: Lifecycle.Aggregate) => Promise<void>;\n }) => Promise<Lifecycle.DetachResult>;\n readonly rotate: (\n authorizationId: string,\n credential: Connection.StoredCredential,\n expiresAt: Date | null,\n ) => Promise<Lifecycle.Aggregate>;\n}\n\nconst failure = (operation: string, cause: unknown): Lifecycle.Error =>\n cause instanceof Lifecycle.Error\n ? cause\n : new Lifecycle.Error({\n category: \"storage\",\n message: cause instanceof globalThis.Error ? cause.message : String(cause),\n operation,\n retry: \"safe\",\n });\n\nexport const layerFrom = (repository: Repository): Layer.Layer<Lifecycle.Service> =>\n Layer.succeed(Lifecycle.Service, {\n bind: Effect.fn(\"AuthorizationLifecycleRepository.bind\")((authorizationId, binding) =>\n Effect.tryPromise({\n try: () => repository.bind(authorizationId, binding),\n catch: (cause) => failure(\"AuthorizationLifecycleRepository.bind\", cause),\n }),\n ),\n connect: Effect.fn(\"AuthorizationLifecycleRepository.connect\")((aggregate) =>\n Effect.tryPromise({\n try: () => repository.connect(aggregate),\n catch: (cause) => failure(\"AuthorizationLifecycleRepository.connect\", cause),\n }),\n ),\n detach: ({ connectionId, revoke }) =>\n Effect.tryPromise({\n try: () =>\n repository.detach({\n connectionId,\n revoke: (aggregate) => Effect.runPromise(revoke(aggregate)),\n }),\n catch: (cause) => failure(\"AuthorizationLifecycleRepository.detach\", cause),\n }),\n findByProviderAccount: Effect.fn(\"AuthorizationLifecycleRepository.findByProviderAccount\")(\n (providerId, providerAccountId) =>\n Effect.tryPromise({\n try: () => repository.findByProviderAccount(providerId, providerAccountId),\n catch: (cause) =>\n failure(\"AuthorizationLifecycleRepository.findByProviderAccount\", cause),\n }),\n ),\n get: Effect.fn(\"AuthorizationLifecycleRepository.get\")((authorizationId) =>\n Effect.tryPromise({\n try: () => repository.get(authorizationId),\n catch: (cause) => failure(\"AuthorizationLifecycleRepository.get\", cause),\n }),\n ),\n getByConnectionId: Effect.fn(\"AuthorizationLifecycleRepository.getByConnectionId\")(\n (connectionId) =>\n Effect.tryPromise({\n try: () => repository.getByConnectionId(connectionId),\n catch: (cause) => failure(\"AuthorizationLifecycleRepository.getByConnectionId\", cause),\n }),\n ),\n promoteEvidence: Effect.fn(\"AuthorizationLifecycleRepository.promoteEvidence\")(\n (authorizationId, evidence) =>\n Effect.tryPromise({\n try: () => repository.promoteEvidence(authorizationId, evidence),\n catch: (cause) => failure(\"AuthorizationLifecycleRepository.promoteEvidence\", cause),\n }),\n ),\n recover: ({ authorizationId, revoke }) =>\n Effect.tryPromise({\n try: () =>\n repository.recover({\n authorizationId,\n revoke: (aggregate) => Effect.runPromise(revoke(aggregate)),\n }),\n catch: (cause) => failure(\"AuthorizationLifecycleRepository.recover\", cause),\n }),\n rotate: Effect.fn(\"AuthorizationLifecycleRepository.rotate\")(\n (authorizationId, credential, expiresAt) =>\n Effect.tryPromise({\n try: () => repository.rotate(authorizationId, credential, expiresAt),\n catch: (cause) => failure(\"AuthorizationLifecycleRepository.rotate\", cause),\n }),\n ),\n });\n\nexport const toAsync = (repository: Lifecycle.Interface): Repository => ({\n bind: (authorizationId, binding) => Effect.runPromise(repository.bind(authorizationId, binding)),\n connect: (aggregate) => Effect.runPromise(repository.connect(aggregate)),\n detach: ({ connectionId, revoke }) =>\n Effect.runPromise(\n repository.detach({\n connectionId,\n revoke: (aggregate) => Effect.tryPromise(() => revoke(aggregate)),\n }),\n ),\n findByProviderAccount: (providerId, providerAccountId) =>\n Effect.runPromise(repository.findByProviderAccount(providerId, providerAccountId)),\n get: (authorizationId) => Effect.runPromise(repository.get(authorizationId)),\n getByConnectionId: (connectionId) =>\n Effect.runPromise(repository.getByConnectionId(connectionId)),\n promoteEvidence: (authorizationId, evidence) =>\n Effect.runPromise(repository.promoteEvidence(authorizationId, evidence)),\n recover: ({ authorizationId, revoke }) =>\n Effect.runPromise(\n repository.recover({\n authorizationId,\n revoke: (aggregate) => Effect.tryPromise(() => revoke(aggregate)),\n }),\n ),\n rotate: (authorizationId, credential, expiresAt) =>\n Effect.runPromise(repository.rotate(authorizationId, credential, expiresAt)),\n});\n\nexport const from = (repository: Repository): Repository => repository;\n\nexport { Error } from \"../auth/lifecycle-repository.ts\";\nexport type { Aggregate, DetachResult } from \"../auth/lifecycle-repository.ts\";\n","import { Data, Effect, Layer } from \"effect\";\n\nimport * as Connection from \"../auth/connection.ts\";\nimport * as Connect from \"../auth/connect.ts\";\nimport type * as Repository from \"./authorization-lifecycle.ts\";\nimport type * as ProviderAuthorization from \"../auth/authorization.ts\";\nimport { webCryptoLayer } from \"../plan/canonical-json.ts\";\nimport * as LifecycleRepository from \"./authorization-lifecycle.ts\";\nimport type * as Secret from \"../auth/secret.ts\";\n\nexport { assertGrant, AuthorizationError, encode, Grant, Schema } from \"../auth/connection.ts\";\nexport type { Connection, OAuthContinuation, StoredCredential } from \"../auth/connection.ts\";\n\nexport function decode(input: unknown): Promise<Connection.Connection> {\n return Effect.runPromise(Connection.decode(input));\n}\n\nexport type Method = Data.TaggedEnum<{\n Interactive: {\n readonly continuations: ContinuationStore;\n readonly flow: InteractiveFlow;\n readonly ttlMs?: number;\n };\n Token: {\n readonly authenticate: (token: Secret.Value) => Promise<Connect.Authentication>;\n readonly providerId: string;\n readonly requiredCapabilities: ReadonlyArray<ProviderAuthorization.Capability>;\n readonly token: Secret.Value;\n };\n}>;\nexport const Method = Data.taggedEnum<Method>();\n\nexport interface ContinuationStore {\n readonly consume: (id: string, now: Date) => Promise<Connect.Continuation | null>;\n readonly put: (continuation: Connect.Continuation) => Promise<void>;\n}\n\nexport interface InteractiveFlow {\n readonly complete: (payload: Secret.Value, callbackUrl: URL) => Promise<Connect.Authentication>;\n readonly method: \"integration\" | \"oauth2\";\n readonly providerId: string;\n readonly requiredCapabilities: ReadonlyArray<ProviderAuthorization.Capability>;\n readonly start: (continuationId: string) => Promise<Connect.InteractiveStart>;\n}\n\nconst connectionFailure = (operation: string, cause: unknown): Connect.Error =>\n cause instanceof Connect.Error\n ? cause\n : new Connect.Error({\n category: \"provider\",\n message: cause instanceof globalThis.Error ? cause.message : String(cause),\n operation,\n retry: \"unknown\",\n });\n\nconst effectMethod = (method: Method): Connect.Method =>\n method._tag === \"Interactive\"\n ? Connect.Method.Interactive({\n continuations: effectContinuations(method.continuations),\n flow: effectFlow(method.flow),\n ...(method.ttlMs === undefined ? {} : { ttlMs: method.ttlMs }),\n })\n : Connect.Method.Token({\n authenticate: (token) =>\n Effect.tryPromise({\n try: () => method.authenticate(token),\n catch: (cause) => connectionFailure(\"Connection.start\", cause),\n }),\n providerId: method.providerId,\n requiredCapabilities: method.requiredCapabilities,\n token: method.token,\n });\n\nconst effectContinuations = (store: ContinuationStore): Connect.ContinuationStore => ({\n consume: (id, now) =>\n Effect.tryPromise({\n try: () => store.consume(id, now),\n catch: (cause) => connectionFailure(\"ConnectionContinuations.consume\", cause),\n }),\n put: (continuation) =>\n Effect.tryPromise({\n try: () => store.put(continuation),\n catch: (cause) => connectionFailure(\"ConnectionContinuations.put\", cause),\n }),\n});\n\nexport const toAsyncContinuations = (store: Connect.ContinuationStore): ContinuationStore => ({\n consume: (id, now) => Effect.runPromise(store.consume(id, now)),\n put: (continuation) => Effect.runPromise(store.put(continuation)),\n});\n\nconst effectFlow = (flow: InteractiveFlow): Connect.InteractiveFlow => ({\n complete: (payload, callbackUrl) =>\n Effect.tryPromise({\n try: () => flow.complete(payload, callbackUrl),\n catch: (cause) => connectionFailure(\"Connection.complete\", cause),\n }),\n method: flow.method,\n providerId: flow.providerId,\n requiredCapabilities: flow.requiredCapabilities,\n start: (continuationId) =>\n Effect.tryPromise({\n try: () => flow.start(continuationId),\n catch: (cause) => connectionFailure(\"Connection.start\", cause),\n }),\n});\n\n/** Adapts an Effect-native provider flow to the Promise facade. */\nexport const fromEffectFlow = (flow: Connect.InteractiveFlow): InteractiveFlow => ({\n complete: (payload, callbackUrl) => Effect.runPromise(flow.complete(payload, callbackUrl)),\n method: flow.method,\n providerId: flow.providerId,\n requiredCapabilities: flow.requiredCapabilities,\n start: (continuationId) =>\n Effect.runPromise(flow.start(continuationId).pipe(Effect.provide(webCryptoLayer))),\n});\n\n/** Adapts an Effect-native token method to the Promise facade. */\nexport function fromEffectTokenMethod(\n method: Extract<Connect.Method, { readonly _tag: \"Token\" }>,\n): Extract<Method, { readonly _tag: \"Token\" }> {\n return Method.Token({\n authenticate: (token) => Effect.runPromise(method.authenticate(token)),\n providerId: method.providerId,\n requiredCapabilities: method.requiredCapabilities,\n token: method.token,\n });\n}\n\nexport async function start(\n input: Connect.BaseInput & {\n readonly method: Method;\n readonly repository: Repository.Repository;\n },\n): Promise<Connect.StartResult> {\n return Effect.runPromise(\n Connect.start({\n authorizedById: input.authorizedById,\n grant: input.grant,\n method: effectMethod(input.method),\n ownerId: input.ownerId,\n }).pipe(\n Effect.provide(Layer.merge(LifecycleRepository.layerFrom(input.repository), webCryptoLayer)),\n ),\n );\n}\n\nexport async function complete(input: {\n readonly callbackUrl: URL;\n readonly continuationId: string;\n readonly continuations: ContinuationStore;\n readonly flow: InteractiveFlow;\n readonly repository: Repository.Repository;\n}): Promise<Repository.Aggregate> {\n return Effect.runPromise(\n Connect.complete({\n callbackUrl: input.callbackUrl,\n continuationId: input.continuationId,\n continuations: effectContinuations(input.continuations),\n flow: effectFlow(input.flow),\n }).pipe(\n Effect.provide(Layer.merge(LifecycleRepository.layerFrom(input.repository), webCryptoLayer)),\n ),\n );\n}\n\nexport { Error, StartResult } from \"../auth/connect.ts\";\nexport type { Authentication, ConnectionStartResult } from \"../auth/connection-api.ts\";\n"],"mappings":";;;;;;;;;;;;;AAqCA,MAAM,WAAW,WAAmB,UAClC,iBAAiBA,QACb,QACA,IAAIA,MAAgB;CAClB,UAAU;CACV,SAAS,iBAAiB,WAAW,QAAQ,MAAM,UAAU,OAAO,KAAK;CACzE;CACA,OAAO;A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ACb,YAAY,KAAK;CACjB,sBAAsB,KAAK;CAC3B,QAAQ,mBACN,OAAO,WAAW;EAChB,WAAW,KAAK,MAAM,cAAc;EACpC,QAAQ,UAAU,kBAAkB,oBAAoB,KAAK;CAC/D,CAAC;AACL;;AAGA,MAAa,kBAAkB,UAAoD;CACjF,WAAW,SAAS,gBAAgB,OAAO,WAAW,KAAK,SAAS,SAAS,WAAW,CAAC;CACzF,QAAQ,KAAK;CACb,YAAY,KAAK;CACjB,sBAAsB,KAAK;CAC3B,QAAQ,mBACN,OAAO,WAAW,KAAK,MAAM,cAAc,CAAC,CAAC,KAAK,OAAO,QAAQ,cAAc,CAAC,CAAC;AACrF;;AAGA,SAAgB,sBACd,QAC6C;CAC7C,OAAO,OAAO,MAAM;EAClB,eAAe,UAAU,OAAO,WAAW,OAAO,aAAa,KAAK,CAAC;EACrE,YAAY,OAAO;EACnB,sBAAsB,OAAO;EAC7B,OAAO,OAAO;CAChB,CAAC;AACH;AAEA,eAAsB,MACpB,OAI8B;CAC9B,OAAO,OAAO,WACZC,QAAc;EACZ,gBAAgB,MAAM;EACtB,OAAO,MAAM;EACb,QAAQ,aAAa,MAAM,MAAM;EACjC,SAAS,MAAM;CACjB,CAAC,CAAC,CAAC,KACD,OAAO,QAAQ,MAAM,MAAMC,UAA8B,MAAM,UAAU,GAAG,cAAc,CAAC,CAC7F,CACF;AACF;AAEA,eAAsB,SAAS,OAMG;CAChC,OAAO,OAAO,WACZC,WAAiB;EACf,aAAa,MAAM;EACnB,gBAAgB,MAAM;EACtB,eAAe,oBAAoB,MAAM,aAAa;EACtD,MAAM,WAAW,MAAM,IAAI;CAC7B,CAAC,CAAC,CAAC,KACD,OAAO,QAAQ,MAAM,MAAMD,UAA8B,MAAM,UAAU,GAAG,cAAc,CAAC,CAC7F,CACF;AACF"}
@@ -0,0 +1,7 @@
1
+ import { A as Connection, F as assertGrant, I as authorizationError, L as decode, N as Schema, P as StoredCredential, R as encode, _ as StartResult, a as Authentication, c as CompleteInput, d as Error, f as Failure, g as Requirements, h as Method, j as Grant, k as AuthorizationError, l as Continuation, m as InteractiveStart, o as AuthenticationFailure, p as InteractiveFlow, s as BaseInput, u as ContinuationStore, v as complete, y as start, z as validate } from "./zone-discovery-BA5I24vu.mjs";
2
+ declare namespace connection_api_d_exports {
3
+ export { Authentication, AuthenticationFailure, AuthorizationError, BaseInput, CompleteInput, Connection, Method as ConnectionMethod, StartResult as ConnectionStartResult, Continuation, ContinuationStore, Error, Failure, Grant, InteractiveFlow, InteractiveStart, Method, Requirements, Schema, StartResult, StoredCredential, assertGrant, authorizationError, complete, decode, encode, start, validate };
4
+ }
5
+ //#endregion
6
+ export { connection_api_d_exports as t };
7
+ //# sourceMappingURL=connection-api-DftK7eHo.d.mts.map
@@ -1,5 +1,23 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
2
  import { Context, Effect, Layer, Schema, SchemaIssue, SchemaTransformation } from "effect";
3
+ //#region src/auth/lifecycle-repository.ts
4
+ var lifecycle_repository_exports = /* @__PURE__ */ __exportAll({
5
+ Error: () => Error$3,
6
+ Service: () => Service$1
7
+ });
8
+ var Error$3 = class extends Schema.TaggedError()("LifecycleRepositoryError", {
9
+ category: Schema.Literal("storage"),
10
+ message: Schema.String,
11
+ operation: Schema.String,
12
+ retry: Schema.Literals([
13
+ "never",
14
+ "after-user-action",
15
+ "safe",
16
+ "unknown"
17
+ ])
18
+ }) {};
19
+ var Service$1 = class extends Context.Service()("@domainkit/AuthorizationLifecycleRepository") {};
20
+ //#endregion
3
21
  //#region src/invalid-input.ts
4
22
  var invalid_input_exports = /* @__PURE__ */ __exportAll({ Error: () => Error$2 });
5
23
  var Error$2 = class extends Schema.TaggedError()("InvalidInputError", { message: Schema.String }) {};
@@ -42,6 +60,7 @@ var provider_exports = /* @__PURE__ */ __exportAll({
42
60
  Error: () => Error$1,
43
61
  ErrorReason: () => ErrorReason,
44
62
  Service: () => Service,
63
+ fromAsync: () => fromAsync,
45
64
  layerFromAsync: () => layerFromAsync,
46
65
  toAsync: () => toAsync
47
66
  });
@@ -67,7 +86,7 @@ var Error$1 = class extends Schema.TaggedError()("ProviderError", {
67
86
  status: Schema.optionalKey(Schema.Number)
68
87
  }) {};
69
88
  var Service = class extends Context.Service()("@domainkit/DnsProvider") {};
70
- const layerFromAsync = (provider) => Layer.succeed(Service, {
89
+ const fromAsync = (provider) => Service.of({
71
90
  id: provider.id,
72
91
  createRecord: Effect.fn("DnsProvider.createRecord")((zone, record) => Effect.tryPromise({
73
92
  try: () => provider.createRecord(zone, record),
@@ -86,6 +105,7 @@ const layerFromAsync = (provider) => Layer.succeed(Service, {
86
105
  catch: (cause) => failure(provider, "listRecords", cause)
87
106
  }))
88
107
  });
108
+ const layerFromAsync = (provider) => Layer.succeed(Service, fromAsync(provider));
89
109
  const toAsync = (provider) => ({
90
110
  id: provider.id,
91
111
  createRecord: (zone, record) => Effect.runPromise(provider.createRecord(zone, record)),
@@ -264,6 +284,6 @@ function isIpv6(value) {
264
284
  }
265
285
  }
266
286
  //#endregion
267
- export { toAsync as C, parse$1 as D, domain_name_exports as E, Error$2 as O, provider_exports as S, decode$1 as T, equals as _, Mx as a, Service as b, Opaque as c, Srv as d, Txt as f, dns_record_exports as g, decode as h, Cname as i, invalid_input_exports as k, RequirementMetadata as l, data as m, Aaaa as n, Ns as o, Type as p, Caa as r, Observed as s, A as t, Schema$1 as u, parse as v, Schema$2 as w, layerFromAsync as x, Error$1 as y };
287
+ export { invalid_input_exports as A, provider_exports as C, domain_name_exports as D, decode$1 as E, Service$1 as M, lifecycle_repository_exports as N, parse$1 as O, layerFromAsync as S, Schema$2 as T, equals as _, Mx as a, Service as b, Opaque as c, Srv as d, Txt as f, dns_record_exports as g, decode as h, Cname as i, Error$3 as j, Error$2 as k, RequirementMetadata as l, data as m, Aaaa as n, Ns as o, Type as p, Caa as r, Observed as s, A as t, Schema$1 as u, parse as v, toAsync as w, fromAsync as x, Error$1 as y };
268
288
 
269
- //# sourceMappingURL=dns-record-C_KwGPLf.mjs.map
289
+ //# sourceMappingURL=dns-record-BLeqo56C.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dns-record-BLeqo56C.mjs","names":["Error","Service","Error","Type","S","Schema","decode","InvalidInputError","parse","Error","S","DomainName.Schema","Schema","InvalidInputError"],"sources":["../src/auth/lifecycle-repository.ts","../src/invalid-input.ts","../src/domain/domain-name.ts","../src/provider/provider.ts","../src/domain/dns-record.ts"],"sourcesContent":["import { Context, Effect, Schema } from \"effect\";\n\nimport type * as ProviderAuthorization from \"./authorization.ts\";\nimport type * as Connection from \"./connection.ts\";\n\nexport interface Aggregate {\n readonly authorization: ProviderAuthorization.ProviderAuthorization;\n readonly bindings: ReadonlyArray<Connection.Connection>;\n readonly credential: Connection.StoredCredential;\n}\n\nexport interface DetachResult {\n readonly authorizationId: string;\n readonly remainingBindings: number;\n readonly revokedAuthorization: boolean;\n}\n\nexport class Error extends Schema.TaggedError<Error>()(\"LifecycleRepositoryError\", {\n category: Schema.Literal(\"storage\"),\n message: Schema.String,\n operation: Schema.String,\n retry: Schema.Literals([\"never\", \"after-user-action\", \"safe\", \"unknown\"]),\n}) {}\n\nexport interface Interface {\n readonly bind: (\n authorizationId: string,\n binding: Connection.Connection,\n ) => Effect.Effect<Aggregate, Error>;\n readonly connect: (aggregate: Aggregate) => Effect.Effect<Aggregate, Error>;\n readonly detach: <E>(input: {\n readonly connectionId: string;\n readonly revoke: (aggregate: Aggregate) => Effect.Effect<void, E>;\n }) => Effect.Effect<DetachResult, Error | E>;\n readonly findByProviderAccount: (\n providerId: string,\n providerAccountId: string,\n ) => Effect.Effect<Aggregate | null, Error>;\n readonly get: (authorizationId: string) => Effect.Effect<Aggregate | null, Error>;\n readonly getByConnectionId: (connectionId: string) => Effect.Effect<Aggregate | null, Error>;\n readonly promoteEvidence: (\n authorizationId: string,\n evidence: ReadonlyArray<ProviderAuthorization.CapabilityEvidence>,\n ) => Effect.Effect<Aggregate, Error>;\n readonly recover: <E>(input: {\n readonly authorizationId: string;\n readonly revoke: (aggregate: Aggregate) => Effect.Effect<void, E>;\n }) => Effect.Effect<DetachResult, Error | E>;\n readonly rotate: (\n authorizationId: string,\n credential: Connection.StoredCredential,\n expiresAt: Date | null,\n ) => Effect.Effect<Aggregate, Error>;\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\n \"@domainkit/AuthorizationLifecycleRepository\",\n) {}\n","import { Schema } from \"effect\";\n\nexport class Error extends Schema.TaggedError<Error>()(\"InvalidInputError\", {\n message: Schema.String,\n}) {}\n","import { Effect, Schema as S, SchemaIssue, SchemaTransformation } from \"effect\";\n\nimport { Error as InvalidInputError } from \"../invalid-input.ts\";\n\nconst labelPattern = /^[a-z0-9_](?:[a-z0-9_-]{0,61}[a-z0-9_])?$/;\n\nconst Type = S.String.check(\n S.makeFilter<string>(\n (value) =>\n value.length <= 253 &&\n value.includes(\".\") &&\n value.split(\".\").every((label) => labelPattern.test(label))\n ? undefined\n : \"Expected a fully qualified DNS name\",\n { identifier: \"DomainName\" },\n ),\n).pipe(S.brand(\"DomainName\"));\n\n/** A lower-case, fully qualified DNS name without a trailing dot. */\nexport type DomainName = typeof Type.Type;\n\n/** Decodes user and wire strings into canonical domain names. */\nexport const Schema = S.String.pipe(\n S.decodeTo(\n Type,\n SchemaTransformation.transformOrFail({\n decode: (input, options) =>\n Effect.try({\n try: () => normalize(input),\n catch: (cause) =>\n new SchemaIssue.InvalidValue(\n { message: cause instanceof Error ? cause.message : String(cause) },\n input,\n options,\n ),\n }),\n encode: (domain) => Effect.succeed(domain),\n }),\n ),\n);\n\nexport const decode = Effect.fn(\"DomainName.decode\")((input: unknown) =>\n S.decodeUnknownEffect(Schema)(input).pipe(\n Effect.mapError((cause) => new InvalidInputError({ message: cause.message })),\n ),\n);\n\nexport function parse(input: unknown): DomainName {\n try {\n return S.decodeUnknownSync(Schema)(input);\n } catch (cause) {\n throw new InvalidInputError({\n message: cause instanceof Error ? cause.message : String(cause),\n });\n }\n}\n\nfunction normalize(input: string): string {\n const labels = input\n .trim()\n .replace(/\\.+$/, \"\")\n .split(\".\")\n .map((label) => {\n if (label.includes(\"_\") || [...label].every((character) => character.charCodeAt(0) <= 127)) {\n return label.toLowerCase();\n }\n const hostname = new URL(`http://${label}.example`).hostname;\n const normalized = hostname.split(\".\")[0];\n if (normalized === undefined) throw new Error(\"Domain label could not be normalized\");\n return normalized.toLowerCase();\n });\n return labels.join(\".\");\n}\n","import { Context, Effect, Layer, Schema } from \"effect\";\n\nimport type * as DomainName from \"../domain/domain-name.ts\";\nimport type * as DnsRecord from \"../domain/dns-record.ts\";\n\nexport interface CreateResult {\n readonly providerRecordId: string | null;\n}\n\nexport const ErrorReason = Schema.Literals([\n \"authentication\",\n \"authorization\",\n \"conflict\",\n \"not_found\",\n \"rate_limit\",\n \"request\",\n \"response\",\n \"transport\",\n \"unsupported\",\n]);\nexport type ErrorReason = typeof ErrorReason.Type;\n\nexport class Error extends Schema.TaggedError<Error>()(\"ProviderError\", {\n cause: Schema.optionalKey(Schema.Unknown),\n code: Schema.optionalKey(Schema.Union([Schema.Number, Schema.String])),\n message: Schema.String,\n operation: Schema.String,\n providerId: Schema.String,\n reason: Schema.optionalKey(ErrorReason),\n retryAfterMs: Schema.optionalKey(Schema.Number),\n status: Schema.optionalKey(Schema.Number),\n}) {}\n\n/** The provider capability used by DNS planning, application, and verification. */\nexport interface Interface {\n readonly id: string;\n readonly createRecord: (\n zone: DomainName.DomainName,\n record: DnsRecord.DnsRecord,\n ) => Effect.Effect<CreateResult, Error>;\n readonly deleteRecord: (\n zone: DomainName.DomainName,\n providerRecordId: string,\n ) => Effect.Effect<void, Error>;\n readonly getRecord: (\n zone: DomainName.DomainName,\n providerRecordId: string,\n ) => Effect.Effect<DnsRecord.Observed | null, Error>;\n readonly listRecords: (\n zone: DomainName.DomainName,\n ) => Effect.Effect<ReadonlyArray<DnsRecord.Observed>, Error>;\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@domainkit/DnsProvider\") {}\n\n/** Minimal Promise-shaped provider contract for hosts that do not use Effect directly. */\nexport interface AsyncInterface {\n readonly id: string;\n readonly createRecord: (\n zone: DomainName.DomainName,\n record: DnsRecord.DnsRecord,\n ) => Promise<CreateResult>;\n readonly deleteRecord: (zone: DomainName.DomainName, providerRecordId: string) => Promise<void>;\n readonly getRecord: (\n zone: DomainName.DomainName,\n providerRecordId: string,\n ) => Promise<DnsRecord.Observed | null>;\n readonly listRecords: (zone: DomainName.DomainName) => Promise<ReadonlyArray<DnsRecord.Observed>>;\n}\n\nexport const fromAsync = (provider: AsyncInterface): Interface =>\n Service.of({\n id: provider.id,\n createRecord: Effect.fn(\"DnsProvider.createRecord\")((zone, record) =>\n Effect.tryPromise({\n try: () => provider.createRecord(zone, record),\n catch: (cause) => failure(provider, \"createRecord\", cause),\n }),\n ),\n deleteRecord: Effect.fn(\"DnsProvider.deleteRecord\")((zone, providerRecordId) =>\n Effect.tryPromise({\n try: () => provider.deleteRecord(zone, providerRecordId),\n catch: (cause) => failure(provider, \"deleteRecord\", cause),\n }),\n ),\n getRecord: Effect.fn(\"DnsProvider.getRecord\")((zone, providerRecordId) =>\n Effect.tryPromise({\n try: () => provider.getRecord(zone, providerRecordId),\n catch: (cause) => failure(provider, \"getRecord\", cause),\n }),\n ),\n listRecords: Effect.fn(\"DnsProvider.listRecords\")((zone) =>\n Effect.tryPromise({\n try: () => provider.listRecords(zone),\n catch: (cause) => failure(provider, \"listRecords\", cause),\n }),\n ),\n });\n\nexport const layerFromAsync = (provider: AsyncInterface): Layer.Layer<Service> =>\n Layer.succeed(Service, fromAsync(provider));\n\nexport const toAsync = (provider: Interface): AsyncInterface => ({\n id: provider.id,\n createRecord: (zone, record) => Effect.runPromise(provider.createRecord(zone, record)),\n deleteRecord: (zone, providerRecordId) =>\n Effect.runPromise(provider.deleteRecord(zone, providerRecordId)),\n getRecord: (zone, providerRecordId) =>\n Effect.runPromise(provider.getRecord(zone, providerRecordId)),\n listRecords: (zone) => Effect.runPromise(provider.listRecords(zone)),\n});\n\nfunction failure(provider: AsyncInterface, operation: string, cause: unknown): Error {\n return cause instanceof Error\n ? cause\n : new Error({\n cause,\n message: cause instanceof globalThis.Error ? cause.message : String(cause),\n operation,\n providerId: provider.id,\n });\n}\n","import { Effect, Schema as S } from \"effect\";\n\nimport { Error as InvalidInputError } from \"../invalid-input.ts\";\nimport * as DomainName from \"./domain-name.ts\";\n\nexport const Type = S.Literals([\"A\", \"AAAA\", \"CNAME\", \"TXT\", \"MX\", \"CAA\", \"NS\", \"SRV\"]);\nexport type Type = typeof Type.Type;\n\nexport const RequirementMetadata = S.Struct({\n ownership: S.String.check(S.isMinLength(1)),\n provenance: S.String.check(S.isMinLength(1)),\n purpose: S.String.check(S.isMinLength(1)),\n});\nexport interface RequirementMetadata extends S.Schema.Type<typeof RequirementMetadata> {}\n\nconst CommonFields = {\n metadata: RequirementMetadata,\n name: DomainName.Schema,\n policy: S.Literals([\"exclusive\", \"append\"]),\n ttl: S.NullOr(S.Int.check(S.isBetween({ minimum: 60, maximum: 2_147_483_647 }))),\n};\n\nconst ExclusiveCommonFields = { ...CommonFields, policy: S.Literal(\"exclusive\") };\nconst Address = S.String.check(\n S.makeFilter((value) => (isIpv4(value) ? undefined : \"Expected an IPv4 address\")),\n);\nconst Ipv6Address = S.String.check(\n S.makeFilter((value) => (isIpv6(value) ? undefined : \"Expected an IPv6 address\")),\n);\nconst Port = S.Int.check(S.isBetween({ minimum: 0, maximum: 65_535 }));\nconst Priority = S.Int.check(S.isBetween({ minimum: 0, maximum: 65_535 }));\n\nexport const Schema = S.TaggedUnion({\n A: { ...CommonFields, address: Address },\n AAAA: { ...CommonFields, address: Ipv6Address },\n CNAME: { ...ExclusiveCommonFields, target: DomainName.Schema },\n TXT: { ...CommonFields, value: S.String.check(S.isMinLength(1)) },\n MX: { ...CommonFields, exchange: DomainName.Schema, priority: Priority },\n CAA: {\n ...CommonFields,\n flags: S.Int.check(S.isBetween({ minimum: 0, maximum: 255 })),\n tag: S.Literals([\"issue\", \"issuewild\", \"iodef\"]),\n value: S.String.check(S.isMinLength(1)),\n },\n NS: { ...CommonFields, target: DomainName.Schema },\n SRV: {\n ...CommonFields,\n port: Port,\n priority: Priority,\n target: DomainName.Schema,\n weight: Priority,\n },\n});\nexport const {\n A,\n AAAA: Aaaa,\n CAA: Caa,\n CNAME: Cname,\n MX: Mx,\n NS: Ns,\n SRV: Srv,\n TXT: Txt,\n} = Schema.cases;\nexport type DnsRecord = typeof Schema.Type;\nexport type Encoded = typeof Schema.Encoded;\n\n/** Provider state that DomainKit cannot create but must retain for safe reconciliation. */\nexport const Opaque = S.Struct({\n _tag: S.Literal(\"Opaque\"),\n name: S.String.check(S.isMinLength(1)),\n providerRecordId: S.NullOr(S.String),\n providerType: S.String.check(S.isMinLength(1)),\n});\nexport interface Opaque extends S.Schema.Type<typeof Opaque> {}\n\n/** Any DNS record observed through a provider, including non-portable record types. */\nexport const Observed = S.Union([Schema, Opaque]);\nexport type Observed = typeof Observed.Type;\n\nexport const decode = Effect.fn(\"DnsRecord.decode\")((input: unknown) =>\n S.decodeUnknownEffect(Schema)(input).pipe(\n Effect.mapError((cause) => new InvalidInputError({ message: cause.message })),\n ),\n);\n\nexport function parse(input: unknown): DnsRecord {\n try {\n return S.decodeUnknownSync(Schema)(input);\n } catch (cause) {\n throw new InvalidInputError({\n message: cause instanceof Error ? cause.message : String(cause),\n });\n }\n}\n\nexport function data(record: DnsRecord): Readonly<Record<string, number | string>> {\n switch (record._tag) {\n case \"A\":\n case \"AAAA\":\n return { address: record.address };\n case \"CNAME\":\n case \"NS\":\n return { target: record.target };\n case \"TXT\":\n return { value: record.value };\n case \"MX\":\n return { exchange: record.exchange, priority: record.priority };\n case \"CAA\":\n return { flags: record.flags, tag: record.tag, value: record.value };\n case \"SRV\":\n return {\n port: record.port,\n priority: record.priority,\n target: record.target,\n weight: record.weight,\n };\n }\n}\n\nexport function equals(left: DnsRecord, right: DnsRecord): boolean {\n return (\n left._tag === right._tag &&\n left.name === right.name &&\n JSON.stringify(data(left)) === JSON.stringify(data(right))\n );\n}\n\nfunction isIpv4(value: string): boolean {\n const parts = value.split(\".\");\n return (\n parts.length === 4 &&\n parts.every(\n (part) => /^\\d{1,3}$/.test(part) && Number(part) <= 255 && String(Number(part)) === part,\n )\n );\n}\n\nfunction isIpv6(value: string): boolean {\n try {\n return new URL(`http://[${value}]/`).hostname.startsWith(\"[\");\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;;AAiBA,IAAaA,UAAb,cAA2B,OAAO,YAAmB,CAAC,CAAC,4BAA4B;CACjF,UAAU,OAAO,QAAQ,SAAS;CAClC,SAAS,OAAO;CAChB,WAAW,OAAO;CAClB,OAAO,OAAO,SAAS;EAAC;EAAS;EAAqB;EAAQ;CAAS,CAAC;AAC1E,CAAC,CAAC,CAAC,CAAC;AAiCJ,IAAaC,YAAb,cAA6B,QAAQ,QAA4B,CAAC,CAChE,6CACF,CAAC,CAAC,CAAC;;;;ACvDH,IAAaC,UAAb,cAA2B,OAAO,YAAmB,CAAC,CAAC,qBAAqB,EAC1E,SAAS,OAAO,OAClB,CAAC,CAAC,CAAC,CAAC;;;;;;;;ACAJ,MAAM,eAAe;AAErB,MAAMC,SAAOC,OAAE,OAAO,MACpBA,OAAE,YACC,UACC,MAAM,UAAU,OAChB,MAAM,SAAS,GAAG,KAClB,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,UAAU,aAAa,KAAK,KAAK,CAAC,IACtD,KAAA,IACA,uCACN,EAAE,YAAY,aAAa,CAC7B,CACF,CAAC,CAAC,KAAKA,OAAE,MAAM,YAAY,CAAC;;AAM5B,MAAaC,WAASD,OAAE,OAAO,KAC7BA,OAAE,SACAD,QACA,qBAAqB,gBAAgB;CACnC,SAAS,OAAO,YACd,OAAO,IAAI;EACT,WAAW,UAAU,KAAK;EAC1B,QAAQ,UACN,IAAI,YAAY,aACd,EAAE,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OA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AAwB;CACtC,IAAI;EACF,OAAO,IAAI,IAAI,WAAW,MAAM,GAAG,CAAC,CAAC,SAAS,WAAW,GAAG;CAC9D,QAAQ;EACN,OAAO;CACT;AACF"}
@@ -1,2 +1,2 @@
1
- import { _ as make, d as Fetch, f as Interface, g as client_d_exports, h as Zone, m as Options, o as auth_d_exports, p as ListZonesInput, u as Account } from "./index-D2howbNz.mjs";
2
- export { type Account, auth_d_exports as Auth, client_d_exports as Client, type Fetch, type Interface, type ListZonesInput, type Options, type Zone, make };
1
+ import { _ as Zone, b as make, c as auth_d_exports, f as Account, g as Options, h as ListZonesInput, m as Interface, p as Fetch, v as client_d_exports, y as discovery } from "./index-B1opsgls.mjs";
2
+ export { type Account, auth_d_exports as Auth, client_d_exports as Client, type Fetch, type Interface, type ListZonesInput, type Options, type Zone, discovery, make };
@@ -1,2 +1,2 @@
1
- import { c as make, s as client_exports, t as auth_exports } from "./auth-B0owkrpk.mjs";
2
- export { auth_exports as Auth, client_exports as Client, make };
1
+ import { d as make, l as client_exports, t as auth_exports, u as discovery } from "./auth-B4jq3yk3.mjs";
2
+ export { auth_exports as Auth, client_exports as Client, discovery, make };
@@ -1,2 +1,2 @@
1
- import { _ as make, a as auth_d_exports, d as Fetch, f as Interface, g as client_d_exports, h as Zone, l as Account, m as Options, p as ListZonesInput, u as AccountContext } from "./index-CEzk2gbZ.mjs";
2
- export { type Account, type AccountContext, auth_d_exports as Auth, client_d_exports as Client, type Fetch, type Interface, type ListZonesInput, type Options, type Zone, make };
1
+ import { _ as Zone, b as make, d as Account, f as AccountContext, g as Options, h as ListZonesInput, m as Interface, p as Fetch, s as auth_d_exports, v as client_d_exports, y as discovery } from "./index-Ewc__bQu.mjs";
2
+ export { type Account, type AccountContext, auth_d_exports as Auth, client_d_exports as Client, type Fetch, type Interface, type ListZonesInput, type Options, type Zone, discovery, make };
@@ -1,2 +1,2 @@
1
- import { n as make, r as auth_exports, t as client_exports } from "./client-BnD7QLRF.mjs";
2
- export { auth_exports as Auth, client_exports as Client, make };
1
+ import { c as client_exports, l as discovery, t as auth_exports, u as make } from "./auth-6-KRy1gN.mjs";
2
+ export { auth_exports as Auth, client_exports as Client, discovery, make };
package/dist/effect.d.mts CHANGED
@@ -1,47 +1,10 @@
1
- import { B as domain_name_d_exports, F as dns_record_d_exports, H as Error$3, N as Type, U as invalid_input_d_exports, d as Value, f as secret_d_exports, h as Error$2, l as TokenValidation, u as manifest_d_exports, v as provider_d_exports } from "./manifest-CP85ePFn.mjs";
2
- import { t as index_d_exports } from "./index-D2howbNz.mjs";
3
- import { t as index_d_exports$1 } from "./index-CEzk2gbZ.mjs";
4
- import { A as Service$2, B as Error$4, C as types_d_exports, D as oauth_state_d_exports, F as credential_d_exports, H as AuthorizationError, P as Service$1, Q as ProviderAuthorization, R as Service, U as Connection, V as error_d_exports, W as Grant, Y as connection_d_exports, et as authorization_d_exports, g as DnsPlan, j as authorization_d_exports$1, l as resolver_d_exports, p as receipt_d_exports, z as connection_d_exports$1 } from "./resolver-BHPsADzE.mjs";
5
- import { E as canonical_json_d_exports, T as CryptoError, b as zones_d_exports, g as AuthorizeError, h as deletion_d_exports, i as cloudflare_doh_d_exports, k as connection_lifecycle_d_exports, n as verify_d_exports, o as doh_d_exports, v as plan_d_exports, w as oauth_d_exports, x as selection_d_exports } from "./verify-B80xCBh2.mjs";
1
+ import { A as Connection, At as dns_record_d_exports, Ft as domain_name_d_exports, J as CryptoError, K as authorization_d_exports, Lt as Error$1, O as lifecycle_repository_d_exports, Ot as Type, Rt as invalid_input_d_exports, S as provider_context_d_exports, W as ProviderAuthorization, Y as canonical_json_d_exports, at as manifest_d_exports, i as zone_discovery_d_exports, k as AuthorizationError, pt as provider_d_exports, st as secret_d_exports } from "./zone-discovery-BA5I24vu.mjs";
2
+ import { t as index_d_exports } from "./index-B1opsgls.mjs";
3
+ import { t as connection_api_d_exports } from "./connection-api-DftK7eHo.mjs";
4
+ import { t as index_d_exports$1 } from "./index-Ewc__bQu.mjs";
5
+ import { _ as selection_d_exports, a as verify_d_exports, d as google_doh_d_exports, g as zones_d_exports, h as doh_d_exports, l as resolver_pool_d_exports, p as cloudflare_doh_d_exports, v as diagnostic_d_exports } from "./verify-7_EbKbFM.mjs";
6
+ import { B as types_d_exports, N as DnsPlan, b as AuthorizeError, k as plan_d_exports, l as resolver_d_exports, v as deletion_d_exports } from "./resolver-BbVzTbCX.mjs";
6
7
  import { Crypto, Effect } from "effect";
7
- declare namespace token_d_exports {
8
- export { Error$1 as Error, Input, Requirements$1 as Requirements, connect };
9
- }
10
- interface Input {
11
- readonly grant: Grant;
12
- readonly ownerId: string;
13
- readonly providerId: string;
14
- readonly subjectId: string;
15
- readonly token: Value;
16
- readonly validate: (token: Value) => Effect.Effect<TokenValidation, Error$2 | Error$3>;
17
- }
18
- declare const connect: (input: Input) => Effect.Effect<{
19
- authorization: {
20
- readonly accountId: string;
21
- readonly capabilities: readonly ("dns:read" | "dns:write")[];
22
- readonly createdAt: Date;
23
- readonly expiresAt: Date | null;
24
- readonly id: string;
25
- readonly kind: "oauth2" | "token";
26
- readonly providerId: string;
27
- readonly scopes: readonly string[];
28
- readonly subjectId: string;
29
- };
30
- connection: {
31
- readonly authorizationId: string;
32
- readonly createdAt: Date;
33
- readonly grant: {
34
- readonly _tag: "account";
35
- } | {
36
- readonly _tag: "domains";
37
- readonly domains: readonly (string & import("effect/Brand").Brand<"DomainName">)[];
38
- };
39
- readonly id: string;
40
- readonly ownerId: string;
41
- };
42
- }, CryptoError | Error$3 | Error$2 | Error$4, Crypto.Crypto | Service | Service$1 | Service$2>;
43
- type Error$1 = Error$2 | Error$3 | CryptoError | Error$4;
44
- type Requirements$1 = Service$2 | Service | Service$1 | Crypto.Crypto;
45
8
  declare namespace connection_authorization_d_exports {
46
9
  export { Error, Requirements, authorize };
47
10
  }
@@ -57,8 +20,8 @@ declare const authorize: (input: {
57
20
  operationIds: string[];
58
21
  planDigest: string;
59
22
  version: "domainkit.plan-authorization.v1";
60
- }, AuthorizationError | Error$3 | AuthorizeError, Crypto.Crypto>;
61
- type Error = AuthorizationError | Error$3 | CryptoError;
23
+ }, AuthorizationError | Error$1 | AuthorizeError, Crypto.Crypto>;
24
+ type Error = AuthorizationError | Error$1 | CryptoError;
62
25
  type Requirements = Crypto.Crypto;
63
26
  declare namespace dns_data_d_exports {
64
27
  export { parse };
@@ -69,5 +32,5 @@ declare function parse(type: Type, input: unknown): string;
69
32
  /** The current package version from the package manifest. */
70
33
  declare const VERSION: string;
71
34
  //#endregion
72
- export { index_d_exports as Cloudflare, cloudflare_doh_d_exports as CloudflareDnsOverHttps, connection_d_exports as Connection, connection_authorization_d_exports as ConnectionAuthorization, connection_lifecycle_d_exports as ConnectionLifecycle, connection_d_exports$1 as ConnectionStore, credential_d_exports as CredentialStore, deletion_d_exports as Deletion, canonical_json_d_exports as Digest, dns_data_d_exports as DnsData, doh_d_exports as DnsOverHttps, types_d_exports as DnsPlan, provider_d_exports as DnsProvider, dns_record_d_exports as DnsRecord, resolver_d_exports as DnsResolver, domain_name_d_exports as DomainName, invalid_input_d_exports as InvalidInput, oauth_d_exports as OAuth, oauth_state_d_exports as OAuthStateStore, manifest_d_exports as ProviderAuth, authorization_d_exports as ProviderAuthorization, authorization_d_exports$1 as ProviderAuthorizationStore, selection_d_exports as ProviderDiscovery, plan_d_exports as Provisioning, receipt_d_exports as ReceiptStore, secret_d_exports as Secret, error_d_exports as Storage, token_d_exports as TokenConnection, VERSION, index_d_exports$1 as Vercel, verify_d_exports as Verification, zones_d_exports as Zones };
35
+ export { lifecycle_repository_d_exports as AuthorizationLifecycle, index_d_exports as Cloudflare, cloudflare_doh_d_exports as CloudflareDnsOverHttps, connection_api_d_exports as Connection, connection_authorization_d_exports as ConnectionAuthorization, deletion_d_exports as Deletion, diagnostic_d_exports as Diagnostic, canonical_json_d_exports as Digest, dns_data_d_exports as DnsData, doh_d_exports as DnsOverHttps, types_d_exports as DnsPlan, provider_d_exports as DnsProvider, dns_record_d_exports as DnsRecord, resolver_d_exports as DnsResolver, resolver_pool_d_exports as DnsResolverPool, domain_name_d_exports as DomainName, google_doh_d_exports as GoogleDnsOverHttps, invalid_input_d_exports as InvalidInput, manifest_d_exports as ProviderAuth, authorization_d_exports as ProviderAuthorization, provider_context_d_exports as ProviderContext, selection_d_exports as ProviderDiscovery, plan_d_exports as Provisioning, secret_d_exports as Secret, VERSION, index_d_exports$1 as Vercel, verify_d_exports as Verification, zone_discovery_d_exports as ZoneDiscovery, zones_d_exports as Zones };
73
36
  //# sourceMappingURL=effect.d.mts.map