@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,56 +0,0 @@
|
|
|
1
|
-
import { Schema } from '../../../json/schema/Schema';
|
|
2
|
-
import { Event } from '../../../model/Event';
|
|
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 { MapUtil } from '../../../util/MapUtil';
|
|
10
|
-
import { AbstractFunction } from '../../AbstractFunction';
|
|
11
|
-
|
|
12
|
-
export class RandomFloat extends AbstractFunction {
|
|
13
|
-
public static readonly MIN_VALUE = 'minValue';
|
|
14
|
-
|
|
15
|
-
public static readonly MAX_VALUE = 'maxValue';
|
|
16
|
-
|
|
17
|
-
public static readonly VALUE = 'value';
|
|
18
|
-
|
|
19
|
-
private static readonly SIGNATURE: FunctionSignature = new FunctionSignature('RandomFloat')
|
|
20
|
-
.setParameters(
|
|
21
|
-
MapUtil.of(
|
|
22
|
-
RandomFloat.MIN_VALUE,
|
|
23
|
-
Parameter.of(
|
|
24
|
-
RandomFloat.MIN_VALUE,
|
|
25
|
-
Schema.ofFloat(RandomFloat.MIN_VALUE).setDefaultValue(0),
|
|
26
|
-
),
|
|
27
|
-
RandomFloat.MAX_VALUE,
|
|
28
|
-
Parameter.of(
|
|
29
|
-
RandomFloat.MAX_VALUE,
|
|
30
|
-
Schema.ofFloat(RandomFloat.MAX_VALUE).setDefaultValue(2147483647),
|
|
31
|
-
),
|
|
32
|
-
),
|
|
33
|
-
)
|
|
34
|
-
.setNamespace(Namespaces.MATH)
|
|
35
|
-
.setEvents(
|
|
36
|
-
new Map<string, Event>([
|
|
37
|
-
Event.outputEventMapEntry(
|
|
38
|
-
MapUtil.of(RandomFloat.VALUE, Schema.ofFloat(RandomFloat.VALUE)),
|
|
39
|
-
),
|
|
40
|
-
]),
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
public getSignature(): FunctionSignature {
|
|
44
|
-
return RandomFloat.SIGNATURE;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
|
|
48
|
-
let min: number = context.getArguments()?.get(RandomFloat.MIN_VALUE);
|
|
49
|
-
|
|
50
|
-
let max: number = context.getArguments()?.get(RandomFloat.MAX_VALUE);
|
|
51
|
-
|
|
52
|
-
let num: number = Math.random() * (max - min) + min;
|
|
53
|
-
|
|
54
|
-
return new FunctionOutput([EventResult.outputOf(new Map([[RandomFloat.VALUE, num]]))]);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Schema } from '../../../json/schema/Schema';
|
|
2
|
-
import { Event } from '../../../model/Event';
|
|
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 { MapUtil } from '../../../util/MapUtil';
|
|
10
|
-
import { AbstractFunction } from '../../AbstractFunction';
|
|
11
|
-
|
|
12
|
-
export class RandomInt extends AbstractFunction {
|
|
13
|
-
public static readonly MIN_VALUE = 'minValue';
|
|
14
|
-
|
|
15
|
-
public static readonly MAX_VALUE = 'maxValue';
|
|
16
|
-
|
|
17
|
-
public static readonly VALUE = 'value';
|
|
18
|
-
|
|
19
|
-
private static readonly SIGNATURE: FunctionSignature = new FunctionSignature('RandomInt')
|
|
20
|
-
.setParameters(
|
|
21
|
-
MapUtil.of(
|
|
22
|
-
RandomInt.MIN_VALUE,
|
|
23
|
-
Parameter.of(
|
|
24
|
-
RandomInt.MIN_VALUE,
|
|
25
|
-
Schema.ofInteger(RandomInt.MIN_VALUE).setDefaultValue(0),
|
|
26
|
-
),
|
|
27
|
-
RandomInt.MAX_VALUE,
|
|
28
|
-
Parameter.of(
|
|
29
|
-
RandomInt.MAX_VALUE,
|
|
30
|
-
Schema.ofInteger(RandomInt.MAX_VALUE).setDefaultValue(2147483647),
|
|
31
|
-
),
|
|
32
|
-
),
|
|
33
|
-
)
|
|
34
|
-
.setNamespace(Namespaces.MATH)
|
|
35
|
-
.setEvents(
|
|
36
|
-
new Map<string, Event>([
|
|
37
|
-
Event.outputEventMapEntry(
|
|
38
|
-
MapUtil.of(RandomInt.VALUE, Schema.ofInteger(RandomInt.VALUE)),
|
|
39
|
-
),
|
|
40
|
-
]),
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
public getSignature(): FunctionSignature {
|
|
44
|
-
return RandomInt.SIGNATURE;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
|
|
48
|
-
let min: number = context.getArguments()?.get(RandomInt.MIN_VALUE);
|
|
49
|
-
|
|
50
|
-
let max: number = context.getArguments()?.get(RandomInt.MAX_VALUE);
|
|
51
|
-
|
|
52
|
-
let num: number = Math.floor(Math.random() * (max - min) + min);
|
|
53
|
-
|
|
54
|
-
return new FunctionOutput([EventResult.outputOf(new Map([[RandomInt.VALUE, num]]))]);
|
|
55
|
-
}
|
|
56
|
-
}
|