@e-mc/db 0.5.4 → 0.6.1
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/LICENSE +1 -1
- package/README.md +1 -1
- package/index.js +6 -16
- package/package.json +5 -5
- package/util.d.ts +1 -0
- package/util.js +12 -3
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright 2023
|
|
1
|
+
Copyright 2023 Studio Trigger
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -225,24 +225,12 @@ class Db extends core_1.ClientDb {
|
|
|
225
225
|
resolveSource(source, folder) {
|
|
226
226
|
let result;
|
|
227
227
|
if (!source.startsWith('@')) {
|
|
228
|
-
|
|
229
|
-
case 'mongodb':
|
|
230
|
-
case 'mssql':
|
|
231
|
-
case 'mysql':
|
|
232
|
-
case 'oracle':
|
|
233
|
-
case 'postgres':
|
|
234
|
-
case 'redis':
|
|
235
|
-
result = '@pi-r/' + source;
|
|
236
|
-
break;
|
|
237
|
-
default:
|
|
238
|
-
result = source;
|
|
239
|
-
break;
|
|
240
|
-
}
|
|
228
|
+
result = this.settings.imports?.[source] || util_1.IMPORTS[source];
|
|
241
229
|
}
|
|
242
|
-
else if (!
|
|
243
|
-
folder
|
|
230
|
+
else if (!folder && !source.includes('/')) {
|
|
231
|
+
folder = 'client';
|
|
244
232
|
}
|
|
245
|
-
return result + (folder ? '/' + folder : '');
|
|
233
|
+
return (result || source) + (folder ? '/' + folder : '');
|
|
246
234
|
}
|
|
247
235
|
getPoolConfig(source, uuidKey) {
|
|
248
236
|
const config = Db.getPoolConfig(source);
|
|
@@ -286,6 +274,8 @@ class Db extends core_1.ClientDb {
|
|
|
286
274
|
throw (0, types_1.errorMessage)(source, "Database provider not found");
|
|
287
275
|
}
|
|
288
276
|
}
|
|
277
|
+
Db.STORE_RESULT_PARTITION_SIZE = 16;
|
|
278
|
+
Db.STORE_RESULT_PARTITION_MULT = 2;
|
|
289
279
|
Object.freeze(types_1.DB_TYPE);
|
|
290
280
|
Object.freeze(util_1.SQL_COMMAND);
|
|
291
281
|
exports.default = Db;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/db",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "DB modules for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "
|
|
12
|
+
"url": "https://github.com/anpham6/e-mc.git",
|
|
13
13
|
"directory": "src/db"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/core": "0.
|
|
24
|
-
"@e-mc/request": "0.
|
|
25
|
-
"@e-mc/types": "0.
|
|
23
|
+
"@e-mc/core": "0.6.1",
|
|
24
|
+
"@e-mc/request": "0.6.1",
|
|
25
|
+
"@e-mc/types": "0.6.1"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/util.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { SQL_COMMAND, DbConnection, ServerAuth } from '../types/lib/db';
|
|
|
4
4
|
|
|
5
5
|
declare namespace util {
|
|
6
6
|
const SQL_COMMAND: SQL_COMMAND;
|
|
7
|
+
const IMPORTS: Record<string, string | undefined>;
|
|
7
8
|
function getBasicAuth(auth: AuthValue): string;
|
|
8
9
|
function getBasicAuth(username: unknown, password?: unknown): string;
|
|
9
10
|
function hasBasicAuth(value: string): boolean;
|
package/util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasBasicAuth = exports.getBasicAuth = exports.setUUIDKey = exports.checkEmpty = exports.parseConnectionString = exports.parseServerAuth = exports.SQL_COMMAND = void 0;
|
|
3
|
+
exports.hasBasicAuth = exports.getBasicAuth = exports.setUUIDKey = exports.checkEmpty = exports.parseConnectionString = exports.parseServerAuth = exports.IMPORTS = exports.SQL_COMMAND = void 0;
|
|
4
4
|
const types_1 = require("@e-mc/types");
|
|
5
5
|
const util_1 = require("@e-mc/request/util");
|
|
6
6
|
Object.defineProperty(exports, "getBasicAuth", { enumerable: true, get: function () { return util_1.getBasicAuth; } });
|
|
@@ -11,7 +11,16 @@ var SQL_COMMAND;
|
|
|
11
11
|
SQL_COMMAND[SQL_COMMAND["INSERT"] = 2] = "INSERT";
|
|
12
12
|
SQL_COMMAND[SQL_COMMAND["UPDATE"] = 3] = "UPDATE";
|
|
13
13
|
SQL_COMMAND[SQL_COMMAND["DELETE"] = 4] = "DELETE";
|
|
14
|
-
})(SQL_COMMAND
|
|
14
|
+
})(SQL_COMMAND || (exports.SQL_COMMAND = SQL_COMMAND = {}));
|
|
15
|
+
exports.IMPORTS = {
|
|
16
|
+
"mongodb": "@pi-r/mongodb",
|
|
17
|
+
"redis": "@pi-r/redis",
|
|
18
|
+
"mysql": "@pi-r/mysql",
|
|
19
|
+
"postgres": "@pi-r/postgres",
|
|
20
|
+
"mssql": "@pi-r/mssql",
|
|
21
|
+
"oracle": "@pi-r/oracle",
|
|
22
|
+
"mariadb": "@pi-r/mariadb"
|
|
23
|
+
};
|
|
15
24
|
function parseServerAuth(credential, port, all) {
|
|
16
25
|
if (typeof port === 'boolean') {
|
|
17
26
|
all = port;
|
|
@@ -91,7 +100,7 @@ function parseConnectionString(value, scheme = 'http') {
|
|
|
91
100
|
}
|
|
92
101
|
exports.parseConnectionString = parseConnectionString;
|
|
93
102
|
function checkEmpty(value) {
|
|
94
|
-
return value === undefined || value === null ? false : value === 0 || (value instanceof Set ? value.size === 0 : (Array.isArray(value) || (0, types_1.isObject)(value)) && value.length === 0);
|
|
103
|
+
return value === undefined || value === null ? false : value === 0 || (value instanceof Set || value instanceof Map ? value.size === 0 : (Array.isArray(value) || (0, types_1.isObject)(value)) && value.length === 0);
|
|
95
104
|
}
|
|
96
105
|
exports.checkEmpty = checkEmpty;
|
|
97
106
|
function setUUIDKey(item, value) {
|