From: Jérôme Benoit Date: Tue, 30 Apr 2024 08:01:09 +0000 (+0200) Subject: refactor: refine type definition X-Git-Tag: v4.0.0~1^2~6 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=2be9b4059c132640cf287a08b42047c1cab4e614;p=poolifier.git refactor: refine type definition Signed-off-by: Jérôme Benoit --- 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 } /**