@onebun/core 0.2.12 → 0.2.14
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.
- package/package.json +2 -2
- package/src/application/application.test.ts +0 -7
- package/src/application/application.ts +3 -2
- package/src/decorators/metadata.test.ts +86 -0
- package/src/decorators/metadata.ts +199 -0
- package/src/docs-examples.test.ts +95 -0
- package/src/index.ts +1 -0
- package/src/module/module.ts +36 -0
- package/src/queue/adapters/memory.adapter.test.ts +0 -4
- package/src/queue/adapters/memory.adapter.ts +0 -46
- package/src/queue/adapters/redis.adapter.test.ts +0 -64
- package/src/queue/adapters/redis.adapter.ts +0 -41
- package/src/queue/docs-examples.test.ts +130 -9
- package/src/queue/index.ts +8 -1
- package/src/queue/queue-service-proxy.test.ts +12 -3
- package/src/queue/queue-service-proxy.ts +37 -7
- package/src/queue/queue.service.test.ts +138 -16
- package/src/queue/queue.service.ts +48 -11
- package/src/queue/scheduler.test.ts +280 -0
- package/src/queue/scheduler.ts +143 -1
- package/src/queue/types.ts +80 -31
- package/src/types.ts +10 -6
package/src/types.ts
CHANGED
|
@@ -198,7 +198,8 @@ export interface TypedEnvSchema {
|
|
|
198
198
|
/**
|
|
199
199
|
* Application options
|
|
200
200
|
*/
|
|
201
|
-
|
|
201
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
202
|
+
export interface ApplicationOptions<QA extends QueueAdapterConstructor<any> = QueueAdapterConstructor> {
|
|
202
203
|
/**
|
|
203
204
|
* Application name (used for metrics and tracing labels)
|
|
204
205
|
*/
|
|
@@ -431,7 +432,7 @@ export interface ApplicationOptions {
|
|
|
431
432
|
/**
|
|
432
433
|
* Queue configuration
|
|
433
434
|
*/
|
|
434
|
-
queue?: QueueApplicationOptions
|
|
435
|
+
queue?: QueueApplicationOptions<QA>;
|
|
435
436
|
|
|
436
437
|
/**
|
|
437
438
|
* Static file serving: serve files from a directory for requests not matched by API routes.
|
|
@@ -544,15 +545,18 @@ export interface ApplicationOptions {
|
|
|
544
545
|
export type QueueAdapterType = 'memory' | 'redis';
|
|
545
546
|
|
|
546
547
|
/**
|
|
547
|
-
* Queue configuration for OneBunApplication
|
|
548
|
+
* Queue configuration for OneBunApplication.
|
|
549
|
+
* Generic parameter `A` infers the adapter constructor type, so `options`
|
|
550
|
+
* is automatically typed to match the adapter's constructor argument.
|
|
548
551
|
*/
|
|
549
|
-
|
|
552
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
553
|
+
export interface QueueApplicationOptions<A extends QueueAdapterConstructor<any> = QueueAdapterConstructor> {
|
|
550
554
|
/** Enable/disable queue (default: auto - enabled if handlers exist) */
|
|
551
555
|
enabled?: boolean;
|
|
552
556
|
/** Adapter type, or custom adapter constructor (e.g. for NATS JetStream) */
|
|
553
|
-
adapter?: QueueAdapterType |
|
|
557
|
+
adapter?: QueueAdapterType | A;
|
|
554
558
|
/** Options passed to the custom adapter constructor when adapter is a class */
|
|
555
|
-
options?:
|
|
559
|
+
options?: A extends QueueAdapterConstructor<infer O> ? O : never;
|
|
556
560
|
/** Redis-specific options (only used when adapter is 'redis') */
|
|
557
561
|
redis?: {
|
|
558
562
|
/** Use shared Redis provider instead of dedicated connection */
|