@e-mc/file-manager 0.6.4 → 0.6.5

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) {
@@ -3276,6 +3259,23 @@ class FileManager extends core_1.Host {
3276
3259
  close() {
3277
3260
  this.Request.close();
3278
3261
  }
3262
+ resetState() {
3263
+ this.finalizeState = 2;
3264
+ this._pendingResult = null;
3265
+ }
3266
+ abortFinalize(err) {
3267
+ if (!this.restarting) {
3268
+ this.writeFail(["Transaction was not completed", this.baseDirectory], err);
3269
+ this.resetState();
3270
+ }
3271
+ else {
3272
+ this.finalizeState = 4;
3273
+ }
3274
+ this.emit('end', [], collectErrors.call(this), this.collectLog());
3275
+ if (!this.restarting) {
3276
+ this.done = true;
3277
+ }
3278
+ }
3279
3279
  set restarting(value) {
3280
3280
  this.finalizeState = (this[kRestarting] = value) ? 3 : 0;
3281
3281
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/file-manager",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
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.6.4",
24
- "@e-mc/compress": "0.6.4",
25
- "@e-mc/core": "0.6.4",
26
- "@e-mc/document": "0.6.4",
27
- "@e-mc/image": "0.6.4",
28
- "@e-mc/request": "0.6.4",
29
- "@e-mc/task": "0.6.4",
30
- "@e-mc/types": "0.6.4",
31
- "@e-mc/watch": "0.6.4"
23
+ "@e-mc/cloud": "0.6.5",
24
+ "@e-mc/compress": "0.6.5",
25
+ "@e-mc/core": "0.6.5",
26
+ "@e-mc/document": "0.6.5",
27
+ "@e-mc/image": "0.6.5",
28
+ "@e-mc/request": "0.6.5",
29
+ "@e-mc/task": "0.6.5",
30
+ "@e-mc/types": "0.6.5",
31
+ "@e-mc/watch": "0.6.5"
32
32
  }
33
33
  }