From 9fef5ec00d595b7cbfe4ad0ad012f20bef058a7b Mon Sep 17 00:00:00 2001 From: Gerald Baulig Date: Thu, 29 Aug 2024 18:29:12 +0200 Subject: [PATCH] fix(facade): error in processing nested objects --- packages/facade/src/gql/protos/graphql.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/facade/src/gql/protos/graphql.ts b/packages/facade/src/gql/protos/graphql.ts index 8471711d..ed1ab457 100644 --- a/packages/facade/src/gql/protos/graphql.ts +++ b/packages/facade/src/gql/protos/graphql.ts @@ -47,17 +47,14 @@ export const preProcessGQLInput = async ( }; } else { const fields = model.getFields(); - const converted = await Promise.all( + await Promise.all( Object.keys(fields).filter( key => key in data ).map( - key => preProcessGQLInput(data[key], fields[key].type) + async key => data[key] = await preProcessGQLInput(data[key], fields[key].type) ) ); - return { - ...data, - ...converted, - }; + return data; } } @@ -106,10 +103,9 @@ export const postProcessGQLOutput = (data: any, model: GraphQLOutputType): any = } if (model instanceof GraphQLObjectType) { - if (model.name === 'GoogleProtobufAny' && data.value) { + if (model.name === 'GoogleProtobufAny') { // TODO Use encoded once resource base supports it - - const decoded = JSON.parse((data.value as Buffer).toString()); + const decoded = JSON.parse(data?.value?.toString()); return { ...data,