@e-mc/file-manager 0.9.3 → 0.9.4

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 (3) hide show
  1. package/README.md +10 -10
  2. package/index.js +20 -20
  3. package/package.json +10 -10
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.9.3/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.9.4/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { DataSource, IncrementalMatch, TaskAction } from "./squared";
@@ -286,15 +286,15 @@ NOTE: **FileManager** is a sub-class of [Host](https://www.npmjs.com/package/@e-
286
286
 
287
287
  ## References
288
288
 
289
- - https://www.unpkg.com/@e-mc/types@0.9.3/lib/squared.d.ts
290
- - https://www.unpkg.com/@e-mc/types@0.9.3/lib/asset.d.ts
291
- - https://www.unpkg.com/@e-mc/types@0.9.3/lib/core.d.ts
292
- - https://www.unpkg.com/@e-mc/types@0.9.3/lib/filemanager.d.ts
293
- - https://www.unpkg.com/@e-mc/types@0.9.3/lib/logger.d.ts
294
- - https://www.unpkg.com/@e-mc/types@0.9.3/lib/module.d.ts
295
- - https://www.unpkg.com/@e-mc/types@0.9.3/lib/node.d.ts
296
- - https://www.unpkg.com/@e-mc/types@0.9.3/lib/request.d.ts
297
- - https://www.unpkg.com/@e-mc/types@0.9.3/lib/settings.d.ts
289
+ - https://www.unpkg.com/@e-mc/types@0.9.4/lib/squared.d.ts
290
+ - https://www.unpkg.com/@e-mc/types@0.9.4/lib/asset.d.ts
291
+ - https://www.unpkg.com/@e-mc/types@0.9.4/lib/core.d.ts
292
+ - https://www.unpkg.com/@e-mc/types@0.9.4/lib/filemanager.d.ts
293
+ - https://www.unpkg.com/@e-mc/types@0.9.4/lib/logger.d.ts
294
+ - https://www.unpkg.com/@e-mc/types@0.9.4/lib/module.d.ts
295
+ - https://www.unpkg.com/@e-mc/types@0.9.4/lib/node.d.ts
296
+ - https://www.unpkg.com/@e-mc/types@0.9.4/lib/request.d.ts
297
+ - https://www.unpkg.com/@e-mc/types@0.9.4/lib/settings.d.ts
298
298
 
299
299
  * https://www.npmjs.com/package/@types/node
300
300
 
package/index.js CHANGED
@@ -1693,25 +1693,8 @@ class FileManager extends core_1.Host {
1693
1693
  if (state === 0 && (this.cleared && this[kDelayed] <= 0 || override) || (this.aborted || state === 3) && override) {
1694
1694
  this.clearProcessTimeout();
1695
1695
  this[kDelayed] = Infinity;
1696
- const resetState = () => {
1697
- this.finalizeState = 2;
1698
- this._pendingResult = null;
1699
- };
1700
- const aborted = (err) => {
1701
- if (!this.restarting) {
1702
- this.writeFail(["Transaction was not completed", this.baseDirectory], err);
1703
- resetState();
1704
- }
1705
- else {
1706
- this.finalizeState = 4;
1707
- }
1708
- this.emit('end', [], collectErrors.call(this), this.collectLog());
1709
- if (!this.restarting) {
1710
- this.done = true;
1711
- }
1712
- };
1713
1696
  if (this.aborted) {
1714
- aborted((0, types_1.createAbortError)());
1697
+ this.abortFinalize((0, types_1.createAbortError)());
1715
1698
  return;
1716
1699
  }
1717
1700
  this.finalizeState = 1;
@@ -1731,7 +1714,7 @@ class FileManager extends core_1.Host {
1731
1714
  if (LOG_TIMEELAPSED) {
1732
1715
  this.writeTimeElapsed('END', this.baseDirectory, this.startTime, errors.length > 0 ? { failed: true, ...core_1.Host.LOG_STYLE_FAIL } : { ...core_1.Host.LOG_STYLE_SUCCESS });
1733
1716
  }
1734
- resetState();
1717
+ this.resetState();
1735
1718
  const log = this.config.log;
1736
1719
  let useNumeric, showSize;
1737
1720
  if ((0, types_1.isObject)(log)) {
@@ -1744,7 +1727,7 @@ class FileManager extends core_1.Host {
1744
1727
  this.emit('end', items, errors, this.collectLog());
1745
1728
  this.done = true;
1746
1729
  })
1747
- .catch((err) => aborted(err));
1730
+ .catch((err) => this.abortFinalize(err));
1748
1731
  }
1749
1732
  }
1750
1733
  hasDocument(instance, document) {
@@ -3891,6 +3874,23 @@ class FileManager extends core_1.Host {
3891
3874
  close() {
3892
3875
  this.Request.close();
3893
3876
  }
3877
+ resetState() {
3878
+ this.finalizeState = 2;
3879
+ this._pendingResult = null;
3880
+ }
3881
+ abortFinalize(err) {
3882
+ if (!this.restarting) {
3883
+ this.writeFail(["Transaction was not completed", this.baseDirectory], err);
3884
+ this.resetState();
3885
+ }
3886
+ else {
3887
+ this.finalizeState = 4;
3888
+ }
3889
+ this.emit('end', [], collectErrors.call(this), this.collectLog());
3890
+ if (!this.restarting) {
3891
+ this.done = true;
3892
+ }
3893
+ }
3894
3894
  set restarting(value) {
3895
3895
  this.finalizeState = (this[kRestarting] = value) ? 3 : 0;
3896
3896
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/file-manager",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
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.9.3",
24
- "@e-mc/compress": "0.9.3",
25
- "@e-mc/core": "0.9.3",
26
- "@e-mc/document": "0.9.3",
27
- "@e-mc/image": "0.9.3",
28
- "@e-mc/request": "0.9.3",
29
- "@e-mc/task": "0.9.3",
30
- "@e-mc/types": "0.9.3",
31
- "@e-mc/watch": "0.9.3",
23
+ "@e-mc/cloud": "0.9.4",
24
+ "@e-mc/compress": "0.9.4",
25
+ "@e-mc/core": "0.9.4",
26
+ "@e-mc/document": "0.9.4",
27
+ "@e-mc/image": "0.9.4",
28
+ "@e-mc/request": "0.9.4",
29
+ "@e-mc/task": "0.9.4",
30
+ "@e-mc/types": "0.9.4",
31
+ "@e-mc/watch": "0.9.4",
32
32
  "chalk": "4.1.2",
33
33
  "picomatch": "^4.0.2"
34
34
  }