relay-runtime 1.7.0-rc.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/LICENSE +1 -1
  2. package/index.js +1 -1
  3. package/lib/ConvertToExecuteFunction.js +12 -75
  4. package/lib/DataChecker.js +400 -0
  5. package/lib/NormalizationNode.js +14 -0
  6. package/lib/ReaderNode.js +10 -0
  7. package/lib/RelayCombinedEnvironmentTypes.js +10 -0
  8. package/lib/RelayConcreteNode.js +12 -29
  9. package/lib/RelayConcreteVariables.js +17 -11
  10. package/lib/RelayConnectionHandler.js +98 -42
  11. package/lib/RelayConnectionInterface.js +5 -13
  12. package/lib/RelayCore.js +17 -14
  13. package/lib/RelayDeclarativeMutationConfig.js +69 -34
  14. package/lib/RelayDefaultHandleKey.js +1 -2
  15. package/lib/RelayDefaultHandlerProvider.js +6 -5
  16. package/lib/RelayError.js +6 -9
  17. package/lib/RelayInMemoryRecordSource.js +20 -22
  18. package/lib/RelayModernEnvironment.js +140 -229
  19. package/lib/RelayModernFragmentSpecResolver.js +110 -102
  20. package/lib/RelayModernGraphQLTag.js +53 -15
  21. package/lib/{RelayModernOperationSelector.js → RelayModernOperationDescriptor.js} +9 -8
  22. package/lib/RelayModernQueryExecutor.js +172 -0
  23. package/lib/RelayModernRecord.js +97 -38
  24. package/lib/RelayModernSelector.js +89 -33
  25. package/lib/RelayModernStore.js +301 -0
  26. package/lib/RelayNetwork.js +16 -28
  27. package/lib/RelayNetworkLogger.js +2 -3
  28. package/lib/RelayNetworkLoggerTransaction.js +32 -30
  29. package/lib/RelayNetworkTypes.js +1 -2
  30. package/lib/RelayObservable.js +127 -155
  31. package/lib/RelayProfiler.js +35 -22
  32. package/lib/RelayPublishQueue.js +144 -96
  33. package/lib/RelayQueryResponseCache.js +37 -21
  34. package/lib/RelayReader.js +194 -61
  35. package/lib/RelayRecordProxy.js +50 -31
  36. package/lib/RelayRecordSourceMutator.js +92 -51
  37. package/lib/RelayRecordSourceProxy.js +43 -35
  38. package/lib/RelayRecordSourceSelectorProxy.js +22 -21
  39. package/lib/RelayRecordState.js +1 -3
  40. package/lib/RelayReferenceMarker.js +110 -37
  41. package/lib/RelayResponseNormalizer.js +248 -82
  42. package/lib/RelayRuntimeTypes.js +1 -3
  43. package/lib/RelayStoreTypes.js +1 -2
  44. package/lib/RelayStoreUtils.js +37 -19
  45. package/lib/RelayViewerHandler.js +14 -10
  46. package/lib/applyRelayModernOptimisticMutation.js +8 -8
  47. package/lib/cloneRelayHandleSourceField.js +8 -9
  48. package/lib/commitLocalUpdate.js +1 -2
  49. package/lib/commitRelayModernMutation.js +21 -14
  50. package/lib/createRelayNetworkLogger.js +11 -9
  51. package/lib/deepFreeze.js +2 -3
  52. package/lib/fetchRelayModernQuery.js +10 -12
  53. package/lib/generateRelayClientID.js +4 -2
  54. package/lib/getRelayHandleKey.js +5 -6
  55. package/lib/hasOverlappingIDs.js +3 -2
  56. package/lib/index.js +59 -62
  57. package/lib/isPromise.js +1 -2
  58. package/lib/isRelayModernEnvironment.js +1 -3
  59. package/lib/isScalarAndEqual.js +1 -3
  60. package/lib/normalizePayload.js +17 -15
  61. package/lib/normalizeRelayPayload.js +9 -9
  62. package/lib/recycleNodesInto.js +25 -9
  63. package/lib/requestRelaySubscription.js +25 -58
  64. package/lib/simpleClone.js +2 -3
  65. package/lib/stableCopy.js +5 -3
  66. package/lib/validateMutation.js +146 -0
  67. package/package.json +3 -3
  68. package/relay-runtime.js +4 -0
  69. package/relay-runtime.min.js +9 -0
  70. package/lib/RelayDataLoader.js +0 -302
  71. package/lib/RelayMarkSweepStore.js +0 -242
  72. package/lib/deferrableFragmentKey.js +0 -20
