@amqp-contract/client-nestjs 0.18.0 → 0.19.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.
package/dist/index.d.cts CHANGED
@@ -176,8 +176,12 @@ type AmqpClientModuleAsyncOptions<TContract extends ContractDefinition> = {
176
176
  /**
177
177
  * Factory function that returns the module options.
178
178
  * Can use injected dependencies to create configuration.
179
+ *
180
+ * Method syntax is intentional: it enables bivariant parameter checking so
181
+ * users can write typed factories like `(config: ConfigService) => ({ ... })`
182
+ * without casting, even though the actual args come from NestJS DI at runtime.
179
183
  */
180
- useFactory: (...args: any[]) => AmqpClientModuleOptionsFactory<TContract>;
184
+ useFactory(...args: unknown[]): AmqpClientModuleOptionsFactory<TContract>;
181
185
  /**
182
186
  * Optional dependencies to inject into the factory function.
183
187
  * Can be a token (string/symbol) or a class reference to a provider.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":["amqp","EventEmitter","TcpSocketConnectOpts","ConnectionOptions","ChannelWrapper","CreateChannelOpts","ConnectionUrl","Options","Connect","AmqpConnectionOptions","url","connectionOptions","ConnectListener","Connection","connection","arg","ConnectFailedListener","Error","err","Buffer","noDelay","timeout","keepAlive","keepAliveDelay","clientProperties","credentials","mechanism","username","password","response","AmqpConnectionManagerOptions","Promise","heartbeatIntervalInSeconds","reconnectTimeInSeconds","findServers","urls","callback","IAmqpConnectionManager","Function","ChannelModel","addListener","event","args","listener","reason","listeners","eventName","on","once","prependListener","prependOnceListener","removeListener","connect","options","reconnect","createChannel","close","isConnected","channelCount","AmqpConnectionManager","_channels","_currentUrl","_closed","_cancelRetriesHandler","_connectPromise","_currentConnection","_findServers","_urls","constructor","_connect","default"],"sources":["../../../node_modules/.pnpm/amqp-connection-manager@5.0.0_amqplib@0.10.9/node_modules/amqp-connection-manager/dist/types/AmqpConnectionManager.d.ts","../src/client.service.ts","../src/client.module.ts","../src/client.module-definition.ts"],"x_google_ignoreList":[0],"mappings":";;;;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AA,EACf,OAAA,EAAS,2BAAA,CAA0B,SAAA,EAAW,KAAA,GAC9C,OAAA,GAAU,cAAA,GACT,MAAA,CAAO,MAAA,OAAa,gBAAA,GAAiB,wBAAA;AAAA;;;;;;KCvIrC,8BAAA,mBAAiD,kBAAA,IAClD,uBAAA,CAAwB,SAAA,IACxB,OAAA,CAAQ,uBAAA,CAAwB,SAAA;;;;KAKxB,4BAAA,mBAA+C,kBAAA;EFhBlC;;;;EEsBvB,UAAA,MAAgB,IAAA,YAAgB,8BAAA,CAA+B,SAAA;EFtBfX;;;;EE2BhD,MAAA,sBAA4B,IAAA;EFzBe;AAc7C;;EEeE,OAAA,GAAU,cAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;AFCZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACRA;cC+Da,gBAAA;ED/DsB;;;;;;EAAA,OCsE1B,OAAA,mBAA0B,kBAAA,CAAA,CAC/B,OAAA,EAAS,uBAAA,CAAwB,SAAA,IAChC,aAAA;EDxE+B;;;;;;EAAA,OC4F3B,YAAA,mBAA+B,kBAAA,CAAA,CACpC,OAAA,EAAS,4BAAA,CAA6B,SAAA,IACrC,aAAA;AAAA;;;;;;;cCvHQ,oBAAA"}
1
+ {"version":3,"file":"index.d.cts","names":["amqp","EventEmitter","TcpSocketConnectOpts","ConnectionOptions","ChannelWrapper","CreateChannelOpts","ConnectionUrl","Options","Connect","AmqpConnectionOptions","url","connectionOptions","ConnectListener","Connection","connection","arg","ConnectFailedListener","Error","err","Buffer","noDelay","timeout","keepAlive","keepAliveDelay","clientProperties","credentials","mechanism","username","password","response","AmqpConnectionManagerOptions","Promise","heartbeatIntervalInSeconds","reconnectTimeInSeconds","findServers","urls","callback","IAmqpConnectionManager","Function","ChannelModel","addListener","event","args","listener","reason","listeners","eventName","on","once","prependListener","prependOnceListener","removeListener","connect","options","reconnect","createChannel","close","isConnected","channelCount","AmqpConnectionManager","_channels","_currentUrl","_closed","_cancelRetriesHandler","_connectPromise","_currentConnection","_findServers","_urls","constructor","_connect","default"],"sources":["../../../node_modules/.pnpm/amqp-connection-manager@5.0.0_amqplib@0.10.9/node_modules/amqp-connection-manager/dist/types/AmqpConnectionManager.d.ts","../src/client.service.ts","../src/client.module.ts","../src/client.module-definition.ts"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;KAKYM,aAAAA,YAAyBN,IAAAA,CAAKO,OAAAA,CAAQC,OAAAA;EAC9CE,GAAAA;EACAC,iBAAAA,GAAoBF,qBAAAA;AAAAA;AAAAA,KAcZA,qBAAAA,IAAyBN,iBAAAA,GAAoBD,oBAAAA;EACrDkB,OAAAA;EACAC,OAAAA;EACAC,SAAAA;EACAC,cAAAA;EACAC,gBAAAA;EACAC,WAAAA;IACIC,SAAAA;IACAC,QAAAA;IACAC,QAAAA;IACAC,QAAAA,QAAgBV,MAAAA;EAAAA;IAEhBO,SAAAA;IACAG,QAAAA,QAAgBV,MAAAA;EAAAA;AAAAA;AAAAA,UAGPW,4BAAAA;EAVbL;EAYAO,0BAAAA;EAVIL;;;;EAeJM,sBAAAA;EAVIJ;;;;AAGR;;;EAeIK,WAAAA,KAAgBE,QAAAA,GAAWD,IAAAA,EAAM7B,aAAAA,GAAgBA,aAAAA,+BAA4CyB,OAAAA,CAAQzB,aAAAA,GAAgBA,aAAAA;EAApEA;EAEjDK,iBAAAA,GAAoBF,qBAAAA;AAAAA;;;;;;;AAjDxB;;;;;;;;;;;;KCwBY,uBAAA,mBAA0C,kBAAA;EDRrB,mFCU/B,QAAA,EAAU,SAAA,EDVyBN;ECYnC,IAAA,EAAM,aAAA,IDFgBgB;ECItB,iBAAA,GAAoB,4BAAA;AAAA;;;;;;;;;;;;;;;;;;;;ADEtB;;;;;;;;;;;;;;;;;;;;;;;cC4Ca,iBAAA,mBAAoC,kBAAA,aACpC,YAAA,EAAc,eAAA;EAAA,iBAMN,OAAA;EAAA,QAJX,MAAA;cAIW,OAAA,EAAS,uBAAA,CAAwB,SAAA;;AA3DtD;;;;;;EAqEQ,YAAA,CAAA,GAAgB,OAAA;EA/D0B;;;;;;;EA0E1C,eAAA,CAAA,GAAmB,OAAA;EA1EzB;;;;AA6CF;;;;;;;;;;;;;;;;;;;;;;;;;EAiEE,OAAA,eAAsB,mBAAA,CAAoB,SAAA,EAAA,CACxC,aAAA,EAAe,KAAA,EACf,OAAA,EAAS,2BAAA,CAA0B,SAAA,EAAW,KAAA,GAC9C,OAAA,GAAU,cAAA,GACT,MAAA,CAAO,MAAA,OAAa,gBAAA,GAAiB,wBAAA;AAAA;;;;;;KCvIrC,8BAAA,mBAAiD,kBAAA,IAClD,uBAAA,CAAwB,SAAA,IACxB,OAAA,CAAQ,uBAAA,CAAwB,SAAA;;;;KAKxB,4BAAA,mBAA+C,kBAAA;EFhBlC;;;;;;;;EEyBvB,UAAA,IAAc,IAAA,cAAkB,8BAAA,CAA+B,SAAA;EFvBpB;;AAc7C;;EEcE,MAAA,sBAA4B,IAAA;EFdOhB;;;EEkBnC,OAAA,GAAU,cAAA;AAAA;;;;;;;;;;;;;;;;;;;;AFFZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACRA;;;;;cCkEa,gBAAA;ED5DS;;;;;;EAAA,OCmEb,OAAA,mBAA0B,kBAAA,CAAA,CAC/B,OAAA,EAAS,uBAAA,CAAwB,SAAA,IAChC,aAAA;EDvEH;;;;;;EAAA,OC2FO,YAAA,mBAA+B,kBAAA,CAAA,CACpC,OAAA,EAAS,4BAAA,CAA6B,SAAA,IACrC,aAAA;AAAA;;;;;;;cC1HQ,oBAAA"}
package/dist/index.d.mts CHANGED
@@ -176,8 +176,12 @@ type AmqpClientModuleAsyncOptions<TContract extends ContractDefinition> = {
176
176
  /**
177
177
  * Factory function that returns the module options.
178
178
  * Can use injected dependencies to create configuration.
179
+ *
180
+ * Method syntax is intentional: it enables bivariant parameter checking so
181
+ * users can write typed factories like `(config: ConfigService) => ({ ... })`
182
+ * without casting, even though the actual args come from NestJS DI at runtime.
179
183
  */
180
- useFactory: (...args: any[]) => AmqpClientModuleOptionsFactory<TContract>;
184
+ useFactory(...args: unknown[]): AmqpClientModuleOptionsFactory<TContract>;
181
185
  /**
182
186
  * Optional dependencies to inject into the factory function.
183
187
  * Can be a token (string/symbol) or a class reference to a provider.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":["amqp","EventEmitter","TcpSocketConnectOpts","ConnectionOptions","ChannelWrapper","CreateChannelOpts","ConnectionUrl","Options","Connect","AmqpConnectionOptions","url","connectionOptions","ConnectListener","Connection","connection","arg","ConnectFailedListener","Error","err","Buffer","noDelay","timeout","keepAlive","keepAliveDelay","clientProperties","credentials","mechanism","username","password","response","AmqpConnectionManagerOptions","Promise","heartbeatIntervalInSeconds","reconnectTimeInSeconds","findServers","urls","callback","IAmqpConnectionManager","Function","ChannelModel","addListener","event","args","listener","reason","listeners","eventName","on","once","prependListener","prependOnceListener","removeListener","connect","options","reconnect","createChannel","close","isConnected","channelCount","AmqpConnectionManager","_channels","_currentUrl","_closed","_cancelRetriesHandler","_connectPromise","_currentConnection","_findServers","_urls","constructor","_connect","default"],"sources":["../../../node_modules/.pnpm/amqp-connection-manager@5.0.0_amqplib@0.10.9/node_modules/amqp-connection-manager/dist/types/AmqpConnectionManager.d.ts","../src/client.service.ts","../src/client.module.ts","../src/client.module-definition.ts"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;KAKYM,aAAAA,YAAyBN,IAAAA,CAAKO,OAAAA,CAAQC,OAAAA;EAC9CE,GAAAA;EACAC,iBAAAA,GAAoBF,qBAAAA;AAAAA;AAAAA,KAcZA,qBAAAA,IAAyBN,iBAAAA,GAAoBD,oBAAAA;EACrDkB,OAAAA;EACAC,OAAAA;EACAC,SAAAA;EACAC,cAAAA;EACAC,gBAAAA;EACAC,WAAAA;IACIC,SAAAA;IACAC,QAAAA;IACAC,QAAAA;IACAC,QAAAA,QAAgBV,MAAAA;EAAAA;IAEhBO,SAAAA;IACAG,QAAAA,QAAgBV,MAAAA;EAAAA;AAAA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C;;EEeE,OAAA,GAAU,cAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;AFCZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACRA;cC+Da,gBAAA;ED/DsB;;;;;;EAAA,OCsE1B,OAAA,mBAA0B,kBAAA,CAAA,CAC/B,OAAA,EAAS,uBAAA,CAAwB,SAAA,IAChC,aAAA;EDxE+B;;;;;;EAAA,OC4F3B,YAAA,mBAA+B,kBAAA,CAAA,CACpC,OAAA,EAAS,4BAAA,CAA6B,SAAA,IACrC,aAAA;AAAA;;;;;;;cCvHQ,oBAAA"}
1
+ {"version":3,"file":"index.d.mts","names":["amqp","EventEmitter","TcpSocketConnectOpts","ConnectionOptions","ChannelWrapper","CreateChannelOpts","ConnectionUrl","Options","Connect","AmqpConnectionOptions","url","connectionOptions","ConnectListener","Connection","connection","arg","ConnectFailedListener","Error","err","Buffer","noDelay","timeout","keepAlive","keepAliveDelay","clientProperties","credentials","mechanism","username","password","response","AmqpConnectionManagerOptions","Promise","heartbeatIntervalInSeconds","reconnectTimeInSeconds","findServers","urls","callback","IAmqpConnectionManager","Function","ChannelModel","addListener","event","args","listener","reason","listeners","eventName","on","once","prependListener","prependOnceListener","removeListener","connect","options","reconnect","createChannel","close","isConnected","channelCount","AmqpConnectionManager","_channels","_currentUrl","_closed","_cancelRetriesHandler","_connectPromise","_currentConnection","_findServers","_urls","constructor","_connect","default"],"sources":["../../../node_modules/.pnpm/amqp-connection-manager@5.0.0_amqplib@0.10.9/node_modules/amqp-connection-manager/dist/types/AmqpConnectionManager.d.ts","../src/client.service.ts","../src/client.module.ts","../src/client.module-definition.ts"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;KAKYM,aAAAA,YAAyBN,IAAAA,CAAKO,OAAAA,CAAQC,OAAAA;EAC9CE,GAAAA;EACAC,iBAAAA,GAAoBF,qBAAAA;AAAAA;AAAAA,KAcZA,qBAAAA,IAAyBN,iBAAAA,GAAoBD,oBAAAA;EACrDkB,OAAAA;EAC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AA,IACxB,OAAA,CAAQ,uBAAA,CAAwB,SAAA;;;;KAKxB,4BAAA,mBAA+C,kBAAA;EFhBlC;;;;;;;;EEyBvB,UAAA,IAAc,IAAA,cAAkB,8BAAA,CAA+B,SAAA;EFvBpB;;AAc7C;;EEcE,MAAA,sBAA4B,IAAA;EFdOhB;;;EEkBnC,OAAA,GAAU,cAAA;AAAA;;;;;;;;;;;;;;;;;;;;AFFZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACRA;;;;;cCkEa,gBAAA;ED5DS;;;;;;EAAA,OCmEb,OAAA,mBAA0B,kBAAA,CAAA,CAC/B,OAAA,EAAS,uBAAA,CAAwB,SAAA,IAChC,aAAA;EDvEH;;;;;;EAAA,OC2FO,YAAA,mBAA+B,kBAAA,CAAA,CACpC,OAAA,EAAS,4BAAA,CAA6B,SAAA,IACrC,aAAA;AAAA;;;;;;;cC1HQ,oBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["TechnicalError"],"sources":["../src/client.module-definition.ts","../src/client.service.ts","../src/client.module.ts"],"sourcesContent":["/**\n * Injection token for AMQP client module options\n * Used by NestJS DI system to inject configuration into AmqpClientService\n */\nexport const MODULE_OPTIONS_TOKEN = Symbol(\"AMQP_CLIENT_MODULE_OPTIONS\");\n","import type { AmqpConnectionManagerOptions, ConnectionUrl } from \"amqp-connection-manager\";\nimport {\n type ClientInferPublisherInput,\n MessageValidationError,\n type PublishOptions,\n TypedAmqpClient,\n} from \"@amqp-contract/client\";\nimport type { ContractDefinition, InferPublisherNames } from \"@amqp-contract/contract\";\nimport { Future, Result } from \"@swan-io/boxed\";\nimport { Inject, Injectable, type OnModuleDestroy, type OnModuleInit } from \"@nestjs/common\";\nimport { MODULE_OPTIONS_TOKEN } from \"./client.module-definition.js\";\nimport { TechnicalError } from \"@amqp-contract/core\";\n\n/**\n * Configuration options for the AMQP client NestJS module.\n *\n * @typeParam TContract - The contract definition type\n *\n * @example\n * ```typescript\n * const options: AmqpClientModuleOptions<typeof contract> = {\n * contract: myContract,\n * urls: ['amqp://localhost'],\n * connectionOptions: {\n * heartbeatIntervalInSeconds: 30\n * }\n * };\n * ```\n */\nexport type AmqpClientModuleOptions<TContract extends ContractDefinition> = {\n /** The AMQP contract definition specifying publishers and their message schemas */\n contract: TContract;\n /** AMQP broker URL(s). Multiple URLs provide failover support */\n urls: ConnectionUrl[];\n /** Optional connection configuration (heartbeat, reconnect settings, etc.) */\n connectionOptions?: AmqpConnectionManagerOptions | undefined;\n};\n\n/**\n * Type-safe AMQP client service for NestJS applications.\n *\n * This service wraps {@link TypedAmqpClient} and integrates it with the NestJS\n * lifecycle, automatically initializing the connection on module init and\n * cleaning up resources on module destroy.\n *\n * @typeParam TContract - The contract definition type\n *\n * @example\n * ```typescript\n * // In your module\n * import { AmqpClientModule } from '@amqp-contract/client-nestjs';\n *\n * @Module({\n * imports: [\n * AmqpClientModule.forRoot({\n * contract: myContract,\n * urls: ['amqp://localhost']\n * })\n * ]\n * })\n * export class AppModule {}\n *\n * // In your service\n * import { AmqpClientService } from '@amqp-contract/client-nestjs';\n *\n * @Injectable()\n * export class OrderService {\n * constructor(\n * private readonly amqpClient: AmqpClientService<typeof myContract>\n * ) {}\n *\n * async createOrder(order: Order) {\n * const result = await this.amqpClient.publish('orderCreated', {\n * orderId: order.id,\n * amount: order.total\n * }).resultToPromise();\n * }\n * }\n * ```\n */\n@Injectable()\nexport class AmqpClientService<TContract extends ContractDefinition>\n implements OnModuleInit, OnModuleDestroy\n{\n private client: TypedAmqpClient<TContract> | null = null;\n\n constructor(\n @Inject(MODULE_OPTIONS_TOKEN)\n private readonly options: AmqpClientModuleOptions<TContract>,\n ) {}\n\n /**\n * Initialize the AMQP client when the NestJS module starts.\n *\n * This lifecycle hook automatically creates and initializes the client\n * when the NestJS application starts up. The connection will be established\n * in the background with automatic reconnection handling.\n */\n async onModuleInit(): Promise<void> {\n this.client = await TypedAmqpClient.create(this.options).resultToPromise();\n }\n\n /**\n * Close the AMQP client when the NestJS module is destroyed.\n *\n * This lifecycle hook ensures proper cleanup of resources when the\n * NestJS application shuts down, gracefully closing the connection\n * and cleaning up all consumers.\n */\n async onModuleDestroy(): Promise<void> {\n if (this.client) {\n await this.client.close().resultToPromise();\n this.client = null;\n }\n }\n\n /**\n * Publish a message using a contract-defined publisher.\n *\n * This method provides type-safe message publishing with automatic validation\n * and explicit error handling through the Result type.\n *\n * @param publisherName - The name of the publisher from the contract\n * @param message - The message payload (type-checked against the contract)\n * @param options - Optional AMQP publish options including compression support\n * @returns A Future that resolves to a Result indicating success or failure\n *\n * @example Basic publishing\n * ```typescript\n * await this.amqpClient.publish('orderCreated', {\n * orderId: '123',\n * amount: 99.99\n * }).resultToPromise();\n * ```\n *\n * @example Publishing with compression\n * ```typescript\n * await this.amqpClient.publish('orderCreated', {\n * orderId: '123',\n * amount: 99.99\n * }, {\n * compression: 'gzip'\n * }).resultToPromise();\n * ```\n */\n publish<TName extends InferPublisherNames<TContract>>(\n publisherName: TName,\n message: ClientInferPublisherInput<TContract, TName>,\n options?: PublishOptions,\n ): Future<Result<void, TechnicalError | MessageValidationError>> {\n if (!this.client) {\n return Future.value(\n Result.Error(\n new TechnicalError(\n \"Client not initialized. Ensure the module has been initialized before publishing.\",\n ),\n ),\n );\n }\n\n return this.client.publish(publisherName, message, options);\n }\n}\n","import { type AmqpClientModuleOptions, AmqpClientService } from \"./client.service.js\";\nimport {\n type DynamicModule,\n Module,\n type ModuleMetadata,\n type Provider,\n type Type,\n} from \"@nestjs/common\";\nimport type { ContractDefinition } from \"@amqp-contract/contract\";\nimport { MODULE_OPTIONS_TOKEN } from \"./client.module-definition.js\";\n\n/**\n * Factory function return type for async module configuration\n */\ntype AmqpClientModuleOptionsFactory<TContract extends ContractDefinition> =\n | AmqpClientModuleOptions<TContract>\n | Promise<AmqpClientModuleOptions<TContract>>;\n\n/**\n * Options for async module configuration using factory pattern\n */\nexport type AmqpClientModuleAsyncOptions<TContract extends ContractDefinition> = {\n /**\n * Factory function that returns the module options.\n * Can use injected dependencies to create configuration.\n */\n // oxlint-disable-next-line no-explicit-any\n useFactory: (...args: any[]) => AmqpClientModuleOptionsFactory<TContract>;\n /**\n * Optional dependencies to inject into the factory function.\n * Can be a token (string/symbol) or a class reference to a provider.\n */\n inject?: (string | symbol | Type<unknown>)[];\n /**\n * Optional list of imported modules that export providers needed by the factory\n */\n imports?: ModuleMetadata[\"imports\"];\n};\n\n/**\n * NestJS module for AMQP client integration\n * This module provides type-safe AMQP client functionality using @amqp-contract/client\n * without relying on NestJS decorators (except for dependency injection)\n *\n * @typeParam TContract - The contract definition type for type-safe publishing\n *\n * @example\n * ```typescript\n * // Synchronous configuration\n * @Module({\n * imports: [\n * AmqpClientModule.forRoot({\n * contract: myContract,\n * urls: ['amqp://localhost']\n * })\n * ]\n * })\n * export class AppModule {}\n *\n * // Asynchronous configuration\n * @Module({\n * imports: [\n * AmqpClientModule.forRootAsync({\n * imports: [ConfigModule],\n * useFactory: (configService: ConfigService) => ({\n * contract: myContract,\n * urls: configService.get('AMQP_URLS')\n * }),\n * inject: [ConfigService]\n * })\n * ]\n * })\n * export class AppModule {}\n *\n * // Using the client in a service\n * @Injectable()\n * export class OrderService {\n * constructor(\n * private readonly amqpClient: AmqpClientService<typeof myContract>\n * ) {}\n *\n * async createOrder(order: Order) {\n * // publish is fully typed based on the contract\n * await this.amqpClient.publish('orderCreated', {\n * orderId: order.id,\n * amount: order.total\n * }).resultToPromise();\n * }\n * }\n * ```\n */\n@Module({})\nexport class AmqpClientModule {\n /**\n * Register the AMQP client module with synchronous configuration\n *\n * @param options - The client configuration options with contract\n * @returns A dynamic module for NestJS\n */\n static forRoot<TContract extends ContractDefinition>(\n options: AmqpClientModuleOptions<TContract>,\n ): DynamicModule {\n return {\n module: AmqpClientModule,\n providers: [\n {\n provide: MODULE_OPTIONS_TOKEN,\n useValue: options,\n },\n AmqpClientService,\n ],\n exports: [AmqpClientService],\n };\n }\n\n /**\n * Register the AMQP client module with asynchronous configuration\n *\n * @param options - Async configuration options with factory function\n * @returns A dynamic module for NestJS\n */\n static forRootAsync<TContract extends ContractDefinition>(\n options: AmqpClientModuleAsyncOptions<TContract>,\n ): DynamicModule {\n const providers: Provider[] = [\n {\n provide: MODULE_OPTIONS_TOKEN,\n useFactory: options.useFactory,\n inject: options.inject ?? [],\n },\n AmqpClientService,\n ];\n\n return {\n module: AmqpClientModule,\n imports: options.imports ?? [],\n providers,\n exports: [AmqpClientService],\n };\n }\n}\n"],"mappings":";;;;;;;;;;AAIA,MAAa,uBAAuB,OAAO,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;AC6EjE,8BAAM,kBAEb;CACE,AAAQ,SAA4C;CAEpD,YACE,AACiB,SACjB;EADiB;;;;;;;;;CAUnB,MAAM,eAA8B;AAClC,OAAK,SAAS,MAAM,gBAAgB,OAAO,KAAK,QAAQ,CAAC,iBAAiB;;;;;;;;;CAU5E,MAAM,kBAAiC;AACrC,MAAI,KAAK,QAAQ;AACf,SAAM,KAAK,OAAO,OAAO,CAAC,iBAAiB;AAC3C,QAAK,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiClB,QACE,eACA,SACA,SAC+D;AAC/D,MAAI,CAAC,KAAK,OACR,QAAO,OAAO,MACZ,OAAO,MACL,IAAIA,iBACF,oFACD,CACF,CACF;AAGH,SAAO,KAAK,OAAO,QAAQ,eAAe,SAAS,QAAQ;;;;CAhF9D,YAAY;oBAOR,OAAO,qBAAqB;;;;;;;ACK1B,iDAAM,iBAAiB;;;;;;;CAO5B,OAAO,QACL,SACe;AACf,SAAO;GACL;GACA,WAAW,CACT;IACE,SAAS;IACT,UAAU;IACX,EACD,kBACD;GACD,SAAS,CAAC,kBAAkB;GAC7B;;;;;;;;CASH,OAAO,aACL,SACe;EACf,MAAM,YAAwB,CAC5B;GACE,SAAS;GACT,YAAY,QAAQ;GACpB,QAAQ,QAAQ,UAAU,EAAE;GAC7B,EACD,kBACD;AAED,SAAO;GACL;GACA,SAAS,QAAQ,WAAW,EAAE;GAC9B;GACA,SAAS,CAAC,kBAAkB;GAC7B;;;mDA/CJ,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"index.mjs","names":["TechnicalError"],"sources":["../src/client.module-definition.ts","../src/client.service.ts","../src/client.module.ts"],"sourcesContent":["/**\n * Injection token for AMQP client module options\n * Used by NestJS DI system to inject configuration into AmqpClientService\n */\nexport const MODULE_OPTIONS_TOKEN = Symbol(\"AMQP_CLIENT_MODULE_OPTIONS\");\n","import type { AmqpConnectionManagerOptions, ConnectionUrl } from \"amqp-connection-manager\";\nimport {\n type ClientInferPublisherInput,\n MessageValidationError,\n type PublishOptions,\n TypedAmqpClient,\n} from \"@amqp-contract/client\";\nimport type { ContractDefinition, InferPublisherNames } from \"@amqp-contract/contract\";\nimport { Future, Result } from \"@swan-io/boxed\";\nimport { Inject, Injectable, type OnModuleDestroy, type OnModuleInit } from \"@nestjs/common\";\nimport { MODULE_OPTIONS_TOKEN } from \"./client.module-definition.js\";\nimport { TechnicalError } from \"@amqp-contract/core\";\n\n/**\n * Configuration options for the AMQP client NestJS module.\n *\n * @typeParam TContract - The contract definition type\n *\n * @example\n * ```typescript\n * const options: AmqpClientModuleOptions<typeof contract> = {\n * contract: myContract,\n * urls: ['amqp://localhost'],\n * connectionOptions: {\n * heartbeatIntervalInSeconds: 30\n * }\n * };\n * ```\n */\nexport type AmqpClientModuleOptions<TContract extends ContractDefinition> = {\n /** The AMQP contract definition specifying publishers and their message schemas */\n contract: TContract;\n /** AMQP broker URL(s). Multiple URLs provide failover support */\n urls: ConnectionUrl[];\n /** Optional connection configuration (heartbeat, reconnect settings, etc.) */\n connectionOptions?: AmqpConnectionManagerOptions | undefined;\n};\n\n/**\n * Type-safe AMQP client service for NestJS applications.\n *\n * This service wraps {@link TypedAmqpClient} and integrates it with the NestJS\n * lifecycle, automatically initializing the connection on module init and\n * cleaning up resources on module destroy.\n *\n * @typeParam TContract - The contract definition type\n *\n * @example\n * ```typescript\n * // In your module\n * import { AmqpClientModule } from '@amqp-contract/client-nestjs';\n *\n * @Module({\n * imports: [\n * AmqpClientModule.forRoot({\n * contract: myContract,\n * urls: ['amqp://localhost']\n * })\n * ]\n * })\n * export class AppModule {}\n *\n * // In your service\n * import { AmqpClientService } from '@amqp-contract/client-nestjs';\n *\n * @Injectable()\n * export class OrderService {\n * constructor(\n * private readonly amqpClient: AmqpClientService<typeof myContract>\n * ) {}\n *\n * async createOrder(order: Order) {\n * const result = await this.amqpClient.publish('orderCreated', {\n * orderId: order.id,\n * amount: order.total\n * }).resultToPromise();\n * }\n * }\n * ```\n */\n@Injectable()\nexport class AmqpClientService<TContract extends ContractDefinition>\n implements OnModuleInit, OnModuleDestroy\n{\n private client: TypedAmqpClient<TContract> | null = null;\n\n constructor(\n @Inject(MODULE_OPTIONS_TOKEN)\n private readonly options: AmqpClientModuleOptions<TContract>,\n ) {}\n\n /**\n * Initialize the AMQP client when the NestJS module starts.\n *\n * This lifecycle hook automatically creates and initializes the client\n * when the NestJS application starts up. The connection will be established\n * in the background with automatic reconnection handling.\n */\n async onModuleInit(): Promise<void> {\n this.client = await TypedAmqpClient.create(this.options).resultToPromise();\n }\n\n /**\n * Close the AMQP client when the NestJS module is destroyed.\n *\n * This lifecycle hook ensures proper cleanup of resources when the\n * NestJS application shuts down, gracefully closing the connection\n * and cleaning up all consumers.\n */\n async onModuleDestroy(): Promise<void> {\n if (this.client) {\n await this.client.close().resultToPromise();\n this.client = null;\n }\n }\n\n /**\n * Publish a message using a contract-defined publisher.\n *\n * This method provides type-safe message publishing with automatic validation\n * and explicit error handling through the Result type.\n *\n * @param publisherName - The name of the publisher from the contract\n * @param message - The message payload (type-checked against the contract)\n * @param options - Optional AMQP publish options including compression support\n * @returns A Future that resolves to a Result indicating success or failure\n *\n * @example Basic publishing\n * ```typescript\n * await this.amqpClient.publish('orderCreated', {\n * orderId: '123',\n * amount: 99.99\n * }).resultToPromise();\n * ```\n *\n * @example Publishing with compression\n * ```typescript\n * await this.amqpClient.publish('orderCreated', {\n * orderId: '123',\n * amount: 99.99\n * }, {\n * compression: 'gzip'\n * }).resultToPromise();\n * ```\n */\n publish<TName extends InferPublisherNames<TContract>>(\n publisherName: TName,\n message: ClientInferPublisherInput<TContract, TName>,\n options?: PublishOptions,\n ): Future<Result<void, TechnicalError | MessageValidationError>> {\n if (!this.client) {\n return Future.value(\n Result.Error(\n new TechnicalError(\n \"Client not initialized. Ensure the module has been initialized before publishing.\",\n ),\n ),\n );\n }\n\n return this.client.publish(publisherName, message, options);\n }\n}\n","import { type AmqpClientModuleOptions, AmqpClientService } from \"./client.service.js\";\nimport {\n type DynamicModule,\n Module,\n type ModuleMetadata,\n type Provider,\n type Type,\n} from \"@nestjs/common\";\nimport type { ContractDefinition } from \"@amqp-contract/contract\";\nimport { MODULE_OPTIONS_TOKEN } from \"./client.module-definition.js\";\n\n/**\n * Factory function return type for async module configuration\n */\ntype AmqpClientModuleOptionsFactory<TContract extends ContractDefinition> =\n | AmqpClientModuleOptions<TContract>\n | Promise<AmqpClientModuleOptions<TContract>>;\n\n/**\n * Options for async module configuration using factory pattern\n */\nexport type AmqpClientModuleAsyncOptions<TContract extends ContractDefinition> = {\n /**\n * Factory function that returns the module options.\n * Can use injected dependencies to create configuration.\n *\n * Method syntax is intentional: it enables bivariant parameter checking so\n * users can write typed factories like `(config: ConfigService) => ({ ... })`\n * without casting, even though the actual args come from NestJS DI at runtime.\n */\n useFactory(...args: unknown[]): AmqpClientModuleOptionsFactory<TContract>;\n /**\n * Optional dependencies to inject into the factory function.\n * Can be a token (string/symbol) or a class reference to a provider.\n */\n inject?: (string | symbol | Type<unknown>)[];\n /**\n * Optional list of imported modules that export providers needed by the factory\n */\n imports?: ModuleMetadata[\"imports\"];\n};\n\n/**\n * NestJS module for AMQP client integration\n * This module provides type-safe AMQP client functionality using @amqp-contract/client\n * without relying on NestJS decorators (except for dependency injection)\n *\n * @typeParam TContract - The contract definition type for type-safe publishing\n *\n * @example\n * ```typescript\n * // Synchronous configuration\n * @Module({\n * imports: [\n * AmqpClientModule.forRoot({\n * contract: myContract,\n * urls: ['amqp://localhost']\n * })\n * ]\n * })\n * export class AppModule {}\n *\n * // Asynchronous configuration\n * @Module({\n * imports: [\n * AmqpClientModule.forRootAsync({\n * imports: [ConfigModule],\n * useFactory: (configService: ConfigService) => ({\n * contract: myContract,\n * urls: configService.get('AMQP_URLS')\n * }),\n * inject: [ConfigService]\n * })\n * ]\n * })\n * export class AppModule {}\n *\n * // Using the client in a service\n * @Injectable()\n * export class OrderService {\n * constructor(\n * private readonly amqpClient: AmqpClientService<typeof myContract>\n * ) {}\n *\n * async createOrder(order: Order) {\n * // publish is fully typed based on the contract\n * await this.amqpClient.publish('orderCreated', {\n * orderId: order.id,\n * amount: order.total\n * }).resultToPromise();\n * }\n * }\n * ```\n */\n@Module({})\nexport class AmqpClientModule {\n /**\n * Register the AMQP client module with synchronous configuration\n *\n * @param options - The client configuration options with contract\n * @returns A dynamic module for NestJS\n */\n static forRoot<TContract extends ContractDefinition>(\n options: AmqpClientModuleOptions<TContract>,\n ): DynamicModule {\n return {\n module: AmqpClientModule,\n providers: [\n {\n provide: MODULE_OPTIONS_TOKEN,\n useValue: options,\n },\n AmqpClientService,\n ],\n exports: [AmqpClientService],\n };\n }\n\n /**\n * Register the AMQP client module with asynchronous configuration\n *\n * @param options - Async configuration options with factory function\n * @returns A dynamic module for NestJS\n */\n static forRootAsync<TContract extends ContractDefinition>(\n options: AmqpClientModuleAsyncOptions<TContract>,\n ): DynamicModule {\n const providers: Provider[] = [\n {\n provide: MODULE_OPTIONS_TOKEN,\n useFactory: options.useFactory,\n inject: options.inject ?? [],\n },\n AmqpClientService,\n ];\n\n return {\n module: AmqpClientModule,\n imports: options.imports ?? [],\n providers,\n exports: [AmqpClientService],\n };\n }\n}\n"],"mappings":";;;;;;;;;;AAIA,MAAa,uBAAuB,OAAO,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;AC6EjE,8BAAM,kBAEb;CACE,AAAQ,SAA4C;CAEpD,YACE,AACiB,SACjB;EADiB;;;;;;;;;CAUnB,MAAM,eAA8B;AAClC,OAAK,SAAS,MAAM,gBAAgB,OAAO,KAAK,QAAQ,CAAC,iBAAiB;;;;;;;;;CAU5E,MAAM,kBAAiC;AACrC,MAAI,KAAK,QAAQ;AACf,SAAM,KAAK,OAAO,OAAO,CAAC,iBAAiB;AAC3C,QAAK,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiClB,QACE,eACA,SACA,SAC+D;AAC/D,MAAI,CAAC,KAAK,OACR,QAAO,OAAO,MACZ,OAAO,MACL,IAAIA,iBACF,oFACD,CACF,CACF;AAGH,SAAO,KAAK,OAAO,QAAQ,eAAe,SAAS,QAAQ;;;;CAhF9D,YAAY;oBAOR,OAAO,qBAAqB;;;;;;;ACQ1B,iDAAM,iBAAiB;;;;;;;CAO5B,OAAO,QACL,SACe;AACf,SAAO;GACL;GACA,WAAW,CACT;IACE,SAAS;IACT,UAAU;IACX,EACD,kBACD;GACD,SAAS,CAAC,kBAAkB;GAC7B;;;;;;;;CASH,OAAO,aACL,SACe;EACf,MAAM,YAAwB,CAC5B;GACE,SAAS;GACT,YAAY,QAAQ;GACpB,QAAQ,QAAQ,UAAU,EAAE;GAC7B,EACD,kBACD;AAED,SAAO;GACL;GACA,SAAS,QAAQ,WAAW,EAAE;GAC9B;GACA,SAAS,CAAC,kBAAkB;GAC7B;;;mDA/CJ,OAAO,EAAE,CAAC"}
package/docs/index.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  ### AmqpClientModule
10
10
 
