@e-mc/file-manager 0.5.7 → 0.5.8

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.
Files changed (2) hide show
  1. package/index.js +20 -20
  2. package/package.json +10 -10
package/index.js CHANGED
@@ -1323,25 +1323,8 @@ class FileManager extends core_1.Host {
1323
1323
  if (state === 0 && (this.cleared && this[kDelayed] <= 0 || override) || (this.aborted || state === 3) && override) {
1324
1324
  this.clearProcessTimeout();
1325
1325
  this[kDelayed] = Infinity;
1326
- const resetState = () => {
1327
- this.finalizeState = 2;
1328
- this._pendingResult = null;
1329
- };
1330
- const aborted = (err) => {
1331
- if (!this.restarting) {
1332
- this.writeFail(["Transaction was not completed", this.baseDirectory], err);
1333
- resetState();
1334
- }
1335
- else {
1336
- this.finalizeState = 4;
1337
- }
1338
- this.emit('end', [], collectErrors.call(this), this.collectLog());
1339
- if (!this.restarting) {
1340
- this.done = true;
1341
- }
1342
- };
1343
1326
  if (this.aborted) {
1344
- aborted((0, types_1.createAbortError)());
1327
+ this.abortFinalize((0, types_1.createAbortError)());
1345
1328
  return;
1346
1329
  }
1347
1330
  this.finalizeState = 1;
@@ -1361,7 +1344,7 @@ class FileManager extends core_1.Host {
1361
1344
  if (LOG_TIMEELAPSED) {
1362
1345
  this.writeTimeElapsed('END', this.baseDirectory, this.startTime, errors.length > 0 ? { failed: true, ...core_1.Host.LOG_STYLE_FAIL } : { ...core_1.Host.LOG_STYLE_SUCCESS });
1363
1346
  }
1364
- resetState();
1347
+ this.resetState();
1365
1348
  const log = this.config.log;
1366
1349
  let useNumeric = false, showSize = true;
1367
1350
  if ((0, types_1.isPlainObject)(log)) {
@@ -1374,7 +1357,7 @@ class FileManager extends core_1.Host {
1374
1357
  this.emit('end', items, errors, this.collectLog());
1375
1358
  this.done = true;
1376
1359
  })
1377
- .catch(err => aborted(err));
1360
+ .catch(err => this.abortFinalize(err));
1378
1361
  }
1379
1362
  }
1380
1363
  hasDocument(instance, document) {
@@ -3275,6 +3258,23 @@ class FileManager extends core_1.Host {
3275
3258
  close() {
3276
3259
  this.Request.close();
3277
3260
  }
3261
+ resetState() {
3262
+ this.finalizeState = 2;
3263
+ this._pendingResult = null;
3264
+ }
3265
+ abortFinalize(err) {
3266
+ if (!this.restarting) {
3267
+ this.writeFail(["Transaction was not completed", this.baseDirectory], err);
3268
+ this.resetState();
3269
+ }
3270
+ else {
3271
+ this.finalizeState = 4;
3272
+ }
3273
+ this.emit('end', [], collectErrors.call(this), this.collectLog());
3274
+ if (!this.restarting) {
3275
+ this.done = true;
3276
+ }
3277
+ }
3278
3278
  set restarting(value) {
3279
3279
  this.finalizeState = (this[kRestarting] = value) ? 3 : 0;
3280
3280
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/file-manager",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
4
4
  "description": "FileManager constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -20,14 +20,14 @@
20
20
  "license": "MIT",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
- "@e-mc/cloud": "0.5.7",
24
- "@e-mc/compress": "0.5.7",
25
- "@e-mc/core": "0.5.7",
26
- "@e-mc/document": "0.5.7",
27
- "@e-mc/image": "0.5.7",
28
- "@e-mc/request": "0.5.7",
29
- "@e-mc/task": "0.5.7",
30
- "@e-mc/types": "0.5.7",
31
- "@e-mc/watch": "0.5.7"
23
+ "@e-mc/cloud": "0.5.8",
24
+ "@e-mc/compress": "0.5.8",
25
+ "@e-mc/core": "0.5.8",
26
+ "@e-mc/document": "0.5.8",
27
+ "@e-mc/image": "0.5.8",
28
+ "@e-mc/request": "0.5.8",
29
+ "@e-mc/task": "0.5.8",
30
+ "@e-mc/types": "0.5.8",
31
+ "@e-mc/watch": "0.5.8"
32
32
  }
33
33
  }