@lenne.tech/nest-server 9.0.0 → 9.0.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/nest-server",
3
- "version": "9.0.0",
3
+ "version": "9.0.1",
4
4
  "description": "Modern, fast, powerful Node.js web framework in TypeScript based on Nest with a GraphQL API and a connection to MongoDB (or other databases).",
5
5
  "keywords": [
6
6
  "node",
@@ -1,3 +1,4 @@
1
+ import { OnApplicationBootstrap } from '@nestjs/common';
1
2
  import { CronExpression, SchedulerRegistry } from '@nestjs/schedule';
2
3
  import { CronJob } from 'cron';
3
4
  import { CronJobConfig } from '../interfaces/cron-job-config.interface';
@@ -6,7 +7,7 @@ import { Falsy } from '../types/falsy.type';
6
7
  /**
7
8
  * Cron jobs service to extend
8
9
  */
9
- export abstract class CoreCronJobs {
10
+ export abstract class CoreCronJobs implements OnApplicationBootstrap {
10
11
  /**
11
12
  * Config for cron jobs
12
13
  */
@@ -36,6 +37,16 @@ export abstract class CoreCronJobs {
36
37
  log: true,
37
38
  ...options,
38
39
  };
40
+ }
41
+
42
+ /**
43
+ * Lifecycle hook method: Called once all modules have been initialized, but before listening for connections.
44
+ * Required to ensure that all services have been previously initiated
45
+ */
46
+ onApplicationBootstrap() {
47
+ if (this.config.log) {
48
+ console.info('Init CronJobs after application bootstrap');
49
+ }
39
50
  this.initCronJobs();
40
51
  }
41
52