@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,55 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = compose;
7
+
8
+ var _seq = require('./seq.js');
9
+
10
+ var _seq2 = _interopRequireDefault(_seq);
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ /**
15
+ * Creates a function which is a composition of the passed asynchronous
16
+ * functions. Each function consumes the return value of the function that
17
+ * follows. Composing functions `f()`, `g()`, and `h()` would produce the result
18
+ * of `f(g(h()))`, only this version uses callbacks to obtain the return values.
19
+ *
20
+ * If the last argument to the composed function is not a function, a promise
21
+ * is returned when you call it.
22
+ *
23
+ * Each function is executed with the `this` binding of the composed function.
24
+ *
25
+ * @name compose
26
+ * @static
27
+ * @memberOf module:ControlFlow
28
+ * @method
29
+ * @category Control Flow
30
+ * @param {...AsyncFunction} functions - the asynchronous functions to compose
31
+ * @returns {Function} an asynchronous function that is the composed
32
+ * asynchronous `functions`
33
+ * @example
34
+ *
35
+ * function add1(n, callback) {
36
+ * setTimeout(function () {
37
+ * callback(null, n + 1);
38
+ * }, 10);
39
+ * }
40
+ *
41
+ * function mul3(n, callback) {
42
+ * setTimeout(function () {
43
+ * callback(null, n * 3);
44
+ * }, 10);
45
+ * }
46
+ *
47
+ * var add1mul3 = async.compose(mul3, add1);
48
+ * add1mul3(4, function (err, result) {
49
+ * // result now equals 15
50
+ * });
51
+ */
52
+ function compose(...args) {
53
+ return (0, _seq2.default)(...args.reverse());
54
+ }
55
+ module.exports = exports.default;
@@ -0,0 +1,115 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _concatLimit = require('./concatLimit.js');
8
+
9
+ var _concatLimit2 = _interopRequireDefault(_concatLimit);
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
+ * Applies `iteratee` to each item in `coll`, concatenating the results. Returns
19
+ * the concatenated list. The `iteratee`s are called in parallel, and the
20
+ * results are concatenated as they return. The results array will be returned in
21
+ * the original order of `coll` passed to the `iteratee` function.
22
+ *
23
+ * @name concat
24
+ * @static
25
+ * @memberOf module:Collections
26
+ * @method
27
+ * @category Collection
28
+ * @alias flatMap
29
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
30
+ * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
31
+ * which should use an array as its result. Invoked with (item, callback).
32
+ * @param {Function} [callback] - A callback which is called after all the
33
+ * `iteratee` functions have finished, or an error occurs. Results is an array
34
+ * containing the concatenated results of the `iteratee` function. Invoked with
35
+ * (err, results).
36
+ * @returns A Promise, if no callback is passed
37
+ * @example
38
+ *
39
+ * // dir1 is a directory that contains file1.txt, file2.txt
40
+ * // dir2 is a directory that contains file3.txt, file4.txt
41
+ * // dir3 is a directory that contains file5.txt
42
+ * // dir4 does not exist
43
+ *
44
+ * let directoryList = ['dir1','dir2','dir3'];
45
+ * let withMissingDirectoryList = ['dir1','dir2','dir3', 'dir4'];
46
+ *
47
+ * // Using callbacks
48
+ * async.concat(directoryList, fs.readdir, function(err, results) {
49
+ * if (err) {
50
+ * console.log(err);
51
+ * } else {
52
+ * console.log(results);
53
+ * // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
54
+ * }
55
+ * });
56
+ *
57
+ * // Error Handling
58
+ * async.concat(withMissingDirectoryList, fs.readdir, function(err, results) {
59
+ * if (err) {
60
+ * console.log(err);
61
+ * // [ Error: ENOENT: no such file or directory ]
62
+ * // since dir4 does not exist
63
+ * } else {
64
+ * console.log(results);
65
+ * }
66
+ * });
67
+ *
68
+ * // Using Promises
69
+ * async.concat(directoryList, fs.readdir)
70
+ * .then(results => {
71
+ * console.log(results);
72
+ * // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
73
+ * }).catch(err => {
74
+ * console.log(err);
75
+ * });
76
+ *
77
+ * // Error Handling
78
+ * async.concat(withMissingDirectoryList, fs.readdir)
79
+ * .then(results => {
80
+ * console.log(results);
81
+ * }).catch(err => {
82
+ * console.log(err);
83
+ * // [ Error: ENOENT: no such file or directory ]
84
+ * // since dir4 does not exist
85
+ * });
86
+ *
87
+ * // Using async/await
88
+ * async () => {
89
+ * try {
90
+ * let results = await async.concat(directoryList, fs.readdir);
91
+ * console.log(results);
92
+ * // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
93
+ * } catch (err) {
94
+ * console.log(err);
95
+ * }
96
+ * }
97
+ *
98
+ * // Error Handling
99
+ * async () => {
100
+ * try {
101
+ * let results = await async.concat(withMissingDirectoryList, fs.readdir);
102
+ * console.log(results);
103
+ * } catch (err) {
104
+ * console.log(err);
105
+ * // [ Error: ENOENT: no such file or directory ]
106
+ * // since dir4 does not exist
107
+ * }
108
+ * }
109
+ *
110
+ */
111
+ function concat(coll, iteratee, callback) {
112
+ return (0, _concatLimit2.default)(coll, Infinity, iteratee, callback);
113
+ }
114
+ exports.default = (0, _awaitify2.default)(concat, 3);
115
+ module.exports = exports.default;
@@ -0,0 +1,60 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _wrapAsync = require('./internal/wrapAsync.js');
8
+
9
+ var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
10
+
11
+ var _mapLimit = require('./mapLimit.js');
12
+
13
+ var _mapLimit2 = _interopRequireDefault(_mapLimit);
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 [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time.
23
+ *
24
+ * @name concatLimit
25
+ * @static
26
+ * @memberOf module:Collections
27
+ * @method
28
+ * @see [async.concat]{@link module:Collections.concat}
29
+ * @category Collection
30
+ * @alias flatMapLimit
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 - A function to apply to each item in `coll`,
34
+ * which should use an array as its result. Invoked with (item, callback).
35
+ * @param {Function} [callback] - A callback which is called after all the
36
+ * `iteratee` functions have finished, or an error occurs. Results is an array
37
+ * containing the concatenated results of the `iteratee` function. Invoked with
38
+ * (err, results).
39
+ * @returns A Promise, if no callback is passed
40
+ */
41
+ function concatLimit(coll, limit, iteratee, callback) {
42
+ var _iteratee = (0, _wrapAsync2.default)(iteratee);
43
+ return (0, _mapLimit2.default)(coll, limit, (val, iterCb) => {
44
+ _iteratee(val, (err, ...args) => {
45
+ if (err) return iterCb(err);
46
+ return iterCb(err, args);
47
+ });
48
+ }, (err, mapResults) => {
49
+ var result = [];
50
+ for (var i = 0; i < mapResults.length; i++) {
51
+ if (mapResults[i]) {
52
+ result = result.concat(...mapResults[i]);
53
+ }
54
+ }
55
+
56
+ return callback(err, result);
57
+ });
58
+ }
59
+ exports.default = (0, _awaitify2.default)(concatLimit, 4);
60
+ module.exports = exports.default;
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _concatLimit = require('./concatLimit.js');
8
+
9
+ var _concatLimit2 = _interopRequireDefault(_concatLimit);
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 [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time.
19
+ *
20
+ * @name concatSeries
21
+ * @static
22
+ * @memberOf module:Collections
23
+ * @method
24
+ * @see [async.concat]{@link module:Collections.concat}
25
+ * @category Collection
26
+ * @alias flatMapSeries
27
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
28
+ * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`.
29
+ * The iteratee should complete with an array an array of results.
30
+ * Invoked with (item, callback).
31
+ * @param {Function} [callback] - A callback which is called after all the
32
+ * `iteratee` functions have finished, or an error occurs. Results is an array
33
+ * containing the concatenated results of the `iteratee` function. Invoked with
34
+ * (err, results).
35
+ * @returns A Promise, if no callback is passed
36
+ */
37
+ function concatSeries(coll, iteratee, callback) {
38
+ return (0, _concatLimit2.default)(coll, 1, iteratee, callback);
39
+ }
40
+ exports.default = (0, _awaitify2.default)(concatSeries, 3);
41
+ module.exports = exports.default;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ exports.default = function (...args) {
8
+ return function (...ignoredArgs /*, callback*/) {
9
+ var callback = ignoredArgs.pop();
10
+ return callback(null, ...args);
11
+ };
12
+ };
13
+
14
+ module.exports = exports.default;
@@ -0,0 +1,96 @@
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 the first value in `coll` that passes an async truth test. The
23
+ * `iteratee` is applied in parallel, meaning the first iteratee to return
24
+ * `true` will fire the detect `callback` with that result. That means the
25
+ * result might not be the first item in the original `coll` (in terms of order)
26
+ * that passes the test.
27
+
28
+ * If order within the original `coll` is important, then look at
29
+ * [`detectSeries`]{@link module:Collections.detectSeries}.
30
+ *
31
+ * @name detect
32
+ * @static
33
+ * @memberOf module:Collections
34
+ * @method
35
+ * @alias find
36
+ * @category Collections
37
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
38
+ * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
39
+ * The iteratee must complete with a boolean value as its result.
40
+ * Invoked with (item, callback).
41
+ * @param {Function} [callback] - A callback which is called as soon as any
42
+ * iteratee returns `true`, or after all the `iteratee` functions have finished.
43
+ * Result will be the first item in the array that passes the truth test
44
+ * (iteratee) or the value `undefined` if none passed. Invoked with
45
+ * (err, result).
46
+ * @returns {Promise} a promise, if a callback is omitted
47
+ * @example
48
+ *
49
+ * // dir1 is a directory that contains file1.txt, file2.txt
50
+ * // dir2 is a directory that contains file3.txt, file4.txt
51
+ * // dir3 is a directory that contains file5.txt
52
+ *
53
+ * // asynchronous function that checks if a file exists
54
+ * function fileExists(file, callback) {
55
+ * fs.access(file, fs.constants.F_OK, (err) => {
56
+ * callback(null, !err);
57
+ * });
58
+ * }
59
+ *
60
+ * async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists,
61
+ * function(err, result) {
62
+ * console.log(result);
63
+ * // dir1/file1.txt
64
+ * // result now equals the first file in the list that exists
65
+ * }
66
+ *);
67
+ *
68
+ * // Using Promises
69
+ * async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists)
70
+ * .then(result => {
71
+ * console.log(result);
72
+ * // dir1/file1.txt
73
+ * // result now equals the first file in the list that exists
74
+ * }).catch(err => {
75
+ * console.log(err);
76
+ * });
77
+ *
78
+ * // Using async/await
79
+ * async () => {
80
+ * try {
81
+ * let result = await async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists);
82
+ * console.log(result);
83
+ * // dir1/file1.txt
84
+ * // result now equals the file in the list that exists
85
+ * }
86
+ * catch (err) {
87
+ * console.log(err);
88
+ * }
89
+ * }
90
+ *
91
+ */
92
+ function detect(coll, iteratee, callback) {
93
+ return (0, _createTester2.default)(bool => bool, (res, item) => item)(_eachOf2.default, coll, iteratee, callback);
94
+ }
95
+ exports.default = (0, _awaitify2.default)(detect, 3);
96
+ module.exports = exports.default;
@@ -0,0 +1,48 @@
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 [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a
23
+ * time.
24
+ *
25
+ * @name detectLimit
26
+ * @static
27
+ * @memberOf module:Collections
28
+ * @method
29
+ * @see [async.detect]{@link module:Collections.detect}
30
+ * @alias findLimit
31
+ * @category Collections
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 - A truth test to apply to each item in `coll`.
35
+ * The iteratee must complete with a boolean value as its result.
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 the first item in the array that passes the truth test
40
+ * (iteratee) or the value `undefined` if none passed. Invoked with
41
+ * (err, result).
42
+ * @returns {Promise} a promise, if a callback is omitted
43
+ */
44
+ function detectLimit(coll, limit, iteratee, callback) {
45
+ return (0, _createTester2.default)(bool => bool, (res, item) => item)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
46
+ }
47
+ exports.default = (0, _awaitify2.default)(detectLimit, 4);
48
+ 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 [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time.
23
+ *
24
+ * @name detectSeries
25
+ * @static
26
+ * @memberOf module:Collections
27
+ * @method
28
+ * @see [async.detect]{@link module:Collections.detect}
29
+ * @alias findSeries
30
+ * @category Collections
31
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32
+ * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
33
+ * The iteratee must complete with a boolean value as its result.
34
+ * Invoked with (item, callback).
35
+ * @param {Function} [callback] - A callback which is called as soon as any
36
+ * iteratee returns `true`, or after all the `iteratee` functions have finished.
37
+ * Result will be the first item in the array that passes the truth test
38
+ * (iteratee) or the value `undefined` if none passed. Invoked with
39
+ * (err, result).
40
+ * @returns {Promise} a promise, if a callback is omitted
41
+ */
42
+ function detectSeries(coll, iteratee, callback) {
43
+ return (0, _createTester2.default)(bool => bool, (res, item) => item)((0, _eachOfLimit2.default)(1), coll, iteratee, callback);
44
+ }
45
+
46
+ exports.default = (0, _awaitify2.default)(detectSeries, 3);
47
+ module.exports = exports.default;
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _consoleFunc = require('./internal/consoleFunc.js');
8
+
9
+ var _consoleFunc2 = _interopRequireDefault(_consoleFunc);
10
+
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+
13
+ /**
14
+ * Logs the result of an [`async` function]{@link AsyncFunction} to the
15
+ * `console` using `console.dir` to display the properties of the resulting object.
16
+ * Only works in Node.js or in browsers that support `console.dir` and
17
+ * `console.error` (such as FF and Chrome).
18
+ * If multiple arguments are returned from the async function,
19
+ * `console.dir` is called on each argument in order.
20
+ *
21
+ * @name dir
22
+ * @static
23
+ * @memberOf module:Utils
24
+ * @method
25
+ * @category Util
26
+ * @param {AsyncFunction} function - The function you want to eventually apply
27
+ * all arguments to.
28
+ * @param {...*} arguments... - Any number of arguments to apply to the function.
29
+ * @example
30
+ *
31
+ * // in a module
32
+ * var hello = function(name, callback) {
33
+ * setTimeout(function() {
34
+ * callback(null, {hello: name});
35
+ * }, 1000);
36
+ * };
37
+ *
38
+ * // in the node repl
39
+ * node> async.dir(hello, 'world');
40
+ * {hello: 'world'}
41
+ */
42
+ exports.default = (0, _consoleFunc2.default)('dir');
43
+ module.exports = exports.default;