Skip to content

Commit 3d0b369

Browse files
committed
extract graph, types
1 parent 3a14f7e commit 3d0b369

File tree

13 files changed

+929
-791
lines changed

13 files changed

+929
-791
lines changed

src/execution/Graph.ts

Lines changed: 411 additions & 0 deletions
Large diffs are not rendered by default.

src/execution/IncrementalPublisher.ts

Lines changed: 142 additions & 703 deletions
Large diffs are not rendered by default.

src/execution/__tests__/defer-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { execute, experimentalExecuteIncrementally } from '../execute.js';
2020
import type {
2121
InitialIncrementalExecutionResult,
2222
SubsequentIncrementalExecutionResult,
23-
} from '../IncrementalPublisher.js';
23+
} from '../types.js';
2424

2525
const friendType = new GraphQLObjectType({
2626
fields: {

src/execution/__tests__/lists-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { GraphQLSchema } from '../../type/schema.js';
1919
import { buildSchema } from '../../utilities/buildASTSchema.js';
2020

2121
import { execute, executeSync } from '../execute.js';
22-
import type { ExecutionResult } from '../IncrementalPublisher.js';
22+
import type { ExecutionResult } from '../types.js';
2323

2424
describe('Execute: Accepts any iterable as list value', () => {
2525
function complete(rootValue: unknown) {

src/execution/__tests__/nonnull-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { GraphQLSchema } from '../../type/schema.js';
1414
import { buildSchema } from '../../utilities/buildASTSchema.js';
1515

1616
import { execute, executeSync } from '../execute.js';
17-
import type { ExecutionResult } from '../IncrementalPublisher.js';
17+
import type { ExecutionResult } from '../types.js';
1818

1919
const syncError = new Error('sync');
2020
const syncNonNullError = new Error('syncNonNull');

src/execution/__tests__/oneof-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { parse } from '../../language/parser.js';
77
import { buildSchema } from '../../utilities/buildASTSchema.js';
88

99
import { execute } from '../execute.js';
10-
import type { ExecutionResult } from '../IncrementalPublisher.js';
10+
import type { ExecutionResult } from '../types.js';
1111

1212
const schema = buildSchema(`
1313
type Query {

src/execution/__tests__/stream-test.ts

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { experimentalExecuteIncrementally } from '../execute.js';
2222
import type {
2323
InitialIncrementalExecutionResult,
2424
SubsequentIncrementalExecutionResult,
25-
} from '../IncrementalPublisher.js';
25+
} from '../types.js';
2626

2727
const friendType = new GraphQLObjectType({
2828
fields: {
@@ -635,7 +635,7 @@ describe('Execute: stream directive', () => {
635635
}
636636
}
637637
`);
638-
const result = await completeAsync(document, 2, {
638+
const result = await completeAsync(document, 3, {
639639
async *friendList() {
640640
yield await Promise.resolve(friends[0]);
641641
yield await Promise.resolve(friends[1]);
@@ -665,6 +665,12 @@ describe('Execute: stream directive', () => {
665665
id: '0',
666666
},
667667
],
668+
hasNext: true,
669+
},
670+
},
671+
{
672+
done: false,
673+
value: {
668674
completed: [{ id: '0' }],
669675
hasNext: false,
670676
},
@@ -1367,10 +1373,6 @@ describe('Execute: stream directive', () => {
13671373
},
13681374
{
13691375
incremental: [
1370-
{
1371-
items: [{ name: 'Luke' }],
1372-
id: '1',
1373-
},
13741376
{
13751377
data: { scalarField: null },
13761378
id: '0',
@@ -1382,8 +1384,12 @@ describe('Execute: stream directive', () => {
13821384
},
13831385
],
13841386
},
1387+
{
1388+
items: [{ name: 'Luke' }],
1389+
id: '1',
1390+
},
13851391
],
1386-
completed: [{ id: '1' }, { id: '0' }],
1392+
completed: [{ id: '0' }, { id: '1' }],
13871393
hasNext: false,
13881394
},
13891395
]);
@@ -1818,14 +1824,14 @@ describe('Execute: stream directive', () => {
18181824
value: {
18191825
pending: [{ id: '2', path: ['friendList', 1], label: 'DeferName' }],
18201826
incremental: [
1821-
{
1822-
items: [{ id: '2' }],
1823-
id: '1',
1824-
},
18251827
{
18261828
data: { name: 'Luke' },
18271829
id: '0',
18281830
},
1831+
{
1832+
items: [{ id: '2' }],
1833+
id: '1',
1834+
},
18291835
],
18301836
completed: [{ id: '0' }],
18311837
hasNext: true,
@@ -1921,14 +1927,14 @@ describe('Execute: stream directive', () => {
19211927
value: {
19221928
pending: [{ id: '2', path: ['friendList', 1], label: 'DeferName' }],
19231929
incremental: [
1924-
{
1925-
items: [{ id: '2' }],
1926-
id: '1',
1927-
},
19281930
{
19291931
data: { name: 'Luke' },
19301932
id: '0',
19311933
},
1934+
{
1935+
items: [{ id: '2' }],
1936+
id: '1',
1937+
},
19321938
],
19331939
completed: [{ id: '0' }],
19341940
hasNext: true,
@@ -1940,30 +1946,21 @@ describe('Execute: stream directive', () => {
19401946
resolveIterableCompletion(null);
19411947
const result3 = await result3Promise;
19421948
expectJSON(result3).toDeepEqual({
1943-
value: {
1944-
completed: [{ id: '1' }],
1945-
hasNext: true,
1946-
},
1947-
done: false,
1948-
});
1949-
1950-
const result4 = await iterator.next();
1951-
expectJSON(result4).toDeepEqual({
19521949
value: {
19531950
incremental: [
19541951
{
19551952
data: { name: 'Han' },
19561953
id: '2',
19571954
},
19581955
],
1959-
completed: [{ id: '2' }],
1956+
completed: [{ id: '1' }, { id: '2' }],
19601957
hasNext: false,
19611958
},
19621959
done: false,
19631960
});
19641961

1965-
const result5 = await iterator.next();
1966-
expectJSON(result5).toDeepEqual({
1962+
const result4 = await iterator.next();
1963+
expectJSON(result4).toDeepEqual({
19671964
value: undefined,
19681965
done: true,
19691966
});

src/execution/__tests__/subscribe-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { GraphQLSchema } from '../../type/schema.js';
2222

2323
import type { ExecutionArgs } from '../execute.js';
2424
import { createSourceEventStream, subscribe } from '../execute.js';
25-
import type { ExecutionResult } from '../IncrementalPublisher.js';
25+
import type { ExecutionResult } from '../types.js';
2626

2727
import { SimplePubSub } from './simplePubSub.js';
2828

0 commit comments

Comments
 (0)