ueberdb2 4.2.102 → 4.2.104
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rusty_db.d.ts","sourceRoot":"","sources":["../../databases/rusty_db.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AAEvD,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,gBAAgB;IAClD,EAAE,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"rusty_db.d.ts","sourceRoot":"","sources":["../../databases/rusty_db.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AAEvD,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,gBAAgB;IAClD,EAAE,EAAE,GAAG,GAAE,IAAI,GAAE,SAAS,CAAA;gBAEZ,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;IAaV,KAAK;IAKL,MAAM,CAAC,GAAG,EAAE,MAAM;IAIlB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAS9B,OAAO;CAGV"}
|
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
import { BulkObject } from "./cassandra_db";
|
|
2
2
|
import AbstractDatabase, { Settings } from "../lib/AbstractDatabase";
|
|
3
|
+
/**
|
|
4
|
+
* 2011 Peter 'Pita' Martischka
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
3
18
|
export default class SQLiteDB extends AbstractDatabase {
|
|
4
19
|
db: any | null;
|
|
5
20
|
constructor(settings: Settings);
|
|
6
21
|
init(callback: Function): void;
|
|
7
|
-
_query(sql: string, params?: never[]): Promise<any>;
|
|
8
22
|
get(key: string, callback: Function): void;
|
|
9
23
|
findKeys(key: string, notKey: string, callback: Function): void;
|
|
10
24
|
set(key: string, value: string, callback: Function): void;
|
|
11
25
|
remove(key: string, callback: Function): void;
|
|
12
|
-
handleBulk(bulk: BulkObject): string;
|
|
13
26
|
doBulk(bulk: BulkObject[], callback: Function): void;
|
|
14
27
|
close(callback: Function): void;
|
|
15
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite_db.d.ts","sourceRoot":"","sources":["../../databases/sqlite_db.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,gBAAgB,EAAE,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"sqlite_db.d.ts","sourceRoot":"","sources":["../../databases/sqlite_db.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,gBAAgB,EAAE,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAEnE;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,gBAAgB;IAC7C,EAAE,EAAE,GAAG,GAAC,IAAI,CAAC;gBACR,QAAQ,EAAC,QAAQ;IAsB7B,IAAI,CAAC,QAAQ,EAAE,QAAQ;IAevB,GAAG,CAAC,GAAG,EAAC,MAAM,EAAE,QAAQ,EAAC,QAAQ;IAKjC,QAAQ,CAAC,GAAG,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,EAAE,QAAQ,EAAC,QAAQ;IAMrD,GAAG,CAAC,GAAG,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,QAAQ,EAAC,QAAQ;IAK/C,MAAM,CAAC,GAAG,EAAC,MAAM,EAAE,QAAQ,EAAC,QAAQ;IAMpC,MAAM,CAAC,IAAI,EAAC,UAAU,EAAE,EAAE,QAAQ,EAAC,QAAQ;IAgB3C,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAIzB"}
|
package/dist/index.js
CHANGED
|
@@ -326147,7 +326147,6 @@ class Rethink_db extends AbstractDatabase {
|
|
|
326147
326147
|
* See the License for the specific language governing permissions and
|
|
326148
326148
|
* limitations under the License.
|
|
326149
326149
|
*/
|
|
326150
|
-
const escape$1 = (val) => `'${val.replace(/'/g, "''")}'`;
|
|
326151
326150
|
class SQLiteDB extends AbstractDatabase {
|
|
326152
326151
|
db;
|
|
326153
326152
|
constructor(settings) {
|
|
@@ -326172,71 +326171,45 @@ class SQLiteDB extends AbstractDatabase {
|
|
|
326172
326171
|
init(callback) {
|
|
326173
326172
|
let SQLITEDB;
|
|
326174
326173
|
try {
|
|
326175
|
-
SQLITEDB = require('
|
|
326174
|
+
SQLITEDB = require('rusty-store-kv');
|
|
326176
326175
|
}
|
|
326177
326176
|
catch (err) {
|
|
326178
|
-
throw new Error('
|
|
326177
|
+
throw new Error('rusty-store-kv not found. It was removed from ueberdb\'s dependencies because it requires ' +
|
|
326179
326178
|
'compilation which fails on several systems. If you still want to use sqlite, run ' +
|
|
326180
|
-
'"pnpm install
|
|
326179
|
+
'"pnpm install rusty-store-kv" in your etherpad-lite ./src directory.');
|
|
326181
326180
|
}
|
|
326182
|
-
this.db = new SQLITEDB(this.settings.filename);
|
|
326183
|
-
this._query('CREATE TABLE IF NOT EXISTS store (key TEXT PRIMARY KEY, value TEXT)');
|
|
326181
|
+
this.db = new SQLITEDB.SQLite(this.settings.filename);
|
|
326184
326182
|
callback();
|
|
326185
326183
|
}
|
|
326186
|
-
async _query(sql, params = []) {
|
|
326187
|
-
// It is unclear how util.promisify() deals with variadic functions, so it is not used here.
|
|
326188
|
-
// According to sqlite3's documentation, .run() method (and maybe .all() and .get(); the
|
|
326189
|
-
// documentation is unclear) might call the callback multiple times. That's OK -- ECMAScript
|
|
326190
|
-
// guarantees that it is safe to call a Promise executor's resolve and reject functions
|
|
326191
|
-
// multiple times. The subsequent calls are ignored, except Node.js's 'process' object emits a
|
|
326192
|
-
// 'multipleResolves' event to aid in debugging.
|
|
326193
|
-
return this.db.prepare(sql).run(params);
|
|
326194
|
-
}
|
|
326195
326184
|
get(key, callback) {
|
|
326196
|
-
const res = this.db.
|
|
326197
|
-
callback(null, res ? res
|
|
326185
|
+
const res = this.db.get(key);
|
|
326186
|
+
callback(null, res ? res : null);
|
|
326198
326187
|
}
|
|
326199
326188
|
findKeys(key, notKey, callback) {
|
|
326200
|
-
|
|
326201
|
-
const params = [];
|
|
326202
|
-
// desired keys are %key:%, e.g. pad:%
|
|
326203
|
-
key = key.replace(/\*/g, '%');
|
|
326204
|
-
params.push(key);
|
|
326205
|
-
if (notKey != null) {
|
|
326206
|
-
// not desired keys are notKey:%, e.g. %:%:%
|
|
326207
|
-
notKey = notKey.replace(/\*/g, '%');
|
|
326208
|
-
query += ' AND key NOT LIKE ?';
|
|
326209
|
-
params.push(notKey);
|
|
326210
|
-
}
|
|
326211
|
-
const res = this.db.prepare(query).all(params).map((row) => row.key);
|
|
326189
|
+
const res = this.db?.findKeys(key, notKey);
|
|
326212
326190
|
callback(null, res);
|
|
326213
326191
|
}
|
|
326214
326192
|
set(key, value, callback) {
|
|
326215
|
-
const res = this.db.
|
|
326216
|
-
res
|
|
326193
|
+
const res = this.db.set(key, value);
|
|
326194
|
+
res ? callback(null, null) : callback(null, res);
|
|
326217
326195
|
}
|
|
326218
326196
|
remove(key, callback) {
|
|
326219
|
-
this.db.
|
|
326197
|
+
this.db.remove(key);
|
|
326220
326198
|
callback(null, null);
|
|
326221
326199
|
}
|
|
326222
|
-
handleBulk(bulk) {
|
|
326223
|
-
let statement = '';
|
|
326224
|
-
if (bulk.type === 'set') {
|
|
326225
|
-
statement = `REPLACE INTO store VALUES (${escape$1(bulk.key)}, ${escape$1(bulk.value)});`;
|
|
326226
|
-
}
|
|
326227
|
-
else if (bulk.type === 'remove') {
|
|
326228
|
-
statement = `DELETE FROM store WHERE key = ${escape$1(bulk.key)};\n`;
|
|
326229
|
-
}
|
|
326230
|
-
return statement;
|
|
326231
|
-
}
|
|
326232
326200
|
doBulk(bulk, callback) {
|
|
326233
|
-
const
|
|
326234
|
-
|
|
326235
|
-
|
|
326236
|
-
|
|
326237
|
-
|
|
326201
|
+
const convertedBulk = bulk.map(b => {
|
|
326202
|
+
if (b.value === null) {
|
|
326203
|
+
return {
|
|
326204
|
+
key: b.key,
|
|
326205
|
+
type: b.type
|
|
326206
|
+
};
|
|
326207
|
+
}
|
|
326208
|
+
else {
|
|
326209
|
+
return b;
|
|
326210
|
+
}
|
|
326238
326211
|
});
|
|
326239
|
-
|
|
326212
|
+
this.db.doBulk(convertedBulk);
|
|
326240
326213
|
callback();
|
|
326241
326214
|
}
|
|
326242
326215
|
close(callback) {
|
|
@@ -335368,8 +335341,8 @@ class SurrealDB extends AbstractDatabase {
|
|
|
335368
335341
|
RUSTY_DB = await import('rusty-store-kv');
|
|
335369
335342
|
}
|
|
335370
335343
|
catch (err) {
|
|
335371
|
-
throw new Error('
|
|
335372
|
-
'compilation which fails on several systems. If you still want to use
|
|
335344
|
+
throw new Error('rusty-store-kv not found. It was removed from ueberdb\'s dependencies because it requires ' +
|
|
335345
|
+
'compilation which fails on several systems. If you still want to use rusty store kv, run ' +
|
|
335373
335346
|
'"pnpm install rusty-store-kv" in your etherpad-lite ./src directory.');
|
|
335374
335347
|
}
|
|
335375
335348
|
this.db = new RUSTY_DB.KeyValueDB(this.settings.filename);
|
package/package.json
CHANGED
|
@@ -28,14 +28,12 @@
|
|
|
28
28
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
29
29
|
"@rollup/plugin-terser": "^0.4.4",
|
|
30
30
|
"@types/async": "^3.2.24",
|
|
31
|
-
"@types/better-sqlite3": "^7.6.11",
|
|
32
31
|
"@types/mssql": "^9.1.5",
|
|
33
32
|
"@types/node": "^22.5.4",
|
|
34
33
|
"@types/pg": "^8.11.8",
|
|
35
34
|
"@types/rethinkdb": "^2.3.21",
|
|
36
35
|
"@types/wtfnode": "^0.7.3",
|
|
37
36
|
"async": "^3.2.6",
|
|
38
|
-
"better-sqlite3": "^11.2.1",
|
|
39
37
|
"cassandra-driver": "^4.7.2",
|
|
40
38
|
"cli-table3": "^0.6.5",
|
|
41
39
|
"dirty-ts": "^1.1.8",
|
|
@@ -53,7 +51,7 @@
|
|
|
53
51
|
"rethinkdb": "^2.4.2",
|
|
54
52
|
"rollup": "^4.21.2",
|
|
55
53
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
56
|
-
"rusty-store-kv": "^1.
|
|
54
|
+
"rusty-store-kv": "^1.2.0",
|
|
57
55
|
"semver": "^7.6.3",
|
|
58
56
|
"simple-git": "^3.26.0",
|
|
59
57
|
"surrealdb.js": "^0.11.1",
|
|
@@ -67,7 +65,7 @@
|
|
|
67
65
|
"url": "https://github.com/ether/ueberDB.git"
|
|
68
66
|
},
|
|
69
67
|
"main": "./dist/index.js",
|
|
70
|
-
"version": "4.2.
|
|
68
|
+
"version": "4.2.104",
|
|
71
69
|
"bugs": {
|
|
72
70
|
"url": "https://github.com/ether/ueberDB/issues"
|
|
73
71
|
},
|