relay-runtime 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.
Files changed (107) hide show
  1. package/experimental.d.ts +34 -0
  2. package/experimental.js +1 -1
  3. package/experimental.js.flow +4 -4
  4. package/handlers/RelayDefaultHandlerProvider.d.ts +12 -0
  5. package/handlers/connection/ConnectionHandler.d.ts +51 -0
  6. package/handlers/connection/ConnectionInterface.d.ts +40 -0
  7. package/handlers/connection/MutationHandlers.d.ts +17 -0
  8. package/index.d.ts +274 -0
  9. package/index.js +1 -1
  10. package/llm-docs/api-reference/relay-runtime/fetch-query.mdx +5 -0
  11. package/llm-docs/getting-started/compiler.mdx +19 -3
  12. package/llm-docs/getting-started/quick-start.mdx +15 -12
  13. package/llm-docs/guides/codemods.mdx +14 -1
  14. package/multi-actor-environment/ActorIdentifier.d.ts +17 -0
  15. package/multi-actor-environment/ActorSpecificEnvironment.js.flow +9 -9
  16. package/multi-actor-environment/MultiActorEnvironment.d.ts +123 -0
  17. package/multi-actor-environment/MultiActorEnvironment.js.flow +22 -18
  18. package/multi-actor-environment/MultiActorEnvironmentTypes.d.ts +225 -0
  19. package/multi-actor-environment/MultiActorEnvironmentTypes.js.flow +3 -3
  20. package/multi-actor-environment/index.d.ts +14 -0
  21. package/multi-actor-environment.d.ts +8 -0
  22. package/mutations/RelayDeclarativeMutationConfig.d.ts +70 -0
  23. package/mutations/applyOptimisticMutation.d.ts +25 -0
  24. package/mutations/commitLocalUpdate.d.ts +10 -0
  25. package/mutations/commitMutation.d.ts +48 -0
  26. package/mutations/commitMutation.js.flow +1 -1
  27. package/network/RelayNetwork.d.ts +12 -0
  28. package/network/RelayNetworkTypes.d.ts +145 -0
  29. package/network/RelayNetworkTypes.js.flow +15 -15
  30. package/network/RelayObservable.d.ts +197 -0
  31. package/network/RelayObservable.js.flow +21 -21
  32. package/network/RelayQueryResponseCache.d.ts +16 -0
  33. package/package.json +1 -1
  34. package/query/GraphQLTag.d.ts +45 -0
  35. package/query/fetchQuery.d.ts +21 -0
  36. package/query/fetchQueryInternal.d.ts +26 -0
  37. package/query/fetchQueryInternal.js.flow +4 -4
  38. package/query/fetchQuery_DEPRECATED.d.ts +17 -0
  39. package/store/ClientID.d.ts +14 -0
  40. package/store/DataChecker.js.flow +8 -6
  41. package/store/NormalizationEngine.js.flow +4 -1
  42. package/store/OperationExecutor.d.ts +51 -0
  43. package/store/OperationExecutor.js.flow +33 -30
  44. package/store/RelayModernEnvironment.d.ts +97 -0
  45. package/store/RelayModernEnvironment.js.flow +21 -21
  46. package/store/RelayModernOperationDescriptor.d.ts +28 -0
  47. package/store/RelayModernRecord.d.ts +92 -0
  48. package/store/RelayModernSelector.d.ts +123 -0
  49. package/store/RelayModernStore.d.ts +57 -0
  50. package/store/RelayOperationTracker.d.ts +29 -0
  51. package/store/RelayPublishQueue.js.flow +8 -8
  52. package/store/RelayRecordSource.d.ts +26 -0
  53. package/store/RelayRecordState.d.ts +28 -0
  54. package/store/RelayResponseNormalizer.d.ts +28 -0
  55. package/store/RelayResponseNormalizer.js.flow +8 -8
  56. package/store/RelayStoreTypes.d.ts +1327 -0
  57. package/store/RelayStoreTypes.js.flow +284 -280
  58. package/store/RelayStoreUtils.d.ts +86 -0
  59. package/store/RelayStoreUtils.js.flow +2 -2
  60. package/store/ResolverFragments.d.ts +43 -0
  61. package/store/ResolverFragments.js.flow +14 -6
  62. package/store/StoreInspector.js.flow +2 -2
  63. package/store/ViewerPattern.d.ts +11 -0
  64. package/store/createFragmentSpecResolver.d.ts +16 -0
  65. package/store/defaultGetDataID.js.flow +1 -1
  66. package/store/isRelayModernEnvironment.d.ts +8 -0
  67. package/store/live-resolvers/LiveResolverCache.js.flow +1 -1
  68. package/store/live-resolvers/resolverDataInjector.d.ts +27 -0
  69. package/store/observeFragmentExperimental.d.ts +46 -0
  70. package/store/observeFragmentExperimental.js.flow +1 -1
  71. package/store/observeQueryExperimental.d.ts +30 -0
  72. package/store/readInlineData.d.ts +19 -0
  73. package/store/readInlineData.js.flow +1 -1
  74. package/store/waitForFragmentExperimental.d.ts +49 -0
  75. package/subscription/requestSubscription.d.ts +27 -0
  76. package/subscription/requestSubscription.js.flow +3 -3
  77. package/util/JSResourceTypes.flow.js.flow +4 -4
  78. package/util/NormalizationNode.d.ts +235 -0
  79. package/util/NormalizationNode.js.flow +124 -122
  80. package/util/ReaderNode.d.ts +264 -0
  81. package/util/ReaderNode.js.flow +152 -149
  82. package/util/RelayConcreteNode.d.ts +120 -0
  83. package/util/RelayConcreteNode.js.flow +31 -31
  84. package/util/RelayError.d.ts +13 -0
  85. package/util/RelayFeatureFlags.d.ts +40 -0
  86. package/util/RelayProfiler.d.ts +121 -0
  87. package/util/RelayReplaySubject.d.ts +25 -0
  88. package/util/RelayRuntimeTypes.d.ts +59 -0
  89. package/util/RelayRuntimeTypes.js.flow +33 -30
  90. package/util/createPayloadFor3DField.d.ts +17 -0
  91. package/util/createPayloadFor3DField.js.flow +4 -4
  92. package/util/deepFreeze.d.ts +8 -0
  93. package/util/getFragmentIdentifier.d.ts +10 -0
  94. package/util/getPaginationMetadata.d.ts +20 -0
  95. package/util/getPaginationVariables.d.ts +20 -0
  96. package/util/getPendingOperationsForFragment.d.ts +18 -0
  97. package/util/getRefetchMetadata.d.ts +19 -0
  98. package/util/getRelayHandleKey.d.ts +8 -0
  99. package/util/getRequestIdentifier.d.ts +17 -0
  100. package/util/getValueAtPath.d.ts +8 -0
  101. package/util/handlePotentialSnapshotErrors.d.ts +14 -0
  102. package/util/isEmptyObject.js.flow +1 -1
  103. package/util/isPromise.d.ts +8 -0
  104. package/util/isScalarAndEqual.d.ts +8 -0
  105. package/util/recycleNodesInto.d.ts +8 -0
  106. package/util/stableCopy.d.ts +8 -0
  107. package/util/withProvidedVariables.d.ts +19 -0
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { Disposable } from './RelayRuntimeTypes';
9
+
10
+ export interface FeatureFlags {
11
+ ENABLE_VARIABLE_CONNECTION_KEY: boolean;
12
+ ENABLE_RELAY_RESOLVERS: boolean;
13
+ ENABLE_GETFRAGMENTIDENTIFIER_OPTIMIZATION: boolean;
14
+ ENABLE_FRIENDLY_QUERY_NAME_GQL_URL: boolean;
15
+ ENABLE_DO_NOT_WRAP_LIVE_QUERY: boolean;
16
+ ENABLE_NOTIFY_SUBSCRIPTION: boolean;
17
+ BATCH_ASYNC_MODULE_UPDATES_FN: null | undefined | ((callback: () => void) => Disposable);
18
+ ENABLE_CONTAINERS_SUBSCRIBE_ON_COMMIT: boolean;
19
+ MAX_DATA_ID_LENGTH: number | null | undefined;
20
+ STRING_INTERN_LEVEL: number;
21
+ LOG_MISSING_RECORDS_IN_PROD: boolean;
22
+ ENABLE_RELAY_OPERATION_TRACKER_SUSPENSE: boolean;
23
+ ENABLE_UI_CONTEXT_ON_RELAY_LOGGER: boolean;
24
+ ENABLE_NONCOMPLIANT_ERROR_HANDLING_ON_LISTS: boolean;
25
+ ENABLE_LOOSE_SUBSCRIPTION_ATTRIBUTION: boolean;
26
+ ENABLE_OPERATION_TRACKER_OPTIMISTIC_UPDATES: boolean;
27
+ PROCESS_OPTIMISTIC_UPDATE_BEFORE_SUBSCRIPTION: boolean;
28
+ MARK_RESOLVER_VALUES_AS_CLEAN_AFTER_FRAGMENT_REREAD: boolean;
29
+ ENABLE_CYLE_DETECTION_IN_VARIABLES: boolean;
30
+ ENABLE_ACTIVITY_COMPATIBILITY: boolean;
31
+ ENABLE_READ_TIME_RESOLVER_STORAGE_KEY_PREFIX: boolean;
32
+ ENABLE_USE_PAGINATION_IS_LOADING_FIX: boolean;
33
+ ENABLE_STORE_ID_COLLISION_LOGGING: boolean;
34
+ DISALLOW_NESTED_UPDATES: boolean;
35
+ ENABLE_TYPENAME_PREFIXED_DATA_ID: boolean;
36
+ CHECK_ALL_FRAGMENTS_FOR_MISSING_CLIENT_EDGES: boolean;
37
+ ENABLE_READER_FRAGMENTS_LOGGING: boolean;
38
+ }
39
+
40
+ export const RelayFeatureFlags: FeatureFlags;
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ export type Handler = (name: string, callback: () => void) => void;
9
+ export type ProfileHandler = (name: string, state?: any) => (error?: Error) => void;
10
+
11
+ /**
12
+ * Instruments methods to allow profiling various parts of Relay. Profiling code
13
+ * in Relay consists of three steps:
14
+ *
15
+ * - Instrument the function to be profiled.
16
+ * - Attach handlers to the instrumented function.
17
+ * - Run the code which triggers the handlers.
18
+ *
19
+ * Handlers attached to instrumented methods are called with an instrumentation
20
+ * name and a callback that must be synchronously executed:
21
+ *
22
+ * instrumentedMethod.attachHandler(function(name, callback) {
23
+ * const start = performance.now();
24
+ * callback();
25
+ * console.log('Duration', performance.now() - start);
26
+ * });
27
+ *
28
+ * Handlers for profiles are callbacks that return a stop method:
29
+ *
30
+ * RelayProfiler.attachProfileHandler('profileName', (name, state) => {
31
+ * const start = performance.now();
32
+ * return function stop(name, state) {
33
+ * console.log(`Duration (${name})`, performance.now() - start);
34
+ * }
35
+ * });
36
+ *
37
+ * In order to reduce the impact on performance in production, instrumented
38
+ * methods and profilers with names that begin with `@` will only be measured
39
+ * if `__DEV__` is true. This should be used for very hot functions.
40
+ */
41
+
42
+ export const RelayProfiler: {
43
+ /**
44
+ * Instruments methods on a class or object. This re-assigns the method in
45
+ * order to preserve function names in stack traces (which are detected by
46
+ * modern debuggers via heuristics). Example usage:
47
+ *
48
+ * const RelayStore = { primeCache: function() {...} };
49
+ * RelayProfiler.instrumentMethods(RelayStore, {
50
+ * primeCache: 'RelayStore.primeCache'
51
+ * });
52
+ *
53
+ * RelayStore.primeCache.attachHandler(...);
54
+ *
55
+ * As a result, the methods will be replaced by wrappers that provide the
56
+ * `attachHandler` and `detachHandler` methods.
57
+ */
58
+ instrumentMethods(object: () => void | object, names: { [key: string]: string }): void;
59
+
60
+ /**
61
+ * Wraps the supplied function with one that provides the `attachHandler` and
62
+ * `detachHandler` methods. Example usage:
63
+ *
64
+ * const printRelayQuery =
65
+ * RelayProfiler.instrument('printRelayQuery', printRelayQuery);
66
+ *
67
+ * printRelayQuery.attachHandler(...);
68
+ *
69
+ * NOTE: The instrumentation assumes that no handlers are attached or detached
70
+ * in the course of executing another handler.
71
+ */
72
+ instrument<T extends () => void>(name: string, originalFunction: T): T;
73
+
74
+ /**
75
+ * Attaches a handler to all methods instrumented with the supplied name.
76
+ *
77
+ * function createRenderer() {
78
+ * return RelayProfiler.instrument('render', function() {...});
79
+ * }
80
+ * const renderA = createRenderer();
81
+ * const renderB = createRenderer();
82
+ *
83
+ * // Only profiles `renderA`.
84
+ * renderA.attachHandler(...);
85
+ *
86
+ * // Profiles both `renderA` and `renderB`.
87
+ * RelayProfiler.attachAggregateHandler('render', ...);
88
+ */
89
+ attachAggregateHandler(name: string, handler: Handler): void;
90
+
91
+ /**
92
+ * Detaches a handler attached via `attachAggregateHandler`.
93
+ */
94
+ detachAggregateHandler(name: string, handler: Handler): void;
95
+
96
+ /**
97
+ * Instruments profiling for arbitrarily asynchronous code by a name.
98
+ *
99
+ * const timerProfiler = RelayProfiler.profile('timeout');
100
+ * setTimeout(function() {
101
+ * timerProfiler.stop();
102
+ * }, 1000);
103
+ *
104
+ * RelayProfiler.attachProfileHandler('timeout', ...);
105
+ *
106
+ * Arbitrary state can also be passed into `profile` as a second argument. The
107
+ * attached profile handlers will receive this as the second argument.
108
+ */
109
+ profile(name: string, state?: any): { stop: (error?: Error) => void };
110
+
111
+ /**
112
+ * Attaches a handler to profiles with the supplied name. You can also
113
+ * attach to the special name '*' which is a catch all.
114
+ */
115
+ attachProfileHandler(name: string, handler: ProfileHandler): void;
116
+
117
+ /**
118
+ * Detaches a handler attached via `attachProfileHandler`.
119
+ */
120
+ detachProfileHandler(name: string, handler: ProfileHandler): void;
121
+ };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import type {Observer, Sink, Subscription} from '../network/RelayObservable';
9
+
10
+ export type Event<T> = { kind: 'next'; data: T } | { kind: 'error'; error: Error } | { kind: 'complete' };
11
+
12
+ /**
13
+ * An implementation of a `ReplaySubject` for Relay Observables.
14
+ *
15
+ * Records events provided and synchronously plays them back to new subscribers,
16
+ * as well as forwarding new asynchronous events.
17
+ */
18
+ export class RelayReplaySubject<T> {
19
+ complete(): void;
20
+ error(error: Error): void;
21
+ next(data: T): void;
22
+ subscribe(observer: Observer<T> | Sink<T>): Subscription;
23
+ unsubscribe(): void;
24
+ getObserverCount(): number;
25
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ /**
9
+ * Represents any resource that must be explicitly disposed of. The most common
10
+ * use-case is as a return value for subscriptions, where calling `dispose()`
11
+ * would cancel the subscription.
12
+ */
13
+ export interface Disposable {
14
+ dispose: DisposeFn;
15
+ }
16
+
17
+ export type DataID = string;
18
+
19
+ export interface Variables {
20
+ [name: string]: any;
21
+ }
22
+
23
+ export interface OperationType {
24
+ readonly variables: Variables;
25
+ readonly response: unknown;
26
+ readonly rawResponse?: unknown | undefined;
27
+ }
28
+
29
+ export type VariablesOf<TQuery extends OperationType> = TQuery['variables'];
30
+
31
+ export type DisposeFn = () => void;
32
+
33
+ /**
34
+ * Settings for how a query response may be cached.
35
+ *
36
+ * - `force`: causes a query to be issued unconditionally, irrespective of the
37
+ * state of any configured response cache.
38
+ * - `poll`: causes a query to live update by polling at the specified interval
39
+ * in milliseconds. (This value will be passed to setTimeout.)
40
+ * - `liveConfigId`: causes a query to live update by calling GraphQLLiveQuery,
41
+ * it represents a configuration of gateway when doing live query
42
+ * - `metadata`: user-supplied metadata.
43
+ * - `transactionId`: a user-supplied value, intended for use as a unique id for
44
+ * a given instance of executing an operation.
45
+ */
46
+ export interface CacheConfig {
47
+ force?: boolean | null | undefined;
48
+ poll?: number | null | undefined;
49
+ liveConfigId?: string | null | undefined;
50
+ metadata?: { [key: string]: unknown } | undefined;
51
+ transactionId?: string | null | undefined;
52
+ }
53
+
54
+ /**
55
+ * Experimental
56
+ */
57
+ export type FetchQueryFetchPolicy = 'store-or-network' | 'network-only';
58
+ export type FetchPolicy = FetchQueryFetchPolicy | 'store-and-network' | 'store-only';
59
+ export type RenderPolicy = 'full' | 'partial';
@@ -32,16 +32,16 @@ export type Disposable = interface {dispose(): void};
32
32
  export type DataID = string;
33
33
 
34
34
  // Variables
35
- export type Variables = {+[string]: $FlowFixMe};
35
+ export type Variables = {readonly [string]: $FlowFixMe};
36
36
 
37
37
  /**
38
38
  * Generated operation flow types are subtypes of this.
39
39
  */
40
40
  export type OperationType = {
41
41
  // TODO(T33395812) Make this an open object type
42
- +variables: Variables,
43
- +response: unknown,
44
- +rawResponse?: {...},
42
+ readonly variables: Variables,
43
+ readonly response: unknown,
44
+ readonly rawResponse?: {...},
45
45
  };
46
46
 
47
47
  export type VariablesOf<T extends OperationType> = T['variables'];
@@ -62,14 +62,17 @@ export type VariablesOf<T extends 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]: unknown, ...},
72
- +transactionId?: ?string,
65
+ readonly force?: ?boolean,
66
+ readonly poll?: ?number,
67
+ readonly liveConfigId?: ?string,
68
+ readonly onSubscribe?: () => void,
69
+ readonly onResume?: (pauseTimeMs: number) => void,
70
+ readonly onPause?: (
71
+ mqttConnectionIsOk: boolean,
72
+ internetIsOk: boolean,
73
+ ) => void,
74
+ readonly metadata?: {readonly [key: string]: unknown, ...},
75
+ readonly transactionId?: ?string,
73
76
  };
