refactor: limit pool internals public exposure
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 4 Jun 2023 11:02:35 +0000 (13:02 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 4 Jun 2023 11:02:35 +0000 (13:02 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
package.json
pnpm-lock.yaml
src/pools/abstract-pool.ts
src/pools/cluster/dynamic.ts
src/pools/cluster/fixed.ts
src/pools/pool.ts
src/pools/thread/dynamic.ts
src/pools/thread/fixed.ts

index 2d9f8dc0c9e05d7570fa5c0cbbbf7d168cbc1928..a456d97104d17851ab61a83de5e79089737985ae 100644 (file)
     "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",
index 003afd75f5428976b8525affe056c1d4f77cace3..e0bf303bb4e5f6eb2d84b332fc149118a81803a2 100644 (file)
@@ -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
index 631434f37618e4727b2a8dcdbee119c309965da1..538d66c797fabc98e93a130953fdde2ee9edfdc8 100644 (file)
@@ -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.
    */
index d4f270a373bc4e0c79198edf7538cb55a62f5e9d..cae9970006fdc1c62bb030d77802cac98eb9ff51 100644 (file)
@@ -34,7 +34,7 @@ export class DynamicClusterPool<
   }
 
   /** @inheritDoc */
-  public get type (): PoolType {
+  protected get type (): PoolType {
     return PoolTypes.dynamic
   }
 
index 78a0b52f8cc5b515c6c300587e518ebc163432a3..0ca0250cecdf4d02f712c5fee30ce699701ba58f 100644 (file)
@@ -100,7 +100,7 @@ export class FixedClusterPool<
   }
 
   /** @inheritDoc */
-  public get type (): PoolType {
+  protected get type (): PoolType {
     return PoolTypes.fixed
   }
 
index f16c54694ab37240e22d47fca1d97fb3d2ec7196..8aae69d463323557197da4a749072989060c0b6a 100644 (file)
@@ -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.
    */
index 79c43b7d5a1b15bdc9b63f7ebd781906c67b5deb..04931b7423423002c6130cd4b07ee0631684ae7b 100644 (file)
@@ -34,7 +34,7 @@ export class DynamicThreadPool<
   }
 
   /** @inheritDoc */
-  public get type (): PoolType {
+  protected get type (): PoolType {
     return PoolTypes.dynamic
   }
 
index cc35f0f971abdb9d1d808e57298a600466c66c73..be1a8baab1f1ac61a9755f1aab009a063863d3fe 100644 (file)
@@ -97,7 +97,7 @@ export class FixedThreadPool<
   }
 
   /** @inheritDoc */
-  public get type (): PoolType {
+  protected get type (): PoolType {
     return PoolTypes.fixed
   }