relay-runtime 0.0.0-main-1decb243 → 0.0.0-main-556d696f

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 (137) hide show
  1. package/experimental.js +1 -1
  2. package/index.js +1 -1
  3. package/lib/experimental.js +3 -3
  4. package/lib/handlers/RelayDefaultHandlerProvider.js +12 -12
  5. package/lib/handlers/connection/ConnectionHandler.js +17 -17
  6. package/lib/handlers/connection/ConnectionInterface.js +10 -10
  7. package/lib/handlers/connection/MutationHandlers.js +16 -16
  8. package/lib/index.js +61 -61
  9. package/lib/multi-actor-environment/ActorIdentifier.js +5 -5
  10. package/lib/multi-actor-environment/ActorSpecificEnvironment.js +8 -8
  11. package/lib/multi-actor-environment/ActorUtils.js +4 -4
  12. package/lib/multi-actor-environment/MultiActorEnvironment.js +12 -12
  13. package/lib/multi-actor-environment/MultiActorEnvironmentTypes.js +1 -1
  14. package/lib/multi-actor-environment/index.js +3 -3
  15. package/lib/mutations/RelayDeclarativeMutationConfig.js +26 -26
  16. package/lib/mutations/RelayRecordProxy.js +9 -9
  17. package/lib/mutations/RelayRecordSourceMutator.js +7 -7
  18. package/lib/mutations/RelayRecordSourceProxy.js +12 -12
  19. package/lib/mutations/RelayRecordSourceSelectorProxy.js +9 -9
  20. package/lib/mutations/applyOptimisticMutation.js +9 -9
  21. package/lib/mutations/commitLocalUpdate.js +1 -1
  22. package/lib/mutations/commitMutation.js +15 -15
  23. package/lib/mutations/createUpdatableProxy.js +13 -13
  24. package/lib/mutations/readUpdatableFragment.js +6 -6
  25. package/lib/mutations/readUpdatableQuery.js +3 -3
  26. package/lib/mutations/validateMutation.js +9 -7
  27. package/lib/network/ConvertToExecuteFunction.js +2 -2
  28. package/lib/network/RelayNetwork.js +8 -8
  29. package/lib/network/RelayNetworkTypes.js +1 -1
  30. package/lib/network/RelayObservable.js +23 -22
  31. package/lib/network/RelayQueryResponseCache.js +5 -5
  32. package/lib/network/wrapNetworkWithLogObserver.js +8 -8
  33. package/lib/query/GraphQLTag.js +16 -16
  34. package/lib/query/PreloadableQueryRegistry.js +1 -1
  35. package/lib/query/fetchQuery.js +13 -13
  36. package/lib/query/fetchQueryInternal.js +8 -8
  37. package/lib/query/fetchQuery_DEPRECATED.js +5 -5
  38. package/lib/store/ClientID.js +7 -7
  39. package/lib/store/DataChecker.js +29 -25
  40. package/lib/store/OperationExecutor.js +87 -87
  41. package/lib/store/RelayConcreteVariables.js +6 -6
  42. package/lib/store/RelayExperimentalGraphResponseHandler.js +12 -12
  43. package/lib/store/RelayExperimentalGraphResponseTransform.js +16 -16
  44. package/lib/store/RelayModernEnvironment.js +21 -21
  45. package/lib/store/RelayModernFragmentSpecResolver.js +16 -16
  46. package/lib/store/RelayModernOperationDescriptor.js +6 -6
  47. package/lib/store/RelayModernRecord.js +23 -23
  48. package/lib/store/RelayModernSelector.js +23 -23
  49. package/lib/store/RelayModernStore.js +35 -35
  50. package/lib/store/RelayOperationTracker.js +3 -3
  51. package/lib/store/RelayOptimisticRecordSource.js +8 -8
  52. package/lib/store/RelayPublishQueue.js +22 -22
  53. package/lib/store/RelayReader.js +48 -50
  54. package/lib/store/RelayRecordSource.js +3 -3
  55. package/lib/store/RelayRecordState.js +4 -4
  56. package/lib/store/RelayReferenceMarker.js +18 -14
  57. package/lib/store/RelayResponseNormalizer.js +40 -36
  58. package/lib/store/RelayStoreSubscriptions.js +8 -8
  59. package/lib/store/RelayStoreTypes.js +1 -1
  60. package/lib/store/RelayStoreUtils.js +40 -35
  61. package/lib/store/ResolverCache.js +16 -16
  62. package/lib/store/ResolverFragments.js +6 -6
  63. package/lib/store/StoreInspector.js +16 -16
  64. package/lib/store/TypeID.js +3 -3
  65. package/lib/store/ViewerPattern.js +5 -5
  66. package/lib/store/cloneRelayHandleSourceField.js +6 -6
  67. package/lib/store/cloneRelayScalarHandleSourceField.js +6 -6
  68. package/lib/store/createFragmentSpecResolver.js +3 -3
  69. package/lib/store/createRelayContext.js +4 -4
  70. package/lib/store/defaultGetDataID.js +2 -2
  71. package/lib/store/defaultRequiredFieldLogger.js +3 -3
  72. package/lib/store/experimental-live-resolvers/LiveResolverCache.js +33 -33
  73. package/lib/store/experimental-live-resolvers/LiveResolverStore.js +36 -36
  74. package/lib/store/experimental-live-resolvers/LiveResolverSuspenseSentinel.js +1 -1
  75. package/lib/store/experimental-live-resolvers/getOutputTypeRecordIDs.js +5 -5
  76. package/lib/store/experimental-live-resolvers/isLiveStateValue.js +2 -2
  77. package/lib/store/experimental-live-resolvers/resolverDataInjector.js +6 -6
  78. package/lib/store/experimental-live-resolvers/weakObjectWrapper.js +6 -6
  79. package/lib/store/hasOverlappingIDs.js +1 -1
  80. package/lib/store/hasSignificantOverlappingIDs.js +3 -3
  81. package/lib/store/isRelayModernEnvironment.js +2 -2
  82. package/lib/store/normalizeResponse.js +1 -1
  83. package/lib/store/readInlineData.js +6 -6
  84. package/lib/subscription/requestSubscription.js +9 -9
  85. package/lib/util/JSResourceTypes.flow.js +1 -1
  86. package/lib/util/NormalizationNode.js +1 -1
  87. package/lib/util/ReaderNode.js +1 -1
  88. package/lib/util/RelayConcreteNode.js +36 -36
  89. package/lib/util/RelayDefaultHandleKey.js +2 -2
  90. package/lib/util/RelayError.js +3 -3
  91. package/lib/util/RelayFeatureFlags.js +1 -1
  92. package/lib/util/RelayProfiler.js +1 -1
  93. package/lib/util/RelayReplaySubject.js +10 -10
  94. package/lib/util/RelayRuntimeTypes.js +1 -1
  95. package/lib/util/StringInterner.js +3 -3
  96. package/lib/util/createPayloadFor3DField.js +2 -2
  97. package/lib/util/deepFreeze.js +3 -3
  98. package/lib/util/generateID.js +1 -1
  99. package/lib/util/getFragmentIdentifier.js +12 -12
  100. package/lib/util/getOperation.js +2 -2
  101. package/lib/util/getPaginationMetadata.js +6 -6
  102. package/lib/util/getPaginationVariables.js +9 -9
  103. package/lib/util/getPendingOperationsForFragment.js +5 -5
  104. package/lib/util/getRefetchMetadata.js +7 -7
  105. package/lib/util/getRelayHandleKey.js +4 -4
  106. package/lib/util/getRequestIdentifier.js +4 -4
  107. package/lib/util/getValueAtPath.js +5 -5
  108. package/lib/util/handlePotentialSnapshotErrors.js +6 -6
  109. package/lib/util/isEmptyObject.js +1 -1
  110. package/lib/util/isPromise.js +2 -2
  111. package/lib/util/isScalarAndEqual.js +2 -2
  112. package/lib/util/recycleNodesInto.js +6 -20
  113. package/lib/util/registerEnvironmentWithDevTools.js +2 -2
  114. package/lib/util/resolveImmediate.js +1 -1
  115. package/lib/util/stableCopy.js +2 -2
  116. package/lib/util/withDuration.js +2 -2
  117. package/lib/util/withProvidedVariables.js +3 -3
  118. package/mutations/validateMutation.js.flow +2 -0
  119. package/network/RelayObservable.js.flow +3 -2
  120. package/package.json +1 -1
  121. package/relay-runtime-experimental.js +2 -2
  122. package/relay-runtime-experimental.min.js +2 -2
  123. package/relay-runtime.js +2 -2
  124. package/relay-runtime.min.js +2 -2
  125. package/store/DataChecker.js.flow +9 -1
  126. package/store/RelayModernSelector.js.flow +6 -3
  127. package/store/RelayReader.js.flow +7 -7
  128. package/store/RelayReferenceMarker.js.flow +6 -1
  129. package/store/RelayResponseNormalizer.js.flow +6 -1
  130. package/store/RelayStoreTypes.js.flow +7 -1
  131. package/store/RelayStoreUtils.js.flow +22 -7
  132. package/store/experimental-live-resolvers/resolverDataInjector.js.flow +1 -0
  133. package/store/experimental-live-resolvers/weakObjectWrapper.js.flow +1 -0
  134. package/util/NormalizationNode.js.flow +15 -2
  135. package/util/ReaderNode.js.flow +1 -1
  136. package/util/createPayloadFor3DField.js.flow +1 -0
  137. package/util/recycleNodesInto.js.flow +8 -30
