@abyss-project/console 1.0.41 → 1.0.43

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 (81) hide show
  1. package/dist/constants/abyss-services.d.ts +0 -0
  2. package/dist/constants/abyss-services.js +1 -0
  3. package/dist/index.d.ts +0 -2
  4. package/dist/index.js +1 -3
  5. package/dist/types/constants/workflow.constants.d.ts +4 -0
  6. package/dist/types/constants/workflow.constants.js +5 -1
  7. package/dist/types/dto/workflow.dto.d.ts +5 -1
  8. package/dist/types/enum/workflow.enum.d.ts +2 -1
  9. package/dist/types/enum/workflow.enum.js +1 -0
  10. package/dist/types/interface/models/workflow-webhook.model.d.ts +1 -0
  11. package/dist/utils/index.d.ts +1 -2
  12. package/dist/utils/index.js +1 -2
  13. package/dist/utils/webhook-trigger.utils.d.ts +0 -7
  14. package/dist/utils/webhook-trigger.utils.js +0 -334
  15. package/dist/workflow-expressions/index.d.ts +5 -17
  16. package/dist/workflow-expressions/index.js +9 -58
  17. package/dist/workflow-expressions/resolver.d.ts +2 -6
  18. package/dist/workflow-expressions/resolver.js +46 -229
  19. package/dist/workflow-expressions/types.d.ts +25 -142
  20. package/dist/workflow-expressions/types.js +3 -21
  21. package/package.json +1 -1
  22. package/dist/expressions/functions/array.d.ts +0 -2
  23. package/dist/expressions/functions/array.js +0 -252
  24. package/dist/expressions/functions/crypto.d.ts +0 -2
  25. package/dist/expressions/functions/crypto.js +0 -101
  26. package/dist/expressions/functions/datetime.d.ts +0 -2
  27. package/dist/expressions/functions/datetime.js +0 -256
  28. package/dist/expressions/functions/index.d.ts +0 -7
  29. package/dist/expressions/functions/index.js +0 -46
  30. package/dist/expressions/functions/math.d.ts +0 -2
  31. package/dist/expressions/functions/math.js +0 -174
  32. package/dist/expressions/functions/string.d.ts +0 -2
  33. package/dist/expressions/functions/string.js +0 -301
  34. package/dist/expressions/functions/utility.d.ts +0 -2
  35. package/dist/expressions/functions/utility.js +0 -230
  36. package/dist/expressions/helpers.d.ts +0 -26
  37. package/dist/expressions/helpers.js +0 -132
  38. package/dist/expressions/index.d.ts +0 -5
  39. package/dist/expressions/index.js +0 -16
  40. package/dist/expressions/mapper.d.ts +0 -9
  41. package/dist/expressions/mapper.js +0 -88
  42. package/dist/expressions/parser.d.ts +0 -3
  43. package/dist/expressions/parser.js +0 -97
  44. package/dist/expressions/pipes/array-pipes.d.ts +0 -2
  45. package/dist/expressions/pipes/array-pipes.js +0 -248
  46. package/dist/expressions/pipes/index.d.ts +0 -8
  47. package/dist/expressions/pipes/index.js +0 -40
  48. package/dist/expressions/pipes/object-pipes.d.ts +0 -2
  49. package/dist/expressions/pipes/object-pipes.js +0 -243
  50. package/dist/expressions/pipes/string-pipes.d.ts +0 -9
  51. package/dist/expressions/pipes/string-pipes.js +0 -178
  52. package/dist/expressions/resolver.d.ts +0 -12
  53. package/dist/expressions/resolver.js +0 -88
  54. package/dist/expressions/types.d.ts +0 -36
  55. package/dist/expressions/types.js +0 -2
  56. package/dist/workflow-expressions/functions/array.d.ts +0 -2
  57. package/dist/workflow-expressions/functions/array.js +0 -252
  58. package/dist/workflow-expressions/functions/crypto.d.ts +0 -2
  59. package/dist/workflow-expressions/functions/crypto.js +0 -101
  60. package/dist/workflow-expressions/functions/datetime.d.ts +0 -2
  61. package/dist/workflow-expressions/functions/datetime.js +0 -256
  62. package/dist/workflow-expressions/functions/index.d.ts +0 -7
  63. package/dist/workflow-expressions/functions/index.js +0 -46
  64. package/dist/workflow-expressions/functions/math.d.ts +0 -2
  65. package/dist/workflow-expressions/functions/math.js +0 -174
  66. package/dist/workflow-expressions/functions/string.d.ts +0 -2
  67. package/dist/workflow-expressions/functions/string.js +0 -301
  68. package/dist/workflow-expressions/functions/utility.d.ts +0 -2
  69. package/dist/workflow-expressions/functions/utility.js +0 -230
  70. package/dist/workflow-expressions/helpers.d.ts +0 -71
  71. package/dist/workflow-expressions/helpers.js +0 -262
  72. package/dist/workflow-expressions/parser.d.ts +0 -8
  73. package/dist/workflow-expressions/parser.js +0 -456
  74. package/dist/workflow-expressions/pipes/array-pipes.d.ts +0 -2
  75. package/dist/workflow-expressions/pipes/array-pipes.js +0 -248
  76. package/dist/workflow-expressions/pipes/index.d.ts +0 -8
  77. package/dist/workflow-expressions/pipes/index.js +0 -40
  78. package/dist/workflow-expressions/pipes/object-pipes.d.ts +0 -2
  79. package/dist/workflow-expressions/pipes/object-pipes.js +0 -243
  80. package/dist/workflow-expressions/pipes/string-pipes.d.ts +0 -9
  81. package/dist/workflow-expressions/pipes/string-pipes.js +0 -178
