domainkit 0.0.1 → 0.1.0-beta.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/LICENSE +21 -0
- package/README.md +115 -1
- package/dist/auth-Df9BuC25.mjs +460 -0
- package/dist/auth-Df9BuC25.mjs.map +1 -0
- package/dist/client-DvXfJx_E.mjs +534 -0
- package/dist/client-DvXfJx_E.mjs.map +1 -0
- package/dist/cloudflare-C_ixZsJo.mjs +46 -0
- package/dist/cloudflare-C_ixZsJo.mjs.map +1 -0
- package/dist/cloudflare-DClWuAm8.d.mts +23 -0
- package/dist/cloudflare.d.mts +3 -0
- package/dist/cloudflare.mjs +2 -0
- package/dist/dns-record-Dzo4flM5.mjs +259 -0
- package/dist/dns-record-Dzo4flM5.mjs.map +1 -0
- package/dist/effect-cloudflare.d.mts +2 -0
- package/dist/effect-cloudflare.mjs +2 -0
- package/dist/effect-vercel.d.mts +2 -0
- package/dist/effect-vercel.mjs +2 -0
- package/dist/effect.d.mts +63 -0
- package/dist/effect.mjs +28 -0
- package/dist/effect.mjs.map +1 -0
- package/dist/index-D1KtyjuI.d.mts +71 -0
- package/dist/index-DQAjUrZu.d.mts +94 -0
- package/dist/index.d.mts +128 -0
- package/dist/index.mjs +198 -0
- package/dist/index.mjs.map +1 -0
- package/dist/manifest-DjH3BVB9.d.mts +579 -0
- package/dist/receipt-C7PjnibZ.mjs +28 -0
- package/dist/receipt-C7PjnibZ.mjs.map +1 -0
- package/dist/resolver-BjZwN2JE.d.mts +2327 -0
- package/dist/resolver-D5nVrR10.mjs +153 -0
- package/dist/resolver-D5nVrR10.mjs.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/testing.d.mts +47 -0
- package/dist/testing.mjs +117 -0
- package/dist/testing.mjs.map +1 -0
- package/dist/vercel-BWz_9Y1v.mjs +38 -0
- package/dist/vercel-BWz_9Y1v.mjs.map +1 -0
- package/dist/vercel-Vc_K_87s.d.mts +22 -0
- package/dist/vercel.d.mts +3 -0
- package/dist/vercel.mjs +2 -0
- package/dist/verify-CeMW6XtK.mjs +1109 -0
- package/dist/verify-CeMW6XtK.mjs.map +1 -0
- package/dist/verify-DPB1OfZ5.d.mts +979 -0
- package/package.json +94 -6
- package/bun.lock +0 -66
- package/index.ts +0 -1
- package/tsconfig.json +0 -30
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { p as Type, w as Schema$1 } from "./dns-record-Dzo4flM5.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$3,
|
|
25
|
+
layerFromAsync: () => layerFromAsync$3,
|
|
26
|
+
toAsync: () => toAsync$3
|
|
27
|
+
});
|
|
28
|
+
var Service$3 = class extends Context.Service()("@domainkit/ConnectionStore") {};
|
|
29
|
+
const toAsync$3 = (store) => ({
|
|
30
|
+
get: (connectionId) => Effect.runPromise(store.get(connectionId)),
|
|
31
|
+
put: (connection) => Effect.runPromise(store.put(connection))
|
|
32
|
+
});
|
|
33
|
+
const layerFromAsync$3 = (store) => Layer.succeed(Service$3, {
|
|
34
|
+
get: Effect.fn("ConnectionStore.get")((connectionId) => Effect.tryPromise({
|
|
35
|
+
try: () => store.get(connectionId),
|
|
36
|
+
catch: (cause) => fromCause("connection.get", cause)
|
|
37
|
+
})),
|
|
38
|
+
put: Effect.fn("ConnectionStore.put")((connection) => Effect.tryPromise({
|
|
39
|
+
try: () => store.put(connection),
|
|
40
|
+
catch: (cause) => fromCause("connection.put", cause)
|
|
41
|
+
}))
|
|
42
|
+
});
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/stores/credential.ts
|
|
45
|
+
var credential_exports = /* @__PURE__ */ __exportAll({
|
|
46
|
+
Service: () => Service$2,
|
|
47
|
+
layerFromAsync: () => layerFromAsync$2,
|
|
48
|
+
toAsync: () => toAsync$2
|
|
49
|
+
});
|
|
50
|
+
var Service$2 = class extends Context.Service()("@domainkit/CredentialStore") {};
|
|
51
|
+
const toAsync$2 = (store) => ({
|
|
52
|
+
delete: (connectionId) => Effect.runPromise(store.delete(connectionId)),
|
|
53
|
+
get: (connectionId) => Effect.runPromise(store.get(connectionId)),
|
|
54
|
+
put: (connectionId, credential) => Effect.runPromise(store.put(connectionId, credential))
|
|
55
|
+
});
|
|
56
|
+
const layerFromAsync$2 = (store) => Layer.succeed(Service$2, {
|
|
57
|
+
delete: Effect.fn("CredentialStore.delete")((connectionId) => Effect.tryPromise({
|
|
58
|
+
try: () => store.delete(connectionId),
|
|
59
|
+
catch: (cause) => fromCause("credential.delete", cause)
|
|
60
|
+
})),
|
|
61
|
+
get: Effect.fn("CredentialStore.get")((connectionId) => Effect.tryPromise({
|
|
62
|
+
try: () => store.get(connectionId),
|
|
63
|
+
catch: (cause) => fromCause("credential.get", cause)
|
|
64
|
+
})),
|
|
65
|
+
put: Effect.fn("CredentialStore.put")((connectionId, credential) => Effect.tryPromise({
|
|
66
|
+
try: () => store.put(connectionId, credential),
|
|
67
|
+
catch: (cause) => fromCause("credential.put", cause)
|
|
68
|
+
}))
|
|
69
|
+
});
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/stores/oauth-state.ts
|
|
72
|
+
var oauth_state_exports = /* @__PURE__ */ __exportAll({
|
|
73
|
+
Service: () => Service$1,
|
|
74
|
+
layerFromAsync: () => layerFromAsync$1,
|
|
75
|
+
toAsync: () => toAsync$1
|
|
76
|
+
});
|
|
77
|
+
var Service$1 = class extends Context.Service()("@domainkit/OAuthStateStore") {};
|
|
78
|
+
const toAsync$1 = (store) => ({
|
|
79
|
+
consume: (stateHash, now) => Effect.runPromise(store.consume(stateHash, now)),
|
|
80
|
+
put: (continuation) => Effect.runPromise(store.put(continuation))
|
|
81
|
+
});
|
|
82
|
+
const layerFromAsync$1 = (store) => Layer.succeed(Service$1, {
|
|
83
|
+
consume: Effect.fn("OAuthStateStore.consume")((stateHash, now) => Effect.tryPromise({
|
|
84
|
+
try: () => store.consume(stateHash, now),
|
|
85
|
+
catch: (cause) => fromCause("oauthState.consume", cause)
|
|
86
|
+
})),
|
|
87
|
+
put: Effect.fn("OAuthStateStore.put")((continuation) => Effect.tryPromise({
|
|
88
|
+
try: () => store.put(continuation),
|
|
89
|
+
catch: (cause) => fromCause("oauthState.put", cause)
|
|
90
|
+
}))
|
|
91
|
+
});
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/verification/resolver.ts
|
|
94
|
+
var resolver_exports = /* @__PURE__ */ __exportAll({
|
|
95
|
+
Answer: () => Answer,
|
|
96
|
+
Error: () => Error,
|
|
97
|
+
Resolution: () => Resolution,
|
|
98
|
+
Service: () => Service,
|
|
99
|
+
layerFromAsync: () => layerFromAsync,
|
|
100
|
+
toAsync: () => toAsync
|
|
101
|
+
});
|
|
102
|
+
const Answer = Schema.Struct({
|
|
103
|
+
data: Schema.String,
|
|
104
|
+
name: Schema$1,
|
|
105
|
+
ttl: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
106
|
+
type: Type
|
|
107
|
+
});
|
|
108
|
+
const Resolution = Schema.TaggedUnion({
|
|
109
|
+
answer: { answers: Schema.Array(Answer) },
|
|
110
|
+
nodata: {}
|
|
111
|
+
});
|
|
112
|
+
var Error = class extends Schema.TaggedError()("ResolverError", {
|
|
113
|
+
cause: Schema.optionalKey(Schema.Unknown),
|
|
114
|
+
message: Schema.String,
|
|
115
|
+
reason: Schema.Literals([
|
|
116
|
+
"response",
|
|
117
|
+
"timeout",
|
|
118
|
+
"transport"
|
|
119
|
+
])
|
|
120
|
+
}) {};
|
|
121
|
+
var Service = class extends Context.Service()("@domainkit/DnsResolver") {};
|
|
122
|
+
const layerFromAsync = (resolver) => Layer.succeed(Service, { resolve: Effect.fn("DnsResolver.resolve")((query) => Effect.tryPromise({
|
|
123
|
+
try: () => resolver.resolve(query),
|
|
124
|
+
catch: (cause) => new Error({
|
|
125
|
+
cause,
|
|
126
|
+
message: cause instanceof globalThis.Error ? cause.message : String(cause),
|
|
127
|
+
reason: "transport"
|
|
128
|
+
})
|
|
129
|
+
}).pipe(Effect.flatMap((resolution) => {
|
|
130
|
+
switch (resolution._tag) {
|
|
131
|
+
case "answer":
|
|
132
|
+
case "nodata": return Effect.succeed(resolution);
|
|
133
|
+
case "timeout": return Effect.fail(new Error({
|
|
134
|
+
message: "DNS query timed out",
|
|
135
|
+
reason: "timeout"
|
|
136
|
+
}));
|
|
137
|
+
case "failure": return Effect.fail(new Error({
|
|
138
|
+
message: resolution.message,
|
|
139
|
+
reason: "transport"
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
}))) });
|
|
143
|
+
const toAsync = (resolver) => ({ resolve: (query) => Effect.runPromise(resolver.resolve(query).pipe(Effect.match({
|
|
144
|
+
onFailure: (failure) => failure.reason === "timeout" ? { _tag: "timeout" } : {
|
|
145
|
+
_tag: "failure",
|
|
146
|
+
message: failure.message
|
|
147
|
+
},
|
|
148
|
+
onSuccess: (resolution) => resolution
|
|
149
|
+
}))) });
|
|
150
|
+
//#endregion
|
|
151
|
+
export { toAsync$3 as _, toAsync as a, oauth_state_exports as c, credential_exports as d, layerFromAsync$2 as f, layerFromAsync$3 as g, connection_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, error_exports as v, fromCause as y };
|
|
152
|
+
|
|
153
|
+
//# sourceMappingURL=resolver-D5nVrR10.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver-D5nVrR10.mjs","names":["Error","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/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 get: (connectionId: string) => Effect.Effect<Connection | null, 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 get: (connectionId: string) => Promise<Connection | null>;\n readonly put: (connection: Connection) => Promise<void>;\n}\n\nexport const toAsync = (store: Interface): AsyncInterface => ({\n get: (connectionId) => Effect.runPromise(store.get(connectionId)),\n put: (connection) => Effect.runPromise(store.put(connection)),\n});\n\nexport const layerFromAsync = (store: AsyncInterface): Layer.Layer<Service> =>\n Layer.succeed(Service, {\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 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: (connectionId: string) => Effect.Effect<void, Error>;\n readonly get: (connectionId: string) => Effect.Effect<StoredCredential | null, Error>;\n readonly put: (connectionId: string, credential: StoredCredential) => Effect.Effect<void, Error>;\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@domainkit/CredentialStore\") {}\n\nexport interface AsyncInterface {\n readonly delete: (connectionId: string) => Promise<void>;\n readonly get: (connectionId: string) => Promise<StoredCredential | null>;\n readonly put: (connectionId: string, credential: StoredCredential) => Promise<void>;\n}\n\nexport const toAsync = (store: Interface): AsyncInterface => ({\n delete: (connectionId) => Effect.runPromise(store.delete(connectionId)),\n get: (connectionId) => Effect.runPromise(store.get(connectionId)),\n put: (connectionId, credential) => Effect.runPromise(store.put(connectionId, credential)),\n});\n\nexport const layerFromAsync = (store: AsyncInterface): Layer.Layer<Service> =>\n Layer.succeed(Service, {\n delete: Effect.fn(\"CredentialStore.delete\")((connectionId) =>\n Effect.tryPromise({\n try: () => store.delete(connectionId),\n catch: (cause) => fromCause(\"credential.delete\", cause),\n }),\n ),\n get: Effect.fn(\"CredentialStore.get\")((connectionId) =>\n Effect.tryPromise({\n try: () => store.get(connectionId),\n catch: (cause) => fromCause(\"credential.get\", cause),\n }),\n ),\n put: Effect.fn(\"CredentialStore.put\")((connectionId, credential) =>\n Effect.tryPromise({\n try: () => store.put(connectionId, credential),\n catch: (cause) => fromCause(\"credential.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,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_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll as t };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { D as Observed, _ as Service, g as Interface, p as AsyncInterface } from "./manifest-DjH3BVB9.mjs";
|
|
2
|
+
import { A as Service$2, E as Service$4, M as AsyncInterface$1, N as Interface$1, O as AsyncInterface$2, P as Service$1, T as Interface$4, a as Interface$3, c as Service$3, d as Interface$5, f as Service$5, i as Error, k as Interface$2, n as AsyncInterface$3, o as Query, s as Resolution, u as AsyncInterface$5, w as AsyncInterface$4 } from "./resolver-BjZwN2JE.mjs";
|
|
3
|
+
import { Effect, Layer } from "effect";
|
|
4
|
+
declare namespace in_memory_connection_d_exports {
|
|
5
|
+
export { layer$5 as layer, make$5 as make, toAsync$5 as toAsync };
|
|
6
|
+
}
|
|
7
|
+
declare function make$5(): Interface$1;
|
|
8
|
+
declare const layer$5: () => Layer.Layer<Service$1>;
|
|
9
|
+
declare const toAsync$5: (store?: Interface$1) => AsyncInterface$1;
|
|
10
|
+
declare namespace in_memory_credential_d_exports {
|
|
11
|
+
export { layer$4 as layer, make$4 as make, toAsync$4 as toAsync };
|
|
12
|
+
}
|
|
13
|
+
declare function make$4(): Interface$2;
|
|
14
|
+
declare const layer$4: () => Layer.Layer<Service$2>;
|
|
15
|
+
declare const toAsync$4: (store?: Interface$2) => AsyncInterface$2;
|
|
16
|
+
declare namespace in_memory_d_exports {
|
|
17
|
+
export { Options, layer$3 as layer, make$3 as make, toAsync$3 as toAsync };
|
|
18
|
+
}
|
|
19
|
+
interface Options {
|
|
20
|
+
readonly id?: string;
|
|
21
|
+
readonly records?: Readonly<Record<string, ReadonlyArray<Observed>>>;
|
|
22
|
+
}
|
|
23
|
+
declare function make$3(options?: Options): Interface;
|
|
24
|
+
declare const layer$3: (options?: Options) => Layer.Layer<Service>;
|
|
25
|
+
declare const toAsync$3: (options?: Options) => AsyncInterface;
|
|
26
|
+
declare namespace in_memory_d_exports$1 {
|
|
27
|
+
export { Resolve, layer$2 as layer, make$2 as make, toAsync$2 as toAsync };
|
|
28
|
+
}
|
|
29
|
+
type Resolve = (query: Query) => Resolution | Effect.Effect<Resolution, Error>;
|
|
30
|
+
declare function make$2(resolve: Resolve): Interface$3;
|
|
31
|
+
declare const layer$2: (resolve: Resolve) => Layer.Layer<Service$3>;
|
|
32
|
+
declare const toAsync$2: (resolve: Resolve) => AsyncInterface$3;
|
|
33
|
+
declare namespace in_memory_oauth_state_d_exports {
|
|
34
|
+
export { layer$1 as layer, make$1 as make, toAsync$1 as toAsync };
|
|
35
|
+
}
|
|
36
|
+
declare function make$1(): Interface$4;
|
|
37
|
+
declare const layer$1: () => Layer.Layer<Service$4>;
|
|
38
|
+
declare const toAsync$1: (store?: Interface$4) => AsyncInterface$4;
|
|
39
|
+
declare namespace in_memory_receipt_d_exports {
|
|
40
|
+
export { layer, make, toAsync };
|
|
41
|
+
}
|
|
42
|
+
declare function make(): Interface$5;
|
|
43
|
+
declare const layer: () => Layer.Layer<Service$5>;
|
|
44
|
+
declare const toAsync: (store?: Interface$5) => AsyncInterface$5;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { in_memory_connection_d_exports as InMemoryConnectionStore, in_memory_credential_d_exports as InMemoryCredentialStore, in_memory_d_exports as InMemoryDnsProvider, in_memory_d_exports$1 as InMemoryDnsResolver, in_memory_oauth_state_d_exports as InMemoryOAuthStateStore, in_memory_receipt_d_exports as InMemoryReceiptStore };
|
|
47
|
+
//# sourceMappingURL=testing.d.mts.map
|
package/dist/testing.mjs
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { C as toAsync$6, D as parse, b as Service } from "./dns-record-Dzo4flM5.mjs";
|
|
3
|
+
import { _ as toAsync$7, a as toAsync$9, l as toAsync$10, m as Service$1, n as Service$3, o as Service$4, p as toAsync$8, u as Service$2 } from "./resolver-D5nVrR10.mjs";
|
|
4
|
+
import { r as toAsync$11, t as Service$5 } from "./receipt-C7PjnibZ.mjs";
|
|
5
|
+
import { Effect, Layer } from "effect";
|
|
6
|
+
//#region src/stores/in-memory-connection.ts
|
|
7
|
+
var in_memory_connection_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
layer: () => layer$5,
|
|
9
|
+
make: () => make$5,
|
|
10
|
+
toAsync: () => toAsync$5
|
|
11
|
+
});
|
|
12
|
+
function make$5() {
|
|
13
|
+
const connections = /* @__PURE__ */ new Map();
|
|
14
|
+
return {
|
|
15
|
+
get: Effect.fn("InMemoryConnectionStore.get")((connectionId) => Effect.sync(() => connections.get(connectionId) ?? null)),
|
|
16
|
+
put: Effect.fn("InMemoryConnectionStore.put")((connection) => Effect.sync(() => void connections.set(connection.id, connection)))
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const layer$5 = () => Layer.succeed(Service$1, make$5());
|
|
20
|
+
const toAsync$5 = (store = make$5()) => toAsync$7(store);
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/stores/in-memory-credential.ts
|
|
23
|
+
var in_memory_credential_exports = /* @__PURE__ */ __exportAll({
|
|
24
|
+
layer: () => layer$4,
|
|
25
|
+
make: () => make$4,
|
|
26
|
+
toAsync: () => toAsync$4
|
|
27
|
+
});
|
|
28
|
+
function make$4() {
|
|
29
|
+
const credentials = /* @__PURE__ */ new Map();
|
|
30
|
+
return {
|
|
31
|
+
delete: Effect.fn("InMemoryCredentialStore.delete")((connectionId) => Effect.sync(() => void credentials.delete(connectionId))),
|
|
32
|
+
get: Effect.fn("InMemoryCredentialStore.get")((connectionId) => Effect.sync(() => credentials.get(connectionId) ?? null)),
|
|
33
|
+
put: Effect.fn("InMemoryCredentialStore.put")((connectionId, credential) => Effect.sync(() => void credentials.set(connectionId, credential)))
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const layer$4 = () => Layer.succeed(Service$2, make$4());
|
|
37
|
+
const toAsync$4 = (store = make$4()) => toAsync$8(store);
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/provider/in-memory.ts
|
|
40
|
+
var in_memory_exports = /* @__PURE__ */ __exportAll({
|
|
41
|
+
layer: () => layer$3,
|
|
42
|
+
make: () => make$3,
|
|
43
|
+
toAsync: () => toAsync$3
|
|
44
|
+
});
|
|
45
|
+
function make$3(options = {}) {
|
|
46
|
+
const id = options.id ?? "memory";
|
|
47
|
+
const records = /* @__PURE__ */ new Map();
|
|
48
|
+
for (const [zone, initial] of Object.entries(options.records ?? {})) records.set(parse(zone), [...initial]);
|
|
49
|
+
return {
|
|
50
|
+
id,
|
|
51
|
+
listRecords: Effect.fn("InMemoryDnsProvider.listRecords")((zone) => Effect.sync(() => [...records.get(zone) ?? []])),
|
|
52
|
+
createRecord: Effect.fn("InMemoryDnsProvider.createRecord")((zone, record) => Effect.sync(() => {
|
|
53
|
+
const current = records.get(zone) ?? [];
|
|
54
|
+
current.push(record);
|
|
55
|
+
records.set(zone, current);
|
|
56
|
+
return { providerRecordId: `${id}:${current.length}` };
|
|
57
|
+
}))
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const layer$3 = (options = {}) => Layer.succeed(Service, make$3(options));
|
|
61
|
+
const toAsync$3 = (options = {}) => toAsync$6(make$3(options));
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/verification/in-memory.ts
|
|
64
|
+
var in_memory_exports$1 = /* @__PURE__ */ __exportAll({
|
|
65
|
+
layer: () => layer$2,
|
|
66
|
+
make: () => make$2,
|
|
67
|
+
toAsync: () => toAsync$2
|
|
68
|
+
});
|
|
69
|
+
function make$2(resolve) {
|
|
70
|
+
return { resolve: Effect.fn("InMemoryDnsResolver.resolve")((query) => Effect.suspend(() => {
|
|
71
|
+
const resolution = resolve(query);
|
|
72
|
+
return Effect.isEffect(resolution) ? resolution : Effect.succeed(resolution);
|
|
73
|
+
})) };
|
|
74
|
+
}
|
|
75
|
+
const layer$2 = (resolve) => Layer.succeed(Service$3, make$2(resolve));
|
|
76
|
+
const toAsync$2 = (resolve) => toAsync$9(make$2(resolve));
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/stores/in-memory-oauth-state.ts
|
|
79
|
+
var in_memory_oauth_state_exports = /* @__PURE__ */ __exportAll({
|
|
80
|
+
layer: () => layer$1,
|
|
81
|
+
make: () => make$1,
|
|
82
|
+
toAsync: () => toAsync$1
|
|
83
|
+
});
|
|
84
|
+
function make$1() {
|
|
85
|
+
const continuations = /* @__PURE__ */ new Map();
|
|
86
|
+
return {
|
|
87
|
+
put: Effect.fn("InMemoryOAuthStateStore.put")((continuation) => Effect.sync(() => void continuations.set(continuation.stateHash, continuation))),
|
|
88
|
+
consume: Effect.fn("InMemoryOAuthStateStore.consume")((stateHash, now) => Effect.sync(() => {
|
|
89
|
+
const continuation = continuations.get(stateHash) ?? null;
|
|
90
|
+
if (continuation === null) return null;
|
|
91
|
+
continuations.delete(stateHash);
|
|
92
|
+
return continuation.expiresAt > now ? continuation : null;
|
|
93
|
+
}))
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const layer$1 = () => Layer.succeed(Service$4, make$1());
|
|
97
|
+
const toAsync$1 = (store = make$1()) => toAsync$10(store);
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/stores/in-memory-receipt.ts
|
|
100
|
+
var in_memory_receipt_exports = /* @__PURE__ */ __exportAll({
|
|
101
|
+
layer: () => layer,
|
|
102
|
+
make: () => make,
|
|
103
|
+
toAsync: () => toAsync
|
|
104
|
+
});
|
|
105
|
+
function make() {
|
|
106
|
+
const receipts = /* @__PURE__ */ new Map();
|
|
107
|
+
return {
|
|
108
|
+
get: Effect.fn("InMemoryReceiptStore.get")((planDigest) => Effect.sync(() => receipts.get(planDigest) ?? null)),
|
|
109
|
+
put: Effect.fn("InMemoryReceiptStore.put")((receipt) => Effect.sync(() => void receipts.set(receipt.planDigest, receipt)))
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const layer = () => Layer.succeed(Service$5, make());
|
|
113
|
+
const toAsync = (store = make()) => toAsync$11(store);
|
|
114
|
+
//#endregion
|
|
115
|
+
export { in_memory_connection_exports as InMemoryConnectionStore, in_memory_credential_exports as InMemoryCredentialStore, in_memory_exports as InMemoryDnsProvider, in_memory_exports$1 as InMemoryDnsResolver, in_memory_oauth_state_exports as InMemoryOAuthStateStore, in_memory_receipt_exports as InMemoryReceiptStore };
|
|
116
|
+
|
|
117
|
+
//# sourceMappingURL=testing.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.mjs","names":["make","layer","ConnectionStore.Service","toAsync","ConnectionStore.toAsync","make","layer","CredentialStore.Service","toAsync","CredentialStore.toAsync","make","DomainName.parse","layer","DnsProvider.Service","toAsync","DnsProvider.toAsync","make","layer","DnsResolver.Service","toAsync","DnsResolver.toAsync","make","layer","OAuthStateStore.Service","toAsync","OAuthStateStore.toAsync","ReceiptStore.Service","ReceiptStore.toAsync"],"sources":["../src/stores/in-memory-connection.ts","../src/stores/in-memory-credential.ts","../src/provider/in-memory.ts","../src/verification/in-memory.ts","../src/stores/in-memory-oauth-state.ts","../src/stores/in-memory-receipt.ts"],"sourcesContent":["import { Effect, Layer } from \"effect\";\n\nimport type * as Connection from \"../auth/connection.ts\";\nimport * as ConnectionStore from \"./connection.ts\";\n\nexport function make(): ConnectionStore.Interface {\n const connections = new Map<string, Connection.Connection>();\n return {\n get: Effect.fn(\"InMemoryConnectionStore.get\")((connectionId) =>\n Effect.sync(() => connections.get(connectionId) ?? null),\n ),\n put: Effect.fn(\"InMemoryConnectionStore.put\")((connection) =>\n Effect.sync(() => void connections.set(connection.id, connection)),\n ),\n };\n}\n\nexport const layer = (): Layer.Layer<ConnectionStore.Service> =>\n Layer.succeed(ConnectionStore.Service, make());\n\nexport const toAsync = (\n store: ConnectionStore.Interface = make(),\n): ConnectionStore.AsyncInterface => ConnectionStore.toAsync(store);\n","import { Effect, Layer } from \"effect\";\n\nimport type * as Connection from \"../auth/connection.ts\";\nimport * as CredentialStore from \"./credential.ts\";\n\nexport function make(): CredentialStore.Interface {\n const credentials = new Map<string, Connection.StoredCredential>();\n return {\n delete: Effect.fn(\"InMemoryCredentialStore.delete\")((connectionId) =>\n Effect.sync(() => void credentials.delete(connectionId)),\n ),\n get: Effect.fn(\"InMemoryCredentialStore.get\")((connectionId) =>\n Effect.sync(() => credentials.get(connectionId) ?? null),\n ),\n put: Effect.fn(\"InMemoryCredentialStore.put\")((connectionId, credential) =>\n Effect.sync(() => void credentials.set(connectionId, credential)),\n ),\n };\n}\n\nexport const layer = (): Layer.Layer<CredentialStore.Service> =>\n Layer.succeed(CredentialStore.Service, make());\n\nexport const toAsync = (\n store: CredentialStore.Interface = make(),\n): CredentialStore.AsyncInterface => CredentialStore.toAsync(store);\n","import { Effect, Layer } from \"effect\";\n\nimport * as DomainName from \"../domain/domain-name.ts\";\nimport type * as DnsRecord from \"../domain/dns-record.ts\";\nimport * as DnsProvider from \"./provider.ts\";\n\nexport interface Options {\n readonly id?: string;\n readonly records?: Readonly<Record<string, ReadonlyArray<DnsRecord.Observed>>>;\n}\n\nexport function make(options: Options = {}): DnsProvider.Interface {\n const id = options.id ?? \"memory\";\n const records = new Map<DomainName.DomainName, Array<DnsRecord.Observed>>();\n for (const [zone, initial] of Object.entries(options.records ?? {})) {\n records.set(DomainName.parse(zone), [...initial]);\n }\n return {\n id,\n listRecords: Effect.fn(\"InMemoryDnsProvider.listRecords\")((zone) =>\n Effect.sync(() => [...(records.get(zone) ?? [])]),\n ),\n createRecord: Effect.fn(\"InMemoryDnsProvider.createRecord\")((zone, record) =>\n Effect.sync(() => {\n const current = records.get(zone) ?? [];\n current.push(record);\n records.set(zone, current);\n return { providerRecordId: `${id}:${current.length}` };\n }),\n ),\n };\n}\n\nexport const layer = (options: Options = {}): Layer.Layer<DnsProvider.Service> =>\n Layer.succeed(DnsProvider.Service, make(options));\n\nexport const toAsync = (options: Options = {}): DnsProvider.AsyncInterface =>\n DnsProvider.toAsync(make(options));\n","import { Effect, Layer } from \"effect\";\n\nimport * as DnsResolver from \"./resolver.ts\";\n\nexport type Resolve = (\n query: DnsResolver.Query,\n) => DnsResolver.Resolution | Effect.Effect<DnsResolver.Resolution, DnsResolver.Error>;\n\nexport function make(resolve: Resolve): DnsResolver.Interface {\n return {\n resolve: Effect.fn(\"InMemoryDnsResolver.resolve\")((query) =>\n Effect.suspend(() => {\n const resolution = resolve(query);\n return Effect.isEffect(resolution) ? resolution : Effect.succeed(resolution);\n }),\n ),\n };\n}\n\nexport const layer = (resolve: Resolve): Layer.Layer<DnsResolver.Service> =>\n Layer.succeed(DnsResolver.Service, make(resolve));\n\nexport const toAsync = (resolve: Resolve): DnsResolver.AsyncInterface =>\n DnsResolver.toAsync(make(resolve));\n","import { Effect, Layer } from \"effect\";\n\nimport type * as Connection from \"../auth/connection.ts\";\nimport * as OAuthStateStore from \"./oauth-state.ts\";\n\nexport function make(): OAuthStateStore.Interface {\n const continuations = new Map<string, Connection.OAuthContinuation>();\n return {\n put: Effect.fn(\"InMemoryOAuthStateStore.put\")((continuation) =>\n Effect.sync(() => void continuations.set(continuation.stateHash, continuation)),\n ),\n consume: Effect.fn(\"InMemoryOAuthStateStore.consume\")((stateHash, now) =>\n Effect.sync(() => {\n const continuation = continuations.get(stateHash) ?? null;\n if (continuation === null) return null;\n continuations.delete(stateHash);\n return continuation.expiresAt > now ? continuation : null;\n }),\n ),\n };\n}\n\nexport const layer = (): Layer.Layer<OAuthStateStore.Service> =>\n Layer.succeed(OAuthStateStore.Service, make());\n\nexport const toAsync = (\n store: OAuthStateStore.Interface = make(),\n): OAuthStateStore.AsyncInterface => OAuthStateStore.toAsync(store);\n","import { Effect, Layer } from \"effect\";\n\nimport type * as DnsPlan from \"../plan/types.ts\";\nimport * as ReceiptStore from \"./receipt.ts\";\n\nexport function make(): ReceiptStore.Interface {\n const receipts = new Map<string, DnsPlan.ApplyReceipt>();\n return {\n get: Effect.fn(\"InMemoryReceiptStore.get\")((planDigest) =>\n Effect.sync(() => receipts.get(planDigest) ?? null),\n ),\n put: Effect.fn(\"InMemoryReceiptStore.put\")((receipt) =>\n Effect.sync(() => void receipts.set(receipt.planDigest, receipt)),\n ),\n };\n}\n\nexport const layer = (): Layer.Layer<ReceiptStore.Service> =>\n Layer.succeed(ReceiptStore.Service, make());\n\nexport const toAsync = (store: ReceiptStore.Interface = make()): ReceiptStore.AsyncInterface =>\n ReceiptStore.toAsync(store);\n"],"mappings":";;;;;;;;;;;AAKA,SAAgBA,SAAkC;CAChD,MAAM,8BAAc,IAAI,IAAmC;CAC3D,OAAO;EACL,KAAK,OAAO,GAAG,6BAA6B,CAAC,EAAE,iBAC7C,OAAO,WAAW,YAAY,IAAI,YAAY,KAAK,IAAI,CACzD;EACA,KAAK,OAAO,GAAG,6BAA6B,CAAC,EAAE,eAC7C,OAAO,WAAW,KAAK,YAAY,IAAI,WAAW,IAAI,UAAU,CAAC,CACnE;CACF;AACF;AAEA,MAAaC,gBACX,MAAM,QAAQC,WAAyBF,OAAK,CAAC;AAE/C,MAAaG,aACX,QAAmCH,OAAK,MACLI,UAAwB,KAAK;;;;;;;;ACjBlE,SAAgBC,SAAkC;CAChD,MAAM,8BAAc,IAAI,IAAyC;CACjE,OAAO;EACL,QAAQ,OAAO,GAAG,gCAAgC,CAAC,EAAE,iBACnD,OAAO,WAAW,KAAK,YAAY,OAAO,YAAY,CAAC,CACzD;EACA,KAAK,OAAO,GAAG,6BAA6B,CAAC,EAAE,iBAC7C,OAAO,WAAW,YAAY,IAAI,YAAY,KAAK,IAAI,CACzD;EACA,KAAK,OAAO,GAAG,6BAA6B,CAAC,EAAE,cAAc,eAC3D,OAAO,WAAW,KAAK,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K,OAAO,CAAC;AAElD,MAAaG,aAAW,YACtBC,UAAoBJ,OAAK,OAAO,CAAC;;;;;;;;AClBnC,SAAgBK,SAAkC;CAChD,MAAM,gCAAgB,IAAI,IAA0C;CACpE,OAAO;EACL,KAAK,OAAO,GAAG,6BAA6B,CAAC,EAAE,iBAC7C,OAAO,WAAW,KAAK,cAAc,IAAI,aAAa,WAAW,YAAY,CAAC,CAChF;EACA,SAAS,OAAO,GAAG,iCAAiC,CAAC,EAAE,WAAW,QAChE,OAAO,WAAW;GAChB,MAAM,eAAe,cAAc,IAAI,SAAS,KAAK;GACrD,IAAI,iBAAiB,MAAM,OAAO;GAClC,cAAc,OAAO,SAAS;GAC9B,OAAO,aAAa,YAAY,MAAM,eAAe;EACvD,CAAC,CACH;CACF;AACF;AAEA,MAAaC,gBACX,MAAM,QAAQC,WAAyBF,OAAK,CAAC;AAE/C,MAAaG,aACX,QAAmCH,OAAK,MACLI,WAAwB,KAAK;;;;;;;;ACtBlE,SAAgB,OAA+B;CAC7C,MAAM,2BAAW,IAAI,IAAkC;CACvD,OAAO;EACL,KAAK,OAAO,GAAG,0BAA0B,CAAC,EAAE,eAC1C,OAAO,WAAW,SAAS,IAAI,UAAU,KAAK,IAAI,CACpD;EACA,KAAK,OAAO,GAAG,0BAA0B,CAAC,EAAE,YAC1C,OAAO,WAAW,KAAK,SAAS,IAAI,QAAQ,YAAY,OAAO,CAAC,CAClE;CACF;AACF;AAEA,MAAa,cACX,MAAM,QAAQC,WAAsB,KAAK,CAAC;AAE5C,MAAa,WAAW,QAAgC,KAAK,MAC3DC,WAAqB,KAAK"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { a as integrationMethod$1, i as exchangeCode$1, n as make$1, o as manifest$1, s as tokenMethod$1 } from "./client-DvXfJx_E.mjs";
|
|
3
|
+
import { Effect } from "effect";
|
|
4
|
+
//#region src/promise/vercel-auth.ts
|
|
5
|
+
var vercel_auth_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
exchangeCode: () => exchangeCode,
|
|
7
|
+
integrationMethod: () => integrationMethod,
|
|
8
|
+
manifest: () => manifest,
|
|
9
|
+
tokenMethod: () => tokenMethod
|
|
10
|
+
});
|
|
11
|
+
const integrationMethod = integrationMethod$1;
|
|
12
|
+
const manifest = manifest$1;
|
|
13
|
+
const tokenMethod = tokenMethod$1;
|
|
14
|
+
function exchangeCode(options) {
|
|
15
|
+
return Effect.runPromise(exchangeCode$1(options));
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/promise/vercel.ts
|
|
19
|
+
var vercel_exports = /* @__PURE__ */ __exportAll({
|
|
20
|
+
Auth: () => vercel_auth_exports,
|
|
21
|
+
make: () => make
|
|
22
|
+
});
|
|
23
|
+
/** Creates a Promise-compatible facade over the Effect-native Vercel client. */
|
|
24
|
+
function make(options) {
|
|
25
|
+
const client = make$1(options);
|
|
26
|
+
return {
|
|
27
|
+
id: client.id,
|
|
28
|
+
createRecord: (zone, record) => Effect.runPromise(client.createRecord(zone, record)),
|
|
29
|
+
listAccounts: () => Effect.runPromise(client.listAccounts()),
|
|
30
|
+
listRecords: (zone) => Effect.runPromise(client.listRecords(zone)),
|
|
31
|
+
listZones: (input) => Effect.runPromise(client.listZones(input)),
|
|
32
|
+
validateToken: () => Effect.runPromise(client.validateToken())
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { vercel_exports as n, vercel_auth_exports as r, make as t };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=vercel-BWz_9Y1v.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-BWz_9Y1v.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 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,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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { l as TokenValidation, p as AsyncInterface } from "./manifest-DjH3BVB9.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-DQAjUrZu.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-Vc_K_87s.d.mts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { d as Fetch, h as Zone, l as Account, m as Options, p as ListZonesInput, u as AccountContext } from "./index-DQAjUrZu.mjs";
|
|
2
|
+
import { i as vercel_auth_d_exports, n as make, t as Interface } from "./vercel-Vc_K_87s.mjs";
|
|
3
|
+
export { type Account, type AccountContext, vercel_auth_d_exports as Auth, type Fetch, Interface, type ListZonesInput, type Options, type Zone, make };
|
package/dist/vercel.mjs
ADDED