@fincity/kirun-js 1.6.4 → 1.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,212 @@
1
+ import {
2
+ FunctionExecutionParameters,
3
+ KIRunFunctionRepository,
4
+ KIRunSchemaRepository,
5
+ MapUtil,
6
+ } from '../../../../../src';
7
+ import { ObjectEntries } from '../../../../../src/engine/function/system/object/ObjectEntries';
8
+
9
+ const objEnt: ObjectEntries = new ObjectEntries();
10
+
11
+ test('entry test 1', async () => {
12
+ let obj = { a: 1, b: 2, d: ['a', 'b', 'c'] };
13
+
14
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
15
+ new KIRunFunctionRepository(),
16
+ new KIRunSchemaRepository(),
17
+ );
18
+
19
+ fep.setArguments(MapUtil.of('source', obj));
20
+
21
+ let res = [
22
+ ['a', 1],
23
+ ['b', 2],
24
+ ['d', ['a', 'b', 'c']],
25
+ ];
26
+
27
+ expect((await objEnt.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
28
+ res,
29
+ );
30
+ });
31
+
32
+ test('entry null test ', async () => {
33
+ let obj = null;
34
+
35
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
36
+ new KIRunFunctionRepository(),
37
+ new KIRunSchemaRepository(),
38
+ );
39
+
40
+ fep.setArguments(MapUtil.of('source', obj));
41
+
42
+ expect((await objEnt.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
43
+ [],
44
+ );
45
+ });
46
+
47
+ test('entry undefined test ', async () => {
48
+ let obj;
49
+
50
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
51
+ new KIRunFunctionRepository(),
52
+ new KIRunSchemaRepository(),
53
+ );
54
+
55
+ fep.setArguments(MapUtil.of('source', obj));
56
+
57
+ expect((await objEnt.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
58
+ [],
59
+ );
60
+ });
61
+
62
+ test('entry primitive number test ', async () => {
63
+ let obj = 423;
64
+
65
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
66
+ new KIRunFunctionRepository(),
67
+ new KIRunSchemaRepository(),
68
+ );
69
+
70
+ fep.setArguments(MapUtil.of('source', obj));
71
+
72
+ expect((await objEnt.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
73
+ [],
74
+ );
75
+ });
76
+
77
+ test('entry primitive boolean test ', async () => {
78
+ let obj = false;
79
+
80
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
81
+ new KIRunFunctionRepository(),
82
+ new KIRunSchemaRepository(),
83
+ );
84
+
85
+ fep.setArguments(MapUtil.of('source', obj));
86
+
87
+ expect((await objEnt.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
88
+ [],
89
+ );
90
+ });
91
+
92
+ test('entry primitive String test ', async () => {
93
+ let obj = 'surendhar';
94
+
95
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
96
+ new KIRunFunctionRepository(),
97
+ new KIRunSchemaRepository(),
98
+ );
99
+
100
+ fep.setArguments(MapUtil.of('source', obj));
101
+
102
+ expect((await objEnt.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual([
103
+ ['0', 's'],
104
+ ['1', 'u'],
105
+ ['2', 'r'],
106
+ ['3', 'e'],
107
+ ['4', 'n'],
108
+ ['5', 'd'],
109
+ ['6', 'h'],
110
+ ['7', 'a'],
111
+ ['8', 'r'],
112
+ ]);
113
+ });
114
+
115
+ test('entry nested object test', async () => {
116
+ let obj = { a: { b: { c: { d: { e: [1, 2, 4, 5] } } } }, c: ['q', 'w', 'e', 'r'] };
117
+
118
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
119
+ new KIRunFunctionRepository(),
120
+ new KIRunSchemaRepository(),
121
+ );
122
+
123
+ fep.setArguments(MapUtil.of('source', obj));
124
+
125
+ let res: any[] = [
126
+ ['a', { b: { c: { d: { e: [1, 2, 4, 5] } } } }],
127
+ ['c', ['q', 'w', 'e', 'r']],
128
+ ];
129
+
130
+ expect((await objEnt.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
131
+ res,
132
+ );
133
+ });
134
+
135
+ test(' entry array test ', async () => {
136
+ let obj = [1, 2, 3, 4, 1, 12, 3, 4, 5];
137
+
138
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
139
+ new KIRunFunctionRepository(),
140
+ new KIRunSchemaRepository(),
141
+ );
142
+
143
+ fep.setArguments(MapUtil.of('source', obj));
144
+
145
+ let res: any[] = [
146
+ ['0', 1],
147
+ ['1', 2],
148
+ ['2', 3],
149
+ ['3', 4],
150
+ ['4', 1],
151
+ ['5', 12],
152
+ ['6', 3],
153
+ ['7', 4],
154
+ ['8', 5],
155
+ ];
156
+
157
+ expect((await objEnt.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
158
+ res,
159
+ );
160
+ });
161
+
162
+ test(' entry duplicate entry test ', async () => {
163
+ let parent = { a: { b: 'c' }, k: { b: 'c' } };
164
+
165
+ let obj = { ...parent, a: 'overridden', k: ' so only child objects are returned from child ' }; // trying to replicate duplicate
166
+
167
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
168
+ new KIRunFunctionRepository(),
169
+ new KIRunSchemaRepository(),
170
+ );
171
+
172
+ fep.setArguments(MapUtil.of('source', obj));
173
+
174
+ let childRes: any[] = [
175
+ ['a', 'overridden'],
176
+ ['k', ' so only child objects are returned from child '],
177
+ ];
178
+
179
+ expect((await objEnt.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
180
+ childRes,
181
+ );
182
+
183
+ let parentRes: any[] = [
184
+ ['a', { b: 'c' }],
185
+ ['k', { b: 'c' }],
186
+ ];
187
+
188
+ fep.setArguments(MapUtil.of('source', parent));
189
+
190
+ expect((await objEnt.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
191
+ parentRes,
192
+ );
193
+ });
194
+
195
+ test('entry primitive String test ', async () => {
196
+ let obj = 'ab cd';
197
+
198
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
199
+ new KIRunFunctionRepository(),
200
+ new KIRunSchemaRepository(),
201
+ );
202
+
203
+ fep.setArguments(MapUtil.of('source', obj));
204
+
205
+ expect((await objEnt.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual([
206
+ ['0', 'a'],
207
+ ['1', 'b'],
208
+ ['2', ' '],
209
+ ['3', 'c'],
210
+ ['4', 'd'],
211
+ ]);
212
+ });
@@ -0,0 +1,168 @@
1
+ import {
2
+ FunctionExecutionParameters,
3
+ KIRunFunctionRepository,
4
+ KIRunSchemaRepository,
5
+ MapUtil,
6
+ } from '../../../../../src';
7
+ import { ObjectKeys } from '../../../../../src/engine/function/system/object/ObjectKeys';
8
+
9
+ const objKeys: ObjectKeys = new ObjectKeys();
10
+
11
+ test('keys test 1', async () => {
12
+ let obj = { a: 1, b: 2, d: ['a', 'b', 'c'] };
13
+
14
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
15
+ new KIRunFunctionRepository(),
16
+ new KIRunSchemaRepository(),
17
+ );
18
+
19
+ fep.setArguments(MapUtil.of('source', obj));
20
+
21
+ let res = ['a', 'b', 'd'];
22
+
23
+ expect((await objKeys.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
24
+ res,
25
+ );
26
+ });
27
+
28
+ test('entry null test ', async () => {
29
+ let obj = null;
30
+
31
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
32
+ new KIRunFunctionRepository(),
33
+ new KIRunSchemaRepository(),
34
+ );
35
+
36
+ fep.setArguments(MapUtil.of('source', obj));
37
+
38
+ expect((await objKeys.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
39
+ [],
40
+ );
41
+ });
42
+
43
+ test('entry undefined test ', async () => {
44
+ let obj;
45
+
46
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
47
+ new KIRunFunctionRepository(),
48
+ new KIRunSchemaRepository(),
49
+ );
50
+
51
+ fep.setArguments(MapUtil.of('source', obj));
52
+
53
+ expect((await objKeys.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
54
+ [],
55
+ );
56
+ });
57
+
58
+ test('entry primitive number test ', async () => {
59
+ let obj = 423;
60
+
61
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
62
+ new KIRunFunctionRepository(),
63
+ new KIRunSchemaRepository(),
64
+ );
65
+
66
+ fep.setArguments(MapUtil.of('source', obj));
67
+
68
+ expect((await objKeys.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
69
+ [],
70
+ );
71
+ });
72
+
73
+ test('entry primitive boolean test ', async () => {
74
+ let obj = false;
75
+
76
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
77
+ new KIRunFunctionRepository(),
78
+ new KIRunSchemaRepository(),
79
+ );
80
+
81
+ fep.setArguments(MapUtil.of('source', obj));
82
+
83
+ expect((await objKeys.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
84
+ [],
85
+ );
86
+ });
87
+
88
+ test('entry primitive String test ', async () => {
89
+ let obj = 'surendhar';
90
+
91
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
92
+ new KIRunFunctionRepository(),
93
+ new KIRunSchemaRepository(),
94
+ );
95
+
96
+ fep.setArguments(MapUtil.of('source', obj));
97
+
98
+ expect((await objKeys.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual([
99
+ '0',
100
+ '1',
101
+ '2',
102
+ '3',
103
+ '4',
104
+ '5',
105
+ '6',
106
+ '7',
107
+ '8',
108
+ ]);
109
+ });
110
+
111
+ test('entry nested object test', async () => {
112
+ let obj = { a: { b: { c: { d: { e: [1, 2, 4, 5] } } } }, c: ['q', 'w', 'e', 'r'] };
113
+
114
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
115
+ new KIRunFunctionRepository(),
116
+ new KIRunSchemaRepository(),
117
+ );
118
+
119
+ fep.setArguments(MapUtil.of('source', obj));
120
+
121
+ let res: any[] = ['a', 'c'];
122
+
123
+ expect((await objKeys.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
124
+ res,
125
+ );
126
+ });
127
+
128
+ test(' entry array test ', async () => {
129
+ let obj = [1, 2, 3, 4, 1, 12, 3, 4, 5];
130
+
131
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
132
+ new KIRunFunctionRepository(),
133
+ new KIRunSchemaRepository(),
134
+ );
135
+
136
+ fep.setArguments(MapUtil.of('source', obj));
137
+
138
+ let res: any[] = ['0', '1', '2', '3', '4', '5', '6', '7', '8'];
139
+
140
+ expect((await objKeys.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
141
+ res,
142
+ );
143
+ });
144
+
145
+ test(' entry duplicate entry test ', async () => {
146
+ let parent = { a: { b: 'c' }, k: { b: 'c' } };
147
+
148
+ let obj = { ...parent, a: 'overridden', k: ' so only child objects are returned from child ' }; // trying to replicate duplicate
149
+
150
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
151
+ new KIRunFunctionRepository(),
152
+ new KIRunSchemaRepository(),
153
+ );
154
+
155
+ fep.setArguments(MapUtil.of('source', obj));
156
+
157
+ let childRes: any[] = ['a', 'k'];
158
+
159
+ expect((await objKeys.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
160
+ childRes,
161
+ );
162
+
163
+ fep.setArguments(MapUtil.of('source', parent));
164
+
165
+ expect((await objKeys.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
166
+ childRes,
167
+ );
168
+ });
@@ -0,0 +1,170 @@
1
+ import {
2
+ FunctionExecutionParameters,
3
+ KIRunFunctionRepository,
4
+ KIRunSchemaRepository,
5
+ MapUtil,
6
+ } from '../../../../../src';
7
+ import { ObjectValues } from '../../../../../src/engine/function/system/object/ObjectValues';
8
+
9
+ const objVals: ObjectValues = new ObjectValues();
10
+
11
+ test('entry test 1', async () => {
12
+ let obj = { a: 1, b: 2, d: ['a', 'b', 'c'] };
13
+
14
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
15
+ new KIRunFunctionRepository(),
16
+ new KIRunSchemaRepository(),
17
+ );
18
+
19
+ fep.setArguments(MapUtil.of('source', obj));
20
+
21
+ let res = [1, 2, ['a', 'b', 'c']];
22
+
23
+ expect((await objVals.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
24
+ res,
25
+ );
26
+ });
27
+
28
+ test('entry null test ', async () => {
29
+ let obj = null;
30
+
31
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
32
+ new KIRunFunctionRepository(),
33
+ new KIRunSchemaRepository(),
34
+ );
35
+
36
+ fep.setArguments(MapUtil.of('source', obj));
37
+
38
+ expect((await objVals.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
39
+ [],
40
+ );
41
+ });
42
+
43
+ test('entry undefined test ', async () => {
44
+ let obj;
45
+
46
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
47
+ new KIRunFunctionRepository(),
48
+ new KIRunSchemaRepository(),
49
+ );
50
+
51
+ fep.setArguments(MapUtil.of('source', obj));
52
+
53
+ expect((await objVals.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
54
+ [],
55
+ );
56
+ });
57
+
58
+ test('entry primitive number test ', async () => {
59
+ let obj = 423;
60
+
61
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
62
+ new KIRunFunctionRepository(),
63
+ new KIRunSchemaRepository(),
64
+ );
65
+
66
+ fep.setArguments(MapUtil.of('source', obj));
67
+
68
+ expect((await objVals.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
69
+ [],
70
+ );
71
+ });
72
+
73
+ test('entry primitive boolean test ', async () => {
74
+ let obj = false;
75
+
76
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
77
+ new KIRunFunctionRepository(),
78
+ new KIRunSchemaRepository(),
79
+ );
80
+
81
+ fep.setArguments(MapUtil.of('source', obj));
82
+
83
+ expect((await objVals.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
84
+ [],
85
+ );
86
+ });
87
+
88
+ test('entry primitive String test ', async () => {
89
+ let obj = 'surendhar';
90
+
91
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
92
+ new KIRunFunctionRepository(),
93
+ new KIRunSchemaRepository(),
94
+ );
95
+
96
+ fep.setArguments(MapUtil.of('source', obj));
97
+
98
+ expect((await objVals.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual([
99
+ 's',
100
+ 'u',
101
+ 'r',
102
+ 'e',
103
+ 'n',
104
+ 'd',
105
+ 'h',
106
+ 'a',
107
+ 'r',
108
+ ]);
109
+ });
110
+
111
+ test('entry nested object test', async () => {
112
+ let obj = { a: { b: { c: { d: { e: [1, 2, 4, 5] } } } }, c: ['q', 'w', 'e', 'r'] };
113
+
114
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
115
+ new KIRunFunctionRepository(),
116
+ new KIRunSchemaRepository(),
117
+ );
118
+
119
+ fep.setArguments(MapUtil.of('source', obj));
120
+
121
+ let res: any[] = [{ b: { c: { d: { e: [1, 2, 4, 5] } } } }, ['q', 'w', 'e', 'r']];
122
+
123
+ expect((await objVals.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
124
+ res,
125
+ );
126
+ });
127
+
128
+ test(' entry array test ', async () => {
129
+ let obj = [1, 2, 3, 4, 1, 12, 3, 4, 5];
130
+
131
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
132
+ new KIRunFunctionRepository(),
133
+ new KIRunSchemaRepository(),
134
+ );
135
+
136
+ fep.setArguments(MapUtil.of('source', obj));
137
+
138
+ let res: any[] = [1, 2, 3, 4, 1, 12, 3, 4, 5];
139
+
140
+ expect((await objVals.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
141
+ res,
142
+ );
143
+ });
144
+
145
+ test(' entry duplicate entry test ', async () => {
146
+ let parent = { a: { b: 'c' }, k: { b: 'c' } };
147
+
148
+ let obj = { ...parent, a: 'overridden', k: ' so only child objects are returned from child ' }; // trying to replicate duplicate
149
+
150
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
151
+ new KIRunFunctionRepository(),
152
+ new KIRunSchemaRepository(),
153
+ );
154
+
155
+ fep.setArguments(MapUtil.of('source', obj));
156
+
157
+ let childRes: any[] = ['overridden', ' so only child objects are returned from child '];
158
+
159
+ expect((await objVals.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
160
+ childRes,
161
+ );
162
+
163
+ let parentRes: any[] = [{ b: 'c' }, { b: 'c' }];
164
+
165
+ fep.setArguments(MapUtil.of('source', parent));
166
+
167
+ expect((await objVals.execute(fep)).allResults()[0]?.getResult()?.get('value')).toStrictEqual(
168
+ parentRes,
169
+ );
170
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fincity/kirun-js",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "Javascript Runtime for Kinetic Instructions",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,31 @@
1
+ import { FunctionOutput } from '../../../model/FunctionOutput';
2
+ import { FunctionSignature } from '../../../model/FunctionSignature';
3
+ import { FunctionExecutionParameters } from '../../../runtime/FunctionExecutionParameters';
4
+ import { AbstractFunction } from '../../AbstractFunction';
5
+
6
+ import { Namespaces } from '../../../namespaces/Namespaces';
7
+ import { Event } from '../../../model/Event';
8
+ import { Schema } from '../../../json/schema/Schema';
9
+ import { Parameter } from '../../../model/Parameter';
10
+
11
+ const VALUE = 'value';
12
+
13
+ const SOURCE = 'source';
14
+
15
+ export abstract class AbstractObjectFunction extends AbstractFunction {
16
+ private SIGNATURE: FunctionSignature;
17
+
18
+ protected constructor(functionName: string) {
19
+ super();
20
+ this.SIGNATURE = new FunctionSignature(functionName)
21
+ .setNamespace(Namespaces.SYSTEM)
22
+ .setParameters(new Map([[SOURCE, new Parameter(SOURCE, Schema.ofAny(SOURCE))]]))
23
+ .setEvents(
24
+ new Map([Event.outputEventMapEntry(new Map([[VALUE, Schema.ofArray(VALUE)]]))]),
25
+ );
26
+ }
27
+
28
+ public getSignature(): FunctionSignature {
29
+ return this.SIGNATURE;
30
+ }
31
+ }
@@ -0,0 +1,25 @@
1
+ import { FunctionOutput } from '../../../model/FunctionOutput';
2
+ import { FunctionExecutionParameters } from '../../../runtime/FunctionExecutionParameters';
3
+
4
+ import { isNullValue } from '../../../util/NullCheck';
5
+ import { EventResult } from '../../../model/EventResult';
6
+ import { AbstractObjectFunction } from './AbstractObjectFunction';
7
+
8
+ const VALUE = 'value';
9
+
10
+ export class ObjectEntries extends AbstractObjectFunction {
11
+ public constructor() {
12
+ super('ObjectEntries');
13
+ }
14
+
15
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
16
+ var source = context.getArguments()?.get('source');
17
+
18
+ if (isNullValue(source))
19
+ return new FunctionOutput([EventResult.outputOf(new Map([[VALUE, []]]))]);
20
+
21
+ let entries = Object.entries(source);
22
+
23
+ return new FunctionOutput([EventResult.outputOf(new Map([[VALUE, entries]]))]);
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ import { FunctionOutput } from '../../../model/FunctionOutput';
2
+ import { FunctionExecutionParameters } from '../../../runtime/FunctionExecutionParameters';
3
+
4
+ import { isNullValue } from '../../../util/NullCheck';
5
+ import { EventResult } from '../../../model/EventResult';
6
+ import { AbstractObjectFunction } from './AbstractObjectFunction';
7
+
8
+ const VALUE = 'value';
9
+
10
+ export class ObjectKeys extends AbstractObjectFunction {
11
+ public constructor() {
12
+ super('ObjectEntries');
13
+ }
14
+
15
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
16
+ var source = context.getArguments()?.get('source');
17
+
18
+ if (isNullValue(source))
19
+ return new FunctionOutput([EventResult.outputOf(new Map([[VALUE, []]]))]);
20
+
21
+ let keys: String[] = Object.keys(source);
22
+
23
+ return new FunctionOutput([EventResult.outputOf(new Map([[VALUE, keys]]))]);
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ import { FunctionOutput } from '../../../model/FunctionOutput';
2
+ import { FunctionExecutionParameters } from '../../../runtime/FunctionExecutionParameters';
3
+
4
+ import { isNullValue } from '../../../util/NullCheck';
5
+ import { EventResult } from '../../../model/EventResult';
6
+ import { AbstractObjectFunction } from './AbstractObjectFunction';
7
+
8
+ const VALUE = 'value';
9
+
10
+ export class ObjectValues extends AbstractObjectFunction {
11
+ public constructor() {
12
+ super('ObjectValues');
13
+ }
14
+
15
+ protected async internalExecute(context: FunctionExecutionParameters): Promise<FunctionOutput> {
16
+ var source = context.getArguments()?.get('source');
17
+
18
+ if (isNullValue(source))
19
+ return new FunctionOutput([EventResult.outputOf(new Map([[VALUE, []]]))]);
20
+
21
+ let objectValues: String[] = Object.values(source);
22
+
23
+ return new FunctionOutput([EventResult.outputOf(new Map([[VALUE, objectValues]]))]);
24
+ }
25
+ }