@fincity/kirun-js 1.0.5 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/__tests__/engine/function/system/array/AddFirstTest.ts +13 -12
  2. package/__tests__/engine/function/system/array/AddTest.ts +11 -11
  3. package/__tests__/engine/function/system/array/BinarySearchTest.ts +29 -14
  4. package/__tests__/engine/function/system/array/CompareTest.ts +3 -3
  5. package/__tests__/engine/function/system/array/CopyTest.ts +5 -5
  6. package/__tests__/engine/function/system/array/DeleteFirstTest.ts +10 -10
  7. package/__tests__/engine/function/system/array/DeleteFromTest.ts +8 -8
  8. package/__tests__/engine/function/system/array/DeleteLastTest.ts +10 -10
  9. package/__tests__/engine/function/system/array/DeleteTest.ts +60 -25
  10. package/__tests__/engine/function/system/array/DisjointTest.ts +6 -7
  11. package/__tests__/engine/function/system/array/Equals.ts +5 -5
  12. package/__tests__/engine/function/system/array/FillTest.ts +5 -5
  13. package/__tests__/engine/function/system/array/FrequencyTest.ts +11 -11
  14. package/__tests__/engine/function/system/array/IndexOfArrayTest.ts +14 -20
  15. package/__tests__/engine/function/system/array/IndexOfTest.ts +26 -14
  16. package/__tests__/engine/function/system/array/InsertTest.ts +12 -12
  17. package/__tests__/engine/function/system/array/LastIndexOfArrayTest.ts +9 -12
  18. package/__tests__/engine/function/system/array/LastIndexOfTest.ts +16 -16
  19. package/__tests__/engine/function/system/array/MaxTest.ts +18 -18
  20. package/__tests__/engine/function/system/array/MinTest.ts +18 -18
  21. package/__tests__/engine/function/system/array/MisMatchTest.ts +8 -11
  22. package/__tests__/engine/function/system/array/ReverseTest.ts +12 -12
  23. package/__tests__/engine/function/system/array/RotateTest.ts +6 -6
  24. package/__tests__/engine/function/system/array/ShuffleTest.ts +7 -4
  25. package/__tests__/engine/function/system/array/SortTest.ts +10 -10
  26. package/__tests__/engine/function/system/array/SubArrayTest.ts +19 -10
  27. package/__tests__/engine/function/system/context/SetFunctionTest.ts +24 -5
  28. package/__tests__/engine/function/system/math/AddTest.ts +2 -2
  29. package/__tests__/engine/function/system/math/RandomIntTest.ts +46 -0
  30. package/__tests__/engine/function/system/string/ConcatenateTest.ts +4 -4
  31. package/__tests__/engine/function/system/string/DeleteForGivenLengthTest.ts +8 -4
  32. package/__tests__/engine/function/system/string/InsertAtGivenPositionTest.ts +6 -6
  33. package/__tests__/engine/function/system/string/PostPadTest.ts +6 -6
  34. package/__tests__/engine/function/system/string/PrePadTest.ts +8 -8
  35. package/__tests__/engine/function/system/string/RegionMatchesTest.ts +15 -6
  36. package/__tests__/engine/function/system/string/ReverseTest.ts +6 -6
  37. package/__tests__/engine/function/system/string/SplitTest.ts +8 -4
  38. package/__tests__/engine/function/system/string/StringFunctionRepoTest2.ts +35 -11
  39. package/__tests__/engine/function/system/string/StringFunctionRepoTest3.ts +14 -5
  40. package/__tests__/engine/function/system/string/StringFunctionRepositoryTest.ts +40 -16
  41. package/__tests__/engine/function/system/string/ToStringTest.ts +6 -6
  42. package/__tests__/engine/function/system/string/TrimToTest.ts +8 -6
  43. package/__tests__/engine/runtime/KIRuntimeTest.ts +148 -155
  44. package/__tests__/engine/runtime/KIRuntimeWithDefinitionTest.ts +89 -0
  45. package/__tests__/engine/util/LinkedListTest.ts +9 -0
  46. package/dist/index.js +1 -1
  47. package/dist/index.js.map +1 -1
  48. package/dist/module.js +1 -1
  49. package/dist/module.js.map +1 -1
  50. package/dist/types.d.ts +267 -109
  51. package/dist/types.d.ts.map +1 -1
  52. package/package.json +1 -1
  53. package/src/engine/function/AbstractFunction.ts +5 -3
  54. package/src/engine/function/Function.ts +1 -1
  55. package/src/engine/function/system/GenerateEvent.ts +1 -1
  56. package/src/engine/function/system/If.ts +1 -1
  57. package/src/engine/function/system/array/AbstractArrayFunction.ts +5 -0
  58. package/src/engine/function/system/array/Add.ts +1 -1
  59. package/src/engine/function/system/array/AddFirst.ts +1 -1
  60. package/src/engine/function/system/array/BinarySearch.ts +1 -1
  61. package/src/engine/function/system/array/Compare.ts +1 -1
  62. package/src/engine/function/system/array/Copy.ts +1 -1
  63. package/src/engine/function/system/array/Delete.ts +24 -32
  64. package/src/engine/function/system/array/DeleteFirst.ts +1 -1
  65. package/src/engine/function/system/array/DeleteFrom.ts +1 -1
  66. package/src/engine/function/system/array/DeleteLast.ts +1 -1
  67. package/src/engine/function/system/array/Disjoint.ts +1 -1
  68. package/src/engine/function/system/array/Equals.ts +2 -2
  69. package/src/engine/function/system/array/Fill.ts +1 -1
  70. package/src/engine/function/system/array/Frequency.ts +1 -1
  71. package/src/engine/function/system/array/IndexOf.ts +1 -1
  72. package/src/engine/function/system/array/IndexOfArray.ts +1 -1
  73. package/src/engine/function/system/array/Insert.ts +1 -1
  74. package/src/engine/function/system/array/LastIndexOf.ts +1 -1
  75. package/src/engine/function/system/array/LastIndexOfArray.ts +1 -1
  76. package/src/engine/function/system/array/Max.ts +1 -1
  77. package/src/engine/function/system/array/Min.ts +1 -1
  78. package/src/engine/function/system/array/MisMatch.ts +1 -1
  79. package/src/engine/function/system/array/Reverse.ts +1 -1
  80. package/src/engine/function/system/array/Rotate.ts +1 -1
  81. package/src/engine/function/system/array/Shuffle.ts +1 -1
  82. package/src/engine/function/system/array/Sort.ts +1 -1
  83. package/src/engine/function/system/array/SubArray.ts +1 -1
  84. package/src/engine/function/system/context/Create.ts +1 -1
  85. package/src/engine/function/system/context/Get.ts +1 -1
  86. package/src/engine/function/system/context/SetFunction.ts +1 -1
  87. package/src/engine/function/system/loop/CountLoop.ts +1 -1
  88. package/src/engine/function/system/loop/RangeLoop.ts +1 -1
  89. package/src/engine/function/system/math/Add.ts +2 -4
  90. package/src/engine/function/system/math/GenericMathFunction.ts +2 -4
  91. package/src/engine/function/system/math/Hypotenuse.ts +2 -6
  92. package/src/engine/function/system/math/Maximum.ts +2 -4
  93. package/src/engine/function/system/math/Minimum.ts +2 -4
  94. package/src/engine/function/system/math/Random.ts +1 -1
  95. package/src/engine/function/system/math/RandomFloat.ts +56 -0
  96. package/src/engine/function/system/math/RandomInt.ts +56 -0
  97. package/src/engine/function/system/string/AbstractStringFunction.ts +24 -8
  98. package/src/engine/function/system/string/Concatenate.ts +2 -2
  99. package/src/engine/function/system/string/DeleteForGivenLength.ts +25 -15
  100. package/src/engine/function/system/string/InsertAtGivenPosition.ts +17 -7
  101. package/src/engine/function/system/string/PostPad.ts +20 -10
  102. package/src/engine/function/system/string/PrePad.ts +17 -7
  103. package/src/engine/function/system/string/RegionMatches.ts +40 -22
  104. package/src/engine/function/system/string/ReplaceAtGivenPosition.ts +26 -13
  105. package/src/engine/function/system/string/Reverse.ts +4 -3
  106. package/src/engine/function/system/string/Split.ts +13 -4
  107. package/src/engine/function/system/string/ToString.ts +9 -5
  108. package/src/engine/function/system/string/TrimTo.ts +13 -6
  109. package/src/engine/json/schema/Schema.ts +1 -0
  110. package/src/engine/model/Event.ts +15 -0
  111. package/src/engine/model/FunctionDefinition.ts +76 -29
  112. package/src/engine/model/Parameter.ts +11 -0
  113. package/src/engine/model/ParameterReference.ts +8 -1
  114. package/src/engine/model/Position.ts +5 -0
  115. package/src/engine/model/Statement.ts +16 -0
  116. package/src/engine/model/StatementGroup.ts +7 -0
  117. package/src/engine/runtime/KIRuntime.ts +26 -24
  118. package/src/index.ts +71 -20
