@apollo/client 3.8.0-alpha.9 → 3.8.0-beta.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.
Files changed (582) hide show
  1. package/apollo-client.cjs +1030 -673
  2. package/apollo-client.cjs.map +1 -1
  3. package/apollo-client.min.cjs +1 -1
  4. package/cache/cache.cjs +35 -31
  5. package/cache/cache.cjs.map +1 -1
  6. package/cache/cache.cjs.native.js +35 -31
  7. package/cache/core/cache.d.ts +5 -4
  8. package/cache/core/cache.d.ts.map +1 -1
  9. package/cache/core/cache.js +1 -0
  10. package/cache/core/cache.js.map +1 -1
  11. package/cache/core/types/Cache.d.ts +2 -2
  12. package/cache/core/types/Cache.d.ts.map +1 -1
  13. package/cache/core/types/Cache.js.map +1 -1
  14. package/cache/core/types/DataProxy.d.ts +4 -4
  15. package/cache/core/types/DataProxy.d.ts.map +1 -1
  16. package/cache/core/types/DataProxy.js.map +1 -1
  17. package/cache/core/types/common.d.ts +3 -3
  18. package/cache/core/types/common.d.ts.map +1 -1
  19. package/cache/core/types/common.js.map +1 -1
  20. package/cache/inmemory/entityStore.d.ts +5 -5
  21. package/cache/inmemory/entityStore.d.ts.map +1 -1
  22. package/cache/inmemory/entityStore.js +2 -2
  23. package/cache/inmemory/entityStore.js.map +1 -1
  24. package/cache/inmemory/fragmentRegistry.d.ts +1 -1
  25. package/cache/inmemory/fragmentRegistry.d.ts.map +1 -1
  26. package/cache/inmemory/fragmentRegistry.js.map +1 -1
  27. package/cache/inmemory/helpers.d.ts +6 -5
  28. package/cache/inmemory/helpers.d.ts.map +1 -1
  29. package/cache/inmemory/helpers.js.map +1 -1
  30. package/cache/inmemory/inMemoryCache.d.ts +9 -7
  31. package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
  32. package/cache/inmemory/inMemoryCache.js +14 -15
  33. package/cache/inmemory/inMemoryCache.js.map +1 -1
  34. package/cache/inmemory/key-extractor.d.ts +1 -1
  35. package/cache/inmemory/key-extractor.d.ts.map +1 -1
  36. package/cache/inmemory/key-extractor.js +2 -2
  37. package/cache/inmemory/key-extractor.js.map +1 -1
  38. package/cache/inmemory/policies.d.ts +7 -6
  39. package/cache/inmemory/policies.d.ts.map +1 -1
  40. package/cache/inmemory/policies.js +6 -6
  41. package/cache/inmemory/policies.js.map +1 -1
  42. package/cache/inmemory/reactiveVars.d.ts +1 -1
  43. package/cache/inmemory/reactiveVars.d.ts.map +1 -1
  44. package/cache/inmemory/reactiveVars.js.map +1 -1
  45. package/cache/inmemory/readFromStore.d.ts +6 -6
  46. package/cache/inmemory/readFromStore.d.ts.map +1 -1
  47. package/cache/inmemory/readFromStore.js +10 -5
  48. package/cache/inmemory/readFromStore.js.map +1 -1
  49. package/cache/inmemory/types.d.ts +6 -6
  50. package/cache/inmemory/types.d.ts.map +1 -1
  51. package/cache/inmemory/types.js.map +1 -1
  52. package/cache/inmemory/writeToStore.d.ts +6 -6
  53. package/cache/inmemory/writeToStore.d.ts.map +1 -1
  54. package/cache/inmemory/writeToStore.js +7 -8
  55. package/cache/inmemory/writeToStore.js.map +1 -1
  56. package/config/jest/setup.d.ts +1 -0
  57. package/config/jest/setup.d.ts.map +1 -1
  58. package/config/jest/setup.js +3 -0
  59. package/config/jest/setup.js.map +1 -1
  60. package/core/ApolloClient.d.ts +13 -10
  61. package/core/ApolloClient.d.ts.map +1 -1
  62. package/core/ApolloClient.js +18 -16
  63. package/core/ApolloClient.js.map +1 -1
  64. package/core/DocumentTransform.d.ts +24 -0
  65. package/core/DocumentTransform.d.ts.map +1 -0
  66. package/core/DocumentTransform.js +68 -0
  67. package/core/DocumentTransform.js.map +1 -0
  68. package/core/LocalState.d.ts +7 -9
  69. package/core/LocalState.d.ts.map +1 -1
  70. package/core/LocalState.js +6 -10
  71. package/core/LocalState.js.map +1 -1
  72. package/core/ObservableQuery.d.ts +11 -8
  73. package/core/ObservableQuery.d.ts.map +1 -1
  74. package/core/ObservableQuery.js +48 -28
  75. package/core/ObservableQuery.js.map +1 -1
  76. package/core/QueryInfo.d.ts +9 -9
  77. package/core/QueryInfo.d.ts.map +1 -1
  78. package/core/QueryInfo.js.map +1 -1
  79. package/core/QueryManager.d.ts +15 -11
  80. package/core/QueryManager.d.ts.map +1 -1
  81. package/core/QueryManager.js +115 -108
  82. package/core/QueryManager.js.map +1 -1
  83. package/core/core.cjs +332 -172
  84. package/core/core.cjs.map +1 -1
  85. package/core/core.cjs.native.js +332 -172
  86. package/core/equalByQuery.d.ts +4 -0
  87. package/core/equalByQuery.d.ts.map +1 -0
  88. package/{react/hooks/compareResults.js → core/equalByQuery.js} +14 -10
  89. package/core/equalByQuery.js.map +1 -0
  90. package/core/index.d.ts +2 -1
  91. package/core/index.d.ts.map +1 -1
  92. package/core/index.js +2 -1
  93. package/core/index.js.map +1 -1
  94. package/core/networkStatus.d.ts +1 -0
  95. package/core/networkStatus.d.ts.map +1 -1
  96. package/core/networkStatus.js +3 -0
  97. package/core/networkStatus.js.map +1 -1
  98. package/core/types.d.ts +14 -14
  99. package/core/types.d.ts.map +1 -1
  100. package/core/types.js.map +1 -1
  101. package/core/watchQueryOptions.d.ts +6 -7
  102. package/core/watchQueryOptions.d.ts.map +1 -1
  103. package/core/watchQueryOptions.js.map +1 -1
  104. package/dev/dev.cjs +642 -0
  105. package/dev/dev.cjs.map +1 -0
  106. package/dev/dev.cjs.native.js +642 -0
  107. package/dev/index.d.ts +4 -0
  108. package/dev/index.d.ts.map +1 -0
  109. package/dev/index.js +4 -0
  110. package/dev/index.js.map +1 -0
  111. package/dev/loadDevMessages.d.ts +2 -0
  112. package/dev/loadDevMessages.d.ts.map +1 -0
  113. package/dev/loadDevMessages.js +6 -0
  114. package/dev/loadDevMessages.js.map +1 -0
  115. package/dev/loadErrorMessageHandler.d.ts +3 -0
  116. package/dev/loadErrorMessageHandler.d.ts.map +1 -0
  117. package/dev/loadErrorMessageHandler.js +26 -0
  118. package/dev/loadErrorMessageHandler.js.map +1 -0
  119. package/dev/loadErrorMessages.d.ts +2 -0
  120. package/dev/loadErrorMessages.d.ts.map +1 -0
  121. package/dev/loadErrorMessages.js +6 -0
  122. package/dev/loadErrorMessages.js.map +1 -0
  123. package/dev/package.json +8 -0
  124. package/errors/errors.cjs +17 -17
  125. package/errors/errors.cjs.map +1 -1
  126. package/errors/errors.cjs.native.js +17 -17
  127. package/errors/index.d.ts +26 -10
  128. package/errors/index.d.ts.map +1 -1
  129. package/errors/index.js +17 -19
  130. package/errors/index.js.map +1 -1
  131. package/invariantErrorCodes.d.ts +13 -0
  132. package/invariantErrorCodes.d.ts.map +1 -0
  133. package/invariantErrorCodes.js +331 -144
  134. package/invariantErrorCodes.js.map +1 -0
  135. package/link/batch/batchLink.d.ts +4 -3
  136. package/link/batch/batchLink.d.ts.map +1 -1
  137. package/link/batch/batchLink.js.map +1 -1
  138. package/link/batch/batching.d.ts +1 -1
  139. package/link/batch/batching.d.ts.map +1 -1
  140. package/link/batch/batching.js.map +1 -1
  141. package/link/batch-http/batch-http.cjs +23 -2
  142. package/link/batch-http/batch-http.cjs.map +1 -1
  143. package/link/batch-http/batch-http.cjs.native.js +23 -2
  144. package/link/batch-http/batchHttpLink.d.ts +3 -2
  145. package/link/batch-http/batchHttpLink.d.ts.map +1 -1
  146. package/link/batch-http/batchHttpLink.js +7 -2
  147. package/link/batch-http/batchHttpLink.js.map +1 -1
  148. package/link/context/index.d.ts +3 -2
  149. package/link/context/index.d.ts.map +1 -1
  150. package/link/context/index.js.map +1 -1
  151. package/link/core/ApolloLink.d.ts +3 -2
  152. package/link/core/ApolloLink.d.ts.map +1 -1
  153. package/link/core/ApolloLink.js +3 -13
  154. package/link/core/ApolloLink.js.map +1 -1
  155. package/link/core/core.cjs +2 -12
  156. package/link/core/core.cjs.map +1 -1
  157. package/link/core/core.cjs.native.js +2 -12
  158. package/link/core/types.d.ts +8 -3
  159. package/link/core/types.d.ts.map +1 -1
  160. package/link/core/types.js.map +1 -1
  161. package/link/error/index.d.ts +4 -3
  162. package/link/error/index.d.ts.map +1 -1
  163. package/link/error/index.js.map +1 -1
  164. package/link/http/HttpLink.d.ts +3 -2
  165. package/link/http/HttpLink.d.ts.map +1 -1
  166. package/link/http/HttpLink.js.map +1 -1
  167. package/link/http/checkFetcher.js +2 -2
  168. package/link/http/checkFetcher.js.map +1 -1
  169. package/link/http/createHttpLink.d.ts +1 -1
  170. package/link/http/createHttpLink.d.ts.map +1 -1
  171. package/link/http/createHttpLink.js +21 -20
  172. package/link/http/createHttpLink.js.map +1 -1
  173. package/link/http/http.cjs +73 -43
  174. package/link/http/http.cjs.map +1 -1
  175. package/link/http/http.cjs.native.js +73 -43
  176. package/link/http/iterators/nodeStream.d.ts +1 -1
  177. package/link/http/iterators/nodeStream.d.ts.map +1 -1
  178. package/link/http/iterators/nodeStream.js.map +1 -1
  179. package/link/http/parseAndCheckHttpResponse.d.ts +2 -2
  180. package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
  181. package/link/http/parseAndCheckHttpResponse.js +47 -26
  182. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  183. package/link/http/responseIterator.d.ts +1 -1
  184. package/link/http/responseIterator.d.ts.map +1 -1
  185. package/link/http/responseIterator.js.map +1 -1
  186. package/link/http/rewriteURIForGET.d.ts +1 -1
  187. package/link/http/rewriteURIForGET.d.ts.map +1 -1
  188. package/link/http/rewriteURIForGET.js.map +1 -1
  189. package/link/http/selectHttpOptionsAndBody.d.ts +3 -2
  190. package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
  191. package/link/http/selectHttpOptionsAndBody.js.map +1 -1
  192. package/link/http/selectURI.d.ts +1 -1
  193. package/link/http/selectURI.d.ts.map +1 -1
  194. package/link/http/selectURI.js.map +1 -1
  195. package/link/http/serializeFetchParameter.d.ts +1 -1
  196. package/link/http/serializeFetchParameter.d.ts.map +1 -1
  197. package/link/http/serializeFetchParameter.js +2 -2
  198. package/link/http/serializeFetchParameter.js.map +1 -1
  199. package/link/persisted-queries/index.d.ts +4 -3
  200. package/link/persisted-queries/index.d.ts.map +1 -1
  201. package/link/persisted-queries/index.js +16 -20
  202. package/link/persisted-queries/index.js.map +1 -1
  203. package/link/persisted-queries/persisted-queries.cjs +15 -19
  204. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  205. package/link/persisted-queries/persisted-queries.cjs.native.js +15 -19
  206. package/link/remove-typename/index.d.ts +2 -0
  207. package/link/remove-typename/index.d.ts.map +1 -0
  208. package/link/remove-typename/index.js +2 -0
  209. package/link/remove-typename/index.js.map +1 -0
  210. package/link/remove-typename/package.json +8 -0
  211. package/link/remove-typename/remove-typename.cjs +82 -0
  212. package/link/remove-typename/remove-typename.cjs.map +1 -0
  213. package/link/remove-typename/remove-typename.cjs.native.js +82 -0
  214. package/link/remove-typename/removeTypenameFromVariables.d.ts +11 -0
  215. package/link/remove-typename/removeTypenameFromVariables.d.ts.map +1 -0
  216. package/link/remove-typename/removeTypenameFromVariables.js +74 -0
  217. package/link/remove-typename/removeTypenameFromVariables.js.map +1 -0
  218. package/link/retry/delayFunction.d.ts +1 -1
  219. package/link/retry/delayFunction.d.ts.map +1 -1
  220. package/link/retry/delayFunction.js.map +1 -1
  221. package/link/retry/retryFunction.d.ts +1 -1
  222. package/link/retry/retryFunction.d.ts.map +1 -1
  223. package/link/retry/retryFunction.js.map +1 -1
  224. package/link/retry/retryLink.d.ts +4 -3
  225. package/link/retry/retryLink.d.ts.map +1 -1
  226. package/link/retry/retryLink.js.map +1 -1
  227. package/link/schema/index.d.ts +3 -2
  228. package/link/schema/index.d.ts.map +1 -1
  229. package/link/schema/index.js.map +1 -1
  230. package/link/subscriptions/index.d.ts +2 -1
  231. package/link/subscriptions/index.d.ts.map +1 -1
  232. package/link/subscriptions/index.js +8 -3
  233. package/link/subscriptions/index.js.map +1 -1
  234. package/link/subscriptions/subscriptions.cjs +8 -3
  235. package/link/subscriptions/subscriptions.cjs.map +1 -1
  236. package/link/subscriptions/subscriptions.cjs.native.js +8 -3
  237. package/link/utils/createOperation.d.ts +1 -1
  238. package/link/utils/createOperation.d.ts.map +1 -1
  239. package/link/utils/createOperation.js.map +1 -1
  240. package/link/utils/filterOperationVariables.d.ts +5 -0
  241. package/link/utils/filterOperationVariables.d.ts.map +1 -0
  242. package/link/utils/filterOperationVariables.js +18 -0
  243. package/link/utils/filterOperationVariables.js.map +1 -0
  244. package/link/utils/index.d.ts +1 -0
  245. package/link/utils/index.d.ts.map +1 -1
  246. package/link/utils/index.js +1 -0
  247. package/link/utils/index.js.map +1 -1
  248. package/link/utils/throwServerError.d.ts +1 -1
  249. package/link/utils/throwServerError.d.ts.map +1 -1
  250. package/link/utils/throwServerError.js.map +1 -1
  251. package/link/utils/toPromise.d.ts +1 -1
  252. package/link/utils/toPromise.d.ts.map +1 -1
  253. package/link/utils/toPromise.js +1 -1
  254. package/link/utils/toPromise.js.map +1 -1
  255. package/link/utils/transformOperation.d.ts +1 -1
  256. package/link/utils/transformOperation.d.ts.map +1 -1
  257. package/link/utils/transformOperation.js.map +1 -1
  258. package/link/utils/utils.cjs +20 -2
  259. package/link/utils/utils.cjs.map +1 -1
  260. package/link/utils/utils.cjs.native.js +20 -2
  261. package/link/utils/validateOperation.d.ts +1 -1
  262. package/link/utils/validateOperation.d.ts.map +1 -1
  263. package/link/utils/validateOperation.js +2 -2
  264. package/link/utils/validateOperation.js.map +1 -1
  265. package/link/ws/index.d.ts +5 -3
  266. package/link/ws/index.d.ts.map +1 -1
  267. package/link/ws/index.js.map +1 -1
  268. package/package.json +36 -32
  269. package/react/cache/QueryReference.d.ts +34 -0
  270. package/react/cache/QueryReference.d.ts.map +1 -0
  271. package/react/cache/QueryReference.js +107 -0
  272. package/react/cache/QueryReference.js.map +1 -0
  273. package/react/cache/SuspenseCache.d.ts +10 -13
  274. package/react/cache/SuspenseCache.d.ts.map +1 -1
  275. package/react/cache/SuspenseCache.js +18 -41
  276. package/react/cache/SuspenseCache.js.map +1 -1
  277. package/react/cache/types.d.ts +2 -0
  278. package/react/cache/types.d.ts.map +1 -0
  279. package/react/cache/types.js +2 -0
  280. package/react/cache/types.js.map +1 -0
  281. package/react/components/Mutation.d.ts +2 -2
  282. package/react/components/Mutation.d.ts.map +1 -1
  283. package/react/components/Mutation.js.map +1 -1
  284. package/react/components/Query.d.ts +2 -2
  285. package/react/components/Query.d.ts.map +1 -1
  286. package/react/components/Query.js.map +1 -1
  287. package/react/components/Subscription.d.ts +2 -2
  288. package/react/components/Subscription.d.ts.map +1 -1
  289. package/react/components/Subscription.js.map +1 -1
  290. package/react/components/types.d.ts +4 -4
  291. package/react/components/types.d.ts.map +1 -1
  292. package/react/components/types.js.map +1 -1
  293. package/react/context/ApolloConsumer.d.ts +1 -1
  294. package/react/context/ApolloConsumer.d.ts.map +1 -1
  295. package/react/context/ApolloConsumer.js +2 -3
  296. package/react/context/ApolloConsumer.js.map +1 -1
  297. package/react/context/ApolloContext.d.ts +10 -3
  298. package/react/context/ApolloContext.d.ts.map +1 -1
  299. package/react/context/ApolloContext.js +10 -8
  300. package/react/context/ApolloContext.js.map +1 -1
  301. package/react/context/ApolloProvider.d.ts +2 -2
  302. package/react/context/ApolloProvider.d.ts.map +1 -1
  303. package/react/context/ApolloProvider.js +8 -13
  304. package/react/context/ApolloProvider.js.map +1 -1
  305. package/react/context/context.cjs +18 -22
  306. package/react/context/context.cjs.map +1 -1
  307. package/react/context/context.cjs.native.js +18 -22
  308. package/react/context/index.d.ts +1 -1
  309. package/react/context/index.d.ts.map +1 -1
  310. package/react/context/index.js +1 -1
  311. package/react/context/index.js.map +1 -1
  312. package/react/hoc/graphql.d.ts +3 -3
  313. package/react/hoc/graphql.d.ts.map +1 -1
  314. package/react/hoc/graphql.js.map +1 -1
  315. package/react/hoc/hoc-utils.d.ts +2 -2
  316. package/react/hoc/hoc-utils.d.ts.map +1 -1
  317. package/react/hoc/hoc-utils.js +2 -3
  318. package/react/hoc/hoc-utils.js.map +1 -1
  319. package/react/hoc/hoc.cjs +2 -4
  320. package/react/hoc/hoc.cjs.map +1 -1
  321. package/react/hoc/hoc.cjs.native.js +2 -4
  322. package/react/hoc/mutation-hoc.d.ts +4 -4
  323. package/react/hoc/mutation-hoc.d.ts.map +1 -1
  324. package/react/hoc/mutation-hoc.js.map +1 -1
  325. package/react/hoc/query-hoc.d.ts +2 -2
  326. package/react/hoc/query-hoc.d.ts.map +1 -1
  327. package/react/hoc/query-hoc.js.map +1 -1
  328. package/react/hoc/subscription-hoc.d.ts +2 -2
  329. package/react/hoc/subscription-hoc.d.ts.map +1 -1
  330. package/react/hoc/subscription-hoc.js.map +1 -1
  331. package/react/hoc/types.d.ts +4 -4
  332. package/react/hoc/types.d.ts.map +1 -1
  333. package/react/hoc/types.js.map +1 -1
  334. package/react/hoc/withApollo.d.ts +1 -1
  335. package/react/hoc/withApollo.d.ts.map +1 -1
  336. package/react/hoc/withApollo.js +2 -3
  337. package/react/hoc/withApollo.js.map +1 -1
  338. package/react/hooks/hooks.cjs +223 -219
  339. package/react/hooks/hooks.cjs.map +1 -1
  340. package/react/hooks/hooks.cjs.native.js +223 -219
  341. package/react/hooks/index.d.ts +2 -1
  342. package/react/hooks/index.d.ts.map +1 -1
  343. package/react/hooks/index.js +2 -1
  344. package/react/hooks/index.js.map +1 -1
  345. package/react/hooks/internal/__use.d.ts +4 -0
  346. package/react/hooks/internal/__use.d.ts.map +1 -0
  347. package/react/hooks/internal/__use.js +17 -0
  348. package/react/hooks/internal/__use.js.map +1 -0
  349. package/react/hooks/internal/index.d.ts +2 -0
  350. package/react/hooks/internal/index.d.ts.map +1 -1
  351. package/react/hooks/internal/index.js +2 -0
  352. package/react/hooks/internal/index.js.map +1 -1
  353. package/react/hooks/internal/useDeepMemo.d.ts +1 -1
  354. package/react/hooks/internal/useDeepMemo.d.ts.map +1 -1
  355. package/react/hooks/internal/useDeepMemo.js.map +1 -1
  356. package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +1 -1
  357. package/react/hooks/internal/useIsomorphicLayoutEffect.js +2 -2
  358. package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
  359. package/react/hooks/internal/useStrictModeSafeCleanupEffect.d.ts +2 -0
  360. package/react/hooks/internal/useStrictModeSafeCleanupEffect.d.ts.map +1 -0
  361. package/react/hooks/internal/useStrictModeSafeCleanupEffect.js +11 -0
  362. package/react/hooks/internal/useStrictModeSafeCleanupEffect.js.map +1 -0
  363. package/react/hooks/useApolloClient.d.ts +1 -1
  364. package/react/hooks/useApolloClient.d.ts.map +1 -1
  365. package/react/hooks/useApolloClient.js +2 -4
  366. package/react/hooks/useApolloClient.js.map +1 -1
  367. package/react/hooks/useBackgroundQuery.d.ts +18 -0
  368. package/react/hooks/useBackgroundQuery.d.ts.map +1 -0
  369. package/react/hooks/useBackgroundQuery.js +69 -0
  370. package/react/hooks/useBackgroundQuery.js.map +1 -0
  371. package/react/hooks/useFragment.d.ts +14 -9
  372. package/react/hooks/useFragment.d.ts.map +1 -1
  373. package/react/hooks/useFragment.js +2 -2
  374. package/react/hooks/useFragment.js.map +1 -1
  375. package/react/hooks/useLazyQuery.d.ts +4 -4
  376. package/react/hooks/useLazyQuery.d.ts.map +1 -1
  377. package/react/hooks/useLazyQuery.js +13 -22
  378. package/react/hooks/useLazyQuery.js.map +1 -1
  379. package/react/hooks/useMutation.d.ts +4 -4
  380. package/react/hooks/useMutation.d.ts.map +1 -1
  381. package/react/hooks/useMutation.js +1 -1
  382. package/react/hooks/useMutation.js.map +1 -1
  383. package/react/hooks/useQuery.d.ts +6 -6
  384. package/react/hooks/useQuery.d.ts.map +1 -1
  385. package/react/hooks/useQuery.js +29 -28
  386. package/react/hooks/useQuery.js.map +1 -1
  387. package/react/hooks/useReactiveVar.d.ts +1 -1
  388. package/react/hooks/useReactiveVar.d.ts.map +1 -1
  389. package/react/hooks/useReactiveVar.js.map +1 -1
  390. package/react/hooks/useSubscription.d.ts +4 -4
  391. package/react/hooks/useSubscription.d.ts.map +1 -1
  392. package/react/hooks/useSubscription.js +27 -19
  393. package/react/hooks/useSubscription.js.map +1 -1
  394. package/react/hooks/useSuspenseCache.d.ts +1 -1
  395. package/react/hooks/useSuspenseCache.d.ts.map +1 -1
  396. package/react/hooks/useSuspenseCache.js +2 -4
  397. package/react/hooks/useSuspenseCache.js.map +1 -1
  398. package/react/hooks/useSuspenseQuery.d.ts +39 -7
  399. package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
  400. package/react/hooks/useSuspenseQuery.js +68 -149
  401. package/react/hooks/useSuspenseQuery.js.map +1 -1
  402. package/react/hooks/useSyncExternalStore.js +1 -1
  403. package/react/index.d.ts +1 -1
  404. package/react/index.d.ts.map +1 -1
  405. package/react/index.js +1 -1
  406. package/react/index.js.map +1 -1
  407. package/react/parser/index.d.ts +1 -1
  408. package/react/parser/index.d.ts.map +1 -1
  409. package/react/parser/index.js +20 -17
  410. package/react/parser/index.js.map +1 -1
  411. package/react/parser/parser.cjs +19 -16
  412. package/react/parser/parser.cjs.map +1 -1
  413. package/react/parser/parser.cjs.native.js +19 -16
  414. package/react/react.cjs +116 -35
  415. package/react/react.cjs.map +1 -1
  416. package/react/react.cjs.native.js +116 -35
  417. package/react/ssr/RenderPromises.d.ts +2 -2
  418. package/react/ssr/RenderPromises.d.ts.map +1 -1
  419. package/react/ssr/RenderPromises.js.map +1 -1
  420. package/react/ssr/renderToStringWithData.d.ts +1 -1
  421. package/react/ssr/renderToStringWithData.d.ts.map +1 -1
  422. package/react/ssr/renderToStringWithData.js.map +1 -1
  423. package/react/types/types.d.ts +10 -13
  424. package/react/types/types.d.ts.map +1 -1
  425. package/react/types/types.js.map +1 -1
  426. package/testing/core/core.cjs +1 -1
  427. package/testing/core/core.cjs.map +1 -1
  428. package/testing/core/core.cjs.native.js +1 -1
  429. package/testing/core/mocking/mockClient.d.ts +2 -2
  430. package/testing/core/mocking/mockClient.d.ts.map +1 -1
  431. package/testing/core/mocking/mockClient.js.map +1 -1
  432. package/testing/core/mocking/mockLink.d.ts +2 -1
  433. package/testing/core/mocking/mockLink.d.ts.map +1 -1
  434. package/testing/core/mocking/mockLink.js +3 -3
  435. package/testing/core/mocking/mockLink.js.map +1 -1
  436. package/testing/core/mocking/mockQueryManager.d.ts +1 -1
  437. package/testing/core/mocking/mockQueryManager.d.ts.map +1 -1
  438. package/testing/core/mocking/mockQueryManager.js.map +1 -1
  439. package/testing/core/mocking/mockSubscriptionLink.d.ts +3 -2
  440. package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -1
  441. package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
  442. package/testing/core/mocking/mockWatchQuery.d.ts +2 -2
  443. package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -1
  444. package/testing/core/mocking/mockWatchQuery.js.map +1 -1
  445. package/testing/core/observableToPromise.d.ts +2 -2
  446. package/testing/core/observableToPromise.d.ts.map +1 -1
  447. package/testing/core/observableToPromise.js.map +1 -1
  448. package/testing/core/subscribeAndCount.d.ts +1 -1
  449. package/testing/core/subscribeAndCount.d.ts.map +1 -1
  450. package/testing/core/subscribeAndCount.js.map +1 -1
  451. package/testing/matchers/index.d.ts +2 -0
  452. package/testing/matchers/index.d.ts.map +1 -0
  453. package/testing/matchers/index.js +6 -0
  454. package/testing/matchers/index.js.map +1 -0
  455. package/testing/matchers/toMatchDocument.d.ts +4 -0
  456. package/testing/matchers/toMatchDocument.d.ts.map +1 -0
  457. package/testing/matchers/toMatchDocument.js +34 -0
  458. package/testing/matchers/toMatchDocument.js.map +1 -0
  459. package/testing/react/MockedProvider.d.ts +8 -7
  460. package/testing/react/MockedProvider.d.ts.map +1 -1
  461. package/testing/react/MockedProvider.js +7 -6
  462. package/testing/react/MockedProvider.js.map +1 -1
  463. package/testing/testing.cjs +7 -51
  464. package/testing/testing.cjs.map +1 -1
  465. package/testing/testing.cjs.native.js +7 -51
  466. package/utilities/common/compact.d.ts +1 -1
  467. package/utilities/common/compact.d.ts.map +1 -1
  468. package/utilities/common/compact.js.map +1 -1
  469. package/utilities/common/errorHandling.d.ts +1 -1
  470. package/utilities/common/errorHandling.d.ts.map +1 -1
  471. package/utilities/common/errorHandling.js.map +1 -1
  472. package/utilities/common/incrementalResult.d.ts +2 -1
  473. package/utilities/common/incrementalResult.d.ts.map +1 -1
  474. package/utilities/common/incrementalResult.js +4 -0
  475. package/utilities/common/incrementalResult.js.map +1 -1
  476. package/utilities/common/mergeOptions.d.ts +1 -1
  477. package/utilities/common/mergeOptions.d.ts.map +1 -1
  478. package/utilities/common/mergeOptions.js +1 -1
  479. package/utilities/common/mergeOptions.js.map +1 -1
  480. package/utilities/common/objects.d.ts +1 -0
  481. package/utilities/common/objects.d.ts.map +1 -1
  482. package/utilities/common/objects.js +6 -0
  483. package/utilities/common/objects.js.map +1 -1
  484. package/utilities/common/omitDeep.d.ts +3 -0
  485. package/utilities/common/omitDeep.d.ts.map +1 -0
  486. package/utilities/common/omitDeep.js +41 -0
  487. package/utilities/common/omitDeep.js.map +1 -0
  488. package/utilities/common/responseIterator.d.ts +2 -2
  489. package/utilities/common/responseIterator.d.ts.map +1 -1
  490. package/utilities/common/responseIterator.js.map +1 -1
  491. package/utilities/common/stringifyForDisplay.d.ts +1 -1
  492. package/utilities/common/stringifyForDisplay.d.ts.map +1 -1
  493. package/utilities/common/stringifyForDisplay.js +3 -2
  494. package/utilities/common/stringifyForDisplay.js.map +1 -1
  495. package/utilities/common/stripTypename.d.ts +2 -0
  496. package/utilities/common/stripTypename.d.ts.map +1 -0
  497. package/utilities/common/stripTypename.js +5 -0
  498. package/utilities/common/stripTypename.js.map +1 -0
  499. package/utilities/globals/global.d.ts +6 -3
  500. package/utilities/globals/global.d.ts.map +1 -1
  501. package/utilities/globals/global.js.map +1 -1
  502. package/utilities/globals/globals.cjs +67 -1
  503. package/utilities/globals/globals.cjs.map +1 -1
  504. package/utilities/globals/globals.cjs.native.js +67 -1
  505. package/utilities/globals/index.d.ts +2 -2
  506. package/utilities/globals/index.d.ts.map +1 -1
  507. package/utilities/globals/index.js +2 -2
  508. package/utilities/globals/index.js.map +1 -1
  509. package/utilities/globals/invariantWrappers.d.ts +24 -0
  510. package/utilities/globals/invariantWrappers.d.ts.map +1 -0
  511. package/utilities/globals/invariantWrappers.js +53 -0
  512. package/utilities/globals/invariantWrappers.js.map +1 -0
  513. package/utilities/graphql/directives.d.ts +1 -1
  514. package/utilities/graphql/directives.d.ts.map +1 -1
  515. package/utilities/graphql/directives.js +6 -7
  516. package/utilities/graphql/directives.js.map +1 -1
  517. package/utilities/graphql/fragments.d.ts +1 -1
  518. package/utilities/graphql/fragments.d.ts.map +1 -1
  519. package/utilities/graphql/fragments.js +8 -5
  520. package/utilities/graphql/fragments.js.map +1 -1
  521. package/utilities/graphql/getFromAST.d.ts +1 -1
  522. package/utilities/graphql/getFromAST.d.ts.map +1 -1
  523. package/utilities/graphql/getFromAST.js +9 -9
  524. package/utilities/graphql/getFromAST.js.map +1 -1
  525. package/utilities/graphql/operations.d.ts +5 -0
  526. package/utilities/graphql/operations.d.ts.map +1 -0
  527. package/utilities/graphql/operations.js +16 -0
  528. package/utilities/graphql/operations.js.map +1 -0
  529. package/utilities/graphql/storeUtils.d.ts +2 -2
  530. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  531. package/utilities/graphql/storeUtils.js +16 -7
  532. package/utilities/graphql/storeUtils.js.map +1 -1
  533. package/utilities/graphql/transform.d.ts +1 -1
  534. package/utilities/graphql/transform.d.ts.map +1 -1
  535. package/utilities/graphql/transform.js +30 -21
  536. package/utilities/graphql/transform.js.map +1 -1
  537. package/utilities/index.d.ts +6 -0
  538. package/utilities/index.d.ts.map +1 -1
  539. package/utilities/index.js +4 -0
  540. package/utilities/index.js.map +1 -1
  541. package/utilities/observables/Concast.d.ts +2 -1
  542. package/utilities/observables/Concast.d.ts.map +1 -1
  543. package/utilities/observables/Concast.js.map +1 -1
  544. package/utilities/observables/Observable.d.ts +2 -1
  545. package/utilities/observables/Observable.d.ts.map +1 -1
  546. package/utilities/observables/Observable.js +1 -1
  547. package/utilities/observables/Observable.js.map +1 -1
  548. package/utilities/observables/asyncMap.d.ts.map +1 -1
  549. package/utilities/observables/asyncMap.js.map +1 -1
  550. package/utilities/observables/iteration.d.ts +1 -1
  551. package/utilities/observables/iteration.d.ts.map +1 -1
  552. package/utilities/observables/iteration.js.map +1 -1
  553. package/utilities/policies/pagination.d.ts +1 -1
  554. package/utilities/policies/pagination.d.ts.map +1 -1
  555. package/utilities/policies/pagination.js.map +1 -1
  556. package/utilities/promises/decoration.d.ts +17 -0
  557. package/utilities/promises/decoration.d.ts.map +1 -0
  558. package/utilities/promises/decoration.js +37 -0
  559. package/utilities/promises/decoration.js.map +1 -0
  560. package/utilities/types/DeepOmit.d.ts +10 -0
  561. package/utilities/types/DeepOmit.d.ts.map +1 -0
  562. package/utilities/types/DeepOmit.js +2 -0
  563. package/utilities/types/DeepOmit.js.map +1 -0
  564. package/utilities/types/DeepPartial.d.ts +12 -0
  565. package/utilities/types/DeepPartial.d.ts.map +1 -0
  566. package/utilities/types/DeepPartial.js +2 -0
  567. package/utilities/types/DeepPartial.js.map +1 -0
  568. package/utilities/types/Primitive.d.ts +2 -0
  569. package/utilities/types/Primitive.d.ts.map +1 -0
  570. package/utilities/types/Primitive.js +2 -0
  571. package/utilities/types/Primitive.js.map +1 -0
  572. package/utilities/utilities.cjs +181 -45
  573. package/utilities/utilities.cjs.map +1 -1
  574. package/utilities/utilities.cjs.native.js +181 -45
  575. package/version.js +1 -1
  576. package/cache/inmemory/__mocks__/optimism.d.ts +0 -2
  577. package/cache/inmemory/__mocks__/optimism.d.ts.map +0 -1
  578. package/cache/inmemory/__mocks__/optimism.js +0 -14
  579. package/cache/inmemory/__mocks__/optimism.js.map +0 -1
  580. package/react/hooks/compareResults.d.ts +0 -3
  581. package/react/hooks/compareResults.d.ts.map +0 -1
  582. package/react/hooks/compareResults.js.map +0 -1
