@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,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _filter2 = require('./internal/filter.js');
|
|
8
|
+
|
|
9
|
+
var _filter3 = _interopRequireDefault(_filter2);
|
|
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 [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a
|
|
23
|
+
* time.
|
|
24
|
+
*
|
|
25
|
+
* @name filterLimit
|
|
26
|
+
* @static
|
|
27
|
+
* @memberOf module:Collections
|
|
28
|
+
* @method
|
|
29
|
+
* @see [async.filter]{@link module:Collections.filter}
|
|
30
|
+
* @alias selectLimit
|
|
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 {Function} iteratee - A truth test to apply to each item in `coll`.
|
|
35
|
+
* The `iteratee` is passed a `callback(err, truthValue)`, which must be called
|
|
36
|
+
* with a boolean argument once it has completed. Invoked with (item, callback).
|
|
37
|
+
* @param {Function} [callback] - A callback which is called after all the
|
|
38
|
+
* `iteratee` functions have finished. Invoked with (err, results).
|
|
39
|
+
* @returns {Promise} a promise, if no callback provided
|
|
40
|
+
*/
|
|
41
|
+
function filterLimit(coll, limit, iteratee, callback) {
|
|
42
|
+
return (0, _filter3.default)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
|
|
43
|
+
}
|
|
44
|
+
exports.default = (0, _awaitify2.default)(filterLimit, 4);
|
|
45
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _filter2 = require('./internal/filter.js');
|
|
8
|
+
|
|
9
|
+
var _filter3 = _interopRequireDefault(_filter2);
|
|
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 [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time.
|
|
23
|
+
*
|
|
24
|
+
* @name filterSeries
|
|
25
|
+
* @static
|
|
26
|
+
* @memberOf module:Collections
|
|
27
|
+
* @method
|
|
28
|
+
* @see [async.filter]{@link module:Collections.filter}
|
|
29
|
+
* @alias selectSeries
|
|
30
|
+
* @category Collection
|
|
31
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
32
|
+
* @param {Function} iteratee - A truth test to apply to each item in `coll`.
|
|
33
|
+
* The `iteratee` is passed a `callback(err, truthValue)`, which must be called
|
|
34
|
+
* with a boolean argument once it has completed. Invoked with (item, callback).
|
|
35
|
+
* @param {Function} [callback] - A callback which is called after all the
|
|
36
|
+
* `iteratee` functions have finished. Invoked with (err, results)
|
|
37
|
+
* @returns {Promise} a promise, if no callback provided
|
|
38
|
+
*/
|
|
39
|
+
function filterSeries(coll, iteratee, callback) {
|
|
40
|
+
return (0, _filter3.default)(_eachOfSeries2.default, coll, iteratee, callback);
|
|
41
|
+
}
|
|
42
|
+
exports.default = (0, _awaitify2.default)(filterSeries, 3);
|
|
43
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = seq;
|
|
7
|
+
|
|
8
|
+
var _reduce = require('./reduce.js');
|
|
9
|
+
|
|
10
|
+
var _reduce2 = _interopRequireDefault(_reduce);
|
|
11
|
+
|
|
12
|
+
var _wrapAsync = require('./internal/wrapAsync.js');
|
|
13
|
+
|
|
14
|
+
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
|
15
|
+
|
|
16
|
+
var _promiseCallback = require('./internal/promiseCallback.js');
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Version of the compose function that is more natural to read. Each function
|
|
22
|
+
* consumes the return value of the previous function. It is the equivalent of
|
|
23
|
+
* [compose]{@link module:ControlFlow.compose} with the arguments reversed.
|
|
24
|
+
*
|
|
25
|
+
* Each function is executed with the `this` binding of the composed function.
|
|
26
|
+
*
|
|
27
|
+
* @name seq
|
|
28
|
+
* @static
|
|
29
|
+
* @memberOf module:ControlFlow
|
|
30
|
+
* @method
|
|
31
|
+
* @see [async.compose]{@link module:ControlFlow.compose}
|
|
32
|
+
* @category Control Flow
|
|
33
|
+
* @param {...AsyncFunction} functions - the asynchronous functions to compose
|
|
34
|
+
* @returns {Function} a function that composes the `functions` in order
|
|
35
|
+
* @example
|
|
36
|
+
*
|
|
37
|
+
* // Requires lodash (or underscore), express3 and dresende's orm2.
|
|
38
|
+
* // Part of an app, that fetches cats of the logged user.
|
|
39
|
+
* // This example uses `seq` function to avoid overnesting and error
|
|
40
|
+
* // handling clutter.
|
|
41
|
+
* app.get('/cats', function(request, response) {
|
|
42
|
+
* var User = request.models.User;
|
|
43
|
+
* async.seq(
|
|
44
|
+
* User.get.bind(User), // 'User.get' has signature (id, callback(err, data))
|
|
45
|
+
* function(user, fn) {
|
|
46
|
+
* user.getCats(fn); // 'getCats' has signature (callback(err, data))
|
|
47
|
+
* }
|
|
48
|
+
* )(req.session.user_id, function (err, cats) {
|
|
49
|
+
* if (err) {
|
|
50
|
+
* console.error(err);
|
|
51
|
+
* response.json({ status: 'error', message: err.message });
|
|
52
|
+
* } else {
|
|
53
|
+
* response.json({ status: 'ok', message: 'Cats found', data: cats });
|
|
54
|
+
* }
|
|
55
|
+
* });
|
|
56
|
+
* });
|
|
57
|
+
*/
|
|
58
|
+
function seq(...functions) {
|
|
59
|
+
var _functions = functions.map(_wrapAsync2.default);
|
|
60
|
+
return function (...args) {
|
|
61
|
+
var that = this;
|
|
62
|
+
|
|
63
|
+
var cb = args[args.length - 1];
|
|
64
|
+
if (typeof cb == 'function') {
|
|
65
|
+
args.pop();
|
|
66
|
+
} else {
|
|
67
|
+
cb = (0, _promiseCallback.promiseCallback)();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
(0, _reduce2.default)(_functions, args, (newargs, fn, iterCb) => {
|
|
71
|
+
fn.apply(that, newargs.concat((err, ...nextargs) => {
|
|
72
|
+
iterCb(err, nextargs);
|
|
73
|
+
}));
|
|
74
|
+
}, (err, results) => cb(err, ...results));
|
|
75
|
+
|
|
76
|
+
return cb[_promiseCallback.PROMISE_SYMBOL];
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = series;
|
|
7
|
+
|
|
8
|
+
var _parallel2 = require('./internal/parallel.js');
|
|
9
|
+
|
|
10
|
+
var _parallel3 = _interopRequireDefault(_parallel2);
|
|
11
|
+
|
|
12
|
+
var _eachOfSeries = require('./eachOfSeries.js');
|
|
13
|
+
|
|
14
|
+
var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Run the functions in the `tasks` collection in series, each one running once
|
|
20
|
+
* the previous function has completed. If any functions in the series pass an
|
|
21
|
+
* error to its callback, no more functions are run, and `callback` is
|
|
22
|
+
* immediately called with the value of the error. Otherwise, `callback`
|
|
23
|
+
* receives an array of results when `tasks` have completed.
|
|
24
|
+
*
|
|
25
|
+
* It is also possible to use an object instead of an array. Each property will
|
|
26
|
+
* be run as a function, and the results will be passed to the final `callback`
|
|
27
|
+
* as an object instead of an array. This can be a more readable way of handling
|
|
28
|
+
* results from {@link async.series}.
|
|
29
|
+
*
|
|
30
|
+
* **Note** that while many implementations preserve the order of object
|
|
31
|
+
* properties, the [ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6)
|
|
32
|
+
* explicitly states that
|
|
33
|
+
*
|
|
34
|
+
* > The mechanics and order of enumerating the properties is not specified.
|
|
35
|
+
*
|
|
36
|
+
* So if you rely on the order in which your series of functions are executed,
|
|
37
|
+
* and want this to work on all platforms, consider using an array.
|
|
38
|
+
*
|
|
39
|
+
* @name series
|
|
40
|
+
* @static
|
|
41
|
+
* @memberOf module:ControlFlow
|
|
42
|
+
* @method
|
|
43
|
+
* @category Control Flow
|
|
44
|
+
* @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing
|
|
45
|
+
* [async functions]{@link AsyncFunction} to run in series.
|
|
46
|
+
* Each function can complete with any number of optional `result` values.
|
|
47
|
+
* @param {Function} [callback] - An optional callback to run once all the
|
|
48
|
+
* functions have completed. This function gets a results array (or object)
|
|
49
|
+
* containing all the result arguments passed to the `task` callbacks. Invoked
|
|
50
|
+
* with (err, result).
|
|
51
|
+
* @return {Promise} a promise, if no callback is passed
|
|
52
|
+
* @example
|
|
53
|
+
*
|
|
54
|
+
* //Using Callbacks
|
|
55
|
+
* async.series([
|
|
56
|
+
* function(callback) {
|
|
57
|
+
* setTimeout(function() {
|
|
58
|
+
* // do some async task
|
|
59
|
+
* callback(null, 'one');
|
|
60
|
+
* }, 200);
|
|
61
|
+
* },
|
|
62
|
+
* function(callback) {
|
|
63
|
+
* setTimeout(function() {
|
|
64
|
+
* // then do another async task
|
|
65
|
+
* callback(null, 'two');
|
|
66
|
+
* }, 100);
|
|
67
|
+
* }
|
|
68
|
+
* ], function(err, results) {
|
|
69
|
+
* console.log(results);
|
|
70
|
+
* // results is equal to ['one','two']
|
|
71
|
+
* });
|
|
72
|
+
*
|
|
73
|
+
* // an example using objects instead of arrays
|
|
74
|
+
* async.series({
|
|
75
|
+
* one: function(callback) {
|
|
76
|
+
* setTimeout(function() {
|
|
77
|
+
* // do some async task
|
|
78
|
+
* callback(null, 1);
|
|
79
|
+
* }, 200);
|
|
80
|
+
* },
|
|
81
|
+
* two: function(callback) {
|
|
82
|
+
* setTimeout(function() {
|
|
83
|
+
* // then do another async task
|
|
84
|
+
* callback(null, 2);
|
|
85
|
+
* }, 100);
|
|
86
|
+
* }
|
|
87
|
+
* }, function(err, results) {
|
|
88
|
+
* console.log(results);
|
|
89
|
+
* // results is equal to: { one: 1, two: 2 }
|
|
90
|
+
* });
|
|
91
|
+
*
|
|
92
|
+
* //Using Promises
|
|
93
|
+
* async.series([
|
|
94
|
+
* function(callback) {
|
|
95
|
+
* setTimeout(function() {
|
|
96
|
+
* callback(null, 'one');
|
|
97
|
+
* }, 200);
|
|
98
|
+
* },
|
|
99
|
+
* function(callback) {
|
|
100
|
+
* setTimeout(function() {
|
|
101
|
+
* callback(null, 'two');
|
|
102
|
+
* }, 100);
|
|
103
|
+
* }
|
|
104
|
+
* ]).then(results => {
|
|
105
|
+
* console.log(results);
|
|
106
|
+
* // results is equal to ['one','two']
|
|
107
|
+
* }).catch(err => {
|
|
108
|
+
* console.log(err);
|
|
109
|
+
* });
|
|
110
|
+
*
|
|
111
|
+
* // an example using an object instead of an array
|
|
112
|
+
* async.series({
|
|
113
|
+
* one: function(callback) {
|
|
114
|
+
* setTimeout(function() {
|
|
115
|
+
* // do some async task
|
|
116
|
+
* callback(null, 1);
|
|
117
|
+
* }, 200);
|
|
118
|
+
* },
|
|
119
|
+
* two: function(callback) {
|
|
120
|
+
* setTimeout(function() {
|
|
121
|
+
* // then do another async task
|
|
122
|
+
* callback(null, 2);
|
|
123
|
+
* }, 100);
|
|
124
|
+
* }
|
|
125
|
+
* }).then(results => {
|
|
126
|
+
* console.log(results);
|
|
127
|
+
* // results is equal to: { one: 1, two: 2 }
|
|
128
|
+
* }).catch(err => {
|
|
129
|
+
* console.log(err);
|
|
130
|
+
* });
|
|
131
|
+
*
|
|
132
|
+
* //Using async/await
|
|
133
|
+
* async () => {
|
|
134
|
+
* try {
|
|
135
|
+
* let results = await async.series([
|
|
136
|
+
* function(callback) {
|
|
137
|
+
* setTimeout(function() {
|
|
138
|
+
* // do some async task
|
|
139
|
+
* callback(null, 'one');
|
|
140
|
+
* }, 200);
|
|
141
|
+
* },
|
|
142
|
+
* function(callback) {
|
|
143
|
+
* setTimeout(function() {
|
|
144
|
+
* // then do another async task
|
|
145
|
+
* callback(null, 'two');
|
|
146
|
+
* }, 100);
|
|
147
|
+
* }
|
|
148
|
+
* ]);
|
|
149
|
+
* console.log(results);
|
|
150
|
+
* // results is equal to ['one','two']
|
|
151
|
+
* }
|
|
152
|
+
* catch (err) {
|
|
153
|
+
* console.log(err);
|
|
154
|
+
* }
|
|
155
|
+
* }
|
|
156
|
+
*
|
|
157
|
+
* // an example using an object instead of an array
|
|
158
|
+
* async () => {
|
|
159
|
+
* try {
|
|
160
|
+
* let results = await async.parallel({
|
|
161
|
+
* one: function(callback) {
|
|
162
|
+
* setTimeout(function() {
|
|
163
|
+
* // do some async task
|
|
164
|
+
* callback(null, 1);
|
|
165
|
+
* }, 200);
|
|
166
|
+
* },
|
|
167
|
+
* two: function(callback) {
|
|
168
|
+
* setTimeout(function() {
|
|
169
|
+
* // then do another async task
|
|
170
|
+
* callback(null, 2);
|
|
171
|
+
* }, 100);
|
|
172
|
+
* }
|
|
173
|
+
* });
|
|
174
|
+
* console.log(results);
|
|
175
|
+
* // results is equal to: { one: 1, two: 2 }
|
|
176
|
+
* }
|
|
177
|
+
* catch (err) {
|
|
178
|
+
* console.log(err);
|
|
179
|
+
* }
|
|
180
|
+
* }
|
|
181
|
+
*
|
|
182
|
+
*/
|
|
183
|
+
function series(tasks, callback) {
|
|
184
|
+
return (0, _parallel3.default)(_eachOfSeries2.default, tasks, callback);
|
|
185
|
+
}
|
|
186
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _setImmediate = require('./internal/setImmediate.js');
|
|
8
|
+
|
|
9
|
+
var _setImmediate2 = _interopRequireDefault(_setImmediate);
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Calls `callback` on a later loop around the event loop. In Node.js this just
|
|
15
|
+
* calls `setImmediate`. In the browser it will use `setImmediate` if
|
|
16
|
+
* available, otherwise `setTimeout(callback, 0)`, which means other higher
|
|
17
|
+
* priority events may precede the execution of `callback`.
|
|
18
|
+
*
|
|
19
|
+
* This is used internally for browser-compatibility purposes.
|
|
20
|
+
*
|
|
21
|
+
* @name setImmediate
|
|
22
|
+
* @static
|
|
23
|
+
* @memberOf module:Utils
|
|
24
|
+
* @method
|
|
25
|
+
* @see [async.nextTick]{@link module:Utils.nextTick}
|
|
26
|
+
* @category Util
|
|
27
|
+
* @param {Function} callback - The function to call on a later loop around
|
|
28
|
+
* the event loop. Invoked with (args...).
|
|
29
|
+
* @param {...*} args... - any number of additional arguments to pass to the
|
|
30
|
+
* callback on the next tick.
|
|
31
|
+
* @example
|
|
32
|
+
*
|
|
33
|
+
* var call_order = [];
|
|
34
|
+
* async.nextTick(function() {
|
|
35
|
+
* call_order.push('two');
|
|
36
|
+
* // call_order now equals ['one','two']
|
|
37
|
+
* });
|
|
38
|
+
* call_order.push('one');
|
|
39
|
+
*
|
|
40
|
+
* async.setImmediate(function (a, b, c) {
|
|
41
|
+
* // a, b, and c equal 1, 2, and 3
|
|
42
|
+
* }, 1, 2, 3);
|
|
43
|
+
*/
|
|
44
|
+
exports.default = _setImmediate2.default;
|
|
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;
|