@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/esm/index.js CHANGED
@@ -33894,7 +33894,7 @@ let JobDispatchHandler = JobDispatchHandler_1 = class JobDispatchHandler {
33894
33894
  await this.instances.appendInstance(job, {
33895
33895
  id: instanceId,
33896
33896
  runType,
33897
- scheduleUid: schedule.uid,
33897
+ scheduleUid: schedule?.uid,
33898
33898
  insertTime: new Date(),
33899
33899
  });
33900
33900
  await this.executor.dispatch({
@@ -40071,7 +40071,7 @@ let AwsJobsProvider = class AwsJobsProvider {
40071
40071
  }
40072
40072
  async dispatch(input) {
40073
40073
  const { definition, schedule, instanceId } = input;
40074
- const awsInvocationParams = schedule.invocationOverrides;
40074
+ const awsInvocationParams = schedule?.invocationOverrides;
40075
40075
  await this.awsBatchService.submitJob({
40076
40076
  instanceId,
40077
40077
  jobUid: definition.uid,