domainkit 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -26
- package/dist/index.d.mts +639 -187
- package/dist/index.mjs +301 -300
- package/dist/index.mjs.map +1 -1
- package/dist/promise.d.mts +464 -0
- package/dist/promise.mjs +636 -0
- package/dist/promise.mjs.map +1 -0
- package/dist/{resolver-CxE-VDw4.mjs → resolver-CvK7JoJM.mjs} +401 -54
- package/dist/resolver-CvK7JoJM.mjs.map +1 -0
- package/dist/{resolver-BbVzTbCX.d.mts → resolver-uqe1h5Vz.d.mts} +1513 -25
- package/dist/testing.d.mts +4 -5
- package/dist/testing.mjs +17 -3
- package/dist/testing.mjs.map +1 -1
- package/dist/verify-B00c81-n.mjs +2420 -0
- package/dist/verify-B00c81-n.mjs.map +1 -0
- package/dist/{verify-7_EbKbFM.d.mts → verify-CkgVrwyl.d.mts} +318 -21
- package/package.json +6 -30
- package/dist/auth-6-KRy1gN.mjs +0 -671
- package/dist/auth-6-KRy1gN.mjs.map +0 -1
- package/dist/auth-B4jq3yk3.mjs +0 -738
- package/dist/auth-B4jq3yk3.mjs.map +0 -1
- package/dist/authorization-CQSKKMrW.mjs +0 -255
- package/dist/authorization-CQSKKMrW.mjs.map +0 -1
- package/dist/canonical-json-CpvqGMcr.mjs +0 -57
- package/dist/canonical-json-CpvqGMcr.mjs.map +0 -1
- package/dist/cloudflare-Bg_p-M2c.mjs +0 -69
- package/dist/cloudflare-Bg_p-M2c.mjs.map +0 -1
- package/dist/cloudflare-FDl5q7Dm.d.mts +0 -32
- package/dist/cloudflare.d.mts +0 -3
- package/dist/cloudflare.mjs +0 -2
- package/dist/connection-BXoSrhZs.mjs +0 -58
- package/dist/connection-BXoSrhZs.mjs.map +0 -1
- package/dist/connection-CEqadXSm.d.mts +0 -182
- package/dist/connection-X3rZhrBZ.mjs +0 -186
- package/dist/connection-X3rZhrBZ.mjs.map +0 -1
- package/dist/connection-api-DftK7eHo.d.mts +0 -7
- package/dist/dns-record-BLeqo56C.mjs +0 -289
- package/dist/dns-record-BLeqo56C.mjs.map +0 -1
- package/dist/effect-cloudflare.d.mts +0 -2
- package/dist/effect-cloudflare.mjs +0 -2
- package/dist/effect-vercel.d.mts +0 -2
- package/dist/effect-vercel.mjs +0 -2
- package/dist/effect.d.mts +0 -36
- package/dist/effect.mjs +0 -50
- package/dist/effect.mjs.map +0 -1
- package/dist/index-B1opsgls.d.mts +0 -159
- package/dist/index-Ewc__bQu.d.mts +0 -145
- package/dist/resolver-CxE-VDw4.mjs.map +0 -1
- package/dist/vercel-BIFpZRPu.mjs +0 -60
- package/dist/vercel-BIFpZRPu.mjs.map +0 -1
- package/dist/vercel-DgJaUX9D.d.mts +0 -31
- package/dist/vercel.d.mts +0 -3
- package/dist/vercel.mjs +0 -2
- package/dist/verify-Q5RYpnuw.mjs +0 -642
- package/dist/verify-Q5RYpnuw.mjs.map +0 -1
- package/dist/zone-discovery-BA5I24vu.d.mts +0 -1390
- package/dist/zones-DKHTpX9C.mjs +0 -19
- package/dist/zones-DKHTpX9C.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,324 +1,325 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { A as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
import { $ as RemoveDomainResult$1, A as make$1, B as discovery, G as secret_exports, O as client_exports$1, Q as Method$1, Tt as version, U as connection_authorization_exports, V as make, W as selection_exports, X as diagnostic_exports, Y as manifest_exports, Z as Error, at as AuthorizationError, b as dns_data_exports, ct as assertGrant, dt as decode, et as StartResult, ft as encode, g as cloudflare_doh_exports, ht as validate, it as start, j as auth_exports, k as discovery$1, lt as authorizationError, m as google_doh_exports, mt as removeDomain$1, nt as extend, ot as Grant, p as resolver_pool_exports, pt as includeDomains, rt as removeDomain, s as verify_exports, st as Schema$1, tt as complete, ut as coversDomain, v as doh_exports, wt as provider_context_exports, x as auth_exports$1, xt as authorization_exports, z as client_exports } from "./verify-B00c81-n.mjs";
|
|
3
|
+
import { B as provider_exports, C as plan_exports, N as types_exports, P as canonical_json_exports, _t as domain_name_exports, bt as invalid_input_exports, dt as zones_exports, lt as zone_discovery_exports, m as deletion_exports, mt as lifecycle_repository_exports, r as resolver_exports, rt as dns_record_exports } from "./resolver-CvK7JoJM.mjs";
|
|
4
|
+
import { Context, Data, Effect, Layer, Schema } from "effect";
|
|
5
|
+
//#region src/auth/connection-api.ts
|
|
6
|
+
var connection_api_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
AuthorizationError: () => AuthorizationError,
|
|
8
|
+
Error: () => Error,
|
|
9
|
+
Grant: () => Grant,
|
|
10
|
+
Method: () => Method$1,
|
|
11
|
+
RemoveDomainResult: () => RemoveDomainResult$1,
|
|
12
|
+
Schema: () => Schema$1,
|
|
13
|
+
StartResult: () => StartResult,
|
|
14
|
+
assertGrant: () => assertGrant,
|
|
15
|
+
authorizationError: () => authorizationError,
|
|
16
|
+
complete: () => complete,
|
|
17
|
+
coversDomain: () => coversDomain,
|
|
18
|
+
decode: () => decode,
|
|
19
|
+
encode: () => encode,
|
|
20
|
+
extend: () => extend,
|
|
21
|
+
includeDomains: () => includeDomains,
|
|
22
|
+
removeDomain: () => removeDomain,
|
|
23
|
+
removeDomainFromGrant: () => removeDomain$1,
|
|
24
|
+
start: () => start,
|
|
25
|
+
validate: () => validate
|
|
26
|
+
});
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/providers/cloudflare/index.ts
|
|
29
|
+
var cloudflare_exports = /* @__PURE__ */ __exportAll({
|
|
30
|
+
Auth: () => auth_exports,
|
|
31
|
+
Client: () => client_exports,
|
|
32
|
+
discovery: () => discovery,
|
|
33
|
+
make: () => make
|
|
17
34
|
});
|
|
18
|
-
function decode$2(input) {
|
|
19
|
-
return Effect.runPromise(decode$4(input));
|
|
20
|
-
}
|
|
21
35
|
//#endregion
|
|
22
|
-
//#region src/
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Schema: () => Schema$3,
|
|
29
|
-
decode: () => decode$1,
|
|
30
|
-
encode: () => encode
|
|
36
|
+
//#region src/providers/vercel/index.ts
|
|
37
|
+
var vercel_exports = /* @__PURE__ */ __exportAll({
|
|
38
|
+
Auth: () => auth_exports$1,
|
|
39
|
+
Client: () => client_exports$1,
|
|
40
|
+
discovery: () => discovery$1,
|
|
41
|
+
make: () => make$1
|
|
31
42
|
});
|
|
32
|
-
function decode$1(input) {
|
|
33
|
-
return Effect.runPromise(decode$3(input));
|
|
34
|
-
}
|
|
35
43
|
//#endregion
|
|
36
|
-
//#region src/
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
//#region src/transport.ts
|
|
45
|
+
var transport_exports = /* @__PURE__ */ __exportAll({
|
|
46
|
+
ApplyResult: () => ApplyResult,
|
|
47
|
+
AuthenticationMethod: () => AuthenticationMethod,
|
|
48
|
+
AuthenticationParameter: () => AuthenticationParameter,
|
|
49
|
+
CleanupOperation: () => CleanupOperation,
|
|
50
|
+
CleanupPlan: () => CleanupPlan,
|
|
51
|
+
CleanupResult: () => CleanupResult,
|
|
52
|
+
Connected: () => Connected,
|
|
53
|
+
ConnectionResult: () => ConnectionResult,
|
|
54
|
+
ConnectionSnapshot: () => ConnectionSnapshot,
|
|
55
|
+
Disconnected: () => Disconnected,
|
|
56
|
+
DnsRecord: () => DnsRecord,
|
|
57
|
+
Failure: () => Failure,
|
|
58
|
+
Method: () => Method,
|
|
59
|
+
Observation: () => Observation,
|
|
60
|
+
ObservationEvidence: () => ObservationEvidence,
|
|
61
|
+
OperationResult: () => OperationResult,
|
|
62
|
+
PlanOperation: () => PlanOperation,
|
|
63
|
+
Provider: () => Provider,
|
|
64
|
+
ProvisioningPlan: () => ProvisioningPlan,
|
|
65
|
+
Redirect: () => Redirect,
|
|
66
|
+
RemoveDomainResult: () => RemoveDomainResult,
|
|
67
|
+
ReusableConnection: () => ReusableConnection,
|
|
68
|
+
Service: () => Service,
|
|
69
|
+
Unsupported: () => Unsupported,
|
|
70
|
+
fromAsync: () => fromAsync,
|
|
71
|
+
fromDnsRecord: () => fromDnsRecord,
|
|
72
|
+
layerFromAsync: () => layerFromAsync,
|
|
73
|
+
toAsync: () => toAsync
|
|
74
|
+
});
|
|
75
|
+
/** A user-presentable failure at the application transport boundary. */
|
|
76
|
+
var Failure = class extends Schema.TaggedError()("Failure", {
|
|
77
|
+
message: Schema.String,
|
|
78
|
+
operation: Schema.String,
|
|
79
|
+
retry: Schema.Literals([
|
|
80
|
+
"never",
|
|
81
|
+
"after-user-action",
|
|
82
|
+
"safe",
|
|
83
|
+
"unknown"
|
|
84
|
+
])
|
|
85
|
+
}) {};
|
|
86
|
+
const AuthenticationParameter = Schema.Struct({
|
|
87
|
+
description: Schema.optionalKey(Schema.String),
|
|
88
|
+
key: Schema.String,
|
|
89
|
+
label: Schema.String,
|
|
90
|
+
placeholder: Schema.optionalKey(Schema.String),
|
|
91
|
+
required: Schema.optionalKey(Schema.Boolean)
|
|
92
|
+
});
|
|
93
|
+
const AuthenticationMethod = Schema.TaggedUnion({
|
|
94
|
+
OAuth: { label: Schema.String },
|
|
95
|
+
Token: {
|
|
96
|
+
label: Schema.String,
|
|
97
|
+
parameters: Schema.optionalKey(Schema.Array(AuthenticationParameter)),
|
|
98
|
+
placeholder: Schema.optionalKey(Schema.String)
|
|
99
|
+
}
|
|
41
100
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
101
|
+
const Method = Data.taggedEnum();
|
|
102
|
+
const Provider = Schema.Struct({
|
|
103
|
+
authentication: Schema.Array(AuthenticationMethod),
|
|
104
|
+
id: Schema.String,
|
|
105
|
+
name: Schema.String
|
|
106
|
+
});
|
|
107
|
+
const Connected = Schema.TaggedStruct("Connected", {
|
|
108
|
+
connectionId: Schema.String,
|
|
109
|
+
domain: Schema.String,
|
|
110
|
+
provider: Provider
|
|
111
|
+
});
|
|
112
|
+
const ReusableConnection = Schema.Struct({
|
|
113
|
+
connectionId: Schema.String,
|
|
114
|
+
label: Schema.String
|
|
115
|
+
});
|
|
116
|
+
const Disconnected = Schema.TaggedStruct("Disconnected", {
|
|
117
|
+
domain: Schema.String,
|
|
118
|
+
provider: Provider,
|
|
119
|
+
reusableConnection: Schema.optionalKey(ReusableConnection)
|
|
120
|
+
});
|
|
121
|
+
const Unsupported = Schema.TaggedStruct("Unsupported", { domain: Schema.String });
|
|
122
|
+
const ConnectionSnapshot = Schema.Union([
|
|
123
|
+
Connected,
|
|
124
|
+
Disconnected,
|
|
125
|
+
Unsupported
|
|
126
|
+
]).pipe(Schema.toTaggedUnion("_tag"));
|
|
127
|
+
const Redirect = Schema.TaggedStruct("Redirect", { authorizationUrl: Schema.String });
|
|
128
|
+
const ConnectionResult = Schema.Union([Connected, Redirect]).pipe(Schema.toTaggedUnion("_tag"));
|
|
129
|
+
const RemoveDomainResult = Schema.TaggedStruct("Removed", {
|
|
130
|
+
connectionId: Schema.String,
|
|
131
|
+
domain: Schema.String,
|
|
132
|
+
remainingDomainCount: Schema.Int
|
|
133
|
+
});
|
|
134
|
+
/** A presentation projection of a DNS requirement. */
|
|
135
|
+
const DnsRecord = Schema.Struct({
|
|
136
|
+
id: Schema.String,
|
|
137
|
+
name: Schema.String,
|
|
138
|
+
priority: Schema.optionalKey(Schema.Int),
|
|
139
|
+
type: Schema.String,
|
|
140
|
+
value: Schema.String
|
|
141
|
+
});
|
|
142
|
+
/** Projects DomainKit's operational record into its application transport representation. */
|
|
143
|
+
const fromDnsRecord = (id, record) => {
|
|
144
|
+
switch (record._tag) {
|
|
145
|
+
case "A":
|
|
146
|
+
case "AAAA": return {
|
|
147
|
+
id,
|
|
148
|
+
name: record.name,
|
|
149
|
+
type: record._tag,
|
|
150
|
+
value: record.address
|
|
151
|
+
};
|
|
152
|
+
case "CNAME":
|
|
153
|
+
case "NS": return {
|
|
154
|
+
id,
|
|
155
|
+
name: record.name,
|
|
156
|
+
type: record._tag,
|
|
157
|
+
value: record.target
|
|
158
|
+
};
|
|
159
|
+
case "TXT": return {
|
|
160
|
+
id,
|
|
161
|
+
name: record.name,
|
|
162
|
+
type: record._tag,
|
|
163
|
+
value: record.value
|
|
164
|
+
};
|
|
165
|
+
case "MX": return {
|
|
166
|
+
id,
|
|
167
|
+
name: record.name,
|
|
168
|
+
priority: record.priority,
|
|
169
|
+
type: record._tag,
|
|
170
|
+
value: record.exchange
|
|
171
|
+
};
|
|
172
|
+
case "CAA": return {
|
|
173
|
+
id,
|
|
174
|
+
name: record.name,
|
|
175
|
+
type: record._tag,
|
|
176
|
+
value: `${record.flags} ${record.tag} ${record.value}`
|
|
177
|
+
};
|
|
178
|
+
case "SRV": return {
|
|
179
|
+
id,
|
|
180
|
+
name: record.name,
|
|
181
|
+
priority: record.priority,
|
|
182
|
+
type: record._tag,
|
|
183
|
+
value: `${record.weight} ${record.port} ${record.target}`
|
|
84
184
|
};
|
|
85
|
-
case "SelectionRequired": return outcome;
|
|
86
185
|
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
Cname: () => Cname,
|
|
103
|
-
Mx: () => Mx,
|
|
104
|
-
Ns: () => Ns,
|
|
105
|
-
Observed: () => Observed,
|
|
106
|
-
Opaque: () => Opaque,
|
|
107
|
-
RequirementMetadata: () => RequirementMetadata,
|
|
108
|
-
Schema: () => Schema$1,
|
|
109
|
-
Srv: () => Srv,
|
|
110
|
-
Txt: () => Txt,
|
|
111
|
-
Type: () => Type,
|
|
112
|
-
data: () => data,
|
|
113
|
-
equals: () => equals,
|
|
114
|
-
parse: () => parse
|
|
186
|
+
};
|
|
187
|
+
const PlanOperation = Schema.TaggedUnion({
|
|
188
|
+
Conflict: {
|
|
189
|
+
id: Schema.String,
|
|
190
|
+
reason: Schema.String,
|
|
191
|
+
record: DnsRecord
|
|
192
|
+
},
|
|
193
|
+
Create: {
|
|
194
|
+
id: Schema.String,
|
|
195
|
+
record: DnsRecord
|
|
196
|
+
},
|
|
197
|
+
Noop: {
|
|
198
|
+
id: Schema.String,
|
|
199
|
+
record: DnsRecord
|
|
200
|
+
}
|
|
115
201
|
});
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
parse: () => parse$1
|
|
202
|
+
const ProvisioningPlan = Schema.TaggedStruct("Plan", {
|
|
203
|
+
digest: Schema.String,
|
|
204
|
+
expiresAt: Schema.String,
|
|
205
|
+
operations: Schema.Array(PlanOperation)
|
|
121
206
|
});
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
decode: () => decode,
|
|
130
|
-
decodeReceipt: () => decodeReceipt,
|
|
131
|
-
encode: () => encode$1,
|
|
132
|
-
encodeReceipt: () => encodeReceipt
|
|
207
|
+
const OperationResult = Schema.TaggedUnion({
|
|
208
|
+
Applied: { operationId: Schema.String },
|
|
209
|
+
Failed: {
|
|
210
|
+
message: Schema.String,
|
|
211
|
+
operationId: Schema.String
|
|
212
|
+
},
|
|
213
|
+
Unchanged: { operationId: Schema.String }
|
|
133
214
|
});
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
Authorization: () => Authorization$1,
|
|
144
|
-
Error: () => Error$1,
|
|
145
|
-
Operation: () => Operation$1,
|
|
146
|
-
PartialError: () => PartialError,
|
|
147
|
-
Plan: () => Plan,
|
|
148
|
-
Receipt: () => Receipt$1,
|
|
149
|
-
apply: () => apply$1,
|
|
150
|
-
authorize: () => authorize$1,
|
|
151
|
-
create: () => create$1
|
|
215
|
+
const ApplyOutcomeFields = {
|
|
216
|
+
operationId: Schema.String,
|
|
217
|
+
receiptId: Schema.String,
|
|
218
|
+
results: Schema.Array(OperationResult)
|
|
219
|
+
};
|
|
220
|
+
const ApplyResult = Schema.TaggedUnion({
|
|
221
|
+
Applied: ApplyOutcomeFields,
|
|
222
|
+
Partial: ApplyOutcomeFields,
|
|
223
|
+
Stale: { message: Schema.String }
|
|
152
224
|
});
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
return Effect.runPromise(apply$2({
|
|
165
|
-
authorization: input.authorization,
|
|
166
|
-
plan: input.plan,
|
|
167
|
-
...input.priorReceipt === void 0 ? {} : { priorReceipt: input.priorReceipt }
|
|
168
|
-
}).pipe(Effect.provide(Layer.merge(layerFromAsync(input.provider), webCryptoLayer))));
|
|
169
|
-
}
|
|
170
|
-
//#endregion
|
|
171
|
-
//#region src/promise/provisioning.ts
|
|
172
|
-
var provisioning_exports = /* @__PURE__ */ __exportAll({
|
|
173
|
-
CreateResult: () => CreateResult,
|
|
174
|
-
Target: () => Target,
|
|
175
|
-
apply: () => apply,
|
|
176
|
-
authorize: () => authorize,
|
|
177
|
-
authorizeForConnection: () => authorizeForConnection,
|
|
178
|
-
create: () => create,
|
|
179
|
-
renderManualInstructions: () => renderManualInstructions
|
|
225
|
+
const ObservationEvidence = Schema.TaggedUnion({
|
|
226
|
+
Found: { recordId: Schema.String },
|
|
227
|
+
Mismatch: {
|
|
228
|
+
message: Schema.String,
|
|
229
|
+
recordId: Schema.String
|
|
230
|
+
},
|
|
231
|
+
Missing: { recordId: Schema.String },
|
|
232
|
+
Unavailable: {
|
|
233
|
+
message: Schema.String,
|
|
234
|
+
recordId: Schema.String
|
|
235
|
+
}
|
|
180
236
|
});
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
237
|
+
const Observation = Schema.TaggedStruct("Observation", {
|
|
238
|
+
provider: Schema.Array(ObservationEvidence),
|
|
239
|
+
publicDns: Schema.Array(ObservationEvidence)
|
|
240
|
+
});
|
|
241
|
+
const CleanupOperation = Schema.TaggedUnion({
|
|
242
|
+
AlreadyAbsent: {
|
|
243
|
+
id: Schema.String,
|
|
244
|
+
record: DnsRecord
|
|
245
|
+
},
|
|
246
|
+
Blocked: {
|
|
247
|
+
id: Schema.String,
|
|
248
|
+
reason: Schema.String,
|
|
249
|
+
record: DnsRecord
|
|
250
|
+
},
|
|
251
|
+
Delete: {
|
|
252
|
+
id: Schema.String,
|
|
253
|
+
record: DnsRecord
|
|
185
254
|
}
|
|
186
|
-
const { provider, ...programInput } = input;
|
|
187
|
-
return Effect.runPromise(create$3(programInput).pipe(Effect.provide(Layer.merge(layerFromAsync(provider), webCryptoLayer))));
|
|
188
|
-
}
|
|
189
|
-
function authorize(plan, operationIds, options = {}) {
|
|
190
|
-
return Effect.runPromise(authorize$4(plan, operationIds, options).pipe(Effect.provide(webCryptoLayer)));
|
|
191
|
-
}
|
|
192
|
-
function apply(input) {
|
|
193
|
-
return Effect.runPromise(apply$3({
|
|
194
|
-
authorization: input.authorization,
|
|
195
|
-
plan: input.plan
|
|
196
|
-
}).pipe(Effect.provide(Layer.merge(layerFromAsync(input.provider), webCryptoLayer))));
|
|
197
|
-
}
|
|
198
|
-
function authorizeForConnection(input) {
|
|
199
|
-
return Effect.runPromise(authorize$2(input).pipe(Effect.provide(webCryptoLayer)));
|
|
200
|
-
}
|
|
201
|
-
const renderManualInstructions = renderManualInstructions$1;
|
|
202
|
-
//#endregion
|
|
203
|
-
//#region src/promise/verification.ts
|
|
204
|
-
var verification_exports = /* @__PURE__ */ __exportAll({
|
|
205
|
-
Provider: () => Provider,
|
|
206
|
-
ProviderObservation: () => ProviderObservation,
|
|
207
|
-
PublicDns: () => PublicDns,
|
|
208
|
-
PublicDnsObservation: () => PublicDnsObservation,
|
|
209
|
-
Result: () => Result,
|
|
210
|
-
observe: () => observe
|
|
211
255
|
});
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
if (input.resolvers !== void 0) program = program.pipe(Effect.provide(Layer.succeed(Service$1, make$4(input.resolvers.map((entry) => ({
|
|
226
|
-
id: entry.id,
|
|
227
|
-
resolver: fromAsyncResolver(entry.resolver),
|
|
228
|
-
...entry.timeoutMs === void 0 ? {} : { timeoutMs: entry.timeoutMs }
|
|
229
|
-
}))))));
|
|
230
|
-
return Effect.runPromise(program);
|
|
231
|
-
}
|
|
232
|
-
function fromAsyncResolver(resolver) {
|
|
233
|
-
return { resolve: (query) => Effect.tryPromise({
|
|
234
|
-
try: () => resolver.resolve(query),
|
|
235
|
-
catch: (cause) => new Error$2({
|
|
236
|
-
cause,
|
|
237
|
-
message: cause instanceof globalThis.Error ? cause.message : String(cause),
|
|
238
|
-
reason: "transport"
|
|
239
|
-
})
|
|
240
|
-
}).pipe(Effect.flatMap((resolution) => {
|
|
241
|
-
switch (resolution._tag) {
|
|
242
|
-
case "answer":
|
|
243
|
-
case "nodata": return Effect.succeed(resolution);
|
|
244
|
-
case "timeout": return Effect.fail(new Error$2({
|
|
245
|
-
message: "DNS query timed out",
|
|
246
|
-
reason: "timeout"
|
|
247
|
-
}));
|
|
248
|
-
case "failure": return Effect.fail(new Error$2({
|
|
249
|
-
message: resolution.message,
|
|
250
|
-
reason: "transport"
|
|
251
|
-
}));
|
|
252
|
-
}
|
|
253
|
-
})) };
|
|
254
|
-
}
|
|
255
|
-
//#endregion
|
|
256
|
-
//#region src/promise/cloudflare-doh.ts
|
|
257
|
-
var cloudflare_doh_exports = /* @__PURE__ */ __exportAll({ make: () => make$3 });
|
|
258
|
-
function make$3(options = {}) {
|
|
259
|
-
return toAsync$1(options);
|
|
260
|
-
}
|
|
261
|
-
//#endregion
|
|
262
|
-
//#region src/promise/doh.ts
|
|
263
|
-
var doh_exports = /* @__PURE__ */ __exportAll({ make: () => make$2 });
|
|
264
|
-
function make$2(options) {
|
|
265
|
-
return toAsync$2(options);
|
|
266
|
-
}
|
|
267
|
-
//#endregion
|
|
268
|
-
//#region src/promise/google-doh.ts
|
|
269
|
-
var google_doh_exports = /* @__PURE__ */ __exportAll({ make: () => make$1 });
|
|
270
|
-
function make$1(options = {}) {
|
|
271
|
-
return toAsync$3(options);
|
|
272
|
-
}
|
|
273
|
-
//#endregion
|
|
274
|
-
//#region src/promise/resolver-pool.ts
|
|
275
|
-
var resolver_pool_exports = /* @__PURE__ */ __exportAll({
|
|
276
|
-
Observation: () => Observation,
|
|
277
|
-
Policy: () => Policy,
|
|
278
|
-
defaultMake: () => defaultMake,
|
|
279
|
-
make: () => make
|
|
256
|
+
const CleanupPlan = Schema.TaggedStruct("CleanupPlan", {
|
|
257
|
+
digest: Schema.String,
|
|
258
|
+
expiresAt: Schema.String,
|
|
259
|
+
operations: Schema.Array(CleanupOperation)
|
|
260
|
+
});
|
|
261
|
+
const CleanupOutcomeFields = {
|
|
262
|
+
operationId: Schema.String,
|
|
263
|
+
results: Schema.Array(OperationResult)
|
|
264
|
+
};
|
|
265
|
+
const CleanupResult = Schema.TaggedUnion({
|
|
266
|
+
Cleaned: CleanupOutcomeFields,
|
|
267
|
+
Partial: CleanupOutcomeFields,
|
|
268
|
+
Stale: { message: Schema.String }
|
|
280
269
|
});
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
function defaultMake(options = {}) {
|
|
289
|
-
return toAsync(defaultMake$1(options));
|
|
290
|
-
}
|
|
291
|
-
function toAsync(pool) {
|
|
292
|
-
return { observe: (query) => Effect.runPromise(pool.observe(query)) };
|
|
293
|
-
}
|
|
294
|
-
function asyncResolver(resolver) {
|
|
295
|
-
return { resolve: (query) => Effect.tryPromise({
|
|
296
|
-
try: () => resolver.resolve(query),
|
|
297
|
-
catch: (cause) => new Error$2({
|
|
298
|
-
cause,
|
|
270
|
+
var Service = class extends Context.Service()("@domainkit/Transport") {};
|
|
271
|
+
/** Converts a Promise-shaped host implementation into the canonical Effect service. */
|
|
272
|
+
const fromAsync = (transport, options = {}) => {
|
|
273
|
+
const attempt = (operation, evaluate) => Effect.tryPromise({
|
|
274
|
+
try: evaluate,
|
|
275
|
+
catch: (cause) => options.onError?.(operation, cause) ?? (cause instanceof Failure ? cause : new Failure({
|
|
299
276
|
message: cause instanceof globalThis.Error ? cause.message : String(cause),
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
|
|
277
|
+
operation,
|
|
278
|
+
retry: "unknown"
|
|
279
|
+
}))
|
|
280
|
+
});
|
|
281
|
+
return Service.of({
|
|
282
|
+
cleanup: {
|
|
283
|
+
apply: (input) => attempt("cleanup.apply", () => transport.cleanup.apply(input)),
|
|
284
|
+
plan: (input) => attempt("cleanup.plan", () => transport.cleanup.plan(input))
|
|
285
|
+
},
|
|
286
|
+
connection: {
|
|
287
|
+
connect: (input) => attempt("connection.connect", () => transport.connection.connect(input)),
|
|
288
|
+
inspect: (input) => attempt("connection.inspect", () => transport.connection.inspect(input)),
|
|
289
|
+
removeDomain: (input) => attempt("connection.removeDomain", () => transport.connection.removeDomain(input)),
|
|
290
|
+
reuse: (input) => attempt("connection.reuse", () => transport.connection.reuse(input))
|
|
291
|
+
},
|
|
292
|
+
provisioning: {
|
|
293
|
+
apply: (input) => attempt("provisioning.apply", () => transport.provisioning.apply(input)),
|
|
294
|
+
plan: (input) => attempt("provisioning.plan", () => transport.provisioning.plan(input))
|
|
295
|
+
},
|
|
296
|
+
verification: { observe: (input) => attempt("verification.observe", () => transport.verification.observe(input)) }
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
const layerFromAsync = (transport, options) => Layer.succeed(Service, fromAsync(transport, options));
|
|
300
|
+
/** Converts an environment-free Effect service into its Promise-shaped host seam. */
|
|
301
|
+
const toAsync = (transport) => ({
|
|
302
|
+
cleanup: {
|
|
303
|
+
apply: (input) => Effect.runPromise(transport.cleanup.apply(input)),
|
|
304
|
+
plan: (input) => Effect.runPromise(transport.cleanup.plan(input))
|
|
305
|
+
},
|
|
306
|
+
connection: {
|
|
307
|
+
connect: (input) => Effect.runPromise(transport.connection.connect(input)),
|
|
308
|
+
inspect: (input) => Effect.runPromise(transport.connection.inspect(input)),
|
|
309
|
+
removeDomain: (input) => Effect.runPromise(transport.connection.removeDomain(input)),
|
|
310
|
+
reuse: (input) => Effect.runPromise(transport.connection.reuse(input))
|
|
311
|
+
},
|
|
312
|
+
provisioning: {
|
|
313
|
+
apply: (input) => Effect.runPromise(transport.provisioning.apply(input)),
|
|
314
|
+
plan: (input) => Effect.runPromise(transport.provisioning.plan(input))
|
|
315
|
+
},
|
|
316
|
+
verification: { observe: (input) => Effect.runPromise(transport.verification.observe(input)) }
|
|
317
|
+
});
|
|
317
318
|
//#endregion
|
|
318
319
|
//#region src/index.ts
|
|
319
320
|
/** The current package version from the package manifest. */
|
|
320
321
|
const VERSION = version;
|
|
321
322
|
//#endregion
|
|
322
|
-
export {
|
|
323
|
+
export { lifecycle_repository_exports as AuthorizationLifecycle, cloudflare_exports as Cloudflare, cloudflare_doh_exports as CloudflareDnsOverHttps, connection_api_exports as Connection, connection_authorization_exports as ConnectionAuthorization, deletion_exports as Deletion, diagnostic_exports as Diagnostic, canonical_json_exports as Digest, dns_data_exports as DnsData, doh_exports as DnsOverHttps, types_exports as DnsPlan, provider_exports as DnsProvider, dns_record_exports as DnsRecord, resolver_exports as DnsResolver, resolver_pool_exports as DnsResolverPool, domain_name_exports as DomainName, google_doh_exports as GoogleDnsOverHttps, invalid_input_exports as InvalidInput, manifest_exports as ProviderAuth, authorization_exports as ProviderAuthorization, provider_context_exports as ProviderContext, selection_exports as ProviderDiscovery, plan_exports as Provisioning, secret_exports as Secret, transport_exports as Transport, VERSION, vercel_exports as Vercel, verify_exports as Verification, zone_discovery_exports as ZoneDiscovery, zones_exports as Zones };
|
|
323
324
|
|
|
324
325
|
//# sourceMappingURL=index.mjs.map
|