ueberdb2 4.2.98 → 4.2.99
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.
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import AbstractDatabase from "../lib/AbstractDatabase";
|
|
2
2
|
import { KeyValueDB } from "rusty-store-kv";
|
|
3
3
|
export default class Rusty_db extends AbstractDatabase {
|
|
4
|
-
db: KeyValueDB | null;
|
|
4
|
+
db: KeyValueDB | null | undefined;
|
|
5
5
|
constructor(settings: {
|
|
6
6
|
filename: string;
|
|
7
7
|
});
|
|
8
8
|
get isAsync(): boolean;
|
|
9
9
|
findKeys(key: string, notKey?: string): string[];
|
|
10
|
-
get(key: string):
|
|
10
|
+
get(key: string): any;
|
|
11
11
|
init(): Promise<void>;
|
|
12
12
|
close(): void;
|
|
13
13
|
remove(key: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rusty_db.d.ts","sourceRoot":"","sources":["../../databases/rusty_db.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,gBAAgB;IAClD,EAAE,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"rusty_db.d.ts","sourceRoot":"","sources":["../../databases/rusty_db.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,gBAAgB;IAClD,EAAE,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,CAAA;gBAGrB,QAAQ,EAAE;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAC;IASxC,IAAI,OAAO,YAEV;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAC,MAAM;IAIpC,GAAG,CAAC,GAAG,EAAE,MAAM;IAYT,IAAI;IAIV,KAAK;IAKL,MAAM,CAAC,GAAG,EAAE,MAAM;IAIlB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAS9B,OAAO;CAGV"}
|
package/dist/index.js
CHANGED
|
@@ -335339,7 +335339,6 @@ class SurrealDB extends AbstractDatabase {
|
|
|
335339
335339
|
db;
|
|
335340
335340
|
constructor(settings) {
|
|
335341
335341
|
super(settings);
|
|
335342
|
-
this.db = new rustyStoreKv.KeyValueDB(this.settings.filename);
|
|
335343
335342
|
// set default settings
|
|
335344
335343
|
this.settings.cache = 0;
|
|
335345
335344
|
this.settings.writeInterval = 0;
|
|
@@ -335352,18 +335351,35 @@ class SurrealDB extends AbstractDatabase {
|
|
|
335352
335351
|
return this.db.findKeys(key, notKey);
|
|
335353
335352
|
}
|
|
335354
335353
|
get(key) {
|
|
335355
|
-
|
|
335354
|
+
const val = this.db.get(key);
|
|
335355
|
+
if (!val) {
|
|
335356
|
+
return val;
|
|
335357
|
+
}
|
|
335358
|
+
try {
|
|
335359
|
+
return JSON.parse(val);
|
|
335360
|
+
}
|
|
335361
|
+
catch (e) {
|
|
335362
|
+
return val;
|
|
335363
|
+
}
|
|
335356
335364
|
}
|
|
335357
335365
|
async init() {
|
|
335358
|
-
|
|
335366
|
+
this.db = new rustyStoreKv.KeyValueDB(this.settings.filename);
|
|
335359
335367
|
}
|
|
335360
335368
|
close() {
|
|
335369
|
+
this.db?.close();
|
|
335370
|
+
this.db = null;
|
|
335361
335371
|
}
|
|
335362
335372
|
remove(key) {
|
|
335363
335373
|
this.db.remove(key);
|
|
335364
335374
|
}
|
|
335365
335375
|
set(key, value) {
|
|
335366
|
-
|
|
335376
|
+
if (typeof value === "object") {
|
|
335377
|
+
const valStr = JSON.stringify(value);
|
|
335378
|
+
this.db.set(key, valStr);
|
|
335379
|
+
}
|
|
335380
|
+
else {
|
|
335381
|
+
this.db.set(key, value.toString());
|
|
335382
|
+
}
|
|
335367
335383
|
}
|
|
335368
335384
|
destroy() {
|
|
335369
335385
|
this.db.destroy();
|
package/package.json
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@types/async": "^3.2.24",
|
|
31
31
|
"@types/better-sqlite3": "^7.6.11",
|
|
32
32
|
"@types/mssql": "^9.1.5",
|
|
33
|
-
"@types/node": "^22.5.
|
|
33
|
+
"@types/node": "^22.5.3",
|
|
34
34
|
"@types/pg": "^8.11.8",
|
|
35
35
|
"@types/rethinkdb": "^2.3.21",
|
|
36
36
|
"@types/wtfnode": "^0.7.3",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"rethinkdb": "^2.4.2",
|
|
54
54
|
"rollup": "^4.21.2",
|
|
55
55
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
56
|
-
"rusty-store-kv": "^1.1.
|
|
56
|
+
"rusty-store-kv": "^1.1.4",
|
|
57
57
|
"semver": "^7.6.3",
|
|
58
58
|
"simple-git": "^3.26.0",
|
|
59
59
|
"surrealdb.js": "^0.11.1",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"url": "https://github.com/ether/ueberDB.git"
|
|
68
68
|
},
|
|
69
69
|
"main": "./dist/index.js",
|
|
70
|
-
"version": "4.2.
|
|
70
|
+
"version": "4.2.99",
|
|
71
71
|
"bugs": {
|
|
72
72
|
"url": "https://github.com/ether/ueberDB/issues"
|
|
73
73
|
},
|