@abyss-project/main 1.0.109 → 1.0.111
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/api/billing-account.admin.api.d.ts +10 -0
- package/dist/api/billing-account.admin.api.js +38 -0
- package/dist/api/billing-addon-template.admin.api.d.ts +7 -0
- package/dist/api/billing-addon-template.admin.api.js +26 -0
- package/dist/api/billing-plan.admin.api.d.ts +6 -0
- package/dist/api/billing-plan.admin.api.js +20 -0
- package/dist/api/billing-plan.api.d.ts +4 -0
- package/dist/api/billing-plan.api.js +12 -0
- package/dist/api/index.d.ts +10 -4
- package/dist/api/index.js +10 -4
- package/dist/api/organization-billing.api.d.ts +17 -0
- package/dist/api/organization-billing.api.js +64 -0
- package/dist/api/organization-member.api.d.ts +12 -0
- package/dist/api/organization-member.api.js +44 -0
- package/dist/api/organization.api.d.ts +3 -2
- package/dist/api/organization.api.js +5 -1
- package/dist/api/project-access.admin.api.d.ts +1 -3
- package/dist/api/project-access.admin.api.js +1 -9
- package/dist/api/project-access.api.d.ts +5 -3
- package/dist/api/project-access.api.js +17 -9
- package/dist/api/project-api-key.api.d.ts +8 -0
- package/dist/api/project-api-key.api.js +29 -0
- package/dist/api/project.api.d.ts +1 -5
- package/dist/api/project.api.js +1 -17
- package/dist/api/team.api.d.ts +14 -0
- package/dist/api/team.api.js +52 -0
- package/dist/api/user-billing.api.d.ts +11 -0
- package/dist/api/user-billing.api.js +40 -0
- package/dist/api/user.api.d.ts +1 -4
- package/dist/api/user.api.js +1 -16
- package/dist/index.d.ts +1 -37
- package/dist/index.js +1 -37
- package/dist/permissions/ability.d.ts +12 -0
- package/dist/permissions/ability.js +134 -0
- package/dist/permissions/index.d.ts +1 -0
- package/dist/{workflow → permissions}/index.js +1 -1
- package/dist/types/enum/abyss-application-event.enum.d.ts +18 -1
- package/dist/types/enum/abyss-application-event.enum.js +17 -0
- package/dist/types/enum/index.d.ts +2 -4
- package/dist/types/enum/index.js +2 -4
- package/dist/types/enum/onboarding-steps.enum.d.ts +5 -3
- package/dist/types/enum/onboarding-steps.enum.js +5 -3
- package/dist/types/enum/organization-billing.enum.d.ts +70 -0
- package/dist/types/enum/organization-billing.enum.js +82 -0
- package/dist/types/enum/organization-permission.enum.d.ts +13 -1
- package/dist/types/enum/organization-permission.enum.js +40 -2
- package/dist/types/enum/user-type.enum.d.ts +1 -0
- package/dist/types/enum/user-type.enum.js +1 -0
- package/dist/types/interface/api/index.d.ts +17 -8
- package/dist/types/interface/api/index.js +17 -8
- package/dist/types/interface/api/requests/billing-account.admin.request.d.ts +53 -0
- package/dist/types/interface/api/requests/billing-addon-template.request.d.ts +32 -0
- package/dist/types/interface/api/requests/billing-plan.request.d.ts +37 -0
- package/dist/types/interface/api/requests/organization-billing.request.d.ts +95 -0
- package/dist/types/interface/api/requests/organization-member.request.d.ts +38 -0
- package/dist/types/interface/api/requests/organization.request.d.ts +10 -0
- package/dist/types/interface/api/requests/project-access.admin.request.d.ts +1 -20
- package/dist/types/interface/api/requests/project-access.request.d.ts +16 -20
- package/dist/types/interface/api/requests/project-api-key.request.d.ts +39 -0
- package/dist/types/interface/api/requests/project.request.d.ts +2 -23
- package/dist/types/interface/api/requests/team.request.d.ts +72 -0
- package/dist/types/interface/api/requests/user-billing.request.d.ts +23 -0
- package/dist/types/interface/api/requests/user.request.d.ts +2 -8
- package/dist/types/interface/api/responses/billing-account.admin.response.d.ts +38 -0
- package/dist/types/interface/api/responses/billing-addon-template.response.d.ts +22 -0
- package/dist/types/interface/api/responses/billing-plan.response.d.ts +26 -0
- package/dist/types/interface/api/responses/gift-code.admin.response.d.ts +0 -1
- package/dist/types/interface/api/responses/gift-code.response.d.ts +0 -1
- package/dist/types/interface/api/responses/organization-billing.response.d.ts +82 -0
- package/dist/types/interface/api/responses/organization-member.response.d.ts +42 -0
- package/dist/types/interface/api/responses/organization-member.response.js +2 -0
- package/dist/types/interface/api/responses/project-access.admin.response.d.ts +0 -8
- package/dist/types/interface/api/responses/project-access.response.d.ts +16 -8
- package/dist/types/interface/api/responses/project-api-key.response.d.ts +26 -0
- package/dist/types/interface/api/responses/project-api-key.response.js +2 -0
- package/dist/types/interface/api/responses/project.response.d.ts +0 -14
- package/dist/types/interface/api/responses/report.public.response.d.ts +0 -1
- package/dist/types/interface/api/responses/team.response.d.ts +52 -0
- package/dist/types/interface/api/responses/team.response.js +2 -0
- package/dist/types/interface/api/responses/user-billing.response.d.ts +45 -0
- package/dist/types/interface/api/responses/user-billing.response.js +2 -0
- package/dist/types/interface/index.d.ts +17 -3
- package/dist/types/interface/index.js +17 -3
- package/dist/types/interface/models/application.model.d.ts +1 -1
- package/dist/types/interface/models/atlas-group.model.d.ts +2 -2
- package/dist/types/interface/models/atlas-page.model.d.ts +2 -2
- package/dist/types/interface/models/atlas.model.d.ts +8 -5
- package/dist/types/interface/models/billing-account.model.d.ts +40 -0
- package/dist/types/interface/models/billing-account.model.js +2 -0
- package/dist/types/interface/models/billing-addon-template.model.d.ts +15 -0
- package/dist/types/interface/models/billing-addon-template.model.js +2 -0
- package/dist/types/interface/models/board-card-checklist.model.d.ts +1 -1
- package/dist/types/interface/models/board-card.model.d.ts +6 -6
- package/dist/types/interface/models/board-column.model.d.ts +1 -1
- package/dist/types/interface/models/board.model.d.ts +7 -4
- package/dist/types/interface/models/credit-transaction.model.d.ts +22 -0
- package/dist/types/interface/models/credit-transaction.model.js +2 -0
- package/dist/types/interface/models/draw.model.d.ts +3 -0
- package/dist/types/interface/models/gift-code-activation.model.d.ts +4 -3
- package/dist/types/interface/models/gift-code.model.d.ts +1 -1
- package/dist/types/interface/models/invoice.model.d.ts +26 -0
- package/dist/types/interface/models/invoice.model.js +2 -0
- package/dist/types/interface/models/memo.model.d.ts +3 -0
- package/dist/types/interface/models/organization-billing.model.d.ts +37 -0
- package/dist/types/interface/models/organization-billing.model.js +2 -0
- package/dist/types/interface/models/organization-member.model.d.ts +5 -4
- package/dist/types/interface/models/organization-project-quota.model.d.ts +15 -0
- package/dist/types/interface/models/organization-project-quota.model.js +2 -0
- package/dist/types/interface/models/organization-quota-alert.model.d.ts +11 -0
- package/dist/types/interface/models/organization-quota-alert.model.js +2 -0
- package/dist/types/interface/models/organization-service-quota.model.d.ts +13 -0
- package/dist/types/interface/models/organization-service-quota.model.js +2 -0
- package/dist/types/interface/models/organization.model.d.ts +13 -0
- package/dist/types/interface/models/plan-template.model.d.ts +29 -0
- package/dist/types/interface/models/plan-template.model.js +2 -0
- package/dist/types/interface/models/project-access.model.d.ts +5 -6
- package/dist/types/interface/models/project-api-key-application-access.model.d.ts +13 -0
- package/dist/types/interface/models/project-api-key-application-access.model.js +2 -0
- package/dist/types/interface/models/project-api-key.model.d.ts +15 -0
- package/dist/types/interface/models/project-api-key.model.js +2 -0
- package/dist/types/interface/models/project.model.d.ts +8 -12
- package/dist/types/interface/models/quota-grant.model.d.ts +20 -0
- package/dist/types/interface/models/quota-grant.model.js +2 -0
- package/dist/types/interface/models/retrospective.model.d.ts +6 -3
- package/dist/types/interface/models/short-link.model.d.ts +4 -1
- package/dist/types/interface/models/team-member.model.d.ts +11 -0
- package/dist/types/interface/models/team-member.model.js +2 -0
- package/dist/types/interface/models/team-project-access.model.d.ts +15 -0
- package/dist/types/interface/models/team-project-access.model.js +2 -0
- package/dist/types/interface/models/team-project-application-access.model.d.ts +13 -0
- package/dist/types/interface/models/team-project-application-access.model.js +2 -0
- package/dist/types/interface/models/team.model.d.ts +19 -0
- package/dist/types/interface/models/team.model.js +2 -0
- package/dist/types/interface/models/token-history.model.d.ts +9 -1
- package/dist/types/interface/models/usage-record.model.d.ts +24 -0
- package/dist/types/interface/models/usage-record.model.js +2 -0
- package/dist/types/interface/models/user-ticket-message.model.d.ts +1 -1
- package/dist/types/interface/models/user-ticket.model.d.ts +1 -1
- package/dist/types/interface/models/user.model.d.ts +16 -18
- package/dist/types/utils/onboarding.utils.d.ts +1 -6
- package/dist/types/utils/onboarding.utils.js +9 -5
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -1
- package/package.json +2 -1
- package/dist/api/user-credit-purchase.admin.api.d.ts +0 -7
- package/dist/api/user-credit-purchase.admin.api.js +0 -28
- package/dist/api/user-credit-purchase.api.d.ts +0 -3
- package/dist/api/user-credit-purchase.api.js +0 -14
- package/dist/api/user-transaction.admin.api.d.ts +0 -5
- package/dist/api/user-transaction.admin.api.js +0 -20
- package/dist/api/user-transaction.api.d.ts +0 -3
- package/dist/api/user-transaction.api.js +0 -14
- package/dist/expressions/index.d.ts +0 -5
- package/dist/expressions/index.js +0 -16
- package/dist/expressions/mapper.d.ts +0 -9
- package/dist/expressions/mapper.js +0 -90
- package/dist/expressions/parser.d.ts +0 -3
- package/dist/expressions/parser.js +0 -97
- package/dist/expressions/resolver.d.ts +0 -12
- package/dist/expressions/resolver.js +0 -88
- package/dist/expressions/types.d.ts +0 -36
- package/dist/types/enum/integration-type.enum.d.ts +0 -4
- package/dist/types/enum/integration-type.enum.js +0 -8
- package/dist/types/enum/invoice-status.enum.d.ts +0 -7
- package/dist/types/enum/invoice-status.enum.js +0 -11
- package/dist/types/enum/organization-role.enum.d.ts +0 -6
- package/dist/types/enum/organization-role.enum.js +0 -10
- package/dist/types/enum/organization-subscription-status.enum.d.ts +0 -7
- package/dist/types/enum/organization-subscription-status.enum.js +0 -11
- package/dist/types/enum/plan-billing-period.enum.d.ts +0 -4
- package/dist/types/enum/plan-billing-period.enum.js +0 -8
- package/dist/types/enum/plan-status.enum.d.ts +0 -4
- package/dist/types/enum/plan-status.enum.js +0 -8
- package/dist/types/enum/subscription-level.enum.d.ts +0 -72
- package/dist/types/enum/subscription-level.enum.js +0 -179
- package/dist/types/enum/usage-record-type.enum.d.ts +0 -8
- package/dist/types/enum/usage-record-type.enum.js +0 -12
- package/dist/types/enum/user-credit-purchase-payment-method.enum.d.ts +0 -3
- package/dist/types/enum/user-credit-purchase-payment-method.enum.js +0 -7
- package/dist/types/enum/user-credit-purchase-platform.enum.d.ts +0 -8
- package/dist/types/enum/user-credit-purchase-platform.enum.js +0 -12
- package/dist/types/enum/user-transaction-type.enum.d.ts +0 -14
- package/dist/types/enum/user-transaction-type.enum.js +0 -18
- package/dist/types/interface/api/requests/user-credit-purchase.admin.request.d.ts +0 -42
- package/dist/types/interface/api/requests/user-credit-purchase.request.d.ts +0 -9
- package/dist/types/interface/api/requests/user-transaction.admin.request.d.ts +0 -30
- package/dist/types/interface/api/requests/user-transaction.request.d.ts +0 -8
- package/dist/types/interface/api/responses/user-credit-purchase.admin.response.d.ts +0 -22
- package/dist/types/interface/api/responses/user-credit-purchase.response.d.ts +0 -8
- package/dist/types/interface/api/responses/user-transaction.admin.response.d.ts +0 -13
- package/dist/types/interface/api/responses/user-transaction.response.d.ts +0 -11
- package/dist/types/interface/models/subscription.model.d.ts +0 -16
- package/dist/types/interface/models/user-credit-purchase.model.d.ts +0 -22
- package/dist/types/interface/models/user-transaction.model.d.ts +0 -19
- package/dist/utils/organization-permission.utils.d.ts +0 -3
- package/dist/utils/organization-permission.utils.js +0 -36
- package/dist/utils/subscription.utils.d.ts +0 -6
- package/dist/utils/subscription.utils.js +0 -41
- package/dist/workflow/expression/expression-functions.utils.d.ts +0 -6
- package/dist/workflow/expression/expression-functions.utils.js +0 -61
- package/dist/workflow/expression/expression-mapper.d.ts +0 -11
- package/dist/workflow/expression/expression-mapper.js +0 -32
- package/dist/workflow/expression/expression-mapping.utils.d.ts +0 -4
- package/dist/workflow/expression/expression-mapping.utils.js +0 -43
- package/dist/workflow/expression/expression-resolver.utils.d.ts +0 -3
- package/dist/workflow/expression/expression-resolver.utils.js +0 -54
- package/dist/workflow/expression/expression-tokenizer.utils.d.ts +0 -4
- package/dist/workflow/expression/expression-tokenizer.utils.js +0 -123
- package/dist/workflow/expression/expression.types.d.ts +0 -33
- package/dist/workflow/expression/expression.types.js +0 -17
- package/dist/workflow/expression/index.d.ts +0 -10
- package/dist/workflow/expression/index.js +0 -40
- package/dist/workflow/expression/workflow-resolver.d.ts +0 -9
- package/dist/workflow/expression/workflow-resolver.js +0 -102
- package/dist/workflow/expressions/functions/array.d.ts +0 -2
- package/dist/workflow/expressions/functions/array.js +0 -252
- package/dist/workflow/expressions/functions/crypto.d.ts +0 -2
- package/dist/workflow/expressions/functions/crypto.js +0 -101
- package/dist/workflow/expressions/functions/datetime.d.ts +0 -2
- package/dist/workflow/expressions/functions/datetime.js +0 -256
- package/dist/workflow/expressions/functions/index.d.ts +0 -7
- package/dist/workflow/expressions/functions/index.js +0 -46
- package/dist/workflow/expressions/functions/math.d.ts +0 -2
- package/dist/workflow/expressions/functions/math.js +0 -174
- package/dist/workflow/expressions/functions/string.d.ts +0 -2
- package/dist/workflow/expressions/functions/string.js +0 -301
- package/dist/workflow/expressions/functions/utility.d.ts +0 -2
- package/dist/workflow/expressions/functions/utility.js +0 -230
- package/dist/workflow/expressions/helpers.d.ts +0 -26
- package/dist/workflow/expressions/helpers.js +0 -132
- package/dist/workflow/expressions/index.d.ts +0 -15
- package/dist/workflow/expressions/index.js +0 -61
- package/dist/workflow/expressions/parser.d.ts +0 -8
- package/dist/workflow/expressions/parser.js +0 -436
- package/dist/workflow/expressions/pipes/array-pipes.d.ts +0 -2
- package/dist/workflow/expressions/pipes/array-pipes.js +0 -248
- package/dist/workflow/expressions/pipes/index.d.ts +0 -8
- package/dist/workflow/expressions/pipes/index.js +0 -40
- package/dist/workflow/expressions/pipes/object-pipes.d.ts +0 -2
- package/dist/workflow/expressions/pipes/object-pipes.js +0 -243
- package/dist/workflow/expressions/pipes/string-pipes.d.ts +0 -9
- package/dist/workflow/expressions/pipes/string-pipes.js +0 -178
- package/dist/workflow/expressions/resolver.d.ts +0 -8
- package/dist/workflow/expressions/resolver.js +0 -263
- package/dist/workflow/expressions/types.d.ts +0 -144
- package/dist/workflow/expressions/types.js +0 -33
- package/dist/workflow/index.d.ts +0 -1
- /package/dist/{expressions/types.js → types/interface/api/requests/billing-account.admin.request.js} +0 -0
- /package/dist/types/interface/api/requests/{user-credit-purchase.admin.request.js → billing-addon-template.request.js} +0 -0
- /package/dist/types/interface/api/requests/{user-credit-purchase.request.js → billing-plan.request.js} +0 -0
- /package/dist/types/interface/api/requests/{user-transaction.admin.request.js → organization-billing.request.js} +0 -0
- /package/dist/types/interface/api/requests/{user-transaction.request.js → organization-member.request.js} +0 -0
- /package/dist/types/interface/api/{responses/user-credit-purchase.admin.response.js → requests/project-api-key.request.js} +0 -0
- /package/dist/types/interface/api/{responses/user-credit-purchase.response.js → requests/team.request.js} +0 -0
- /package/dist/types/interface/api/{responses/user-transaction.admin.response.js → requests/user-billing.request.js} +0 -0
- /package/dist/types/interface/api/responses/{user-transaction.response.js → billing-account.admin.response.js} +0 -0
- /package/dist/types/interface/{models/subscription.model.js → api/responses/billing-addon-template.response.js} +0 -0
- /package/dist/types/interface/{models/user-credit-purchase.model.js → api/responses/billing-plan.response.js} +0 -0
- /package/dist/types/interface/{models/user-transaction.model.js → api/responses/organization-billing.response.js} +0 -0
|
@@ -1,61 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
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;
|
|
@@ -1,32 +0,0 @@
|
|
|
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;
|
|
@@ -1,4 +0,0 @@
|
|
|
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[];
|
|
@@ -1,43 +0,0 @@
|
|
|
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;
|
|
@@ -1,54 +0,0 @@
|
|
|
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;
|
|
@@ -1,4 +0,0 @@
|
|
|
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[];
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parsePathSegments = exports.tokenize = exports.detectDataSource = void 0;
|
|
4
|
-
const expression_types_1 = require("./expression.types");
|
|
5
|
-
const EXPRESSION_PATTERN = /\{\{(.+?)\}\}/g;
|
|
6
|
-
const REFERENCE_PATTERN = /@(\w+):([a-zA-Z0-9-_]+)/g;
|
|
7
|
-
const DATA_SOURCE_PREFIXES = {
|
|
8
|
-
trigger: expression_types_1.DataSourceType.WORKFLOW_TRIGGER,
|
|
9
|
-
triggerData: expression_types_1.DataSourceType.WORKFLOW_TRIGGER,
|
|
10
|
-
steps: expression_types_1.DataSourceType.WORKFLOW_STEPS,
|
|
11
|
-
variables: expression_types_1.DataSourceType.WORKFLOW_VARIABLES,
|
|
12
|
-
secret: expression_types_1.DataSourceType.SECRETS,
|
|
13
|
-
ipAddress: expression_types_1.DataSourceType.IP_ADDRESSES,
|
|
14
|
-
domain: expression_types_1.DataSourceType.DOMAINS,
|
|
15
|
-
abyss: expression_types_1.DataSourceType.ABYSS_CONFIG,
|
|
16
|
-
app: expression_types_1.DataSourceType.APPLICATIONS,
|
|
17
|
-
project: expression_types_1.DataSourceType.PROJECT,
|
|
18
|
-
env: expression_types_1.DataSourceType.ENV,
|
|
19
|
-
fn: expression_types_1.DataSourceType.FUNCTIONS,
|
|
20
|
-
};
|
|
21
|
-
function detectDataSource(path) {
|
|
22
|
-
const firstDot = path.indexOf('.');
|
|
23
|
-
const firstBracket = path.indexOf('[');
|
|
24
|
-
let prefix;
|
|
25
|
-
if (firstDot === -1 && firstBracket === -1) {
|
|
26
|
-
prefix = path;
|
|
27
|
-
}
|
|
28
|
-
else if (firstDot === -1) {
|
|
29
|
-
prefix = path.substring(0, firstBracket);
|
|
30
|
-
}
|
|
31
|
-
else if (firstBracket === -1) {
|
|
32
|
-
prefix = path.substring(0, firstDot);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
prefix = path.substring(0, Math.min(firstDot, firstBracket));
|
|
36
|
-
}
|
|
37
|
-
return DATA_SOURCE_PREFIXES[prefix] || null;
|
|
38
|
-
}
|
|
39
|
-
exports.detectDataSource = detectDataSource;
|
|
40
|
-
function tokenize(text) {
|
|
41
|
-
const tokens = [];
|
|
42
|
-
let lastIndex = 0;
|
|
43
|
-
const expressionMatches = Array.from(text.matchAll(EXPRESSION_PATTERN));
|
|
44
|
-
for (const match of expressionMatches) {
|
|
45
|
-
const matchIndex = match.index;
|
|
46
|
-
if (matchIndex > lastIndex) {
|
|
47
|
-
tokens.push({
|
|
48
|
-
type: 'text',
|
|
49
|
-
value: text.substring(lastIndex, matchIndex),
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
tokens.push({
|
|
53
|
-
type: 'expression',
|
|
54
|
-
value: match[1].trim(),
|
|
55
|
-
raw: match[0],
|
|
56
|
-
});
|
|
57
|
-
lastIndex = matchIndex + match[0].length;
|
|
58
|
-
}
|
|
59
|
-
if (lastIndex < text.length) {
|
|
60
|
-
tokens.push({
|
|
61
|
-
type: 'text',
|
|
62
|
-
value: text.substring(lastIndex),
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
const referenceMatches = Array.from(text.matchAll(REFERENCE_PATTERN));
|
|
66
|
-
for (const match of referenceMatches) {
|
|
67
|
-
tokens.push({
|
|
68
|
-
type: 'reference',
|
|
69
|
-
entityType: match[1],
|
|
70
|
-
entityId: match[2],
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
return tokens;
|
|
74
|
-
}
|
|
75
|
-
exports.tokenize = tokenize;
|
|
76
|
-
function parsePathSegments(path) {
|
|
77
|
-
const segments = [];
|
|
78
|
-
let current = '';
|
|
79
|
-
let inBrackets = false;
|
|
80
|
-
let quoteChar = null;
|
|
81
|
-
for (let i = 0; i < path.length; i++) {
|
|
82
|
-
const char = path[i];
|
|
83
|
-
if (quoteChar) {
|
|
84
|
-
if (char === quoteChar && path[i - 1] !== '\\') {
|
|
85
|
-
quoteChar = null;
|
|
86
|
-
}
|
|
87
|
-
else if (char !== quoteChar) {
|
|
88
|
-
current += char;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
else if (char === '"' || char === "'") {
|
|
92
|
-
quoteChar = char;
|
|
93
|
-
}
|
|
94
|
-
else if (char === '[') {
|
|
95
|
-
if (current) {
|
|
96
|
-
segments.push(current);
|
|
97
|
-
current = '';
|
|
98
|
-
}
|
|
99
|
-
inBrackets = true;
|
|
100
|
-
}
|
|
101
|
-
else if (char === ']') {
|
|
102
|
-
if (current) {
|
|
103
|
-
segments.push(current);
|
|
104
|
-
current = '';
|
|
105
|
-
}
|
|
106
|
-
inBrackets = false;
|
|
107
|
-
}
|
|
108
|
-
else if (char === '.' && !inBrackets) {
|
|
109
|
-
if (current) {
|
|
110
|
-
segments.push(current);
|
|
111
|
-
current = '';
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
current += char;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
if (current) {
|
|
119
|
-
segments.push(current);
|
|
120
|
-
}
|
|
121
|
-
return segments;
|
|
122
|
-
}
|
|
123
|
-
exports.parsePathSegments = parsePathSegments;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { ResourceMapping as GenericResourceMapping } from '../../expressions';
|
|
2
|
-
export declare enum DataSourceType {
|
|
3
|
-
WORKFLOW_TRIGGER = "trigger",
|
|
4
|
-
WORKFLOW_STEPS = "steps",
|
|
5
|
-
WORKFLOW_VARIABLES = "variables",
|
|
6
|
-
SECRETS = "secret",
|
|
7
|
-
IP_ADDRESSES = "ipAddress",
|
|
8
|
-
DOMAINS = "domain",
|
|
9
|
-
APPLICATIONS = "app",
|
|
10
|
-
ABYSS_CONFIG = "abyss",
|
|
11
|
-
PROJECT = "project",
|
|
12
|
-
ENV = "env",
|
|
13
|
-
FUNCTIONS = "fn"
|
|
14
|
-
}
|
|
15
|
-
export type WorkflowResourceMapping = GenericResourceMapping<DataSourceType>;
|
|
16
|
-
export interface WorkflowExpressionContext {
|
|
17
|
-
trigger?: Record<string, unknown>;
|
|
18
|
-
steps?: Record<string, unknown>;
|
|
19
|
-
variables?: Record<string, unknown>;
|
|
20
|
-
secret?: Record<string, unknown>;
|
|
21
|
-
ipAddress?: Record<string, unknown>;
|
|
22
|
-
domain?: Record<string, unknown>;
|
|
23
|
-
app?: Record<string, unknown>;
|
|
24
|
-
abyss?: Record<string, unknown>;
|
|
25
|
-
project?: Record<string, unknown>;
|
|
26
|
-
env?: Record<string, unknown>;
|
|
27
|
-
}
|
|
28
|
-
export interface WorkflowExpressionResult {
|
|
29
|
-
value: unknown;
|
|
30
|
-
success: boolean;
|
|
31
|
-
error?: string;
|
|
32
|
-
accessedSources: DataSourceType[];
|
|
33
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DataSourceType = void 0;
|
|
4
|
-
var DataSourceType;
|
|
5
|
-
(function (DataSourceType) {
|
|
6
|
-
DataSourceType["WORKFLOW_TRIGGER"] = "trigger";
|
|
7
|
-
DataSourceType["WORKFLOW_STEPS"] = "steps";
|
|
8
|
-
DataSourceType["WORKFLOW_VARIABLES"] = "variables";
|
|
9
|
-
DataSourceType["SECRETS"] = "secret";
|
|
10
|
-
DataSourceType["IP_ADDRESSES"] = "ipAddress";
|
|
11
|
-
DataSourceType["DOMAINS"] = "domain";
|
|
12
|
-
DataSourceType["APPLICATIONS"] = "app";
|
|
13
|
-
DataSourceType["ABYSS_CONFIG"] = "abyss";
|
|
14
|
-
DataSourceType["PROJECT"] = "project";
|
|
15
|
-
DataSourceType["ENV"] = "env";
|
|
16
|
-
DataSourceType["FUNCTIONS"] = "fn";
|
|
17
|
-
})(DataSourceType || (exports.DataSourceType = DataSourceType = {}));
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type { WorkflowResourceMapping, WorkflowExpressionContext, WorkflowExpressionResult, } from './expression.types';
|
|
2
|
-
export { DataSourceType } from './expression.types';
|
|
3
|
-
export { convertToDisplayFormat, convertToSaveFormat, extractMappings, validateExpression, createWorkflowResourceMapping, buildPathSegment, } from './expression-mapper';
|
|
4
|
-
export { resolveWorkflowExpression, isWorkflowExpressionDynamic, extractDataSources, validateWorkflowExpression, } from './workflow-resolver';
|
|
5
|
-
export type { ExpressionMappingOptions, ExpressionParserConfig, ResolverOptions, } from '../../expressions';
|
|
6
|
-
export { parseExpression, stringifyExpression, isDynamicExpression, extractPaths, } from '../../expressions';
|
|
7
|
-
export * from './expression-resolver.utils';
|
|
8
|
-
export * from './expression-tokenizer.utils';
|
|
9
|
-
export * from './expression-functions.utils';
|
|
10
|
-
export * from './expression-mapping.utils';
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.extractPaths = exports.isDynamicExpression = exports.stringifyExpression = exports.parseExpression = exports.validateWorkflowExpression = exports.extractDataSources = exports.isWorkflowExpressionDynamic = exports.resolveWorkflowExpression = exports.buildPathSegment = exports.createWorkflowResourceMapping = exports.validateExpression = exports.extractMappings = exports.convertToSaveFormat = exports.convertToDisplayFormat = exports.DataSourceType = void 0;
|
|
18
|
-
var expression_types_1 = require("./expression.types");
|
|
19
|
-
Object.defineProperty(exports, "DataSourceType", { enumerable: true, get: function () { return expression_types_1.DataSourceType; } });
|
|
20
|
-
var expression_mapper_1 = require("./expression-mapper");
|
|
21
|
-
Object.defineProperty(exports, "convertToDisplayFormat", { enumerable: true, get: function () { return expression_mapper_1.convertToDisplayFormat; } });
|
|
22
|
-
Object.defineProperty(exports, "convertToSaveFormat", { enumerable: true, get: function () { return expression_mapper_1.convertToSaveFormat; } });
|
|
23
|
-
Object.defineProperty(exports, "extractMappings", { enumerable: true, get: function () { return expression_mapper_1.extractMappings; } });
|
|
24
|
-
Object.defineProperty(exports, "validateExpression", { enumerable: true, get: function () { return expression_mapper_1.validateExpression; } });
|
|
25
|
-
Object.defineProperty(exports, "createWorkflowResourceMapping", { enumerable: true, get: function () { return expression_mapper_1.createWorkflowResourceMapping; } });
|
|
26
|
-
Object.defineProperty(exports, "buildPathSegment", { enumerable: true, get: function () { return expression_mapper_1.buildPathSegment; } });
|
|
27
|
-
var workflow_resolver_1 = require("./workflow-resolver");
|
|
28
|
-
Object.defineProperty(exports, "resolveWorkflowExpression", { enumerable: true, get: function () { return workflow_resolver_1.resolveWorkflowExpression; } });
|
|
29
|
-
Object.defineProperty(exports, "isWorkflowExpressionDynamic", { enumerable: true, get: function () { return workflow_resolver_1.isWorkflowExpressionDynamic; } });
|
|
30
|
-
Object.defineProperty(exports, "extractDataSources", { enumerable: true, get: function () { return workflow_resolver_1.extractDataSources; } });
|
|
31
|
-
Object.defineProperty(exports, "validateWorkflowExpression", { enumerable: true, get: function () { return workflow_resolver_1.validateWorkflowExpression; } });
|
|
32
|
-
var expressions_1 = require("../../expressions");
|
|
33
|
-
Object.defineProperty(exports, "parseExpression", { enumerable: true, get: function () { return expressions_1.parseExpression; } });
|
|
34
|
-
Object.defineProperty(exports, "stringifyExpression", { enumerable: true, get: function () { return expressions_1.stringifyExpression; } });
|
|
35
|
-
Object.defineProperty(exports, "isDynamicExpression", { enumerable: true, get: function () { return expressions_1.isDynamicExpression; } });
|
|
36
|
-
Object.defineProperty(exports, "extractPaths", { enumerable: true, get: function () { return expressions_1.extractPaths; } });
|
|
37
|
-
__exportStar(require("./expression-resolver.utils"), exports);
|
|
38
|
-
__exportStar(require("./expression-tokenizer.utils"), exports);
|
|
39
|
-
__exportStar(require("./expression-functions.utils"), exports);
|
|
40
|
-
__exportStar(require("./expression-mapping.utils"), exports);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type ResolverOptions } from '../../expressions';
|
|
2
|
-
import type { WorkflowExpressionContext, WorkflowExpressionResult, DataSourceType } from './expression.types';
|
|
3
|
-
export declare function resolveWorkflowExpression(expression: string, context: WorkflowExpressionContext, options?: ResolverOptions): WorkflowExpressionResult;
|
|
4
|
-
export declare function isWorkflowExpressionDynamic(expression: string): boolean;
|
|
5
|
-
export declare function extractDataSources(expression: string): DataSourceType[];
|
|
6
|
-
export declare function validateWorkflowExpression(expression: string): {
|
|
7
|
-
valid: boolean;
|
|
8
|
-
error?: string;
|
|
9
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateWorkflowExpression = exports.extractDataSources = exports.isWorkflowExpressionDynamic = exports.resolveWorkflowExpression = void 0;
|
|
4
|
-
const expressions_1 = require("../../expressions");
|
|
5
|
-
function resolveWorkflowExpression(expression, context, options) {
|
|
6
|
-
try {
|
|
7
|
-
const paths = (0, expressions_1.extractPaths)(expression);
|
|
8
|
-
const accessedSources = new Set();
|
|
9
|
-
for (const path of paths) {
|
|
10
|
-
const source = path.split('.')[0];
|
|
11
|
-
accessedSources.add(source);
|
|
12
|
-
}
|
|
13
|
-
const value = (0, expressions_1.resolveExpression)(expression, context, {
|
|
14
|
-
...options,
|
|
15
|
-
functions: {
|
|
16
|
-
...workflowFunctions,
|
|
17
|
-
...((options === null || options === void 0 ? void 0 : options.functions) || {}),
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
return {
|
|
21
|
-
value,
|
|
22
|
-
success: true,
|
|
23
|
-
accessedSources: Array.from(accessedSources),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
return {
|
|
28
|
-
value: undefined,
|
|
29
|
-
success: false,
|
|
30
|
-
error: error instanceof Error ? error.message : String(error),
|
|
31
|
-
accessedSources: [],
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.resolveWorkflowExpression = resolveWorkflowExpression;
|
|
36
|
-
const workflowFunctions = {
|
|
37
|
-
upper: (str) => String(str).toUpperCase(),
|
|
38
|
-
lower: (str) => String(str).toLowerCase(),
|
|
39
|
-
trim: (str) => String(str).trim(),
|
|
40
|
-
length: (str) => String(str).length,
|
|
41
|
-
join: (arr, separator = ',') => {
|
|
42
|
-
if (!Array.isArray(arr))
|
|
43
|
-
return String(arr);
|
|
44
|
-
return arr.join(String(separator));
|
|
45
|
-
},
|
|
46
|
-
first: (arr) => {
|
|
47
|
-
if (!Array.isArray(arr))
|
|
48
|
-
return arr;
|
|
49
|
-
return arr[0];
|
|
50
|
-
},
|
|
51
|
-
last: (arr) => {
|
|
52
|
-
if (!Array.isArray(arr))
|
|
53
|
-
return arr;
|
|
54
|
-
return arr[arr.length - 1];
|
|
55
|
-
},
|
|
56
|
-
now: () => new Date().toISOString(),
|
|
57
|
-
timestamp: () => Date.now(),
|
|
58
|
-
json: (obj) => JSON.stringify(obj),
|
|
59
|
-
default: (value, defaultValue) => {
|
|
60
|
-
return value === undefined || value === null ? defaultValue : value;
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
function isWorkflowExpressionDynamic(expression) {
|
|
64
|
-
return (0, expressions_1.isDynamicExpression)(expression);
|
|
65
|
-
}
|
|
66
|
-
exports.isWorkflowExpressionDynamic = isWorkflowExpressionDynamic;
|
|
67
|
-
function extractDataSources(expression) {
|
|
68
|
-
const paths = (0, expressions_1.extractPaths)(expression);
|
|
69
|
-
const sources = new Set();
|
|
70
|
-
for (const path of paths) {
|
|
71
|
-
const source = path.split('.')[0];
|
|
72
|
-
sources.add(source);
|
|
73
|
-
}
|
|
74
|
-
return Array.from(sources);
|
|
75
|
-
}
|
|
76
|
-
exports.extractDataSources = extractDataSources;
|
|
77
|
-
function validateWorkflowExpression(expression) {
|
|
78
|
-
try {
|
|
79
|
-
const openCount = (expression.match(/\{\{/g) || []).length;
|
|
80
|
-
const closeCount = (expression.match(/\}\}/g) || []).length;
|
|
81
|
-
if (openCount !== closeCount) {
|
|
82
|
-
return {
|
|
83
|
-
valid: false,
|
|
84
|
-
error: 'Mismatched expression delimiters',
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
if (/\{\{\s*\}\}/.test(expression)) {
|
|
88
|
-
return {
|
|
89
|
-
valid: false,
|
|
90
|
-
error: 'Empty expression found',
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
return { valid: true };
|
|
94
|
-
}
|
|
95
|
-
catch (error) {
|
|
96
|
-
return {
|
|
97
|
-
valid: false,
|
|
98
|
-
error: error instanceof Error ? error.message : String(error),
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
exports.validateWorkflowExpression = validateWorkflowExpression;
|