@ocap/resolver 1.29.14 → 1.29.15
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/esm/index.d.mts +1 -0
- package/esm/index.mjs +15 -3
- package/lib/index.cjs +15 -3
- package/lib/index.d.cts +1 -0
- package/package.json +17 -17
package/esm/index.d.mts
CHANGED
package/esm/index.mjs
CHANGED
|
@@ -748,11 +748,22 @@ var OCAPResolver = class {
|
|
|
748
748
|
}
|
|
749
749
|
async search(args) {
|
|
750
750
|
if (!args.keyword) return { results: [] };
|
|
751
|
+
const titleFields = {
|
|
752
|
+
account: ["moniker"],
|
|
753
|
+
asset: ["moniker"],
|
|
754
|
+
token: ["name", "symbol"],
|
|
755
|
+
factory: ["name"],
|
|
756
|
+
tokenFactory: ["name", "moniker"]
|
|
757
|
+
};
|
|
751
758
|
const doSearch = async (type, keyword) => {
|
|
752
|
-
|
|
759
|
+
const result = await this.indexdb[type].get(keyword);
|
|
760
|
+
if (!result) return null;
|
|
761
|
+
const fields = titleFields[type];
|
|
762
|
+
return {
|
|
753
763
|
type,
|
|
754
|
-
id: keyword
|
|
755
|
-
|
|
764
|
+
id: keyword,
|
|
765
|
+
title: fields ? fields.map((f) => result[f]).find((v) => v) || "" : ""
|
|
766
|
+
};
|
|
756
767
|
};
|
|
757
768
|
if (patterns.txHash.test(args.keyword)) return { results: (await Promise.all([doSearch("tx", args.keyword.toUpperCase()), doSearch("rollupBlock", args.keyword)])).filter(Boolean) };
|
|
758
769
|
const entitiesByDid = [
|
|
@@ -769,6 +780,7 @@ var OCAPResolver = class {
|
|
|
769
780
|
const keyword = toAddress(args.keyword);
|
|
770
781
|
return { results: (await Promise.all(entitiesByDid.map((type) => doSearch(type, keyword)))).filter(Boolean) };
|
|
771
782
|
}
|
|
783
|
+
if (typeof this.indexdb.search === "function") return { results: await this.indexdb.search(args.keyword) };
|
|
772
784
|
return { results: [] };
|
|
773
785
|
}
|
|
774
786
|
estimateGas(args = {}) {
|
package/lib/index.cjs
CHANGED
|
@@ -762,11 +762,22 @@ var OCAPResolver = class {
|
|
|
762
762
|
}
|
|
763
763
|
async search(args) {
|
|
764
764
|
if (!args.keyword) return { results: [] };
|
|
765
|
+
const titleFields = {
|
|
766
|
+
account: ["moniker"],
|
|
767
|
+
asset: ["moniker"],
|
|
768
|
+
token: ["name", "symbol"],
|
|
769
|
+
factory: ["name"],
|
|
770
|
+
tokenFactory: ["name", "moniker"]
|
|
771
|
+
};
|
|
765
772
|
const doSearch = async (type, keyword) => {
|
|
766
|
-
|
|
773
|
+
const result = await this.indexdb[type].get(keyword);
|
|
774
|
+
if (!result) return null;
|
|
775
|
+
const fields = titleFields[type];
|
|
776
|
+
return {
|
|
767
777
|
type,
|
|
768
|
-
id: keyword
|
|
769
|
-
|
|
778
|
+
id: keyword,
|
|
779
|
+
title: fields ? fields.map((f) => result[f]).find((v) => v) || "" : ""
|
|
780
|
+
};
|
|
770
781
|
};
|
|
771
782
|
if (_arcblock_validator.patterns.txHash.test(args.keyword)) return { results: (await Promise.all([doSearch("tx", args.keyword.toUpperCase()), doSearch("rollupBlock", args.keyword)])).filter(Boolean) };
|
|
772
783
|
const entitiesByDid = [
|
|
@@ -783,6 +794,7 @@ var OCAPResolver = class {
|
|
|
783
794
|
const keyword = (0, _ocap_util.toAddress)(args.keyword);
|
|
784
795
|
return { results: (await Promise.all(entitiesByDid.map((type) => doSearch(type, keyword)))).filter(Boolean) };
|
|
785
796
|
}
|
|
797
|
+
if (typeof this.indexdb.search === "function") return { results: await this.indexdb.search(args.keyword) };
|
|
786
798
|
return { results: [] };
|
|
787
799
|
}
|
|
788
800
|
estimateGas(args = {}) {
|
package/lib/index.d.cts
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.29.
|
|
6
|
+
"version": "1.29.15",
|
|
7
7
|
"description": "GraphQL resolver built upon ocap statedb and GQL layer",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./lib/index.cjs",
|
|
@@ -43,29 +43,29 @@
|
|
|
43
43
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@arcblock/jwt": "1.29.
|
|
47
|
-
"@ocap/indexdb-memory": "1.29.
|
|
48
|
-
"@ocap/statedb-memory": "1.29.
|
|
46
|
+
"@arcblock/jwt": "1.29.15",
|
|
47
|
+
"@ocap/indexdb-memory": "1.29.15",
|
|
48
|
+
"@ocap/statedb-memory": "1.29.15",
|
|
49
49
|
"@types/express": "^4.17.23",
|
|
50
50
|
"@types/lodash": "^4.17.16",
|
|
51
51
|
"@types/node": "^20.10.0",
|
|
52
52
|
"tsdown": "^0.18.4"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@arcblock/did": "1.29.
|
|
56
|
-
"@arcblock/did-ext": "1.29.
|
|
57
|
-
"@arcblock/did-util": "1.29.
|
|
55
|
+
"@arcblock/did": "1.29.15",
|
|
56
|
+
"@arcblock/did-ext": "1.29.15",
|
|
57
|
+
"@arcblock/did-util": "1.29.15",
|
|
58
58
|
"@arcblock/nft-display": "^3.2.3",
|
|
59
|
-
"@arcblock/validator": "1.29.
|
|
60
|
-
"@ocap/config": "1.29.
|
|
61
|
-
"@ocap/indexdb": "1.29.
|
|
62
|
-
"@ocap/mcrypto": "1.29.
|
|
63
|
-
"@ocap/message": "1.29.
|
|
64
|
-
"@ocap/state": "1.29.
|
|
65
|
-
"@ocap/tx-protocols": "1.29.
|
|
66
|
-
"@ocap/types": "1.29.
|
|
67
|
-
"@ocap/util": "1.29.
|
|
68
|
-
"@ocap/wallet": "1.29.
|
|
59
|
+
"@arcblock/validator": "1.29.15",
|
|
60
|
+
"@ocap/config": "1.29.15",
|
|
61
|
+
"@ocap/indexdb": "1.29.15",
|
|
62
|
+
"@ocap/mcrypto": "1.29.15",
|
|
63
|
+
"@ocap/message": "1.29.15",
|
|
64
|
+
"@ocap/state": "1.29.15",
|
|
65
|
+
"@ocap/tx-protocols": "1.29.15",
|
|
66
|
+
"@ocap/types": "1.29.15",
|
|
67
|
+
"@ocap/util": "1.29.15",
|
|
68
|
+
"@ocap/wallet": "1.29.15",
|
|
69
69
|
"debug": "^4.4.3",
|
|
70
70
|
"express": "^4.22.1",
|
|
71
71
|
"lodash": "^4.17.23",
|