domainkit 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +87 -83
  2. package/dist/{client-BnD7QLRF.mjs → auth-6-KRy1gN.mjs} +235 -131
  3. package/dist/auth-6-KRy1gN.mjs.map +1 -0
  4. package/dist/{auth-B0owkrpk.mjs → auth-B4jq3yk3.mjs} +212 -20
  5. package/dist/auth-B4jq3yk3.mjs.map +1 -0
  6. package/dist/authorization-CQSKKMrW.mjs +255 -0
  7. package/dist/authorization-CQSKKMrW.mjs.map +1 -0
  8. package/dist/canonical-json-CpvqGMcr.mjs +57 -0
  9. package/dist/canonical-json-CpvqGMcr.mjs.map +1 -0
  10. package/dist/{cloudflare-D0-J2MfP.mjs → cloudflare-Bg_p-M2c.mjs} +26 -3
  11. package/dist/cloudflare-Bg_p-M2c.mjs.map +1 -0
  12. package/dist/cloudflare-FDl5q7Dm.d.mts +32 -0
  13. package/dist/cloudflare.d.mts +3 -3
  14. package/dist/cloudflare.mjs +2 -2
  15. package/dist/connection-BXoSrhZs.mjs +58 -0
  16. package/dist/connection-BXoSrhZs.mjs.map +1 -0
  17. package/dist/connection-CEqadXSm.d.mts +182 -0
  18. package/dist/connection-X3rZhrBZ.mjs +186 -0
  19. package/dist/connection-X3rZhrBZ.mjs.map +1 -0
  20. package/dist/connection-api-DftK7eHo.d.mts +7 -0
  21. package/dist/{dns-record-C_KwGPLf.mjs → dns-record-BLeqo56C.mjs} +23 -3
  22. package/dist/dns-record-BLeqo56C.mjs.map +1 -0
  23. package/dist/effect-cloudflare.d.mts +2 -2
  24. package/dist/effect-cloudflare.mjs +2 -2
  25. package/dist/effect-vercel.d.mts +2 -2
  26. package/dist/effect-vercel.mjs +2 -2
  27. package/dist/effect.d.mts +9 -46
  28. package/dist/effect.mjs +29 -7
  29. package/dist/effect.mjs.map +1 -1
  30. package/dist/{index-D2howbNz.d.mts → index-B1opsgls.d.mts} +53 -6
  31. package/dist/{index-CEzk2gbZ.d.mts → index-Ewc__bQu.d.mts} +58 -7
  32. package/dist/index.d.mts +169 -113
  33. package/dist/index.mjs +201 -139
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/{resolver-BHPsADzE.d.mts → resolver-BbVzTbCX.d.mts} +630 -273
  36. package/dist/resolver-CxE-VDw4.mjs +598 -0
  37. package/dist/resolver-CxE-VDw4.mjs.map +1 -0
  38. package/dist/testing.d.mts +53 -44
  39. package/dist/testing.mjs +379 -107
  40. package/dist/testing.mjs.map +1 -1
  41. package/dist/{vercel-DD89DCqH.mjs → vercel-BIFpZRPu.mjs} +23 -3
  42. package/dist/vercel-BIFpZRPu.mjs.map +1 -0
  43. package/dist/vercel-DgJaUX9D.d.mts +31 -0
  44. package/dist/vercel.d.mts +3 -3
  45. package/dist/vercel.mjs +2 -2
  46. package/dist/verify-7_EbKbFM.d.mts +805 -0
  47. package/dist/verify-Q5RYpnuw.mjs +642 -0
  48. package/dist/verify-Q5RYpnuw.mjs.map +1 -0
  49. package/dist/zone-discovery-BA5I24vu.d.mts +1390 -0
  50. package/dist/zones-DKHTpX9C.mjs +19 -0
  51. package/dist/zones-DKHTpX9C.mjs.map +1 -0
  52. package/package.json +1 -1
  53. package/dist/auth-B0owkrpk.mjs.map +0 -1
  54. package/dist/client-BnD7QLRF.mjs.map +0 -1
  55. package/dist/cloudflare-CprjjXfm.d.mts +0 -23
  56. package/dist/cloudflare-D0-J2MfP.mjs.map +0 -1
  57. package/dist/dns-record-C_KwGPLf.mjs.map +0 -1
  58. package/dist/manifest-CP85ePFn.d.mts +0 -583
  59. package/dist/receipt-CGSnfZQ6.mjs +0 -28
  60. package/dist/receipt-CGSnfZQ6.mjs.map +0 -1
  61. package/dist/resolver-tEXpKxmH.mjs +0 -200
  62. package/dist/resolver-tEXpKxmH.mjs.map +0 -1
  63. package/dist/vercel-D-E2aqb1.d.mts +0 -22
  64. package/dist/vercel-DD89DCqH.mjs.map +0 -1
  65. package/dist/verify-B80xCBh2.d.mts +0 -1407
  66. package/dist/verify-BXOvXE20.mjs +0 -1388
  67. package/dist/verify-BXOvXE20.mjs.map +0 -1
