@e-mc/core 0.8.27 → 0.8.28
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 +20 -8
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
12
|
+
- https://www.unpkg.com/@e-mc/types@0.8.28/lib/index.d.ts
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { DataSource, LogStatus } from "./squared";
|
|
@@ -61,7 +61,7 @@ interface HostConstructor extends ModuleConstructor {
|
|
|
61
61
|
getThreadCount(full: true): ThreadCountStat;
|
|
62
62
|
getThreadCount(username: string, iv?: BinaryLike): ThreadCountStat;
|
|
63
63
|
getThreadCount(username?: string | boolean, iv?: BinaryLike): number;
|
|
64
|
-
getPermissionFromSettings(): IPermission;
|
|
64
|
+
getPermissionFromSettings(freeze?: boolean): IPermission;
|
|
65
65
|
readonly prototype: IHost;
|
|
66
66
|
new(config?: HostInitConfig): IHost;
|
|
67
67
|
}
|
|
@@ -165,13 +165,13 @@ interface IPermission {
|
|
|
165
165
|
|
|
166
166
|
## References
|
|
167
167
|
|
|
168
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
169
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
170
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
171
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
172
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
173
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
174
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
168
|
+
- https://www.unpkg.com/@e-mc/types@0.8.28/lib/squared.d.ts
|
|
169
|
+
- https://www.unpkg.com/@e-mc/types@0.8.28/lib/core.d.ts
|
|
170
|
+
- https://www.unpkg.com/@e-mc/types@0.8.28/lib/db.d.ts
|
|
171
|
+
- https://www.unpkg.com/@e-mc/types@0.8.28/lib/dom.d.ts
|
|
172
|
+
- https://www.unpkg.com/@e-mc/types@0.8.28/lib/logger.d.ts
|
|
173
|
+
- https://www.unpkg.com/@e-mc/types@0.8.28/lib/node.d.ts
|
|
174
|
+
- https://www.unpkg.com/@e-mc/types@0.8.28/lib/settings.d.ts
|
|
175
175
|
|
|
176
176
|
## LICENSE
|
|
177
177
|
|
package/index.js
CHANGED
|
@@ -218,7 +218,7 @@ function updateHostQueue(host, position, priority, broadcast) {
|
|
|
218
218
|
}
|
|
219
219
|
function isInvalidRange(result, range) {
|
|
220
220
|
const [lower, upper = 0] = range;
|
|
221
|
-
return result.length <= lower || upper > 0 && result.length > upper;
|
|
221
|
+
return Array.isArray(result) && (result.length <= lower || upper > 0 && result.length > upper);
|
|
222
222
|
}
|
|
223
223
|
function asPosix(value) {
|
|
224
224
|
if (PLATFORM_WIN32) {
|
|
@@ -259,6 +259,7 @@ class Host extends module_1.default {
|
|
|
259
259
|
if (permission.unc_write) {
|
|
260
260
|
PERMISSION.setUNCWrite(unc_write);
|
|
261
261
|
}
|
|
262
|
+
Object.freeze(PERMISSION);
|
|
262
263
|
}
|
|
263
264
|
if ((0, types_1.isObject)(perm.settings)) {
|
|
264
265
|
const { picomatch: pico, minimatch: mini } = perm.settings;
|
|
@@ -430,8 +431,8 @@ class Host extends module_1.default {
|
|
|
430
431
|
}
|
|
431
432
|
return count;
|
|
432
433
|
}
|
|
433
|
-
static getPermissionFromSettings() {
|
|
434
|
-
return PERMISSION;
|
|
434
|
+
static getPermissionFromSettings(freeze = true) {
|
|
435
|
+
return freeze ? PERMISSION : Permission.clone(PERMISSION);
|
|
435
436
|
}
|
|
436
437
|
constructor(config = {}) {
|
|
437
438
|
super();
|
|
@@ -842,7 +843,10 @@ class ClientDb extends Client {
|
|
|
842
843
|
}
|
|
843
844
|
}
|
|
844
845
|
static storeResult(source, credential, queryString, result, options, sessionKey, sessionExpires) {
|
|
845
|
-
var _j
|
|
846
|
+
var _j;
|
|
847
|
+
if (!credential || !Array.isArray(result)) {
|
|
848
|
+
return result;
|
|
849
|
+
}
|
|
846
850
|
let cache, cacheDir;
|
|
847
851
|
if ((0, types_1.isObject)(sessionKey)) {
|
|
848
852
|
({ cacheDir, sessionKey, sessionExpires } = sessionKey);
|
|
@@ -907,8 +911,14 @@ class ClientDb extends Client {
|
|
|
907
911
|
}
|
|
908
912
|
else if (typeof sessionKey === 'string' && sessionExpires && sessionExpires > 0) {
|
|
909
913
|
const dbKey = userKey + sessionKey;
|
|
910
|
-
|
|
911
|
-
|
|
914
|
+
const sourceData = CACHE_SESSION[source] || (CACHE_SESSION[source] = {});
|
|
915
|
+
let data = sourceData[dbKey];
|
|
916
|
+
if (!data) {
|
|
917
|
+
data = {};
|
|
918
|
+
sourceData[dbKey] = data;
|
|
919
|
+
setTimeout(() => delete sourceData[dbKey], sessionExpires * 1000);
|
|
920
|
+
}
|
|
921
|
+
data[queryString] = result;
|
|
912
922
|
}
|
|
913
923
|
}
|
|
914
924
|
return result;
|
|
@@ -1070,9 +1080,10 @@ class ClientDb extends Client {
|
|
|
1070
1080
|
}
|
|
1071
1081
|
}
|
|
1072
1082
|
const result = ClientDb.findResult(this.moduleName + '_' + source, uuidKey || credential, queryString, value === 0 ? 0 : ClientDb.getTimeout(value || this.settingsOf(source, 'cache')), sessionKey, renewCache);
|
|
1073
|
-
if (
|
|
1074
|
-
return
|
|
1083
|
+
if (exclusiveOf && isInvalidRange(result, exclusiveOf)) {
|
|
1084
|
+
return;
|
|
1075
1085
|
}
|
|
1086
|
+
return result;
|
|
1076
1087
|
}
|
|
1077
1088
|
setQueryResult(source, credential, queryString, result, sessionKey) {
|
|
1078
1089
|
var _j;
|
|
@@ -1351,3 +1362,4 @@ class Permission {
|
|
|
1351
1362
|
exports.Permission = Permission;
|
|
1352
1363
|
_e = kDiskRead, _f = kDiskWrite, _g = kUncRead, _h = kUncWrite;
|
|
1353
1364
|
PERMISSION = Host.createPermission(true, true);
|
|
1365
|
+
Object.freeze(PERMISSION);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.28",
|
|
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.8.
|
|
24
|
-
"@e-mc/types": "0.8.
|
|
23
|
+
"@e-mc/module": "0.8.28",
|
|
24
|
+
"@e-mc/types": "0.8.28",
|
|
25
25
|
"picomatch": "^3.0.1"
|
|
26
26
|
}
|
|
27
27
|
}
|