@ocap/statedb-memory 1.30.10 → 1.30.12
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/table/base.d.mts +2 -2
- package/esm/table/base.mjs +4 -4
- package/lib/table/base.cjs +4 -4
- package/lib/table/base.d.cts +2 -2
- package/package.json +5 -5
package/esm/table/base.d.mts
CHANGED
|
@@ -26,10 +26,10 @@ declare class MemoryTable<T = unknown> extends StateDBTable<T> {
|
|
|
26
26
|
syncBalance,
|
|
27
27
|
db
|
|
28
28
|
}: TableOptions);
|
|
29
|
-
_create(key: string | Record<string, unknown>, attrs?: Partial<T>,
|
|
29
|
+
_create(key: string | Record<string, unknown>, attrs?: Partial<T>, context?: IOperationContext): Promise<T>;
|
|
30
30
|
_get(key: string | Record<string, unknown>, _context?: IOperationContext): Promise<T | null>;
|
|
31
31
|
_history(_key?: string, _context?: IOperationContext): T[];
|
|
32
|
-
_update(key: string | Record<string, unknown>, updates: Partial<T>,
|
|
32
|
+
_update(key: string | Record<string, unknown>, updates: Partial<T>, context?: IOperationContext): Promise<T>;
|
|
33
33
|
updateOrCreate(exist: unknown, state: Partial<T>, ctx?: IOperationContext): Promise<T>;
|
|
34
34
|
_reset(_context?: IOperationContext): void;
|
|
35
35
|
}
|
package/esm/table/base.mjs
CHANGED
|
@@ -23,7 +23,7 @@ var MemoryTable = class MemoryTable extends StateDBTable {
|
|
|
23
23
|
});
|
|
24
24
|
this.markReady();
|
|
25
25
|
}
|
|
26
|
-
async _create(key, attrs = {},
|
|
26
|
+
async _create(key, attrs = {}, context) {
|
|
27
27
|
const id = this.generatePrimaryKey(key);
|
|
28
28
|
if (await MemoryTable.prototype._get.call(this, id)) throw new Error(`${this.name} already exists: ${key}`);
|
|
29
29
|
debug(`insert ${this.name}`, attrs);
|
|
@@ -39,7 +39,7 @@ var MemoryTable = class MemoryTable extends StateDBTable {
|
|
|
39
39
|
address: attrs.address,
|
|
40
40
|
tokens: attrs.tokens,
|
|
41
41
|
context: attrs.context
|
|
42
|
-
});
|
|
42
|
+
}, context);
|
|
43
43
|
}
|
|
44
44
|
return result;
|
|
45
45
|
}
|
|
@@ -59,7 +59,7 @@ var MemoryTable = class MemoryTable extends StateDBTable {
|
|
|
59
59
|
_history(_key, _context) {
|
|
60
60
|
return [];
|
|
61
61
|
}
|
|
62
|
-
async _update(key, updates,
|
|
62
|
+
async _update(key, updates, context) {
|
|
63
63
|
const id = this.generatePrimaryKey(key);
|
|
64
64
|
const doc = await MemoryTable.prototype._get.call(this, id);
|
|
65
65
|
if (!doc) throw new Error(`${this.name} does not exists: ${key}`);
|
|
@@ -73,7 +73,7 @@ var MemoryTable = class MemoryTable extends StateDBTable {
|
|
|
73
73
|
address: doc.address,
|
|
74
74
|
tokens: doc.tokens,
|
|
75
75
|
context: doc.context
|
|
76
|
-
});
|
|
76
|
+
}, context);
|
|
77
77
|
}
|
|
78
78
|
return doc;
|
|
79
79
|
}
|
package/lib/table/base.cjs
CHANGED
|
@@ -27,7 +27,7 @@ var MemoryTable = class MemoryTable extends _ocap_statedb.StateDBTable {
|
|
|
27
27
|
});
|
|
28
28
|
this.markReady();
|
|
29
29
|
}
|
|
30
|
-
async _create(key, attrs = {},
|
|
30
|
+
async _create(key, attrs = {}, context) {
|
|
31
31
|
const id = this.generatePrimaryKey(key);
|
|
32
32
|
if (await MemoryTable.prototype._get.call(this, id)) throw new Error(`${this.name} already exists: ${key}`);
|
|
33
33
|
debug$1(`insert ${this.name}`, attrs);
|
|
@@ -43,7 +43,7 @@ var MemoryTable = class MemoryTable extends _ocap_statedb.StateDBTable {
|
|
|
43
43
|
address: attrs.address,
|
|
44
44
|
tokens: attrs.tokens,
|
|
45
45
|
context: attrs.context
|
|
46
|
-
});
|
|
46
|
+
}, context);
|
|
47
47
|
}
|
|
48
48
|
return result;
|
|
49
49
|
}
|
|
@@ -63,7 +63,7 @@ var MemoryTable = class MemoryTable extends _ocap_statedb.StateDBTable {
|
|
|
63
63
|
_history(_key, _context) {
|
|
64
64
|
return [];
|
|
65
65
|
}
|
|
66
|
-
async _update(key, updates,
|
|
66
|
+
async _update(key, updates, context) {
|
|
67
67
|
const id = this.generatePrimaryKey(key);
|
|
68
68
|
const doc = await MemoryTable.prototype._get.call(this, id);
|
|
69
69
|
if (!doc) throw new Error(`${this.name} does not exists: ${key}`);
|
|
@@ -77,7 +77,7 @@ var MemoryTable = class MemoryTable extends _ocap_statedb.StateDBTable {
|
|
|
77
77
|
address: doc.address,
|
|
78
78
|
tokens: doc.tokens,
|
|
79
79
|
context: doc.context
|
|
80
|
-
});
|
|
80
|
+
}, context);
|
|
81
81
|
}
|
|
82
82
|
return doc;
|
|
83
83
|
}
|
package/lib/table/base.d.cts
CHANGED
|
@@ -26,10 +26,10 @@ declare class MemoryTable<T = unknown> extends StateDBTable<T> {
|
|
|
26
26
|
syncBalance,
|
|
27
27
|
db
|
|
28
28
|
}: TableOptions);
|
|
29
|
-
_create(key: string | Record<string, unknown>, attrs?: Partial<T>,
|
|
29
|
+
_create(key: string | Record<string, unknown>, attrs?: Partial<T>, context?: IOperationContext): Promise<T>;
|
|
30
30
|
_get(key: string | Record<string, unknown>, _context?: IOperationContext): Promise<T | null>;
|
|
31
31
|
_history(_key?: string, _context?: IOperationContext): T[];
|
|
32
|
-
_update(key: string | Record<string, unknown>, updates: Partial<T>,
|
|
32
|
+
_update(key: string | Record<string, unknown>, updates: Partial<T>, context?: IOperationContext): Promise<T>;
|
|
33
33
|
updateOrCreate(exist: unknown, state: Partial<T>, ctx?: IOperationContext): Promise<T>;
|
|
34
34
|
_reset(_context?: IOperationContext): void;
|
|
35
35
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocap/statedb-memory",
|
|
3
3
|
"description": "OCAP statedb adapter that uses memory as backend statedb, just for test purpose",
|
|
4
|
-
"version": "1.30.
|
|
4
|
+
"version": "1.30.12",
|
|
5
5
|
"author": "wangshijun <shijun@arcblock.io> (https://www.arcblock.io)",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/ArcBlock/blockchain/issues",
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
},
|
|
64
64
|
"gitHead": "87990c8b5e215107fc587c1ced0d6b3e2cd2483e",
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@ocap/state": "1.30.
|
|
67
|
-
"@ocap/statedb": "1.30.
|
|
68
|
-
"@ocap/types": "1.30.
|
|
69
|
-
"@ocap/util": "1.30.
|
|
66
|
+
"@ocap/state": "1.30.12",
|
|
67
|
+
"@ocap/statedb": "1.30.12",
|
|
68
|
+
"@ocap/types": "1.30.12",
|
|
69
|
+
"@ocap/util": "1.30.12",
|
|
70
70
|
"debug": "^4.4.3",
|
|
71
71
|
"lodash": "^4.17.23",
|
|
72
72
|
"lokijs": "^1.5.12"
|