react-relay 2.0.0-rc.2 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. package/index.js +2 -2
  2. package/lib/ReactRelayContext.js +6 -3
  3. package/lib/ReactRelayFragmentContainer.js +48 -46
  4. package/lib/ReactRelayFragmentMockRenderer.js +5 -1
  5. package/lib/ReactRelayPaginationContainer.js +102 -68
  6. package/lib/ReactRelayQueryFetcher.js +54 -28
  7. package/lib/ReactRelayQueryRenderer.js +28 -20
  8. package/lib/ReactRelayRefetchContainer.js +70 -58
  9. package/lib/ReactRelayTestMocker.js +56 -43
  10. package/lib/ReactRelayTypes.js +1 -1
  11. package/lib/RelayContext.js +8 -2
  12. package/lib/assertFragmentMap.js +9 -7
  13. package/lib/buildReactRelayContainer.js +32 -23
  14. package/lib/index.js +41 -0
  15. package/lib/isRelayEnvironment.js +1 -1
  16. package/lib/isRelayVariables.js +1 -1
  17. package/lib/readContext.js +7 -4
  18. package/package.json +4 -4
  19. package/react-relay.js +2 -2
  20. package/react-relay.min.js +2 -2
  21. package/classic.js +0 -10
  22. package/compat.js +0 -10
  23. package/lib/ConcreteQuery.js +0 -10
  24. package/lib/GraphQLQueryRunner.js +0 -264
  25. package/lib/GraphQLRange.js +0 -1124
  26. package/lib/GraphQLSegment.js +0 -743
  27. package/lib/GraphQLStoreChangeEmitter.js +0 -141
  28. package/lib/GraphQLStoreQueryResolver.js +0 -288
  29. package/lib/GraphQLStoreRangeUtils.js +0 -126
  30. package/lib/QueryBuilder.js +0 -228
  31. package/lib/ReactRelayClassicExports.js +0 -29
  32. package/lib/ReactRelayCompatContainerBuilder.js +0 -175
  33. package/lib/ReactRelayCompatPublic.js +0 -28
  34. package/lib/ReactRelayContainerProfiler.js +0 -30
  35. package/lib/ReactRelayFragmentContainer-flowtest.js +0 -201
  36. package/lib/ReactRelayPaginationContainer-flowtest.js +0 -213
  37. package/lib/ReactRelayPublic.js +0 -29
  38. package/lib/ReactRelayRefetchContainer-flowtest.js +0 -191
  39. package/lib/RelayCacheProcessor.js +0 -196
  40. package/lib/RelayChangeTracker.js +0 -83
  41. package/lib/RelayClassicContainerUtils.js +0 -49
  42. package/lib/RelayClassicCore.js +0 -34
  43. package/lib/RelayClassicRecordState.js +0 -31
  44. package/lib/RelayCompatContainer.js +0 -25
  45. package/lib/RelayCompatEnvironment.js +0 -27
  46. package/lib/RelayCompatMutations.js +0 -133
  47. package/lib/RelayCompatPaginationContainer.js +0 -27
  48. package/lib/RelayCompatRefetchContainer.js +0 -27
  49. package/lib/RelayCompatTypes.js +0 -10
  50. package/lib/RelayContainer.js +0 -889
  51. package/lib/RelayContainerComparators.js +0 -75
  52. package/lib/RelayContainerProxy.js +0 -21
  53. package/lib/RelayDefaultNetworkLayer.js +0 -192
  54. package/lib/RelayEnvironment.js +0 -449
  55. package/lib/RelayEnvironmentTypes.js +0 -10
  56. package/lib/RelayFetchMode.js +0 -17
  57. package/lib/RelayFragmentPointer.js +0 -161
  58. package/lib/RelayFragmentReference.js +0 -249
  59. package/lib/RelayFragmentSpecResolver.js +0 -305
  60. package/lib/RelayGraphQLMutation.js +0 -288
  61. package/lib/RelayGraphQLTag.js +0 -42
  62. package/lib/RelayInternalTypes.js +0 -15
  63. package/lib/RelayInternals.js +0 -24
  64. package/lib/RelayMetaRoute.js +0 -35
  65. package/lib/RelayMockRenderer.js +0 -71
  66. package/lib/RelayModern-flowtest.js +0 -342
  67. package/lib/RelayModernFlowtest_badref.graphql.js +0 -10
  68. package/lib/RelayModernFlowtest_notref.graphql.js +0 -10
  69. package/lib/RelayModernFlowtest_user.graphql.js +0 -10
  70. package/lib/RelayModernFlowtest_users.graphql.js +0 -10
  71. package/lib/RelayMutation.js +0 -322
  72. package/lib/RelayMutationDebugPrinter.js +0 -47
  73. package/lib/RelayMutationQuery.js +0 -558
  74. package/lib/RelayMutationQueue.js +0 -530
  75. package/lib/RelayMutationRequest.js +0 -103
  76. package/lib/RelayMutationTracker.js +0 -113
  77. package/lib/RelayMutationTransaction.js +0 -92
  78. package/lib/RelayMutationTransactionStatus.js +0 -55
  79. package/lib/RelayNetworkDebug.js +0 -131
  80. package/lib/RelayNetworkLayer.js +0 -185
  81. package/lib/RelayNodeInterface.js +0 -104
  82. package/lib/RelayOperationDescriptor.js +0 -40
  83. package/lib/RelayOptimisticMutationUtils.js +0 -208
  84. package/lib/RelayPendingQueryTracker.js +0 -166
  85. package/lib/RelayPropTypes.js +0 -57
  86. package/lib/RelayPublic.js +0 -44
  87. package/lib/RelayQL.js +0 -128
  88. package/lib/RelayQuery.js +0 -1584
  89. package/lib/RelayQueryCaching.js +0 -33
  90. package/lib/RelayQueryConfig.js +0 -58
  91. package/lib/RelayQueryPath.js +0 -204
  92. package/lib/RelayQueryRequest.js +0 -103
  93. package/lib/RelayQueryTracker.js +0 -86
  94. package/lib/RelayQueryTransform.js +0 -91
  95. package/lib/RelayQueryVisitor.js +0 -93
  96. package/lib/RelayQueryWriter.js +0 -573
  97. package/lib/RelayReadyState.js +0 -83
  98. package/lib/RelayReadyStateRenderer.js +0 -145
  99. package/lib/RelayRecord.js +0 -75
  100. package/lib/RelayRecordStatusMap.js +0 -57
  101. package/lib/RelayRecordStore.js +0 -433
  102. package/lib/RelayRecordWriter.js +0 -601
  103. package/lib/RelayRefQueryDescriptor.js +0 -27
  104. package/lib/RelayRenderer.js +0 -268
  105. package/lib/RelayRootContainer.js +0 -125
  106. package/lib/RelayRoute.js +0 -92
  107. package/lib/RelayRouteFragment.js +0 -44
  108. package/lib/RelaySelector.js +0 -201
  109. package/lib/RelayShallowMock.js +0 -69
  110. package/lib/RelayStaticContainer.js +0 -38
  111. package/lib/RelayStore.js +0 -12
  112. package/lib/RelayStoreConstants.js +0 -20
  113. package/lib/RelayStoreData.js +0 -660
  114. package/lib/RelayTaskQueue.js +0 -189
  115. package/lib/RelayTypes.js +0 -13
  116. package/lib/RelayVariable.js +0 -32
  117. package/lib/RelayVariables.js +0 -92
  118. package/lib/buildRQL.js +0 -160
  119. package/lib/callsFromGraphQL.js +0 -74
  120. package/lib/callsToGraphQL.js +0 -34
  121. package/lib/checkRelayQueryData.js +0 -250
  122. package/lib/createRelayQuery.js +0 -17
  123. package/lib/dedent.js +0 -49
  124. package/lib/diffRelayQuery.js +0 -757
  125. package/lib/directivesToGraphQL.js +0 -39
  126. package/lib/filterRelayQuery.js +0 -29
  127. package/lib/findRelayQueryLeaves.js +0 -293
  128. package/lib/flattenRelayQuery.js +0 -121
  129. package/lib/flattenSplitRelayQueries.js +0 -44
  130. package/lib/forEachRootCallArg.js +0 -40
  131. package/lib/fromGraphQL.js +0 -48
  132. package/lib/generateClientEdgeID.js +0 -22
  133. package/lib/generateClientID.js +0 -27
  134. package/lib/generateConcreteFragmentID.js +0 -30
  135. package/lib/generateForceIndex.js +0 -24
  136. package/lib/generateRQLFieldAlias.js +0 -39
  137. package/lib/getRangeBehavior.js +0 -58
  138. package/lib/getRelayQueries.js +0 -83
  139. package/lib/intersectRelayQuery.js +0 -149
  140. package/lib/isClassicRelayContext.js +0 -20
  141. package/lib/isClassicRelayEnvironment.js +0 -20
  142. package/lib/isCompatibleRelayFragmentType.js +0 -27
  143. package/lib/isRelayContainer.js +0 -16
  144. package/lib/makeLegacyStringishComponentRef.js +0 -52
  145. package/lib/printRelayOSSQuery.js +0 -329
  146. package/lib/printRelayQuery.js +0 -26
  147. package/lib/rangeOperationToMetadataKey.js +0 -25
  148. package/lib/readRelayQueryData.js +0 -551
  149. package/lib/relayUnstableBatchedUpdates.js +0 -12
  150. package/lib/relayUnstableBatchedUpdates.native.js +0 -11
  151. package/lib/restoreRelayCacheData.js +0 -188
  152. package/lib/serializeRelayQueryCall.js +0 -42
  153. package/lib/splitDeferredRelayQueries.js +0 -298
  154. package/lib/stableStringify.js +0 -85
  155. package/lib/testEditDistance.js +0 -112
  156. package/lib/throwFailedPromise.js +0 -26
  157. package/lib/toGraphQL.js +0 -94
  158. package/lib/transformRelayQueryPayload.js +0 -145
  159. package/lib/validateMutationConfig.js +0 -117
  160. package/lib/validateRelayReadQuery.js +0 -112
  161. package/lib/writeRelayQueryPayload.js +0 -44
  162. package/lib/writeRelayUpdatePayload.js +0 -513
  163. package/react-relay-classic.js +0 -4
  164. package/react-relay-classic.min.js +0 -9
  165. package/react-relay-compat.js +0 -4
  166. package/react-relay-compat.min.js +0 -9
