relay-runtime 12.0.0 → 13.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 (216) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +67 -0
  3. package/handlers/RelayDefaultHandlerProvider.js.flow +3 -3
  4. package/handlers/connection/ConnectionHandler.js.flow +9 -18
  5. package/handlers/connection/ConnectionInterface.js.flow +1 -1
  6. package/handlers/connection/MutationHandlers.js.flow +8 -12
  7. package/index.js +2 -2
  8. package/index.js.flow +43 -34
  9. package/lib/handlers/RelayDefaultHandlerProvider.js +1 -1
  10. package/lib/handlers/connection/ConnectionHandler.js +13 -19
  11. package/lib/handlers/connection/ConnectionInterface.js +1 -1
  12. package/lib/handlers/connection/MutationHandlers.js +4 -7
  13. package/lib/index.js +49 -46
  14. package/lib/multi-actor-environment/ActorIdentifier.js +1 -1
  15. package/lib/multi-actor-environment/ActorSpecificEnvironment.js +9 -5
  16. package/lib/multi-actor-environment/ActorUtils.js +1 -1
  17. package/lib/multi-actor-environment/MultiActorEnvironment.js +36 -23
  18. package/lib/multi-actor-environment/MultiActorEnvironmentTypes.js +1 -1
  19. package/lib/multi-actor-environment/index.js +3 -3
  20. package/lib/mutations/RelayDeclarativeMutationConfig.js +5 -2
  21. package/lib/mutations/RelayRecordProxy.js +4 -3
  22. package/lib/mutations/RelayRecordSourceMutator.js +4 -3
  23. package/lib/mutations/RelayRecordSourceProxy.js +13 -5
  24. package/lib/mutations/RelayRecordSourceSelectorProxy.js +13 -5
  25. package/lib/mutations/applyOptimisticMutation.js +7 -7
  26. package/lib/mutations/commitLocalUpdate.js +1 -1
  27. package/lib/mutations/commitMutation.js +16 -15
  28. package/lib/mutations/readUpdatableQuery_EXPERIMENTAL.js +242 -0
  29. package/lib/mutations/validateMutation.js +7 -7
  30. package/lib/network/ConvertToExecuteFunction.js +3 -2
  31. package/lib/network/RelayNetwork.js +4 -3
  32. package/lib/network/RelayNetworkTypes.js +1 -1
  33. package/lib/network/RelayObservable.js +2 -4
  34. package/lib/network/RelayQueryResponseCache.js +3 -3
  35. package/lib/network/wrapNetworkWithLogObserver.js +3 -2
  36. package/lib/query/GraphQLTag.js +3 -2
  37. package/lib/query/PreloadableQueryRegistry.js +1 -1
  38. package/lib/query/fetchQuery.js +7 -6
  39. package/lib/query/fetchQueryInternal.js +1 -1
  40. package/lib/query/fetchQuery_DEPRECATED.js +3 -2
  41. package/lib/store/ClientID.js +8 -2
  42. package/lib/store/DataChecker.js +17 -18
  43. package/lib/store/OperationExecutor.js +14 -14
  44. package/lib/store/RelayConcreteVariables.js +7 -10
  45. package/lib/store/RelayExperimentalGraphResponseHandler.js +153 -0
  46. package/lib/store/RelayExperimentalGraphResponseTransform.js +391 -0
  47. package/lib/store/RelayModernEnvironment.js +67 -43
  48. package/lib/store/RelayModernFragmentSpecResolver.js +9 -9
  49. package/lib/store/RelayModernOperationDescriptor.js +3 -2
  50. package/lib/store/RelayModernRecord.js +13 -12
  51. package/lib/store/RelayModernSelector.js +15 -9
  52. package/lib/store/RelayModernStore.js +15 -16
  53. package/lib/store/RelayOperationTracker.js +1 -1
  54. package/lib/store/RelayOptimisticRecordSource.js +1 -1
  55. package/lib/store/RelayPublishQueue.js +12 -6
  56. package/lib/store/RelayReader.js +131 -40
  57. package/lib/store/RelayRecordSource.js +1 -1
  58. package/lib/store/RelayRecordState.js +1 -1
  59. package/lib/store/RelayReferenceMarker.js +11 -12
  60. package/lib/store/RelayResponseNormalizer.js +26 -23
  61. package/lib/store/RelayStoreReactFlightUtils.js +4 -4
  62. package/lib/store/RelayStoreSubscriptions.js +7 -5
  63. package/lib/store/RelayStoreTypes.js +1 -1
  64. package/lib/store/RelayStoreUtils.js +6 -6
  65. package/lib/store/ResolverCache.js +7 -7
  66. package/lib/store/ResolverFragments.js +12 -8
  67. package/lib/store/StoreInspector.js +1 -1
  68. package/lib/store/TypeID.js +1 -1
  69. package/lib/store/ViewerPattern.js +1 -1
  70. package/lib/store/cloneRelayHandleSourceField.js +6 -5
  71. package/lib/store/cloneRelayScalarHandleSourceField.js +6 -5
  72. package/lib/store/createFragmentSpecResolver.js +1 -1
  73. package/lib/store/createRelayContext.js +4 -2
  74. package/lib/store/defaultGetDataID.js +1 -1
  75. package/lib/store/defaultRequiredFieldLogger.js +1 -1
  76. package/lib/store/hasOverlappingIDs.js +1 -1
  77. package/lib/store/isRelayModernEnvironment.js +1 -1
  78. package/lib/store/normalizeRelayPayload.js +1 -1
  79. package/lib/store/readInlineData.js +7 -3
  80. package/lib/subscription/requestSubscription.js +4 -6
  81. package/lib/util/JSResourceTypes.flow.js +1 -1
  82. package/lib/util/NormalizationNode.js +1 -1
  83. package/lib/util/ReaderNode.js +1 -1
  84. package/lib/util/RelayConcreteNode.js +2 -1
  85. package/lib/util/RelayDefaultHandleKey.js +1 -1
  86. package/lib/util/RelayError.js +1 -1
  87. package/lib/util/RelayFeatureFlags.js +8 -3
  88. package/lib/util/RelayProfiler.js +1 -1
  89. package/lib/util/RelayReplaySubject.js +1 -1
  90. package/lib/util/RelayRuntimeTypes.js +1 -7
  91. package/lib/util/StringInterner.js +71 -0
  92. package/lib/util/createPayloadFor3DField.js +1 -1
  93. package/lib/util/deepFreeze.js +1 -1
  94. package/lib/util/generateID.js +1 -1
  95. package/lib/util/getAllRootVariables.js +29 -0
  96. package/lib/util/getFragmentIdentifier.js +16 -8
  97. package/lib/util/getOperation.js +3 -2
  98. package/lib/util/getPaginationMetadata.js +1 -1
  99. package/lib/util/getPaginationVariables.js +3 -4
  100. package/lib/util/getPendingOperationsForFragment.js +1 -1
  101. package/lib/util/getRefetchMetadata.js +1 -1
  102. package/lib/util/getRelayHandleKey.js +3 -3
  103. package/lib/util/getRequestIdentifier.js +3 -3
  104. package/lib/util/getValueAtPath.js +1 -1
  105. package/lib/util/isEmptyObject.js +1 -1
  106. package/lib/util/isPromise.js +1 -1
  107. package/lib/util/isScalarAndEqual.js +1 -1
  108. package/lib/util/recycleNodesInto.js +1 -1
  109. package/lib/util/registerEnvironmentWithDevTools.js +1 -1
  110. package/lib/util/reportMissingRequiredFields.js +1 -1
  111. package/lib/util/resolveImmediate.js +1 -1
  112. package/lib/util/stableCopy.js +1 -1
  113. package/lib/util/withDuration.js +1 -1
  114. package/multi-actor-environment/ActorIdentifier.js.flow +1 -1
  115. package/multi-actor-environment/ActorSpecificEnvironment.js.flow +28 -20
  116. package/multi-actor-environment/ActorUtils.js.flow +3 -3
  117. package/multi-actor-environment/MultiActorEnvironment.js.flow +46 -25
  118. package/multi-actor-environment/MultiActorEnvironmentTypes.js.flow +28 -12
  119. package/multi-actor-environment/index.js.flow +2 -3
  120. package/mutations/RelayDeclarativeMutationConfig.js.flow +33 -28
  121. package/mutations/RelayRecordProxy.js.flow +5 -6
  122. package/mutations/RelayRecordSourceMutator.js.flow +5 -7
  123. package/mutations/RelayRecordSourceProxy.js.flow +20 -11
  124. package/mutations/RelayRecordSourceSelectorProxy.js.flow +16 -6
  125. package/mutations/applyOptimisticMutation.js.flow +14 -15
  126. package/mutations/commitLocalUpdate.js.flow +2 -2
  127. package/mutations/commitMutation.js.flow +36 -49
  128. package/mutations/readUpdatableQuery_EXPERIMENTAL.js.flow +318 -0
  129. package/mutations/validateMutation.js.flow +20 -18
  130. package/network/ConvertToExecuteFunction.js.flow +3 -3
  131. package/network/RelayNetwork.js.flow +5 -6
  132. package/network/RelayNetworkTypes.js.flow +1 -1
  133. package/network/RelayObservable.js.flow +2 -4
  134. package/network/RelayQueryResponseCache.js.flow +4 -4
  135. package/network/wrapNetworkWithLogObserver.js.flow +9 -9
  136. package/package.json +2 -2
  137. package/query/GraphQLTag.js.flow +11 -11
  138. package/query/PreloadableQueryRegistry.js.flow +5 -3
  139. package/query/fetchQuery.js.flow +19 -19
  140. package/query/fetchQueryInternal.js.flow +7 -10
  141. package/query/fetchQuery_DEPRECATED.js.flow +7 -7
  142. package/relay-runtime.js +2 -2
  143. package/relay-runtime.min.js +3 -3
  144. package/store/ClientID.js.flow +10 -3
  145. package/store/DataChecker.js.flow +21 -30
  146. package/store/OperationExecutor.js.flow +55 -63
  147. package/store/RelayConcreteVariables.js.flow +5 -11
  148. package/store/RelayExperimentalGraphResponseHandler.js.flow +121 -0
  149. package/store/RelayExperimentalGraphResponseTransform.js.flow +470 -0
  150. package/store/RelayModernEnvironment.js.flow +57 -28
  151. package/store/RelayModernFragmentSpecResolver.js.flow +18 -20
  152. package/store/RelayModernOperationDescriptor.js.flow +11 -12
  153. package/store/RelayModernRecord.js.flow +20 -13
  154. package/store/RelayModernSelector.js.flow +25 -15
  155. package/store/RelayModernStore.js.flow +22 -26
  156. package/store/RelayOperationTracker.js.flow +12 -18
  157. package/store/RelayOptimisticRecordSource.js.flow +3 -3
  158. package/store/RelayPublishQueue.js.flow +43 -24
  159. package/store/RelayReader.js.flow +181 -68
  160. package/store/RelayRecordSource.js.flow +3 -3
  161. package/store/RelayRecordState.js.flow +1 -1
  162. package/store/RelayReferenceMarker.js.flow +13 -16
  163. package/store/RelayResponseNormalizer.js.flow +44 -42
  164. package/store/RelayStoreReactFlightUtils.js.flow +4 -5
  165. package/store/RelayStoreSubscriptions.js.flow +10 -9
  166. package/store/RelayStoreTypes.js.flow +73 -30
  167. package/store/RelayStoreUtils.js.flow +9 -10
  168. package/store/ResolverCache.js.flow +17 -15
  169. package/store/ResolverFragments.js.flow +18 -25
  170. package/store/StoreInspector.js.flow +3 -3
  171. package/store/TypeID.js.flow +2 -2
  172. package/store/ViewerPattern.js.flow +3 -3
  173. package/store/cloneRelayHandleSourceField.js.flow +6 -7
  174. package/store/cloneRelayScalarHandleSourceField.js.flow +6 -7
  175. package/store/createFragmentSpecResolver.js.flow +4 -5
  176. package/store/createRelayContext.js.flow +3 -3
  177. package/store/defaultGetDataID.js.flow +1 -1
  178. package/store/defaultRequiredFieldLogger.js.flow +1 -1
  179. package/store/hasOverlappingIDs.js.flow +1 -1
  180. package/store/isRelayModernEnvironment.js.flow +1 -1
  181. package/store/normalizeRelayPayload.js.flow +7 -8
  182. package/store/readInlineData.js.flow +8 -9
  183. package/subscription/requestSubscription.js.flow +16 -25
  184. package/util/JSResourceTypes.flow.js.flow +1 -1
  185. package/util/NormalizationNode.js.flow +1 -1
  186. package/util/ReaderNode.js.flow +10 -1
  187. package/util/RelayConcreteNode.js.flow +4 -1
  188. package/util/RelayDefaultHandleKey.js.flow +1 -1
  189. package/util/RelayError.js.flow +1 -1
  190. package/util/RelayFeatureFlags.js.flow +15 -5
  191. package/util/RelayProfiler.js.flow +1 -1
  192. package/util/RelayReplaySubject.js.flow +3 -4
  193. package/util/RelayRuntimeTypes.js.flow +70 -3
  194. package/util/StringInterner.js.flow +69 -0
  195. package/util/createPayloadFor3DField.js.flow +4 -4
  196. package/util/deepFreeze.js.flow +1 -1
  197. package/util/generateID.js.flow +1 -1
  198. package/util/getAllRootVariables.js.flow +36 -0
  199. package/util/getFragmentIdentifier.js.flow +28 -16
  200. package/util/getOperation.js.flow +3 -3
  201. package/util/getPaginationMetadata.js.flow +6 -11
  202. package/util/getPaginationVariables.js.flow +6 -10
  203. package/util/getPendingOperationsForFragment.js.flow +3 -3
  204. package/util/getRefetchMetadata.js.flow +8 -12
  205. package/util/getRelayHandleKey.js.flow +2 -3
  206. package/util/getRequestIdentifier.js.flow +4 -4
  207. package/util/getValueAtPath.js.flow +1 -1
  208. package/util/isEmptyObject.js.flow +1 -1
  209. package/util/isPromise.js.flow +1 -1
  210. package/util/isScalarAndEqual.js.flow +1 -1
  211. package/util/recycleNodesInto.js.flow +1 -1
  212. package/util/registerEnvironmentWithDevTools.js.flow +1 -1
  213. package/util/reportMissingRequiredFields.js.flow +1 -1
  214. package/util/resolveImmediate.js.flow +2 -2
  215. package/util/stableCopy.js.flow +1 -1
  216. package/util/withDuration.js.flow +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -14,14 +14,14 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
