taskchef 3.0.0 → 3.0.2

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 (39) hide show
  1. package/.codex-plugin/plugin.json +1 -1
  2. package/node_modules/graceful-fs/LICENSE +15 -0
  3. package/node_modules/graceful-fs/README.md +143 -0
  4. package/node_modules/graceful-fs/clone.js +23 -0
  5. package/node_modules/graceful-fs/graceful-fs.js +448 -0
  6. package/node_modules/graceful-fs/legacy-streams.js +118 -0
  7. package/node_modules/graceful-fs/package.json +53 -0
  8. package/node_modules/graceful-fs/polyfills.js +355 -0
  9. package/node_modules/proper-lockfile/CHANGELOG.md +108 -0
  10. package/node_modules/proper-lockfile/LICENSE +21 -0
  11. package/node_modules/proper-lockfile/README.md +183 -0
  12. package/node_modules/proper-lockfile/index.js +40 -0
  13. package/node_modules/proper-lockfile/lib/adapter.js +85 -0
  14. package/node_modules/proper-lockfile/lib/lockfile.js +342 -0
  15. package/node_modules/proper-lockfile/lib/mtime-precision.js +55 -0
  16. package/node_modules/proper-lockfile/package.json +71 -0
  17. package/node_modules/retry/.npmignore +3 -0
  18. package/node_modules/retry/.travis.yml +15 -0
  19. package/node_modules/retry/License +21 -0
  20. package/node_modules/retry/Makefile +18 -0
  21. package/node_modules/retry/README.md +227 -0
  22. package/node_modules/retry/equation.gif +0 -0
  23. package/node_modules/retry/example/dns.js +31 -0
  24. package/node_modules/retry/example/stop.js +40 -0
  25. package/node_modules/retry/index.js +1 -0
  26. package/node_modules/retry/lib/retry.js +100 -0
  27. package/node_modules/retry/lib/retry_operation.js +158 -0
  28. package/node_modules/retry/package.json +32 -0
  29. package/node_modules/retry/test/common.js +10 -0
  30. package/node_modules/retry/test/integration/test-forever.js +24 -0
  31. package/node_modules/retry/test/integration/test-retry-operation.js +258 -0
  32. package/node_modules/retry/test/integration/test-retry-wrap.js +101 -0
  33. package/node_modules/retry/test/integration/test-timeouts.js +69 -0
  34. package/node_modules/signal-exit/LICENSE.txt +16 -0
  35. package/node_modules/signal-exit/README.md +39 -0
  36. package/node_modules/signal-exit/index.js +202 -0
  37. package/node_modules/signal-exit/package.json +38 -0
  38. package/node_modules/signal-exit/signals.js +53 -0
  39. package/package.json +5 -2
