@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/src/types.ts CHANGED
@@ -198,7 +198,8 @@ export interface TypedEnvSchema {
198
198
  /**
199
199
  * Application options
200
200
  */
201
- export interface ApplicationOptions {
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
- export interface QueueApplicationOptions {
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 | QueueAdapterConstructor;
557
+ adapter?: QueueAdapterType | A;
554
558
  /** Options passed to the custom adapter constructor when adapter is a class */
555
- options?: unknown;
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 */