@e-mc/core 0.10.16 → 0.10.17
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/README.md +9 -9
- package/index.js +19 -7
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.17/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { DataSource, LogStatus } from "./squared";
|
|
@@ -67,7 +67,7 @@ interface HostConstructor extends ModuleConstructor {
|
|
|
67
67
|
getThreadCount(full: true): ThreadCountStat;
|
|
68
68
|
getThreadCount(username: string, iv?: BinaryLike): ThreadCountStat;
|
|
69
69
|
getThreadCount(username?: string | boolean, iv?: BinaryLike): number;
|
|
70
|
-
getPermissionFromSettings(): IPermission;
|
|
70
|
+
getPermissionFromSettings(freeze?: boolean): IPermission;
|
|
71
71
|
readonly prototype: IHost;
|
|
72
72
|
new(config?: HostInitConfig): IHost;
|
|
73
73
|
}
|
|
@@ -230,13 +230,13 @@ NOTE: **@e-mc/core** is mostly a collection of abstract base classes which canno
|
|
|
230
230
|
|
|
231
231
|
## References
|
|
232
232
|
|
|
233
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
234
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
235
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
236
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
237
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
238
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
239
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
233
|
+
- https://www.unpkg.com/@e-mc/types@0.10.17/lib/squared.d.ts
|
|
234
|
+
- https://www.unpkg.com/@e-mc/types@0.10.17/lib/core.d.ts
|
|
235
|
+
- https://www.unpkg.com/@e-mc/types@0.10.17/lib/db.d.ts
|
|
236
|
+
- https://www.unpkg.com/@e-mc/types@0.10.17/lib/dom.d.ts
|
|
237
|
+
- https://www.unpkg.com/@e-mc/types@0.10.17/lib/logger.d.ts
|
|
238
|
+
- https://www.unpkg.com/@e-mc/types@0.10.17/lib/node.d.ts
|
|
239
|
+
- https://www.unpkg.com/@e-mc/types@0.10.17/lib/settings.d.ts
|
|
240
240
|
|
|
241
241
|
## LICENSE
|
|
242
242
|
|
package/index.js
CHANGED
|
@@ -235,7 +235,7 @@ function getSettingsValue(options, name, component) {
|
|
|
235
235
|
}
|
|
236
236
|
function isInvalidRange(result, range) {
|
|
237
237
|
const [lower, upper = 0] = range;
|
|
238
|
-
return result.length <= lower || upper > 0 && result.length > upper;
|
|
238
|
+
return Array.isArray(result) && (result.length <= lower || upper > 0 && result.length > upper);
|
|
239
239
|
}
|
|
240
240
|
function asPosix(value) {
|
|
241
241
|
if (module_1.PLATFORM_WIN32) {
|
|
@@ -276,6 +276,7 @@ class Host extends module_1 {
|
|
|
276
276
|
if (permission.unc_write) {
|
|
277
277
|
PERMISSION.setUNCWrite(unc_write);
|
|
278
278
|
}
|
|
279
|
+
Object.freeze(PERMISSION);
|
|
279
280
|
}
|
|
280
281
|
if (perm.settings) {
|
|
281
282
|
const { picomatch: pico, minimatch: mini } = perm.settings;
|
|
@@ -450,8 +451,8 @@ class Host extends module_1 {
|
|
|
450
451
|
static getLogDelayed() {
|
|
451
452
|
return HOST.LOG_DELAYED;
|
|
452
453
|
}
|
|
453
|
-
static getPermissionFromSettings() {
|
|
454
|
-
return PERMISSION;
|
|
454
|
+
static getPermissionFromSettings(freeze = true) {
|
|
455
|
+
return freeze ? PERMISSION : Permission.clone(PERMISSION);
|
|
455
456
|
}
|
|
456
457
|
constructor(config = {}) {
|
|
457
458
|
super();
|
|
@@ -951,6 +952,9 @@ class ClientDb extends Client {
|
|
|
951
952
|
}
|
|
952
953
|
}
|
|
953
954
|
static storeResult(source, credential, queryString, result, options, sessionKey, sessionExpires) {
|
|
955
|
+
if (!credential || !Array.isArray(result)) {
|
|
956
|
+
return result;
|
|
957
|
+
}
|
|
954
958
|
let cache, cacheDir;
|
|
955
959
|
if ((0, types_1.isObject)(sessionKey)) {
|
|
956
960
|
({ cacheDir, sessionKey, sessionExpires } = sessionKey);
|
|
@@ -1015,8 +1019,14 @@ class ClientDb extends Client {
|
|
|
1015
1019
|
}
|
|
1016
1020
|
else if (typeof sessionKey === 'string' && sessionExpires && sessionExpires > 0) {
|
|
1017
1021
|
const dbKey = userKey + sessionKey;
|
|
1018
|
-
|
|
1019
|
-
|
|
1022
|
+
const sourceData = CACHE_SESSION[source] ||= {};
|
|
1023
|
+
let data = sourceData[dbKey];
|
|
1024
|
+
if (!data) {
|
|
1025
|
+
data = {};
|
|
1026
|
+
sourceData[dbKey] = data;
|
|
1027
|
+
setTimeout(() => delete sourceData[dbKey], sessionExpires * 1000);
|
|
1028
|
+
}
|
|
1029
|
+
data[queryString] = result;
|
|
1020
1030
|
}
|
|
1021
1031
|
}
|
|
1022
1032
|
return result;
|
|
@@ -1165,9 +1175,10 @@ class ClientDb extends Client {
|
|
|
1165
1175
|
}
|
|
1166
1176
|
}
|
|
1167
1177
|
const result = ClientDb.findResult(this.moduleName + '_' + source, uuidKey || credential, queryString, value === 0 ? 0 : ClientDb.getTimeout(value || this.settingsOf(source, 'cache')), sessionKey, renewCache);
|
|
1168
|
-
if (
|
|
1169
|
-
return
|
|
1178
|
+
if (exclusiveOf && !isInvalidRange(result, exclusiveOf)) {
|
|
1179
|
+
return;
|
|
1170
1180
|
}
|
|
1181
|
+
return result;
|
|
1171
1182
|
}
|
|
1172
1183
|
setQueryResult(source, credential, queryString, result, sessionKey) {
|
|
1173
1184
|
if (!Array.isArray(result)) {
|
|
@@ -1452,3 +1463,4 @@ class Permission {
|
|
|
1452
1463
|
exports.Permission = Permission;
|
|
1453
1464
|
_f = kDiskRead, _g = kDiskWrite, _h = kUncRead, _j = kUncWrite;
|
|
1454
1465
|
PERMISSION = Host.createPermission(true, true);
|
|
1466
|
+
Object.freeze(PERMISSION);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/core",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.17",
|
|
4
4
|
"description": "Core modules for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/module": "0.10.
|
|
24
|
-
"@e-mc/types": "0.10.
|
|
23
|
+
"@e-mc/module": "0.10.17",
|
|
24
|
+
"@e-mc/types": "0.10.17",
|
|
25
25
|
"picomatch": "^4.0.3"
|
|
26
26
|
}
|
|
27
27
|
}
|