@punks/backend-entity-manager 0.0.281 → 0.0.282

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.
@@ -13,7 +13,7 @@ export declare enum JobRunType {
13
13
  }
14
14
  export declare class JobInstance {
15
15
  id: string;
16
- scheduleUid: string;
16
+ scheduleUid?: string;
17
17
  jobUid: string;
18
18
  runType: JobRunType;
19
19
  status: JobStatus;
@@ -11,7 +11,7 @@ export interface IJobDefinitionsRepository {
11
11
  export interface IJobInstancesRepository {
12
12
  getById(id: string): Promise<JobInstance>;
13
13
  getByStatus(...status: JobStatus[]): Promise<JobInstance[]>;
14
- getLastInstance(jobUid: string, scheduleUid: string): Promise<JobInstance | undefined>;
14
+ getLastInstance(jobUid: string, scheduleUid?: string): Promise<JobInstance | undefined>;
15
15
  appendInstance(job: JobDefinition<unknown, unknown>, data: Pick<JobInstance, "id" | "insertTime" | "scheduleUid" | "runType">): Promise<JobInstance>;
16
16
  updateInstance(instanceId: string, data: Pick<JobInstance, "startTime" | "endTime" | "status" | "result" | "error">): Promise<JobInstance>;
17
17
  }
@@ -1,7 +1,7 @@
1
1
  import { JobDefinition, JobSchedule } from "./definition";
2
2
  export interface JobDispatchInput {
3
3
  definition: JobDefinition<unknown, unknown>;
4
- schedule: JobSchedule<unknown>;
4
+ schedule?: JobSchedule<unknown>;
5
5
  instanceId: string;
6
6
  }
7
7
  export declare enum JobProviderState {
@@ -1,7 +1,7 @@
1
1
  import { JobDefinition, JobRunType, JobSchedule } from "../../abstractions";
2
2
  export interface JobDispatchCommandInput {
3
3
  job: JobDefinition<unknown, unknown>;
4
- schedule: JobSchedule<unknown>;
4
+ schedule?: JobSchedule<unknown>;
5
5
  runType: JobRunType;
6
6
  }
7
7
  export declare class JobDispatchCommand {
@@ -0,0 +1,9 @@
1
+ import { IJobDefinitionsRepository } from "../../abstractions";
2
+ import { CommandBus } from "@nestjs/cqrs";
3
+ import { JobTriggerInput } from "./types";
4
+ export declare class JobsService {
5
+ private readonly definitions;
6
+ private readonly commandBus;
7
+ constructor(definitions: IJobDefinitionsRepository, commandBus: CommandBus);
8
+ runJob: (input: JobTriggerInput) => Promise<any>;
9
+ }
@@ -0,0 +1,4 @@
1
+ export type JobTriggerInput = {
2
+ jobUid: string;
3
+ scheduleUid?: string;
4
+ };
package/dist/index.d.ts CHANGED
@@ -2151,7 +2151,7 @@ declare enum JobRunType {
2151
2151
  }
2152
2152
  declare class JobInstance {
2153
2153
  id: string;
2154
- scheduleUid: string;
2154
+ scheduleUid?: string;
2155
2155
  jobUid: string;
2156
2156
  runType: JobRunType;
2157
2157
  status: JobStatus;
@@ -2182,7 +2182,7 @@ interface IJobDefinitionsRepository {
2182
2182
  interface IJobInstancesRepository {
2183
2183
  getById(id: string): Promise<JobInstance>;
2184
2184
  getByStatus(...status: JobStatus[]): Promise<JobInstance[]>;
2185
- getLastInstance(jobUid: string, scheduleUid: string): Promise<JobInstance | undefined>;
2185
+ getLastInstance(jobUid: string, scheduleUid?: string): Promise<JobInstance | undefined>;
2186
2186
  appendInstance(job: JobDefinition<unknown, unknown>, data: Pick<JobInstance, "id" | "insertTime" | "scheduleUid" | "runType">): Promise<JobInstance>;
2187
2187
  updateInstance(instanceId: string, data: Pick<JobInstance, "startTime" | "endTime" | "status" | "result" | "error">): Promise<JobInstance>;
2188
2188
  }
@@ -2242,7 +2242,7 @@ declare class JobsScheduler {
2242
2242
 
2243
2243
  interface JobDispatchInput {
2244
2244
  definition: JobDefinition<unknown, unknown>;
2245
- schedule: JobSchedule<unknown>;
2245
+ schedule?: JobSchedule<unknown>;
2246
2246
  instanceId: string;
2247
2247
  }
2248
2248
  declare enum JobProviderState {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@punks/backend-entity-manager",
3
- "version": "0.0.281",
3
+ "version": "0.0.282",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",