relay-runtime 0.0.0-main-e4919b17 → 0.0.0-main-454de5bb
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/lib/network/RelayNetwork.js +1 -1
- package/lib/store/RelayConcreteVariables.js +1 -2
- package/lib/store/RelayModernOperationDescriptor.js +1 -1
- package/lib/util/withProvidedVariables.js +1 -3
- package/network/RelayNetwork.js.flow +4 -1
- package/package.json +1 -1
- package/relay-runtime.js +2 -2
- package/relay-runtime.min.js +2 -2
- package/store/RelayConcreteVariables.js.flow +2 -3
- package/store/RelayModernOperationDescriptor.js.flow +1 -1
- package/util/RelayConcreteNode.js.flow +4 -2
- package/util/withProvidedVariables.js.flow +2 -3
|
@@ -18,7 +18,7 @@ import type {
|
|
|
18
18
|
NormalizationOperation,
|
|
19
19
|
} from '../util/NormalizationNode';
|
|
20
20
|
import type {ReaderFragment} from '../util/ReaderNode';
|
|
21
|
-
import type {
|
|
21
|
+
import type {ProvidedVariablesType} from '../util/RelayConcreteNode';
|
|
22
22
|
import type {Variables} from '../util/RelayRuntimeTypes';
|
|
23
23
|
|
|
24
24
|
const {getArgumentValues} = require('./RelayStoreUtils');
|
|
@@ -85,7 +85,7 @@ function getFragmentVariables(
|
|
|
85
85
|
*/
|
|
86
86
|
function getOperationVariables(
|
|
87
87
|
operation: NormalizationOperation,
|
|
88
|
-
|
|
88
|
+
providedVariables: ?ProvidedVariablesType,
|
|
89
89
|
variables: Variables,
|
|
90
90
|
): Variables {
|
|
91
91
|
const operationVariables = {};
|
|
@@ -97,7 +97,6 @@ function getOperationVariables(
|
|
|
97
97
|
operationVariables[def.name] = value;
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
-
const providedVariables = parameters.providedVariables;
|
|
101
100
|
if (providedVariables != null) {
|
|
102
101
|
Object.keys(providedVariables).forEach((varName: string) => {
|
|
103
102
|
operationVariables[varName] = providedVariables[varName].get();
|
|
@@ -46,7 +46,7 @@ function createOperationDescriptor<TQuery: OperationType>(
|
|
|
46
46
|
const operation = request.operation;
|
|
47
47
|
const operationVariables = getOperationVariables(
|
|
48
48
|
operation,
|
|
49
|
-
request.params,
|
|
49
|
+
request.params.providedVariables,
|
|
50
50
|
variables,
|
|
51
51
|
);
|
|
52
52
|
const requestDescriptor = createRequestDescriptor(
|
|
@@ -35,6 +35,8 @@ export type NormalizationRootNode =
|
|
|
35
35
|
| ConcreteRequest
|
|
36
36
|
| NormalizationSplitOperation;
|
|
37
37
|
|
|
38
|
+
export type ProvidedVariablesType = {[key: string]: {|get(): mixed|}};
|
|
39
|
+
|
|
38
40
|
/**
|
|
39
41
|
* Contains the parameters required for executing a GraphQL request.
|
|
40
42
|
* The operation can either be provided as a persisted `id` or `text`. If given
|
|
@@ -48,7 +50,7 @@ export type RequestParameters =
|
|
|
48
50
|
// common fields
|
|
49
51
|
+name: string,
|
|
50
52
|
+operationKind: 'mutation' | 'query' | 'subscription',
|
|
51
|
-
+providedVariables?:
|
|
53
|
+
+providedVariables?: ProvidedVariablesType,
|
|
52
54
|
+metadata: {[key: string]: mixed, ...},
|
|
53
55
|
|}
|
|
54
56
|
| {|
|
|
@@ -58,7 +60,7 @@ export type RequestParameters =
|
|
|
58
60
|
// common fields
|
|
59
61
|
+name: string,
|
|
60
62
|
+operationKind: 'mutation' | 'query' | 'subscription',
|
|
61
|
-
+providedVariables?:
|
|
63
|
+
+providedVariables?: ProvidedVariablesType,
|
|
62
64
|
+metadata: {[key: string]: mixed, ...},
|
|
63
65
|
|};
|
|
64
66
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
'use strict';
|
|
15
15
|
|
|
16
|
-
import type {
|
|
16
|
+
import type {ProvidedVariablesType} from './RelayConcreteNode';
|
|
17
17
|
import type {Variables} from './RelayRuntimeTypes';
|
|
18
18
|
|
|
19
19
|
const areEqual = require('areEqual');
|
|
@@ -24,9 +24,8 @@ const debugCache = WEAKMAP_SUPPORTED ? new WeakMap() : new Map();
|
|
|
24
24
|
|
|
25
25
|
function withProvidedVariables(
|
|
26
26
|
userSuppliedVariables: Variables,
|
|
27
|
-
|
|
27
|
+
providedVariables: ?ProvidedVariablesType,
|
|
28
28
|
): Variables {
|
|
29
|
-
const providedVariables = parameters.providedVariables;
|
|
30
29
|
if (providedVariables != null) {
|
|
31
30
|
const operationVariables = {};
|
|
32
31
|
Object.assign(operationVariables, userSuppliedVariables);
|