mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-07 14:09:59 +00:00
Minor subgraph ts fixes (#973)
This commit is contained in:
@@ -20,6 +20,8 @@ export type SerialisedLLinkArray = [
|
||||
type: ISlotType,
|
||||
]
|
||||
|
||||
type BasicReadonlyNetwork = Pick<ReadonlyLinkNetwork, "getNodeById" | "links" | "floatingLinks">
|
||||
|
||||
// this is the class in charge of storing link information
|
||||
export class LLink implements LinkSegment, Serialisable<SerialisableLLink> {
|
||||
/** Link ID */
|
||||
@@ -162,7 +164,7 @@ export class LLink implements LinkSegment, Serialisable<SerialisableLLink> {
|
||||
* @param linkId The ID of the link to get the origin node of
|
||||
* @returns The origin node of the link, or `undefined` if the link is not found or the origin node is not found
|
||||
*/
|
||||
static getOriginNode(network: Pick<ReadonlyLinkNetwork, "getNodeById" | "links">, linkId: LinkId): LGraphNode | undefined {
|
||||
static getOriginNode(network: BasicReadonlyNetwork, linkId: LinkId): LGraphNode | undefined {
|
||||
const id = network.links.get(linkId)?.origin_id
|
||||
return network.getNodeById(id) ?? undefined
|
||||
}
|
||||
@@ -173,7 +175,7 @@ export class LLink implements LinkSegment, Serialisable<SerialisableLLink> {
|
||||
* @param linkId The ID of the link to get the target node of
|
||||
* @returns The target node of the link, or `undefined` if the link is not found or the target node is not found
|
||||
*/
|
||||
static getTargetNode(network: Pick<ReadonlyLinkNetwork, "getNodeById" | "links">, linkId: LinkId): LGraphNode | undefined {
|
||||
static getTargetNode(network: BasicReadonlyNetwork, linkId: LinkId): LGraphNode | undefined {
|
||||
const id = network.links.get(linkId)?.target_id
|
||||
return network.getNodeById(id) ?? undefined
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ export interface BaseExportedGraph {
|
||||
/** Definitions of re-usable objects that are referenced elsewhere in this exported graph. */
|
||||
definitions?: {
|
||||
/** The base definition of subgraphs used in this workflow. That is, what you see when you open / edit a subgraph. */
|
||||
subgraphs?: Record<UUID, ExportedSubgraph>[]
|
||||
subgraphs?: Record<UUID, ExportedSubgraph>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ export interface ExportedSubgraphInstance extends NodeSubgraphSharedProps {
|
||||
* The ID of the actual subgraph definition.
|
||||
* @see {@link ExportedSubgraph.subgraphs}
|
||||
*/
|
||||
subgraphId: UUID
|
||||
type: UUID
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,7 +123,7 @@ export interface ISerialisedGraph extends BaseExportedGraph {
|
||||
* Defines a subgraph and its contents.
|
||||
* Can be referenced multiple times in a schema.
|
||||
*/
|
||||
export interface ExportedSubgraph extends ISerialisedGraph {
|
||||
export interface ExportedSubgraph extends SerialisableGraph {
|
||||
/** The display name of the subgraph. */
|
||||
name: string
|
||||
/** Ordered list of inputs to the subgraph itself. Similar to a reroute, with the input side in the graph, and the output side in the subgraph. */
|
||||
|
||||
Reference in New Issue
Block a user