refactor: Introduce IActionOutput and ITriggerOutput types

This commit is contained in:
Faruk AYDIN
2022-10-12 21:10:44 +02:00
committed by Ali BARIN
parent 6895378d33
commit d9192f6e6b
22 changed files with 327 additions and 279 deletions

View File

@@ -23,33 +23,33 @@ export default {
options: [
{
label: 'Monday',
value: 1
value: 1,
},
{
label: 'Tuesday',
value: 2
value: 2,
},
{
label: 'Wednesday',
value: 3
value: 3,
},
{
label: 'Thursday',
value: 4
value: 4,
},
{
label: 'Friday',
value: 5
value: 5,
},
{
label: 'Saturday',
value: 6
value: 6,
},
{
label: 'Sunday',
value: 0
}
]
value: 0,
},
],
},
{
label: 'Time of day',
@@ -61,126 +61,135 @@ export default {
options: [
{
label: '00:00',
value: 0
value: 0,
},
{
label: '01:00',
value: 1
value: 1,
},
{
label: '02:00',
value: 2
value: 2,
},
{
label: '03:00',
value: 3
value: 3,
},
{
label: '04:00',
value: 4
value: 4,
},
{
label: '05:00',
value: 5
value: 5,
},
{
label: '06:00',
value: 6
value: 6,
},
{
label: '07:00',
value: 7
value: 7,
},
{
label: '08:00',
value: 8
value: 8,
},
{
label: '09:00',
value: 9
value: 9,
},
{
label: '10:00',
value: 10
value: 10,
},
{
label: '11:00',
value: 11
value: 11,
},
{
label: '12:00',
value: 12
value: 12,
},
{
label: '13:00',
value: 13
value: 13,
},
{
label: '14:00',
value: 14
value: 14,
},
{
label: '15:00',
value: 15
value: 15,
},
{
label: '16:00',
value: 16
value: 16,
},
{
label: '17:00',
value: 17
value: 17,
},
{
label: '18:00',
value: 18
value: 18,
},
{
label: '19:00',
value: 19
value: 19,
},
{
label: '20:00',
value: 20
value: 20,
},
{
label: '21:00',
value: 21
value: 21,
},
{
label: '22:00',
value: 22
value: 22,
},
{
label: '23:00',
value: 23
}
]
}
]
value: 23,
},
],
},
],
},
{
key: 'testStep',
name: 'Test trigger'
}
name: 'Test trigger',
},
],
getInterval(parameters: IGlobalVariable["db"]["step"]["parameters"]) {
const interval = cronTimes.everyWeekOnAndAt(parameters.weekday as number, parameters.hour as number);
getInterval(parameters: IGlobalVariable['step']['parameters']) {
const interval = cronTimes.everyWeekOnAndAt(
parameters.weekday as number,
parameters.hour as number
);
return interval;
},
async run($: IGlobalVariable, startDateTime: Date) {
const dateTime = DateTime.fromJSDate(startDateTime);
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(dateTime) as IJSONValue;
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(
dateTime
) as IJSONValue;
return { data: [dateTimeObjectRepresentation] };
},
async testRun($: IGlobalVariable) {
const nextCronDateTime = getNextCronDateTime(this.getInterval($.db.step.parameters));
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(nextCronDateTime) as IJSONValue;
const nextCronDateTime = getNextCronDateTime(
this.getInterval($.step.parameters)
);
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(
nextCronDateTime
) as IJSONValue;
return { data: [dateTimeObjectRepresentation] };
},