react-relay 2.0.0-rc.2 → 5.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 (166) hide show
  1. package/index.js +2 -2
  2. package/lib/ReactRelayContext.js +6 -3
  3. package/lib/ReactRelayFragmentContainer.js +48 -46
  4. package/lib/ReactRelayFragmentMockRenderer.js +5 -1
  5. package/lib/ReactRelayPaginationContainer.js +102 -68
  6. package/lib/ReactRelayQueryFetcher.js +54 -28
  7. package/lib/ReactRelayQueryRenderer.js +28 -20
  8. package/lib/ReactRelayRefetchContainer.js +70 -58
  9. package/lib/ReactRelayTestMocker.js +56 -43
  10. package/lib/ReactRelayTypes.js +1 -1
  11. package/lib/RelayContext.js +8 -2
  12. package/lib/assertFragmentMap.js +9 -7
  13. package/lib/buildReactRelayContainer.js +32 -23
  14. package/lib/index.js +41 -0
  15. package/lib/isRelayEnvironment.js +1 -1
  16. package/lib/isRelayVariables.js +1 -1
  17. package/lib/readContext.js +7 -4
  18. package/package.json +4 -4
  19. package/react-relay.js +2 -2
  20. package/react-relay.min.js +2 -2
  21. package/classic.js +0 -10
  22. package/compat.js +0 -10
  23. package/lib/ConcreteQuery.js +0 -10
  24. package/lib/GraphQLQueryRunner.js +0 -264
  25. package/lib/GraphQLRange.js +0 -1124
  26. package/lib/GraphQLSegment.js +0 -743
  27. package/lib/GraphQLStoreChangeEmitter.js +0 -141
  28. package/lib/GraphQLStoreQueryResolver.js +0 -288
  29. package/lib/GraphQLStoreRangeUtils.js +0 -126
  30. package/lib/QueryBuilder.js +0 -228
  31. package/lib/ReactRelayClassicExports.js +0 -29
  32. package/lib/ReactRelayCompatContainerBuilder.js +0 -175
  33. package/lib/ReactRelayCompatPublic.js +0 -28
  34. package/lib/ReactRelayContainerProfiler.js +0 -30
  35. package/lib/ReactRelayFragmentContainer-flowtest.js +0 -201
  36. package/lib/ReactRelayPaginationContainer-flowtest.js +0 -213
  37. package/lib/ReactRelayPublic.js +0 -29
  38. package/lib/ReactRelayRefetchContainer-flowtest.js +0 -191
  39. package/lib/RelayCacheProcessor.js +0 -196
  40. package/lib/RelayChangeTracker.js +0 -83
  41. package/lib/RelayClassicContainerUtils.js +0 -49
  42. package/lib/RelayClassicCore.js +0 -34
  43. package/lib/RelayClassicRecordState.js +0 -31
  44. package/lib/RelayCompatContainer.js +0 -25
  45. package/lib/RelayCompatEnvironment.js +0 -27
  46. package/lib/RelayCompatMutations.js +0 -133
  47. package/lib/RelayCompatPaginationContainer.js +0 -27
  48. package/lib/RelayCompatRefetchContainer.js +0 -27
  49. package/lib/RelayCompatTypes.js +0 -10
  50. package/lib/RelayContainer.js +0 -889
  51. package/lib/RelayContainerComparators.js +0 -75
  52. package/lib/RelayContainerProxy.js +0 -21
  53. package/lib/RelayDefaultNetworkLayer.js +0 -192
  54. package/lib/RelayEnvironment.js +0 -449
  55. package/lib/RelayEnvironmentTypes.js +0 -10
  56. package/lib/RelayFetchMode.js +0 -17
  57. package/lib/RelayFragmentPointer.js +0 -161
  58. package/lib/RelayFragmentReference.js +0 -249
  59. package/lib/RelayFragmentSpecResolver.js +0 -305
  60. package/lib/RelayGraphQLMutation.js +0 -288
  61. package/lib/RelayGraphQLTag.js +0 -42
  62. package/lib/RelayInternalTypes.js +0 -15
  63. package/lib/RelayInternals.js +0 -24
  64. package/lib/RelayMetaRoute.js +0 -35
  65. package/lib/RelayMockRenderer.js +0 -71
  66. package/lib/RelayModern-flowtest.js +0 -342
  67. package/lib/RelayModernFlowtest_badref.graphql.js +0 -10
  68. package/lib/RelayModernFlowtest_notref.graphql.js +0 -10
  69. package/lib/RelayModernFlowtest_user.graphql.js +0 -10
  70. package/lib/RelayModernFlowtest_users.graphql.js +0 -10
  71. package/lib/RelayMutation.js +0 -322
  72. package/lib/RelayMutationDebugPrinter.js +0 -47
  73. package/lib/RelayMutationQuery.js +0 -558
  74. package/lib/RelayMutationQueue.js +0 -530
  75. package/lib/RelayMutationRequest.js +0 -103
  76. package/lib/RelayMutationTracker.js +0 -113
  77. package/lib/RelayMutationTransaction.js +0 -92
  78. package/lib/RelayMutationTransactionStatus.js +0 -55
  79. package/lib/RelayNetworkDebug.js +0 -131
  80. package/lib/RelayNetworkLayer.js +0 -185
  81. package/lib/RelayNodeInterface.js +0 -104
  82. package/lib/RelayOperationDescriptor.js +0 -40
  83. package/lib/RelayOptimisticMutationUtils.js +0 -208
  84. package/lib/RelayPendingQueryTracker.js +0 -166
  85. package/lib/RelayPropTypes.js +0 -57
  86. package/lib/RelayPublic.js +0 -44
  87. package/lib/RelayQL.js +0 -128
  88. package/lib/RelayQuery.js +0 -1584
  89. package/lib/RelayQueryCaching.js +0 -33
  90. package/lib/RelayQueryConfig.js +0 -58
  91. package/lib/RelayQueryPath.js +0 -204
  92. package/lib/RelayQueryRequest.js +0 -103
  93. package/lib/RelayQueryTracker.js +0 -86
  94. package/lib/RelayQueryTransform.js +0 -91
  95. package/lib/RelayQueryVisitor.js +0 -93
  96. package/lib/RelayQueryWriter.js +0 -573
  97. package/lib/RelayReadyState.js +0 -83
  98. package/lib/RelayReadyStateRenderer.js +0 -145
  99. package/lib/RelayRecord.js +0 -75
  100. package/lib/RelayRecordStatusMap.js +0 -57
  101. package/lib/RelayRecordStore.js +0 -433
  102. package/lib/RelayRecordWriter.js +0 -601
  103. package/lib/RelayRefQueryDescriptor.js +0 -27
  104. package/lib/RelayRenderer.js +0 -268
  105. package/lib/RelayRootContainer.js +0 -125
  106. package/lib/RelayRoute.js +0 -92
  107. package/lib/RelayRouteFragment.js +0 -44
  108. package/lib/RelaySelector.js +0 -201
  109. package/lib/RelayShallowMock.js +0 -69
  110. package/lib/RelayStaticContainer.js +0 -38
  111. package/lib/RelayStore.js +0 -12
  112. package/lib/RelayStoreConstants.js +0 -20
  113. package/lib/RelayStoreData.js +0 -660
  114. package/lib/RelayTaskQueue.js +0 -189
  115. package/lib/RelayTypes.js +0 -13
  116. package/lib/RelayVariable.js +0 -32
  117. package/lib/RelayVariables.js +0 -92
  118. package/lib/buildRQL.js +0 -160
  119. package/lib/callsFromGraphQL.js +0 -74
  120. package/lib/callsToGraphQL.js +0 -34
  121. package/lib/checkRelayQueryData.js +0 -250
  122. package/lib/createRelayQuery.js +0 -17
  123. package/lib/dedent.js +0 -49
  124. package/lib/diffRelayQuery.js +0 -757
  125. package/lib/directivesToGraphQL.js +0 -39
  126. package/lib/filterRelayQuery.js +0 -29
  127. package/lib/findRelayQueryLeaves.js +0 -293
  128. package/lib/flattenRelayQuery.js +0 -121
  129. package/lib/flattenSplitRelayQueries.js +0 -44
  130. package/lib/forEachRootCallArg.js +0 -40
  131. package/lib/fromGraphQL.js +0 -48
  132. package/lib/generateClientEdgeID.js +0 -22
  133. package/lib/generateClientID.js +0 -27
  134. package/lib/generateConcreteFragmentID.js +0 -30
  135. package/lib/generateForceIndex.js +0 -24
  136. package/lib/generateRQLFieldAlias.js +0 -39
  137. package/lib/getRangeBehavior.js +0 -58
  138. package/lib/getRelayQueries.js +0 -83
  139. package/lib/intersectRelayQuery.js +0 -149
  140. package/lib/isClassicRelayContext.js +0 -20
  141. package/lib/isClassicRelayEnvironment.js +0 -20
  142. package/lib/isCompatibleRelayFragmentType.js +0 -27
  143. package/lib/isRelayContainer.js +0 -16
  144. package/lib/makeLegacyStringishComponentRef.js +0 -52
  145. package/lib/printRelayOSSQuery.js +0 -329
  146. package/lib/printRelayQuery.js +0 -26
  147. package/lib/rangeOperationToMetadataKey.js +0 -25
  148. package/lib/readRelayQueryData.js +0 -551
  149. package/lib/relayUnstableBatchedUpdates.js +0 -12
  150. package/lib/relayUnstableBatchedUpdates.native.js +0 -11
  151. package/lib/restoreRelayCacheData.js +0 -188
  152. package/lib/serializeRelayQueryCall.js +0 -42
  153. package/lib/splitDeferredRelayQueries.js +0 -298
  154. package/lib/stableStringify.js +0 -85
  155. package/lib/testEditDistance.js +0 -112
  156. package/lib/throwFailedPromise.js +0 -26
  157. package/lib/toGraphQL.js +0 -94
  158. package/lib/transformRelayQueryPayload.js +0 -145
  159. package/lib/validateMutationConfig.js +0 -117
  160. package/lib/validateRelayReadQuery.js +0 -112
  161. package/lib/writeRelayQueryPayload.js +0 -44
  162. package/lib/writeRelayUpdatePayload.js +0 -513
  163. package/react-relay-classic.js +0 -4
  164. package/react-relay-classic.min.js +0 -9
  165. package/react-relay-compat.js +0 -4
  166. package/react-relay-compat.min.js +0 -9
