@apollo/client 0.0.0-pr-10521-20230206180228

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 (778) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +45 -0
  3. package/apollo-client.cjs +7614 -0
  4. package/apollo-client.cjs.map +1 -0
  5. package/apollo-client.min.cjs +1 -0
  6. package/cache/cache.cjs +2425 -0
  7. package/cache/cache.cjs.map +1 -0
  8. package/cache/cache.cjs.native.js +2425 -0
  9. package/cache/core/cache.d.ts +32 -0
  10. package/cache/core/cache.d.ts.map +1 -0
  11. package/cache/core/cache.js +84 -0
  12. package/cache/core/cache.js.map +1 -0
  13. package/cache/core/types/Cache.d.ts +55 -0
  14. package/cache/core/types/Cache.d.ts.map +1 -0
  15. package/cache/core/types/Cache.js +4 -0
  16. package/cache/core/types/Cache.js.map +1 -0
  17. package/cache/core/types/DataProxy.d.ts +52 -0
  18. package/cache/core/types/DataProxy.d.ts.map +1 -0
  19. package/cache/core/types/DataProxy.js +2 -0
  20. package/cache/core/types/DataProxy.js.map +1 -0
  21. package/cache/core/types/common.d.ts +47 -0
  22. package/cache/core/types/common.d.ts.map +1 -0
  23. package/cache/core/types/common.js +26 -0
  24. package/cache/core/types/common.js.map +1 -0
  25. package/cache/index.d.ts +15 -0
  26. package/cache/index.d.ts.map +1 -0
  27. package/cache/index.js +14 -0
  28. package/cache/index.js.map +1 -0
  29. package/cache/inmemory/__mocks__/optimism.d.ts +2 -0
  30. package/cache/inmemory/__mocks__/optimism.d.ts.map +1 -0
  31. package/cache/inmemory/__mocks__/optimism.js +14 -0
  32. package/cache/inmemory/__mocks__/optimism.js.map +1 -0
  33. package/cache/inmemory/entityStore.d.ts +83 -0
  34. package/cache/inmemory/entityStore.d.ts.map +1 -0
  35. package/cache/inmemory/entityStore.js +467 -0
  36. package/cache/inmemory/entityStore.js.map +1 -0
  37. package/cache/inmemory/fixPolyfills.d.ts +1 -0
  38. package/cache/inmemory/fixPolyfills.d.ts.map +1 -0
  39. package/cache/inmemory/fixPolyfills.js +1 -0
  40. package/cache/inmemory/fixPolyfills.js.map +1 -0
  41. package/cache/inmemory/fixPolyfills.native.d.ts +2 -0
  42. package/cache/inmemory/fixPolyfills.native.d.ts.map +1 -0
  43. package/cache/inmemory/fixPolyfills.native.js +48 -0
  44. package/cache/inmemory/fixPolyfills.native.js.map +1 -0
  45. package/cache/inmemory/fragmentRegistry.d.ts +8 -0
  46. package/cache/inmemory/fragmentRegistry.d.ts.map +1 -0
  47. package/cache/inmemory/fragmentRegistry.js +113 -0
  48. package/cache/inmemory/fragmentRegistry.js.map +1 -0
  49. package/cache/inmemory/helpers.d.ts +27 -0
  50. package/cache/inmemory/helpers.d.ts.map +1 -0
  51. package/cache/inmemory/helpers.js +85 -0
  52. package/cache/inmemory/helpers.js.map +1 -0
  53. package/cache/inmemory/inMemoryCache.d.ts +52 -0
  54. package/cache/inmemory/inMemoryCache.d.ts.map +1 -0
  55. package/cache/inmemory/inMemoryCache.js +316 -0
  56. package/cache/inmemory/inMemoryCache.js.map +1 -0
  57. package/cache/inmemory/key-extractor.d.ts +9 -0
  58. package/cache/inmemory/key-extractor.d.ts.map +1 -0
  59. package/cache/inmemory/key-extractor.js +118 -0
  60. package/cache/inmemory/key-extractor.js.map +1 -0
  61. package/cache/inmemory/object-canon.d.ts +17 -0
  62. package/cache/inmemory/object-canon.d.ts.map +1 -0
  63. package/cache/inmemory/object-canon.js +120 -0
  64. package/cache/inmemory/object-canon.js.map +1 -0
  65. package/cache/inmemory/policies.d.ts +96 -0
  66. package/cache/inmemory/policies.d.ts.map +1 -0
  67. package/cache/inmemory/policies.js +416 -0
  68. package/cache/inmemory/policies.js.map +1 -0
  69. package/cache/inmemory/reactiveVars.d.ts +18 -0
  70. package/cache/inmemory/reactiveVars.d.ts.map +1 -0
  71. package/cache/inmemory/reactiveVars.js +65 -0
  72. package/cache/inmemory/reactiveVars.js.map +1 -0
  73. package/cache/inmemory/readFromStore.d.ts +36 -0
  74. package/cache/inmemory/readFromStore.d.ts.map +1 -0
  75. package/cache/inmemory/readFromStore.js +267 -0
  76. package/cache/inmemory/readFromStore.js.map +1 -0
  77. package/cache/inmemory/types.d.ts +81 -0
  78. package/cache/inmemory/types.d.ts.map +1 -0
  79. package/cache/inmemory/types.js +4 -0
  80. package/cache/inmemory/types.js.map +1 -0
  81. package/cache/inmemory/writeToStore.d.ts +37 -0
  82. package/cache/inmemory/writeToStore.d.ts.map +1 -0
  83. package/cache/inmemory/writeToStore.js +394 -0
  84. package/cache/inmemory/writeToStore.js.map +1 -0
  85. package/cache/package.json +8 -0
  86. package/config/jest/setup.d.ts +2 -0
  87. package/config/jest/setup.d.ts.map +1 -0
  88. package/config/jest/setup.js +5 -0
  89. package/config/jest/setup.js.map +1 -0
  90. package/core/ApolloClient.d.ts +76 -0
  91. package/core/ApolloClient.d.ts.map +1 -0
  92. package/core/ApolloClient.js +240 -0
  93. package/core/ApolloClient.js.map +1 -0
  94. package/core/LocalState.d.ts +69 -0
  95. package/core/LocalState.d.ts.map +1 -0
  96. package/core/LocalState.js +321 -0
  97. package/core/LocalState.js.map +1 -0
  98. package/core/ObservableQuery.d.ts +74 -0
  99. package/core/ObservableQuery.d.ts.map +1 -0
  100. package/core/ObservableQuery.js +507 -0
  101. package/core/ObservableQuery.js.map +1 -0
  102. package/core/QueryInfo.d.ts +62 -0
  103. package/core/QueryInfo.d.ts.map +1 -0
  104. package/core/QueryInfo.js +287 -0
  105. package/core/QueryInfo.js.map +1 -0
  106. package/core/QueryManager.d.ts +120 -0
  107. package/core/QueryManager.d.ts.map +1 -0
  108. package/core/QueryManager.js +890 -0
  109. package/core/QueryManager.js.map +1 -0
  110. package/core/core.cjs +2349 -0
  111. package/core/core.cjs.map +1 -0
  112. package/core/core.cjs.native.js +2349 -0
  113. package/core/index.d.ts +17 -0
  114. package/core/index.d.ts.map +1 -0
  115. package/core/index.js +17 -0
  116. package/core/index.js.map +1 -0
  117. package/core/networkStatus.d.ts +11 -0
  118. package/core/networkStatus.d.ts.map +1 -0
  119. package/core/networkStatus.js +14 -0
  120. package/core/networkStatus.js.map +1 -0
  121. package/core/package.json +8 -0
  122. package/core/types.d.ts +74 -0
  123. package/core/types.d.ts.map +1 -0
  124. package/core/types.js +3 -0
  125. package/core/types.js.map +1 -0
  126. package/core/watchQueryOptions.d.ts +78 -0
  127. package/core/watchQueryOptions.d.ts.map +1 -0
  128. package/core/watchQueryOptions.js +2 -0
  129. package/core/watchQueryOptions.js.map +1 -0
  130. package/errors/errors.cjs +49 -0
  131. package/errors/errors.cjs.map +1 -0
  132. package/errors/errors.cjs.native.js +49 -0
  133. package/errors/index.d.ts +23 -0
  134. package/errors/index.d.ts.map +1 -0
  135. package/errors/index.js +42 -0
  136. package/errors/index.js.map +1 -0
  137. package/errors/package.json +8 -0
  138. package/index.d.ts +3 -0
  139. package/index.d.ts.map +1 -0
  140. package/index.js +3 -0
  141. package/index.js.map +1 -0
  142. package/invariantErrorCodes.js +339 -0
  143. package/link/batch/batch.cjs +159 -0
  144. package/link/batch/batch.cjs.map +1 -0
  145. package/link/batch/batch.cjs.native.js +159 -0
  146. package/link/batch/batchLink.d.ts +19 -0
  147. package/link/batch/batchLink.d.ts.map +1 -0
  148. package/link/batch/batchLink.js +31 -0
  149. package/link/batch/batchLink.js.map +1 -0
  150. package/link/batch/batching.d.ts +27 -0
  151. package/link/batch/batching.d.ts.map +1 -0
  152. package/link/batch/batching.js +125 -0
  153. package/link/batch/batching.js.map +1 -0
  154. package/link/batch/index.d.ts +2 -0
  155. package/link/batch/index.d.ts.map +1 -0
  156. package/link/batch/index.js +2 -0
  157. package/link/batch/index.js.map +1 -0
  158. package/link/batch/package.json +8 -0
  159. package/link/batch-http/batch-http.cjs +137 -0
  160. package/link/batch-http/batch-http.cjs.map +1 -0
  161. package/link/batch-http/batch-http.cjs.native.js +137 -0
  162. package/link/batch-http/batchHttpLink.d.ts +16 -0
  163. package/link/batch-http/batchHttpLink.d.ts.map +1 -0
  164. package/link/batch-http/batchHttpLink.js +131 -0
  165. package/link/batch-http/batchHttpLink.js.map +1 -0
  166. package/link/batch-http/index.d.ts +2 -0
  167. package/link/batch-http/index.d.ts.map +1 -0
  168. package/link/batch-http/index.js +2 -0
  169. package/link/batch-http/index.js.map +1 -0
  170. package/link/batch-http/package.json +8 -0
  171. package/link/context/context.cjs +38 -0
  172. package/link/context/context.cjs.map +1 -0
  173. package/link/context/context.cjs.native.js +38 -0
  174. package/link/context/index.d.ts +5 -0
  175. package/link/context/index.d.ts.map +1 -0
  176. package/link/context/index.js +31 -0
  177. package/link/context/index.js.map +1 -0
  178. package/link/context/package.json +8 -0
  179. package/link/core/ApolloLink.d.ts +16 -0
  180. package/link/core/ApolloLink.d.ts.map +1 -0
  181. package/link/core/ApolloLink.js +100 -0
  182. package/link/core/ApolloLink.js.map +1 -0
  183. package/link/core/concat.d.ts +3 -0
  184. package/link/core/concat.d.ts.map +1 -0
  185. package/link/core/concat.js +3 -0
  186. package/link/core/concat.js.map +1 -0
  187. package/link/core/core.cjs +121 -0
  188. package/link/core/core.cjs.map +1 -0
  189. package/link/core/core.cjs.native.js +121 -0
  190. package/link/core/empty.d.ts +3 -0
  191. package/link/core/empty.d.ts.map +1 -0
  192. package/link/core/empty.js +3 -0
  193. package/link/core/empty.js.map +1 -0
  194. package/link/core/execute.d.ts +3 -0
  195. package/link/core/execute.d.ts.map +1 -0
  196. package/link/core/execute.js +3 -0
  197. package/link/core/execute.js.map +1 -0
  198. package/link/core/from.d.ts +3 -0
  199. package/link/core/from.d.ts.map +1 -0
  200. package/link/core/from.js +3 -0
  201. package/link/core/from.js.map +1 -0
  202. package/link/core/index.d.ts +9 -0
  203. package/link/core/index.d.ts.map +1 -0
  204. package/link/core/index.js +9 -0
  205. package/link/core/index.js.map +1 -0
  206. package/link/core/package.json +8 -0
  207. package/link/core/split.d.ts +3 -0
  208. package/link/core/split.d.ts.map +1 -0
  209. package/link/core/split.js +3 -0
  210. package/link/core/split.js.map +1 -0
  211. package/link/core/types.d.ts +52 -0
  212. package/link/core/types.d.ts.map +1 -0
  213. package/link/core/types.js +2 -0
  214. package/link/core/types.js.map +1 -0
  215. package/link/error/error.cjs +90 -0
  216. package/link/error/error.cjs.map +1 -0
  217. package/link/error/error.cjs.native.js +90 -0
  218. package/link/error/index.d.ts +24 -0
  219. package/link/error/index.d.ts.map +1 -0
  220. package/link/error/index.js +83 -0
  221. package/link/error/index.js.map +1 -0
  222. package/link/error/package.json +8 -0
  223. package/link/http/HttpLink.d.ts +8 -0
  224. package/link/http/HttpLink.d.ts.map +1 -0
  225. package/link/http/HttpLink.js +15 -0
  226. package/link/http/HttpLink.js.map +1 -0
  227. package/link/http/checkFetcher.d.ts +2 -0
  228. package/link/http/checkFetcher.d.ts.map +1 -0
  229. package/link/http/checkFetcher.js +7 -0
  230. package/link/http/checkFetcher.js.map +1 -0
  231. package/link/http/createHttpLink.d.ts +4 -0
  232. package/link/http/createHttpLink.d.ts.map +1 -0
  233. package/link/http/createHttpLink.js +127 -0
  234. package/link/http/createHttpLink.js.map +1 -0
  235. package/link/http/createSignalIfSupported.d.ts +8 -0
  236. package/link/http/createSignalIfSupported.d.ts.map +1 -0
  237. package/link/http/createSignalIfSupported.js +8 -0
  238. package/link/http/createSignalIfSupported.js.map +1 -0
  239. package/link/http/http.cjs +593 -0
  240. package/link/http/http.cjs.map +1 -0
  241. package/link/http/http.cjs.native.js +593 -0
  242. package/link/http/index.d.ts +11 -0
  243. package/link/http/index.d.ts.map +1 -0
  244. package/link/http/index.js +11 -0
  245. package/link/http/index.js.map +1 -0
  246. package/link/http/iterators/async.d.ts +2 -0
  247. package/link/http/iterators/async.d.ts.map +1 -0
  248. package/link/http/iterators/async.js +14 -0
  249. package/link/http/iterators/async.js.map +1 -0
  250. package/link/http/iterators/nodeStream.d.ts +4 -0
  251. package/link/http/iterators/nodeStream.d.ts.map +1 -0
  252. package/link/http/iterators/nodeStream.js +71 -0
  253. package/link/http/iterators/nodeStream.js.map +1 -0
  254. package/link/http/iterators/promise.d.ts +2 -0
  255. package/link/http/iterators/promise.d.ts.map +1 -0
  256. package/link/http/iterators/promise.js +28 -0
  257. package/link/http/iterators/promise.js.map +1 -0
  258. package/link/http/iterators/reader.d.ts +2 -0
  259. package/link/http/iterators/reader.d.ts.map +1 -0
  260. package/link/http/iterators/reader.js +15 -0
  261. package/link/http/iterators/reader.js.map +1 -0
  262. package/link/http/package.json +8 -0
  263. package/link/http/parseAndCheckHttpResponse.d.ts +14 -0
  264. package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -0
  265. package/link/http/parseAndCheckHttpResponse.js +148 -0
  266. package/link/http/parseAndCheckHttpResponse.js.map +1 -0
  267. package/link/http/responseIterator.d.ts +3 -0
  268. package/link/http/responseIterator.d.ts.map +1 -0
  269. package/link/http/responseIterator.js +23 -0
  270. package/link/http/responseIterator.js.map +1 -0
  271. package/link/http/rewriteURIForGET.d.ts +9 -0
  272. package/link/http/rewriteURIForGET.d.ts.map +1 -0
  273. package/link/http/rewriteURIForGET.js +43 -0
  274. package/link/http/rewriteURIForGET.js.map +1 -0
  275. package/link/http/selectHttpOptionsAndBody.d.ts +57 -0
  276. package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -0
  277. package/link/http/selectHttpOptionsAndBody.js +78 -0
  278. package/link/http/selectHttpOptionsAndBody.js.map +1 -0
  279. package/link/http/selectURI.d.ts +3 -0
  280. package/link/http/selectURI.d.ts.map +1 -0
  281. package/link/http/selectURI.js +14 -0
  282. package/link/http/selectURI.js.map +1 -0
  283. package/link/http/serializeFetchParameter.d.ts +6 -0
  284. package/link/http/serializeFetchParameter.d.ts.map +1 -0
  285. package/link/http/serializeFetchParameter.js +14 -0
  286. package/link/http/serializeFetchParameter.js.map +1 -0
  287. package/link/persisted-queries/index.d.ts +31 -0
  288. package/link/persisted-queries/index.d.ts.map +1 -0
  289. package/link/persisted-queries/index.js +170 -0
  290. package/link/persisted-queries/index.js.map +1 -0
  291. package/link/persisted-queries/package.json +8 -0
  292. package/link/persisted-queries/persisted-queries.cjs +174 -0
  293. package/link/persisted-queries/persisted-queries.cjs.map +1 -0
  294. package/link/persisted-queries/persisted-queries.cjs.native.js +174 -0
  295. package/link/retry/delayFunction.d.ts +11 -0
  296. package/link/retry/delayFunction.d.ts.map +1 -0
  297. package/link/retry/delayFunction.js +12 -0
  298. package/link/retry/delayFunction.js.map +1 -0
  299. package/link/retry/index.d.ts +2 -0
  300. package/link/retry/index.d.ts.map +1 -0
  301. package/link/retry/index.js +2 -0
  302. package/link/retry/index.js.map +1 -0
  303. package/link/retry/package.json +8 -0
  304. package/link/retry/retry.cjs +170 -0
  305. package/link/retry/retry.cjs.map +1 -0
  306. package/link/retry/retry.cjs.native.js +170 -0
  307. package/link/retry/retryFunction.d.ts +10 -0
  308. package/link/retry/retryFunction.d.ts.map +1 -0
  309. package/link/retry/retryFunction.js +9 -0
  310. package/link/retry/retryFunction.js.map +1 -0
  311. package/link/retry/retryLink.d.ts +17 -0
  312. package/link/retry/retryLink.d.ts.map +1 -0
  313. package/link/retry/retryLink.js +145 -0
  314. package/link/retry/retryLink.js.map +1 -0
  315. package/link/schema/index.d.ts +22 -0
  316. package/link/schema/index.d.ts.map +1 -0
  317. package/link/schema/index.js +50 -0
  318. package/link/schema/index.js.map +1 -0
  319. package/link/schema/package.json +8 -0
  320. package/link/schema/schema.cjs +56 -0
  321. package/link/schema/schema.cjs.map +1 -0
  322. package/link/schema/schema.cjs.native.js +56 -0
  323. package/link/subscriptions/index.d.ts +9 -0
  324. package/link/subscriptions/index.d.ts.map +1 -0
  325. package/link/subscriptions/index.js +39 -0
  326. package/link/subscriptions/index.js.map +1 -0
  327. package/link/subscriptions/package.json +8 -0
  328. package/link/subscriptions/subscriptions.cjs +45 -0
  329. package/link/subscriptions/subscriptions.cjs.map +1 -0
  330. package/link/subscriptions/subscriptions.cjs.native.js +45 -0
  331. package/link/utils/createOperation.d.ts +3 -0
  332. package/link/utils/createOperation.d.ts.map +1 -0
  333. package/link/utils/createOperation.js +23 -0
  334. package/link/utils/createOperation.js.map +1 -0
  335. package/link/utils/fromError.d.ts +3 -0
  336. package/link/utils/fromError.d.ts.map +1 -0
  337. package/link/utils/fromError.js +7 -0
  338. package/link/utils/fromError.js.map +1 -0
  339. package/link/utils/fromPromise.d.ts +3 -0
  340. package/link/utils/fromPromise.d.ts.map +1 -0
  341. package/link/utils/fromPromise.js +12 -0
  342. package/link/utils/fromPromise.js.map +1 -0
  343. package/link/utils/index.d.ts +9 -0
  344. package/link/utils/index.d.ts.map +1 -0
  345. package/link/utils/index.js +9 -0
  346. package/link/utils/index.js.map +1 -0
  347. package/link/utils/package.json +8 -0
  348. package/link/utils/throwServerError.d.ts +7 -0
  349. package/link/utils/throwServerError.d.ts.map +1 -0
  350. package/link/utils/throwServerError.js +9 -0
  351. package/link/utils/throwServerError.js.map +1 -0
  352. package/link/utils/toPromise.d.ts +3 -0
  353. package/link/utils/toPromise.d.ts.map +1 -0
  354. package/link/utils/toPromise.js +19 -0
  355. package/link/utils/toPromise.js.map +1 -0
  356. package/link/utils/transformOperation.d.ts +3 -0
  357. package/link/utils/transformOperation.d.ts.map +1 -0
  358. package/link/utils/transformOperation.js +17 -0
  359. package/link/utils/transformOperation.js.map +1 -0
  360. package/link/utils/utils.cjs +115 -0
  361. package/link/utils/utils.cjs.map +1 -0
  362. package/link/utils/utils.cjs.native.js +115 -0
  363. package/link/utils/validateOperation.d.ts +3 -0
  364. package/link/utils/validateOperation.d.ts.map +1 -0
  365. package/link/utils/validateOperation.js +18 -0
  366. package/link/utils/validateOperation.js.map +1 -0
  367. package/link/ws/index.d.ts +17 -0
  368. package/link/ws/index.d.ts.map +1 -0
  369. package/link/ws/index.js +22 -0
  370. package/link/ws/index.js.map +1 -0
  371. package/link/ws/package.json +8 -0
  372. package/link/ws/ws.cjs +28 -0
  373. package/link/ws/ws.cjs.map +1 -0
  374. package/link/ws/ws.cjs.native.js +28 -0
  375. package/main.cjs +16 -0
  376. package/main.cjs.map +1 -0
  377. package/main.cjs.native.js +16 -0
  378. package/package.json +141 -0
  379. package/react/cache/SuspenseCache.d.ts +18 -0
  380. package/react/cache/SuspenseCache.d.ts.map +1 -0
  381. package/react/cache/SuspenseCache.js +49 -0
  382. package/react/cache/SuspenseCache.js.map +1 -0
  383. package/react/cache/index.d.ts +2 -0
  384. package/react/cache/index.d.ts.map +1 -0
  385. package/react/cache/index.js +2 -0
  386. package/react/cache/index.js.map +1 -0
  387. package/react/components/Mutation.d.ts +12 -0
  388. package/react/components/Mutation.d.ts.map +1 -0
  389. package/react/components/Mutation.js +22 -0
  390. package/react/components/Mutation.js.map +1 -0
  391. package/react/components/Query.d.ts +12 -0
  392. package/react/components/Query.d.ts.map +1 -0
  393. package/react/components/Query.js +23 -0
  394. package/react/components/Query.js.map +1 -0
  395. package/react/components/Subscription.d.ts +12 -0
  396. package/react/components/Subscription.d.ts.map +1 -0
  397. package/react/components/Subscription.js +17 -0
  398. package/react/components/Subscription.js.map +1 -0
  399. package/react/components/components.cjs +81 -0
  400. package/react/components/components.cjs.map +1 -0
  401. package/react/components/components.cjs.native.js +81 -0
  402. package/react/components/index.d.ts +5 -0
  403. package/react/components/index.d.ts.map +1 -0
  404. package/react/components/index.js +5 -0
  405. package/react/components/index.js.map +1 -0
  406. package/react/components/package.json +8 -0
  407. package/react/components/types.d.ts +18 -0
  408. package/react/components/types.d.ts.map +1 -0
  409. package/react/components/types.js +2 -0
  410. package/react/components/types.js.map +1 -0
  411. package/react/context/ApolloConsumer.d.ts +7 -0
  412. package/react/context/ApolloConsumer.d.ts.map +1 -0
  413. package/react/context/ApolloConsumer.js +12 -0
  414. package/react/context/ApolloConsumer.js.map +1 -0
  415. package/react/context/ApolloContext.d.ts +12 -0
  416. package/react/context/ApolloContext.d.ts.map +1 -0
  417. package/react/context/ApolloContext.js +20 -0
  418. package/react/context/ApolloContext.js.map +1 -0
  419. package/react/context/ApolloProvider.d.ts +10 -0
  420. package/react/context/ApolloProvider.d.ts.map +1 -0
  421. package/react/context/ApolloProvider.js +20 -0
  422. package/react/context/ApolloProvider.js.map +1 -0
  423. package/react/context/context.cjs +70 -0
  424. package/react/context/context.cjs.map +1 -0
  425. package/react/context/context.cjs.native.js +70 -0
  426. package/react/context/index.d.ts +5 -0
  427. package/react/context/index.d.ts.map +1 -0
  428. package/react/context/index.js +5 -0
  429. package/react/context/index.js.map +1 -0
  430. package/react/context/package.json +8 -0
  431. package/react/hoc/graphql.d.ts +6 -0
  432. package/react/hoc/graphql.d.ts.map +1 -0
  433. package/react/hoc/graphql.js +17 -0
  434. package/react/hoc/graphql.js.map +1 -0
  435. package/react/hoc/hoc-utils.d.ts +17 -0
  436. package/react/hoc/hoc-utils.d.ts.map +1 -0
  437. package/react/hoc/hoc-utils.js +47 -0
  438. package/react/hoc/hoc-utils.js.map +1 -0
  439. package/react/hoc/hoc.cjs +325 -0
  440. package/react/hoc/hoc.cjs.map +1 -0
  441. package/react/hoc/hoc.cjs.native.js +325 -0
  442. package/react/hoc/index.d.ts +8 -0
  443. package/react/hoc/index.d.ts.map +1 -0
  444. package/react/hoc/index.js +8 -0
  445. package/react/hoc/index.js.map +1 -0
  446. package/react/hoc/mutation-hoc.d.ts +7 -0
  447. package/react/hoc/mutation-hoc.d.ts.map +1 -0
  448. package/react/hoc/mutation-hoc.js +63 -0
  449. package/react/hoc/mutation-hoc.js.map +1 -0
  450. package/react/hoc/package.json +8 -0
  451. package/react/hoc/query-hoc.d.ts +5 -0
  452. package/react/hoc/query-hoc.d.ts.map +1 -0
  453. package/react/hoc/query-hoc.js +70 -0
  454. package/react/hoc/query-hoc.js.map +1 -0
  455. package/react/hoc/subscription-hoc.d.ts +5 -0
  456. package/react/hoc/subscription-hoc.d.ts.map +1 -0
  457. package/react/hoc/subscription-hoc.js +80 -0
  458. package/react/hoc/subscription-hoc.js.map +1 -0
  459. package/react/hoc/types.d.ts +43 -0
  460. package/react/hoc/types.d.ts.map +1 -0
  461. package/react/hoc/types.js +2 -0
  462. package/react/hoc/types.js.map +1 -0
  463. package/react/hoc/withApollo.d.ts +4 -0
  464. package/react/hoc/withApollo.d.ts.map +1 -0
  465. package/react/hoc/withApollo.js +45 -0
  466. package/react/hoc/withApollo.js.map +1 -0
  467. package/react/hooks/compareResults.d.ts +3 -0
  468. package/react/hooks/compareResults.d.ts.map +1 -0
  469. package/react/hooks/compareResults.js +63 -0
  470. package/react/hooks/compareResults.js.map +1 -0
  471. package/react/hooks/hooks.cjs +913 -0
  472. package/react/hooks/hooks.cjs.map +1 -0
  473. package/react/hooks/hooks.cjs.native.js +913 -0
  474. package/react/hooks/index.d.ts +10 -0
  475. package/react/hooks/index.d.ts.map +1 -0
  476. package/react/hooks/index.js +10 -0
  477. package/react/hooks/index.js.map +1 -0
  478. package/react/hooks/internal/index.d.ts +3 -0
  479. package/react/hooks/internal/index.d.ts.map +1 -0
  480. package/react/hooks/internal/index.js +3 -0
  481. package/react/hooks/internal/index.js.map +1 -0
  482. package/react/hooks/internal/useDeepMemo.d.ts +3 -0
  483. package/react/hooks/internal/useDeepMemo.d.ts.map +1 -0
  484. package/react/hooks/internal/useDeepMemo.js +10 -0
  485. package/react/hooks/internal/useDeepMemo.js.map +1 -0
  486. package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts +3 -0
  487. package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +1 -0
  488. package/react/hooks/internal/useIsomorphicLayoutEffect.js +6 -0
  489. package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -0
  490. package/react/hooks/package.json +8 -0
  491. package/react/hooks/useApolloClient.d.ts +3 -0
  492. package/react/hooks/useApolloClient.d.ts.map +1 -0
  493. package/react/hooks/useApolloClient.js +12 -0
  494. package/react/hooks/useApolloClient.js.map +1 -0
  495. package/react/hooks/useFragment.d.ts +13 -0
  496. package/react/hooks/useFragment.d.ts.map +1 -0
  497. package/react/hooks/useFragment.js +39 -0
  498. package/react/hooks/useFragment.js.map +1 -0
  499. package/react/hooks/useLazyQuery.d.ts +6 -0
  500. package/react/hooks/useLazyQuery.d.ts.map +1 -0
  501. package/react/hooks/useLazyQuery.js +71 -0
  502. package/react/hooks/useLazyQuery.js.map +1 -0
  503. package/react/hooks/useMutation.d.ts +6 -0
  504. package/react/hooks/useMutation.d.ts.map +1 -0
  505. package/react/hooks/useMutation.js +100 -0
  506. package/react/hooks/useMutation.js.map +1 -0
  507. package/react/hooks/useQuery.d.ts +41 -0
  508. package/react/hooks/useQuery.d.ts.map +1 -0
  509. package/react/hooks/useQuery.js +302 -0
  510. package/react/hooks/useQuery.js.map +1 -0
  511. package/react/hooks/useReactiveVar.d.ts +3 -0
  512. package/react/hooks/useReactiveVar.d.ts.map +1 -0
  513. package/react/hooks/useReactiveVar.js +16 -0
  514. package/react/hooks/useReactiveVar.js.map +1 -0
  515. package/react/hooks/useSubscription.d.ts +6 -0
  516. package/react/hooks/useSubscription.d.ts.map +1 -0
  517. package/react/hooks/useSubscription.js +141 -0
  518. package/react/hooks/useSubscription.js.map +1 -0
  519. package/react/hooks/useSuspenseCache.d.ts +2 -0
  520. package/react/hooks/useSuspenseCache.d.ts.map +1 -0
  521. package/react/hooks/useSuspenseCache.js +10 -0
  522. package/react/hooks/useSuspenseCache.js.map +1 -0
  523. package/react/hooks/useSuspenseQuery.d.ts +12 -0
  524. package/react/hooks/useSuspenseQuery.d.ts.map +1 -0
  525. package/react/hooks/useSuspenseQuery.js +181 -0
  526. package/react/hooks/useSuspenseQuery.js.map +1 -0
  527. package/react/hooks/useSyncExternalStore.d.ts +4 -0
  528. package/react/hooks/useSyncExternalStore.d.ts.map +1 -0
  529. package/react/hooks/useSyncExternalStore.js +48 -0
  530. package/react/hooks/useSyncExternalStore.js.map +1 -0
  531. package/react/index.d.ts +7 -0
  532. package/react/index.d.ts.map +1 -0
  533. package/react/index.js +7 -0
  534. package/react/index.js.map +1 -0
  535. package/react/package.json +8 -0
  536. package/react/parser/index.d.ts +15 -0
  537. package/react/parser/index.d.ts.map +1 -0
  538. package/react/parser/index.js +94 -0
  539. package/react/parser/index.js.map +1 -0
  540. package/react/parser/package.json +8 -0
  541. package/react/parser/parser.cjs +103 -0
  542. package/react/parser/parser.cjs.map +1 -0
  543. package/react/parser/parser.cjs.native.js +103 -0
  544. package/react/react.cjs +69 -0
  545. package/react/react.cjs.map +1 -0
  546. package/react/react.cjs.native.js +69 -0
  547. package/react/ssr/RenderPromises.d.ts +22 -0
  548. package/react/ssr/RenderPromises.d.ts.map +1 -0
  549. package/react/ssr/RenderPromises.js +90 -0
  550. package/react/ssr/RenderPromises.js.map +1 -0
  551. package/react/ssr/getDataFromTree.d.ts +13 -0
  552. package/react/ssr/getDataFromTree.d.ts.map +1 -0
  553. package/react/ssr/getDataFromTree.js +32 -0
  554. package/react/ssr/getDataFromTree.js.map +1 -0
  555. package/react/ssr/index.d.ts +4 -0
  556. package/react/ssr/index.d.ts.map +1 -0
  557. package/react/ssr/index.js +4 -0
  558. package/react/ssr/index.js.map +1 -0
  559. package/react/ssr/package.json +8 -0
  560. package/react/ssr/renderToStringWithData.d.ts +3 -0
  561. package/react/ssr/renderToStringWithData.d.ts.map +1 -0
  562. package/react/ssr/renderToStringWithData.js +9 -0
  563. package/react/ssr/renderToStringWithData.js.map +1 -0
  564. package/react/ssr/ssr.cjs +151 -0
  565. package/react/ssr/ssr.cjs.map +1 -0
  566. package/react/ssr/ssr.cjs.native.js +151 -0
  567. package/react/types/types.d.ts +130 -0
  568. package/react/types/types.d.ts.map +1 -0
  569. package/react/types/types.js +2 -0
  570. package/react/types/types.js.map +1 -0
  571. package/testing/core/core.cjs +315 -0
  572. package/testing/core/core.cjs.map +1 -0
  573. package/testing/core/core.cjs.native.js +315 -0
  574. package/testing/core/index.d.ts +8 -0
  575. package/testing/core/index.d.ts.map +1 -0
  576. package/testing/core/index.js +8 -0
  577. package/testing/core/index.js.map +1 -0
  578. package/testing/core/itAsync.d.ts +6 -0
  579. package/testing/core/itAsync.d.ts.map +1 -0
  580. package/testing/core/itAsync.js +19 -0
  581. package/testing/core/itAsync.js.map +1 -0
  582. package/testing/core/mocking/mockClient.d.ts +5 -0
  583. package/testing/core/mocking/mockClient.d.ts.map +1 -0
  584. package/testing/core/mocking/mockClient.js +14 -0
  585. package/testing/core/mocking/mockClient.js.map +1 -0
  586. package/testing/core/mocking/mockFetch.d.ts +24 -0
  587. package/testing/core/mocking/mockFetch.d.ts.map +1 -0
  588. package/testing/core/mocking/mockFetch.js +83 -0
  589. package/testing/core/mocking/mockFetch.js.map +1 -0
  590. package/testing/core/mocking/mockLink.d.ts +28 -0
  591. package/testing/core/mocking/mockLink.d.ts.map +1 -0
  592. package/testing/core/mocking/mockLink.js +139 -0
  593. package/testing/core/mocking/mockLink.js.map +1 -0
  594. package/testing/core/mocking/mockQueryManager.d.ts +5 -0
  595. package/testing/core/mocking/mockQueryManager.d.ts.map +1 -0
  596. package/testing/core/mocking/mockQueryManager.js +14 -0
  597. package/testing/core/mocking/mockQueryManager.js.map +1 -0
  598. package/testing/core/mocking/mockSubscriptionLink.d.ts +24 -0
  599. package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -0
  600. package/testing/core/mocking/mockSubscriptionLink.js +62 -0
  601. package/testing/core/mocking/mockSubscriptionLink.js.map +1 -0
  602. package/testing/core/mocking/mockWatchQuery.d.ts +5 -0
  603. package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -0
  604. package/testing/core/mocking/mockWatchQuery.js +15 -0
  605. package/testing/core/mocking/mockWatchQuery.js.map +1 -0
  606. package/testing/core/observableToPromise.d.ts +15 -0
  607. package/testing/core/observableToPromise.d.ts.map +1 -0
  608. package/testing/core/observableToPromise.js +65 -0
  609. package/testing/core/observableToPromise.js.map +1 -0
  610. package/testing/core/package.json +8 -0
  611. package/testing/core/subscribeAndCount.d.ts +3 -0
  612. package/testing/core/subscribeAndCount.d.ts.map +1 -0
  613. package/testing/core/subscribeAndCount.js +16 -0
  614. package/testing/core/subscribeAndCount.js.map +1 -0
  615. package/testing/core/wait.d.ts +3 -0
  616. package/testing/core/wait.d.ts.map +1 -0
  617. package/testing/core/wait.js +16 -0
  618. package/testing/core/wait.js.map +1 -0
  619. package/testing/core/withConsoleSpy.d.ts +4 -0
  620. package/testing/core/withConsoleSpy.d.ts.map +1 -0
  621. package/testing/core/withConsoleSpy.js +39 -0
  622. package/testing/core/withConsoleSpy.js.map +1 -0
  623. package/testing/core/wrap.d.ts +4 -0
  624. package/testing/core/wrap.d.ts.map +1 -0
  625. package/testing/core/wrap.js +26 -0
  626. package/testing/core/wrap.js.map +1 -0
  627. package/testing/index.d.ts +4 -0
  628. package/testing/index.d.ts.map +1 -0
  629. package/testing/index.js +4 -0
  630. package/testing/index.js.map +1 -0
  631. package/testing/package.json +8 -0
  632. package/testing/react/MockedProvider.d.ts +30 -0
  633. package/testing/react/MockedProvider.d.ts.map +1 -0
  634. package/testing/react/MockedProvider.js +39 -0
  635. package/testing/react/MockedProvider.js.map +1 -0
  636. package/testing/testing.cjs +109 -0
  637. package/testing/testing.cjs.map +1 -0
  638. package/testing/testing.cjs.native.js +109 -0
  639. package/utilities/common/arrays.d.ts +2 -0
  640. package/utilities/common/arrays.d.ts.map +1 -0
  641. package/utilities/common/arrays.js +4 -0
  642. package/utilities/common/arrays.js.map +1 -0
  643. package/utilities/common/canUse.d.ts +7 -0
  644. package/utilities/common/canUse.d.ts.map +1 -0
  645. package/utilities/common/canUse.js +11 -0
  646. package/utilities/common/canUse.js.map +1 -0
  647. package/utilities/common/cloneDeep.d.ts +2 -0
  648. package/utilities/common/cloneDeep.d.ts.map +1 -0
  649. package/utilities/common/cloneDeep.js +33 -0
  650. package/utilities/common/cloneDeep.js.map +1 -0
  651. package/utilities/common/compact.d.ts +3 -0
  652. package/utilities/common/compact.d.ts.map +1 -0
  653. package/utilities/common/compact.js +19 -0
  654. package/utilities/common/compact.js.map +1 -0
  655. package/utilities/common/errorHandling.d.ts +4 -0
  656. package/utilities/common/errorHandling.d.ts.map +1 -0
  657. package/utilities/common/errorHandling.js +21 -0
  658. package/utilities/common/errorHandling.js.map +1 -0
  659. package/utilities/common/filterInPlace.d.ts +2 -0
  660. package/utilities/common/filterInPlace.d.ts.map +1 -0
  661. package/utilities/common/filterInPlace.js +11 -0
  662. package/utilities/common/filterInPlace.js.map +1 -0
  663. package/utilities/common/incrementalResult.d.ts +6 -0
  664. package/utilities/common/incrementalResult.d.ts.map +1 -0
  665. package/utilities/common/incrementalResult.js +32 -0
  666. package/utilities/common/incrementalResult.js.map +1 -0
  667. package/utilities/common/makeUniqueId.d.ts +2 -0
  668. package/utilities/common/makeUniqueId.d.ts.map +1 -0
  669. package/utilities/common/makeUniqueId.js +7 -0
  670. package/utilities/common/makeUniqueId.js.map +1 -0
  671. package/utilities/common/maybeDeepFreeze.d.ts +2 -0
  672. package/utilities/common/maybeDeepFreeze.d.ts.map +1 -0
  673. package/utilities/common/maybeDeepFreeze.js +34 -0
  674. package/utilities/common/maybeDeepFreeze.js.map +1 -0
  675. package/utilities/common/mergeDeep.d.ts +14 -0
  676. package/utilities/common/mergeDeep.d.ts.map +1 -0
  677. package/utilities/common/mergeDeep.js +76 -0
  678. package/utilities/common/mergeDeep.js.map +1 -0
  679. package/utilities/common/mergeOptions.d.ts +5 -0
  680. package/utilities/common/mergeOptions.d.ts.map +1 -0
  681. package/utilities/common/mergeOptions.js +8 -0
  682. package/utilities/common/mergeOptions.js.map +1 -0
  683. package/utilities/common/objects.d.ts +2 -0
  684. package/utilities/common/objects.d.ts.map +1 -0
  685. package/utilities/common/objects.js +4 -0
  686. package/utilities/common/objects.js.map +1 -0
  687. package/utilities/common/responseIterator.d.ts +10 -0
  688. package/utilities/common/responseIterator.d.ts.map +1 -0
  689. package/utilities/common/responseIterator.js +21 -0
  690. package/utilities/common/responseIterator.js.map +1 -0
  691. package/utilities/common/stringifyForDisplay.d.ts +2 -0
  692. package/utilities/common/stringifyForDisplay.d.ts.map +1 -0
  693. package/utilities/common/stringifyForDisplay.js +8 -0
  694. package/utilities/common/stringifyForDisplay.js.map +1 -0
  695. package/utilities/globals/DEV.d.ts +3 -0
  696. package/utilities/globals/DEV.d.ts.map +1 -0
  697. package/utilities/globals/DEV.js +9 -0
  698. package/utilities/globals/DEV.js.map +1 -0
  699. package/utilities/globals/fix-graphql.d.ts +2 -0
  700. package/utilities/globals/fix-graphql.d.ts.map +1 -0
  701. package/utilities/globals/fix-graphql.js +6 -0
  702. package/utilities/globals/fix-graphql.js.map +1 -0
  703. package/utilities/globals/global.d.ts +5 -0
  704. package/utilities/globals/global.d.ts.map +1 -0
  705. package/utilities/globals/global.js +6 -0
  706. package/utilities/globals/global.js.map +1 -0
  707. package/utilities/globals/globals.cjs +42 -0
  708. package/utilities/globals/globals.cjs.map +1 -0
  709. package/utilities/globals/globals.cjs.native.js +42 -0
  710. package/utilities/globals/index.d.ts +8 -0
  711. package/utilities/globals/index.d.ts.map +1 -0
  712. package/utilities/globals/index.js +10 -0
  713. package/utilities/globals/index.js.map +1 -0
  714. package/utilities/globals/maybe.d.ts +2 -0
  715. package/utilities/globals/maybe.d.ts.map +1 -0
  716. package/utilities/globals/maybe.js +7 -0
  717. package/utilities/globals/maybe.js.map +1 -0
  718. package/utilities/globals/package.json +8 -0
  719. package/utilities/graphql/directives.d.ts +18 -0
  720. package/utilities/graphql/directives.d.ts.map +1 -0
  721. package/utilities/graphql/directives.js +72 -0
  722. package/utilities/graphql/directives.js.map +1 -0
  723. package/utilities/graphql/fragments.d.ts +9 -0
  724. package/utilities/graphql/fragments.d.ts.map +1 -0
  725. package/utilities/graphql/fragments.js +64 -0
  726. package/utilities/graphql/fragments.js.map +1 -0
  727. package/utilities/graphql/getFromAST.d.ts +10 -0
  728. package/utilities/graphql/getFromAST.d.ts.map +1 -0
  729. package/utilities/graphql/getFromAST.js +76 -0
  730. package/utilities/graphql/getFromAST.js.map +1 -0
  731. package/utilities/graphql/storeUtils.d.ts +32 -0
  732. package/utilities/graphql/storeUtils.d.ts.map +1 -0
  733. package/utilities/graphql/storeUtils.js +208 -0
  734. package/utilities/graphql/storeUtils.js.map +1 -0
  735. package/utilities/graphql/transform.d.ts +27 -0
  736. package/utilities/graphql/transform.d.ts.map +1 -0
  737. package/utilities/graphql/transform.js +281 -0
  738. package/utilities/graphql/transform.js.map +1 -0
  739. package/utilities/index.d.ts +27 -0
  740. package/utilities/index.d.ts.map +1 -0
  741. package/utilities/index.js +27 -0
  742. package/utilities/index.js.map +1 -0
  743. package/utilities/observables/Concast.d.ts +27 -0
  744. package/utilities/observables/Concast.d.ts.map +1 -0
  745. package/utilities/observables/Concast.js +137 -0
  746. package/utilities/observables/Concast.js.map +1 -0
  747. package/utilities/observables/Observable.d.ts +5 -0
  748. package/utilities/observables/Observable.d.ts.map +1 -0
  749. package/utilities/observables/Observable.js +9 -0
  750. package/utilities/observables/Observable.js.map +1 -0
  751. package/utilities/observables/asyncMap.d.ts +3 -0
  752. package/utilities/observables/asyncMap.d.ts.map +1 -0
  753. package/utilities/observables/asyncMap.js +49 -0
  754. package/utilities/observables/asyncMap.js.map +1 -0
  755. package/utilities/observables/iteration.d.ts +3 -0
  756. package/utilities/observables/iteration.d.ts.map +1 -0
  757. package/utilities/observables/iteration.js +6 -0
  758. package/utilities/observables/iteration.js.map +1 -0
  759. package/utilities/observables/subclassing.d.ts +3 -0
  760. package/utilities/observables/subclassing.d.ts.map +1 -0
  761. package/utilities/observables/subclassing.js +13 -0
  762. package/utilities/observables/subclassing.js.map +1 -0
  763. package/utilities/package.json +8 -0
  764. package/utilities/policies/pagination.d.ts +28 -0
  765. package/utilities/policies/pagination.d.ts.map +1 -0
  766. package/utilities/policies/pagination.js +151 -0
  767. package/utilities/policies/pagination.js.map +1 -0
  768. package/utilities/types/IsStrictlyAny.d.ts +5 -0
  769. package/utilities/types/IsStrictlyAny.d.ts.map +1 -0
  770. package/utilities/types/IsStrictlyAny.js +2 -0
  771. package/utilities/types/IsStrictlyAny.js.map +1 -0
  772. package/utilities/utilities.cjs +1371 -0
  773. package/utilities/utilities.cjs.map +1 -0
  774. package/utilities/utilities.cjs.native.js +1371 -0
  775. package/version.d.ts +2 -0
  776. package/version.d.ts.map +1 -0
  777. package/version.js +2 -0
  778. package/version.js.map +1 -0
