@ocap/resolver 1.13.26 → 1.13.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +16 -10
  2. package/package.json +11 -11
package/lib/index.js CHANGED
@@ -165,14 +165,18 @@ module.exports = class OCAPResolver {
165
165
  }
166
166
 
167
167
  getTx({ hash }, ctx) {
168
- return this._getState({
169
- table: 'tx',
170
- id: hash,
171
- dataKey: 'tx.itxJson.data',
172
- onRead: (tx) => this.formatTx(tx, ctx),
173
- expandContext: false,
174
- ctx,
175
- });
168
+ if (states.Joi.hashRegexp.test(hash)) {
169
+ return this._getState({
170
+ table: 'tx',
171
+ id: hash.toUpperCase(),
172
+ dataKey: 'tx.itxJson.data',
173
+ onRead: (tx) => this.formatTx(tx, ctx),
174
+ expandContext: false,
175
+ ctx,
176
+ });
177
+ }
178
+
179
+ return null;
176
180
  }
177
181
 
178
182
  getBlock() {
@@ -569,9 +573,11 @@ module.exports = class OCAPResolver {
569
573
  return { results: results.filter(Boolean) };
570
574
  }
571
575
 
572
- const entitiesByHash = ['tx', 'rollupBlock'];
573
576
  if (states.Joi.hashRegexp.test(args.keyword)) {
574
- const results = await Promise.all(entitiesByHash.map(doSearch));
577
+ const results = await Promise.all([
578
+ this.indexdb.tx.get(args.keyword.toUpperCase()),
579
+ this.indexdb.rollupBlock.get(args.keyword),
580
+ ]);
575
581
  return { results: results.filter(Boolean) };
576
582
  }
577
583
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.13.26",
6
+ "version": "1.13.30",
7
7
  "description": "GraphQL resolver built upon ocap statedb and GQL layer",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -22,17 +22,17 @@
22
22
  "jest": "^26.6.3"
23
23
  },
24
24
  "dependencies": {
25
- "@arcblock/did": "1.13.26",
26
- "@arcblock/did-util": "1.13.26",
27
- "@ocap/config": "1.13.26",
28
- "@ocap/indexdb": "1.13.26",
29
- "@ocap/mcrypto": "1.13.26",
30
- "@ocap/message": "1.13.26",
31
- "@ocap/state": "1.13.26",
32
- "@ocap/tx-protocols": "1.13.26",
33
- "@ocap/util": "1.13.26",
25
+ "@arcblock/did": "1.13.30",
26
+ "@arcblock/did-util": "1.13.30",
27
+ "@ocap/config": "1.13.30",
28
+ "@ocap/indexdb": "1.13.30",
29
+ "@ocap/mcrypto": "1.13.30",
30
+ "@ocap/message": "1.13.30",
31
+ "@ocap/state": "1.13.30",
32
+ "@ocap/tx-protocols": "1.13.30",
33
+ "@ocap/util": "1.13.30",
34
34
  "debug": "^4.3.2",
35
35
  "lodash": "^4.17.21"
36
36
  },
37
- "gitHead": "b06672f0905949152d1236080e656976abcb616d"
37
+ "gitHead": "601d10347bdfd53c07f9d8df35da99d315b86dd8"
38
38
  }