@abyss-project/console 1.0.40 → 1.0.42

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 (77) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js +1 -2
  3. package/dist/types/constants/index.d.ts +1 -0
  4. package/dist/types/constants/index.js +1 -0
  5. package/dist/types/constants/workflow.constants.d.ts +9 -0
  6. package/dist/types/constants/workflow.constants.js +12 -0
  7. package/dist/types/interface/models/workflow-trigger.model.d.ts +1 -4
  8. package/dist/types/interface/models/workflow-webhook.model.d.ts +1 -0
  9. package/dist/utils/webhook-trigger.utils.d.ts +1 -6
  10. package/dist/utils/webhook-trigger.utils.js +33 -318
  11. package/dist/workflow-expressions/index.d.ts +5 -17
  12. package/dist/workflow-expressions/index.js +9 -58
  13. package/dist/workflow-expressions/resolver.d.ts +2 -6
  14. package/dist/workflow-expressions/resolver.js +31 -220
  15. package/dist/workflow-expressions/types.d.ts +21 -118
  16. package/dist/workflow-expressions/types.js +2 -20
  17. package/package.json +1 -1
  18. package/dist/expressions/functions/array.d.ts +0 -2
  19. package/dist/expressions/functions/array.js +0 -252
  20. package/dist/expressions/functions/crypto.d.ts +0 -2
  21. package/dist/expressions/functions/crypto.js +0 -101
  22. package/dist/expressions/functions/datetime.d.ts +0 -2
  23. package/dist/expressions/functions/datetime.js +0 -256
  24. package/dist/expressions/functions/index.d.ts +0 -7
  25. package/dist/expressions/functions/index.js +0 -46
  26. package/dist/expressions/functions/math.d.ts +0 -2
  27. package/dist/expressions/functions/math.js +0 -174
  28. package/dist/expressions/functions/string.d.ts +0 -2
  29. package/dist/expressions/functions/string.js +0 -301
  30. package/dist/expressions/functions/utility.d.ts +0 -2
  31. package/dist/expressions/functions/utility.js +0 -230
  32. package/dist/expressions/helpers.d.ts +0 -26
  33. package/dist/expressions/helpers.js +0 -132
  34. package/dist/expressions/index.d.ts +0 -5
  35. package/dist/expressions/index.js +0 -16
  36. package/dist/expressions/mapper.d.ts +0 -9
  37. package/dist/expressions/mapper.js +0 -88
  38. package/dist/expressions/parser.d.ts +0 -3
  39. package/dist/expressions/parser.js +0 -97
  40. package/dist/expressions/pipes/array-pipes.d.ts +0 -2
  41. package/dist/expressions/pipes/array-pipes.js +0 -248
  42. package/dist/expressions/pipes/index.d.ts +0 -8
  43. package/dist/expressions/pipes/index.js +0 -40
  44. package/dist/expressions/pipes/object-pipes.d.ts +0 -2
  45. package/dist/expressions/pipes/object-pipes.js +0 -243
  46. package/dist/expressions/pipes/string-pipes.d.ts +0 -9
  47. package/dist/expressions/pipes/string-pipes.js +0 -178
  48. package/dist/expressions/resolver.d.ts +0 -12
  49. package/dist/expressions/resolver.js +0 -88
  50. package/dist/expressions/types.d.ts +0 -36
  51. package/dist/expressions/types.js +0 -2
  52. package/dist/workflow-expressions/functions/array.d.ts +0 -2
  53. package/dist/workflow-expressions/functions/array.js +0 -252
  54. package/dist/workflow-expressions/functions/crypto.d.ts +0 -2
  55. package/dist/workflow-expressions/functions/crypto.js +0 -101
  56. package/dist/workflow-expressions/functions/datetime.d.ts +0 -2
  57. package/dist/workflow-expressions/functions/datetime.js +0 -256
  58. package/dist/workflow-expressions/functions/index.d.ts +0 -7
  59. package/dist/workflow-expressions/functions/index.js +0 -46
  60. package/dist/workflow-expressions/functions/math.d.ts +0 -2
  61. package/dist/workflow-expressions/functions/math.js +0 -174
  62. package/dist/workflow-expressions/functions/string.d.ts +0 -2
  63. package/dist/workflow-expressions/functions/string.js +0 -301
  64. package/dist/workflow-expressions/functions/utility.d.ts +0 -2
  65. package/dist/workflow-expressions/functions/utility.js +0 -230
  66. package/dist/workflow-expressions/helpers.d.ts +0 -71
  67. package/dist/workflow-expressions/helpers.js +0 -262
  68. package/dist/workflow-expressions/parser.d.ts +0 -8
  69. package/dist/workflow-expressions/parser.js +0 -456
  70. package/dist/workflow-expressions/pipes/array-pipes.d.ts +0 -2
  71. package/dist/workflow-expressions/pipes/array-pipes.js +0 -248
  72. package/dist/workflow-expressions/pipes/index.d.ts +0 -8
  73. package/dist/workflow-expressions/pipes/index.js +0 -40
  74. package/dist/workflow-expressions/pipes/object-pipes.d.ts +0 -2
  75. package/dist/workflow-expressions/pipes/object-pipes.js +0 -243
  76. package/dist/workflow-expressions/pipes/string-pipes.d.ts +0 -9
  77. package/dist/workflow-expressions/pipes/string-pipes.js +0 -178
