comfy-workflow
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -51,3 +51,8 @@ "use strict"; | ||
setInput(name, value) { | ||
this.inputs.set(name, value); | ||
if (value == null) { | ||
this.inputs.delete(name); | ||
} | ||
else { | ||
this.inputs.set(name, value); | ||
} | ||
return this; | ||
@@ -123,5 +128,8 @@ } | ||
const t = this.nodes.get(value[0]); | ||
if (!t) | ||
throw new Error(`Invalid workflow format: node "${value[0]}" not found`); | ||
n.setInput(name, t.output(value[1])); | ||
if (t) { | ||
n.setInput(name, t.output(value[1])); | ||
} | ||
else { | ||
n.setInput(name, null); | ||
} | ||
} | ||
@@ -128,0 +136,0 @@ else { |
@@ -24,3 +24,8 @@ import * as APIFormat from './api-format'; | ||
setInput(name, value) { | ||
this.inputs.set(name, value); | ||
if (value == null) { | ||
this.inputs.delete(name); | ||
} | ||
else { | ||
this.inputs.set(name, value); | ||
} | ||
return this; | ||
@@ -95,5 +100,8 @@ } | ||
const t = this.nodes.get(value[0]); | ||
if (!t) | ||
throw new Error(`Invalid workflow format: node "${value[0]}" not found`); | ||
n.setInput(name, t.output(value[1])); | ||
if (t) { | ||
n.setInput(name, t.output(value[1])); | ||
} | ||
else { | ||
n.setInput(name, null); | ||
} | ||
} | ||
@@ -100,0 +108,0 @@ else { |
{ | ||
"name": "comfy-workflow", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"main": "dist/cjs/index.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/esm/index.js", |
@@ -29,4 +29,8 @@ import * as APIFormat from './api-format' | ||
setInput(name: string, value: APIFormat.InputValue) { | ||
this.inputs.set(name, value) | ||
setInput(name: string, value: APIFormat.InputValue | null) { | ||
if (value == null) { | ||
this.inputs.delete(name) | ||
} else { | ||
this.inputs.set(name, value) | ||
} | ||
return this | ||
@@ -114,7 +118,7 @@ } | ||
const t = this.nodes.get(value[0]) | ||
if (!t) | ||
throw new Error( | ||
`Invalid workflow format: node "${value[0]}" not found`, | ||
) | ||
n.setInput(name, t.output(value[1])) | ||
if (t) { | ||
n.setInput(name, t.output(value[1])) | ||
} else { | ||
n.setInput(name, null) | ||
} | ||
} else { | ||
@@ -121,0 +125,0 @@ n.setInput(name, value) |
@@ -17,3 +17,3 @@ import * as APIFormat from './api-format'; | ||
output(index: number): NodeOutput; | ||
setInput(name: string, value: APIFormat.InputValue): this; | ||
setInput(name: string, value: APIFormat.InputValue | null): this; | ||
setInputs(inputs: Record<string, APIFormat.InputValue>): this; | ||
@@ -20,0 +20,0 @@ toApiFormat(): APIFormat.Node; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
215596
4408