relay-runtime 0.0.0-main-90bee398 → 0.0.0-main-8723bd66
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/handlers/connection/ConnectionHandler.js.flow +0 -7
- package/handlers/connection/MutationHandlers.js.flow +0 -3
- package/index.js +1 -1
- package/index.js.flow +7 -0
- package/lib/handlers/connection/ConnectionHandler.js +5 -11
- package/lib/handlers/connection/MutationHandlers.js +3 -6
- package/lib/multi-actor-environment/ActorSpecificEnvironment.js +4 -0
- package/lib/multi-actor-environment/MultiActorEnvironment.js +27 -14
- package/lib/mutations/commitMutation.js +1 -4
- package/lib/network/RelayObservable.js +1 -3
- package/lib/store/DataChecker.js +1 -2
- package/lib/store/RelayConcreteVariables.js +3 -7
- package/lib/store/RelayModernEnvironment.js +55 -31
- package/lib/store/RelayModernStore.js +1 -2
- package/lib/store/RelayReader.js +1 -2
- package/lib/store/RelayReferenceMarker.js +1 -2
- package/lib/store/RelayResponseNormalizer.js +1 -2
- package/lib/store/RelayStoreUtils.js +1 -2
- package/lib/subscription/requestSubscription.js +1 -1
- package/lib/util/RelayRuntimeTypes.js +0 -6
- package/lib/util/getPaginationVariables.js +2 -3
- package/multi-actor-environment/ActorSpecificEnvironment.js.flow +7 -1
- package/multi-actor-environment/MultiActorEnvironment.js.flow +25 -0
- package/multi-actor-environment/MultiActorEnvironmentTypes.js.flow +17 -2
- package/mutations/commitMutation.js.flow +0 -2
- package/network/RelayObservable.js.flow +0 -2
- package/package.json +1 -1
- package/relay-runtime.js +2 -2
- package/relay-runtime.min.js +2 -2
- package/store/ClientID.js.flow +1 -1
- package/store/DataChecker.js.flow +0 -1
- package/store/RelayConcreteVariables.js.flow +0 -5
- package/store/RelayModernEnvironment.js.flow +29 -1
- package/store/RelayModernStore.js.flow +0 -1
- package/store/RelayReader.js.flow +0 -1
- package/store/RelayReferenceMarker.js.flow +0 -1
- package/store/RelayResponseNormalizer.js.flow +0 -1
- package/store/RelayStoreTypes.js.flow +14 -2
- package/store/RelayStoreUtils.js.flow +0 -1
- package/store/TypeID.js.flow +1 -1
- package/subscription/requestSubscription.js.flow +1 -1
- package/util/RelayFeatureFlags.js.flow +1 -1
- package/util/RelayRuntimeTypes.js.flow +68 -1
- package/util/getPaginationVariables.js.flow +0 -2
package/store/ClientID.js.flow
CHANGED
|
@@ -40,7 +40,6 @@ function getFragmentVariables(
|
|
|
40
40
|
if (argumentVariables.hasOwnProperty(definition.name)) {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
// $FlowFixMe[cannot-spread-interface]
|
|
44
43
|
variables = variables || {...argumentVariables};
|
|
45
44
|
switch (definition.kind) {
|
|
46
45
|
case 'LocalArgument':
|
|
@@ -57,12 +56,9 @@ function getFragmentVariables(
|
|
|
57
56
|
* RelayStoreUtils.getStableVariableValue() that variable keys are all
|
|
58
57
|
* present.
|
|
59
58
|
*/
|
|
60
|
-
// $FlowFixMe[incompatible-use]
|
|
61
59
|
variables[definition.name] = undefined;
|
|
62
60
|
break;
|
|
63
61
|
}
|
|
64
|
-
// $FlowFixMe[incompatible-use]
|
|
65
|
-
// $FlowFixMe[cannot-write]
|
|
66
62
|
variables[definition.name] = rootVariables[definition.name];
|
|
67
63
|
break;
|
|
68
64
|
default:
|
|
@@ -91,7 +87,6 @@ function getOperationVariables(
|
|
|
91
87
|
const operationVariables = {};
|
|
92
88
|
operation.argumentDefinitions.forEach(def => {
|
|
93
89
|
let value = def.defaultValue;
|
|
94
|
-
// $FlowFixMe[cannot-write]
|
|
95
90
|
if (variables[def.name] != null) {
|
|
96
91
|
value = variables[def.name];
|
|
97
92
|
}
|
|
@@ -326,7 +326,7 @@ class RelayModernEnvironment implements IEnvironment {
|
|
|
326
326
|
|
|
327
327
|
/**
|
|
328
328
|
* Returns an Observable of GraphQLResponse resulting from executing the
|
|
329
|
-
* provided Query
|
|
329
|
+
* provided Query operation, each result of which is then
|
|
330
330
|
* normalized and committed to the publish queue.
|
|
331
331
|
*
|
|
332
332
|
* Note: Observables are lazy, so calling this method will do nothing until
|
|
@@ -334,6 +334,34 @@ class RelayModernEnvironment implements IEnvironment {
|
|
|
334
334
|
*/
|
|
335
335
|
execute({
|
|
336
336
|
operation,
|
|
337
|
+
}: {|
|
|
338
|
+
operation: OperationDescriptor,
|
|
339
|
+
|}): RelayObservable<GraphQLResponse> {
|
|
340
|
+
return this._execute({
|
|
341
|
+
createSource: () =>
|
|
342
|
+
this._network.execute(
|
|
343
|
+
operation.request.node.params,
|
|
344
|
+
operation.request.variables,
|
|
345
|
+
operation.request.cacheConfig || {},
|
|
346
|
+
null,
|
|
347
|
+
),
|
|
348
|
+
isClientPayload: false,
|
|
349
|
+
operation,
|
|
350
|
+
optimisticConfig: null,
|
|
351
|
+
updater: null,
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Returns an Observable of GraphQLResponse resulting from executing the
|
|
357
|
+
* provided Subscription operation, each result of which is then
|
|
358
|
+
* normalized and committed to the publish queue.
|
|
359
|
+
*
|
|
360
|
+
* Note: Observables are lazy, so calling this method will do nothing until
|
|
361
|
+
* the result is subscribed to: environment.execute({...}).subscribe({...}).
|
|
362
|
+
*/
|
|
363
|
+
executeSubscription({
|
|
364
|
+
operation,
|
|
337
365
|
updater,
|
|
338
366
|
}: {|
|
|
339
367
|
operation: OperationDescriptor,
|
|
@@ -722,13 +722,25 @@ export interface IEnvironment {
|
|
|
722
722
|
* responses may be returned (via `next`) over time followed by either
|
|
723
723
|
* the request completing (`completed`) or an error (`error`).
|
|
724
724
|
*
|
|
725
|
+
* Note: Observables are lazy, so calling this method will do nothing until
|
|
726
|
+
* the result is subscribed to: environment.execute({...}).subscribe({...}).
|
|
727
|
+
*/
|
|
728
|
+
execute(config: {|
|
|
729
|
+
operation: OperationDescriptor,
|
|
730
|
+
|}): RelayObservable<GraphQLResponse>;
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Send a subscription to the server with Observer semantics: one or more
|
|
734
|
+
* responses may be returned (via `next`) over time followed by either
|
|
735
|
+
* the request completing (`completed`) or an error (`error`).
|
|
736
|
+
*
|
|
725
737
|
* Networks/servers that support subscriptions may choose to hold the
|
|
726
738
|
* subscription open indefinitely such that `complete` is not called.
|
|
727
739
|
*
|
|
728
740
|
* Note: Observables are lazy, so calling this method will do nothing until
|
|
729
|
-
* the result is subscribed to: environment.
|
|
741
|
+
* the result is subscribed to: environment.executeSubscription({...}).subscribe({...}).
|
|
730
742
|
*/
|
|
731
|
-
|
|
743
|
+
executeSubscription(config: {|
|
|
732
744
|
operation: OperationDescriptor,
|
|
733
745
|
updater?: ?SelectorStoreUpdater,
|
|
734
746
|
|}): RelayObservable<GraphQLResponse>;
|
package/store/TypeID.js.flow
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
|
-
* @flow strict
|
|
7
|
+
* @flow strict-local
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
* Basic types used throughout Relay.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
import type {ReaderFragment, ReaderInlineDataFragment} from './ReaderNode';
|
|
20
|
+
import type {ConcreteRequest} from './RelayConcreteNode';
|
|
21
|
+
|
|
19
22
|
/**
|
|
20
23
|
* Represents any resource that must be explicitly disposed of. The most common
|
|
21
24
|
* use-case is as a return value for subscriptions, where calling `dispose()`
|
|
@@ -69,3 +72,67 @@ export type FetchPolicy =
|
|
|
69
72
|
| 'store-and-network'
|
|
70
73
|
| 'store-only';
|
|
71
74
|
export type RenderPolicy = 'full' | 'partial';
|
|
75
|
+
|
|
76
|
+
/* eslint-disable no-undef */
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Return type of graphql tag literals for all operations.
|
|
80
|
+
*/
|
|
81
|
+
declare export opaque type Operation<
|
|
82
|
+
-TVariables: Variables,
|
|
83
|
+
+TData,
|
|
84
|
+
TRawResponse,
|
|
85
|
+
>: ConcreteRequest;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Return type of graphql tag literals for queries.
|
|
89
|
+
*/
|
|
90
|
+
declare export opaque type Query<
|
|
91
|
+
-TVariables: Variables,
|
|
92
|
+
+TData,
|
|
93
|
+
TRawResponse = void,
|
|
94
|
+
>: Operation<TVariables, TData, TRawResponse>;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Return type of graphql tag literals for mutations.
|
|
98
|
+
*/
|
|
99
|
+
declare export opaque type Mutation<
|
|
100
|
+
-TVariables: Variables,
|
|
101
|
+
+TData,
|
|
102
|
+
TRawResponse = void,
|
|
103
|
+
>: Operation<TVariables, TData, TRawResponse>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Return type of graphql tag literals for subscriptions.
|
|
107
|
+
*
|
|
108
|
+
* NOTE: Using the GraphQL prefix here because of a naming conflict with
|
|
109
|
+
* `RelayObservable`'s `Subscription` type.
|
|
110
|
+
*/
|
|
111
|
+
declare export opaque type GraphQLSubscription<
|
|
112
|
+
-TVariables: Variables,
|
|
113
|
+
+TData,
|
|
114
|
+
TRawResponse = void,
|
|
115
|
+
>: Operation<TVariables, TData, TRawResponse>;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Return type of graphql tag literals for `@inline` fragments.
|
|
119
|
+
*/
|
|
120
|
+
declare export opaque type InlineFragment<
|
|
121
|
+
TFragmentType,
|
|
122
|
+
+TData,
|
|
123
|
+
>: ReaderInlineDataFragment;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Return type of graphql tag literals for fragments, except `@inline`
|
|
127
|
+
* fragments.
|
|
128
|
+
*/
|
|
129
|
+
declare export opaque type Fragment<TFragmentType, +TData>: ReaderFragment;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Return type of graphql tag literals for `@refetchable` fragments.
|
|
133
|
+
*/
|
|
134
|
+
declare export opaque type RefetchableFragment<
|
|
135
|
+
TFragmentType,
|
|
136
|
+
+TData,
|
|
137
|
+
-TVariables: Variables,
|
|
138
|
+
>: Fragment<TFragmentType, TData>;
|
|
@@ -56,7 +56,6 @@ function getPaginationVariables(
|
|
|
56
56
|
'determined by Relay.',
|
|
57
57
|
backwardMetadata.count,
|
|
58
58
|
);
|
|
59
|
-
// $FlowFixMe[cannot-spread-interface]
|
|
60
59
|
const paginationVariables = {
|
|
61
60
|
...baseVariables,
|
|
62
61
|
...extraVariables,
|
|
@@ -93,7 +92,6 @@ function getPaginationVariables(
|
|
|
93
92
|
'determined by Relay.',
|
|
94
93
|
forwardMetadata.count,
|
|
95
94
|
);
|
|
96
|
-
// $FlowFixMe[cannot-spread-interface]
|
|
97
95
|
const paginationVariables = {
|
|
98
96
|
...baseVariables,
|
|
99
97
|
...extraVariables,
|