fix: provide step.parameters to Scheduler triggers
This commit is contained in:
@@ -1,18 +1,15 @@
|
|||||||
import Triggers from './triggers';
|
import Triggers from './triggers';
|
||||||
import {
|
import {
|
||||||
IService,
|
IService,
|
||||||
IApp,
|
IConnection,
|
||||||
IJSONObject,
|
IFlow,
|
||||||
|
IStep,
|
||||||
} from '@automatisch/types';
|
} from '@automatisch/types';
|
||||||
|
|
||||||
export default class Scheduler implements IService {
|
export default class Scheduler implements IService {
|
||||||
triggers: Triggers;
|
triggers: Triggers;
|
||||||
|
|
||||||
constructor(
|
constructor(connection: IConnection, flow: IFlow, step: IStep) {
|
||||||
appData: IApp,
|
this.triggers = new Triggers(step.parameters);
|
||||||
connectionData: IJSONObject,
|
|
||||||
parameters: IJSONObject
|
|
||||||
) {
|
|
||||||
this.triggers = new Triggers(connectionData, parameters);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { IJSONObject } from '@automatisch/types';
|
import { IStep } from '@automatisch/types';
|
||||||
import EveryHour from './triggers/every-hour';
|
import EveryHour from './triggers/every-hour';
|
||||||
import EveryDay from './triggers/every-day';
|
import EveryDay from './triggers/every-day';
|
||||||
import EveryWeek from './triggers/every-week';
|
import EveryWeek from './triggers/every-week';
|
||||||
@@ -10,7 +10,7 @@ export default class Triggers {
|
|||||||
everyWeek: EveryWeek;
|
everyWeek: EveryWeek;
|
||||||
everyMonth: EveryMonth;
|
everyMonth: EveryMonth;
|
||||||
|
|
||||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
constructor(parameters: IStep["parameters"]) {
|
||||||
this.everyHour = new EveryHour(parameters);
|
this.everyHour = new EveryHour(parameters);
|
||||||
this.everyDay = new EveryDay(parameters);
|
this.everyDay = new EveryDay(parameters);
|
||||||
this.everyWeek = new EveryWeek(parameters);
|
this.everyWeek = new EveryWeek(parameters);
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import type { IJSONObject, IJSONValue, ITrigger } from '@automatisch/types';
|
import type { IStep, IJSONValue, ITrigger } from '@automatisch/types';
|
||||||
import { cronTimes, getNextCronDateTime, getDateTimeObjectRepresentation } from '../utils';
|
import { cronTimes, getNextCronDateTime, getDateTimeObjectRepresentation } from '../utils';
|
||||||
|
|
||||||
export default class EveryDay implements ITrigger {
|
export default class EveryDay implements ITrigger {
|
||||||
triggersOnWeekend?: boolean;
|
triggersOnWeekend?: boolean;
|
||||||
hour?: number;
|
hour?: number;
|
||||||
|
|
||||||
constructor(parameters: IJSONObject) {
|
constructor(parameters: IStep["parameters"]) {
|
||||||
if (parameters.triggersOnWeekend) {
|
if (parameters.triggersOnWeekend) {
|
||||||
this.triggersOnWeekend = parameters.triggersOnWeekend as boolean;
|
this.triggersOnWeekend = parameters.triggersOnWeekend as boolean;
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import type { IJSONObject, IJSONValue, ITrigger } from '@automatisch/types';
|
import type { IStep, IJSONValue, ITrigger } from '@automatisch/types';
|
||||||
import { cronTimes, getNextCronDateTime, getDateTimeObjectRepresentation } from '../utils';
|
import { cronTimes, getNextCronDateTime, getDateTimeObjectRepresentation } from '../utils';
|
||||||
|
|
||||||
export default class EveryHour implements ITrigger {
|
export default class EveryHour implements ITrigger {
|
||||||
triggersOnWeekend?: boolean | string;
|
triggersOnWeekend?: boolean | string;
|
||||||
|
|
||||||
constructor(parameters: IJSONObject) {
|
constructor(parameters: IStep["parameters"]) {
|
||||||
if (parameters.triggersOnWeekend) {
|
if (parameters.triggersOnWeekend) {
|
||||||
this.triggersOnWeekend = parameters.triggersOnWeekend as string;
|
this.triggersOnWeekend = parameters.triggersOnWeekend as string;
|
||||||
}
|
}
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import type { IJSONObject, IJSONValue, ITrigger } from '@automatisch/types';
|
import type { IStep, IJSONValue, ITrigger } from '@automatisch/types';
|
||||||
import { cronTimes, getNextCronDateTime, getDateTimeObjectRepresentation } from '../utils';
|
import { cronTimes, getNextCronDateTime, getDateTimeObjectRepresentation } from '../utils';
|
||||||
|
|
||||||
export default class EveryMonth implements ITrigger {
|
export default class EveryMonth implements ITrigger {
|
||||||
day?: number;
|
day?: number;
|
||||||
hour?: number;
|
hour?: number;
|
||||||
|
|
||||||
constructor(parameters: IJSONObject) {
|
constructor(parameters: IStep["parameters"]) {
|
||||||
if (parameters.day) {
|
if (parameters.day) {
|
||||||
this.day = parameters.day as number;
|
this.day = parameters.day as number;
|
||||||
}
|
}
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import type { IJSONObject, IJSONValue, ITrigger } from '@automatisch/types';
|
import type { IStep, IJSONValue, ITrigger } from '@automatisch/types';
|
||||||
import { cronTimes, getNextCronDateTime, getDateTimeObjectRepresentation } from '../utils';
|
import { cronTimes, getNextCronDateTime, getDateTimeObjectRepresentation } from '../utils';
|
||||||
|
|
||||||
export default class EveryWeek implements ITrigger {
|
export default class EveryWeek implements ITrigger {
|
||||||
weekday?: number;
|
weekday?: number;
|
||||||
hour?: number;
|
hour?: number;
|
||||||
|
|
||||||
constructor(parameters: IJSONObject) {
|
constructor(parameters: IStep["parameters"]) {
|
||||||
if (parameters.weekday) {
|
if (parameters.weekday) {
|
||||||
this.weekday = parameters.weekday as number;
|
this.weekday = parameters.weekday as number;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user