react-relay 4.0.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +1 -1
- package/lib/ReactRelayContext.js +1 -1
- package/lib/ReactRelayFragmentContainer.js +6 -6
- package/lib/ReactRelayPaginationContainer.js +26 -38
- package/lib/ReactRelayQueryFetcher.js +3 -3
- package/lib/ReactRelayRefetchContainer.js +12 -18
- package/lib/ReactRelayTestMocker.js +14 -14
- package/lib/ReactRelayTypes.js +1 -1
- package/lib/assertFragmentMap.js +1 -1
- package/lib/index.js +1 -1
- package/lib/isRelayEnvironment.js +1 -1
- package/lib/isRelayVariables.js +1 -1
- package/lib/readContext.js +1 -1
- package/package.json +3 -3
- package/react-relay.js +2 -2
- package/react-relay.min.js +2 -2
package/index.js
CHANGED
package/lib/ReactRelayContext.js
CHANGED
@@ -4,7 +4,7 @@
|
|
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.
|
6
6
|
*
|
7
|
-
*
|
7
|
+
*
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
'use strict';
|
@@ -15,10 +15,10 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
15
15
|
|
16
16
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
17
17
|
|
18
|
-
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
19
|
-
|
20
18
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
21
19
|
|
20
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
21
|
+
|
22
22
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
23
23
|
|
24
24
|
var React = require("react");
|
@@ -54,7 +54,7 @@ function createContainerWithFragments(Component, fragments) {
|
|
54
54
|
var _this;
|
55
55
|
|
56
56
|
_this = _React$Component.call(this, props) || this;
|
57
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
57
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_handleFragmentDataUpdate", function () {
|
58
58
|
var resolverFromThisUpdate = _this.state.resolver;
|
59
59
|
|
60
60
|
_this.setState(function (updatedState) {
|
@@ -183,11 +183,11 @@ function createContainerWithFragments(Component, fragments) {
|
|
183
183
|
}
|
184
184
|
|
185
185
|
return false;
|
186
|
-
}
|
186
|
+
}
|
187
187
|
/**
|
188
188
|
* Render new data for the existing props/context.
|
189
189
|
*/
|
190
|
-
|
190
|
+
;
|
191
191
|
|
192
192
|
_proto._rerenderIfStoreHasChanged = function _rerenderIfStoreHasChanged() {
|
193
193
|
var _this$state = this.state,
|
@@ -15,10 +15,10 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
15
15
|
|
16
16
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
17
17
|
|
18
|
-
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
19
|
-
|
20
18
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
21
19
|
|
20
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
21
|
+
|
22
22
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
23
23
|
|
24
24
|
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));
|
@@ -48,7 +48,6 @@ var _require2 = require("./RelayContext"),
|
|
48
48
|
|
49
49
|
var _require3 = require("relay-runtime"),
|
50
50
|
ConnectionInterface = _require3.ConnectionInterface,
|
51
|
-
RelayFeatureFlags = _require3.RelayFeatureFlags,
|
52
51
|
Observable = _require3.Observable,
|
53
52
|
getFragmentOwners = _require3.getFragmentOwners,
|
54
53
|
isScalarAndEqual = _require3.isScalarAndEqual;
|
@@ -268,20 +267,20 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
|
|
268
267
|
var _this;
|
269
268
|
|
270
269
|
_this = _React$Component.call(this, props) || this;
|
271
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
270
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_handleFragmentDataUpdate", function () {
|
272
271
|
_this.setState({
|
273
272
|
data: _this._resolver.resolve()
|
274
273
|
});
|
275
274
|
});
|
276
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
275
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_hasMore", function () {
|
277
276
|
var connectionData = _this._getConnectionData();
|
278
277
|
|
279
278
|
return !!(connectionData && connectionData.hasMore && connectionData.cursor);
|
280
279
|
});
|
281
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
280
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_isLoading", function () {
|
282
281
|
return !!_this._refetchSubscription;
|
283
282
|
});
|
284
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
283
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_refetchConnection", function (totalCount, observerOrCallback, refetchVariables) {
|
285
284
|
if (!_this._canFetchPage('refetchConnection')) {
|
286
285
|
return {
|
287
286
|
dispose: function dispose() {}
|
@@ -303,7 +302,7 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
|
|
303
302
|
dispose: fetch.unsubscribe
|
304
303
|
};
|
305
304
|
});
|
306
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
305
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_loadMore", function (pageSize, observerOrCallback, options) {
|
307
306
|
if (!_this._canFetchPage('loadMore')) {
|
308
307
|
return {
|
309
308
|
dispose: function dispose() {}
|
@@ -446,11 +445,11 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
|
|
446
445
|
refetchConnection: this._refetchConnection,
|
447
446
|
environment: relayContext.environment
|
448
447
|
};
|
449
|
-
}
|
448
|
+
}
|
450
449
|
/**
|
451
450
|
* Render new data for the existing props/context.
|
452
451
|
*/
|
453
|
-
|
452
|
+
;
|
454
453
|
|
455
454
|
_proto._getConnectionData = function _getConnectionData() {
|
456
455
|
// Extract connection data and verify there are more edges to fetch
|
@@ -531,29 +530,22 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
|
|
531
530
|
var props = (0, _objectSpread3["default"])({}, restProps, this.state.data);
|
532
531
|
var rootVariables;
|
533
532
|
var fragmentVariables;
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
// the variables from the fragment owner
|
551
|
-
{}, fragments, restProps, fragmentOwners);
|
552
|
-
} else {
|
553
|
-
rootVariables = this.props.__relayContext.variables;
|
554
|
-
fragmentVariables = getVariablesFromObject(rootVariables, fragments, restProps);
|
555
|
-
}
|
556
|
-
|
533
|
+
var fragmentOwners = getFragmentOwners(fragments, restProps); // NOTE: rootVariables are spread down below in a couple of places,
|
534
|
+
// so we compute them here from the fragment owners.
|
535
|
+
// For extra safety, we make sure the rootVariables include the
|
536
|
+
// variables from all owners in this fragmentSpec, even though they
|
537
|
+
// should all point to the same owner
|
538
|
+
|
539
|
+
forEachObject(fragments, function (__, key) {
|
540
|
+
var _ref, _fragmentOwner$, _ref2;
|
541
|
+
|
542
|
+
var fragmentOwner = fragmentOwners[key];
|
543
|
+
var fragmentOwnerVariables = Array.isArray(fragmentOwner) ? (_ref = (_fragmentOwner$ = fragmentOwner[0]) === null || _fragmentOwner$ === void 0 ? void 0 : _fragmentOwner$.variables) !== null && _ref !== void 0 ? _ref : {} : (_ref2 = fragmentOwner === null || fragmentOwner === void 0 ? void 0 : fragmentOwner.variables) !== null && _ref2 !== void 0 ? _ref2 : {};
|
544
|
+
rootVariables = (0, _objectSpread3["default"])({}, rootVariables, fragmentOwnerVariables);
|
545
|
+
});
|
546
|
+
fragmentVariables = getVariablesFromObject( // NOTE: We pass empty operationVariables because we want to prefer
|
547
|
+
// the variables from the fragment owner
|
548
|
+
{}, fragments, restProps, fragmentOwners);
|
557
549
|
fragmentVariables = (0, _objectSpread3["default"])({}, rootVariables, fragmentVariables, this._refetchVariables);
|
558
550
|
var fetchVariables = connectionConfig.getVariables(props, {
|
559
551
|
count: paginatingVariables.count,
|
@@ -561,11 +553,7 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
|
|
561
553
|
}, fragmentVariables);
|
562
554
|
!(typeof fetchVariables === 'object' && fetchVariables !== null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'ReactRelayPaginationContainer: Expected `getVariables()` to ' + 'return an object, got `%s` in `%s`.', fetchVariables, componentName) : invariant(false) : void 0;
|
563
555
|
fetchVariables = (0, _objectSpread3["default"])({}, fetchVariables, this._refetchVariables);
|
564
|
-
|
565
|
-
if (RelayFeatureFlags.MERGE_FETCH_AND_FRAGMENT_VARS) {
|
566
|
-
fragmentVariables = (0, _objectSpread3["default"])({}, fetchVariables, fragmentVariables);
|
567
|
-
}
|
568
|
-
|
556
|
+
fragmentVariables = (0, _objectSpread3["default"])({}, fetchVariables, fragmentVariables);
|
569
557
|
var cacheConfig = options ? {
|
570
558
|
force: !!options.force
|
571
559
|
} : undefined;
|
@@ -4,7 +4,7 @@
|
|
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.
|
6
6
|
*
|
7
|
-
*
|
7
|
+
*
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
'use strict';
|
@@ -125,7 +125,7 @@ function () {
|
|
125
125
|
}
|
126
126
|
}
|
127
127
|
}
|
128
|
-
}
|
128
|
+
}
|
129
129
|
/**
|
130
130
|
* `fetch` fetches the data for the given operation.
|
131
131
|
* If a result is immediately available synchronously, it will be synchronously
|
@@ -135,7 +135,7 @@ function () {
|
|
135
135
|
* `onDataChange` will be called with the first result (**if it wasn't returned synchronously**),
|
136
136
|
* and then subsequently whenever the data changes.
|
137
137
|
*/
|
138
|
-
|
138
|
+
;
|
139
139
|
|
140
140
|
_proto.fetch = function fetch(fetchOptions) {
|
141
141
|
var _this2 = this;
|
@@ -17,10 +17,10 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
17
17
|
|
18
18
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));
|
19
19
|
|
20
|
-
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
21
|
-
|
22
20
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
23
21
|
|
22
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
23
|
+
|
24
24
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
25
25
|
|
26
26
|
var React = require("react");
|
@@ -43,7 +43,6 @@ var _require2 = require("./RelayContext"),
|
|
43
43
|
|
44
44
|
var _require3 = require("relay-runtime"),
|
45
45
|
Observable = _require3.Observable,
|
46
|
-
RelayFeatureFlags = _require3.RelayFeatureFlags,
|
47
46
|
getFragmentOwners = _require3.getFragmentOwners,
|
48
47
|
isScalarAndEqual = _require3.isScalarAndEqual;
|
49
48
|
|
@@ -65,7 +64,7 @@ function createContainerWithFragments(Component, fragments, taggedNode) {
|
|
65
64
|
var _this;
|
66
65
|
|
67
66
|
_this = _React$Component.call(this, props) || this;
|
68
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
67
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_handleFragmentDataUpdate", function () {
|
69
68
|
var resolverFromThisUpdate = _this.state.resolver;
|
70
69
|
|
71
70
|
_this.setState(function (updatedState) {
|
@@ -77,7 +76,7 @@ function createContainerWithFragments(Component, fragments, taggedNode) {
|
|
77
76
|
);
|
78
77
|
});
|
79
78
|
});
|
80
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
79
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_refetch", function (refetchVariables, renderVariables, observerOrCallback, options) {
|
81
80
|
if (_this._isUnmounted) {
|
82
81
|
process.env.NODE_ENV !== "production" ? warning(false, 'ReactRelayRefetchContainer: Unexpected call of `refetch` ' + 'on unmounted container `%s`. It looks like some instances ' + 'of your container still trying to refetch the data but they already ' + 'unmounted. Please make sure you clear all timers, intervals, async ' + 'calls, etc that may trigger `refetch`.', containerName) : void 0;
|
83
82
|
return {
|
@@ -91,7 +90,7 @@ function createContainerWithFragments(Component, fragments, taggedNode) {
|
|
91
90
|
|
92
91
|
var fetchVariables = typeof refetchVariables === 'function' ? refetchVariables(_this._getFragmentVariables()) : refetchVariables;
|
93
92
|
fetchVariables = (0, _objectSpread2["default"])({}, rootVariables, fetchVariables);
|
94
|
-
var fragmentVariables = renderVariables ?
|
93
|
+
var fragmentVariables = renderVariables ? (0, _objectSpread2["default"])({}, fetchVariables, renderVariables) : fetchVariables;
|
95
94
|
var cacheConfig = options ? {
|
96
95
|
force: !!options.force
|
97
96
|
} : undefined;
|
@@ -225,12 +224,12 @@ function createContainerWithFragments(Component, fragments, taggedNode) {
|
|
225
224
|
|
226
225
|
this._subscribeToNewResolver();
|
227
226
|
}
|
228
|
-
}
|
227
|
+
}
|
229
228
|
/**
|
230
229
|
* When new props are received, read data for the new props and add it to
|
231
230
|
* state. Props may be the same in which case previous data can be reused.
|
232
231
|
*/
|
233
|
-
|
232
|
+
;
|
234
233
|
|
235
234
|
_class.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {
|
236
235
|
// Any props change could impact the query, so we mirror props in state.
|
@@ -329,22 +328,17 @@ function createContainerWithFragments(Component, fragments, taggedNode) {
|
|
329
328
|
data: maybeNewData
|
330
329
|
});
|
331
330
|
}
|
332
|
-
}
|
331
|
+
}
|
333
332
|
/**
|
334
333
|
* Render new data for the existing props/context.
|
335
334
|
*/
|
336
|
-
|
335
|
+
;
|
337
336
|
|
338
337
|
_proto._getFragmentVariables = function _getFragmentVariables() {
|
339
338
|
var getVariablesFromObject = this.props.__relayContext.environment.unstable_internal.getVariablesFromObject;
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
// the variables from the fragment owner
|
344
|
-
{}, fragments, this.props, getFragmentOwners(fragments, this.props));
|
345
|
-
}
|
346
|
-
|
347
|
-
return getVariablesFromObject(this.props.__relayContext.variables, fragments, this.props);
|
339
|
+
return getVariablesFromObject( // NOTE: We pass empty operationVariables because we want to prefer
|
340
|
+
// the variables from the fragment owner
|
341
|
+
{}, fragments, this.props, getFragmentOwners(fragments, this.props));
|
348
342
|
};
|
349
343
|
|
350
344
|
_proto._getQueryFetcher = function _getQueryFetcher() {
|
@@ -57,7 +57,7 @@ function () {
|
|
57
57
|
var toRet = nextId.toString();
|
58
58
|
nextId++;
|
59
59
|
return toRet;
|
60
|
-
}
|
60
|
+
}
|
61
61
|
/**
|
62
62
|
* Create a unique identifier for a (query, variables) pair.
|
63
63
|
* @param request: the request associated with the query
|
@@ -67,16 +67,16 @@ function () {
|
|
67
67
|
* @returns a string which can later be used to uniquely identify this query
|
68
68
|
* in the list of pending queries
|
69
69
|
*/
|
70
|
-
|
70
|
+
;
|
71
71
|
|
72
72
|
ReactRelayTestMocker.getIdentifier = function getIdentifier(request) {
|
73
73
|
return request.name;
|
74
|
-
}
|
74
|
+
}
|
75
75
|
/**
|
76
76
|
* Remove variables that we don't need from the query that will make it more
|
77
77
|
* annoying to test (e.g. client_mutation_id, actor_id)
|
78
78
|
*/
|
79
|
-
|
79
|
+
;
|
80
80
|
|
81
81
|
ReactRelayTestMocker.stripUnused = function stripUnused(variables) {
|
82
82
|
if (variables.input) {
|
@@ -87,7 +87,7 @@ function () {
|
|
87
87
|
}
|
88
88
|
|
89
89
|
return variables;
|
90
|
-
}
|
90
|
+
}
|
91
91
|
/**
|
92
92
|
* Replace the environment's network layer with a mocked out one to allow for
|
93
93
|
* better testing. Mocking the network allows testing without using a mocked
|
@@ -95,7 +95,7 @@ function () {
|
|
95
95
|
* in refetch containers, for example. It also allows test writers to see how
|
96
96
|
* their components behave under error conditions.
|
97
97
|
*/
|
98
|
-
|
98
|
+
;
|
99
99
|
|
100
100
|
var _proto = ReactRelayTestMocker.prototype;
|
101
101
|
|
@@ -168,28 +168,28 @@ function () {
|
|
168
168
|
|
169
169
|
_proto._getDefaults = function _getDefaults() {
|
170
170
|
return this._defaults;
|
171
|
-
}
|
171
|
+
}
|
172
172
|
/**
|
173
173
|
* set a default payload for a given query
|
174
174
|
*/
|
175
|
-
|
175
|
+
;
|
176
176
|
|
177
177
|
_proto.setDefault = function setDefault(toSet) {
|
178
178
|
var query = toSet.query,
|
179
179
|
payload = toSet.payload;
|
180
180
|
var ident = ReactRelayTestMocker.getIdentifier(query.params);
|
181
181
|
this._defaults[ident] = payload;
|
182
|
-
}
|
182
|
+
}
|
183
183
|
/**
|
184
184
|
* remove a default payload for a given query
|
185
185
|
*/
|
186
|
-
|
186
|
+
;
|
187
187
|
|
188
188
|
_proto.unsetDefault = function unsetDefault(toUnset) {
|
189
189
|
var query = toUnset.query;
|
190
190
|
var ident = ReactRelayTestMocker.getIdentifier(query.params);
|
191
191
|
delete this._defaults[ident];
|
192
|
-
}
|
192
|
+
}
|
193
193
|
/**
|
194
194
|
* Write directly to the Relay store instead of trying to resolve a query that
|
195
195
|
* was sent via the network.
|
@@ -198,7 +198,7 @@ function () {
|
|
198
198
|
* (via `createFragmentContainer`). The component under test should also be
|
199
199
|
* wrapped in a `RelayTestRenderer`.
|
200
200
|
*/
|
201
|
-
|
201
|
+
;
|
202
202
|
|
203
203
|
_proto.dataWrite = function dataWrite(config) {
|
204
204
|
var query = config.query,
|
@@ -209,7 +209,7 @@ function () {
|
|
209
209
|
!(payload.data != null && payload.errors === undefined) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Only `data` can be written when using `writeDirect`. You may need to ' + 'wrap your payload in an object like `{data: payload}`.') : invariant(false) : void 0;
|
210
210
|
|
211
211
|
this._environment.commitPayload(operationDescriptor, payload.data);
|
212
|
-
}
|
212
|
+
}
|
213
213
|
/**
|
214
214
|
* Write the data specified in config's payload to the instance's environment.
|
215
215
|
* NOTE: callers may need to invoke `jest.runOnlyPendingTimers()` after
|
@@ -218,7 +218,7 @@ function () {
|
|
218
218
|
* @param config: an object containing the data to write and the query and
|
219
219
|
* variables that the payload is simulating a response to
|
220
220
|
*/
|
221
|
-
|
221
|
+
;
|
222
222
|
|
223
223
|
_proto.networkWrite = function networkWrite(config) {
|
224
224
|
!this._environment.hasMockedNetwork ? process.env.NODE_ENV !== "production" ? invariant(false, 'You cannot resolve queries without a mocked environment. Did you mean ' + 'to use `writeDirect` instead?') : invariant(false) : void 0;
|
package/lib/ReactRelayTypes.js
CHANGED
package/lib/assertFragmentMap.js
CHANGED
package/lib/index.js
CHANGED
package/lib/isRelayVariables.js
CHANGED
package/lib/readContext.js
CHANGED
package/package.json
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-relay",
|
3
3
|
"description": "A framework for building GraphQL-driven React applications.",
|
4
|
-
"version": "
|
4
|
+
"version": "5.0.0",
|
5
5
|
"keywords": [
|
6
6
|
"graphql",
|
7
7
|
"relay",
|
8
8
|
"react"
|
9
9
|
],
|
10
10
|
"license": "MIT",
|
11
|
-
"homepage": "https://
|
11
|
+
"homepage": "https://relay.dev",
|
12
12
|
"bugs": "https://github.com/facebook/relay/issues",
|
13
13
|
"repository": "facebook/relay",
|
14
14
|
"dependencies": {
|
15
15
|
"@babel/runtime": "^7.0.0",
|
16
16
|
"fbjs": "^1.0.0",
|
17
17
|
"nullthrows": "^1.1.0",
|
18
|
-
"relay-runtime": "
|
18
|
+
"relay-runtime": "5.0.0"
|
19
19
|
},
|
20
20
|
"peerDependencies": {
|
21
21
|
"react": "^16.5.0"
|
package/react-relay.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
/**
|
2
|
-
* Relay
|
2
|
+
* Relay v5.0.0
|
3
3
|
*/
|
4
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("relay-runtime"),require("react"),require("fbjs/lib/invariant"),require("fbjs/lib/areEqual"),require("fbjs/lib/warning"),require("fbjs/lib/mapObject"),require("fbjs/lib/forEachObject")):"function"==typeof define&&define.amd?define(["relay-runtime","react","fbjs/lib/invariant","fbjs/lib/areEqual","fbjs/lib/warning","fbjs/lib/mapObject","fbjs/lib/forEachObject"],t):"object"==typeof exports?exports.ReactRelay=t(require("relay-runtime"),require("react"),require("fbjs/lib/invariant"),require("fbjs/lib/areEqual"),require("fbjs/lib/warning"),require("fbjs/lib/mapObject"),require("fbjs/lib/forEachObject")):e.ReactRelay=t(e["relay-runtime"],e.react,e["fbjs/lib/invariant"],e["fbjs/lib/areEqual"],e["fbjs/lib/warning"],e["fbjs/lib/mapObject"],e["fbjs/lib/forEachObject"])}(window,function(e,t,n,r,o,a,i){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=17)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";var r=n(1),o=n(0).__internal.createRelayContext;e.exports=o(r)},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=n},function(e,t,n){var r=n(4);e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){r(e,t,n[t])})}return e}},function(e,t){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}},function(e,t){e.exports=r},function(e,t,n){"use strict";function r(e){return e.displayName||e.name||"Component"}e.exports={getComponentName:r,getContainerName:function(e){return"Relay("+r(e)+")"}}},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,n){"use strict";var r=n(2)(n(13)),o=n(1),a=n(3),i=n(19),s=n(5),l=n(20),c=n(21),u=n(9),f=u.getComponentName,p=u.getContainerName;e.exports=function(e,t,u){var h,v,d=p(e);function _(r){if(null==v||r.__relayContext.environment!==h){if(h=r.__relayContext.environment,!(0,n(0).isRelayModernEnvironment)(h))throw new Error("RelayModernContainer: Can only use Relay Modern component "+"".concat(d," in a Relay Modern environment!"));var o=h.unstable_internal.getFragment,a=l(t,o);v=u(e,a),_.getDerivedStateFromProps=v.getDerivedStateFromProps}return new v(r)}function y(e,t){var n=c(a);return n||s(!1,"".concat(d," tried to render a context that was ")+"not valid this means that ".concat(d," was rendered outside of a ")+"query renderer."),o.createElement(_,(0,r.default)({},e,{__relayContext:n,componentRef:e.componentRef||t}))}i(f(e),t),_.prototype=o.Component.prototype,_.displayName=d,y.displayName=d;var b=o.forwardRef(y);return b.__ComponentClass=e,b}},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.apply(this,arguments)}e.exports=n},function(e,t,n){"use strict";var r=n(5),o=n(22),a=n(23);function i(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&o(e.environment)&&a(e.variables)}e.exports={assertRelayContext:function(e){return i(e)||r(!1,"RelayContext: Expected `context.relay` to be an object conforming to the `RelayContext` interface, got `%s`.",e),e},isRelayContext:i}},function(e,t,n){"use strict";var r=n(2)(n(4)),o=n(5),a=n(0),i=a.isRelayModernEnvironment,s=a.__internal.fetchQuery,l=function(){function e(e){(0,r.default)(this,"_selectionReferences",[]),(0,r.default)(this,"_callOnDataChangeWhenSet",!1),null!=e&&(this._cacheSelectionReference=e.cacheSelectionReference,this._selectionReferences=e.selectionReferences)}var t=e.prototype;return t.getSelectionReferences=function(){return{cacheSelectionReference:this._cacheSelectionReference,selectionReferences:this._selectionReferences}},t.lookupInStore=function(e,t){return e.check(t.root)?(this._retainCachedOperation(e,t),e.lookup(t.fragment,t)):null},t.execute=function(e){var t=this,n=e.environment,r=e.operation,o=e.cacheConfig,a=e.preservePreviousReferences,l=void 0!==a&&a,c=n.retain(r.root),u=null!=o?{networkCacheConfig:o}:{},f=function(){t._selectionReferences=t._selectionReferences.concat(c)},p=function(){l||t.disposeSelectionReferences(),t._selectionReferences=t._selectionReferences.concat(c)},h=function(){t._selectionReferences=t._selectionReferences.concat(c)};return i(n)?s(n,r,u).do({error:f,complete:p,unsubscribe:h}):n.execute({operation:r,cacheConfig:o}).do({error:f,complete:p,unsubscribe:h})},t.setOnDataChange=function(e){this._fetchOptions||o(!1,"ReactRelayQueryFetcher: `setOnDataChange` should have been called after having called `fetch`"),"function"==typeof e&&(this._fetchOptions.onDataChangeCallbacks=this._fetchOptions.onDataChangeCallbacks||[],this._fetchOptions.onDataChangeCallbacks.push(e),this._callOnDataChangeWhenSet&&(null!=this._error?e({error:this._error}):null!=this._snapshot&&e({snapshot:this._snapshot})))},t.fetch=function(e){var t,n=this,r=e.cacheConfig,o=e.environment,a=e.operation,i=e.onDataChange,s=!1;this.disposeRequest();var l=this._fetchOptions&&this._fetchOptions.onDataChangeCallbacks;this._fetchOptions={cacheConfig:r,environment:o,onDataChangeCallbacks:l||[],operation:a},i&&-1===this._fetchOptions.onDataChangeCallbacks.indexOf(i)&&this._fetchOptions.onDataChangeCallbacks.push(i);var c=this.execute({environment:o,operation:a,cacheConfig:r}).finally(function(){n._pendingRequest=null}).subscribe({next:function(){n._callOnDataChangeWhenSet=!0,n._error=null,n._onQueryDataAvailable({notifyFirstResult:s})},error:function(e){n._callOnDataChangeWhenSet=!0,n._error=e,n._snapshot=null;var r=n._fetchOptions&&n._fetchOptions.onDataChangeCallbacks;s?r&&r.forEach(function(t){t({error:e})}):t=e}});if(this._pendingRequest={dispose:function(){c.unsubscribe()}},s=!0,t)throw t;return this._snapshot},t.retry=function(){return this._fetchOptions||o(!1,"ReactRelayQueryFetcher: `retry` should be called after having called `fetch`"),this.fetch({cacheConfig:this._fetchOptions.cacheConfig,environment:this._fetchOptions.environment,operation:this._fetchOptions.operation,onDataChange:null})},t.dispose=function(){this.disposeRequest(),this.disposeSelectionReferences()},t.disposeRequest=function(){this._error=null,this._snapshot=null,this._pendingRequest&&this._pendingRequest.dispose(),this._rootSubscription&&(this._rootSubscription.dispose(),this._rootSubscription=null)},t._retainCachedOperation=function(e,t){this._disposeCacheSelectionReference(),this._cacheSelectionReference=e.retain(t.root)},t._disposeCacheSelectionReference=function(){this._cacheSelectionReference&&this._cacheSelectionReference.dispose(),this._cacheSelectionReference=null},t.disposeSelectionReferences=function(){this._disposeCacheSelectionReference(),this._selectionReferences.forEach(function(e){return e.dispose()}),this._selectionReferences=[]},t._onQueryDataAvailable=function(e){var t=this,n=e.notifyFirstResult;this._fetchOptions||o(!1,"ReactRelayQueryFetcher: `_onQueryDataAvailable` should have been called after having called `fetch`");var r=this._fetchOptions,a=r.environment,i=r.onDataChangeCallbacks,s=r.operation;if(!this._snapshot&&(this._snapshot=a.lookup(s.fragment,s),this._rootSubscription=a.subscribe(this._snapshot,function(e){if(null!=t._fetchOptions){var n=t._fetchOptions.onDataChangeCallbacks;Array.isArray(n)&&n.forEach(function(t){return t({snapshot:e})})}}),this._snapshot&&n&&Array.isArray(i))){var l=this._snapshot;i.forEach(function(e){return e({snapshot:l})})}},e}();e.exports=l},function(e,t){e.exports=o},function(e,t,n){"use strict";var r=n(3),o=n(18),a=n(24),i=n(26),s=n(27),l=n(0);e.exports={QueryRenderer:i,MutationTypes:l.MutationTypes,RangeOperations:l.RangeOperations,ReactRelayContext:r,applyOptimisticMutation:l.applyOptimisticMutation,commitLocalUpdate:l.commitLocalUpdate,commitMutation:l.commitMutation,createFragmentContainer:o.createContainer,createPaginationContainer:a.createContainer,createRefetchContainer:s.createContainer,fetchQuery:l.fetchQuery,graphql:l.graphql,requestSubscription:l.requestSubscription}},function(e,t,n){"use strict";var r=n(2),o=r(n(6)),a=r(n(10)),i=r(n(7)),s=r(n(11)),l=r(n(4)),c=n(1),u=n(8),f=n(12),p=n(9).getContainerName,h=n(14).assertRelayContext,v=n(0).isScalarAndEqual;function d(e,t){var n,r,f=p(e);return r=n=function(n){function r(e){var r;r=n.call(this,e)||this,(0,l.default)((0,s.default)((0,s.default)(r)),"_handleFragmentDataUpdate",function(){var e=r.state.resolver;r.setState(function(t){return e===t.resolver?{data:t.resolver.resolve(),relayProp:_(t.relayProp.environment)}:null})});var o=h(e.__relayContext),a=(0,o.environment.unstable_internal.createFragmentSpecResolver)(o,f,t,e);return r.state={data:a.resolve(),prevProps:e,prevPropsContext:o,relayProp:_(o.environment),resolver:a},r}(0,i.default)(r,n),r.getDerivedStateFromProps=function(e,n){var r=n.prevProps,o=h(e.__relayContext),a=o.environment.unstable_internal,i=a.createFragmentSpecResolver,s=a.getDataIDsFromObject,l=s(t,r),c=s(t,e),p=n.resolver;if(n.prevPropsContext.environment!==o.environment||n.prevPropsContext.variables!==o.variables||!u(l,c))return{data:(p=i(o,f,t,e)).resolve(),prevPropsContext:o,prevProps:e,relayProp:_(o.environment),resolver:p};p.setProps(e);var v=p.resolve();return v!==n.data?{data:v,prevProps:e,prevPropsContext:o,relayProp:_(o.environment)}:null};var p=r.prototype;return p.componentDidMount=function(){this._subscribeToNewResolver(),this._rerenderIfStoreHasChanged()},p.componentDidUpdate=function(e,t){this.state.resolver!==t.resolver&&(t.resolver.dispose(),this._subscribeToNewResolver()),this._rerenderIfStoreHasChanged()},p.componentWillUnmount=function(){this.state.resolver.dispose()},p.shouldComponentUpdate=function(e,n){if(n.data!==this.state.data)return!0;for(var r=Object.keys(e),o=0;o<r.length;o++){var a=r[o];if("__relayContext"===a){if(n.prevPropsContext.environment!==this.state.prevPropsContext.environment||n.prevPropsContext.variables!==this.state.prevPropsContext.variables)return!0}else if(!t.hasOwnProperty(a)&&!v(e[a],this.props[a]))return!0}return!1},p._rerenderIfStoreHasChanged=function(){var e=this.state,t=e.data,n=e.resolver.resolve();t!==n&&this.setState({data:n})},p._subscribeToNewResolver=function(){this.state.resolver.setCallback(this._handleFragmentDataUpdate)},p.render=function(){var t=this.props,n=t.componentRef,r=(t.__relayContext,(0,a.default)(t,["componentRef","__relayContext"]));return c.createElement(e,(0,o.default)({},r,this.state.data,{ref:n,relay:this.state.relayProp}))},r}(c.Component),(0,l.default)(n,"displayName",f),r}function _(e){return{environment:e}}e.exports={createContainer:function(e,t){return f(e,t,d)}}},function(e,t,n){"use strict";var r=n(5);e.exports=function(e,t){for(var n in t&&"object"==typeof t||r(!1,"Could not create Relay Container for `%s`. Expected a set of GraphQL fragments, got `%s` instead.",e,t),t)if(t.hasOwnProperty(n)){var o=t[n];(!o||"object"!=typeof o&&"function"!=typeof o)&&r(!1,"Could not create Relay Container for `%s`. The value of fragment `%s` was expected to be a fragment, got `%s` instead.",e,n,o)}}},function(e,t){e.exports=a},function(e,t,n){"use strict";var r=n(1).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,o=r.ReactCurrentDispatcher,a=r.ReactCurrentOwner;e.exports=function(e){return(null!=o?o.current:a.currentDispatcher).readContext(e)}},function(e,t,n){"use strict";e.exports=function(e){return"object"==typeof e&&null!==e&&"function"==typeof e.check&&"function"==typeof e.lookup&&"function"==typeof e.retain&&"function"==typeof e.sendQuery&&"function"==typeof e.execute&&"function"==typeof e.subscribe}},function(e,t,n){"use strict";e.exports=function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}},function(e,t,n){"use strict";var r=n(2),o=r(n(13)),a=r(n(10)),i=r(n(7)),s=r(n(11)),l=r(n(4)),c=r(n(6)),u=n(1),f=n(3),p=n(15),h=n(8),v=n(12),d=n(25),_=n(5),y=n(16),b=n(9),m=b.getComponentName,C=b.getContainerName,g=n(14).assertRelayContext,R=n(0),x=R.ConnectionInterface,P=R.RelayFeatureFlags,F=R.Observable,O=R.getFragmentOwners,S=R.isScalarAndEqual,q="forward";function E(e){return"function"==typeof e?{error:e,complete:e,unsubscribe:function(t){"function"==typeof e&&e()}}:e||{}}function j(e,t,n){var r,v,b=m(e),R=C(e),j=function(e){var t=null,n=!1;for(var r in e){var o=e[r],a=o.metadata&&o.metadata.connection;void 0!==o.metadata&&(n=!0),a&&(1!==a.length&&_(!1,"ReactRelayPaginationContainer: Only a single @connection is supported, `%s` has %s.",r,a.length),t&&_(!1,"ReactRelayPaginationContainer: Only a single fragment with @connection is supported."),t=(0,c.default)({},a[0],{fragmentName:r}))}return n&&null===t&&_(!1,"ReactRelayPaginationContainer: A @connection directive must be present."),t||{}}(t),D=n.getConnectionFromProps||function(e){var t=e.path;return t||_(!1,"ReactRelayPaginationContainer: Unable to synthesize a getConnectionFromProps function."),function(n){for(var r=n[e.fragmentName],o=0;o<t.length;o++){if(!r||"object"!=typeof r)return null;r=r[t[o]]}return r}}(j),w=n.direction||j.direction;w||_(!1,"ReactRelayPaginationContainer: Unable to infer direction of the connection, possibly because both first and last are provided.");var A=n.getFragmentVariables||function(e){var t=e.count;return t||_(!1,"ReactRelayPaginationContainer: Unable to synthesize a getFragmentVariables function."),function(e,n){return(0,c.default)({},e,(0,l.default)({},t,n))}}(j);return v=r=function(r){function v(e){var n;n=r.call(this,e)||this,(0,l.default)((0,s.default)((0,s.default)(n)),"_handleFragmentDataUpdate",function(){n.setState({data:n._resolver.resolve()})}),(0,l.default)((0,s.default)((0,s.default)(n)),"_hasMore",function(){var e=n._getConnectionData();return!!(e&&e.hasMore&&e.cursor)}),(0,l.default)((0,s.default)((0,s.default)(n)),"_isLoading",function(){return!!n._refetchSubscription}),(0,l.default)((0,s.default)((0,s.default)(n)),"_refetchConnection",function(e,t,r){if(!n._canFetchPage("refetchConnection"))return{dispose:function(){}};n._refetchVariables=r;var o={count:e,cursor:null,totalCount:e};return{dispose:n._fetchPage(o,E(t),{force:!0}).unsubscribe}}),(0,l.default)((0,s.default)((0,s.default)(n)),"_loadMore",function(e,t,r){if(!n._canFetchPage("loadMore"))return{dispose:function(){}};var o=E(t),a=n._getConnectionData();if(!a)return F.create(function(e){return e.complete()}).subscribe(o),null;var i=a.edgeCount+e;if(r&&r.force)return n._refetchConnection(i,t);var s=x.get(),l=s.END_CURSOR,c=s.START_CURSOR,u=a.cursor;y(u,"ReactRelayPaginationContainer: Cannot `loadMore` without valid `%s` (got `%s`)",w===q?l:c,u);var f={count:e,cursor:u,totalCount:i};return{dispose:n._fetchPage(f,o,r).unsubscribe}});var o=g(e.__relayContext),a=o.environment.unstable_internal.createFragmentSpecResolver;return n._isARequestInFlight=!1,n._refetchSubscription=null,n._refetchVariables=null,n._resolver=a(o,R,t,e,n._handleFragmentDataUpdate),n.state={data:n._resolver.resolve(),prevContext:o,contextForChildren:o,relayProp:n._buildRelayProp(o)},n._isUnmounted=!1,n._hasFetched=!1,n}(0,i.default)(v,r);var m=v.prototype;return m.UNSAFE_componentWillReceiveProps=function(e){var n=g(e.__relayContext),r=n.environment.unstable_internal,o=r.createFragmentSpecResolver,a=r.getDataIDsFromObject,i=a(t,this.props),s=a(t,e);n.environment===this.state.prevContext.environment&&n.variables===this.state.prevContext.variables&&h(i,s)?this._hasFetched||this._resolver.setProps(e):(this._cleanup(),this._resolver=o(n,R,t,e,this._handleFragmentDataUpdate),this.setState({prevContext:n,contextForChildren:n,relayProp:this._buildRelayProp(n)}));var l=this._resolver.resolve();l!==this.state.data&&this.setState({data:l})},m.componentWillUnmount=function(){this._isUnmounted=!0,this._cleanup()},m.shouldComponentUpdate=function(e,n){if(n.data!==this.state.data||n.relayProp!==this.state.relayProp)return!0;for(var r=Object.keys(e),o=0;o<r.length;o++){var a=r[o];if("__relayContext"===a){if(n.prevContext.environment!==this.state.prevContext.environment||n.prevContext.variables!==this.state.prevContext.variables)return!0}else if(!t.hasOwnProperty(a)&&!S(e[a],this.props[a]))return!0}return!1},m._buildRelayProp=function(e){return{hasMore:this._hasMore,isLoading:this._isLoading,loadMore:this._loadMore,refetchConnection:this._refetchConnection,environment:e.environment}},m._getConnectionData=function(){var e=this.props,t=(e.componentRef,(0,a.default)(e,["componentRef"])),n=(0,c.default)({},t,this.state.data),r=D(n);if(null==r)return null;var o=x.get(),i=o.EDGES,s=o.PAGE_INFO,l=o.HAS_NEXT_PAGE,u=o.HAS_PREV_PAGE,f=o.END_CURSOR,p=o.START_CURSOR;"object"!=typeof r&&_(!1,"ReactRelayPaginationContainer: Expected `getConnectionFromProps()` in `%s`to return `null` or a plain object with %s and %s properties, got `%s`.",b,i,s,r);var h=r[i],v=r[s];if(null==h||null==v)return null;Array.isArray(h)||_(!1,"ReactRelayPaginationContainer: Expected `getConnectionFromProps()` in `%s`to return an object with %s: Array, got `%s`.",b,i,h),"object"!=typeof v&&_(!1,"ReactRelayPaginationContainer: Expected `getConnectionFromProps()` in `%s`to return an object with %s: Object, got `%s`.",b,s,v);var d=w===q?v[l]:v[u],m=w===q?v[f]:v[p];return"boolean"!=typeof d||0!==h.length&&void 0===m?(y(!1,"ReactRelayPaginationContainer: Cannot paginate without %s fields in `%s`. Be sure to fetch %s (got `%s`) and %s (got `%s`).",s,b,w===q?l:u,d,w===q?f:p,m),null):{cursor:m,edgeCount:h.length,hasMore:d}},m._getQueryFetcher=function(){return this._queryFetcher||(this._queryFetcher=new p),this._queryFetcher},m._canFetchPage=function(e){return!this._isUnmounted||(y(!1,"ReactRelayPaginationContainer: Unexpected call of `%s` on unmounted container `%s`. It looks like some instances of your container still trying to fetch data but they already unmounted. Please make sure you clear all timers, intervals, async calls, etc that may trigger `%s` call.",e,R,e),!1)},m._fetchPage=function(e,r,o){var i,s,l=this,u=g(this.props.__relayContext).environment,f=u.unstable_internal,p=f.createOperationDescriptor,v=f.getRequest,y=f.getVariablesFromObject,m=this.props,C=(m.componentRef,m.__relayContext,(0,a.default)(m,["componentRef","__relayContext"])),R=(0,c.default)({},C,this.state.data);if(P.PREFER_FRAGMENT_OWNER_OVER_CONTEXT){var x=O(t,C);d(t,function(e,t){var n,r,o,a=x[t],s=Array.isArray(a)?null!==(n=null===(r=a[0])||void 0===r?void 0:r.variables)&&void 0!==n?n:{}:null!==(o=null===a||void 0===a?void 0:a.variables)&&void 0!==o?o:{};i=(0,c.default)({},i,s)}),s=y({},t,C,x)}else i=this.props.__relayContext.variables,s=y(i,t,C);s=(0,c.default)({},i,s,this._refetchVariables);var S=n.getVariables(R,{count:e.count,cursor:e.cursor},s);("object"!=typeof S||null===S)&&_(!1,"ReactRelayPaginationContainer: Expected `getVariables()` to return an object, got `%s` in `%s`.",S,b),S=(0,c.default)({},S,this._refetchVariables),P.MERGE_FETCH_AND_FRAGMENT_VARS&&(s=(0,c.default)({},S,s));var q=o?{force:!!o.force}:void 0,E=p(v(n.query),S),j=null;this._refetchSubscription&&this._refetchSubscription.unsubscribe(),this._hasFetched=!0;var D=function(){l._refetchSubscription===j&&(l._refetchSubscription=null,l._isARequestInFlight=!1)};return this._isARequestInFlight=!0,j=this._getQueryFetcher().execute({environment:u,operation:E,cacheConfig:q,preservePreviousReferences:!0}).mergeMap(function(t){return F.create(function(t){!function(t,n){var r=(0,c.default)({},l.props.__relayContext.variables,s),o=l._resolver.resolve();l._resolver.setVariables(A(s,e.totalCount),E.node);var a=l._resolver.resolve();h(o,a)?n():l.setState({data:a,contextForChildren:{environment:l.props.__relayContext.environment,variables:r}},n)}(0,function(){t.next(),t.complete()})})}).do({error:D,complete:D,unsubscribe:D}).subscribe(r||{}),this._refetchSubscription=this._isARequestInFlight?j:null,j},m._cleanup=function(){this._resolver.dispose(),this._refetchVariables=null,this._hasFetched=!1,this._refetchSubscription&&(this._refetchSubscription.unsubscribe(),this._refetchSubscription=null,this._isARequestInFlight=!1),this._queryFetcher&&this._queryFetcher.dispose()},m.render=function(){var t=this.props,n=t.componentRef,r=(t.__relayContext,(0,a.default)(t,["componentRef","__relayContext"]));return u.createElement(f.Provider,{value:this.state.contextForChildren},u.createElement(e,(0,o.default)({},r,this.state.data,{ref:n,relay:this.state.relayProp})))},v}(u.Component),(0,l.default)(r,"displayName",R),v}e.exports={createContainer:function(e,t,n){return v(e,t,function(e,t){return j(e,t,n)})}}},function(e,t){e.exports=i},function(e,t,n){"use strict";var r=n(2),o=r(n(6)),a=r(n(7)),i=n(1),s=n(3),l=n(15),c=n(8),u=n(0).deepFreeze,f={},p="STORE_THEN_NETWORK",h=function(e){function t(t){var n;n=e.call(this,t)||this;var r,a,i={handleDataChange:null,handleRetryAfterError:null};if(t.query){var s=t.query;a=_((0,t.environment.unstable_internal.getRequest)(s).params,t.variables),r=f[a]?f[a].queryFetcher:new l}else r=new l;return n.state=(0,o.default)({prevPropsEnvironment:t.environment,prevPropsVariables:t.variables,prevQuery:t.query,queryFetcher:r,retryCallbacks:i},y(t,r,i,a)),n}(0,a.default)(t,e),t.getDerivedStateFromProps=function(e,t){if(t.prevQuery!==e.query||t.prevPropsEnvironment!==e.environment||!c(t.prevPropsVariables,e.variables)){var n,r=e.query,a=t.queryFetcher.getSelectionReferences();if(t.queryFetcher.disposeRequest(),r){var i=_((0,e.environment.unstable_internal.getRequest)(r).params,e.variables);n=f[i]?f[i].queryFetcher:new l(a)}else n=new l(a);return(0,o.default)({prevQuery:e.query,prevPropsEnvironment:e.environment,prevPropsVariables:e.variables,queryFetcher:n},y(e,n,t.retryCallbacks))}return null};var n=t.prototype;return n.componentDidMount=function(){var e=this,t=this.state,n=t.retryCallbacks,r=t.queryFetcher,o=t.requestCacheKey;o&&delete f[o],n.handleDataChange=function(t){var n=null==t.error?null:t.error,r=null==t.snapshot?null:t.snapshot;e.setState(function(e){var t=e.requestCacheKey;return t&&delete f[t],r===e.snapshot&&n===e.error?null:{renderProps:d(n,r,e.queryFetcher,e.retryCallbacks),snapshot:r,requestCacheKey:null}})},n.handleRetryAfterError=function(t){return e.setState(function(e){var t=e.requestCacheKey;return t&&delete f[t],{renderProps:{error:null,props:null,retry:null},requestCacheKey:null}})},this.props.query&&r.setOnDataChange(n.handleDataChange)},n.componentDidUpdate=function(){var e=this.state.requestCacheKey;e&&(delete f[e],delete this.state.requestCacheKey)},n.componentWillUnmount=function(){this.state.queryFetcher.dispose()},n.shouldComponentUpdate=function(e,t){return e.render!==this.props.render||t.renderProps!==this.state.renderProps},n.render=function(){var e=this.state,t=e.renderProps,n=e.relayContext;return u(t),i.createElement(s.Provider,{value:n},this.props.render(t))},t}(i.Component);function v(e,t){return{environment:e,variables:t}}function d(e,t,n,r){return{error:e||null,props:t?t.data:null,retry:function(){var t=n.retry();t&&"function"==typeof r.handleDataChange?r.handleDataChange({snapshot:t}):e&&"function"==typeof r.handleRetryAfterError&&r.handleRetryAfterError(e)}}}function _(e,t){var n=e.id||e.text;return JSON.stringify({id:String(n),variables:t})}function y(e,t,n,r){var o=e.environment,a=e.query,i=e.variables,s=o;if(!a)return t.dispose(),{error:null,relayContext:v(s,i),renderProps:{error:null,props:{},retry:null},requestCacheKey:null};var l=s.unstable_internal,c=l.createOperationDescriptor,u=(0,l.getRequest)(a),h=c(u,i),y=v(s,h.variables);if("string"==typeof r&&f[r]){var b=f[r].snapshot;return b?{error:null,relayContext:y,renderProps:d(null,b,t,n),snapshot:b,requestCacheKey:r}:{error:null,relayContext:y,renderProps:{error:null,props:null,retry:null},snapshot:null,requestCacheKey:r}}try{var m=e.dataFrom===p?t.lookupInStore(s,h):null,C=t.fetch({cacheConfig:e.cacheConfig,dataFrom:e.dataFrom,environment:s,onDataChange:n.handleDataChange,operation:h})||m;return r=r||_(u.params,e.variables),f[r]={queryFetcher:t,snapshot:C},C?{error:null,relayContext:y,renderProps:d(null,C,t,n),snapshot:C,requestCacheKey:r}:{error:null,relayContext:y,renderProps:{error:null,props:null,retry:null},snapshot:null,requestCacheKey:r}}catch(e){return{error:e,relayContext:y,renderProps:d(e,null,t,n),snapshot:null,requestCacheKey:r}}}e.exports=h},function(e,t,n){"use strict";var r=n(2),o=r(n(13)),a=r(n(10)),i=r(n(6)),s=r(n(7)),l=r(n(11)),c=r(n(4)),u=n(1),f=n(3),p=n(15),h=n(8),v=n(12),d=n(16),_=n(9).getContainerName,y=n(14).assertRelayContext,b=n(0),m=b.Observable,C=b.RelayFeatureFlags,g=b.getFragmentOwners,R=b.isScalarAndEqual;function x(e,t){return{environment:e,refetch:t}}e.exports={createContainer:function(e,t,n){return v(e,t,function(e,t){return function(e,t,n){var r,v,b=_(e);return v=r=function(r){function v(e){var o;o=r.call(this,e)||this,(0,c.default)((0,l.default)((0,l.default)(o)),"_handleFragmentDataUpdate",function(){var e=o.state.resolver;o.setState(function(t){return e===t.resolver?{data:t.resolver.resolve()}:null})}),(0,c.default)((0,l.default)((0,l.default)(o)),"_refetch",function(e,t,r,a){if(o._isUnmounted)return d(!1,"ReactRelayRefetchContainer: Unexpected call of `refetch` on unmounted container `%s`. It looks like some instances of your container still trying to refetch the data but they already unmounted. Please make sure you clear all timers, intervals, async calls, etc that may trigger `refetch`.",b),{dispose:function(){}};var s=y(o.props.__relayContext),l=s.environment,c=s.variables,u="function"==typeof e?e(o._getFragmentVariables()):e;u=(0,i.default)({},c,u);var f,p=t?C.MERGE_FETCH_AND_FRAGMENT_VARS?(0,i.default)({},u,t):(0,i.default)({},c,t):u,h=a?{force:!!a.force}:void 0,v="function"==typeof r?{next:r,error:r}:r||{},_=o.props.__relayContext.environment.unstable_internal,g=(0,_.createOperationDescriptor)((0,_.getRequest)(n),u);return o.state.localVariables=u,o._refetchSubscription&&o._refetchSubscription.unsubscribe(),"store-or-network"===(null===a||void 0===a?void 0:a.fetchPolicy)&&null!=o._getQueryFetcher().lookupInStore(l,g)?(o.state.resolver.setVariables(p,g.node),o.setState(function(e){return{data:e.resolver.resolve(),contextForChildren:{environment:o.props.__relayContext.environment,variables:p}}},function(){v.next&&v.next(),v.complete&&v.complete()}),{dispose:function(){}}):(o._getQueryFetcher().execute({environment:l,operation:g,cacheConfig:h,preservePreviousReferences:!0}).mergeMap(function(e){return o.state.resolver.setVariables(p,g.node),m.create(function(e){return o.setState(function(e){return{data:e.resolver.resolve(),contextForChildren:{environment:o.props.__relayContext.environment,variables:p}}},function(){e.next(),e.complete()})})}).finally(function(){o._refetchSubscription===f&&(o._refetchSubscription=null)}).subscribe((0,i.default)({},v,{start:function(e){o._refetchSubscription=f=e,v.start&&v.start(e)}})),{dispose:function(){f&&f.unsubscribe()}})});var a=y(e.__relayContext);o._refetchSubscription=null;var s=(0,a.environment.unstable_internal.createFragmentSpecResolver)(a,b,t,e);return o.state={data:s.resolve(),localVariables:null,prevProps:e,prevPropsContext:a,contextForChildren:a,relayProp:x(a.environment,o._refetch),resolver:s},o._isUnmounted=!1,o}(0,s.default)(v,r);var _=v.prototype;return _.componentDidMount=function(){this._subscribeToNewResolver()},_.componentDidUpdate=function(e,t){this.state.resolver!==t.resolver&&(t.resolver.dispose(),this._queryFetcher&&this._queryFetcher.dispose(),this._refetchSubscription&&this._refetchSubscription.unsubscribe(),this._subscribeToNewResolver())},v.getDerivedStateFromProps=function(e,n){var r=n.prevProps,o=y(e.__relayContext),a=o.environment.unstable_internal,i=a.createFragmentSpecResolver,s=a.getDataIDsFromObject,l=s(t,r),c=s(t,e),u=n.resolver;if(n.prevPropsContext.environment!==o.environment||n.prevPropsContext.variables!==o.variables||!h(l,c))return{data:(u=i(o,b,t,e)).resolve(),localVariables:null,prevProps:e,prevPropsContext:o,contextForChildren:o,relayProp:x(o.environment,n.relayProp.refetch),resolver:u};n.localVariables||u.setProps(e);var f=u.resolve();return f!==n.data?{data:f,prevProps:e}:null},_.componentWillUnmount=function(){this._isUnmounted=!0,this.state.resolver.dispose(),this._queryFetcher&&this._queryFetcher.dispose(),this._refetchSubscription&&this._refetchSubscription.unsubscribe()},_.shouldComponentUpdate=function(e,n){if(n.data!==this.state.data||n.relayProp!==this.state.relayProp)return!0;for(var r=Object.keys(e),o=0;o<r.length;o++){var a=r[o];if("__relayContext"===a){if(this.state.prevPropsContext.environment!==n.prevPropsContext.environment||this.state.prevPropsContext.variables!==n.prevPropsContext.variables)return!0}else if(!t.hasOwnProperty(a)&&!R(e[a],this.props[a]))return!0}return!1},_._subscribeToNewResolver=function(){var e=this.state,t=e.data,n=e.resolver;n.setCallback(this._handleFragmentDataUpdate);var r=n.resolve();t!==r&&this.setState({data:r})},_._getFragmentVariables=function(){var e=this.props.__relayContext.environment.unstable_internal.getVariablesFromObject;return C.PREFER_FRAGMENT_OWNER_OVER_CONTEXT?e({},t,this.props,g(t,this.props)):e(this.props.__relayContext.variables,t,this.props)},_._getQueryFetcher=function(){return this._queryFetcher||(this._queryFetcher=new p),this._queryFetcher},_.render=function(){var t=this.props,n=t.componentRef,r=(t.__relayContext,(0,a.default)(t,["componentRef","__relayContext"])),i=this.state,s=i.relayProp,l=i.contextForChildren;return u.createElement(f.Provider,{value:l},u.createElement(e,(0,o.default)({},r,this.state.data,{ref:n,relay:s})))},v}(u.Component),(0,c.default)(r,"displayName",b),v}(e,t,n)})}}}])});
|
4
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("relay-runtime"),require("react"),require("fbjs/lib/invariant"),require("fbjs/lib/areEqual"),require("fbjs/lib/warning"),require("fbjs/lib/mapObject"),require("fbjs/lib/forEachObject")):"function"==typeof define&&define.amd?define(["relay-runtime","react","fbjs/lib/invariant","fbjs/lib/areEqual","fbjs/lib/warning","fbjs/lib/mapObject","fbjs/lib/forEachObject"],t):"object"==typeof exports?exports.ReactRelay=t(require("relay-runtime"),require("react"),require("fbjs/lib/invariant"),require("fbjs/lib/areEqual"),require("fbjs/lib/warning"),require("fbjs/lib/mapObject"),require("fbjs/lib/forEachObject")):e.ReactRelay=t(e["relay-runtime"],e.react,e["fbjs/lib/invariant"],e["fbjs/lib/areEqual"],e["fbjs/lib/warning"],e["fbjs/lib/mapObject"],e["fbjs/lib/forEachObject"])}(window,function(e,t,n,r,o,a,i){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=17)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";var r=n(1),o=n(0).__internal.createRelayContext;e.exports=o(r)},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=n},function(e,t,n){var r=n(4);e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){r(e,t,n[t])})}return e}},function(e,t){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}},function(e,t){e.exports=r},function(e,t,n){"use strict";function r(e){return e.displayName||e.name||"Component"}e.exports={getComponentName:r,getContainerName:function(e){return"Relay("+r(e)+")"}}},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,n){"use strict";var r=n(2)(n(13)),o=n(1),a=n(3),i=n(19),s=n(5),c=n(20),l=n(21),u=n(9),f=u.getComponentName,p=u.getContainerName;e.exports=function(e,t,u){var h,v,d=p(e);function y(r){if(null==v||r.__relayContext.environment!==h){if(h=r.__relayContext.environment,!(0,n(0).isRelayModernEnvironment)(h))throw new Error("RelayModernContainer: Can only use Relay Modern component "+"".concat(d," in a Relay Modern environment!"));var o=h.unstable_internal.getFragment,a=c(t,o);v=u(e,a),y.getDerivedStateFromProps=v.getDerivedStateFromProps}return new v(r)}function _(e,t){var n=l(a);return n||s(!1,"".concat(d," tried to render a context that was ")+"not valid this means that ".concat(d," was rendered outside of a ")+"query renderer."),o.createElement(y,(0,r.default)({},e,{__relayContext:n,componentRef:e.componentRef||t}))}i(f(e),t),y.prototype=o.Component.prototype,y.displayName=d,_.displayName=d;var b=o.forwardRef(_);return b.__ComponentClass=e,b}},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.apply(this,arguments)}e.exports=n},function(e,t,n){"use strict";var r=n(5),o=n(22),a=n(23);function i(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&o(e.environment)&&a(e.variables)}e.exports={assertRelayContext:function(e){return i(e)||r(!1,"RelayContext: Expected `context.relay` to be an object conforming to the `RelayContext` interface, got `%s`.",e),e},isRelayContext:i}},function(e,t,n){"use strict";var r=n(2)(n(4)),o=n(5),a=n(0),i=a.isRelayModernEnvironment,s=a.__internal.fetchQuery,c=function(){function e(e){(0,r.default)(this,"_selectionReferences",[]),(0,r.default)(this,"_callOnDataChangeWhenSet",!1),null!=e&&(this._cacheSelectionReference=e.cacheSelectionReference,this._selectionReferences=e.selectionReferences)}var t=e.prototype;return t.getSelectionReferences=function(){return{cacheSelectionReference:this._cacheSelectionReference,selectionReferences:this._selectionReferences}},t.lookupInStore=function(e,t){return e.check(t.root)?(this._retainCachedOperation(e,t),e.lookup(t.fragment,t)):null},t.execute=function(e){var t=this,n=e.environment,r=e.operation,o=e.cacheConfig,a=e.preservePreviousReferences,c=void 0!==a&&a,l=n.retain(r.root),u=null!=o?{networkCacheConfig:o}:{},f=function(){t._selectionReferences=t._selectionReferences.concat(l)},p=function(){c||t.disposeSelectionReferences(),t._selectionReferences=t._selectionReferences.concat(l)},h=function(){t._selectionReferences=t._selectionReferences.concat(l)};return i(n)?s(n,r,u).do({error:f,complete:p,unsubscribe:h}):n.execute({operation:r,cacheConfig:o}).do({error:f,complete:p,unsubscribe:h})},t.setOnDataChange=function(e){this._fetchOptions||o(!1,"ReactRelayQueryFetcher: `setOnDataChange` should have been called after having called `fetch`"),"function"==typeof e&&(this._fetchOptions.onDataChangeCallbacks=this._fetchOptions.onDataChangeCallbacks||[],this._fetchOptions.onDataChangeCallbacks.push(e),this._callOnDataChangeWhenSet&&(null!=this._error?e({error:this._error}):null!=this._snapshot&&e({snapshot:this._snapshot})))},t.fetch=function(e){var t,n=this,r=e.cacheConfig,o=e.environment,a=e.operation,i=e.onDataChange,s=!1;this.disposeRequest();var c=this._fetchOptions&&this._fetchOptions.onDataChangeCallbacks;this._fetchOptions={cacheConfig:r,environment:o,onDataChangeCallbacks:c||[],operation:a},i&&-1===this._fetchOptions.onDataChangeCallbacks.indexOf(i)&&this._fetchOptions.onDataChangeCallbacks.push(i);var l=this.execute({environment:o,operation:a,cacheConfig:r}).finally(function(){n._pendingRequest=null}).subscribe({next:function(){n._callOnDataChangeWhenSet=!0,n._error=null,n._onQueryDataAvailable({notifyFirstResult:s})},error:function(e){n._callOnDataChangeWhenSet=!0,n._error=e,n._snapshot=null;var r=n._fetchOptions&&n._fetchOptions.onDataChangeCallbacks;s?r&&r.forEach(function(t){t({error:e})}):t=e}});if(this._pendingRequest={dispose:function(){l.unsubscribe()}},s=!0,t)throw t;return this._snapshot},t.retry=function(){return this._fetchOptions||o(!1,"ReactRelayQueryFetcher: `retry` should be called after having called `fetch`"),this.fetch({cacheConfig:this._fetchOptions.cacheConfig,environment:this._fetchOptions.environment,operation:this._fetchOptions.operation,onDataChange:null})},t.dispose=function(){this.disposeRequest(),this.disposeSelectionReferences()},t.disposeRequest=function(){this._error=null,this._snapshot=null,this._pendingRequest&&this._pendingRequest.dispose(),this._rootSubscription&&(this._rootSubscription.dispose(),this._rootSubscription=null)},t._retainCachedOperation=function(e,t){this._disposeCacheSelectionReference(),this._cacheSelectionReference=e.retain(t.root)},t._disposeCacheSelectionReference=function(){this._cacheSelectionReference&&this._cacheSelectionReference.dispose(),this._cacheSelectionReference=null},t.disposeSelectionReferences=function(){this._disposeCacheSelectionReference(),this._selectionReferences.forEach(function(e){return e.dispose()}),this._selectionReferences=[]},t._onQueryDataAvailable=function(e){var t=this,n=e.notifyFirstResult;this._fetchOptions||o(!1,"ReactRelayQueryFetcher: `_onQueryDataAvailable` should have been called after having called `fetch`");var r=this._fetchOptions,a=r.environment,i=r.onDataChangeCallbacks,s=r.operation;if(!this._snapshot&&(this._snapshot=a.lookup(s.fragment,s),this._rootSubscription=a.subscribe(this._snapshot,function(e){if(null!=t._fetchOptions){var n=t._fetchOptions.onDataChangeCallbacks;Array.isArray(n)&&n.forEach(function(t){return t({snapshot:e})})}}),this._snapshot&&n&&Array.isArray(i))){var c=this._snapshot;i.forEach(function(e){return e({snapshot:c})})}},e}();e.exports=c},function(e,t){e.exports=o},function(e,t,n){"use strict";var r=n(3),o=n(18),a=n(24),i=n(26),s=n(27),c=n(0);e.exports={QueryRenderer:i,MutationTypes:c.MutationTypes,RangeOperations:c.RangeOperations,ReactRelayContext:r,applyOptimisticMutation:c.applyOptimisticMutation,commitLocalUpdate:c.commitLocalUpdate,commitMutation:c.commitMutation,createFragmentContainer:o.createContainer,createPaginationContainer:a.createContainer,createRefetchContainer:s.createContainer,fetchQuery:c.fetchQuery,graphql:c.graphql,requestSubscription:c.requestSubscription}},function(e,t,n){"use strict";var r=n(2),o=r(n(6)),a=r(n(10)),i=r(n(11)),s=r(n(7)),c=r(n(4)),l=n(1),u=n(8),f=n(12),p=n(9).getContainerName,h=n(14).assertRelayContext,v=n(0).isScalarAndEqual;function d(e,t){var n,r,f=p(e);return r=n=function(n){function r(e){var r;r=n.call(this,e)||this,(0,c.default)((0,i.default)(r),"_handleFragmentDataUpdate",function(){var e=r.state.resolver;r.setState(function(t){return e===t.resolver?{data:t.resolver.resolve(),relayProp:y(t.relayProp.environment)}:null})});var o=h(e.__relayContext),a=(0,o.environment.unstable_internal.createFragmentSpecResolver)(o,f,t,e);return r.state={data:a.resolve(),prevProps:e,prevPropsContext:o,relayProp:y(o.environment),resolver:a},r}(0,s.default)(r,n),r.getDerivedStateFromProps=function(e,n){var r=n.prevProps,o=h(e.__relayContext),a=o.environment.unstable_internal,i=a.createFragmentSpecResolver,s=a.getDataIDsFromObject,c=s(t,r),l=s(t,e),p=n.resolver;if(n.prevPropsContext.environment!==o.environment||n.prevPropsContext.variables!==o.variables||!u(c,l))return{data:(p=i(o,f,t,e)).resolve(),prevPropsContext:o,prevProps:e,relayProp:y(o.environment),resolver:p};p.setProps(e);var v=p.resolve();return v!==n.data?{data:v,prevProps:e,prevPropsContext:o,relayProp:y(o.environment)}:null};var p=r.prototype;return p.componentDidMount=function(){this._subscribeToNewResolver(),this._rerenderIfStoreHasChanged()},p.componentDidUpdate=function(e,t){this.state.resolver!==t.resolver&&(t.resolver.dispose(),this._subscribeToNewResolver()),this._rerenderIfStoreHasChanged()},p.componentWillUnmount=function(){this.state.resolver.dispose()},p.shouldComponentUpdate=function(e,n){if(n.data!==this.state.data)return!0;for(var r=Object.keys(e),o=0;o<r.length;o++){var a=r[o];if("__relayContext"===a){if(n.prevPropsContext.environment!==this.state.prevPropsContext.environment||n.prevPropsContext.variables!==this.state.prevPropsContext.variables)return!0}else if(!t.hasOwnProperty(a)&&!v(e[a],this.props[a]))return!0}return!1},p._rerenderIfStoreHasChanged=function(){var e=this.state,t=e.data,n=e.resolver.resolve();t!==n&&this.setState({data:n})},p._subscribeToNewResolver=function(){this.state.resolver.setCallback(this._handleFragmentDataUpdate)},p.render=function(){var t=this.props,n=t.componentRef,r=(t.__relayContext,(0,a.default)(t,["componentRef","__relayContext"]));return l.createElement(e,(0,o.default)({},r,this.state.data,{ref:n,relay:this.state.relayProp}))},r}(l.Component),(0,c.default)(n,"displayName",f),r}function y(e){return{environment:e}}e.exports={createContainer:function(e,t){return f(e,t,d)}}},function(e,t,n){"use strict";var r=n(5);e.exports=function(e,t){for(var n in t&&"object"==typeof t||r(!1,"Could not create Relay Container for `%s`. Expected a set of GraphQL fragments, got `%s` instead.",e,t),t)if(t.hasOwnProperty(n)){var o=t[n];(!o||"object"!=typeof o&&"function"!=typeof o)&&r(!1,"Could not create Relay Container for `%s`. The value of fragment `%s` was expected to be a fragment, got `%s` instead.",e,n,o)}}},function(e,t){e.exports=a},function(e,t,n){"use strict";var r=n(1).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,o=r.ReactCurrentDispatcher,a=r.ReactCurrentOwner;e.exports=function(e){return(null!=o?o.current:a.currentDispatcher).readContext(e)}},function(e,t,n){"use strict";e.exports=function(e){return"object"==typeof e&&null!==e&&"function"==typeof e.check&&"function"==typeof e.lookup&&"function"==typeof e.retain&&"function"==typeof e.sendQuery&&"function"==typeof e.execute&&"function"==typeof e.subscribe}},function(e,t,n){"use strict";e.exports=function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}},function(e,t,n){"use strict";var r=n(2),o=r(n(13)),a=r(n(10)),i=r(n(11)),s=r(n(7)),c=r(n(4)),l=r(n(6)),u=n(1),f=n(3),p=n(15),h=n(8),v=n(12),d=n(25),y=n(5),_=n(16),b=n(9),m=b.getComponentName,C=b.getContainerName,g=n(14).assertRelayContext,R=n(0),x=R.ConnectionInterface,P=R.Observable,S=R.getFragmentOwners,O=R.isScalarAndEqual,F="forward";function q(e){return"function"==typeof e?{error:e,complete:e,unsubscribe:function(t){"function"==typeof e&&e()}}:e||{}}function j(e,t,n){var r,v,b=m(e),R=C(e),j=function(e){var t=null,n=!1;for(var r in e){var o=e[r],a=o.metadata&&o.metadata.connection;void 0!==o.metadata&&(n=!0),a&&(1!==a.length&&y(!1,"ReactRelayPaginationContainer: Only a single @connection is supported, `%s` has %s.",r,a.length),t&&y(!1,"ReactRelayPaginationContainer: Only a single fragment with @connection is supported."),t=(0,l.default)({},a[0],{fragmentName:r}))}return n&&null===t&&y(!1,"ReactRelayPaginationContainer: A @connection directive must be present."),t||{}}(t),D=n.getConnectionFromProps||function(e){var t=e.path;return t||y(!1,"ReactRelayPaginationContainer: Unable to synthesize a getConnectionFromProps function."),function(n){for(var r=n[e.fragmentName],o=0;o<t.length;o++){if(!r||"object"!=typeof r)return null;r=r[t[o]]}return r}}(j),E=n.direction||j.direction;E||y(!1,"ReactRelayPaginationContainer: Unable to infer direction of the connection, possibly because both first and last are provided.");var w=n.getFragmentVariables||function(e){var t=e.count;return t||y(!1,"ReactRelayPaginationContainer: Unable to synthesize a getFragmentVariables function."),function(e,n){return(0,l.default)({},e,(0,c.default)({},t,n))}}(j);return v=r=function(r){function v(e){var n;n=r.call(this,e)||this,(0,c.default)((0,i.default)(n),"_handleFragmentDataUpdate",function(){n.setState({data:n._resolver.resolve()})}),(0,c.default)((0,i.default)(n),"_hasMore",function(){var e=n._getConnectionData();return!!(e&&e.hasMore&&e.cursor)}),(0,c.default)((0,i.default)(n),"_isLoading",function(){return!!n._refetchSubscription}),(0,c.default)((0,i.default)(n),"_refetchConnection",function(e,t,r){if(!n._canFetchPage("refetchConnection"))return{dispose:function(){}};n._refetchVariables=r;var o={count:e,cursor:null,totalCount:e};return{dispose:n._fetchPage(o,q(t),{force:!0}).unsubscribe}}),(0,c.default)((0,i.default)(n),"_loadMore",function(e,t,r){if(!n._canFetchPage("loadMore"))return{dispose:function(){}};var o=q(t),a=n._getConnectionData();if(!a)return P.create(function(e){return e.complete()}).subscribe(o),null;var i=a.edgeCount+e;if(r&&r.force)return n._refetchConnection(i,t);var s=x.get(),c=s.END_CURSOR,l=s.START_CURSOR,u=a.cursor;_(u,"ReactRelayPaginationContainer: Cannot `loadMore` without valid `%s` (got `%s`)",E===F?c:l,u);var f={count:e,cursor:u,totalCount:i};return{dispose:n._fetchPage(f,o,r).unsubscribe}});var o=g(e.__relayContext),a=o.environment.unstable_internal.createFragmentSpecResolver;return n._isARequestInFlight=!1,n._refetchSubscription=null,n._refetchVariables=null,n._resolver=a(o,R,t,e,n._handleFragmentDataUpdate),n.state={data:n._resolver.resolve(),prevContext:o,contextForChildren:o,relayProp:n._buildRelayProp(o)},n._isUnmounted=!1,n._hasFetched=!1,n}(0,s.default)(v,r);var m=v.prototype;return m.UNSAFE_componentWillReceiveProps=function(e){var n=g(e.__relayContext),r=n.environment.unstable_internal,o=r.createFragmentSpecResolver,a=r.getDataIDsFromObject,i=a(t,this.props),s=a(t,e);n.environment===this.state.prevContext.environment&&n.variables===this.state.prevContext.variables&&h(i,s)?this._hasFetched||this._resolver.setProps(e):(this._cleanup(),this._resolver=o(n,R,t,e,this._handleFragmentDataUpdate),this.setState({prevContext:n,contextForChildren:n,relayProp:this._buildRelayProp(n)}));var c=this._resolver.resolve();c!==this.state.data&&this.setState({data:c})},m.componentWillUnmount=function(){this._isUnmounted=!0,this._cleanup()},m.shouldComponentUpdate=function(e,n){if(n.data!==this.state.data||n.relayProp!==this.state.relayProp)return!0;for(var r=Object.keys(e),o=0;o<r.length;o++){var a=r[o];if("__relayContext"===a){if(n.prevContext.environment!==this.state.prevContext.environment||n.prevContext.variables!==this.state.prevContext.variables)return!0}else if(!t.hasOwnProperty(a)&&!O(e[a],this.props[a]))return!0}return!1},m._buildRelayProp=function(e){return{hasMore:this._hasMore,isLoading:this._isLoading,loadMore:this._loadMore,refetchConnection:this._refetchConnection,environment:e.environment}},m._getConnectionData=function(){var e=this.props,t=(e.componentRef,(0,a.default)(e,["componentRef"])),n=(0,l.default)({},t,this.state.data),r=D(n);if(null==r)return null;var o=x.get(),i=o.EDGES,s=o.PAGE_INFO,c=o.HAS_NEXT_PAGE,u=o.HAS_PREV_PAGE,f=o.END_CURSOR,p=o.START_CURSOR;"object"!=typeof r&&y(!1,"ReactRelayPaginationContainer: Expected `getConnectionFromProps()` in `%s`to return `null` or a plain object with %s and %s properties, got `%s`.",b,i,s,r);var h=r[i],v=r[s];if(null==h||null==v)return null;Array.isArray(h)||y(!1,"ReactRelayPaginationContainer: Expected `getConnectionFromProps()` in `%s`to return an object with %s: Array, got `%s`.",b,i,h),"object"!=typeof v&&y(!1,"ReactRelayPaginationContainer: Expected `getConnectionFromProps()` in `%s`to return an object with %s: Object, got `%s`.",b,s,v);var d=E===F?v[c]:v[u],m=E===F?v[f]:v[p];return"boolean"!=typeof d||0!==h.length&&void 0===m?(_(!1,"ReactRelayPaginationContainer: Cannot paginate without %s fields in `%s`. Be sure to fetch %s (got `%s`) and %s (got `%s`).",s,b,E===F?c:u,d,E===F?f:p,m),null):{cursor:m,edgeCount:h.length,hasMore:d}},m._getQueryFetcher=function(){return this._queryFetcher||(this._queryFetcher=new p),this._queryFetcher},m._canFetchPage=function(e){return!this._isUnmounted||(_(!1,"ReactRelayPaginationContainer: Unexpected call of `%s` on unmounted container `%s`. It looks like some instances of your container still trying to fetch data but they already unmounted. Please make sure you clear all timers, intervals, async calls, etc that may trigger `%s` call.",e,R,e),!1)},m._fetchPage=function(e,r,o){var i,s,c=this,u=g(this.props.__relayContext).environment,f=u.unstable_internal,p=f.createOperationDescriptor,v=f.getRequest,_=f.getVariablesFromObject,m=this.props,C=(m.componentRef,m.__relayContext,(0,a.default)(m,["componentRef","__relayContext"])),R=(0,l.default)({},C,this.state.data),x=S(t,C);d(t,function(e,t){var n,r,o,a=x[t],s=Array.isArray(a)?null!==(n=null===(r=a[0])||void 0===r?void 0:r.variables)&&void 0!==n?n:{}:null!==(o=null==a?void 0:a.variables)&&void 0!==o?o:{};i=(0,l.default)({},i,s)}),s=_({},t,C,x),s=(0,l.default)({},i,s,this._refetchVariables);var O=n.getVariables(R,{count:e.count,cursor:e.cursor},s);("object"!=typeof O||null===O)&&y(!1,"ReactRelayPaginationContainer: Expected `getVariables()` to return an object, got `%s` in `%s`.",O,b),O=(0,l.default)({},O,this._refetchVariables),s=(0,l.default)({},O,s);var F=o?{force:!!o.force}:void 0,q=p(v(n.query),O),j=null;this._refetchSubscription&&this._refetchSubscription.unsubscribe(),this._hasFetched=!0;var D=function(){c._refetchSubscription===j&&(c._refetchSubscription=null,c._isARequestInFlight=!1)};return this._isARequestInFlight=!0,j=this._getQueryFetcher().execute({environment:u,operation:q,cacheConfig:F,preservePreviousReferences:!0}).mergeMap(function(t){return P.create(function(t){!function(t,n){var r=(0,l.default)({},c.props.__relayContext.variables,s),o=c._resolver.resolve();c._resolver.setVariables(w(s,e.totalCount),q.node);var a=c._resolver.resolve();h(o,a)?n():c.setState({data:a,contextForChildren:{environment:c.props.__relayContext.environment,variables:r}},n)}(0,function(){t.next(),t.complete()})})}).do({error:D,complete:D,unsubscribe:D}).subscribe(r||{}),this._refetchSubscription=this._isARequestInFlight?j:null,j},m._cleanup=function(){this._resolver.dispose(),this._refetchVariables=null,this._hasFetched=!1,this._refetchSubscription&&(this._refetchSubscription.unsubscribe(),this._refetchSubscription=null,this._isARequestInFlight=!1),this._queryFetcher&&this._queryFetcher.dispose()},m.render=function(){var t=this.props,n=t.componentRef,r=(t.__relayContext,(0,a.default)(t,["componentRef","__relayContext"]));return u.createElement(f.Provider,{value:this.state.contextForChildren},u.createElement(e,(0,o.default)({},r,this.state.data,{ref:n,relay:this.state.relayProp})))},v}(u.Component),(0,c.default)(r,"displayName",R),v}e.exports={createContainer:function(e,t,n){return v(e,t,function(e,t){return j(e,t,n)})}}},function(e,t){e.exports=i},function(e,t,n){"use strict";var r=n(2),o=r(n(6)),a=r(n(7)),i=n(1),s=n(3),c=n(15),l=n(8),u=n(0).deepFreeze,f={},p="STORE_THEN_NETWORK",h=function(e){function t(t){var n;n=e.call(this,t)||this;var r,a,i={handleDataChange:null,handleRetryAfterError:null};if(t.query){var s=t.query;a=y((0,t.environment.unstable_internal.getRequest)(s).params,t.variables),r=f[a]?f[a].queryFetcher:new c}else r=new c;return n.state=(0,o.default)({prevPropsEnvironment:t.environment,prevPropsVariables:t.variables,prevQuery:t.query,queryFetcher:r,retryCallbacks:i},_(t,r,i,a)),n}(0,a.default)(t,e),t.getDerivedStateFromProps=function(e,t){if(t.prevQuery!==e.query||t.prevPropsEnvironment!==e.environment||!l(t.prevPropsVariables,e.variables)){var n,r=e.query,a=t.queryFetcher.getSelectionReferences();if(t.queryFetcher.disposeRequest(),r){var i=y((0,e.environment.unstable_internal.getRequest)(r).params,e.variables);n=f[i]?f[i].queryFetcher:new c(a)}else n=new c(a);return(0,o.default)({prevQuery:e.query,prevPropsEnvironment:e.environment,prevPropsVariables:e.variables,queryFetcher:n},_(e,n,t.retryCallbacks))}return null};var n=t.prototype;return n.componentDidMount=function(){var e=this,t=this.state,n=t.retryCallbacks,r=t.queryFetcher,o=t.requestCacheKey;o&&delete f[o],n.handleDataChange=function(t){var n=null==t.error?null:t.error,r=null==t.snapshot?null:t.snapshot;e.setState(function(e){var t=e.requestCacheKey;return t&&delete f[t],r===e.snapshot&&n===e.error?null:{renderProps:d(n,r,e.queryFetcher,e.retryCallbacks),snapshot:r,requestCacheKey:null}})},n.handleRetryAfterError=function(t){return e.setState(function(e){var t=e.requestCacheKey;return t&&delete f[t],{renderProps:{error:null,props:null,retry:null},requestCacheKey:null}})},this.props.query&&r.setOnDataChange(n.handleDataChange)},n.componentDidUpdate=function(){var e=this.state.requestCacheKey;e&&(delete f[e],delete this.state.requestCacheKey)},n.componentWillUnmount=function(){this.state.queryFetcher.dispose()},n.shouldComponentUpdate=function(e,t){return e.render!==this.props.render||t.renderProps!==this.state.renderProps},n.render=function(){var e=this.state,t=e.renderProps,n=e.relayContext;return u(t),i.createElement(s.Provider,{value:n},this.props.render(t))},t}(i.Component);function v(e,t){return{environment:e,variables:t}}function d(e,t,n,r){return{error:e||null,props:t?t.data:null,retry:function(){var t=n.retry();t&&"function"==typeof r.handleDataChange?r.handleDataChange({snapshot:t}):e&&"function"==typeof r.handleRetryAfterError&&r.handleRetryAfterError(e)}}}function y(e,t){var n=e.id||e.text;return JSON.stringify({id:String(n),variables:t})}function _(e,t,n,r){var o=e.environment,a=e.query,i=e.variables,s=o;if(!a)return t.dispose(),{error:null,relayContext:v(s,i),renderProps:{error:null,props:{},retry:null},requestCacheKey:null};var c=s.unstable_internal,l=c.createOperationDescriptor,u=(0,c.getRequest)(a),h=l(u,i),_=v(s,h.variables);if("string"==typeof r&&f[r]){var b=f[r].snapshot;return b?{error:null,relayContext:_,renderProps:d(null,b,t,n),snapshot:b,requestCacheKey:r}:{error:null,relayContext:_,renderProps:{error:null,props:null,retry:null},snapshot:null,requestCacheKey:r}}try{var m=e.dataFrom===p?t.lookupInStore(s,h):null,C=t.fetch({cacheConfig:e.cacheConfig,dataFrom:e.dataFrom,environment:s,onDataChange:n.handleDataChange,operation:h})||m;return r=r||y(u.params,e.variables),f[r]={queryFetcher:t,snapshot:C},C?{error:null,relayContext:_,renderProps:d(null,C,t,n),snapshot:C,requestCacheKey:r}:{error:null,relayContext:_,renderProps:{error:null,props:null,retry:null},snapshot:null,requestCacheKey:r}}catch(e){return{error:e,relayContext:_,renderProps:d(e,null,t,n),snapshot:null,requestCacheKey:r}}}e.exports=h},function(e,t,n){"use strict";var r=n(2),o=r(n(13)),a=r(n(10)),i=r(n(6)),s=r(n(11)),c=r(n(7)),l=r(n(4)),u=n(1),f=n(3),p=n(15),h=n(8),v=n(12),d=n(16),y=n(9).getContainerName,_=n(14).assertRelayContext,b=n(0),m=b.Observable,C=b.getFragmentOwners,g=b.isScalarAndEqual;function R(e,t){return{environment:e,refetch:t}}e.exports={createContainer:function(e,t,n){return v(e,t,function(e,t){return function(e,t,n){var r,v,b=y(e);return v=r=function(r){function v(e){var o;o=r.call(this,e)||this,(0,l.default)((0,s.default)(o),"_handleFragmentDataUpdate",function(){var e=o.state.resolver;o.setState(function(t){return e===t.resolver?{data:t.resolver.resolve()}:null})}),(0,l.default)((0,s.default)(o),"_refetch",function(e,t,r,a){if(o._isUnmounted)return d(!1,"ReactRelayRefetchContainer: Unexpected call of `refetch` on unmounted container `%s`. It looks like some instances of your container still trying to refetch the data but they already unmounted. Please make sure you clear all timers, intervals, async calls, etc that may trigger `refetch`.",b),{dispose:function(){}};var s=_(o.props.__relayContext),c=s.environment,l=s.variables,u="function"==typeof e?e(o._getFragmentVariables()):e;u=(0,i.default)({},l,u);var f,p=t?(0,i.default)({},u,t):u,h=a?{force:!!a.force}:void 0,v="function"==typeof r?{next:r,error:r}:r||{},y=o.props.__relayContext.environment.unstable_internal,C=(0,y.createOperationDescriptor)((0,y.getRequest)(n),u);return o.state.localVariables=u,o._refetchSubscription&&o._refetchSubscription.unsubscribe(),"store-or-network"===(null==a?void 0:a.fetchPolicy)&&null!=o._getQueryFetcher().lookupInStore(c,C)?(o.state.resolver.setVariables(p,C.node),o.setState(function(e){return{data:e.resolver.resolve(),contextForChildren:{environment:o.props.__relayContext.environment,variables:p}}},function(){v.next&&v.next(),v.complete&&v.complete()}),{dispose:function(){}}):(o._getQueryFetcher().execute({environment:c,operation:C,cacheConfig:h,preservePreviousReferences:!0}).mergeMap(function(e){return o.state.resolver.setVariables(p,C.node),m.create(function(e){return o.setState(function(e){return{data:e.resolver.resolve(),contextForChildren:{environment:o.props.__relayContext.environment,variables:p}}},function(){e.next(),e.complete()})})}).finally(function(){o._refetchSubscription===f&&(o._refetchSubscription=null)}).subscribe((0,i.default)({},v,{start:function(e){o._refetchSubscription=f=e,v.start&&v.start(e)}})),{dispose:function(){f&&f.unsubscribe()}})});var a=_(e.__relayContext);o._refetchSubscription=null;var c=(0,a.environment.unstable_internal.createFragmentSpecResolver)(a,b,t,e);return o.state={data:c.resolve(),localVariables:null,prevProps:e,prevPropsContext:a,contextForChildren:a,relayProp:R(a.environment,o._refetch),resolver:c},o._isUnmounted=!1,o}(0,c.default)(v,r);var y=v.prototype;return y.componentDidMount=function(){this._subscribeToNewResolver()},y.componentDidUpdate=function(e,t){this.state.resolver!==t.resolver&&(t.resolver.dispose(),this._queryFetcher&&this._queryFetcher.dispose(),this._refetchSubscription&&this._refetchSubscription.unsubscribe(),this._subscribeToNewResolver())},v.getDerivedStateFromProps=function(e,n){var r=n.prevProps,o=_(e.__relayContext),a=o.environment.unstable_internal,i=a.createFragmentSpecResolver,s=a.getDataIDsFromObject,c=s(t,r),l=s(t,e),u=n.resolver;if(n.prevPropsContext.environment!==o.environment||n.prevPropsContext.variables!==o.variables||!h(c,l))return{data:(u=i(o,b,t,e)).resolve(),localVariables:null,prevProps:e,prevPropsContext:o,contextForChildren:o,relayProp:R(o.environment,n.relayProp.refetch),resolver:u};n.localVariables||u.setProps(e);var f=u.resolve();return f!==n.data?{data:f,prevProps:e}:null},y.componentWillUnmount=function(){this._isUnmounted=!0,this.state.resolver.dispose(),this._queryFetcher&&this._queryFetcher.dispose(),this._refetchSubscription&&this._refetchSubscription.unsubscribe()},y.shouldComponentUpdate=function(e,n){if(n.data!==this.state.data||n.relayProp!==this.state.relayProp)return!0;for(var r=Object.keys(e),o=0;o<r.length;o++){var a=r[o];if("__relayContext"===a){if(this.state.prevPropsContext.environment!==n.prevPropsContext.environment||this.state.prevPropsContext.variables!==n.prevPropsContext.variables)return!0}else if(!t.hasOwnProperty(a)&&!g(e[a],this.props[a]))return!0}return!1},y._subscribeToNewResolver=function(){var e=this.state,t=e.data,n=e.resolver;n.setCallback(this._handleFragmentDataUpdate);var r=n.resolve();t!==r&&this.setState({data:r})},y._getFragmentVariables=function(){return(0,this.props.__relayContext.environment.unstable_internal.getVariablesFromObject)({},t,this.props,C(t,this.props))},y._getQueryFetcher=function(){return this._queryFetcher||(this._queryFetcher=new p),this._queryFetcher},y.render=function(){var t=this.props,n=t.componentRef,r=(t.__relayContext,(0,a.default)(t,["componentRef","__relayContext"])),i=this.state,s=i.relayProp,c=i.contextForChildren;return u.createElement(f.Provider,{value:c},u.createElement(e,(0,o.default)({},r,this.state.data,{ref:n,relay:s})))},v}(u.Component),(0,l.default)(r,"displayName",b),v}(e,t,n)})}}}])});
|
package/react-relay.min.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
/**
|
2
|
-
* Relay
|
2
|
+
* Relay v5.0.0
|
3
3
|
*
|
4
4
|
* Copyright (c) 2013-present, Facebook, Inc.
|
5
5
|
*
|
6
6
|
* This source code is licensed under the MIT license found in the
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
8
8
|
*/
|
9
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("relay-runtime"),require("fbjs/lib/invariant"),require("fbjs/lib/areEqual"),require("fbjs/lib/warning"),require("fbjs/lib/mapObject"),require("fbjs/lib/forEachObject")):"function"==typeof define&&define.amd?define(["react","relay-runtime","fbjs/lib/invariant","fbjs/lib/areEqual","fbjs/lib/warning","fbjs/lib/mapObject","fbjs/lib/forEachObject"],t):"object"==typeof exports?exports.ReactRelay=t(require("react"),require("relay-runtime"),require("fbjs/lib/invariant"),require("fbjs/lib/areEqual"),require("fbjs/lib/warning"),require("fbjs/lib/mapObject"),require("fbjs/lib/forEachObject")):e.ReactRelay=t(e.react,e["relay-runtime"],e["fbjs/lib/invariant"],e["fbjs/lib/areEqual"],e["fbjs/lib/warning"],e["fbjs/lib/mapObject"],e["fbjs/lib/forEachObject"])}(window,function(e,t,r,n,o,a,i){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=17)}([function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t,r){"use strict";var n=r(0),o=r(1).__internal.createRelayContext;e.exports=o(n)},function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t){e.exports=r},function(e,t,r){var n=r(4);e.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}},function(e,t){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}},function(e,t){e.exports=n},function(e,t,r){"use strict";function n(e){return e.displayName||e.name||"Component"}e.exports={getComponentName:n,getContainerName:function(e){return"Relay("+n(e)+")"}}},function(e,t){e.exports=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,r){"use strict";var n=r(2)(r(13)),o=r(0),a=r(3),i=r(19),s=r(5),u=r(20),l=r(21),c=r(9),f=c.getComponentName,p=c.getContainerName;e.exports=function(e,t,r){var c,h,v=p(e);function d(n){if(null==h||n.__relayContext.environment!==c){var o=(c=n.__relayContext.environment).unstable_internal.getFragment,a=u(t,o);h=r(e,a),d.getDerivedStateFromProps=h.getDerivedStateFromProps}return new h(n)}function _(e,t){var r=l(a);return r||s(!1),o.createElement(d,(0,n.default)({},e,{__relayContext:r,componentRef:e.componentRef||t}))}return i(f(e),t),d.prototype=o.Component.prototype,d.displayName=v,_.displayName=v,o.forwardRef(_)}},function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r.apply(this,arguments)}e.exports=r},function(e,t,r){"use strict";var n=r(5),o=r(22),a=r(23);function i(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&o(e.environment)&&a(e.variables)}e.exports={assertRelayContext:function(e){return i(e)||n(!1),e},isRelayContext:i}},function(e,t,r){"use strict";var n=r(2)(r(4)),o=r(5),a=r(1),i=a.isRelayModernEnvironment,s=a.__internal.fetchQuery,u=function(){function e(e){(0,n.default)(this,"_selectionReferences",[]),(0,n.default)(this,"_callOnDataChangeWhenSet",!1),null!=e&&(this._cacheSelectionReference=e.cacheSelectionReference,this._selectionReferences=e.selectionReferences)}var t=e.prototype;return t.getSelectionReferences=function(){return{cacheSelectionReference:this._cacheSelectionReference,selectionReferences:this._selectionReferences}},t.lookupInStore=function(e,t){return e.check(t.root)?(this._retainCachedOperation(e,t),e.lookup(t.fragment,t)):null},t.execute=function(e){var t=this,r=e.environment,n=e.operation,o=e.cacheConfig,a=e.preservePreviousReferences,u=void 0!==a&&a,l=r.retain(n.root),c=null!=o?{networkCacheConfig:o}:{},f=function(){t._selectionReferences=t._selectionReferences.concat(l)},p=function(){u||t.disposeSelectionReferences(),t._selectionReferences=t._selectionReferences.concat(l)},h=function(){t._selectionReferences=t._selectionReferences.concat(l)};return i(r)?s(r,n,c).do({error:f,complete:p,unsubscribe:h}):r.execute({operation:n,cacheConfig:o}).do({error:f,complete:p,unsubscribe:h})},t.setOnDataChange=function(e){this._fetchOptions||o(!1),"function"==typeof e&&(this._fetchOptions.onDataChangeCallbacks=this._fetchOptions.onDataChangeCallbacks||[],this._fetchOptions.onDataChangeCallbacks.push(e),this._callOnDataChangeWhenSet&&(null!=this._error?e({error:this._error}):null!=this._snapshot&&e({snapshot:this._snapshot})))},t.fetch=function(e){var t,r=this,n=e.cacheConfig,o=e.environment,a=e.operation,i=e.onDataChange,s=!1;this.disposeRequest();var u=this._fetchOptions&&this._fetchOptions.onDataChangeCallbacks;this._fetchOptions={cacheConfig:n,environment:o,onDataChangeCallbacks:u||[],operation:a},i&&-1===this._fetchOptions.onDataChangeCallbacks.indexOf(i)&&this._fetchOptions.onDataChangeCallbacks.push(i);var l=this.execute({environment:o,operation:a,cacheConfig:n}).finally(function(){r._pendingRequest=null}).subscribe({next:function(){r._callOnDataChangeWhenSet=!0,r._error=null,r._onQueryDataAvailable({notifyFirstResult:s})},error:function(e){r._callOnDataChangeWhenSet=!0,r._error=e,r._snapshot=null;var n=r._fetchOptions&&r._fetchOptions.onDataChangeCallbacks;s?n&&n.forEach(function(t){t({error:e})}):t=e}});if(this._pendingRequest={dispose:function(){l.unsubscribe()}},s=!0,t)throw t;return this._snapshot},t.retry=function(){return this._fetchOptions||o(!1),this.fetch({cacheConfig:this._fetchOptions.cacheConfig,environment:this._fetchOptions.environment,operation:this._fetchOptions.operation,onDataChange:null})},t.dispose=function(){this.disposeRequest(),this.disposeSelectionReferences()},t.disposeRequest=function(){this._error=null,this._snapshot=null,this._pendingRequest&&this._pendingRequest.dispose(),this._rootSubscription&&(this._rootSubscription.dispose(),this._rootSubscription=null)},t._retainCachedOperation=function(e,t){this._disposeCacheSelectionReference(),this._cacheSelectionReference=e.retain(t.root)},t._disposeCacheSelectionReference=function(){this._cacheSelectionReference&&this._cacheSelectionReference.dispose(),this._cacheSelectionReference=null},t.disposeSelectionReferences=function(){this._disposeCacheSelectionReference(),this._selectionReferences.forEach(function(e){return e.dispose()}),this._selectionReferences=[]},t._onQueryDataAvailable=function(e){var t=this,r=e.notifyFirstResult;this._fetchOptions||o(!1);var n=this._fetchOptions,a=n.environment,i=n.onDataChangeCallbacks,s=n.operation;if(!this._snapshot&&(this._snapshot=a.lookup(s.fragment,s),this._rootSubscription=a.subscribe(this._snapshot,function(e){if(null!=t._fetchOptions){var r=t._fetchOptions.onDataChangeCallbacks;Array.isArray(r)&&r.forEach(function(t){return t({snapshot:e})})}}),this._snapshot&&r&&Array.isArray(i))){var u=this._snapshot;i.forEach(function(e){return e({snapshot:u})})}},e}();e.exports=u},function(e,t){e.exports=o},function(e,t,r){"use strict";var n=r(3),o=r(18),a=r(24),i=r(26),s=r(27),u=r(1);e.exports={QueryRenderer:i,MutationTypes:u.MutationTypes,RangeOperations:u.RangeOperations,ReactRelayContext:n,applyOptimisticMutation:u.applyOptimisticMutation,commitLocalUpdate:u.commitLocalUpdate,commitMutation:u.commitMutation,createFragmentContainer:o.createContainer,createPaginationContainer:a.createContainer,createRefetchContainer:s.createContainer,fetchQuery:u.fetchQuery,graphql:u.graphql,requestSubscription:u.requestSubscription}},function(e,t,r){"use strict";var n=r(2),o=n(r(6)),a=n(r(10)),i=n(r(7)),s=n(r(11)),u=n(r(4)),l=r(0),c=r(8),f=r(12),p=r(9).getContainerName,h=r(14).assertRelayContext,v=r(1).isScalarAndEqual;function d(e,t){var r,n,f=p(e);return n=r=function(r){function n(e){var n;n=r.call(this,e)||this,(0,u.default)((0,s.default)((0,s.default)(n)),"_handleFragmentDataUpdate",function(){var e=n.state.resolver;n.setState(function(t){return e===t.resolver?{data:t.resolver.resolve(),relayProp:_(t.relayProp.environment)}:null})});var o=h(e.__relayContext),a=(0,o.environment.unstable_internal.createFragmentSpecResolver)(o,f,t,e);return n.state={data:a.resolve(),prevProps:e,prevPropsContext:o,relayProp:_(o.environment),resolver:a},n}(0,i.default)(n,r),n.getDerivedStateFromProps=function(e,r){var n=r.prevProps,o=h(e.__relayContext),a=o.environment.unstable_internal,i=a.createFragmentSpecResolver,s=a.getDataIDsFromObject,u=s(t,n),l=s(t,e),p=r.resolver;if(r.prevPropsContext.environment!==o.environment||r.prevPropsContext.variables!==o.variables||!c(u,l))return{data:(p=i(o,f,t,e)).resolve(),prevPropsContext:o,prevProps:e,relayProp:_(o.environment),resolver:p};p.setProps(e);var v=p.resolve();return v!==r.data?{data:v,prevProps:e,prevPropsContext:o,relayProp:_(o.environment)}:null};var p=n.prototype;return p.componentDidMount=function(){this._subscribeToNewResolver(),this._rerenderIfStoreHasChanged()},p.componentDidUpdate=function(e,t){this.state.resolver!==t.resolver&&(t.resolver.dispose(),this._subscribeToNewResolver()),this._rerenderIfStoreHasChanged()},p.componentWillUnmount=function(){this.state.resolver.dispose()},p.shouldComponentUpdate=function(e,r){if(r.data!==this.state.data)return!0;for(var n=Object.keys(e),o=0;o<n.length;o++){var a=n[o];if("__relayContext"===a){if(r.prevPropsContext.environment!==this.state.prevPropsContext.environment||r.prevPropsContext.variables!==this.state.prevPropsContext.variables)return!0}else if(!t.hasOwnProperty(a)&&!v(e[a],this.props[a]))return!0}return!1},p._rerenderIfStoreHasChanged=function(){var e=this.state,t=e.data,r=e.resolver.resolve();t!==r&&this.setState({data:r})},p._subscribeToNewResolver=function(){this.state.resolver.setCallback(this._handleFragmentDataUpdate)},p.render=function(){var t=this.props,r=t.componentRef,n=(t.__relayContext,(0,a.default)(t,["componentRef","__relayContext"]));return l.createElement(e,(0,o.default)({},n,this.state.data,{ref:r,relay:this.state.relayProp}))},n}(l.Component),(0,u.default)(r,"displayName",f),n}function _(e){return{environment:e}}e.exports={createContainer:function(e,t){return f(e,t,d)}}},function(e,t,r){"use strict";var n=r(5);e.exports=function(e,t){for(var r in t&&"object"==typeof t||n(!1),t)if(t.hasOwnProperty(r)){var o=t[r];(!o||"object"!=typeof o&&"function"!=typeof o)&&n(!1)}}},function(e,t){e.exports=a},function(e,t,r){"use strict";var n=r(0).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,o=n.ReactCurrentDispatcher,a=n.ReactCurrentOwner;e.exports=function(e){return(null!=o?o.current:a.currentDispatcher).readContext(e)}},function(e,t,r){"use strict";e.exports=function(e){return"object"==typeof e&&null!==e&&"function"==typeof e.check&&"function"==typeof e.lookup&&"function"==typeof e.retain&&"function"==typeof e.sendQuery&&"function"==typeof e.execute&&"function"==typeof e.subscribe}},function(e,t,r){"use strict";e.exports=function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}},function(e,t,r){"use strict";var n=r(2),o=n(r(13)),a=n(r(10)),i=n(r(7)),s=n(r(11)),u=n(r(4)),l=n(r(6)),c=r(0),f=r(3),p=r(15),h=r(8),v=r(12),d=r(25),_=r(5),b=(r(16),r(9)),y=b.getComponentName,m=b.getContainerName,C=r(14).assertRelayContext,g=r(1),R=g.ConnectionInterface,x=g.RelayFeatureFlags,P=g.Observable,S=g.getFragmentOwners,F=g.isScalarAndEqual,O="forward";function q(e){return"function"==typeof e?{error:e,complete:e,unsubscribe:function(t){"function"==typeof e&&e()}}:e||{}}function E(e,t,r){y(e);var n,v,b=m(e),g=function(e){var t=null,r=!1;for(var n in e){var o=e[n],a=o.metadata&&o.metadata.connection;void 0!==o.metadata&&(r=!0),a&&(1!==a.length&&_(!1),t&&_(!1),t=(0,l.default)({},a[0],{fragmentName:n}))}return r&&null===t&&_(!1),t||{}}(t),E=r.getConnectionFromProps||function(e){var t=e.path;return t||_(!1),function(r){for(var n=r[e.fragmentName],o=0;o<t.length;o++){if(!n||"object"!=typeof n)return null;n=n[t[o]]}return n}}(g),D=r.direction||g.direction;D||_(!1);var j=r.getFragmentVariables||function(e){var t=e.count;return t||_(!1),function(e,r){return(0,l.default)({},e,(0,u.default)({},t,r))}}(g);return v=n=function(n){function v(e){var r;r=n.call(this,e)||this,(0,u.default)((0,s.default)((0,s.default)(r)),"_handleFragmentDataUpdate",function(){r.setState({data:r._resolver.resolve()})}),(0,u.default)((0,s.default)((0,s.default)(r)),"_hasMore",function(){var e=r._getConnectionData();return!!(e&&e.hasMore&&e.cursor)}),(0,u.default)((0,s.default)((0,s.default)(r)),"_isLoading",function(){return!!r._refetchSubscription}),(0,u.default)((0,s.default)((0,s.default)(r)),"_refetchConnection",function(e,t,n){if(!r._canFetchPage("refetchConnection"))return{dispose:function(){}};r._refetchVariables=n;var o={count:e,cursor:null,totalCount:e};return{dispose:r._fetchPage(o,q(t),{force:!0}).unsubscribe}}),(0,u.default)((0,s.default)((0,s.default)(r)),"_loadMore",function(e,t,n){if(!r._canFetchPage("loadMore"))return{dispose:function(){}};var o=q(t),a=r._getConnectionData();if(!a)return P.create(function(e){return e.complete()}).subscribe(o),null;var i=a.edgeCount+e;if(n&&n.force)return r._refetchConnection(i,t);var s=R.get(),u=(s.END_CURSOR,s.START_CURSOR,{count:e,cursor:a.cursor,totalCount:i});return{dispose:r._fetchPage(u,o,n).unsubscribe}});var o=C(e.__relayContext),a=o.environment.unstable_internal.createFragmentSpecResolver;return r._isARequestInFlight=!1,r._refetchSubscription=null,r._refetchVariables=null,r._resolver=a(o,b,t,e,r._handleFragmentDataUpdate),r.state={data:r._resolver.resolve(),prevContext:o,contextForChildren:o,relayProp:r._buildRelayProp(o)},r._isUnmounted=!1,r._hasFetched=!1,r}(0,i.default)(v,n);var y=v.prototype;return y.UNSAFE_componentWillReceiveProps=function(e){var r=C(e.__relayContext),n=r.environment.unstable_internal,o=n.createFragmentSpecResolver,a=n.getDataIDsFromObject,i=a(t,this.props),s=a(t,e);r.environment===this.state.prevContext.environment&&r.variables===this.state.prevContext.variables&&h(i,s)?this._hasFetched||this._resolver.setProps(e):(this._cleanup(),this._resolver=o(r,b,t,e,this._handleFragmentDataUpdate),this.setState({prevContext:r,contextForChildren:r,relayProp:this._buildRelayProp(r)}));var u=this._resolver.resolve();u!==this.state.data&&this.setState({data:u})},y.componentWillUnmount=function(){this._isUnmounted=!0,this._cleanup()},y.shouldComponentUpdate=function(e,r){if(r.data!==this.state.data||r.relayProp!==this.state.relayProp)return!0;for(var n=Object.keys(e),o=0;o<n.length;o++){var a=n[o];if("__relayContext"===a){if(r.prevContext.environment!==this.state.prevContext.environment||r.prevContext.variables!==this.state.prevContext.variables)return!0}else if(!t.hasOwnProperty(a)&&!F(e[a],this.props[a]))return!0}return!1},y._buildRelayProp=function(e){return{hasMore:this._hasMore,isLoading:this._isLoading,loadMore:this._loadMore,refetchConnection:this._refetchConnection,environment:e.environment}},y._getConnectionData=function(){var e=this.props,t=(e.componentRef,(0,a.default)(e,["componentRef"])),r=(0,l.default)({},t,this.state.data),n=E(r);if(null==n)return null;var o=R.get(),i=o.EDGES,s=o.PAGE_INFO,u=o.HAS_NEXT_PAGE,c=o.HAS_PREV_PAGE,f=o.END_CURSOR,p=o.START_CURSOR;"object"!=typeof n&&_(!1);var h=n[i],v=n[s];if(null==h||null==v)return null;Array.isArray(h)||_(!1),"object"!=typeof v&&_(!1);var d=D===O?v[u]:v[c],b=D===O?v[f]:v[p];return"boolean"!=typeof d||0!==h.length&&void 0===b?null:{cursor:b,edgeCount:h.length,hasMore:d}},y._getQueryFetcher=function(){return this._queryFetcher||(this._queryFetcher=new p),this._queryFetcher},y._canFetchPage=function(e){return!this._isUnmounted},y._fetchPage=function(e,n,o){var i,s,u=this,c=C(this.props.__relayContext).environment,f=c.unstable_internal,p=f.createOperationDescriptor,v=f.getRequest,b=f.getVariablesFromObject,y=this.props,m=(y.componentRef,y.__relayContext,(0,a.default)(y,["componentRef","__relayContext"])),g=(0,l.default)({},m,this.state.data);if(x.PREFER_FRAGMENT_OWNER_OVER_CONTEXT){var R=S(t,m);d(t,function(e,t){var r,n,o,a=R[t],s=Array.isArray(a)?null!==(r=null===(n=a[0])||void 0===n?void 0:n.variables)&&void 0!==r?r:{}:null!==(o=null===a||void 0===a?void 0:a.variables)&&void 0!==o?o:{};i=(0,l.default)({},i,s)}),s=b({},t,m,R)}else i=this.props.__relayContext.variables,s=b(i,t,m);s=(0,l.default)({},i,s,this._refetchVariables);var F=r.getVariables(g,{count:e.count,cursor:e.cursor},s);("object"!=typeof F||null===F)&&_(!1),F=(0,l.default)({},F,this._refetchVariables),x.MERGE_FETCH_AND_FRAGMENT_VARS&&(s=(0,l.default)({},F,s));var O=o?{force:!!o.force}:void 0,q=p(v(r.query),F),E=null;this._refetchSubscription&&this._refetchSubscription.unsubscribe(),this._hasFetched=!0;var D=function(){u._refetchSubscription===E&&(u._refetchSubscription=null,u._isARequestInFlight=!1)};return this._isARequestInFlight=!0,E=this._getQueryFetcher().execute({environment:c,operation:q,cacheConfig:O,preservePreviousReferences:!0}).mergeMap(function(t){return P.create(function(t){!function(t,r){var n=(0,l.default)({},u.props.__relayContext.variables,s),o=u._resolver.resolve();u._resolver.setVariables(j(s,e.totalCount),q.node);var a=u._resolver.resolve();h(o,a)?r():u.setState({data:a,contextForChildren:{environment:u.props.__relayContext.environment,variables:n}},r)}(0,function(){t.next(),t.complete()})})}).do({error:D,complete:D,unsubscribe:D}).subscribe(n||{}),this._refetchSubscription=this._isARequestInFlight?E:null,E},y._cleanup=function(){this._resolver.dispose(),this._refetchVariables=null,this._hasFetched=!1,this._refetchSubscription&&(this._refetchSubscription.unsubscribe(),this._refetchSubscription=null,this._isARequestInFlight=!1),this._queryFetcher&&this._queryFetcher.dispose()},y.render=function(){var t=this.props,r=t.componentRef,n=(t.__relayContext,(0,a.default)(t,["componentRef","__relayContext"]));return c.createElement(f.Provider,{value:this.state.contextForChildren},c.createElement(e,(0,o.default)({},n,this.state.data,{ref:r,relay:this.state.relayProp})))},v}(c.Component),(0,u.default)(n,"displayName",b),v}e.exports={createContainer:function(e,t,r){return v(e,t,function(e,t){return E(e,t,r)})}}},function(e,t){e.exports=i},function(e,t,r){"use strict";var n=r(2),o=n(r(6)),a=n(r(7)),i=r(0),s=r(3),u=r(15),l=r(8),c=(r(1).deepFreeze,{}),f="STORE_THEN_NETWORK",p=function(e){function t(t){var r;r=e.call(this,t)||this;var n,a,i={handleDataChange:null,handleRetryAfterError:null};if(t.query){var s=t.query;a=d((0,t.environment.unstable_internal.getRequest)(s).params,t.variables),n=c[a]?c[a].queryFetcher:new u}else n=new u;return r.state=(0,o.default)({prevPropsEnvironment:t.environment,prevPropsVariables:t.variables,prevQuery:t.query,queryFetcher:n,retryCallbacks:i},_(t,n,i,a)),r}(0,a.default)(t,e),t.getDerivedStateFromProps=function(e,t){if(t.prevQuery!==e.query||t.prevPropsEnvironment!==e.environment||!l(t.prevPropsVariables,e.variables)){var r,n=e.query,a=t.queryFetcher.getSelectionReferences();if(t.queryFetcher.disposeRequest(),n){var i=d((0,e.environment.unstable_internal.getRequest)(n).params,e.variables);r=c[i]?c[i].queryFetcher:new u(a)}else r=new u(a);return(0,o.default)({prevQuery:e.query,prevPropsEnvironment:e.environment,prevPropsVariables:e.variables,queryFetcher:r},_(e,r,t.retryCallbacks))}return null};var r=t.prototype;return r.componentDidMount=function(){var e=this,t=this.state,r=t.retryCallbacks,n=t.queryFetcher,o=t.requestCacheKey;o&&delete c[o],r.handleDataChange=function(t){var r=null==t.error?null:t.error,n=null==t.snapshot?null:t.snapshot;e.setState(function(e){var t=e.requestCacheKey;return t&&delete c[t],n===e.snapshot&&r===e.error?null:{renderProps:v(r,n,e.queryFetcher,e.retryCallbacks),snapshot:n,requestCacheKey:null}})},r.handleRetryAfterError=function(t){return e.setState(function(e){var t=e.requestCacheKey;return t&&delete c[t],{renderProps:{error:null,props:null,retry:null},requestCacheKey:null}})},this.props.query&&n.setOnDataChange(r.handleDataChange)},r.componentDidUpdate=function(){var e=this.state.requestCacheKey;e&&(delete c[e],delete this.state.requestCacheKey)},r.componentWillUnmount=function(){this.state.queryFetcher.dispose()},r.shouldComponentUpdate=function(e,t){return e.render!==this.props.render||t.renderProps!==this.state.renderProps},r.render=function(){var e=this.state,t=e.renderProps,r=e.relayContext;return i.createElement(s.Provider,{value:r},this.props.render(t))},t}(i.Component);function h(e,t){return{environment:e,variables:t}}function v(e,t,r,n){return{error:e||null,props:t?t.data:null,retry:function(){var t=r.retry();t&&"function"==typeof n.handleDataChange?n.handleDataChange({snapshot:t}):e&&"function"==typeof n.handleRetryAfterError&&n.handleRetryAfterError(e)}}}function d(e,t){var r=e.id||e.text;return JSON.stringify({id:String(r),variables:t})}function _(e,t,r,n){var o=e.environment,a=e.query,i=e.variables,s=o;if(!a)return t.dispose(),{error:null,relayContext:h(s,i),renderProps:{error:null,props:{},retry:null},requestCacheKey:null};var u=s.unstable_internal,l=u.createOperationDescriptor,p=(0,u.getRequest)(a),_=l(p,i),b=h(s,_.variables);if("string"==typeof n&&c[n]){var y=c[n].snapshot;return y?{error:null,relayContext:b,renderProps:v(null,y,t,r),snapshot:y,requestCacheKey:n}:{error:null,relayContext:b,renderProps:{error:null,props:null,retry:null},snapshot:null,requestCacheKey:n}}try{var m=e.dataFrom===f?t.lookupInStore(s,_):null,C=t.fetch({cacheConfig:e.cacheConfig,dataFrom:e.dataFrom,environment:s,onDataChange:r.handleDataChange,operation:_})||m;return n=n||d(p.params,e.variables),c[n]={queryFetcher:t,snapshot:C},C?{error:null,relayContext:b,renderProps:v(null,C,t,r),snapshot:C,requestCacheKey:n}:{error:null,relayContext:b,renderProps:{error:null,props:null,retry:null},snapshot:null,requestCacheKey:n}}catch(e){return{error:e,relayContext:b,renderProps:v(e,null,t,r),snapshot:null,requestCacheKey:n}}}e.exports=p},function(e,t,r){"use strict";var n=r(2),o=n(r(13)),a=n(r(10)),i=n(r(6)),s=n(r(7)),u=n(r(11)),l=n(r(4)),c=r(0),f=r(3),p=r(15),h=r(8),v=r(12),d=(r(16),r(9).getContainerName),_=r(14).assertRelayContext,b=r(1),y=b.Observable,m=b.RelayFeatureFlags,C=b.getFragmentOwners,g=b.isScalarAndEqual;function R(e,t){return{environment:e,refetch:t}}e.exports={createContainer:function(e,t,r){return v(e,t,function(e,t){return function(e,t,r){var n,v,b=d(e);return v=n=function(n){function v(e){var o;o=n.call(this,e)||this,(0,l.default)((0,u.default)((0,u.default)(o)),"_handleFragmentDataUpdate",function(){var e=o.state.resolver;o.setState(function(t){return e===t.resolver?{data:t.resolver.resolve()}:null})}),(0,l.default)((0,u.default)((0,u.default)(o)),"_refetch",function(e,t,n,a){if(o._isUnmounted)return{dispose:function(){}};var s=_(o.props.__relayContext),u=s.environment,l=s.variables,c="function"==typeof e?e(o._getFragmentVariables()):e;c=(0,i.default)({},l,c);var f,p=t?m.MERGE_FETCH_AND_FRAGMENT_VARS?(0,i.default)({},c,t):(0,i.default)({},l,t):c,h=a?{force:!!a.force}:void 0,v="function"==typeof n?{next:n,error:n}:n||{},d=o.props.__relayContext.environment.unstable_internal,b=(0,d.createOperationDescriptor)((0,d.getRequest)(r),c);return o.state.localVariables=c,o._refetchSubscription&&o._refetchSubscription.unsubscribe(),"store-or-network"===(null===a||void 0===a?void 0:a.fetchPolicy)&&null!=o._getQueryFetcher().lookupInStore(u,b)?(o.state.resolver.setVariables(p,b.node),o.setState(function(e){return{data:e.resolver.resolve(),contextForChildren:{environment:o.props.__relayContext.environment,variables:p}}},function(){v.next&&v.next(),v.complete&&v.complete()}),{dispose:function(){}}):(o._getQueryFetcher().execute({environment:u,operation:b,cacheConfig:h,preservePreviousReferences:!0}).mergeMap(function(e){return o.state.resolver.setVariables(p,b.node),y.create(function(e){return o.setState(function(e){return{data:e.resolver.resolve(),contextForChildren:{environment:o.props.__relayContext.environment,variables:p}}},function(){e.next(),e.complete()})})}).finally(function(){o._refetchSubscription===f&&(o._refetchSubscription=null)}).subscribe((0,i.default)({},v,{start:function(e){o._refetchSubscription=f=e,v.start&&v.start(e)}})),{dispose:function(){f&&f.unsubscribe()}})});var a=_(e.__relayContext);o._refetchSubscription=null;var s=(0,a.environment.unstable_internal.createFragmentSpecResolver)(a,b,t,e);return o.state={data:s.resolve(),localVariables:null,prevProps:e,prevPropsContext:a,contextForChildren:a,relayProp:R(a.environment,o._refetch),resolver:s},o._isUnmounted=!1,o}(0,s.default)(v,n);var d=v.prototype;return d.componentDidMount=function(){this._subscribeToNewResolver()},d.componentDidUpdate=function(e,t){this.state.resolver!==t.resolver&&(t.resolver.dispose(),this._queryFetcher&&this._queryFetcher.dispose(),this._refetchSubscription&&this._refetchSubscription.unsubscribe(),this._subscribeToNewResolver())},v.getDerivedStateFromProps=function(e,r){var n=r.prevProps,o=_(e.__relayContext),a=o.environment.unstable_internal,i=a.createFragmentSpecResolver,s=a.getDataIDsFromObject,u=s(t,n),l=s(t,e),c=r.resolver;if(r.prevPropsContext.environment!==o.environment||r.prevPropsContext.variables!==o.variables||!h(u,l))return{data:(c=i(o,b,t,e)).resolve(),localVariables:null,prevProps:e,prevPropsContext:o,contextForChildren:o,relayProp:R(o.environment,r.relayProp.refetch),resolver:c};r.localVariables||c.setProps(e);var f=c.resolve();return f!==r.data?{data:f,prevProps:e}:null},d.componentWillUnmount=function(){this._isUnmounted=!0,this.state.resolver.dispose(),this._queryFetcher&&this._queryFetcher.dispose(),this._refetchSubscription&&this._refetchSubscription.unsubscribe()},d.shouldComponentUpdate=function(e,r){if(r.data!==this.state.data||r.relayProp!==this.state.relayProp)return!0;for(var n=Object.keys(e),o=0;o<n.length;o++){var a=n[o];if("__relayContext"===a){if(this.state.prevPropsContext.environment!==r.prevPropsContext.environment||this.state.prevPropsContext.variables!==r.prevPropsContext.variables)return!0}else if(!t.hasOwnProperty(a)&&!g(e[a],this.props[a]))return!0}return!1},d._subscribeToNewResolver=function(){var e=this.state,t=e.data,r=e.resolver;r.setCallback(this._handleFragmentDataUpdate);var n=r.resolve();t!==n&&this.setState({data:n})},d._getFragmentVariables=function(){var e=this.props.__relayContext.environment.unstable_internal.getVariablesFromObject;return m.PREFER_FRAGMENT_OWNER_OVER_CONTEXT?e({},t,this.props,C(t,this.props)):e(this.props.__relayContext.variables,t,this.props)},d._getQueryFetcher=function(){return this._queryFetcher||(this._queryFetcher=new p),this._queryFetcher},d.render=function(){var t=this.props,r=t.componentRef,n=(t.__relayContext,(0,a.default)(t,["componentRef","__relayContext"])),i=this.state,s=i.relayProp,u=i.contextForChildren;return c.createElement(f.Provider,{value:u},c.createElement(e,(0,o.default)({},n,this.state.data,{ref:r,relay:s})))},v}(c.Component),(0,l.default)(n,"displayName",b),v}(e,t,r)})}}}])});
|
9
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("relay-runtime"),require("fbjs/lib/invariant"),require("fbjs/lib/areEqual"),require("fbjs/lib/warning"),require("fbjs/lib/mapObject"),require("fbjs/lib/forEachObject")):"function"==typeof define&&define.amd?define(["react","relay-runtime","fbjs/lib/invariant","fbjs/lib/areEqual","fbjs/lib/warning","fbjs/lib/mapObject","fbjs/lib/forEachObject"],t):"object"==typeof exports?exports.ReactRelay=t(require("react"),require("relay-runtime"),require("fbjs/lib/invariant"),require("fbjs/lib/areEqual"),require("fbjs/lib/warning"),require("fbjs/lib/mapObject"),require("fbjs/lib/forEachObject")):e.ReactRelay=t(e.react,e["relay-runtime"],e["fbjs/lib/invariant"],e["fbjs/lib/areEqual"],e["fbjs/lib/warning"],e["fbjs/lib/mapObject"],e["fbjs/lib/forEachObject"])}(window,function(e,t,r,n,o,a,i){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=17)}([function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t,r){"use strict";var n=r(0),o=r(1).__internal.createRelayContext;e.exports=o(n)},function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t){e.exports=r},function(e,t,r){var n=r(4);e.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}},function(e,t){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}},function(e,t){e.exports=n},function(e,t,r){"use strict";function n(e){return e.displayName||e.name||"Component"}e.exports={getComponentName:n,getContainerName:function(e){return"Relay("+n(e)+")"}}},function(e,t){e.exports=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,r){"use strict";var n=r(2)(r(13)),o=r(0),a=r(3),i=r(19),s=r(5),u=r(20),c=r(21),l=r(9),f=l.getComponentName,p=l.getContainerName;e.exports=function(e,t,r){var l,h,v=p(e);function d(n){if(null==h||n.__relayContext.environment!==l){var o=(l=n.__relayContext.environment).unstable_internal.getFragment,a=u(t,o);h=r(e,a),d.getDerivedStateFromProps=h.getDerivedStateFromProps}return new h(n)}function _(e,t){var r=c(a);return r||s(!1),o.createElement(d,(0,n.default)({},e,{__relayContext:r,componentRef:e.componentRef||t}))}return i(f(e),t),d.prototype=o.Component.prototype,d.displayName=v,_.displayName=v,o.forwardRef(_)}},function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r.apply(this,arguments)}e.exports=r},function(e,t,r){"use strict";var n=r(5),o=r(22),a=r(23);function i(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&o(e.environment)&&a(e.variables)}e.exports={assertRelayContext:function(e){return i(e)||n(!1),e},isRelayContext:i}},function(e,t,r){"use strict";var n=r(2)(r(4)),o=r(5),a=r(1),i=a.isRelayModernEnvironment,s=a.__internal.fetchQuery,u=function(){function e(e){(0,n.default)(this,"_selectionReferences",[]),(0,n.default)(this,"_callOnDataChangeWhenSet",!1),null!=e&&(this._cacheSelectionReference=e.cacheSelectionReference,this._selectionReferences=e.selectionReferences)}var t=e.prototype;return t.getSelectionReferences=function(){return{cacheSelectionReference:this._cacheSelectionReference,selectionReferences:this._selectionReferences}},t.lookupInStore=function(e,t){return e.check(t.root)?(this._retainCachedOperation(e,t),e.lookup(t.fragment,t)):null},t.execute=function(e){var t=this,r=e.environment,n=e.operation,o=e.cacheConfig,a=e.preservePreviousReferences,u=void 0!==a&&a,c=r.retain(n.root),l=null!=o?{networkCacheConfig:o}:{},f=function(){t._selectionReferences=t._selectionReferences.concat(c)},p=function(){u||t.disposeSelectionReferences(),t._selectionReferences=t._selectionReferences.concat(c)},h=function(){t._selectionReferences=t._selectionReferences.concat(c)};return i(r)?s(r,n,l).do({error:f,complete:p,unsubscribe:h}):r.execute({operation:n,cacheConfig:o}).do({error:f,complete:p,unsubscribe:h})},t.setOnDataChange=function(e){this._fetchOptions||o(!1),"function"==typeof e&&(this._fetchOptions.onDataChangeCallbacks=this._fetchOptions.onDataChangeCallbacks||[],this._fetchOptions.onDataChangeCallbacks.push(e),this._callOnDataChangeWhenSet&&(null!=this._error?e({error:this._error}):null!=this._snapshot&&e({snapshot:this._snapshot})))},t.fetch=function(e){var t,r=this,n=e.cacheConfig,o=e.environment,a=e.operation,i=e.onDataChange,s=!1;this.disposeRequest();var u=this._fetchOptions&&this._fetchOptions.onDataChangeCallbacks;this._fetchOptions={cacheConfig:n,environment:o,onDataChangeCallbacks:u||[],operation:a},i&&-1===this._fetchOptions.onDataChangeCallbacks.indexOf(i)&&this._fetchOptions.onDataChangeCallbacks.push(i);var c=this.execute({environment:o,operation:a,cacheConfig:n}).finally(function(){r._pendingRequest=null}).subscribe({next:function(){r._callOnDataChangeWhenSet=!0,r._error=null,r._onQueryDataAvailable({notifyFirstResult:s})},error:function(e){r._callOnDataChangeWhenSet=!0,r._error=e,r._snapshot=null;var n=r._fetchOptions&&r._fetchOptions.onDataChangeCallbacks;s?n&&n.forEach(function(t){t({error:e})}):t=e}});if(this._pendingRequest={dispose:function(){c.unsubscribe()}},s=!0,t)throw t;return this._snapshot},t.retry=function(){return this._fetchOptions||o(!1),this.fetch({cacheConfig:this._fetchOptions.cacheConfig,environment:this._fetchOptions.environment,operation:this._fetchOptions.operation,onDataChange:null})},t.dispose=function(){this.disposeRequest(),this.disposeSelectionReferences()},t.disposeRequest=function(){this._error=null,this._snapshot=null,this._pendingRequest&&this._pendingRequest.dispose(),this._rootSubscription&&(this._rootSubscription.dispose(),this._rootSubscription=null)},t._retainCachedOperation=function(e,t){this._disposeCacheSelectionReference(),this._cacheSelectionReference=e.retain(t.root)},t._disposeCacheSelectionReference=function(){this._cacheSelectionReference&&this._cacheSelectionReference.dispose(),this._cacheSelectionReference=null},t.disposeSelectionReferences=function(){this._disposeCacheSelectionReference(),this._selectionReferences.forEach(function(e){return e.dispose()}),this._selectionReferences=[]},t._onQueryDataAvailable=function(e){var t=this,r=e.notifyFirstResult;this._fetchOptions||o(!1);var n=this._fetchOptions,a=n.environment,i=n.onDataChangeCallbacks,s=n.operation;if(!this._snapshot&&(this._snapshot=a.lookup(s.fragment,s),this._rootSubscription=a.subscribe(this._snapshot,function(e){if(null!=t._fetchOptions){var r=t._fetchOptions.onDataChangeCallbacks;Array.isArray(r)&&r.forEach(function(t){return t({snapshot:e})})}}),this._snapshot&&r&&Array.isArray(i))){var u=this._snapshot;i.forEach(function(e){return e({snapshot:u})})}},e}();e.exports=u},function(e,t){e.exports=o},function(e,t,r){"use strict";var n=r(3),o=r(18),a=r(24),i=r(26),s=r(27),u=r(1);e.exports={QueryRenderer:i,MutationTypes:u.MutationTypes,RangeOperations:u.RangeOperations,ReactRelayContext:n,applyOptimisticMutation:u.applyOptimisticMutation,commitLocalUpdate:u.commitLocalUpdate,commitMutation:u.commitMutation,createFragmentContainer:o.createContainer,createPaginationContainer:a.createContainer,createRefetchContainer:s.createContainer,fetchQuery:u.fetchQuery,graphql:u.graphql,requestSubscription:u.requestSubscription}},function(e,t,r){"use strict";var n=r(2),o=n(r(6)),a=n(r(10)),i=n(r(11)),s=n(r(7)),u=n(r(4)),c=r(0),l=r(8),f=r(12),p=r(9).getContainerName,h=r(14).assertRelayContext,v=r(1).isScalarAndEqual;function d(e,t){var r,n,f=p(e);return n=r=function(r){function n(e){var n;n=r.call(this,e)||this,(0,u.default)((0,i.default)(n),"_handleFragmentDataUpdate",function(){var e=n.state.resolver;n.setState(function(t){return e===t.resolver?{data:t.resolver.resolve(),relayProp:_(t.relayProp.environment)}:null})});var o=h(e.__relayContext),a=(0,o.environment.unstable_internal.createFragmentSpecResolver)(o,f,t,e);return n.state={data:a.resolve(),prevProps:e,prevPropsContext:o,relayProp:_(o.environment),resolver:a},n}(0,s.default)(n,r),n.getDerivedStateFromProps=function(e,r){var n=r.prevProps,o=h(e.__relayContext),a=o.environment.unstable_internal,i=a.createFragmentSpecResolver,s=a.getDataIDsFromObject,u=s(t,n),c=s(t,e),p=r.resolver;if(r.prevPropsContext.environment!==o.environment||r.prevPropsContext.variables!==o.variables||!l(u,c))return{data:(p=i(o,f,t,e)).resolve(),prevPropsContext:o,prevProps:e,relayProp:_(o.environment),resolver:p};p.setProps(e);var v=p.resolve();return v!==r.data?{data:v,prevProps:e,prevPropsContext:o,relayProp:_(o.environment)}:null};var p=n.prototype;return p.componentDidMount=function(){this._subscribeToNewResolver(),this._rerenderIfStoreHasChanged()},p.componentDidUpdate=function(e,t){this.state.resolver!==t.resolver&&(t.resolver.dispose(),this._subscribeToNewResolver()),this._rerenderIfStoreHasChanged()},p.componentWillUnmount=function(){this.state.resolver.dispose()},p.shouldComponentUpdate=function(e,r){if(r.data!==this.state.data)return!0;for(var n=Object.keys(e),o=0;o<n.length;o++){var a=n[o];if("__relayContext"===a){if(r.prevPropsContext.environment!==this.state.prevPropsContext.environment||r.prevPropsContext.variables!==this.state.prevPropsContext.variables)return!0}else if(!t.hasOwnProperty(a)&&!v(e[a],this.props[a]))return!0}return!1},p._rerenderIfStoreHasChanged=function(){var e=this.state,t=e.data,r=e.resolver.resolve();t!==r&&this.setState({data:r})},p._subscribeToNewResolver=function(){this.state.resolver.setCallback(this._handleFragmentDataUpdate)},p.render=function(){var t=this.props,r=t.componentRef,n=(t.__relayContext,(0,a.default)(t,["componentRef","__relayContext"]));return c.createElement(e,(0,o.default)({},n,this.state.data,{ref:r,relay:this.state.relayProp}))},n}(c.Component),(0,u.default)(r,"displayName",f),n}function _(e){return{environment:e}}e.exports={createContainer:function(e,t){return f(e,t,d)}}},function(e,t,r){"use strict";var n=r(5);e.exports=function(e,t){for(var r in t&&"object"==typeof t||n(!1),t)if(t.hasOwnProperty(r)){var o=t[r];(!o||"object"!=typeof o&&"function"!=typeof o)&&n(!1)}}},function(e,t){e.exports=a},function(e,t,r){"use strict";var n=r(0).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,o=n.ReactCurrentDispatcher,a=n.ReactCurrentOwner;e.exports=function(e){return(null!=o?o.current:a.currentDispatcher).readContext(e)}},function(e,t,r){"use strict";e.exports=function(e){return"object"==typeof e&&null!==e&&"function"==typeof e.check&&"function"==typeof e.lookup&&"function"==typeof e.retain&&"function"==typeof e.sendQuery&&"function"==typeof e.execute&&"function"==typeof e.subscribe}},function(e,t,r){"use strict";e.exports=function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}},function(e,t,r){"use strict";var n=r(2),o=n(r(13)),a=n(r(10)),i=n(r(11)),s=n(r(7)),u=n(r(4)),c=n(r(6)),l=r(0),f=r(3),p=r(15),h=r(8),v=r(12),d=r(25),_=r(5),b=(r(16),r(9)),y=b.getComponentName,m=b.getContainerName,C=r(14).assertRelayContext,g=r(1),x=g.ConnectionInterface,R=g.Observable,P=g.getFragmentOwners,S=g.isScalarAndEqual,O="forward";function F(e){return"function"==typeof e?{error:e,complete:e,unsubscribe:function(t){"function"==typeof e&&e()}}:e||{}}function q(e,t,r){y(e);var n,v,b=m(e),g=function(e){var t=null,r=!1;for(var n in e){var o=e[n],a=o.metadata&&o.metadata.connection;void 0!==o.metadata&&(r=!0),a&&(1!==a.length&&_(!1),t&&_(!1),t=(0,c.default)({},a[0],{fragmentName:n}))}return r&&null===t&&_(!1),t||{}}(t),q=r.getConnectionFromProps||function(e){var t=e.path;return t||_(!1),function(r){for(var n=r[e.fragmentName],o=0;o<t.length;o++){if(!n||"object"!=typeof n)return null;n=n[t[o]]}return n}}(g),D=r.direction||g.direction;D||_(!1);var j=r.getFragmentVariables||function(e){var t=e.count;return t||_(!1),function(e,r){return(0,c.default)({},e,(0,u.default)({},t,r))}}(g);return v=n=function(n){function v(e){var r;r=n.call(this,e)||this,(0,u.default)((0,i.default)(r),"_handleFragmentDataUpdate",function(){r.setState({data:r._resolver.resolve()})}),(0,u.default)((0,i.default)(r),"_hasMore",function(){var e=r._getConnectionData();return!!(e&&e.hasMore&&e.cursor)}),(0,u.default)((0,i.default)(r),"_isLoading",function(){return!!r._refetchSubscription}),(0,u.default)((0,i.default)(r),"_refetchConnection",function(e,t,n){if(!r._canFetchPage("refetchConnection"))return{dispose:function(){}};r._refetchVariables=n;var o={count:e,cursor:null,totalCount:e};return{dispose:r._fetchPage(o,F(t),{force:!0}).unsubscribe}}),(0,u.default)((0,i.default)(r),"_loadMore",function(e,t,n){if(!r._canFetchPage("loadMore"))return{dispose:function(){}};var o=F(t),a=r._getConnectionData();if(!a)return R.create(function(e){return e.complete()}).subscribe(o),null;var i=a.edgeCount+e;if(n&&n.force)return r._refetchConnection(i,t);var s=x.get(),u=(s.END_CURSOR,s.START_CURSOR,{count:e,cursor:a.cursor,totalCount:i});return{dispose:r._fetchPage(u,o,n).unsubscribe}});var o=C(e.__relayContext),a=o.environment.unstable_internal.createFragmentSpecResolver;return r._isARequestInFlight=!1,r._refetchSubscription=null,r._refetchVariables=null,r._resolver=a(o,b,t,e,r._handleFragmentDataUpdate),r.state={data:r._resolver.resolve(),prevContext:o,contextForChildren:o,relayProp:r._buildRelayProp(o)},r._isUnmounted=!1,r._hasFetched=!1,r}(0,s.default)(v,n);var y=v.prototype;return y.UNSAFE_componentWillReceiveProps=function(e){var r=C(e.__relayContext),n=r.environment.unstable_internal,o=n.createFragmentSpecResolver,a=n.getDataIDsFromObject,i=a(t,this.props),s=a(t,e);r.environment===this.state.prevContext.environment&&r.variables===this.state.prevContext.variables&&h(i,s)?this._hasFetched||this._resolver.setProps(e):(this._cleanup(),this._resolver=o(r,b,t,e,this._handleFragmentDataUpdate),this.setState({prevContext:r,contextForChildren:r,relayProp:this._buildRelayProp(r)}));var u=this._resolver.resolve();u!==this.state.data&&this.setState({data:u})},y.componentWillUnmount=function(){this._isUnmounted=!0,this._cleanup()},y.shouldComponentUpdate=function(e,r){if(r.data!==this.state.data||r.relayProp!==this.state.relayProp)return!0;for(var n=Object.keys(e),o=0;o<n.length;o++){var a=n[o];if("__relayContext"===a){if(r.prevContext.environment!==this.state.prevContext.environment||r.prevContext.variables!==this.state.prevContext.variables)return!0}else if(!t.hasOwnProperty(a)&&!S(e[a],this.props[a]))return!0}return!1},y._buildRelayProp=function(e){return{hasMore:this._hasMore,isLoading:this._isLoading,loadMore:this._loadMore,refetchConnection:this._refetchConnection,environment:e.environment}},y._getConnectionData=function(){var e=this.props,t=(e.componentRef,(0,a.default)(e,["componentRef"])),r=(0,c.default)({},t,this.state.data),n=q(r);if(null==n)return null;var o=x.get(),i=o.EDGES,s=o.PAGE_INFO,u=o.HAS_NEXT_PAGE,l=o.HAS_PREV_PAGE,f=o.END_CURSOR,p=o.START_CURSOR;"object"!=typeof n&&_(!1);var h=n[i],v=n[s];if(null==h||null==v)return null;Array.isArray(h)||_(!1),"object"!=typeof v&&_(!1);var d=D===O?v[u]:v[l],b=D===O?v[f]:v[p];return"boolean"!=typeof d||0!==h.length&&void 0===b?null:{cursor:b,edgeCount:h.length,hasMore:d}},y._getQueryFetcher=function(){return this._queryFetcher||(this._queryFetcher=new p),this._queryFetcher},y._canFetchPage=function(e){return!this._isUnmounted},y._fetchPage=function(e,n,o){var i,s,u=this,l=C(this.props.__relayContext).environment,f=l.unstable_internal,p=f.createOperationDescriptor,v=f.getRequest,b=f.getVariablesFromObject,y=this.props,m=(y.componentRef,y.__relayContext,(0,a.default)(y,["componentRef","__relayContext"])),g=(0,c.default)({},m,this.state.data),x=P(t,m);d(t,function(e,t){var r,n,o,a=x[t],s=Array.isArray(a)?null!==(r=null===(n=a[0])||void 0===n?void 0:n.variables)&&void 0!==r?r:{}:null!==(o=null==a?void 0:a.variables)&&void 0!==o?o:{};i=(0,c.default)({},i,s)}),s=b({},t,m,x),s=(0,c.default)({},i,s,this._refetchVariables);var S=r.getVariables(g,{count:e.count,cursor:e.cursor},s);("object"!=typeof S||null===S)&&_(!1),S=(0,c.default)({},S,this._refetchVariables),s=(0,c.default)({},S,s);var O=o?{force:!!o.force}:void 0,F=p(v(r.query),S),q=null;this._refetchSubscription&&this._refetchSubscription.unsubscribe(),this._hasFetched=!0;var D=function(){u._refetchSubscription===q&&(u._refetchSubscription=null,u._isARequestInFlight=!1)};return this._isARequestInFlight=!0,q=this._getQueryFetcher().execute({environment:l,operation:F,cacheConfig:O,preservePreviousReferences:!0}).mergeMap(function(t){return R.create(function(t){!function(t,r){var n=(0,c.default)({},u.props.__relayContext.variables,s),o=u._resolver.resolve();u._resolver.setVariables(j(s,e.totalCount),F.node);var a=u._resolver.resolve();h(o,a)?r():u.setState({data:a,contextForChildren:{environment:u.props.__relayContext.environment,variables:n}},r)}(0,function(){t.next(),t.complete()})})}).do({error:D,complete:D,unsubscribe:D}).subscribe(n||{}),this._refetchSubscription=this._isARequestInFlight?q:null,q},y._cleanup=function(){this._resolver.dispose(),this._refetchVariables=null,this._hasFetched=!1,this._refetchSubscription&&(this._refetchSubscription.unsubscribe(),this._refetchSubscription=null,this._isARequestInFlight=!1),this._queryFetcher&&this._queryFetcher.dispose()},y.render=function(){var t=this.props,r=t.componentRef,n=(t.__relayContext,(0,a.default)(t,["componentRef","__relayContext"]));return l.createElement(f.Provider,{value:this.state.contextForChildren},l.createElement(e,(0,o.default)({},n,this.state.data,{ref:r,relay:this.state.relayProp})))},v}(l.Component),(0,u.default)(n,"displayName",b),v}e.exports={createContainer:function(e,t,r){return v(e,t,function(e,t){return q(e,t,r)})}}},function(e,t){e.exports=i},function(e,t,r){"use strict";var n=r(2),o=n(r(6)),a=n(r(7)),i=r(0),s=r(3),u=r(15),c=r(8),l=(r(1).deepFreeze,{}),f="STORE_THEN_NETWORK",p=function(e){function t(t){var r;r=e.call(this,t)||this;var n,a,i={handleDataChange:null,handleRetryAfterError:null};if(t.query){var s=t.query;a=d((0,t.environment.unstable_internal.getRequest)(s).params,t.variables),n=l[a]?l[a].queryFetcher:new u}else n=new u;return r.state=(0,o.default)({prevPropsEnvironment:t.environment,prevPropsVariables:t.variables,prevQuery:t.query,queryFetcher:n,retryCallbacks:i},_(t,n,i,a)),r}(0,a.default)(t,e),t.getDerivedStateFromProps=function(e,t){if(t.prevQuery!==e.query||t.prevPropsEnvironment!==e.environment||!c(t.prevPropsVariables,e.variables)){var r,n=e.query,a=t.queryFetcher.getSelectionReferences();if(t.queryFetcher.disposeRequest(),n){var i=d((0,e.environment.unstable_internal.getRequest)(n).params,e.variables);r=l[i]?l[i].queryFetcher:new u(a)}else r=new u(a);return(0,o.default)({prevQuery:e.query,prevPropsEnvironment:e.environment,prevPropsVariables:e.variables,queryFetcher:r},_(e,r,t.retryCallbacks))}return null};var r=t.prototype;return r.componentDidMount=function(){var e=this,t=this.state,r=t.retryCallbacks,n=t.queryFetcher,o=t.requestCacheKey;o&&delete l[o],r.handleDataChange=function(t){var r=null==t.error?null:t.error,n=null==t.snapshot?null:t.snapshot;e.setState(function(e){var t=e.requestCacheKey;return t&&delete l[t],n===e.snapshot&&r===e.error?null:{renderProps:v(r,n,e.queryFetcher,e.retryCallbacks),snapshot:n,requestCacheKey:null}})},r.handleRetryAfterError=function(t){return e.setState(function(e){var t=e.requestCacheKey;return t&&delete l[t],{renderProps:{error:null,props:null,retry:null},requestCacheKey:null}})},this.props.query&&n.setOnDataChange(r.handleDataChange)},r.componentDidUpdate=function(){var e=this.state.requestCacheKey;e&&(delete l[e],delete this.state.requestCacheKey)},r.componentWillUnmount=function(){this.state.queryFetcher.dispose()},r.shouldComponentUpdate=function(e,t){return e.render!==this.props.render||t.renderProps!==this.state.renderProps},r.render=function(){var e=this.state,t=e.renderProps,r=e.relayContext;return i.createElement(s.Provider,{value:r},this.props.render(t))},t}(i.Component);function h(e,t){return{environment:e,variables:t}}function v(e,t,r,n){return{error:e||null,props:t?t.data:null,retry:function(){var t=r.retry();t&&"function"==typeof n.handleDataChange?n.handleDataChange({snapshot:t}):e&&"function"==typeof n.handleRetryAfterError&&n.handleRetryAfterError(e)}}}function d(e,t){var r=e.id||e.text;return JSON.stringify({id:String(r),variables:t})}function _(e,t,r,n){var o=e.environment,a=e.query,i=e.variables,s=o;if(!a)return t.dispose(),{error:null,relayContext:h(s,i),renderProps:{error:null,props:{},retry:null},requestCacheKey:null};var u=s.unstable_internal,c=u.createOperationDescriptor,p=(0,u.getRequest)(a),_=c(p,i),b=h(s,_.variables);if("string"==typeof n&&l[n]){var y=l[n].snapshot;return y?{error:null,relayContext:b,renderProps:v(null,y,t,r),snapshot:y,requestCacheKey:n}:{error:null,relayContext:b,renderProps:{error:null,props:null,retry:null},snapshot:null,requestCacheKey:n}}try{var m=e.dataFrom===f?t.lookupInStore(s,_):null,C=t.fetch({cacheConfig:e.cacheConfig,dataFrom:e.dataFrom,environment:s,onDataChange:r.handleDataChange,operation:_})||m;return n=n||d(p.params,e.variables),l[n]={queryFetcher:t,snapshot:C},C?{error:null,relayContext:b,renderProps:v(null,C,t,r),snapshot:C,requestCacheKey:n}:{error:null,relayContext:b,renderProps:{error:null,props:null,retry:null},snapshot:null,requestCacheKey:n}}catch(e){return{error:e,relayContext:b,renderProps:v(e,null,t,r),snapshot:null,requestCacheKey:n}}}e.exports=p},function(e,t,r){"use strict";var n=r(2),o=n(r(13)),a=n(r(10)),i=n(r(6)),s=n(r(11)),u=n(r(7)),c=n(r(4)),l=r(0),f=r(3),p=r(15),h=r(8),v=r(12),d=(r(16),r(9).getContainerName),_=r(14).assertRelayContext,b=r(1),y=b.Observable,m=b.getFragmentOwners,C=b.isScalarAndEqual;function g(e,t){return{environment:e,refetch:t}}e.exports={createContainer:function(e,t,r){return v(e,t,function(e,t){return function(e,t,r){var n,v,b=d(e);return v=n=function(n){function v(e){var o;o=n.call(this,e)||this,(0,c.default)((0,s.default)(o),"_handleFragmentDataUpdate",function(){var e=o.state.resolver;o.setState(function(t){return e===t.resolver?{data:t.resolver.resolve()}:null})}),(0,c.default)((0,s.default)(o),"_refetch",function(e,t,n,a){if(o._isUnmounted)return{dispose:function(){}};var s=_(o.props.__relayContext),u=s.environment,c=s.variables,l="function"==typeof e?e(o._getFragmentVariables()):e;l=(0,i.default)({},c,l);var f,p=t?(0,i.default)({},l,t):l,h=a?{force:!!a.force}:void 0,v="function"==typeof n?{next:n,error:n}:n||{},d=o.props.__relayContext.environment.unstable_internal,b=(0,d.createOperationDescriptor)((0,d.getRequest)(r),l);return o.state.localVariables=l,o._refetchSubscription&&o._refetchSubscription.unsubscribe(),"store-or-network"===(null==a?void 0:a.fetchPolicy)&&null!=o._getQueryFetcher().lookupInStore(u,b)?(o.state.resolver.setVariables(p,b.node),o.setState(function(e){return{data:e.resolver.resolve(),contextForChildren:{environment:o.props.__relayContext.environment,variables:p}}},function(){v.next&&v.next(),v.complete&&v.complete()}),{dispose:function(){}}):(o._getQueryFetcher().execute({environment:u,operation:b,cacheConfig:h,preservePreviousReferences:!0}).mergeMap(function(e){return o.state.resolver.setVariables(p,b.node),y.create(function(e){return o.setState(function(e){return{data:e.resolver.resolve(),contextForChildren:{environment:o.props.__relayContext.environment,variables:p}}},function(){e.next(),e.complete()})})}).finally(function(){o._refetchSubscription===f&&(o._refetchSubscription=null)}).subscribe((0,i.default)({},v,{start:function(e){o._refetchSubscription=f=e,v.start&&v.start(e)}})),{dispose:function(){f&&f.unsubscribe()}})});var a=_(e.__relayContext);o._refetchSubscription=null;var u=(0,a.environment.unstable_internal.createFragmentSpecResolver)(a,b,t,e);return o.state={data:u.resolve(),localVariables:null,prevProps:e,prevPropsContext:a,contextForChildren:a,relayProp:g(a.environment,o._refetch),resolver:u},o._isUnmounted=!1,o}(0,u.default)(v,n);var d=v.prototype;return d.componentDidMount=function(){this._subscribeToNewResolver()},d.componentDidUpdate=function(e,t){this.state.resolver!==t.resolver&&(t.resolver.dispose(),this._queryFetcher&&this._queryFetcher.dispose(),this._refetchSubscription&&this._refetchSubscription.unsubscribe(),this._subscribeToNewResolver())},v.getDerivedStateFromProps=function(e,r){var n=r.prevProps,o=_(e.__relayContext),a=o.environment.unstable_internal,i=a.createFragmentSpecResolver,s=a.getDataIDsFromObject,u=s(t,n),c=s(t,e),l=r.resolver;if(r.prevPropsContext.environment!==o.environment||r.prevPropsContext.variables!==o.variables||!h(u,c))return{data:(l=i(o,b,t,e)).resolve(),localVariables:null,prevProps:e,prevPropsContext:o,contextForChildren:o,relayProp:g(o.environment,r.relayProp.refetch),resolver:l};r.localVariables||l.setProps(e);var f=l.resolve();return f!==r.data?{data:f,prevProps:e}:null},d.componentWillUnmount=function(){this._isUnmounted=!0,this.state.resolver.dispose(),this._queryFetcher&&this._queryFetcher.dispose(),this._refetchSubscription&&this._refetchSubscription.unsubscribe()},d.shouldComponentUpdate=function(e,r){if(r.data!==this.state.data||r.relayProp!==this.state.relayProp)return!0;for(var n=Object.keys(e),o=0;o<n.length;o++){var a=n[o];if("__relayContext"===a){if(this.state.prevPropsContext.environment!==r.prevPropsContext.environment||this.state.prevPropsContext.variables!==r.prevPropsContext.variables)return!0}else if(!t.hasOwnProperty(a)&&!C(e[a],this.props[a]))return!0}return!1},d._subscribeToNewResolver=function(){var e=this.state,t=e.data,r=e.resolver;r.setCallback(this._handleFragmentDataUpdate);var n=r.resolve();t!==n&&this.setState({data:n})},d._getFragmentVariables=function(){return(0,this.props.__relayContext.environment.unstable_internal.getVariablesFromObject)({},t,this.props,m(t,this.props))},d._getQueryFetcher=function(){return this._queryFetcher||(this._queryFetcher=new p),this._queryFetcher},d.render=function(){var t=this.props,r=t.componentRef,n=(t.__relayContext,(0,a.default)(t,["componentRef","__relayContext"])),i=this.state,s=i.relayProp,u=i.contextForChildren;return l.createElement(f.Provider,{value:u},l.createElement(e,(0,o.default)({},n,this.state.data,{ref:r,relay:s})))},v}(l.Component),(0,c.default)(n,"displayName",b),v}(e,t,r)})}}}])});
|