relay-runtime 20.1.1 → 21.0.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 +1 -1
- package/experimental.js.flow +8 -8
- package/handlers/connection/ConnectionHandler.js.flow +5 -5
- package/handlers/connection/ConnectionInterface.js.flow +1 -1
- package/index.js +1 -1
- package/index.js.flow +125 -62
- package/lib/experimental.js +3 -3
- package/lib/index.js +105 -57
- package/lib/multi-actor-environment/ActorIdentifier.js +2 -2
- package/lib/multi-actor-environment/MultiActorEnvironment.js +3 -1
- package/lib/mutations/commitMutation.js +8 -8
- package/lib/mutations/validateMutation.js +4 -4
- package/lib/query/GraphQLTag.js +3 -3
- package/lib/query/fetchQuery.js +15 -3
- package/lib/store/DataChecker.js +38 -4
- package/lib/store/NormalizationEngine.js +373 -0
- package/lib/store/OperationExecutor.js +172 -113
- package/lib/store/RelayConcreteVariables.js +1 -1
- package/lib/store/RelayErrorTrie.js +2 -2
- package/lib/store/RelayExperimentalGraphResponseTransform.js +8 -8
- package/lib/store/RelayModernEnvironment.js +26 -19
- package/lib/store/RelayModernRecord.js +18 -8
- package/lib/store/RelayModernSelector.js +9 -9
- package/lib/store/RelayModernStore.js +152 -43
- package/lib/store/RelayPublishQueue.js +1 -1
- package/lib/store/RelayReader.js +76 -38
- package/lib/store/RelayRecordSource.js +6 -0
- package/lib/store/RelayReferenceMarker.js +2 -1
- package/lib/store/RelayResponseNormalizer.js +88 -55
- package/lib/store/RelayStoreSubscriptions.js +34 -10
- package/lib/store/RelayStoreUtils.js +8 -1
- package/lib/store/ResolverFragments.js +2 -2
- package/lib/store/live-resolvers/LiveResolverCache.js +25 -9
- package/lib/store/observeFragmentExperimental.js +17 -1
- package/lib/store/observeQueryExperimental.js +2 -2
- package/lib/subscription/requestSubscription.js +3 -3
- package/lib/util/RelayError.js +3 -0
- package/lib/util/RelayFeatureFlags.js +6 -2
- package/lib/util/RelayReplaySubject.js +4 -4
- package/lib/util/handlePotentialSnapshotErrors.js +2 -2
- package/lib/util/stableCopy.js +2 -2
- package/llm-docs/api-reference/entrypoint-apis/entrypoint-container.mdx +38 -0
- package/llm-docs/api-reference/entrypoint-apis/load-entrypoint.mdx +77 -0
- package/llm-docs/api-reference/entrypoint-apis/use-entrypoint-loader.mdx +99 -0
- package/llm-docs/api-reference/graphql/graphql-directives.mdx +378 -0
- package/llm-docs/api-reference/hooks/_use-lazy-load-query-extra.mdx +16 -0
- package/llm-docs/api-reference/hooks/load-query.mdx +84 -0
- package/llm-docs/api-reference/hooks/relay-environment-provider.mdx +78 -0
- package/llm-docs/api-reference/hooks/use-client-query.mdx +65 -0
- package/llm-docs/api-reference/hooks/use-fragment.mdx +69 -0
- package/llm-docs/api-reference/hooks/use-lazy-load-query.mdx +62 -0
- package/llm-docs/api-reference/hooks/use-mutation.mdx +94 -0
- package/llm-docs/api-reference/hooks/use-pagination-fragment.mdx +166 -0
- package/llm-docs/api-reference/hooks/use-prefetchable-forward-pagination-fragment.mdx +134 -0
- package/llm-docs/api-reference/hooks/use-preloaded-query.mdx +84 -0
- package/llm-docs/api-reference/hooks/use-query-loader.mdx +95 -0
- package/llm-docs/api-reference/hooks/use-refetchable-fragment.mdx +122 -0
- package/llm-docs/api-reference/hooks/use-relay-environment.mdx +37 -0
- package/llm-docs/api-reference/hooks/use-subscription.mdx +66 -0
- package/llm-docs/api-reference/relay-resolvers/docblock-format.mdx +321 -0
- package/llm-docs/api-reference/relay-resolvers/runtime-functions.mdx +94 -0
- package/llm-docs/api-reference/relay-runtime/commit-mutation.mdx +65 -0
- package/llm-docs/api-reference/relay-runtime/fetch-query.mdx +113 -0
- package/llm-docs/api-reference/relay-runtime/field-logger.mdx +170 -0
- package/llm-docs/api-reference/relay-runtime/observe-fragment.mdx +92 -0
- package/llm-docs/api-reference/relay-runtime/relay-environment.mdx +53 -0
- package/llm-docs/api-reference/relay-runtime/request-subscription.mdx +54 -0
- package/llm-docs/api-reference/relay-runtime/runtime-configuration.mdx +52 -0
- package/llm-docs/api-reference/relay-runtime/store.mdx +734 -0
- package/llm-docs/api-reference/relay-runtime/wait-for-fragment-data.mdx +89 -0
- package/llm-docs/api-reference/types/CacheConfig.mdx +8 -0
- package/llm-docs/api-reference/types/Disposable.mdx +4 -0
- package/llm-docs/api-reference/types/GraphQLSubscriptionConfig.mdx +17 -0
- package/llm-docs/api-reference/types/MutationConfig.mdx +31 -0
- package/llm-docs/api-reference/types/SelectorStoreUpdater.mdx +6 -0
- package/llm-docs/api-reference/types/UploadableMap.mdx +3 -0
- package/llm-docs/community/learning-resources.mdx +64 -0
- package/llm-docs/debugging/declarative-mutation-directives.mdx +34 -0
- package/llm-docs/debugging/disallowed-id-types-error.mdx +43 -0
- package/llm-docs/debugging/inconsistent-typename-error.mdx +47 -0
- package/llm-docs/debugging/relay-devtools.mdx +73 -0
- package/llm-docs/debugging/why-null.mdx +116 -0
- package/llm-docs/editor-support.mdx +55 -0
- package/llm-docs/error-reference/unknown-field.mdx +36 -0
- package/llm-docs/getting-started/babel-plugin.mdx +31 -0
- package/llm-docs/getting-started/compiler-config.mdx +25 -0
- package/llm-docs/getting-started/compiler.mdx +82 -0
- package/llm-docs/getting-started/lint-rules.mdx +87 -0
- package/llm-docs/getting-started/production.mdx +30 -0
- package/llm-docs/getting-started/quick-start.mdx +213 -0
- package/llm-docs/glossary/glossary.mdx +1040 -0
- package/llm-docs/guided-tour/list-data/advanced-pagination.mdx +157 -0
- package/llm-docs/guided-tour/list-data/connections.mdx +81 -0
- package/llm-docs/guided-tour/list-data/pagination.mdx +193 -0
- package/llm-docs/guided-tour/list-data/rendering-connections.mdx +112 -0
- package/llm-docs/guided-tour/list-data/streaming-pagination.mdx +87 -0
- package/llm-docs/guided-tour/managing-data-outside-react/retaining-queries.mdx +51 -0
- package/llm-docs/guided-tour/refetching/refetching-queries-with-different-data.mdx +337 -0
- package/llm-docs/guided-tour/refetching/refreshing-queries.mdx +350 -0
- package/llm-docs/guided-tour/rendering/environment.mdx +59 -0
- package/llm-docs/guided-tour/rendering/error-states.mdx +295 -0
- package/llm-docs/guided-tour/rendering/fragments.mdx +354 -0
- package/llm-docs/guided-tour/rendering/loading-states.mdx +245 -0
- package/llm-docs/guided-tour/rendering/queries.mdx +261 -0
- package/llm-docs/guided-tour/rendering/variables.mdx +233 -0
- package/llm-docs/guided-tour/reusing-cached-data/fetch-policies.mdx +56 -0
- package/llm-docs/guided-tour/reusing-cached-data/filling-in-missing-data.mdx +102 -0
- package/llm-docs/guided-tour/reusing-cached-data/introduction.mdx +22 -0
- package/llm-docs/guided-tour/reusing-cached-data/presence-of-data.mdx +93 -0
- package/llm-docs/guided-tour/reusing-cached-data/rendering-partially-cached-data.mdx +175 -0
- package/llm-docs/guided-tour/reusing-cached-data/staleness-of-data.mdx +116 -0
- package/llm-docs/guided-tour/updating-data/client-only-data.mdx +115 -0
- package/llm-docs/guided-tour/updating-data/graphql-mutations.mdx +334 -0
- package/llm-docs/guided-tour/updating-data/graphql-subscriptions.mdx +279 -0
- package/llm-docs/guided-tour/updating-data/imperatively-modifying-linked-fields.mdx +511 -0
- package/llm-docs/guided-tour/updating-data/imperatively-modifying-store-data-legacy.mdx +142 -0
- package/llm-docs/guided-tour/updating-data/imperatively-modifying-store-data.mdx +275 -0
- package/llm-docs/guided-tour/updating-data/introduction.mdx +25 -0
- package/llm-docs/guided-tour/updating-data/local-data-updates.mdx +71 -0
- package/llm-docs/guided-tour/updating-data/typesafe-updaters-faq.mdx +83 -0
- package/llm-docs/guided-tour/updating-data/updating-connections.mdx +592 -0
- package/llm-docs/guides/alias-directive.mdx +160 -0
- package/llm-docs/guides/catch-directive.mdx +167 -0
- package/llm-docs/guides/client-schema-extensions.mdx +208 -0
- package/llm-docs/guides/codemods.mdx +66 -0
- package/llm-docs/guides/data-driven-dependencies/client-3d.mdx +255 -0
- package/llm-docs/guides/data-driven-dependencies/configuration.mdx +127 -0
- package/llm-docs/guides/data-driven-dependencies/introduction.mdx +39 -0
- package/llm-docs/guides/data-driven-dependencies/server-3d.mdx +664 -0
- package/llm-docs/guides/document-comparison.mdx +106 -0
- package/llm-docs/guides/graphql-server-specification.mdx +453 -0
- package/llm-docs/guides/network-layer.mdx +69 -0
- package/llm-docs/guides/persisted-queries.mdx +328 -0
- package/llm-docs/guides/relay-resolvers/context.mdx +99 -0
- package/llm-docs/guides/relay-resolvers/defining-fields.mdx +151 -0
- package/llm-docs/guides/relay-resolvers/defining-types.mdx +164 -0
- package/llm-docs/guides/relay-resolvers/deprecated.mdx +27 -0
- package/llm-docs/guides/relay-resolvers/derived-fields.mdx +127 -0
- package/llm-docs/guides/relay-resolvers/descriptions.mdx +44 -0
- package/llm-docs/guides/relay-resolvers/enabling.mdx +41 -0
- package/llm-docs/guides/relay-resolvers/errors.mdx +64 -0
- package/llm-docs/guides/relay-resolvers/field-arguments.mdx +63 -0
- package/llm-docs/guides/relay-resolvers/introduction.mdx +62 -0
- package/llm-docs/guides/relay-resolvers/limitations.mdx +30 -0
- package/llm-docs/guides/relay-resolvers/live-fields.mdx +164 -0
- package/llm-docs/guides/relay-resolvers/return-types.mdx +161 -0
- package/llm-docs/guides/relay-resolvers/suspense.mdx +41 -0
- package/llm-docs/guides/required-directive.mdx +240 -0
- package/llm-docs/guides/semantic-nullability.mdx +93 -0
- package/llm-docs/guides/testing-relay-components.mdx +642 -0
- package/llm-docs/guides/testing-relay-with-preloaded-queries.mdx +160 -0
- package/llm-docs/guides/throw-on-field-error-directive.mdx +58 -0
- package/llm-docs/guides/type-emission.mdx +414 -0
- package/llm-docs/home.mdx +32 -0
- package/llm-docs/principles-and-architecture/architecture-overview.mdx +24 -0
- package/llm-docs/principles-and-architecture/compiler-architecture.mdx +106 -0
- package/llm-docs/principles-and-architecture/runtime-architecture.mdx +249 -0
- package/llm-docs/principles-and-architecture/thinking-in-graphql.mdx +309 -0
- package/llm-docs/principles-and-architecture/thinking-in-relay.mdx +104 -0
- package/llm-docs/principles-and-architecture/videos.mdx +50 -0
- package/llm-docs/tutorial/arrays-lists.mdx +126 -0
- package/llm-docs/tutorial/fragments-1.mdx +487 -0
- package/llm-docs/tutorial/graphql.mdx +172 -0
- package/llm-docs/tutorial/interfaces-polymorphism.mdx +161 -0
- package/llm-docs/tutorial/intro.mdx +58 -0
- package/llm-docs/tutorial/mutations-updates.mdx +624 -0
- package/llm-docs/tutorial/organizing-mutations-queries-and-subscriptions.mdx +13 -0
- package/llm-docs/tutorial/queries-1.mdx +267 -0
- package/llm-docs/tutorial/queries-2.mdx +389 -0
- package/llm-docs/tutorial/refetchable-fragments.mdx +352 -0
- package/multi-actor-environment/ActorIdentifier.js.flow +2 -2
- package/multi-actor-environment/ActorSpecificEnvironment.js.flow +7 -7
- package/multi-actor-environment/ActorUtils.js.flow +1 -1
- package/multi-actor-environment/MultiActorEnvironment.js.flow +12 -8
- package/multi-actor-environment/MultiActorEnvironmentTypes.js.flow +3 -3
- package/mutations/RelayDeclarativeMutationConfig.js.flow +9 -9
- package/mutations/RelayRecordProxy.js.flow +8 -11
- package/mutations/RelayRecordSourceMutator.js.flow +4 -4
- package/mutations/RelayRecordSourceProxy.js.flow +4 -4
- package/mutations/RelayRecordSourceSelectorProxy.js.flow +6 -6
- package/mutations/applyOptimisticMutation.js.flow +2 -2
- package/mutations/commitMutation.js.flow +20 -16
- package/mutations/createUpdatableProxy.js.flow +19 -19
- package/mutations/readUpdatableFragment.js.flow +3 -3
- package/mutations/readUpdatableQuery.js.flow +3 -3
- package/mutations/validateMutation.js.flow +7 -7
- package/network/RelayNetworkTypes.js.flow +4 -4
- package/network/RelayObservable.js.flow +16 -14
- package/network/RelayQueryResponseCache.js.flow +3 -3
- package/network/wrapNetworkWithLogObserver.js.flow +1 -1
- package/package.json +2 -1
- package/query/GraphQLTag.js.flow +22 -10
- package/query/fetchQuery.js.flow +23 -10
- package/query/fetchQuery_DEPRECATED.js.flow +1 -1
- package/store/DataChecker.js.flow +43 -9
- package/store/NormalizationEngine.js.flow +779 -0
- package/store/OperationExecutor.js.flow +173 -70
- package/store/RelayConcreteVariables.js.flow +5 -5
- package/store/RelayErrorTrie.js.flow +12 -12
- package/store/RelayExperimentalGraphResponseHandler.js.flow +3 -3
- package/store/RelayExperimentalGraphResponseTransform.js.flow +10 -10
- package/store/RelayModernEnvironment.js.flow +41 -26
- package/store/RelayModernFragmentSpecResolver.js.flow +1 -1
- package/store/RelayModernOperationDescriptor.js.flow +1 -1
- package/store/RelayModernRecord.js.flow +44 -20
- package/store/RelayModernSelector.js.flow +21 -21
- package/store/RelayModernStore.js.flow +219 -58
- package/store/RelayOperationTracker.js.flow +2 -2
- package/store/RelayOptimisticRecordSource.js.flow +2 -2
- package/store/RelayPublishQueue.js.flow +21 -12
- package/store/RelayReader.js.flow +129 -57
- package/store/RelayRecordSource.js.flow +10 -0
- package/store/RelayRecordState.js.flow +1 -1
- package/store/RelayReferenceMarker.js.flow +5 -4
- package/store/RelayResponseNormalizer.js.flow +125 -57
- package/store/RelayStoreSubscriptions.js.flow +52 -8
- package/store/RelayStoreTypes.js.flow +153 -64
- package/store/RelayStoreUtils.js.flow +15 -7
- package/store/ResolverCache.js.flow +2 -2
- package/store/ResolverFragments.js.flow +12 -12
- package/store/StoreInspector.js.flow +6 -7
- package/store/cloneRelayHandleSourceField.js.flow +1 -1
- package/store/cloneRelayScalarHandleSourceField.js.flow +1 -1
- package/store/createRelayContext.js.flow +1 -1
- package/store/createRelayLoggingContext.js.flow +4 -4
- package/store/defaultGetDataID.js.flow +2 -2
- package/store/isRelayModernEnvironment.js.flow +4 -2
- package/store/live-resolvers/LiveResolverCache.js.flow +55 -20
- package/store/live-resolvers/LiveResolverSuspenseSentinel.js.flow +3 -3
- package/store/live-resolvers/getOutputTypeRecordIDs.js.flow +1 -1
- package/store/live-resolvers/isLiveStateValue.js.flow +2 -2
- package/store/live-resolvers/resolverDataInjector.js.flow +8 -5
- package/store/observeFragmentExperimental.js.flow +49 -20
- package/store/observeQueryExperimental.js.flow +5 -5
- package/store/readInlineData.js.flow +4 -4
- package/store/waitForFragmentExperimental.js.flow +3 -3
- package/subscription/requestSubscription.js.flow +7 -7
- package/util/NormalizationNode.js.flow +34 -32
- package/util/ReaderNode.js.flow +32 -30
- package/util/RelayConcreteNode.js.flow +5 -5
- package/util/RelayError.js.flow +4 -1
- package/util/RelayFeatureFlags.js.flow +21 -1
- package/util/RelayProfiler.js.flow +1 -1
- package/util/RelayReplaySubject.js.flow +3 -3
- package/util/RelayRuntimeTypes.js.flow +11 -11
- package/util/createPayloadFor3DField.js.flow +9 -5
- package/util/deepFreeze.js.flow +2 -2
- package/util/getFragmentIdentifier.js.flow +1 -1
- package/util/getPaginationMetadata.js.flow +1 -1
- package/util/getPaginationVariables.js.flow +1 -1
- package/util/getPendingOperationsForFragment.js.flow +2 -2
- package/util/getRefetchMetadata.js.flow +6 -5
- package/util/getValueAtPath.js.flow +3 -3
- package/util/handlePotentialSnapshotErrors.js.flow +5 -5
- package/util/isEmptyObject.js.flow +1 -1
- package/util/isPromise.js.flow +2 -2
- package/util/isScalarAndEqual.js.flow +1 -1
- package/util/recycleNodesInto.js.flow +2 -2
- package/util/registerEnvironmentWithDevTools.js.flow +1 -1
- package/util/shallowFreeze.js.flow +1 -1
- package/util/stableCopy.js.flow +5 -5
- package/util/withProvidedVariables.js.flow +14 -10
|
@@ -30,6 +30,7 @@ import type {
|
|
|
30
30
|
NormalizationRootNode,
|
|
31
31
|
NormalizationScalarField,
|
|
32
32
|
NormalizationSelectableNode,
|
|
33
|
+
NormalizationSelection,
|
|
33
34
|
} from '../util/NormalizationNode';
|
|
34
35
|
import type {
|
|
35
36
|
ReaderClientEdgeToServerObject,
|
|
@@ -75,7 +76,7 @@ export type FragmentMap = {[key: string]: ReaderFragment, ...};
|
|
|
75
76
|
/**
|
|
76
77
|
* The results of a selector given a store/RecordSource.
|
|
77
78
|
*/
|
|
78
|
-
export type SelectorData = {[key: string]:
|
|
79
|
+
export type SelectorData = {[key: string]: unknown, ...};
|
|
79
80
|
|
|
80
81
|
export type SingularReaderSelector = {
|
|
81
82
|
+kind: 'SingularReaderSelector',
|
|
@@ -91,7 +92,7 @@ export type ReaderSelector = SingularReaderSelector | PluralReaderSelector;
|
|
|
91
92
|
|
|
92
93
|
export type PluralReaderSelector = {
|
|
93
94
|
+kind: 'PluralReaderSelector',
|
|
94
|
-
+selectors:
|
|
95
|
+
+selectors: ReadonlyArray<SingularReaderSelector>,
|
|
95
96
|
};
|
|
96
97
|
|
|
97
98
|
export type FieldErrorType =
|
|
@@ -132,7 +133,7 @@ export type ClientEdgeTraversalInfo = {
|
|
|
132
133
|
};
|
|
133
134
|
|
|
134
135
|
export type ClientEdgeTraversalPath =
|
|
135
|
-
|
|
136
|
+
ReadonlyArray<ClientEdgeTraversalInfo | null>;
|
|
136
137
|
|
|
137
138
|
export type MissingClientEdgeRequestInfo = {
|
|
138
139
|
+request: ConcreteRequest,
|
|
@@ -145,8 +146,8 @@ export type MissingClientEdgeRequestInfo = {
|
|
|
145
146
|
export type Snapshot = {
|
|
146
147
|
+data: ?SelectorData,
|
|
147
148
|
+isMissingData: boolean,
|
|
148
|
-
+missingLiveResolverFields?:
|
|
149
|
-
+missingClientEdges: null |
|
|
149
|
+
+missingLiveResolverFields?: ReadonlyArray<DataID>,
|
|
150
|
+
+missingClientEdges: null | ReadonlyArray<MissingClientEdgeRequestInfo>,
|
|
150
151
|
+seenRecords: DataIDSet,
|
|
151
152
|
+selector: SingularReaderSelector,
|
|
152
153
|
+fieldErrors: ?FieldErrors,
|
|
@@ -170,7 +171,7 @@ export type OperationDescriptor = {
|
|
|
170
171
|
/**
|
|
171
172
|
* Arbitrary data e.g. received by a container as props.
|
|
172
173
|
*/
|
|
173
|
-
export type Props = {[key: string]:
|
|
174
|
+
export type Props = {[key: string]: unknown, ...};
|
|
174
175
|
|
|
175
176
|
/**
|
|
176
177
|
* The type of the `relay` property set on React context by the React/Relay
|
|
@@ -187,7 +188,7 @@ export type RelayContext = {
|
|
|
187
188
|
* The results of reading the results of a FragmentMap given some input
|
|
188
189
|
* `Props`.
|
|
189
190
|
*/
|
|
190
|
-
export type FragmentSpecResults = {[key: string]:
|
|
191
|
+
export type FragmentSpecResults = {[key: string]: unknown, ...};
|
|
191
192
|
|
|
192
193
|
/**
|
|
193
194
|
* A utility for resolving and subscribing to the results of a fragment spec
|
|
@@ -258,7 +259,7 @@ export interface MutableRecordSource extends RecordSource {
|
|
|
258
259
|
}
|
|
259
260
|
|
|
260
261
|
export type CheckOptions = {
|
|
261
|
-
+handlers:
|
|
262
|
+
+handlers: ReadonlyArray<MissingFieldHandler>,
|
|
262
263
|
+defaultActorIdentifier: ActorIdentifier,
|
|
263
264
|
+getTargetForActor: (actorIdentifier: ActorIdentifier) => MutableRecordSource,
|
|
264
265
|
+getSourceForActor: (actorIdentifier: ActorIdentifier) => RecordSource,
|
|
@@ -306,7 +307,7 @@ export interface Store {
|
|
|
306
307
|
notify(
|
|
307
308
|
sourceOperation?: OperationDescriptor,
|
|
308
309
|
invalidateStore?: boolean,
|
|
309
|
-
):
|
|
310
|
+
): ReadonlyArray<RequestDescriptor>;
|
|
310
311
|
|
|
311
312
|
/**
|
|
312
313
|
* Publish new information (e.g. from the network) to the store, updating its
|
|
@@ -354,7 +355,7 @@ export interface Store {
|
|
|
354
355
|
* Will return an opaque snapshot of the current invalidation state of
|
|
355
356
|
* the data ids that were provided.
|
|
356
357
|
*/
|
|
357
|
-
lookupInvalidationState(dataIDs:
|
|
358
|
+
lookupInvalidationState(dataIDs: ReadonlyArray<DataID>): InvalidationState;
|
|
358
359
|
|
|
359
360
|
/**
|
|
360
361
|
* Given the previous invalidation state for those
|
|
@@ -422,6 +423,16 @@ export interface StoreSubscriptions {
|
|
|
422
423
|
sourceOperation?: OperationDescriptor,
|
|
423
424
|
): void;
|
|
424
425
|
|
|
426
|
+
/**
|
|
427
|
+
* Same as `updateSubscriptions`, except it only notifies subscriptions with stale snapshots.
|
|
428
|
+
*/
|
|
429
|
+
updateStaleSubscriptions(
|
|
430
|
+
source: RecordSource,
|
|
431
|
+
updatedRecordIDs: DataIDSet,
|
|
432
|
+
updatedOwners: Array<RequestDescriptor>,
|
|
433
|
+
sourceOperation?: OperationDescriptor,
|
|
434
|
+
): void;
|
|
435
|
+
|
|
425
436
|
/**
|
|
426
437
|
* returns the number of subscriptions
|
|
427
438
|
*/
|
|
@@ -461,23 +472,23 @@ export interface RecordProxy {
|
|
|
461
472
|
args?: ?Variables,
|
|
462
473
|
): RecordProxy;
|
|
463
474
|
getType(): string;
|
|
464
|
-
getValue(name: string, args?: ?Variables):
|
|
465
|
-
getErrors(name: string, args?: ?Variables):
|
|
475
|
+
getValue(name: string, args?: ?Variables): unknown;
|
|
476
|
+
getErrors(name: string, args?: ?Variables): ?ReadonlyArray<TRelayFieldError>;
|
|
466
477
|
setLinkedRecord(
|
|
467
478
|
record: RecordProxy,
|
|
468
479
|
name: string,
|
|
469
480
|
args?: ?Variables,
|
|
470
481
|
): RecordProxy;
|
|
471
482
|
setLinkedRecords(
|
|
472
|
-
records:
|
|
483
|
+
records: ReadonlyArray<?RecordProxy>,
|
|
473
484
|
name: string,
|
|
474
485
|
args?: ?Variables,
|
|
475
486
|
): RecordProxy;
|
|
476
487
|
setValue(
|
|
477
|
-
value:
|
|
488
|
+
value: unknown,
|
|
478
489
|
name: string,
|
|
479
490
|
args?: ?Variables,
|
|
480
|
-
errors?:
|
|
491
|
+
errors?: ?ReadonlyArray<TRelayFieldError>,
|
|
481
492
|
): RecordProxy;
|
|
482
493
|
invalidateRecord(): void;
|
|
483
494
|
}
|
|
@@ -487,7 +498,7 @@ export interface ReadOnlyRecordProxy {
|
|
|
487
498
|
getLinkedRecord(name: string, args?: ?Variables): ?RecordProxy;
|
|
488
499
|
getLinkedRecords(name: string, args?: ?Variables): ?Array<?RecordProxy>;
|
|
489
500
|
getType(): string;
|
|
490
|
-
getValue(name: string, args?: ?Variables):
|
|
501
|
+
getValue(name: string, args?: ?Variables): unknown;
|
|
491
502
|
}
|
|
492
503
|
|
|
493
504
|
/**
|
|
@@ -520,11 +531,11 @@ export interface RecordSourceProxy {
|
|
|
520
531
|
get(dataID: DataID): ?RecordProxy;
|
|
521
532
|
getRoot(): RecordProxy;
|
|
522
533
|
invalidateStore(): void;
|
|
523
|
-
readUpdatableQuery<TVariables
|
|
534
|
+
readUpdatableQuery<TVariables extends Variables, TData>(
|
|
524
535
|
query: UpdatableQuery<TVariables, TData>,
|
|
525
536
|
variables: TVariables,
|
|
526
537
|
): UpdatableData<TData>;
|
|
527
|
-
readUpdatableFragment<TFragmentType
|
|
538
|
+
readUpdatableFragment<TFragmentType extends FragmentType, TData>(
|
|
528
539
|
fragment: UpdatableFragment<TFragmentType, TData>,
|
|
529
540
|
fragmentReference: HasUpdatableSpread<TFragmentType>,
|
|
530
541
|
): UpdatableData<TData>;
|
|
@@ -547,12 +558,35 @@ export interface RecordSourceSelectorProxy extends RecordSourceProxy {
|
|
|
547
558
|
|
|
548
559
|
export type SuspenseFragmentLogEvent = {
|
|
549
560
|
+name: 'suspense.fragment',
|
|
550
|
-
+data:
|
|
561
|
+
+data: unknown,
|
|
551
562
|
+fragment: ReaderFragment,
|
|
552
563
|
+isRelayHooks: boolean,
|
|
553
564
|
+isMissingData: boolean,
|
|
554
565
|
+isPromiseCached: boolean,
|
|
555
|
-
+pendingOperations:
|
|
566
|
+
+pendingOperations: ReadonlyArray<RequestDescriptor>,
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
export type SuspenseResolverLogEvent = {
|
|
570
|
+
+name: 'suspense.resolver',
|
|
571
|
+
+fragment: ReaderFragment,
|
|
572
|
+
+fragmentOwner: RequestDescriptor,
|
|
573
|
+
+isMount: boolean,
|
|
574
|
+
+suspendingLiveResolvers: ReadonlyArray<DataID>,
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
export type SuspenseClientEdgeLogEvent = {
|
|
578
|
+
+name: 'suspense.client_edge',
|
|
579
|
+
+fragment: ReaderFragment,
|
|
580
|
+
+fragmentOwner: RequestDescriptor,
|
|
581
|
+
+isMount: boolean,
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
export type SuspenseMissingDataLogEvent = {
|
|
585
|
+
+name: 'suspense.missing_data',
|
|
586
|
+
+fragment: ReaderFragment,
|
|
587
|
+
+fragmentOwner: RequestDescriptor,
|
|
588
|
+
+isMount: boolean,
|
|
589
|
+
+pendingOperations: ReadonlyArray<RequestDescriptor>,
|
|
556
590
|
};
|
|
557
591
|
|
|
558
592
|
export type SuspenseQueryLogEvent = {
|
|
@@ -571,7 +605,7 @@ export type QueryResourceFetchLogEvent = {
|
|
|
571
605
|
+resourceID: number,
|
|
572
606
|
+operation: OperationDescriptor,
|
|
573
607
|
// value from ProfilerContext
|
|
574
|
-
+profilerContext:
|
|
608
|
+
+profilerContext: unknown,
|
|
575
609
|
// FetchPolicy from Relay Hooks
|
|
576
610
|
+fetchPolicy: string,
|
|
577
611
|
// RenderPolicy from Relay Hooks
|
|
@@ -584,14 +618,14 @@ export type QueryResourceRetainLogEvent = {
|
|
|
584
618
|
+name: 'queryresource.retain',
|
|
585
619
|
+resourceID: number,
|
|
586
620
|
// value from ProfilerContext
|
|
587
|
-
+profilerContext:
|
|
621
|
+
+profilerContext: unknown,
|
|
588
622
|
};
|
|
589
623
|
|
|
590
624
|
export type FragmentResourceMissingDataLogEvent = {
|
|
591
625
|
// Indicates FragmentResource is going to return a result that is missing
|
|
592
626
|
// data.
|
|
593
627
|
+name: 'fragmentresource.missing_data',
|
|
594
|
-
+data:
|
|
628
|
+
+data: unknown,
|
|
595
629
|
+fragment: ReaderFragment,
|
|
596
630
|
+isRelayHooks: boolean,
|
|
597
631
|
// Are we reading this result from the fragment resource cache?
|
|
@@ -605,13 +639,13 @@ export type PendingOperationFoundLogEvent = {
|
|
|
605
639
|
+name: 'pendingoperation.found',
|
|
606
640
|
+fragment: ReaderFragment,
|
|
607
641
|
+fragmentOwner: RequestDescriptor,
|
|
608
|
-
+pendingOperations:
|
|
642
|
+
+pendingOperations: ReadonlyArray<RequestDescriptor>,
|
|
609
643
|
};
|
|
610
644
|
|
|
611
645
|
export type NetworkInfoLogEvent = {
|
|
612
646
|
+name: 'network.info',
|
|
613
647
|
+networkRequestId: number,
|
|
614
|
-
+info:
|
|
648
|
+
+info: unknown,
|
|
615
649
|
};
|
|
616
650
|
|
|
617
651
|
export type NetworkStartLogEvent = {
|
|
@@ -709,6 +743,14 @@ export type StoreDataCheckerEndEvent = {
|
|
|
709
743
|
+selector: NormalizationSelector,
|
|
710
744
|
};
|
|
711
745
|
|
|
746
|
+
export type StoreDataCheckerMissingEvent = {
|
|
747
|
+
+name: 'store.datachecker.missing',
|
|
748
|
+
+kind: 'scalar' | 'linked' | 'pluralLinked' | 'unknown_record',
|
|
749
|
+
+dataID: DataID,
|
|
750
|
+
+fieldName?: string,
|
|
751
|
+
+storageKey?: string,
|
|
752
|
+
};
|
|
753
|
+
|
|
712
754
|
export type StorePublishLogEvent = {
|
|
713
755
|
+name: 'store.publish',
|
|
714
756
|
+source: RecordSource,
|
|
@@ -746,6 +788,16 @@ export type StoreGcEndEvent = {
|
|
|
746
788
|
+references: DataIDSet,
|
|
747
789
|
};
|
|
748
790
|
|
|
791
|
+
export type StoreBatchStartLogEvent = {
|
|
792
|
+
+name: 'store.batch.start',
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
export type StoreBatchCompleteLogEvent = {
|
|
796
|
+
+name: 'store.batch.complete',
|
|
797
|
+
+sourceOperations: Array<OperationDescriptor>,
|
|
798
|
+
+invalidateStore: boolean,
|
|
799
|
+
};
|
|
800
|
+
|
|
749
801
|
export type StoreNotifyStartLogEvent = {
|
|
750
802
|
+name: 'store.notify.start',
|
|
751
803
|
+sourceOperation: ?OperationDescriptor,
|
|
@@ -767,9 +819,20 @@ export type StoreNotifySubscriptionLogEvent = {
|
|
|
767
819
|
+nextSnapshot: Snapshot,
|
|
768
820
|
};
|
|
769
821
|
|
|
822
|
+
export type ReaderReadFragmentSpread = {
|
|
823
|
+
+name: 'reader.fragmentSpread',
|
|
824
|
+
fragmentName: string,
|
|
825
|
+
data: SelectorData,
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
export type ReaderRead = {
|
|
829
|
+
name: 'reader.read',
|
|
830
|
+
selector: SingularReaderSelector,
|
|
831
|
+
};
|
|
832
|
+
|
|
770
833
|
export type EntrypointRootConsumeLogEvent = {
|
|
771
834
|
+name: 'entrypoint.root.consume',
|
|
772
|
-
+profilerContext:
|
|
835
|
+
+profilerContext: unknown,
|
|
773
836
|
+rootModuleID: string,
|
|
774
837
|
};
|
|
775
838
|
|
|
@@ -796,8 +859,20 @@ export type IdCollisionTypenameLogEvent = {
|
|
|
796
859
|
+new_typename: string,
|
|
797
860
|
};
|
|
798
861
|
|
|
862
|
+
export type FetchQueryFetchLogEvent = {
|
|
863
|
+
+name: 'fetchquery.fetch',
|
|
864
|
+
+operation: OperationDescriptor,
|
|
865
|
+
// FetchPolicy from Relay Hooks
|
|
866
|
+
+fetchPolicy: string,
|
|
867
|
+
+queryAvailability: OperationAvailability,
|
|
868
|
+
+shouldFetch: boolean,
|
|
869
|
+
};
|
|
870
|
+
|
|
799
871
|
export type LogEvent =
|
|
800
872
|
| SuspenseFragmentLogEvent
|
|
873
|
+
| SuspenseResolverLogEvent
|
|
874
|
+
| SuspenseClientEdgeLogEvent
|
|
875
|
+
| SuspenseMissingDataLogEvent
|
|
801
876
|
| SuspenseQueryLogEvent
|
|
802
877
|
| QueryResourceFetchLogEvent
|
|
803
878
|
| QueryResourceRetainLogEvent
|
|
@@ -821,6 +896,7 @@ export type LogEvent =
|
|
|
821
896
|
| ExecuteNormalizeEnd
|
|
822
897
|
| StoreDataCheckerStartEvent
|
|
823
898
|
| StoreDataCheckerEndEvent
|
|
899
|
+
| StoreDataCheckerMissingEvent
|
|
824
900
|
| StorePublishLogEvent
|
|
825
901
|
| StoreSnapshotLogEvent
|
|
826
902
|
| StoreLookupStartEvent
|
|
@@ -829,16 +905,21 @@ export type LogEvent =
|
|
|
829
905
|
| StoreGcStartEvent
|
|
830
906
|
| StoreGcInterruptedEvent
|
|
831
907
|
| StoreGcEndEvent
|
|
908
|
+
| StoreBatchStartLogEvent
|
|
909
|
+
| StoreBatchCompleteLogEvent
|
|
832
910
|
| StoreNotifyStartLogEvent
|
|
833
911
|
| StoreNotifyCompleteLogEvent
|
|
834
912
|
| StoreNotifySubscriptionLogEvent
|
|
835
913
|
| EntrypointRootConsumeLogEvent
|
|
836
914
|
| LiveResolverBatchStartLogEvent
|
|
837
915
|
| LiveResolverBatchEndLogEvent
|
|
838
|
-
| UseFragmentSubscriptionMissedUpdates
|
|
916
|
+
| UseFragmentSubscriptionMissedUpdates
|
|
917
|
+
| FetchQueryFetchLogEvent
|
|
918
|
+
| ReaderRead
|
|
919
|
+
| ReaderReadFragmentSpread;
|
|
839
920
|
|
|
840
921
|
export type LogFunction = LogEvent => void;
|
|
841
|
-
export type LogRequestInfoFunction =
|
|
922
|
+
export type LogRequestInfoFunction = unknown => void;
|
|
842
923
|
|
|
843
924
|
/**
|
|
844
925
|
* The public API of Relay core. Represents an encapsulated environment with its
|
|
@@ -848,7 +929,7 @@ export interface IEnvironment {
|
|
|
848
929
|
/**
|
|
849
930
|
* Extra information attached to the environment instance
|
|
850
931
|
*/
|
|
851
|
-
+options:
|
|
932
|
+
+options: unknown;
|
|
852
933
|
|
|
853
934
|
/**
|
|
854
935
|
* **UNSTABLE** Event based logging API thats scoped to the environment.
|
|
@@ -905,7 +986,7 @@ export interface IEnvironment {
|
|
|
905
986
|
* Apply an optimistic mutation response and/or updater. The mutation can be
|
|
906
987
|
* reverted by calling `dispose()` on the returned value.
|
|
907
988
|
*/
|
|
908
|
-
applyMutation<TMutation
|
|
989
|
+
applyMutation<TMutation extends MutationParameters>(
|
|
909
990
|
optimisticConfig: OptimisticResponseConfig<TMutation>,
|
|
910
991
|
): Disposable;
|
|
911
992
|
|
|
@@ -979,7 +1060,7 @@ export interface IEnvironment {
|
|
|
979
1060
|
* Note: Observables are lazy, so calling this method will do nothing until
|
|
980
1061
|
* the result is subscribed to: environment.executeSubscription({...}).subscribe({...}).
|
|
981
1062
|
*/
|
|
982
|
-
executeSubscription<TMutation
|
|
1063
|
+
executeSubscription<TMutation extends MutationParameters>(config: {
|
|
983
1064
|
operation: OperationDescriptor,
|
|
984
1065
|
updater?: ?SelectorStoreUpdater<TMutation['response']>,
|
|
985
1066
|
}): RelayObservable<GraphQLResponse>;
|
|
@@ -994,7 +1075,7 @@ export interface IEnvironment {
|
|
|
994
1075
|
* the result is subscribed to:
|
|
995
1076
|
* environment.executeMutation({...}).subscribe({...}).
|
|
996
1077
|
*/
|
|
997
|
-
executeMutation<TMutation
|
|
1078
|
+
executeMutation<TMutation extends MutationParameters>(
|
|
998
1079
|
config: ExecuteMutationConfig<TMutation>,
|
|
999
1080
|
): RelayObservable<GraphQLResponse>;
|
|
1000
1081
|
|
|
@@ -1041,8 +1122,8 @@ export interface IEnvironment {
|
|
|
1041
1122
|
*/
|
|
1042
1123
|
export type ModuleImportPointer = {
|
|
1043
1124
|
+__fragmentPropName: ?string,
|
|
1044
|
-
+__module_component:
|
|
1045
|
-
+$fragmentSpreads:
|
|
1125
|
+
+__module_component: unknown,
|
|
1126
|
+
+$fragmentSpreads: unknown,
|
|
1046
1127
|
...
|
|
1047
1128
|
};
|
|
1048
1129
|
|
|
@@ -1056,7 +1137,7 @@ export type DataIDSet = Set<DataID>;
|
|
|
1056
1137
|
* A function that updates a store (via a proxy) given the results of a "handle"
|
|
1057
1138
|
* field payload.
|
|
1058
1139
|
*/
|
|
1059
|
-
export type Handler =
|
|
1140
|
+
export type Handler = Readonly<{
|
|
1060
1141
|
update: (store: RecordSourceProxy, fieldPayload: HandleFieldPayload) => void,
|
|
1061
1142
|
...
|
|
1062
1143
|
}>;
|
|
@@ -1101,11 +1182,11 @@ export type HandleFieldPayload = {
|
|
|
1101
1182
|
*/
|
|
1102
1183
|
export type ModuleImportPayload = {
|
|
1103
1184
|
+kind: 'ModuleImportPayload',
|
|
1104
|
-
+args:
|
|
1185
|
+
+args: ?ReadonlyArray<NormalizationArgument>,
|
|
1105
1186
|
+data: PayloadData,
|
|
1106
1187
|
+dataID: DataID,
|
|
1107
|
-
+operationReference:
|
|
1108
|
-
+path:
|
|
1188
|
+
+operationReference: unknown,
|
|
1189
|
+
+path: ReadonlyArray<string>,
|
|
1109
1190
|
+typeName: string,
|
|
1110
1191
|
+variables: Variables,
|
|
1111
1192
|
+actorIdentifier: ?ActorIdentifier,
|
|
@@ -1131,7 +1212,7 @@ export type ActorPayload = {
|
|
|
1131
1212
|
+data: PayloadData,
|
|
1132
1213
|
+dataID: DataID,
|
|
1133
1214
|
+node: NormalizationLinkedField,
|
|
1134
|
-
+path:
|
|
1215
|
+
+path: ReadonlyArray<string>,
|
|
1135
1216
|
+typeName: string,
|
|
1136
1217
|
+variables: Variables,
|
|
1137
1218
|
+actorIdentifier: ActorIdentifier,
|
|
@@ -1151,7 +1232,7 @@ export type DeferPlaceholder = {
|
|
|
1151
1232
|
+kind: 'defer',
|
|
1152
1233
|
+data: PayloadData,
|
|
1153
1234
|
+label: string,
|
|
1154
|
-
+path:
|
|
1235
|
+
+path: ReadonlyArray<string>,
|
|
1155
1236
|
+selector: NormalizationSelector,
|
|
1156
1237
|
+typeName: string,
|
|
1157
1238
|
+actorIdentifier: ?ActorIdentifier,
|
|
@@ -1159,7 +1240,7 @@ export type DeferPlaceholder = {
|
|
|
1159
1240
|
export type StreamPlaceholder = {
|
|
1160
1241
|
+kind: 'stream',
|
|
1161
1242
|
+label: string,
|
|
1162
|
-
+path:
|
|
1243
|
+
+path: ReadonlyArray<string>,
|
|
1163
1244
|
+parentID: DataID,
|
|
1164
1245
|
+node: NormalizationSelectableNode,
|
|
1165
1246
|
+variables: Variables,
|
|
@@ -1186,12 +1267,12 @@ export type OperationLoader = {
|
|
|
1186
1267
|
* Synchronously load an operation, returning either the node or null if it
|
|
1187
1268
|
* cannot be resolved synchronously.
|
|
1188
1269
|
*/
|
|
1189
|
-
get(reference:
|
|
1270
|
+
get(reference: unknown): ?NormalizationRootNode,
|
|
1190
1271
|
|
|
1191
1272
|
/**
|
|
1192
1273
|
* Asynchronously load an operation.
|
|
1193
1274
|
*/
|
|
1194
|
-
load(reference:
|
|
1275
|
+
load(reference: unknown): Promise<?NormalizationRootNode>,
|
|
1195
1276
|
};
|
|
1196
1277
|
|
|
1197
1278
|
/**
|
|
@@ -1214,7 +1295,7 @@ export type SelectorStoreUpdater<-TMutationResponse> = (
|
|
|
1214
1295
|
* A set of configs that can be used to apply an optimistic update into the
|
|
1215
1296
|
* store.
|
|
1216
1297
|
*/
|
|
1217
|
-
export type OptimisticUpdate<TMutation
|
|
1298
|
+
export type OptimisticUpdate<TMutation extends MutationParameters> =
|
|
1218
1299
|
| OptimisticUpdateFunction
|
|
1219
1300
|
| OptimisticUpdateRelayPayload<TMutation>;
|
|
1220
1301
|
|
|
@@ -1222,13 +1303,14 @@ export type OptimisticUpdateFunction = {
|
|
|
1222
1303
|
+storeUpdater: StoreUpdater,
|
|
1223
1304
|
};
|
|
1224
1305
|
|
|
1225
|
-
export type OptimisticUpdateRelayPayload<TMutation
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1306
|
+
export type OptimisticUpdateRelayPayload<TMutation extends MutationParameters> =
|
|
1307
|
+
{
|
|
1308
|
+
+operation: OperationDescriptor,
|
|
1309
|
+
+payload: RelayResponsePayload,
|
|
1310
|
+
+updater: ?SelectorStoreUpdater<TMutation['response']>,
|
|
1311
|
+
};
|
|
1230
1312
|
|
|
1231
|
-
export type OptimisticResponseConfig<TMutation
|
|
1313
|
+
export type OptimisticResponseConfig<TMutation extends MutationParameters> = {
|
|
1232
1314
|
+operation: OperationDescriptor,
|
|
1233
1315
|
+response: ?PayloadData,
|
|
1234
1316
|
+updater: ?SelectorStoreUpdater<TMutation['response']>,
|
|
@@ -1246,7 +1328,7 @@ export type MissingFieldHandler =
|
|
|
1246
1328
|
parentRecord: ?ReadOnlyRecordProxy,
|
|
1247
1329
|
args: Variables,
|
|
1248
1330
|
store: ReadOnlyRecordSourceProxy,
|
|
1249
|
-
) =>
|
|
1331
|
+
) => unknown,
|
|
1250
1332
|
}
|
|
1251
1333
|
| {
|
|
1252
1334
|
kind: 'linked',
|
|
@@ -1289,7 +1371,7 @@ export type MissingExpectedDataLogEvent = {
|
|
|
1289
1371
|
+owner: string,
|
|
1290
1372
|
fieldPath: string, // Purposefully mutable to allow lazy construction in RelayReader
|
|
1291
1373
|
// To populate this, you should pass the value to a ReactRelayLoggingContext
|
|
1292
|
-
+uiContext:
|
|
1374
|
+
+uiContext: unknown | void,
|
|
1293
1375
|
};
|
|
1294
1376
|
|
|
1295
1377
|
/**
|
|
@@ -1318,7 +1400,7 @@ export type MissingExpectedDataThrowEvent = {
|
|
|
1318
1400
|
fieldPath: string, // Purposefully mutable to allow lazy construction in RelayReader
|
|
1319
1401
|
+handled: boolean,
|
|
1320
1402
|
// To populate this, you should pass the value to a ReactRelayLoggingContext
|
|
1321
|
-
+uiContext:
|
|
1403
|
+
+uiContext: unknown | void,
|
|
1322
1404
|
};
|
|
1323
1405
|
|
|
1324
1406
|
/**
|
|
@@ -1330,7 +1412,7 @@ export type MissingRequiredFieldLogEvent = {
|
|
|
1330
1412
|
+owner: string,
|
|
1331
1413
|
fieldPath: string, // Purposefully mutable to allow lazy construction in RelayReader
|
|
1332
1414
|
// To populate this, you should pass the value to a ReactRelayLoggingContext
|
|
1333
|
-
+uiContext:
|
|
1415
|
+
+uiContext: unknown | void,
|
|
1334
1416
|
};
|
|
1335
1417
|
|
|
1336
1418
|
/**
|
|
@@ -1350,7 +1432,7 @@ export type MissingRequiredFieldThrowEvent = {
|
|
|
1350
1432
|
fieldPath: string, // Purposefully mutable to allow lazy construction in RelayReader
|
|
1351
1433
|
+handled: boolean,
|
|
1352
1434
|
// To populate this, you should pass the value to a ReactRelayLoggingContext
|
|
1353
|
-
+uiContext:
|
|
1435
|
+
+uiContext: unknown | void,
|
|
1354
1436
|
};
|
|
1355
1437
|
|
|
1356
1438
|
/**
|
|
@@ -1373,7 +1455,7 @@ export type RelayResolverErrorEvent = {
|
|
|
1373
1455
|
+shouldThrow: boolean,
|
|
1374
1456
|
+handled: boolean,
|
|
1375
1457
|
// To populate this, you should pass the value to a ReactRelayLoggingContext
|
|
1376
|
-
+uiContext:
|
|
1458
|
+
+uiContext: unknown | void,
|
|
1377
1459
|
};
|
|
1378
1460
|
|
|
1379
1461
|
/**
|
|
@@ -1401,7 +1483,7 @@ export type RelayFieldPayloadErrorEvent = {
|
|
|
1401
1483
|
+shouldThrow: boolean,
|
|
1402
1484
|
+handled: boolean,
|
|
1403
1485
|
// To populate this, you should pass the value to a ReactRelayLoggingContext
|
|
1404
|
-
+uiContext:
|
|
1486
|
+
+uiContext: unknown | void,
|
|
1405
1487
|
};
|
|
1406
1488
|
|
|
1407
1489
|
/**
|
|
@@ -1428,14 +1510,21 @@ export type RelayResponsePayload = {
|
|
|
1428
1510
|
+fieldPayloads: ?Array<HandleFieldPayload>,
|
|
1429
1511
|
+incrementalPlaceholders: ?Array<IncrementalDataPlaceholder>,
|
|
1430
1512
|
+followupPayloads: ?Array<FollowupPayload>,
|
|
1431
|
-
+source: MutableRecordSource,
|
|
1432
1513
|
+isFinal: boolean,
|
|
1514
|
+
+isPreNormalized?: boolean,
|
|
1515
|
+
+s2cExecutions?: ?ReadonlyArray<{
|
|
1516
|
+
+recordID: DataID,
|
|
1517
|
+
+selections: ReadonlyArray<NormalizationSelection>,
|
|
1518
|
+
+typeName: string,
|
|
1519
|
+
}>,
|
|
1520
|
+
+source: MutableRecordSource,
|
|
1521
|
+
+storeUpdater?: ?(store: RecordSourceProxy) => void,
|
|
1433
1522
|
};
|
|
1434
1523
|
|
|
1435
1524
|
/**
|
|
1436
1525
|
* Configuration on the executeMutation(...).
|
|
1437
1526
|
*/
|
|
1438
|
-
export type ExecuteMutationConfig<TMutation
|
|
1527
|
+
export type ExecuteMutationConfig<TMutation extends MutationParameters> = {
|
|
1439
1528
|
operation: OperationDescriptor,
|
|
1440
1529
|
optimisticUpdater?: ?SelectorStoreUpdater<TMutation['response']>,
|
|
1441
1530
|
optimisticResponse?: ?Object,
|
|
@@ -1450,14 +1539,14 @@ export interface PublishQueue {
|
|
|
1450
1539
|
/**
|
|
1451
1540
|
* Schedule applying an optimistic updates on the next `run()`.
|
|
1452
1541
|
*/
|
|
1453
|
-
applyUpdate<TMutation
|
|
1542
|
+
applyUpdate<TMutation extends MutationParameters>(
|
|
1454
1543
|
updater: OptimisticUpdate<TMutation>,
|
|
1455
1544
|
): void;
|
|
1456
1545
|
|
|
1457
1546
|
/**
|
|
1458
1547
|
* Schedule reverting an optimistic updates on the next `run()`.
|
|
1459
1548
|
*/
|
|
1460
|
-
revertUpdate<TMutation
|
|
1549
|
+
revertUpdate<TMutation extends MutationParameters>(
|
|
1461
1550
|
updater: OptimisticUpdate<TMutation>,
|
|
1462
1551
|
): void;
|
|
1463
1552
|
|
|
@@ -1469,7 +1558,7 @@ export interface PublishQueue {
|
|
|
1469
1558
|
/**
|
|
1470
1559
|
* Schedule applying a payload to the store on the next `run()`.
|
|
1471
1560
|
*/
|
|
1472
|
-
commitPayload<TMutation
|
|
1561
|
+
commitPayload<TMutation extends MutationParameters>(
|
|
1473
1562
|
operation: OperationDescriptor,
|
|
1474
1563
|
payload: RelayResponsePayload,
|
|
1475
1564
|
updater?: ?SelectorStoreUpdater<TMutation['response']>,
|
|
@@ -1493,7 +1582,7 @@ export interface PublishQueue {
|
|
|
1493
1582
|
* Optionally provide an OperationDescriptor indicating the source operation
|
|
1494
1583
|
* that was being processed to produce this run.
|
|
1495
1584
|
*/
|
|
1496
|
-
run(sourceOperation?: OperationDescriptor):
|
|
1585
|
+
run(sourceOperation?: OperationDescriptor): ReadonlyArray<RequestDescriptor>;
|
|
1497
1586
|
}
|
|
1498
1587
|
|
|
1499
1588
|
/**
|
|
@@ -1532,4 +1621,4 @@ export type LiveState<+T> = {
|
|
|
1532
1621
|
* `resolverContext` is set on the Relay Store.
|
|
1533
1622
|
* This context will be passed as the third argument to the live resolver
|
|
1534
1623
|
*/
|
|
1535
|
-
export type ResolverContext =
|
|
1624
|
+
export type ResolverContext = unknown;
|
|
@@ -36,12 +36,13 @@ const invariant = require('invariant');
|
|
|
36
36
|
|
|
37
37
|
export type Arguments = {
|
|
38
38
|
+FRAGMENT_POINTER_IS_WITHIN_UNMATCHED_TYPE_REFINEMENT?: boolean,
|
|
39
|
-
+[string]:
|
|
39
|
+
+[string]: unknown,
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
const {VARIABLE, LITERAL, OBJECT_VALUE, LIST_VALUE} = RelayConcreteNode;
|
|
43
43
|
|
|
44
44
|
const ERRORS_KEY: '__errors' = '__errors';
|
|
45
|
+
const FIELD_GRANULAR_NOTIFICATIONS_KEY = '__fieldGranularNotifications';
|
|
45
46
|
const MODULE_COMPONENT_KEY_PREFIX = '__module_component_';
|
|
46
47
|
const MODULE_OPERATION_KEY_PREFIX = '__module_operation_';
|
|
47
48
|
|
|
@@ -50,7 +51,7 @@ const RELAY_READ_TIME_RESOLVER_KEY_PREFIX = '$r:';
|
|
|
50
51
|
function getArgumentValue(
|
|
51
52
|
arg: NormalizationArgument | ReaderArgument,
|
|
52
53
|
variables: Variables,
|
|
53
|
-
):
|
|
54
|
+
): unknown {
|
|
54
55
|
if (arg.kind === VARIABLE) {
|
|
55
56
|
// Variables are provided at runtime and are not guaranteed to be stable.
|
|
56
57
|
return getStableVariableValue(arg.variableName, variables);
|
|
@@ -58,7 +59,7 @@ function getArgumentValue(
|
|
|
58
59
|
// The Relay compiler generates stable ConcreteArgument values.
|
|
59
60
|
return arg.value;
|
|
60
61
|
} else if (arg.kind === OBJECT_VALUE) {
|
|
61
|
-
const value: {[string]:
|
|
62
|
+
const value: {[string]: unknown} = {};
|
|
62
63
|
arg.fields.forEach(field => {
|
|
63
64
|
value[field.name] = getArgumentValue(field, variables);
|
|
64
65
|
});
|
|
@@ -77,13 +78,13 @@ function getArgumentValue(
|
|
|
77
78
|
* names. Guaranteed to return a result with stable ordered nested values.
|
|
78
79
|
*/
|
|
79
80
|
function getArgumentValues(
|
|
80
|
-
args?:
|
|
81
|
+
args?: ?ReadonlyArray<NormalizationArgument | ReaderArgument>,
|
|
81
82
|
variables: Variables,
|
|
82
83
|
isWithinUnmatchedTypeRefinement?: boolean,
|
|
83
84
|
): Arguments {
|
|
84
85
|
const values: {
|
|
85
86
|
FRAGMENT_POINTER_IS_WITHIN_UNMATCHED_TYPE_REFINEMENT?: boolean,
|
|
86
|
-
[string]:
|
|
87
|
+
[string]: unknown,
|
|
87
88
|
} = {};
|
|
88
89
|
if (isWithinUnmatchedTypeRefinement) {
|
|
89
90
|
values[
|
|
@@ -204,7 +205,7 @@ function getArguments(
|
|
|
204
205
|
| NormalizationHandle
|
|
205
206
|
| ReaderField
|
|
206
207
|
| ReaderActorChange,
|
|
207
|
-
):
|
|
208
|
+
): ?ReadonlyArray<NormalizationArgument | ReaderArgument> {
|
|
208
209
|
if (field.kind === 'RelayResolver' || field.kind === 'RelayLiveResolver') {
|
|
209
210
|
if (field.args == null) {
|
|
210
211
|
return field.fragment?.args;
|
|
@@ -256,7 +257,7 @@ function formatStorageKey(name: string, argValues: ?Arguments): string {
|
|
|
256
257
|
* Given Variables and a variable name, return a variable value with
|
|
257
258
|
* all values in a stable order.
|
|
258
259
|
*/
|
|
259
|
-
function getStableVariableValue(name: string, variables: Variables):
|
|
260
|
+
function getStableVariableValue(name: string, variables: Variables): unknown {
|
|
260
261
|
invariant(
|
|
261
262
|
variables.hasOwnProperty(name),
|
|
262
263
|
'getVariableValue(): Undefined variable `%s`.',
|
|
@@ -273,6 +274,10 @@ function getModuleOperationKey(documentName: string): string {
|
|
|
273
274
|
return `${MODULE_OPERATION_KEY_PREFIX}${documentName}`;
|
|
274
275
|
}
|
|
275
276
|
|
|
277
|
+
function getFieldNotificationKey(dataID: string, storageKey: string): string {
|
|
278
|
+
return `__fn:${dataID}:${storageKey}`;
|
|
279
|
+
}
|
|
280
|
+
|
|
276
281
|
/**
|
|
277
282
|
* Constants shared by all implementations of RecordSource/MutableRecordSource/etc.
|
|
278
283
|
*/
|
|
@@ -286,6 +291,7 @@ const RelayStoreUtils = {
|
|
|
286
291
|
FRAGMENT_PROP_NAME_KEY: '__fragmentPropName',
|
|
287
292
|
MODULE_COMPONENT_KEY: '__module_component', // alias returned by Reader
|
|
288
293
|
ERRORS_KEY,
|
|
294
|
+
FIELD_GRANULAR_NOTIFICATIONS_KEY,
|
|
289
295
|
ID_KEY: '__id',
|
|
290
296
|
REF_KEY: '__ref',
|
|
291
297
|
REFS_KEY: '__refs',
|
|
@@ -298,6 +304,7 @@ const RelayStoreUtils = {
|
|
|
298
304
|
RELAY_RESOLVER_SNAPSHOT_KEY: '__resolverSnapshot',
|
|
299
305
|
RELAY_RESOLVER_ERROR_KEY: '__resolverError',
|
|
300
306
|
RELAY_RESOLVER_OUTPUT_TYPE_RECORD_IDS: '__resolverOutputTypeRecordIDs',
|
|
307
|
+
RELAY_RESOLVER_RECORD_TYPENAME: '__RELAY_RESOLVER__',
|
|
301
308
|
RELAY_READ_TIME_RESOLVER_KEY_PREFIX,
|
|
302
309
|
|
|
303
310
|
formatStorageKey,
|
|
@@ -309,6 +316,7 @@ const RelayStoreUtils = {
|
|
|
309
316
|
getStableStorageKey,
|
|
310
317
|
getModuleComponentKey,
|
|
311
318
|
getModuleOperationKey,
|
|
319
|
+
getFieldNotificationKey,
|
|
312
320
|
} as const;
|
|
313
321
|
|
|
314
322
|
module.exports = RelayStoreUtils;
|