@@ -1,200 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { p as Type, w as Schema$1 } from "./dns-record-C_KwGPLf.mjs";
3
- import { Context, Effect, Layer, Schema } from "effect";
4
- //#region src/stores/error.ts
5
- var error_exports = /* @__PURE__ */ __exportAll({
6
- Error: () => Error$1,
7
- fromCause: () => fromCause
8
- });
9
- var Error$1 = class extends Schema.TaggedError()("StorageError", {
10
- cause: Schema.optionalKey(Schema.Unknown),
11
- message: Schema.String,
12
- operation: Schema.String
13
- }) {};
14
- function fromCause(operation, cause) {
15
- return cause instanceof Error$1 ? cause : new Error$1({
16
- cause,
17
- message: cause instanceof globalThis.Error ? cause.message : String(cause),
18
- operation
19
- });
20
- }
21
- //#endregion
22
- //#region src/stores/connection.ts
23
- var connection_exports = /* @__PURE__ */ __exportAll({
24
- Service: () => Service$4,
25
- layerFromAsync: () => layerFromAsync$4,
26
- toAsync: () => toAsync$4
27
- });
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)),
32
- get: (connectionId) => Effect.runPromise(store.get(connectionId)),
33
- listByAuthorizationId: (authorizationId) => Effect.runPromise(store.listByAuthorizationId(authorizationId)),
34
- put: (connection) => Effect.runPromise(store.put(connection))
35
- });
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
- })),
45
- get: Effect.fn("ConnectionStore.get")((connectionId) => Effect.tryPromise({
46
- try: () => store.get(connectionId),
47
- catch: (cause) => fromCause("connection.get", cause)
48
- })),
49
- listByAuthorizationId: Effect.fn("ConnectionStore.listByAuthorizationId")((authorizationId) => Effect.tryPromise({
50
- try: () => store.listByAuthorizationId(authorizationId),
51
- catch: (cause) => fromCause("connection.listByAuthorizationId", cause)
52
- })),
53
- put: Effect.fn("ConnectionStore.put")((connection) => Effect.tryPromise({
54
- try: () => store.put(connection),
55
- catch: (cause) => fromCause("connection.put", cause)
56
- }))
57
- });
58
- //#endregion
59
- //#region src/stores/credential.ts
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({
88
- Service: () => Service$2,
89
- layerFromAsync: () => layerFromAsync$2,
90
- toAsync: () => toAsync$2
91
- });
92
- var Service$2 = class extends Context.Service()("@domainkit/ProviderAuthorizationStore") {};
93
- const toAsync$2 = (store) => ({
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))
98
- });
99
- const layerFromAsync$2 = (store) => Layer.succeed(Service$2, {
100
- delete: Effect.fn("ProviderAuthorizationStore.delete")((authorizationId) => Effect.tryPromise({
101
- try: () => store.delete(authorizationId),
102
- catch: (cause) => fromCause("providerAuthorization.delete", cause)
103
- })),
104
- findByProviderAccount: Effect.fn("ProviderAuthorizationStore.findByProviderAccount")((providerId, accountId) => Effect.tryPromise({
105
- try: () => store.findByProviderAccount(providerId, accountId),
106
- catch: (cause) => fromCause("providerAuthorization.findByProviderAccount", cause)
107
- })),
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)
115
- }))
116
- });
117
- //#endregion
118
- //#region src/stores/oauth-state.ts
119
- var oauth_state_exports = /* @__PURE__ */ __exportAll({
120
- Service: () => Service$1,
121
- layerFromAsync: () => layerFromAsync$1,
122
- toAsync: () => toAsync$1
123
- });
124
- var Service$1 = class extends Context.Service()("@domainkit/OAuthStateStore") {};
125
- const toAsync$1 = (store) => ({
126
- consume: (stateHash, now) => Effect.runPromise(store.consume(stateHash, now)),
127
- put: (continuation) => Effect.runPromise(store.put(continuation))
128
- });
129
- const layerFromAsync$1 = (store) => Layer.succeed(Service$1, {
130
- consume: Effect.fn("OAuthStateStore.consume")((stateHash, now) => Effect.tryPromise({
131
- try: () => store.consume(stateHash, now),
132
- catch: (cause) => fromCause("oauthState.consume", cause)
133
- })),
134
- put: Effect.fn("OAuthStateStore.put")((continuation) => Effect.tryPromise({
135
- try: () => store.put(continuation),
136
- catch: (cause) => fromCause("oauthState.put", cause)
137
- }))
138
- });
139
- //#endregion
140
- //#region src/verification/resolver.ts
141
- var resolver_exports = /* @__PURE__ */ __exportAll({
142
- Answer: () => Answer,
143
- Error: () => Error,
144
- Resolution: () => Resolution,
145
- Service: () => Service,
146
- layerFromAsync: () => layerFromAsync,
147
- toAsync: () => toAsync
148
- });
149
- const Answer = Schema.Struct({
150
- data: Schema.String,
151
- name: Schema$1,
152
- ttl: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
153
- type: Type
154
- });
155
- const Resolution = Schema.TaggedUnion({
156
- answer: { answers: Schema.Array(Answer) },
157
- nodata: {}
158
- });
159
- var Error = class extends Schema.TaggedError()("ResolverError", {
160
- cause: Schema.optionalKey(Schema.Unknown),
161
- message: Schema.String,
162
- reason: Schema.Literals([
163
- "response",
164
- "timeout",
165
- "transport"
166
- ])
167
- }) {};
168
- var Service = class extends Context.Service()("@domainkit/DnsResolver") {};
169
- const layerFromAsync = (resolver) => Layer.succeed(Service, { resolve: Effect.fn("DnsResolver.resolve")((query) => Effect.tryPromise({
170
- try: () => resolver.resolve(query),
171
- catch: (cause) => new Error({
172
- cause,
173
- message: cause instanceof globalThis.Error ? cause.message : String(cause),
174
- reason: "transport"
175
- })
176
- }).pipe(Effect.flatMap((resolution) => {
177
- switch (resolution._tag) {
178
- case "answer":
179
- case "nodata": return Effect.succeed(resolution);
180
- case "timeout": return Effect.fail(new Error({
181
- message: "DNS query timed out",
182
- reason: "timeout"
183
- }));
184
- case "failure": return Effect.fail(new Error({
185
- message: resolution.message,
186
- reason: "transport"
187
- }));
188
- }
189
- }))) });
190
- const toAsync = (resolver) => ({ resolve: (query) => Effect.runPromise(resolver.resolve(query).pipe(Effect.match({
191
- onFailure: (failure) => failure.reason === "timeout" ? { _tag: "timeout" } : {
192
- _tag: "failure",
193
- message: failure.message
194
- },
195
- onSuccess: (resolution) => resolution
196
- }))) });
197
- //#endregion
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 };
199
-
200
- //# sourceMappingURL=resolver-tEXpKxmH.mjs.map
@@ -1 +0,0 @@
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,OAAu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MAAM;GAAE,SAAS,WAAW;GAAS,QAAQ;EAAY,CAAC,CAAC;CACtF;AACF,CAAC,CACH,CACF,EACF,CAAC;AAEH,MAAa,WAAW,cAAyC,EAC/D,UAAU,UACR,OAAO,WACL,SAAS,QAAQ,KAAK,CAAC,CAAC,KACtB,OAAO,MAAM;CACX,YAAY,YACV,QAAQ,WAAW,YACf,EAAE,MAAM,UAAU,IAClB;EAAE,MAAM;EAAW,SAAS,QAAQ;CAAQ;CAClD,YAAY,eAAe;AAC7B,CAAC,CACH,CACF,EACJ"}
@@ -1,22 +0,0 @@
1
- import { l as TokenValidation, p as AsyncInterface } from "./manifest-CP85ePFn.mjs";
2
- import { c as tokenMethod$1, d as Fetch, h as Zone, i as IntegrationMethodOptions, l as Account, m as Options, n as ExchangeCodeOptions, o as integrationMethod$1, p as ListZonesInput, r as IntegrationCredential, s as manifest$1, u as AccountContext } from "./index-CEzk2gbZ.mjs";
3
- declare namespace vercel_auth_d_exports {
4
- export { ExchangeCodeOptions, IntegrationCredential, IntegrationMethodOptions, exchangeCode, integrationMethod, manifest, tokenMethod };
5
- }
6
- declare const integrationMethod: typeof integrationMethod$1;
7
- declare const manifest: typeof manifest$1;
8
- declare const tokenMethod: typeof tokenMethod$1;
9
- declare function exchangeCode(options: ExchangeCodeOptions): Promise<IntegrationCredential>;
10
- declare namespace vercel_d_exports {
11
- export { Account, AccountContext, vercel_auth_d_exports as Auth, Fetch, Interface, ListZonesInput, Options, Zone, make };
12
- }
13
- interface Interface extends AsyncInterface {
14
- readonly listAccounts: () => Promise<ReadonlyArray<Account>>;
15
- readonly listZones: (input?: ListZonesInput) => Promise<ReadonlyArray<Zone>>;
16
- readonly validateToken: () => Promise<TokenValidation>;
17
- }
18
- /** Creates a Promise-compatible facade over the Effect-native Vercel client. */
19
- declare function make(options: Options): Interface;
20
- //#endregion
21
- export { vercel_auth_d_exports as i, make as n, vercel_d_exports as r, Interface as t };
22
- //# sourceMappingURL=vercel-D-E2aqb1.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vercel-DD89DCqH.mjs","names":["EffectAuth.integrationMethod","EffectAuth.manifest","EffectAuth.tokenMethod","EffectAuth.exchangeCode","Vercel.make"],"sources":["../src/promise/vercel-auth.ts","../src/promise/vercel.ts"],"sourcesContent":["import { Effect } from \"effect\";\n\nimport * as EffectAuth from \"../providers/vercel/auth.ts\";\n\nexport const integrationMethod = EffectAuth.integrationMethod;\nexport const manifest = EffectAuth.manifest;\nexport const tokenMethod = EffectAuth.tokenMethod;\nexport type {\n ExchangeCodeOptions,\n IntegrationCredential,\n IntegrationMethodOptions,\n} from \"../providers/vercel/auth.ts\";\n\nexport function exchangeCode(\n options: EffectAuth.ExchangeCodeOptions,\n): Promise<EffectAuth.IntegrationCredential> {\n return Effect.runPromise(EffectAuth.exchangeCode(options));\n}\n","import { Effect } from \"effect\";\n\nimport type * as ProviderAuth from \"../auth/manifest.ts\";\nimport type * as DnsProvider from \"../provider/provider.ts\";\nimport * as Vercel from \"../providers/vercel/index.ts\";\n\nexport * as Auth from \"./vercel-auth.ts\";\nexport type {\n Account,\n AccountContext,\n Fetch,\n ListZonesInput,\n Options,\n Zone,\n} from \"../providers/vercel/client.ts\";\n\nexport interface Interface extends DnsProvider.AsyncInterface {\n readonly listAccounts: () => Promise<ReadonlyArray<Vercel.Account>>;\n readonly listZones: (input?: Vercel.Client.ListZonesInput) => Promise<ReadonlyArray<Vercel.Zone>>;\n readonly validateToken: () => Promise<ProviderAuth.TokenValidation>;\n}\n\n/** Creates a Promise-compatible facade over the Effect-native Vercel client. */\nexport function make(options: Vercel.Client.Options): Interface {\n const client = Vercel.make(options);\n return {\n id: client.id,\n createRecord: (zone, record) => Effect.runPromise(client.createRecord(zone, record)),\n deleteRecord: (zone, providerRecordId) =>\n Effect.runPromise(client.deleteRecord(zone, providerRecordId)),\n getRecord: (zone, providerRecordId) =>\n Effect.runPromise(client.getRecord(zone, providerRecordId)),\n listAccounts: () => Effect.runPromise(client.listAccounts()),\n listRecords: (zone) => Effect.runPromise(client.listRecords(zone)),\n listZones: (input) => Effect.runPromise(client.listZones(input)),\n validateToken: () => Effect.runPromise(client.validateToken()),\n };\n}\n"],"mappings":";;;;;;;;;;AAIA,MAAa,oBAAoBA;AACjC,MAAa,WAAWC;AACxB,MAAa,cAAcC;AAO3B,SAAgB,aACd,SAC2C;CAC3C,OAAO,OAAO,WAAWC,eAAwB,OAAO,CAAC;AAC3D;;;;;;;;ACMA,SAAgB,KAAK,SAA2C;CAC9D,MAAM,SAASC,OAAY,OAAO;CAClC,OAAO;EACL,IAAI,OAAO;EACX,eAAe,MAAM,WAAW,OAAO,WAAW,OAAO,aAAa,MAAM,MAAM,CAAC;EACnF,eAAe,MAAM,qBACnB,OAAO,WAAW,OAAO,aAAa,MAAM,gBAAgB,CAAC;EAC/D,YAAY,MAAM,qBAChB,OAAO,WAAW,OAAO,UAAU,MAAM,gBAAgB,CAAC;EAC5D,oBAAoB,OAAO,WAAW,OAAO,aAAa,CAAC;EAC3D,cAAc,SAAS,OAAO,WAAW,OAAO,YAAY,IAAI,CAAC;EACjE,YAAY,UAAU,OAAO,WAAW,OAAO,UAAU,KAAK,CAAC;EAC/D,qBAAqB,OAAO,WAAW,OAAO,cAAc,CAAC;CAC/D;AACF"}