From 2be9b4059c132640cf287a08b42047c1cab4e614 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 30 Apr 2024 10:01:09 +0200 Subject: [PATCH] refactor: refine type definition MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- SECURITY.md | 3 ++- src/index.ts | 2 ++ src/pools/abstract-pool.ts | 2 +- src/priority-queue.ts | 4 ++-- src/utility-types.ts | 8 +++----- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index da268313..d42dfb7a 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,7 +6,8 @@ Security matrix, currently there are no security vulnerabilities. | Version | Supported | | ------- | ------------------ | -| 3.x.x | :white_check_mark: | +| 4.x.x | :white_check_mark: | +| 3.x.x | :x: | | 2.x.x | :x: | | 1.x.x | :x: | diff --git a/src/index.ts b/src/index.ts index a0081a47..cba06414 100644 --- a/src/index.ts +++ b/src/index.ts @@ -54,6 +54,7 @@ export type { MessageValue, PromiseResponseWrapper, Task, + TaskFunctionProperties, TaskPerformance, WorkerError, WorkerStatistics, @@ -65,6 +66,7 @@ export { ClusterWorker } from './worker/cluster-worker.js' export type { TaskAsyncFunction, TaskFunction, + TaskFunctionObject, TaskFunctionOperationResult, TaskFunctions, TaskSyncFunction diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 9a7199ec..ba632bb1 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -1294,7 +1294,7 @@ export abstract class AbstractPool< } /** - * Chooses a worker node for the next task. + * Chooses a worker node for the next task given the worker choice strategy. * * @param workerChoiceStrategy - The worker choice strategy. * @returns The chosen worker node key diff --git a/src/priority-queue.ts b/src/priority-queue.ts index 3c26ff35..64b5a924 100644 --- a/src/priority-queue.ts +++ b/src/priority-queue.ts @@ -29,7 +29,7 @@ export class PriorityQueue { /** * Constructs a priority queue. * - * @param k - Prioritized bucket size. + * @param k - Prioritized bucket size. @defaultValue Infinity */ public constructor (k = Infinity) { if (k !== Infinity && !Number.isSafeInteger(k)) { @@ -121,7 +121,7 @@ export class PriorityQueue { /** * Returns an iterator for the priority queue. * - * @returns An iterator for the deque. + * @returns An iterator for the priority queue. * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols */ [Symbol.iterator] (): Iterator { diff --git a/src/utility-types.ts b/src/utility-types.ts index aa4e2198..82f79230 100644 --- a/src/utility-types.ts +++ b/src/utility-types.ts @@ -67,22 +67,20 @@ export interface WorkerStatistics { /** * Task function properties. - * - * @internal */ export interface TaskFunctionProperties { /** * Task function name. */ - name: string + readonly name: string /** * Task function priority. Lower values have higher priority. */ - priority?: number + readonly priority?: number /** * Task function worker choice strategy. */ - strategy?: WorkerChoiceStrategy + readonly strategy?: WorkerChoiceStrategy } /** -- 2.34.1