relay-runtime 11.0.2 → 13.0.0-rc.2
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/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 +1 -1
- package/index.js.flow +57 -35
- 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 +59 -44
- package/lib/multi-actor-environment/ActorIdentifier.js +12 -2
- package/lib/multi-actor-environment/ActorSpecificEnvironment.js +64 -20
- package/lib/multi-actor-environment/ActorUtils.js +27 -0
- package/lib/multi-actor-environment/MultiActorEnvironment.js +324 -61
- package/lib/multi-actor-environment/MultiActorEnvironmentTypes.js +1 -1
- package/lib/multi-actor-environment/index.js +6 -2
- 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 +19 -6
- package/lib/mutations/applyOptimisticMutation.js +7 -7
- package/lib/mutations/commitLocalUpdate.js +1 -1
- package/lib/mutations/commitMutation.js +15 -11
- package/lib/mutations/readUpdatableQuery_EXPERIMENTAL.js +242 -0
- package/lib/mutations/validateMutation.js +11 -6
- 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 +1 -1
- package/lib/network/RelayQueryResponseCache.js +22 -6
- package/lib/network/wrapNetworkWithLogObserver.js +79 -0
- 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 +124 -55
- package/lib/store/OperationExecutor.js +489 -215
- package/lib/store/RelayConcreteVariables.js +27 -9
- package/lib/store/RelayExperimentalGraphResponseHandler.js +153 -0
- package/lib/store/RelayExperimentalGraphResponseTransform.js +391 -0
- package/lib/store/RelayModernEnvironment.js +100 -120
- package/lib/store/RelayModernFragmentSpecResolver.js +53 -27
- package/lib/store/RelayModernOperationDescriptor.js +3 -2
- package/lib/store/RelayModernRecord.js +48 -13
- package/lib/store/RelayModernSelector.js +15 -9
- package/lib/store/RelayModernStore.js +56 -23
- package/lib/store/RelayOperationTracker.js +34 -24
- package/lib/store/RelayOptimisticRecordSource.js +1 -1
- package/lib/store/RelayPublishQueue.js +35 -11
- package/lib/store/RelayReader.js +257 -72
- package/lib/store/RelayRecordSource.js +88 -4
- package/lib/store/RelayRecordState.js +1 -1
- package/lib/store/RelayReferenceMarker.js +34 -22
- package/lib/store/RelayResponseNormalizer.js +172 -96
- package/lib/store/RelayStoreReactFlightUtils.js +5 -11
- package/lib/store/RelayStoreSubscriptions.js +15 -10
- package/lib/store/RelayStoreTypes.js +1 -1
- package/lib/store/RelayStoreUtils.js +13 -8
- package/lib/store/ResolverCache.js +213 -0
- package/lib/store/ResolverFragments.js +10 -6
- 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 +5 -3
- 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 +32 -34
- 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 +3 -1
- package/lib/util/RelayDefaultHandleKey.js +1 -1
- package/lib/util/RelayError.js +1 -1
- package/lib/util/RelayFeatureFlags.js +10 -7
- package/lib/util/RelayProfiler.js +1 -1
- package/lib/util/RelayReplaySubject.js +22 -7
- 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 +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 +3 -3
- package/lib/util/getRequestIdentifier.js +3 -3
- package/lib/util/getValueAtPath.js +51 -0
- package/lib/util/isEmptyObject.js +2 -2
- 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 +26 -0
- 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 +31 -0
- package/multi-actor-environment/ActorIdentifier.js.flow +18 -2
- package/multi-actor-environment/ActorSpecificEnvironment.js.flow +94 -58
- package/multi-actor-environment/ActorUtils.js.flow +33 -0
- package/multi-actor-environment/MultiActorEnvironment.js.flow +366 -93
- package/multi-actor-environment/MultiActorEnvironmentTypes.js.flow +88 -23
- package/multi-actor-environment/index.js.flow +3 -1
- package/mutations/RelayDeclarativeMutationConfig.js.flow +33 -27
- 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 +23 -8
- package/mutations/applyOptimisticMutation.js.flow +14 -15
- package/mutations/commitLocalUpdate.js.flow +2 -2
- package/mutations/commitMutation.js.flow +36 -47
- package/mutations/readUpdatableQuery_EXPERIMENTAL.js.flow +318 -0
- package/mutations/validateMutation.js.flow +27 -17
- 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 -2
- package/network/RelayQueryResponseCache.js.flow +35 -22
- package/network/wrapNetworkWithLogObserver.js.flow +99 -0
- 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 +2 -2
- package/store/ClientID.js.flow +15 -4
- package/store/DataChecker.js.flow +142 -60
- package/store/OperationExecutor.js.flow +575 -320
- package/store/RelayConcreteVariables.js.flow +28 -9
- package/store/RelayExperimentalGraphResponseHandler.js.flow +121 -0
- package/store/RelayExperimentalGraphResponseTransform.js.flow +470 -0
- package/store/RelayModernEnvironment.js.flow +91 -115
- package/store/RelayModernFragmentSpecResolver.js.flow +56 -32
- package/store/RelayModernOperationDescriptor.js.flow +13 -8
- package/store/RelayModernRecord.js.flow +68 -12
- package/store/RelayModernSelector.js.flow +25 -15
- package/store/RelayModernStore.js.flow +67 -32
- package/store/RelayOperationTracker.js.flow +60 -44
- package/store/RelayOptimisticRecordSource.js.flow +3 -3
- package/store/RelayPublishQueue.js.flow +74 -32
- package/store/RelayReader.js.flow +319 -100
- package/store/RelayRecordSource.js.flow +73 -7
- package/store/RelayRecordState.js.flow +1 -1
- package/store/RelayReferenceMarker.js.flow +41 -27
- package/store/RelayResponseNormalizer.js.flow +204 -86
- package/store/RelayStoreReactFlightUtils.js.flow +5 -12
- package/store/RelayStoreSubscriptions.js.flow +20 -12
- package/store/RelayStoreTypes.js.flow +200 -41
- package/store/RelayStoreUtils.js.flow +25 -12
- package/store/ResolverCache.js.flow +249 -0
- package/store/ResolverFragments.js.flow +16 -20
- 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 +4 -4
- 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 +55 -51
- package/util/JSResourceTypes.flow.js.flow +1 -1
- package/util/NormalizationNode.js.flow +11 -4
- package/util/ReaderNode.js.flow +25 -2
- package/util/RelayConcreteNode.js.flow +5 -1
- package/util/RelayDefaultHandleKey.js.flow +1 -1
- package/util/RelayError.js.flow +1 -1
- package/util/RelayFeatureFlags.js.flow +23 -15
- package/util/RelayProfiler.js.flow +1 -1
- package/util/RelayReplaySubject.js.flow +10 -10
- 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 +69 -0
- package/util/getPaginationVariables.js.flow +108 -0
- package/util/getPendingOperationsForFragment.js.flow +62 -0
- package/util/getRefetchMetadata.js.flow +76 -0
- package/util/getRelayHandleKey.js.flow +2 -3
- package/util/getRequestIdentifier.js.flow +4 -4
- package/util/getValueAtPath.js.flow +46 -0
- package/util/isEmptyObject.js.flow +2 -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 +33 -0
- 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 +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
|
@@ -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.
|
|
@@ -11,23 +11,32 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
import type {
|
|
14
|
+
import type {GraphQLResponse, PayloadData} from '../network/RelayNetworkTypes';
|
|
15
15
|
import type RelayObservable from '../network/RelayObservable';
|
|
16
|
+
import type RelayPublishQueue from '../store/RelayPublishQueue';
|
|
16
17
|
import type {
|
|
18
|
+
ExecuteMutationConfig,
|
|
19
|
+
IEnvironment,
|
|
20
|
+
MutationParameters,
|
|
17
21
|
OperationAvailability,
|
|
18
22
|
OperationDescriptor,
|
|
19
23
|
OptimisticResponseConfig,
|
|
20
24
|
OptimisticUpdateFunction,
|
|
25
|
+
RecordSourceProxy,
|
|
21
26
|
SelectorStoreUpdater,
|
|
22
27
|
SingularReaderSelector,
|
|
23
28
|
Snapshot,
|
|
24
29
|
StoreUpdater,
|
|
25
|
-
IEnvironment,
|
|
26
|
-
ExecuteMutationConfig,
|
|
27
30
|
} from '../store/RelayStoreTypes';
|
|
28
31
|
import type {Disposable} from '../util/RelayRuntimeTypes';
|
|
29
32
|
import type {ActorIdentifier} from './ActorIdentifier';
|
|
30
33
|
|
|
34
|
+
export type MultiActorStoreUpdater = (
|
|
35
|
+
actorIdentifier: ActorIdentifier,
|
|
36
|
+
environment: IActorEnvironment,
|
|
37
|
+
store: RecordSourceProxy,
|
|
38
|
+
) => void;
|
|
39
|
+
|
|
31
40
|
/**
|
|
32
41
|
* Interface of actor specific sub-environment
|
|
33
42
|
*/
|
|
@@ -42,6 +51,17 @@ export interface IActorEnvironment extends IEnvironment {
|
|
|
42
51
|
* Identifier of the actor for the current active environment
|
|
43
52
|
*/
|
|
44
53
|
+actorIdentifier: ActorIdentifier;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* TODO: this needs to move the the MultiActorEnvironment with different API.
|
|
57
|
+
*/
|
|
58
|
+
getPublishQueue(): RelayPublishQueue;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Optional. A human-readable identifier of the environment.
|
|
62
|
+
* This value should be visible in the dev tools.
|
|
63
|
+
*/
|
|
64
|
+
+configName: ?string;
|
|
45
65
|
}
|
|
46
66
|
|
|
47
67
|
/**
|
|
@@ -64,7 +84,7 @@ export interface IMultiActorEnvironment {
|
|
|
64
84
|
* selector.
|
|
65
85
|
*/
|
|
66
86
|
check(
|
|
67
|
-
|
|
87
|
+
actorEnvironment: IActorEnvironment,
|
|
68
88
|
operation: OperationDescriptor,
|
|
69
89
|
): OperationAvailability;
|
|
70
90
|
|
|
@@ -74,7 +94,7 @@ export interface IMultiActorEnvironment {
|
|
|
74
94
|
* the snapshot's selector to change.
|
|
75
95
|
*/
|
|
76
96
|
subscribe(
|
|
77
|
-
|
|
97
|
+
actorEnvironment: IActorEnvironment,
|
|
78
98
|
snapshot: Snapshot,
|
|
79
99
|
callback: (snapshot: Snapshot) => void,
|
|
80
100
|
): Disposable;
|
|
@@ -85,7 +105,7 @@ export interface IMultiActorEnvironment {
|
|
|
85
105
|
* until the returned reference is disposed.
|
|
86
106
|
*/
|
|
87
107
|
retain(
|
|
88
|
-
|
|
108
|
+
actorEnvironment: IActorEnvironment,
|
|
89
109
|
operation: OperationDescriptor,
|
|
90
110
|
): Disposable;
|
|
91
111
|
|
|
@@ -94,17 +114,34 @@ export interface IMultiActorEnvironment {
|
|
|
94
114
|
* by calling `dispose()` on the returned value.
|
|
95
115
|
*/
|
|
96
116
|
applyUpdate(
|
|
97
|
-
|
|
117
|
+
actorEnvironment: IActorEnvironment,
|
|
98
118
|
optimisticUpdate: OptimisticUpdateFunction,
|
|
99
119
|
): Disposable;
|
|
100
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Revert updates for the `update` function.
|
|
123
|
+
*/
|
|
124
|
+
revertUpdate(
|
|
125
|
+
actorEnvironment: IActorEnvironment,
|
|
126
|
+
update: OptimisticUpdateFunction,
|
|
127
|
+
): void;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Revert updates for the `update` function, and apply the `replacement` update.
|
|
131
|
+
*/
|
|
132
|
+
replaceUpdate(
|
|
133
|
+
actorEnvironment: IActorEnvironment,
|
|
134
|
+
update: OptimisticUpdateFunction,
|
|
135
|
+
replacement: OptimisticUpdateFunction,
|
|
136
|
+
): void;
|
|
137
|
+
|
|
101
138
|
/**
|
|
102
139
|
* Apply an optimistic mutation response and/or updater. The mutation can be
|
|
103
140
|
* reverted by calling `dispose()` on the returned value.
|
|
104
141
|
*/
|
|
105
|
-
applyMutation(
|
|
106
|
-
|
|
107
|
-
optimisticConfig: OptimisticResponseConfig
|
|
142
|
+
applyMutation<TMutation: MutationParameters>(
|
|
143
|
+
actorEnvironment: IActorEnvironment,
|
|
144
|
+
optimisticConfig: OptimisticResponseConfig<TMutation>,
|
|
108
145
|
): Disposable;
|
|
109
146
|
|
|
110
147
|
/**
|
|
@@ -112,13 +149,21 @@ export interface IMultiActorEnvironment {
|
|
|
112
149
|
* should therefore not be used for optimistic updates. This is mainly
|
|
113
150
|
* intended for updating fields from client schema extensions.
|
|
114
151
|
*/
|
|
115
|
-
commitUpdate(
|
|
152
|
+
commitUpdate(
|
|
153
|
+
actorEnvironment: IActorEnvironment,
|
|
154
|
+
updater: StoreUpdater,
|
|
155
|
+
): void;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Commit store updates for each actor-specific environment known to MultiActorEnvironment
|
|
159
|
+
*/
|
|
160
|
+
commitMultiActorUpdate(updater: MultiActorStoreUpdater): void;
|
|
116
161
|
|
|
117
162
|
/**
|
|
118
163
|
* Commit a payload to the environment using the given operation selector.
|
|
119
164
|
*/
|
|
120
165
|
commitPayload(
|
|
121
|
-
|
|
166
|
+
actorEnvironment: IActorEnvironment,
|
|
122
167
|
operationDescriptor: OperationDescriptor,
|
|
123
168
|
payload: PayloadData,
|
|
124
169
|
): void;
|
|
@@ -127,7 +172,7 @@ export interface IMultiActorEnvironment {
|
|
|
127
172
|
* Read the results of a selector from in-memory records in the store.
|
|
128
173
|
*/
|
|
129
174
|
lookup(
|
|
130
|
-
|
|
175
|
+
actorEnvironment: IActorEnvironment,
|
|
131
176
|
selector: SingularReaderSelector,
|
|
132
177
|
): Snapshot;
|
|
133
178
|
|
|
@@ -136,17 +181,32 @@ export interface IMultiActorEnvironment {
|
|
|
136
181
|
* responses may be returned (via `next`) over time followed by either
|
|
137
182
|
* the request completing (`completed`) or an error (`error`).
|
|
138
183
|
*
|
|
184
|
+
* Note: Observables are lazy, so calling this method will do nothing until
|
|
185
|
+
* the result is subscribed to: environment.execute({...}).subscribe({...}).
|
|
186
|
+
*/
|
|
187
|
+
execute(
|
|
188
|
+
actorEnvironment: IActorEnvironment,
|
|
189
|
+
config: {
|
|
190
|
+
operation: OperationDescriptor,
|
|
191
|
+
},
|
|
192
|
+
): RelayObservable<GraphQLResponse>;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Send a subscription to the server with Observer semantics: one or more
|
|
196
|
+
* responses may be returned (via `next`) over time followed by either
|
|
197
|
+
* the request completing (`completed`) or an error (`error`).
|
|
198
|
+
*
|
|
139
199
|
* Networks/servers that support subscriptions may choose to hold the
|
|
140
200
|
* subscription open indefinitely such that `complete` is not called.
|
|
141
201
|
*
|
|
142
202
|
* Note: Observables are lazy, so calling this method will do nothing until
|
|
143
|
-
* the result is subscribed to: environment.
|
|
203
|
+
* the result is subscribed to: environment.executeSubscription({...}).subscribe({...}).
|
|
144
204
|
*/
|
|
145
|
-
|
|
146
|
-
|
|
205
|
+
executeSubscription<TMutation: MutationParameters>(
|
|
206
|
+
actorEnvironment: IActorEnvironment,
|
|
147
207
|
config: {
|
|
148
208
|
operation: OperationDescriptor,
|
|
149
|
-
updater?: ?SelectorStoreUpdater
|
|
209
|
+
updater?: ?SelectorStoreUpdater<TMutation['response']>,
|
|
150
210
|
},
|
|
151
211
|
): RelayObservable<GraphQLResponse>;
|
|
152
212
|
|
|
@@ -160,9 +220,9 @@ export interface IMultiActorEnvironment {
|
|
|
160
220
|
* the result is subscribed to:
|
|
161
221
|
* environment.executeMutation({...}).subscribe({...}).
|
|
162
222
|
*/
|
|
163
|
-
executeMutation(
|
|
164
|
-
|
|
165
|
-
config: ExecuteMutationConfig
|
|
223
|
+
executeMutation<TMutation: MutationParameters>(
|
|
224
|
+
actorEnvironment: IActorEnvironment,
|
|
225
|
+
config: ExecuteMutationConfig<TMutation>,
|
|
166
226
|
): RelayObservable<GraphQLResponse>;
|
|
167
227
|
|
|
168
228
|
/**
|
|
@@ -175,7 +235,7 @@ export interface IMultiActorEnvironment {
|
|
|
175
235
|
* environment.executeWithSource({...}).subscribe({...}).
|
|
176
236
|
*/
|
|
177
237
|
executeWithSource(
|
|
178
|
-
|
|
238
|
+
actorEnvironment: IActorEnvironment,
|
|
179
239
|
{
|
|
180
240
|
operation: OperationDescriptor,
|
|
181
241
|
source: RelayObservable<GraphQLResponse>,
|
|
@@ -190,7 +250,12 @@ export interface IMultiActorEnvironment {
|
|
|
190
250
|
* active GraphQL subscription
|
|
191
251
|
*/
|
|
192
252
|
isRequestActive(
|
|
193
|
-
|
|
253
|
+
actorEnvironment: IActorEnvironment,
|
|
194
254
|
requestIdentifier: string,
|
|
195
255
|
): boolean;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Returns `true` if execute in the server environment
|
|
259
|
+
*/
|
|
260
|
+
isServer(): boolean;
|
|
196
261
|
}
|
|
@@ -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.
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
const {getActorIdentifier} = require('./ActorIdentifier');
|
|
14
15
|
const MultiActorEnvironment = require('./MultiActorEnvironment');
|
|
15
16
|
|
|
16
17
|
export type {ActorIdentifier} from './ActorIdentifier';
|
|
@@ -21,4 +22,5 @@ export type {
|
|
|
21
22
|
|
|
22
23
|
module.exports = {
|
|
23
24
|
MultiActorEnvironment,
|
|
25
|
+
getActorIdentifier,
|
|
24
26
|
};
|
|
@@ -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,11 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
const ConnectionHandler = require('../handlers/connection/ConnectionHandler');
|
|
16
|
-
|
|
17
|
-
const warning = require('warning');
|
|
18
|
-
|
|
19
15
|
import type {
|
|
16
|
+
MutationParameters,
|
|
20
17
|
RecordSourceSelectorProxy,
|
|
21
18
|
SelectorData,
|
|
22
19
|
SelectorStoreUpdater,
|
|
@@ -24,6 +21,9 @@ import type {
|
|
|
24
21
|
import type {ConcreteRequest} from '../util/RelayConcreteNode';
|
|
25
22
|
import type {Variables} from '../util/RelayRuntimeTypes';
|
|
26
23
|
|
|
24
|
+
const ConnectionHandler = require('../handlers/connection/ConnectionHandler');
|
|
25
|
+
const warning = require('warning');
|
|
26
|
+
|
|
27
27
|
const MutationTypes = Object.freeze({
|
|
28
28
|
RANGE_ADD: 'RANGE_ADD',
|
|
29
29
|
RANGE_DELETE: 'RANGE_DELETE',
|
|
@@ -39,7 +39,7 @@ export type RangeOperation = $Values<typeof RangeOperations>;
|
|
|
39
39
|
|
|
40
40
|
type RangeBehaviorsFunction = (connectionArgs: {
|
|
41
41
|
[name: string]: $FlowFixMe,
|
|
42
|
-
|
|
42
|
+
...
|
|
43
43
|
}) => RangeOperation;
|
|
44
44
|
type RangeBehaviorsObject = {[key: string]: RangeOperation, ...};
|
|
45
45
|
export type RangeBehaviors = RangeBehaviorsFunction | RangeBehaviorsObject;
|
|
@@ -84,18 +84,21 @@ export type DeclarativeMutationConfig =
|
|
|
84
84
|
| RangeDeleteConfig
|
|
85
85
|
| NodeDeleteConfig;
|
|
86
86
|
|
|
87
|
-
function convert(
|
|
87
|
+
function convert<TMutation: MutationParameters>(
|
|
88
88
|
configs: Array<DeclarativeMutationConfig>,
|
|
89
89
|
request: ConcreteRequest,
|
|
90
|
-
optimisticUpdater?: ?SelectorStoreUpdater
|
|
91
|
-
updater?: ?SelectorStoreUpdater
|
|
90
|
+
optimisticUpdater?: ?SelectorStoreUpdater<TMutation['response']>,
|
|
91
|
+
updater?: ?SelectorStoreUpdater<TMutation['response']>,
|
|
92
92
|
): {
|
|
93
|
-
optimisticUpdater: SelectorStoreUpdater
|
|
94
|
-
updater: SelectorStoreUpdater
|
|
93
|
+
optimisticUpdater: SelectorStoreUpdater<TMutation['response']>,
|
|
94
|
+
updater: SelectorStoreUpdater<TMutation['response']>,
|
|
95
95
|
...
|
|
96
96
|
} {
|
|
97
|
-
const configOptimisticUpdates
|
|
98
|
-
|
|
97
|
+
const configOptimisticUpdates: Array<
|
|
98
|
+
SelectorStoreUpdater<TMutation['response']>,
|
|
99
|
+
> = optimisticUpdater ? [optimisticUpdater] : [];
|
|
100
|
+
const configUpdates: Array<SelectorStoreUpdater<TMutation['response']>> =
|
|
101
|
+
updater ? [updater] : [];
|
|
99
102
|
configs.forEach(config => {
|
|
100
103
|
switch (config.type) {
|
|
101
104
|
case 'NODE_DELETE':
|
|
@@ -124,13 +127,16 @@ function convert(
|
|
|
124
127
|
return {
|
|
125
128
|
optimisticUpdater: (
|
|
126
129
|
store: RecordSourceSelectorProxy,
|
|
127
|
-
data: ?
|
|
130
|
+
data: ?TMutation['response'],
|
|
128
131
|
) => {
|
|
129
132
|
configOptimisticUpdates.forEach(eachOptimisticUpdater => {
|
|
130
133
|
eachOptimisticUpdater(store, data);
|
|
131
134
|
});
|
|
132
135
|
},
|
|
133
|
-
updater: (
|
|
136
|
+
updater: (
|
|
137
|
+
store: RecordSourceSelectorProxy,
|
|
138
|
+
data: ?TMutation['response'],
|
|
139
|
+
) => {
|
|
134
140
|
configUpdates.forEach(eachUpdater => {
|
|
135
141
|
eachUpdater(store, data);
|
|
136
142
|
});
|
|
@@ -141,13 +147,13 @@ function convert(
|
|
|
141
147
|
function nodeDelete(
|
|
142
148
|
config: NodeDeleteConfig,
|
|
143
149
|
request: ConcreteRequest,
|
|
144
|
-
): ?SelectorStoreUpdater {
|
|
150
|
+
): ?SelectorStoreUpdater<mixed> {
|
|
145
151
|
const {deletedIDFieldName} = config;
|
|
146
152
|
const rootField = getRootField(request);
|
|
147
153
|
if (!rootField) {
|
|
148
154
|
return null;
|
|
149
155
|
}
|
|
150
|
-
return (store: RecordSourceSelectorProxy, data: ?
|
|
156
|
+
return (store: RecordSourceSelectorProxy, data: ?mixed) => {
|
|
151
157
|
const payload = store.getRootField(rootField);
|
|
152
158
|
if (!payload) {
|
|
153
159
|
return;
|
|
@@ -165,7 +171,7 @@ function nodeDelete(
|
|
|
165
171
|
function rangeAdd(
|
|
166
172
|
config: RangeAddConfig,
|
|
167
173
|
request: ConcreteRequest,
|
|
168
|
-
): ?SelectorStoreUpdater {
|
|
174
|
+
): ?SelectorStoreUpdater<mixed> {
|
|
169
175
|
const {parentID, connectionInfo, edgeName} = config;
|
|
170
176
|
if (!parentID) {
|
|
171
177
|
warning(
|
|
@@ -179,7 +185,7 @@ function rangeAdd(
|
|
|
179
185
|
if (!connectionInfo || !rootField) {
|
|
180
186
|
return null;
|
|
181
187
|
}
|
|
182
|
-
return (store: RecordSourceSelectorProxy, data: ?
|
|
188
|
+
return (store: RecordSourceSelectorProxy, data: ?mixed) => {
|
|
183
189
|
const parent = store.get(parentID);
|
|
184
190
|
if (!parent) {
|
|
185
191
|
return;
|
|
@@ -233,13 +239,9 @@ function rangeAdd(
|
|
|
233
239
|
function rangeDelete(
|
|
234
240
|
config: RangeDeleteConfig,
|
|
235
241
|
request: ConcreteRequest,
|
|
236
|
-
): ?SelectorStoreUpdater {
|
|
237
|
-
const {
|
|
238
|
-
|
|
239
|
-
connectionKeys,
|
|
240
|
-
pathToConnection,
|
|
241
|
-
deletedIDFieldName,
|
|
242
|
-
} = config;
|
|
242
|
+
): ?SelectorStoreUpdater<mixed> {
|
|
243
|
+
const {parentID, connectionKeys, pathToConnection, deletedIDFieldName} =
|
|
244
|
+
config;
|
|
243
245
|
if (!parentID) {
|
|
244
246
|
warning(
|
|
245
247
|
false,
|
|
@@ -252,12 +254,16 @@ function rangeDelete(
|
|
|
252
254
|
if (!rootField) {
|
|
253
255
|
return null;
|
|
254
256
|
}
|
|
255
|
-
return (store: RecordSourceSelectorProxy, data: ?
|
|
257
|
+
return (store: RecordSourceSelectorProxy, data: ?mixed) => {
|
|
256
258
|
if (!data) {
|
|
257
259
|
return;
|
|
258
260
|
}
|
|
259
261
|
const deleteIDs = [];
|
|
262
|
+
// the type of data should come from a type parameter associated with ConcreteRequest,
|
|
263
|
+
// but ConcreteRequest does not contain a type parameter. Hence, we use a FlowFixMe.
|
|
264
|
+
// $FlowFixMe[incompatible-use] see above
|
|
260
265
|
let deletedIDField = data[rootField];
|
|
266
|
+
|
|
261
267
|
if (deletedIDField && Array.isArray(deletedIDFieldName)) {
|
|
262
268
|
for (const eachField of deletedIDFieldName) {
|
|
263
269
|
if (deletedIDField && typeof deletedIDField === 'object') {
|
|
@@ -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,17 +12,16 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
const invariant = require('invariant');
|
|
16
|
-
|
|
17
|
-
const {generateClientID} = require('../store/ClientID');
|
|
18
|
-
const {getStableStorageKey} = require('../store/RelayStoreUtils');
|
|
19
|
-
|
|
20
15
|
import type {RecordProxy} from '../store/RelayStoreTypes';
|
|
21
16
|
import type {Arguments} from '../store/RelayStoreUtils';
|
|
22
17
|
import type {DataID} from '../util/RelayRuntimeTypes';
|
|
23
18
|
import type RelayRecordSourceMutator from './RelayRecordSourceMutator';
|
|
24
19
|
import type RelayRecordSourceProxy from './RelayRecordSourceProxy';
|
|
25
20
|
|
|
21
|
+
const {generateClientID} = require('../store/ClientID');
|
|
22
|
+
const {getStableStorageKey} = require('../store/RelayStoreUtils');
|
|
23
|
+
const invariant = require('invariant');
|
|
24
|
+
|
|
26
25
|
/**
|
|
27
26
|
* @internal
|
|
28
27
|
*
|
|
@@ -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,6 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
const RelayModernRecord = require('../store/RelayModernRecord');
|
|
16
|
-
|
|
17
|
-
const invariant = require('invariant');
|
|
18
|
-
|
|
19
|
-
const {EXISTENT} = require('../store/RelayRecordState');
|
|
20
|
-
|
|
21
15
|
import type {RecordState} from '../store/RelayRecordState';
|
|
22
16
|
import type {
|
|
23
17
|
MutableRecordSource,
|
|
@@ -26,6 +20,10 @@ import type {
|
|
|
26
20
|
} from '../store/RelayStoreTypes';
|
|
27
21
|
import type {DataID} from '../util/RelayRuntimeTypes';
|
|
28
22
|
|
|
23
|
+
const RelayModernRecord = require('../store/RelayModernRecord');
|
|
24
|
+
const {EXISTENT} = require('../store/RelayRecordState');
|
|
25
|
+
const invariant = require('invariant');
|
|
26
|
+
|
|
29
27
|
/**
|
|
30
28
|
* @internal
|
|
31
29
|
*
|
|
@@ -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,26 +12,28 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
const RelayModernRecord = require('../store/RelayModernRecord');
|
|
16
|
-
const RelayRecordProxy = require('./RelayRecordProxy');
|
|
17
|
-
|
|
18
|
-
const invariant = require('invariant');
|
|
19
|
-
|
|
20
|
-
const {EXISTENT, NONEXISTENT} = require('../store/RelayRecordState');
|
|
21
|
-
const {ROOT_ID, ROOT_TYPE} = require('../store/RelayStoreUtils');
|
|
22
|
-
|
|
23
15
|
import type {HandlerProvider} from '../handlers/RelayDefaultHandlerProvider';
|
|
16
|
+
import type {GraphQLTaggedNode} from '../query/GraphQLTag';
|
|
24
17
|
import type {GetDataID} from '../store/RelayResponseNormalizer';
|
|
25
18
|
import type {
|
|
26
19
|
DataIDSet,
|
|
27
20
|
HandleFieldPayload,
|
|
28
|
-
RecordSource,
|
|
29
21
|
RecordProxy,
|
|
22
|
+
RecordSource,
|
|
30
23
|
RecordSourceProxy,
|
|
31
24
|
} from '../store/RelayStoreTypes';
|
|
32
|
-
import type {DataID} from '../util/RelayRuntimeTypes';
|
|
25
|
+
import type {DataID, OperationType} from '../util/RelayRuntimeTypes';
|
|
33
26
|
import type RelayRecordSourceMutator from './RelayRecordSourceMutator';
|
|
34
27
|
|
|
28
|
+
const RelayModernRecord = require('../store/RelayModernRecord');
|
|
29
|
+
const {EXISTENT, NONEXISTENT} = require('../store/RelayRecordState');
|
|
30
|
+
const {ROOT_ID, ROOT_TYPE} = require('../store/RelayStoreUtils');
|
|
31
|
+
const {
|
|
32
|
+
readUpdatableQuery_EXPERIMENTAL,
|
|
33
|
+
} = require('./readUpdatableQuery_EXPERIMENTAL');
|
|
34
|
+
const RelayRecordProxy = require('./RelayRecordProxy');
|
|
35
|
+
const invariant = require('invariant');
|
|
36
|
+
|
|
35
37
|
/**
|
|
36
38
|
* @internal
|
|
37
39
|
*
|
|
@@ -160,6 +162,13 @@ class RelayRecordSourceProxy implements RecordSourceProxy {
|
|
|
160
162
|
getIDsMarkedForInvalidation(): DataIDSet {
|
|
161
163
|
return this._idsMarkedForInvalidation;
|
|
162
164
|
}
|
|
165
|
+
|
|
166
|
+
readUpdatableQuery_EXPERIMENTAL<TQuery: OperationType>(
|
|
167
|
+
query: GraphQLTaggedNode,
|
|
168
|
+
variables: TQuery['variables'],
|
|
169
|
+
): TQuery['response'] {
|
|
170
|
+
return readUpdatableQuery_EXPERIMENTAL(query, variables, this);
|
|
171
|
+
}
|
|
163
172
|
}
|
|
164
173
|
|
|
165
174
|
module.exports = RelayRecordSourceProxy;
|
|
@@ -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,10 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const {getStorageKey, ROOT_TYPE} = require('../store/RelayStoreUtils');
|
|
18
|
-
|
|
15
|
+
import type {GraphQLTaggedNode} from '../query/GraphQLTag';
|
|
19
16
|
import type {
|
|
20
17
|
RecordProxy,
|
|
21
18
|
RecordSourceProxy,
|
|
@@ -23,9 +20,15 @@ import type {
|
|
|
23
20
|
SingularReaderSelector,
|
|
24
21
|
} from '../store/RelayStoreTypes';
|
|
25
22
|
import type {ReaderLinkedField} from '../util/ReaderNode';
|
|
26
|
-
import type {DataID} from '../util/RelayRuntimeTypes';
|
|
23
|
+
import type {DataID, OperationType} from '../util/RelayRuntimeTypes';
|
|
27
24
|
import type RelayRecordSourceMutator from './RelayRecordSourceMutator';
|
|
28
25
|
|
|
26
|
+
const {ROOT_TYPE, getStorageKey} = require('../store/RelayStoreUtils');
|
|
27
|
+
const {
|
|
28
|
+
readUpdatableQuery_EXPERIMENTAL,
|
|
29
|
+
} = require('./readUpdatableQuery_EXPERIMENTAL');
|
|
30
|
+
const invariant = require('invariant');
|
|
31
|
+
|
|
29
32
|
/**
|
|
30
33
|
* @internal
|
|
31
34
|
*
|
|
@@ -78,10 +81,15 @@ class RelayRecordSourceSelectorProxy implements RecordSourceSelectorProxy {
|
|
|
78
81
|
fieldName: string,
|
|
79
82
|
plural: boolean,
|
|
80
83
|
): ReaderLinkedField {
|
|
81
|
-
|
|
84
|
+
let field = selector.node.selections.find(
|
|
82
85
|
selection =>
|
|
83
|
-
selection.kind === 'LinkedField' && selection.name === fieldName
|
|
86
|
+
(selection.kind === 'LinkedField' && selection.name === fieldName) ||
|
|
87
|
+
(selection.kind === 'RequiredField' &&
|
|
88
|
+
selection.field.name === fieldName),
|
|
84
89
|
);
|
|
90
|
+
if (field && field.kind === 'RequiredField') {
|
|
91
|
+
field = field.field;
|
|
92
|
+
}
|
|
85
93
|
invariant(
|
|
86
94
|
field && field.kind === 'LinkedField',
|
|
87
95
|
'RelayRecordSourceSelectorProxy#getRootField(): Cannot find root ' +
|
|
@@ -114,6 +122,13 @@ class RelayRecordSourceSelectorProxy implements RecordSourceSelectorProxy {
|
|
|
114
122
|
invalidateStore(): void {
|
|
115
123
|
this.__recordSource.invalidateStore();
|
|
116
124
|
}
|
|
125
|
+
|
|
126
|
+
readUpdatableQuery_EXPERIMENTAL<TQuery: OperationType>(
|
|
127
|
+
query: GraphQLTaggedNode,
|
|
128
|
+
variables: TQuery['variables'],
|
|
129
|
+
): TQuery['response'] {
|
|
130
|
+
return readUpdatableQuery_EXPERIMENTAL(query, variables, this);
|
|
131
|
+
}
|
|
117
132
|
}
|
|
118
133
|
|
|
119
134
|
module.exports = RelayRecordSourceSelectorProxy;
|
|
@@ -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,29 +12,28 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
const RelayDeclarativeMutationConfig = require('./RelayDeclarativeMutationConfig');
|
|
16
|
-
|
|
17
|
-
const invariant = require('invariant');
|
|
18
|
-
const isRelayModernEnvironment = require('../store/isRelayModernEnvironment');
|
|
19
|
-
|
|
20
|
-
const {getRequest} = require('../query/GraphQLTag');
|
|
21
|
-
const {
|
|
22
|
-
createOperationDescriptor,
|
|
23
|
-
} = require('../store/RelayModernOperationDescriptor');
|
|
24
|
-
|
|
25
15
|
import type {GraphQLTaggedNode} from '../query/GraphQLTag';
|
|
26
16
|
import type {
|
|
27
17
|
IEnvironment,
|
|
18
|
+
MutationParameters,
|
|
28
19
|
SelectorStoreUpdater,
|
|
29
20
|
} from '../store/RelayStoreTypes';
|
|
30
21
|
import type {Disposable, Variables} from '../util/RelayRuntimeTypes';
|
|
31
22
|
import type {DeclarativeMutationConfig} from './RelayDeclarativeMutationConfig';
|
|
32
23
|
|
|
33
|
-
|
|
24
|
+
const {getRequest} = require('../query/GraphQLTag');
|
|
25
|
+
const isRelayModernEnvironment = require('../store/isRelayModernEnvironment');
|
|
26
|
+
const {
|
|
27
|
+
createOperationDescriptor,
|
|
28
|
+
} = require('../store/RelayModernOperationDescriptor');
|
|
29
|
+
const RelayDeclarativeMutationConfig = require('./RelayDeclarativeMutationConfig');
|
|
30
|
+
const invariant = require('invariant');
|
|
31
|
+
|
|
32
|
+
export type OptimisticMutationConfig<TMutation: MutationParameters> = {|
|
|
34
33
|
configs?: ?Array<DeclarativeMutationConfig>,
|
|
35
34
|
mutation: GraphQLTaggedNode,
|
|
36
35
|
variables: Variables,
|
|
37
|
-
optimisticUpdater?: ?SelectorStoreUpdater
|
|
36
|
+
optimisticUpdater?: ?SelectorStoreUpdater<TMutation['response']>,
|
|
38
37
|
optimisticResponse?: Object,
|
|
39
38
|
|};
|
|
40
39
|
|
|
@@ -42,9 +41,9 @@ export type OptimisticMutationConfig = {|
|
|
|
42
41
|
* Higher-level helper function to execute a mutation against a specific
|
|
43
42
|
* environment.
|
|
44
43
|
*/
|
|
45
|
-
function applyOptimisticMutation(
|
|
44
|
+
function applyOptimisticMutation<TMutation: MutationParameters>(
|
|
46
45
|
environment: IEnvironment,
|
|
47
|
-
config: OptimisticMutationConfig
|
|
46
|
+
config: OptimisticMutationConfig<TMutation>,
|
|
48
47
|
): Disposable {
|
|
49
48
|
invariant(
|
|
50
49
|
isRelayModernEnvironment(environment),
|
|
@@ -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,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
import type {
|
|
15
|
+
import type {IEnvironment, StoreUpdater} from '../store/RelayStoreTypes';
|
|
16
16
|
|
|
17
17
|
function commitLocalUpdate(
|
|
18
18
|
environment: IEnvironment,
|