domainkit 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/testing.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { F as webCryptoLayer, I as Error$2, L as Service$1, R as fromAsync$1, S as create, V as toAsync$2, _ as PartialApplyError, at as parse$1, b as apply, d as apply$1, f as authorize$1, ft as Error$1, h as ConflictError, i as toAsync$3, it as equals, kt as parse, n as Service$2, p as create$1, pt as Service, v as StaleError, wt as project, x as authorize, y as Target } from "./resolver-tZU6gEVq.mjs";
3
- import { Effect, Layer, Ref, Schema, Semaphore } from "effect";
2
+ import { i as webCryptoLayer, k as parse, l as Revocation, o as Error$1, s as Service, w as project } from "./canonical-json-CQYKsZw7.mjs";
3
+ import { C as authorize, I as Error$2, L as Service$1, R as fromAsync$1, S as apply, V as toAsync$2, _ as ConflictError, at as parse$1, b as StaleError, h as create$1, i as Service$2, it as equals, m as authorize$1, o as toAsync$3, p as apply$1, w as create, x as Target, y as PartialApplyError } from "./resolver-DPJs8h0a.mjs";
4
+ import { DateTime, Effect, Layer, Ref, Schema, Semaphore } from "effect";
4
5
  //#region src/stores/in-memory-lifecycle-repository.ts
