plugin-common.module.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { Module } from '@nestjs/common';
  2. import { CacheModule } from '../cache/cache.module';
  3. import { ConfigModule } from '../config/config.module';
  4. import { ConnectionModule } from '../connection/connection.module';
  5. import { EventBusModule } from '../event-bus/event-bus.module';
  6. import { HealthCheckModule } from '../health-check/health-check.module';
  7. import { I18nModule } from '../i18n/i18n.module';
  8. import { JobQueueModule } from '../job-queue/job-queue.module';
  9. import { ProcessContextModule } from '../process-context/process-context.module';
  10. import { ServiceModule } from '../service/service.module';
  11. /**
  12. * @description
  13. * This module provides the common services, configuration, and event bus capabilities
  14. * required by a typical plugin. It should be imported into plugins to avoid having to
  15. * repeat the same boilerplate for each individual plugin.
  16. *
  17. * The PluginCommonModule exports:
  18. *
  19. * * `EventBusModule`, allowing the injection of the {@link EventBus} service.
  20. * * `ServiceModule` allowing the injection of any of the various entity services such as ProductService, OrderService etc.
  21. * * `ConfigModule`, allowing the injection of the ConfigService.
  22. * * `JobQueueModule`, allowing the injection of the {@link JobQueueService}.
  23. * * `HealthCheckModule`, allowing the injection of the {@link HealthCheckRegistryService}.
  24. *
  25. * @docsCategory plugin
  26. */
  27. @Module({
  28. imports: [
  29. EventBusModule,
  30. ConfigModule,
  31. ConnectionModule.forPlugin(),
  32. ServiceModule,
  33. JobQueueModule,
  34. HealthCheckModule,
  35. CacheModule,
  36. I18nModule,
  37. ProcessContextModule,
  38. ],
  39. exports: [
  40. EventBusModule,
  41. ConfigModule,
  42. ConnectionModule.forPlugin(),
  43. ServiceModule,
  44. JobQueueModule,
  45. HealthCheckModule,
  46. CacheModule,
  47. I18nModule,
  48. ProcessContextModule,
  49. ],
  50. })
  51. export class PluginCommonModule {}