@wabot-dev/framework 0.5.11 → 0.5.13

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.
@@ -33,7 +33,6 @@ __decorate([
33
33
  ], SocketChannelReceivedMessage.prototype, "senderName", void 0);
34
34
  __decorate([
35
35
  isString(),
36
- isNotEmpty(),
37
36
  isOptional(),
38
37
  __metadata("design:type", String)
39
38
  ], SocketChannelReceivedMessage.prototype, "text", void 0);
@@ -9,6 +9,9 @@ class CronJob extends Entity {
9
9
  this.computeNextRun(new Date());
10
10
  }
11
11
  }
12
+ get schedule() {
13
+ return this.data.cron;
14
+ }
12
15
  get nextRunAt() {
13
16
  return this.data.nextRunAt ? new Date(this.data.nextRunAt) : null;
14
17
  }
@@ -60,7 +60,9 @@ let CronScheduler = class CronScheduler {
60
60
  this.logger.debug(`start reconciliation of crons ${configToReconciliate.map((x) => x.name).join(', ')}`);
61
61
  try {
62
62
  const cronJobs = await Promise.all(configToReconciliate.map((x) => this.reconciliateConfig(x)));
63
- this.logger.info(`Cron reconciliation succeeded for ${configToReconciliate.map((x) => x.name).join(', ')}`);
63
+ for (const cronJob of cronJobs) {
64
+ this.logger.info(`config CRON ${cronJob.name} ${cronJob.schedule}`);
65
+ }
64
66
  this.jobScheduler.start(cronJobs.map((x) => x.commandName));
65
67
  this.jobWatchdog.start(cronJobs.map((x) => x.commandName));
66
68
  }
@@ -126,7 +128,7 @@ let CronScheduler = class CronScheduler {
126
128
  }
127
129
  }
128
130
  await this.cronRepo.update(fresh);
129
- this.logger.info(`Cron ${fresh.id} spawned ${executions} job(s), next at ${fresh.nextRunAt.toISOString()}`);
131
+ this.logger.info(`Cron ${fresh.name} spawned ${executions} job(s), next at ${fresh.nextRunAt.toISOString()}`);
130
132
  });
131
133
  }
132
134
  async reconciliateConfig(config) {
@@ -23,7 +23,9 @@ let JobScheduler = class JobScheduler {
23
23
  }
24
24
  start(commands) {
25
25
  commands.forEach((x) => this.commands.add(x));
26
- this.logger.info(`Starting job handlers for commands ${commands.join(', ')}`);
26
+ for (const command of commands) {
27
+ this.logger.info(`config COMMAND ${command}`);
28
+ }
27
29
  if (this.commands.size > 0 && !this.running) {
28
30
  this.running = true;
29
31
  this.tick();
@@ -604,6 +604,7 @@ interface ICronJobData extends IEntityData {
604
604
  }
605
605
  declare class CronJob extends Entity<ICronJobData> {
606
606
  constructor(data: ICronJobData);
607
+ get schedule(): string;
607
608
  get nextRunAt(): Date | null;
608
609
  get lastRunAt(): Date | null;
609
610
  get maxConcurrency(): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wabot-dev/framework",
3
- "version": "0.5.11",
3
+ "version": "0.5.13",
4
4
  "description": "Framework for IA Chat Bots",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",