74
77
 
75
78
  export type FetchQueryFetchPolicy = 'store-or-network' | 'network-only';
@@ -86,8 +89,8 @@ export type RenderPolicy = 'full' | 'partial';
86
89
  * Return type of graphql tag literals for all operations.
87
90
  */
88
91
  declare export opaque type Operation<
89
- -TVariables extends Variables,
90
- +TData,
92
+ in TVariables extends Variables,
93
+ out TData,
91
94
  TRawResponse,
92
95
  >: ConcreteRequest;
93
96
 
@@ -95,8 +98,8 @@ declare export opaque type Operation<
95
98
  * Return type of graphql tag literals for updatable queries.
96
99
  */
97
100
  declare export opaque type UpdatableQuery<
98
- -TVariables extends Variables,
99
- +TData,
101
+ in TVariables extends Variables,
102
+ out TData,
100
103
  >: ConcreteUpdatableQuery;
101
104
 
102
105
  /**
@@ -104,15 +107,15 @@ declare export opaque type UpdatableQuery<
104
107
  */
105
108
  declare export opaque type UpdatableFragment<
106
109
  TFragmentType,
107
- +TData,
110
+ out TData,
108
111
  >: ReaderFragment;
109
112
 
110
113
  /**
111
114
  * Return type of graphql tag literals for queries.
112
115
  */