@@ -1,24 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its 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
- * strict
8
- * @format
9
- */
10
- 'use strict';
11
-
12
- var _index = 1;
13
- /**
14
- * Generate a new force index used to write GraphQL data in the store. A new
15
- * force index can be used to overwrite previous ranges.
16
- *
17
- * @internal
18
- */
19
-
20
- function generateForceIndex() {
21
- return _index++;
22
- }
23
-
24
- module.exports = generateForceIndex;
@@ -1,39 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its 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
- * strict-local
8
- * @format
9
- */
10
- 'use strict';
11
- /* eslint-disable no-bitwise */
12
-
13
- var PREFIX = '_';
14
- /**
15
- * @internal
16
- *
17
- * Sanitizes a stringified GraphQL field (including any calls and their values)
18
- * to produce a valid alias.
19
- *
20
- * This is used to auto-alias fields in generated queries, so that developers
21
- * composing multiple components together don't have to worry about collisions
22
- * between components requesting the same fields. (Explicit aliases are only
23
- * needed within a single component when it uses the same field multiple times,
24
- * in order to differentiate these fields in the props).
25
- */
26
-
27
- function generateRQLFieldAlias(input) {
28
- // Field names with no calls can be used as aliases without encoding
29
- var index = input.indexOf('.');
30
-
31
- if (index === -1) {
32
- return input;
33
- } // Unsign crc32 hash so we do not base62 encode a negative number.
34
-
35
-
36
- return PREFIX + input.substr(0, index) + require("fbjs/lib/base62")(require("fbjs/lib/crc32")(input) >>> 0);
37
- }
38
-
39
- module.exports = generateRQLFieldAlias;
@@ -1,58 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its 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
- * strict-local
8
- * @format
9
- */
10
- 'use strict';
11
-
12
- /**
13
- * Return the action (prepend/append) to use when adding an item to
14
- * the range with the specified calls.
15
- *
16
- * Ex:
17
- * rangeBehaviors: `{'orderby(recent)': 'append'}`
18
- * calls: `[{name: 'orderby', value: 'recent'}]`
19
- *
20
- * Returns `'append'`
21
- */
22
- function getRangeBehavior(rangeBehaviors, calls) {
23
- if (typeof rangeBehaviors === 'function') {
24
- var rangeFilterCalls = getObjectFromCalls(calls);
25
- return rangeBehaviors(rangeFilterCalls);
26
- } else {
27
- var rangeBehaviorKey = calls.map(require("./serializeRelayQueryCall")).sort().join('').slice(1);
28
- var behavior = rangeBehaviors[rangeBehaviorKey];
29
-
30
- if (behavior == null) {
31
- return null;
32
- }
33
-
34
- !(typeof behavior === 'string') ? process.env.NODE_ENV !== "production" ? require("fbjs/lib/invariant")(false, 'getRangeBehavior(): Expected range behavior for key `%s` to be a ' + 'string, got `%s`.', rangeBehaviorKey, behavior) : require("fbjs/lib/invariant")(false) : void 0;
35
- return behavior;
36
- }
37
- }
38
- /**
39
- * Returns an object representation of the rangeFilterCalls that
40
- * will be passed to config.rangeBehaviors
41
- *
42
- * Example:
43
- * calls: `[{name: 'orderby', value: 'recent'}]`
44
- *
45
- * Returns:
46
- * `{orderby: 'recent'}`
47
- */
48
-
49
-
50
- function getObjectFromCalls(calls) {
51
- var behaviors = {};
52
- calls.forEach(function (call) {
53
- behaviors[call.name] = call.value;
54
- });
55
- return behaviors;
56
- }
57
-
58
- module.exports = getRangeBehavior;
@@ -1,83 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its 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
- 'use strict';
11
-
12
- var queryCache = new Map();
13
- /**
14
- * @internal
15
- *
16
- * `getRelayQueries` retrieves all queries for a component given a route.
17
- */
18
-
19
- function getRelayQueries(Component, route) {
20
- var queryCachingEnabled = require("./RelayQueryCaching").getEnabled();
21
-
22
- if (!queryCachingEnabled) {
23
- return buildQuerySet(Component, route);
24
- }
25
-
26
- var cache = queryCache.get(Component);
27
-
28
- if (!cache) {
29
- cache = {};
30
- queryCache.set(Component, cache);
31
- }
32
-
33
- var cacheKey = route.name + ':' + require("./stableStringify")(route.params);
34
-
35
- if (cache.hasOwnProperty(cacheKey)) {
36
- return cache[cacheKey];
37
- }
38
-
39
- var querySet = buildQuerySet(Component, route);
40
- cache[cacheKey] = querySet;
41
- return querySet;
42
- }
43
- /**
44
- * @internal
45
- */
46
-
47
-
48
- function buildQuerySet(Component, route) {
49
- var querySet = {};
50
- Component.getFragmentNames().forEach(function (fragmentName) {
51
- querySet[fragmentName] = null;
52
- });
53
- Object.keys(route.queries).forEach(function (queryName) {
54
- if (!Component.hasFragment(queryName)) {
55
- process.env.NODE_ENV !== "production" ? require("fbjs/lib/warning")(false, 'Relay.QL: query `%s.queries.%s` is invalid, expected fragment ' + '`%s.fragments.%s` to be defined.', route.name, queryName, Component.displayName, queryName) : void 0;
56
- return;
57
- }
58
-
59
- var queryBuilder = route.queries[queryName];
60
-
61
- if (queryBuilder) {
62
- var concreteQuery = require("./buildRQL").Query(queryBuilder, Component, queryName, route.params);
63
-
64
- !(concreteQuery !== undefined) ? process.env.NODE_ENV !== "production" ? require("fbjs/lib/invariant")(false, 'Relay.QL: query `%s.queries.%s` is invalid, a typical query is ' + 'defined using: () => Relay.QL`query { ... }`.', route.name, queryName) : require("fbjs/lib/invariant")(false) : void 0;
65
-
66
- if (concreteQuery) {
67
- var rootQuery = require("./RelayQuery").Root.create(concreteQuery, require("./RelayMetaRoute").get(route.name), route.params);
68
-
69
- var identifyingArg = rootQuery.getIdentifyingArg();
70
-
71
- if (!identifyingArg || identifyingArg.value !== undefined) {
72
- querySet[queryName] = rootQuery;
73
- return;
74
- }
75
- }
76
- }
77
-
78
- querySet[queryName] = null;
79
- });
80
- return querySet;
81
- }
82
-
83
- module.exports = require("relay-runtime").RelayProfiler.instrument('Relay.getQueries', getRelayQueries);
@@ -1,149 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its 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
- 'use strict';
11
-
12
- var _inheritsLoose2 = require("@babel/runtime/helpers/interopRequireDefault")(require("@babel/runtime/helpers/inheritsLoose"));
13
-
14
- /**
15
- * @internal
16
- *
17
- * `intersectRelayQuery(subjectNode, patternNode)` returns a node with fields in
18
- * `subjectNode` that also exist in `patternNode`. `patternNode` is expected to
19
- * be flattened (and not contain fragments).
20
- *
21
- * If any field in `patternNode` is unterminated (i.e. has no sub-fields), we
22
- * treat the field as though it contains every descendant sub-field.
23
- *
24
- * If `filterUnterminatedRange` is supplied, it will be invoked with any fields
25
- * from `subjectNode` that are connections and unterminated in `patternNode`. If
26
- * it returns true, the `edges` and `page_info` fields will be filtered out.
27
- */
28
- function intersectRelayQuery(subjectNode, patternNode, filterUnterminatedRange) {
29
- filterUnterminatedRange = filterUnterminatedRange || returnsFalse;
30
- var visitor = new RelayQueryIntersector(filterUnterminatedRange);
31
- return visitor.traverse(subjectNode, patternNode);
32
- }
33
-
34
- var RelayQueryIntersector =
35
- /*#__PURE__*/
36
- function (_RelayQueryTransform) {
37
- (0, _inheritsLoose2["default"])(RelayQueryIntersector, _RelayQueryTransform);
38
-
39
- function RelayQueryIntersector(filterUnterminatedRange) {
40
- var _this;
41
-
42
- _this = _RelayQueryTransform.call(this) || this;
43
- _this._filterUnterminatedRange = filterUnterminatedRange;
44
- return _this;
45
- }
46
-
47
- var _proto = RelayQueryIntersector.prototype;
48
-
49
- _proto.traverse = function traverse(subjectNode, patternNode) {
50
- var _this2 = this;
51
-
52
- if (!subjectNode.canHaveSubselections()) {
53
- // Since `patternNode` exists, `subjectNode` must be in the intersection.
54
- return subjectNode;
55
- }
56
-
57
- if (!hasChildren(patternNode)) {
58
- if (subjectNode instanceof require("./RelayQuery").Field && subjectNode.isConnection() && this._filterUnterminatedRange(subjectNode)) {
59
- return filterRangeFields(subjectNode);
60
- } // Unterminated `patternNode` is the same as containing every descendant
61
- // sub-field, so `subjectNode` must be in the intersection.
62
-
63
-
64
- return subjectNode;
65
- }
66
-
67
- return subjectNode.clone(subjectNode.getChildren().map(function (subjectChild) {
68
- if (subjectChild instanceof require("./RelayQuery").Fragment) {
69
- return _this2.visit(subjectChild, patternNode);
70
- }
71
-
72
- if (subjectChild instanceof require("./RelayQuery").Field) {
73
- var schemaName = subjectChild.getSchemaName();
74
- var patternChild;
75
- var patternChildren = patternNode.getChildren();
76
-
77
- for (var ii = 0; ii < patternChildren.length; ii++) {
78
- var child = patternChildren[ii];
79
- !(child instanceof require("./RelayQuery").Field) ? process.env.NODE_ENV !== "production" ? require("fbjs/lib/invariant")(false, 'intersectRelayQuery(): Nodes in `patternNode` must be fields.') : require("fbjs/lib/invariant")(false) : void 0;
80
-
81
- if (child.getSchemaName() === schemaName) {
82
- patternChild = child;
83
- break;
84
- }
85
- }
86
-
87
- if (patternChild) {
88
- return _this2.visit(subjectChild, patternChild);
89
- }
90
- }
91
-
92
- return null;
93
- }));
94
- };
95
-
96
- return RelayQueryIntersector;
97
- }(require("./RelayQueryTransform"));
98
- /**
99
- * @private
100
- */
101
-
102
-
103
- var RelayQueryRangeFilter =
104
- /*#__PURE__*/
105
- function (_RelayQueryTransform2) {
106
- (0, _inheritsLoose2["default"])(RelayQueryRangeFilter, _RelayQueryTransform2);
107
-
108
- function RelayQueryRangeFilter() {
109
- return _RelayQueryTransform2.apply(this, arguments) || this;
110
- }
111
-
112
- var _proto2 = RelayQueryRangeFilter.prototype;
113
-
114
- _proto2.visitField = function visitField(node) {
115
- var _ConnectionInterface$ = require("relay-runtime").ConnectionInterface.get(),
116
- EDGES = _ConnectionInterface$.EDGES,
117
- PAGE_INFO = _ConnectionInterface$.PAGE_INFO;
118
-
119
- var schemaName = node.getSchemaName();
120
-
121
- if (schemaName === EDGES || schemaName === PAGE_INFO) {
122
- return null;
123
- } else {
124
- return node;
125
- }
126
- };
127
-
128
- return RelayQueryRangeFilter;
129
- }(require("./RelayQueryTransform"));
130
-
131
- var rangeFilter = new RelayQueryRangeFilter();
132
-
133
- function filterRangeFields(node) {
134
- return rangeFilter.traverse(node, undefined);
135
- }
136
-
137
- function returnsFalse() {
138
- return false;
139
- }
140
-
141
- function hasChildren(node) {
142
- return !node.getChildren().every(isGenerated);
143
- }
144
-
145
- function isGenerated(node) {
146
- return node.isGenerated();
147
- }
148
-
149
- module.exports = intersectRelayQuery;
@@ -1,20 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its 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
- * strict
8
- * @format
9
- */
10
- 'use strict';
11
-
12
- /**
13
- * Determine if a given value is an object that implements the `RelayContext`
14
- * interface.
15
- */
16
- function isClassicRelayContext(relay) {
17
- return typeof relay === 'object' && relay !== null && !Array.isArray(relay) && require("./isClassicRelayEnvironment")(relay.environment) && require("./isRelayVariables")(relay.variables);
18
- }
19
-
20
- module.exports = isClassicRelayContext;
@@ -1,20 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its 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
- * strict
8
- * @format
9
- */
10
- 'use strict';
11
- /**
12
- * Determine if a given value is an object that implements the `RelayEnvironment`
13
- * interface.
14
- */
15
-
16
- function isClassicRelayEnvironment(environment) {
17
- return typeof environment === 'object' && environment !== null && typeof environment.applyMutation === 'function' && typeof environment.sendMutation === 'function' && typeof environment.forceFetch === 'function' && typeof environment.getFragmentResolver === 'function' && typeof environment.getStoreData === 'function' && typeof environment.primeCache === 'function';
18
- }
19
-
20
- module.exports = isClassicRelayEnvironment;
@@ -1,27 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its 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
- 'use strict';
11
-
12
- /**
13
- * @internal
14
- *
15
- * Determine if the given fragment's type is compatible with the given record
16
- * type. The types are considered compatible if they exactly match or in the
17
- * following cases:
18
- * - Types are not recorded for optimistic records; if the record type is null
19
- * it is assumed to be compatible with the fragment.
20
- * - Abstract fragments are assumed to be compatible with all types; being more
21
- * precise would require access to the full schema inheritance hierarchy.
22
- */
23
- function isCompatibleRelayFragmentType(fragment, recordType) {
24
- return recordType === fragment.getType() || !recordType || fragment.isAbstract();
25
- }
26
-
27
- module.exports = isCompatibleRelayFragmentType;
@@ -1,16 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its 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
- 'use strict';
11
-
12
- function isRelayContainer(component) {
13
- return !!(component && component.getFragmentNames && component.getFragment && component.hasFragment && component.hasVariable);
14
- }
15
-
16
- module.exports = isRelayContainer;
@@ -1,52 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its 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
- 'use strict';
11
-
12
- /**
13
- * Instead of ref="component", use this module to mimic a string ref.
14
- * This horrible hack lets us avoid string ref warnings in React strict mode
15
- * until we have time to clean up the various uses of .refs.component.
16
- *
17
- * Track usage at https://fburl.com/relay_containers_string_refs_dashboard
18
- *
19
- * @TODO (T28161354) Remove this hack once string refs have been removed.
20
- */
21
- function makeLegacyStringishComponentRef(parentComponent, componentName) {
22
- var hasWarned = false;
23
-
24
- if (process.env.NODE_ENV !== "production") {
25
- return function ref(childComponent) {
26
- if (!Object.isExtensible(parentComponent.refs)) {
27
- // Probably emptyObject. >.>
28
- parentComponent.refs = {};
29
- } // RelayFBContainerProxy uses this getter to avoid triggering the warning.
30
- // This proxy component logs a separate warning to track its usage.
31
-
32
-
33
- parentComponent.refs.__INTERNAL__component = childComponent; // $FlowFixMe https://github.com/facebook/flow/issues/285
34
-
35
- Object.defineProperty(parentComponent.refs, 'component', {
36
- configurable: true,
37
- get: function get() {
38
- if (!hasWarned) {
39
- hasWarned = true;
40
- process.env.NODE_ENV !== "production" ? require("fbjs/lib/warning")(false, 'RelayContainer: Do not use `container.refs.component` for ' + 'RelayCompat or RelayModern containers. Instead pass ' + '`componentRef={ref}` to `%s`.', componentName) : void 0;
41
- }
42
-
43
- return childComponent;
44
- }
45
- });
46
- };
47
- } else {
48
- return 'component';
49
- }
50
- }
51
-
52
- module.exports = makeLegacyStringishComponentRef;