@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.
Files changed (259) hide show
  1. package/dist/api/billing-account.admin.api.d.ts +10 -0
  2. package/dist/api/billing-account.admin.api.js +38 -0
  3. package/dist/api/billing-addon-template.admin.api.d.ts +7 -0
  4. package/dist/api/billing-addon-template.admin.api.js +26 -0
  5. package/dist/api/billing-plan.admin.api.d.ts +6 -0
  6. package/dist/api/billing-plan.admin.api.js +20 -0
  7. package/dist/api/billing-plan.api.d.ts +4 -0
  8. package/dist/api/billing-plan.api.js +12 -0
  9. package/dist/api/index.d.ts +10 -4
  10. package/dist/api/index.js +10 -4
  11. package/dist/api/organization-billing.api.d.ts +17 -0
  12. package/dist/api/organization-billing.api.js +64 -0
  13. package/dist/api/organization-member.api.d.ts +12 -0
  14. package/dist/api/organization-member.api.js +44 -0
  15. package/dist/api/organization.api.d.ts +3 -2
  16. package/dist/api/organization.api.js +5 -1
  17. package/dist/api/project-access.admin.api.d.ts +1 -3
  18. package/dist/api/project-access.admin.api.js +1 -9
  19. package/dist/api/project-access.api.d.ts +5 -3
  20. package/dist/api/project-access.api.js +17 -9
  21. package/dist/api/project-api-key.api.d.ts +8 -0
  22. package/dist/api/project-api-key.api.js +29 -0
  23. package/dist/api/project.api.d.ts +1 -5
  24. package/dist/api/project.api.js +1 -17
  25. package/dist/api/team.api.d.ts +14 -0
  26. package/dist/api/team.api.js +52 -0
  27. package/dist/api/user-billing.api.d.ts +11 -0
  28. package/dist/api/user-billing.api.js +40 -0
  29. package/dist/api/user.api.d.ts +1 -4
  30. package/dist/api/user.api.js +1 -16
  31. package/dist/index.d.ts +1 -37
  32. package/dist/index.js +1 -37
  33. package/dist/permissions/ability.d.ts +12 -0
  34. package/dist/permissions/ability.js +134 -0
  35. package/dist/permissions/index.d.ts +1 -0
  36. package/dist/{workflow → permissions}/index.js +1 -1
  37. package/dist/types/enum/abyss-application-event.enum.d.ts +18 -1
  38. package/dist/types/enum/abyss-application-event.enum.js +17 -0
  39. package/dist/types/enum/index.d.ts +2 -4
  40. package/dist/types/enum/index.js +2 -4
  41. package/dist/types/enum/onboarding-steps.enum.d.ts +5 -3
  42. package/dist/types/enum/onboarding-steps.enum.js +5 -3
  43. package/dist/types/enum/organization-billing.enum.d.ts +70 -0
  44. package/dist/types/enum/organization-billing.enum.js +82 -0
  45. package/dist/types/enum/organization-permission.enum.d.ts +13 -1
  46. package/dist/types/enum/organization-permission.enum.js +40 -2
  47. package/dist/types/enum/user-type.enum.d.ts +1 -0
  48. package/dist/types/enum/user-type.enum.js +1 -0
  49. package/dist/types/interface/api/index.d.ts +17 -8
  50. package/dist/types/interface/api/index.js +17 -8
  51. package/dist/types/interface/api/requests/billing-account.admin.request.d.ts +53 -0
  52. package/dist/types/interface/api/requests/billing-addon-template.request.d.ts +32 -0
  53. package/dist/types/interface/api/requests/billing-plan.request.d.ts +37 -0
  54. package/dist/types/interface/api/requests/organization-billing.request.d.ts +95 -0
  55. package/dist/types/interface/api/requests/organization-member.request.d.ts +38 -0
  56. package/dist/types/interface/api/requests/organization.request.d.ts +10 -0
  57. package/dist/types/interface/api/requests/project-access.admin.request.d.ts +1 -20
  58. package/dist/types/interface/api/requests/project-access.request.d.ts +16 -20
  59. package/dist/types/interface/api/requests/project-api-key.request.d.ts +39 -0
  60. package/dist/types/interface/api/requests/project.request.d.ts +2 -23
  61. package/dist/types/interface/api/requests/team.request.d.ts +72 -0
  62. package/dist/types/interface/api/requests/user-billing.request.d.ts +23 -0
  63. package/dist/types/interface/api/requests/user.request.d.ts +2 -8
  64. package/dist/types/interface/api/responses/billing-account.admin.response.d.ts +38 -0
  65. package/dist/types/interface/api/responses/billing-addon-template.response.d.ts +22 -0
  66. package/dist/types/interface/api/responses/billing-plan.response.d.ts +26 -0
  67. package/dist/types/interface/api/responses/gift-code.admin.response.d.ts +0 -1
  68. package/dist/types/interface/api/responses/gift-code.response.d.ts +0 -1
  69. package/dist/types/interface/api/responses/organization-billing.response.d.ts +82 -0
  70. package/dist/types/interface/api/responses/organization-member.response.d.ts +42 -0
  71. package/dist/types/interface/api/responses/organization-member.response.js +2 -0
  72. package/dist/types/interface/api/responses/project-access.admin.response.d.ts +0 -8
  73. package/dist/types/interface/api/responses/project-access.response.d.ts +16 -8
  74. package/dist/types/interface/api/responses/project-api-key.response.d.ts +26 -0
  75. package/dist/types/interface/api/responses/project-api-key.response.js +2 -0
  76. package/dist/types/interface/api/responses/project.response.d.ts +0 -14
  77. package/dist/types/interface/api/responses/report.public.response.d.ts +0 -1
  78. package/dist/types/interface/api/responses/team.response.d.ts +52 -0
  79. package/dist/types/interface/api/responses/team.response.js +2 -0
  80. package/dist/types/interface/api/responses/user-billing.response.d.ts +45 -0
  81. package/dist/types/interface/api/responses/user-billing.response.js +2 -0
  82. package/dist/types/interface/index.d.ts +17 -3
  83. package/dist/types/interface/index.js +17 -3
  84. package/dist/types/interface/models/application.model.d.ts +1 -1
  85. package/dist/types/interface/models/atlas-group.model.d.ts +2 -2
  86. package/dist/types/interface/models/atlas-page.model.d.ts +2 -2
  87. package/dist/types/interface/models/atlas.model.d.ts +8 -5
  88. package/dist/types/interface/models/billing-account.model.d.ts +40 -0
  89. package/dist/types/interface/models/billing-account.model.js +2 -0
  90. package/dist/types/interface/models/billing-addon-template.model.d.ts +15 -0
  91. package/dist/types/interface/models/billing-addon-template.model.js +2 -0
  92. package/dist/types/interface/models/board-card-checklist.model.d.ts +1 -1
  93. package/dist/types/interface/models/board-card.model.d.ts +6 -6
  94. package/dist/types/interface/models/board-column.model.d.ts +1 -1
  95. package/dist/types/interface/models/board.model.d.ts +7 -4
  96. package/dist/types/interface/models/credit-transaction.model.d.ts +22 -0
  97. package/dist/types/interface/models/credit-transaction.model.js +2 -0
  98. package/dist/types/interface/models/draw.model.d.ts +3 -0
  99. package/dist/types/interface/models/gift-code-activation.model.d.ts +4 -3
  100. package/dist/types/interface/models/gift-code.model.d.ts +1 -1
  101. package/dist/types/interface/models/invoice.model.d.ts +26 -0
  102. package/dist/types/interface/models/invoice.model.js +2 -0
  103. package/dist/types/interface/models/memo.model.d.ts +3 -0
  104. package/dist/types/interface/models/organization-billing.model.d.ts +37 -0
  105. package/dist/types/interface/models/organization-billing.model.js +2 -0
  106. package/dist/types/interface/models/organization-member.model.d.ts +5 -4
  107. package/dist/types/interface/models/organization-project-quota.model.d.ts +15 -0
  108. package/dist/types/interface/models/organization-project-quota.model.js +2 -0
  109. package/dist/types/interface/models/organization-quota-alert.model.d.ts +11 -0
  110. package/dist/types/interface/models/organization-quota-alert.model.js +2 -0
  111. package/dist/types/interface/models/organization-service-quota.model.d.ts +13 -0
  112. package/dist/types/interface/models/organization-service-quota.model.js +2 -0
  113. package/dist/types/interface/models/organization.model.d.ts +13 -0
  114. package/dist/types/interface/models/plan-template.model.d.ts +29 -0
  115. package/dist/types/interface/models/plan-template.model.js +2 -0
  116. package/dist/types/interface/models/project-access.model.d.ts +5 -6
  117. package/dist/types/interface/models/project-api-key-application-access.model.d.ts +13 -0
  118. package/dist/types/interface/models/project-api-key-application-access.model.js +2 -0
  119. package/dist/types/interface/models/project-api-key.model.d.ts +15 -0
  120. package/dist/types/interface/models/project-api-key.model.js +2 -0
  121. package/dist/types/interface/models/project.model.d.ts +8 -12
  122. package/dist/types/interface/models/quota-grant.model.d.ts +20 -0
  123. package/dist/types/interface/models/quota-grant.model.js +2 -0
  124. package/dist/types/interface/models/retrospective.model.d.ts +6 -3
  125. package/dist/types/interface/models/short-link.model.d.ts +4 -1
  126. package/dist/types/interface/models/team-member.model.d.ts +11 -0
  127. package/dist/types/interface/models/team-member.model.js +2 -0
  128. package/dist/types/interface/models/team-project-access.model.d.ts +15 -0
  129. package/dist/types/interface/models/team-project-access.model.js +2 -0
  130. package/dist/types/interface/models/team-project-application-access.model.d.ts +13 -0
  131. package/dist/types/interface/models/team-project-application-access.model.js +2 -0
  132. package/dist/types/interface/models/team.model.d.ts +19 -0
  133. package/dist/types/interface/models/team.model.js +2 -0
  134. package/dist/types/interface/models/token-history.model.d.ts +9 -1
  135. package/dist/types/interface/models/usage-record.model.d.ts +24 -0
  136. package/dist/types/interface/models/usage-record.model.js +2 -0
  137. package/dist/types/interface/models/user-ticket-message.model.d.ts +1 -1
  138. package/dist/types/interface/models/user-ticket.model.d.ts +1 -1
  139. package/dist/types/interface/models/user.model.d.ts +16 -18
  140. package/dist/types/utils/onboarding.utils.d.ts +1 -6
  141. package/dist/types/utils/onboarding.utils.js +9 -5
  142. package/dist/utils/index.d.ts +0 -1
  143. package/dist/utils/index.js +0 -1
  144. package/package.json +2 -1
  145. package/dist/api/user-credit-purchase.admin.api.d.ts +0 -7
  146. package/dist/api/user-credit-purchase.admin.api.js +0 -28
  147. package/dist/api/user-credit-purchase.api.d.ts +0 -3
  148. package/dist/api/user-credit-purchase.api.js +0 -14
  149. package/dist/api/user-transaction.admin.api.d.ts +0 -5
  150. package/dist/api/user-transaction.admin.api.js +0 -20
  151. package/dist/api/user-transaction.api.d.ts +0 -3
  152. package/dist/api/user-transaction.api.js +0 -14
  153. package/dist/expressions/index.d.ts +0 -5
  154. package/dist/expressions/index.js +0 -16
  155. package/dist/expressions/mapper.d.ts +0 -9
  156. package/dist/expressions/mapper.js +0 -90
  157. package/dist/expressions/parser.d.ts +0 -3
  158. package/dist/expressions/parser.js +0 -97
  159. package/dist/expressions/resolver.d.ts +0 -12
  160. package/dist/expressions/resolver.js +0 -88
  161. package/dist/expressions/types.d.ts +0 -36
  162. package/dist/types/enum/integration-type.enum.d.ts +0 -4
  163. package/dist/types/enum/integration-type.enum.js +0 -8
  164. package/dist/types/enum/invoice-status.enum.d.ts +0 -7
  165. package/dist/types/enum/invoice-status.enum.js +0 -11
  166. package/dist/types/enum/organization-role.enum.d.ts +0 -6
  167. package/dist/types/enum/organization-role.enum.js +0 -10
  168. package/dist/types/enum/organization-subscription-status.enum.d.ts +0 -7
  169. package/dist/types/enum/organization-subscription-status.enum.js +0 -11
  170. package/dist/types/enum/plan-billing-period.enum.d.ts +0 -4
  171. package/dist/types/enum/plan-billing-period.enum.js +0 -8
  172. package/dist/types/enum/plan-status.enum.d.ts +0 -4
  173. package/dist/types/enum/plan-status.enum.js +0 -8
  174. package/dist/types/enum/subscription-level.enum.d.ts +0 -72
  175. package/dist/types/enum/subscription-level.enum.js +0 -179
  176. package/dist/types/enum/usage-record-type.enum.d.ts +0 -8
  177. package/dist/types/enum/usage-record-type.enum.js +0 -12
  178. package/dist/types/enum/user-credit-purchase-payment-method.enum.d.ts +0 -3
  179. package/dist/types/enum/user-credit-purchase-payment-method.enum.js +0 -7
  180. package/dist/types/enum/user-credit-purchase-platform.enum.d.ts +0 -8
  181. package/dist/types/enum/user-credit-purchase-platform.enum.js +0 -12
  182. package/dist/types/enum/user-transaction-type.enum.d.ts +0 -14
  183. package/dist/types/enum/user-transaction-type.enum.js +0 -18
  184. package/dist/types/interface/api/requests/user-credit-purchase.admin.request.d.ts +0 -42
  185. package/dist/types/interface/api/requests/user-credit-purchase.request.d.ts +0 -9
  186. package/dist/types/interface/api/requests/user-transaction.admin.request.d.ts +0 -30
  187. package/dist/types/interface/api/requests/user-transaction.request.d.ts +0 -8
  188. package/dist/types/interface/api/responses/user-credit-purchase.admin.response.d.ts +0 -22
  189. package/dist/types/interface/api/responses/user-credit-purchase.response.d.ts +0 -8
  190. package/dist/types/interface/api/responses/user-transaction.admin.response.d.ts +0 -13
  191. package/dist/types/interface/api/responses/user-transaction.response.d.ts +0 -11
  192. package/dist/types/interface/models/subscription.model.d.ts +0 -16
  193. package/dist/types/interface/models/user-credit-purchase.model.d.ts +0 -22
  194. package/dist/types/interface/models/user-transaction.model.d.ts +0 -19
  195. package/dist/utils/organization-permission.utils.d.ts +0 -3
  196. package/dist/utils/organization-permission.utils.js +0 -36
  197. package/dist/utils/subscription.utils.d.ts +0 -6
  198. package/dist/utils/subscription.utils.js +0 -41
  199. package/dist/workflow/expression/expression-functions.utils.d.ts +0 -6
  200. package/dist/workflow/expression/expression-functions.utils.js +0 -61
  201. package/dist/workflow/expression/expression-mapper.d.ts +0 -11
  202. package/dist/workflow/expression/expression-mapper.js +0 -32
  203. package/dist/workflow/expression/expression-mapping.utils.d.ts +0 -4
  204. package/dist/workflow/expression/expression-mapping.utils.js +0 -43
  205. package/dist/workflow/expression/expression-resolver.utils.d.ts +0 -3
  206. package/dist/workflow/expression/expression-resolver.utils.js +0 -54
  207. package/dist/workflow/expression/expression-tokenizer.utils.d.ts +0 -4
  208. package/dist/workflow/expression/expression-tokenizer.utils.js +0 -123
  209. package/dist/workflow/expression/expression.types.d.ts +0 -33
  210. package/dist/workflow/expression/expression.types.js +0 -17
  211. package/dist/workflow/expression/index.d.ts +0 -10
  212. package/dist/workflow/expression/index.js +0 -40
  213. package/dist/workflow/expression/workflow-resolver.d.ts +0 -9
  214. package/dist/workflow/expression/workflow-resolver.js +0 -102
  215. package/dist/workflow/expressions/functions/array.d.ts +0 -2
  216. package/dist/workflow/expressions/functions/array.js +0 -252
  217. package/dist/workflow/expressions/functions/crypto.d.ts +0 -2
  218. package/dist/workflow/expressions/functions/crypto.js +0 -101
  219. package/dist/workflow/expressions/functions/datetime.d.ts +0 -2
  220. package/dist/workflow/expressions/functions/datetime.js +0 -256
  221. package/dist/workflow/expressions/functions/index.d.ts +0 -7
  222. package/dist/workflow/expressions/functions/index.js +0 -46
  223. package/dist/workflow/expressions/functions/math.d.ts +0 -2
  224. package/dist/workflow/expressions/functions/math.js +0 -174
  225. package/dist/workflow/expressions/functions/string.d.ts +0 -2
  226. package/dist/workflow/expressions/functions/string.js +0 -301
  227. package/dist/workflow/expressions/functions/utility.d.ts +0 -2
  228. package/dist/workflow/expressions/functions/utility.js +0 -230
  229. package/dist/workflow/expressions/helpers.d.ts +0 -26
  230. package/dist/workflow/expressions/helpers.js +0 -132
  231. package/dist/workflow/expressions/index.d.ts +0 -15
  232. package/dist/workflow/expressions/index.js +0 -61
  233. package/dist/workflow/expressions/parser.d.ts +0 -8
  234. package/dist/workflow/expressions/parser.js +0 -436
  235. package/dist/workflow/expressions/pipes/array-pipes.d.ts +0 -2
  236. package/dist/workflow/expressions/pipes/array-pipes.js +0 -248
  237. package/dist/workflow/expressions/pipes/index.d.ts +0 -8
  238. package/dist/workflow/expressions/pipes/index.js +0 -40
  239. package/dist/workflow/expressions/pipes/object-pipes.d.ts +0 -2
  240. package/dist/workflow/expressions/pipes/object-pipes.js +0 -243
  241. package/dist/workflow/expressions/pipes/string-pipes.d.ts +0 -9
  242. package/dist/workflow/expressions/pipes/string-pipes.js +0 -178
  243. package/dist/workflow/expressions/resolver.d.ts +0 -8
  244. package/dist/workflow/expressions/resolver.js +0 -263
  245. package/dist/workflow/expressions/types.d.ts +0 -144
  246. package/dist/workflow/expressions/types.js +0 -33
  247. package/dist/workflow/index.d.ts +0 -1
  248. /package/dist/{expressions/types.js → types/interface/api/requests/billing-account.admin.request.js} +0 -0
  249. /package/dist/types/interface/api/requests/{user-credit-purchase.admin.request.js → billing-addon-template.request.js} +0 -0
  250. /package/dist/types/interface/api/requests/{user-credit-purchase.request.js → billing-plan.request.js} +0 -0
  251. /package/dist/types/interface/api/requests/{user-transaction.admin.request.js → organization-billing.request.js} +0 -0
  252. /package/dist/types/interface/api/requests/{user-transaction.request.js → organization-member.request.js} +0 -0
  253. /package/dist/types/interface/api/{responses/user-credit-purchase.admin.response.js → requests/project-api-key.request.js} +0 -0
  254. /package/dist/types/interface/api/{responses/user-credit-purchase.response.js → requests/team.request.js} +0 -0
  255. /package/dist/types/interface/api/{responses/user-transaction.admin.response.js → requests/user-billing.request.js} +0 -0
  256. /package/dist/types/interface/api/responses/{user-transaction.response.js → billing-account.admin.response.js} +0 -0
  257. /package/dist/types/interface/{models/subscription.model.js → api/responses/billing-addon-template.response.js} +0 -0
  258. /package/dist/types/interface/{models/user-credit-purchase.model.js → api/responses/billing-plan.response.js} +0 -0
  259. /package/dist/types/interface/{models/user-transaction.model.js → api/responses/organization-billing.response.js} +0 -0