@@ -1,252 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.arrayFunctions = void 0;
4
- exports.arrayFunctions = {
5
- length: {
6
- name: 'length',
7
- description: 'Returns the length of a string or array',
8
- category: 'array',
9
- signature: 'length(value)',
10
- args: [
11
- {
12
- name: 'value',
13
- type: 'string|array',
14
- required: true,
15
- description: 'String or array',
16
- },
17
- ],
18
- returnType: 'number',
19
- examples: ['{{fn.length(trigger.items)}}'],
20
- execute: (value) => {
21
- if (typeof value === 'string') {
22
- return value.length;
23
- }
24
- if (Array.isArray(value)) {
25
- return value.length;
26
- }
27
- return 0;
28
- },
29
- },
30
- first: {
31
- name: 'first',
32
- description: 'Returns the first element of an array',
33
- category: 'array',
34
- signature: 'first(arr)',
35
- args: [
36
- {
37
- name: 'arr',
38
- type: 'array',
39
- required: true,
40
- description: 'Input array',
41
- },
42
- ],
43
- returnType: 'any',
44
- examples: ['{{fn.first(trigger.items)}}'],
45
- execute: (arr) => {
46
- if (Array.isArray(arr) && arr.length > 0) {
47
- return arr[0];
48
- }
49
- return undefined;
50
- },
51
- },
52
- last: {
53
- name: 'last',
54
- description: 'Returns the last element of an array',
55
- category: 'array',
56
- signature: 'last(arr)',
57
- args: [
58
- {
59
- name: 'arr',
60
- type: 'array',
61
- required: true,
62
- description: 'Input array',
63
- },
64
- ],
65
- returnType: 'any',
66
- examples: ['{{fn.last(trigger.items)}}'],
67
- execute: (arr) => {
68
- if (Array.isArray(arr) && arr.length > 0) {
69
- return arr[arr.length - 1];
70
- }
71
- return undefined;
72
- },
73
- },
74
- join: {
75
- name: 'join',
76
- description: 'Joins array elements into a string',
77
- category: 'array',
78
- signature: 'join(arr, separator)',
79
- args: [
80
- {
81
- name: 'arr',
82
- type: 'array',
83
- required: true,
84
- description: 'Input array',
85
- },
86
- {
87
- name: 'separator',
88
- type: 'string',
89
- required: false,
90
- description: 'Separator (default: ",")',
91
- },
92
- ],
93
- returnType: 'string',
94
- examples: ['{{fn.join(trigger.tags, ", ")}}'],
95
- execute: (arr, separator) => {
96
- if (!Array.isArray(arr)) {
97
- return '';
98
- }
99
- return arr.join(separator !== undefined ? String(separator) : ',');
100
- },
101
- },
102
- slice: {
103
- name: 'slice',
104
- description: 'Extracts a section of an array',
105
- category: 'array',
106
- signature: 'slice(arr, start, end?)',
107
- args: [
108
- {
109
- name: 'arr',
110
- type: 'array',
111
- required: true,
112
- description: 'Input array',
113
- },
114
- {
115
- name: 'start',
116
- type: 'number',
117
- required: true,
118
- description: 'Start index',
119
- },
120
- {
121
- name: 'end',
122
- type: 'number',
123
- required: false,
124
- description: 'End index',
125
- },
126
- ],
127
- returnType: 'array',
128
- examples: ['{{fn.slice(trigger.items, 0, 3)}}'],
129
- execute: (arr, start, end) => {
130
- if (!Array.isArray(arr)) {
131
- return [];
132
- }
133
- return arr.slice(Number(start), end !== undefined ? Number(end) : undefined);
134
- },
135
- },
136
- includes: {
137
- name: 'includes',
138
- description: 'Checks if an array includes a value',
139
- category: 'array',
140
- signature: 'includes(arr, value)',
141
- args: [
142
- {
143
- name: 'arr',
144
- type: 'array',
145
- required: true,
146
- description: 'Input array',
147
- },
148
- {
149
- name: 'value',
150
- type: 'any',
151
- required: true,
152
- description: 'Value to search for',
153
- },
154
- ],
155
- returnType: 'boolean',
156
- examples: ['{{fn.includes(trigger.roles, "admin")}}'],
157
- execute: (arr, value) => {
158
- if (!Array.isArray(arr)) {
159
- return false;
160
- }
161
- return arr.includes(value);
162
- },
163
- },
164
- reverse: {
165
- name: 'reverse',
166
- description: 'Reverses the order of array elements',
167
- category: 'array',
168
- signature: 'reverse(arr)',
169
- args: [
170
- {
171
- name: 'arr',
172
- type: 'array',
173
- required: true,
174
- description: 'Input array',
175
- },
176
- ],
177
- returnType: 'array',
178
- examples: ['{{fn.reverse(trigger.items)}}'],
179
- execute: (arr) => {
180
- if (!Array.isArray(arr)) {
181
- return [];
182
- }
183
- return [...arr].reverse();
184
- },
185
- },
186
- unique: {
187
- name: 'unique',
188
- description: 'Returns unique elements from an array',
189
- category: 'array',
190
- signature: 'unique(arr)',
191
- args: [
192
- {
193
- name: 'arr',
194
- type: 'array',
195
- required: true,
196
- description: 'Input array',
197
- },
198
- ],
199
- returnType: 'array',
200
- examples: ['{{fn.unique(trigger.tags)}}'],
201
- execute: (arr) => {
202
- if (!Array.isArray(arr)) {
203
- return [];
204
- }
205
- return Array.from(new Set(arr));
206
- },
207
- },
208
- flatten: {
209
- name: 'flatten',
210
- description: 'Flattens a nested array by one level',
211
- category: 'array',
212
- signature: 'flatten(arr)',
213
- args: [
214
- {
215
- name: 'arr',
216
- type: 'array',
217
- required: true,
218
- description: 'Input array',
219
- },
220
- ],
221
- returnType: 'array',
222
- examples: ['{{fn.flatten([[1, 2], [3, 4]])}}'],
223
- execute: (arr) => {
224
- if (!Array.isArray(arr)) {
225
- return [];
226
- }
227
- return arr.flat();
228
- },
229
- },
230
- compact: {
231
- name: 'compact',
232
- description: 'Removes falsy values from an array',
233
- category: 'array',
234
- signature: 'compact(arr)',
235
- args: [
236
- {
237
- name: 'arr',
238
- type: 'array',
239
- required: true,
240
- description: 'Input array',
241
- },
242
- ],
243
- returnType: 'array',
244
- examples: ['{{fn.compact([0, 1, false, 2, "", 3])}}'],
245
- execute: (arr) => {
246
- if (!Array.isArray(arr)) {
247
- return [];
248
- }
249
- return arr.filter(Boolean);
250
- },
251
- },
252
- };
@@ -1,2 +0,0 @@
1
- import type { BuiltInFunction } from '../types';
2
- export declare const cryptoFunctions: Record<string, BuiltInFunction>;
@@ -1,101 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cryptoFunctions = void 0;
4
- const crypto_1 = require("crypto");
5
- exports.cryptoFunctions = {
6
- md5: {
7
- name: 'md5',
8
- description: 'Generates an MD5 hash of the input string',
9
- category: 'crypto',
10
- signature: 'md5(str)',
11
- args: [
12
- {
13
- name: 'str',
14
- type: 'string',
15
- required: true,
16
- description: 'Input string',
17
- },
18
- ],
19
- returnType: 'string',
20
- examples: ['{{fn.md5(trigger.password)}}'],
21
- execute: (str) => {
22
- return (0, crypto_1.createHash)('md5').update(String(str)).digest('hex');
23
- },
24
- },
25
- sha1: {
26
- name: 'sha1',
27
- description: 'Generates a SHA-1 hash of the input string',
28
- category: 'crypto',
29
- signature: 'sha1(str)',
30
- args: [
31
- {
32
- name: 'str',
33
- type: 'string',
34
- required: true,
35
- description: 'Input string',
36
- },
37
- ],
38
- returnType: 'string',
39
- examples: ['{{fn.sha1(trigger.data)}}'],
40
- execute: (str) => {
41
- return (0, crypto_1.createHash)('sha1').update(String(str)).digest('hex');
42
- },
43
- },
44
- sha256: {
45
- name: 'sha256',
46
- description: 'Generates a SHA-256 hash of the input string',
47
- category: 'crypto',
48
- signature: 'sha256(str)',
49
- args: [
50
- {
51
- name: 'str',
52
- type: 'string',
53
- required: true,
54
- description: 'Input string',
55
- },
56
- ],
57
- returnType: 'string',
58
- examples: ['{{fn.sha256(trigger.data)}}'],
59
- execute: (str) => {
60
- return (0, crypto_1.createHash)('sha256').update(String(str)).digest('hex');
61
- },
62
- },
63
- sha512: {
64
- name: 'sha512',
65
- description: 'Generates a SHA-512 hash of the input string',
66
- category: 'crypto',
67
- signature: 'sha512(str)',
68
- args: [
69
- {
70
- name: 'str',
71
- type: 'string',
72
- required: true,
73
- description: 'Input string',
74
- },
75
- ],
76
- returnType: 'string',
77
- examples: ['{{fn.sha512(trigger.data)}}'],
78
- execute: (str) => {
79
- return (0, crypto_1.createHash)('sha512').update(String(str)).digest('hex');
80
- },
81
- },
82
- randomBytes: {
83
- name: 'randomBytes',
84
- description: 'Generates random bytes as a hex string',
85
- category: 'crypto',
86
- signature: 'randomBytes(size)',
87
- args: [
88
- {
89
- name: 'size',
90
- type: 'number',
91
- required: true,
92
- description: 'Number of bytes',
93
- },
94
- ],
95
- returnType: 'string',
96
- examples: ['{{fn.randomBytes(16)}}'],
97
- execute: (size) => {
98
- return (0, crypto_1.randomBytes)(Number(size)).toString('hex');
99
- },
100
- },
101
- };
@@ -1,2 +0,0 @@
1
- import type { BuiltInFunction } from '../types';
2
- export declare const datetimeFunctions: Record<string, BuiltInFunction>;
@@ -1,256 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.datetimeFunctions = void 0;
4
- const date_fns_1 = require("date-fns");
5
- exports.datetimeFunctions = {
6
- now: {
7
- name: 'now',
8
- description: 'Returns the current date and time in ISO format',
9
- category: 'datetime',
10
- signature: 'now()',
11
- args: [],
12
- returnType: 'string',
13
- examples: ['{{fn.now()}}', '{{now()}}'],
14
- execute: () => new Date().toISOString(),
15
- },
16
- timestamp: {
17
- name: 'timestamp',
18
- description: 'Returns the current Unix timestamp in milliseconds',
19
- category: 'datetime',
20
- signature: 'timestamp()',
21
- args: [],
22
- returnType: 'number',
23
- examples: ['{{fn.timestamp()}}', '{{timestamp()}}'],
24
- execute: () => Date.now(),
25
- },
26
- formatDate: {
27
- name: 'formatDate',
28
- description: 'Formats a date string with the specified format',
29
- category: 'datetime',
30
- signature: 'formatDate(date, format)',
31
- args: [
32
- {
33
- name: 'date',
34
- type: 'string',
35
- required: true,
36
- description: 'ISO date string',
37
- },
38
- {
39
- name: 'format',
40
- type: 'string',
41
- required: true,
42
- description: 'Format pattern (e.g., yyyy-MM-dd)',
43
- },
44
- ],
45
- returnType: 'string',
46
- examples: ['{{fn.formatDate(trigger.createdAt, "yyyy-MM-dd")}}'],
47
- execute: (date, formatStr) => {
48
- const d = new Date(date);
49
- return (0, date_fns_1.format)(d, formatStr);
50
- },
51
- },
52
- addDays: {
53
- name: 'addDays',
54
- description: 'Adds days to a date',
55
- category: 'datetime',
56
- signature: 'addDays(date, days)',
57
- args: [
58
- {
59
- name: 'date',
60
- type: 'string',
61
- required: true,
62
- description: 'ISO date string',
63
- },
64
- {
65
- name: 'days',
66
- type: 'number',
67
- required: true,
68
- description: 'Number of days to add',
69
- },
70
- ],
71
- returnType: 'string',
72
- examples: ['{{fn.addDays(fn.now(), 7)}}'],
73
- execute: (date, days) => {
74
- const d = new Date(date);
75
- return (0, date_fns_1.addDays)(d, days).toISOString();
76
- },
77
- },
78
- addHours: {
79
- name: 'addHours',
80
- description: 'Adds hours to a date',
81
- category: 'datetime',
82
- signature: 'addHours(date, hours)',
83
- args: [
84
- {
85
- name: 'date',
86
- type: 'string',
87
- required: true,
88
- description: 'ISO date string',
89
- },
90
- {
91
- name: 'hours',
92
- type: 'number',
93
- required: true,
94
- description: 'Number of hours to add',
95
- },
96
- ],
97
- returnType: 'string',
98
- examples: ['{{fn.addHours(fn.now(), 24)}}'],
99
- execute: (date, hours) => {
100
- const d = new Date(date);
101
- return (0, date_fns_1.addHours)(d, hours).toISOString();
102
- },
103
- },
104
- addMinutes: {
105
- name: 'addMinutes',
106
- description: 'Adds minutes to a date',
107
- category: 'datetime',
108
- signature: 'addMinutes(date, minutes)',
109
- args: [
110
- {
111
- name: 'date',
112
- type: 'string',
113
- required: true,
114
- description: 'ISO date string',
115
- },
116
- {
117
- name: 'minutes',
118
- type: 'number',
119
- required: true,
120
- description: 'Number of minutes to add',
121
- },
122
- ],
123
- returnType: 'string',
124
- examples: ['{{fn.addMinutes(fn.now(), 30)}}'],
125
- execute: (date, minutes) => {
126
- const d = new Date(date);
127
- return (0, date_fns_1.addMinutes)(d, minutes).toISOString();
128
- },
129
- },
130
- addSeconds: {
131
- name: 'addSeconds',
132
- description: 'Adds seconds to a date',
133
- category: 'datetime',
134
- signature: 'addSeconds(date, seconds)',
135
- args: [
136
- {
137
- name: 'date',
138
- type: 'string',
139
- required: true,
140
- description: 'ISO date string',
141
- },
142
- {
143
- name: 'seconds',
144
- type: 'number',
145
- required: true,
146
- description: 'Number of seconds to add',
147
- },
148
- ],
149
- returnType: 'string',
150
- examples: ['{{fn.addSeconds(fn.now(), 60)}}'],
151
- execute: (date, seconds) => {
152
- const d = new Date(date);
153
- return (0, date_fns_1.addSeconds)(d, seconds).toISOString();
154
- },
155
- },
156
- diffDays: {
157
- name: 'diffDays',
158
- description: 'Returns the difference in days between two dates',
159
- category: 'datetime',
160
- signature: 'diffDays(date1, date2)',
161
- args: [
162
- {
163
- name: 'date1',
164
- type: 'string',
165
- required: true,
166
- description: 'First ISO date string',
167
- },
168
- {
169
- name: 'date2',
170
- type: 'string',
171
- required: true,
172
- description: 'Second ISO date string',
173
- },
174
- ],
175
- returnType: 'number',
176
- examples: ['{{fn.diffDays(trigger.startDate, fn.now())}}'],
177
- execute: (date1, date2) => {
178
- return (0, date_fns_1.differenceInDays)(new Date(date1), new Date(date2));
179
- },
180
- },
181
- diffHours: {
182
- name: 'diffHours',
183
- description: 'Returns the difference in hours between two dates',
184
- category: 'datetime',
185
- signature: 'diffHours(date1, date2)',
186
- args: [
187
- {
188
- name: 'date1',
189
- type: 'string',
190
- required: true,
191
- description: 'First ISO date string',
192
- },
193
- {
194
- name: 'date2',
195
- type: 'string',
196
- required: true,
197
- description: 'Second ISO date string',
198
- },
199
- ],
200
- returnType: 'number',
201
- examples: ['{{fn.diffHours(trigger.startDate, fn.now())}}'],
202
- execute: (date1, date2) => {
203
- return (0, date_fns_1.differenceInHours)(new Date(date1), new Date(date2));
204
- },
205
- },
206
- diffMinutes: {
207
- name: 'diffMinutes',
208
- description: 'Returns the difference in minutes between two dates',
209
- category: 'datetime',
210
- signature: 'diffMinutes(date1, date2)',
211
- args: [
212
- {
213
- name: 'date1',
214
- type: 'string',
215
- required: true,
216
- description: 'First ISO date string',
217
- },
218
- {
219
- name: 'date2',
220
- type: 'string',
221
- required: true,
222
- description: 'Second ISO date string',
223
- },
224
- ],
225
- returnType: 'number',
226
- examples: ['{{fn.diffMinutes(trigger.startDate, fn.now())}}'],
227
- execute: (date1, date2) => {
228
- return (0, date_fns_1.differenceInMinutes)(new Date(date1), new Date(date2));
229
- },
230
- },
231
- diffSeconds: {
232
- name: 'diffSeconds',
233
- description: 'Returns the difference in seconds between two dates',
234
- category: 'datetime',
235
- signature: 'diffSeconds(date1, date2)',
236
- args: [
237
- {
238
- name: 'date1',
239
- type: 'string',
240
- required: true,
241
- description: 'First ISO date string',
242
- },
243
- {
244
- name: 'date2',
245
- type: 'string',
246
- required: true,
247
- description: 'Second ISO date string',
248
- },
249
- ],
250
- returnType: 'number',
251
- examples: ['{{fn.diffSeconds(trigger.startDate, fn.now())}}'],
252
- execute: (date1, date2) => {
253
- return (0, date_fns_1.differenceInSeconds)(new Date(date1), new Date(date2));
254
- },
255
- },
256
- };
@@ -1,7 +0,0 @@
1
- import type { BuiltInFunction, FunctionCategory } from '../types';
2
- export declare const BUILT_IN_FUNCTIONS: Record<string, BuiltInFunction>;
3
- export declare function executeFunction(name: string, args: unknown[]): unknown;
4
- export declare function getFunctionsByCategory(category: FunctionCategory): Record<string, BuiltInFunction>;
5
- export declare function getFunctionNames(): string[];
6
- export declare function hasFunction(name: string): boolean;
7
- export declare function getFunction(name: string): BuiltInFunction | undefined;
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFunction = exports.hasFunction = exports.getFunctionNames = exports.getFunctionsByCategory = exports.executeFunction = exports.BUILT_IN_FUNCTIONS = void 0;
4
- const datetime_1 = require("./datetime");
5
- const string_1 = require("./string");
6
- const math_1 = require("./math");
7
- const crypto_1 = require("./crypto");
8
- const array_1 = require("./array");
9
- const utility_1 = require("./utility");
10
- exports.BUILT_IN_FUNCTIONS = {
11
- ...datetime_1.datetimeFunctions,
12
- ...string_1.stringFunctions,
13
- ...math_1.mathFunctions,
14
- ...crypto_1.cryptoFunctions,
15
- ...array_1.arrayFunctions,
16
- ...utility_1.utilityFunctions,
17
- };
18
- function executeFunction(name, args) {
19
- const func = exports.BUILT_IN_FUNCTIONS[name];
20
- if (!func) {
21
- throw new Error(`Unknown function: ${name}`);
22
- }
23
- return func.execute(...args);
24
- }
25
- exports.executeFunction = executeFunction;
26
- function getFunctionsByCategory(category) {
27
- return Object.entries(exports.BUILT_IN_FUNCTIONS)
28
- .filter(([, func]) => func.category === category)
29
- .reduce((acc, [name, func]) => {
30
- acc[name] = func;
31
- return acc;
32
- }, {});
33
- }
34
- exports.getFunctionsByCategory = getFunctionsByCategory;
35
- function getFunctionNames() {
36
- return Object.keys(exports.BUILT_IN_FUNCTIONS);
37
- }
38
- exports.getFunctionNames = getFunctionNames;
39
- function hasFunction(name) {
40
- return name in exports.BUILT_IN_FUNCTIONS;
41
- }
42
- exports.hasFunction = hasFunction;
43
- function getFunction(name) {
44
- return exports.BUILT_IN_FUNCTIONS[name];
45
- }
46
- exports.getFunction = getFunction;
@@ -1,2 +0,0 @@
1
- import type { BuiltInFunction } from '../types';
2
- export declare const mathFunctions: Record<string, BuiltInFunction>;