@@ -44,7 +44,7 @@ export class Create extends AbstractFunction {
44
44
  return SIGNATURE;
45
45
  }
46
46
 
47
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
47
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
48
48
  const name: string = context?.getArguments()?.get(NAME);
49
49
 
50
50
  if (context?.getContext()?.has(name))
@@ -40,7 +40,7 @@ export class Get extends AbstractFunction {
40
40
  return SIGNATURE;
41
41
  }
42
42
 
43
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
43
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
44
44
  const name: string = context?.getArguments()?.get(NAME);
45
45
 
46
46
  if (!context.getContext()?.has(name))
@@ -47,7 +47,7 @@ export class SetFunction extends AbstractFunction {
47
47
  return SIGNATURE;
48
48
  }
49
49
 
50
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
50
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
51
51
  let key: string = context?.getArguments()?.get(NAME);
52
52
 
53
53
  if (StringUtil.isNullOrBlank(key)) {
@@ -35,7 +35,7 @@ export class CountLoop extends AbstractFunction {
35
35
  return SIGNATURE;
36
36
  }
37
37
 
38
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
38
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
39
39
  let count: number = context.getArguments()?.get(COUNT);
40
40
  let current = 0;
41
41
 
@@ -92,7 +92,7 @@ export class RangeLoop extends AbstractFunction {
92
92
  return SIGNATURE;
93
93
  }
94
94
 
95
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
95
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
96
96
  let from: number = context.getArguments()?.get(FROM);
97
97
  let to: number = context.getArguments()?.get(TO);
98
98
  let step: number = context.getArguments()?.get(STEP);
@@ -13,9 +13,7 @@ const VALUE = 'value';
13
13
  const SIGNATURE = new FunctionSignature('Add')
14
14
  .setNamespace(Namespaces.MATH)
15
15
  .setParameters(
16
- new Map([
17
- [VALUE, new Parameter(VALUE, Schema.ofNumber(VALUE)).setVariableArgument(true)],
18
- ]),
16
+ new Map([[VALUE, new Parameter(VALUE, Schema.ofNumber(VALUE)).setVariableArgument(true)]]),
19
17
  )
20
18
  .setEvents(new Map([Event.outputEventMapEntry(new Map([[VALUE, Schema.ofNumber(VALUE)]]))]));
21
19
 
@@ -24,7 +22,7 @@ export class Add extends AbstractFunction {
24
22
  return SIGNATURE;
25
23
  }
26
24
 
27
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
25
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
28
26
  let nums: number[] = context.getArguments()?.get(VALUE);
29
27
 
30
28
  return new FunctionOutput([
@@ -17,9 +17,7 @@ const VALUE2 = 'value2';
17
17
 
18
18
  const paramFunctions = [
19
19
  () => {
20
- return new Map([
21
- [VALUE,new Parameter(VALUE,Schema.ofNumber(VALUE))],
22
- ]);
20
+ return new Map([[VALUE, new Parameter(VALUE, Schema.ofNumber(VALUE))]]);
23
21
  },
24
22
  () => {
25
23
  return new Map([
@@ -65,7 +63,7 @@ export class GenericMathFunction extends AbstractFunction {
65
63
  return this.signature;
66
64
  }
67
65
 
68
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
66
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
69
67
  let v1 = PrimitiveUtil.findPrimitiveNumberType(
70
68
  context.getArguments()?.get(this.parametersNumber == 1 ? VALUE : VALUE1),
71
69
  ).getT2();
@@ -17,11 +17,7 @@ export class Hypotenuse extends AbstractFunction {
17
17
  .setNamespace(Namespaces.MATH)
18
18
  .setParameters(
19
19
  new Map([
20
- [
21
- VALUE,
22
- new Parameter(VALUE,Schema.ofNumber(VALUE))
23
- .setVariableArgument(true),
24
- ],
20
+ [VALUE, new Parameter(VALUE, Schema.ofNumber(VALUE)).setVariableArgument(true)],
25
21
  ]),
26
22
  )
27
23
  .setEvents(
@@ -45,7 +41,7 @@ export class Hypotenuse extends AbstractFunction {
45
41
  return Hypotenuse.SIGNATURE;
46
42
  }
47
43
 
48
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
44
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
49
45
  let nums: number[] = context.getArguments()?.get(VALUE);
50
46
 
51
47
  return new FunctionOutput([
@@ -13,9 +13,7 @@ const VALUE = 'value';
13
13
  const SIGNATURE = new FunctionSignature('Maximum')
14
14
  .setNamespace(Namespaces.MATH)
15
15
  .setParameters(
16
- new Map([
17
- [VALUE, new Parameter(VALUE, Schema.ofNumber(VALUE)).setVariableArgument(true)],
18
- ]),
16
+ new Map([[VALUE, new Parameter(VALUE, Schema.ofNumber(VALUE)).setVariableArgument(true)]]),
19
17
  )
20
18
  .setEvents(new Map([Event.outputEventMapEntry(new Map([[VALUE, Schema.ofNumber(VALUE)]]))]));
21
19
 
@@ -24,7 +22,7 @@ export class Maximum extends AbstractFunction {
24
22
  return SIGNATURE;
25
23
  }
26
24
 
27
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
25
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
28
26
  let nums: number[] = context.getArguments()?.get(VALUE);
29
27
 
30
28
  return new FunctionOutput([
@@ -13,9 +13,7 @@ const VALUE = 'value';
13
13
  const SIGNATURE = new FunctionSignature('Minimum')
14
14
  .setNamespace(Namespaces.MATH)
15
15
  .setParameters(
16
- new Map([
17
- [VALUE, new Parameter(VALUE, Schema.ofNumber(VALUE)).setVariableArgument(true)],
18
- ]),
16
+ new Map([[VALUE, new Parameter(VALUE, Schema.ofNumber(VALUE)).setVariableArgument(true)]]),
19
17
  )
20
18
  .setEvents(new Map([Event.outputEventMapEntry(new Map([[VALUE, Schema.ofNumber(VALUE)]]))]));
21
19
 
@@ -24,7 +22,7 @@ export class Minimum extends AbstractFunction {
24
22
  return SIGNATURE;
25
23
  }
26
24
 
27
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
25
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
28
26
  let nums: number[] = context.getArguments()?.get(VALUE);
29
27
 
30
28
  return new FunctionOutput([
@@ -21,7 +21,7 @@ export class Random extends AbstractFunction {
21
21
  public getSignature(): FunctionSignature {
22
22
  return Random.SIGNATURE;
23
23
  }
24
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
24
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
25
25
  return new FunctionOutput([EventResult.outputOf(new Map([[VALUE, Math.random()]]))]);
26
26
  }
27
27
  }
@@ -0,0 +1,56 @@
1
+ import { Schema } from '../../../json/schema/Schema';
2
+ import { Event } from '../../../model/Event';
3
+ import { EventResult } from '../../../model/EventResult';
4
+ import { FunctionOutput } from '../../../model/FunctionOutput';
5
+ import { FunctionSignature } from '../../../model/FunctionSignature';
6
+ import { Parameter } from '../../../model/Parameter';
7
+ import { Namespaces } from '../../../namespaces/Namespaces';
8
+ import { FunctionExecutionParameters } from '../../../runtime/FunctionExecutionParameters';
9
+ import { MapUtil } from '../../../util/MapUtil';
10
+ import { AbstractFunction } from '../../AbstractFunction';
11
+
12
+ export class RandomFloat extends AbstractFunction {
13
+ public static readonly MIN_VALUE = 'minValue';
14
+
15
+ public static readonly MAX_VALUE = 'maxValue';
16
+
17
+ public static readonly VALUE = 'value';
18
+
19
+ private static readonly SIGNATURE: FunctionSignature = new FunctionSignature('Random')
20
+ .setParameters(
21
+ MapUtil.of(
22
+ RandomFloat.MIN_VALUE,
23
+ Parameter.of(
24
+ RandomFloat.MIN_VALUE,
25
+ Schema.ofFloat(RandomFloat.MIN_VALUE).setDefaultValue(0),
26
+ ),
27
+ RandomFloat.MAX_VALUE,
28
+ Parameter.of(
29
+ RandomFloat.MAX_VALUE,
30
+ Schema.ofFloat(RandomFloat.MAX_VALUE).setDefaultValue(2147483647),
31
+ ),
32
+ ),
33
+ )
34
+ .setNamespace(Namespaces.MATH)
35
+ .setEvents(
36
+ new Map<string, Event>([
37
+ Event.outputEventMapEntry(
38
+ MapUtil.of(RandomFloat.VALUE, Schema.ofFloat(RandomFloat.VALUE)),
39
+ ),
40
+ ]),
41
+ );
42
+
43
+ public getSignature(): FunctionSignature {
44
+ return RandomFloat.SIGNATURE;
45
+ }
46
+
47
+ protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
48
+ let min: number = context.getArguments()?.get(RandomFloat.MIN_VALUE);
49
+
50
+ let max: number = context.getArguments()?.get(RandomFloat.MAX_VALUE);
51
+
52
+ let num: number = Math.floor(Math.random() * (max - min) + min);
53
+
54
+ return new FunctionOutput([EventResult.outputOf(new Map([[RandomFloat.VALUE, num]]))]);
55
+ }
56
+ }
@@ -0,0 +1,56 @@
1
+ import { Schema } from '../../../json/schema/Schema';
2
+ import { Event } from '../../../model/Event';
3
+ import { EventResult } from '../../../model/EventResult';
4
+ import { FunctionOutput } from '../../../model/FunctionOutput';
5
+ import { FunctionSignature } from '../../../model/FunctionSignature';
6
+ import { Parameter } from '../../../model/Parameter';
7
+ import { Namespaces } from '../../../namespaces/Namespaces';
8
+ import { FunctionExecutionParameters } from '../../../runtime/FunctionExecutionParameters';
9
+ import { MapUtil } from '../../../util/MapUtil';
10
+ import { AbstractFunction } from '../../AbstractFunction';
11
+
12
+ export class RandomInt extends AbstractFunction {
13
+ public static readonly MIN_VALUE = 'minValue';
14
+
15
+ public static readonly MAX_VALUE = 'maxValue';
16
+
17
+ public static readonly VALUE = 'value';
18
+
19
+ private static readonly SIGNATURE: FunctionSignature = new FunctionSignature('Random')
20
+ .setParameters(
21
+ MapUtil.of(
22
+ RandomInt.MIN_VALUE,
23
+ Parameter.of(
24
+ RandomInt.MIN_VALUE,
25
+ Schema.ofInteger(RandomInt.MIN_VALUE).setDefaultValue(0),
26
+ ),
27
+ RandomInt.MAX_VALUE,
28
+ Parameter.of(
29
+ RandomInt.MAX_VALUE,
30
+ Schema.ofInteger(RandomInt.MAX_VALUE).setDefaultValue(2147483647),
31
+ ),
32
+ ),
33
+ )
34
+ .setNamespace(Namespaces.MATH)
35
+ .setEvents(
36
+ new Map<string, Event>([
37
+ Event.outputEventMapEntry(
38
+ MapUtil.of(RandomInt.VALUE, Schema.ofInteger(RandomInt.VALUE)),
39
+ ),
40
+ ]),
41
+ );
42
+
43
+ public getSignature(): FunctionSignature {
44
+ return RandomInt.SIGNATURE;
45
+ }
46
+
47
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
48
+ let min: number = context.getArguments()?.get(RandomInt.MIN_VALUE);
49
+
50
+ let max: number = context.getArguments()?.get(RandomInt.MAX_VALUE);
51
+
52
+ let num: number = Math.floor(Math.random() * (max - min) + min);
53
+
54
+ return new FunctionOutput([EventResult.outputOf(new Map([[RandomInt.VALUE, num]]))]);
55
+ }
56
+ }
@@ -120,7 +120,9 @@ export abstract class AbstractStringFunction extends AbstractFunction {
120
120
  super(namespace, functionName, event, ...parameter);
121
121
  }
122
122
 
123
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
123
+ protected async internalExecute(
124
+ context: FunctionExecutionParameters,
125
+ ): Promise<FunctionOutput> {
124
126
  let s: string = context
125
127
  ?.getArguments()
126
128
  ?.get(AbstractStringFunction.PARAMETER_STRING_NAME);
@@ -160,7 +162,9 @@ export abstract class AbstractStringFunction extends AbstractFunction {
160
162
  super(namespace, functionName, event, ...parameter);
161
163
  }
162
164
 
163
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
165
+ protected async internalExecute(
166
+ context: FunctionExecutionParameters,
167
+ ): Promise<FunctionOutput> {
164
168
  let s: string = context
165
169
  ?.getArguments()
166
170
  ?.get(AbstractStringFunction.PARAMETER_STRING_NAME);
@@ -200,7 +204,9 @@ export abstract class AbstractStringFunction extends AbstractFunction {
200
204
  super(namespace, functionName, event, ...parameter);
201
205
  }
202
206
 
203
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
207
+ protected async internalExecute(
208
+ context: FunctionExecutionParameters,
209
+ ): Promise<FunctionOutput> {
204
210
  let s1: string = context
205
211
  ?.getArguments()
206
212
  ?.get(AbstractStringFunction.PARAMETER_STRING_NAME);
@@ -237,7 +243,9 @@ export abstract class AbstractStringFunction extends AbstractFunction {
237
243
  super(namespace, functionName, event, ...parameter);
238
244
  }
239
245
 
240
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
246
+ protected async internalExecute(
247
+ context: FunctionExecutionParameters,
248
+ ): Promise<FunctionOutput> {
241
249
  let s: string = context
242
250
  ?.getArguments()
243
251
  ?.get(AbstractStringFunction.PARAMETER_STRING_NAME);
@@ -272,7 +280,9 @@ export abstract class AbstractStringFunction extends AbstractFunction {
272
280
  super(namespace, functionName, event, ...parameter);
273
281
  }
274
282
 
275
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
283
+ protected async internalExecute(
284
+ context: FunctionExecutionParameters,
285
+ ): Promise<FunctionOutput> {
276
286
  let s: string = context
277
287
  ?.getArguments()
278
288
  ?.get(AbstractStringFunction.PARAMETER_STRING_NAME);
@@ -308,7 +318,9 @@ export abstract class AbstractStringFunction extends AbstractFunction {
308
318
  super(namespace, functionName, event, ...parameter);
309
319
  }
310
320
 
311
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
321
+ protected async internalExecute(
322
+ context: FunctionExecutionParameters,
323
+ ): Promise<FunctionOutput> {
312
324
  let s: string = context
313
325
  ?.getArguments()
314
326
  ?.get(AbstractStringFunction.PARAMETER_STRING_NAME);
@@ -353,7 +365,9 @@ export abstract class AbstractStringFunction extends AbstractFunction {
353
365
  super(namespace, functionName, event, ...parameter);
354
366
  }
355
367
 
356
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
368
+ protected async internalExecute(
369
+ context: FunctionExecutionParameters,
370
+ ): Promise<FunctionOutput> {
357
371
  let s: string = context
358
372
  ?.getArguments()
359
373
  ?.get(AbstractStringFunction.PARAMETER_STRING_NAME);
@@ -401,7 +415,9 @@ export abstract class AbstractStringFunction extends AbstractFunction {
401
415
  super(namespace, functionName, event, ...parameter);
402
416
  }
403
417
 
404
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
418
+ protected async internalExecute(
419
+ context: FunctionExecutionParameters,
420
+ ): Promise<FunctionOutput> {
405
421
  let s1: string = context
406
422
  ?.getArguments()
407
423
  ?.get(AbstractStringFunction.PARAMETER_STRING_NAME);
@@ -23,7 +23,7 @@ export class Concatenate extends AbstractFunction {
23
23
  new Map([
24
24
  [
25
25
  Concatenate.VALUE,
26
- new Parameter( Concatenate.VALUE, Concatenate.SCHEMA).setVariableArgument(true),
26
+ new Parameter(Concatenate.VALUE, Concatenate.SCHEMA).setVariableArgument(true),
27
27
  ],
28
28
  ]),
29
29
  )
@@ -43,7 +43,7 @@ export class Concatenate extends AbstractFunction {
43
43
  return Concatenate.SIGNATURE;
44
44
  }
45
45
 
46
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
46
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
47
47
  let contextArgs: string[] = context.getArguments()?.get(Concatenate.VALUE);
48
48
 
49
49
  let concatenatedString: string = '';
@@ -17,20 +17,30 @@ export class DeleteForGivenLength extends AbstractFunction {
17
17
 
18
18
  public static readonly EVENT_RESULT_NAME: string = 'result';
19
19
 
20
- protected readonly PARAMETER_STRING: Parameter =new Parameter(DeleteForGivenLength.PARAMETER_STRING_NAME,Schema.ofString(DeleteForGivenLength.PARAMETER_STRING_NAME));
21
-
22
- protected readonly PARAMETER_AT_START: Parameter =new Parameter(DeleteForGivenLength.PARAMETER_AT_START_NAME,Schema.ofInteger(DeleteForGivenLength.PARAMETER_AT_START_NAME));
23
-
24
- protected readonly PARAMETER_AT_END: Parameter =new Parameter(DeleteForGivenLength.PARAMETER_AT_END_NAME,Schema.ofInteger(DeleteForGivenLength.PARAMETER_AT_END_NAME));
25
-
26
- protected readonly EVENT_STRING: Event =new Event(Event.OUTPUT,
27
- new Map([
28
- [
29
- DeleteForGivenLength.EVENT_RESULT_NAME,
30
- Schema.ofString(DeleteForGivenLength.EVENT_RESULT_NAME),
31
- ],
32
- ]),
33
- );
20
+ protected readonly PARAMETER_STRING: Parameter = new Parameter(
21
+ DeleteForGivenLength.PARAMETER_STRING_NAME,
22
+ Schema.ofString(DeleteForGivenLength.PARAMETER_STRING_NAME),
23
+ );
24
+
25
+ protected readonly PARAMETER_AT_START: Parameter = new Parameter(
26
+ DeleteForGivenLength.PARAMETER_AT_START_NAME,
27
+ Schema.ofInteger(DeleteForGivenLength.PARAMETER_AT_START_NAME),
28
+ );
29
+
30
+ protected readonly PARAMETER_AT_END: Parameter = new Parameter(
31
+ DeleteForGivenLength.PARAMETER_AT_END_NAME,
32
+ Schema.ofInteger(DeleteForGivenLength.PARAMETER_AT_END_NAME),
33
+ );
34
+
35
+ protected readonly EVENT_STRING: Event = new Event(
36
+ Event.OUTPUT,
37
+ new Map([
38
+ [
39
+ DeleteForGivenLength.EVENT_RESULT_NAME,
40
+ Schema.ofString(DeleteForGivenLength.EVENT_RESULT_NAME),
41
+ ],
42
+ ]),
43
+ );
34
44
 
35
45
  private signature: FunctionSignature = new FunctionSignature('DeleteForGivenLength')
36
46
  .setNamespace(Namespaces.STRING)
@@ -51,7 +61,7 @@ export class DeleteForGivenLength extends AbstractFunction {
51
61
  return this.signature;
52
62
  }
53
63
 
54
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
64
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
55
65
  let inputString: string = context
56
66
  ?.getArguments()
57
67
  ?.get(DeleteForGivenLength.PARAMETER_STRING_NAME);
@@ -17,15 +17,25 @@ export class InsertAtGivenPosition extends AbstractFunction {
17
17
 
18
18
  protected readonly EVENT_RESULT_NAME: string = 'result';
19
19
 
20
- protected readonly PARAMETER_STRING: Parameter =new Parameter(InsertAtGivenPosition.PARAMETER_STRING_NAME,Schema.ofString(InsertAtGivenPosition.PARAMETER_STRING_NAME));
20
+ protected readonly PARAMETER_STRING: Parameter = new Parameter(
21
+ InsertAtGivenPosition.PARAMETER_STRING_NAME,
22
+ Schema.ofString(InsertAtGivenPosition.PARAMETER_STRING_NAME),
23
+ );
21
24
 
22
- protected readonly PARAMETER_AT_POSITION: Parameter =new Parameter(InsertAtGivenPosition.PARAMETER_AT_POSITION_NAME,Schema.ofInteger(InsertAtGivenPosition.PARAMETER_AT_POSITION_NAME));
25
+ protected readonly PARAMETER_AT_POSITION: Parameter = new Parameter(
26
+ InsertAtGivenPosition.PARAMETER_AT_POSITION_NAME,
27
+ Schema.ofInteger(InsertAtGivenPosition.PARAMETER_AT_POSITION_NAME),
28
+ );
23
29
 
24
- protected readonly PARAMETER_INSERT_STRING: Parameter =new Parameter(InsertAtGivenPosition.PARAMETER_INSERT_STRING_NAME,Schema.ofString(InsertAtGivenPosition.PARAMETER_INSERT_STRING_NAME));
30
+ protected readonly PARAMETER_INSERT_STRING: Parameter = new Parameter(
31
+ InsertAtGivenPosition.PARAMETER_INSERT_STRING_NAME,
32
+ Schema.ofString(InsertAtGivenPosition.PARAMETER_INSERT_STRING_NAME),
33
+ );
25
34
 
26
- protected readonly EVENT_STRING: Event =new Event(Event.OUTPUT,
27
- new Map([[this.EVENT_RESULT_NAME, Schema.ofString(this.EVENT_RESULT_NAME)]]),
28
- );
35
+ protected readonly EVENT_STRING: Event = new Event(
36
+ Event.OUTPUT,
37
+ new Map([[this.EVENT_RESULT_NAME, Schema.ofString(this.EVENT_RESULT_NAME)]]),
38
+ );
29
39
 
30
40
  private signature: FunctionSignature = new FunctionSignature('InsertAtGivenPosition')
31
41
  .setNamespace(Namespaces.STRING)
@@ -48,7 +58,7 @@ export class InsertAtGivenPosition extends AbstractFunction {
48
58
  return this.signature;
49
59
  }
50
60
 
51
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
61
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
52
62
  let inputString: string = context
53
63
  ?.getArguments()
54
64
  ?.get(InsertAtGivenPosition.PARAMETER_STRING_NAME);
@@ -17,15 +17,25 @@ export class PostPad extends AbstractFunction {
17
17
 
18
18
  protected static readonly EVENT_RESULT_NAME: string = 'result';
19
19
 
20
- protected static PARAMETER_STRING: Parameter =new Parameter(PostPad.PARAMETER_STRING_NAME,Schema.ofString(PostPad.PARAMETER_STRING_NAME));
21
-
22
- protected static PARAMETER_POSTPAD_STRING: Parameter =new Parameter(PostPad.PARAMETER_POSTPAD_STRING_NAME,Schema.ofString(PostPad.PARAMETER_POSTPAD_STRING_NAME));
23
-
24
- protected static PARAMETER_LENGTH: Parameter =new Parameter(PostPad.PARAMETER_LENGTH_NAME,Schema.ofInteger(PostPad.PARAMETER_LENGTH_NAME));
25
-
26
- protected static EVENT_STRING: Event =new Event(Event.OUTPUT,
27
- new Map([[PostPad.EVENT_RESULT_NAME, Schema.ofString(PostPad.EVENT_RESULT_NAME)]]),
28
- );
20
+ protected static PARAMETER_STRING: Parameter = new Parameter(
21
+ PostPad.PARAMETER_STRING_NAME,
22
+ Schema.ofString(PostPad.PARAMETER_STRING_NAME),
23
+ );
24
+
25
+ protected static PARAMETER_POSTPAD_STRING: Parameter = new Parameter(
26
+ PostPad.PARAMETER_POSTPAD_STRING_NAME,
27
+ Schema.ofString(PostPad.PARAMETER_POSTPAD_STRING_NAME),
28
+ );
29
+
30
+ protected static PARAMETER_LENGTH: Parameter = new Parameter(
31
+ PostPad.PARAMETER_LENGTH_NAME,
32
+ Schema.ofInteger(PostPad.PARAMETER_LENGTH_NAME),
33
+ );
34
+
35
+ protected static EVENT_STRING: Event = new Event(
36
+ Event.OUTPUT,
37
+ new Map([[PostPad.EVENT_RESULT_NAME, Schema.ofString(PostPad.EVENT_RESULT_NAME)]]),
38
+ );
29
39
 
30
40
  private signature: FunctionSignature = new FunctionSignature('PostPad')
31
41
  .setNamespace(Namespaces.STRING)
@@ -49,7 +59,7 @@ export class PostPad extends AbstractFunction {
49
59
  return this.signature;
50
60
  }
51
61
 
52
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
62
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
53
63
  let inputString: string = context.getArguments()?.get(PostPad.PARAMETER_STRING_NAME);
54
64
  let postpadString: string = context
55
65
  ?.getArguments()
@@ -17,15 +17,25 @@ export class PrePad extends AbstractFunction {
17
17
 
18
18
  public static readonly EVENT_RESULT_NAME: string = 'result';
19
19
 
20
- protected static readonly PARAMETER_STRING: Parameter =new Parameter(PrePad.PARAMETER_STRING_NAME,Schema.ofString(PrePad.PARAMETER_STRING_NAME));
20
+ protected static readonly PARAMETER_STRING: Parameter = new Parameter(
21
+ PrePad.PARAMETER_STRING_NAME,
22
+ Schema.ofString(PrePad.PARAMETER_STRING_NAME),
23
+ );
21
24
 
22
- protected static readonly PARAMETER_PREPAD_STRING: Parameter =new Parameter(PrePad.PARAMETER_PREPAD_STRING_NAME,Schema.ofString(PrePad.PARAMETER_PREPAD_STRING_NAME));
25
+ protected static readonly PARAMETER_PREPAD_STRING: Parameter = new Parameter(
26
+ PrePad.PARAMETER_PREPAD_STRING_NAME,
27
+ Schema.ofString(PrePad.PARAMETER_PREPAD_STRING_NAME),
28
+ );
23
29
 
24
- protected static readonly PARAMETER_LENGTH: Parameter =new Parameter(PrePad.PARAMETER_LENGTH_NAME,Schema.ofInteger(PrePad.PARAMETER_LENGTH_NAME));
30
+ protected static readonly PARAMETER_LENGTH: Parameter = new Parameter(
31
+ PrePad.PARAMETER_LENGTH_NAME,
32
+ Schema.ofInteger(PrePad.PARAMETER_LENGTH_NAME),
33
+ );
25
34
 
26
- protected static readonly EVENT_STRING: Event =new Event(Event.OUTPUT,
27
- new Map([[PrePad.EVENT_RESULT_NAME, Schema.ofString(PrePad.EVENT_RESULT_NAME)]]),
28
- );
35
+ protected static readonly EVENT_STRING: Event = new Event(
36
+ Event.OUTPUT,
37
+ new Map([[PrePad.EVENT_RESULT_NAME, Schema.ofString(PrePad.EVENT_RESULT_NAME)]]),
38
+ );
29
39
 
30
40
  private readonly signature: FunctionSignature = new FunctionSignature('PrePad')
31
41
  .setNamespace(Namespaces.STRING)
@@ -46,7 +56,7 @@ export class PrePad extends AbstractFunction {
46
56
  super();
47
57
  }
48
58
 
49
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
59
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
50
60
  let inputString: string = context.getArguments()?.get(PrePad.PARAMETER_STRING_NAME);
51
61
  let prepadString: string = context.getArguments()?.get(PrePad.PARAMETER_PREPAD_STRING_NAME);
52
62
  let length: number = context.getArguments()?.get(PrePad.PARAMETER_LENGTH_NAME);
@@ -23,26 +23,42 @@ export class RegionMatches extends AbstractFunction {
23
23
 
24
24
  public static readonly EVENT_RESULT_NAME: string = 'result';
25
25
 
26
- public static PARAMETER_STRING: Parameter =new Parameter(RegionMatches.PARAMETER_STRING_NAME,Schema.ofString(RegionMatches.PARAMETER_STRING_NAME));
27
-
28
- protected static PARAMETER_OTHER_STRING: Parameter =new Parameter(RegionMatches.PARAMETER_OTHER_STRING_NAME,Schema.ofString(RegionMatches.PARAMETER_OTHER_STRING_NAME));
29
-
30
- protected static PARAMETER_FIRST_OFFSET: Parameter =new Parameter(RegionMatches.PARAMETER_FIRST_OFFSET_NAME,Schema.ofInteger(RegionMatches.PARAMETER_FIRST_OFFSET_NAME));
31
-
32
- protected static PARAMETER_SECOND_OFFSET: Parameter =new Parameter(RegionMatches.PARAMETER_SECOND_OFFSET_NAME,Schema.ofInteger(RegionMatches.PARAMETER_SECOND_OFFSET_NAME));
33
-
34
- protected static PARAMETER_INTEGER: Parameter =new Parameter(RegionMatches.PARAMETER_INTEGER_NAME,Schema.ofInteger(RegionMatches.PARAMETER_INTEGER_NAME));
35
-
36
- protected static PARAMETER_BOOLEAN: Parameter =new Parameter(RegionMatches.PARAMETER_BOOLEAN_NAME,Schema.ofBoolean(RegionMatches.PARAMETER_BOOLEAN_NAME));
37
-
38
- protected static EVENT_BOOLEAN: Event =new Event(Event.OUTPUT,
39
- new Map([
40
- [
41
- RegionMatches.EVENT_RESULT_NAME,
42
- Schema.ofBoolean(RegionMatches.EVENT_RESULT_NAME),
43
- ],
44
- ]),
45
- );
26
+ public static PARAMETER_STRING: Parameter = new Parameter(
27
+ RegionMatches.PARAMETER_STRING_NAME,
28
+ Schema.ofString(RegionMatches.PARAMETER_STRING_NAME),
29
+ );
30
+
31
+ protected static PARAMETER_OTHER_STRING: Parameter = new Parameter(
32
+ RegionMatches.PARAMETER_OTHER_STRING_NAME,
33
+ Schema.ofString(RegionMatches.PARAMETER_OTHER_STRING_NAME),
34
+ );
35
+
36
+ protected static PARAMETER_FIRST_OFFSET: Parameter = new Parameter(
37
+ RegionMatches.PARAMETER_FIRST_OFFSET_NAME,
38
+ Schema.ofInteger(RegionMatches.PARAMETER_FIRST_OFFSET_NAME),
39
+ );
40
+
41
+ protected static PARAMETER_SECOND_OFFSET: Parameter = new Parameter(
42
+ RegionMatches.PARAMETER_SECOND_OFFSET_NAME,
43
+ Schema.ofInteger(RegionMatches.PARAMETER_SECOND_OFFSET_NAME),
44
+ );
45
+
46
+ protected static PARAMETER_INTEGER: Parameter = new Parameter(
47
+ RegionMatches.PARAMETER_INTEGER_NAME,
48
+ Schema.ofInteger(RegionMatches.PARAMETER_INTEGER_NAME),
49
+ );
50
+
51
+ protected static PARAMETER_BOOLEAN: Parameter = new Parameter(
52
+ RegionMatches.PARAMETER_BOOLEAN_NAME,
53
+ Schema.ofBoolean(RegionMatches.PARAMETER_BOOLEAN_NAME),
54
+ );
55
+
56
+ protected static EVENT_BOOLEAN: Event = new Event(
57
+ Event.OUTPUT,
58
+ new Map([
59
+ [RegionMatches.EVENT_RESULT_NAME, Schema.ofBoolean(RegionMatches.EVENT_RESULT_NAME)],
60
+ ]),
61
+ );
46
62
 
47
63
  private signature: FunctionSignature = new FunctionSignature('RegionMatches')
48
64
  .setNamespace(Namespaces.STRING)
@@ -81,10 +97,12 @@ export class RegionMatches extends AbstractFunction {
81
97
  super();
82
98
  }
83
99
 
84
- protected internalExecute(context: FunctionExecutionParameters): FunctionOutput {
100
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
85
101
  let inputString: string = context.getArguments()?.get(RegionMatches.PARAMETER_STRING_NAME);
86
102
  let ignoreCase: boolean = context.getArguments()?.get(RegionMatches.PARAMETER_BOOLEAN_NAME);
87
- let toffSet: number = context.getArguments()?.get(RegionMatches.PARAMETER_FIRST_OFFSET_NAME);
103
+ let toffSet: number = context
104
+ .getArguments()
105
+ ?.get(RegionMatches.PARAMETER_FIRST_OFFSET_NAME);
88
106
  let otherString: string = context
89
107
  ?.getArguments()
90
108
  ?.get(RegionMatches.PARAMETER_OTHER_STRING_NAME);