@@ -0,0 +1,325 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var globals = require('../../utilities/globals');
6
+ var parser = require('../parser');
7
+ var tslib = require('tslib');
8
+ var React = require('react');
9
+ var hoistNonReactStatics = require('hoist-non-react-statics');
10
+ var components = require('../components');
11
+ var context = require('../context');
12
+
13
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
14
+
15
+ function _interopNamespace(e) {
16
+ if (e && e.__esModule) return e;
17
+ var n = Object.create(null);
18
+ if (e) {
19
+ for (var k in e) {
20
+ n[k] = e[k];
21
+ }
22
+ }
23
+ n["default"] = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
+ var hoistNonReactStatics__default = /*#__PURE__*/_interopDefaultLegacy(hoistNonReactStatics);
29
+
30
+ var defaultMapPropsToOptions = function () { return ({}); };
31
+ var defaultMapPropsToSkip = function () { return false; };
32
+ function getDisplayName$1(WrappedComponent) {
33
+ return WrappedComponent.displayName || WrappedComponent.name || 'Component';
34
+ }
35
+ function calculateVariablesFromProps(operation, props) {
36
+ var variables = {};
37
+ for (var _i = 0, _a = operation.variables; _i < _a.length; _i++) {
38
+ var _b = _a[_i], variable = _b.variable, type = _b.type;
39
+ if (!variable.name || !variable.name.value)
40
+ continue;
41
+ var variableName = variable.name.value;
42
+ var variableProp = props[variableName];
43
+ if (typeof variableProp !== 'undefined') {
44
+ variables[variableName] = variableProp;
45
+ continue;
46
+ }
47
+ if (type.kind !== 'NonNullType') {
48
+ variables[variableName] = undefined;
49
+ }
50
+ }
51
+ return variables;
52
+ }
53
+ var GraphQLBase = (function (_super) {
54
+ tslib.__extends(GraphQLBase, _super);
55
+ function GraphQLBase(props) {
56
+ var _this = _super.call(this, props) || this;
57
+ _this.withRef = false;
58
+ _this.setWrappedInstance = _this.setWrappedInstance.bind(_this);
59
+ return _this;
60
+ }
61
+ GraphQLBase.prototype.getWrappedInstance = function () {
62
+ globals.__DEV__ ? globals.invariant(this.withRef, "To access the wrapped instance, you need to specify " +
63
+ "{ withRef: true } in the options") : globals.invariant(this.withRef, 30);
64
+ return this.wrappedInstance;
65
+ };
66
+ GraphQLBase.prototype.setWrappedInstance = function (ref) {
67
+ this.wrappedInstance = ref;
68
+ };
69
+ return GraphQLBase;
70
+ }(React__namespace.Component));
71
+
72
+ function withQuery(document, operationOptions) {
73
+ if (operationOptions === void 0) { operationOptions = {}; }
74
+ var operation = parser.parser(document);
75
+ var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? 'Apollo' : _c;
76
+ var mapPropsToOptions = options;
77
+ if (typeof mapPropsToOptions !== 'function') {
78
+ mapPropsToOptions = function () { return options; };
79
+ }
80
+ var mapPropsToSkip = skip;
81
+ if (typeof mapPropsToSkip !== 'function') {
82
+ mapPropsToSkip = function () { return skip; };
83
+ }
84
+ var lastResultProps;
85
+ return function (WrappedComponent) {
86
+ var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName$1(WrappedComponent), ")");
87
+ var GraphQL = (function (_super) {
88
+ tslib.__extends(GraphQL, _super);
89
+ function GraphQL() {
90
+ return _super !== null && _super.apply(this, arguments) || this;
91
+ }
92
+ GraphQL.prototype.render = function () {
93
+ var _this = this;
94
+ var props = this.props;
95
+ var shouldSkip = mapPropsToSkip(props);
96
+ var opts = shouldSkip
97
+ ? Object.create(null)
98
+ : tslib.__assign({}, mapPropsToOptions(props));
99
+ if (!shouldSkip && !opts.variables && operation.variables.length > 0) {
100
+ opts.variables = calculateVariablesFromProps(operation, props);
101
+ }
102
+ return (React__namespace.createElement(components.Query, tslib.__assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, query: document }), function (_a) {
103
+ var _b, _c;
104
+ _a.client; var data = _a.data, r = tslib.__rest(_a, ["client", "data"]);
105
+ if (operationOptions.withRef) {
106
+ _this.withRef = true;
107
+ props = Object.assign({}, props, {
108
+ ref: _this.setWrappedInstance
109
+ });
110
+ }
111
+ if (shouldSkip) {
112
+ return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, {})));
113
+ }
114
+ var result = Object.assign(r, data || {});
115
+ var name = operationOptions.name || 'data';
116
+ var childProps = (_b = {}, _b[name] = result, _b);
117
+ if (operationOptions.props) {
118
+ var newResult = (_c = {},
119
+ _c[name] = result,
120
+ _c.ownProps = props,
121
+ _c);
122
+ lastResultProps = operationOptions.props(newResult, lastResultProps);
123
+ childProps = lastResultProps;
124
+ }
125
+ return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, childProps)));
126
+ }));
127
+ };
128
+ GraphQL.displayName = graphQLDisplayName;
129
+ GraphQL.WrappedComponent = WrappedComponent;
130
+ return GraphQL;
131
+ }(GraphQLBase));
132
+ return hoistNonReactStatics__default(GraphQL, WrappedComponent, {});
133
+ };
134
+ }
135
+
136
+ function withMutation(document, operationOptions) {
137
+ if (operationOptions === void 0) { operationOptions = {}; }
138
+ var operation = parser.parser(document);
139
+ var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.alias, alias = _b === void 0 ? 'Apollo' : _b;
140
+ var mapPropsToOptions = options;
141
+ if (typeof mapPropsToOptions !== 'function')
142
+ mapPropsToOptions = function () { return options; };
143
+ return function (WrappedComponent) {
144
+ var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName$1(WrappedComponent), ")");
145
+ var GraphQL = (function (_super) {
146
+ tslib.__extends(GraphQL, _super);
147
+ function GraphQL() {
148
+ return _super !== null && _super.apply(this, arguments) || this;
149
+ }
150
+ GraphQL.prototype.render = function () {
151
+ var props = this.props;
152
+ var opts = mapPropsToOptions(props);
153
+ if (operationOptions.withRef) {
154
+ this.withRef = true;
155
+ props = Object.assign({}, props, {
156
+ ref: this.setWrappedInstance
157
+ });
158
+ }
159
+ if (!opts.variables && operation.variables.length > 0) {
160
+ opts.variables = calculateVariablesFromProps(operation, props);
161
+ }
162
+ return (React__namespace.createElement(components.Mutation, tslib.__assign({ ignoreResults: true }, opts, { mutation: document }), function (mutate, _a) {
163
+ var _b, _c;
164
+ var data = _a.data, r = tslib.__rest(_a, ["data"]);
165
+ var result = Object.assign(r, data || {});
166
+ var name = operationOptions.name || 'mutate';
167
+ var resultName = operationOptions.name
168
+ ? "".concat(name, "Result")
169
+ : 'result';
170
+ var childProps = (_b = {},
171
+ _b[name] = mutate,
172
+ _b[resultName] = result,
173
+ _b);
174
+ if (operationOptions.props) {
175
+ var newResult = (_c = {},
176
+ _c[name] = mutate,
177
+ _c[resultName] = result,
178
+ _c.ownProps = props,
179
+ _c);
180
+ childProps = operationOptions.props(newResult);
181
+ }
182
+ return React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, childProps));
183
+ }));
184
+ };
185
+ GraphQL.displayName = graphQLDisplayName;
186
+ GraphQL.WrappedComponent = WrappedComponent;
187
+ return GraphQL;
188
+ }(GraphQLBase));
189
+ return hoistNonReactStatics__default(GraphQL, WrappedComponent, {});
190
+ };
191
+ }
192
+
193
+ function withSubscription(document, operationOptions) {
194
+ if (operationOptions === void 0) { operationOptions = {}; }
195
+ var operation = parser.parser(document);
196
+ var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? 'Apollo' : _c, shouldResubscribe = operationOptions.shouldResubscribe;
197
+ var mapPropsToOptions = options;
198
+ if (typeof mapPropsToOptions !== 'function')
199
+ mapPropsToOptions = function () { return options; };
200
+ var mapPropsToSkip = skip;
201
+ if (typeof mapPropsToSkip !== 'function')
202
+ mapPropsToSkip = function () { return skip; };
203
+ var lastResultProps;
204
+ return function (WrappedComponent) {
205
+ var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName$1(WrappedComponent), ")");
206
+ var GraphQL = (function (_super) {
207
+ tslib.__extends(GraphQL, _super);
208
+ function GraphQL(props) {
209
+ var _this = _super.call(this, props) || this;
210
+ _this.state = { resubscribe: false };
211
+ return _this;
212
+ }
213
+ GraphQL.prototype.updateResubscribe = function (resubscribe) {
214
+ this.setState({ resubscribe: resubscribe });
215
+ };
216
+ GraphQL.prototype.componentDidUpdate = function (prevProps) {
217
+ var resubscribe = !!(shouldResubscribe &&
218
+ shouldResubscribe(prevProps, this.props));
219
+ if (this.state.resubscribe !== resubscribe) {
220
+ this.updateResubscribe(resubscribe);
221
+ }
222
+ };
223
+ GraphQL.prototype.render = function () {
224
+ var _this = this;
225
+ var props = this.props;
226
+ var shouldSkip = mapPropsToSkip(props);
227
+ var opts = shouldSkip
228
+ ? Object.create(null)
229
+ : mapPropsToOptions(props);
230
+ if (!shouldSkip && !opts.variables && operation.variables.length > 0) {
231
+ opts.variables = calculateVariablesFromProps(operation, props);
232
+ }
233
+ return (React__namespace.createElement(components.Subscription, tslib.__assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, subscription: document, shouldResubscribe: this.state.resubscribe }), function (_a) {
234
+ var _b, _c;
235
+ var data = _a.data, r = tslib.__rest(_a, ["data"]);
236
+ if (operationOptions.withRef) {
237
+ _this.withRef = true;
238
+ props = Object.assign({}, props, {
239
+ ref: _this.setWrappedInstance
240
+ });
241
+ }
242
+ if (shouldSkip) {
243
+ return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, {})));
244
+ }
245
+ var result = Object.assign(r, data || {});
246
+ var name = operationOptions.name || 'data';
247
+ var childProps = (_b = {}, _b[name] = result, _b);
248
+ if (operationOptions.props) {
249
+ var newResult = (_c = {},
250
+ _c[name] = result,
251
+ _c.ownProps = props,
252
+ _c);
253
+ lastResultProps = operationOptions.props(newResult, lastResultProps);
254
+ childProps = lastResultProps;
255
+ }
256
+ return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, childProps)));
257
+ }));
258
+ };
259
+ GraphQL.displayName = graphQLDisplayName;
260
+ GraphQL.WrappedComponent = WrappedComponent;
261
+ return GraphQL;
262
+ }(GraphQLBase));
263
+ return hoistNonReactStatics__default(GraphQL, WrappedComponent, {});
264
+ };
265
+ }
266
+
267
+ function graphql(document, operationOptions) {
268
+ if (operationOptions === void 0) { operationOptions = {}; }
269
+ switch (parser.parser(document).type) {
270
+ case parser.DocumentType.Mutation:
271
+ return withMutation(document, operationOptions);
272
+ case parser.DocumentType.Subscription:
273
+ return withSubscription(document, operationOptions);
274
+ case parser.DocumentType.Query:
275
+ default:
276
+ return withQuery(document, operationOptions);
277
+ }
278
+ }
279
+
280
+ function getDisplayName(WrappedComponent) {
281
+ return WrappedComponent.displayName || WrappedComponent.name || 'Component';
282
+ }
283
+ function withApollo(WrappedComponent, operationOptions) {
284
+ if (operationOptions === void 0) { operationOptions = {}; }
285
+ var withDisplayName = "withApollo(".concat(getDisplayName(WrappedComponent), ")");
286
+ var WithApollo = (function (_super) {
287
+ tslib.__extends(WithApollo, _super);
288
+ function WithApollo(props) {
289
+ var _this = _super.call(this, props) || this;
290
+ _this.setWrappedInstance = _this.setWrappedInstance.bind(_this);
291
+ return _this;
292
+ }
293
+ WithApollo.prototype.getWrappedInstance = function () {
294
+ globals.__DEV__ ? globals.invariant(operationOptions.withRef, "To access the wrapped instance, you need to specify " +
295
+ "{ withRef: true } in the options") : globals.invariant(operationOptions.withRef, 31);
296
+ return this.wrappedInstance;
297
+ };
298
+ WithApollo.prototype.setWrappedInstance = function (ref) {
299
+ this.wrappedInstance = ref;
300
+ };
301
+ WithApollo.prototype.render = function () {
302
+ var _this = this;
303
+ return (React__namespace.createElement(context.ApolloConsumer, null, function (client) {
304
+ var props = Object.assign({}, _this.props, {
305
+ client: client,
306
+ ref: operationOptions.withRef
307
+ ? _this.setWrappedInstance
308
+ : undefined
309
+ });
310
+ return React__namespace.createElement(WrappedComponent, tslib.__assign({}, props));
311
+ }));
312
+ };
313
+ WithApollo.displayName = withDisplayName;
314
+ WithApollo.WrappedComponent = WrappedComponent;
315
+ return WithApollo;
316
+ }(React__namespace.Component));
317
+ return hoistNonReactStatics__default(WithApollo, WrappedComponent, {});
318
+ }
319
+
320
+ exports.graphql = graphql;
321
+ exports.withApollo = withApollo;
322
+ exports.withMutation = withMutation;
323
+ exports.withQuery = withQuery;
324
+ exports.withSubscription = withSubscription;
325
+ //# sourceMappingURL=hoc.cjs.map
@@ -0,0 +1,8 @@
1
+ import '../../utilities/globals';
2
+ export { graphql } from './graphql';
3
+ export { withQuery } from './query-hoc';
4
+ export { withMutation } from './mutation-hoc';
5
+ export { withSubscription } from './subscription-hoc';
6
+ export { withApollo } from './withApollo';
7
+ export * from './types';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/hoc/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,cAAc,SAAS,CAAC"}
@@ -0,0 +1,8 @@
1
+ import "../../utilities/globals/index.js";
2
+ export { graphql } from "./graphql.js";
3
+ export { withQuery } from "./query-hoc.js";
4
+ export { withMutation } from "./mutation-hoc.js";
5
+ export { withSubscription } from "./subscription-hoc.js";
6
+ export { withApollo } from "./withApollo.js";
7
+ export * from "./types.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/hoc/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,cAAc,SAAS,CAAC","sourcesContent":["import '../../utilities/globals';\n\nexport { graphql } from './graphql';\n\nexport { withQuery } from './query-hoc';\nexport { withMutation } from './mutation-hoc';\nexport { withSubscription } from './subscription-hoc';\nexport { withApollo } from './withApollo';\n\nexport * from './types';\n"]}
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { DocumentNode } from 'graphql';
3
+ import { DefaultContext, OperationVariables } from '../../core/types';
4
+ import { OperationOption, MutateProps } from './types';
5
+ import { ApolloCache } from '../../core';
6
+ export declare function withMutation<TProps extends TGraphQLVariables | {} = {}, TData extends Record<string, any> = {}, TGraphQLVariables extends OperationVariables = {}, TChildProps = MutateProps<TData, TGraphQLVariables>, TContext extends Record<string, any> = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: React.ComponentType<TProps & TChildProps>) => React.ComponentClass<TProps>;
7
+ //# sourceMappingURL=mutation-hoc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutation-hoc.d.ts","sourceRoot":"","sources":["../../../src/react/hoc/mutation-hoc.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIvC,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AActE,OAAO,EAAE,eAAe,EAAe,WAAW,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,wBAAgB,YAAY,CAC1B,MAAM,SAAS,iBAAiB,GAAG,EAAE,GAAG,EAAE,EAC1C,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,EACtC,iBAAiB,SAAS,kBAAkB,GAAG,EAAE,EACjD,WAAW,GAAG,WAAW,CAAC,KAAK,EAAE,iBAAiB,CAAC,EACnD,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,cAAc,EACrD,MAAM,SAAS,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,EAElD,QAAQ,EAAE,YAAY,EACtB,gBAAgB,GAAE,eAAe,CAC/B,MAAM,EACN,KAAK,EACL,iBAAiB,EACjB,WAAW,CACP,sBAgBc,MAAM,aAAa,CAAC,MAAM,GAAG,WAAW,CAAC,KAC1D,MAAM,cAAc,CAAC,MAAM,CAAC,CA6DhC"}
@@ -0,0 +1,63 @@
1
+ import { __assign, __extends, __rest } from "tslib";
2
+ import * as React from 'react';
3
+ import hoistNonReactStatics from 'hoist-non-react-statics';
4
+ import { parser } from "../parser/index.js";
5
+ import { Mutation } from "../components/index.js";
6
+ import { defaultMapPropsToOptions, getDisplayName, calculateVariablesFromProps, GraphQLBase } from "./hoc-utils.js";
7
+ export function withMutation(document, operationOptions) {
8
+ if (operationOptions === void 0) { operationOptions = {}; }
9
+ var operation = parser(document);
10
+ var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.alias, alias = _b === void 0 ? 'Apollo' : _b;
11
+ var mapPropsToOptions = options;
12
+ if (typeof mapPropsToOptions !== 'function')
13
+ mapPropsToOptions = function () { return options; };
14
+ return function (WrappedComponent) {
15
+ var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName(WrappedComponent), ")");
16
+ var GraphQL = (function (_super) {
17
+ __extends(GraphQL, _super);
18
+ function GraphQL() {
19
+ return _super !== null && _super.apply(this, arguments) || this;
20
+ }
21
+ GraphQL.prototype.render = function () {
22
+ var props = this.props;
23
+ var opts = mapPropsToOptions(props);
24
+ if (operationOptions.withRef) {
25
+ this.withRef = true;
26
+ props = Object.assign({}, props, {
27
+ ref: this.setWrappedInstance
28
+ });
29
+ }
30
+ if (!opts.variables && operation.variables.length > 0) {
31
+ opts.variables = calculateVariablesFromProps(operation, props);
32
+ }
33
+ return (React.createElement(Mutation, __assign({ ignoreResults: true }, opts, { mutation: document }), function (mutate, _a) {
34
+ var _b, _c;
35
+ var data = _a.data, r = __rest(_a, ["data"]);
36
+ var result = Object.assign(r, data || {});
37
+ var name = operationOptions.name || 'mutate';
38
+ var resultName = operationOptions.name
39
+ ? "".concat(name, "Result")
40
+ : 'result';
41
+ var childProps = (_b = {},
42
+ _b[name] = mutate,
43
+ _b[resultName] = result,
44
+ _b);
45
+ if (operationOptions.props) {
46
+ var newResult = (_c = {},
47
+ _c[name] = mutate,
48
+ _c[resultName] = result,
49
+ _c.ownProps = props,
50
+ _c);
51
+ childProps = operationOptions.props(newResult);
52
+ }
53
+ return React.createElement(WrappedComponent, __assign({}, props, childProps));
54
+ }));
55
+ };
56
+ GraphQL.displayName = graphQLDisplayName;
57
+ GraphQL.WrappedComponent = WrappedComponent;
58
+ return GraphQL;
59
+ }(GraphQLBase));
60
+ return hoistNonReactStatics(GraphQL, WrappedComponent, {});
61
+ };
62
+ }
63
+ //# sourceMappingURL=mutation-hoc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutation-hoc.js","sourceRoot":"","sources":["../../../src/react/hoc/mutation-hoc.tsx"],"names":[],"mappings":"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","sourcesContent":["import * as React from 'react';\nimport { DocumentNode } from 'graphql';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\n\nimport { parser } from '../parser';\nimport { DefaultContext, OperationVariables } from '../../core/types';\nimport {\n BaseMutationOptions,\n MutationFunction,\n MutationResult\n} from '../types/types';\nimport { Mutation } from '../components';\n\nimport {\n defaultMapPropsToOptions,\n getDisplayName,\n calculateVariablesFromProps,\n GraphQLBase\n} from './hoc-utils';\nimport { OperationOption, OptionProps, MutateProps } from './types';\nimport { ApolloCache } from '../../core';\n\nexport function withMutation<\n TProps extends TGraphQLVariables | {} = {},\n TData extends Record<string, any> = {},\n TGraphQLVariables extends OperationVariables = {},\n TChildProps = MutateProps<TData, TGraphQLVariables>,\n TContext extends Record<string, any> = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n>(\n document: DocumentNode,\n operationOptions: OperationOption<\n TProps,\n TData,\n TGraphQLVariables,\n TChildProps\n > = {}\n) {\n // this is memoized so if coming from `graphql` there is nearly no extra cost\n const operation = parser(document);\n // extract options\n\n const {\n options = defaultMapPropsToOptions,\n alias = 'Apollo'\n } = operationOptions;\n\n let mapPropsToOptions = options as (props: any) => BaseMutationOptions<TData, TGraphQLVariables, TContext, TCache>;\n if (typeof mapPropsToOptions !== 'function')\n mapPropsToOptions = () => options as BaseMutationOptions<TData, TGraphQLVariables, TContext, TCache>;\n\n return (\n WrappedComponent: React.ComponentType<TProps & TChildProps>\n ): React.ComponentClass<TProps> => {\n const graphQLDisplayName = `${alias}(${getDisplayName(WrappedComponent)})`;\n class GraphQL extends GraphQLBase<TProps, TChildProps> {\n static displayName = graphQLDisplayName;\n static WrappedComponent = WrappedComponent;\n render() {\n let props = this.props as TProps;\n const opts = mapPropsToOptions(props) as BaseMutationOptions<TData, TGraphQLVariables, TContext, TCache>;\n\n if (operationOptions.withRef) {\n this.withRef = true;\n props = Object.assign({}, props, {\n ref: this.setWrappedInstance\n });\n }\n if (!opts.variables && operation.variables.length > 0) {\n opts.variables = calculateVariablesFromProps(operation, props) as TGraphQLVariables;\n }\n\n return (\n <Mutation ignoreResults {...opts} mutation={document}>\n {(\n mutate: MutationFunction<TData, TGraphQLVariables>,\n { data, ...r }: MutationResult<TData>\n ) => {\n // the HOC's historically hoisted the data from the execution result\n // up onto the result since it was passed as a nested prop\n // we massage the Mutation component's shape here to replicate that\n // this matches the query HoC\n const result = Object.assign(r, data || {});\n const name = operationOptions.name || 'mutate';\n const resultName = operationOptions.name\n ? `${name}Result`\n : 'result';\n let childProps = ({\n [name]: mutate,\n [resultName]: result\n } as any) as TChildProps;\n if (operationOptions.props) {\n const newResult: OptionProps<\n TProps,\n TData,\n TGraphQLVariables\n > = {\n [name]: mutate,\n [resultName]: result,\n ownProps: props\n };\n childProps = operationOptions.props(newResult) as any;\n }\n\n return <WrappedComponent {...props} {...childProps} />;\n }}\n </Mutation>\n );\n }\n }\n\n // Make sure we preserve any custom statics on the original component.\n return hoistNonReactStatics(GraphQL, WrappedComponent, {});\n };\n}\n"]}
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@apollo/client/react/hoc",
3
+ "type": "module",
4
+ "main": "hoc.cjs",
5
+ "module": "index.js",
6
+ "types": "index.d.ts",
7
+ "sideEffects": false
8
+ }
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import { DocumentNode } from 'graphql';
3
+ import { OperationOption, DataProps } from './types';
4
+ export declare function withQuery<TProps extends TGraphQLVariables | Record<string, any> = Record<string, any>, TData extends object = {}, TGraphQLVariables extends object = {}, TChildProps extends object = DataProps<TData, TGraphQLVariables>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: React.ComponentType<TProps & TChildProps>) => React.ComponentClass<TProps>;
5
+ //# sourceMappingURL=query-hoc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-hoc.d.ts","sourceRoot":"","sources":["../../../src/react/hoc/query-hoc.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAavC,OAAO,EAAE,eAAe,EAAe,SAAS,EAAE,MAAM,SAAS,CAAC;AAElE,wBAAgB,SAAS,CACvB,MAAM,SAAS,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5E,KAAK,SAAS,MAAM,GAAG,EAAE,EACzB,iBAAiB,SAAS,MAAM,GAAG,EAAE,EACrC,WAAW,SAAS,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,iBAAiB,CAAC,EAEhE,QAAQ,EAAE,YAAY,EACtB,gBAAgB,GAAE,eAAe,CAC/B,MAAM,EACN,KAAK,EACL,iBAAiB,EACjB,WAAW,CACP,sBAwBc,MAAM,aAAa,CAAC,MAAM,GAAG,WAAW,CAAC,KAC1D,MAAM,cAAc,CAAC,MAAM,CAAC,CA+EhC"}
@@ -0,0 +1,70 @@
1
+ import { __assign, __extends, __rest } from "tslib";
2
+ import * as React from 'react';
3
+ import hoistNonReactStatics from 'hoist-non-react-statics';
4
+ import { parser } from "../parser/index.js";
5
+ import { Query } from "../components/index.js";
6
+ import { getDisplayName, GraphQLBase, calculateVariablesFromProps, defaultMapPropsToOptions, defaultMapPropsToSkip } from "./hoc-utils.js";
7
+ export function withQuery(document, operationOptions) {
8
+ if (operationOptions === void 0) { operationOptions = {}; }
9
+ var operation = parser(document);
10
+ var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? 'Apollo' : _c;
11
+ var mapPropsToOptions = options;
12
+ if (typeof mapPropsToOptions !== 'function') {
13
+ mapPropsToOptions = function () { return options; };
14
+ }
15
+ var mapPropsToSkip = skip;
16
+ if (typeof mapPropsToSkip !== 'function') {
17
+ mapPropsToSkip = function () { return skip; };
18
+ }
19
+ var lastResultProps;
20
+ return function (WrappedComponent) {
21
+ var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName(WrappedComponent), ")");
22
+ var GraphQL = (function (_super) {
23
+ __extends(GraphQL, _super);
24
+ function GraphQL() {
25
+ return _super !== null && _super.apply(this, arguments) || this;
26
+ }
27
+ GraphQL.prototype.render = function () {
28
+ var _this = this;
29
+ var props = this.props;
30
+ var shouldSkip = mapPropsToSkip(props);
31
+ var opts = shouldSkip
32
+ ? Object.create(null)
33
+ : __assign({}, mapPropsToOptions(props));
34
+ if (!shouldSkip && !opts.variables && operation.variables.length > 0) {
35
+ opts.variables = calculateVariablesFromProps(operation, props);
36
+ }
37
+ return (React.createElement(Query, __assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, query: document }), function (_a) {
38
+ var _b, _c;
39
+ var _ = _a.client, data = _a.data, r = __rest(_a, ["client", "data"]);
40
+ if (operationOptions.withRef) {
41
+ _this.withRef = true;
42
+ props = Object.assign({}, props, {
43
+ ref: _this.setWrappedInstance
44
+ });
45
+ }
46
+ if (shouldSkip) {
47
+ return (React.createElement(WrappedComponent, __assign({}, props, {})));
48
+ }
49
+ var result = Object.assign(r, data || {});
50
+ var name = operationOptions.name || 'data';
51
+ var childProps = (_b = {}, _b[name] = result, _b);
52
+ if (operationOptions.props) {
53
+ var newResult = (_c = {},
54
+ _c[name] = result,
55
+ _c.ownProps = props,
56
+ _c);
57
+ lastResultProps = operationOptions.props(newResult, lastResultProps);
58
+ childProps = lastResultProps;
59
+ }
60
+ return (React.createElement(WrappedComponent, __assign({}, props, childProps)));
61
+ }));
62
+ };
63
+ GraphQL.displayName = graphQLDisplayName;
64
+ GraphQL.WrappedComponent = WrappedComponent;
65
+ return GraphQL;
66
+ }(GraphQLBase));
67
+ return hoistNonReactStatics(GraphQL, WrappedComponent, {});
68
+ };
69
+ }
70
+ //# sourceMappingURL=query-hoc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-hoc.js","sourceRoot":"","sources":["../../../src/react/hoc/query-hoc.tsx"],"names":[],"mappings":"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","sourcesContent":["import * as React from 'react';\nimport { DocumentNode } from 'graphql';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\n\nimport { parser } from '../parser';\nimport { BaseQueryOptions } from '../types/types';\nimport { Query } from '../components';\nimport {\n getDisplayName,\n GraphQLBase,\n calculateVariablesFromProps,\n defaultMapPropsToOptions,\n defaultMapPropsToSkip\n} from './hoc-utils';\nimport { OperationOption, OptionProps, DataProps } from './types';\n\nexport function withQuery<\n TProps extends TGraphQLVariables | Record<string, any> = Record<string, any>,\n TData extends object = {},\n TGraphQLVariables extends object = {},\n TChildProps extends object = DataProps<TData, TGraphQLVariables>\n>(\n document: DocumentNode,\n operationOptions: OperationOption<\n TProps,\n TData,\n TGraphQLVariables,\n TChildProps\n > = {}\n) {\n // this is memoized so if coming from `graphql` there is nearly no extra cost\n const operation = parser(document);\n // extract options\n const {\n options = defaultMapPropsToOptions,\n skip = defaultMapPropsToSkip,\n alias = 'Apollo'\n } = operationOptions;\n\n let mapPropsToOptions = options as (props: any) => BaseQueryOptions;\n if (typeof mapPropsToOptions !== 'function') {\n mapPropsToOptions = () => options as BaseQueryOptions;\n }\n\n let mapPropsToSkip = skip as (props: any) => boolean;\n if (typeof mapPropsToSkip !== 'function') {\n mapPropsToSkip = () => skip as any;\n }\n\n // allow for advanced referential equality checks\n let lastResultProps: TChildProps | void;\n return (\n WrappedComponent: React.ComponentType<TProps & TChildProps>\n ): React.ComponentClass<TProps> => {\n const graphQLDisplayName = `${alias}(${getDisplayName(WrappedComponent)})`;\n class GraphQL extends GraphQLBase<TProps, TChildProps> {\n static displayName = graphQLDisplayName;\n static WrappedComponent = WrappedComponent;\n\n render() {\n let props = this.props;\n const shouldSkip = mapPropsToSkip(props);\n const opts = shouldSkip\n ? Object.create(null)\n : { ...mapPropsToOptions(props) };\n\n if (!shouldSkip && !opts.variables && operation.variables.length > 0) {\n opts.variables = calculateVariablesFromProps(operation, props);\n }\n\n return (\n <Query\n {...opts}\n displayName={graphQLDisplayName}\n skip={shouldSkip}\n query={document}\n >\n {({ client: _, data, ...r }: any) => {\n if (operationOptions.withRef) {\n this.withRef = true;\n props = Object.assign({}, props, {\n ref: this.setWrappedInstance\n });\n }\n\n // if we have skipped, no reason to manage any reshaping\n if (shouldSkip) {\n return (\n <WrappedComponent\n {...(props as TProps)}\n {...({} as TChildProps)}\n />\n );\n }\n\n // the HOC's historically hoisted the data from the execution result\n // up onto the result since it was passed as a nested prop\n // we massage the Query components shape here to replicate that\n const result = Object.assign(r, data || {});\n const name = operationOptions.name || 'data';\n let childProps = { [name]: result };\n if (operationOptions.props) {\n const newResult: OptionProps<\n TProps,\n TData,\n TGraphQLVariables\n > = {\n [name]: result,\n ownProps: props as TProps\n };\n lastResultProps = operationOptions.props(\n newResult,\n lastResultProps\n );\n childProps = lastResultProps;\n }\n\n return (\n <WrappedComponent\n {...(props as TProps)}\n {...(childProps as TChildProps)}\n />\n );\n }}\n </Query>\n );\n }\n }\n\n // Make sure we preserve any custom statics on the original component.\n return hoistNonReactStatics(GraphQL, WrappedComponent, {});\n };\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import { DocumentNode } from 'graphql';
3
+ import { OperationOption, DataProps } from './types';
4
+ export declare function withSubscription<TProps extends TGraphQLVariables | {} = {}, TData extends object = {}, TGraphQLVariables extends object = {}, TChildProps extends object = DataProps<TData, TGraphQLVariables>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: React.ComponentType<TProps & TChildProps>) => React.ComponentClass<TProps>;
5
+ //# sourceMappingURL=subscription-hoc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription-hoc.d.ts","sourceRoot":"","sources":["../../../src/react/hoc/subscription-hoc.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAavC,OAAO,EAAE,eAAe,EAAe,SAAS,EAAE,MAAM,SAAS,CAAC;AAElE,wBAAgB,gBAAgB,CAC9B,MAAM,SAAS,iBAAiB,GAAG,EAAE,GAAG,EAAE,EAC1C,KAAK,SAAS,MAAM,GAAG,EAAE,EACzB,iBAAiB,SAAS,MAAM,GAAG,EAAE,EACrC,WAAW,SAAS,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,iBAAiB,CAAC,EAEhE,QAAQ,EAAE,YAAY,EACtB,gBAAgB,GAAE,eAAe,CAC/B,MAAM,EACN,KAAK,EACL,iBAAiB,EACjB,WAAW,CACP,sBAsBc,MAAM,aAAa,CAAC,MAAM,GAAG,WAAW,CAAC,KAC1D,MAAM,cAAc,CAAC,MAAM,CAAC,CAoGhC"}
@@ -0,0 +1,80 @@
1
+ import { __assign, __extends, __rest } from "tslib";
2
+ import * as React from 'react';
3
+ import hoistNonReactStatics from 'hoist-non-react-statics';
4
+ import { parser } from "../parser/index.js";
5
+ import { Subscription } from "../components/index.js";
6
+ import { getDisplayName, GraphQLBase, calculateVariablesFromProps, defaultMapPropsToOptions, defaultMapPropsToSkip } from "./hoc-utils.js";
7
+ export function withSubscription(document, operationOptions) {
8
+ if (operationOptions === void 0) { operationOptions = {}; }
9
+ var operation = parser(document);
10
+ var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? 'Apollo' : _c, shouldResubscribe = operationOptions.shouldResubscribe;
11
+ var mapPropsToOptions = options;
12
+ if (typeof mapPropsToOptions !== 'function')
13
+ mapPropsToOptions = function () { return options; };
14
+ var mapPropsToSkip = skip;
15
+ if (typeof mapPropsToSkip !== 'function')
16
+ mapPropsToSkip = function () { return skip; };
17
+ var lastResultProps;
18
+ return function (WrappedComponent) {
19
+ var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName(WrappedComponent), ")");
20
+ var GraphQL = (function (_super) {
21
+ __extends(GraphQL, _super);
22
+ function GraphQL(props) {
23
+ var _this = _super.call(this, props) || this;
24
+ _this.state = { resubscribe: false };
25
+ return _this;
26
+ }
27
+ GraphQL.prototype.updateResubscribe = function (resubscribe) {
28
+ this.setState({ resubscribe: resubscribe });
29
+ };
30
+ GraphQL.prototype.componentDidUpdate = function (prevProps) {
31
+ var resubscribe = !!(shouldResubscribe &&
32
+ shouldResubscribe(prevProps, this.props));
33
+ if (this.state.resubscribe !== resubscribe) {
34
+ this.updateResubscribe(resubscribe);
35
+ }
36
+ };
37
+ GraphQL.prototype.render = function () {
38
+ var _this = this;
39
+ var props = this.props;
40
+ var shouldSkip = mapPropsToSkip(props);
41
+ var opts = shouldSkip
42
+ ? Object.create(null)
43
+ : mapPropsToOptions(props);
44
+ if (!shouldSkip && !opts.variables && operation.variables.length > 0) {
45
+ opts.variables = calculateVariablesFromProps(operation, props);
46
+ }
47
+ return (React.createElement(Subscription, __assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, subscription: document, shouldResubscribe: this.state.resubscribe }), function (_a) {
48
+ var _b, _c;
49
+ var data = _a.data, r = __rest(_a, ["data"]);
50
+ if (operationOptions.withRef) {
51
+ _this.withRef = true;
52
+ props = Object.assign({}, props, {
53
+ ref: _this.setWrappedInstance
54
+ });
55
+ }
56
+ if (shouldSkip) {
57
+ return (React.createElement(WrappedComponent, __assign({}, props, {})));
58
+ }
59
+ var result = Object.assign(r, data || {});
60
+ var name = operationOptions.name || 'data';
61
+ var childProps = (_b = {}, _b[name] = result, _b);
62
+ if (operationOptions.props) {
63
+ var newResult = (_c = {},
64
+ _c[name] = result,
65
+ _c.ownProps = props,
66
+ _c);
67
+ lastResultProps = operationOptions.props(newResult, lastResultProps);
68
+ childProps = lastResultProps;
69
+ }
70
+ return (React.createElement(WrappedComponent, __assign({}, props, childProps)));
71
+ }));
72
+ };
73
+ GraphQL.displayName = graphQLDisplayName;
74
+ GraphQL.WrappedComponent = WrappedComponent;
75
+ return GraphQL;
76
+ }(GraphQLBase));
77
+ return hoistNonReactStatics(GraphQL, WrappedComponent, {});
78
+ };
79
+ }
80
+ //# sourceMappingURL=subscription-hoc.js.map