113
116
  declare export opaque type Query<
114
- -TVariables extends Variables,
115
- +TData,
117
+ in TVariables extends Variables,
118
+ out TData,
116
119
  TRawResponse = void,
117
120
  >: Operation<TVariables, TData, TRawResponse>;
118
121
 
@@ -120,8 +123,8 @@ declare export opaque type Query<
120
123
  * Return type of graphql tag literals for client-only queries.
121
124
  */
122
125
  declare export opaque type ClientQuery<
123
- -TVariables extends Variables,
124
- +TData,
126
+ in TVariables extends Variables,
127
+ out TData,
125
128
  TRawResponse = void,
126
129
  >: ClientRequest;
127
130
 
@@ -129,8 +132,8 @@ declare export opaque type ClientQuery<
129
132
  * Return type of graphql tag literals for mutations.
130
133
  */
131
134
  declare export opaque type Mutation<
132
- -TVariables extends Variables,
133
- +TData,
135
+ in TVariables extends Variables,
136
+ out TData,
134
137
  TRawResponse = {...},
135
138
  >: Operation<TVariables, TData, TRawResponse>;
136
139
 
@@ -141,8 +144,8 @@ declare export opaque type Mutation<
141
144
  * `RelayObservable`'s `Subscription` type.
142
145
  */
