domainkit 0.7.0 → 0.8.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/README.md +7 -4
- package/dist/{connect-10vHuShV.d.mts → connect-D-X8T9W8.d.mts} +286 -90
- package/dist/{connection-C0xsU41C.d.mts → connection-Dp6ZdSo8.d.mts} +2 -2
- package/dist/{connection-api-DW7xUJdj.d.mts → connection-api-lqG1nBtD.d.mts} +2 -2
- package/dist/index.d.mts +703 -34
- package/dist/index.mjs +134 -28
- package/dist/index.mjs.map +1 -1
- package/dist/promise.d.mts +7 -7
- package/dist/promise.mjs +4 -4
- package/dist/{resolver-DPJs8h0a.mjs → resolver-BeGz1ukw.mjs} +90 -28
- package/dist/resolver-BeGz1ukw.mjs.map +1 -0
- package/dist/{resolver-DRrLm_hB.d.mts → resolver-xoSwyXDJ.d.mts} +2 -2
- package/dist/server.d.mts +3 -3
- package/dist/testing.d.mts +2 -2
- package/dist/testing.mjs +1 -1
- package/dist/{verify-DDnK8U7C.mjs → verify-DvGPb5C9.mjs} +34 -28
- package/dist/verify-DvGPb5C9.mjs.map +1 -0
- package/dist/{verify-C3V_GtzL.d.mts → verify-FpunAcM7.d.mts} +72 -5
- package/package.json +1 -1
- package/dist/resolver-DPJs8h0a.mjs.map +0 -1
- package/dist/verify-DDnK8U7C.mjs.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { A as Error$1, D as decode$5, E as Schema$2, b as assertAttachment, c as Evidence$1, d as codec, k as parse$1, p as AuthorizationError, s as Service$1, x as authorizationError } from "./canonical-json-CQYKsZw7.mjs";
|
|
3
3
|
import { n as Method$1, t as Error$2 } from "./connect-oI8hcMxc.mjs";
|
|
4
|
-
import { C as authorize$1, I as Error$3, L as Service$3, R as fromAsync$1, V as toAsync$4, Y as Opaque, i as Service$2, it as equals, n as Error$4, nt as decode$6, o as toAsync$5, r as Resolution$1, tt as data, ut as candidates } from "./resolver-
|
|
4
|
+
import { C as authorize$1, I as Error$3, L as Service$3, R as fromAsync$1, V as toAsync$4, Y as Opaque, i as Service$2, it as equals, n as Error$4, nt as decode$6, o as toAsync$5, r as Resolution$1, tt as data, ut as candidates } from "./resolver-BeGz1ukw.mjs";
|
|
5
5
|
import { Clock, Context, Crypto, Data, Effect, Layer, Option, Schema, SchemaIssue, SchemaTransformation } from "effect";
|
|
6
6
|
import * as oauth from "oauth4webapi";
|
|
7
7
|
import * as DnsPacket from "@leichtgewicht/dns-packet";
|
|
8
8
|
//#region package.json
|
|
9
|
-
var version = "0.
|
|
9
|
+
var version = "0.8.0";
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/auth/diagnostic.ts
|
|
12
12
|
var diagnostic_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -50,7 +50,7 @@ var manifest_exports = /* @__PURE__ */ __exportAll({
|
|
|
50
50
|
Schema: () => Schema$1,
|
|
51
51
|
decode: () => decode$4
|
|
52
52
|
});
|
|
53
|
-
const
|
|
53
|
+
const MethodSchema = Schema.TaggedUnion({
|
|
54
54
|
integration: {
|
|
55
55
|
capabilities: Schema.Array(Schema.Literals(["dns:read", "dns:write"])),
|
|
56
56
|
installUrl: Schema.String,
|
|
@@ -76,8 +76,15 @@ const Method = Schema.TaggedUnion({
|
|
|
76
76
|
instructionsUrl: Schema.String
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
|
+
/** Provider authentication method schema and constructors for trusted manifests. */
|
|
80
|
+
const Method = {
|
|
81
|
+
Schema: MethodSchema,
|
|
82
|
+
integration: (input) => MethodSchema.cases.integration.make(input),
|
|
83
|
+
oauth2: (input) => MethodSchema.cases.oauth2.make(input),
|
|
84
|
+
token: (input) => MethodSchema.cases.token.make(input)
|
|
85
|
+
};
|
|
79
86
|
const Schema$1 = Schema.Struct({
|
|
80
|
-
methods: Schema.Array(Method),
|
|
87
|
+
methods: Schema.Array(Method.Schema),
|
|
81
88
|
providerId: Schema.String
|
|
82
89
|
});
|
|
83
90
|
const decode$4 = Effect.fn("ProviderAuth.decode")((input) => Schema.decodeUnknownEffect(Schema$1)(input).pipe(Effect.mapError((cause) => new Error$1({ message: cause.message }))));
|
|
@@ -123,7 +130,7 @@ const Evidence = Schema.Struct({
|
|
|
123
130
|
providerId: Schema.String,
|
|
124
131
|
zone: Schema$2
|
|
125
132
|
});
|
|
126
|
-
const
|
|
133
|
+
const SelectionSchema = Schema.TaggedUnion({
|
|
127
134
|
selected: {
|
|
128
135
|
candidate: Evidence,
|
|
129
136
|
evidence: Schema.Array(Evidence),
|
|
@@ -134,6 +141,12 @@ const Selection = Schema.TaggedUnion({
|
|
|
134
141
|
reason: Schema.Literals(["ambiguous", "unsupported"])
|
|
135
142
|
}
|
|
136
143
|
});
|
|
144
|
+
/** Provider selection schema and constructors for trusted discovery results. */
|
|
145
|
+
const Selection = {
|
|
146
|
+
Schema: SelectionSchema,
|
|
147
|
+
manual: (input) => SelectionSchema.cases.manual.make(input),
|
|
148
|
+
selected: (input) => SelectionSchema.cases.selected.make(input)
|
|
149
|
+
};
|
|
137
150
|
function select(input) {
|
|
138
151
|
const domain = parse$1(input.domain);
|
|
139
152
|
const zoneCandidates = new Set(candidates(domain));
|
|
@@ -162,25 +175,22 @@ function select(input) {
|
|
|
162
175
|
if (index < 0) throw authorizationError("Explicit provider zone is not connected for this domain", "ProviderDiscovery.select");
|
|
163
176
|
const candidate = evidence[index];
|
|
164
177
|
if (candidate === void 0) throw new Error("Eligible provider evidence is missing");
|
|
165
|
-
return {
|
|
166
|
-
_tag: "selected",
|
|
178
|
+
return Selection.selected({
|
|
167
179
|
candidate,
|
|
168
180
|
evidence,
|
|
169
181
|
reason: "explicit"
|
|
170
|
-
};
|
|
182
|
+
});
|
|
171
183
|
}
|
|
172
184
|
const decisive = evidence.filter(({ decisiveNameserverMatch }) => decisiveNameserverMatch);
|
|
173
185
|
const candidate = decisive[0];
|
|
174
|
-
return decisive.length === 1 && candidate !== void 0 ? {
|
|
175
|
-
_tag: "selected",
|
|
186
|
+
return decisive.length === 1 && candidate !== void 0 ? Selection.selected({
|
|
176
187
|
candidate,
|
|
177
188
|
evidence,
|
|
178
189
|
reason: "unique-nameserver-match"
|
|
179
|
-
} : {
|
|
180
|
-
_tag: "manual",
|
|
190
|
+
}) : Selection.manual({
|
|
181
191
|
evidence,
|
|
182
192
|
reason: decisive.length > 1 ? "ambiguous" : "unsupported"
|
|
183
|
-
};
|
|
193
|
+
});
|
|
184
194
|
}
|
|
185
195
|
function evidenceFor(connected, authoritative) {
|
|
186
196
|
const configured = new Set(nameserverSet(connected.nameservers));
|
|
@@ -518,7 +528,7 @@ const decode$3 = Effect.fn("CloudflareRecords.decode")((record) => Effect.gen(fu
|
|
|
518
528
|
default: return yield* decodeOpaque$1(record);
|
|
519
529
|
}
|
|
520
530
|
}));
|
|
521
|
-
const decodeOpaque$1 = Effect.fn("CloudflareRecords.decodeOpaque")((record) => Schema.decodeUnknownEffect(Opaque)({
|
|
531
|
+
const decodeOpaque$1 = Effect.fn("CloudflareRecords.decodeOpaque")((record) => Schema.decodeUnknownEffect(Opaque.Schema)({
|
|
522
532
|
_tag: "Opaque",
|
|
523
533
|
name: record.name,
|
|
524
534
|
providerRecordId: record.id,
|
|
@@ -926,21 +936,19 @@ const Context$2 = Schema.Struct({
|
|
|
926
936
|
const contextCodec$1 = codec("cloudflare.v1", Context$2);
|
|
927
937
|
/** Describes Cloudflare's caller-created API-token authorization method. */
|
|
928
938
|
function tokenMethod$1(capabilities) {
|
|
929
|
-
return {
|
|
930
|
-
_tag: "token",
|
|
939
|
+
return Method.token({
|
|
931
940
|
capabilities: [...capabilities],
|
|
932
941
|
instructionsUrl: "https://developers.cloudflare.com/fundamentals/api/get-started/create-token/"
|
|
933
|
-
};
|
|
942
|
+
});
|
|
934
943
|
}
|
|
935
944
|
/** Describes a registered Cloudflare OAuth client and its assigned scope IDs. */
|
|
936
945
|
function oauthMethod(options) {
|
|
937
|
-
return {
|
|
938
|
-
_tag: "oauth2",
|
|
946
|
+
return Method.oauth2({
|
|
939
947
|
authorizationServer,
|
|
940
948
|
capabilities: [...options.capabilities],
|
|
941
949
|
clientAuth: options.clientAuth,
|
|
942
950
|
scopes: [...options.scopes]
|
|
943
|
-
};
|
|
951
|
+
});
|
|
944
952
|
}
|
|
945
953
|
/** Creates the Cloudflare token and OAuth authorization manifest. */
|
|
946
954
|
function manifest$1(options) {
|
|
@@ -1322,7 +1330,7 @@ const decode$1 = Effect.fn("VercelRecords.decode")((zone, record) => Effect.gen(
|
|
|
1322
1330
|
default: return yield* decodeOpaque(record, name);
|
|
1323
1331
|
}
|
|
1324
1332
|
}));
|
|
1325
|
-
const decodeOpaque = Effect.fn("VercelRecords.decodeOpaque")((record, name) => Schema.decodeUnknownEffect(Opaque)({
|
|
1333
|
+
const decodeOpaque = Effect.fn("VercelRecords.decodeOpaque")((record, name) => Schema.decodeUnknownEffect(Opaque.Schema)({
|
|
1326
1334
|
_tag: "Opaque",
|
|
1327
1335
|
name,
|
|
1328
1336
|
providerRecordId: record.id,
|
|
@@ -1728,20 +1736,18 @@ const Context$1 = Schema.TaggedUnion({
|
|
|
1728
1736
|
const contextCodec = codec("vercel.v1", Context$1);
|
|
1729
1737
|
/** Describes Vercel's caller-created personal access-token method. */
|
|
1730
1738
|
function tokenMethod(capabilities) {
|
|
1731
|
-
return {
|
|
1732
|
-
_tag: "token",
|
|
1739
|
+
return Method.token({
|
|
1733
1740
|
capabilities: [...capabilities],
|
|
1734
1741
|
instructionsUrl: "https://vercel.com/account/settings/tokens"
|
|
1735
|
-
};
|
|
1742
|
+
});
|
|
1736
1743
|
}
|
|
1737
1744
|
/** Describes Vercel's provider-specific integration installation flow. */
|
|
1738
1745
|
function integrationMethod(options) {
|
|
1739
|
-
return {
|
|
1740
|
-
_tag: "integration",
|
|
1746
|
+
return Method.integration({
|
|
1741
1747
|
capabilities: [...options.capabilities],
|
|
1742
1748
|
installUrl: `https://vercel.com/integrations/${encodeURIComponent(options.slug)}/new`,
|
|
1743
1749
|
tokenEndpoint: "https://api.vercel.com/v2/oauth/access_token"
|
|
1744
|
-
};
|
|
1750
|
+
});
|
|
1745
1751
|
}
|
|
1746
1752
|
/** Creates the Vercel token and integration authorization manifest. */
|
|
1747
1753
|
function manifest(options) {
|
|
@@ -2393,4 +2399,4 @@ function recordValue(requirement) {
|
|
|
2393
2399
|
//#endregion
|
|
2394
2400
|
export { decode$4 as $, client_exports as A, tokenConnectionMethod$1 as B, integrationFlow as C, tokenConnectionMethod as D, restore as E, oauthFlow as F, make$5 as G, tokenValidator as H, oauthMethod as I, session_exports as J, authorize as K, refreshCredential as L, make$4 as M, auth_exports$1 as N, tokenMethod as O, manifest$1 as P, Schema$1 as Q, restore$1 as R, exchangeCode as S, manifest as T, client_exports$1 as U, tokenMethod$1 as V, discovery$1 as W, secret_exports as X, selection_exports as Y, Method as Z, toAsync$1 as _, Result as a, dns_data_exports as b, Observation as c, defaultMake as d, manifest_exports as et, make as f, cloudflare_doh_exports as g, toAsync as h, PublicDnsObservation as i, discovery as j, AccountContext as k, Policy as l, google_doh_exports as m, ProviderObservation as n, version as nt, observe as o, resolver_pool_exports as p, connection_authorization_exports as q, PublicDns as r, verify_exports as s, Provider as t, diagnostic_exports as tt, Service as u, doh_exports as v, integrationMethod as w, auth_exports as x, toAsync$2 as y, subjectResolver as z };
|
|
2395
2401
|
|
|
2396
|
-
//# sourceMappingURL=verify-
|
|
2402
|
+
//# sourceMappingURL=verify-DvGPb5C9.mjs.map
|