@nocobase/plugin-backup-restore 1.6.20 → 1.6.21

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 (152) hide show
  1. package/dist/client/d0c15e9119b8e3d3.js +10 -0
  2. package/dist/client/index.js +1 -1
  3. package/dist/externalVersion.js +5 -5
  4. package/dist/node_modules/@hapi/topo/package.json +1 -1
  5. package/dist/node_modules/archiver/index.js +2 -2
  6. package/dist/node_modules/archiver/node_modules/async/all.js +119 -0
  7. package/dist/node_modules/archiver/node_modules/async/allLimit.js +46 -0
  8. package/dist/node_modules/archiver/node_modules/async/allSeries.js +45 -0
  9. package/dist/node_modules/archiver/node_modules/async/any.js +122 -0
  10. package/dist/node_modules/archiver/node_modules/async/anyLimit.js +47 -0
  11. package/dist/node_modules/archiver/node_modules/async/anySeries.js +46 -0
  12. package/dist/node_modules/archiver/node_modules/async/apply.js +11 -0
  13. package/dist/node_modules/archiver/node_modules/async/applyEach.js +57 -0
  14. package/dist/node_modules/archiver/node_modules/async/applyEachSeries.js +37 -0
  15. package/dist/node_modules/archiver/node_modules/async/asyncify.js +118 -0
  16. package/dist/node_modules/archiver/node_modules/async/auto.js +333 -0
  17. package/dist/node_modules/archiver/node_modules/async/autoInject.js +182 -0
  18. package/dist/node_modules/archiver/node_modules/async/bower.json +17 -0
  19. package/dist/node_modules/archiver/node_modules/async/cargo.js +63 -0
  20. package/dist/node_modules/archiver/node_modules/async/cargoQueue.js +71 -0
  21. package/dist/node_modules/archiver/node_modules/async/compose.js +55 -0
  22. package/dist/node_modules/archiver/node_modules/async/concat.js +115 -0
  23. package/dist/node_modules/archiver/node_modules/async/concatLimit.js +60 -0
  24. package/dist/node_modules/archiver/node_modules/async/concatSeries.js +41 -0
  25. package/dist/node_modules/archiver/node_modules/async/constant.js +14 -0
  26. package/dist/node_modules/archiver/node_modules/async/detect.js +96 -0
  27. package/dist/node_modules/archiver/node_modules/async/detectLimit.js +48 -0
  28. package/dist/node_modules/archiver/node_modules/async/detectSeries.js +47 -0
  29. package/dist/node_modules/archiver/node_modules/async/dir.js +43 -0
  30. package/dist/node_modules/archiver/node_modules/async/dist/async.js +6062 -0
  31. package/dist/node_modules/archiver/node_modules/async/dist/async.min.js +1 -0
  32. package/dist/node_modules/archiver/node_modules/async/doDuring.js +68 -0
  33. package/dist/node_modules/archiver/node_modules/async/doUntil.js +46 -0
  34. package/dist/node_modules/archiver/node_modules/async/doWhilst.js +68 -0
  35. package/dist/node_modules/archiver/node_modules/async/during.js +78 -0
  36. package/dist/node_modules/archiver/node_modules/async/each.js +129 -0
  37. package/dist/node_modules/archiver/node_modules/async/eachLimit.js +50 -0
  38. package/dist/node_modules/archiver/node_modules/async/eachOf.js +185 -0
  39. package/dist/node_modules/archiver/node_modules/async/eachOfLimit.js +47 -0
  40. package/dist/node_modules/archiver/node_modules/async/eachOfSeries.js +39 -0
  41. package/dist/node_modules/archiver/node_modules/async/eachSeries.js +44 -0
  42. package/dist/node_modules/archiver/node_modules/async/ensureAsync.js +67 -0
  43. package/dist/node_modules/archiver/node_modules/async/every.js +119 -0
  44. package/dist/node_modules/archiver/node_modules/async/everyLimit.js +46 -0
  45. package/dist/node_modules/archiver/node_modules/async/everySeries.js +45 -0
  46. package/dist/node_modules/archiver/node_modules/async/filter.js +93 -0
  47. package/dist/node_modules/archiver/node_modules/async/filterLimit.js +45 -0
  48. package/dist/node_modules/archiver/node_modules/async/filterSeries.js +43 -0
  49. package/dist/node_modules/archiver/node_modules/async/find.js +96 -0
  50. package/dist/node_modules/archiver/node_modules/async/findLimit.js +48 -0
  51. package/dist/node_modules/archiver/node_modules/async/findSeries.js +47 -0
  52. package/dist/node_modules/archiver/node_modules/async/flatMap.js +115 -0
  53. package/dist/node_modules/archiver/node_modules/async/flatMapLimit.js +60 -0
  54. package/dist/node_modules/archiver/node_modules/async/flatMapSeries.js +41 -0
  55. package/dist/node_modules/archiver/node_modules/async/foldl.js +153 -0
  56. package/dist/node_modules/archiver/node_modules/async/foldr.js +41 -0
  57. package/dist/node_modules/archiver/node_modules/async/forEach.js +129 -0
  58. package/dist/node_modules/archiver/node_modules/async/forEachLimit.js +50 -0
  59. package/dist/node_modules/archiver/node_modules/async/forEachOf.js +185 -0
  60. package/dist/node_modules/archiver/node_modules/async/forEachOfLimit.js +47 -0
  61. package/dist/node_modules/archiver/node_modules/async/forEachOfSeries.js +39 -0
  62. package/dist/node_modules/archiver/node_modules/async/forEachSeries.js +44 -0
  63. package/dist/node_modules/archiver/node_modules/async/forever.js +68 -0
  64. package/dist/node_modules/archiver/node_modules/async/groupBy.js +108 -0
  65. package/dist/node_modules/archiver/node_modules/async/groupByLimit.js +71 -0
  66. package/dist/node_modules/archiver/node_modules/async/groupBySeries.js +36 -0
  67. package/dist/node_modules/archiver/node_modules/async/index.js +588 -0
  68. package/dist/node_modules/archiver/node_modules/async/inject.js +153 -0
  69. package/dist/node_modules/archiver/node_modules/async/internal/DoublyLinkedList.js +92 -0
  70. package/dist/node_modules/archiver/node_modules/async/internal/Heap.js +120 -0
  71. package/dist/node_modules/archiver/node_modules/async/internal/applyEach.js +29 -0
  72. package/dist/node_modules/archiver/node_modules/async/internal/asyncEachOfLimit.js +75 -0
  73. package/dist/node_modules/archiver/node_modules/async/internal/awaitify.js +28 -0
  74. package/dist/node_modules/archiver/node_modules/async/internal/breakLoop.js +10 -0
  75. package/dist/node_modules/archiver/node_modules/async/internal/consoleFunc.js +31 -0
  76. package/dist/node_modules/archiver/node_modules/async/internal/createTester.js +40 -0
  77. package/dist/node_modules/archiver/node_modules/async/internal/eachOfLimit.js +90 -0
  78. package/dist/node_modules/archiver/node_modules/async/internal/filter.js +55 -0
  79. package/dist/node_modules/archiver/node_modules/async/internal/getIterator.js +11 -0
  80. package/dist/node_modules/archiver/node_modules/async/internal/initialParams.js +14 -0
  81. package/dist/node_modules/archiver/node_modules/async/internal/isArrayLike.js +10 -0
  82. package/dist/node_modules/archiver/node_modules/async/internal/iterator.js +57 -0
  83. package/dist/node_modules/archiver/node_modules/async/internal/map.js +30 -0
  84. package/dist/node_modules/archiver/node_modules/async/internal/once.js +17 -0
  85. package/dist/node_modules/archiver/node_modules/async/internal/onlyOnce.js +15 -0
  86. package/dist/node_modules/archiver/node_modules/async/internal/parallel.js +34 -0
  87. package/dist/node_modules/archiver/node_modules/async/internal/promiseCallback.js +23 -0
  88. package/dist/node_modules/archiver/node_modules/async/internal/queue.js +294 -0
  89. package/dist/node_modules/archiver/node_modules/async/internal/range.js +14 -0
  90. package/dist/node_modules/archiver/node_modules/async/internal/reject.js +26 -0
  91. package/dist/node_modules/archiver/node_modules/async/internal/setImmediate.js +34 -0
  92. package/dist/node_modules/archiver/node_modules/async/internal/withoutIndex.js +10 -0
  93. package/dist/node_modules/archiver/node_modules/async/internal/wrapAsync.js +34 -0
  94. package/dist/node_modules/archiver/node_modules/async/log.js +41 -0
  95. package/dist/node_modules/archiver/node_modules/async/map.js +142 -0
  96. package/dist/node_modules/archiver/node_modules/async/mapLimit.js +45 -0
  97. package/dist/node_modules/archiver/node_modules/async/mapSeries.js +44 -0
  98. package/dist/node_modules/archiver/node_modules/async/mapValues.js +152 -0
  99. package/dist/node_modules/archiver/node_modules/async/mapValuesLimit.js +61 -0
  100. package/dist/node_modules/archiver/node_modules/async/mapValuesSeries.js +37 -0
  101. package/dist/node_modules/archiver/node_modules/async/memoize.js +91 -0
  102. package/dist/node_modules/archiver/node_modules/async/nextTick.js +52 -0
  103. package/dist/node_modules/archiver/node_modules/async/package.json +75 -0
  104. package/dist/node_modules/archiver/node_modules/async/parallel.js +180 -0
  105. package/dist/node_modules/archiver/node_modules/async/parallelLimit.js +41 -0
  106. package/dist/node_modules/archiver/node_modules/async/priorityQueue.js +60 -0
  107. package/dist/node_modules/archiver/node_modules/async/queue.js +24 -0
  108. package/dist/node_modules/archiver/node_modules/async/race.js +67 -0
  109. package/dist/node_modules/archiver/node_modules/async/reduce.js +153 -0
  110. package/dist/node_modules/archiver/node_modules/async/reduceRight.js +41 -0
  111. package/dist/node_modules/archiver/node_modules/async/reflect.js +78 -0
  112. package/dist/node_modules/archiver/node_modules/async/reflectAll.js +93 -0
  113. package/dist/node_modules/archiver/node_modules/async/reject.js +87 -0
  114. package/dist/node_modules/archiver/node_modules/async/rejectLimit.js +45 -0
  115. package/dist/node_modules/archiver/node_modules/async/rejectSeries.js +43 -0
  116. package/dist/node_modules/archiver/node_modules/async/retry.js +159 -0
  117. package/dist/node_modules/archiver/node_modules/async/retryable.js +77 -0
  118. package/dist/node_modules/archiver/node_modules/async/select.js +93 -0
  119. package/dist/node_modules/archiver/node_modules/async/selectLimit.js +45 -0
  120. package/dist/node_modules/archiver/node_modules/async/selectSeries.js +43 -0
  121. package/dist/node_modules/archiver/node_modules/async/seq.js +79 -0
  122. package/dist/node_modules/archiver/node_modules/async/series.js +186 -0
  123. package/dist/node_modules/archiver/node_modules/async/setImmediate.js +45 -0
  124. package/dist/node_modules/archiver/node_modules/async/some.js +122 -0
  125. package/dist/node_modules/archiver/node_modules/async/someLimit.js +47 -0
  126. package/dist/node_modules/archiver/node_modules/async/someSeries.js +46 -0
  127. package/dist/node_modules/archiver/node_modules/async/sortBy.js +190 -0
  128. package/dist/node_modules/archiver/node_modules/async/timeout.js +89 -0
  129. package/dist/node_modules/archiver/node_modules/async/times.js +50 -0
  130. package/dist/node_modules/archiver/node_modules/async/timesLimit.js +43 -0
  131. package/dist/node_modules/archiver/node_modules/async/timesSeries.js +32 -0
  132. package/dist/node_modules/archiver/node_modules/async/transform.js +173 -0
  133. package/dist/node_modules/archiver/node_modules/async/tryEach.js +78 -0
  134. package/dist/node_modules/archiver/node_modules/async/unmemoize.js +25 -0
  135. package/dist/node_modules/archiver/node_modules/async/until.js +61 -0
  136. package/dist/node_modules/archiver/node_modules/async/waterfall.js +105 -0
  137. package/dist/node_modules/archiver/node_modules/async/whilst.js +78 -0
  138. package/dist/node_modules/archiver/node_modules/async/wrapSync.js +118 -0
  139. package/dist/node_modules/archiver/package.json +1 -1
  140. package/dist/node_modules/decompress/package.json +1 -1
  141. package/dist/node_modules/mkdirp/package.json +1 -1
  142. package/dist/node_modules/moment/package.json +1 -1
  143. package/dist/node_modules/semver/bin/semver.js +7 -15
  144. package/dist/node_modules/semver/classes/range.js +28 -13
  145. package/dist/node_modules/semver/classes/semver.js +23 -7
  146. package/dist/node_modules/semver/functions/diff.js +5 -12
  147. package/dist/node_modules/semver/index.js +1 -1
  148. package/dist/node_modules/semver/internal/lrucache.js +40 -0
  149. package/dist/node_modules/semver/internal/re.js +2 -0
  150. package/dist/node_modules/semver/package.json +1 -1
  151. package/package.json +3 -3
  152. package/dist/client/04e68bac2ed0170d.js +0 -10
