zkjson 0.7.2 → 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/cjs/circomlibjs/SMTMemDb.js +6 -6
- package/cjs/db_tree.js +4 -4
- package/esm/circomlibjs/SMTMemDb.js +6 -6
- package/esm/db_tree.js +4 -4
- package/package.json +1 -1
@@ -21,8 +21,8 @@ var SMTMemDb = exports["default"] = /*#__PURE__*/function () {
|
|
21
21
|
this.nodes = {};
|
22
22
|
this.root = F.zero;
|
23
23
|
if (this.kv) {
|
24
|
-
var root = this.kv.get("
|
25
|
-
if (root) this.root = root;else this.kv.put("
|
24
|
+
var root = this.kv.get("root");
|
25
|
+
if (root) this.root = root;else this.kv.put("root", this.root);
|
26
26
|
}
|
27
27
|
this.F = F;
|
28
28
|
}
|
@@ -67,7 +67,7 @@ var SMTMemDb = exports["default"] = /*#__PURE__*/function () {
|
|
67
67
|
case 0:
|
68
68
|
keyS = this._key2str(key);
|
69
69
|
if (!this.nodes[keyS]) {
|
70
|
-
node = this.kv.get("
|
70
|
+
node = this.kv.get("node_".concat(keyS));
|
71
71
|
if (node) this.nodes[keyS] = node;
|
72
72
|
}
|
73
73
|
return _context2.a(2, this.nodes[keyS]);
|
@@ -111,7 +111,7 @@ var SMTMemDb = exports["default"] = /*#__PURE__*/function () {
|
|
111
111
|
while (1) switch (_context4.n) {
|
112
112
|
case 0:
|
113
113
|
this.root = rt;
|
114
|
-
if (this.kv) this.kv.put("
|
114
|
+
if (this.kv) this.kv.put("root", this.root);
|
115
115
|
case 1:
|
116
116
|
return _context4.a(2);
|
117
117
|
}
|
@@ -134,7 +134,7 @@ var SMTMemDb = exports["default"] = /*#__PURE__*/function () {
|
|
134
134
|
keyS = this._key2str(inserts[i][0]);
|
135
135
|
this._normalize(inserts[i][1]);
|
136
136
|
this.nodes[keyS] = inserts[i][1];
|
137
|
-
if (this.kv) this.kv.put("
|
137
|
+
if (this.kv) this.kv.put("node_".concat(keyS), this.nodes[keyS]);
|
138
138
|
}
|
139
139
|
case 1:
|
140
140
|
return _context5.a(2);
|
@@ -157,7 +157,7 @@ var SMTMemDb = exports["default"] = /*#__PURE__*/function () {
|
|
157
157
|
for (i = 0; i < dels.length; i++) {
|
158
158
|
keyS = this._key2str(dels[i]);
|
159
159
|
delete this.nodes[keyS];
|
160
|
-
if (this.kv) this.kv.del("
|
160
|
+
if (this.kv) this.kv.del("node_".concat(keyS));
|
161
161
|
}
|
162
162
|
case 1:
|
163
163
|
return _context6.a(2);
|
package/cjs/db_tree.js
CHANGED
@@ -51,13 +51,13 @@ var DBTree = exports["default"] = /*#__PURE__*/function () {
|
|
51
51
|
return _regenerator().w(function (_context) {
|
52
52
|
while (1) switch (_context.n) {
|
53
53
|
case 0:
|
54
|
-
this.kvi = (_this$kv = this.kv) === null || _this$kv === void 0 ? void 0 : _this$kv.call(this, "
|
54
|
+
this.kvi = (_this$kv = this.kv) === null || _this$kv === void 0 ? void 0 : _this$kv.call(this, "db");
|
55
55
|
_context.n = 1;
|
56
56
|
return (0, _newMemEmptyTrie["default"])(this.kvi);
|
57
57
|
case 1:
|
58
58
|
this.tree = _context.v;
|
59
59
|
if (this.kvi) {
|
60
|
-
count = this.kvi.get("
|
60
|
+
count = this.kvi.get("count");
|
61
61
|
if (!(0, _ramda.isNil)(count)) this.count = count;
|
62
62
|
}
|
63
63
|
case 2:
|
@@ -193,7 +193,7 @@ var DBTree = exports["default"] = /*#__PURE__*/function () {
|
|
193
193
|
size_path: this.size_path,
|
194
194
|
level: this.level,
|
195
195
|
size_json: this.size_json,
|
196
|
-
kv: (_this$kv2 = this.kv) === null || _this$kv2 === void 0 ? void 0 : _this$kv2.call(this, "
|
196
|
+
kv: (_this$kv2 = this.kv) === null || _this$kv2 === void 0 ? void 0 : _this$kv2.call(this, "dir_".concat(id))
|
197
197
|
});
|
198
198
|
_context4.n = 8;
|
199
199
|
return _col.init();
|
@@ -206,7 +206,7 @@ var DBTree = exports["default"] = /*#__PURE__*/function () {
|
|
206
206
|
case 9:
|
207
207
|
if (id === this.count) {
|
208
208
|
this.count++;
|
209
|
-
if (this.kvi) this.kvi.put("
|
209
|
+
if (this.kvi) this.kvi.put("count", this.count);
|
210
210
|
}
|
211
211
|
return _context4.a(2, id);
|
212
212
|
}
|
@@ -4,9 +4,9 @@ export default class SMTMemDb {
|
|
4
4
|
this.nodes = {}
|
5
5
|
this.root = F.zero
|
6
6
|
if (this.kv) {
|
7
|
-
const root = this.kv.get("
|
7
|
+
const root = this.kv.get("root")
|
8
8
|
if (root) this.root = root
|
9
|
-
else this.kv.put("
|
9
|
+
else this.kv.put("root", this.root)
|
10
10
|
}
|
11
11
|
this.F = F
|
12
12
|
}
|
@@ -31,7 +31,7 @@ export default class SMTMemDb {
|
|
31
31
|
async get(key) {
|
32
32
|
const keyS = this._key2str(key)
|
33
33
|
if (!this.nodes[keyS]) {
|
34
|
-
let node = this.kv.get(`
|
34
|
+
let node = this.kv.get(`node_${keyS}`)
|
35
35
|
if (node) this.nodes[keyS] = node
|
36
36
|
}
|
37
37
|
return this.nodes[keyS]
|
@@ -47,7 +47,7 @@ export default class SMTMemDb {
|
|
47
47
|
|
48
48
|
async setRoot(rt) {
|
49
49
|
this.root = rt
|
50
|
-
if (this.kv) this.kv.put("
|
50
|
+
if (this.kv) this.kv.put("root", this.root)
|
51
51
|
}
|
52
52
|
|
53
53
|
async multiIns(inserts) {
|
@@ -55,7 +55,7 @@ export default class SMTMemDb {
|
|
55
55
|
const keyS = this._key2str(inserts[i][0])
|
56
56
|
this._normalize(inserts[i][1])
|
57
57
|
this.nodes[keyS] = inserts[i][1]
|
58
|
-
if (this.kv) this.kv.put(`
|
58
|
+
if (this.kv) this.kv.put(`node_${keyS}`, this.nodes[keyS])
|
59
59
|
}
|
60
60
|
}
|
61
61
|
|
@@ -63,7 +63,7 @@ export default class SMTMemDb {
|
|
63
63
|
for (let i = 0; i < dels.length; i++) {
|
64
64
|
const keyS = this._key2str(dels[i])
|
65
65
|
delete this.nodes[keyS]
|
66
|
-
if (this.kv) this.kv.del(`
|
66
|
+
if (this.kv) this.kv.del(`node_${keyS}`)
|
67
67
|
}
|
68
68
|
}
|
69
69
|
}
|
package/esm/db_tree.js
CHANGED
@@ -23,10 +23,10 @@ export default class DBTree {
|
|
23
23
|
}
|
24
24
|
|
25
25
|
async init() {
|
26
|
-
this.kvi = this.kv?.("
|
26
|
+
this.kvi = this.kv?.("db")
|
27
27
|
this.tree = await newMemEmptyTrie(this.kvi)
|
28
28
|
if (this.kvi) {
|
29
|
-
const count = this.kvi.get("
|
29
|
+
const count = this.kvi.get("count")
|
30
30
|
if (!isNil(count)) this.count = count
|
31
31
|
}
|
32
32
|
}
|
@@ -62,7 +62,7 @@ export default class DBTree {
|
|
62
62
|
size_path: this.size_path,
|
63
63
|
level: this.level,
|
64
64
|
size_json: this.size_json,
|
65
|
-
kv: this.kv?.(`
|
65
|
+
kv: this.kv?.(`dir_${id}`),
|
66
66
|
})
|
67
67
|
await _col.init()
|
68
68
|
this.cols[id] = _col
|
@@ -71,7 +71,7 @@ export default class DBTree {
|
|
71
71
|
await this.tree.insert(id, [root])
|
72
72
|
if (id === this.count) {
|
73
73
|
this.count++
|
74
|
-
if (this.kvi) this.kvi.put("
|
74
|
+
if (this.kvi) this.kvi.put("count", this.count)
|
75
75
|
}
|
76
76
|
return id
|
77
77
|
}
|