domainkit 0.1.0 → 0.1.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.
package/README.md CHANGED
@@ -58,10 +58,25 @@ The Promise namespaces delegate to the canonical Effect programs rather than mai
58
58
  planning, authorization, or verification implementation. Hosts supply providers and stores
59
59
  explicitly; DomainKit does not own a hidden runtime.
60
60
 
61
- The Cloudflare adapter accepts a host-owned API or OAuth token and an explicitly selected account.
62
- The host also declares the capabilities required when that credential was issued; Cloudflare's
63
- non-mutating token-verification endpoint cannot infer DNS write permission. The adapter creates
64
- DNS-only records and leaves credential storage and user interaction to the host:
61
+ The Cloudflare authorization helpers can discover the account selected by an OAuth grant or API
62
+ token from a domain the host already owns. They walk from the requested name to its registrable
63
+ domain, require exactly one accessible authoritative zone, and return its Cloudflare account ID.
64
+ Hosts therefore do not need to ask users to find or paste an account ID. The host still declares
65
+ the capabilities required when the credential was issued because Cloudflare's non-mutating token
66
+ verification endpoint cannot infer DNS write permission:
67
+
68
+ ```ts
69
+ import { Cloudflare, DomainName } from "domainkit";
70
+
71
+ const resolveSubject = Cloudflare.Auth.subjectResolver({
72
+ capabilities: ["dns:read", "dns:write"],
73
+ domain: DomainName.parse("mail.customer.example.com"),
74
+ });
75
+ ```
76
+
77
+ Once authorized, the DNS client remains explicitly account-scoped. The host supplies the discovered
78
+ account ID with its stored credential. The adapter creates DNS-only records and leaves credential
79
+ storage and user interaction to the host:
65
80
 
