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.
Files changed (219) hide show
  1. package/README.md +67 -0
  2. package/handlers/RelayDefaultHandlerProvider.js.flow +3 -3
  3. package/handlers/connection/ConnectionHandler.js.flow +9 -18
  4. package/handlers/connection/ConnectionInterface.js.flow +1 -1
  5. package/handlers/connection/MutationHandlers.js.flow +8 -12
  6. package/index.js +1 -1
  7. package/index.js.flow +57 -35
  8. package/lib/handlers/RelayDefaultHandlerProvider.js +1 -1
  9. package/lib/handlers/connection/ConnectionHandler.js +13 -19
  10. package/lib/handlers/connection/ConnectionInterface.js +1 -1
  11. package/lib/handlers/connection/MutationHandlers.js +4 -7
  12. package/lib/index.js +59 -44
  13. package/lib/multi-actor-environment/ActorIdentifier.js +12 -2
  14. package/lib/multi-actor-environment/ActorSpecificEnvironment.js +64 -20
  15. package/lib/multi-actor-environment/ActorUtils.js +27 -0
  16. package/lib/multi-actor-environment/MultiActorEnvironment.js +324 -61
  17. package/lib/multi-actor-environment/MultiActorEnvironmentTypes.js +1 -1
  18. package/lib/multi-actor-environment/index.js +6 -2
  19. package/lib/mutations/RelayDeclarativeMutationConfig.js +5 -2
  20. package/lib/mutations/RelayRecordProxy.js +4 -3
  21. package/lib/mutations/RelayRecordSourceMutator.js +4 -3
  22. package/lib/mutations/RelayRecordSourceProxy.js +13 -5
  23. package/lib/mutations/RelayRecordSourceSelectorProxy.js +19 -6
  24. package/lib/mutations/applyOptimisticMutation.js +7 -7
  25. package/lib/mutations/commitLocalUpdate.js +1 -1
  26. package/lib/mutations/commitMutation.js +15 -11
  27. package/lib/mutations/readUpdatableQuery_EXPERIMENTAL.js +242 -0
  28. package/lib/mutations/validateMutation.js +11 -6
  29. package/lib/network/ConvertToExecuteFunction.js +3 -2
  30. package/lib/network/RelayNetwork.js +4 -3
  31. package/lib/network/RelayNetworkTypes.js +1 -1
  32. package/lib/network/RelayObservable.js +1 -1
  33. package/lib/network/RelayQueryResponseCache.js +22 -6
  34. package/lib/network/wrapNetworkWithLogObserver.js +79 -0
  35. package/lib/query/GraphQLTag.js +3 -2
  36. package/lib/query/PreloadableQueryRegistry.js +1 -1
  37. package/lib/query/fetchQuery.js +7 -6
  38. package/lib/query/fetchQueryInternal.js +1 -1
  39. package/lib/query/fetchQuery_DEPRECATED.js +3 -2
  40. package/lib/store/ClientID.js +8 -2
  41. package/lib/store/DataChecker.js +124 -55
  42. package/lib/store/OperationExecutor.js +489 -215
  43. package/lib/store/RelayConcreteVariables.js +27 -9
  44. package/lib/store/RelayExperimentalGraphResponseHandler.js +153 -0
  45. package/lib/store/RelayExperimentalGraphResponseTransform.js +391 -0
  46. package/lib/store/RelayModernEnvironment.js +100 -120
  47. package/lib/store/RelayModernFragmentSpecResolver.js +53 -27
  48. package/lib/store/RelayModernOperationDescriptor.js +3 -2
  49. package/lib/store/RelayModernRecord.js +48 -13
  50. package/lib/store/RelayModernSelector.js +15 -9
  51. package/lib/store/RelayModernStore.js +56 -23
  52. package/lib/store/RelayOperationTracker.js +34 -24
  53. package/lib/store/RelayOptimisticRecordSource.js +1 -1
  54. package/lib/store/RelayPublishQueue.js +35 -11
  55. package/lib/store/RelayReader.js +257 -72
  56. package/lib/store/RelayRecordSource.js +88 -4
  57. package/lib/store/RelayRecordState.js +1 -1
  58. package/lib/store/RelayReferenceMarker.js +34 -22
  59. package/lib/store/RelayResponseNormalizer.js +172 -96
  60. package/lib/store/RelayStoreReactFlightUtils.js +5 -11
  61. package/lib/store/RelayStoreSubscriptions.js +15 -10
  62. package/lib/store/RelayStoreTypes.js +1 -1
  63. package/lib/store/RelayStoreUtils.js +13 -8
  64. package/lib/store/ResolverCache.js +213 -0
  65. package/lib/store/ResolverFragments.js +10 -6
  66. package/lib/store/StoreInspector.js +1 -1
  67. package/lib/store/TypeID.js +1 -1
  68. package/lib/store/ViewerPattern.js +1 -1
  69. package/lib/store/cloneRelayHandleSourceField.js +6 -5
  70. package/lib/store/cloneRelayScalarHandleSourceField.js +6 -5
  71. package/lib/store/createFragmentSpecResolver.js +1 -1
  72. package/lib/store/createRelayContext.js +5 -3
  73. package/lib/store/defaultGetDataID.js +1 -1
  74. package/lib/store/defaultRequiredFieldLogger.js +1 -1
  75. package/lib/store/hasOverlappingIDs.js +1 -1
  76. package/lib/store/isRelayModernEnvironment.js +1 -1
  77. package/lib/store/normalizeRelayPayload.js +1 -1
  78. package/lib/store/readInlineData.js +7 -3
  79. package/lib/subscription/requestSubscription.js +32 -34
  80. package/lib/util/JSResourceTypes.flow.js +1 -1
  81. package/lib/util/NormalizationNode.js +1 -1
  82. package/lib/util/ReaderNode.js +1 -1
  83. package/lib/util/RelayConcreteNode.js +3 -1
  84. package/lib/util/RelayDefaultHandleKey.js +1 -1
  85. package/lib/util/RelayError.js +1 -1
  86. package/lib/util/RelayFeatureFlags.js +10 -7
  87. package/lib/util/RelayProfiler.js +1 -1
  88. package/lib/util/RelayReplaySubject.js +22 -7
  89. package/lib/util/RelayRuntimeTypes.js +1 -7
  90. package/lib/util/StringInterner.js +71 -0
  91. package/lib/util/createPayloadFor3DField.js +1 -1
  92. package/lib/util/deepFreeze.js +1 -1
  93. package/lib/util/generateID.js +1 -1
  94. package/lib/util/getAllRootVariables.js +29 -0
  95. package/lib/util/getFragmentIdentifier.js +16 -8
  96. package/lib/util/getOperation.js +3 -2
  97. package/lib/util/getPaginationMetadata.js +41 -0
  98. package/lib/util/getPaginationVariables.js +66 -0
  99. package/lib/util/getPendingOperationsForFragment.js +55 -0
  100. package/lib/util/getRefetchMetadata.js +36 -0
  101. package/lib/util/getRelayHandleKey.js +3 -3
  102. package/lib/util/getRequestIdentifier.js +3 -3
  103. package/lib/util/getValueAtPath.js +51 -0
  104. package/lib/util/isEmptyObject.js +2 -2
  105. package/lib/util/isPromise.js +1 -1
  106. package/lib/util/isScalarAndEqual.js +1 -1
  107. package/lib/util/recycleNodesInto.js +1 -1
  108. package/lib/util/registerEnvironmentWithDevTools.js +26 -0
  109. package/lib/util/reportMissingRequiredFields.js +1 -1
  110. package/lib/util/resolveImmediate.js +1 -1
  111. package/lib/util/stableCopy.js +1 -1
  112. package/lib/util/withDuration.js +31 -0
  113. package/multi-actor-environment/ActorIdentifier.js.flow +18 -2
  114. package/multi-actor-environment/ActorSpecificEnvironment.js.flow +94 -58
  115. package/multi-actor-environment/ActorUtils.js.flow +33 -0
  116. package/multi-actor-environment/MultiActorEnvironment.js.flow +366 -93
  117. package/multi-actor-environment/MultiActorEnvironmentTypes.js.flow +88 -23
  118. package/multi-actor-environment/index.js.flow +3 -1
  119. package/mutations/RelayDeclarativeMutationConfig.js.flow +33 -27
  120. package/mutations/RelayRecordProxy.js.flow +5 -6
  121. package/mutations/RelayRecordSourceMutator.js.flow +5 -7
  122. package/mutations/RelayRecordSourceProxy.js.flow +20 -11
  123. package/mutations/RelayRecordSourceSelectorProxy.js.flow +23 -8
  124. package/mutations/applyOptimisticMutation.js.flow +14 -15
  125. package/mutations/commitLocalUpdate.js.flow +2 -2
  126. package/mutations/commitMutation.js.flow +36 -47
  127. package/mutations/readUpdatableQuery_EXPERIMENTAL.js.flow +318 -0
  128. package/mutations/validateMutation.js.flow +27 -17
  129. package/network/ConvertToExecuteFunction.js.flow +3 -3
  130. package/network/RelayNetwork.js.flow +5 -6
  131. package/network/RelayNetworkTypes.js.flow +1 -1
  132. package/network/RelayObservable.js.flow +2 -2
  133. package/network/RelayQueryResponseCache.js.flow +35 -22
  134. package/network/wrapNetworkWithLogObserver.js.flow +99 -0
  135. package/package.json +2 -2
  136. package/query/GraphQLTag.js.flow +11 -11
  137. package/query/PreloadableQueryRegistry.js.flow +5 -3
  138. package/query/fetchQuery.js.flow +19 -19
  139. package/query/fetchQueryInternal.js.flow +7 -10
  140. package/query/fetchQuery_DEPRECATED.js.flow +7 -7
  141. package/relay-runtime.js +2 -2
  142. package/relay-runtime.min.js +2 -2
  143. package/store/ClientID.js.flow +15 -4
  144. package/store/DataChecker.js.flow +142 -60
  145. package/store/OperationExecutor.js.flow +575 -320
  146. package/store/RelayConcreteVariables.js.flow +28 -9
  147. package/store/RelayExperimentalGraphResponseHandler.js.flow +121 -0
  148. package/store/RelayExperimentalGraphResponseTransform.js.flow +470 -0
  149. package/store/RelayModernEnvironment.js.flow +91 -115
  150. package/store/RelayModernFragmentSpecResolver.js.flow +56 -32
  151. package/store/RelayModernOperationDescriptor.js.flow +13 -8
  152. package/store/RelayModernRecord.js.flow +68 -12
  153. package/store/RelayModernSelector.js.flow +25 -15
  154. package/store/RelayModernStore.js.flow +67 -32
  155. package/store/RelayOperationTracker.js.flow +60 -44
  156. package/store/RelayOptimisticRecordSource.js.flow +3 -3
  157. package/store/RelayPublishQueue.js.flow +74 -32
  158. package/store/RelayReader.js.flow +319 -100
  159. package/store/RelayRecordSource.js.flow +73 -7
  160. package/store/RelayRecordState.js.flow +1 -1
  161. package/store/RelayReferenceMarker.js.flow +41 -27
  162. package/store/RelayResponseNormalizer.js.flow +204 -86
  163. package/store/RelayStoreReactFlightUtils.js.flow +5 -12
  164. package/store/RelayStoreSubscriptions.js.flow +20 -12
  165. package/store/RelayStoreTypes.js.flow +200 -41
  166. package/store/RelayStoreUtils.js.flow +25 -12
  167. package/store/ResolverCache.js.flow +249 -0
  168. package/store/ResolverFragments.js.flow +16 -20
  169. package/store/StoreInspector.js.flow +3 -3
  170. package/store/TypeID.js.flow +2 -2
  171. package/store/ViewerPattern.js.flow +3 -3
  172. package/store/cloneRelayHandleSourceField.js.flow +6 -7
  173. package/store/cloneRelayScalarHandleSourceField.js.flow +6 -7
  174. package/store/createFragmentSpecResolver.js.flow +4 -5
  175. package/store/createRelayContext.js.flow +4 -4
  176. package/store/defaultGetDataID.js.flow +1 -1
  177. package/store/defaultRequiredFieldLogger.js.flow +1 -1
  178. package/store/hasOverlappingIDs.js.flow +1 -1
  179. package/store/isRelayModernEnvironment.js.flow +1 -1
  180. package/store/normalizeRelayPayload.js.flow +7 -8
  181. package/store/readInlineData.js.flow +8 -9
  182. package/subscription/requestSubscription.js.flow +55 -51
  183. package/util/JSResourceTypes.flow.js.flow +1 -1
  184. package/util/NormalizationNode.js.flow +11 -4
  185. package/util/ReaderNode.js.flow +25 -2
  186. package/util/RelayConcreteNode.js.flow +5 -1
  187. package/util/RelayDefaultHandleKey.js.flow +1 -1
  188. package/util/RelayError.js.flow +1 -1
  189. package/util/RelayFeatureFlags.js.flow +23 -15
  190. package/util/RelayProfiler.js.flow +1 -1
  191. package/util/RelayReplaySubject.js.flow +10 -10
  192. package/util/RelayRuntimeTypes.js.flow +70 -3
  193. package/util/StringInterner.js.flow +69 -0
  194. package/util/createPayloadFor3DField.js.flow +4 -4
  195. package/util/deepFreeze.js.flow +1 -1
  196. package/util/generateID.js.flow +1 -1
  197. package/util/getAllRootVariables.js.flow +36 -0
  198. package/util/getFragmentIdentifier.js.flow +28 -16
  199. package/util/getOperation.js.flow +3 -3
  200. package/util/getPaginationMetadata.js.flow +69 -0
  201. package/util/getPaginationVariables.js.flow +108 -0
  202. package/util/getPendingOperationsForFragment.js.flow +62 -0
  203. package/util/getRefetchMetadata.js.flow +76 -0
  204. package/util/getRelayHandleKey.js.flow +2 -3
  205. package/util/getRequestIdentifier.js.flow +4 -4
  206. package/util/getValueAtPath.js.flow +46 -0
  207. package/util/isEmptyObject.js.flow +2 -1
  208. package/util/isPromise.js.flow +1 -1
  209. package/util/isScalarAndEqual.js.flow +1 -1
  210. package/util/recycleNodesInto.js.flow +1 -1
  211. package/util/registerEnvironmentWithDevTools.js.flow +33 -0
  212. package/util/reportMissingRequiredFields.js.flow +1 -1
  213. package/util/resolveImmediate.js.flow +2 -2
  214. package/util/stableCopy.js.flow +1 -1
  215. package/util/withDuration.js.flow +32 -0
  216. package/lib/store/RelayRecordSourceMapImpl.js +0 -107
  217. package/lib/store/RelayStoreSubscriptionsUsingMapByID.js +0 -318
  218. package/store/RelayRecordSourceMapImpl.js.flow +0 -91
  219. package/store/RelayStoreSubscriptionsUsingMapByID.js.flow +0 -283
