balda 0.0.3 → 0.0.4

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/lib/index.d.ts CHANGED
@@ -11,10 +11,11 @@ import { RequestHandler, Router as Router$1, IRouter } from 'express';
11
11
  export { ErrorRequestHandler as ExpressErrorMiddleware, RequestHandler as ExpressMiddleware, NextFunction as ExpressNextFunction, Request as ExpressRequest, Response as ExpressResponse } from 'express';
12
12
  import * as pino from 'pino';
13
13
  import pino__default, { pino as pino$1 } from 'pino';
14
+ import { TSchema } from '@sinclair/typebox';
15
+ import { IClientSubscribeOptions, IClientOptions, IClientPublishOptions, MqttClient } from 'mqtt';
16
+ import { SQSClientConfig, SQSClient } from '@aws-sdk/client-sqs';
14
17
  import { Queue, Job } from 'bullmq';
15
18
  import { PgBoss } from 'pg-boss';
16
- import { SQSClient, SQSClientConfig } from '@aws-sdk/client-sqs';
17
- import { IClientSubscribeOptions, IClientOptions, IClientPublishOptions, MqttClient } from 'mqtt';
18
19
  import { AsyncLocalStorage } from 'node:async_hooks';
19
20
  import { S3Client } from '@aws-sdk/client-s3';
20
21
 
@@ -1095,14 +1096,15 @@ type ClientRouter = Omit<Router, "applyGlobalMiddlewaresToAllRoutes" | "addOrUpd
1095
1096
  * The server class that is used to create and manage the server
1096
1097
  */
