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.
Files changed (334) hide show
  1. package/experimental.d.ts +34 -0
  2. package/experimental.js +1 -1
  3. package/experimental.js.flow +11 -11
  4. package/handlers/RelayDefaultHandlerProvider.d.ts +12 -0
  5. package/handlers/connection/ConnectionHandler.d.ts +51 -0
  6. package/handlers/connection/ConnectionHandler.js.flow +5 -5
  7. package/handlers/connection/ConnectionInterface.d.ts +40 -0
  8. package/handlers/connection/ConnectionInterface.js.flow +1 -1
  9. package/handlers/connection/MutationHandlers.d.ts +17 -0
  10. package/index.d.ts +274 -0
  11. package/index.js +1 -1
  12. package/index.js.flow +125 -62
  13. package/lib/experimental.js +3 -3
  14. package/lib/index.js +105 -57
  15. package/lib/multi-actor-environment/ActorIdentifier.js +2 -2
  16. package/lib/multi-actor-environment/MultiActorEnvironment.js +3 -1
  17. package/lib/mutations/commitMutation.js +8 -8
  18. package/lib/mutations/validateMutation.js +4 -4
  19. package/lib/query/GraphQLTag.js +3 -3
  20. package/lib/query/fetchQuery.js +15 -3
  21. package/lib/store/DataChecker.js +38 -4
  22. package/lib/store/NormalizationEngine.js +373 -0
  23. package/lib/store/OperationExecutor.js +172 -113
  24. package/lib/store/RelayConcreteVariables.js +1 -1
  25. package/lib/store/RelayErrorTrie.js +2 -2
  26. package/lib/store/RelayExperimentalGraphResponseTransform.js +8 -8
  27. package/lib/store/RelayModernEnvironment.js +26 -19
  28. package/lib/store/RelayModernRecord.js +18 -8
  29. package/lib/store/RelayModernSelector.js +9 -9
  30. package/lib/store/RelayModernStore.js +152 -43
  31. package/lib/store/RelayPublishQueue.js +1 -1
  32. package/lib/store/RelayReader.js +76 -38
  33. package/lib/store/RelayRecordSource.js +6 -0
  34. package/lib/store/RelayReferenceMarker.js +2 -1
  35. package/lib/store/RelayResponseNormalizer.js +88 -55
  36. package/lib/store/RelayStoreSubscriptions.js +34 -10
  37. package/lib/store/RelayStoreUtils.js +8 -1
  38. package/lib/store/ResolverFragments.js +2 -2
  39. package/lib/store/live-resolvers/LiveResolverCache.js +25 -9
  40. package/lib/store/observeFragmentExperimental.js +17 -1
  41. package/lib/store/observeQueryExperimental.js +2 -2
  42. package/lib/subscription/requestSubscription.js +3 -3
  43. package/lib/util/RelayError.js +3 -0
  44. package/lib/util/RelayFeatureFlags.js +6 -2
  45. package/lib/util/RelayReplaySubject.js +4 -4
  46. package/lib/util/handlePotentialSnapshotErrors.js +2 -2
  47. package/lib/util/stableCopy.js +2 -2
  48. package/llm-docs/api-reference/entrypoint-apis/entrypoint-container.mdx +38 -0
  49. package/llm-docs/api-reference/entrypoint-apis/load-entrypoint.mdx +77 -0
  50. package/llm-docs/api-reference/entrypoint-apis/use-entrypoint-loader.mdx +99 -0
  51. package/llm-docs/api-reference/graphql/graphql-directives.mdx +378 -0
  52. package/llm-docs/api-reference/hooks/_use-lazy-load-query-extra.mdx +16 -0
  53. package/llm-docs/api-reference/hooks/load-query.mdx +84 -0
  54. package/llm-docs/api-reference/hooks/relay-environment-provider.mdx +78 -0
  55. package/llm-docs/api-reference/hooks/use-client-query.mdx +65 -0
  56. package/llm-docs/api-reference/hooks/use-fragment.mdx +69 -0
  57. package/llm-docs/api-reference/hooks/use-lazy-load-query.mdx +62 -0
  58. package/llm-docs/api-reference/hooks/use-mutation.mdx +94 -0
  59. package/llm-docs/api-reference/hooks/use-pagination-fragment.mdx +166 -0
  60. package/llm-docs/api-reference/hooks/use-prefetchable-forward-pagination-fragment.mdx +134 -0
  61. package/llm-docs/api-reference/hooks/use-preloaded-query.mdx +84 -0
  62. package/llm-docs/api-reference/hooks/use-query-loader.mdx +95 -0
  63. package/llm-docs/api-reference/hooks/use-refetchable-fragment.mdx +122 -0
  64. package/llm-docs/api-reference/hooks/use-relay-environment.mdx +37 -0
  65. package/llm-docs/api-reference/hooks/use-subscription.mdx +66 -0
  66. package/llm-docs/api-reference/relay-resolvers/docblock-format.mdx +321 -0
  67. package/llm-docs/api-reference/relay-resolvers/runtime-functions.mdx +94 -0
  68. package/llm-docs/api-reference/relay-runtime/commit-mutation.mdx +65 -0
  69. package/llm-docs/api-reference/relay-runtime/fetch-query.mdx +118 -0
  70. package/llm-docs/api-reference/relay-runtime/field-logger.mdx +170 -0
  71. package/llm-docs/api-reference/relay-runtime/observe-fragment.mdx +92 -0
  72. package/llm-docs/api-reference/relay-runtime/relay-environment.mdx +53 -0
  73. package/llm-docs/api-reference/relay-runtime/request-subscription.mdx +54 -0
  74. package/llm-docs/api-reference/relay-runtime/runtime-configuration.mdx +52 -0
  75. package/llm-docs/api-reference/relay-runtime/store.mdx +734 -0
  76. package/llm-docs/api-reference/relay-runtime/wait-for-fragment-data.mdx +89 -0
  77. package/llm-docs/api-reference/types/CacheConfig.mdx +8 -0
  78. package/llm-docs/api-reference/types/Disposable.mdx +4 -0
  79. package/llm-docs/api-reference/types/GraphQLSubscriptionConfig.mdx +17 -0
  80. package/llm-docs/api-reference/types/MutationConfig.mdx +31 -0
  81. package/llm-docs/api-reference/types/SelectorStoreUpdater.mdx +6 -0
  82. package/llm-docs/api-reference/types/UploadableMap.mdx +3 -0
  83. package/llm-docs/community/learning-resources.mdx +64 -0
  84. package/llm-docs/debugging/declarative-mutation-directives.mdx +34 -0
  85. package/llm-docs/debugging/disallowed-id-types-error.mdx +43 -0
  86. package/llm-docs/debugging/inconsistent-typename-error.mdx +47 -0
  87. package/llm-docs/debugging/relay-devtools.mdx +73 -0
  88. package/llm-docs/debugging/why-null.mdx +116 -0
  89. package/llm-docs/editor-support.mdx +55 -0
  90. package/llm-docs/error-reference/unknown-field.mdx +36 -0
  91. package/llm-docs/getting-started/babel-plugin.mdx +31 -0
  92. package/llm-docs/getting-started/compiler-config.mdx +25 -0
  93. package/llm-docs/getting-started/compiler.mdx +98 -0
  94. package/llm-docs/getting-started/lint-rules.mdx +87 -0
  95. package/llm-docs/getting-started/production.mdx +30 -0
  96. package/llm-docs/getting-started/quick-start.mdx +216 -0
  97. package/llm-docs/glossary/glossary.mdx +1040 -0
  98. package/llm-docs/guided-tour/list-data/advanced-pagination.mdx +157 -0
  99. package/llm-docs/guided-tour/list-data/connections.mdx +81 -0
  100. package/llm-docs/guided-tour/list-data/pagination.mdx +193 -0
  101. package/llm-docs/guided-tour/list-data/rendering-connections.mdx +112 -0
  102. package/llm-docs/guided-tour/list-data/streaming-pagination.mdx +87 -0
  103. package/llm-docs/guided-tour/managing-data-outside-react/retaining-queries.mdx +51 -0
  104. package/llm-docs/guided-tour/refetching/refetching-queries-with-different-data.mdx +337 -0
  105. package/llm-docs/guided-tour/refetching/refreshing-queries.mdx +350 -0
  106. package/llm-docs/guided-tour/rendering/environment.mdx +59 -0
  107. package/llm-docs/guided-tour/rendering/error-states.mdx +295 -0
  108. package/llm-docs/guided-tour/rendering/fragments.mdx +354 -0
  109. package/llm-docs/guided-tour/rendering/loading-states.mdx +245 -0
  110. package/llm-docs/guided-tour/rendering/queries.mdx +261 -0
  111. package/llm-docs/guided-tour/rendering/variables.mdx +233 -0
  112. package/llm-docs/guided-tour/reusing-cached-data/fetch-policies.mdx +56 -0
  113. package/llm-docs/guided-tour/reusing-cached-data/filling-in-missing-data.mdx +102 -0
  114. package/llm-docs/guided-tour/reusing-cached-data/introduction.mdx +22 -0
  115. package/llm-docs/guided-tour/reusing-cached-data/presence-of-data.mdx +93 -0
  116. package/llm-docs/guided-tour/reusing-cached-data/rendering-partially-cached-data.mdx +175 -0
  117. package/llm-docs/guided-tour/reusing-cached-data/staleness-of-data.mdx +116 -0
  118. package/llm-docs/guided-tour/updating-data/client-only-data.mdx +115 -0
  119. package/llm-docs/guided-tour/updating-data/graphql-mutations.mdx +334 -0
  120. package/llm-docs/guided-tour/updating-data/graphql-subscriptions.mdx +279 -0
  121. package/llm-docs/guided-tour/updating-data/imperatively-modifying-linked-fields.mdx +511 -0
  122. package/llm-docs/guided-tour/updating-data/imperatively-modifying-store-data-legacy.mdx +142 -0
  123. package/llm-docs/guided-tour/updating-data/imperatively-modifying-store-data.mdx +275 -0
  124. package/llm-docs/guided-tour/updating-data/introduction.mdx +25 -0
  125. package/llm-docs/guided-tour/updating-data/local-data-updates.mdx +71 -0
  126. package/llm-docs/guided-tour/updating-data/typesafe-updaters-faq.mdx +83 -0
  127. package/llm-docs/guided-tour/updating-data/updating-connections.mdx +592 -0
  128. package/llm-docs/guides/alias-directive.mdx +160 -0
  129. package/llm-docs/guides/catch-directive.mdx +167 -0
  130. package/llm-docs/guides/client-schema-extensions.mdx +208 -0
  131. package/llm-docs/guides/codemods.mdx +79 -0
  132. package/llm-docs/guides/data-driven-dependencies/client-3d.mdx +255 -0
  133. package/llm-docs/guides/data-driven-dependencies/configuration.mdx +127 -0
  134. package/llm-docs/guides/data-driven-dependencies/introduction.mdx +39 -0
  135. package/llm-docs/guides/data-driven-dependencies/server-3d.mdx +664 -0
  136. package/llm-docs/guides/document-comparison.mdx +106 -0
  137. package/llm-docs/guides/graphql-server-specification.mdx +453 -0
  138. package/llm-docs/guides/network-layer.mdx +69 -0
  139. package/llm-docs/guides/persisted-queries.mdx +328 -0
  140. package/llm-docs/guides/relay-resolvers/context.mdx +99 -0
  141. package/llm-docs/guides/relay-resolvers/defining-fields.mdx +151 -0
  142. package/llm-docs/guides/relay-resolvers/defining-types.mdx +164 -0
  143. package/llm-docs/guides/relay-resolvers/deprecated.mdx +27 -0
  144. package/llm-docs/guides/relay-resolvers/derived-fields.mdx +127 -0
  145. package/llm-docs/guides/relay-resolvers/descriptions.mdx +44 -0
  146. package/llm-docs/guides/relay-resolvers/enabling.mdx +41 -0
  147. package/llm-docs/guides/relay-resolvers/errors.mdx +64 -0
  148. package/llm-docs/guides/relay-resolvers/field-arguments.mdx +63 -0
  149. package/llm-docs/guides/relay-resolvers/introduction.mdx +62 -0
  150. package/llm-docs/guides/relay-resolvers/limitations.mdx +30 -0
  151. package/llm-docs/guides/relay-resolvers/live-fields.mdx +164 -0
  152. package/llm-docs/guides/relay-resolvers/return-types.mdx +161 -0
  153. package/llm-docs/guides/relay-resolvers/suspense.mdx +41 -0
  154. package/llm-docs/guides/required-directive.mdx +240 -0
  155. package/llm-docs/guides/semantic-nullability.mdx +93 -0
  156. package/llm-docs/guides/testing-relay-components.mdx +642 -0
  157. package/llm-docs/guides/testing-relay-with-preloaded-queries.mdx +160 -0
  158. package/llm-docs/guides/throw-on-field-error-directive.mdx +58 -0
  159. package/llm-docs/guides/type-emission.mdx +414 -0
  160. package/llm-docs/home.mdx +32 -0
  161. package/llm-docs/principles-and-architecture/architecture-overview.mdx +24 -0
  162. package/llm-docs/principles-and-architecture/compiler-architecture.mdx +106 -0
  163. package/llm-docs/principles-and-architecture/runtime-architecture.mdx +249 -0
  164. package/llm-docs/principles-and-architecture/thinking-in-graphql.mdx +309 -0
  165. package/llm-docs/principles-and-architecture/thinking-in-relay.mdx +104 -0
  166. package/llm-docs/principles-and-architecture/videos.mdx +50 -0
  167. package/llm-docs/tutorial/arrays-lists.mdx +126 -0
  168. package/llm-docs/tutorial/fragments-1.mdx +487 -0
  169. package/llm-docs/tutorial/graphql.mdx +172 -0
  170. package/llm-docs/tutorial/interfaces-polymorphism.mdx +161 -0
  171. package/llm-docs/tutorial/intro.mdx +58 -0
  172. package/llm-docs/tutorial/mutations-updates.mdx +624 -0
  173. package/llm-docs/tutorial/organizing-mutations-queries-and-subscriptions.mdx +13 -0
  174. package/llm-docs/tutorial/queries-1.mdx +267 -0
  175. package/llm-docs/tutorial/queries-2.mdx +389 -0
  176. package/llm-docs/tutorial/refetchable-fragments.mdx +352 -0
  177. package/multi-actor-environment/ActorIdentifier.d.ts +17 -0
  178. package/multi-actor-environment/ActorIdentifier.js.flow +2 -2
  179. package/multi-actor-environment/ActorSpecificEnvironment.js.flow +15 -15
  180. package/multi-actor-environment/ActorUtils.js.flow +1 -1
  181. package/multi-actor-environment/MultiActorEnvironment.d.ts +123 -0
  182. package/multi-actor-environment/MultiActorEnvironment.js.flow +32 -24
  183. package/multi-actor-environment/MultiActorEnvironmentTypes.d.ts +225 -0
  184. package/multi-actor-environment/MultiActorEnvironmentTypes.js.flow +6 -6
  185. package/multi-actor-environment/index.d.ts +14 -0
  186. package/multi-actor-environment.d.ts +8 -0
  187. package/mutations/RelayDeclarativeMutationConfig.d.ts +70 -0
  188. package/mutations/RelayDeclarativeMutationConfig.js.flow +9 -9
  189. package/mutations/RelayRecordProxy.js.flow +8 -11
  190. package/mutations/RelayRecordSourceMutator.js.flow +4 -4
  191. package/mutations/RelayRecordSourceProxy.js.flow +4 -4
  192. package/mutations/RelayRecordSourceSelectorProxy.js.flow +6 -6
  193. package/mutations/applyOptimisticMutation.d.ts +25 -0
  194. package/mutations/applyOptimisticMutation.js.flow +2 -2
  195. package/mutations/commitLocalUpdate.d.ts +10 -0
  196. package/mutations/commitMutation.d.ts +48 -0
  197. package/mutations/commitMutation.js.flow +21 -17
  198. package/mutations/createUpdatableProxy.js.flow +19 -19
  199. package/mutations/readUpdatableFragment.js.flow +3 -3
  200. package/mutations/readUpdatableQuery.js.flow +3 -3
  201. package/mutations/validateMutation.js.flow +7 -7
  202. package/network/RelayNetwork.d.ts +12 -0
  203. package/network/RelayNetworkTypes.d.ts +145 -0
  204. package/network/RelayNetworkTypes.js.flow +18 -18
  205. package/network/RelayObservable.d.ts +197 -0
  206. package/network/RelayObservable.js.flow +32 -30
  207. package/network/RelayQueryResponseCache.d.ts +16 -0
  208. package/network/RelayQueryResponseCache.js.flow +3 -3
  209. package/network/wrapNetworkWithLogObserver.js.flow +1 -1
  210. package/package.json +2 -1
  211. package/query/GraphQLTag.d.ts +45 -0
  212. package/query/GraphQLTag.js.flow +22 -10
  213. package/query/fetchQuery.d.ts +21 -0
  214. package/query/fetchQuery.js.flow +23 -10
  215. package/query/fetchQueryInternal.d.ts +26 -0
  216. package/query/fetchQueryInternal.js.flow +4 -4
  217. package/query/fetchQuery_DEPRECATED.d.ts +17 -0
  218. package/query/fetchQuery_DEPRECATED.js.flow +1 -1
  219. package/store/ClientID.d.ts +14 -0
  220. package/store/DataChecker.js.flow +51 -15
  221. package/store/NormalizationEngine.js.flow +782 -0
  222. package/store/OperationExecutor.d.ts +51 -0
  223. package/store/OperationExecutor.js.flow +204 -98
  224. package/store/RelayConcreteVariables.js.flow +5 -5
  225. package/store/RelayErrorTrie.js.flow +12 -12
  226. package/store/RelayExperimentalGraphResponseHandler.js.flow +3 -3
  227. package/store/RelayExperimentalGraphResponseTransform.js.flow +10 -10
  228. package/store/RelayModernEnvironment.d.ts +97 -0
  229. package/store/RelayModernEnvironment.js.flow +58 -43
  230. package/store/RelayModernFragmentSpecResolver.js.flow +1 -1
  231. package/store/RelayModernOperationDescriptor.d.ts +28 -0
  232. package/store/RelayModernOperationDescriptor.js.flow +1 -1
  233. package/store/RelayModernRecord.d.ts +92 -0
  234. package/store/RelayModernRecord.js.flow +44 -20
  235. package/store/RelayModernSelector.d.ts +123 -0
  236. package/store/RelayModernSelector.js.flow +21 -21
  237. package/store/RelayModernStore.d.ts +57 -0
  238. package/store/RelayModernStore.js.flow +219 -58
  239. package/store/RelayOperationTracker.d.ts +29 -0
  240. package/store/RelayOperationTracker.js.flow +2 -2
  241. package/store/RelayOptimisticRecordSource.js.flow +2 -2
  242. package/store/RelayPublishQueue.js.flow +29 -20
  243. package/store/RelayReader.js.flow +129 -57
  244. package/store/RelayRecordSource.d.ts +26 -0
  245. package/store/RelayRecordSource.js.flow +10 -0
  246. package/store/RelayRecordState.d.ts +28 -0
  247. package/store/RelayRecordState.js.flow +1 -1
  248. package/store/RelayReferenceMarker.js.flow +5 -4
  249. package/store/RelayResponseNormalizer.d.ts +28 -0
  250. package/store/RelayResponseNormalizer.js.flow +130 -62
  251. package/store/RelayStoreSubscriptions.js.flow +52 -8
  252. package/store/RelayStoreTypes.d.ts +1327 -0
  253. package/store/RelayStoreTypes.js.flow +371 -278
  254. package/store/RelayStoreUtils.d.ts +86 -0
  255. package/store/RelayStoreUtils.js.flow +16 -8
  256. package/store/ResolverCache.js.flow +2 -2
  257. package/store/ResolverFragments.d.ts +43 -0
  258. package/store/ResolverFragments.js.flow +22 -14
  259. package/store/StoreInspector.js.flow +7 -8
  260. package/store/ViewerPattern.d.ts +11 -0
  261. package/store/cloneRelayHandleSourceField.js.flow +1 -1
  262. package/store/cloneRelayScalarHandleSourceField.js.flow +1 -1
  263. package/store/createFragmentSpecResolver.d.ts +16 -0
  264. package/store/createRelayContext.js.flow +1 -1
  265. package/store/createRelayLoggingContext.js.flow +4 -4
  266. package/store/defaultGetDataID.js.flow +2 -2
  267. package/store/isRelayModernEnvironment.d.ts +8 -0
  268. package/store/isRelayModernEnvironment.js.flow +4 -2
  269. package/store/live-resolvers/LiveResolverCache.js.flow +55 -20
  270. package/store/live-resolvers/LiveResolverSuspenseSentinel.js.flow +3 -3
  271. package/store/live-resolvers/getOutputTypeRecordIDs.js.flow +1 -1
  272. package/store/live-resolvers/isLiveStateValue.js.flow +2 -2
  273. package/store/live-resolvers/resolverDataInjector.d.ts +27 -0
  274. package/store/live-resolvers/resolverDataInjector.js.flow +8 -5
  275. package/store/observeFragmentExperimental.d.ts +46 -0
  276. package/store/observeFragmentExperimental.js.flow +50 -21
  277. package/store/observeQueryExperimental.d.ts +30 -0
  278. package/store/observeQueryExperimental.js.flow +5 -5
  279. package/store/readInlineData.d.ts +19 -0
  280. package/store/readInlineData.js.flow +5 -5
  281. package/store/waitForFragmentExperimental.d.ts +49 -0
  282. package/store/waitForFragmentExperimental.js.flow +3 -3
  283. package/subscription/requestSubscription.d.ts +27 -0
  284. package/subscription/requestSubscription.js.flow +10 -10
  285. package/util/JSResourceTypes.flow.js.flow +4 -4
  286. package/util/NormalizationNode.d.ts +235 -0
  287. package/util/NormalizationNode.js.flow +127 -123
  288. package/util/ReaderNode.d.ts +264 -0
  289. package/util/ReaderNode.js.flow +156 -151
  290. package/util/RelayConcreteNode.d.ts +120 -0
  291. package/util/RelayConcreteNode.js.flow +32 -32
  292. package/util/RelayError.d.ts +13 -0
  293. package/util/RelayError.js.flow +4 -1
  294. package/util/RelayFeatureFlags.d.ts +40 -0
  295. package/util/RelayFeatureFlags.js.flow +21 -1
  296. package/util/RelayProfiler.d.ts +121 -0
  297. package/util/RelayProfiler.js.flow +1 -1
  298. package/util/RelayReplaySubject.d.ts +25 -0
  299. package/util/RelayReplaySubject.js.flow +3 -3
  300. package/util/RelayRuntimeTypes.d.ts +59 -0
  301. package/util/RelayRuntimeTypes.js.flow +36 -33
  302. package/util/createPayloadFor3DField.d.ts +17 -0
  303. package/util/createPayloadFor3DField.js.flow +9 -5
  304. package/util/deepFreeze.d.ts +8 -0
  305. package/util/deepFreeze.js.flow +2 -2
  306. package/util/getFragmentIdentifier.d.ts +10 -0
  307. package/util/getFragmentIdentifier.js.flow +1 -1
  308. package/util/getPaginationMetadata.d.ts +20 -0
  309. package/util/getPaginationMetadata.js.flow +1 -1
  310. package/util/getPaginationVariables.d.ts +20 -0
  311. package/util/getPaginationVariables.js.flow +1 -1
  312. package/util/getPendingOperationsForFragment.d.ts +18 -0
  313. package/util/getPendingOperationsForFragment.js.flow +2 -2
  314. package/util/getRefetchMetadata.d.ts +19 -0
  315. package/util/getRefetchMetadata.js.flow +6 -5
  316. package/util/getRelayHandleKey.d.ts +8 -0
  317. package/util/getRequestIdentifier.d.ts +17 -0
  318. package/util/getValueAtPath.d.ts +8 -0
  319. package/util/getValueAtPath.js.flow +3 -3
  320. package/util/handlePotentialSnapshotErrors.d.ts +14 -0
  321. package/util/handlePotentialSnapshotErrors.js.flow +5 -5
  322. package/util/isEmptyObject.js.flow +1 -1
  323. package/util/isPromise.d.ts +8 -0
  324. package/util/isPromise.js.flow +2 -2
  325. package/util/isScalarAndEqual.d.ts +8 -0
  326. package/util/isScalarAndEqual.js.flow +1 -1
  327. package/util/recycleNodesInto.d.ts +8 -0
  328. package/util/recycleNodesInto.js.flow +2 -2
  329. package/util/registerEnvironmentWithDevTools.js.flow +1 -1
  330. package/util/shallowFreeze.js.flow +1 -1
  331. package/util/stableCopy.d.ts +8 -0
  332. package/util/stableCopy.js.flow +5 -5
  333. package/util/withProvidedVariables.d.ts +19 -0
  334. package/util/withProvidedVariables.js.flow +14 -10
