relay-runtime 11.0.0 → 13.0.0-rc.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/handlers/RelayDefaultHandlerProvider.js.flow +2 -2
- package/handlers/connection/ConnectionHandler.js.flow +8 -10
- package/handlers/connection/MutationHandlers.js.flow +31 -7
- package/index.js +1 -1
- package/index.js.flow +60 -36
- package/lib/handlers/RelayDefaultHandlerProvider.js +1 -1
- package/lib/handlers/connection/ConnectionHandler.js +8 -8
- package/lib/handlers/connection/MutationHandlers.js +61 -5
- package/lib/index.js +58 -43
- package/lib/multi-actor-environment/ActorIdentifier.js +33 -0
- package/lib/multi-actor-environment/ActorSpecificEnvironment.js +152 -0
- package/lib/multi-actor-environment/ActorUtils.js +27 -0
- package/lib/multi-actor-environment/MultiActorEnvironment.js +419 -0
- package/lib/multi-actor-environment/MultiActorEnvironmentTypes.js +11 -0
- package/lib/multi-actor-environment/index.js +21 -0
- package/lib/mutations/RelayDeclarativeMutationConfig.js +4 -1
- package/lib/mutations/RelayRecordProxy.js +3 -2
- package/lib/mutations/RelayRecordSourceMutator.js +3 -2
- package/lib/mutations/RelayRecordSourceProxy.js +12 -4
- package/lib/mutations/RelayRecordSourceSelectorProxy.js +18 -5
- package/lib/mutations/applyOptimisticMutation.js +6 -6
- package/lib/mutations/commitMutation.js +14 -10
- package/lib/mutations/readUpdatableQuery_EXPERIMENTAL.js +238 -0
- package/lib/mutations/validateMutation.js +12 -5
- package/lib/network/ConvertToExecuteFunction.js +2 -1
- package/lib/network/RelayNetwork.js +3 -2
- package/lib/network/RelayQueryResponseCache.js +21 -4
- package/lib/network/wrapNetworkWithLogObserver.js +79 -0
- package/lib/query/GraphQLTag.js +3 -2
- package/lib/query/fetchQuery.js +6 -5
- package/lib/query/fetchQueryInternal.js +1 -1
- package/lib/query/fetchQuery_DEPRECATED.js +2 -1
- package/lib/store/ClientID.js +7 -1
- package/lib/store/DataChecker.js +141 -60
- package/lib/store/{RelayModernQueryExecutor.js → OperationExecutor.js} +532 -195
- package/lib/store/RelayConcreteVariables.js +24 -4
- package/lib/store/RelayModernEnvironment.js +175 -234
- package/lib/store/RelayModernFragmentSpecResolver.js +52 -26
- package/lib/store/RelayModernOperationDescriptor.js +2 -1
- package/lib/store/RelayModernRecord.js +47 -12
- package/lib/store/RelayModernSelector.js +14 -8
- package/lib/store/RelayModernStore.js +58 -29
- package/lib/store/RelayOperationTracker.js +34 -24
- package/lib/store/RelayPublishQueue.js +41 -13
- package/lib/store/RelayReader.js +287 -46
- package/lib/store/RelayRecordSource.js +87 -3
- package/lib/store/RelayReferenceMarker.js +55 -31
- package/lib/store/RelayResponseNormalizer.js +250 -108
- package/lib/store/RelayStoreReactFlightUtils.js +8 -12
- package/lib/store/RelayStoreSubscriptions.js +14 -9
- package/lib/store/RelayStoreUtils.js +11 -5
- package/lib/store/ResolverCache.js +213 -0
- package/lib/store/ResolverFragments.js +61 -0
- package/lib/store/cloneRelayHandleSourceField.js +5 -4
- package/lib/store/cloneRelayScalarHandleSourceField.js +5 -4
- package/lib/store/createRelayContext.js +4 -2
- package/lib/store/defaultGetDataID.js +3 -1
- package/lib/store/readInlineData.js +6 -2
- package/lib/subscription/requestSubscription.js +35 -9
- package/lib/util/RelayConcreteNode.js +4 -0
- package/lib/util/RelayFeatureFlags.js +11 -4
- package/lib/util/RelayProfiler.js +17 -187
- package/lib/util/RelayReplaySubject.js +22 -7
- package/lib/util/RelayRuntimeTypes.js +0 -6
- package/lib/util/StringInterner.js +71 -0
- package/lib/util/deepFreeze.js +1 -0
- package/lib/util/getFragmentIdentifier.js +15 -7
- package/lib/util/getOperation.js +2 -1
- package/lib/util/getPaginationMetadata.js +41 -0
- package/lib/util/getPaginationVariables.js +66 -0
- package/lib/util/getPendingOperationsForFragment.js +55 -0
- package/lib/util/getRefetchMetadata.js +36 -0
- package/lib/util/getRelayHandleKey.js +2 -2
- package/lib/util/getRequestIdentifier.js +2 -2
- package/lib/util/getValueAtPath.js +51 -0
- package/lib/util/isEmptyObject.js +1 -1
- package/lib/util/registerEnvironmentWithDevTools.js +26 -0
- package/lib/util/withDuration.js +31 -0
- package/multi-actor-environment/ActorIdentifier.js.flow +43 -0
- package/multi-actor-environment/ActorSpecificEnvironment.js.flow +225 -0
- package/multi-actor-environment/ActorUtils.js.flow +33 -0
- package/multi-actor-environment/MultiActorEnvironment.js.flow +506 -0
- package/multi-actor-environment/MultiActorEnvironmentTypes.js.flow +261 -0
- package/multi-actor-environment/index.js.flow +26 -0
- package/mutations/RelayDeclarativeMutationConfig.js.flow +32 -26
- package/mutations/RelayRecordProxy.js.flow +4 -5
- package/mutations/RelayRecordSourceMutator.js.flow +4 -6
- package/mutations/RelayRecordSourceProxy.js.flow +19 -10
- package/mutations/RelayRecordSourceSelectorProxy.js.flow +22 -7
- package/mutations/applyOptimisticMutation.js.flow +13 -14
- package/mutations/commitLocalUpdate.js.flow +1 -1
- package/mutations/commitMutation.js.flow +35 -46
- package/mutations/readUpdatableQuery_EXPERIMENTAL.js.flow +309 -0
- package/mutations/validateMutation.js.flow +28 -16
- package/network/ConvertToExecuteFunction.js.flow +2 -2
- package/network/RelayNetwork.js.flow +4 -5
- package/network/RelayNetworkTypes.js.flow +17 -8
- package/network/RelayObservable.js.flow +1 -1
- package/network/RelayQueryResponseCache.js.flow +34 -20
- package/network/wrapNetworkWithLogObserver.js.flow +100 -0
- package/package.json +3 -2
- package/query/GraphQLTag.js.flow +9 -9
- package/query/PreloadableQueryRegistry.js.flow +2 -1
- package/query/fetchQuery.js.flow +11 -13
- package/query/fetchQueryInternal.js.flow +6 -9
- package/query/fetchQuery_DEPRECATED.js.flow +6 -6
- package/relay-runtime.js +2 -2
- package/relay-runtime.min.js +2 -2
- package/store/ClientID.js.flow +14 -3
- package/store/DataChecker.js.flow +162 -67
- package/store/{RelayModernQueryExecutor.js.flow → OperationExecutor.js.flow} +616 -283
- package/store/RelayConcreteVariables.js.flow +27 -5
- package/store/RelayModernEnvironment.js.flow +176 -235
- package/store/RelayModernFragmentSpecResolver.js.flow +55 -31
- package/store/RelayModernOperationDescriptor.js.flow +12 -7
- package/store/RelayModernRecord.js.flow +67 -11
- package/store/RelayModernSelector.js.flow +24 -14
- package/store/RelayModernStore.js.flow +72 -36
- package/store/RelayOperationTracker.js.flow +59 -43
- package/store/RelayOptimisticRecordSource.js.flow +2 -2
- package/store/RelayPublishQueue.js.flow +79 -34
- package/store/RelayReader.js.flow +351 -72
- package/store/RelayRecordSource.js.flow +72 -6
- package/store/RelayReferenceMarker.js.flow +60 -33
- package/store/RelayResponseNormalizer.js.flow +288 -102
- package/store/RelayStoreReactFlightUtils.js.flow +9 -13
- package/store/RelayStoreSubscriptions.js.flow +19 -11
- package/store/RelayStoreTypes.js.flow +210 -44
- package/store/RelayStoreUtils.js.flow +25 -11
- package/store/ResolverCache.js.flow +249 -0
- package/store/ResolverFragments.js.flow +121 -0
- package/store/StoreInspector.js.flow +2 -2
- package/store/TypeID.js.flow +1 -1
- package/store/ViewerPattern.js.flow +2 -2
- package/store/cloneRelayHandleSourceField.js.flow +5 -6
- package/store/cloneRelayScalarHandleSourceField.js.flow +5 -6
- package/store/createFragmentSpecResolver.js.flow +3 -4
- package/store/createRelayContext.js.flow +3 -3
- package/store/defaultGetDataID.js.flow +3 -1
- package/store/normalizeRelayPayload.js.flow +6 -7
- package/store/readInlineData.js.flow +7 -8
- package/subscription/requestSubscription.js.flow +54 -27
- package/util/NormalizationNode.js.flow +16 -3
- package/util/ReaderNode.js.flow +38 -2
- package/util/RelayConcreteNode.js.flow +4 -0
- package/util/RelayFeatureFlags.js.flow +24 -8
- package/util/RelayProfiler.js.flow +22 -194
- package/util/RelayReplaySubject.js.flow +9 -9
- package/util/RelayRuntimeTypes.js.flow +73 -4
- package/util/StringInterner.js.flow +69 -0
- package/util/createPayloadFor3DField.js.flow +3 -3
- package/util/deepFreeze.js.flow +2 -1
- package/util/getFragmentIdentifier.js.flow +27 -15
- package/util/getOperation.js.flow +2 -2
- package/util/getPaginationMetadata.js.flow +72 -0
- package/util/getPaginationVariables.js.flow +108 -0
- package/util/getPendingOperationsForFragment.js.flow +62 -0
- package/util/getRefetchMetadata.js.flow +79 -0
- package/util/getRelayHandleKey.js.flow +1 -2
- package/util/getRequestIdentifier.js.flow +3 -3
- package/util/getValueAtPath.js.flow +46 -0
- package/util/isEmptyObject.js.flow +2 -1
- package/util/registerEnvironmentWithDevTools.js.flow +33 -0
- package/util/resolveImmediate.js.flow +1 -1
- package/util/withDuration.js.flow +32 -0
- package/lib/store/RelayRecordSourceMapImpl.js +0 -107
- package/lib/store/RelayStoreSubscriptionsUsingMapByID.js +0 -318
- package/store/RelayRecordSourceMapImpl.js.flow +0 -91
- package/store/RelayStoreSubscriptionsUsingMapByID.js.flow +0 -283
package/lib/store/DataChecker.js
CHANGED
|
@@ -15,39 +15,44 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
15
15
|
|
|
16
16
|
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
|
|
17
17
|
|
|
18
|
-
var RelayConcreteNode = require('../util/RelayConcreteNode');
|
|
19
|
-
|
|
20
|
-
var RelayFeatureFlags = require('../util/RelayFeatureFlags');
|
|
21
|
-
|
|
22
|
-
var RelayModernRecord = require('./RelayModernRecord');
|
|
23
|
-
|
|
24
18
|
var RelayRecordSourceMutator = require('../mutations/RelayRecordSourceMutator');
|
|
25
19
|
|
|
26
20
|
var RelayRecordSourceProxy = require('../mutations/RelayRecordSourceProxy');
|
|
27
21
|
|
|
28
|
-
var
|
|
22
|
+
var getOperation = require('../util/getOperation');
|
|
29
23
|
|
|
30
|
-
var
|
|
24
|
+
var RelayConcreteNode = require('../util/RelayConcreteNode');
|
|
25
|
+
|
|
26
|
+
var RelayFeatureFlags = require('../util/RelayFeatureFlags');
|
|
27
|
+
|
|
28
|
+
var _require = require('./ClientID'),
|
|
29
|
+
isClientID = _require.isClientID;
|
|
31
30
|
|
|
32
31
|
var cloneRelayHandleSourceField = require('./cloneRelayHandleSourceField');
|
|
33
32
|
|
|
34
33
|
var cloneRelayScalarHandleSourceField = require('./cloneRelayScalarHandleSourceField');
|
|
35
34
|
|
|
36
|
-
var
|
|
35
|
+
var _require2 = require('./RelayConcreteVariables'),
|
|
36
|
+
getLocalVariables = _require2.getLocalVariables;
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var RelayModernRecord = require('./RelayModernRecord');
|
|
39
39
|
|
|
40
|
-
var
|
|
41
|
-
|
|
40
|
+
var _require3 = require('./RelayRecordState'),
|
|
41
|
+
EXISTENT = _require3.EXISTENT,
|
|
42
|
+
UNKNOWN = _require3.UNKNOWN;
|
|
43
|
+
|
|
44
|
+
var RelayStoreReactFlightUtils = require('./RelayStoreReactFlightUtils');
|
|
42
45
|
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
var RelayStoreUtils = require('./RelayStoreUtils');
|
|
47
|
+
|
|
48
|
+
var _require4 = require('./TypeID'),
|
|
49
|
+
generateTypeID = _require4.generateTypeID;
|
|
46
50
|
|
|
47
|
-
var
|
|
48
|
-
generateTypeID = _require3.generateTypeID;
|
|
51
|
+
var invariant = require('invariant');
|
|
49
52
|
|
|
50
|
-
var
|
|
53
|
+
var ACTOR_CHANGE = RelayConcreteNode.ACTOR_CHANGE,
|
|
54
|
+
CONDITION = RelayConcreteNode.CONDITION,
|
|
55
|
+
CLIENT_COMPONENT = RelayConcreteNode.CLIENT_COMPONENT,
|
|
51
56
|
CLIENT_EXTENSION = RelayConcreteNode.CLIENT_EXTENSION,
|
|
52
57
|
DEFER = RelayConcreteNode.DEFER,
|
|
53
58
|
FLIGHT_FIELD = RelayConcreteNode.FLIGHT_FIELD,
|
|
@@ -75,11 +80,11 @@ var ROOT_ID = RelayStoreUtils.ROOT_ID,
|
|
|
75
80
|
* If all records are present, returns `true`, otherwise `false`.
|
|
76
81
|
*/
|
|
77
82
|
|
|
78
|
-
function check(
|
|
83
|
+
function check(getSourceForActor, getTargetForActor, defaultActorIdentifier, selector, handlers, operationLoader, getDataID, shouldProcessClientComponents) {
|
|
79
84
|
var dataID = selector.dataID,
|
|
80
85
|
node = selector.node,
|
|
81
86
|
variables = selector.variables;
|
|
82
|
-
var checker = new DataChecker(
|
|
87
|
+
var checker = new DataChecker(getSourceForActor, getTargetForActor, defaultActorIdentifier, variables, handlers, operationLoader, getDataID, shouldProcessClientComponents);
|
|
83
88
|
return checker.check(node, dataID);
|
|
84
89
|
}
|
|
85
90
|
/**
|
|
@@ -88,20 +93,45 @@ function check(source, target, selector, handlers, operationLoader, getDataID) {
|
|
|
88
93
|
|
|
89
94
|
|
|
90
95
|
var DataChecker = /*#__PURE__*/function () {
|
|
91
|
-
function DataChecker(
|
|
92
|
-
|
|
96
|
+
function DataChecker(getSourceForActor, getTargetForActor, defaultActorIdentifier, variables, handlers, operationLoader, getDataID, shouldProcessClientComponents) {
|
|
97
|
+
this._getSourceForActor = getSourceForActor;
|
|
98
|
+
this._getTargetForActor = getTargetForActor;
|
|
99
|
+
this._getDataID = getDataID;
|
|
100
|
+
this._source = getSourceForActor(defaultActorIdentifier);
|
|
101
|
+
this._mutatorRecordSourceProxyCache = new Map();
|
|
102
|
+
|
|
103
|
+
var _this$_getMutatorAndR = this._getMutatorAndRecordProxyForActor(defaultActorIdentifier),
|
|
104
|
+
mutator = _this$_getMutatorAndR[0],
|
|
105
|
+
recordSourceProxy = _this$_getMutatorAndR[1];
|
|
106
|
+
|
|
93
107
|
this._mostRecentlyInvalidatedAt = null;
|
|
94
108
|
this._handlers = handlers;
|
|
95
109
|
this._mutator = mutator;
|
|
96
110
|
this._operationLoader = operationLoader !== null && operationLoader !== void 0 ? operationLoader : null;
|
|
97
|
-
this._recordSourceProxy =
|
|
111
|
+
this._recordSourceProxy = recordSourceProxy;
|
|
98
112
|
this._recordWasMissing = false;
|
|
99
|
-
this._source = source;
|
|
100
113
|
this._variables = variables;
|
|
114
|
+
this._shouldProcessClientComponents = shouldProcessClientComponents;
|
|
101
115
|
}
|
|
102
116
|
|
|
103
117
|
var _proto = DataChecker.prototype;
|
|
104
118
|
|
|
119
|
+
_proto._getMutatorAndRecordProxyForActor = function _getMutatorAndRecordProxyForActor(actorIdentifier) {
|
|
120
|
+
var tuple = this._mutatorRecordSourceProxyCache.get(actorIdentifier);
|
|
121
|
+
|
|
122
|
+
if (tuple == null) {
|
|
123
|
+
var target = this._getTargetForActor(actorIdentifier);
|
|
124
|
+
|
|
125
|
+
var mutator = new RelayRecordSourceMutator(this._getSourceForActor(actorIdentifier), target);
|
|
126
|
+
var recordSourceProxy = new RelayRecordSourceProxy(mutator, this._getDataID);
|
|
127
|
+
tuple = [mutator, recordSourceProxy];
|
|
128
|
+
|
|
129
|
+
this._mutatorRecordSourceProxyCache.set(actorIdentifier, tuple);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return tuple;
|
|
133
|
+
};
|
|
134
|
+
|
|
105
135
|
_proto.check = function check(node, dataID) {
|
|
106
136
|
this._traverse(node, dataID);
|
|
107
137
|
|
|
@@ -125,6 +155,8 @@ var DataChecker = /*#__PURE__*/function () {
|
|
|
125
155
|
|
|
126
156
|
_proto._getDataForHandlers = function _getDataForHandlers(field, dataID) {
|
|
127
157
|
return {
|
|
158
|
+
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
159
|
+
* this parameters */
|
|
128
160
|
args: field.args ? getArgumentValues(field.args, this._variables) : {},
|
|
129
161
|
// Getting a snapshot of the record state is potentially expensive since
|
|
130
162
|
// we will need to merge the sink and source records. Since we do not create
|
|
@@ -276,8 +308,13 @@ var DataChecker = /*#__PURE__*/function () {
|
|
|
276
308
|
|
|
277
309
|
break;
|
|
278
310
|
|
|
311
|
+
case ACTOR_CHANGE:
|
|
312
|
+
_this2._checkActorChange(selection.linkedField, dataID);
|
|
313
|
+
|
|
314
|
+
break;
|
|
315
|
+
|
|
279
316
|
case CONDITION:
|
|
280
|
-
var conditionValue = _this2._getVariableValue(selection.condition);
|
|
317
|
+
var conditionValue = Boolean(_this2._getVariableValue(selection.condition));
|
|
281
318
|
|
|
282
319
|
if (conditionValue === selection.passingValue) {
|
|
283
320
|
_this2._traverseSelections(selection.selections, dataID);
|
|
@@ -287,16 +324,16 @@ var DataChecker = /*#__PURE__*/function () {
|
|
|
287
324
|
|
|
288
325
|
case INLINE_FRAGMENT:
|
|
289
326
|
{
|
|
290
|
-
var
|
|
327
|
+
var _abstractKey = selection.abstractKey;
|
|
291
328
|
|
|
292
|
-
if (
|
|
329
|
+
if (_abstractKey == null) {
|
|
293
330
|
// concrete type refinement: only check data if the type exactly matches
|
|
294
331
|
var typeName = _this2._mutator.getType(dataID);
|
|
295
332
|
|
|
296
333
|
if (typeName === selection.type) {
|
|
297
334
|
_this2._traverseSelections(selection.selections, dataID);
|
|
298
335
|
}
|
|
299
|
-
} else
|
|
336
|
+
} else {
|
|
300
337
|
// Abstract refinement: check data depending on whether the type
|
|
301
338
|
// conforms to the interface/union or not:
|
|
302
339
|
// - Type known to _not_ implement the interface: don't check the selections.
|
|
@@ -304,25 +341,22 @@ var DataChecker = /*#__PURE__*/function () {
|
|
|
304
341
|
// - Unknown whether the type implements the interface: don't check the selections
|
|
305
342
|
// and treat the data as missing; we do this because the Relay Compiler
|
|
306
343
|
// guarantees that the type discriminator will always be fetched.
|
|
307
|
-
var
|
|
344
|
+
var _recordType = _this2._mutator.getType(dataID);
|
|
345
|
+
|
|
346
|
+
!(_recordType != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'DataChecker: Expected record `%s` to have a known type', dataID) : invariant(false) : void 0;
|
|
308
347
|
|
|
309
|
-
|
|
310
|
-
var typeID = generateTypeID(recordType);
|
|
348
|
+
var _typeID = generateTypeID(_recordType);
|
|
311
349
|
|
|
312
|
-
var
|
|
350
|
+
var _implementsInterface = _this2._mutator.getValue(_typeID, _abstractKey);
|
|
313
351
|
|
|
314
|
-
if (
|
|
352
|
+
if (_implementsInterface === true) {
|
|
315
353
|
_this2._traverseSelections(selection.selections, dataID);
|
|
316
|
-
} else if (
|
|
354
|
+
} else if (_implementsInterface == null) {
|
|
317
355
|
// unsure if the type implements the interface: data is
|
|
318
356
|
// missing so don't bother reading the fragment
|
|
319
357
|
_this2._handleMissing();
|
|
320
358
|
} // else false: known to not implement the interface
|
|
321
359
|
|
|
322
|
-
} else {
|
|
323
|
-
// legacy behavior for abstract refinements: always check even
|
|
324
|
-
// if the type doesn't conform
|
|
325
|
-
_this2._traverseSelections(selection.selections, dataID);
|
|
326
360
|
}
|
|
327
361
|
|
|
328
362
|
break;
|
|
@@ -362,11 +396,14 @@ var DataChecker = /*#__PURE__*/function () {
|
|
|
362
396
|
_this2._traverseSelections(selection.selections, dataID);
|
|
363
397
|
|
|
364
398
|
break;
|
|
365
|
-
// $FlowFixMe[incompatible-type]
|
|
366
399
|
|
|
367
400
|
case FRAGMENT_SPREAD:
|
|
401
|
+
var prevVariables = _this2._variables;
|
|
402
|
+
_this2._variables = getLocalVariables(_this2._variables, selection.fragment.argumentDefinitions, selection.args);
|
|
403
|
+
|
|
368
404
|
_this2._traverseSelections(selection.fragment.selections, dataID);
|
|
369
405
|
|
|
406
|
+
_this2._variables = prevVariables;
|
|
370
407
|
break;
|
|
371
408
|
|
|
372
409
|
case CLIENT_EXTENSION:
|
|
@@ -378,24 +415,21 @@ var DataChecker = /*#__PURE__*/function () {
|
|
|
378
415
|
break;
|
|
379
416
|
|
|
380
417
|
case TYPE_DISCRIMINATOR:
|
|
381
|
-
|
|
382
|
-
var _abstractKey = selection.abstractKey;
|
|
418
|
+
var abstractKey = selection.abstractKey;
|
|
383
419
|
|
|
384
|
-
|
|
420
|
+
var recordType = _this2._mutator.getType(dataID);
|
|
385
421
|
|
|
386
|
-
|
|
422
|
+
!(recordType != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'DataChecker: Expected record `%s` to have a known type', dataID) : invariant(false) : void 0;
|
|
423
|
+
var typeID = generateTypeID(recordType);
|
|
387
424
|
|
|
388
|
-
|
|
425
|
+
var implementsInterface = _this2._mutator.getValue(typeID, abstractKey);
|
|
389
426
|
|
|
390
|
-
|
|
427
|
+
if (implementsInterface == null) {
|
|
428
|
+
// unsure if the type implements the interface: data is
|
|
429
|
+
// missing
|
|
430
|
+
_this2._handleMissing();
|
|
431
|
+
} // else: if it does or doesn't implement, we don't need to check or skip anything else
|
|
391
432
|
|
|
392
|
-
if (_implementsInterface == null) {
|
|
393
|
-
// unsure if the type implements the interface: data is
|
|
394
|
-
// missing
|
|
395
|
-
_this2._handleMissing();
|
|
396
|
-
} // else: if it does or doesn't implement, we don't need to check or skip anything else
|
|
397
|
-
|
|
398
|
-
}
|
|
399
433
|
|
|
400
434
|
break;
|
|
401
435
|
|
|
@@ -408,6 +442,15 @@ var DataChecker = /*#__PURE__*/function () {
|
|
|
408
442
|
|
|
409
443
|
break;
|
|
410
444
|
|
|
445
|
+
case CLIENT_COMPONENT:
|
|
446
|
+
if (_this2._shouldProcessClientComponents === false) {
|
|
447
|
+
break;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
_this2._traverseSelections(selection.fragment.selections, dataID);
|
|
451
|
+
|
|
452
|
+
break;
|
|
453
|
+
|
|
411
454
|
default:
|
|
412
455
|
selection;
|
|
413
456
|
!false ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayAsyncLoader(): Unexpected ast kind `%s`.', selection.kind) : invariant(false) : void 0;
|
|
@@ -434,8 +477,12 @@ var DataChecker = /*#__PURE__*/function () {
|
|
|
434
477
|
|
|
435
478
|
if (normalizationRootNode != null) {
|
|
436
479
|
var operation = getOperation(normalizationRootNode);
|
|
480
|
+
var prevVariables = this._variables;
|
|
481
|
+
this._variables = getLocalVariables(this._variables, operation.argumentDefinitions, moduleImport.args);
|
|
437
482
|
|
|
438
483
|
this._traverse(operation, dataID);
|
|
484
|
+
|
|
485
|
+
this._variables = prevVariables;
|
|
439
486
|
} else {
|
|
440
487
|
// If the fragment is not available, we assume that the data cannot have been
|
|
441
488
|
// processed yet and must therefore be missing.
|
|
@@ -503,6 +550,40 @@ var DataChecker = /*#__PURE__*/function () {
|
|
|
503
550
|
}
|
|
504
551
|
};
|
|
505
552
|
|
|
553
|
+
_proto._checkActorChange = function _checkActorChange(field, dataID) {
|
|
554
|
+
var storageKey = getStorageKey(field, this._variables);
|
|
555
|
+
|
|
556
|
+
var record = this._source.get(dataID);
|
|
557
|
+
|
|
558
|
+
var tuple = record != null ? RelayModernRecord.getActorLinkedRecordID(record, storageKey) : record;
|
|
559
|
+
|
|
560
|
+
if (tuple == null) {
|
|
561
|
+
if (tuple === undefined) {
|
|
562
|
+
this._handleMissing();
|
|
563
|
+
}
|
|
564
|
+
} else {
|
|
565
|
+
var _actorIdentifier = tuple[0],
|
|
566
|
+
linkedID = tuple[1];
|
|
567
|
+
var prevSource = this._source;
|
|
568
|
+
var prevMutator = this._mutator;
|
|
569
|
+
var prevRecordSourceProxy = this._recordSourceProxy;
|
|
570
|
+
|
|
571
|
+
var _this$_getMutatorAndR2 = this._getMutatorAndRecordProxyForActor(_actorIdentifier),
|
|
572
|
+
mutator = _this$_getMutatorAndR2[0],
|
|
573
|
+
recordSourceProxy = _this$_getMutatorAndR2[1];
|
|
574
|
+
|
|
575
|
+
this._source = this._getSourceForActor(_actorIdentifier);
|
|
576
|
+
this._mutator = mutator;
|
|
577
|
+
this._recordSourceProxy = recordSourceProxy;
|
|
578
|
+
|
|
579
|
+
this._traverse(field, linkedID);
|
|
580
|
+
|
|
581
|
+
this._source = prevSource;
|
|
582
|
+
this._mutator = prevMutator;
|
|
583
|
+
this._recordSourceProxy = prevRecordSourceProxy;
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
|
|
506
587
|
_proto._checkFlightField = function _checkFlightField(field, dataID) {
|
|
507
588
|
var storageKey = getStorageKey(field, this._variables);
|
|
508
589
|
|
|
@@ -520,28 +601,28 @@ var DataChecker = /*#__PURE__*/function () {
|
|
|
520
601
|
|
|
521
602
|
var tree = this._mutator.getValue(linkedID, RelayStoreReactFlightUtils.REACT_FLIGHT_TREE_STORAGE_KEY);
|
|
522
603
|
|
|
523
|
-
var
|
|
604
|
+
var reachableExecutableDefinitions = this._mutator.getValue(linkedID, RelayStoreReactFlightUtils.REACT_FLIGHT_EXECUTABLE_DEFINITIONS_STORAGE_KEY);
|
|
524
605
|
|
|
525
|
-
if (tree == null || !Array.isArray(
|
|
606
|
+
if (tree == null || !Array.isArray(reachableExecutableDefinitions)) {
|
|
526
607
|
this._handleMissing();
|
|
527
608
|
|
|
528
609
|
return;
|
|
529
610
|
}
|
|
530
611
|
|
|
531
612
|
var operationLoader = this._operationLoader;
|
|
532
|
-
!(operationLoader !== null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'DataChecker: Expected an operationLoader to be configured when using ' + 'React Flight.') : invariant(false) : void 0; // In Flight, the variables that are in scope for reachable
|
|
533
|
-
// the same as what's in scope for the outer query.
|
|
613
|
+
!(operationLoader !== null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'DataChecker: Expected an operationLoader to be configured when using ' + 'React Flight.') : invariant(false) : void 0; // In Flight, the variables that are in scope for reachable executable
|
|
614
|
+
// definitions aren't the same as what's in scope for the outer query.
|
|
534
615
|
|
|
535
616
|
var prevVariables = this._variables; // $FlowFixMe[incompatible-cast]
|
|
536
617
|
|
|
537
|
-
var _iterator4 = (0, _createForOfIteratorHelper2["default"])(
|
|
618
|
+
var _iterator4 = (0, _createForOfIteratorHelper2["default"])(reachableExecutableDefinitions),
|
|
538
619
|
_step4;
|
|
539
620
|
|
|
540
621
|
try {
|
|
541
622
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
542
|
-
var
|
|
543
|
-
this._variables =
|
|
544
|
-
var normalizationRootNode = operationLoader.get(
|
|
623
|
+
var definition = _step4.value;
|
|
624
|
+
this._variables = definition.variables;
|
|
625
|
+
var normalizationRootNode = operationLoader.get(definition.module);
|
|
545
626
|
|
|
546
627
|
if (normalizationRootNode != null) {
|
|
547
628
|
var operation = getOperation(normalizationRootNode);
|