@chainlink/external-adapter-framework 2.10.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.
Files changed (32) hide show
  1. package/README.md +1 -1
  2. package/adapter/market-status.d.ts +6 -0
  3. package/adapter/market-status.js +22 -0
  4. package/adapter/market-status.js.map +1 -1
  5. package/config/index.js +1 -1
  6. package/generator-adapter/node_modules/.yarn-integrity +8 -8
  7. package/generator-adapter/node_modules/@types/node/README.md +1 -1
  8. package/generator-adapter/node_modules/@types/node/package.json +2 -2
  9. package/generator-adapter/node_modules/@types/node/process.d.ts +7 -0
  10. package/generator-adapter/node_modules/@yeoman/adapter/dist/queued-adapter.js +1 -3
  11. package/generator-adapter/node_modules/@yeoman/adapter/dist/queued-adapter.js.map +1 -1
  12. package/generator-adapter/node_modules/@yeoman/adapter/package.json +3 -3
  13. package/generator-adapter/node_modules/@yeoman/types/package.json +3 -3
  14. package/generator-adapter/node_modules/p-queue/dist/index.d.ts +181 -11
  15. package/generator-adapter/node_modules/p-queue/dist/index.js +366 -45
  16. package/generator-adapter/node_modules/p-queue/dist/options copy.d.ts +121 -0
  17. package/generator-adapter/node_modules/p-queue/dist/options copy.js +1 -0
  18. package/generator-adapter/node_modules/p-queue/dist/options.d.ts +26 -7
  19. package/generator-adapter/node_modules/p-queue/dist/priority-queue.d.ts +1 -0
  20. package/generator-adapter/node_modules/p-queue/dist/priority-queue.js +12 -6
  21. package/generator-adapter/node_modules/p-queue/dist/queue.d.ts +1 -0
  22. package/generator-adapter/node_modules/p-queue/package.json +19 -27
  23. package/generator-adapter/node_modules/p-queue/readme.md +541 -19
  24. package/generator-adapter/node_modules/p-timeout/index.d.ts +2 -4
  25. package/generator-adapter/node_modules/p-timeout/index.js +23 -50
  26. package/generator-adapter/node_modules/p-timeout/package.json +11 -9
  27. package/generator-adapter/node_modules/p-timeout/readme.md +11 -9
  28. package/generator-adapter/package.json +3 -3
  29. package/package.json +8 -7
  30. package/validation/market-status.d.ts +6 -0
  31. package/validation/market-status.js +69 -0
  32. package/validation/market-status.js.map +1 -0
@@ -1,15 +1,26 @@
1
1
  import { type Queue, type RunFunction } from './queue.js';
2
2
  type TimeoutOptions = {
3
3
  /**
4
- Per-operation timeout in milliseconds. Operations fulfill once `timeout` elapses if they haven't already.
5
- */
6
- timeout?: number;
7
- /**
8
- Whether or not a timeout is considered an exception.
4
+ Per-operation timeout in milliseconds. Operations will throw a `TimeoutError` if they don't complete within the specified time.
9
5
 
10
- @default false
6
+ The timeout begins when the operation is dequeued and starts execution, not while it's waiting in the queue.
7
+
8
+ @default undefined
9
+
10
+ Can be overridden per task using the `timeout` option in `.add()`:
11
+
12
+ @example
13
+ ```
14
+ const queue = new PQueue({timeout: 5000});
15
+
16
+ // This task uses the global 5s timeout
17
+ await queue.add(() => fetchData());
18
+
19
+ // This task has a 10s timeout
20
+ await queue.add(() => slowTask(), {timeout: 10000});
21
+ ```
11
22
  */
12
- throwOnTimeout?: boolean;
23
+ timeout?: number;
13
24
  };
14
25
  export type Options<QueueType extends Queue<RunFunction, QueueOptions>, QueueOptions extends QueueAddOptions> = {
15
26
  /**
@@ -51,6 +62,10 @@ export type Options<QueueType extends Queue<RunFunction, QueueOptions>, QueueOpt
51
62
 
52
63
  @default false
53
64
  */
65
+ readonly carryoverIntervalCount?: boolean;
66
+ /**
67
+ @deprecated Renamed to `carryoverIntervalCount`.
68
+ */
54
69
  readonly carryoverConcurrencyCount?: boolean;
55
70
  } & TimeoutOptions;
