From 58eaf9d0dbfd2819521f1df0fc0e82f025fcf783 Mon Sep 17 00:00:00 2001 From: Yaacov Rydzinski Date: Wed, 7 Sep 2022 21:39:22 +0300 Subject: [PATCH] rename fieldPath to itemPath --- src/execution/execute.ts | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/execution/execute.ts b/src/execution/execute.ts index 0e5e6493c23..ca3df187d20 100644 --- a/src/execution/execute.ts +++ b/src/execution/execute.ts @@ -996,7 +996,7 @@ async function completeAsyncIteratorValue( break; } - const fieldPath = addPath(path, index, undefined); + const itemPath = addPath(path, index, undefined); let iteration; try { // eslint-disable-next-line no-await-in-loop @@ -1005,7 +1005,7 @@ async function completeAsyncIteratorValue( break; } } catch (rawError) { - const error = locatedError(rawError, fieldNodes, pathToArray(fieldPath)); + const error = locatedError(rawError, fieldNodes, pathToArray(itemPath)); completedResults.push(handleFieldError(error, itemType, errors)); break; } @@ -1019,7 +1019,7 @@ async function completeAsyncIteratorValue( itemType, fieldNodes, info, - fieldPath, + itemPath, asyncPayloadRecord, ) ) { @@ -1952,7 +1952,7 @@ async function executeStreamIteratorItem( info: GraphQLResolveInfo, itemType: GraphQLOutputType, asyncPayloadRecord: StreamRecord, - fieldPath: Path, + itemPath: Path, ): Promise> { let item; try { @@ -1963,9 +1963,9 @@ async function executeStreamIteratorItem( } item = value; } catch (rawError) { - const error = locatedError(rawError, fieldNodes, pathToArray(fieldPath)); + const error = locatedError(rawError, fieldNodes, pathToArray(itemPath)); const value = handleFieldError(error, itemType, asyncPayloadRecord.errors); - filterSubsequentPayloads(exeContext, fieldPath, asyncPayloadRecord); + filterSubsequentPayloads(exeContext, itemPath, asyncPayloadRecord); // don't continue if iterator throws return { done: true, value }; } @@ -1976,32 +1976,28 @@ async function executeStreamIteratorItem( itemType, fieldNodes, info, - fieldPath, + itemPath, item, asyncPayloadRecord, ); if (isPromise(completedItem)) { completedItem = completedItem.then(undefined, (rawError) => { - const error = locatedError( - rawError, - fieldNodes, - pathToArray(fieldPath), - ); + const error = locatedError(rawError, fieldNodes, pathToArray(itemPath)); const handledError = handleFieldError( error, itemType, asyncPayloadRecord.errors, ); - filterSubsequentPayloads(exeContext, fieldPath, asyncPayloadRecord); + filterSubsequentPayloads(exeContext, itemPath, asyncPayloadRecord); return handledError; }); } return { done: false, value: completedItem }; } catch (rawError) { - const error = locatedError(rawError, fieldNodes, pathToArray(fieldPath)); + const error = locatedError(rawError, fieldNodes, pathToArray(itemPath)); const value = handleFieldError(error, itemType, asyncPayloadRecord.errors); - filterSubsequentPayloads(exeContext, fieldPath, asyncPayloadRecord); + filterSubsequentPayloads(exeContext, itemPath, asyncPayloadRecord); return { done: false, value }; } } @@ -2021,10 +2017,10 @@ async function executeStreamIterator( let previousAsyncPayloadRecord = parentContext ?? undefined; // eslint-disable-next-line no-constant-condition while (true) { - const fieldPath = addPath(path, index, undefined); + const itemPath = addPath(path, index, undefined); const asyncPayloadRecord = new StreamRecord({ label, - path: fieldPath, + path: itemPath, parentContext: previousAsyncPayloadRecord, iterator, exeContext, @@ -2037,7 +2033,7 @@ async function executeStreamIterator( info, itemType, asyncPayloadRecord, - fieldPath, + itemPath, ); asyncPayloadRecord.addItems(