react-relay 2.0.0-rc.2 → 5.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.
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,551 +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 _inheritsLoose2 = require("@babel/runtime/helpers/interopRequireDefault")(require("@babel/runtime/helpers/inheritsLoose"));
13
-
14
- var MUTATION_STATUS = require("./RelayRecord").MetadataKey.MUTATION_STATUS;
15
-
16
- var METADATA_KEYS = ['__status__', '__resolvedFragmentMapGeneration__'];
17
- /**
18
- * @internal
19
- *
20
- * Retrieves data from the `RelayStore`.
21
- */
22
-
23
- function readRelayQueryData(storeData, queryNode, dataID, options) {
24
- var reader = new RelayStoreReader(storeData, options);
25
- var data = reader.retrieveData(queryNode, dataID); // We validate only after retrieving the data, to give our `invariant`
26
- // checks below a chance to fail fast.
27
-
28
- require("./validateRelayReadQuery")(queryNode, options);
29
-
30
- return data;
31
- }
32
-
33
- var RelayStoreReader =
34
- /*#__PURE__*/
35
- function (_RelayQueryVisitor) {
36
- (0, _inheritsLoose2["default"])(RelayStoreReader, _RelayQueryVisitor);
37
-
38
- // GraphQLStoreRangeUtils
39
- function RelayStoreReader(storeData, options) {
40
- var _this;
41
-
42
- _this = _RelayQueryVisitor.call(this) || this;
43
- _this._rangeData = storeData.getRangeData();
44
- _this._recordStore = storeData.getQueuedStore();
45
- _this._storeData = storeData;
46
- _this._traverseFragmentReferences = options && options.traverseFragmentReferences || false;
47
- _this._traverseGeneratedFields = options && options.traverseGeneratedFields || false;
48
- return _this;
49
- }
50
- /**
51
- * Runs `queryNode` against the data in `dataID` and returns the result.
52
- */
53
-
54
-
55
- var _proto = RelayStoreReader.prototype;
56
-
57
- _proto.retrieveData = function retrieveData(queryNode, dataID) {
58
- var result = {
59
- data: undefined,
60
- dataIDs: {}
61
- };
62
-
63
- var rangeData = this._rangeData.parseRangeClientID(dataID);
64
-
65
- var status = this._recordStore.getRecordState(rangeData ? rangeData.dataID : dataID);
66
-
67
- if (status === require("./RelayClassicRecordState").EXISTENT) {
68
- var state = this._createState({
69
- componentDataID: null,
70
- data: undefined,
71
- isPartial: false,
72
- parent: null,
73
- rangeInfo: null,
74
- seenDataIDs: result.dataIDs,
75
- storeDataID: dataID
76
- });
77
-
78
- this.visit(queryNode, state);
79
- result.data = state.data;
80
- } else if (status === require("./RelayClassicRecordState").NONEXISTENT) {
81
- result.data = null;
82
- }
83
-
84
- return result;
85
- };
86
-
87
- _proto.visit = function visit(node, state) {
88
- var result = _RelayQueryVisitor.prototype.visit.call(this, node, state);
89
-
90
- this._updateMetadataFields(state);
91
-
92
- return result;
93
- };
94
-
95
- _proto.visitField = function visitField(node, state) {
96
- var _ConnectionInterface$ = require("relay-runtime").ConnectionInterface.get(),
97
- EDGES = _ConnectionInterface$.EDGES,
98
- PAGE_INFO = _ConnectionInterface$.PAGE_INFO; // Check for range client IDs (eg. `someID_first(25)`) and unpack if
99
- // present, overriding `state`.
100
-
101
-
102
- this._handleRangeInfo(node, state);
103
-
104
- if (node.canHaveSubselections() || node.isGenerated()) {
105
- // Make sure we return at least the __dataID__.
106
- getDataObject(state);
107
- }
108
-
109
- if (node.isGenerated() && !this._traverseGeneratedFields) {
110
- return;
111
- }
112
-
113
- var rangeInfo = state.rangeInfo;
114
-
115
- if (rangeInfo && node.getSchemaName() === EDGES) {
116
- this._readEdges(node, rangeInfo, state);
117
- } else if (rangeInfo && node.getSchemaName() === PAGE_INFO) {
118
- this._readPageInfo(node, rangeInfo, state);
119
- } else if (!node.canHaveSubselections()) {
120
- this._readScalar(node, state);
121
- } else if (node.isPlural()) {
122
- this._readPlural(node, state);
123
- } else if (node.isConnection()) {
124
- this._readConnection(node, state);
125
- } else {
126
- this._readLinkedField(node, state);
127
- }
128
-
129
- state.seenDataIDs[state.storeDataID] = true;
130
- };
131
-
132
- _proto.visitFragment = function visitFragment(node, state) {
133
- var dataID = getComponentDataID(state);
134
-
135
- if (node.isContainerFragment() && !this._traverseFragmentReferences) {
136
- state.seenDataIDs[dataID] = true;
137
- var data = getDataObject(state);
138
-
139
- require("./RelayFragmentPointer").addFragment(data, node);
140
- } else if (require("./isCompatibleRelayFragmentType")(node, this._recordStore.getType(dataID))) {
141
- this.traverse(node, state);
142
- }
143
- };
144
-
145
- _proto._createState = function _createState(state) {
146
- // If we have a valid `dataID`, ensure that a record is created for it even
147
- // if we do not actually end up populating it with fields.
148
- var status = this._recordStore.getRecordState(state.storeDataID);
149
-
150
- if (status === require("./RelayClassicRecordState").EXISTENT) {
151
- getDataObject(state);
152
- }
153
-
154
- return state;
155
- };
156
-
157
- _proto._readScalar = function _readScalar(node, state) {
158
- var storageKey = node.getStorageKey();
159
-
160
- var field = this._recordStore.getField(state.storeDataID, storageKey);
161
-
162
- if (field === undefined) {
163
- state.isPartial = true;
164
- } else if (field === null && !state.data) {
165
- state.data = null;
166
- } else {
167
- this._setDataValue(state, node.getApplicationName(), Array.isArray(field) ? field.slice() : field);
168
- }
169
- };
170
-
171
- _proto._readPlural = function _readPlural(node, state) {
172
- var _this2 = this;
173
-
174
- var storageKey = node.getStorageKey();
175
-
176
- var dataIDs = this._recordStore.getLinkedRecordIDs(state.storeDataID, storageKey);
177
-
178
- if (dataIDs) {
179
- var applicationName = node.getApplicationName();
180
- var previousData = getDataValue(state, applicationName);
181
- var nextData = dataIDs.map(function (dataID, ii) {
182
- var data;
183
-
184
- if (previousData instanceof Object) {
185
- data = previousData[ii];
186
- }
187
-
188
- var nextState = _this2._createState({
189
- componentDataID: null,
190
- data: data,
191
- isPartial: false,
192
- parent: node,
193
- rangeInfo: null,
194
- seenDataIDs: state.seenDataIDs,
195
- storeDataID: dataID
196
- });
197
-
198
- node.getChildren().forEach(function (child) {
199
- return _this2.visit(child, nextState);
200
- });
201
-
202
- if (nextState.isPartial) {
203
- state.isPartial = true;
204
- }
205
-
206
- return nextState.data;
207
- });
208
-
209
- this._setDataValue(state, applicationName, nextData);
210
- }
211
- };
212
-
213
- _proto._readConnection = function _readConnection(node, state) {
214
- var applicationName = node.getApplicationName();
215
- var storageKey = node.getStorageKey();
216
- var calls = node.getCallsWithValues();
217
-
218
- var dataID = this._recordStore.getLinkedRecordID(state.storeDataID, storageKey);
219
-
220
- if (!dataID) {
221
- state.isPartial = true;
222
- return;
223
- }
224
-
225
- enforceRangeCalls(node);
226
-
227
- var metadata = this._recordStore.getRangeMetadata(dataID, calls);
228
-
229
- var nextState = this._createState({
230
- componentDataID: this._getConnectionClientID(node, dataID),
231
- data: getDataValue(state, applicationName),
232
- isPartial: false,
233
- parent: node,
234
- rangeInfo: metadata && calls.length ? metadata : null,
235
- seenDataIDs: state.seenDataIDs,
236
- storeDataID: dataID
237
- });
238
-
239
- this.traverse(node, nextState);
240
-
241
- if (nextState.isPartial) {
242
- state.isPartial = true;
243
- }
244
-
245
- this._setDataValue(state, applicationName, nextState.data);
246
- };
247
-
248
- _proto._readEdges = function _readEdges(node, rangeInfo, state) {
249
- var _this3 = this;
250
-
251
- var _ConnectionInterface$2 = require("relay-runtime").ConnectionInterface.get(),
252
- EDGES = _ConnectionInterface$2.EDGES;
253
-
254
- if (rangeInfo.diffCalls.length) {
255
- state.isPartial = true;
256
- }
257
-
258
- var previousData = getDataValue(state, EDGES); // Include null-filtered edges as "seen" so that they will be subscribed.
259
-
260
- rangeInfo.requestedEdgeIDs.forEach(function (edgeID) {
261
- state.seenDataIDs[edgeID] = true;
262
- });
263
- var edges = rangeInfo.filteredEdges.map(function (edgeData, ii) {
264
- var data;
265
-
266
- if (previousData instanceof Object) {
267
- data = previousData[ii];
268
- }
269
-
270
- var nextState = _this3._createState({
271
- componentDataID: null,
272
- data: data,
273
- isPartial: false,
274
- parent: node,
275
- rangeInfo: null,
276
- seenDataIDs: state.seenDataIDs,
277
- storeDataID: edgeData.edgeID
278
- });
279
-
280
- _this3.traverse(node, nextState);
281
-
282
- if (nextState.isPartial) {
283
- state.isPartial = true;
284
- }
285
-
286
- return nextState.data;
287
- });
288
-
289
- this._setDataValue(state, EDGES, edges);
290
- };
291
-
292
- _proto._readPageInfo = function _readPageInfo(node, rangeInfo, state) {
293
- var _this4 = this;
294
-
295
- var _ConnectionInterface$3 = require("relay-runtime").ConnectionInterface.get(),
296
- PAGE_INFO = _ConnectionInterface$3.PAGE_INFO;
297
-
298
- var pageInfo = rangeInfo.pageInfo;
299
- !pageInfo ? process.env.NODE_ENV !== "production" ? require("fbjs/lib/invariant")(false, 'readRelayQueryData(): Missing field, `%s`.', PAGE_INFO) : require("fbjs/lib/invariant")(false) : void 0;
300
-
301
- if (rangeInfo.diffCalls.length) {
302
- state.isPartial = true;
303
- }
304
-
305
- var info = pageInfo; // for Flow
306
-
307
- var nextData; // Page info comes from the range metadata, so we do a custom traversal here
308
- // which is simpler than passing through page-info-related state as a hint
309
- // for the normal traversal.
310
-
311
- var read = function read(child) {
312
- if (child instanceof require("./RelayQuery").Fragment) {
313
- if (child.isContainerFragment() && !_this4._traverseFragmentReferences) {
314
- nextData = nextData || {};
315
-
316
- require("./RelayFragmentPointer").addFragment(nextData, child);
317
- } else {
318
- child.getChildren().forEach(read);
319
- }
320
- } else {
321
- var field = child;
322
-
323
- if (!field.isGenerated() || _this4._traverseGeneratedFields) {
324
- nextData = nextData || {};
325
- nextData[field.getApplicationName()] = info[field.getStorageKey()];
326
- }
327
- }
328
- };
329
-
330
- node.getChildren().forEach(read);
331
-
332
- this._setDataValue(state, node.getApplicationName(), nextData);
333
- };
334
-
335
- _proto._readLinkedField = function _readLinkedField(node, state) {
336
- var storageKey = node.getStorageKey();
337
- var applicationName = node.getApplicationName();
338
-
339
- var dataID = this._recordStore.getLinkedRecordID(state.storeDataID, storageKey);
340
-
341
- if (dataID == null) {
342
- if (dataID === undefined) {
343
- state.isPartial = true;
344
- }
345
-
346
- this._setDataValue(state, applicationName, dataID);
347
-
348
- return;
349
- }
350
-
351
- var nextState = this._createState({
352
- componentDataID: null,
353
- data: getDataValue(state, applicationName),
354
- isPartial: false,
355
- parent: node,
356
- rangeInfo: null,
357
- seenDataIDs: state.seenDataIDs,
358
- storeDataID: dataID
359
- });
360
-
361
- this.traverse(node, nextState);
362
-
363
- if (nextState.isPartial) {
364
- state.isPartial = true;
365
- }
366
-
367
- this._setDataValue(state, applicationName, nextState.data);
368
- };
369
- /**
370
- * Assigns `value` to the property of `state.data` identified by `key`.
371
- *
372
- * Pre-populates `state` with a suitable `data` object if needed, and copies
373
- * over any metadata fields, if present.
374
- */
375
-
376
-
377
- _proto._setDataValue = function _setDataValue(state, key, value) {
378
- var data = getDataObject(state); // ensure __dataID__
379
-
380
- if (value === undefined) {
381
- return;
382
- }
383
-
384
- data[key] = value;
385
- };
386
-
387
- _proto._updateMetadataFields = function _updateMetadataFields(state) {
388
- var _this5 = this;
389
-
390
- var data = state.data;
391
-
392
- if (!(data instanceof Object)) {
393
- return;
394
- }
395
-
396
- var dataID = state.storeDataID; // Copy metadata that is necessary to dirty records when recycling objects.
397
-
398
- METADATA_KEYS.forEach(function (metadataKey) {
399
- var metadataValue = _this5._recordStore.getField(dataID, metadataKey);
400
-
401
- if (metadataValue != null) {
402
- data[metadataKey] = metadataValue;
403
- }
404
- }); // Set the partial bit after metadata has been copied over.
405
-
406
- if (state.isPartial) {
407
- data.__status__ = require("./RelayRecordStatusMap").setPartialStatus(data.__status__, true);
408
- } // Hash any pending mutation transactions.
409
-
410
-
411
- var mutationIDs = this._storeData.getClientMutationIDs(dataID);
412
-
413
- if (mutationIDs) {
414
- var statuses = [];
415
-
416
- var mutationQueue = this._storeData.getMutationQueue();
417
-
418
- mutationIDs.forEach(function (mutationID) {
419
- var transaction = mutationQueue.getTransaction(mutationID);
420
-
421
- if (transaction) {
422
- statuses.push(transaction.getHash());
423
- }
424
- });
425
- data[MUTATION_STATUS] = statuses.join(',');
426
- }
427
- };
428
- /**
429
- * Obtains a client ID (eg. `someDataID_first(10)`) for the connection
430
- * identified by `connectionID`. If there are no range calls on the supplied
431
- * `node`, then a call-less connection ID (eg. `someDataID`) will be returned
432
- * instead.
433
- */
434
-
435
-
436
- _proto._getConnectionClientID = function _getConnectionClientID(node, connectionID) {
437
- var calls = node.getCallsWithValues();
438
-
439
- if (!require("relay-runtime").ConnectionInterface.hasRangeCalls(calls)) {
440
- return connectionID;
441
- }
442
-
443
- return this._rangeData.getClientIDForRangeWithID(require("./callsToGraphQL")(calls), {}, connectionID);
444
- };
445
- /**
446
- * Checks to see if we have a range client ID (eg. `someID_first(25)`), and if
447
- * so, unpacks the range metadata, stashing it into (and overriding) `state`.
448
- */
449
-
450
-
451
- _proto._handleRangeInfo = function _handleRangeInfo(node, state) {
452
- var rangeData = this._rangeData.parseRangeClientID(state.storeDataID);
453
-
454
- if (rangeData != null) {
455
- state.componentDataID = state.storeDataID;
456
- state.storeDataID = rangeData.dataID;
457
- state.rangeInfo = this._recordStore.getRangeMetadata(state.storeDataID, require("./callsFromGraphQL")(rangeData.calls, rangeData.callValues));
458
- }
459
- };
460
-
461
- return RelayStoreReader;
462
- }(require("./RelayQueryVisitor"));
463
- /**
464
- * Checks that `parent` either has range calls on it or does not contain either
465
- * `page_info` or `edges` fields. This enforcement intentionally transcends
466
- * traverseFragmentReferences boundaries.
467
- */
468
-
469
-
470
- function enforceRangeCalls(parent) {
471
- if (!parent.__hasValidatedConnectionCalls__) {
472
- var calls = parent.getCallsWithValues();
473
-
474
- if (!require("relay-runtime").ConnectionInterface.hasRangeCalls(calls)) {
475
- rangeCallEnforcer.traverse(parent, parent);
476
- }
477
-
478
- parent.__hasValidatedConnectionCalls__ = true;
479
- }
480
- }
481
-
482
- var RelayRangeCallEnforcer =
483
- /*#__PURE__*/
484
- function (_RelayQueryVisitor2) {
485
- (0, _inheritsLoose2["default"])(RelayRangeCallEnforcer, _RelayQueryVisitor2);
486
-
487
- function RelayRangeCallEnforcer() {
488
- return _RelayQueryVisitor2.apply(this, arguments) || this;
489
- }
490
-
491
- var _proto2 = RelayRangeCallEnforcer.prototype;
492
-
493
- _proto2.visitField = function visitField(node, parent) {
494
- var _ConnectionInterface$4 = require("relay-runtime").ConnectionInterface.get(),
495
- EDGES = _ConnectionInterface$4.EDGES,
496
- PAGE_INFO = _ConnectionInterface$4.PAGE_INFO;
497
-
498
- var schemaName = node.getSchemaName();
499
- !(schemaName !== EDGES && schemaName !== PAGE_INFO) ? process.env.NODE_ENV !== "production" ? require("fbjs/lib/invariant")(false, 'readRelayQueryData(): The field `%s` is a connection. Fields `%s` and ' + '`%s` cannot be fetched without a `first`, `last` or `find` argument.', parent.getApplicationName(), EDGES, PAGE_INFO) : require("fbjs/lib/invariant")(false) : void 0;
500
- };
501
-
502
- return RelayRangeCallEnforcer;
503
- }(require("./RelayQueryVisitor"));
504
-
505
- var rangeCallEnforcer = new RelayRangeCallEnforcer();
506
- /**
507
- * Returns the component-specific DataID stored in `state`, falling back to the
508
- * generic "store" DataID.
509
- *
510
- * For most nodes, the generic "store" DataID can be used for both reading out
511
- * of the store and writing into the result object that will be passed back to
512
- * the component. For connections with range calls on them the "store" and
513
- * "component" ID will be different because the component needs a special
514
- * client-ID that encodes the range calls.
515
- */
516
-
517
- function getComponentDataID(state) {
518
- if (state.componentDataID != null) {
519
- return state.componentDataID;
520
- } else {
521
- return state.storeDataID;
522
- }
523
- }
524
- /**
525
- * Retrieves `state.data`, initializing it if necessary.
526
- */
527
-
528
-
529
- function getDataObject(state) {
530
- var data = state.data;
531
-
532
- if (!data) {
533
- data = state.data = require("./RelayRecord").create(getComponentDataID(state));
534
- }
535
-
536
- !(data instanceof Object) ? process.env.NODE_ENV !== "production" ? require("fbjs/lib/invariant")(false, 'readRelayQueryData(): Unable to read field on non-object.') : require("fbjs/lib/invariant")(false) : void 0;
537
- return data;
538
- }
539
- /**
540
- * Looks up the value identified by `key` in `state.data`.
541
- *
542
- * Pre-populates `state` with a suitable `data` objects if needed.
543
- */
544
-
545
-
546
- function getDataValue(state, key) {
547
- var data = getDataObject(state);
548
- return data[key];
549
- }
550
-
551
- module.exports = require("relay-runtime").RelayProfiler.instrument('readRelayQueryData', readRelayQueryData);
@@ -1,12 +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
8
- * @format
9
- */
10
- 'use strict';
11
-
12
- module.exports = require("react-dom").unstable_batchedUpdates;
@@ -1,11 +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
- * @format
8
- */
9
- 'use strict';
10
-
11
- module.exports = require("react-native").unstable_batchedUpdates;