@venizia/ignis-helpers 0.0.8-9 → 0.0.9-0

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 (132) hide show
  1. package/README.md +20 -20
  2. package/dist/modules/index.d.ts +1 -0
  3. package/dist/modules/index.d.ts.map +1 -1
  4. package/dist/modules/index.js +1 -0
  5. package/dist/modules/index.js.map +1 -1
  6. package/dist/modules/pool/helper.d.ts +100 -0
  7. package/dist/modules/pool/helper.d.ts.map +1 -0
  8. package/dist/modules/pool/helper.js +326 -0
  9. package/dist/modules/pool/helper.js.map +1 -0
  10. package/dist/modules/pool/index.d.ts +3 -0
  11. package/dist/modules/pool/index.d.ts.map +1 -0
  12. package/dist/modules/pool/index.js +19 -0
  13. package/dist/modules/pool/index.js.map +1 -0
  14. package/dist/modules/pool/types.d.ts +62 -0
  15. package/dist/modules/pool/types.d.ts.map +1 -0
  16. package/dist/modules/{redis → pool}/types.js.map +1 -1
  17. package/dist/modules/queue/bullmq/helper.d.ts +3 -3
  18. package/dist/modules/queue/bullmq/helper.d.ts.map +1 -1
  19. package/dist/modules/queue/internal/hf/helper.d.ts +37 -0
  20. package/dist/modules/queue/internal/hf/helper.d.ts.map +1 -0
  21. package/dist/modules/queue/internal/hf/helper.js +82 -0
  22. package/dist/modules/queue/internal/hf/helper.js.map +1 -0
  23. package/dist/modules/queue/internal/hf/index.d.ts +3 -0
  24. package/dist/modules/queue/internal/hf/index.d.ts.map +1 -0
  25. package/dist/modules/queue/internal/hf/index.js +19 -0
  26. package/dist/modules/queue/internal/hf/index.js.map +1 -0
  27. package/dist/modules/queue/internal/hf/types.d.ts +9 -0
  28. package/dist/modules/queue/internal/hf/types.d.ts.map +1 -0
  29. package/dist/modules/queue/internal/hf/types.js +3 -0
  30. package/dist/modules/queue/internal/hf/types.js.map +1 -0
  31. package/dist/modules/queue/internal/index.d.ts +2 -1
  32. package/dist/modules/queue/internal/index.d.ts.map +1 -1
  33. package/dist/modules/queue/internal/index.js +2 -1
  34. package/dist/modules/queue/internal/index.js.map +1 -1
  35. package/dist/modules/queue/internal/sequential/helper.d.ts +40 -0
  36. package/dist/modules/queue/internal/sequential/helper.d.ts.map +1 -0
  37. package/dist/modules/queue/internal/{helper.js → sequential/helper.js} +26 -32
  38. package/dist/modules/queue/internal/sequential/helper.js.map +1 -0
  39. package/dist/modules/queue/internal/sequential/index.d.ts +3 -0
  40. package/dist/modules/queue/internal/sequential/index.d.ts.map +1 -0
  41. package/dist/modules/queue/internal/sequential/index.js +19 -0
  42. package/dist/modules/queue/internal/sequential/index.js.map +1 -0
  43. package/dist/modules/queue/internal/sequential/types.d.ts +35 -0
  44. package/dist/modules/queue/internal/sequential/types.d.ts.map +1 -0
  45. package/dist/modules/queue/internal/sequential/types.js +15 -0
  46. package/dist/modules/queue/internal/sequential/types.js.map +1 -0
  47. package/dist/modules/queue/kafka/base.d.ts +3 -1
  48. package/dist/modules/queue/kafka/base.d.ts.map +1 -1
  49. package/dist/modules/queue/kafka/base.js +11 -0
  50. package/dist/modules/queue/kafka/base.js.map +1 -1
  51. package/dist/modules/queue/kafka/consumer.d.ts +8 -0
  52. package/dist/modules/queue/kafka/consumer.d.ts.map +1 -1
  53. package/dist/modules/queue/kafka/consumer.js +126 -35
  54. package/dist/modules/queue/kafka/consumer.js.map +1 -1
  55. package/dist/modules/redis/base/abstract.helper.d.ts +223 -0
  56. package/dist/modules/redis/base/abstract.helper.d.ts.map +1 -0
  57. package/dist/modules/redis/base/abstract.helper.js +433 -0
  58. package/dist/modules/redis/base/abstract.helper.js.map +1 -0
  59. package/dist/modules/redis/base/index.d.ts +2 -0
  60. package/dist/modules/redis/base/index.d.ts.map +1 -0
  61. package/dist/modules/redis/base/index.js +18 -0
  62. package/dist/modules/redis/base/index.js.map +1 -0
  63. package/dist/modules/redis/cluster/cluster.helper.d.ts +11 -0
  64. package/dist/modules/redis/cluster/cluster.helper.d.ts.map +1 -0
  65. package/dist/modules/redis/{cluster.helper.js → cluster/cluster.helper.js} +3 -3
  66. package/dist/modules/redis/cluster/cluster.helper.js.map +1 -0
  67. package/dist/modules/redis/cluster/index.d.ts +2 -0
  68. package/dist/modules/redis/cluster/index.d.ts.map +1 -0
  69. package/dist/modules/redis/cluster/index.js +18 -0
  70. package/dist/modules/redis/cluster/index.js.map +1 -0
  71. package/dist/modules/redis/common/constants.d.ts +17 -0
  72. package/dist/modules/redis/common/constants.d.ts.map +1 -0
  73. package/dist/modules/redis/common/constants.js +23 -0
  74. package/dist/modules/redis/common/constants.js.map +1 -0
  75. package/dist/modules/redis/common/index.d.ts +4 -0
  76. package/dist/modules/redis/common/index.d.ts.map +1 -0
  77. package/dist/modules/redis/common/index.js +20 -0
  78. package/dist/modules/redis/common/index.js.map +1 -0
  79. package/dist/modules/redis/common/interfaces.d.ts +223 -0
  80. package/dist/modules/redis/common/interfaces.d.ts.map +1 -0
  81. package/dist/modules/redis/common/interfaces.js +3 -0
  82. package/dist/modules/redis/common/interfaces.js.map +1 -0
  83. package/dist/modules/redis/common/types.d.ts +65 -0
  84. package/dist/modules/redis/common/types.d.ts.map +1 -0
  85. package/dist/modules/redis/common/types.js +3 -0
  86. package/dist/modules/redis/common/types.js.map +1 -0
  87. package/dist/modules/redis/factory.d.ts +22 -0
  88. package/dist/modules/redis/factory.d.ts.map +1 -0
  89. package/dist/modules/redis/factory.js +25 -0
  90. package/dist/modules/redis/factory.js.map +1 -0
  91. package/dist/modules/redis/index.d.ts +6 -4
  92. package/dist/modules/redis/index.d.ts.map +1 -1
  93. package/dist/modules/redis/index.js +6 -4
  94. package/dist/modules/redis/index.js.map +1 -1
  95. package/dist/modules/redis/sentinel/index.d.ts +2 -0
  96. package/dist/modules/redis/sentinel/index.d.ts.map +1 -0
  97. package/dist/modules/redis/sentinel/index.js +18 -0
  98. package/dist/modules/redis/sentinel/index.js.map +1 -0
  99. package/dist/modules/redis/sentinel/sentinel.helper.d.ts +8 -0
  100. package/dist/modules/redis/sentinel/sentinel.helper.d.ts.map +1 -0
  101. package/dist/modules/redis/sentinel/sentinel.helper.js +41 -0
  102. package/dist/modules/redis/sentinel/sentinel.helper.js.map +1 -0
  103. package/dist/modules/redis/single/index.d.ts +2 -0
  104. package/dist/modules/redis/single/index.d.ts.map +1 -0
  105. package/dist/modules/redis/single/index.js +18 -0
  106. package/dist/modules/redis/single/index.js.map +1 -0
  107. package/dist/modules/redis/single/single.helper.d.ts +8 -0
  108. package/dist/modules/redis/single/single.helper.d.ts.map +1 -0
  109. package/dist/modules/redis/single/single.helper.js +33 -0
  110. package/dist/modules/redis/single/single.helper.js.map +1 -0
  111. package/dist/modules/socket/socket-io/common/types.d.ts +2 -2
  112. package/dist/modules/socket/socket-io/common/types.d.ts.map +1 -1
  113. package/dist/modules/socket/websocket/common/types.d.ts +3 -3
  114. package/dist/modules/socket/websocket/common/types.d.ts.map +1 -1
  115. package/package.json +7 -6
  116. package/dist/modules/queue/internal/helper.d.ts +0 -69
  117. package/dist/modules/queue/internal/helper.d.ts.map +0 -1
  118. package/dist/modules/queue/internal/helper.js.map +0 -1
  119. package/dist/modules/redis/cluster.helper.d.ts +0 -11
  120. package/dist/modules/redis/cluster.helper.d.ts.map +0 -1
  121. package/dist/modules/redis/cluster.helper.js.map +0 -1
  122. package/dist/modules/redis/default.helper.d.ts +0 -138
  123. package/dist/modules/redis/default.helper.d.ts.map +0 -1
  124. package/dist/modules/redis/default.helper.js +0 -320
  125. package/dist/modules/redis/default.helper.js.map +0 -1
  126. package/dist/modules/redis/single.helper.d.ts +0 -8
  127. package/dist/modules/redis/single.helper.d.ts.map +0 -1
  128. package/dist/modules/redis/single.helper.js +0 -41
  129. package/dist/modules/redis/single.helper.js.map +0 -1
  130. package/dist/modules/redis/types.d.ts +0 -44
  131. package/dist/modules/redis/types.d.ts.map +0 -1
  132. /package/dist/modules/{redis → pool}/types.js +0 -0