@@ -1,436 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tokenizeTemplate = exports.parseExpression = exports.parsePathSegments = exports.detectDataSource = void 0;
4
- const EXPRESSION_PATTERN = /\{\{(.+?)\}\}/g;
5
- const FUNCTION_PATTERN = /^(?:fn\.)?(\w+)\((.*)\)$/s;
6
- const PIPE_PATTERN = /\s*\|\s*(\w+)(?:\(([^)]*)\))?/g;
7
- const DATA_SOURCE_PREFIXES = {
8
- trigger: 'trigger',
9
- triggerData: 'trigger',
10
- steps: 'steps',
11
- variables: 'variables',
12
- secret: 'secret',
13
- ipAddress: 'ipAddress',
14
- domain: 'domain',
15
- abyss: 'abyss',
16
- app: 'app',
17
- project: 'project',
18
- env: 'env',
19
- fn: 'fn',
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 parsePathSegments(path) {
41
- const segments = [];
42
- let current = '';
43
- let inBracket = false;
44
- let bracketContent = '';
45
- for (let i = 0; i < path.length; i++) {
46
- const char = path[i];
47
- if (char === '[') {
48
- if (current) {
49
- segments.push(current);
50
- current = '';
51
- }
52
- inBracket = true;
53
- bracketContent = '';
54
- }
55
- else if (char === ']' && inBracket) {
56
- const cleaned = bracketContent.replace(/^["']|["']$/g, '');
57
- segments.push(cleaned);
58
- inBracket = false;
59
- bracketContent = '';
60
- }
61
- else if (inBracket) {
62
- bracketContent += char;
63
- }
64
- else if (char === '.') {
65
- if (current) {
66
- segments.push(current);
67
- current = '';
68
- }
69
- }
70
- else {
71
- current += char;
72
- }
73
- }
74
- if (current) {
75
- segments.push(current);
76
- }
77
- return segments;
78
- }
79
- exports.parsePathSegments = parsePathSegments;
80
- function parseExpression(expression) {
81
- const trimmed = expression.trim();
82
- if (!trimmed) {
83
- return { type: 'literal', literalType: 'string', literalValue: '', isValid: false, error: 'Empty expression' };
84
- }
85
- try {
86
- return parseExpressionAST(trimmed);
87
- }
88
- catch (error) {
89
- return {
90
- type: 'literal',
91
- literalType: 'string',
92
- literalValue: '',
93
- isValid: false,
94
- error: error instanceof Error ? error.message : 'Parse error',
95
- };
96
- }
97
- }
98
- exports.parseExpression = parseExpression;
99
- function parseExpressionAST(expr) {
100
- const trimmed = expr.trim();
101
- const ternary = findTernaryOperator(trimmed);
102
- if (ternary) {
103
- return {
104
- type: 'ternary',
105
- condition: parseExpressionAST(ternary.condition),
106
- consequent: parseExpressionAST(ternary.consequent),
107
- alternate: parseExpressionAST(ternary.alternate),
108
- isValid: true,
109
- };
110
- }
111
- const binary = findBinaryOperator(trimmed);
112
- if (binary) {
113
- return {
114
- type: 'binary',
115
- operator: binary.operator,
116
- left: parseExpressionAST(binary.left),
117
- right: parseExpressionAST(binary.right),
118
- isValid: true,
119
- };
120
- }
121
- return parsePrimary(trimmed);
122
- }
123
- function parsePrimary(expr) {
124
- const trimmed = expr.trim();
125
- if (trimmed.startsWith('!') && !trimmed.startsWith('!=')) {
126
- return {
127
- type: 'unary',
128
- operator: '!',
129
- operand: parsePrimary(trimmed.substring(1)),
130
- isValid: true,
131
- };
132
- }
133
- if (trimmed.startsWith('(') && trimmed.endsWith(')')) {
134
- const inner = trimmed.substring(1, trimmed.length - 1);
135
- return {
136
- type: 'group',
137
- expression: parseExpressionAST(inner),
138
- isValid: true,
139
- };
140
- }
141
- if ((trimmed.startsWith('"') && trimmed.endsWith('"')) ||
142
- (trimmed.startsWith("'") && trimmed.endsWith("'"))) {
143
- return {
144
- type: 'literal',
145
- literalType: 'string',
146
- literalValue: trimmed.slice(1, -1),
147
- isValid: true,
148
- };
149
- }
150
- if (/^-?\d+(\.\d+)?$/.test(trimmed)) {
151
- return {
152
- type: 'literal',
153
- literalType: 'number',
154
- literalValue: parseFloat(trimmed),
155
- isValid: true,
156
- };
157
- }
158
- if (trimmed === 'true' || trimmed === 'false') {
159
- return {
160
- type: 'literal',
161
- literalType: 'boolean',
162
- literalValue: trimmed === 'true',
163
- isValid: true,
164
- };
165
- }
166
- if (trimmed === 'null') {
167
- return {
168
- type: 'literal',
169
- literalType: 'null',
170
- literalValue: null,
171
- isValid: true,
172
- };
173
- }
174
- const funcMatch = trimmed.match(FUNCTION_PATTERN);
175
- if (funcMatch) {
176
- const [, funcName, argsStr] = funcMatch;
177
- return {
178
- type: 'function',
179
- isFunction: true,
180
- functionName: funcName,
181
- functionArgs: parseArgs(argsStr),
182
- isValid: true,
183
- };
184
- }
185
- const pipeIndex = findFirstPipeIndex(trimmed);
186
- if (pipeIndex !== -1) {
187
- const pathPart = trimmed.substring(0, pipeIndex).trim();
188
- const pipesPart = trimmed.substring(pipeIndex);
189
- const operations = parsePipeOperations(pipesPart);
190
- const source = detectDataSource(pathPart);
191
- return {
192
- type: 'path',
193
- path: pathPart,
194
- source,
195
- operations,
196
- isValid: true,
197
- };
198
- }
199
- const source = detectDataSource(trimmed);
200
- return {
201
- type: 'path',
202
- path: trimmed,
203
- source,
204
- isValid: true,
205
- };
206
- }
207
- const OPERATOR_PRECEDENCE_MAP = {
208
- '||': 1,
209
- '&&': 2,
210
- '==': 3,
211
- '!=': 3,
212
- '<': 4,
213
- '>': 4,
214
- '<=': 4,
215
- '>=': 4,
216
- '+': 5,
217
- '-': 5,
218
- '*': 6,
219
- '/': 6,
220
- '%': 6,
221
- '**': 7,
222
- };
223
- function findTernaryOperator(expr) {
224
- let depth = 0;
225
- let questionIdx = -1;
226
- let colonIdx = -1;
227
- for (let i = 0; i < expr.length; i++) {
228
- const char = expr[i];
229
- if (char === '(' || char === '[' || char === '{') {
230
- depth++;
231
- }
232
- if (char === ')' || char === ']' || char === '}') {
233
- depth--;
234
- }
235
- if (depth === 0) {
236
- if (char === '?' && questionIdx === -1) {
237
- questionIdx = i;
238
- }
239
- else if (char === ':' && questionIdx !== -1 && colonIdx === -1) {
240
- colonIdx = i;
241
- }
242
- }
243
- }
244
- if (questionIdx !== -1 && colonIdx !== -1) {
245
- return {
246
- condition: expr.substring(0, questionIdx).trim(),
247
- consequent: expr.substring(questionIdx + 1, colonIdx).trim(),
248
- alternate: expr.substring(colonIdx + 1).trim(),
249
- };
250
- }
251
- return null;
252
- }
253
- function findBinaryOperator(expr) {
254
- const operators = [
255
- '||', '&&', '===', '!==', '==', '!=', '>=', '<=', '>', '<',
256
- '**', '+', '-', '*', '/', '%',
257
- ];
258
- let depth = 0;
259
- let inString = false;
260
- let stringChar = '';
261
- let bestOp = null;
262
- for (let i = 0; i < expr.length; i++) {
263
- const char = expr[i];
264
- if ((char === '"' || char === "'") && (i === 0 || expr[i - 1] !== '\\')) {
265
- if (!inString) {
266
- inString = true;
267
- stringChar = char;
268
- }
269
- else if (char === stringChar) {
270
- inString = false;
271
- }
272
- continue;
273
- }
274
- if (inString) {
275
- continue;
276
- }
277
- if (char === '(' || char === '[' || char === '{')
278
- depth++;
279
- if (char === ')' || char === ']' || char === '}')
280
- depth--;
281
- if (depth !== 0)
282
- continue;
283
- for (const op of operators) {
284
- if (expr.substring(i, i + op.length) === op) {
285
- if (i === 0)
286
- continue;
287
- const precedence = OPERATOR_PRECEDENCE_MAP[op] || 0;
288
- if (!bestOp ||
289
- precedence < bestOp.precedence ||
290
- (precedence === bestOp.precedence && i > bestOp.index)) {
291
- bestOp = { operator: op, index: i, precedence };
292
- }
293
- break;
294
- }
295
- }
296
- }
297
- if (bestOp && bestOp.index > 0) {
298
- return {
299
- operator: bestOp.operator,
300
- left: expr.substring(0, bestOp.index).trim(),
301
- right: expr.substring(bestOp.index + bestOp.operator.length).trim(),
302
- };
303
- }
304
- return null;
305
- }
306
- function findFirstPipeIndex(str) {
307
- let depth = 0;
308
- let inString = false;
309
- let stringChar = '';
310
- for (let i = 0; i < str.length; i++) {
311
- const char = str[i];
312
- const prevChar = i > 0 ? str[i - 1] : '';
313
- if ((char === '"' || char === "'") && prevChar !== '\\') {
314
- if (!inString) {
315
- inString = true;
316
- stringChar = char;
317
- }
318
- else if (char === stringChar) {
319
- inString = false;
320
- }
321
- continue;
322
- }
323
- if (inString)
324
- continue;
325
- if (char === '(' || char === '[' || char === '{')
326
- depth++;
327
- if (char === ')' || char === ']' || char === '}')
328
- depth--;
329
- if (char === '|' && depth === 0 && str[i + 1] !== '|') {
330
- return i;
331
- }
332
- }
333
- return -1;
334
- }
335
- function parseArgs(argsString) {
336
- if (!argsString.trim()) {
337
- return [];
338
- }
339
- const args = [];
340
- let current = '';
341
- let depth = 0;
342
- let inString = false;
343
- let stringChar = '';
344
- for (let i = 0; i < argsString.length; i++) {
345
- const char = argsString[i];
346
- const prevChar = i > 0 ? argsString[i - 1] : '';
347
- if ((char === '"' || char === "'") && prevChar !== '\\') {
348
- if (!inString) {
349
- inString = true;
350
- stringChar = char;
351
- }
352
- else if (char === stringChar) {
353
- inString = false;
354
- }
355
- current += char;
356
- continue;
357
- }
358
- if (inString) {
359
- current += char;
360
- continue;
361
- }
362
- if (char === '(' || char === '[' || char === '{') {
363
- depth++;
364
- current += char;
365
- continue;
366
- }
367
- if (char === ')' || char === ']' || char === '}') {
368
- depth--;
369
- current += char;
370
- continue;
371
- }
372
- if (char === ',' && depth === 0) {
373
- args.push(parseArgValue(current.trim()));
374
- current = '';
375
- continue;
376
- }
377
- current += char;
378
- }
379
- if (current.trim()) {
380
- args.push(parseArgValue(current.trim()));
381
- }
382
- return args;
383
- }
384
- function parseArgValue(value) {
385
- if ((value.startsWith('"') && value.endsWith('"')) ||
386
- (value.startsWith("'") && value.endsWith("'"))) {
387
- return value.slice(1, -1);
388
- }
389
- if (value === 'true')
390
- return true;
391
- if (value === 'false')
392
- return false;
393
- if (value === 'null')
394
- return null;
395
- if (/^-?\d+(\.\d+)?$/.test(value))
396
- return parseFloat(value);
397
- return value;
398
- }
399
- function parsePipeOperations(pipesStr) {
400
- const operations = [];
401
- const pipePattern = /\s*\|\s*(\w+)(?:\(([^)]*)\))?/g;
402
- let match;
403
- while ((match = pipePattern.exec(pipesStr)) !== null) {
404
- const [, name, argsStr] = match;
405
- const args = argsStr ? parseArgs(argsStr) : [];
406
- operations.push({ name, args });
407
- }
408
- return operations;
409
- }
410
- function tokenizeTemplate(template) {
411
- const tokens = [];
412
- let lastIndex = 0;
413
- const regex = new RegExp(EXPRESSION_PATTERN);
414
- let match;
415
- while ((match = regex.exec(template)) !== null) {
416
- if (match.index > lastIndex) {
417
- tokens.push({
418
- type: 'text',
419
- value: template.substring(lastIndex, match.index),
420
- });
421
- }
422
- tokens.push({
423
- type: 'expression',
424
- value: match[1],
425
- });
426
- lastIndex = match.index + match[0].length;
427
- }
428
- if (lastIndex < template.length) {
429
- tokens.push({
430
- type: 'text',
431
- value: template.substring(lastIndex),
432
- });
433
- }
434
- return tokens;
435
- }
436
- exports.tokenizeTemplate = tokenizeTemplate;
@@ -1,2 +0,0 @@
1
- import type { PipeDefinition } from './string-pipes';
2
- export declare const arrayPipes: Record<string, PipeDefinition>;
@@ -1,248 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.arrayPipes = void 0;
4
- exports.arrayPipes = {
5
- first: {
6
- name: 'first',
7
- description: 'Gets the first element',
8
- category: 'array',
9
- signature: 'first',
10
- examples: ['{{trigger.items | first}}'],
11
- execute: (value) => {
12
- if (Array.isArray(value) && value.length > 0) {
13
- return value[0];
14
- }
15
- return undefined;
16
- },
17
- },
18
- last: {
19
- name: 'last',
20
- description: 'Gets the last element',
21
- category: 'array',
22
- signature: 'last',
23
- examples: ['{{trigger.items | last}}'],
24
- execute: (value) => {
25
- if (Array.isArray(value) && value.length > 0) {
26
- return value[value.length - 1];
27
- }
28
- return undefined;
29
- },
30
- },
31
- length: {
32
- name: 'length',
33
- description: 'Returns the length',
34
- category: 'array',
35
- signature: 'length',
36
- examples: ['{{trigger.items | length}}'],
37
- execute: (value) => {
38
- if (Array.isArray(value)) {
39
- return value.length;
40
- }
41
- if (typeof value === 'string') {
42
- return value.length;
43
- }
44
- return 0;
45
- },
46
- },
47
- join: {
48
- name: 'join',
49
- description: 'Joins array elements',
50
- category: 'array',
51
- signature: 'join(separator?)',
52
- examples: ['{{trigger.tags | join(", ")}}'],
53
- execute: (value, separator) => {
54
- if (!Array.isArray(value)) {
55
- return '';
56
- }
57
- return value.join(separator !== undefined ? String(separator) : ',');
58
- },
59
- },
60
- slice: {
61
- name: 'slice',
62
- description: 'Extracts a section',
63
- category: 'array',
64
- signature: 'slice(start, end?)',
65
- examples: ['{{trigger.items | slice(0, 3)}}'],
66
- execute: (value, start, end) => {
67
- if (!Array.isArray(value)) {
68
- return [];
69
- }
70
- return value.slice(Number(start), end !== undefined ? Number(end) : undefined);
71
- },
72
- },
73
- reverse: {
74
- name: 'reverse',
75
- description: 'Reverses the order',
76
- category: 'array',
77
- signature: 'reverse',
78
- examples: ['{{trigger.items | reverse}}'],
79
- execute: (value) => {
80
- if (!Array.isArray(value)) {
81
- return [];
82
- }
83
- return [...value].reverse();
84
- },
85
- },
86
- sort: {
87
- name: 'sort',
88
- description: 'Sorts the array',
89
- category: 'array',
90
- signature: 'sort',
91
- examples: ['{{trigger.numbers | sort}}'],
92
- execute: (value) => {
93
- if (!Array.isArray(value)) {
94
- return [];
95
- }
96
- return [...value].sort();
97
- },
98
- },
99
- unique: {
100
- name: 'unique',
101
- description: 'Returns unique elements',
102
- category: 'array',
103
- signature: 'unique',
104
- examples: ['{{trigger.tags | unique}}'],
105
- execute: (value) => {
106
- if (!Array.isArray(value)) {
107
- return [];
108
- }
109
- return Array.from(new Set(value));
110
- },
111
- },
112
- flatten: {
113
- name: 'flatten',
114
- description: 'Flattens nested arrays',
115
- category: 'array',
116
- signature: 'flatten',
117
- examples: ['{{trigger.nested | flatten}}'],
118
- execute: (value) => {
119
- if (!Array.isArray(value)) {
120
- return [];
121
- }
122
- return value.flat();
123
- },
124
- },
125
- compact: {
126
- name: 'compact',
127
- description: 'Removes falsy values',
128
- category: 'array',
129
- signature: 'compact',
130
- examples: ['{{trigger.items | compact}}'],
131
- execute: (value) => {
132
- if (!Array.isArray(value)) {
133
- return [];
134
- }
135
- return value.filter(Boolean);
136
- },
137
- },
138
- sum: {
139
- name: 'sum',
140
- description: 'Sums numeric values',
141
- category: 'array',
142
- signature: 'sum',
143
- examples: ['{{trigger.numbers | sum}}'],
144
- execute: (value) => {
145
- if (!Array.isArray(value)) {
146
- return 0;
147
- }
148
- return value.reduce((acc, val) => acc + Number(val), 0);
149
- },
150
- },
151
- avg: {
152
- name: 'avg',
153
- description: 'Calculates average',
154
- category: 'array',
155
- signature: 'avg',
156
- examples: ['{{trigger.scores | avg}}'],
157
- execute: (value) => {
158
- if (!Array.isArray(value) || value.length === 0) {
159
- return 0;
160
- }
161
- const sum = value.reduce((acc, val) => acc + Number(val), 0);
162
- return sum / value.length;
163
- },
164
- },
165
- min: {
166
- name: 'min',
167
- description: 'Returns minimum value',
168
- category: 'array',
169
- signature: 'min',
170
- examples: ['{{trigger.numbers | min}}'],
171
- execute: (value) => {
172
- if (!Array.isArray(value) || value.length === 0) {
173
- return undefined;
174
- }
175
- return Math.min(...value.map(Number));
176
- },
177
- },
178
- max: {
179
- name: 'max',
180
- description: 'Returns maximum value',
181
- category: 'array',
182
- signature: 'max',
183
- examples: ['{{trigger.numbers | max}}'],
184
- execute: (value) => {
185
- if (!Array.isArray(value) || value.length === 0) {
186
- return undefined;
187
- }
188
- return Math.max(...value.map(Number));
189
- },
190
- },
191
- map: {
192
- name: 'map',
193
- description: 'Maps over array elements',
194
- category: 'array',
195
- signature: 'map(property)',
196
- examples: ['{{trigger.users | map("name")}}'],
197
- execute: (value, property) => {
198
- if (!Array.isArray(value)) {
199
- return [];
200
- }
201
- const prop = String(property);
202
- return value.map((item) => {
203
- if (item && typeof item === 'object') {
204
- return item[prop];
205
- }
206
- return undefined;
207
- });
208
- },
209
- },
210
- filter: {
211
- name: 'filter',
212
- description: 'Filters array elements by property',
213
- category: 'array',
214
- signature: 'filter(property, value)',
215
- examples: ['{{trigger.users | filter("active", true)}}'],
216
- execute: (value, property, filterValue) => {
217
- if (!Array.isArray(value)) {
218
- return [];
219
- }
220
- const prop = String(property);
221
- return value.filter((item) => {
222
- if (item && typeof item === 'object') {
223
- return item[prop] === filterValue;
224
- }
225
- return false;
226
- });
227
- },
228
- },
229
- pluck: {
230
- name: 'pluck',
231
- description: 'Extracts property from each object',
232
- category: 'array',
233
- signature: 'pluck(property)',
234
- examples: ['{{trigger.users | pluck("email")}}'],
235
- execute: (value, property) => {
236
- if (!Array.isArray(value)) {
237
- return [];
238
- }
239
- const prop = String(property);
240
- return value.map((item) => {
241
- if (item && typeof item === 'object') {
242
- return item[prop];
243
- }
244
- return undefined;
245
- });
246
- },
247
- },
248
- };
@@ -1,8 +0,0 @@
1
- import type { PipeDefinition } from './string-pipes';
2
- import type { OperationCategory } from '../types';
3
- export declare const PIPE_OPERATIONS: Record<string, PipeDefinition>;
4
- export declare function executePipeOperation(name: string, value: unknown, args: unknown[]): unknown;
5
- export declare function getPipesByCategory(category: OperationCategory): Record<string, PipeDefinition>;
6
- export declare function getPipeNames(): string[];
7
- export declare function hasPipe(name: string): boolean;
8
- export declare function getPipe(name: string): PipeDefinition | undefined;