relay-runtime 20.0.0 → 20.1.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/experimental.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v20.0.0
2
+ * Relay v20.1.0
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v20.0.0
2
+ * Relay v20.1.0
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
@@ -37,7 +37,7 @@ const validateMutation = require('./validateMutation');
37
37
  const invariant = require('invariant');
38
38
  const warning = require('warning');
39
39
 
40
- export type MutationConfig<TMutation: MutationParameters> = {
40
+ export type MutationConfig<TMutation: MutationParameters> = $ReadOnly<{
41
41
  cacheConfig?: CacheConfig,
42
42
  configs?: Array<DeclarativeMutationConfig>,
43
43
  mutation: GraphQLTaggedNode,
@@ -57,9 +57,9 @@ export type MutationConfig<TMutation: MutationParameters> = {
57
57
  updater?: ?SelectorStoreUpdater<TMutation['response']>,
58
58
  uploadables?: UploadableMap,
59
59
  variables: TMutation['variables'],
60
- };
60
+ }>;
61
61
 
62
- export type CommitMutationConfig<TVariables, TData, TRawResponse> = {
62
+ export type CommitMutationConfig<TVariables, TData, TRawResponse> = $ReadOnly<{
63
63
  cacheConfig?: CacheConfig,
64
64
  configs?: Array<DeclarativeMutationConfig>,
65
65
  mutation: Mutation<TVariables, TData, TRawResponse>,
@@ -71,8 +71,8 @@ export type CommitMutationConfig<TVariables, TData, TRawResponse> = {
71
71
  optimisticUpdater?: ?SelectorStoreUpdater<TData>,
72
72
  updater?: ?SelectorStoreUpdater<TData>,
73
73
  uploadables?: UploadableMap,
74
- variables: TVariables,
75
- };
74
+ variables: NoInfer<TVariables>,
75
+ }>;
76
76
 
77
77
  /**
78
78
  * Higher-level helper function to execute a mutation against a specific
@@ -26,7 +26,7 @@ export interface INetwork {
26
26
 
27
27
  export type LogRequestInfoFunction = mixed => void;
28
28
 
29
- export type PayloadData = {[key: string]: mixed};
29
+ export type PayloadData = {+[key: string]: mixed};
30
30
 
31
31
  export type PayloadError = interface {
32
32
  message: string,
@@ -134,4 +134,4 @@ export type SubscribeFunction = (
134
134
  ) => RelayObservable<GraphQLResponse>;
135
135
 
136
136
  export type Uploadable = File | Blob;
137
- export type UploadableMap = {[key: string]: Uploadable};
137
+ export type UploadableMap = {+[key: string]: Uploadable};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "relay-runtime",
3
3
  "description": "A core runtime for building GraphQL-driven applications.",
4
- "version": "20.0.0",
4
+ "version": "20.1.0",
5
5
  "keywords": [
6
6
  "graphql",
7
7
  "relay"
@@ -115,7 +115,7 @@ const invariant = require('invariant');
115
115
  function fetchQuery<TVariables: Variables, TData, TRawResponse>(
116
116
  environment: IEnvironment,
117
117
  query: Query<TVariables, TData, TRawResponse>,
118
- variables: TVariables,
118
+ variables: NoInfer<TVariables>,
119
119
  options?: $ReadOnly<{
120
120
  fetchPolicy?: FetchQueryFetchPolicy,
121
121
  networkCacheConfig?: CacheConfig,
@@ -470,6 +470,8 @@ class RelayModernStore implements Store {
470
470
  fetchTime: Date.now(),
471
471
  };
472
472
  this._releaseBuffer.push(id);
473
+ /* $FlowFixMe[incompatible-call] Natural Inference rollout. See
474
+ * https://fburl.com/gdoc/y8dn025u */
473
475
  this._roots.set(id, temporaryRootEntry);
474
476
  }
475
477
  }
@@ -86,7 +86,7 @@ class RelayRecordSource implements MutableRecordSource {
86
86
  }
87
87
 