143
146
  declare export opaque type GraphQLSubscription<
144
- -TVariables extends Variables,
145
- +TData,
147
+ in TVariables extends Variables,
148
+ out TData,
146
149
  TRawResponse = void,
147
150
  >: Operation<TVariables, TData, TRawResponse>;
148
151
 
@@ -151,21 +154,21 @@ declare export opaque type GraphQLSubscription<
151
154
  */
152
155
  declare export opaque type InlineFragment<
153
156
  TFragmentType,
154
- +TData,
157
+ out TData,
155
158
  >: ReaderInlineDataFragment;
156
159
 
157
160
  /**
158
161
  * Return type of graphql tag literals for fragments, except `@inline`
159
162
  * fragments.
160
163
  */
161
- declare export opaque type Fragment<TFragmentType, +TData>: ReaderFragment;
164
+ declare export opaque type Fragment<TFragmentType, out TData>: ReaderFragment;
162
165
 
163
166
  /**
164
167
  * Return type of graphql tag literals for `@refetchable` fragments.
165
168
  */
166
169
  declare export opaque type RefetchableFragment<
167
170
  TFragmentType,
168
- +TData,
171
+ out TData,
169
172
  TVariables extends Variables,
170
173
  >: Fragment<TFragmentType, TData>;
171
174
 