1097
1098
  declare class Server<H extends NodeHttpClient = NodeHttpClient> implements ServerInterface {
1099
+ readonly _brand: "BaldaServer";
1098
1100
  isListening: boolean;
1099
1101
  isProduction: boolean;
1100
1102
  graphql: GraphQL;
1103
+ readonly serverOptions: ResolvedServerOptions;
1101
1104
  readonly router: ClientRouter;
1102
1105
  private wasInitialized;
1103
1106
  private serverConnector;
1104
1107
  private globalMiddlewares;
1105
- private serverOptions;
1106
1108
  private controllerImportBlacklistedPaths;
1107
1109
  private notFoundHandler?;
1108
1110
  private readonly nativeEnv;
@@ -1664,6 +1666,10 @@ type ResolvedServerOptions = {
1664
1666
  };
1665
1667
  type ServerErrorHandler = (req: Request$1, res: Response$1, next: NextFunction, error: Error) => SyncOrAsync;
1666
1668
  interface ServerInterface {
1669
+ /**
1670
+ * Identifier for the balda server instance
1671
+ */
1672
+ _brand: "BaldaServer";
1667
1673
  /**
1668
1674
  * Whether the server is in production mode NODE_ENV is set to "production"
1669
1675
  */
@@ -1689,6 +1695,10 @@ interface ServerInterface {
1689
1695
  * @warning Must be used before `listen` method
1690
1696
  */
1691
1697
  tapOptions?: ServerTapOptions;
1698
+ /**
1699
+ * Server options passed to the constructor
1700
+ */
1701
+ serverOptions: ResolvedServerOptions;
1692
1702
  /**
1693
1703
  * Main singleton router instance of the server
1694
1704
  */
@@ -1963,7 +1973,7 @@ interface SerializeOptions {
1963
1973
  safe?: boolean;
1964
1974
  }
1965
1975
 
1966
- declare const serialize: <T extends ZodType | AjvCompileParams[0]>(schema: T, options?: SerializeOptions) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
1976
+ declare const serialize: <T extends ZodType | TSchema | AjvCompileParams[0]>(schema: T, options?: SerializeOptions) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
1967
1977
 
1968
1978
  interface CustomValidationError {
1969
1979
  status?: number;
@@ -1971,17 +1981,17 @@ interface CustomValidationError {
1971
1981
  }
1972
1982
  interface ValidationOptions {
1973
1983
  /**
1974
- * The schema to validate the request body against (Zod schema or OpenAPI schema)
1984
+ * The schema to validate the request body against (Zod, TypeBox, or plain JSON schema)
1975
1985
  */
1976
- body?: ZodType | AjvCompileParams[0];
1986
+ body?: ZodType | TSchema | AjvCompileParams[0];
1977
1987
  /**
1978
- * The schema to validate the query parameters against (Zod schema or OpenAPI schema)
1988
+ * The schema to validate the query parameters against (Zod, TypeBox, or plain JSON schema)
1979
1989
  */
1980
- query?: ZodType | AjvCompileParams[0];
1990
+ query?: ZodType | TSchema | AjvCompileParams[0];
1981
1991
  /**
1982
- * The schema to validate both body and query against (Zod schema or OpenAPI schema)
1992
+ * The schema to validate both body and query against (Zod, TypeBox, or plain JSON schema)
1983
1993
  */
1984
- all?: ZodType | AjvCompileParams[0];
1994
+ all?: ZodType | TSchema | AjvCompileParams[0];
1985
1995
  /**
1986
1996
  * Whether to use safe validation (returns original data if validation fails instead of throwing)
1987
1997
  * @default false
@@ -2040,92 +2050,6 @@ declare class CronService {
2040
2050
  }
2041
2051
  declare const setCronGlobalErrorHandler: (globalErrorHandler: (...args: Parameters<(typeof CronService)["globalErrorHandler"]>) => void) => void;
2042
2052
 
2043
- declare class BullMQPubSub implements PubSub<"bullmq"> {
2044
- private queues;
2045
- private workers;
2046
- private bullmqClient;
2047
- publish<T extends QueueTopicKey>(topic: T, payload: QueueTopic[T], options?: PublishOptions<"bullmq">): Promise<{
2048
- id: string;
2049
- }>;
2050
- subscribe<T extends QueueTopicKey>(topic: T, handler: (payload: QueueTopic[T]) => Promise<void>): Promise<void>;
2051
- private getQueue;
2052
- private getBullMQClient;
2053
- }
2054
-
2055
- declare class PGBossPubSub implements PubSub<"pgboss"> {
2056
- private boss;
2057
- private createdQueues;
2058
- publish<T extends QueueTopicKey>(topic: T, payload: QueueTopic[T], options?: PublishOptions<"pgboss">): Promise<{
2059
- id: string;
2060
- }>;
2061
- subscribe<T extends QueueTopicKey>(topic: T, handler: (payload: QueueTopic[T]) => Promise<void>): Promise<void>;
2062
- private getBoss;
2063
- private ensureQueue;
2064
- }
2065
-
2066
- declare class SQSPubSub implements PubSub<"sqs"> {
2067
- private consumers;
2068
- private client?;
2069
- private sqsLib;
2070
- private sqsConsumerLib;
2071
- publish<T extends QueueTopicKey>(topic: T, payload: QueueTopic[T], options?: PublishOptions<"sqs">): Promise<{
2072
- id: string;
2073
- }>;
2074
- subscribe<T extends QueueTopicKey>(topic: T, handler: (payload: QueueTopic[T]) => Promise<void>): Promise<void>;
2075
- private getClient;
2076
- private getSqsLib;
2077
- private getSqsConsumerLib;
2078
- private resolveQueueUrl;
2079
- }
2080
-
2081
- type BullMQAddTaskOptions = Parameters<Queue["add"]>[2];
2082
- type PGBossSendOptions = Parameters<PgBoss["send"]>[2];
2083
- type SQSPublishOptions = Parameters<SQSClient["send"]>[0];
2084
- type PublishOptions<T extends QueueProviderKey> = T extends "bullmq" ? BullMQAddTaskOptions : T extends "sqs" ? SQSPublishOptions : T extends "pgboss" ? PGBossSendOptions : never;
2085
- interface QueueTopic {
2086
- }
2087
- type QueueTopicKey = keyof QueueTopic;
2088
- interface PubSub<P extends QueueProviderKey = any> {
2089
- publish: <T extends QueueTopicKey>(topic: T, payload: QueueTopic[T], options: PublishOptions<P>) => Promise<{
2090
- id: string;
2091
- }>;
2092
- subscribe: <T extends QueueTopicKey>(topic: T, handler: (payload: QueueTopic[T]) => Promise<void>) => Promise<void>;
2093
- }
2094
- interface QueueProvider {
2095
- bullmq: BullMQPubSub;
2096
- sqs: SQSPubSub;
2097
- pgboss: PGBossPubSub;
2098
- }
2099
- type QueueProviderKey = keyof QueueProvider;
2100
-
2101
- /**
2102
- * Decorator to register a queue handler
2103
- * @param provider - The provider to use
2104
- * @param topic - The topic to subscribe to
2105
- * @returns A function to decorate the handler
2106
- */
2107
- declare const queue: {
2108
- <P extends QueueProviderKey, T extends QueueTopicKey>(provider: P, topic: T): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
2109
- bullmq<T extends QueueTopicKey>(topic: T): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
2110
- sqs<T extends QueueTopicKey>(topic: T): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
2111
- pgboss<T extends QueueTopicKey>(topic: T): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
2112
- };
2113
-
2114
- type QueueRegistration = {
2115
- name: string;
2116
- topic: QueueTopicKey;
2117
- handler: (payload: any) => Promise<void>;
2118
- provider: QueueProviderKey;
2119
- };
2120
- declare class QueueService {
2121
- static scheduledSubscribers: QueueRegistration[];
2122
- static register(name: string, topic: QueueRegistration["topic"], handler: QueueRegistration["handler"], options?: {
2123
- provider?: QueueProviderKey;
2124
- }): void;
2125
- static run(): Promise<void>;
2126
- static massiveImportQueues(queueHandlerPatterns: string[]): Promise<void>;
2127
- }
2128
-
2129
2053
  /**
2130
2054
  * Base class for MQTT handlers with logger instance
2131
2055
  * @example
@@ -2245,8 +2169,10 @@ declare const mqtt: MqttService;
2245
2169
  /**
2246
2170
  * Base class for queue handlers with logger instance
2247
2171
  * @example
2172
+ * const myQueue = bullmqQueue<MyPayload>("my-topic");
2173
+ *
2248
2174
  * export default class MyQueue extends BaseQueue {
2249
- * @queue("bullmq", "my-topic")
2175
+ * @myQueue.subscribe()
2250
2176
  * async handle(payload: MyPayload) {
2251
2177
  * this.logger.info({ payload }, "Processing queue message");
2252
2178
  * }
@@ -2256,6 +2182,89 @@ declare class BaseQueue {
2256
2182
  protected readonly logger: pino.Logger<string, boolean>;
2257
2183
  }
2258
2184
 
2185
+ declare class PGBossPubSub implements GenericPubSub {
2186
+ private boss;
2187
+ private createdQueues;
2188
+ publish<TPayload>(topic: string, payload: TPayload, options?: PublishOptions<"pgboss">): Promise<{
2189
+ id: string;
2190
+ }>;
2191
+ subscribe<TPayload>(topic: string, handler: (payload: TPayload) => Promise<void>): Promise<void>;
2192
+ private getBoss;
2193
+ private ensureQueue;
2194
+ publishWithConfig<TPayload>(topic: string, payload: TPayload, options?: PublishOptions<"pgboss">, queueConfig?: PGBossQueueOptions): Promise<{
2195
+ id: string;
2196
+ }>;
2197
+ subscribeWithConfig<TPayload>(topic: string, handler: (payload: TPayload) => Promise<void>, queueConfig?: PGBossQueueOptions): Promise<void>;
2198
+ private bossInstances;
2199
+ private getBossWithConfig;
2200
+ private ensureQueueWithBoss;
2201
+ }
2202
+
2203
+ declare class SQSPubSub implements GenericPubSub {
2204
+ private consumers;
2205
+ private client?;
2206
+ private sqsLib;
2207
+ private sqsConsumerLib;
2208
+ publish<TPayload>(topic: string, payload: TPayload, options?: PublishOptions<"sqs">): Promise<{
2209
+ id: string;
2210
+ }>;
2211
+ subscribe<TPayload>(topic: string, handler: (payload: TPayload) => Promise<void>): Promise<void>;
2212
+ private getClient;
2213
+ private getSqsLib;
2214
+ private getSqsConsumerLib;
2215
+ private resolveQueueUrl;
2216
+ publishWithConfig<TPayload>(topic: string, payload: TPayload, options?: PublishOptions<"sqs">, queueConfig?: SQSQueueOptions): Promise<{
2217
+ id: string;
2218
+ }>;
2219
+ subscribeWithConfig<TPayload>(topic: string, handler: (payload: TPayload) => Promise<void>, queueConfig?: SQSQueueOptions): Promise<void>;
2220
+ private getClientWithConfig;
2221
+ }
2222
+
2223
+ type BullMQAddTaskOptions = Parameters<Queue["add"]>[2];
2224
+ type PGBossSendOptions = Parameters<PgBoss["send"]>[2];
2225
+ type SQSPublishOptions = Parameters<SQSClient["send"]>[0];
2226
+ type BuiltInProviderKey = "bullmq" | "sqs" | "pgboss";
2227
+ type PublishOptions<T extends BuiltInProviderKey> = T extends "bullmq" ? BullMQAddTaskOptions : T extends "sqs" ? SQSPublishOptions : T extends "pgboss" ? PGBossSendOptions : never;
2228
+ type SQSQueueOptions = {
2229
+ queueUrl: string;
2230
+ client?: SQSClientConfig;
2231
+ };
2232
+ type BullMQQueueOptions = ConstructorParameters<typeof Queue>[1];
2233
+ type PGBossQueueOptions = {
2234
+ connectionString?: string;
2235
+ };
2236
+ interface GenericPubSub<TPayload = unknown> {
2237
+ publish(topic: string, payload: TPayload, options?: Record<string, unknown>): Promise<{
2238
+ id: string;
2239
+ }>;
2240
+ subscribe(topic: string, handler: (payload: TPayload) => Promise<void>): Promise<void>;
2241
+ }
2242
+ interface QueueProvider {
2243
+ bullmq: BullMQPubSub;
2244
+ sqs: SQSPubSub;
2245
+ pgboss: PGBossPubSub;
2246
+ }
2247
+ type QueueProviderKey = keyof QueueProvider;
2248
+
2249
+ declare class BullMQPubSub implements GenericPubSub {
2250
+ private queues;
2251
+ private workers;
2252
+ private bullmqClient;
2253
+ publish<TPayload>(topic: string, payload: TPayload, options?: PublishOptions<"bullmq">): Promise<{
2254
+ id: string;
2255
+ }>;
2256
+ subscribe<TPayload>(topic: string, handler: (payload: TPayload) => Promise<void>): Promise<void>;
2257
+ private getQueue;
2258
+ private getBullMQClient;
2259
+ publishWithConfig<TPayload>(topic: string, payload: TPayload, options?: PublishOptions<"bullmq">, queueConfig?: BullMQQueueOptions): Promise<{
2260
+ id: string;
2261
+ }>;
2262
+ subscribeWithConfig<TPayload>(topic: string, handler: (payload: TPayload) => Promise<void>, queueConfig?: BullMQQueueOptions): Promise<void>;
2263
+ private getQueueWithConfig;
2264
+ private getQueueKey;
2265
+ private getWorkerKey;
2266
+ }
2267
+
2259
2268
  /**
2260
2269
  * Options for BullMQ configuration
2261
2270
  * @param options - The options for BullMQ
@@ -2273,7 +2282,7 @@ declare class BullMQConfiguration {
2273
2282
  */
2274
2283
  declare const defineBullMQConfiguration: (options: BullMQConfigurationOptions) => void;
2275
2284
 
2276
- type CustomQueueConfiguration = PubSub;
2285
+ type CustomQueueConfiguration = GenericPubSub;
2277
2286
 
2278
2287
  type PGBossConfigurationOptions = {
2279
2288
  connectionString?: string;
@@ -2291,7 +2300,7 @@ type SQSConfigurationOptions = {
2291
2300
  batchSize?: number;
2292
2301
  visibilityTimeout?: number;
2293
2302
  waitTimeSeconds?: number;
2294
- queueUrlMap: Record<QueueTopicKey, string>;
2303
+ queueUrlMap: Record<string, string>;
2295
2304
  };
2296
2305
  errorHandler?: (error: Error) => SyncOrAsync;
2297
2306
  };
@@ -2300,33 +2309,10 @@ declare class SQSConfiguration {
2300
2309
  }
2301
2310
  declare const defineSQSConfiguration: (options: SQSConfigurationOptions) => void;
2302
2311
 
2303
- /**
2304
- * Main publisher for balda queue, has shortcuts for base providers, e.g. `publish.bullmq`
2305
- * @param provider - The provider to use
2306
- * @param topic - The topic to publish to
2307
- * @param payload - The payload to publish
2308
- * @param options - The options to use
2309
- * @returns The id of the published job
2310
- */
2311
- declare const publish: {
2312
- <P extends QueueProviderKey, T extends QueueTopicKey>(provider: P, topic: T, payload: QueueTopic[T], options?: PublishOptions<P>): Promise<{
2313
- id: string;
2314
- }>;
2315
- bullmq<T extends QueueTopicKey>(topic: T, payload: QueueTopic[T], options?: PublishOptions<"bullmq">): Promise<{
2316
- id: string;
2317
- }>;
2318
- sqs<T extends QueueTopicKey>(topic: T, payload: QueueTopic[T], options?: PublishOptions<"sqs">): Promise<{
2319
- id: string;
2320
- }>;
2321
- pgboss<T extends QueueTopicKey>(topic: T, payload: QueueTopic[T], options?: PublishOptions<"pgboss">): Promise<{
2322
- id: string;
2323
- }>;
2324
- };
2325
-
2326
2312
  declare class QueueManager {
2327
- static map: Map<QueueProviderKey, PubSub>;
2328
- static getProvider<P extends QueueProviderKey>(provider: P): PubSub<P>;
2329
- static setProvider(provider: QueueProviderKey, pubsub: PubSub<QueueProviderKey>): void;
2313
+ static map: Map<QueueProviderKey, GenericPubSub>;
2314
+ static getProvider<P extends QueueProviderKey>(provider: P): GenericPubSub<P>;
2315
+ static setProvider(provider: QueueProviderKey, pubsub: GenericPubSub<QueueProviderKey>): void;
2330
2316
  }
2331
2317
 
2332
2318
  /**
@@ -2364,6 +2350,187 @@ declare const defineQueueConfiguration: (options: {
2364
2350
  sqs?: Parameters<typeof defineSQSConfiguration>[0];
2365
2351
  } & { [key in Exclude<QueueProviderKey, "bullmq" | "pgboss" | "sqs">]?: CustomQueueConfiguration; }) => void;
2366
2352
 
2353
+ type QueueHandler = (payload: unknown) => Promise<void>;
2354
+ type TypedQueueRegistration = {
2355
+ name: string;
2356
+ topic: string;
2357
+ handler: QueueHandler;
2358
+ provider: BuiltInProviderKey;
2359
+ queueOptions?: unknown;
2360
+ };
2361
+ type CustomQueueRegistration = {
2362
+ name: string;
2363
+ topic: string;
2364
+ handler: QueueHandler;
2365
+ pubsub: GenericPubSub;
2366
+ };
2367
+ declare class QueueService {
2368
+ static typedQueueSubscribers: Map<string, TypedQueueRegistration>;
2369
+ static customQueueSubscribers: Map<string, CustomQueueRegistration>;
2370
+ /**
2371
+ * Factory function for creating handler instances.
2372
+ * Can be overridden to provide custom dependency injection.
2373
+ * @default Creates new instance using constructor
2374
+ */
2375
+ static instanceFactory: (ctor: Function) => object;
2376
+ static registerTypedQueue(name: string, topic: string, handler: QueueHandler, provider: BuiltInProviderKey, queueOptions?: unknown): void;
2377
+ static registerCustomQueue(name: string, topic: string, handler: QueueHandler, pubsub: GenericPubSub): void;
2378
+ static run(): Promise<void>;
2379
+ static massiveImportQueues(queueHandlerPatterns: string[], options?: {
2380
+ throwOnError?: boolean;
2381
+ }): Promise<void>;
2382
+ }
2383
+
2384
+ type QueueOptionsForProvider<P extends BuiltInProviderKey> = P extends "sqs" ? SQSQueueOptions : P extends "bullmq" ? BullMQQueueOptions : P extends "pgboss" ? PGBossQueueOptions : never;
2385
+ /**
2386
+ * TypedQueue for built-in providers (sqs, bullmq, pgboss)
2387
+ */
2388
+ declare class TypedQueue<TPayload, TProvider extends BuiltInProviderKey = BuiltInProviderKey> {
2389
+ readonly topic: string;
2390
+ readonly provider: TProvider;
2391
+ private readonly queueOptions?;
2392
+ constructor(topic: string, provider: TProvider, queueOptions?: QueueOptionsForProvider<TProvider> | undefined);
2393
+ publish(payload: TPayload, options?: PublishOptions<TProvider>): Promise<{
2394
+ id: string;
2395
+ }>;
2396
+ /**
2397
+ * Subscribe to the queue, to be used as a decorator on a class method
2398
+ * @example
2399
+ * ```ts
2400
+ * @queue.subscribe()
2401
+ * async handle(payload: TPayload) {
2402
+ * console.log(payload);
2403
+ * }
2404
+ * ```
2405
+ */
2406
+ subscribe(): MethodDecorator;
2407
+ /**
2408
+ * Subscribe to the queue with the given handler
2409
+ * @param handler - The handler function to subscribe to the queue
2410
+ * @returns A promise to subscribe to the queue
2411
+ * @example
2412
+ * ```ts
2413
+ * @queue.subscribe(async (payload: TPayload) => {
2414
+ * console.log(payload);
2415
+ * })
2416
+ * ```
2417
+ */
2418
+ subscribe(handler: (payload: TPayload) => Promise<void>): Promise<void>;
2419
+ private createSubscribeDecorator;
2420
+ private subscribeWithCallback;
2421
+ }
2422
+ /**
2423
+ * CustomTypedQueue for user-defined custom providers
2424
+ */
2425
+ declare class CustomTypedQueue<TPayload, TOptions = Record<string, unknown>> {
2426
+ readonly topic: string;
2427
+ private readonly pubsub;
2428
+ constructor(topic: string, pubsub: GenericPubSub<TPayload>);
2429
+ publish(payload: TPayload, options?: TOptions): Promise<{
2430
+ id: string;
2431
+ }>;
2432
+ subscribe(): MethodDecorator;
2433
+ subscribe(handler: (payload: TPayload) => Promise<void>): Promise<void>;
2434
+ private createSubscribeDecorator;
2435
+ }
2436
+
2437
+ /**
2438
+ * Create a typed SQS queue
2439
+ * @param topic - The queue topic name
2440
+ * @param options - SQS-specific options including queueUrl
2441
+ * @returns A TypedQueue instance for SQS
2442
+ *
2443
+ * @example
2444
+ * ```typescript
2445
+ * const userQueue = sqsQueue<{ userId: string }>('user-events', {
2446
+ * queueUrl: 'https://sqs.us-east-1.amazonaws.com/123456789/my-queue'
2447
+ * });
2448
+ *
2449
+ * // Publishing
2450
+ * await userQueue.publish({ userId: '123' });
2451
+ *
2452
+ * // Subscribing with decorator
2453
+ * class UserHandler {
2454
+ * @userQueue.subscribe()
2455
+ * async handle(payload: { userId: string }) {}
2456
+ * }
2457
+ *
2458
+ * // Subscribing with callback
2459
+ * await userQueue.subscribe(async (payload) => {
2460
+ * console.log(payload.userId);
2461
+ * });
2462
+ * ```
2463
+ */
2464
+ declare function sqsQueue<TPayload>(topic: string, options?: SQSQueueOptions): TypedQueue<TPayload, "sqs">;
2465
+ /**
2466
+ * Create a typed BullMQ queue
2467
+ * @param topic - The queue topic name
2468
+ * @param options - BullMQ-specific options (connection, job options, etc.)
2469
+ * @returns A TypedQueue instance for BullMQ
2470
+ *
2471
+ * @example
2472
+ * ```typescript
2473
+ * const orderQueue = bullmqQueue<{ orderId: number }>('orders', {
2474
+ * connection: { host: 'localhost', port: 6379 }
2475
+ * });
2476
+ *
2477
+ * // Publishing
2478
+ * await orderQueue.publish({ orderId: 123 });
2479
+ *
2480
+ * // Subscribing with decorator
2481
+ * class OrderHandler {
2482
+ * @orderQueue.subscribe()
2483
+ * async handle(payload: { orderId: number }) {}
2484
+ * }
2485
+ * ```
2486
+ */
2487
+ declare function bullmqQueue<TPayload>(topic: string, options?: BullMQQueueOptions): TypedQueue<TPayload, "bullmq">;
2488
+ /**
2489
+ * Create a typed PGBoss queue
2490
+ * @param topic - The queue topic name
2491
+ * @param options - PGBoss-specific options
2492
+ * @returns A TypedQueue instance for PGBoss
2493
+ *
2494
+ * @example
2495
+ * ```typescript
2496
+ * const notificationQueue = pgbossQueue<{ message: string }>('notifications');
2497
+ *
2498
+ * // Publishing
2499
+ * await notificationQueue.publish({ message: 'Hello!' });
2500
+ *
2501
+ * // Subscribing with decorator
2502
+ * class NotificationHandler {
2503
+ * @notificationQueue.subscribe()
2504
+ * async handle(payload: { message: string }) {}
2505
+ * }
2506
+ * ```
2507
+ */
2508
+ declare function pgbossQueue<TPayload>(topic: string, options?: PGBossQueueOptions): TypedQueue<TPayload, "pgboss">;
2509
+ /**
2510
+ * Create a typed queue with a custom PubSub provider
2511
+ * @param topic - The queue topic name
2512
+ * @param pubsub - A custom PubSub implementation
2513
+ * @returns A CustomTypedQueue instance for the custom provider
2514
+ *
2515
+ * @example
2516
+ * ```typescript
2517
+ * const customProvider: GenericPubSub<MyPayload> = {
2518
+ * async publish(topic, payload, options) {
2519
+ * // Custom publish logic
2520
+ * return { id: 'custom-id' };
2521
+ * },
2522
+ * async subscribe(topic, handler) {
2523
+ * // Custom subscribe logic
2524
+ * }
2525
+ * };
2526
+ *
2527
+ * const customQueue = createQueue<{ data: string }>('custom-topic', customProvider);
2528
+ *
2529
+ * await customQueue.publish({ data: 'test' });
2530
+ * ```
2531
+ */
2532
+ declare function createQueue<TPayload, TOptions = Record<string, unknown>>(topic: string, pubsub: GenericPubSub<TPayload>): CustomTypedQueue<TPayload, TOptions>;
2533
+
2367
2534
  /**
2368
2535
  * The logger instance, can be overridden by the `defineLoggerConfig` function
2369
2536
  */
@@ -2542,7 +2709,7 @@ declare class GenerateSdkCommand extends Command {
2542
2709
  static help: string[];
2543
2710
  static serverPath: string;
2544
2711
  static outputPath: string;
2545
- static swaggerPath: string;
2712
+ static swaggerPath?: string;
2546
2713
  static httpClient: string;
2547
2714
  static unwrapResponseData: boolean;
2548
2715
  static singleHttpClient: boolean;
@@ -3091,4 +3258,4 @@ declare const createPolicyDecorator: <T extends Record<string, PolicyProvider>>(
3091
3258
  */
3092
3259
  declare const router: ClientRouter;
3093
3260
 
3094
- export { ARG_SYMBOL, AzureBlobStorageProvider, BaseCron, BaseMqtt, BasePlugin, BaseQueue, type BaseStorageProviderOptions, type BlobStorageProviderOptions, BullMQConfiguration, type BullMQConfigurationOptions, BullMQPubSub, type BunTapOptions, Command, type CommandOptions, CommandRegistry, type CronSchedule, type CronScheduleParams, CronService, type CustomQueueConfiguration, type CustomStorageProviderOptions, type CustomValidationError, type DenoTapOptions, type ExpressAdapterOptions, type ExpressHandler, type ExpressRouter, type FileAllowedMimeType, GraphQL, type GraphQLContext, type GraphQLOptions, type GraphQLResolverFunction, type GraphQLResolverMap, type GraphQLResolverType, type GraphQLResolvers, type GraphQLSchemaInput, type GraphQLTypeDef, type HttpMethod, type HttpsOptions, LocalStorageProvider, type LocalStorageProviderOptions, type LoggerOptions, MockServer, type MockServerOptions, type MqttConnectionOptions, type MqttHandler, type MqttPublishOptions, MqttService, type MqttSubscribeOptions, type MqttSubscription, type MqttTopics, type NextFunction, type NodeHttpClient, type NodeServer, type NodeTapOptions, PGBossConfiguration, type PGBossConfigurationOptions, PGBossPubSub, type PGBossSendOptions, type PolicyDecorator, PolicyManager, type PolicyMetadata, type PolicyProvider, type PubSub, type PublishOptions, QueueManager, type QueueProvider, type QueueProviderKey, QueueService, type QueueTopic, type QueueTopicKey, Request$1 as Request, type ResolvedServerOptions, Response$1 as Response, type ReturnType$1 as ReturnType, type ReturnTypeMap, type RuntimeServer, type RuntimeServerMap, S3StorageProvider, type S3StorageProviderOptions, SQSConfiguration, type SQSConfigurationOptions, SQSPubSub, type SQSPublishOptions, type SerializeOptions, Server, type ServerConnectInput, type ServerErrorHandler, type ServerInterface, type ServerListenCallback, type ServerOptions, type ServerPlugin, type ServerRoute, type ServerRouteHandler, type ServerRouteMiddleware, type ServerTapOptions, type ServerTapOptionsBuilder, type SignalEvent, type StandardMethodOptions, type StaticPluginOptions, Storage, type StorageInterface, type StorageOptions, type StorageProviderOptions, VALIDATION_ERROR_SYMBOL, type ValidationOptions, arg, asyncLocalStorage, asyncStorage, baseCommands, commandRegistry, compression, controller, cookie, cors, createExpressAdapter, createPolicyDecorator, cron, defineLoggerConfig, defineQueueConfiguration, del, expressHandler, expressMiddleware, fileParser, flag, get, getContentType, hash, helmet, json, log, logger, methodOverride, middleware, mountExpressRouter, mqtt, patch, post, publish, put, queue, rateLimiter, router, serialize, serveStatic, session, setCronGlobalErrorHandler, setMqttGlobalErrorHandler, timeout, trustProxy, urlencoded, validate };
3261
+ export { ARG_SYMBOL, AzureBlobStorageProvider, BaseCron, BaseMqtt, BasePlugin, BaseQueue, type BaseStorageProviderOptions, type BlobStorageProviderOptions, BullMQConfiguration, type BullMQConfigurationOptions, BullMQPubSub, type BunTapOptions, Command, type CommandOptions, CommandRegistry, type CronSchedule, type CronScheduleParams, CronService, type CustomQueueConfiguration, type CustomStorageProviderOptions, CustomTypedQueue, type CustomValidationError, type DenoTapOptions, type ExpressAdapterOptions, type ExpressHandler, type ExpressRouter, type FileAllowedMimeType, GraphQL, type GraphQLContext, type GraphQLOptions, type GraphQLResolverFunction, type GraphQLResolverMap, type GraphQLResolverType, type GraphQLResolvers, type GraphQLSchemaInput, type GraphQLTypeDef, type HttpMethod, type HttpsOptions, LocalStorageProvider, type LocalStorageProviderOptions, type LoggerOptions, MockServer, type MockServerOptions, type MqttConnectionOptions, type MqttHandler, type MqttPublishOptions, MqttService, type MqttSubscribeOptions, type MqttSubscription, type MqttTopics, type NextFunction, type NodeHttpClient, type NodeServer, type NodeTapOptions, PGBossConfiguration, type PGBossConfigurationOptions, PGBossPubSub, type PolicyDecorator, PolicyManager, type PolicyMetadata, type PolicyProvider, QueueManager, QueueService, Request$1 as Request, type ResolvedServerOptions, Response$1 as Response, type ReturnType$1 as ReturnType, type ReturnTypeMap, type RuntimeServer, type RuntimeServerMap, S3StorageProvider, type S3StorageProviderOptions, SQSConfiguration, type SQSConfigurationOptions, SQSPubSub, type SerializeOptions, Server, type ServerConnectInput, type ServerErrorHandler, type ServerInterface, type ServerListenCallback, type ServerOptions, type ServerPlugin, type ServerRoute, type ServerRouteHandler, type ServerRouteMiddleware, type ServerTapOptions, type ServerTapOptionsBuilder, type SignalEvent, type StandardMethodOptions, type StaticPluginOptions, Storage, type StorageInterface, type StorageOptions, type StorageProviderOptions, TypedQueue, VALIDATION_ERROR_SYMBOL, type ValidationOptions, arg, asyncLocalStorage, asyncStorage, baseCommands, bullmqQueue, commandRegistry, compression, controller, cookie, cors, createExpressAdapter, createPolicyDecorator, createQueue, cron, defineLoggerConfig, defineQueueConfiguration, del, expressHandler, expressMiddleware, fileParser, flag, get, getContentType, hash, helmet, json, log, logger, methodOverride, middleware, mountExpressRouter, mqtt, patch, pgbossQueue, post, put, rateLimiter, router, serialize, serveStatic, session, setCronGlobalErrorHandler, setMqttGlobalErrorHandler, sqsQueue, timeout, trustProxy, urlencoded, validate };