@arken/node 1.5.4 → 1.5.5
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/.rush/temp/shrinkwrap-deps.json +2 -7
- package/build/db.js +3 -21
- package/build/db.js.map +1 -1
- package/build/package.json +1 -8
- package/build/tsconfig.tsbuildinfo +1 -1
- package/db.ts +22 -22
- package/package.json +1 -8
package/db.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReplaySubject } from 'rxjs';
|
|
2
2
|
import Loki from 'lokijs';
|
|
3
|
-
import * as jetpack from 'fs-jetpack';
|
|
3
|
+
// import * as jetpack from 'fs-jetpack';
|
|
4
4
|
import mongoose, {
|
|
5
5
|
ConnectOptions,
|
|
6
6
|
Model as MongooseModel,
|
|
@@ -18,16 +18,17 @@ import fsPath from 'path';
|
|
|
18
18
|
import { v4 as uuidv4 } from 'uuid';
|
|
19
19
|
import _ from 'lodash';
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
export function isPostgresError (error: unknown): boolean {
|
|
21
|
+
export function isPostgresError(error: unknown): boolean {
|
|
23
22
|
if (!error) {
|
|
24
23
|
return false;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
return _.every(['severity', 'code', 'detail', 'internalQuery', 'routine'], (attr) => _.has(error as object, attr));
|
|
28
|
-
}
|
|
27
|
+
}
|
|
29
28
|
|
|
30
|
-
export function isUniqueConstraintViolation
|
|
29
|
+
export function isUniqueConstraintViolation(error) {
|
|
30
|
+
return isPostgresError(error) && error.code === '23505';
|
|
31
|
+
}
|
|
31
32
|
|
|
32
33
|
export function generateLongId(): string {
|
|
33
34
|
return uuidv4().toUpperCase();
|
|
@@ -89,7 +90,6 @@ export function escapeStringRegexp(string: string): string {
|
|
|
89
90
|
return string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
|
|
90
91
|
}
|
|
91
92
|
|
|
92
|
-
|
|
93
93
|
let app: any;
|
|
94
94
|
let log: (...msgs: any[]) => void;
|
|
95
95
|
|
|
@@ -463,27 +463,27 @@ class Database {
|
|
|
463
463
|
restoreData() {
|
|
464
464
|
log('Restoring data', ['p1']);
|
|
465
465
|
|
|
466
|
-
const files = jetpack.find(fsPath.join(__dirname, 'data/db'), { matching: '**/*.json' });
|
|
466
|
+
// const files = jetpack.find(fsPath.join(__dirname, 'data/db'), { matching: '**/*.json' });
|
|
467
467
|
|
|
468
|
-
for (const file of files) {
|
|
469
|
-
|
|
468
|
+
// for (const file of files) {
|
|
469
|
+
// log(`Found file: ${file}`);
|
|
470
470
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
471
|
+
// try {
|
|
472
|
+
// const data = jetpack.read(file, 'json');
|
|
473
|
+
// const [name, key] = file.replace('data/db/', '').replace('.json', '').split('/');
|
|
474
474
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
475
|
+
// this.initCollection(name, key, data as Record<string, any>);
|
|
476
|
+
// } catch (e) {
|
|
477
|
+
// if (e.toString().indexOf('JSON parsing failed') !== -1) {
|
|
478
|
+
// log(`File corrupt, loading backup: ${file}`);
|
|
479
479
|
|
|
480
|
-
|
|
481
|
-
|
|
480
|
+
// const data = jetpack.read(`${file}.backup`, 'json');
|
|
481
|
+
// const [name, key] = file.replace('data/db/', '').replace('.json', '').split('/');
|
|
482
482
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
}
|
|
483
|
+
// this.initCollection(name, key, data as Record<string, any>);
|
|
484
|
+
// }
|
|
485
|
+
// }
|
|
486
|
+
// }
|
|
487
487
|
}
|
|
488
488
|
|
|
489
489
|
beautify(data: any) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arken/node",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/types.d.ts",
|
|
@@ -17,21 +17,14 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@trpc/server": "11.0.0-rc.660",
|
|
19
19
|
"@trpc/client": "11.0.0-rc.660",
|
|
20
|
-
"@typechain/ethers-v4": "^1",
|
|
21
20
|
"axios": "^1",
|
|
22
|
-
"compromise": "^14",
|
|
23
|
-
"cross-fetch": "^4",
|
|
24
21
|
"crypto-js": "^4",
|
|
25
22
|
"dayjs": "^1",
|
|
26
|
-
"es6-promise": "^4",
|
|
27
|
-
"fs-jetpack": "^4",
|
|
28
23
|
"js-md5": "^0",
|
|
29
|
-
"langdetect": "^0",
|
|
30
24
|
"lodash": "^4",
|
|
31
25
|
"lokijs": "^1",
|
|
32
26
|
"moment": "^2",
|
|
33
27
|
"mongoose": "^8",
|
|
34
|
-
"node-fetch": "^3",
|
|
35
28
|
"openai": "^4",
|
|
36
29
|
"pluralize": "^8",
|
|
37
30
|
"puppeteer": "^22",
|