5
6
  var in_memory_lifecycle_repository_exports = /* @__PURE__ */ __exportAll({
6
7
  layer: () => layer$2,
@@ -25,8 +26,8 @@ function conflict$1(operation, message) {
25
26
  function ownerConnection(aggregate, connectionId, ownerId) {
26
27
  return aggregate.connections.find((connection) => connection.id === connectionId && connection.ownerId === ownerId);
27
28
  }
28
- function publicConnection(connection, authorization) {
29
- return project(connection, authorization);
29
+ function publicConnection(connection, authorization, credential) {
30
+ return project(connection, authorization, credential);
30
31
  }
31
32
  function make$3(options = {}) {
32
33
  const state = Effect.runSync(Ref.make(/* @__PURE__ */ new Map()));
@@ -51,21 +52,19 @@ function make$3(options = {}) {
51
52
  const get = Effect.fn("ManagedDnsConnections.get")((authorizationId) => Ref.get(state).pipe(Effect.map((entries) => entries.get(authorizationId) ?? null)));
52
53
  const getByConnectionId = Effect.fn("ManagedDnsConnections.getByConnectionId")((connectionId) => Ref.get(state).pipe(Effect.map((entries) => [...entries.values()].find((aggregate) => aggregate.connections.some((connection) => connection.id === connectionId)) ?? null)));
53
54
  const finishRevocation = Effect.fn("InMemoryManagedDnsConnections.finishRevocation")(function* (aggregate, connection, revoke) {
55
+ const requestedAt = yield* DateTime.nowAsDate;
54
56
  const pending = {
55
57
  ...aggregate,
56
58
  authorization: {
57
59
  ...aggregate.authorization,
58
- revocation: aggregate.authorization.revocation._tag === "Pending" ? aggregate.authorization.revocation : {
59
- _tag: "Pending",
60
- requestedAt: /* @__PURE__ */ new Date()
61
- }
60
+ revocation: aggregate.authorization.revocation._tag === "Pending" ? aggregate.authorization.revocation : Revocation.Pending({ requestedAt })
62
61
  }
63
62
  };
64
63
  yield* commit("prepareRevocation", pending);
65
64
  yield* revoke(pending.authorization);
66
65
  yield* remove("completeRevocation", pending.authorization.id);
67
66
  return {
68
- connection: publicConnection(connection, pending.authorization),
67
+ connection: publicConnection(connection, pending.authorization, pending.credential),
69
68
  remainingConnections: 0,
70
69
  revokedAuthorization: true
71
70
  };
@@ -82,7 +81,7 @@ function make$3(options = {}) {
82
81
  if (existing.connectionId !== attachment.connectionId || existing.domain !== attachment.domain || existing.target.accountId !== attachment.target.accountId || existing.target.accountKind !== attachment.target.accountKind || existing.target.zoneId !== attachment.target.zoneId || existing.target.zoneName !== attachment.target.zoneName) return yield* conflict$1("attach", "Domain attachment id is already in use");
83
82
  return {
84
83
  attachment: existing,
85
- connection: publicConnection(connection, aggregate.authorization)
84
+ connection: publicConnection(connection, aggregate.authorization, aggregate.credential)
86
85
  };
87
86
  }
88
87
  if ([...(yield* Ref.get(state)).values()].some((candidate) => candidate.attachments.some(({ id }) => id === attachment.id))) return yield* conflict$1("attach", "Domain attachment id is already in use");
@@ -96,7 +95,7 @@ function make$3(options = {}) {
96
95
  yield* commit("attach", next);
97
96
  return {
98
97
  attachment,
99
- connection: publicConnection(connection, aggregate.authorization)
98
+ connection: publicConnection(connection, aggregate.authorization, aggregate.credential)
100
99
  };
101
100
  })),
102
101
  connect: (input) => serialize(Effect.gen(function* () {
@@ -130,7 +129,7 @@ function make$3(options = {}) {
130
129
  yield* commit("detach", next);
131
130
  return {
132
131
  attachment,
133
- connection: publicConnection(connection, aggregate.authorization),
132
+ connection: publicConnection(connection, aggregate.authorization, aggregate.credential),
134
133
  remainingAttachments: next.attachments.filter(({ connectionId }) => connectionId === connection.id).length
135
134
  };
136
135
  }
@@ -150,7 +149,7 @@ function make$3(options = {}) {
150
149
  };
151
150
  yield* commit("disconnectConnection", next);
152
151
  return {
153
- connection: publicConnection(connection, aggregate.authorization),
152
+ connection: publicConnection(connection, aggregate.authorization, aggregate.credential),
154
153
  remainingConnections: remainingConnections.length,
155
154
  revokedAuthorization: false
156
155
  };
@@ -190,15 +189,11 @@ function make$3(options = {}) {
190
189
  if (connection === void 0) return yield* missing("recover", "Pending authorization has no connection");
191
190
  return yield* finishRevocation(aggregate, connection, revoke);
192
191
  }).pipe(Effect.withSpan("ManagedDnsConnections.recover"))),
193
- rotate: (authorizationId, credential, expiresAt) => serialize(Effect.gen(function* () {
192
+ rotate: (authorizationId, credential) => serialize(Effect.gen(function* () {
194
193
  const aggregate = yield* get(authorizationId);
195
194
  if (aggregate === null) return yield* missing("rotate", "Provider authorization does not exist");
196
195
  const next = {
197
196
  ...aggregate,
198
- authorization: {
199
- ...aggregate.authorization,
200
- expiresAt
201
- },
202
197
  credential
203
198
  };
204
199
  yield* commit("rotate", next);
@@ -1 +1 @@
1
- {"version":3,"file":"testing.mjs","names":["Lifecycle.Error","conflict","Connection.project","make","layer","Lifecycle.Service","make","make","DomainName.parse","layer","DnsProvider.Service","toAsync","DnsProvider.toAsync","DnsResolver.Service","DnsResolver.toAsync","DnsProvider.fromAsync","Provisioning.create","Provisioning.apply","Provisioning.authorize","Provisioning.PartialApplyError","DnsRecord.equals","Deletion.create","Deletion.apply","Deletion.authorize","Provisioning.ConflictError","Provisioning.StaleError","DnsProvider.Error","DnsProvider.Service","Digest.webCryptoLayer","DnsRecord.parse"],"sources":["../src/stores/in-memory-lifecycle-repository.ts","../src/stores/in-memory-continuation.ts","../src/provider/in-memory.ts","../src/verification/in-memory.ts","../src/testing/provider-conformance.ts"],"sourcesContent":["import { Effect, Layer, Ref, Semaphore } from \"effect\";\n\nimport * as ProviderAuthorization from \"../auth/authorization.ts\";\nimport * as Connection from \"../auth/connection.ts\";\nimport * as Lifecycle from \"../auth/lifecycle-repository.ts\";\n\nexport interface Options {\n readonly beforeCommit?: (\n operation: string,\n aggregate: Lifecycle.Aggregate | null,\n ) => Effect.Effect<void, Lifecycle.Error>;\n}\n\nfunction missing(operation: string, message: string): Lifecycle.Error {\n return new Lifecycle.Error({\n category: \"storage\",\n message,\n operation,\n retry: \"never\",\n });\n}\n\nfunction conflict(operation: string, message: string): Lifecycle.Error {\n return new Lifecycle.Error({\n category: \"storage\",\n message,\n operation,\n retry: \"after-user-action\",\n });\n}\n\nfunction ownerConnection(\n aggregate: Lifecycle.Aggregate,\n connectionId: string,\n ownerId: string,\n): Connection.StoredConnection | undefined {\n return aggregate.connections.find(\n (connection) => connection.id === connectionId && connection.ownerId === ownerId,\n );\n}\n\nfunction publicConnection(\n connection: Connection.StoredConnection,\n authorization: ProviderAuthorization.ProviderAuthorization,\n): Connection.ProviderConnection {\n return Connection.project(connection, authorization);\n}\n\nexport function make(options: Options = {}): Lifecycle.Interface {\n const state = Effect.runSync(Ref.make<ReadonlyMap<string, Lifecycle.Aggregate>>(new Map()));\n const mutations = Semaphore.makeUnsafe(1);\n const serialize = <A, E, R>(effect: Effect.Effect<A, E, R>) => mutations.withPermit(effect);\n\n const commit = Effect.fn(\"InMemoryManagedDnsConnections.commit\")(function* (\n operation: string,\n aggregate: Lifecycle.Aggregate,\n ) {\n if (options.beforeCommit !== undefined) yield* options.beforeCommit(operation, aggregate);\n yield* Ref.update(state, (entries) => {\n const next = new Map(entries);\n next.set(aggregate.authorization.id, aggregate);\n return next;\n });\n });\n\n const remove = Effect.fn(\"InMemoryManagedDnsConnections.remove\")(function* (\n operation: string,\n authorizationId: string,\n ) {\n if (options.beforeCommit !== undefined) yield* options.beforeCommit(operation, null);\n yield* Ref.update(state, (entries) => {\n const next = new Map(entries);\n next.delete(authorizationId);\n return next;\n });\n });\n\n const get = Effect.fn(\"ManagedDnsConnections.get\")((authorizationId: string) =>\n Ref.get(state).pipe(Effect.map((entries) => entries.get(authorizationId) ?? null)),\n );\n\n const getByConnectionId = Effect.fn(\"ManagedDnsConnections.getByConnectionId\")(\n (connectionId: string) =>\n Ref.get(state).pipe(\n Effect.map(\n (entries) =>\n [...entries.values()].find((aggregate) =>\n aggregate.connections.some((connection) => connection.id === connectionId),\n ) ?? null,\n ),\n ),\n );\n\n const finishRevocation = Effect.fn(\"InMemoryManagedDnsConnections.finishRevocation\")(function* <\n E,\n >(\n aggregate: Lifecycle.Aggregate,\n connection: Connection.StoredConnection,\n revoke: (authorization: ProviderAuthorization.ProviderAuthorization) => Effect.Effect<void, E>,\n ) {\n const pending: Lifecycle.Aggregate = {\n ...aggregate,\n authorization: {\n ...aggregate.authorization,\n revocation:\n aggregate.authorization.revocation._tag === \"Pending\"\n ? aggregate.authorization.revocation\n : { _tag: \"Pending\", requestedAt: new Date() },\n },\n };\n yield* commit(\"prepareRevocation\", pending);\n yield* revoke(pending.authorization);\n yield* remove(\"completeRevocation\", pending.authorization.id);\n return {\n connection: publicConnection(connection, pending.authorization),\n remainingConnections: 0,\n revokedAuthorization: true,\n } satisfies Lifecycle.DisconnectResult;\n });\n\n return Lifecycle.Service.of({\n attach: ({ attachment, connectionId, ownerId }) =>\n serialize(\n Effect.gen(function* () {\n const aggregate = yield* getByConnectionId(connectionId);\n if (aggregate === null) {\n return yield* missing(\"attach\", \"Provider connection does not exist\");\n }\n const connection = ownerConnection(aggregate, connectionId, ownerId);\n if (connection === undefined) {\n return yield* missing(\"attach\", \"Provider connection does not belong to this owner\");\n }\n if (attachment.connectionId !== connectionId) {\n return yield* conflict(\"attach\", \"Domain attachment targets another connection\");\n }\n const existing = aggregate.attachments.find(({ id }) => id === attachment.id);\n if (existing !== undefined) {\n if (\n existing.connectionId !== attachment.connectionId ||\n existing.domain !== attachment.domain ||\n existing.target.accountId !== attachment.target.accountId ||\n existing.target.accountKind !== attachment.target.accountKind ||\n existing.target.zoneId !== attachment.target.zoneId ||\n existing.target.zoneName !== attachment.target.zoneName\n ) {\n return yield* conflict(\"attach\", \"Domain attachment id is already in use\");\n }\n return {\n attachment: existing,\n connection: publicConnection(connection, aggregate.authorization),\n };\n }\n const duplicateId = [...(yield* Ref.get(state)).values()].some((candidate) =>\n candidate.attachments.some(({ id }) => id === attachment.id),\n );\n if (duplicateId) {\n return yield* conflict(\"attach\", \"Domain attachment id is already in use\");\n }\n const duplicate = [...(yield* Ref.get(state)).values()].some((candidate) => {\n return candidate.attachments.some(\n ({ connectionId: attachmentConnectionId, domain }) =>\n domain === attachment.domain &&\n candidate.connections.some(\n (candidateConnection) =>\n candidateConnection.id === attachmentConnectionId &&\n candidateConnection.ownerId === ownerId,\n ),\n );\n });\n if (duplicate) {\n return yield* conflict(\n \"attach\",\n \"An organization domain already has a provider attachment\",\n );\n }\n const next: Lifecycle.Aggregate = {\n ...aggregate,\n attachments: [...aggregate.attachments, attachment],\n };\n yield* commit(\"attach\", next);\n return {\n attachment,\n connection: publicConnection(connection, aggregate.authorization),\n };\n }),\n ),\n connect: (input) =>\n serialize(\n Effect.gen(function* () {\n const entries = yield* Ref.get(state);\n const current = entries.get(input.authorization.id);\n if (\n current?.authorization.revocation._tag === \"Pending\" ||\n (input.expectedAuthorizationId !== undefined && current === undefined)\n ) {\n return yield* conflict(\n \"connect\",\n current === undefined\n ? \"Provider authorization no longer exists\"\n : \"Provider authorization is awaiting revocation recovery\",\n );\n }\n if (\n input.expectedAuthorizationId !== undefined &&\n current?.authorization.id !== input.expectedAuthorizationId\n ) {\n return yield* conflict(\"connect\", \"Provider authorization changed during reconnect\");\n }\n if (\n input.authorization.id !== input.connection.authorizationId ||\n input.authorization.providerId !== input.connection.providerId ||\n input.authorization.method !== input.connection.method\n ) {\n return yield* conflict(\"connect\", \"Connection does not match its authorization\");\n }\n const existingConnection = current?.connections.find(\n (connection) => connection.ownerId === input.connection.ownerId,\n );\n if (\n input.expectedConnectionId !== undefined &&\n existingConnection?.id !== input.expectedConnectionId\n ) {\n return yield* conflict(\"connect\", \"Organization connection changed during reconnect\");\n }\n const connection = existingConnection ?? input.connection;\n const next: Lifecycle.Aggregate = {\n authorization: input.authorization,\n connections: current\n ? [...current.connections.filter(({ id }) => id !== connection.id), connection]\n : [connection],\n attachments: current?.attachments ?? [],\n credential: input.credential,\n };\n yield* commit(\"connect\", next);\n return next;\n }),\n ),\n detach: ({ attachmentId, ownerId }) =>\n serialize(\n Effect.gen(function* () {\n const entries = yield* Ref.get(state);\n for (const aggregate of entries.values()) {\n const attachment = aggregate.attachments.find(({ id }) => id === attachmentId);\n if (attachment === undefined) continue;\n const connection = ownerConnection(aggregate, attachment.connectionId, ownerId);\n if (connection === undefined) {\n return yield* missing(\"detach\", \"Domain attachment does not belong to this owner\");\n }\n const next: Lifecycle.Aggregate = {\n ...aggregate,\n attachments: aggregate.attachments.filter(({ id }) => id !== attachmentId),\n };\n yield* commit(\"detach\", next);\n return {\n attachment,\n connection: publicConnection(connection, aggregate.authorization),\n remainingAttachments: next.attachments.filter(\n ({ connectionId }) => connectionId === connection.id,\n ).length,\n };\n }\n return yield* missing(\"detach\", \"Domain attachment does not exist\");\n }),\n ),\n disconnect: ({ connectionId, ownerId, revoke }) =>\n serialize(\n Effect.gen(function* () {\n const aggregate = yield* getByConnectionId(connectionId);\n if (aggregate === null) {\n return yield* missing(\"disconnect\", \"Provider connection does not exist\");\n }\n const connection = ownerConnection(aggregate, connectionId, ownerId);\n if (connection === undefined) {\n return yield* missing(\n \"disconnect\",\n \"Provider connection does not belong to this owner\",\n );\n }\n if (aggregate.attachments.some(({ connectionId: id }) => id === connectionId)) {\n return yield* conflict(\n \"disconnect\",\n \"Detach all organization domains before disconnecting the provider\",\n );\n }\n const remainingConnections = aggregate.connections.filter(\n ({ id }) => id !== connectionId,\n );\n if (remainingConnections.length > 0) {\n const next: Lifecycle.Aggregate = { ...aggregate, connections: remainingConnections };\n yield* commit(\"disconnectConnection\", next);\n return {\n connection: publicConnection(connection, aggregate.authorization),\n remainingConnections: remainingConnections.length,\n revokedAuthorization: false,\n };\n }\n return yield* finishRevocation(aggregate, connection, revoke);\n }).pipe(Effect.withSpan(\"ManagedDnsConnections.disconnect\")),\n ),\n findConnection: (ownerId, authorizationId) =>\n Ref.get(state).pipe(\n Effect.map(\n (entries) =>\n entries.get(authorizationId)?.connections.find(({ ownerId: id }) => id === ownerId) ??\n null,\n ),\n ),\n get,\n getAttachment: (attachmentId) =>\n Ref.get(state).pipe(\n Effect.map(\n (entries) =>\n [...entries.values()]\n .flatMap(({ attachments }) => attachments)\n .find(({ id }) => id === attachmentId) ?? null,\n ),\n ),\n getByConnectionId,\n listAttachments: (connectionId, ownerId) =>\n Effect.gen(function* () {\n const aggregate = yield* getByConnectionId(connectionId);\n if (aggregate === null) {\n return yield* missing(\"listAttachments\", \"Provider connection does not exist\");\n }\n if (ownerConnection(aggregate, connectionId, ownerId) === undefined) {\n return yield* missing(\n \"listAttachments\",\n \"Provider connection does not belong to this owner\",\n );\n }\n return aggregate.attachments.filter(({ connectionId: id }) => id === connectionId);\n }),\n promoteEvidence: (authorizationId, evidence) =>\n serialize(\n Effect.gen(function* () {\n const aggregate = yield* get(authorizationId);\n if (aggregate === null) {\n return yield* missing(\"promoteEvidence\", \"Provider authorization does not exist\");\n }\n const byCapability = new Map(\n aggregate.authorization.capabilityEvidence.map((item) => [item.capability, item]),\n );\n for (const item of evidence) byCapability.set(item.capability, item);\n const next = {\n ...aggregate,\n authorization: {\n ...aggregate.authorization,\n capabilityEvidence: [...byCapability.values()],\n },\n };\n yield* commit(\"promoteEvidence\", next);\n return next;\n }),\n ),\n recover: ({ authorizationId, revoke }) =>\n serialize(\n Effect.gen(function* () {\n const aggregate = yield* get(authorizationId);\n if (aggregate === null) {\n return yield* missing(\"recover\", \"Provider authorization does not exist\");\n }\n if (aggregate.authorization.revocation._tag !== \"Pending\") {\n return yield* missing(\"recover\", \"Provider authorization is not awaiting revocation\");\n }\n const connection = aggregate.connections[0];\n if (connection === undefined) {\n return yield* missing(\"recover\", \"Pending authorization has no connection\");\n }\n return yield* finishRevocation(aggregate, connection, revoke);\n }).pipe(Effect.withSpan(\"ManagedDnsConnections.recover\")),\n ),\n rotate: (authorizationId, credential, expiresAt) =>\n serialize(\n Effect.gen(function* () {\n const aggregate = yield* get(authorizationId);\n if (aggregate === null) {\n return yield* missing(\"rotate\", \"Provider authorization does not exist\");\n }\n const next = {\n ...aggregate,\n authorization: { ...aggregate.authorization, expiresAt },\n credential,\n };\n yield* commit(\"rotate\", next);\n return next;\n }),\n ),\n });\n}\n\nexport const layer = (options: Options = {}) => Layer.sync(Lifecycle.Service, () => make(options));\n","import { Effect, Ref } from \"effect\";\n\nimport type * as Connection from \"../auth/connect.ts\";\n\nexport function make(): Connection.ContinuationStore {\n const state = Effect.runSync(Ref.make<ReadonlyMap<string, Connection.Continuation>>(new Map()));\n return {\n consume: Effect.fn(\"ConnectionContinuations.consume\")(function* (id, now) {\n return yield* Ref.modify(state, (entries) => {\n const continuation = entries.get(id);\n const next = new Map(entries);\n next.delete(id);\n return [\n continuation !== undefined && continuation.expiresAt > now ? continuation : null,\n next,\n ] as const;\n });\n }),\n put: Effect.fn(\"ConnectionContinuations.put\")((continuation) =>\n Ref.update(state, (entries) => {\n const next = new Map(entries);\n next.set(continuation.id, continuation);\n return next;\n }),\n ),\n };\n}\n","import { Effect, Layer } from \"effect\";\n\nimport * as DomainName from \"../domain/domain-name.ts\";\nimport type * as DnsRecord from \"../domain/dns-record.ts\";\nimport * as DnsProvider from \"./provider.ts\";\n\nexport interface Options {\n readonly id?: string;\n readonly records?: Readonly<Record<string, ReadonlyArray<DnsRecord.Observed>>>;\n}\n\nexport function make(options: Options = {}): DnsProvider.Interface {\n const id = options.id ?? \"memory\";\n const records = new Map<DomainName.DomainName, Array<DnsRecord.Observed>>();\n const recordIds = new Map<string, DnsRecord.Observed>();\n for (const [zone, initial] of Object.entries(options.records ?? {})) {\n records.set(DomainName.parse(zone), [...initial]);\n for (const [index, record] of initial.entries()) recordIds.set(`${id}:${index + 1}`, record);\n }\n return {\n id,\n listRecords: Effect.fn(\"InMemoryDnsProvider.listRecords\")((zone) =>\n Effect.sync(() => [...(records.get(zone) ?? [])]),\n ),\n createRecord: Effect.fn(\"InMemoryDnsProvider.createRecord\")((zone, record) =>\n Effect.sync(() => {\n const current = records.get(zone) ?? [];\n current.push(record);\n records.set(zone, current);\n const providerRecordId = `${id}:${current.length}`;\n recordIds.set(providerRecordId, record);\n return { providerRecordId };\n }),\n ),\n deleteRecord: Effect.fn(\"InMemoryDnsProvider.deleteRecord\")((zone, providerRecordId) =>\n Effect.sync(() => {\n const record = recordIds.get(providerRecordId);\n if (record === undefined) return;\n records.set(\n zone,\n (records.get(zone) ?? []).filter((candidate) => candidate !== record),\n );\n recordIds.delete(providerRecordId);\n }),\n ),\n getRecord: Effect.fn(\"InMemoryDnsProvider.getRecord\")((_zone, providerRecordId) =>\n Effect.sync(() => recordIds.get(providerRecordId) ?? null),\n ),\n };\n}\n\nexport const layer = (options: Options = {}): Layer.Layer<DnsProvider.Service> =>\n Layer.succeed(DnsProvider.Service, make(options));\n\nexport const toAsync = (options: Options = {}): DnsProvider.AsyncInterface =>\n DnsProvider.toAsync(make(options));\n","import { Effect, Layer } from \"effect\";\n\nimport * as DnsResolver from \"./resolver.ts\";\n\nexport type Resolve = (\n query: DnsResolver.Query,\n) => DnsResolver.Resolution | Effect.Effect<DnsResolver.Resolution, DnsResolver.Error>;\n\nexport function make(resolve: Resolve): DnsResolver.Interface {\n return {\n resolve: Effect.fn(\"InMemoryDnsResolver.resolve\")((query) =>\n Effect.suspend(() => {\n const resolution = resolve(query);\n return Effect.isEffect(resolution) ? resolution : Effect.succeed(resolution);\n }),\n ),\n };\n}\n\nexport const layer = (resolve: Resolve): Layer.Layer<DnsResolver.Service> =>\n Layer.succeed(DnsResolver.Service, make(resolve));\n\nexport const toAsync = (resolve: Resolve): DnsResolver.AsyncInterface =>\n DnsResolver.toAsync(make(resolve));\n","import { Effect, Layer, Schema } from \"effect\";\n\nimport * as DomainName from \"../domain/domain-name.ts\";\nimport * as DnsRecord from \"../domain/dns-record.ts\";\nimport * as Deletion from \"../plan/deletion.ts\";\nimport * as Digest from \"../plan/canonical-json.ts\";\nimport * as Provisioning from \"../plan/plan.ts\";\nimport * as DnsProvider from \"../provider/provider.ts\";\n\nexport class Error extends Schema.TaggedError<Error>()(\"ProviderConformanceError\", {\n case: Schema.String,\n message: Schema.String,\n providerId: Schema.String,\n}) {}\n\nexport interface Input {\n readonly makeProvider: () => Effect.Effect<DnsProvider.Interface, DnsProvider.Error>;\n readonly prefix?: string;\n readonly zone: DomainName.DomainName;\n}\n\nexport interface Report {\n readonly cases: ReadonlyArray<string>;\n readonly providerId: string;\n readonly zone: DomainName.DomainName;\n}\n\n/** Adapt a fresh Promise-shaped provider factory for the Effect-native conformance runner. */\nexport function fromAsync(makeProvider: () => DnsProvider.AsyncInterface): Input[\"makeProvider\"] {\n return () => Effect.sync(() => DnsProvider.fromAsync(makeProvider()));\n}\n\nconst cases = [\n \"create-readback-cleanup\",\n \"exact-noop\",\n \"conflict\",\n \"stale-plan\",\n \"partial-apply-cleanup\",\n] as const;\n\n/** Run the deterministic offline contract every DomainKit DNS adapter must satisfy. */\nexport const run = Effect.fn(\"ProviderConformance.run\")(function* (input: Input) {\n const makeProvider = () =>\n Effect.suspend(input.makeProvider).pipe(\n Effect.catchDefect((cause) =>\n Effect.fail(\n new Error({\n case: \"factory\",\n message: cause instanceof globalThis.Error ? cause.message : \"Provider factory failed\",\n providerId: \"unknown\",\n }),\n ),\n ),\n );\n const first = yield* makeProvider();\n const providerId = first.id;\n const prefix = input.prefix ?? \"domainkit-conformance\";\n yield* createReadbackCleanup(first, input.zone, prefix);\n yield* exactNoop(yield* makeProvider(), input.zone, prefix);\n yield* conflict(yield* makeProvider(), input.zone, prefix);\n yield* stalePlan(yield* makeProvider(), input.zone, prefix);\n yield* partialApplyCleanup(yield* makeProvider(), input.zone, prefix);\n return { cases, providerId, zone: input.zone } satisfies Report;\n});\n\nfunction createReadbackCleanup(\n provider: DnsProvider.Interface,\n zone: DomainName.DomainName,\n prefix: string,\n) {\n const requirements = createRequirements(zone, prefix);\n let cleanupRecordIds: ReadonlyArray<string> = [];\n return Effect.gen(function* () {\n const { plan } = yield* Provisioning.create({\n requirements,\n target: Provisioning.Target.ExactZone({ zone }),\n });\n yield* requireTags(provider, \"create-readback-cleanup\", plan.operations, [\"create\", \"create\"]);\n const receipt = yield* Provisioning.apply({\n authorization: yield* Provisioning.authorize(plan),\n plan,\n }).pipe(\n Effect.tapError((failure) =>\n failure instanceof Provisioning.PartialApplyError\n ? Effect.sync(() => {\n cleanupRecordIds = providerRecordIds(failure.receipt.operations);\n })\n : Effect.void,\n ),\n );\n cleanupRecordIds = providerRecordIds(receipt.operations);\n yield* requireCondition(\n provider,\n \"create-readback-cleanup\",\n receipt.status === \"complete\" &&\n receipt.operations.every(({ providerRecordId }) => providerRecordId !== null),\n \"apply must return a complete receipt with provider record IDs\",\n );\n const observed = yield* provider.listRecords(zone);\n yield* requireCondition(\n provider,\n \"create-readback-cleanup\",\n requirements.every((requirement) =>\n observed.some(\n (record) => record._tag !== \"Opaque\" && DnsRecord.equals(record, requirement),\n ),\n ),\n \"listRecords must return every created record, including across provider pages\",\n );\n const deletion = yield* Deletion.create({ plan, receipt });\n const deletionReceipt = yield* Deletion.apply({\n authorization: yield* Deletion.authorize(deletion),\n plan: deletion,\n });\n yield* requireCondition(\n provider,\n \"create-readback-cleanup\",\n deletionReceipt.status === \"complete\" &&\n (yield* recordIdsAbsent(provider, zone, cleanupRecordIds)),\n \"receipt-bound cleanup must remove every created record\",\n );\n }).pipe(\n Effect.ensuring(bestEffortDelete(provider, zone, () => cleanupRecordIds)),\n Effect.provide(providerLayer(provider)),\n );\n}\n\nfunction exactNoop(provider: DnsProvider.Interface, zone: DomainName.DomainName, prefix: string) {\n const requirement = cname(zone, `${prefix}-exact`);\n let cleanupRecordIds: ReadonlyArray<string> = [];\n return Effect.gen(function* () {\n const created = yield* provider.createRecord(zone, requirement);\n cleanupRecordIds = created.providerRecordId === null ? [] : [created.providerRecordId];\n const { plan } = yield* Provisioning.create({\n requirements: [requirement],\n target: Provisioning.Target.ExactZone({ zone }),\n });\n yield* requireTags(provider, \"exact-noop\", plan.operations, [\"noop\"]);\n const receipt = yield* Provisioning.apply({\n authorization: yield* Provisioning.authorize(plan),\n plan,\n });\n yield* requireCondition(\n provider,\n \"exact-noop\",\n receipt.operations.length === 0,\n \"an exact plan must not create another record\",\n );\n yield* deleteCreated(provider, zone, created.providerRecordId, \"exact-noop\");\n }).pipe(\n Effect.ensuring(bestEffortDelete(provider, zone, () => cleanupRecordIds)),\n Effect.provide(providerLayer(provider)),\n );\n}\n\nfunction conflict(provider: DnsProvider.Interface, zone: DomainName.DomainName, prefix: string) {\n const requirement = cname(zone, `${prefix}-conflict`);\n const occupied = txt(zone, `${prefix}-conflict`, \"occupied\");\n let cleanupRecordIds: ReadonlyArray<string> = [];\n return Effect.gen(function* () {\n const created = yield* provider.createRecord(zone, occupied);\n cleanupRecordIds = created.providerRecordId === null ? [] : [created.providerRecordId];\n const { plan } = yield* Provisioning.create({\n requirements: [requirement],\n target: Provisioning.Target.ExactZone({ zone }),\n });\n yield* requireTags(provider, \"conflict\", plan.operations, [\"conflict\"]);\n const failure = yield* Provisioning.apply({\n authorization: yield* Provisioning.authorize(plan),\n plan,\n }).pipe(Effect.flip);\n yield* requireCondition(\n provider,\n \"conflict\",\n failure instanceof Provisioning.ConflictError,\n \"apply must fail closed on incompatible state\",\n );\n yield* deleteCreated(provider, zone, created.providerRecordId, \"conflict\");\n }).pipe(\n Effect.ensuring(bestEffortDelete(provider, zone, () => cleanupRecordIds)),\n Effect.provide(providerLayer(provider)),\n );\n}\n\nfunction stalePlan(provider: DnsProvider.Interface, zone: DomainName.DomainName, prefix: string) {\n const requirement = cname(zone, `${prefix}-stale`);\n let cleanupRecordIds: ReadonlyArray<string> = [];\n return Effect.gen(function* () {\n const { plan } = yield* Provisioning.create({\n requirements: [requirement],\n target: Provisioning.Target.ExactZone({ zone }),\n });\n const authorization = yield* Provisioning.authorize(plan);\n const created = yield* provider.createRecord(zone, requirement);\n cleanupRecordIds = created.providerRecordId === null ? [] : [created.providerRecordId];\n const failure = yield* Provisioning.apply({ authorization, plan }).pipe(Effect.flip);\n yield* requireCondition(\n provider,\n \"stale-plan\",\n failure instanceof Provisioning.StaleError,\n \"apply must reject provider state that changed after authorization\",\n );\n yield* deleteCreated(provider, zone, created.providerRecordId, \"stale-plan\");\n }).pipe(\n Effect.ensuring(bestEffortDelete(provider, zone, () => cleanupRecordIds)),\n Effect.provide(providerLayer(provider)),\n );\n}\n\nfunction partialApplyCleanup(\n provider: DnsProvider.Interface,\n zone: DomainName.DomainName,\n prefix: string,\n) {\n let creates = 0;\n const flaky = DnsProvider.Service.of({\n ...provider,\n createRecord: Effect.fn(\"ProviderConformance.createRecord\")((target, record) => {\n creates += 1;\n return creates === 1\n ? provider.createRecord(target, record)\n : Effect.fail(\n new DnsProvider.Error({\n message: \"injected conformance failure\",\n operation: \"createRecord\",\n providerId: provider.id,\n }),\n );\n }),\n });\n const requirements = [\n cname(zone, `${prefix}-partial-one`),\n txt(zone, `${prefix}-partial-two`, \"domainkit\"),\n ];\n let cleanupRecordIds: ReadonlyArray<string> = [];\n return Effect.gen(function* () {\n const { plan } = yield* Provisioning.create({\n requirements,\n target: Provisioning.Target.ExactZone({ zone }),\n });\n const failure = yield* Provisioning.apply({\n authorization: yield* Provisioning.authorize(plan),\n plan,\n }).pipe(Effect.flip);\n cleanupRecordIds =\n failure instanceof Provisioning.PartialApplyError\n ? providerRecordIds(failure.receipt.operations)\n : [];\n yield* requireCondition(\n provider,\n \"partial-apply-cleanup\",\n failure instanceof Provisioning.PartialApplyError && failure.receipt.operations.length === 1,\n \"a later write failure must preserve the first confirmed write in a partial receipt\",\n );\n if (!(failure instanceof Provisioning.PartialApplyError)) return;\n const deletion = yield* Deletion.create({ plan, receipt: failure.receipt }).pipe(\n Effect.provide(providerLayer(provider)),\n );\n yield* Deletion.apply({\n authorization: yield* Deletion.authorize(deletion),\n plan: deletion,\n }).pipe(Effect.provide(providerLayer(provider)));\n yield* requireCondition(\n provider,\n \"partial-apply-cleanup\",\n yield* recordIdsAbsent(provider, zone, cleanupRecordIds),\n \"partial receipt cleanup must remove the confirmed write\",\n );\n }).pipe(\n Effect.ensuring(bestEffortDelete(provider, zone, () => cleanupRecordIds)),\n Effect.provide(providerLayer(flaky)),\n );\n}\n\nfunction providerRecordIds(\n operations: ReadonlyArray<{ readonly providerRecordId: string | null }>,\n): ReadonlyArray<string> {\n return operations.flatMap(({ providerRecordId }) =>\n providerRecordId === null ? [] : [providerRecordId],\n );\n}\n\nfunction recordIdsAbsent(\n provider: DnsProvider.Interface,\n zone: DomainName.DomainName,\n recordIds: ReadonlyArray<string>,\n) {\n return Effect.forEach(recordIds, (providerRecordId) =>\n provider.getRecord(zone, providerRecordId),\n ).pipe(Effect.map((records) => records.every((record) => record === null)));\n}\n\nfunction bestEffortDelete(\n provider: DnsProvider.Interface,\n zone: DomainName.DomainName,\n recordIds: () => ReadonlyArray<string>,\n) {\n return Effect.suspend(() =>\n Effect.forEach(\n recordIds(),\n (providerRecordId) => provider.deleteRecord(zone, providerRecordId).pipe(Effect.ignore),\n { discard: true },\n ),\n );\n}\n\nfunction providerLayer(provider: DnsProvider.Interface) {\n return Layer.merge(Layer.succeed(DnsProvider.Service, provider), Digest.webCryptoLayer);\n}\n\nfunction createRequirements(zone: DomainName.DomainName, prefix: string) {\n return [cname(zone, `${prefix}-create`), txt(zone, `${prefix}-page`, \"domainkit\")];\n}\n\nfunction cname(zone: DomainName.DomainName, label: string) {\n return DnsRecord.parse({\n _tag: \"CNAME\",\n metadata: { ownership: \"tester\", provenance: \"domainkit\", purpose: \"conformance\" },\n name: `${label}.${zone}`,\n policy: \"exclusive\",\n target: \"target.example.net\",\n ttl: 300,\n });\n}\n\nfunction txt(zone: DomainName.DomainName, label: string, value: string) {\n return DnsRecord.parse({\n _tag: \"TXT\",\n metadata: { ownership: \"tester\", provenance: \"domainkit\", purpose: \"conformance\" },\n name: `${label}.${zone}`,\n policy: \"append\",\n ttl: 300,\n value,\n });\n}\n\nfunction requireTags(\n provider: DnsProvider.Interface,\n testCase: string,\n operations: ReadonlyArray<{ readonly _tag: string }>,\n expected: ReadonlyArray<string>,\n) {\n return requireCondition(\n provider,\n testCase,\n JSON.stringify(operations.map(({ _tag }) => _tag)) === JSON.stringify(expected),\n `expected operations ${expected.join(\", \")}`,\n );\n}\n\nfunction requireCondition(\n provider: DnsProvider.Interface,\n testCase: string,\n condition: boolean,\n message: string,\n) {\n return condition\n ? Effect.void\n : Effect.fail(new Error({ case: testCase, message, providerId: provider.id }));\n}\n\nfunction deleteCreated(\n provider: DnsProvider.Interface,\n zone: DomainName.DomainName,\n providerRecordId: string | null,\n testCase: string,\n) {\n return providerRecordId === null\n ? Effect.fail(\n new Error({\n case: testCase,\n message: \"provider must return record IDs for safe cleanup\",\n providerId: provider.id,\n }),\n )\n : provider.deleteRecord(zone, providerRecordId);\n}\n"],"mappings":";;;;;;;;AAaA,SAAS,QAAQ,WAAmB,SAAkC;CACpE,OAAO,IAAIA,QAAgB;EACzB,UAAU;EACV;EACA;EACA,OAAO;CACT,CAAC;AACH;AAEA,SAASC,WAAS,WAAmB,SAAkC;CACrE,OAAO,IAAID,QAAgB;EACzB,UAAU;EACV;EACA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,qBAAqB,OACxB,OAAO,KACL,IAAI,MAAM;EACR,MAAM;EACN,SAAS;EACT,YAAY,SAAS;CACvB,CAAC,CACH,IACA,SAAS,aAAa,MAAM,gBAAgB;AAClD"}
1
+ {"version":3,"file":"testing.mjs","names":["Lifecycle.Error","conflict","Connection.project","make","layer","Lifecycle.Service","make","make","DomainName.parse","layer","DnsProvider.Service","toAsync","DnsProvider.toAsync","DnsResolver.Service","DnsResolver.toAsync","DnsProvider.fromAsync","Provisioning.create","Provisioning.apply","Provisioning.authorize","Provisioning.PartialApplyError","DnsRecord.equals","Deletion.create","Deletion.apply","Deletion.authorize","Provisioning.ConflictError","Provisioning.StaleError","DnsProvider.Error","DnsProvider.Service","Digest.webCryptoLayer","DnsRecord.parse"],"sources":["../src/stores/in-memory-lifecycle-repository.ts","../src/stores/in-memory-continuation.ts","../src/provider/in-memory.ts","../src/verification/in-memory.ts","../src/testing/provider-conformance.ts"],"sourcesContent":["import { DateTime, Effect, Layer, Ref, Semaphore } from \"effect\";\n\nimport * as ProviderAuthorization from \"../auth/authorization.ts\";\nimport * as Connection from \"../auth/connection.ts\";\nimport * as Lifecycle from \"../auth/lifecycle-repository.ts\";\n\nexport interface Options {\n readonly beforeCommit?: (\n operation: string,\n aggregate: Lifecycle.Aggregate | null,\n ) => Effect.Effect<void, Lifecycle.Error>;\n}\n\nfunction missing(operation: string, message: string): Lifecycle.Error {\n return new Lifecycle.Error({\n category: \"storage\",\n message,\n operation,\n retry: \"never\",\n });\n}\n\nfunction conflict(operation: string, message: string): Lifecycle.Error {\n return new Lifecycle.Error({\n category: \"storage\",\n message,\n operation,\n retry: \"after-user-action\",\n });\n}\n\nfunction ownerConnection(\n aggregate: Lifecycle.Aggregate,\n connectionId: string,\n ownerId: string,\n): Connection.StoredConnection | undefined {\n return aggregate.connections.find(\n (connection) => connection.id === connectionId && connection.ownerId === ownerId,\n );\n}\n\nfunction publicConnection(\n connection: Connection.StoredConnection,\n authorization: ProviderAuthorization.ProviderAuthorization,\n credential: Connection.StoredCredential,\n): Connection.ProviderConnection {\n return Connection.project(connection, authorization, credential);\n}\n\nexport function make(options: Options = {}): Lifecycle.Interface {\n const state = Effect.runSync(Ref.make<ReadonlyMap<string, Lifecycle.Aggregate>>(new Map()));\n const mutations = Semaphore.makeUnsafe(1);\n const serialize = <A, E, R>(effect: Effect.Effect<A, E, R>) => mutations.withPermit(effect);\n\n const commit = Effect.fn(\"InMemoryManagedDnsConnections.commit\")(function* (\n operation: string,\n aggregate: Lifecycle.Aggregate,\n ) {\n if (options.beforeCommit !== undefined) yield* options.beforeCommit(operation, aggregate);\n yield* Ref.update(state, (entries) => {\n const next = new Map(entries);\n next.set(aggregate.authorization.id, aggregate);\n return next;\n });\n });\n\n const remove = Effect.fn(\"InMemoryManagedDnsConnections.remove\")(function* (\n operation: string,\n authorizationId: string,\n ) {\n if (options.beforeCommit !== undefined) yield* options.beforeCommit(operation, null);\n yield* Ref.update(state, (entries) => {\n const next = new Map(entries);\n next.delete(authorizationId);\n return next;\n });\n });\n\n const get = Effect.fn(\"ManagedDnsConnections.get\")((authorizationId: string) =>\n Ref.get(state).pipe(Effect.map((entries) => entries.get(authorizationId) ?? null)),\n );\n\n const getByConnectionId = Effect.fn(\"ManagedDnsConnections.getByConnectionId\")(\n (connectionId: string) =>\n Ref.get(state).pipe(\n Effect.map(\n (entries) =>\n [...entries.values()].find((aggregate) =>\n aggregate.connections.some((connection) => connection.id === connectionId),\n ) ?? null,\n ),\n ),\n );\n\n const finishRevocation = Effect.fn(\"InMemoryManagedDnsConnections.finishRevocation\")(function* <\n E,\n >(\n aggregate: Lifecycle.Aggregate,\n connection: Connection.StoredConnection,\n revoke: (authorization: ProviderAuthorization.ProviderAuthorization) => Effect.Effect<void, E>,\n ) {\n const requestedAt = yield* DateTime.nowAsDate;\n const pending: Lifecycle.Aggregate = {\n ...aggregate,\n authorization: {\n ...aggregate.authorization,\n revocation:\n aggregate.authorization.revocation._tag === \"Pending\"\n ? aggregate.authorization.revocation\n : ProviderAuthorization.Revocation.Pending({ requestedAt }),\n },\n };\n yield* commit(\"prepareRevocation\", pending);\n yield* revoke(pending.authorization);\n yield* remove(\"completeRevocation\", pending.authorization.id);\n return {\n connection: publicConnection(connection, pending.authorization, pending.credential),\n remainingConnections: 0,\n revokedAuthorization: true,\n } satisfies Lifecycle.DisconnectResult;\n });\n\n return Lifecycle.Service.of({\n attach: ({ attachment, connectionId, ownerId }) =>\n serialize(\n Effect.gen(function* () {\n const aggregate = yield* getByConnectionId(connectionId);\n if (aggregate === null) {\n return yield* missing(\"attach\", \"Provider connection does not exist\");\n }\n const connection = ownerConnection(aggregate, connectionId, ownerId);\n if (connection === undefined) {\n return yield* missing(\"attach\", \"Provider connection does not belong to this owner\");\n }\n if (attachment.connectionId !== connectionId) {\n return yield* conflict(\"attach\", \"Domain attachment targets another connection\");\n }\n const existing = aggregate.attachments.find(({ id }) => id === attachment.id);\n if (existing !== undefined) {\n if (\n existing.connectionId !== attachment.connectionId ||\n existing.domain !== attachment.domain ||\n existing.target.accountId !== attachment.target.accountId ||\n existing.target.accountKind !== attachment.target.accountKind ||\n existing.target.zoneId !== attachment.target.zoneId ||\n existing.target.zoneName !== attachment.target.zoneName\n ) {\n return yield* conflict(\"attach\", \"Domain attachment id is already in use\");\n }\n return {\n attachment: existing,\n connection: publicConnection(\n connection,\n aggregate.authorization,\n aggregate.credential,\n ),\n };\n }\n const duplicateId = [...(yield* Ref.get(state)).values()].some((candidate) =>\n candidate.attachments.some(({ id }) => id === attachment.id),\n );\n if (duplicateId) {\n return yield* conflict(\"attach\", \"Domain attachment id is already in use\");\n }\n const duplicate = [...(yield* Ref.get(state)).values()].some((candidate) => {\n return candidate.attachments.some(\n ({ connectionId: attachmentConnectionId, domain }) =>\n domain === attachment.domain &&\n candidate.connections.some(\n (candidateConnection) =>\n candidateConnection.id === attachmentConnectionId &&\n candidateConnection.ownerId === ownerId,\n ),\n );\n });\n if (duplicate) {\n return yield* conflict(\n \"attach\",\n \"An organization domain already has a provider attachment\",\n );\n }\n const next: Lifecycle.Aggregate = {\n ...aggregate,\n attachments: [...aggregate.attachments, attachment],\n };\n yield* commit(\"attach\", next);\n return {\n attachment,\n connection: publicConnection(connection, aggregate.authorization, aggregate.credential),\n };\n }),\n ),\n connect: (input) =>\n serialize(\n Effect.gen(function* () {\n const entries = yield* Ref.get(state);\n const current = entries.get(input.authorization.id);\n if (\n current?.authorization.revocation._tag === \"Pending\" ||\n (input.expectedAuthorizationId !== undefined && current === undefined)\n ) {\n return yield* conflict(\n \"connect\",\n current === undefined\n ? \"Provider authorization no longer exists\"\n : \"Provider authorization is awaiting revocation recovery\",\n );\n }\n if (\n input.expectedAuthorizationId !== undefined &&\n current?.authorization.id !== input.expectedAuthorizationId\n ) {\n return yield* conflict(\"connect\", \"Provider authorization changed during reconnect\");\n }\n if (\n input.authorization.id !== input.connection.authorizationId ||\n input.authorization.providerId !== input.connection.providerId ||\n input.authorization.method !== input.connection.method\n ) {\n return yield* conflict(\"connect\", \"Connection does not match its authorization\");\n }\n const existingConnection = current?.connections.find(\n (connection) => connection.ownerId === input.connection.ownerId,\n );\n if (\n input.expectedConnectionId !== undefined &&\n existingConnection?.id !== input.expectedConnectionId\n ) {\n return yield* conflict(\"connect\", \"Organization connection changed during reconnect\");\n }\n const connection = existingConnection ?? input.connection;\n const next: Lifecycle.Aggregate = {\n authorization: input.authorization,\n connections: current\n ? [...current.connections.filter(({ id }) => id !== connection.id), connection]\n : [connection],\n attachments: current?.attachments ?? [],\n credential: input.credential,\n };\n yield* commit(\"connect\", next);\n return next;\n }),\n ),\n detach: ({ attachmentId, ownerId }) =>\n serialize(\n Effect.gen(function* () {\n const entries = yield* Ref.get(state);\n for (const aggregate of entries.values()) {\n const attachment = aggregate.attachments.find(({ id }) => id === attachmentId);\n if (attachment === undefined) continue;\n const connection = ownerConnection(aggregate, attachment.connectionId, ownerId);\n if (connection === undefined) {\n return yield* missing(\"detach\", \"Domain attachment does not belong to this owner\");\n }\n const next: Lifecycle.Aggregate = {\n ...aggregate,\n attachments: aggregate.attachments.filter(({ id }) => id !== attachmentId),\n };\n yield* commit(\"detach\", next);\n return {\n attachment,\n connection: publicConnection(\n connection,\n aggregate.authorization,\n aggregate.credential,\n ),\n remainingAttachments: next.attachments.filter(\n ({ connectionId }) => connectionId === connection.id,\n ).length,\n };\n }\n return yield* missing(\"detach\", \"Domain attachment does not exist\");\n }),\n ),\n disconnect: ({ connectionId, ownerId, revoke }) =>\n serialize(\n Effect.gen(function* () {\n const aggregate = yield* getByConnectionId(connectionId);\n if (aggregate === null) {\n return yield* missing(\"disconnect\", \"Provider connection does not exist\");\n }\n const connection = ownerConnection(aggregate, connectionId, ownerId);\n if (connection === undefined) {\n return yield* missing(\n \"disconnect\",\n \"Provider connection does not belong to this owner\",\n );\n }\n if (aggregate.attachments.some(({ connectionId: id }) => id === connectionId)) {\n return yield* conflict(\n \"disconnect\",\n \"Detach all organization domains before disconnecting the provider\",\n );\n }\n const remainingConnections = aggregate.connections.filter(\n ({ id }) => id !== connectionId,\n );\n if (remainingConnections.length > 0) {\n const next: Lifecycle.Aggregate = { ...aggregate, connections: remainingConnections };\n yield* commit(\"disconnectConnection\", next);\n return {\n connection: publicConnection(\n connection,\n aggregate.authorization,\n aggregate.credential,\n ),\n remainingConnections: remainingConnections.length,\n revokedAuthorization: false,\n };\n }\n return yield* finishRevocation(aggregate, connection, revoke);\n }).pipe(Effect.withSpan(\"ManagedDnsConnections.disconnect\")),\n ),\n findConnection: (ownerId, authorizationId) =>\n Ref.get(state).pipe(\n Effect.map(\n (entries) =>\n entries.get(authorizationId)?.connections.find(({ ownerId: id }) => id === ownerId) ??\n null,\n ),\n ),\n get,\n getAttachment: (attachmentId) =>\n Ref.get(state).pipe(\n Effect.map(\n (entries) =>\n [...entries.values()]\n .flatMap(({ attachments }) => attachments)\n .find(({ id }) => id === attachmentId) ?? null,\n ),\n ),\n getByConnectionId,\n listAttachments: (connectionId, ownerId) =>\n Effect.gen(function* () {\n const aggregate = yield* getByConnectionId(connectionId);\n if (aggregate === null) {\n return yield* missing(\"listAttachments\", \"Provider connection does not exist\");\n }\n if (ownerConnection(aggregate, connectionId, ownerId) === undefined) {\n return yield* missing(\n \"listAttachments\",\n \"Provider connection does not belong to this owner\",\n );\n }\n return aggregate.attachments.filter(({ connectionId: id }) => id === connectionId);\n }),\n promoteEvidence: (authorizationId, evidence) =>\n serialize(\n Effect.gen(function* () {\n const aggregate = yield* get(authorizationId);\n if (aggregate === null) {\n return yield* missing(\"promoteEvidence\", \"Provider authorization does not exist\");\n }\n const byCapability = new Map(\n aggregate.authorization.capabilityEvidence.map((item) => [item.capability, item]),\n );\n for (const item of evidence) byCapability.set(item.capability, item);\n const next = {\n ...aggregate,\n authorization: {\n ...aggregate.authorization,\n capabilityEvidence: [...byCapability.values()],\n },\n };\n yield* commit(\"promoteEvidence\", next);\n return next;\n }),\n ),\n recover: ({ authorizationId, revoke }) =>\n serialize(\n Effect.gen(function* () {\n const aggregate = yield* get(authorizationId);\n if (aggregate === null) {\n return yield* missing(\"recover\", \"Provider authorization does not exist\");\n }\n if (aggregate.authorization.revocation._tag !== \"Pending\") {\n return yield* missing(\"recover\", \"Provider authorization is not awaiting revocation\");\n }\n const connection = aggregate.connections[0];\n if (connection === undefined) {\n return yield* missing(\"recover\", \"Pending authorization has no connection\");\n }\n return yield* finishRevocation(aggregate, connection, revoke);\n }).pipe(Effect.withSpan(\"ManagedDnsConnections.recover\")),\n ),\n rotate: (authorizationId, credential) =>\n serialize(\n Effect.gen(function* () {\n const aggregate = yield* get(authorizationId);\n if (aggregate === null) {\n return yield* missing(\"rotate\", \"Provider authorization does not exist\");\n }\n const next = {\n ...aggregate,\n credential,\n };\n yield* commit(\"rotate\", next);\n return next;\n }),\n ),\n });\n}\n\nexport const layer = (options: Options = {}) => Layer.sync(Lifecycle.Service, () => make(options));\n","import { Effect, Ref } from \"effect\";\n\nimport type * as Connection from \"../auth/connect.ts\";\n\nexport function make(): Connection.ContinuationStore {\n const state = Effect.runSync(Ref.make<ReadonlyMap<string, Connection.Continuation>>(new Map()));\n return {\n consume: Effect.fn(\"ConnectionContinuations.consume\")(function* (id, now) {\n return yield* Ref.modify(state, (entries) => {\n const continuation = entries.get(id);\n const next = new Map(entries);\n next.delete(id);\n return [\n continuation !== undefined && continuation.expiresAt > now ? continuation : null,\n next,\n ] as const;\n });\n }),\n put: Effect.fn(\"ConnectionContinuations.put\")((continuation) =>\n Ref.update(state, (entries) => {\n const next = new Map(entries);\n next.set(continuation.id, continuation);\n return next;\n }),\n ),\n };\n}\n","import { Effect, Layer } from \"effect\";\n\nimport * as DomainName from \"../domain/domain-name.ts\";\nimport type * as DnsRecord from \"../domain/dns-record.ts\";\nimport * as DnsProvider from \"./provider.ts\";\n\nexport interface Options {\n readonly id?: string;\n readonly records?: Readonly<Record<string, ReadonlyArray<DnsRecord.Observed>>>;\n}\n\nexport function make(options: Options = {}): DnsProvider.Interface {\n const id = options.id ?? \"memory\";\n const records = new Map<DomainName.DomainName, Array<DnsRecord.Observed>>();\n const recordIds = new Map<string, DnsRecord.Observed>();\n for (const [zone, initial] of Object.entries(options.records ?? {})) {\n records.set(DomainName.parse(zone), [...initial]);\n for (const [index, record] of initial.entries()) recordIds.set(`${id}:${index + 1}`, record);\n }\n return {\n id,\n listRecords: Effect.fn(\"InMemoryDnsProvider.listRecords\")((zone) =>\n Effect.sync(() => [...(records.get(zone) ?? [])]),\n ),\n createRecord: Effect.fn(\"InMemoryDnsProvider.createRecord\")((zone, record) =>\n Effect.sync(() => {\n const current = records.get(zone) ?? [];\n current.push(record);\n records.set(zone, current);\n const providerRecordId = `${id}:${current.length}`;\n recordIds.set(providerRecordId, record);\n return { providerRecordId };\n }),\n ),\n deleteRecord: Effect.fn(\"InMemoryDnsProvider.deleteRecord\")((zone, providerRecordId) =>\n Effect.sync(() => {\n const record = recordIds.get(providerRecordId);\n if (record === undefined) return;\n records.set(\n zone,\n (records.get(zone) ?? []).filter((candidate) => candidate !== record),\n );\n recordIds.delete(providerRecordId);\n }),\n ),\n getRecord: Effect.fn(\"InMemoryDnsProvider.getRecord\")((_zone, providerRecordId) =>\n Effect.sync(() => recordIds.get(providerRecordId) ?? null),\n ),\n };\n}\n\nexport const layer = (options: Options = {}): Layer.Layer<DnsProvider.Service> =>\n Layer.succeed(DnsProvider.Service, make(options));\n\nexport const toAsync = (options: Options = {}): DnsProvider.AsyncInterface =>\n DnsProvider.toAsync(make(options));\n","import { Effect, Layer } from \"effect\";\n\nimport * as DnsResolver from \"./resolver.ts\";\n\nexport type Resolve = (\n query: DnsResolver.Query,\n) => DnsResolver.Resolution | Effect.Effect<DnsResolver.Resolution, DnsResolver.Error>;\n\nexport function make(resolve: Resolve): DnsResolver.Interface {\n return {\n resolve: Effect.fn(\"InMemoryDnsResolver.resolve\")((query) =>\n Effect.suspend(() => {\n const resolution = resolve(query);\n return Effect.isEffect(resolution) ? resolution : Effect.succeed(resolution);\n }),\n ),\n };\n}\n\nexport const layer = (resolve: Resolve): Layer.Layer<DnsResolver.Service> =>\n Layer.succeed(DnsResolver.Service, make(resolve));\n\nexport const toAsync = (resolve: Resolve): DnsResolver.AsyncInterface =>\n DnsResolver.toAsync(make(resolve));\n","import { Effect, Layer, Schema } from \"effect\";\n\nimport * as DomainName from \"../domain/domain-name.ts\";\nimport * as DnsRecord from \"../domain/dns-record.ts\";\nimport * as Deletion from \"../plan/deletion.ts\";\nimport * as Digest from \"../plan/canonical-json.ts\";\nimport * as Provisioning from \"../plan/plan.ts\";\nimport * as DnsProvider from \"../provider/provider.ts\";\n\nexport class Error extends Schema.TaggedError<Error>()(\"ProviderConformanceError\", {\n case: Schema.String,\n message: Schema.String,\n providerId: Schema.String,\n}) {}\n\nexport interface Input {\n readonly makeProvider: () => Effect.Effect<DnsProvider.Interface, DnsProvider.Error>;\n readonly prefix?: string;\n readonly zone: DomainName.DomainName;\n}\n\nexport interface Report {\n readonly cases: ReadonlyArray<string>;\n readonly providerId: string;\n readonly zone: DomainName.DomainName;\n}\n\n/** Adapt a fresh Promise-shaped provider factory for the Effect-native conformance runner. */\nexport function fromAsync(makeProvider: () => DnsProvider.AsyncInterface): Input[\"makeProvider\"] {\n return () => Effect.sync(() => DnsProvider.fromAsync(makeProvider()));\n}\n\nconst cases = [\n \"create-readback-cleanup\",\n \"exact-noop\",\n \"conflict\",\n \"stale-plan\",\n \"partial-apply-cleanup\",\n] as const;\n\n/** Run the deterministic offline contract every DomainKit DNS adapter must satisfy. */\nexport const run = Effect.fn(\"ProviderConformance.run\")(function* (input: Input) {\n const makeProvider = () =>\n Effect.suspend(input.makeProvider).pipe(\n Effect.catchDefect((cause) =>\n Effect.fail(\n new Error({\n case: \"factory\",\n message: cause instanceof globalThis.Error ? cause.message : \"Provider factory failed\",\n providerId: \"unknown\",\n }),\n ),\n ),\n );\n const first = yield* makeProvider();\n const providerId = first.id;\n const prefix = input.prefix ?? \"domainkit-conformance\";\n yield* createReadbackCleanup(first, input.zone, prefix);\n yield* exactNoop(yield* makeProvider(), input.zone, prefix);\n yield* conflict(yield* makeProvider(), input.zone, prefix);\n yield* stalePlan(yield* makeProvider(), input.zone, prefix);\n yield* partialApplyCleanup(yield* makeProvider(), input.zone, prefix);\n return { cases, providerId, zone: input.zone } satisfies Report;\n});\n\nfunction createReadbackCleanup(\n provider: DnsProvider.Interface,\n zone: DomainName.DomainName,\n prefix: string,\n) {\n const requirements = createRequirements(zone, prefix);\n let cleanupRecordIds: ReadonlyArray<string> = [];\n return Effect.gen(function* () {\n const { plan } = yield* Provisioning.create({\n requirements,\n target: Provisioning.Target.ExactZone({ zone }),\n });\n yield* requireTags(provider, \"create-readback-cleanup\", plan.operations, [\"create\", \"create\"]);\n const receipt = yield* Provisioning.apply({\n authorization: yield* Provisioning.authorize(plan),\n plan,\n }).pipe(\n Effect.tapError((failure) =>\n failure instanceof Provisioning.PartialApplyError\n ? Effect.sync(() => {\n cleanupRecordIds = providerRecordIds(failure.receipt.operations);\n })\n : Effect.void,\n ),\n );\n cleanupRecordIds = providerRecordIds(receipt.operations);\n yield* requireCondition(\n provider,\n \"create-readback-cleanup\",\n receipt.status === \"complete\" &&\n receipt.operations.every(({ providerRecordId }) => providerRecordId !== null),\n \"apply must return a complete receipt with provider record IDs\",\n );\n const observed = yield* provider.listRecords(zone);\n yield* requireCondition(\n provider,\n \"create-readback-cleanup\",\n requirements.every((requirement) =>\n observed.some(\n (record) => record._tag !== \"Opaque\" && DnsRecord.equals(record, requirement),\n ),\n ),\n \"listRecords must return every created record, including across provider pages\",\n );\n const deletion = yield* Deletion.create({ plan, receipt });\n const deletionReceipt = yield* Deletion.apply({\n authorization: yield* Deletion.authorize(deletion),\n plan: deletion,\n });\n yield* requireCondition(\n provider,\n \"create-readback-cleanup\",\n deletionReceipt.status === \"complete\" &&\n (yield* recordIdsAbsent(provider, zone, cleanupRecordIds)),\n \"receipt-bound cleanup must remove every created record\",\n );\n }).pipe(\n Effect.ensuring(bestEffortDelete(provider, zone, () => cleanupRecordIds)),\n Effect.provide(providerLayer(provider)),\n );\n}\n\nfunction exactNoop(provider: DnsProvider.Interface, zone: DomainName.DomainName, prefix: string) {\n const requirement = cname(zone, `${prefix}-exact`);\n let cleanupRecordIds: ReadonlyArray<string> = [];\n return Effect.gen(function* () {\n const created = yield* provider.createRecord(zone, requirement);\n cleanupRecordIds = created.providerRecordId === null ? [] : [created.providerRecordId];\n const { plan } = yield* Provisioning.create({\n requirements: [requirement],\n target: Provisioning.Target.ExactZone({ zone }),\n });\n yield* requireTags(provider, \"exact-noop\", plan.operations, [\"noop\"]);\n const receipt = yield* Provisioning.apply({\n authorization: yield* Provisioning.authorize(plan),\n plan,\n });\n yield* requireCondition(\n provider,\n \"exact-noop\",\n receipt.operations.length === 0,\n \"an exact plan must not create another record\",\n );\n yield* deleteCreated(provider, zone, created.providerRecordId, \"exact-noop\");\n }).pipe(\n Effect.ensuring(bestEffortDelete(provider, zone, () => cleanupRecordIds)),\n Effect.provide(providerLayer(provider)),\n );\n}\n\nfunction conflict(provider: DnsProvider.Interface, zone: DomainName.DomainName, prefix: string) {\n const requirement = cname(zone, `${prefix}-conflict`);\n const occupied = txt(zone, `${prefix}-conflict`, \"occupied\");\n let cleanupRecordIds: ReadonlyArray<string> = [];\n return Effect.gen(function* () {\n const created = yield* provider.createRecord(zone, occupied);\n cleanupRecordIds = created.providerRecordId === null ? [] : [created.providerRecordId];\n const { plan } = yield* Provisioning.create({\n requirements: [requirement],\n target: Provisioning.Target.ExactZone({ zone }),\n });\n yield* requireTags(provider, \"conflict\", plan.operations, [\"conflict\"]);\n const failure = yield* Provisioning.apply({\n authorization: yield* Provisioning.authorize(plan),\n plan,\n }).pipe(Effect.flip);\n yield* requireCondition(\n provider,\n \"conflict\",\n failure instanceof Provisioning.ConflictError,\n \"apply must fail closed on incompatible state\",\n );\n yield* deleteCreated(provider, zone, created.providerRecordId, \"conflict\");\n }).pipe(\n Effect.ensuring(bestEffortDelete(provider, zone, () => cleanupRecordIds)),\n Effect.provide(providerLayer(provider)),\n );\n}\n\nfunction stalePlan(provider: DnsProvider.Interface, zone: DomainName.DomainName, prefix: string) {\n const requirement = cname(zone, `${prefix}-stale`);\n let cleanupRecordIds: ReadonlyArray<string> = [];\n return Effect.gen(function* () {\n const { plan } = yield* Provisioning.create({\n requirements: [requirement],\n target: Provisioning.Target.ExactZone({ zone }),\n });\n const authorization = yield* Provisioning.authorize(plan);\n const created = yield* provider.createRecord(zone, requirement);\n cleanupRecordIds = created.providerRecordId === null ? [] : [created.providerRecordId];\n const failure = yield* Provisioning.apply({ authorization, plan }).pipe(Effect.flip);\n yield* requireCondition(\n provider,\n \"stale-plan\",\n failure instanceof Provisioning.StaleError,\n \"apply must reject provider state that changed after authorization\",\n );\n yield* deleteCreated(provider, zone, created.providerRecordId, \"stale-plan\");\n }).pipe(\n Effect.ensuring(bestEffortDelete(provider, zone, () => cleanupRecordIds)),\n Effect.provide(providerLayer(provider)),\n );\n}\n\nfunction partialApplyCleanup(\n provider: DnsProvider.Interface,\n zone: DomainName.DomainName,\n prefix: string,\n) {\n let creates = 0;\n const flaky = DnsProvider.Service.of({\n ...provider,\n createRecord: Effect.fn(\"ProviderConformance.createRecord\")((target, record) => {\n creates += 1;\n return creates === 1\n ? provider.createRecord(target, record)\n : Effect.fail(\n new DnsProvider.Error({\n message: \"injected conformance failure\",\n operation: \"createRecord\",\n providerId: provider.id,\n }),\n );\n }),\n });\n const requirements = [\n cname(zone, `${prefix}-partial-one`),\n txt(zone, `${prefix}-partial-two`, \"domainkit\"),\n ];\n let cleanupRecordIds: ReadonlyArray<string> = [];\n return Effect.gen(function* () {\n const { plan } = yield* Provisioning.create({\n requirements,\n target: Provisioning.Target.ExactZone({ zone }),\n });\n const failure = yield* Provisioning.apply({\n authorization: yield* Provisioning.authorize(plan),\n plan,\n }).pipe(Effect.flip);\n cleanupRecordIds =\n failure instanceof Provisioning.PartialApplyError\n ? providerRecordIds(failure.receipt.operations)\n : [];\n yield* requireCondition(\n provider,\n \"partial-apply-cleanup\",\n failure instanceof Provisioning.PartialApplyError && failure.receipt.operations.length === 1,\n \"a later write failure must preserve the first confirmed write in a partial receipt\",\n );\n if (!(failure instanceof Provisioning.PartialApplyError)) return;\n const deletion = yield* Deletion.create({ plan, receipt: failure.receipt }).pipe(\n Effect.provide(providerLayer(provider)),\n );\n yield* Deletion.apply({\n authorization: yield* Deletion.authorize(deletion),\n plan: deletion,\n }).pipe(Effect.provide(providerLayer(provider)));\n yield* requireCondition(\n provider,\n \"partial-apply-cleanup\",\n yield* recordIdsAbsent(provider, zone, cleanupRecordIds),\n \"partial receipt cleanup must remove the confirmed write\",\n );\n }).pipe(\n Effect.ensuring(bestEffortDelete(provider, zone, () => cleanupRecordIds)),\n Effect.provide(providerLayer(flaky)),\n );\n}\n\nfunction providerRecordIds(\n operations: ReadonlyArray<{ readonly providerRecordId: string | null }>,\n): ReadonlyArray<string> {\n return operations.flatMap(({ providerRecordId }) =>\n providerRecordId === null ? [] : [providerRecordId],\n );\n}\n\nfunction recordIdsAbsent(\n provider: DnsProvider.Interface,\n zone: DomainName.DomainName,\n recordIds: ReadonlyArray<string>,\n) {\n return Effect.forEach(recordIds, (providerRecordId) =>\n provider.getRecord(zone, providerRecordId),\n ).pipe(Effect.map((records) => records.every((record) => record === null)));\n}\n\nfunction bestEffortDelete(\n provider: DnsProvider.Interface,\n zone: DomainName.DomainName,\n recordIds: () => ReadonlyArray<string>,\n) {\n return Effect.suspend(() =>\n Effect.forEach(\n recordIds(),\n (providerRecordId) => provider.deleteRecord(zone, providerRecordId).pipe(Effect.ignore),\n { discard: true },\n ),\n );\n}\n\nfunction providerLayer(provider: DnsProvider.Interface) {\n return Layer.merge(Layer.succeed(DnsProvider.Service, provider), Digest.webCryptoLayer);\n}\n\nfunction createRequirements(zone: DomainName.DomainName, prefix: string) {\n return [cname(zone, `${prefix}-create`), txt(zone, `${prefix}-page`, \"domainkit\")];\n}\n\nfunction cname(zone: DomainName.DomainName, label: string) {\n return DnsRecord.parse({\n _tag: \"CNAME\",\n metadata: { ownership: \"tester\", provenance: \"domainkit\", purpose: \"conformance\" },\n name: `${label}.${zone}`,\n policy: \"exclusive\",\n target: \"target.example.net\",\n ttl: 300,\n });\n}\n\nfunction txt(zone: DomainName.DomainName, label: string, value: string) {\n return DnsRecord.parse({\n _tag: \"TXT\",\n metadata: { ownership: \"tester\", provenance: \"domainkit\", purpose: \"conformance\" },\n name: `${label}.${zone}`,\n policy: \"append\",\n ttl: 300,\n value,\n });\n}\n\nfunction requireTags(\n provider: DnsProvider.Interface,\n testCase: string,\n operations: ReadonlyArray<{ readonly _tag: string }>,\n expected: ReadonlyArray<string>,\n) {\n return requireCondition(\n provider,\n testCase,\n JSON.stringify(operations.map(({ _tag }) => _tag)) === JSON.stringify(expected),\n `expected operations ${expected.join(\", \")}`,\n );\n}\n\nfunction requireCondition(\n provider: DnsProvider.Interface,\n testCase: string,\n condition: boolean,\n message: string,\n) {\n return condition\n ? Effect.void\n : Effect.fail(new Error({ case: testCase, message, providerId: provider.id }));\n}\n\nfunction deleteCreated(\n provider: DnsProvider.Interface,\n zone: DomainName.DomainName,\n providerRecordId: string | null,\n testCase: string,\n) {\n return providerRecordId === null\n ? Effect.fail(\n new Error({\n case: testCase,\n message: \"provider must return record IDs for safe cleanup\",\n providerId: provider.id,\n }),\n )\n : provider.deleteRecord(zone, providerRecordId);\n}\n"],"mappings":";;;;;;;;;AAaA,SAAS,QAAQ,WAAmB,SAAkC;CACpE,OAAO,IAAIA,QAAgB;EACzB,UAAU;EACV;EACA;EACA,OAAO;CACT,CAAC;AACH;AAEA,SAASC,WAAS,WAAmB,SAAkC;CACrE,OAAO,IAAID,QAAgB;EACzB,UAAU;EACV;EACA;EACA,OAAO;CACT,CAAC;AACH;AAEA,SAAS,gBACP,WACA,cACA,SACyC;CACzC,OAAO,UAAU,YAAY,MAC1B,eAAe,WAAW,OAAO,gBAAgB,WAAW,YAAY,OAC3E;AACF;AAEA,SAAS,iBACP,YACA,eACA,YAC+B;CAC/B,OAAOE,QAAmB,YAAY,eAAe,UAAU;AACjE;AAEA,SAAgBC,OAAK,UAAmB,CAAC,GAAwB;CAC/D,MAAM,QAAQ,OAAO,QAAQ,IAAI,qBAA+C,IAAI,IAAI,CAAC,CAAC;CAC1F,MAAM,YAAY,UAAU,WAAW,CAAC;CACxC,MAAM,aAAsB,WAAmC,UAAU,WAAW,MAAM;CAE1F,MAAM,SAAS,OAAO,GAAG,sCAAsC,CAAC,CAAC,WAC/D,WACA,WACA;EACA,IAAI,QAAQ,iBAAiB,KAAA,GAAW,OAAO,QAAQ,aAAa,WAAW,SAAS;EACxF,OAAO,IAAI,OAAO,QAAQ,YAAY;GACpC,MAAM,OAAO,IAAI,IAAI,OAAO;GAC5B,KAAK,IAAI,UAAU,cAAc,IAAI,SAAS;GAC9C,OAAO;EACT,CAAC;CACH,CAAC;CAED,MAAM,SAAS,OAAO,GAAG,sCAAsC,CAAC,CAAC,WAC/D,WACA,iBACA;EACA,IAAI,QAAQ,iBAAiB,KA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ACjF,MAAM,GAAG,MAAM,GAAG;EAClB,QAAQ;EACR,KAAK;EACL;CACF,CAAC;AACH;AAEA,SAAS,YACP,UACA,UACA,YACA,UACA;CACA,OAAO,iBACL,UACA,UACA,KAAK,UAAU,WAAW,KAAK,EAAE,WAAW,IAAI,CAAC,MAAM,KAAK,UAAU,QAAQ,GAC9E,uBAAuB,SAAS,KAAK,IAAI,GAC3C;AACF;AAEA,SAAS,iBACP,UACA,UACA,WACA,SACA;CACA,OAAO,YACH,OAAO,OACP,OAAO,KAAK,IAAI,MAAM;EAAE,MAAM;EAAU;EAAS,YAAY,SAAS;CAAG,CAAC,CAAC;AACjF;AAEA,SAAS,cACP,UACA,MACA,kBACA,UACA;CACA,OAAO,qBAAqB,OACxB,OAAO,KACL,IAAI,MAAM;EACR,MAAM;EACN,SAAS;EACT,YAAY,SAAS;CACvB,CAAC,CACH,IACA,SAAS,aAAa,MAAM,gBAAgB;AAClD"}
@@ -1,4 +1,5 @@
1
- import { Bt as TokenValidation, H as Source, Ht as Value, It as OAuthClientConfiguration, Jt as Service$2, Kt as Error, Lt as OAuthMethod, Nt as IntegrationMethod, Pt as Manifest, Q as InteractiveFlow, Rt as OAuthSubjectResolver, Wt as AsyncInterface$1, a as Interface$5, at as Envelope, bt as ProviderConnection, c as Service$1, en as DnsRecord, et as Method, hn as DomainName, i as Error$2, it as Codec, jt as ProviderAuthorization, kt as Capability, n as AsyncInterface$2, o as Query, qt as Interface$4, t as Answer, xt as ProviderTarget, yn as Error$1, yt as DomainAttachment } from "./resolver-BGBLnPjJ.mjs";
1
+ import { H as Capability, J as Manifest, M as ProviderConnection, N as ProviderTarget, Nt as Error$1, Q as OAuthSubjectResolver, W as ProviderAuthorization, X as OAuthClientConfiguration, Z as OAuthMethod, ct as Service$1, d as Method, et as TokenValidation, g as Envelope, h as Codec, it as AsyncInterface$1, j as DomainAttachment, kt as DomainName, l as InteractiveFlow, mt as DnsRecord, nt as Value, ot as Error, q as IntegrationMethod, s as Error$2, st as Interface$4 } from "./connect-10vHuShV.mjs";
2
+ import { H as Source, a as Interface$5, c as Service$2, i as Error$3, n as AsyncInterface$2, o as Query, t as Answer } from "./resolver-DRrLm_hB.mjs";
2
3
  import { Context, Data, Effect, Layer, Schema } from "effect";
3
4
  import * as oauth from "oauth4webapi";
4
5
  declare namespace diagnostic_d_exports {
@@ -202,11 +203,12 @@ declare const Resolution: {
202
203
  /** The credential material a provider adapter needs to restore a session. */
203
204
  interface Credential {
204
205
  readonly accessToken: Value;
206
+ readonly expiresAt: Date | null;
205
207
  readonly refreshToken: Value | null;
206
208
  readonly tokenType: string;
207
209
  }
208
210
  /** The non-secret authorization projection required when restoring a provider session. */
209
- type Authorization = Pick<ProviderAuthorization, "capabilityEvidence" | "expiresAt" | "method" | "providerContext" | "providerId" | "requiredCapabilities" | "revocation">;
211
+ type Authorization = Pick<ProviderAuthorization, "capabilityEvidence" | "method" | "providerContext" | "providerId" | "requiredCapabilities" | "revocation">;
210
212
  interface RestoreInput {
211
213
  readonly authorization: Authorization;
212
214
  readonly credential: Credential;
@@ -293,7 +295,7 @@ declare const validateDomainToken: (options: DomainCredentialOptions) => Effect.
293
295
  /** Creates an Effect-native Cloudflare client without owning the credential lifecycle. */
294
296
  declare function make$5(options: Options$4): Interface$2;
295
297
  declare namespace auth_d_exports$1 {
296
- export { Context$2 as Context, CredentialTarget, OAuthFlowOptions, OAuthMethodOptions, SubjectResolverOptions, TokenConnectionOptions$1 as TokenConnectionOptions, TokenValidatorOptions, contextCodec$1 as contextCodec, manifest$1 as manifest, oauthAuthentication, oauthFlow, oauthMethod, restore$1 as restore, subjectResolver, tokenConnectionMethod$1 as tokenConnectionMethod, tokenMethod$1 as tokenMethod, tokenValidator };
298
+ export { Context$2 as Context, CredentialTarget, OAuthFlowOptions, OAuthMethodOptions, RefreshCredentialOptions, SubjectResolverOptions, TokenConnectionOptions$1 as TokenConnectionOptions, TokenValidatorOptions, contextCodec$1 as contextCodec, manifest$1 as manifest, oauthAuthentication, oauthFlow, oauthMethod, refreshCredential, restore$1 as restore, subjectResolver, tokenConnectionMethod$1 as tokenConnectionMethod, tokenMethod$1 as tokenMethod, tokenValidator };
297
299
  }
298
300
  declare const Context$2: Schema.Struct<{
299
301
  readonly accountId: Schema.optionalKey<Schema.String>;
@@ -364,16 +366,29 @@ declare const oauthAuthentication: (options: SubjectResolverOptions & {
364
366
  }[];
365
367
  credential: {
366
368
  accessToken: Value;
369
+ expiresAt: Date | null;
367
370
  refreshToken: Value | null;
368
371
  tokenType: Lowercase<string>;
369
372
  };
370
- expiresAt: Date | null;
371
373
  providerAccountId: string;
372
374
  providerContext: Envelope;
373
375
  scopes: string[];
374
376
  }, Error$1 | Error, never>;
375
377
  /** Restore a credential-scoped Cloudflare session from persisted authorization state. */
376
378
  declare function restore$1(options: RestoreInput & Pick<Options$4, "baseUrl" | "fetch">): Effect.Effect<Interface$2, Error>;
379
+ interface RefreshCredentialOptions {
380
+ readonly client: OAuthClientConfiguration;
381
+ readonly clientAuth: OAuthMethod["clientAuth"];
382
+ readonly credential: Credential;
383
+ readonly fetch?: Fetch$2;
384
+ }
385
+ /** Exchanges a Cloudflare refresh token for a fresh provider credential. */
386
+ declare const refreshCredential: (options: RefreshCredentialOptions) => Effect.Effect<{
387
+ accessToken: Value;
388
+ expiresAt: Date | null;
389
+ refreshToken: Value;
390
+ tokenType: Lowercase<string>;
391
+ }, Error | Error$2, never>;
377
392
  type OAuthFlowOptions = SubjectResolverOptions & {
378
393
  readonly client: OAuthClientConfiguration;
379
394
  readonly clientAuth: OAuthMethod["clientAuth"];
@@ -396,6 +411,17 @@ type AccountContext = {
396
411
  readonly _tag: "team";
397
412
  readonly teamId: string;
398
413
  };
414
+ /** Constructs the account scope used by Vercel API requests. */
415
+ declare const AccountContext: {
416
+ personal: () => Extract<AccountContext, {
417
+ readonly _tag: "personal";
418
+ }>;
419
+ team: ({ teamId }: {
420
+ readonly teamId: string;
421
+ }) => Extract<AccountContext, {
422
+ readonly _tag: "team";
423
+ }>;
424
+ };
399
425
  /** Configuration for an Effect-native Vercel authoritative-DNS client. */
400
426
  interface Options$3 {
401
427
  readonly baseUrl?: string;
@@ -489,7 +515,6 @@ declare const exchangeCode: (options: ExchangeCodeOptions) => Effect.Effect<{
489
515
  accessToken: Value;
490
516
  context: {
491
517
  readonly _tag: "personal";
492
- readonly teamId?: never;
493
518
  } | {
494
519
  readonly _tag: "team";
495
520
  readonly teamId: string;
@@ -517,10 +542,10 @@ declare const integrationAuthentication: (options: ExchangeCodeOptions & {
517
542
  }[];
518
543
  credential: {
519
544
  accessToken: Value;
545
+ expiresAt: null;
520
546
  refreshToken: null;
521
547
  tokenType: string;
522
548
  };
523
- expiresAt: null;
524
549
  providerAccountId: string;
525
550
  providerContext: Envelope;
526
551
  scopes: never[];
@@ -543,7 +568,7 @@ interface Options$2 {
543
568
  readonly timeoutMs?: number;
544
569
  }
545
570
  declare function make$3(options: Options$2): Interface$5;
546
- declare const layer$2: (options: Options$2) => Layer.Layer<Service$1>;
571
+ declare const layer$2: (options: Options$2) => Layer.Layer<Service$2>;
547
572
  declare const toAsync$2: (options: Options$2) => AsyncInterface$2;
548
573
  declare namespace cloudflare_doh_d_exports {
549
574
  export { Options$1 as Options, layer$1 as layer, make$2 as make, toAsync$1 as toAsync };
@@ -552,7 +577,7 @@ interface Options$1 extends Omit<Options$2, "endpoint"> {
552
577
  readonly endpoint?: string;
553
578
  }
554
579
  declare function make$2(options?: Options$1): Interface$5;
555
- declare const layer$1: (options?: Options$1) => Layer.Layer<Service$1>;
580
+ declare const layer$1: (options?: Options$1) => Layer.Layer<Service$2>;
556
581
  declare const toAsync$1: (options?: Options$1) => AsyncInterface$2;
557
582
  declare namespace google_doh_d_exports {
558
583
  export { Options, layer, make$1 as make, toAsync };
@@ -561,7 +586,7 @@ interface Options extends Omit<Options$2, "endpoint"> {
561
586
  readonly endpoint?: string;
562
587
  }
563
588
  declare function make$1(options?: Options): Interface$5;
564
- declare const layer: (options?: Options) => Layer.Layer<Service$1>;
589
+ declare const layer: (options?: Options) => Layer.Layer<Service$2>;
565
590
  declare const toAsync: (options?: Options) => AsyncInterface$2;
566
591
  declare namespace resolver_pool_d_exports {
567
592
  export { DefaultOptions, Entry, Interface, Observation, Policy, Service, defaultLayer, defaultMake, make };
@@ -578,7 +603,7 @@ type Observation = Data.TaggedEnum<{
578
603
  };
579
604
  Failed: {
580
605
  readonly message: string;
581
- readonly reason: Exclude<Error$2["reason"], "timeout">;
606
+ readonly reason: Exclude<Error$3["reason"], "timeout">;
582
607
  readonly resolverId: string;
583
608
  };
584
609
  NoData: {
@@ -599,7 +624,7 @@ declare const Observation: {
599
624
  }> | Extract<{
600
625
  readonly _tag: "Failed";
601
626
  readonly message: string;
602
- readonly reason: Exclude<Error$2["reason"], "timeout">;
627
+ readonly reason: Exclude<Error$3["reason"], "timeout">;
603
628
  readonly resolverId: string;
604
629
  }, {
605
630
  readonly _tag: Tag;
@@ -623,7 +648,7 @@ declare const Observation: {
623
648
  } | {
624
649
  readonly _tag: "Failed";
625
650
  readonly message: string;
626
- readonly reason: Exclude<Error$2["reason"], "timeout">;
651
+ readonly reason: Exclude<Error$3["reason"], "timeout">;
627
652
  readonly resolverId: string;
628
653
  } | {
629
654
  readonly _tag: "NoData";
@@ -641,7 +666,7 @@ declare const Observation: {
641
666
  } | {
642
667
  readonly _tag: "Failed";
643
668
  readonly message: string;
644
- readonly reason: Exclude<Error$2["reason"], "timeout">;
669
+ readonly reason: Exclude<Error$3["reason"], "timeout">;
645
670
  readonly resolverId: string;
646
671
  } | {
647
672
  readonly _tag: "NoData";
@@ -658,7 +683,7 @@ declare const Observation: {
658
683
  } | {
659
684
  readonly _tag: "Failed";
660
685
  readonly message: string;
661
- readonly reason: Exclude<Error$2["reason"], "timeout">;
686
+ readonly reason: Exclude<Error$3["reason"], "timeout">;
662
687
  readonly resolverId: string;
663
688
  } | {
664
689
  readonly _tag: "NoData";
@@ -676,7 +701,7 @@ declare const Observation: {
676
701
  } | {
677
702
  readonly _tag: "Failed";
678
703
  readonly message: string;
679
- readonly reason: Exclude<Error$2["reason"], "timeout">;
704
+ readonly reason: Exclude<Error$3["reason"], "timeout">;
680
705
  readonly resolverId: string;
681
706
  } | {
682
707
  readonly _tag: "NoData";
@@ -695,7 +720,7 @@ declare const Observation: {
695
720
  readonly Failed: Data.TaggedEnum.ConstructorFrom<{
696
721
  readonly _tag: "Failed";
697
722
  readonly message: string;
698
- readonly reason: Exclude<Error$2["reason"], "timeout">;
723
+ readonly reason: Exclude<Error$3["reason"], "timeout">;
699
724
  readonly resolverId: string;
700
725
  }, "_tag">;
701
726
  readonly NoData: Data.TaggedEnum.ConstructorFrom<{
@@ -1236,8 +1261,8 @@ declare const Result: {
1236
1261
  }, "_tag">;
1237
1262
  };
1238
1263
  declare function observe(input: PublicOnlyConfig): Effect.Effect<Result, Error$1>;
1239
- declare function observe(input: ProviderConfig): Effect.Effect<Result, Error$1, Service$2>;
1240
- declare function observe(input: Config): Effect.Effect<Result, Error$1, Service$2>;
1264
+ declare function observe(input: ProviderConfig): Effect.Effect<Result, Error$1, Service$1>;
1265
+ declare function observe(input: Config): Effect.Effect<Result, Error$1, Service$1>;
1241
1266
  //#endregion
1242
- export { zones_d_exports as $, Options$3 as A, oauthMethod as B, manifest as C, Fetch$1 as D, AccountContext as E, OAuthMethodOptions as F, ListZonesInput$1 as G, Account$1 as H, SubjectResolverOptions as I, Interface$3 as J, Options$4 as K, TokenConnectionOptions$1 as L, index_d_exports$1 as M, CredentialTarget as N, Interface$1 as O, OAuthFlowOptions as P, session_d_exports as Q, TokenValidatorOptions as R, integrationMethod as S, Account as T, Fetch$2 as U, tokenMethod$1 as V, Interface$2 as W, Resolution as X, ListTargetsInput as Y, RestoreInput as Z, ExchangeCodeOptions as _, verify_d_exports as a, IntegrationMethodOptions as b, Policy as c, google_doh_d_exports as d, selection_d_exports as et, Options$1 as f, index_d_exports as g, doh_d_exports as h, Result as i, Zone as j, ListZonesInput as k, resolver_pool_d_exports as l, Options$2 as m, PublicDns as n, DefaultOptions as o, cloudflare_doh_d_exports as p, Zone$1 as q, PublicDnsObservation as r, Observation as s, ProviderObservation as t, diagnostic_d_exports as tt, Options as u, IntegrationCredential as v, tokenMethod as w, TokenConnectionOptions as x, IntegrationFlowOptions as y, manifest$1 as z };
1243
- //# sourceMappingURL=verify-6xK05pwL.d.mts.map
1267
+ export { RestoreInput as $, Options$3 as A, manifest$1 as B, manifest as C, Fetch$1 as D, AccountContext as E, OAuthMethodOptions as F, Interface$2 as G, tokenMethod$1 as H, RefreshCredentialOptions as I, Zone$1 as J, ListZonesInput$1 as K, SubjectResolverOptions as L, index_d_exports$1 as M, CredentialTarget as N, Interface$1 as O, OAuthFlowOptions as P, Resolution as Q, TokenConnectionOptions$1 as R, integrationMethod as S, Account as T, Account$1 as U, oauthMethod as V, Fetch$2 as W, Interface$3 as X, Credential as Y, ListTargetsInput as Z, ExchangeCodeOptions as _, verify_d_exports as a, IntegrationMethodOptions as b, Policy as c, google_doh_d_exports as d, session_d_exports as et, Options$1 as f, index_d_exports as g, doh_d_exports as h, Result as i, Zone as j, ListZonesInput as k, resolver_pool_d_exports as l, Options$2 as m, PublicDns as n, selection_d_exports as nt, DefaultOptions as o, cloudflare_doh_d_exports as p, Options$4 as q, PublicDnsObservation as r, diagnostic_d_exports as rt, Observation as s, ProviderObservation as t, zones_d_exports as tt, Options as u, IntegrationCredential as v, tokenMethod as w, TokenConnectionOptions as x, IntegrationFlowOptions as y, TokenValidatorOptions as z };
1268
+ //# sourceMappingURL=verify-C3V_GtzL.d.mts.map