@@ -1,178 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stringPipes = void 0;
4
- exports.stringPipes = {
5
- upper: {
6
- name: 'upper',
7
- description: 'Converts to uppercase',
8
- category: 'string',
9
- signature: 'upper',
10
- examples: ['{{trigger.name | upper}}'],
11
- execute: (value) => String(value).toUpperCase(),
12
- },
13
- lower: {
14
- name: 'lower',
15
- description: 'Converts to lowercase',
16
- category: 'string',
17
- signature: 'lower',
18
- examples: ['{{trigger.email | lower}}'],
19
- execute: (value) => String(value).toLowerCase(),
20
- },
21
- capitalize: {
22
- name: 'capitalize',
23
- description: 'Capitalizes the first letter',
24
- category: 'string',
25
- signature: 'capitalize',
26
- examples: ['{{trigger.name | capitalize}}'],
27
- execute: (value) => {
28
- const str = String(value);
29
- return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
30
- },
31
- },
32
- trim: {
33
- name: 'trim',
34
- description: 'Removes whitespace from both ends',
35
- category: 'string',
36
- signature: 'trim',
37
- examples: ['{{trigger.input | trim}}'],
38
- execute: (value) => String(value).trim(),
39
- },
40
- truncate: {
41
- name: 'truncate',
42
- description: 'Truncates a string to a specified length',
43
- category: 'string',
44
- signature: 'truncate(length)',
45
- examples: ['{{trigger.description | truncate(100)}}'],
46
- execute: (value, length) => {
47
- const str = String(value);
48
- const len = Number(length);
49
- return str.length > len ? str.substring(0, len) + '...' : str;
50
- },
51
- },
52
- replace: {
53
- name: 'replace',
54
- description: 'Replaces occurrences of a pattern',
55
- category: 'string',
56
- signature: 'replace(search, replacement)',
57
- examples: ['{{trigger.text | replace("old", "new")}}'],
58
- execute: (value, search, replacement) => {
59
- const searchStr = String(search);
60
- const replaceStr = String(replacement);
61
- return String(value).replace(new RegExp(searchStr.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), replaceStr);
62
- },
63
- },
64
- split: {
65
- name: 'split',
66
- description: 'Splits a string into an array',
67
- category: 'string',
68
- signature: 'split(separator)',
69
- examples: ['{{trigger.tags | split(",")}}'],
70
- execute: (value, separator) => {
71
- return String(value).split(String(separator));
72
- },
73
- },
74
- substring: {
75
- name: 'substring',
76
- description: 'Extracts a substring',
77
- category: 'string',
78
- signature: 'substring(start, end?)',
79
- examples: ['{{trigger.id | substring(0, 8)}}'],
80
- execute: (value, start, end) => {
81
- return String(value).substring(Number(start), end !== undefined ? Number(end) : undefined);
82
- },
83
- },
84
- padStart: {
85
- name: 'padStart',
86
- description: 'Pads a string from the start',
87
- category: 'string',
88
- signature: 'padStart(length, padString?)',
89
- examples: ['{{trigger.id | padStart(10, "0")}}'],
90
- execute: (value, length, padString) => {
91
- return String(value).padStart(Number(length), padString !== undefined ? String(padString) : ' ');
92
- },
93
- },
94
- padEnd: {
95
- name: 'padEnd',
96
- description: 'Pads a string from the end',
97
- category: 'string',
98
- signature: 'padEnd(length, padString?)',
99
- examples: ['{{trigger.code | padEnd(5, "X")}}'],
100
- execute: (value, length, padString) => {
101
- return String(value).padEnd(Number(length), padString !== undefined ? String(padString) : ' ');
102
- },
103
- },
104
- repeat: {
105
- name: 'repeat',
106
- description: 'Repeats a string n times',
107
- category: 'string',
108
- signature: 'repeat(count)',
109
- examples: ['{{trigger.char | repeat(3)}}'],
110
- execute: (value, count) => {
111
- return String(value).repeat(Number(count));
112
- },
113
- },
114
- reverse: {
115
- name: 'reverse',
116
- description: 'Reverses a string',
117
- category: 'string',
118
- signature: 'reverse',
119
- examples: ['{{trigger.text | reverse}}'],
120
- execute: (value) => {
121
- return String(value).split('').reverse().join('');
122
- },
123
- },
124
- slugify: {
125
- name: 'slugify',
126
- description: 'Converts to URL-friendly slug',
127
- category: 'string',
128
- signature: 'slugify',
129
- examples: ['{{trigger.title | slugify}}'],
130
- execute: (value) => {
131
- return String(value)
132
- .toLowerCase()
133
- .trim()
134
- .replace(/[^\w\s-]/g, '')
135
- .replace(/[\s_-]+/g, '-')
136
- .replace(/^-+|-+$/g, '');
137
- },
138
- },
139
- camelCase: {
140
- name: 'camelCase',
141
- description: 'Converts to camelCase',
142
- category: 'string',
143
- signature: 'camelCase',
144
- examples: ['{{trigger.text | camelCase}}'],
145
- execute: (value) => {
146
- return String(value)
147
- .replace(/[^\w\s]/g, '')
148
- .replace(/\s+(.)/g, (_, char) => char.toUpperCase())
149
- .replace(/^\w/, (char) => char.toLowerCase());
150
- },
151
- },
152
- kebabCase: {
153
- name: 'kebabCase',
154
- description: 'Converts to kebab-case',
155
- category: 'string',
156
- signature: 'kebabCase',
157
- examples: ['{{trigger.text | kebabCase}}'],
158
- execute: (value) => {
159
- return String(value)
160
- .replace(/([a-z])([A-Z])/g, '$1-$2')
161
- .replace(/[\s_]+/g, '-')
162
- .toLowerCase();
163
- },
164
- },
165
- snakeCase: {
166
- name: 'snakeCase',
167
- description: 'Converts to snake_case',
168
- category: 'string',
169
- signature: 'snakeCase',
170
- examples: ['{{trigger.text | snakeCase}}'],
171
- execute: (value) => {
172
- return String(value)
173
- .replace(/([a-z])([A-Z])/g, '$1_$2')
174
- .replace(/[\s-]+/g, '_')
175
- .toLowerCase();
176
- },
177
- },
178
- };
@@ -1,12 +0,0 @@
1
- export interface ExpressionContext {
2
- [key: string]: unknown;
3
- }
4
- export interface ResolverOptions {
5
- strict?: boolean;
6
- functions?: Record<string, (...args: unknown[]) => unknown>;
7
- allowNested?: boolean;
8
- maxDepth?: number;
9
- }
10
- export declare function resolveExpression(expression: string, context: ExpressionContext, options?: ResolverOptions): unknown;
11
- export declare function isDynamicExpression(expression: string): boolean;
12
- export declare function extractPaths(expression: string): string[];
@@ -1,88 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractPaths = exports.isDynamicExpression = exports.resolveExpression = void 0;
4
- const parser_1 = require("./parser");
5
- function resolveExpression(expression, context, options = {}) {
6
- const opts = {
7
- strict: false,
8
- functions: {},
9
- allowNested: true,
10
- maxDepth: 10,
11
- ...options,
12
- };
13
- if (!expression) {
14
- return expression;
15
- }
16
- const parsed = (0, parser_1.parseExpression)(expression);
17
- if (!parsed.isDynamic) {
18
- return expression;
19
- }
20
- if (parsed.tokens.length === 1 && parsed.tokens[0].type === 'expression') {
21
- return evaluateExpression(parsed.tokens[0].value, context, opts);
22
- }
23
- return parsed.tokens
24
- .map((token) => {
25
- if (token.type === 'text') {
26
- return token.value;
27
- }
28
- if (token.type === 'expression') {
29
- const value = evaluateExpression(token.value, context, opts);
30
- return value === undefined || value === null ? '' : String(value);
31
- }
32
- return '';
33
- })
34
- .join('');
35
- }
36
- exports.resolveExpression = resolveExpression;
37
- function evaluateExpression(expression, context, options) {
38
- try {
39
- const value = resolvePath(expression, context, options);
40
- return value;
41
- }
42
- catch (error) {
43
- if (options.strict) {
44
- throw error;
45
- }
46
- return undefined;
47
- }
48
- }
49
- function resolvePath(path, context, options, depth = 0) {
50
- if (depth > options.maxDepth) {
51
- throw new Error(`Maximum depth exceeded for path: ${path}`);
52
- }
53
- const bracketMatch = path.match(/^([^[]+)\[['"]([^'"]+)['"]\](.*)$/);
54
- if (bracketMatch) {
55
- const [, base, key, rest] = bracketMatch;
56
- const baseValue = resolvePath(base, context, options, depth + 1);
57
- if (baseValue === undefined || baseValue === null) {
58
- return undefined;
59
- }
60
- const value = baseValue[key];
61
- if (rest && rest.length > 0) {
62
- return resolvePath(rest.replace(/^\./, ''), { _: value }, options, depth + 1);
63
- }
64
- return value;
65
- }
66
- const parts = path.split('.');
67
- let current = context;
68
- for (const part of parts) {
69
- if (current === undefined || current === null) {
70
- return undefined;
71
- }
72
- if (typeof current !== 'object') {
73
- return undefined;
74
- }
75
- current = current[part];
76
- }
77
- return current;
78
- }
79
- function isDynamicExpression(expression) {
80
- const parsed = (0, parser_1.parseExpression)(expression);
81
- return parsed.isDynamic;
82
- }
83
- exports.isDynamicExpression = isDynamicExpression;
84
- function extractPaths(expression) {
85
- const parsed = (0, parser_1.parseExpression)(expression);
86
- return parsed.references.map((ref) => `${ref.source}.${ref.path}`);
87
- }
88
- exports.extractPaths = extractPaths;
@@ -1,36 +0,0 @@
1
- export interface ResourceMapping<TSource = string> {
2
- source: TSource;
3
- displayPath: string;
4
- savePath: string;
5
- resourceId: string;
6
- resourceName: string;
7
- }
8
- export type ExpressionToken = {
9
- type: 'text';
10
- value: string;
11
- } | {
12
- type: 'expression';
13
- value: string;
14
- raw: string;
15
- } | {
16
- type: 'reference';
17
- source: string;
18
- path: string;
19
- };
20
- export interface ExpressionParserConfig {
21
- openDelimiter?: string;
22
- closeDelimiter?: string;
23
- trimExpressions?: boolean;
24
- }
25
- export interface ParsedExpression {
26
- tokens: ExpressionToken[];
27
- isDynamic: boolean;
28
- references: Array<{
29
- source: string;
30
- path: string;
31
- }>;
32
- }
33
- export interface ExpressionMappingOptions {
34
- strict?: boolean;
35
- preserveUnknown?: boolean;
36
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- import type { BuiltInFunction } from '../types';
2
- export declare const arrayFunctions: Record<string, BuiltInFunction>;
@@ -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>;