relay-test-utils 21.0.0 → 21.0.1

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.
@@ -63,33 +63,33 @@ type ValueResolver = (
63
63
  defaultValue?: unknown,
64
64
  ) => unknown;
65
65
  type Traversable = {
66
- +selections: ReadonlyArray<NormalizationSelection>,
67
- +typeName: ?string,
68
- +isAbstractType: ?boolean,
69
- +name: ?string,
70
- +alias: ?string,
71
- +args: ?{[string]: unknown, ...},
66
+ readonly selections: ReadonlyArray<NormalizationSelection>,
67
+ readonly typeName: ?string,
68
+ readonly isAbstractType: ?boolean,
69
+ readonly name: ?string,
70
+ readonly alias: ?string,
71
+ readonly args: ?{[string]: unknown, ...},
72
72
  };
73
73
  type MockData = {[string]: unknown, ...};
74
74
  export type MockResolverContext = {
75
- +parentType: ?string,
76
- +name: ?string,
77
- +alias: ?string,
78
- +path: ?ReadonlyArray<string>,
79
- +args: ?{[string]: unknown, ...},
75
+ readonly parentType: ?string,
76
+ readonly name: ?string,
77
+ readonly alias: ?string,
78
+ readonly path: ?ReadonlyArray<string>,
79
+ readonly args: ?{[string]: unknown, ...},
80
80
  };
81
81
  type MockResolver = (
82
82
  context: MockResolverContext,
83
83
  generateId: () => number,
84
84
  ) => unknown;
85
- export type MockResolvers = {+[typeName: string]: MockResolver, ...};
85
+ export type MockResolvers = {readonly [typeName: string]: MockResolver, ...};
86
86
 
87
87
  type SelectionMetadata = {
88
88
  [selectionPath: string]: {
89
- +type: string,
90
- +plural: boolean,
91
- +nullable: boolean,
92
- +enumValues: ReadonlyArray<string> | null,
89
+ readonly type: string,
90
+ readonly plural: boolean,
91
+ readonly nullable: boolean,
92
+ readonly enumValues: ReadonlyArray<string> | null,
93
93
  },
94
94
  ...
95
95
  };
