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,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright (c) Facebook, Inc. and its 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.
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @format
9
9
  */
10
-
11
10
  'use strict';
12
11
 
13
12
  var MutationTypes = Object.freeze({
@@ -17,21 +16,15 @@ var MutationTypes = Object.freeze({
17
16
  FIELDS_CHANGE: 'FIELDS_CHANGE',
18
17
  REQUIRED_CHILDREN: 'REQUIRED_CHILDREN'
19
18
  });
20
-
21
-
22
19
  var RangeOperations = Object.freeze({
23
20
  APPEND: 'append',
24
21
  IGNORE: 'ignore',
25
22
  PREPEND: 'prepend',
26
- REFETCH: 'refetch', // legacy only
23
+ REFETCH: 'refetch',
24
+ // legacy only
27
25
  REMOVE: 'remove' // legacy only
28
- });
29
-
30
- // Unused in Relay Modern
31
-
32
-
33
- // Unused in Relay Modern
34
26
 
27
+ });
35
28
 
36
29
  function convert(configs, request, optimisticUpdater, updater) {
37
30
  var configOptimisticUpdates = optimisticUpdater ? [optimisticUpdater] : [];
@@ -40,24 +33,32 @@ function convert(configs, request, optimisticUpdater, updater) {
40
33
  switch (config.type) {
41
34
  case 'NODE_DELETE':
42
35
  var nodeDeleteResult = nodeDelete(config, request);
36
+
43
37
  if (nodeDeleteResult) {
44
38
  configOptimisticUpdates.push(nodeDeleteResult);
45
39
  configUpdates.push(nodeDeleteResult);
46
40
  }
41
+
47
42
  break;
43
+
48
44
  case 'RANGE_ADD':
49
45
  var rangeAddResult = rangeAdd(config, request);
46
+
50
47
  if (rangeAddResult) {
51
48
  configOptimisticUpdates.push(rangeAddResult);
52
49
  configUpdates.push(rangeAddResult);
53
50
  }
51
+
54
52
  break;
53
+
55
54
  case 'RANGE_DELETE':
56
55
  var rangeDeleteResult = rangeDelete(config, request);
56
+
57
57
  if (rangeDeleteResult) {
58
58
  configOptimisticUpdates.push(rangeDeleteResult);
59
59
  configUpdates.push(rangeDeleteResult);
60
60
  }
61
+
61
62
  break;
62
63
  }
63
64
  });
