Skip to content

incremental delivery: add pending notifications #3897

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

Merged
merged 1 commit into from
Aug 25, 2023
Merged
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
56 changes: 54 additions & 2 deletions src/execution/IncrementalPublisher.ts
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ import type {
import type { GroupedFieldSet } from './collectFields.js';

interface IncrementalUpdate<TData = unknown, TExtensions = ObjMap<unknown>> {
pending: ReadonlyArray<PendingResult>;
incremental: ReadonlyArray<IncrementalResult<TData, TExtensions>>;
completed: ReadonlyArray<CompletedResult>;
}
@@ -59,6 +60,7 @@ export interface InitialIncrementalExecutionResult<
TExtensions = ObjMap<unknown>,
> extends ExecutionResult<TData, TExtensions> {
data: TData;
pending: ReadonlyArray<PendingResult>;
hasNext: true;
extensions?: TExtensions;
}
@@ -68,6 +70,7 @@ export interface FormattedInitialIncrementalExecutionResult<
TExtensions = ObjMap<unknown>,
> extends FormattedExecutionResult<TData, TExtensions> {
data: TData;
pending: ReadonlyArray<PendingResult>;
hasNext: boolean;
extensions?: TExtensions;
}
@@ -85,6 +88,7 @@ export interface FormattedSubsequentIncrementalExecutionResult<
TExtensions = ObjMap<unknown>,
> {
hasNext: boolean;
pending?: ReadonlyArray<PendingResult>;
incremental?: ReadonlyArray<FormattedIncrementalResult<TData, TExtensions>>;
completed?: ReadonlyArray<FormattedCompletedResult>;
extensions?: TExtensions;
@@ -141,6 +145,11 @@ export type FormattedIncrementalResult<
| FormattedIncrementalDeferResult<TData, TExtensions>
| FormattedIncrementalStreamResult<TData, TExtensions>;

export interface PendingResult {
path: ReadonlyArray<string | number>;
label?: string;
}

export interface CompletedResult {
path: ReadonlyArray<string | number>;
label?: string;
@@ -296,10 +305,20 @@ export class IncrementalPublisher {

const errors = initialResultRecord.errors;
const initialResult = errors.length === 0 ? { data } : { errors, data };
if (this._pending.size > 0) {
const pending = this._pending;
if (pending.size > 0) {
const pendingSources = new Set<DeferredFragmentRecord | StreamRecord>();
for (const subsequentResultRecord of pending) {
const pendingSource = isStreamItemsRecord(subsequentResultRecord)
? subsequentResultRecord.streamRecord
: subsequentResultRecord;
pendingSources.add(pendingSource);
}

return {
initialResult: {
...initialResult,
pending: this._pendingSourcesToResults(pendingSources),
hasNext: true,
},
subsequentResults: this._subscribe(),
@@ -347,6 +366,23 @@ export class IncrementalPublisher {
});
}

private _pendingSourcesToResults(
pendingSources: ReadonlySet<DeferredFragmentRecord | StreamRecord>,
): Array<PendingResult> {
const pendingResults: Array<PendingResult> = [];
for (const pendingSource of pendingSources) {
pendingSource.pendingSent = true;
const pendingResult: PendingResult = {
path: pendingSource.path,
};
if (pendingSource.label !== undefined) {
pendingResult.label = pendingSource.label;
}
pendingResults.push(pendingResult);
}
return pendingResults;
}

private _subscribe(): AsyncGenerator<
SubsequentIncrementalExecutionResult,
void,
@@ -461,14 +497,18 @@ export class IncrementalPublisher {
private _getIncrementalResult(
completedRecords: ReadonlySet<SubsequentResultRecord>,
): SubsequentIncrementalExecutionResult | undefined {
const { incremental, completed } = this._processPending(completedRecords);
const { pending, incremental, completed } =
this._processPending(completedRecords);

const hasNext = this._pending.size > 0;
if (incremental.length === 0 && completed.length === 0 && hasNext) {
return undefined;
}

const result: SubsequentIncrementalExecutionResult = { hasNext };
if (pending.length) {
result.pending = pending;
}
if (incremental.length) {
result.incremental = incremental;
}
@@ -482,17 +522,25 @@ export class IncrementalPublisher {
private _processPending(
completedRecords: ReadonlySet<SubsequentResultRecord>,
): IncrementalUpdate {
const newPendingSources = new Set<DeferredFragmentRecord | StreamRecord>();
const incrementalResults: Array<IncrementalResult> = [];
const completedResults: Array<CompletedResult> = [];
for (const subsequentResultRecord of completedRecords) {
for (const child of subsequentResultRecord.children) {
if (child.filtered) {
continue;
}
const pendingSource = isStreamItemsRecord(child)
? child.streamRecord
: child;
if (!pendingSource.pendingSent) {
newPendingSources.add(pendingSource);
}
this._publish(child);
}
if (isStreamItemsRecord(subsequentResultRecord)) {
if (subsequentResultRecord.isFinalRecord) {
newPendingSources.delete(subsequentResultRecord.streamRecord);
completedResults.push(
this._completedRecordToResult(subsequentResultRecord.streamRecord),
);
@@ -513,6 +561,7 @@ export class IncrementalPublisher {
}
incrementalResults.push(incrementalResult);
} else {
newPendingSources.delete(subsequentResultRecord);
completedResults.push(
this._completedRecordToResult(subsequentResultRecord),
);
@@ -537,6 +586,7 @@ export class IncrementalPublisher {
}

return {
pending: this._pendingSourcesToResults(newPendingSources),
incremental: incrementalResults,
completed: completedResults,
};
@@ -690,6 +740,7 @@ export class DeferredFragmentRecord {
deferredGroupedFieldSetRecords: Set<DeferredGroupedFieldSetRecord>;
errors: Array<GraphQLError>;
filtered: boolean;
pendingSent?: boolean;
_pending: Set<DeferredGroupedFieldSetRecord>;

constructor(opts: { path: Path | undefined; label: string | undefined }) {
@@ -709,6 +760,7 @@ export class StreamRecord {
path: ReadonlyArray<string | number>;
errors: Array<GraphQLError>;
earlyReturn?: (() => Promise<unknown>) | undefined;
pendingSent?: boolean;
constructor(opts: {
label: string | undefined;
path: Path;
82 changes: 82 additions & 0 deletions src/execution/__tests__/defer-test.ts
Original file line number Diff line number Diff line change
@@ -176,6 +176,7 @@ describe('Execute: defer directive', () => {
id: '1',
},
},
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
@@ -231,6 +232,7 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: { hero: { id: '1' } },
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
@@ -261,6 +263,7 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: {},
pending: [{ path: [], label: 'DeferQuery' }],
hasNext: true,
},
{
@@ -302,6 +305,7 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: {},
pending: [{ path: [], label: 'DeferQuery' }],
hasNext: true,
},
{
@@ -351,6 +355,10 @@ describe('Execute: defer directive', () => {
data: {
hero: {},
},
pending: [
{ path: ['hero'], label: 'DeferTop' },
{ path: ['hero'], label: 'DeferNested' },
],
hasNext: true,
},
{
@@ -396,6 +404,7 @@ describe('Execute: defer directive', () => {
name: 'Luke',
},
},
pending: [{ path: ['hero'], label: 'DeferTop' }],
hasNext: true,
},
{
@@ -424,6 +433,7 @@ describe('Execute: defer directive', () => {
name: 'Luke',
},
},
pending: [{ path: ['hero'], label: 'DeferTop' }],
hasNext: true,
},
{
@@ -449,6 +459,7 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: { hero: { id: '1' } },
pending: [{ path: ['hero'], label: 'InlineDeferred' }],
hasNext: true,
},
{
@@ -478,6 +489,7 @@ describe('Execute: defer directive', () => {
data: {
hero: {},
},
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
@@ -506,6 +518,10 @@ describe('Execute: defer directive', () => {
data: {
hero: {},
},
pending: [
{ path: ['hero'], label: 'DeferID' },
{ path: ['hero'], label: 'DeferName' },
],
hasNext: true,
},
{
@@ -551,6 +567,10 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: {},
pending: [
{ path: [], label: 'DeferID' },
{ path: [], label: 'DeferName' },
],
hasNext: true,
},
{
@@ -601,6 +621,10 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: {},
pending: [
{ path: [], label: 'DeferID' },
{ path: [], label: 'DeferName' },
],
hasNext: true,
},
{
@@ -648,6 +672,10 @@ describe('Execute: defer directive', () => {
data: {
hero: {},
},
pending: [
{ path: [], label: 'DeferName' },
{ path: ['hero'], label: 'DeferID' },
],
hasNext: true,
},
{
@@ -691,9 +719,11 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: {},
pending: [{ path: [], label: 'DeferName' }],
hasNext: true,
},
{
pending: [{ path: ['hero'], label: 'DeferID' }],
incremental: [
{
data: {
@@ -753,6 +783,20 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: { hero: { friends: [{}, {}, {}] } },
pending: [
{ path: ['hero', 'friends', 0] },
{ path: ['hero', 'friends', 0] },
{ path: ['hero', 'friends', 0] },
{ path: ['hero', 'friends', 0] },
{ path: ['hero', 'friends', 1] },
{ path: ['hero', 'friends', 1] },
{ path: ['hero', 'friends', 1] },
{ path: ['hero', 'friends', 1] },
{ path: ['hero', 'friends', 2] },
{ path: ['hero', 'friends', 2] },
{ path: ['hero', 'friends', 2] },
{ path: ['hero', 'friends', 2] },
],
hasNext: true,
},
{
@@ -831,6 +875,7 @@ describe('Execute: defer directive', () => {
},
},
},
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
@@ -872,9 +917,11 @@ describe('Execute: defer directive', () => {
data: {
hero: {},
},
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
pending: [{ path: ['hero', 'nestedObject', 'deeperObject'] }],
incremental: [
{
data: {
@@ -954,9 +1001,11 @@ describe('Execute: defer directive', () => {
},
},
},
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
pending: [{ path: ['hero', 'nestedObject'] }],
incremental: [
{
data: { bar: 'bar' },
@@ -967,6 +1016,7 @@ describe('Execute: defer directive', () => {
hasNext: true,
},
{
pending: [{ path: ['hero', 'nestedObject', 'deeperObject'] }],
incremental: [
{
data: { baz: 'baz' },
@@ -1025,9 +1075,14 @@ describe('Execute: defer directive', () => {
},
},
},
pending: [
{ path: ['hero'] },
{ path: ['hero', 'nestedObject', 'deeperObject'] },
],
hasNext: true,
},
{
pending: [{ path: ['hero', 'nestedObject', 'deeperObject'] }],
incremental: [
{
data: {
@@ -1106,6 +1161,7 @@ describe('Execute: defer directive', () => {
},
},
},
pending: [{ path: [] }, { path: ['a', 'b'] }],
hasNext: true,
},
{
@@ -1157,6 +1213,7 @@ describe('Execute: defer directive', () => {
data: {
a: {},
},
pending: [{ path: [] }, { path: ['a'] }],
hasNext: true,
},
{
@@ -1224,6 +1281,7 @@ describe('Execute: defer directive', () => {
data: {
a: {},
},
pending: [{ path: [] }, { path: ['a'] }],
hasNext: true,
},
{
@@ -1299,6 +1357,7 @@ describe('Execute: defer directive', () => {
data: {
a: {},
},
pending: [{ path: [] }, { path: ['a'] }],
hasNext: true,
},
{
@@ -1388,6 +1447,7 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: {},
pending: [{ path: [] }],
hasNext: true,
},
{
@@ -1436,6 +1496,7 @@ describe('Execute: defer directive', () => {
friends: [{ name: 'Han' }, { name: 'Leia' }, { name: 'C-3PO' }],
},
},
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
@@ -1471,6 +1532,7 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: { hero: { friends: [{ name: 'Han' }] } },
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
@@ -1507,6 +1569,7 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: { hero: { friends: [] } },
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
@@ -1539,6 +1602,7 @@ describe('Execute: defer directive', () => {
friends: [{ name: 'Han' }, { name: 'Leia' }, { name: 'C-3PO' }],
},
},
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
@@ -1586,6 +1650,7 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: { hero: { friends: [] } },
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
@@ -1619,6 +1684,7 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: { hero: { nestedObject: null } },
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
@@ -1651,6 +1717,7 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: { hero: { nestedObject: { name: 'foo' } } },
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
@@ -1683,6 +1750,7 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: { hero: { id: '1' } },
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
@@ -1725,6 +1793,7 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: { hero: { id: '1' } },
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
@@ -1803,6 +1872,7 @@ describe('Execute: defer directive', () => {
expectJSON(result).toDeepEqual([
{
data: { hero: { id: '1' } },
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
@@ -1855,9 +1925,15 @@ describe('Execute: defer directive', () => {
data: {
hero: { id: '1' },
},
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
pending: [
{ path: ['hero', 'friends', 0] },
{ path: ['hero', 'friends', 1] },
{ path: ['hero', 'friends', 2] },
],
incremental: [
{
data: { name: 'slow', friends: [{}, {}, {}] },
@@ -1906,9 +1982,15 @@ describe('Execute: defer directive', () => {
data: {
hero: { id: '1' },
},
pending: [{ path: ['hero'] }],
hasNext: true,
},
{
pending: [
{ path: ['hero', 'friends', 0] },
{ path: ['hero', 'friends', 1] },
{ path: ['hero', 'friends', 2] },
],
incremental: [
{
data: {
2 changes: 2 additions & 0 deletions src/execution/__tests__/mutations-test.ts
Original file line number Diff line number Diff line change
@@ -237,6 +237,7 @@ describe('Execute: Handles mutation execution ordering', () => {
first: {},
second: { theNumber: 2 },
},
pending: [{ path: ['first'], label: 'defer-label' }],
hasNext: true,
},
{
@@ -312,6 +313,7 @@ describe('Execute: Handles mutation execution ordering', () => {
data: {
second: { theNumber: 2 },
},
pending: [{ path: [], label: 'defer-label' }],
hasNext: true,
},
{
52 changes: 52 additions & 0 deletions src/execution/__tests__/stream-test.ts
Original file line number Diff line number Diff line change
@@ -142,6 +142,7 @@ describe('Execute: stream directive', () => {
data: {
scalarList: ['apple'],
},
pending: [{ path: ['scalarList'] }],
hasNext: true,
},
{
@@ -165,6 +166,7 @@ describe('Execute: stream directive', () => {
data: {
scalarList: [],
},
pending: [{ path: ['scalarList'] }],
hasNext: true,
},
{
@@ -217,6 +219,7 @@ describe('Execute: stream directive', () => {
data: {
scalarList: ['apple'],
},
pending: [{ path: ['scalarList'], label: 'scalar-stream' }],
hasNext: true,
},
{
@@ -261,6 +264,7 @@ describe('Execute: stream directive', () => {
expectJSON(result).toDeepEqual([
{
data: { scalarList: ['apple', 'banana'] },
pending: [{ path: ['scalarList'] }],
hasNext: true,
},
{
@@ -284,6 +288,7 @@ describe('Execute: stream directive', () => {
data: {
scalarListList: [['apple', 'apple', 'apple']],
},
pending: [{ path: ['scalarListList'] }],
hasNext: true,
},
{
@@ -333,6 +338,7 @@ describe('Execute: stream directive', () => {
},
],
},
pending: [{ path: ['friendList'] }],
hasNext: true,
},
{
@@ -369,6 +375,7 @@ describe('Execute: stream directive', () => {
data: {
friendList: [],
},
pending: [{ path: ['friendList'] }],
hasNext: true,
},
{
@@ -431,6 +438,7 @@ describe('Execute: stream directive', () => {
},
],
},
pending: [{ path: ['friendList'] }],
hasNext: true,
},
{
@@ -480,6 +488,7 @@ describe('Execute: stream directive', () => {
data: {
friendList: [{ name: 'Luke', id: '1' }, null],
},
pending: [{ path: ['friendList'] }],
hasNext: true,
},
{
@@ -517,6 +526,7 @@ describe('Execute: stream directive', () => {
data: {
friendList: [{ name: 'Luke', id: '1' }],
},
pending: [{ path: ['friendList'] }],
hasNext: true,
},
{
@@ -568,6 +578,7 @@ describe('Execute: stream directive', () => {
data: {
friendList: [],
},
pending: [{ path: ['friendList'] }],
hasNext: true,
},
{
@@ -627,6 +638,7 @@ describe('Execute: stream directive', () => {
{ name: 'Han', id: '2' },
],
},
pending: [{ path: ['friendList'] }],
hasNext: true,
},
{
@@ -696,6 +708,7 @@ describe('Execute: stream directive', () => {
{ name: 'Han', id: '2' },
],
},
pending: [{ path: ['friendList'] }],
hasNext: true,
},
},
@@ -769,6 +782,7 @@ describe('Execute: stream directive', () => {
data: {
friendList: [{ name: 'Luke', id: '1' }],
},
pending: [{ path: ['friendList'] }],
hasNext: true,
},
{
@@ -805,6 +819,7 @@ describe('Execute: stream directive', () => {
data: {
nonNullFriendList: [{ name: 'Luke' }],
},
pending: [{ path: ['nonNullFriendList'] }],
hasNext: true,
},
{
@@ -851,6 +866,7 @@ describe('Execute: stream directive', () => {
data: {
nonNullFriendList: [{ name: 'Luke' }],
},
pending: [{ path: ['nonNullFriendList'] }],
hasNext: true,
},
{
@@ -885,6 +901,7 @@ describe('Execute: stream directive', () => {
data: {
scalarList: ['Luke'],
},
pending: [{ path: ['scalarList'] }],
hasNext: true,
},
{
@@ -928,6 +945,7 @@ describe('Execute: stream directive', () => {
data: {
friendList: [{ nonNullName: 'Luke' }],
},
pending: [{ path: ['friendList'] }],
hasNext: true,
},
{
@@ -978,6 +996,7 @@ describe('Execute: stream directive', () => {
data: {
friendList: [{ nonNullName: 'Luke' }],
},
pending: [{ path: ['friendList'] }],
hasNext: true,
},
{
@@ -1030,6 +1049,7 @@ describe('Execute: stream directive', () => {
data: {
nonNullFriendList: [{ nonNullName: 'Luke' }],
},
pending: [{ path: ['nonNullFriendList'] }],
hasNext: true,
},
{
@@ -1069,6 +1089,7 @@ describe('Execute: stream directive', () => {
data: {
nonNullFriendList: [{ nonNullName: 'Luke' }],
},
pending: [{ path: ['nonNullFriendList'] }],
hasNext: true,
},
{
@@ -1110,6 +1131,7 @@ describe('Execute: stream directive', () => {
data: {
friendList: [{ nonNullName: 'Luke' }],
},
pending: [{ path: ['friendList'] }],
hasNext: true,
},
{
@@ -1167,6 +1189,7 @@ describe('Execute: stream directive', () => {
data: {
nonNullFriendList: [{ nonNullName: 'Luke' }],
},
pending: [{ path: ['nonNullFriendList'] }],
hasNext: true,
},
{
@@ -1234,6 +1257,7 @@ describe('Execute: stream directive', () => {
data: {
nonNullFriendList: [{ nonNullName: 'Luke' }],
},
pending: [{ path: ['nonNullFriendList'] }],
hasNext: true,
},
{
@@ -1311,6 +1335,7 @@ describe('Execute: stream directive', () => {
data: {
nonNullFriendList: [{ nonNullName: 'Luke' }],
},
pending: [{ path: ['nonNullFriendList'] }],
hasNext: true,
},
{
@@ -1426,6 +1451,10 @@ describe('Execute: stream directive', () => {
otherNestedObject: {},
nestedObject: { nestedFriendList: [] },
},
pending: [
{ path: ['otherNestedObject'] },
{ path: ['nestedObject', 'nestedFriendList'] },
],
hasNext: true,
},
{
@@ -1485,6 +1514,7 @@ describe('Execute: stream directive', () => {
data: {
nestedObject: {},
},
pending: [{ path: ['nestedObject'] }],
hasNext: true,
},
{
@@ -1537,6 +1567,7 @@ describe('Execute: stream directive', () => {
data: {
friendList: [],
},
pending: [{ path: ['friendList'] }],
hasNext: true,
},
{
@@ -1627,6 +1658,7 @@ describe('Execute: stream directive', () => {
data: {
nestedObject: {},
},
pending: [{ path: ['nestedObject'] }],
hasNext: true,
});

@@ -1688,6 +1720,7 @@ describe('Execute: stream directive', () => {
data: {
friendList: [{ id: '1', name: 'Luke' }],
},
pending: [{ path: ['friendList'] }],
hasNext: true,
},
{
@@ -1747,6 +1780,10 @@ describe('Execute: stream directive', () => {
nestedFriendList: [],
},
},
pending: [
{ path: ['nestedObject'] },
{ path: ['nestedObject', 'nestedFriendList'] },
],
hasNext: true,
},
{
@@ -1811,6 +1848,7 @@ describe('Execute: stream directive', () => {
data: {
nestedObject: {},
},
pending: [{ path: ['nestedObject'] }],
hasNext: true,
});

@@ -1819,6 +1857,7 @@ describe('Execute: stream directive', () => {
const result2 = await result2Promise;
expectJSON(result2).toDeepEqual({
value: {
pending: [{ path: ['nestedObject', 'nestedFriendList'] }],
incremental: [
{
data: { scalarField: 'slow', nestedFriendList: [] },
@@ -1912,6 +1951,10 @@ describe('Execute: stream directive', () => {
data: {
friendList: [{ id: '1' }],
},
pending: [
{ path: ['friendList', 0], label: 'DeferName' },
{ path: ['friendList'], label: 'stream-label' },
],
hasNext: true,
});

@@ -1920,6 +1963,7 @@ describe('Execute: stream directive', () => {
const result2 = await result2Promise;
expectJSON(result2).toDeepEqual({
value: {
pending: [{ path: ['friendList', 1], label: 'DeferName' }],
incremental: [
{
data: { name: 'Luke' },
@@ -2008,6 +2052,10 @@ describe('Execute: stream directive', () => {
data: {
friendList: [{ id: '1' }],
},
pending: [
{ path: ['friendList', 0], label: 'DeferName' },
{ path: ['friendList'], label: 'stream-label' },
],
hasNext: true,
});

@@ -2016,6 +2064,7 @@ describe('Execute: stream directive', () => {
const result2 = await result2Promise;
expectJSON(result2).toDeepEqual({
value: {
pending: [{ path: ['friendList', 1], label: 'DeferName' }],
incremental: [
{
data: { name: 'Luke' },
@@ -2111,6 +2160,7 @@ describe('Execute: stream directive', () => {
},
],
},
pending: [{ path: ['friendList', 0] }, { path: ['friendList'] }],
hasNext: true,
});
const returnPromise = iterator.return();
@@ -2166,6 +2216,7 @@ describe('Execute: stream directive', () => {
},
],
},
pending: [{ path: ['friendList'] }],
hasNext: true,
});

@@ -2225,6 +2276,7 @@ describe('Execute: stream directive', () => {
},
],
},
pending: [{ path: ['friendList', 0] }, { path: ['friendList'] }],
hasNext: true,
});