14
14
 
15
15
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
16
16
 
17
- var RelayConcreteNode = require('../util/RelayConcreteNode');
18
-
19
17
  var getRelayHandleKey = require('../util/getRelayHandleKey');
20
18
 
21
- var invariant = require('invariant');
19
+ var RelayConcreteNode = require('../util/RelayConcreteNode');
22
20
 
23
21
  var stableCopy = require('../util/stableCopy');
24
22
 
23
+ var invariant = require('invariant');
24
+
25
25
  var VARIABLE = RelayConcreteNode.VARIABLE,
26
26
  LITERAL = RelayConcreteNode.LITERAL,
27
27
  OBJECT_VALUE = RelayConcreteNode.OBJECT_VALUE,
@@ -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
 
@@ -194,6 +193,7 @@ function getModuleOperationKey(documentName) {
194
193
 
195
194
  var RelayStoreUtils = {
196
195
  ACTOR_IDENTIFIER_KEY: '__actorIdentifier',
196
+ CLIENT_EDGE_TRAVERSAL_PATH: '__clientEdgeTraversalPath',
197
197
  FRAGMENTS_KEY: '__fragments',
198
198
  FRAGMENT_OWNER_KEY: '__fragmentOwner',
199
199
  FRAGMENT_PROP_NAME_KEY: '__fragmentPropName',
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -14,22 +14,22 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
14
14
 
15
15
  var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
16
16
 
17
- var RelayModernRecord = require('./RelayModernRecord');
18
-
19
17
  var recycleNodesInto = require('../util/recycleNodesInto');
20
18
 
21
- var warning = require("fbjs/lib/warning");
22
-
23
19
  var _require = require('./ClientID'),
24
20
  generateClientID = _require.generateClientID;
25
21
 
22
+ var RelayModernRecord = require('./RelayModernRecord');
23
+
26
24
  var _require2 = require('./RelayStoreUtils'),
27
- RELAY_RESOLVER_VALUE_KEY = _require2.RELAY_RESOLVER_VALUE_KEY,
28
- RELAY_RESOLVER_INVALIDATION_KEY = _require2.RELAY_RESOLVER_INVALIDATION_KEY,
29
25
  RELAY_RESOLVER_INPUTS_KEY = _require2.RELAY_RESOLVER_INPUTS_KEY,
26
+ RELAY_RESOLVER_INVALIDATION_KEY = _require2.RELAY_RESOLVER_INVALIDATION_KEY,
30
27
  RELAY_RESOLVER_READER_SELECTOR_KEY = _require2.RELAY_RESOLVER_READER_SELECTOR_KEY,
28
+ RELAY_RESOLVER_VALUE_KEY = _require2.RELAY_RESOLVER_VALUE_KEY,
31
29
  getStorageKey = _require2.getStorageKey;
32
30
 
31
+ var warning = require("fbjs/lib/warning");
32
+
33
33
  // $FlowFixMe[unclear-type] - will always be empty
34
34
  var emptySet = new Set();
35
35
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -10,14 +10,18 @@
10
10
  // flowlint ambiguous-object-type:error
11
11
  'use strict';
12
12
 
13
- var invariant = require('invariant');
14
-
15
13
  var _require = require('../query/GraphQLTag'),
16
14
  getFragment = _require.getFragment;
17
15
 
18
16
  var _require2 = require('./RelayModernSelector'),
19
17
  getSelector = _require2.getSelector;
20
18
 
19
+ var invariant = require('invariant'); // When we call the user-supplied resolver function, it will in turn call
20
+ // `readFragment`, but that's a global function -- it needs information
21
+ // about what resolver is being executed, which is supplied by putting the
22
+ // info on this stack before we call the resolver function.
23
+
24
+
21
25
  var contextStack = [];
22
26
 
23
27
  function withResolverContext(context, cb) {
@@ -33,22 +37,22 @@ function withResolverContext(context, cb) {
33
37
  // The declarations ensure that the type of the returned data is:
34
38
  // - non-nullable if the provided ref type is non-nullable
35
39
  // - nullable if the provided ref type is nullable
36
- // - array of non-nullable if the privoided ref type is an array of
40
+ // - array of non-nullable if the provided ref type is an array of
37
41
  // non-nullable refs
38
- // - array of nullable if the privoided ref type is an array of nullable refs
42
+ // - array of nullable if the provided ref type is an array of nullable refs
39
43
 
40
44
 
41
- function readFragment(fragmentInput, fragmentRef) {
45
+ function readFragment(fragmentInput, fragmentKey) {
42
46
  if (!contextStack.length) {
43
47
  throw new Error('readFragment should be called only from within a Relay Resolver function.');
44
48
  }
45
49
 
46
50
  var context = contextStack[contextStack.length - 1];
47
51
  var fragmentNode = getFragment(fragmentInput);
48
- var fragmentSelector = getSelector(fragmentNode, fragmentRef);
52
+ var fragmentSelector = getSelector(fragmentNode, fragmentKey);
49
53
  !(fragmentSelector != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "Expected a selector for the fragment of the resolver ".concat(fragmentNode.name, ", but got null.")) : invariant(false) : void 0;
50
54
  !(fragmentSelector.kind === 'SingularReaderSelector') ? process.env.NODE_ENV !== "production" ? invariant(false, "Expected a singular reader selector for the fragment of the resolver ".concat(fragmentNode.name, ", but it was plural.")) : invariant(false) : void 0;
51
- return context.getDataForResolverFragment(fragmentSelector, fragmentRef);
55
+ return context.getDataForResolverFragment(fragmentSelector, fragmentKey);
52
56
  }
53
57
 
54
58
  module.exports = {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -10,16 +10,15 @@
10
10
  // flowlint ambiguous-object-type:error
11
11
  'use strict';
12
12
 
13
- var areEqual = require("fbjs/lib/areEqual");
14
-
15
- var invariant = require('invariant');
16
-
17
13
  var _require = require('../util/RelayConcreteNode'),
18
14
  LINKED_FIELD = _require.LINKED_FIELD;
19
15
 
20
16
  var _require2 = require('./RelayStoreUtils'),
21
17
  getHandleStorageKey = _require2.getHandleStorageKey;
22
18
 
19
+ var areEqual = require("fbjs/lib/areEqual");
20
+
21
+ var invariant = require('invariant');
23
22
  /**
24
23
  * @private
25
24
  *
@@ -27,6 +26,8 @@ var _require2 = require('./RelayStoreUtils'),
27
26
  * field (on which the handle was declared) among the sibling `selections`, and
28
27
  * copying its selections into the clone.
29
28
  */
29
+
30
+
30
31
  function cloneRelayHandleSourceField(handleField, selections, variables) {
31
32
  var sourceField = selections.find(function (source) {
32
33
  return source.kind === LINKED_FIELD && source.name === handleField.name && source.alias === handleField.alias && areEqual(source.args, handleField.args);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -10,22 +10,23 @@
10
10
  // flowlint ambiguous-object-type:error
11
11
  'use strict';
12
12
 
13
- var areEqual = require("fbjs/lib/areEqual");
14
-
15
- var invariant = require('invariant');
16
-
17
13
  var _require = require('../util/RelayConcreteNode'),
18
14
  SCALAR_FIELD = _require.SCALAR_FIELD;
19
15
 
20
16
  var _require2 = require('./RelayStoreUtils'),
21
17
  getHandleStorageKey = _require2.getHandleStorageKey;
22
18
 
19
+ var areEqual = require("fbjs/lib/areEqual");
20
+
21
+ var invariant = require('invariant');
23
22
  /**
24
23
  * @private
25
24
  *
26
25
  * Creates a clone of the supplied `handleField` by finding the original scalar
27
26
  * field (on which the handle was declared) among the sibling `selections`.
28
27
  */
28
+
29
+
29
30
  function cloneRelayScalarHandleSourceField(handleField, selections, variables) {
30
31
  var sourceField = selections.find(function (source) {
31
32
  return source.kind === SCALAR_FIELD && source.name === handleField.name && source.alias === handleField.alias && areEqual(source.args, handleField.args);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -10,7 +10,9 @@
10
10
  // flowlint ambiguous-object-type:error
11
11
  'use strict';
12
12
 
13
- var invariant = require('invariant');
13
+ var invariant = require('invariant'); // Ideally, we'd just import the type of the react module, but this causes Flow
14
+ // problems.
15
+
14
16
 
15
17
  var relayContext;
16
18
  var firstReact;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -10,14 +10,18 @@
10
10
  // flowlint ambiguous-object-type:error
11
11
  'use strict';
12
12
 
13
- var invariant = require('invariant');
14
-
15
13
  var _require = require('../query/GraphQLTag'),
16
14
  getInlineDataFragment = _require.getInlineDataFragment;
17
15
 
18
16
  var _require2 = require('./RelayStoreUtils'),
19
17
  FRAGMENTS_KEY = _require2.FRAGMENTS_KEY;
20
18
 
19
+ var invariant = require('invariant');
20
+ /**
21
+ * Reads an @inline data fragment that was spread into the parent fragment.
22
+ */
23
+
24
+
21
25
  function readInlineData(fragment, fragmentRef) {
22
26
  var _fragmentRef$FRAGMENT;
23
27
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -12,10 +12,6 @@
12
12
 
13
13
  var RelayDeclarativeMutationConfig = require('../mutations/RelayDeclarativeMutationConfig');
14
14
 
15
- var RelayFeatureFlags = require('../util/RelayFeatureFlags');
16
-
17
- var warning = require("fbjs/lib/warning");
18
-
19
15
  var _require = require('../query/GraphQLTag'),
20
16
  getRequest = _require.getRequest;
21
17
 
@@ -25,6 +21,8 @@ var _require2 = require('../store/RelayModernOperationDescriptor'),
25
21
  var _require3 = require('../store/RelayModernSelector'),
26
22
  createReaderSelector = _require3.createReaderSelector;
27
23
 
24
+ var warning = require("fbjs/lib/warning");
25
+
28
26
  function requestSubscription(environment, config) {
29
27
  var subscription = getRequest(config.subscription);
30
28
 
@@ -48,7 +46,7 @@ function requestSubscription(environment, config) {
48
46
  config.updater) : config,
49
47
  updater = _ref.updater;
50
48
 
51
- var sub = environment.execute({
49
+ var sub = environment.executeSubscription({
52
50
  operation: operation,
53
51
  updater: updater
54
52
  }).subscribe({
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -27,6 +27,7 @@ var RelayConcreteNode = {
27
27
  ACTOR_CHANGE: 'ActorChange',
28
28
  CONDITION: 'Condition',
29
29
  CLIENT_COMPONENT: 'ClientComponent',
30
+ CLIENT_EDGE: 'ClientEdge',
30
31
  CLIENT_EXTENSION: 'ClientExtension',
31
32
  DEFER: 'Defer',
32
33
  CONNECTION: 'Connection',
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -11,10 +11,11 @@
11
11
  'use strict';
12
12
 
13
13
  var RelayFeatureFlags = {
14
+ DELAY_CLEANUP_OF_PENDING_PRELOAD_QUERIES: false,
15
+ ENABLE_CLIENT_EDGES: false,
14
16
  ENABLE_VARIABLE_CONNECTION_KEY: false,
15
17
  ENABLE_PARTIAL_RENDERING_DEFAULT: true,
16
18
  ENABLE_REACT_FLIGHT_COMPONENT_FIELD: false,
17
- ENABLE_REQUIRED_DIRECTIVES: false,
18
19
  ENABLE_RELAY_RESOLVERS: false,
19
20
  ENABLE_GETFRAGMENTIDENTIFIER_OPTIMIZATION: false,
20
21
  ENABLE_FRIENDLY_QUERY_NAME_GQL_URL: false,
@@ -23,6 +24,10 @@ var RelayFeatureFlags = {
23
24
  ENABLE_NOTIFY_SUBSCRIPTION: false,
24
25
  BATCH_ASYNC_MODULE_UPDATES_FN: null,
25
26
  ENABLE_CONTAINERS_SUBSCRIBE_ON_COMMIT: false,
26
- ENABLE_QUERY_RENDERER_OFFSCREEN_SUPPORT: false
27
+ ENABLE_QUERY_RENDERER_OFFSCREEN_SUPPORT: false,
28
+ MAX_DATA_ID_LENGTH: null,
29
+ REFACTOR_SUSPENSE_RESOURCE: true,
30
+ STRING_INTERN_LEVEL: 0,
31
+ USE_REACT_CACHE: false
27
32
  };
28
33
  module.exports = RelayFeatureFlags;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -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
  */
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ *
8
+ * @format
9
+ */
10
+ // flowlint ambiguous-object-type:error
11
+ 'use strict';
12
+
13
+ var internTable = new Map();
14
+ var nextIndex = 1;
15
+ var digits = initDigitTable(); // Character used as the prefix for interned strings. The specific character is
16
+ // chosen to reduce the likelihood that non-interned input strings need to be
17
+ // escaped (choosing eg a-Z would increase the likelihood we need to escape)
18
+
19
+ var INTERN_PREFIX = '\t'; // Character used as the prefix of escaped strings. As above, this is also
20
+ // chosen to be unlikely in normal input strings.
21
+
22
+ var ESCAPE_PREFIX = '\v';
23
+
24
+ function initDigitTable() {
25
+ // disable lint because digits isn't defined when this function is called
26
+ // eslint-disable-next-line no-shadow
27
+ var digits = new Set();
28
+
29
+ for (var i = 0; i < 10; ++i) {
30
+ digits.add(i.toString());
31
+ }
32
+
33
+ return digits;
34
+ } // Escape a string so that it cannot conflict with an interned string
35
+
36
+
37
+ function escape(str) {
38
+ if ( // "\t<digit>..." -> "\v\t<digit>..."
39
+ str[0] === INTERN_PREFIX && digits.has(str[1]) || // "\v..." -> "\v\v..."
40
+ str[0] === ESCAPE_PREFIX) {
41
+ return ESCAPE_PREFIX + str;
42
+ }
43
+
44
+ return str;
45
+ } // Interns the input string if its length equals or exceeds the given `limit`,
46
+ // returning a shorter replacement string that is uniquely associated with the
47
+ // input: multiple calls to intern() for the equivalent input strings (and limit)
48
+ // will always return the exact same string.
49
+ // Strings shorter than the limit are not interned but are escaped if they
50
+ // could conflict with interned strings.
51
+
52
+
53
+ function intern(str, limit) {
54
+ if (limit == null || str.length < limit) {
55
+ return escape(str);
56
+ }
57
+
58
+ var internedString = internTable.get(str);
59
+
60
+ if (internedString != null) {
61
+ return internedString;
62
+ }
63
+
64
+ internedString = INTERN_PREFIX + nextIndex++;
65
+ internTable.set(str, internedString);
66
+ return internedString;
67
+ }
68
+
69
+ module.exports = {
70
+ intern: intern
71
+ };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and 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.
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ *
8
+ * @format
9
+ * @emails oncall+relay
10
+ */
11
+ // flowlint ambiguous-object-type:error
12
+ 'use strict';
13
+
14
+ function getAllRootVariables(userSuppliedVariables, parameters) {
15
+ var providedVariables = parameters.providedVariables;
16
+
17
+ if (providedVariables != null) {
18
+ var allVariables = {};
19
+ Object.assign(allVariables, userSuppliedVariables);
20
+ Object.keys(providedVariables).forEach(function (varName) {
21
+ allVariables[varName] = providedVariables[varName].get();
22
+ });
23
+ return allVariables;
24
+ } else {
25
+ return userSuppliedVariables;
26
+ }
27
+ }
28
+
29
+ module.exports = getAllRootVariables;