@fincity/kirun-js 1.0.0
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/.prettierrc +9 -0
- package/__tests__/engine/function/system/array/AddFirstTest.ts +235 -0
- package/__tests__/engine/function/system/array/AddTest.ts +126 -0
- package/__tests__/engine/function/system/array/BinarySearchTest.ts +135 -0
- package/__tests__/engine/function/system/array/CompareTest.ts +48 -0
- package/__tests__/engine/function/system/array/CopyTest.ts +86 -0
- package/__tests__/engine/function/system/array/DeleteFirstTest.ts +103 -0
- package/__tests__/engine/function/system/array/DeleteFromTest.ts +232 -0
- package/__tests__/engine/function/system/array/DeleteLastTest.ts +103 -0
- package/__tests__/engine/function/system/array/DeleteTest.ts +110 -0
- package/__tests__/engine/function/system/array/DisjointTest.ts +184 -0
- package/__tests__/engine/function/system/array/Equals.ts +67 -0
- package/__tests__/engine/function/system/array/FillTest.ts +36 -0
- package/__tests__/engine/function/system/array/FrequencyTest.ts +97 -0
- package/__tests__/engine/function/system/array/IndexOfArrayTest.ts +347 -0
- package/__tests__/engine/function/system/array/IndexOfTest.ts +267 -0
- package/__tests__/engine/function/system/array/InsertTest.ts +229 -0
- package/__tests__/engine/function/system/array/LastIndexOfArrayTest.ts +213 -0
- package/__tests__/engine/function/system/array/LastIndexOfTest.ts +253 -0
- package/__tests__/engine/function/system/array/MaxTest.ts +98 -0
- package/__tests__/engine/function/system/array/MinTest.ts +99 -0
- package/__tests__/engine/function/system/array/MisMatchTest.ts +215 -0
- package/__tests__/engine/function/system/array/ReverseTest.ts +235 -0
- package/__tests__/engine/function/system/array/RotateTest.ts +137 -0
- package/__tests__/engine/function/system/array/ShuffleTest.ts +154 -0
- package/__tests__/engine/function/system/array/SortTest.ts +130 -0
- package/__tests__/engine/function/system/array/SubArrayTest.ts +236 -0
- package/__tests__/engine/function/system/math/AddTest.ts +12 -0
- package/__tests__/engine/function/system/string/ConcatenateTest.ts +46 -0
- package/__tests__/engine/function/system/string/DeleteForGivenLengthTest.ts +38 -0
- package/__tests__/engine/function/system/string/InsertAtGivenPositionTest.ts +53 -0
- package/__tests__/engine/function/system/string/PostPadTest.ts +54 -0
- package/__tests__/engine/function/system/string/PrePadTest.ts +54 -0
- package/__tests__/engine/function/system/string/RegionMatchesTest.ts +78 -0
- package/__tests__/engine/function/system/string/ReverseTest.ts +36 -0
- package/__tests__/engine/function/system/string/SplitTest.ts +61 -0
- package/__tests__/engine/function/system/string/StringFunctionRepoTest2.ts +126 -0
- package/__tests__/engine/function/system/string/StringFunctionRepoTest3.ts +54 -0
- package/__tests__/engine/function/system/string/StringFunctionRepositoryTest.ts +146 -0
- package/__tests__/engine/function/system/string/ToStringTest.ts +43 -0
- package/__tests__/engine/function/system/string/TrimToTest.ts +28 -0
- package/__tests__/engine/json/schema/validator/SchemaValidatorTest.ts +26 -0
- package/__tests__/engine/runtime/KIRuntimeTest.ts +351 -0
- package/__tests__/engine/runtime/expression/ExpressionEvaluationTest.ts +128 -0
- package/__tests__/engine/runtime/expression/ExpressionTest.ts +33 -0
- package/__tests__/engine/runtime/expression/tokenextractor/OutputMapTokenValueExtractorTest.ts +44 -0
- package/__tests__/engine/runtime/expression/tokenextractor/TokenValueExtractorTest.ts +72 -0
- package/__tests__/engine/util/LinkedListTest.ts +29 -0
- package/__tests__/engine/util/string/StringFormatterTest.ts +17 -0
- package/__tests__/indexTest.ts +33 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/module.js +2 -0
- package/dist/module.js.map +1 -0
- package/dist/types.d.ts +430 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +54 -0
- package/src/engine/HybridRepository.ts +18 -0
- package/src/engine/Repository.ts +3 -0
- package/src/engine/constant/KIRunConstants.ts +7 -0
- package/src/engine/exception/ExecutionException.ts +12 -0
- package/src/engine/exception/KIRuntimeException.ts +12 -0
- package/src/engine/function/AbstractFunction.ts +76 -0
- package/src/engine/function/Function.ts +13 -0
- package/src/engine/function/system/GenerateEvent.ts +76 -0
- package/src/engine/function/system/If.ts +40 -0
- package/src/engine/function/system/array/AbstractArrayFunction.ts +158 -0
- package/src/engine/function/system/array/Add.ts +31 -0
- package/src/engine/function/system/array/AddFirst.ts +44 -0
- package/src/engine/function/system/array/BinarySearch.ts +66 -0
- package/src/engine/function/system/array/Compare.ts +150 -0
- package/src/engine/function/system/array/Copy.ts +56 -0
- package/src/engine/function/system/array/Delete.ts +63 -0
- package/src/engine/function/system/array/DeleteFirst.ts +22 -0
- package/src/engine/function/system/array/DeleteFrom.ts +51 -0
- package/src/engine/function/system/array/DeleteLast.ts +23 -0
- package/src/engine/function/system/array/Disjoint.ts +85 -0
- package/src/engine/function/system/array/Equals.ts +36 -0
- package/src/engine/function/system/array/Fill.ts +51 -0
- package/src/engine/function/system/array/Frequency.ts +68 -0
- package/src/engine/function/system/array/IndexOf.ts +56 -0
- package/src/engine/function/system/array/IndexOfArray.ts +67 -0
- package/src/engine/function/system/array/Insert.ts +48 -0
- package/src/engine/function/system/array/LastIndexOf.ts +62 -0
- package/src/engine/function/system/array/LastIndexOfArray.ts +70 -0
- package/src/engine/function/system/array/Max.ts +31 -0
- package/src/engine/function/system/array/Min.ts +32 -0
- package/src/engine/function/system/array/MisMatch.ts +66 -0
- package/src/engine/function/system/array/Reverse.ts +50 -0
- package/src/engine/function/system/array/Rotate.ts +43 -0
- package/src/engine/function/system/array/Shuffle.ts +31 -0
- package/src/engine/function/system/array/Sort.ts +70 -0
- package/src/engine/function/system/array/SubArray.ts +48 -0
- package/src/engine/function/system/context/Create.ts +73 -0
- package/src/engine/function/system/context/Get.ts +55 -0
- package/src/engine/function/system/context/SetFunction.ts +244 -0
- package/src/engine/function/system/loop/CountLoop.ts +55 -0
- package/src/engine/function/system/loop/RangeLoop.ts +120 -0
- package/src/engine/function/system/math/Add.ts +34 -0
- package/src/engine/function/system/math/GenericMathFunction.ts +80 -0
- package/src/engine/function/system/math/Hypotenuse.ts +57 -0
- package/src/engine/function/system/math/MathFunctionRepository.ts +63 -0
- package/src/engine/function/system/math/Maximum.ts +38 -0
- package/src/engine/function/system/math/Minimum.ts +38 -0
- package/src/engine/function/system/math/Random.ts +27 -0
- package/src/engine/function/system/string/AbstractStringFunction.ts +409 -0
- package/src/engine/function/system/string/Concatenate.ts +57 -0
- package/src/engine/function/system/string/DeleteForGivenLength.ts +82 -0
- package/src/engine/function/system/string/InsertAtGivenPosition.ts +72 -0
- package/src/engine/function/system/string/PostPad.ts +83 -0
- package/src/engine/function/system/string/PrePad.ts +73 -0
- package/src/engine/function/system/string/RegionMatches.ts +119 -0
- package/src/engine/function/system/string/ReplaceAtGivenPosition.ts +101 -0
- package/src/engine/function/system/string/Reverse.ts +62 -0
- package/src/engine/function/system/string/Split.ts +53 -0
- package/src/engine/function/system/string/StringFunctionRepository.ts +60 -0
- package/src/engine/function/system/string/ToString.ts +45 -0
- package/src/engine/function/system/string/TrimTo.ts +55 -0
- package/src/engine/json/JsonExpression.ts +11 -0
- package/src/engine/json/schema/Schema.ts +670 -0
- package/src/engine/json/schema/SchemaUtil.ts +145 -0
- package/src/engine/json/schema/array/ArraySchemaType.ts +44 -0
- package/src/engine/json/schema/object/AdditionalPropertiesType.ts +32 -0
- package/src/engine/json/schema/string/StringFormat.ts +7 -0
- package/src/engine/json/schema/type/MultipleType.ts +28 -0
- package/src/engine/json/schema/type/SchemaType.ts +11 -0
- package/src/engine/json/schema/type/SingleType.ts +23 -0
- package/src/engine/json/schema/type/Type.ts +6 -0
- package/src/engine/json/schema/type/TypeUtil.ts +25 -0
- package/src/engine/json/schema/validator/AnyOfAllOfOneOfValidator.ts +108 -0
- package/src/engine/json/schema/validator/ArrayValidator.ts +145 -0
- package/src/engine/json/schema/validator/BooleanValidator.ts +24 -0
- package/src/engine/json/schema/validator/NullValidator.ts +17 -0
- package/src/engine/json/schema/validator/NumberValidator.ts +115 -0
- package/src/engine/json/schema/validator/ObjectValidator.ts +184 -0
- package/src/engine/json/schema/validator/SchemaValidator.ts +141 -0
- package/src/engine/json/schema/validator/StringValidator.ts +97 -0
- package/src/engine/json/schema/validator/TypeValidator.ts +49 -0
- package/src/engine/json/schema/validator/exception/SchemaReferenceException.ts +19 -0
- package/src/engine/json/schema/validator/exception/SchemaValidationException.ts +22 -0
- package/src/engine/model/AbstractStatement.ts +29 -0
- package/src/engine/model/Argument.ts +36 -0
- package/src/engine/model/Event.ts +62 -0
- package/src/engine/model/EventResult.ts +34 -0
- package/src/engine/model/FunctionDefinition.ts +69 -0
- package/src/engine/model/FunctionOutput.ts +37 -0
- package/src/engine/model/FunctionOutputGenerator.ts +5 -0
- package/src/engine/model/FunctionSignature.ts +67 -0
- package/src/engine/model/Parameter.ts +97 -0
- package/src/engine/model/ParameterReference.ts +57 -0
- package/src/engine/model/ParameterReferenceType.ts +4 -0
- package/src/engine/model/ParameterType.ts +4 -0
- package/src/engine/model/Position.ts +40 -0
- package/src/engine/model/Statement.ts +101 -0
- package/src/engine/model/StatementGroup.ts +37 -0
- package/src/engine/namespaces/Namespaces.ts +11 -0
- package/src/engine/repository/KIRunFunctionRepository.ts +37 -0
- package/src/engine/repository/KIRunSchemaRepository.ts +24 -0
- package/src/engine/runtime/ContextElement.ts +28 -0
- package/src/engine/runtime/FunctionExecutionParameters.ts +74 -0
- package/src/engine/runtime/KIRuntime.ts +653 -0
- package/src/engine/runtime/StatementExecution.ts +61 -0
- package/src/engine/runtime/StatementMessage.ts +30 -0
- package/src/engine/runtime/StatementMessageType.ts +5 -0
- package/src/engine/runtime/expression/Expression.ts +330 -0
- package/src/engine/runtime/expression/ExpressionEvaluator.ts +305 -0
- package/src/engine/runtime/expression/ExpressionToken.ts +15 -0
- package/src/engine/runtime/expression/ExpressionTokenValue.ts +23 -0
- package/src/engine/runtime/expression/Operation.ts +190 -0
- package/src/engine/runtime/expression/exception/ExpressionEvaluationException.ts +15 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticAdditionOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticDivisionOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticInetgerDivisionOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticModulusOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticMultiplicationOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticSubtractionOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArrayOperator.ts +31 -0
- package/src/engine/runtime/expression/operators/binary/BinaryOperator.ts +15 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseAndOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseLeftShiftOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseOrOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseRightShiftOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseUnsignedRightShiftOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseXorOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/LogicalAndOperator.ts +25 -0
- package/src/engine/runtime/expression/operators/binary/LogicalEqualOperator.ts +13 -0
- package/src/engine/runtime/expression/operators/binary/LogicalGreaterThanEqualOperator.ts +24 -0
- package/src/engine/runtime/expression/operators/binary/LogicalGreaterThanOperator.ts +24 -0
- package/src/engine/runtime/expression/operators/binary/LogicalLessThanEqualOperator.ts +24 -0
- package/src/engine/runtime/expression/operators/binary/LogicalLessThanOperator.ts +24 -0
- package/src/engine/runtime/expression/operators/binary/LogicalNotEqualOperator.ts +13 -0
- package/src/engine/runtime/expression/operators/binary/LogicalOrOperator.ts +25 -0
- package/src/engine/runtime/expression/operators/binary/ObjectOperator.ts +24 -0
- package/src/engine/runtime/expression/operators/unary/ArithmeticUnaryMinusOperator.ts +13 -0
- package/src/engine/runtime/expression/operators/unary/ArithmeticUnaryPlusOperator.ts +13 -0
- package/src/engine/runtime/expression/operators/unary/BitwiseComplementOperator.ts +22 -0
- package/src/engine/runtime/expression/operators/unary/LogicalNotOperator.ts +22 -0
- package/src/engine/runtime/expression/operators/unary/UnaryOperator.ts +15 -0
- package/src/engine/runtime/expression/tokenextractor/LiteralTokenValueExtractor.ts +64 -0
- package/src/engine/runtime/expression/tokenextractor/TokenValueExtractor.ts +136 -0
- package/src/engine/runtime/graph/ExecutionGraph.ts +81 -0
- package/src/engine/runtime/graph/GraphVertex.ts +118 -0
- package/src/engine/runtime/graph/GraphVertexType.ts +4 -0
- package/src/engine/runtime/tokenextractor/ArgumentsTokenValueExtractor.ts +22 -0
- package/src/engine/runtime/tokenextractor/ContextTokenValueExtractor.ts +37 -0
- package/src/engine/runtime/tokenextractor/OutputMapTokenValueExtractor.ts +32 -0
- package/src/engine/util/ArrayUtil.ts +23 -0
- package/src/engine/util/LinkedList.ts +229 -0
- package/src/engine/util/MapUtil.ts +86 -0
- package/src/engine/util/NullCheck.ts +3 -0
- package/src/engine/util/Tuples.ts +43 -0
- package/src/engine/util/primitive/PrimitiveUtil.ts +143 -0
- package/src/engine/util/string/StringBuilder.ts +59 -0
- package/src/engine/util/string/StringFormatter.ts +25 -0
- package/src/engine/util/string/StringUtil.ts +48 -0
- package/src/index.ts +13 -0
- package/tsconfig.json +6 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { AbstractStringFunction } from '../../../../../src/engine/function/system/string/AbstractStringFunction';
|
|
2
|
+
import { StringFunctionRepository } from '../../../../../src/engine/function/system/string/StringFunctionRepository';
|
|
3
|
+
import { Namespaces } from '../../../../../src/engine/namespaces/Namespaces';
|
|
4
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
5
|
+
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
6
|
+
|
|
7
|
+
const repo = new StringFunctionRepository();
|
|
8
|
+
|
|
9
|
+
test('StringFunctionRepository - Trim', () => {
|
|
10
|
+
let fun = repo.find(Namespaces.STRING, 'Trim');
|
|
11
|
+
if (!fun) {
|
|
12
|
+
throw new Error('Function not available');
|
|
13
|
+
}
|
|
14
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
15
|
+
fep.setArguments(MapUtil.of(AbstractStringFunction.PARAMETER_STRING_NAME, ' Kiran '));
|
|
16
|
+
expect(
|
|
17
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
18
|
+
).toBe('Kiran');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('StringFunctionRepo -Repeat', () => {
|
|
22
|
+
let fun = repo.find(Namespaces.STRING, 'Repeat');
|
|
23
|
+
if (!fun) {
|
|
24
|
+
throw new Error('Function not available');
|
|
25
|
+
}
|
|
26
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
27
|
+
|
|
28
|
+
fep.setArguments(
|
|
29
|
+
MapUtil.of<string, string | number>(
|
|
30
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
31
|
+
' surendhar ',
|
|
32
|
+
AbstractStringFunction.PARAMETER_INDEX_NAME,
|
|
33
|
+
3,
|
|
34
|
+
),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
expect(
|
|
38
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
39
|
+
).toBe(' surendhar surendhar surendhar ');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('StringFunctionRepo -Lowercase', () => {
|
|
43
|
+
let fun = repo.find(Namespaces.STRING, 'LowerCase');
|
|
44
|
+
if (!fun) {
|
|
45
|
+
throw new Error('Function not available');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
49
|
+
|
|
50
|
+
fep.setArguments(
|
|
51
|
+
MapUtil.of<string, string | number>(
|
|
52
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
53
|
+
' SURENDHAR ',
|
|
54
|
+
),
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
expect(
|
|
58
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
59
|
+
).toBe(' surendhar ');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('StringFunctionRepo -UpperCase', () => {
|
|
63
|
+
let fun = repo.find(Namespaces.STRING, 'UpperCase');
|
|
64
|
+
if (!fun) {
|
|
65
|
+
throw new Error('Function not available');
|
|
66
|
+
}
|
|
67
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
68
|
+
|
|
69
|
+
fep.setArguments(
|
|
70
|
+
MapUtil.of<string, string | number>(
|
|
71
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
72
|
+
' surendhar ',
|
|
73
|
+
),
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
expect(
|
|
77
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
78
|
+
).toBe(' SURENDHAR ');
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('StringFunctionRepo -Blank1', () => {
|
|
82
|
+
let fun = repo.find(Namespaces.STRING, 'Blank');
|
|
83
|
+
if (!fun) {
|
|
84
|
+
throw new Error('Function not available');
|
|
85
|
+
}
|
|
86
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
87
|
+
|
|
88
|
+
fep.setArguments(
|
|
89
|
+
MapUtil.of<string, string | number>(AbstractStringFunction.PARAMETER_STRING_NAME, ''),
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
expect(
|
|
93
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
94
|
+
).toBe(true);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test('StringFunctionRepo -Blank2', () => {
|
|
98
|
+
let fun = repo.find(Namespaces.STRING, 'Blank');
|
|
99
|
+
if (!fun) {
|
|
100
|
+
throw new Error('Function not available');
|
|
101
|
+
}
|
|
102
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
103
|
+
|
|
104
|
+
fep.setArguments(
|
|
105
|
+
MapUtil.of<string, string | number>(
|
|
106
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
107
|
+
' this is a string',
|
|
108
|
+
),
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
expect(
|
|
112
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
113
|
+
).toBe(false);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('StringFunctionRepo -Empty1', () => {
|
|
117
|
+
let fun = repo.find(Namespaces.STRING, 'Empty');
|
|
118
|
+
if (!fun) {
|
|
119
|
+
throw new Error('Function not available');
|
|
120
|
+
}
|
|
121
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
122
|
+
|
|
123
|
+
fep.setArguments(
|
|
124
|
+
MapUtil.of<string, string | number>(AbstractStringFunction.PARAMETER_STRING_NAME, ''),
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
expect(
|
|
128
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
129
|
+
).toBe(true);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('StringFunctionRepo -Empty2', () => {
|
|
133
|
+
let fun = repo.find(Namespaces.STRING, 'Empty');
|
|
134
|
+
if (!fun) {
|
|
135
|
+
throw new Error('Function not available');
|
|
136
|
+
}
|
|
137
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
138
|
+
|
|
139
|
+
fep.setArguments(
|
|
140
|
+
MapUtil.of<string, string | number>(AbstractStringFunction.PARAMETER_STRING_NAME, ' '),
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
expect(
|
|
144
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
145
|
+
).toBe(false);
|
|
146
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ToString } from '../../../../../src/engine/function/system/string/ToString';
|
|
2
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
|
+
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
|
+
|
|
5
|
+
const toString: ToString = new ToString();
|
|
6
|
+
|
|
7
|
+
test('toString test1', () => {
|
|
8
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
9
|
+
fep.setArguments(MapUtil.of('anytype', 123));
|
|
10
|
+
|
|
11
|
+
expect(toString.execute(fep).allResults()[0].getResult().get('result')).toBe('123');
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// test('toString test2', () => {
|
|
15
|
+
// let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
16
|
+
|
|
17
|
+
// let array: string[] = [];
|
|
18
|
+
// array.push('I');
|
|
19
|
+
// array.push('am');
|
|
20
|
+
// array.push('using');
|
|
21
|
+
// array.push('eclipse');
|
|
22
|
+
// array.push('to');
|
|
23
|
+
// array.push('test');
|
|
24
|
+
// array.push('the');
|
|
25
|
+
// array.push('changes');
|
|
26
|
+
// array.push('with');
|
|
27
|
+
// array.push('test');
|
|
28
|
+
// array.push('Driven');
|
|
29
|
+
// array.push('developement');
|
|
30
|
+
|
|
31
|
+
// fep.setArguments(MapUtil.of('anytype', array));
|
|
32
|
+
|
|
33
|
+
// expect(toString.execute(fep).allResults()[0].getResult().get('result')).toBe(
|
|
34
|
+
// 'I am using eclipse to test the changes with test Driven developement',
|
|
35
|
+
// );
|
|
36
|
+
// });
|
|
37
|
+
|
|
38
|
+
test('toString test2 ', () => {
|
|
39
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
40
|
+
fep.setArguments(MapUtil.of('anytype', true));
|
|
41
|
+
|
|
42
|
+
expect(toString.execute(fep).allResults()[0].getResult().get('result')).toBe('true');
|
|
43
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TrimTo } from '../../../../../src/engine/function/system/string/TrimTo';
|
|
2
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
|
+
|
|
4
|
+
const trim: TrimTo = new TrimTo();
|
|
5
|
+
|
|
6
|
+
test('Trim to test1 ', () => {
|
|
7
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
|
|
8
|
+
new Map<string, string | number>([
|
|
9
|
+
[TrimTo.PARAMETER_STRING_NAME, ' THIScompatY IS A NOcoDE plATFNORM'],
|
|
10
|
+
[TrimTo.PARAMETER_LENGTH_NAME, 14],
|
|
11
|
+
]),
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
expect(trim.execute(fep).allResults()[0].getResult().get(TrimTo.EVENT_RESULT_NAME)).toBe(
|
|
15
|
+
' THIScompatY I',
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('Trim to test2 ', () => {
|
|
20
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
|
|
21
|
+
new Map<string, string | number>([
|
|
22
|
+
[TrimTo.PARAMETER_STRING_NAME, ' THIScompatY IS A NOcoDE plATFNORM'],
|
|
23
|
+
[TrimTo.PARAMETER_LENGTH_NAME, 0],
|
|
24
|
+
]),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
expect(trim.execute(fep).allResults()[0].getResult().get(TrimTo.EVENT_RESULT_NAME)).toBe('');
|
|
28
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
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 { SchemaValidationException } from '../../../../../src/engine/json/schema/validator/exception/SchemaValidationException';
|
|
5
|
+
import { SchemaValidator } from '../../../../../src/engine/json/schema/validator/SchemaValidator';
|
|
6
|
+
import { KIRunSchemaRepository } from '../../../../../src/engine/repository/KIRunSchemaRepository';
|
|
7
|
+
|
|
8
|
+
const repo = new KIRunSchemaRepository();
|
|
9
|
+
|
|
10
|
+
test('Schema Validator Test 1', () => {
|
|
11
|
+
let schema: Schema = new Schema().setType(TypeUtil.of(SchemaType.INTEGER));
|
|
12
|
+
|
|
13
|
+
expect(SchemaValidator.validate([], schema, repo, 2)).toBe(2);
|
|
14
|
+
|
|
15
|
+
let obj = { name: 'shagil' };
|
|
16
|
+
let objSchema: Schema = Schema.ofObject('testObj')
|
|
17
|
+
.setProperties(new Map<string, Schema>([['name', Schema.ofString('name')]]))
|
|
18
|
+
.setRequired(['name']);
|
|
19
|
+
expect(SchemaValidator.validate([], objSchema, repo, obj)).toBe(obj);
|
|
20
|
+
|
|
21
|
+
expect(() => SchemaValidator.validate([], objSchema, repo, { name: 123 })).toThrow(
|
|
22
|
+
'Value {"name":123} is not of valid type(s)\nValue 123 is not of valid type(s)\n123 is not String',
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
// expect(SchemaValidator.validate([], schema, repo, 2.5)).toThrowError(new SchemaValidationException('', '2.5 is not a number of type Integer'));
|
|
26
|
+
});
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { KIRuntime } from '../../../src/engine/runtime/KIRuntime';
|
|
2
|
+
import { EventResult } from '../../../src/engine/model/EventResult';
|
|
3
|
+
import { Event } from '../../../src/engine/model/Event';
|
|
4
|
+
import { FunctionDefinition } from '../../../src/engine/model/FunctionDefinition';
|
|
5
|
+
import { Parameter } from '../../../src/engine/model/Parameter';
|
|
6
|
+
import { FunctionExecutionParameters } from '../../../src/engine/runtime/FunctionExecutionParameters';
|
|
7
|
+
import { Create } from '../../../src/engine/function/system/context/Create';
|
|
8
|
+
import { SetFunction } from '../../../src/engine/function/system/context/SetFunction';
|
|
9
|
+
import { GenerateEvent } from '../../../src/engine/function/system/GenerateEvent';
|
|
10
|
+
import { If } from '../../../src/engine/function/system/If';
|
|
11
|
+
import { RangeLoop } from '../../../src/engine/function/system/loop/RangeLoop';
|
|
12
|
+
import { Statement } from '../../../src/engine/model/Statement';
|
|
13
|
+
import { ParameterReference } from '../../../src/engine/model/ParameterReference';
|
|
14
|
+
import { Schema } from '../../../src/engine/json/schema/Schema';
|
|
15
|
+
import { KIRunFunctionRepository } from '../../../src/engine/repository/KIRunFunctionRepository';
|
|
16
|
+
import { KIRunSchemaRepository } from '../../../src/engine/repository/KIRunSchemaRepository';
|
|
17
|
+
import { Namespaces } from '../../../src/engine/namespaces/Namespaces';
|
|
18
|
+
import { FunctionSignature } from '../../../src/engine/model/FunctionSignature';
|
|
19
|
+
import { AbstractFunction } from '../../../src/engine/function/AbstractFunction';
|
|
20
|
+
import { FunctionOutput } from '../../../src/engine/model/FunctionOutput';
|
|
21
|
+
import { HybridRepository } from '../../../src/engine/HybridRepository';
|
|
22
|
+
import { Function } from '../../../src/engine/function/Function';
|
|
23
|
+
|
|
24
|
+
test('KIRuntime Test 1', () => {
|
|
25
|
+
let start = new Date().getTime();
|
|
26
|
+
let num: number = 7000;
|
|
27
|
+
let array: number[] = [];
|
|
28
|
+
let a = 0,
|
|
29
|
+
b = 1;
|
|
30
|
+
array.push(a);
|
|
31
|
+
array.push(b);
|
|
32
|
+
|
|
33
|
+
for (let i = 2; i < num; i++) {
|
|
34
|
+
array.push(array[i - 2] + array[i - 1]);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
console.log('Normal Logic : ' + (new Date().getTime() - start));
|
|
38
|
+
|
|
39
|
+
var create = new Create().getSignature();
|
|
40
|
+
var integerSchema = { name: 'EachElement', type: 'INTEGER' };
|
|
41
|
+
var arrayOfIntegerSchema = {
|
|
42
|
+
name: 'ArrayType',
|
|
43
|
+
type: 'ARRAY',
|
|
44
|
+
defaultValue: new Array(),
|
|
45
|
+
items: integerSchema,
|
|
46
|
+
};
|
|
47
|
+
var createArray =new Statement('createArray', create.getNamespace(), create.getName())
|
|
48
|
+
.setParameterMap(
|
|
49
|
+
new Map([
|
|
50
|
+
['name', [ParameterReference.ofValue('a')]],
|
|
51
|
+
['schema', [ParameterReference.ofValue(arrayOfIntegerSchema)]],
|
|
52
|
+
]),
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
var rangeLoop = new RangeLoop().getSignature();
|
|
56
|
+
var loop =new Statement('loop', rangeLoop.getNamespace(), rangeLoop.getName())
|
|
57
|
+
.setParameterMap(
|
|
58
|
+
new Map([
|
|
59
|
+
['from', [ParameterReference.ofValue(0)]],
|
|
60
|
+
['to', [ParameterReference.ofExpression('Arguments.Count')]],
|
|
61
|
+
]),
|
|
62
|
+
)
|
|
63
|
+
.setDependentStatements(['Steps.createArray.output']);
|
|
64
|
+
|
|
65
|
+
var resultObj = { name: 'result', value: { isExpression: true, value: 'Context.a' } };
|
|
66
|
+
|
|
67
|
+
var generate = new GenerateEvent().getSignature();
|
|
68
|
+
var outputGenerate =new Statement('outputStep', generate.getNamespace(), generate.getName())
|
|
69
|
+
.setParameterMap(
|
|
70
|
+
new Map([
|
|
71
|
+
['eventName', [ParameterReference.ofValue('output')]],
|
|
72
|
+
['results', [ParameterReference.ofValue(resultObj)]],
|
|
73
|
+
]),
|
|
74
|
+
)
|
|
75
|
+
.setDependentStatements(['Steps.loop.output']);
|
|
76
|
+
|
|
77
|
+
var ifFunction = new If().getSignature();
|
|
78
|
+
var ifStep =new Statement('if', ifFunction.getNamespace(), ifFunction.getName())
|
|
79
|
+
.setParameterMap(
|
|
80
|
+
new Map([
|
|
81
|
+
[
|
|
82
|
+
'condition',
|
|
83
|
+
[
|
|
84
|
+
ParameterReference.ofExpression(
|
|
85
|
+
'Steps.loop.iteration.index = 0 or Steps.loop.iteration.index = 1',
|
|
86
|
+
),
|
|
87
|
+
],
|
|
88
|
+
],
|
|
89
|
+
]),
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
var set = new SetFunction().getSignature();
|
|
93
|
+
var set1 =new Statement('setOnTrue', set.getNamespace(), set.getName())
|
|
94
|
+
.setParameterMap(
|
|
95
|
+
new Map([
|
|
96
|
+
['name', [ParameterReference.ofValue('Context.a[Steps.loop.iteration.index]')]],
|
|
97
|
+
['value', [ParameterReference.ofExpression('Steps.loop.iteration.index')]],
|
|
98
|
+
]),
|
|
99
|
+
)
|
|
100
|
+
.setDependentStatements(['Steps.if.true']);
|
|
101
|
+
var set2 =new Statement('setOnFalse', set.getNamespace(), set.getName())
|
|
102
|
+
.setParameterMap(
|
|
103
|
+
new Map([
|
|
104
|
+
['name', [ParameterReference.ofValue('Context.a[Steps.loop.iteration.index]')]],
|
|
105
|
+
[
|
|
106
|
+
'value',
|
|
107
|
+
[
|
|
108
|
+
ParameterReference.ofExpression(
|
|
109
|
+
'Context.a[Steps.loop.iteration.index - 1] + Context.a[Steps.loop.iteration.index - 2]',
|
|
110
|
+
),
|
|
111
|
+
],
|
|
112
|
+
],
|
|
113
|
+
]),
|
|
114
|
+
)
|
|
115
|
+
.setDependentStatements(['Steps.if.false']);
|
|
116
|
+
|
|
117
|
+
start = new Date().getTime();
|
|
118
|
+
let out: EventResult[] = new KIRuntime(
|
|
119
|
+
new FunctionDefinition('Fibonacci')
|
|
120
|
+
.setSteps(
|
|
121
|
+
new Map([
|
|
122
|
+
Statement.ofEntry(createArray),
|
|
123
|
+
Statement.ofEntry(loop),
|
|
124
|
+
Statement.ofEntry(outputGenerate),
|
|
125
|
+
Statement.ofEntry(ifStep),
|
|
126
|
+
Statement.ofEntry(set1),
|
|
127
|
+
Statement.ofEntry(set2),
|
|
128
|
+
]),
|
|
129
|
+
)
|
|
130
|
+
.setNamespace('Test')
|
|
131
|
+
.setEvents(
|
|
132
|
+
new Map([
|
|
133
|
+
Event.outputEventMapEntry(
|
|
134
|
+
new Map([['result', Schema.ofArray('result', Schema.ofInteger('result'))]]),
|
|
135
|
+
),
|
|
136
|
+
]),
|
|
137
|
+
)
|
|
138
|
+
.setParameters(
|
|
139
|
+
new Map([
|
|
140
|
+
[
|
|
141
|
+
'Count',
|
|
142
|
+
new Parameter('Count',Schema.ofInteger('Count')),
|
|
143
|
+
],
|
|
144
|
+
]),
|
|
145
|
+
) as FunctionDefinition,
|
|
146
|
+
new KIRunFunctionRepository(),
|
|
147
|
+
new KIRunSchemaRepository(),
|
|
148
|
+
)
|
|
149
|
+
.execute(new FunctionExecutionParameters().setArguments(new Map([['Count', num]])))
|
|
150
|
+
.allResults();
|
|
151
|
+
console.log('KIRunt Logic : ' + (new Date().getTime() - start));
|
|
152
|
+
expect(out[0].getResult().get('result')).toStrictEqual(array);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test('KIRuntime Test 2', () => {
|
|
156
|
+
var genEvent = new GenerateEvent().getSignature();
|
|
157
|
+
|
|
158
|
+
var expression = { isExpression: true, value: 'Steps.first.output.value' };
|
|
159
|
+
|
|
160
|
+
let resultObj = { name: 'result', value: expression };
|
|
161
|
+
|
|
162
|
+
let out: EventResult[] = new KIRuntime(
|
|
163
|
+
(
|
|
164
|
+
new FunctionDefinition('SingleCall')
|
|
165
|
+
.setNamespace('Test')
|
|
166
|
+
.setParameters(
|
|
167
|
+
new Map([
|
|
168
|
+
[
|
|
169
|
+
'Value',
|
|
170
|
+
new Parameter('Value',Schema.ofInteger('Value')),
|
|
171
|
+
],
|
|
172
|
+
]),
|
|
173
|
+
) as FunctionDefinition
|
|
174
|
+
).setSteps(
|
|
175
|
+
new Map([
|
|
176
|
+
Statement.ofEntry(
|
|
177
|
+
new Statement('first', Namespaces.MATH, 'Absolute')
|
|
178
|
+
.setParameterMap(
|
|
179
|
+
new Map([
|
|
180
|
+
['value', [ParameterReference.ofExpression('Arguments.Value')]],
|
|
181
|
+
]),
|
|
182
|
+
),
|
|
183
|
+
),
|
|
184
|
+
Statement.ofEntry(
|
|
185
|
+
new Statement('second', genEvent.getNamespace(), genEvent.getName())
|
|
186
|
+
.setParameterMap(
|
|
187
|
+
new Map([
|
|
188
|
+
['eventName', [ParameterReference.ofValue('output')]],
|
|
189
|
+
['results', [ParameterReference.ofValue(resultObj)]],
|
|
190
|
+
]),
|
|
191
|
+
),
|
|
192
|
+
),
|
|
193
|
+
]),
|
|
194
|
+
),
|
|
195
|
+
new KIRunFunctionRepository(),
|
|
196
|
+
new KIRunSchemaRepository(),
|
|
197
|
+
)
|
|
198
|
+
.execute(new FunctionExecutionParameters().setArguments(new Map([['Value', -10]])))
|
|
199
|
+
.allResults();
|
|
200
|
+
|
|
201
|
+
expect(out[0].getResult().get('result')).toBe(10);
|
|
202
|
+
});
|
|
203
|
+
test('KIRuntime Test 3', () => {
|
|
204
|
+
var genEvent = new GenerateEvent().getSignature();
|
|
205
|
+
|
|
206
|
+
var expression = { isExpression: true, value: 'Steps.first.output.value' };
|
|
207
|
+
|
|
208
|
+
let resultObj = { name: 'result', value: expression };
|
|
209
|
+
|
|
210
|
+
let out: EventResult[] = new KIRuntime(
|
|
211
|
+
(
|
|
212
|
+
new FunctionDefinition('SingleCall')
|
|
213
|
+
.setNamespace('Test')
|
|
214
|
+
.setParameters(
|
|
215
|
+
new Map([
|
|
216
|
+
[
|
|
217
|
+
'Value',
|
|
218
|
+
new Parameter('Value',Schema.ofInteger('Value')),
|
|
219
|
+
],
|
|
220
|
+
]),
|
|
221
|
+
) as FunctionDefinition
|
|
222
|
+
).setSteps(
|
|
223
|
+
new Map([
|
|
224
|
+
Statement.ofEntry(
|
|
225
|
+
new Statement('first', Namespaces.MATH, 'CubeRoot')
|
|
226
|
+
.setParameterMap(
|
|
227
|
+
new Map([
|
|
228
|
+
['value', [ParameterReference.ofExpression('Arguments.Value')]],
|
|
229
|
+
]),
|
|
230
|
+
),
|
|
231
|
+
),
|
|
232
|
+
Statement.ofEntry(
|
|
233
|
+
new Statement('second', genEvent.getNamespace(), genEvent.getName())
|
|
234
|
+
.setParameterMap(
|
|
235
|
+
new Map([
|
|
236
|
+
['eventName', [ParameterReference.ofValue('output')]],
|
|
237
|
+
['results', [ParameterReference.ofValue(resultObj)]],
|
|
238
|
+
]),
|
|
239
|
+
),
|
|
240
|
+
),
|
|
241
|
+
]),
|
|
242
|
+
),
|
|
243
|
+
new KIRunFunctionRepository(),
|
|
244
|
+
new KIRunSchemaRepository(),
|
|
245
|
+
)
|
|
246
|
+
.execute(new FunctionExecutionParameters().setArguments(new Map([['Value', 27]])))
|
|
247
|
+
.allResults();
|
|
248
|
+
|
|
249
|
+
expect(out[0].getResult().get('result')).toBe(3);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
test('KIRuntime Test 4', () => {
|
|
253
|
+
let start = new Date().getTime();
|
|
254
|
+
const num = 7;
|
|
255
|
+
let array = new Array(num);
|
|
256
|
+
let a = 0,
|
|
257
|
+
b = 1;
|
|
258
|
+
array[0] = a;
|
|
259
|
+
array[1] = b;
|
|
260
|
+
|
|
261
|
+
for (let i = 2; i < num; i++) {
|
|
262
|
+
array[i] = array[i - 2] + array[i - 1];
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
console.log('Normal Logic : ' + (new Date().getTime() - start));
|
|
266
|
+
|
|
267
|
+
var fibFunctionSignature = new FunctionSignature('FibFunction')
|
|
268
|
+
.setNamespace('FibSpace')
|
|
269
|
+
.setParameters(
|
|
270
|
+
new Map([
|
|
271
|
+
[
|
|
272
|
+
'value',
|
|
273
|
+
new Parameter('value',Schema.ofInteger('value')),
|
|
274
|
+
],
|
|
275
|
+
]),
|
|
276
|
+
)
|
|
277
|
+
.setEvents(
|
|
278
|
+
new Map([
|
|
279
|
+
Event.outputEventMapEntry(
|
|
280
|
+
new Map([['value', Schema.ofArray('value', Schema.ofInteger('value'))]]),
|
|
281
|
+
),
|
|
282
|
+
]),
|
|
283
|
+
);
|
|
284
|
+
class FibFunction extends AbstractFunction {
|
|
285
|
+
public getSignature(): FunctionSignature {
|
|
286
|
+
return fibFunctionSignature;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
|
|
290
|
+
let count = context.getArguments()?.get('value');
|
|
291
|
+
let a = new Array(count);
|
|
292
|
+
for (let i = 0; i < count; i++) a[i] = i < 2 ? i : a[i - 1] + a[i - 2];
|
|
293
|
+
return new FunctionOutput([EventResult.outputOf(new Map([['value', a]]))]);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
var fibFunction = new FibFunction();
|
|
298
|
+
|
|
299
|
+
var genEvent = new GenerateEvent().getSignature();
|
|
300
|
+
|
|
301
|
+
var expression = { isExpression: true, value: 'Steps.fib.output.value' };
|
|
302
|
+
let resultObj = { name: 'result', value: expression };
|
|
303
|
+
|
|
304
|
+
var hybrid = new HybridRepository(new KIRunFunctionRepository(), {
|
|
305
|
+
find(namespace, name): Function {
|
|
306
|
+
return fibFunction;
|
|
307
|
+
},
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
start = new Date().getTime();
|
|
311
|
+
let out: EventResult[] = new KIRuntime(
|
|
312
|
+
(
|
|
313
|
+
new FunctionDefinition('CustomFunction')
|
|
314
|
+
.setNamespace('Test')
|
|
315
|
+
.setParameters(
|
|
316
|
+
new Map([
|
|
317
|
+
[
|
|
318
|
+
'Value',
|
|
319
|
+
new Parameter('Value',Schema.ofInteger('Value')),
|
|
320
|
+
],
|
|
321
|
+
]),
|
|
322
|
+
) as FunctionDefinition
|
|
323
|
+
).setSteps(
|
|
324
|
+
new Map([
|
|
325
|
+
Statement.ofEntry(
|
|
326
|
+
new Statement('fib', fibFunctionSignature.getNamespace(), 'asdf')
|
|
327
|
+
.setParameterMap(
|
|
328
|
+
new Map([
|
|
329
|
+
['value', [ParameterReference.ofExpression('Arguments.Value')]],
|
|
330
|
+
]),
|
|
331
|
+
),
|
|
332
|
+
),
|
|
333
|
+
Statement.ofEntry(
|
|
334
|
+
new Statement('fiboutput', genEvent.getNamespace(), genEvent.getName())
|
|
335
|
+
.setParameterMap(
|
|
336
|
+
new Map([
|
|
337
|
+
['eventName', [ParameterReference.ofValue('output')]],
|
|
338
|
+
['results', [ParameterReference.ofValue(resultObj)]],
|
|
339
|
+
]),
|
|
340
|
+
),
|
|
341
|
+
),
|
|
342
|
+
]),
|
|
343
|
+
),
|
|
344
|
+
hybrid,
|
|
345
|
+
new KIRunSchemaRepository(),
|
|
346
|
+
)
|
|
347
|
+
.execute(new FunctionExecutionParameters().setArguments(new Map([['Value', num]])))
|
|
348
|
+
.allResults();
|
|
349
|
+
console.log('KIRun Logic : ' + (new Date().getTime() - start));
|
|
350
|
+
expect(out[0].getResult().get('result')).toStrictEqual(array);
|
|
351
|
+
});
|