@seedprotocol/eas 0.7.9-next.1189.g5e63267 → 0.7.9
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 +1 -1
- package/dist/EasClient/createEasGraphQLClient.d.ts +8 -1
- package/dist/EasClient/createEasGraphQLClient.d.ts.map +1 -1
- package/dist/{QueryClient-vrzrZbSV.js → QueryClient-D3BW5tJk.js} +11 -4
- package/dist/QueryClient-D3BW5tJk.js.map +1 -0
- package/dist/api.d.ts +0 -10
- package/dist/api.d.ts.map +1 -1
- package/dist/default/EasClient.d.ts +2 -0
- package/dist/default/EasClient.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +191 -175
- package/dist/index.js.map +1 -1
- package/dist/modelSchemas.d.ts +33 -0
- package/dist/modelSchemas.d.ts.map +1 -0
- package/dist/node/EasClient.d.ts +17 -0
- package/dist/node/EasClient.d.ts.map +1 -1
- package/dist/node/easDispatcher.d.ts +26 -0
- package/dist/node/easDispatcher.d.ts.map +1 -0
- package/dist/node/index.d.ts +12 -2
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node.js +33 -8
- package/dist/node.js.map +1 -1
- package/dist/stores/schemaUidCache.d.ts +5 -0
- package/dist/stores/schemaUidCache.d.ts.map +1 -1
- package/package.json +3 -2
- package/dist/QueryClient-vrzrZbSV.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as e, S as t, T as n, _ as r, a as i, b as a, c as o, d as s, f as c, g as l, h as u, i as d, l as ee, m as te, n as ne, o as re, p as ie, r as ae, s as oe, t as se, u as ce, v as le, w as ue, x as f, y as de } from "./QueryClient-
|
|
1
|
+
import { C as e, S as t, T as n, _ as r, a as i, b as a, c as o, d as s, f as c, g as l, h as u, i as d, l as ee, m as te, n as ne, o as re, p as ie, r as ae, s as oe, t as se, u as ce, v as le, w as ue, x as f, y as de } from "./QueryClient-D3BW5tJk.js";
|
|
2
2
|
import { keccak_256 as fe } from "@noble/hashes/sha3";
|
|
3
3
|
import { bytesToHex as pe, utf8ToBytes as me } from "@noble/hashes/utils";
|
|
4
4
|
//#region src/keccak.ts
|
|
@@ -2474,7 +2474,7 @@ function b(e) {
|
|
|
2474
2474
|
}
|
|
2475
2475
|
//#endregion
|
|
2476
2476
|
//#region src/queries.ts
|
|
2477
|
-
var x = b("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), Ce = b("\n query GetSchemaByName($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), S = b("\n query GetSeeds($where: AttestationWhereInput!, $take: Int, $skip: Int) {\n itemSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }], take: $take, skip: $skip) {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n revocationTime\n schemaId\n timeCreated\n isOffchain\n }\n }\n"), C = b("\n query GetSeedsLean($where: AttestationWhereInput!, $take: Int, $skip: Int) {\n itemSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }], take: $take, skip: $skip) {\n id\n decodedDataJson\n attester\n refUID\n revoked\n revocationTime\n schemaId\n timeCreated\n isOffchain\n }\n }\n"),
|
|
2477
|
+
var x = b("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), Ce = b("\n query GetSchemaByName($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), S = b("\n query GetSeeds($where: AttestationWhereInput!, $take: Int, $skip: Int) {\n itemSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }], take: $take, skip: $skip) {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n revocationTime\n schemaId\n timeCreated\n isOffchain\n }\n }\n"), C = b("\n query GetSeedsLean($where: AttestationWhereInput!, $take: Int, $skip: Int) {\n itemSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }], take: $take, skip: $skip) {\n id\n decodedDataJson\n attester\n refUID\n revoked\n revocationTime\n schemaId\n timeCreated\n isOffchain\n }\n }\n"), we = b("\n query GetDomainOwnerships($where: AttestationWhereInput!) {\n domainOwnerships: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n decodedDataJson\n attester\n recipient\n refUID\n revoked\n revocationTime\n expirationTime\n schemaId\n timeCreated\n }\n }\n"), Te = b("\n query GetSeedIds($where: AttestationWhereInput!) {\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n }\n }\n"), Ee = b("\n query GetStorageTransactionId($where: AttestationWhereInput!) {\n storageTransactionId: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n id\n decodedDataJson\n }\n }\n"), w = b("\n query GetVersions($where: AttestationWhereInput!) {\n itemVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), T = b("\n query GetProperties($where: AttestationWhereInput!) {\n itemProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), De = b("\n query GetAllPropertiesForAllVersions($where: AttestationWhereInput!) {\n allProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), Oe = b("\n query GetFilesMetadata($where: AttestationWhereInput!) {\n filesMetadata: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), ke = b("\n query GetImageSeeds($where: AttestationWhereInput!) {\n imageSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n schemaId\n txid\n timeCreated\n time\n isOffchain\n }\n }\n"), Ae = b("\n query GetImageVersions($where: AttestationWhereInput!) {\n imageVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), E = b("\n query GetAttestationChanges($where: AttestationWhereInput!) {\n changes: attestations(where: $where) {\n id\n refUID\n timeCreated\n revocationTime\n }\n }\n"), je = async ({ seedUids: e, excludeRevoked: n = !0 }) => {
|
|
2478
2478
|
let r = f.getQueryClient(), a = t.getEasClient(), o = {
|
|
2479
2479
|
refUID: { in: e },
|
|
2480
2480
|
schemaId: { equals: y }
|
|
@@ -2484,7 +2484,7 @@ var x = b("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schem
|
|
|
2484
2484
|
[...e].sort(),
|
|
2485
2485
|
n
|
|
2486
2486
|
],
|
|
2487
|
-
queryFn: async () => a.request(
|
|
2487
|
+
queryFn: async () => a.request(w, { where: s })
|
|
2488
2488
|
});
|
|
2489
2489
|
return c;
|
|
2490
2490
|
}, D = async ({ versionUids: e, excludeRevoked: n = !0 }) => {
|
|
@@ -2494,7 +2494,7 @@ var x = b("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schem
|
|
|
2494
2494
|
[...e].sort(),
|
|
2495
2495
|
n
|
|
2496
2496
|
],
|
|
2497
|
-
queryFn: async () => a.request(
|
|
2497
|
+
queryFn: async () => a.request(T, { where: o })
|
|
2498
2498
|
});
|
|
2499
2499
|
return s;
|
|
2500
2500
|
}, Me = async ({ versionUids: e, excludeRevoked: n, checkAttesters: r = !0 }) => {
|
|
@@ -2503,7 +2503,7 @@ var x = b("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schem
|
|
|
2503
2503
|
excludeRevoked: n
|
|
2504
2504
|
});
|
|
2505
2505
|
if (!r || i.length === 0) return g(i);
|
|
2506
|
-
let a = t.getEasClient(), { itemVersions: o } = await a.request(
|
|
2506
|
+
let a = t.getEasClient(), { itemVersions: o } = await a.request(w, { where: {
|
|
2507
2507
|
id: { in: [...new Set(i.map((e) => e.refUID))] },
|
|
2508
2508
|
schemaId: { equals: y }
|
|
2509
2509
|
} }), s = [...new Set(o.map((e) => e.refUID))], { itemSeeds: c } = await a.request(C, {
|
|
@@ -2512,22 +2512,7 @@ var x = b("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schem
|
|
|
2512
2512
|
skip: 0
|
|
2513
2513
|
}), l = new Set(c.map((e) => e.id)), u = _(o.filter((e) => l.has(e.refUID)), c), d = new Set(u.map((e) => e.id));
|
|
2514
2514
|
return g(_(i.filter((e) => d.has(e.refUID)), u));
|
|
2515
|
-
},
|
|
2516
|
-
let n = f.getQueryClient(), r = t.getEasClient();
|
|
2517
|
-
if (!n || !r) return;
|
|
2518
|
-
let { schemas: a } = await i(n, {
|
|
2519
|
-
queryKey: ["getEasSchemaUidBySchemaName", e],
|
|
2520
|
-
queryFn: async () => r.request(x, { where: { schema: { endsWith: e } } })
|
|
2521
|
-
});
|
|
2522
|
-
if (a && a.length !== 0) return a[0].id;
|
|
2523
|
-
}, Ne = async ({ schemaName: e }) => {
|
|
2524
|
-
try {
|
|
2525
|
-
return await O({ schemaName: e });
|
|
2526
|
-
} catch (t) {
|
|
2527
|
-
process.env.NODE_ENV === "development" && console.warn(`Failed to fetch schema for schema name ${e}:`, t);
|
|
2528
|
-
return;
|
|
2529
|
-
}
|
|
2530
|
-
}, Pe = async ({ schemaUids: e, addresses: n, excludeRevoked: r = !0 }) => {
|
|
2515
|
+
}, Ne = async ({ schemaUids: e, addresses: n, excludeRevoked: r = !0 }) => {
|
|
2531
2516
|
let a = {
|
|
2532
2517
|
attester: { in: n.map((e) => {
|
|
2533
2518
|
try {
|
|
@@ -2549,7 +2534,7 @@ var x = b("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schem
|
|
|
2549
2534
|
queryFn: async () => s.request(S, { where: a })
|
|
2550
2535
|
});
|
|
2551
2536
|
return c;
|
|
2552
|
-
},
|
|
2537
|
+
}, O = async (e, n = 10, r, a) => {
|
|
2553
2538
|
let o = r ?? 0, s = a?.uidPrefix, c = {
|
|
2554
2539
|
where: v({
|
|
2555
2540
|
...s === void 0 ? {} : { id: { startsWith: s } },
|
|
@@ -2567,22 +2552,22 @@ var x = b("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schem
|
|
|
2567
2552
|
],
|
|
2568
2553
|
queryFn: async () => u.request(C, c)
|
|
2569
2554
|
});
|
|
2570
|
-
return d.map((t) =>
|
|
2571
|
-
},
|
|
2555
|
+
return d.map((t) => k(t, [e]));
|
|
2556
|
+
}, k = (e, t) => ({
|
|
2572
2557
|
...e,
|
|
2573
2558
|
schema: { schemaNames: t.map((e) => ({ name: e })) }
|
|
2574
|
-
}), A = /* @__PURE__ */ new Map(),
|
|
2559
|
+
}), A = /* @__PURE__ */ new Map(), Pe = (e) => {
|
|
2575
2560
|
let t = "";
|
|
2576
2561
|
try {
|
|
2577
2562
|
t = o();
|
|
2578
2563
|
} catch {}
|
|
2579
2564
|
return `${t}\n${e.toLowerCase()}`;
|
|
2580
|
-
},
|
|
2565
|
+
}, Fe = () => {
|
|
2581
2566
|
A.clear();
|
|
2582
|
-
},
|
|
2567
|
+
}, Ie = async (e) => {
|
|
2583
2568
|
let n = /* @__PURE__ */ new Map(), r = [];
|
|
2584
2569
|
for (let t of new Set(e)) {
|
|
2585
|
-
let e = A.get(
|
|
2570
|
+
let e = A.get(Pe(t));
|
|
2586
2571
|
e ? n.set(t, e) : r.push(t);
|
|
2587
2572
|
}
|
|
2588
2573
|
if (r.length === 0) return n;
|
|
@@ -2592,10 +2577,10 @@ var x = b("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schem
|
|
|
2592
2577
|
}), c = new Map(r.map((e) => [e.toLowerCase(), e]));
|
|
2593
2578
|
for (let e of s ?? []) {
|
|
2594
2579
|
let t = (e.schemaNames ?? []).map((e) => e.name), r = c.get(e.id.toLowerCase());
|
|
2595
|
-
r && t.length !== 0 && (A.set(
|
|
2580
|
+
r && t.length !== 0 && (A.set(Pe(r), t), n.set(r, t));
|
|
2596
2581
|
}
|
|
2597
2582
|
return n;
|
|
2598
|
-
},
|
|
2583
|
+
}, Le = async ({ uids: e, excludeRevoked: n = !0 }) => {
|
|
2599
2584
|
if (e.length === 0) return [];
|
|
2600
2585
|
let r = n ? v({ id: { in: e } }) : { id: { in: e } }, a = f.getQueryClient(), o = t.getEasClient(), { itemSeeds: s } = await i(a, {
|
|
2601
2586
|
queryKey: [
|
|
@@ -2608,12 +2593,12 @@ var x = b("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schem
|
|
|
2608
2593
|
take: e.length,
|
|
2609
2594
|
skip: 0
|
|
2610
2595
|
})
|
|
2611
|
-
}), c = s ?? [], l = await
|
|
2612
|
-
return c.map((e) =>
|
|
2613
|
-
},
|
|
2596
|
+
}), c = s ?? [], l = await Ie(c.map((e) => e.schemaId));
|
|
2597
|
+
return c.map((e) => k(e, l.get(e.schemaId) ?? []));
|
|
2598
|
+
}, Re = 400, ze = async ({ refUIDs: e, ids: n, since: r }) => {
|
|
2614
2599
|
let a = { OR: [{ timeCreated: { gt: r } }, { revocationTime: { gt: r } }] }, o = [], s = (e, t) => {
|
|
2615
2600
|
let n = [...new Set(t)].sort();
|
|
2616
|
-
for (let t = 0; t < n.length; t +=
|
|
2601
|
+
for (let t = 0; t < n.length; t += Re) o.push({ [e]: { in: n.slice(t, t + Re) } });
|
|
2617
2602
|
};
|
|
2618
2603
|
if (s("refUID", e), s("id", n), o.length === 0) return [];
|
|
2619
2604
|
let c = f.getQueryClient(), l = t.getEasClient(), u = await Promise.all(o.map((e) => i(c, {
|
|
@@ -2626,16 +2611,16 @@ var x = b("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schem
|
|
|
2626
2611
|
}))), d = /* @__PURE__ */ new Map();
|
|
2627
2612
|
for (let { changes: e } of u) for (let t of e ?? []) d.set(t.id, t);
|
|
2628
2613
|
return [...d.values()];
|
|
2629
|
-
},
|
|
2614
|
+
}, Be = async (e, t = 10) => (await O(e, t)).map((e) => e.id);
|
|
2630
2615
|
//#endregion
|
|
2631
2616
|
//#region src/easUid.ts
|
|
2632
|
-
function
|
|
2617
|
+
function Ve(e) {
|
|
2633
2618
|
if (e == null || e === "" || e === "NULL") return !0;
|
|
2634
2619
|
let t = e.trim();
|
|
2635
2620
|
return t === "" || t.toLowerCase() === "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
2636
2621
|
}
|
|
2637
|
-
function
|
|
2638
|
-
if (
|
|
2622
|
+
function He(e) {
|
|
2623
|
+
if (Ve(e)) return !1;
|
|
2639
2624
|
let t = String(e).trim();
|
|
2640
2625
|
if (!/^0x/i.test(t)) return !1;
|
|
2641
2626
|
let n = t.slice(2);
|
|
@@ -2648,8 +2633,8 @@ function j(e) {
|
|
|
2648
2633
|
}
|
|
2649
2634
|
//#endregion
|
|
2650
2635
|
//#region src/domainOwnershipHelpers.ts
|
|
2651
|
-
var
|
|
2652
|
-
function
|
|
2636
|
+
var Ue = "string domain,address claimer,string method,bytes32 challengeHash,uint64 verifiedAt,string registryCreationDate,string registryExpirationDate,bytes32 registryFingerprint,string scope", We = "seedprotocol.domainOwnership", Ge = "dns-txt-challenge", Ke = "registrable", qe = "hostname", Je = "_seedprotocol-challenge", Ye = 2592e5, Xe = 31536e6, Ze = 31536e3;
|
|
2637
|
+
function Qe(e) {
|
|
2653
2638
|
return new TextEncoder().encode(e);
|
|
2654
2639
|
}
|
|
2655
2640
|
function M(e) {
|
|
@@ -2663,14 +2648,14 @@ function N(e) {
|
|
|
2663
2648
|
return t.toLowerCase();
|
|
2664
2649
|
}
|
|
2665
2650
|
}
|
|
2666
|
-
function
|
|
2667
|
-
return `${
|
|
2651
|
+
function $e(e) {
|
|
2652
|
+
return `${Je}.${M(e)}`;
|
|
2668
2653
|
}
|
|
2669
|
-
function
|
|
2654
|
+
function et(e) {
|
|
2670
2655
|
let t = N(e.claimer);
|
|
2671
2656
|
return `token=${e.token},addr=${t},expiry=${e.expiry}`;
|
|
2672
2657
|
}
|
|
2673
|
-
function
|
|
2658
|
+
function tt(e) {
|
|
2674
2659
|
let t = e.replace(/^"+|"+$/g, "").trim(), n = /* @__PURE__ */ new Map();
|
|
2675
2660
|
for (let e of t.split(",")) {
|
|
2676
2661
|
let t = e.indexOf("=");
|
|
@@ -2685,17 +2670,17 @@ function rt(e) {
|
|
|
2685
2670
|
expiry: a
|
|
2686
2671
|
};
|
|
2687
2672
|
}
|
|
2688
|
-
function
|
|
2673
|
+
function nt(e) {
|
|
2689
2674
|
let t = M(e.domain), n = N(e.claimer), r = (e.scope ?? "registrable").trim();
|
|
2690
|
-
return "0x" + p(
|
|
2675
|
+
return "0x" + p(Qe(`${t}|${n}|${e.token}|${r}`));
|
|
2691
2676
|
}
|
|
2692
|
-
function
|
|
2677
|
+
function rt(e) {
|
|
2693
2678
|
let t = {
|
|
2694
2679
|
domain: M(e.domain),
|
|
2695
2680
|
creationDate: (e.creationDate ?? "").trim(),
|
|
2696
2681
|
registrarIanaId: (e.registrarIanaId ?? "").trim()
|
|
2697
2682
|
};
|
|
2698
|
-
return "0x" + p(
|
|
2683
|
+
return "0x" + p(Qe(JSON.stringify(t)));
|
|
2699
2684
|
}
|
|
2700
2685
|
function P(e) {
|
|
2701
2686
|
return typeof e == "string" ? j(e) : e && typeof e == "object" && "hex" in e ? j(String(e.hex)) : e && typeof e == "object" && "value" in e ? P(e.value) : j(String(e ?? ""));
|
|
@@ -2703,16 +2688,16 @@ function P(e) {
|
|
|
2703
2688
|
function F(e) {
|
|
2704
2689
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2705
2690
|
}
|
|
2706
|
-
function
|
|
2691
|
+
function it(e) {
|
|
2707
2692
|
if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
|
|
2708
2693
|
if (typeof e == "bigint") return Number(e);
|
|
2709
2694
|
if (typeof e == "string" && e.trim() !== "") {
|
|
2710
2695
|
let t = Number(e);
|
|
2711
2696
|
return Number.isFinite(t) ? Math.trunc(t) : 0;
|
|
2712
2697
|
}
|
|
2713
|
-
return e && typeof e == "object" && "value" in e ?
|
|
2698
|
+
return e && typeof e == "object" && "value" in e ? it(e.value) : 0;
|
|
2714
2699
|
}
|
|
2715
|
-
function
|
|
2700
|
+
function at(e) {
|
|
2716
2701
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2717
2702
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
2718
2703
|
return {
|
|
@@ -2720,20 +2705,20 @@ function st(e) {
|
|
|
2720
2705
|
claimer: N(F(n.get("claimer")?.value)),
|
|
2721
2706
|
method: F(n.get("method")?.value),
|
|
2722
2707
|
challengeHash: P(n.get("challengeHash")?.value),
|
|
2723
|
-
verifiedAt:
|
|
2708
|
+
verifiedAt: it(n.get("verifiedAt")?.value),
|
|
2724
2709
|
registryCreationDate: F(n.get("registryCreationDate")?.value),
|
|
2725
2710
|
registryExpirationDate: F(n.get("registryExpirationDate")?.value),
|
|
2726
2711
|
registryFingerprint: P(n.get("registryFingerprint")?.value),
|
|
2727
2712
|
scope: F(n.get("scope")?.value)
|
|
2728
2713
|
};
|
|
2729
2714
|
}
|
|
2730
|
-
function
|
|
2715
|
+
function ot(e) {
|
|
2731
2716
|
if (!e?.trim()) return null;
|
|
2732
2717
|
let t = Date.parse(e);
|
|
2733
2718
|
return Number.isFinite(t) ? Math.floor(t / 1e3) : null;
|
|
2734
2719
|
}
|
|
2735
|
-
function
|
|
2736
|
-
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.softStaleMs ?? 31536e6, i = e.expirationTime, a =
|
|
2720
|
+
function st(e) {
|
|
2721
|
+
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.softStaleMs ?? 31536e6, i = e.expirationTime, a = ot(e.decoded.registryExpirationDate);
|
|
2737
2722
|
if (typeof i == "number" && i > 0 && t >= i || a != null && t >= a) return {
|
|
2738
2723
|
status: "expired",
|
|
2739
2724
|
warnings: n
|
|
@@ -2742,7 +2727,7 @@ function lt(e) {
|
|
|
2742
2727
|
status: "unknown",
|
|
2743
2728
|
warnings: n
|
|
2744
2729
|
};
|
|
2745
|
-
if (e.registrySnapshot !== void 0) return j(
|
|
2730
|
+
if (e.registrySnapshot !== void 0) return j(rt({
|
|
2746
2731
|
domain: e.decoded.domain,
|
|
2747
2732
|
creationDate: e.registrySnapshot.creationDate,
|
|
2748
2733
|
registrarIanaId: e.registrySnapshot.registrarIanaId
|
|
@@ -2764,10 +2749,10 @@ function lt(e) {
|
|
|
2764
2749
|
}
|
|
2765
2750
|
//#endregion
|
|
2766
2751
|
//#region src/domainOwnership.ts
|
|
2767
|
-
function
|
|
2752
|
+
function I(e) {
|
|
2768
2753
|
return e.trim().toLowerCase().replace(/\.$/, "");
|
|
2769
2754
|
}
|
|
2770
|
-
async function
|
|
2755
|
+
async function ct(e) {
|
|
2771
2756
|
let { toolAddresses: n, domains: r, claimers: i, schemaUid: a, excludeRevoked: o = !0 } = e;
|
|
2772
2757
|
if (!n.length) return [];
|
|
2773
2758
|
let s = n.map((e) => {
|
|
@@ -2777,7 +2762,7 @@ async function dt(e) {
|
|
|
2777
2762
|
return e;
|
|
2778
2763
|
}
|
|
2779
2764
|
}), c = { attester: { in: s } };
|
|
2780
|
-
a ? c.schemaId = { equals: a } : c.schema = { is: { schemaNames: { some: { name: { equals:
|
|
2765
|
+
a ? c.schemaId = { equals: a } : c.schema = { is: { schemaNames: { some: { name: { equals: We } } } } }, i?.length && (c.recipient = { in: i.map((e) => {
|
|
2781
2766
|
try {
|
|
2782
2767
|
return h(e);
|
|
2783
2768
|
} catch {
|
|
@@ -2790,16 +2775,16 @@ async function dt(e) {
|
|
|
2790
2775
|
o,
|
|
2791
2776
|
a ?? "seedprotocol.domainOwnership",
|
|
2792
2777
|
[...s].sort(),
|
|
2793
|
-
[...(r ?? []).map(
|
|
2778
|
+
[...(r ?? []).map(I)].sort(),
|
|
2794
2779
|
[...i ?? []].map((e) => e.toLowerCase()).sort()
|
|
2795
2780
|
],
|
|
2796
|
-
queryFn: async () => u.request(
|
|
2781
|
+
queryFn: async () => u.request(we, { where: c })
|
|
2797
2782
|
});
|
|
2798
2783
|
if (!r?.length) return d;
|
|
2799
|
-
let ee = new Set(r.map(
|
|
2784
|
+
let ee = new Set(r.map(I));
|
|
2800
2785
|
return d.filter((e) => {
|
|
2801
2786
|
try {
|
|
2802
|
-
let t =
|
|
2787
|
+
let t = at(e.decodedDataJson ?? "[]");
|
|
2803
2788
|
return ee.has(t.domain);
|
|
2804
2789
|
} catch {
|
|
2805
2790
|
return !1;
|
|
@@ -2808,8 +2793,8 @@ async function dt(e) {
|
|
|
2808
2793
|
}
|
|
2809
2794
|
//#endregion
|
|
2810
2795
|
//#region src/publishAuthorizationHelpers.ts
|
|
2811
|
-
var
|
|
2812
|
-
function
|
|
2796
|
+
var lt = "address identity,address sessionKey,address app,string scopes,uint64 grantedAt,uint64 expiresAt,bytes32 permissionsHash", ut = "seedprotocol.publishAuthorization", dt = "publish,revoke", ft = 31536e3;
|
|
2797
|
+
function L(e) {
|
|
2813
2798
|
let t = e.trim();
|
|
2814
2799
|
try {
|
|
2815
2800
|
return h(t).toLowerCase();
|
|
@@ -2817,35 +2802,35 @@ function I(e) {
|
|
|
2817
2802
|
return t.toLowerCase();
|
|
2818
2803
|
}
|
|
2819
2804
|
}
|
|
2820
|
-
function
|
|
2805
|
+
function pt(e) {
|
|
2821
2806
|
return typeof e == "string" ? j(e) : e && typeof e == "object" && "hex" in e ? j(String(e.hex)) : j(String(e ?? ""));
|
|
2822
2807
|
}
|
|
2823
|
-
function
|
|
2808
|
+
function R(e) {
|
|
2824
2809
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2825
2810
|
}
|
|
2826
|
-
function
|
|
2811
|
+
function z(e) {
|
|
2827
2812
|
if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
|
|
2828
2813
|
if (typeof e == "bigint") return Number(e);
|
|
2829
2814
|
if (typeof e == "string" && e.trim() !== "") {
|
|
2830
2815
|
let t = Number(e);
|
|
2831
2816
|
return Number.isFinite(t) ? Math.trunc(t) : 0;
|
|
2832
2817
|
}
|
|
2833
|
-
return e && typeof e == "object" && "value" in e ?
|
|
2818
|
+
return e && typeof e == "object" && "value" in e ? z(e.value) : 0;
|
|
2834
2819
|
}
|
|
2835
|
-
function
|
|
2820
|
+
function mt(e) {
|
|
2836
2821
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2837
2822
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
2838
2823
|
return {
|
|
2839
|
-
identity:
|
|
2840
|
-
sessionKey:
|
|
2841
|
-
app:
|
|
2842
|
-
scopes:
|
|
2843
|
-
grantedAt:
|
|
2844
|
-
expiresAt:
|
|
2845
|
-
permissionsHash:
|
|
2824
|
+
identity: L(R(n.get("identity")?.value)),
|
|
2825
|
+
sessionKey: L(R(n.get("sessionKey")?.value)),
|
|
2826
|
+
app: L(R(n.get("app")?.value)),
|
|
2827
|
+
scopes: R(n.get("scopes")?.value),
|
|
2828
|
+
grantedAt: z(n.get("grantedAt")?.value),
|
|
2829
|
+
expiresAt: z(n.get("expiresAt")?.value),
|
|
2830
|
+
permissionsHash: pt(n.get("permissionsHash")?.value)
|
|
2846
2831
|
};
|
|
2847
2832
|
}
|
|
2848
|
-
function
|
|
2833
|
+
function ht(e) {
|
|
2849
2834
|
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.expectedScopes ?? "publish,revoke", i = e.expirationTime, a = e.decoded.expiresAt;
|
|
2850
2835
|
return typeof i == "number" && i > 0 && t >= i || a > 0 && t >= a ? {
|
|
2851
2836
|
status: "expired",
|
|
@@ -2861,14 +2846,14 @@ function vt(e) {
|
|
|
2861
2846
|
warnings: n
|
|
2862
2847
|
});
|
|
2863
2848
|
}
|
|
2864
|
-
function
|
|
2849
|
+
function gt(e) {
|
|
2865
2850
|
return "0x" + p(new TextEncoder().encode(e));
|
|
2866
2851
|
}
|
|
2867
2852
|
//#endregion
|
|
2868
2853
|
//#region src/publishAuthorization.ts
|
|
2869
|
-
async function
|
|
2854
|
+
async function _t(e = {}) {
|
|
2870
2855
|
let { identities: n, sessionKeys: r, apps: i, schemaUid: a, excludeRevoked: o = !0 } = e, s = {};
|
|
2871
|
-
a ? s.schemaId = { equals: a } : s.schema = { is: { schemaNames: { some: { name: { equals:
|
|
2856
|
+
a ? s.schemaId = { equals: a } : s.schema = { is: { schemaNames: { some: { name: { equals: ut } } } } }, n?.length && (s.attester = { in: n.map((e) => {
|
|
2872
2857
|
try {
|
|
2873
2858
|
return h(e);
|
|
2874
2859
|
} catch {
|
|
@@ -2896,7 +2881,7 @@ async function bt(e = {}) {
|
|
|
2896
2881
|
let d = new Set(i.map((e) => e.toLowerCase()));
|
|
2897
2882
|
return u.filter((e) => {
|
|
2898
2883
|
try {
|
|
2899
|
-
let t =
|
|
2884
|
+
let t = mt(e.decodedDataJson ?? "[]");
|
|
2900
2885
|
return d.has(t.app.toLowerCase());
|
|
2901
2886
|
} catch {
|
|
2902
2887
|
return !1;
|
|
@@ -2905,29 +2890,29 @@ async function bt(e = {}) {
|
|
|
2905
2890
|
}
|
|
2906
2891
|
//#endregion
|
|
2907
2892
|
//#region src/easNames.ts
|
|
2908
|
-
var
|
|
2893
|
+
var B = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/([A-Z])([A-Z][a-z])/g, "$1_$2").replace(/[^A-Za-z0-9]+/g, "_").replace(/^_+|_+$/g, "").toLowerCase(), vt = [
|
|
2909
2894
|
"exact",
|
|
2910
2895
|
"normalized",
|
|
2911
2896
|
"fuzzy"
|
|
2912
|
-
],
|
|
2897
|
+
], yt = (e) => typeof e == "string" && vt.includes(e), V = {
|
|
2913
2898
|
exact: 0,
|
|
2914
2899
|
normalized: 1,
|
|
2915
2900
|
fuzzy: 2
|
|
2916
|
-
},
|
|
2917
|
-
let n =
|
|
2901
|
+
}, bt = "fuzzy", H = (e) => e.toLowerCase().replace(/[^a-z0-9]/g, ""), U = (e, t = {}) => {
|
|
2902
|
+
let n = H(e);
|
|
2918
2903
|
return t.relation && (n.length > 3 && n.endsWith("ids") ? n = n.slice(0, -3) : n.length > 2 && n.endsWith("id") && (n = n.slice(0, -2))), n.length > 3 && n.endsWith("s") && !n.endsWith("ss") && (n = n.slice(0, -1)), n;
|
|
2919
2904
|
};
|
|
2920
|
-
function
|
|
2921
|
-
if (
|
|
2922
|
-
if (
|
|
2923
|
-
if (
|
|
2905
|
+
function W(e, t, n = {}) {
|
|
2906
|
+
if (B(e) === t) return "exact";
|
|
2907
|
+
if (H(e) === H(t)) return "normalized";
|
|
2908
|
+
if (U(e, n) === U(t, n)) return "fuzzy";
|
|
2924
2909
|
}
|
|
2925
|
-
var
|
|
2926
|
-
function
|
|
2910
|
+
var G = (e, t) => V[e] <= V[t], K = (e, t) => V[e] - V[t];
|
|
2911
|
+
function xt(e, t) {
|
|
2927
2912
|
let n, r = [];
|
|
2928
2913
|
for (let i of t) {
|
|
2929
|
-
let t =
|
|
2930
|
-
t &&
|
|
2914
|
+
let t = W(i.name, e, { relation: i.relation });
|
|
2915
|
+
t && G(t, i.level ?? "fuzzy") && (n === void 0 || K(t, n) < 0 ? (n = t, r = [i.value]) : t === n && r.push(i.value));
|
|
2931
2916
|
}
|
|
2932
2917
|
return n === void 0 ? { kind: "none" } : r.length > 1 ? {
|
|
2933
2918
|
kind: "ambiguous",
|
|
@@ -2939,99 +2924,135 @@ function wt(e, t) {
|
|
|
2939
2924
|
tier: n
|
|
2940
2925
|
};
|
|
2941
2926
|
}
|
|
2942
|
-
function
|
|
2927
|
+
function St(e, t, n = {}) {
|
|
2943
2928
|
let r = typeof n.level == "function" ? n.level : () => n.level ?? "fuzzy", i, a = /* @__PURE__ */ new Set();
|
|
2944
2929
|
for (let o of t) {
|
|
2945
|
-
let t =
|
|
2946
|
-
t &&
|
|
2930
|
+
let t = W(o, e, { relation: n.relation });
|
|
2931
|
+
t && G(t, r(o)) && (i === void 0 || K(t, i) < 0 ? (i = t, a = /* @__PURE__ */ new Set([o])) : t === i && a.add(o));
|
|
2947
2932
|
}
|
|
2948
2933
|
return a;
|
|
2949
2934
|
}
|
|
2950
|
-
function
|
|
2935
|
+
function Ct(e) {
|
|
2951
2936
|
let t = e.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
|
|
2952
2937
|
return [.../* @__PURE__ */ new Set([
|
|
2953
|
-
|
|
2938
|
+
B(e),
|
|
2954
2939
|
t,
|
|
2955
|
-
|
|
2940
|
+
H(e)
|
|
2956
2941
|
])];
|
|
2957
2942
|
}
|
|
2958
|
-
function
|
|
2959
|
-
if (t === "exact") return [
|
|
2960
|
-
let n = /* @__PURE__ */ new Set([...
|
|
2943
|
+
function wt(e, t = bt) {
|
|
2944
|
+
if (t === "exact") return [B(e)];
|
|
2945
|
+
let n = /* @__PURE__ */ new Set([...Ct(e), e]);
|
|
2961
2946
|
if (t === "fuzzy") for (let e of [...n]) n.add(e.endsWith("s") ? e.slice(0, -1) : `${e}s`);
|
|
2962
2947
|
return [...n];
|
|
2963
2948
|
}
|
|
2964
2949
|
//#endregion
|
|
2965
|
-
//#region src/
|
|
2966
|
-
var
|
|
2967
|
-
|
|
2950
|
+
//#region src/modelSchemas.ts
|
|
2951
|
+
var Tt = (e) => `bytes32 ${B(e)}`, Et = "bytes32 ", Dt = (e) => {
|
|
2952
|
+
let t = /* @__PURE__ */ new Map();
|
|
2953
|
+
for (let { name: n, level: r } of e) {
|
|
2954
|
+
if (!n) continue;
|
|
2955
|
+
let e = t.get(n), i = r ?? "fuzzy";
|
|
2956
|
+
(!e || K(i, e) < 0) && t.set(n, i);
|
|
2957
|
+
}
|
|
2958
|
+
return t;
|
|
2959
|
+
}, Ot = async (e) => {
|
|
2960
|
+
let n = Dt(e);
|
|
2961
|
+
if (n.size === 0) return [];
|
|
2962
|
+
let r = f.getQueryClient(), i = t.getEasClient();
|
|
2963
|
+
if (!r || !i) return [];
|
|
2964
|
+
let a = /* @__PURE__ */ new Set();
|
|
2965
|
+
for (let [e, t] of n) for (let n of wt(e, t)) a.add(`${Et}${n}`);
|
|
2966
|
+
let o = [...a].sort();
|
|
2967
|
+
return (await r.fetchQuery({
|
|
2968
|
+
queryKey: ["fetchEasModelSchemas", o],
|
|
2969
|
+
queryFn: async () => i.request(x, { where: { schema: { in: o } } })
|
|
2970
|
+
}))?.schemas ?? [];
|
|
2971
|
+
}, kt = (e, t) => {
|
|
2972
|
+
let n = [...Dt(t)].map(([e, t]) => ({
|
|
2973
|
+
value: e,
|
|
2974
|
+
name: e,
|
|
2975
|
+
level: t
|
|
2976
|
+
})), r = [];
|
|
2977
|
+
for (let t of e) {
|
|
2978
|
+
if (!t.schema?.startsWith(Et)) continue;
|
|
2979
|
+
let e = xt(t.schema.slice(8), n);
|
|
2980
|
+
e.kind === "match" && r.push({
|
|
2981
|
+
schema: t,
|
|
2982
|
+
modelName: e.value,
|
|
2983
|
+
tier: e.tier
|
|
2984
|
+
});
|
|
2985
|
+
}
|
|
2986
|
+
return r;
|
|
2987
|
+
}, At = async (e) => kt(await Ot(e), e), jt = /^-?\d+$/, Mt = /^(-?)0x([0-9a-f]+)$/i;
|
|
2988
|
+
function Nt(e) {
|
|
2968
2989
|
return typeof e == "string" && /^u?int\d*$/.test(e);
|
|
2969
2990
|
}
|
|
2970
|
-
function
|
|
2971
|
-
let t =
|
|
2991
|
+
function Pt(e) {
|
|
2992
|
+
let t = Mt.exec(e.trim());
|
|
2972
2993
|
if (!t) return;
|
|
2973
2994
|
let n = BigInt("0x" + t[2]);
|
|
2974
2995
|
return (t[1] ? -n : n).toString();
|
|
2975
2996
|
}
|
|
2976
|
-
function
|
|
2997
|
+
function Ft(e) {
|
|
2977
2998
|
if (typeof e == "bigint") return e.toString();
|
|
2978
2999
|
if (typeof e == "number") return Number.isFinite(e) ? String(e) : void 0;
|
|
2979
3000
|
if (typeof e == "string") {
|
|
2980
3001
|
let t = e.trim();
|
|
2981
3002
|
if (!t) return;
|
|
2982
|
-
if (
|
|
2983
|
-
if (
|
|
3003
|
+
if (jt.test(t)) return BigInt(t).toString();
|
|
3004
|
+
if (Mt.test(t)) return Pt(t);
|
|
2984
3005
|
let n = Number(t);
|
|
2985
3006
|
return Number.isFinite(n) ? String(n) : void 0;
|
|
2986
3007
|
}
|
|
2987
3008
|
if (e && typeof e == "object") {
|
|
2988
3009
|
let t = e.hex ?? e._hex;
|
|
2989
|
-
if (typeof t == "string") return
|
|
3010
|
+
if (typeof t == "string") return Pt(t);
|
|
2990
3011
|
}
|
|
2991
3012
|
}
|
|
2992
|
-
function
|
|
3013
|
+
function It(e, t) {
|
|
2993
3014
|
return e === "string" ? t === "" : e === "bytes32" && typeof t == "string" && /^0x0{64}$/i.test(t);
|
|
2994
3015
|
}
|
|
2995
3016
|
//#endregion
|
|
2996
3017
|
//#region src/publishedByHelpers.ts
|
|
2997
|
-
var
|
|
2998
|
-
function
|
|
3018
|
+
var Lt = "bytes32 seedUid,bytes32 versionUid,bytes32[] attestationUids,bytes32 batchHash,string toolName,string toolVersion", Rt = "seedprotocol.publishedBy";
|
|
3019
|
+
function zt(e) {
|
|
2999
3020
|
let t = e.startsWith("0x") || e.startsWith("0X") ? e.slice(2) : e, n = new Uint8Array(t.length / 2);
|
|
3000
3021
|
for (let e = 0; e < n.length; e++) n[e] = parseInt(t.slice(e * 2, e * 2 + 2), 16);
|
|
3001
3022
|
return n;
|
|
3002
3023
|
}
|
|
3003
|
-
function
|
|
3004
|
-
let t = [...e].map((e) => j(e)).filter((e) => e !== "" &&
|
|
3024
|
+
function Bt(e) {
|
|
3025
|
+
let t = [...e].map((e) => j(e)).filter((e) => e !== "" && He(e)).sort();
|
|
3005
3026
|
if (t.length === 0) return "0x" + p(/* @__PURE__ */ new Uint8Array());
|
|
3006
3027
|
let n = new Uint8Array(t.length * 32);
|
|
3007
|
-
for (let e = 0; e < t.length; e++) n.set(
|
|
3028
|
+
for (let e = 0; e < t.length; e++) n.set(zt(t[e]), e * 32);
|
|
3008
3029
|
return "0x" + p(n);
|
|
3009
3030
|
}
|
|
3010
|
-
function
|
|
3011
|
-
return j(
|
|
3031
|
+
function Vt(e) {
|
|
3032
|
+
return j(Bt(e.attestationUids)) === j(e.batchHash);
|
|
3012
3033
|
}
|
|
3013
|
-
function
|
|
3034
|
+
function q(e) {
|
|
3014
3035
|
return typeof e == "string" ? j(e) : e && typeof e == "object" && "hex" in e ? j(String(e.hex)) : j(String(e ?? ""));
|
|
3015
3036
|
}
|
|
3016
|
-
function
|
|
3037
|
+
function Ht(e) {
|
|
3017
3038
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
3018
3039
|
}
|
|
3019
|
-
function
|
|
3040
|
+
function Ut(e) {
|
|
3020
3041
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
3021
3042
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
3022
3043
|
let r = n.get("attestationUids")?.value, i = [];
|
|
3023
|
-
return Array.isArray(r) ? i = r.map((e) =>
|
|
3024
|
-
seedUid:
|
|
3025
|
-
versionUid:
|
|
3044
|
+
return Array.isArray(r) ? i = r.map((e) => q(e)) : r && typeof r == "object" && Array.isArray(r.value) && (i = r.value.map((e) => q(e))), {
|
|
3045
|
+
seedUid: q(n.get("seedUid")?.value),
|
|
3046
|
+
versionUid: q(n.get("versionUid")?.value),
|
|
3026
3047
|
attestationUids: i,
|
|
3027
|
-
batchHash:
|
|
3028
|
-
toolName:
|
|
3029
|
-
toolVersion:
|
|
3048
|
+
batchHash: q(n.get("batchHash")?.value),
|
|
3049
|
+
toolName: Ht(n.get("toolName")?.value),
|
|
3050
|
+
toolVersion: Ht(n.get("toolVersion")?.value)
|
|
3030
3051
|
};
|
|
3031
3052
|
}
|
|
3032
3053
|
//#endregion
|
|
3033
3054
|
//#region src/publishedBy.ts
|
|
3034
|
-
async function
|
|
3055
|
+
async function Wt(e) {
|
|
3035
3056
|
let { toolAddresses: n, refUIDs: r, schemaUid: i, excludeRevoked: a = !0 } = e;
|
|
3036
3057
|
if (!n.length) return [];
|
|
3037
3058
|
let o = n.map((e) => {
|
|
@@ -3041,7 +3062,7 @@ async function Vt(e) {
|
|
|
3041
3062
|
return e;
|
|
3042
3063
|
}
|
|
3043
3064
|
}), s = { attester: { in: o } };
|
|
3044
|
-
i ? s.schemaId = { equals: i } : s.schema = { is: { schemaNames: { some: { name: { equals:
|
|
3065
|
+
i ? s.schemaId = { equals: i } : s.schema = { is: { schemaNames: { some: { name: { equals: Rt } } } } }, r?.length && (s.refUID = { in: r }), a && (s = v(s));
|
|
3045
3066
|
let c = f.getQueryClient(), l = t.getEasClient(), { itemSeeds: u } = await c.fetchQuery({
|
|
3046
3067
|
queryKey: [
|
|
3047
3068
|
"getPublishedByFromEas",
|
|
@@ -3056,75 +3077,70 @@ async function Vt(e) {
|
|
|
3056
3077
|
}
|
|
3057
3078
|
//#endregion
|
|
3058
3079
|
//#region src/default/index.ts
|
|
3059
|
-
function
|
|
3080
|
+
function Gt() {
|
|
3060
3081
|
t.isConfigured() || t.configure(new ne()), f.isConfigured() || f.configure(new se());
|
|
3061
3082
|
}
|
|
3062
3083
|
//#endregion
|
|
3063
3084
|
//#region src/stores/schemaUidCache.ts
|
|
3064
|
-
var
|
|
3085
|
+
var J = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Map(), Kt = 3e5, X = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map(), Q = /* @__PURE__ */ new Map(), $ = 0, qt = () => {
|
|
3065
3086
|
try {
|
|
3066
3087
|
return o();
|
|
3067
3088
|
} catch {
|
|
3068
3089
|
return "";
|
|
3069
3090
|
}
|
|
3070
|
-
},
|
|
3071
|
-
let n =
|
|
3091
|
+
}, Jt = (e) => `${qt()}\n${e}`, Yt = async (e, t) => {
|
|
3092
|
+
let n = Jt(e), r = Z.get(n);
|
|
3072
3093
|
if (r !== void 0) {
|
|
3073
3094
|
if (Date.now() < r) return;
|
|
3074
|
-
|
|
3095
|
+
Z.delete(n);
|
|
3075
3096
|
}
|
|
3076
|
-
let i =
|
|
3097
|
+
let i = Q.get(n);
|
|
3077
3098
|
if (i) return i;
|
|
3078
|
-
let a =
|
|
3079
|
-
|
|
3099
|
+
let a = $, o = t().then((e) => (!e && a === $ && Z.set(n, Date.now() + Kt), e)).finally(() => {
|
|
3100
|
+
Q.get(n) === o && Q.delete(n);
|
|
3080
3101
|
});
|
|
3081
|
-
return
|
|
3082
|
-
},
|
|
3083
|
-
|
|
3084
|
-
},
|
|
3085
|
-
let t = `${
|
|
3086
|
-
for (let e of [...
|
|
3087
|
-
for (let e of [...
|
|
3088
|
-
r &&
|
|
3089
|
-
},
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
let
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
} catch (e) {
|
|
3107
|
-
process.env.NODE_ENV === "development" && console.warn(`Failed to fetch schema for schema name ${t}:`, e);
|
|
3108
|
-
return;
|
|
3109
|
-
}
|
|
3110
|
-
return e && q.set(t, e), e;
|
|
3102
|
+
return Q.set(n, o), o;
|
|
3103
|
+
}, Xt = () => {
|
|
3104
|
+
$++, Z.clear(), Q.clear();
|
|
3105
|
+
}, Zt = (e) => {
|
|
3106
|
+
let t = `${qt()}\n`, n = (n) => n.startsWith(t) && e(n.slice(t.length)), r = !1;
|
|
3107
|
+
for (let e of [...Z.keys()]) n(e) && Z.delete(e);
|
|
3108
|
+
for (let e of [...Q.keys()]) n(e) && (Q.delete(e), r = !0);
|
|
3109
|
+
r && $++;
|
|
3110
|
+
}, Qt = (e) => (t) => t === `definition:${e}`, $t = () => {
|
|
3111
|
+
J.clear(), Y.clear(), X.clear(), Xt();
|
|
3112
|
+
}, en = ({ text: e, schemaUid: t }) => {
|
|
3113
|
+
J.set(m(e), t), Zt(Qt(e));
|
|
3114
|
+
}, tn = ({ modelName: e, schemaUid: t }) => {
|
|
3115
|
+
Y.set(e.toLowerCase(), t);
|
|
3116
|
+
let n = `model:${B(e)}`;
|
|
3117
|
+
Zt((e) => e === n);
|
|
3118
|
+
}, nn = (e) => Y.get(e.toLowerCase()), rn = (e) => J.get(m(e)), an = async ({ schemaText: e }) => {
|
|
3119
|
+
let t = m(e), n = J.get(t);
|
|
3120
|
+
if (n) return n;
|
|
3121
|
+
let r;
|
|
3122
|
+
try {
|
|
3123
|
+
r = await on(e);
|
|
3124
|
+
} catch (t) {
|
|
3125
|
+
process.env.NODE_ENV === "development" && console.warn(`Failed to fetch schema for definition ${e}:`, t);
|
|
3126
|
+
return;
|
|
3111
3127
|
}
|
|
3112
|
-
return
|
|
3113
|
-
},
|
|
3114
|
-
let n =
|
|
3128
|
+
return r && J.set(t, r), r;
|
|
3129
|
+
}, on = async (e) => {
|
|
3130
|
+
let n = Jt(e), r = X.get(n);
|
|
3115
3131
|
if (r) return r;
|
|
3116
3132
|
let i = f.getQueryClient(), a = t.getEasClient();
|
|
3117
3133
|
if (!i || !a) return;
|
|
3118
|
-
let o = await
|
|
3134
|
+
let o = await Yt(`definition:${e}`, async () => {
|
|
3119
3135
|
let t = await i.fetchQuery({
|
|
3120
3136
|
queryKey: ["getSchemaByDefinition", e],
|
|
3121
3137
|
queryFn: async () => a.request(Ce, { where: { schema: { equals: e } } })
|
|
3122
3138
|
}), n = t?.schemas ?? t?.data?.schemas;
|
|
3123
3139
|
return Array.isArray(n) && n.length > 0 ? n[0].id : void 0;
|
|
3124
3140
|
});
|
|
3125
|
-
return o &&
|
|
3141
|
+
return o && X.set(n, o), o;
|
|
3126
3142
|
};
|
|
3127
3143
|
//#endregion
|
|
3128
|
-
export { t as BaseEasClient, t as EasClient, f as BaseQueryClient, te as DEFAULT_EAS_CHAIN_ID,
|
|
3144
|
+
export { t as BaseEasClient, t as EasClient, f as BaseQueryClient, te as DEFAULT_EAS_CHAIN_ID, bt as DEFAULT_NAME_MATCH_LEVEL, Ye as DOMAIN_OWNERSHIP_CHALLENGE_TTL_MS, Ze as DOMAIN_OWNERSHIP_DEFAULT_EXPIRATION_SECS, Ge as DOMAIN_OWNERSHIP_METHOD, Ue as DOMAIN_OWNERSHIP_SCHEMA_DEF, We as DOMAIN_OWNERSHIP_SCHEMA_NAME, qe as DOMAIN_OWNERSHIP_SCOPE_HOSTNAME, Ke as DOMAIN_OWNERSHIP_SCOPE_REGISTRABLE, Xe as DOMAIN_OWNERSHIP_SOFT_STALE_MS, Je as DOMAIN_OWNERSHIP_TXT_LABEL, ne as DefaultEasClient, se as DefaultQueryClient, e as DuplicateEasModuleError, u as EAS_CHAIN_DEPLOYMENTS, be as EAS_ENDPOINT, ae as EAS_REQUEST_TIMEOUT_MS, De as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, E as GET_ATTESTATION_CHANGES, we as GET_DOMAIN_OWNERSHIPS, Oe as GET_FILES_METADATA, ke as GET_IMAGE_SEEDS, Ae as GET_IMAGE_VERSIONS, T as GET_PROPERTIES, x as GET_SCHEMAS, Ce as GET_SCHEMA_BY_NAME, S as GET_SEEDS, C as GET_SEEDS_LEAN, Te as GET_SEED_IDS, Ee as GET_STORAGE_TRANSACTION_ID, w as GET_VERSIONS, vt as NAME_MATCH_LEVELS, l as OP_STACK_EAS_CONTRACT_ADDRESS, r as OP_STACK_SCHEMA_REGISTRY_ADDRESS, Lt as PUBLISHED_BY_SCHEMA_DEF, Rt as PUBLISHED_BY_SCHEMA_NAME, ft as PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS, lt as PUBLISH_AUTHORIZATION_SCHEMA_DEF, ut as PUBLISH_AUTHORIZATION_SCHEMA_NAME, dt as PUBLISH_AUTHORIZATION_SCOPES, Kt as SCHEMA_LOOKUP_MISS_TTL_MS, xe as VERSION_SCHEMA_DEF, y as VERSION_SCHEMA_UID, _e as ZERO_ADDRESS, ve as ZERO_BYTES, ye as ZERO_BYTES32, ue as assertSingleEasModule, st as assessDomainOwnership, ht as assessPublishAuthorization, et as buildDomainOwnershipTxtValue, Yt as cachedSchemaLookup, h as checksumAddress, Xt as clearSchemaLookupMisses, K as compareNameMatchTiers, re as configureEasReadChain, d as createEasGraphQLClient, at as decodeDomainOwnershipData, Ft as decodeEasNumber, mt as decodePublishAuthorizationData, Ut as decodePublishedByData, $e as domainOwnershipTxtName, B as easName, Ct as easNameVariants, wt as easNamesToFetch, Gt as ensureEasPlatform, oe as expectEasReadChain, Ot as fetchEasModelSchemas, U as fuzzyNameKey, ze as getAttestationChangesSince, Me as getCanonicalItemPropertiesFromEas, ct as getDomainOwnershipFromEas, le as getEasAttestationExplorerUrl, de as getEasChainDeployment, o as getEasEndpoint, At as getEasModelSchemasForNames, ee as getEasReadChainId, on as getEasSchemaUidForExactDefinition, an as getEasSchemaUidForSchemaDefinition, D as getItemPropertiesFromEas, je as getItemVersionsFromEas, _t as getPublishAuthorizationFromEas, Wt as getPublishedByFromEas, Ie as getSchemaNamesBySchemaUids, nn as getSchemaUidForModelFromCache, rn as getSchemaUidForSchemaDefinitionFromCache, Be as getSeedUidsBySchemaName, O as getSeedsBySchemaName, Le as getSeedsByUidsFromEas, Ne as getSeedsFromSchemaUids, nt as hashDomainOwnershipChallenge, rt as hashDomainRegistryFingerprint, gt as hashPublishAuthorizationMaterial, Bt as hashPublishedByBatch, It as isEasEmptyValue, ce as isEasReadChainConfigured, s as isEasReadChainSettled, G as isNameMatchAllowed, yt as isNameMatchLevel, Nt as isNumericEasType, Ve as isPlaceholderUid, He as isValidEasAttestationUid, _ as keepAttestationsFromRefAttester, St as localNamesInBestMatchTier, kt as matchEasModelSchemas, xt as matchEasName, Tt as modelSchemaDefinition, W as nameMatchTier, j as normalizeBytes32Hex, H as normalizedNameKey, tt as parseDomainOwnershipTxtValue, ge as partitionByRefAttester, g as pickLatestPropertyAttestationsByRefAndSchema, n as resetEasClientOwnerForTests, c as resetEasReadChain, Fe as resetSchemaNamesCache, $t as resetSchemaUidCaches, a as resolveEasChainDeployment, tn as setSchemaUidForModel, en as setSchemaUidForSchemaDefinition, m as toSnakeCase, Vt as verifyPublishedByBatch, ie as whenEasReadChainSettled, v as withExcludeRevokedFilter };
|
|
3129
3145
|
|
|
3130
3146
|
//# sourceMappingURL=index.js.map
|