11
- Defined in: [packages/client-nestjs/src/client.module.ts:93](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.module.ts#L93)
11
+ Defined in: [packages/client-nestjs/src/client.module.ts:96](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.module.ts#L96)
12
12
 
13
13
  NestJS module for AMQP client integration
14
14
  This module provides type-safe AMQP client functionality using @amqp-contract/client
@@ -84,7 +84,7 @@ new AmqpClientModule(): AmqpClientModule;
84
84
  static forRoot<TContract>(options): DynamicModule;
85
85
  ```
86
86
 
87
- Defined in: [packages/client-nestjs/src/client.module.ts:100](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.module.ts#L100)
87
+ Defined in: [packages/client-nestjs/src/client.module.ts:103](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.module.ts#L103)
88
88
 
89
89
  Register the AMQP client module with synchronous configuration
90
90
 
@@ -112,7 +112,7 @@ A dynamic module for NestJS
112
112
  static forRootAsync<TContract>(options): DynamicModule;
113
113
  ```
114
114
 
115
- Defined in: [packages/client-nestjs/src/client.module.ts:122](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.module.ts#L122)
115
+ Defined in: [packages/client-nestjs/src/client.module.ts:125](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.module.ts#L125)
116
116
 
117
117
  Register the AMQP client module with asynchronous configuration
118
118
 
@@ -138,7 +138,7 @@ A dynamic module for NestJS
138
138
 
139
139
  ### AmqpClientService
140
140
 
141
- Defined in: [packages/client-nestjs/src/client.service.ts:82](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.service.ts#L82)
141
+ Defined in: [packages/client-nestjs/src/client.service.ts:82](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.service.ts#L82)
142
142
 
143
143
  Type-safe AMQP client service for NestJS applications.
144
144
 
@@ -199,7 +199,7 @@ export class OrderService {
199
199
  new AmqpClientService<TContract>(options): AmqpClientService<TContract>;
200
200
  ```
201
201
 
202
- Defined in: [packages/client-nestjs/src/client.service.ts:87](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.service.ts#L87)
202
+ Defined in: [packages/client-nestjs/src/client.service.ts:87](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.service.ts#L87)
203
203
 
204
204
  ###### Parameters
205
205
 
@@ -219,7 +219,7 @@ Defined in: [packages/client-nestjs/src/client.service.ts:87](https://github.com
219
219
  onModuleDestroy(): Promise<void>;
220
220
  ```
221
221
 
222
- Defined in: [packages/client-nestjs/src/client.service.ts:110](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.service.ts#L110)
222
+ Defined in: [packages/client-nestjs/src/client.service.ts:110](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.service.ts#L110)
223
223
 
224
224
  Close the AMQP client when the NestJS module is destroyed.
225
225
 
@@ -243,7 +243,7 @@ OnModuleDestroy.onModuleDestroy
243
243
  onModuleInit(): Promise<void>;
244
244
  ```
245
245
 
246
- Defined in: [packages/client-nestjs/src/client.service.ts:99](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.service.ts#L99)
246
+ Defined in: [packages/client-nestjs/src/client.service.ts:99](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.service.ts#L99)
247
247
 
248
248
  Initialize the AMQP client when the NestJS module starts.
249
249
 
@@ -272,7 +272,7 @@ publish<TName>(
272
272
  | MessageValidationError>>;
273
273
  ```
274
274
 
275
- Defined in: [packages/client-nestjs/src/client.service.ts:146](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.service.ts#L146)
275
+ Defined in: [packages/client-nestjs/src/client.service.ts:146](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.service.ts#L146)
276
276
 
277
277
  Publish a message using a contract-defined publisher.
278
278
 
@@ -475,9 +475,20 @@ Error.prepareStackTrace
475
475
 
476
476
  ### MessageValidationError
477
477
 
478
- Defined in: packages/client/dist/index.d.mts:83
478
+ Defined in: packages/core/dist/index.d.mts:83
479
479
 
480
- Error thrown when message validation fails
480
+ Error thrown when message validation fails (payload or headers).
481
+
482
+ Used by both the client (publish-time payload validation) and the worker
483
+ (consume-time payload and headers validation).
484
+
485
+ #### Param
486
+
487
+ The name of the publisher or consumer that triggered the validation
488
+
489
+ #### Param
490
+
491
+ The validation issues from the Standard Schema validation
481
492
 
482
493
  #### Extends
483
494
 
@@ -488,10 +499,10 @@ Error thrown when message validation fails
488
499
  | Property | Modifier | Type | Inherited from | Defined in |
489
500
  | ------ | ------ | ------ | ------ | ------ |
490
501
  | <a id="cause-1"></a> `cause?` | `public` | `unknown` | `Error.cause` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 |
491
- | <a id="issues"></a> `issues` | `readonly` | `unknown` | - | packages/client/dist/index.d.mts:85 |
502
+ | <a id="issues"></a> `issues` | `readonly` | `unknown` | - | packages/core/dist/index.d.mts:85 |
492
503
  | <a id="message-1"></a> `message` | `public` | `string` | `Error.message` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 |
493
504
  | <a id="name-1"></a> `name` | `public` | `string` | `Error.name` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 |
494
- | <a id="publishername"></a> `publisherName` | `readonly` | `string` | - | packages/client/dist/index.d.mts:84 |
505
+ | <a id="source"></a> `source` | `readonly` | `string` | - | packages/core/dist/index.d.mts:84 |
495
506
  | <a id="stack-1"></a> `stack?` | `public` | `string` | `Error.stack` | node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 |
496
507
 
497
508
  ## Type Aliases
@@ -502,7 +513,7 @@ Error thrown when message validation fails
502
513
  type AmqpClientModuleAsyncOptions<TContract> = object;
503
514
  ```
504
515
 
505
- Defined in: [packages/client-nestjs/src/client.module.ts:22](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.module.ts#L22)
516
+ Defined in: [packages/client-nestjs/src/client.module.ts:22](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.module.ts#L22)
506
517
 
507
518
  Options for async module configuration using factory pattern
508
519
 
@@ -516,9 +527,35 @@ Options for async module configuration using factory pattern
516
527
 
517
528
  | Property | Type | Description | Defined in |
518
529
  | ------ | ------ | ------ | ------ |
519
- | <a id="imports"></a> `imports?` | `ModuleMetadata`\[`"imports"`\] | Optional list of imported modules that export providers needed by the factory | [packages/client-nestjs/src/client.module.ts:37](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.module.ts#L37) |
520
- | <a id="inject"></a> `inject?` | (`string` \| `symbol` \| `Type`&lt;`unknown`&gt;)[] | Optional dependencies to inject into the factory function. Can be a token (string/symbol) or a class reference to a provider. | [packages/client-nestjs/src/client.module.ts:33](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.module.ts#L33) |
521
- | <a id="usefactory"></a> `useFactory` | (...`args`) => `AmqpClientModuleOptionsFactory`&lt;`TContract`&gt; | Factory function that returns the module options. Can use injected dependencies to create configuration. | [packages/client-nestjs/src/client.module.ts:28](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.module.ts#L28) |
530
+ | <a id="imports"></a> `imports?` | `ModuleMetadata`\[`"imports"`\] | Optional list of imported modules that export providers needed by the factory | [packages/client-nestjs/src/client.module.ts:40](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.module.ts#L40) |
531
+ | <a id="inject"></a> `inject?` | (`string` \| `symbol` \| `Type`&lt;`unknown`&gt;)[] | Optional dependencies to inject into the factory function. Can be a token (string/symbol) or a class reference to a provider. | [packages/client-nestjs/src/client.module.ts:36](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.module.ts#L36) |
532
+
533
+ #### Methods
534
+
535
+ ##### useFactory()
536
+
537
+ ```ts
538
+ useFactory(...args): AmqpClientModuleOptionsFactory<TContract>;
539
+ ```
540
+
541
+ Defined in: [packages/client-nestjs/src/client.module.ts:31](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.module.ts#L31)
542
+
543
+ Factory function that returns the module options.
544
+ Can use injected dependencies to create configuration.
545
+
546
+ Method syntax is intentional: it enables bivariant parameter checking so
547
+ users can write typed factories like `(config: ConfigService) => ({ ... })`
548
+ without casting, even though the actual args come from NestJS DI at runtime.
549
+
550
+ ###### Parameters
551
+
552
+ | Parameter | Type |
553
+ | ------ | ------ |
554
+ | ...`args` | `unknown`[] |
555
+
556
+ ###### Returns
557
+
558
+ `AmqpClientModuleOptionsFactory`&lt;`TContract`&gt;
522
559
 
523
560
  ***
524
561
 
@@ -528,7 +565,7 @@ Options for async module configuration using factory pattern
528
565
  type AmqpClientModuleOptions<TContract> = object;
529
566
  ```
530
567
 
531
- Defined in: [packages/client-nestjs/src/client.service.ts:30](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.service.ts#L30)
568
+ Defined in: [packages/client-nestjs/src/client.service.ts:30](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.service.ts#L30)
532
569
 
533
570
  Configuration options for the AMQP client NestJS module.
534
571
 
@@ -554,9 +591,9 @@ const options: AmqpClientModuleOptions<typeof contract> = {
554
591
 
555
592
  | Property | Type | Description | Defined in |
556
593
  | ------ | ------ | ------ | ------ |
557
- | <a id="connectionoptions"></a> `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration (heartbeat, reconnect settings, etc.) | [packages/client-nestjs/src/client.service.ts:36](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.service.ts#L36) |
558
- | <a id="contract"></a> `contract` | `TContract` | The AMQP contract definition specifying publishers and their message schemas | [packages/client-nestjs/src/client.service.ts:32](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.service.ts#L32) |
559
- | <a id="urls"></a> `urls` | `ConnectionUrl`[] | AMQP broker URL(s). Multiple URLs provide failover support | [packages/client-nestjs/src/client.service.ts:34](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.service.ts#L34) |
594
+ | <a id="connectionoptions"></a> `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration (heartbeat, reconnect settings, etc.) | [packages/client-nestjs/src/client.service.ts:36](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.service.ts#L36) |
595
+ | <a id="contract"></a> `contract` | `TContract` | The AMQP contract definition specifying publishers and their message schemas | [packages/client-nestjs/src/client.service.ts:32](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.service.ts#L32) |
596
+ | <a id="urls"></a> `urls` | `ConnectionUrl`[] | AMQP broker URL(s). Multiple URLs provide failover support | [packages/client-nestjs/src/client.service.ts:34](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.service.ts#L34) |
560
597
 
561
598
  ***
562
599
 
@@ -585,7 +622,7 @@ Infer publisher input type (message payload) for a specific publisher in a contr
585
622
  const MODULE_OPTIONS_TOKEN: typeof MODULE_OPTIONS_TOKEN;
586
623
  ```
587
624
 
588
- Defined in: [packages/client-nestjs/src/client.module-definition.ts:5](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/client-nestjs/src/client.module-definition.ts#L5)
625
+ Defined in: [packages/client-nestjs/src/client.module-definition.ts:5](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/client-nestjs/src/client.module-definition.ts#L5)
589
626
 
590
627
  Injection token for AMQP client module options
591
628
  Used by NestJS DI system to inject configuration into AmqpClientService
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amqp-contract/client-nestjs",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "NestJS integration for @amqp-contract/client",
5
5
  "keywords": [
6
6
  "amqp",
@@ -52,9 +52,9 @@
52
52
  "docs"
53
53
  ],
54
54
  "dependencies": {
55
- "@amqp-contract/client": "0.18.0",
56
- "@amqp-contract/contract": "0.18.0",
57
- "@amqp-contract/core": "0.18.0"
55
+ "@amqp-contract/client": "0.19.0",
56
+ "@amqp-contract/contract": "0.19.0",
57
+ "@amqp-contract/core": "0.19.0"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@nestjs/common": "11.1.13",
@@ -74,7 +74,7 @@
74
74
  "typescript": "5.9.3",
75
75
  "vitest": "4.0.18",
76
76
  "zod": "4.3.6",
77
- "@amqp-contract/testing": "0.18.0",
77
+ "@amqp-contract/testing": "0.19.0",
78
78
  "@amqp-contract/tsconfig": "0.1.0",
79
79
  "@amqp-contract/typedoc": "0.1.0"
80
80
  },