@@ -21,12 +21,12 @@ import type RelayObservable, {ObservableFromValue} from './RelayObservable';
21
21
  * queries.
22
22
  */
23
23
  export interface INetwork {
24
- +execute: ExecuteFunction;
24
+ readonly execute: ExecuteFunction;
25
25
  }
26
26
 
27
- export type LogRequestInfoFunction = mixed => void;
27
+ export type LogRequestInfoFunction = unknown => void;
28
28
 
29
- export type PayloadData = {+[key: string]: mixed};
29
+ export type PayloadData = {readonly [key: string]: unknown};
30
30
 
31
31
  export type PayloadError = interface {
32
32
  message: string,
@@ -40,26 +40,26 @@ export type PayloadError = interface {
40
40
  severity?: 'CRITICAL' | 'ERROR' | 'WARNING',
41
41
  };
42
42
 
43
- export type PayloadExtensions = {[key: string]: mixed, ...};
43
+ export type PayloadExtensions = {[key: string]: unknown, ...};
44
44
 
45
45
  /**
46
46
  * The shape of a GraphQL response as dictated by the
47
47
  * [spec](https://spec.graphql.org/June2018/#sec-Response-Format).
48
48
  */
49
49
  export type GraphQLResponseWithData = {
50
- +data: PayloadData,
51
- +errors?: Array<PayloadError>,
52
- +extensions?: PayloadExtensions,
53
- +label?: string,
54
- +path?: Array<string | number>,
50
+ readonly data: PayloadData,
51
+ readonly errors?: Array<PayloadError>,
52
+ readonly extensions?: PayloadExtensions,
53
+ readonly label?: string,
54
+ readonly path?: Array<string | number>,
55
55
  };
56
56
 
57
57
  export type GraphQLResponseWithoutData = {
58
- +data?: ?PayloadData,
59
- +errors: Array<PayloadError>,
60
- +extensions?: PayloadExtensions,
61
- +label?: string,
62
- +path?: Array<string | number>,
58
+ readonly data?: ?PayloadData,
59
+ readonly errors: Array<PayloadError>,
60
+ readonly extensions?: PayloadExtensions,
61
+ readonly label?: string,
62
+ readonly path?: Array<string | number>,
63
63
  };
64
64
 
65
65
  export type GraphQLResponseWithExtensionsOnly = {
@@ -71,8 +71,8 @@ export type GraphQLResponseWithExtensionsOnly = {
71
71
  // since `data: null` is a *required* output if there was an error during
72
72
  // execution, but the inverse is not described in the sepc: `data: null`
73
73
  // does not necessarily indicate that there was an error.
74
- +data: null,
75
- +extensions: PayloadExtensions,
74
+ readonly data: null,
75
+ readonly extensions: PayloadExtensions,
76
76
  };
77
77
 
78
78
  export type GraphQLSingularResponse =
@@ -82,7 +82,7 @@ export type GraphQLSingularResponse =
82
82
 
83
83
  export type GraphQLResponse =
84
84
  | GraphQLSingularResponse
85
- | $ReadOnlyArray<GraphQLSingularResponse>;
85
+ | ReadonlyArray<GraphQLSingularResponse>;
86
86
 
87
87
  /**
88
88
  * A function that pre-process the response at the network layer. This
@@ -134,4 +134,4 @@ export type SubscribeFunction = (
134
134
  ) => RelayObservable<GraphQLResponse>;
135
135
 
136
136
  export type Uploadable = File | Blob;
137
- export type UploadableMap = {+[key: string]: Uploadable};
137
+ export type UploadableMap = {readonly [key: string]: Uploadable};
@@ -0,0 +1,197 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ /**
9
+ * A Subscription object is returned from .subscribe(), which can be
10
+ * unsubscribed or checked to see if the resulting subscription has closed.
11
+ */
12
+ export interface Subscription {
13
+ unsubscribe(): void;
14
+ readonly closed: boolean;
15
+ }
16
+
17
+ /**
18
+ * An Observer is an object of optional callback functions provided to
19
+ * .subscribe(). Each callback function is invoked when that event occurs.
20
+ */
21
+ export interface Observer<T> {
22
+ readonly start?: ((subscription: Subscription) => void) | undefined;
23
+ readonly next?: ((value: T) => void) | undefined;
24
+ readonly error?: ((error: Error) => void) | undefined;
25
+ readonly complete?: (() => void) | undefined;
26
+ readonly unsubscribe?: ((subscription: Subscription) => void) | undefined;
27
+ }
28
+
29
+ /**
30
+ * A Sink is an object of methods provided by Observable during construction.
31
+ * The methods are to be called to trigger each event. It also contains a closed
32
+ * field to see if the resulting subscription has closed.
33
+ */
34
+ export interface Sink<T> {
35
+ next(value: T): void;
36
+ error(error: Error, isUncaughtThrownError?: boolean): void;
37
+ complete(): void;
38
+ readonly closed: boolean;
39
+ }
40
+
41
+ /**
42
+ * A Source is the required argument when constructing a new Observable. Similar
43
+ * to a Promise constructor, this is a function which is invoked with a Sink,
44
+ * and may return either a cleanup function or a Subscription instance (for use
45
+ * when composing Observables).
46
+ */
47
+ export type Source<T> = (sink: Sink<T>) => void | Subscription | (() => unknown);
48
+
49
+ /**
50
+ * A Subscribable is an interface describing any object which can be subscribed.
51
+ *
52
+ * Note: A sink may be passed directly to .subscribe() as its observer,
53
+ * allowing for easily composing Subscribables.
54
+ */
55
+ export interface Subscribable<T> {
56
+ subscribe(observer: Observer<T> | Sink<T>): Subscription;
57
+ }
58
+
59
+ export type ObservableFromValue<T> = Subscribable<T> | Promise<T> | T;
60
+
61
+ /**
62
+ * Limited implementation of ESObservable, providing the limited set of behavior
63
+ * Relay networking requires.
64
+ *
65
+ * Observables retain the benefit of callbacks which can be called
66
+ * synchronously, avoiding any UI jitter, while providing a compositional API,
67
+ * which simplifies logic and prevents mishandling of errors compared to
68
+ * the direct use of callback functions.
69
+ *
70
+ * ESObservable: https://github.com/tc39/proposal-observable
71
+ */
72
+ export class RelayObservable<T> implements Subscribable<T> {
73
+ // Use RelayObservable.create(source);
74
+ private constructor(source: never);
75
+
76
+ static create<V>(source: Source<V>): RelayObservable<V>;
77
+
78
+ /**
79
+ * When an emitted error event is not handled by an Observer, it is reported
80
+ * to the host environment (what the ESObservable spec refers to as
81
+ * "HostReportErrors()").
82
+ *
83
+ * The default implementation in development rethrows thrown errors, and
84
+ * logs emitted error events to the console, while in production does nothing
85
+ * (swallowing unhandled errors).
86
+ *
87
+ * Called during application initialization, this method allows
88
+ * application-specific handling of unhandled errors. Allowing, for example,
89
+ * integration with error logging or developer tools.
90
+ *
91
+ * A second parameter `isUncaughtThrownError` is true when the unhandled error
92
+ * was thrown within an Observer handler, and false when the unhandled error
93
+ * was an unhandled emitted event.
94
+ *
95
+ * - Uncaught thrown errors typically represent avoidable errors thrown from
96
+ * application code, which should be handled with a try/catch block, and
97
+ * usually have useful stack traces.
98
+ *
99
+ * - Unhandled emitted event errors typically represent unavoidable events in
100
+ * application flow such as network failure, and may not have useful
101
+ * stack traces.
102
+ */
103
+ static onUnhandledError(callback: (error: Error, isUncaughtThrownError: boolean) => void): void;
104
+
105
+ /**
106
+ * Accepts various kinds of data sources, and always returns a RelayObservable
107
+ * useful for accepting the result of a user-provided FetchFunction.
108
+ */
109
+ static from<V>(obj: ObservableFromValue<V>): RelayObservable<V>;
110
+
111
+ /**
112
+ * Similar to promise.catch(), observable.catch() handles error events, and
113
+ * provides an alternative observable to use in it's place.
114
+ *
115
+ * If the catch handler throws a new error, it will appear as an error event
116
+ * on the resulting Observable.
117
+ */
118
+ catch<U>(fn: (error: Error) => RelayObservable<U>): RelayObservable<T | U>;
119
+
120
+ /**
121
+ * Returns a new Observable which first yields values from this Observable,
122
+ * then yields values from the next Observable. This is useful for chaining
123
+ * together Observables of finite length.
124
+ */
125
+ concat<U>(next: RelayObservable<U>): RelayObservable<T | U>;
126
+
127
+ /**
128
+ * Returns a new Observable which returns the same values as this one, but
129
+ * modified so that the provided Observer is called to perform a side-effects
130
+ * for all events emitted by the source.
131
+ *
132
+ * Any errors that are thrown in the side-effect Observer are unhandled, and
133
+ * do not affect the source Observable or its Observer.
134
+ *
135
+ * This is useful for when debugging your Observables or performing other
136
+ * side-effects such as logging or performance monitoring.
137
+ */
138
+ do(observer: Observer<T>): RelayObservable<T>;
139
+
140
+ /**
141
+ * Returns a new Observable which returns the same values as this one, but
142
+ * modified so that the finally callback is performed after completion,
143
+ * whether normal or due to error or unsubscription.
144
+ *
145
+ * This is useful for cleanup such as resource finalization.
146
+ */
147
+ finally(fn: () => unknown): RelayObservable<T>;
148
+
149
+ /**
150
+ * Returns a new Observable which is identical to this one, unless this
151
+ * Observable completes before yielding any values, in which case the new
152
+ * Observable will yield the values from the alternate Observable.
153
+ *
154
+ * If this Observable does yield values, the alternate is never subscribed to.
155
+ *
156
+ * This is useful for scenarios where values may come from multiple sources
157
+ * which should be tried in order, i.e. from a cache before a network.
158
+ */
159
+ ifEmpty<U>(alternate: RelayObservable<U>): RelayObservable<T | U>;
160
+
161
+ /**
162
+ * Observable's primary API: returns an unsubscribable Subscription to the
163
+ * source of this Observable.
164
+ *
165
+ * Note: A sink may be passed directly to .subscribe() as its observer,
166
+ * allowing for easily composing Observables.
167
+ */
168
+ subscribe(observer: Observer<T> | Sink<T>): Subscription;
169
+
170
+ /**
171
+ * Returns a new Observerable where each value has been transformed by
172
+ * the mapping function.
173
+ */
174
+ map<U>(fn: (value: T) => U): RelayObservable<U>;
175
+
176
+ /**
177
+ * Returns a new Observable where each value is replaced with a new Observable
178
+ * by the mapping function, the results of which returned as a single
179
+ * merged Observable.
180
+ */
181
+ mergeMap<U>(fn: (value: T) => ObservableFromValue<U>): RelayObservable<U>;
182
+
183
+ /**
184
+ * Returns a new Observable which first mirrors this Observable, then when it
185
+ * completes, waits for `pollInterval` milliseconds before re-subscribing to
186
+ * this Observable again, looping in this manner until unsubscribed.
187
+ *
188
+ * The returned Observable never completes.
189
+ */
190
+ poll(pollInterval: number): RelayObservable<T>;
191
+
192
+ /**
193
+ * Returns a Promise which resolves when this Observable yields a first value
194
+ * or when it completes with no value.
195
+ */
196
+ toPromise(): Promise<T | undefined>;
197
+ }
@@ -18,14 +18,14 @@ const isPromise = require('../util/isPromise');
18
18
  * unsubscribed or checked to see if the resulting subscription has closed.
19
19
  */
20
20
  export type Subscription = {
21
- +unsubscribe: () => void,
22
- +closed: boolean,
21
+ readonly unsubscribe: () => void,
22
+ readonly closed: boolean,
23
23
  };
24
24
 
25
25
  type SubscriptionFn = {
26
- (): mixed,
27
- +unsubscribe?: void,
28
- +closed?: void,
26
+ (): unknown,
27
+ readonly unsubscribe?: void,
28
+ readonly closed?: void,
29
29
  ...
30
30
  };
31
31
 
@@ -33,12 +33,12 @@ type SubscriptionFn = {
33
33
  * An Observer is an object of optional callback functions provided to
34
34
  * .subscribe(). Each callback function is invoked when that event occurs.
35
35
  */
36
- export type Observer<-T> = {
37
- +start?: ?(Subscription) => mixed,
38
- +next?: ?(T) => mixed,
39
- +error?: ?(Error) => mixed,
40
- +complete?: ?() => mixed,
41
- +unsubscribe?: ?(Subscription) => mixed,
36
+ export type Observer<in T> = {
37
+ readonly start?: ?(Subscription) => unknown,
38
+ readonly next?: ?(T) => unknown,
39
+ readonly error?: ?(Error) => unknown,
40
+ readonly complete?: ?() => unknown,
41
+ readonly unsubscribe?: ?(Subscription) => unknown,
42
42
  };
43
43
 
44
44
  /**
@@ -46,11 +46,11 @@ export type Observer<-T> = {
46
46
  * The methods are to be called to trigger each event. It also contains a closed
47
47
  * field to see if the resulting subscription has closed.
48
48
  */
49
- export type Sink<-T> = {
50
- +next: T => void,
51
- +error: (Error, isUncaughtThrownError?: boolean) => void,
52
- +complete: () => void,
53
- +closed: boolean,
49
+ export type Sink<in T> = {
50
+ readonly next: T => void,
51
+ readonly error: (Error, isUncaughtThrownError?: boolean) => void,
52
+ readonly complete: () => void,
53
+ readonly closed: boolean,
54
54
  };
55
55
 
56
56
  /**
@@ -59,7 +59,7 @@ export type Sink<-T> = {
59
59
  * and may return either a cleanup function or a Subscription instance (for use
60
60
  * when composing Observables).
61
61
  */
62
- export type Source<+T> = (Sink<T>) => void | Subscription | SubscriptionFn;
62
+ export type Source<out T> = (Sink<T>) => void | Subscription | SubscriptionFn;
63
63
 
64
64
  /**
65
65
  * A Subscribable is an interface describing any object which can be subscribed.
@@ -67,14 +67,14 @@ export type Source<+T> = (Sink<T>) => void | Subscription | SubscriptionFn;
67
67
  * Note: A sink may be passed directly to .subscribe() as its observer,
68
68
  * allowing for easily composing Subscribables.
69
69
  */
70
- export interface Subscribable<+T> {
70
+ export interface Subscribable<out T> {
71
71
  subscribe(observer: Observer<T> | Sink<T>): Subscription;
72
72
  }
73
73
 
74
- export type ObservableFromValue<+T> = Subscribable<T> | Promise<T> | T;
74
+ export type ObservableFromValue<out T> = Subscribable<T> | Promise<T> | T;
75
75
 
76
76
  let hostReportError:
77
- | ((Error, isUncaughtThrownError: boolean) => mixed)
77
+ | ((Error, isUncaughtThrownError: boolean) => unknown)
78
78
  | ((_error: Error, _isUncaughtThrownError: boolean) => void) = swallowError;
79
79
 
80
80
  /**
@@ -88,11 +88,11 @@ let hostReportError:
88
88
  *
89
89
  * ESObservable: https://github.com/tc39/proposal-observable
90
90
  */
91
- class RelayObservable<+T> implements Subscribable<T> {
92
- +_source: Source<T>;
91
+ class RelayObservable<out T> implements Subscribable<T> {
92
+ readonly _source: Source<T>;
93
93
 
94
94
  static create<V>(source: Source<V>): RelayObservable<V> {
95
- return new RelayObservable((source: any));
95
+ return new RelayObservable(source as any);
96
96
  }
97
97
 
98
98
  // Use RelayObservable.create()
@@ -103,7 +103,7 @@ class RelayObservable<+T> implements Subscribable<T> {
103
103
  throw new Error('Source must be a Function: ' + String(source));
104
104
  }
105
105
  }
106
- (this: any)._source = source;
106
+ (this as any)._source = source;
107
107
  }
108
108
 
109
109
  /**
@@ -132,7 +132,7 @@ class RelayObservable<+T> implements Subscribable<T> {
132
132
  * stack traces.
133
133
  */
134
134
  static onUnhandledError(
135
- callback: (Error, isUncaughtThrownError: boolean) => mixed,
135
+ callback: (Error, isUncaughtThrownError: boolean) => unknown,
136
136
  ): void {
137
137
  hostReportError = callback;
138
138
  }
@@ -247,7 +247,7 @@ class RelayObservable<+T> implements Subscribable<T> {
247
247
  *
248
248
  * This is useful for cleanup such as resource finalization.
249
249
  */
250
- finally(fn: () => mixed): RelayObservable<T> {
250
+ finally(fn: () => unknown): RelayObservable<T> {
251
251
  return RelayObservable.create(sink => {
252
252
  const subscription = this.subscribe(sink);
253
253
  return () => {
@@ -351,6 +351,8 @@ class RelayObservable<+T> implements Subscribable<T> {
351
351
  }
352
352
 
353
353
  function complete(this: ObservableContext) {
354
+ /* $FlowFixMe[incompatible-type] Error exposed after improved typing of
355
+ * Array.{includes,indexOf,lastIndexOf} */
354
356
  subscriptions.splice(subscriptions.indexOf(this._sub), 1);
355
357
  if (subscriptions.length === 0) {
356
358
  sink.complete();
@@ -445,9 +447,9 @@ class RelayObservable<+T> implements Subscribable<T> {
445
447
  }
446
448
 
447
449
  // Use declarations to teach Flow how to check isObservable.
448
- declare function isObservable<T>(obj: mixed): obj is Subscribable<T>;
450
+ declare function isObservable<T>(obj: unknown): obj is Subscribable<T>;
449
451
 
450
- function isObservable(obj: mixed) {
452
+ function isObservable(obj: unknown) {
451
453
  return (
452
454
  typeof obj === 'object' &&
453
455
  obj !== null &&
@@ -489,8 +491,8 @@ function subscribe<T>(
489
491
  // Subscription objects below, however not all flow environments we expect
490
492
  // Relay to be used within will support property getters, and many minifier
491
493
  // tools still do not support ES5 syntax. Instead, we can use defineProperty.
492
- const withClosed: <O>(obj: O) => {...O, +closed: boolean} = (obj =>
493
- Object.defineProperty(obj, 'closed', ({get: () => closed}: any)): any);
494
+ const withClosed: <O>(obj: O) => {...O, readonly closed: boolean} = (obj =>
495
+ Object.defineProperty(obj, 'closed', {get: () => closed} as any)) as any;
494
496
 
495
497
  function doCleanup() {
496
498
  if (cleanup) {
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { GraphQLResponse } from '../network/RelayNetworkTypes';
9
+ import { Variables } from '../util/RelayRuntimeTypes';
10
+
11
+ export default class RelayQueryResponseCache {
12
+ constructor(config: { size: number; ttl: number });
13
+ clear(): void;
14
+ get(queryID: string, variables: Variables): GraphQLResponse | null;
15
+ set(queryID: string, variables: Variables, payload: GraphQLResponse): void;
16
+ }
@@ -77,16 +77,16 @@ class RelayQueryResponseCache {
77
77
  ...payload.extensions,
78
78
  cacheTimestamp: response.fetchTime,
79
79
  },
80
- }: GraphQLSingularResponse),
80
+ }) as GraphQLSingularResponse,
81
81
  );
82
82
  }
83
- return ({
83
+ return {
84
84
  ...response.payload,
85
85
  extensions: {
86
86
  ...response.payload.extensions,
87
87
  cacheTimestamp: response.fetchTime,
88
88
  },
89
- }: GraphQLSingularResponse);
89
+ } as GraphQLSingularResponse;
90
90
  }
91
91
 
92
92
  set(queryID: string, variables: Variables, payload: GraphQLResponse): void {
@@ -90,7 +90,7 @@ function wrapNetworkWithLogObserver(
90
90
  });
91
91
  },
92
92
  };
93
- const logRequestInfo = (info: mixed) => {
93
+ const logRequestInfo = (info: unknown) => {
94
94
  env.__log({
95
95
  name: 'network.info',
96
96
  networkRequestId,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "relay-runtime",
3
3
  "description": "A core runtime for building GraphQL-driven applications.",
4
- "version": "20.1.1",
4
+ "version": "21.0.1",
5
5
  "keywords": [
6
6
  "graphql",
7
7
  "relay"
@@ -23,5 +23,6 @@
23
23
  "": "./"
24
24
  },
25
25
  "main": "index.js",
26
+ "types": "index.d.ts",
26
27
  "haste_commonjs": true
27
28
  }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import {
9
+ ReaderFragment,
10
+ ReaderInlineDataFragment,
11
+ ReaderPaginationFragment,
12
+ ReaderRefetchableFragment,
13
+ } from '../util/ReaderNode';
14
+ import { ConcreteRequest } from '../util/RelayConcreteNode';
15
+
16
+ // The type of a graphql`...` tagged template expression.
17
+ export type GraphQLTaggedNode =
18
+ | ReaderFragment
19
+ | ConcreteRequest
20
+ | ReaderInlineDataFragment
21
+ | (() => ReaderFragment | ConcreteRequest | ReaderInlineDataFragment);
22
+
23
+ /**
24
+ * Runtime function to correspond to the `graphql` tagged template function.
25
+ * All calls to this function should be transformed by the plugin.
26
+ */
27
+ export function graphql(strings: unknown): GraphQLTaggedNode;
28
+
29
+ export function getNode(taggedNode: unknown): unknown;
30
+
31
+ export function isFragment(node: GraphQLTaggedNode): boolean;
32
+
33
+ export function isRequest(node: GraphQLTaggedNode): boolean;
34
+
35
+ export function isInlineDataFragment(node: GraphQLTaggedNode): boolean;
36
+
37
+ export function getFragment(taggedNode: GraphQLTaggedNode): ReaderFragment;
38
+
39
+ export function getPaginationFragment(taggedNode: GraphQLTaggedNode): ReaderPaginationFragment | null;
40
+
41
+ export function getRefetchableFragment(taggedNode: GraphQLTaggedNode): ReaderRefetchableFragment | null;
42
+
43
+ export function getRequest(taggedNode: GraphQLTaggedNode): ConcreteRequest;
44
+
45
+ export function getInlineDataFragment(taggedNode: GraphQLTaggedNode): ReaderInlineDataFragment;
@@ -46,7 +46,7 @@ export type GraphQLTaggedNode =
46
46
  * Runtime function to correspond to the `graphql` tagged template function.
47
47
  * All calls to this function should be transformed by the plugin.
48
48
  */
49
- function graphql(strings: $ReadOnlyArray<string>): any {
49
+ function graphql(strings: ReadonlyArray<string>): any {
50
50
  invariant(
51
51
  false,
52
52
  'graphql: Unexpected invocation at runtime. Either the Babel transform ' +
@@ -65,7 +65,7 @@ function getNode(
65
65
  | ConcreteUpdatableQuery {
66
66
  let node = taggedNode;
67
67
  if (typeof node === 'function') {
68
- node = (node(): ReaderFragment | ConcreteRequest);
68
+ node = node() as ReaderFragment | ConcreteRequest;
69
69
  warning(
70
70
  false,
71
71
  'RelayGraphQLTag: node `%s` unexpectedly wrapped in a function.',
@@ -82,6 +82,8 @@ function isFragment(node: GraphQLTaggedNode): boolean {
82
82
  const fragment = getNode(node);
83
83
  return (
84
84
  typeof fragment === 'object' &&
85
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
86
+ * roll out. See https://fburl.com/workplace/5whu3i34. */
85
87
  fragment !== null &&
86
88
  fragment.kind === RelayConcreteNode.FRAGMENT
87
89
  );
@@ -91,6 +93,8 @@ function isRequest(node: GraphQLTaggedNode): boolean {
91
93
  const request = getNode(node);
92
94
  return (
93
95
  typeof request === 'object' &&
96
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
97
+ * roll out. See https://fburl.com/workplace/5whu3i34. */
94
98
  request !== null &&
95
99
  request.kind === RelayConcreteNode.REQUEST
96
100
  );
@@ -100,6 +104,8 @@ function isUpdatableQuery(node: GraphQLTaggedNode): boolean {
100
104
  const updatableQuery = getNode(node);
101
105
  return (
102
106
  typeof updatableQuery === 'object' &&
107
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
108
+ * roll out. See https://fburl.com/workplace/5whu3i34. */
103
109
  updatableQuery !== null &&
104
110
  updatableQuery.kind === RelayConcreteNode.UPDATABLE_QUERY
105
111
  );
@@ -109,6 +115,8 @@ function isInlineDataFragment(node: GraphQLTaggedNode): boolean {
109
115
  const fragment = getNode(node);
110
116
  return (
111
117
  typeof fragment === 'object' &&
118
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
119
+ * roll out. See https://fburl.com/workplace/5whu3i34. */
112
120
  fragment !== null &&
113
121
  fragment.kind === RelayConcreteNode.INLINE_DATA_FRAGMENT
114
122
  );
@@ -121,7 +129,7 @@ function getFragment(taggedNode: GraphQLTaggedNode): ReaderFragment {
121
129
  'GraphQLTag: Expected a fragment, got `%s`.',
122
130
  JSON.stringify(fragment),
123
131
  );
124
- return (fragment: any);
132
+ return fragment as any;
125
133
  }
126
134
 
127
135
  function getPaginationFragment(
@@ -131,6 +139,8 @@ function getPaginationFragment(
131
139
  const refetch = fragment.metadata?.refetch;
132
140
  const connection = refetch?.connection;
133
141
  if (
142
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
143
+ * roll out. See https://fburl.com/workplace/5whu3i34. */
134
144
  refetch === null ||
135
145
  typeof refetch !== 'object' ||
136
146
  connection === null ||
@@ -138,7 +148,7 @@ function getPaginationFragment(
138
148
  ) {
139
149
  return null;
140
150
  }
141
- return (fragment: any);
151
+ return fragment as any;
142
152
  }
143
153
 
144
154
  function getRefetchableFragment(
@@ -146,10 +156,12 @@ function getRefetchableFragment(
146
156
  ): ReaderRefetchableFragment | null {
147
157
  const fragment = getFragment(taggedNode);
148
158
  const refetch = fragment.metadata?.refetch;
159
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
160
+ * roll out. See https://fburl.com/workplace/5whu3i34. */
149
161
  if (refetch === null || typeof refetch !== 'object') {
150
162
  return null;
151
163
  }
152
- return (fragment: any);
164
+ return fragment as any;
153
165
  }
154
166
 
155
167
  function getRequest(taggedNode: GraphQLTaggedNode): ConcreteRequest {
@@ -159,7 +171,7 @@ function getRequest(taggedNode: GraphQLTaggedNode): ConcreteRequest {
159
171
  'GraphQLTag: Expected a request, got `%s`.',
160
172
  JSON.stringify(request),
161
173
  );
162
- return (request: any);
174
+ return request as any;
163
175
  }
164
176
 
165
177
  function getUpdatableQuery(
@@ -171,7 +183,7 @@ function getUpdatableQuery(
171
183
  'GraphQLTag: Expected a request, got `%s`.',
172
184
  JSON.stringify(updatableQuery),
173
185
  );
174
- return (updatableQuery: any);
186
+ return updatableQuery as any;
175
187
  }
176
188
 
177
189
  function getInlineDataFragment(
@@ -183,20 +195,20 @@ function getInlineDataFragment(
183
195
  'GraphQLTag: Expected an inline data fragment, got `%s`.',
184
196
  JSON.stringify(fragment),
185
197
  );
186
- return (fragment: any);
198
+ return fragment as any;
187
199
  }
188
200
 
189
201
  module.exports = {
190
202
  getFragment,
203
+ getInlineDataFragment,
191
204
  getNode,
192
205
  getPaginationFragment,
193
206
  getRefetchableFragment,
194
207
  getRequest,
195
208
  getUpdatableQuery,
196
- getInlineDataFragment,
197
209
  graphql,
198
210
  isFragment,
211
+ isInlineDataFragment,
199
212
  isRequest,
200
213
  isUpdatableQuery,
201
- isInlineDataFragment,
202
214
  };