@@ -1,342 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- *
8
- * @format
9
- */
10
- 'use strict';
11
-
12
- var _taggedTemplateLiteral2 = require("@babel/runtime/helpers/interopRequireDefault")(require("./taggedTemplateLiteral"));
13
-
14
- var _inheritsLoose2 = require("@babel/runtime/helpers/interopRequireDefault")(require("@babel/runtime/helpers/inheritsLoose"));
15
-
16
- function _templateObject4() {
17
- var data = (0, _taggedTemplateLiteral2["default"])(["\n fragment RelayModernFlowtest_users on User @relay(plural: true) {\n name\n }\n "]);
18
-
19
- _templateObject4 = function _templateObject4() {
20
- return data;
21
- };
22
-
23
- return data;
24
- }
25
-
26
- function _templateObject3() {
27
- var data = (0, _taggedTemplateLiteral2["default"])(["\n fragment RelayModernFlowtest_user on User {\n name\n }\n "]);
28
-
29
- _templateObject3 = function _templateObject3() {
30
- return data;
31
- };
32
-
33
- return data;
34
- }
35
-
36
- function _templateObject2() {
37
- var data = (0, _taggedTemplateLiteral2["default"])(["\n fragment RelayModernFlowtest_badref on User {\n id\n # Note: this test includes a reference, but *not the right one*.\n ...RelayModernFlowtest_user\n }\n "]);
38
-
39
- _templateObject2 = function _templateObject2() {
40
- return data;
41
- };
42
-
43
- return data;
44
- }
45
-
46
- function _templateObject() {
47
- var data = (0, _taggedTemplateLiteral2["default"])(["\n fragment RelayModernFlowtest_notref on User {\n id\n ...RelayModernFlowtest_user\n }\n "]);
48
-
49
- _templateObject = function _templateObject() {
50
- return data;
51
- };
52
-
53
- return data;
54
- }
55
-
56
- var NotReferencedTest_ =
57
- /*#__PURE__*/
58
- function (_React$Component) {
59
- (0, _inheritsLoose2["default"])(NotReferencedTest_, _React$Component);
60
-
61
- function NotReferencedTest_() {
62
- return _React$Component.apply(this, arguments) || this;
63
- }
64
-
65
- var _proto = NotReferencedTest_.prototype;
66
-
67
- _proto.render = function render() {
68
- return null;
69
- };
70
-
71
- return NotReferencedTest_;
72
- }(require("react").Component);
73
-
74
- var NotReferencedTest = require("./ReactRelayPublic").createFragmentContainer(NotReferencedTest_, {
75
- notref: require("./ReactRelayPublic").graphql(_templateObject())
76
- });
77
-
78
- var BadReferenceTest_ =
79
- /*#__PURE__*/
80
- function (_React$Component2) {
81
- (0, _inheritsLoose2["default"])(BadReferenceTest_, _React$Component2);
82
-
83
- function BadReferenceTest_() {
84
- return _React$Component2.apply(this, arguments) || this;
85
- }
86
-
87
- var _proto2 = BadReferenceTest_.prototype;
88
-
89
- _proto2.render = function render() {
90
- this.props.badref.id; // $FlowExpectedError
91
-
92
- this.props.badref.name; // $FlowExpectedError The notref fragment was not used.
93
-
94
- return require("react").createElement(NotReferencedTest, {
95
- notref: this.props.badref
96
- });
97
- };
98
-
99
- return BadReferenceTest_;
100
- }(require("react").Component);
101
-
102
- var BadReferenceTest = require("./ReactRelayPublic").createFragmentContainer(BadReferenceTest_, {
103
- badref: require("./ReactRelayPublic").graphql(_templateObject2())
104
- });
105
-
106
- require("react").createElement(BadReferenceTest, {
107
- badref: someRef
108
- });
109
-
110
- var SingularTest =
111
- /*#__PURE__*/
112
- function (_React$Component3) {
113
- (0, _inheritsLoose2["default"])(SingularTest, _React$Component3);
114
-
115
- function SingularTest() {
116
- return _React$Component3.apply(this, arguments) || this;
117
- }
118
-
119
- var _proto3 = SingularTest.prototype;
120
-
121
- _proto3.render = function render() {
122
- require("nullthrows")(this.props.user.name); // $FlowExpectedError
123
-
124
-
125
- this.props.nullableUser.name; // $FlowExpectedError
126
-
127
- this.props.optionalUser.name;
128
-
129
- require("nullthrows")(require("nullthrows")(this.props.nullableUser).name);
130
-
131
- require("nullthrows")(require("nullthrows")(this.props.optionalUser).name);
132
-
133
- return null;
134
- };
135
-
136
- return SingularTest;
137
- }(require("react").Component);
138
-
139
- SingularTest = require("./ReactRelayPublic").createFragmentContainer(SingularTest, {
140
- user: require("./ReactRelayPublic").graphql(_templateObject3())
141
- });
142
-
143
- var PluralTest =
144
- /*#__PURE__*/
145
- function (_React$Component4) {
146
- (0, _inheritsLoose2["default"])(PluralTest, _React$Component4);
147
-
148
- function PluralTest() {
149
- return _React$Component4.apply(this, arguments) || this;
150
- }
151
-
152
- var _proto4 = PluralTest.prototype;
153
-
154
- _proto4.render = function render() {
155
- var names = this.props.users.map(function (user) {
156
- return user.name;
157
- }).filter(Boolean);
158
- names; // $FlowExpectedError
159
-
160
- names;
161
- return null;
162
- };
163
-
164
- return PluralTest;
165
- }(require("react").Component);
166
-
167
- PluralTest = require("./ReactRelayPublic").createFragmentContainer(PluralTest, {
168
- users: require("./ReactRelayPublic").graphql(_templateObject4())
169
- });
170
-
171
- function cb() {} // $FlowExpectedError - can't pass null for user
172
-
173
-
174
- require("react").createElement(SingularTest, {
175
- onClick: cb,
176
- string: "x",
177
- user: null,
178
- nullableUser: null
179
- }); // $FlowExpectedError - user is required
180
-
181
-
182
- require("react").createElement(SingularTest, {
183
- onClick: cb,
184
- string: "x",
185
- nullableUser: null
186
- }); // $FlowExpectedError - can't pass non-user ref for user
187
-
188
-
189
- require("react").createElement(SingularTest, {
190
- onClick: cb,
191
- string: "x",
192
- user: nonUserRef,
193
- nullableUser: null
194
- }); // $FlowExpectedError - `cb` prop is not a function
195
-
196
-
197
- require("react").createElement(SingularTest, {
198
- onClick: "cb",
199
- string: "x",
200
- user: aUserRef,
201
- nullableUser: null
202
- }); // $FlowExpectedError - `string` prop is not a string
203
-
204
-
205
- require("react").createElement(SingularTest, {
206
- onClick: cb,
207
- string: 1,
208
- user: aUserRef,
209
- nullableUser: null
210
- });
211
-
212
- require("react").createElement(SingularTest, {
213
- onClick: cb,
214
- string: "x",
215
- user: aUserRef,
216
- nullableUser: null
217
- });
218
-
219
- require("react").createElement(SingularTest, {
220
- onClick: cb,
221
- string: "x",
222
- user: aUserRef,
223
- nullableUser: aUserRef
224
- });
225
-
226
- require("react").createElement(SingularTest, {
227
- onClick: cb,
228
- string: "x",
229
- user: aUserRef,
230
- nullableUser: null,
231
- optionalUser: aUserRef
232
- }); // $FlowExpectedError - optional, not nullable!
233
-
234
-
235
- require("react").createElement(SingularTest, {
236
- string: "x",
237
- user: aUserRef,
238
- nullableUser: null,
239
- optionalUser: null
240
- });
241
-
242
- require("react").createElement(SingularTest, {
243
- string: "x",
244
- onClick: cb,
245
- user: aComplexUserRef,
246
- nullableUser: aComplexUserRef,
247
- optionalUser: aComplexUserRef
248
- }); // $FlowExpectedError - can't pass null for user
249
-
250
-
251
- require("react").createElement(PluralTest, {
252
- users: null,
253
- nullableUsers: null
254
- }); // $FlowExpectedError - users is required
255
-
256
-
257
- require("react").createElement(PluralTest, {
258
- nullableUsers: null
259
- }); // $FlowExpectedError - can't pass non-user refs for user
260
-
261
-
262
- require("react").createElement(PluralTest, {
263
- users: [nonUserRef],
264
- nullableUsers: null
265
- });
266
-
267
- require("react").createElement(PluralTest, {
268
- users: usersRef,
269
- nullableUsers: null
270
- });
271
-
272
- require("react").createElement(PluralTest, {
273
- users: [oneOfUsersRef],
274
- nullableUsers: null
275
- });
276
-
277
- require("react").createElement(PluralTest, {
278
- users: [oneOfUsersRef],
279
- nullableUsers: null
280
- });
281
-
282
- require("react").createElement(PluralTest, {
283
- users: usersRef,
284
- nullableUsers: [oneOfUsersRef]
285
- });
286
-
287
- require("react").createElement(PluralTest, {
288
- users: usersRef,
289
- nullableUsers: null,
290
- optionalUsers: usersRef
291
- }); // $FlowExpectedError - optional, not nullable!
292
-
293
-
294
- require("react").createElement(PluralTest, {
295
- users: usersRef,
296
- nullableUsers: null,
297
- optionalUsers: null
298
- });
299
-
300
- var AnyTest =
301
- /*#__PURE__*/
302
- function (_React$Component5) {
303
- (0, _inheritsLoose2["default"])(AnyTest, _React$Component5);
304
-
305
- function AnyTest() {
306
- return _React$Component5.apply(this, arguments) || this;
307
- }
308
-
309
- return AnyTest;
310
- }(require("react").Component);
311
-
312
- AnyTest = require("./ReactRelayPublic").createFragmentContainer(AnyTest, {});
313
-
314
- require("react").createElement(AnyTest, {
315
- anything: 42,
316
- anyFunction: function anyFunction() {},
317
- maybeFunction: null,
318
- anyObject: {}
319
- });
320
-
321
- require("react").createElement(AnyTest, {
322
- anything: 42,
323
- anyFunction: function anyFunction() {},
324
- maybeFunction: function maybeFunction() {},
325
- anyObject: {}
326
- }); // $FlowExpectedError - optional function cannot be null
327
-
328
-
329
- require("react").createElement(AnyTest, {
330
- anything: 42,
331
- anyFunction: function anyFunction() {},
332
- optionalFunction: function optionalFunction() {},
333
- anyObject: {}
334
- }); // $FlowExpectedError - can't pass {} for a Function
335
-
336
-
337
- require("react").createElement(AnyTest, {
338
- anything: 42,
339
- anyFunction: {},
340
- maybeFunction: function maybeFunction() {},
341
- anyObject: {}
342
- });
@@ -1,10 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * strict-local
8
- * @format
9
- */
10
- 'use strict';
@@ -1,10 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * strict-local
8
- * @format
9
- */
10
- 'use strict';
@@ -1,10 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * strict-local
8
- * @format
9
- */
10
- 'use strict';
@@ -1,10 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * strict-local
8
- * @format
9
- */
10
- 'use strict';