@@ -0,0 +1,32 @@
1
+ {
2
+ "author": "Tim Koschützki <tim@debuggable.com> (http://debuggable.com/)",
3
+ "name": "retry",
4
+ "description": "Abstraction for exponential and custom retry strategies for failed operations.",
5
+ "license": "MIT",
6
+ "version": "0.12.0",
7
+ "homepage": "https://github.com/tim-kos/node-retry",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git://github.com/tim-kos/node-retry.git"
11
+ },
12
+ "directories": {
13
+ "lib": "./lib"
14
+ },
15
+ "main": "index",
16
+ "engines": {
17
+ "node": ">= 4"
18
+ },
19
+ "dependencies": {},
20
+ "devDependencies": {
21
+ "fake": "0.2.0",
22
+ "istanbul": "^0.4.5",
23
+ "tape": "^4.8.0"
24
+ },
25
+ "scripts": {
26
+ "test": "./node_modules/.bin/istanbul cover ./node_modules/tape/bin/tape ./test/integration/*.js",
27
+ "release:major": "env SEMANTIC=major npm run release",
28
+ "release:minor": "env SEMANTIC=minor npm run release",
29
+ "release:patch": "env SEMANTIC=patch npm run release",
30
+ "release": "npm version ${SEMANTIC:-patch} -m \"Release %s\" && git push && git push --tags && npm publish"
31
+ }
32
+ }
@@ -0,0 +1,10 @@
1
+ var common = module.exports;
2
+ var path = require('path');
3
+
4
+ var rootDir = path.join(__dirname, '..');
5
+ common.dir = {
6
+ lib: rootDir + '/lib'
7
+ };
8
+
9
+ common.assert = require('assert');
10
+ common.fake = require('fake');
@@ -0,0 +1,24 @@
1
+ var common = require('../common');
2
+ var assert = common.assert;
3
+ var retry = require(common.dir.lib + '/retry');
4
+
5
+ (function testForeverUsesFirstTimeout() {
6
+ var operation = retry.operation({
7
+ retries: 0,
8
+ minTimeout: 100,
9
+ maxTimeout: 100,
10
+ forever: true
11
+ });
12
+
13
+ operation.attempt(function(numAttempt) {
14
+ console.log('>numAttempt', numAttempt);
15
+ var err = new Error("foo");
16
+ if (numAttempt == 10) {
17
+ operation.stop();
18
+ }
19
+
20
+ if (operation.retry(err)) {
21
+ return;
22
+ }
23
+ });
24
+ })();
@@ -0,0 +1,258 @@
1
+ var common = require('../common');
2
+ var assert = common.assert;
3
+ var fake = common.fake.create();
4
+ var retry = require(common.dir.lib + '/retry');
5
+
6
+ (function testReset() {
7
+ var error = new Error('some error');
8
+ var operation = retry.operation([1, 2, 3]);
9
+ var attempts = 0;
10
+
11
+ var finalCallback = fake.callback('finalCallback');
12
+ fake.expectAnytime(finalCallback);
13
+
14
+ var expectedFinishes = 1;
15
+ var finishes = 0;
16
+
17
+ var fn = function() {
18
+ operation.attempt(function(currentAttempt) {
19
+ attempts++;
20
+ assert.equal(currentAttempt, attempts);
21
+ if (operation.retry(error)) {
22
+ return;
23
+ }
24
+
25
+ finishes++
26
+ assert.equal(expectedFinishes, finishes);
27
+ assert.strictEqual(attempts, 4);
28
+ assert.strictEqual(operation.attempts(), attempts);
29
+ assert.strictEqual(operation.mainError(), error);
30
+
31
+ if (finishes < 2) {
32
+ attempts = 0;
33
+ expectedFinishes++;
34
+ operation.reset();
35
+ fn()
36
+ } else {
37
+ finalCallback();
38
+ }
39
+ });
40
+ };
41
+
42
+ fn();
43
+ })();
44
+
45
+ (function testErrors() {
46
+ var operation = retry.operation();
47
+
48
+ var error = new Error('some error');
49
+ var error2 = new Error('some other error');
50
+ operation._errors.push(error);
51
+ operation._errors.push(error2);
52
+
53
+ assert.deepEqual(operation.errors(), [error, error2]);
54
+ })();
55
+
56
+ (function testMainErrorReturnsMostFrequentError() {
57
+ var operation = retry.operation();
58
+ var error = new Error('some error');
59
+ var error2 = new Error('some other error');
60
+
61
+ operation._errors.push(error);
62
+ operation._errors.push(error2);
63
+ operation._errors.push(error);
64
+
65
+ assert.strictEqual(operation.mainError(), error);
66
+ })();
67
+
68
+ (function testMainErrorReturnsLastErrorOnEqualCount() {
69
+ var operation = retry.operation();
70
+ var error = new Error('some error');
71
+ var error2 = new Error('some other error');
72
+
73
+ operation._errors.push(error);
74
+ operation._errors.push(error2);
75
+
76
+ assert.strictEqual(operation.mainError(), error2);
77
+ })();
78
+
79
+ (function testAttempt() {
80
+ var operation = retry.operation();
81
+ var fn = new Function();
82
+
83
+ var timeoutOpts = {
84
+ timeout: 1,
85
+ cb: function() {}
86
+ };
87
+ operation.attempt(fn, timeoutOpts);
88
+
89
+ assert.strictEqual(fn, operation._fn);
90
+ assert.strictEqual(timeoutOpts.timeout, operation._operationTimeout);
91
+ assert.strictEqual(timeoutOpts.cb, operation._operationTimeoutCb);
92
+ })();
93
+
94
+ (function testRetry() {
95
+ var error = new Error('some error');
96
+ var operation = retry.operation([1, 2, 3]);
97
+ var attempts = 0;
98
+
99
+ var finalCallback = fake.callback('finalCallback');
100
+ fake.expectAnytime(finalCallback);
101
+
102
+ var fn = function() {
103
+ operation.attempt(function(currentAttempt) {
104
+ attempts++;
105
+ assert.equal(currentAttempt, attempts);
106
+ if (operation.retry(error)) {
107
+ return;
108
+ }
109
+
110
+ assert.strictEqual(attempts, 4);
111
+ assert.strictEqual(operation.attempts(), attempts);
112
+ assert.strictEqual(operation.mainError(), error);
113
+ finalCallback();
114
+ });
115
+ };
116
+
117
+ fn();
118
+ })();
119
+
120
+ (function testRetryForever() {
121
+ var error = new Error('some error');
122
+ var operation = retry.operation({ retries: 3, forever: true });
123
+ var attempts = 0;
124
+
125
+ var finalCallback = fake.callback('finalCallback');
126
+ fake.expectAnytime(finalCallback);
127
+
128
+ var fn = function() {
129
+ operation.attempt(function(currentAttempt) {
130
+ attempts++;
131
+ assert.equal(currentAttempt, attempts);
132
+ if (attempts !== 6 && operation.retry(error)) {
133
+ return;
134
+ }
135
+
136
+ assert.strictEqual(attempts, 6);
137
+ assert.strictEqual(operation.attempts(), attempts);
138
+ assert.strictEqual(operation.mainError(), error);
139
+ finalCallback();
140
+ });
141
+ };
142
+
143
+ fn();
144
+ })();
145
+
146
+ (function testRetryForeverNoRetries() {
147
+ var error = new Error('some error');
148
+ var delay = 50
149
+ var operation = retry.operation({
150
+ retries: null,
151
+ forever: true,
152
+ minTimeout: delay,
153
+ maxTimeout: delay
154
+ });
155
+
156
+ var attempts = 0;
157
+ var startTime = new Date().getTime();
158
+
159
+ var finalCallback = fake.callback('finalCallback');
160
+ fake.expectAnytime(finalCallback);
161
+
162
+ var fn = function() {
163
+ operation.attempt(function(currentAttempt) {
164
+ attempts++;
165
+ assert.equal(currentAttempt, attempts);
166
+ if (attempts !== 4 && operation.retry(error)) {
167
+ return;
168
+ }
169
+
170
+ var endTime = new Date().getTime();
171
+ var minTime = startTime + (delay * 3);
172
+ var maxTime = minTime + 20 // add a little headroom for code execution time
173
+ assert(endTime >= minTime)
174
+ assert(endTime < maxTime)
175
+ assert.strictEqual(attempts, 4);
176
+ assert.strictEqual(operation.attempts(), attempts);
177
+ assert.strictEqual(operation.mainError(), error);
178
+ finalCallback();
179
+ });
180
+ };
181
+
182
+ fn();
183
+ })();
184
+
185
+ (function testStop() {
186
+ var error = new Error('some error');
187
+ var operation = retry.operation([1, 2, 3]);
188
+ var attempts = 0;
189
+
190
+ var finalCallback = fake.callback('finalCallback');
191
+ fake.expectAnytime(finalCallback);
192
+
193
+ var fn = function() {
194
+ operation.attempt(function(currentAttempt) {
195
+ attempts++;
196
+ assert.equal(currentAttempt, attempts);
197
+
198
+ if (attempts === 2) {
199
+ operation.stop();
200
+
201
+ assert.strictEqual(attempts, 2);
202
+ assert.strictEqual(operation.attempts(), attempts);
203
+ assert.strictEqual(operation.mainError(), error);
204
+ finalCallback();
205
+ }
206
+
207
+ if (operation.retry(error)) {
208
+ return;
209
+ }
210
+ });
211
+ };
212
+
213
+ fn();
214
+ })();
215
+
216
+ (function testMaxRetryTime() {
217
+ var error = new Error('some error');
218
+ var maxRetryTime = 30;
219
+ var operation = retry.operation({
220
+ minTimeout: 1,
221
+ maxRetryTime: maxRetryTime
222
+ });
223
+ var attempts = 0;
224
+
225
+ var finalCallback = fake.callback('finalCallback');
226
+ fake.expectAnytime(finalCallback);
227
+
228
+ var longAsyncFunction = function (wait, callback){
229
+ setTimeout(callback, wait);
230
+ };
231
+
232
+ var fn = function() {
233
+ var startTime = new Date().getTime();
234
+ operation.attempt(function(currentAttempt) {
235
+ attempts++;
236
+ assert.equal(currentAttempt, attempts);
237
+
238
+ if (attempts !== 2) {
239
+ if (operation.retry(error)) {
240
+ return;
241
+ }
242
+ } else {
243
+ var curTime = new Date().getTime();
244
+ longAsyncFunction(maxRetryTime - (curTime - startTime - 1), function(){
245
+ if (operation.retry(error)) {
246
+ assert.fail('timeout should be occurred');
247
+ return;
248
+ }
249
+
250
+ assert.strictEqual(operation.mainError(), error);
251
+ finalCallback();
252
+ });
253
+ }
254
+ });
255
+ };
256
+
257
+ fn();
258
+ })();
@@ -0,0 +1,101 @@
1
+ var common = require('../common');
2
+ var assert = common.assert;
3
+ var fake = common.fake.create();
4
+ var retry = require(common.dir.lib + '/retry');
5
+
6
+ function getLib() {
7
+ return {
8
+ fn1: function() {},
9
+ fn2: function() {},
10
+ fn3: function() {}
11
+ };
12
+ }
13
+
14
+ (function wrapAll() {
15
+ var lib = getLib();
16
+ retry.wrap(lib);
17
+ assert.equal(lib.fn1.name, 'bound retryWrapper');
18
+ assert.equal(lib.fn2.name, 'bound retryWrapper');
19
+ assert.equal(lib.fn3.name, 'bound retryWrapper');
20
+ }());
21
+
22
+ (function wrapAllPassOptions() {
23
+ var lib = getLib();
24
+ retry.wrap(lib, {retries: 2});
25
+ assert.equal(lib.fn1.name, 'bound retryWrapper');
26
+ assert.equal(lib.fn2.name, 'bound retryWrapper');
27
+ assert.equal(lib.fn3.name, 'bound retryWrapper');
28
+ assert.equal(lib.fn1.options.retries, 2);
29
+ assert.equal(lib.fn2.options.retries, 2);
30
+ assert.equal(lib.fn3.options.retries, 2);
31
+ }());
32
+
33
+ (function wrapDefined() {
34
+ var lib = getLib();
35
+ retry.wrap(lib, ['fn2', 'fn3']);
36
+ assert.notEqual(lib.fn1.name, 'bound retryWrapper');
37
+ assert.equal(lib.fn2.name, 'bound retryWrapper');
38
+ assert.equal(lib.fn3.name, 'bound retryWrapper');
39
+ }());
40
+
41
+ (function wrapDefinedAndPassOptions() {
42
+ var lib = getLib();
43
+ retry.wrap(lib, {retries: 2}, ['fn2', 'fn3']);
44
+ assert.notEqual(lib.fn1.name, 'bound retryWrapper');
45
+ assert.equal(lib.fn2.name, 'bound retryWrapper');
46
+ assert.equal(lib.fn3.name, 'bound retryWrapper');
47
+ assert.equal(lib.fn2.options.retries, 2);
48
+ assert.equal(lib.fn3.options.retries, 2);
49
+ }());
50
+
51
+ (function runWrappedWithoutError() {
52
+ var callbackCalled;
53
+ var lib = {method: function(a, b, callback) {
54
+ assert.equal(a, 1);
55
+ assert.equal(b, 2);
56
+ assert.equal(typeof callback, 'function');
57
+ callback();
58
+ }};
59
+ retry.wrap(lib);
60
+ lib.method(1, 2, function() {
61
+ callbackCalled = true;
62
+ });
63
+ assert.ok(callbackCalled);
64
+ }());
65
+
66
+ (function runWrappedSeveralWithoutError() {
67
+ var callbacksCalled = 0;
68
+ var lib = {
69
+ fn1: function (a, callback) {
70
+ assert.equal(a, 1);
71
+ assert.equal(typeof callback, 'function');
72
+ callback();
73
+ },
74
+ fn2: function (a, callback) {
75
+ assert.equal(a, 2);
76
+ assert.equal(typeof callback, 'function');
77
+ callback();
78
+ }
79
+ };
80
+ retry.wrap(lib, {}, ['fn1', 'fn2']);
81
+ lib.fn1(1, function() {
82
+ callbacksCalled++;
83
+ });
84
+ lib.fn2(2, function() {
85
+ callbacksCalled++;
86
+ });
87
+ assert.equal(callbacksCalled, 2);
88
+ }());
89
+
90
+ (function runWrappedWithError() {
91
+ var callbackCalled;
92
+ var lib = {method: function(callback) {
93
+ callback(new Error('Some error'));
94
+ }};
95
+ retry.wrap(lib, {retries: 1});
96
+ lib.method(function(err) {
97
+ callbackCalled = true;
98
+ assert.ok(err instanceof Error);
99
+ });
100
+ assert.ok(!callbackCalled);
101
+ }());
@@ -0,0 +1,69 @@
1
+ var common = require('../common');
2
+ var assert = common.assert;
3
+ var retry = require(common.dir.lib + '/retry');
4
+
5
+ (function testDefaultValues() {
6
+ var timeouts = retry.timeouts();
7
+
8
+ assert.equal(timeouts.length, 10);
9
+ assert.equal(timeouts[0], 1000);
10
+ assert.equal(timeouts[1], 2000);
11
+ assert.equal(timeouts[2], 4000);
12
+ })();
13
+
14
+ (function testDefaultValuesWithRandomize() {
15
+ var minTimeout = 5000;
16
+ var timeouts = retry.timeouts({
17
+ minTimeout: minTimeout,
18
+ randomize: true
19
+ });
20
+
21
+ assert.equal(timeouts.length, 10);
22
+ assert.ok(timeouts[0] > minTimeout);
23
+ assert.ok(timeouts[1] > timeouts[0]);
24
+ assert.ok(timeouts[2] > timeouts[1]);
25
+ })();
26
+
27
+ (function testPassedTimeoutsAreUsed() {
28
+ var timeoutsArray = [1000, 2000, 3000];
29
+ var timeouts = retry.timeouts(timeoutsArray);
30
+ assert.deepEqual(timeouts, timeoutsArray);
31
+ assert.notStrictEqual(timeouts, timeoutsArray);
32
+ })();
33
+
34
+ (function testTimeoutsAreWithinBoundaries() {
35
+ var minTimeout = 1000;
36
+ var maxTimeout = 10000;
37
+ var timeouts = retry.timeouts({
38
+ minTimeout: minTimeout,
39
+ maxTimeout: maxTimeout
40
+ });
41
+ for (var i = 0; i < timeouts; i++) {
42
+ assert.ok(timeouts[i] >= minTimeout);
43
+ assert.ok(timeouts[i] <= maxTimeout);
44
+ }
45
+ })();
46
+
47
+ (function testTimeoutsAreIncremental() {
48
+ var timeouts = retry.timeouts();
49
+ var lastTimeout = timeouts[0];
50
+ for (var i = 0; i < timeouts; i++) {
51
+ assert.ok(timeouts[i] > lastTimeout);
52
+ lastTimeout = timeouts[i];
53
+ }
54
+ })();
55
+
56
+ (function testTimeoutsAreIncrementalForFactorsLessThanOne() {
57
+ var timeouts = retry.timeouts({
58
+ retries: 3,
59
+ factor: 0.5
60
+ });
61
+
62
+ var expected = [250, 500, 1000];
63
+ assert.deepEqual(expected, timeouts);
64
+ })();
65
+
66
+ (function testRetries() {
67
+ var timeouts = retry.timeouts({retries: 2});
68
+ assert.strictEqual(timeouts.length, 2);
69
+ })();
@@ -0,0 +1,16 @@
1
+ The ISC License
2
+
3
+ Copyright (c) 2015, Contributors
4
+
5
+ Permission to use, copy, modify, and/or distribute this software
6
+ for any purpose with or without fee is hereby granted, provided
7
+ that the above copyright notice and this permission notice
8
+ appear in all copies.
9
+
10
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
12
+ OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
13
+ LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
14
+ OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
15
+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
16
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,39 @@
1
+ # signal-exit
2
+
3
+ [![Build Status](https://travis-ci.org/tapjs/signal-exit.png)](https://travis-ci.org/tapjs/signal-exit)
4
+ [![Coverage](https://coveralls.io/repos/tapjs/signal-exit/badge.svg?branch=master)](https://coveralls.io/r/tapjs/signal-exit?branch=master)
5
+ [![NPM version](https://img.shields.io/npm/v/signal-exit.svg)](https://www.npmjs.com/package/signal-exit)
6
+ [![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
7
+
8
+ When you want to fire an event no matter how a process exits:
9
+
10
+ * reaching the end of execution.
11
+ * explicitly having `process.exit(code)` called.
12
+ * having `process.kill(pid, sig)` called.
13
+ * receiving a fatal signal from outside the process
14
+
15
+ Use `signal-exit`.
16
+
17
+ ```js
18
+ var onExit = require('signal-exit')
19
+
20
+ onExit(function (code, signal) {
21
+ console.log('process exited!')
22
+ })
23
+ ```
24
+
25
+ ## API
26
+
27
+ `var remove = onExit(function (code, signal) {}, options)`
28
+
29
+ The return value of the function is a function that will remove the
30
+ handler.
31
+
32
+ Note that the function *only* fires for signals if the signal would
33
+ cause the process to exit. That is, there are no other listeners, and
34
+ it is a fatal signal.
35
+
36
+ ## Options
37
+
38
+ * `alwaysLast`: Run this handler after any other signal or exit
39
+ handlers. This causes `process.emit` to be monkeypatched.