@ocap/indexdb 1.18.92 → 1.18.94
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/lib/db.js +4 -0
- package/lib/util.js +14 -1
- package/package.json +4 -4
package/lib/db.js
CHANGED
|
@@ -53,6 +53,10 @@ class BaseIndexDB extends Ready {
|
|
|
53
53
|
listBlocks() {
|
|
54
54
|
return [];
|
|
55
55
|
}
|
|
56
|
+
|
|
57
|
+
listDelegations({ from, to, paging = {}, timeFilter = {} } = {}) {
|
|
58
|
+
throw new Error('listDelegations should be implemented in adapter');
|
|
59
|
+
}
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
module.exports = BaseIndexDB;
|
package/lib/util.js
CHANGED
|
@@ -69,13 +69,18 @@ const createIndexedDelegation = (x, ctx) => {
|
|
|
69
69
|
data: x.data,
|
|
70
70
|
genesisTime: x.context.genesisTime,
|
|
71
71
|
renaissanceTime: x.context.renaissanceTime,
|
|
72
|
-
|
|
72
|
+
// https://discuss.elastic.co/t/updating-an-object-field/110735
|
|
73
|
+
ops: [x.ops],
|
|
73
74
|
};
|
|
74
75
|
if (ctx.senderState) {
|
|
75
76
|
result.from = get(ctx, 'senderState.address', '');
|
|
77
|
+
} else {
|
|
78
|
+
result.from = get(ctx, 'tx.from', '');
|
|
76
79
|
}
|
|
77
80
|
if (ctx.receiverState) {
|
|
78
81
|
result.to = get(ctx, 'receiverState.address', '');
|
|
82
|
+
} else {
|
|
83
|
+
result.to = get(ctx, 'itx.to', '');
|
|
79
84
|
}
|
|
80
85
|
return result;
|
|
81
86
|
};
|
|
@@ -407,6 +412,13 @@ const formatTxAfterRead = (tx) => {
|
|
|
407
412
|
return tx;
|
|
408
413
|
};
|
|
409
414
|
|
|
415
|
+
const formatDelegationAfterRead = (delegation) => {
|
|
416
|
+
// https://discuss.elastic.co/t/updating-an-object-field/110735
|
|
417
|
+
const ops = Array.isArray(delegation.ops) ? delegation.ops[0] : delegation.ops;
|
|
418
|
+
delegation.ops = Object.keys(ops).map((x) => ({ key: x, value: ops[x] }));
|
|
419
|
+
return delegation;
|
|
420
|
+
};
|
|
421
|
+
|
|
410
422
|
const parseDateTime = (str) => {
|
|
411
423
|
if (!str) {
|
|
412
424
|
return '';
|
|
@@ -554,4 +566,5 @@ module.exports = {
|
|
|
554
566
|
parseDateTime,
|
|
555
567
|
formatTokenMeta,
|
|
556
568
|
isDefaultTokenChanged,
|
|
569
|
+
formatDelegationAfterRead,
|
|
557
570
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.18.
|
|
6
|
+
"version": "1.18.94",
|
|
7
7
|
"description": "Defines the basic interface for OCAP IndexDB",
|
|
8
8
|
"main": "lib/main.js",
|
|
9
9
|
"files": [
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"jest": "^27.5.1"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@ocap/state": "1.18.
|
|
29
|
-
"@ocap/util": "1.18.
|
|
28
|
+
"@ocap/state": "1.18.94",
|
|
29
|
+
"@ocap/util": "1.18.94",
|
|
30
30
|
"kareem": "^2.4.1",
|
|
31
31
|
"lodash": "^4.17.21"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "6e23a66fb0adcd1359e21b4fde180860b4c305b3"
|
|
34
34
|
}
|