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
@@ -1,1388 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { D as parse$1, O as Error$3, T as decode$4, _ as equals, b as Service, h as decode$5, m as data, s as Observed, u as Schema$6, w as Schema$5, y as Error$4 } from "./dns-record-C_KwGPLf.mjs";
3
- import { l as candidates } from "./auth-B0owkrpk.mjs";
4
- import { a as toAsync$2, m as Service$3, n as Service$5, o as Service$4, t as Error$5, u as Service$2, v as Service$1 } from "./resolver-tEXpKxmH.mjs";
5
- import { c as Value } from "./client-BnD7QLRF.mjs";
6
- import { Cause, Clock, Crypto, Effect, Layer, PlatformError, Schema, SchemaIssue, SchemaTransformation } from "effect";
7
- import * as oauth from "oauth4webapi";
8
- import * as DnsPacket from "@leichtgewicht/dns-packet";
9
- //#region package.json
10
- var version = "0.1.1";
11
- //#endregion
12
- //#region src/auth/connection.ts
13
- var connection_exports = /* @__PURE__ */ __exportAll({
14
- AuthorizationError: () => AuthorizationError$1,
15
- Grant: () => Grant,
16
- Schema: () => Schema$4,
17
- assertGrant: () => assertGrant,
18
- decode: () => decode$3,
19
- encode: () => encode$2,
20
- validate: () => validate$3
21
- });
22
- const Grant = Schema.TaggedUnion({
23
- account: {},
24
- domains: { domains: Schema.Array(Schema$5) }
25
- });
26
- /** An owner-scoped grant bound to one provider authorization. */
27
- const Schema$4 = Schema.Struct({
28
- authorizationId: Schema.String,
29
- createdAt: Schema.DateFromString,
30
- grant: Grant,
31
- id: Schema.String,
32
- ownerId: Schema.String
33
- });
34
- const decode$3 = Effect.fn("Connection.decode")((input) => Schema.decodeUnknownEffect(Schema$4)(input).pipe(Effect.mapError((cause) => new Error$3({ message: cause.message }))));
35
- const validate$3 = Effect.fn("Connection.validate")((input) => Schema.decodeUnknownEffect(Schema.toType(Schema$4))(input).pipe(Effect.mapError((cause) => new Error$3({ message: cause.message }))));
36
- const encode$2 = Schema.encodeSync(Schema$4);
37
- var AuthorizationError$1 = class extends Schema.TaggedError()("AuthorizationError", { message: Schema.String }) {};
38
- function assertGrant(connection, authorization, request) {
39
- if (connection.authorizationId !== authorization.id || authorization.providerId !== request.providerId) throw new AuthorizationError$1({ message: "Connection does not grant this provider account" });
40
- if (authorization.expiresAt !== null) {
41
- if (Number.isNaN(authorization.expiresAt.getTime())) throw new AuthorizationError$1({ message: "Connection expiration is invalid" });
42
- if (authorization.expiresAt <= (request.now ?? /* @__PURE__ */ new Date())) throw new AuthorizationError$1({ message: "Connection has expired" });
43
- }
44
- if (!authorization.capabilities.includes(request.capability)) throw new AuthorizationError$1({ message: `Connection lacks the ${request.capability} capability` });
45
- let domain;
46
- try {
47
- domain = parse$1(request.domain);
48
- } catch (cause) {
49
- if (cause instanceof Error$3) throw cause;
50
- throw new Error$3({ message: cause instanceof Error ? cause.message : String(cause) });
51
- }
52
- if (connection.grant._tag === "domains" && !connection.grant.domains.includes(domain)) throw new AuthorizationError$1({ message: "Connection does not grant this domain" });
53
- return domain;
54
- }
55
- //#endregion
56
- //#region src/auth/connection-lifecycle.ts
57
- var connection_lifecycle_exports = /* @__PURE__ */ __exportAll({
58
- Error: () => Error$2,
59
- detach: () => detach,
60
- updateGrant: () => updateGrant
61
- });
62
- var Error$2 = class extends Schema.TaggedError()("ConnectionLifecycleError", { message: Schema.String }) {};
63
- /** Replace the grant on an owner binding after the host has obtained explicit consent. */
64
- const updateGrant = Effect.fn("ConnectionLifecycle.updateGrant")(function* (input) {
65
- const connectionStore = yield* Service$1;
66
- const connection = yield* validate$3({
67
- ...input.connection,
68
- grant: input.grant
69
- });
70
- yield* connectionStore.put(connection);
71
- return connection;
72
- });
73
- /**
74
- * Detach one owner binding. The final binding invokes provider revocation before deleting local
75
- * credential and authorization state. The callback keeps provider-specific revocation outside the
76
- * portable authorization model.
77
- */
78
- function detach(input) {
79
- return Effect.gen(function* () {
80
- const authorizationStore = yield* Service$2;
81
- const connectionStore = yield* Service$1;
82
- const credentialStore = yield* Service$3;
83
- const connection = yield* connectionStore.get(input.connectionId);
84
- if (connection === null) return yield* new Error$2({ message: "Connection binding does not exist" });
85
- const remainingBindings = (yield* connectionStore.listByAuthorizationId(connection.authorizationId)).filter(({ id }) => id !== connection.id);
86
- if (remainingBindings.length > 0) {
87
- yield* connectionStore.delete(connection.id);
88
- return {
89
- connection,
90
- remainingBindings: remainingBindings.length,
91
- revokedAuthorization: false
92
- };
93
- }
94
- const authorization = yield* authorizationStore.get(connection.authorizationId);
95
- if (authorization === null) {
96
- yield* credentialStore.delete(connection.authorizationId);
97
- yield* connectionStore.delete(connection.id);
98
- return {
99
- connection,
100
- remainingBindings: 0,
101
- revokedAuthorization: true
102
- };
103
- }
104
- yield* input.revokeAuthorization(authorization);
105
- yield* credentialStore.delete(authorization.id);
106
- yield* authorizationStore.delete(authorization.id);
107
- yield* connectionStore.delete(connection.id);
108
- return {
109
- connection,
110
- remainingBindings: 0,
111
- revokedAuthorization: true
112
- };
113
- });
114
- }
115
- //#endregion
116
- //#region src/auth/authorization.ts
117
- var authorization_exports = /* @__PURE__ */ __exportAll({
118
- Capability: () => Capability,
119
- Schema: () => Schema$3,
120
- decode: () => decode$2,
121
- encode: () => encode$1,
122
- validate: () => validate$2
123
- });
124
- const Capability = Schema.Literals(["dns:read", "dns:write"]);
125
- /** A provider credential authorization shared by one or more owner connections. */
126
- const Schema$3 = Schema.Struct({
127
- accountId: Schema.String,
128
- capabilities: Schema.Array(Capability),
129
- createdAt: Schema.DateFromString,
130
- expiresAt: Schema.NullOr(Schema.DateFromString),
131
- id: Schema.String,
132
- kind: Schema.Literals(["oauth2", "token"]),
133
- providerId: Schema.String,
134
- scopes: Schema.Array(Schema.String),
135
- subjectId: Schema.String
136
- });
137
- const decode$2 = Effect.fn("ProviderAuthorization.decode")((input) => Schema.decodeUnknownEffect(Schema$3)(input).pipe(Effect.mapError((cause) => new Error$3({ message: cause.message }))));
138
- const validate$2 = Effect.fn("ProviderAuthorization.validate")((input) => Schema.decodeUnknownEffect(Schema.toType(Schema$3))(input).pipe(Effect.mapError((cause) => new Error$3({ message: cause.message }))));
139
- const encode$1 = Schema.encodeSync(Schema$3);
140
- //#endregion
141
- //#region src/plan/canonical-json.ts
142
- var canonical_json_exports = /* @__PURE__ */ __exportAll({
143
- CryptoError: () => CryptoError,
144
- sha256Encoded: () => sha256Encoded,
145
- sha256Json: () => sha256Json,
146
- sha256Text: () => sha256Text,
147
- stringify: () => stringify,
148
- webCryptoLayer: () => webCryptoLayer
149
- });
150
- var CryptoError = class extends Schema.TaggedError()("CryptoError", { message: Schema.String }) {};
151
- /** Deterministic JSON serialization for already schema-encoded protocol values. */
152
- function stringify(value) {
153
- if (value === null || typeof value !== "object") {
154
- const encoded = JSON.stringify(value);
155
- if (encoded === void 0) throw new TypeError("Value is not representable as JSON");
156
- return encoded;
157
- }
158
- if (isJsonArray(value)) return `[${value.map(stringify).join(",")}]`;
159
- return `{${Object.entries(value).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([key, entry]) => `${JSON.stringify(key)}:${stringify(entry)}`).join(",")}}`;
160
- }
161
- function isJsonArray(value) {
162
- return Array.isArray(value);
163
- }
164
- const sha256Text = Effect.fn("Digest.sha256Text")(function* (value) {
165
- return [...yield* (yield* Crypto.Crypto).digest("SHA-256", new TextEncoder().encode(value)).pipe(Effect.mapError((cause) => new CryptoError({ message: cause.message })))].map((byte) => byte.toString(16).padStart(2, "0")).join("");
166
- });
167
- const sha256Json = Effect.fn("Digest.sha256Json")((value) => Effect.try({
168
- try: () => stringify(value),
169
- catch: (cause) => new CryptoError({ message: cause instanceof Error ? cause.message : String(cause) })
170
- }).pipe(Effect.flatMap(sha256Text)));
171
- function sha256EncodedProgram(schema, value) {
172
- return Schema.encodeEffect(schema)(value).pipe(Effect.mapError((cause) => new CryptoError({ message: cause.message })), Effect.flatMap(Schema.decodeUnknownEffect(Schema.Json)), Effect.mapError((cause) => new CryptoError({ message: cause.message })), Effect.flatMap(sha256Json));
173
- }
174
- const sha256Encoded = Effect.fn("Digest.sha256Encoded")(sha256EncodedProgram);
175
- /** Portable Web Crypto implementation for hosts that want a ready-made Layer. */
176
- const webCryptoLayer = Layer.succeed(Crypto.Crypto, Crypto.make({
177
- randomBytes: (size) => crypto.getRandomValues(new Uint8Array(size)),
178
- digest: (algorithm, data) => Effect.tryPromise({
179
- try: async () => {
180
- const bytes = new Uint8Array(data.byteLength);
181
- bytes.set(data);
182
- return new Uint8Array(await crypto.subtle.digest(algorithm, bytes.buffer));
183
- },
184
- catch: (cause) => PlatformError.systemError({
185
- _tag: "Unknown",
186
- module: "WebCrypto",
187
- method: "digest",
188
- cause
189
- })
190
- })
191
- }));
192
- //#endregion
193
- //#region src/auth/oauth.ts
194
- var oauth_exports = /* @__PURE__ */ __exportAll({
195
- begin: () => begin,
196
- complete: () => complete,
197
- refresh: () => refresh,
198
- revoke: () => revoke
199
- });
200
- function beginProgram(input) {
201
- return Effect.gen(function* () {
202
- const stateStore = yield* Service$4;
203
- const cryptoService = yield* Crypto.Crypto;
204
- const now = yield* Clock.currentTimeMillis;
205
- const state = base64Url(yield* cryptoBytes(cryptoService, 32));
206
- const codeVerifier = base64Url(yield* cryptoBytes(cryptoService, 32));
207
- const challenge = base64Url(yield* cryptoService.digest("SHA-256", new TextEncoder().encode(codeVerifier)).pipe(Effect.mapError((cause) => new CryptoError({ message: cause.message }))));
208
- const stateHash = yield* sha256Text(state);
209
- const authorizationUrl = new URL(input.method.authorizationServer.authorization_endpoint);
210
- authorizationUrl.search = new URLSearchParams({
211
- client_id: input.client.clientId,
212
- code_challenge: challenge,
213
- code_challenge_method: "S256",
214
- redirect_uri: input.redirectUri,
215
- response_type: "code",
216
- scope: input.method.scopes.join(" "),
217
- state
218
- }).toString();
219
- yield* stateStore.put({
220
- clientId: input.client.clientId,
221
- codeVerifier: Value.from(codeVerifier),
222
- expiresAt: new Date(now + (input.ttlMs ?? 6e5)),
223
- grant: input.grant,
224
- method: input.method,
225
- ownerId: input.ownerId,
226
- redirectUri: input.redirectUri,
227
- stateHash,
228
- subjectId: input.subjectId
229
- });
230
- return { authorizationUrl };
231
- });
232
- }
233
- function completeProgram(input) {
234
- return Effect.gen(function* () {
235
- const stateStore = yield* Service$4;
236
- const authorizationStore = yield* Service$2;
237
- const connectionStore = yield* Service$1;
238
- const credentialStore = yield* Service$3;
239
- const cryptoService = yield* Crypto.Crypto;
240
- const state = input.callbackUrl.searchParams.get("state");
241
- if (state === null) return yield* new AuthorizationError$1({ message: "OAuth callback is missing state" });
242
- const now = yield* Clock.currentTimeMillis;
243
- const continuation = yield* stateStore.consume(yield* sha256Text(state), new Date(now));
244
- if (continuation === null) return yield* new AuthorizationError$1({ message: "OAuth continuation is expired, unknown, or already used" });
245
- if (continuation.clientId !== input.client.clientId) return yield* new AuthorizationError$1({ message: "OAuth client does not match the continuation" });
246
- const as = continuation.method.authorizationServer;
247
- const client = { client_id: continuation.clientId };
248
- const authentication = yield* effectClientAuthentication(continuation.method, input.client);
249
- const tokens = yield* providerRequest(input.providerId, async (signal) => {
250
- const callbackParameters = oauth.validateAuthResponse(as, client, input.callbackUrl, state);
251
- const response = await oauth.authorizationCodeGrantRequest(as, client, authentication, callbackParameters, continuation.redirectUri, continuation.codeVerifier.expose(), requestOptions(input.fetch, signal));
252
- return oauth.processAuthorizationCodeResponse(as, client, response);
253
- });
254
- const accessToken = Value.from(tokens.access_token);
255
- const subject = yield* input.resolveSubject(tokens, accessToken);
256
- const existingAuthorization = yield* authorizationStore.findByProviderAccount(input.providerId, subject.accountId);
257
- const authorizationId = existingAuthorization?.id ?? (yield* cryptoService.randomUUIDv4.pipe(Effect.mapError((cause) => new CryptoError({ message: cause.message }))));
258
- const authorization = yield* validate$2({
259
- accountId: subject.accountId,
260
- capabilities: [...continuation.method.capabilities],
261
- createdAt: existingAuthorization?.createdAt ?? new Date(now),
262
- expiresAt: subject.expiresAt,
263
- id: authorizationId,
264
- kind: "oauth2",
265
- providerId: input.providerId,
266
- scopes: (tokens.scope ?? continuation.method.scopes.join(" ")).split(" ").filter(Boolean),
267
- subjectId: continuation.subjectId
268
- });
269
- const existingConnection = yield* connectionStore.find(continuation.ownerId, authorization.id);
270
- const connection = yield* validate$3({
271
- authorizationId: authorization.id,
272
- createdAt: existingConnection?.createdAt ?? new Date(now),
273
- grant: continuation.grant,
274
- id: existingConnection?.id ?? (yield* cryptoService.randomUUIDv4.pipe(Effect.mapError((cause) => new CryptoError({ message: cause.message })))),
275
- ownerId: continuation.ownerId
276
- });
277
- yield* credentialStore.put(authorization.id, {
278
- accessToken,
279
- refreshToken: tokens.refresh_token === void 0 ? null : Value.from(tokens.refresh_token),
280
- tokenType: tokens.token_type
281
- });
282
- yield* authorizationStore.put(authorization);
283
- yield* connectionStore.put(connection);
284
- return {
285
- authorization,
286
- connection
287
- };
288
- });
289
- }
290
- function refreshProgram(input) {
291
- return Effect.gen(function* () {
292
- const credentialStore = yield* Service$3;
293
- const credential = yield* requireCredential(input.authorization.id, credentialStore);
294
- const refreshToken = credential.refreshToken;
295
- if (refreshToken === null) return yield* new AuthorizationError$1({ message: "Connection has no refresh token" });
296
- const as = input.method.authorizationServer;
297
- const client = { client_id: input.client.clientId };
298
- const authentication = yield* effectClientAuthentication(input.method, input.client);
299
- const tokens = yield* providerRequest(input.authorization.providerId, async (signal) => {
300
- const response = await oauth.refreshTokenGrantRequest(as, client, authentication, refreshToken.expose(), requestOptions(input.fetch, signal));
301
- return oauth.processRefreshTokenResponse(as, client, response);
302
- });
303
- yield* credentialStore.put(input.authorization.id, {
304
- accessToken: Value.from(tokens.access_token),
305
- refreshToken: tokens.refresh_token === void 0 ? credential.refreshToken : Value.from(tokens.refresh_token),
306
- tokenType: tokens.token_type
307
- });
308
- });
309
- }
310
- function revokeProgram(input) {
311
- return Effect.gen(function* () {
312
- if (input.method.authorizationServer.revocation_endpoint === void 0) return yield* new AuthorizationError$1({ message: "Provider does not advertise token revocation" });
313
- const credentialStore = yield* Service$3;
314
- const credential = yield* requireCredential(input.authorization.id, credentialStore);
315
- const as = input.method.authorizationServer;
316
- const authentication = yield* effectClientAuthentication(input.method, input.client);
317
- yield* providerRequest(input.authorization.providerId, async (signal) => {
318
- const response = await oauth.revocationRequest(as, { client_id: input.client.clientId }, authentication, credential.accessToken.expose(), requestOptions(input.fetch, signal));
319
- await oauth.processRevocationResponse(response);
320
- });
321
- yield* credentialStore.delete(input.authorization.id);
322
- });
323
- }
324
- function effectClientAuthentication(method, client) {
325
- return Effect.try({
326
- try: () => clientAuthentication(method, client),
327
- catch: (cause) => cause instanceof Error$3 ? cause : new Error$3({ message: "OAuth client authentication is invalid" })
328
- });
329
- }
330
- function clientAuthentication(method, client) {
331
- switch (method.clientAuth) {
332
- case "none": return oauth.None();
333
- case "client_secret_basic":
334
- if (client.clientSecret === void 0) throw new Error$3({ message: "Client secret is required" });
335
- return oauth.ClientSecretBasic(client.clientSecret.expose());
336
- case "client_secret_post":
337
- if (client.clientSecret === void 0) throw new Error$3({ message: "Client secret is required" });
338
- return oauth.ClientSecretPost(client.clientSecret.expose());
339
- }
340
- }
341
- function requestOptions(fetchImplementation, signal) {
342
- return fetchImplementation === void 0 ? { signal } : {
343
- signal,
344
- [oauth.customFetch]: (url, options) => fetchImplementation(url, {
345
- ...options,
346
- body: options.body
347
- })
348
- };
349
- }
350
- function requireCredential(connectionId, store) {
351
- return store.get(connectionId).pipe(Effect.flatMap((credential) => credential === null ? Effect.fail(new AuthorizationError$1({ message: "Connection credentials are unavailable" })) : Effect.succeed(credential)));
352
- }
353
- function providerRequest(providerId, request) {
354
- return Effect.tryPromise({
355
- try: request,
356
- catch: (cause) => cause instanceof AuthorizationError$1 || cause instanceof Error$3 ? cause : new Error$4({
357
- cause,
358
- message: safeOAuthMessage(cause),
359
- operation: "oauthRequest",
360
- providerId
361
- })
362
- });
363
- }
364
- function cryptoBytes(cryptoService, size) {
365
- return cryptoService.randomBytes(size).pipe(Effect.mapError((cause) => new CryptoError({ message: cause.message })));
366
- }
367
- function base64Url(bytes) {
368
- let binary = "";
369
- for (const byte of bytes) binary += String.fromCharCode(byte);
370
- return btoa(binary).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
371
- }
372
- function safeOAuthMessage(cause) {
373
- return cause instanceof Error ? cause.name : "OAuth provider request failed";
374
- }
375
- const begin = Effect.fn("OAuth.begin")(beginProgram);
376
- const complete = Effect.fn("OAuth.complete")(completeProgram);
377
- const refresh = Effect.fn("OAuth.refresh")(refreshProgram);
378
- const revoke = Effect.fn("OAuth.revoke")(revokeProgram);
379
- //#endregion
380
- //#region src/auth/manifest.ts
381
- var manifest_exports = /* @__PURE__ */ __exportAll({
382
- Method: () => Method,
383
- Schema: () => Schema$2,
384
- decode: () => decode$1
385
- });
386
- const Method = Schema.TaggedUnion({
387
- integration: {
388
- capabilities: Schema.Array(Schema.Literals(["dns:read", "dns:write"])),
389
- installUrl: Schema.String,
390
- tokenEndpoint: Schema.String
391
- },
392
- oauth2: {
393
- authorizationServer: Schema.Struct({
394
- authorization_endpoint: Schema.String,
395
- issuer: Schema.String,
396
- revocation_endpoint: Schema.optionalKey(Schema.String),
397
- token_endpoint: Schema.String
398
- }),
399
- capabilities: Schema.Array(Schema.Literals(["dns:read", "dns:write"])),
400
- clientAuth: Schema.Literals([
401
- "none",
402
- "client_secret_basic",
403
- "client_secret_post"
404
- ]),
405
- scopes: Schema.Array(Schema.String)
406
- },
407
- token: {
408
- capabilities: Schema.Array(Schema.Literals(["dns:read", "dns:write"])),
409
- instructionsUrl: Schema.String
410
- }
411
- });
412
- const Schema$2 = Schema.Struct({
413
- methods: Schema.Array(Method),
414
- providerId: Schema.String
415
- });
416
- const decode$1 = Effect.fn("ProviderAuth.decode")((input) => Schema.decodeUnknownEffect(Schema$2)(input).pipe(Effect.mapError((cause) => new Error$3({ message: cause.message }))));
417
- //#endregion
418
- //#region src/auth/token.ts
419
- var token_exports = /* @__PURE__ */ __exportAll({ connect: () => connect });
420
- const connect = Effect.fn("TokenConnection.connect")(function* (input) {
421
- const authorizationStore = yield* Service$2;
422
- const connectionStore = yield* Service$1;
423
- const credentialStore = yield* Service$3;
424
- const cryptoService = yield* Crypto.Crypto;
425
- const validation = yield* input.validate(input.token);
426
- const createdAt = new Date(yield* Clock.currentTimeMillis);
427
- const existingAuthorization = yield* authorizationStore.findByProviderAccount(input.providerId, validation.accountId);
428
- const authorization = yield* validate$2({
429
- accountId: validation.accountId,
430
- capabilities: [...validation.capabilities],
431
- createdAt: existingAuthorization?.createdAt ?? createdAt,
432
- expiresAt: validation.expiresAt,
433
- id: existingAuthorization?.id ?? (yield* cryptoService.randomUUIDv4.pipe(Effect.mapError((cause) => new CryptoError({ message: cause.message })))),
434
- kind: "token",
435
- providerId: input.providerId,
436
- scopes: [...validation.scopes],
437
- subjectId: input.subjectId
438
- });
439
- const existingConnection = yield* connectionStore.find(input.ownerId, authorization.id);
440
- const connection = yield* validate$3({
441
- authorizationId: authorization.id,
442
- createdAt: existingConnection?.createdAt ?? createdAt,
443
- grant: input.grant,
444
- id: existingConnection?.id ?? (yield* cryptoService.randomUUIDv4.pipe(Effect.mapError((cause) => new CryptoError({ message: cause.message })))),
445
- ownerId: input.ownerId
446
- });
447
- yield* credentialStore.put(authorization.id, {
448
- accessToken: input.token,
449
- refreshToken: null,
450
- tokenType: "bearer"
451
- });
452
- yield* authorizationStore.put(authorization);
453
- yield* connectionStore.put(connection);
454
- return {
455
- authorization,
456
- connection
457
- };
458
- });
459
- //#endregion
460
- //#region src/discovery/selection.ts
461
- var selection_exports = /* @__PURE__ */ __exportAll({
462
- Evidence: () => Evidence,
463
- Selection: () => Selection,
464
- select: () => select
465
- });
466
- const Evidence = Schema.Struct({
467
- accountId: Schema.String,
468
- connectionId: Schema.String,
469
- decisiveNameserverMatch: Schema.Boolean,
470
- matchedNameservers: Schema.Array(Schema$5),
471
- providerId: Schema.String,
472
- zone: Schema$5
473
- });
474
- const Selection = Schema.TaggedUnion({
475
- selected: {
476
- candidate: Evidence,
477
- evidence: Schema.Array(Evidence),
478
- reason: Schema.Literals(["explicit", "unique-nameserver-match"])
479
- },
480
- manual: {
481
- evidence: Schema.Array(Evidence),
482
- reason: Schema.Literals(["ambiguous", "unsupported"])
483
- }
484
- });
485
- function select(input) {
486
- const domain = parse$1(input.domain);
487
- const zoneCandidates = new Set(candidates(domain));
488
- const authoritative = nameserverSet(input.authoritativeNameservers);
489
- const eligible = input.connectedZones.filter((connected) => {
490
- if (!zoneCandidates.has(parse$1(connected.zone))) return false;
491
- try {
492
- assertGrant(connected.connection, connected.authorization, {
493
- capability: "dns:read",
494
- domain,
495
- ...input.now === void 0 ? {} : { now: input.now },
496
- providerId: connected.providerId
497
- });
498
- return true;
499
- } catch {
500
- return false;
501
- }
502
- });
503
- const evidence = eligible.map((connected) => evidenceFor(connected, authoritative));
504
- if (input.explicit !== void 0) {
505
- const explicitZone = parse$1(input.explicit.zone);
506
- const index = eligible.findIndex((connected) => connected.providerId === input.explicit?.providerId && connected.authorization.accountId === input.explicit.accountId && parse$1(connected.zone) === explicitZone);
507
- if (index < 0) throw new AuthorizationError$1({ message: "Explicit provider zone is not connected or granted" });
508
- const candidate = evidence[index];
509
- if (candidate === void 0) throw new Error("Eligible provider evidence is missing");
510
- return {
511
- _tag: "selected",
512
- candidate,
513
- evidence,
514
- reason: "explicit"
515
- };
516
- }
517
- const decisive = evidence.filter(({ decisiveNameserverMatch }) => decisiveNameserverMatch);
518
- const candidate = decisive[0];
519
- return decisive.length === 1 && candidate !== void 0 ? {
520
- _tag: "selected",
521
- candidate,
522
- evidence,
523
- reason: "unique-nameserver-match"
524
- } : {
525
- _tag: "manual",
526
- evidence,
527
- reason: decisive.length > 1 ? "ambiguous" : "unsupported"
528
- };
529
- }
530
- function evidenceFor(connected, authoritative) {
531
- const configured = new Set(nameserverSet(connected.nameservers));
532
- const matchedNameservers = authoritative.filter((nameserver) => configured.has(nameserver));
533
- return {
534
- accountId: connected.authorization.accountId,
535
- connectionId: connected.connection.id,
536
- decisiveNameserverMatch: authoritative.length > 0 && matchedNameservers.length === authoritative.length,
537
- matchedNameservers,
538
- providerId: connected.providerId,
539
- zone: parse$1(connected.zone)
540
- };
541
- }
542
- function nameserverSet(nameservers) {
543
- return [...new Set(nameservers.map(parse$1))].sort();
544
- }
545
- //#endregion
546
- //#region src/plan/types.ts
547
- var types_exports = /* @__PURE__ */ __exportAll({
548
- Authorization: () => Authorization$1,
549
- Operation: () => Operation$1,
550
- Receipt: () => Receipt$1,
551
- Schema: () => Schema$1,
552
- decode: () => decode,
553
- decodeReceipt: () => decodeReceipt,
554
- encode: () => encode,
555
- encodeReceipt: () => encodeReceipt
556
- });
557
- const Operation$1 = Schema.TaggedUnion({
558
- create: {
559
- id: Schema.String,
560
- requirement: Schema$6
561
- },
562
- noop: {
563
- id: Schema.String,
564
- requirement: Schema$6,
565
- ttlDrift: Schema.Boolean
566
- },
567
- conflict: {
568
- existing: Schema.Array(Observed),
569
- id: Schema.String,
570
- reason: Schema.String,
571
- requirement: Schema$6
572
- }
573
- });
574
- const Schema$1 = Schema.Struct({
575
- digest: Schema.String,
576
- operations: Schema.Array(Operation$1),
577
- providerId: Schema.String,
578
- version: Schema.Literal("domainkit.dns-plan.v1"),
579
- zone: Schema$5
580
- });
581
- const Authorization$1 = Schema.Struct({
582
- allowPartial: Schema.Boolean,
583
- operationIds: Schema.Array(Schema.String),
584
- planDigest: Schema.String,
585
- version: Schema.Literal("domainkit.plan-authorization.v1")
586
- });
587
- const Receipt$1 = Schema.Struct({
588
- appliedAt: Schema.DateFromString,
589
- operations: Schema.Array(Schema.Struct({
590
- operationId: Schema.String,
591
- providerRecordId: Schema.NullOr(Schema.String)
592
- })),
593
- planDigest: Schema.String,
594
- providerId: Schema.String,
595
- status: Schema.Literals(["complete", "partial"]),
596
- version: Schema.Literal("domainkit.apply-receipt.v1"),
597
- zone: Schema$5
598
- });
599
- const decode = Effect.fn("DnsPlan.decode")((input) => Schema.decodeUnknownEffect(Schema$1)(input).pipe(Effect.mapError((cause) => new Error$3({ message: cause.message }))));
600
- const encode = Schema.encodeSync(Schema$1);
601
- const decodeReceipt = Effect.fn("DnsPlan.decodeReceipt")((input) => Schema.decodeUnknownEffect(Receipt$1)(input).pipe(Effect.mapError((cause) => new Error$3({ message: cause.message }))));
602
- const encodeReceipt = Schema.encodeSync(Receipt$1);
603
- //#endregion
604
- //#region src/plan/plan.ts
605
- var plan_exports = /* @__PURE__ */ __exportAll({
606
- AuthorizationError: () => AuthorizationError,
607
- ConflictError: () => ConflictError,
608
- PartialApplyError: () => PartialApplyError,
609
- StaleError: () => StaleError,
610
- apply: () => apply$1,
611
- authorize: () => authorize$2,
612
- create: () => create$1,
613
- renderManualInstructions: () => renderManualInstructions,
614
- validate: () => validate$1
615
- });
616
- const UnsignedPlan$1 = Schema.Struct({
617
- operations: Schema.Array(Operation$1),
618
- providerId: Schema.String,
619
- version: Schema.Literal("domainkit.dns-plan.v1"),
620
- zone: Schema$5
621
- });
622
- const RequirementDigest = Schema.Struct({ requirement: Schema$6 });
623
- var ConflictError = class extends Schema.TaggedError()("PlanConflictError", { operationIds: Schema.Array(Schema.String) }) {};
624
- var AuthorizationError = class extends Schema.TaggedError()("AuthorizationError", { message: Schema.String }) {};
625
- var StaleError = class extends Schema.TaggedError()("StalePlanError", {
626
- approvedPlanDigest: Schema.String,
627
- currentPlanDigest: Schema.String
628
- }) {};
629
- var PartialApplyError = class extends Schema.TaggedError()("PartialApplyError", {
630
- causeTag: Schema.Literals([
631
- "CryptoError",
632
- "InvalidInputError",
633
- "Interrupted",
634
- "ProviderError",
635
- "StalePlanError"
636
- ]),
637
- failedOperationId: Schema.String,
638
- message: Schema.String,
639
- receipt: Receipt$1
640
- }) {};
641
- /** Builds a deterministic DNS plan through the provider in the Effect environment. */
642
- const create$1 = Effect.fn("Provisioning.create")(function* (input) {
643
- const provider = yield* Service;
644
- const zone = yield* decode$4(input.zone);
645
- const requirements = (yield* Effect.forEach(input.requirements, decode$5, { concurrency: "unbounded" })).sort(compareRecords);
646
- const existing = [...yield* provider.listRecords(zone)].sort(compareRecords);
647
- const { operations } = yield* Effect.reduce(requirements, () => ({
648
- operations: [],
649
- projected: existing
650
- }), (state, requirement) => reconcileRequirement(requirement, state.projected).pipe(Effect.map((operation) => ({
651
- operations: [...state.operations, operation],
652
- projected: operation._tag === "create" ? [...state.projected, operation.requirement].sort(compareRecords) : state.projected
653
- }))));
654
- const unsigned = {
655
- operations,
656
- providerId: provider.id,
657
- version: "domainkit.dns-plan.v1",
658
- zone
659
- };
660
- return {
661
- ...unsigned,
662
- digest: yield* sha256Encoded(UnsignedPlan$1, unsigned)
663
- };
664
- });
665
- /** Authorizes all or a selected subset of create operations in a digest-bound plan. */
666
- const authorize$2 = Effect.fn("Provisioning.authorize")(function* (plan, operationIds, options = {}) {
667
- yield* validate$1(plan);
668
- const createIds = plan.operations.filter((operation) => operation._tag === "create").map(({ id }) => id);
669
- const selected = [...new Set(operationIds ?? createIds)].sort();
670
- const unknown = selected.filter((id) => !createIds.includes(id));
671
- if (unknown.length > 0) return yield* new AuthorizationError({ message: `Unknown operation IDs: ${unknown.join(", ")}` });
672
- if (!options.allowPartial && selected.length !== createIds.length) return yield* new AuthorizationError({ message: "Partial authorization requires allowPartial" });
673
- return {
674
- allowPartial: options.allowPartial ?? false,
675
- operationIds: selected,
676
- planDigest: plan.digest,
677
- version: "domainkit.plan-authorization.v1"
678
- };
679
- });
680
- /** Applies approved creates sequentially after full and per-operation revalidation. */
681
- const apply$1 = Effect.fn("Provisioning.apply")(function* (input) {
682
- const { authorization, plan } = input;
683
- const provider = yield* Service;
684
- yield* validate$1(plan);
685
- if (authorization.planDigest !== plan.digest) return yield* new AuthorizationError({ message: "Authorization belongs to a different plan" });
686
- if (provider.id !== plan.providerId) return yield* new AuthorizationError({ message: "Provider does not match the approved plan" });
687
- const conflicts = plan.operations.filter((operation) => operation._tag === "conflict");
688
- if (conflicts.length > 0) return yield* new ConflictError({ operationIds: conflicts.map(({ id }) => id) });
689
- const creates = plan.operations.filter(Operation$1.guards.create);
690
- const approved = new Set(authorization.operationIds);
691
- const unknown = authorization.operationIds.filter((id) => !creates.some((operation) => operation.id === id));
692
- if (unknown.length > 0) return yield* new AuthorizationError({ message: `Authorization contains unknown operations: ${unknown.join(", ")}` });
693
- if (!authorization.allowPartial && creates.some(({ id }) => !approved.has(id))) return yield* new AuthorizationError({ message: "Authorization does not cover every create operation" });
694
- const currentPlan = yield* create$1({
695
- requirements: plan.operations.map(({ requirement }) => requirement),
696
- zone: plan.zone
697
- });
698
- if (currentPlan.digest !== plan.digest) return yield* new StaleError({
699
- approvedPlanDigest: plan.digest,
700
- currentPlanDigest: currentPlan.digest
701
- });
702
- const operations = [];
703
- for (const operation of creates) {
704
- if (!approved.has(operation.id)) continue;
705
- yield* Effect.gen(function* () {
706
- yield* assertStillCreatable(plan, operation);
707
- const result = yield* provider.createRecord(plan.zone, operation.requirement);
708
- operations.push({
709
- operationId: operation.id,
710
- providerRecordId: result.providerRecordId
711
- });
712
- }).pipe(Effect.catch((failure) => operations.length === 0 ? Effect.fail(failure) : makeReceipt$1(input, operations, "partial").pipe(Effect.flatMap((receipt) => Effect.fail(new PartialApplyError({
713
- causeTag: failure._tag,
714
- failedOperationId: operation.id,
715
- message: failureMessage(failure),
716
- receipt
717
- }))))), Effect.catchCause((cause) => {
718
- if (!Cause.hasInterruptsOnly(cause) || operations.length === 0) return Effect.failCause(cause);
719
- return makeReceipt$1(input, operations, "partial").pipe(Effect.flatMap((receipt) => Effect.fail(new PartialApplyError({
720
- causeTag: "Interrupted",
721
- failedOperationId: operation.id,
722
- message: "DNS apply was interrupted after confirmed writes",
723
- receipt
724
- }))));
725
- }));
726
- }
727
- return yield* makeReceipt$1(input, operations, "complete");
728
- });
729
- function renderManualInstructions(plan) {
730
- return plan.operations.map((operation) => {
731
- const record = operation.requirement;
732
- const data$2 = Object.entries(data(record)).map(([key, value]) => `${key}=${value}`).join(" ");
733
- return `${operation._tag.toUpperCase()} ${record._tag} ${record.name} ${data$2}`.trim();
734
- });
735
- }
736
- function makeReceipt$1(input, operations, status) {
737
- return Clock.currentTimeMillis.pipe(Effect.map((now) => ({
738
- appliedAt: new Date(now),
739
- operations,
740
- planDigest: input.plan.digest,
741
- providerId: input.plan.providerId,
742
- status,
743
- version: "domainkit.apply-receipt.v1",
744
- zone: input.plan.zone
745
- })));
746
- }
747
- function assertStillCreatable(plan, operation) {
748
- return create$1({
749
- requirements: [operation.requirement],
750
- zone: plan.zone
751
- }).pipe(Effect.flatMap((currentPlan) => {
752
- const currentOperation = currentPlan.operations[0];
753
- return currentOperation?._tag === "create" && currentOperation.id === operation.id ? Effect.void : Effect.fail(new StaleError({
754
- approvedPlanDigest: plan.digest,
755
- currentPlanDigest: currentPlan.digest
756
- }));
757
- }));
758
- }
759
- function reconcileRequirement(requirement, allExisting) {
760
- return Effect.gen(function* () {
761
- const sameName = allExisting.filter((record) => record.name === requirement.name);
762
- const sameSet = sameName.filter((record) => record._tag !== "Opaque" && record._tag === requirement._tag);
763
- const exact = sameSet.find((record) => equals(record, requirement));
764
- const id = yield* sha256Encoded(RequirementDigest, { requirement });
765
- if (exact !== void 0) return {
766
- _tag: "noop",
767
- id,
768
- requirement,
769
- ttlDrift: exact.ttl !== requirement.ttl
770
- };
771
- if (sameName.length > 0 && (requirement._tag === "CNAME" || sameName.some((record) => record._tag === "CNAME"))) return {
772
- _tag: "conflict",
773
- existing: sameName,
774
- id,
775
- reason: "CNAME records cannot coexist with other records at the same name",
776
- requirement
777
- };
778
- if (sameSet.length > 0 && (requirement.policy === "exclusive" || sameSet.some(({ policy }) => policy === "exclusive"))) return {
779
- _tag: "conflict",
780
- existing: sameSet,
781
- id,
782
- reason: "The exclusive record set already contains incompatible data",
783
- requirement
784
- };
785
- return {
786
- _tag: "create",
787
- id,
788
- requirement
789
- };
790
- });
791
- }
792
- function validate$1(plan) {
793
- const unsigned = {
794
- operations: plan.operations,
795
- providerId: plan.providerId,
796
- version: plan.version,
797
- zone: plan.zone
798
- };
799
- return sha256Encoded(UnsignedPlan$1, unsigned).pipe(Effect.flatMap((digest) => digest === plan.digest ? Effect.void : Effect.fail(new AuthorizationError({ message: "Plan digest does not match its contents" }))));
800
- }
801
- function failureMessage(failure) {
802
- return failure._tag === "StalePlanError" ? "DNS state changed while applying the approved plan" : failure.message;
803
- }
804
- function compareRecords(left, right) {
805
- const encode = Schema.encodeSync(Observed);
806
- const toJson = Schema.decodeUnknownSync(Schema.Json);
807
- const leftJson = stringify(toJson(encode(left)));
808
- const rightJson = stringify(toJson(encode(right)));
809
- return leftJson < rightJson ? -1 : leftJson > rightJson ? 1 : 0;
810
- }
811
- //#endregion
812
- //#region src/plan/connection-authorization.ts
813
- var connection_authorization_exports = /* @__PURE__ */ __exportAll({ authorize: () => authorize$1 });
814
- const authorize$1 = Effect.fn("ConnectionAuthorization.authorize")(function* (input) {
815
- const domain = yield* Effect.try({
816
- try: () => assertGrant(input.connection, input.authorization, {
817
- capability: "dns:write",
818
- domain: input.domain,
819
- providerId: input.plan.providerId
820
- }),
821
- catch: (cause) => cause instanceof AuthorizationError$1 || cause instanceof Error$3 ? cause : new AuthorizationError$1({ message: "Connection grant is invalid" })
822
- });
823
- const authorization = yield* authorize$2(input.plan, input.operationIds, input.allowPartial === void 0 ? {} : { allowPartial: input.allowPartial });
824
- const selected = new Set(authorization.operationIds);
825
- if (input.plan.operations.filter((operation) => operation._tag === "create" && selected.has(operation.id) && operation.requirement.name !== domain && !operation.requirement.name.endsWith(`.${domain}`)).length > 0) return yield* new AuthorizationError$1({ message: `Plan operations are outside the granted domain ${domain}` });
826
- return authorization;
827
- });
828
- //#endregion
829
- //#region src/plan/deletion.ts
830
- var deletion_exports = /* @__PURE__ */ __exportAll({
831
- Authorization: () => Authorization,
832
- Error: () => Error$1,
833
- Operation: () => Operation,
834
- PartialError: () => PartialError,
835
- Plan: () => Plan,
836
- Receipt: () => Receipt,
837
- apply: () => apply,
838
- authorize: () => authorize,
839
- create: () => create,
840
- validate: () => validate
841
- });
842
- const Operation = Schema.Struct({
843
- id: Schema.String,
844
- providerRecordId: Schema.String,
845
- record: Schema$6
846
- });
847
- const UnsignedPlan = Schema.Struct({
848
- createdAt: Schema.DateFromString,
849
- expiresAt: Schema.DateFromString,
850
- operations: Schema.Array(Operation),
851
- providerId: Schema.String,
852
- sourcePlanDigest: Schema.String,
853
- version: Schema.Literal("domainkit.deletion-plan.v1"),
854
- zone: Schema$5
855
- });
856
- const Plan = Schema.Struct({
857
- ...UnsignedPlan.fields,
858
- digest: Schema.String
859
- });
860
- const Authorization = Schema.Struct({
861
- operationIds: Schema.Array(Schema.String),
862
- planDigest: Schema.String,
863
- version: Schema.Literal("domainkit.deletion-authorization.v1")
864
- });
865
- const Receipt = Schema.Struct({
866
- deletedAt: Schema.DateFromString,
867
- operations: Schema.Array(Schema.Struct({
868
- operationId: Schema.String,
869
- providerRecordId: Schema.String
870
- })),
871
- planDigest: Schema.String,
872
- providerId: Schema.String,
873
- status: Schema.Literals(["complete", "partial"]),
874
- version: Schema.Literal("domainkit.deletion-receipt.v1"),
875
- zone: Schema$5
876
- });
877
- var Error$1 = class extends Schema.TaggedError()("UnsafeDeletionError", {
878
- message: Schema.String,
879
- operationId: Schema.optionalKey(Schema.String)
880
- }) {};
881
- var PartialError = class extends Schema.TaggedError()("PartialDeletionError", {
882
- failedOperationId: Schema.String,
883
- message: Schema.String,
884
- receipt: Receipt
885
- }) {};
886
- /** Build a fresh deletion plan only from records proven by a prior create receipt. */
887
- const create = Effect.fn("Deletion.create")(function* (input) {
888
- const provider = yield* Service;
889
- yield* validate$1(input.plan);
890
- if (input.receipt.planDigest !== input.plan.digest || input.receipt.providerId !== input.plan.providerId || input.receipt.zone !== input.plan.zone) return yield* new Error$1({ message: "Create receipt does not belong to the source plan" });
891
- if (provider.id !== input.plan.providerId) return yield* new Error$1({ message: "Provider does not match the source receipt" });
892
- const operations = yield* Effect.forEach(input.receipt.operations, (applied) => Effect.gen(function* () {
893
- const source = input.plan.operations.find((operation) => operation._tag === "create" && operation.id === applied.operationId);
894
- if (source === void 0 || source._tag !== "create") return yield* new Error$1({
895
- message: "Receipt operation is not a created source record",
896
- operationId: applied.operationId
897
- });
898
- if (applied.providerRecordId === null) return yield* new Error$1({
899
- message: "Provider record ID is required for safe deletion",
900
- operationId: applied.operationId
901
- });
902
- yield* assertExact(provider, input.plan.zone, applied.providerRecordId, source.requirement, source.id);
903
- return {
904
- id: source.id,
905
- providerRecordId: applied.providerRecordId,
906
- record: source.requirement
907
- };
908
- }));
909
- const now = yield* Clock.currentTimeMillis;
910
- const unsigned = {
911
- createdAt: new Date(now),
912
- expiresAt: new Date(now + (input.ttlMs ?? 9e5)),
913
- operations,
914
- providerId: input.plan.providerId,
915
- sourcePlanDigest: input.plan.digest,
916
- version: "domainkit.deletion-plan.v1",
917
- zone: input.plan.zone
918
- };
919
- return {
920
- ...unsigned,
921
- digest: yield* sha256Encoded(UnsignedPlan, unsigned)
922
- };
923
- });
924
- /** Produce a separate digest-bound consent artifact for destructive operations. */
925
- const authorize = Effect.fn("Deletion.authorize")(function* (plan, operationIds) {
926
- yield* validate(plan);
927
- const selected = [...new Set(operationIds ?? plan.operations.map(({ id }) => id))].sort();
928
- const unknown = selected.filter((id) => !plan.operations.some((operation) => operation.id === id));
929
- if (unknown.length > 0) return yield* new Error$1({ message: `Unknown deletion operation IDs: ${unknown.join(", ")}` });
930
- return {
931
- operationIds: selected,
932
- planDigest: plan.digest,
933
- version: "domainkit.deletion-authorization.v1"
934
- };
935
- });
936
- /** Re-read every approved record before the first delete, then delete by provider record ID. */
937
- const apply = Effect.fn("Deletion.apply")(function* (input) {
938
- const provider = yield* Service;
939
- yield* validate(input.plan);
940
- if (input.authorization.planDigest !== input.plan.digest) return yield* new Error$1({ message: "Deletion authorization belongs to a different plan" });
941
- if (provider.id !== input.plan.providerId) return yield* new Error$1({ message: "Provider does not match the deletion plan" });
942
- const now = yield* Clock.currentTimeMillis;
943
- if (input.plan.expiresAt <= new Date(now)) return yield* new Error$1({ message: "Deletion plan has expired" });
944
- const selected = input.plan.operations.filter(({ id }) => input.authorization.operationIds.includes(id));
945
- if (selected.length !== input.authorization.operationIds.length) return yield* new Error$1({ message: "Deletion authorization contains unknown operations" });
946
- const previouslyDeleted = yield* validatePriorReceipt(input.plan, input.priorReceipt);
947
- const completedIds = new Set(previouslyDeleted.map(({ operationId }) => operationId));
948
- if (previouslyDeleted.some(({ operationId }) => !input.authorization.operationIds.includes(operationId))) return yield* new Error$1({ message: "Prior receipt contains an unauthorized operation" });
949
- const remaining = selected.filter(({ id }) => !completedIds.has(id));
950
- yield* Effect.forEach(remaining, (operation) => assertExact(provider, input.plan.zone, operation.providerRecordId, operation.record, operation.id));
951
- const deleted = [...previouslyDeleted];
952
- for (const operation of remaining) {
953
- const failure = yield* Effect.gen(function* () {
954
- yield* assertExact(provider, input.plan.zone, operation.providerRecordId, operation.record, operation.id);
955
- yield* provider.deleteRecord(input.plan.zone, operation.providerRecordId);
956
- deleted.push({
957
- operationId: operation.id,
958
- providerRecordId: operation.providerRecordId
959
- });
960
- }).pipe(Effect.match({
961
- onFailure: (cause) => cause,
962
- onSuccess: () => null
963
- }));
964
- if (failure !== null) {
965
- if (deleted.length === 0) return yield* failure;
966
- return yield* new PartialError({
967
- failedOperationId: operation.id,
968
- message: failure.message,
969
- receipt: yield* makeReceipt(input.plan, deleted, "partial")
970
- });
971
- }
972
- }
973
- return yield* makeReceipt(input.plan, deleted, "complete");
974
- });
975
- function validate(plan) {
976
- const unsigned = {
977
- createdAt: plan.createdAt,
978
- expiresAt: plan.expiresAt,
979
- operations: plan.operations,
980
- providerId: plan.providerId,
981
- sourcePlanDigest: plan.sourcePlanDigest,
982
- version: plan.version,
983
- zone: plan.zone
984
- };
985
- return sha256Encoded(UnsignedPlan, unsigned).pipe(Effect.flatMap((digest) => digest === plan.digest ? Effect.void : Effect.fail(new Error$1({ message: "Deletion plan digest does not match its contents" }))));
986
- }
987
- function validatePriorReceipt(plan, receipt) {
988
- if (receipt === void 0) return Effect.succeed([]);
989
- if (receipt.planDigest !== plan.digest || receipt.providerId !== plan.providerId || receipt.zone !== plan.zone || receipt.status !== "partial") return Effect.fail(new Error$1({ message: "Prior receipt does not belong to this deletion plan" }));
990
- for (const completed of receipt.operations) {
991
- const operation = plan.operations.find(({ id }) => id === completed.operationId);
992
- if (operation === void 0 || operation.providerRecordId !== completed.providerRecordId) return Effect.fail(new Error$1({ message: "Prior receipt operation does not match the deletion plan" }));
993
- }
994
- return Effect.succeed([...receipt.operations]);
995
- }
996
- function assertExact(provider, zone, providerRecordId, expected, operationId) {
997
- return provider.getRecord(zone, providerRecordId).pipe(Effect.flatMap((observed) => observed !== null && observed._tag !== "Opaque" && equals(observed, expected) ? Effect.void : Effect.fail(new Error$1({
998
- message: observed === null ? "Created record no longer exists" : "Created record content no longer matches its receipt",
999
- operationId
1000
- }))));
1001
- }
1002
- function makeReceipt(plan, operations, status) {
1003
- return Clock.currentTimeMillis.pipe(Effect.map((now) => ({
1004
- deletedAt: new Date(now),
1005
- operations,
1006
- planDigest: plan.digest,
1007
- providerId: plan.providerId,
1008
- status,
1009
- version: "domainkit.deletion-receipt.v1",
1010
- zone: plan.zone
1011
- })));
1012
- }
1013
- //#endregion
1014
- //#region src/verification/dns-data.ts
1015
- var dns_data_exports = /* @__PURE__ */ __exportAll({ parse: () => parse });
1016
- const CanonicalAddress = Schema.String.pipe(Schema.decodeTo(Schema.String, SchemaTransformation.transform({
1017
- decode: (value) => value.trim().toLowerCase(),
1018
- encode: (value) => value
1019
- })));
1020
- const CanonicalDomain = Schema.String.pipe(Schema.decodeTo(Schema.String, SchemaTransformation.transformOrFail({
1021
- decode: (value, options) => Effect.try({
1022
- try: () => parse$1(value).toString(),
1023
- catch: (cause) => new SchemaIssue.InvalidValue({ message: cause instanceof Error ? cause.message : String(cause) }, value, options)
1024
- }),
1025
- encode: (value) => Effect.succeed(value)
1026
- })));
1027
- const CanonicalMx = tokenizedDomain(2, 1);
1028
- const CanonicalSrv = tokenizedDomain(4, 3);
1029
- const CanonicalTxt = Schema.String.pipe(Schema.decodeTo(Schema.String, SchemaTransformation.transform({
1030
- decode: (value) => {
1031
- const trimmed = value.trim();
1032
- const chunks = [...trimmed.matchAll(/"((?:\\.|[^"])*)"/g)];
1033
- return chunks.length === 0 ? trimmed : chunks.map((match) => (match[1] ?? "").replace(/\\"/g, "\"").replace(/\\\\/g, "\\")).join("");
1034
- },
1035
- encode: (value) => value
1036
- })));
1037
- const CanonicalCaa = Schema.String.pipe(Schema.decodeTo(Schema.String, SchemaTransformation.transform({
1038
- decode: (value) => value.trim().replace(/\s+"([\s\S]*)"$/, " $1"),
1039
- encode: (value) => value
1040
- })));
1041
- function parse(type, input) {
1042
- const schema = (() => {
1043
- switch (type) {
1044
- case "A":
1045
- case "AAAA": return CanonicalAddress;
1046
- case "CNAME":
1047
- case "NS": return CanonicalDomain;
1048
- case "MX": return CanonicalMx;
1049
- case "SRV": return CanonicalSrv;
1050
- case "TXT": return CanonicalTxt;
1051
- case "CAA": return CanonicalCaa;
1052
- }
1053
- })();
1054
- try {
1055
- return Schema.decodeUnknownSync(schema)(input);
1056
- } catch (cause) {
1057
- throw new Error$3({ message: cause instanceof Error ? cause.message : String(cause) });
1058
- }
1059
- }
1060
- function tokenizedDomain(length, domainIndex) {
1061
- return Schema.String.pipe(Schema.decodeTo(Schema.String, SchemaTransformation.transformOrFail({
1062
- decode: (value, options) => Effect.try({
1063
- try: () => {
1064
- const parts = value.trim().split(/\s+/);
1065
- if (parts.length !== length) throw new Error("DNS record data has an invalid field count");
1066
- const domain = parts[domainIndex];
1067
- if (domain === void 0) throw new Error("DNS record target is missing");
1068
- parts[domainIndex] = parse$1(domain);
1069
- return parts.join(" ");
1070
- },
1071
- catch: (cause) => new SchemaIssue.InvalidValue({ message: cause instanceof Error ? cause.message : String(cause) }, value, options)
1072
- }),
1073
- encode: (value) => Effect.succeed(value)
1074
- })));
1075
- }
1076
- //#endregion
1077
- //#region src/verification/doh.ts
1078
- var doh_exports = /* @__PURE__ */ __exportAll({
1079
- layer: () => layer$1,
1080
- make: () => make$1,
1081
- toAsync: () => toAsync$1
1082
- });
1083
- function make$1(options) {
1084
- const fetch = options.fetch ?? globalThis.fetch;
1085
- const timeoutMs = options.timeoutMs ?? 5e3;
1086
- return { resolve: Effect.fn("DnsOverHttps.resolve")((query) => Effect.tryPromise({
1087
- try: (effectSignal) => request({
1088
- effectSignal,
1089
- fetch,
1090
- query,
1091
- timeoutMs,
1092
- endpoint: options.endpoint
1093
- }),
1094
- catch: (cause) => cause instanceof Error$5 ? cause : new Error$5({
1095
- cause,
1096
- message: cause instanceof Error ? cause.message : "DNS resolution failed",
1097
- reason: "transport"
1098
- })
1099
- }).pipe(Effect.flatMap((message) => decodeResolution(query, message)))) };
1100
- }
1101
- const layer$1 = (options) => Layer.succeed(Service$5, make$1(options));
1102
- const toAsync$1 = (options) => toAsync$2(make$1(options));
1103
- function decodeResolution(query, message) {
1104
- return Effect.try({
1105
- try: () => DnsPacket.decode(message),
1106
- catch: (cause) => new Error$5({
1107
- cause,
1108
- message: "DoH returned an invalid DNS message",
1109
- reason: "response"
1110
- })
1111
- }).pipe(Effect.flatMap((packet) => validatePacket(query, packet)), Effect.flatMap(decodePacket));
1112
- }
1113
- function decodePacket(packet) {
1114
- if (packet.rcode === "NXDOMAIN") return Effect.succeed({ _tag: "nodata" });
1115
- if (packet.rcode !== "NOERROR") return Effect.fail(new Error$5({
1116
- message: `DNS resolver returned ${packet.rcode ?? "an unknown response code"}`,
1117
- reason: "response"
1118
- }));
1119
- if (packet.answers === void 0 || packet.answers.length === 0) return Effect.succeed({ _tag: "nodata" });
1120
- return Effect.forEach(packet.answers, decodeAnswer, { concurrency: "unbounded" }).pipe(Effect.map((answers) => {
1121
- const supportedAnswers = answers.filter((answer) => answer !== null);
1122
- return supportedAnswers.length === 0 ? { _tag: "nodata" } : {
1123
- _tag: "answer",
1124
- answers: supportedAnswers
1125
- };
1126
- }));
1127
- }
1128
- function validatePacket(query, packet) {
1129
- return Effect.try({
1130
- try: () => {
1131
- if (packet.type !== "response") throw new Error("DoH returned a DNS query");
1132
- if (packet.id !== 0) throw new Error("DoH response used an unexpected message ID");
1133
- if (packet.flag_tc) throw new Error("DoH returned a truncated DNS response");
1134
- const questions = packet.questions ?? [];
1135
- if (questions.length !== 1) throw new Error("DoH returned an unexpected question count");
1136
- const question = questions[0];
1137
- if (question === void 0) throw new Error("DoH response omitted the DNS question");
1138
- if (question.class !== "IN" || question.type !== query.type || parse$1(question.name) !== query.name) throw new Error("DoH response did not match the DNS question");
1139
- return packet;
1140
- },
1141
- catch: (cause) => new Error$5({
1142
- cause,
1143
- message: cause instanceof Error ? cause.message : "DoH returned an invalid DNS response",
1144
- reason: "response"
1145
- })
1146
- });
1147
- }
1148
- function decodeAnswer(answer) {
1149
- return Effect.gen(function* () {
1150
- if (answer.class !== "IN") return null;
1151
- const decoded = yield* Effect.try({
1152
- try: () => answerData(answer),
1153
- catch: (cause) => new Error$5({
1154
- cause,
1155
- message: "DoH returned invalid DNS record data",
1156
- reason: "response"
1157
- })
1158
- });
1159
- if (decoded === void 0) return null;
1160
- const name = yield* decode$4(answer.name);
1161
- const data = yield* Effect.try({
1162
- try: () => parse(decoded.type, decoded.data),
1163
- catch: (cause) => new Error$5({
1164
- cause,
1165
- message: "DoH returned invalid DNS record data",
1166
- reason: "response"
1167
- })
1168
- });
1169
- if (answer.ttl === void 0) return yield* new Error$5({
1170
- message: "DoH response omitted the DNS record TTL",
1171
- reason: "response"
1172
- });
1173
- return {
1174
- data,
1175
- name,
1176
- ttl: answer.ttl,
1177
- type: decoded.type
1178
- };
1179
- }).pipe(Effect.mapError((cause) => cause instanceof Error$5 ? cause : new Error$5({
1180
- cause,
1181
- message: cause.message,
1182
- reason: "response"
1183
- })));
1184
- }
1185
- function answerData(answer) {
1186
- switch (answer.type) {
1187
- case "A":
1188
- case "AAAA":
1189
- case "CNAME":
1190
- case "NS": return {
1191
- data: answer.data,
1192
- type: answer.type
1193
- };
1194
- case "CAA": return {
1195
- data: `${answer.data.flags ?? 0} ${answer.data.tag} ${answer.data.value}`,
1196
- type: answer.type
1197
- };
1198
- case "MX": return {
1199
- data: `${requiredNumber(answer.data.preference, "MX preference")} ${answer.data.exchange}`,
1200
- type: answer.type
1201
- };
1202
- case "SRV": return {
1203
- data: [
1204
- requiredNumber(answer.data.priority, "SRV priority"),
1205
- requiredNumber(answer.data.weight, "SRV weight"),
1206
- requiredNumber(answer.data.port, "SRV port"),
1207
- answer.data.target
1208
- ].join(" "),
1209
- type: answer.type
1210
- };
1211
- case "TXT": return {
1212
- data: decodeTxt(answer.data),
1213
- type: answer.type
1214
- };
1215
- default: return;
1216
- }
1217
- }
1218
- function decodeTxt(data) {
1219
- const encoded = (Array.isArray(data) ? data : [data]).map((chunk) => typeof chunk === "string" ? new TextEncoder().encode(chunk) : chunk);
1220
- const length = encoded.reduce((total, chunk) => total + chunk.length, 0);
1221
- const joined = new Uint8Array(length);
1222
- let offset = 0;
1223
- for (const chunk of encoded) {
1224
- joined.set(chunk, offset);
1225
- offset += chunk.length;
1226
- }
1227
- return new TextDecoder("utf-8", { fatal: true }).decode(joined);
1228
- }
1229
- function requiredNumber(value, field) {
1230
- if (value === void 0) throw new Error(`DoH response omitted ${field}`);
1231
- return value;
1232
- }
1233
- async function request(input) {
1234
- const controller = new AbortController();
1235
- let timedOut = false;
1236
- const abortFromEffect = () => controller.abort(input.effectSignal.reason);
1237
- const abortFromHost = () => controller.abort(input.query.signal?.reason);
1238
- input.effectSignal.addEventListener("abort", abortFromEffect, { once: true });
1239
- input.query.signal?.addEventListener("abort", abortFromHost, { once: true });
1240
- const timer = setTimeout(() => {
1241
- timedOut = true;
1242
- controller.abort(/* @__PURE__ */ new Error("DNS resolution timed out"));
1243
- }, input.timeoutMs);
1244
- try {
1245
- const query = Uint8Array.from(DnsPacket.encode({
1246
- flags: DnsPacket.RECURSION_DESIRED,
1247
- id: 0,
1248
- questions: [{
1249
- name: input.query.name,
1250
- type: input.query.type
1251
- }],
1252
- type: "query"
1253
- }));
1254
- const response = await input.fetch(new URL(input.endpoint), {
1255
- body: query,
1256
- headers: {
1257
- accept: "application/dns-message",
1258
- "content-type": "application/dns-message"
1259
- },
1260
- method: "POST",
1261
- signal: controller.signal
1262
- });
1263
- if (!response.ok) throw new Error$5({
1264
- message: `DoH returned HTTP ${response.status}`,
1265
- reason: "transport"
1266
- });
1267
- const contentType = response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase();
1268
- if (contentType !== "application/dns-message") throw new Error$5({
1269
- message: `DoH returned unsupported content type ${contentType ?? "<missing>"}`,
1270
- reason: "response"
1271
- });
1272
- return new Uint8Array(await response.arrayBuffer());
1273
- } catch (cause) {
1274
- if (timedOut) throw new Error$5({
1275
- message: "DNS query timed out",
1276
- reason: "timeout"
1277
- });
1278
- throw cause;
1279
- } finally {
1280
- clearTimeout(timer);
1281
- input.effectSignal.removeEventListener("abort", abortFromEffect);
1282
- input.query.signal?.removeEventListener("abort", abortFromHost);
1283
- }
1284
- }
1285
- //#endregion
1286
- //#region src/verification/cloudflare-doh.ts
1287
- var cloudflare_doh_exports = /* @__PURE__ */ __exportAll({
1288
- layer: () => layer,
1289
- make: () => make,
1290
- toAsync: () => toAsync
1291
- });
1292
- const endpoint = "https://cloudflare-dns.com/dns-query";
1293
- function make(options = {}) {
1294
- return make$1({
1295
- ...options,
1296
- endpoint: options.endpoint ?? endpoint
1297
- });
1298
- }
1299
- const layer = (options = {}) => Layer.succeed(Service$5, make(options));
1300
- const toAsync = (options = {}) => toAsync$2(make(options));
1301
- //#endregion
1302
- //#region src/verification/verify.ts
1303
- var verify_exports = /* @__PURE__ */ __exportAll({
1304
- ProviderObservation: () => ProviderObservation,
1305
- PublicDnsObservation: () => PublicDnsObservation,
1306
- Result: () => Result,
1307
- record: () => record
1308
- });
1309
- const ProviderObservation = Schema.TaggedUnion({
1310
- match: {},
1311
- missing: {},
1312
- mismatch: { records: Schema.Array(Schema$6) },
1313
- failure: { message: Schema.String }
1314
- });
1315
- const PublicDnsObservation = Schema.TaggedUnion({
1316
- propagated: {},
1317
- missing: {},
1318
- mismatch: { answers: Schema.Array(Schema.String) },
1319
- timeout: {},
1320
- failure: { message: Schema.String }
1321
- });
1322
- const Result = Schema.Struct({
1323
- provider: ProviderObservation,
1324
- publicDns: PublicDnsObservation,
1325
- status: Schema.Literals([
1326
- "verified",
1327
- "pending",
1328
- "mismatch",
1329
- "unavailable"
1330
- ])
1331
- });
1332
- const record = Effect.fn("Verification.record")(function* (input) {
1333
- const provider = yield* Service;
1334
- const resolver = yield* Service$5;
1335
- const [providerObservation, publicDns] = yield* Effect.all([observeProvider(provider, input.zone, input.record).pipe(Effect.catch((failure) => Effect.succeed({
1336
- _tag: "failure",
1337
- message: failure.message
1338
- }))), resolver.resolve({
1339
- name: input.record.name,
1340
- type: input.record._tag
1341
- }).pipe(Effect.match({
1342
- onFailure: (failure) => failure.reason === "timeout" ? { _tag: "timeout" } : {
1343
- _tag: "failure",
1344
- message: failure.message
1345
- },
1346
- onSuccess: (resolution) => observePublicDns(input.record, resolution)
1347
- }))], { concurrency: "unbounded" });
1348
- return {
1349
- provider: providerObservation,
1350
- publicDns,
1351
- status: providerObservation._tag === "match" && publicDns._tag === "propagated" ? "verified" : providerObservation._tag === "failure" || publicDns._tag === "failure" || publicDns._tag === "timeout" ? "unavailable" : providerObservation._tag === "mismatch" || publicDns._tag === "mismatch" ? "mismatch" : "pending"
1352
- };
1353
- });
1354
- function observeProvider(provider, zone, requirement) {
1355
- return provider.listRecords(zone).pipe(Effect.map((records) => {
1356
- if (records.some((existing) => existing._tag !== "Opaque" && equals(existing, requirement))) return { _tag: "match" };
1357
- const sameSet = records.filter((existing) => existing._tag !== "Opaque" && existing.name === requirement.name && existing._tag === requirement._tag);
1358
- return sameSet.length === 0 ? { _tag: "missing" } : {
1359
- _tag: "mismatch",
1360
- records: sameSet
1361
- };
1362
- }));
1363
- }
1364
- function observePublicDns(requirement, resolution) {
1365
- if (resolution._tag === "nodata") return { _tag: "missing" };
1366
- const expected = parse(requirement._tag, recordValue(requirement));
1367
- return resolution.answers.some((answer) => answer.name === requirement.name && answer.type === requirement._tag && parse(answer.type, answer.data) === expected) ? { _tag: "propagated" } : {
1368
- _tag: "mismatch",
1369
- answers: resolution.answers.map(({ data }) => data)
1370
- };
1371
- }
1372
- function recordValue(requirement) {
1373
- const data$1 = data(requirement);
1374
- switch (requirement._tag) {
1375
- case "A":
1376
- case "AAAA": return String(data$1.address);
1377
- case "CNAME":
1378
- case "NS": return String(data$1.target);
1379
- case "TXT": return String(data$1.value);
1380
- case "MX": return `${data$1.priority} ${data$1.exchange}`;
1381
- case "CAA": return `${data$1.flags} ${data$1.tag} ${data$1.value}`;
1382
- case "SRV": return `${data$1.priority} ${data$1.weight} ${data$1.port} ${data$1.target}`;
1383
- }
1384
- }
1385
- //#endregion
1386
- export { Error$2 as $, decodeReceipt as A, manifest_exports as B, plan_exports as C, Receipt$1 as D, Operation$1 as E, connect as F, revoke as G, complete as H, token_exports as I, Capability as J, canonical_json_exports as K, Method as L, encodeReceipt as M, types_exports as N, Schema$1 as O, selection_exports as P, encode$1 as Q, Schema$2 as R, create$1 as S, Authorization$1 as T, oauth_exports as U, begin as V, refresh as W, authorization_exports as X, Schema$3 as Y, decode$2 as Z, deletion_exports as _, doh_exports as a, Schema$4 as at, apply$1 as b, Authorization as c, decode$3 as ct, PartialError as d, connection_lifecycle_exports as et, Plan as f, create as g, authorize as h, toAsync as i, Grant as it, encode as j, decode as k, Error$1 as l, encode$2 as lt, apply as m, verify_exports as n, updateGrant as nt, toAsync$1 as o, assertGrant as ot, Receipt as p, webCryptoLayer as q, cloudflare_doh_exports as r, AuthorizationError$1 as rt, dns_data_exports as s, connection_exports as st, record as t, detach as tt, Operation as u, version as ut, authorize$1 as v, renderManualInstructions as w, authorize$2 as x, connection_authorization_exports as y, decode$1 as z };
1387
-
1388
- //# sourceMappingURL=verify-BXOvXE20.mjs.map