@ocap/statedb-fs 1.13.64 → 1.13.68
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/table/base.js +12 -0
- package/package.json +3 -3
package/lib/table/base.js
CHANGED
|
@@ -65,6 +65,18 @@ class FsTable extends StateDBTable {
|
|
|
65
65
|
return doc;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
updateOrCreate(exist, state, ctx) {
|
|
69
|
+
if (!state[this.uniqIndex]) {
|
|
70
|
+
throw new Error('Cannot update or create without uniq index');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (exist) {
|
|
74
|
+
return this.update(state[this.uniqIndex], state, ctx);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return this.create(state[this.uniqIndex], state, ctx);
|
|
78
|
+
}
|
|
79
|
+
|
|
68
80
|
_reset() {
|
|
69
81
|
this.collection.removeWhere({});
|
|
70
82
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocap/statedb-fs",
|
|
3
3
|
"description": "OCAP statedb adapter that uses fs as backend",
|
|
4
|
-
"version": "1.13.
|
|
4
|
+
"version": "1.13.68",
|
|
5
5
|
"author": "wangshijun <shijun@arcblock.io> (https://www.arcblock.io)",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/ArcBlock/asset-chain/issues",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"test": "jest --forceExit --detectOpenHandles",
|
|
38
38
|
"coverage": "npm run test -- --coverage & exit 0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "d84324870fe9dca3619df362ba09219dd420f274",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@ocap/statedb": "1.13.
|
|
42
|
+
"@ocap/statedb": "1.13.68",
|
|
43
43
|
"debug": "^4.3.2",
|
|
44
44
|
"lodash": "^4.17.21",
|
|
45
45
|
"lokijs": "^1.5.11"
|