Skip to content

Commit 84c939c

Browse files
authored
Rename ComfyWorkflow to ComfyWorkflowJSON (#91)
1 parent d6b2d5f commit 84c939c

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

src/scripts/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ComfyWorkflow } from "types/comfyWorkflow";
1+
import { ComfyWorkflowJSON } from "types/comfyWorkflow";
22
import {
33
HistoryTaskItem,
44
PendingTaskItem,
@@ -13,7 +13,7 @@ interface QueuePromptRequestBody {
1313
prompt: Record<number, any>;
1414
extra_data: {
1515
extra_pnginfo: {
16-
workflow: ComfyWorkflow;
16+
workflow: ComfyWorkflowJSON;
1717
};
1818
};
1919
front?: boolean;

src/scripts/app.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import { createImageHost, calculateImageGrid } from "./ui/imagePreview";
1515
import { DraggableList } from "./ui/draggableList";
1616
import { applyTextReplacements, addStylesheet } from "./utils";
1717
import type { ComfyExtension } from "/types/comfy";
18-
import { type ComfyWorkflow, parseComfyWorkflow } from "../types/comfyWorkflow";
18+
import {
19+
type ComfyWorkflowJSON,
20+
parseComfyWorkflow,
21+
} from "../types/comfyWorkflow";
1922
import { ComfyNodeDef } from "/types/apiTypes";
2023
import { ComfyAppMenu } from "./ui/menu/index.js";
2124
import { getStorageValue, setStorageValue } from "./utils.js";
@@ -1094,7 +1097,7 @@ export class ComfyApp {
10941097

10951098
// No image found. Look for node data
10961099
data = data.getData("text/plain");
1097-
let workflow: ComfyWorkflow;
1100+
let workflow: ComfyWorkflowJSON;
10981101
try {
10991102
data = data.slice(data.indexOf("{"));
11001103
workflow = await parseComfyWorkflow(data);
@@ -2182,7 +2185,7 @@ export class ComfyApp {
21822185
* @param { boolean } clean If the graph state, e.g. images, should be cleared
21832186
*/
21842187
async loadGraphData(
2185-
graphData?: ComfyWorkflow,
2188+
graphData?: ComfyWorkflowJSON,
21862189
clean: boolean = true,
21872190
restore_view: boolean = true,
21882191
workflow: string | null = null

src/scripts/defaultGraph.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { ComfyWorkflow } from "/types/comfyWorkflow";
1+
import type { ComfyWorkflowJSON } from "/types/comfyWorkflow";
22

3-
export const defaultGraph: ComfyWorkflow = {
3+
export const defaultGraph: ComfyWorkflowJSON = {
44
last_node_id: 9,
55
last_link_id: 9,
66
nodes: [

src/types/comfyWorkflow.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,11 @@ export type NodeInput = z.infer<typeof zNodeInput>;
127127
export type NodeOutput = z.infer<typeof zNodeOutput>;
128128
export type ComfyLink = z.infer<typeof zComfyLink>;
129129
export type ComfyNode = z.infer<typeof zComfyNode>;
130-
export type ComfyWorkflow = z.infer<typeof zComfyWorkflow>;
130+
export type ComfyWorkflowJSON = z.infer<typeof zComfyWorkflow>;
131131

132-
export async function parseComfyWorkflow(data: string): Promise<ComfyWorkflow> {
132+
export async function parseComfyWorkflow(
133+
data: string
134+
): Promise<ComfyWorkflowJSON> {
133135
// Validate
134136
const result = await zComfyWorkflow.safeParseAsync(JSON.parse(data));
135137
if (!result.success) {

0 commit comments

Comments
 (0)