@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,41 @@
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 to the `console`. Only works in
15
+ * Node.js or in browsers that support `console.log` and `console.error` (such
16
+ * as FF and Chrome). If multiple arguments are returned from the async
17
+ * function, `console.log` is called on each argument in order.
18
+ *
19
+ * @name log
20
+ * @static
21
+ * @memberOf module:Utils
22
+ * @method
23
+ * @category Util
24
+ * @param {AsyncFunction} function - The function you want to eventually apply
25
+ * all arguments to.
26
+ * @param {...*} arguments... - Any number of arguments to apply to the function.
27
+ * @example
28
+ *
29
+ * // in a module
30
+ * var hello = function(name, callback) {
31
+ * setTimeout(function() {
32
+ * callback(null, 'hello ' + name);
33
+ * }, 1000);
34
+ * };
35
+ *
36
+ * // in the node repl
37
+ * node> async.log(hello, 'world');
38
+ * 'hello world'
39
+ */
40
+ exports.default = (0, _consoleFunc2.default)('log');
41
+ module.exports = exports.default;
@@ -0,0 +1,142 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _map2 = require('./internal/map.js');
8
+
9
+ var _map3 = _interopRequireDefault(_map2);
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
+ * Produces a new collection of values by mapping each value in `coll` through
23
+ * the `iteratee` function. The `iteratee` is called with an item from `coll`
24
+ * and a callback for when it has finished processing. Each of these callbacks
25
+ * takes 2 arguments: an `error`, and the transformed item from `coll`. If
26
+ * `iteratee` passes an error to its callback, the main `callback` (for the
27
+ * `map` function) is immediately called with the error.
28
+ *
29
+ * Note, that since this function applies the `iteratee` to each item in
30
+ * parallel, there is no guarantee that the `iteratee` functions will complete
31
+ * in order. However, the results array will be in the same order as the
32
+ * original `coll`.
33
+ *
34
+ * If `map` is passed an Object, the results will be an Array. The results
35
+ * will roughly be in the order of the original Objects' keys (but this can
36
+ * vary across JavaScript engines).
37
+ *
38
+ * @name map
39
+ * @static
40
+ * @memberOf module:Collections
41
+ * @method
42
+ * @category Collection
43
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
44
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
45
+ * `coll`.
46
+ * The iteratee should complete with the transformed item.
47
+ * Invoked with (item, callback).
48
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
49
+ * functions have finished, or an error occurs. Results is an Array of the
50
+ * transformed items from the `coll`. Invoked with (err, results).
51
+ * @returns {Promise} a promise, if no callback is passed
52
+ * @example
53
+ *
54
+ * // file1.txt is a file that is 1000 bytes in size
55
+ * // file2.txt is a file that is 2000 bytes in size
56
+ * // file3.txt is a file that is 3000 bytes in size
57
+ * // file4.txt does not exist
58
+ *
59
+ * const fileList = ['file1.txt','file2.txt','file3.txt'];
60
+ * const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];
61
+ *
62
+ * // asynchronous function that returns the file size in bytes
63
+ * function getFileSizeInBytes(file, callback) {
64
+ * fs.stat(file, function(err, stat) {
65
+ * if (err) {
66
+ * return callback(err);
67
+ * }
68
+ * callback(null, stat.size);
69
+ * });
70
+ * }
71
+ *
72
+ * // Using callbacks
73
+ * async.map(fileList, getFileSizeInBytes, function(err, results) {
74
+ * if (err) {
75
+ * console.log(err);
76
+ * } else {
77
+ * console.log(results);
78
+ * // results is now an array of the file size in bytes for each file, e.g.
79
+ * // [ 1000, 2000, 3000]
80
+ * }
81
+ * });
82
+ *
83
+ * // Error Handling
84
+ * async.map(withMissingFileList, getFileSizeInBytes, function(err, results) {
85
+ * if (err) {
86
+ * console.log(err);
87
+ * // [ Error: ENOENT: no such file or directory ]
88
+ * } else {
89
+ * console.log(results);
90
+ * }
91
+ * });
92
+ *
93
+ * // Using Promises
94
+ * async.map(fileList, getFileSizeInBytes)
95
+ * .then( results => {
96
+ * console.log(results);
97
+ * // results is now an array of the file size in bytes for each file, e.g.
98
+ * // [ 1000, 2000, 3000]
99
+ * }).catch( err => {
100
+ * console.log(err);
101
+ * });
102
+ *
103
+ * // Error Handling
104
+ * async.map(withMissingFileList, getFileSizeInBytes)
105
+ * .then( results => {
106
+ * console.log(results);
107
+ * }).catch( err => {
108
+ * console.log(err);
109
+ * // [ Error: ENOENT: no such file or directory ]
110
+ * });
111
+ *
112
+ * // Using async/await
113
+ * async () => {
114
+ * try {
115
+ * let results = await async.map(fileList, getFileSizeInBytes);
116
+ * console.log(results);
117
+ * // results is now an array of the file size in bytes for each file, e.g.
118
+ * // [ 1000, 2000, 3000]
119
+ * }
120
+ * catch (err) {
121
+ * console.log(err);
122
+ * }
123
+ * }
124
+ *
125
+ * // Error Handling
126
+ * async () => {
127
+ * try {
128
+ * let results = await async.map(withMissingFileList, getFileSizeInBytes);
129
+ * console.log(results);
130
+ * }
131
+ * catch (err) {
132
+ * console.log(err);
133
+ * // [ Error: ENOENT: no such file or directory ]
134
+ * }
135
+ * }
136
+ *
137
+ */
138
+ function map(coll, iteratee, callback) {
139
+ return (0, _map3.default)(_eachOf2.default, coll, iteratee, callback);
140
+ }
141
+ exports.default = (0, _awaitify2.default)(map, 3);
142
+ module.exports = exports.default;
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _map2 = require('./internal/map.js');
8
+
9
+ var _map3 = _interopRequireDefault(_map2);
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 [`map`]{@link module:Collections.map} but runs a maximum of `limit` async operations at a time.
23
+ *
24
+ * @name mapLimit
25
+ * @static
26
+ * @memberOf module:Collections
27
+ * @method
28
+ * @see [async.map]{@link module:Collections.map}
29
+ * @category Collection
30
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
31
+ * @param {number} limit - The maximum number of async operations at a time.
32
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
33
+ * `coll`.
34
+ * The iteratee should complete with the transformed item.
35
+ * Invoked with (item, callback).
36
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
37
+ * functions have finished, or an error occurs. Results is an array of the
38
+ * transformed items from the `coll`. Invoked with (err, results).
39
+ * @returns {Promise} a promise, if no callback is passed
40
+ */
41
+ function mapLimit(coll, limit, iteratee, callback) {
42
+ return (0, _map3.default)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
43
+ }
44
+ exports.default = (0, _awaitify2.default)(mapLimit, 4);
45
+ module.exports = exports.default;
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _map2 = require('./internal/map.js');
8
+
9
+ var _map3 = _interopRequireDefault(_map2);
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 [`map`]{@link module:Collections.map} but runs only a single async operation at a time.
23
+ *
24
+ * @name mapSeries
25
+ * @static
26
+ * @memberOf module:Collections
27
+ * @method
28
+ * @see [async.map]{@link module:Collections.map}
29
+ * @category Collection
30
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
31
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
32
+ * `coll`.
33
+ * The iteratee should complete with the transformed item.
34
+ * Invoked with (item, callback).
35
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
36
+ * functions have finished, or an error occurs. Results is an array of the
37
+ * transformed items from the `coll`. Invoked with (err, results).
38
+ * @returns {Promise} a promise, if no callback is passed
39
+ */
40
+ function mapSeries(coll, iteratee, callback) {
41
+ return (0, _map3.default)(_eachOfSeries2.default, coll, iteratee, callback);
42
+ }
43
+ exports.default = (0, _awaitify2.default)(mapSeries, 3);
44
+ module.exports = exports.default;
@@ -0,0 +1,152 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = mapValues;
7
+
8
+ var _mapValuesLimit = require('./mapValuesLimit.js');
9
+
10
+ var _mapValuesLimit2 = _interopRequireDefault(_mapValuesLimit);
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ /**
15
+ * A relative of [`map`]{@link module:Collections.map}, designed for use with objects.
16
+ *
17
+ * Produces a new Object by mapping each value of `obj` through the `iteratee`
18
+ * function. The `iteratee` is called each `value` and `key` from `obj` and a
19
+ * callback for when it has finished processing. Each of these callbacks takes
20
+ * two arguments: an `error`, and the transformed item from `obj`. If `iteratee`
21
+ * passes an error to its callback, the main `callback` (for the `mapValues`
22
+ * function) is immediately called with the error.
23
+ *
24
+ * Note, the order of the keys in the result is not guaranteed. The keys will
25
+ * be roughly in the order they complete, (but this is very engine-specific)
26
+ *
27
+ * @name mapValues
28
+ * @static
29
+ * @memberOf module:Collections
30
+ * @method
31
+ * @category Collection
32
+ * @param {Object} obj - A collection to iterate over.
33
+ * @param {AsyncFunction} iteratee - A function to apply to each value and key
34
+ * in `coll`.
35
+ * The iteratee should complete with the transformed value as its result.
36
+ * Invoked with (value, key, callback).
37
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
38
+ * functions have finished, or an error occurs. `result` is a new object consisting
39
+ * of each key from `obj`, with each transformed value on the right-hand side.
40
+ * Invoked with (err, result).
41
+ * @returns {Promise} a promise, if no callback is passed
42
+ * @example
43
+ *
44
+ * // file1.txt is a file that is 1000 bytes in size
45
+ * // file2.txt is a file that is 2000 bytes in size
46
+ * // file3.txt is a file that is 3000 bytes in size
47
+ * // file4.txt does not exist
48
+ *
49
+ * const fileMap = {
50
+ * f1: 'file1.txt',
51
+ * f2: 'file2.txt',
52
+ * f3: 'file3.txt'
53
+ * };
54
+ *
55
+ * const withMissingFileMap = {
56
+ * f1: 'file1.txt',
57
+ * f2: 'file2.txt',
58
+ * f3: 'file4.txt'
59
+ * };
60
+ *
61
+ * // asynchronous function that returns the file size in bytes
62
+ * function getFileSizeInBytes(file, key, callback) {
63
+ * fs.stat(file, function(err, stat) {
64
+ * if (err) {
65
+ * return callback(err);
66
+ * }
67
+ * callback(null, stat.size);
68
+ * });
69
+ * }
70
+ *
71
+ * // Using callbacks
72
+ * async.mapValues(fileMap, getFileSizeInBytes, function(err, result) {
73
+ * if (err) {
74
+ * console.log(err);
75
+ * } else {
76
+ * console.log(result);
77
+ * // result is now a map of file size in bytes for each file, e.g.
78
+ * // {
79
+ * // f1: 1000,
80
+ * // f2: 2000,
81
+ * // f3: 3000
82
+ * // }
83
+ * }
84
+ * });
85
+ *
86
+ * // Error handling
87
+ * async.mapValues(withMissingFileMap, getFileSizeInBytes, function(err, result) {
88
+ * if (err) {
89
+ * console.log(err);
90
+ * // [ Error: ENOENT: no such file or directory ]
91
+ * } else {
92
+ * console.log(result);
93
+ * }
94
+ * });
95
+ *
96
+ * // Using Promises
97
+ * async.mapValues(fileMap, getFileSizeInBytes)
98
+ * .then( result => {
99
+ * console.log(result);
100
+ * // result is now a map of file size in bytes for each file, e.g.
101
+ * // {
102
+ * // f1: 1000,
103
+ * // f2: 2000,
104
+ * // f3: 3000
105
+ * // }
106
+ * }).catch (err => {
107
+ * console.log(err);
108
+ * });
109
+ *
110
+ * // Error Handling
111
+ * async.mapValues(withMissingFileMap, getFileSizeInBytes)
112
+ * .then( result => {
113
+ * console.log(result);
114
+ * }).catch (err => {
115
+ * console.log(err);
116
+ * // [ Error: ENOENT: no such file or directory ]
117
+ * });
118
+ *
119
+ * // Using async/await
120
+ * async () => {
121
+ * try {
122
+ * let result = await async.mapValues(fileMap, getFileSizeInBytes);
123
+ * console.log(result);
124
+ * // result is now a map of file size in bytes for each file, e.g.
125
+ * // {
126
+ * // f1: 1000,
127
+ * // f2: 2000,
128
+ * // f3: 3000
129
+ * // }
130
+ * }
131
+ * catch (err) {
132
+ * console.log(err);
133
+ * }
134
+ * }
135
+ *
136
+ * // Error Handling
137
+ * async () => {
138
+ * try {
139
+ * let result = await async.mapValues(withMissingFileMap, getFileSizeInBytes);
140
+ * console.log(result);
141
+ * }
142
+ * catch (err) {
143
+ * console.log(err);
144
+ * // [ Error: ENOENT: no such file or directory ]
145
+ * }
146
+ * }
147
+ *
148
+ */
149
+ function mapValues(obj, iteratee, callback) {
150
+ return (0, _mapValuesLimit2.default)(obj, Infinity, iteratee, callback);
151
+ }
152
+ module.exports = exports.default;
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _eachOfLimit = require('./internal/eachOfLimit.js');
8
+
9
+ var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
10
+
11
+ var _awaitify = require('./internal/awaitify.js');
12
+
13
+ var _awaitify2 = _interopRequireDefault(_awaitify);
14
+
15
+ var _once = require('./internal/once.js');
16
+
17
+ var _once2 = _interopRequireDefault(_once);
18
+
19
+ var _wrapAsync = require('./internal/wrapAsync.js');
20
+
21
+ var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
22
+
23
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
+
25
+ /**
26
+ * The same as [`mapValues`]{@link module:Collections.mapValues} but runs a maximum of `limit` async operations at a
27
+ * time.
28
+ *
29
+ * @name mapValuesLimit
30
+ * @static
31
+ * @memberOf module:Collections
32
+ * @method
33
+ * @see [async.mapValues]{@link module:Collections.mapValues}
34
+ * @category Collection
35
+ * @param {Object} obj - A collection to iterate over.
36
+ * @param {number} limit - The maximum number of async operations at a time.
37
+ * @param {AsyncFunction} iteratee - A function to apply to each value and key
38
+ * in `coll`.
39
+ * The iteratee should complete with the transformed value as its result.
40
+ * Invoked with (value, key, callback).
41
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
42
+ * functions have finished, or an error occurs. `result` is a new object consisting
43
+ * of each key from `obj`, with each transformed value on the right-hand side.
44
+ * Invoked with (err, result).
45
+ * @returns {Promise} a promise, if no callback is passed
46
+ */
47
+ function mapValuesLimit(obj, limit, iteratee, callback) {
48
+ callback = (0, _once2.default)(callback);
49
+ var newObj = {};
50
+ var _iteratee = (0, _wrapAsync2.default)(iteratee);
51
+ return (0, _eachOfLimit2.default)(limit)(obj, (val, key, next) => {
52
+ _iteratee(val, key, (err, result) => {
53
+ if (err) return next(err);
54
+ newObj[key] = result;
55
+ next(err);
56
+ });
57
+ }, err => callback(err, newObj));
58
+ }
59
+
60
+ exports.default = (0, _awaitify2.default)(mapValuesLimit, 4);
61
+ module.exports = exports.default;
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = mapValuesSeries;
7
+
8
+ var _mapValuesLimit = require('./mapValuesLimit.js');
9
+
10
+ var _mapValuesLimit2 = _interopRequireDefault(_mapValuesLimit);
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ /**
15
+ * The same as [`mapValues`]{@link module:Collections.mapValues} but runs only a single async operation at a time.
16
+ *
17
+ * @name mapValuesSeries
18
+ * @static
19
+ * @memberOf module:Collections
20
+ * @method
21
+ * @see [async.mapValues]{@link module:Collections.mapValues}
22
+ * @category Collection
23
+ * @param {Object} obj - A collection to iterate over.
24
+ * @param {AsyncFunction} iteratee - A function to apply to each value and key
25
+ * in `coll`.
26
+ * The iteratee should complete with the transformed value as its result.
27
+ * Invoked with (value, key, callback).
28
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
29
+ * functions have finished, or an error occurs. `result` is a new object consisting
30
+ * of each key from `obj`, with each transformed value on the right-hand side.
31
+ * Invoked with (err, result).
32
+ * @returns {Promise} a promise, if no callback is passed
33
+ */
34
+ function mapValuesSeries(obj, iteratee, callback) {
35
+ return (0, _mapValuesLimit2.default)(obj, 1, iteratee, callback);
36
+ }
37
+ module.exports = exports.default;
@@ -0,0 +1,91 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = memoize;
7
+
8
+ var _setImmediate = require('./internal/setImmediate.js');
9
+
10
+ var _setImmediate2 = _interopRequireDefault(_setImmediate);
11
+
12
+ var _initialParams = require('./internal/initialParams.js');
13
+
14
+ var _initialParams2 = _interopRequireDefault(_initialParams);
15
+
16
+ var _wrapAsync = require('./internal/wrapAsync.js');
17
+
18
+ var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ /**
23
+ * Caches the results of an async function. When creating a hash to store
24
+ * function results against, the callback is omitted from the hash and an
25
+ * optional hash function can be used.
26
+ *
27
+ * **Note: if the async function errs, the result will not be cached and
28
+ * subsequent calls will call the wrapped function.**
29
+ *
30
+ * If no hash function is specified, the first argument is used as a hash key,
31
+ * which may work reasonably if it is a string or a data type that converts to a
32
+ * distinct string. Note that objects and arrays will not behave reasonably.
33
+ * Neither will cases where the other arguments are significant. In such cases,
34
+ * specify your own hash function.
35
+ *
36
+ * The cache of results is exposed as the `memo` property of the function
37
+ * returned by `memoize`.
38
+ *
39
+ * @name memoize
40
+ * @static
41
+ * @memberOf module:Utils
42
+ * @method
43
+ * @category Util
44
+ * @param {AsyncFunction} fn - The async function to proxy and cache results from.
45
+ * @param {Function} hasher - An optional function for generating a custom hash
46
+ * for storing results. It has all the arguments applied to it apart from the
47
+ * callback, and must be synchronous.
48
+ * @returns {AsyncFunction} a memoized version of `fn`
49
+ * @example
50
+ *
51
+ * var slow_fn = function(name, callback) {
52
+ * // do something
53
+ * callback(null, result);
54
+ * };
55
+ * var fn = async.memoize(slow_fn);
56
+ *
57
+ * // fn can now be used as if it were slow_fn
58
+ * fn('some name', function() {
59
+ * // callback
60
+ * });
61
+ */
62
+ function memoize(fn, hasher = v => v) {
63
+ var memo = Object.create(null);
64
+ var queues = Object.create(null);
65
+ var _fn = (0, _wrapAsync2.default)(fn);
66
+ var memoized = (0, _initialParams2.default)((args, callback) => {
67
+ var key = hasher(...args);
68
+ if (key in memo) {
69
+ (0, _setImmediate2.default)(() => callback(null, ...memo[key]));
70
+ } else if (key in queues) {
71
+ queues[key].push(callback);
72
+ } else {
73
+ queues[key] = [callback];
74
+ _fn(...args, (err, ...resultArgs) => {
75
+ // #1465 don't memoize if an error occurred
76
+ if (!err) {
77
+ memo[key] = resultArgs;
78
+ }
79
+ var q = queues[key];
80
+ delete queues[key];
81
+ for (var i = 0, l = q.length; i < l; i++) {
82
+ q[i](err, ...resultArgs);
83
+ }
84
+ });
85
+ }
86
+ });
87
+ memoized.memo = memo;
88
+ memoized.unmemoized = fn;
89
+ return memoized;
90
+ }
91
+ module.exports = exports.default;
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _setImmediate = require('./internal/setImmediate.js');
8
+
9
+ /**
10
+ * Calls `callback` on a later loop around the event loop. In Node.js this just
11
+ * calls `process.nextTick`. In the browser it will use `setImmediate` if
12
+ * available, otherwise `setTimeout(callback, 0)`, which means other higher
13
+ * priority events may precede the execution of `callback`.
14
+ *
15
+ * This is used internally for browser-compatibility purposes.
16
+ *
17
+ * @name nextTick
18
+ * @static
19
+ * @memberOf module:Utils
20
+ * @method
21
+ * @see [async.setImmediate]{@link module:Utils.setImmediate}
22
+ * @category Util
23
+ * @param {Function} callback - The function to call on a later loop around
24
+ * the event loop. Invoked with (args...).
25
+ * @param {...*} args... - any number of additional arguments to pass to the
26
+ * callback on the next tick.
27
+ * @example
28
+ *
29
+ * var call_order = [];
30
+ * async.nextTick(function() {
31
+ * call_order.push('two');
32
+ * // call_order now equals ['one','two']
33
+ * });
34
+ * call_order.push('one');
35
+ *
36
+ * async.setImmediate(function (a, b, c) {
37
+ * // a, b, and c equal 1, 2, and 3
38
+ * }, 1, 2, 3);
39
+ */
40
+ var _defer; /* istanbul ignore file */
41
+
42
+
43
+ if (_setImmediate.hasNextTick) {
44
+ _defer = process.nextTick;
45
+ } else if (_setImmediate.hasSetImmediate) {
46
+ _defer = setImmediate;
47
+ } else {
48
+ _defer = _setImmediate.fallback;
49
+ }
50
+
51
+ exports.default = (0, _setImmediate.wrap)(_defer);
52
+ module.exports = exports.default;