MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / extractCommands

Function extractCommands

javascript/selenium-webdriver/generate_bidi.mjs:563–591  ·  view source on GitHub ↗

Extract all BiDi commands by traversing CommandData and extension XxxCommand unions.

(ast)

Source from the content-addressed store, hash-verified

561
562/** Extract all BiDi commands by traversing CommandData and extension XxxCommand unions. */
563function extractCommands(ast) {
564 const defMap = buildDefMap(ast)
565 const emptyParamTypes = buildEmptyParamTypes(ast)
566 const commandNames = collectAllMembers(defMap, 'Command')
567 const commands = []
568
569 for (const name of commandNames) {
570 const def = defMap.get(name)
571 if (!def) continue
572
573 const parsed = parseLeafDef(def)
574 if (!parsed) continue
575
576 const { domain, methodStr, operationName: methodName, paramsCddl } = parsed
577 // emptyParamTypes holds raw CDDL group names, so compare the raw name (not the normalized one).
578 const hasParams = paramsCddl !== null && !emptyParamTypes.has(paramsCddl)
579
580 commands.push({
581 domain,
582 cddlName: name,
583 methodStr,
584 methodName,
585 paramsCddl,
586 hasParams,
587 })
588 }
589
590 return commands
591}
592
593/** Extract all BiDi events by traversing EventData and extension XxxEvent unions. */
594function extractEvents(ast) {

Callers 1

buildModelFunction · 0.85

Calls 6

buildDefMapFunction · 0.85
buildEmptyParamTypesFunction · 0.85
collectAllMembersFunction · 0.85
parseLeafDefFunction · 0.85
getMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected