@ocap/statedb 1.28.5 → 1.28.7

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/README.md CHANGED
@@ -9,7 +9,7 @@ Defines the abstract interface of OCAP StateDB, must be implemented with an actu
9
9
  ## Usage
10
10
 
11
11
  ```shell
12
- pnpm install @ocap/statedb-memory
12
+ bun install @ocap/statedb-memory
13
13
  ```
14
14
 
15
15
  Then:
package/lib/db.js CHANGED
@@ -6,7 +6,7 @@ class StateDB extends Ready {
6
6
  super();
7
7
 
8
8
  this.tables = tables;
9
- this.readyMarks = tables.reduce((acc, x) => ({ ...acc, [x]: false }), {});
9
+ this.readyMarks = Object.fromEntries(tables.map((x) => [x, false]));
10
10
  this.readyListenersAttached = false;
11
11
  }
12
12
 
package/lib/table.js CHANGED
@@ -1,6 +1,4 @@
1
- /* eslint-disable no-shadow */
2
- /* eslint-disable no-underscore-dangle */
3
- const crypto = require('crypto');
1
+ const crypto = require('node:crypto');
4
2
  const Kareem = require('kareem');
5
3
  const omit = require('lodash/omit');
6
4
  const pick = require('lodash/pick');
@@ -34,7 +32,7 @@ class StateDBTable extends Ready {
34
32
 
35
33
  if (['create', 'update', 'reset'].includes(x)) {
36
34
  const ctx = args.slice(-1).pop();
37
- if (ctx && ctx.tx) {
35
+ if (ctx?.tx) {
38
36
  ctx.events = ctx.events || [];
39
37
  ctx.events.push({
40
38
  table: this.name,
@@ -69,33 +67,27 @@ class StateDBTable extends Ready {
69
67
  });
70
68
  }
71
69
 
72
- // eslint-disable-next-line no-unused-vars
73
- _create(id, attrs, context) {
70
+ _create(_id, _attrs, _context) {
74
71
  throw new Error('`_create` must be implemented in sub statedb');
75
72
  }
76
73
 
77
- // eslint-disable-next-line no-unused-vars
78
- _get(id, context) {
74
+ _get(_id, _context) {
79
75
  throw new Error('`_get` must be implemented in sub statedb');
80
76
  }
81
77
 
82
- // eslint-disable-next-line no-unused-vars
83
- _update(id, updates, context) {
78
+ _update(_id, _updates, _context) {
84
79
  throw new Error('`_update` must be implemented in sub statedb');
85
80
  }
86
81
 
87
- // eslint-disable-next-line no-unused-vars
88
- _reset(context) {
82
+ _reset(_context) {
89
83
  throw new Error('`_reset` must be implemented in sub statedb');
90
84
  }
91
85
 
92
- // eslint-disable-next-line no-unused-vars
93
- _history(id, context) {
86
+ _history(_id, _context) {
94
87
  throw new Error('`_history` must be implemented in sub statedb');
95
88
  }
96
89
 
97
- // eslint-disable-next-line no-unused-vars
98
- updateOrCreate(id, attrs, context) {
90
+ updateOrCreate(_id, _attrs, _context) {
99
91
  throw new Error('`updateOrCreate` must be implemented in sub statedb');
100
92
  }
101
93
 
package/package.json CHANGED
@@ -3,29 +3,27 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.28.5",
6
+ "version": "1.28.7",
7
7
  "description": "Defines the basic interface for OCAP StateDB",
8
8
  "main": "lib/index.js",
9
9
  "files": [
10
10
  "lib"
11
11
  ],
12
+ "scripts": {
13
+ "lint": "biome check",
14
+ "lint:fix": "biome check --write",
15
+ "test": "bun test",
16
+ "coverage": "npm run test -- --coverage"
17
+ },
12
18
  "keywords": [],
13
19
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
14
20
  "license": "MIT",
15
- "devDependencies": {
16
- "jest": "^29.7.0"
17
- },
21
+ "devDependencies": {},
18
22
  "dependencies": {
23
+ "@arcblock/did": "1.28.7",
24
+ "@ocap/state": "1.28.7",
25
+ "@ocap/util": "1.28.7",
19
26
  "kareem": "^2.4.1",
20
- "lodash": "^4.17.21",
21
- "@arcblock/did": "1.28.5",
22
- "@ocap/util": "1.28.5",
23
- "@ocap/state": "1.28.5"
24
- },
25
- "scripts": {
26
- "lint": "eslint tests lib",
27
- "lint:fix": "eslint --fix tests lib",
28
- "test": "jest --forceExit --detectOpenHandles",
29
- "coverage": "npm run test -- --coverage"
27
+ "lodash": "^4.17.21"
30
28
  }
31
- }
29
+ }
package/LICENSE DELETED
@@ -1,13 +0,0 @@
1
- Copyright 2018-2025 ArcBlock
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.