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
|
@@ -32,7 +32,7 @@ const {createOperationDescriptor} = require('./RelayModernOperationDescriptor');
|
|
|
32
32
|
* This feature is still experimental and does not properly handle some resolver
|
|
33
33
|
* features such as client-to-server edges.
|
|
34
34
|
*/
|
|
35
|
-
function observeQuery<TVariables
|
|
35
|
+
function observeQuery<TVariables extends Variables, TData>(
|
|
36
36
|
environment: IEnvironment,
|
|
37
37
|
gqlQuery: Query<TVariables, TData>,
|
|
38
38
|
variables: TVariables,
|
|
@@ -43,15 +43,15 @@ function observeQuery<TVariables: Variables, TData>(
|
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
const rootFragmentRef: $FlowFixMe = {
|
|
46
|
-
|
|
46
|
+
__fragmentOwner: operation.request,
|
|
47
47
|
__fragments: {
|
|
48
48
|
[operation.fragment.node.name]: operation.request.variables,
|
|
49
49
|
},
|
|
50
|
-
|
|
50
|
+
__id: operation.fragment.dataID,
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
const fragmentNode: Fragment<$FlowFixMe, TData> =
|
|
54
|
-
.fragment
|
|
53
|
+
const fragmentNode: Fragment<$FlowFixMe, TData> = operation.request.node
|
|
54
|
+
.fragment as $FlowFixMe;
|
|
55
55
|
|
|
56
56
|
return observeFragment(environment, fragmentNode, rootFragmentRef);
|
|
57
57
|
}
|
|
@@ -27,19 +27,19 @@ type HasSpread<TFragmentType> = {
|
|
|
27
27
|
/**
|
|
28
28
|
* Reads an @inline data fragment that was spread into the parent fragment.
|
|
29
29
|
*/
|
|
30
|
-
declare function readInlineData<TFragmentType
|
|
30
|
+
declare function readInlineData<TFragmentType extends FragmentType, TData>(
|
|
31
31
|
fragment: InlineFragment<TFragmentType, TData>,
|
|
32
32
|
key: HasSpread<TFragmentType>,
|
|
33
33
|
): TData;
|
|
34
|
-
declare function readInlineData<TFragmentType
|
|
34
|
+
declare function readInlineData<TFragmentType extends FragmentType, TData>(
|
|
35
35
|
fragment: InlineFragment<TFragmentType, TData>,
|
|
36
36
|
key: ?HasSpread<TFragmentType>,
|
|
37
37
|
): ?TData;
|
|
38
38
|
|
|
39
39
|
function readInlineData(
|
|
40
40
|
fragment: GraphQLTaggedNode,
|
|
41
|
-
fragmentRef:
|
|
42
|
-
):
|
|
41
|
+
fragmentRef: unknown,
|
|
42
|
+
): unknown {
|
|
43
43
|
const inlineDataFragment = getInlineDataFragment(fragment);
|
|
44
44
|
if (fragmentRef == null) {
|
|
45
45
|
return fragmentRef;
|
|
@@ -33,12 +33,12 @@ const {observeFragment} = require('./observeFragmentExperimental');
|
|
|
33
33
|
* you might choose to @defer a fragment that you only need to access inside an
|
|
34
34
|
* event handler and then await its value inside the handler if/when it is triggered.
|
|
35
35
|
*/
|
|
36
|
-
async function waitForFragmentData<TFragmentType
|
|
36
|
+
async function waitForFragmentData<TFragmentType extends FragmentType, TData>(
|
|
37
37
|
environment: IEnvironment,
|
|
38
38
|
fragment: Fragment<TFragmentType, TData>,
|
|
39
39
|
fragmentRef:
|
|
40
40
|
| HasSpread<TFragmentType>
|
|
41
|
-
|
|
|
41
|
+
| ReadonlyArray<HasSpread<TFragmentType>>,
|
|
42
42
|
): Promise<TData> {
|
|
43
43
|
let subscription: ?Subscription;
|
|
44
44
|
|
|
@@ -60,7 +60,7 @@ async function waitForFragmentData<TFragmentType: FragmentType, TData>(
|
|
|
60
60
|
});
|
|
61
61
|
subscription?.unsubscribe();
|
|
62
62
|
return data;
|
|
63
|
-
} catch (e:
|
|
63
|
+
} catch (e: unknown) {
|
|
64
64
|
subscription?.unsubscribe();
|
|
65
65
|
throw e;
|
|
66
66
|
}
|
|
@@ -42,18 +42,18 @@ export type SubscriptionParameters = {
|
|
|
42
42
|
* type information.
|
|
43
43
|
*/
|
|
44
44
|
export type GraphQLSubscriptionConfig<TVariables, TData, TRawResponse> =
|
|
45
|
-
|
|
45
|
+
Readonly<{
|
|
46
46
|
configs?: Array<DeclarativeMutationConfig>,
|
|
47
47
|
cacheConfig?: CacheConfig,
|
|
48
48
|
subscription: GraphQLSubscription<TVariables, TData, TRawResponse>,
|
|
49
|
-
variables: TVariables
|
|
49
|
+
variables: NoInfer<TVariables>,
|
|
50
50
|
onCompleted?: ?() => void,
|
|
51
51
|
onError?: ?(error: Error) => void,
|
|
52
52
|
onNext?: ?(response: ?TData) => void,
|
|
53
53
|
updater?: ?SelectorStoreUpdater<TData>,
|
|
54
54
|
}>;
|
|
55
55
|
|
|
56
|
-
function requestSubscription<TVariables
|
|
56
|
+
function requestSubscription<TVariables extends Variables, TData, TRawResponse>(
|
|
57
57
|
environment: IEnvironment,
|
|
58
58
|
config: GraphQLSubscriptionConfig<TVariables, TData, TRawResponse>,
|
|
59
59
|
): Disposable {
|
|
@@ -89,6 +89,8 @@ function requestSubscription<TVariables: Variables, TData, TRawResponse>(
|
|
|
89
89
|
updater,
|
|
90
90
|
})
|
|
91
91
|
.subscribe({
|
|
92
|
+
complete: onCompleted,
|
|
93
|
+
error: onError,
|
|
92
94
|
next: responses => {
|
|
93
95
|
if (onNext != null) {
|
|
94
96
|
let selector = operation.fragment;
|
|
@@ -107,12 +109,10 @@ function requestSubscription<TVariables: Variables, TData, TRawResponse>(
|
|
|
107
109
|
);
|
|
108
110
|
}
|
|
109
111
|
const data = environment.lookup(selector).data;
|
|
110
|
-
// $FlowFixMe[incompatible-
|
|
111
|
-
onNext(
|
|
112
|
+
// $FlowFixMe[incompatible-type]
|
|
113
|
+
onNext(data as TData);
|
|
112
114
|
}
|
|
113
115
|
},
|
|
114
|
-
error: onError,
|
|
115
|
-
complete: onCompleted,
|
|
116
116
|
});
|
|
117
117
|
return {
|
|
118
118
|
dispose: sub.unsubscribe,
|
|
@@ -22,13 +22,15 @@ import type {JSResourceReference} from 'JSResourceReference';
|
|
|
22
22
|
export type NormalizationOperation = {
|
|
23
23
|
+kind: 'Operation',
|
|
24
24
|
+name: string,
|
|
25
|
-
+argumentDefinitions:
|
|
26
|
-
+selections:
|
|
25
|
+
+argumentDefinitions: ReadonlyArray<NormalizationLocalArgumentDefinition>,
|
|
26
|
+
+selections: ReadonlyArray<NormalizationSelection>,
|
|
27
27
|
+clientAbstractTypes?: {
|
|
28
|
-
+[string]:
|
|
28
|
+
+[string]: ReadonlyArray<string>,
|
|
29
29
|
},
|
|
30
|
+
+has_server_to_client_resolvers?: boolean,
|
|
30
31
|
+use_exec_time_resolvers?: boolean,
|
|
31
32
|
+exec_time_resolvers_enabled_provider?: ProvidedVariableType,
|
|
33
|
+
+use_experimental_provider?: ProvidedVariableType,
|
|
32
34
|
};
|
|
33
35
|
|
|
34
36
|
export type NormalizationHandle =
|
|
@@ -39,26 +41,26 @@ export type NormalizationLinkedHandle = {
|
|
|
39
41
|
+kind: 'LinkedHandle',
|
|
40
42
|
+alias?: ?string,
|
|
41
43
|
+name: string,
|
|
42
|
-
+args?:
|
|
44
|
+
+args?: ?ReadonlyArray<NormalizationArgument>,
|
|
43
45
|
+handle: string,
|
|
44
46
|
+key: string,
|
|
45
47
|
// NOTE: this property is optional because it's expected to be rarely used
|
|
46
48
|
+dynamicKey?: ?NormalizationArgument,
|
|
47
|
-
+filters?:
|
|
48
|
-
+handleArgs?:
|
|
49
|
+
+filters?: ?ReadonlyArray<string>,
|
|
50
|
+
+handleArgs?: ReadonlyArray<NormalizationArgument>,
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
export type NormalizationScalarHandle = {
|
|
52
54
|
+kind: 'ScalarHandle',
|
|
53
55
|
+alias?: ?string,
|
|
54
56
|
+name: string,
|
|
55
|
-
+args?:
|
|
57
|
+
+args?: ?ReadonlyArray<NormalizationArgument>,
|
|
56
58
|
+handle: string,
|
|
57
59
|
+key: string,
|
|
58
60
|
// NOTE: this property is optional because it's expected to be rarely used
|
|
59
61
|
+dynamicKey?: ?NormalizationArgument,
|
|
60
|
-
+filters?:
|
|
61
|
-
+handleArgs?:
|
|
62
|
+
+filters?: ?ReadonlyArray<string>,
|
|
63
|
+
+handleArgs?: ReadonlyArray<NormalizationArgument>,
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
export type NormalizationArgument =
|
|
@@ -71,12 +73,12 @@ export type NormalizationCondition = {
|
|
|
71
73
|
+kind: 'Condition',
|
|
72
74
|
+passingValue: boolean,
|
|
73
75
|
+condition: string,
|
|
74
|
-
+selections:
|
|
76
|
+
+selections: ReadonlyArray<NormalizationSelection>,
|
|
75
77
|
};
|
|
76
78
|
|
|
77
79
|
export type NormalizationClientExtension = {
|
|
78
80
|
+kind: 'ClientExtension',
|
|
79
|
-
+selections:
|
|
81
|
+
+selections: ReadonlyArray<NormalizationSelection>,
|
|
80
82
|
};
|
|
81
83
|
|
|
82
84
|
export type NormalizationField =
|
|
@@ -87,7 +89,7 @@ export type NormalizationField =
|
|
|
87
89
|
|
|
88
90
|
export type NormalizationInlineFragment = {
|
|
89
91
|
+kind: 'InlineFragment',
|
|
90
|
-
+selections:
|
|
92
|
+
+selections: ReadonlyArray<NormalizationSelection>,
|
|
91
93
|
+type: string,
|
|
92
94
|
+abstractKey?: ?string,
|
|
93
95
|
};
|
|
@@ -95,7 +97,7 @@ export type NormalizationInlineFragment = {
|
|
|
95
97
|
export type NormalizationFragmentSpread = {
|
|
96
98
|
+kind: 'FragmentSpread',
|
|
97
99
|
+fragment: NormalizationSplitOperation,
|
|
98
|
-
+args?:
|
|
100
|
+
+args?: ?ReadonlyArray<NormalizationArgument>,
|
|
99
101
|
};
|
|
100
102
|
|
|
101
103
|
export type NormalizationLinkedField = {
|
|
@@ -103,10 +105,10 @@ export type NormalizationLinkedField = {
|
|
|
103
105
|
+alias?: ?string,
|
|
104
106
|
+name: string,
|
|
105
107
|
+storageKey?: ?string,
|
|
106
|
-
+args?:
|
|
108
|
+
+args?: ?ReadonlyArray<NormalizationArgument>,
|
|
107
109
|
+concreteType?: ?string,
|
|
108
110
|
+plural: boolean,
|
|
109
|
-
+selections:
|
|
111
|
+
+selections: ReadonlyArray<NormalizationSelection>,
|
|
110
112
|
};
|
|
111
113
|
|
|
112
114
|
export type NormalizationActorChange = {
|
|
@@ -115,15 +117,15 @@ export type NormalizationActorChange = {
|
|
|
115
117
|
};
|
|
116
118
|
|
|
117
119
|
export type NormalizationModuleImport = {
|
|
118
|
-
+args?:
|
|
120
|
+
+args?: ?ReadonlyArray<NormalizationArgument>,
|
|
119
121
|
+kind: 'ModuleImport',
|
|
120
122
|
+documentName: string,
|
|
121
123
|
+fragmentPropName: string,
|
|
122
124
|
+fragmentName: string,
|
|
123
125
|
+componentModuleProvider?: () =>
|
|
124
|
-
|
|
|
125
|
-
| Promise<
|
|
126
|
-
| JSResourceReference<
|
|
126
|
+
| unknown
|
|
127
|
+
| Promise<unknown>
|
|
128
|
+
| JSResourceReference<unknown>,
|
|
127
129
|
+operationModuleProvider?: () =>
|
|
128
130
|
| NormalizationRootNode
|
|
129
131
|
| Promise<NormalizationRootNode>
|
|
@@ -133,20 +135,20 @@ export type NormalizationModuleImport = {
|
|
|
133
135
|
export type NormalizationListValueArgument = {
|
|
134
136
|
+kind: 'ListValue',
|
|
135
137
|
+name: string,
|
|
136
|
-
+items:
|
|
138
|
+
+items: ReadonlyArray<NormalizationArgument | null>,
|
|
137
139
|
};
|
|
138
140
|
|
|
139
141
|
export type NormalizationLiteralArgument = {
|
|
140
142
|
+kind: 'Literal',
|
|
141
143
|
+name: string,
|
|
142
144
|
+type?: ?string,
|
|
143
|
-
+value:
|
|
145
|
+
+value: unknown,
|
|
144
146
|
};
|
|
145
147
|
|
|
146
148
|
export type NormalizationLocalArgumentDefinition = {
|
|
147
149
|
+kind: 'LocalArgument',
|
|
148
150
|
+name: string,
|
|
149
|
-
+defaultValue:
|
|
151
|
+
+defaultValue: unknown,
|
|
150
152
|
};
|
|
151
153
|
|
|
152
154
|
export type NormalizationNode =
|
|
@@ -163,7 +165,7 @@ export type NormalizationScalarField = {
|
|
|
163
165
|
+kind: 'ScalarField',
|
|
164
166
|
+alias?: ?string,
|
|
165
167
|
+name: string,
|
|
166
|
-
+args?:
|
|
168
|
+
+args?: ?ReadonlyArray<NormalizationArgument>,
|
|
167
169
|
+storageKey?: ?string,
|
|
168
170
|
};
|
|
169
171
|
|
|
@@ -185,7 +187,7 @@ type ResolverData =
|
|
|
185
187
|
export type NormalizationResolverField = {
|
|
186
188
|
+kind: 'RelayResolver',
|
|
187
189
|
+name: string,
|
|
188
|
-
+args?:
|
|
190
|
+
+args?: ?ReadonlyArray<NormalizationArgument>,
|
|
189
191
|
+fragment?: ?NormalizationInlineFragment,
|
|
190
192
|
+storageKey?: ?string,
|
|
191
193
|
+isOutputType: boolean,
|
|
@@ -195,7 +197,7 @@ export type NormalizationResolverField = {
|
|
|
195
197
|
export type NormalizationLiveResolverField = {
|
|
196
198
|
+kind: 'RelayLiveResolver',
|
|
197
199
|
+name: string,
|
|
198
|
-
+args?:
|
|
200
|
+
+args?: ?ReadonlyArray<NormalizationArgument>,
|
|
199
201
|
+fragment?: ?NormalizationInlineFragment,
|
|
200
202
|
+storageKey?: ?string,
|
|
201
203
|
+isOutputType: boolean,
|
|
@@ -216,7 +218,7 @@ export type NormalizationClientEdgeToClientObject = {
|
|
|
216
218
|
};
|
|
217
219
|
|
|
218
220
|
export type NormalizationClientComponent = {
|
|
219
|
-
+args?:
|
|
221
|
+
+args?: ?ReadonlyArray<NormalizationArgument>,
|
|
220
222
|
+kind: 'ClientComponent',
|
|
221
223
|
+fragment: NormalizationNode,
|
|
222
224
|
};
|
|
@@ -242,25 +244,25 @@ export type NormalizationSelection =
|
|
|
242
244
|
| NormalizationTypeDiscriminator;
|
|
243
245
|
|
|
244
246
|
export type NormalizationSplitOperation = {
|
|
245
|
-
+argumentDefinitions?:
|
|
247
|
+
+argumentDefinitions?: ReadonlyArray<NormalizationLocalArgumentDefinition>,
|
|
246
248
|
+kind: 'SplitOperation',
|
|
247
249
|
+name: string,
|
|
248
|
-
+metadata?: ?{+[key: string]:
|
|
249
|
-
+selections:
|
|
250
|
+
+metadata?: ?{+[key: string]: unknown, ...},
|
|
251
|
+
+selections: ReadonlyArray<NormalizationSelection>,
|
|
250
252
|
};
|
|
251
253
|
|
|
252
254
|
export type NormalizationStream = {
|
|
253
255
|
+if: string | null,
|
|
254
256
|
+kind: 'Stream',
|
|
255
257
|
+label: string,
|
|
256
|
-
+selections:
|
|
258
|
+
+selections: ReadonlyArray<NormalizationSelection>,
|
|
257
259
|
};
|
|
258
260
|
|
|
259
261
|
export type NormalizationDefer = {
|
|
260
262
|
+if: string | null,
|
|
261
263
|
+kind: 'Defer',
|
|
262
264
|
+label: string,
|
|
263
|
-
+selections:
|
|
265
|
+
+selections: ReadonlyArray<NormalizationSelection>,
|
|
264
266
|
};
|
|
265
267
|
|
|
266
268
|
export type NormalizationVariableArgument = {
|
|
@@ -273,7 +275,7 @@ export type NormalizationVariableArgument = {
|
|
|
273
275
|
export type NormalizationObjectValueArgument = {
|
|
274
276
|
+kind: 'ObjectValue',
|
|
275
277
|
+name: string,
|
|
276
|
-
+fields:
|
|
278
|
+
+fields: ReadonlyArray<NormalizationArgument>,
|
|
277
279
|
};
|
|
278
280
|
|
|
279
281
|
export type NormalizationSelectableNode =
|
package/util/ReaderNode.js.flow
CHANGED
|
@@ -19,15 +19,15 @@ import type {JSResourceReference} from 'JSResourceReference';
|
|
|
19
19
|
export type ReaderFragmentSpread = {
|
|
20
20
|
+kind: 'FragmentSpread',
|
|
21
21
|
+name: string,
|
|
22
|
-
+args?:
|
|
22
|
+
+args?: ?ReadonlyArray<ReaderArgument>,
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export type ReaderInlineDataFragmentSpread = {
|
|
26
26
|
+kind: 'InlineDataFragmentSpread',
|
|
27
27
|
+name: string,
|
|
28
|
-
+selections:
|
|
29
|
-
+args?:
|
|
30
|
-
+argumentDefinitions:
|
|
28
|
+
+selections: ReadonlyArray<ReaderSelection>,
|
|
29
|
+
+args?: ?ReadonlyArray<ReaderArgument>,
|
|
30
|
+
+argumentDefinitions: ReadonlyArray<ReaderArgumentDefinition>,
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export type ReaderFragment = {
|
|
@@ -36,7 +36,7 @@ export type ReaderFragment = {
|
|
|
36
36
|
+type: string,
|
|
37
37
|
+abstractKey?: ?string,
|
|
38
38
|
+metadata?: ?{
|
|
39
|
-
+connection?:
|
|
39
|
+
+connection?: ReadonlyArray<ConnectionMetadata>,
|
|
40
40
|
// Indicates if the fragment has been annotated with `@throwOnFieldError`
|
|
41
41
|
+throwOnFieldError?: boolean,
|
|
42
42
|
// Indicates if the fragment has been annotated with `@catch`
|
|
@@ -45,9 +45,10 @@ export type ReaderFragment = {
|
|
|
45
45
|
+mask?: boolean,
|
|
46
46
|
+plural?: boolean,
|
|
47
47
|
+refetch?: ReaderRefetchMetadata,
|
|
48
|
+
+vultureHash?: string,
|
|
48
49
|
},
|
|
49
|
-
+argumentDefinitions:
|
|
50
|
-
+selections:
|
|
50
|
+
+argumentDefinitions: ReadonlyArray<ReaderArgumentDefinition>,
|
|
51
|
+
+selections: ReadonlyArray<ReaderSelection>,
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
// Marker type for a @refetchable fragment
|
|
@@ -96,7 +97,7 @@ export type ReaderPaginationMetadata = {
|
|
|
96
97
|
+count: string,
|
|
97
98
|
+cursor: string,
|
|
98
99
|
} | null,
|
|
99
|
-
+path:
|
|
100
|
+
+path: ReadonlyArray<string>,
|
|
100
101
|
};
|
|
101
102
|
|
|
102
103
|
export type ReaderInlineDataFragment = {
|
|
@@ -116,12 +117,12 @@ export type ReaderCondition = {
|
|
|
116
117
|
+kind: 'Condition',
|
|
117
118
|
+passingValue: boolean,
|
|
118
119
|
+condition: string,
|
|
119
|
-
+selections:
|
|
120
|
+
+selections: ReadonlyArray<ReaderSelection>,
|
|
120
121
|
};
|
|
121
122
|
|
|
122
123
|
export type ReaderClientExtension = {
|
|
123
124
|
+kind: 'ClientExtension',
|
|
124
|
-
+selections:
|
|
125
|
+
+selections: ReadonlyArray<ReaderSelection>,
|
|
125
126
|
};
|
|
126
127
|
|
|
127
128
|
export type ReaderField =
|
|
@@ -137,7 +138,7 @@ export type ReaderRootArgument = {
|
|
|
137
138
|
|
|
138
139
|
export type ReaderInlineFragment = {
|
|
139
140
|
+kind: 'InlineFragment',
|
|
140
|
-
+selections:
|
|
141
|
+
+selections: ReadonlyArray<ReaderSelection>,
|
|
141
142
|
+type: ?string,
|
|
142
143
|
+abstractKey?: ?string,
|
|
143
144
|
};
|
|
@@ -153,10 +154,10 @@ export type ReaderLinkedField = {
|
|
|
153
154
|
+alias?: ?string,
|
|
154
155
|
+name: string,
|
|
155
156
|
+storageKey?: ?string,
|
|
156
|
-
+args?:
|
|
157
|
+
+args?: ?ReadonlyArray<ReaderArgument>,
|
|
157
158
|
+concreteType?: ?string,
|
|
158
159
|
+plural: boolean,
|
|
159
|
-
+selections:
|
|
160
|
+
+selections: ReadonlyArray<ReaderSelection>,
|
|
160
161
|
};
|
|
161
162
|
|
|
162
163
|
export type ReaderActorChange = {
|
|
@@ -164,45 +165,45 @@ export type ReaderActorChange = {
|
|
|
164
165
|
+alias?: ?string,
|
|
165
166
|
+name: string,
|
|
166
167
|
+storageKey?: ?string,
|
|
167
|
-
+args?:
|
|
168
|
+
+args?: ?ReadonlyArray<ReaderArgument>,
|
|
168
169
|
+fragmentSpread: ReaderFragmentSpread,
|
|
169
170
|
};
|
|
170
171
|
|
|
171
172
|
export type ReaderModuleImport = {
|
|
172
|
-
+args?:
|
|
173
|
+
+args?: ?ReadonlyArray<ReaderArgument>,
|
|
173
174
|
+kind: 'ModuleImport',
|
|
174
175
|
+documentName: string,
|
|
175
176
|
+fragmentPropName: string,
|
|
176
177
|
+fragmentName: string,
|
|
177
178
|
+componentModuleProvider?: () =>
|
|
178
|
-
|
|
|
179
|
-
| Promise<
|
|
180
|
-
| JSResourceReference<
|
|
179
|
+
| unknown
|
|
180
|
+
| Promise<unknown>
|
|
181
|
+
| JSResourceReference<unknown>,
|
|
181
182
|
};
|
|
182
183
|
|
|
183
184
|
export type ReaderListValueArgument = {
|
|
184
185
|
+kind: 'ListValue',
|
|
185
186
|
+name: string,
|
|
186
|
-
+items:
|
|
187
|
+
+items: ReadonlyArray<ReaderArgument | null>,
|
|
187
188
|
};
|
|
188
189
|
|
|
189
190
|
export type ReaderLiteralArgument = {
|
|
190
191
|
+kind: 'Literal',
|
|
191
192
|
+name: string,
|
|
192
193
|
+type?: ?string,
|
|
193
|
-
+value:
|
|
194
|
+
+value: unknown,
|
|
194
195
|
};
|
|
195
196
|
|
|
196
197
|
export type ReaderLocalArgument = {
|
|
197
198
|
+kind: 'LocalArgument',
|
|
198
199
|
+name: string,
|
|
199
|
-
+defaultValue:
|
|
200
|
+
+defaultValue: unknown,
|
|
200
201
|
};
|
|
201
202
|
|
|
202
203
|
export type ReaderObjectValueArgument = {
|
|
203
204
|
+kind: 'ObjectValue',
|
|
204
205
|
+name: string,
|
|
205
|
-
+fields:
|
|
206
|
+
+fields: ReadonlyArray<ReaderArgument>,
|
|
206
207
|
};
|
|
207
208
|
|
|
208
209
|
export type ReaderNode =
|
|
@@ -215,18 +216,18 @@ export type ReaderScalarField = {
|
|
|
215
216
|
+kind: 'ScalarField',
|
|
216
217
|
+alias?: ?string,
|
|
217
218
|
+name: string,
|
|
218
|
-
+args?:
|
|
219
|
+
+args?: ?ReadonlyArray<ReaderArgument>,
|
|
219
220
|
+storageKey?: ?string,
|
|
220
221
|
};
|
|
221
222
|
|
|
222
223
|
export type ReaderDefer = {
|
|
223
224
|
+kind: 'Defer',
|
|
224
|
-
+selections:
|
|
225
|
+
+selections: ReadonlyArray<ReaderSelection>,
|
|
225
226
|
};
|
|
226
227
|
|
|
227
228
|
export type ReaderStream = {
|
|
228
229
|
+kind: 'Stream',
|
|
229
|
-
+selections:
|
|
230
|
+
+selections: ReadonlyArray<ReaderSelection>,
|
|
230
231
|
};
|
|
231
232
|
|
|
232
233
|
export type RequiredFieldAction = 'NONE' | 'LOG' | 'THROW';
|
|
@@ -236,7 +237,7 @@ export type ReaderRequiredField = {
|
|
|
236
237
|
+field: ReaderField | ReaderClientEdge,
|
|
237
238
|
+action: RequiredFieldAction,
|
|
238
239
|
// TODO: This field is not used any more, we should be able to remove it.
|
|
239
|
-
+path?:
|
|
240
|
+
+path?: unknown,
|
|
240
241
|
};
|
|
241
242
|
|
|
242
243
|
export type CatchFieldTo = 'RESULT' | 'NULL';
|
|
@@ -246,10 +247,10 @@ export type ReaderCatchField = {
|
|
|
246
247
|
+field: ReaderField | ReaderClientEdge | ReaderAliasedInlineFragmentSpread,
|
|
247
248
|
+to: CatchFieldTo,
|
|
248
249
|
// TODO: This field is not used any more, we should be able to remove it.
|
|
249
|
-
+path?:
|
|
250
|
+
+path?: unknown,
|
|
250
251
|
};
|
|
251
252
|
|
|
252
|
-
export type ResolverFunction = (...args: Array<any>) =>
|
|
253
|
+
export type ResolverFunction = (...args: Array<any>) => unknown; // flowlint-line unclear-type:off
|
|
253
254
|
// With ES6 imports, a resolver function might be exported under the `default` key.
|
|
254
255
|
export type ResolverModule = ResolverFunction | {default: ResolverFunction};
|
|
255
256
|
|
|
@@ -274,7 +275,7 @@ export type ReaderRelayResolver = {
|
|
|
274
275
|
+kind: 'RelayResolver',
|
|
275
276
|
+alias?: ?string,
|
|
276
277
|
+name: string,
|
|
277
|
-
+args?:
|
|
278
|
+
+args?: ?ReadonlyArray<ReaderArgument>,
|
|
278
279
|
+fragment?: ?ReaderFragmentSpread,
|
|
279
280
|
+path: string,
|
|
280
281
|
+resolverModule: ResolverModule,
|
|
@@ -285,7 +286,7 @@ export type ReaderRelayLiveResolver = {
|
|
|
285
286
|
+kind: 'RelayLiveResolver',
|
|
286
287
|
+alias?: ?string,
|
|
287
288
|
+name: string,
|
|
288
|
-
+args?:
|
|
289
|
+
+args?: ?ReadonlyArray<ReaderArgument>,
|
|
289
290
|
+fragment?: ?ReaderFragmentSpread,
|
|
290
291
|
+path: string,
|
|
291
292
|
+resolverModule: ResolverModule,
|
|
@@ -298,6 +299,7 @@ export type ReaderClientEdgeToClientObject = {
|
|
|
298
299
|
+modelResolvers: {
|
|
299
300
|
[string]: ReaderRelayResolver | ReaderRelayLiveResolver,
|
|
300
301
|
} | null,
|
|
302
|
+
+serverObjectOperations?: {[string]: ConcreteRequest} | null,
|
|
301
303
|
+linkedField: ReaderLinkedField,
|
|
302
304
|
+backingField:
|
|
303
305
|
| ReaderRelayResolver
|
|
@@ -39,9 +39,9 @@ export type NormalizationRootNode =
|
|
|
39
39
|
| ConcreteRequest
|
|
40
40
|
| NormalizationSplitOperation;
|
|
41
41
|
|
|
42
|
-
export type ProvidedVariableType = {get():
|
|
42
|
+
export type ProvidedVariableType = {get(): unknown};
|
|
43
43
|
|
|
44
|
-
export type ProvidedVariablesType = {+[key: string]: {get():
|
|
44
|
+
export type ProvidedVariablesType = {+[key: string]: {get(): unknown}};
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Contains the parameters required for executing a GraphQL request.
|
|
@@ -57,7 +57,7 @@ export type RequestParameters =
|
|
|
57
57
|
+name: string,
|
|
58
58
|
+operationKind: 'mutation' | 'query' | 'subscription',
|
|
59
59
|
+providedVariables?: ProvidedVariablesType,
|
|
60
|
-
+metadata: {[key: string]:
|
|
60
|
+
+metadata: {[key: string]: unknown, ...},
|
|
61
61
|
}
|
|
62
62
|
| {
|
|
63
63
|
+cacheID: string,
|
|
@@ -67,7 +67,7 @@ export type RequestParameters =
|
|
|
67
67
|
+name: string,
|
|
68
68
|
+operationKind: 'mutation' | 'query' | 'subscription',
|
|
69
69
|
+providedVariables?: ProvidedVariablesType,
|
|
70
|
-
+metadata: {[key: string]:
|
|
70
|
+
+metadata: {[key: string]: unknown, ...},
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
export type ClientRequestParameters = {
|
|
@@ -78,7 +78,7 @@ export type ClientRequestParameters = {
|
|
|
78
78
|
+name: string,
|
|
79
79
|
+operationKind: 'query' | 'mutation',
|
|
80
80
|
+providedVariables?: ProvidedVariablesType,
|
|
81
|
-
+metadata: {[key: string]:
|
|
81
|
+
+metadata: {[key: string]: unknown, ...},
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
export type ClientRequest = {
|
package/util/RelayError.js.flow
CHANGED
|
@@ -25,12 +25,15 @@ function createError(
|
|
|
25
25
|
String(messageParams[index++]),
|
|
26
26
|
);
|
|
27
27
|
const err = new Error(message);
|
|
28
|
+
// messageParams[2] is the operation name
|
|
29
|
+
const operation = messageParams[2] ?? null;
|
|
28
30
|
// $FlowFixMe[unsafe-object-assign]
|
|
29
|
-
const error = Object.assign(
|
|
31
|
+
const error = Object.assign(err as any, {
|
|
30
32
|
name,
|
|
31
33
|
messageFormat,
|
|
32
34
|
messageParams,
|
|
33
35
|
type,
|
|
36
|
+
operation,
|
|
34
37
|
taalOpcodes: [2, 2], // skip frame (code=2) twice
|
|
35
38
|
});
|
|
36
39
|
// In V8, Error objects keep the closure scope chain alive until the
|
|
@@ -80,6 +80,22 @@ export type FeatureFlags = {
|
|
|
80
80
|
//
|
|
81
81
|
// See https://github.com/facebook/relay/issues/4882
|
|
82
82
|
CHECK_ALL_FRAGMENTS_FOR_MISSING_CLIENT_EDGES: boolean,
|
|
83
|
+
|
|
84
|
+
// When enabled, records created for Relay Resolvers will be filtered out
|
|
85
|
+
// from the store when serializing to JSON.
|
|
86
|
+
FILTER_OUT_RELAY_RESOLVER_RECORDS: boolean,
|
|
87
|
+
|
|
88
|
+
// Reduce the work on store.notify
|
|
89
|
+
OPTIMIZE_NOTIFY: boolean,
|
|
90
|
+
|
|
91
|
+
// Enable per-field subscription granularity on specific records (e.g. client:root).
|
|
92
|
+
// When enabled, subscriptions reading a field-granular record are only notified
|
|
93
|
+
// when the specific fields they read have changed, rather than on any change
|
|
94
|
+
// to the record.
|
|
95
|
+
ENABLE_FIELD_GRANULAR_NOTIFICATIONS: boolean,
|
|
96
|
+
|
|
97
|
+
// Enable logging for reader reading fragment spreads and fragments. Useful for logging unused fragments.
|
|
98
|
+
ENABLE_READER_FRAGMENTS_LOGGING: boolean,
|
|
83
99
|
};
|
|
84
100
|
|
|
85
101
|
const RelayFeatureFlags: FeatureFlags = {
|
|
@@ -102,13 +118,17 @@ const RelayFeatureFlags: FeatureFlags = {
|
|
|
102
118
|
PROCESS_OPTIMISTIC_UPDATE_BEFORE_SUBSCRIPTION: false,
|
|
103
119
|
MARK_RESOLVER_VALUES_AS_CLEAN_AFTER_FRAGMENT_REREAD: false,
|
|
104
120
|
ENABLE_CYLE_DETECTION_IN_VARIABLES: false,
|
|
105
|
-
ENABLE_ACTIVITY_COMPATIBILITY:
|
|
121
|
+
ENABLE_ACTIVITY_COMPATIBILITY: true,
|
|
106
122
|
ENABLE_READ_TIME_RESOLVER_STORAGE_KEY_PREFIX: true,
|
|
107
123
|
ENABLE_USE_PAGINATION_IS_LOADING_FIX: false,
|
|
108
124
|
DISALLOW_NESTED_UPDATES: false,
|
|
109
125
|
ENABLE_TYPENAME_PREFIXED_DATA_ID: false,
|
|
110
126
|
ENABLE_UI_CONTEXT_ON_RELAY_LOGGER: false,
|
|
111
127
|
CHECK_ALL_FRAGMENTS_FOR_MISSING_CLIENT_EDGES: false,
|
|
128
|
+
FILTER_OUT_RELAY_RESOLVER_RECORDS: false,
|
|
129
|
+
OPTIMIZE_NOTIFY: false,
|
|
130
|
+
ENABLE_FIELD_GRANULAR_NOTIFICATIONS: false,
|
|
131
|
+
ENABLE_READER_FRAGMENTS_LOGGING: false,
|
|
112
132
|
};
|
|
113
133
|
|
|
114
134
|
module.exports = RelayFeatureFlags;
|