@e-mc/core 0.7.0 → 0.7.2
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 +10 -10
- package/README.md +5 -3
- package/index.d.ts +12 -12
- package/index.js +63 -64
- package/package.json +5 -5
package/LICENSE
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
Copyright 2023
|
|
2
|
-
|
|
3
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
-
|
|
5
|
-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
-
|
|
7
|
-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
-
|
|
9
|
-
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
-
|
|
1
|
+
Copyright 2023 Wit Studio
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
+
|
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
+
|
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
+
|
|
9
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
+
|
|
11
11
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { HostConstructor, ModuleConstructor } from '../types/lib';
|
|
2
|
-
import type { AbortComponentConstructor, ClientConstructor, ClientDbConstructor, PermissionConstructor } from '../types/lib/core';
|
|
3
|
-
|
|
4
|
-
declare namespace core {
|
|
5
|
-
const Module: ModuleConstructor;
|
|
6
|
-
const Host: HostConstructor;
|
|
7
|
-
const Client: ClientConstructor;
|
|
8
|
-
const ClientDb: ClientDbConstructor;
|
|
9
|
-
const AbortComponent: AbortComponentConstructor;
|
|
10
|
-
const Permission: PermissionConstructor;
|
|
11
|
-
}
|
|
12
|
-
|
|
1
|
+
import type { HostConstructor, ModuleConstructor } from '../types/lib';
|
|
2
|
+
import type { AbortComponentConstructor, ClientConstructor, ClientDbConstructor, PermissionConstructor } from '../types/lib/core';
|
|
3
|
+
|
|
4
|
+
declare namespace core {
|
|
5
|
+
const Module: ModuleConstructor;
|
|
6
|
+
const Host: HostConstructor;
|
|
7
|
+
const Client: ClientConstructor;
|
|
8
|
+
const ClientDb: ClientDbConstructor;
|
|
9
|
+
const AbortComponent: AbortComponentConstructor;
|
|
10
|
+
const Permission: PermissionConstructor;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
13
|
export = core;
|
package/index.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
2
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.Module = exports.Permission = exports.AbortComponent = exports.ClientDb = exports.Client = exports.Host = void 0;
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const fs = require("fs");
|
|
7
7
|
const pm = require("picomatch");
|
|
8
|
-
const types_1 = require("
|
|
9
|
-
const module_1 = require("
|
|
8
|
+
const types_1 = require("@e-mc/types");
|
|
9
|
+
const module_1 = require("@e-mc/module");
|
|
10
10
|
exports.Module = module_1.default;
|
|
11
11
|
const kConfig = Symbol('config');
|
|
12
12
|
const kQueued = Symbol('queued');
|
|
13
|
-
const kUsername = Symbol('username');
|
|
14
13
|
const kAbortHandler = Symbol('abortHandler');
|
|
15
14
|
const kFreeze = Symbol('freeze');
|
|
16
15
|
const kDone = Symbol('done');
|
|
@@ -27,7 +26,7 @@ const HOST = {
|
|
|
27
26
|
DONE: new Map(),
|
|
28
27
|
QUEUE: [],
|
|
29
28
|
QUEUE_LIMIT: Infinity,
|
|
30
|
-
QUEUE_EXPIRES: 86400000
|
|
29
|
+
QUEUE_EXPIRES: 86400000,
|
|
31
30
|
PID: 1,
|
|
32
31
|
CLOSED: 0,
|
|
33
32
|
QUEUED: 0,
|
|
@@ -39,31 +38,18 @@ const HOST = {
|
|
|
39
38
|
ADMIN_USERS: [],
|
|
40
39
|
ADMIN_PRIVATE: false,
|
|
41
40
|
THREAD_LIMIT: Infinity,
|
|
42
|
-
THREAD_EXPIRES: 86400000
|
|
41
|
+
THREAD_EXPIRES: 86400000,
|
|
43
42
|
PRIORITY_MIN: 0,
|
|
44
43
|
PRIORITY_MAX: 100,
|
|
45
44
|
PRIORITY_BYPASS: undefined
|
|
46
45
|
};
|
|
47
46
|
const PLATFORM_WIN32 = process.platform === 'win32';
|
|
47
|
+
const HOST_USERNAME = new WeakMap();
|
|
48
48
|
let STORE_RESULT_COUNT = 0;
|
|
49
49
|
let PICOMATCH_OPTIONS = { nocase: PLATFORM_WIN32 };
|
|
50
50
|
let MINIMATCH_OPTIONS = { matchBase: true, nocase: PLATFORM_WIN32 };
|
|
51
51
|
let MINIMATCH;
|
|
52
52
|
let PERMISSION;
|
|
53
|
-
function convertPosix(value) {
|
|
54
|
-
if (value) {
|
|
55
|
-
if ((0, types_1.isString)(value)) {
|
|
56
|
-
return asPosix(value);
|
|
57
|
-
}
|
|
58
|
-
if (Array.isArray(value)) {
|
|
59
|
-
const items = value.filter(item => (0, types_1.isString)(item));
|
|
60
|
-
if (items.length) {
|
|
61
|
-
return items.map(item => asPosix(item));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return '';
|
|
66
|
-
}
|
|
67
53
|
function getSettingsValue(options, name, component) {
|
|
68
54
|
const result = options[name];
|
|
69
55
|
return component ? (0, types_1.isObject)(result) ? result[component] : undefined : result;
|
|
@@ -92,7 +78,7 @@ function callResumeThread(item, aborted) {
|
|
|
92
78
|
if (item.joined) {
|
|
93
79
|
const { instance, args = [], startTime } = item;
|
|
94
80
|
if (!aborted) {
|
|
95
|
-
instance.writeTimeElapsed('JOIN', ['Thread restarting...', HOST.THREAD_LIMIT > 1 ? 'Availability: ' + HOST.DONE.size + ' / ' + HOST.THREAD_LIMIT : ''], startTime, { type: 2
|
|
81
|
+
instance.writeTimeElapsed('JOIN', ['Thread restarting...', HOST.THREAD_LIMIT > 1 ? 'Availability: ' + HOST.DONE.size + ' / ' + HOST.THREAD_LIMIT : ''], startTime, { type: 2, ...module_1.default.LOG_STYLE_WARN });
|
|
96
82
|
}
|
|
97
83
|
queueMicrotask(() => {
|
|
98
84
|
try {
|
|
@@ -104,7 +90,7 @@ function callResumeThread(item, aborted) {
|
|
|
104
90
|
}
|
|
105
91
|
}
|
|
106
92
|
function cancelThread(host, hint, rejected) {
|
|
107
|
-
host.writeFail(["Transaction was cancelled"
|
|
93
|
+
host.writeFail(["Transaction was cancelled", host.username], (0, types_1.errorValue)("Thread was killed", hint), { type: 2, fatal: true });
|
|
108
94
|
host.abort();
|
|
109
95
|
if (rejected) {
|
|
110
96
|
++HOST.REJECTED;
|
|
@@ -121,7 +107,7 @@ function matchPermission(permission, pathname) {
|
|
|
121
107
|
return enabled === true && (0, types_1.isString)(pathname) && (value === '**/*' || value === '**' || Permission.match(pathname, value));
|
|
122
108
|
}
|
|
123
109
|
function setPermission(name, pathname, enabled) {
|
|
124
|
-
if (typeof enabled === 'boolean' && (!this[kFreeze] || this[name].enabled === null) && (!enabled || (pathname =
|
|
110
|
+
if (typeof enabled === 'boolean' && (!this[kFreeze] || this[name].enabled === null) && (!enabled || (pathname = Permission.toPosix(pathname)))) {
|
|
125
111
|
if (enabled && Array.isArray(pathname)) {
|
|
126
112
|
switch (pathname.length) {
|
|
127
113
|
case 1:
|
|
@@ -227,7 +213,7 @@ function resumeHostQueue(host) {
|
|
|
227
213
|
}
|
|
228
214
|
function updateHostQueue(host, position, priority, broadcast) {
|
|
229
215
|
if (!broadcast || host.broadcastId) {
|
|
230
|
-
host.formatMessage(2
|
|
216
|
+
host.formatMessage(2, 'QUEUE', ["Thread limit exceeded" + ` (position #${position + 1})`, host.username], 'Priority: ' + priority, { type: 2, ...module_1.default.LOG_STYLE_WARN });
|
|
231
217
|
}
|
|
232
218
|
}
|
|
233
219
|
function asPosix(value) {
|
|
@@ -235,8 +221,8 @@ function asPosix(value) {
|
|
|
235
221
|
return PLATFORM_WIN32 ? value.replace(/\\/g, '/') : value;
|
|
236
222
|
}
|
|
237
223
|
const readable = (value) => (0, types_1.isString)(value) || (0, types_1.isArray)(value);
|
|
238
|
-
const expireTime = (value) => Date.now() + value * 1000
|
|
239
|
-
const convertSeconds = (value) => typeof value === 'string' && Math.ceil((0, types_1.parseTime)(value) / 1000
|
|
224
|
+
const expireTime = (value) => Date.now() + value * 1000;
|
|
225
|
+
const convertSeconds = (value) => typeof value === 'string' && Math.ceil((0, types_1.parseTime)(value) / 1000) || 0;
|
|
240
226
|
class Host extends module_1.default {
|
|
241
227
|
static purgeMemory(percent = 1, limit = 0, parent) {
|
|
242
228
|
return parent ? super.purgeMemory(percent, limit) : Promise.resolve(0);
|
|
@@ -396,7 +382,7 @@ class Host extends module_1.default {
|
|
|
396
382
|
closeThread(host);
|
|
397
383
|
}
|
|
398
384
|
else if (host.startTime + HOST.THREAD_EXPIRES >= current) {
|
|
399
|
-
host.writeFail(["Transaction was cancelled"
|
|
385
|
+
host.writeFail(["Transaction was cancelled", host.username], (0, types_1.errorValue)("Timeout was exceeded", (0, types_1.formatTime)(HOST.THREAD_EXPIRES)), { fatal: true });
|
|
400
386
|
host.abort();
|
|
401
387
|
closeThread(host);
|
|
402
388
|
}
|
|
@@ -452,10 +438,9 @@ class Host extends module_1.default {
|
|
|
452
438
|
this._usingObjects = new Set();
|
|
453
439
|
this[_a] = false;
|
|
454
440
|
this[_b] = false;
|
|
455
|
-
this[_c] = '';
|
|
456
441
|
const { broadcastId, log, username, priority } = config;
|
|
457
442
|
if ((0, types_1.isString)(username)) {
|
|
458
|
-
this
|
|
443
|
+
HOST_USERNAME.set(this, username);
|
|
459
444
|
}
|
|
460
445
|
if (broadcastId) {
|
|
461
446
|
this.broadcastId = broadcastId;
|
|
@@ -646,7 +631,7 @@ class Host extends module_1.default {
|
|
|
646
631
|
return this[kConfig];
|
|
647
632
|
}
|
|
648
633
|
get username() {
|
|
649
|
-
return this
|
|
634
|
+
return HOST_USERNAME.get(this) || '';
|
|
650
635
|
}
|
|
651
636
|
set done(value) {
|
|
652
637
|
if (value) {
|
|
@@ -665,7 +650,7 @@ class Host extends module_1.default {
|
|
|
665
650
|
}
|
|
666
651
|
}
|
|
667
652
|
exports.Host = Host;
|
|
668
|
-
_a = kDone, _b = kQueued
|
|
653
|
+
_a = kDone, _b = kQueued;
|
|
669
654
|
class Client extends module_1.default {
|
|
670
655
|
static purgeMemory(percent = 1, limit = 0, parent) {
|
|
671
656
|
return parent ? super.purgeMemory(percent, limit) : Promise.resolve(0);
|
|
@@ -673,7 +658,7 @@ class Client extends module_1.default {
|
|
|
673
658
|
constructor(data) {
|
|
674
659
|
super();
|
|
675
660
|
this._extensions = null;
|
|
676
|
-
this[
|
|
661
|
+
this[_c] = '';
|
|
677
662
|
this.module = (0, types_1.isPlainObject)(data) ? data : {};
|
|
678
663
|
}
|
|
679
664
|
init(...args) {
|
|
@@ -702,8 +687,8 @@ class Client extends module_1.default {
|
|
|
702
687
|
return this[kCacheDir];
|
|
703
688
|
}
|
|
704
689
|
get settings() {
|
|
705
|
-
var
|
|
706
|
-
return ((
|
|
690
|
+
var _j;
|
|
691
|
+
return ((_j = this.module).settings || (_j.settings = {}));
|
|
707
692
|
}
|
|
708
693
|
set extensions(values) {
|
|
709
694
|
if (Array.isArray(values)) {
|
|
@@ -716,14 +701,14 @@ class Client extends module_1.default {
|
|
|
716
701
|
}
|
|
717
702
|
}
|
|
718
703
|
exports.Client = Client;
|
|
719
|
-
|
|
704
|
+
_c = kCacheDir;
|
|
720
705
|
class ClientDb extends Client {
|
|
721
|
-
static get TRANSACTION_ACTIVE() { return 1
|
|
722
|
-
static get TRANSACTION_PARTIAL() { return 2
|
|
723
|
-
static get TRANSACTION_COMMIT() { return 4
|
|
724
|
-
static get TRANSACTION_TERMINATE() { return 8
|
|
725
|
-
static get TRANSACTION_ABORT() { return 16
|
|
726
|
-
static get TRANSACTION_FAIL() { return 32
|
|
706
|
+
static get TRANSACTION_ACTIVE() { return 1; }
|
|
707
|
+
static get TRANSACTION_PARTIAL() { return 2; }
|
|
708
|
+
static get TRANSACTION_COMMIT() { return 4; }
|
|
709
|
+
static get TRANSACTION_TERMINATE() { return 8; }
|
|
710
|
+
static get TRANSACTION_ABORT() { return 16; }
|
|
711
|
+
static get TRANSACTION_FAIL() { return 32; }
|
|
727
712
|
static loadSettings(settings, password) {
|
|
728
713
|
if (super.loadSettings({ process: settings.process }, password)) {
|
|
729
714
|
const memory = settings.memory;
|
|
@@ -788,7 +773,7 @@ class ClientDb extends Client {
|
|
|
788
773
|
let result = 0;
|
|
789
774
|
switch (typeof value) {
|
|
790
775
|
case 'number':
|
|
791
|
-
result = value * 1000
|
|
776
|
+
result = value * 1000;
|
|
792
777
|
break;
|
|
793
778
|
case 'string':
|
|
794
779
|
result = (0, types_1.parseTime)(value);
|
|
@@ -841,7 +826,7 @@ class ClientDb extends Client {
|
|
|
841
826
|
}
|
|
842
827
|
}
|
|
843
828
|
static storeResult(source, credential, queryString, result, options, sessionKey, sessionExpires) {
|
|
844
|
-
var
|
|
829
|
+
var _j, _k;
|
|
845
830
|
let cache, cacheDir;
|
|
846
831
|
if ((0, types_1.isObject)(sessionKey)) {
|
|
847
832
|
({ cacheDir, sessionKey, sessionExpires } = sessionKey);
|
|
@@ -884,7 +869,7 @@ class ClientDb extends Client {
|
|
|
884
869
|
queryString = this.asHash(queryString);
|
|
885
870
|
if (timeout > 0) {
|
|
886
871
|
const item = [expireTime(timeout), result, Date.now(), 0];
|
|
887
|
-
((
|
|
872
|
+
((_j = (CACHE_USER[source] || (CACHE_USER[source] = {})))[userKey] || (_j[userKey] = {}))[queryString] = item;
|
|
888
873
|
addSourceResult(source, item);
|
|
889
874
|
if (cacheDir) {
|
|
890
875
|
if (partition) {
|
|
@@ -906,17 +891,17 @@ class ClientDb extends Client {
|
|
|
906
891
|
}
|
|
907
892
|
else if (typeof sessionKey === 'string' && sessionExpires && sessionExpires > 0) {
|
|
908
893
|
const dbKey = userKey + sessionKey;
|
|
909
|
-
((
|
|
910
|
-
setTimeout(() => delete CACHE_SESSION[dbKey], sessionExpires * 1000
|
|
894
|
+
((_k = (CACHE_SESSION[source] || (CACHE_SESSION[source] = {})))[dbKey] || (_k[dbKey] = {}))[queryString] = result;
|
|
895
|
+
setTimeout(() => delete CACHE_SESSION[dbKey], sessionExpires * 1000);
|
|
911
896
|
}
|
|
912
897
|
}
|
|
913
898
|
return result;
|
|
914
899
|
}
|
|
915
|
-
static purgeResult(prefix) {
|
|
900
|
+
static async purgeResult(prefix) {
|
|
916
901
|
const current = Date.now();
|
|
917
902
|
const providers = new Map();
|
|
918
903
|
if (prefix) {
|
|
919
|
-
if (prefix.
|
|
904
|
+
if (!prefix.includes('_')) {
|
|
920
905
|
prefix += '_';
|
|
921
906
|
for (const key in CACHE_USER) {
|
|
922
907
|
if (key.startsWith(prefix)) {
|
|
@@ -977,7 +962,7 @@ class ClientDb extends Client {
|
|
|
977
962
|
constructor(data, database = []) {
|
|
978
963
|
super(data);
|
|
979
964
|
this.database = database;
|
|
980
|
-
this.cacheExpires = 600000
|
|
965
|
+
this.cacheExpires = 600000;
|
|
981
966
|
}
|
|
982
967
|
init(config) {
|
|
983
968
|
let { cache_dir, session_expires: expires } = this.settings;
|
|
@@ -1071,7 +1056,7 @@ class ClientDb extends Client {
|
|
|
1071
1056
|
}
|
|
1072
1057
|
const uuidKey = ClientDb.extractUUID(credential);
|
|
1073
1058
|
let options;
|
|
1074
|
-
if (ClientDb.enabled("memory.settings.users"
|
|
1059
|
+
if (ClientDb.enabled("memory.settings.users", this.host?.username)) {
|
|
1075
1060
|
let value;
|
|
1076
1061
|
if ((0, types_1.isObject)(sessionKey)) {
|
|
1077
1062
|
({ value, sessionKey } = sessionKey);
|
|
@@ -1091,13 +1076,13 @@ class ClientDb extends Client {
|
|
|
1091
1076
|
}
|
|
1092
1077
|
applyState(items, value, as) {
|
|
1093
1078
|
for (const item of Array.isArray(items) ? items : [items]) {
|
|
1094
|
-
if ((0, types_1.hasBit)(value, 8
|
|
1079
|
+
if ((0, types_1.hasBit)(value, 8)) {
|
|
1095
1080
|
const state = item.transactionState || (item.transactionState = 0);
|
|
1096
|
-
if ((0, types_1.hasBit)(state, 4
|
|
1081
|
+
if ((0, types_1.hasBit)(state, 4) || (0, types_1.hasBit)(state, 32)) {
|
|
1097
1082
|
item.transactionState |= value;
|
|
1098
1083
|
}
|
|
1099
1084
|
}
|
|
1100
|
-
else if ((0, types_1.hasBit)(value, 16
|
|
1085
|
+
else if ((0, types_1.hasBit)(value, 16)) {
|
|
1101
1086
|
item.transactionState || (item.transactionState = value);
|
|
1102
1087
|
}
|
|
1103
1088
|
else if (as) {
|
|
@@ -1121,8 +1106,8 @@ class ClientDb extends Client {
|
|
|
1121
1106
|
}
|
|
1122
1107
|
}
|
|
1123
1108
|
settingsKey(uuidKey, name, component) {
|
|
1124
|
-
var
|
|
1125
|
-
const data = ((
|
|
1109
|
+
var _j;
|
|
1110
|
+
const data = ((_j = this.settings).user_key || (_j.user_key = {}))[uuidKey];
|
|
1126
1111
|
if ((0, types_1.isObject)(data)) {
|
|
1127
1112
|
return getSettingsValue(data, name, component);
|
|
1128
1113
|
}
|
|
@@ -1130,22 +1115,22 @@ class ClientDb extends Client {
|
|
|
1130
1115
|
get pending() {
|
|
1131
1116
|
return this.database.filter(item => {
|
|
1132
1117
|
const state = item.transactionState || 0;
|
|
1133
|
-
return state === 0 || state === 16
|
|
1118
|
+
return state === 0 || state === 16;
|
|
1134
1119
|
});
|
|
1135
1120
|
}
|
|
1136
1121
|
get committed() {
|
|
1137
|
-
return this.database.filter(item => (item.transactionState & 4
|
|
1122
|
+
return this.database.filter(item => (item.transactionState & 4) === 4);
|
|
1138
1123
|
}
|
|
1139
1124
|
get failed() {
|
|
1140
|
-
return this.database.filter(item => (item.transactionState & 32
|
|
1125
|
+
return this.database.filter(item => (item.transactionState & 32) === 32);
|
|
1141
1126
|
}
|
|
1142
1127
|
}
|
|
1143
1128
|
exports.ClientDb = ClientDb;
|
|
1144
|
-
ClientDb.STORE_RESULT_PARTITION_SIZE = 16
|
|
1145
|
-
ClientDb.STORE_RESULT_PARTITION_MULT = 2
|
|
1129
|
+
ClientDb.STORE_RESULT_PARTITION_SIZE = 16;
|
|
1130
|
+
ClientDb.STORE_RESULT_PARTITION_MULT = 2;
|
|
1146
1131
|
class AbortComponent {
|
|
1147
1132
|
constructor() {
|
|
1148
|
-
this[
|
|
1133
|
+
this[_d] = new AbortController();
|
|
1149
1134
|
}
|
|
1150
1135
|
static attach(instance, signal, options) {
|
|
1151
1136
|
let map = ABORT_LISTENER.get(instance);
|
|
@@ -1185,7 +1170,7 @@ class AbortComponent {
|
|
|
1185
1170
|
}
|
|
1186
1171
|
}
|
|
1187
1172
|
exports.AbortComponent = AbortComponent;
|
|
1188
|
-
|
|
1173
|
+
_d = kAbortHandler;
|
|
1189
1174
|
class Permission {
|
|
1190
1175
|
static create(settings, parent, freeze) {
|
|
1191
1176
|
if (this.validate(settings)) {
|
|
@@ -1259,11 +1244,25 @@ class Permission {
|
|
|
1259
1244
|
}
|
|
1260
1245
|
return pm.isMatch(pathname, pattern, PICOMATCH_OPTIONS);
|
|
1261
1246
|
}
|
|
1247
|
+
static toPosix(value) {
|
|
1248
|
+
if (value) {
|
|
1249
|
+
if ((0, types_1.isString)(value)) {
|
|
1250
|
+
return asPosix(value);
|
|
1251
|
+
}
|
|
1252
|
+
if (Array.isArray(value)) {
|
|
1253
|
+
const items = value.filter(item => (0, types_1.isString)(item));
|
|
1254
|
+
if (items.length) {
|
|
1255
|
+
return items.map(item => asPosix(item));
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
return '';
|
|
1260
|
+
}
|
|
1262
1261
|
constructor(freeze = false) {
|
|
1262
|
+
this[_e] = { enabled: null, value: '' };
|
|
1263
1263
|
this[_f] = { enabled: null, value: '' };
|
|
1264
1264
|
this[_g] = { enabled: null, value: '' };
|
|
1265
1265
|
this[_h] = { enabled: null, value: '' };
|
|
1266
|
-
this[_j] = { enabled: null, value: '' };
|
|
1267
1266
|
this[kFreeze] = freeze;
|
|
1268
1267
|
}
|
|
1269
1268
|
setDiskRead(pathname = '', enabled = true) {
|
|
@@ -1316,5 +1315,5 @@ class Permission {
|
|
|
1316
1315
|
}
|
|
1317
1316
|
}
|
|
1318
1317
|
exports.Permission = Permission;
|
|
1319
|
-
|
|
1318
|
+
_e = kDiskRead, _f = kDiskWrite, _g = kUncRead, _h = kUncWrite;
|
|
1320
1319
|
PERMISSION = Host.createPermission(true, true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Core 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": "https://github.com/anpham6/e-mc.git",
|
|
12
|
+
"url": "git+https://github.com/anpham6/e-mc.git",
|
|
13
13
|
"directory": "src/core"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"squared-functions"
|
|
18
18
|
],
|
|
19
19
|
"author": "An Pham <anpham6@gmail.com>",
|
|
20
|
-
"license": "
|
|
20
|
+
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/module": "0.7.
|
|
24
|
-
"@e-mc/types": "0.7.
|
|
23
|
+
"@e-mc/module": "0.7.2",
|
|
24
|
+
"@e-mc/types": "0.7.2",
|
|
25
25
|
"picomatch": "^3.0.1"
|
|
26
26
|
}
|
|
27
27
|
}
|