66
81
  ```ts
67
82
  import { Cloudflare, Provisioning, Secret } from "domainkit";
@@ -77,7 +92,8 @@ const plan = await Provisioning.create({ provider, requirements, zone: "example.
77
92
 
78
93
  OAuth helpers own Cloudflare's endpoints and client-auth variants while accepting the scope IDs
79
94
  assigned during OAuth client registration. `Cloudflare.Auth.tokenMethod` describes the equivalent
80
- API-token capability.
95
+ API-token capability. Explicit `accountId` authorization remains available for hosts that already
96
+ have a trusted account selection.
81
97
 
82
98
  The Vercel adapter accepts either explicit personal or team context. It supports personal access
83
99
  tokens and Vercel's integration-code exchange without treating that provider-specific installation
@@ -1,6 +1,20 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { T as decode$2, c as Opaque, h as decode$3, y as Error } from "./dns-record-C_KwGPLf.mjs";
2
+ import { D as parse, O as Error, T as decode$2, c as Opaque, h as decode$3, y as Error$1 } from "./dns-record-C_KwGPLf.mjs";
3
3
  import { Clock, Effect, Schema } from "effect";
4
+ import { getDomain } from "tldts";
5
+ //#region src/discovery/zones.ts
6
+ var zones_exports = /* @__PURE__ */ __exportAll({ candidates: () => candidates });
7
+ function candidates(input) {
8
+ const domain = parse(input);
9
+ const registrable = getDomain(domain, { allowPrivateDomains: true });
10
+ if (registrable === null) throw new Error({ message: "Domain does not have a registrable DNS zone" });
11
+ const labels = domain.split(".");
12
+ const registrableLabels = registrable.split(".").length;
13
+ const values = [];
14
+ for (let index = 0; index <= labels.length - registrableLabels; index += 1) values.push(parse(labels.slice(index).join(".")));
15
+ return values;
16
+ }
17
+ //#endregion
4
18
  //#region src/providers/cloudflare/protocol.ts
5
19
  const ErrorDetail = Schema.Struct({
6
20
  code: Schema.Number,
@@ -204,7 +218,7 @@ function encode(record) {
204
218
  }
205
219
  const decodeData = Effect.fn("CloudflareRecords.decodeData")((record) => Schema.decodeUnknownEffect(Data)(record.data).pipe(Effect.mapError((cause) => failure$1("decodeRecord", cause.message))));
206
220
  function failure$1(operation, message, fields = {}) {
207
- return new Error({
221
+ return new Error$1({
208
222
  message,
209
223
  operation,
210
224
  providerId: "cloudflare",
@@ -213,9 +227,12 @@ function failure$1(operation, message, fields = {}) {
213
227
  }
214
228
  //#endregion
215
229
  //#region src/providers/cloudflare/client.ts
216
- var client_exports = /* @__PURE__ */ __exportAll({ make: () => make });
217
- /** Creates an Effect-native Cloudflare client without owning the credential lifecycle. */
218
- function make(options) {
230
+ var client_exports = /* @__PURE__ */ __exportAll({
231
+ discoverAuthorizationAccount: () => discoverAuthorizationAccount,
232
+ make: () => make,
233
+ validateDomainToken: () => validateDomainToken
234
+ });
235
+ const makeTransport = (options) => {
219
236
  const fetch = options.fetch ?? globalThis.fetch;
220
237
  const baseUrl = (options.baseUrl ?? "https://api.cloudflare.com/client/v4").replace(/\/$/, "");
221
238
  const request = Effect.fn("CloudflareClient.request")((path, operation, init) => Effect.gen(function* () {
@@ -258,17 +275,62 @@ function make(options) {
258
275
  yield* ensureSuccess(body, "listZones", response);
259
276
  return yield* decode(ZoneListEnvelope, body, "listZones", response);
260
277
  }));
261
- const allZones = Effect.fn("CloudflareClient.allZones")((accountId, name) => Effect.gen(function* () {
262
- const zones = [];
263
- let page = 1;
264
- while (true) {
265
- const envelope = yield* listZonesPage(accountId, name, page);
266
- zones.push(...envelope.result);
267
- const totalPages = envelope.result_info?.total_pages;
268
- if (totalPages !== void 0 && page >= totalPages || totalPages === void 0 && envelope.result.length < 50) return zones;
269
- page += 1;
270
- }
271
- }));
278
+ return {
279
+ allZones: Effect.fn("CloudflareClient.allZones")((accountId, name) => Effect.gen(function* () {
280
+ const zones = [];
281
+ let page = 1;
282
+ while (true) {
283
+ const envelope = yield* listZonesPage(accountId, name, page);
284
+ zones.push(...envelope.result);
285
+ const totalPages = envelope.result_info?.total_pages;
286
+ if (totalPages !== void 0 && page >= totalPages || totalPages === void 0 && envelope.result.length < 50) return zones;
287
+ page += 1;
288
+ }
289
+ })),
290
+ inspectToken: Effect.fn("CloudflareClient.inspectToken")((path) => Effect.gen(function* () {
291
+ const { body, response } = yield* request(path, "validateToken");
292
+ yield* ensureSuccess(body, "validateToken", response);
293
+ const envelope = yield* decode(TokenEnvelope, body, "validateToken", response);
294
+ if (envelope.result.status !== "active") return yield* Effect.fail(failure("validateToken", `Cloudflare token is ${envelope.result.status}`, {
295
+ reason: "authentication",
296
+ status: response.status
297
+ }));
298
+ const expiresAt = envelope.result.expires_on === void 0 ? null : new Date(envelope.result.expires_on);
299
+ if (expiresAt !== null && Number.isNaN(expiresAt.valueOf())) return yield* Effect.fail(failure("validateToken", "Cloudflare token expiry is not a valid timestamp", {
300
+ reason: "response",
301
+ status: response.status
302
+ }));
303
+ return expiresAt;
304
+ })),
305
+ request
306
+ };
307
+ };
308
+ const discoverAccount = Effect.fn("CloudflareClient.discoverAccount")((options) => Effect.gen(function* () {
309
+ const { allZones } = makeTransport(options);
310
+ for (const candidate of candidates(options.domain)) {
311
+ const matches = yield* allZones(void 0, candidate);
312
+ const match = matches[0];
313
+ if (matches.length === 0) continue;
314
+ if (matches.length === 1 && match !== void 0) return match.account;
315
+ return yield* Effect.fail(failure("discoverAccount", `Cloudflare returned multiple accessible zones named ${candidate}`, { reason: "conflict" }));
316
+ }
317
+ return yield* Effect.fail(failure("discoverAccount", `Cloudflare did not expose an accessible zone for ${options.domain}`, { reason: "not_found" }));
318
+ }));
319
+ const discoverAuthorizationAccount = discoverAccount;
320
+ const validateDomainToken = Effect.fn("CloudflareClient.validateDomainToken")((options) => Effect.gen(function* () {
321
+ const transport = makeTransport(options);
322
+ const account = options.tokenKind === "account" ? yield* discoverAccount(options) : void 0;
323
+ const expiresAt = yield* transport.inspectToken(account === void 0 ? "/user/tokens/verify" : `/accounts/${encodeURIComponent(account.id)}/tokens/verify`);
324
+ return {
325
+ accountId: (account ?? (yield* discoverAccount(options))).id,
326
+ capabilities: options.capabilities,
327
+ expiresAt,
328
+ scopes: []
329
+ };
330
+ }));
331
+ /** Creates an Effect-native Cloudflare client without owning the credential lifecycle. */
332
+ function make(options) {
333
+ const { allZones, inspectToken, request } = makeTransport(options);
272
334
  const resolveZone = Effect.fn("CloudflareClient.resolveZone")((name) => Effect.gen(function* () {
273
335
  const matches = yield* allZones(options.accountId, name);
274
336
  const match = matches[0];
@@ -328,19 +390,8 @@ function make(options) {
328
390
  listZones: Effect.fn("CloudflareClient.listZones")((input = {}) => allZones(input.accountId ?? options.accountId, input.name).pipe(Effect.flatMap((zones) => Effect.forEach(zones, projectZone)))),
329
391
  validateToken: Effect.fn("CloudflareClient.validateToken")(() => Effect.gen(function* () {
330
392
  const path = options.tokenKind === "account" ? `/accounts/${encodeURIComponent(options.accountId)}/tokens/verify` : "/user/tokens/verify";
331
- const { body, response } = yield* request(path, "validateToken");
332
- yield* ensureSuccess(body, "validateToken", response);
333
- const envelope = yield* decode(TokenEnvelope, body, "validateToken", response);
334
- if (envelope.result.status !== "active") return yield* Effect.fail(failure("validateToken", `Cloudflare token is ${envelope.result.status}`, {
335
- reason: "authentication",
336
- status: response.status
337
- }));
393
+ const expiresAt = yield* inspectToken(path);
338
394
  yield* allZones(options.accountId);
339
- const expiresAt = envelope.result.expires_on === void 0 ? null : new Date(envelope.result.expires_on);
340
- if (expiresAt !== null && Number.isNaN(expiresAt.valueOf())) return yield* Effect.fail(failure("validateToken", "Cloudflare token expiry is not a valid timestamp", {
341
- reason: "response",
342
- status: response.status
343
- }));
344
395
  return {
345
396
  accountId: options.accountId,
346
397
  capabilities: options.capabilities,
@@ -400,7 +451,7 @@ function retryAfter(value) {
400
451
  return Number.isNaN(date) ? void 0 : Math.max(0, date - Date.now());
401
452
  }
402
453
  function failure(operation, message, fields = {}) {
403
- return new Error({
454
+ return new Error$1({
404
455
  ...fields,
405
456
  message,
406
457
  operation,
@@ -450,26 +501,46 @@ function manifest(options) {
450
501
  /** Resolves the Cloudflare account selected by a completed OAuth grant. */
451
502
  function subjectResolver(options) {
452
503
  return (tokens, accessToken) => Effect.gen(function* () {
453
- yield* make({
454
- ...options,
504
+ const accountId = options.accountId ?? (yield* discoverAuthorizationAccount({
505
+ ...options.baseUrl === void 0 ? {} : { baseUrl: options.baseUrl },
506
+ domain: options.domain,
507
+ ...options.fetch === void 0 ? {} : { fetch: options.fetch },
508
+ token: accessToken
509
+ }).pipe(Effect.map((account) => account.id)));
510
+ if (options.accountId !== void 0) yield* make({
511
+ accountId: options.accountId,
512
+ ...options.baseUrl === void 0 ? {} : { baseUrl: options.baseUrl },
513
+ capabilities: options.capabilities,
514
+ ...options.fetch === void 0 ? {} : { fetch: options.fetch },
455
515
  token: accessToken,
456
516
  tokenKind: "user"
457
517
  }).listZones();
458
518
  const now = yield* Clock.currentTimeMillis;
459
519
  return {
460
- accountId: options.accountId,
520
+ accountId,
461
521
  expiresAt: typeof tokens.expires_in === "number" ? new Date(now + tokens.expires_in * 1e3) : null
462
522
  };
463
523
  });
464
524
  }
465
525
  /** Creates a host callback that validates a Cloudflare API token. */
466
526
  function tokenValidator(options) {
467
- return (token) => make({
468
- ...options,
469
- token
527
+ return (token) => options.accountId === void 0 ? validateDomainToken({
528
+ ...options.baseUrl === void 0 ? {} : { baseUrl: options.baseUrl },
529
+ capabilities: options.capabilities,
530
+ domain: options.domain,
531
+ ...options.fetch === void 0 ? {} : { fetch: options.fetch },
532
+ token,
533
+ ...options.tokenKind === void 0 ? {} : { tokenKind: options.tokenKind }
534
+ }) : make({
535
+ accountId: options.accountId,
536
+ ...options.baseUrl === void 0 ? {} : { baseUrl: options.baseUrl },
537
+ capabilities: options.capabilities,
538
+ ...options.fetch === void 0 ? {} : { fetch: options.fetch },
539
+ token,
540
+ ...options.tokenKind === void 0 ? {} : { tokenKind: options.tokenKind }
470
541
  }).validateToken();
471
542
  }
472
543
  //#endregion
473
- export { tokenMethod as a, subjectResolver as i, manifest as n, client_exports as o, oauthMethod as r, make as s, auth_exports as t };
544
+ export { tokenMethod as a, make as c, subjectResolver as i, candidates as l, manifest as n, tokenValidator as o, oauthMethod as r, client_exports as s, auth_exports as t, zones_exports as u };
474
545
 
475
- //# sourceMappingURL=auth-Vi-hhXbV.mjs.map
546
+ //# sourceMappingURL=auth-B0owkrpk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-B0owkrpk.mjs","names":["DomainName.parse","InvalidInputError","S","S","decode","DomainName.decode","failure","DnsRecord.decode","DnsRecord.Opaque","DnsProvider.Error","Protocol.ZoneListEnvelope","Protocol.TokenEnvelope","Zones.candidates","Protocol.RecordListEnvelope","Records.decode","Records.encode","Protocol.RecordEnvelope","DomainName.decode","S","Protocol.BaseEnvelope","DnsProvider.Error","Client.discoverAuthorizationAccount","Client.make","Client.validateDomainToken"],"sources":["../src/discovery/zones.ts","../src/providers/cloudflare/protocol.ts","../src/providers/cloudflare/records.ts","../src/providers/cloudflare/client.ts","../src/providers/cloudflare/auth.ts"],"sourcesContent":["import { getDomain } from \"tldts\";\n\nimport * as DomainName from \"../domain/domain-name.ts\";\nimport { Error as InvalidInputError } from \"../invalid-input.ts\";\n\nexport function candidates(input: string): ReadonlyArray<DomainName.DomainName> {\n const domain = DomainName.parse(input);\n const registrable = getDomain(domain, { allowPrivateDomains: true });\n if (registrable === null) {\n throw new InvalidInputError({ message: \"Domain does not have a registrable DNS zone\" });\n }\n const labels = domain.split(\".\");\n const registrableLabels = registrable.split(\".\").length;\n const values: Array<DomainName.DomainName> = [];\n for (let index = 0; index <= labels.length - registrableLabels; index += 1) {\n values.push(DomainName.parse(labels.slice(index).join(\".\")));\n }\n return values;\n}\n","import { Schema as S } from \"effect\";\n\nexport const ErrorDetail = S.Struct({\n code: S.Number,\n message: S.String,\n});\nexport interface ErrorDetail extends S.Schema.Type<typeof ErrorDetail> {}\n\nexport const ResultInfo = S.Struct({\n count: S.optionalKey(S.Number),\n page: S.optionalKey(S.Number),\n per_page: S.optionalKey(S.Number),\n total_count: S.optionalKey(S.Number),\n total_pages: S.optionalKey(S.Number),\n});\n\nconst Message = S.Struct({\n code: S.optionalKey(S.Number),\n message: S.String,\n});\n\nexport const BaseEnvelope = S.Struct({\n errors: S.Array(ErrorDetail),\n messages: S.Array(Message),\n success: S.Boolean,\n});\n\nexport const Account = S.Struct({\n id: S.String,\n name: S.String,\n});\nexport interface Account extends S.Schema.Type<typeof Account> {}\n\nexport const Zone = S.Struct({\n account: Account,\n id: S.String,\n name: S.String,\n name_servers: S.Array(S.String),\n status: S.optionalKey(S.String),\n});\nexport interface Zone extends S.Schema.Type<typeof Zone> {}\n\nexport const Record = S.Struct({\n content: S.optionalKey(S.String),\n data: S.optionalKey(S.Unknown),\n id: S.String,\n name: S.String,\n priority: S.optionalKey(S.Number),\n proxied: S.optionalKey(S.Boolean),\n ttl: S.Number,\n type: S.String,\n});\nexport interface Record extends S.Schema.Type<typeof Record> {}\n\nexport const Token = S.Struct({\n expires_on: S.optionalKey(S.String),\n id: S.String,\n not_before: S.optionalKey(S.String),\n status: S.Literals([\"active\", \"disabled\", \"expired\"]),\n});\nexport interface Token extends S.Schema.Type<typeof Token> {}\n\nexport const ZoneListEnvelope = S.Struct({\n errors: S.Array(ErrorDetail),\n messages: S.Array(Message),\n result: S.Array(Zone),\n result_info: S.optionalKey(ResultInfo),\n success: S.Boolean,\n});\nexport const RecordListEnvelope = S.Struct({\n errors: S.Array(ErrorDetail),\n messages: S.Array(Message),\n result: S.Array(Record),\n result_info: S.optionalKey(ResultInfo),\n success: S.Boolean,\n});\nexport const RecordEnvelope = S.Struct({\n errors: S.Array(ErrorDetail),\n messages: S.Array(Message),\n result: Record,\n success: S.Boolean,\n});\nexport const TokenEnvelope = S.Struct({\n errors: S.Array(ErrorDetail),\n messages: S.Array(Message),\n result: Token,\n success: S.Boolean,\n});\n","import { Effect, Schema as S } from \"effect\";\n\nimport * as DomainName from \"../../domain/domain-name.ts\";\nimport * as DnsRecord from \"../../domain/dns-record.ts\";\nimport * as DnsProvider from \"../../provider/provider.ts\";\nimport type * as Protocol from \"./protocol.ts\";\n\nconst Data = S.Struct({\n flags: S.optionalKey(S.Number),\n port: S.optionalKey(S.Number),\n priority: S.optionalKey(S.Number),\n tag: S.optionalKey(S.String),\n target: S.optionalKey(S.String),\n value: S.optionalKey(S.String),\n weight: S.optionalKey(S.Number),\n});\n\nexport type CreateBody = Readonly<Record<string, unknown>>;\n\nexport const decode = Effect.fn(\"CloudflareRecords.decode\")((record: Protocol.Record) =>\n Effect.gen(function* () {\n const name = yield* DomainName.decode(record.name).pipe(\n Effect.match({ onFailure: () => null, onSuccess: (value) => value }),\n );\n if (name === null) return yield* decodeOpaque(record);\n const common = {\n metadata: {\n ownership: \"provider\",\n provenance: record.proxied === true ? \"cloudflare:proxied\" : \"cloudflare\",\n purpose: \"existing DNS record\",\n },\n name,\n policy: record.type === \"CNAME\" ? \"exclusive\" : \"append\",\n ttl: record.ttl === 1 ? null : record.ttl,\n } as const;\n const content = () =>\n record.content === undefined\n ? Effect.fail(failure(\"decodeRecord\", `Cloudflare ${record.type} record has no content`))\n : Effect.succeed(record.content);\n\n switch (record.type) {\n case \"A\":\n case \"AAAA\":\n return yield* DnsRecord.decode({\n ...common,\n _tag: record.type,\n address: yield* content(),\n }).pipe(Effect.mapError((cause) => failure(\"decodeRecord\", cause.message)));\n case \"CNAME\":\n case \"NS\":\n return yield* DnsRecord.decode({\n ...common,\n _tag: record.type,\n target: yield* content(),\n }).pipe(Effect.mapError((cause) => failure(\"decodeRecord\", cause.message)));\n case \"TXT\":\n return yield* DnsRecord.decode({\n ...common,\n _tag: \"TXT\",\n value: yield* content(),\n }).pipe(Effect.mapError((cause) => failure(\"decodeRecord\", cause.message)));\n case \"MX\":\n return yield* DnsRecord.decode({\n ...common,\n _tag: \"MX\",\n exchange: yield* content(),\n priority: record.priority,\n }).pipe(Effect.mapError((cause) => failure(\"decodeRecord\", cause.message)));\n case \"CAA\": {\n const data = yield* decodeData(record);\n return yield* DnsRecord.decode({ ...common, _tag: \"CAA\", ...data }).pipe(\n Effect.mapError((cause) => failure(\"decodeRecord\", cause.message)),\n );\n }\n case \"SRV\": {\n const data = yield* decodeData(record);\n return yield* DnsRecord.decode({ ...common, _tag: \"SRV\", ...data }).pipe(\n Effect.mapError((cause) => failure(\"decodeRecord\", cause.message)),\n );\n }\n default:\n return yield* decodeOpaque(record);\n }\n }),\n);\n\nconst decodeOpaque = Effect.fn(\"CloudflareRecords.decodeOpaque\")((record: Protocol.Record) =>\n S.decodeUnknownEffect(DnsRecord.Opaque)({\n _tag: \"Opaque\",\n name: record.name,\n providerRecordId: record.id,\n providerType: record.type,\n }).pipe(Effect.mapError((cause) => failure(\"decodeRecord\", cause.message))),\n);\n\nexport function encode(record: DnsRecord.DnsRecord): CreateBody {\n const common = {\n name: record.name,\n proxied: false,\n ttl: record.ttl ?? 1,\n type: record._tag,\n };\n switch (record._tag) {\n case \"A\":\n case \"AAAA\":\n return { ...common, content: record.address };\n case \"CNAME\":\n case \"NS\":\n return { ...common, content: record.target };\n case \"TXT\":\n return { ...common, content: record.value };\n case \"MX\":\n return { ...common, content: record.exchange, priority: record.priority };\n case \"CAA\":\n return {\n ...common,\n data: { flags: record.flags, tag: record.tag, value: record.value },\n };\n case \"SRV\":\n return {\n ...common,\n data: {\n port: record.port,\n priority: record.priority,\n target: record.target,\n weight: record.weight,\n },\n };\n }\n}\n\nconst decodeData = Effect.fn(\"CloudflareRecords.decodeData\")((record: Protocol.Record) =>\n S.decodeUnknownEffect(Data)(record.data).pipe(\n Effect.mapError((cause) => failure(\"decodeRecord\", cause.message)),\n ),\n);\n\nfunction failure(\n operation: string,\n message: string,\n fields: Partial<Pick<DnsProvider.Error, \"reason\">> = {},\n): DnsProvider.Error {\n return new DnsProvider.Error({\n message,\n operation,\n providerId: \"cloudflare\",\n reason: fields.reason ?? \"response\",\n });\n}\n","import { Effect, Schema as S } from \"effect\";\n\nimport type * as ProviderAuth from \"../../auth/manifest.ts\";\nimport type * as Secret from \"../../auth/secret.ts\";\nimport * as DomainName from \"../../domain/domain-name.ts\";\nimport type * as DnsRecord from \"../../domain/dns-record.ts\";\nimport * as Zones from \"../../discovery/zones.ts\";\nimport * as DnsProvider from \"../../provider/provider.ts\";\nimport * as Protocol from \"./protocol.ts\";\nimport * as Records from \"./records.ts\";\n\nexport type Fetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;\n\n/** Configuration for an Effect-native Cloudflare authoritative-DNS client. */\nexport interface Options {\n readonly accountId: string;\n readonly baseUrl?: string;\n /** Capabilities the host required when issuing or authorizing this credential. */\n readonly capabilities: ProviderAuth.TokenValidation[\"capabilities\"];\n readonly fetch?: Fetch;\n readonly token: Secret.Value;\n readonly tokenKind?: \"account\" | \"user\";\n}\n\nexport interface ListZonesInput {\n readonly accountId?: string;\n readonly name?: DomainName.DomainName;\n}\n\nexport type Account = Protocol.Account;\n\n/** A portable Cloudflare authoritative zone with normalized nameserver evidence. */\nexport interface Zone {\n readonly accountId: string;\n readonly id: string;\n readonly name: DomainName.DomainName;\n readonly nameservers: ReadonlyArray<DomainName.DomainName>;\n readonly status: string | null;\n}\n\nexport interface Interface extends DnsProvider.Interface {\n readonly listAccounts: () => Effect.Effect<ReadonlyArray<Account>, DnsProvider.Error>;\n readonly listZones: (\n input?: ListZonesInput,\n ) => Effect.Effect<ReadonlyArray<Zone>, DnsProvider.Error>;\n readonly validateToken: () => Effect.Effect<ProviderAuth.TokenValidation, DnsProvider.Error>;\n}\n\ninterface CredentialOptions {\n readonly baseUrl?: string;\n readonly fetch?: Fetch;\n readonly token: Secret.Value;\n}\n\ninterface DomainCredentialOptions extends CredentialOptions {\n readonly capabilities: ProviderAuth.TokenValidation[\"capabilities\"];\n readonly domain: DomainName.DomainName;\n readonly tokenKind?: \"account\" | \"user\";\n}\n\nconst makeTransport = (options: CredentialOptions) => {\n const fetch = options.fetch ?? globalThis.fetch;\n const baseUrl = (options.baseUrl ?? \"https://api.cloudflare.com/client/v4\").replace(/\\/$/, \"\");\n\n const request = Effect.fn(\"CloudflareClient.request\")(\n (path: string, operation: string, init?: RequestInit) =>\n Effect.gen(function* () {\n const response = yield* Effect.tryPromise({\n try: () =>\n fetch(`${baseUrl}${path}`, {\n ...init,\n headers: {\n Accept: \"application/json\",\n Authorization: `Bearer ${options.token.expose()}`,\n ...(init?.body === undefined ? {} : { \"Content-Type\": \"application/json\" }),\n ...init?.headers,\n },\n }),\n catch: () =>\n failure(operation, \"Cloudflare request failed\", {\n reason: \"transport\",\n }),\n });\n const body = yield* Effect.tryPromise({\n try: () => response.json() as Promise<unknown>,\n catch: () => {\n const retryAfterMs = retryAfter(response.headers.get(\"retry-after\"));\n return failure(\n operation,\n response.ok\n ? \"Cloudflare returned a non-JSON response\"\n : `Cloudflare request failed with HTTP ${response.status}`,\n {\n reason: response.ok ? \"response\" : reason(response.status),\n ...(retryAfterMs === undefined ? {} : { retryAfterMs }),\n status: response.status,\n },\n );\n },\n });\n return { body, response } as const;\n }),\n );\n\n const listZonesPage = Effect.fn(\"CloudflareClient.listZonesPage\")(\n (accountId: string | undefined, name: DomainName.DomainName | undefined, page: number) =>\n Effect.gen(function* () {\n const query = new URLSearchParams({ page: String(page), per_page: \"50\" });\n query.set(\"type\", \"full,partial,secondary,internal\");\n if (accountId !== undefined) query.set(\"account.id\", accountId);\n if (name !== undefined) query.set(\"name\", name);\n const { body, response } = yield* request(`/zones?${query}`, \"listZones\");\n yield* ensureSuccess(body, \"listZones\", response);\n return yield* decode(Protocol.ZoneListEnvelope, body, \"listZones\", response);\n }),\n );\n\n const allZones = Effect.fn(\"CloudflareClient.allZones\")(\n (accountId?: string, name?: DomainName.DomainName) =>\n Effect.gen(function* () {\n const zones: Array<Protocol.Zone> = [];\n let page = 1;\n while (true) {\n const envelope = yield* listZonesPage(accountId, name, page);\n zones.push(...envelope.result);\n const totalPages = envelope.result_info?.total_pages;\n if (\n (totalPages !== undefined && page >= totalPages) ||\n (totalPages === undefined && envelope.result.length < 50)\n ) {\n return zones;\n }\n page += 1;\n }\n }),\n );\n\n const inspectToken = Effect.fn(\"CloudflareClient.inspectToken\")((path: string) =>\n Effect.gen(function* () {\n const { body, response } = yield* request(path, \"validateToken\");\n yield* ensureSuccess(body, \"validateToken\", response);\n const envelope = yield* decode(Protocol.TokenEnvelope, body, \"validateToken\", response);\n if (envelope.result.status !== \"active\") {\n return yield* Effect.fail(\n failure(\"validateToken\", `Cloudflare token is ${envelope.result.status}`, {\n reason: \"authentication\",\n status: response.status,\n }),\n );\n }\n const expiresAt =\n envelope.result.expires_on === undefined ? null : new Date(envelope.result.expires_on);\n if (expiresAt !== null && Number.isNaN(expiresAt.valueOf())) {\n return yield* Effect.fail(\n failure(\"validateToken\", \"Cloudflare token expiry is not a valid timestamp\", {\n reason: \"response\",\n status: response.status,\n }),\n );\n }\n return expiresAt;\n }),\n );\n\n return { allZones, inspectToken, request } as const;\n};\n\nconst discoverAccount = Effect.fn(\"CloudflareClient.discoverAccount\")(\n (options: CredentialOptions & { readonly domain: DomainName.DomainName }) =>\n Effect.gen(function* () {\n const { allZones } = makeTransport(options);\n for (const candidate of Zones.candidates(options.domain)) {\n const matches = yield* allZones(undefined, candidate);\n const match = matches[0];\n if (matches.length === 0) continue;\n if (matches.length === 1 && match !== undefined) return match.account;\n return yield* Effect.fail(\n failure(\n \"discoverAccount\",\n `Cloudflare returned multiple accessible zones named ${candidate}`,\n { reason: \"conflict\" },\n ),\n );\n }\n return yield* Effect.fail(\n failure(\n \"discoverAccount\",\n `Cloudflare did not expose an accessible zone for ${options.domain}`,\n { reason: \"not_found\" },\n ),\n );\n }),\n);\n\nexport const discoverAuthorizationAccount = discoverAccount;\n\nexport const validateDomainToken = Effect.fn(\"CloudflareClient.validateDomainToken\")(\n (options: DomainCredentialOptions) =>\n Effect.gen(function* () {\n const transport = makeTransport(options);\n const account = options.tokenKind === \"account\" ? yield* discoverAccount(options) : undefined;\n const expiresAt = yield* transport.inspectToken(\n account === undefined\n ? \"/user/tokens/verify\"\n : `/accounts/${encodeURIComponent(account.id)}/tokens/verify`,\n );\n const discoveredAccount = account ?? (yield* discoverAccount(options));\n return {\n accountId: discoveredAccount.id,\n capabilities: options.capabilities,\n expiresAt,\n scopes: [],\n } satisfies ProviderAuth.TokenValidation;\n }),\n);\n\n/** Creates an Effect-native Cloudflare client without owning the credential lifecycle. */\nexport function make(options: Options): Interface {\n const { allZones, inspectToken, request } = makeTransport(options);\n\n const resolveZone = Effect.fn(\"CloudflareClient.resolveZone\")((name: DomainName.DomainName) =>\n Effect.gen(function* () {\n const matches = yield* allZones(options.accountId, name);\n const match = matches[0];\n if (matches.length === 1 && match !== undefined) return match;\n return yield* Effect.fail(\n failure(\n \"resolveZone\",\n matches.length === 0\n ? `Cloudflare zone ${name} was not found in account ${options.accountId}`\n : `Cloudflare returned multiple zones named ${name} in account ${options.accountId}`,\n { reason: matches.length === 0 ? \"not_found\" : \"response\" },\n ),\n );\n }),\n );\n\n const listRecords = Effect.fn(\"CloudflareClient.listRecords\")((zoneName: DomainName.DomainName) =>\n Effect.gen(function* () {\n const zone = yield* resolveZone(zoneName);\n const records: Array<DnsRecord.Observed> = [];\n let page = 1;\n while (true) {\n const query = new URLSearchParams({ page: String(page), per_page: \"100\" });\n const { body, response } = yield* request(\n `/zones/${encodeURIComponent(zone.id)}/dns_records?${query}`,\n \"listRecords\",\n );\n yield* ensureSuccess(body, \"listRecords\", response);\n const envelope = yield* decode(Protocol.RecordListEnvelope, body, \"listRecords\", response);\n records.push(...(yield* Effect.forEach(envelope.result, Records.decode)));\n const totalPages = envelope.result_info?.total_pages;\n if (\n (totalPages !== undefined && page >= totalPages) ||\n (totalPages === undefined && envelope.result.length < 100)\n ) {\n return records;\n }\n page += 1;\n }\n }),\n );\n\n const createRecord = Effect.fn(\"CloudflareClient.createRecord\")(\n (zoneName: DomainName.DomainName, record: DnsRecord.DnsRecord) =>\n Effect.gen(function* () {\n const zone = yield* resolveZone(zoneName);\n const { body, response } = yield* request(\n `/zones/${encodeURIComponent(zone.id)}/dns_records`,\n \"createRecord\",\n { body: JSON.stringify(Records.encode(record)), method: \"POST\" },\n );\n yield* ensureSuccess(body, \"createRecord\", response);\n const envelope = yield* decode(Protocol.RecordEnvelope, body, \"createRecord\", response);\n return { providerRecordId: envelope.result.id };\n }),\n );\n\n const getRecord = Effect.fn(\"CloudflareClient.getRecord\")(\n (zoneName: DomainName.DomainName, providerRecordId: string) =>\n Effect.gen(function* () {\n const zone = yield* resolveZone(zoneName);\n const { body, response } = yield* request(\n `/zones/${encodeURIComponent(zone.id)}/dns_records/${encodeURIComponent(providerRecordId)}`,\n \"getRecord\",\n );\n if (response.status === 404) return null;\n yield* ensureSuccess(body, \"getRecord\", response);\n const envelope = yield* decode(Protocol.RecordEnvelope, body, \"getRecord\", response);\n return yield* Records.decode(envelope.result);\n }),\n );\n\n const deleteRecord = Effect.fn(\"CloudflareClient.deleteRecord\")(\n (zoneName: DomainName.DomainName, providerRecordId: string) =>\n Effect.gen(function* () {\n const zone = yield* resolveZone(zoneName);\n const { body, response } = yield* request(\n `/zones/${encodeURIComponent(zone.id)}/dns_records/${encodeURIComponent(providerRecordId)}`,\n \"deleteRecord\",\n { method: \"DELETE\" },\n );\n yield* ensureSuccess(body, \"deleteRecord\", response);\n }),\n );\n\n const listAccounts = Effect.fn(\"CloudflareClient.listAccounts\")(() =>\n allZones().pipe(\n Effect.map((zones) => {\n const accounts = new Map<string, Protocol.Account>();\n for (const zone of zones) accounts.set(zone.account.id, zone.account);\n return [...accounts.values()].sort((left, right) => left.name.localeCompare(right.name));\n }),\n ),\n );\n\n const listZones = Effect.fn(\"CloudflareClient.listZones\")((input: ListZonesInput = {}) =>\n allZones(input.accountId ?? options.accountId, input.name).pipe(\n Effect.flatMap((zones) => Effect.forEach(zones, projectZone)),\n ),\n );\n\n const validateToken = Effect.fn(\"CloudflareClient.validateToken\")(() =>\n Effect.gen(function* () {\n const path =\n options.tokenKind === \"account\"\n ? `/accounts/${encodeURIComponent(options.accountId)}/tokens/verify`\n : \"/user/tokens/verify\";\n const expiresAt = yield* inspectToken(path);\n yield* allZones(options.accountId);\n return {\n accountId: options.accountId,\n capabilities: options.capabilities,\n expiresAt,\n scopes: [],\n };\n }),\n );\n\n return {\n id: \"cloudflare\",\n createRecord,\n deleteRecord,\n getRecord,\n listAccounts,\n listRecords,\n listZones,\n validateToken,\n };\n}\n\nconst projectZone = Effect.fn(\"CloudflareClient.projectZone\")((zone: Protocol.Zone) =>\n Effect.gen(function* () {\n const name = yield* DomainName.decode(zone.name).pipe(\n Effect.mapError((cause) => failure(\"listZones\", cause.message, { reason: \"response\" })),\n );\n const nameservers = yield* Effect.forEach(zone.name_servers, (nameserver) =>\n DomainName.decode(nameserver).pipe(\n Effect.mapError((cause) => failure(\"listZones\", cause.message, { reason: \"response\" })),\n ),\n );\n return {\n accountId: zone.account.id,\n id: zone.id,\n name,\n nameservers,\n status: zone.status ?? null,\n };\n }),\n);\n\nfunction decode<A>(\n schema: S.ConstraintCodec<A, unknown, never, unknown>,\n input: unknown,\n operation: string,\n response: Response,\n): Effect.Effect<A, DnsProvider.Error> {\n return S.decodeUnknownEffect(schema)(input).pipe(\n Effect.mapError((cause) =>\n failure(operation, `Cloudflare response did not match its API contract: ${cause.message}`, {\n reason: \"response\",\n status: response.status,\n }),\n ),\n );\n}\n\nfunction ensureSuccess(\n input: unknown,\n operation: string,\n response: Response,\n): Effect.Effect<void, DnsProvider.Error> {\n return S.decodeUnknownEffect(Protocol.BaseEnvelope)(input).pipe(\n Effect.mapError(() =>\n failure(operation, \"Cloudflare response did not contain a valid API envelope\", {\n reason: \"response\",\n status: response.status,\n }),\n ),\n Effect.flatMap((envelope) => {\n if (response.ok && envelope.success) return Effect.void;\n const detail = envelope.errors[0];\n const retryAfterMs = retryAfter(response.headers.get(\"retry-after\"));\n return Effect.fail(\n failure(\n operation,\n detail?.message ?? `Cloudflare request failed with HTTP ${response.status}`,\n {\n ...(detail === undefined ? {} : { code: detail.code }),\n reason: reason(response.status, detail?.code),\n ...(retryAfterMs === undefined ? {} : { retryAfterMs }),\n status: response.status,\n },\n ),\n );\n }),\n );\n}\n\nfunction reason(status: number, code?: number): DnsProvider.ErrorReason {\n if (status === 401) return \"authentication\";\n if (status === 403) return \"authorization\";\n if (status === 404) return \"not_found\";\n if (status === 409 || code === 81056 || code === 81057 || code === 81058) return \"conflict\";\n if (status === 429) return \"rate_limit\";\n if (status >= 500) return \"response\";\n return \"request\";\n}\n\nfunction retryAfter(value: string | null): number | undefined {\n if (value === null) return undefined;\n const seconds = Number(value);\n if (Number.isFinite(seconds)) return Math.max(0, seconds * 1_000);\n const date = Date.parse(value);\n return Number.isNaN(date) ? undefined : Math.max(0, date - Date.now());\n}\n\nfunction failure(\n operation: string,\n message: string,\n fields: Partial<Pick<DnsProvider.Error, \"code\" | \"reason\" | \"retryAfterMs\" | \"status\">> = {},\n): DnsProvider.Error {\n return new DnsProvider.Error({\n ...fields,\n message,\n operation,\n providerId: \"cloudflare\",\n });\n}\n","import type * as oauth from \"oauth4webapi\";\nimport { Clock, Effect } from \"effect\";\n\nimport type * as ProviderAuth from \"../../auth/manifest.ts\";\nimport type * as Secret from \"../../auth/secret.ts\";\nimport type * as DomainName from \"../../domain/domain-name.ts\";\nimport * as Client from \"./client.ts\";\n\nconst authorizationServer = {\n authorization_endpoint: \"https://dash.cloudflare.com/oauth2/auth\",\n issuer: \"https://dash.cloudflare.com\",\n revocation_endpoint: \"https://dash.cloudflare.com/oauth2/revoke\",\n token_endpoint: \"https://dash.cloudflare.com/oauth2/token\",\n} as const;\n\n/** Describes Cloudflare's caller-created API-token authorization method. */\nexport function tokenMethod(\n capabilities: ProviderAuth.TokenValidation[\"capabilities\"],\n): Extract<ProviderAuth.Manifest[\"methods\"][number], { readonly _tag: \"token\" }> {\n return {\n _tag: \"token\",\n capabilities: [...capabilities],\n instructionsUrl: \"https://developers.cloudflare.com/fundamentals/api/get-started/create-token/\",\n };\n}\n\nexport interface OAuthMethodOptions {\n /** Scope IDs assigned to the OAuth client by Cloudflare. */\n readonly scopes: ReadonlyArray<string>;\n /** Capabilities represented by those assigned scope IDs. */\n readonly capabilities: ProviderAuth.TokenValidation[\"capabilities\"];\n readonly clientAuth: ProviderAuth.OAuthMethod[\"clientAuth\"];\n}\n\n/** Describes a registered Cloudflare OAuth client and its assigned scope IDs. */\nexport function oauthMethod(options: OAuthMethodOptions): ProviderAuth.OAuthMethod {\n return {\n _tag: \"oauth2\",\n authorizationServer,\n capabilities: [...options.capabilities],\n clientAuth: options.clientAuth,\n scopes: [...options.scopes],\n };\n}\n\n/** Creates the Cloudflare token and OAuth authorization manifest. */\nexport function manifest(options: OAuthMethodOptions): ProviderAuth.Manifest {\n return {\n methods: [tokenMethod(options.capabilities), oauthMethod(options)],\n providerId: \"cloudflare\",\n };\n}\n\ntype CredentialOptions = Omit<Client.Options, \"accountId\" | \"token\" | \"tokenKind\">;\n\n/** Selects an explicit Cloudflare account or discovers it from an authorized domain. */\nexport type CredentialTarget =\n | {\n readonly accountId: string;\n readonly domain?: never;\n }\n | {\n readonly accountId?: never;\n readonly domain: DomainName.DomainName;\n };\n\nexport type SubjectResolverOptions = CredentialOptions & CredentialTarget;\n\n/** Configuration for validating a Cloudflare token against an account or authorized domain. */\nexport type TokenValidatorOptions = CredentialOptions &\n (\n | {\n readonly accountId: string;\n readonly domain?: never;\n readonly tokenKind?: \"account\" | \"user\";\n }\n | {\n readonly accountId?: never;\n readonly domain: DomainName.DomainName;\n readonly tokenKind?: \"account\" | \"user\";\n }\n );\n\n/** Resolves the Cloudflare account selected by a completed OAuth grant. */\nexport function subjectResolver(\n options: SubjectResolverOptions,\n): ProviderAuth.OAuthSubjectResolver {\n return (tokens: oauth.TokenEndpointResponse, accessToken: Secret.Value) =>\n Effect.gen(function* () {\n const accountId =\n options.accountId ??\n (yield* Client.discoverAuthorizationAccount({\n ...(options.baseUrl === undefined ? {} : { baseUrl: options.baseUrl }),\n domain: options.domain,\n ...(options.fetch === undefined ? {} : { fetch: options.fetch }),\n token: accessToken,\n }).pipe(Effect.map((account) => account.id)));\n if (options.accountId !== undefined) {\n yield* Client.make({\n accountId: options.accountId,\n ...(options.baseUrl === undefined ? {} : { baseUrl: options.baseUrl }),\n capabilities: options.capabilities,\n ...(options.fetch === undefined ? {} : { fetch: options.fetch }),\n token: accessToken,\n tokenKind: \"user\",\n }).listZones();\n }\n const now = yield* Clock.currentTimeMillis;\n return {\n accountId,\n expiresAt:\n typeof tokens.expires_in === \"number\" ? new Date(now + tokens.expires_in * 1_000) : null,\n };\n });\n}\n\n/** Creates a host callback that validates a Cloudflare API token. */\nexport function tokenValidator(\n options: TokenValidatorOptions,\n): (token: Secret.Value) => ReturnType<Client.Interface[\"validateToken\"]> {\n return (token) =>\n options.accountId === undefined\n ? Client.validateDomainToken({\n ...(options.baseUrl === undefined ? {} : { baseUrl: options.baseUrl }),\n capabilities: options.capabilities,\n domain: options.domain,\n ...(options.fetch === undefined ? {} : { fetch: options.fetch }),\n token,\n ...(options.tokenKind === undefined ? {} : { tokenKind: options.tokenKind }),\n })\n : Client.make({\n accountId: options.accountId,\n ...(options.baseUrl === undefined ? {} : { baseUrl: options.baseUrl }),\n capabilities: options.capabilities,\n ...(options.fetch === undefined ? {} : { fetch: options.fetch }),\n token,\n ...(options.tokenKind === undefined ? {} : { tokenKind: options.tokenKind }),\n }).validateToken();\n}\n"],"mappings":";;;;;;AAKA,SAAgB,WAAW,OAAqD;CAC9E,MAAM,SAASA,MAAiB,KAAK;CACrC,MAAM,cAAc,UAAU,QAAQ,EAAE,qBAAqB,KAAK,CAAC;CACnE,IAAI,gBAAgB,MAClB,MAAM,IAAIC,MAAkB,EAAE,SAAS,8CAA8C,CAAC;CAExF,MAAM,SAAS,OAAO,MAAM,GAAG;CAC/B,MAAM,oBAAoB,YAAY,MAAM,GAAG,CAAC,CAAC;CACjD,MAAM,SAAuC,CAAC;CAC9C,KAAK,IAAI,QAAQ,GAAG,SAAS,OAAO,SAAS,mBAAmB,SAAS,GACvE,OAAO,KAAKD,MAAiB,OAAO,MAAM,KAAK,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;CAE7D,OAAO;AACT;;;AChBA,MAAa,cAAcE,OAAE,OAAO;CAClC,MAAMA,OAAE;CACR,SAASA,OAAE;AACb,CAAC;AAGD,MAAa,aAAaA,OAAE,OAAO;CACjC,OAAOA,OAAE,YAAYA,OAAE,MAAM;CAC7B,MAAMA,OAAE,YAAYA,OAAE,MAAM;CAC5B,UAAUA,OAAE,YAAYA,OAAE,MAAM;CAChC,aAAaA,OAAE,YAAYA,OAAE,MAAM;CACnC,aAAaA,OAAE,YAAYA,OAAE,MAAM;AACrC,CAAC;AAED,MAAM,UAAUA,OAAE,OAAO;CAC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O,MAAM;EACzB,OAAO;GACL;GACA,WACE,OAAO,OAAO,eAAe,WAAW,IAAI,KAAK,MAAM,OAAO,aAAa,GAAK,IAAI;EACxF;CACF,CAAC;AACL;;AAGA,SAAgB,eACd,SACwE;CACxE,QAAQ,UACN,QAAQ,cAAc,KAAA,IAClBC,oBAA2B;EACzB,GAAI,QAAQ,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS,QAAQ,QAAQ;EACpE,cAAc,QAAQ;EACtB,QAAQ,QAAQ;EAChB,GAAI,QAAQ,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,QAAQ,MAAM;EAC9D;EACA,GAAI,QAAQ,cAAc,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,QAAQ,UAAU;CAC5E,CAAC,IACDD,KAAY;EACV,WAAW,QAAQ;EACnB,GAAI,QAAQ,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS,QAAQ,QAAQ;EACpE,cAAc,QAAQ;EACtB,GAAI,QAAQ,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,QAAQ,MAAM;EAC9D;EACA,GAAI,QAAQ,cAAc,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,QAAQ,UAAU;CAC5E,CAAC,CAAC,CAAC,cAAc;AACzB"}
@@ -1,13 +1,13 @@
1
1
  import { d as Value, l as TokenValidation, p as AsyncInterface, t as AsyncOAuthSubjectResolver } from "./manifest-CP85ePFn.mjs";
2
- import { a as manifest$1, c as Account, d as ListZonesInput, f as Options, l as Fetch, n as OAuthMethodOptions, o as oauthMethod$1, p as Zone, r as SubjectResolverOptions, s as tokenMethod$1 } from "./index-CS9Rl5LQ.mjs";
2
+ import { a as TokenValidatorOptions, c as oauthMethod$1, d as Fetch, h as Zone, i as SubjectResolverOptions, l as tokenMethod$1, m as Options, n as CredentialTarget, p as ListZonesInput, r as OAuthMethodOptions, s as manifest$1, u as Account } from "./index-D2howbNz.mjs";
3
3
  declare namespace cloudflare_auth_d_exports {
4
- export { OAuthMethodOptions, SubjectResolverOptions, manifest, oauthMethod, subjectResolver, tokenMethod, tokenValidator };
4
+ export { CredentialTarget, OAuthMethodOptions, SubjectResolverOptions, TokenValidatorOptions, manifest, oauthMethod, subjectResolver, tokenMethod, tokenValidator };
5
5
  }
6
6
  declare const manifest: typeof manifest$1;
7
7
  declare const oauthMethod: typeof oauthMethod$1;
8
8
  declare const tokenMethod: typeof tokenMethod$1;
9
9
  declare function subjectResolver(options: SubjectResolverOptions): AsyncOAuthSubjectResolver;
10
- declare function tokenValidator(options: Omit<Options, "token">): (token: Value) => Promise<TokenValidation>;
10
+ declare function tokenValidator(options: TokenValidatorOptions): (token: Value) => Promise<TokenValidation>;
11
11
  declare namespace cloudflare_d_exports {
12
12
  export { Account, cloudflare_auth_d_exports as Auth, Fetch, Interface, ListZonesInput, Options, Zone, make };
13
13
  }
@@ -20,4 +20,4 @@ interface Interface extends AsyncInterface {
20
20
  declare function make(options: Options): Interface;
21
21
  //#endregion
22
22
  export { cloudflare_auth_d_exports as i, cloudflare_d_exports as n, make as r, Interface as t };
23
- //# sourceMappingURL=cloudflare-tdjNS8vE.d.mts.map
23
+ //# sourceMappingURL=cloudflare-CprjjXfm.d.mts.map
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { a as tokenMethod$1, i as subjectResolver$1, n as manifest$1, r as oauthMethod$1, s as make$1 } from "./auth-Vi-hhXbV.mjs";
2
+ import { a as tokenMethod$1, c as make$1, i as subjectResolver$1, n as manifest$1, o as tokenValidator$1, r as oauthMethod$1 } from "./auth-B0owkrpk.mjs";
3
3
  import { Effect } from "effect";
4
4
  //#region src/promise/cloudflare-auth.ts
5
5
  var cloudflare_auth_exports = /* @__PURE__ */ __exportAll({
@@ -17,10 +17,8 @@ function subjectResolver(options) {
17
17
  return (tokens, accessToken) => Effect.runPromise(resolve(tokens, accessToken));
18
18
  }
19
19
  function tokenValidator(options) {
20
- return (token) => Effect.runPromise(make$1({
21
- ...options,
22
- token
23
- }).validateToken());
20
+ const validate = tokenValidator$1(options);
21
+ return (token) => Effect.runPromise(validate(token));
24
22
  }
25
23
  //#endregion
26
24
  //#region src/promise/cloudflare.ts
@@ -45,4 +43,4 @@ function make(options) {
45
43
  //#endregion
46
44
  export { make as n, cloudflare_auth_exports as r, cloudflare_exports as t };
47
45
 
48
- //# sourceMappingURL=cloudflare-C6ryPlCZ.mjs.map
46
+ //# sourceMappingURL=cloudflare-D0-J2MfP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudflare-D0-J2MfP.mjs","names":["EffectAuth.manifest","EffectAuth.oauthMethod","EffectAuth.tokenMethod","EffectAuth.subjectResolver","EffectAuth.tokenValidator","Cloudflare.make"],"sources":["../src/promise/cloudflare-auth.ts","../src/promise/cloudflare.ts"],"sourcesContent":["import type * as oauth from \"oauth4webapi\";\nimport { Effect } from \"effect\";\n\nimport type * as ProviderAuth from \"../auth/manifest.ts\";\nimport type * as Secret from \"../auth/secret.ts\";\nimport * as EffectAuth from \"../providers/cloudflare/auth.ts\";\n\nexport const manifest = EffectAuth.manifest;\nexport const oauthMethod = EffectAuth.oauthMethod;\nexport const tokenMethod = EffectAuth.tokenMethod;\nexport type {\n CredentialTarget,\n OAuthMethodOptions,\n SubjectResolverOptions,\n TokenValidatorOptions,\n} from \"../providers/cloudflare/auth.ts\";\n\nexport function subjectResolver(\n options: EffectAuth.SubjectResolverOptions,\n): ProviderAuth.AsyncOAuthSubjectResolver {\n const resolve = EffectAuth.subjectResolver(options);\n return (tokens: oauth.TokenEndpointResponse, accessToken: Secret.Value) =>\n Effect.runPromise(resolve(tokens, accessToken));\n}\n\nexport function tokenValidator(\n options: EffectAuth.TokenValidatorOptions,\n): (token: Secret.Value) => Promise<ProviderAuth.TokenValidation> {\n const validate = EffectAuth.tokenValidator(options);\n return (token) => Effect.runPromise(validate(token));\n}\n","import { Effect } from \"effect\";\n\nimport type * as ProviderAuth from \"../auth/manifest.ts\";\nimport type * as DnsProvider from \"../provider/provider.ts\";\nimport * as Cloudflare from \"../providers/cloudflare/index.ts\";\n\nexport * as Auth from \"./cloudflare-auth.ts\";\nexport type {\n Account,\n Fetch,\n ListZonesInput,\n Options,\n Zone,\n} from \"../providers/cloudflare/client.ts\";\n\nexport interface Interface extends DnsProvider.AsyncInterface {\n readonly listAccounts: () => Promise<ReadonlyArray<Cloudflare.Account>>;\n readonly listZones: (\n input?: Cloudflare.Client.ListZonesInput,\n ) => Promise<ReadonlyArray<Cloudflare.Zone>>;\n readonly validateToken: () => Promise<ProviderAuth.TokenValidation>;\n}\n\n/** Creates a Promise-compatible facade over the Effect-native Cloudflare client. */\nexport function make(options: Cloudflare.Client.Options): Interface {\n const client = Cloudflare.make(options);\n return {\n id: client.id,\n createRecord: (zone, record) => Effect.runPromise(client.createRecord(zone, record)),\n deleteRecord: (zone, providerRecordId) =>\n Effect.runPromise(client.deleteRecord(zone, providerRecordId)),\n getRecord: (zone, providerRecordId) =>\n Effect.runPromise(client.getRecord(zone, providerRecordId)),\n listAccounts: () => Effect.runPromise(client.listAccounts()),\n listRecords: (zone) => Effect.runPromise(client.listRecords(zone)),\n listZones: (input) => Effect.runPromise(client.listZones(input)),\n validateToken: () => Effect.runPromise(client.validateToken()),\n };\n}\n"],"mappings":";;;;;;;;;;;AAOA,MAAa,WAAWA;AACxB,MAAa,cAAcC;AAC3B,MAAa,cAAcC;AAQ3B,SAAgB,gBACd,SACwC;CACxC,MAAM,UAAUC,kBAA2B,OAAO;CAClD,QAAQ,QAAqC,gBAC3C,OAAO,WAAW,QAAQ,QAAQ,WAAW,CAAC;AAClD;AAEA,SAAgB,eACd,SACgE;CAChE,MAAM,WAAWC,iBAA0B,OAAO;CAClD,QAAQ,UAAU,OAAO,WAAW,SAAS,KAAK,CAAC;AACrD;;;;;;;;ACNA,SAAgB,KAAK,SAA+C;CAClE,MAAM,SAASC,OAAgB,OAAO;CACtC,OAAO;EACL,IAAI,OAAO;EACX,eAAe,MAAM,WAAW,OAAO,WAAW,OAAO,aAAa,MAAM,MAAM,CAAC;EACnF,eAAe,MAAM,qBACnB,OAAO,WAAW,OAAO,aAAa,MAAM,gBAAgB,CAAC;EAC/D,YAAY,MAAM,qBAChB,OAAO,WAAW,OAAO,UAAU,MAAM,gBAAgB,CAAC;EAC5D,oBAAoB,OAAO,WAAW,OAAO,aAAa,CAAC;EAC3D,cAAc,SAAS,OAAO,WAAW,OAAO,YAAY,IAAI,CAAC;EACjE,YAAY,UAAU,OAAO,WAAW,OAAO,UAAU,KAAK,CAAC;EAC/D,qBAAqB,OAAO,WAAW,OAAO,cAAc,CAAC;CAC/D;AACF"}
@@ -1,3 +1,3 @@
1
- import { c as Account, d as ListZonesInput, f as Options, l as Fetch, p as Zone } from "./index-CS9Rl5LQ.mjs";
2
- import { i as cloudflare_auth_d_exports, r as make, t as Interface } from "./cloudflare-tdjNS8vE.mjs";
1
+ import { d as Fetch, h as Zone, m as Options, p as ListZonesInput, u as Account } from "./index-D2howbNz.mjs";
2
+ import { i as cloudflare_auth_d_exports, r as make, t as Interface } from "./cloudflare-CprjjXfm.mjs";
3
3
  export { type Account, cloudflare_auth_d_exports as Auth, type Fetch, Interface, type ListZonesInput, type Options, type Zone, make };
@@ -1,2 +1,2 @@
1
- import { n as make, r as cloudflare_auth_exports } from "./cloudflare-C6ryPlCZ.mjs";
1
+ import { n as make, r as cloudflare_auth_exports } from "./cloudflare-D0-J2MfP.mjs";
2
2
  export { cloudflare_auth_exports as Auth, make };
@@ -1,2 +1,2 @@
1
- import { c as Account, d as ListZonesInput, f as Options, h as make, i as auth_d_exports, l as Fetch, m as client_d_exports, p as Zone, u as Interface } from "./index-CS9Rl5LQ.mjs";
1
+ import { _ as make, d as Fetch, f as Interface, g as client_d_exports, h as Zone, m as Options, o as auth_d_exports, p as ListZonesInput, u as Account } from "./index-D2howbNz.mjs";
2
2
  export { type Account, auth_d_exports as Auth, client_d_exports as Client, type Fetch, type Interface, type ListZonesInput, type Options, type Zone, make };
@@ -1,2 +1,2 @@
1
- import { o as client_exports, s as make, t as auth_exports } from "./auth-Vi-hhXbV.mjs";
1
+ import { c as make, s as client_exports, t as auth_exports } from "./auth-B0owkrpk.mjs";
2
2
  export { auth_exports as Auth, client_exports as Client, make };
package/dist/effect.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { B as domain_name_d_exports, F as dns_record_d_exports, H as Error$3, N as Type, U as invalid_input_d_exports, d as Value, f as secret_d_exports, h as Error$2, l as TokenValidation, u as manifest_d_exports, v as provider_d_exports } from "./manifest-CP85ePFn.mjs";
2
- import { t as index_d_exports } from "./index-CS9Rl5LQ.mjs";
2
+ import { t as index_d_exports } from "./index-D2howbNz.mjs";
3
3
  import { t as index_d_exports$1 } from "./index-CEzk2gbZ.mjs";
4
4
  import { A as Service$2, B as Error$4, C as types_d_exports, D as oauth_state_d_exports, F as credential_d_exports, H as AuthorizationError, P as Service$1, Q as ProviderAuthorization, R as Service, U as Connection, V as error_d_exports, W as Grant, Y as connection_d_exports, et as authorization_d_exports, g as DnsPlan, j as authorization_d_exports$1, l as resolver_d_exports, p as receipt_d_exports, z as connection_d_exports$1 } from "./resolver-BHPsADzE.mjs";
5
5
  import { E as canonical_json_d_exports, T as CryptoError, b as zones_d_exports, g as AuthorizeError, h as deletion_d_exports, i as cloudflare_doh_d_exports, k as connection_lifecycle_d_exports, n as verify_d_exports, o as doh_d_exports, v as plan_d_exports, w as oauth_d_exports, x as selection_d_exports } from "./verify-B80xCBh2.mjs";
package/dist/effect.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
2
  import { E as domain_name_exports, S as provider_exports, g as dns_record_exports, k as invalid_input_exports } from "./dns-record-C_KwGPLf.mjs";
3
- import { o as client_exports, s as make, t as auth_exports } from "./auth-Vi-hhXbV.mjs";
4
- import { C as plan_exports, F as zones_exports, L as token_exports, N as types_exports, P as selection_exports, V as manifest_exports, W as oauth_exports, Z as authorization_exports, _ as deletion_exports, a as doh_exports, ct as connection_exports, dt as version, n as verify_exports, q as canonical_json_exports, r as cloudflare_doh_exports, s as dns_data_exports, tt as connection_lifecycle_exports, y as connection_authorization_exports } from "./verify-BjrR_4NF.mjs";
3
+ import { c as make, s as client_exports, t as auth_exports, u as zones_exports } from "./auth-B0owkrpk.mjs";
4
+ import { B as manifest_exports, C as plan_exports, I as token_exports, K as canonical_json_exports, N as types_exports, P as selection_exports, U as oauth_exports, X as authorization_exports, _ as deletion_exports, a as doh_exports, et as connection_lifecycle_exports, n as verify_exports, r as cloudflare_doh_exports, s as dns_data_exports, st as connection_exports, ut as version, y as connection_authorization_exports } from "./verify-BXOvXE20.mjs";
5
5
  import { S as error_exports, c as oauth_state_exports, d as authorization_exports$1, h as credential_exports, i as resolver_exports, y as connection_exports$1 } from "./resolver-tEXpKxmH.mjs";
6
6
  import { l as secret_exports, n as make$1, r as auth_exports$1, t as client_exports$1 } from "./client-BnD7QLRF.mjs";
7
7
  import { n as receipt_exports } from "./receipt-CGSnfZQ6.mjs";
@@ -7,7 +7,7 @@ declare const Account$1: Schema.Struct<{
7
7
  }>;
8
8
  interface Account$1 extends Schema.Schema.Type<typeof Account$1> {}
9
9
  declare namespace client_d_exports {
10
- export { Account, Fetch, Interface, ListZonesInput, Options, Zone, make };
10
+ export { Account, Fetch, Interface, ListZonesInput, Options, Zone, discoverAuthorizationAccount, make, validateDomainToken };
11
11
  }
12
12
  type Fetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
13
13
  /** Configuration for an Effect-native Cloudflare authoritative-DNS client. */
@@ -38,10 +38,32 @@ interface Interface extends Interface$1 {
38
38
  readonly listZones: (input?: ListZonesInput) => Effect.Effect<ReadonlyArray<Zone>, Error>;
39
39
  readonly validateToken: () => Effect.Effect<TokenValidation, Error>;
40
40
  }
41
+ interface CredentialOptions$1 {
42
+ readonly baseUrl?: string;
43
+ readonly fetch?: Fetch;
44
+ readonly token: Value;
45
+ }
46
+ interface DomainCredentialOptions extends CredentialOptions$1 {
47
+ readonly capabilities: TokenValidation["capabilities"];
48
+ readonly domain: DomainName;
49
+ readonly tokenKind?: "account" | "user";
50
+ }
51
+ declare const discoverAuthorizationAccount: (options: CredentialOptions$1 & {
52
+ readonly domain: DomainName;
53
+ }) => Effect.Effect<{
54
+ readonly id: string;
55
+ readonly name: string;
56
+ }, Error, never>;
57
+ declare const validateDomainToken: (options: DomainCredentialOptions) => Effect.Effect<{
58
+ accountId: string;
59
+ capabilities: readonly ("dns:read" | "dns:write")[];
60
+ expiresAt: Date | null;
61
+ scopes: never[];
62
+ }, Error, never>;
41
63
  /** Creates an Effect-native Cloudflare client without owning the credential lifecycle. */
42
64
  declare function make(options: Options): Interface;
43
65
  declare namespace auth_d_exports {
44
- export { OAuthMethodOptions, SubjectResolverOptions, manifest, oauthMethod, subjectResolver, tokenMethod, tokenValidator };
66
+ export { CredentialTarget, OAuthMethodOptions, SubjectResolverOptions, TokenValidatorOptions, manifest, oauthMethod, subjectResolver, tokenMethod, tokenValidator };
45
67
  }
46
68
  /** Describes Cloudflare's caller-created API-token authorization method. */
47
69
  declare function tokenMethod(capabilities: TokenValidation["capabilities"]): Extract<Manifest["methods"][number], {
@@ -58,14 +80,33 @@ interface OAuthMethodOptions {
58
80
  declare function oauthMethod(options: OAuthMethodOptions): OAuthMethod;
59
81
  /** Creates the Cloudflare token and OAuth authorization manifest. */
60
82
  declare function manifest(options: OAuthMethodOptions): Manifest;
61
- interface SubjectResolverOptions extends Omit<Options, "token" | "tokenKind"> {}
83
+ type CredentialOptions = Omit<Options, "accountId" | "token" | "tokenKind">;
84
+ /** Selects an explicit Cloudflare account or discovers it from an authorized domain. */
85
+ type CredentialTarget = {
86
+ readonly accountId: string;
87
+ readonly domain?: never;
88
+ } | {
89
+ readonly accountId?: never;
90
+ readonly domain: DomainName;
91
+ };
92
+ type SubjectResolverOptions = CredentialOptions & CredentialTarget;
93
+ /** Configuration for validating a Cloudflare token against an account or authorized domain. */
94
+ type TokenValidatorOptions = CredentialOptions & ({
95
+ readonly accountId: string;
96
+ readonly domain?: never;
97
+ readonly tokenKind?: "account" | "user";
98
+ } | {
99
+ readonly accountId?: never;
100
+ readonly domain: DomainName;
101
+ readonly tokenKind?: "account" | "user";
102
+ });
62
103
  /** Resolves the Cloudflare account selected by a completed OAuth grant. */
63
104
  declare function subjectResolver(options: SubjectResolverOptions): OAuthSubjectResolver;
64
105
  /** Creates a host callback that validates a Cloudflare API token. */
65
- declare function tokenValidator(options: Omit<Options, "token">): (token: Value) => ReturnType<Interface["validateToken"]>;
106
+ declare function tokenValidator(options: TokenValidatorOptions): (token: Value) => ReturnType<Interface["validateToken"]>;
66
107
  declare namespace index_d_exports {
67
108
  export { Account, auth_d_exports as Auth, client_d_exports as Client, Fetch, Interface, ListZonesInput, Options, Zone, make };
68
109
  }
69
110
  //#endregion
70
- export { manifest as a, Account as c, ListZonesInput as d, Options as f, make as h, auth_d_exports as i, Fetch as l, client_d_exports as m, OAuthMethodOptions as n, oauthMethod as o, Zone as p, SubjectResolverOptions as r, tokenMethod as s, index_d_exports as t, Interface as u };
71
- //# sourceMappingURL=index-CS9Rl5LQ.d.mts.map
111
+ export { make as _, TokenValidatorOptions as a, oauthMethod as c, Fetch as d, Interface as f, client_d_exports as g, Zone as h, SubjectResolverOptions as i, tokenMethod as l, Options as m, CredentialTarget as n, auth_d_exports as o, ListZonesInput as p, OAuthMethodOptions as r, manifest as s, index_d_exports as t, Account as u };
112
+ //# sourceMappingURL=index-D2howbNz.d.mts.map
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { A as Schema$1, C as DnsRecord, D as Observed, E as Ns, I as equals, L as parse, M as Txt, N as Type, O as Opaque, P as data, R as DomainName, S as Cname, T as Mx, U as invalid_input_d_exports, V as parse$1, a as OAuthClientConfiguration, b as Aaaa, c as Schema, d as Value, f as secret_d_exports, i as Method, j as Srv, k as RequirementMetadata, l as TokenValidation, m as CreateResult, o as OAuthMethod, p as AsyncInterface, r as Manifest, t as AsyncOAuthSubjectResolver, w as Encoded, x as Caa, y as A, z as Schema$2 } from "./manifest-CP85ePFn.mjs";
2
- import { n as cloudflare_d_exports } from "./cloudflare-tdjNS8vE.mjs";
2
+ import { n as cloudflare_d_exports } from "./cloudflare-CprjjXfm.mjs";
3
3
  import { $ as Schema$4, G as OAuthContinuation, H as AuthorizationError, I as AsyncInterface$1, J as assertGrant, K as Schema$3, M as AsyncInterface$3, O as AsyncInterface$2, Q as ProviderAuthorization, S as encodeReceipt, U as Connection, W as Grant, X as encode, Z as Capability, _ as Operation, b as Schema$5, g as DnsPlan, h as Authorization, m as ApplyReceipt, n as AsyncInterface$4, o as Query, q as StoredCredential, r as AsyncResolution, t as Answer, tt as encode$1, u as AsyncInterface$6, v as PlanAuthorization, w as AsyncInterface$5, x as encode$2, y as Receipt } from "./resolver-BHPsADzE.mjs";
4
4
  import { A as updateGrant$1, C as Fetch$1, D as DetachResult, O as Error, S as BeginInput$1, _ as CreateInput$1, a as Options$3, b as zones_d_exports, c as Authorization$1, d as Operation$1, f as PartialError, l as CreateError, m as Receipt$1, p as Plan, r as Options$2, s as ApplyError, t as Result, u as Error$1, x as selection_d_exports, y as renderManualInstructions$1 } from "./verify-B80xCBh2.mjs";
5
5
  import { r as vercel_d_exports } from "./vercel-D-E2aqb1.mjs";
package/dist/index.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
2
  import { D as parse$1, O as Error$1, _ as equals, a as Mx, c as Opaque, d as Srv, f as Txt, i as Cname, k as invalid_input_exports, l as RequirementMetadata, m as data, n as Aaaa, o as Ns, p as Type, r as Caa, s as Observed, t as A, u as Schema$1, v as parse, w as Schema$2, x as layerFromAsync, y as Error$2 } from "./dns-record-C_KwGPLf.mjs";
3
- import { t as cloudflare_exports } from "./cloudflare-C6ryPlCZ.mjs";
4
- import { $ as encode$1, A as decodeReceipt$1, B as decode$6, D as Receipt, E as Operation, F as zones_exports, G as refresh$1, H as begin$1, I as connect$1, J as webCryptoLayer, K as revoke$1, M as encodeReceipt, O as Schema$6, P as selection_exports, Q as decode$5, R as Method, S as create$3, T as Authorization, U as complete$1, X as Schema$4, Y as Capability, at as Grant, b as apply$3, c as Authorization$1, d as PartialError, dt as version, et as Error$3, f as Plan, g as create$2, h as authorize$2, i as toAsync, it as AuthorizationError, j as encode$2, k as decode$7, l as Error$4, lt as decode$4, m as apply$2, nt as detach$1, o as toAsync$1, ot as Schema$3, p as Receipt$1, rt as updateGrant$1, st as assertGrant, t as record$1, u as Operation$1, ut as encode, v as authorize$4, w as renderManualInstructions$1, x as authorize$3, z as Schema$5 } from "./verify-BjrR_4NF.mjs";
3
+ import { u as zones_exports } from "./auth-B0owkrpk.mjs";
4
+ import { t as cloudflare_exports } from "./cloudflare-D0-J2MfP.mjs";
5
+ import { $ as Error$3, A as decodeReceipt$1, D as Receipt, E as Operation, F as connect$1, G as revoke$1, H as complete$1, J as Capability, L as Method, M as encodeReceipt, O as Schema$6, P as selection_exports, Q as encode$1, R as Schema$5, S as create$3, T as Authorization, V as begin$1, W as refresh$1, Y as Schema$4, Z as decode$5, at as Schema$3, b as apply$3, c as Authorization$1, ct as decode$4, d as PartialError, f as Plan, g as create$2, h as authorize$2, i as toAsync, it as Grant, j as encode$2, k as decode$7, l as Error$4, lt as encode, m as apply$2, nt as updateGrant$1, o as toAsync$1, ot as assertGrant, p as Receipt$1, q as webCryptoLayer, rt as AuthorizationError, t as record$1, tt as detach$1, u as Operation$1, ut as version, v as authorize$4, w as renderManualInstructions$1, x as authorize$3, z as decode$6 } from "./verify-BXOvXE20.mjs";
5
6
  import { b as layerFromAsync$1, f as layerFromAsync$2, g as layerFromAsync$3, r as layerFromAsync$5, s as layerFromAsync$4 } from "./resolver-tEXpKxmH.mjs";
6
7
  import { l as secret_exports } from "./client-BnD7QLRF.mjs";
7
8
  import { n as vercel_exports } from "./vercel-DD89DCqH.mjs";