Function GenerateTSFromJson

  • Generate typescript code to match a JSON workflow.

    Parameters

    • json: {
          client_id: string;
          extra_data?: {
              extra_pnginfo: {
                  workflow: {
                      config: {};
                      extra: {};
                      groups: {}[];
                      last_link_id?: number;
                      last_node_id?: number;
                      links: [number, number, number, number, number, string][];
                      nodes: {
                          id: number;
                          inputs: {}[];
                          outputs: {
                              links: number[];
                              name: string;
                              type: string;
                          }[];
                          type: string;
                      }[];
                      version: number;
                  };
              };
          };
          prompt: {};
      }

      the workflow

      • client_id: string
      • Optionalextra_data?: {
            extra_pnginfo: {
                workflow: {
                    config: {};
                    extra: {};
                    groups: {}[];
                    last_link_id?: number;
                    last_node_id?: number;
                    links: [number, number, number, number, number, string][];
                    nodes: {
                        id: number;
                        inputs: {}[];
                        outputs: {
                            links: number[];
                            name: string;
                            type: string;
                        }[];
                        type: string;
                    }[];
                    version: number;
                };
            };
        }
        • extra_pnginfo: {
              workflow: {
                  config: {};
                  extra: {};
                  groups: {}[];
                  last_link_id?: number;
                  last_node_id?: number;
                  links: [number, number, number, number, number, string][];
                  nodes: {
                      id: number;
                      inputs: {}[];
                      outputs: {
                          links: number[];
                          name: string;
                          type: string;
                      }[];
                      type: string;
                  }[];
                  version: number;
              };
          }
          • workflow: {
                config: {};
                extra: {};
                groups: {}[];
                last_link_id?: number;
                last_node_id?: number;
                links: [number, number, number, number, number, string][];
                nodes: {
                    id: number;
                    inputs: {}[];
                    outputs: {
                        links: number[];
                        name: string;
                        type: string;
                    }[];
                    type: string;
                }[];
                version: number;
            }
            • config: {}
              • extra: {}
                • groups: {}[]
                • Optionallast_link_id?: number
                • Optionallast_node_id?: number
                • links: [number, number, number, number, number, string][]
                • nodes: {
                      id: number;
                      inputs: {}[];
                      outputs: {
                          links: number[];
                          name: string;
                          type: string;
                      }[];
                      type: string;
                  }[]
                • version: number
          • prompt: {}
          • base: string = 'comfy'

            the name of the node registry to use. By default it is set to comfy

          Returns string

          The generated code based on the JSON workflow