@@ -1,302 +0,0 @@
1
- /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * strict-local
8
- * @format
9
- */
10
-
11
- 'use strict';
12
-
13
- var _classCallCheck3 = _interopRequireDefault(require('babel-runtime/helpers/classCallCheck'));
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
16
-
17
- /**
18
- * Synchronously check whether the records required to fulfill the
19
- * given `selector` are present in `source`.
20
- *
21
- * If a field is missing, it uses the provided handlers to attempt to substitute
22
- * data. The `target` will store all records that are modified because of a
23
- * successful substitution.
24
- *
25
- * If all records are present, returns `true`, otherwise `false`.
26
- */
27
- function check(source, target, selector, handlers) {
28
- var dataID = selector.dataID,
29
- node = selector.node,
30
- variables = selector.variables;
31
-
32
- var loader = new RelayDataLoader(source, target, variables, handlers);
33
- return loader.check(node, dataID);
34
- }
35
-
36
- /**
37
- * @private
38
- */
39
-
40
- var RelayDataLoader = function () {
41
- function RelayDataLoader(source, target, variables, handlers) {
42
- (0, _classCallCheck3['default'])(this, RelayDataLoader);
43
-
44
- this._source = source;
45
- this._variables = variables;
46
- this._recordWasMissing = false;
47
- this._handlers = handlers;
48
- this._mutator = new (require('./RelayRecordSourceMutator'))(source, target);
49
- }
50
-
51
- RelayDataLoader.prototype.check = function check(node, dataID) {
52
- this._traverse(node, dataID);
53
- return !this._recordWasMissing;
54
- };
55
-
56
- RelayDataLoader.prototype._getVariableValue = function _getVariableValue(name) {
57
- !this._variables.hasOwnProperty(name) ? process.env.NODE_ENV !== 'production' ? require('fbjs/lib/invariant')(false, 'RelayAsyncLoader(): Undefined variable `%s`.', name) : require('fbjs/lib/invariant')(false) : void 0;
58
- return this._variables[name];
59
- };
60
-
61
- RelayDataLoader.prototype._handleMissing = function _handleMissing() {
62
- this._recordWasMissing = true;
63
- };
64
-
65
- RelayDataLoader.prototype._getDataForHandlers = function _getDataForHandlers(field, dataID) {
66
- return {
67
- args: field.args ? require('./RelayStoreUtils').getArgumentValues(field.args, this._variables) : {},
68
- // Getting a snapshot of the record state is potentially expensive since
69
- // we will need to merge the sink and source records. Since we do not create
70
- // any new records in this process, it is probably reasonable to provide
71
- // handlers with a copy of the source record.
72
- // The only thing that the provided record will not contain is fields
73
- // added by previous handlers.
74
- record: this._source.get(dataID)
75
- };
76
- };
77
-
78
- RelayDataLoader.prototype._handleMissingScalarField = function _handleMissingScalarField(field, dataID) {
79
- var _getDataForHandlers2 = this._getDataForHandlers(field, dataID),
80
- args = _getDataForHandlers2.args,
81
- record = _getDataForHandlers2.record;
82
-
83
- var _iteratorNormalCompletion = true;
84
- var _didIteratorError = false;
85
- var _iteratorError = undefined;
86
-
87
- try {
88
- for (var _iterator = this._handlers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
89
- var handler = _step.value;
90
-
91
- if (handler.kind === 'scalar') {
92
- var newValue = handler.handle(field, record, args);
93
- if (newValue !== undefined) {
94
- return newValue;
95
- }
96
- }
97
- }
98
- } catch (err) {
99
- _didIteratorError = true;
100
- _iteratorError = err;
101
- } finally {
102
- try {
103
- if (!_iteratorNormalCompletion && _iterator['return']) {
104
- _iterator['return']();
105
- }
106
- } finally {
107
- if (_didIteratorError) {
108
- throw _iteratorError;
109
- }
110
- }
111
- }
112
-
113
- this._handleMissing();
114
- };
115
-
116
- RelayDataLoader.prototype._handleMissingLinkField = function _handleMissingLinkField(field, dataID) {
117
- var _getDataForHandlers3 = this._getDataForHandlers(field, dataID),
118
- args = _getDataForHandlers3.args,
119
- record = _getDataForHandlers3.record;
120
-
121
- var _iteratorNormalCompletion2 = true;
122
- var _didIteratorError2 = false;
123
- var _iteratorError2 = undefined;
124
-
125
- try {
126
- for (var _iterator2 = this._handlers[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
127
- var handler = _step2.value;
128
-
129
- if (handler.kind === 'linked') {
130
- var newValue = handler.handle(field, record, args);
131
- if (newValue != null && this._mutator.getStatus(newValue) === require('./RelayRecordState').EXISTENT) {
132
- return newValue;
133
- }
134
- }
135
- }
136
- } catch (err) {
137
- _didIteratorError2 = true;
138
- _iteratorError2 = err;
139
- } finally {
140
- try {
141
- if (!_iteratorNormalCompletion2 && _iterator2['return']) {
142
- _iterator2['return']();
143
- }
144
- } finally {
145
- if (_didIteratorError2) {
146
- throw _iteratorError2;
147
- }
148
- }
149
- }
150
-
151
- this._handleMissing();
152
- };
153
-
154
- RelayDataLoader.prototype._handleMissingPluralLinkField = function _handleMissingPluralLinkField(field, dataID) {
155
- var _this = this;
156
-
157
- var _getDataForHandlers4 = this._getDataForHandlers(field, dataID),
158
- args = _getDataForHandlers4.args,
159
- record = _getDataForHandlers4.record;
160
-
161
- var _iteratorNormalCompletion3 = true;
162
- var _didIteratorError3 = false;
163
- var _iteratorError3 = undefined;
164
-
165
- try {
166
- for (var _iterator3 = this._handlers[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
167
- var handler = _step3.value;
168
-
169
- if (handler.kind === 'pluralLinked') {
170
- var newValue = handler.handle(field, record, args);
171
- if (newValue != null) {
172
- return newValue.filter(function (linkedID) {
173
- return linkedID != null && _this._mutator.getStatus(linkedID) === require('./RelayRecordState').EXISTENT;
174
- });
175
- }
176
- }
177
- }
178
- } catch (err) {
179
- _didIteratorError3 = true;
180
- _iteratorError3 = err;
181
- } finally {
182
- try {
183
- if (!_iteratorNormalCompletion3 && _iterator3['return']) {
184
- _iterator3['return']();
185
- }
186
- } finally {
187
- if (_didIteratorError3) {
188
- throw _iteratorError3;
189
- }
190
- }
191
- }
192
-
193
- this._handleMissing();
194
- };
195
-
196
- RelayDataLoader.prototype._traverse = function _traverse(node, dataID) {
197
- var status = this._mutator.getStatus(dataID);
198
- if (status === require('./RelayRecordState').UNKNOWN) {
199
- this._handleMissing();
200
- }
201
- if (status === require('./RelayRecordState').EXISTENT) {
202
- this._traverseSelections(node.selections, dataID);
203
- }
204
- };
205
-
206
- RelayDataLoader.prototype._traverseSelections = function _traverseSelections(selections, dataID) {
207
- var _this2 = this;
208
-
209
- selections.every(function (selection) {
210
- switch (selection.kind) {
211
- case require('./RelayConcreteNode').SCALAR_FIELD:
212
- _this2._prepareScalar(selection, dataID);
213
- break;
214
- case require('./RelayConcreteNode').LINKED_FIELD:
215
- if (selection.plural) {
216
- _this2._preparePluralLink(selection, dataID);
217
- } else {
218
- _this2._prepareLink(selection, dataID);
219
- }
220
- break;
221
- case require('./RelayConcreteNode').CONDITION:
222
- var conditionValue = _this2._getVariableValue(selection.condition);
223
- if (conditionValue === selection.passingValue) {
224
- _this2._traverseSelections(selection.selections, dataID);
225
- }
226
- break;
227
- case require('./RelayConcreteNode').INLINE_FRAGMENT:
228
- var typeName = _this2._mutator.getType(dataID);
229
- if (typeName != null && typeName === selection.type) {
230
- _this2._traverseSelections(selection.selections, dataID);
231
- }
232
- break;
233
- case require('./RelayConcreteNode').LINKED_HANDLE:
234
- // Handles have no selections themselves; traverse the original field
235
- // where the handle was set-up instead.
236
- var handleField = require('./cloneRelayHandleSourceField')(selection, selections, _this2._variables);
237
- if (handleField.plural) {
238
- _this2._preparePluralLink(handleField, dataID);
239
- } else {
240
- _this2._prepareLink(handleField, dataID);
241
- }
242
- break;
243
- default:
244
- !(selection.kind === require('./RelayConcreteNode').SCALAR_FIELD) ? process.env.NODE_ENV !== 'production' ? require('fbjs/lib/invariant')(false, 'RelayAsyncLoader(): Unexpected ast kind `%s`.', selection.kind) : require('fbjs/lib/invariant')(false) : void 0;
245
- }
246
- return !_this2._done;
247
- });
248
- };
249
-
250
- RelayDataLoader.prototype._prepareScalar = function _prepareScalar(field, dataID) {
251
- var storageKey = require('./RelayStoreUtils').getStorageKey(field, this._variables);
252
- var fieldValue = this._mutator.getValue(dataID, storageKey);
253
- if (fieldValue === undefined) {
254
- fieldValue = this._handleMissingScalarField(field, dataID);
255
- if (fieldValue !== undefined) {
256
- this._mutator.setValue(dataID, storageKey, fieldValue);
257
- }
258
- }
259
- };
260
-
261
- RelayDataLoader.prototype._prepareLink = function _prepareLink(field, dataID) {
262
- var storageKey = require('./RelayStoreUtils').getStorageKey(field, this._variables);
263
- var linkedID = this._mutator.getLinkedRecordID(dataID, storageKey);
264
-
265
- if (linkedID === undefined) {
266
- linkedID = this._handleMissingLinkField(field, dataID);
267
- if (linkedID != null) {
268
- this._mutator.setLinkedRecordID(dataID, storageKey, linkedID);
269
- }
270
- }
271
- if (linkedID != null) {
272
- this._traverse(field, linkedID);
273
- }
274
- };
275
-
276
- RelayDataLoader.prototype._preparePluralLink = function _preparePluralLink(field, dataID) {
277
- var _this3 = this;
278
-
279
- var storageKey = require('./RelayStoreUtils').getStorageKey(field, this._variables);
280
- var linkedIDs = this._mutator.getLinkedRecordIDs(dataID, storageKey);
281
-
282
- if (linkedIDs === undefined) {
283
- linkedIDs = this._handleMissingPluralLinkField(field, dataID);
284
- if (linkedIDs != null) {
285
- this._mutator.setLinkedRecordIDs(dataID, storageKey, linkedIDs);
286
- }
287
- }
288
- if (linkedIDs) {
289
- linkedIDs.forEach(function (linkedID) {
290
- if (linkedID != null) {
291
- _this3._traverse(field, linkedID);
292
- }
293
- });
294
- }
295
- };
296
-
297
- return RelayDataLoader;
298
- }();
299
-
300
- module.exports = {
301
- check: check
302
- };
@@ -1,242 +0,0 @@
1
- /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * strict-local
8
- * @format
9
- */
10
-
11
- 'use strict';
12
-
13
- var _extends3 = _interopRequireDefault(require('babel-runtime/helpers/extends'));
14
-
15
- var _classCallCheck3 = _interopRequireDefault(require('babel-runtime/helpers/classCallCheck'));
16
-
17
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
18
-
19
- /**
20
- * @public
21
- *
22
- * An implementation of the `Store` interface defined in `RelayStoreTypes`.
23
- *
24
- * Note that a Store takes ownership of all records provided to it: other
25
- * objects may continue to hold a reference to such records but may not mutate
26
- * them. The static Relay core is architected to avoid mutating records that may have been
27
- * passed to a store: operations that mutate records will either create fresh
28
- * records or clone existing records and modify the clones. Record immutability
29
- * is also enforced in development mode by freezing all records passed to a store.
30
- */
31
- var RelayMarkSweepStore = function () {
32
- function RelayMarkSweepStore(source) {
33
- (0, _classCallCheck3['default'])(this, RelayMarkSweepStore);
34
-
35
- // Prevent mutation of a record from outside the store.
36
- if (process.env.NODE_ENV !== 'production') {
37
- var storeIDs = source.getRecordIDs();
38
- for (var ii = 0; ii < storeIDs.length; ii++) {
39
- var record = source.get(storeIDs[ii]);
40
- if (record) {
41
- require('./RelayModernRecord').freeze(record);
42
- }
43
- }
44
- }
45
- this._gcEnabled = true;
46
- this._hasScheduledGC = false;
47
- this._index = 0;
48
- this._recordSource = source;
49
- this._roots = new Map();
50
- this._subscriptions = new Set();
51
- this._updatedRecordIDs = {};
52
- }
53
-
54
- RelayMarkSweepStore.prototype.getSource = function getSource() {
55
- return this._recordSource;
56
- };
57
-
58
- RelayMarkSweepStore.prototype.check = function check(selector) {
59
- return require('./RelayDataLoader').check(this._recordSource, this._recordSource, selector, []);
60
- };
61
-
62
- RelayMarkSweepStore.prototype.retain = function retain(selector) {
63
- var _this = this;
64
-
65
- var index = this._index++;
66
- var dispose = function dispose() {
67
- _this._roots['delete'](index);
68
- _this._scheduleGC();
69
- };
70
- this._roots.set(index, selector);
71
- return { dispose: dispose };
72
- };
73
-
74
- RelayMarkSweepStore.prototype.lookup = function lookup(selector) {
75
- var snapshot = require('./RelayReader').read(this._recordSource, selector);
76
- if (process.env.NODE_ENV !== 'production') {
77
- require('./deepFreeze')(snapshot);
78
- }
79
- return snapshot;
80
- };
81
-
82
- RelayMarkSweepStore.prototype.notify = function notify() {
83
- var _this2 = this;
84
-
85
- this._subscriptions.forEach(function (subscription) {
86
- _this2._updateSubscription(subscription);
87
- });
88
- this._updatedRecordIDs = {};
89
- };
90
-
91
- RelayMarkSweepStore.prototype.publish = function publish(source) {
92
- updateTargetFromSource(this._recordSource, source, this._updatedRecordIDs);
93
- };
94
-
95
- RelayMarkSweepStore.prototype.subscribe = function subscribe(snapshot, callback) {
96
- var _this3 = this;
97
-
98
- var subscription = { callback: callback, snapshot: snapshot };
99
- var dispose = function dispose() {
100
- _this3._subscriptions['delete'](subscription);
101
- };
102
- this._subscriptions.add(subscription);
103
- return { dispose: dispose };
104
- };
105
-
106
- // Internal API
107
-
108
-
109
- RelayMarkSweepStore.prototype.__getUpdatedRecordIDs = function __getUpdatedRecordIDs() {
110
- return this._updatedRecordIDs;
111
- };
112
-
113
- RelayMarkSweepStore.prototype._updateSubscription = function _updateSubscription(subscription) {
114
- var callback = subscription.callback,
115
- snapshot = subscription.snapshot;
116
-
117
- if (!require('./hasOverlappingIDs')(snapshot, this._updatedRecordIDs)) {
118
- return;
119
- }
120
-
121
- var _RelayReader$read = require('./RelayReader').read(this._recordSource, snapshot),
122
- data = _RelayReader$read.data,
123
- seenRecords = _RelayReader$read.seenRecords;
124
-
125
- var nextData = require('./recycleNodesInto')(snapshot.data, data);
126
- var nextSnapshot = (0, _extends3['default'])({}, snapshot, {
127
- data: nextData,
128
- seenRecords: seenRecords
129
- });
130
- if (process.env.NODE_ENV !== 'production') {
131
- require('./deepFreeze')(nextSnapshot);
132
- }
133
- subscription.snapshot = nextSnapshot;
134
- if (nextSnapshot.data !== snapshot.data) {
135
- callback(nextSnapshot);
136
- }
137
- };
138
-
139
- RelayMarkSweepStore.prototype._scheduleGC = function _scheduleGC() {
140
- var _this4 = this;
141
-
142
- if (!this._gcEnabled || this._hasScheduledGC) {
143
- return;
144
- }
145
- this._hasScheduledGC = true;
146
- require('fbjs/lib/resolveImmediate')(function () {
147
- _this4.__gc();
148
- _this4._hasScheduledGC = false;
149
- });
150
- };
151
-
152
- RelayMarkSweepStore.prototype.__gc = function __gc() {
153
- var _this5 = this;
154
-
155
- var references = new Set();
156
- // Mark all records that are traversable from a root
157
- this._roots.forEach(function (selector) {
158
- require('./RelayReferenceMarker').mark(_this5._recordSource, selector, references);
159
- });
160
- // Short-circuit if *nothing* is referenced
161
- if (!references.size) {
162
- this._recordSource.clear();
163
- return;
164
- }
165
- // Evict any unreferenced nodes
166
- var storeIDs = this._recordSource.getRecordIDs();
167
- for (var ii = 0; ii < storeIDs.length; ii++) {
168
- var dataID = storeIDs[ii];
169
- if (!references.has(dataID)) {
170
- this._recordSource.remove(dataID);
171
- }
172
- }
173
- };
174
-
175
- // Internal hooks to enable/disable garbage collection for experimentation
176
-
177
-
178
- RelayMarkSweepStore.prototype.__enableGC = function __enableGC() {
179
- this._gcEnabled = true;
180
- };
181
-
182
- RelayMarkSweepStore.prototype.__disableGC = function __disableGC() {
183
- this._gcEnabled = false;
184
- };
185
-
186
- return RelayMarkSweepStore;
187
- }();
188
-
189
- /**
190
- * Updates the target with information from source, also updating a mapping of
191
- * which records in the target were changed as a result.
192
- */
193
-
194
-
195
- function updateTargetFromSource(target, source, updatedRecordIDs) {
196
- var dataIDs = source.getRecordIDs();
197
- for (var ii = 0; ii < dataIDs.length; ii++) {
198
- var dataID = dataIDs[ii];
199
- var sourceRecord = source.get(dataID);
200
- var targetRecord = target.get(dataID);
201
- // Prevent mutation of a record from outside the store.
202
- if (process.env.NODE_ENV !== 'production') {
203
- if (sourceRecord) {
204
- require('./RelayModernRecord').freeze(sourceRecord);
205
- }
206
- }
207
- if (sourceRecord === require('./RelayStoreUtils').UNPUBLISH_RECORD_SENTINEL) {
208
- // Unpublish a record
209
- target.remove(dataID);
210
- updatedRecordIDs[dataID] = true;
211
- } else if (sourceRecord && targetRecord) {
212
- var nextRecord = require('./RelayModernRecord').update(targetRecord, sourceRecord);
213
- if (nextRecord !== targetRecord) {
214
- // Prevent mutation of a record from outside the store.
215
- if (process.env.NODE_ENV !== 'production') {
216
- require('./RelayModernRecord').freeze(nextRecord);
217
- }
218
- updatedRecordIDs[dataID] = true;
219
- target.set(dataID, nextRecord);
220
- }
221
- } else if (sourceRecord === null) {
222
- target['delete'](dataID);
223
- if (targetRecord !== null) {
224
- updatedRecordIDs[dataID] = true;
225
- }
226
- } else if (sourceRecord) {
227
- target.set(dataID, sourceRecord);
228
- updatedRecordIDs[dataID] = true;
229
- } // don't add explicit undefined
230
- }
231
- }
232
-
233
- require('./RelayProfiler').instrumentMethods(RelayMarkSweepStore.prototype, {
234
- lookup: 'RelayMarkSweepStore.prototype.lookup',
235
- notify: 'RelayMarkSweepStore.prototype.notify',
236
- publish: 'RelayMarkSweepStore.prototype.publish',
237
- retain: 'RelayMarkSweepStore.prototype.retain',
238
- subscribe: 'RelayMarkSweepStore.prototype.subscribe',
239
- __gc: 'RelayMarkSweepStore.prototype.__gc'
240
- });
241
-
242
- module.exports = RelayMarkSweepStore;
@@ -1,20 +0,0 @@
1
- /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * strict
8
- * @format
9
- */
10
-
11
- 'use strict';
12
-
13
- function deferrableFragmentKey(dataID, fragmentName, variables) {
14
- var variablesString = Object.keys(variables).reduce(function (acc, key) {
15
- return '' + acc + (acc ? ',' : '') + key + ':' + variables[key];
16
- }, '');
17
- return 'path:' + dataID + ',key:' + fragmentName + ',request:' + variablesString;
18
- }
19
-
20
- module.exports = deferrableFragmentKey;