* Parse SubBlockConfig items from within an array body (between the brackets). * Handles inline `{...}` objects and function calls `funcName(...)`.
( arrayContent: string, uiOnlyIds: Set<string>, utilsContent: string )
| 3410 | * Handles inline `{...}` objects and function calls `funcName(...)`. |
| 3411 | */ |
| 3412 | function parseSubBlockArrayContent( |
| 3413 | arrayContent: string, |
| 3414 | uiOnlyIds: Set<string>, |
| 3415 | utilsContent: string |
| 3416 | ): TriggerConfigField[] { |
| 3417 | const fields: TriggerConfigField[] = [] |
| 3418 | let i = 0 |
| 3419 | |
| 3420 | while (i < arrayContent.length) { |
| 3421 | if (arrayContent[i] === '{') { |
| 3422 | const j = findMatchingClose(arrayContent, i) |
| 3423 | if (j === -1) break |
| 3424 | const field = parseSubBlockObject(arrayContent.substring(i, j), uiOnlyIds, utilsContent) |
| 3425 | if (field) fields.push(field) |
| 3426 | i = j |
| 3427 | } else if (/[a-zA-Z_]/.test(arrayContent[i])) { |
| 3428 | // Possible function call: funcName(args) |
| 3429 | const funcCallMatch = /^(\w+)\s*\(/.exec(arrayContent.substring(i)) |
| 3430 | if (funcCallMatch && utilsContent) { |
| 3431 | const funcName = funcCallMatch[1] |
| 3432 | if (funcName !== 'true' && funcName !== 'false' && funcName !== 'null') { |
| 3433 | fields.push(...resolveSubBlockBuilderFunction(funcName, utilsContent)) |
| 3434 | } |
| 3435 | // Advance past the function call's closing paren |
| 3436 | const openIdx = arrayContent.indexOf('(', i + funcName.length) |
| 3437 | if (openIdx !== -1) { |
| 3438 | const closeIdx = findMatchingClose(arrayContent, openIdx, '(', ')') |
| 3439 | i = closeIdx !== -1 ? closeIdx : openIdx + 1 |
| 3440 | } else { |
| 3441 | i += funcName.length |
| 3442 | } |
| 3443 | } else { |
| 3444 | i++ |
| 3445 | } |
| 3446 | } else { |
| 3447 | i++ |
| 3448 | } |
| 3449 | } |
| 3450 | |
| 3451 | return fields |
| 3452 | } |
| 3453 | |
| 3454 | /** |
| 3455 | * Extract user-facing configuration fields from a TriggerConfig subBlocks definition. |
no test coverage detected