56
71
  export type QueueAddOptions = {
@@ -60,6 +75,10 @@ export type QueueAddOptions = {
60
75
  @default 0
61
76
  */
62
77
  readonly priority?: number;
78
+ /**
79
+ Unique identifier for the promise function, used to update its priority before execution. If not specified, it is auto-assigned an incrementing BigInt starting from `1n`.
80
+ */
81
+ id?: string;
63
82
  } & TaskOptions & TimeoutOptions;
64
83
  export type TaskOptions = {
65
84
  /**
@@ -6,6 +6,7 @@ export type PriorityQueueOptions = {
6
6
  export default class PriorityQueue implements Queue<RunFunction, PriorityQueueOptions> {
7
7
  #private;
8
8
  enqueue(run: RunFunction, options?: Partial<PriorityQueueOptions>): void;
9
+ setPriority(id: string, priority: number): void;
9
10
  dequeue(): RunFunction | undefined;
10
11
  filter(options: Readonly<Partial<PriorityQueueOptions>>): RunFunction[];
11
12
  get size(): number;
@@ -2,21 +2,27 @@ import lowerBound from './lower-bound.js';
2
2
  export default class PriorityQueue {
3
3
  #queue = [];
4
4
  enqueue(run, options) {
5
- options = {
6
- priority: 0,
7
- ...options,
8
- };
5
+ const { priority = 0, id, } = options ?? {};
9
6
  const element = {
10
- priority: options.priority,
7
+ priority,
8
+ id,
11
9
  run,
12
10
  };
13
- if (this.size && this.#queue[this.size - 1].priority >= options.priority) {
11
+ if (this.size === 0 || this.#queue[this.size - 1].priority >= priority) {
14
12
  this.#queue.push(element);
15
13
  return;
16
14
  }
17
15
  const index = lowerBound(this.#queue, element, (a, b) => b.priority - a.priority);
18
16
  this.#queue.splice(index, 0, element);
19
17
  }
18
+ setPriority(id, priority) {
19
+ const index = this.#queue.findIndex((element) => element.id === id);
20
+ if (index === -1) {
21
+ throw new ReferenceError(`No promise function with the id "${id}" exists in the queue.`);
22
+ }
23
+ const [item] = this.#queue.splice(index, 1);
24
+ this.enqueue(item.run, { priority, id });
25
+ }
20
26
  dequeue() {
21
27
  const item = this.#queue.shift();
22
28
  return item?.run;
@@ -4,4 +4,5 @@ export type Queue<Element, Options> = {
4
4
  filter: (options: Readonly<Partial<Options>>) => Element[];
5
5
  dequeue: () => Element | undefined;
6
6
  enqueue: (run: Element, options?: Partial<Options>) => void;
7
+ setPriority: (id: string, priority: number) => void;
7
8
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "p-queue",
3
- "version": "8.0.1",
3
+ "version": "9.0.1",
4
4
  "description": "Promise queue with concurrency control",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/p-queue",
@@ -12,11 +12,11 @@
12
12
  },
13
13
  "sideEffects": false,
14
14
  "engines": {
15
- "node": ">=18"
15
+ "node": ">=20"
16
16
  },
17
17
  "scripts": {
18
18
  "build": "del-cli dist && tsc",
19
- "test": "xo && ava && del-cli dist && tsc && tsd",
19
+ "test": "xo && node --import=tsx/esm --test test/*.ts && del-cli dist && tsc && tsd",
20
20
  "bench": "node --import=tsx/esm bench.ts",
21
21
  "prepublishOnly": "del-cli dist && tsc"
22
22
  },
@@ -48,42 +48,34 @@
48
48
  ],
49
49
  "dependencies": {
50
50
  "eventemitter3": "^5.0.1",
51
- "p-timeout": "^6.1.2"
51
+ "p-timeout": "^7.0.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@sindresorhus/tsconfig": "^5.0.0",
54
+ "@sindresorhus/tsconfig": "^8.0.1",
55
55
  "@types/benchmark": "^2.1.5",
56
- "@types/node": "^20.10.4",
57
- "ava": "^5.3.1",
56
+ "@types/node": "^24.5.1",
58
57
  "benchmark": "^2.1.4",
59
- "del-cli": "^5.1.0",
58
+ "del-cli": "^6.0.0",
60
59
  "delay": "^6.0.0",
61
60
  "in-range": "^3.0.0",
62
- "p-defer": "^4.0.0",
63
- "random-int": "^3.0.0",
61
+ "p-defer": "^4.0.1",
62
+ "random-int": "^3.1.0",
64
63
  "time-span": "^5.1.0",
65
- "tsd": "^0.29.0",
66
- "tsx": "^4.6.2",
67
- "typescript": "^5.3.3",
68
- "xo": "^0.56.0"
69
- },
70
- "ava": {
71
- "workerThreads": false,
72
- "files": [
73
- "test/**"
74
- ],
75
- "extensions": {
76
- "ts": "module"
77
- },
78
- "nodeArguments": [
79
- "--import=tsx/esm"
80
- ]
64
+ "tsd": "^0.33.0",
65
+ "tsx": "^4.20.5",
66
+ "typescript": "^5.9.2",
67
+ "xo": "^1.2.2"
81
68
  },
82
69
  "xo": {
83
70
  "rules": {
84
71
  "@typescript-eslint/member-ordering": "off",
85
72
  "@typescript-eslint/no-floating-promises": "off",
86
- "@typescript-eslint/no-invalid-void-type": "off"
73
+ "@typescript-eslint/no-unsafe-call": "off",
74
+ "@typescript-eslint/no-unsafe-assignment": "off",
75
+ "@typescript-eslint/no-unsafe-return": "off",
76
+ "@typescript-eslint/no-unsafe-argument": "off",
77
+ "@typescript-eslint/prefer-promise-reject-errors": "off",
78
+ "ava/no-import-test-files": "off"
87
79
  }
88
80
  }
89
81
  }