@@ -0,0 +1,185 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _isArrayLike = require('./internal/isArrayLike.js');
8
+
9
+ var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
10
+
11
+ var _breakLoop = require('./internal/breakLoop.js');
12
+
13
+ var _breakLoop2 = _interopRequireDefault(_breakLoop);
14
+
15
+ var _eachOfLimit = require('./eachOfLimit.js');
16
+
17
+ var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
18
+
19
+ var _once = require('./internal/once.js');
20
+
21
+ var _once2 = _interopRequireDefault(_once);
22
+
23
+ var _onlyOnce = require('./internal/onlyOnce.js');
24
+
25
+ var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
26
+
27
+ var _wrapAsync = require('./internal/wrapAsync.js');
28
+
29
+ var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
30
+
31
+ var _awaitify = require('./internal/awaitify.js');
32
+
33
+ var _awaitify2 = _interopRequireDefault(_awaitify);
34
+
35
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36
+
37
+ // eachOf implementation optimized for array-likes
38
+ function eachOfArrayLike(coll, iteratee, callback) {
39
+ callback = (0, _once2.default)(callback);
40
+ var index = 0,
41
+ completed = 0,
42
+ { length } = coll,
43
+ canceled = false;
44
+ if (length === 0) {
45
+ callback(null);
46
+ }
47
+
48
+ function iteratorCallback(err, value) {
49
+ if (err === false) {
50
+ canceled = true;
51
+ }
52
+ if (canceled === true) return;
53
+ if (err) {
54
+ callback(err);
55
+ } else if (++completed === length || value === _breakLoop2.default) {
56
+ callback(null);
57
+ }
58
+ }
59
+
60
+ for (; index < length; index++) {
61
+ iteratee(coll[index], index, (0, _onlyOnce2.default)(iteratorCallback));
62
+ }
63
+ }
64
+
65
+ // a generic version of eachOf which can handle array, object, and iterator cases.
66
+ function eachOfGeneric(coll, iteratee, callback) {
67
+ return (0, _eachOfLimit2.default)(coll, Infinity, iteratee, callback);
68
+ }
69
+
70
+ /**
71
+ * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument
72
+ * to the iteratee.
73
+ *
74
+ * @name eachOf
75
+ * @static
76
+ * @memberOf module:Collections
77
+ * @method
78
+ * @alias forEachOf
79
+ * @category Collection
80
+ * @see [async.each]{@link module:Collections.each}
81
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
82
+ * @param {AsyncFunction} iteratee - A function to apply to each
83
+ * item in `coll`.
84
+ * The `key` is the item's key, or index in the case of an array.
85
+ * Invoked with (item, key, callback).
86
+ * @param {Function} [callback] - A callback which is called when all
87
+ * `iteratee` functions have finished, or an error occurs. Invoked with (err).
88
+ * @returns {Promise} a promise, if a callback is omitted
89
+ * @example
90
+ *
91
+ * // dev.json is a file containing a valid json object config for dev environment
92
+ * // dev.json is a file containing a valid json object config for test environment
93
+ * // prod.json is a file containing a valid json object config for prod environment
94
+ * // invalid.json is a file with a malformed json object
95
+ *
96
+ * let configs = {}; //global variable
97
+ * let validConfigFileMap = {dev: 'dev.json', test: 'test.json', prod: 'prod.json'};
98
+ * let invalidConfigFileMap = {dev: 'dev.json', test: 'test.json', invalid: 'invalid.json'};
99
+ *
100
+ * // asynchronous function that reads a json file and parses the contents as json object
101
+ * function parseFile(file, key, callback) {
102
+ * fs.readFile(file, "utf8", function(err, data) {
103
+ * if (err) return calback(err);
104
+ * try {
105
+ * configs[key] = JSON.parse(data);
106
+ * } catch (e) {
107
+ * return callback(e);
108
+ * }
109
+ * callback();
110
+ * });
111
+ * }
112
+ *
113
+ * // Using callbacks
114
+ * async.forEachOf(validConfigFileMap, parseFile, function (err) {
115
+ * if (err) {
116
+ * console.error(err);
117
+ * } else {
118
+ * console.log(configs);
119
+ * // configs is now a map of JSON data, e.g.
120
+ * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
121
+ * }
122
+ * });
123
+ *
124
+ * //Error handing
125
+ * async.forEachOf(invalidConfigFileMap, parseFile, function (err) {
126
+ * if (err) {
127
+ * console.error(err);
128
+ * // JSON parse error exception
129
+ * } else {
130
+ * console.log(configs);
131
+ * }
132
+ * });
133
+ *
134
+ * // Using Promises
135
+ * async.forEachOf(validConfigFileMap, parseFile)
136
+ * .then( () => {
137
+ * console.log(configs);
138
+ * // configs is now a map of JSON data, e.g.
139
+ * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
140
+ * }).catch( err => {
141
+ * console.error(err);
142
+ * });
143
+ *
144
+ * //Error handing
145
+ * async.forEachOf(invalidConfigFileMap, parseFile)
146
+ * .then( () => {
147
+ * console.log(configs);
148
+ * }).catch( err => {
149
+ * console.error(err);
150
+ * // JSON parse error exception
151
+ * });
152
+ *
153
+ * // Using async/await
154
+ * async () => {
155
+ * try {
156
+ * let result = await async.forEachOf(validConfigFileMap, parseFile);
157
+ * console.log(configs);
158
+ * // configs is now a map of JSON data, e.g.
159
+ * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
160
+ * }
161
+ * catch (err) {
162
+ * console.log(err);
163
+ * }
164
+ * }
165
+ *
166
+ * //Error handing
167
+ * async () => {
168
+ * try {
169
+ * let result = await async.forEachOf(invalidConfigFileMap, parseFile);
170
+ * console.log(configs);
171
+ * }
172
+ * catch (err) {
173
+ * console.log(err);
174
+ * // JSON parse error exception
175
+ * }
176
+ * }
177
+ *
178
+ */
179
+ function eachOf(coll, iteratee, callback) {
180
+ var eachOfImplementation = (0, _isArrayLike2.default)(coll) ? eachOfArrayLike : eachOfGeneric;
181
+ return eachOfImplementation(coll, (0, _wrapAsync2.default)(iteratee), callback);
182
+ }
183
+
184
+ exports.default = (0, _awaitify2.default)(eachOf, 3);
185
+ module.exports = exports.default;
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _eachOfLimit2 = require('./internal/eachOfLimit.js');
8
+
9
+ var _eachOfLimit3 = _interopRequireDefault(_eachOfLimit2);
10
+
11
+ var _wrapAsync = require('./internal/wrapAsync.js');
12
+
13
+ var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
14
+
15
+ var _awaitify = require('./internal/awaitify.js');
16
+
17
+ var _awaitify2 = _interopRequireDefault(_awaitify);
18
+
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+
21
+ /**
22
+ * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a
23
+ * time.
24
+ *
25
+ * @name eachOfLimit
26
+ * @static
27
+ * @memberOf module:Collections
28
+ * @method
29
+ * @see [async.eachOf]{@link module:Collections.eachOf}
30
+ * @alias forEachOfLimit
31
+ * @category Collection
32
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
33
+ * @param {number} limit - The maximum number of async operations at a time.
34
+ * @param {AsyncFunction} iteratee - An async function to apply to each
35
+ * item in `coll`. The `key` is the item's key, or index in the case of an
36
+ * array.
37
+ * Invoked with (item, key, callback).
38
+ * @param {Function} [callback] - A callback which is called when all
39
+ * `iteratee` functions have finished, or an error occurs. Invoked with (err).
40
+ * @returns {Promise} a promise, if a callback is omitted
41
+ */
42
+ function eachOfLimit(coll, limit, iteratee, callback) {
43
+ return (0, _eachOfLimit3.default)(limit)(coll, (0, _wrapAsync2.default)(iteratee), callback);
44
+ }
45
+
46
+ exports.default = (0, _awaitify2.default)(eachOfLimit, 4);
47
+ module.exports = exports.default;
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _eachOfLimit = require('./eachOfLimit.js');
8
+
9
+ var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
10
+
11
+ var _awaitify = require('./internal/awaitify.js');
12
+
13
+ var _awaitify2 = _interopRequireDefault(_awaitify);
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+
17
+ /**
18
+ * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time.
19
+ *
20
+ * @name eachOfSeries
21
+ * @static
22
+ * @memberOf module:Collections
23
+ * @method
24
+ * @see [async.eachOf]{@link module:Collections.eachOf}
25
+ * @alias forEachOfSeries
26
+ * @category Collection
27
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
28
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
29
+ * `coll`.
30
+ * Invoked with (item, key, callback).
31
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
32
+ * functions have finished, or an error occurs. Invoked with (err).
33
+ * @returns {Promise} a promise, if a callback is omitted
34
+ */
35
+ function eachOfSeries(coll, iteratee, callback) {
36
+ return (0, _eachOfLimit2.default)(coll, 1, iteratee, callback);
37
+ }
38
+ exports.default = (0, _awaitify2.default)(eachOfSeries, 3);
39
+ module.exports = exports.default;
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _eachLimit = require('./eachLimit.js');
8
+
9
+ var _eachLimit2 = _interopRequireDefault(_eachLimit);
10
+
11
+ var _awaitify = require('./internal/awaitify.js');
12
+
13
+ var _awaitify2 = _interopRequireDefault(_awaitify);
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+
17
+ /**
18
+ * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time.
19
+ *
20
+ * Note, that unlike [`each`]{@link module:Collections.each}, this function applies iteratee to each item
21
+ * in series and therefore the iteratee functions will complete in order.
22
+
23
+ * @name eachSeries
24
+ * @static
25
+ * @memberOf module:Collections
26
+ * @method
27
+ * @see [async.each]{@link module:Collections.each}
28
+ * @alias forEachSeries
29
+ * @category Collection
30
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
31
+ * @param {AsyncFunction} iteratee - An async function to apply to each
32
+ * item in `coll`.
33
+ * The array index is not passed to the iteratee.
34
+ * If you need the index, use `eachOfSeries`.
35
+ * Invoked with (item, callback).
36
+ * @param {Function} [callback] - A callback which is called when all
37
+ * `iteratee` functions have finished, or an error occurs. Invoked with (err).
38
+ * @returns {Promise} a promise, if a callback is omitted
39
+ */
40
+ function eachSeries(coll, iteratee, callback) {
41
+ return (0, _eachLimit2.default)(coll, 1, iteratee, callback);
42
+ }
43
+ exports.default = (0, _awaitify2.default)(eachSeries, 3);
44
+ module.exports = exports.default;
@@ -0,0 +1,68 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _onlyOnce = require('./internal/onlyOnce.js');
8
+
9
+ var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
10
+
11
+ var _ensureAsync = require('./ensureAsync.js');
12
+
13
+ var _ensureAsync2 = _interopRequireDefault(_ensureAsync);
14
+
15
+ var _wrapAsync = require('./internal/wrapAsync.js');
16
+
17
+ var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
18
+
19
+ var _awaitify = require('./internal/awaitify.js');
20
+
21
+ var _awaitify2 = _interopRequireDefault(_awaitify);
22
+
23
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
+
25
+ /**
26
+ * Calls the asynchronous function `fn` with a callback parameter that allows it
27
+ * to call itself again, in series, indefinitely.
28
+
29
+ * If an error is passed to the callback then `errback` is called with the
30
+ * error, and execution stops, otherwise it will never be called.
31
+ *
32
+ * @name forever
33
+ * @static
34
+ * @memberOf module:ControlFlow
35
+ * @method
36
+ * @category Control Flow
37
+ * @param {AsyncFunction} fn - an async function to call repeatedly.
38
+ * Invoked with (next).
39
+ * @param {Function} [errback] - when `fn` passes an error to it's callback,
40
+ * this function will be called, and execution stops. Invoked with (err).
41
+ * @returns {Promise} a promise that rejects if an error occurs and an errback
42
+ * is not passed
43
+ * @example
44
+ *
45
+ * async.forever(
46
+ * function(next) {
47
+ * // next is suitable for passing to things that need a callback(err [, whatever]);
48
+ * // it will result in this function being called again.
49
+ * },
50
+ * function(err) {
51
+ * // if next is called with a value in its first parameter, it will appear
52
+ * // in here as 'err', and execution will stop.
53
+ * }
54
+ * );
55
+ */
56
+ function forever(fn, errback) {
57
+ var done = (0, _onlyOnce2.default)(errback);
58
+ var task = (0, _wrapAsync2.default)((0, _ensureAsync2.default)(fn));
59
+
60
+ function next(err) {
61
+ if (err) return done(err);
62
+ if (err === false) return;
63
+ task(next);
64
+ }
65
+ return next();
66
+ }
67
+ exports.default = (0, _awaitify2.default)(forever, 2);
68
+ module.exports = exports.default;
@@ -0,0 +1,108 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = groupBy;
7
+
8
+ var _groupByLimit = require('./groupByLimit.js');
9
+
10
+ var _groupByLimit2 = _interopRequireDefault(_groupByLimit);
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ /**
15
+ * Returns a new object, where each value corresponds to an array of items, from
16
+ * `coll`, that returned the corresponding key. That is, the keys of the object
17
+ * correspond to the values passed to the `iteratee` callback.
18
+ *
19
+ * Note: Since this function applies the `iteratee` to each item in parallel,
20
+ * there is no guarantee that the `iteratee` functions will complete in order.
21
+ * However, the values for each key in the `result` will be in the same order as
22
+ * the original `coll`. For Objects, the values will roughly be in the order of
23
+ * the original Objects' keys (but this can vary across JavaScript engines).
24
+ *
25
+ * @name groupBy
26
+ * @static
27
+ * @memberOf module:Collections
28
+ * @method
29
+ * @category Collection
30
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
31
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
32
+ * `coll`.
33
+ * The iteratee should complete with a `key` to group the value under.
34
+ * Invoked with (value, callback).
35
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
36
+ * functions have finished, or an error occurs. Result is an `Object` whoses
37
+ * properties are arrays of values which returned the corresponding key.
38
+ * @returns {Promise} a promise, if no callback is passed
39
+ * @example
40
+ *
41
+ * // dir1 is a directory that contains file1.txt, file2.txt
42
+ * // dir2 is a directory that contains file3.txt, file4.txt
43
+ * // dir3 is a directory that contains file5.txt
44
+ * // dir4 does not exist
45
+ *
46
+ * const files = ['dir1/file1.txt','dir2','dir4']
47
+ *
48
+ * // asynchronous function that detects file type as none, file, or directory
49
+ * function detectFile(file, callback) {
50
+ * fs.stat(file, function(err, stat) {
51
+ * if (err) {
52
+ * return callback(null, 'none');
53
+ * }
54
+ * callback(null, stat.isDirectory() ? 'directory' : 'file');
55
+ * });
56
+ * }
57
+ *
58
+ * //Using callbacks
59
+ * async.groupBy(files, detectFile, function(err, result) {
60
+ * if(err) {
61
+ * console.log(err);
62
+ * } else {
63
+ * console.log(result);
64
+ * // {
65
+ * // file: [ 'dir1/file1.txt' ],
66
+ * // none: [ 'dir4' ],
67
+ * // directory: [ 'dir2']
68
+ * // }
69
+ * // result is object containing the files grouped by type
70
+ * }
71
+ * });
72
+ *
73
+ * // Using Promises
74
+ * async.groupBy(files, detectFile)
75
+ * .then( result => {
76
+ * console.log(result);
77
+ * // {
78
+ * // file: [ 'dir1/file1.txt' ],
79
+ * // none: [ 'dir4' ],
80
+ * // directory: [ 'dir2']
81
+ * // }
82
+ * // result is object containing the files grouped by type
83
+ * }).catch( err => {
84
+ * console.log(err);
85
+ * });
86
+ *
87
+ * // Using async/await
88
+ * async () => {
89
+ * try {
90
+ * let result = await async.groupBy(files, detectFile);
91
+ * console.log(result);
92
+ * // {
93
+ * // file: [ 'dir1/file1.txt' ],
94
+ * // none: [ 'dir4' ],
95
+ * // directory: [ 'dir2']
96
+ * // }
97
+ * // result is object containing the files grouped by type
98
+ * }
99
+ * catch (err) {
100
+ * console.log(err);
101
+ * }
102
+ * }
103
+ *
104
+ */
105
+ function groupBy(coll, iteratee, callback) {
106
+ return (0, _groupByLimit2.default)(coll, Infinity, iteratee, callback);
107
+ }
108
+ module.exports = exports.default;
@@ -0,0 +1,71 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _mapLimit = require('./mapLimit.js');
8
+
9
+ var _mapLimit2 = _interopRequireDefault(_mapLimit);
10
+
11
+ var _wrapAsync = require('./internal/wrapAsync.js');
12
+
13
+ var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
14
+
15
+ var _awaitify = require('./internal/awaitify.js');
16
+
17
+ var _awaitify2 = _interopRequireDefault(_awaitify);
18
+
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+
21
+ /**
22
+ * The same as [`groupBy`]{@link module:Collections.groupBy} but runs a maximum of `limit` async operations at a time.
23
+ *
24
+ * @name groupByLimit
25
+ * @static
26
+ * @memberOf module:Collections
27
+ * @method
28
+ * @see [async.groupBy]{@link module:Collections.groupBy}
29
+ * @category Collection
30
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
31
+ * @param {number} limit - The maximum number of async operations at a time.
32
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
33
+ * `coll`.
34
+ * The iteratee should complete with a `key` to group the value under.
35
+ * Invoked with (value, callback).
36
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
37
+ * functions have finished, or an error occurs. Result is an `Object` whoses
38
+ * properties are arrays of values which returned the corresponding key.
39
+ * @returns {Promise} a promise, if no callback is passed
40
+ */
41
+ function groupByLimit(coll, limit, iteratee, callback) {
42
+ var _iteratee = (0, _wrapAsync2.default)(iteratee);
43
+ return (0, _mapLimit2.default)(coll, limit, (val, iterCb) => {
44
+ _iteratee(val, (err, key) => {
45
+ if (err) return iterCb(err);
46
+ return iterCb(err, { key, val });
47
+ });
48
+ }, (err, mapResults) => {
49
+ var result = {};
50
+ // from MDN, handle object having an `hasOwnProperty` prop
51
+ var { hasOwnProperty } = Object.prototype;
52
+
53
+ for (var i = 0; i < mapResults.length; i++) {
54
+ if (mapResults[i]) {
55
+ var { key } = mapResults[i];
56
+ var { val } = mapResults[i];
57
+
58
+ if (hasOwnProperty.call(result, key)) {
59
+ result[key].push(val);
60
+ } else {
61
+ result[key] = [val];
62
+ }
63
+ }
64
+ }
65
+
66
+ return callback(err, result);
67
+ });
68
+ }
69
+
70
+ exports.default = (0, _awaitify2.default)(groupByLimit, 4);
71
+ module.exports = exports.default;
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = groupBySeries;
7
+
8
+ var _groupByLimit = require('./groupByLimit.js');
9
+
10
+ var _groupByLimit2 = _interopRequireDefault(_groupByLimit);
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ /**
15
+ * The same as [`groupBy`]{@link module:Collections.groupBy} but runs only a single async operation at a time.
16
+ *
17
+ * @name groupBySeries
18
+ * @static
19
+ * @memberOf module:Collections
20
+ * @method
21
+ * @see [async.groupBy]{@link module:Collections.groupBy}
22
+ * @category Collection
23
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
24
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
25
+ * `coll`.
26
+ * The iteratee should complete with a `key` to group the value under.
27
+ * Invoked with (value, callback).
28
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
29
+ * functions have finished, or an error occurs. Result is an `Object` whose
30
+ * properties are arrays of values which returned the corresponding key.
31
+ * @returns {Promise} a promise, if no callback is passed
32
+ */
33
+ function groupBySeries(coll, iteratee, callback) {
34
+ return (0, _groupByLimit2.default)(coll, 1, iteratee, callback);
35
+ }
36
+ module.exports = exports.default;