Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yield all available payloads as a list #1

Open
wants to merge 1 commit into
base: let
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 24 additions & 21 deletions spec/Section 6 -- Execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ ExecuteQuery(query, schema, variableValues, initialValue):
{hasNext} with the value {true}.
- Let {iterator} be the result of running
{YieldSubsequentPayloads(subsequentPayloads)}.
- For each {payload} yielded by {iterator}:
- For each {payloadList} yielded by {iterator}:
- If a termination signal is received:
- Send a termination signal to {iterator}.
- Return.
- Otherwise:
- Yield {payload}.
- Yield {payloadList}.

### Mutation

Expand Down Expand Up @@ -175,12 +175,12 @@ ExecuteMutation(mutation, schema, variableValues, initialValue):
{hasNext} with the value {true}.
- Let {iterator} be the result of running
{YieldSubsequentPayloads(subsequentPayloads)}.
- For each {payload} yielded by {iterator}:
- For each {payloadList} yielded by {iterator}:
- If a termination signal is received:
- Send a termination signal to {iterator}.
- Return.
- Otherwise:
- Yield {payload}.
- Yield {payloadList}.

### Subscription

Expand Down Expand Up @@ -337,12 +337,12 @@ ExecuteSubscriptionEvent(subscription, schema, variableValues, initialValue):
{hasNext} with the value {true}.
- Let {iterator} be the result of running
{YieldSubsequentPayloads(subsequentPayloads)}.
- For each {payload} yielded by {iterator}:
- For each {payloadList} yielded by {iterator}:
- If a termination signal is received:
- Send a termination signal to {iterator}.
- Return.
- Otherwise:
- Yield {payload}.
- Yield {payloadList}.

Note: The {ExecuteSubscriptionEvent()} algorithm is intentionally similar to
{ExecuteQuery()} since this is how each event result is produced.
Expand Down Expand Up @@ -372,21 +372,24 @@ YieldSubsequentPayloads(subsequentPayloads):
- If {record} contains {iterator}:
- Send a termination signal to {iterator}.
- Return.
- Let {record} be the first item in {subsequentPayloads} with a completed
{dataExecution}.
- Remove {record} from {subsequentPayloads}.
- If {isCompletedIterator} on {record} is {true}:
- If {subsequentPayloads} is empty:
- Yield a map containing a field `hasNext` with the value {false}.
- Return.
- If {subsequentPayloads} is not empty:
- Continue to the next record in {subsequentPayloads}.
- Let {payload} be the completed result returned by {dataExecution}.
- If {record} is not the final element in {subsequentPayloads}:
- Add an entry to {payload} named `hasNext` with the value {true}.
- If {record} is the final element in {subsequentPayloads}:
- Add an entry to {payload} named `hasNext` with the value {false}.
- Yield {payload}
- Let {completed} be the next set of items in {subsequentPayloads} with
completed {dataExecution} results.
- Initialize {payloadList} to an empty list.
- For each {record} in {completed}.
- Remove {record} from {subsequentPayloads}.
- If {isCompletedIterator} on {record} is {true}:
- If {subsequentPayloads} is empty:
- Yield a map containing a field `hasNext` with the value {false}.
- Return.
- If {subsequentPayloads} is not empty:
- Continue to the next record in {subsequentPayloads}.
- Let {payload} be the completed result returned by {dataExecution}.
- If {record} is not the final element in {subsequentPayloads}:
- Add an entry to {payload} named `hasNext` with the value {true}.
- If {record} is the final element in {subsequentPayloads}:
- Add an entry to {payload} named `hasNext` with the value {false}.
- Append {payload} to {payloadList}
- Yield {payloadList}

## Executing Selection Sets

Expand Down