@@ -188,11 +188,11 @@ class RelayMockPayloadGenerator {
188
188
  _deferredPayloads: Array<GraphQLResponseWithData>;
189
189
 
190
190
  constructor(options: {
191
- +variables: Variables,
192
- +mockResolvers: MockResolvers | null,
193
- +selectionMetadata: SelectionMetadata | null,
194
- +mockClientData: ?boolean,
195
- +generateDeferredPayload: ?boolean,
191
+ readonly variables: Variables,
192
+ readonly mockResolvers: MockResolvers | null,
193
+ readonly selectionMetadata: SelectionMetadata | null,
194
+ readonly mockClientData: ?boolean,
195
+ readonly generateDeferredPayload: ?boolean,
196
196
  }) {
197
197
  this._variables = options.variables;
198
198
  this._mockResolvers = {
@@ -924,10 +924,10 @@ class RelayMockPayloadGenerator {
924
924
  typeName: ?string,
925
925
  selectionPath: ReadonlyArray<string>,
926
926
  ): {
927
- +type: string,
928
- +plural: boolean,
929
- +enumValues: ReadonlyArray<string> | null,
930
- +nullable: boolean,
927
+ readonly type: string,
928
+ readonly plural: boolean,
929
+ readonly enumValues: ReadonlyArray<string> | null,
930
+ readonly nullable: boolean,
931
931
  } {
932
932
  return (
933
933
  this._getTypeDetailsForPath(selectionPath) ?? {
@@ -40,10 +40,10 @@ const {
40
40
  } = require('relay-runtime');
41
41
 
42
42
  type PendingRequest = {
43
- +request: RequestParameters,
44
- +variables: Variables,
45
- +cacheConfig: CacheConfig,
46
- +sink: Sink<GraphQLSingularResponse>,
43
+ readonly request: RequestParameters,
44
+ readonly variables: Variables,
45
+ readonly cacheConfig: CacheConfig,
46
+ readonly sink: Sink<GraphQLSingularResponse>,
47
47
  };
48
48
 
49
49
  const MAX_SIZE = 10;
@@ -91,53 +91,53 @@ type OperationMockResolver = (
91
91
  ) => ?GraphQLSingularResponse | ?Error;
92
92
 
93
93
  type MockFunctions = {
94
- +clearCache: () => void,
95
- +cachePayload: (
94
+ readonly clearCache: () => void,
95
+ readonly cachePayload: (
96
96
  request: ConcreteRequest | OperationDescriptor,
97
97
  variables: Variables,
98
98
  payload: GraphQLSingularResponse,
99
99
  ) => void,
100
- +isLoading: (
100
+ readonly isLoading: (
101
101
  request: ConcreteRequest | OperationDescriptor,
102
102
  variables: Variables,
103
103
  cacheConfig?: CacheConfig,
104
104
  ) => boolean,
105
- +reject: (
105
+ readonly reject: (
106
106
  request: ConcreteRequest | OperationDescriptor,
107
107
  error: Error | string,
108
108
  ) => void,
109
- +nextValue: (
109
+ readonly nextValue: (
110
110
  request: ConcreteRequest | OperationDescriptor,
111
111
  payload: GraphQLSingularResponse,
112
112
  ) => void,
113
- +complete: (request: ConcreteRequest | OperationDescriptor) => void,
114
- +resolve: (
113
+ readonly complete: (request: ConcreteRequest | OperationDescriptor) => void,
114
+ readonly resolve: (
115
115
  request: ConcreteRequest | OperationDescriptor,
116
116
  payload: ReadonlyArray<GraphQLSingularResponse> | GraphQLSingularResponse,
117
117
  ) => void,
118
- +getAllOperations: () => ReadonlyArray<OperationDescriptor>,
119
- +findOperation: (
118
+ readonly getAllOperations: () => ReadonlyArray<OperationDescriptor>,
119
+ readonly findOperation: (
120
120
  findFn: (operation: OperationDescriptor) => boolean,
121
121
  ) => OperationDescriptor,
122
- +queuePendingOperation: (
122
+ readonly queuePendingOperation: (
123
123
  query: GraphQLTaggedNode,
124
124
  variables: Variables,
125
125
  ) => void,
126
- +getMostRecentOperation: () => OperationDescriptor,
127
- +resolveMostRecentOperation: (
126
+ readonly getMostRecentOperation: () => OperationDescriptor,
127
+ readonly resolveMostRecentOperation: (
128
128
  payload:
129
129
  | GraphQLSingularResponse
130
130
  | ((operation: OperationDescriptor) => GraphQLSingularResponse),
131
131
  ) => void,
132
- +rejectMostRecentOperation: (
132
+ readonly rejectMostRecentOperation: (
133
133
  error: Error | ((operation: OperationDescriptor) => Error),
134
134
  ) => void,
135
- +queueOperationResolver: (resolver: OperationMockResolver) => void,
135
+ readonly queueOperationResolver: (resolver: OperationMockResolver) => void,
136
136
  };
137
137
 
138
138
  interface MockEnvironment {
139
- +mock: MockFunctions;
140
- +mockClear: () => void;
139
+ readonly mock: MockFunctions;
140
+ readonly mockClear: () => void;
141
141
  }
142
142
 
143
143
  export interface RelayMockEnvironment extends MockEnvironment, IEnvironment {}
@@ -34,7 +34,7 @@ const {
34
34
  * expect(actual).toEqual(expectedValue)
35
35
  * ```
36
36
  **/
37
- function testResolver<D extends ?{+$fragmentType?: unknown, ...}, Ret>(
37
+ function testResolver<D extends ?{readonly $fragmentType?: unknown, ...}, Ret>(
38
38
  resolver: ({$data?: D, $fragmentRefs: any, $fragmentSpreads: any}) => Ret,
39
39
  // indexed_access is not yet enabled for this code base. Once it is, this can
40
40
  // become: `Key['$data']`
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v21.0.0
2
+ * Relay v21.0.1
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "relay-test-utils",
3
3
  "description": "Utilities for testing Relay applications.",
4
- "version": "21.0.0",
4
+ "version": "21.0.1",
5
5
  "keywords": [
6
6
  "graphql",
7
7
  "relay"
@@ -18,7 +18,7 @@
18
18
  "@babel/runtime": "^7.25.0",
19
19
  "fbjs": "^3.0.2",
20
20
  "invariant": "^2.2.4",
21
- "relay-runtime": "21.0.0"
21
+ "relay-runtime": "21.0.1"
22
22
  },
23
23
  "directories": {
24
24
  "": "./"