relay-runtime 20.1.1 → 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.
- package/experimental.d.ts +34 -0
- package/experimental.js +1 -1
- package/experimental.js.flow +11 -11
- package/handlers/RelayDefaultHandlerProvider.d.ts +12 -0
- package/handlers/connection/ConnectionHandler.d.ts +51 -0
- package/handlers/connection/ConnectionHandler.js.flow +5 -5
- package/handlers/connection/ConnectionInterface.d.ts +40 -0
- package/handlers/connection/ConnectionInterface.js.flow +1 -1
- package/handlers/connection/MutationHandlers.d.ts +17 -0
- package/index.d.ts +274 -0
- 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 +118 -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 +98 -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 +216 -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 +79 -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.d.ts +17 -0
- package/multi-actor-environment/ActorIdentifier.js.flow +2 -2
- package/multi-actor-environment/ActorSpecificEnvironment.js.flow +15 -15
- package/multi-actor-environment/ActorUtils.js.flow +1 -1
- package/multi-actor-environment/MultiActorEnvironment.d.ts +123 -0
- package/multi-actor-environment/MultiActorEnvironment.js.flow +32 -24
- package/multi-actor-environment/MultiActorEnvironmentTypes.d.ts +225 -0
- package/multi-actor-environment/MultiActorEnvironmentTypes.js.flow +6 -6
- package/multi-actor-environment/index.d.ts +14 -0
- package/multi-actor-environment.d.ts +8 -0
- package/mutations/RelayDeclarativeMutationConfig.d.ts +70 -0
- 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.d.ts +25 -0
- package/mutations/applyOptimisticMutation.js.flow +2 -2
- package/mutations/commitLocalUpdate.d.ts +10 -0
- package/mutations/commitMutation.d.ts +48 -0
- package/mutations/commitMutation.js.flow +21 -17
- 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/RelayNetwork.d.ts +12 -0
- package/network/RelayNetworkTypes.d.ts +145 -0
- package/network/RelayNetworkTypes.js.flow +18 -18
- package/network/RelayObservable.d.ts +197 -0
- package/network/RelayObservable.js.flow +32 -30
- package/network/RelayQueryResponseCache.d.ts +16 -0
- package/network/RelayQueryResponseCache.js.flow +3 -3
- package/network/wrapNetworkWithLogObserver.js.flow +1 -1
- package/package.json +2 -1
- package/query/GraphQLTag.d.ts +45 -0
- package/query/GraphQLTag.js.flow +22 -10
- package/query/fetchQuery.d.ts +21 -0
- package/query/fetchQuery.js.flow +23 -10
- package/query/fetchQueryInternal.d.ts +26 -0
- package/query/fetchQueryInternal.js.flow +4 -4
- package/query/fetchQuery_DEPRECATED.d.ts +17 -0
- package/query/fetchQuery_DEPRECATED.js.flow +1 -1
- package/store/ClientID.d.ts +14 -0
- package/store/DataChecker.js.flow +51 -15
- package/store/NormalizationEngine.js.flow +782 -0
- package/store/OperationExecutor.d.ts +51 -0
- package/store/OperationExecutor.js.flow +204 -98
- 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.d.ts +97 -0
- package/store/RelayModernEnvironment.js.flow +58 -43
- package/store/RelayModernFragmentSpecResolver.js.flow +1 -1
- package/store/RelayModernOperationDescriptor.d.ts +28 -0
- package/store/RelayModernOperationDescriptor.js.flow +1 -1
- package/store/RelayModernRecord.d.ts +92 -0
- package/store/RelayModernRecord.js.flow +44 -20
- package/store/RelayModernSelector.d.ts +123 -0
- package/store/RelayModernSelector.js.flow +21 -21
- package/store/RelayModernStore.d.ts +57 -0
- package/store/RelayModernStore.js.flow +219 -58
- package/store/RelayOperationTracker.d.ts +29 -0
- package/store/RelayOperationTracker.js.flow +2 -2
- package/store/RelayOptimisticRecordSource.js.flow +2 -2
- package/store/RelayPublishQueue.js.flow +29 -20
- package/store/RelayReader.js.flow +129 -57
- package/store/RelayRecordSource.d.ts +26 -0
- package/store/RelayRecordSource.js.flow +10 -0
- package/store/RelayRecordState.d.ts +28 -0
- package/store/RelayRecordState.js.flow +1 -1
- package/store/RelayReferenceMarker.js.flow +5 -4
- package/store/RelayResponseNormalizer.d.ts +28 -0
- package/store/RelayResponseNormalizer.js.flow +130 -62
- package/store/RelayStoreSubscriptions.js.flow +52 -8
- package/store/RelayStoreTypes.d.ts +1327 -0
- package/store/RelayStoreTypes.js.flow +371 -278
- package/store/RelayStoreUtils.d.ts +86 -0
- package/store/RelayStoreUtils.js.flow +16 -8
- package/store/ResolverCache.js.flow +2 -2
- package/store/ResolverFragments.d.ts +43 -0
- package/store/ResolverFragments.js.flow +22 -14
- package/store/StoreInspector.js.flow +7 -8
- package/store/ViewerPattern.d.ts +11 -0
- package/store/cloneRelayHandleSourceField.js.flow +1 -1
- package/store/cloneRelayScalarHandleSourceField.js.flow +1 -1
- package/store/createFragmentSpecResolver.d.ts +16 -0
- package/store/createRelayContext.js.flow +1 -1
- package/store/createRelayLoggingContext.js.flow +4 -4
- package/store/defaultGetDataID.js.flow +2 -2
- package/store/isRelayModernEnvironment.d.ts +8 -0
- 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.d.ts +27 -0
- package/store/live-resolvers/resolverDataInjector.js.flow +8 -5
- package/store/observeFragmentExperimental.d.ts +46 -0
- package/store/observeFragmentExperimental.js.flow +50 -21
- package/store/observeQueryExperimental.d.ts +30 -0
- package/store/observeQueryExperimental.js.flow +5 -5
- package/store/readInlineData.d.ts +19 -0
- package/store/readInlineData.js.flow +5 -5
- package/store/waitForFragmentExperimental.d.ts +49 -0
- package/store/waitForFragmentExperimental.js.flow +3 -3
- package/subscription/requestSubscription.d.ts +27 -0
- package/subscription/requestSubscription.js.flow +10 -10
- package/util/JSResourceTypes.flow.js.flow +4 -4
- package/util/NormalizationNode.d.ts +235 -0
- package/util/NormalizationNode.js.flow +127 -123
- package/util/ReaderNode.d.ts +264 -0
- package/util/ReaderNode.js.flow +156 -151
- package/util/RelayConcreteNode.d.ts +120 -0
- package/util/RelayConcreteNode.js.flow +32 -32
- package/util/RelayError.d.ts +13 -0
- package/util/RelayError.js.flow +4 -1
- package/util/RelayFeatureFlags.d.ts +40 -0
- package/util/RelayFeatureFlags.js.flow +21 -1
- package/util/RelayProfiler.d.ts +121 -0
- package/util/RelayProfiler.js.flow +1 -1
- package/util/RelayReplaySubject.d.ts +25 -0
- package/util/RelayReplaySubject.js.flow +3 -3
- package/util/RelayRuntimeTypes.d.ts +59 -0
- package/util/RelayRuntimeTypes.js.flow +36 -33
- package/util/createPayloadFor3DField.d.ts +17 -0
- package/util/createPayloadFor3DField.js.flow +9 -5
- package/util/deepFreeze.d.ts +8 -0
- package/util/deepFreeze.js.flow +2 -2
- package/util/getFragmentIdentifier.d.ts +10 -0
- package/util/getFragmentIdentifier.js.flow +1 -1
- package/util/getPaginationMetadata.d.ts +20 -0
- package/util/getPaginationMetadata.js.flow +1 -1
- package/util/getPaginationVariables.d.ts +20 -0
- package/util/getPaginationVariables.js.flow +1 -1
- package/util/getPendingOperationsForFragment.d.ts +18 -0
- package/util/getPendingOperationsForFragment.js.flow +2 -2
- package/util/getRefetchMetadata.d.ts +19 -0
- package/util/getRefetchMetadata.js.flow +6 -5
- package/util/getRelayHandleKey.d.ts +8 -0
- package/util/getRequestIdentifier.d.ts +17 -0
- package/util/getValueAtPath.d.ts +8 -0
- package/util/getValueAtPath.js.flow +3 -3
- package/util/handlePotentialSnapshotErrors.d.ts +14 -0
- package/util/handlePotentialSnapshotErrors.js.flow +5 -5
- package/util/isEmptyObject.js.flow +1 -1
- package/util/isPromise.d.ts +8 -0
- package/util/isPromise.js.flow +2 -2
- package/util/isScalarAndEqual.d.ts +8 -0
- package/util/isScalarAndEqual.js.flow +1 -1
- package/util/recycleNodesInto.d.ts +8 -0
- package/util/recycleNodesInto.js.flow +2 -2
- package/util/registerEnvironmentWithDevTools.js.flow +1 -1
- package/util/shallowFreeze.js.flow +1 -1
- package/util/stableCopy.d.ts +8 -0
- package/util/stableCopy.js.flow +5 -5
- package/util/withProvidedVariables.d.ts +19 -0
- 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,
|
|
@@ -65,9 +66,9 @@ export type OperationTracker = RelayOperationTracker;
|
|
|
65
66
|
export type Record = RelayModernRecord;
|
|
66
67
|
|
|
67
68
|
export type MutationParameters = {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
readonly response: {...},
|
|
70
|
+
readonly variables: {...},
|
|
71
|
+
readonly rawResponse?: {...},
|
|
71
72
|
};
|
|
72
73
|
|
|
73
74
|
export type FragmentMap = {[key: string]: ReaderFragment, ...};
|
|
@@ -75,23 +76,23 @@ 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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
readonly kind: 'SingularReaderSelector',
|
|
83
|
+
readonly dataID: DataID,
|
|
84
|
+
readonly isWithinUnmatchedTypeRefinement: boolean,
|
|
85
|
+
readonly clientEdgeTraversalPath: ClientEdgeTraversalPath | null,
|
|
86
|
+
readonly node: ReaderFragment,
|
|
87
|
+
readonly owner: RequestDescriptor,
|
|
88
|
+
readonly variables: Variables,
|
|
88
89
|
};
|
|
89
90
|
|
|
90
91
|
export type ReaderSelector = SingularReaderSelector | PluralReaderSelector;
|
|
91
92
|
|
|
92
93
|
export type PluralReaderSelector = {
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
readonly kind: 'PluralReaderSelector',
|
|
95
|
+
readonly selectors: ReadonlyArray<SingularReaderSelector>,
|
|
95
96
|
};
|
|
96
97
|
|
|
97
98
|
export type FieldErrorType =
|
|
@@ -100,10 +101,10 @@ export type FieldErrorType =
|
|
|
100
101
|
| 'PAYLOAD_ERROR';
|
|
101
102
|
|
|
102
103
|
export type RequestDescriptor = {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
readonly identifier: RequestIdentifier,
|
|
105
|
+
readonly node: ConcreteRequest,
|
|
106
|
+
readonly variables: Variables,
|
|
107
|
+
readonly cacheConfig: ?CacheConfig,
|
|
107
108
|
};
|
|
108
109
|
|
|
109
110
|
/**
|
|
@@ -111,9 +112,9 @@ export type RequestDescriptor = {
|
|
|
111
112
|
* purposes of targeting a subgraph.
|
|
112
113
|
*/
|
|
113
114
|
export type NormalizationSelector = {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
readonly dataID: DataID,
|
|
116
|
+
readonly node: NormalizationSelectableNode,
|
|
117
|
+
readonly variables: Variables,
|
|
117
118
|
};
|
|
118
119
|
|
|
119
120
|
export type FieldError =
|
|
@@ -127,29 +128,29 @@ export type FieldError =
|
|
|
127
128
|
export type FieldErrors = Array<FieldError>;
|
|
128
129
|
|
|
129
130
|
export type ClientEdgeTraversalInfo = {
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
readonly readerClientEdge: ReaderClientEdgeToServerObject,
|
|
132
|
+
readonly clientEdgeDestinationID: DataID,
|
|
132
133
|
};
|
|
133
134
|
|
|
134
135
|
export type ClientEdgeTraversalPath =
|
|
135
|
-
|
|
136
|
+
ReadonlyArray<ClientEdgeTraversalInfo | null>;
|
|
136
137
|
|
|
137
138
|
export type MissingClientEdgeRequestInfo = {
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
readonly request: ConcreteRequest,
|
|
140
|
+
readonly clientEdgeDestinationID: DataID,
|
|
140
141
|
};
|
|
141
142
|
|
|
142
143
|
/**
|
|
143
144
|
* A representation of a selector and its results at a particular point in time.
|
|
144
145
|
*/
|
|
145
146
|
export type Snapshot = {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
147
|
+
readonly data: ?SelectorData,
|
|
148
|
+
readonly isMissingData: boolean,
|
|
149
|
+
readonly missingLiveResolverFields?: ReadonlyArray<DataID>,
|
|
150
|
+
readonly missingClientEdges: null | ReadonlyArray<MissingClientEdgeRequestInfo>,
|
|
151
|
+
readonly seenRecords: DataIDSet,
|
|
152
|
+
readonly selector: SingularReaderSelector,
|
|
153
|
+
readonly fieldErrors: ?FieldErrors,
|
|
153
154
|
};
|
|
154
155
|
|
|
155
156
|
/**
|
|
@@ -162,15 +163,15 @@ export type Snapshot = {
|
|
|
162
163
|
* the results of the the operation.
|
|
163
164
|
*/
|
|
164
165
|
export type OperationDescriptor = {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
readonly fragment: SingularReaderSelector,
|
|
167
|
+
readonly request: RequestDescriptor,
|
|
168
|
+
readonly root: NormalizationSelector,
|
|
168
169
|
};
|
|
169
170
|
|
|
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
|
|
@@ -245,7 +246,7 @@ export interface RecordSource {
|
|
|
245
246
|
/**
|
|
246
247
|
* A collection of records keyed by id.
|
|
247
248
|
*/
|
|
248
|
-
export type RecordSourceJSON = {
|
|
249
|
+
export type RecordSourceJSON = {readonly [DataID]: ?RecordJSON};
|
|
249
250
|
|
|
250
251
|
/**
|
|
251
252
|
* A read/write interface for accessing and updating graph data.
|
|
@@ -258,10 +259,14 @@ export interface MutableRecordSource extends RecordSource {
|
|
|
258
259
|
}
|
|
259
260
|
|
|
260
261
|
export type CheckOptions = {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
262
|
+
readonly handlers: ReadonlyArray<MissingFieldHandler>,
|
|
263
|
+
readonly defaultActorIdentifier: ActorIdentifier,
|
|
264
|
+
readonly getTargetForActor: (
|
|
265
|
+
actorIdentifier: ActorIdentifier,
|
|
266
|
+
) => MutableRecordSource,
|
|
267
|
+
readonly getSourceForActor: (
|
|
268
|
+
actorIdentifier: ActorIdentifier,
|
|
269
|
+
) => RecordSource,
|
|
265
270
|
};
|
|
266
271
|
|
|
267
272
|
export type OperationAvailability =
|
|
@@ -306,7 +311,7 @@ export interface Store {
|
|
|
306
311
|
notify(
|
|
307
312
|
sourceOperation?: OperationDescriptor,
|
|
308
313
|
invalidateStore?: boolean,
|
|
309
|
-
):
|
|
314
|
+
): ReadonlyArray<RequestDescriptor>;
|
|
310
315
|
|
|
311
316
|
/**
|
|
312
317
|
* Publish new information (e.g. from the network) to the store, updating its
|
|
@@ -354,7 +359,7 @@ export interface Store {
|
|
|
354
359
|
* Will return an opaque snapshot of the current invalidation state of
|
|
355
360
|
* the data ids that were provided.
|
|
356
361
|
*/
|
|
357
|
-
lookupInvalidationState(dataIDs:
|
|
362
|
+
lookupInvalidationState(dataIDs: ReadonlyArray<DataID>): InvalidationState;
|
|
358
363
|
|
|
359
364
|
/**
|
|
360
365
|
* Given the previous invalidation state for those
|
|
@@ -422,6 +427,16 @@ export interface StoreSubscriptions {
|
|
|
422
427
|
sourceOperation?: OperationDescriptor,
|
|
423
428
|
): void;
|
|
424
429
|
|
|
430
|
+
/**
|
|
431
|
+
* Same as `updateSubscriptions`, except it only notifies subscriptions with stale snapshots.
|
|
432
|
+
*/
|
|
433
|
+
updateStaleSubscriptions(
|
|
434
|
+
source: RecordSource,
|
|
435
|
+
updatedRecordIDs: DataIDSet,
|
|
436
|
+
updatedOwners: Array<RequestDescriptor>,
|
|
437
|
+
sourceOperation?: OperationDescriptor,
|
|
438
|
+
): void;
|
|
439
|
+
|
|
425
440
|
/**
|
|
426
441
|
* returns the number of subscriptions
|
|
427
442
|
*/
|
|
@@ -438,8 +453,8 @@ export type Scheduler = (() => void) => void;
|
|
|
438
453
|
* A type that can schedule callbacks and also cancel them.
|
|
439
454
|
*/
|
|
440
455
|
export type TaskScheduler = {
|
|
441
|
-
|
|
442
|
-
|
|
456
|
+
readonly cancel: (id: string) => void,
|
|
457
|
+
readonly schedule: (fn: () => void, priority?: TaskPriority) => string,
|
|
443
458
|
};
|
|
444
459
|
|
|
445
460
|
export type TaskPriority = 'default' | 'low';
|
|
@@ -461,23 +476,23 @@ export interface RecordProxy {
|
|
|
461
476
|
args?: ?Variables,
|
|
462
477
|
): RecordProxy;
|
|
463
478
|
getType(): string;
|
|
464
|
-
getValue(name: string, args?: ?Variables):
|
|
465
|
-
getErrors(name: string, args?: ?Variables):
|
|
479
|
+
getValue(name: string, args?: ?Variables): unknown;
|
|
480
|
+
getErrors(name: string, args?: ?Variables): ?ReadonlyArray<TRelayFieldError>;
|
|
466
481
|
setLinkedRecord(
|
|
467
482
|
record: RecordProxy,
|
|
468
483
|
name: string,
|
|
469
484
|
args?: ?Variables,
|
|
470
485
|
): RecordProxy;
|
|
471
486
|
setLinkedRecords(
|
|
472
|
-
records:
|
|
487
|
+
records: ReadonlyArray<?RecordProxy>,
|
|
473
488
|
name: string,
|
|
474
489
|
args?: ?Variables,
|
|
475
490
|
): RecordProxy;
|
|
476
491
|
setValue(
|
|
477
|
-
value:
|
|
492
|
+
value: unknown,
|
|
478
493
|
name: string,
|
|
479
494
|
args?: ?Variables,
|
|
480
|
-
errors?:
|
|
495
|
+
errors?: ?ReadonlyArray<TRelayFieldError>,
|
|
481
496
|
): RecordProxy;
|
|
482
497
|
invalidateRecord(): void;
|
|
483
498
|
}
|
|
@@ -487,7 +502,7 @@ export interface ReadOnlyRecordProxy {
|
|
|
487
502
|
getLinkedRecord(name: string, args?: ?Variables): ?RecordProxy;
|
|
488
503
|
getLinkedRecords(name: string, args?: ?Variables): ?Array<?RecordProxy>;
|
|
489
504
|
getType(): string;
|
|
490
|
-
getValue(name: string, args?: ?Variables):
|
|
505
|
+
getValue(name: string, args?: ?Variables): unknown;
|
|
491
506
|
}
|
|
492
507
|
|
|
493
508
|
/**
|
|
@@ -496,7 +511,7 @@ export interface ReadOnlyRecordProxy {
|
|
|
496
511
|
* This type is expected by store.readUpdatableFragment.
|
|
497
512
|
*/
|
|
498
513
|
export type HasUpdatableSpread<TFragmentType> = {
|
|
499
|
-
|
|
514
|
+
readonly $updatableFragmentSpreads: TFragmentType,
|
|
500
515
|
...
|
|
501
516
|
};
|
|
502
517
|
|
|
@@ -505,7 +520,7 @@ export type HasUpdatableSpread<TFragmentType> = {
|
|
|
505
520
|
* readUpdatableFragment.
|
|
506
521
|
*/
|
|
507
522
|
export type UpdatableData<TData> = {
|
|
508
|
-
|
|
523
|
+
readonly updatableData: TData,
|
|
509
524
|
};
|
|
510
525
|
|
|
511
526
|
/**
|
|
@@ -520,11 +535,11 @@ export interface RecordSourceProxy {
|
|
|
520
535
|
get(dataID: DataID): ?RecordProxy;
|
|
521
536
|
getRoot(): RecordProxy;
|
|
522
537
|
invalidateStore(): void;
|
|
523
|
-
readUpdatableQuery<TVariables
|
|
538
|
+
readUpdatableQuery<TVariables extends Variables, TData>(
|
|
524
539
|
query: UpdatableQuery<TVariables, TData>,
|
|
525
540
|
variables: TVariables,
|
|
526
541
|
): UpdatableData<TData>;
|
|
527
|
-
readUpdatableFragment<TFragmentType
|
|
542
|
+
readUpdatableFragment<TFragmentType extends FragmentType, TData>(
|
|
528
543
|
fragment: UpdatableFragment<TFragmentType, TData>,
|
|
529
544
|
fragmentReference: HasUpdatableSpread<TFragmentType>,
|
|
530
545
|
): UpdatableData<TData>;
|
|
@@ -546,244 +561,296 @@ export interface RecordSourceSelectorProxy extends RecordSourceProxy {
|
|
|
546
561
|
}
|
|
547
562
|
|
|
548
563
|
export type SuspenseFragmentLogEvent = {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
564
|
+
readonly name: 'suspense.fragment',
|
|
565
|
+
readonly data: unknown,
|
|
566
|
+
readonly fragment: ReaderFragment,
|
|
567
|
+
readonly isRelayHooks: boolean,
|
|
568
|
+
readonly isMissingData: boolean,
|
|
569
|
+
readonly isPromiseCached: boolean,
|
|
570
|
+
readonly pendingOperations: ReadonlyArray<RequestDescriptor>,
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
export type SuspenseResolverLogEvent = {
|
|
574
|
+
readonly name: 'suspense.resolver',
|
|
575
|
+
readonly fragment: ReaderFragment,
|
|
576
|
+
readonly fragmentOwner: RequestDescriptor,
|
|
577
|
+
readonly isMount: boolean,
|
|
578
|
+
readonly suspendingLiveResolvers: ReadonlyArray<DataID>,
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
export type SuspenseClientEdgeLogEvent = {
|
|
582
|
+
readonly name: 'suspense.client_edge',
|
|
583
|
+
readonly fragment: ReaderFragment,
|
|
584
|
+
readonly fragmentOwner: RequestDescriptor,
|
|
585
|
+
readonly isMount: boolean,
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
export type SuspenseMissingDataLogEvent = {
|
|
589
|
+
readonly name: 'suspense.missing_data',
|
|
590
|
+
readonly fragment: ReaderFragment,
|
|
591
|
+
readonly fragmentOwner: RequestDescriptor,
|
|
592
|
+
readonly isMount: boolean,
|
|
593
|
+
readonly pendingOperations: ReadonlyArray<RequestDescriptor>,
|
|
556
594
|
};
|
|
557
595
|
|
|
558
596
|
export type SuspenseQueryLogEvent = {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
597
|
+
readonly name: 'suspense.query',
|
|
598
|
+
readonly fetchPolicy: string,
|
|
599
|
+
readonly isPromiseCached: boolean,
|
|
600
|
+
readonly operation: OperationDescriptor,
|
|
601
|
+
readonly queryAvailability: ?OperationAvailability,
|
|
602
|
+
readonly renderPolicy: RenderPolicy,
|
|
565
603
|
};
|
|
566
604
|
|
|
567
605
|
export type QueryResourceFetchLogEvent = {
|
|
568
|
-
|
|
606
|
+
readonly name: 'queryresource.fetch',
|
|
569
607
|
// ID of this query resource request and will be the same
|
|
570
608
|
// if there is an associated queryresource.retain event.
|
|
571
|
-
|
|
572
|
-
|
|
609
|
+
readonly resourceID: number,
|
|
610
|
+
readonly operation: OperationDescriptor,
|
|
573
611
|
// value from ProfilerContext
|
|
574
|
-
|
|
612
|
+
readonly profilerContext: unknown,
|
|
575
613
|
// FetchPolicy from Relay Hooks
|
|
576
|
-
|
|
614
|
+
readonly fetchPolicy: string,
|
|
577
615
|
// RenderPolicy from Relay Hooks
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
616
|
+
readonly renderPolicy: RenderPolicy,
|
|
617
|
+
readonly queryAvailability: OperationAvailability,
|
|
618
|
+
readonly shouldFetch: boolean,
|
|
581
619
|
};
|
|
582
620
|
|
|
583
621
|
export type QueryResourceRetainLogEvent = {
|
|
584
|
-
|
|
585
|
-
|
|
622
|
+
readonly name: 'queryresource.retain',
|
|
623
|
+
readonly resourceID: number,
|
|
586
624
|
// value from ProfilerContext
|
|
587
|
-
|
|
625
|
+
readonly profilerContext: unknown,
|
|
588
626
|
};
|
|
589
627
|
|
|
590
628
|
export type FragmentResourceMissingDataLogEvent = {
|
|
591
629
|
// Indicates FragmentResource is going to return a result that is missing
|
|
592
630
|
// data.
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
631
|
+
readonly name: 'fragmentresource.missing_data',
|
|
632
|
+
readonly data: unknown,
|
|
633
|
+
readonly fragment: ReaderFragment,
|
|
634
|
+
readonly isRelayHooks: boolean,
|
|
597
635
|
// Are we reading this result from the fragment resource cache?
|
|
598
|
-
|
|
636
|
+
readonly cached: boolean,
|
|
599
637
|
};
|
|
600
638
|
|
|
601
639
|
export type PendingOperationFoundLogEvent = {
|
|
602
640
|
// Indicates getPendingOperationForFragment identified a pending operation.
|
|
603
641
|
// Useful for measuring how frequently RelayOperationTracker identifies a
|
|
604
642
|
// related operation on which to suspend.
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
643
|
+
readonly name: 'pendingoperation.found',
|
|
644
|
+
readonly fragment: ReaderFragment,
|
|
645
|
+
readonly fragmentOwner: RequestDescriptor,
|
|
646
|
+
readonly pendingOperations: ReadonlyArray<RequestDescriptor>,
|
|
609
647
|
};
|
|
610
648
|
|
|
611
649
|
export type NetworkInfoLogEvent = {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
650
|
+
readonly name: 'network.info',
|
|
651
|
+
readonly networkRequestId: number,
|
|
652
|
+
readonly info: unknown,
|
|
615
653
|
};
|
|
616
654
|
|
|
617
655
|
export type NetworkStartLogEvent = {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
656
|
+
readonly name: 'network.start',
|
|
657
|
+
readonly networkRequestId: number,
|
|
658
|
+
readonly params: RequestParameters,
|
|
659
|
+
readonly variables: Variables,
|
|
660
|
+
readonly cacheConfig: CacheConfig,
|
|
623
661
|
};
|
|
624
662
|
|
|
625
663
|
export type NetworkNextLogEvent = {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
664
|
+
readonly name: 'network.next',
|
|
665
|
+
readonly networkRequestId: number,
|
|
666
|
+
readonly response: GraphQLResponse,
|
|
629
667
|
};
|
|
630
668
|
|
|
631
669
|
export type NetworkErrorLogEvent = {
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
670
|
+
readonly name: 'network.error',
|
|
671
|
+
readonly networkRequestId: number,
|
|
672
|
+
readonly error: Error,
|
|
635
673
|
};
|
|
636
674
|
|
|
637
675
|
export type NetworkCompleteLogEvent = {
|
|
638
|
-
|
|
639
|
-
|
|
676
|
+
readonly name: 'network.complete',
|
|
677
|
+
readonly networkRequestId: number,
|
|
640
678
|
};
|
|
641
679
|
|
|
642
680
|
export type NetworkUnsubscribeLogEvent = {
|
|
643
|
-
|
|
644
|
-
|
|
681
|
+
readonly name: 'network.unsubscribe',
|
|
682
|
+
readonly networkRequestId: number,
|
|
645
683
|
};
|
|
646
684
|
|
|
647
685
|
export type ExecuteStartLogEvent = {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
686
|
+
readonly name: 'execute.start',
|
|
687
|
+
readonly executeId: number,
|
|
688
|
+
readonly params: RequestParameters,
|
|
689
|
+
readonly variables: Variables,
|
|
690
|
+
readonly cacheConfig: CacheConfig,
|
|
653
691
|
};
|
|
654
692
|
|
|
655
693
|
export type ExecuteNextStartLogEvent = {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
694
|
+
readonly name: 'execute.next.start',
|
|
695
|
+
readonly executeId: number,
|
|
696
|
+
readonly response: GraphQLResponse,
|
|
697
|
+
readonly operation: OperationDescriptor,
|
|
660
698
|
};
|
|
661
699
|
|
|
662
700
|
export type ExecuteNextEndLogEvent = {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
701
|
+
readonly name: 'execute.next.end',
|
|
702
|
+
readonly executeId: number,
|
|
703
|
+
readonly response: GraphQLResponse,
|
|
704
|
+
readonly operation: OperationDescriptor,
|
|
667
705
|
};
|
|
668
706
|
|
|
669
707
|
export type ExecuteAsyncModuleLogEvent = {
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
708
|
+
readonly name: 'execute.async.module',
|
|
709
|
+
readonly executeId: number,
|
|
710
|
+
readonly operationName: string,
|
|
711
|
+
readonly duration: number,
|
|
674
712
|
};
|
|
675
713
|
|
|
676
714
|
export type ExecuteErrorLogEvent = {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
715
|
+
readonly name: 'execute.error',
|
|
716
|
+
readonly executeId: number,
|
|
717
|
+
readonly error: Error,
|
|
680
718
|
};
|
|
681
719
|
|
|
682
720
|
export type ExecuteCompleteLogEvent = {
|
|
683
|
-
|
|
684
|
-
|
|
721
|
+
readonly name: 'execute.complete',
|
|
722
|
+
readonly executeId: number,
|
|
685
723
|
};
|
|
686
724
|
|
|
687
725
|
export type ExecuteUnsubscribeLogEvent = {
|
|
688
|
-
|
|
689
|
-
|
|
726
|
+
readonly name: 'execute.unsubscribe',
|
|
727
|
+
readonly executeId: number,
|
|
690
728
|
};
|
|
691
729
|
|
|
692
730
|
export type ExecuteNormalizeStart = {
|
|
693
|
-
|
|
694
|
-
|
|
731
|
+
readonly name: 'execute.normalize.start',
|
|
732
|
+
readonly operation: OperationDescriptor,
|
|
695
733
|
};
|
|
696
734
|
|
|
697
735
|
export type ExecuteNormalizeEnd = {
|
|
698
|
-
|
|
699
|
-
|
|
736
|
+
readonly name: 'execute.normalize.end',
|
|
737
|
+
readonly operation: OperationDescriptor,
|
|
700
738
|
};
|
|
701
739
|
|
|
702
740
|
export type StoreDataCheckerStartEvent = {
|
|
703
|
-
|
|
704
|
-
|
|
741
|
+
readonly name: 'store.datachecker.start',
|
|
742
|
+
readonly selector: NormalizationSelector,
|
|
705
743
|
};
|
|
706
744
|
|
|
707
745
|
export type StoreDataCheckerEndEvent = {
|
|
708
|
-
|
|
709
|
-
|
|
746
|
+
readonly name: 'store.datachecker.end',
|
|
747
|
+
readonly selector: NormalizationSelector,
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
export type StoreDataCheckerMissingEvent = {
|
|
751
|
+
readonly name: 'store.datachecker.missing',
|
|
752
|
+
readonly kind: 'scalar' | 'linked' | 'pluralLinked' | 'unknown_record',
|
|
753
|
+
readonly dataID: DataID,
|
|
754
|
+
readonly fieldName?: string,
|
|
755
|
+
readonly storageKey?: string,
|
|
710
756
|
};
|
|
711
757
|
|
|
712
758
|
export type StorePublishLogEvent = {
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
759
|
+
readonly name: 'store.publish',
|
|
760
|
+
readonly source: RecordSource,
|
|
761
|
+
readonly optimistic: boolean,
|
|
716
762
|
};
|
|
717
763
|
|
|
718
764
|
export type StoreSnapshotLogEvent = {
|
|
719
|
-
|
|
765
|
+
readonly name: 'store.snapshot',
|
|
720
766
|
};
|
|
721
767
|
|
|
722
768
|
export type StoreLookupStartEvent = {
|
|
723
|
-
|
|
724
|
-
|
|
769
|
+
readonly name: 'store.lookup.start',
|
|
770
|
+
readonly selector: SingularReaderSelector,
|
|
725
771
|
};
|
|
726
772
|
|
|
727
773
|
export type StoreLookupEndEvent = {
|
|
728
|
-
|
|
729
|
-
|
|
774
|
+
readonly name: 'store.lookup.end',
|
|
775
|
+
readonly selector: SingularReaderSelector,
|
|
730
776
|
};
|
|
731
777
|
|
|
732
778
|
export type StoreRestoreLogEvent = {
|
|
733
|
-
|
|
779
|
+
readonly name: 'store.restore',
|
|
734
780
|
};
|
|
735
781
|
|
|
736
782
|
export type StoreGcStartEvent = {
|
|
737
|
-
|
|
783
|
+
readonly name: 'store.gc.start',
|
|
738
784
|
};
|
|
739
785
|
|
|
740
786
|
export type StoreGcInterruptedEvent = {
|
|
741
|
-
|
|
787
|
+
readonly name: 'store.gc.interrupted',
|
|
742
788
|
};
|
|
743
789
|
|
|
744
790
|
export type StoreGcEndEvent = {
|
|
745
|
-
|
|
746
|
-
|
|
791
|
+
readonly name: 'store.gc.end',
|
|
792
|
+
readonly references: DataIDSet,
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
export type StoreBatchStartLogEvent = {
|
|
796
|
+
readonly name: 'store.batch.start',
|
|
797
|
+
};
|
|
798
|
+
|
|
799
|
+
export type StoreBatchCompleteLogEvent = {
|
|
800
|
+
readonly name: 'store.batch.complete',
|
|
801
|
+
readonly sourceOperations: Array<OperationDescriptor>,
|
|
802
|
+
readonly invalidateStore: boolean,
|
|
747
803
|
};
|
|
748
804
|
|
|
749
805
|
export type StoreNotifyStartLogEvent = {
|
|
750
|
-
|
|
751
|
-
|
|
806
|
+
readonly name: 'store.notify.start',
|
|
807
|
+
readonly sourceOperation: ?OperationDescriptor,
|
|
752
808
|
};
|
|
753
809
|
|
|
754
810
|
export type StoreNotifyCompleteLogEvent = {
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
811
|
+
readonly name: 'store.notify.complete',
|
|
812
|
+
readonly sourceOperation: ?OperationDescriptor,
|
|
813
|
+
readonly updatedRecordIDs: DataIDSet,
|
|
814
|
+
readonly invalidatedRecordIDs: DataIDSet,
|
|
815
|
+
readonly subscriptionsSize: number,
|
|
816
|
+
readonly updatedOwners: Array<RequestDescriptor>,
|
|
761
817
|
};
|
|
762
818
|
|
|
763
819
|
export type StoreNotifySubscriptionLogEvent = {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
820
|
+
readonly name: 'store.notify.subscription',
|
|
821
|
+
readonly sourceOperation: ?OperationDescriptor,
|
|
822
|
+
readonly snapshot: Snapshot,
|
|
823
|
+
readonly nextSnapshot: Snapshot,
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
export type ReaderReadFragmentSpread = {
|
|
827
|
+
readonly name: 'reader.fragmentSpread',
|
|
828
|
+
fragmentName: string,
|
|
829
|
+
data: SelectorData,
|
|
830
|
+
};
|
|
831
|
+
|
|
832
|
+
export type ReaderRead = {
|
|
833
|
+
name: 'reader.read',
|
|
834
|
+
selector: SingularReaderSelector,
|
|
768
835
|
};
|
|
769
836
|
|
|
770
837
|
export type EntrypointRootConsumeLogEvent = {
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
838
|
+
readonly name: 'entrypoint.root.consume',
|
|
839
|
+
readonly profilerContext: unknown,
|
|
840
|
+
readonly rootModuleID: string,
|
|
774
841
|
};
|
|
775
842
|
|
|
776
843
|
export type LiveResolverBatchStartLogEvent = {
|
|
777
|
-
|
|
844
|
+
readonly name: 'liveresolver.batch.start',
|
|
778
845
|
};
|
|
779
846
|
|
|
780
847
|
export type LiveResolverBatchEndLogEvent = {
|
|
781
|
-
|
|
848
|
+
readonly name: 'liveresolver.batch.end',
|
|
782
849
|
};
|
|
783
850
|
|
|
784
851
|
export type UseFragmentSubscriptionMissedUpdates = {
|
|
785
|
-
|
|
786
|
-
|
|
852
|
+
readonly name: 'useFragment.subscription.missedUpdates',
|
|
853
|
+
readonly hasDataChanges: boolean,
|
|
787
854
|
};
|
|
788
855
|
|
|
789
856
|
/**
|
|
@@ -791,13 +858,25 @@ export type UseFragmentSubscriptionMissedUpdates = {
|
|
|
791
858
|
* but have different types, resulting in an collision in the store.
|
|
792
859
|
*/
|
|
793
860
|
export type IdCollisionTypenameLogEvent = {
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
861
|
+
readonly name: 'idCollision.typename',
|
|
862
|
+
readonly previous_typename: string,
|
|
863
|
+
readonly new_typename: string,
|
|
864
|
+
};
|
|
865
|
+
|
|
866
|
+
export type FetchQueryFetchLogEvent = {
|
|
867
|
+
readonly name: 'fetchquery.fetch',
|
|
868
|
+
readonly operation: OperationDescriptor,
|
|
869
|
+
// FetchPolicy from Relay Hooks
|
|
870
|
+
readonly fetchPolicy: string,
|
|
871
|
+
readonly queryAvailability: OperationAvailability,
|
|
872
|
+
readonly shouldFetch: boolean,
|
|
797
873
|
};
|
|
798
874
|
|
|
799
875
|
export type LogEvent =
|
|
800
876
|
| SuspenseFragmentLogEvent
|
|
877
|
+
| SuspenseResolverLogEvent
|
|
878
|
+
| SuspenseClientEdgeLogEvent
|
|
879
|
+
| SuspenseMissingDataLogEvent
|
|
801
880
|
| SuspenseQueryLogEvent
|
|
802
881
|
| QueryResourceFetchLogEvent
|
|
803
882
|
| QueryResourceRetainLogEvent
|
|
@@ -821,6 +900,7 @@ export type LogEvent =
|
|
|
821
900
|
| ExecuteNormalizeEnd
|
|
822
901
|
| StoreDataCheckerStartEvent
|
|
823
902
|
| StoreDataCheckerEndEvent
|
|
903
|
+
| StoreDataCheckerMissingEvent
|
|
824
904
|
| StorePublishLogEvent
|
|
825
905
|
| StoreSnapshotLogEvent
|
|
826
906
|
| StoreLookupStartEvent
|
|
@@ -829,16 +909,21 @@ export type LogEvent =
|
|
|
829
909
|
| StoreGcStartEvent
|
|
830
910
|
| StoreGcInterruptedEvent
|
|
831
911
|
| StoreGcEndEvent
|
|
912
|
+
| StoreBatchStartLogEvent
|
|
913
|
+
| StoreBatchCompleteLogEvent
|
|
832
914
|
| StoreNotifyStartLogEvent
|
|
833
915
|
| StoreNotifyCompleteLogEvent
|
|
834
916
|
| StoreNotifySubscriptionLogEvent
|
|
835
917
|
| EntrypointRootConsumeLogEvent
|
|
836
918
|
| LiveResolverBatchStartLogEvent
|
|
837
919
|
| LiveResolverBatchEndLogEvent
|
|
838
|
-
| UseFragmentSubscriptionMissedUpdates
|
|
920
|
+
| UseFragmentSubscriptionMissedUpdates
|
|
921
|
+
| FetchQueryFetchLogEvent
|
|
922
|
+
| ReaderRead
|
|
923
|
+
| ReaderReadFragmentSpread;
|
|
839
924
|
|
|
840
925
|
export type LogFunction = LogEvent => void;
|
|
841
|
-
export type LogRequestInfoFunction =
|
|
926
|
+
export type LogRequestInfoFunction = unknown => void;
|
|
842
927
|
|
|
843
928
|
/**
|
|
844
929
|
* The public API of Relay core. Represents an encapsulated environment with its
|
|
@@ -848,7 +933,7 @@ export interface IEnvironment {
|
|
|
848
933
|
/**
|
|
849
934
|
* Extra information attached to the environment instance
|
|
850
935
|
*/
|
|
851
|
-
|
|
936
|
+
readonly options: unknown;
|
|
852
937
|
|
|
853
938
|
/**
|
|
854
939
|
* **UNSTABLE** Event based logging API thats scoped to the environment.
|
|
@@ -905,7 +990,7 @@ export interface IEnvironment {
|
|
|
905
990
|
* Apply an optimistic mutation response and/or updater. The mutation can be
|
|
906
991
|
* reverted by calling `dispose()` on the returned value.
|
|
907
992
|
*/
|
|
908
|
-
applyMutation<TMutation
|
|
993
|
+
applyMutation<TMutation extends MutationParameters>(
|
|
909
994
|
optimisticConfig: OptimisticResponseConfig<TMutation>,
|
|
910
995
|
): Disposable;
|
|
911
996
|
|
|
@@ -979,7 +1064,7 @@ export interface IEnvironment {
|
|
|
979
1064
|
* Note: Observables are lazy, so calling this method will do nothing until
|
|
980
1065
|
* the result is subscribed to: environment.executeSubscription({...}).subscribe({...}).
|
|
981
1066
|
*/
|
|
982
|
-
executeSubscription<TMutation
|
|
1067
|
+
executeSubscription<TMutation extends MutationParameters>(config: {
|
|
983
1068
|
operation: OperationDescriptor,
|
|
984
1069
|
updater?: ?SelectorStoreUpdater<TMutation['response']>,
|
|
985
1070
|
}): RelayObservable<GraphQLResponse>;
|
|
@@ -994,7 +1079,7 @@ export interface IEnvironment {
|
|
|
994
1079
|
* the result is subscribed to:
|
|
995
1080
|
* environment.executeMutation({...}).subscribe({...}).
|
|
996
1081
|
*/
|
|
997
|
-
executeMutation<TMutation
|
|
1082
|
+
executeMutation<TMutation extends MutationParameters>(
|
|
998
1083
|
config: ExecuteMutationConfig<TMutation>,
|
|
999
1084
|
): RelayObservable<GraphQLResponse>;
|
|
1000
1085
|
|
|
@@ -1040,9 +1125,9 @@ export interface IEnvironment {
|
|
|
1040
1125
|
* selection
|
|
1041
1126
|
*/
|
|
1042
1127
|
export type ModuleImportPointer = {
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1128
|
+
readonly __fragmentPropName: ?string,
|
|
1129
|
+
readonly __module_component: unknown,
|
|
1130
|
+
readonly $fragmentSpreads: unknown,
|
|
1046
1131
|
...
|
|
1047
1132
|
};
|
|
1048
1133
|
|
|
@@ -1056,7 +1141,7 @@ export type DataIDSet = Set<DataID>;
|
|
|
1056
1141
|
* A function that updates a store (via a proxy) given the results of a "handle"
|
|
1057
1142
|
* field payload.
|
|
1058
1143
|
*/
|
|
1059
|
-
export type Handler =
|
|
1144
|
+
export type Handler = Readonly<{
|
|
1060
1145
|
update: (store: RecordSourceProxy, fieldPayload: HandleFieldPayload) => void,
|
|
1061
1146
|
...
|
|
1062
1147
|
}>;
|
|
@@ -1067,18 +1152,18 @@ export type Handler = $ReadOnly<{
|
|
|
1067
1152
|
*/
|
|
1068
1153
|
export type HandleFieldPayload = {
|
|
1069
1154
|
// The arguments that were fetched.
|
|
1070
|
-
|
|
1155
|
+
readonly args: Variables,
|
|
1071
1156
|
// The __id of the record containing the source/handle field.
|
|
1072
|
-
|
|
1157
|
+
readonly dataID: DataID,
|
|
1073
1158
|
// The (storage) key at which the original server data was written.
|
|
1074
|
-
|
|
1159
|
+
readonly fieldKey: string,
|
|
1075
1160
|
// The name of the handle.
|
|
1076
|
-
|
|
1161
|
+
readonly handle: string,
|
|
1077
1162
|
// The (storage) key at which the handle's data should be written by the
|
|
1078
1163
|
// handler.
|
|
1079
|
-
|
|
1164
|
+
readonly handleKey: string,
|
|
1080
1165
|
// The arguments applied to the handle
|
|
1081
|
-
|
|
1166
|
+
readonly handleArgs: Variables,
|
|
1082
1167
|
};
|
|
1083
1168
|
|
|
1084
1169
|
/**
|
|
@@ -1100,15 +1185,15 @@ export type HandleFieldPayload = {
|
|
|
1100
1185
|
*
|
|
1101
1186
|
*/
|
|
1102
1187
|
export type ModuleImportPayload = {
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1188
|
+
readonly kind: 'ModuleImportPayload',
|
|
1189
|
+
readonly args: ?ReadonlyArray<NormalizationArgument>,
|
|
1190
|
+
readonly data: PayloadData,
|
|
1191
|
+
readonly dataID: DataID,
|
|
1192
|
+
readonly operationReference: unknown,
|
|
1193
|
+
readonly path: ReadonlyArray<string>,
|
|
1194
|
+
readonly typeName: string,
|
|
1195
|
+
readonly variables: Variables,
|
|
1196
|
+
readonly actorIdentifier: ?ActorIdentifier,
|
|
1112
1197
|
};
|
|
1113
1198
|
|
|
1114
1199
|
/**
|
|
@@ -1127,14 +1212,14 @@ export type ModuleImportPayload = {
|
|
|
1127
1212
|
* typeName can also be used to construct a root record for normalization.
|
|
1128
1213
|
*/
|
|
1129
1214
|
export type ActorPayload = {
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1215
|
+
readonly kind: 'ActorPayload',
|
|
1216
|
+
readonly data: PayloadData,
|
|
1217
|
+
readonly dataID: DataID,
|
|
1218
|
+
readonly node: NormalizationLinkedField,
|
|
1219
|
+
readonly path: ReadonlyArray<string>,
|
|
1220
|
+
readonly typeName: string,
|
|
1221
|
+
readonly variables: Variables,
|
|
1222
|
+
readonly actorIdentifier: ActorIdentifier,
|
|
1138
1223
|
};
|
|
1139
1224
|
|
|
1140
1225
|
/**
|
|
@@ -1148,22 +1233,22 @@ export type FollowupPayload = ModuleImportPayload | ActorPayload;
|
|
|
1148
1233
|
* arrives.
|
|
1149
1234
|
*/
|
|
1150
1235
|
export type DeferPlaceholder = {
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1236
|
+
readonly kind: 'defer',
|
|
1237
|
+
readonly data: PayloadData,
|
|
1238
|
+
readonly label: string,
|
|
1239
|
+
readonly path: ReadonlyArray<string>,
|
|
1240
|
+
readonly selector: NormalizationSelector,
|
|
1241
|
+
readonly typeName: string,
|
|
1242
|
+
readonly actorIdentifier: ?ActorIdentifier,
|
|
1158
1243
|
};
|
|
1159
1244
|
export type StreamPlaceholder = {
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1245
|
+
readonly kind: 'stream',
|
|
1246
|
+
readonly label: string,
|
|
1247
|
+
readonly path: ReadonlyArray<string>,
|
|
1248
|
+
readonly parentID: DataID,
|
|
1249
|
+
readonly node: NormalizationSelectableNode,
|
|
1250
|
+
readonly variables: Variables,
|
|
1251
|
+
readonly actorIdentifier: ?ActorIdentifier,
|
|
1167
1252
|
};
|
|
1168
1253
|
export type IncrementalDataPlaceholder = DeferPlaceholder | StreamPlaceholder;
|
|
1169
1254
|
|
|
@@ -1186,12 +1271,12 @@ export type OperationLoader = {
|
|
|
1186
1271
|
* Synchronously load an operation, returning either the node or null if it
|
|
1187
1272
|
* cannot be resolved synchronously.
|
|
1188
1273
|
*/
|
|
1189
|
-
get(reference:
|
|
1274
|
+
get(reference: unknown): ?NormalizationRootNode,
|
|
1190
1275
|
|
|
1191
1276
|
/**
|
|
1192
1277
|
* Asynchronously load an operation.
|
|
1193
1278
|
*/
|
|
1194
|
-
load(reference:
|
|
1279
|
+
load(reference: unknown): Promise<?NormalizationRootNode>,
|
|
1195
1280
|
};
|
|
1196
1281
|
|
|
1197
1282
|
/**
|
|
@@ -1205,7 +1290,7 @@ export type StoreUpdater = (store: RecordSourceProxy) => void;
|
|
|
1205
1290
|
* order to easily access the root fields of a query/mutation as well as a
|
|
1206
1291
|
* second argument of the response object of the mutation.
|
|
1207
1292
|
*/
|
|
1208
|
-
export type SelectorStoreUpdater
|
|
1293
|
+
export type SelectorStoreUpdater<in TMutationResponse> = (
|
|
1209
1294
|
store: RecordSourceSelectorProxy,
|
|
1210
1295
|
data: ?TMutationResponse,
|
|
1211
1296
|
) => void;
|
|
@@ -1214,24 +1299,25 @@ export type SelectorStoreUpdater<-TMutationResponse> = (
|
|
|
1214
1299
|
* A set of configs that can be used to apply an optimistic update into the
|
|
1215
1300
|
* store.
|
|
1216
1301
|
*/
|
|
1217
|
-
export type OptimisticUpdate<TMutation
|
|
1302
|
+
export type OptimisticUpdate<TMutation extends MutationParameters> =
|
|
1218
1303
|
| OptimisticUpdateFunction
|
|
1219
1304
|
| OptimisticUpdateRelayPayload<TMutation>;
|
|
1220
1305
|
|
|
1221
1306
|
export type OptimisticUpdateFunction = {
|
|
1222
|
-
|
|
1307
|
+
readonly storeUpdater: StoreUpdater,
|
|
1223
1308
|
};
|
|
1224
1309
|
|
|
1225
|
-
export type OptimisticUpdateRelayPayload<TMutation
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1310
|
+
export type OptimisticUpdateRelayPayload<TMutation extends MutationParameters> =
|
|
1311
|
+
{
|
|
1312
|
+
readonly operation: OperationDescriptor,
|
|
1313
|
+
readonly payload: RelayResponsePayload,
|
|
1314
|
+
readonly updater: ?SelectorStoreUpdater<TMutation['response']>,
|
|
1315
|
+
};
|
|
1230
1316
|
|
|
1231
|
-
export type OptimisticResponseConfig<TMutation
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1317
|
+
export type OptimisticResponseConfig<TMutation extends MutationParameters> = {
|
|
1318
|
+
readonly operation: OperationDescriptor,
|
|
1319
|
+
readonly response: ?PayloadData,
|
|
1320
|
+
readonly updater: ?SelectorStoreUpdater<TMutation['response']>,
|
|
1235
1321
|
};
|
|
1236
1322
|
|
|
1237
1323
|
/**
|
|
@@ -1246,7 +1332,7 @@ export type MissingFieldHandler =
|
|
|
1246
1332
|
parentRecord: ?ReadOnlyRecordProxy,
|
|
1247
1333
|
args: Variables,
|
|
1248
1334
|
store: ReadOnlyRecordSourceProxy,
|
|
1249
|
-
) =>
|
|
1335
|
+
) => unknown,
|
|
1250
1336
|
}
|
|
1251
1337
|
| {
|
|
1252
1338
|
kind: 'linked',
|
|
@@ -1285,11 +1371,11 @@ export type MissingFieldHandler =
|
|
|
1285
1371
|
* https://relay.dev/docs/next/guides/throw-on-field-error-directive/
|
|
1286
1372
|
*/
|
|
1287
1373
|
export type MissingExpectedDataLogEvent = {
|
|
1288
|
-
|
|
1289
|
-
|
|
1374
|
+
readonly kind: 'missing_expected_data.log',
|
|
1375
|
+
readonly owner: string,
|
|
1290
1376
|
fieldPath: string, // Purposefully mutable to allow lazy construction in RelayReader
|
|
1291
1377
|
// To populate this, you should pass the value to a ReactRelayLoggingContext
|
|
1292
|
-
|
|
1378
|
+
readonly uiContext: unknown | void,
|
|
1293
1379
|
};
|
|
1294
1380
|
|
|
1295
1381
|
/**
|
|
@@ -1313,12 +1399,12 @@ export type MissingExpectedDataLogEvent = {
|
|
|
1313
1399
|
* `handled: true` and should not trigger a throw.
|
|
1314
1400
|
*/
|
|
1315
1401
|
export type MissingExpectedDataThrowEvent = {
|
|
1316
|
-
|
|
1317
|
-
|
|
1402
|
+
readonly kind: 'missing_expected_data.throw',
|
|
1403
|
+
readonly owner: string,
|
|
1318
1404
|
fieldPath: string, // Purposefully mutable to allow lazy construction in RelayReader
|
|
1319
|
-
|
|
1405
|
+
readonly handled: boolean,
|
|
1320
1406
|
// To populate this, you should pass the value to a ReactRelayLoggingContext
|
|
1321
|
-
|
|
1407
|
+
readonly uiContext: unknown | void,
|
|
1322
1408
|
};
|
|
1323
1409
|
|
|
1324
1410
|
/**
|
|
@@ -1326,11 +1412,11 @@ export type MissingExpectedDataThrowEvent = {
|
|
|
1326
1412
|
* store.
|
|
1327
1413
|
*/
|
|
1328
1414
|
export type MissingRequiredFieldLogEvent = {
|
|
1329
|
-
|
|
1330
|
-
|
|
1415
|
+
readonly kind: 'missing_required_field.log',
|
|
1416
|
+
readonly owner: string,
|
|
1331
1417
|
fieldPath: string, // Purposefully mutable to allow lazy construction in RelayReader
|
|
1332
1418
|
// To populate this, you should pass the value to a ReactRelayLoggingContext
|
|
1333
|
-
|
|
1419
|
+
readonly uiContext: unknown | void,
|
|
1334
1420
|
};
|
|
1335
1421
|
|
|
1336
1422
|
/**
|
|
@@ -1345,12 +1431,12 @@ export type MissingRequiredFieldLogEvent = {
|
|
|
1345
1431
|
* `handled: true` and should not trigger a throw.
|
|
1346
1432
|
*/
|
|
1347
1433
|
export type MissingRequiredFieldThrowEvent = {
|
|
1348
|
-
|
|
1349
|
-
|
|
1434
|
+
readonly kind: 'missing_required_field.throw',
|
|
1435
|
+
readonly owner: string,
|
|
1350
1436
|
fieldPath: string, // Purposefully mutable to allow lazy construction in RelayReader
|
|
1351
|
-
|
|
1437
|
+
readonly handled: boolean,
|
|
1352
1438
|
// To populate this, you should pass the value to a ReactRelayLoggingContext
|
|
1353
|
-
|
|
1439
|
+
readonly uiContext: unknown | void,
|
|
1354
1440
|
};
|
|
1355
1441
|
|
|
1356
1442
|
/**
|
|
@@ -1366,14 +1452,14 @@ export type MissingRequiredFieldThrowEvent = {
|
|
|
1366
1452
|
* `handled: true` and should not trigger a throw.
|
|
1367
1453
|
*/
|
|
1368
1454
|
export type RelayResolverErrorEvent = {
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1455
|
+
readonly kind: 'relay_resolver.error',
|
|
1456
|
+
readonly owner: string,
|
|
1457
|
+
readonly fieldPath: string,
|
|
1458
|
+
readonly error: Error,
|
|
1459
|
+
readonly shouldThrow: boolean,
|
|
1460
|
+
readonly handled: boolean,
|
|
1375
1461
|
// To populate this, you should pass the value to a ReactRelayLoggingContext
|
|
1376
|
-
|
|
1462
|
+
readonly uiContext: unknown | void,
|
|
1377
1463
|
};
|
|
1378
1464
|
|
|
1379
1465
|
/**
|
|
@@ -1394,14 +1480,14 @@ export type RelayResolverErrorEvent = {
|
|
|
1394
1480
|
* `handled: true` and should not trigger a throw.
|
|
1395
1481
|
*/
|
|
1396
1482
|
export type RelayFieldPayloadErrorEvent = {
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1483
|
+
readonly kind: 'relay_field_payload.error',
|
|
1484
|
+
readonly owner: string,
|
|
1485
|
+
readonly fieldPath: string,
|
|
1486
|
+
readonly error: TRelayFieldError,
|
|
1487
|
+
readonly shouldThrow: boolean,
|
|
1488
|
+
readonly handled: boolean,
|
|
1403
1489
|
// To populate this, you should pass the value to a ReactRelayLoggingContext
|
|
1404
|
-
|
|
1490
|
+
readonly uiContext: unknown | void,
|
|
1405
1491
|
};
|
|
1406
1492
|
|
|
1407
1493
|
/**
|
|
@@ -1424,18 +1510,25 @@ export type RelayFieldLogger = (event: RelayFieldLoggerEvent) => void;
|
|
|
1424
1510
|
* The results of normalizing a query.
|
|
1425
1511
|
*/
|
|
1426
1512
|
export type RelayResponsePayload = {
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1513
|
+
readonly errors: ?Array<PayloadError>,
|
|
1514
|
+
readonly fieldPayloads: ?Array<HandleFieldPayload>,
|
|
1515
|
+
readonly incrementalPlaceholders: ?Array<IncrementalDataPlaceholder>,
|
|
1516
|
+
readonly followupPayloads: ?Array<FollowupPayload>,
|
|
1517
|
+
readonly isFinal: boolean,
|
|
1518
|
+
readonly isPreNormalized?: boolean,
|
|
1519
|
+
readonly s2cExecutions?: ?ReadonlyArray<{
|
|
1520
|
+
readonly recordID: DataID,
|
|
1521
|
+
readonly selections: ReadonlyArray<NormalizationSelection>,
|
|
1522
|
+
readonly typeName: string,
|
|
1523
|
+
}>,
|
|
1524
|
+
readonly source: MutableRecordSource,
|
|
1525
|
+
readonly storeUpdater?: ?(store: RecordSourceProxy) => void,
|
|
1433
1526
|
};
|
|
1434
1527
|
|
|
1435
1528
|
/**
|
|
1436
1529
|
* Configuration on the executeMutation(...).
|
|
1437
1530
|
*/
|
|
1438
|
-
export type ExecuteMutationConfig<TMutation
|
|
1531
|
+
export type ExecuteMutationConfig<TMutation extends MutationParameters> = {
|
|
1439
1532
|
operation: OperationDescriptor,
|
|
1440
1533
|
optimisticUpdater?: ?SelectorStoreUpdater<TMutation['response']>,
|
|
1441
1534
|
optimisticResponse?: ?Object,
|
|
@@ -1450,14 +1543,14 @@ export interface PublishQueue {
|
|
|
1450
1543
|
/**
|
|
1451
1544
|
* Schedule applying an optimistic updates on the next `run()`.
|
|
1452
1545
|
*/
|
|
1453
|
-
applyUpdate<TMutation
|
|
1546
|
+
applyUpdate<TMutation extends MutationParameters>(
|
|
1454
1547
|
updater: OptimisticUpdate<TMutation>,
|
|
1455
1548
|
): void;
|
|
1456
1549
|
|
|
1457
1550
|
/**
|
|
1458
1551
|
* Schedule reverting an optimistic updates on the next `run()`.
|
|
1459
1552
|
*/
|
|
1460
|
-
revertUpdate<TMutation
|
|
1553
|
+
revertUpdate<TMutation extends MutationParameters>(
|
|
1461
1554
|
updater: OptimisticUpdate<TMutation>,
|
|
1462
1555
|
): void;
|
|
1463
1556
|
|
|
@@ -1469,7 +1562,7 @@ export interface PublishQueue {
|
|
|
1469
1562
|
/**
|
|
1470
1563
|
* Schedule applying a payload to the store on the next `run()`.
|
|
1471
1564
|
*/
|
|
1472
|
-
commitPayload<TMutation
|
|
1565
|
+
commitPayload<TMutation extends MutationParameters>(
|
|
1473
1566
|
operation: OperationDescriptor,
|
|
1474
1567
|
payload: RelayResponsePayload,
|
|
1475
1568
|
updater?: ?SelectorStoreUpdater<TMutation['response']>,
|
|
@@ -1493,7 +1586,7 @@ export interface PublishQueue {
|
|
|
1493
1586
|
* Optionally provide an OperationDescriptor indicating the source operation
|
|
1494
1587
|
* that was being processed to produce this run.
|
|
1495
1588
|
*/
|
|
1496
|
-
run(sourceOperation?: OperationDescriptor):
|
|
1589
|
+
run(sourceOperation?: OperationDescriptor): ReadonlyArray<RequestDescriptor>;
|
|
1497
1590
|
}
|
|
1498
1591
|
|
|
1499
1592
|
/**
|
|
@@ -1502,7 +1595,7 @@ export interface PublishQueue {
|
|
|
1502
1595
|
* can only come from a given set.
|
|
1503
1596
|
*/
|
|
1504
1597
|
export type ConcreteClientEdgeResolverReturnType<T = any> = {
|
|
1505
|
-
|
|
1598
|
+
readonly id: T & DataID,
|
|
1506
1599
|
};
|
|
1507
1600
|
|
|
1508
1601
|
/**
|
|
@@ -1515,7 +1608,7 @@ export type ConcreteClientEdgeResolverReturnType<T = any> = {
|
|
|
1515
1608
|
* that the provider of the LiveState value confirms that the value has indeed
|
|
1516
1609
|
* change before notifying Relay of the change.
|
|
1517
1610
|
*/
|
|
1518
|
-
export type LiveState
|
|
1611
|
+
export type LiveState<out T> = {
|
|
1519
1612
|
/**
|
|
1520
1613
|
* Returns the current value of the live state.
|
|
1521
1614
|
*/
|
|
@@ -1532,4 +1625,4 @@ export type LiveState<+T> = {
|
|
|
1532
1625
|
* `resolverContext` is set on the Relay Store.
|
|
1533
1626
|
* This context will be passed as the third argument to the live resolver
|
|
1534
1627
|
*/
|
|
1535
|
-
export type ResolverContext =
|
|
1628
|
+
export type ResolverContext = unknown;
|