From 8881ae32256c9a9ebe6d78c95672f610a3f46719 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 4 Jun 2023 13:02:35 +0200 Subject: [PATCH] refactor: limit pool internals public exposure MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- package.json | 2 +- pnpm-lock.yaml | 14 +++++++------- src/pools/abstract-pool.ts | 10 +++++++--- src/pools/cluster/dynamic.ts | 2 +- src/pools/cluster/fixed.ts | 2 +- src/pools/pool.ts | 6 ------ src/pools/thread/dynamic.ts | 2 +- src/pools/thread/fixed.ts | 2 +- 8 files changed, 19 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 2d9f8dc0..a456d971 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "eslint-define-config": "^1.20.0", "eslint-import-resolver-typescript": "^3.5.5", "eslint-plugin-import": "^2.27.5", - "eslint-plugin-jsdoc": "^46.2.1", + "eslint-plugin-jsdoc": "^46.2.2", "eslint-plugin-n": "^16.0.0", "eslint-plugin-promise": "^6.1.1", "eslint-plugin-spellcheck": "^0.0.20", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 003afd75..e0bf303b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -57,8 +57,8 @@ devDependencies: specifier: ^2.27.5 version: 2.27.5(@typescript-eslint/parser@5.59.8)(eslint-import-resolver-typescript@3.5.5)(eslint@8.42.0) eslint-plugin-jsdoc: - specifier: ^46.2.1 - version: 46.2.1(eslint@8.42.0) + specifier: ^46.2.2 + version: 46.2.2(eslint@8.42.0) eslint-plugin-n: specifier: ^16.0.0 version: 16.0.0(eslint@8.42.0) @@ -778,8 +778,8 @@ packages: resolution: {integrity: sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==} dev: true - /@sindresorhus/is@5.4.0: - resolution: {integrity: sha512-Ggh6E9AnMpiNXlbXfFUcWE9qm408rL8jDi7+PMBBx7TMbwEmiqAiSmZ+zydYwxcJLqPGNDoLc9mXDuMDBZg0sA==} + /@sindresorhus/is@5.4.1: + resolution: {integrity: sha512-axlrvsHlHlFmKKMEg4VyvMzFr93JWJj4eIfXY1STVuO2fsImCa7ncaiG5gC8HKOX590AW5RtRsC41/B+OfrSqw==} engines: {node: '>=14.16'} dev: true @@ -2351,8 +2351,8 @@ packages: - supports-color dev: true - /eslint-plugin-jsdoc@46.2.1(eslint@8.42.0): - resolution: {integrity: sha512-rsv3EE2FGDpYTSnIzDHpf9SsB7ccTmCl8dMcJzpBAOLiJ1maIMYMOfPDqT1IB+Y21muD894xhO6BTrOIvY5mfg==} + /eslint-plugin-jsdoc@46.2.2(eslint@8.42.0): + resolution: {integrity: sha512-s85g93FT54emQX/h+Aoh1+SFrIz/C327gn+t8YS4md82/iNFWNp+qjT88MNH9XwD0rrhUqxE39xh46+RTGRyYw==} engines: {node: '>=16'} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -3029,7 +3029,7 @@ packages: resolution: {integrity: sha512-mThBblvlAF1d4O5oqyvN+ZxLAYwIJK7bpMxgYqPD9okW0C3qm5FFn7k811QrcuEBwaogR3ngOFoCfs6mRv7teQ==} engines: {node: '>=14.16'} dependencies: - '@sindresorhus/is': 5.4.0 + '@sindresorhus/is': 5.4.1 '@szmarczak/http-timer': 5.0.1 cacheable-lookup: 7.0.0 cacheable-request: 10.2.10 diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 631434f3..538d66c7 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -211,9 +211,6 @@ export abstract class AbstractPool< } } - /** @inheritDoc */ - public abstract get type (): PoolType - /** @inheritDoc */ public get info (): PoolInfo { return { @@ -249,6 +246,13 @@ export abstract class AbstractPool< } } + /** + * Pool type. + * + * If it is `'dynamic'`, it provides the `max` property. + */ + protected abstract get type (): PoolType + /** * Gets the worker type. */ diff --git a/src/pools/cluster/dynamic.ts b/src/pools/cluster/dynamic.ts index d4f270a3..cae99700 100644 --- a/src/pools/cluster/dynamic.ts +++ b/src/pools/cluster/dynamic.ts @@ -34,7 +34,7 @@ export class DynamicClusterPool< } /** @inheritDoc */ - public get type (): PoolType { + protected get type (): PoolType { return PoolTypes.dynamic } diff --git a/src/pools/cluster/fixed.ts b/src/pools/cluster/fixed.ts index 78a0b52f..0ca0250c 100644 --- a/src/pools/cluster/fixed.ts +++ b/src/pools/cluster/fixed.ts @@ -100,7 +100,7 @@ export class FixedClusterPool< } /** @inheritDoc */ - public get type (): PoolType { + protected get type (): PoolType { return PoolTypes.fixed } diff --git a/src/pools/pool.ts b/src/pools/pool.ts index f16c5469..8aae69d4 100644 --- a/src/pools/pool.ts +++ b/src/pools/pool.ts @@ -158,12 +158,6 @@ export interface IPool< Data = unknown, Response = unknown > { - /** - * Pool type. - * - * If it is `'dynamic'`, it provides the `max` property. - */ - readonly type: PoolType /** * Pool information. */ diff --git a/src/pools/thread/dynamic.ts b/src/pools/thread/dynamic.ts index 79c43b7d..04931b74 100644 --- a/src/pools/thread/dynamic.ts +++ b/src/pools/thread/dynamic.ts @@ -34,7 +34,7 @@ export class DynamicThreadPool< } /** @inheritDoc */ - public get type (): PoolType { + protected get type (): PoolType { return PoolTypes.dynamic } diff --git a/src/pools/thread/fixed.ts b/src/pools/thread/fixed.ts index cc35f0f9..be1a8baa 100644 --- a/src/pools/thread/fixed.ts +++ b/src/pools/thread/fixed.ts @@ -97,7 +97,7 @@ export class FixedThreadPool< } /** @inheritDoc */ - public get type (): PoolType { + protected get type (): PoolType { return PoolTypes.fixed } -- 2.34.1