88
88
  toJSON(): RecordSourceJSON {
89
- const obj: RecordSourceJSON = {};
89
+ const obj: {...RecordSourceJSON} = {};
90
90
  for (const [key, record] of this._records) {
91
91
  obj[key] = RelayModernRecord.toJSON<null | void>(record);
92
92
  }
@@ -67,7 +67,7 @@ const invariant = require('invariant');
67
67
  const warning = require('warning');
68
68
 
69
69
  export type GetDataID = (
70
- fieldValue: {[string]: mixed},
70
+ fieldValue: {+[string]: mixed},
71
71
  typeName: string,
72
72
  ) => mixed;
73
73
 
@@ -245,7 +245,7 @@ export interface RecordSource {
245
245
  /**
246
246
  * A collection of records keyed by id.
247
247
  */
248
- export type RecordSourceJSON = {[DataID]: ?RecordJSON};
248
+ export type RecordSourceJSON = {+[DataID]: ?RecordJSON};
249
249
 
250
250
  /**
251
251
  * A read/write interface for accessing and updating graph data.
@@ -258,10 +258,10 @@ export interface MutableRecordSource extends RecordSource {
258
258
  }
259
259
 
260
260
  export type CheckOptions = {
261
- handlers: $ReadOnlyArray<MissingFieldHandler>,
262
- defaultActorIdentifier: ActorIdentifier,
263
- getTargetForActor: (actorIdentifier: ActorIdentifier) => MutableRecordSource,
264
- getSourceForActor: (actorIdentifier: ActorIdentifier) => RecordSource,
261
+ +handlers: $ReadOnlyArray<MissingFieldHandler>,
262
+ +defaultActorIdentifier: ActorIdentifier,
263
+ +getTargetForActor: (actorIdentifier: ActorIdentifier) => MutableRecordSource,
264
+ +getSourceForActor: (actorIdentifier: ActorIdentifier) => RecordSource,
265
265
  };
266
266
 
267
267
  export type OperationAvailability =
@@ -32,11 +32,11 @@ export type EvaluationResult<T> = {
32
32
  error: ?Error,
33
33
  };
34
34
 
35
- export type ResolverFragmentResult = {
35
+ export type ResolverFragmentResult = $ReadOnly<{
36
36
  data: mixed,
37
37
  isMissingData: boolean,
38
38
  fieldErrors: ?FieldErrors,
39
- };
39
+ }>;
40
40
 
41
41
  export type GetDataForResolverFragmentFn =
42
42
  SingularReaderSelector => ResolverFragmentResult;
@@ -14,7 +14,7 @@
14
14
  const {VIEWER_ID, VIEWER_TYPE} = require('./ViewerPattern');
15
15
 
16
16
  function defaultGetDataID(
17
- fieldValue: {[string]: mixed},
17
+ fieldValue: {+[string]: mixed},
18
18
  typeName: string,
19
19
  ): mixed {
20
20
  if (typeName === VIEWER_TYPE) {
@@ -41,16 +41,17 @@ export type SubscriptionParameters = {
41
41
  * Updated Flow type that makes use of typed graphql tagged literals with
42
42
  * type information.
43
43
  */
44
- export type GraphQLSubscriptionConfig<TVariables, TData, TRawResponse> = {
45
- configs?: Array<DeclarativeMutationConfig>,
46
- cacheConfig?: CacheConfig,
47
- subscription: GraphQLSubscription<TVariables, TData, TRawResponse>,
48
- variables: TVariables,
49
- onCompleted?: ?() => void,
50
- onError?: ?(error: Error) => void,
51
- onNext?: ?(response: ?TData) => void,
52
- updater?: ?SelectorStoreUpdater<TData>,
53
- };
44
+ export type GraphQLSubscriptionConfig<TVariables, TData, TRawResponse> =
45
+ $ReadOnly<{
46
+ configs?: Array<DeclarativeMutationConfig>,
47
+ cacheConfig?: CacheConfig,
48
+ subscription: GraphQLSubscription<TVariables, TData, TRawResponse>,
49
+ variables: TVariables,
50
+ onCompleted?: ?() => void,
51
+ onError?: ?(error: Error) => void,
52
+ onNext?: ?(response: ?TData) => void,
53
+ updater?: ?SelectorStoreUpdater<TData>,
54
+ }>;
54
55
 
55
56
  function requestSubscription<TVariables: Variables, TData, TRawResponse>(
56
57
  environment: IEnvironment,
@@ -62,14 +62,14 @@ export type VariablesOf<T: OperationType> = T['variables'];
62
62
  * a given instance of executing an operation.
63
63
  */
64
64
  export type CacheConfig = {
65
- force?: ?boolean,
66
- poll?: ?number,
67
- liveConfigId?: ?string,
68
- onSubscribe?: () => void,
69
- onResume?: (pauseTimeMs: number) => void,
70
- onPause?: (mqttConnectionIsOk: boolean, internetIsOk: boolean) => void,
71
- metadata?: {[key: string]: mixed, ...},
72
- transactionId?: ?string,
65
+ +force?: ?boolean,
66
+ +poll?: ?number,
67
+ +liveConfigId?: ?string,
68
+ +onSubscribe?: () => void,
69
+ +onResume?: (pauseTimeMs: number) => void,
70
+ +onPause?: (mqttConnectionIsOk: boolean, internetIsOk: boolean) => void,
71
+ +metadata?: {+[key: string]: mixed, ...},
72
+ +transactionId?: ?string,
73
73
  };
74
74
 
75
75
  export type FetchQueryFetchPolicy = 'store-or-network' | 'network-only';