@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,262 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getValueType = exports.convertExpressionToDisplayFormat = exports.convertExpressionToSaveFormat = exports.generatePreview = exports.validateExpression = exports.tokenizeEnriched = exports.getCurrentExpressionContext = exports.parseOperations = exports.extractPaths = exports.isInsideExpression = exports.hasReferences = exports.hasExpressions = exports.buildReferenceString = exports.buildExpressionString = void 0;
4
- const types_1 = require("./types");
5
- const parser_1 = require("./parser");
6
- const parser_2 = require("./parser");
7
- const resolver_1 = require("./resolver");
8
- const parser_3 = require("./parser");
9
- function buildExpressionString(path, operations) {
10
- let expr = `{{${path}`;
11
- if (operations && operations.length > 0) {
12
- const opsStr = operations
13
- .map((op) => {
14
- if (op.args.length === 0) {
15
- return op.name;
16
- }
17
- const argsStr = op.args
18
- .map((arg) => (typeof arg === 'string' ? `"${arg}"` : String(arg)))
19
- .join(', ');
20
- return `${op.name}(${argsStr})`;
21
- })
22
- .join(' | ');
23
- expr += ` | ${opsStr}`;
24
- }
25
- expr += '}}';
26
- return expr;
27
- }
28
- exports.buildExpressionString = buildExpressionString;
29
- function buildReferenceString(type, id) {
30
- return `@${type}:${id}`;
31
- }
32
- exports.buildReferenceString = buildReferenceString;
33
- function hasExpressions(str) {
34
- return /\{\{.+?\}\}/.test(str);
35
- }
36
- exports.hasExpressions = hasExpressions;
37
- function hasReferences(str) {
38
- return /@\w+:[a-zA-Z0-9-_]+/.test(str);
39
- }
40
- exports.hasReferences = hasReferences;
41
- function isInsideExpression(text, cursorPos) {
42
- const beforeCursor = text.substring(0, cursorPos);
43
- const lastOpenBrace = beforeCursor.lastIndexOf('{{');
44
- const lastCloseBrace = beforeCursor.lastIndexOf('}}');
45
- return lastOpenBrace > lastCloseBrace && lastOpenBrace !== -1;
46
- }
47
- exports.isInsideExpression = isInsideExpression;
48
- function extractPaths(str) {
49
- const matches = str.matchAll(/\{\{(.+?)\}\}/g);
50
- return Array.from(matches, (m) => {
51
- const expr = m[1].trim();
52
- const [path] = expr.split('|');
53
- return path.trim();
54
- });
55
- }
56
- exports.extractPaths = extractPaths;
57
- function parseOperations(opsStr) {
58
- if (!opsStr || !opsStr.trim()) {
59
- return [];
60
- }
61
- const operations = [];
62
- const parts = opsStr.split('|').map((p) => p.trim());
63
- for (const part of parts) {
64
- if (!part) {
65
- continue;
66
- }
67
- const match = part.match(/^(\w+)(?:\(([^)]*)\))?$/);
68
- if (match) {
69
- const [, name, argsStr] = match;
70
- const args = [];
71
- if (argsStr) {
72
- const argParts = argsStr.split(',').map((a) => a.trim());
73
- for (const arg of argParts) {
74
- if (arg.startsWith('"') || arg.startsWith("'")) {
75
- args.push(arg.slice(1, -1));
76
- }
77
- else if (!isNaN(Number(arg))) {
78
- args.push(Number(arg));
79
- }
80
- else if (arg === 'true' || arg === 'false') {
81
- args.push(arg === 'true');
82
- }
83
- else {
84
- args.push(arg);
85
- }
86
- }
87
- }
88
- operations.push({ name, args });
89
- }
90
- }
91
- return operations;
92
- }
93
- exports.parseOperations = parseOperations;
94
- function getCurrentExpressionContext(text, cursorPos) {
95
- if (!isInsideExpression(text, cursorPos)) {
96
- return null;
97
- }
98
- const beforeCursor = text.substring(0, cursorPos);
99
- const afterCursor = text.substring(cursorPos);
100
- const start = beforeCursor.lastIndexOf('{{') + 2;
101
- const endMatch = afterCursor.match(/\}\}/);
102
- const end = endMatch && endMatch.index !== undefined ? cursorPos + endMatch.index : text.length;
103
- const expression = text.substring(start, end);
104
- const [path] = expression.split('|');
105
- const expressionContent = expression.trim();
106
- const cursorOffsetInExpression = cursorPos - start;
107
- const contentUpToCursor = expression.substring(0, cursorOffsetInExpression);
108
- const match = contentUpToCursor.match(/([a-zA-Z_][a-zA-Z0-9_]*(?:\["[^"]*"\]|\['[^']*'\]|\[[^\]]*\]|\.(?:[a-zA-Z_][a-zA-Z0-9_]*))*\.?[a-zA-Z0-9_]*)$/);
109
- const currentPath = match && match[1] ? match[1] : '';
110
- return {
111
- isInExpression: true,
112
- expressionStart: start,
113
- expressionContent,
114
- cursorOffsetInExpression,
115
- currentPath,
116
- expression: expression.trim(),
117
- start,
118
- end,
119
- path: path.trim(),
120
- };
121
- }
122
- exports.getCurrentExpressionContext = getCurrentExpressionContext;
123
- function tokenizeEnriched(template) {
124
- const backendTokens = (0, parser_1.tokenizeTemplate)(template);
125
- const result = [];
126
- let currentPos = 0;
127
- for (const token of backendTokens) {
128
- if (token.type === 'text') {
129
- result.push({
130
- type: 'text',
131
- value: token.value,
132
- rawValue: token.value,
133
- start: currentPos,
134
- end: currentPos + token.value.length,
135
- });
136
- currentPos += token.value.length;
137
- }
138
- else {
139
- const exprValue = token.value.trim();
140
- const parsed = (0, parser_2.parseExpression)(exprValue);
141
- const source = (0, parser_3.detectDataSource)(exprValue);
142
- const rawValue = `{{${token.value}}}`;
143
- result.push({
144
- type: parsed.isValid ? 'expression' : 'error',
145
- value: exprValue,
146
- rawValue: rawValue,
147
- start: currentPos,
148
- end: currentPos + rawValue.length,
149
- parsed,
150
- source,
151
- isSecret: source === types_1.DataSourceType.SECRETS,
152
- });
153
- currentPos += rawValue.length;
154
- }
155
- }
156
- return result;
157
- }
158
- exports.tokenizeEnriched = tokenizeEnriched;
159
- function validateExpression(expression, context) {
160
- const tokens = tokenizeEnriched(expression);
161
- try {
162
- const parsed = (0, parser_2.parseExpression)(expression);
163
- if (!parsed.isValid) {
164
- return {
165
- isValid: false,
166
- errors: [
167
- {
168
- type: 'error',
169
- message: parsed.error || 'Invalid expression',
170
- start: 0,
171
- end: expression.length,
172
- path: expression,
173
- },
174
- ],
175
- warnings: [],
176
- tokens,
177
- };
178
- }
179
- (0, resolver_1.evaluateExpression)(parsed, context);
180
- return {
181
- isValid: true,
182
- errors: [],
183
- warnings: [],
184
- tokens,
185
- };
186
- }
187
- catch (error) {
188
- return {
189
- isValid: false,
190
- errors: [
191
- {
192
- type: 'error',
193
- message: error instanceof Error ? error.message : 'Validation error',
194
- start: 0,
195
- end: expression.length,
196
- path: expression,
197
- },
198
- ],
199
- warnings: [],
200
- tokens,
201
- };
202
- }
203
- }
204
- exports.validateExpression = validateExpression;
205
- function generatePreview(expression, context) {
206
- try {
207
- const parsed = (0, parser_2.parseExpression)(expression);
208
- if (!parsed.isValid) {
209
- return { value: null, type: 'error', error: parsed.error };
210
- }
211
- const value = (0, resolver_1.evaluateExpression)(parsed, context);
212
- const type = value === null ? 'null' : typeof value;
213
- return { value, type };
214
- }
215
- catch (error) {
216
- return {
217
- value: null,
218
- type: 'error',
219
- error: error instanceof Error ? error.message : 'Evaluation error',
220
- };
221
- }
222
- }
223
- exports.generatePreview = generatePreview;
224
- function convertExpressionToSaveFormat(expression, mappings) {
225
- if (!expression || mappings.length === 0) {
226
- return expression;
227
- }
228
- let result = expression;
229
- const sortedMappings = [...mappings].sort((a, b) => b.displayPath.length - a.displayPath.length);
230
- for (const mapping of sortedMappings) {
231
- const regex = new RegExp(mapping.displayPath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g');
232
- result = result.replace(regex, mapping.savePath);
233
- }
234
- return result;
235
- }
236
- exports.convertExpressionToSaveFormat = convertExpressionToSaveFormat;
237
- function convertExpressionToDisplayFormat(expression, mappings) {
238
- if (!expression || mappings.length === 0) {
239
- return expression;
240
- }
241
- let result = expression;
242
- const sortedMappings = [...mappings].sort((a, b) => b.savePath.length - a.savePath.length);
243
- for (const mapping of sortedMappings) {
244
- const regex = new RegExp(mapping.savePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g');
245
- result = result.replace(regex, mapping.displayPath);
246
- }
247
- return result;
248
- }
249
- exports.convertExpressionToDisplayFormat = convertExpressionToDisplayFormat;
250
- function getValueType(value) {
251
- if (value === null) {
252
- return 'null';
253
- }
254
- if (value === undefined) {
255
- return 'undefined';
256
- }
257
- if (Array.isArray(value)) {
258
- return 'array';
259
- }
260
- return typeof value;
261
- }
262
- exports.getValueType = getValueType;
@@ -1,8 +0,0 @@
1
- import type { ParsedExpression, DataSourceType } from './types';
2
- export declare function detectDataSource(path: string): DataSourceType | null;
3
- export declare function parsePathSegments(path: string): string[];
4
- export declare function parseExpression(expression: string): ParsedExpression;
5
- export declare function tokenizeTemplate(template: string): Array<{
6
- type: 'text' | 'expression';
7
- value: string;
8
- }>;