@punks/backend-entity-manager 0.0.283 → 0.0.285

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.
@@ -1,17 +1,16 @@
1
1
  import { SchedulerRegistry } from "@nestjs/schedule";
2
- import { JobsSettings } from "../../abstractions/settings";
3
2
  import { JobsSchedulerTask } from "../../task/jobs-scheduler";
4
3
  import { JobsMonitorTask } from "../../task/jobs-monitor";
5
4
  export declare class JobsScheduler {
6
- private readonly jobsSettings;
7
5
  private readonly schedulerRegistry;
8
6
  private readonly schedulerTask;
9
7
  private readonly monitorTask;
10
8
  private readonly logger;
11
- constructor(jobsSettings: JobsSettings, schedulerRegistry: SchedulerRegistry, schedulerTask: JobsSchedulerTask, monitorTask: JobsMonitorTask);
9
+ constructor(schedulerRegistry: SchedulerRegistry, schedulerTask: JobsSchedulerTask, monitorTask: JobsMonitorTask);
12
10
  register(): void;
13
11
  private registerJobsScheduler;
14
12
  private registerJobsMonitor;
15
13
  private batchJobsSchedule;
16
14
  private batchJobsMonitor;
15
+ private get jobsSettings();
17
16
  }
@@ -1,4 +1,4 @@
1
- import { IJobDefinitionsRepository, IJobInstancesRepository, JobDefinition } from "../../abstractions";
1
+ import { IJobDefinitionsRepository, IJobInstancesRepository, JobDefinition, JobInstance } from "../../abstractions";
2
2
  import { CommandBus } from "@nestjs/cqrs";
3
3
  import { JobTriggerInput } from "./types";
4
4
  export declare class JobsService {
@@ -6,7 +6,7 @@ export declare class JobsService {
6
6
  private readonly instances;
7
7
  private readonly commandBus;
8
8
  constructor(definitions: IJobDefinitionsRepository, instances: IJobInstancesRepository, commandBus: CommandBus);
9
- triggerJob: (input: JobTriggerInput) => Promise<any>;
9
+ triggerJob: (input: JobTriggerInput) => Promise<JobInstance>;
10
10
  updateJob: (input: JobDefinition<unknown, unknown>) => Promise<void>;
11
11
  instanceMonitor: (input: {
12
12
  instanceId: string;
@@ -0,0 +1,3 @@
1
+ import { AppInMemorySettings } from "../../../../../settings";
2
+ import { JobsSettings } from "../abstractions/settings";
3
+ export declare const jobsSettings: AppInMemorySettings<JobsSettings>;
@@ -1,7 +1,6 @@
1
1
  export declare const EntityManagerProviderToken: {
2
2
  DiscoveryService: {};
3
3
  OperationsLockRepository: {};
4
- JobsModuleSettings: {};
5
4
  JobInstancesRepository: {};
6
5
  JobDefinitionsRepository: {};
7
6
  };
package/dist/esm/index.js CHANGED
@@ -33769,10 +33769,11 @@ JobsMonitorTask = JobsMonitorTask_1 = __decorate([
33769
33769
  __metadata("design:paramtypes", [Object, Object, CommandBus])
33770
33770
  ], JobsMonitorTask);
33771
33771
 
33772
+ const jobsSettings = new AppInMemorySettings();
33773
+
33772
33774
  var JobsScheduler_1;
33773
33775
  let JobsScheduler = JobsScheduler_1 = class JobsScheduler {
33774
- constructor(jobsSettings, schedulerRegistry, schedulerTask, monitorTask) {
33775
- this.jobsSettings = jobsSettings;
33776
+ constructor(schedulerRegistry, schedulerTask, monitorTask) {
33776
33777
  this.schedulerRegistry = schedulerRegistry;
33777
33778
  this.schedulerTask = schedulerTask;
33778
33779
  this.monitorTask = monitorTask;
@@ -33808,11 +33809,13 @@ let JobsScheduler = JobsScheduler_1 = class JobsScheduler {
33808
33809
  this.registerJobsScheduler();
33809
33810
  this.registerJobsMonitor();
33810
33811
  }
33812
+ get jobsSettings() {
33813
+ return jobsSettings.value;
33814
+ }
33811
33815
  };
33812
33816
  JobsScheduler = JobsScheduler_1 = __decorate([
33813
33817
  Injectable(),
33814
- __param(0, Inject(getEntityManagerProviderToken("JobsModuleSettings"))),
33815
- __metadata("design:paramtypes", [Object, SchedulerRegistry,
33818
+ __metadata("design:paramtypes", [SchedulerRegistry,
33816
33819
  JobsSchedulerTask,
33817
33820
  JobsMonitorTask])
33818
33821
  ], JobsScheduler);
@@ -33961,10 +33964,11 @@ let JobDispatchHandler = JobDispatchHandler_1 = class JobDispatchHandler {
33961
33964
  instanceId,
33962
33965
  payload,
33963
33966
  });
33964
- await this.instances.updateInstance(instanceId, {
33967
+ const instance = await this.instances.updateInstance(instanceId, {
33965
33968
  status: JobStatus.Ready,
33966
33969
  });
33967
33970
  this.logger.info(`JOB DISPATCH -> dispatching completed job ${job.uid} -> ${instanceId}`);
33971
+ return instance;
33968
33972
  }
33969
33973
  catch (e) {
33970
33974
  await this.instances.updateInstance(instanceId, {
@@ -34115,16 +34119,10 @@ let JobsModule = JobsModule_1 = class JobsModule {
34115
34119
  await this.jobsProviderFactory.initialize();
34116
34120
  }
34117
34121
  static forRoot(input) {
34122
+ jobsSettings.initialize(input);
34118
34123
  return {
34119
34124
  module: JobsModule_1,
34120
34125
  ...ModuleData$7,
34121
- providers: [
34122
- ...ModuleData$7.providers,
34123
- {
34124
- provide: getEntityManagerProviderToken("JobsModuleSettings"),
34125
- useValue: input,
34126
- },
34127
- ],
34128
34126
  };
34129
34127
  }
34130
34128
  };