[Refactor] Use node def v2 in registerNodeDef (#2856)

This commit is contained in:
Chenlei Hu
2025-03-04 12:07:13 -05:00
committed by GitHub
parent fe5964ceb6
commit 2d179ad632
5 changed files with 84 additions and 64 deletions

View File

@@ -121,3 +121,19 @@ export const isComboInputSpec = (
): inputSpec is ComboInputSpec => {
return inputSpec.type === 'COMBO'
}
/**
* Check if a node definition is a valid ComfyUI node definition.
*
* Note: This is just a simple check against the V1 schema.
*
* @param nodeDef - The node definition to check.
* @returns True if the node definition is valid, false otherwise.
*/
export const isComfyNodeDef = (nodeDef: unknown): nodeDef is ComfyNodeDef => {
return (
!!nodeDef &&
typeof nodeDef === 'object' &&
['inputs', 'outputs'].every((key) => key in nodeDef)
)
}