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
|
@@ -49,12 +49,14 @@ var Executor = /*#__PURE__*/function () {
|
|
|
49
49
|
sink = _ref3.sink,
|
|
50
50
|
source = _ref3.source,
|
|
51
51
|
treatMissingFieldsAsNull = _ref3.treatMissingFieldsAsNull,
|
|
52
|
+
deferDeduplicatedFields = _ref3.deferDeduplicatedFields,
|
|
52
53
|
updater = _ref3.updater,
|
|
53
54
|
log = _ref3.log,
|
|
54
55
|
normalizeResponse = _ref3.normalizeResponse;
|
|
55
56
|
this._actorIdentifier = actorIdentifier;
|
|
56
57
|
this._getDataID = getDataID;
|
|
57
58
|
this._treatMissingFieldsAsNull = treatMissingFieldsAsNull;
|
|
59
|
+
this._deferDeduplicatedFields = deferDeduplicatedFields;
|
|
58
60
|
this._incrementalPayloadsPending = false;
|
|
59
61
|
this._incrementalResults = new Map();
|
|
60
62
|
this._log = log;
|
|
@@ -84,6 +86,7 @@ var Executor = /*#__PURE__*/function () {
|
|
|
84
86
|
this._seenActors = new Set();
|
|
85
87
|
this._completeFns = [];
|
|
86
88
|
this._normalizeResponse = normalizeResponse;
|
|
89
|
+
this._isClientQuery = this._operation.request.node.params.id == null && this._operation.request.node.params.text == null;
|
|
87
90
|
var id = this._nextSubscriptionId++;
|
|
88
91
|
if (RelayFeatureFlags.PROCESS_OPTIMISTIC_UPDATE_BEFORE_SUBSCRIPTION && optimisticConfig != null) {
|
|
89
92
|
this._processOptimisticResponse(optimisticConfig.response != null ? {
|
|
@@ -108,17 +111,17 @@ var Executor = /*#__PURE__*/function () {
|
|
|
108
111
|
var _this$_operation$requ3;
|
|
109
112
|
_this._start(id, subscription);
|
|
110
113
|
_this._log({
|
|
111
|
-
|
|
114
|
+
cacheConfig: (_this$_operation$requ3 = _this._operation.request.cacheConfig) !== null && _this$_operation$requ3 !== void 0 ? _this$_operation$requ3 : {},
|
|
112
115
|
executeId: _this._executeId,
|
|
116
|
+
name: 'execute.start',
|
|
113
117
|
params: _this._operation.request.node.params,
|
|
114
|
-
variables: _this._operation.request.variables
|
|
115
|
-
cacheConfig: (_this$_operation$requ3 = _this._operation.request.cacheConfig) !== null && _this$_operation$requ3 !== void 0 ? _this$_operation$requ3 : {}
|
|
118
|
+
variables: _this._operation.request.variables
|
|
116
119
|
});
|
|
117
120
|
},
|
|
118
121
|
unsubscribe: function unsubscribe() {
|
|
119
122
|
_this._log({
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
executeId: _this._executeId,
|
|
124
|
+
name: 'execute.unsubscribe'
|
|
122
125
|
});
|
|
123
126
|
}
|
|
124
127
|
});
|
|
@@ -226,8 +229,8 @@ var Executor = /*#__PURE__*/function () {
|
|
|
226
229
|
this.cancel();
|
|
227
230
|
this._sink.complete();
|
|
228
231
|
this._log({
|
|
229
|
-
|
|
230
|
-
|
|
232
|
+
executeId: this._executeId,
|
|
233
|
+
name: 'execute.complete'
|
|
231
234
|
});
|
|
232
235
|
}
|
|
233
236
|
};
|
|
@@ -235,9 +238,9 @@ var Executor = /*#__PURE__*/function () {
|
|
|
235
238
|
this.cancel();
|
|
236
239
|
this._sink.error(error);
|
|
237
240
|
this._log({
|
|
238
|
-
|
|
241
|
+
error: error,
|
|
239
242
|
executeId: this._executeId,
|
|
240
|
-
|
|
243
|
+
name: 'execute.error'
|
|
241
244
|
});
|
|
242
245
|
};
|
|
243
246
|
_proto._start = function _start(id, subscription) {
|
|
@@ -248,19 +251,24 @@ var Executor = /*#__PURE__*/function () {
|
|
|
248
251
|
var _this4 = this;
|
|
249
252
|
var priority = this._state === 'loading_incremental' ? 'low' : 'default';
|
|
250
253
|
this._schedule(function () {
|
|
254
|
+
if (!Array.isArray(response) && response.isPreNormalized === true) {
|
|
255
|
+
_this4._handlePreNormalizedPayload(response);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
var graphQLResponse = response;
|
|
251
259
|
_this4._log({
|
|
252
|
-
name: 'execute.next.start',
|
|
253
260
|
executeId: _this4._executeId,
|
|
254
|
-
|
|
255
|
-
operation: _this4._operation
|
|
261
|
+
name: 'execute.next.start',
|
|
262
|
+
operation: _this4._operation,
|
|
263
|
+
response: graphQLResponse
|
|
256
264
|
});
|
|
257
|
-
_this4._handleNext(
|
|
265
|
+
_this4._handleNext(graphQLResponse);
|
|
258
266
|
_this4._maybeCompleteSubscriptionOperationTracking();
|
|
259
267
|
_this4._log({
|
|
260
|
-
name: 'execute.next.end',
|
|
261
268
|
executeId: _this4._executeId,
|
|
262
|
-
|
|
263
|
-
operation: _this4._operation
|
|
269
|
+
name: 'execute.next.end',
|
|
270
|
+
operation: _this4._operation,
|
|
271
|
+
response: graphQLResponse
|
|
264
272
|
});
|
|
265
273
|
}, priority);
|
|
266
274
|
};
|
|
@@ -314,6 +322,29 @@ var Executor = /*#__PURE__*/function () {
|
|
|
314
322
|
}
|
|
315
323
|
return false;
|
|
316
324
|
};
|
|
325
|
+
_proto._handlePreNormalizedPayload = function _handlePreNormalizedPayload(payload) {
|
|
326
|
+
var _this6 = this;
|
|
327
|
+
var _payload$storeUpdater;
|
|
328
|
+
if (this._state === 'completed') {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
this._seenActors.clear();
|
|
332
|
+
if (this._optimisticUpdates !== null) {
|
|
333
|
+
this._optimisticUpdates.forEach(function (update) {
|
|
334
|
+
return _this6._getPublishQueueAndSaveActor().revertUpdate(update);
|
|
335
|
+
});
|
|
336
|
+
this._optimisticUpdates = null;
|
|
337
|
+
}
|
|
338
|
+
this._getPublishQueueAndSaveActor().commitPayload(this._operation, payload, (_payload$storeUpdater = payload.storeUpdater) !== null && _payload$storeUpdater !== void 0 ? _payload$storeUpdater : this._updater);
|
|
339
|
+
if (payload.isFinal) {
|
|
340
|
+
this._state = 'loading_final';
|
|
341
|
+
} else if (this._state === 'started') {
|
|
342
|
+
this._state = 'loading_incremental';
|
|
343
|
+
}
|
|
344
|
+
var updatedOwners = this._runPublishQueue(this._operation);
|
|
345
|
+
this._updateActiveState();
|
|
346
|
+
this._updateOperationTracker(updatedOwners);
|
|
347
|
+
};
|
|
317
348
|
_proto._handleNext = function _handleNext(response) {
|
|
318
349
|
if (this._state === 'completed') {
|
|
319
350
|
return;
|
|
@@ -327,9 +358,26 @@ var Executor = /*#__PURE__*/function () {
|
|
|
327
358
|
return ((_x$extensions = x.extensions) === null || _x$extensions === void 0 ? void 0 : _x$extensions.is_final) === true;
|
|
328
359
|
});
|
|
329
360
|
if (isFinal) {
|
|
330
|
-
this._state
|
|
331
|
-
|
|
332
|
-
|
|
361
|
+
if (this._useExecTimeResolvers && this._state !== 'loading_final' && responses.some(function (x) {
|
|
362
|
+
var _x$extensions2;
|
|
363
|
+
return ((_x$extensions2 = x.extensions) === null || _x$extensions2 === void 0 ? void 0 : _x$extensions2.is_normalized) === true;
|
|
364
|
+
})) {
|
|
365
|
+
this._execTimeResolverResponseComplete = true;
|
|
366
|
+
if (!this._isClientQuery && responses.some(function (x) {
|
|
367
|
+
var _x$extensions3;
|
|
368
|
+
return ((_x$extensions3 = x.extensions) === null || _x$extensions3 === void 0 ? void 0 : _x$extensions3.is_client_only) === true;
|
|
369
|
+
})) {
|
|
370
|
+
this._isClientQuery = true;
|
|
371
|
+
}
|
|
372
|
+
if (this._isClientQuery) {
|
|
373
|
+
this._state = 'loading_final';
|
|
374
|
+
}
|
|
375
|
+
this._updateActiveState();
|
|
376
|
+
} else {
|
|
377
|
+
this._state = 'loading_final';
|
|
378
|
+
this._updateActiveState();
|
|
379
|
+
this._incrementalPayloadsPending = false;
|
|
380
|
+
}
|
|
333
381
|
}
|
|
334
382
|
this._sink.next(response);
|
|
335
383
|
return;
|
|
@@ -348,8 +396,8 @@ var Executor = /*#__PURE__*/function () {
|
|
|
348
396
|
if (this._isSubscriptionOperation) {
|
|
349
397
|
var nextID = generateUniqueClientID();
|
|
350
398
|
this._operation = {
|
|
351
|
-
request: this._operation.request,
|
|
352
399
|
fragment: createReaderSelector(this._operation.fragment.node, nextID, this._operation.fragment.variables, this._operation.fragment.owner),
|
|
400
|
+
request: this._operation.request,
|
|
353
401
|
root: createNormalizationSelector(this._operation.root.node, nextID, this._operation.root.variables)
|
|
354
402
|
};
|
|
355
403
|
}
|
|
@@ -359,10 +407,13 @@ var Executor = /*#__PURE__*/function () {
|
|
|
359
407
|
if (hasNormalizedResponses) {
|
|
360
408
|
var _payloadFollowups = [];
|
|
361
409
|
for (var i = 0; i < normalizedResponses.length; i++) {
|
|
362
|
-
var _response$extensions2;
|
|
410
|
+
var _response$extensions2, _response$extensions3;
|
|
363
411
|
var _response = normalizedResponses[i];
|
|
364
412
|
var source = new RelayRecordSource(_response.data);
|
|
365
413
|
var isFinal = ((_response$extensions2 = _response.extensions) === null || _response$extensions2 === void 0 ? void 0 : _response$extensions2.is_final) === true;
|
|
414
|
+
if (((_response$extensions3 = _response.extensions) === null || _response$extensions3 === void 0 ? void 0 : _response$extensions3.is_client_only) === true) {
|
|
415
|
+
this._isClientQuery = true;
|
|
416
|
+
}
|
|
366
417
|
var payload = {
|
|
367
418
|
errors: [],
|
|
368
419
|
fieldPayloads: [],
|
|
@@ -375,6 +426,9 @@ var Executor = /*#__PURE__*/function () {
|
|
|
375
426
|
_payloadFollowups.push(payload);
|
|
376
427
|
this._execTimeResolverResponseComplete = isFinal;
|
|
377
428
|
if (isFinal) {
|
|
429
|
+
if (this._isClientQuery) {
|
|
430
|
+
this._state = 'loading_final';
|
|
431
|
+
}
|
|
378
432
|
this._updateActiveState();
|
|
379
433
|
}
|
|
380
434
|
}
|
|
@@ -402,7 +456,7 @@ var Executor = /*#__PURE__*/function () {
|
|
|
402
456
|
this._sink.next(response);
|
|
403
457
|
};
|
|
404
458
|
_proto._processOptimisticResponse = function _processOptimisticResponse(response, updater, treatMissingFieldsAsNull) {
|
|
405
|
-
var
|
|
459
|
+
var _this7 = this;
|
|
406
460
|
!(this._optimisticUpdates === null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'OperationExecutor: environment.execute: only support one optimistic response per ' + 'execute.') : invariant(false) : void 0;
|
|
407
461
|
if (response == null && updater == null) {
|
|
408
462
|
return;
|
|
@@ -411,6 +465,7 @@ var Executor = /*#__PURE__*/function () {
|
|
|
411
465
|
if (response) {
|
|
412
466
|
var payload = this._normalizeResponse(response, this._operation.root, ROOT_TYPE, {
|
|
413
467
|
actorIdentifier: this._actorIdentifier,
|
|
468
|
+
deferDeduplicatedFields: false,
|
|
414
469
|
getDataID: this._getDataID,
|
|
415
470
|
log: this._log,
|
|
416
471
|
path: [],
|
|
@@ -430,17 +485,17 @@ var Executor = /*#__PURE__*/function () {
|
|
|
430
485
|
payload: {
|
|
431
486
|
errors: null,
|
|
432
487
|
fieldPayloads: null,
|
|
433
|
-
incrementalPlaceholders: null,
|
|
434
488
|
followupPayloads: null,
|
|
435
|
-
|
|
436
|
-
isFinal: false
|
|
489
|
+
incrementalPlaceholders: null,
|
|
490
|
+
isFinal: false,
|
|
491
|
+
source: RelayRecordSource.create()
|
|
437
492
|
},
|
|
438
493
|
updater: updater
|
|
439
494
|
});
|
|
440
495
|
}
|
|
441
496
|
this._optimisticUpdates = optimisticUpdates;
|
|
442
497
|
optimisticUpdates.forEach(function (update) {
|
|
443
|
-
return
|
|
498
|
+
return _this7._getPublishQueueAndSaveActor().applyUpdate(update);
|
|
444
499
|
});
|
|
445
500
|
var updatedOwners = this._runPublishQueue();
|
|
446
501
|
if (RelayFeatureFlags.ENABLE_OPERATION_TRACKER_OPTIMISTIC_UPDATES) {
|
|
@@ -497,11 +552,12 @@ var Executor = /*#__PURE__*/function () {
|
|
|
497
552
|
};
|
|
498
553
|
return this._normalizeResponse(nextResponse, selector, followupPayload.typeName, {
|
|
499
554
|
actorIdentifier: this._actorIdentifier,
|
|
555
|
+
deferDeduplicatedFields: false,
|
|
500
556
|
getDataID: this._getDataID,
|
|
501
557
|
log: this._log,
|
|
502
558
|
path: followupPayload.path,
|
|
503
|
-
|
|
504
|
-
|
|
559
|
+
shouldProcessClientComponents: this._shouldProcessClientComponents,
|
|
560
|
+
treatMissingFieldsAsNull: this._treatMissingFieldsAsNull
|
|
505
561
|
}, this._useExecTimeResolvers);
|
|
506
562
|
};
|
|
507
563
|
_proto._processOptimisticModuleImport = function _processOptimisticModuleImport(normalizationRootNode, moduleImportPayload) {
|
|
@@ -518,33 +574,33 @@ var Executor = /*#__PURE__*/function () {
|
|
|
518
574
|
return optimisticUpdates;
|
|
519
575
|
};
|
|
520
576
|
_proto._processAsyncOptimisticModuleImport = function _processAsyncOptimisticModuleImport(moduleImportPayload) {
|
|
521
|
-
var
|
|
577
|
+
var _this8 = this;
|
|
522
578
|
this._expectOperationLoader().load(moduleImportPayload.operationReference).then(function (operation) {
|
|
523
|
-
if (operation == null ||
|
|
579
|
+
if (operation == null || _this8._state !== 'started') {
|
|
524
580
|
return;
|
|
525
581
|
}
|
|
526
|
-
var moduleImportOptimisticUpdates =
|
|
582
|
+
var moduleImportOptimisticUpdates = _this8._processOptimisticModuleImport(operation, moduleImportPayload);
|
|
527
583
|
moduleImportOptimisticUpdates.forEach(function (update) {
|
|
528
|
-
return
|
|
584
|
+
return _this8._getPublishQueueAndSaveActor().applyUpdate(update);
|
|
529
585
|
});
|
|
530
|
-
if (
|
|
531
|
-
process.env.NODE_ENV !== "production" ? warning(false, 'OperationExecutor: Unexpected ModuleImport optimistic ' + 'update in operation %s.' +
|
|
586
|
+
if (_this8._optimisticUpdates == null) {
|
|
587
|
+
process.env.NODE_ENV !== "production" ? warning(false, 'OperationExecutor: Unexpected ModuleImport optimistic ' + 'update in operation %s.' + _this8._operation.request.node.params.name) : void 0;
|
|
532
588
|
} else {
|
|
533
589
|
var _this$_optimisticUpda;
|
|
534
|
-
(_this$_optimisticUpda =
|
|
535
|
-
|
|
590
|
+
(_this$_optimisticUpda = _this8._optimisticUpdates).push.apply(_this$_optimisticUpda, (0, _toConsumableArray2["default"])(moduleImportOptimisticUpdates));
|
|
591
|
+
_this8._runPublishQueue();
|
|
536
592
|
}
|
|
537
593
|
});
|
|
538
594
|
};
|
|
539
595
|
_proto._processResponses = function _processResponses(responses) {
|
|
540
|
-
var
|
|
596
|
+
var _this9 = this;
|
|
541
597
|
this._log({
|
|
542
598
|
name: 'execute.normalize.start',
|
|
543
599
|
operation: this._operation
|
|
544
600
|
});
|
|
545
601
|
if (this._optimisticUpdates !== null) {
|
|
546
602
|
this._optimisticUpdates.forEach(function (update) {
|
|
547
|
-
|
|
603
|
+
_this9._getPublishQueueAndSaveActor().revertUpdate(update);
|
|
548
604
|
});
|
|
549
605
|
this._optimisticUpdates = null;
|
|
550
606
|
}
|
|
@@ -552,24 +608,25 @@ var Executor = /*#__PURE__*/function () {
|
|
|
552
608
|
this._incrementalResults.clear();
|
|
553
609
|
this._source.clear();
|
|
554
610
|
return responses.map(function (payloadPart) {
|
|
555
|
-
var relayPayload =
|
|
556
|
-
actorIdentifier:
|
|
557
|
-
|
|
558
|
-
|
|
611
|
+
var relayPayload = _this9._normalizeResponse(payloadPart, _this9._operation.root, ROOT_TYPE, {
|
|
612
|
+
actorIdentifier: _this9._actorIdentifier,
|
|
613
|
+
deferDeduplicatedFields: false,
|
|
614
|
+
getDataID: _this9._getDataID,
|
|
615
|
+
log: _this9._log,
|
|
559
616
|
path: [],
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
},
|
|
563
|
-
|
|
564
|
-
|
|
617
|
+
shouldProcessClientComponents: _this9._shouldProcessClientComponents,
|
|
618
|
+
treatMissingFieldsAsNull: _this9._treatMissingFieldsAsNull
|
|
619
|
+
}, _this9._useExecTimeResolvers);
|
|
620
|
+
_this9._getPublishQueueAndSaveActor().commitPayload(_this9._operation, relayPayload, _this9._updater);
|
|
621
|
+
_this9._log({
|
|
565
622
|
name: 'execute.normalize.end',
|
|
566
|
-
operation:
|
|
623
|
+
operation: _this9._operation
|
|
567
624
|
});
|
|
568
625
|
return relayPayload;
|
|
569
626
|
});
|
|
570
627
|
};
|
|
571
628
|
_proto._processPayloadFollowups = function _processPayloadFollowups(payloads) {
|
|
572
|
-
var
|
|
629
|
+
var _this0 = this;
|
|
573
630
|
if (this._state === 'completed') {
|
|
574
631
|
return;
|
|
575
632
|
}
|
|
@@ -577,35 +634,35 @@ var Executor = /*#__PURE__*/function () {
|
|
|
577
634
|
var incrementalPlaceholders = payload.incrementalPlaceholders,
|
|
578
635
|
followupPayloads = payload.followupPayloads,
|
|
579
636
|
isFinal = payload.isFinal;
|
|
580
|
-
|
|
581
|
-
|
|
637
|
+
_this0._state = isFinal ? 'loading_final' : 'loading_incremental';
|
|
638
|
+
_this0._updateActiveState();
|
|
582
639
|
if (isFinal) {
|
|
583
|
-
|
|
640
|
+
_this0._incrementalPayloadsPending = false;
|
|
584
641
|
}
|
|
585
642
|
if (followupPayloads && followupPayloads.length !== 0) {
|
|
586
643
|
followupPayloads.forEach(function (followupPayload) {
|
|
587
644
|
var _followupPayload$acto;
|
|
588
|
-
var prevActorIdentifier =
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
645
|
+
var prevActorIdentifier = _this0._actorIdentifier;
|
|
646
|
+
_this0._actorIdentifier = (_followupPayload$acto = followupPayload.actorIdentifier) !== null && _followupPayload$acto !== void 0 ? _followupPayload$acto : _this0._actorIdentifier;
|
|
647
|
+
_this0._processFollowupPayload(followupPayload);
|
|
648
|
+
_this0._actorIdentifier = prevActorIdentifier;
|
|
592
649
|
});
|
|
593
650
|
}
|
|
594
651
|
if (incrementalPlaceholders && incrementalPlaceholders.length !== 0) {
|
|
595
|
-
|
|
652
|
+
_this0._incrementalPayloadsPending = _this0._state !== 'loading_final';
|
|
596
653
|
incrementalPlaceholders.forEach(function (incrementalPlaceholder) {
|
|
597
654
|
var _incrementalPlacehold;
|
|
598
|
-
var prevActorIdentifier =
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
655
|
+
var prevActorIdentifier = _this0._actorIdentifier;
|
|
656
|
+
_this0._actorIdentifier = (_incrementalPlacehold = incrementalPlaceholder.actorIdentifier) !== null && _incrementalPlacehold !== void 0 ? _incrementalPlacehold : _this0._actorIdentifier;
|
|
657
|
+
_this0._processIncrementalPlaceholder(payload, incrementalPlaceholder);
|
|
658
|
+
_this0._actorIdentifier = prevActorIdentifier;
|
|
602
659
|
});
|
|
603
|
-
if (
|
|
604
|
-
process.env.NODE_ENV !== "production" ? warning(
|
|
660
|
+
if (_this0._isClientPayload || _this0._state === 'loading_final') {
|
|
661
|
+
process.env.NODE_ENV !== "production" ? warning(_this0._isClientPayload, 'RelayModernEnvironment: Operation `%s` contains @defer/@stream ' + 'directives but was executed in non-streaming mode. See ' + 'https://fburl.com/relay-incremental-delivery-non-streaming-warning.', _this0._operation.request.node.params.name) : void 0;
|
|
605
662
|
var relayPayloads = [];
|
|
606
663
|
incrementalPlaceholders.forEach(function (placeholder) {
|
|
607
664
|
if (placeholder.kind === 'defer') {
|
|
608
|
-
relayPayloads.push(
|
|
665
|
+
relayPayloads.push(_this0._processDeferResponse(placeholder.label, placeholder.path, placeholder, {
|
|
609
666
|
data: placeholder.data,
|
|
610
667
|
extensions: {
|
|
611
668
|
is_final: true
|
|
@@ -614,7 +671,7 @@ var Executor = /*#__PURE__*/function () {
|
|
|
614
671
|
}
|
|
615
672
|
});
|
|
616
673
|
if (relayPayloads.length > 0) {
|
|
617
|
-
|
|
674
|
+
_this0._processPayloadFollowups(relayPayloads);
|
|
618
675
|
}
|
|
619
676
|
}
|
|
620
677
|
}
|
|
@@ -629,7 +686,7 @@ var Executor = /*#__PURE__*/function () {
|
|
|
629
686
|
}
|
|
630
687
|
};
|
|
631
688
|
_proto._processFollowupPayload = function _processFollowupPayload(followupPayload) {
|
|
632
|
-
var
|
|
689
|
+
var _this1 = this;
|
|
633
690
|
switch (followupPayload.kind) {
|
|
634
691
|
case 'ModuleImportPayload':
|
|
635
692
|
var operationLoader = this._expectOperationLoader();
|
|
@@ -640,8 +697,8 @@ var Executor = /*#__PURE__*/function () {
|
|
|
640
697
|
var id = this._nextSubscriptionId++;
|
|
641
698
|
this._pendingModulePayloadsCount++;
|
|
642
699
|
var decrementPendingCount = function decrementPendingCount() {
|
|
643
|
-
|
|
644
|
-
|
|
700
|
+
_this1._pendingModulePayloadsCount--;
|
|
701
|
+
_this1._maybeCompleteSubscriptionOperationTracking();
|
|
645
702
|
};
|
|
646
703
|
var networkObservable = RelayObservable.from(new Promise(function (resolve, reject) {
|
|
647
704
|
operationLoader.load(followupPayload.operationReference).then(resolve, reject);
|
|
@@ -649,29 +706,30 @@ var Executor = /*#__PURE__*/function () {
|
|
|
649
706
|
RelayObservable.create(function (sink) {
|
|
650
707
|
var cancellationToken;
|
|
651
708
|
var subscription = networkObservable.subscribe({
|
|
709
|
+
error: sink.error,
|
|
652
710
|
next: function next(loadedNode) {
|
|
653
711
|
if (loadedNode != null) {
|
|
654
712
|
var publishModuleImportPayload = function publishModuleImportPayload() {
|
|
655
713
|
try {
|
|
656
714
|
var operation = getOperation(loadedNode);
|
|
657
715
|
var batchAsyncModuleUpdatesFN = RelayFeatureFlags.BATCH_ASYNC_MODULE_UPDATES_FN;
|
|
658
|
-
var shouldScheduleAsyncStoreUpdate = batchAsyncModuleUpdatesFN != null &&
|
|
716
|
+
var shouldScheduleAsyncStoreUpdate = batchAsyncModuleUpdatesFN != null && _this1._pendingModulePayloadsCount > 1;
|
|
659
717
|
var _withStartAndDuration = withStartAndDuration(function () {
|
|
660
|
-
|
|
718
|
+
_this1._handleFollowupPayload(followupPayload, operation);
|
|
661
719
|
if (shouldScheduleAsyncStoreUpdate) {
|
|
662
|
-
|
|
720
|
+
_this1._scheduleAsyncStoreUpdate(batchAsyncModuleUpdatesFN, sink.complete);
|
|
663
721
|
} else {
|
|
664
|
-
var updatedOwners =
|
|
665
|
-
|
|
722
|
+
var updatedOwners = _this1._runPublishQueue();
|
|
723
|
+
_this1._updateOperationTracker(updatedOwners);
|
|
666
724
|
}
|
|
667
725
|
}),
|
|
668
726
|
_ = _withStartAndDuration[0],
|
|
669
727
|
duration = _withStartAndDuration[1];
|
|
670
|
-
|
|
728
|
+
_this1._log({
|
|
729
|
+
duration: duration,
|
|
730
|
+
executeId: _this1._executeId,
|
|
671
731
|
name: 'execute.async.module',
|
|
672
|
-
|
|
673
|
-
operationName: operation.name,
|
|
674
|
-
duration: duration
|
|
732
|
+
operationName: operation.name
|
|
675
733
|
});
|
|
676
734
|
if (!shouldScheduleAsyncStoreUpdate) {
|
|
677
735
|
sink.complete();
|
|
@@ -680,7 +738,7 @@ var Executor = /*#__PURE__*/function () {
|
|
|
680
738
|
sink.error(error);
|
|
681
739
|
}
|
|
682
740
|
};
|
|
683
|
-
var scheduler =
|
|
741
|
+
var scheduler = _this1._scheduler;
|
|
684
742
|
if (scheduler == null) {
|
|
685
743
|
publishModuleImportPayload();
|
|
686
744
|
} else {
|
|
@@ -689,26 +747,25 @@ var Executor = /*#__PURE__*/function () {
|
|
|
689
747
|
} else {
|
|
690
748
|
sink.complete();
|
|
691
749
|
}
|
|
692
|
-
}
|
|
693
|
-
error: sink.error
|
|
750
|
+
}
|
|
694
751
|
});
|
|
695
752
|
return function () {
|
|
696
753
|
subscription.unsubscribe();
|
|
697
|
-
if (
|
|
698
|
-
|
|
754
|
+
if (_this1._scheduler != null && cancellationToken != null) {
|
|
755
|
+
_this1._scheduler.cancel(cancellationToken);
|
|
699
756
|
}
|
|
700
757
|
};
|
|
701
758
|
}).subscribe({
|
|
702
759
|
complete: function complete() {
|
|
703
|
-
|
|
760
|
+
_this1._complete(id);
|
|
704
761
|
decrementPendingCount();
|
|
705
762
|
},
|
|
706
763
|
error: function error(_error4) {
|
|
707
|
-
|
|
764
|
+
_this1._error(_error4);
|
|
708
765
|
decrementPendingCount();
|
|
709
766
|
},
|
|
710
767
|
start: function start(subscription) {
|
|
711
|
-
return
|
|
768
|
+
return _this1._start(id, subscription);
|
|
712
769
|
}
|
|
713
770
|
});
|
|
714
771
|
}
|
|
@@ -779,8 +836,8 @@ var Executor = /*#__PURE__*/function () {
|
|
|
779
836
|
nextParentPayloads = parentPayloads;
|
|
780
837
|
}
|
|
781
838
|
this._source.set(parentID, {
|
|
782
|
-
|
|
783
|
-
|
|
839
|
+
fieldPayloads: nextParentPayloads,
|
|
840
|
+
record: nextParentRecord
|
|
784
841
|
});
|
|
785
842
|
if (pendingResponses != null) {
|
|
786
843
|
var payloadFollowups = this._processIncrementalResponses(pendingResponses);
|
|
@@ -788,16 +845,16 @@ var Executor = /*#__PURE__*/function () {
|
|
|
788
845
|
}
|
|
789
846
|
};
|
|
790
847
|
_proto._processIncrementalResponses = function _processIncrementalResponses(incrementalResponses) {
|
|
791
|
-
var
|
|
848
|
+
var _this10 = this;
|
|
792
849
|
var relayPayloads = [];
|
|
793
850
|
incrementalResponses.forEach(function (incrementalResponse) {
|
|
794
851
|
var label = incrementalResponse.label,
|
|
795
852
|
path = incrementalResponse.path,
|
|
796
853
|
response = incrementalResponse.response;
|
|
797
|
-
var resultForLabel =
|
|
854
|
+
var resultForLabel = _this10._incrementalResults.get(label);
|
|
798
855
|
if (resultForLabel == null) {
|
|
799
856
|
resultForLabel = new Map();
|
|
800
|
-
|
|
857
|
+
_this10._incrementalResults.set(label, resultForLabel);
|
|
801
858
|
}
|
|
802
859
|
if (label.indexOf('$defer$') !== -1) {
|
|
803
860
|
var pathKey = path.map(String).join('.');
|
|
@@ -815,7 +872,7 @@ var Executor = /*#__PURE__*/function () {
|
|
|
815
872
|
}
|
|
816
873
|
var placeholder = resultForPath.placeholder;
|
|
817
874
|
!(placeholder.kind === 'defer') ? process.env.NODE_ENV !== "production" ? invariant(false, 'OperationExecutor: Expected data for path `%s` for label `%s` ' + 'to be data for @defer, was `@%s`.', pathKey, label, placeholder.kind) : invariant(false) : void 0;
|
|
818
|
-
relayPayloads.push(
|
|
875
|
+
relayPayloads.push(_this10._processDeferResponse(label, path, placeholder, response));
|
|
819
876
|
} else {
|
|
820
877
|
var _pathKey = path.slice(0, -2).map(String).join('.');
|
|
821
878
|
var _resultForPath = resultForLabel.get(_pathKey);
|
|
@@ -832,7 +889,7 @@ var Executor = /*#__PURE__*/function () {
|
|
|
832
889
|
}
|
|
833
890
|
var _placeholder = _resultForPath.placeholder;
|
|
834
891
|
!(_placeholder.kind === 'stream') ? process.env.NODE_ENV !== "production" ? invariant(false, 'OperationExecutor: Expected data for path `%s` for label `%s` ' + 'to be data for @stream, was `@%s`.', _pathKey, label, _placeholder.kind) : invariant(false) : void 0;
|
|
835
|
-
relayPayloads.push(
|
|
892
|
+
relayPayloads.push(_this10._processStreamResponse(label, path, _placeholder, response));
|
|
836
893
|
}
|
|
837
894
|
});
|
|
838
895
|
return relayPayloads;
|
|
@@ -844,25 +901,26 @@ var Executor = /*#__PURE__*/function () {
|
|
|
844
901
|
this._actorIdentifier = (_placeholder$actorIde = placeholder.actorIdentifier) !== null && _placeholder$actorIde !== void 0 ? _placeholder$actorIde : this._actorIdentifier;
|
|
845
902
|
var relayPayload = this._normalizeResponse(response, placeholder.selector, placeholder.typeName, {
|
|
846
903
|
actorIdentifier: this._actorIdentifier,
|
|
904
|
+
deferDeduplicatedFields: this._deferDeduplicatedFields,
|
|
847
905
|
getDataID: this._getDataID,
|
|
848
906
|
log: this._log,
|
|
849
907
|
path: placeholder.path,
|
|
850
|
-
|
|
851
|
-
|
|
908
|
+
shouldProcessClientComponents: this._shouldProcessClientComponents,
|
|
909
|
+
treatMissingFieldsAsNull: this._treatMissingFieldsAsNull
|
|
852
910
|
}, this._useExecTimeResolvers);
|
|
853
911
|
this._getPublishQueueAndSaveActor().commitPayload(this._operation, relayPayload);
|
|
854
912
|
var parentEntry = this._source.get(parentID);
|
|
855
913
|
!(parentEntry != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'OperationExecutor: Expected the parent record `%s` for @defer ' + 'data to exist.', parentID) : invariant(false) : void 0;
|
|
856
914
|
var fieldPayloads = parentEntry.fieldPayloads;
|
|
857
915
|
if (fieldPayloads.length !== 0) {
|
|
858
|
-
var _response$
|
|
916
|
+
var _response$extensions4;
|
|
859
917
|
var handleFieldsRelayPayload = {
|
|
860
918
|
errors: null,
|
|
861
919
|
fieldPayloads: fieldPayloads,
|
|
862
|
-
incrementalPlaceholders: null,
|
|
863
920
|
followupPayloads: null,
|
|
864
|
-
|
|
865
|
-
isFinal: ((_response$
|
|
921
|
+
incrementalPlaceholders: null,
|
|
922
|
+
isFinal: ((_response$extensions4 = response.extensions) === null || _response$extensions4 === void 0 ? void 0 : _response$extensions4.is_final) === true,
|
|
923
|
+
source: RelayRecordSource.create()
|
|
866
924
|
};
|
|
867
925
|
this._getPublishQueueAndSaveActor().commitPayload(this._operation, handleFieldsRelayPayload);
|
|
868
926
|
}
|
|
@@ -907,10 +965,10 @@ var Executor = /*#__PURE__*/function () {
|
|
|
907
965
|
var handleFieldsRelayPayload = {
|
|
908
966
|
errors: null,
|
|
909
967
|
fieldPayloads: fieldPayloads,
|
|
910
|
-
incrementalPlaceholders: null,
|
|
911
968
|
followupPayloads: null,
|
|
912
|
-
|
|
913
|
-
isFinal: false
|
|
969
|
+
incrementalPlaceholders: null,
|
|
970
|
+
isFinal: false,
|
|
971
|
+
source: RelayRecordSource.create()
|
|
914
972
|
};
|
|
915
973
|
this._getPublishQueueAndSaveActor().commitPayload(this._operation, handleFieldsRelayPayload);
|
|
916
974
|
}
|
|
@@ -942,16 +1000,17 @@ var Executor = /*#__PURE__*/function () {
|
|
|
942
1000
|
nextIDs[itemIndex] = itemID;
|
|
943
1001
|
RelayModernRecord.setLinkedRecordIDs(nextParentRecord, storageKey, nextIDs);
|
|
944
1002
|
this._source.set(parentID, {
|
|
945
|
-
|
|
946
|
-
|
|
1003
|
+
fieldPayloads: fieldPayloads,
|
|
1004
|
+
record: nextParentRecord
|
|
947
1005
|
});
|
|
948
1006
|
var relayPayload = this._normalizeResponse(response, selector, typeName, {
|
|
949
1007
|
actorIdentifier: this._actorIdentifier,
|
|
1008
|
+
deferDeduplicatedFields: false,
|
|
950
1009
|
getDataID: this._getDataID,
|
|
951
1010
|
log: this._log,
|
|
952
1011
|
path: [].concat((0, _toConsumableArray2["default"])(normalizationPath), [responseKey, String(itemIndex)]),
|
|
953
|
-
|
|
954
|
-
|
|
1012
|
+
shouldProcessClientComponents: this._shouldProcessClientComponents,
|
|
1013
|
+
treatMissingFieldsAsNull: this._treatMissingFieldsAsNull
|
|
955
1014
|
}, this._useExecTimeResolvers);
|
|
956
1015
|
return {
|
|
957
1016
|
fieldPayloads: fieldPayloads,
|
|
@@ -963,16 +1022,16 @@ var Executor = /*#__PURE__*/function () {
|
|
|
963
1022
|
};
|
|
964
1023
|
};
|
|
965
1024
|
_proto._scheduleAsyncStoreUpdate = function _scheduleAsyncStoreUpdate(scheduleFn, completeFn) {
|
|
966
|
-
var
|
|
1025
|
+
var _this11 = this;
|
|
967
1026
|
this._completeFns.push(completeFn);
|
|
968
1027
|
if (this._asyncStoreUpdateDisposable != null) {
|
|
969
1028
|
return;
|
|
970
1029
|
}
|
|
971
1030
|
this._asyncStoreUpdateDisposable = scheduleFn(function () {
|
|
972
|
-
|
|
973
|
-
var updatedOwners =
|
|
974
|
-
|
|
975
|
-
var _iterator2 = (0, _createForOfIteratorHelper2["default"])(
|
|
1031
|
+
_this11._asyncStoreUpdateDisposable = null;
|
|
1032
|
+
var updatedOwners = _this11._runPublishQueue();
|
|
1033
|
+
_this11._updateOperationTracker(updatedOwners);
|
|
1034
|
+
var _iterator2 = (0, _createForOfIteratorHelper2["default"])(_this11._completeFns),
|
|
976
1035
|
_step2;
|
|
977
1036
|
try {
|
|
978
1037
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
@@ -984,7 +1043,7 @@ var Executor = /*#__PURE__*/function () {
|
|
|
984
1043
|
} finally {
|
|
985
1044
|
_iterator2.f();
|
|
986
1045
|
}
|
|
987
|
-
|
|
1046
|
+
_this11._completeFns = [];
|
|
988
1047
|
});
|
|
989
1048
|
};
|
|
990
1049
|
_proto._updateOperationTracker = function _updateOperationTracker(updatedOwners) {
|
|
@@ -1068,7 +1127,7 @@ function partitionGraphQLResponses(responses) {
|
|
|
1068
1127
|
var incrementalResponses = [];
|
|
1069
1128
|
var normalizedResponses = [];
|
|
1070
1129
|
responses.forEach(function (response) {
|
|
1071
|
-
var _response$
|
|
1130
|
+
var _response$extensions5;
|
|
1072
1131
|
if (response.path != null || response.label != null) {
|
|
1073
1132
|
var label = response.label,
|
|
1074
1133
|
path = response.path;
|
|
@@ -1080,7 +1139,7 @@ function partitionGraphQLResponses(responses) {
|
|
|
1080
1139
|
path: path,
|
|
1081
1140
|
response: response
|
|
1082
1141
|
});
|
|
1083
|
-
} else if (((_response$
|
|
1142
|
+
} else if (((_response$extensions5 = response.extensions) === null || _response$extensions5 === void 0 ? void 0 : _response$extensions5.is_normalized) === true) {
|
|
1084
1143
|
normalizedResponses.push(response);
|
|
1085
1144
|
} else {
|
|
1086
1145
|
nonIncrementalResponses.push(response);
|
|
@@ -63,7 +63,7 @@ function getLocalVariables(currentVariables, argumentDefinitions, args) {
|
|
|
63
63
|
return nextVariables;
|
|
64
64
|
}
|
|
65
65
|
module.exports = {
|
|
66
|
-
getLocalVariables: getLocalVariables,
|
|
67
66
|
getFragmentVariables: getFragmentVariables,
|
|
67
|
+
getLocalVariables: getLocalVariables,
|
|
68
68
|
getOperationVariables: getOperationVariables
|
|
69
69
|
};
|