Extract all BiDi commands by traversing CommandData and extension XxxCommand unions.
(ast)
| 529 | |
| 530 | /** Extract all BiDi commands by traversing CommandData and extension XxxCommand unions. */ |
| 531 | function extractCommands(ast) { |
| 532 | const defMap = buildDefMap(ast) |
| 533 | const emptyParamTypes = buildEmptyParamTypes(ast) |
| 534 | const commandNames = collectAllMembers(defMap, 'Command') |
| 535 | const commands = [] |
| 536 | |
| 537 | for (const name of commandNames) { |
| 538 | const def = defMap.get(name) |
| 539 | if (!def) continue |
| 540 | |
| 541 | const parsed = parseLeafDef(def) |
| 542 | if (!parsed) continue |
| 543 | |
| 544 | const { domain, methodStr, operationName: methodName, paramsCddl, vendor } = parsed |
| 545 | // emptyParamTypes holds raw CDDL group names, so compare the raw name (not the normalized one). |
| 546 | const hasParams = paramsCddl !== null && !emptyParamTypes.has(paramsCddl) |
| 547 | |
| 548 | commands.push({ |
| 549 | domain, |
| 550 | cddlName: name, |
| 551 | methodStr, |
| 552 | methodName, |
| 553 | paramsCddl, |
| 554 | hasParams, |
| 555 | vendor, |
| 556 | }) |
| 557 | } |
| 558 | |
| 559 | return commands |
| 560 | } |
| 561 | |
| 562 | /** Extract all BiDi events by traversing EventData and extension XxxEvent unions. */ |
| 563 | function extractEvents(ast) { |
no test coverage detected