relay-runtime 1.7.0-rc.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/index.js +1 -1
- package/lib/ConvertToExecuteFunction.js +12 -75
- package/lib/DataChecker.js +400 -0
- package/lib/NormalizationNode.js +14 -0
- package/lib/ReaderNode.js +10 -0
- package/lib/RelayCombinedEnvironmentTypes.js +10 -0
- package/lib/RelayConcreteNode.js +12 -29
- package/lib/RelayConcreteVariables.js +17 -11
- package/lib/RelayConnectionHandler.js +98 -42
- package/lib/RelayConnectionInterface.js +5 -13
- package/lib/RelayCore.js +17 -14
- package/lib/RelayDeclarativeMutationConfig.js +69 -34
- package/lib/RelayDefaultHandleKey.js +1 -2
- package/lib/RelayDefaultHandlerProvider.js +6 -5
- package/lib/RelayError.js +6 -9
- package/lib/RelayInMemoryRecordSource.js +20 -22
- package/lib/RelayModernEnvironment.js +140 -229
- package/lib/RelayModernFragmentSpecResolver.js +110 -102
- package/lib/RelayModernGraphQLTag.js +53 -15
- package/lib/{RelayModernOperationSelector.js → RelayModernOperationDescriptor.js} +9 -8
- package/lib/RelayModernQueryExecutor.js +172 -0
- package/lib/RelayModernRecord.js +97 -38
- package/lib/RelayModernSelector.js +89 -33
- package/lib/RelayModernStore.js +301 -0
- package/lib/RelayNetwork.js +16 -28
- package/lib/RelayNetworkLogger.js +2 -3
- package/lib/RelayNetworkLoggerTransaction.js +32 -30
- package/lib/RelayNetworkTypes.js +1 -2
- package/lib/RelayObservable.js +127 -155
- package/lib/RelayProfiler.js +35 -22
- package/lib/RelayPublishQueue.js +144 -96
- package/lib/RelayQueryResponseCache.js +37 -21
- package/lib/RelayReader.js +194 -61
- package/lib/RelayRecordProxy.js +50 -31
- package/lib/RelayRecordSourceMutator.js +92 -51
- package/lib/RelayRecordSourceProxy.js +43 -35
- package/lib/RelayRecordSourceSelectorProxy.js +22 -21
- package/lib/RelayRecordState.js +1 -3
- package/lib/RelayReferenceMarker.js +110 -37
- package/lib/RelayResponseNormalizer.js +248 -82
- package/lib/RelayRuntimeTypes.js +1 -3
- package/lib/RelayStoreTypes.js +1 -2
- package/lib/RelayStoreUtils.js +37 -19
- package/lib/RelayViewerHandler.js +14 -10
- package/lib/applyRelayModernOptimisticMutation.js +8 -8
- package/lib/cloneRelayHandleSourceField.js +8 -9
- package/lib/commitLocalUpdate.js +1 -2
- package/lib/commitRelayModernMutation.js +21 -14
- package/lib/createRelayNetworkLogger.js +11 -9
- package/lib/deepFreeze.js +2 -3
- package/lib/fetchRelayModernQuery.js +10 -12
- package/lib/generateRelayClientID.js +4 -2
- package/lib/getRelayHandleKey.js +5 -6
- package/lib/hasOverlappingIDs.js +3 -2
- package/lib/index.js +59 -62
- package/lib/isPromise.js +1 -2
- package/lib/isRelayModernEnvironment.js +1 -3
- package/lib/isScalarAndEqual.js +1 -3
- package/lib/normalizePayload.js +17 -15
- package/lib/normalizeRelayPayload.js +9 -9
- package/lib/recycleNodesInto.js +25 -9
- package/lib/requestRelaySubscription.js +25 -58
- package/lib/simpleClone.js +2 -3
- package/lib/stableCopy.js +5 -3
- package/lib/validateMutation.js +146 -0
- package/package.json +3 -3
- package/relay-runtime.js +4 -0
- package/relay-runtime.min.js +9 -0
- package/lib/RelayDataLoader.js +0 -302
- package/lib/RelayMarkSweepStore.js +0 -242
- package/lib/deferrableFragmentKey.js +0 -20
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -7,14 +7,11 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
10
|
'use strict';
|
|
12
11
|
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
var _toConsumableArray3 = _interopRequireDefault(require('babel-runtime/helpers/toConsumableArray'));
|
|
12
|
+
var _defineProperty2 = require("@babel/runtime/helpers/interopRequireDefault")(require("@babel/runtime/helpers/defineProperty"));
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
var _toConsumableArray2 = require("@babel/runtime/helpers/interopRequireDefault")(require("@babel/runtime/helpers/toConsumableArray"));
|
|
18
15
|
|
|
19
16
|
var queryID = 1;
|
|
20
17
|
|
|
@@ -25,16 +22,16 @@ var queryID = 1;
|
|
|
25
22
|
* `console.log`. Another might ping a logging endpoint. Another might add some
|
|
26
23
|
* autogenerated logs before doing either of the foregoing.
|
|
27
24
|
*/
|
|
28
|
-
var RelayNetworkLoggerTransaction =
|
|
25
|
+
var RelayNetworkLoggerTransaction =
|
|
26
|
+
/*#__PURE__*/
|
|
27
|
+
function () {
|
|
29
28
|
function RelayNetworkLoggerTransaction(_ref) {
|
|
30
29
|
var request = _ref.request,
|
|
31
30
|
variables = _ref.variables,
|
|
32
31
|
cacheConfig = _ref.cacheConfig,
|
|
33
32
|
uploadables = _ref.uploadables;
|
|
34
|
-
(0,
|
|
35
|
-
this
|
|
36
|
-
this._logs = [];
|
|
37
|
-
|
|
33
|
+
(0, _defineProperty2["default"])(this, "_hasCommittedLogs", false);
|
|
34
|
+
(0, _defineProperty2["default"])(this, "_logs", []);
|
|
38
35
|
this._cacheConfig = cacheConfig;
|
|
39
36
|
this._id = queryID++;
|
|
40
37
|
this._request = request;
|
|
@@ -42,22 +39,27 @@ var RelayNetworkLoggerTransaction = function () {
|
|
|
42
39
|
this._variables = variables;
|
|
43
40
|
}
|
|
44
41
|
|
|
45
|
-
RelayNetworkLoggerTransaction.prototype
|
|
46
|
-
|
|
42
|
+
var _proto = RelayNetworkLoggerTransaction.prototype;
|
|
43
|
+
|
|
44
|
+
_proto.addLog = function addLog(label) {
|
|
45
|
+
for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
47
46
|
values[_key - 1] = arguments[_key];
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
this._logs.push({
|
|
49
|
+
this._logs.push({
|
|
50
|
+
label: label,
|
|
51
|
+
values: values
|
|
52
|
+
});
|
|
51
53
|
};
|
|
52
54
|
|
|
53
|
-
|
|
55
|
+
_proto.clearLogs = function clearLogs() {
|
|
54
56
|
this._logs = [];
|
|
55
57
|
};
|
|
56
58
|
|
|
57
|
-
|
|
59
|
+
_proto.printLogs = function printLogs(error, payload, status) {
|
|
58
60
|
/* eslint-disable no-console */
|
|
59
61
|
var transactionId = this.getIdentifier();
|
|
60
|
-
console.groupCollapsed && console.groupCollapsed(
|
|
62
|
+
console.groupCollapsed && console.groupCollapsed("%c".concat(transactionId), error ? 'color:red' : '');
|
|
61
63
|
console.timeEnd && console.timeEnd(transactionId);
|
|
62
64
|
this.getLogsToPrint(error, payload, status).forEach(function (_ref2) {
|
|
63
65
|
var _console;
|
|
@@ -65,49 +67,49 @@ var RelayNetworkLoggerTransaction = function () {
|
|
|
65
67
|
var label = _ref2.label,
|
|
66
68
|
values = _ref2.values;
|
|
67
69
|
|
|
68
|
-
(_console = console).log.apply(_console, [label
|
|
70
|
+
(_console = console).log.apply(_console, ["".concat(label, ":")].concat((0, _toConsumableArray2["default"])(values)));
|
|
69
71
|
});
|
|
70
72
|
console.groupEnd && console.groupEnd();
|
|
71
73
|
/* eslint-enable no-console */
|
|
72
74
|
};
|
|
73
75
|
|
|
74
|
-
|
|
75
|
-
!(this._hasCommittedLogs === false) ? process.env.NODE_ENV !==
|
|
76
|
+
_proto.commitLogs = function commitLogs(error, payload, status) {
|
|
77
|
+
!(this._hasCommittedLogs === false) ? process.env.NODE_ENV !== "production" ? require("fbjs/lib/invariant")(false, "The logs for transaction #".concat(this._id, " have already been committed.")) : require("fbjs/lib/invariant")(false) : void 0;
|
|
76
78
|
this.printLogs(error, payload, status);
|
|
77
79
|
this.markCommitted();
|
|
78
80
|
};
|
|
79
81
|
|
|
80
|
-
|
|
82
|
+
_proto.markCommitted = function markCommitted() {
|
|
81
83
|
this._hasCommittedLogs = true;
|
|
82
84
|
};
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
!(this._hasCommittedLogs === false) ? process.env.NODE_ENV !==
|
|
86
|
+
_proto.flushLogs = function flushLogs(error, payload, status) {
|
|
87
|
+
!(this._hasCommittedLogs === false) ? process.env.NODE_ENV !== "production" ? require("fbjs/lib/invariant")(false, "The logs for transaction #".concat(this._id, " have already been committed.")) : require("fbjs/lib/invariant")(false) : void 0;
|
|
86
88
|
this.printLogs(error, payload, status);
|
|
87
89
|
this.clearLogs();
|
|
88
90
|
};
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
_proto.getCacheConfig = function getCacheConfig() {
|
|
91
93
|
return this._cacheConfig;
|
|
92
94
|
};
|
|
93
95
|
|
|
94
|
-
|
|
95
|
-
return
|
|
96
|
+
_proto.getIdentifier = function getIdentifier() {
|
|
97
|
+
return "[".concat(this._id, "] Relay Modern: ").concat(this._request.name);
|
|
96
98
|
};
|
|
97
99
|
|
|
98
|
-
|
|
100
|
+
_proto.getLogsToPrint = function getLogsToPrint(error, payload, status) {
|
|
99
101
|
return this._logs;
|
|
100
102
|
};
|
|
101
103
|
|
|
102
|
-
|
|
104
|
+
_proto.getRequest = function getRequest() {
|
|
103
105
|
return this._request;
|
|
104
106
|
};
|
|
105
107
|
|
|
106
|
-
|
|
108
|
+
_proto.getUploadables = function getUploadables() {
|
|
107
109
|
return this._uploadables;
|
|
108
110
|
};
|
|
109
111
|
|
|
110
|
-
|
|
112
|
+
_proto.getVariables = function getVariables() {
|
|
111
113
|
return this._variables;
|
|
112
114
|
};
|
|
113
115
|
|
package/lib/RelayNetworkTypes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -7,5 +7,4 @@
|
|
|
7
7
|
* strict-local
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
10
|
'use strict';
|