relay-runtime 1.3.0 → 1.5.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 +16 -26
- package/index.js +3 -6
- package/lib/ConvertToExecuteFunction.js +73 -0
- package/lib/RelayConcreteNode.js +31 -14
- package/lib/RelayConcreteVariables.js +11 -6
- package/lib/RelayConnectionHandler.js +2 -4
- package/lib/RelayConnectionInterface.js +3 -5
- package/lib/RelayCore.js +4 -6
- package/lib/RelayDataLoader.js +2 -4
- package/lib/RelayDeclarativeMutationConfig.js +316 -0
- package/lib/RelayDefaultHandleKey.js +2 -4
- package/lib/RelayDefaultHandlerProvider.js +2 -4
- package/lib/RelayError.js +2 -6
- package/lib/RelayInMemoryRecordSource.js +2 -4
- package/lib/RelayInternalTypes.js +2 -5
- package/lib/RelayInternals.js +2 -5
- package/lib/RelayMarkSweepStore.js +22 -5
- package/lib/RelayMetricsRecorder.js +9 -9
- package/lib/RelayMockRenderer.js +3 -8
- package/lib/RelayModernEnvironment.js +120 -135
- package/lib/RelayModernFragmentSpecResolver.js +81 -55
- package/lib/RelayModernGraphQLTag.js +8 -17
- package/lib/RelayModernOperationSelector.js +8 -8
- package/lib/RelayModernRecord.js +8 -8
- package/lib/RelayModernSelector.js +54 -43
- package/lib/RelayNetwork.js +9 -11
- package/lib/RelayNetworkDebug.js +4 -7
- package/lib/RelayNetworkLogger.js +2 -4
- package/lib/RelayNetworkLoggerTransaction.js +18 -20
- package/lib/RelayNetworkTypes.js +2 -4
- package/lib/RelayObservable.js +193 -120
- package/lib/RelayProfiler.js +7 -7
- package/lib/RelayPublishQueue.js +17 -9
- package/lib/RelayQueryCaching.js +2 -5
- package/lib/RelayQueryResponseCache.js +3 -5
- package/lib/RelayReader.js +18 -8
- package/lib/RelayRecordProxy.js +12 -11
- package/lib/RelayRecordSourceMutator.js +9 -9
- package/lib/RelayRecordSourceProxy.js +15 -13
- package/lib/RelayRecordSourceSelectorProxy.js +2 -4
- package/lib/RelayRecordState.js +2 -4
- package/lib/RelayReferenceMarker.js +2 -4
- package/lib/RelayResponseNormalizer.js +34 -25
- package/lib/RelayRuntime.js +25 -14
- package/lib/RelayRuntimeTypes.js +22 -0
- package/lib/RelayShallowMock.js +4 -7
- package/lib/RelayStoreTypes.js +2 -4
- package/lib/RelayStoreUtils.js +66 -26
- package/lib/RelayTaskQueue.js +2 -5
- package/lib/RelayTypes.js +2 -5
- package/lib/RelayViewerHandler.js +4 -5
- package/lib/applyRelayModernOptimisticMutation.js +9 -8
- package/lib/cloneRelayHandleSourceField.js +4 -11
- package/lib/commitLocalUpdate.js +2 -4
- package/lib/commitRelayModernMutation.js +24 -22
- package/lib/createRelayNetworkLogger.js +25 -27
- package/lib/dedent.js +2 -5
- package/lib/deepFreeze.js +3 -5
- package/lib/deferrableFragmentKey.js +21 -0
- package/lib/fetchRelayModernQuery.js +13 -21
- package/lib/generateRelayClientID.js +2 -4
- package/lib/getRelayHandleKey.js +2 -4
- package/lib/hasOverlappingIDs.js +2 -4
- package/lib/isCompatibleRelayFragmentType.js +2 -5
- package/lib/isPromise.js +2 -5
- package/lib/isRelayModernEnvironment.js +2 -4
- package/lib/isScalarAndEqual.js +3 -5
- package/lib/normalizePayload.js +10 -13
- package/lib/normalizeRelayPayload.js +8 -5
- package/lib/recycleNodesInto.js +2 -4
- package/lib/relayUnstableBatchedUpdates.js +2 -5
- package/lib/relayUnstableBatchedUpdates.native.js +2 -5
- package/lib/requestRelaySubscription.js +20 -34
- package/lib/simpleClone.js +2 -4
- package/lib/stableCopy.js +35 -0
- package/lib/testEditDistance.js +2 -5
- package/lib/throwFailedPromise.js +2 -5
- package/package.json +4 -5
- package/relay-runtime.js +2307 -2665
- package/relay-runtime.min.js +6 -9
- package/ARCHITECTURE.md +0 -232
- package/PATENTS +0 -33
- package/lib/ConvertToObserveFunction.js +0 -39
- package/lib/RelayDebugger.js +0 -199
- package/lib/RelayRecordSourceInspector.js +0 -289
- package/lib/RelayStoreProxyDebugger.js +0 -44
- package/lib/formatStorageKey.js +0 -37
- package/lib/prettyStringify.js +0 -35
- package/lib/setRelayModernMutationConfigs.js +0 -302
- package/lib/stableJSONStringify.js +0 -45
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
3
|
*
|
|
5
|
-
* This source code is licensed under the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
6
|
*
|
|
9
7
|
* @providesModule RelayNetworkLoggerTransaction
|
|
10
8
|
*
|
|
@@ -13,8 +11,6 @@
|
|
|
13
11
|
|
|
14
12
|
'use strict';
|
|
15
13
|
|
|
16
|
-
/* eslint-disable no-console-disallow */
|
|
17
|
-
|
|
18
14
|
var _classCallCheck3 = _interopRequireDefault(require('babel-runtime/helpers/classCallCheck'));
|
|
19
15
|
|
|
20
16
|
var _toConsumableArray3 = _interopRequireDefault(require('babel-runtime/helpers/toConsumableArray'));
|
|
@@ -32,7 +28,7 @@ var queryID = 1;
|
|
|
32
28
|
*/
|
|
33
29
|
var RelayNetworkLoggerTransaction = function () {
|
|
34
30
|
function RelayNetworkLoggerTransaction(_ref) {
|
|
35
|
-
var
|
|
31
|
+
var request = _ref.request,
|
|
36
32
|
variables = _ref.variables,
|
|
37
33
|
cacheConfig = _ref.cacheConfig,
|
|
38
34
|
uploadables = _ref.uploadables;
|
|
@@ -42,7 +38,7 @@ var RelayNetworkLoggerTransaction = function () {
|
|
|
42
38
|
|
|
43
39
|
this._cacheConfig = cacheConfig;
|
|
44
40
|
this._id = queryID++;
|
|
45
|
-
this.
|
|
41
|
+
this._request = request;
|
|
46
42
|
this._uploadables = uploadables;
|
|
47
43
|
this._variables = variables;
|
|
48
44
|
}
|
|
@@ -59,11 +55,12 @@ var RelayNetworkLoggerTransaction = function () {
|
|
|
59
55
|
this._logs = [];
|
|
60
56
|
};
|
|
61
57
|
|
|
62
|
-
RelayNetworkLoggerTransaction.prototype.printLogs = function printLogs(error,
|
|
58
|
+
RelayNetworkLoggerTransaction.prototype.printLogs = function printLogs(error, payload, status) {
|
|
59
|
+
/* eslint-disable no-console */
|
|
63
60
|
var transactionId = this.getIdentifier();
|
|
64
|
-
console.groupCollapsed('%c' + transactionId, error ? 'color:red' : '');
|
|
61
|
+
console.groupCollapsed && console.groupCollapsed('%c' + transactionId, error ? 'color:red' : '');
|
|
65
62
|
console.timeEnd && console.timeEnd(transactionId);
|
|
66
|
-
this.getLogsToPrint(error,
|
|
63
|
+
this.getLogsToPrint(error, payload, status).forEach(function (_ref2) {
|
|
67
64
|
var _console;
|
|
68
65
|
|
|
69
66
|
var label = _ref2.label,
|
|
@@ -71,12 +68,13 @@ var RelayNetworkLoggerTransaction = function () {
|
|
|
71
68
|
|
|
72
69
|
(_console = console).log.apply(_console, [label + ':'].concat((0, _toConsumableArray3['default'])(values)));
|
|
73
70
|
});
|
|
74
|
-
console.groupEnd();
|
|
71
|
+
console.groupEnd && console.groupEnd();
|
|
72
|
+
/* eslint-enable no-console */
|
|
75
73
|
};
|
|
76
74
|
|
|
77
|
-
RelayNetworkLoggerTransaction.prototype.commitLogs = function commitLogs(error,
|
|
75
|
+
RelayNetworkLoggerTransaction.prototype.commitLogs = function commitLogs(error, payload, status) {
|
|
78
76
|
require('fbjs/lib/invariant')(this._hasCommittedLogs === false, 'The logs for transaction #' + this._id + ' have already been committed.');
|
|
79
|
-
this.printLogs(error,
|
|
77
|
+
this.printLogs(error, payload, status);
|
|
80
78
|
this.markCommitted();
|
|
81
79
|
};
|
|
82
80
|
|
|
@@ -84,9 +82,9 @@ var RelayNetworkLoggerTransaction = function () {
|
|
|
84
82
|
this._hasCommittedLogs = true;
|
|
85
83
|
};
|
|
86
84
|
|
|
87
|
-
RelayNetworkLoggerTransaction.prototype.flushLogs = function flushLogs(error,
|
|
85
|
+
RelayNetworkLoggerTransaction.prototype.flushLogs = function flushLogs(error, payload, status) {
|
|
88
86
|
require('fbjs/lib/invariant')(this._hasCommittedLogs === false, 'The logs for transaction #' + this._id + ' have already been committed.');
|
|
89
|
-
this.printLogs(error,
|
|
87
|
+
this.printLogs(error, payload, status);
|
|
90
88
|
this.clearLogs();
|
|
91
89
|
};
|
|
92
90
|
|
|
@@ -95,15 +93,15 @@ var RelayNetworkLoggerTransaction = function () {
|
|
|
95
93
|
};
|
|
96
94
|
|
|
97
95
|
RelayNetworkLoggerTransaction.prototype.getIdentifier = function getIdentifier() {
|
|
98
|
-
return '[' + this._id + '] Relay Modern: ' + this.
|
|
96
|
+
return '[' + this._id + '] Relay Modern: ' + this._request.name;
|
|
99
97
|
};
|
|
100
98
|
|
|
101
|
-
RelayNetworkLoggerTransaction.prototype.getLogsToPrint = function getLogsToPrint(error,
|
|
99
|
+
RelayNetworkLoggerTransaction.prototype.getLogsToPrint = function getLogsToPrint(error, payload, status) {
|
|
102
100
|
return this._logs;
|
|
103
101
|
};
|
|
104
102
|
|
|
105
|
-
RelayNetworkLoggerTransaction.prototype.
|
|
106
|
-
return this.
|
|
103
|
+
RelayNetworkLoggerTransaction.prototype.getRequest = function getRequest() {
|
|
104
|
+
return this._request;
|
|
107
105
|
};
|
|
108
106
|
|
|
109
107
|
RelayNetworkLoggerTransaction.prototype.getUploadables = function getUploadables() {
|
package/lib/RelayNetworkTypes.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
3
|
*
|
|
5
|
-
* This source code is licensed under the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
6
|
*
|
|
9
7
|
* @providesModule RelayNetworkTypes
|
|
10
8
|
*
|