@@ -18,7 +18,7 @@ function shouldInclude(_a, variables) {
18
18
  var evaledValue = false;
19
19
  if (ifArgument.value.kind === 'Variable') {
20
20
  evaledValue = variables && variables[ifArgument.value.name.value];
21
- globals.__DEV__ ? globals.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : globals.invariant(evaledValue !== void 0, 41);
21
+ globals.invariant(evaledValue !== void 0, 66, directive.name.value);
22
22
  }
23
23
  else {
24
24
  evaledValue = ifArgument.value.value;
@@ -65,13 +65,12 @@ function getInclusionDirectives(directives) {
65
65
  return;
66
66
  var directiveArguments = directive.arguments;
67
67
  var directiveName = directive.name.value;
68
- globals.__DEV__ ? globals.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : globals.invariant(directiveArguments && directiveArguments.length === 1, 42);
68
+ globals.invariant(directiveArguments && directiveArguments.length === 1, 67, directiveName);
69
69
  var ifArgument = directiveArguments[0];
70
- globals.__DEV__ ? globals.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : globals.invariant(ifArgument.name && ifArgument.name.value === 'if', 43);
70
+ globals.invariant(ifArgument.name && ifArgument.name.value === 'if', 68, directiveName);
71
71
  var ifValue = ifArgument.value;
72
- globals.__DEV__ ? globals.invariant(ifValue &&
73
- (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @".concat(directiveName, " directive must be a variable or a boolean value.")) : globals.invariant(ifValue &&
74
- (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 44);
72
+ globals.invariant(ifValue &&
73
+ (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 69, directiveName);
75
74
  result.push({ directive: directive, ifArgument: ifArgument });
76
75
  });
77
76
  }
@@ -83,15 +82,18 @@ function getFragmentQueryDocument(document, fragmentName) {
83
82
  var fragments = [];
84
83
  document.definitions.forEach(function (definition) {
85
84
  if (definition.kind === 'OperationDefinition') {
86
- throw globals.__DEV__ ? new globals.InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
87
- 'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new globals.InvariantError(45);
85
+ throw globals.newInvariantError(
86
+ 70,
87
+ definition.operation,
88
+ definition.name ? " named '".concat(definition.name.value, "'") : ''
89
+ );
88
90
  }
89
91
  if (definition.kind === 'FragmentDefinition') {
90
92
  fragments.push(definition);
91
93
  }
92
94
  });
93
95
  if (typeof actualFragmentName === 'undefined') {
94
- globals.__DEV__ ? globals.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : globals.invariant(fragments.length === 1, 46);
96
+ globals.invariant(fragments.length === 1, 71, fragments.length);
95
97
  actualFragmentName = fragments[0].name.value;
96
98
  }
97
99
  var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
@@ -132,7 +134,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
132
134
  return fragmentMap(fragmentName);
133
135
  }
134
136
  var fragment = fragmentMap && fragmentMap[fragmentName];
135
- globals.__DEV__ ? globals.invariant(fragment, "No fragment named ".concat(fragmentName)) : globals.invariant(fragment, 47);
137
+ globals.invariant(fragment, 72, fragmentName);
136
138
  return fragment || null;
137
139
  }
138
140
  default:
@@ -143,6 +145,12 @@ function getFragmentFromSelection(selection, fragmentMap) {
143
145
  function isNonNullObject(obj) {
144
146
  return obj !== null && typeof obj === 'object';
145
147
  }
148
+ function isPlainObject(obj) {
149
+ return (obj !== null &&
150
+ typeof obj === 'object' &&
151
+ (Object.getPrototypeOf(obj) === Object.prototype ||
152
+ Object.getPrototypeOf(obj) === null));
153
+ }
146
154
 
147
155
  function makeReference(id) {
148
156
  return { __ref: String(id) };
@@ -214,9 +222,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
214
222
  argObj[name.value] = null;
215
223
  }
216
224
  else {
217
- throw globals.__DEV__ ? new globals.InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
218
- 'is not supported. Use variables instead of inline arguments to ' +
219
- 'overcome this limitation.') : new globals.InvariantError(56);
225
+ throw globals.newInvariantError(81, name.value, value.kind);
220
226
  }
221
227
  }
222
228
  function storeKeyNameFromField(field, variables) {
@@ -250,6 +256,7 @@ var KNOWN_DIRECTIVES = [
250
256
  'client',
251
257
  'rest',
252
258
  'export',
259
+ 'nonreactive',
253
260
  ];
254
261
  var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
255
262
  if (args &&
@@ -324,9 +331,7 @@ function resultKeyNameFromField(field) {
324
331
  return field.alias ? field.alias.value : field.name.value;
325
332
  }
326
333
  function getTypenameFromResult(result, selectionSet, fragmentMap) {
327
- if (typeof result.__typename === 'string') {
328
- return result.__typename;
329
- }
334
+ var fragments;
330
335
  for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) {
331
336
  var selection = _a[_i];
332
337
  if (isField(selection)) {
@@ -334,7 +339,19 @@ function getTypenameFromResult(result, selectionSet, fragmentMap) {
334
339
  return result[resultKeyNameFromField(selection)];
335
340
  }
336
341
  }
342
+ else if (fragments) {
343
+ fragments.push(selection);
344
+ }
337
345
  else {
346
+ fragments = [selection];
347
+ }
348
+ }
349
+ if (typeof result.__typename === 'string') {
350
+ return result.__typename;
351
+ }
352
+ if (fragments) {
353
+ for (var _b = 0, fragments_1 = fragments; _b < fragments_1.length; _b++) {
354
+ var selection = fragments_1[_b];
338
355
  var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap);
339
356
  if (typeof typename === 'string') {
340
357
  return typename;
@@ -350,16 +367,16 @@ function isInlineFragment(selection) {
350
367
  }
351
368
 
352
369
  function checkDocument(doc) {
353
- globals.__DEV__ ? globals.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : globals.invariant(doc && doc.kind === 'Document', 48);
370
+ globals.invariant(doc && doc.kind === 'Document', 73);
354
371
  var operations = doc.definitions
355
372
  .filter(function (d) { return d.kind !== 'FragmentDefinition'; })
356
373
  .map(function (definition) {
357
374
  if (definition.kind !== 'OperationDefinition') {
358
- throw globals.__DEV__ ? new globals.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new globals.InvariantError(49);
375
+ throw globals.newInvariantError(74, definition.kind);
359
376
  }
360
377
  return definition;
361
378
  });
362
- globals.__DEV__ ? globals.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : globals.invariant(operations.length <= 1, 50);
379
+ globals.invariant(operations.length <= 1, 75, operations.length);
363
380
  return doc;
364
381
  }
365
382
  function getOperationDefinition(doc) {
@@ -382,14 +399,14 @@ function getFragmentDefinitions(doc) {
382
399
  }
383
400
  function getQueryDefinition(doc) {
384
401
  var queryDef = getOperationDefinition(doc);
385
- globals.__DEV__ ? globals.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : globals.invariant(queryDef && queryDef.operation === 'query', 51);
402
+ globals.invariant(queryDef && queryDef.operation === 'query', 76);
386
403
  return queryDef;
387
404
  }
388
405
  function getFragmentDefinition(doc) {
389
- globals.__DEV__ ? globals.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : globals.invariant(doc.kind === 'Document', 52);
390
- globals.__DEV__ ? globals.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : globals.invariant(doc.definitions.length <= 1, 53);
406
+ globals.invariant(doc.kind === 'Document', 77);
407
+ globals.invariant(doc.definitions.length <= 1, 78);
391
408
  var fragmentDef = doc.definitions[0];
392
- globals.__DEV__ ? globals.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : globals.invariant(fragmentDef.kind === 'FragmentDefinition', 54);
409
+ globals.invariant(fragmentDef.kind === 'FragmentDefinition', 79);
393
410
  return fragmentDef;
394
411
  }
395
412
  function getMainDefinition(queryDoc) {
@@ -412,7 +429,7 @@ function getMainDefinition(queryDoc) {
412
429
  if (fragmentDefinition) {
413
430
  return fragmentDefinition;
414
431
  }
415
- throw globals.__DEV__ ? new globals.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new globals.InvariantError(55);
432
+ throw globals.newInvariantError(80);
416
433
  }
417
434
  function getDefaultValues(definition) {
418
435
  var defaultValues = Object.create(null);
@@ -448,19 +465,30 @@ function nullIfDocIsEmpty(doc) {
448
465
  ? null
449
466
  : doc;
450
467
  }
451
- function getDirectiveMatcher(directives) {
452
- var nameSet = new Set();
453
- var tests = [];
454
- directives.forEach(function (directive) {
455
- if (directive.name) {
456
- nameSet.add(directive.name);
457
- }
458
- else if (directive.test) {
459
- tests.push(directive.test);
468
+ function getDirectiveMatcher(configs) {
469
+ var names = new Map();
470
+ var tests = new Map();
471
+ configs.forEach(function (directive) {
472
+ if (directive) {
473
+ if (directive.name) {
474
+ names.set(directive.name, directive);
475
+ }
476
+ else if (directive.test) {
477
+ tests.set(directive.test, directive);
478
+ }
460
479
  }
461
480
  });
462
- return function (directive) { return (nameSet.has(directive.name.value) ||
463
- tests.some(function (test) { return test(directive); })); };
481
+ return function (directive) {
482
+ var config = names.get(directive.name.value);
483
+ if (!config && tests.size) {
484
+ tests.forEach(function (testConfig, test) {
485
+ if (test(directive)) {
486
+ config = testConfig;
487
+ }
488
+ });
489
+ }
490
+ return config;
491
+ };
464
492
  }
465
493
  function makeInUseGetterFunction(defaultKey) {
466
494
  var map = new Map();
@@ -477,6 +505,7 @@ function makeInUseGetterFunction(defaultKey) {
477
505
  };
478
506
  }
479
507
  function removeDirectivesFromDocument(directives, doc) {
508
+ checkDocument(doc);
480
509
  var getInUseByOperationName = makeInUseGetterFunction("");
481
510
  var getInUseByFragmentName = makeInUseGetterFunction("");
482
511
  var getInUse = function (ancestors) {
@@ -490,7 +519,7 @@ function removeDirectivesFromDocument(directives, doc) {
490
519
  return getInUseByFragmentName(ancestor.name.value);
491
520
  }
492
521
  }
493
- globals.__DEV__ && globals.invariant.error("Could not find operation or fragment");
522
+ globals.__DEV__ && globals.invariant.error(82);
494
523
  return null;
495
524
  };
496
525
  var operationCount = 0;
@@ -500,10 +529,8 @@ function removeDirectivesFromDocument(directives, doc) {
500
529
  }
501
530
  }
502
531
  var directiveMatcher = getDirectiveMatcher(directives);
503
- var hasRemoveDirective = directives.some(function (directive) { return directive.remove; });
504
- var shouldRemoveField = function (nodeDirectives) { return (hasRemoveDirective &&
505
- nodeDirectives &&
506
- nodeDirectives.some(directiveMatcher)); };
532
+ var shouldRemoveField = function (nodeDirectives) { return (isNonEmptyArray(nodeDirectives) &&
533
+ nodeDirectives.map(directiveMatcher).some(function (config) { return config && config.remove; })); };
507
534
  var originalFragmentDefsByPath = new Map();
508
535
  var firstVisitMadeChanges = false;
509
536
  var fieldOrInlineFragmentVisitor = {
@@ -668,8 +695,7 @@ var connectionRemoveConfig = {
668
695
  if (willRemove) {
669
696
  if (!directive.arguments ||
670
697
  !directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) {
671
- globals.__DEV__ && globals.invariant.warn('Removing an @connection directive even though it does not have a key. ' +
672
- 'You may want to use the key parameter to specify a store key.');
698
+ globals.__DEV__ && globals.invariant.warn(83);
673
699
  }
674
700
  }
675
701
  return willRemove;
@@ -763,6 +789,20 @@ function removeClientSetsFromDocument(document) {
763
789
  return modifiedDoc;
764
790
  }
765
791
 
792
+ function isOperation(document, operation) {
793
+ var _a;
794
+ return ((_a = getOperationDefinition(document)) === null || _a === void 0 ? void 0 : _a.operation) === operation;
795
+ }
796
+ function isMutationOperation(document) {
797
+ return isOperation(document, graphql.OperationTypeNode.MUTATION);
798
+ }
799
+ function isQueryOperation(document) {
800
+ return isOperation(document, graphql.OperationTypeNode.QUERY);
801
+ }
802
+ function isSubscriptionOperation(document) {
803
+ return isOperation(document, graphql.OperationTypeNode.SUBSCRIPTION);
804
+ }
805
+
766
806
  var hasOwnProperty = Object.prototype.hasOwnProperty;
767
807
  function mergeDeep() {
768
808
  var sources = [];
@@ -984,6 +1024,43 @@ function makeEmptyData() {
984
1024
  };
985
1025
  }
986
1026
 
1027
+ function createFulfilledPromise(value) {
1028
+ var promise = Promise.resolve(value);
1029
+ promise.status = 'fulfilled';
1030
+ promise.value = value;
1031
+ return promise;
1032
+ }
1033
+ function createRejectedPromise(reason) {
1034
+ var promise = Promise.reject(reason);
1035
+ promise.status = 'rejected';
1036
+ promise.reason = reason;
1037
+ return promise;
1038
+ }
1039
+ function isStatefulPromise(promise) {
1040
+ return 'status' in promise;
1041
+ }
1042
+ function wrapPromiseWithState(promise) {
1043
+ if (isStatefulPromise(promise)) {
1044
+ return promise;
1045
+ }
1046
+ var pendingPromise = promise;
1047
+ pendingPromise.status = 'pending';
1048
+ pendingPromise.then(function (value) {
1049
+ if (pendingPromise.status === 'pending') {
1050
+ var fulfilledPromise = pendingPromise;
1051
+ fulfilledPromise.status = 'fulfilled';
1052
+ fulfilledPromise.value = value;
1053
+ }
1054
+ }, function (reason) {
1055
+ if (pendingPromise.status === 'pending') {
1056
+ var rejectedPromise = pendingPromise;
1057
+ rejectedPromise.status = 'rejected';
1058
+ rejectedPromise.reason = reason;
1059
+ }
1060
+ });
1061
+ return promise;
1062
+ }
1063
+
987
1064
  var toString = Object.prototype.toString;
988
1065
  function cloneDeep(value) {
989
1066
  return cloneDeepHelper(value);
@@ -1266,6 +1343,9 @@ function isExecutionPatchResult(value) {
1266
1343
  return (isExecutionPatchIncrementalResult(value) ||
1267
1344
  isExecutionPatchInitialResult(value));
1268
1345
  }
1346
+ function isApolloPayloadResult(value) {
1347
+ return isNonNullObject(value) && "payload" in value;
1348
+ }
1269
1349
  function mergeIncrementalData(prevResult, result) {
1270
1350
  var mergedData = prevResult;
1271
1351
  var merger = new DeepMerger();
@@ -1331,16 +1411,17 @@ function makeUniqueId(prefix) {
1331
1411
  return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2));
1332
1412
  }
1333
1413
 
1334
- function stringifyForDisplay(value) {
1414
+ function stringifyForDisplay(value, space) {
1415
+ if (space === void 0) { space = 0; }
1335
1416
  var undefId = makeUniqueId("stringifyForDisplay");
1336
1417
  return JSON.stringify(value, function (key, value) {
1337
1418
  return value === void 0 ? undefId : value;
1338
- }).split(JSON.stringify(undefId)).join("<undefined>");
1419
+ }, space).split(JSON.stringify(undefId)).join("<undefined>");
1339
1420
  }
1340
1421
 
1341
1422
  function mergeOptions(defaults, options) {
1342
1423
  return compact(defaults, options, options.variables && {
1343
- variables: tslib.__assign(tslib.__assign({}, (defaults && defaults.variables)), options.variables),
1424
+ variables: compact(tslib.__assign(tslib.__assign({}, (defaults && defaults.variables)), options.variables)),
1344
1425
  });
1345
1426
  }
1346
1427
 
@@ -1364,6 +1445,50 @@ function isNodeReadableStream(value) {
1364
1445
  return !!value.pipe;
1365
1446
  }
1366
1447
 
1448
+ function omitDeep(value, key) {
1449
+ return __omitDeep(value, key);
1450
+ }
1451
+ function __omitDeep(value, key, known) {
1452
+ if (known === void 0) { known = new Map(); }
1453
+ if (known.has(value)) {
1454
+ return known.get(value);
1455
+ }
1456
+ var modified = false;
1457
+ if (Array.isArray(value)) {
1458
+ var array_1 = [];
1459
+ known.set(value, array_1);
1460
+ value.forEach(function (value, index) {
1461
+ var result = __omitDeep(value, key, known);
1462
+ modified || (modified = result !== value);
1463
+ array_1[index] = result;
1464
+ });
1465
+ if (modified) {
1466
+ return array_1;
1467
+ }
1468
+ }
1469
+ else if (isPlainObject(value)) {
1470
+ var obj_1 = Object.create(Object.getPrototypeOf(value));
1471
+ known.set(value, obj_1);
1472
+ Object.keys(value).forEach(function (k) {
1473
+ if (k === key) {
1474
+ modified = true;
1475
+ return;
1476
+ }
1477
+ var result = __omitDeep(value[k], key, known);
1478
+ modified || (modified = result !== value[k]);
1479
+ obj_1[k] = result;
1480
+ });
1481
+ if (modified) {
1482
+ return obj_1;
1483
+ }
1484
+ }
1485
+ return value;
1486
+ }
1487
+
1488
+ function stripTypename(value) {
1489
+ return omitDeep(value, '__typename');
1490
+ }
1491
+
1367
1492
  exports.DEV = globals.DEV;
1368
1493
  exports.maybe = globals.maybe;
1369
1494
  exports.Observable = zenObservableTs.Observable;
@@ -1384,6 +1509,8 @@ exports.cloneDeep = cloneDeep;
1384
1509
  exports.compact = compact;
1385
1510
  exports.concatPagination = concatPagination;
1386
1511
  exports.createFragmentMap = createFragmentMap;
1512
+ exports.createFulfilledPromise = createFulfilledPromise;
1513
+ exports.createRejectedPromise = createRejectedPromise;
1387
1514
  exports.fixObservableSubclass = fixObservableSubclass;
1388
1515
  exports.getDefaultValues = getDefaultValues;
1389
1516
  exports.getDirectiveNames = getDirectiveNames;
@@ -1404,6 +1531,7 @@ exports.hasAllDirectives = hasAllDirectives;
1404
1531
  exports.hasAnyDirectives = hasAnyDirectives;
1405
1532
  exports.hasClientExports = hasClientExports;
1406
1533
  exports.hasDirectives = hasDirectives;
1534
+ exports.isApolloPayloadResult = isApolloPayloadResult;
1407
1535
  exports.isArray = isArray;
1408
1536
  exports.isAsyncIterableIterator = isAsyncIterableIterator;
1409
1537
  exports.isBlob = isBlob;
@@ -1413,13 +1541,18 @@ exports.isExecutionPatchInitialResult = isExecutionPatchInitialResult;
1413
1541
  exports.isExecutionPatchResult = isExecutionPatchResult;
1414
1542
  exports.isField = isField;
1415
1543
  exports.isInlineFragment = isInlineFragment;
1544
+ exports.isMutationOperation = isMutationOperation;
1416
1545
  exports.isNodeReadableStream = isNodeReadableStream;
1417
1546
  exports.isNodeResponse = isNodeResponse;
1418
1547
  exports.isNonEmptyArray = isNonEmptyArray;
1419
1548
  exports.isNonNullObject = isNonNullObject;
1549
+ exports.isPlainObject = isPlainObject;
1550
+ exports.isQueryOperation = isQueryOperation;
1420
1551
  exports.isReadableStream = isReadableStream;
1421
1552
  exports.isReference = isReference;
1553
+ exports.isStatefulPromise = isStatefulPromise;
1422
1554
  exports.isStreamableBlob = isStreamableBlob;
1555
+ exports.isSubscriptionOperation = isSubscriptionOperation;
1423
1556
  exports.iterateObserversSafely = iterateObserversSafely;
1424
1557
  exports.makeReference = makeReference;
1425
1558
  exports.makeUniqueId = makeUniqueId;
@@ -1429,6 +1562,7 @@ exports.mergeDeepArray = mergeDeepArray;
1429
1562
  exports.mergeIncrementalData = mergeIncrementalData;
1430
1563
  exports.mergeOptions = mergeOptions;
1431
1564
  exports.offsetLimitPagination = offsetLimitPagination;
1565
+ exports.omitDeep = omitDeep;
1432
1566
  exports.relayStylePagination = relayStylePagination;
1433
1567
  exports.removeArgumentsFromDocument = removeArgumentsFromDocument;
1434
1568
  exports.removeClientSetsFromDocument = removeClientSetsFromDocument;
@@ -1439,5 +1573,7 @@ exports.resultKeyNameFromField = resultKeyNameFromField;
1439
1573
  exports.shouldInclude = shouldInclude;
1440
1574
  exports.storeKeyNameFromField = storeKeyNameFromField;
1441
1575
  exports.stringifyForDisplay = stringifyForDisplay;
1576
+ exports.stripTypename = stripTypename;
1442
1577
  exports.valueToObjectRepresentation = valueToObjectRepresentation;
1578
+ exports.wrapPromiseWithState = wrapPromiseWithState;
1443
1579
  //# sourceMappingURL=utilities.cjs.map
package/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export var version = '3.8.0-alpha.9';
1
+ export var version = '3.8.0-beta.0';
2
2
  //# sourceMappingURL=version.js.map
@@ -1,2 +0,0 @@
1
- declare const optimism: any;
2
- //# sourceMappingURL=optimism.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"optimism.d.ts","sourceRoot":"","sources":["../../../../src/cache/inmemory/__mocks__/optimism.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,QAAQ,KAAiC,CAAC"}
@@ -1,14 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var optimism = jest.requireActual('optimism');
13
- module.exports = __assign(__assign({}, optimism), { wrap: jest.fn(optimism.wrap) });
14
- //# sourceMappingURL=optimism.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"optimism.js","sourceRoot":"","sources":["../../../../src/cache/inmemory/__mocks__/optimism.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,IAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AAChD,MAAM,CAAC,OAAO,yBACT,QAAQ,KACX,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAC7B,CAAC","sourcesContent":["const optimism = jest.requireActual('optimism');\nmodule.exports = {\n ...optimism,\n wrap: jest.fn(optimism.wrap),\n};\n"]}
@@ -1,3 +0,0 @@
1
- import { DocumentNode } from "graphql";
2
- export declare function compareResultsUsingQuery(query: DocumentNode, aResult: any, bResult: any, variables?: Record<string, any> | undefined): boolean;
3
- //# sourceMappingURL=compareResults.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compareResults.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/compareResults.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,YAAY,EAOb,MAAM,SAAS,CAAC;AAejB,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,EACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAC1C,OAAO,CAWT"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"compareResults.js","sourceRoot":"","sources":["../../../src/react/hooks/compareResults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,eAAe,CAAC;AAalC,OAAO,EACL,iBAAiB,EAEjB,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,OAAO,EACP,sBAAsB,EACtB,aAAa,GACd,MAAM,iBAAiB,CAAC;AAIzB,MAAM,UAAU,wBAAwB,CACtC,KAAmB,EACnB,OAAY,EACZ,OAAY,EACZ,SAA2C;IAE3C,IAAI,OAAO,KAAK,OAAO;QAAE,OAAO,IAAI,CAAC;IACrC,OAAO,+BAA+B,CACpC,iBAAiB,CAAC,KAAK,CAAC,CAAC,YAAY,EACrC,OAAO,EACP,OAAO,EACP;QACE,WAAW,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;QAC7D,SAAS,WAAA;KACV,CACF,CAAC;AACJ,CAAC;AASD,SAAS,+BAA+B,CACtC,YAA8B,EAC9B,OAAY,EACZ,OAAY,EACZ,OAAuB;IAEvB,IAAM,cAAc,GAAG,IAAI,GAAG,EAAiB,CAAC;IAKhD,OAAO,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,UAAA,SAAS;QAG5C,IAAI,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC;YAAE,OAAO,IAAI,CAAC;QAC/C,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAG9B,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC;YAAE,OAAO,IAAI,CAAC;QAI9D,IAAI,gCAAgC,CAAC,SAAS,CAAC;YAAE,OAAO,IAAI,CAAC;QAE7D,IAAI,OAAO,CAAC,SAAS,CAAC,EAAE;YACtB,IAAM,SAAS,GAAG,sBAAsB,CAAC,SAAS,CAAC,CAAC;YACpD,IAAM,YAAY,GAAG,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;YACnD,IAAM,YAAY,GAAG,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;YACnD,IAAM,iBAAiB,GAAG,SAAS,CAAC,YAAY,CAAC;YAEjD,IAAI,CAAC,iBAAiB,EAAE;gBAGtB,OAAO,KAAK,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;aAC1C;YAED,IAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YAClD,IAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YAClD,IAAI,aAAa,KAAK,aAAa;gBAAE,OAAO,KAAK,CAAC;YAClD,IAAI,aAAa,IAAI,aAAa,EAAE;gBAClC,IAAM,QAAM,GAAG,YAAY,CAAC,MAAM,CAAC;gBACnC,IAAI,YAAY,CAAC,MAAM,KAAK,QAAM,EAAE;oBAClC,OAAO,KAAK,CAAC;iBACd;gBACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAM,EAAE,EAAE,CAAC,EAAE;oBAC/B,IAAI,CAAC,+BAA+B,CAClC,iBAAiB,EACjB,YAAY,CAAC,CAAC,CAAC,EACf,YAAY,CAAC,CAAC,CAAC,EACf,OAAO,CACR,EAAE;wBACD,OAAO,KAAK,CAAC;qBACd;iBACF;gBACD,OAAO,IAAI,CAAC;aACb;YAED,OAAO,+BAA+B,CACpC,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,OAAO,CACR,CAAC;SAEH;aAAM;YACL,IAAM,QAAQ,GAAG,wBAAwB,CAAC,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;YAC1E,IAAI,QAAQ,EAAE;gBAGZ,IAAI,gCAAgC,CAAC,QAAQ,CAAC;oBAAE,OAAO,IAAI,CAAC;gBAE5D,OAAO,+BAA+B,CACpC,QAAQ,CAAC,YAAY,EAKrB,OAAO,EACP,OAAO,EACP,OAAO,CACR,CAAC;aACH;SACF;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,gCAAgC,CAAC,SAIhB;IAExB,OAAO,CAAC,CAAC,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;AACrF,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAkB;IAChD,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,aAAa,CAAC;AAC1C,CAAC","sourcesContent":["import equal from \"@wry/equality\";\n\nimport {\n DirectiveNode,\n DocumentNode,\n FieldNode,\n FragmentDefinitionNode,\n FragmentSpreadNode,\n InlineFragmentNode,\n SelectionNode,\n SelectionSetNode,\n} from \"graphql\";\n\nimport {\n createFragmentMap,\n FragmentMap,\n getFragmentDefinitions,\n getFragmentFromSelection,\n getMainDefinition,\n isField,\n resultKeyNameFromField,\n shouldInclude,\n} from \"../../utilities\";\n\n// Returns true if aResult and bResult are deeply equal according to the fields\n// selected by the given query, ignoring any fields marked as @nonreactive.\nexport function compareResultsUsingQuery(\n query: DocumentNode,\n aResult: any,\n bResult: any,\n variables?: Record<string, any> | undefined,\n): boolean {\n if (aResult === bResult) return true;\n return compareResultsUsingSelectionSet(\n getMainDefinition(query).selectionSet,\n aResult,\n bResult,\n {\n fragmentMap: createFragmentMap(getFragmentDefinitions(query)),\n variables,\n },\n );\n}\n\n// Encapsulates the information used by compareResultsUsingSelectionSet that\n// does not change during the recursion.\ninterface CompareContext {\n fragmentMap: FragmentMap;\n variables: Record<string, any> | undefined;\n}\n\nfunction compareResultsUsingSelectionSet(\n selectionSet: SelectionSetNode,\n aResult: any,\n bResult: any,\n context: CompareContext,\n): boolean {\n const seenSelections = new Set<SelectionNode>();\n\n // Returning true from this Array.prototype.every callback function skips the\n // current field/subtree. Returning false aborts the entire traversal\n // immediately, causing compareResultsUsingSelectionSet to return false.\n return selectionSet.selections.every(selection => {\n // Avoid re-processing the same selection at the same level of recursion, in\n // case the same field gets included via multiple indirect fragment spreads.\n if (seenSelections.has(selection)) return true;\n seenSelections.add(selection);\n\n // Ignore @skip(if: true) and @include(if: false) fields.\n if (!shouldInclude(selection, context.variables)) return true;\n\n // If the field or (named) fragment spread has a @nonreactive directive on\n // it, we don't care if it's different, so we pretend it's the same.\n if (selectionHasNonreactiveDirective(selection)) return true;\n\n if (isField(selection)) {\n const resultKey = resultKeyNameFromField(selection);\n const aResultChild = aResult && aResult[resultKey];\n const bResultChild = bResult && bResult[resultKey];\n const childSelectionSet = selection.selectionSet;\n\n if (!childSelectionSet) {\n // These are scalar values, so we can compare them with deep equal\n // without redoing the main recursive work.\n return equal(aResultChild, bResultChild);\n }\n\n const aChildIsArray = Array.isArray(aResultChild);\n const bChildIsArray = Array.isArray(bResultChild);\n if (aChildIsArray !== bChildIsArray) return false;\n if (aChildIsArray && bChildIsArray) {\n const length = aResultChild.length;\n if (bResultChild.length !== length) {\n return false;\n }\n for (let i = 0; i < length; ++i) {\n if (!compareResultsUsingSelectionSet(\n childSelectionSet,\n aResultChild[i],\n bResultChild[i],\n context,\n )) {\n return false;\n }\n }\n return true;\n }\n\n return compareResultsUsingSelectionSet(\n childSelectionSet,\n aResultChild,\n bResultChild,\n context,\n );\n\n } else {\n const fragment = getFragmentFromSelection(selection, context.fragmentMap);\n if (fragment) {\n // The fragment might === selection if it's an inline fragment, but\n // could be !== if it's a named fragment ...spread.\n if (selectionHasNonreactiveDirective(fragment)) return true;\n\n return compareResultsUsingSelectionSet(\n fragment.selectionSet,\n // Notice that we reuse the same aResult and bResult values here,\n // since the fragment ...spread does not specify a field name, but\n // consists of multiple fields (within the fragment's selection set)\n // that should be applied to the current result value(s).\n aResult,\n bResult,\n context,\n );\n }\n }\n });\n}\n\nfunction selectionHasNonreactiveDirective(selection:\n | FieldNode\n | InlineFragmentNode\n | FragmentSpreadNode\n | FragmentDefinitionNode,\n): boolean {\n return !!selection.directives && selection.directives.some(directiveIsNonreactive);\n}\n\nfunction directiveIsNonreactive(dir: DirectiveNode): boolean {\n return dir.name.value === \"nonreactive\";\n}\n"]}