@fincity/kirun-js 2.7.0 → 2.8.2
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.
- package/__tests__/engine/function/system/WaitTest.ts +1 -1
- package/__tests__/engine/function/system/array/AddFirstTest.ts +2 -6
- package/__tests__/engine/function/system/array/IndexOfTest.ts +8 -13
- package/__tests__/engine/function/system/array/LastIndexOfTest.ts +9 -28
- package/__tests__/engine/function/system/date/AddSubtractTimeTest.ts +93 -0
- package/__tests__/engine/function/system/date/DateFunctionRepositoryTest.ts +96 -0
- package/__tests__/engine/function/system/date/DifferenceTest.ts +93 -0
- package/__tests__/engine/function/system/date/EpochToTimestampTest.ts +133 -0
- package/__tests__/engine/function/system/date/FromDateStringTest.ts +51 -0
- package/__tests__/engine/function/system/date/FromNowTest.ts +71 -0
- package/__tests__/engine/function/system/date/GetCurrentTimeStampTest.ts +19 -27
- package/__tests__/engine/function/system/date/GetNamesTest.ts +105 -0
- package/__tests__/engine/function/system/date/IsBetweenTest.ts +53 -0
- package/__tests__/engine/function/system/date/IsValidISODateTest.ts +42 -54
- package/__tests__/engine/function/system/date/LastFirstOfTest.ts +64 -0
- package/__tests__/engine/function/system/date/SetTimeZoneTest.ts +48 -0
- package/__tests__/engine/function/system/date/StartEndOfTest.ts +53 -0
- package/__tests__/engine/function/system/date/TimeAsTest.ts +24 -0
- package/__tests__/engine/function/system/date/TimestampToEpochTest.ts +45 -0
- package/__tests__/engine/function/system/date/ToDateStringTest.ts +48 -0
- package/__tests__/engine/function/system/math/RandomFloatTest.ts +21 -22
- package/__tests__/engine/function/system/math/RandomIntTest.ts +5 -4
- package/__tests__/engine/repository/RepositoryFilterTest.ts +4 -1
- package/__tests__/engine/runtime/expression/ExpressionEqualityTest.ts +76 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +14 -13
- package/dist/types.d.ts.map +1 -1
- package/generator/generateValidationCSV.ts +51 -42
- package/generator/validation-js.csv +0 -0
- package/package.json +9 -7
- package/src/engine/function/AbstractFunction.ts +1 -1
- package/src/engine/function/system/Print.ts +19 -5
- package/src/engine/function/system/Wait.ts +1 -1
- package/src/engine/function/system/array/AbstractArrayFunction.ts +3 -3
- package/src/engine/function/system/array/Fill.ts +1 -1
- package/src/engine/function/system/array/Frequency.ts +0 -1
- package/src/engine/function/system/array/IndexOf.ts +4 -4
- package/src/engine/function/system/array/LastIndexOf.ts +3 -3
- package/src/engine/function/system/array/Rotate.ts +1 -1
- package/src/engine/function/system/array/Shuffle.ts +1 -1
- package/src/engine/function/system/array/Sort.ts +1 -1
- package/src/engine/function/system/date/AbstractDateFunction.ts +229 -111
- package/src/engine/function/system/date/AddSubtractTime.ts +99 -0
- package/src/engine/function/system/date/DateFunctionRepository.ts +228 -122
- package/src/engine/function/system/date/EpochToTimestamp.ts +75 -0
- package/src/engine/function/system/date/FromDateString.ts +44 -0
- package/src/engine/function/system/date/FromNow.ts +77 -0
- package/src/engine/function/system/date/GetCurrent.ts +20 -0
- package/src/engine/function/system/date/GetNames.ts +74 -0
- package/src/engine/function/system/date/IsBetween.ts +62 -0
- package/src/engine/function/system/date/IsValidISODate.ts +54 -40
- package/src/engine/function/system/date/LastFirstOf.ts +72 -0
- package/src/engine/function/system/date/SetTimeZone.ts +43 -0
- package/src/engine/function/system/date/StartEndOf.ts +44 -0
- package/src/engine/function/system/date/TimeAs.ts +64 -0
- package/src/engine/function/system/date/TimestampToEpoch.ts +54 -0
- package/src/engine/function/system/date/ToDateString.ts +49 -0
- package/src/engine/function/system/date/common.ts +9 -0
- package/src/engine/function/system/math/MathFunctionRepository.ts +43 -4
- package/src/engine/function/system/math/RandomAny.ts +57 -0
- package/src/engine/function/system/object/ObjectConvert.ts +45 -19
- package/src/engine/function/system/object/ObjectFunctionRepository.ts +2 -1
- package/src/engine/function/system/string/AbstractStringFunction.ts +42 -82
- package/src/engine/function/system/string/StringFunctionRepository.ts +39 -20
- package/src/engine/json/schema/SchemaUtil.ts +1 -1
- package/src/engine/repository/KIRunSchemaRepository.ts +57 -3
- package/src/engine/util/string/StringUtil.ts +12 -0
- package/tsconfig.json +1 -2
- package/__tests__/engine/function/system/date/AddTimeTest.ts +0 -115
- package/__tests__/engine/function/system/date/DateToEpochTest.ts +0 -74
- package/__tests__/engine/function/system/date/DifferenceOfTimestampsTest.ts +0 -53
- package/__tests__/engine/function/system/date/EpochToDateTest.ts +0 -105
- package/__tests__/engine/function/system/date/GetDateTest.ts +0 -85
- package/__tests__/engine/function/system/date/GetDayTest.ts +0 -85
- package/__tests__/engine/function/system/date/GetFullYearTest.ts +0 -85
- package/__tests__/engine/function/system/date/GetHoursTest.ts +0 -85
- package/__tests__/engine/function/system/date/GetMilliSecondsTest.ts +0 -85
- package/__tests__/engine/function/system/date/GetMinutesTest.ts +0 -85
- package/__tests__/engine/function/system/date/GetMonthTest.ts +0 -85
- package/__tests__/engine/function/system/date/GetSecondsTest.ts +0 -85
- package/__tests__/engine/function/system/date/GetTimeAsArrayTest.ts +0 -59
- package/__tests__/engine/function/system/date/GetTimeAsObjectTest.ts +0 -83
- package/__tests__/engine/function/system/date/GetTimeTest.ts +0 -86
- package/__tests__/engine/function/system/date/IsLeapYearTest.ts +0 -85
- package/__tests__/engine/function/system/date/MaximumTimestampTest.ts +0 -55
- package/__tests__/engine/function/system/date/MinimumTimestampTest.ts +0 -54
- package/__tests__/engine/function/system/date/SubtractTimeTest.ts +0 -95
- package/src/engine/function/system/date/DateToEpoch.ts +0 -39
- package/src/engine/function/system/date/DifferenceOfTimestamps.ts +0 -45
- package/src/engine/function/system/date/EpochToDate.ts +0 -76
- package/src/engine/function/system/date/GetCurrentTimeStamp.ts +0 -36
- package/src/engine/function/system/date/GetTimeAsArray.ts +0 -48
- package/src/engine/function/system/date/GetTimeAsObject.ts +0 -66
- package/src/engine/function/system/date/MaximumTimestamp.ts +0 -73
- package/src/engine/function/system/date/MinimumTimestamp.ts +0 -74
- package/src/engine/function/system/math/RandomFloat.ts +0 -56
- package/src/engine/function/system/math/RandomInt.ts +0 -56
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { FunctionExecutionParameters, KIRunFunctionRepository, KIRunSchemaRepository } from "../../../../../src";
|
|
2
|
-
import { MaximumTimestamp } from "../../../../../src/engine/function/system/date/MaximumTimestamp";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const mt : MaximumTimestamp = new MaximumTimestamp();
|
|
6
|
-
|
|
7
|
-
let fep : FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
8
|
-
new KIRunFunctionRepository(),
|
|
9
|
-
new KIRunSchemaRepository(),
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
describe('MaximumTimestamp valid', () => {
|
|
13
|
-
|
|
14
|
-
test('test1', async () => {
|
|
15
|
-
|
|
16
|
-
const arr = ["2023-10-25T13:30:04.970+07:00","2023-10-25T12:30:04.970-1:00","2023-10-25T19:30:04.970Z"];
|
|
17
|
-
fep.setArguments(new Map([['isoDates', arr]]));
|
|
18
|
-
|
|
19
|
-
await expect(mt.execute(fep)).rejects.toThrow();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
test('test2', async () => {
|
|
23
|
-
|
|
24
|
-
const arr = ["2023-10-25T13:30:04.970Z", "2023-10-25T12:30:04.970Z","2023-10-25T19:30:04.970Z"];
|
|
25
|
-
fep.setArguments(new Map([['isoDates', arr]]));
|
|
26
|
-
|
|
27
|
-
expect((await mt.execute(fep)).allResults()[0].getResult().get("result")).toBe("2023-10-25T19:30:04.970Z");
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('test3', async () => {
|
|
31
|
-
|
|
32
|
-
const arr = ["2023-10-25T12:30:04.970Z"];
|
|
33
|
-
fep.setArguments(new Map([['isoDates', arr]]));
|
|
34
|
-
|
|
35
|
-
expect((await mt.execute(fep)).allResults()[0].getResult().get("result")).toBe("2023-10-25T12:30:04.970Z");
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
test('test4', async () => {
|
|
39
|
-
|
|
40
|
-
const arr = ["2023-10-25T13:30:04.970+07:00","2023-10-25T12:30:04.970-11:00","2023-10-25T19:30:04.970Z","2023-10-25T13:30:04.970+09:00","2023-10-25T19:30:04.970+01:30"];
|
|
41
|
-
fep.setArguments(new Map([['isoDates', arr]]));
|
|
42
|
-
|
|
43
|
-
expect((await mt.execute(fep)).allResults()[0].getResult().get("result")).toBe("2023-10-25T12:30:04.970-11:00");
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test('test5', async () => {
|
|
47
|
-
|
|
48
|
-
const arr = ["2023-10-25T13:30:04.100+01:00","2023-10-25T13:30:04.101+02:00","2023-10-25T13:30:04.102+03:00","2023-10-25T13:30:04.103+04:00","2023-10-25T13:30:04.104+05:00"];
|
|
49
|
-
fep.setArguments(new Map([['isoDates', arr]]));
|
|
50
|
-
|
|
51
|
-
expect((await mt.execute(fep)).allResults()[0].getResult().get("result")).toBe("2023-10-25T13:30:04.100+01:00");
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
});
|
|
55
|
-
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { FunctionExecutionParameters, KIRunFunctionRepository, KIRunSchemaRepository } from "../../../../../src";
|
|
2
|
-
import { MinimumTimestamp } from "../../../../../src/engine/function/system/date/MinimumTimestamp";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const mt: MinimumTimestamp = new MinimumTimestamp();
|
|
6
|
-
|
|
7
|
-
let fep : FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
8
|
-
new KIRunFunctionRepository(),
|
|
9
|
-
new KIRunSchemaRepository(),
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
describe('MinimumTimestamp valid', () => {
|
|
13
|
-
|
|
14
|
-
test('test1', async () => {
|
|
15
|
-
|
|
16
|
-
const arr = ["2023-10-25T13:30:04.970Z","2023-10-25T12:30:04.970Z","2023-10-25T19:30:04.970Z"];
|
|
17
|
-
fep.setArguments(new Map([['isoDates', arr]]));
|
|
18
|
-
|
|
19
|
-
expect((await mt.execute(fep)).allResults()[0].getResult().get("result")).toBe("2023-10-25T12:30:04.970Z");
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
test('test2', async () => {
|
|
23
|
-
|
|
24
|
-
const arr = ["2023-10-25T12:30:04.970Z"];
|
|
25
|
-
fep.setArguments(new Map([['isoDates', arr]]));
|
|
26
|
-
|
|
27
|
-
expect((await mt.execute(fep)).allResults()[0].getResult().get("result")).toBe("2023-10-25T12:30:04.970Z");
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('test3', async () => {
|
|
31
|
-
|
|
32
|
-
const arr = ["2023-10-25T13:30:04.970+07:00","2023-10-25T12:30:04.970-1:00","2023-10-25T19:30:04.970Z"];
|
|
33
|
-
fep.setArguments(new Map([['isoDates', arr]]));
|
|
34
|
-
|
|
35
|
-
await expect(mt.execute(fep)).rejects.toThrow();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
test('test4', async () => {
|
|
39
|
-
|
|
40
|
-
const arr = ["2023-10-25T13:30:04.970+07:00","2023-10-25T12:30:04.970-11:00","2023-10-25T19:30:04.970Z","2023-10-25T13:30:04.970+09:00","2023-10-25T19:30:04.970+01:30"];
|
|
41
|
-
fep.setArguments(new Map([['isoDates', arr]]));
|
|
42
|
-
|
|
43
|
-
expect((await mt.execute(fep)).allResults()[0].getResult().get("result")).toBe("2023-10-25T13:30:04.970+09:00");
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test('test5', async () => {
|
|
47
|
-
|
|
48
|
-
const arr = ["2023-10-25T02:30:04.970Z","2023-10-25T03:30:04.970Z","2023-10-25T04:30:04.970Z","2023-10-25T05:30:04.970Z","2023-10-25T06:30:04.970Z","2023-10-25T07:30:04.970Z","2023-10-25T08:30:04.970Z","2023-10-25T09:30:04.970Z","2023-10-25T10:30:04.970Z","2023-10-25T11:30:04.970Z","2023-10-25T12:30:04.970Z","2023-10-25T13:30:04.970Z","2023-10-25T14:30:04.970Z","2023-10-25T15:30:04.970Z","2023-10-25T16:30:04.970Z","2023-10-25T17:30:04.970Z","2023-10-25T18:30:04.970Z","2023-10-25T19:30:04.970Z","2023-10-25T01:30:04.970Z"];
|
|
49
|
-
fep.setArguments(new Map([['isoDates', arr]]));
|
|
50
|
-
|
|
51
|
-
expect((await mt.execute(fep)).allResults()[0].getResult().get("result")).toBe("2023-10-25T01:30:04.970Z");
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
});
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { FunctionExecutionParameters, KIRunFunctionRepository, KIRunSchemaRepository, Namespaces } from "../../../../../src";
|
|
2
|
-
import { AbstractDateFunction } from "../../../../../src/engine/function/system/date/AbstractDateFunction";
|
|
3
|
-
import { DateFunctionRepository } from "../../../../../src/engine/function/system/date/DateFunctionRepository";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const dfr : DateFunctionRepository = new DateFunctionRepository();
|
|
7
|
-
|
|
8
|
-
const fep : FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
9
|
-
new KIRunFunctionRepository(),
|
|
10
|
-
new KIRunSchemaRepository());
|
|
11
|
-
|
|
12
|
-
test('check for invalid dates', async () => {
|
|
13
|
-
|
|
14
|
-
const subtractTimeFunction = await dfr.find(Namespaces.DATE, 'SubtractTime');
|
|
15
|
-
|
|
16
|
-
if (!subtractTimeFunction) {
|
|
17
|
-
throw new Error("Function not found");
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
fep.setArguments(new Map<string, any>([
|
|
21
|
-
[AbstractDateFunction.PARAMETER_DATE_NAME, '2029-15-05T06:04:18.073Z'],
|
|
22
|
-
[AbstractDateFunction.PARAMETER_INT_NAME, 10],
|
|
23
|
-
[AbstractDateFunction.PARAMETER_UNIT_NAME, 'SECOND']
|
|
24
|
-
]));
|
|
25
|
-
|
|
26
|
-
await expect( () => subtractTimeFunction.execute(fep)).rejects.toThrow();
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test('Subtract Time 1', async () => {
|
|
30
|
-
|
|
31
|
-
const subtractTimeFunction = await dfr.find(Namespaces.DATE, 'SubtractTime');
|
|
32
|
-
|
|
33
|
-
if (!subtractTimeFunction) {
|
|
34
|
-
throw new Error("Function not found");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
fep.setArguments(new Map<string, any>([
|
|
38
|
-
[AbstractDateFunction.PARAMETER_DATE_NAME, '2024-09-13T23:52:34.633-05:30'],
|
|
39
|
-
[AbstractDateFunction.PARAMETER_INT_NAME, 10],
|
|
40
|
-
[AbstractDateFunction.PARAMETER_UNIT_NAME, 'MINUTE']
|
|
41
|
-
]));
|
|
42
|
-
|
|
43
|
-
expect((await subtractTimeFunction.execute(fep)).allResults()[0].getResult().get('result')).toBe('2024-09-13T23:42:34.633-05:30');
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test('Subtract Time 2', async () => {
|
|
47
|
-
|
|
48
|
-
const subtractTimeFunction = await dfr.find(Namespaces.DATE, 'SubtractTime');
|
|
49
|
-
|
|
50
|
-
if (!subtractTimeFunction) {
|
|
51
|
-
throw new Error("Function not found");
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
fep.setArguments(new Map<string, any>([
|
|
55
|
-
[AbstractDateFunction.PARAMETER_DATE_NAME, '2024-09-13T23:52:34.633-05:30'],
|
|
56
|
-
[AbstractDateFunction.PARAMETER_INT_NAME, 13],
|
|
57
|
-
[AbstractDateFunction.PARAMETER_UNIT_NAME, 'MONTH']
|
|
58
|
-
]));
|
|
59
|
-
|
|
60
|
-
expect((await subtractTimeFunction.execute(fep)).allResults()[0].getResult().get('result')).toBe('2023-08-13T23:52:34.633-05:30');
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
test('Subtract Time 3', async () => {
|
|
64
|
-
|
|
65
|
-
const subtractTimeFunction = await dfr.find(Namespaces.DATE, 'SubtractTime');
|
|
66
|
-
|
|
67
|
-
if (!subtractTimeFunction) {
|
|
68
|
-
throw new Error("Function not found");
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
fep.setArguments(new Map<string, any>([
|
|
72
|
-
[AbstractDateFunction.PARAMETER_DATE_NAME, '2024-09-13T23:52:34.633-05:30'],
|
|
73
|
-
[AbstractDateFunction.PARAMETER_INT_NAME, 70],
|
|
74
|
-
[AbstractDateFunction.PARAMETER_UNIT_NAME, 'SECOND']
|
|
75
|
-
]));
|
|
76
|
-
|
|
77
|
-
expect((await subtractTimeFunction.execute(fep)).allResults()[0].getResult().get('result')).toBe('2024-09-13T23:51:24.633-05:30');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test('Subtract Time 4', async () => {
|
|
81
|
-
|
|
82
|
-
const subtractTimeFunction = await dfr.find(Namespaces.DATE, 'SubtractTime');
|
|
83
|
-
|
|
84
|
-
if (!subtractTimeFunction) {
|
|
85
|
-
throw new Error("Function not found");
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
fep.setArguments(new Map<string, any>([
|
|
89
|
-
[AbstractDateFunction.PARAMETER_DATE_NAME, '2024-09-13T23:52:34.633-05:30'],
|
|
90
|
-
[AbstractDateFunction.PARAMETER_INT_NAME, 5],
|
|
91
|
-
[AbstractDateFunction.PARAMETER_UNIT_NAME, 'YEAR']
|
|
92
|
-
]));
|
|
93
|
-
|
|
94
|
-
expect((await subtractTimeFunction.execute(fep)).allResults()[0].getResult().get('result')).toBe('2019-09-13T23:52:34.633-05:30');
|
|
95
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Schema } from "../../../json/schema/Schema";
|
|
2
|
-
import { FunctionOutput } from "../../../model/FunctionOutput";
|
|
3
|
-
import { FunctionSignature } from "../../../model/FunctionSignature";
|
|
4
|
-
import { Event } from '../../../model/Event';
|
|
5
|
-
import { Parameter } from "../../../model/Parameter";
|
|
6
|
-
import { Namespaces } from "../../../namespaces/Namespaces";
|
|
7
|
-
import { FunctionExecutionParameters } from "../../../runtime/FunctionExecutionParameters";
|
|
8
|
-
import { MapUtil } from "../../../util/MapUtil";
|
|
9
|
-
import { AbstractFunction } from "../../AbstractFunction";
|
|
10
|
-
import { isNullValue } from "../../../util/NullCheck";
|
|
11
|
-
import { KIRuntimeException } from "../../../exception/KIRuntimeException";
|
|
12
|
-
import { EventResult } from "../../../model/EventResult";
|
|
13
|
-
import { ValidDateTimeUtil } from "../../../util/ValidDateTimeUtil";
|
|
14
|
-
|
|
15
|
-
const OUTPUT : string = "result";
|
|
16
|
-
|
|
17
|
-
const VALUE : string = "isoDate";
|
|
18
|
-
|
|
19
|
-
export class DateToEpoch extends AbstractFunction{
|
|
20
|
-
|
|
21
|
-
public getSignature(): FunctionSignature {
|
|
22
|
-
|
|
23
|
-
return new FunctionSignature('DateToEpoch')
|
|
24
|
-
.setNamespace(Namespaces.DATE)
|
|
25
|
-
.setParameters(MapUtil.of(VALUE, Parameter.of(VALUE,Schema.ofRef(Namespaces.DATE + ".timeStamp"))))
|
|
26
|
-
.setEvents(new Map([Event.outputEventMapEntry(new Map([[OUTPUT, Schema.ofLong(OUTPUT)]]))]));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
|
|
30
|
-
|
|
31
|
-
var date = context.getArguments()?.get(VALUE);
|
|
32
|
-
|
|
33
|
-
if(isNullValue(date) || !ValidDateTimeUtil.validate(date))
|
|
34
|
-
throw new KIRuntimeException("Please provide a valid date object");
|
|
35
|
-
|
|
36
|
-
const epochMillis = new Date(date).getTime();
|
|
37
|
-
return new FunctionOutput([ EventResult.of(OUTPUT , MapUtil.of( OUTPUT , epochMillis))]);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { KIRuntimeException } from "../../../exception/KIRuntimeException";
|
|
2
|
-
import { Schema } from "../../../json/schema/Schema";
|
|
3
|
-
import { EventResult } from "../../../model/EventResult";
|
|
4
|
-
import { FunctionOutput } from "../../../model/FunctionOutput";
|
|
5
|
-
import { FunctionSignature } from "../../../model/FunctionSignature";
|
|
6
|
-
import { Parameter } from "../../../model/Parameter";
|
|
7
|
-
import { Namespaces } from "../../../namespaces/Namespaces";
|
|
8
|
-
import { FunctionExecutionParameters } from "../../../runtime/FunctionExecutionParameters";
|
|
9
|
-
import { ValidDateTimeUtil } from "../../../util/ValidDateTimeUtil";
|
|
10
|
-
import { AbstractFunction } from "../../AbstractFunction";
|
|
11
|
-
|
|
12
|
-
const DATE_ONE: string = "isoDateOne";
|
|
13
|
-
const DATE_TWO: string = "isoDateTwo";
|
|
14
|
-
const OUTPUT: string = "result";
|
|
15
|
-
|
|
16
|
-
const SIGNATURE: FunctionSignature = new FunctionSignature('DifferenceOfTimestamps')
|
|
17
|
-
.setNamespace(Namespaces.DATE)
|
|
18
|
-
.setParameters(
|
|
19
|
-
new Map([
|
|
20
|
-
[DATE_ONE, new Parameter(DATE_ONE, Schema.ofString(DATE_ONE).setRef(Namespaces.DATE+".timeStamp"))],
|
|
21
|
-
[DATE_TWO, new Parameter(DATE_TWO, Schema.ofString(DATE_TWO).setRef(Namespaces.DATE+".timeStamp"))]
|
|
22
|
-
])
|
|
23
|
-
);;
|
|
24
|
-
|
|
25
|
-
export class DifferenceOfTimestamps extends AbstractFunction {
|
|
26
|
-
|
|
27
|
-
public getSignature(): FunctionSignature {
|
|
28
|
-
return SIGNATURE;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
|
|
32
|
-
|
|
33
|
-
const firstDate:string = context?.getArguments()?.get(DATE_ONE);
|
|
34
|
-
const secondDate:string = context?.getArguments()?.get(DATE_TWO);
|
|
35
|
-
|
|
36
|
-
if(!ValidDateTimeUtil.validate(firstDate) || !ValidDateTimeUtil.validate(secondDate))
|
|
37
|
-
throw new KIRuntimeException("Please provide valid ISO date for both the given dates.");
|
|
38
|
-
|
|
39
|
-
const fDate: Date = new Date(firstDate);
|
|
40
|
-
const sDate: Date = new Date(secondDate);
|
|
41
|
-
|
|
42
|
-
return new FunctionOutput([EventResult.outputOf(new Map([[OUTPUT, (sDate.getTime() - fDate.getTime())/60000]]))]);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { Schema } from "../../../json/schema/Schema";
|
|
2
|
-
import { FunctionOutput } from "../../../model/FunctionOutput";
|
|
3
|
-
import { FunctionSignature } from "../../../model/FunctionSignature";
|
|
4
|
-
import { Event } from '../../../model/Event';
|
|
5
|
-
import { Parameter } from "../../../model/Parameter";
|
|
6
|
-
import { Namespaces } from "../../../namespaces/Namespaces";
|
|
7
|
-
import { FunctionExecutionParameters } from "../../../runtime/FunctionExecutionParameters";
|
|
8
|
-
import { AbstractFunction } from "../../AbstractFunction";
|
|
9
|
-
import { isNullValue } from "../../../util/NullCheck";
|
|
10
|
-
import { KIRuntimeException } from "../../../exception/KIRuntimeException";
|
|
11
|
-
import { EventResult } from "../../../model/EventResult";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const VALUE = 'epoch';
|
|
15
|
-
const OUTPUT = 'date';
|
|
16
|
-
const ERROR_MSG: string = "Please provide a valid value for epoch.";
|
|
17
|
-
|
|
18
|
-
const SIGNATURE = new FunctionSignature('EpochToDate')
|
|
19
|
-
.setNamespace(Namespaces.DATE)
|
|
20
|
-
.setParameters(
|
|
21
|
-
new Map([
|
|
22
|
-
[
|
|
23
|
-
VALUE,
|
|
24
|
-
new Parameter(
|
|
25
|
-
VALUE,
|
|
26
|
-
new Schema().setAnyOf([
|
|
27
|
-
Schema.ofInteger(VALUE),
|
|
28
|
-
Schema.ofLong(VALUE),
|
|
29
|
-
Schema.ofString(VALUE),
|
|
30
|
-
]),
|
|
31
|
-
),
|
|
32
|
-
],
|
|
33
|
-
]),
|
|
34
|
-
)
|
|
35
|
-
.setEvents(
|
|
36
|
-
new Map([
|
|
37
|
-
Event.outputEventMapEntry(
|
|
38
|
-
new Map([[OUTPUT, Schema.ofRef(`${Namespaces.DATE}.timeStamp`)]]),
|
|
39
|
-
),
|
|
40
|
-
]),
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
export class EpochToDate extends AbstractFunction{
|
|
44
|
-
|
|
45
|
-
public getSignature(): FunctionSignature {
|
|
46
|
-
return SIGNATURE;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
|
|
50
|
-
|
|
51
|
-
var epoch : any = context.getArguments()?.get(VALUE);
|
|
52
|
-
|
|
53
|
-
if(isNullValue(epoch))
|
|
54
|
-
throw new KIRuntimeException(ERROR_MSG);
|
|
55
|
-
|
|
56
|
-
if(typeof epoch === 'boolean')
|
|
57
|
-
throw new KIRuntimeException(ERROR_MSG);
|
|
58
|
-
|
|
59
|
-
if(typeof epoch === 'string')
|
|
60
|
-
epoch = parseInt(epoch)
|
|
61
|
-
|
|
62
|
-
if(isNaN(epoch))
|
|
63
|
-
throw new KIRuntimeException(ERROR_MSG);
|
|
64
|
-
|
|
65
|
-
epoch = epoch > 999999999999 ? epoch : epoch * 1000;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return new FunctionOutput([
|
|
69
|
-
EventResult.outputOf(new Map([
|
|
70
|
-
[OUTPUT, new Date(epoch).toISOString()]
|
|
71
|
-
]))
|
|
72
|
-
]);
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { FunctionOutput } from "../../../model/FunctionOutput";
|
|
2
|
-
import { FunctionSignature } from "../../../model/FunctionSignature";
|
|
3
|
-
import { Event } from '../../../model/Event';
|
|
4
|
-
import { Namespaces } from "../../../namespaces/Namespaces";
|
|
5
|
-
import { FunctionExecutionParameters } from "../../../runtime/FunctionExecutionParameters";
|
|
6
|
-
import { AbstractFunction } from "../../AbstractFunction";
|
|
7
|
-
import { Schema } from "../../../json/schema/Schema";
|
|
8
|
-
import { EventResult } from "../../../model/EventResult";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const OUTPUT = 'date';
|
|
12
|
-
|
|
13
|
-
const SIGNATURE: FunctionSignature = new FunctionSignature("GetCurrentTimeStamp")
|
|
14
|
-
.setNamespace(Namespaces.DATE)
|
|
15
|
-
.setParameters(new Map([]))
|
|
16
|
-
.setEvents(new Map([
|
|
17
|
-
Event.outputEventMapEntry(
|
|
18
|
-
new Map([[OUTPUT, Schema.ofRef(`${Namespaces.DATE}.timeStamp`)]]),
|
|
19
|
-
),
|
|
20
|
-
]));
|
|
21
|
-
|
|
22
|
-
export class GetCurrentTimeStamp extends AbstractFunction{
|
|
23
|
-
|
|
24
|
-
public getSignature(): FunctionSignature {
|
|
25
|
-
|
|
26
|
-
return SIGNATURE;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
|
|
31
|
-
|
|
32
|
-
const date : string = new Date(Date.now()).toISOString();
|
|
33
|
-
|
|
34
|
-
return new FunctionOutput([EventResult.of(OUTPUT, new Map([ [OUTPUT, date]]))]);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { KIRuntimeException } from "../../../exception/KIRuntimeException";
|
|
2
|
-
import { ArraySchemaType } from "../../../json/schema/array/ArraySchemaType";
|
|
3
|
-
import { Schema } from "../../../json/schema/Schema";
|
|
4
|
-
import { Event } from '../../../model/Event';
|
|
5
|
-
import { EventResult } from "../../../model/EventResult";
|
|
6
|
-
import { FunctionOutput } from "../../../model/FunctionOutput";
|
|
7
|
-
import { FunctionSignature } from "../../../model/FunctionSignature";
|
|
8
|
-
import { Parameter } from "../../../model/Parameter";
|
|
9
|
-
import { Namespaces } from "../../../namespaces/Namespaces";
|
|
10
|
-
import { FunctionExecutionParameters } from "../../../runtime/FunctionExecutionParameters";
|
|
11
|
-
import { MapUtil } from "../../../util/MapUtil";
|
|
12
|
-
import { isNullValue } from "../../../util/NullCheck";
|
|
13
|
-
import { ValidDateTimeUtil } from "../../../util/ValidDateTimeUtil";
|
|
14
|
-
import { AbstractFunction } from "../../AbstractFunction";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const VALUE:string = "isoDate";
|
|
18
|
-
|
|
19
|
-
const OUTPUT:string = "result";
|
|
20
|
-
|
|
21
|
-
const SIGNATURE = new FunctionSignature('GetTimeAsArray')
|
|
22
|
-
.setNamespace(Namespaces.DATE)
|
|
23
|
-
.setParameters(MapUtil.of(VALUE, Parameter.of(VALUE, Schema.ofRef(Namespaces.DATE + ".timeStamp"))))
|
|
24
|
-
.setEvents(new Map([Event.outputEventMapEntry(new Map([[OUTPUT , Schema.ofArray(OUTPUT).setItems(ArraySchemaType.of(Schema.ofNumber("number")))]]))]))
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export class GetTimeAsArray extends AbstractFunction{
|
|
28
|
-
|
|
29
|
-
public getSignature(): FunctionSignature {
|
|
30
|
-
return SIGNATURE;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
|
|
34
|
-
|
|
35
|
-
var inputDate = context.getArguments()?.get(VALUE);
|
|
36
|
-
|
|
37
|
-
if(isNullValue(inputDate) || !ValidDateTimeUtil.validate(inputDate))
|
|
38
|
-
throw new KIRuntimeException("Please provide a valid date object");
|
|
39
|
-
|
|
40
|
-
const date = new Date(inputDate);
|
|
41
|
-
|
|
42
|
-
const outputArray = [ date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate()
|
|
43
|
-
, date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds()];
|
|
44
|
-
|
|
45
|
-
return new FunctionOutput([EventResult.outputOf(new Map([[OUTPUT , outputArray]]))]);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { KIRuntimeException } from "../../../exception/KIRuntimeException";
|
|
2
|
-
import { ArraySchemaType } from "../../../json/schema/array/ArraySchemaType";
|
|
3
|
-
import { Schema } from "../../../json/schema/Schema";
|
|
4
|
-
import { Event } from '../../../model/Event';
|
|
5
|
-
import { EventResult } from "../../../model/EventResult";
|
|
6
|
-
import { FunctionOutput } from "../../../model/FunctionOutput";
|
|
7
|
-
import { FunctionSignature } from "../../../model/FunctionSignature";
|
|
8
|
-
import { Parameter } from "../../../model/Parameter";
|
|
9
|
-
import { Namespaces } from "../../../namespaces/Namespaces";
|
|
10
|
-
import { FunctionExecutionParameters } from "../../../runtime/FunctionExecutionParameters";
|
|
11
|
-
import { MapUtil } from "../../../util/MapUtil";
|
|
12
|
-
import { isNullValue } from "../../../util/NullCheck";
|
|
13
|
-
import { ValidDateTimeUtil } from "../../../util/ValidDateTimeUtil";
|
|
14
|
-
import { AbstractFunction } from "../../AbstractFunction";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const VALUE:string = "isoDate";
|
|
18
|
-
|
|
19
|
-
const OUTPUT:string = "result";
|
|
20
|
-
|
|
21
|
-
const SIGNATURE = new FunctionSignature('GetTimeAsObject')
|
|
22
|
-
.setNamespace(Namespaces.DATE)
|
|
23
|
-
.setParameters(MapUtil.of(VALUE, Parameter.of(VALUE, Schema.ofRef(Namespaces.DATE + ".timeStamp"))))
|
|
24
|
-
.setEvents(new Map([Event.outputEventMapEntry(new Map([[OUTPUT ,
|
|
25
|
-
Schema.ofObject(OUTPUT).setProperties(new Map(
|
|
26
|
-
[
|
|
27
|
-
["year", Schema.ofNumber("year")],
|
|
28
|
-
["month", Schema.ofNumber("month")],
|
|
29
|
-
["day", Schema.ofNumber("day")],
|
|
30
|
-
["hours", Schema.ofNumber("hours")],
|
|
31
|
-
["minutes", Schema.ofNumber("minutes")],
|
|
32
|
-
["seconds", Schema.ofNumber("seconds")],
|
|
33
|
-
["milliseconds", Schema.ofNumber("milliseconds")]
|
|
34
|
-
]
|
|
35
|
-
))]]))]));
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export class GetTimeAsObject extends AbstractFunction{
|
|
39
|
-
|
|
40
|
-
public getSignature(): FunctionSignature {
|
|
41
|
-
return SIGNATURE;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
|
|
45
|
-
|
|
46
|
-
var inputDate = context.getArguments()?.get(VALUE);
|
|
47
|
-
|
|
48
|
-
if(isNullValue(inputDate) || !ValidDateTimeUtil.validate(inputDate))
|
|
49
|
-
throw new KIRuntimeException("Please provide a valid date object");
|
|
50
|
-
|
|
51
|
-
const date = new Date(inputDate);
|
|
52
|
-
|
|
53
|
-
const outputObject = {
|
|
54
|
-
year: date.getUTCFullYear(),
|
|
55
|
-
month: date.getUTCMonth() + 1,
|
|
56
|
-
day: date.getUTCDate(),
|
|
57
|
-
hours: date.getUTCHours(),
|
|
58
|
-
minutes: date.getUTCMinutes(),
|
|
59
|
-
seconds: date.getUTCSeconds(),
|
|
60
|
-
milliseconds: date.getUTCMilliseconds()
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
return new FunctionOutput([EventResult.outputOf(new Map([[OUTPUT , outputObject]]))]);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Schema } from "../../../json/schema/Schema";
|
|
2
|
-
import { FunctionOutput } from "../../../model/FunctionOutput";
|
|
3
|
-
import { FunctionSignature } from "../../../model/FunctionSignature";
|
|
4
|
-
import { Parameter } from "../../../model/Parameter";
|
|
5
|
-
import { Namespaces } from "../../../namespaces/Namespaces";
|
|
6
|
-
import { FunctionExecutionParameters } from "../../../runtime/FunctionExecutionParameters";
|
|
7
|
-
import { AbstractFunction } from "../../AbstractFunction";
|
|
8
|
-
import { Event } from "../../../model/Event";
|
|
9
|
-
import { KIRuntimeException } from "../../../exception/KIRuntimeException";
|
|
10
|
-
import { ValidDateTimeUtil } from "../../../util/ValidDateTimeUtil";
|
|
11
|
-
import { EventResult } from "../../../model/EventResult";
|
|
12
|
-
|
|
13
|
-
const VALUE = "isoDates";
|
|
14
|
-
|
|
15
|
-
const OUTPUT = "result";
|
|
16
|
-
|
|
17
|
-
const ERROR_MESSAGE = "Please provide a valid date";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const SIGNATURE : FunctionSignature = new FunctionSignature('MaximumTimestamp')
|
|
22
|
-
.setNamespace(Namespaces.DATE)
|
|
23
|
-
.setParameters(new Map([[VALUE, Parameter.of(VALUE, Schema.ofString(VALUE).setRef(Namespaces.DATE + ".timeStamp")).setVariableArgument(true)]]))
|
|
24
|
-
.setEvents(new Map([[OUTPUT, new Event(OUTPUT, new Map([[OUTPUT, Schema.ofString(OUTPUT).setRef(Namespaces.DATE + ".timeStamp")]]))]]));
|
|
25
|
-
|
|
26
|
-
export class MaximumTimestamp extends AbstractFunction {
|
|
27
|
-
|
|
28
|
-
public getSignature(): FunctionSignature {
|
|
29
|
-
return SIGNATURE;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
|
|
33
|
-
|
|
34
|
-
const dates = context?.getArguments()?.get(VALUE);
|
|
35
|
-
|
|
36
|
-
const size = dates.length;
|
|
37
|
-
|
|
38
|
-
if(size === 0){
|
|
39
|
-
throw new KIRuntimeException(ERROR_MESSAGE)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
else if (size == 1) {
|
|
43
|
-
|
|
44
|
-
const firstDate: string = dates[0];
|
|
45
|
-
|
|
46
|
-
if (!ValidDateTimeUtil.validate(firstDate))
|
|
47
|
-
|
|
48
|
-
throw new KIRuntimeException(ERROR_MESSAGE);
|
|
49
|
-
|
|
50
|
-
return new FunctionOutput([EventResult.outputOf(new Map([[OUTPUT, firstDate]]))]);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
let maxIndex: number = 0;
|
|
54
|
-
let max : number = new Date(dates[0]).getTime();
|
|
55
|
-
|
|
56
|
-
for(let i=1;i<size;i++){
|
|
57
|
-
|
|
58
|
-
const date: string = dates[i];
|
|
59
|
-
|
|
60
|
-
if(!ValidDateTimeUtil.validate(date))
|
|
61
|
-
throw new KIRuntimeException(ERROR_MESSAGE);
|
|
62
|
-
|
|
63
|
-
const current: number = new Date(date).getTime();
|
|
64
|
-
|
|
65
|
-
if(current > max){
|
|
66
|
-
max = current;
|
|
67
|
-
maxIndex = i;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return new FunctionOutput([EventResult.outputOf(new Map([[OUTPUT, dates[maxIndex]]]))]);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { KIRuntimeException } from "../../../exception/KIRuntimeException";
|
|
2
|
-
import { Schema } from "../../../json/schema/Schema";
|
|
3
|
-
import { FunctionOutput } from "../../../model/FunctionOutput";
|
|
4
|
-
import { FunctionSignature } from "../../../model/FunctionSignature";
|
|
5
|
-
import { Parameter } from "../../../model/Parameter";
|
|
6
|
-
import { Namespaces } from "../../../namespaces/Namespaces";
|
|
7
|
-
import { FunctionExecutionParameters } from "../../../runtime/FunctionExecutionParameters";
|
|
8
|
-
import { ValidDateTimeUtil } from "../../../util/ValidDateTimeUtil";
|
|
9
|
-
import { AbstractFunction } from "../../AbstractFunction";
|
|
10
|
-
import { EventResult } from "../../../model/EventResult";
|
|
11
|
-
import { Event } from "../../../model/Event";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const VALUE: string = "isoDates";
|
|
16
|
-
|
|
17
|
-
const OUTPUT: string = "result";
|
|
18
|
-
|
|
19
|
-
const ERROR_MESSAGE: string = "Please provide a valid date";
|
|
20
|
-
|
|
21
|
-
const SIGNATURE : FunctionSignature = new FunctionSignature('MinimumTimestamp')
|
|
22
|
-
.setNamespace(Namespaces.DATE)
|
|
23
|
-
.setParameters(new Map([[VALUE, Parameter.of(VALUE, Schema.ofString(VALUE).setRef(Namespaces.DATE + ".timeStamp")).setVariableArgument(true)]]))
|
|
24
|
-
.setEvents(new Map([[OUTPUT , new Event(OUTPUT, new Map([[OUTPUT, Schema.ofString(OUTPUT).setRef(Namespaces.DATE + ".timeStamp")]]))]]));
|
|
25
|
-
|
|
26
|
-
export class MinimumTimestamp extends AbstractFunction{
|
|
27
|
-
|
|
28
|
-
public getSignature(): FunctionSignature {
|
|
29
|
-
return SIGNATURE;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
|
|
33
|
-
|
|
34
|
-
const dates = context?.getArguments()?.get(VALUE);
|
|
35
|
-
|
|
36
|
-
const size = dates.length;
|
|
37
|
-
|
|
38
|
-
if(size === 0){
|
|
39
|
-
throw new KIRuntimeException(ERROR_MESSAGE)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
else if (size == 1) {
|
|
43
|
-
|
|
44
|
-
const firstDate: string = dates[0];
|
|
45
|
-
|
|
46
|
-
if (!ValidDateTimeUtil.validate(firstDate))
|
|
47
|
-
|
|
48
|
-
throw new KIRuntimeException(ERROR_MESSAGE);
|
|
49
|
-
|
|
50
|
-
return new FunctionOutput([EventResult.outputOf(new Map([[OUTPUT, firstDate]]))]);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
let minIndex: number = 0;
|
|
54
|
-
let min : number = new Date(dates[0]).getTime();
|
|
55
|
-
|
|
56
|
-
for(let i=1;i<size;i++){
|
|
57
|
-
|
|
58
|
-
const date: string = dates[i];
|
|
59
|
-
|
|
60
|
-
if(!ValidDateTimeUtil.validate(date))
|
|
61
|
-
throw new KIRuntimeException(ERROR_MESSAGE);
|
|
62
|
-
|
|
63
|
-
const current: number = new Date(date).getTime();
|
|
64
|
-
|
|
65
|
-
if(current < min){
|
|
66
|
-
min = current;
|
|
67
|
-
minIndex = i;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return new FunctionOutput([EventResult.outputOf(new Map([[OUTPUT, dates[minIndex]]]))]);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
}
|