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.
- 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-B00c81-n.mjs +2420 -0
- package/dist/verify-B00c81-n.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/dist/promise.mjs
ADDED
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { $ as RemoveDomainResult, A as make$7, C as integrationFlow$1, Ct as encode$1, D as tokenMethod$3, E as tokenConnectionMethod$3, F as subjectResolver$1, G as secret_exports, H as authorize$2, I as tokenConnectionMethod$2, J as decode$5, K as Method$2, L as tokenMethod$2, M as manifest$2, N as oauthFlow$1, P as oauthMethod$1, Q as Method$1, R as tokenValidator$1, S as exchangeCode$1, St as decode$6, T as manifest$3, Tt as version, V as make$6, W as selection_exports, X as diagnostic_exports, Z as Error, _ as toAsync$2, _t as CapabilityEvidence, a as Result, at as AuthorizationError, bt as Schema$3, c as Observation, ct as assertGrant, d as defaultMake$1, dt as decode$4, et as StartResult, f as make$8, ft as encode, gt as Capability, h as toAsync$4, i as PublicDnsObservation, it as start$1, l as Policy, mt as removeDomain$1, n as ProviderObservation, nt as extend$1, o as observe$1, ot as Grant, pt as includeDomains, q as Schema$2, r as PublicDns$1, rt as removeDomain$2, st as Schema$1, t as Provider$1, tt as complete$1, u as Service, ut as coversDomain, vt as Evidence, w as integrationMethod$1, wt as provider_context_exports, y as toAsync$3, yt as EvidenceSchema } from "./verify-B00c81-n.mjs";
|
|
3
|
+
import { $ as Txt, A as decodeReceipt$1, D as Receipt, E as Operation, F as webCryptoLayer, G as Cname, H as A, I as Error$2, J as Observed, K as Mx, L as Service$2, M as encodeReceipt, O as Schema$6, Q as Srv, S as create$3, T as Authorization, U as Aaaa, W as Caa, X as RequirementMetadata, Y as Opaque, Z as Schema$4, a as Authorization$1, at as parse, b as apply$3, bt as invalid_input_exports, c as PartialError, ct as make$9, d as apply$2, dt as zones_exports, et as Type, f as authorize$3, ft as Error$1, g as CreateResult, ht as Schema$5, it as equals, j as encode$2, k as decode$7, l as Plan, o as Error$3, ot as Candidate, p as create$2, pt as Service$1, q as Ns, s as Operation$1, st as Service$3, t as Error$4, tt as data, u as Receipt$1, vt as parse$1, w as renderManualInstructions$1, x as authorize$4, y as Target, z as layerFromAsync } from "./resolver-CvK7JoJM.mjs";
|
|
4
|
+
import { Data, Effect, Layer } from "effect";
|
|
5
|
+
//#region src/promise/authorization-lifecycle.ts
|
|
6
|
+
var authorization_lifecycle_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
Error: () => Error$1,
|
|
8
|
+
from: () => from,
|
|
9
|
+
layerFrom: () => layerFrom,
|
|
10
|
+
toAsync: () => toAsync$1
|
|
11
|
+
});
|
|
12
|
+
const failure = (operation, cause) => cause instanceof Error$1 ? cause : new Error$1({
|
|
13
|
+
category: "storage",
|
|
14
|
+
message: cause instanceof globalThis.Error ? cause.message : String(cause),
|
|
15
|
+
operation,
|
|
16
|
+
retry: "safe"
|
|
17
|
+
});
|
|
18
|
+
const layerFrom = (repository) => Layer.succeed(Service$1, {
|
|
19
|
+
bind: Effect.fn("AuthorizationLifecycleRepository.bind")((authorizationId, binding) => Effect.tryPromise({
|
|
20
|
+
try: () => repository.bind(authorizationId, binding),
|
|
21
|
+
catch: (cause) => failure("AuthorizationLifecycleRepository.bind", cause)
|
|
22
|
+
})),
|
|
23
|
+
connect: Effect.fn("AuthorizationLifecycleRepository.connect")((aggregate) => Effect.tryPromise({
|
|
24
|
+
try: () => repository.connect(aggregate),
|
|
25
|
+
catch: (cause) => failure("AuthorizationLifecycleRepository.connect", cause)
|
|
26
|
+
})),
|
|
27
|
+
detach: ({ connectionId, revoke }) => Effect.tryPromise({
|
|
28
|
+
try: () => repository.detach({
|
|
29
|
+
connectionId,
|
|
30
|
+
revoke: (aggregate) => Effect.runPromise(revoke(aggregate))
|
|
31
|
+
}),
|
|
32
|
+
catch: (cause) => failure("AuthorizationLifecycleRepository.detach", cause)
|
|
33
|
+
}),
|
|
34
|
+
findByProviderAccount: Effect.fn("AuthorizationLifecycleRepository.findByProviderAccount")((providerId, providerAccountId) => Effect.tryPromise({
|
|
35
|
+
try: () => repository.findByProviderAccount(providerId, providerAccountId),
|
|
36
|
+
catch: (cause) => failure("AuthorizationLifecycleRepository.findByProviderAccount", cause)
|
|
37
|
+
})),
|
|
38
|
+
get: Effect.fn("AuthorizationLifecycleRepository.get")((authorizationId) => Effect.tryPromise({
|
|
39
|
+
try: () => repository.get(authorizationId),
|
|
40
|
+
catch: (cause) => failure("AuthorizationLifecycleRepository.get", cause)
|
|
41
|
+
})),
|
|
42
|
+
getByConnectionId: Effect.fn("AuthorizationLifecycleRepository.getByConnectionId")((connectionId) => Effect.tryPromise({
|
|
43
|
+
try: () => repository.getByConnectionId(connectionId),
|
|
44
|
+
catch: (cause) => failure("AuthorizationLifecycleRepository.getByConnectionId", cause)
|
|
45
|
+
})),
|
|
46
|
+
modifyBinding: (connectionId, modify) => Effect.tryPromise({
|
|
47
|
+
try: () => repository.modifyBinding(connectionId, modify),
|
|
48
|
+
catch: (cause) => failure("AuthorizationLifecycleRepository.modifyBinding", cause)
|
|
49
|
+
}),
|
|
50
|
+
promoteEvidence: Effect.fn("AuthorizationLifecycleRepository.promoteEvidence")((authorizationId, evidence) => Effect.tryPromise({
|
|
51
|
+
try: () => repository.promoteEvidence(authorizationId, evidence),
|
|
52
|
+
catch: (cause) => failure("AuthorizationLifecycleRepository.promoteEvidence", cause)
|
|
53
|
+
})),
|
|
54
|
+
recover: ({ authorizationId, revoke }) => Effect.tryPromise({
|
|
55
|
+
try: () => repository.recover({
|
|
56
|
+
authorizationId,
|
|
57
|
+
revoke: (aggregate) => Effect.runPromise(revoke(aggregate))
|
|
58
|
+
}),
|
|
59
|
+
catch: (cause) => failure("AuthorizationLifecycleRepository.recover", cause)
|
|
60
|
+
}),
|
|
61
|
+
rotate: Effect.fn("AuthorizationLifecycleRepository.rotate")((authorizationId, credential, expiresAt) => Effect.tryPromise({
|
|
62
|
+
try: () => repository.rotate(authorizationId, credential, expiresAt),
|
|
63
|
+
catch: (cause) => failure("AuthorizationLifecycleRepository.rotate", cause)
|
|
64
|
+
}))
|
|
65
|
+
});
|
|
66
|
+
const toAsync$1 = (repository) => ({
|
|
67
|
+
bind: (authorizationId, binding) => Effect.runPromise(repository.bind(authorizationId, binding)),
|
|
68
|
+
connect: (aggregate) => Effect.runPromise(repository.connect(aggregate)),
|
|
69
|
+
detach: ({ connectionId, revoke }) => Effect.runPromise(repository.detach({
|
|
70
|
+
connectionId,
|
|
71
|
+
revoke: (aggregate) => Effect.tryPromise(() => revoke(aggregate))
|
|
72
|
+
})),
|
|
73
|
+
findByProviderAccount: (providerId, providerAccountId) => Effect.runPromise(repository.findByProviderAccount(providerId, providerAccountId)),
|
|
74
|
+
get: (authorizationId) => Effect.runPromise(repository.get(authorizationId)),
|
|
75
|
+
getByConnectionId: (connectionId) => Effect.runPromise(repository.getByConnectionId(connectionId)),
|
|
76
|
+
modifyBinding: (connectionId, modify) => Effect.runPromise(repository.modifyBinding(connectionId, modify)),
|
|
77
|
+
promoteEvidence: (authorizationId, evidence) => Effect.runPromise(repository.promoteEvidence(authorizationId, evidence)),
|
|
78
|
+
recover: ({ authorizationId, revoke }) => Effect.runPromise(repository.recover({
|
|
79
|
+
authorizationId,
|
|
80
|
+
revoke: (aggregate) => Effect.tryPromise(() => revoke(aggregate))
|
|
81
|
+
})),
|
|
82
|
+
rotate: (authorizationId, credential, expiresAt) => Effect.runPromise(repository.rotate(authorizationId, credential, expiresAt))
|
|
83
|
+
});
|
|
84
|
+
const from = (repository) => repository;
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/promise/connection.ts
|
|
87
|
+
var connection_exports = /* @__PURE__ */ __exportAll({
|
|
88
|
+
AuthorizationError: () => AuthorizationError,
|
|
89
|
+
Error: () => Error,
|
|
90
|
+
Grant: () => Grant,
|
|
91
|
+
Method: () => Method,
|
|
92
|
+
RemoveDomainResult: () => RemoveDomainResult,
|
|
93
|
+
Schema: () => Schema$1,
|
|
94
|
+
StartResult: () => StartResult,
|
|
95
|
+
assertGrant: () => assertGrant,
|
|
96
|
+
complete: () => complete,
|
|
97
|
+
coversDomain: () => coversDomain,
|
|
98
|
+
decode: () => decode$3,
|
|
99
|
+
encode: () => encode,
|
|
100
|
+
extend: () => extend,
|
|
101
|
+
fromEffectFlow: () => fromEffectFlow,
|
|
102
|
+
fromEffectTokenMethod: () => fromEffectTokenMethod,
|
|
103
|
+
includeDomains: () => includeDomains,
|
|
104
|
+
removeDomain: () => removeDomain,
|
|
105
|
+
removeDomainFromGrant: () => removeDomain$1,
|
|
106
|
+
start: () => start,
|
|
107
|
+
toAsyncContinuations: () => toAsyncContinuations
|
|
108
|
+
});
|
|
109
|
+
function decode$3(input) {
|
|
110
|
+
return Effect.runPromise(decode$4(input));
|
|
111
|
+
}
|
|
112
|
+
const Method = Data.taggedEnum();
|
|
113
|
+
const connectionFailure = (operation, cause) => cause instanceof Error ? cause : new Error({
|
|
114
|
+
category: "provider",
|
|
115
|
+
message: cause instanceof globalThis.Error ? cause.message : String(cause),
|
|
116
|
+
operation,
|
|
117
|
+
retry: "unknown"
|
|
118
|
+
});
|
|
119
|
+
const effectMethod = (method) => method._tag === "Interactive" ? Method$1.Interactive({
|
|
120
|
+
continuations: effectContinuations(method.continuations),
|
|
121
|
+
flow: effectFlow(method.flow),
|
|
122
|
+
...method.ttlMs === void 0 ? {} : { ttlMs: method.ttlMs }
|
|
123
|
+
}) : Method$1.Token({
|
|
124
|
+
authenticate: (token) => Effect.tryPromise({
|
|
125
|
+
try: () => method.authenticate(token),
|
|
126
|
+
catch: (cause) => connectionFailure("Connection.start", cause)
|
|
127
|
+
}),
|
|
128
|
+
providerId: method.providerId,
|
|
129
|
+
requiredCapabilities: method.requiredCapabilities,
|
|
130
|
+
token: method.token
|
|
131
|
+
});
|
|
132
|
+
const effectContinuations = (store) => ({
|
|
133
|
+
consume: (id, now) => Effect.tryPromise({
|
|
134
|
+
try: () => store.consume(id, now),
|
|
135
|
+
catch: (cause) => connectionFailure("ConnectionContinuations.consume", cause)
|
|
136
|
+
}),
|
|
137
|
+
put: (continuation) => Effect.tryPromise({
|
|
138
|
+
try: () => store.put(continuation),
|
|
139
|
+
catch: (cause) => connectionFailure("ConnectionContinuations.put", cause)
|
|
140
|
+
})
|
|
141
|
+
});
|
|
142
|
+
const toAsyncContinuations = (store) => ({
|
|
143
|
+
consume: (id, now) => Effect.runPromise(store.consume(id, now)),
|
|
144
|
+
put: (continuation) => Effect.runPromise(store.put(continuation))
|
|
145
|
+
});
|
|
146
|
+
const effectFlow = (flow) => ({
|
|
147
|
+
complete: (payload, callbackUrl) => Effect.tryPromise({
|
|
148
|
+
try: () => flow.complete(payload, callbackUrl),
|
|
149
|
+
catch: (cause) => connectionFailure("Connection.complete", cause)
|
|
150
|
+
}),
|
|
151
|
+
method: flow.method,
|
|
152
|
+
providerId: flow.providerId,
|
|
153
|
+
requiredCapabilities: flow.requiredCapabilities,
|
|
154
|
+
start: (continuationId) => Effect.tryPromise({
|
|
155
|
+
try: () => flow.start(continuationId),
|
|
156
|
+
catch: (cause) => connectionFailure("Connection.start", cause)
|
|
157
|
+
})
|
|
158
|
+
});
|
|
159
|
+
/** Adapts an Effect-native provider flow to the Promise facade. */
|
|
160
|
+
const fromEffectFlow = (flow) => ({
|
|
161
|
+
complete: (payload, callbackUrl) => Effect.runPromise(flow.complete(payload, callbackUrl)),
|
|
162
|
+
method: flow.method,
|
|
163
|
+
providerId: flow.providerId,
|
|
164
|
+
requiredCapabilities: flow.requiredCapabilities,
|
|
165
|
+
start: (continuationId) => Effect.runPromise(flow.start(continuationId).pipe(Effect.provide(webCryptoLayer)))
|
|
166
|
+
});
|
|
167
|
+
/** Adapts an Effect-native token method to the Promise facade. */
|
|
168
|
+
function fromEffectTokenMethod(method) {
|
|
169
|
+
return Method.Token({
|
|
170
|
+
authenticate: (token) => Effect.runPromise(method.authenticate(token)),
|
|
171
|
+
providerId: method.providerId,
|
|
172
|
+
requiredCapabilities: method.requiredCapabilities,
|
|
173
|
+
token: method.token
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
async function start(input) {
|
|
177
|
+
return Effect.runPromise(start$1({
|
|
178
|
+
authorizedById: input.authorizedById,
|
|
179
|
+
grant: input.grant,
|
|
180
|
+
method: effectMethod(input.method),
|
|
181
|
+
ownerId: input.ownerId
|
|
182
|
+
}).pipe(Effect.provide(Layer.merge(layerFrom(input.repository), webCryptoLayer))));
|
|
183
|
+
}
|
|
184
|
+
async function complete(input) {
|
|
185
|
+
return Effect.runPromise(complete$1({
|
|
186
|
+
callbackUrl: input.callbackUrl,
|
|
187
|
+
continuationId: input.continuationId,
|
|
188
|
+
continuations: effectContinuations(input.continuations),
|
|
189
|
+
flow: effectFlow(input.flow)
|
|
190
|
+
}).pipe(Effect.provide(Layer.merge(layerFrom(input.repository), webCryptoLayer))));
|
|
191
|
+
}
|
|
192
|
+
/** Extends one owner binding without repeating provider authentication. */
|
|
193
|
+
async function extend(input) {
|
|
194
|
+
return Effect.runPromise(extend$1({
|
|
195
|
+
connectionId: input.connectionId,
|
|
196
|
+
grant: input.grant,
|
|
197
|
+
ownerId: input.ownerId
|
|
198
|
+
}).pipe(Effect.provide(layerFrom(input.repository))));
|
|
199
|
+
}
|
|
200
|
+
/** Removes one domain from an owner binding without revoking provider authorization. */
|
|
201
|
+
async function removeDomain(input) {
|
|
202
|
+
return Effect.runPromise(removeDomain$2({
|
|
203
|
+
connectionId: input.connectionId,
|
|
204
|
+
domain: input.domain,
|
|
205
|
+
ownerId: input.ownerId
|
|
206
|
+
}).pipe(Effect.provide(layerFrom(input.repository))));
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/promise/provider-auth.ts
|
|
210
|
+
var provider_auth_exports = /* @__PURE__ */ __exportAll({
|
|
211
|
+
Method: () => Method$2,
|
|
212
|
+
Schema: () => Schema$2,
|
|
213
|
+
decode: () => decode$2
|
|
214
|
+
});
|
|
215
|
+
function decode$2(input) {
|
|
216
|
+
return Effect.runPromise(decode$5(input));
|
|
217
|
+
}
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/promise/provider-authorization.ts
|
|
220
|
+
var provider_authorization_exports = /* @__PURE__ */ __exportAll({
|
|
221
|
+
Capability: () => Capability,
|
|
222
|
+
CapabilityEvidence: () => CapabilityEvidence,
|
|
223
|
+
Evidence: () => Evidence,
|
|
224
|
+
EvidenceSchema: () => EvidenceSchema,
|
|
225
|
+
Schema: () => Schema$3,
|
|
226
|
+
decode: () => decode$1,
|
|
227
|
+
encode: () => encode$1
|
|
228
|
+
});
|
|
229
|
+
function decode$1(input) {
|
|
230
|
+
return Effect.runPromise(decode$6(input));
|
|
231
|
+
}
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/promise/zone-discovery.ts
|
|
234
|
+
var zone_discovery_exports = /* @__PURE__ */ __exportAll({
|
|
235
|
+
Candidate: () => Candidate,
|
|
236
|
+
discover: () => discover,
|
|
237
|
+
toEffectSource: () => toEffectSource
|
|
238
|
+
});
|
|
239
|
+
function discover(input) {
|
|
240
|
+
return Effect.runPromise(make$9(input.sources.map(toEffectSource)).discover(input.domain).pipe(Effect.map(projectOutcome)));
|
|
241
|
+
}
|
|
242
|
+
function toEffectSource(source) {
|
|
243
|
+
return {
|
|
244
|
+
listZones: (name) => Effect.tryPromise({
|
|
245
|
+
try: () => source.listZones(name),
|
|
246
|
+
catch: (cause) => new Error$2({
|
|
247
|
+
cause,
|
|
248
|
+
message: cause instanceof globalThis.Error ? cause.message : String(cause),
|
|
249
|
+
operation: "ZoneDiscovery.listZones",
|
|
250
|
+
providerId: source.provider.id,
|
|
251
|
+
reason: "transport"
|
|
252
|
+
})
|
|
253
|
+
}),
|
|
254
|
+
provider: Service$2.of({
|
|
255
|
+
id: source.provider.id,
|
|
256
|
+
createRecord: (zone, record) => Effect.tryPromise({
|
|
257
|
+
try: () => source.provider.createRecord(zone, record),
|
|
258
|
+
catch: (cause) => providerFailure(source.provider.id, "createRecord", cause)
|
|
259
|
+
}),
|
|
260
|
+
deleteRecord: (zone, providerRecordId) => Effect.tryPromise({
|
|
261
|
+
try: () => source.provider.deleteRecord(zone, providerRecordId),
|
|
262
|
+
catch: (cause) => providerFailure(source.provider.id, "deleteRecord", cause)
|
|
263
|
+
}),
|
|
264
|
+
getRecord: (zone, providerRecordId) => Effect.tryPromise({
|
|
265
|
+
try: () => source.provider.getRecord(zone, providerRecordId),
|
|
266
|
+
catch: (cause) => providerFailure(source.provider.id, "getRecord", cause)
|
|
267
|
+
}),
|
|
268
|
+
listRecords: (zone) => Effect.tryPromise({
|
|
269
|
+
try: () => source.provider.listRecords(zone),
|
|
270
|
+
catch: (cause) => providerFailure(source.provider.id, "listRecords", cause)
|
|
271
|
+
})
|
|
272
|
+
})
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function projectOutcome(outcome) {
|
|
276
|
+
switch (outcome._tag) {
|
|
277
|
+
case "NotFound": return outcome;
|
|
278
|
+
case "Resolved": return {
|
|
279
|
+
_tag: "Resolved",
|
|
280
|
+
candidate: outcome.candidate
|
|
281
|
+
};
|
|
282
|
+
case "SelectionRequired": return outcome;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function providerFailure(providerId, operation, cause) {
|
|
286
|
+
return cause instanceof Error$2 ? cause : new Error$2({
|
|
287
|
+
cause,
|
|
288
|
+
message: cause instanceof globalThis.Error ? cause.message : String(cause),
|
|
289
|
+
operation,
|
|
290
|
+
providerId
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/promise/dns-record.ts
|
|
295
|
+
var dns_record_exports = /* @__PURE__ */ __exportAll({
|
|
296
|
+
A: () => A,
|
|
297
|
+
Aaaa: () => Aaaa,
|
|
298
|
+
Caa: () => Caa,
|
|
299
|
+
Cname: () => Cname,
|
|
300
|
+
Mx: () => Mx,
|
|
301
|
+
Ns: () => Ns,
|
|
302
|
+
Observed: () => Observed,
|
|
303
|
+
Opaque: () => Opaque,
|
|
304
|
+
RequirementMetadata: () => RequirementMetadata,
|
|
305
|
+
Schema: () => Schema$4,
|
|
306
|
+
Srv: () => Srv,
|
|
307
|
+
Txt: () => Txt,
|
|
308
|
+
Type: () => Type,
|
|
309
|
+
data: () => data,
|
|
310
|
+
equals: () => equals,
|
|
311
|
+
parse: () => parse
|
|
312
|
+
});
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region src/promise/domain-name.ts
|
|
315
|
+
var domain_name_exports = /* @__PURE__ */ __exportAll({
|
|
316
|
+
Schema: () => Schema$5,
|
|
317
|
+
parse: () => parse$1
|
|
318
|
+
});
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region src/promise/dns-plan.ts
|
|
321
|
+
var dns_plan_exports = /* @__PURE__ */ __exportAll({
|
|
322
|
+
Authorization: () => Authorization,
|
|
323
|
+
Operation: () => Operation,
|
|
324
|
+
Receipt: () => Receipt,
|
|
325
|
+
Schema: () => Schema$6,
|
|
326
|
+
decode: () => decode,
|
|
327
|
+
decodeReceipt: () => decodeReceipt,
|
|
328
|
+
encode: () => encode$2,
|
|
329
|
+
encodeReceipt: () => encodeReceipt
|
|
330
|
+
});
|
|
331
|
+
function decode(input) {
|
|
332
|
+
return Effect.runPromise(decode$7(input));
|
|
333
|
+
}
|
|
334
|
+
function decodeReceipt(input) {
|
|
335
|
+
return Effect.runPromise(decodeReceipt$1(input));
|
|
336
|
+
}
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region src/promise/deletion.ts
|
|
339
|
+
var deletion_exports = /* @__PURE__ */ __exportAll({
|
|
340
|
+
Authorization: () => Authorization$1,
|
|
341
|
+
Error: () => Error$3,
|
|
342
|
+
Operation: () => Operation$1,
|
|
343
|
+
PartialError: () => PartialError,
|
|
344
|
+
Plan: () => Plan,
|
|
345
|
+
Receipt: () => Receipt$1,
|
|
346
|
+
apply: () => apply$1,
|
|
347
|
+
authorize: () => authorize$1,
|
|
348
|
+
create: () => create$1
|
|
349
|
+
});
|
|
350
|
+
function create$1(input) {
|
|
351
|
+
return Effect.runPromise(create$2({
|
|
352
|
+
plan: input.plan,
|
|
353
|
+
receipt: input.receipt,
|
|
354
|
+
...input.ttlMs === void 0 ? {} : { ttlMs: input.ttlMs }
|
|
355
|
+
}).pipe(Effect.provide(Layer.merge(layerFromAsync(input.provider), webCryptoLayer))));
|
|
356
|
+
}
|
|
357
|
+
function authorize$1(plan, operationIds) {
|
|
358
|
+
return Effect.runPromise(authorize$3(plan, operationIds).pipe(Effect.provide(webCryptoLayer)));
|
|
359
|
+
}
|
|
360
|
+
function apply$1(input) {
|
|
361
|
+
return Effect.runPromise(apply$2({
|
|
362
|
+
authorization: input.authorization,
|
|
363
|
+
plan: input.plan,
|
|
364
|
+
...input.priorReceipt === void 0 ? {} : { priorReceipt: input.priorReceipt }
|
|
365
|
+
}).pipe(Effect.provide(Layer.merge(layerFromAsync(input.provider), webCryptoLayer))));
|
|
366
|
+
}
|
|
367
|
+
//#endregion
|
|
368
|
+
//#region src/promise/cloudflare-auth.ts
|
|
369
|
+
var cloudflare_auth_exports = /* @__PURE__ */ __exportAll({
|
|
370
|
+
manifest: () => manifest$1,
|
|
371
|
+
oauthFlow: () => oauthFlow,
|
|
372
|
+
oauthMethod: () => oauthMethod,
|
|
373
|
+
subjectResolver: () => subjectResolver,
|
|
374
|
+
tokenConnectionMethod: () => tokenConnectionMethod$1,
|
|
375
|
+
tokenMethod: () => tokenMethod$1,
|
|
376
|
+
tokenValidator: () => tokenValidator
|
|
377
|
+
});
|
|
378
|
+
const manifest$1 = manifest$2;
|
|
379
|
+
const oauthMethod = oauthMethod$1;
|
|
380
|
+
const tokenMethod$1 = tokenMethod$2;
|
|
381
|
+
function subjectResolver(options) {
|
|
382
|
+
const resolve = subjectResolver$1(options);
|
|
383
|
+
return (tokens, accessToken) => Effect.runPromise(resolve(tokens, accessToken));
|
|
384
|
+
}
|
|
385
|
+
/** Creates Cloudflare's OAuth implementation for the Promise connection facade. */
|
|
386
|
+
function oauthFlow(options) {
|
|
387
|
+
return fromEffectFlow(oauthFlow$1(options));
|
|
388
|
+
}
|
|
389
|
+
/** Creates a Cloudflare token method for the Promise connection facade. */
|
|
390
|
+
function tokenConnectionMethod$1(options) {
|
|
391
|
+
return fromEffectTokenMethod(tokenConnectionMethod$2(options));
|
|
392
|
+
}
|
|
393
|
+
function tokenValidator(options) {
|
|
394
|
+
const validate = tokenValidator$1(options);
|
|
395
|
+
return (token) => Effect.runPromise(validate(token));
|
|
396
|
+
}
|
|
397
|
+
//#endregion
|
|
398
|
+
//#region src/promise/cloudflare.ts
|
|
399
|
+
var cloudflare_exports = /* @__PURE__ */ __exportAll({
|
|
400
|
+
Auth: () => cloudflare_auth_exports,
|
|
401
|
+
discovery: () => discovery$1,
|
|
402
|
+
make: () => make$5
|
|
403
|
+
});
|
|
404
|
+
/** Creates a Promise-compatible facade over the Effect-native Cloudflare client. */
|
|
405
|
+
function make$5(options) {
|
|
406
|
+
const client = make$6(options);
|
|
407
|
+
return {
|
|
408
|
+
id: client.id,
|
|
409
|
+
createRecord: (zone, record) => Effect.runPromise(client.createRecord(zone, record)),
|
|
410
|
+
deleteRecord: (zone, providerRecordId) => Effect.runPromise(client.deleteRecord(zone, providerRecordId)),
|
|
411
|
+
getRecord: (zone, providerRecordId) => Effect.runPromise(client.getRecord(zone, providerRecordId)),
|
|
412
|
+
listAccounts: () => Effect.runPromise(client.listAccounts()),
|
|
413
|
+
listRecords: (zone) => Effect.runPromise(client.listRecords(zone)),
|
|
414
|
+
listZones: (input) => Effect.runPromise(client.listZones(input)),
|
|
415
|
+
validateToken: () => Effect.runPromise(client.validateToken())
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
/** Creates the optional Cloudflare discovery source for Promise consumers. */
|
|
419
|
+
function discovery$1(options) {
|
|
420
|
+
const client = make$5(options);
|
|
421
|
+
return {
|
|
422
|
+
listZones: async (name) => (await client.listZones({ name })).map((zone) => ({
|
|
423
|
+
...zone,
|
|
424
|
+
status: zone.status === "active" || zone.status === "pending" ? zone.status : "unknown"
|
|
425
|
+
})),
|
|
426
|
+
provider: client
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/promise/vercel-auth.ts
|
|
431
|
+
var vercel_auth_exports = /* @__PURE__ */ __exportAll({
|
|
432
|
+
exchangeCode: () => exchangeCode,
|
|
433
|
+
integrationFlow: () => integrationFlow,
|
|
434
|
+
integrationMethod: () => integrationMethod,
|
|
435
|
+
manifest: () => manifest,
|
|
436
|
+
tokenConnectionMethod: () => tokenConnectionMethod,
|
|
437
|
+
tokenMethod: () => tokenMethod
|
|
438
|
+
});
|
|
439
|
+
const integrationMethod = integrationMethod$1;
|
|
440
|
+
const manifest = manifest$3;
|
|
441
|
+
const tokenMethod = tokenMethod$3;
|
|
442
|
+
function exchangeCode(options) {
|
|
443
|
+
return Effect.runPromise(exchangeCode$1(options));
|
|
444
|
+
}
|
|
445
|
+
/** Creates Vercel Integration's implementation for the Promise connection facade. */
|
|
446
|
+
function integrationFlow(options) {
|
|
447
|
+
return fromEffectFlow(integrationFlow$1(options));
|
|
448
|
+
}
|
|
449
|
+
/** Creates a Vercel token method for the Promise connection facade. */
|
|
450
|
+
function tokenConnectionMethod(options) {
|
|
451
|
+
return fromEffectTokenMethod(tokenConnectionMethod$3(options));
|
|
452
|
+
}
|
|
453
|
+
//#endregion
|
|
454
|
+
//#region src/promise/vercel.ts
|
|
455
|
+
var vercel_exports = /* @__PURE__ */ __exportAll({
|
|
456
|
+
Auth: () => vercel_auth_exports,
|
|
457
|
+
discovery: () => discovery,
|
|
458
|
+
make: () => make$4
|
|
459
|
+
});
|
|
460
|
+
/** Creates a Promise-compatible facade over the Effect-native Vercel client. */
|
|
461
|
+
function make$4(options) {
|
|
462
|
+
const client = make$7(options);
|
|
463
|
+
return {
|
|
464
|
+
id: client.id,
|
|
465
|
+
createRecord: (zone, record) => Effect.runPromise(client.createRecord(zone, record)),
|
|
466
|
+
deleteRecord: (zone, providerRecordId) => Effect.runPromise(client.deleteRecord(zone, providerRecordId)),
|
|
467
|
+
getRecord: (zone, providerRecordId) => Effect.runPromise(client.getRecord(zone, providerRecordId)),
|
|
468
|
+
listAccounts: () => Effect.runPromise(client.listAccounts()),
|
|
469
|
+
listRecords: (zone) => Effect.runPromise(client.listRecords(zone)),
|
|
470
|
+
listZones: (input) => Effect.runPromise(client.listZones(input)),
|
|
471
|
+
validateToken: () => Effect.runPromise(client.validateToken())
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
/** Creates the optional Vercel discovery source for Promise consumers. */
|
|
475
|
+
function discovery(options) {
|
|
476
|
+
const client = make$4(options);
|
|
477
|
+
return {
|
|
478
|
+
listZones: (name) => client.listZones({ name }),
|
|
479
|
+
provider: client
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/promise/provisioning.ts
|
|
484
|
+
var provisioning_exports = /* @__PURE__ */ __exportAll({
|
|
485
|
+
CreateResult: () => CreateResult,
|
|
486
|
+
Target: () => Target,
|
|
487
|
+
apply: () => apply,
|
|
488
|
+
authorize: () => authorize,
|
|
489
|
+
authorizeForConnection: () => authorizeForConnection,
|
|
490
|
+
create: () => create,
|
|
491
|
+
renderManualInstructions: () => renderManualInstructions
|
|
492
|
+
});
|
|
493
|
+
function create(input) {
|
|
494
|
+
if ("sources" in input) {
|
|
495
|
+
const { sources, ...programInput } = input;
|
|
496
|
+
return Effect.runPromise(create$3(programInput).pipe(Effect.provide(Layer.merge(Layer.succeed(Service$3, make$9(sources.map(toEffectSource))), webCryptoLayer))));
|
|
497
|
+
}
|
|
498
|
+
const { provider, ...programInput } = input;
|
|
499
|
+
return Effect.runPromise(create$3(programInput).pipe(Effect.provide(Layer.merge(layerFromAsync(provider), webCryptoLayer))));
|
|
500
|
+
}
|
|
501
|
+
function authorize(plan, operationIds, options = {}) {
|
|
502
|
+
return Effect.runPromise(authorize$4(plan, operationIds, options).pipe(Effect.provide(webCryptoLayer)));
|
|
503
|
+
}
|
|
504
|
+
function apply(input) {
|
|
505
|
+
return Effect.runPromise(apply$3({
|
|
506
|
+
authorization: input.authorization,
|
|
507
|
+
plan: input.plan
|
|
508
|
+
}).pipe(Effect.provide(Layer.merge(layerFromAsync(input.provider), webCryptoLayer))));
|
|
509
|
+
}
|
|
510
|
+
function authorizeForConnection(input) {
|
|
511
|
+
return Effect.runPromise(authorize$2(input).pipe(Effect.provide(webCryptoLayer)));
|
|
512
|
+
}
|
|
513
|
+
const renderManualInstructions = renderManualInstructions$1;
|
|
514
|
+
//#endregion
|
|
515
|
+
//#region src/promise/verification.ts
|
|
516
|
+
var verification_exports = /* @__PURE__ */ __exportAll({
|
|
517
|
+
Provider: () => Provider,
|
|
518
|
+
ProviderObservation: () => ProviderObservation,
|
|
519
|
+
PublicDns: () => PublicDns,
|
|
520
|
+
PublicDnsObservation: () => PublicDnsObservation,
|
|
521
|
+
Result: () => Result,
|
|
522
|
+
observe: () => observe
|
|
523
|
+
});
|
|
524
|
+
const PublicDns = PublicDns$1;
|
|
525
|
+
const Provider = Data.taggedEnum();
|
|
526
|
+
function observe(input) {
|
|
527
|
+
const provider = input.provider ?? Provider.Disabled();
|
|
528
|
+
let program = provider._tag === "Enabled" ? observe$1({
|
|
529
|
+
record: input.record,
|
|
530
|
+
...input.publicDns === void 0 ? {} : { publicDns: input.publicDns },
|
|
531
|
+
provider: Provider$1.Enabled({ zone: provider.zone })
|
|
532
|
+
}).pipe(Effect.provide(layerFromAsync(provider.provider))) : observe$1({
|
|
533
|
+
record: input.record,
|
|
534
|
+
...input.publicDns === void 0 ? {} : { publicDns: input.publicDns },
|
|
535
|
+
provider: Provider$1.Disabled()
|
|
536
|
+
});
|
|
537
|
+
if (input.resolvers !== void 0) program = program.pipe(Effect.provide(Layer.succeed(Service, make$8(input.resolvers.map((entry) => ({
|
|
538
|
+
id: entry.id,
|
|
539
|
+
resolver: fromAsyncResolver(entry.resolver),
|
|
540
|
+
...entry.timeoutMs === void 0 ? {} : { timeoutMs: entry.timeoutMs }
|
|
541
|
+
}))))));
|
|
542
|
+
return Effect.runPromise(program);
|
|
543
|
+
}
|
|
544
|
+
function fromAsyncResolver(resolver) {
|
|
545
|
+
return { resolve: (query) => Effect.tryPromise({
|
|
546
|
+
try: () => resolver.resolve(query),
|
|
547
|
+
catch: (cause) => new Error$4({
|
|
548
|
+
cause,
|
|
549
|
+
message: cause instanceof globalThis.Error ? cause.message : String(cause),
|
|
550
|
+
reason: "transport"
|
|
551
|
+
})
|
|
552
|
+
}).pipe(Effect.flatMap((resolution) => {
|
|
553
|
+
switch (resolution._tag) {
|
|
554
|
+
case "answer":
|
|
555
|
+
case "nodata": return Effect.succeed(resolution);
|
|
556
|
+
case "timeout": return Effect.fail(new Error$4({
|
|
557
|
+
message: "DNS query timed out",
|
|
558
|
+
reason: "timeout"
|
|
559
|
+
}));
|
|
560
|
+
case "failure": return Effect.fail(new Error$4({
|
|
561
|
+
message: resolution.message,
|
|
562
|
+
reason: "transport"
|
|
563
|
+
}));
|
|
564
|
+
}
|
|
565
|
+
})) };
|
|
566
|
+
}
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region src/promise/cloudflare-doh.ts
|
|
569
|
+
var cloudflare_doh_exports = /* @__PURE__ */ __exportAll({ make: () => make$3 });
|
|
570
|
+
function make$3(options = {}) {
|
|
571
|
+
return toAsync$2(options);
|
|
572
|
+
}
|
|
573
|
+
//#endregion
|
|
574
|
+
//#region src/promise/doh.ts
|
|
575
|
+
var doh_exports = /* @__PURE__ */ __exportAll({ make: () => make$2 });
|
|
576
|
+
function make$2(options) {
|
|
577
|
+
return toAsync$3(options);
|
|
578
|
+
}
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region src/promise/google-doh.ts
|
|
581
|
+
var google_doh_exports = /* @__PURE__ */ __exportAll({ make: () => make$1 });
|
|
582
|
+
function make$1(options = {}) {
|
|
583
|
+
return toAsync$4(options);
|
|
584
|
+
}
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region src/promise/resolver-pool.ts
|
|
587
|
+
var resolver_pool_exports = /* @__PURE__ */ __exportAll({
|
|
588
|
+
Observation: () => Observation,
|
|
589
|
+
Policy: () => Policy,
|
|
590
|
+
defaultMake: () => defaultMake,
|
|
591
|
+
make: () => make
|
|
592
|
+
});
|
|
593
|
+
function make(entries) {
|
|
594
|
+
return toAsync(make$8(entries.map((entry) => ({
|
|
595
|
+
id: entry.id,
|
|
596
|
+
resolver: asyncResolver(entry.resolver),
|
|
597
|
+
...entry.timeoutMs === void 0 ? {} : { timeoutMs: entry.timeoutMs }
|
|
598
|
+
}))));
|
|
599
|
+
}
|
|
600
|
+
function defaultMake(options = {}) {
|
|
601
|
+
return toAsync(defaultMake$1(options));
|
|
602
|
+
}
|
|
603
|
+
function toAsync(pool) {
|
|
604
|
+
return { observe: (query) => Effect.runPromise(pool.observe(query)) };
|
|
605
|
+
}
|
|
606
|
+
function asyncResolver(resolver) {
|
|
607
|
+
return { resolve: (query) => Effect.tryPromise({
|
|
608
|
+
try: () => resolver.resolve(query),
|
|
609
|
+
catch: (cause) => new Error$4({
|
|
610
|
+
cause,
|
|
611
|
+
message: cause instanceof globalThis.Error ? cause.message : String(cause),
|
|
612
|
+
reason: "transport"
|
|
613
|
+
})
|
|
614
|
+
}).pipe(Effect.flatMap((resolution) => {
|
|
615
|
+
switch (resolution._tag) {
|
|
616
|
+
case "answer":
|
|
617
|
+
case "nodata": return Effect.succeed(resolution);
|
|
618
|
+
case "timeout": return Effect.fail(new Error$4({
|
|
619
|
+
message: "DNS query timed out",
|
|
620
|
+
reason: "timeout"
|
|
621
|
+
}));
|
|
622
|
+
case "failure": return Effect.fail(new Error$4({
|
|
623
|
+
message: resolution.message,
|
|
624
|
+
reason: "transport"
|
|
625
|
+
}));
|
|
626
|
+
}
|
|
627
|
+
})) };
|
|
628
|
+
}
|
|
629
|
+
//#endregion
|
|
630
|
+
//#region src/promise.ts
|
|
631
|
+
/** The current package version from the package manifest. */
|
|
632
|
+
const VERSION = version;
|
|
633
|
+
//#endregion
|
|
634
|
+
export { authorization_lifecycle_exports as AuthorizationLifecycle, cloudflare_exports as Cloudflare, cloudflare_doh_exports as CloudflareDnsOverHttps, connection_exports as Connection, deletion_exports as Deletion, diagnostic_exports as Diagnostic, doh_exports as DnsOverHttps, dns_plan_exports as DnsPlan, dns_record_exports as DnsRecord, resolver_pool_exports as DnsResolverPool, domain_name_exports as DomainName, google_doh_exports as GoogleDnsOverHttps, invalid_input_exports as InvalidInput, provider_auth_exports as ProviderAuth, provider_authorization_exports as ProviderAuthorization, provider_context_exports as ProviderContext, selection_exports as ProviderDiscovery, provisioning_exports as Provisioning, secret_exports as Secret, VERSION, vercel_exports as Vercel, verification_exports as Verification, zone_discovery_exports as ZoneDiscovery, zones_exports as Zones };
|
|
635
|
+
|
|
636
|
+
//# sourceMappingURL=promise.mjs.map
|