package/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  # :fire: IGNIS - @venizia/ignis-helpers
4
4
 
5
- **Production-ready infrastructure utilities for the Ignis Framework**
5
+ **Production-ready infrastructure utilities for the IGNIS Framework**
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/@venizia/ignis-helpers.svg?style=flat-square&color=cb3837)](https://www.npmjs.com/package/@venizia/ignis-helpers)
8
8
  [![License](https://img.shields.io/badge/License-MIT-3DA639.svg?style=flat-square)](https://opensource.org/licenses/MIT)
9
9
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6.svg?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
10
10
 
11
- Logging, Redis, queues (BullMQ/MQTT/Kafka), storage (MinIO/Disk/Memory), cryptography (AES/RSA/ECDH), networking (TCP/TLS/UDP/HTTP), cron, Socket.IO, WebSocket, UID generation, worker threads, and more. Designed to integrate seamlessly with the Ignis IoC container.
11
+ Logging, Redis, queues (BullMQ/MQTT/Kafka), storage (MinIO/Disk/Memory), cryptography (AES/RSA/ECDH), networking (TCP/TLS/UDP/HTTP), cron, Socket.IO, WebSocket, UID generation, worker threads, and more. Designed to integrate seamlessly with the IGNIS IoC container.
12
12
 
13
13
  [Installation](#installation) • [Quick Start](#module-overview) • [API Reference](#logger) • [Documentation](https://venizia-ai.github.io/ignis)
14
14
 
@@ -112,7 +112,7 @@ import { CryptoHelper } from '@venizia/ignis-helpers/crypto';
112
112
  - [Module Utility](#module-utility)
113
113
  - [Common Types](#common-types)
114
114
  - [Key Patterns](#key-patterns)
115
- - [Integration with Ignis Core](#integration-with-ignis-core)
115
+ - [Integration with IGNIS Core](#integration-with-ignis-core)
116
116
  - [Environment Variables Reference](#environment-variables-reference)
117
117
  - [Error Handling Patterns](#error-handling-patterns)
118
118
  - [Performance Tips](#performance-tips)
@@ -161,7 +161,7 @@ import { KafkaProducerHelper, KafkaConsumerHelper, KafkaAdminHelper } from '@ven
161
161
  | `ioredis` | Redis client |
162
162
  | `dayjs` | Date/time utilities |
163
163
  | `hono` | HTTP framework types, JSX re-exports |
164
- | `drizzle-orm` | ORM types (used across Ignis) |
164
+ | `drizzle-orm` | ORM types (used across IGNIS) |
165
165
  | `lodash` | Utility functions |
166
166
  | `reflect-metadata` | Decorator metadata |
167
167
  | `@venizia/ignis-inversion` | IoC container, `@inject`/`@injectable` |
@@ -500,9 +500,9 @@ Full-featured Redis client wrapper around IoRedis supporting single instances an
500
500
  ### Single Instance
501
501
 
502
502
  ```typescript
503
- import { RedisHelper } from '@venizia/ignis-helpers';
503
+ import { RedisSingleHelper } from '@venizia/ignis-helpers';
504
504
 
505
- const redis = new RedisHelper({
505
+ const redis = new RedisSingleHelper({
506
506
  name: 'main-redis',
507
507
  host: '127.0.0.1',
508
508
  port: 6379,
@@ -536,7 +536,7 @@ const cluster = new RedisClusterHelper({
536
536
  });
537
537
  ```
538
538
 
539
- Both `RedisHelper` and `RedisClusterHelper` extend `DefaultRedisHelper`, which provides all data operations. They differ only in how the underlying IoRedis client is created.
539
+ Both `RedisSingleHelper` and `RedisClusterHelper` extend `AbstractRedisHelper`, which provides all data operations. They differ only in how the underlying IoRedis client is created.
540
540
 
541
541
  ### String Operations
542
542
 
@@ -787,7 +787,7 @@ const producer = BullMQHelper.newInstance({
787
787
  queueName: 'email-queue',
788
788
  identifier: 'email-producer',
789
789
  role: 'queue', // 'queue' = producer, 'worker' = consumer
790
- redisConnection: redis, // DefaultRedisHelper instance
790
+ redisConnection: redis, // IRedisHelper instance
791
791
  });
792
792
 
793
793
  // Add jobs to the queue
@@ -1660,7 +1660,7 @@ const io = new SocketIOServerHelper({
1660
1660
  cors: { origin: '*' },
1661
1661
  path: '/socket.io',
1662
1662
  },
1663
- redisConnection: redis, // DefaultRedisHelper instance
1663
+ redisConnection: redis, // IRedisHelper instance
1664
1664
  defaultRooms: ['io-default', 'io-notification'],
1665
1665
  authenticateTimeout: 10_000, // 10s to authenticate
1666
1666
  pingInterval: 30_000, // 30s ping interval
@@ -1784,7 +1784,7 @@ import { WebSocketServerHelper } from '@venizia/ignis-helpers';
1784
1784
  const ws = new WebSocketServerHelper({
1785
1785
  identifier: 'realtime',
1786
1786
  server: bunServer, // Bun server instance (IBunServer)
1787
- redisConnection: redis, // DefaultRedisHelper instance
1787
+ redisConnection: redis, // IRedisHelper instance
1788
1788
  path: '/ws', // Default: '/ws'
1789
1789
  authTimeout: 5_000, // 5s to authenticate (default)
1790
1790
  heartbeatInterval: 30_000, // 30s between heartbeats (default)
@@ -2899,21 +2899,21 @@ interface IConfigurable<Options, Result> {
2899
2899
 
2900
2900
  ---
2901
2901
 
2902
- ## Integration with Ignis Core
2902
+ ## Integration with IGNIS Core
2903
2903
 
2904
- The helpers package is designed to integrate with the Ignis framework's IoC container. Here is how helpers are typically used within an Ignis application:
2904
+ The helpers package is designed to integrate with the IGNIS framework's IoC container. Here is how helpers are typically used within an IGNIS application:
2905
2905
 
2906
2906
  **Binding helpers in the application lifecycle:**
2907
2907
 
2908
2908
  ```typescript
2909
2909
  import { BaseApplication, BootMixin } from '@venizia/ignis';
2910
- import { RedisHelper, Logger } from '@venizia/ignis-helpers';
2910
+ import { RedisSingleHelper, Logger } from '@venizia/ignis-helpers';
2911
2911
 
2912
2912
  class MyApplication extends BootMixin(BaseApplication) {
2913
2913
  async preConfigure() {
2914
2914
  // Register Redis as a singleton binding
2915
2915
  this.container.bind('datasources.Redis').to(
2916
- new RedisHelper({
2916
+ new RedisSingleHelper({
2917
2917
  name: 'main',
2918
2918
  host: process.env.REDIS_HOST,
2919
2919
  port: parseInt(process.env.REDIS_PORT),
@@ -3005,7 +3005,7 @@ Complete table of all environment variables used across all helpers modules.
3005
3005
  All connection helpers use lifecycle hooks for error handling. Errors are never swallowed -- they are logged and forwarded to your callback:
3006
3006
 
3007
3007
  ```typescript
3008
- const redis = new RedisHelper({
3008
+ const redis = new RedisSingleHelper({
3009
3009
  // ...
3010
3010
  onError: ({ name, helper, error }) => {
3011
3011
  // Log to external monitoring
@@ -3116,15 +3116,15 @@ try {
3116
3116
 
3117
3117
  ---
3118
3118
 
3119
- ## About Ignis
3119
+ ## About IGNIS
3120
3120
 
3121
- Ignis brings together the structured, enterprise development experience of **LoopBack 4** with the blazing speed and simplicity of **Hono** -- giving you the best of both worlds.
3121
+ IGNIS brings together the structured, enterprise development experience of **LoopBack 4** with the blazing speed and simplicity of **Hono** -- giving you the best of both worlds.
3122
3122
 
3123
3123
  ## Documentation
3124
3124
 
3125
- - [Ignis Repository](https://github.com/VENIZIA-AI/ignis)
3126
- - [Getting Started](https://github.com/VENIZIA-AI/ignis/blob/main/packages/docs/wiki/get-started/index.md)
3127
- - [Helpers Reference](https://github.com/VENIZIA-AI/ignis/blob/main/packages/docs/wiki/references/helpers/index.md)
3125
+ - [IGNIS Repository](https://github.com/VENIZIA-AI/ignis)
3126
+ - [Getting Started](https://github.com/VENIZIA-AI/ignis/blob/main/docs/wiki/content/get-started/index.md)
3127
+ - [Helpers Reference](https://github.com/VENIZIA-AI/ignis/blob/main/docs/wiki/content/references/helpers/index.md)
3128
3128
 
3129
3129
  ## License
3130
3130
 
@@ -4,6 +4,7 @@ export * from './env';
4
4
  export * from './error';
5
5
  export * from './logger';
6
6
  export * from './network';
7
+ export * from './pool';
7
8
  export * from './queue';
8
9
  export * from './redis';
9
10
  export * from './socket';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AAEvB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AAEvB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC"}
@@ -20,6 +20,7 @@ __exportStar(require("./env"), exports);
20
20
  __exportStar(require("./error"), exports);
21
21
  __exportStar(require("./logger"), exports);
22
22
  __exportStar(require("./network"), exports);
23
+ __exportStar(require("./pool"), exports);
23
24
  __exportStar(require("./queue"), exports);
24
25
  __exportStar(require("./redis"), exports);
25
26
  __exportStar(require("./socket"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AAEvB,2CAAyB;AACzB,wCAAsB;AACtB,0CAAwB;AACxB,2CAAyB;AACzB,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB;AACxB,2CAAyB;AACzB,4CAA0B;AAC1B,4CAA0B;AAC1B,wCAAsB;AACtB,kDAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AAEvB,2CAAyB;AACzB,wCAAsB;AACtB,0CAAwB;AACxB,2CAAyB;AACzB,4CAA0B;AAC1B,yCAAuB;AACvB,0CAAwB;AACxB,0CAAwB;AACxB,2CAAyB;AACzB,4CAA0B;AAC1B,4CAA0B;AAC1B,wCAAsB;AACtB,kDAAgC"}
@@ -0,0 +1,100 @@
1
+ import { ValueOrPromise } from '../../common/types';
2
+ import { BaseHelper } from '../../modules/base';
3
+ import { IPool, IPoolControlOptions, IPoolOptions, IPoolStats } from './types';
4
+ /**
5
+ * Generic single-borrower object pool — skeleton.
6
+ *
7
+ * Holds all pool state and the pairing logic; subclasses supply the resource lifecycle by overriding
8
+ * {@link create} (required) and, optionally, {@link validateResource} / {@link resetResource} /
9
+ * {@link onDestroyResource}. {@link BasePoolHelper} is the concrete, callback-configured subclass.
10
+ *
11
+ * Every pairing of a resource with a waiting acquirer flows through ONE re-entrancy-guarded
12
+ * `dispatch()` loop, so `acquire`/`release`/`use`/`discard`/`warmup` stay thin; each loop branch
13
+ * delegates to a single-purpose helper (`takeIdleResource`, `createAndHand`, `handToWaiter`).
14
+ *
15
+ * The waiter queue is a generic O(1) {@link HfQueueHelper}: enqueue pushes, dequeue advances a head index
16
+ * (skipping cancelled nodes), and a timed-out acquirer is cancelled in O(1) — no Array.shift/splice
17
+ * on the hot path.
18
+ */
19
+ export declare abstract class AbstractPoolHelper<T> extends BaseHelper implements IPool<T> {
20
+ protected readonly size: number;
21
+ protected readonly acquireTimeoutMs?: number;
22
+ protected readonly maxWaitingClients?: number;
23
+ private readonly idle;
24
+ private readonly borrowed;
25
+ private readonly waiterQueue;
26
+ private total;
27
+ private isDispatching;
28
+ private isDestroyed;
29
+ constructor(opts: IPoolControlOptions);
30
+ /** Create one resource. Required. */
31
+ protected abstract create(): ValueOrPromise<T>;
32
+ /** Validate an idle resource just before hand-out; false → destroyed + replaced. Default: always valid. */
33
+ protected validateResource(_opts: {
34
+ resource: T;
35
+ }): ValueOrPromise<boolean>;
36
+ /** Reset an idle resource before hand-out (e.g. clear state). Throw → resource discarded. Default: no-op. */
37
+ protected resetResource(_opts: {
38
+ resource: T;
39
+ }): ValueOrPromise<void>;
40
+ /** Tear down a resource being removed from the pool. Default: no-op. */
41
+ protected onDestroyResource(_opts: {
42
+ resource: T;
43
+ }): ValueOrPromise<void>;
44
+ getStats(): IPoolStats;
45
+ acquire(): Promise<T>;
46
+ release(opts: {
47
+ resource: T;
48
+ }): void;
49
+ warmup(): Promise<void>;
50
+ use<R>(opts: {
51
+ fn: (resource: T) => ValueOrPromise<R>;
52
+ }): Promise<R>;
53
+ discard(opts: {
54
+ resource: T;
55
+ }): Promise<void>;
56
+ destroy(): Promise<void>;
57
+ private createResource;
58
+ private destroyResource;
59
+ /** Fire-and-forget dispatch with logged rejection; shared by all dispatch call sites. */
60
+ private safeDispatch;
61
+ /**
62
+ * Pair servable resources with waiting acquirers, one at a time, until the queue drains or the
63
+ * pool is exhausted. Re-entrancy-guarded so only one loop runs at a time (others no-op and let this
64
+ * loop finish). Each branch delegates to a single-purpose helper.
65
+ */
66
+ private dispatch;
67
+ /** Pop an idle resource and validate+reset it; on ANY failure destroy it and return null (caller retries). */
68
+ private takeIdleResource;
69
+ /** Create a fresh resource and hand it to the next waiter; on create failure, reject that waiter. */
70
+ private createAndHand;
71
+ /**
72
+ * Give a ready resource to the next live waiter. Returns false when no live waiter remains
73
+ * (raced — e.g. it timed out during an await): the resource is returned to idle instead.
74
+ */
75
+ private handToWaiter;
76
+ /** Dequeue the next live waiter and disarm its acquire-timeout so it cannot fire after settlement. */
77
+ private takeNextWaiter;
78
+ private clearWaiterTimer;
79
+ }
80
+ /**
81
+ * Concrete object pool configured by callbacks ({@link IPoolOptions}). Implements the
82
+ * AbstractPoolHelper lifecycle hooks by delegating to `create`/`validate`/`reset`/`destroy`.
83
+ *
84
+ * Each borrow is exclusive until released; `use()` is leak-safe (destroys the resource on error).
85
+ */
86
+ export declare class BasePoolHelper<T> extends AbstractPoolHelper<T> {
87
+ private readonly factory;
88
+ constructor(options: IPoolOptions<T>);
89
+ protected create(): ValueOrPromise<T>;
90
+ protected validateResource(opts: {
91
+ resource: T;
92
+ }): ValueOrPromise<boolean>;
93
+ protected resetResource(opts: {
94
+ resource: T;
95
+ }): ValueOrPromise<void>;
96
+ protected onDestroyResource(opts: {
97
+ resource: T;
98
+ }): ValueOrPromise<void>;
99
+ }
100
+ //# sourceMappingURL=helper.d.ts.map
@@ -0,0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cAAc,CAAC,IAAI,CAAC;cAI1D,iBAAiB,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,CAAC,CAAA;KAAE,GAAG,cAAc,CAAC,IAAI,CAAC;CAGlF"}
@@ -0,0 +1,326 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BasePoolHelper = exports.AbstractPoolHelper = void 0;
4
+ const base_1 = require("../../modules/base");
5
+ const error_1 = require("../../modules/error");
6
+ const hf_1 = require("../../modules/queue/internal/hf");
7
+ /**
8
+ * Generic single-borrower object pool — skeleton.
9
+ *
10
+ * Holds all pool state and the pairing logic; subclasses supply the resource lifecycle by overriding
11
+ * {@link create} (required) and, optionally, {@link validateResource} / {@link resetResource} /
12
+ * {@link onDestroyResource}. {@link BasePoolHelper} is the concrete, callback-configured subclass.
13
+ *
14
+ * Every pairing of a resource with a waiting acquirer flows through ONE re-entrancy-guarded
15
+ * `dispatch()` loop, so `acquire`/`release`/`use`/`discard`/`warmup` stay thin; each loop branch
16
+ * delegates to a single-purpose helper (`takeIdleResource`, `createAndHand`, `handToWaiter`).
17
+ *
18
+ * The waiter queue is a generic O(1) {@link HfQueueHelper}: enqueue pushes, dequeue advances a head index
19
+ * (skipping cancelled nodes), and a timed-out acquirer is cancelled in O(1) — no Array.shift/splice
20
+ * on the hot path.
21
+ */
22
+ class AbstractPoolHelper extends base_1.BaseHelper {
23
+ constructor(opts) {
24
+ super({ scope: opts.scope ?? 'BasePoolHelper' });
25
+ this.idle = [];
26
+ this.borrowed = new Set();
27
+ this.waiterQueue = new hf_1.HfQueueHelper();
28
+ this.total = 0; // live or being-created resources
29
+ this.isDispatching = false;
30
+ this.isDestroyed = false;
31
+ this.size = opts.size;
32
+ this.acquireTimeoutMs = opts.acquireTimeoutMs;
33
+ this.maxWaitingClients = opts.maxWaitingClients;
34
+ }
35
+ /** Validate an idle resource just before hand-out; false → destroyed + replaced. Default: always valid. */
36
+ validateResource(_opts) {
37
+ return true;
38
+ }
39
+ /** Reset an idle resource before hand-out (e.g. clear state). Throw → resource discarded. Default: no-op. */
40
+ resetResource(_opts) {
41
+ return undefined;
42
+ }
43
+ /** Tear down a resource being removed from the pool. Default: no-op. */
44
+ onDestroyResource(_opts) {
45
+ return undefined;
46
+ }
47
+ // ----------------------------------------------------------------------------------------------------------
48
+ getStats() {
49
+ return {
50
+ size: this.size,
51
+ available: this.idle.length,
52
+ borrowed: this.borrowed.size,
53
+ pending: this.waiterQueue.size,
54
+ };
55
+ }
56
+ async acquire() {
57
+ if (this.isDestroyed) {
58
+ throw (0, error_1.getError)({ message: '[acquire] Pool has been destroyed.' });
59
+ }
60
+ if (this.maxWaitingClients !== undefined && this.maxWaitingClients > 0) {
61
+ // Only reject when this acquire would actually have to WAIT: no idle resource and the pool is at
62
+ // capacity. With a free/creatable resource the caller is served, so maxWaitingClients:0 means
63
+ // "serve if available, never queue" rather than "reject everything".
64
+ const isWaitRequired = !this.idle.length && this.total >= this.size;
65
+ if (isWaitRequired && this.waiterQueue.size >= this.maxWaitingClients) {
66
+ throw (0, error_1.getError)({
67
+ message: `[acquire] Too many waiting clients (>= ${this.maxWaitingClients}).`,
68
+ });
69
+ }
70
+ }
71
+ const promise = new Promise((resolve, reject) => {
72
+ const waiter = { resolve, reject, timer: null };
73
+ const node = this.waiterQueue.enqueue({ value: waiter });
74
+ if (this.acquireTimeoutMs !== undefined && this.acquireTimeoutMs > 0) {
75
+ waiter.timer = setTimeout(() => {
76
+ this.waiterQueue.cancel({ node }); // O(1) — dispatch skips it when reached
77
+ reject((0, error_1.getError)({
78
+ message: `[acquire] Acquire timed out after ${this.acquireTimeoutMs}ms.`,
79
+ }));
80
+ }, this.acquireTimeoutMs);
81
+ }
82
+ });
83
+ this.safeDispatch({ action: 'acquire' });
84
+ return promise;
85
+ }
86
+ release(opts) {
87
+ const { resource } = opts;
88
+ const logger = this.logger.for(this.release.name);
89
+ if (!this.borrowed.has(resource)) {
90
+ logger.warn('Called with a foreign/already-released resource; ignoring.');
91
+ return;
92
+ }
93
+ this.borrowed.delete(resource);
94
+ if (this.isDestroyed) {
95
+ this.destroyResource({ resource }).catch(error => {
96
+ logger.warn('destroyResource error on release: %s', error);
97
+ });
98
+ return;
99
+ }
100
+ this.idle.push(resource);
101
+ this.safeDispatch({ action: 'release' });
102
+ }
103
+ async warmup() {
104
+ if (this.isDestroyed) {
105
+ throw (0, error_1.getError)({ message: '[warmup] Pool has been destroyed.' });
106
+ }
107
+ // Create sequentially, re-checking the live `total` before each create so the `size` cap holds
108
+ // under concurrent warmup()/acquire(). createResource() bumps `total` synchronously (before its
109
+ // await), so a re-check here observes in-flight creations from other callers → no overshoot.
110
+ while (this.total < this.size) {
111
+ const resource = await this.createResource();
112
+ this.idle.push(resource);
113
+ }
114
+ this.safeDispatch({ action: 'warmup' });
115
+ }
116
+ async use(opts) {
117
+ const resource = await this.acquire();
118
+ try {
119
+ const result = await opts.fn(resource);
120
+ this.release({ resource });
121
+ return result;
122
+ }
123
+ catch (error) {
124
+ this.logger
125
+ .for(this.use.name)
126
+ .error('fn threw → release skipped, force DISCARD | Error: %s', error);
127
+ await this.discard({ resource });
128
+ throw error;
129
+ }
130
+ }
131
+ async discard(opts) {
132
+ const { resource } = opts;
133
+ if (!this.borrowed.delete(resource)) {
134
+ this.logger.for(this.discard.name).warn('Called with a non-borrowed resource; ignoring.');
135
+ return;
136
+ }
137
+ await this.destroyResource({ resource });
138
+ this.safeDispatch({ action: 'discard' });
139
+ }
140
+ async destroy() {
141
+ this.isDestroyed = true;
142
+ const error = (0, error_1.getError)({ message: '[destroy] Pool destroyed while awaiting a resource.' });
143
+ const draineds = this.waiterQueue.drain();
144
+ for (const waiter of draineds) {
145
+ this.clearWaiterTimer({ waiter });
146
+ waiter.reject(error);
147
+ }
148
+ const toDestroy = this.idle.splice(0);
149
+ await Promise.all(toDestroy.map(resource => this.destroyResource({ resource })));
150
+ }
151
+ // ----------------------------------------------------------------------------------------------------------
152
+ async createResource() {
153
+ this.total += 1; // bump BEFORE await so concurrent dispatch/warmup see the in-flight create (no overshoot)
154
+ try {
155
+ const resource = await this.create();
156
+ return resource;
157
+ }
158
+ catch (error) {
159
+ this.total -= 1;
160
+ this.logger
161
+ .for(this.createResource.name)
162
+ .error('Error creating pool resource | Error: %s', error);
163
+ throw error;
164
+ }
165
+ }
166
+ async destroyResource(opts) {
167
+ this.total -= 1;
168
+ try {
169
+ await this.onDestroyResource(opts);
170
+ }
171
+ catch (error) {
172
+ this.logger.for(this.destroyResource.name).warn('destroy hook threw: %s', error);
173
+ }
174
+ }
175
+ // ----------------------------------------------------------------------------------------------------------
176
+ /** Fire-and-forget dispatch with logged rejection; shared by all dispatch call sites. */
177
+ safeDispatch(opts) {
178
+ this.dispatch().catch(error => {
179
+ this.logger
180
+ .for(this.dispatch.name)
181
+ .warn('dispatch error | action: %s | Error: %s', opts.action, error);
182
+ });
183
+ }
184
+ /**
185
+ * Pair servable resources with waiting acquirers, one at a time, until the queue drains or the
186
+ * pool is exhausted. Re-entrancy-guarded so only one loop runs at a time (others no-op and let this
187
+ * loop finish). Each branch delegates to a single-purpose helper.
188
+ */
189
+ async dispatch() {
190
+ if (this.isDispatching) {
191
+ return;
192
+ }
193
+ this.isDispatching = true;
194
+ try {
195
+ while (this.waiterQueue.size > 0) {
196
+ // Prefer a warm idle resource (LIFO) over creating a new one.
197
+ if (this.idle.length > 0) {
198
+ const resource = await this.takeIdleResource();
199
+ if (resource === null) {
200
+ continue; // bad idle resource was discarded → try the next one
201
+ }
202
+ if (!this.handToWaiter({ resource })) {
203
+ return;
204
+ }
205
+ continue;
206
+ }
207
+ // No idle, but room to grow → create one for the next waiter.
208
+ if (this.total < this.size) {
209
+ await this.createAndHand();
210
+ continue;
211
+ }
212
+ return;
213
+ }
214
+ }
215
+ catch (error) {
216
+ this.logger
217
+ .for(this.dispatch.name)
218
+ .error('[dispatch] Error while dispatching pool element | Error: %s', error);
219
+ }
220
+ finally {
221
+ this.isDispatching = false;
222
+ }
223
+ }
224
+ /** Pop an idle resource and validate+reset it; on ANY failure destroy it and return null (caller retries). */
225
+ async takeIdleResource() {
226
+ const resource = this.idle.pop();
227
+ const logger = this.logger.for(this.takeIdleResource.name);
228
+ let isValid;
229
+ try {
230
+ isValid = await this.validateResource({ resource });
231
+ }
232
+ catch (error) {
233
+ // A throwing validate must NOT leak the popped candidate (would corrupt `total` and can
234
+ // permanently starve the pool); treat it like an invalid resource: discard + retry.
235
+ logger.warn('validate hook threw; discarding resource: %s', error);
236
+ await this.destroyResource({ resource });
237
+ return null;
238
+ }
239
+ if (!isValid) {
240
+ await this.destroyResource({ resource });
241
+ return null;
242
+ }
243
+ try {
244
+ await this.resetResource({ resource });
245
+ }
246
+ catch (error) {
247
+ logger.warn('reset hook threw; discarding resource: %s', error);
248
+ await this.destroyResource({ resource });
249
+ return null;
250
+ }
251
+ return resource;
252
+ }
253
+ /** Create a fresh resource and hand it to the next waiter; on create failure, reject that waiter. */
254
+ async createAndHand() {
255
+ let resource;
256
+ try {
257
+ resource = await this.createResource();
258
+ }
259
+ catch (error) {
260
+ this.takeNextWaiter()?.reject(error);
261
+ return;
262
+ }
263
+ this.handToWaiter({ resource });
264
+ }
265
+ /**
266
+ * Give a ready resource to the next live waiter. Returns false when no live waiter remains
267
+ * (raced — e.g. it timed out during an await): the resource is returned to idle instead.
268
+ */
269
+ handToWaiter(opts) {
270
+ const waiter = this.takeNextWaiter();
271
+ if (!waiter) {
272
+ this.idle.push(opts.resource);
273
+ return false;
274
+ }
275
+ this.borrowed.add(opts.resource);
276
+ waiter.resolve(opts.resource);
277
+ return true;
278
+ }
279
+ /** Dequeue the next live waiter and disarm its acquire-timeout so it cannot fire after settlement. */
280
+ takeNextWaiter() {
281
+ const waiter = this.waiterQueue.dequeue();
282
+ if (waiter) {
283
+ this.clearWaiterTimer({ waiter });
284
+ }
285
+ return waiter;
286
+ }
287
+ clearWaiterTimer(opts) {
288
+ const { waiter } = opts;
289
+ if (waiter.timer) {
290
+ clearTimeout(waiter.timer);
291
+ waiter.timer = null;
292
+ }
293
+ }
294
+ }
295
+ exports.AbstractPoolHelper = AbstractPoolHelper;
296
+ /**
297
+ * Concrete object pool configured by callbacks ({@link IPoolOptions}). Implements the
298
+ * AbstractPoolHelper lifecycle hooks by delegating to `create`/`validate`/`reset`/`destroy`.
299
+ *
300
+ * Each borrow is exclusive until released; `use()` is leak-safe (destroys the resource on error).
301
+ */
302
+ class BasePoolHelper extends AbstractPoolHelper {
303
+ constructor(options) {
304
+ super({
305
+ size: options.size,
306
+ acquireTimeoutMs: options.acquireTimeoutMs,
307
+ maxWaitingClients: options.maxWaitingClients,
308
+ scope: options.scope ?? BasePoolHelper.name,
309
+ });
310
+ this.factory = options;
311
+ }
312
+ create() {
313
+ return this.factory.create();
314
+ }
315
+ validateResource(opts) {
316
+ return this.factory.validate ? this.factory.validate(opts.resource) : true;
317
+ }
318
+ resetResource(opts) {
319
+ return this.factory.reset?.(opts.resource);
320
+ }
321
+ onDestroyResource(opts) {
322
+ return this.factory.destroy?.(opts.resource);
323
+ }
324
+ }
325
+ exports.BasePoolHelper = BasePoolHelper;
326
+ //# sourceMappingURL=helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/modules/pool/helper.ts"],"names":[],"mappings":";;;AACA,yCAA4C;AAC5C,2CAA2C;AAC3C,oDAA4D;AAG5D;;;;;;;;;;;;;;GAcG;AACH,MAAsB,kBAAsB,SAAQ,iBAAU;IAa5D,YAAY,IAAyB;QACnC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,gBAAgB,EAAE,CAAC,CAAC;QATlC,SAAI,GAAQ,EAAE,CAAC;QACf,aAAQ,GAAG,IAAI,GAAG,EAAK,CAAC;QACxB,gBAAW,GAAG,IAAI,kBAAa,EAAkB,CAAC;QAE3D,UAAK,GAAG,CAAC,CAAC,CAAC,kCAAkC;QAC7C,kBAAa,GAAG,KAAK,CAAC;QACtB,gBAAW,GAA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AAC,MAAM,EAAE,CAAC;IAC/B,CAAC;IAEkB,gBAAgB,CAAC,IAAqB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7E,CAAC;IAEkB,aAAa,CAAC,IAAqB;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAEkB,iBAAiB,CAAC,IAAqB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC;CACF;AA5BD,wCA4BC"}
@@ -0,0 +1,3 @@
1
+ export * from './helper';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/pool/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./helper"), exports);
18
+ __exportStar(require("./types"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/pool/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB"}