@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,75 @@
1
+ {
2
+ "name": "async",
3
+ "description": "Higher-order functions and common patterns for asynchronous code",
4
+ "version": "3.2.5",
5
+ "main": "dist/async.js",
6
+ "author": "Caolan McMahon",
7
+ "homepage": "https://caolan.github.io/async/",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/caolan/async.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/caolan/async/issues"
14
+ },
15
+ "keywords": [
16
+ "async",
17
+ "callback",
18
+ "module",
19
+ "utility"
20
+ ],
21
+ "devDependencies": {
22
+ "@babel/eslint-parser": "^7.16.5",
23
+ "@babel/core": "7.23.2",
24
+ "babel-minify": "^0.5.0",
25
+ "babel-plugin-add-module-exports": "^1.0.4",
26
+ "babel-plugin-istanbul": "^6.1.1",
27
+ "babel-plugin-syntax-async-generators": "^6.13.0",
28
+ "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
29
+ "babel-preset-es2015": "^6.3.13",
30
+ "babel-preset-es2017": "^6.22.0",
31
+ "babel-register": "^6.26.0",
32
+ "babelify": "^10.0.0",
33
+ "benchmark": "^2.1.1",
34
+ "bluebird": "^3.4.6",
35
+ "browserify": "^17.0.0",
36
+ "chai": "^4.2.0",
37
+ "cheerio": "^0.22.0",
38
+ "es6-promise": "^4.2.8",
39
+ "eslint": "^8.6.0",
40
+ "eslint-plugin-prefer-arrow": "^1.2.3",
41
+ "fs-extra": "^11.1.1",
42
+ "jsdoc": "^3.6.2",
43
+ "karma": "^6.3.12",
44
+ "karma-browserify": "^8.1.0",
45
+ "karma-firefox-launcher": "^2.1.2",
46
+ "karma-mocha": "^2.0.1",
47
+ "karma-mocha-reporter": "^2.2.0",
48
+ "karma-safari-launcher": "^1.0.0",
49
+ "mocha": "^6.1.4",
50
+ "native-promise-only": "^0.8.0-a",
51
+ "nyc": "^15.1.0",
52
+ "rollup": "^4.2.0",
53
+ "rollup-plugin-node-resolve": "^5.2.0",
54
+ "rollup-plugin-npm": "^2.0.0",
55
+ "rsvp": "^4.8.5",
56
+ "semver": "^7.3.5",
57
+ "yargs": "^17.3.1"
58
+ },
59
+ "scripts": {
60
+ "coverage": "nyc npm run mocha-node-test -- --grep @nycinvalid --invert",
61
+ "jsdoc": "jsdoc -c ./support/jsdoc/jsdoc.json && node support/jsdoc/jsdoc-fix-html.js",
62
+ "lint": "eslint --fix .",
63
+ "mocha-browser-test": "karma start",
64
+ "mocha-node-test": "mocha",
65
+ "mocha-test": "npm run mocha-node-test && npm run mocha-browser-test",
66
+ "test": "npm run lint && npm run mocha-node-test"
67
+ },
68
+ "license": "MIT",
69
+ "nyc": {
70
+ "exclude": [
71
+ "test"
72
+ ]
73
+ },
74
+ "module": "dist/async.mjs"
75
+ }
@@ -0,0 +1,180 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = parallel;
7
+
8
+ var _eachOf = require('./eachOf.js');
9
+
10
+ var _eachOf2 = _interopRequireDefault(_eachOf);
11
+
12
+ var _parallel2 = require('./internal/parallel.js');
13
+
14
+ var _parallel3 = _interopRequireDefault(_parallel2);
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ /**
19
+ * Run the `tasks` collection of functions in parallel, without waiting until
20
+ * the previous function has completed. If any of the functions pass an error to
21
+ * its callback, the main `callback` is immediately called with the value of the
22
+ * error. Once the `tasks` have completed, the results are passed to the final
23
+ * `callback` as an array.
24
+ *
25
+ * **Note:** `parallel` is about kicking-off I/O tasks in parallel, not about
26
+ * parallel execution of code. If your tasks do not use any timers or perform
27
+ * any I/O, they will actually be executed in series. Any synchronous setup
28
+ * sections for each task will happen one after the other. JavaScript remains
29
+ * single-threaded.
30
+ *
31
+ * **Hint:** Use [`reflect`]{@link module:Utils.reflect} to continue the
32
+ * execution of other tasks when a task fails.
33
+ *
34
+ * It is also possible to use an object instead of an array. Each property will
35
+ * be run as a function and the results will be passed to the final `callback`
36
+ * as an object instead of an array. This can be a more readable way of handling
37
+ * results from {@link async.parallel}.
38
+ *
39
+ * @name parallel
40
+ * @static
41
+ * @memberOf module:ControlFlow
42
+ * @method
43
+ * @category Control Flow
44
+ * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection of
45
+ * [async functions]{@link AsyncFunction} to run.
46
+ * Each async 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 successfully. This function gets a results array
49
+ * (or object) containing all the result arguments passed to the task callbacks.
50
+ * Invoked with (err, results).
51
+ * @returns {Promise} a promise, if a callback is not passed
52
+ *
53
+ * @example
54
+ *
55
+ * //Using Callbacks
56
+ * async.parallel([
57
+ * function(callback) {
58
+ * setTimeout(function() {
59
+ * callback(null, 'one');
60
+ * }, 200);
61
+ * },
62
+ * function(callback) {
63
+ * setTimeout(function() {
64
+ * callback(null, 'two');
65
+ * }, 100);
66
+ * }
67
+ * ], function(err, results) {
68
+ * console.log(results);
69
+ * // results is equal to ['one','two'] even though
70
+ * // the second function had a shorter timeout.
71
+ * });
72
+ *
73
+ * // an example using an object instead of an array
74
+ * async.parallel({
75
+ * one: function(callback) {
76
+ * setTimeout(function() {
77
+ * callback(null, 1);
78
+ * }, 200);
79
+ * },
80
+ * two: function(callback) {
81
+ * setTimeout(function() {
82
+ * callback(null, 2);
83
+ * }, 100);
84
+ * }
85
+ * }, function(err, results) {
86
+ * console.log(results);
87
+ * // results is equal to: { one: 1, two: 2 }
88
+ * });
89
+ *
90
+ * //Using Promises
91
+ * async.parallel([
92
+ * function(callback) {
93
+ * setTimeout(function() {
94
+ * callback(null, 'one');
95
+ * }, 200);
96
+ * },
97
+ * function(callback) {
98
+ * setTimeout(function() {
99
+ * callback(null, 'two');
100
+ * }, 100);
101
+ * }
102
+ * ]).then(results => {
103
+ * console.log(results);
104
+ * // results is equal to ['one','two'] even though
105
+ * // the second function had a shorter timeout.
106
+ * }).catch(err => {
107
+ * console.log(err);
108
+ * });
109
+ *
110
+ * // an example using an object instead of an array
111
+ * async.parallel({
112
+ * one: function(callback) {
113
+ * setTimeout(function() {
114
+ * callback(null, 1);
115
+ * }, 200);
116
+ * },
117
+ * two: function(callback) {
118
+ * setTimeout(function() {
119
+ * callback(null, 2);
120
+ * }, 100);
121
+ * }
122
+ * }).then(results => {
123
+ * console.log(results);
124
+ * // results is equal to: { one: 1, two: 2 }
125
+ * }).catch(err => {
126
+ * console.log(err);
127
+ * });
128
+ *
129
+ * //Using async/await
130
+ * async () => {
131
+ * try {
132
+ * let results = await async.parallel([
133
+ * function(callback) {
134
+ * setTimeout(function() {
135
+ * callback(null, 'one');
136
+ * }, 200);
137
+ * },
138
+ * function(callback) {
139
+ * setTimeout(function() {
140
+ * callback(null, 'two');
141
+ * }, 100);
142
+ * }
143
+ * ]);
144
+ * console.log(results);
145
+ * // results is equal to ['one','two'] even though
146
+ * // the second function had a shorter timeout.
147
+ * }
148
+ * catch (err) {
149
+ * console.log(err);
150
+ * }
151
+ * }
152
+ *
153
+ * // an example using an object instead of an array
154
+ * async () => {
155
+ * try {
156
+ * let results = await async.parallel({
157
+ * one: function(callback) {
158
+ * setTimeout(function() {
159
+ * callback(null, 1);
160
+ * }, 200);
161
+ * },
162
+ * two: function(callback) {
163
+ * setTimeout(function() {
164
+ * callback(null, 2);
165
+ * }, 100);
166
+ * }
167
+ * });
168
+ * console.log(results);
169
+ * // results is equal to: { one: 1, two: 2 }
170
+ * }
171
+ * catch (err) {
172
+ * console.log(err);
173
+ * }
174
+ * }
175
+ *
176
+ */
177
+ function parallel(tasks, callback) {
178
+ return (0, _parallel3.default)(_eachOf2.default, tasks, callback);
179
+ }
180
+ module.exports = exports.default;
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = parallelLimit;
7
+
8
+ var _eachOfLimit = require('./internal/eachOfLimit.js');
9
+
10
+ var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
11
+
12
+ var _parallel = require('./internal/parallel.js');
13
+
14
+ var _parallel2 = _interopRequireDefault(_parallel);
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ /**
19
+ * The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async operations at a
20
+ * time.
21
+ *
22
+ * @name parallelLimit
23
+ * @static
24
+ * @memberOf module:ControlFlow
25
+ * @method
26
+ * @see [async.parallel]{@link module:ControlFlow.parallel}
27
+ * @category Control Flow
28
+ * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection of
29
+ * [async functions]{@link AsyncFunction} to run.
30
+ * Each async function can complete with any number of optional `result` values.
31
+ * @param {number} limit - The maximum number of async operations at a time.
32
+ * @param {Function} [callback] - An optional callback to run once all the
33
+ * functions have completed successfully. This function gets a results array
34
+ * (or object) containing all the result arguments passed to the task callbacks.
35
+ * Invoked with (err, results).
36
+ * @returns {Promise} a promise, if a callback is not passed
37
+ */
38
+ function parallelLimit(tasks, limit, callback) {
39
+ return (0, _parallel2.default)((0, _eachOfLimit2.default)(limit), tasks, callback);
40
+ }
41
+ module.exports = exports.default;
@@ -0,0 +1,60 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ exports.default = function (worker, concurrency) {
8
+ // Start with a normal queue
9
+ var q = (0, _queue2.default)(worker, concurrency);
10
+
11
+ var {
12
+ push,
13
+ pushAsync
14
+ } = q;
15
+
16
+ q._tasks = new _Heap2.default();
17
+ q._createTaskItem = ({ data, priority }, callback) => {
18
+ return {
19
+ data,
20
+ priority,
21
+ callback
22
+ };
23
+ };
24
+
25
+ function createDataItems(tasks, priority) {
26
+ if (!Array.isArray(tasks)) {
27
+ return { data: tasks, priority };
28
+ }
29
+ return tasks.map(data => {
30
+ return { data, priority };
31
+ });
32
+ }
33
+
34
+ // Override push to accept second parameter representing priority
35
+ q.push = function (data, priority = 0, callback) {
36
+ return push(createDataItems(data, priority), callback);
37
+ };
38
+
39
+ q.pushAsync = function (data, priority = 0, callback) {
40
+ return pushAsync(createDataItems(data, priority), callback);
41
+ };
42
+
43
+ // Remove unshift functions
44
+ delete q.unshift;
45
+ delete q.unshiftAsync;
46
+
47
+ return q;
48
+ };
49
+
50
+ var _queue = require('./queue.js');
51
+
52
+ var _queue2 = _interopRequireDefault(_queue);
53
+
54
+ var _Heap = require('./internal/Heap.js');
55
+
56
+ var _Heap2 = _interopRequireDefault(_Heap);
57
+
58
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
59
+
60
+ module.exports = exports.default;
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ exports.default = function (worker, concurrency) {
8
+ var _worker = (0, _wrapAsync2.default)(worker);
9
+ return (0, _queue2.default)((items, cb) => {
10
+ _worker(items[0], cb);
11
+ }, concurrency, 1);
12
+ };
13
+
14
+ var _queue = require('./internal/queue.js');
15
+
16
+ var _queue2 = _interopRequireDefault(_queue);
17
+
18
+ var _wrapAsync = require('./internal/wrapAsync.js');
19
+
20
+ var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+
24
+ module.exports = exports.default;
@@ -0,0 +1,67 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _once = require('./internal/once.js');
8
+
9
+ var _once2 = _interopRequireDefault(_once);
10
+
11
+ var _wrapAsync = require('./internal/wrapAsync.js');
12
+
13
+ var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
14
+
15
+ var _awaitify = require('./internal/awaitify.js');
16
+
17
+ var _awaitify2 = _interopRequireDefault(_awaitify);
18
+
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+
21
+ /**
22
+ * Runs the `tasks` array of functions in parallel, without waiting until the
23
+ * previous function has completed. Once any of the `tasks` complete or pass an
24
+ * error to its callback, the main `callback` is immediately called. It's
25
+ * equivalent to `Promise.race()`.
26
+ *
27
+ * @name race
28
+ * @static
29
+ * @memberOf module:ControlFlow
30
+ * @method
31
+ * @category Control Flow
32
+ * @param {Array} tasks - An array containing [async functions]{@link AsyncFunction}
33
+ * to run. Each function can complete with an optional `result` value.
34
+ * @param {Function} callback - A callback to run once any of the functions have
35
+ * completed. This function gets an error or result from the first function that
36
+ * completed. Invoked with (err, result).
37
+ * @returns {Promise} a promise, if a callback is omitted
38
+ * @example
39
+ *
40
+ * async.race([
41
+ * function(callback) {
42
+ * setTimeout(function() {
43
+ * callback(null, 'one');
44
+ * }, 200);
45
+ * },
46
+ * function(callback) {
47
+ * setTimeout(function() {
48
+ * callback(null, 'two');
49
+ * }, 100);
50
+ * }
51
+ * ],
52
+ * // main callback
53
+ * function(err, result) {
54
+ * // the result will be equal to 'two' as it finishes earlier
55
+ * });
56
+ */
57
+ function race(tasks, callback) {
58
+ callback = (0, _once2.default)(callback);
59
+ if (!Array.isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions'));
60
+ if (!tasks.length) return callback();
61
+ for (var i = 0, l = tasks.length; i < l; i++) {
62
+ (0, _wrapAsync2.default)(tasks[i])(callback);
63
+ }
64
+ }
65
+
66
+ exports.default = (0, _awaitify2.default)(race, 2);
67
+ module.exports = exports.default;
@@ -0,0 +1,153 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _eachOfSeries = require('./eachOfSeries.js');
8
+
9
+ var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
10
+
11
+ var _once = require('./internal/once.js');
12
+
13
+ var _once2 = _interopRequireDefault(_once);
14
+
15
+ var _wrapAsync = require('./internal/wrapAsync.js');
16
+
17
+ var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
18
+
19
+ var _awaitify = require('./internal/awaitify.js');
20
+
21
+ var _awaitify2 = _interopRequireDefault(_awaitify);
22
+
23
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
+
25
+ /**
26
+ * Reduces `coll` into a single value using an async `iteratee` to return each
27
+ * successive step. `memo` is the initial state of the reduction. This function
28
+ * only operates in series.
29
+ *
30
+ * For performance reasons, it may make sense to split a call to this function
31
+ * into a parallel map, and then use the normal `Array.prototype.reduce` on the
32
+ * results. This function is for situations where each step in the reduction
33
+ * needs to be async; if you can get the data before reducing it, then it's
34
+ * probably a good idea to do so.
35
+ *
36
+ * @name reduce
37
+ * @static
38
+ * @memberOf module:Collections
39
+ * @method
40
+ * @alias inject
41
+ * @alias foldl
42
+ * @category Collection
43
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
44
+ * @param {*} memo - The initial state of the reduction.
45
+ * @param {AsyncFunction} iteratee - A function applied to each item in the
46
+ * array to produce the next step in the reduction.
47
+ * The `iteratee` should complete with the next state of the reduction.
48
+ * If the iteratee completes with an error, the reduction is stopped and the
49
+ * main `callback` is immediately called with the error.
50
+ * Invoked with (memo, item, callback).
51
+ * @param {Function} [callback] - A callback which is called after all the
52
+ * `iteratee` functions have finished. Result is the reduced value. Invoked with
53
+ * (err, result).
54
+ * @returns {Promise} a promise, if no callback is passed
55
+ * @example
56
+ *
57
+ * // file1.txt is a file that is 1000 bytes in size
58
+ * // file2.txt is a file that is 2000 bytes in size
59
+ * // file3.txt is a file that is 3000 bytes in size
60
+ * // file4.txt does not exist
61
+ *
62
+ * const fileList = ['file1.txt','file2.txt','file3.txt'];
63
+ * const withMissingFileList = ['file1.txt','file2.txt','file3.txt', 'file4.txt'];
64
+ *
65
+ * // asynchronous function that computes the file size in bytes
66
+ * // file size is added to the memoized value, then returned
67
+ * function getFileSizeInBytes(memo, file, callback) {
68
+ * fs.stat(file, function(err, stat) {
69
+ * if (err) {
70
+ * return callback(err);
71
+ * }
72
+ * callback(null, memo + stat.size);
73
+ * });
74
+ * }
75
+ *
76
+ * // Using callbacks
77
+ * async.reduce(fileList, 0, getFileSizeInBytes, function(err, result) {
78
+ * if (err) {
79
+ * console.log(err);
80
+ * } else {
81
+ * console.log(result);
82
+ * // 6000
83
+ * // which is the sum of the file sizes of the three files
84
+ * }
85
+ * });
86
+ *
87
+ * // Error Handling
88
+ * async.reduce(withMissingFileList, 0, getFileSizeInBytes, function(err, result) {
89
+ * if (err) {
90
+ * console.log(err);
91
+ * // [ Error: ENOENT: no such file or directory ]
92
+ * } else {
93
+ * console.log(result);
94
+ * }
95
+ * });
96
+ *
97
+ * // Using Promises
98
+ * async.reduce(fileList, 0, getFileSizeInBytes)
99
+ * .then( result => {
100
+ * console.log(result);
101
+ * // 6000
102
+ * // which is the sum of the file sizes of the three files
103
+ * }).catch( err => {
104
+ * console.log(err);
105
+ * });
106
+ *
107
+ * // Error Handling
108
+ * async.reduce(withMissingFileList, 0, getFileSizeInBytes)
109
+ * .then( result => {
110
+ * console.log(result);
111
+ * }).catch( err => {
112
+ * console.log(err);
113
+ * // [ Error: ENOENT: no such file or directory ]
114
+ * });
115
+ *
116
+ * // Using async/await
117
+ * async () => {
118
+ * try {
119
+ * let result = await async.reduce(fileList, 0, getFileSizeInBytes);
120
+ * console.log(result);
121
+ * // 6000
122
+ * // which is the sum of the file sizes of the three files
123
+ * }
124
+ * catch (err) {
125
+ * console.log(err);
126
+ * }
127
+ * }
128
+ *
129
+ * // Error Handling
130
+ * async () => {
131
+ * try {
132
+ * let result = await async.reduce(withMissingFileList, 0, getFileSizeInBytes);
133
+ * console.log(result);
134
+ * }
135
+ * catch (err) {
136
+ * console.log(err);
137
+ * // [ Error: ENOENT: no such file or directory ]
138
+ * }
139
+ * }
140
+ *
141
+ */
142
+ function reduce(coll, memo, iteratee, callback) {
143
+ callback = (0, _once2.default)(callback);
144
+ var _iteratee = (0, _wrapAsync2.default)(iteratee);
145
+ return (0, _eachOfSeries2.default)(coll, (x, i, iterCb) => {
146
+ _iteratee(memo, x, (err, v) => {
147
+ memo = v;
148
+ iterCb(err);
149
+ });
150
+ }, err => callback(err, memo));
151
+ }
152
+ exports.default = (0, _awaitify2.default)(reduce, 4);
153
+ module.exports = exports.default;
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = reduceRight;
7
+
8
+ var _reduce = require('./reduce.js');
9
+
10
+ var _reduce2 = _interopRequireDefault(_reduce);
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ /**
15
+ * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order.
16
+ *
17
+ * @name reduceRight
18
+ * @static
19
+ * @memberOf module:Collections
20
+ * @method
21
+ * @see [async.reduce]{@link module:Collections.reduce}
22
+ * @alias foldr
23
+ * @category Collection
24
+ * @param {Array} array - A collection to iterate over.
25
+ * @param {*} memo - The initial state of the reduction.
26
+ * @param {AsyncFunction} iteratee - A function applied to each item in the
27
+ * array to produce the next step in the reduction.
28
+ * The `iteratee` should complete with the next state of the reduction.
29
+ * If the iteratee completes with an error, the reduction is stopped and the
30
+ * main `callback` is immediately called with the error.
31
+ * Invoked with (memo, item, callback).
32
+ * @param {Function} [callback] - A callback which is called after all the
33
+ * `iteratee` functions have finished. Result is the reduced value. Invoked with
34
+ * (err, result).
35
+ * @returns {Promise} a promise, if no callback is passed
36
+ */
37
+ function reduceRight(array, memo, iteratee, callback) {
38
+ var reversed = [...array].reverse();
39
+ return (0, _reduce2.default)(reversed, memo, iteratee, callback);
40
+ }
41
+ module.exports = exports.default;