@ocap/statedb 1.30.23 → 1.30.25

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.mjs CHANGED
@@ -96,7 +96,7 @@ var StateDBTable = class extends Ready {
96
96
  generatePrimaryKey(doc) {
97
97
  if (typeof doc === "string") return doc;
98
98
  if (Array.isArray(this.uniqIndex)) {
99
- const key = this.uniqIndex.map((id) => doc[id]).map((item) => typeof item === "object" ? JSON.stringify(item) : item).join("-");
99
+ const key = this.uniqIndex.map((id) => doc[id]).map((item) => typeof item === "object" ? JSON.stringify(item) : String(item ?? "")).map((item) => item.replace(/\\/g, "\\\\").replace(/-/g, "\\-")).join("-");
100
100
  return crypto.createHash("md5").update(key).digest("hex");
101
101
  }
102
102
  return doc[this.uniqIndex];
package/lib/table.cjs CHANGED
@@ -102,7 +102,7 @@ var StateDBTable = class extends _ocap_util_lib_ready.Ready {
102
102
  generatePrimaryKey(doc) {
103
103
  if (typeof doc === "string") return doc;
104
104
  if (Array.isArray(this.uniqIndex)) {
105
- const key = this.uniqIndex.map((id) => doc[id]).map((item) => typeof item === "object" ? JSON.stringify(item) : item).join("-");
105
+ const key = this.uniqIndex.map((id) => doc[id]).map((item) => typeof item === "object" ? JSON.stringify(item) : String(item ?? "")).map((item) => item.replace(/\\/g, "\\\\").replace(/-/g, "\\-")).join("-");
106
106
  return node_crypto.default.createHash("md5").update(key).digest("hex");
107
107
  }
108
108
  return doc[this.uniqIndex];
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.30.23",
6
+ "version": "1.30.25",
7
7
  "description": "Defines the basic interface for OCAP StateDB",
8
8
  "type": "module",
9
9
  "main": "./lib/index.cjs",
@@ -44,10 +44,10 @@
44
44
  "license": "MIT",
45
45
  "devDependencies": {},
46
46
  "dependencies": {
47
- "@arcblock/did": "1.30.23",
48
- "@ocap/state": "1.30.23",
49
- "@ocap/types": "1.30.23",
50
- "@ocap/util": "1.30.23",
47
+ "@arcblock/did": "1.30.25",
48
+ "@ocap/state": "1.30.25",
49
+ "@ocap/types": "1.30.25",
50
+ "@ocap/util": "1.30.25",
51
51
  "kareem": "^2.4.1",
52
52
  "lodash": "^4.17.23"
53
53
  }