domainkit 0.1.0-beta.0 → 0.1.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/{auth-Df9BuC25.mjs → auth-Vi-hhXbV.mjs} +24 -9
- package/dist/auth-Vi-hhXbV.mjs.map +1 -0
- package/dist/{client-DvXfJx_E.mjs → client-BnD7QLRF.mjs} +54 -21
- package/dist/client-BnD7QLRF.mjs.map +1 -0
- package/dist/{cloudflare-C_ixZsJo.mjs → cloudflare-C6ryPlCZ.mjs} +4 -2
- package/dist/{cloudflare-C_ixZsJo.mjs.map → cloudflare-C6ryPlCZ.mjs.map} +1 -1
- package/dist/{cloudflare-DClWuAm8.d.mts → cloudflare-tdjNS8vE.d.mts} +3 -3
- package/dist/cloudflare.d.mts +2 -2
- package/dist/cloudflare.mjs +1 -1
- package/dist/{dns-record-Dzo4flM5.mjs → dns-record-C_KwGPLf.mjs} +11 -1
- package/dist/dns-record-C_KwGPLf.mjs.map +1 -0
- package/dist/effect-cloudflare.d.mts +1 -1
- package/dist/effect-cloudflare.mjs +1 -1
- package/dist/effect-vercel.d.mts +1 -1
- package/dist/effect-vercel.mjs +1 -1
- package/dist/effect.d.mts +33 -23
- package/dist/effect.mjs +7 -7
- package/dist/effect.mjs.map +1 -1
- package/dist/{index-DQAjUrZu.d.mts → index-CEzk2gbZ.d.mts} +2 -2
- package/dist/{index-D1KtyjuI.d.mts → index-CS9Rl5LQ.d.mts} +2 -2
- package/dist/index.d.mts +72 -27
- package/dist/index.mjs +88 -25
- package/dist/index.mjs.map +1 -1
- package/dist/{manifest-DjH3BVB9.d.mts → manifest-CP85ePFn.d.mts} +5 -1
- package/dist/{receipt-C7PjnibZ.mjs → receipt-CGSnfZQ6.mjs} +2 -2
- package/dist/{receipt-C7PjnibZ.mjs.map → receipt-CGSnfZQ6.mjs.map} +1 -1
- package/dist/{resolver-BjZwN2JE.d.mts → resolver-BHPsADzE.d.mts} +115 -55
- package/dist/{resolver-D5nVrR10.mjs → resolver-tEXpKxmH.mjs} +69 -22
- package/dist/resolver-tEXpKxmH.mjs.map +1 -0
- package/dist/testing.d.mts +24 -18
- package/dist/testing.mjs +72 -24
- package/dist/testing.mjs.map +1 -1
- package/dist/{vercel-Vc_K_87s.d.mts → vercel-D-E2aqb1.d.mts} +3 -3
- package/dist/{vercel-BWz_9Y1v.mjs → vercel-DD89DCqH.mjs} +4 -2
- package/dist/{vercel-BWz_9Y1v.mjs.map → vercel-DD89DCqH.mjs.map} +1 -1
- package/dist/vercel.d.mts +2 -2
- package/dist/vercel.mjs +1 -1
- package/dist/{verify-DPB1OfZ5.d.mts → verify-B80xCBh2.d.mts} +457 -29
- package/dist/{verify-CeMW6XtK.mjs → verify-BjrR_4NF.mjs} +426 -134
- package/dist/verify-BjrR_4NF.mjs.map +1 -0
- package/package.json +4 -2
- package/dist/auth-Df9BuC25.mjs.map +0 -1
- package/dist/client-DvXfJx_E.mjs.map +0 -1
- package/dist/dns-record-Dzo4flM5.mjs.map +0 -1
- package/dist/resolver-D5nVrR10.mjs.map +0 -1
- package/dist/verify-CeMW6XtK.mjs.map +0 -1
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["decode","Connection.decode","decode","ProviderAuth.decode","DnsPlan.decode","DnsPlan.decodeReceipt","OAuthEffect.begin","OAuthStateStore.layerFromAsync","OAuthEffect.complete","ConnectionStore.layerFromAsync","CredentialStore.layerFromAsync","OAuthEffect.refresh","OAuthEffect.revoke","InvalidInputError","DnsProvider.Error","ProvisioningEffect.create","DnsProvider.layerFromAsync","ProvisioningEffect.authorize","ProvisioningEffect.apply","ConnectionAuthorization.authorize","ProvisioningEffect.renderManualInstructions","TokenEffect.connect","InvalidInputError","DnsProvider.Error","ConnectionStore.layerFromAsync","CredentialStore.layerFromAsync","VerificationEffect.record","DnsProvider.layerFromAsync","DnsResolver.layerFromAsync","make","CloudflareDnsOverHttps.toAsync","DnsOverHttps.toAsync","packageJson.version"],"sources":["../src/promise/connection.ts","../src/promise/provider-auth.ts","../src/promise/dns-record.ts","../src/promise/domain-name.ts","../src/promise/dns-plan.ts","../src/promise/oauth.ts","../src/promise/provisioning.ts","../src/promise/token.ts","../src/promise/verification.ts","../src/promise/cloudflare-doh.ts","../src/promise/doh.ts","../src/index.ts"],"sourcesContent":["import { Effect } from \"effect\";\n\nimport * as Connection from \"../auth/connection.ts\";\n\nexport {\n assertGrant,\n AuthorizationError,\n Capability,\n encode,\n Grant,\n Schema,\n} from \"../auth/connection.ts\";\nexport type { Connection, OAuthContinuation, StoredCredential } from \"../auth/connection.ts\";\n\nexport function decode(input: unknown): Promise<Connection.Connection> {\n return Effect.runPromise(Connection.decode(input));\n}\n","import { Effect } from \"effect\";\n\nimport * as ProviderAuth from \"../auth/manifest.ts\";\n\nexport { Method, Schema } from \"../auth/manifest.ts\";\nexport type {\n AsyncOAuthSubjectResolver as OAuthSubjectResolver,\n Manifest,\n OAuthClientConfiguration,\n OAuthMethod,\n TokenValidation,\n} from \"../auth/manifest.ts\";\n\nexport function decode(input: unknown): Promise<ProviderAuth.Manifest> {\n return Effect.runPromise(ProviderAuth.decode(input));\n}\n","export {\n A,\n Aaaa,\n Caa,\n Cname,\n data,\n equals,\n Mx,\n Ns,\n Opaque,\n Observed,\n parse,\n RequirementMetadata,\n Schema,\n Srv,\n Txt,\n Type,\n} from \"../domain/dns-record.ts\";\nexport type { DnsRecord, Encoded } from \"../domain/dns-record.ts\";\n","export { parse, Schema } from \"../domain/domain-name.ts\";\nexport type { DomainName } from \"../domain/domain-name.ts\";\n","import { Effect } from \"effect\";\n\nimport * as DnsPlan from \"../plan/types.ts\";\n\nexport { Authorization, encode, encodeReceipt, Operation, Receipt, Schema } from \"../plan/types.ts\";\nexport type { ApplyReceipt, DnsPlan, PlanAuthorization } from \"../plan/types.ts\";\n\nexport function decode(input: unknown): Promise<DnsPlan.DnsPlan> {\n return Effect.runPromise(DnsPlan.decode(input));\n}\n\nexport function decodeReceipt(input: unknown): Promise<DnsPlan.ApplyReceipt> {\n return Effect.runPromise(DnsPlan.decodeReceipt(input));\n}\n","import { Effect, Layer } from \"effect\";\n\nimport * as Connection from \"../auth/connection.ts\";\nimport * as OAuthEffect from \"../auth/oauth.ts\";\nimport type * as ProviderAuth from \"../auth/manifest.ts\";\nimport { Error as InvalidInputError } from \"../invalid-input.ts\";\nimport { webCryptoLayer } from \"../plan/canonical-json.ts\";\nimport * as DnsProvider from \"../provider/provider.ts\";\nimport * as ConnectionStore from \"../stores/connection.ts\";\nimport * as CredentialStore from \"../stores/credential.ts\";\nimport * as OAuthStateStore from \"../stores/oauth-state.ts\";\n\nexport interface BeginInput extends OAuthEffect.BeginInput {\n readonly stateStore: OAuthStateStore.AsyncInterface;\n}\n\nexport function begin(input: BeginInput): Promise<{ readonly authorizationUrl: URL }> {\n const { stateStore, ...programInput } = input;\n return Effect.runPromise(\n OAuthEffect.begin(programInput).pipe(\n Effect.provide(Layer.merge(OAuthStateStore.layerFromAsync(stateStore), webCryptoLayer)),\n ),\n );\n}\n\nexport function complete(input: {\n readonly callbackUrl: URL;\n readonly client: ProviderAuth.OAuthClientConfiguration;\n readonly connectionStore: ConnectionStore.AsyncInterface;\n readonly credentialStore: CredentialStore.AsyncInterface;\n readonly fetch?: OAuthEffect.Fetch;\n readonly providerId: string;\n readonly resolveSubject: ProviderAuth.AsyncOAuthSubjectResolver;\n readonly stateStore: OAuthStateStore.AsyncInterface;\n}): Promise<Connection.Connection> {\n return Effect.runPromise(\n OAuthEffect.complete({\n callbackUrl: input.callbackUrl,\n client: input.client,\n ...(input.fetch === undefined ? {} : { fetch: input.fetch }),\n providerId: input.providerId,\n resolveSubject: (tokens, accessToken) =>\n Effect.tryPromise({\n try: () => input.resolveSubject(tokens, accessToken),\n catch: (cause) => providerFailure(input.providerId, \"resolveSubject\", cause),\n }),\n }).pipe(\n Effect.provide(\n Layer.mergeAll(\n OAuthStateStore.layerFromAsync(input.stateStore),\n ConnectionStore.layerFromAsync(input.connectionStore),\n CredentialStore.layerFromAsync(input.credentialStore),\n webCryptoLayer,\n ),\n ),\n ),\n );\n}\n\nexport function refresh(input: {\n readonly client: ProviderAuth.OAuthClientConfiguration;\n readonly connection: Connection.Connection;\n readonly credentialStore: CredentialStore.AsyncInterface;\n readonly fetch?: OAuthEffect.Fetch;\n readonly method: ProviderAuth.OAuthMethod;\n}): Promise<void> {\n return Effect.runPromise(\n OAuthEffect.refresh({\n client: input.client,\n connection: input.connection,\n ...(input.fetch === undefined ? {} : { fetch: input.fetch }),\n method: input.method,\n }).pipe(Effect.provide(CredentialStore.layerFromAsync(input.credentialStore))),\n );\n}\n\nexport function revoke(input: {\n readonly client: ProviderAuth.OAuthClientConfiguration;\n readonly connection: Connection.Connection;\n readonly credentialStore: CredentialStore.AsyncInterface;\n readonly fetch?: OAuthEffect.Fetch;\n readonly method: ProviderAuth.OAuthMethod;\n}): Promise<void> {\n return Effect.runPromise(\n OAuthEffect.revoke({\n client: input.client,\n connection: input.connection,\n ...(input.fetch === undefined ? {} : { fetch: input.fetch }),\n method: input.method,\n }).pipe(Effect.provide(CredentialStore.layerFromAsync(input.credentialStore))),\n );\n}\n\nfunction providerFailure(\n providerId: string,\n operation: string,\n cause: unknown,\n): DnsProvider.Error | InvalidInputError {\n return cause instanceof InvalidInputError || cause instanceof DnsProvider.Error\n ? cause\n : new DnsProvider.Error({\n cause,\n message: cause instanceof Error ? cause.message : \"Provider callback failed\",\n operation,\n providerId,\n });\n}\n\nexport type Fetch = OAuthEffect.Fetch;\n","import { Effect, Layer } from \"effect\";\n\nimport type * as Connection from \"../auth/connection.ts\";\nimport * as ConnectionAuthorization from \"../plan/connection-authorization.ts\";\nimport { webCryptoLayer } from \"../plan/canonical-json.ts\";\nimport * as ProvisioningEffect from \"../plan/plan.ts\";\nimport type * as DnsPlan from \"../plan/types.ts\";\nimport * as DnsProvider from \"../provider/provider.ts\";\n\nexport interface CreateInput extends ProvisioningEffect.CreateInput {\n readonly provider: DnsProvider.AsyncInterface;\n}\n\nexport function create(input: CreateInput): Promise<DnsPlan.DnsPlan> {\n const { provider, ...programInput } = input;\n return Effect.runPromise(\n ProvisioningEffect.create(programInput).pipe(\n Effect.provide(Layer.merge(DnsProvider.layerFromAsync(provider), webCryptoLayer)),\n ),\n );\n}\n\nexport function authorize(\n plan: DnsPlan.DnsPlan,\n operationIds?: ReadonlyArray<string>,\n options: { readonly allowPartial?: boolean } = {},\n): Promise<DnsPlan.PlanAuthorization> {\n return Effect.runPromise(\n ProvisioningEffect.authorize(plan, operationIds, options).pipe(Effect.provide(webCryptoLayer)),\n );\n}\n\nexport function apply(input: {\n readonly authorization: DnsPlan.PlanAuthorization;\n readonly plan: DnsPlan.DnsPlan;\n readonly provider: DnsProvider.AsyncInterface;\n}): Promise<DnsPlan.ApplyReceipt> {\n return Effect.runPromise(\n ProvisioningEffect.apply({ authorization: input.authorization, plan: input.plan }).pipe(\n Effect.provide(Layer.merge(DnsProvider.layerFromAsync(input.provider), webCryptoLayer)),\n ),\n );\n}\n\nexport function authorizeForConnection(input: {\n readonly accountId: string;\n readonly allowPartial?: boolean;\n readonly connection: Connection.Connection;\n readonly operationIds?: ReadonlyArray<string>;\n readonly plan: DnsPlan.DnsPlan;\n}): Promise<DnsPlan.PlanAuthorization> {\n return Effect.runPromise(\n ConnectionAuthorization.authorize(input).pipe(Effect.provide(webCryptoLayer)),\n );\n}\n\nexport const renderManualInstructions = ProvisioningEffect.renderManualInstructions;\n","import { Effect, Layer } from \"effect\";\n\nimport * as Connection from \"../auth/connection.ts\";\nimport type * as ProviderAuth from \"../auth/manifest.ts\";\nimport { Value as Secret } from \"../auth/secret.ts\";\nimport * as TokenEffect from \"../auth/token.ts\";\nimport { Error as InvalidInputError } from \"../invalid-input.ts\";\nimport { webCryptoLayer } from \"../plan/canonical-json.ts\";\nimport * as DnsProvider from \"../provider/provider.ts\";\nimport * as ConnectionStore from \"../stores/connection.ts\";\nimport * as CredentialStore from \"../stores/credential.ts\";\n\nexport function connect(input: {\n readonly connectionStore: ConnectionStore.AsyncInterface;\n readonly credentialStore: CredentialStore.AsyncInterface;\n readonly grant: Connection.Grant;\n readonly providerId: string;\n readonly subjectId: string;\n readonly token: Secret;\n readonly validate: (token: Secret) => Promise<ProviderAuth.TokenValidation>;\n}): Promise<Connection.Connection> {\n return Effect.runPromise(\n TokenEffect.connect({\n grant: input.grant,\n providerId: input.providerId,\n subjectId: input.subjectId,\n token: input.token,\n validate: (token) =>\n Effect.tryPromise({\n try: () => input.validate(token),\n catch: (cause) =>\n cause instanceof InvalidInputError || cause instanceof DnsProvider.Error\n ? cause\n : new DnsProvider.Error({\n cause,\n message: cause instanceof Error ? cause.message : \"Token validation failed\",\n operation: \"validateToken\",\n providerId: input.providerId,\n }),\n }),\n }).pipe(\n Effect.provide(\n Layer.mergeAll(\n ConnectionStore.layerFromAsync(input.connectionStore),\n CredentialStore.layerFromAsync(input.credentialStore),\n webCryptoLayer,\n ),\n ),\n ),\n );\n}\n","import { Effect, Layer } from \"effect\";\n\nimport type * as DomainName from \"../domain/domain-name.ts\";\nimport type * as DnsRecord from \"../domain/dns-record.ts\";\nimport * as DnsProvider from \"../provider/provider.ts\";\nimport * as DnsResolver from \"../verification/resolver.ts\";\nimport * as VerificationEffect from \"../verification/verify.ts\";\n\nexport function record(input: {\n readonly provider: DnsProvider.AsyncInterface;\n readonly record: DnsRecord.DnsRecord;\n readonly resolver: DnsResolver.AsyncInterface;\n readonly zone: DomainName.DomainName;\n}): Promise<VerificationEffect.Result> {\n return Effect.runPromise(\n VerificationEffect.record({ record: input.record, zone: input.zone }).pipe(\n Effect.provide(\n Layer.merge(\n DnsProvider.layerFromAsync(input.provider),\n DnsResolver.layerFromAsync(input.resolver),\n ),\n ),\n ),\n );\n}\n","import * as CloudflareDnsOverHttps from \"../verification/cloudflare-doh.ts\";\nimport type * as DnsResolver from \"../verification/resolver.ts\";\n\nexport type Options = CloudflareDnsOverHttps.Options;\n\nexport function make(options: Options = {}): DnsResolver.AsyncInterface {\n return CloudflareDnsOverHttps.toAsync(options);\n}\n","import * as DnsOverHttps from \"../verification/doh.ts\";\nimport type * as DnsResolver from \"../verification/resolver.ts\";\n\nexport type Options = DnsOverHttps.Options;\n\nexport function make(options: Options): DnsResolver.AsyncInterface {\n return DnsOverHttps.toAsync(options);\n}\n","import packageJson from \"../package.json\" with { type: \"json\" };\n\n/** The current package version from the package manifest. */\nexport const VERSION = packageJson.version;\n\nexport * as Connection from \"./promise/connection.ts\";\nexport * as ProviderAuth from \"./promise/provider-auth.ts\";\nexport * as Secret from \"./auth/secret.ts\";\nexport * as ProviderDiscovery from \"./discovery/selection.ts\";\nexport * as Zones from \"./discovery/zones.ts\";\nexport * as DnsRecord from \"./promise/dns-record.ts\";\nexport * as DomainName from \"./promise/domain-name.ts\";\nexport * as InvalidInput from \"./invalid-input.ts\";\nexport * as DnsPlan from \"./promise/dns-plan.ts\";\nexport type * as DnsProvider from \"./promise/dns-provider.ts\";\nexport * as Cloudflare from \"./promise/cloudflare.ts\";\nexport * as Vercel from \"./promise/vercel.ts\";\nexport type * as DnsResolver from \"./promise/dns-resolver.ts\";\nexport * as OAuth from \"./promise/oauth.ts\";\nexport * as Provisioning from \"./promise/provisioning.ts\";\nexport type * as Stores from \"./promise/stores.ts\";\nexport * as TokenConnection from \"./promise/token.ts\";\nexport * as Verification from \"./promise/verification.ts\";\nexport * as CloudflareDnsOverHttps from \"./promise/cloudflare-doh.ts\";\nexport * as DnsOverHttps from \"./promise/doh.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAcA,SAAgBA,SAAO,OAAgD;CACrE,OAAO,OAAO,WAAWC,SAAkB,KAAK,CAAC;AACnD;;;;;;;;ACHA,SAAgBC,SAAO,OAAgD;CACrE,OAAO,OAAO,WAAWC,SAAoB,KAAK,CAAC;AACrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AGRA,SAAgB,OAAO,OAA0C;CAC/D,OAAO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BC,UACnD,QACA,IAAIA,QAAkB;IACpB;IACA,SAAS,iBAAiB,QAAQ,MAAM,UAAU;IAClD,WAAW;IACX,YAAY,MAAM;GACpB,CAAC;EACT,CAAC;CACL,CAAC,CAAC,CAAC,KACD,OAAO,QACL,MAAM,SACJC,iBAA+B,MAAM,eAAe,GACpDC,iBAA+B,MAAM,eAAe,GACpD,cACF,CACF,CACF,CACF;AACF;;;;AC1CA,SAAgB,OAAO,OAKgB;CACrC,OAAO,OAAO,WACZC,SAA0B;EAAE,QAAQ,MAAM;EAAQ,MAAM,MAAM;CAAK,CAAC,CAAC,CAAC,KACpE,OAAO,QACL,MAAM,MACJC,eAA2B,MAAM,QAAQ,GACzCC,iBAA2B,MAAM,QAAQ,CAC3C,CACF,CACF,CACF;AACF;;;;ACnBA,SAAgBC,OAAK,UAAmB,CAAC,GAA+B;CACtE,OAAOC,QAA+B,OAAO;AAC/C;;;;ACFA,SAAgB,KAAK,SAA8C;CACjE,OAAOC,UAAqB,OAAO;AACrC;;;;ACJA,MAAa,UAAUC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["decode","Connection.decode","Lifecycle.updateGrant","ConnectionStore.layerFromAsync","Lifecycle.detach","Lifecycle.Error","ProviderAuthorizationStore.layerFromAsync","CredentialStore.layerFromAsync","decode","ProviderAuthorization.decode","decode","ProviderAuth.decode","DnsPlan.decode","DnsPlan.decodeReceipt","create","DeletionEffect.create","DnsProvider.layerFromAsync","authorize","DeletionEffect.authorize","apply","DeletionEffect.apply","OAuthEffect.begin","OAuthStateStore.layerFromAsync","OAuthEffect.complete","ProviderAuthorizationStore.layerFromAsync","ConnectionStore.layerFromAsync","CredentialStore.layerFromAsync","OAuthEffect.refresh","OAuthEffect.revoke","InvalidInputError","DnsProvider.Error","ProvisioningEffect.create","DnsProvider.layerFromAsync","ProvisioningEffect.authorize","ProvisioningEffect.apply","ConnectionAuthorization.authorize","ProvisioningEffect.renderManualInstructions","TokenEffect.connect","InvalidInputError","DnsProvider.Error","ConnectionStore.layerFromAsync","ProviderAuthorizationStore.layerFromAsync","CredentialStore.layerFromAsync","VerificationEffect.record","DnsProvider.layerFromAsync","DnsResolver.layerFromAsync","make","CloudflareDnsOverHttps.toAsync","DnsOverHttps.toAsync","packageJson.version"],"sources":["../src/promise/connection.ts","../src/promise/connection-lifecycle.ts","../src/promise/provider-authorization.ts","../src/promise/provider-auth.ts","../src/promise/dns-record.ts","../src/promise/domain-name.ts","../src/promise/dns-plan.ts","../src/promise/deletion.ts","../src/promise/oauth.ts","../src/promise/provisioning.ts","../src/promise/token.ts","../src/promise/verification.ts","../src/promise/cloudflare-doh.ts","../src/promise/doh.ts","../src/index.ts"],"sourcesContent":["import { Effect } from \"effect\";\n\nimport * as Connection from \"../auth/connection.ts\";\n\nexport { assertGrant, AuthorizationError, encode, Grant, Schema } from \"../auth/connection.ts\";\nexport type { Connection, OAuthContinuation, StoredCredential } from \"../auth/connection.ts\";\n\nexport function decode(input: unknown): Promise<Connection.Connection> {\n return Effect.runPromise(Connection.decode(input));\n}\n","import { Effect, Layer } from \"effect\";\n\nimport type * as Connection from \"../auth/connection.ts\";\nimport type * as ProviderAuthorization from \"../auth/authorization.ts\";\nimport * as Lifecycle from \"../auth/connection-lifecycle.ts\";\nimport * as ConnectionStore from \"../stores/connection.ts\";\nimport * as CredentialStore from \"../stores/credential.ts\";\nimport * as ProviderAuthorizationStore from \"../stores/authorization.ts\";\n\nexport function updateGrant(input: {\n readonly connection: Parameters<typeof Lifecycle.updateGrant>[0][\"connection\"];\n readonly connectionStore: ConnectionStore.AsyncInterface;\n readonly grant: Parameters<typeof Lifecycle.updateGrant>[0][\"grant\"];\n}): Promise<Connection.Connection> {\n return Effect.runPromise(\n Lifecycle.updateGrant({ connection: input.connection, grant: input.grant }).pipe(\n Effect.provide(ConnectionStore.layerFromAsync(input.connectionStore)),\n ),\n );\n}\n\nexport function detach(input: {\n readonly authorizationStore: ProviderAuthorizationStore.AsyncInterface;\n readonly connectionId: string;\n readonly connectionStore: ConnectionStore.AsyncInterface;\n readonly credentialStore: CredentialStore.AsyncInterface;\n readonly revokeAuthorization: (\n authorization: ProviderAuthorization.ProviderAuthorization,\n ) => Promise<void>;\n}): Promise<Lifecycle.DetachResult> {\n return Effect.runPromise(\n Lifecycle.detach({\n connectionId: input.connectionId,\n revokeAuthorization: (authorization) =>\n Effect.tryPromise({\n try: () => input.revokeAuthorization(authorization),\n catch: (cause) =>\n new Lifecycle.Error({\n message: cause instanceof globalThis.Error ? cause.message : String(cause),\n }),\n }),\n }).pipe(\n Effect.provide(\n Layer.mergeAll(\n ProviderAuthorizationStore.layerFromAsync(input.authorizationStore),\n ConnectionStore.layerFromAsync(input.connectionStore),\n CredentialStore.layerFromAsync(input.credentialStore),\n ),\n ),\n ),\n );\n}\n\nexport { Error } from \"../auth/connection-lifecycle.ts\";\nexport type { DetachResult } from \"../auth/connection-lifecycle.ts\";\n","import { Effect } from \"effect\";\n\nimport * as ProviderAuthorization from \"../auth/authorization.ts\";\n\nexport { Capability, encode, Schema } from \"../auth/authorization.ts\";\nexport type { ProviderAuthorization } from \"../auth/authorization.ts\";\n\nexport function decode(input: unknown): Promise<ProviderAuthorization.ProviderAuthorization> {\n return Effect.runPromise(ProviderAuthorization.decode(input));\n}\n","import { Effect } from \"effect\";\n\nimport * as ProviderAuth from \"../auth/manifest.ts\";\n\nexport { Method, Schema } from \"../auth/manifest.ts\";\nexport type {\n AsyncOAuthSubjectResolver as OAuthSubjectResolver,\n Manifest,\n OAuthClientConfiguration,\n OAuthMethod,\n TokenValidation,\n} from \"../auth/manifest.ts\";\n\nexport function decode(input: unknown): Promise<ProviderAuth.Manifest> {\n return Effect.runPromise(ProviderAuth.decode(input));\n}\n","export {\n A,\n Aaaa,\n Caa,\n Cname,\n data,\n equals,\n Mx,\n Ns,\n Opaque,\n Observed,\n parse,\n RequirementMetadata,\n Schema,\n Srv,\n Txt,\n Type,\n} from \"../domain/dns-record.ts\";\nexport type { DnsRecord, Encoded } from \"../domain/dns-record.ts\";\n","export { parse, Schema } from \"../domain/domain-name.ts\";\nexport type { DomainName } from \"../domain/domain-name.ts\";\n","import { Effect } from \"effect\";\n\nimport * as DnsPlan from \"../plan/types.ts\";\n\nexport { Authorization, encode, encodeReceipt, Operation, Receipt, Schema } from \"../plan/types.ts\";\nexport type { ApplyReceipt, DnsPlan, PlanAuthorization } from \"../plan/types.ts\";\n\nexport function decode(input: unknown): Promise<DnsPlan.DnsPlan> {\n return Effect.runPromise(DnsPlan.decode(input));\n}\n\nexport function decodeReceipt(input: unknown): Promise<DnsPlan.ApplyReceipt> {\n return Effect.runPromise(DnsPlan.decodeReceipt(input));\n}\n","import { Effect, Layer } from \"effect\";\n\nimport { webCryptoLayer } from \"../plan/canonical-json.ts\";\nimport * as DeletionEffect from \"../plan/deletion.ts\";\nimport type * as DnsPlan from \"../plan/types.ts\";\nimport * as DnsProvider from \"../provider/provider.ts\";\n\nexport function create(input: {\n readonly plan: DnsPlan.DnsPlan;\n readonly provider: DnsProvider.AsyncInterface;\n readonly receipt: DnsPlan.ApplyReceipt;\n readonly ttlMs?: number;\n}): Promise<DeletionEffect.Plan> {\n return Effect.runPromise(\n DeletionEffect.create({\n plan: input.plan,\n receipt: input.receipt,\n ...(input.ttlMs === undefined ? {} : { ttlMs: input.ttlMs }),\n }).pipe(\n Effect.provide(Layer.merge(DnsProvider.layerFromAsync(input.provider), webCryptoLayer)),\n ),\n );\n}\n\nexport function authorize(\n plan: DeletionEffect.Plan,\n operationIds?: ReadonlyArray<string>,\n): Promise<DeletionEffect.Authorization> {\n return Effect.runPromise(\n DeletionEffect.authorize(plan, operationIds).pipe(Effect.provide(webCryptoLayer)),\n );\n}\n\nexport function apply(input: {\n readonly authorization: DeletionEffect.Authorization;\n readonly plan: DeletionEffect.Plan;\n readonly priorReceipt?: DeletionEffect.Receipt;\n readonly provider: DnsProvider.AsyncInterface;\n}): Promise<DeletionEffect.Receipt> {\n return Effect.runPromise(\n DeletionEffect.apply({\n authorization: input.authorization,\n plan: input.plan,\n ...(input.priorReceipt === undefined ? {} : { priorReceipt: input.priorReceipt }),\n }).pipe(\n Effect.provide(Layer.merge(DnsProvider.layerFromAsync(input.provider), webCryptoLayer)),\n ),\n );\n}\n\nexport { Authorization, Error, Operation, PartialError, Plan, Receipt } from \"../plan/deletion.ts\";\nexport type {\n ApplyError,\n Authorization as DeletionAuthorization,\n CreateError,\n Operation as DeletionOperation,\n Plan as DeletionPlan,\n Receipt as DeletionReceipt,\n} from \"../plan/deletion.ts\";\n","import { Effect, Layer } from \"effect\";\n\nimport * as Connection from \"../auth/connection.ts\";\nimport * as ProviderAuthorization from \"../auth/authorization.ts\";\nimport * as OAuthEffect from \"../auth/oauth.ts\";\nimport type * as ProviderAuth from \"../auth/manifest.ts\";\nimport { Error as InvalidInputError } from \"../invalid-input.ts\";\nimport { webCryptoLayer } from \"../plan/canonical-json.ts\";\nimport * as DnsProvider from \"../provider/provider.ts\";\nimport * as ConnectionStore from \"../stores/connection.ts\";\nimport * as CredentialStore from \"../stores/credential.ts\";\nimport * as ProviderAuthorizationStore from \"../stores/authorization.ts\";\nimport * as OAuthStateStore from \"../stores/oauth-state.ts\";\n\nexport interface BeginInput extends OAuthEffect.BeginInput {\n readonly stateStore: OAuthStateStore.AsyncInterface;\n}\n\nexport function begin(input: BeginInput): Promise<{ readonly authorizationUrl: URL }> {\n const { stateStore, ...programInput } = input;\n return Effect.runPromise(\n OAuthEffect.begin(programInput).pipe(\n Effect.provide(Layer.merge(OAuthStateStore.layerFromAsync(stateStore), webCryptoLayer)),\n ),\n );\n}\n\nexport function complete(input: {\n readonly callbackUrl: URL;\n readonly client: ProviderAuth.OAuthClientConfiguration;\n readonly connectionStore: ConnectionStore.AsyncInterface;\n readonly credentialStore: CredentialStore.AsyncInterface;\n readonly authorizationStore: ProviderAuthorizationStore.AsyncInterface;\n readonly fetch?: OAuthEffect.Fetch;\n readonly providerId: string;\n readonly resolveSubject: ProviderAuth.AsyncOAuthSubjectResolver;\n readonly stateStore: OAuthStateStore.AsyncInterface;\n}): Promise<{\n readonly authorization: ProviderAuthorization.ProviderAuthorization;\n readonly connection: Connection.Connection;\n}> {\n return Effect.runPromise(\n OAuthEffect.complete({\n callbackUrl: input.callbackUrl,\n client: input.client,\n ...(input.fetch === undefined ? {} : { fetch: input.fetch }),\n providerId: input.providerId,\n resolveSubject: (tokens, accessToken) =>\n Effect.tryPromise({\n try: () => input.resolveSubject(tokens, accessToken),\n catch: (cause) => providerFailure(input.providerId, \"resolveSubject\", cause),\n }),\n }).pipe(\n Effect.provide(\n Layer.mergeAll(\n OAuthStateStore.layerFromAsync(input.stateStore),\n ProviderAuthorizationStore.layerFromAsync(input.authorizationStore),\n ConnectionStore.layerFromAsync(input.connectionStore),\n CredentialStore.layerFromAsync(input.credentialStore),\n webCryptoLayer,\n ),\n ),\n ),\n );\n}\n\nexport function refresh(input: {\n readonly authorization: ProviderAuthorization.ProviderAuthorization;\n readonly client: ProviderAuth.OAuthClientConfiguration;\n readonly credentialStore: CredentialStore.AsyncInterface;\n readonly fetch?: OAuthEffect.Fetch;\n readonly method: ProviderAuth.OAuthMethod;\n}): Promise<void> {\n return Effect.runPromise(\n OAuthEffect.refresh({\n client: input.client,\n authorization: input.authorization,\n ...(input.fetch === undefined ? {} : { fetch: input.fetch }),\n method: input.method,\n }).pipe(Effect.provide(CredentialStore.layerFromAsync(input.credentialStore))),\n );\n}\n\nexport function revoke(input: {\n readonly authorization: ProviderAuthorization.ProviderAuthorization;\n readonly client: ProviderAuth.OAuthClientConfiguration;\n readonly credentialStore: CredentialStore.AsyncInterface;\n readonly fetch?: OAuthEffect.Fetch;\n readonly method: ProviderAuth.OAuthMethod;\n}): Promise<void> {\n return Effect.runPromise(\n OAuthEffect.revoke({\n client: input.client,\n authorization: input.authorization,\n ...(input.fetch === undefined ? {} : { fetch: input.fetch }),\n method: input.method,\n }).pipe(Effect.provide(CredentialStore.layerFromAsync(input.credentialStore))),\n );\n}\n\nfunction providerFailure(\n providerId: string,\n operation: string,\n cause: unknown,\n): DnsProvider.Error | InvalidInputError {\n return cause instanceof InvalidInputError || cause instanceof DnsProvider.Error\n ? cause\n : new DnsProvider.Error({\n cause,\n message: cause instanceof Error ? cause.message : \"Provider callback failed\",\n operation,\n providerId,\n });\n}\n\nexport type Fetch = OAuthEffect.Fetch;\n","import { Effect, Layer } from \"effect\";\n\nimport type * as Connection from \"../auth/connection.ts\";\nimport type * as ProviderAuthorization from \"../auth/authorization.ts\";\nimport * as ConnectionAuthorization from \"../plan/connection-authorization.ts\";\nimport { webCryptoLayer } from \"../plan/canonical-json.ts\";\nimport * as ProvisioningEffect from \"../plan/plan.ts\";\nimport type * as DnsPlan from \"../plan/types.ts\";\nimport * as DnsProvider from \"../provider/provider.ts\";\n\nexport interface CreateInput extends ProvisioningEffect.CreateInput {\n readonly provider: DnsProvider.AsyncInterface;\n}\n\nexport function create(input: CreateInput): Promise<DnsPlan.DnsPlan> {\n const { provider, ...programInput } = input;\n return Effect.runPromise(\n ProvisioningEffect.create(programInput).pipe(\n Effect.provide(Layer.merge(DnsProvider.layerFromAsync(provider), webCryptoLayer)),\n ),\n );\n}\n\nexport function authorize(\n plan: DnsPlan.DnsPlan,\n operationIds?: ReadonlyArray<string>,\n options: { readonly allowPartial?: boolean } = {},\n): Promise<DnsPlan.PlanAuthorization> {\n return Effect.runPromise(\n ProvisioningEffect.authorize(plan, operationIds, options).pipe(Effect.provide(webCryptoLayer)),\n );\n}\n\nexport function apply(input: {\n readonly authorization: DnsPlan.PlanAuthorization;\n readonly plan: DnsPlan.DnsPlan;\n readonly provider: DnsProvider.AsyncInterface;\n}): Promise<DnsPlan.ApplyReceipt> {\n return Effect.runPromise(\n ProvisioningEffect.apply({ authorization: input.authorization, plan: input.plan }).pipe(\n Effect.provide(Layer.merge(DnsProvider.layerFromAsync(input.provider), webCryptoLayer)),\n ),\n );\n}\n\nexport function authorizeForConnection(input: {\n readonly allowPartial?: boolean;\n readonly authorization: ProviderAuthorization.ProviderAuthorization;\n readonly connection: Connection.Connection;\n readonly domain: string;\n readonly operationIds?: ReadonlyArray<string>;\n readonly plan: DnsPlan.DnsPlan;\n}): Promise<DnsPlan.PlanAuthorization> {\n return Effect.runPromise(\n ConnectionAuthorization.authorize(input).pipe(Effect.provide(webCryptoLayer)),\n );\n}\n\nexport const renderManualInstructions = ProvisioningEffect.renderManualInstructions;\n","import { Effect, Layer } from \"effect\";\n\nimport * as Connection from \"../auth/connection.ts\";\nimport * as ProviderAuthorization from \"../auth/authorization.ts\";\nimport type * as ProviderAuth from \"../auth/manifest.ts\";\nimport { Value as Secret } from \"../auth/secret.ts\";\nimport * as TokenEffect from \"../auth/token.ts\";\nimport { Error as InvalidInputError } from \"../invalid-input.ts\";\nimport { webCryptoLayer } from \"../plan/canonical-json.ts\";\nimport * as DnsProvider from \"../provider/provider.ts\";\nimport * as ConnectionStore from \"../stores/connection.ts\";\nimport * as CredentialStore from \"../stores/credential.ts\";\nimport * as ProviderAuthorizationStore from \"../stores/authorization.ts\";\n\nexport function connect(input: {\n readonly connectionStore: ConnectionStore.AsyncInterface;\n readonly credentialStore: CredentialStore.AsyncInterface;\n readonly authorizationStore: ProviderAuthorizationStore.AsyncInterface;\n readonly grant: Connection.Grant;\n readonly ownerId: string;\n readonly providerId: string;\n readonly subjectId: string;\n readonly token: Secret;\n readonly validate: (token: Secret) => Promise<ProviderAuth.TokenValidation>;\n}): Promise<{\n readonly authorization: ProviderAuthorization.ProviderAuthorization;\n readonly connection: Connection.Connection;\n}> {\n return Effect.runPromise(\n TokenEffect.connect({\n grant: input.grant,\n ownerId: input.ownerId,\n providerId: input.providerId,\n subjectId: input.subjectId,\n token: input.token,\n validate: (token) =>\n Effect.tryPromise({\n try: () => input.validate(token),\n catch: (cause) =>\n cause instanceof InvalidInputError || cause instanceof DnsProvider.Error\n ? cause\n : new DnsProvider.Error({\n cause,\n message: cause instanceof Error ? cause.message : \"Token validation failed\",\n operation: \"validateToken\",\n providerId: input.providerId,\n }),\n }),\n }).pipe(\n Effect.provide(\n Layer.mergeAll(\n ConnectionStore.layerFromAsync(input.connectionStore),\n ProviderAuthorizationStore.layerFromAsync(input.authorizationStore),\n CredentialStore.layerFromAsync(input.credentialStore),\n webCryptoLayer,\n ),\n ),\n ),\n );\n}\n","import { Effect, Layer } from \"effect\";\n\nimport type * as DomainName from \"../domain/domain-name.ts\";\nimport type * as DnsRecord from \"../domain/dns-record.ts\";\nimport * as DnsProvider from \"../provider/provider.ts\";\nimport * as DnsResolver from \"../verification/resolver.ts\";\nimport * as VerificationEffect from \"../verification/verify.ts\";\n\nexport function record(input: {\n readonly provider: DnsProvider.AsyncInterface;\n readonly record: DnsRecord.DnsRecord;\n readonly resolver: DnsResolver.AsyncInterface;\n readonly zone: DomainName.DomainName;\n}): Promise<VerificationEffect.Result> {\n return Effect.runPromise(\n VerificationEffect.record({ record: input.record, zone: input.zone }).pipe(\n Effect.provide(\n Layer.merge(\n DnsProvider.layerFromAsync(input.provider),\n DnsResolver.layerFromAsync(input.resolver),\n ),\n ),\n ),\n );\n}\n","import * as CloudflareDnsOverHttps from \"../verification/cloudflare-doh.ts\";\nimport type * as DnsResolver from \"../verification/resolver.ts\";\n\nexport type Options = CloudflareDnsOverHttps.Options;\n\nexport function make(options: Options = {}): DnsResolver.AsyncInterface {\n return CloudflareDnsOverHttps.toAsync(options);\n}\n","import * as DnsOverHttps from \"../verification/doh.ts\";\nimport type * as DnsResolver from \"../verification/resolver.ts\";\n\nexport type Options = DnsOverHttps.Options;\n\nexport function make(options: Options): DnsResolver.AsyncInterface {\n return DnsOverHttps.toAsync(options);\n}\n","import packageJson from \"../package.json\" with { type: \"json\" };\n\n/** The current package version from the package manifest. */\nexport const VERSION = packageJson.version;\n\nexport * as Connection from \"./promise/connection.ts\";\nexport * as ConnectionLifecycle from \"./promise/connection-lifecycle.ts\";\nexport * as ProviderAuthorization from \"./promise/provider-authorization.ts\";\nexport * as ProviderAuth from \"./promise/provider-auth.ts\";\nexport * as Secret from \"./auth/secret.ts\";\nexport * as ProviderDiscovery from \"./discovery/selection.ts\";\nexport * as Zones from \"./discovery/zones.ts\";\nexport * as DnsRecord from \"./promise/dns-record.ts\";\nexport * as DomainName from \"./promise/domain-name.ts\";\nexport * as InvalidInput from \"./invalid-input.ts\";\nexport * as DnsPlan from \"./promise/dns-plan.ts\";\nexport * as Deletion from \"./promise/deletion.ts\";\nexport type * as DnsProvider from \"./promise/dns-provider.ts\";\nexport * as Cloudflare from \"./promise/cloudflare.ts\";\nexport * as Vercel from \"./promise/vercel.ts\";\nexport type * as DnsResolver from \"./promise/dns-resolver.ts\";\nexport * as OAuth from \"./promise/oauth.ts\";\nexport * as Provisioning from \"./promise/provisioning.ts\";\nexport type * as Stores from \"./promise/stores.ts\";\nexport * as TokenConnection from \"./promise/token.ts\";\nexport * as Verification from \"./promise/verification.ts\";\nexport * as CloudflareDnsOverHttps from \"./promise/cloudflare-doh.ts\";\nexport * as DnsOverHttps from \"./promise/doh.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAOA,SAAgBA,SAAO,OAAgD;CACrE,OAAO,OAAO,WAAWC,SAAkB,KAAK,CAAC;AACnD;;;;;;;;ACAA,SAAgB,YAAY,OAIO;CACjC,OAAO,OAAO,WACZC,cAAsB;EAAE,YAAY,MAAM;EAAY,OAAO,MAAM;CAAM,CAAC,CAAC,CAAC,KAC1E,OAAO,QAAQC,iBAA+B,MAAM,eAAe,CAAC,CACtE,CACF;AACF;AAEA,SAAgB,OAAO,OAQa;CAClC,OAAO,OAAO,WACZC,SAAiB;EACf,cAAc,MAAM;EACpB,sBAAsB,kBACpB,OAAO,WAAW;GAChB,WAAW,MAAM,oBAAoB,aAAa;GAClD,QAAQ,UACN,IAAIC,QAAgB,EAClB,SAAS,iBAAiB,WAAW,QAAQ,MAAM,UAAU,OAAO,KAAK,EAC3E,CAAC;EACL,CAAC;CACL,CAAC,CAAC,CAAC,KACD,OAAO,QACL,MAAM,SACJC,iBAA0C,MAAM,kBAAkB,GAClE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KACD,OAAO,QACL,MAAM,SACJC,iBAA+B,MAAM,eAAe,GACpDC,iBAA0C,MAAM,kBAAkB,GAClEC,iBAA+B,MAAM,eAAe,GACpD,cACF,CACF,CACF,CACF;AACF;;;;ACnDA,SAAgB,OAAO,OAKgB;CACrC,OAAO,OAAO,WACZC,SAA0B;EAAE,QAAQ,MAAM;EAAQ,MAAM,MAAM;CAAK,CAAC,CAAC,CAAC,KACpE,OAAO,QACL,MAAM,MACJC,eAA2B,MAAM,QAAQ,GACzCC,iBAA2B,MAAM,QAAQ,CAC3C,CACF,CACF,CACF;AACF;;;;ACnBA,SAAgBC,OAAK,UAAmB,CAAC,GAA+B;CACtE,OAAOC,QAA+B,OAAO;AAC/C;;;;ACFA,SAAgB,KAAK,SAA8C;CACjE,OAAOC,UAAqB,OAAO;AACrC;;;;ACJA,MAAa,UAAUC"}
|
|
@@ -445,6 +445,8 @@ declare class Error extends Error_base {}
|
|
|
445
445
|
interface Interface {
|
|
446
446
|
readonly id: string;
|
|
447
447
|
readonly createRecord: (zone: DomainName, record: DnsRecord) => Effect.Effect<CreateResult, Error>;
|
|
448
|
+
readonly deleteRecord: (zone: DomainName, providerRecordId: string) => Effect.Effect<void, Error>;
|
|
449
|
+
readonly getRecord: (zone: DomainName, providerRecordId: string) => Effect.Effect<Observed | null, Error>;
|
|
448
450
|
readonly listRecords: (zone: DomainName) => Effect.Effect<ReadonlyArray<Observed>, Error>;
|
|
449
451
|
}
|
|
450
452
|
declare const Service_base: Context.ServiceClass<Service, "@domainkit/DnsProvider", Interface>;
|
|
@@ -453,6 +455,8 @@ declare class Service extends Service_base {}
|
|
|
453
455
|
interface AsyncInterface {
|
|
454
456
|
readonly id: string;
|
|
455
457
|
readonly createRecord: (zone: DomainName, record: DnsRecord) => Promise<CreateResult>;
|
|
458
|
+
readonly deleteRecord: (zone: DomainName, providerRecordId: string) => Promise<void>;
|
|
459
|
+
readonly getRecord: (zone: DomainName, providerRecordId: string) => Promise<Observed | null>;
|
|
456
460
|
readonly listRecords: (zone: DomainName) => Promise<ReadonlyArray<Observed>>;
|
|
457
461
|
}
|
|
458
462
|
declare const layerFromAsync: (provider: AsyncInterface) => Layer.Layer<Service>;
|
|
@@ -576,4 +580,4 @@ interface AsyncOAuthSubjectResolver {
|
|
|
576
580
|
}
|
|
577
581
|
//#endregion
|
|
578
582
|
export { Schema$2 as A, domain_name_d_exports as B, DnsRecord as C, Observed as D, Ns as E, dns_record_d_exports as F, Error$1 as H, equals as I, parse as L, Txt as M, Type as N, Opaque as O, data as P, DomainName as R, Cname as S, Mx as T, invalid_input_d_exports as U, parse$1 as V, Service as _, OAuthClientConfiguration as a, Aaaa as b, Schema$1 as c, Value as d, secret_d_exports as f, Interface as g, Error as h, Method as i, Srv as j, RequirementMetadata as k, TokenValidation as l, CreateResult as m, IntegrationMethod as n, OAuthMethod as o, AsyncInterface as p, Manifest as r, OAuthSubjectResolver as s, AsyncOAuthSubjectResolver as t, manifest_d_exports as u, provider_d_exports as v, Encoded as w, Caa as x, A as y, Schema$3 as z };
|
|
579
|
-
//# sourceMappingURL=manifest-
|
|
583
|
+
//# sourceMappingURL=manifest-CP85ePFn.d.mts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { C as fromCause } from "./resolver-tEXpKxmH.mjs";
|
|
3
3
|
import { Context, Effect, Layer } from "effect";
|
|
4
4
|
//#region src/stores/receipt.ts
|
|
5
5
|
var receipt_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -25,4 +25,4 @@ const layerFromAsync = (store) => Layer.succeed(Service, {
|
|
|
25
25
|
//#endregion
|
|
26
26
|
export { receipt_exports as n, toAsync as r, Service as t };
|
|
27
27
|
|
|
28
|
-
//# sourceMappingURL=receipt-
|
|
28
|
+
//# sourceMappingURL=receipt-CGSnfZQ6.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"receipt-
|
|
1
|
+
{"version":3,"file":"receipt-CGSnfZQ6.mjs","names":[],"sources":["../src/stores/receipt.ts"],"sourcesContent":["import { Context, Effect, Layer } from \"effect\";\n\nimport type { ApplyReceipt } from \"../plan/types.ts\";\nimport { type Error, fromCause } from \"./error.ts\";\n\nexport interface Interface {\n readonly get: (planDigest: string) => Effect.Effect<ApplyReceipt | null, Error>;\n readonly put: (receipt: ApplyReceipt) => Effect.Effect<void, Error>;\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@domainkit/ReceiptStore\") {}\n\nexport interface AsyncInterface {\n readonly get: (planDigest: string) => Promise<ApplyReceipt | null>;\n readonly put: (receipt: ApplyReceipt) => Promise<void>;\n}\n\nexport const toAsync = (store: Interface): AsyncInterface => ({\n get: (planDigest) => Effect.runPromise(store.get(planDigest)),\n put: (receipt) => Effect.runPromise(store.put(receipt)),\n});\n\nexport const layerFromAsync = (store: AsyncInterface): Layer.Layer<Service> =>\n Layer.succeed(Service, {\n get: Effect.fn(\"ReceiptStore.get\")((planDigest) =>\n Effect.tryPromise({\n try: () => store.get(planDigest),\n catch: (cause) => fromCause(\"receipt.get\", cause),\n }),\n ),\n put: Effect.fn(\"ReceiptStore.put\")((receipt) =>\n Effect.tryPromise({\n try: () => store.put(receipt),\n catch: (cause) => fromCause(\"receipt.put\", cause),\n }),\n ),\n });\n"],"mappings":";;;;;;;;;AAUA,IAAa,UAAb,cAA6B,QAAQ,QAA4B,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC;AAO/F,MAAa,WAAW,WAAsC;CAC5D,MAAM,eAAe,OAAO,WAAW,MAAM,IAAI,UAAU,CAAC;CAC5D,MAAM,YAAY,OAAO,WAAW,MAAM,IAAI,OAAO,CAAC;AACxD;AAEA,MAAa,kBAAkB,UAC7B,MAAM,QAAQ,SAAS;CACrB,KAAK,OAAO,GAAG,kBAAkB,CAAC,EAAE,eAClC,OAAO,WAAW;EAChB,WAAW,MAAM,IAAI,UAAU;EAC/B,QAAQ,UAAU,UAAU,eAAe,KAAK;CAClD,CAAC,CACH;CACA,KAAK,OAAO,GAAG,kBAAkB,CAAC,EAAE,YAClC,OAAO,WAAW;EAChB,WAAW,MAAM,IAAI,OAAO;EAC5B,QAAQ,UAAU,UAAU,eAAe,KAAK;CAClD,CAAC,CACH;AACF,CAAC"}
|
|
@@ -1,10 +1,69 @@
|
|
|
1
|
-
import { H as Error$2, N as Type, R as DomainName, d as Value, o as OAuthMethod } from "./manifest-
|
|
1
|
+
import { H as Error$2, N as Type, R as DomainName, d as Value, o as OAuthMethod } from "./manifest-CP85ePFn.mjs";
|
|
2
2
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
3
|
-
declare namespace
|
|
4
|
-
export {
|
|
3
|
+
declare namespace authorization_d_exports$1 {
|
|
4
|
+
export { Capability, ProviderAuthorization, Schema$3 as Schema, decode$2 as decode, encode$2 as encode, validate$1 as validate };
|
|
5
5
|
}
|
|
6
6
|
declare const Capability: Schema.Literals<readonly ["dns:read", "dns:write"]>;
|
|
7
7
|
type Capability = typeof Capability.Type;
|
|
8
|
+
/** A provider credential authorization shared by one or more owner connections. */
|
|
9
|
+
declare const Schema$3: Schema.Struct<{
|
|
10
|
+
readonly accountId: Schema.String;
|
|
11
|
+
readonly capabilities: Schema.$Array<Schema.Literals<readonly ["dns:read", "dns:write"]>>;
|
|
12
|
+
readonly createdAt: Schema.DateFromString;
|
|
13
|
+
readonly expiresAt: Schema.NullOr<Schema.DateFromString>;
|
|
14
|
+
readonly id: Schema.String;
|
|
15
|
+
readonly kind: Schema.Literals<readonly ["oauth2", "token"]>;
|
|
16
|
+
readonly providerId: Schema.String;
|
|
17
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
18
|
+
readonly subjectId: Schema.String;
|
|
19
|
+
}>;
|
|
20
|
+
interface ProviderAuthorization extends Schema.Schema.Type<typeof Schema$3> {}
|
|
21
|
+
declare const decode$2: (input: unknown) => Effect.Effect<{
|
|
22
|
+
readonly accountId: string;
|
|
23
|
+
readonly capabilities: readonly ("dns:read" | "dns:write")[];
|
|
24
|
+
readonly createdAt: Date;
|
|
25
|
+
readonly expiresAt: Date | null;
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly kind: "oauth2" | "token";
|
|
28
|
+
readonly providerId: string;
|
|
29
|
+
readonly scopes: readonly string[];
|
|
30
|
+
readonly subjectId: string;
|
|
31
|
+
}, Error$2, never>;
|
|
32
|
+
declare const validate$1: (input: unknown) => Effect.Effect<{
|
|
33
|
+
readonly accountId: string;
|
|
34
|
+
readonly capabilities: readonly ("dns:read" | "dns:write")[];
|
|
35
|
+
readonly createdAt: Date;
|
|
36
|
+
readonly expiresAt: Date | null;
|
|
37
|
+
readonly id: string;
|
|
38
|
+
readonly kind: "oauth2" | "token";
|
|
39
|
+
readonly providerId: string;
|
|
40
|
+
readonly scopes: readonly string[];
|
|
41
|
+
readonly subjectId: string;
|
|
42
|
+
}, Error$2, never>;
|
|
43
|
+
declare const encode$2: (input: {
|
|
44
|
+
readonly accountId: string;
|
|
45
|
+
readonly capabilities: readonly ("dns:read" | "dns:write")[];
|
|
46
|
+
readonly createdAt: Date;
|
|
47
|
+
readonly expiresAt: Date | null;
|
|
48
|
+
readonly id: string;
|
|
49
|
+
readonly kind: "oauth2" | "token";
|
|
50
|
+
readonly providerId: string;
|
|
51
|
+
readonly scopes: readonly string[];
|
|
52
|
+
readonly subjectId: string;
|
|
53
|
+
}, options?: import("effect/SchemaAST").ParseOptions) => {
|
|
54
|
+
readonly accountId: string;
|
|
55
|
+
readonly capabilities: readonly ("dns:read" | "dns:write")[];
|
|
56
|
+
readonly createdAt: string;
|
|
57
|
+
readonly expiresAt: string | null;
|
|
58
|
+
readonly id: string;
|
|
59
|
+
readonly kind: "oauth2" | "token";
|
|
60
|
+
readonly providerId: string;
|
|
61
|
+
readonly scopes: readonly string[];
|
|
62
|
+
readonly subjectId: string;
|
|
63
|
+
};
|
|
64
|
+
declare namespace connection_d_exports$1 {
|
|
65
|
+
export { AuthorizationError, Connection, Grant, OAuthContinuation, Schema$2 as Schema, StoredCredential, assertGrant, decode$1 as decode, encode$1 as encode, validate };
|
|
66
|
+
}
|
|
8
67
|
declare const Grant: Schema.TaggedUnion<{
|
|
9
68
|
readonly account: Schema.TaggedStruct<"account", {}>;
|
|
10
69
|
readonly domains: Schema.TaggedStruct<"domains", {
|
|
@@ -12,11 +71,10 @@ declare const Grant: Schema.TaggedUnion<{
|
|
|
12
71
|
}>;
|
|
13
72
|
}>;
|
|
14
73
|
type Grant = typeof Grant.Type;
|
|
74
|
+
/** An owner-scoped grant bound to one provider authorization. */
|
|
15
75
|
declare const Schema$2: Schema.Struct<{
|
|
16
|
-
readonly
|
|
17
|
-
readonly capabilities: Schema.$Array<Schema.Literals<readonly ["dns:read", "dns:write"]>>;
|
|
76
|
+
readonly authorizationId: Schema.String;
|
|
18
77
|
readonly createdAt: Schema.DateFromString;
|
|
19
|
-
readonly expiresAt: Schema.NullOr<Schema.DateFromString>;
|
|
20
78
|
readonly grant: Schema.TaggedUnion<{
|
|
21
79
|
readonly account: Schema.TaggedStruct<"account", {}>;
|
|
22
80
|
readonly domains: Schema.TaggedStruct<"domains", {
|
|
@@ -24,17 +82,12 @@ declare const Schema$2: Schema.Struct<{
|
|
|
24
82
|
}>;
|
|
25
83
|
}>;
|
|
26
84
|
readonly id: Schema.String;
|
|
27
|
-
readonly
|
|
28
|
-
readonly providerId: Schema.String;
|
|
29
|
-
readonly scopes: Schema.$Array<Schema.String>;
|
|
30
|
-
readonly subjectId: Schema.String;
|
|
85
|
+
readonly ownerId: Schema.String;
|
|
31
86
|
}>;
|
|
32
87
|
interface Connection extends Schema.Schema.Type<typeof Schema$2> {}
|
|
33
88
|
declare const decode$1: (input: unknown) => Effect.Effect<{
|
|
34
|
-
readonly
|
|
35
|
-
readonly capabilities: readonly ("dns:read" | "dns:write")[];
|
|
89
|
+
readonly authorizationId: string;
|
|
36
90
|
readonly createdAt: Date;
|
|
37
|
-
readonly expiresAt: Date | null;
|
|
38
91
|
readonly grant: {
|
|
39
92
|
readonly _tag: "account";
|
|
40
93
|
} | {
|
|
@@ -42,16 +95,11 @@ declare const decode$1: (input: unknown) => Effect.Effect<{
|
|
|
42
95
|
readonly domains: readonly (string & import("effect/Brand").Brand<"DomainName">)[];
|
|
43
96
|
};
|
|
44
97
|
readonly id: string;
|
|
45
|
-
readonly
|
|
46
|
-
readonly providerId: string;
|
|
47
|
-
readonly scopes: readonly string[];
|
|
48
|
-
readonly subjectId: string;
|
|
98
|
+
readonly ownerId: string;
|
|
49
99
|
}, Error$2, never>;
|
|
50
100
|
declare const validate: (input: unknown) => Effect.Effect<{
|
|
51
|
-
readonly
|
|
52
|
-
readonly capabilities: readonly ("dns:read" | "dns:write")[];
|
|
101
|
+
readonly authorizationId: string;
|
|
53
102
|
readonly createdAt: Date;
|
|
54
|
-
readonly expiresAt: Date | null;
|
|
55
103
|
readonly grant: {
|
|
56
104
|
readonly _tag: "account";
|
|
57
105
|
} | {
|
|
@@ -59,16 +107,11 @@ declare const validate: (input: unknown) => Effect.Effect<{
|
|
|
59
107
|
readonly domains: readonly (string & import("effect/Brand").Brand<"DomainName">)[];
|
|
60
108
|
};
|
|
61
109
|
readonly id: string;
|
|
62
|
-
readonly
|
|
63
|
-
readonly providerId: string;
|
|
64
|
-
readonly scopes: readonly string[];
|
|
65
|
-
readonly subjectId: string;
|
|
110
|
+
readonly ownerId: string;
|
|
66
111
|
}, Error$2, never>;
|
|
67
112
|
declare const encode$1: (input: {
|
|
68
|
-
readonly
|
|
69
|
-
readonly capabilities: readonly ("dns:read" | "dns:write")[];
|
|
113
|
+
readonly authorizationId: string;
|
|
70
114
|
readonly createdAt: Date;
|
|
71
|
-
readonly expiresAt: Date | null;
|
|
72
115
|
readonly grant: {
|
|
73
116
|
readonly _tag: "account";
|
|
74
117
|
} | {
|
|
@@ -76,15 +119,10 @@ declare const encode$1: (input: {
|
|
|
76
119
|
readonly domains: readonly (string & import("effect/Brand").Brand<"DomainName">)[];
|
|
77
120
|
};
|
|
78
121
|
readonly id: string;
|
|
79
|
-
readonly
|
|
80
|
-
readonly providerId: string;
|
|
81
|
-
readonly scopes: readonly string[];
|
|
82
|
-
readonly subjectId: string;
|
|
122
|
+
readonly ownerId: string;
|
|
83
123
|
}, options?: import("effect/SchemaAST").ParseOptions) => {
|
|
84
|
-
readonly
|
|
85
|
-
readonly capabilities: readonly ("dns:read" | "dns:write")[];
|
|
124
|
+
readonly authorizationId: string;
|
|
86
125
|
readonly createdAt: string;
|
|
87
|
-
readonly expiresAt: string | null;
|
|
88
126
|
readonly grant: {
|
|
89
127
|
readonly _tag: "account";
|
|
90
128
|
} | {
|
|
@@ -92,10 +130,7 @@ declare const encode$1: (input: {
|
|
|
92
130
|
readonly domains: readonly string[];
|
|
93
131
|
};
|
|
94
132
|
readonly id: string;
|
|
95
|
-
readonly
|
|
96
|
-
readonly providerId: string;
|
|
97
|
-
readonly scopes: readonly string[];
|
|
98
|
-
readonly subjectId: string;
|
|
133
|
+
readonly ownerId: string;
|
|
99
134
|
};
|
|
100
135
|
interface OAuthContinuation {
|
|
101
136
|
readonly clientId: string;
|
|
@@ -103,6 +138,7 @@ interface OAuthContinuation {
|
|
|
103
138
|
readonly expiresAt: Date;
|
|
104
139
|
readonly grant: Grant;
|
|
105
140
|
readonly method: OAuthMethod;
|
|
141
|
+
readonly ownerId: string;
|
|
106
142
|
readonly redirectUri: string;
|
|
107
143
|
readonly stateHash: string;
|
|
108
144
|
readonly subjectId: string;
|
|
@@ -116,8 +152,7 @@ declare const AuthorizationError_base: Schema.Class<AuthorizationError, Schema.T
|
|
|
116
152
|
readonly message: Schema.String;
|
|
117
153
|
}>, import("effect/Cause").YieldableError>;
|
|
118
154
|
declare class AuthorizationError extends AuthorizationError_base {}
|
|
119
|
-
declare function assertGrant(connection: Connection, request: {
|
|
120
|
-
readonly accountId: string;
|
|
155
|
+
declare function assertGrant(connection: Connection, authorization: ProviderAuthorization, request: {
|
|
121
156
|
readonly capability: Capability;
|
|
122
157
|
readonly domain: string;
|
|
123
158
|
readonly now?: Date;
|
|
@@ -134,34 +169,59 @@ declare const Error_base$1: Schema.Class<Error$1, Schema.TaggedStruct<"StorageEr
|
|
|
134
169
|
declare class Error$1 extends Error_base$1 {}
|
|
135
170
|
declare function fromCause(operation: string, cause: unknown): Error$1;
|
|
136
171
|
declare namespace connection_d_exports {
|
|
137
|
-
export { AsyncInterface$
|
|
172
|
+
export { AsyncInterface$5 as AsyncInterface, Interface$5 as Interface, Service$5 as Service, layerFromAsync$5 as layerFromAsync, toAsync$5 as toAsync };
|
|
138
173
|
}
|
|
139
|
-
interface Interface$
|
|
174
|
+
interface Interface$5 {
|
|
175
|
+
readonly delete: (connectionId: string) => Effect.Effect<void, Error$1>;
|
|
176
|
+
readonly find: (ownerId: string, authorizationId: string) => Effect.Effect<Connection | null, Error$1>;
|
|
140
177
|
readonly get: (connectionId: string) => Effect.Effect<Connection | null, Error$1>;
|
|
178
|
+
readonly listByAuthorizationId: (authorizationId: string) => Effect.Effect<ReadonlyArray<Connection>, Error$1>;
|
|
141
179
|
readonly put: (connection: Connection) => Effect.Effect<void, Error$1>;
|
|
142
180
|
}
|
|
143
|
-
declare const Service_base$
|
|
144
|
-
declare class Service$
|
|
145
|
-
interface AsyncInterface$
|
|
181
|
+
declare const Service_base$5: Context.ServiceClass<Service$5, "@domainkit/ConnectionStore", Interface$5>;
|
|
182
|
+
declare class Service$5 extends Service_base$5 {}
|
|
183
|
+
interface AsyncInterface$5 {
|
|
184
|
+
readonly delete: (connectionId: string) => Promise<void>;
|
|
185
|
+
readonly find: (ownerId: string, authorizationId: string) => Promise<Connection | null>;
|
|
146
186
|
readonly get: (connectionId: string) => Promise<Connection | null>;
|
|
187
|
+
readonly listByAuthorizationId: (authorizationId: string) => Promise<ReadonlyArray<Connection>>;
|
|
147
188
|
readonly put: (connection: Connection) => Promise<void>;
|
|
148
189
|
}
|
|
190
|
+
declare const toAsync$5: (store: Interface$5) => AsyncInterface$5;
|
|
191
|
+
declare const layerFromAsync$5: (store: AsyncInterface$5) => Layer.Layer<Service$5>;
|
|
192
|
+
declare namespace credential_d_exports {
|
|
193
|
+
export { AsyncInterface$4 as AsyncInterface, Interface$4 as Interface, Service$4 as Service, layerFromAsync$4 as layerFromAsync, toAsync$4 as toAsync };
|
|
194
|
+
}
|
|
195
|
+
interface Interface$4 {
|
|
196
|
+
readonly delete: (authorizationId: string) => Effect.Effect<void, Error$1>;
|
|
197
|
+
readonly get: (authorizationId: string) => Effect.Effect<StoredCredential | null, Error$1>;
|
|
198
|
+
readonly put: (authorizationId: string, credential: StoredCredential) => Effect.Effect<void, Error$1>;
|
|
199
|
+
}
|
|
200
|
+
declare const Service_base$4: Context.ServiceClass<Service$4, "@domainkit/CredentialStore", Interface$4>;
|
|
201
|
+
declare class Service$4 extends Service_base$4 {}
|
|
202
|
+
interface AsyncInterface$4 {
|
|
203
|
+
readonly delete: (authorizationId: string) => Promise<void>;
|
|
204
|
+
readonly get: (authorizationId: string) => Promise<StoredCredential | null>;
|
|
205
|
+
readonly put: (authorizationId: string, credential: StoredCredential) => Promise<void>;
|
|
206
|
+
}
|
|
149
207
|
declare const toAsync$4: (store: Interface$4) => AsyncInterface$4;
|
|
150
208
|
declare const layerFromAsync$4: (store: AsyncInterface$4) => Layer.Layer<Service$4>;
|
|
151
|
-
declare namespace
|
|
209
|
+
declare namespace authorization_d_exports {
|
|
152
210
|
export { AsyncInterface$3 as AsyncInterface, Interface$3 as Interface, Service$3 as Service, layerFromAsync$3 as layerFromAsync, toAsync$3 as toAsync };
|
|
153
211
|
}
|
|
154
212
|
interface Interface$3 {
|
|
155
|
-
readonly delete: (
|
|
156
|
-
readonly
|
|
157
|
-
readonly
|
|
213
|
+
readonly delete: (authorizationId: string) => Effect.Effect<void, Error$1>;
|
|
214
|
+
readonly findByProviderAccount: (providerId: string, accountId: string) => Effect.Effect<ProviderAuthorization | null, Error$1>;
|
|
215
|
+
readonly get: (authorizationId: string) => Effect.Effect<ProviderAuthorization | null, Error$1>;
|
|
216
|
+
readonly put: (authorization: ProviderAuthorization) => Effect.Effect<void, Error$1>;
|
|
158
217
|
}
|
|
159
|
-
declare const Service_base$3: Context.ServiceClass<Service$3, "@domainkit/
|
|
218
|
+
declare const Service_base$3: Context.ServiceClass<Service$3, "@domainkit/ProviderAuthorizationStore", Interface$3>;
|
|
160
219
|
declare class Service$3 extends Service_base$3 {}
|
|
161
220
|
interface AsyncInterface$3 {
|
|
162
|
-
readonly delete: (
|
|
163
|
-
readonly
|
|
164
|
-
readonly
|
|
221
|
+
readonly delete: (authorizationId: string) => Promise<void>;
|
|
222
|
+
readonly findByProviderAccount: (providerId: string, accountId: string) => Promise<ProviderAuthorization | null>;
|
|
223
|
+
readonly get: (authorizationId: string) => Promise<ProviderAuthorization | null>;
|
|
224
|
+
readonly put: (authorization: ProviderAuthorization) => Promise<void>;
|
|
165
225
|
}
|
|
166
226
|
declare const toAsync$3: (store: Interface$3) => AsyncInterface$3;
|
|
167
227
|
declare const layerFromAsync$3: (store: AsyncInterface$3) => Layer.Layer<Service$3>;
|
|
@@ -2323,5 +2383,5 @@ interface AsyncInterface {
|
|
|
2323
2383
|
declare const layerFromAsync: (resolver: AsyncInterface) => Layer.Layer<Service>;
|
|
2324
2384
|
declare const toAsync: (resolver: Interface) => AsyncInterface;
|
|
2325
2385
|
//#endregion
|
|
2326
|
-
export { Service$3 as A,
|
|
2327
|
-
//# sourceMappingURL=resolver-
|
|
2386
|
+
export { Schema$3 as $, Service$3 as A, Error$1 as B, types_d_exports as C, oauth_state_d_exports as D, Service$2 as E, credential_d_exports as F, OAuthContinuation as G, AuthorizationError as H, AsyncInterface$5 as I, assertGrant as J, Schema$2 as K, Interface$5 as L, AsyncInterface$4 as M, Interface$4 as N, AsyncInterface$3 as O, Service$4 as P, ProviderAuthorization as Q, Service$5 as R, encodeReceipt as S, Interface$2 as T, Connection as U, error_d_exports as V, Grant as W, encode$1 as X, connection_d_exports$1 as Y, Capability as Z, Operation as _, Interface as a, Schema$1 as b, Service as c, Interface$1 as d, authorization_d_exports$1 as et, Service$1 as f, DnsPlan as g, Authorization as h, Error as i, authorization_d_exports as j, Interface$3 as k, resolver_d_exports as l, ApplyReceipt as m, AsyncInterface as n, Query as o, receipt_d_exports as p, StoredCredential as q, AsyncResolution as r, Resolution as s, Answer as t, encode$2 as tt, AsyncInterface$1 as u, PlanAuthorization as v, AsyncInterface$2 as w, encode as x, Receipt as y, connection_d_exports as z };
|
|
2387
|
+
//# sourceMappingURL=resolver-BHPsADzE.d.mts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { p as Type, w as Schema$1 } from "./dns-record-
|
|
2
|
+
import { p as Type, w as Schema$1 } from "./dns-record-C_KwGPLf.mjs";
|
|
3
3
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
4
4
|
//#region src/stores/error.ts
|
|
5
5
|
var error_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -21,20 +21,35 @@ function fromCause(operation, cause) {
|
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/stores/connection.ts
|
|
23
23
|
var connection_exports = /* @__PURE__ */ __exportAll({
|
|
24
|
-
Service: () => Service$
|
|
25
|
-
layerFromAsync: () => layerFromAsync$
|
|
26
|
-
toAsync: () => toAsync$
|
|
24
|
+
Service: () => Service$4,
|
|
25
|
+
layerFromAsync: () => layerFromAsync$4,
|
|
26
|
+
toAsync: () => toAsync$4
|
|
27
27
|
});
|
|
28
|
-
var Service$
|
|
29
|
-
const toAsync$
|
|
28
|
+
var Service$4 = class extends Context.Service()("@domainkit/ConnectionStore") {};
|
|
29
|
+
const toAsync$4 = (store) => ({
|
|
30
|
+
delete: (connectionId) => Effect.runPromise(store.delete(connectionId)),
|
|
31
|
+
find: (ownerId, authorizationId) => Effect.runPromise(store.find(ownerId, authorizationId)),
|
|
30
32
|
get: (connectionId) => Effect.runPromise(store.get(connectionId)),
|
|
33
|
+
listByAuthorizationId: (authorizationId) => Effect.runPromise(store.listByAuthorizationId(authorizationId)),
|
|
31
34
|
put: (connection) => Effect.runPromise(store.put(connection))
|
|
32
35
|
});
|
|
33
|
-
const layerFromAsync$
|
|
36
|
+
const layerFromAsync$4 = (store) => Layer.succeed(Service$4, {
|
|
37
|
+
delete: Effect.fn("ConnectionStore.delete")((connectionId) => Effect.tryPromise({
|
|
38
|
+
try: () => store.delete(connectionId),
|
|
39
|
+
catch: (cause) => fromCause("connection.delete", cause)
|
|
40
|
+
})),
|
|
41
|
+
find: Effect.fn("ConnectionStore.find")((ownerId, authorizationId) => Effect.tryPromise({
|
|
42
|
+
try: () => store.find(ownerId, authorizationId),
|
|
43
|
+
catch: (cause) => fromCause("connection.find", cause)
|
|
44
|
+
})),
|
|
34
45
|
get: Effect.fn("ConnectionStore.get")((connectionId) => Effect.tryPromise({
|
|
35
46
|
try: () => store.get(connectionId),
|
|
36
47
|
catch: (cause) => fromCause("connection.get", cause)
|
|
37
48
|
})),
|
|
49
|
+
listByAuthorizationId: Effect.fn("ConnectionStore.listByAuthorizationId")((authorizationId) => Effect.tryPromise({
|
|
50
|
+
try: () => store.listByAuthorizationId(authorizationId),
|
|
51
|
+
catch: (cause) => fromCause("connection.listByAuthorizationId", cause)
|
|
52
|
+
})),
|
|
38
53
|
put: Effect.fn("ConnectionStore.put")((connection) => Effect.tryPromise({
|
|
39
54
|
try: () => store.put(connection),
|
|
40
55
|
catch: (cause) => fromCause("connection.put", cause)
|
|
@@ -43,28 +58,60 @@ const layerFromAsync$3 = (store) => Layer.succeed(Service$3, {
|
|
|
43
58
|
//#endregion
|
|
44
59
|
//#region src/stores/credential.ts
|
|
45
60
|
var credential_exports = /* @__PURE__ */ __exportAll({
|
|
61
|
+
Service: () => Service$3,
|
|
62
|
+
layerFromAsync: () => layerFromAsync$3,
|
|
63
|
+
toAsync: () => toAsync$3
|
|
64
|
+
});
|
|
65
|
+
var Service$3 = class extends Context.Service()("@domainkit/CredentialStore") {};
|
|
66
|
+
const toAsync$3 = (store) => ({
|
|
67
|
+
delete: (authorizationId) => Effect.runPromise(store.delete(authorizationId)),
|
|
68
|
+
get: (authorizationId) => Effect.runPromise(store.get(authorizationId)),
|
|
69
|
+
put: (authorizationId, credential) => Effect.runPromise(store.put(authorizationId, credential))
|
|
70
|
+
});
|
|
71
|
+
const layerFromAsync$3 = (store) => Layer.succeed(Service$3, {
|
|
72
|
+
delete: Effect.fn("CredentialStore.delete")((authorizationId) => Effect.tryPromise({
|
|
73
|
+
try: () => store.delete(authorizationId),
|
|
74
|
+
catch: (cause) => fromCause("credential.delete", cause)
|
|
75
|
+
})),
|
|
76
|
+
get: Effect.fn("CredentialStore.get")((authorizationId) => Effect.tryPromise({
|
|
77
|
+
try: () => store.get(authorizationId),
|
|
78
|
+
catch: (cause) => fromCause("credential.get", cause)
|
|
79
|
+
})),
|
|
80
|
+
put: Effect.fn("CredentialStore.put")((authorizationId, credential) => Effect.tryPromise({
|
|
81
|
+
try: () => store.put(authorizationId, credential),
|
|
82
|
+
catch: (cause) => fromCause("credential.put", cause)
|
|
83
|
+
}))
|
|
84
|
+
});
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/stores/authorization.ts
|
|
87
|
+
var authorization_exports = /* @__PURE__ */ __exportAll({
|
|
46
88
|
Service: () => Service$2,
|
|
47
89
|
layerFromAsync: () => layerFromAsync$2,
|
|
48
90
|
toAsync: () => toAsync$2
|
|
49
91
|
});
|
|
50
|
-
var Service$2 = class extends Context.Service()("@domainkit/
|
|
92
|
+
var Service$2 = class extends Context.Service()("@domainkit/ProviderAuthorizationStore") {};
|
|
51
93
|
const toAsync$2 = (store) => ({
|
|
52
|
-
delete: (
|
|
53
|
-
|
|
54
|
-
|
|
94
|
+
delete: (authorizationId) => Effect.runPromise(store.delete(authorizationId)),
|
|
95
|
+
findByProviderAccount: (providerId, accountId) => Effect.runPromise(store.findByProviderAccount(providerId, accountId)),
|
|
96
|
+
get: (authorizationId) => Effect.runPromise(store.get(authorizationId)),
|
|
97
|
+
put: (authorization) => Effect.runPromise(store.put(authorization))
|
|
55
98
|
});
|
|
56
99
|
const layerFromAsync$2 = (store) => Layer.succeed(Service$2, {
|
|
57
|
-
delete: Effect.fn("
|
|
58
|
-
try: () => store.delete(
|
|
59
|
-
catch: (cause) => fromCause("
|
|
100
|
+
delete: Effect.fn("ProviderAuthorizationStore.delete")((authorizationId) => Effect.tryPromise({
|
|
101
|
+
try: () => store.delete(authorizationId),
|
|
102
|
+
catch: (cause) => fromCause("providerAuthorization.delete", cause)
|
|
60
103
|
})),
|
|
61
|
-
|
|
62
|
-
try: () => store.
|
|
63
|
-
catch: (cause) => fromCause("
|
|
104
|
+
findByProviderAccount: Effect.fn("ProviderAuthorizationStore.findByProviderAccount")((providerId, accountId) => Effect.tryPromise({
|
|
105
|
+
try: () => store.findByProviderAccount(providerId, accountId),
|
|
106
|
+
catch: (cause) => fromCause("providerAuthorization.findByProviderAccount", cause)
|
|
64
107
|
})),
|
|
65
|
-
|
|
66
|
-
try: () => store.
|
|
67
|
-
catch: (cause) => fromCause("
|
|
108
|
+
get: Effect.fn("ProviderAuthorizationStore.get")((authorizationId) => Effect.tryPromise({
|
|
109
|
+
try: () => store.get(authorizationId),
|
|
110
|
+
catch: (cause) => fromCause("providerAuthorization.get", cause)
|
|
111
|
+
})),
|
|
112
|
+
put: Effect.fn("ProviderAuthorizationStore.put")((authorization) => Effect.tryPromise({
|
|
113
|
+
try: () => store.put(authorization),
|
|
114
|
+
catch: (cause) => fromCause("providerAuthorization.put", cause)
|
|
68
115
|
}))
|
|
69
116
|
});
|
|
70
117
|
//#endregion
|
|
@@ -148,6 +195,6 @@ const toAsync = (resolver) => ({ resolve: (query) => Effect.runPromise(resolver.
|
|
|
148
195
|
onSuccess: (resolution) => resolution
|
|
149
196
|
}))) });
|
|
150
197
|
//#endregion
|
|
151
|
-
export { toAsync$3 as _, toAsync as a, oauth_state_exports as c,
|
|
198
|
+
export { fromCause as C, error_exports as S, toAsync$3 as _, toAsync as a, layerFromAsync$4 as b, oauth_state_exports as c, authorization_exports as d, layerFromAsync$2 as f, layerFromAsync$3 as g, credential_exports as h, resolver_exports as i, toAsync$1 as l, Service$3 as m, Service as n, Service$1 as o, toAsync$2 as p, layerFromAsync as r, layerFromAsync$1 as s, Error as t, Service$2 as u, Service$4 as v, toAsync$4 as x, connection_exports as y };
|
|
152
199
|
|
|
153
|
-
//# sourceMappingURL=resolver-
|
|
200
|
+
//# sourceMappingURL=resolver-tEXpKxmH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver-tEXpKxmH.mjs","names":["Error","Service","toAsync","layerFromAsync","Service","toAsync","layerFromAsync","Service","toAsync","layerFromAsync","Service","toAsync","layerFromAsync","DomainName.Schema","DnsRecord.Type"],"sources":["../src/stores/error.ts","../src/stores/connection.ts","../src/stores/credential.ts","../src/stores/authorization.ts","../src/stores/oauth-state.ts","../src/verification/resolver.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nexport class Error extends Schema.TaggedError<Error>()(\"StorageError\", {\n cause: Schema.optionalKey(Schema.Unknown),\n message: Schema.String,\n operation: Schema.String,\n}) {}\n\nexport function fromCause(operation: string, cause: unknown): Error {\n return cause instanceof Error\n ? cause\n : new Error({\n cause,\n message: cause instanceof globalThis.Error ? cause.message : String(cause),\n operation,\n });\n}\n","import { Context, Effect, Layer } from \"effect\";\n\nimport type { Connection } from \"../auth/connection.ts\";\nimport { type Error, fromCause } from \"./error.ts\";\n\nexport interface Interface {\n readonly delete: (connectionId: string) => Effect.Effect<void, Error>;\n readonly find: (\n ownerId: string,\n authorizationId: string,\n ) => Effect.Effect<Connection | null, Error>;\n readonly get: (connectionId: string) => Effect.Effect<Connection | null, Error>;\n readonly listByAuthorizationId: (\n authorizationId: string,\n ) => Effect.Effect<ReadonlyArray<Connection>, Error>;\n readonly put: (connection: Connection) => Effect.Effect<void, Error>;\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@domainkit/ConnectionStore\") {}\n\nexport interface AsyncInterface {\n readonly delete: (connectionId: string) => Promise<void>;\n readonly find: (ownerId: string, authorizationId: string) => Promise<Connection | null>;\n readonly get: (connectionId: string) => Promise<Connection | null>;\n readonly listByAuthorizationId: (authorizationId: string) => Promise<ReadonlyArray<Connection>>;\n readonly put: (connection: Connection) => Promise<void>;\n}\n\nexport const toAsync = (store: Interface): AsyncInterface => ({\n delete: (connectionId) => Effect.runPromise(store.delete(connectionId)),\n find: (ownerId, authorizationId) => Effect.runPromise(store.find(ownerId, authorizationId)),\n get: (connectionId) => Effect.runPromise(store.get(connectionId)),\n listByAuthorizationId: (authorizationId) =>\n Effect.runPromise(store.listByAuthorizationId(authorizationId)),\n put: (connection) => Effect.runPromise(store.put(connection)),\n});\n\nexport const layerFromAsync = (store: AsyncInterface): Layer.Layer<Service> =>\n Layer.succeed(Service, {\n delete: Effect.fn(\"ConnectionStore.delete\")((connectionId) =>\n Effect.tryPromise({\n try: () => store.delete(connectionId),\n catch: (cause) => fromCause(\"connection.delete\", cause),\n }),\n ),\n find: Effect.fn(\"ConnectionStore.find\")((ownerId, authorizationId) =>\n Effect.tryPromise({\n try: () => store.find(ownerId, authorizationId),\n catch: (cause) => fromCause(\"connection.find\", cause),\n }),\n ),\n get: Effect.fn(\"ConnectionStore.get\")((connectionId) =>\n Effect.tryPromise({\n try: () => store.get(connectionId),\n catch: (cause) => fromCause(\"connection.get\", cause),\n }),\n ),\n listByAuthorizationId: Effect.fn(\"ConnectionStore.listByAuthorizationId\")((authorizationId) =>\n Effect.tryPromise({\n try: () => store.listByAuthorizationId(authorizationId),\n catch: (cause) => fromCause(\"connection.listByAuthorizationId\", cause),\n }),\n ),\n put: Effect.fn(\"ConnectionStore.put\")((connection) =>\n Effect.tryPromise({\n try: () => store.put(connection),\n catch: (cause) => fromCause(\"connection.put\", cause),\n }),\n ),\n });\n","import { Context, Effect, Layer } from \"effect\";\n\nimport type { StoredCredential } from \"../auth/connection.ts\";\nimport { type Error, fromCause } from \"./error.ts\";\n\nexport interface Interface {\n readonly delete: (authorizationId: string) => Effect.Effect<void, Error>;\n readonly get: (authorizationId: string) => Effect.Effect<StoredCredential | null, Error>;\n readonly put: (\n authorizationId: string,\n credential: StoredCredential,\n ) => Effect.Effect<void, Error>;\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@domainkit/CredentialStore\") {}\n\nexport interface AsyncInterface {\n readonly delete: (authorizationId: string) => Promise<void>;\n readonly get: (authorizationId: string) => Promise<StoredCredential | null>;\n readonly put: (authorizationId: string, credential: StoredCredential) => Promise<void>;\n}\n\nexport const toAsync = (store: Interface): AsyncInterface => ({\n delete: (authorizationId) => Effect.runPromise(store.delete(authorizationId)),\n get: (authorizationId) => Effect.runPromise(store.get(authorizationId)),\n put: (authorizationId, credential) => Effect.runPromise(store.put(authorizationId, credential)),\n});\n\nexport const layerFromAsync = (store: AsyncInterface): Layer.Layer<Service> =>\n Layer.succeed(Service, {\n delete: Effect.fn(\"CredentialStore.delete\")((authorizationId) =>\n Effect.tryPromise({\n try: () => store.delete(authorizationId),\n catch: (cause) => fromCause(\"credential.delete\", cause),\n }),\n ),\n get: Effect.fn(\"CredentialStore.get\")((authorizationId) =>\n Effect.tryPromise({\n try: () => store.get(authorizationId),\n catch: (cause) => fromCause(\"credential.get\", cause),\n }),\n ),\n put: Effect.fn(\"CredentialStore.put\")((authorizationId, credential) =>\n Effect.tryPromise({\n try: () => store.put(authorizationId, credential),\n catch: (cause) => fromCause(\"credential.put\", cause),\n }),\n ),\n });\n","import { Context, Effect, Layer } from \"effect\";\n\nimport type { ProviderAuthorization } from \"../auth/authorization.ts\";\nimport { type Error, fromCause } from \"./error.ts\";\n\nexport interface Interface {\n readonly delete: (authorizationId: string) => Effect.Effect<void, Error>;\n readonly findByProviderAccount: (\n providerId: string,\n accountId: string,\n ) => Effect.Effect<ProviderAuthorization | null, Error>;\n readonly get: (authorizationId: string) => Effect.Effect<ProviderAuthorization | null, Error>;\n readonly put: (authorization: ProviderAuthorization) => Effect.Effect<void, Error>;\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\n \"@domainkit/ProviderAuthorizationStore\",\n) {}\n\nexport interface AsyncInterface {\n readonly delete: (authorizationId: string) => Promise<void>;\n readonly findByProviderAccount: (\n providerId: string,\n accountId: string,\n ) => Promise<ProviderAuthorization | null>;\n readonly get: (authorizationId: string) => Promise<ProviderAuthorization | null>;\n readonly put: (authorization: ProviderAuthorization) => Promise<void>;\n}\n\nexport const toAsync = (store: Interface): AsyncInterface => ({\n delete: (authorizationId) => Effect.runPromise(store.delete(authorizationId)),\n findByProviderAccount: (providerId, accountId) =>\n Effect.runPromise(store.findByProviderAccount(providerId, accountId)),\n get: (authorizationId) => Effect.runPromise(store.get(authorizationId)),\n put: (authorization) => Effect.runPromise(store.put(authorization)),\n});\n\nexport const layerFromAsync = (store: AsyncInterface): Layer.Layer<Service> =>\n Layer.succeed(Service, {\n delete: Effect.fn(\"ProviderAuthorizationStore.delete\")((authorizationId) =>\n Effect.tryPromise({\n try: () => store.delete(authorizationId),\n catch: (cause) => fromCause(\"providerAuthorization.delete\", cause),\n }),\n ),\n findByProviderAccount: Effect.fn(\"ProviderAuthorizationStore.findByProviderAccount\")(\n (providerId, accountId) =>\n Effect.tryPromise({\n try: () => store.findByProviderAccount(providerId, accountId),\n catch: (cause) => fromCause(\"providerAuthorization.findByProviderAccount\", cause),\n }),\n ),\n get: Effect.fn(\"ProviderAuthorizationStore.get\")((authorizationId) =>\n Effect.tryPromise({\n try: () => store.get(authorizationId),\n catch: (cause) => fromCause(\"providerAuthorization.get\", cause),\n }),\n ),\n put: Effect.fn(\"ProviderAuthorizationStore.put\")((authorization) =>\n Effect.tryPromise({\n try: () => store.put(authorization),\n catch: (cause) => fromCause(\"providerAuthorization.put\", cause),\n }),\n ),\n });\n","import { Context, Effect, Layer } from \"effect\";\n\nimport type { OAuthContinuation } from \"../auth/connection.ts\";\nimport { type Error, fromCause } from \"./error.ts\";\n\nexport interface Interface {\n readonly consume: (\n stateHash: string,\n now: Date,\n ) => Effect.Effect<OAuthContinuation | null, Error>;\n readonly put: (continuation: OAuthContinuation) => Effect.Effect<void, Error>;\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@domainkit/OAuthStateStore\") {}\n\nexport interface AsyncInterface {\n readonly consume: (stateHash: string, now: Date) => Promise<OAuthContinuation | null>;\n readonly put: (continuation: OAuthContinuation) => Promise<void>;\n}\n\nexport const toAsync = (store: Interface): AsyncInterface => ({\n consume: (stateHash, now) => Effect.runPromise(store.consume(stateHash, now)),\n put: (continuation) => Effect.runPromise(store.put(continuation)),\n});\n\nexport const layerFromAsync = (store: AsyncInterface): Layer.Layer<Service> =>\n Layer.succeed(Service, {\n consume: Effect.fn(\"OAuthStateStore.consume\")((stateHash, now) =>\n Effect.tryPromise({\n try: () => store.consume(stateHash, now),\n catch: (cause) => fromCause(\"oauthState.consume\", cause),\n }),\n ),\n put: Effect.fn(\"OAuthStateStore.put\")((continuation) =>\n Effect.tryPromise({\n try: () => store.put(continuation),\n catch: (cause) => fromCause(\"oauthState.put\", cause),\n }),\n ),\n });\n","import { Context, Effect, Layer, Schema } from \"effect\";\n\nimport * as DomainName from \"../domain/domain-name.ts\";\nimport * as DnsRecord from \"../domain/dns-record.ts\";\n\nexport interface Query {\n readonly name: DomainName.DomainName;\n readonly signal?: AbortSignal;\n readonly type: DnsRecord.Type;\n}\n\nexport const Answer = Schema.Struct({\n data: Schema.String,\n name: DomainName.Schema,\n ttl: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n type: DnsRecord.Type,\n});\nexport interface Answer extends Schema.Schema.Type<typeof Answer> {}\n\nexport const Resolution = Schema.TaggedUnion({\n answer: { answers: Schema.Array(Answer) },\n nodata: {},\n});\nexport type Resolution = typeof Resolution.Type;\n\nexport class Error extends Schema.TaggedError<Error>()(\"ResolverError\", {\n cause: Schema.optionalKey(Schema.Unknown),\n message: Schema.String,\n reason: Schema.Literals([\"response\", \"timeout\", \"transport\"]),\n}) {}\n\nexport interface Interface {\n readonly resolve: (query: Query) => Effect.Effect<Resolution, Error>;\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@domainkit/DnsResolver\") {}\n\nexport type AsyncResolution =\n | Resolution\n | { readonly _tag: \"timeout\" }\n | { readonly _tag: \"failure\"; readonly message: string };\n\nexport interface AsyncInterface {\n readonly resolve: (query: Query) => Promise<AsyncResolution>;\n}\n\nexport const layerFromAsync = (resolver: AsyncInterface): Layer.Layer<Service> =>\n Layer.succeed(Service, {\n resolve: Effect.fn(\"DnsResolver.resolve\")((query) =>\n Effect.tryPromise({\n try: () => resolver.resolve(query),\n catch: (cause) =>\n new Error({\n cause,\n message: cause instanceof globalThis.Error ? cause.message : String(cause),\n reason: \"transport\",\n }),\n }).pipe(\n Effect.flatMap((resolution) => {\n switch (resolution._tag) {\n case \"answer\":\n case \"nodata\":\n return Effect.succeed(resolution);\n case \"timeout\":\n return Effect.fail(new Error({ message: \"DNS query timed out\", reason: \"timeout\" }));\n case \"failure\":\n return Effect.fail(new Error({ message: resolution.message, reason: \"transport\" }));\n }\n }),\n ),\n ),\n });\n\nexport const toAsync = (resolver: Interface): AsyncInterface => ({\n resolve: (query) =>\n Effect.runPromise(\n resolver.resolve(query).pipe(\n Effect.match({\n onFailure: (failure): AsyncResolution =>\n failure.reason === \"timeout\"\n ? { _tag: \"timeout\" }\n : { _tag: \"failure\", message: failure.message },\n onSuccess: (resolution) => resolution,\n }),\n ),\n ),\n});\n"],"mappings":";;;;;;;;AAEA,IAAaA,UAAb,cAA2B,OAAO,YAAmB,CAAC,CAAC,gBAAgB;CACrE,OAAO,OAAO,YAAY,OAAO,OAAO;CACxC,SAAS,OAAO;CAChB,WAAW,OAAO;AACpB,CAAC,CAAC,CAAC,CAAC;AAEJ,SAAgB,UAAU,WAAmB,OAAuB;CAClE,OAAO,iBAAiBA,UACpB,QACA,IAAIA,QAAM;EACR;EACA,SAAS,iBAAiB,W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