relay-runtime 0.0.0-main-90bee398 → 0.0.0-main-8723bd66

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 (44) hide show
  1. package/handlers/connection/ConnectionHandler.js.flow +0 -7
  2. package/handlers/connection/MutationHandlers.js.flow +0 -3
  3. package/index.js +1 -1
  4. package/index.js.flow +7 -0
  5. package/lib/handlers/connection/ConnectionHandler.js +5 -11
  6. package/lib/handlers/connection/MutationHandlers.js +3 -6
  7. package/lib/multi-actor-environment/ActorSpecificEnvironment.js +4 -0
  8. package/lib/multi-actor-environment/MultiActorEnvironment.js +27 -14
  9. package/lib/mutations/commitMutation.js +1 -4
  10. package/lib/network/RelayObservable.js +1 -3
  11. package/lib/store/DataChecker.js +1 -2
  12. package/lib/store/RelayConcreteVariables.js +3 -7
  13. package/lib/store/RelayModernEnvironment.js +55 -31
  14. package/lib/store/RelayModernStore.js +1 -2
  15. package/lib/store/RelayReader.js +1 -2
  16. package/lib/store/RelayReferenceMarker.js +1 -2
  17. package/lib/store/RelayResponseNormalizer.js +1 -2
  18. package/lib/store/RelayStoreUtils.js +1 -2
  19. package/lib/subscription/requestSubscription.js +1 -1
  20. package/lib/util/RelayRuntimeTypes.js +0 -6
  21. package/lib/util/getPaginationVariables.js +2 -3
  22. package/multi-actor-environment/ActorSpecificEnvironment.js.flow +7 -1
  23. package/multi-actor-environment/MultiActorEnvironment.js.flow +25 -0
  24. package/multi-actor-environment/MultiActorEnvironmentTypes.js.flow +17 -2
  25. package/mutations/commitMutation.js.flow +0 -2
  26. package/network/RelayObservable.js.flow +0 -2
  27. package/package.json +1 -1
  28. package/relay-runtime.js +2 -2
  29. package/relay-runtime.min.js +2 -2
  30. package/store/ClientID.js.flow +1 -1
  31. package/store/DataChecker.js.flow +0 -1
  32. package/store/RelayConcreteVariables.js.flow +0 -5
  33. package/store/RelayModernEnvironment.js.flow +29 -1
  34. package/store/RelayModernStore.js.flow +0 -1
  35. package/store/RelayReader.js.flow +0 -1
  36. package/store/RelayReferenceMarker.js.flow +0 -1
  37. package/store/RelayResponseNormalizer.js.flow +0 -1
  38. package/store/RelayStoreTypes.js.flow +14 -2
  39. package/store/RelayStoreUtils.js.flow +0 -1
  40. package/store/TypeID.js.flow +1 -1
  41. package/subscription/requestSubscription.js.flow +1 -1
  42. package/util/RelayFeatureFlags.js.flow +1 -1
  43. package/util/RelayRuntimeTypes.js.flow +68 -1
  44. package/util/getPaginationVariables.js.flow +0 -2
