@fincity/kirun-js 1.0.1 → 1.0.4
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/BinarySearchTest.ts +51 -42
- package/__tests__/engine/function/system/array/IndexOfTest.ts +1 -1
- package/__tests__/engine/function/system/context/SetFunctionTest.ts +52 -0
- package/__tests__/engine/function/system/string/InsertAtGivenPositionTest.ts +2 -2
- package/__tests__/engine/function/system/string/StringFunctionRepoTest2.ts +10 -0
- package/__tests__/engine/function/system/string/StringFunctionRepoTest3.ts +18 -10
- package/__tests__/engine/function/system/string/StringFunctionRepositoryTest.ts +5 -7
- package/__tests__/engine/runtime/expression/ExpressionTest.ts +6 -0
- package/__tests__/engine/runtime/expression/tokenextractor/OutputMapTokenValueExtractorTest.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +89 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -6
- package/src/engine/function/system/array/AbstractArrayFunction.ts +12 -0
- package/src/engine/function/system/array/BinarySearch.ts +3 -3
- package/src/engine/function/system/context/SetFunction.ts +94 -107
- package/src/engine/function/system/string/AbstractStringFunction.ts +61 -39
- package/src/engine/function/system/string/StringFunctionRepository.ts +2 -2
- package/src/engine/json/schema/validator/StringValidator.ts +1 -1
- package/src/engine/runtime/expression/Expression.ts +6 -8
- package/src/engine/runtime/expression/Operation.ts +26 -4
- package/src/engine/runtime/expression/operators/binary/index.ts +23 -0
- package/src/engine/runtime/expression/operators/unary/index.ts +5 -0
- package/src/engine/util/MapUtil.ts +10 -10
- package/src/engine/util/primitive/PrimitiveUtil.ts +2 -1
- package/src/index.ts +2 -0
- package/dist/module.js +0 -2
- package/dist/module.js.map +0 -1
|
@@ -25,45 +25,67 @@ export abstract class AbstractStringFunction extends AbstractFunction {
|
|
|
25
25
|
|
|
26
26
|
public static readonly EVENT_RESULT_NAME: string = 'result';
|
|
27
27
|
|
|
28
|
-
protected static readonly PARAMETER_STRING: Parameter =new Parameter(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
protected static readonly
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
28
|
+
protected static readonly PARAMETER_STRING: Parameter = new Parameter(
|
|
29
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
30
|
+
Schema.ofString(AbstractStringFunction.PARAMETER_STRING_NAME),
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
protected static readonly PARAMETER_SECOND_STRING: Parameter = new Parameter(
|
|
34
|
+
AbstractStringFunction.PARAMETER_SECOND_STRING_NAME,
|
|
35
|
+
Schema.ofString(AbstractStringFunction.PARAMETER_SECOND_STRING_NAME),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
protected static readonly PARAMETER_THIRD_STRING: Parameter = new Parameter(
|
|
39
|
+
AbstractStringFunction.PARAMETER_THIRD_STRING_NAME,
|
|
40
|
+
Schema.ofString(AbstractStringFunction.PARAMETER_THIRD_STRING_NAME),
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
protected static readonly PARAMETER_INDEX: Parameter = new Parameter(
|
|
44
|
+
AbstractStringFunction.PARAMETER_INDEX_NAME,
|
|
45
|
+
Schema.ofInteger(AbstractStringFunction.PARAMETER_INDEX_NAME),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
protected static readonly PARAMETER_SECOND_INDEX: Parameter = new Parameter(
|
|
49
|
+
AbstractStringFunction.PARAMETER_SECOND_INDEX_NAME,
|
|
50
|
+
Schema.ofInteger(AbstractStringFunction.PARAMETER_SECOND_INDEX_NAME),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
protected static readonly PARAMETER_SEARCH_STRING: Parameter = new Parameter(
|
|
54
|
+
AbstractStringFunction.PARAMETER_SEARCH_STRING_NAME,
|
|
55
|
+
Schema.ofString(AbstractStringFunction.PARAMETER_STRING_NAME),
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
protected static readonly EVENT_STRING: Event = new Event(
|
|
59
|
+
Event.OUTPUT,
|
|
60
|
+
MapUtil.of(
|
|
61
|
+
AbstractStringFunction.EVENT_RESULT_NAME,
|
|
62
|
+
Schema.ofString(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
63
|
+
),
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
protected static readonly EVENT_BOOLEAN: Event = new Event(
|
|
67
|
+
Event.OUTPUT,
|
|
68
|
+
MapUtil.of(
|
|
69
|
+
AbstractStringFunction.EVENT_RESULT_NAME,
|
|
70
|
+
Schema.ofBoolean(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
71
|
+
),
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
protected static readonly EVENT_INT: Event = new Event(
|
|
75
|
+
Event.OUTPUT,
|
|
76
|
+
MapUtil.of(
|
|
77
|
+
AbstractStringFunction.EVENT_RESULT_NAME,
|
|
78
|
+
Schema.ofInteger(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
79
|
+
),
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
protected static readonly EVENT_ARRAY: Event = new Event(
|
|
83
|
+
Event.OUTPUT,
|
|
84
|
+
MapUtil.of(
|
|
85
|
+
AbstractStringFunction.EVENT_RESULT_NAME,
|
|
86
|
+
Schema.ofArray(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
87
|
+
),
|
|
88
|
+
);
|
|
67
89
|
|
|
68
90
|
private signature: FunctionSignature;
|
|
69
91
|
|
|
@@ -9,8 +9,8 @@ export class StringFunctionRepository implements Repository<Function> {
|
|
|
9
9
|
AbstractStringFunction.ofEntryString('Trim', (e) => e.trim()),
|
|
10
10
|
AbstractStringFunction.ofEntryString('LowerCase', (e) => e.toLocaleLowerCase()),
|
|
11
11
|
AbstractStringFunction.ofEntryString('UpperCase', (e) => e.toUpperCase()),
|
|
12
|
-
AbstractStringFunction.ofEntryStringBooleanOutput('
|
|
13
|
-
AbstractStringFunction.ofEntryStringBooleanOutput('
|
|
12
|
+
AbstractStringFunction.ofEntryStringBooleanOutput('IsBlank', (e) => e.trim() === ''),
|
|
13
|
+
AbstractStringFunction.ofEntryStringBooleanOutput('IsEmpty', (e) => e === ''),
|
|
14
14
|
|
|
15
15
|
AbstractStringFunction.ofEntryAsStringBooleanOutput(
|
|
16
16
|
'Contains',
|
|
@@ -18,7 +18,7 @@ export class StringValidator {
|
|
|
18
18
|
if (isNullValue(element))
|
|
19
19
|
throw new SchemaValidationException(
|
|
20
20
|
SchemaValidator.path(parents),
|
|
21
|
-
'Expected a string but found
|
|
21
|
+
'Expected a string but found ' + element,
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
if (typeof element !== 'string')
|
|
@@ -134,7 +134,7 @@ export class Expression extends ExpressionToken {
|
|
|
134
134
|
|
|
135
135
|
for (let size = start; size > 0; size--) {
|
|
136
136
|
let op: string = this.expression.substring(i, i + size);
|
|
137
|
-
if (Operation.
|
|
137
|
+
if (Operation.OPERATORS_WITHOUT_SPACE_WRAP.has(op)) {
|
|
138
138
|
if (!StringUtil.isNullOrBlank(buff)) {
|
|
139
139
|
this.tokens.push(new ExpressionToken(buff));
|
|
140
140
|
isPrevOp = false;
|
|
@@ -236,14 +236,12 @@ export class Expression extends ExpressionToken {
|
|
|
236
236
|
op: Operation | undefined,
|
|
237
237
|
isPrevOp: boolean,
|
|
238
238
|
): void {
|
|
239
|
-
if(!op) return;
|
|
239
|
+
if (!op) return;
|
|
240
240
|
if (isPrevOp || tokens.isEmpty()) {
|
|
241
|
-
if (Operation.UNARY_OPERATORS.has(op)){
|
|
241
|
+
if (Operation.UNARY_OPERATORS.has(op)) {
|
|
242
242
|
const x = Operation.UNARY_MAP.get(op);
|
|
243
|
-
if(x)
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
else
|
|
243
|
+
if (x) ops.push(x);
|
|
244
|
+
} else
|
|
247
245
|
throw new ExpressionEvaluationException(
|
|
248
246
|
this.expression,
|
|
249
247
|
StringFormatter.format('Extra operator $ found.', op),
|
|
@@ -269,7 +267,7 @@ export class Expression extends ExpressionToken {
|
|
|
269
267
|
private hasPrecedence(op1: Operation, op2: Operation): boolean {
|
|
270
268
|
let pre1: number | undefined = Operation.OPERATOR_PRIORITY.get(op1);
|
|
271
269
|
let pre2: number | undefined = Operation.OPERATOR_PRIORITY.get(op2);
|
|
272
|
-
if(!pre1 || !pre2) {
|
|
270
|
+
if (!pre1 || !pre2) {
|
|
273
271
|
throw new Error('Unknown operators provided');
|
|
274
272
|
}
|
|
275
273
|
return pre2 < pre1;
|
|
@@ -6,9 +6,9 @@ export class Operation {
|
|
|
6
6
|
public static readonly ADDITION: Operation = new Operation('+');
|
|
7
7
|
public static readonly SUBTRACTION: Operation = new Operation('-');
|
|
8
8
|
|
|
9
|
-
public static readonly NOT: Operation = new Operation('not');
|
|
10
|
-
public static readonly AND: Operation = new Operation('and');
|
|
11
|
-
public static readonly OR: Operation = new Operation('or');
|
|
9
|
+
public static readonly NOT: Operation = new Operation('not', undefined, true);
|
|
10
|
+
public static readonly AND: Operation = new Operation('and', undefined, true);
|
|
11
|
+
public static readonly OR: Operation = new Operation('or', undefined, true);
|
|
12
12
|
public static readonly LESS_THAN: Operation = new Operation('<');
|
|
13
13
|
public static readonly LESS_THAN_EQUAL: Operation = new Operation('<=');
|
|
14
14
|
public static readonly GREATER_THAN: Operation = new Operation('>');
|
|
@@ -144,6 +144,18 @@ export class Operation {
|
|
|
144
144
|
].map((e) => e.getOperator()),
|
|
145
145
|
);
|
|
146
146
|
|
|
147
|
+
public static readonly OPERATORS_WITHOUT_SPACE_WRAP: Set<string> = new Set(
|
|
148
|
+
[
|
|
149
|
+
...Array.from(Operation.ARITHMETIC_OPERATORS),
|
|
150
|
+
...Array.from(Operation.LOGICAL_OPERATORS),
|
|
151
|
+
...Array.from(Operation.BITWISE_OPERATORS),
|
|
152
|
+
Operation.ARRAY_OPERATOR,
|
|
153
|
+
Operation.OBJECT_OPERATOR,
|
|
154
|
+
]
|
|
155
|
+
.filter((e) => !e.shouldBeWrappedInSpace())
|
|
156
|
+
.map((e) => e.getOperator()),
|
|
157
|
+
);
|
|
158
|
+
|
|
147
159
|
public static readonly OPERATION_VALUE_OF: Map<string, Operation> = new Map(
|
|
148
160
|
Array.from(Operation.VALUE_OF.entries()).map(([_, o]) => [o.getOperator(), o]),
|
|
149
161
|
);
|
|
@@ -167,9 +179,15 @@ export class Operation {
|
|
|
167
179
|
|
|
168
180
|
private operator: string;
|
|
169
181
|
private operatorName: string;
|
|
170
|
-
|
|
182
|
+
private _shouldBeWrappedInSpace: boolean;
|
|
183
|
+
public constructor(
|
|
184
|
+
operator: string,
|
|
185
|
+
operatorName?: string,
|
|
186
|
+
shouldBeWrappedInSpace: boolean = false,
|
|
187
|
+
) {
|
|
171
188
|
this.operator = operator;
|
|
172
189
|
this.operatorName = operatorName ?? operator;
|
|
190
|
+
this._shouldBeWrappedInSpace = shouldBeWrappedInSpace;
|
|
173
191
|
}
|
|
174
192
|
|
|
175
193
|
public getOperator(): string {
|
|
@@ -180,6 +198,10 @@ export class Operation {
|
|
|
180
198
|
return this.operatorName;
|
|
181
199
|
}
|
|
182
200
|
|
|
201
|
+
public shouldBeWrappedInSpace(): boolean {
|
|
202
|
+
return this._shouldBeWrappedInSpace;
|
|
203
|
+
}
|
|
204
|
+
|
|
183
205
|
public valueOf(str: string): Operation | undefined {
|
|
184
206
|
return Operation.VALUE_OF.get(str);
|
|
185
207
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export * from './ArithmeticAdditionOperator';
|
|
2
|
+
export * from './ArithmeticDivisionOperator';
|
|
3
|
+
export * from './ArithmeticInetgerDivisionOperator';
|
|
4
|
+
export * from './ArithmeticModulusOperator';
|
|
5
|
+
export * from './ArithmeticMultiplicationOperator';
|
|
6
|
+
export * from './ArithmeticSubtractionOperator';
|
|
7
|
+
export * from './ArrayOperator';
|
|
8
|
+
export * from './BinaryOperator';
|
|
9
|
+
export * from './BitwiseAndOperator';
|
|
10
|
+
export * from './BitwiseLeftShiftOperator';
|
|
11
|
+
export * from './BitwiseOrOperator';
|
|
12
|
+
export * from './BitwiseRightShiftOperator';
|
|
13
|
+
export * from './BitwiseUnsignedRightShiftOperator';
|
|
14
|
+
export * from './BitwiseXorOperator';
|
|
15
|
+
export * from './LogicalAndOperator';
|
|
16
|
+
export * from './LogicalEqualOperator';
|
|
17
|
+
export * from './LogicalGreaterThanEqualOperator';
|
|
18
|
+
export * from './LogicalGreaterThanOperator';
|
|
19
|
+
export * from './LogicalLessThanEqualOperator';
|
|
20
|
+
export * from './LogicalNotEqualOperator';
|
|
21
|
+
export * from './LogicalLessThanOperator';
|
|
22
|
+
export * from './LogicalOrOperator';
|
|
23
|
+
export * from './ObjectOperator';
|
|
@@ -25,25 +25,25 @@ export class MapUtil {
|
|
|
25
25
|
): Map<K, V> {
|
|
26
26
|
const map: Map<K, V> = new Map();
|
|
27
27
|
|
|
28
|
-
if (k1 && v1) map.set(k1
|
|
28
|
+
if (!isNullValue(k1) && !isNullValue(v1)) map.set(k1!, v1!);
|
|
29
29
|
|
|
30
|
-
if (k2 && v2) map.set(k2
|
|
30
|
+
if (!isNullValue(k2) && !isNullValue(v2)) map.set(k2!, v2!);
|
|
31
31
|
|
|
32
|
-
if (k3 && v3) map.set(k3
|
|
32
|
+
if (!isNullValue(k3) && !isNullValue(v3)) map.set(k3!, v3!);
|
|
33
33
|
|
|
34
|
-
if (k4 && v4) map.set(k4
|
|
34
|
+
if (!isNullValue(k4) && !isNullValue(v4)) map.set(k4!, v4!);
|
|
35
35
|
|
|
36
|
-
if (k5 && v5) map.set(k5
|
|
36
|
+
if (!isNullValue(k5) && !isNullValue(v5)) map.set(k5!, v5!);
|
|
37
37
|
|
|
38
|
-
if (k6 && v6) map.set(k6
|
|
38
|
+
if (!isNullValue(k6) && !isNullValue(v6)) map.set(k6!, v6!);
|
|
39
39
|
|
|
40
|
-
if (k7 && v7) map.set(k7
|
|
40
|
+
if (!isNullValue(k7) && !isNullValue(v7)) map.set(k7!, v7!);
|
|
41
41
|
|
|
42
|
-
if (k8 && v8) map.set(k8
|
|
42
|
+
if (!isNullValue(k8) && !isNullValue(v8)) map.set(k8!, v8!);
|
|
43
43
|
|
|
44
|
-
if (k9 && v9) map.set(k9
|
|
44
|
+
if (!isNullValue(k9) && !isNullValue(v9)) map.set(k9!, v9!);
|
|
45
45
|
|
|
46
|
-
if (k10 && v10) map.set(k10
|
|
46
|
+
if (!isNullValue(k10) && !isNullValue(v10)) map.set(k10!, v10!);
|
|
47
47
|
|
|
48
48
|
return map;
|
|
49
49
|
}
|
|
@@ -83,7 +83,7 @@ export class PrimitiveUtil {
|
|
|
83
83
|
if (isNullValue(a) || isNullValue(b)) return isNullValue(a) ? -1 : 1;
|
|
84
84
|
|
|
85
85
|
if (Array.isArray(a) || Array.isArray(b)) {
|
|
86
|
-
if (Array.isArray(a)
|
|
86
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
87
87
|
if (a.length != b.length) return a.length - b.length;
|
|
88
88
|
for (let i = 0; i < a.length; i++) {
|
|
89
89
|
let cmp: number = this.compare(a[i], b[i]);
|
|
@@ -104,6 +104,7 @@ export class PrimitiveUtil {
|
|
|
104
104
|
if (cmp != 0) return cmp;
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
+
return typofa === 'object' ? -1 : 1;
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
return this.comparePrimitive(a, b);
|
package/src/index.ts
CHANGED
|
@@ -22,3 +22,5 @@ export * from './engine/util/LinkedList';
|
|
|
22
22
|
export * from './engine/util/NullCheck';
|
|
23
23
|
export * from './engine/util/string/StringFormatter';
|
|
24
24
|
export * from './engine/util/string/StringUtil';
|
|
25
|
+
export * from './engine/runtime/expression/operators/binary';
|
|
26
|
+
export * from './engine/runtime/expression/operators/unary';
|
package/dist/module.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function e(e,t,r,s){Object.defineProperty(e,t,{get:r,set:s,enumerable:!0,configurable:!0})}var t={};e(t,"Tuple2",(()=>r)),e(t,"Tuple3",(()=>s)),e(t,"Tuple4",(()=>n));class r{constructor(e,t){this.f=e,this.s=t}getT1(){return this.f}getT2(){return this.s}}class s extends r{constructor(e,t,r){super(e,t),this.t=r}getT3(){return this.t}}class n extends s{constructor(e,t,r,s){super(e,t,r),this.fr=s}getT4(){return this.fr}}e({},"HybridRepository",(()=>i));class i{constructor(...e){this.repos=e}find(e,t){for(let r of this.repos){let s=r.find(e,t);if(s)return s}}}e({},"Schema",(()=>E));e({},"Namespaces",(()=>a));class a{static SYSTEM="System";static SYSTEM_CTX="System.Context";static SYSTEM_LOOP="System.Loop";static SYSTEM_ARRAY="System.Array";static MATH="System.Math";static STRING="System.String";constructor(){}}function o(e){return null==e}e({},"isNullValue",(()=>o));class h{setSingleSchema(e){return this.singleSchema=e,this}setTupleSchema(e){return this.tupleSchema=e,this}getSingleSchema(){return this.singleSchema}getTupleSchema(){return this.tupleSchema}isSingleType(){return!o(this.singleSchema)}static of(...e){return 1==e.length?(new h).setSingleSchema(e[0]):(new h).setTupleSchema(e)}static from(e){if(!e)return;Array.isArray(e)&&h.of(...E.fromListOfSchemas(e));let t=E.from(e);return t?h.of(t):void 0}}class u{getBooleanValue(){return this.booleanValue}getSchemaValue(){return this.schemaValue}setBooleanValue(e){return this.booleanValue=e,this}setSchemaValue(e){return this.schemaValue=e,this}static from(e){if(!e)return;const t=new u;return t.booleanValue=e.booleanValue,t.schemaValue=e.schemaValue,t}}let l;var p;e({},"SchemaType",(()=>l)),(p=l||(l={})).INTEGER="Integer",p.LONG="Long",p.FLOAT="Float",p.DOUBLE="Double",p.STRING="String",p.OBJECT="Object",p.ARRAY="Array",p.BOOLEAN="Boolean",p.NULL="Null";class c{}class m extends c{constructor(e){super(),this.type=e}getType(){return this.type}setType(e){return this.type=e,this}getAllowedSchemaTypes(){return this.type}contains(e){return this.type?.has(e)}}class g extends c{constructor(e){super(),this.type=e}getType(){return this.type}getAllowedSchemaTypes(){return new Set([this.type])}contains(e){return this.type==e}}class f{static of(...e){return 1==e.length?new g(e[0]):new m(new Set(e))}static from(e){return"string"==typeof e?f.of(e):Array.isArray(e)?f.of(...Array.of(e).map((e=>e)).map((e=>e))):void 0}}class E{static NULL=(new E).setNamespace(a.SYSTEM).setName("Null").setType(f.of(l.NULL)).setConstant(void 0);static TYPE_SCHEMA=(new E).setType(f.of(l.STRING)).setEnums(["INTEGER","LONG","FLOAT","DOUBLE","STRING","OBJECT","ARRAY","BOOLEAN","NULL"]);static SCHEMA=(new E).setNamespace(a.SYSTEM).setName("Schema").setType(f.of(l.OBJECT)).setProperties(new Map([["namespace",E.of("namespace",l.STRING).setDefaultValue("_")],["name",E.ofString("name")],["version",E.of("version",l.INTEGER).setDefaultValue(1)],["ref",E.ofString("ref")],["type",(new E).setAnyOf([E.TYPE_SCHEMA,E.ofArray("type",E.TYPE_SCHEMA)])],["anyOf",E.ofArray("anyOf",E.ofRef("#/"))],["allOf",E.ofArray("allOf",E.ofRef("#/"))],["oneOf",E.ofArray("oneOf",E.ofRef("#/"))],["not",E.ofRef("#/")],["title",E.ofString("title")],["description",E.ofString("description")],["id",E.ofString("id")],["examples",E.ofAny("examples")],["defaultValue",E.ofAny("defaultValue")],["comment",E.ofString("comment")],["enums",E.ofArray("enums",E.ofString("enums"))],["constant",E.ofAny("constant")],["pattern",E.ofString("pattern")],["format",E.of("format",l.STRING).setEnums(["DATETIME","TIME","DATE","EMAIL","REGEX"])],["minLength",E.ofInteger("minLength")],["maxLength",E.ofInteger("maxLength")],["multipleOf",E.ofLong("multipleOf")],["minimum",E.ofNumber("minimum")],["maximum",E.ofNumber("maximum")],["exclusiveMinimum",E.ofNumber("exclusiveMinimum")],["exclusiveMaximum",E.ofNumber("exclusiveMaximum")],["properties",E.of("properties",l.OBJECT).setAdditionalProperties((new u).setSchemaValue(E.ofRef("#/")))],["additionalProperties",(new E).setName("additionalProperty").setNamespace(a.SYSTEM).setAnyOf([E.ofBoolean("additionalProperty"),E.ofObject("additionalProperty").setRef("#/")]).setDefaultValue(!0)],["required",E.ofArray("required",E.ofString("required")).setDefaultValue([])],["propertyNames",E.ofRef("#/")],["minProperties",E.ofInteger("minProperties")],["maxProperties",E.ofInteger("maxProperties")],["patternProperties",E.of("patternProperties",l.OBJECT).setAdditionalProperties((new u).setSchemaValue(E.ofRef("#/")))],["items",(new E).setName("items").setAnyOf([E.ofRef("#/").setName("item"),E.ofArray("tuple",E.ofRef("#/"))])],["contains",E.ofRef("#/")],["minItems",E.ofInteger("minItems")],["maxItems",E.ofInteger("maxItems")],["uniqueItems",E.ofBoolean("uniqueItems")],["$defs",E.of("$defs",l.OBJECT).setAdditionalProperties((new u).setSchemaValue(E.ofRef("#/")))],["permission",E.ofString("permission")]])).setRequired([]);static ofString(e){return(new E).setType(f.of(l.STRING)).setName(e)}static ofInteger(e){return(new E).setType(f.of(l.INTEGER)).setName(e)}static ofFloat(e){return(new E).setType(f.of(l.FLOAT)).setName(e)}static ofLong(e){return(new E).setType(f.of(l.LONG)).setName(e)}static ofDouble(e){return(new E).setType(f.of(l.DOUBLE)).setName(e)}static ofAny(e){return(new E).setType(f.of(l.INTEGER,l.LONG,l.FLOAT,l.DOUBLE,l.STRING,l.BOOLEAN,l.ARRAY,l.NULL,l.OBJECT)).setName(e)}static ofAnyNotNull(e){return(new E).setType(f.of(l.INTEGER,l.LONG,l.FLOAT,l.DOUBLE,l.STRING,l.BOOLEAN,l.ARRAY,l.OBJECT)).setName(e)}static ofNumber(e){return(new E).setType(f.of(l.INTEGER,l.LONG,l.FLOAT,l.DOUBLE)).setName(e)}static ofBoolean(e){return(new E).setType(f.of(l.BOOLEAN)).setName(e)}static of(e,...t){return(new E).setType(f.of(...t)).setName(e)}static ofObject(e){return(new E).setType(f.of(l.OBJECT)).setName(e)}static ofRef(e){return(new E).setRef(e)}static ofArray(e,...t){return(new E).setType(f.of(l.ARRAY)).setName(e).setItems(h.of(...t))}static fromListOfSchemas(e){if(o(e)&&!Array.isArray(e))return[];let t=[];for(let r of Array.from(e)){let e=E.from(r);e&&t.push(e)}return t}static fromMapOfSchemas(e){if(o(e))return;const t=new Map;return Object.entries(e).forEach((([e,r])=>{let s=E.from(r);s&&t.set(e,s)})),t}static from(e,t=!1){if(o(e))return;let r=new E;return r.namespace=e.namespace,r.name=e.name,r.version=e.version,r.ref=e.ref,r.type=t?new g(l.STRING):f.from(r.type),r.anyOf=E.fromListOfSchemas(e.anyOf),r.allOf=E.fromListOfSchemas(e.allOf),r.oneOf=E.fromListOfSchemas(e.oneOf),r.not=E.from(e.not),r.description=e.description,r.examples=e.examples?[...e.examples]:void 0,r.defaultValue=e.defaultValue,r.comment=e.comment,r.enums=e.enums?[...e.enums]:void 0,r.constant=e.constant,r.pattern=e.pattern,r.format=e.format,r.minLength=e.minLength,r.maxLength=e.maxLength,r.multipleOf=e.multipleOf,r.minimum=e.minimum,r.maximum=e.maximum,r.exclusiveMinimum=e.exclusiveMinimum,r.exclusiveMaximum=e.exclusiveMaximum,r.properties=E.fromMapOfSchemas(e.properties),r.additionalProperties=u.from(e.additionalProperties),r.required=e.required,r.propertyNames=E.from(e.propertyNames,!0),r.minProperties=e.minProperties,r.maxProperties=e.maxProperties,r.patternProperties=E.fromMapOfSchemas(e.patternProperties),r.items=h.from(e.items),r.contains=E.from(e.contains),r.minItems=e.minItems,r.maxItems=e.maxItems,r.uniqueItems=e.uniqueItems,r.$defs=E.fromMapOfSchemas(e.$defs),r.permission=e.permission,r}namespace="_";version=1;getTitle(){return this.getFullName()}getFullName(){return this.namespace&&"_"!=this.namespace?this.namespace+"."+this.name:this.name}get$defs(){return this.$defs}set$defs(e){return this.$defs=e,this}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getVersion(){return this.version}setVersion(e){return this.version=e,this}getRef(){return this.ref}setRef(e){return this.ref=e,this}getType(){return this.type}setType(e){return this.type=e,this}getAnyOf(){return this.anyOf}setAnyOf(e){return this.anyOf=e,this}getAllOf(){return this.allOf}setAllOf(e){return this.allOf=e,this}getOneOf(){return this.oneOf}setOneOf(e){return this.oneOf=e,this}getNot(){return this.not}setNot(e){return this.not=e,this}getDescription(){return this.description}setDescription(e){return this.description=e,this}getExamples(){return this.examples}setExamples(e){return this.examples=e,this}getDefaultValue(){return this.defaultValue}setDefaultValue(e){return this.defaultValue=e,this}getComment(){return this.comment}setComment(e){return this.comment=e,this}getEnums(){return this.enums}setEnums(e){return this.enums=e,this}getConstant(){return this.constant}setConstant(e){return this.constant=e,this}getPattern(){return this.pattern}setPattern(e){return this.pattern=e,this}getFormat(){return this.format}setFormat(e){return this.format=e,this}getMinLength(){return this.minLength}setMinLength(e){return this.minLength=e,this}getMaxLength(){return this.maxLength}setMaxLength(e){return this.maxLength=e,this}getMultipleOf(){return this.multipleOf}setMultipleOf(e){return this.multipleOf=e,this}getMinimum(){return this.minimum}setMinimum(e){return this.minimum=e,this}getMaximum(){return this.maximum}setMaximum(e){return this.maximum=e,this}getExclusiveMinimum(){return this.exclusiveMinimum}setExclusiveMinimum(e){return this.exclusiveMinimum=e,this}getExclusiveMaximum(){return this.exclusiveMaximum}setExclusiveMaximum(e){return this.exclusiveMaximum=e,this}getProperties(){return this.properties}setProperties(e){return this.properties=e,this}getAdditionalProperties(){return this.additionalProperties}setAdditionalProperties(e){return this.additionalProperties=e,this}getRequired(){return this.required}setRequired(e){return this.required=e,this}getPropertyNames(){return this.propertyNames}setPropertyNames(e){return this.propertyNames=e,this.propertyNames.type=new g(l.STRING),this}getMinProperties(){return this.minProperties}setMinProperties(e){return this.minProperties=e,this}getMaxProperties(){return this.maxProperties}setMaxProperties(e){return this.maxProperties=e,this}getPatternProperties(){return this.patternProperties}setPatternProperties(e){return this.patternProperties=e,this}getItems(){return this.items}setItems(e){return this.items=e,this}getContains(){return this.contains}setContains(e){return this.contains=e,this}getMinItems(){return this.minItems}setMinItems(e){return this.minItems=e,this}getMaxItems(){return this.maxItems}setMaxItems(e){return this.maxItems=e,this}getUniqueItems(){return this.uniqueItems}setUniqueItems(e){return this.uniqueItems=e,this}getPermission(){return this.permission}setPermission(e){return this.permission=e,this}}e({},"SchemaValidator",(()=>M));e({},"StringUtil",(()=>d));e({},"KIRuntimeException",(()=>T));class T extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}e({},"StringFormatter",(()=>A));class A{static format(e,...t){if(!t||0==t.length)return e;let r="",s=0,n="",i=n,a=e.length;for(let o=0;o<a;o++)n=e.charAt(o),"$"==n&&"\\"==i?r=r.substring(0,o-1)+n:"$"==n&&s<t.length?r+=t[s++]:r+=n,i=n;return r.toString()}constructor(){}}class d{constructor(){}static nthIndex(e,t,r=0,s){if(!e)throw new T("String cannot be null");if(r<0||r>=e.length)throw new T(A.format("Cannot search from index : $",r));if(s<=0||s>e.length)throw new T(A.format("Cannot search for occurance : $",s));for(;r<e.length;){if(e.charAt(r)==t&&0==--s)return r;++r}return-1}static splitAtFirstOccurance(e,t){if(!e)return[void 0,void 0];let r=e.indexOf(t);return-1==r?[e,void 0]:[e.substring(0,r),e.substring(r+1)]}static isNullOrBlank(e){return!e||""==e.trim()}}class O extends Error{constructor(e,t,r){super(e.trim()?e+"-"+t:t),this.schemaPath=e,this.cause=r}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}class S extends Error{constructor(e,t,r=[],s){super(t+(r?r.map((e=>e.message)).reduce(((e,t)=>e+"\n"+t),""):"")),this.schemaPath=e,this.cause=s}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}class N{static UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH="Unable to retrive schema from referenced path";static CYCLIC_REFERENCE_LIMIT_COUNTER=20;static getDefaultValue(e,t){if(e)return e.getConstant()?e.getConstant():e.getDefaultValue()?e.getDefaultValue():N.getDefaultValue(N.getSchemaFromRef(e,t,e.getRef()),t)}static getSchemaFromRef(e,t,r,s=0){if(++s==N.CYCLIC_REFERENCE_LIMIT_COUNTER)throw new S(r??"","Schema has a cyclic reference");if(!e||!r||d.isNullOrBlank(r))return;if(!r.startsWith("#")){var n=N.resolveExternalSchema(e,t,r);n&&(e=n.getT1(),r=n.getT2())}let i=r.split("/");return e=N.resolveInternalSchema(e,t,r,s,i,1)}static resolveInternalSchema(e,t,r,s,n,i){let a=e;for(;i<n.length;){if("$defs"===n[i]){if(++i>=n.length||!a.get$defs())throw new O(r,N.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);a=a.get$defs()?.get(n[i])}else{if(a&&(!a.getType()?.contains(l.OBJECT)||!a.getProperties()))throw new O(r,"Cannot retrievie schema from non Object type schemas");a=a.getProperties()?.get(n[i])}if(i++,!a)throw new O(r,N.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);if(!d.isNullOrBlank(a.getRef())&&(a=N.getSchemaFromRef(a,t,a.getRef(),s),!a))throw new O(r,N.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH)}return a}static resolveExternalSchema(e,t,s){if(!t)return;let n=d.splitAtFirstOccurance(e?.getRef()??"","/");if(!n[0])return;let i=d.splitAtFirstOccurance(n[0],".");if(!i[0]||!i[1])return;let a=t.find(i[0],i[1]);if(a){if(!n[1]||""===n[1])return new r(a,s);if(s="#/"+n[1],!a)throw new O(s,N.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);return new r(a,s)}}constructor(){}}class I{static validate(e,t,r,s){let n=[];return t.getOneOf()&&!t.getOneOf()?I.oneOf(e,t,r,s,n):t.getAllOf()&&!t.getAllOf()?I.allOf(e,t,r,s,n):t.getAnyOf()&&!t.getAnyOf()&&I.anyOf(e,t,r,s,n),s}static anyOf(e,t,r,s,n){let i=!1;for(let a of t.getAnyOf()??[])try{I.validate(e,a,r,s),i=!0;break}catch(e){i=!1,n.push(e)}if(!i)throw new S(M.path(e),"The value don't satisfy any of the schemas.",n)}static allOf(e,t,r,s,n){let i=0;for(let a of t.getAllOf()??[])try{I.validate(e,a,r,s),i++}catch(e){n.push(e)}if(i!==t.getAllOf()?.length)throw new S(M.path(e),"The value doesn't satisfy some of the schemas.",n)}static oneOf(e,t,r,s,n){let i=0;for(let a of t.getOneOf()??[])try{I.validate(e,a,r,s),i++}catch(e){n.push(e)}if(1!=i)throw new S(M.path(e),0==i?"The value does not satisfy any schema":"The value satisfy more than one schema",n)}constructor(){}}class R{static validate(e,t,r,s){if(o(s))throw new S(M.path(e),"Expected an array but found null");if(!Array.isArray(s))throw new S(M.path(e),s.toString()+" is not an Array");let n=s;return R.checkMinMaxItems(e,t,n),R.checkItems(e,t,r,n),R.checkUniqueItems(e,t,n),R.checkContains(e,t,r,n),s}static checkContains(e,t,r,s){if(!t.getContains())return;let n=!1;for(let i=0;i<s.length;i++){let a=e?[...e]:[];try{M.validate(a,t.getContains(),r,s[i]),n=!0;break}catch(e){n=!1}}if(!n)throw new S(M.path(e),"None of the items are of type contains schema")}static checkUniqueItems(e,t,r){if(t.getUniqueItems()&&t.getUniqueItems()){if(new Set(r).size!==r.length)throw new S(M.path(e),"Items on the array are not unique")}}static checkMinMaxItems(e,t,r){if(t.getMinItems()&&t.getMinItems()>r.length)throw new S(M.path(e),"Array should have minimum of "+t.getMinItems()+" elements");if(t.getMaxItems()&&t.getMaxItems()<r.length)throw new S(M.path(e),"Array can have maximum of "+t.getMaxItems()+" elements")}static checkItems(e,t,r,s){if(!t.getItems())return;let n=t.getItems();if(n.getSingleSchema())for(let t=0;t<s.length;t++){let i=e?[...e]:[],a=M.validate(i,n.getSingleSchema(),r,s[t]);s[t]=a}if(n.getTupleSchema()){if(n.getTupleSchema().length!==s.length)throw new S(M.path(e),"Expected an array with only "+n.getTupleSchema().length+" but found "+s.length);for(let t=0;t<s.length;t++){let i=e?[...e]:[],a=M.validate(i,n.getTupleSchema()[t],r,s[t]);s[t]=a}}}constructor(){}}class w{static validate(e,t,r,s){if(o(s))throw new S(M.path(t),"Expected a number but found null");if("number"!=typeof s)throw new S(M.path(t),s.toString()+" is not a "+e);let n=w.extractNumber(e,t,r,s);return w.checkRange(t,r,s,n),w.checkMultipleOf(t,r,s,n),s}static extractNumber(e,t,r,s){let n=s;try{e!=l.LONG&&e!=l.INTEGER||(n=Math.round(n))}catch(r){throw new S(M.path(t),s+" is not a number of type "+e,r)}if(o(n)||(e==l.LONG||e==l.INTEGER)&&n!=s)throw new S(M.path(t),s.toString()+" is not a number of type "+e);return n}static checkMultipleOf(e,t,r,s){if(t.getMultipleOf()){if(s%t.getMultipleOf()!=0)throw new S(M.path(e),r.toString()+" is not multiple of "+t.getMultipleOf())}}static checkRange(e,t,r,s){if(t.getMinimum()&&w.numberCompare(s,t.getMinimum())<0)throw new S(M.path(e),r.toString()+" should be greater than or equal to "+t.getMinimum());if(t.getMaximum()&&w.numberCompare(s,t.getMaximum())>0)throw new S(M.path(e),r.toString()+" should be less than or equal to "+t.getMaximum());if(t.getExclusiveMinimum()&&w.numberCompare(s,t.getExclusiveMinimum())<=0)throw new S(M.path(e),r.toString()+" should be greater than "+t.getExclusiveMinimum());if(t.getExclusiveMaximum()&&w.numberCompare(s,t.getExclusiveMaximum())>0)throw new S(M.path(e),r.toString()+" should be less than "+t.getExclusiveMaximum())}static numberCompare(e,t){return e-t}constructor(){}}class y{static validate(e,t,r,s){if(o(s))throw new S(M.path(e),"Expected an object but found null");if("object"!=typeof s||Array.isArray(s))throw new S(M.path(e),s.toString()+" is not an Object");let n=s,i=new Set(Object.keys(n));y.checkMinMaxProperties(e,t,i),t.getPropertyNames()&&y.checkPropertyNameSchema(e,t,r,i),t.getRequired()&&y.checkRequired(e,t,n),t.getProperties()&&y.checkProperties(e,t,r,n,i),t.getPatternProperties()&&y.checkPatternProperties(e,t,r,n,i),t.getAdditionalProperties()&&y.checkAddtionalProperties(e,t,r,n,i)}static checkPropertyNameSchema(e,t,r,s){for(let n of Array.from(s.values()))try{M.validate(e,t.getPropertyNames(),r,n)}catch(t){throw new S(M.path(e),"Property name '"+n+"' does not fit the property schema")}}static checkRequired(e,t,r){for(const s of t.getRequired()??[])if(o(r[s]))throw new S(M.path(e),s+" is mandatory")}static checkAddtionalProperties(e,t,r,s,n){let i=t.getAdditionalProperties();if(i.getSchemaValue())for(let t of Array.from(n.values())){let n=e?[...e]:[],a=M.validate(n,i.getSchemaValue(),r,s.get(t));s[t]=a}else if(!1===i.getBooleanValue()&&n.size)throw new S(M.path(e),n.toString()+" are additional properties which are not allowed.")}static checkPatternProperties(e,t,r,s,n){const i=new Map;for(const e of Array.from(t.getPatternProperties().keys()))i.set(e,new RegExp(e));for(const a of Array.from(n.values())){const o=e?[...e]:[];for(const e of Array.from(i.entries()))if(e[1].test(a)){const i=M.validate(o,t.getPatternProperties().get(e[0]),r,s[a]);s[a]=i,n.delete(a);break}}}static checkProperties(e,t,r,s,n){for(const i of Array.from(t.getProperties())){let t=s[i[0]];if(o(t))continue;let a=e?[...e]:[],h=M.validate(a,i[1],r,t);s[i[0]]=h,n.delete(i[0])}}static checkMinMaxProperties(e,t,r){if(t.getMinProperties()&&r.size<t.getMinProperties())throw new S(M.path(e),"Object should have minimum of "+t.getMinProperties()+" properties");if(t.getMaxProperties()&&r.size>t.getMaxProperties())throw new S(M.path(e),"Object can have maximum of "+t.getMaxProperties()+" properties")}constructor(){}}let x;var _;(_=x||(x={})).DATETIME="DATETIME",_.TIME="TIME",_.DATE="DATE",_.EMAIL="EMAIL",_.REGEX="REGEX";class P{static TIME=/^([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?([+-][01][0-9]:[0-5][0-9])?$/;static DATE=/^[0-9]{4,4}-([0][0-9]|[1][0-2])-(0[1-9]|[1-2][1-9]|3[01])$/;static DATETIME=/^[0-9]{4,4}-([0][0-9]|[1][0-2])-(0[1-9]|[1-2][1-9]|3[01])T([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?([+-][01][0-9]:[0-5][0-9])?$/;static validate(e,t,r){if(o(r))throw new S(M.path(e),"Expected a string but found null");if("string"!=typeof r)throw new S(M.path(e),r.toString()+" is not String");t.getFormat()==x.TIME?P.patternMatcher(e,t,r,P.TIME,"time pattern"):t.getFormat()==x.DATE?P.patternMatcher(e,t,r,P.DATE,"date pattern"):t.getFormat()==x.DATETIME?P.patternMatcher(e,t,r,P.DATETIME,"date time pattern"):t.getPattern()&&P.patternMatcher(e,t,r,new RegExp(t.getPattern()),"pattern "+t.getPattern());let s=r.length;if(t.getMinLength()&&s<t.getMinLength())throw new S(M.path(e),"Expected a minimum of "+t.getMinLength()+" characters");if(t.getMaxLength()&&s>t.getMinLength())throw new S(M.path(e),"Expected a maximum of "+t.getMaxLength()+" characters");return r}static patternMatcher(e,t,r,s,n){if(!s.test(r))throw new S(M.path(e),r.toString()+" is not matched with the "+n)}constructor(){}}class v{static validate(e,t,r,s,n){if(t==l.STRING)P.validate(e,r,n);else if(t==l.LONG||t==l.INTEGER||t==l.DOUBLE||t==l.FLOAT)w.validate(t,e,r,n);else if(t==l.BOOLEAN)(class{static validate(e,t,r){if(o(r))throw new S(M.path(e),"Expected a boolean but found null");if("boolean"!=typeof r)throw new S(M.path(e),r.toString()+" is not a boolean");return r}constructor(){}}).validate(e,r,n);else if(t==l.OBJECT)y.validate(e,r,s,n);else if(t==l.ARRAY)R.validate(e,r,s,n);else{if(t!=l.NULL)throw new S(M.path(e),t+" is not a valid type.");(class{static validate(e,t,r){if(r)throw new S(M.path(e),"Expected a null but found "+r);return r}constructor(){}}).validate(e,r,n)}return n}constructor(){}}class M{static path(e){return e?e.map((e=>e.getTitle()??"")).filter((e=>!!e)).reduce(((e,t,r)=>e+(0===r?"":".")+t),""):""}static validate(e,t,r,s){if(!t)return s;if(e||(e=new Array),e.push(t),o(s)&&!o(t.getDefaultValue()))return JSON.parse(JSON.stringify(t.getDefaultValue()));if(t.getConstant())return M.constantValidation(e,t,s);if(t.getEnums()&&!t.getEnums()?.length)return M.enumCheck(e,t,s);if(t.getType()&&M.typeValidation(e,t,r,s),!d.isNullOrBlank(t.getRef()))return M.validate(e,N.getSchemaFromRef(e[0],r,t.getRef()),r,s);if((t.getOneOf()||t.getAllOf()||t.getAnyOf())&&I.validate(e,t,r,s),t.getNot()){let n=!1;try{M.validate(e,t.getNot(),r,s),n=!0}catch(e){n=!1}if(n)throw new S(M.path(e),"Schema validated value in not condition.")}return s}static constantValidation(e,t,r){if(!t.getConstant().equals(r))throw new S(M.path(e),"Expecting a constant value : "+r);return r}static enumCheck(e,t,r){let s=!1;for(let e of t.getEnums()??[])if(e===r){s=!0;break}if(s)return r;throw new S(M.path(e),"Value is not one of "+t.getEnums())}static typeValidation(e,t,r,s){let n=!1,i=[];for(const a of Array.from(t.getType()?.getAllowedSchemaTypes()?.values()??[]))try{v.validate(e,a,t,r,s),n=!0;break}catch(e){n=!1,i.push(e)}if(!n)throw new S(M.path(e),"Value "+JSON.stringify(s)+" is not of valid type(s)",i)}constructor(){}}e({},"KIRunConstants",(()=>L));class L{static NAMESPACE="namespace";static NAME="name";static ID="id";constructor(){}}e({},"ExecutionException",(()=>U));class U extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}e({},"AbstractFunction",(()=>C));class C{validateArguments(e){return Array.from(this.getSignature().getParameters().entries()).map((t=>{let s,n=t[0],i=t[1],a=e.get(t[0]);if(o(a))return new r(n,M.validate(void 0,i.getSchema(),void 0,void 0));if(!i?.isVariableArgument())return new r(n,M.validate(void 0,i.getSchema(),void 0,a));Array.isArray(a)?s=a:(s=[],s.push(a));for(const e of s)M.validate(void 0,i.getSchema(),void 0,e);return new r(n,a)})).reduce(((e,t)=>(e.set(t.getT1(),t.getT2()),e)),new Map)}execute(e){return e.setArguments(this.validateArguments(e.getArguments()??new Map)),this.internalExecute(e)}getProbableEventSignature(e){return this.getSignature().getEvents()}}e({},"KIRuntime",(()=>Fe));class V{constructor(e){this.expression=e}getExpression(){return this.expression}}class B{static OUTPUT="output";static ERROR="error";static ITERATION="iteration";static TRUE="true";static FALSE="false";static SCHEMA_NAME="Event";static SCHEMA=(new E).setNamespace(a.SYSTEM).setName(B.SCHEMA_NAME).setType(f.of(l.OBJECT)).setProperties(new Map([["name",E.ofString("name")],["parameters",E.ofObject("parameter").setAdditionalProperties((new u).setSchemaValue(E.SCHEMA))]]));constructor(e,t){this.name=e,this.parameters=t}getName(){return this.name}setName(e){return this.name=e,this}getParameters(){return this.parameters}setParameters(e){return this.parameters=e,this}static outputEventMapEntry(e){return B.eventMapEntry(B.OUTPUT,e)}static eventMapEntry(e,t){return[e,new B(e,t)]}}class b{constructor(e,t){this.name=e,this.result=t}getName(){return this.name}setName(e){return this.name=e,this}getResult(){return this.result}setResult(e){return this.result=e,this}static outputOf(e){return b.of(B.OUTPUT,e)}static of(e,t){return new b(e,t)}}class D{index=0;constructor(e){if(o(e))throw new T("Function output is generating null");Array.isArray(e)&&e.length&&e[0]instanceof b?this.fo=e:(this.fo=[],this.generator=e)}next(){if(!this.generator)return this.index<this.fo.length?this.fo[this.index++]:void 0;const e=this.generator.next();return e&&this.fo.push(e),e}allResults(){return this.fo}}let k;var G;(G=k||(k={})).CONSTANT="CONSTANT",G.EXPRESSION="EXPRESSION";class F{static SCHEMA_NAME="Parameter";static SCHEMA=(new E).setNamespace(a.SYSTEM).setName(F.SCHEMA_NAME).setProperties(new Map([["schema",E.SCHEMA],["parameterName",E.ofString("parameterName")],["variableArgument",E.of("variableArgument",l.BOOLEAN).setDefaultValue(!1)]]));static EXPRESSION=(new E).setNamespace(a.SYSTEM).setName("ParameterExpression").setType(f.of(l.OBJECT)).setProperties(new Map([["isExpression",E.ofBoolean("isExpression").setDefaultValue(!0)],["value",E.ofAny("value")]]));variableArgument=!1;type=k.EXPRESSION;constructor(e,t){this.schema=t,this.parameterName=e}getSchema(){return this.schema}setSchema(e){return this.schema=e,this}getParameterName(){return this.parameterName}setParameterName(e){return this.parameterName=e,this}isVariableArgument(){return this.variableArgument}setVariableArgument(e){return this.variableArgument=e,this}getType(){return this.type}setType(e){return this.type=e,this}static ofEntry(e,t,r=!1,s=k.EXPRESSION){return[e,new F(e,t).setType(s).setVariableArgument(r)]}static of(e,t,r=!1,s=k.EXPRESSION){return new F(e,t).setType(s).setVariableArgument(r)}}let $;var Y;(Y=$||($={})).VALUE="VALUE",Y.EXPRESSION="EXPRESSION";e({},"LinkedList",(()=>H));class H{head=void 0;tail=void 0;length=0;constructor(e){if(e?.length){for(const t of e)if(this.head){const e=new W(t,this.tail);this.tail.next=e,this.tail=e}else this.tail=this.head=new W(t);this.length=e.length}}push(e){const t=new W(e,void 0,this.head);this.head?(this.head.previous=t,this.head=t):this.tail=this.head=t,this.length++}pop(){if(!this.head)throw Error("List is empty and cannot pop further.");const e=this.head.value;if(this.length--,this.head==this.tail)return this.head=this.tail=void 0,e;const t=this.head;return this.head=t.next,t.next=void 0,t.previous=void 0,this.head.previous=void 0,e}isEmpty(){return!this.length}size(){return this.length}get(e){if(e<0||e>=this.length)throw new Error(`${e} is out of bounds [0,${this.length}]`);let t=this.head;for(;e>0;)t=this.head.next,--e;return t.value}set(e,t){if(e<0||e>=this.length)throw new T(A.format("Index $ out of bound to set the value in linked list.",e));let r=this.head;for(;e>0;)r=this.head.next,--e;return r.value=t,this}toString(){let e=this.head,t="";for(;e;)t+=e.value,e=e.next,e&&(t+=", ");return`[${t}]`}toArray(){let e=[],t=this.head;for(;t;)e.push(t.value),t=t.next;return e}peek(){if(!this.head)throw new Error("List is empty so cannot peak");return this.head.value}peekLast(){if(!this.tail)throw new Error("List is empty so cannot peak");return this.tail.value}getFirst(){if(!this.head)throw new Error("List is empty so cannot get first");return this.head.value}removeFirst(){return this.pop()}removeLast(){if(!this.tail)throw new Error("List is empty so cannot remove");--this.length;const e=this.tail.value;if(0==this.length)this.head=this.tail=void 0;else{const e=this.tail.previous;e.next=void 0,this.tail.previous=void 0,this.tail=e}return e}addAll(e){return e&&e.length?(e.forEach(this.add.bind(this)),this):this}add(e){return++this.length,this.tail||this.head?this.head===this.tail?(this.tail=new W(e,this.head),this.head.next=this.tail):(this.tail=new W(e,this.tail),this.tail.previous.next=this.tail):this.head=this.tail=new W(e),this}map(e,t){let r=new H,s=this.head,n=0;for(;s;)r.add(e(s.value,n)),s=s.next,++n;return r}forEach(e,t){let r=this.head,s=0;for(;r;)e(r.value,s),r=r.next,++s}}class W{constructor(e,t,r){this.value=e,this.next=r,this.previous=t}toString(){return""+this.value}}e({},"ExpressionEvaluator",(()=>ve));class j{constructor(e){this.str=e??""}append(e){return this.str+=e,this}toString(){return""+this.str}trim(){return this.str=this.str.trim(),this}setLength(e){return this.str=this.str.substring(0,e),this}length(){return this.str.length}charAt(e){return this.str.charAt(e)}deleteCharAt(e){return this.checkIndex(e),this.str=this.str.substring(0,e)+this.str.substring(e+1),this}insert(e,t){return this.str=this.str.substring(0,e)+t+this.str.substring(e),this}checkIndex(e){if(e>=this.str.length)throw new T(`Index ${e} is greater than or equal to ${this.str.length}`)}substring(e,t){return this.str.substring(e,t)}}e({},"ExpressionEvaluationException",(()=>q));class q extends Error{constructor(e,t,r){super(A.format("$ : $",e,t)),this.cause=r}getCause(){return this.cause}}e({},"Expression",(()=>J));e({},"ExpressionToken",(()=>X));class X{constructor(e){this.expression=e}getExpression(){return this.expression}toString(){return this.expression}}e({},"Operation",(()=>Q));class Q{static MULTIPLICATION=new Q("*");static DIVISION=new Q("/");static INTEGER_DIVISION=new Q("//");static MOD=new Q("%");static ADDITION=new Q("+");static SUBTRACTION=new Q("-");static NOT=new Q("not");static AND=new Q("and");static OR=new Q("or");static LESS_THAN=new Q("<");static LESS_THAN_EQUAL=new Q("<=");static GREATER_THAN=new Q(">");static GREATER_THAN_EQUAL=new Q(">=");static EQUAL=new Q("=");static NOT_EQUAL=new Q("!=");static BITWISE_AND=new Q("&");static BITWISE_OR=new Q("|");static BITWISE_XOR=new Q("^");static BITWISE_COMPLEMENT=new Q("~");static BITWISE_LEFT_SHIFT=new Q("<<");static BITWISE_RIGHT_SHIFT=new Q(">>");static BITWISE_UNSIGNED_RIGHT_SHIFT=new Q(">>>");static UNARY_PLUS=new Q("UN: +","+");static UNARY_MINUS=new Q("UN: -","-");static UNARY_LOGICAL_NOT=new Q("UN: not","not");static UNARY_BITWISE_COMPLEMENT=new Q("UN: ~","~");static ARRAY_OPERATOR=new Q("[");static OBJECT_OPERATOR=new Q(".");static VALUE_OF=new Map([["MULTIPLICATION",Q.MULTIPLICATION],["DIVISION",Q.DIVISION],["INTEGER_DIVISON",Q.INTEGER_DIVISION],["MOD",Q.MOD],["ADDITION",Q.ADDITION],["SUBTRACTION",Q.SUBTRACTION],["NOT",Q.NOT],["AND",Q.AND],["OR",Q.OR],["LESS_THAN",Q.LESS_THAN],["LESS_THAN_EQUAL",Q.LESS_THAN_EQUAL],["GREATER_THAN",Q.GREATER_THAN],["GREATER_THAN_EQUAL",Q.GREATER_THAN_EQUAL],["EQUAL",Q.EQUAL],["NOT_EQUAL",Q.NOT_EQUAL],["BITWISE_AND",Q.BITWISE_AND],["BITWISE_OR",Q.BITWISE_OR],["BITWISE_XOR",Q.BITWISE_XOR],["BITWISE_COMPLEMENT",Q.BITWISE_COMPLEMENT],["BITWISE_LEFT_SHIFT",Q.BITWISE_LEFT_SHIFT],["BITWISE_RIGHT_SHIFT",Q.BITWISE_RIGHT_SHIFT],["BITWISE_UNSIGNED_RIGHT_SHIFT",Q.BITWISE_UNSIGNED_RIGHT_SHIFT],["UNARY_PLUS",Q.UNARY_PLUS],["UNARY_MINUS",Q.UNARY_MINUS],["UNARY_LOGICAL_NOT",Q.UNARY_LOGICAL_NOT],["UNARY_BITWISE_COMPLEMENT",Q.UNARY_BITWISE_COMPLEMENT],["ARRAY_OPERATOR",Q.ARRAY_OPERATOR],["OBJECT_OPERATOR",Q.OBJECT_OPERATOR]]);static UNARY_OPERATORS=new Set([Q.ADDITION,Q.SUBTRACTION,Q.NOT,Q.BITWISE_COMPLEMENT,Q.UNARY_PLUS,Q.UNARY_MINUS,Q.UNARY_LOGICAL_NOT,Q.UNARY_BITWISE_COMPLEMENT]);static ARITHMETIC_OPERATORS=new Set([Q.MULTIPLICATION,Q.DIVISION,Q.INTEGER_DIVISION,Q.MOD,Q.ADDITION,Q.SUBTRACTION]);static LOGICAL_OPERATORS=new Set([Q.NOT,Q.AND,Q.OR,Q.LESS_THAN,Q.LESS_THAN_EQUAL,Q.GREATER_THAN,Q.GREATER_THAN_EQUAL,Q.EQUAL,Q.NOT_EQUAL]);static BITWISE_OPERATORS=new Set([Q.BITWISE_AND,Q.BITWISE_COMPLEMENT,Q.BITWISE_LEFT_SHIFT,Q.BITWISE_OR,Q.BITWISE_RIGHT_SHIFT,Q.BITWISE_UNSIGNED_RIGHT_SHIFT,Q.BITWISE_XOR]);static OPERATOR_PRIORITY=new Map([[Q.UNARY_PLUS,1],[Q.UNARY_MINUS,1],[Q.UNARY_LOGICAL_NOT,1],[Q.UNARY_BITWISE_COMPLEMENT,1],[Q.ARRAY_OPERATOR,1],[Q.OBJECT_OPERATOR,1],[Q.MULTIPLICATION,2],[Q.DIVISION,2],[Q.INTEGER_DIVISION,2],[Q.MOD,2],[Q.ADDITION,3],[Q.SUBTRACTION,3],[Q.BITWISE_LEFT_SHIFT,4],[Q.BITWISE_RIGHT_SHIFT,4],[Q.BITWISE_UNSIGNED_RIGHT_SHIFT,4],[Q.LESS_THAN,5],[Q.LESS_THAN_EQUAL,5],[Q.GREATER_THAN,5],[Q.GREATER_THAN_EQUAL,5],[Q.EQUAL,6],[Q.NOT_EQUAL,6],[Q.BITWISE_AND,7],[Q.BITWISE_XOR,8],[Q.BITWISE_OR,9],[Q.AND,10],[Q.OR,11]]);static OPERATORS=new Set([...Array.from(Q.ARITHMETIC_OPERATORS),...Array.from(Q.LOGICAL_OPERATORS),...Array.from(Q.BITWISE_OPERATORS),Q.ARRAY_OPERATOR,Q.OBJECT_OPERATOR].map((e=>e.getOperator())));static OPERATION_VALUE_OF=new Map(Array.from(Q.VALUE_OF.entries()).map((([e,t])=>[t.getOperator(),t])));static UNARY_MAP=new Map([[Q.ADDITION,Q.UNARY_PLUS],[Q.SUBTRACTION,Q.UNARY_MINUS],[Q.NOT,Q.UNARY_LOGICAL_NOT],[Q.BITWISE_COMPLEMENT,Q.UNARY_BITWISE_COMPLEMENT],[Q.UNARY_PLUS,Q.UNARY_PLUS],[Q.UNARY_MINUS,Q.UNARY_MINUS],[Q.UNARY_LOGICAL_NOT,Q.UNARY_LOGICAL_NOT],[Q.UNARY_BITWISE_COMPLEMENT,Q.UNARY_BITWISE_COMPLEMENT]]);static BIGGEST_OPERATOR_SIZE=Array.from(Q.VALUE_OF.values()).map((e=>e.getOperator())).filter((e=>!e.startsWith("UN: "))).map((e=>e.length)).reduce(((e,t)=>e>t?e:t),0);constructor(e,t){this.operator=e,this.operatorName=t??e}getOperator(){return this.operator}getOperatorName(){return this.operatorName}valueOf(e){return Q.VALUE_OF.get(e)}toString(){return this.operator}}class J extends X{tokens=new H;ops=new H;constructor(e,t,r,s){super(e||""),t&&this.tokens.push(t),r&&this.tokens.push(r),s&&this.ops.push(s),this.evaluate()}getTokens(){return this.tokens}getOperations(){return this.ops}evaluate(){const e=this.expression.length;let t,r="",s=new j(""),n=0,i=!1;for(;n<e;){switch(r=this.expression[n],t=s.toString(),r){case" ":i=this.processTokenSepearator(s,t,i);break;case"(":n=this.processSubExpression(e,s,t,n,i),i=!1;break;case")":throw new q(this.expression,"Extra closing parenthesis found");case"]":throw new q(this.expression,"Extra closing square bracket found");default:let a=this.processOthers(r,e,s,t,n,i);n=a.getT1(),i=a.getT2(),i&&this.ops.peek()==Q.ARRAY_OPERATOR&&(a=this.process(e,s,n),n=a.getT1(),i=a.getT2())}++n}if(t=s.toString(),!d.isNullOrBlank(t)){if(Q.OPERATORS.has(t))throw new q(this.expression,"Expression is ending with an operator");this.tokens.push(new X(t))}}process(e,t,s){let n=1;for(++s;s<e&&0!=n;){let e=this.expression.charAt(s);"]"==e?--n:"["==e&&++n,0!=n&&(t.append(e),s++)}return this.tokens.push(new J(t.toString())),t.setLength(0),new r(s,!1)}processOthers(e,t,s,n,i,a){let o=t-i;o=o<Q.BIGGEST_OPERATOR_SIZE?o:Q.BIGGEST_OPERATOR_SIZE;for(let e=o;e>0;e--){let t=this.expression.substring(i,i+e);if(Q.OPERATORS.has(t))return d.isNullOrBlank(n)||(this.tokens.push(new X(n)),a=!1),this.checkUnaryOperator(this.tokens,this.ops,Q.OPERATION_VALUE_OF.get(t),a),a=!0,s.setLength(0),new r(i+e-1,a)}return s.append(e),new r(i,!1)}processSubExpression(e,t,r,s,n){if(Q.OPERATORS.has(r))this.checkUnaryOperator(this.tokens,this.ops,Q.OPERATION_VALUE_OF.get(r),n),t.setLength(0);else if(!d.isNullOrBlank(r))throw new q(this.expression,A.format("Unkown token : $ found.",r));let i=1;const a=new j;let o=this.expression.charAt(s);for(s++;s<e&&i>0;)o=this.expression.charAt(s),"("==o?i++:")"==o&&i--,0!=i&&(a.append(o),s++);if(")"!=o)throw new q(this.expression,"Missing a closed parenthesis");for(;a.length()>2&&"("==a.charAt(0)&&")"==a.charAt(a.length()-1);)a.deleteCharAt(0),a.setLength(a.length()-1);return this.tokens.push(new J(a.toString().trim())),s}processTokenSepearator(e,t,r){return d.isNullOrBlank(t)||(Q.OPERATORS.has(t)?(this.checkUnaryOperator(this.tokens,this.ops,Q.OPERATION_VALUE_OF.get(t),r),r=!0):(this.tokens.push(new X(t)),r=!1)),e.setLength(0),r}checkUnaryOperator(e,t,r,s){if(r)if(s||e.isEmpty()){if(!Q.UNARY_OPERATORS.has(r))throw new q(this.expression,A.format("Extra operator $ found.",r));{const e=Q.UNARY_MAP.get(r);e&&t.push(e)}}else{for(;!t.isEmpty()&&this.hasPrecedence(r,t.peek());){let r=t.pop();if(Q.UNARY_OPERATORS.has(r)){let t=e.pop();e.push(new J("",t,void 0,r))}else{let t=e.pop(),s=e.pop();e.push(new J("",s,t,r))}}t.push(r)}}hasPrecedence(e,t){let r=Q.OPERATOR_PRIORITY.get(e),s=Q.OPERATOR_PRIORITY.get(t);if(!r||!s)throw new Error("Unknown operators provided");return s<r}toString(){if(this.ops.isEmpty())return 1==this.tokens.size()?this.tokens.get(0).toString():"Error: No tokens";let e=new j,t=0;const r=this.ops.toArray(),s=this.tokens.toArray();for(let n=0;n<r.length;n++)if(r[n].getOperator().startsWith("UN: "))e.append("(").append(r[n].getOperator().substring(4)).append(s[t]instanceof J?s[t].toString():s[t]).append(")"),t++;else{if(0==t){const r=s[t++];e.insert(0,r.toString())}const i=s[t++];e.insert(0,r[n].getOperator()).insert(0,i.toString()).insert(0,"(").append(")")}return e.toString()}equals(e){return this.expression==e.expression}}e({},"ExpressionTokenValue",(()=>K));class K extends X{constructor(e,t){super(e),this.element=t}getTokenValue(){return this.element}getElement(){return this.element}toString(){return A.format("$: $",this.expression,this.element)}}class z{nullCheck(e,t,r){if(o(e)||o(t))throw new U(A.format("$ cannot be applied to a null value",r.getOperatorName()))}}class Z extends z{apply(e,t){return this.nullCheck(e,t,Q.ADDITION),e+t}}class ee extends z{apply(e,t){return this.nullCheck(e,t,Q.DIVISION),e/t}}class te extends z{apply(e,t){return this.nullCheck(e,t,Q.DIVISION),Math.floor(e/t)}}class re extends z{apply(e,t){return this.nullCheck(e,t,Q.MOD),e%t}}class se extends z{apply(e,t){return this.nullCheck(e,t,Q.MULTIPLICATION),e*t}}class ne extends z{apply(e,t){return this.nullCheck(e,t,Q.SUBTRACTION),e-t}}class ie extends z{apply(e,t){if(!e)throw new U("Cannot apply array operator on a null value");if(!t)throw new U("Cannot retrive null index value");if(!Array.isArray(e)&&"string"!=typeof e)throw new U(A.format("Cannot retrieve value from a primitive value $",e));if(t>=e.length)throw new U(A.format("Cannot retrieve index $ from the array of length $",t,e.length));return e[t]}}class ae extends z{apply(e,t){return this.nullCheck(e,t,Q.BITWISE_AND),e&t}}class oe extends z{apply(e,t){return this.nullCheck(e,t,Q.BITWISE_LEFT_SHIFT),e<<t}}class he extends z{apply(e,t){return this.nullCheck(e,t,Q.BITWISE_OR),e|t}}class ue extends z{apply(e,t){return this.nullCheck(e,t,Q.BITWISE_RIGHT_SHIFT),e>>t}}class le extends z{apply(e,t){return this.nullCheck(e,t,Q.BITWISE_UNSIGNED_RIGHT_SHIFT),e>>>t}}class pe extends z{apply(e,t){return this.nullCheck(e,t,Q.BITWISE_XOR),e^t}}class ce{static findPrimitiveNullAsBoolean(e){if(!e)return new r(l.BOOLEAN,!1);let t=typeof e;if("object"===t)throw new U(A.format("$ is not a primitive type",e));let s=e;return"boolean"===t?new r(l.BOOLEAN,s):"string"===t?new r(l.STRING,s):ce.findPrimitiveNumberType(s)}static findPrimitive(e){if(o(e))return new r(l.NULL,void 0);let t=typeof e;if("object"===t)throw new U(A.format("$ is not a primitive type",e));let s=e;return"boolean"===t?new r(l.BOOLEAN,s):"string"===t?new r(l.STRING,s):ce.findPrimitiveNumberType(s)}static findPrimitiveNumberType(e){if(o(e)||Array.isArray(e)||"object"==typeof e)throw new U(A.format("Unable to convert $ to a number.",e));let t=e;try{let e=t;return Number.isInteger(e)?new r(l.LONG,e):new r(l.DOUBLE,e)}catch(e){throw new U(A.format("Unable to convert $ to a number.",t),e)}}static compare(e,t){if(e==t)return 0;if(o(e)||o(t))return o(e)?-1:1;if(Array.isArray(e)||Array.isArray(t)){if(Array.isArray(e)||Array.isArray(t)){if(e.length!=t.length)return e.length-t.length;for(let r=0;r<e.length;r++){let s=this.compare(e[r],t[r]);if(0!=s)return s}return 0}return Array.isArray(e)?-1:1}const r=typeof e,s=typeof t;return"object"!==r&&"object"!==s||"object"===r&&"object"===s&&Object.keys(e).forEach((r=>{let s=this.compare(e[r],t[r]);if(0!=s)return s})),this.comparePrimitive(e,t)}static comparePrimitive(e,t){return o(e)||o(t)?o(e)&&o(t)?0:o(e)?-1:1:e==t?0:"boolean"==typeof e||"boolean"==typeof t?e?-1:1:"string"==typeof e||"string"==typeof t?e+""<t+""?-1:1:"number"==typeof e||"number"==typeof t?e-t:0}static baseNumberType(e){return Number.isInteger(e)?l.LONG:l.DOUBLE}static toPrimitiveType(e){return e}constructor(){}}class me extends z{apply(e,t){const r=ce.findPrimitiveNullAsBoolean(e),s=ce.findPrimitiveNullAsBoolean(t);if(r.getT1()!=l.BOOLEAN)throw new U(A.format("Boolean value expected but found $",r.getT2()));if(s.getT1()!=l.BOOLEAN)throw new U(A.format("Boolean value expected but found $",s.getT2()));return r.getT2()&&s.getT2()}}class ge extends z{apply(e,t){const r=ce.findPrimitiveNullAsBoolean(e),s=ce.findPrimitiveNullAsBoolean(t);return r.getT2()==s.getT2()}}class fe extends z{apply(e,t){const r=ce.findPrimitiveNullAsBoolean(e),s=ce.findPrimitiveNullAsBoolean(t);if(r.getT1()==l.BOOLEAN||s.getT1()==l.BOOLEAN)throw new U(A.format("Cannot compare >= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>=s.getT2()}}class Ee extends z{apply(e,t){const r=ce.findPrimitiveNullAsBoolean(e),s=ce.findPrimitiveNullAsBoolean(t);if(r.getT1()==l.BOOLEAN||s.getT1()==l.BOOLEAN)throw new U(A.format("Cannot compare > with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>s.getT2()}}class Te extends z{apply(e,t){const r=ce.findPrimitiveNullAsBoolean(e),s=ce.findPrimitiveNullAsBoolean(t);if(r.getT1()==l.BOOLEAN||s.getT1()==l.BOOLEAN)throw new U(A.format("Cannot compare <= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<=s.getT2()}}class Ae extends z{apply(e,t){const r=ce.findPrimitiveNullAsBoolean(e),s=ce.findPrimitiveNullAsBoolean(t);if(r.getT1()==l.BOOLEAN||s.getT1()==l.BOOLEAN)throw new U(A.format("Cannot compare < with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<s.getT2()}}class de extends z{apply(e,t){const r=ce.findPrimitiveNullAsBoolean(e),s=ce.findPrimitiveNullAsBoolean(t);return r.getT2()!=s.getT2()}}class Oe extends z{apply(e,t){const r=ce.findPrimitiveNullAsBoolean(e),s=ce.findPrimitiveNullAsBoolean(t);if(r.getT1()!=l.BOOLEAN)throw new U(A.format("Boolean value expected but found $",r.getT2()));if(s.getT1()!=l.BOOLEAN)throw new U(A.format("Boolean value expected but found $",s.getT2()));return r.getT2()||s.getT2()}}class Se extends z{apply(e,t){if(!e)throw new U("Cannot apply array operator on a null value");if(!t)throw new U("Cannot retrive null property value");const r=typeof e;if(!Array.isArray(e)&&"string"!=r&&"object"!=r)throw new U(A.format("Cannot retrieve value from a primitive value $",e));return e[t]}}class Ne{nullCheck(e,t){if(o(e))throw new U(A.format("$ cannot be applied to a null value",t.getOperatorName()))}}class Ie extends Ne{apply(e){return this.nullCheck(e,Q.UNARY_MINUS),ce.findPrimitiveNumberType(e),-e}}class Re extends Ne{apply(e){return this.nullCheck(e,Q.UNARY_PLUS),ce.findPrimitiveNumberType(e),e}}class we extends Ne{apply(e){this.nullCheck(e,Q.UNARY_BITWISE_COMPLEMENT);let t=ce.findPrimitiveNumberType(e);if(t.getT1()!=l.INTEGER&&t.getT1()!=l.LONG)throw new U(A.format("Unable to apply bitwise operator on $",e));return~e}}class ye extends Ne{apply(e){if(this.nullCheck(e,Q.UNARY_LOGICAL_NOT),ce.findPrimitiveNumberType(e).getT1()!=l.BOOLEAN)throw new U(A.format("Unable to apply bitwise operator on $",e));return!e}}e({},"TokenValueExtractor",(()=>xe));class xe{static REGEX_SQUARE_BRACKETS=/[\[\]]/;static REGEX_DOT=/\./;getValue(e){let t=this.getPrefix();if(!e.startsWith(t))throw new T(A.format("Token $ doesn't start with $",e,t));return this.getValueInternal(e)}retrieveElementFrom(e,t,r,s){if(o(s))return;if(t.length==r)return s;let n=t[r].split(xe.REGEX_SQUARE_BRACKETS).map((e=>e.trim())).filter((e=>!d.isNullOrBlank(e))).reduce(((s,n,i)=>this.resolveForEachPartOfTokenWithBrackets(e,t,r,n,s,i)),s);return this.retrieveElementFrom(e,t,r+1,n)}resolveForEachPartOfTokenWithBrackets(e,t,r,s,n,i){if(!o(n)){if(0===i){if(Array.isArray(n)){if("length"===s)return n.length;try{let e=parseInt(s);if(isNaN(e))throw new Error(A.format("$ is not a number",e));if(e>=n.length)return;return n[e]}catch(t){throw new q(e,A.format("$ couldn't be parsed into integer in $",s,e),t)}}return this.checkIfObject(e,t,r,n),n[s]}if(s?.startsWith('"')){if(!s.endsWith('"')||1==s.length||2==s.length)throw new q(e,A.format("$ is missing a double quote or empty key found",e));return this.checkIfObject(e,t,r,n),n[s.substring(1,s.length-1)]}try{let t=parseInt(s);if(isNaN(t))throw new Error(A.format("$ is not a number",t));if(!Array.isArray(n))throw new q(e,A.format("Expecting an array with index $ while processing the expression",t,e));if(t>=n.length)return;return n[t]}catch(t){throw new q(e,A.format("$ couldn't be parsed into integer in $",s,e),t)}}}checkIfObject(e,t,r,s){if("object"!=typeof s||Array.isArray(s))throw new q(e,A.format("Unable to retrive $ from $ in the path $",t[r],s.toString(),e))}}const _e=new Map([["true",!0],["false",!1],["null",void 0]]);class Pe extends xe{static INSTANCE=new Pe;getValueInternal(e){if(!d.isNullOrBlank(e))return e=e.trim(),_e.has(e)?_e.get(e):e.startsWith('"')?this.processString(e):this.processNumbers(e)}processNumbers(e){try{let t;if(t=-1==e.indexOf(".")?parseInt(e):parseFloat(e),isNaN(t))throw new Error("Parse number error");return t}catch(t){throw new q(e,A.format("Unable to parse the literal or expression $",e),t)}}processString(e){if(!e.endsWith('"'))throw new q(e,A.format("String literal $ is not closed properly",e));return e.substring(1,e.length-1)}getPrefix(){return""}}class ve{static UNARY_OPERATORS_MAP=new Map([[Q.UNARY_BITWISE_COMPLEMENT,new we],[Q.UNARY_LOGICAL_NOT,new ye],[Q.UNARY_MINUS,new Ie],[Q.UNARY_PLUS,new Re]]);static BINARY_OPERATORS_MAP=new Map([[Q.ADDITION,new Z],[Q.DIVISION,new ee],[Q.INTEGER_DIVISION,new te],[Q.MOD,new re],[Q.MULTIPLICATION,new se],[Q.SUBTRACTION,new ne],[Q.BITWISE_AND,new ae],[Q.BITWISE_LEFT_SHIFT,new oe],[Q.BITWISE_OR,new he],[Q.BITWISE_RIGHT_SHIFT,new ue],[Q.BITWISE_UNSIGNED_RIGHT_SHIFT,new le],[Q.BITWISE_XOR,new pe],[Q.AND,new me],[Q.EQUAL,new ge],[Q.GREATER_THAN,new Ee],[Q.GREATER_THAN_EQUAL,new fe],[Q.LESS_THAN,new Ae],[Q.LESS_THAN_EQUAL,new Te],[Q.OR,new Oe],[Q.NOT_EQUAL,new de],[Q.ARRAY_OPERATOR,new ie],[Q.OBJECT_OPERATOR,new Se]]);static UNARY_OPERATORS_MAP_KEY_SET=new Set(ve.UNARY_OPERATORS_MAP.keys());constructor(e){e instanceof J?(this.exp=e,this.expression=this.exp.getExpression()):this.expression=e}evaluate(e){return this.exp||(this.exp=new J(this.expression)),this.evaluateExpression(this.exp,e)}getExpression(){return this.exp||(this.exp=new J(this.expression)),this.exp}getExpressionString(){return this.expression}evaluateExpression(e,t){let r=e.getOperations(),s=e.getTokens();for(;!r.isEmpty();){let e=r.pop(),a=s.pop();if(ve.UNARY_OPERATORS_MAP_KEY_SET.has(e))s.push(this.applyUnaryOperation(e,this.getValueFromToken(t,a)));else if(e==Q.OBJECT_OPERATOR||e==Q.ARRAY_OPERATOR)this.processObjectOrArrayOperator(t,r,s,e,a);else{const r=s.pop();var n=this.getValueFromToken(t,r),i=this.getValueFromToken(t,a);s.push(this.applyBinaryOperation(e,n,i))}}if(s.isEmpty())throw new U(A.format("Expression : $ evaluated to null",e));if(1!=s.size())throw new U(A.format("Expression : $ evaluated multiple values $",e,s));const a=s.get(0);if(a instanceof K)return a.getElement();if(!(a instanceof J))return this.getValueFromToken(t,a);throw new U(A.format("Expression : $ evaluated to $",e,s.get(0)))}processObjectOrArrayOperator(e,t,r,s,n){const i=new H,a=new H;if(!s||!n)return;do{a.push(s),n instanceof J?i.push(new K(n.toString(),this.evaluateExpression(n,e))):n&&i.push(n),n=r.isEmpty()?void 0:r.pop(),s=t.isEmpty()?void 0:t.pop()}while(s==Q.OBJECT_OPERATOR||s==Q.ARRAY_OPERATOR);n&&(n instanceof J?i.push(new K(n.toString(),this.evaluateExpression(n,e))):i.push(n)),s&&t.push(s);let o=i.pop(),h=new j(o instanceof K?o.getTokenValue():o.toString());for(;!i.isEmpty();)o=i.pop(),s=a.pop(),h.append(s.getOperator()).append(o instanceof K?o.getTokenValue():o.toString()),s==Q.ARRAY_OPERATOR&&h.append("]");let u=h.toString(),l=u.substring(0,u.indexOf(".")+1);if(l.length>2&&e.has(l))r.push(new K(u,this.getValue(u,e)));else{let e;try{e=Pe.INSTANCE.getValue(u)}catch(t){e=u}r.push(new K(u,e))}}applyBinaryOperation(e,t,r){if("object"===typeof t||"object"===typeof r||Array.isArray(t)||Array.isArray(r))throw new q(this.expression,A.format("Cannot evaluate expression $ $ $",t,e.getOperator(),r));let s=ve.BINARY_OPERATORS_MAP.get(e);if(!s)throw new q(this.expression,A.format("No operator found to evaluate $ $ $",t,e.getOperator(),r));return new K(e.toString(),s.apply(t,r))}applyUnaryOperation(e,t){if("object"===typeof t||Array.isArray(t))throw new q(this.expression,A.format("The operator $ cannot be applied to $",e.getOperator(),t));let r=ve.UNARY_OPERATORS_MAP.get(e);if(!r)throw new q(this.expression,A.format("No Unary operator $ is found to apply on $",e.getOperator(),t));return new K(e.toString(),r.apply(t))}getValueFromToken(e,t){return t instanceof J?this.evaluateExpression(t,e):t instanceof K?t.getElement():this.getValue(t.getExpression(),e)}getValue(e,t){if(e.length<=5)return Pe.INSTANCE.getValue(e);const r=e.substring(0,e.indexOf(".")+1);return(t.get(r)??Pe.INSTANCE).getValue(e)}}class Me extends xe{static PREFIX="Arguments.";constructor(e){super(),this.args=e}getValueInternal(e){let t=e.split(xe.REGEX_DOT);return this.retrieveElementFrom(e,t,2,this.args.get(t[1]))}getPrefix(){return Me.PREFIX}}class Le extends xe{static PREFIX="Context.";constructor(e){super(),this.context=e}getValueInternal(e){let t=e.split(xe.REGEX_DOT),r=t[1],s=r.indexOf("["),n=2;return-1!=s&&(r=t[1].substring(0,s),t[1]=t[1].substring(s),n=1),this.retrieveElementFrom(e,t,n,this.context.get(r)?.getElement())}getPrefix(){return Le.PREFIX}}class Ue extends xe{static PREFIX="Steps.";constructor(e){super(),this.output=e}getValueInternal(e){let t=e.split(xe.REGEX_DOT),r=1,s=this.output.get(t[r++]);if(!s||r>=t.length)return;let n=s.get(t[r++]);if(!n||r>=t.length)return;let i=n.get(t[r++]);return this.retrieveElementFrom(e,t,r,i)}getPrefix(){return Ue.PREFIX}}class Ce{count=0;valueExtractors=new Map;getContext(){return this.context}setContext(e){this.context=e;let t=new Le(e);return this.valueExtractors.set(t.getPrefix(),t),this}getArguments(){return this.args}setArguments(e){this.args=e;let t=new Me(e);return this.valueExtractors.set(t.getPrefix(),t),this}getEvents(){return this.events}setEvents(e){return this.events=e,this}getStatementExecution(){return this.statementExecution}setStatementExecution(e){return this.statementExecution=e,this}getSteps(){return this.steps}setSteps(e){this.steps=e;let t=new Ue(e);return this.valueExtractors.set(t.getPrefix(),t),this}getCount(){return this.count}setCount(e){return this.count=e,this}getValuesMap(){return this.valueExtractors}}class Ve{outVertices=new Map;inVertices=new Set;constructor(e,t){this.data=t,this.graph=e}getData(){return this.data}setData(e){return this.data=e,this}getOutVertices(){return this.outVertices}setOutVertices(e){return this.outVertices=e,this}getInVertices(){return this.inVertices}setInVertices(e){return this.inVertices=e,this}getGraph(){return this.graph}setGraph(e){return this.graph=e,this}getKey(){return this.data.getUniqueKey()}addOutEdgeTo(e,t){return this.outVertices.has(e)||this.outVertices.set(e,new Set),this.outVertices.get(e).add(t),t.inVertices.add(new r(this,e)),t}addInEdgeTo(e,t){return this.inVertices.add(new r(e,t)),e.outVertices.has(t)||e.outVertices.set(t,new Set),e.outVertices.get(t).add(this),e}hasIncomingEdges(){return!!this.inVertices.size}hasOutgoingEdges(){return!!this.outVertices.size}getSubGraphOfType(e){let t=new Be(!0);var r=new H(Array.from(this.outVertices.get(e)??[]));for(r.map((e=>e.getData())).forEach((e=>t.addVertex(e)));!r.isEmpty();){var s=r.pop();Array.from(s.outVertices.values()).flatMap((e=>Array.from(e))).forEach((e=>{t.addVertex(e.getData()),r.add(e)}))}return t}toString(){var e=Array.from(this.getInVertices()).map((e=>e.getT1().getKey()+"("+e.getT2()+")")).join(", "),t=Array.from(this.outVertices.entries()).map((([e,t])=>e+": "+Array.from(t).map((e=>e.getKey())).join(","))).join("\n\t\t");return this.getKey()+":\n\tIn: "+e+"\n\tOut: \n\t\t"+t}}class Be{nodeMap=new Map;constructor(e=!1){this.isSubGrph=e}getVerticesData(){return Array.from(this.nodeMap.values()).map((e=>e.getData()))}addVertex(e){if(!this.nodeMap.has(e.getUniqueKey())){let t=new Ve(this,e);this.nodeMap.set(e.getUniqueKey(),t)}return this.nodeMap.get(e.getUniqueKey())}getVertex(e){return this.nodeMap.get(e)}getVertexData(e){if(this.nodeMap.has(e))return this.nodeMap.get(e).getData()}getVerticesWithNoIncomingEdges(){return Array.from(this.nodeMap.values()).filter((e=>!e.hasIncomingEdges()))}isCyclic(){let e,t=new H(this.getVerticesWithNoIncomingEdges()),r=new Set;for(;!t.isEmpty();){if(r.has(t.getFirst().getKey()))return!0;e=t.removeFirst(),r.add(e.getKey()),e.hasOutgoingEdges()&&t.addAll(Array.from(e.getOutVertices().values()).flatMap((e=>Array.from(e))))}return!1}addVertices(e){for(const t of e)this.addVertex(t)}getNodeMap(){return this.nodeMap}isSubGraph(){return this.isSubGrph}toString(){return"Execution Graph : \n"+Array.from(this.nodeMap.values()).map((e=>e.toString())).join("\n")}}class be{constructor(e,t){this.message=t,this.messageType=e}getMessageType(){return this.messageType}setMessageType(e){return this.messageType=e,this}getMessage(){return this.message}setMessage(e){return this.message=e,this}toString(){return`${this.messageType} : ${this.message}`}}class De{messages=new Array;dependencies=new Set;constructor(e){this.statement=e}getStatement(){return this.statement}setStatement(e){return this.statement=e,this}getMessages(){return this.messages}setMessages(e){return this.messages=e,this}getDependencies(){return this.dependencies}setDependencies(e){return this.dependencies=e,this}getUniqueKey(){return this.statement.getStatementName()}addMessage(e,t){this.messages.push(new be(e,t))}addDependency(e){this.dependencies.add(e)}getDepenedencies(){return this.dependencies}equals(e){if(!(e instanceof De))return!1;return e.statement.equals(this.statement)}}let ke;var Ge;(Ge=ke||(ke={})).ERROR="ERROR",Ge.WARNING="WARNING",Ge.MESSAGE="MESSAGE";class Fe extends C{static PARAMETER_NEEDS_A_VALUE='Parameter "$" needs a value';static STEP_REGEX_PATTERN=new RegExp("Steps\\.([a-zA-Z0-9\\\\-]{1,})\\.([a-zA-Z0-9\\\\-]{1,})","g");static VERSION=1;static MAX_EXECUTION_ITERATIONS=1e7;constructor(e,t,r){if(super(),this.fd=e,this.fd.getVersion()>Fe.VERSION)throw new T("Runtime is at a lower version "+Fe.VERSION+" and trying to run code from version "+this.fd.getVersion()+".");this.fRepo=t,this.sRepo=r}getSignature(){return this.fd}getExecutionPlan(e){let t=new Be;for(let r of Array.from(this.fd.getSteps().values()))t.addVertex(this.prepareStatementExecution(e,r));let r=this.makeEdges(t);if(r.length)throw new T(A.format("Found these unresolved dependencies : $ ",r.map((e=>A.format("Steps.$.$",e.getT1(),e.getT2())))));return t}internalExecute(e){e.getContext()||e.setContext(new Map),e.getEvents()||e.setEvents(new Map),e.getSteps()||e.setSteps(new Map);let t=this.getExecutionPlan(e.getContext()),r=t.getVerticesData().filter((e=>e.getMessages().length)).map((e=>e.getStatement().getStatementName()+": \n"+e.getMessages().join(",")));if(r?.length)throw new T("Please fix the errors in the function definition before execution : \n"+r.join(",\n"));return this.executeGraph(t,e)}executeGraph(e,t){let r=new H;r.addAll(e.getVerticesWithNoIncomingEdges());let s=new H;for(;!(r.isEmpty()&&s.isEmpty()||t.getEvents()?.has(B.OUTPUT));)if(this.processBranchQue(t,r,s),this.processExecutionQue(t,r,s),t.setCount(t.getCount()+1),t.getCount()==Fe.MAX_EXECUTION_ITERATIONS)throw new T("Execution locked in an infinite loop");if(!e.isSubGraph()&&!t.getEvents()?.size)throw new T("No events raised");return new D(Array.from(t.getEvents()?.entries()??[]).flatMap((e=>e[1].map((t=>b.of(e[0],t))))))}processExecutionQue(e,t,r){if(!t.isEmpty()){let s=t.pop();this.allDependenciesResolvedVertex(s,e.getSteps())?this.executeVertex(s,e,r,t):t.add(s)}}processBranchQue(e,t,r){if(r.length){let s=r.pop();this.allDependenciesResolvedTuples(s.getT2(),e.getSteps())?this.executeBranch(e,t,s):r.add(s)}}executeBranch(e,t,r){let s,n=r.getT4();do{this.executeGraph(r.getT1(),e),s=r.getT3().next(),s&&(e.getSteps()?.has(n.getData().getStatement().getStatementName())||e.getSteps()?.set(n.getData().getStatement().getStatementName(),new Map),e.getSteps()?.get(n.getData().getStatement().getStatementName())?.set(s.getName(),this.resolveInternalExpressions(s.getResult(),e)))}while(s&&s.getName()!=B.OUTPUT);s?.getName()==B.OUTPUT&&n.getOutVertices().has(B.OUTPUT)&&(n?.getOutVertices()?.get(B.OUTPUT)??[]).forEach((e=>t.add(e)))}executeVertex(e,t,r,s){let i=e.getData().getStatement(),a=this.fRepo.find(i.getNamespace(),i.getName());if(!a)throw new T(A.format("$.$ function is not found.",i.getNamespace(),i.getName()));let o=a?.getSignature().getParameters(),h=this.getArgumentsFromParametersMap(t,i,o??new Map),u=t.getContext(),l=a.execute((new Ce).setContext(u).setArguments(h).setEvents(t.getEvents()).setSteps(t.getSteps()).setStatementExecution(e.getData()).setCount(t.getCount())),p=l.next();if(!p)throw new T(A.format("Executing $ returned no events",i.getStatementName()));let c=p.getName()==B.OUTPUT;if(t.getSteps()?.has(i.getStatementName())||t.getSteps().set(i.getStatementName(),new Map),t.getSteps().get(i.getStatementName()).set(p.getName(),this.resolveInternalExpressions(p.getResult(),t)),c){let t=e.getOutVertices().get(B.OUTPUT);t&&t.forEach((e=>s.add(e)))}else{let t=e.getSubGraphOfType(p.getName()),s=this.makeEdges(t);r.push(new n(t,s,l,e))}}resolveInternalExpressions(e,t){return e?Array.from(e.entries()).map((e=>new r(e[0],this.resolveInternalExpression(e[1],t)))).reduce(((e,t)=>(e.set(t.getT1(),t.getT2()),e)),new Map):e}resolveInternalExpression(e,t){if(o(e)||"object"!=typeof e)return e;if(e instanceof V){return new ve(e.getExpression()).evaluate(t.getValuesMap())}if(Array.isArray(e)){let r=[];for(let s of e)r.push(this.resolveInternalExpression(s,t));return r}if("object"==typeof e){let r={};for(let s of Object.entries(e))r[s[0]]=this.resolveInternalExpression(s[1],t);return r}}allDependenciesResolvedTuples(e,t){for(let r of e){if(!t.has(r.getT1()))return!1;if(!t.get(r.getT1())?.get(r.getT2()))return!1}return!0}allDependenciesResolvedVertex(e,t){return!e.getInVertices().size||0==Array.from(e.getInVertices()).filter((e=>{let r=e.getT1().getData().getStatement().getStatementName(),s=e.getT2();return!(t.has(r)&&t.get(r)?.has(s))})).length}getArgumentsFromParametersMap(e,t,s){return Array.from(t.getParameterMap().entries()).map((t=>{let n,i=t[1];if(!i?.length)return new r(t[0],n);let a=s.get(t[0]);return a?(n=a.isVariableArgument()?i.map((t=>this.parameterReferenceEvaluation(e,t))).flatMap((e=>Array.isArray(e)?e:[e])):this.parameterReferenceEvaluation(e,i[0]),new r(t[0],n)):new r(t[0],void 0)})).filter((e=>!o(e.getT2()))).reduce(((e,t)=>(e.set(t.getT1(),t.getT2()),e)),new Map)}parameterReferenceEvaluation(e,t){let r;if(t.getType()==$.VALUE)r=this.resolveInternalExpression(t.getValue(),e);else if(t.getType()==$.EXPRESSION&&!d.isNullOrBlank(t.getExpression())){r=new ve(t.getExpression()??"").evaluate(e.getValuesMap())}return r}prepareStatementExecution(e,t){let r=new De(t),s=this.fRepo.find(t.getNamespace(),t.getName());if(!s)throw new T(A.format("$.$ was not available",t.getNamespace(),t.getName()));let n=new Map(s.getSignature().getParameters());for(let s of Array.from(t.getParameterMap().entries())){let t=n.get(s[0]);if(!t)continue;let i=s[1];if(i.length){if(t.isVariableArgument())for(let s of i)this.parameterReferenceValidation(e,r,t,s);else{let s=i[0];this.parameterReferenceValidation(e,r,t,s)}n.delete(t.getParameterName())}else o(N.getDefaultValue(t.getSchema(),this.sRepo))&&r.addMessage(ke.ERROR,A.format(Fe.PARAMETER_NEEDS_A_VALUE,t.getParameterName()))}if(!o(r.getStatement().getDependentStatements()))for(let e of r.getStatement().getDependentStatements())r.addDependency(e);if(n.size)for(let e of Array.from(n.values()))o(N.getDefaultValue(e.getSchema(),this.sRepo))&&r.addMessage(ke.ERROR,A.format(Fe.PARAMETER_NEEDS_A_VALUE,e.getParameterName()));return r}parameterReferenceValidation(e,t,s,n){if(n){if(n.getType()==$.VALUE){o(n.getValue())&&o(N.getDefaultValue(s.getSchema(),this.sRepo))&&t.addMessage(ke.ERROR,A.format(Fe.PARAMETER_NEEDS_A_VALUE,s.getParameterName()));let e=new H;for(e.push(new r(s.getSchema(),n.getValue()));!e.isEmpty();){let s=e.pop();if(s.getT2()instanceof V)this.addDependencies(t,s.getT2().getExpression());else{if(o(s.getT1())||o(s.getT1().getType()))continue;if(s.getT1().getType()?.contains(l.ARRAY)&&Array.isArray(s.getT2())){let t=s.getT1().getItems();if(!t)continue;if(t.isSingleType())for(let n of s.getT2())e.push(new r(t.getSingleSchema(),n));else{let n=s.getT2();for(let s=0;s<n.length;s++)e.push(new r(t.getTupleSchema()[s],n[s]))}}else if(s.getT1().getType()?.contains(l.OBJECT)&&"object"==typeof s.getT2()){let n=s.getT1();if(n.getName()===F.EXPRESSION.getName()&&n.getNamespace()===F.EXPRESSION.getNamespace()){let e=s.getT2();e.isExpression&&this.addDependencies(t,e.value)}else if(n.getProperties())for(let t of Object.entries(s.getT2()))n.getProperties().has(t[0])&&e.push(new r(n.getProperties().get(t[0]),t[1]))}}}}else if(n.getType()==$.EXPRESSION)if(d.isNullOrBlank(n.getExpression()))o(N.getDefaultValue(s.getSchema(),this.sRepo))&&t.addMessage(ke.ERROR,A.format(Fe.PARAMETER_NEEDS_A_VALUE,s.getParameterName()));else try{this.addDependencies(t,n.getExpression())}catch(e){t.addMessage(ke.ERROR,A.format("Error evaluating $ : $",n.getExpression(),e))}}else o(N.getDefaultValue(s.getSchema(),this.sRepo))&&t.addMessage(ke.ERROR,A.format(Fe.PARAMETER_NEEDS_A_VALUE,s.getParameterName()))}addDependencies(e,t){t&&Array.from(t.match(Fe.STEP_REGEX_PATTERN)??[]).forEach((t=>e.addDependency(t)))}makeEdges(e){let t=e.getNodeMap().values(),s=[];for(let n of Array.from(t))for(let t of n.getData().getDependencies()){let i=t.indexOf(".",6),a=t.substring(6,i),o=t.indexOf(".",i+1),h=-1==o?t.substring(i+1):t.substring(i+1,o);e.getNodeMap().has(a)||s.push(new r(a,h));let u=e.getNodeMap().get(a);u&&n.addInEdgeTo(u,h)}return s}}export{r as Tuple2,s as Tuple3,n as Tuple4,i as HybridRepository,E as Schema,l as SchemaType,M as SchemaValidator,L as KIRunConstants,U as ExecutionException,T as KIRuntimeException,C as AbstractFunction,a as Namespaces,Fe as KIRuntime,J as Expression,ve as ExpressionEvaluator,xe as TokenValueExtractor,q as ExpressionEvaluationException,X as ExpressionToken,K as ExpressionTokenValue,Q as Operation,H as LinkedList,o as isNullValue,A as StringFormatter,d as StringUtil};
|
|
2
|
-
//# sourceMappingURL=module.js.map
|