@@ -1,8 +1,8 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
4
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
5
- var _require = require("../util/RelayConcreteNode"),
5
+ var _require = require('../util/RelayConcreteNode'),
6
6
  ACTOR_CHANGE = _require.ACTOR_CHANGE,
7
7
  CLIENT_COMPONENT = _require.CLIENT_COMPONENT,
8
8
  CLIENT_EDGE_TO_CLIENT_OBJECT = _require.CLIENT_EDGE_TO_CLIENT_OBJECT,
@@ -14,6 +14,7 @@ var _require = require("../util/RelayConcreteNode"),
14
14
  LINKED_FIELD = _require.LINKED_FIELD,
15
15
  LINKED_HANDLE = _require.LINKED_HANDLE,
16
16
  MODULE_IMPORT = _require.MODULE_IMPORT,
17
+ RELAY_LIVE_RESOLVER = _require.RELAY_LIVE_RESOLVER,
17
18
  RELAY_RESOLVER = _require.RELAY_RESOLVER,
18
19
  SCALAR_FIELD = _require.SCALAR_FIELD,
19
20
  SCALAR_HANDLE = _require.SCALAR_HANDLE,
@@ -25,12 +26,12 @@ var validateMutation = function validateMutation() {};
25
26
  if (process.env.NODE_ENV !== "production") {
26
27
  var addFieldToDiff = function addFieldToDiff(path, diff, isScalar) {
27
28
  var deepLoc = diff;
28
- path.split(".").forEach(function (key, index, arr) {
29
+ path.split('.').forEach(function (key, index, arr) {
29
30
  if (deepLoc[key] == null) {
30
31
  deepLoc[key] = {};
31
32
  }
32
33
  if (isScalar && index === arr.length - 1) {
33
- deepLoc[key] = "<scalar>";
34
+ deepLoc[key] = '<scalar>';
34
35
  }
35
36
  deepLoc = deepLoc[key];
36
37
  });
@@ -38,7 +39,7 @@ if (process.env.NODE_ENV !== "production") {
38
39
  validateMutation = function validateMutation(optimisticResponse, mutation, variables) {
39
40
  var operationName = mutation.operation.name;
40
41
  var context = {
41
- path: "ROOT",
42
+ path: 'ROOT',
42
43
  visitedPaths: new Set(),
43
44
  variables: variables || {},
44
45
  missingDiff: {},
@@ -47,8 +48,8 @@ if (process.env.NODE_ENV !== "production") {
47
48
  };
48
49
  validateSelections(optimisticResponse, mutation.operation.selections, context);
49
50
  validateOptimisticResponse(optimisticResponse, context);
50
- process.env.NODE_ENV !== "production" ? warning(context.missingDiff.ROOT == null, "Expected `optimisticResponse` to match structure of server response for mutation `%s`, please define fields for all of\n%s", operationName, JSON.stringify(context.missingDiff.ROOT, null, 2)) : void 0;
51
- process.env.NODE_ENV !== "production" ? warning(context.extraDiff.ROOT == null, "Expected `optimisticResponse` to match structure of server response for mutation `%s`, please remove all fields of\n%s", operationName, JSON.stringify(context.extraDiff.ROOT, null, 2)) : void 0;
51
+ process.env.NODE_ENV !== "production" ? warning(context.missingDiff.ROOT == null, 'Expected `optimisticResponse` to match structure of server response for mutation `%s`, please define fields for all of\n%s', operationName, JSON.stringify(context.missingDiff.ROOT, null, 2)) : void 0;
52
+ process.env.NODE_ENV !== "production" ? warning(context.extraDiff.ROOT == null, 'Expected `optimisticResponse` to match structure of server response for mutation `%s`, please remove all fields of\n%s', operationName, JSON.stringify(context.extraDiff.ROOT, null, 2)) : void 0;
52
53
  };
53
54
  var validateSelections = function validateSelections(optimisticResponse, selections, context) {
54
55
  selections.forEach(function (selection) {
@@ -90,6 +91,7 @@ if (process.env.NODE_ENV !== "production") {
90
91
  case TYPE_DISCRIMINATOR:
91
92
  return validateAbstractKey(context, selection.abstractKey);
92
93
  case RELAY_RESOLVER:
94
+ case RELAY_LIVE_RESOLVER:
93
95
  case CLIENT_EDGE_TO_CLIENT_OBJECT:
94
96
  case LINKED_HANDLE:
95
97
  case SCALAR_HANDLE:
@@ -1,6 +1,6 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
- var RelayObservable = require("./RelayObservable");
3
+ var RelayObservable = require('./RelayObservable');
4
4
  function convertFetch(fn) {
5
5
  return function fetch(request, variables, cacheConfig, uploadables, logRequestInfo) {
6
6
  var result = fn(request, variables, cacheConfig, uploadables, logRequestInfo);
@@ -1,21 +1,21 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
- var withProvidedVariables = require("../util/withProvidedVariables");
4
- var _require = require("./ConvertToExecuteFunction"),
3
+ var withProvidedVariables = require('../util/withProvidedVariables');
4
+ var _require = require('./ConvertToExecuteFunction'),
5
5
  convertFetch = _require.convertFetch;
6
- var invariant = require("invariant");
6
+ var invariant = require('invariant');
7
7
  function create(fetchFn, subscribe) {
8
8
  var observeFetch = convertFetch(fetchFn);
9
9
  function execute(request, variables, cacheConfig, uploadables, logRequestInfo) {
10
10
  var operationVariables = withProvidedVariables(variables, request.providedVariables);
11
- if (request.operationKind === "subscription") {
12
- !subscribe ? process.env.NODE_ENV !== "production" ? invariant(false, "RelayNetwork: This network layer does not support Subscriptions. " + "To use Subscriptions, provide a custom network layer.") : invariant(false) : void 0;
13
- !!uploadables ? process.env.NODE_ENV !== "production" ? invariant(false, "RelayNetwork: Cannot provide uploadables while subscribing.") : invariant(false) : void 0;
11
+ if (request.operationKind === 'subscription') {
12
+ !subscribe ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayNetwork: This network layer does not support Subscriptions. ' + 'To use Subscriptions, provide a custom network layer.') : invariant(false) : void 0;
13
+ !!uploadables ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayNetwork: Cannot provide uploadables while subscribing.') : invariant(false) : void 0;
14
14
  return subscribe(request, operationVariables, cacheConfig);
15
15
  }
16
16
  var pollInterval = cacheConfig.poll;
17
17
  if (pollInterval != null) {
18
- !!uploadables ? process.env.NODE_ENV !== "production" ? invariant(false, "RelayNetwork: Cannot provide uploadables while polling.") : invariant(false) : void 0;
18
+ !!uploadables ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayNetwork: Cannot provide uploadables while polling.') : invariant(false) : void 0;
19
19
  return observeFetch(request, operationVariables, {
20
20
  force: true
21
21
  }).poll(pollInterval);
@@ -1 +1 @@
1
- "use strict";
1
+ 'use strict';
@@ -1,6 +1,6 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
- var isPromise = require("../util/isPromise");
3
+ var isPromise = require('../util/isPromise');
4
4
  var hostReportError = swallowError;
5
5
  var RelayObservable = /*#__PURE__*/function () {
6
6
  RelayObservable.create = function create(source) {
@@ -8,8 +8,8 @@ var RelayObservable = /*#__PURE__*/function () {
8
8
  };
9
9
  function RelayObservable(source) {
10
10
  if (process.env.NODE_ENV !== "production") {
11
- if (!source || typeof source !== "function") {
12
- throw new Error("Source must be a Function: " + String(source));
11
+ if (!source || typeof source !== 'function') {
12
+ throw new Error('Source must be a Function: ' + String(source));
13
13
  }
14
14
  }
15
15
  this._source = source;
@@ -84,11 +84,11 @@ var RelayObservable = /*#__PURE__*/function () {
84
84
  };
85
85
  };
86
86
  return _this3.subscribe({
87
- start: both("start"),
88
- next: both("next"),
89
- error: both("error"),
90
- complete: both("complete"),
91
- unsubscribe: both("unsubscribe")
87
+ start: both('start'),
88
+ next: both('next'),
89
+ error: both('error'),
90
+ complete: both('complete'),
91
+ unsubscribe: both('unsubscribe')
92
92
  });
93
93
  });
94
94
  };
@@ -106,7 +106,8 @@ var RelayObservable = /*#__PURE__*/function () {
106
106
  var _this5 = this;
107
107
  return RelayObservable.create(function (sink) {
108
108
  var hasValue = false;
109
- var current = _this5.subscribe({
109
+ var current;
110
+ current = _this5.subscribe({
110
111
  next: function next(value) {
111
112
  hasValue = true;
112
113
  sink.next(value);
@@ -121,14 +122,14 @@ var RelayObservable = /*#__PURE__*/function () {
121
122
  }
122
123
  });
123
124
  return function () {
124
- current.unsubscribe();
125
+ current && current.unsubscribe();
125
126
  };
126
127
  });
127
128
  };
128
129
  _proto.subscribe = function subscribe(observer) {
129
130
  if (process.env.NODE_ENV !== "production") {
130
- if (!observer || typeof observer !== "object") {
131
- throw new Error("Observer must be an Object with callbacks: " + String(observer));
131
+ if (!observer || typeof observer !== 'object') {
132
+ throw new Error('Observer must be an Object with callbacks: ' + String(observer));
132
133
  }
133
134
  }
134
135
  return _subscribe(this._source, observer);
@@ -197,8 +198,8 @@ var RelayObservable = /*#__PURE__*/function () {
197
198
  _proto.poll = function poll(pollInterval) {
198
199
  var _this8 = this;
199
200
  if (process.env.NODE_ENV !== "production") {
200
- if (typeof pollInterval !== "number" || pollInterval <= 0) {
201
- throw new Error("RelayObservable: Expected pollInterval to be positive, got: " + pollInterval);
201
+ if (typeof pollInterval !== 'number' || pollInterval <= 0) {
202
+ throw new Error('RelayObservable: Expected pollInterval to be positive, got: ' + pollInterval);
202
203
  }
203
204
  }
204
205
  return RelayObservable.create(function (sink) {
@@ -239,7 +240,7 @@ var RelayObservable = /*#__PURE__*/function () {
239
240
  return RelayObservable;
240
241
  }();
241
242
  function isObservable(obj) {
242
- return typeof obj === "object" && obj !== null && typeof obj.subscribe === "function";
243
+ return typeof obj === 'object' && obj !== null && typeof obj.subscribe === 'function';
243
244
  }
244
245
  function fromObservable(obj) {
245
246
  return obj instanceof RelayObservable ? obj : RelayObservable.create(function (sink) {
@@ -264,7 +265,7 @@ function _subscribe(source, observer) {
264
265
  var closed = false;
265
266
  var cleanup;
266
267
  var withClosed = function withClosed(obj) {
267
- return Object.defineProperty(obj, "closed", {
268
+ return Object.defineProperty(obj, 'closed', {
268
269
  get: function get() {
269
270
  return closed;
270
271
  }
@@ -351,8 +352,8 @@ function _subscribe(source, observer) {
351
352
  sink.error(error, true);
352
353
  }
353
354
  if (process.env.NODE_ENV !== "production") {
354
- if (cleanup !== undefined && typeof cleanup !== "function" && (!cleanup || typeof cleanup.unsubscribe !== "function")) {
355
- throw new Error("Returned cleanup function which cannot be called: " + String(cleanup));
355
+ if (cleanup !== undefined && typeof cleanup !== 'function' && (!cleanup || typeof cleanup.unsubscribe !== 'function')) {
356
+ throw new Error('Returned cleanup function which cannot be called: ' + String(cleanup));
356
357
  }
357
358
  }
358
359
  if (closed) {
@@ -363,14 +364,14 @@ function _subscribe(source, observer) {
363
364
  function swallowError(_error, _isUncaughtThrownError) {}
364
365
  if (process.env.NODE_ENV !== "production") {
365
366
  RelayObservable.onUnhandledError(function (error, isUncaughtThrownError) {
366
- if (typeof fail === "function") {
367
+ if (typeof fail === 'function') {
367
368
  fail(String(error));
368
369
  } else if (isUncaughtThrownError) {
369
370
  setTimeout(function () {
370
371
  throw error;
371
372
  });
372
- } else if (typeof console !== "undefined") {
373
- console.error("RelayObservable: Unhandled Error", error);
373
+ } else if (typeof console !== 'undefined') {
374
+ console.error('RelayObservable: Unhandled Error', error);
374
375
  }
375
376
  });
376
377
  }
@@ -1,15 +1,15 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
4
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
5
- var stableCopy = require("../util/stableCopy");
6
- var invariant = require("invariant");
5
+ var stableCopy = require('../util/stableCopy');
6
+ var invariant = require('invariant');
7
7
  var RelayQueryResponseCache = /*#__PURE__*/function () {
8
8
  function RelayQueryResponseCache(_ref) {
9
9
  var size = _ref.size,
10
10
  ttl = _ref.ttl;
11
- !(size > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, "RelayQueryResponseCache: Expected the max cache size to be > 0, got " + "`%s`.", size) : invariant(false) : void 0;
12
- !(ttl > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, "RelayQueryResponseCache: Expected the max ttl to be > 0, got `%s`.", ttl) : invariant(false) : void 0;
11
+ !(size > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayQueryResponseCache: Expected the max cache size to be > 0, got ' + '`%s`.', size) : invariant(false) : void 0;
12
+ !(ttl > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayQueryResponseCache: Expected the max ttl to be > 0, got `%s`.', ttl) : invariant(false) : void 0;
13
13
  this._responses = new Map();
14
14
  this._size = size;
15
15
  this._ttl = ttl;
@@ -1,6 +1,6 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
- var generateID = require("../util/generateID");
3
+ var generateID = require('../util/generateID');
4
4
  function wrapNetworkWithLogObserver(env, network) {
5
5
  return {
6
6
  execute: function execute(params, variables, cacheConfig, uploadables) {
@@ -8,7 +8,7 @@ function wrapNetworkWithLogObserver(env, network) {
8
8
  var logObserver = {
9
9
  start: function start(subscription) {
10
10
  env.__log({
11
- name: "network.start",
11
+ name: 'network.start',
12
12
  networkRequestId: networkRequestId,
13
13
  params: params,
14
14
  variables: variables,
@@ -17,34 +17,34 @@ function wrapNetworkWithLogObserver(env, network) {
17
17
  },
18
18
  next: function next(response) {
19
19
  env.__log({
20
- name: "network.next",
20
+ name: 'network.next',
21
21
  networkRequestId: networkRequestId,
22
22
  response: response
23
23
  });
24
24
  },
25
25
  error: function error(_error) {
26
26
  env.__log({
27
- name: "network.error",
27
+ name: 'network.error',
28
28
  networkRequestId: networkRequestId,
29
29
  error: _error
30
30
  });
31
31
  },
32
32
  complete: function complete() {
33
33
  env.__log({
34
- name: "network.complete",
34
+ name: 'network.complete',
35
35
  networkRequestId: networkRequestId
36
36
  });
37
37
  },
38
38
  unsubscribe: function unsubscribe() {
39
39
  env.__log({
40
- name: "network.unsubscribe",
40
+ name: 'network.unsubscribe',
41
41
  networkRequestId: networkRequestId
42
42
  });
43
43
  }
44
44
  };
45
45
  var logRequestInfo = function logRequestInfo(info) {
46
46
  env.__log({
47
- name: "network.info",
47
+ name: 'network.info',
48
48
  networkRequestId: networkRequestId,
49
49
  info: info
50
50
  });
@@ -1,16 +1,16 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
- var RelayConcreteNode = require("../util/RelayConcreteNode");
4
- var invariant = require("invariant");
3
+ var RelayConcreteNode = require('../util/RelayConcreteNode');
4
+ var invariant = require('invariant');
5
5
  var warning = require("fbjs/lib/warning");
6
6
  function graphql(strings) {
7
- !false ? process.env.NODE_ENV !== "production" ? invariant(false, "graphql: Unexpected invocation at runtime. Either the Babel transform " + "was not set up, or it failed to identify this call site. Make sure it " + "is being used verbatim as `graphql`. Note also that there cannot be " + "a space between graphql and the backtick that follows.") : invariant(false) : void 0;
7
+ !false ? process.env.NODE_ENV !== "production" ? invariant(false, 'graphql: Unexpected invocation at runtime. Either the Babel transform ' + 'was not set up, or it failed to identify this call site. Make sure it ' + 'is being used verbatim as `graphql`. Note also that there cannot be ' + 'a space between graphql and the backtick that follows.') : invariant(false) : void 0;
8
8
  }
9
9
  function getNode(taggedNode) {
10
10
  var node = taggedNode;
11
- if (typeof node === "function") {
11
+ if (typeof node === 'function') {
12
12
  node = node();
13
- process.env.NODE_ENV !== "production" ? warning(false, "RelayGraphQLTag: node `%s` unexpectedly wrapped in a function.", node.kind === "Fragment" ? node.name : node.operation.name) : void 0;
13
+ process.env.NODE_ENV !== "production" ? warning(false, 'RelayGraphQLTag: node `%s` unexpectedly wrapped in a function.', node.kind === 'Fragment' ? node.name : node.operation.name) : void 0;
14
14
  } else if (node["default"]) {
15
15
  node = node["default"];
16
16
  }
@@ -18,23 +18,23 @@ function getNode(taggedNode) {
18
18
  }
19
19
  function isFragment(node) {
20
20
  var fragment = getNode(node);
21
- return typeof fragment === "object" && fragment !== null && fragment.kind === RelayConcreteNode.FRAGMENT;
21
+ return typeof fragment === 'object' && fragment !== null && fragment.kind === RelayConcreteNode.FRAGMENT;
22
22
  }
23
23
  function isRequest(node) {
24
24
  var request = getNode(node);
25
- return typeof request === "object" && request !== null && request.kind === RelayConcreteNode.REQUEST;
25
+ return typeof request === 'object' && request !== null && request.kind === RelayConcreteNode.REQUEST;
26
26
  }
27
27
  function isUpdatableQuery(node) {
28
28
  var updatableQuery = getNode(node);
29
- return typeof updatableQuery === "object" && updatableQuery !== null && updatableQuery.kind === RelayConcreteNode.UPDATABLE_QUERY;
29
+ return typeof updatableQuery === 'object' && updatableQuery !== null && updatableQuery.kind === RelayConcreteNode.UPDATABLE_QUERY;
30
30
  }
31
31
  function isInlineDataFragment(node) {
32
32
  var fragment = getNode(node);
33
- return typeof fragment === "object" && fragment !== null && fragment.kind === RelayConcreteNode.INLINE_DATA_FRAGMENT;
33
+ return typeof fragment === 'object' && fragment !== null && fragment.kind === RelayConcreteNode.INLINE_DATA_FRAGMENT;
34
34
  }
35
35
  function getFragment(taggedNode) {
36
36
  var fragment = getNode(taggedNode);
37
- !isFragment(fragment) ? process.env.NODE_ENV !== "production" ? invariant(false, "GraphQLTag: Expected a fragment, got `%s`.", JSON.stringify(fragment)) : invariant(false) : void 0;
37
+ !isFragment(fragment) ? process.env.NODE_ENV !== "production" ? invariant(false, 'GraphQLTag: Expected a fragment, got `%s`.', JSON.stringify(fragment)) : invariant(false) : void 0;
38
38
  return fragment;
39
39
  }
40
40
  function getPaginationFragment(taggedNode) {
@@ -42,7 +42,7 @@ function getPaginationFragment(taggedNode) {
42
42
  var fragment = getFragment(taggedNode);
43
43
  var refetch = (_fragment$metadata = fragment.metadata) === null || _fragment$metadata === void 0 ? void 0 : _fragment$metadata.refetch;
44
44
  var connection = refetch === null || refetch === void 0 ? void 0 : refetch.connection;
45
- if (refetch === null || typeof refetch !== "object" || connection === null || typeof connection !== "object") {
45
+ if (refetch === null || typeof refetch !== 'object' || connection === null || typeof connection !== 'object') {
46
46
  return null;
47
47
  }
48
48
  return fragment;
@@ -51,24 +51,24 @@ function getRefetchableFragment(taggedNode) {
51
51
  var _fragment$metadata2;
52
52
  var fragment = getFragment(taggedNode);
53
53
  var refetch = (_fragment$metadata2 = fragment.metadata) === null || _fragment$metadata2 === void 0 ? void 0 : _fragment$metadata2.refetch;
54
- if (refetch === null || typeof refetch !== "object") {
54
+ if (refetch === null || typeof refetch !== 'object') {
55
55
  return null;
56
56
  }
57
57
  return fragment;
58
58
  }
59
59
  function getRequest(taggedNode) {
60
60
  var request = getNode(taggedNode);
61
- !isRequest(request) ? process.env.NODE_ENV !== "production" ? invariant(false, "GraphQLTag: Expected a request, got `%s`.", JSON.stringify(request)) : invariant(false) : void 0;
61
+ !isRequest(request) ? process.env.NODE_ENV !== "production" ? invariant(false, 'GraphQLTag: Expected a request, got `%s`.', JSON.stringify(request)) : invariant(false) : void 0;
62
62
  return request;
63
63
  }
64
64
  function getUpdatableQuery(taggedNode) {
65
65
  var updatableQuery = getNode(taggedNode);
66
- !isUpdatableQuery(updatableQuery) ? process.env.NODE_ENV !== "production" ? invariant(false, "GraphQLTag: Expected a request, got `%s`.", JSON.stringify(updatableQuery)) : invariant(false) : void 0;
66
+ !isUpdatableQuery(updatableQuery) ? process.env.NODE_ENV !== "production" ? invariant(false, 'GraphQLTag: Expected a request, got `%s`.', JSON.stringify(updatableQuery)) : invariant(false) : void 0;
67
67
  return updatableQuery;
68
68
  }
69
69
  function getInlineDataFragment(taggedNode) {
70
70
  var fragment = getNode(taggedNode);
71
- !isInlineDataFragment(fragment) ? process.env.NODE_ENV !== "production" ? invariant(false, "GraphQLTag: Expected an inline data fragment, got `%s`.", JSON.stringify(fragment)) : invariant(false) : void 0;
71
+ !isInlineDataFragment(fragment) ? process.env.NODE_ENV !== "production" ? invariant(false, 'GraphQLTag: Expected an inline data fragment, got `%s`.', JSON.stringify(fragment)) : invariant(false) : void 0;
72
72
  return fragment;
73
73
  }
74
74
  module.exports = {
@@ -1,4 +1,4 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
3
  var PreloadableQueryRegistry = /*#__PURE__*/function () {
4
4
  function PreloadableQueryRegistry() {
@@ -1,43 +1,43 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
4
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
5
- var RelayObservable = require("../network/RelayObservable");
6
- var _require = require("../store/RelayModernOperationDescriptor"),
5
+ var RelayObservable = require('../network/RelayObservable');
6
+ var _require = require('../store/RelayModernOperationDescriptor'),
7
7
  createOperationDescriptor = _require.createOperationDescriptor;
8
- var handlePotentialSnapshotErrors = require("../util/handlePotentialSnapshotErrors");
9
- var fetchQueryInternal = require("./fetchQueryInternal");
10
- var _require2 = require("./GraphQLTag"),
8
+ var handlePotentialSnapshotErrors = require('../util/handlePotentialSnapshotErrors');
9
+ var fetchQueryInternal = require('./fetchQueryInternal');
10
+ var _require2 = require('./GraphQLTag'),
11
11
  getRequest = _require2.getRequest;
12
- var invariant = require("invariant");
12
+ var invariant = require('invariant');
13
13
  function fetchQuery(environment, query, variables, options) {
14
14
  var _options$fetchPolicy;
15
15
  var queryNode = getRequest(query);
16
- !(queryNode.params.operationKind === "query") ? process.env.NODE_ENV !== "production" ? invariant(false, "fetchQuery: Expected query operation") : invariant(false) : void 0;
16
+ !(queryNode.params.operationKind === 'query') ? process.env.NODE_ENV !== "production" ? invariant(false, 'fetchQuery: Expected query operation') : invariant(false) : void 0;
17
17
  var networkCacheConfig = (0, _objectSpread2["default"])({
18
18
  force: true
19
19
  }, options === null || options === void 0 ? void 0 : options.networkCacheConfig);
20
20
  var operation = createOperationDescriptor(queryNode, variables, networkCacheConfig);
21
- var fetchPolicy = (_options$fetchPolicy = options === null || options === void 0 ? void 0 : options.fetchPolicy) !== null && _options$fetchPolicy !== void 0 ? _options$fetchPolicy : "network-only";
21
+ var fetchPolicy = (_options$fetchPolicy = options === null || options === void 0 ? void 0 : options.fetchPolicy) !== null && _options$fetchPolicy !== void 0 ? _options$fetchPolicy : 'network-only';
22
22
  function readData(snapshot) {
23
23
  handlePotentialSnapshotErrors(environment, snapshot.missingRequiredFields, snapshot.relayResolverErrors);
24
24
  return snapshot.data;
25
25
  }
26
26
  switch (fetchPolicy) {
27
- case "network-only":
27
+ case 'network-only':
28
28
  {
29
29
  return getNetworkObservable(environment, operation).map(readData);
30
30
  }
31
- case "store-or-network":
31
+ case 'store-or-network':
32
32
  {
33
- if (environment.check(operation).status === "available") {
33
+ if (environment.check(operation).status === 'available') {
34
34
  return RelayObservable.from(environment.lookup(operation.fragment)).map(readData);
35
35
  }
36
36
  return getNetworkObservable(environment, operation).map(readData);
37
37
  }
38
38
  default:
39
39
  fetchPolicy;
40
- throw new Error("fetchQuery: Invalid fetchPolicy " + fetchPolicy);
40
+ throw new Error('fetchQuery: Invalid fetchPolicy ' + fetchPolicy);
41
41
  }
42
42
  }
43
43
  function getNetworkObservable(environment, operation) {
@@ -1,10 +1,10 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
- var Observable = require("../network/RelayObservable");
4
- var RelayFeatureFlags = require("../util/RelayFeatureFlags");
5
- var RelayReplaySubject = require("../util/RelayReplaySubject");
6
- var invariant = require("invariant");
7
- var WEAKMAP_SUPPORTED = typeof WeakMap === "function";
3
+ var Observable = require('../network/RelayObservable');
4
+ var RelayFeatureFlags = require('../util/RelayFeatureFlags');
5
+ var RelayReplaySubject = require('../util/RelayReplaySubject');
6
+ var invariant = require('invariant');
7
+ var WEAKMAP_SUPPORTED = typeof WeakMap === 'function';
8
8
  var requestCachesByEnvironment = WEAKMAP_SUPPORTED ? new WeakMap() : new Map();
9
9
  function fetchQuery(environment, operation) {
10
10
  return fetchQueryDeduped(environment, operation.request.identifier, function () {
@@ -53,7 +53,7 @@ function fetchQueryDeduped(environment, identifier, fetchFn) {
53
53
  }
54
54
  });
55
55
  }
56
- !(cachedRequest != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "[fetchQueryInternal] fetchQueryDeduped: Expected `start` to be " + "called synchronously") : invariant(false) : void 0;
56
+ !(cachedRequest != null) ? process.env.NODE_ENV !== "production" ? invariant(false, '[fetchQueryInternal] fetchQueryDeduped: Expected `start` to be ' + 'called synchronously') : invariant(false) : void 0;
57
57
  return getObservableForCachedRequest(requestCache, cachedRequest).subscribe(sink);
58
58
  });
59
59
  }
@@ -151,7 +151,7 @@ function getRequestCache(environment) {
151
151
  }
152
152
  function getCachedRequest(requestCache, identifier) {
153
153
  var cached = requestCache.get(identifier);
154
- !(cached != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "[fetchQueryInternal] getCachedRequest: Expected request to be cached") : invariant(false) : void 0;
154
+ !(cached != null) ? process.env.NODE_ENV !== "production" ? invariant(false, '[fetchQueryInternal] getCachedRequest: Expected request to be cached') : invariant(false) : void 0;
155
155
  return cached;
156
156
  }
157
157
  module.exports = {
@@ -1,13 +1,13 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
- var _require = require("../store/RelayModernOperationDescriptor"),
3
+ var _require = require('../store/RelayModernOperationDescriptor'),
4
4
  createOperationDescriptor = _require.createOperationDescriptor;
5
- var _require2 = require("./GraphQLTag"),
5
+ var _require2 = require('./GraphQLTag'),
6
6
  getRequest = _require2.getRequest;
7
7
  function fetchQuery_DEPRECATED(environment, taggedNode, variables, cacheConfig) {
8
8
  var query = getRequest(taggedNode);
9
- if (query.params.operationKind !== "query") {
10
- throw new Error("fetchQuery: Expected query operation");
9
+ if (query.params.operationKind !== 'query') {
10
+ throw new Error('fetchQuery: Expected query operation');
11
11
  }
12
12
  var operation = createOperationDescriptor(query, variables, cacheConfig);
13
13
  return environment.execute({
@@ -1,14 +1,14 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
- var RelayFeatureFlags = require("../util/RelayFeatureFlags");
4
- var _require = require("../util/StringInterner"),
3
+ var RelayFeatureFlags = require('../util/RelayFeatureFlags');
4
+ var _require = require('../util/StringInterner'),
5
5
  intern = _require.intern;
6
- var PREFIX = "client:";
6
+ var PREFIX = 'client:';
7
7
  function generateClientID(id, storageKey, index) {
8
8
  var internedId = RelayFeatureFlags.STRING_INTERN_LEVEL <= 0 ? id : intern(id, RelayFeatureFlags.MAX_DATA_ID_LENGTH);
9
- var key = internedId + ":" + storageKey;
9
+ var key = internedId + ':' + storageKey;
10
10
  if (index != null) {
11
- key += ":" + index;
11
+ key += ':' + index;
12
12
  }
13
13
  if (key.indexOf(PREFIX) !== 0) {
14
14
  key = PREFIX + key;
@@ -25,7 +25,7 @@ function generateUniqueClientID() {
25
25
  function generateClientObjectClientID(typename, localId, index) {
26
26
  var key = "".concat(PREFIX).concat(typename, ":").concat(localId);
27
27
  if (index != null) {
28
- key += ":" + index;
28
+ key += ':' + index;
29
29
  }
30
30
  return key;
31
31
  }