@@ -1,283 +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
- * @flow strict-local
8
- * @format
9
- */
10
-
11
- // flowlint ambiguous-object-type:error
12
-
13
- 'use strict';
14
-
15
- const RelayFeatureFlags = require('../util/RelayFeatureFlags');
16
- const RelayReader = require('./RelayReader');
17
-
18
- const deepFreeze = require('../util/deepFreeze');
19
- const recycleNodesInto = require('../util/recycleNodesInto');
20
-
21
- import type {DataID, Disposable} from '../util/RelayRuntimeTypes';
22
- import type {
23
- LogFunction,
24
- OperationDescriptor,
25
- RecordSource,
26
- RequestDescriptor,
27
- Snapshot,
28
- StoreSubscriptions,
29
- DataIDSet,
30
- } from './RelayStoreTypes';
31
-
32
- type Subscription = {|
33
- backup: ?Snapshot,
34
- callback: (snapshot: Snapshot) => void,
35
- notifiedRevision: number,
36
- snapshot: Snapshot,
37
- snapshotRevision: number,
38
- |};
39
-
40
- class RelayStoreSubscriptionsUsingMapByID implements StoreSubscriptions {
41
- _notifiedRevision: number;
42
- _snapshotRevision: number;
43
- _subscriptionsByDataId: Map<DataID, Set<Subscription>>;
44
- _staleSubscriptions: Set<Subscription>;
45
- __log: ?LogFunction;
46
-
47
- constructor(log?: ?LogFunction) {
48
- this._notifiedRevision = 0;
49
- this._snapshotRevision = 0;
50
- this._subscriptionsByDataId = new Map();
51
- this._staleSubscriptions = new Set();
52
- this.__log = log;
53
- }
54
-
55
- subscribe(
56
- snapshot: Snapshot,
57
- callback: (snapshot: Snapshot) => void,
58
- ): Disposable {
59
- const subscription = {
60
- backup: null,
61
- callback,
62
- notifiedRevision: this._notifiedRevision,
63
- snapshotRevision: this._snapshotRevision,
64
- snapshot,
65
- };
66
- const dispose = () => {
67
- for (const dataId of snapshot.seenRecords) {
68
- const subscriptionsForDataId = this._subscriptionsByDataId.get(dataId);
69
- if (subscriptionsForDataId != null) {
70
- subscriptionsForDataId.delete(subscription);
71
- if (subscriptionsForDataId.size === 0) {
72
- this._subscriptionsByDataId.delete(dataId);
73
- }
74
- }
75
- }
76
- };
77
-
78
- for (const dataId of snapshot.seenRecords) {
79
- const subscriptionsForDataId = this._subscriptionsByDataId.get(dataId);
80
- if (subscriptionsForDataId != null) {
81
- subscriptionsForDataId.add(subscription);
82
- } else {
83
- this._subscriptionsByDataId.set(dataId, new Set([subscription]));
84
- }
85
- }
86
-
87
- return {dispose};
88
- }
89
-
90
- snapshotSubscriptions(source: RecordSource) {
91
- this._snapshotRevision++;
92
- this._subscriptionsByDataId.forEach(subscriptions => {
93
- subscriptions.forEach(subscription => {
94
- if (subscription.snapshotRevision === this._snapshotRevision) {
95
- return;
96
- }
97
- subscription.snapshotRevision = this._snapshotRevision;
98
-
99
- // Backup occurs after writing a new "final" payload(s) and before (re)applying
100
- // optimistic changes. Each subscription's `snapshot` represents what was *last
101
- // published to the subscriber*, which notably may include previous optimistic
102
- // updates. Therefore a subscription can be in any of the following states:
103
- // - stale=true: This subscription was restored to a different value than
104
- // `snapshot`. That means this subscription has changes relative to its base,
105
- // but its base has changed (we just applied a final payload): recompute
106
- // a backup so that we can later restore to the state the subscription
107
- // should be in.
108
- // - stale=false: This subscription was restored to the same value than
109
- // `snapshot`. That means this subscription does *not* have changes relative
110
- // to its base, so the current `snapshot` is valid to use as a backup.
111
- if (!this._staleSubscriptions.has(subscription)) {
112
- subscription.backup = subscription.snapshot;
113
- return;
114
- }
115
- const snapshot = subscription.snapshot;
116
- const backup = RelayReader.read(source, snapshot.selector);
117
- const nextData = recycleNodesInto(snapshot.data, backup.data);
118
- (backup: $FlowFixMe).data = nextData; // backup owns the snapshot and can safely mutate
119
- subscription.backup = backup;
120
- });
121
- });
122
- }
123
-
124
- restoreSubscriptions() {
125
- this._snapshotRevision++;
126
- this._subscriptionsByDataId.forEach(subscriptions => {
127
- subscriptions.forEach(subscription => {
128
- if (subscription.snapshotRevision === this._snapshotRevision) {
129
- return;
130
- }
131
- subscription.snapshotRevision = this._snapshotRevision;
132
-
133
- const backup = subscription.backup;
134
- subscription.backup = null;
135
- if (backup) {
136
- if (backup.data !== subscription.snapshot.data) {
137
- this._staleSubscriptions.add(subscription);
138
- }
139
- const prevSeenRecords = subscription.snapshot.seenRecords;
140
- subscription.snapshot = {
141
- data: subscription.snapshot.data,
142
- isMissingData: backup.isMissingData,
143
- seenRecords: backup.seenRecords,
144
- selector: backup.selector,
145
- missingRequiredFields: backup.missingRequiredFields,
146
- };
147
- this._updateSubscriptionsMap(subscription, prevSeenRecords);
148
- } else {
149
- this._staleSubscriptions.add(subscription);
150
- }
151
- });
152
- });
153
- }
154
-
155
- updateSubscriptions(
156
- source: RecordSource,
157
- updatedRecordIDs: DataIDSet,
158
- updatedOwners: Array<RequestDescriptor>,
159
- sourceOperation?: OperationDescriptor,
160
- ) {
161
- this._notifiedRevision++;
162
- updatedRecordIDs.forEach(updatedRecordId => {
163
- const subcriptionsForDataId = this._subscriptionsByDataId.get(
164
- updatedRecordId,
165
- );
166
- if (subcriptionsForDataId == null) {
167
- return;
168
- }
169
- subcriptionsForDataId.forEach(subscription => {
170
- if (subscription.notifiedRevision === this._notifiedRevision) {
171
- return;
172
- }
173
- const owner = this._updateSubscription(
174
- source,
175
- subscription,
176
- false,
177
- sourceOperation,
178
- );
179
- if (owner != null) {
180
- updatedOwners.push(owner);
181
- }
182
- });
183
- });
184
- this._staleSubscriptions.forEach(subscription => {
185
- if (subscription.notifiedRevision === this._notifiedRevision) {
186
- return;
187
- }
188
- const owner = this._updateSubscription(
189
- source,
190
- subscription,
191
- true,
192
- sourceOperation,
193
- );
194
- if (owner != null) {
195
- updatedOwners.push(owner);
196
- }
197
- });
198
- this._staleSubscriptions.clear();
199
- }
200
-
201
- /**
202
- * Notifies the callback for the subscription if the data for the associated
203
- * snapshot has changed.
204
- * Additionally, updates the subscription snapshot with the latest snapshot,
205
- * amarks it as not stale, and updates the subscription tracking for any
206
- * any new ids observed in the latest data snapshot.
207
- * Returns the owner (RequestDescriptor) if the subscription was affected by the
208
- * latest update, or null if it was not affected.
209
- */
210
- _updateSubscription(
211
- source: RecordSource,
212
- subscription: Subscription,
213
- stale: boolean,
214
- sourceOperation?: OperationDescriptor,
215
- ): ?RequestDescriptor {
216
- const {backup, callback, snapshot} = subscription;
217
- let nextSnapshot: Snapshot =
218
- stale && backup != null
219
- ? backup
220
- : RelayReader.read(source, snapshot.selector);
221
- const nextData = recycleNodesInto(snapshot.data, nextSnapshot.data);
222
- nextSnapshot = ({
223
- data: nextData,
224
- isMissingData: nextSnapshot.isMissingData,
225
- seenRecords: nextSnapshot.seenRecords,
226
- selector: nextSnapshot.selector,
227
- missingRequiredFields: nextSnapshot.missingRequiredFields,
228
- }: Snapshot);
229
- if (__DEV__) {
230
- deepFreeze(nextSnapshot);
231
- }
232
-
233
- const prevSeenRecords = subscription.snapshot.seenRecords;
234
- subscription.snapshot = nextSnapshot;
235
- subscription.notifiedRevision = this._notifiedRevision;
236
- this._updateSubscriptionsMap(subscription, prevSeenRecords);
237
-
238
- if (nextSnapshot.data !== snapshot.data) {
239
- if (this.__log && RelayFeatureFlags.ENABLE_NOTIFY_SUBSCRIPTION) {
240
- this.__log({
241
- name: 'store.notify.subscription',
242
- sourceOperation,
243
- snapshot,
244
- nextSnapshot,
245
- });
246
- }
247
- callback(nextSnapshot);
248
- return snapshot.selector.owner;
249
- }
250
- }
251
-
252
- /**
253
- * Updates the Map that tracks subscriptions by id.
254
- * Given an updated subscription and the records that where seen
255
- * on the previous subscription snapshot, updates our tracking
256
- * to track the subscription for the newly and no longer seen ids.
257
- */
258
- _updateSubscriptionsMap(
259
- subscription: Subscription,
260
- prevSeenRecords: DataIDSet,
261
- ) {
262
- for (const dataId of prevSeenRecords) {
263
- const subscriptionsForDataId = this._subscriptionsByDataId.get(dataId);
264
- if (subscriptionsForDataId != null) {
265
- subscriptionsForDataId.delete(subscription);
266
- if (subscriptionsForDataId.size === 0) {
267
- this._subscriptionsByDataId.delete(dataId);
268
- }
269
- }
270
- }
271
-
272
- for (const dataId of subscription.snapshot.seenRecords) {
273
- const subscriptionsForDataId = this._subscriptionsByDataId.get(dataId);
274
- if (subscriptionsForDataId != null) {
275
- subscriptionsForDataId.add(subscription);
276
- } else {
277
- this._subscriptionsByDataId.set(dataId, new Set([subscription]));
278
- }
279
- }
280
- }
281
- }
282
-
283
- module.exports = RelayStoreSubscriptionsUsingMapByID;