Function NormalizeComfyJSON

  • Convert the original json obtained from the ComfyUI backend into something less bad.

    Parameters

    • cfg: Record<string, {
          category: string;
          description: string;
          display_name: string;
          input: {
              optional?: [];
              required?: [];
          };
          name: string;
          output: string | string[];
          output_is_list: boolean[];
          output_name: string | string[];
          output_node: boolean;
          python_module: string;
      }>

      The original comfy json

    Returns Record<string, {
        inputs: Record<string, {
            metadata?: {
                default?: unknown;
                max?: unknown;
                min?: unknown;
                step?: unknown;
            };
            required: boolean;
            type: string | string[];
        }>;
        metadata: {
            category: string;
            description: string;
            display_name: string;
            is_output_node: boolean;
            name: string;
            python_module: string;
        };
        outputs: Record<string, {
            is_list: boolean;
            type: string;
        }>;
    }>

    A normalized version, since the original is awful