relay-compiler 11.0.2 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/relay-compiler +92 -34
- package/codegen/NormalizationCodeGenerator.js.flow +1 -6
- package/codegen/createPrintRequireModuleDependency.js.flow +2 -4
- package/codegen/writeRelayGeneratedFile.js.flow +1 -1
- package/index.js +1 -1
- package/language/javascript/RelayFlowTypeTransformers.js.flow +3 -3
- package/lib/codegen/NormalizationCodeGenerator.js +2 -3
- package/lib/codegen/createPrintRequireModuleDependency.js +2 -2
- package/lib/codegen/writeRelayGeneratedFile.js +1 -1
- package/lib/transforms/ClientExtensionsTransform.js +1 -0
- package/lib/transforms/ConnectionTransform.js +6 -2
- package/lib/transforms/DeclarativeConnectionMutationTransform.js +5 -2
- package/lib/transforms/DeferStreamTransform.js +2 -1
- package/lib/transforms/DisallowIdAsAlias.js +2 -1
- package/lib/transforms/FieldHandleTransform.js +3 -1
- package/lib/transforms/FlattenTransform.js +3 -1
- package/lib/transforms/GenerateIDFieldTransform.js +3 -1
- package/lib/transforms/GenerateTypeNameTransform.js +9 -3
- package/lib/transforms/InlineDataFragmentTransform.js +6 -2
- package/lib/transforms/InlineFragmentsTransform.js +4 -2
- package/lib/transforms/MaskTransform.js +7 -3
- package/lib/transforms/MatchTransform.js +5 -1
- package/lib/transforms/ReactFlightComponentTransform.js +3 -0
- package/lib/transforms/RelayDirectiveTransform.js +3 -1
- package/lib/transforms/RequiredFieldTransform.js +6 -2
- package/lib/transforms/SkipClientExtensionsTransform.js +3 -0
- package/lib/transforms/SkipHandleFieldTransform.js +1 -0
- package/lib/transforms/SkipRedundantNodesTransform.js +2 -1
- package/lib/transforms/SplitModuleImportTransform.js +4 -1
- package/lib/transforms/TestOperationTransform.js +1 -0
- package/lib/transforms/ValidateRequiredArgumentsTransform.js +5 -1
- package/lib/transforms/ValidateServerOnlyDirectivesTransform.js +4 -1
- package/lib/util/areEqualArgValues.js +2 -1
- package/package.json +7 -7
- package/relay-compiler.js +3 -3
- package/relay-compiler.min.js +3 -3
- package/transforms/ClientExtensionsTransform.js.flow +1 -0
- package/transforms/ConnectionTransform.js.flow +4 -0
- package/transforms/DeclarativeConnectionMutationTransform.js.flow +3 -0
- package/transforms/DeferStreamTransform.js.flow +1 -0
- package/transforms/DisallowIdAsAlias.js.flow +1 -0
- package/transforms/FieldHandleTransform.js.flow +2 -0
- package/transforms/FlattenTransform.js.flow +2 -0
- package/transforms/GenerateIDFieldTransform.js.flow +2 -0
- package/transforms/GenerateTypeNameTransform.js.flow +6 -0
- package/transforms/InlineDataFragmentTransform.js.flow +4 -0
- package/transforms/InlineFragmentsTransform.js.flow +2 -0
- package/transforms/MaskTransform.js.flow +4 -0
- package/transforms/MatchTransform.js.flow +4 -0
- package/transforms/ReactFlightComponentTransform.js.flow +3 -0
- package/transforms/RelayDirectiveTransform.js.flow +2 -0
- package/transforms/RequiredFieldTransform.js.flow +4 -0
- package/transforms/SkipClientExtensionsTransform.js.flow +3 -0
- package/transforms/SkipHandleFieldTransform.js.flow +1 -0
- package/transforms/SkipRedundantNodesTransform.js.flow +1 -0
- package/transforms/SplitModuleImportTransform.js.flow +3 -0
- package/transforms/TestOperationTransform.js.flow +1 -0
- package/transforms/ValidateRequiredArgumentsTransform.js.flow +4 -0
- package/transforms/ValidateServerOnlyDirectivesTransform.js.flow +3 -0
- package/util/areEqualArgValues.js.flow +1 -0
@@ -31,6 +31,7 @@ function clientExtensionTransform(context: CompilerContext): CompilerContext {
|
|
31
31
|
}
|
32
32
|
|
33
33
|
function traverseDefinition<T: Definition>(node: T): T {
|
34
|
+
// $FlowFixMe[incompatible-use]
|
34
35
|
const compilerContext: CompilerContext = this.getContext();
|
35
36
|
|
36
37
|
const schema = compilerContext.getSchema();
|
@@ -123,6 +123,7 @@ function visitFragmentOrRoot<N: Fragment | Root>(
|
|
123
123
|
node: N,
|
124
124
|
options: Options,
|
125
125
|
): ?N {
|
126
|
+
// $FlowFixMe[incompatible-use]
|
126
127
|
const transformedNode = this.traverse(node, options);
|
127
128
|
const connectionMetadata = options.connectionMetadata;
|
128
129
|
if (connectionMetadata.length) {
|
@@ -141,6 +142,7 @@ function visitFragmentOrRoot<N: Fragment | Root>(
|
|
141
142
|
* @internal
|
142
143
|
*/
|
143
144
|
function visitLinkedField(field: LinkedField, options: Options): LinkedField {
|
145
|
+
// $FlowFixMe[incompatible-use]
|
144
146
|
const context: CompilerContext = this.getContext();
|
145
147
|
const schema = context.getSchema();
|
146
148
|
|
@@ -148,6 +150,7 @@ function visitLinkedField(field: LinkedField, options: Options): LinkedField {
|
|
148
150
|
|
149
151
|
const isPlural = schema.isList(nullableType);
|
150
152
|
const path = options.path.concat(isPlural ? null : field.alias || field.name);
|
153
|
+
// $FlowFixMe[incompatible-use]
|
151
154
|
let transformedField: LinkedField = this.traverse(field, {
|
152
155
|
...options,
|
153
156
|
path,
|
@@ -198,6 +201,7 @@ function visitLinkedField(field: LinkedField, options: Options): LinkedField {
|
|
198
201
|
const {direction} = connectionMetadata;
|
199
202
|
if (direction != null) {
|
200
203
|
const selections = transformConnectionSelections(
|
204
|
+
// $FlowFixMe[incompatible-use]
|
201
205
|
this.getContext(),
|
202
206
|
transformedField,
|
203
207
|
schema.assertCompositeType(nullableType),
|
@@ -94,6 +94,7 @@ function visitScalarField(field: ScalarField): ScalarField {
|
|
94
94
|
return field;
|
95
95
|
}
|
96
96
|
|
97
|
+
// $FlowFixMe[incompatible-use]
|
97
98
|
const schema = this.getContext().getSchema();
|
98
99
|
|
99
100
|
if (!schema.isId(schema.getRawType(field.type))) {
|
@@ -126,6 +127,7 @@ function visitScalarField(field: ScalarField): ScalarField {
|
|
126
127
|
}
|
127
128
|
|
128
129
|
function visitLinkedField(field: LinkedField): LinkedField {
|
130
|
+
// $FlowFixMe[incompatible-use]
|
129
131
|
const transformedField = this.traverse(field);
|
130
132
|
const deleteDirective = transformedField.directives.find(
|
131
133
|
directive => directive.name === DELETE_RECORD,
|
@@ -162,6 +164,7 @@ function visitLinkedField(field: LinkedField): LinkedField {
|
|
162
164
|
[targetDirective.loc],
|
163
165
|
);
|
164
166
|
}
|
167
|
+
// $FlowFixMe[incompatible-use]
|
165
168
|
const schema = this.getContext().getSchema();
|
166
169
|
if (edgeDirective) {
|
167
170
|
const fieldType = schema.getRawType(transformedField.type);
|
@@ -34,6 +34,7 @@ function fieldHandleTransform(context: CompilerContext): CompilerContext {
|
|
34
34
|
* @internal
|
35
35
|
*/
|
36
36
|
function visitField<F: LinkedField | ScalarField>(field: F): F {
|
37
|
+
// $FlowFixMe[incompatible-use]
|
37
38
|
const nextField = field.kind === 'LinkedField' ? this.traverse(field) : field;
|
38
39
|
const handles = nextField.handles;
|
39
40
|
if (!handles || !handles.length) {
|
@@ -46,6 +47,7 @@ function visitField<F: LinkedField | ScalarField>(field: F): F {
|
|
46
47
|
'"handle" property, got `%s`.',
|
47
48
|
handles.join(', '),
|
48
49
|
);
|
50
|
+
// $FlowFixMe[incompatible-use]
|
49
51
|
const context: CompilerContext = this.getContext();
|
50
52
|
const schema = context.getSchema();
|
51
53
|
const alias = nextField.alias;
|
@@ -74,6 +74,7 @@ function flattenTransformImpl(
|
|
74
74
|
|
75
75
|
function memoizedFlattenSelection(cache: Map<Node, Map<?TypeID, any>>) {
|
76
76
|
return function flattenSelectionsFn<T: Node>(node: T, state: State): T {
|
77
|
+
// $FlowFixMe[incompatible-use]
|
77
78
|
const context: CompilerContext = this.getContext();
|
78
79
|
let nodeCache = cache.get(node);
|
79
80
|
if (nodeCache == null) {
|
@@ -117,6 +118,7 @@ function memoizedFlattenSelection(cache: Map<Node, Map<?TypeID, any>>) {
|
|
117
118
|
? {...node, selections: Array.from(nextSelections.values())}
|
118
119
|
: node;
|
119
120
|
state.parentType = type;
|
121
|
+
// $FlowFixMe[incompatible-use]
|
120
122
|
const deeplyFlattenedNode = this.traverse(flattenedNode, state);
|
121
123
|
state.parentType = parentType;
|
122
124
|
nodeCache.set(parentType, deeplyFlattenedNode);
|
@@ -77,6 +77,7 @@ function generateIDFieldTransform(context: CompilerContext): CompilerContext {
|
|
77
77
|
}
|
78
78
|
|
79
79
|
function visitLinkedField(field: LinkedField, state: State): LinkedField {
|
80
|
+
// $FlowFixMe[incompatible-use]
|
80
81
|
const transformedNode = this.traverse(field, state);
|
81
82
|
|
82
83
|
// If the field already has an unaliased `id` field, do nothing
|
@@ -84,6 +85,7 @@ function visitLinkedField(field: LinkedField, state: State): LinkedField {
|
|
84
85
|
return transformedNode;
|
85
86
|
}
|
86
87
|
|
88
|
+
// $FlowFixMe[incompatible-use]
|
87
89
|
const context: CompilerContext = this.getContext();
|
88
90
|
const schema = context.getSchema();
|
89
91
|
const unmodifiedType = schema.assertCompositeType(
|
@@ -69,8 +69,10 @@ function generateTypeNameTransform(context: CompilerContext): CompilerContext {
|
|
69
69
|
}
|
70
70
|
|
71
71
|
function visitFragment(fragment: Fragment, state: State): Fragment {
|
72
|
+
// $FlowFixMe[incompatible-use]
|
72
73
|
const schema: Schema = this.getContext().getSchema();
|
73
74
|
const rawType = schema.getRawType(fragment.type);
|
75
|
+
// $FlowFixMe[incompatible-use]
|
74
76
|
let transformedNode = (this.traverse(fragment, state): Fragment);
|
75
77
|
const isClientType = !schema.isServerType(rawType);
|
76
78
|
if (!isClientType && schema.isAbstractType(rawType)) {
|
@@ -102,12 +104,14 @@ function visitInlineFragment(
|
|
102
104
|
fragment: InlineFragment,
|
103
105
|
state: State,
|
104
106
|
): InlineFragment {
|
107
|
+
// $FlowFixMe[incompatible-use]
|
105
108
|
const schema: Schema = this.getContext().getSchema();
|
106
109
|
let transformedNode = cache.get(fragment);
|
107
110
|
if (transformedNode != null && transformedNode.kind === 'InlineFragment') {
|
108
111
|
return transformedNode;
|
109
112
|
}
|
110
113
|
const rawType = schema.getRawType(fragment.typeCondition);
|
114
|
+
// $FlowFixMe[incompatible-use]
|
111
115
|
transformedNode = (this.traverse(fragment, state): InlineFragment);
|
112
116
|
const isClientType = !schema.isServerType(rawType);
|
113
117
|
if (!isClientType && schema.isAbstractType(rawType)) {
|
@@ -137,11 +141,13 @@ function visitInlineFragment(
|
|
137
141
|
}
|
138
142
|
|
139
143
|
function visitLinkedField(field: LinkedField, state: State): LinkedField {
|
144
|
+
// $FlowFixMe[incompatible-use]
|
140
145
|
const schema: Schema = this.getContext().getSchema();
|
141
146
|
let transformedNode = cache.get(field);
|
142
147
|
if (transformedNode != null && transformedNode.kind === 'LinkedField') {
|
143
148
|
return transformedNode;
|
144
149
|
}
|
150
|
+
// $FlowFixMe[incompatible-use]
|
145
151
|
transformedNode = (this.traverse(field, state): LinkedField);
|
146
152
|
if (
|
147
153
|
schema.isAbstractType(schema.getRawType(transformedNode.type)) &&
|
@@ -44,6 +44,7 @@ function inlineDataFragmentTransform(
|
|
44
44
|
}
|
45
45
|
|
46
46
|
function visitFragment(fragment: Fragment): Fragment {
|
47
|
+
// $FlowFixMe[incompatible-use]
|
47
48
|
const transformedFragment = this.traverse(fragment);
|
48
49
|
|
49
50
|
const inlineDirective = transformedFragment.directives.find(
|
@@ -67,10 +68,12 @@ function visitFragment(fragment: Fragment): Fragment {
|
|
67
68
|
function visitFragmentSpread(
|
68
69
|
fragmentSpread: FragmentSpread,
|
69
70
|
): FragmentSpread | InlineDataFragmentSpread {
|
71
|
+
// $FlowFixMe[incompatible-use]
|
70
72
|
const transformedFragmentSpread: FragmentSpread = this.traverse(
|
71
73
|
fragmentSpread,
|
72
74
|
);
|
73
75
|
|
76
|
+
// $FlowFixMe[incompatible-use]
|
74
77
|
const context: CompilerContext = this.getContext();
|
75
78
|
const fragment = context.get(transformedFragmentSpread.name);
|
76
79
|
if (
|
@@ -99,6 +102,7 @@ function visitFragmentSpread(
|
|
99
102
|
);
|
100
103
|
}
|
101
104
|
|
105
|
+
// $FlowFixMe[incompatible-use]
|
102
106
|
const transformedFragment = (this.visit(fragment): Fragment);
|
103
107
|
|
104
108
|
return ({
|
@@ -48,6 +48,7 @@ function fragmentSpreadVisitor(cache: FragmentVisitorCache): FragmentVisitor {
|
|
48
48
|
'arguments. Use the `ApplyFragmentArgumentTransform` before flattening',
|
49
49
|
fragmentSpread.name,
|
50
50
|
);
|
51
|
+
// $FlowFixMe[incompatible-use]
|
51
52
|
const fragment: Fragment = this.getContext().getFragment(
|
52
53
|
fragmentSpread.name,
|
53
54
|
fragmentSpread.loc,
|
@@ -60,6 +61,7 @@ function fragmentSpreadVisitor(cache: FragmentVisitorCache): FragmentVisitor {
|
|
60
61
|
selections: fragment.selections,
|
61
62
|
typeCondition: fragment.type,
|
62
63
|
};
|
64
|
+
// $FlowFixMe[incompatible-use]
|
63
65
|
traverseResult = this.traverse(result);
|
64
66
|
cache.set(fragmentSpread, traverseResult);
|
65
67
|
return traverseResult;
|
@@ -47,11 +47,13 @@ function maskTransform(context: CompilerContext): CompilerContext {
|
|
47
47
|
}
|
48
48
|
|
49
49
|
function visitFragment(fragment: Fragment, state: State): Fragment {
|
50
|
+
// $FlowFixMe[incompatible-use]
|
50
51
|
const result = this.traverse(fragment, state);
|
51
52
|
if (state.reachableArguments.length === 0) {
|
52
53
|
return result;
|
53
54
|
}
|
54
55
|
const joinedArgumentDefinitions = joinArgumentDefinitions(
|
56
|
+
// $FlowFixMe[incompatible-use]
|
55
57
|
this.getContext().getSchema(),
|
56
58
|
fragment,
|
57
59
|
state.reachableArguments,
|
@@ -76,6 +78,7 @@ function visitFragmentSpread(
|
|
76
78
|
'arguments. Use the `ApplyFragmentArgumentTransform` before flattening',
|
77
79
|
fragmentSpread.name,
|
78
80
|
);
|
81
|
+
// $FlowFixMe[incompatible-use]
|
79
82
|
const context = this.getContext();
|
80
83
|
const fragment: Fragment = context.getFragment(fragmentSpread.name);
|
81
84
|
const result: InlineFragment = {
|
@@ -111,6 +114,7 @@ function visitFragmentSpread(
|
|
111
114
|
for (const argDef of fragment.argumentDefinitions) {
|
112
115
|
state.reachableArguments.push(argDef);
|
113
116
|
}
|
117
|
+
// $FlowFixMe[incompatible-use]
|
114
118
|
return this.traverse(result, state);
|
115
119
|
}
|
116
120
|
|
@@ -91,6 +91,7 @@ function visitInlineFragment(
|
|
91
91
|
node: InlineFragment,
|
92
92
|
state: State,
|
93
93
|
): InlineFragment {
|
94
|
+
// $FlowFixMe[incompatible-use]
|
94
95
|
return this.traverse(node, {
|
95
96
|
...state,
|
96
97
|
parentType: node.typeCondition,
|
@@ -98,6 +99,7 @@ function visitInlineFragment(
|
|
98
99
|
}
|
99
100
|
|
100
101
|
function visitScalarField(field: ScalarField): ScalarField {
|
102
|
+
// $FlowFixMe[incompatible-use]
|
101
103
|
const context: CompilerContext = this.getContext();
|
102
104
|
const schema = context.getSchema();
|
103
105
|
|
@@ -125,6 +127,7 @@ function visitScalarField(field: ScalarField): ScalarField {
|
|
125
127
|
}
|
126
128
|
|
127
129
|
function visitLinkedField(node: LinkedField, state: State): LinkedField {
|
130
|
+
// $FlowFixMe[incompatible-use]
|
128
131
|
const context: CompilerContext = this.getContext();
|
129
132
|
const schema = context.getSchema();
|
130
133
|
|
@@ -153,6 +156,7 @@ function visitLinkedField(node: LinkedField, state: State): LinkedField {
|
|
153
156
|
}
|
154
157
|
|
155
158
|
state.path.push(node);
|
159
|
+
// $FlowFixMe[incompatible-use]
|
156
160
|
const transformedNode: LinkedField = this.traverse(node, {
|
157
161
|
...state,
|
158
162
|
moduleKey,
|
@@ -70,6 +70,7 @@ function reactFlightComponentTransform(
|
|
70
70
|
}
|
71
71
|
|
72
72
|
function visitInlineFragment(fragment, state) {
|
73
|
+
// $FlowFixMe[incompatible-use]
|
73
74
|
return this.traverse(fragment, {
|
74
75
|
parentType: fragment.typeCondition ?? state.parentType,
|
75
76
|
types: state.types,
|
@@ -77,11 +78,13 @@ function visitInlineFragment(fragment, state) {
|
|
77
78
|
}
|
78
79
|
|
79
80
|
function visitLinkedField(field, state) {
|
81
|
+
// $FlowFixMe[incompatible-use]
|
80
82
|
return this.traverse(field, {parentType: field.type, types: state.types});
|
81
83
|
}
|
82
84
|
|
83
85
|
function visitScalarField(field: ScalarField, state: State): ScalarField {
|
84
86
|
// use the return type to quickly determine if this is a flight field
|
87
|
+
// $FlowFixMe[incompatible-use]
|
85
88
|
const schema = this.getContext().getSchema();
|
86
89
|
if (schema.getRawType(field.type) !== state.types.componentType) {
|
87
90
|
return field;
|
@@ -49,10 +49,12 @@ function visitRelayMetadata<T: Fragment | FragmentSpread>(
|
|
49
49
|
return function(node) {
|
50
50
|
const relayDirective = node.directives.find(({name}) => name === RELAY);
|
51
51
|
if (!relayDirective) {
|
52
|
+
// $FlowFixMe[incompatible-use]
|
52
53
|
return this.traverse(node);
|
53
54
|
}
|
54
55
|
const argValues = getLiteralArgumentValues(relayDirective.args);
|
55
56
|
const metadata = metadataFn(argValues);
|
57
|
+
// $FlowFixMe[incompatible-use]
|
56
58
|
return this.traverse({
|
57
59
|
...node,
|
58
60
|
directives: node.directives.filter(
|
@@ -95,10 +95,12 @@ function requiredFieldTransform(context: CompilerContext): CompilerContext {
|
|
95
95
|
}
|
96
96
|
|
97
97
|
function visitFragment(fragment: Fragment, state: State) {
|
98
|
+
// $FlowFixMe[incompatible-use]
|
98
99
|
return addChildrenCanBubbleMetadata(this.traverse(fragment, state), state);
|
99
100
|
}
|
100
101
|
|
101
102
|
function visitRoot(root: Root, state: State) {
|
103
|
+
// $FlowFixMe[incompatible-use]
|
102
104
|
return addChildrenCanBubbleMetadata(this.traverse(root, state), state);
|
103
105
|
}
|
104
106
|
|
@@ -110,6 +112,7 @@ function visitInlineFragment(fragment: InlineFragment, state: State) {
|
|
110
112
|
state.parentAbstractInlineFragment ??
|
111
113
|
getAbstractInlineFragment(fragment, state.schema);
|
112
114
|
|
115
|
+
// $FlowFixMe[incompatible-use]
|
113
116
|
return this.traverse(fragment, {...state, parentAbstractInlineFragment});
|
114
117
|
}
|
115
118
|
|
@@ -148,6 +151,7 @@ function visitLinkedField(field: LinkedField, state: State): LinkedField {
|
|
148
151
|
parentAbstractInlineFragment: null,
|
149
152
|
};
|
150
153
|
|
154
|
+
// $FlowFixMe[incompatible-use]
|
151
155
|
let newField = this.traverse(field, newState);
|
152
156
|
|
153
157
|
const pathName = path.join('.');
|
@@ -28,14 +28,17 @@ function skipClientExtensionTransform(
|
|
28
28
|
}
|
29
29
|
|
30
30
|
function visitFragment(node: Fragment): ?Fragment {
|
31
|
+
// $FlowFixMe[incompatible-use]
|
31
32
|
const context: CompilerContext = this.getContext();
|
32
33
|
if (context.getSchema().isServerType(node.type)) {
|
34
|
+
// $FlowFixMe[incompatible-use]
|
33
35
|
return this.traverse(node);
|
34
36
|
}
|
35
37
|
return null;
|
36
38
|
}
|
37
39
|
|
38
40
|
function vistFragmentSpread(node: FragmentSpread): ?FragmentSpread {
|
41
|
+
// $FlowFixMe[incompatible-use]
|
39
42
|
const context: CompilerContext = this.getContext();
|
40
43
|
const fragment = context.getFragment(node.name, node.loc);
|
41
44
|
const isServer = context.getSchema().isServerType(fragment.type);
|
@@ -29,6 +29,7 @@ function skipHandleFieldTransform(context: CompilerContext): CompilerContext {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
function visitField<F: Field>(field: F): ?F {
|
32
|
+
// $FlowFixMe[incompatible-use]
|
32
33
|
const transformedNode = this.traverse(field);
|
33
34
|
if (transformedNode.handles) {
|
34
35
|
return {
|
@@ -137,6 +137,7 @@ function skipRedundantNodesTransform(
|
|
137
137
|
let cache = new Map();
|
138
138
|
function visitNode<T: Fragment | Root | SplitOperation>(node: T): ?T {
|
139
139
|
cache = new Map();
|
140
|
+
// $FlowFixMe[incompatible-use]
|
140
141
|
const context: CompilerContext = this.getContext();
|
141
142
|
return transformNode(context.getSchema(), node, new IMap()).node;
|
142
143
|
}
|
@@ -51,6 +51,7 @@ function splitMatchTransform(context: CompilerContext): CompilerContext {
|
|
51
51
|
}
|
52
52
|
|
53
53
|
function visitLinkedField(field: LinkedField, state: State): LinkedField {
|
54
|
+
// $FlowFixMe[incompatible-use]
|
54
55
|
return this.traverse(field, {
|
55
56
|
parentType: field.type,
|
56
57
|
splitOperations: state.splitOperations,
|
@@ -61,6 +62,7 @@ function visitInlineFragment(
|
|
61
62
|
fragment: InlineFragment,
|
62
63
|
state: State,
|
63
64
|
): InlineFragment {
|
65
|
+
// $FlowFixMe[incompatible-use]
|
64
66
|
return this.traverse(fragment, {
|
65
67
|
parentType: fragment.typeCondition,
|
66
68
|
splitOperations: state.splitOperations,
|
@@ -77,6 +79,7 @@ function visitModuleImport(node: ModuleImport, state: State): ModuleImport {
|
|
77
79
|
createdSplitOperation.parentSources.add(node.sourceDocument);
|
78
80
|
return node;
|
79
81
|
}
|
82
|
+
// $FlowFixMe[incompatible-use]
|
80
83
|
const transformedNode = this.traverse(node, state);
|
81
84
|
const splitOperation: SplitOperation = {
|
82
85
|
kind: 'SplitOperation',
|
@@ -57,6 +57,7 @@ function getTypeDetails(schema: Schema, fieldType: TypeID): TypeDetails {
|
|
57
57
|
}
|
58
58
|
|
59
59
|
function visitRoot(node: Root) {
|
60
|
+
// $FlowFixMe[incompatible-use]
|
60
61
|
const schema: Schema = this.getContext().getSchema();
|
61
62
|
const testDirective = node.directives.find(
|
62
63
|
directive => directive.name === 'relay_test_operation',
|
@@ -51,6 +51,7 @@ function validateRequiredArguments(context: CompilerContext): CompilerContext {
|
|
51
51
|
}
|
52
52
|
|
53
53
|
function visitDirective(node: Directive, {rootNode}: State): void {
|
54
|
+
// $FlowFixMe[incompatible-use]
|
54
55
|
const context: CompilerContext = this.getContext();
|
55
56
|
const directiveDef = context.getSchema().getDirective(node.name);
|
56
57
|
if (directiveDef == null) {
|
@@ -65,6 +66,7 @@ function visitDirective(node: Directive, {rootNode}: State): void {
|
|
65
66
|
}
|
66
67
|
|
67
68
|
function visitInlineFragment(fragment, {rootNode}: State): void {
|
69
|
+
// $FlowFixMe[incompatible-use]
|
68
70
|
this.traverse(fragment, {
|
69
71
|
rootNode,
|
70
72
|
parentType: fragment.typeCondition,
|
@@ -72,6 +74,7 @@ function visitInlineFragment(fragment, {rootNode}: State): void {
|
|
72
74
|
}
|
73
75
|
|
74
76
|
function visitField(node: Field, {parentType, rootNode}: State): void {
|
77
|
+
// $FlowFixMe[incompatible-use]
|
75
78
|
const context: CompilerContext = this.getContext();
|
76
79
|
const schema = context.getSchema();
|
77
80
|
const definition = getFieldDefinitionStrict(schema, parentType, node.name);
|
@@ -94,6 +97,7 @@ function visitField(node: Field, {parentType, rootNode}: State): void {
|
|
94
97
|
rootNode,
|
95
98
|
);
|
96
99
|
}
|
100
|
+
// $FlowFixMe[incompatible-use]
|
97
101
|
this.traverse(node, {
|
98
102
|
rootNode,
|
99
103
|
parentType: node.type,
|
@@ -61,12 +61,14 @@ function stopVisit() {}
|
|
61
61
|
// Only visits selections as an optimization to not look at arguments
|
62
62
|
function visitLinkedField(node: LinkedField, state: State): void {
|
63
63
|
for (const selection of node.selections) {
|
64
|
+
// $FlowFixMe[incompatible-use]
|
64
65
|
this.visit(selection, state);
|
65
66
|
}
|
66
67
|
}
|
67
68
|
|
68
69
|
function visitClientExtension(node: ClientExtension, state: State): void {
|
69
70
|
for (const selection of node.selections) {
|
71
|
+
// $FlowFixMe[incompatible-use]
|
70
72
|
this.visit(selection, {
|
71
73
|
rootClientSelection: selection,
|
72
74
|
});
|
@@ -92,6 +94,7 @@ function visitTransformedDirective(node: Defer | Stream, state: State): void {
|
|
92
94
|
: null,
|
93
95
|
);
|
94
96
|
}
|
97
|
+
// $FlowFixMe[incompatible-use]
|
95
98
|
this.traverse(node, state);
|
96
99
|
}
|
97
100
|
|
@@ -47,6 +47,7 @@ function eq(a: any, b: any, aStack: Array<any>, bStack: Array<any>): boolean {
|
|
47
47
|
if (typeof a !== 'object' || typeof b !== 'object') {
|
48
48
|
return false;
|
49
49
|
}
|
50
|
+
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
|
50
51
|
const objToStr = Object.prototype.toString;
|
51
52
|
const className = objToStr.call(a);
|
52
53
|
if (className !== objToStr.call(b)) {
|