@chainlink/external-adapter-framework 2.11.0 → 2.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/index.js +1 -1
- package/generator-adapter/node_modules/.yarn-integrity +8 -8
- package/generator-adapter/node_modules/@types/node/README.md +1 -1
- package/generator-adapter/node_modules/@types/node/package.json +2 -2
- package/generator-adapter/node_modules/@types/node/process.d.ts +7 -0
- package/generator-adapter/node_modules/@yeoman/adapter/dist/queued-adapter.js +1 -3
- package/generator-adapter/node_modules/@yeoman/adapter/dist/queued-adapter.js.map +1 -1
- package/generator-adapter/node_modules/@yeoman/adapter/package.json +3 -3
- package/generator-adapter/node_modules/@yeoman/types/package.json +3 -3
- package/generator-adapter/node_modules/p-queue/dist/index.d.ts +181 -11
- package/generator-adapter/node_modules/p-queue/dist/index.js +366 -45
- package/generator-adapter/node_modules/p-queue/dist/options copy.d.ts +121 -0
- package/generator-adapter/node_modules/p-queue/dist/options copy.js +1 -0
- package/generator-adapter/node_modules/p-queue/dist/options.d.ts +26 -7
- package/generator-adapter/node_modules/p-queue/dist/priority-queue.d.ts +1 -0
- package/generator-adapter/node_modules/p-queue/dist/priority-queue.js +12 -6
- package/generator-adapter/node_modules/p-queue/dist/queue.d.ts +1 -0
- package/generator-adapter/node_modules/p-queue/package.json +19 -27
- package/generator-adapter/node_modules/p-queue/readme.md +541 -19
- package/generator-adapter/node_modules/p-timeout/index.d.ts +2 -4
- package/generator-adapter/node_modules/p-timeout/index.js +23 -50
- package/generator-adapter/node_modules/p-timeout/package.json +11 -9
- package/generator-adapter/node_modules/p-timeout/readme.md +11 -9
- package/generator-adapter/package.json +3 -3
- package/package.json +6 -6
|
@@ -1,39 +1,13 @@
|
|
|
1
1
|
export class TimeoutError extends Error {
|
|
2
|
-
|
|
3
|
-
super(message);
|
|
4
|
-
this.name = 'TimeoutError';
|
|
5
|
-
}
|
|
6
|
-
}
|
|
2
|
+
name = 'TimeoutError';
|
|
7
3
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
export class AbortError extends Error {
|
|
13
|
-
constructor(message) {
|
|
14
|
-
super();
|
|
15
|
-
this.name = 'AbortError';
|
|
16
|
-
this.message = message;
|
|
4
|
+
constructor(message, options) {
|
|
5
|
+
super(message, options);
|
|
6
|
+
Error.captureStackTrace?.(this, TimeoutError);
|
|
17
7
|
}
|
|
18
8
|
}
|
|
19
9
|
|
|
20
|
-
|
|
21
|
-
TODO: Remove AbortError and just throw DOMException when targeting Node 18.
|
|
22
|
-
*/
|
|
23
|
-
const getDOMException = errorMessage => globalThis.DOMException === undefined
|
|
24
|
-
? new AbortError(errorMessage)
|
|
25
|
-
: new DOMException(errorMessage);
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
TODO: Remove below function and just 'reject(signal.reason)' when targeting Node 18.
|
|
29
|
-
*/
|
|
30
|
-
const getAbortedReason = signal => {
|
|
31
|
-
const reason = signal.reason === undefined
|
|
32
|
-
? getDOMException('This operation was aborted.')
|
|
33
|
-
: signal.reason;
|
|
34
|
-
|
|
35
|
-
return reason instanceof Error ? reason : getDOMException(reason);
|
|
36
|
-
};
|
|
10
|
+
const getAbortedReason = signal => signal.reason ?? new DOMException('This operation was aborted.', 'AbortError');
|
|
37
11
|
|
|
38
12
|
export default function pTimeout(promise, options) {
|
|
39
13
|
const {
|
|
@@ -41,40 +15,42 @@ export default function pTimeout(promise, options) {
|
|
|
41
15
|
fallback,
|
|
42
16
|
message,
|
|
43
17
|
customTimers = {setTimeout, clearTimeout},
|
|
18
|
+
signal,
|
|
44
19
|
} = options;
|
|
45
20
|
|
|
46
21
|
let timer;
|
|
22
|
+
let abortHandler;
|
|
47
23
|
|
|
48
24
|
const wrappedPromise = new Promise((resolve, reject) => {
|
|
49
25
|
if (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {
|
|
50
26
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
|
|
51
27
|
}
|
|
52
28
|
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
29
|
+
if (signal?.aborted) {
|
|
30
|
+
reject(getAbortedReason(signal));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
58
33
|
|
|
59
|
-
|
|
34
|
+
if (signal) {
|
|
35
|
+
abortHandler = () => {
|
|
60
36
|
reject(getAbortedReason(signal));
|
|
61
37
|
};
|
|
62
38
|
|
|
63
39
|
signal.addEventListener('abort', abortHandler, {once: true});
|
|
64
|
-
|
|
65
|
-
promise.finally(() => {
|
|
66
|
-
signal.removeEventListener('abort', abortHandler);
|
|
67
|
-
});
|
|
68
40
|
}
|
|
69
41
|
|
|
42
|
+
// Use .then() instead of async IIFE to preserve stack traces
|
|
43
|
+
// eslint-disable-next-line promise/prefer-await-to-then, promise/prefer-catch
|
|
44
|
+
promise.then(resolve, reject);
|
|
45
|
+
|
|
70
46
|
if (milliseconds === Number.POSITIVE_INFINITY) {
|
|
71
|
-
promise.then(resolve, reject);
|
|
72
47
|
return;
|
|
73
48
|
}
|
|
74
49
|
|
|
75
50
|
// We create the error outside of `setTimeout` to preserve the stack trace.
|
|
76
51
|
const timeoutError = new TimeoutError();
|
|
77
52
|
|
|
53
|
+
// `.call(undefined, ...)` is needed for custom timers to avoid context issues
|
|
78
54
|
timer = customTimers.setTimeout.call(undefined, () => {
|
|
79
55
|
if (fallback) {
|
|
80
56
|
try {
|
|
@@ -99,21 +75,18 @@ export default function pTimeout(promise, options) {
|
|
|
99
75
|
reject(timeoutError);
|
|
100
76
|
}
|
|
101
77
|
}, milliseconds);
|
|
102
|
-
|
|
103
|
-
(async () => {
|
|
104
|
-
try {
|
|
105
|
-
resolve(await promise);
|
|
106
|
-
} catch (error) {
|
|
107
|
-
reject(error);
|
|
108
|
-
}
|
|
109
|
-
})();
|
|
110
78
|
});
|
|
111
79
|
|
|
80
|
+
// eslint-disable-next-line promise/prefer-await-to-then
|
|
112
81
|
const cancelablePromise = wrappedPromise.finally(() => {
|
|
113
82
|
cancelablePromise.clear();
|
|
83
|
+
if (abortHandler && signal) {
|
|
84
|
+
signal.removeEventListener('abort', abortHandler);
|
|
85
|
+
}
|
|
114
86
|
});
|
|
115
87
|
|
|
116
88
|
cancelablePromise.clear = () => {
|
|
89
|
+
// `.call(undefined, ...)` is needed for custom timers to avoid context issues
|
|
117
90
|
customTimers.clearTimeout.call(undefined, timer);
|
|
118
91
|
timer = undefined;
|
|
119
92
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "p-timeout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"description": "Timeout a promise after a specified amount of time",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "sindresorhus/p-timeout",
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
"url": "https://sindresorhus.com"
|
|
12
12
|
},
|
|
13
13
|
"type": "module",
|
|
14
|
-
"exports":
|
|
15
|
-
|
|
14
|
+
"exports": {
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"default": "./index.js"
|
|
17
|
+
},
|
|
16
18
|
"sideEffects": false,
|
|
17
19
|
"engines": {
|
|
18
|
-
"node": ">=
|
|
20
|
+
"node": ">=20"
|
|
19
21
|
},
|
|
20
22
|
"scripts": {
|
|
21
23
|
"test": "xo && ava && tsd"
|
|
@@ -38,13 +40,13 @@
|
|
|
38
40
|
"bluebird"
|
|
39
41
|
],
|
|
40
42
|
"devDependencies": {
|
|
41
|
-
"ava": "^4.
|
|
42
|
-
"delay": "^
|
|
43
|
+
"ava": "^6.4.1",
|
|
44
|
+
"delay": "^6.0.0",
|
|
43
45
|
"in-range": "^3.0.0",
|
|
44
46
|
"p-cancelable": "^4.0.1",
|
|
45
|
-
"sinon": "^
|
|
47
|
+
"sinon": "^21.0.0",
|
|
46
48
|
"time-span": "^5.1.0",
|
|
47
|
-
"tsd": "^0.
|
|
48
|
-
"xo": "^
|
|
49
|
+
"tsd": "^0.33.0",
|
|
50
|
+
"xo": "^1.2.2"
|
|
49
51
|
}
|
|
50
52
|
}
|
|
@@ -54,7 +54,7 @@ Passing `Infinity` will cause it to never time out.
|
|
|
54
54
|
##### message
|
|
55
55
|
|
|
56
56
|
Type: `string | Error | false`\
|
|
57
|
-
Default: `'Promise timed out after
|
|
57
|
+
Default: `'Promise timed out after {milliseconds} milliseconds'`
|
|
58
58
|
|
|
59
59
|
Specify a custom error message or error to throw when it times out:
|
|
60
60
|
|
|
@@ -78,6 +78,8 @@ Type: `Function`
|
|
|
78
78
|
|
|
79
79
|
Do something other than rejecting with an error on timeout.
|
|
80
80
|
|
|
81
|
+
The function can return a value or a promise.
|
|
82
|
+
|
|
81
83
|
You could for example retry:
|
|
82
84
|
|
|
83
85
|
```js
|
|
@@ -89,8 +91,10 @@ const delayedPromise = () => setTimeout(200);
|
|
|
89
91
|
await pTimeout(delayedPromise(), {
|
|
90
92
|
milliseconds: 50,
|
|
91
93
|
fallback: () => {
|
|
92
|
-
return pTimeout(delayedPromise(), {
|
|
93
|
-
|
|
94
|
+
return pTimeout(delayedPromise(), {
|
|
95
|
+
milliseconds: 300
|
|
96
|
+
});
|
|
97
|
+
}
|
|
94
98
|
});
|
|
95
99
|
```
|
|
96
100
|
|
|
@@ -105,8 +109,8 @@ Useful for testing purposes, in particular to work around [`sinon.useFakeTimers(
|
|
|
105
109
|
Example:
|
|
106
110
|
|
|
107
111
|
```js
|
|
108
|
-
import {setTimeout} from 'node:timers/promises';
|
|
109
112
|
import pTimeout from 'p-timeout';
|
|
113
|
+
import sinon from 'sinon';
|
|
110
114
|
|
|
111
115
|
const originalSetTimeout = setTimeout;
|
|
112
116
|
const originalClearTimeout = clearTimeout;
|
|
@@ -123,13 +127,11 @@ await pTimeout(doSomething(), {
|
|
|
123
127
|
});
|
|
124
128
|
```
|
|
125
129
|
|
|
126
|
-
|
|
130
|
+
##### signal
|
|
127
131
|
|
|
128
132
|
Type: [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
|
|
129
133
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*Requires Node.js 16 or later.*
|
|
134
|
+
Abort the promise.
|
|
133
135
|
|
|
134
136
|
```js
|
|
135
137
|
import pTimeout from 'p-timeout';
|
|
@@ -164,7 +166,7 @@ Exposed for instance checking and sub-classing.
|
|
|
164
166
|
|
|
165
167
|
> Modern alternative to `p-timeout`
|
|
166
168
|
|
|
167
|
-
|
|
169
|
+
Async functions like `fetch` can accept an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal), which can be conveniently created with [`AbortSignal.timeout()`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static).
|
|
168
170
|
|
|
169
171
|
The advantage over `p-timeout` is that the promise-generating function (like `fetch`) is actually notified that the user is no longer expecting an answer, so it can interrupt its work and free resources.
|
|
170
172
|
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
],
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"yeoman-generator": "7.5.1",
|
|
15
|
-
"@yeoman/types": "1.
|
|
15
|
+
"@yeoman/types": "1.9.1",
|
|
16
16
|
"mem-fs": "4.1.2",
|
|
17
|
-
"@yeoman/adapter": "3.1.
|
|
18
|
-
"@types/node": "24.10.
|
|
17
|
+
"@yeoman/adapter": "3.1.1",
|
|
18
|
+
"@types/node": "24.10.1"
|
|
19
19
|
}
|
|
20
20
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainlink/external-adapter-framework",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "git://github.com/smartcontractkit/ea-framework-js.git",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"ajv": "8.17.1",
|
|
9
9
|
"axios": "1.13.2",
|
|
10
|
-
"eventsource": "4.
|
|
10
|
+
"eventsource": "4.1.0",
|
|
11
11
|
"fastify": "5.6.2",
|
|
12
12
|
"ioredis": "5.8.2",
|
|
13
13
|
"mock-socket": "9.3.1",
|
|
@@ -38,17 +38,17 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@sinonjs/fake-timers": "15.0.0",
|
|
41
|
-
"@types/node": "24.10.
|
|
41
|
+
"@types/node": "24.10.1",
|
|
42
42
|
"@types/sinonjs__fake-timers": "15.0.1",
|
|
43
43
|
"@types/ws": "8.18.1",
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
45
|
-
"@typescript-eslint/parser": "8.
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "8.47.0",
|
|
45
|
+
"@typescript-eslint/parser": "8.47.0",
|
|
46
46
|
"ava": "6.4.1",
|
|
47
47
|
"axios-mock-adapter": "2.1.0",
|
|
48
48
|
"c8": "10.1.3",
|
|
49
49
|
"eslint": "9.39.1",
|
|
50
50
|
"eslint-config-prettier": "10.1.8",
|
|
51
|
-
"eslint-plugin-tsdoc": "0.
|
|
51
|
+
"eslint-plugin-tsdoc": "0.5.0",
|
|
52
52
|
"mocksse": "1.0.4",
|
|
53
53
|
"prettier": "3.6.2",
|
|
54
54
|
"ts-node": "10.9.2",
|