@@ -175,7 +178,7 @@ declare export opaque type RefetchableFragment<
175
178
  */
176
179
  declare export opaque type PrefetchableRefetchableFragment<
177
180
  TFragmentType,
178
- +TData,
179
- +TEdgeData,
181
+ out TData,
182
+ out TEdgeData,
180
183
  TVariables extends Variables,
181
184
  >: Fragment<TFragmentType, TData>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import type {JSResourceReference, NormalizationSplitOperation} from './NormalizationNode';
9
+
10
+ export type Local3DPayload<_DocumentName extends string, Response extends Record<string, unknown>> = Response;
11
+
12
+ export default function createPayloadFor3DField<DocumentName extends string, Response extends Record<string, unknown>>(
13
+ name: DocumentName,
14
+ operation: JSResourceReference<NormalizationSplitOperation>,
15
+ component: JSResourceReference<unknown>,
16
+ response: Response,
17
+ ): Local3DPayload<DocumentName, Response>;
@@ -21,15 +21,15 @@ const {
21
21
 
22
22
  export opaque type Local3DPayload<
23
23
  // eslint-disable-next-line no-unused-vars
24
- +DocumentName extends string,
25
- +Response extends {...},
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
- +DocumentName extends string,
30
+ out DocumentName extends string,
31
31
  // $FlowFixMe[unsupported-variance-annotation]
32
- +Response extends {...},
32
+ out Response extends {...},
33
33
  >(
34
34
  name: DocumentName,
35
35
  operation: JSResourceReference<NormalizationSplitOperation>,
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ export default function deepFreeze<T extends object>(value: T): T;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { ReaderFragment } from './ReaderNode';
9
+
10
+ export default function getFragmentIdentifier(fragmentNode: ReaderFragment, fragmentRef: any): string;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import {ReaderFragment, ReaderPaginationMetadata} from './ReaderNode';
9
+ import { ConcreteRequest } from './RelayConcreteNode';
10
+
11
+ export default function getPaginationMetadata(
12
+ fragmentNode: ReaderFragment,
13
+ componentDisplayName: string,
14
+ ): {
15
+ connectionPathInFragmentData: ReadonlyArray<string | number>;
16
+ identifierField: string | null | undefined;
17
+ paginationRequest: ConcreteRequest;
18
+ paginationMetadata: ReaderPaginationMetadata;
19
+ stream: boolean;
20
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { ReaderPaginationMetadata } from './ReaderNode';
9
+ import { Variables } from './RelayRuntimeTypes';
10
+
11
+ export type Direction = 'forward' | 'backward';
12
+
13
+ export default function getPaginationVariables(
14
+ direction: Direction,
15
+ count: number,
16
+ cursor: string | null | undefined,
17
+ baseVariables: Variables,
18
+ extraVariables: Variables,
19
+ paginationMetadata: ReaderPaginationMetadata,
20
+ ): { [key: string]: any };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import type {Environment, RequestDescriptor} from '../store/RelayStoreTypes';
9
+ import type { ReaderFragment } from './ReaderNode';
10
+
11
+ export default function getPendingOperationsForFragment(
12
+ environment: Environment,
13
+ fragmentNode: ReaderFragment,
14
+ fragmentOwner: RequestDescriptor,
15
+ ): {
16
+ promise: Promise<void>;
17
+ pendingOperations: readonly RequestDescriptor[];
18
+ } | null;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import {ReaderFragment, ReaderRefetchMetadata, RefetchableIdentifierInfo} from './ReaderNode';
9
+ import { ConcreteRequest } from './RelayConcreteNode';
10
+
11
+ export default function getRefetchMetadata(
12
+ fragmentNode: ReaderFragment,
13
+ componentDisplayName: string,
14
+ ): {
15
+ fragmentRefPathInResponse: ReadonlyArray<string | number>;
16
+ identifierInfo: RefetchableIdentifierInfo | null | undefined;
17
+ refetchableRequest: ConcreteRequest;
18
+ refetchMetadata: ReaderRefetchMetadata;
19
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ export default function getRelayHandleKey(handleName: string, key?: string | null, fieldName?: string | null): string;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { RequestParameters } from './RelayConcreteNode';
9
+ import { Variables } from './RelayRuntimeTypes';
10
+
11
+ export type RequestIdentifier = string;
12
+
13
+ /**
14
+ * Returns a stable identifier for the given pair of `RequestParameters` +
15
+ * variables.
16
+ */
17
+ export default function getRequestIdentifier(parameters: RequestParameters, variables: Variables): RequestIdentifier;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ export default function getValueAtPath(data: any, path: ReadonlyArray<string | number>): any;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import {Environment, MissingRequiredFields, RelayResolverErrors} from '../store/RelayStoreTypes';
9
+
10
+ export default function handlePotentialSnapshotErrors(
11
+ environment: Environment,
12
+ missingRequiredFields: MissingRequiredFields | null | undefined,
13
+ relayResolverErrors: RelayResolverErrors,
14
+ ): void;
@@ -14,7 +14,7 @@
14
14
  // $FlowFixMe[method-unbinding] added when improving typing for this parameters
15
15
  const hasOwnProperty = Object.prototype.hasOwnProperty;
16
16
 
17
- function isEmptyObject(obj: {+[key: string]: unknown}): boolean {
17
+ function isEmptyObject(obj: {readonly [key: string]: unknown}): boolean {
18
18
  for (const key in obj) {
19
19
  if (hasOwnProperty.call(obj, key)) {
20
20
  return false;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ export default function isPromise(p: any): p is Promise<any>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ export default function isScalarAndEqual(valueA: unknown, valueB: unknown): boolean;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ export default function recycleNodesInto<T>(prevData: T, nextData: T): T;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ export default function stableCopy<T>(value: T): T;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { ProvidedVariablesType } from './RelayConcreteNode';
9
+ import { Variables } from './RelayRuntimeTypes';
10
+
11
+ interface WithProvidedVariablesFn {
12
+ (
13
+ userSuppliedVariables: Variables,
14
+ providedVariables: ProvidedVariablesType | null | undefined,
15
+ ): Variables;
16
+ tests_only_resetDebugCache: undefined | (() => void);
17
+ }
18
+ declare const withProvidedVariables: WithProvidedVariablesFn;
19
+ export default withProvidedVariables;