@e-mc/file-manager 0.8.4 → 0.8.6
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 +11 -11
- package/index.js +172 -176
- package/package.json +10 -10
package/LICENSE
CHANGED
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.6/lib/index.d.ts
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { DataSource, IncrementalMatch, TaskAction } from "./squared";
|
|
@@ -24,8 +24,8 @@ import type { RequestData, Settings } from "./node";
|
|
|
24
24
|
import type { Aria2Options, BufferFormat, OpenOptions } from "./request";
|
|
25
25
|
import type { CloudModule, CompressModule, DbModule, DocumentModule, HttpConnectSettings, HttpMemorySettings, ImageModule, RequestModule, TaskModule, WatchModule } from "./settings";
|
|
26
26
|
|
|
27
|
-
import type { NoParamCallback } from "fs";
|
|
28
27
|
import type { SpawnOptions } from "child_process";
|
|
28
|
+
import type { NoParamCallback } from "fs";
|
|
29
29
|
|
|
30
30
|
interface IFileManager extends IHost, Set<string> {
|
|
31
31
|
finalizeState: number;
|
|
@@ -191,15 +191,15 @@ interface FileManagerConstructor extends HostConstructor {
|
|
|
191
191
|
|
|
192
192
|
## References
|
|
193
193
|
|
|
194
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
195
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
196
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
197
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
198
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
199
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
200
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
201
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
202
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
194
|
+
- https://www.unpkg.com/@e-mc/types@0.8.6/lib/squared.d.ts
|
|
195
|
+
- https://www.unpkg.com/@e-mc/types@0.8.6/lib/asset.d.ts
|
|
196
|
+
- https://www.unpkg.com/@e-mc/types@0.8.6/lib/core.d.ts
|
|
197
|
+
- https://www.unpkg.com/@e-mc/types@0.8.6/lib/filemanager.d.ts
|
|
198
|
+
- https://www.unpkg.com/@e-mc/types@0.8.6/lib/logger.d.ts
|
|
199
|
+
- https://www.unpkg.com/@e-mc/types@0.8.6/lib/module.d.ts
|
|
200
|
+
- https://www.unpkg.com/@e-mc/types@0.8.6/lib/node.d.ts
|
|
201
|
+
- https://www.unpkg.com/@e-mc/types@0.8.6/lib/request.d.ts
|
|
202
|
+
- https://www.unpkg.com/@e-mc/types@0.8.6/lib/settings.d.ts
|
|
203
203
|
|
|
204
204
|
## LICENSE
|
|
205
205
|
|
package/index.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* eslint @typescript-eslint/no-explicit-any: "off" */
|
|
3
2
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
4
|
const path = require("path");
|
|
6
5
|
const fs = require("fs");
|
|
7
6
|
const pm = require("picomatch");
|
|
8
|
-
const lib_v4_1 = require("
|
|
9
|
-
const util_1 = require("
|
|
10
|
-
const asset_1 = require("
|
|
11
|
-
const util_2 = require("
|
|
12
|
-
const types_1 = require("
|
|
13
|
-
const core_1 = require("
|
|
14
|
-
const request_1 = require("
|
|
15
|
-
const document_1 = require("
|
|
16
|
-
const task_1 = require("
|
|
17
|
-
const image_1 = require("
|
|
18
|
-
const watch_1 = require("
|
|
19
|
-
const compress_1 = require("
|
|
20
|
-
const cloud_1 = require("
|
|
7
|
+
const lib_v4_1 = require("@e-mc/module/lib-v4");
|
|
8
|
+
const util_1 = require("@e-mc/request/util");
|
|
9
|
+
const asset_1 = require("@e-mc/document/asset");
|
|
10
|
+
const util_2 = require("@e-mc/document/util");
|
|
11
|
+
const types_1 = require("@e-mc/types");
|
|
12
|
+
const core_1 = require("@e-mc/core");
|
|
13
|
+
const request_1 = require("@e-mc/request");
|
|
14
|
+
const document_1 = require("@e-mc/document");
|
|
15
|
+
const task_1 = require("@e-mc/task");
|
|
16
|
+
const image_1 = require("@e-mc/image");
|
|
17
|
+
const watch_1 = require("@e-mc/watch");
|
|
18
|
+
const compress_1 = require("@e-mc/compress");
|
|
19
|
+
const cloud_1 = require("@e-mc/cloud");
|
|
21
20
|
const kBaseDirectory = Symbol('baseDirectory');
|
|
22
21
|
const kIncremental = Symbol('incremental');
|
|
23
22
|
const kRestarting = Symbol('restarting');
|
|
@@ -37,7 +36,7 @@ const CACHE_ETAG = {};
|
|
|
37
36
|
const DISK = {
|
|
38
37
|
ENABLED: false,
|
|
39
38
|
EXPIRES: 0,
|
|
40
|
-
LIMIT: (0, types_1.formatSize)("1gb"
|
|
39
|
+
LIMIT: (0, types_1.formatSize)("1gb"),
|
|
41
40
|
INCLUDE: [],
|
|
42
41
|
EXCLUDE: []
|
|
43
42
|
};
|
|
@@ -47,8 +46,8 @@ const MEMORY = {
|
|
|
47
46
|
SIZE: 0,
|
|
48
47
|
TOTAL: 0,
|
|
49
48
|
EXPIRES: 0,
|
|
50
|
-
LIMIT: (0, types_1.formatSize)("100mb"
|
|
51
|
-
LIMIT_ALL: (0, types_1.formatSize)("512mb"
|
|
49
|
+
LIMIT: (0, types_1.formatSize)("100mb"),
|
|
50
|
+
LIMIT_ALL: (0, types_1.formatSize)("512mb"),
|
|
52
51
|
INCLUDE: [],
|
|
53
52
|
EXCLUDE: [],
|
|
54
53
|
PURGE: 0.25,
|
|
@@ -62,11 +61,11 @@ let RECURSION_LIMIT = 10;
|
|
|
62
61
|
let LOG_TIMEELAPSED = true;
|
|
63
62
|
let LOG_TIMEPROCESS = true;
|
|
64
63
|
const HTTP_CLIENT = {
|
|
65
|
-
timeout: 60000
|
|
66
|
-
connectTimeout: 20 * 1000
|
|
64
|
+
timeout: 60000,
|
|
65
|
+
connectTimeout: 20 * 1000,
|
|
67
66
|
redirectLimit: 3,
|
|
68
|
-
retryWait: 1000
|
|
69
|
-
retryAfter: 30 * 1000
|
|
67
|
+
retryWait: 1000,
|
|
68
|
+
retryAfter: 30 * 1000,
|
|
70
69
|
retryLimit: 10
|
|
71
70
|
};
|
|
72
71
|
function applyTimeout(target, options) {
|
|
@@ -97,7 +96,7 @@ function withinSizeRange(uri, value, pattern) {
|
|
|
97
96
|
return true;
|
|
98
97
|
}
|
|
99
98
|
function startMessage() {
|
|
100
|
-
this.formatMessage(128
|
|
99
|
+
this.formatMessage(128, 'START', [new Date().toLocaleString(), this.assets.length + ' assets'], this.baseDirectory, { ...core_1.Host.LOG_STYLE_SUCCESS });
|
|
101
100
|
}
|
|
102
101
|
function clearAssets() {
|
|
103
102
|
this.assets.forEach(item => {
|
|
@@ -117,7 +116,7 @@ function bundleTorrent(files, mimeType, encoding) {
|
|
|
117
116
|
output += fs.readFileSync(file, encoding);
|
|
118
117
|
}
|
|
119
118
|
catch (err) {
|
|
120
|
-
this.writeFail(["Unable to read file"
|
|
119
|
+
this.writeFail(["Unable to read file", path.basename(file)], err, 32);
|
|
121
120
|
}
|
|
122
121
|
}
|
|
123
122
|
}
|
|
@@ -134,13 +133,13 @@ function recurseDir(output, subDirs, options) {
|
|
|
134
133
|
.sort((a, b) => {
|
|
135
134
|
if (sortBy > 0) {
|
|
136
135
|
if (a.isDirectory() && !b.isDirectory()) {
|
|
137
|
-
return sortBy & 1
|
|
136
|
+
return sortBy & 1 ? -1 : 1;
|
|
138
137
|
}
|
|
139
138
|
if (!a.isDirectory() && b.isDirectory()) {
|
|
140
|
-
return sortBy & 1
|
|
139
|
+
return sortBy & 1 ? 1 : -1;
|
|
141
140
|
}
|
|
142
141
|
}
|
|
143
|
-
return (a.name < b.name ? -1 : 1) * (2
|
|
142
|
+
return (a.name < b.name ? -1 : 1) * (2 & 2 ? -1 : 1);
|
|
144
143
|
});
|
|
145
144
|
for (const item of items) {
|
|
146
145
|
if (!item.isDirectory()) {
|
|
@@ -164,7 +163,7 @@ function checkHash(localUri, output, options, data) {
|
|
|
164
163
|
value = options;
|
|
165
164
|
}
|
|
166
165
|
if ((0, types_1.isString)(value)) {
|
|
167
|
-
algorithm || (algorithm = "sha256"
|
|
166
|
+
algorithm || (algorithm = "sha256");
|
|
168
167
|
if (!data) {
|
|
169
168
|
try {
|
|
170
169
|
data = fs.readFileSync(localUri);
|
|
@@ -179,7 +178,7 @@ function checkHash(localUri, output, options, data) {
|
|
|
179
178
|
}
|
|
180
179
|
}
|
|
181
180
|
if ((value = value.toLowerCase()) === core_1.Host.asHash(data, { algorithm, digest })) {
|
|
182
|
-
this.formatMessage(32
|
|
181
|
+
this.formatMessage(32, algorithm, ["Checksum matched" + (output ? ' (output)' : ''), path.basename(localUri)], value, { ...core_1.Host.LOG_STYLE_INFO, queue: true });
|
|
183
182
|
return true;
|
|
184
183
|
}
|
|
185
184
|
return false;
|
|
@@ -217,7 +216,7 @@ function filterPaths(values, include, exclude, dot) {
|
|
|
217
216
|
return values;
|
|
218
217
|
}
|
|
219
218
|
function abortedHost() {
|
|
220
|
-
if (this.finalizeState === 6
|
|
219
|
+
if (this.finalizeState === 6) {
|
|
221
220
|
this.restarting = false;
|
|
222
221
|
this.performFinalize(true);
|
|
223
222
|
return this.done;
|
|
@@ -261,7 +260,7 @@ function collectErrors() {
|
|
|
261
260
|
const clearModule = (instance) => {
|
|
262
261
|
const { moduleName, errors } = instance;
|
|
263
262
|
if (errors.length) {
|
|
264
|
-
errors.forEach(value => result.push(`[${moduleName}] ` + (core_1.Host.asString(value) || "Unknown"
|
|
263
|
+
errors.forEach(value => result.push(`[${moduleName}] ` + (core_1.Host.asString(value) || "Unknown")));
|
|
265
264
|
errors.length = 0;
|
|
266
265
|
}
|
|
267
266
|
};
|
|
@@ -283,12 +282,12 @@ function collectErrors() {
|
|
|
283
282
|
return result;
|
|
284
283
|
}
|
|
285
284
|
function rejectModule(err, type, hint) {
|
|
286
|
-
this.writeFail(["Handled rejection"
|
|
285
|
+
this.writeFail(["Handled rejection", this.moduleName + (hint ? ': ' + hint : '')], err, type);
|
|
287
286
|
}
|
|
288
|
-
const checksumFile = (algorithm) => "checksum"
|
|
289
|
-
const checksumError = (algorithm) => new Error("Invalid parameters"
|
|
287
|
+
const checksumFile = (algorithm) => "checksum" + '.' + ((0, types_1.isString)(algorithm) ? algorithm.toLowerCase() : "sha256");
|
|
288
|
+
const checksumError = (algorithm) => new Error("Invalid parameters" + ` (${algorithm || "sha256"})`);
|
|
290
289
|
const isFunction = (value) => typeof value === 'function';
|
|
291
|
-
const ignoreAsset = (item, exists) => item.invalid || (0, types_1.hasBit)(item.flags, 1
|
|
290
|
+
const ignoreAsset = (item, exists) => item.invalid || (0, types_1.hasBit)(item.flags, 1 | (!exists ? 128 : 0));
|
|
292
291
|
class HttpDiskCache {
|
|
293
292
|
constructor(host, enabled) {
|
|
294
293
|
this.host = host;
|
|
@@ -420,7 +419,7 @@ class HttpDiskCache {
|
|
|
420
419
|
}
|
|
421
420
|
class HttpMemoryCache extends HttpDiskCache {
|
|
422
421
|
constructor(host, enabled) {
|
|
423
|
-
super(host, enabled && core_1.Host.enabled("memory.settings.users"
|
|
422
|
+
super(host, enabled && core_1.Host.enabled("memory.settings.users", host.username));
|
|
424
423
|
this.limit = MEMORY.LIMIT;
|
|
425
424
|
this.expires = MEMORY.EXPIRES;
|
|
426
425
|
this.toDisk = [MEMORY.DISK_MIN, MEMORY.DISK_MAX];
|
|
@@ -603,8 +602,8 @@ class FileManager extends core_1.Host {
|
|
|
603
602
|
SESSION_LIMIT = Math.pow(10, value);
|
|
604
603
|
}
|
|
605
604
|
}
|
|
606
|
-
LOG_TIMEELAPSED = this.hasLogType(128
|
|
607
|
-
LOG_TIMEPROCESS = this.hasLogType(256
|
|
605
|
+
LOG_TIMEELAPSED = this.hasLogType(128);
|
|
606
|
+
LOG_TIMEPROCESS = this.hasLogType(256);
|
|
608
607
|
return true;
|
|
609
608
|
}
|
|
610
609
|
static sanitizeAssets(assets, exclusions = []) {
|
|
@@ -622,7 +621,7 @@ class FileManager extends core_1.Host {
|
|
|
622
621
|
for (const attr in item) {
|
|
623
622
|
switch (attr) {
|
|
624
623
|
case 'flags':
|
|
625
|
-
item.flags &= ~(128
|
|
624
|
+
item.flags &= ~(128 | 16);
|
|
626
625
|
break;
|
|
627
626
|
case 'watch':
|
|
628
627
|
if ((0, types_1.isPlainObject)(item.watch) && item.watch.assets) {
|
|
@@ -692,7 +691,7 @@ class FileManager extends core_1.Host {
|
|
|
692
691
|
if (options.throwsEmpty) {
|
|
693
692
|
throw err;
|
|
694
693
|
}
|
|
695
|
-
this.writeFail(["Unable to read directory"
|
|
694
|
+
this.writeFail(["Unable to read directory", root], err, 32);
|
|
696
695
|
return null;
|
|
697
696
|
}
|
|
698
697
|
return result;
|
|
@@ -745,7 +744,7 @@ class FileManager extends core_1.Host {
|
|
|
745
744
|
fail.push(pathname);
|
|
746
745
|
}
|
|
747
746
|
else if (verbose) {
|
|
748
|
-
process.stdout.write("+"
|
|
747
|
+
process.stdout.write("+" + ' ' + pathname + '\n');
|
|
749
748
|
}
|
|
750
749
|
valid = true;
|
|
751
750
|
}
|
|
@@ -785,7 +784,7 @@ class FileManager extends core_1.Host {
|
|
|
785
784
|
if (options.throwsEmpty) {
|
|
786
785
|
throw err;
|
|
787
786
|
}
|
|
788
|
-
this.writeFail(["Unable to read directory"
|
|
787
|
+
this.writeFail(["Unable to read directory", root], err, 32);
|
|
789
788
|
return null;
|
|
790
789
|
}
|
|
791
790
|
if (parent) {
|
|
@@ -796,14 +795,14 @@ class FileManager extends core_1.Host {
|
|
|
796
795
|
missing = Array.from(new Set(missing));
|
|
797
796
|
}
|
|
798
797
|
}
|
|
799
|
-
if (verbose === true) {
|
|
798
|
+
if (verbose === true) {
|
|
800
799
|
const max = Math.max(...fail.concat(missing).map(item => item.length));
|
|
801
800
|
const writeLog = (items, symbol) => {
|
|
802
|
-
const [bg, fg] = symbol === "-"
|
|
801
|
+
const [bg, fg] = symbol === "-" ? ['\x1b[31m', '\x1b[89m'] : ['\x1b[33m', '\x1b[89m'];
|
|
803
802
|
items.forEach((value, index) => process.stdout.write(bg + symbol + ` ${value.padEnd(max)} (${(index + 1).toString()})${fg}\n`));
|
|
804
803
|
};
|
|
805
|
-
writeLog(fail, "-"
|
|
806
|
-
writeLog(missing, "?"
|
|
804
|
+
writeLog(fail, "-");
|
|
805
|
+
writeLog(missing, "?");
|
|
807
806
|
}
|
|
808
807
|
return [fail, missing];
|
|
809
808
|
}
|
|
@@ -876,7 +875,7 @@ class FileManager extends core_1.Host {
|
|
|
876
875
|
HTTP_CLIENT.connectTimeout = timeout;
|
|
877
876
|
}
|
|
878
877
|
if ((retry_wait = (0, util_1.fromSeconds)(retry_wait)) >= 0) {
|
|
879
|
-
HTTP_CLIENT.retryWait = Math.min(retry_wait, 600 * 1000
|
|
878
|
+
HTTP_CLIENT.retryWait = Math.min(retry_wait, 600 * 1000);
|
|
880
879
|
}
|
|
881
880
|
if ((retry_after = (0, util_1.fromSeconds)(retry_after)) >= 0) {
|
|
882
881
|
HTTP_CLIENT.retryAfter = Math.min(retry_after, this.MAX_TIMEOUT);
|
|
@@ -890,7 +889,7 @@ class FileManager extends core_1.Host {
|
|
|
890
889
|
}
|
|
891
890
|
constructor(baseDirectory, config, permission, postFinalize) {
|
|
892
891
|
super(config);
|
|
893
|
-
this.finalizeState = 0
|
|
892
|
+
this.finalizeState = 0;
|
|
894
893
|
this.processTimeout = PROCESS_TIMEOUT.filemanager;
|
|
895
894
|
this.Document = [];
|
|
896
895
|
this.Task = [];
|
|
@@ -953,7 +952,7 @@ class FileManager extends core_1.Host {
|
|
|
953
952
|
item.id || (item.id = ++ASSET_ID);
|
|
954
953
|
}
|
|
955
954
|
this._assets = assets.slice(0);
|
|
956
|
-
this[kIncremental] = incremental === "staging"
|
|
955
|
+
this[kIncremental] = incremental === "staging" ? "staging" : "none";
|
|
957
956
|
if (targeted) {
|
|
958
957
|
this.using(...targeted);
|
|
959
958
|
}
|
|
@@ -981,7 +980,7 @@ class FileManager extends core_1.Host {
|
|
|
981
980
|
request.host = this;
|
|
982
981
|
this.Request = request;
|
|
983
982
|
if (this.aborted) {
|
|
984
|
-
this.finalizeState = 6
|
|
983
|
+
this.finalizeState = 6;
|
|
985
984
|
}
|
|
986
985
|
else {
|
|
987
986
|
request.init(config).apply({ client: HTTP_CLIENT });
|
|
@@ -1091,7 +1090,7 @@ class FileManager extends core_1.Host {
|
|
|
1091
1090
|
}
|
|
1092
1091
|
if (this.restartable && (!recursive || --this[kRecursionLimit] >= 0)) {
|
|
1093
1092
|
if (this.reset()) {
|
|
1094
|
-
this.finalizeState = 5
|
|
1093
|
+
this.finalizeState = 5;
|
|
1095
1094
|
FileManager.sanitizeAssets(this.assets, exclusions);
|
|
1096
1095
|
for (const { instance } of this.Document) {
|
|
1097
1096
|
instance.restart();
|
|
@@ -1139,7 +1138,7 @@ class FileManager extends core_1.Host {
|
|
|
1139
1138
|
}
|
|
1140
1139
|
}
|
|
1141
1140
|
reset() {
|
|
1142
|
-
if (this.finalizeState === 1
|
|
1141
|
+
if (this.finalizeState === 1) {
|
|
1143
1142
|
return false;
|
|
1144
1143
|
}
|
|
1145
1144
|
super.reset();
|
|
@@ -1161,7 +1160,7 @@ class FileManager extends core_1.Host {
|
|
|
1161
1160
|
clearAssets.call(this);
|
|
1162
1161
|
this.cleared = false;
|
|
1163
1162
|
this[kDelayed] = 0;
|
|
1164
|
-
this.finalizeState = 0
|
|
1163
|
+
this.finalizeState = 0;
|
|
1165
1164
|
return true;
|
|
1166
1165
|
}
|
|
1167
1166
|
deleteFile(value, options = {}, callback) {
|
|
@@ -1186,11 +1185,11 @@ class FileManager extends core_1.Host {
|
|
|
1186
1185
|
}
|
|
1187
1186
|
resumeThread(options) {
|
|
1188
1187
|
if (this.aborted || options.aborted) {
|
|
1189
|
-
this.finalizeState = 0
|
|
1188
|
+
this.finalizeState = 0;
|
|
1190
1189
|
this.performFinalize(true);
|
|
1191
1190
|
return;
|
|
1192
1191
|
}
|
|
1193
|
-
this.finalizeState = 5
|
|
1192
|
+
this.finalizeState = 5;
|
|
1194
1193
|
startMessage.call(this);
|
|
1195
1194
|
this.processAssets(...options.args);
|
|
1196
1195
|
}
|
|
@@ -1226,7 +1225,7 @@ class FileManager extends core_1.Host {
|
|
|
1226
1225
|
if (typeof target === 'string') {
|
|
1227
1226
|
const module = args.shift();
|
|
1228
1227
|
if ((0, types_1.isObject)(module)) {
|
|
1229
|
-
if (target === "@e-mc/cloud"
|
|
1228
|
+
if (target === "@e-mc/cloud") {
|
|
1230
1229
|
instance = new cloud_1.default(module, database);
|
|
1231
1230
|
}
|
|
1232
1231
|
else {
|
|
@@ -1236,11 +1235,11 @@ class FileManager extends core_1.Host {
|
|
|
1236
1235
|
instance = new Handler(module, database);
|
|
1237
1236
|
}
|
|
1238
1237
|
else {
|
|
1239
|
-
throw (0, types_1.errorMessage)(this.moduleName, "Not a Cloud constructor"
|
|
1238
|
+
throw (0, types_1.errorMessage)(this.moduleName, "Not a Cloud constructor", target);
|
|
1240
1239
|
}
|
|
1241
1240
|
}
|
|
1242
1241
|
catch (err) {
|
|
1243
|
-
this.checkPackage(err, target, ["Unable to load handler"
|
|
1242
|
+
this.checkPackage(err, target, ["Unable to load handler", this.moduleName], 64);
|
|
1244
1243
|
}
|
|
1245
1244
|
}
|
|
1246
1245
|
}
|
|
@@ -1273,7 +1272,7 @@ class FileManager extends core_1.Host {
|
|
|
1273
1272
|
}
|
|
1274
1273
|
}
|
|
1275
1274
|
}
|
|
1276
|
-
const manager = new FileManager(this.baseDirectory, { ...this.config, incremental: "none"
|
|
1275
|
+
const manager = new FileManager(this.baseDirectory, { ...this.config, incremental: "none", assets }, postFinalize);
|
|
1277
1276
|
for (const { constructor, params } of this.Document) {
|
|
1278
1277
|
manager.install('document', constructor, ...params);
|
|
1279
1278
|
}
|
|
@@ -1284,17 +1283,20 @@ class FileManager extends core_1.Host {
|
|
|
1284
1283
|
manager.install('cloud', this.Cloud.module);
|
|
1285
1284
|
}
|
|
1286
1285
|
if (this.Image) {
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1286
|
+
const mimeMap = new Map();
|
|
1287
|
+
let params = [];
|
|
1288
|
+
for (const [mimeType, handler] of this.Image) {
|
|
1289
|
+
const { constructor, params: trailing } = handler;
|
|
1290
|
+
if (params.length === 0 || mimeType === 'handler') {
|
|
1291
|
+
params = trailing;
|
|
1293
1292
|
}
|
|
1293
|
+
mimeMap.set(mimeType, constructor);
|
|
1294
1294
|
}
|
|
1295
|
-
manager.
|
|
1295
|
+
manager.install('image', mimeMap, ...params);
|
|
1296
|
+
}
|
|
1297
|
+
if (this.Compress) {
|
|
1298
|
+
manager.install('compress', this.Compress.module);
|
|
1296
1299
|
}
|
|
1297
|
-
manager.Compress = this.Compress;
|
|
1298
1300
|
manager.sessionId = this.sessionId;
|
|
1299
1301
|
manager.permission = this.permission;
|
|
1300
1302
|
manager.cacheToDisk = this.cacheToDisk;
|
|
@@ -1304,7 +1306,7 @@ class FileManager extends core_1.Host {
|
|
|
1304
1306
|
manager.processAssets();
|
|
1305
1307
|
}
|
|
1306
1308
|
catch (err) {
|
|
1307
|
-
manager.writeFail("Unknown"
|
|
1309
|
+
manager.writeFail("Unknown", err, { startTime: manager.startTime });
|
|
1308
1310
|
}
|
|
1309
1311
|
}
|
|
1310
1312
|
return manager;
|
|
@@ -1315,7 +1317,7 @@ class FileManager extends core_1.Host {
|
|
|
1315
1317
|
if (target instanceof Map) {
|
|
1316
1318
|
const handler = new Map();
|
|
1317
1319
|
for (const [mimeType, constructor] of target) {
|
|
1318
|
-
if (constructor.prototype instanceof image_1.default) {
|
|
1320
|
+
if (isFunction(constructor) && constructor.prototype instanceof image_1.default) {
|
|
1319
1321
|
const instance = new constructor(args[0]);
|
|
1320
1322
|
instance.host = this;
|
|
1321
1323
|
instance.init(this.config);
|
|
@@ -1364,7 +1366,7 @@ class FileManager extends core_1.Host {
|
|
|
1364
1366
|
}
|
|
1365
1367
|
const isSame = (a, b) => a === b || decodeURIComponent(a) === decodeURIComponent(b);
|
|
1366
1368
|
const result = (assets || this.assets).filter(item => {
|
|
1367
|
-
|
|
1369
|
+
const { uri, flags } = item;
|
|
1368
1370
|
if (uri && (!instance || this.hasDocument(instance, item.document)) && (!item.invalid || assets || (0, types_1.mainFlag)(flags) || (0, types_1.usingFlag)(flags) || (0, types_1.cloneFlag)(flags) || (0, types_1.watchFlag)(flags))) {
|
|
1369
1371
|
if (origin) {
|
|
1370
1372
|
if (!item.url) {
|
|
@@ -1386,13 +1388,7 @@ class FileManager extends core_1.Host {
|
|
|
1386
1388
|
const indexA = uri.indexOf('#');
|
|
1387
1389
|
const indexB = value.indexOf('#');
|
|
1388
1390
|
if (indexA !== -1 || indexB !== -1) {
|
|
1389
|
-
|
|
1390
|
-
uri = uri.substring(0, indexA);
|
|
1391
|
-
}
|
|
1392
|
-
if (indexB !== -1) {
|
|
1393
|
-
value = value.substring(0, indexB);
|
|
1394
|
-
}
|
|
1395
|
-
return isSame(uri, value);
|
|
1391
|
+
return isSame(indexA !== -1 ? uri.substring(0, indexA) : uri, indexB !== -1 ? value.substring(0, indexB) : value);
|
|
1396
1392
|
}
|
|
1397
1393
|
}
|
|
1398
1394
|
return false;
|
|
@@ -1472,7 +1468,7 @@ class FileManager extends core_1.Host {
|
|
|
1472
1468
|
}
|
|
1473
1469
|
}
|
|
1474
1470
|
catch (err) {
|
|
1475
|
-
this.writeFail(["Unable to rename file"
|
|
1471
|
+
this.writeFail(["Unable to rename file", name], err, 32);
|
|
1476
1472
|
return false;
|
|
1477
1473
|
}
|
|
1478
1474
|
}
|
|
@@ -1493,7 +1489,7 @@ class FileManager extends core_1.Host {
|
|
|
1493
1489
|
file.pathname = pathname;
|
|
1494
1490
|
file.filename = filename;
|
|
1495
1491
|
this.setLocalUri(file, true);
|
|
1496
|
-
this.writeFail(["Unable to rename file"
|
|
1492
|
+
this.writeFail(["Unable to rename file", name], err, 32);
|
|
1497
1493
|
return false;
|
|
1498
1494
|
}
|
|
1499
1495
|
}
|
|
@@ -1530,7 +1526,7 @@ class FileManager extends core_1.Host {
|
|
|
1530
1526
|
}
|
|
1531
1527
|
}
|
|
1532
1528
|
catch (err) {
|
|
1533
|
-
this.writeFail(["Unable to rename file"
|
|
1529
|
+
this.writeFail(["Unable to rename file", path.basename(value)], err, 32);
|
|
1534
1530
|
return false;
|
|
1535
1531
|
}
|
|
1536
1532
|
if (!copy) {
|
|
@@ -1558,25 +1554,25 @@ class FileManager extends core_1.Host {
|
|
|
1558
1554
|
this.performFinalize();
|
|
1559
1555
|
}
|
|
1560
1556
|
if (err) {
|
|
1561
|
-
this.writeFail(["Unknown"
|
|
1557
|
+
this.writeFail(["Unknown", uri], err, 32);
|
|
1562
1558
|
}
|
|
1563
1559
|
}
|
|
1564
1560
|
performFinalize(override) {
|
|
1565
1561
|
const state = this.finalizeState;
|
|
1566
|
-
if (state === 0
|
|
1562
|
+
if (state === 0 && (this.cleared && this[kDelayed] <= 0 || override) || (this.aborted || state === 3) && override) {
|
|
1567
1563
|
this.clearProcessTimeout();
|
|
1568
1564
|
this[kDelayed] = Infinity;
|
|
1569
1565
|
const resetState = () => {
|
|
1570
|
-
this.finalizeState = 2
|
|
1566
|
+
this.finalizeState = 2;
|
|
1571
1567
|
this._pendingResult = null;
|
|
1572
1568
|
};
|
|
1573
1569
|
const aborted = (err) => {
|
|
1574
1570
|
if (!this.restarting) {
|
|
1575
|
-
this.writeFail(["Transaction was not completed"
|
|
1571
|
+
this.writeFail(["Transaction was not completed", this.baseDirectory], err);
|
|
1576
1572
|
resetState();
|
|
1577
1573
|
}
|
|
1578
1574
|
else {
|
|
1579
|
-
this.finalizeState = 4
|
|
1575
|
+
this.finalizeState = 4;
|
|
1580
1576
|
}
|
|
1581
1577
|
this.emit('end', [], collectErrors.call(this), this.collectLog());
|
|
1582
1578
|
if (!this.restarting) {
|
|
@@ -1587,7 +1583,7 @@ class FileManager extends core_1.Host {
|
|
|
1587
1583
|
aborted((0, types_1.createAbortError)());
|
|
1588
1584
|
return;
|
|
1589
1585
|
}
|
|
1590
|
-
this.finalizeState = 1
|
|
1586
|
+
this.finalizeState = 1;
|
|
1591
1587
|
this.finalize()
|
|
1592
1588
|
.then(() => {
|
|
1593
1589
|
const errors = collectErrors.call(this);
|
|
@@ -1628,7 +1624,7 @@ class FileManager extends core_1.Host {
|
|
|
1628
1624
|
let uri = file.uri, type;
|
|
1629
1625
|
if (uri && !file.url && !file.content && !file.base64 && !file.dataView) {
|
|
1630
1626
|
if (core_1.Host.isFile(uri, 'torrent')) {
|
|
1631
|
-
type = 4
|
|
1627
|
+
type = 4;
|
|
1632
1628
|
}
|
|
1633
1629
|
else if (core_1.Host.isURL(uri, 'file')) {
|
|
1634
1630
|
try {
|
|
@@ -1636,7 +1632,7 @@ class FileManager extends core_1.Host {
|
|
|
1636
1632
|
file.uri = file.url.toString();
|
|
1637
1633
|
}
|
|
1638
1634
|
catch (err) {
|
|
1639
|
-
this.writeFail(['Unable to parse URL', uri], err, 1024
|
|
1635
|
+
this.writeFail(['Unable to parse URL', uri], err, 1024);
|
|
1640
1636
|
return { pathname: '', localUri: '' };
|
|
1641
1637
|
}
|
|
1642
1638
|
}
|
|
@@ -1659,7 +1655,7 @@ class FileManager extends core_1.Host {
|
|
|
1659
1655
|
}
|
|
1660
1656
|
}
|
|
1661
1657
|
catch (err) {
|
|
1662
|
-
this.writeFail(['Unable to resolve file location', uri], err, 32
|
|
1658
|
+
this.writeFail(['Unable to resolve file location', uri], err, 32);
|
|
1663
1659
|
return { pathname: '', localUri: '' };
|
|
1664
1660
|
}
|
|
1665
1661
|
}
|
|
@@ -1667,13 +1663,13 @@ class FileManager extends core_1.Host {
|
|
|
1667
1663
|
const url = file.url;
|
|
1668
1664
|
if (url) {
|
|
1669
1665
|
if (url.protocol.startsWith('http')) {
|
|
1670
|
-
type = 1
|
|
1666
|
+
type = 1;
|
|
1671
1667
|
}
|
|
1672
1668
|
else if (file.socketPath && url.protocol === 'file:') {
|
|
1673
|
-
type = 2
|
|
1669
|
+
type = 2;
|
|
1674
1670
|
}
|
|
1675
1671
|
else if (core_1.Host.isFile(url, 's/ftp')) {
|
|
1676
|
-
type = 3
|
|
1672
|
+
type = 3;
|
|
1677
1673
|
}
|
|
1678
1674
|
}
|
|
1679
1675
|
file.fetchType = type;
|
|
@@ -1694,7 +1690,7 @@ class FileManager extends core_1.Host {
|
|
|
1694
1690
|
const pathname = segments.length ? path.join(this.baseDirectory, ...segments) : this.baseDirectory;
|
|
1695
1691
|
const localUri = file.filename ? path.join(pathname, file.filename) : pathname;
|
|
1696
1692
|
file.localUri = localUri;
|
|
1697
|
-
if (type !== 4
|
|
1693
|
+
if (type !== 4) {
|
|
1698
1694
|
file.mimeType || (file.mimeType = file.url && core_1.Host.lookupMime(path.basename(file.url.pathname)) || core_1.Host.lookupMime(file.filename));
|
|
1699
1695
|
}
|
|
1700
1696
|
return { pathname, localUri };
|
|
@@ -1724,7 +1720,7 @@ class FileManager extends core_1.Host {
|
|
|
1724
1720
|
sourceUTF8 = fs.readFileSync(uri, file.encoding);
|
|
1725
1721
|
}
|
|
1726
1722
|
catch (err) {
|
|
1727
|
-
this.writeFail(["Unable to read file"
|
|
1723
|
+
this.writeFail(["Unable to read file", path.basename(uri)], err, 32);
|
|
1728
1724
|
}
|
|
1729
1725
|
}
|
|
1730
1726
|
if (sourceUTF8?.[0] === '\uFEFF' && file.encoding !== 'utf16le') {
|
|
@@ -1747,7 +1743,7 @@ class FileManager extends core_1.Host {
|
|
|
1747
1743
|
return fs.readFileSync(uri);
|
|
1748
1744
|
}
|
|
1749
1745
|
catch (err) {
|
|
1750
|
-
this.writeFail(["Unable to read file"
|
|
1746
|
+
this.writeFail(["Unable to read file", path.basename(uri)], err, 32);
|
|
1751
1747
|
}
|
|
1752
1748
|
}
|
|
1753
1749
|
const result = file.base64 ? Buffer.from(file.base64, 'base64') : null;
|
|
@@ -1844,7 +1840,7 @@ class FileManager extends core_1.Host {
|
|
|
1844
1840
|
return file.buffer = buffer;
|
|
1845
1841
|
}
|
|
1846
1842
|
catch (err) {
|
|
1847
|
-
this.writeFail(["Unable to write file"
|
|
1843
|
+
this.writeFail(["Unable to write file", path.basename(localUri)], err, 8192);
|
|
1848
1844
|
}
|
|
1849
1845
|
}
|
|
1850
1846
|
return null;
|
|
@@ -1885,7 +1881,7 @@ class FileManager extends core_1.Host {
|
|
|
1885
1881
|
fs.copyFileSync(localUri, output);
|
|
1886
1882
|
}
|
|
1887
1883
|
catch (err) {
|
|
1888
|
-
this.writeFail(["Unable to copy file"
|
|
1884
|
+
this.writeFail(["Unable to copy file", path.basename(localUri)], err, 32);
|
|
1889
1885
|
return;
|
|
1890
1886
|
}
|
|
1891
1887
|
}
|
|
@@ -1915,7 +1911,7 @@ class FileManager extends core_1.Host {
|
|
|
1915
1911
|
}
|
|
1916
1912
|
}
|
|
1917
1913
|
catch (err) {
|
|
1918
|
-
this.writeFail(["Unable to read buffer"
|
|
1914
|
+
this.writeFail(["Unable to read buffer", path.basename(localUri)], err, 32);
|
|
1919
1915
|
}
|
|
1920
1916
|
if (rename) {
|
|
1921
1917
|
if (!ext) {
|
|
@@ -1932,7 +1928,7 @@ class FileManager extends core_1.Host {
|
|
|
1932
1928
|
}
|
|
1933
1929
|
}
|
|
1934
1930
|
catch (err) {
|
|
1935
|
-
this.writeFail(["Unable to rename file"
|
|
1931
|
+
this.writeFail(["Unable to rename file", path.basename(output)], err, 32);
|
|
1936
1932
|
}
|
|
1937
1933
|
}
|
|
1938
1934
|
}
|
|
@@ -1974,7 +1970,7 @@ class FileManager extends core_1.Host {
|
|
|
1974
1970
|
config.timeout = this[kProcessTimeout].compress ?? PROCESS_TIMEOUT.compress;
|
|
1975
1971
|
tasks.push(instance.tryFile(file.buffer || localUri, output, config, (err, result) => {
|
|
1976
1972
|
if (err) {
|
|
1977
|
-
this.writeFail(["Unable to compress file"
|
|
1973
|
+
this.writeFail(["Unable to compress file", path.basename(localUri)], err, { type: 8, startTime: config.startTime });
|
|
1978
1974
|
}
|
|
1979
1975
|
else if ((0, types_1.isString)(result)) {
|
|
1980
1976
|
if (condition?.includes('%') && (0, lib_v4_1.getSize)(result) >= (0, lib_v4_1.getSize)(localUri)) {
|
|
@@ -1988,7 +1984,7 @@ class FileManager extends core_1.Host {
|
|
|
1988
1984
|
}
|
|
1989
1985
|
}
|
|
1990
1986
|
catch (err) {
|
|
1991
|
-
this.writeFail(["Unable to read file"
|
|
1987
|
+
this.writeFail(["Unable to read file", path.basename(output)], err, 32);
|
|
1992
1988
|
}
|
|
1993
1989
|
}
|
|
1994
1990
|
}
|
|
@@ -2008,7 +2004,7 @@ class FileManager extends core_1.Host {
|
|
|
2008
2004
|
file.mimeType = mimeType;
|
|
2009
2005
|
data.mimeType = mimeType;
|
|
2010
2006
|
}
|
|
2011
|
-
const errorAsset = (instance, err, type = 4
|
|
2007
|
+
const errorAsset = (instance, err, type = 4) => rejectModule.call(instance, err, type, path.basename(localUri));
|
|
2012
2008
|
if (file.tasks) {
|
|
2013
2009
|
const taskName = [];
|
|
2014
2010
|
for (const { task, handler: moduleName, preceding } of file.tasks) {
|
|
@@ -2056,7 +2052,7 @@ class FileManager extends core_1.Host {
|
|
|
2056
2052
|
.then(() => this.closeThread(instance, data))
|
|
2057
2053
|
.catch(err => {
|
|
2058
2054
|
this.closeThread(instance, data);
|
|
2059
|
-
errorAsset(instance, err, 2048
|
|
2055
|
+
errorAsset(instance, err, 2048);
|
|
2060
2056
|
});
|
|
2061
2057
|
}
|
|
2062
2058
|
}
|
|
@@ -2066,7 +2062,7 @@ class FileManager extends core_1.Host {
|
|
|
2066
2062
|
}
|
|
2067
2063
|
}
|
|
2068
2064
|
catch (err) {
|
|
2069
|
-
errorAsset(instance, err, 2048
|
|
2065
|
+
errorAsset(instance, err, 2048);
|
|
2070
2066
|
}
|
|
2071
2067
|
}
|
|
2072
2068
|
}
|
|
@@ -2145,7 +2141,7 @@ class FileManager extends core_1.Host {
|
|
|
2145
2141
|
task();
|
|
2146
2142
|
}
|
|
2147
2143
|
catch (err) {
|
|
2148
|
-
this.writeFail(["Unable to perform task"
|
|
2144
|
+
this.writeFail(["Unable to perform task", path.basename(this.getLocalUri(data))], err);
|
|
2149
2145
|
}
|
|
2150
2146
|
this.removeAsyncTask();
|
|
2151
2147
|
});
|
|
@@ -2220,7 +2216,7 @@ class FileManager extends core_1.Host {
|
|
|
2220
2216
|
options = { format: options };
|
|
2221
2217
|
}
|
|
2222
2218
|
options.format || (options.format = 'json');
|
|
2223
|
-
return this.Request.get(uri, options).then(data => typeof data === 'object' ? data : null)
|
|
2219
|
+
return this.Request.get(uri, options).then(data => typeof data === 'object' ? data : null);
|
|
2224
2220
|
}
|
|
2225
2221
|
async fetchBuffer(uri, options) {
|
|
2226
2222
|
if (options && 'format' in options) {
|
|
@@ -2276,19 +2272,19 @@ class FileManager extends core_1.Host {
|
|
|
2276
2272
|
});
|
|
2277
2273
|
}
|
|
2278
2274
|
switch (this.finalizeState) {
|
|
2279
|
-
case 0
|
|
2275
|
+
case 0:
|
|
2280
2276
|
if (this.delayed === 0 && !this.cleared) {
|
|
2281
2277
|
break;
|
|
2282
2278
|
}
|
|
2283
|
-
case 1
|
|
2284
|
-
case 3
|
|
2285
|
-
case 5
|
|
2286
|
-
case 4
|
|
2279
|
+
case 1:
|
|
2280
|
+
case 3:
|
|
2281
|
+
case 5:
|
|
2282
|
+
case 4:
|
|
2287
2283
|
if (this._pendingResult) {
|
|
2288
2284
|
return this._pendingResult;
|
|
2289
2285
|
}
|
|
2290
|
-
this.finalizeState = 0
|
|
2291
|
-
case 2
|
|
2286
|
+
this.finalizeState = 0;
|
|
2287
|
+
case 2:
|
|
2292
2288
|
resetAssets.call(this);
|
|
2293
2289
|
break;
|
|
2294
2290
|
}
|
|
@@ -2308,14 +2304,14 @@ class FileManager extends core_1.Host {
|
|
|
2308
2304
|
abortedHost.call(this);
|
|
2309
2305
|
return;
|
|
2310
2306
|
}
|
|
2311
|
-
if (this.finalizeState === 5
|
|
2307
|
+
if (this.finalizeState === 5) {
|
|
2312
2308
|
this.restarting = false;
|
|
2313
2309
|
}
|
|
2314
2310
|
else if (this._pendingResult) {
|
|
2315
2311
|
return;
|
|
2316
2312
|
}
|
|
2317
2313
|
if (!this.canWrite(this.baseDirectory, { ownPermissionOnly: true })) {
|
|
2318
|
-
this.writeFail("Unsupported access"
|
|
2314
|
+
this.writeFail("Unsupported access", new Error(this.baseDirectory), 8192);
|
|
2319
2315
|
this.cleared = true;
|
|
2320
2316
|
if (this.queued) {
|
|
2321
2317
|
this.joinQueue({ reject: true });
|
|
@@ -2323,15 +2319,15 @@ class FileManager extends core_1.Host {
|
|
|
2323
2319
|
return;
|
|
2324
2320
|
}
|
|
2325
2321
|
switch (this.finalizeState) {
|
|
2326
|
-
case 0
|
|
2322
|
+
case 0:
|
|
2327
2323
|
if (this.delayed === 0 && !this.cleared) {
|
|
2328
2324
|
break;
|
|
2329
2325
|
}
|
|
2330
|
-
case 1
|
|
2331
|
-
case 3
|
|
2332
|
-
case 4
|
|
2326
|
+
case 1:
|
|
2327
|
+
case 3:
|
|
2328
|
+
case 4:
|
|
2333
2329
|
return;
|
|
2334
|
-
case 2
|
|
2330
|
+
case 2:
|
|
2335
2331
|
resetAssets.call(this);
|
|
2336
2332
|
break;
|
|
2337
2333
|
}
|
|
@@ -2339,10 +2335,10 @@ class FileManager extends core_1.Host {
|
|
|
2339
2335
|
const length = arguments.length;
|
|
2340
2336
|
const args = new Array(length);
|
|
2341
2337
|
for (let i = 0; i < length; ++i) {
|
|
2342
|
-
args[i] = arguments[i];
|
|
2338
|
+
args[i] = arguments[i];
|
|
2343
2339
|
}
|
|
2344
2340
|
if (this.joinQueue({ args })) {
|
|
2345
|
-
this.finalizeState = 4
|
|
2341
|
+
this.finalizeState = 4;
|
|
2346
2342
|
return;
|
|
2347
2343
|
}
|
|
2348
2344
|
}
|
|
@@ -2352,7 +2348,7 @@ class FileManager extends core_1.Host {
|
|
|
2352
2348
|
this.clearProcessTimeout();
|
|
2353
2349
|
this[KTimerMain] = setInterval(() => {
|
|
2354
2350
|
const { processing, processTimeout, finalizeState } = this;
|
|
2355
|
-
if (finalizeState === 4
|
|
2351
|
+
if (finalizeState === 4) {
|
|
2356
2352
|
return;
|
|
2357
2353
|
}
|
|
2358
2354
|
const currentTime = Date.now();
|
|
@@ -2380,12 +2376,12 @@ class FileManager extends core_1.Host {
|
|
|
2380
2376
|
file.invalid = true;
|
|
2381
2377
|
const localUri = file.localUri;
|
|
2382
2378
|
if (expired) {
|
|
2383
|
-
data.abort(new Error("Timeout was exceeded"
|
|
2379
|
+
data.abort(new Error("Timeout was exceeded"));
|
|
2384
2380
|
if (localUri) {
|
|
2385
2381
|
this.deleteFile(localUri, { id: file.id, emptyDir: true, all: true });
|
|
2386
2382
|
}
|
|
2387
2383
|
}
|
|
2388
|
-
(moduleName && this.find(moduleName) || this).formatFail(16384
|
|
2384
|
+
(moduleName && this.find(moduleName) || this).formatFail(16384, "FAIL!", ["Unable to process file", moduleName || 'main'], (0, types_1.errorValue)(expired ? "Timeout was exceeded" : "Aborted", localUri), { queue: false, startTime: data.startTime });
|
|
2389
2385
|
processing.splice(i--, 1);
|
|
2390
2386
|
aborted = true;
|
|
2391
2387
|
}
|
|
@@ -2406,10 +2402,10 @@ class FileManager extends core_1.Host {
|
|
|
2406
2402
|
const bundling = Object.create(null);
|
|
2407
2403
|
const originCount = Object.create(null);
|
|
2408
2404
|
const emptied = [this.baseDirectory];
|
|
2409
|
-
const staging = this[kIncremental] === "staging"
|
|
2405
|
+
const staging = this[kIncremental] === "staging";
|
|
2410
2406
|
const incremental = this.config.incremental;
|
|
2411
2407
|
const isCacheable = (file) => file.initialValue?.cacheable !== false;
|
|
2412
|
-
const hasIncremental = (value) => value === "etag"
|
|
2408
|
+
const hasIncremental = (value) => value === "etag" || value === "exists";
|
|
2413
2409
|
let cacheable = false, cacheOpen = false, cacheEtag = false;
|
|
2414
2410
|
if (!staging) {
|
|
2415
2411
|
cacheable = this[kRecursionLimit] === RECURSION_LIMIT;
|
|
@@ -2417,10 +2413,10 @@ class FileManager extends core_1.Host {
|
|
|
2417
2413
|
if (cacheOpen = hasIncremental(incremental)) {
|
|
2418
2414
|
this[kIncremental] = incremental;
|
|
2419
2415
|
}
|
|
2420
|
-
cacheEtag = incremental === "etag"
|
|
2416
|
+
cacheEtag = incremental === "etag";
|
|
2421
2417
|
}
|
|
2422
2418
|
else {
|
|
2423
|
-
this[kIncremental] = "none"
|
|
2419
|
+
this[kIncremental] = "none";
|
|
2424
2420
|
}
|
|
2425
2421
|
}
|
|
2426
2422
|
const targeting = this._usingObjects.size > 0;
|
|
@@ -2430,11 +2426,11 @@ class FileManager extends core_1.Host {
|
|
|
2430
2426
|
}
|
|
2431
2427
|
switch (file.incremental) {
|
|
2432
2428
|
case false:
|
|
2433
|
-
case "none"
|
|
2434
|
-
case "exists"
|
|
2435
|
-
case "staging"
|
|
2429
|
+
case "none":
|
|
2430
|
+
case "exists":
|
|
2431
|
+
case "staging":
|
|
2436
2432
|
return false;
|
|
2437
|
-
case "etag"
|
|
2433
|
+
case "etag":
|
|
2438
2434
|
return true;
|
|
2439
2435
|
default:
|
|
2440
2436
|
return cacheEtag;
|
|
@@ -2471,11 +2467,11 @@ class FileManager extends core_1.Host {
|
|
|
2471
2467
|
if (bundleIndex > 0) {
|
|
2472
2468
|
items[bundleIndex - 1] = file;
|
|
2473
2469
|
let url, parent;
|
|
2474
|
-
if (file.fetchType === 1
|
|
2470
|
+
if (file.fetchType === 1 && (cacheToDisk.has(url = file.url) || cacheToMemory.has(url)) && (parent = assets.find(item => item.bundleIndex === 0 && item.bundleId === bundleId))) {
|
|
2475
2471
|
(parent.bundleQueue || (parent.bundleQueue = [])).push(new Promise(resolve => {
|
|
2476
2472
|
this.Request.open(url, { method: 'HEAD', httpVersion: 1 })
|
|
2477
2473
|
.on('response', res => {
|
|
2478
|
-
if (res.statusCode < 300
|
|
2474
|
+
if (res.statusCode < 300) {
|
|
2479
2475
|
applyHeaders(file, res.headers);
|
|
2480
2476
|
}
|
|
2481
2477
|
resolve(file);
|
|
@@ -2539,7 +2535,7 @@ class FileManager extends core_1.Host {
|
|
|
2539
2535
|
}
|
|
2540
2536
|
catch (err) {
|
|
2541
2537
|
items.forEach(queue => queue.invalid = true);
|
|
2542
|
-
this.writeFail([buffer ? "Unable to write buffer"
|
|
2538
|
+
this.writeFail([buffer ? "Unable to write buffer" : "Unable to copy file", path.basename(file.localUri)], err, 32);
|
|
2543
2539
|
}
|
|
2544
2540
|
}
|
|
2545
2541
|
};
|
|
@@ -2594,7 +2590,7 @@ class FileManager extends core_1.Host {
|
|
|
2594
2590
|
checkEtag = false;
|
|
2595
2591
|
}
|
|
2596
2592
|
else if (uri) {
|
|
2597
|
-
if (type === 1
|
|
2593
|
+
if (type === 1 || type === 2) {
|
|
2598
2594
|
const url = queue.url;
|
|
2599
2595
|
const options = {
|
|
2600
2596
|
url,
|
|
@@ -2602,7 +2598,7 @@ class FileManager extends core_1.Host {
|
|
|
2602
2598
|
statusMessage: uri + ` (${queue.bundleIndex})`
|
|
2603
2599
|
};
|
|
2604
2600
|
let etag, pipeTo;
|
|
2605
|
-
if (type === 2
|
|
2601
|
+
if (type === 2) {
|
|
2606
2602
|
options.socketPath = queue.socketPath;
|
|
2607
2603
|
options.httpVersion = 1;
|
|
2608
2604
|
}
|
|
@@ -2694,7 +2690,7 @@ class FileManager extends core_1.Host {
|
|
|
2694
2690
|
const pathname = this.getTempDir({ uuidDir: true });
|
|
2695
2691
|
if (!pathname || !mimeType) {
|
|
2696
2692
|
queue.invalid = true;
|
|
2697
|
-
tasks.push(Promise.reject(!pathname ? new Error("Unable to create temp directory"
|
|
2693
|
+
tasks.push(Promise.reject(!pathname ? new Error("Unable to create temp directory") : (0, types_1.errorValue)("MIME not found", uri)));
|
|
2698
2694
|
break;
|
|
2699
2695
|
}
|
|
2700
2696
|
tasks.push(this.fetchFiles(queue.url || uri, { pathname, binOpts: queue.binOpts || file.binOpts })
|
|
@@ -2732,7 +2728,7 @@ class FileManager extends core_1.Host {
|
|
|
2732
2728
|
success = await Promise.all(tasks)
|
|
2733
2729
|
.then(() => true)
|
|
2734
2730
|
.catch(err => {
|
|
2735
|
-
this.writeFail(["Unable to download file"
|
|
2731
|
+
this.writeFail(["Unable to download file", 'bundle: ' + path.basename(localUri)], err, 1024);
|
|
2736
2732
|
return false;
|
|
2737
2733
|
});
|
|
2738
2734
|
}
|
|
@@ -2798,10 +2794,10 @@ class FileManager extends core_1.Host {
|
|
|
2798
2794
|
if (!preceding) {
|
|
2799
2795
|
this.completeAsyncTask();
|
|
2800
2796
|
}
|
|
2801
|
-
this.writeFail(["Unable to download file"
|
|
2797
|
+
this.writeFail(["Unable to download file", uri], err, err instanceof Error && err.message.startsWith("Timeout was exceeded") ? 16384 : 1024);
|
|
2802
2798
|
};
|
|
2803
2799
|
const errorPermission = (file) => {
|
|
2804
|
-
this.writeFail(["Unable to read file"
|
|
2800
|
+
this.writeFail(["Unable to read file", file.uri], (0, types_1.errorValue)('Operation not permitted', file.uri || "Unknown"), 8192);
|
|
2805
2801
|
file.invalid = true;
|
|
2806
2802
|
};
|
|
2807
2803
|
const createFolder = (file, pathname) => {
|
|
@@ -2814,7 +2810,7 @@ class FileManager extends core_1.Host {
|
|
|
2814
2810
|
}
|
|
2815
2811
|
else {
|
|
2816
2812
|
file.invalid = true;
|
|
2817
|
-
this.writeFail("Unable to create directory"
|
|
2813
|
+
this.writeFail("Unable to create directory", (0, types_1.errorValue)('Path not found', pathname));
|
|
2818
2814
|
return false;
|
|
2819
2815
|
}
|
|
2820
2816
|
}
|
|
@@ -2830,7 +2826,7 @@ class FileManager extends core_1.Host {
|
|
|
2830
2826
|
item.invalid = true;
|
|
2831
2827
|
this.filesToRemove.add(localUri);
|
|
2832
2828
|
this.completeAsyncTask();
|
|
2833
|
-
this.writeFail(["Checksum did not match"
|
|
2829
|
+
this.writeFail(["Checksum did not match", path.basename(localUri)], (0, types_1.errorValue)(item.uri || localUri, "Invalid checksum"), { type: 32, queue: true });
|
|
2834
2830
|
return;
|
|
2835
2831
|
}
|
|
2836
2832
|
if (fetched) {
|
|
@@ -2873,7 +2869,7 @@ class FileManager extends core_1.Host {
|
|
|
2873
2869
|
const type = item.incremental;
|
|
2874
2870
|
let valid = cacheOpen;
|
|
2875
2871
|
if (valid) {
|
|
2876
|
-
if (type === false || type === "none"
|
|
2872
|
+
if (type === false || type === "none") {
|
|
2877
2873
|
valid = false;
|
|
2878
2874
|
}
|
|
2879
2875
|
}
|
|
@@ -2886,9 +2882,9 @@ class FileManager extends core_1.Host {
|
|
|
2886
2882
|
}
|
|
2887
2883
|
}
|
|
2888
2884
|
if (valid && filename) {
|
|
2889
|
-
const etag = (cacheEtag && type !== "exists"
|
|
2885
|
+
const etag = (cacheEtag && type !== "exists" || type === "etag") && !!uri;
|
|
2890
2886
|
if (etag && imported.some(file => file.imported.includes(uri))) {
|
|
2891
|
-
item.incremental = "none"
|
|
2887
|
+
item.incremental = "none";
|
|
2892
2888
|
}
|
|
2893
2889
|
else if (!(0, types_1.mainFlag)(item.flags)) {
|
|
2894
2890
|
let cached;
|
|
@@ -2901,7 +2897,7 @@ class FileManager extends core_1.Host {
|
|
|
2901
2897
|
}
|
|
2902
2898
|
return false;
|
|
2903
2899
|
};
|
|
2904
|
-
if ((!etag || item.fetchType === 1
|
|
2900
|
+
if ((!etag || item.fetchType === 1 && ((0, types_1.isEmpty)(bundleId) || bundleIndex <= 0)) && (!watch || !item.watch || setBuffer(item))) {
|
|
2905
2901
|
let childBundle, childDownload;
|
|
2906
2902
|
if (!(0, types_1.isEmpty)(bundleId) && bundleIndex > 0) {
|
|
2907
2903
|
const target = assets.find(parent => parent.bundleIndex === 0 && parent.bundleId === bundleId);
|
|
@@ -2938,8 +2934,8 @@ class FileManager extends core_1.Host {
|
|
|
2938
2934
|
}
|
|
2939
2935
|
const checksumOutput = item.checksumOutput;
|
|
2940
2936
|
if (core_1.Host.isPath(localUri) && (!checksumOutput || checkHash.call(this, localUri, true, checksumOutput))) {
|
|
2941
|
-
item.flags |= 128
|
|
2942
|
-
if (!etag || item.fetchType !== 1
|
|
2937
|
+
item.flags |= 128;
|
|
2938
|
+
if (!etag || item.fetchType !== 1 || checksumOutput) {
|
|
2943
2939
|
if (bundleIndex === 0 && !(0, types_1.isEmpty)(bundleId)) {
|
|
2944
2940
|
assets.filter(child => child.bundleId === bundleId && child.bundleIndex > 0).forEach(child => {
|
|
2945
2941
|
setBuffer(child);
|
|
@@ -3003,7 +2999,6 @@ class FileManager extends core_1.Host {
|
|
|
3003
2999
|
break;
|
|
3004
3000
|
}
|
|
3005
3001
|
const { pathname, localUri } = download;
|
|
3006
|
-
const uri = item.uri;
|
|
3007
3002
|
if (item.content) {
|
|
3008
3003
|
if (!checkQueue(item, localUri, pathname, true)) {
|
|
3009
3004
|
const content = item.content;
|
|
@@ -3033,15 +3028,16 @@ class FileManager extends core_1.Host {
|
|
|
3033
3028
|
}
|
|
3034
3029
|
continue;
|
|
3035
3030
|
}
|
|
3031
|
+
const uri = item.uri;
|
|
3036
3032
|
if (!uri) {
|
|
3037
3033
|
item.invalid = true;
|
|
3038
3034
|
continue;
|
|
3039
3035
|
}
|
|
3040
3036
|
const checkDest = (src) => staging || !(0, lib_v4_1.hasSameStat)(src, localUri);
|
|
3041
|
-
const type = item.fetchType || 0
|
|
3037
|
+
const type = item.fetchType || 0;
|
|
3042
3038
|
const bundleMain = item.bundleIndex === 0 && !(0, types_1.isEmpty)(item.bundleId);
|
|
3043
|
-
const isHttp = type === 1
|
|
3044
|
-
if (isHttp || type === 2
|
|
3039
|
+
const isHttp = type === 1;
|
|
3040
|
+
if (isHttp || type === 2) {
|
|
3045
3041
|
let checkEtag;
|
|
3046
3042
|
if (bundling[uri] && (0, types_1.isEmpty)(item.bundleId)) {
|
|
3047
3043
|
bundling[uri].push(item);
|
|
@@ -3065,12 +3061,12 @@ class FileManager extends core_1.Host {
|
|
|
3065
3061
|
if (isHttp) {
|
|
3066
3062
|
cacheDir = cacheToDisk.has(url) && isCacheable(item);
|
|
3067
3063
|
cacheBuffer = cacheToMemory.has(url);
|
|
3068
|
-
mainEtag = (0, types_1.mainFlag)(item.flags) && (cacheEtag || item.incremental === "etag"
|
|
3064
|
+
mainEtag = (0, types_1.mainFlag)(item.flags) && (cacheEtag || item.incremental === "etag");
|
|
3069
3065
|
}
|
|
3070
3066
|
const closeResponse = () => client?.destroy();
|
|
3071
3067
|
const downloadUri = (request, etagDir) => {
|
|
3072
3068
|
if (checkEtag) {
|
|
3073
|
-
item.flags &= ~128
|
|
3069
|
+
item.flags &= ~128;
|
|
3074
3070
|
}
|
|
3075
3071
|
closeResponse();
|
|
3076
3072
|
const location = request.url.toString();
|
|
@@ -3122,7 +3118,7 @@ class FileManager extends core_1.Host {
|
|
|
3122
3118
|
(client = request.open(href, target))
|
|
3123
3119
|
.on('response', res => {
|
|
3124
3120
|
const statusCode = res.statusCode;
|
|
3125
|
-
if (statusCode < 300
|
|
3121
|
+
if (statusCode < 300) {
|
|
3126
3122
|
const etag = applyHeaders(item, res.headers, false, mainEtag);
|
|
3127
3123
|
let tempDir, etagDir;
|
|
3128
3124
|
if (etag) {
|
|
@@ -3214,7 +3210,7 @@ class FileManager extends core_1.Host {
|
|
|
3214
3210
|
fs.writeFileSync(localUri, buffer);
|
|
3215
3211
|
this.addDownload(Buffer.byteLength(buffer, encoding), types_1.DOWNLOAD_TYPE.CACHE);
|
|
3216
3212
|
if (checkEtag) {
|
|
3217
|
-
item.flags &= ~128
|
|
3213
|
+
item.flags &= ~128;
|
|
3218
3214
|
}
|
|
3219
3215
|
fileReceived(item, localUri, null, true, false, true);
|
|
3220
3216
|
closeResponse();
|
|
@@ -3230,7 +3226,7 @@ class FileManager extends core_1.Host {
|
|
|
3230
3226
|
}
|
|
3231
3227
|
downloadUri(target, etagDir);
|
|
3232
3228
|
}
|
|
3233
|
-
else if (statusCode < 400
|
|
3229
|
+
else if (statusCode < 400) {
|
|
3234
3230
|
closeResponse();
|
|
3235
3231
|
const location = res.headers.location;
|
|
3236
3232
|
if (location && ++redirects <= HTTP_CLIENT.redirectLimit) {
|
|
@@ -3276,7 +3272,7 @@ class FileManager extends core_1.Host {
|
|
|
3276
3272
|
}
|
|
3277
3273
|
else if (type) {
|
|
3278
3274
|
if (bundleMain && !item.mimeType) {
|
|
3279
|
-
errorRequest(item, (0, types_1.errorValue)("MIME not found"
|
|
3275
|
+
errorRequest(item, (0, types_1.errorValue)("MIME not found", uri), true);
|
|
3280
3276
|
}
|
|
3281
3277
|
else if (!checkQueue(item, localUri, pathname, false)) {
|
|
3282
3278
|
if (downloading[uri]) {
|
|
@@ -3314,7 +3310,7 @@ class FileManager extends core_1.Host {
|
|
|
3314
3310
|
found = true;
|
|
3315
3311
|
}
|
|
3316
3312
|
catch (err) {
|
|
3317
|
-
this.writeFail(["Unable to rename file"
|
|
3313
|
+
this.writeFail(["Unable to rename file", item.filename], err, 32);
|
|
3318
3314
|
}
|
|
3319
3315
|
}
|
|
3320
3316
|
else {
|
|
@@ -3395,7 +3391,7 @@ class FileManager extends core_1.Host {
|
|
|
3395
3391
|
item.buffer = result;
|
|
3396
3392
|
}
|
|
3397
3393
|
})
|
|
3398
|
-
.catch(err => this.writeFail(["Unable to compress file"
|
|
3394
|
+
.catch(err => this.writeFail(["Unable to compress file", path.basename(file)], err, { type: 8, startTime: options.startTime })));
|
|
3399
3395
|
}
|
|
3400
3396
|
}
|
|
3401
3397
|
}
|
|
@@ -3406,7 +3402,7 @@ class FileManager extends core_1.Host {
|
|
|
3406
3402
|
async finalizeDocument() {
|
|
3407
3403
|
for (const { instance, constructor } of this.Document) {
|
|
3408
3404
|
if (constructor.finalize && instance.assets.length) {
|
|
3409
|
-
await constructor.finalize.call(this, instance).catch(err => rejectModule.call(instance, err, 4
|
|
3405
|
+
await constructor.finalize.call(this, instance).catch(err => rejectModule.call(instance, err, 4));
|
|
3410
3406
|
if (this.aborted) {
|
|
3411
3407
|
return;
|
|
3412
3408
|
}
|
|
@@ -3418,7 +3414,7 @@ class FileManager extends core_1.Host {
|
|
|
3418
3414
|
for (const { instance, constructor } of this.Task) {
|
|
3419
3415
|
const items = assets.filter(item => item.tasks.find(data => data.handler === instance.moduleName));
|
|
3420
3416
|
if (items.length) {
|
|
3421
|
-
await (constructor.using || constructor.finalize).call(this, instance, items).catch(err => rejectModule.call(instance, err, 4
|
|
3417
|
+
await (constructor.using || constructor.finalize).call(this, instance, items).catch(err => rejectModule.call(instance, err, 4));
|
|
3422
3418
|
if (this.aborted) {
|
|
3423
3419
|
return;
|
|
3424
3420
|
}
|
|
@@ -3429,7 +3425,7 @@ class FileManager extends core_1.Host {
|
|
|
3429
3425
|
async finalizeCloud() {
|
|
3430
3426
|
const cloud = this.Cloud;
|
|
3431
3427
|
if (cloud) {
|
|
3432
|
-
return cloud_1.default.finalize.call(this, cloud).catch(err => rejectModule.call(cloud, err, 64
|
|
3428
|
+
return cloud_1.default.finalize.call(this, cloud).catch(err => rejectModule.call(cloud, err, 64));
|
|
3433
3429
|
}
|
|
3434
3430
|
}
|
|
3435
3431
|
async finalizeCleanup() {
|
|
@@ -3444,7 +3440,7 @@ class FileManager extends core_1.Host {
|
|
|
3444
3440
|
}
|
|
3445
3441
|
for (const { instance, constructor } of this.Document) {
|
|
3446
3442
|
if (constructor.cleanup && instance.assets.length) {
|
|
3447
|
-
await constructor.cleanup.call(this, instance).catch(err => rejectModule.call(instance, err, 4
|
|
3443
|
+
await constructor.cleanup.call(this, instance).catch(err => rejectModule.call(instance, err, 4));
|
|
3448
3444
|
}
|
|
3449
3445
|
}
|
|
3450
3446
|
}
|
|
@@ -3482,11 +3478,11 @@ class FileManager extends core_1.Host {
|
|
|
3482
3478
|
}
|
|
3483
3479
|
}
|
|
3484
3480
|
removeFiles();
|
|
3485
|
-
await this.finalizeCompress(this.assets.filter(item => item.compress && !ignoreAsset(item))).catch(err => rejectModule.call(this, err, 8
|
|
3481
|
+
await this.finalizeCompress(this.assets.filter(item => item.compress && !ignoreAsset(item))).catch(err => rejectModule.call(this, err, 8));
|
|
3486
3482
|
if (this.aborted) {
|
|
3487
3483
|
return Promise.reject((0, types_1.createAbortError)());
|
|
3488
3484
|
}
|
|
3489
|
-
await this.finalizeDocument().catch(err => rejectModule.call(this, err, 4
|
|
3485
|
+
await this.finalizeDocument().catch(err => rejectModule.call(this, err, 4));
|
|
3490
3486
|
if (this.aborted) {
|
|
3491
3487
|
return Promise.reject((0, types_1.createAbortError)());
|
|
3492
3488
|
}
|
|
@@ -3496,12 +3492,12 @@ class FileManager extends core_1.Host {
|
|
|
3496
3492
|
fs.writeFileSync(item.localUri, item.sourceUTF8, item.encoding || (item.encoding = 'utf-8'));
|
|
3497
3493
|
}
|
|
3498
3494
|
catch (err) {
|
|
3499
|
-
this.writeFail(["Unable to write file"
|
|
3495
|
+
this.writeFail(["Unable to write file", path.basename(item.localUri)], err, { type: 32, startTime });
|
|
3500
3496
|
}
|
|
3501
3497
|
}
|
|
3502
3498
|
}
|
|
3503
3499
|
removeFiles();
|
|
3504
|
-
await this.finalizeTask(this.taskAssets.filter(item => item.tasks?.find(data => !data.preceding) && item.localUri && this.has(item.localUri) && !ignoreAsset(item))).catch(err => rejectModule.call(this, err, 4
|
|
3500
|
+
await this.finalizeTask(this.taskAssets.filter(item => item.tasks?.find(data => !data.preceding) && item.localUri && this.has(item.localUri) && !ignoreAsset(item))).catch(err => rejectModule.call(this, err, 4));
|
|
3505
3501
|
if (this.aborted) {
|
|
3506
3502
|
return Promise.reject((0, types_1.createAbortError)());
|
|
3507
3503
|
}
|
|
@@ -3512,12 +3508,12 @@ class FileManager extends core_1.Host {
|
|
|
3512
3508
|
if (!filesToRemove.has(localUri) && !checkHash.call(this, localUri, true, item.checksumOutput)) {
|
|
3513
3509
|
item.invalid = true;
|
|
3514
3510
|
filesToRemove.add(localUri);
|
|
3515
|
-
this.writeFail(["Checksum did not match"
|
|
3511
|
+
this.writeFail(["Checksum did not match", path.basename(localUri)], (0, types_1.errorValue)(localUri, "Invalid checksum"), { type: 32, startTime, queue: true });
|
|
3516
3512
|
}
|
|
3517
3513
|
}
|
|
3518
3514
|
}
|
|
3519
3515
|
removeFiles();
|
|
3520
|
-
await this.finalizeCloud().catch(err => rejectModule.call(this, err, 64
|
|
3516
|
+
await this.finalizeCloud().catch(err => rejectModule.call(this, err, 64));
|
|
3521
3517
|
if (this.aborted) {
|
|
3522
3518
|
return Promise.reject((0, types_1.createAbortError)());
|
|
3523
3519
|
}
|
|
@@ -3546,22 +3542,22 @@ class FileManager extends core_1.Host {
|
|
|
3546
3542
|
try {
|
|
3547
3543
|
const files = (await FileManager.writeChecksum(baseDirectory, checksum.filename, checksum));
|
|
3548
3544
|
if (sumTime) {
|
|
3549
|
-
this.writeTimeElapsed(checksum.algorithm || "sha256"
|
|
3545
|
+
this.writeTimeElapsed(checksum.algorithm || "sha256", [baseDirectory, files.length + (files.length === 1 ? ' file' : ' files')], sumTime, { ...core_1.Host.LOG_STYLE_WARN });
|
|
3550
3546
|
}
|
|
3551
3547
|
}
|
|
3552
3548
|
catch (err) {
|
|
3553
|
-
this.writeFail(["Unable to read directory"
|
|
3549
|
+
this.writeFail(["Unable to read directory", path.basename(baseDirectory)], err, { type: 32, startTime });
|
|
3554
3550
|
}
|
|
3555
3551
|
}
|
|
3556
3552
|
}
|
|
3557
|
-
await this.finalizeCleanup().catch(err => rejectModule.call(this, err, 1
|
|
3553
|
+
await this.finalizeCleanup().catch(err => rejectModule.call(this, err, 1));
|
|
3558
3554
|
removeFiles();
|
|
3559
3555
|
if (LOG_TIMEELAPSED) {
|
|
3560
3556
|
const [h, d, c] = this[kDownloadStats];
|
|
3561
3557
|
const errorCount = this.errorCount;
|
|
3562
3558
|
const message = [];
|
|
3563
3559
|
if (errorCount) {
|
|
3564
|
-
message.push('ERROR ' + errorCount);
|
|
3560
|
+
message.push('ERROR ' + errorCount);
|
|
3565
3561
|
}
|
|
3566
3562
|
let [size, count] = h;
|
|
3567
3563
|
if (count) {
|
|
@@ -3587,7 +3583,7 @@ class FileManager extends core_1.Host {
|
|
|
3587
3583
|
this.Request.close();
|
|
3588
3584
|
}
|
|
3589
3585
|
set restarting(value) {
|
|
3590
|
-
this.finalizeState = (this[kRestarting] = value) ? 3
|
|
3586
|
+
this.finalizeState = (this[kRestarting] = value) ? 3 : 0;
|
|
3591
3587
|
}
|
|
3592
3588
|
get restarting() {
|
|
3593
3589
|
return this[kRestarting];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/file-manager",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.6",
|
|
4
4
|
"description": "FileManager constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
"license": "BSD 3-Clause",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/cloud": "0.8.
|
|
24
|
-
"@e-mc/compress": "0.8.
|
|
25
|
-
"@e-mc/core": "0.8.
|
|
26
|
-
"@e-mc/document": "0.8.
|
|
27
|
-
"@e-mc/image": "0.8.
|
|
28
|
-
"@e-mc/request": "0.8.
|
|
29
|
-
"@e-mc/task": "0.8.
|
|
30
|
-
"@e-mc/types": "0.8.
|
|
31
|
-
"@e-mc/watch": "0.8.
|
|
23
|
+
"@e-mc/cloud": "0.8.6",
|
|
24
|
+
"@e-mc/compress": "0.8.6",
|
|
25
|
+
"@e-mc/core": "0.8.6",
|
|
26
|
+
"@e-mc/document": "0.8.6",
|
|
27
|
+
"@e-mc/image": "0.8.6",
|
|
28
|
+
"@e-mc/request": "0.8.6",
|
|
29
|
+
"@e-mc/task": "0.8.6",
|
|
30
|
+
"@e-mc/types": "0.8.6",
|
|
31
|
+
"@e-mc/watch": "0.8.6",
|
|
32
32
|
"picomatch": "^3.0.1"
|
|
33
33
|
}
|
|
34
34
|
}
|