plugin-common.module.ts 2.0 KB

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