File tree Expand file tree Collapse file tree 3 files changed +13
-15
lines changed Expand file tree Collapse file tree 3 files changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ class ComfyApi extends EventTarget {
249249 const objectInfoUnsafe = await resp . json ( )
250250 const objectInfo : Record < string , ComfyNodeDef > = { }
251251 for ( const key in objectInfoUnsafe ) {
252- const validatedDef = await validateComfyNodeDef (
252+ const validatedDef = validateComfyNodeDef (
253253 objectInfoUnsafe [ key ] ,
254254 /* onError=*/ ( errorMessage : string ) => {
255255 console . warn (
Original file line number Diff line number Diff line change @@ -285,11 +285,11 @@ export type ComfyInputsSpec = z.infer<typeof zComfyInputsSpec>
285285export type ComfyOutputTypesSpec = z . infer < typeof zComfyOutputTypesSpec >
286286export type ComfyNodeDef = z . infer < typeof zComfyNodeDef >
287287
288- export async function validateComfyNodeDef (
288+ export function validateComfyNodeDef (
289289 data : any ,
290290 onError : ( error : string ) => void = console . warn
291- ) : Promise < ComfyNodeDef | null > {
292- const result = await zComfyNodeDef . safeParseAsync ( data )
291+ ) : ComfyNodeDef | null {
292+ const result = zComfyNodeDef . safeParse ( data )
293293 if ( ! result . success ) {
294294 const zodError = fromZodError ( result . error )
295295 onError (
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ const EXAMPLE_NODE_DEF: ComfyNodeDef = {
2121
2222describe ( 'validateNodeDef' , ( ) => {
2323 it ( 'Should accept a valid node definition' , async ( ) => {
24- expect ( await validateComfyNodeDef ( EXAMPLE_NODE_DEF ) ) . not . toBeNull ( )
24+ expect ( validateComfyNodeDef ( EXAMPLE_NODE_DEF ) ) . not . toBeNull ( )
2525 } )
2626
2727 describe . each ( [
@@ -37,14 +37,12 @@ describe('validateNodeDef', () => {
3737 ( inputSpec , expected ) => {
3838 it ( `should accept input spec format: ${ JSON . stringify ( inputSpec ) } ` , async ( ) => {
3939 expect (
40- (
41- await validateComfyNodeDef ( {
42- ...EXAMPLE_NODE_DEF ,
43- input : {
44- required : inputSpec
45- }
46- } )
47- ) . input . required . ckpt_name
40+ validateComfyNodeDef ( {
41+ ...EXAMPLE_NODE_DEF ,
42+ input : {
43+ required : inputSpec
44+ }
45+ } ) . input . required . ckpt_name
4846 ) . toEqual ( expected )
4947 } )
5048 }
@@ -61,7 +59,7 @@ describe('validateNodeDef', () => {
6159 ( inputSpec ) => {
6260 it ( `should accept input spec format: ${ JSON . stringify ( inputSpec ) } ` , async ( ) => {
6361 expect (
64- await validateComfyNodeDef ( {
62+ validateComfyNodeDef ( {
6563 ...EXAMPLE_NODE_DEF ,
6664 input : {
6765 required : inputSpec
@@ -80,7 +78,7 @@ describe('validateNodeDef', () => {
8078 )
8179
8280 for ( const nodeDef of nodeDefs ) {
83- expect ( await validateComfyNodeDef ( nodeDef ) ) . not . toBeNull ( )
81+ expect ( validateComfyNodeDef ( nodeDef ) ) . not . toBeNull ( )
8482 }
8583 } )
8684} )
You can’t perform that action at this time.
0 commit comments