@@ -144,12 +144,10 @@ function update(store: RecordSourceProxy, payload: HandleFieldPayload): void {
144
144
  let nextEdges = [];
145
145
  const args = payload.args;
146
146
  if (prevEdges && serverEdges) {
147
- // $FlowFixMe[prop-missing]
148
147
  if (args.after != null) {
149
148
  // Forward pagination from the end of the connection: append edges
150
149
  if (
151
150
  clientPageInfo &&
152
- // $FlowFixMe[prop-missing]
153
151
  args.after === clientPageInfo.getValue(END_CURSOR)
154
152
  ) {
155
153
  const nodeIDs = new Set();
@@ -165,12 +163,10 @@ function update(store: RecordSourceProxy, payload: HandleFieldPayload): void {
165
163
  );
166
164
  return;
167
165
  }
168
- // $FlowFixMe[prop-missing]
169
166
  } else if (args.before != null) {
170
167
  // Backward pagination from the start of the connection: prepend edges
171
168
  if (
172
169
  clientPageInfo &&
173
- // $FlowFixMe[prop-missing]
174
170
  args.before === clientPageInfo.getValue(START_CURSOR)
175
171
  ) {
176
172
  const nodeIDs = new Set();
@@ -202,12 +198,10 @@ function update(store: RecordSourceProxy, payload: HandleFieldPayload): void {
202
198
  }
203
199
  // Page info should be updated even if no new edge were returned.
204
200
  if (clientPageInfo && serverPageInfo) {
205
- // $FlowFixMe[prop-missing]
206
201
  if (args.after == null && args.before == null) {
207
202
  // The connection was refetched from the beginning/end: replace
208
203
  // page_info
209
204
  clientPageInfo.copyFieldsFrom(serverPageInfo);
210
- // $FlowFixMe[prop-missing]
211
205
  } else if (args.before != null || (args.after == null && args.last)) {
212
206
  clientPageInfo.setValue(
213
207
  !!serverPageInfo.getValue(HAS_PREV_PAGE),
@@ -217,7 +211,6 @@ function update(store: RecordSourceProxy, payload: HandleFieldPayload): void {
217
211
  if (typeof startCursor === 'string') {
218
212
  clientPageInfo.setValue(startCursor, START_CURSOR);
219
213
  }
220
- // $FlowFixMe[prop-missing]
221
214
  } else if (args.after != null || (args.before == null && args.first)) {
222
215
  clientPageInfo.setValue(
223
216
  !!serverPageInfo.getValue(HAS_NEXT_PAGE),
@@ -50,7 +50,6 @@ const DeleteEdgeHandler = {
50
50
  if (record == null) {
51
51
  return;
52
52
  }
53
- // $FlowFixMe[prop-missing]
54
53
  const {connections} = payload.handleArgs;
55
54
  invariant(
56
55
  connections != null,
@@ -100,7 +99,6 @@ function edgeUpdater(
100
99
  if (record == null) {
101
100
  return;
102
101
  }
103
- // $FlowFixMe[prop-missing]
104
102
  const {connections} = payload.handleArgs;
105
103
  invariant(
106
104
  connections != null,
@@ -173,7 +171,6 @@ function nodeUpdater(
173
171
  if (record == null) {
174
172
  return;
175
173
  }
176
- // $FlowFixMe[prop-missing]
177
174
  const {connections, edgeTypeName} = payload.handleArgs;
178
175
  invariant(
179
176
  connections != null,
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v0.0.0-main-90bee398
2
+ * Relay v0.0.0-main-8723bd66
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
5
5
  *
package/index.js.flow CHANGED
@@ -210,7 +210,14 @@ export type {
210
210
  Disposable,
211
211
  FetchPolicy,
212
212
  FetchQueryFetchPolicy,
213
+ Fragment,
214
+ GraphQLSubscription,
215
+ InlineFragment,
216
+ Mutation,
217
+ Operation,
213
218
  OperationType,
219
+ Query,
220
+ RefetchableFragment,
214
221
  RenderPolicy,
215
222
  Variables,
216
223
  VariablesOf,
@@ -133,23 +133,19 @@ function update(store, payload) {
133
133
  var args = payload.args;
134
134
 
135
135
  if (prevEdges && _serverEdges) {
136
- // $FlowFixMe[prop-missing]
137
136
  if (args.after != null) {
138
137
  // Forward pagination from the end of the connection: append edges
139
- if (clientPageInfo && // $FlowFixMe[prop-missing]
140
- args.after === clientPageInfo.getValue(END_CURSOR)) {
138
+ if (clientPageInfo && args.after === clientPageInfo.getValue(END_CURSOR)) {
141
139
  var nodeIDs = new Set();
142
140
  mergeEdges(prevEdges, nextEdges, nodeIDs);
143
141
  mergeEdges(_serverEdges, nextEdges, nodeIDs);
144
142
  } else {
145
143
  process.env.NODE_ENV !== "production" ? warning(false, 'Relay: Unexpected after cursor `%s`, edges must ' + 'be fetched from the end of the list (`%s`).', args.after, clientPageInfo && clientPageInfo.getValue(END_CURSOR)) : void 0;
146
144
  return;
147
- } // $FlowFixMe[prop-missing]
148
-
145
+ }
149
146
  } else if (args.before != null) {
150
147
  // Backward pagination from the start of the connection: prepend edges
151
- if (clientPageInfo && // $FlowFixMe[prop-missing]
152
- args.before === clientPageInfo.getValue(START_CURSOR)) {
148
+ if (clientPageInfo && args.before === clientPageInfo.getValue(START_CURSOR)) {
153
149
  var _nodeIDs = new Set();
154
150
 
155
151
  mergeEdges(_serverEdges, nextEdges, _nodeIDs);
@@ -176,19 +172,17 @@ function update(store, payload) {
176
172
 
177
173
 
178
174
  if (clientPageInfo && serverPageInfo) {
179
- // $FlowFixMe[prop-missing]
180
175
  if (args.after == null && args.before == null) {
181
176
  // The connection was refetched from the beginning/end: replace
182
177
  // page_info
183
- clientPageInfo.copyFieldsFrom(serverPageInfo); // $FlowFixMe[prop-missing]
178
+ clientPageInfo.copyFieldsFrom(serverPageInfo);
184
179
  } else if (args.before != null || args.after == null && args.last) {
185
180
  clientPageInfo.setValue(!!serverPageInfo.getValue(HAS_PREV_PAGE), HAS_PREV_PAGE);
186
181
  var startCursor = serverPageInfo.getValue(START_CURSOR);
187
182
 
188
183
  if (typeof startCursor === 'string') {
189
184
  clientPageInfo.setValue(startCursor, START_CURSOR);
190
- } // $FlowFixMe[prop-missing]
191
-
185
+ }
192
186
  } else if (args.after != null || args.before == null && args.first) {
193
187
  clientPageInfo.setValue(!!serverPageInfo.getValue(HAS_NEXT_PAGE), HAS_NEXT_PAGE);
194
188
  var endCursor = serverPageInfo.getValue(END_CURSOR);
@@ -47,8 +47,7 @@ var DeleteEdgeHandler = {
47
47
 
48
48
  if (record == null) {
49
49
  return;
50
- } // $FlowFixMe[prop-missing]
51
-
50
+ }
52
51
 
53
52
  var connections = payload.handleArgs.connections;
54
53
  !(connections != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'MutationHandlers: Expected connection IDs to be specified.') : invariant(false) : void 0;
@@ -101,8 +100,7 @@ function edgeUpdater(insertFn) {
101
100
 
102
101
  if (record == null) {
103
102
  return;
104
- } // $FlowFixMe[prop-missing]
105
-
103
+ }
106
104
 
107
105
  var connections = payload.handleArgs.connections;
108
106
  !(connections != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'MutationHandlers: Expected connection IDs to be specified.') : invariant(false) : void 0;
@@ -205,8 +203,7 @@ function nodeUpdater(insertFn) {
205
203
 
206
204
  if (record == null) {
207
205
  return;
208
- } // $FlowFixMe[prop-missing]
209
-
206
+ }
210
207
 
211
208
  var _payload$handleArgs = payload.handleArgs,
212
209
  connections = _payload$handleArgs.connections,
@@ -126,6 +126,10 @@ var ActorSpecificEnvironment = /*#__PURE__*/function () {
126
126
  return this.multiActorEnvironment.execute(this, config);
127
127
  };
128
128
 
129
+ _proto.executeSubscription = function executeSubscription(config) {
130
+ return this.multiActorEnvironment.executeSubscription(this, config);
131
+ };
132
+
129
133
  _proto.executeMutation = function executeMutation(options) {
130
134
  return this.multiActorEnvironment.executeMutation(this, options);
131
135
  };
@@ -258,8 +258,7 @@ var MultiActorEnvironment = /*#__PURE__*/function () {
258
258
  };
259
259
 
260
260
  _proto.execute = function execute(actorEnvironment, _ref) {
261
- var operation = _ref.operation,
262
- updater = _ref.updater;
261
+ var operation = _ref.operation;
263
262
  return this._execute(actorEnvironment, {
264
263
  createSource: function createSource() {
265
264
  return actorEnvironment.getNetwork().execute(operation.request.node.params, operation.request.variables, operation.request.cacheConfig || {}, null);
@@ -267,16 +266,30 @@ var MultiActorEnvironment = /*#__PURE__*/function () {
267
266
  isClientPayload: false,
268
267
  operation: operation,
269
268
  optimisticConfig: null,
270
- updater: updater
269
+ updater: null
271
270
  });
272
271
  };
273
272
 
274
- _proto.executeMutation = function executeMutation(actorEnvironment, _ref2) {
273
+ _proto.executeSubscription = function executeSubscription(actorEnvironment, _ref2) {
275
274
  var operation = _ref2.operation,
276
- optimisticResponse = _ref2.optimisticResponse,
277
- optimisticUpdater = _ref2.optimisticUpdater,
278
- updater = _ref2.updater,
279
- uploadables = _ref2.uploadables;
275
+ updater = _ref2.updater;
276
+ return this._execute(actorEnvironment, {
277
+ createSource: function createSource() {
278
+ return actorEnvironment.getNetwork().execute(operation.request.node.params, operation.request.variables, operation.request.cacheConfig || {}, null);
279
+ },
280
+ isClientPayload: false,
281
+ operation: operation,
282
+ optimisticConfig: null,
283
+ updater: updater
284
+ });
285
+ };
286
+
287
+ _proto.executeMutation = function executeMutation(actorEnvironment, _ref3) {
288
+ var operation = _ref3.operation,
289
+ optimisticResponse = _ref3.optimisticResponse,
290
+ optimisticUpdater = _ref3.optimisticUpdater,
291
+ updater = _ref3.updater,
292
+ uploadables = _ref3.uploadables;
280
293
  var optimisticConfig;
281
294
 
282
295
  if (optimisticResponse || optimisticUpdater) {
@@ -322,14 +335,14 @@ var MultiActorEnvironment = /*#__PURE__*/function () {
322
335
  return this._isServer;
323
336
  };
324
337
 
325
- _proto._execute = function _execute(actorEnvironment, _ref3) {
338
+ _proto._execute = function _execute(actorEnvironment, _ref4) {
326
339
  var _this4 = this;
327
340
 
328
- var createSource = _ref3.createSource,
329
- isClientPayload = _ref3.isClientPayload,
330
- operation = _ref3.operation,
331
- optimisticConfig = _ref3.optimisticConfig,
332
- updater = _ref3.updater;
341
+ var createSource = _ref4.createSource,
342
+ isClientPayload = _ref4.isClientPayload,
343
+ operation = _ref4.operation,
344
+ optimisticConfig = _ref4.optimisticConfig,
345
+ updater = _ref4.updater;
333
346
  return RelayObservable.create(function (sink) {
334
347
  var executor = OperationExecutor.execute({
335
348
  actorIdentifier: actorEnvironment.actorIdentifier,
@@ -58,10 +58,7 @@ function commitMutation(environment, config) {
58
58
  onUnsubscribe = config.onUnsubscribe,
59
59
  variables = config.variables,
60
60
  uploadables = config.uploadables;
61
- var operation = createOperationDescriptor(mutation,
62
- /* $FlowFixMe[class-object-subtyping] added when improving typing for this
63
- * parameters */
64
- variables, cacheConfig, generateUniqueClientID()); // TODO: remove this check after we fix flow.
61
+ var operation = createOperationDescriptor(mutation, variables, cacheConfig, generateUniqueClientID()); // TODO: remove this check after we fix flow.
65
62
 
66
63
  if (typeof optimisticResponse === 'function') {
67
64
  optimisticResponse = optimisticResponse();
@@ -332,15 +332,13 @@ var RelayObservable = /*#__PURE__*/function () {
332
332
  if (subscriptions.length === 0) {
333
333
  sink.complete();
334
334
  }
335
- } // $FlowFixMe[incompatible-call]
336
-
335
+ }
337
336
 
338
337
  _this7.subscribe({
339
338
  start: start,
340
339
  next: function next(value) {
341
340
  try {
342
341
  if (!sink.closed) {
343
- // $FlowFixMe[incompatible-call]
344
342
  RelayObservable.from(fn(value)).subscribe({
345
343
  start: start,
346
344
  next: sink.next,
@@ -145,8 +145,7 @@ var DataChecker = /*#__PURE__*/function () {
145
145
  };
146
146
 
147
147
  _proto._getVariableValue = function _getVariableValue(name) {
148
- !this._variables.hasOwnProperty(name) ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayAsyncLoader(): Undefined variable `%s`.', name) : invariant(false) : void 0; // $FlowFixMe[cannot-write]
149
-
148
+ !this._variables.hasOwnProperty(name) ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayAsyncLoader(): Undefined variable `%s`.', name) : invariant(false) : void 0;
150
149
  return this._variables[name];
151
150
  };
152
151
 
@@ -32,8 +32,7 @@ function getFragmentVariables(fragment, rootVariables, argumentVariables) {
32
32
  fragment.argumentDefinitions.forEach(function (definition) {
33
33
  if (argumentVariables.hasOwnProperty(definition.name)) {
34
34
  return;
35
- } // $FlowFixMe[cannot-spread-interface]
36
-
35
+ }
37
36
 
38
37
  variables = variables || (0, _objectSpread2["default"])({}, argumentVariables);
39
38
 
@@ -53,12 +52,9 @@ function getFragmentVariables(fragment, rootVariables, argumentVariables) {
53
52
  * RelayStoreUtils.getStableVariableValue() that variable keys are all
54
53
  * present.
55
54
  */
56
- // $FlowFixMe[incompatible-use]
57
55
  variables[definition.name] = undefined;
58
56
  break;
59
- } // $FlowFixMe[incompatible-use]
60
- // $FlowFixMe[cannot-write]
61
-
57
+ }
62
58
 
63
59
  variables[definition.name] = rootVariables[definition.name];
64
60
  break;
@@ -81,7 +77,7 @@ function getFragmentVariables(fragment, rootVariables, argumentVariables) {
81
77
  function getOperationVariables(operation, variables) {
82
78
  var operationVariables = {};
83
79
  operation.argumentDefinitions.forEach(function (def) {
84
- var value = def.defaultValue; // $FlowFixMe[cannot-write]
80
+ var value = def.defaultValue;
85
81
 
86
82
  if (variables[def.name] != null) {
87
83
  value = variables[def.name];
@@ -277,7 +277,7 @@ var RelayModernEnvironment = /*#__PURE__*/function () {
277
277
  }
278
278
  /**
279
279
  * Returns an Observable of GraphQLResponse resulting from executing the
280
- * provided Query or Subscription operation, each result of which is then
280
+ * provided Query operation, each result of which is then
281
281
  * normalized and committed to the publish queue.
282
282
  *
283
283
  * Note: Observables are lazy, so calling this method will do nothing until
@@ -288,8 +288,7 @@ var RelayModernEnvironment = /*#__PURE__*/function () {
288
288
  _proto.execute = function execute(_ref) {
289
289
  var _this7 = this;
290
290
 
291
- var operation = _ref.operation,
292
- updater = _ref.updater;
291
+ var operation = _ref.operation;
293
292
  return this._execute({
294
293
  createSource: function createSource() {
295
294
  return _this7._network.execute(operation.request.node.params, operation.request.variables, operation.request.cacheConfig || {}, null);
@@ -297,6 +296,31 @@ var RelayModernEnvironment = /*#__PURE__*/function () {
297
296
  isClientPayload: false,
298
297
  operation: operation,
299
298
  optimisticConfig: null,
299
+ updater: null
300
+ });
301
+ }
302
+ /**
303
+ * Returns an Observable of GraphQLResponse resulting from executing the
304
+ * provided Subscription operation, each result of which is then
305
+ * normalized and committed to the publish queue.
306
+ *
307
+ * Note: Observables are lazy, so calling this method will do nothing until
308
+ * the result is subscribed to: environment.execute({...}).subscribe({...}).
309
+ */
310
+ ;
311
+
312
+ _proto.executeSubscription = function executeSubscription(_ref2) {
313
+ var _this8 = this;
314
+
315
+ var operation = _ref2.operation,
316
+ updater = _ref2.updater;
317
+ return this._execute({
318
+ createSource: function createSource() {
319
+ return _this8._network.execute(operation.request.node.params, operation.request.variables, operation.request.cacheConfig || {}, null);
320
+ },
321
+ isClientPayload: false,
322
+ operation: operation,
323
+ optimisticConfig: null,
300
324
  updater: updater
301
325
  });
302
326
  }
@@ -312,14 +336,14 @@ var RelayModernEnvironment = /*#__PURE__*/function () {
312
336
  */
313
337
  ;
314
338
 
315
- _proto.executeMutation = function executeMutation(_ref2) {
316
- var _this8 = this;
339
+ _proto.executeMutation = function executeMutation(_ref3) {
340
+ var _this9 = this;
317
341
 
318
- var operation = _ref2.operation,
319
- optimisticResponse = _ref2.optimisticResponse,
320
- optimisticUpdater = _ref2.optimisticUpdater,
321
- updater = _ref2.updater,
322
- uploadables = _ref2.uploadables;
342
+ var operation = _ref3.operation,
343
+ optimisticResponse = _ref3.optimisticResponse,
344
+ optimisticUpdater = _ref3.optimisticUpdater,
345
+ updater = _ref3.updater,
346
+ uploadables = _ref3.uploadables;
323
347
  var optimisticConfig;
324
348
 
325
349
  if (optimisticResponse || optimisticUpdater) {
@@ -332,7 +356,7 @@ var RelayModernEnvironment = /*#__PURE__*/function () {
332
356
 
333
357
  return this._execute({
334
358
  createSource: function createSource() {
335
- return _this8._network.execute(operation.request.node.params, operation.request.variables, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, operation.request.cacheConfig), {}, {
359
+ return _this9._network.execute(operation.request.node.params, operation.request.variables, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, operation.request.cacheConfig), {}, {
336
360
  force: true
337
361
  }), uploadables);
338
362
  },
@@ -353,9 +377,9 @@ var RelayModernEnvironment = /*#__PURE__*/function () {
353
377
  */
354
378
  ;
355
379
 
356
- _proto.executeWithSource = function executeWithSource(_ref3) {
357
- var operation = _ref3.operation,
358
- source = _ref3.source;
380
+ _proto.executeWithSource = function executeWithSource(_ref4) {
381
+ var operation = _ref4.operation,
382
+ source = _ref4.source;
359
383
  return this._execute({
360
384
  createSource: function createSource() {
361
385
  return source;
@@ -373,35 +397,35 @@ var RelayModernEnvironment = /*#__PURE__*/function () {
373
397
  return "RelayModernEnvironment(".concat((_this$configName = this.configName) !== null && _this$configName !== void 0 ? _this$configName : '', ")");
374
398
  };
375
399
 
376
- _proto._execute = function _execute(_ref4) {
377
- var _this9 = this;
400
+ _proto._execute = function _execute(_ref5) {
401
+ var _this10 = this;
378
402
 
379
- var createSource = _ref4.createSource,
380
- isClientPayload = _ref4.isClientPayload,
381
- operation = _ref4.operation,
382
- optimisticConfig = _ref4.optimisticConfig,
383
- updater = _ref4.updater;
403
+ var createSource = _ref5.createSource,
404
+ isClientPayload = _ref5.isClientPayload,
405
+ operation = _ref5.operation,
406
+ optimisticConfig = _ref5.optimisticConfig,
407
+ updater = _ref5.updater;
384
408
  var publishQueue = this._publishQueue;
385
409
  var store = this._store;
386
410
  return RelayObservable.create(function (sink) {
387
411
  var executor = OperationExecutor.execute({
388
412
  actorIdentifier: INTERNAL_ACTOR_IDENTIFIER_DO_NOT_USE,
389
- getDataID: _this9._getDataID,
413
+ getDataID: _this10._getDataID,
390
414
  isClientPayload: isClientPayload,
391
- log: _this9.__log,
415
+ log: _this10.__log,
392
416
  operation: operation,
393
- operationExecutions: _this9._operationExecutions,
394
- operationLoader: _this9._operationLoader,
395
- operationTracker: _this9._operationTracker,
417
+ operationExecutions: _this10._operationExecutions,
418
+ operationLoader: _this10._operationLoader,
419
+ operationTracker: _this10._operationTracker,
396
420
  optimisticConfig: optimisticConfig,
397
421
  getPublishQueue: function getPublishQueue(actorIdentifier) {
398
422
  assertInternalActorIndentifier(actorIdentifier);
399
423
  return publishQueue;
400
424
  },
401
- reactFlightPayloadDeserializer: _this9._reactFlightPayloadDeserializer,
402
- reactFlightServerErrorHandler: _this9._reactFlightServerErrorHandler,
403
- scheduler: _this9._scheduler,
404
- shouldProcessClientComponents: _this9._shouldProcessClientComponents,
425
+ reactFlightPayloadDeserializer: _this10._reactFlightPayloadDeserializer,
426
+ reactFlightServerErrorHandler: _this10._reactFlightServerErrorHandler,
427
+ scheduler: _this10._scheduler,
428
+ shouldProcessClientComponents: _this10._shouldProcessClientComponents,
405
429
  sink: sink,
406
430
  // NOTE: Some product tests expect `Network.execute` to be called only
407
431
  // when the Observable is executed.
@@ -410,7 +434,7 @@ var RelayModernEnvironment = /*#__PURE__*/function () {
410
434
  assertInternalActorIndentifier(actorIdentifier);
411
435
  return store;
412
436
  },
413
- treatMissingFieldsAsNull: _this9._treatMissingFieldsAsNull,
437
+ treatMissingFieldsAsNull: _this10._treatMissingFieldsAsNull,
414
438
  updater: updater
415
439
  });
416
440
  return function () {
@@ -680,8 +680,7 @@ function updateTargetFromSource(target, source, currentWriteEpoch, idsMarkedForI
680
680
  }
681
681
 
682
682
  RelayModernRecord.setValue(nextRecord, RelayStoreUtils.INVALIDATED_AT_KEY, currentWriteEpoch);
683
- invalidatedRecordIDs.add(dataID); // $FlowFixMe[incompatible-call]
684
-
683
+ invalidatedRecordIDs.add(dataID);
685
684
  target.set(dataID, nextRecord);
686
685
  });
687
686
  } // Update the target based on the changes present in source
@@ -179,8 +179,7 @@ var RelayReader = /*#__PURE__*/function () {
179
179
  };
180
180
 
181
181
  _proto._getVariableValue = function _getVariableValue(name) {
182
- !this._variables.hasOwnProperty(name) ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayReader(): Undefined variable `%s`.', name) : invariant(false) : void 0; // $FlowFixMe[cannot-write]
183
-
182
+ !this._variables.hasOwnProperty(name) ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayReader(): Undefined variable `%s`.', name) : invariant(false) : void 0;
184
183
  return this._variables[name];
185
184
  };
186
185
 
@@ -100,8 +100,7 @@ var RelayReferenceMarker = /*#__PURE__*/function () {
100
100
  };
101
101
 
102
102
  _proto._getVariableValue = function _getVariableValue(name) {
103
- !this._variables.hasOwnProperty(name) ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayReferenceMarker(): Undefined variable `%s`.', name) : invariant(false) : void 0; // $FlowFixMe[cannot-write]
104
-
103
+ !this._variables.hasOwnProperty(name) ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayReferenceMarker(): Undefined variable `%s`.', name) : invariant(false) : void 0;
105
104
  return this._variables[name];
106
105
  };
107
106
 
@@ -133,8 +133,7 @@ var RelayResponseNormalizer = /*#__PURE__*/function () {
133
133
  };
134
134
 
135
135
  _proto._getVariableValue = function _getVariableValue(name) {
136
- !this._variables.hasOwnProperty(name) ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayResponseNormalizer(): Undefined variable `%s`.', name) : invariant(false) : void 0; // $FlowFixMe[cannot-write]
137
-
136
+ !this._variables.hasOwnProperty(name) ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayResponseNormalizer(): Undefined variable `%s`.', name) : invariant(false) : void 0;
138
137
  return this._variables[name];
139
138
  };
140
139
 
@@ -175,8 +175,7 @@ function formatStorageKey(name, argValues) {
175
175
 
176
176
 
177
177
  function getStableVariableValue(name, variables) {
178
- !variables.hasOwnProperty(name) ? process.env.NODE_ENV !== "production" ? invariant(false, 'getVariableValue(): Undefined variable `%s`.', name) : invariant(false) : void 0; // $FlowFixMe[cannot-write]
179
-
178
+ !variables.hasOwnProperty(name) ? process.env.NODE_ENV !== "production" ? invariant(false, 'getVariableValue(): Undefined variable `%s`.', name) : invariant(false) : void 0;
180
179
  return stableCopy(variables[name]);
181
180
  }
182
181
 
@@ -48,7 +48,7 @@ function requestSubscription(environment, config) {
48
48
  config.updater) : config,
49
49
  updater = _ref.updater;
50
50
 
51
- var sub = environment.execute({
51
+ var sub = environment.executeSubscription({
52
52
  operation: operation,
53
53
  updater: updater
54
54
  }).subscribe({
@@ -11,10 +11,4 @@
11
11
  'use strict';
12
12
  /**
13
13
  * Basic types used throughout Relay.
14
- */
15
-
16
- /**
17
- * Represents any resource that must be explicitly disposed of. The most common
18
- * use-case is as a return value for subscriptions, where calling `dispose()`
19
- * would cancel the subscription.
20
14
  */
@@ -32,7 +32,7 @@ function getPaginationVariables(direction, count, cursor, baseVariables, extraVa
32
32
 
33
33
  !(backwardMetadata != null && backwardMetadata.count != null && backwardMetadata.cursor != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Relay: Expected backward pagination metadata to be available. ' + "If you're seeing this, this is likely a bug in Relay.") : invariant(false) : void 0;
34
34
  process.env.NODE_ENV !== "production" ? warning(!extraVariables.hasOwnProperty(backwardMetadata.cursor), 'Relay: `UNSTABLE_extraVariables` provided by caller should not ' + 'contain cursor variable `%s`. This variable is automatically ' + 'determined by Relay.', backwardMetadata.cursor) : void 0;
35
- process.env.NODE_ENV !== "production" ? warning(!extraVariables.hasOwnProperty(backwardMetadata.count), 'Relay: `UNSTABLE_extraVariables` provided by caller should not ' + 'contain count variable `%s`. This variable is automatically ' + 'determined by Relay.', backwardMetadata.count) : void 0; // $FlowFixMe[cannot-spread-interface]
35
+ process.env.NODE_ENV !== "production" ? warning(!extraVariables.hasOwnProperty(backwardMetadata.count), 'Relay: `UNSTABLE_extraVariables` provided by caller should not ' + 'contain count variable `%s`. This variable is automatically ' + 'determined by Relay.', backwardMetadata.count) : void 0;
36
36
 
37
37
  var _paginationVariables = (0, _objectSpread4["default"])((0, _objectSpread4["default"])((0, _objectSpread4["default"])({}, baseVariables), extraVariables), {}, (_objectSpread2 = {}, (0, _defineProperty2["default"])(_objectSpread2, backwardMetadata.cursor, cursor), (0, _defineProperty2["default"])(_objectSpread2, backwardMetadata.count, count), _objectSpread2));
38
38
 
@@ -49,8 +49,7 @@ function getPaginationVariables(direction, count, cursor, baseVariables, extraVa
49
49
 
50
50
  !(forwardMetadata != null && forwardMetadata.count != null && forwardMetadata.cursor != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Relay: Expected forward pagination metadata to be available. ' + "If you're seeing this, this is likely a bug in Relay.") : invariant(false) : void 0;
51
51
  process.env.NODE_ENV !== "production" ? warning(!extraVariables.hasOwnProperty(forwardMetadata.cursor), 'Relay: `UNSTABLE_extraVariables` provided by caller should not ' + 'contain cursor variable `%s`. This variable is automatically ' + 'determined by Relay.', forwardMetadata.cursor) : void 0;
52
- process.env.NODE_ENV !== "production" ? warning(!extraVariables.hasOwnProperty(forwardMetadata.count), 'Relay: `UNSTABLE_extraVariables` provided by caller should not ' + 'contain count variable `%s`. This variable is automatically ' + 'determined by Relay.', forwardMetadata.count) : void 0; // $FlowFixMe[cannot-spread-interface]
53
-
52
+ process.env.NODE_ENV !== "production" ? warning(!extraVariables.hasOwnProperty(forwardMetadata.count), 'Relay: `UNSTABLE_extraVariables` provided by caller should not ' + 'contain count variable `%s`. This variable is automatically ' + 'determined by Relay.', forwardMetadata.count) : void 0;
54
53
  var paginationVariables = (0, _objectSpread4["default"])((0, _objectSpread4["default"])((0, _objectSpread4["default"])({}, baseVariables), extraVariables), {}, (_objectSpread3 = {}, (0, _defineProperty2["default"])(_objectSpread3, forwardMetadata.cursor, cursor), (0, _defineProperty2["default"])(_objectSpread3, forwardMetadata.count, count), _objectSpread3));
55
54
 
56
55
  if (backwardMetadata && backwardMetadata.cursor) {
@@ -186,11 +186,17 @@ class ActorSpecificEnvironment implements IActorEnvironment {
186
186
 
187
187
  execute(config: {
188
188
  operation: OperationDescriptor,
189
- updater?: ?SelectorStoreUpdater,
190
189
  }): RelayObservable<GraphQLResponse> {
191
190
  return this.multiActorEnvironment.execute(this, config);
192
191
  }
193
192
 
193
+ executeSubscription(config: {
194
+ operation: OperationDescriptor,
195
+ updater: ?SelectorStoreUpdater,
196
+ }): RelayObservable<GraphQLResponse> {
197
+ return this.multiActorEnvironment.executeSubscription(this, config);
198
+ }
199
+
194
200
  executeMutation(
195
201
  options: ExecuteMutationConfig,
196
202
  ): RelayObservable<GraphQLResponse> {
@@ -323,6 +323,31 @@ class MultiActorEnvironment implements IMultiActorEnvironment {
323
323
  }
324
324
 
325
325
  execute(
326
+ actorEnvironment: IActorEnvironment,
327
+ {
328
+ operation,
329
+ }: {
330
+ operation: OperationDescriptor,
331
+ },
332
+ ): RelayObservable<GraphQLResponse> {
333
+ return this._execute(actorEnvironment, {
334
+ createSource: () =>
335
+ actorEnvironment
336
+ .getNetwork()
337
+ .execute(
338
+ operation.request.node.params,
339
+ operation.request.variables,
340
+ operation.request.cacheConfig || {},
341
+ null,
342
+ ),
343
+ isClientPayload: false,
344
+ operation,
345
+ optimisticConfig: null,
346
+ updater: null,
347
+ });
348
+ }
349
+
350
+ executeSubscription(
326
351
  actorEnvironment: IActorEnvironment,
327
352
  {
328
353
  operation,