@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.
- package/dist/client/d0c15e9119b8e3d3.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +5 -5
- package/dist/node_modules/@hapi/topo/package.json +1 -1
- package/dist/node_modules/archiver/index.js +2 -2
- package/dist/node_modules/archiver/node_modules/async/all.js +119 -0
- package/dist/node_modules/archiver/node_modules/async/allLimit.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/allSeries.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/any.js +122 -0
- package/dist/node_modules/archiver/node_modules/async/anyLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/anySeries.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/apply.js +11 -0
- package/dist/node_modules/archiver/node_modules/async/applyEach.js +57 -0
- package/dist/node_modules/archiver/node_modules/async/applyEachSeries.js +37 -0
- package/dist/node_modules/archiver/node_modules/async/asyncify.js +118 -0
- package/dist/node_modules/archiver/node_modules/async/auto.js +333 -0
- package/dist/node_modules/archiver/node_modules/async/autoInject.js +182 -0
- package/dist/node_modules/archiver/node_modules/async/bower.json +17 -0
- package/dist/node_modules/archiver/node_modules/async/cargo.js +63 -0
- package/dist/node_modules/archiver/node_modules/async/cargoQueue.js +71 -0
- package/dist/node_modules/archiver/node_modules/async/compose.js +55 -0
- package/dist/node_modules/archiver/node_modules/async/concat.js +115 -0
- package/dist/node_modules/archiver/node_modules/async/concatLimit.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/concatSeries.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/constant.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/detect.js +96 -0
- package/dist/node_modules/archiver/node_modules/async/detectLimit.js +48 -0
- package/dist/node_modules/archiver/node_modules/async/detectSeries.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/dir.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/dist/async.js +6062 -0
- package/dist/node_modules/archiver/node_modules/async/dist/async.min.js +1 -0
- package/dist/node_modules/archiver/node_modules/async/doDuring.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/doUntil.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/doWhilst.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/during.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/each.js +129 -0
- package/dist/node_modules/archiver/node_modules/async/eachLimit.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/eachOf.js +185 -0
- package/dist/node_modules/archiver/node_modules/async/eachOfLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/eachOfSeries.js +39 -0
- package/dist/node_modules/archiver/node_modules/async/eachSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/ensureAsync.js +67 -0
- package/dist/node_modules/archiver/node_modules/async/every.js +119 -0
- package/dist/node_modules/archiver/node_modules/async/everyLimit.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/everySeries.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/filter.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/filterLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/filterSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/find.js +96 -0
- package/dist/node_modules/archiver/node_modules/async/findLimit.js +48 -0
- package/dist/node_modules/archiver/node_modules/async/findSeries.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/flatMap.js +115 -0
- package/dist/node_modules/archiver/node_modules/async/flatMapLimit.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/flatMapSeries.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/foldl.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/foldr.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/forEach.js +129 -0
- package/dist/node_modules/archiver/node_modules/async/forEachLimit.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOf.js +185 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOfLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOfSeries.js +39 -0
- package/dist/node_modules/archiver/node_modules/async/forEachSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/forever.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/groupBy.js +108 -0
- package/dist/node_modules/archiver/node_modules/async/groupByLimit.js +71 -0
- package/dist/node_modules/archiver/node_modules/async/groupBySeries.js +36 -0
- package/dist/node_modules/archiver/node_modules/async/index.js +588 -0
- package/dist/node_modules/archiver/node_modules/async/inject.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/internal/DoublyLinkedList.js +92 -0
- package/dist/node_modules/archiver/node_modules/async/internal/Heap.js +120 -0
- package/dist/node_modules/archiver/node_modules/async/internal/applyEach.js +29 -0
- package/dist/node_modules/archiver/node_modules/async/internal/asyncEachOfLimit.js +75 -0
- package/dist/node_modules/archiver/node_modules/async/internal/awaitify.js +28 -0
- package/dist/node_modules/archiver/node_modules/async/internal/breakLoop.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/consoleFunc.js +31 -0
- package/dist/node_modules/archiver/node_modules/async/internal/createTester.js +40 -0
- package/dist/node_modules/archiver/node_modules/async/internal/eachOfLimit.js +90 -0
- package/dist/node_modules/archiver/node_modules/async/internal/filter.js +55 -0
- package/dist/node_modules/archiver/node_modules/async/internal/getIterator.js +11 -0
- package/dist/node_modules/archiver/node_modules/async/internal/initialParams.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/internal/isArrayLike.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/iterator.js +57 -0
- package/dist/node_modules/archiver/node_modules/async/internal/map.js +30 -0
- package/dist/node_modules/archiver/node_modules/async/internal/once.js +17 -0
- package/dist/node_modules/archiver/node_modules/async/internal/onlyOnce.js +15 -0
- package/dist/node_modules/archiver/node_modules/async/internal/parallel.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/internal/promiseCallback.js +23 -0
- package/dist/node_modules/archiver/node_modules/async/internal/queue.js +294 -0
- package/dist/node_modules/archiver/node_modules/async/internal/range.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/internal/reject.js +26 -0
- package/dist/node_modules/archiver/node_modules/async/internal/setImmediate.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/internal/withoutIndex.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/wrapAsync.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/log.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/map.js +142 -0
- package/dist/node_modules/archiver/node_modules/async/mapLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/mapSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/mapValues.js +152 -0
- package/dist/node_modules/archiver/node_modules/async/mapValuesLimit.js +61 -0
- package/dist/node_modules/archiver/node_modules/async/mapValuesSeries.js +37 -0
- package/dist/node_modules/archiver/node_modules/async/memoize.js +91 -0
- package/dist/node_modules/archiver/node_modules/async/nextTick.js +52 -0
- package/dist/node_modules/archiver/node_modules/async/package.json +75 -0
- package/dist/node_modules/archiver/node_modules/async/parallel.js +180 -0
- package/dist/node_modules/archiver/node_modules/async/parallelLimit.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/priorityQueue.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/queue.js +24 -0
- package/dist/node_modules/archiver/node_modules/async/race.js +67 -0
- package/dist/node_modules/archiver/node_modules/async/reduce.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/reduceRight.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/reflect.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/reflectAll.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/reject.js +87 -0
- package/dist/node_modules/archiver/node_modules/async/rejectLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/rejectSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/retry.js +159 -0
- package/dist/node_modules/archiver/node_modules/async/retryable.js +77 -0
- package/dist/node_modules/archiver/node_modules/async/select.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/selectLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/selectSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/seq.js +79 -0
- package/dist/node_modules/archiver/node_modules/async/series.js +186 -0
- package/dist/node_modules/archiver/node_modules/async/setImmediate.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/some.js +122 -0
- package/dist/node_modules/archiver/node_modules/async/someLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/someSeries.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/sortBy.js +190 -0
- package/dist/node_modules/archiver/node_modules/async/timeout.js +89 -0
- package/dist/node_modules/archiver/node_modules/async/times.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/timesLimit.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/timesSeries.js +32 -0
- package/dist/node_modules/archiver/node_modules/async/transform.js +173 -0
- package/dist/node_modules/archiver/node_modules/async/tryEach.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/unmemoize.js +25 -0
- package/dist/node_modules/archiver/node_modules/async/until.js +61 -0
- package/dist/node_modules/archiver/node_modules/async/waterfall.js +105 -0
- package/dist/node_modules/archiver/node_modules/async/whilst.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/wrapSync.js +118 -0
- package/dist/node_modules/archiver/package.json +1 -1
- package/dist/node_modules/decompress/package.json +1 -1
- package/dist/node_modules/mkdirp/package.json +1 -1
- package/dist/node_modules/moment/package.json +1 -1
- package/dist/node_modules/semver/bin/semver.js +7 -15
- package/dist/node_modules/semver/classes/range.js +28 -13
- package/dist/node_modules/semver/classes/semver.js +23 -7
- package/dist/node_modules/semver/functions/diff.js +5 -12
- package/dist/node_modules/semver/index.js +1 -1
- package/dist/node_modules/semver/internal/lrucache.js +40 -0
- package/dist/node_modules/semver/internal/re.js +2 -0
- package/dist/node_modules/semver/package.json +1 -1
- package/package.json +3 -3
- package/dist/client/04e68bac2ed0170d.js +0 -10
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _createTester = require('./internal/createTester.js');
|
|
8
|
+
|
|
9
|
+
var _createTester2 = _interopRequireDefault(_createTester);
|
|
10
|
+
|
|
11
|
+
var _eachOf = require('./eachOf.js');
|
|
12
|
+
|
|
13
|
+
var _eachOf2 = _interopRequireDefault(_eachOf);
|
|
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
|
+
* Returns `true` if every element in `coll` satisfies an async test. If any
|
|
23
|
+
* iteratee call returns `false`, the main `callback` is immediately called.
|
|
24
|
+
*
|
|
25
|
+
* @name every
|
|
26
|
+
* @static
|
|
27
|
+
* @memberOf module:Collections
|
|
28
|
+
* @method
|
|
29
|
+
* @alias all
|
|
30
|
+
* @category Collection
|
|
31
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
32
|
+
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
|
33
|
+
* in the collection in parallel.
|
|
34
|
+
* The iteratee must complete with a boolean result value.
|
|
35
|
+
* Invoked with (item, callback).
|
|
36
|
+
* @param {Function} [callback] - A callback which is called after all the
|
|
37
|
+
* `iteratee` functions have finished. Result will be either `true` or `false`
|
|
38
|
+
* depending on the values of the async tests. Invoked with (err, result).
|
|
39
|
+
* @returns {Promise} a promise, if no callback provided
|
|
40
|
+
* @example
|
|
41
|
+
*
|
|
42
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
43
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
44
|
+
* // dir3 is a directory that contains file5.txt
|
|
45
|
+
* // dir4 does not exist
|
|
46
|
+
*
|
|
47
|
+
* const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file5.txt'];
|
|
48
|
+
* const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];
|
|
49
|
+
*
|
|
50
|
+
* // asynchronous function that checks if a file exists
|
|
51
|
+
* function fileExists(file, callback) {
|
|
52
|
+
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
53
|
+
* callback(null, !err);
|
|
54
|
+
* });
|
|
55
|
+
* }
|
|
56
|
+
*
|
|
57
|
+
* // Using callbacks
|
|
58
|
+
* async.every(fileList, fileExists, function(err, result) {
|
|
59
|
+
* console.log(result);
|
|
60
|
+
* // true
|
|
61
|
+
* // result is true since every file exists
|
|
62
|
+
* });
|
|
63
|
+
*
|
|
64
|
+
* async.every(withMissingFileList, fileExists, function(err, result) {
|
|
65
|
+
* console.log(result);
|
|
66
|
+
* // false
|
|
67
|
+
* // result is false since NOT every file exists
|
|
68
|
+
* });
|
|
69
|
+
*
|
|
70
|
+
* // Using Promises
|
|
71
|
+
* async.every(fileList, fileExists)
|
|
72
|
+
* .then( result => {
|
|
73
|
+
* console.log(result);
|
|
74
|
+
* // true
|
|
75
|
+
* // result is true since every file exists
|
|
76
|
+
* }).catch( err => {
|
|
77
|
+
* console.log(err);
|
|
78
|
+
* });
|
|
79
|
+
*
|
|
80
|
+
* async.every(withMissingFileList, fileExists)
|
|
81
|
+
* .then( result => {
|
|
82
|
+
* console.log(result);
|
|
83
|
+
* // false
|
|
84
|
+
* // result is false since NOT every file exists
|
|
85
|
+
* }).catch( err => {
|
|
86
|
+
* console.log(err);
|
|
87
|
+
* });
|
|
88
|
+
*
|
|
89
|
+
* // Using async/await
|
|
90
|
+
* async () => {
|
|
91
|
+
* try {
|
|
92
|
+
* let result = await async.every(fileList, fileExists);
|
|
93
|
+
* console.log(result);
|
|
94
|
+
* // true
|
|
95
|
+
* // result is true since every file exists
|
|
96
|
+
* }
|
|
97
|
+
* catch (err) {
|
|
98
|
+
* console.log(err);
|
|
99
|
+
* }
|
|
100
|
+
* }
|
|
101
|
+
*
|
|
102
|
+
* async () => {
|
|
103
|
+
* try {
|
|
104
|
+
* let result = await async.every(withMissingFileList, fileExists);
|
|
105
|
+
* console.log(result);
|
|
106
|
+
* // false
|
|
107
|
+
* // result is false since NOT every file exists
|
|
108
|
+
* }
|
|
109
|
+
* catch (err) {
|
|
110
|
+
* console.log(err);
|
|
111
|
+
* }
|
|
112
|
+
* }
|
|
113
|
+
*
|
|
114
|
+
*/
|
|
115
|
+
function every(coll, iteratee, callback) {
|
|
116
|
+
return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOf2.default, coll, iteratee, callback);
|
|
117
|
+
}
|
|
118
|
+
exports.default = (0, _awaitify2.default)(every, 3);
|
|
119
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _createTester = require('./internal/createTester.js');
|
|
8
|
+
|
|
9
|
+
var _createTester2 = _interopRequireDefault(_createTester);
|
|
10
|
+
|
|
11
|
+
var _eachOfLimit = require('./internal/eachOfLimit.js');
|
|
12
|
+
|
|
13
|
+
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
|
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 [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time.
|
|
23
|
+
*
|
|
24
|
+
* @name everyLimit
|
|
25
|
+
* @static
|
|
26
|
+
* @memberOf module:Collections
|
|
27
|
+
* @method
|
|
28
|
+
* @see [async.every]{@link module:Collections.every}
|
|
29
|
+
* @alias allLimit
|
|
30
|
+
* @category Collection
|
|
31
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
32
|
+
* @param {number} limit - The maximum number of async operations at a time.
|
|
33
|
+
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
|
34
|
+
* in the collection in parallel.
|
|
35
|
+
* The iteratee must complete with a boolean result value.
|
|
36
|
+
* Invoked with (item, callback).
|
|
37
|
+
* @param {Function} [callback] - A callback which is called after all the
|
|
38
|
+
* `iteratee` functions have finished. Result will be either `true` or `false`
|
|
39
|
+
* depending on the values of the async tests. Invoked with (err, result).
|
|
40
|
+
* @returns {Promise} a promise, if no callback provided
|
|
41
|
+
*/
|
|
42
|
+
function everyLimit(coll, limit, iteratee, callback) {
|
|
43
|
+
return (0, _createTester2.default)(bool => !bool, res => !res)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
|
|
44
|
+
}
|
|
45
|
+
exports.default = (0, _awaitify2.default)(everyLimit, 4);
|
|
46
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _createTester = require('./internal/createTester.js');
|
|
8
|
+
|
|
9
|
+
var _createTester2 = _interopRequireDefault(_createTester);
|
|
10
|
+
|
|
11
|
+
var _eachOfSeries = require('./eachOfSeries.js');
|
|
12
|
+
|
|
13
|
+
var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
|
|
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 [`every`]{@link module:Collections.every} but runs only a single async operation at a time.
|
|
23
|
+
*
|
|
24
|
+
* @name everySeries
|
|
25
|
+
* @static
|
|
26
|
+
* @memberOf module:Collections
|
|
27
|
+
* @method
|
|
28
|
+
* @see [async.every]{@link module:Collections.every}
|
|
29
|
+
* @alias allSeries
|
|
30
|
+
* @category Collection
|
|
31
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
32
|
+
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
|
33
|
+
* in the collection in series.
|
|
34
|
+
* The iteratee must complete with a boolean result value.
|
|
35
|
+
* Invoked with (item, callback).
|
|
36
|
+
* @param {Function} [callback] - A callback which is called after all the
|
|
37
|
+
* `iteratee` functions have finished. Result will be either `true` or `false`
|
|
38
|
+
* depending on the values of the async tests. Invoked with (err, result).
|
|
39
|
+
* @returns {Promise} a promise, if no callback provided
|
|
40
|
+
*/
|
|
41
|
+
function everySeries(coll, iteratee, callback) {
|
|
42
|
+
return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOfSeries2.default, coll, iteratee, callback);
|
|
43
|
+
}
|
|
44
|
+
exports.default = (0, _awaitify2.default)(everySeries, 3);
|
|
45
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _createTester = require('./internal/createTester.js');
|
|
8
|
+
|
|
9
|
+
var _createTester2 = _interopRequireDefault(_createTester);
|
|
10
|
+
|
|
11
|
+
var _eachOf = require('./eachOf.js');
|
|
12
|
+
|
|
13
|
+
var _eachOf2 = _interopRequireDefault(_eachOf);
|
|
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
|
+
* Returns `true` if at least one element in the `coll` satisfies an async test.
|
|
23
|
+
* If any iteratee call returns `true`, the main `callback` is immediately
|
|
24
|
+
* called.
|
|
25
|
+
*
|
|
26
|
+
* @name some
|
|
27
|
+
* @static
|
|
28
|
+
* @memberOf module:Collections
|
|
29
|
+
* @method
|
|
30
|
+
* @alias any
|
|
31
|
+
* @category Collection
|
|
32
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
33
|
+
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
|
34
|
+
* in the collections in parallel.
|
|
35
|
+
* The iteratee should complete with a boolean `result` value.
|
|
36
|
+
* Invoked with (item, callback).
|
|
37
|
+
* @param {Function} [callback] - A callback which is called as soon as any
|
|
38
|
+
* iteratee returns `true`, or after all the iteratee functions have finished.
|
|
39
|
+
* Result will be either `true` or `false` depending on the values of the async
|
|
40
|
+
* tests. Invoked with (err, result).
|
|
41
|
+
* @returns {Promise} a promise, if no callback provided
|
|
42
|
+
* @example
|
|
43
|
+
*
|
|
44
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
45
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
46
|
+
* // dir3 is a directory that contains file5.txt
|
|
47
|
+
* // dir4 does not exist
|
|
48
|
+
*
|
|
49
|
+
* // asynchronous function that checks if a file exists
|
|
50
|
+
* function fileExists(file, callback) {
|
|
51
|
+
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
52
|
+
* callback(null, !err);
|
|
53
|
+
* });
|
|
54
|
+
* }
|
|
55
|
+
*
|
|
56
|
+
* // Using callbacks
|
|
57
|
+
* async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists,
|
|
58
|
+
* function(err, result) {
|
|
59
|
+
* console.log(result);
|
|
60
|
+
* // true
|
|
61
|
+
* // result is true since some file in the list exists
|
|
62
|
+
* }
|
|
63
|
+
*);
|
|
64
|
+
*
|
|
65
|
+
* async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists,
|
|
66
|
+
* function(err, result) {
|
|
67
|
+
* console.log(result);
|
|
68
|
+
* // false
|
|
69
|
+
* // result is false since none of the files exists
|
|
70
|
+
* }
|
|
71
|
+
*);
|
|
72
|
+
*
|
|
73
|
+
* // Using Promises
|
|
74
|
+
* async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists)
|
|
75
|
+
* .then( result => {
|
|
76
|
+
* console.log(result);
|
|
77
|
+
* // true
|
|
78
|
+
* // result is true since some file in the list exists
|
|
79
|
+
* }).catch( err => {
|
|
80
|
+
* console.log(err);
|
|
81
|
+
* });
|
|
82
|
+
*
|
|
83
|
+
* async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists)
|
|
84
|
+
* .then( result => {
|
|
85
|
+
* console.log(result);
|
|
86
|
+
* // false
|
|
87
|
+
* // result is false since none of the files exists
|
|
88
|
+
* }).catch( err => {
|
|
89
|
+
* console.log(err);
|
|
90
|
+
* });
|
|
91
|
+
*
|
|
92
|
+
* // Using async/await
|
|
93
|
+
* async () => {
|
|
94
|
+
* try {
|
|
95
|
+
* let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists);
|
|
96
|
+
* console.log(result);
|
|
97
|
+
* // true
|
|
98
|
+
* // result is true since some file in the list exists
|
|
99
|
+
* }
|
|
100
|
+
* catch (err) {
|
|
101
|
+
* console.log(err);
|
|
102
|
+
* }
|
|
103
|
+
* }
|
|
104
|
+
*
|
|
105
|
+
* async () => {
|
|
106
|
+
* try {
|
|
107
|
+
* let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists);
|
|
108
|
+
* console.log(result);
|
|
109
|
+
* // false
|
|
110
|
+
* // result is false since none of the files exists
|
|
111
|
+
* }
|
|
112
|
+
* catch (err) {
|
|
113
|
+
* console.log(err);
|
|
114
|
+
* }
|
|
115
|
+
* }
|
|
116
|
+
*
|
|
117
|
+
*/
|
|
118
|
+
function some(coll, iteratee, callback) {
|
|
119
|
+
return (0, _createTester2.default)(Boolean, res => res)(_eachOf2.default, coll, iteratee, callback);
|
|
120
|
+
}
|
|
121
|
+
exports.default = (0, _awaitify2.default)(some, 3);
|
|
122
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _createTester = require('./internal/createTester.js');
|
|
8
|
+
|
|
9
|
+
var _createTester2 = _interopRequireDefault(_createTester);
|
|
10
|
+
|
|
11
|
+
var _eachOfLimit = require('./internal/eachOfLimit.js');
|
|
12
|
+
|
|
13
|
+
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
|
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 [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time.
|
|
23
|
+
*
|
|
24
|
+
* @name someLimit
|
|
25
|
+
* @static
|
|
26
|
+
* @memberOf module:Collections
|
|
27
|
+
* @method
|
|
28
|
+
* @see [async.some]{@link module:Collections.some}
|
|
29
|
+
* @alias anyLimit
|
|
30
|
+
* @category Collection
|
|
31
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
32
|
+
* @param {number} limit - The maximum number of async operations at a time.
|
|
33
|
+
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
|
34
|
+
* in the collections in parallel.
|
|
35
|
+
* The iteratee should complete with a boolean `result` value.
|
|
36
|
+
* Invoked with (item, callback).
|
|
37
|
+
* @param {Function} [callback] - A callback which is called as soon as any
|
|
38
|
+
* iteratee returns `true`, or after all the iteratee functions have finished.
|
|
39
|
+
* Result will be either `true` or `false` depending on the values of the async
|
|
40
|
+
* tests. Invoked with (err, result).
|
|
41
|
+
* @returns {Promise} a promise, if no callback provided
|
|
42
|
+
*/
|
|
43
|
+
function someLimit(coll, limit, iteratee, callback) {
|
|
44
|
+
return (0, _createTester2.default)(Boolean, res => res)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
|
|
45
|
+
}
|
|
46
|
+
exports.default = (0, _awaitify2.default)(someLimit, 4);
|
|
47
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _createTester = require('./internal/createTester.js');
|
|
8
|
+
|
|
9
|
+
var _createTester2 = _interopRequireDefault(_createTester);
|
|
10
|
+
|
|
11
|
+
var _eachOfSeries = require('./eachOfSeries.js');
|
|
12
|
+
|
|
13
|
+
var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
|
|
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 [`some`]{@link module:Collections.some} but runs only a single async operation at a time.
|
|
23
|
+
*
|
|
24
|
+
* @name someSeries
|
|
25
|
+
* @static
|
|
26
|
+
* @memberOf module:Collections
|
|
27
|
+
* @method
|
|
28
|
+
* @see [async.some]{@link module:Collections.some}
|
|
29
|
+
* @alias anySeries
|
|
30
|
+
* @category Collection
|
|
31
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
32
|
+
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
|
33
|
+
* in the collections in series.
|
|
34
|
+
* The iteratee should complete with a boolean `result` value.
|
|
35
|
+
* Invoked with (item, callback).
|
|
36
|
+
* @param {Function} [callback] - A callback which is called as soon as any
|
|
37
|
+
* iteratee returns `true`, or after all the iteratee functions have finished.
|
|
38
|
+
* Result will be either `true` or `false` depending on the values of the async
|
|
39
|
+
* tests. Invoked with (err, result).
|
|
40
|
+
* @returns {Promise} a promise, if no callback provided
|
|
41
|
+
*/
|
|
42
|
+
function someSeries(coll, iteratee, callback) {
|
|
43
|
+
return (0, _createTester2.default)(Boolean, res => res)(_eachOfSeries2.default, coll, iteratee, callback);
|
|
44
|
+
}
|
|
45
|
+
exports.default = (0, _awaitify2.default)(someSeries, 3);
|
|
46
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _applyEach = require('./internal/applyEach.js');
|
|
8
|
+
|
|
9
|
+
var _applyEach2 = _interopRequireDefault(_applyEach);
|
|
10
|
+
|
|
11
|
+
var _map = require('./map.js');
|
|
12
|
+
|
|
13
|
+
var _map2 = _interopRequireDefault(_map);
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Applies the provided arguments to each function in the array, calling
|
|
19
|
+
* `callback` after all functions have completed. If you only provide the first
|
|
20
|
+
* argument, `fns`, then it will return a function which lets you pass in the
|
|
21
|
+
* arguments as if it were a single function call. If more arguments are
|
|
22
|
+
* provided, `callback` is required while `args` is still optional. The results
|
|
23
|
+
* for each of the applied async functions are passed to the final callback
|
|
24
|
+
* as an array.
|
|
25
|
+
*
|
|
26
|
+
* @name applyEach
|
|
27
|
+
* @static
|
|
28
|
+
* @memberOf module:ControlFlow
|
|
29
|
+
* @method
|
|
30
|
+
* @category Control Flow
|
|
31
|
+
* @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s
|
|
32
|
+
* to all call with the same arguments
|
|
33
|
+
* @param {...*} [args] - any number of separate arguments to pass to the
|
|
34
|
+
* function.
|
|
35
|
+
* @param {Function} [callback] - the final argument should be the callback,
|
|
36
|
+
* called when all functions have completed processing.
|
|
37
|
+
* @returns {AsyncFunction} - Returns a function that takes no args other than
|
|
38
|
+
* an optional callback, that is the result of applying the `args` to each
|
|
39
|
+
* of the functions.
|
|
40
|
+
* @example
|
|
41
|
+
*
|
|
42
|
+
* const appliedFn = async.applyEach([enableSearch, updateSchema], 'bucket')
|
|
43
|
+
*
|
|
44
|
+
* appliedFn((err, results) => {
|
|
45
|
+
* // results[0] is the results for `enableSearch`
|
|
46
|
+
* // results[1] is the results for `updateSchema`
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* // partial application example:
|
|
50
|
+
* async.each(
|
|
51
|
+
* buckets,
|
|
52
|
+
* async (bucket) => async.applyEach([enableSearch, updateSchema], bucket)(),
|
|
53
|
+
* callback
|
|
54
|
+
* );
|
|
55
|
+
*/
|
|
56
|
+
exports.default = (0, _applyEach2.default)(_map2.default);
|
|
57
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _applyEach = require('./internal/applyEach.js');
|
|
8
|
+
|
|
9
|
+
var _applyEach2 = _interopRequireDefault(_applyEach);
|
|
10
|
+
|
|
11
|
+
var _mapSeries = require('./mapSeries.js');
|
|
12
|
+
|
|
13
|
+
var _mapSeries2 = _interopRequireDefault(_mapSeries);
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time.
|
|
19
|
+
*
|
|
20
|
+
* @name applyEachSeries
|
|
21
|
+
* @static
|
|
22
|
+
* @memberOf module:ControlFlow
|
|
23
|
+
* @method
|
|
24
|
+
* @see [async.applyEach]{@link module:ControlFlow.applyEach}
|
|
25
|
+
* @category Control Flow
|
|
26
|
+
* @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s to all
|
|
27
|
+
* call with the same arguments
|
|
28
|
+
* @param {...*} [args] - any number of separate arguments to pass to the
|
|
29
|
+
* function.
|
|
30
|
+
* @param {Function} [callback] - the final argument should be the callback,
|
|
31
|
+
* called when all functions have completed processing.
|
|
32
|
+
* @returns {AsyncFunction} - A function, that when called, is the result of
|
|
33
|
+
* appling the `args` to the list of functions. It takes no args, other than
|
|
34
|
+
* a callback.
|
|
35
|
+
*/
|
|
36
|
+
exports.default = (0, _applyEach2.default)(_mapSeries2.default);
|
|
37
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = asyncify;
|
|
7
|
+
|
|
8
|
+
var _initialParams = require('./internal/initialParams.js');
|
|
9
|
+
|
|
10
|
+
var _initialParams2 = _interopRequireDefault(_initialParams);
|
|
11
|
+
|
|
12
|
+
var _setImmediate = require('./internal/setImmediate.js');
|
|
13
|
+
|
|
14
|
+
var _setImmediate2 = _interopRequireDefault(_setImmediate);
|
|
15
|
+
|
|
16
|
+
var _wrapAsync = require('./internal/wrapAsync.js');
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Take a sync function and make it async, passing its return value to a
|
|
22
|
+
* callback. This is useful for plugging sync functions into a waterfall,
|
|
23
|
+
* series, or other async functions. Any arguments passed to the generated
|
|
24
|
+
* function will be passed to the wrapped function (except for the final
|
|
25
|
+
* callback argument). Errors thrown will be passed to the callback.
|
|
26
|
+
*
|
|
27
|
+
* If the function passed to `asyncify` returns a Promise, that promises's
|
|
28
|
+
* resolved/rejected state will be used to call the callback, rather than simply
|
|
29
|
+
* the synchronous return value.
|
|
30
|
+
*
|
|
31
|
+
* This also means you can asyncify ES2017 `async` functions.
|
|
32
|
+
*
|
|
33
|
+
* @name asyncify
|
|
34
|
+
* @static
|
|
35
|
+
* @memberOf module:Utils
|
|
36
|
+
* @method
|
|
37
|
+
* @alias wrapSync
|
|
38
|
+
* @category Util
|
|
39
|
+
* @param {Function} func - The synchronous function, or Promise-returning
|
|
40
|
+
* function to convert to an {@link AsyncFunction}.
|
|
41
|
+
* @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be
|
|
42
|
+
* invoked with `(args..., callback)`.
|
|
43
|
+
* @example
|
|
44
|
+
*
|
|
45
|
+
* // passing a regular synchronous function
|
|
46
|
+
* async.waterfall([
|
|
47
|
+
* async.apply(fs.readFile, filename, "utf8"),
|
|
48
|
+
* async.asyncify(JSON.parse),
|
|
49
|
+
* function (data, next) {
|
|
50
|
+
* // data is the result of parsing the text.
|
|
51
|
+
* // If there was a parsing error, it would have been caught.
|
|
52
|
+
* }
|
|
53
|
+
* ], callback);
|
|
54
|
+
*
|
|
55
|
+
* // passing a function returning a promise
|
|
56
|
+
* async.waterfall([
|
|
57
|
+
* async.apply(fs.readFile, filename, "utf8"),
|
|
58
|
+
* async.asyncify(function (contents) {
|
|
59
|
+
* return db.model.create(contents);
|
|
60
|
+
* }),
|
|
61
|
+
* function (model, next) {
|
|
62
|
+
* // `model` is the instantiated model object.
|
|
63
|
+
* // If there was an error, this function would be skipped.
|
|
64
|
+
* }
|
|
65
|
+
* ], callback);
|
|
66
|
+
*
|
|
67
|
+
* // es2017 example, though `asyncify` is not needed if your JS environment
|
|
68
|
+
* // supports async functions out of the box
|
|
69
|
+
* var q = async.queue(async.asyncify(async function(file) {
|
|
70
|
+
* var intermediateStep = await processFile(file);
|
|
71
|
+
* return await somePromise(intermediateStep)
|
|
72
|
+
* }));
|
|
73
|
+
*
|
|
74
|
+
* q.push(files);
|
|
75
|
+
*/
|
|
76
|
+
function asyncify(func) {
|
|
77
|
+
if ((0, _wrapAsync.isAsync)(func)) {
|
|
78
|
+
return function (...args /*, callback*/) {
|
|
79
|
+
const callback = args.pop();
|
|
80
|
+
const promise = func.apply(this, args);
|
|
81
|
+
return handlePromise(promise, callback);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (0, _initialParams2.default)(function (args, callback) {
|
|
86
|
+
var result;
|
|
87
|
+
try {
|
|
88
|
+
result = func.apply(this, args);
|
|
89
|
+
} catch (e) {
|
|
90
|
+
return callback(e);
|
|
91
|
+
}
|
|
92
|
+
// if result is Promise object
|
|
93
|
+
if (result && typeof result.then === 'function') {
|
|
94
|
+
return handlePromise(result, callback);
|
|
95
|
+
} else {
|
|
96
|
+
callback(null, result);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function handlePromise(promise, callback) {
|
|
102
|
+
return promise.then(value => {
|
|
103
|
+
invokeCallback(callback, null, value);
|
|
104
|
+
}, err => {
|
|
105
|
+
invokeCallback(callback, err && (err instanceof Error || err.message) ? err : new Error(err));
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function invokeCallback(callback, error, value) {
|
|
110
|
+
try {
|
|
111
|
+
callback(error, value);
|
|
112
|
+
} catch (err) {
|
|
113
|
+
(0, _setImmediate2.default)(e => {
|
|
114
|
+
throw e;
|
|
115
|
+
}, err);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
module.exports = exports.default;
|