relay-runtime 12.0.0 → 13.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/LICENSE +1 -1
- package/README.md +67 -0
- package/handlers/RelayDefaultHandlerProvider.js.flow +3 -3
- package/handlers/connection/ConnectionHandler.js.flow +9 -18
- package/handlers/connection/ConnectionInterface.js.flow +1 -1
- package/handlers/connection/MutationHandlers.js.flow +8 -12
- package/index.js +2 -2
- package/index.js.flow +43 -34
- package/lib/handlers/RelayDefaultHandlerProvider.js +1 -1
- package/lib/handlers/connection/ConnectionHandler.js +13 -19
- package/lib/handlers/connection/ConnectionInterface.js +1 -1
- package/lib/handlers/connection/MutationHandlers.js +4 -7
- package/lib/index.js +49 -46
- package/lib/multi-actor-environment/ActorIdentifier.js +1 -1
- package/lib/multi-actor-environment/ActorSpecificEnvironment.js +9 -5
- package/lib/multi-actor-environment/ActorUtils.js +1 -1
- package/lib/multi-actor-environment/MultiActorEnvironment.js +36 -23
- package/lib/multi-actor-environment/MultiActorEnvironmentTypes.js +1 -1
- package/lib/multi-actor-environment/index.js +3 -3
- package/lib/mutations/RelayDeclarativeMutationConfig.js +5 -2
- package/lib/mutations/RelayRecordProxy.js +4 -3
- package/lib/mutations/RelayRecordSourceMutator.js +4 -3
- package/lib/mutations/RelayRecordSourceProxy.js +13 -5
- package/lib/mutations/RelayRecordSourceSelectorProxy.js +13 -5
- package/lib/mutations/applyOptimisticMutation.js +7 -7
- package/lib/mutations/commitLocalUpdate.js +1 -1
- package/lib/mutations/commitMutation.js +16 -15
- package/lib/mutations/readUpdatableQuery_EXPERIMENTAL.js +242 -0
- package/lib/mutations/validateMutation.js +7 -7
- package/lib/network/ConvertToExecuteFunction.js +3 -2
- package/lib/network/RelayNetwork.js +4 -3
- package/lib/network/RelayNetworkTypes.js +1 -1
- package/lib/network/RelayObservable.js +2 -4
- package/lib/network/RelayQueryResponseCache.js +3 -3
- package/lib/network/wrapNetworkWithLogObserver.js +3 -2
- package/lib/query/GraphQLTag.js +3 -2
- package/lib/query/PreloadableQueryRegistry.js +1 -1
- package/lib/query/fetchQuery.js +7 -6
- package/lib/query/fetchQueryInternal.js +1 -1
- package/lib/query/fetchQuery_DEPRECATED.js +3 -2
- package/lib/store/ClientID.js +8 -2
- package/lib/store/DataChecker.js +17 -18
- package/lib/store/OperationExecutor.js +14 -14
- package/lib/store/RelayConcreteVariables.js +7 -10
- package/lib/store/RelayExperimentalGraphResponseHandler.js +153 -0
- package/lib/store/RelayExperimentalGraphResponseTransform.js +391 -0
- package/lib/store/RelayModernEnvironment.js +67 -43
- package/lib/store/RelayModernFragmentSpecResolver.js +9 -9
- package/lib/store/RelayModernOperationDescriptor.js +3 -2
- package/lib/store/RelayModernRecord.js +13 -12
- package/lib/store/RelayModernSelector.js +15 -9
- package/lib/store/RelayModernStore.js +15 -16
- package/lib/store/RelayOperationTracker.js +1 -1
- package/lib/store/RelayOptimisticRecordSource.js +1 -1
- package/lib/store/RelayPublishQueue.js +12 -6
- package/lib/store/RelayReader.js +131 -40
- package/lib/store/RelayRecordSource.js +1 -1
- package/lib/store/RelayRecordState.js +1 -1
- package/lib/store/RelayReferenceMarker.js +11 -12
- package/lib/store/RelayResponseNormalizer.js +26 -23
- package/lib/store/RelayStoreReactFlightUtils.js +4 -4
- package/lib/store/RelayStoreSubscriptions.js +7 -5
- package/lib/store/RelayStoreTypes.js +1 -1
- package/lib/store/RelayStoreUtils.js +6 -6
- package/lib/store/ResolverCache.js +7 -7
- package/lib/store/ResolverFragments.js +12 -8
- package/lib/store/StoreInspector.js +1 -1
- package/lib/store/TypeID.js +1 -1
- package/lib/store/ViewerPattern.js +1 -1
- package/lib/store/cloneRelayHandleSourceField.js +6 -5
- package/lib/store/cloneRelayScalarHandleSourceField.js +6 -5
- package/lib/store/createFragmentSpecResolver.js +1 -1
- package/lib/store/createRelayContext.js +4 -2
- package/lib/store/defaultGetDataID.js +1 -1
- package/lib/store/defaultRequiredFieldLogger.js +1 -1
- package/lib/store/hasOverlappingIDs.js +1 -1
- package/lib/store/isRelayModernEnvironment.js +1 -1
- package/lib/store/normalizeRelayPayload.js +1 -1
- package/lib/store/readInlineData.js +7 -3
- package/lib/subscription/requestSubscription.js +4 -6
- package/lib/util/JSResourceTypes.flow.js +1 -1
- package/lib/util/NormalizationNode.js +1 -1
- package/lib/util/ReaderNode.js +1 -1
- package/lib/util/RelayConcreteNode.js +2 -1
- package/lib/util/RelayDefaultHandleKey.js +1 -1
- package/lib/util/RelayError.js +1 -1
- package/lib/util/RelayFeatureFlags.js +8 -3
- package/lib/util/RelayProfiler.js +1 -1
- package/lib/util/RelayReplaySubject.js +1 -1
- package/lib/util/RelayRuntimeTypes.js +1 -7
- package/lib/util/StringInterner.js +71 -0
- package/lib/util/createPayloadFor3DField.js +1 -1
- package/lib/util/deepFreeze.js +1 -1
- package/lib/util/generateID.js +1 -1
- package/lib/util/getAllRootVariables.js +29 -0
- package/lib/util/getFragmentIdentifier.js +16 -8
- package/lib/util/getOperation.js +3 -2
- package/lib/util/getPaginationMetadata.js +1 -1
- package/lib/util/getPaginationVariables.js +3 -4
- package/lib/util/getPendingOperationsForFragment.js +1 -1
- package/lib/util/getRefetchMetadata.js +1 -1
- package/lib/util/getRelayHandleKey.js +3 -3
- package/lib/util/getRequestIdentifier.js +3 -3
- package/lib/util/getValueAtPath.js +1 -1
- package/lib/util/isEmptyObject.js +1 -1
- package/lib/util/isPromise.js +1 -1
- package/lib/util/isScalarAndEqual.js +1 -1
- package/lib/util/recycleNodesInto.js +1 -1
- package/lib/util/registerEnvironmentWithDevTools.js +1 -1
- package/lib/util/reportMissingRequiredFields.js +1 -1
- package/lib/util/resolveImmediate.js +1 -1
- package/lib/util/stableCopy.js +1 -1
- package/lib/util/withDuration.js +1 -1
- package/multi-actor-environment/ActorIdentifier.js.flow +1 -1
- package/multi-actor-environment/ActorSpecificEnvironment.js.flow +28 -20
- package/multi-actor-environment/ActorUtils.js.flow +3 -3
- package/multi-actor-environment/MultiActorEnvironment.js.flow +46 -25
- package/multi-actor-environment/MultiActorEnvironmentTypes.js.flow +28 -12
- package/multi-actor-environment/index.js.flow +2 -3
- package/mutations/RelayDeclarativeMutationConfig.js.flow +33 -28
- package/mutations/RelayRecordProxy.js.flow +5 -6
- package/mutations/RelayRecordSourceMutator.js.flow +5 -7
- package/mutations/RelayRecordSourceProxy.js.flow +20 -11
- package/mutations/RelayRecordSourceSelectorProxy.js.flow +16 -6
- package/mutations/applyOptimisticMutation.js.flow +14 -15
- package/mutations/commitLocalUpdate.js.flow +2 -2
- package/mutations/commitMutation.js.flow +36 -49
- package/mutations/readUpdatableQuery_EXPERIMENTAL.js.flow +318 -0
- package/mutations/validateMutation.js.flow +20 -18
- package/network/ConvertToExecuteFunction.js.flow +3 -3
- package/network/RelayNetwork.js.flow +5 -6
- package/network/RelayNetworkTypes.js.flow +1 -1
- package/network/RelayObservable.js.flow +2 -4
- package/network/RelayQueryResponseCache.js.flow +4 -4
- package/network/wrapNetworkWithLogObserver.js.flow +9 -9
- package/package.json +2 -2
- package/query/GraphQLTag.js.flow +11 -11
- package/query/PreloadableQueryRegistry.js.flow +5 -3
- package/query/fetchQuery.js.flow +19 -19
- package/query/fetchQueryInternal.js.flow +7 -10
- package/query/fetchQuery_DEPRECATED.js.flow +7 -7
- package/relay-runtime.js +2 -2
- package/relay-runtime.min.js +3 -3
- package/store/ClientID.js.flow +10 -3
- package/store/DataChecker.js.flow +21 -30
- package/store/OperationExecutor.js.flow +55 -63
- package/store/RelayConcreteVariables.js.flow +5 -11
- package/store/RelayExperimentalGraphResponseHandler.js.flow +121 -0
- package/store/RelayExperimentalGraphResponseTransform.js.flow +470 -0
- package/store/RelayModernEnvironment.js.flow +57 -28
- package/store/RelayModernFragmentSpecResolver.js.flow +18 -20
- package/store/RelayModernOperationDescriptor.js.flow +11 -12
- package/store/RelayModernRecord.js.flow +20 -13
- package/store/RelayModernSelector.js.flow +25 -15
- package/store/RelayModernStore.js.flow +22 -26
- package/store/RelayOperationTracker.js.flow +12 -18
- package/store/RelayOptimisticRecordSource.js.flow +3 -3
- package/store/RelayPublishQueue.js.flow +43 -24
- package/store/RelayReader.js.flow +181 -68
- package/store/RelayRecordSource.js.flow +3 -3
- package/store/RelayRecordState.js.flow +1 -1
- package/store/RelayReferenceMarker.js.flow +13 -16
- package/store/RelayResponseNormalizer.js.flow +44 -42
- package/store/RelayStoreReactFlightUtils.js.flow +4 -5
- package/store/RelayStoreSubscriptions.js.flow +10 -9
- package/store/RelayStoreTypes.js.flow +73 -30
- package/store/RelayStoreUtils.js.flow +9 -10
- package/store/ResolverCache.js.flow +17 -15
- package/store/ResolverFragments.js.flow +18 -25
- package/store/StoreInspector.js.flow +3 -3
- package/store/TypeID.js.flow +2 -2
- package/store/ViewerPattern.js.flow +3 -3
- package/store/cloneRelayHandleSourceField.js.flow +6 -7
- package/store/cloneRelayScalarHandleSourceField.js.flow +6 -7
- package/store/createFragmentSpecResolver.js.flow +4 -5
- package/store/createRelayContext.js.flow +3 -3
- package/store/defaultGetDataID.js.flow +1 -1
- package/store/defaultRequiredFieldLogger.js.flow +1 -1
- package/store/hasOverlappingIDs.js.flow +1 -1
- package/store/isRelayModernEnvironment.js.flow +1 -1
- package/store/normalizeRelayPayload.js.flow +7 -8
- package/store/readInlineData.js.flow +8 -9
- package/subscription/requestSubscription.js.flow +16 -25
- package/util/JSResourceTypes.flow.js.flow +1 -1
- package/util/NormalizationNode.js.flow +1 -1
- package/util/ReaderNode.js.flow +10 -1
- package/util/RelayConcreteNode.js.flow +4 -1
- package/util/RelayDefaultHandleKey.js.flow +1 -1
- package/util/RelayError.js.flow +1 -1
- package/util/RelayFeatureFlags.js.flow +15 -5
- package/util/RelayProfiler.js.flow +1 -1
- package/util/RelayReplaySubject.js.flow +3 -4
- package/util/RelayRuntimeTypes.js.flow +70 -3
- package/util/StringInterner.js.flow +69 -0
- package/util/createPayloadFor3DField.js.flow +4 -4
- package/util/deepFreeze.js.flow +1 -1
- package/util/generateID.js.flow +1 -1
- package/util/getAllRootVariables.js.flow +36 -0
- package/util/getFragmentIdentifier.js.flow +28 -16
- package/util/getOperation.js.flow +3 -3
- package/util/getPaginationMetadata.js.flow +6 -11
- package/util/getPaginationVariables.js.flow +6 -10
- package/util/getPendingOperationsForFragment.js.flow +3 -3
- package/util/getRefetchMetadata.js.flow +8 -12
- package/util/getRelayHandleKey.js.flow +2 -3
- package/util/getRequestIdentifier.js.flow +4 -4
- package/util/getValueAtPath.js.flow +1 -1
- package/util/isEmptyObject.js.flow +1 -1
- package/util/isPromise.js.flow +1 -1
- package/util/isScalarAndEqual.js.flow +1 -1
- package/util/recycleNodesInto.js.flow +1 -1
- package/util/registerEnvironmentWithDevTools.js.flow +1 -1
- package/util/reportMissingRequiredFields.js.flow +1 -1
- package/util/resolveImmediate.js.flow +2 -2
- package/util/stableCopy.js.flow +1 -1
- package/util/withDuration.js.flow +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and 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
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
* @emails oncall+relay
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// flowlint ambiguous-object-type:error
|
|
13
|
+
|
|
14
|
+
'use strict';
|
|
15
|
+
|
|
16
|
+
import type {RequestParameters} from './RelayConcreteNode';
|
|
17
|
+
import type {Variables} from './RelayRuntimeTypes';
|
|
18
|
+
|
|
19
|
+
function getAllRootVariables(
|
|
20
|
+
userSuppliedVariables: Variables,
|
|
21
|
+
parameters: RequestParameters,
|
|
22
|
+
): Variables {
|
|
23
|
+
const providedVariables = parameters.providedVariables;
|
|
24
|
+
if (providedVariables != null) {
|
|
25
|
+
const allVariables = {};
|
|
26
|
+
Object.assign(allVariables, userSuppliedVariables);
|
|
27
|
+
Object.keys(providedVariables).forEach((varName: string) => {
|
|
28
|
+
allVariables[varName] = providedVariables[varName].get();
|
|
29
|
+
});
|
|
30
|
+
return allVariables;
|
|
31
|
+
} else {
|
|
32
|
+
return userSuppliedVariables;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = getAllRootVariables;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -13,18 +13,17 @@
|
|
|
13
13
|
|
|
14
14
|
'use strict';
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const isEmptyObject = require('./isEmptyObject');
|
|
19
|
-
const stableCopy = require('./stableCopy');
|
|
16
|
+
import type {ReaderFragment} from './ReaderNode';
|
|
20
17
|
|
|
21
18
|
const {
|
|
22
19
|
getDataIDsFromFragment,
|
|
23
|
-
getVariablesFromFragment,
|
|
24
20
|
getSelector,
|
|
21
|
+
getVariablesFromFragment,
|
|
25
22
|
} = require('../store/RelayModernSelector');
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const isEmptyObject = require('./isEmptyObject');
|
|
24
|
+
const RelayFeatureFlags = require('./RelayFeatureFlags');
|
|
25
|
+
const stableCopy = require('./stableCopy');
|
|
26
|
+
const {intern} = require('./StringInterner');
|
|
28
27
|
|
|
29
28
|
function getFragmentIdentifier(
|
|
30
29
|
fragmentNode: ReaderFragment,
|
|
@@ -43,6 +42,19 @@ function getFragmentIdentifier(
|
|
|
43
42
|
const dataIDs = getDataIDsFromFragment(fragmentNode, fragmentRef);
|
|
44
43
|
|
|
45
44
|
if (RelayFeatureFlags.ENABLE_GETFRAGMENTIDENTIFIER_OPTIMIZATION) {
|
|
45
|
+
let ids =
|
|
46
|
+
typeof dataIDs === 'undefined'
|
|
47
|
+
? 'missing'
|
|
48
|
+
: dataIDs == null
|
|
49
|
+
? 'null'
|
|
50
|
+
: Array.isArray(dataIDs)
|
|
51
|
+
? '[' + dataIDs.join(',') + ']'
|
|
52
|
+
: dataIDs;
|
|
53
|
+
ids =
|
|
54
|
+
RelayFeatureFlags.STRING_INTERN_LEVEL <= 1
|
|
55
|
+
? ids
|
|
56
|
+
: intern(ids, RelayFeatureFlags.MAX_DATA_ID_LENGTH);
|
|
57
|
+
|
|
46
58
|
return (
|
|
47
59
|
fragmentOwnerIdentifier +
|
|
48
60
|
'/' +
|
|
@@ -52,15 +64,15 @@ function getFragmentIdentifier(
|
|
|
52
64
|
? '{}'
|
|
53
65
|
: JSON.stringify(stableCopy(fragmentVariables))) +
|
|
54
66
|
'/' +
|
|
55
|
-
|
|
56
|
-
? 'missing'
|
|
57
|
-
: dataIDs == null
|
|
58
|
-
? 'null'
|
|
59
|
-
: Array.isArray(dataIDs)
|
|
60
|
-
? '[' + dataIDs.join(',') + ']'
|
|
61
|
-
: dataIDs)
|
|
67
|
+
ids
|
|
62
68
|
);
|
|
63
69
|
} else {
|
|
70
|
+
let ids = JSON.stringify(dataIDs) ?? 'missing';
|
|
71
|
+
ids =
|
|
72
|
+
RelayFeatureFlags.STRING_INTERN_LEVEL <= 1
|
|
73
|
+
? ids
|
|
74
|
+
: intern(ids, RelayFeatureFlags.MAX_DATA_ID_LENGTH);
|
|
75
|
+
|
|
64
76
|
return (
|
|
65
77
|
fragmentOwnerIdentifier +
|
|
66
78
|
'/' +
|
|
@@ -68,7 +80,7 @@ function getFragmentIdentifier(
|
|
|
68
80
|
'/' +
|
|
69
81
|
JSON.stringify(stableCopy(fragmentVariables)) +
|
|
70
82
|
'/' +
|
|
71
|
-
|
|
83
|
+
ids
|
|
72
84
|
);
|
|
73
85
|
}
|
|
74
86
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
|
|
14
14
|
'use strict';
|
|
15
15
|
|
|
16
|
-
const {REQUEST, SPLIT_OPERATION} = require('./RelayConcreteNode');
|
|
17
|
-
|
|
18
16
|
import type {
|
|
19
17
|
NormalizationOperation,
|
|
20
18
|
NormalizationRootNode,
|
|
21
19
|
NormalizationSplitOperation,
|
|
22
20
|
} from './NormalizationNode';
|
|
23
21
|
|
|
22
|
+
const {REQUEST, SPLIT_OPERATION} = require('./RelayConcreteNode');
|
|
23
|
+
|
|
24
24
|
/**
|
|
25
25
|
* OperationLoaders can return either a NormalizationSplitOperation or
|
|
26
26
|
* ConcreteRequest.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -13,15 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
'use strict';
|
|
15
15
|
|
|
16
|
+
import type {ReaderFragment, ReaderPaginationMetadata} from './ReaderNode';
|
|
17
|
+
import type {ConcreteRequest} from './RelayConcreteNode';
|
|
18
|
+
|
|
16
19
|
const getRefetchMetadata = require('./getRefetchMetadata');
|
|
17
20
|
const invariant = require('invariant');
|
|
18
21
|
|
|
19
|
-
import type {
|
|
20
|
-
ConcreteRequest,
|
|
21
|
-
ReaderFragment,
|
|
22
|
-
ReaderPaginationMetadata,
|
|
23
|
-
} from 'relay-runtime';
|
|
24
|
-
|
|
25
22
|
function getPaginationMetadata(
|
|
26
23
|
fragmentNode: ReaderFragment,
|
|
27
24
|
componentDisplayName: string,
|
|
@@ -32,10 +29,8 @@ function getPaginationMetadata(
|
|
|
32
29
|
paginationMetadata: ReaderPaginationMetadata,
|
|
33
30
|
stream: boolean,
|
|
34
31
|
|} {
|
|
35
|
-
const {
|
|
36
|
-
|
|
37
|
-
refetchMetadata,
|
|
38
|
-
} = getRefetchMetadata(fragmentNode, componentDisplayName);
|
|
32
|
+
const {refetchableRequest: paginationRequest, refetchMetadata} =
|
|
33
|
+
getRefetchMetadata(fragmentNode, componentDisplayName);
|
|
39
34
|
|
|
40
35
|
const paginationMetadata = refetchMetadata.connection;
|
|
41
36
|
invariant(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
'use strict';
|
|
15
15
|
|
|
16
|
-
const invariant = require('invariant');
|
|
17
|
-
const warning = require('warning');
|
|
18
|
-
|
|
19
16
|
import type {ReaderPaginationMetadata} from './ReaderNode';
|
|
20
17
|
import type {Variables} from './RelayRuntimeTypes';
|
|
21
18
|
|
|
19
|
+
const invariant = require('invariant');
|
|
20
|
+
const warning = require('warning');
|
|
21
|
+
|
|
22
22
|
export type Direction = 'forward' | 'backward';
|
|
23
23
|
|
|
24
24
|
function getPaginationVariables(
|
|
@@ -29,10 +29,8 @@ function getPaginationVariables(
|
|
|
29
29
|
extraVariables: Variables,
|
|
30
30
|
paginationMetadata: ReaderPaginationMetadata,
|
|
31
31
|
): {[string]: mixed, ...} {
|
|
32
|
-
const {
|
|
33
|
-
|
|
34
|
-
forward: forwardMetadata,
|
|
35
|
-
} = paginationMetadata;
|
|
32
|
+
const {backward: backwardMetadata, forward: forwardMetadata} =
|
|
33
|
+
paginationMetadata;
|
|
36
34
|
|
|
37
35
|
if (direction === 'backward') {
|
|
38
36
|
invariant(
|
|
@@ -56,7 +54,6 @@ function getPaginationVariables(
|
|
|
56
54
|
'determined by Relay.',
|
|
57
55
|
backwardMetadata.count,
|
|
58
56
|
);
|
|
59
|
-
// $FlowFixMe[cannot-spread-interface]
|
|
60
57
|
const paginationVariables = {
|
|
61
58
|
...baseVariables,
|
|
62
59
|
...extraVariables,
|
|
@@ -93,7 +90,6 @@ function getPaginationVariables(
|
|
|
93
90
|
'determined by Relay.',
|
|
94
91
|
forwardMetadata.count,
|
|
95
92
|
);
|
|
96
|
-
// $FlowFixMe[cannot-spread-interface]
|
|
97
93
|
const paginationVariables = {
|
|
98
94
|
...baseVariables,
|
|
99
95
|
...extraVariables,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
|
|
14
14
|
'use strict';
|
|
15
15
|
|
|
16
|
-
const {getPromiseForActiveRequest} = require('../query/fetchQueryInternal');
|
|
17
|
-
|
|
18
16
|
import type {IEnvironment, RequestDescriptor} from '../store/RelayStoreTypes';
|
|
19
17
|
import type {ReaderFragment} from './ReaderNode';
|
|
20
18
|
|
|
19
|
+
const {getPromiseForActiveRequest} = require('../query/fetchQueryInternal');
|
|
20
|
+
|
|
21
21
|
function getPendingOperationsForFragment(
|
|
22
22
|
environment: IEnvironment,
|
|
23
23
|
fragmentNode: ReaderFragment,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -13,13 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
'use strict';
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
import type {ReaderFragment, ReaderRefetchMetadata} from './ReaderNode';
|
|
17
|
+
import type {ConcreteRequest} from './RelayConcreteNode';
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
ConcreteRequest,
|
|
20
|
-
ReaderFragment,
|
|
21
|
-
ReaderRefetchMetadata,
|
|
22
|
-
} from 'relay-runtime';
|
|
19
|
+
const invariant = require('invariant');
|
|
23
20
|
|
|
24
21
|
function getRefetchMetadata(
|
|
25
22
|
fragmentNode: ReaderFragment,
|
|
@@ -51,11 +48,10 @@ function getRefetchMetadata(
|
|
|
51
48
|
);
|
|
52
49
|
|
|
53
50
|
// handle both commonjs and es modules
|
|
54
|
-
const refetchableRequest:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
: refetchMetadata.operation;
|
|
51
|
+
const refetchableRequest: ConcreteRequest | string =
|
|
52
|
+
(refetchMetadata: $FlowFixMe).operation.default
|
|
53
|
+
? (refetchMetadata: $FlowFixMe).operation.default
|
|
54
|
+
: refetchMetadata.operation;
|
|
59
55
|
const fragmentRefPathInResponse = refetchMetadata.fragmentPathInResult;
|
|
60
56
|
invariant(
|
|
61
57
|
typeof refetchableRequest !== 'string',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -12,9 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
const invariant = require('invariant');
|
|
16
|
-
|
|
17
15
|
const {DEFAULT_HANDLE_KEY} = require('./RelayDefaultHandleKey');
|
|
16
|
+
const invariant = require('invariant');
|
|
18
17
|
|
|
19
18
|
/**
|
|
20
19
|
* @internal
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
const invariant = require('invariant');
|
|
16
|
-
const stableCopy = require('./stableCopy');
|
|
17
|
-
|
|
18
15
|
import type {RequestParameters} from './RelayConcreteNode';
|
|
19
16
|
import type {Variables} from './RelayRuntimeTypes';
|
|
20
17
|
|
|
18
|
+
const stableCopy = require('./stableCopy');
|
|
19
|
+
const invariant = require('invariant');
|
|
20
|
+
|
|
21
21
|
export type RequestIdentifier = string;
|
|
22
22
|
|
|
23
23
|
/**
|
package/util/isPromise.js.flow
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -21,7 +21,7 @@ function resolveImmediate(callback: () => void) {
|
|
|
21
21
|
resolvedPromise.then(callback).catch(throwNext);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
function throwNext(error) {
|
|
24
|
+
function throwNext(error: $FlowFixMe) {
|
|
25
25
|
setTimeout(() => {
|
|
26
26
|
throw error;
|
|
27
27
|
}, 0);
|
package/util/stableCopy.js.flow
CHANGED