@chainlink/external-adapter-framework 2.6.0 → 2.7.0
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/README.md +1 -1
- package/adapter/types.d.ts +1 -1
- package/config/index.d.ts +4 -0
- package/config/index.js +4 -0
- package/config/index.js.map +1 -1
- package/debug/router.js +7 -36
- package/debug/router.js.map +1 -1
- package/debug/settings-page.d.ts +1 -7
- package/debug/settings-page.js +0 -22
- package/debug/settings-page.js.map +1 -1
- package/generator-adapter/generators/app/index.js +11 -5
- package/generator-adapter/node_modules/.yarn-integrity +2 -2
- package/generator-adapter/node_modules/@types/node/README.md +2 -2
- package/generator-adapter/node_modules/@types/node/async_hooks.d.ts +65 -1
- package/generator-adapter/node_modules/@types/node/buffer.buffer.d.ts +2 -0
- package/generator-adapter/node_modules/@types/node/buffer.d.ts +7 -2
- package/generator-adapter/node_modules/@types/node/cluster.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/compatibility/disposable.d.ts +0 -2
- package/generator-adapter/node_modules/@types/node/compatibility/indexable.d.ts +0 -3
- package/generator-adapter/node_modules/@types/node/compatibility/iterators.d.ts +0 -1
- package/generator-adapter/node_modules/@types/node/diagnostics_channel.d.ts +37 -13
- package/generator-adapter/node_modules/@types/node/dns/promises.d.ts +36 -9
- package/generator-adapter/node_modules/@types/node/dns.d.ts +73 -20
- package/generator-adapter/node_modules/@types/node/dom-events.d.ts +60 -85
- package/generator-adapter/node_modules/@types/node/events.d.ts +0 -1
- package/generator-adapter/node_modules/@types/node/fs/promises.d.ts +21 -17
- package/generator-adapter/node_modules/@types/node/fs.d.ts +94 -10
- package/generator-adapter/node_modules/@types/node/globals.d.ts +136 -283
- package/generator-adapter/node_modules/@types/node/http.d.ts +88 -1
- package/generator-adapter/node_modules/@types/node/http2.d.ts +69 -1
- package/generator-adapter/node_modules/@types/node/module.d.ts +113 -18
- package/generator-adapter/node_modules/@types/node/net.d.ts +15 -9
- package/generator-adapter/node_modules/@types/node/package.json +2 -2
- package/generator-adapter/node_modules/@types/node/perf_hooks.d.ts +2 -2
- package/generator-adapter/node_modules/@types/node/process.d.ts +0 -2
- package/generator-adapter/node_modules/@types/node/querystring.d.ts +2 -3
- package/generator-adapter/node_modules/@types/node/repl.d.ts +3 -5
- package/generator-adapter/node_modules/@types/node/sqlite.d.ts +172 -0
- package/generator-adapter/node_modules/@types/node/stream/web.d.ts +7 -3
- package/generator-adapter/node_modules/@types/node/stream.d.ts +6 -0
- package/generator-adapter/node_modules/@types/node/test.d.ts +1865 -1970
- package/generator-adapter/node_modules/@types/node/tls.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +2 -0
- package/generator-adapter/node_modules/@types/node/util.d.ts +28 -3
- package/generator-adapter/node_modules/@types/node/v8.d.ts +33 -0
- package/generator-adapter/node_modules/@types/node/vm.d.ts +61 -8
- package/generator-adapter/node_modules/@types/node/worker_threads.d.ts +48 -25
- package/generator-adapter/package.json +1 -1
- package/index.js +3 -0
- package/index.js.map +1 -1
- package/package.json +14 -15
- package/status/router.d.ts +49 -0
- package/status/router.js +55 -0
- package/status/router.js.map +1 -0
- package/transports/sse.d.ts +2 -2
- package/transports/sse.js +2 -5
- package/transports/sse.js.map +1 -1
- package/util/settings.d.ts +11 -0
- package/util/settings.js +29 -0
- package/util/settings.js.map +1 -0
|
@@ -647,7 +647,7 @@ declare module "tls" {
|
|
|
647
647
|
* @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc), or a TLS context object created
|
|
648
648
|
* with {@link createSecureContext} itself.
|
|
649
649
|
*/
|
|
650
|
-
addContext(hostname: string, context: SecureContextOptions): void;
|
|
650
|
+
addContext(hostname: string, context: SecureContextOptions | SecureContext): void;
|
|
651
651
|
/**
|
|
652
652
|
* Returns the session ticket keys.
|
|
653
653
|
*
|
|
@@ -448,6 +448,8 @@ declare module "buffer" {
|
|
|
448
448
|
*/
|
|
449
449
|
subarray(start?: number, end?: number): Buffer;
|
|
450
450
|
}
|
|
451
|
+
type NonSharedBuffer = Buffer;
|
|
452
|
+
type AllowSharedBuffer = Buffer;
|
|
451
453
|
}
|
|
452
454
|
/** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
|
|
453
455
|
var SlowBuffer: {
|
|
@@ -433,7 +433,6 @@ declare module "util" {
|
|
|
433
433
|
* });
|
|
434
434
|
* ```
|
|
435
435
|
* @since v19.7.0
|
|
436
|
-
* @experimental
|
|
437
436
|
* @param resource Any non-null object tied to the abortable operation and held weakly.
|
|
438
437
|
* If `resource` is garbage collected before the `signal` aborts, the promise remains pending,
|
|
439
438
|
* allowing Node.js to stop tracking it.
|
|
@@ -1411,7 +1410,7 @@ declare module "util" {
|
|
|
1411
1410
|
* @param content The raw contents of a `.env` file.
|
|
1412
1411
|
* @since v20.12.0
|
|
1413
1412
|
*/
|
|
1414
|
-
export function parseEnv(content: string):
|
|
1413
|
+
export function parseEnv(content: string): NodeJS.Dict<string>;
|
|
1415
1414
|
// https://nodejs.org/docs/latest/api/util.html#foreground-colors
|
|
1416
1415
|
type ForegroundColors =
|
|
1417
1416
|
| "black"
|
|
@@ -1466,10 +1465,22 @@ declare module "util" {
|
|
|
1466
1465
|
| "reset"
|
|
1467
1466
|
| "strikethrough"
|
|
1468
1467
|
| "underline";
|
|
1468
|
+
export interface StyleTextOptions {
|
|
1469
|
+
/**
|
|
1470
|
+
* When true, `stream` is checked to see if it can handle colors.
|
|
1471
|
+
* @default true
|
|
1472
|
+
*/
|
|
1473
|
+
validateStream?: boolean | undefined;
|
|
1474
|
+
/**
|
|
1475
|
+
* A stream that will be validated if it can be colored.
|
|
1476
|
+
* @default process.stdout
|
|
1477
|
+
*/
|
|
1478
|
+
stream?: NodeJS.WritableStream | undefined;
|
|
1479
|
+
}
|
|
1469
1480
|
/**
|
|
1470
1481
|
* This function returns a formatted text considering the `format` passed
|
|
1471
1482
|
* for printing in a terminal. It is aware of the terminal's capabilities
|
|
1472
|
-
* and acts according to the configuration set via `
|
|
1483
|
+
* and acts according to the configuration set via `NO_COLOR`,
|
|
1473
1484
|
* `NODE_DISABLE_COLORS` and `FORCE_COLOR` environment variables.
|
|
1474
1485
|
*
|
|
1475
1486
|
* ```js
|
|
@@ -1518,6 +1529,7 @@ declare module "util" {
|
|
|
1518
1529
|
| Modifiers
|
|
1519
1530
|
| Array<ForegroundColors | BackgroundColors | Modifiers>,
|
|
1520
1531
|
text: string,
|
|
1532
|
+
options?: StyleTextOptions,
|
|
1521
1533
|
): string;
|
|
1522
1534
|
/**
|
|
1523
1535
|
* An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API.
|
|
@@ -2213,6 +2225,19 @@ declare module "util/types" {
|
|
|
2213
2225
|
* @since v10.0.0
|
|
2214
2226
|
*/
|
|
2215
2227
|
function isExternal(object: unknown): boolean;
|
|
2228
|
+
/**
|
|
2229
|
+
* Returns `true` if the value is a built-in `Float16Array` instance.
|
|
2230
|
+
*
|
|
2231
|
+
* ```js
|
|
2232
|
+
* util.types.isFloat16Array(new ArrayBuffer()); // Returns false
|
|
2233
|
+
* util.types.isFloat16Array(new Float16Array()); // Returns true
|
|
2234
|
+
* util.types.isFloat16Array(new Float32Array()); // Returns false
|
|
2235
|
+
* ```
|
|
2236
|
+
* @since v22.16.0
|
|
2237
|
+
*/
|
|
2238
|
+
// This does NOT return a type predicate in v22.x.
|
|
2239
|
+
// The Float16Array feature does not yet exist in this version of Node.js.
|
|
2240
|
+
function isFloat16Array(object: unknown): boolean;
|
|
2216
2241
|
/**
|
|
2217
2242
|
* Returns `true` if the value is a built-in [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) instance.
|
|
2218
2243
|
*
|
|
@@ -400,6 +400,39 @@ declare module "v8" {
|
|
|
400
400
|
* @since v12.8.0
|
|
401
401
|
*/
|
|
402
402
|
function getHeapCodeStatistics(): HeapCodeStatistics;
|
|
403
|
+
/**
|
|
404
|
+
* V8 only supports `Latin-1/ISO-8859-1` and `UTF16` as the underlying representation of a string.
|
|
405
|
+
* If the `content` uses `Latin-1/ISO-8859-1` as the underlying representation, this function will return true;
|
|
406
|
+
* otherwise, it returns false.
|
|
407
|
+
*
|
|
408
|
+
* If this method returns false, that does not mean that the string contains some characters not in `Latin-1/ISO-8859-1`.
|
|
409
|
+
* Sometimes a `Latin-1` string may also be represented as `UTF16`.
|
|
410
|
+
*
|
|
411
|
+
* ```js
|
|
412
|
+
* const { isStringOneByteRepresentation } = require('node:v8');
|
|
413
|
+
*
|
|
414
|
+
* const Encoding = {
|
|
415
|
+
* latin1: 1,
|
|
416
|
+
* utf16le: 2,
|
|
417
|
+
* };
|
|
418
|
+
* const buffer = Buffer.alloc(100);
|
|
419
|
+
* function writeString(input) {
|
|
420
|
+
* if (isStringOneByteRepresentation(input)) {
|
|
421
|
+
* buffer.writeUint8(Encoding.latin1);
|
|
422
|
+
* buffer.writeUint32LE(input.length, 1);
|
|
423
|
+
* buffer.write(input, 5, 'latin1');
|
|
424
|
+
* } else {
|
|
425
|
+
* buffer.writeUint8(Encoding.utf16le);
|
|
426
|
+
* buffer.writeUint32LE(input.length * 2, 1);
|
|
427
|
+
* buffer.write(input, 5, 'utf16le');
|
|
428
|
+
* }
|
|
429
|
+
* }
|
|
430
|
+
* writeString('hello');
|
|
431
|
+
* writeString('你好');
|
|
432
|
+
* ```
|
|
433
|
+
* @since v22.15.0
|
|
434
|
+
*/
|
|
435
|
+
function isStringOneByteRepresentation(content: string): boolean;
|
|
403
436
|
/**
|
|
404
437
|
* @since v8.0.0
|
|
405
438
|
*/
|
|
@@ -56,9 +56,14 @@ declare module "vm" {
|
|
|
56
56
|
*/
|
|
57
57
|
columnOffset?: number | undefined;
|
|
58
58
|
}
|
|
59
|
+
type DynamicModuleLoader<T> = (
|
|
60
|
+
specifier: string,
|
|
61
|
+
referrer: T,
|
|
62
|
+
importAttributes: ImportAttributes,
|
|
63
|
+
) => Module | Promise<Module>;
|
|
59
64
|
interface ScriptOptions extends BaseOptions {
|
|
60
65
|
/**
|
|
61
|
-
* V8's code cache data for the supplied source.
|
|
66
|
+
* Provides an optional data with V8's code cache data for the supplied source.
|
|
62
67
|
*/
|
|
63
68
|
cachedData?: Buffer | NodeJS.ArrayBufferView | undefined;
|
|
64
69
|
/** @deprecated in favor of `script.createCachedData()` */
|
|
@@ -69,7 +74,7 @@ declare module "vm" {
|
|
|
69
74
|
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
70
75
|
*/
|
|
71
76
|
importModuleDynamically?:
|
|
72
|
-
|
|
|
77
|
+
| DynamicModuleLoader<Script>
|
|
73
78
|
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
74
79
|
| undefined;
|
|
75
80
|
}
|
|
@@ -110,18 +115,40 @@ declare module "vm" {
|
|
|
110
115
|
microtaskMode?: CreateContextOptions["microtaskMode"];
|
|
111
116
|
}
|
|
112
117
|
interface RunningCodeOptions extends RunningScriptOptions {
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Provides an optional data with V8's code cache data for the supplied source.
|
|
120
|
+
*/
|
|
121
|
+
cachedData?: ScriptOptions["cachedData"] | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
124
|
+
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
125
|
+
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
126
|
+
*/
|
|
127
|
+
importModuleDynamically?:
|
|
128
|
+
| DynamicModuleLoader<Script>
|
|
129
|
+
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
130
|
+
| undefined;
|
|
115
131
|
}
|
|
116
132
|
interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions {
|
|
117
|
-
|
|
118
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Provides an optional data with V8's code cache data for the supplied source.
|
|
135
|
+
*/
|
|
136
|
+
cachedData?: ScriptOptions["cachedData"] | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
139
|
+
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
140
|
+
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
141
|
+
*/
|
|
142
|
+
importModuleDynamically?:
|
|
143
|
+
| DynamicModuleLoader<Script>
|
|
144
|
+
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
145
|
+
| undefined;
|
|
119
146
|
}
|
|
120
147
|
interface CompileFunctionOptions extends BaseOptions {
|
|
121
148
|
/**
|
|
122
149
|
* Provides an optional data with V8's code cache data for the supplied source.
|
|
123
150
|
*/
|
|
124
|
-
cachedData?:
|
|
151
|
+
cachedData?: ScriptOptions["cachedData"] | undefined;
|
|
125
152
|
/**
|
|
126
153
|
* Specifies whether to produce new cache data.
|
|
127
154
|
* @default false
|
|
@@ -135,6 +162,15 @@ declare module "vm" {
|
|
|
135
162
|
* An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling
|
|
136
163
|
*/
|
|
137
164
|
contextExtensions?: Object[] | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
167
|
+
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
168
|
+
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
169
|
+
*/
|
|
170
|
+
importModuleDynamically?:
|
|
171
|
+
| DynamicModuleLoader<ReturnType<typeof compileFunction>>
|
|
172
|
+
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
173
|
+
| undefined;
|
|
138
174
|
}
|
|
139
175
|
interface CreateContextOptions {
|
|
140
176
|
/**
|
|
@@ -169,6 +205,15 @@ declare module "vm" {
|
|
|
169
205
|
* If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
|
|
170
206
|
*/
|
|
171
207
|
microtaskMode?: "afterEvaluate" | undefined;
|
|
208
|
+
/**
|
|
209
|
+
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
210
|
+
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
211
|
+
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
212
|
+
*/
|
|
213
|
+
importModuleDynamically?:
|
|
214
|
+
| DynamicModuleLoader<Context>
|
|
215
|
+
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
216
|
+
| undefined;
|
|
172
217
|
}
|
|
173
218
|
type MeasureMemoryMode = "summary" | "detailed";
|
|
174
219
|
interface MeasureMemoryOptions {
|
|
@@ -848,6 +893,9 @@ declare module "vm" {
|
|
|
848
893
|
* @default 'vm:module(i)' where i is a context-specific ascending index.
|
|
849
894
|
*/
|
|
850
895
|
identifier?: string | undefined;
|
|
896
|
+
/**
|
|
897
|
+
* Provides an optional data with V8's code cache data for the supplied source.
|
|
898
|
+
*/
|
|
851
899
|
cachedData?: ScriptOptions["cachedData"] | undefined;
|
|
852
900
|
context?: Context | undefined;
|
|
853
901
|
lineOffset?: BaseOptions["lineOffset"] | undefined;
|
|
@@ -856,7 +904,12 @@ declare module "vm" {
|
|
|
856
904
|
* Called during evaluation of this module to initialize the `import.meta`.
|
|
857
905
|
*/
|
|
858
906
|
initializeImportMeta?: ((meta: ImportMeta, module: SourceTextModule) => void) | undefined;
|
|
859
|
-
|
|
907
|
+
/**
|
|
908
|
+
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
909
|
+
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
910
|
+
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
911
|
+
*/
|
|
912
|
+
importModuleDynamically?: DynamicModuleLoader<SourceTextModule> | undefined;
|
|
860
913
|
}
|
|
861
914
|
/**
|
|
862
915
|
* This feature is only available with the `--experimental-vm-modules` command
|
|
@@ -15,28 +15,31 @@
|
|
|
15
15
|
*
|
|
16
16
|
* ```js
|
|
17
17
|
* import {
|
|
18
|
-
* Worker,
|
|
18
|
+
* Worker,
|
|
19
|
+
* isMainThread,
|
|
20
|
+
* parentPort,
|
|
21
|
+
* workerData,
|
|
19
22
|
* } from 'node:worker_threads';
|
|
20
|
-
* import { parse } from 'some-js-parsing-library';
|
|
21
23
|
*
|
|
22
|
-
* if (isMainThread) {
|
|
23
|
-
*
|
|
24
|
-
* return new Promise((resolve, reject) => {
|
|
25
|
-
* const worker = new Worker(__filename, {
|
|
26
|
-
* workerData: script,
|
|
27
|
-
* });
|
|
28
|
-
* worker.on('message', resolve);
|
|
29
|
-
* worker.on('error', reject);
|
|
30
|
-
* worker.on('exit', (code) => {
|
|
31
|
-
* if (code !== 0)
|
|
32
|
-
* reject(new Error(`Worker stopped with exit code ${code}`));
|
|
33
|
-
* });
|
|
34
|
-
* });
|
|
35
|
-
* };
|
|
36
|
-
* } else {
|
|
24
|
+
* if (!isMainThread) {
|
|
25
|
+
* const { parse } = await import('some-js-parsing-library');
|
|
37
26
|
* const script = workerData;
|
|
38
27
|
* parentPort.postMessage(parse(script));
|
|
39
28
|
* }
|
|
29
|
+
*
|
|
30
|
+
* export default function parseJSAsync(script) {
|
|
31
|
+
* return new Promise((resolve, reject) => {
|
|
32
|
+
* const worker = new Worker(new URL(import.meta.url), {
|
|
33
|
+
* workerData: script,
|
|
34
|
+
* });
|
|
35
|
+
* worker.on('message', resolve);
|
|
36
|
+
* worker.on('error', reject);
|
|
37
|
+
* worker.on('exit', (code) => {
|
|
38
|
+
* if (code !== 0)
|
|
39
|
+
* reject(new Error(`Worker stopped with exit code ${code}`));
|
|
40
|
+
* });
|
|
41
|
+
* });
|
|
42
|
+
* };
|
|
40
43
|
* ```
|
|
41
44
|
*
|
|
42
45
|
* The above example spawns a Worker thread for each `parseJSAsync()` call. In
|
|
@@ -52,14 +55,14 @@
|
|
|
52
55
|
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/worker_threads.js)
|
|
53
56
|
*/
|
|
54
57
|
declare module "worker_threads" {
|
|
55
|
-
import { Blob } from "node:buffer";
|
|
56
58
|
import { Context } from "node:vm";
|
|
57
59
|
import { EventEmitter } from "node:events";
|
|
58
60
|
import { EventLoopUtilityFunction } from "node:perf_hooks";
|
|
59
61
|
import { FileHandle } from "node:fs/promises";
|
|
60
62
|
import { Readable, Writable } from "node:stream";
|
|
63
|
+
import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
|
|
61
64
|
import { URL } from "node:url";
|
|
62
|
-
import {
|
|
65
|
+
import { HeapInfo } from "node:v8";
|
|
63
66
|
const isInternalThread: boolean;
|
|
64
67
|
const isMainThread: boolean;
|
|
65
68
|
const parentPort: null | MessagePort;
|
|
@@ -89,7 +92,16 @@ declare module "worker_threads" {
|
|
|
89
92
|
interface WorkerPerformance {
|
|
90
93
|
eventLoopUtilization: EventLoopUtilityFunction;
|
|
91
94
|
}
|
|
92
|
-
type
|
|
95
|
+
type Transferable =
|
|
96
|
+
| ArrayBuffer
|
|
97
|
+
| MessagePort
|
|
98
|
+
| AbortSignal
|
|
99
|
+
| FileHandle
|
|
100
|
+
| ReadableStream
|
|
101
|
+
| WritableStream
|
|
102
|
+
| TransformStream;
|
|
103
|
+
/** @deprecated Use `import { Transferable } from "node:worker_threads"` instead. */
|
|
104
|
+
type TransferListItem = Transferable;
|
|
93
105
|
/**
|
|
94
106
|
* Instances of the `worker.MessagePort` class represent one end of an
|
|
95
107
|
* asynchronous, two-way communications channel. It can be used to transfer
|
|
@@ -174,7 +186,7 @@ declare module "worker_threads" {
|
|
|
174
186
|
* behind this API, see the `serialization API of the node:v8 module`.
|
|
175
187
|
* @since v10.5.0
|
|
176
188
|
*/
|
|
177
|
-
postMessage(value: any, transferList?: readonly
|
|
189
|
+
postMessage(value: any, transferList?: readonly Transferable[]): void;
|
|
178
190
|
/**
|
|
179
191
|
* Opposite of `unref()`. Calling `ref()` on a previously `unref()`ed port does _not_ let the program exit if it's the only active handle left (the default
|
|
180
192
|
* behavior). If the port is `ref()`ed, calling `ref()` again has no effect.
|
|
@@ -261,7 +273,7 @@ declare module "worker_threads" {
|
|
|
261
273
|
/**
|
|
262
274
|
* Additional data to send in the first worker message.
|
|
263
275
|
*/
|
|
264
|
-
transferList?:
|
|
276
|
+
transferList?: Transferable[] | undefined;
|
|
265
277
|
/**
|
|
266
278
|
* @default true
|
|
267
279
|
*/
|
|
@@ -409,7 +421,7 @@ declare module "worker_threads" {
|
|
|
409
421
|
* See `port.postMessage()` for more details.
|
|
410
422
|
* @since v10.5.0
|
|
411
423
|
*/
|
|
412
|
-
postMessage(value: any, transferList?: readonly
|
|
424
|
+
postMessage(value: any, transferList?: readonly Transferable[]): void;
|
|
413
425
|
/**
|
|
414
426
|
* Sends a value to another worker, identified by its thread ID.
|
|
415
427
|
* @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
|
|
@@ -425,7 +437,7 @@ declare module "worker_threads" {
|
|
|
425
437
|
postMessageToThread(
|
|
426
438
|
threadId: number,
|
|
427
439
|
value: any,
|
|
428
|
-
transferList: readonly
|
|
440
|
+
transferList: readonly Transferable[],
|
|
429
441
|
timeout?: number,
|
|
430
442
|
): Promise<void>;
|
|
431
443
|
/**
|
|
@@ -457,6 +469,13 @@ declare module "worker_threads" {
|
|
|
457
469
|
* @return A promise for a Readable Stream containing a V8 heap snapshot
|
|
458
470
|
*/
|
|
459
471
|
getHeapSnapshot(): Promise<Readable>;
|
|
472
|
+
/**
|
|
473
|
+
* This method returns a `Promise` that will resolve to an object identical to `v8.getHeapStatistics()`,
|
|
474
|
+
* or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
|
|
475
|
+
* This methods allows the statistics to be observed from outside the actual thread.
|
|
476
|
+
* @since v22.16.0
|
|
477
|
+
*/
|
|
478
|
+
getHeapStatistics(): Promise<HeapInfo>;
|
|
460
479
|
addListener(event: "error", listener: (err: Error) => void): this;
|
|
461
480
|
addListener(event: "exit", listener: (exitCode: number) => void): this;
|
|
462
481
|
addListener(event: "message", listener: (value: any) => void): this;
|
|
@@ -701,7 +720,7 @@ declare module "worker_threads" {
|
|
|
701
720
|
* @param value Any arbitrary, cloneable JavaScript value that will be cloned and passed automatically to all new `Worker` instances. If `value` is passed as `undefined`, any previously set value
|
|
702
721
|
* for the `key` will be deleted.
|
|
703
722
|
*/
|
|
704
|
-
function setEnvironmentData(key: Serializable, value
|
|
723
|
+
function setEnvironmentData(key: Serializable, value?: Serializable): void;
|
|
705
724
|
|
|
706
725
|
import {
|
|
707
726
|
BroadcastChannel as _BroadcastChannel,
|
|
@@ -709,6 +728,10 @@ declare module "worker_threads" {
|
|
|
709
728
|
MessagePort as _MessagePort,
|
|
710
729
|
} from "worker_threads";
|
|
711
730
|
global {
|
|
731
|
+
function structuredClone<T>(
|
|
732
|
+
value: T,
|
|
733
|
+
options?: { transfer?: Transferable[] },
|
|
734
|
+
): T;
|
|
712
735
|
/**
|
|
713
736
|
* `BroadcastChannel` class is a global reference for `import { BroadcastChannel } from 'worker_threads'`
|
|
714
737
|
* https://nodejs.org/api/globals.html#broadcastchannel
|
package/index.js
CHANGED
|
@@ -13,6 +13,7 @@ const router_1 = __importDefault(require("./debug/router"));
|
|
|
13
13
|
const metrics_1 = require("./metrics");
|
|
14
14
|
const util_1 = require("./util");
|
|
15
15
|
const validation_1 = require("./validation");
|
|
16
|
+
const router_2 = __importDefault(require("./status/router"));
|
|
16
17
|
const logger = (0, util_1.makeLogger)('Main');
|
|
17
18
|
const VERSION = process.env['npm_package_version'];
|
|
18
19
|
const getTLSOptions = (adapterSettings) => {
|
|
@@ -151,6 +152,8 @@ async function buildRestApi(adapter) {
|
|
|
151
152
|
(0, router_1.default)(app, adapter);
|
|
152
153
|
logger.info('Serving debug endpoints');
|
|
153
154
|
}
|
|
155
|
+
// Register status endpoint
|
|
156
|
+
(0, router_2.default)(app, adapter);
|
|
154
157
|
// Use global error handling
|
|
155
158
|
app.setErrorHandler(validation_1.errorCatchingMiddleware);
|
|
156
159
|
// Always reply with json content
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAkD;AAElD,+BAA2B;AAC3B,qCAAwC;AACxC,uCAAwD;AACxD,+DAA8D;AAE9D,4DAAmD;AACnD,uCAAsE;AACtE,iCAMe;AACf,6CAA2E;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAkD;AAElD,+BAA2B;AAC3B,qCAAwC;AACxC,uCAAwD;AACxD,+DAA8D;AAE9D,4DAAmD;AACnD,uCAAsE;AACtE,iCAMe;AACf,6CAA2E;AAE3E,6DAAoD;AAIpD,MAAM,MAAM,GAAG,IAAA,iBAAU,EAAC,MAAM,CAAC,CAAA;AAEjC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;AAY3C,MAAM,aAAa,GAAG,CAAC,eAAgC,EAAE,EAAE;IAChE,IAAI,CAAC,eAAe,CAAC,WAAW,IAAI,CAAC,eAAe,CAAC,YAAY,EAAE,CAAC;QAClE,OAAO,EAAE,CAAA;IACX,CAAC;IAED,IAAI,eAAe,CAAC,WAAW,IAAI,eAAe,CAAC,YAAY,EAAE,CAAC;QAChE,MAAM,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AC;YACD,MAAM,CAAC,OAAO,CAAsB,YAAY,EAAE,gCAAsB,CAAC,CAAA;QAC3E,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainlink/external-adapter-framework",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"ajv": "8.17.1",
|
|
8
|
-
"axios": "1.
|
|
9
|
-
"eventsource": "
|
|
10
|
-
"fastify": "5.
|
|
8
|
+
"axios": "1.10.0",
|
|
9
|
+
"eventsource": "4.0.0",
|
|
10
|
+
"fastify": "5.4.0",
|
|
11
11
|
"ioredis": "5.6.1",
|
|
12
12
|
"mock-socket": "9.3.1",
|
|
13
|
-
"pino": "9.
|
|
13
|
+
"pino": "9.7.0",
|
|
14
14
|
"pino-pretty": "13.0.0",
|
|
15
15
|
"prom-client": "15.1.3",
|
|
16
16
|
"redlock": "5.0.0-beta.2",
|
|
17
|
-
"ws": "8.18.
|
|
17
|
+
"ws": "8.18.3"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "rm -rf dist/src && mkdir -p ./dist/src && cp package.json dist/src && cp README.md dist/src && tsc && yarn pre-build-generator",
|
|
@@ -36,23 +36,22 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@sinonjs/fake-timers": "14.0.0",
|
|
39
|
-
"@types/
|
|
40
|
-
"@types/node": "22.15.3",
|
|
39
|
+
"@types/node": "22.16.3",
|
|
41
40
|
"@types/sinonjs__fake-timers": "8.1.5",
|
|
42
41
|
"@types/ws": "8.18.1",
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
44
|
-
"@typescript-eslint/parser": "8.
|
|
45
|
-
"ava": "6.
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "8.36.0",
|
|
43
|
+
"@typescript-eslint/parser": "8.36.0",
|
|
44
|
+
"ava": "6.4.1",
|
|
46
45
|
"axios-mock-adapter": "2.1.0",
|
|
47
46
|
"c8": "10.1.3",
|
|
48
|
-
"eslint": "9.
|
|
49
|
-
"eslint-config-prettier": "10.1.
|
|
47
|
+
"eslint": "9.31.0",
|
|
48
|
+
"eslint-config-prettier": "10.1.5",
|
|
50
49
|
"eslint-plugin-tsdoc": "0.4.0",
|
|
51
50
|
"mocksse": "1.0.4",
|
|
52
|
-
"prettier": "3.
|
|
51
|
+
"prettier": "3.6.2",
|
|
53
52
|
"ts-node": "10.9.2",
|
|
54
53
|
"ts-node-dev": "2.0.0",
|
|
55
|
-
"typedoc": "0.28.
|
|
54
|
+
"typedoc": "0.28.7",
|
|
56
55
|
"typescript": "5.8.3"
|
|
57
56
|
},
|
|
58
57
|
"prettier": {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { FastifyInstance } from 'fastify';
|
|
2
|
+
import { Adapter } from '../adapter';
|
|
3
|
+
export interface StatusResponse {
|
|
4
|
+
adapter: {
|
|
5
|
+
name: string;
|
|
6
|
+
version: string;
|
|
7
|
+
uptimeSeconds: number;
|
|
8
|
+
};
|
|
9
|
+
endpoints: {
|
|
10
|
+
name: string;
|
|
11
|
+
aliases: string[];
|
|
12
|
+
transports: string[];
|
|
13
|
+
}[];
|
|
14
|
+
defaultEndpoint: string;
|
|
15
|
+
configuration: {
|
|
16
|
+
name: string;
|
|
17
|
+
value: unknown;
|
|
18
|
+
type: string;
|
|
19
|
+
description: string;
|
|
20
|
+
required: boolean;
|
|
21
|
+
default: unknown;
|
|
22
|
+
customSetting: boolean;
|
|
23
|
+
envDefaultOverride: unknown;
|
|
24
|
+
}[];
|
|
25
|
+
runtime: {
|
|
26
|
+
nodeVersion: string;
|
|
27
|
+
platform: string;
|
|
28
|
+
architecture: string;
|
|
29
|
+
hostname: string;
|
|
30
|
+
};
|
|
31
|
+
metrics: {
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
port?: number;
|
|
34
|
+
endpoint?: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* This function registers the status endpoint for the adapter.
|
|
39
|
+
* This endpoint provides comprehensive information about the adapter including:
|
|
40
|
+
* - Adapter metadata (name, version, commit)
|
|
41
|
+
* - Configuration (obfuscated sensitive values)
|
|
42
|
+
* - Runtime information
|
|
43
|
+
* - Dependencies status
|
|
44
|
+
* - Endpoints and transports
|
|
45
|
+
*
|
|
46
|
+
* @param app - the fastify instance that has been created
|
|
47
|
+
* @param adapter - the adapter for which to create the status endpoint
|
|
48
|
+
*/
|
|
49
|
+
export default function registerStatusEndpoint(app: FastifyInstance, adapter: Adapter): void;
|
package/status/router.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = registerStatusEndpoint;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const os_1 = require("os");
|
|
6
|
+
const settings_1 = require("../util/settings");
|
|
7
|
+
/**
|
|
8
|
+
* This function registers the status endpoint for the adapter.
|
|
9
|
+
* This endpoint provides comprehensive information about the adapter including:
|
|
10
|
+
* - Adapter metadata (name, version, commit)
|
|
11
|
+
* - Configuration (obfuscated sensitive values)
|
|
12
|
+
* - Runtime information
|
|
13
|
+
* - Dependencies status
|
|
14
|
+
* - Endpoints and transports
|
|
15
|
+
*
|
|
16
|
+
* @param app - the fastify instance that has been created
|
|
17
|
+
* @param adapter - the adapter for which to create the status endpoint
|
|
18
|
+
*/
|
|
19
|
+
function registerStatusEndpoint(app, adapter) {
|
|
20
|
+
// Status endpoint that returns comprehensive adapter information
|
|
21
|
+
app.get((0, path_1.join)(adapter.config.settings.BASE_URL, '/status'), async () => {
|
|
22
|
+
const metricsEndpoint = adapter.config.settings.METRICS_USE_BASE_URL
|
|
23
|
+
? (0, path_1.join)(adapter.config.settings.BASE_URL, 'metrics')
|
|
24
|
+
: '/metrics';
|
|
25
|
+
const statusResponse = {
|
|
26
|
+
adapter: {
|
|
27
|
+
name: adapter.name,
|
|
28
|
+
version: process.env['npm_package_version'] || 'unknown',
|
|
29
|
+
uptimeSeconds: process.uptime(),
|
|
30
|
+
},
|
|
31
|
+
endpoints: adapter.endpoints.map((endpoint) => ({
|
|
32
|
+
name: endpoint.name,
|
|
33
|
+
aliases: endpoint.aliases || [],
|
|
34
|
+
transports: endpoint.transportRoutes.routeNames(),
|
|
35
|
+
})),
|
|
36
|
+
defaultEndpoint: adapter.defaultEndpoint || '',
|
|
37
|
+
configuration: (0, settings_1.buildSettingsList)(adapter),
|
|
38
|
+
runtime: {
|
|
39
|
+
nodeVersion: process.version,
|
|
40
|
+
platform: process.platform,
|
|
41
|
+
architecture: process.arch,
|
|
42
|
+
hostname: (0, os_1.hostname)(),
|
|
43
|
+
},
|
|
44
|
+
metrics: {
|
|
45
|
+
enabled: adapter.config.settings.METRICS_ENABLED,
|
|
46
|
+
port: adapter.config.settings.METRICS_ENABLED
|
|
47
|
+
? adapter.config.settings.METRICS_PORT
|
|
48
|
+
: undefined,
|
|
49
|
+
endpoint: adapter.config.settings.METRICS_ENABLED ? metricsEndpoint : undefined,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
return statusResponse;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../../src/status/router.ts"],"names":[],"mappings":";;AAqDA,yCAqCC;AAzFD,+BAA2B;AAC3B,2BAA6B;AAE7B,+CAAoD;AAqCpD;;;;;;;;;;;GAWG;AACH,SAAwB,sBAAsB,CAAC,GAAoB,EAAE,OAAgB;IACnF,iEAAiE;IACjE,GAAG,CAAC,GAAG,CAAC,IAAA,WAAI,EA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C,CAAC,CAAC,SAAS;gBACb,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS;aAChF;SACF,CAAA;QAED,OAAO,cAAc,CAAA;IACvB,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/transports/sse.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import EventSource from 'eventsource';
|
|
2
|
+
import { EventSource, EventSourceInit } from 'eventsource';
|
|
3
3
|
import { EndpointContext } from '../adapter';
|
|
4
4
|
import { Requester } from '../util/requester';
|
|
5
5
|
import { ProviderResult } from '../util/types';
|
|
@@ -8,7 +8,7 @@ import { TransportDependencies, TransportGenerics } from './';
|
|
|
8
8
|
import { StreamingTransport, SubscriptionDeltas } from './abstract/streaming';
|
|
9
9
|
export interface SSEConfig {
|
|
10
10
|
url: string;
|
|
11
|
-
eventSourceInitDict?:
|
|
11
|
+
eventSourceInitDict?: EventSourceInit;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Helper struct type that will be used to pass types to the generic parameters of a Transport.
|