@pristine-ts/scheduling 0.0.173 → 0.0.177

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.
@@ -25,7 +25,25 @@ exports.SchedulerManager = void 0;
25
25
  const tsyringe_1 = require("tsyringe");
26
26
  const common_1 = require("@pristine-ts/common");
27
27
  const scheduling_module_keyname_1 = require("../scheduling.module.keyname");
28
+ /**
29
+ * The Scheduler Manager runs the scheduled tasks.A scheduled task cannot specify the interval at which it wants to be triggered.
30
+ * It's only a mechanism to understand that must be triggered by a CRON.
31
+ * When used with a CRON, a scheduled task will be triggered at a recurring interval, it is your own responsibility to implement a
32
+ * logic of executing or not based on how long it's been since the last execution.
33
+ * Please look at the aws-scheduling module for an example of how to setup a CRON using AWS Event Bridge with Pristine's listeners.
34
+ * It is tagged so it can be injected using SchedulerInterface.
35
+ * It is module scoped to the scheduling module.
36
+ */
28
37
  let SchedulerManager = class SchedulerManager {
38
+ /**
39
+ * The Scheduler Manager runs the scheduled tasks.A scheduled task cannot specify the interval at which it wants to be triggered.
40
+ * It's only a mechanism to understand that must be triggered by a CRON.
41
+ * When used with a CRON, a scheduled task will be triggered at a recurring interval, it is your own responsibility to implement a
42
+ * logic of executing or not based on how long it's been since the last execution.
43
+ * Please look at the aws-scheduling module for an example of how to setup a CRON using AWS Event Bridge with Pristine's listeners.
44
+ * @param scheduledTasks The scheduled tasks to run. All services with the tag ServiceDefinitionTagEnum.ScheduledTask will be automatically injected here.
45
+ * @param logHandler The log handler to use to output logs.
46
+ */
29
47
  constructor(scheduledTasks, logHandler) {
30
48
  this.scheduledTasks = scheduledTasks;
31
49
  this.logHandler = logHandler;
@@ -41,7 +59,7 @@ let SchedulerManager = class SchedulerManager {
41
59
  this.scheduledTasks.forEach(scheduledTask => {
42
60
  promises.push(scheduledTask.run());
43
61
  });
44
- this.logHandler.debug("Completed the execution of the tasks.", { scheduledTasks: this.scheduledTasks }, scheduling_module_keyname_1.SchedulingModuleKeyname);
62
+ this.logHandler.debug("Completed triggering all the tasks.", { scheduledTasks: this.scheduledTasks }, scheduling_module_keyname_1.SchedulingModuleKeyname);
45
63
  Promise.allSettled(promises).then(results => {
46
64
  results.forEach(result => {
47
65
  if (result.status === 'fulfilled') {
@@ -1 +1 @@
1
- {"version":3,"file":"scheduler.manager.js","sourceRoot":"","sources":["../../../../src/managers/scheduler.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAuD;AAEvD,gDAAgF;AAChF,4EAAqE;AAOrE,IAAa,gBAAgB,GAA7B,MAAa,gBAAgB;IACzB,YAAgF,cAAwC,EAC5D,UAA+B;QADX,mBAAc,GAAd,cAAc,CAA0B;QAC5D,eAAU,GAAV,UAAU,CAAqB;IAC3F,CAAC;IAED;;OAEG;IACG,QAAQ;;YACV,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,sCAAsC,EAAE,EAAC,cAAc,EAAE,IAAI,CAAC,cAAc,EAAC,EAAE,mDAAuB,CAAC,CAAC;YAE9H,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;gBACzB,MAAM,QAAQ,GAAoB,EAAE,CAAC;gBAErC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;oBACxC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC;gBACvC,CAAC,CAAC,CAAC;gBAEH,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,uCAAuC,EAAE,EAAC,cAAc,EAAE,IAAI,CAAC,cAAc,EAAC,EAAE,mDAAuB,CAAC,CAAC;gBAE/H,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;oBACxC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;wBACrB,IAAG,MAAM,CAAC,MAAM,KAAK,WAAW,EAAE;4BAC9B,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,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, "__esModule", { value: true });
13
13
  exports.SchedulingModule = void 0;
14
14
  const logging_1 = require("@pristine-ts/logging");
15
15
  const scheduling_module_keyname_1 = require("./scheduling.module.keyname");
16
- const event_1 = require("@pristine-ts/event");
17
16
  const core_1 = require("@pristine-ts/core");
18
17
  __exportStar(require("./interfaces/interfaces"), exports);
19
18
  __exportStar(require("./managers/managers"), exports);
@@ -22,7 +21,6 @@ exports.SchedulingModule = {
22
21
  keyname: scheduling_module_keyname_1.SchedulingModuleKeyname,
23
22
  importModules: [
24
23
  logging_1.LoggingModule,
25
- event_1.EventModule,
26
24
  core_1.CoreModule,
27
25
  ],
28
26
  providerRegistrations: [],
@@ -1 +1 @@
1
- {"version":3,"file":"scheduling.module.js","sourceRoot":"","sources":["../../../src/scheduling.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,kDAAmD;AACnD,2EAAoE;AACpE,8CAA+C;AAC/C,4CAA6C;AAE7C,0DAAwC;AACxC,sDAAoC;AACpC,gDAA8B;AAEjB,QAAA,gBAAgB,GAAoB;IAC7C,OAAO,EAAE,mDAAuB;IAChC,aAAa,EAAE;QACX,uBAAa;QACb,mBAAW;QACX,iBAAU;KACb;IACD,qBAAqB,EAAE,EAAE;IACzB,wBAAwB,EAAE,EACzB;CAEJ,CAAA"}
1
+ {"version":3,"file":"scheduling.module.js","sourceRoot":"","sources":["../../../src/scheduling.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,kDAAmD;AACnD,2EAAoE;AACpE,4CAA6C;AAE7C,0DAAwC;AACxC,sDAAoC;AACpC,gDAA8B;AAEjB,QAAA,gBAAgB,GAAoB;IAC7C,OAAO,EAAE,mDAAuB;IAChC,aAAa,EAAE;QACX,uBAAa;QACb,iBAAU;KACb;IACD,qBAAqB,EAAE,EAAE;IACzB,wBAAwB,EAAE,EACzB;CAEJ,CAAA"}
@@ -18,6 +18,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.DefaultTask = void 0;
19
19
  const tsyringe_1 = require("tsyringe");
20
20
  const common_1 = require("@pristine-ts/common");
21
+ /**
22
+ * The default task is here so that there is at least one service with the ServiceDefinitionTagEnum.ScheduledTask.
23
+ * It does not do anything.
24
+ * Until there's a fix for: https://github.com/microsoft/tsyringe/issues/63
25
+ */
21
26
  let DefaultTask = class DefaultTask {
22
27
  run() {
23
28
  return __awaiter(this, void 0, void 0, function* () {
@@ -1 +1 @@
1
- {"version":3,"file":"default.task.js","sourceRoot":"","sources":["../../../../src/tasks/default.task.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,uCAAoC;AACpC,gDAAkE;AAIlE,IAAa,WAAW,GAAxB,MAAa,WAAW;IACd,GAAG;;QACT,CAAC;KAAA;CACJ,CAAA;AAHY,WAAW;IAFvB,qBAAU,EAAE;IACZ,YAAG,CAAC,iCAAwB,CAAC,aAAa,CAAC;GAC/B,WAAW,CAGvB;AAHY,kCAAW"}
1
+ {"version":3,"file":"default.task.js","sourceRoot":"","sources":["../../../../src/tasks/default.task.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,uCAAoC;AACpC,gDAAkE;AAElE;;;;GAIG;AAGH,IAAa,WAAW,GAAxB,MAAa,WAAW;IACd,GAAG;;QACT,CAAC;KAAA;CACJ,CAAA;AAHY,WAAW;IAFvB,qBAAU,EAAE;IACZ,YAAG,CAAC,iCAAwB,CAAC,aAAa,CAAC;GAC/B,WAAW,CAGvB;AAHY,kCAAW"}
@@ -22,7 +22,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  import { injectable, injectAll, inject } from "tsyringe";
23
23
  import { moduleScoped, ServiceDefinitionTagEnum, tag } from "@pristine-ts/common";
24
24
  import { SchedulingModuleKeyname } from "../scheduling.module.keyname";
25
+ /**
26
+ * The Scheduler Manager runs the scheduled tasks.A scheduled task cannot specify the interval at which it wants to be triggered.
27
+ * It's only a mechanism to understand that must be triggered by a CRON.
28
+ * When used with a CRON, a scheduled task will be triggered at a recurring interval, it is your own responsibility to implement a
29
+ * logic of executing or not based on how long it's been since the last execution.
30
+ * Please look at the aws-scheduling module for an example of how to setup a CRON using AWS Event Bridge with Pristine's listeners.
31
+ * It is tagged so it can be injected using SchedulerInterface.
32
+ * It is module scoped to the scheduling module.
33
+ */
25
34
  let SchedulerManager = class SchedulerManager {
35
+ /**
36
+ * The Scheduler Manager runs the scheduled tasks.A scheduled task cannot specify the interval at which it wants to be triggered.
37
+ * It's only a mechanism to understand that must be triggered by a CRON.
38
+ * When used with a CRON, a scheduled task will be triggered at a recurring interval, it is your own responsibility to implement a
39
+ * logic of executing or not based on how long it's been since the last execution.
40
+ * Please look at the aws-scheduling module for an example of how to setup a CRON using AWS Event Bridge with Pristine's listeners.
41
+ * @param scheduledTasks The scheduled tasks to run. All services with the tag ServiceDefinitionTagEnum.ScheduledTask will be automatically injected here.
42
+ * @param logHandler The log handler to use to output logs.
43
+ */
26
44
  constructor(scheduledTasks, logHandler) {
27
45
  this.scheduledTasks = scheduledTasks;
28
46
  this.logHandler = logHandler;
@@ -38,7 +56,7 @@ let SchedulerManager = class SchedulerManager {
38
56
  this.scheduledTasks.forEach(scheduledTask => {
39
57
  promises.push(scheduledTask.run());
40
58
  });
41
- this.logHandler.debug("Completed the execution of the tasks.", { scheduledTasks: this.scheduledTasks }, SchedulingModuleKeyname);
59
+ this.logHandler.debug("Completed triggering all the tasks.", { scheduledTasks: this.scheduledTasks }, SchedulingModuleKeyname);
42
60
  Promise.allSettled(promises).then(results => {
43
61
  results.forEach(result => {
44
62
  if (result.status === 'fulfilled') {
@@ -1 +1 @@
1
- {"version":3,"file":"scheduler.manager.js","sourceRoot":"","sources":["../../../../src/managers/scheduler.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AAEvD,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBA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,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC;gBACvC,CAAC,CAAC,CAAC;gBAEH,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,qCAAqC,EAAE,EAAC,cAAc,EAAE,IAAI,CAAC,cAAc,EAAC,EAAE,uBAAuB,CAAC,CAAC;gBAE7H,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;oBACxC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;wBACrB,IAAG,MAAM,CAAC,MAAM,KAAK,WAAW,EAAE;4BAC9B,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,0BAA0B,EAAE,EAAC,MAAM,EAAC,EAAE,uBAAuB,CAAC,CAAA;yBACvF;6BACI;4BACD,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,sBAAsB,EAAE;gCAC1C,MAAM,EAAE;oCACJ,MAAM,EAAE,MAAM,CAAC,MAAM;oCACrB,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,EAAE;iCAC7B;6BACJ,EAAE,uBAAuB,CAAC,CAAA;yBAC9B;oBACL,CAAC,CAAC,CAAC;oBAEH,OAAO,OAAO,EAAE,CAAC;gBACrB,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAA;QACN,CAAC;KAAA;CACJ,CAAA;AAjDY,gBAAgB;IAH5B,YAAY,CAAC,uBAAuB,CAAC;IACrC,GAAG,CAAC,oBAAoB,CAAC;IACzB,UAAU,EAAE;IAYI,WAAA,SAAS,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAA;IACjD,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;;GAZjC,gBAAgB,CAiD5B;SAjDY,gBAAgB"}
@@ -1,6 +1,5 @@
1
1
  import { LoggingModule } from "@pristine-ts/logging";
2
2
  import { SchedulingModuleKeyname } from "./scheduling.module.keyname";
3
- import { EventModule } from "@pristine-ts/event";
4
3
  import { CoreModule } from "@pristine-ts/core";
5
4
  export * from "./interfaces/interfaces";
6
5
  export * from "./managers/managers";
@@ -9,7 +8,6 @@ export const SchedulingModule = {
9
8
  keyname: SchedulingModuleKeyname,
10
9
  importModules: [
11
10
  LoggingModule,
12
- EventModule,
13
11
  CoreModule,
14
12
  ],
15
13
  providerRegistrations: [],
@@ -1 +1 @@
1
- {"version":3,"file":"scheduling.module.js","sourceRoot":"","sources":["../../../src/scheduling.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAC,uBAAuB,EAAC,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAE7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAE9B,MAAM,CAAC,MAAM,gBAAgB,GAAoB;IAC7C,OAAO,EAAE,uBAAuB;IAChC,aAAa,EAAE;QACX,aAAa;QACb,WAAW;QACX,UAAU;KACb;IACD,qBAAqB,EAAE,EAAE;IACzB,wBAAwB,EAAE,EACzB;CAEJ,CAAA"}
1
+ {"version":3,"file":"scheduling.module.js","sourceRoot":"","sources":["../../../src/scheduling.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAC,uBAAuB,EAAC,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAE7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAE9B,MAAM,CAAC,MAAM,gBAAgB,GAAoB;IAC7C,OAAO,EAAE,uBAAuB;IAChC,aAAa,EAAE;QACX,aAAa;QACb,UAAU;KACb;IACD,qBAAqB,EAAE,EAAE;IACzB,wBAAwB,EAAE,EACzB;CAEJ,CAAA"}
@@ -15,6 +15,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
15
15
  };
16
16
  import { injectable } from "tsyringe";
17
17
  import { ServiceDefinitionTagEnum, tag } from "@pristine-ts/common";
18
+ /**
19
+ * The default task is here so that there is at least one service with the ServiceDefinitionTagEnum.ScheduledTask.
20
+ * It does not do anything.
21
+ * Until there's a fix for: https://github.com/microsoft/tsyringe/issues/63
22
+ */
18
23
  let DefaultTask = class DefaultTask {
19
24
  run() {
20
25
  return __awaiter(this, void 0, void 0, function* () {
@@ -1 +1 @@
1
- {"version":3,"file":"default.task.js","sourceRoot":"","sources":["../../../../src/tasks/default.task.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAC,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AAIlE,IAAa,WAAW,GAAxB,MAAa,WAAW;IACd,GAAG;;QACT,CAAC;KAAA;CACJ,CAAA;AAHY,WAAW;IAFvB,UAAU,EAAE;IACZ,GAAG,CAAC,wBAAwB,CAAC,aAAa,CAAC;GAC/B,WAAW,CAGvB;SAHY,WAAW"}
1
+ {"version":3,"file":"default.task.js","sourceRoot":"","sources":["../../../../src/tasks/default.task.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAC,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AAElE;;;;GAIG;AAGH,IAAa,WAAW,GAAxB,MAAa,WAAW;IACd,GAAG;;QACT,CAAC;KAAA;CACJ,CAAA;AAHY,WAAW;IAFvB,UAAU,EAAE;IACZ,GAAG,CAAC,wBAAwB,CAAC,aAAa,CAAC;GAC/B,WAAW,CAGvB;SAHY,WAAW"}
@@ -1,3 +1,9 @@
1
+ /**
2
+ * This interface defines what a Scheduled task should implement.
3
+ */
1
4
  export interface ScheduledTaskInterface {
5
+ /**
6
+ * This method runs the actual task.
7
+ */
2
8
  run(): Promise<void>;
3
9
  }
@@ -1,3 +1,9 @@
1
+ /**
2
+ * This interface defines what a Scheduler should implement.
3
+ */
1
4
  export interface SchedulerInterface {
5
+ /**
6
+ * This method runs all the tasks that were registered.
7
+ */
2
8
  runTasks(): Promise<void>;
3
9
  }
@@ -1,9 +1,27 @@
1
1
  import { ScheduledTaskInterface } from "../interfaces/scheduled-task.interface";
2
2
  import { SchedulerInterface } from "../interfaces/scheduler.interface";
3
3
  import { LogHandlerInterface } from "@pristine-ts/logging";
4
+ /**
5
+ * The Scheduler Manager runs the scheduled tasks.A scheduled task cannot specify the interval at which it wants to be triggered.
6
+ * It's only a mechanism to understand that must be triggered by a CRON.
7
+ * When used with a CRON, a scheduled task will be triggered at a recurring interval, it is your own responsibility to implement a
8
+ * logic of executing or not based on how long it's been since the last execution.
9
+ * Please look at the aws-scheduling module for an example of how to setup a CRON using AWS Event Bridge with Pristine's listeners.
10
+ * It is tagged so it can be injected using SchedulerInterface.
11
+ * It is module scoped to the scheduling module.
12
+ */
4
13
  export declare class SchedulerManager implements SchedulerInterface {
5
14
  private readonly scheduledTasks;
6
15
  private readonly logHandler;
16
+ /**
17
+ * The Scheduler Manager runs the scheduled tasks.A scheduled task cannot specify the interval at which it wants to be triggered.
18
+ * It's only a mechanism to understand that must be triggered by a CRON.
19
+ * When used with a CRON, a scheduled task will be triggered at a recurring interval, it is your own responsibility to implement a
20
+ * logic of executing or not based on how long it's been since the last execution.
21
+ * Please look at the aws-scheduling module for an example of how to setup a CRON using AWS Event Bridge with Pristine's listeners.
22
+ * @param scheduledTasks The scheduled tasks to run. All services with the tag ServiceDefinitionTagEnum.ScheduledTask will be automatically injected here.
23
+ * @param logHandler The log handler to use to output logs.
24
+ */
7
25
  constructor(scheduledTasks: ScheduledTaskInterface[], logHandler: LogHandlerInterface);
8
26
  /**
9
27
  * This method runs all the tasks that were registered.
@@ -1,4 +1,9 @@
1
1
  import { ScheduledTaskInterface } from "../interfaces/scheduled-task.interface";
2
+ /**
3
+ * The default task is here so that there is at least one service with the ServiceDefinitionTagEnum.ScheduledTask.
4
+ * It does not do anything.
5
+ * Until there's a fix for: https://github.com/microsoft/tsyringe/issues/63
6
+ */
2
7
  export declare class DefaultTask implements ScheduledTaskInterface {
3
8
  run(): Promise<void>;
4
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pristine-ts/scheduling",
3
- "version": "0.0.173",
3
+ "version": "0.0.177",
4
4
  "description": "",
5
5
  "module": "dist/lib/esm/scheduling.module.js",
6
6
  "main": "dist/lib/cjs/scheduling.module.js",
@@ -19,10 +19,9 @@
19
19
  "access": "public"
20
20
  },
21
21
  "dependencies": {
22
- "@pristine-ts/common": "^0.0.173",
23
- "@pristine-ts/core": "^0.0.173",
24
- "@pristine-ts/event": "^0.0.173",
25
- "@pristine-ts/logging": "^0.0.173"
22
+ "@pristine-ts/common": "^0.0.177",
23
+ "@pristine-ts/core": "^0.0.177",
24
+ "@pristine-ts/logging": "^0.0.177"
26
25
  },
27
26
  "jest": {
28
27
  "transform": {
@@ -58,5 +57,5 @@
58
57
  "src/*.{js,ts}"
59
58
  ]
60
59
  },
61
- "gitHead": "9c4e43f029a4e7ed49adb0f183ee56502dde3253"
60
+ "gitHead": "814886bbf3c28c5588cbd5f7bb9a2d5e323d6850"
62
61
  }