relay-runtime 0.0.0-main-b6c6b7d2 → 0.0.0-main-dcf2098c
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/index.js +1 -1
- package/index.js.flow +2 -0
- package/lib/index.js +3 -0
- package/lib/query/fetchQuery.js +3 -0
- package/lib/store/ResolverFragments.js +2 -2
- package/package.json +1 -1
- package/query/fetchQuery.js.flow +9 -7
- package/relay-runtime.js +2 -2
- package/relay-runtime.min.js +2 -2
- package/store/ResolverFragments.js.flow +2 -2
package/index.js
CHANGED
package/index.js.flow
CHANGED
|
@@ -46,6 +46,7 @@ const RelayModernStore = require('./store/RelayModernStore');
|
|
|
46
46
|
const RelayOperationTracker = require('./store/RelayOperationTracker');
|
|
47
47
|
const RelayRecordSource = require('./store/RelayRecordSource');
|
|
48
48
|
const RelayStoreUtils = require('./store/RelayStoreUtils');
|
|
49
|
+
const ResolverFragments = require('./store/ResolverFragments');
|
|
49
50
|
const ViewerPattern = require('./store/ViewerPattern');
|
|
50
51
|
const requestSubscription = require('./subscription/requestSubscription');
|
|
51
52
|
const createPayloadFor3DField = require('./util/createPayloadFor3DField');
|
|
@@ -352,6 +353,7 @@ module.exports = {
|
|
|
352
353
|
getPendingOperationsForFragment: getPendingOperationsForFragment,
|
|
353
354
|
getValueAtPath: getValueAtPath,
|
|
354
355
|
__internal: {
|
|
356
|
+
ResolverFragments,
|
|
355
357
|
OperationTracker: RelayOperationTracker,
|
|
356
358
|
createRelayContext: createRelayContext,
|
|
357
359
|
getOperationVariables: RelayConcreteVariables.getOperationVariables,
|
package/lib/index.js
CHANGED
|
@@ -73,6 +73,8 @@ var RelayRecordSource = require('./store/RelayRecordSource');
|
|
|
73
73
|
|
|
74
74
|
var RelayStoreUtils = require('./store/RelayStoreUtils');
|
|
75
75
|
|
|
76
|
+
var ResolverFragments = require('./store/ResolverFragments');
|
|
77
|
+
|
|
76
78
|
var ViewerPattern = require('./store/ViewerPattern');
|
|
77
79
|
|
|
78
80
|
var requestSubscription = require('./subscription/requestSubscription');
|
|
@@ -230,6 +232,7 @@ module.exports = {
|
|
|
230
232
|
getPendingOperationsForFragment: getPendingOperationsForFragment,
|
|
231
233
|
getValueAtPath: getValueAtPath,
|
|
232
234
|
__internal: {
|
|
235
|
+
ResolverFragments: ResolverFragments,
|
|
233
236
|
OperationTracker: RelayOperationTracker,
|
|
234
237
|
createRelayContext: createRelayContext,
|
|
235
238
|
getOperationVariables: RelayConcreteVariables.getOperationVariables,
|
package/lib/query/fetchQuery.js
CHANGED
|
@@ -122,6 +122,9 @@ function fetchQuery(environment, query, variables, options) {
|
|
|
122
122
|
if (snapshot.missingRequiredFields != null) {
|
|
123
123
|
reportMissingRequiredFields(environment, snapshot.missingRequiredFields);
|
|
124
124
|
}
|
|
125
|
+
/* $FlowFixMe[incompatible-return] we assume readData returns the right
|
|
126
|
+
* data just having written it from network or checked availability. */
|
|
127
|
+
|
|
125
128
|
|
|
126
129
|
return snapshot.data;
|
|
127
130
|
}
|
|
@@ -37,9 +37,9 @@ function withResolverContext(context, cb) {
|
|
|
37
37
|
// The declarations ensure that the type of the returned data is:
|
|
38
38
|
// - non-nullable if the provided ref type is non-nullable
|
|
39
39
|
// - nullable if the provided ref type is nullable
|
|
40
|
-
// - array of non-nullable if the
|
|
40
|
+
// - array of non-nullable if the provided ref type is an array of
|
|
41
41
|
// non-nullable refs
|
|
42
|
-
// - array of nullable if the
|
|
42
|
+
// - array of nullable if the provided ref type is an array of nullable refs
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
function readFragment(fragmentInput, fragmentKey) {
|
package/package.json
CHANGED
package/query/fetchQuery.js.flow
CHANGED
|
@@ -22,9 +22,9 @@ import type {
|
|
|
22
22
|
CacheConfig,
|
|
23
23
|
FetchQueryFetchPolicy,
|
|
24
24
|
OperationType,
|
|
25
|
-
|
|
25
|
+
Query,
|
|
26
|
+
Variables,
|
|
26
27
|
} from '../util/RelayRuntimeTypes';
|
|
27
|
-
import type {GraphQLTaggedNode} from './GraphQLTag';
|
|
28
28
|
|
|
29
29
|
const RelayObservable = require('../network/RelayObservable');
|
|
30
30
|
const {
|
|
@@ -112,15 +112,15 @@ const invariant = require('invariant');
|
|
|
112
112
|
* ```
|
|
113
113
|
* NOTE: When using .toPromise(), the request cannot be cancelled.
|
|
114
114
|
*/
|
|
115
|
-
function fetchQuery<
|
|
115
|
+
function fetchQuery<TVariables: Variables, TData, TRawResponse>(
|
|
116
116
|
environment: IEnvironment,
|
|
117
|
-
query:
|
|
118
|
-
variables:
|
|
117
|
+
query: Query<TVariables, TData, TRawResponse>,
|
|
118
|
+
variables: TVariables,
|
|
119
119
|
options?: $ReadOnly<{|
|
|
120
120
|
fetchPolicy?: FetchQueryFetchPolicy,
|
|
121
121
|
networkCacheConfig?: CacheConfig,
|
|
122
122
|
|}>,
|
|
123
|
-
): RelayObservable<
|
|
123
|
+
): RelayObservable<TData> {
|
|
124
124
|
const queryNode = getRequest(query);
|
|
125
125
|
invariant(
|
|
126
126
|
queryNode.params.operationKind === 'query',
|
|
@@ -137,10 +137,12 @@ function fetchQuery<TQuery: OperationType>(
|
|
|
137
137
|
);
|
|
138
138
|
const fetchPolicy = options?.fetchPolicy ?? 'network-only';
|
|
139
139
|
|
|
140
|
-
function readData(snapshot: Snapshot) {
|
|
140
|
+
function readData(snapshot: Snapshot): TData {
|
|
141
141
|
if (snapshot.missingRequiredFields != null) {
|
|
142
142
|
reportMissingRequiredFields(environment, snapshot.missingRequiredFields);
|
|
143
143
|
}
|
|
144
|
+
/* $FlowFixMe[incompatible-return] we assume readData returns the right
|
|
145
|
+
* data just having written it from network or checked availability. */
|
|
144
146
|
return snapshot.data;
|
|
145
147
|
}
|
|
146
148
|
|