@abyss-project/main 1.0.93 → 1.0.94
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.
- package/dist/expressions/index.d.ts +5 -0
- package/dist/expressions/index.js +16 -0
- package/dist/expressions/mapper.d.ts +9 -0
- package/dist/expressions/mapper.js +90 -0
- package/dist/expressions/parser.d.ts +3 -0
- package/dist/expressions/parser.js +97 -0
- package/dist/expressions/resolver.d.ts +12 -0
- package/dist/expressions/resolver.js +88 -0
- package/dist/expressions/types.d.ts +36 -0
- package/dist/types/enum/abyss-application-event.enum.d.ts +5 -1
- package/dist/types/enum/abyss-application-event.enum.js +4 -0
- package/dist/types/enum/project-access-permission.enum.d.ts +5 -1
- package/dist/types/enum/project-access-permission.enum.js +4 -0
- package/dist/workflow/expression/expression-functions.utils.d.ts +6 -0
- package/dist/workflow/expression/expression-functions.utils.js +61 -0
- package/dist/workflow/expression/expression-mapper.d.ts +11 -0
- package/dist/workflow/expression/expression-mapper.js +32 -0
- package/dist/workflow/expression/expression-mapping.utils.d.ts +4 -0
- package/dist/workflow/expression/expression-mapping.utils.js +43 -0
- package/dist/workflow/expression/expression-resolver.utils.d.ts +3 -0
- package/dist/workflow/expression/expression-resolver.utils.js +54 -0
- package/dist/workflow/expression/expression-tokenizer.utils.d.ts +4 -0
- package/dist/workflow/expression/expression-tokenizer.utils.js +123 -0
- package/dist/workflow/expression/expression.types.d.ts +33 -0
- package/dist/workflow/expression/expression.types.js +17 -0
- package/dist/workflow/expression/index.d.ts +10 -0
- package/dist/workflow/expression/index.js +40 -0
- package/dist/workflow/expression/workflow-resolver.d.ts +9 -0
- package/dist/workflow/expression/workflow-resolver.js +102 -0
- package/dist/workflow/expressions/functions/array.d.ts +2 -0
- package/dist/workflow/expressions/functions/array.js +252 -0
- package/dist/workflow/expressions/functions/crypto.d.ts +2 -0
- package/dist/workflow/expressions/functions/crypto.js +101 -0
- package/dist/workflow/expressions/functions/datetime.d.ts +2 -0
- package/dist/workflow/expressions/functions/datetime.js +256 -0
- package/dist/workflow/expressions/functions/index.d.ts +7 -0
- package/dist/workflow/expressions/functions/index.js +46 -0
- package/dist/workflow/expressions/functions/math.d.ts +2 -0
- package/dist/workflow/expressions/functions/math.js +174 -0
- package/dist/workflow/expressions/functions/string.d.ts +2 -0
- package/dist/workflow/expressions/functions/string.js +301 -0
- package/dist/workflow/expressions/functions/utility.d.ts +2 -0
- package/dist/workflow/expressions/functions/utility.js +230 -0
- package/dist/workflow/expressions/helpers.d.ts +26 -0
- package/dist/workflow/expressions/helpers.js +132 -0
- package/dist/workflow/expressions/index.d.ts +15 -0
- package/dist/workflow/expressions/index.js +61 -0
- package/dist/workflow/expressions/parser.d.ts +8 -0
- package/dist/workflow/expressions/parser.js +436 -0
- package/dist/workflow/expressions/pipes/array-pipes.d.ts +2 -0
- package/dist/workflow/expressions/pipes/array-pipes.js +248 -0
- package/dist/workflow/expressions/pipes/index.d.ts +8 -0
- package/dist/workflow/expressions/pipes/index.js +40 -0
- package/dist/workflow/expressions/pipes/object-pipes.d.ts +2 -0
- package/dist/workflow/expressions/pipes/object-pipes.js +243 -0
- package/dist/workflow/expressions/pipes/string-pipes.d.ts +9 -0
- package/dist/workflow/expressions/pipes/string-pipes.js +178 -0
- package/dist/workflow/expressions/resolver.d.ts +8 -0
- package/dist/workflow/expressions/resolver.js +263 -0
- package/dist/workflow/expressions/types.d.ts +144 -0
- package/dist/workflow/expressions/types.js +33 -0
- package/dist/workflow/index.d.ts +1 -0
- package/dist/workflow/index.js +17 -0
- package/package.json +1 -1
- package/dist/api/domain-verification.admin.api.d.ts +0 -4
- package/dist/api/domain-verification.admin.api.js +0 -10
- package/dist/api/domain-verification.api.d.ts +0 -7
- package/dist/api/domain-verification.api.js +0 -28
- package/dist/api/workflow.api.d.ts +0 -26
- package/dist/api/workflow.api.js +0 -60
- package/dist/types/dto/domain-verification.dto.d.ts +0 -19
- package/dist/types/interface/api/bodies/domain-verification.body.d.ts +0 -7
- package/dist/types/interface/api/bodies/domain-verification.body.js +0 -2
- package/dist/types/interface/api/params/domain-verification.params.d.ts +0 -18
- package/dist/types/interface/api/params/domain-verification.params.js +0 -2
- package/dist/types/interface/api/requests/domain-verification.admin.request.d.ts +0 -5
- package/dist/types/interface/api/requests/domain-verification.admin.request.js +0 -2
- package/dist/types/interface/api/requests/domain-verification.request.d.ts +0 -29
- package/dist/types/interface/api/requests/domain-verification.request.js +0 -2
- package/dist/types/interface/api/requests/workflow.request.d.ts +0 -119
- package/dist/types/interface/api/requests/workflow.request.js +0 -2
- package/dist/types/interface/api/responses/domain-verification.admin.response.d.ts +0 -6
- package/dist/types/interface/api/responses/domain-verification.admin.response.js +0 -2
- package/dist/types/interface/api/responses/domain-verification.response.d.ts +0 -29
- package/dist/types/interface/api/responses/domain-verification.response.js +0 -2
- package/dist/types/interface/api/responses/project-domain-verification.response.d.ts +0 -55
- package/dist/types/interface/api/responses/project-domain-verification.response.js +0 -2
- package/dist/types/interface/api/responses/workflow.response.d.ts +0 -124
- package/dist/types/interface/api/responses/workflow.response.js +0 -2
- package/dist/types/interface/models/domain-verification.model.d.ts +0 -42
- package/dist/types/interface/models/domain-verification.model.js +0 -14
- package/dist/types/interface/models/project-domain-verification.model.d.ts +0 -27
- package/dist/types/interface/models/project-domain-verification.model.js +0 -15
- package/dist/types/interface/models/workflow-execution-step.model.d.ts +0 -59
- package/dist/types/interface/models/workflow-execution-step.model.js +0 -12
- package/dist/types/interface/models/workflow-execution.model.d.ts +0 -78
- package/dist/types/interface/models/workflow-execution.model.js +0 -13
- package/dist/types/interface/models/workflow-step.model.d.ts +0 -106
- package/dist/types/interface/models/workflow-step.model.js +0 -44
- package/dist/types/interface/models/workflow-template.model.d.ts +0 -41
- package/dist/types/interface/models/workflow-template.model.js +0 -2
- package/dist/types/interface/models/workflow.model.d.ts +0 -72
- package/dist/types/interface/models/workflow.model.js +0 -23
- /package/dist/{types/dto/domain-verification.dto.js → expressions/types.js} +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { ResourceMapping, ExpressionToken, ExpressionParserConfig, ParsedExpression, ExpressionMappingOptions, } from './types';
|
|
2
|
+
export { parseExpression, stringifyExpression, } from './parser';
|
|
3
|
+
export { convertToDisplayFormat, convertToSaveFormat, extractMappings, validateExpression, createResourceMapping, } from './mapper';
|
|
4
|
+
export type { ExpressionContext, ResolverOptions, } from './resolver';
|
|
5
|
+
export { resolveExpression, isDynamicExpression, extractPaths, } from './resolver';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractPaths = exports.isDynamicExpression = exports.resolveExpression = exports.createResourceMapping = exports.validateExpression = exports.extractMappings = exports.convertToSaveFormat = exports.convertToDisplayFormat = exports.stringifyExpression = exports.parseExpression = void 0;
|
|
4
|
+
var parser_1 = require("./parser");
|
|
5
|
+
Object.defineProperty(exports, "parseExpression", { enumerable: true, get: function () { return parser_1.parseExpression; } });
|
|
6
|
+
Object.defineProperty(exports, "stringifyExpression", { enumerable: true, get: function () { return parser_1.stringifyExpression; } });
|
|
7
|
+
var mapper_1 = require("./mapper");
|
|
8
|
+
Object.defineProperty(exports, "convertToDisplayFormat", { enumerable: true, get: function () { return mapper_1.convertToDisplayFormat; } });
|
|
9
|
+
Object.defineProperty(exports, "convertToSaveFormat", { enumerable: true, get: function () { return mapper_1.convertToSaveFormat; } });
|
|
10
|
+
Object.defineProperty(exports, "extractMappings", { enumerable: true, get: function () { return mapper_1.extractMappings; } });
|
|
11
|
+
Object.defineProperty(exports, "validateExpression", { enumerable: true, get: function () { return mapper_1.validateExpression; } });
|
|
12
|
+
Object.defineProperty(exports, "createResourceMapping", { enumerable: true, get: function () { return mapper_1.createResourceMapping; } });
|
|
13
|
+
var resolver_1 = require("./resolver");
|
|
14
|
+
Object.defineProperty(exports, "resolveExpression", { enumerable: true, get: function () { return resolver_1.resolveExpression; } });
|
|
15
|
+
Object.defineProperty(exports, "isDynamicExpression", { enumerable: true, get: function () { return resolver_1.isDynamicExpression; } });
|
|
16
|
+
Object.defineProperty(exports, "extractPaths", { enumerable: true, get: function () { return resolver_1.extractPaths; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ResourceMapping, ExpressionMappingOptions } from './types';
|
|
2
|
+
export declare function convertToDisplayFormat<TSource = string>(expression: string, mappings: ResourceMapping<TSource>[], options?: ExpressionMappingOptions): string;
|
|
3
|
+
export declare function convertToSaveFormat<TSource = string>(expression: string, mappings: ResourceMapping<TSource>[], options?: ExpressionMappingOptions): string;
|
|
4
|
+
export declare function extractMappings<TSource = string>(expression: string, mappings: ResourceMapping<TSource>[]): ResourceMapping<TSource>[];
|
|
5
|
+
export declare function validateExpression<TSource = string>(expression: string, mappings: ResourceMapping<TSource>[]): {
|
|
6
|
+
valid: boolean;
|
|
7
|
+
missingReferences: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare function createResourceMapping<TSource = string>(source: TSource, resourceId: string, resourceName: string, pathBuilder: (source: TSource, identifier: string) => string): ResourceMapping<TSource>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createResourceMapping = exports.validateExpression = exports.extractMappings = exports.convertToSaveFormat = exports.convertToDisplayFormat = void 0;
|
|
4
|
+
const parser_1 = require("./parser");
|
|
5
|
+
function convertToDisplayFormat(expression, mappings, options = {}) {
|
|
6
|
+
const opts = {
|
|
7
|
+
strict: false,
|
|
8
|
+
preserveUnknown: true,
|
|
9
|
+
...options,
|
|
10
|
+
};
|
|
11
|
+
if (!expression) {
|
|
12
|
+
return expression;
|
|
13
|
+
}
|
|
14
|
+
let result = expression;
|
|
15
|
+
const sortedMappings = [...mappings].sort((a, b) => b.savePath.length - a.savePath.length);
|
|
16
|
+
for (const mapping of sortedMappings) {
|
|
17
|
+
const escapedSavePath = escapeRegExp(mapping.savePath);
|
|
18
|
+
const regex = new RegExp(escapedSavePath, 'g');
|
|
19
|
+
result = result.replace(regex, mapping.displayPath);
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
exports.convertToDisplayFormat = convertToDisplayFormat;
|
|
24
|
+
function convertToSaveFormat(expression, mappings, options = {}) {
|
|
25
|
+
const opts = {
|
|
26
|
+
strict: false,
|
|
27
|
+
preserveUnknown: true,
|
|
28
|
+
...options,
|
|
29
|
+
};
|
|
30
|
+
if (!expression) {
|
|
31
|
+
return expression;
|
|
32
|
+
}
|
|
33
|
+
let result = expression;
|
|
34
|
+
const sortedMappings = [...mappings].sort((a, b) => b.displayPath.length - a.displayPath.length);
|
|
35
|
+
for (const mapping of sortedMappings) {
|
|
36
|
+
const escapedDisplayPath = escapeRegExp(mapping.displayPath);
|
|
37
|
+
const regex = new RegExp(escapedDisplayPath, 'g');
|
|
38
|
+
result = result.replace(regex, mapping.savePath);
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
exports.convertToSaveFormat = convertToSaveFormat;
|
|
43
|
+
function extractMappings(expression, mappings) {
|
|
44
|
+
if (!expression) {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
const parsed = (0, parser_1.parseExpression)(expression);
|
|
48
|
+
const usedMappings = [];
|
|
49
|
+
for (const reference of parsed.references) {
|
|
50
|
+
const mapping = mappings.find((m) => m.displayPath.includes(reference.source) ||
|
|
51
|
+
m.savePath.includes(reference.source));
|
|
52
|
+
if (mapping && !usedMappings.includes(mapping)) {
|
|
53
|
+
usedMappings.push(mapping);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return usedMappings;
|
|
57
|
+
}
|
|
58
|
+
exports.extractMappings = extractMappings;
|
|
59
|
+
function validateExpression(expression, mappings) {
|
|
60
|
+
if (!expression) {
|
|
61
|
+
return { valid: true, missingReferences: [] };
|
|
62
|
+
}
|
|
63
|
+
const parsed = (0, parser_1.parseExpression)(expression);
|
|
64
|
+
const missingReferences = [];
|
|
65
|
+
for (const reference of parsed.references) {
|
|
66
|
+
const hasMapping = mappings.some((m) => m.displayPath.includes(reference.source) ||
|
|
67
|
+
m.savePath.includes(reference.source));
|
|
68
|
+
if (!hasMapping) {
|
|
69
|
+
missingReferences.push(`${reference.source}.${reference.path}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
valid: missingReferences.length === 0,
|
|
74
|
+
missingReferences,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
exports.validateExpression = validateExpression;
|
|
78
|
+
function escapeRegExp(str) {
|
|
79
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
80
|
+
}
|
|
81
|
+
function createResourceMapping(source, resourceId, resourceName, pathBuilder) {
|
|
82
|
+
return {
|
|
83
|
+
source,
|
|
84
|
+
resourceId,
|
|
85
|
+
resourceName,
|
|
86
|
+
displayPath: pathBuilder(source, resourceName),
|
|
87
|
+
savePath: pathBuilder(source, resourceId),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
exports.createResourceMapping = createResourceMapping;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ExpressionToken, ExpressionParserConfig, ParsedExpression } from './types';
|
|
2
|
+
export declare function parseExpression(expression: string, config?: ExpressionParserConfig): ParsedExpression;
|
|
3
|
+
export declare function stringifyExpression(tokens: ExpressionToken[], config?: ExpressionParserConfig): string;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringifyExpression = exports.parseExpression = void 0;
|
|
4
|
+
const DEFAULT_CONFIG = {
|
|
5
|
+
openDelimiter: '{{',
|
|
6
|
+
closeDelimiter: '}}',
|
|
7
|
+
trimExpressions: true,
|
|
8
|
+
};
|
|
9
|
+
function parseExpression(expression, config = {}) {
|
|
10
|
+
const cfg = { ...DEFAULT_CONFIG, ...config };
|
|
11
|
+
const tokens = [];
|
|
12
|
+
const references = [];
|
|
13
|
+
let currentPosition = 0;
|
|
14
|
+
let isDynamic = false;
|
|
15
|
+
while (currentPosition < expression.length) {
|
|
16
|
+
const openIndex = expression.indexOf(cfg.openDelimiter, currentPosition);
|
|
17
|
+
if (openIndex === -1) {
|
|
18
|
+
const remaining = expression.slice(currentPosition);
|
|
19
|
+
if (remaining) {
|
|
20
|
+
tokens.push({ type: 'text', value: remaining });
|
|
21
|
+
}
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
if (openIndex > currentPosition) {
|
|
25
|
+
tokens.push({
|
|
26
|
+
type: 'text',
|
|
27
|
+
value: expression.slice(currentPosition, openIndex),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const closeIndex = expression.indexOf(cfg.closeDelimiter, openIndex + cfg.openDelimiter.length);
|
|
31
|
+
if (closeIndex === -1) {
|
|
32
|
+
tokens.push({
|
|
33
|
+
type: 'text',
|
|
34
|
+
value: expression.slice(openIndex),
|
|
35
|
+
});
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
const rawExpression = expression.slice(openIndex, closeIndex + cfg.closeDelimiter.length);
|
|
39
|
+
let expressionContent = expression.slice(openIndex + cfg.openDelimiter.length, closeIndex);
|
|
40
|
+
if (cfg.trimExpressions) {
|
|
41
|
+
expressionContent = expressionContent.trim();
|
|
42
|
+
}
|
|
43
|
+
const referenceMatch = parseReference(expressionContent);
|
|
44
|
+
if (referenceMatch) {
|
|
45
|
+
references.push(referenceMatch);
|
|
46
|
+
}
|
|
47
|
+
tokens.push({
|
|
48
|
+
type: 'expression',
|
|
49
|
+
value: expressionContent,
|
|
50
|
+
raw: rawExpression,
|
|
51
|
+
});
|
|
52
|
+
isDynamic = true;
|
|
53
|
+
currentPosition = closeIndex + cfg.closeDelimiter.length;
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
tokens,
|
|
57
|
+
isDynamic,
|
|
58
|
+
references,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
exports.parseExpression = parseExpression;
|
|
62
|
+
function parseReference(expression) {
|
|
63
|
+
expression = expression.trim();
|
|
64
|
+
const dotMatch = expression.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\.(.+)$/);
|
|
65
|
+
if (dotMatch) {
|
|
66
|
+
return {
|
|
67
|
+
source: dotMatch[1],
|
|
68
|
+
path: dotMatch[2],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const bracketMatch = expression.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[['"](.+?)['"]\]$/);
|
|
72
|
+
if (bracketMatch) {
|
|
73
|
+
return {
|
|
74
|
+
source: bracketMatch[1],
|
|
75
|
+
path: bracketMatch[2],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
function stringifyExpression(tokens, config = {}) {
|
|
81
|
+
const cfg = { ...DEFAULT_CONFIG, ...config };
|
|
82
|
+
return tokens
|
|
83
|
+
.map((token) => {
|
|
84
|
+
if (token.type === 'text') {
|
|
85
|
+
return token.value;
|
|
86
|
+
}
|
|
87
|
+
if (token.type === 'expression') {
|
|
88
|
+
return token.raw || `${cfg.openDelimiter}${token.value}${cfg.closeDelimiter}`;
|
|
89
|
+
}
|
|
90
|
+
if (token.type === 'reference') {
|
|
91
|
+
return `${cfg.openDelimiter}${token.source}.${token.path}${cfg.closeDelimiter}`;
|
|
92
|
+
}
|
|
93
|
+
return '';
|
|
94
|
+
})
|
|
95
|
+
.join('');
|
|
96
|
+
}
|
|
97
|
+
exports.stringifyExpression = stringifyExpression;
|
|
@@ -0,0 +1,12 @@
|
|
|
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[];
|
|
@@ -0,0 +1,88 @@
|
|
|
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;
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
}
|
|
@@ -277,5 +277,9 @@ export declare enum AbyssApplicationEvent {
|
|
|
277
277
|
ABYSS_CONSOLE_WORKFLOW_STEP_EXECUTION_SKIP = "abyss-console.workflow.step-execution.skip",
|
|
278
278
|
ABYSS_CONSOLE_PROJECT_CREATE = "abyss-console.project.create",
|
|
279
279
|
ABYSS_CONSOLE_PROJECT_DELETE = "abyss-console.project.delete",
|
|
280
|
-
ABYSS_CONSOLE_PROJECT_SYNC = "abyss-console.project.sync"
|
|
280
|
+
ABYSS_CONSOLE_PROJECT_SYNC = "abyss-console.project.sync",
|
|
281
|
+
ABYSS_CONSOLE_VARIABLE_CREATE = "abyss-console.variable.create",
|
|
282
|
+
ABYSS_CONSOLE_VARIABLE_READ = "abyss-console.variable.read-public",
|
|
283
|
+
ABYSS_CONSOLE_VARIABLE_UPDATE = "abyss-console.variable.update",
|
|
284
|
+
ABYSS_CONSOLE_VARIABLE_DELETE = "abyss-console.variable.delete"
|
|
281
285
|
}
|
|
@@ -282,4 +282,8 @@ var AbyssApplicationEvent;
|
|
|
282
282
|
AbyssApplicationEvent["ABYSS_CONSOLE_PROJECT_CREATE"] = "abyss-console.project.create";
|
|
283
283
|
AbyssApplicationEvent["ABYSS_CONSOLE_PROJECT_DELETE"] = "abyss-console.project.delete";
|
|
284
284
|
AbyssApplicationEvent["ABYSS_CONSOLE_PROJECT_SYNC"] = "abyss-console.project.sync";
|
|
285
|
+
AbyssApplicationEvent["ABYSS_CONSOLE_VARIABLE_CREATE"] = "abyss-console.variable.create";
|
|
286
|
+
AbyssApplicationEvent["ABYSS_CONSOLE_VARIABLE_READ"] = "abyss-console.variable.read-public";
|
|
287
|
+
AbyssApplicationEvent["ABYSS_CONSOLE_VARIABLE_UPDATE"] = "abyss-console.variable.update";
|
|
288
|
+
AbyssApplicationEvent["ABYSS_CONSOLE_VARIABLE_DELETE"] = "abyss-console.variable.delete";
|
|
285
289
|
})(AbyssApplicationEvent || (exports.AbyssApplicationEvent = AbyssApplicationEvent = {}));
|
|
@@ -21,5 +21,9 @@ export declare enum ProjectAccessPermission {
|
|
|
21
21
|
WORKFLOW_UPDATE = "WORKFLOW_UPDATE",
|
|
22
22
|
WORKFLOW_DELETE = "WORKFLOW_DELETE",
|
|
23
23
|
WORKFLOW_EXECUTE = "WORKFLOW_EXECUTE",
|
|
24
|
-
WORKFLOW_NOTIFICATION = "WORKFLOW_NOTIFICATION"
|
|
24
|
+
WORKFLOW_NOTIFICATION = "WORKFLOW_NOTIFICATION",
|
|
25
|
+
VARIABLE_CREATE = "VARIABLE_CREATE",
|
|
26
|
+
VARIABLE_READ = "VARIABLE_READ",
|
|
27
|
+
VARIABLE_UPDATE = "VARIABLE_UPDATE",
|
|
28
|
+
VARIABLE_DELETE = "VARIABLE_DELETE"
|
|
25
29
|
}
|
|
@@ -26,4 +26,8 @@ var ProjectAccessPermission;
|
|
|
26
26
|
ProjectAccessPermission["WORKFLOW_DELETE"] = "WORKFLOW_DELETE";
|
|
27
27
|
ProjectAccessPermission["WORKFLOW_EXECUTE"] = "WORKFLOW_EXECUTE";
|
|
28
28
|
ProjectAccessPermission["WORKFLOW_NOTIFICATION"] = "WORKFLOW_NOTIFICATION";
|
|
29
|
+
ProjectAccessPermission["VARIABLE_CREATE"] = "VARIABLE_CREATE";
|
|
30
|
+
ProjectAccessPermission["VARIABLE_READ"] = "VARIABLE_READ";
|
|
31
|
+
ProjectAccessPermission["VARIABLE_UPDATE"] = "VARIABLE_UPDATE";
|
|
32
|
+
ProjectAccessPermission["VARIABLE_DELETE"] = "VARIABLE_DELETE";
|
|
29
33
|
})(ProjectAccessPermission || (exports.ProjectAccessPermission = ProjectAccessPermission = {}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function uuid(): string;
|
|
2
|
+
export declare function random(min: number, max: number): number;
|
|
3
|
+
export declare function now(): number;
|
|
4
|
+
export declare function isoDate(): string;
|
|
5
|
+
export declare const PIPE_OPERATIONS: Record<string, (value: unknown, ...args: unknown[]) => unknown>;
|
|
6
|
+
export declare const BUILT_IN_FUNCTIONS: Record<string, (...args: unknown[]) => unknown>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BUILT_IN_FUNCTIONS = exports.PIPE_OPERATIONS = exports.isoDate = exports.now = exports.random = exports.uuid = void 0;
|
|
4
|
+
function uuid() {
|
|
5
|
+
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
|
|
6
|
+
return crypto.randomUUID();
|
|
7
|
+
}
|
|
8
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
9
|
+
const r = (Math.random() * 16) | 0;
|
|
10
|
+
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
11
|
+
return v.toString(16);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
exports.uuid = uuid;
|
|
15
|
+
function random(min, max) {
|
|
16
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
17
|
+
}
|
|
18
|
+
exports.random = random;
|
|
19
|
+
function now() {
|
|
20
|
+
return Date.now();
|
|
21
|
+
}
|
|
22
|
+
exports.now = now;
|
|
23
|
+
function isoDate() {
|
|
24
|
+
return new Date().toISOString();
|
|
25
|
+
}
|
|
26
|
+
exports.isoDate = isoDate;
|
|
27
|
+
exports.PIPE_OPERATIONS = {
|
|
28
|
+
lower: (value) => String(value).toLowerCase(),
|
|
29
|
+
upper: (value) => String(value).toUpperCase(),
|
|
30
|
+
trim: (value) => String(value).trim(),
|
|
31
|
+
length: (value) => (Array.isArray(value) ? value.length : String(value).length),
|
|
32
|
+
abs: (value) => Math.abs(Number(value)),
|
|
33
|
+
round: (value) => Math.round(Number(value)),
|
|
34
|
+
floor: (value) => Math.floor(Number(value)),
|
|
35
|
+
ceil: (value) => Math.ceil(Number(value)),
|
|
36
|
+
json: (value) => JSON.stringify(value),
|
|
37
|
+
parse: (value) => {
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(String(value));
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
isNumber: (value) => typeof value === 'number' && !isNaN(value),
|
|
46
|
+
isString: (value) => typeof value === 'string',
|
|
47
|
+
isArray: (value) => Array.isArray(value),
|
|
48
|
+
isObject: (value) => typeof value === 'object' && value !== null,
|
|
49
|
+
};
|
|
50
|
+
exports.BUILT_IN_FUNCTIONS = {
|
|
51
|
+
uuid,
|
|
52
|
+
random: (...args) => random(Number(args[0]), Number(args[1])),
|
|
53
|
+
now,
|
|
54
|
+
isoDate,
|
|
55
|
+
min: (...args) => Math.min(...args.map(Number)),
|
|
56
|
+
max: (...args) => Math.max(...args.map(Number)),
|
|
57
|
+
abs: (...args) => Math.abs(Number(args[0])),
|
|
58
|
+
round: (...args) => Math.round(Number(args[0])),
|
|
59
|
+
floor: (...args) => Math.floor(Number(args[0])),
|
|
60
|
+
ceil: (...args) => Math.ceil(Number(args[0])),
|
|
61
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ExpressionMappingOptions } from '../../expressions';
|
|
2
|
+
import type { WorkflowResourceMapping, DataSourceType } from './expression.types';
|
|
3
|
+
export declare function convertToDisplayFormat(expression: string, mappings: WorkflowResourceMapping[], options?: ExpressionMappingOptions): string;
|
|
4
|
+
export declare function convertToSaveFormat(expression: string, mappings: WorkflowResourceMapping[], options?: ExpressionMappingOptions): string;
|
|
5
|
+
export declare function extractMappings(expression: string, mappings: WorkflowResourceMapping[]): WorkflowResourceMapping[];
|
|
6
|
+
export declare function validateExpression(expression: string, mappings: WorkflowResourceMapping[]): {
|
|
7
|
+
valid: boolean;
|
|
8
|
+
missingReferences: string[];
|
|
9
|
+
};
|
|
10
|
+
export declare function createWorkflowResourceMapping(source: DataSourceType, resourceId: string, resourceName: string): WorkflowResourceMapping;
|
|
11
|
+
export declare function buildPathSegment(source: DataSourceType, identifier: string): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildPathSegment = exports.createWorkflowResourceMapping = exports.validateExpression = exports.extractMappings = exports.convertToSaveFormat = exports.convertToDisplayFormat = void 0;
|
|
4
|
+
const expressions_1 = require("../../expressions");
|
|
5
|
+
function convertToDisplayFormat(expression, mappings, options) {
|
|
6
|
+
return (0, expressions_1.convertToDisplayFormat)(expression, mappings, options);
|
|
7
|
+
}
|
|
8
|
+
exports.convertToDisplayFormat = convertToDisplayFormat;
|
|
9
|
+
function convertToSaveFormat(expression, mappings, options) {
|
|
10
|
+
return (0, expressions_1.convertToSaveFormat)(expression, mappings, options);
|
|
11
|
+
}
|
|
12
|
+
exports.convertToSaveFormat = convertToSaveFormat;
|
|
13
|
+
function extractMappings(expression, mappings) {
|
|
14
|
+
return (0, expressions_1.extractMappings)(expression, mappings);
|
|
15
|
+
}
|
|
16
|
+
exports.extractMappings = extractMappings;
|
|
17
|
+
function validateExpression(expression, mappings) {
|
|
18
|
+
return (0, expressions_1.validateExpression)(expression, mappings);
|
|
19
|
+
}
|
|
20
|
+
exports.validateExpression = validateExpression;
|
|
21
|
+
function createWorkflowResourceMapping(source, resourceId, resourceName) {
|
|
22
|
+
return (0, expressions_1.createResourceMapping)(source, resourceId, resourceName, buildPathSegment);
|
|
23
|
+
}
|
|
24
|
+
exports.createWorkflowResourceMapping = createWorkflowResourceMapping;
|
|
25
|
+
function buildPathSegment(source, identifier) {
|
|
26
|
+
const escapedId = identifier.replace(/[.\[\]]/g, '\\$&');
|
|
27
|
+
if (/[\s."']/.test(identifier)) {
|
|
28
|
+
return `${source}["${identifier}"]`;
|
|
29
|
+
}
|
|
30
|
+
return `${source}.${escapedId}`;
|
|
31
|
+
}
|
|
32
|
+
exports.buildPathSegment = buildPathSegment;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ResourceMapping } from './expression.types';
|
|
2
|
+
export declare function convertExpressionToSaveFormat(expression: string, mappings: ResourceMapping[]): string;
|
|
3
|
+
export declare function convertExpressionToDisplayFormat(expression: string, mappings: ResourceMapping[]): string;
|
|
4
|
+
export declare function extractExpressionTokens(text: string): string[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractExpressionTokens = exports.convertExpressionToDisplayFormat = exports.convertExpressionToSaveFormat = void 0;
|
|
4
|
+
const expression_tokenizer_utils_1 = require("./expression-tokenizer.utils");
|
|
5
|
+
function convertExpressionToSaveFormat(expression, mappings) {
|
|
6
|
+
if (!expression || mappings.length === 0) {
|
|
7
|
+
return expression;
|
|
8
|
+
}
|
|
9
|
+
let result = expression;
|
|
10
|
+
const sortedMappings = [...mappings].sort((a, b) => b.displayPath.length - a.displayPath.length);
|
|
11
|
+
for (const mapping of sortedMappings) {
|
|
12
|
+
const displayPattern = escapeRegExp(mapping.displayPath);
|
|
13
|
+
const regex = new RegExp(displayPattern, 'g');
|
|
14
|
+
result = result.replace(regex, mapping.savePath);
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
exports.convertExpressionToSaveFormat = convertExpressionToSaveFormat;
|
|
19
|
+
function convertExpressionToDisplayFormat(expression, mappings) {
|
|
20
|
+
if (!expression || mappings.length === 0) {
|
|
21
|
+
return expression;
|
|
22
|
+
}
|
|
23
|
+
let result = expression;
|
|
24
|
+
const sortedMappings = [...mappings].sort((a, b) => b.savePath.length - a.savePath.length);
|
|
25
|
+
for (const mapping of sortedMappings) {
|
|
26
|
+
const savePattern = escapeRegExp(mapping.savePath);
|
|
27
|
+
const regex = new RegExp(savePattern, 'g');
|
|
28
|
+
result = result.replace(regex, mapping.displayPath);
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
exports.convertExpressionToDisplayFormat = convertExpressionToDisplayFormat;
|
|
33
|
+
function escapeRegExp(str) {
|
|
34
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
35
|
+
}
|
|
36
|
+
function extractExpressionTokens(text) {
|
|
37
|
+
const tokens = (0, expression_tokenizer_utils_1.tokenize)(text);
|
|
38
|
+
const expressions = tokens
|
|
39
|
+
.filter((token) => token.type === 'expression')
|
|
40
|
+
.map((token) => token.value);
|
|
41
|
+
return Array.from(new Set(expressions));
|
|
42
|
+
}
|
|
43
|
+
exports.extractExpressionTokens = extractExpressionTokens;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTruthy = exports.resolveExpressions = exports.resolvePathValue = void 0;
|
|
4
|
+
const expression_tokenizer_utils_1 = require("./expression-tokenizer.utils");
|
|
5
|
+
function resolvePathValue(path, context) {
|
|
6
|
+
const segments = (0, expression_tokenizer_utils_1.parsePathSegments)(path);
|
|
7
|
+
let current = context;
|
|
8
|
+
for (const segment of segments) {
|
|
9
|
+
if (current === null || current === undefined) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
if (/^\d+$/.test(segment) && Array.isArray(current)) {
|
|
13
|
+
current = current[Number(segment)];
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
current = current[segment];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return current;
|
|
20
|
+
}
|
|
21
|
+
exports.resolvePathValue = resolvePathValue;
|
|
22
|
+
function resolveExpressions(text, context) {
|
|
23
|
+
return text.replace(/\{\{(.+?)\}\}/g, (match, path) => {
|
|
24
|
+
const trimmedPath = path.trim();
|
|
25
|
+
const value = resolvePathValue(trimmedPath, context);
|
|
26
|
+
if (value === undefined || value === null) {
|
|
27
|
+
return match;
|
|
28
|
+
}
|
|
29
|
+
if (typeof value === 'object') {
|
|
30
|
+
return JSON.stringify(value);
|
|
31
|
+
}
|
|
32
|
+
return String(value);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
exports.resolveExpressions = resolveExpressions;
|
|
36
|
+
function isTruthy(value) {
|
|
37
|
+
if (value === null || value === undefined) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (typeof value === 'boolean') {
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
if (typeof value === 'number') {
|
|
44
|
+
return value !== 0;
|
|
45
|
+
}
|
|
46
|
+
if (typeof value === 'string') {
|
|
47
|
+
return value.length > 0;
|
|
48
|
+
}
|
|
49
|
+
if (Array.isArray(value)) {
|
|
50
|
+
return value.length > 0;
|
|
51
|
+
}
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
exports.isTruthy = isTruthy;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ExpressionToken, DataSourceType } from './expression.types';
|
|
2
|
+
export declare function detectDataSource(path: string): DataSourceType | null;
|
|
3
|
+
export declare function tokenize(text: string): ExpressionToken[];
|
|
4
|
+
export declare function parsePathSegments(path: string): string[];
|