@fincity/kirun-js 1.1.2 → 1.1.5
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/array/AddFirstTest.ts +29 -7
- package/__tests__/engine/function/system/array/AddTest.ts +21 -5
- package/__tests__/engine/function/system/array/BinarySearchTest.ts +26 -7
- package/__tests__/engine/function/system/array/CompareTest.ts +5 -1
- package/__tests__/engine/function/system/array/CopyTest.ts +22 -7
- package/__tests__/engine/function/system/array/DeleteFirstTest.ts +21 -5
- package/__tests__/engine/function/system/array/DeleteFromTest.ts +17 -4
- package/__tests__/engine/function/system/array/DeleteLastTest.ts +21 -5
- package/__tests__/engine/function/system/array/DeleteTest.ts +25 -6
- package/__tests__/engine/function/system/array/DisjointTest.ts +13 -3
- package/__tests__/engine/function/system/array/Equals.ts +13 -3
- package/__tests__/engine/function/system/array/FillTest.ts +5 -1
- package/__tests__/engine/function/system/array/FrequencyTest.ts +13 -3
- package/__tests__/engine/function/system/array/IndexOfArrayTest.ts +29 -7
- package/__tests__/engine/function/system/array/IndexOfTest.ts +21 -5
- package/__tests__/engine/function/system/array/InsertTest.ts +25 -6
- package/__tests__/engine/function/system/array/LastIndexOfArrayTest.ts +21 -5
- package/__tests__/engine/function/system/array/LastIndexOfTest.ts +25 -6
- package/__tests__/engine/function/system/array/MaxTest.ts +33 -24
- package/__tests__/engine/function/system/array/MinTest.ts +33 -24
- package/__tests__/engine/function/system/array/MisMatchTest.ts +17 -4
- package/__tests__/engine/function/system/array/ReverseTest.ts +21 -5
- package/__tests__/engine/function/system/array/RotateTest.ts +13 -3
- package/__tests__/engine/function/system/array/ShuffleTest.ts +9 -2
- package/__tests__/engine/function/system/array/SortTest.ts +21 -5
- package/__tests__/engine/function/system/array/SubArrayTest.ts +21 -5
- package/__tests__/engine/function/system/context/SetFunctionTest.ts +13 -3
- package/__tests__/engine/function/system/math/AddTest.ts +5 -3
- package/__tests__/engine/function/system/math/MathFunctionRepositoryTest.ts +108 -0
- package/__tests__/engine/function/system/math/MaximumTest.ts +38 -0
- package/__tests__/engine/function/system/math/MinimumTest.ts +38 -0
- package/__tests__/engine/function/system/math/RandomFloatTest.ts +83 -0
- package/__tests__/engine/function/system/math/RandomIntTest.ts +13 -5
- package/__tests__/engine/function/system/string/ConcatenateTest.ts +9 -2
- package/__tests__/engine/function/system/string/DeleteForGivenLengthTest.ts +9 -2
- package/__tests__/engine/function/system/string/InsertAtGivenPositionTest.ts +13 -3
- package/__tests__/engine/function/system/string/PostPadTest.ts +13 -3
- package/__tests__/engine/function/system/string/PrePadTest.ts +13 -3
- package/__tests__/engine/function/system/string/RegionMatchesTest.ts +13 -3
- package/__tests__/engine/function/system/string/ReverseTest.ts +10 -3
- package/__tests__/engine/function/system/string/SplitTest.ts +9 -2
- package/__tests__/engine/function/system/string/StringFunctionRepoTest2.ts +13 -3
- package/__tests__/engine/function/system/string/StringFunctionRepoTest3.ts +9 -2
- package/__tests__/engine/function/system/string/StringFunctionRepositoryTest.ts +33 -8
- package/__tests__/engine/function/system/string/ToStringTest.ts +10 -3
- package/__tests__/engine/function/system/string/TrimToTest.ts +9 -2
- package/__tests__/engine/json/schema/SchemaUtil.ts +3 -0
- package/__tests__/engine/json/schema/type/TypeUtilTest.ts +10 -0
- package/__tests__/engine/json/schema/validator/AnyOfAllOfOneOfValidatorTest.ts +38 -0
- package/__tests__/engine/json/schema/validator/SchemaValidatorTest.ts +67 -0
- package/__tests__/engine/runtime/KIRuntimeTest.ts +23 -12
- package/__tests__/engine/runtime/KIRuntimeWithDefinitionTest.ts +9 -10
- package/__tests__/engine/runtime/expression/ExpressionEvaluationTest.ts +5 -1
- 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 +11 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/engine/function/AbstractFunction.ts +14 -5
- package/src/engine/function/system/math/Maximum.ts +1 -1
- package/src/engine/function/system/math/Minimum.ts +1 -1
- package/src/engine/function/system/math/RandomFloat.ts +2 -2
- package/src/engine/json/schema/Schema.ts +3 -3
- package/src/engine/json/schema/SchemaUtil.ts +4 -4
- package/src/engine/json/schema/type/TypeUtil.ts +3 -5
- package/src/engine/json/schema/validator/SchemaValidator.ts +4 -1
- package/src/engine/model/AbstractStatement.ts +10 -0
- package/src/engine/runtime/FunctionExecutionParameters.ts +48 -0
- package/src/engine/runtime/KIRuntime.ts +38 -24
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { RandomInt } from '../../../../../src/engine/function/system/math/RandomInt';
|
|
2
2
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
3
4
|
|
|
4
5
|
const rand = new RandomInt();
|
|
5
6
|
|
|
6
7
|
test(' rand int 1', async () => {
|
|
7
8
|
let min = 100,
|
|
8
9
|
max = 1000123;
|
|
9
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
11
|
+
new KIRunFunctionRepository(),
|
|
12
|
+
new KIRunSchemaRepository(),
|
|
13
|
+
).setArguments(
|
|
10
14
|
new Map([
|
|
11
15
|
['minValue', min],
|
|
12
16
|
['maxValue', max],
|
|
@@ -20,9 +24,10 @@ test(' rand int 1', async () => {
|
|
|
20
24
|
|
|
21
25
|
test(' rand int 2', async () => {
|
|
22
26
|
let min = 100;
|
|
23
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
24
|
-
new
|
|
25
|
-
|
|
27
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
28
|
+
new KIRunFunctionRepository(),
|
|
29
|
+
new KIRunSchemaRepository(),
|
|
30
|
+
).setArguments(new Map([['minValue', min]]));
|
|
26
31
|
let num: number = (await rand.execute(fep)).allResults()[0].getResult().get('value');
|
|
27
32
|
|
|
28
33
|
expect(num).toBeLessThanOrEqual(2147483647);
|
|
@@ -32,7 +37,10 @@ test(' rand int 2', async () => {
|
|
|
32
37
|
test(' rand int 3', async () => {
|
|
33
38
|
let min = 100,
|
|
34
39
|
max = 101;
|
|
35
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
40
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
41
|
+
new KIRunFunctionRepository(),
|
|
42
|
+
new KIRunSchemaRepository(),
|
|
43
|
+
).setArguments(
|
|
36
44
|
new Map([
|
|
37
45
|
['minValue', min],
|
|
38
46
|
['maxValue', max],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
1
2
|
import { Concatenate } from '../../../../../src/engine/function/system/string/Concatenate';
|
|
2
3
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
4
|
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
@@ -5,7 +6,10 @@ import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
|
5
6
|
const cat: Concatenate = new Concatenate();
|
|
6
7
|
|
|
7
8
|
test('conatenate test1', async () => {
|
|
8
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
9
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
new KIRunFunctionRepository(),
|
|
11
|
+
new KIRunSchemaRepository(),
|
|
12
|
+
);
|
|
9
13
|
|
|
10
14
|
let array: string[] = [];
|
|
11
15
|
array.push('I ');
|
|
@@ -37,7 +41,10 @@ test('conatenate test2', async () => {
|
|
|
37
41
|
list.push(' PLATform ');
|
|
38
42
|
list.push('2');
|
|
39
43
|
|
|
40
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
44
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
45
|
+
new KIRunFunctionRepository(),
|
|
46
|
+
new KIRunSchemaRepository(),
|
|
47
|
+
);
|
|
41
48
|
|
|
42
49
|
fep.setArguments(MapUtil.of('value', list));
|
|
43
50
|
expect((await cat.execute(fep)).allResults()[0].getResult().get('value')).toBe(
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
1
2
|
import { DeleteForGivenLength } from '../../../../../src/engine/function/system/string/DeleteForGivenLength';
|
|
2
3
|
import { SchemaValidationException } from '../../../../../src/engine/json/schema/validator/exception/SchemaValidationException';
|
|
3
4
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
@@ -6,7 +7,10 @@ import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
|
6
7
|
const deleteT: DeleteForGivenLength = new DeleteForGivenLength();
|
|
7
8
|
|
|
8
9
|
test('DeleteForGivenLength test1', async () => {
|
|
9
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
11
|
+
new KIRunFunctionRepository(),
|
|
12
|
+
new KIRunSchemaRepository(),
|
|
13
|
+
);
|
|
10
14
|
|
|
11
15
|
fep.setArguments(
|
|
12
16
|
new Map<string, string | number>([
|
|
@@ -24,7 +28,10 @@ test('DeleteForGivenLength test1', async () => {
|
|
|
24
28
|
});
|
|
25
29
|
|
|
26
30
|
test('DeleteForGivenLength test2', async () => {
|
|
27
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
31
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
32
|
+
new KIRunFunctionRepository(),
|
|
33
|
+
new KIRunSchemaRepository(),
|
|
34
|
+
);
|
|
28
35
|
|
|
29
36
|
fep.setArguments(
|
|
30
37
|
new Map<string, string | number>([
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { InsertAtGivenPosition } from '../../../../../src/engine/function/system/string/InsertAtGivenPosition';
|
|
2
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
2
3
|
|
|
3
4
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
4
5
|
|
|
5
6
|
const reve: InsertAtGivenPosition = new InsertAtGivenPosition();
|
|
6
7
|
|
|
7
8
|
test('InsertATGivenPositions test1', async () => {
|
|
8
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
9
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
new KIRunFunctionRepository(),
|
|
11
|
+
new KIRunSchemaRepository(),
|
|
12
|
+
);
|
|
9
13
|
|
|
10
14
|
fep.setArguments(
|
|
11
15
|
new Map<string, string | number>([
|
|
@@ -21,7 +25,10 @@ test('InsertATGivenPositions test1', async () => {
|
|
|
21
25
|
});
|
|
22
26
|
|
|
23
27
|
test('InsertATGivenPositions test2', async () => {
|
|
24
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
28
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
29
|
+
new KIRunFunctionRepository(),
|
|
30
|
+
new KIRunSchemaRepository(),
|
|
31
|
+
);
|
|
25
32
|
|
|
26
33
|
fep.setArguments(
|
|
27
34
|
new Map<string, string | number>([
|
|
@@ -37,7 +44,10 @@ test('InsertATGivenPositions test2', async () => {
|
|
|
37
44
|
});
|
|
38
45
|
|
|
39
46
|
test('InsertATGivenPositions test3', async () => {
|
|
40
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
47
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
48
|
+
new KIRunFunctionRepository(),
|
|
49
|
+
new KIRunSchemaRepository(),
|
|
50
|
+
);
|
|
41
51
|
|
|
42
52
|
fep.setArguments(
|
|
43
53
|
new Map<string, string | number>([
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { PostPad } from '../../../../../src/engine/function/system/string/PostPad';
|
|
2
2
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
3
|
import { MapEntry, MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
4
5
|
|
|
5
6
|
const reve: PostPad = new PostPad();
|
|
6
7
|
|
|
7
8
|
test('postpad test1', async () => {
|
|
8
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
9
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
new KIRunFunctionRepository(),
|
|
11
|
+
new KIRunSchemaRepository(),
|
|
12
|
+
);
|
|
9
13
|
|
|
10
14
|
fep.setArguments(
|
|
11
15
|
new Map<string, string | number>([
|
|
@@ -21,7 +25,10 @@ test('postpad test1', async () => {
|
|
|
21
25
|
});
|
|
22
26
|
|
|
23
27
|
test('postpad test2', async () => {
|
|
24
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
28
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
29
|
+
new KIRunFunctionRepository(),
|
|
30
|
+
new KIRunSchemaRepository(),
|
|
31
|
+
);
|
|
25
32
|
|
|
26
33
|
fep.setArguments(
|
|
27
34
|
new Map<string, string | number>([
|
|
@@ -37,7 +44,10 @@ test('postpad test2', async () => {
|
|
|
37
44
|
});
|
|
38
45
|
|
|
39
46
|
test('postpad test3', async () => {
|
|
40
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
47
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
48
|
+
new KIRunFunctionRepository(),
|
|
49
|
+
new KIRunSchemaRepository(),
|
|
50
|
+
);
|
|
41
51
|
|
|
42
52
|
fep.setArguments(
|
|
43
53
|
new Map<string, string | number>([
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { PrePad } from '../../../../../src/engine/function/system/string/PrePad';
|
|
2
2
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
3
|
import { MapEntry, MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
4
5
|
|
|
5
6
|
const prepad: PrePad = new PrePad();
|
|
6
7
|
|
|
7
8
|
test('prepad test1', async () => {
|
|
8
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
9
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
new KIRunFunctionRepository(),
|
|
11
|
+
new KIRunSchemaRepository(),
|
|
12
|
+
);
|
|
9
13
|
|
|
10
14
|
fep.setArguments(
|
|
11
15
|
new Map<string, string | number>([
|
|
@@ -23,7 +27,10 @@ test('prepad test1', async () => {
|
|
|
23
27
|
});
|
|
24
28
|
|
|
25
29
|
test('prepad test2', async () => {
|
|
26
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
30
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
31
|
+
new KIRunFunctionRepository(),
|
|
32
|
+
new KIRunSchemaRepository(),
|
|
33
|
+
);
|
|
27
34
|
|
|
28
35
|
fep.setArguments(
|
|
29
36
|
new Map<string, string | number>([
|
|
@@ -39,7 +46,10 @@ test('prepad test2', async () => {
|
|
|
39
46
|
});
|
|
40
47
|
|
|
41
48
|
test('prepad test3', async () => {
|
|
42
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
49
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
50
|
+
new KIRunFunctionRepository(),
|
|
51
|
+
new KIRunSchemaRepository(),
|
|
52
|
+
);
|
|
43
53
|
|
|
44
54
|
fep.setArguments(
|
|
45
55
|
new Map<string, string | number>([
|
|
@@ -2,10 +2,14 @@ import { RegionMatches } from '../../../../../src/engine/function/system/string/
|
|
|
2
2
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
3
|
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
4
|
|
|
5
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
5
6
|
const region: RegionMatches = new RegionMatches();
|
|
6
7
|
|
|
7
8
|
test('toString test1', async () => {
|
|
8
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
9
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
new KIRunFunctionRepository(),
|
|
11
|
+
new KIRunSchemaRepository(),
|
|
12
|
+
);
|
|
9
13
|
|
|
10
14
|
fep.setArguments(
|
|
11
15
|
MapUtil.of<string, string | number | boolean>(
|
|
@@ -33,7 +37,10 @@ test('toString test1', async () => {
|
|
|
33
37
|
});
|
|
34
38
|
|
|
35
39
|
test('toString test2', async () => {
|
|
36
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
40
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
41
|
+
new KIRunFunctionRepository(),
|
|
42
|
+
new KIRunSchemaRepository(),
|
|
43
|
+
);
|
|
37
44
|
fep.setArguments(
|
|
38
45
|
MapUtil.of<string, string | number | boolean>(
|
|
39
46
|
RegionMatches.PARAMETER_BOOLEAN_NAME,
|
|
@@ -60,7 +67,10 @@ test('toString test2', async () => {
|
|
|
60
67
|
});
|
|
61
68
|
|
|
62
69
|
test('toString test3', async () => {
|
|
63
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
70
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
71
|
+
new KIRunFunctionRepository(),
|
|
72
|
+
new KIRunSchemaRepository(),
|
|
73
|
+
);
|
|
64
74
|
fep.setArguments(
|
|
65
75
|
MapUtil.of<string, string | number | boolean>(
|
|
66
76
|
RegionMatches.PARAMETER_BOOLEAN_NAME,
|
|
@@ -2,11 +2,15 @@ import { Reverse } from '../../../../../src/engine/function/system/string/Revers
|
|
|
2
2
|
import { SchemaValidationException } from '../../../../../src/engine/json/schema/validator/exception/SchemaValidationException';
|
|
3
3
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
4
4
|
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
5
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
5
6
|
|
|
6
7
|
const reve: Reverse = new Reverse();
|
|
7
8
|
|
|
8
9
|
test('reverse test1', async () => {
|
|
9
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
11
|
+
new KIRunFunctionRepository(),
|
|
12
|
+
new KIRunSchemaRepository(),
|
|
13
|
+
);
|
|
10
14
|
|
|
11
15
|
fep.setArguments(MapUtil.of('value', ' mr"ofta"lp edoc on a si sihT'));
|
|
12
16
|
|
|
@@ -16,7 +20,10 @@ test('reverse test1', async () => {
|
|
|
16
20
|
});
|
|
17
21
|
|
|
18
22
|
test('reverse test2', async () => {
|
|
19
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
23
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
24
|
+
new KIRunFunctionRepository(),
|
|
25
|
+
new KIRunSchemaRepository(),
|
|
26
|
+
);
|
|
20
27
|
|
|
21
28
|
fep.setArguments(MapUtil.of('value', ' '));
|
|
22
29
|
|
|
@@ -26,7 +33,7 @@ test('reverse test2', async () => {
|
|
|
26
33
|
});
|
|
27
34
|
|
|
28
35
|
// test('reverse test3', async () => {
|
|
29
|
-
// let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
36
|
+
// let fep: FunctionExecutionParameters = new FunctionExecutionParameters(new KIRunFunctionRepository(), new KIRunSchemaRepository());
|
|
30
37
|
|
|
31
38
|
// fep.setArguments(MapUtil.of('value', null));
|
|
32
39
|
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { Split } from '../../../../../src/engine/function/system/string/Split';
|
|
2
2
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
3
|
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
4
5
|
|
|
5
6
|
const Spli: Split = new Split();
|
|
6
7
|
|
|
7
8
|
test('split test1', async () => {
|
|
8
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
9
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
new KIRunFunctionRepository(),
|
|
11
|
+
new KIRunSchemaRepository(),
|
|
12
|
+
);
|
|
9
13
|
fep.setArguments(
|
|
10
14
|
MapUtil.of(
|
|
11
15
|
'string',
|
|
@@ -35,7 +39,10 @@ test('split test1', async () => {
|
|
|
35
39
|
});
|
|
36
40
|
|
|
37
41
|
test('split test2', async () => {
|
|
38
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
42
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
43
|
+
new KIRunFunctionRepository(),
|
|
44
|
+
new KIRunSchemaRepository(),
|
|
45
|
+
);
|
|
39
46
|
fep.setArguments(
|
|
40
47
|
MapUtil.of(
|
|
41
48
|
'string',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
1
2
|
import { AbstractStringFunction } from '../../../../../src/engine/function/system/string/AbstractStringFunction';
|
|
2
3
|
import { StringFunctionRepository } from '../../../../../src/engine/function/system/string/StringFunctionRepository';
|
|
3
4
|
import { Namespaces } from '../../../../../src/engine/namespaces/Namespaces';
|
|
@@ -8,7 +9,10 @@ const stringRepo = new StringFunctionRepository();
|
|
|
8
9
|
|
|
9
10
|
test('StringRepo - contains', async () => {
|
|
10
11
|
let fun = stringRepo.find(Namespaces.STRING, 'Contains');
|
|
11
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
12
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
13
|
+
new KIRunFunctionRepository(),
|
|
14
|
+
new KIRunSchemaRepository(),
|
|
15
|
+
);
|
|
12
16
|
|
|
13
17
|
if (!fun) {
|
|
14
18
|
throw new Error('Function not available');
|
|
@@ -84,7 +88,10 @@ test('string function repo 2', async () => {
|
|
|
84
88
|
throw new Error('Function not available');
|
|
85
89
|
}
|
|
86
90
|
|
|
87
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
91
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
92
|
+
new KIRunFunctionRepository(),
|
|
93
|
+
new KIRunSchemaRepository(),
|
|
94
|
+
);
|
|
88
95
|
fep.setArguments(
|
|
89
96
|
MapUtil.of(
|
|
90
97
|
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
@@ -140,7 +147,10 @@ test('string function repo 3', async () => {
|
|
|
140
147
|
throw new Error('Function not available');
|
|
141
148
|
}
|
|
142
149
|
|
|
143
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
150
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
151
|
+
new KIRunFunctionRepository(),
|
|
152
|
+
new KIRunSchemaRepository(),
|
|
153
|
+
);
|
|
144
154
|
|
|
145
155
|
fep.setArguments(
|
|
146
156
|
MapUtil.of(
|
|
@@ -3,12 +3,16 @@ import { StringFunctionRepository } from '../../../../../src/engine/function/sys
|
|
|
3
3
|
import { Namespaces } from '../../../../../src/engine/namespaces/Namespaces';
|
|
4
4
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
5
5
|
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
6
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
6
7
|
|
|
7
8
|
const stringRepo = new StringFunctionRepository();
|
|
8
9
|
|
|
9
10
|
test('StringRepo3 - EqualsIgnoreCase', async () => {
|
|
10
11
|
let fun = stringRepo.find(Namespaces.STRING, 'EqualsIgnoreCase');
|
|
11
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
12
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
13
|
+
new KIRunFunctionRepository(),
|
|
14
|
+
new KIRunSchemaRepository(),
|
|
15
|
+
);
|
|
12
16
|
|
|
13
17
|
if (!fun) {
|
|
14
18
|
throw new Error('Function not available');
|
|
@@ -48,7 +52,10 @@ test('StringRepo3 - EqualsIgnoreCase', async () => {
|
|
|
48
52
|
|
|
49
53
|
test('StringRepo3 - EqualsIgnoreCase', async () => {
|
|
50
54
|
let fun = stringRepo.find(Namespaces.STRING, 'EqualsIgnoreCase');
|
|
51
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
55
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
56
|
+
new KIRunFunctionRepository(),
|
|
57
|
+
new KIRunSchemaRepository(),
|
|
58
|
+
).setArguments(
|
|
52
59
|
new Map([
|
|
53
60
|
[AbstractStringFunction.PARAMETER_STRING_NAME, ' no code Kirun PLATform '],
|
|
54
61
|
[
|
|
@@ -3,6 +3,7 @@ import { StringFunctionRepository } from '../../../../../src/engine/function/sys
|
|
|
3
3
|
import { Namespaces } from '../../../../../src/engine/namespaces/Namespaces';
|
|
4
4
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
5
5
|
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
6
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
6
7
|
|
|
7
8
|
const repo = new StringFunctionRepository();
|
|
8
9
|
|
|
@@ -11,7 +12,10 @@ test('StringFunctionRepository - Trim', async () => {
|
|
|
11
12
|
if (!fun) {
|
|
12
13
|
throw new Error('Function not available');
|
|
13
14
|
}
|
|
14
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
15
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
16
|
+
new KIRunFunctionRepository(),
|
|
17
|
+
new KIRunSchemaRepository(),
|
|
18
|
+
);
|
|
15
19
|
fep.setArguments(MapUtil.of(AbstractStringFunction.PARAMETER_STRING_NAME, ' Kiran '));
|
|
16
20
|
expect(
|
|
17
21
|
(await fun.execute(fep))
|
|
@@ -26,7 +30,10 @@ test('StringFunctionRepo -Repeat', async () => {
|
|
|
26
30
|
if (!fun) {
|
|
27
31
|
throw new Error('Function not available');
|
|
28
32
|
}
|
|
29
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
33
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
34
|
+
new KIRunFunctionRepository(),
|
|
35
|
+
new KIRunSchemaRepository(),
|
|
36
|
+
);
|
|
30
37
|
|
|
31
38
|
fep.setArguments(
|
|
32
39
|
MapUtil.of<string, string | number>(
|
|
@@ -51,7 +58,10 @@ test('StringFunctionRepo -Lowercase', async () => {
|
|
|
51
58
|
throw new Error('Function not available');
|
|
52
59
|
}
|
|
53
60
|
|
|
54
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
61
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
62
|
+
new KIRunFunctionRepository(),
|
|
63
|
+
new KIRunSchemaRepository(),
|
|
64
|
+
);
|
|
55
65
|
|
|
56
66
|
fep.setArguments(
|
|
57
67
|
MapUtil.of<string, string | number>(
|
|
@@ -73,7 +83,10 @@ test('StringFunctionRepo -UpperCase', async () => {
|
|
|
73
83
|
if (!fun) {
|
|
74
84
|
throw new Error('Function not available');
|
|
75
85
|
}
|
|
76
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
86
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
87
|
+
new KIRunFunctionRepository(),
|
|
88
|
+
new KIRunSchemaRepository(),
|
|
89
|
+
);
|
|
77
90
|
|
|
78
91
|
fep.setArguments(
|
|
79
92
|
MapUtil.of<string, string | number>(
|
|
@@ -95,7 +108,10 @@ test('StringFunctionRepo -Blank1', async () => {
|
|
|
95
108
|
if (!fun) {
|
|
96
109
|
throw new Error('Function not available');
|
|
97
110
|
}
|
|
98
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
111
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
112
|
+
new KIRunFunctionRepository(),
|
|
113
|
+
new KIRunSchemaRepository(),
|
|
114
|
+
);
|
|
99
115
|
|
|
100
116
|
fep.setArguments(MapUtil.of<string, string>(AbstractStringFunction.PARAMETER_STRING_NAME, ''));
|
|
101
117
|
|
|
@@ -112,7 +128,10 @@ test('StringFunctionRepo -Blank2', async () => {
|
|
|
112
128
|
if (!fun) {
|
|
113
129
|
throw new Error('Function not available');
|
|
114
130
|
}
|
|
115
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
131
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
132
|
+
new KIRunFunctionRepository(),
|
|
133
|
+
new KIRunSchemaRepository(),
|
|
134
|
+
);
|
|
116
135
|
|
|
117
136
|
fep.setArguments(
|
|
118
137
|
MapUtil.of<string, string | number>(
|
|
@@ -134,7 +153,10 @@ test('StringFunctionRepo -Empty1', async () => {
|
|
|
134
153
|
if (!fun) {
|
|
135
154
|
throw new Error('Function not available');
|
|
136
155
|
}
|
|
137
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
156
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
157
|
+
new KIRunFunctionRepository(),
|
|
158
|
+
new KIRunSchemaRepository(),
|
|
159
|
+
);
|
|
138
160
|
|
|
139
161
|
fep.setArguments(
|
|
140
162
|
MapUtil.of<string, string | number>(AbstractStringFunction.PARAMETER_STRING_NAME, ''),
|
|
@@ -153,7 +175,10 @@ test('StringFunctionRepo -Empty2', async () => {
|
|
|
153
175
|
if (!fun) {
|
|
154
176
|
throw new Error('Function not available');
|
|
155
177
|
}
|
|
156
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
178
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
179
|
+
new KIRunFunctionRepository(),
|
|
180
|
+
new KIRunSchemaRepository(),
|
|
181
|
+
);
|
|
157
182
|
|
|
158
183
|
fep.setArguments(
|
|
159
184
|
MapUtil.of<string, string | number>(AbstractStringFunction.PARAMETER_STRING_NAME, ' '),
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { ToString } from '../../../../../src/engine/function/system/string/ToString';
|
|
2
2
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
3
|
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
4
5
|
|
|
5
6
|
const toString: ToString = new ToString();
|
|
6
7
|
|
|
7
8
|
test('toString test1', async () => {
|
|
8
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
9
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
new KIRunFunctionRepository(),
|
|
11
|
+
new KIRunSchemaRepository(),
|
|
12
|
+
);
|
|
9
13
|
fep.setArguments(MapUtil.of('anytype', 123));
|
|
10
14
|
|
|
11
15
|
expect((await toString.execute(fep)).allResults()[0].getResult().get('result')).toBe('123');
|
|
12
16
|
});
|
|
13
17
|
|
|
14
18
|
// test('toString test2', async () => {
|
|
15
|
-
// let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
19
|
+
// let fep: FunctionExecutionParameters = new FunctionExecutionParameters(new KIRunFunctionRepository(), new KIRunSchemaRepository());
|
|
16
20
|
|
|
17
21
|
// let array: string[] = [];
|
|
18
22
|
// array.push('I');
|
|
@@ -36,7 +40,10 @@ test('toString test1', async () => {
|
|
|
36
40
|
// });
|
|
37
41
|
|
|
38
42
|
test('toString test2 ', async () => {
|
|
39
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
43
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
44
|
+
new KIRunFunctionRepository(),
|
|
45
|
+
new KIRunSchemaRepository(),
|
|
46
|
+
);
|
|
40
47
|
fep.setArguments(MapUtil.of('anytype', true));
|
|
41
48
|
|
|
42
49
|
expect((await toString.execute(fep)).allResults()[0].getResult().get('result')).toBe('true');
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { TrimTo } from '../../../../../src/engine/function/system/string/TrimTo';
|
|
2
2
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
3
4
|
|
|
4
5
|
const trim: TrimTo = new TrimTo();
|
|
5
6
|
|
|
6
7
|
test('Trim to test1 ', async () => {
|
|
7
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
8
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
9
|
+
new KIRunFunctionRepository(),
|
|
10
|
+
new KIRunSchemaRepository(),
|
|
11
|
+
).setArguments(
|
|
8
12
|
new Map<string, string | number>([
|
|
9
13
|
[TrimTo.PARAMETER_STRING_NAME, ' THIScompatY IS A NOcoDE plATFNORM'],
|
|
10
14
|
[TrimTo.PARAMETER_LENGTH_NAME, 14],
|
|
@@ -17,7 +21,10 @@ test('Trim to test1 ', async () => {
|
|
|
17
21
|
});
|
|
18
22
|
|
|
19
23
|
test('Trim to test2 ', async () => {
|
|
20
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
24
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
25
|
+
new KIRunFunctionRepository(),
|
|
26
|
+
new KIRunSchemaRepository(),
|
|
27
|
+
).setArguments(
|
|
21
28
|
new Map<string, string | number>([
|
|
22
29
|
[TrimTo.PARAMETER_STRING_NAME, ' THIScompatY IS A NOcoDE plATFNORM'],
|
|
23
30
|
[TrimTo.PARAMETER_LENGTH_NAME, 0],
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SchemaType, TypeUtil } from '../../../../../src';
|
|
2
|
+
|
|
3
|
+
test('TypeUtilTest', () => {
|
|
4
|
+
expect(TypeUtil.from('Object')?.contains(SchemaType.OBJECT)).toBeTruthy();
|
|
5
|
+
|
|
6
|
+
let type = TypeUtil.from(['Object', 'String']);
|
|
7
|
+
|
|
8
|
+
expect(type?.contains(SchemaType.STRING)).toBeTruthy();
|
|
9
|
+
expect(type?.contains(SchemaType.OBJECT)).toBeTruthy();
|
|
10
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Schema } from "../../../../../src/engine/json/schema/Schema";
|
|
2
|
+
import { SchemaType } from "../../../../../src/engine/json/schema/type/SchemaType";
|
|
3
|
+
import { TypeUtil } from "../../../../../src/engine/json/schema/type/TypeUtil";
|
|
4
|
+
import { AnyOfAllOfOneOfValidator } from "../../../../../src/engine/json/schema/validator/AnyOfAllOfOneOfValidator";
|
|
5
|
+
import { KIRunSchemaRepository } from "../../../../../src/engine/repository/KIRunSchemaRepository";
|
|
6
|
+
|
|
7
|
+
const repo = new KIRunSchemaRepository();
|
|
8
|
+
|
|
9
|
+
test("Any Of All Of One Validator Test 1", () => {
|
|
10
|
+
let schema: Schema = new Schema().setType(TypeUtil.of(SchemaType.INTEGER));
|
|
11
|
+
|
|
12
|
+
expect(AnyOfAllOfOneOfValidator.validate([], schema, repo, 10)).toBe(10);
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
test("Any Of All Of One Validator Test 2", () => {
|
|
16
|
+
let arraySchema: Schema = new Schema().setType(TypeUtil.of(SchemaType.ARRAY));
|
|
17
|
+
|
|
18
|
+
expect(AnyOfAllOfOneOfValidator.validate([], arraySchema, repo, [1, 2, 3])).toStrictEqual([1, 2, 3]);
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test("Any Of All Of One Validator Test 3", () => {
|
|
22
|
+
let objSchema: Schema = Schema.ofObject("testObj").setProperties(new Map<string, Schema>([['key', Schema.ofString('key')]]));
|
|
23
|
+
|
|
24
|
+
expect(AnyOfAllOfOneOfValidator.validate([], objSchema, repo, { "key": "value" })).toStrictEqual({ "key": "value" });
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
test("Any Of All Of One Validator Test 3", () => {
|
|
28
|
+
let nullSchema: Schema = new Schema().setType(TypeUtil.of(SchemaType.NULL));
|
|
29
|
+
|
|
30
|
+
expect(AnyOfAllOfOneOfValidator.validate([], nullSchema, repo, null)).toBe(null);
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test("Any Of All Of One Validator Test 3", () => {
|
|
34
|
+
let nullSchema: Schema = new Schema().setType(TypeUtil.of(SchemaType.BOOLEAN));
|
|
35
|
+
|
|
36
|
+
expect(AnyOfAllOfOneOfValidator.validate([], nullSchema, repo, null)).toBe(null);
|
|
37
|
+
})
|
|
38
|
+
|