relay-runtime 0.0.0-main-5a7f35aa → 0.0.0-main-4dcb3ffa
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/experimental.js +1 -1
- package/index.js +1 -1
- package/network/RelayObservable.js.flow +6 -6
- package/package.json +1 -1
- package/store/RelayStoreTypes.js.flow +2 -2
- package/util/JSResourceTypes.flow.js.flow +1 -1
- package/util/RelayRuntimeTypes.js.flow +18 -18
- package/util/createPayloadFor3DField.js.flow +4 -4
package/experimental.js
CHANGED
package/index.js
CHANGED
|
@@ -33,7 +33,7 @@ type SubscriptionFn = {
|
|
|
33
33
|
* An Observer is an object of optional callback functions provided to
|
|
34
34
|
* .subscribe(). Each callback function is invoked when that event occurs.
|
|
35
35
|
*/
|
|
36
|
-
export type Observer
|
|
36
|
+
export type Observer<in T> = {
|
|
37
37
|
+start?: ?(Subscription) => unknown,
|
|
38
38
|
+next?: ?(T) => unknown,
|
|
39
39
|
+error?: ?(Error) => unknown,
|
|
@@ -46,7 +46,7 @@ export type Observer<-T> = {
|
|
|
46
46
|
* The methods are to be called to trigger each event. It also contains a closed
|
|
47
47
|
* field to see if the resulting subscription has closed.
|
|
48
48
|
*/
|
|
49
|
-
export type Sink
|
|
49
|
+
export type Sink<in T> = {
|
|
50
50
|
+next: T => void,
|
|
51
51
|
+error: (Error, isUncaughtThrownError?: boolean) => void,
|
|
52
52
|
+complete: () => void,
|
|
@@ -59,7 +59,7 @@ export type Sink<-T> = {
|
|
|
59
59
|
* and may return either a cleanup function or a Subscription instance (for use
|
|
60
60
|
* when composing Observables).
|
|
61
61
|
*/
|
|
62
|
-
export type Source
|
|
62
|
+
export type Source<out T> = (Sink<T>) => void | Subscription | SubscriptionFn;
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* A Subscribable is an interface describing any object which can be subscribed.
|
|
@@ -67,11 +67,11 @@ export type Source<+T> = (Sink<T>) => void | Subscription | SubscriptionFn;
|
|
|
67
67
|
* Note: A sink may be passed directly to .subscribe() as its observer,
|
|
68
68
|
* allowing for easily composing Subscribables.
|
|
69
69
|
*/
|
|
70
|
-
export interface Subscribable
|
|
70
|
+
export interface Subscribable<out T> {
|
|
71
71
|
subscribe(observer: Observer<T> | Sink<T>): Subscription;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
export type ObservableFromValue
|
|
74
|
+
export type ObservableFromValue<out T> = Subscribable<T> | Promise<T> | T;
|
|
75
75
|
|
|
76
76
|
let hostReportError:
|
|
77
77
|
| ((Error, isUncaughtThrownError: boolean) => unknown)
|
|
@@ -88,7 +88,7 @@ let hostReportError:
|
|
|
88
88
|
*
|
|
89
89
|
* ESObservable: https://github.com/tc39/proposal-observable
|
|
90
90
|
*/
|
|
91
|
-
class RelayObservable
|
|
91
|
+
class RelayObservable<out T> implements Subscribable<T> {
|
|
92
92
|
+_source: Source<T>;
|
|
93
93
|
|
|
94
94
|
static create<V>(source: Source<V>): RelayObservable<V> {
|
package/package.json
CHANGED
|
@@ -1286,7 +1286,7 @@ export type StoreUpdater = (store: RecordSourceProxy) => void;
|
|
|
1286
1286
|
* order to easily access the root fields of a query/mutation as well as a
|
|
1287
1287
|
* second argument of the response object of the mutation.
|
|
1288
1288
|
*/
|
|
1289
|
-
export type SelectorStoreUpdater
|
|
1289
|
+
export type SelectorStoreUpdater<in TMutationResponse> = (
|
|
1290
1290
|
store: RecordSourceSelectorProxy,
|
|
1291
1291
|
data: ?TMutationResponse,
|
|
1292
1292
|
) => void;
|
|
@@ -1604,7 +1604,7 @@ export type ConcreteClientEdgeResolverReturnType<T = any> = {
|
|
|
1604
1604
|
* that the provider of the LiveState value confirms that the value has indeed
|
|
1605
1605
|
* change before notifying Relay of the change.
|
|
1606
1606
|
*/
|
|
1607
|
-
export type LiveState
|
|
1607
|
+
export type LiveState<out T> = {
|
|
1608
1608
|
/**
|
|
1609
1609
|
* Returns the current value of the live state.
|
|
1610
1610
|
*/
|
|
@@ -86,8 +86,8 @@ export type RenderPolicy = 'full' | 'partial';
|
|
|
86
86
|
* Return type of graphql tag literals for all operations.
|
|
87
87
|
*/
|
|
88
88
|
declare export opaque type Operation<
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
in TVariables extends Variables,
|
|
90
|
+
out TData,
|
|
91
91
|
TRawResponse,
|
|
92
92
|
>: ConcreteRequest;
|
|
93
93
|
|
|
@@ -95,8 +95,8 @@ declare export opaque type Operation<
|
|
|
95
95
|
* Return type of graphql tag literals for updatable queries.
|
|
96
96
|
*/
|
|
97
97
|
declare export opaque type UpdatableQuery<
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
in TVariables extends Variables,
|
|
99
|
+
out TData,
|
|
100
100
|
>: ConcreteUpdatableQuery;
|
|
101
101
|
|
|
102
102
|
/**
|
|
@@ -104,15 +104,15 @@ declare export opaque type UpdatableQuery<
|
|
|
104
104
|
*/
|
|
105
105
|
declare export opaque type UpdatableFragment<
|
|
106
106
|
TFragmentType,
|
|
107
|
-
|
|
107
|
+
out TData,
|
|
108
108
|
>: ReaderFragment;
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
111
|
* Return type of graphql tag literals for queries.
|
|
112
112
|
*/
|
|
113
113
|
declare export opaque type Query<
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
in TVariables extends Variables,
|
|
115
|
+
out TData,
|
|
116
116
|
TRawResponse = void,
|
|
117
117
|
>: Operation<TVariables, TData, TRawResponse>;
|
|
118
118
|
|
|
@@ -120,8 +120,8 @@ declare export opaque type Query<
|
|
|
120
120
|
* Return type of graphql tag literals for client-only queries.
|
|
121
121
|
*/
|
|
122
122
|
declare export opaque type ClientQuery<
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
in TVariables extends Variables,
|
|
124
|
+
out TData,
|
|
125
125
|
TRawResponse = void,
|
|
126
126
|
>: ClientRequest;
|
|
127
127
|
|
|
@@ -129,8 +129,8 @@ declare export opaque type ClientQuery<
|
|
|
129
129
|
* Return type of graphql tag literals for mutations.
|
|
130
130
|
*/
|
|
131
131
|
declare export opaque type Mutation<
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
in TVariables extends Variables,
|
|
133
|
+
out TData,
|
|
134
134
|
TRawResponse = {...},
|
|
135
135
|
>: Operation<TVariables, TData, TRawResponse>;
|
|
136
136
|
|
|
@@ -141,8 +141,8 @@ declare export opaque type Mutation<
|
|
|
141
141
|
* `RelayObservable`'s `Subscription` type.
|
|
142
142
|
*/
|
|
143
143
|
declare export opaque type GraphQLSubscription<
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
in TVariables extends Variables,
|
|
145
|
+
out TData,
|
|
146
146
|
TRawResponse = void,
|
|
147
147
|
>: Operation<TVariables, TData, TRawResponse>;
|
|
148
148
|
|
|
@@ -151,21 +151,21 @@ declare export opaque type GraphQLSubscription<
|
|
|
151
151
|
*/
|
|
152
152
|
declare export opaque type InlineFragment<
|
|
153
153
|
TFragmentType,
|
|
154
|
-
|
|
154
|
+
out TData,
|
|
155
155
|
>: ReaderInlineDataFragment;
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
158
|
* Return type of graphql tag literals for fragments, except `@inline`
|
|
159
159
|
* fragments.
|
|
160
160
|
*/
|
|
161
|
-
declare export opaque type Fragment<TFragmentType,
|
|
161
|
+
declare export opaque type Fragment<TFragmentType, out TData>: ReaderFragment;
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
164
|
* Return type of graphql tag literals for `@refetchable` fragments.
|
|
165
165
|
*/
|
|
166
166
|
declare export opaque type RefetchableFragment<
|
|
167
167
|
TFragmentType,
|
|
168
|
-
|
|
168
|
+
out TData,
|
|
169
169
|
TVariables extends Variables,
|
|
170
170
|
>: Fragment<TFragmentType, TData>;
|
|
171
171
|
|
|
@@ -175,7 +175,7 @@ declare export opaque type RefetchableFragment<
|
|
|
175
175
|
*/
|
|
176
176
|
declare export opaque type PrefetchableRefetchableFragment<
|
|
177
177
|
TFragmentType,
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
out TData,
|
|
179
|
+
out TEdgeData,
|
|
180
180
|
TVariables extends Variables,
|
|
181
181
|
>: Fragment<TFragmentType, TData>;
|
|
@@ -21,15 +21,15 @@ const {
|
|
|
21
21
|
|
|
22
22
|
export opaque type Local3DPayload<
|
|
23
23
|
// eslint-disable-next-line no-unused-vars
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
out DocumentName extends string,
|
|
25
|
+
out Response extends {...},
|
|
26
26
|
> = Response;
|
|
27
27
|
|
|
28
28
|
function createPayloadFor3DField<
|
|
29
29
|
// $FlowFixMe[unsupported-variance-annotation]
|
|
30
|
-
|
|
30
|
+
out DocumentName extends string,
|
|
31
31
|
// $FlowFixMe[unsupported-variance-annotation]
|
|
32
|
-
|
|
32
|
+
out Response extends {...},
|
|
33
33
|
>(
|
|
34
34
|
name: DocumentName,
|
|
35
35
|
operation: JSResourceReference<NormalizationSplitOperation>,
|