@@ -77,21 +78,24 @@ function convert(configs, request, optimisticUpdater, updater) {
77
78
 
78
79
  function nodeDelete(config, request) {
79
80
  var deletedIDFieldName = config.deletedIDFieldName;
80
-
81
81
  var rootField = getRootField(request);
82
+
82
83
  if (!rootField) {
83
84
  return null;
84
85
  }
86
+
85
87
  return function (store, data) {
86
88
  var payload = store.getRootField(rootField);
89
+
87
90
  if (!payload) {
88
91
  return;
89
92
  }
93
+
90
94
  var deleteID = payload.getValue(deletedIDFieldName);
91
95
  var deleteIDs = Array.isArray(deleteID) ? deleteID : [deleteID];
92
96
  deleteIDs.forEach(function (id) {
93
97
  if (id && typeof id === 'string') {
94
- store['delete'](id);
98
+ store["delete"](id);
95
99
  }
96
100
  });
97
101
  };
@@ -103,22 +107,29 @@ function rangeAdd(config, request) {
103
107
  edgeName = config.edgeName;
104
108
 
105
109
  if (!parentID) {
106
- process.env.NODE_ENV !== 'production' ? require('fbjs/lib/warning')(false, 'RelayDeclarativeMutationConfig: For mutation config RANGE_ADD ' + 'to work you must include a parentID') : void 0;
110
+ process.env.NODE_ENV !== "production" ? require("fbjs/lib/warning")(false, 'RelayDeclarativeMutationConfig: For mutation config RANGE_ADD ' + 'to work you must include a parentID') : void 0;
107
111
  return null;
108
112
  }
113
+
109
114
  var rootField = getRootField(request);
115
+
110
116
  if (!connectionInfo || !rootField) {
111
117
  return null;
112
118
  }
119
+
113
120
  return function (store, data) {
114
121
  var parent = store.get(parentID);
122
+
115
123
  if (!parent) {
116
124
  return;
117
125
  }
126
+
118
127
  var payload = store.getRootField(rootField);
128
+
119
129
  if (!payload) {
120
130
  return;
121
131
  }
132
+
122
133
  var serverEdge = payload.getLinkedRecord(edgeName);
123
134
  var _iteratorNormalCompletion = true;
124
135
  var _didIteratorError = false;
@@ -131,26 +142,36 @@ function rangeAdd(config, request) {
131
142
  if (!serverEdge) {
132
143
  continue;
133
144
  }
134
- var connection = require('./RelayConnectionHandler').getConnection(parent, info.key, info.filters);
145
+
146
+ var connection = require("./RelayConnectionHandler").getConnection(parent, info.key, info.filters);
147
+
135
148
  if (!connection) {
136
149
  continue;
137
150
  }
138
- var clientEdge = require('./RelayConnectionHandler').buildConnectionEdge(store, connection, serverEdge);
151
+
152
+ var clientEdge = require("./RelayConnectionHandler").buildConnectionEdge(store, connection, serverEdge);
153
+
139
154
  if (!clientEdge) {
140
155
  continue;
141
156
  }
157
+
142
158
  switch (info.rangeBehavior) {
143
159
  case 'append':
144
- require('./RelayConnectionHandler').insertEdgeAfter(connection, clientEdge);
160
+ require("./RelayConnectionHandler").insertEdgeAfter(connection, clientEdge);
161
+
145
162
  break;
163
+
146
164
  case 'ignore':
147
165
  // Do nothing
148
166
  break;
167
+
149
168
  case 'prepend':
150
- require('./RelayConnectionHandler').insertEdgeBefore(connection, clientEdge);
169
+ require("./RelayConnectionHandler").insertEdgeBefore(connection, clientEdge);
170
+
151
171
  break;
172
+
152
173
  default:
153
- process.env.NODE_ENV !== 'production' ? require('fbjs/lib/warning')(false, 'RelayDeclarativeMutationConfig: RANGE_ADD range behavior `%s` ' + 'will not work as expected in RelayModern, supported range ' + "behaviors are 'append', 'prepend', and 'ignore'.", info.rangeBehavior) : void 0;
174
+ process.env.NODE_ENV !== "production" ? require("fbjs/lib/warning")(false, 'RelayDeclarativeMutationConfig: RANGE_ADD range behavior `%s` ' + 'will not work as expected in RelayModern, supported range ' + "behaviors are 'append', 'prepend', and 'ignore'.", info.rangeBehavior) : void 0;
154
175
  break;
155
176
  }
156
177
  }
@@ -159,8 +180,8 @@ function rangeAdd(config, request) {
159
180
  _iteratorError = err;
160
181
  } finally {
161
182
  try {
162
- if (!_iteratorNormalCompletion && _iterator['return']) {
163
- _iterator['return']();
183
+ if (!_iteratorNormalCompletion && _iterator["return"] != null) {
184
+ _iterator["return"]();
164
185
  }
165
186
  } finally {
166
187
  if (_didIteratorError) {
@@ -178,19 +199,24 @@ function rangeDelete(config, request) {
178
199
  deletedIDFieldName = config.deletedIDFieldName;
179
200
 
180
201
  if (!parentID) {
181
- process.env.NODE_ENV !== 'production' ? require('fbjs/lib/warning')(false, 'RelayDeclarativeMutationConfig: For mutation config RANGE_DELETE ' + 'to work you must include a parentID') : void 0;
202
+ process.env.NODE_ENV !== "production" ? require("fbjs/lib/warning")(false, 'RelayDeclarativeMutationConfig: For mutation config RANGE_DELETE ' + 'to work you must include a parentID') : void 0;
182
203
  return null;
183
204
  }
205
+
184
206
  var rootField = getRootField(request);
207
+
185
208
  if (!rootField) {
186
209
  return null;
187
210
  }
211
+
188
212
  return function (store, data) {
189
213
  if (!data) {
190
214
  return;
191
215
  }
216
+
192
217
  var deleteIDs = [];
193
218
  var deletedIDField = data[rootField];
219
+
194
220
  if (deletedIDField && Array.isArray(deletedIDFieldName)) {
195
221
  var _iteratorNormalCompletion2 = true;
196
222
  var _didIteratorError2 = false;
@@ -209,8 +235,8 @@ function rangeDelete(config, request) {
209
235
  _iteratorError2 = err;
210
236
  } finally {
211
237
  try {
212
- if (!_iteratorNormalCompletion2 && _iterator2['return']) {
213
- _iterator2['return']();
238
+ if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
239
+ _iterator2["return"]();
214
240
  }
215
241
  } finally {
216
242
  if (_didIteratorError2) {
@@ -230,6 +256,7 @@ function rangeDelete(config, request) {
230
256
  }
231
257
  } else if (deletedIDField && typeof deletedIDFieldName === 'string' && typeof deletedIDField === 'object') {
232
258
  deletedIDField = deletedIDField[deletedIDFieldName];
259
+
233
260
  if (typeof deletedIDField === 'string') {
234
261
  deleteIDs.push(deletedIDField);
235
262
  } else if (Array.isArray(deletedIDField)) {
@@ -240,31 +267,38 @@ function rangeDelete(config, request) {
240
267
  });
241
268
  }
242
269
  }
270
+
243
271
  deleteNode(parentID, connectionKeys, pathToConnection, store, deleteIDs);
244
272
  };
245
273
  }
246
274
 
247
275
  function deleteNode(parentID, connectionKeys, pathToConnection, store, deleteIDs) {
248
- process.env.NODE_ENV !== 'production' ? require('fbjs/lib/warning')(connectionKeys, 'RelayDeclarativeMutationConfig: RANGE_DELETE must provide a ' + 'connectionKeys') : void 0;
276
+ process.env.NODE_ENV !== "production" ? require("fbjs/lib/warning")(connectionKeys, 'RelayDeclarativeMutationConfig: RANGE_DELETE must provide a ' + 'connectionKeys') : void 0;
249
277
  var parent = store.get(parentID);
278
+
250
279
  if (!parent) {
251
280
  return;
252
281
  }
282
+
253
283
  if (pathToConnection.length < 2) {
254
- process.env.NODE_ENV !== 'production' ? require('fbjs/lib/warning')(false, 'RelayDeclarativeMutationConfig: RANGE_DELETE ' + 'pathToConnection must include at least parent and connection') : void 0;
284
+ process.env.NODE_ENV !== "production" ? require("fbjs/lib/warning")(false, 'RelayDeclarativeMutationConfig: RANGE_DELETE ' + 'pathToConnection must include at least parent and connection') : void 0;
255
285
  return;
256
286
  }
287
+
257
288
  var recordProxy = parent;
289
+
258
290
  for (var i = 1; i < pathToConnection.length - 1; i++) {
259
291
  if (recordProxy) {
260
292
  recordProxy = recordProxy.getLinkedRecord(pathToConnection[i]);
261
293
  }
262
- }
263
- // Should never enter loop except edge cases
294
+ } // Should never enter loop except edge cases
295
+
296
+
264
297
  if (!connectionKeys || !recordProxy) {
265
- process.env.NODE_ENV !== 'production' ? require('fbjs/lib/warning')(false, 'RelayDeclarativeMutationConfig: RANGE_DELETE ' + 'pathToConnection is incorrect. Unable to find connection with ' + 'parentID: %s and path: %s', parentID, pathToConnection.toString()) : void 0;
298
+ process.env.NODE_ENV !== "production" ? require("fbjs/lib/warning")(false, 'RelayDeclarativeMutationConfig: RANGE_DELETE ' + 'pathToConnection is incorrect. Unable to find connection with ' + 'parentID: %s and path: %s', parentID, pathToConnection.toString()) : void 0;
266
299
  return;
267
300
  }
301
+
268
302
  var _iteratorNormalCompletion3 = true;
269
303
  var _didIteratorError3 = false;
270
304
  var _iteratorError3 = undefined;
@@ -273,10 +307,11 @@ function deleteNode(parentID, connectionKeys, pathToConnection, store, deleteIDs
273
307
  var _loop = function _loop() {
274
308
  var key = _step3.value;
275
309
 
276
- var connection = require('./RelayConnectionHandler').getConnection(recordProxy, key.key, key.filters);
310
+ var connection = require("./RelayConnectionHandler").getConnection(recordProxy, key.key, key.filters);
311
+
277
312
  if (connection) {
278
313
  deleteIDs.forEach(function (deleteID) {
279
- require('./RelayConnectionHandler').deleteNode(connection, deleteID);
314
+ require("./RelayConnectionHandler").deleteNode(connection, deleteID);
280
315
  });
281
316
  }
282
317
  };
@@ -289,8 +324,8 @@ function deleteNode(parentID, connectionKeys, pathToConnection, store, deleteIDs
289
324
  _iteratorError3 = err;
290
325
  } finally {
291
326
  try {
292
- if (!_iteratorNormalCompletion3 && _iterator3['return']) {
293
- _iterator3['return']();
327
+ if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) {
328
+ _iterator3["return"]();
294
329
  }
295
330
  } finally {
296
331
  if (_didIteratorError3) {
@@ -304,12 +339,12 @@ function getRootField(request) {
304
339
  if (request.fragment.selections && request.fragment.selections.length > 0 && request.fragment.selections[0].kind === 'LinkedField') {
305
340
  return request.fragment.selections[0].name;
306
341
  }
342
+
307
343
  return null;
308
344
  }
309
345
 
310
346
  module.exports = {
311
347
  MutationTypes: MutationTypes,
312
348
  RangeOperations: RangeOperations,
313
-
314
349
  convert: convert
315
350
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright (c) Facebook, Inc. and its 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.
@@ -7,7 +7,6 @@
7
7
  * strict
8
8
  * @format
9
9
  */
10
-
11
10
  'use strict';
12
11
 
13
12
  module.exports = {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright (c) Facebook, Inc. and its 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.
@@ -7,17 +7,18 @@
7
7
  * strict-local
8
8
  * @format
9
9
  */
10
-
11
10
  'use strict';
12
11
 
13
12
  function RelayDefaultHandlerProvider(handle) {
14
13
  switch (handle) {
15
14
  case 'connection':
16
- return require('./RelayConnectionHandler');
15
+ return require("./RelayConnectionHandler");
16
+
17
17
  case 'viewer':
18
- return require('./RelayViewerHandler');
18
+ return require("./RelayViewerHandler");
19
19
  }
20
- !false ? process.env.NODE_ENV !== 'production' ? require('fbjs/lib/invariant')(false, 'RelayDefaultHandlerProvider: No handler provided for `%s`.', handle) : require('fbjs/lib/invariant')(false) : void 0;
20
+
21
+ !false ? process.env.NODE_ENV !== "production" ? require("fbjs/lib/invariant")(false, 'RelayDefaultHandlerProvider: No handler provided for `%s`.', handle) : require("fbjs/lib/invariant")(false) : void 0;
21
22
  }
22
23
 
23
24
  module.exports = RelayDefaultHandlerProvider;
package/lib/RelayError.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright (c) Facebook, Inc. and its 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.
@@ -7,12 +7,9 @@
7
7
  *
8
8
  * @format
9
9
  */
10
-
11
10
  'use strict';
12
11
 
13
- var _toConsumableArray3 = _interopRequireDefault(require('babel-runtime/helpers/toConsumableArray'));
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
12
+ var _toConsumableArray2 = require("@babel/runtime/helpers/interopRequireDefault")(require("@babel/runtime/helpers/toConsumableArray"));
16
13
 
17
14
  /**
18
15
  * @internal
@@ -21,26 +18,26 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'd
21
18
  */
22
19
  var RelayError = {
23
20
  create: function create(name, format) {
24
- for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
21
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
25
22
  args[_key - 2] = arguments[_key];
26
23
  }
27
24
 
28
25
  return createError('mustfix', name, format, args);
29
26
  },
30
27
  createWarning: function createWarning(name, format) {
31
- for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
28
+ for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
32
29
  args[_key2 - 2] = arguments[_key2];
33
30
  }
34
31
 
35
32
  return createError('warn', name, format, args);
36
33
  }
37
34
  };
38
-
39
35
  /**
40
36
  * @private
41
37
  */
38
+
42
39
  function createError(type, name, format, args) {
43
- var error = new Error(require('fbjs/lib/sprintf').apply(undefined, [format].concat((0, _toConsumableArray3['default'])(args))));
40
+ var error = new Error(require("fbjs/lib/sprintf").apply(void 0, [format].concat((0, _toConsumableArray2["default"])(args))));
44
41
  error.name = name;
45
42
  error.type = type;
46
43
  error.framesToPop = 2;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright (c) Facebook, Inc. and its 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.
@@ -7,68 +7,66 @@
7
7
  *
8
8
  * @format
9
9
  */
10
-
11
10
  'use strict';
12
11
 
13
- var _classCallCheck3 = _interopRequireDefault(require('babel-runtime/helpers/classCallCheck'));
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
16
-
17
12
  /**
18
13
  * An implementation of the `MutableRecordSource` interface (defined in
19
14
  * `RelayStoreTypes`) that holds all records in memory.
20
15
  */
21
- var RelayInMemoryRecordSource = function () {
16
+ var RelayInMemoryRecordSource =
17
+ /*#__PURE__*/
18
+ function () {
22
19
  function RelayInMemoryRecordSource(records) {
23
- (0, _classCallCheck3['default'])(this, RelayInMemoryRecordSource);
24
-
25
20
  this._records = records || {};
26
21
  }
27
22
 
28
- RelayInMemoryRecordSource.prototype.clear = function clear() {
23
+ var _proto = RelayInMemoryRecordSource.prototype;
24
+
25
+ _proto.clear = function clear() {
29
26
  this._records = {};
30
27
  };
31
28
 
32
- RelayInMemoryRecordSource.prototype['delete'] = function _delete(dataID) {
29
+ _proto["delete"] = function _delete(dataID) {
33
30
  this._records[dataID] = null;
34
31
  };
35
32
 
36
- RelayInMemoryRecordSource.prototype.get = function get(dataID) {
33
+ _proto.get = function get(dataID) {
37
34
  return this._records[dataID];
38
35
  };
39
36
 
40
- RelayInMemoryRecordSource.prototype.getRecordIDs = function getRecordIDs() {
37
+ _proto.getRecordIDs = function getRecordIDs() {
41
38
  return Object.keys(this._records);
42
39
  };
43
40
 
44
- RelayInMemoryRecordSource.prototype.getStatus = function getStatus(dataID) {
41
+ _proto.getStatus = function getStatus(dataID) {
45
42
  if (!this._records.hasOwnProperty(dataID)) {
46
- return require('./RelayRecordState').UNKNOWN;
43
+ return require("./RelayRecordState").UNKNOWN;
47
44
  }
48
- return this._records[dataID] == null ? require('./RelayRecordState').NONEXISTENT : require('./RelayRecordState').EXISTENT;
45
+
46
+ return this._records[dataID] == null ? require("./RelayRecordState").NONEXISTENT : require("./RelayRecordState").EXISTENT;
49
47
  };
50
48
 
51
- RelayInMemoryRecordSource.prototype.has = function has(dataID) {
49
+ _proto.has = function has(dataID) {
52
50
  return this._records.hasOwnProperty(dataID);
53
51
  };
54
52
 
55
- RelayInMemoryRecordSource.prototype.load = function load(dataID, callback) {
53
+ _proto.load = function load(dataID, callback) {
56
54
  callback(null, this.get(dataID));
57
55
  };
58
56
 
59
- RelayInMemoryRecordSource.prototype.remove = function remove(dataID) {
57
+ _proto.remove = function remove(dataID) {
60
58
  delete this._records[dataID];
61
59
  };
62
60
 
63
- RelayInMemoryRecordSource.prototype.set = function set(dataID, record) {
61
+ _proto.set = function set(dataID, record) {
64
62
  this._records[dataID] = record;
65
63
  };
66
64
 
67
- RelayInMemoryRecordSource.prototype.size = function size() {
65
+ _proto.size = function size() {
68
66
  return Object.keys(this._records).length;
69
67
  };
70
68
 
71
- RelayInMemoryRecordSource.prototype.toJSON = function toJSON() {
69
+ _proto.toJSON = function toJSON() {
72
70
  return this._records;
73
71
  };
74
72