@apollo/client 3.4.8 → 3.4.12

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 (240) hide show
  1. package/README.md +2 -2
  2. package/apollo-client.cjs.js +92 -107
  3. package/apollo-client.cjs.js.map +1 -1
  4. package/apollo-client.cjs.min.js +1 -0
  5. package/cache/cache.cjs.js +20 -22
  6. package/cache/cache.cjs.js.map +1 -1
  7. package/cache/index.d.ts +1 -0
  8. package/cache/index.d.ts.map +1 -1
  9. package/cache/index.js +1 -3
  10. package/cache/index.js.map +1 -1
  11. package/cache/inmemory/entityStore.js +2 -2
  12. package/cache/inmemory/entityStore.js.map +1 -1
  13. package/cache/inmemory/object-canon.d.ts +1 -0
  14. package/cache/inmemory/object-canon.d.ts.map +1 -1
  15. package/cache/inmemory/object-canon.js +1 -0
  16. package/cache/inmemory/object-canon.js.map +1 -1
  17. package/cache/inmemory/policies.d.ts.map +1 -1
  18. package/cache/inmemory/policies.js +4 -4
  19. package/cache/inmemory/policies.js.map +1 -1
  20. package/cache/inmemory/readFromStore.d.ts.map +1 -1
  21. package/cache/inmemory/readFromStore.js +4 -4
  22. package/cache/inmemory/readFromStore.js.map +1 -1
  23. package/cache/inmemory/writeToStore.d.ts.map +1 -1
  24. package/cache/inmemory/writeToStore.js +2 -2
  25. package/cache/inmemory/writeToStore.js.map +1 -1
  26. package/core/ApolloClient.d.ts.map +1 -1
  27. package/core/ApolloClient.js +3 -3
  28. package/core/ApolloClient.js.map +1 -1
  29. package/core/LocalState.d.ts.map +1 -1
  30. package/core/LocalState.js +2 -2
  31. package/core/LocalState.js.map +1 -1
  32. package/core/ObservableQuery.d.ts.map +1 -1
  33. package/core/ObservableQuery.js +19 -6
  34. package/core/ObservableQuery.js.map +1 -1
  35. package/core/QueryManager.d.ts.map +1 -1
  36. package/core/QueryManager.js +10 -10
  37. package/core/QueryManager.js.map +1 -1
  38. package/core/core.cjs.js +49 -35
  39. package/core/core.cjs.js.map +1 -1
  40. package/core/index.js +1 -1
  41. package/core/index.js.map +1 -1
  42. package/errors/errors.cjs.js +1 -2
  43. package/errors/errors.cjs.js.map +1 -1
  44. package/errors/index.d.ts +1 -0
  45. package/errors/index.d.ts.map +1 -1
  46. package/errors/index.js +1 -3
  47. package/errors/index.js.map +1 -1
  48. package/invariantErrorCodes.js +56 -81
  49. package/link/core/ApolloLink.js +2 -2
  50. package/link/core/ApolloLink.js.map +1 -1
  51. package/link/core/core.cjs.js +4 -6
  52. package/link/core/core.cjs.js.map +1 -1
  53. package/link/core/index.d.ts +1 -0
  54. package/link/core/index.d.ts.map +1 -1
  55. package/link/core/index.js +1 -3
  56. package/link/core/index.js.map +1 -1
  57. package/link/http/checkFetcher.js +2 -2
  58. package/link/http/checkFetcher.js.map +1 -1
  59. package/link/http/createHttpLink.d.ts +1 -0
  60. package/link/http/createHttpLink.d.ts.map +1 -1
  61. package/link/http/createHttpLink.js +1 -0
  62. package/link/http/createHttpLink.js.map +1 -1
  63. package/link/http/http.cjs.js +3 -3
  64. package/link/http/http.cjs.js.map +1 -1
  65. package/link/http/index.d.ts +1 -0
  66. package/link/http/index.d.ts.map +1 -1
  67. package/link/http/index.js +1 -0
  68. package/link/http/index.js.map +1 -1
  69. package/link/http/serializeFetchParameter.d.ts +1 -1
  70. package/link/http/serializeFetchParameter.d.ts.map +1 -1
  71. package/link/http/serializeFetchParameter.js +2 -2
  72. package/link/http/serializeFetchParameter.js.map +1 -1
  73. package/link/persisted-queries/index.d.ts +1 -1
  74. package/link/persisted-queries/index.d.ts.map +1 -1
  75. package/link/persisted-queries/index.js +4 -4
  76. package/link/persisted-queries/index.js.map +1 -1
  77. package/link/persisted-queries/persisted-queries.cjs.js +8 -5
  78. package/link/persisted-queries/persisted-queries.cjs.js.map +1 -1
  79. package/link/utils/index.d.ts +1 -0
  80. package/link/utils/index.d.ts.map +1 -1
  81. package/link/utils/index.js +1 -0
  82. package/link/utils/index.js.map +1 -1
  83. package/link/utils/toPromise.d.ts.map +1 -1
  84. package/link/utils/toPromise.js +1 -1
  85. package/link/utils/toPromise.js.map +1 -1
  86. package/link/utils/utils.cjs.js +3 -3
  87. package/link/utils/utils.cjs.js.map +1 -1
  88. package/link/utils/validateOperation.d.ts.map +1 -1
  89. package/link/utils/validateOperation.js +2 -2
  90. package/link/utils/validateOperation.js.map +1 -1
  91. package/package.json +11 -11
  92. package/react/context/ApolloConsumer.d.ts.map +1 -1
  93. package/react/context/ApolloConsumer.js +2 -2
  94. package/react/context/ApolloConsumer.js.map +1 -1
  95. package/react/context/ApolloContext.d.ts +2 -1
  96. package/react/context/ApolloContext.d.ts.map +1 -1
  97. package/react/context/ApolloContext.js +11 -5
  98. package/react/context/ApolloContext.js.map +1 -1
  99. package/react/context/ApolloProvider.d.ts.map +1 -1
  100. package/react/context/ApolloProvider.js +2 -2
  101. package/react/context/ApolloProvider.js.map +1 -1
  102. package/react/context/context.cjs.js +15 -9
  103. package/react/context/context.cjs.js.map +1 -1
  104. package/react/context/index.d.ts +1 -0
  105. package/react/context/index.d.ts.map +1 -1
  106. package/react/context/index.js +1 -0
  107. package/react/context/index.js.map +1 -1
  108. package/react/data/OperationData.d.ts.map +1 -1
  109. package/react/data/OperationData.js +3 -3
  110. package/react/data/OperationData.js.map +1 -1
  111. package/react/data/QueryData.d.ts.map +1 -1
  112. package/react/data/QueryData.js +1 -3
  113. package/react/data/QueryData.js.map +1 -1
  114. package/react/data/data.cjs.js +6 -8
  115. package/react/data/data.cjs.js.map +1 -1
  116. package/react/data/index.d.ts +1 -0
  117. package/react/data/index.d.ts.map +1 -1
  118. package/react/data/index.js +1 -0
  119. package/react/data/index.js.map +1 -1
  120. package/react/hoc/hoc-utils.d.ts.map +1 -1
  121. package/react/hoc/hoc-utils.js +2 -2
  122. package/react/hoc/hoc-utils.js.map +1 -1
  123. package/react/hoc/hoc.cjs.js +5 -5
  124. package/react/hoc/hoc.cjs.js.map +1 -1
  125. package/react/hoc/index.d.ts +1 -0
  126. package/react/hoc/index.d.ts.map +1 -1
  127. package/react/hoc/index.js +1 -0
  128. package/react/hoc/index.js.map +1 -1
  129. package/react/hoc/withApollo.d.ts.map +1 -1
  130. package/react/hoc/withApollo.js +2 -2
  131. package/react/hoc/withApollo.js.map +1 -1
  132. package/react/hooks/hooks.cjs.js +3 -3
  133. package/react/hooks/hooks.cjs.js.map +1 -1
  134. package/react/hooks/index.d.ts +1 -0
  135. package/react/hooks/index.d.ts.map +1 -1
  136. package/react/hooks/index.js +1 -0
  137. package/react/hooks/index.js.map +1 -1
  138. package/react/hooks/useApolloClient.d.ts.map +1 -1
  139. package/react/hooks/useApolloClient.js +2 -2
  140. package/react/hooks/useApolloClient.js.map +1 -1
  141. package/react/hooks/useSubscription.d.ts +1 -0
  142. package/react/hooks/useSubscription.d.ts.map +1 -1
  143. package/react/hooks/useSubscription.js +1 -0
  144. package/react/hooks/useSubscription.js.map +1 -1
  145. package/react/hooks/utils/useAfterFastRefresh.d.ts +1 -0
  146. package/react/hooks/utils/useAfterFastRefresh.d.ts.map +1 -1
  147. package/react/hooks/utils/useAfterFastRefresh.js +1 -0
  148. package/react/hooks/utils/useAfterFastRefresh.js.map +1 -1
  149. package/react/hooks/utils/useBaseQuery.d.ts +1 -0
  150. package/react/hooks/utils/useBaseQuery.d.ts.map +1 -1
  151. package/react/hooks/utils/useBaseQuery.js +1 -0
  152. package/react/hooks/utils/useBaseQuery.js.map +1 -1
  153. package/react/index.d.ts +1 -0
  154. package/react/index.d.ts.map +1 -1
  155. package/react/index.js +1 -3
  156. package/react/index.js.map +1 -1
  157. package/react/parser/index.d.ts.map +1 -1
  158. package/react/parser/index.js +5 -5
  159. package/react/parser/index.js.map +1 -1
  160. package/react/parser/parser.cjs.js +10 -10
  161. package/react/parser/parser.cjs.js.map +1 -1
  162. package/react/react.cjs.js +2 -3
  163. package/react/react.cjs.js.map +1 -1
  164. package/testing/index.d.ts +1 -0
  165. package/testing/index.d.ts.map +1 -1
  166. package/testing/index.js +1 -3
  167. package/testing/index.js.map +1 -1
  168. package/testing/testing.cjs.js +3 -5
  169. package/testing/testing.cjs.js.map +1 -1
  170. package/utilities/common/canUse.d.ts +1 -0
  171. package/utilities/common/canUse.d.ts.map +1 -1
  172. package/utilities/common/canUse.js +2 -0
  173. package/utilities/common/canUse.js.map +1 -1
  174. package/utilities/common/mergeDeep.js +1 -1
  175. package/utilities/common/mergeDeep.js.map +1 -1
  176. package/utilities/globals/DEV.js +2 -2
  177. package/utilities/globals/DEV.js.map +1 -1
  178. package/utilities/{common → globals}/global.d.ts +0 -0
  179. package/utilities/globals/global.d.ts.map +1 -0
  180. package/utilities/{common → globals}/global.js +0 -0
  181. package/utilities/globals/global.js.map +1 -0
  182. package/utilities/globals/globals.cjs.js +57 -0
  183. package/utilities/globals/globals.cjs.js.map +1 -0
  184. package/utilities/globals/index.d.ts +5 -2
  185. package/utilities/globals/index.d.ts.map +1 -1
  186. package/utilities/globals/index.js +8 -1
  187. package/utilities/globals/index.js.map +1 -1
  188. package/utilities/{common → globals}/maybe.d.ts +0 -0
  189. package/utilities/globals/maybe.d.ts.map +1 -0
  190. package/utilities/{common → globals}/maybe.js +0 -0
  191. package/utilities/globals/maybe.js.map +1 -0
  192. package/utilities/globals/package.json +7 -0
  193. package/utilities/graphql/directives.d.ts.map +1 -1
  194. package/utilities/graphql/directives.js +5 -5
  195. package/utilities/graphql/directives.js.map +1 -1
  196. package/utilities/graphql/fragments.d.ts.map +1 -1
  197. package/utilities/graphql/fragments.js +5 -5
  198. package/utilities/graphql/fragments.js.map +1 -1
  199. package/utilities/graphql/getFromAST.d.ts.map +1 -1
  200. package/utilities/graphql/getFromAST.js +9 -9
  201. package/utilities/graphql/getFromAST.js.map +1 -1
  202. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  203. package/utilities/graphql/storeUtils.js +2 -2
  204. package/utilities/graphql/storeUtils.js.map +1 -1
  205. package/utilities/graphql/transform.d.ts.map +1 -1
  206. package/utilities/graphql/transform.js +2 -2
  207. package/utilities/graphql/transform.js.map +1 -1
  208. package/utilities/index.d.ts +1 -3
  209. package/utilities/index.d.ts.map +1 -1
  210. package/utilities/index.js +1 -5
  211. package/utilities/index.js.map +1 -1
  212. package/utilities/observables/Concast.js +1 -1
  213. package/utilities/observables/Concast.js.map +1 -1
  214. package/utilities/observables/subclassing.d.ts.map +1 -1
  215. package/utilities/observables/subclassing.js +2 -1
  216. package/utilities/observables/subclassing.js.map +1 -1
  217. package/utilities/package.json +1 -3
  218. package/utilities/policies/pagination.d.ts +1 -1
  219. package/utilities/policies/pagination.d.ts.map +1 -1
  220. package/utilities/policies/pagination.js +9 -4
  221. package/utilities/policies/pagination.js.map +1 -1
  222. package/utilities/testing/mocking/mockFetch.js +1 -1
  223. package/utilities/testing/mocking/mockFetch.js.map +1 -1
  224. package/utilities/testing/mocking/mockLink.d.ts.map +1 -1
  225. package/utilities/testing/mocking/mockLink.js +2 -2
  226. package/utilities/testing/mocking/mockLink.js.map +1 -1
  227. package/utilities/testing/mocking/mockWatchQuery.js +1 -1
  228. package/utilities/testing/mocking/mockWatchQuery.js.map +1 -1
  229. package/utilities/testing/observableToPromise.js +1 -1
  230. package/utilities/testing/observableToPromise.js.map +1 -1
  231. package/utilities/utilities.cjs.js +42 -74
  232. package/utilities/utilities.cjs.js.map +1 -1
  233. package/version.js +1 -1
  234. package/apollo-core.cjs.js +0 -5768
  235. package/apollo-core.cjs.js.map +0 -1
  236. package/apollo-core.cjs.min.js +0 -1
  237. package/utilities/common/global.d.ts.map +0 -1
  238. package/utilities/common/global.js.map +0 -1
  239. package/utilities/common/maybe.d.ts.map +0 -1
  240. package/utilities/common/maybe.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"persisted-queries.cjs.js","sources":["index.js"],"sourcesContent":["import { __assign } from \"tslib\";\nimport { print } from 'graphql';\nimport { invariant } from 'ts-invariant';\nimport { ApolloLink } from '../core';\nimport { Observable, compact } from '../../utilities';\nexport var VERSION = 1;\nvar PersistedQueryLink;\n(function (PersistedQueryLink) {\n ;\n ;\n ;\n})(PersistedQueryLink || (PersistedQueryLink = {}));\nvar defaultOptions = {\n disable: function (_a) {\n var graphQLErrors = _a.graphQLErrors, operation = _a.operation;\n if (graphQLErrors &&\n graphQLErrors.some(function (_a) {\n var message = _a.message;\n return message === 'PersistedQueryNotSupported';\n })) {\n return true;\n }\n var response = operation.getContext().response;\n if (response &&\n response.status &&\n (response.status === 400 || response.status === 500)) {\n return true;\n }\n return false;\n },\n useGETForHashedQueries: false,\n};\nfunction operationDefinesMutation(operation) {\n return operation.query.definitions.some(function (d) { return d.kind === 'OperationDefinition' && d.operation === 'mutation'; });\n}\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar hashesByQuery = new WeakMap();\nvar nextHashesChildKey = 0;\nexport var createPersistedQueryLink = function (options) {\n __DEV__ ? invariant(options && (typeof options.sha256 === 'function' ||\n typeof options.generateHash === 'function'), 'Missing/invalid \"sha256\" or \"generateHash\" function. Please ' +\n 'configure one using the \"createPersistedQueryLink(options)\" options ' +\n 'parameter.') : invariant(options && (typeof options.sha256 === 'function' ||\n typeof options.generateHash === 'function'), 27);\n var _a = compact(defaultOptions, options), sha256 = _a.sha256, _b = _a.generateHash, generateHash = _b === void 0 ? function (query) {\n return Promise.resolve(sha256(print(query)));\n } : _b, disable = _a.disable, useGETForHashedQueries = _a.useGETForHashedQueries;\n var supportsPersistedQueries = true;\n var hashesChildKey = 'forLink' + nextHashesChildKey++;\n var getHashPromise = function (query) {\n return new Promise(function (resolve) { return resolve(generateHash(query)); });\n };\n function getQueryHash(query) {\n if (!query || typeof query !== 'object') {\n return getHashPromise(query);\n }\n var hashes = hashesByQuery.get(query);\n if (!hashes)\n hashesByQuery.set(query, hashes = Object.create(null));\n return hasOwnProperty.call(hashes, hashesChildKey)\n ? hashes[hashesChildKey]\n : hashes[hashesChildKey] = getHashPromise(query);\n }\n return new ApolloLink(function (operation, forward) {\n __DEV__ ? invariant(forward, 'PersistedQueryLink cannot be the last link in the chain.') : invariant(forward, 28);\n var query = operation.query;\n return new Observable(function (observer) {\n var subscription;\n var retried = false;\n var originalFetchOptions;\n var setFetchOptions = false;\n var retry = function (_a, cb) {\n var response = _a.response, networkError = _a.networkError;\n if (!retried && ((response && response.errors) || networkError)) {\n retried = true;\n var disablePayload = {\n response: response,\n networkError: networkError,\n operation: operation,\n graphQLErrors: response ? response.errors : undefined,\n };\n supportsPersistedQueries = !disable(disablePayload);\n if ((response &&\n response.errors &&\n response.errors.some(function (_a) {\n var message = _a.message;\n return message === 'PersistedQueryNotFound';\n })) ||\n !supportsPersistedQueries) {\n if (subscription)\n subscription.unsubscribe();\n operation.setContext({\n http: {\n includeQuery: true,\n includeExtensions: supportsPersistedQueries,\n },\n fetchOptions: {\n method: 'POST',\n },\n });\n if (setFetchOptions) {\n operation.setContext({ fetchOptions: originalFetchOptions });\n }\n subscription = forward(operation).subscribe(handler);\n return;\n }\n }\n cb();\n };\n var handler = {\n next: function (response) {\n retry({ response: response }, function () { return observer.next(response); });\n },\n error: function (networkError) {\n retry({ networkError: networkError }, function () { return observer.error(networkError); });\n },\n complete: observer.complete.bind(observer),\n };\n operation.setContext({\n http: {\n includeQuery: !supportsPersistedQueries,\n includeExtensions: supportsPersistedQueries,\n },\n });\n if (useGETForHashedQueries &&\n supportsPersistedQueries &&\n !operationDefinesMutation(operation)) {\n operation.setContext(function (_a) {\n var _b = _a.fetchOptions, fetchOptions = _b === void 0 ? {} : _b;\n originalFetchOptions = fetchOptions;\n return {\n fetchOptions: __assign(__assign({}, fetchOptions), { method: 'GET' }),\n };\n });\n setFetchOptions = true;\n }\n if (supportsPersistedQueries) {\n getQueryHash(query).then(function (sha256Hash) {\n operation.extensions.persistedQuery = {\n version: VERSION,\n sha256Hash: sha256Hash,\n };\n subscription = forward(operation).subscribe(handler);\n }).catch(observer.error.bind(observer));\n ;\n }\n else {\n subscription = forward(operation).subscribe(handler);\n }\n return function () {\n if (subscription)\n subscription.unsubscribe();\n };\n });\n });\n};\n//#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ACnB,gBAAgB,eAAe,GAAG,IAAI,CAAC;AACvC,aAAa;AACb,YAAY,IAAI,wBAAwB,EAAE;AAC1C,gBAAgB,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,UAAU,UAAU,EAAE;AAC/D,oBAAoB,SAAS,CAAC,UAAU,CAAC,cAAc,GAAG;AAC1D,wBAAwB,OAAO,EAAE,OAAO;AACxC,wBAAwB,UAAU,EAAE,UAAU;AAC9C,qBAAqB,CAAC;AACtB,oBAAoB,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACzE,iBAAiB,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AAExD,aAAa;AACb,iBAAiB;AACjB,gBAAgB,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACrE,aAAa;AACb,YAAY,OAAO,YAAY;AAC/B,gBAAgB,IAAI,YAAY;AAChC,oBAAoB,YAAY,CAAC,WAAW,EAAE,CAAC;AAC/C,aAAa,CAAC;AACd,SAAS,CAAC,CAAC;AACX,KAAK,CAAC,CAAC;AACP;;;;;"}
1
+ {"version":3,"file":"persisted-queries.cjs.js","sources":["index.js"],"sourcesContent":["import { __assign } from \"tslib\";\nimport { invariant } from '../../utilities/globals';\nimport { print } from 'graphql';\nimport { ApolloLink } from '../core';\nimport { Observable, compact } from '../../utilities';\nexport var VERSION = 1;\nexport var PersistedQueryLink;\n(function (PersistedQueryLink) {\n ;\n ;\n ;\n})(PersistedQueryLink || (PersistedQueryLink = {}));\nvar defaultOptions = {\n disable: function (_a) {\n var graphQLErrors = _a.graphQLErrors, operation = _a.operation;\n if (graphQLErrors &&\n graphQLErrors.some(function (_a) {\n var message = _a.message;\n return message === 'PersistedQueryNotSupported';\n })) {\n return true;\n }\n var response = operation.getContext().response;\n if (response &&\n response.status &&\n (response.status === 400 || response.status === 500)) {\n return true;\n }\n return false;\n },\n useGETForHashedQueries: false,\n};\nfunction operationDefinesMutation(operation) {\n return operation.query.definitions.some(function (d) { return d.kind === 'OperationDefinition' && d.operation === 'mutation'; });\n}\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar hashesByQuery = new WeakMap();\nvar nextHashesChildKey = 0;\nexport var createPersistedQueryLink = function (options) {\n __DEV__ ? invariant(options && (typeof options.sha256 === 'function' ||\n typeof options.generateHash === 'function'), 'Missing/invalid \"sha256\" or \"generateHash\" function. Please ' +\n 'configure one using the \"createPersistedQueryLink(options)\" options ' +\n 'parameter.') : invariant(options && (typeof options.sha256 === 'function' ||\n typeof options.generateHash === 'function'), 24);\n var _a = compact(defaultOptions, options), sha256 = _a.sha256, _b = _a.generateHash, generateHash = _b === void 0 ? function (query) {\n return Promise.resolve(sha256(print(query)));\n } : _b, disable = _a.disable, useGETForHashedQueries = _a.useGETForHashedQueries;\n var supportsPersistedQueries = true;\n var hashesChildKey = 'forLink' + nextHashesChildKey++;\n var getHashPromise = function (query) {\n return new Promise(function (resolve) { return resolve(generateHash(query)); });\n };\n function getQueryHash(query) {\n if (!query || typeof query !== 'object') {\n return getHashPromise(query);\n }\n var hashes = hashesByQuery.get(query);\n if (!hashes)\n hashesByQuery.set(query, hashes = Object.create(null));\n return hasOwnProperty.call(hashes, hashesChildKey)\n ? hashes[hashesChildKey]\n : hashes[hashesChildKey] = getHashPromise(query);\n }\n return new ApolloLink(function (operation, forward) {\n __DEV__ ? invariant(forward, 'PersistedQueryLink cannot be the last link in the chain.') : invariant(forward, 25);\n var query = operation.query;\n return new Observable(function (observer) {\n var subscription;\n var retried = false;\n var originalFetchOptions;\n var setFetchOptions = false;\n var retry = function (_a, cb) {\n var response = _a.response, networkError = _a.networkError;\n if (!retried && ((response && response.errors) || networkError)) {\n retried = true;\n var disablePayload = {\n response: response,\n networkError: networkError,\n operation: operation,\n graphQLErrors: response ? response.errors : undefined,\n };\n supportsPersistedQueries = !disable(disablePayload);\n if ((response &&\n response.errors &&\n response.errors.some(function (_a) {\n var message = _a.message;\n return message === 'PersistedQueryNotFound';\n })) ||\n !supportsPersistedQueries) {\n if (subscription)\n subscription.unsubscribe();\n operation.setContext({\n http: {\n includeQuery: true,\n includeExtensions: supportsPersistedQueries,\n },\n fetchOptions: {\n method: 'POST',\n },\n });\n if (setFetchOptions) {\n operation.setContext({ fetchOptions: originalFetchOptions });\n }\n subscription = forward(operation).subscribe(handler);\n return;\n }\n }\n cb();\n };\n var handler = {\n next: function (response) {\n retry({ response: response }, function () { return observer.next(response); });\n },\n error: function (networkError) {\n retry({ networkError: networkError }, function () { return observer.error(networkError); });\n },\n complete: observer.complete.bind(observer),\n };\n operation.setContext({\n http: {\n includeQuery: !supportsPersistedQueries,\n includeExtensions: supportsPersistedQueries,\n },\n });\n if (useGETForHashedQueries &&\n supportsPersistedQueries &&\n !operationDefinesMutation(operation)) {\n operation.setContext(function (_a) {\n var _b = _a.fetchOptions, fetchOptions = _b === void 0 ? {} : _b;\n originalFetchOptions = fetchOptions;\n return {\n fetchOptions: __assign(__assign({}, fetchOptions), { method: 'GET' }),\n };\n });\n setFetchOptions = true;\n }\n if (supportsPersistedQueries) {\n getQueryHash(query).then(function (sha256Hash) {\n operation.extensions.persistedQuery = {\n version: VERSION,\n sha256Hash: sha256Hash,\n };\n subscription = forward(operation).subscribe(handler);\n }).catch(observer.error.bind(observer));\n ;\n }\n else {\n subscription = forward(operation).subscribe(handler);\n }\n return function () {\n if (subscription)\n subscription.unsubscribe();\n };\n });\n });\n};\n//# sourceMappingURL=index.js.map"],"names":["PersistedQueryLink","invariant","compact","print","ApolloLink","Observable","__assign"],"mappings":";;;;;;;;;;AAKU,IAAC,OAAO,GAAG,EAAE;AACZA,oCAAmB;AAC9B,CAAC,UAAU,kBAAkB,EAAE;AAI/B,CAAC,EAAEA,0BAAkB,KAAKA,0BAAkB,GAAG,EAAE,CAAC,CAAC,CAAC;AACpD,IAAI,cAAc,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AAC,IAAI,CAAC,UAAU,UAAU,EAAE;AAC/D,oBAAoB,SAAS,CAAC,UAAU,CAAC,cAAc,GAAG;AAC1D,wBAAwB,OAAO,EAAE,OAAO;AACxC,wBAAwB,UAAU,EAAE,UAAU;AAC9C,qBAAqB,CAAC;AACtB,oBAAoB,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACzE,iBAAiB,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AAExD,aAAa;AACb,iBAAiB;AACjB,gBAAgB,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACrE,aAAa;AACb,YAAY,OAAO,YAAY;AAC/B,gBAAgB,IAAI,YAAY;AAChC,oBAAoB,YAAY,CAAC,WAAW,EAAE,CAAC;AAC/C,aAAa,CAAC;AACd,SAAS,CAAC,CAAC;AACX,KAAK,CAAC,CAAC;AACP;;;;;"}
@@ -1,3 +1,4 @@
1
+ import '../../utilities/globals';
1
2
  export { fromError } from './fromError';
2
3
  export { toPromise } from './toPromise';
3
4
  export { fromPromise } from './fromPromise';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/link/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/link/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import "../../utilities/globals/index.js";
1
2
  export { fromError } from "./fromError.js";
2
3
  export { toPromise } from "./toPromise.js";
3
4
  export { fromPromise } from "./fromPromise.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAe,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export { fromError } from './fromError';\nexport { toPromise } from './toPromise';\nexport { fromPromise } from './fromPromise';\nexport { ServerError, throwServerError } from './throwServerError';\nexport { validateOperation } from './validateOperation';\nexport { createOperation } from './createOperation';\nexport { transformOperation } from './transformOperation';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAe,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["import '../../utilities/globals';\n\nexport { fromError } from './fromError';\nexport { toPromise } from './toPromise';\nexport { fromPromise } from './fromPromise';\nexport { ServerError, throwServerError } from './throwServerError';\nexport { validateOperation } from './validateOperation';\nexport { createOperation } from './createOperation';\nexport { transformOperation } from './transformOperation';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"toPromise.d.ts","sourceRoot":"","sources":["../../../src/link/utils/toPromise.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAiBlE"}
1
+ {"version":3,"file":"toPromise.d.ts","sourceRoot":"","sources":["../../../src/link/utils/toPromise.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAiBlE"}
@@ -1,4 +1,4 @@
1
- import { invariant } from 'ts-invariant';
1
+ import { invariant } from "../../utilities/globals/index.js";
2
2
  export function toPromise(observable) {
3
3
  var completed = false;
4
4
  return new Promise(function (resolve, reject) {
@@ -1 +1 @@
1
- {"version":3,"file":"toPromise.js","sourceRoot":"","sources":["../../../src/link/utils/toPromise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,MAAM,UAAU,SAAS,CAAI,UAAyB;IACpD,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,OAAO,IAAI,OAAO,CAAI,UAAC,OAAO,EAAE,MAAM;QACpC,UAAU,CAAC,SAAS,CAAC;YACnB,IAAI,EAAE,UAAA,IAAI;gBACR,IAAI,SAAS,EAAE;oBACb,SAAS,CAAC,IAAI,CACZ,mEAAmE,CACpE,CAAC;iBACH;qBAAM;oBACL,SAAS,GAAG,IAAI,CAAC;oBACjB,OAAO,CAAC,IAAI,CAAC,CAAC;iBACf;YACH,CAAC;YACD,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { invariant } from 'ts-invariant';\n\nimport { Observable } from '../../utilities';\n\nexport function toPromise<R>(observable: Observable<R>): Promise<R> {\n let completed = false;\n return new Promise<R>((resolve, reject) => {\n observable.subscribe({\n next: data => {\n if (completed) {\n invariant.warn(\n `Promise Wrapper does not support multiple results from Observable`,\n );\n } else {\n completed = true;\n resolve(data);\n }\n },\n error: reject,\n });\n });\n}\n"]}
1
+ {"version":3,"file":"toPromise.js","sourceRoot":"","sources":["../../../src/link/utils/toPromise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,MAAM,UAAU,SAAS,CAAI,UAAyB;IACpD,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,OAAO,IAAI,OAAO,CAAI,UAAC,OAAO,EAAE,MAAM;QACpC,UAAU,CAAC,SAAS,CAAC;YACnB,IAAI,EAAE,UAAA,IAAI;gBACR,IAAI,SAAS,EAAE;oBACb,SAAS,CAAC,IAAI,CACZ,mEAAmE,CACpE,CAAC;iBACH;qBAAM;oBACL,SAAS,GAAG,IAAI,CAAC;oBACjB,OAAO,CAAC,IAAI,CAAC,CAAC;iBACf;YACH,CAAC;YACD,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { invariant } from '../../utilities/globals';\nimport { Observable } from '../../utilities';\n\nexport function toPromise<R>(observable: Observable<R>): Promise<R> {\n let completed = false;\n return new Promise<R>((resolve, reject) => {\n observable.subscribe({\n next: data => {\n if (completed) {\n invariant.warn(\n `Promise Wrapper does not support multiple results from Observable`,\n );\n } else {\n completed = true;\n resolve(data);\n }\n },\n error: reject,\n });\n });\n}\n"]}
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var globals = require('../../utilities/globals');
5
6
  var utilities = require('../../utilities');
6
- var tsInvariant = require('ts-invariant');
7
7
  var tslib = require('tslib');
8
8
 
9
9
  function fromError(errorValue) {
@@ -18,7 +18,7 @@ function toPromise(observable) {
18
18
  observable.subscribe({
19
19
  next: function (data) {
20
20
  if (completed) {
21
- __DEV__ && tsInvariant.invariant.warn("Promise Wrapper does not support multiple results from Observable");
21
+ __DEV__ && globals.invariant.warn("Promise Wrapper does not support multiple results from Observable");
22
22
  }
23
23
  else {
24
24
  completed = true;
@@ -61,7 +61,7 @@ function validateOperation(operation) {
61
61
  for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
62
62
  var key = _a[_i];
63
63
  if (OPERATION_FIELDS.indexOf(key) < 0) {
64
- throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: " + key) : new tsInvariant.InvariantError(29);
64
+ throw __DEV__ ? new globals.InvariantError("illegal argument: " + key) : new globals.InvariantError(26);
65
65
  }
66
66
  }
67
67
  return operation;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs.js","sources":["fromError.js","toPromise.js","fromPromise.js","throwServerError.js","validateOperation.js","createOperation.js","transformOperation.js"],"sourcesContent":["import { Observable } from '../../utilities';\nexport function fromError(errorValue) {\n return new Observable(function (observer) {\n observer.error(errorValue);\n });\n}\n//# sourceMappingURL=fromError.js.map","import { invariant } from 'ts-invariant';\nexport function toPromise(observable) {\n var completed = false;\n return new Promise(function (resolve, reject) {\n observable.subscribe({\n next: function (data) {\n if (completed) {\n __DEV__ && invariant.warn(\"Promise Wrapper does not support multiple results from Observable\");\n }\n else {\n completed = true;\n resolve(data);\n }\n },\n error: reject,\n });\n });\n}\n//# sourceMappingURL=toPromise.js.map","import { Observable } from '../../utilities';\nexport function fromPromise(promise) {\n return new Observable(function (observer) {\n promise\n .then(function (value) {\n observer.next(value);\n observer.complete();\n })\n .catch(observer.error.bind(observer));\n });\n}\n//# sourceMappingURL=fromPromise.js.map","export var throwServerError = function (response, result, message) {\n var error = new Error(message);\n error.name = 'ServerError';\n error.response = response;\n error.statusCode = response.status;\n error.result = result;\n throw error;\n};\n//# sourceMappingURL=throwServerError.js.map","import { InvariantError } from 'ts-invariant';\nexport function validateOperation(operation) {\n var OPERATION_FIELDS = [\n 'query',\n 'operationName',\n 'variables',\n 'extensions',\n 'context',\n ];\n for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {\n var key = _a[_i];\n if (OPERATION_FIELDS.indexOf(key) < 0) {\n throw __DEV__ ? new InvariantError(\"illegal argument: \" + key) : new InvariantError(29);\n }\n }\n return operation;\n}\n//# sourceMappingURL=validateOperation.js.map","import { __assign } from \"tslib\";\nexport function createOperation(starting, operation) {\n var context = __assign({}, starting);\n var setContext = function (next) {\n if (typeof next === 'function') {\n context = __assign(__assign({}, context), next(context));\n }\n else {\n context = __assign(__assign({}, context), next);\n }\n };\n var getContext = function () { return (__assign({}, context)); };\n Object.defineProperty(operation, 'setContext', {\n enumerable: false,\n value: setContext,\n });\n Object.defineProperty(operation, 'getContext', {\n enumerable: false,\n value: getContext,\n });\n return operation;\n}\n//# sourceMappingURL=createOperation.js.map","import { getOperationName } from '../../utilities';\nexport function transformOperation(operation) {\n var transformedOperation = {\n variables: operation.variables || {},\n extensions: operation.extensions || {},\n operationName: operation.operationName,\n query: operation.query,\n };\n if (!transformedOperation.operationName) {\n transformedOperation.operationName =\n typeof transformedOperation.query !== 'string'\n ? getOperationName(transformedOperation.query) || undefined\n : '';\n }\n return transformedOperation;\n}\n//# sourceMappingURL=transformOperation.js.map"],"names":["Observable","invariant","InvariantError","__assign","getOperationName"],"mappings":";;;;;;;;AACO,SAAS,SAAS,CAAC,UAAU,EAAE;AACtC,IAAI,OAAO,IAAIA,oBAAU,CAAC,UAAU,QAAQ,EAAE;AAC9C,QAAQ,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AACnC,KAAK,CAAC,CAAC;AACP;;ACJO,SAAS,SAAS,CAAC,UAAU,EAAE;AACtC,IAAI,IAAI,SAAS,GAAG,KAAK,CAAC;AAC1B,IAAI,OAAO,IAAI,OAAO,CAAC,UAAU,OAAO,EAAE,MAAM,EAAE;AAClD,QAAQ,UAAU,CAAC,SAAS,CAAC;AAC7B,YAAY,IAAI,EAAE,UAAU,IAAI,EAAE;AAClC,gBAAgB,IAAI,SAAS,EAAE;AAC/B,oBAAoB,OAAO,IAAIC,qBAAS,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC;AACnH,iBAAiB;AACjB,qBAAqB;AACrB,oBAAoB,SAAS,GAAG,IAAI,CAAC;AACrC,oBAAoB,OAAO,CAAC,IAAI,CAAC,CAAC;AAClC,iBAAiB;AACjB,aAAa;AACb,YAAY,KAAK,EAAE,MAAM;AACzB,SAAS,CAAC,CAAC;AACX,KAAK,CAAC,CAAC;AACP;;AChBO,SAAS,WAAW,CAAC,OAAO,EAAE;AACrC,IAAI,OAAO,IAAID,oBAAU,CAAC,UAAU,QAAQ,EAAE;AAC9C,QAAQ,OAAO;AACf,aAAa,IAAI,CAAC,UAAU,KAAK,EAAE;AACnC,YAAY,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACj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AAoB,CAAC,aAAa,EAAE;AAC7C,QAAQ,oBAAoB,CAAC,aAAa;AAC1C,YAAY,OAAO,oBAAoB,CAAC,KAAK,KAAK,QAAQ;AAC1D,kBAAkBC,0BAAgB,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,SAAS;AAC3E,kBAAkB,EAAE,CAAC;AACrB,KAAK;AACL,IAAI,OAAO,oBAAoB,CAAC;AAChC;;;;;;;;;;"}
1
+ {"version":3,"file":"utils.cjs.js","sources":["fromError.js","toPromise.js","fromPromise.js","throwServerError.js","validateOperation.js","createOperation.js","transformOperation.js"],"sourcesContent":["import { Observable } from '../../utilities';\nexport function fromError(errorValue) {\n return new Observable(function (observer) {\n observer.error(errorValue);\n });\n}\n//# sourceMappingURL=fromError.js.map","import { invariant } from '../../utilities/globals';\nexport function toPromise(observable) {\n var completed = false;\n return new Promise(function (resolve, reject) {\n observable.subscribe({\n next: function (data) {\n if (completed) {\n __DEV__ && invariant.warn(\"Promise Wrapper does not support multiple results from Observable\");\n }\n else {\n completed = true;\n resolve(data);\n }\n },\n error: reject,\n });\n });\n}\n//# sourceMappingURL=toPromise.js.map","import { Observable } from '../../utilities';\nexport function fromPromise(promise) {\n return new Observable(function (observer) {\n promise\n .then(function (value) {\n observer.next(value);\n observer.complete();\n })\n .catch(observer.error.bind(observer));\n });\n}\n//# sourceMappingURL=fromPromise.js.map","export var throwServerError = function (response, result, message) {\n var error = new Error(message);\n error.name = 'ServerError';\n error.response = response;\n error.statusCode = response.status;\n error.result = result;\n throw error;\n};\n//# sourceMappingURL=throwServerError.js.map","import { InvariantError } from '../../utilities/globals';\nexport function validateOperation(operation) {\n var OPERATION_FIELDS = [\n 'query',\n 'operationName',\n 'variables',\n 'extensions',\n 'context',\n ];\n for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {\n var key = _a[_i];\n if (OPERATION_FIELDS.indexOf(key) < 0) {\n throw __DEV__ ? new InvariantError(\"illegal argument: \" + key) : new InvariantError(26);\n }\n }\n return operation;\n}\n//# sourceMappingURL=validateOperation.js.map","import { __assign } from \"tslib\";\nexport function createOperation(starting, operation) {\n var context = __assign({}, starting);\n var setContext = function (next) {\n if (typeof next === 'function') {\n context = __assign(__assign({}, context), next(context));\n }\n else {\n context = __assign(__assign({}, context), next);\n }\n };\n var getContext = function () { return (__assign({}, context)); };\n Object.defineProperty(operation, 'setContext', {\n enumerable: false,\n value: setContext,\n });\n Object.defineProperty(operation, 'getContext', {\n enumerable: false,\n value: getContext,\n });\n return operation;\n}\n//# sourceMappingURL=createOperation.js.map","import { getOperationName } from '../../utilities';\nexport function transformOperation(operation) {\n var transformedOperation = {\n variables: operation.variables || {},\n extensions: operation.extensions || {},\n operationName: operation.operationName,\n query: operation.query,\n };\n if (!transformedOperation.operationName) {\n transformedOperation.operationName =\n typeof transformedOperation.query !== 'string'\n ? getOperationName(transformedOperation.query) || undefined\n : '';\n }\n return transformedOperation;\n}\n//# sourceMappingURL=transformOperation.js.map"],"names":["Observable","invariant","InvariantError","__assign","getOperationName"],"mappings":";;;;;;;;AACO,SAAS,SAAS,CAAC,UAAU,EAAE;AACtC,IAAI,OAAO,IAAIA,oBAAU,CAAC,UAAU,QAAQ,EAAE;AAC9C,QAAQ,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AACnC,KAAK,CAAC,CAAC;AACP;;ACJO,SAAS,SAAS,CAAC,UAAU,EAAE;AACtC,IAAI,IAAI,SAAS,GAAG,KAAK,CAAC;AAC1B,IAAI,OAAO,IAAI,OAAO,CAAC,UAAU,OAAO,EAAE,MAAM,EAAE;AAClD,QAAQ,UAAU,CAAC,SAAS,CAAC;AAC7B,YAAY,IAAI,EAAE,UAAU,IAAI,EAAE;AAClC,gBAAgB,IAAI,SAAS,EAAE;AAC/B,oBAAoB,OAAO,IAAIC,iBAAS,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC;AACnH,iBAAiB;AACjB,qBAAqB;AACrB,oBAAoB,SAAS,GAAG,IAAI,CAA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CAAC,CAAC;AACP,IAAI,OAAO,SAAS,CAAC;AACrB;;ACpBO,SAAS,kBAAkB,CAAC,SAAS,EAAE;AAC9C,IAAI,IAAI,oBAAoB,GAAG;AAC/B,QAAQ,SAAS,EAAE,SAAS,CAAC,SAAS,IAAI,EAAE;AAC5C,QAAQ,UAAU,EAAE,SAAS,CAAC,UAAU,IAAI,EAAE;AAC9C,QAAQ,aAAa,EAAE,SAAS,CAAC,aAAa;AAC9C,QAAQ,KAAK,EAAE,SAAS,CAAC,KAAK;AAC9B,KAAK,CAAC;AACN,IAAI,IAAI,CAAC,oBAAoB,CAAC,aAAa,EAAE;AAC7C,QAAQ,oBAAoB,CAAC,aAAa;AAC1C,YAAY,OAAO,oBAAoB,CAAC,KAAK,KAAK,QAAQ;AAC1D,kBAAkBC,0BAAgB,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,SAAS;AAC3E,kBAAkB,EAAE,CAAC;AACrB,KAAK;AACL,IAAI,OAAO,oBAAoB,CAAC;AAChC;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"validateOperation.d.ts","sourceRoot":"","sources":["../../../src/link/utils/validateOperation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,cAAc,GAAG,cAAc,CAe3E"}
1
+ {"version":3,"file":"validateOperation.d.ts","sourceRoot":"","sources":["../../../src/link/utils/validateOperation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,cAAc,GAAG,cAAc,CAe3E"}
@@ -1,4 +1,4 @@
1
- import { InvariantError } from 'ts-invariant';
1
+ import { InvariantError } from "../../utilities/globals/index.js";
2
2
  export function validateOperation(operation) {
3
3
  var OPERATION_FIELDS = [
4
4
  'query',
@@ -10,7 +10,7 @@ export function validateOperation(operation) {
10
10
  for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
11
11
  var key = _a[_i];
12
12
  if (OPERATION_FIELDS.indexOf(key) < 0) {
13
- throw __DEV__ ? new InvariantError("illegal argument: " + key) : new InvariantError(29);
13
+ throw __DEV__ ? new InvariantError("illegal argument: " + key) : new InvariantError(26);
14
14
  }
15
15
  }
16
16
  return operation;
@@ -1 +1 @@
1
- {"version":3,"file":"validateOperation.js","sourceRoot":"","sources":["../../../src/link/utils/validateOperation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI9C,MAAM,UAAU,iBAAiB,CAAC,SAAyB;IACzD,IAAM,gBAAgB,GAAG;QACvB,OAAO;QACP,eAAe;QACf,WAAW;QACX,YAAY;QACZ,SAAS;KACV,CAAC;IACF,KAAgB,UAAsB,EAAtB,KAAA,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAtB,cAAsB,EAAtB,IAAsB,EAAE;QAAnC,IAAI,GAAG,SAAA;QACV,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YACrC,MAAM,IAAI,cAAc,CAAC,uBAAqB,GAAK,CAAC,CAAC;SACtD;KACF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import { InvariantError } from 'ts-invariant';\n\nimport { GraphQLRequest } from '../core';\n\nexport function validateOperation(operation: GraphQLRequest): GraphQLRequest {\n const OPERATION_FIELDS = [\n 'query',\n 'operationName',\n 'variables',\n 'extensions',\n 'context',\n ];\n for (let key of Object.keys(operation)) {\n if (OPERATION_FIELDS.indexOf(key) < 0) {\n throw new InvariantError(`illegal argument: ${key}`);\n }\n }\n\n return operation;\n}\n"]}
1
+ {"version":3,"file":"validateOperation.js","sourceRoot":"","sources":["../../../src/link/utils/validateOperation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAGxD,MAAM,UAAU,iBAAiB,CAAC,SAAyB;IACzD,IAAM,gBAAgB,GAAG;QACvB,OAAO;QACP,eAAe;QACf,WAAW;QACX,YAAY;QACZ,SAAS;KACV,CAAC;IACF,KAAgB,UAAsB,EAAtB,KAAA,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAtB,cAAsB,EAAtB,IAAsB,EAAE;QAAnC,IAAI,GAAG,SAAA;QACV,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YACrC,MAAM,IAAI,cAAc,CAAC,uBAAqB,GAAK,CAAC,CAAC;SACtD;KACF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import { InvariantError } from '../../utilities/globals'\nimport { GraphQLRequest } from '../core';\n\nexport function validateOperation(operation: GraphQLRequest): GraphQLRequest {\n const OPERATION_FIELDS = [\n 'query',\n 'operationName',\n 'variables',\n 'extensions',\n 'context',\n ];\n for (let key of Object.keys(operation)) {\n if (OPERATION_FIELDS.indexOf(key) < 0) {\n throw new InvariantError(`illegal argument: ${key}`);\n }\n }\n\n return operation;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo/client",
3
- "version": "3.4.8",
3
+ "version": "3.4.12",
4
4
  "description": "A fully-featured caching GraphQL client.",
5
5
  "private": false,
6
6
  "keywords": [
@@ -53,22 +53,22 @@
53
53
  "symbol-observable": "^4.0.0",
54
54
  "ts-invariant": "^0.9.0",
55
55
  "tslib": "^2.3.0",
56
- "zen-observable-ts": "^1.1.0"
56
+ "zen-observable-ts": "~1.1.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@babel/parser": "7.15.3",
60
- "@graphql-tools/schema": "8.1.0",
59
+ "@babel/parser": "7.15.6",
60
+ "@graphql-tools/schema": "8.2.0",
61
61
  "@rollup/plugin-node-resolve": "11.2.1",
62
62
  "@testing-library/react": "9.5.0",
63
- "@testing-library/react-hooks": "7.0.1",
63
+ "@testing-library/react-hooks": "7.0.2",
64
64
  "@types/fast-json-stable-stringify": "2.0.0",
65
65
  "@types/fetch-mock": "7.3.5",
66
66
  "@types/glob": "7.1.4",
67
67
  "@types/hoist-non-react-statics": "3.3.1",
68
68
  "@types/jest": "26.0.24",
69
69
  "@types/lodash": "4.14.172",
70
- "@types/node": "16.6.1",
71
- "@types/react": "17.0.18",
70
+ "@types/node": "16.9.1",
71
+ "@types/react": "17.0.20",
72
72
  "@types/react-dom": "17.0.2",
73
73
  "@types/recompose": "0.30.8",
74
74
  "bundlesize": "0.18.1",
@@ -76,7 +76,7 @@
76
76
  "crypto-hash": "1.3.0",
77
77
  "fetch-mock": "9.11.0",
78
78
  "glob": "7.1.7",
79
- "graphql": "15.5.1",
79
+ "graphql": "15.5.3",
80
80
  "jest": "26.6.3",
81
81
  "jest-fetch-mock": "3.0.3",
82
82
  "jest-junit": "12.2.0",
@@ -91,10 +91,10 @@
91
91
  "rollup-plugin-terser": "7.0.2",
92
92
  "rxjs": "6.6.7",
93
93
  "subscriptions-transport-ws": "0.9.19",
94
- "terser": "5.7.1",
94
+ "terser": "5.7.2",
95
95
  "ts-jest": "26.5.6",
96
- "ts-node": "10.2.0",
97
- "typescript": "4.3.5",
96
+ "ts-node": "10.2.1",
97
+ "typescript": "4.4.3",
98
98
  "wait-for-observables": "1.0.3"
99
99
  },
100
100
  "publishConfig": {
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloConsumer.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloConsumer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC;CACrE;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAcxD,CAAC"}
1
+ {"version":3,"file":"ApolloConsumer.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloConsumer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC;CACrE;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAcxD,CAAC"}
@@ -1,11 +1,11 @@
1
+ import { invariant } from "../../utilities/globals/index.js";
1
2
  import * as React from 'react';
2
- import { invariant } from 'ts-invariant';
3
3
  import { getApolloContext } from "./ApolloContext.js";
4
4
  export var ApolloConsumer = function (props) {
5
5
  var ApolloContext = getApolloContext();
6
6
  return React.createElement(ApolloContext.Consumer, null, function (context) {
7
7
  __DEV__ ? invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
8
- 'Wrap the root component in an <ApolloProvider>.') : invariant(context && context.client, 30);
8
+ 'Wrap the root component in an <ApolloProvider>.') : invariant(context && context.client, 27);
9
9
  return props.children(context.client);
10
10
  });
11
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloConsumer.js","sourceRoot":"","sources":["../../../src/react/context/ApolloConsumer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAMnD,MAAM,CAAC,IAAM,cAAc,GAAkC,UAAA,KAAK;IAChE,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,QACpB,UAAC,OAAY;QACZ,SAAS,CACP,OAAO,IAAI,OAAO,CAAC,MAAM,EACzB,4DAA4D;YAC1D,iDAAiD,CACpD,CAAC;QACF,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC,CACsB,CAC1B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { invariant } from 'ts-invariant';\n\nimport { ApolloClient } from '../../core';\nimport { getApolloContext } from './ApolloContext';\n\nexport interface ApolloConsumerProps {\n children: (client: ApolloClient<object>) => React.ReactChild | null;\n}\n\nexport const ApolloConsumer: React.FC<ApolloConsumerProps> = props => {\n const ApolloContext = getApolloContext();\n return (\n <ApolloContext.Consumer>\n {(context: any) => {\n invariant(\n context && context.client,\n 'Could not find \"client\" in the context of ApolloConsumer. ' +\n 'Wrap the root component in an <ApolloProvider>.'\n );\n return props.children(context.client);\n }}\n </ApolloContext.Consumer>\n );\n};\n"]}
1
+ {"version":3,"file":"ApolloConsumer.js","sourceRoot":"","sources":["../../../src/react/context/ApolloConsumer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAMnD,MAAM,CAAC,IAAM,cAAc,GAAkC,UAAA,KAAK;IAChE,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,QACpB,UAAC,OAAY;QACZ,SAAS,CACP,OAAO,IAAI,OAAO,CAAC,MAAM,EACzB,4DAA4D;YAC1D,iDAAiD,CACpD,CAAC;QACF,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC,CACsB,CAC1B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { invariant } from '../../utilities/globals';\n\nimport * as React from 'react';\n\nimport { ApolloClient } from '../../core';\nimport { getApolloContext } from './ApolloContext';\n\nexport interface ApolloConsumerProps {\n children: (client: ApolloClient<object>) => React.ReactChild | null;\n}\n\nexport const ApolloConsumer: React.FC<ApolloConsumerProps> = props => {\n const ApolloContext = getApolloContext();\n return (\n <ApolloContext.Consumer>\n {(context: any) => {\n invariant(\n context && context.client,\n 'Could not find \"client\" in the context of ApolloConsumer. ' +\n 'Wrap the root component in an <ApolloProvider>.'\n );\n return props.children(context.client);\n }}\n </ApolloContext.Consumer>\n );\n};\n"]}
@@ -1,8 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { ApolloClient } from '../../core';
3
+ import type { RenderPromises } from '../ssr';
3
4
  export interface ApolloContextValue {
4
5
  client?: ApolloClient<object>;
5
- renderPromises?: Record<any, any>;
6
+ renderPromises?: RenderPromises;
6
7
  }
7
8
  export declare function getApolloContext(): React.Context<ApolloContextValue>;
8
9
  export { getApolloContext as resetApolloContext };
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloContext.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;CACnC;AAcD,wBAAgB,gBAAgB,sCAQ/B;AAED,OAAO,EAAE,gBAAgB,IAAI,kBAAkB,EAAE,CAAA"}
1
+ {"version":3,"file":"ApolloContext.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAUD,wBAAgB,gBAAgB,IAAI,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAYpE;AAED,OAAO,EAAE,gBAAgB,IAAI,kBAAkB,EAAE,CAAA"}
@@ -1,12 +1,18 @@
1
1
  import * as React from 'react';
2
- import { canUseWeakMap } from "../../utilities/index.js";
3
- var cache = new (canUseWeakMap ? WeakMap : Map)();
2
+ import { canUseSymbol } from "../../utilities/index.js";
3
+ var contextKey = canUseSymbol
4
+ ? Symbol.for('__APOLLO_CONTEXT__')
5
+ : '__APOLLO_CONTEXT__';
4
6
  export function getApolloContext() {
5
- var context = cache.get(React.createContext);
7
+ var context = React.createContext[contextKey];
6
8
  if (!context) {
7
- context = React.createContext({});
9
+ Object.defineProperty(React.createContext, contextKey, {
10
+ value: context = React.createContext({}),
11
+ enumerable: false,
12
+ writable: false,
13
+ configurable: true,
14
+ });
8
15
  context.displayName = 'ApolloContext';
9
- cache.set(React.createContext, context);
10
16
  }
11
17
  return context;
12
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloContext.js","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAchD,IAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAG9C,CAAC;AAEJ,MAAM,UAAU,gBAAgB;IAC9B,IAAI,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,CAAE,CAAC;IAC9C,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,GAAG,KAAK,CAAC,aAAa,CAAqB,EAAE,CAAC,CAAC;QACtD,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;QACtC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;KACzC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,gBAAgB,IAAI,kBAAkB,EAAE,CAAA","sourcesContent":["import * as React from 'react';\nimport { ApolloClient } from '../../core';\nimport { canUseWeakMap } from '../../utilities';\n\nexport interface ApolloContextValue {\n client?: ApolloClient<object>;\n renderPromises?: Record<any, any>;\n}\n\n// To make sure Apollo Client doesn't create more than one React context\n// (which can lead to problems like having an Apollo Client instance added\n// in one context, then attempting to retrieve it from another different\n// context), a single Apollo context is created and tracked in global state.\n// We use React.createContext as the key instead of just React to avoid\n// ambiguities between default and namespace React imports.\n\nconst cache = new (canUseWeakMap ? WeakMap : Map)<\n typeof React.createContext,\n React.Context<ApolloContextValue>\n>();\n\nexport function getApolloContext() {\n let context = cache.get(React.createContext)!;\n if (!context) {\n context = React.createContext<ApolloContextValue>({});\n context.displayName = 'ApolloContext';\n cache.set(React.createContext, context);\n }\n return context;\n}\n\nexport { getApolloContext as resetApolloContext }\n"]}
1
+ {"version":3,"file":"ApolloContext.js","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAY/C,IAAM,UAAU,GAAG,YAAY;IAC7B,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAClC,CAAC,CAAC,oBAAoB,CAAC;AAEzB,MAAM,UAAU,gBAAgB;IAC9B,IAAI,OAAO,GAAI,KAAK,CAAC,aAAqB,CAAC,UAAU,CAAsC,CAAC;IAC5F,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,aAAa,EAAE,UAAU,EAAE;YACrD,KAAK,EAAE,OAAO,GAAG,KAAK,CAAC,aAAa,CAAqB,EAAE,CAAC;YAC5D,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;QACH,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;KACvC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,gBAAgB,IAAI,kBAAkB,EAAE,CAAA","sourcesContent":["import * as React from 'react';\nimport { ApolloClient } from '../../core';\nimport { canUseSymbol } from '../../utilities';\nimport type { RenderPromises } from '../ssr';\n\nexport interface ApolloContextValue {\n client?: ApolloClient<object>;\n renderPromises?: RenderPromises;\n}\n\n// To make sure Apollo Client doesn't create more than one React context\n// (which can lead to problems like having an Apollo Client instance added\n// in one context, then attempting to retrieve it from another different\n// context), a single Apollo context is created and tracked in global state.\nconst contextKey = canUseSymbol\n ? Symbol.for('__APOLLO_CONTEXT__')\n : '__APOLLO_CONTEXT__';\n\nexport function getApolloContext(): React.Context<ApolloContextValue> {\n let context = (React.createContext as any)[contextKey] as React.Context<ApolloContextValue>;\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: context = React.createContext<ApolloContextValue>({}),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = 'ApolloContext';\n }\n return context;\n}\n\nexport { getApolloContext as resetApolloContext }\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloProvider.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,MAAM,WAAW,mBAAmB,CAAC,MAAM;IACzC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC;CACtD;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CA0B7D,CAAC"}
1
+ {"version":3,"file":"ApolloProvider.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,MAAM,WAAW,mBAAmB,CAAC,MAAM;IACzC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC;CACtD;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CA0B7D,CAAC"}
@@ -1,5 +1,5 @@
1
+ import { invariant } from "../../utilities/globals/index.js";
1
2
  import * as React from 'react';
2
- import { invariant } from 'ts-invariant';
3
3
  import { getApolloContext } from "./ApolloContext.js";
4
4
  export var ApolloProvider = function (_a) {
5
5
  var client = _a.client, children = _a.children;
@@ -10,7 +10,7 @@ export var ApolloProvider = function (_a) {
10
10
  context = Object.assign({}, context, { client: client });
11
11
  }
12
12
  __DEV__ ? invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
13
- 'sure you pass in your client via the "client" prop.') : invariant(context.client, 31);
13
+ 'sure you pass in your client via the "client" prop.') : invariant(context.client, 28);
14
14
  return (React.createElement(ApolloContext.Provider, { value: context }, children));
15
15
  });
16
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloProvider.js","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAOnD,MAAM,CAAC,IAAM,cAAc,GAAuC,UAAC,EAGlE;QAFC,MAAM,YAAA,EACN,QAAQ,cAAA;IAER,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,QACpB,UAAC,OAAiB;QAAjB,wBAAA,EAAA,YAAiB;QACjB,IAAI,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE;YACvC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;SAClD;QAED,SAAS,CACP,OAAO,CAAC,MAAM,EACd,wDAAwD;YACtD,qDAAqD,CACxD,CAAC;QAEF,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IACnC,QAAQ,CACc,CAC1B,CAAC;IACJ,CAAC,CACsB,CAC1B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { invariant } from 'ts-invariant';\n\nimport { ApolloClient } from '../../core';\nimport { getApolloContext } from './ApolloContext';\n\nexport interface ApolloProviderProps<TCache> {\n client: ApolloClient<TCache>;\n children: React.ReactNode | React.ReactNode[] | null;\n}\n\nexport const ApolloProvider: React.FC<ApolloProviderProps<any>> = ({\n client,\n children\n}) => {\n const ApolloContext = getApolloContext();\n return (\n <ApolloContext.Consumer>\n {(context: any = {}) => {\n if (client && context.client !== client) {\n context = Object.assign({}, context, { client });\n }\n\n invariant(\n context.client,\n 'ApolloProvider was not passed a client instance. Make ' +\n 'sure you pass in your client via the \"client\" prop.'\n );\n\n return (\n <ApolloContext.Provider value={context}>\n {children}\n </ApolloContext.Provider>\n );\n }}\n </ApolloContext.Consumer>\n );\n};\n"]}
1
+ {"version":3,"file":"ApolloProvider.js","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAOnD,MAAM,CAAC,IAAM,cAAc,GAAuC,UAAC,EAGlE;QAFC,MAAM,YAAA,EACN,QAAQ,cAAA;IAER,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,QACpB,UAAC,OAAiB;QAAjB,wBAAA,EAAA,YAAiB;QACjB,IAAI,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE;YACvC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;SAClD;QAED,SAAS,CACP,OAAO,CAAC,MAAM,EACd,wDAAwD;YACtD,qDAAqD,CACxD,CAAC;QAEF,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IACnC,QAAQ,CACc,CAC1B,CAAC;IACJ,CAAC,CACsB,CAC1B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { invariant } from '../../utilities/globals';\n\nimport * as React from 'react';\n\nimport { ApolloClient } from '../../core';\nimport { getApolloContext } from './ApolloContext';\n\nexport interface ApolloProviderProps<TCache> {\n client: ApolloClient<TCache>;\n children: React.ReactNode | React.ReactNode[] | null;\n}\n\nexport const ApolloProvider: React.FC<ApolloProviderProps<any>> = ({\n client,\n children\n}) => {\n const ApolloContext = getApolloContext();\n return (\n <ApolloContext.Consumer>\n {(context: any = {}) => {\n if (client && context.client !== client) {\n context = Object.assign({}, context, { client });\n }\n\n invariant(\n context.client,\n 'ApolloProvider was not passed a client instance. Make ' +\n 'sure you pass in your client via the \"client\" prop.'\n );\n\n return (\n <ApolloContext.Provider value={context}>\n {children}\n </ApolloContext.Provider>\n );\n }}\n </ApolloContext.Consumer>\n );\n};\n"]}
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var globals = require('../../utilities/globals');
5
6
  var React = require('react');
6
- var tsInvariant = require('ts-invariant');
7
7
  var utilities = require('../../utilities');
8
8
 
9
9
  function _interopNamespace(e) {
@@ -20,13 +20,19 @@ function _interopNamespace(e) {
20
20
 
21
21
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
22
22
 
23
- var cache = new (utilities.canUseWeakMap ? WeakMap : Map)();
23
+ var contextKey = utilities.canUseSymbol
24
+ ? Symbol.for('__APOLLO_CONTEXT__')
25
+ : '__APOLLO_CONTEXT__';
24
26
  function getApolloContext() {
25
- var context = cache.get(React__namespace.createContext);
27
+ var context = React__namespace.createContext[contextKey];
26
28
  if (!context) {
27
- context = React__namespace.createContext({});
29
+ Object.defineProperty(React__namespace.createContext, contextKey, {
30
+ value: context = React__namespace.createContext({}),
31
+ enumerable: false,
32
+ writable: false,
33
+ configurable: true,
34
+ });
28
35
  context.displayName = 'ApolloContext';
29
- cache.set(React__namespace.createContext, context);
30
36
  }
31
37
  return context;
32
38
  }
@@ -34,8 +40,8 @@ function getApolloContext() {
34
40
  var ApolloConsumer = function (props) {
35
41
  var ApolloContext = getApolloContext();
36
42
  return React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
37
- __DEV__ ? tsInvariant.invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
38
- 'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client, 30);
43
+ __DEV__ ? globals.invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
44
+ 'Wrap the root component in an <ApolloProvider>.') : globals.invariant(context && context.client, 27);
39
45
  return props.children(context.client);
40
46
  });
41
47
  };
@@ -48,8 +54,8 @@ var ApolloProvider = function (_a) {
48
54
  if (client && context.client !== client) {
49
55
  context = Object.assign({}, context, { client: client });
50
56
  }
51
- __DEV__ ? tsInvariant.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
52
- 'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client, 31);
57
+ __DEV__ ? globals.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
58
+ 'sure you pass in your client via the "client" prop.') : globals.invariant(context.client, 28);
53
59
  return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
54
60
  });
55
61
  };
@@ -1 +1 @@
1
- {"version":3,"file":"context.cjs.js","sources":["ApolloContext.js","ApolloConsumer.js","ApolloProvider.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseWeakMap } from '../../utilities';\nvar cache = new (canUseWeakMap ? WeakMap : Map)();\nexport function getApolloContext() {\n var context = cache.get(React.createContext);\n if (!context) {\n context = React.createContext({});\n context.displayName = 'ApolloContext';\n cache.set(React.createContext, context);\n }\n return context;\n}\nexport { getApolloContext as resetApolloContext };\n//# sourceMappingURL=ApolloContext.js.map","import * as React from 'react';\nimport { invariant } from 'ts-invariant';\nimport { getApolloContext } from './ApolloContext';\nexport var ApolloConsumer = function (props) {\n var ApolloContext = getApolloContext();\n return React.createElement(ApolloContext.Consumer, null, function (context) {\n __DEV__ ? invariant(context && context.client, 'Could not find \"client\" in the context of ApolloConsumer. ' +\n 'Wrap the root component in an <ApolloProvider>.') : invariant(context && context.client, 30);\n return props.children(context.client);\n });\n};\n//# sourceMappingURL=ApolloConsumer.js.map","import * as React from 'react';\nimport { invariant } from 'ts-invariant';\nimport { getApolloContext } from './ApolloContext';\nexport var ApolloProvider = function (_a) {\n var client = _a.client, children = _a.children;\n var ApolloContext = getApolloContext();\n return React.createElement(ApolloContext.Consumer, null, function (context) {\n if (context === void 0) { context = {}; }\n if (client && context.client !== client) {\n context = Object.assign({}, context, { client: client });\n }\n __DEV__ ? invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +\n 'sure you pass in your client via the \"client\" prop.') : invariant(context.client, 31);\n return (React.createElement(ApolloContext.Provider, { value: context }, children));\n });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,CAAC;AAC3C,IAAI,OAAOD,gBAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE;AAChF,QAAQ,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,CAAC,EAAE;AACjD,QAAQ,IAAI,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE;AACjD,YAAY,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AACrE,SAAS;AACT,QAAQ,OAAO,GAAGC,qBAAS,CAAC,OAAO,CAAC,MAAM,EAAE,wDAAwD;AACpG,YAAY,qDAAqD,CAAC,GAAGA,qBAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACnG,QAAQ,QAAQD,gBAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,EAAE;AAC3F,KAAK,CAAC,CAAC;AACP;;;;;;;"}
1
+ {"version":3,"file":"context.cjs.js","sources":["ApolloContext.js","ApolloConsumer.js","ApolloProvider.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseSymbol } from '../../utilities';\nvar contextKey = canUseSymbol\n ? Symbol.for('__APOLLO_CONTEXT__')\n : '__APOLLO_CONTEXT__';\nexport function getApolloContext() {\n var context = React.createContext[contextKey];\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: context = React.createContext({}),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = 'ApolloContext';\n }\n return context;\n}\nexport { getApolloContext as resetApolloContext };\n//# sourceMappingURL=ApolloContext.js.map","import { invariant } from '../../utilities/globals';\nimport * as React from 'react';\nimport { getApolloContext } from './ApolloContext';\nexport var ApolloConsumer = function (props) {\n var ApolloContext = getApolloContext();\n return React.createElement(ApolloContext.Consumer, null, function (context) {\n __DEV__ ? invariant(context && context.client, 'Could not find \"client\" in the context of ApolloConsumer. ' +\n 'Wrap the root component in an <ApolloProvider>.') : invariant(context && context.client, 27);\n return props.children(context.client);\n });\n};\n//# sourceMappingURL=ApolloConsumer.js.map","import { invariant } from '../../utilities/globals';\nimport * as React from 'react';\nimport { getApolloContext } from './ApolloContext';\nexport var ApolloProvider = function (_a) {\n var client = _a.client, children = _a.children;\n var ApolloContext = getApolloContext();\n return React.createElement(ApolloContext.Consumer, null, function (context) {\n if (context === void 0) { context = {}; }\n if (client && context.client !== client) {\n context = Object.assign({}, context, { client: client });\n }\n __DEV__ ? invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +\n 'sure you pass in your client via the \"client\" prop.') : invariant(context.client, 28);\n return (React.createElement(ApolloContext.Provider, { value: context }, children));\n });\n};\n//# sourceMappingURL=ApolloProvider.js.map"],"names":["canUseSymbol","React","invariant"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,IAAI,UAAU,GAAGA,sBAAY;AAC7B,MAAM,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;AACtC,MAAM,oBAAoB,CAAC;AACpB,SAAS,gBAAgB,GAAG;AACnC,IAAI,IAAI,OAAO,GAAGC,gBAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AAClD,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,MAAM,CAAC,cAAc,CAACA,gBAAK,CAAC,aAAa,EAAE,UAAU,EAAE;AAC/D,YAAY,KAAK,EAAE,OAAO,GAAGA,gBAAK,CAAC,aAAa,CAAC,EAAE,CAAC;AACpD,YAAY,UAAU,EAAE,KAAK;AAC7B,YAAY,QAAQ,EAAE,KAAK;AAC3B,YAAY,YAAY,EAAE,IAAI;AAC9B,SAAS,CAAC,CAAC;AACX,QAAQ,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;AAC9C,KAAK;AACL,IAAI,OAAO,OAAO,CAAC;AACnB;;ACdU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AAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,EAAE;AAC3F,KAAK,CAAC,CAAC;AACP;;;;;;;"}
@@ -1,3 +1,4 @@
1
+ import '../../utilities/globals';
1
2
  export * from './ApolloConsumer';
2
3
  export * from './ApolloContext';
3
4
  export * from './ApolloProvider';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import "../../utilities/globals/index.js";
1
2
  export * from "./ApolloConsumer.js";
2
3
  export * from "./ApolloContext.js";
3
4
  export * from "./ApolloProvider.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './ApolloConsumer';\nexport * from './ApolloContext';\nexport * from './ApolloProvider';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC","sourcesContent":["import '../../utilities/globals';\n\nexport * from './ApolloConsumer';\nexport * from './ApolloContext';\nexport * from './ApolloProvider';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"OperationData.d.ts","sourceRoot":"","sources":["../../../src/react/data/OperationData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIvC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAyB,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,8BAAsB,aAAa,CAAC,QAAQ,GAAG,GAAG;IACzC,SAAS,EAAE,OAAO,CAAS;IAC3B,eAAe,EAAE,aAAa,CAAC,QAAQ,CAAC,CAE7C;IACK,OAAO,EAAE,GAAG,CAAM;IAClB,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAEpC,OAAO,CAAC,OAAO,CAA0D;gBAE7D,OAAO,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,GAAG;IAKrD,UAAU,IAAI,aAAa,CAAC,QAAQ,CAAC;IAIrC,UAAU,CACf,UAAU,EAAE,aAAa,CAAC,QAAQ,CAAC,EACnC,aAAa,GAAE,OAAe;aAQhB,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,GAAG,GAAG;aAC1B,YAAY,CAAC,GAAG,IAAI,EAAE,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC;aAC/C,OAAO,IAAI,IAAI;IAE/B,SAAS,CAAC,OAAO;IAIjB,SAAS,CAAC,aAAa;;;;IAwBvB,SAAS,CAAC,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY;CAUxE"}
1
+ {"version":3,"file":"OperationData.d.ts","sourceRoot":"","sources":["../../../src/react/data/OperationData.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAyB,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,8BAAsB,aAAa,CAAC,QAAQ,GAAG,GAAG;IACzC,SAAS,EAAE,OAAO,CAAS;IAC3B,eAAe,EAAE,aAAa,CAAC,QAAQ,CAAC,CAE7C;IACK,OAAO,EAAE,GAAG,CAAM;IAClB,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAEpC,OAAO,CAAC,OAAO,CAA0D;gBAE7D,OAAO,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,GAAG;IAKrD,UAAU,IAAI,aAAa,CAAC,QAAQ,CAAC;IAIrC,UAAU,CACf,UAAU,EAAE,aAAa,CAAC,QAAQ,CAAC,EACnC,aAAa,GAAE,OAAe;aAQhB,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,GAAG,GAAG;aAC1B,YAAY,CAAC,GAAG,IAAI,EAAE,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC;aAC/C,OAAO,IAAI,IAAI;IAE/B,SAAS,CAAC,OAAO;IAIjB,SAAS,CAAC,aAAa;;;;IAwBvB,SAAS,CAAC,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY;CAUxE"}
@@ -1,5 +1,5 @@
1
+ import { invariant } from "../../utilities/globals/index.js";
1
2
  import { equal } from '@wry/equality';
2
- import { invariant } from 'ts-invariant';
3
3
  import { parser, operationName } from "../parser/index.js";
4
4
  var OperationData = (function () {
5
5
  function OperationData(options, context) {
@@ -28,7 +28,7 @@ var OperationData = (function () {
28
28
  (this.context && this.context.client);
29
29
  __DEV__ ? invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' +
30
30
  'Wrap the root component in an <ApolloProvider>, or pass an ' +
31
- 'ApolloClient instance in via options.') : invariant(!!client, 32);
31
+ 'ApolloClient instance in via options.') : invariant(!!client, 29);
32
32
  var isNew = false;
33
33
  if (client !== this.client) {
34
34
  isNew = true;
@@ -45,7 +45,7 @@ var OperationData = (function () {
45
45
  var requiredOperationName = operationName(type);
46
46
  var usedOperationName = operationName(operation.type);
47
47
  __DEV__ ? invariant(operation.type === type, "Running a " + requiredOperationName + " requires a graphql " +
48
- (requiredOperationName + ", but a " + usedOperationName + " was used instead.")) : invariant(operation.type === type, 33);
48
+ (requiredOperationName + ", but a " + usedOperationName + " was used instead.")) : invariant(operation.type === type, 30);
49
49
  };
50
50
  return OperationData;
51
51
  }());
@@ -1 +1 @@
1
- {"version":3,"file":"OperationData.js","sourceRoot":"","sources":["../../../src/react/data/OperationData.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAgB,MAAM,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAGhE;IAUE,uBAAY,OAAiC,EAAE,OAAa;QATrD,cAAS,GAAY,KAAK,CAAC;QAC3B,oBAAe,GAA4B,EAEjD,CAAC;QACK,YAAO,GAAQ,EAAE,CAAC;QAGjB,YAAO,GAA4B,EAA6B,CAAC;QAGvE,IAAI,CAAC,OAAO,GAAG,OAAO,IAAK,EAA8B,CAAC;QAC1D,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;IAC/B,CAAC;IAEM,kCAAU,GAAjB;QACE,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEM,kCAAU,GAAjB,UACE,UAAmC,EACnC,aAA8B;QAA9B,8BAAA,EAAA,qBAA8B;QAE9B,IAAI,aAAa,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE;YACrD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC;SACrC;QACD,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC;IAC5B,CAAC;IAMS,+BAAO,GAAjB;QACE,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACzB,CAAC;IAES,qCAAa,GAAvB;QACE,IAAM,MAAM,GACV,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;YACrC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAExC,SAAS,CACP,CAAC,CAAC,MAAM,EACR,oEAAoE;YAClE,6DAA6D;YAC7D,uCAAuC,CAC1C,CAAC;QAEF,IAAI,KAAK,GAAG,KAAK,CAAC;QAClB,IAAI,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;YAC1B,KAAK,GAAG,IAAI,CAAC;YACb,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,IAAI,CAAC,OAAO,EAAE,CAAC;SAChB;QACD,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAA8B;YAC3C,KAAK,OAAA;SACN,CAAC;IACJ,CAAC;IAES,0CAAkB,GAA5B,UAA6B,QAAsB,EAAE,IAAkB;QACrE,IAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QACnC,IAAM,qBAAqB,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QAClD,IAAM,iBAAiB,GAAG,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACxD,SAAS,CACP,SAAS,CAAC,IAAI,KAAK,IAAI,EACvB,eAAa,qBAAqB,yBAAsB;aACnD,qBAAqB,gBAAW,iBAAiB,uBAAoB,CAAA,CAC3E,CAAC;IACJ,CAAC;IACH,oBAAC;AAAD,CAAC,AAvED,IAuEC","sourcesContent":["import { DocumentNode } from 'graphql';\nimport { equal } from '@wry/equality';\nimport { invariant } from 'ts-invariant';\n\nimport { ApolloClient } from '../../core';\nimport { DocumentType, parser, operationName } from '../parser';\nimport { CommonOptions } from '../types/types';\n\nexport abstract class OperationData<TOptions = any> {\n public isMounted: boolean = false;\n public previousOptions: CommonOptions<TOptions> = {} as CommonOptions<\n TOptions\n >;\n public context: any = {};\n public client: ApolloClient<object>;\n\n private options: CommonOptions<TOptions> = {} as CommonOptions<TOptions>;\n\n constructor(options?: CommonOptions<TOptions>, context?: any) {\n this.options = options || ({} as CommonOptions<TOptions>);\n this.context = context || {};\n }\n\n public getOptions(): CommonOptions<TOptions> {\n return this.options;\n }\n\n public setOptions(\n newOptions: CommonOptions<TOptions>,\n storePrevious: boolean = false\n ) {\n if (storePrevious && !equal(this.options, newOptions)) {\n this.previousOptions = this.options;\n }\n this.options = newOptions;\n }\n\n public abstract execute(...args: any): any;\n public abstract afterExecute(...args: any): void | (() => void);\n public abstract cleanup(): void;\n\n protected unmount() {\n this.isMounted = false;\n }\n\n protected refreshClient() {\n const client =\n (this.options && this.options.client) ||\n (this.context && this.context.client);\n\n invariant(\n !!client,\n 'Could not find \"client\" in the context or passed in as an option. ' +\n 'Wrap the root component in an <ApolloProvider>, or pass an ' +\n 'ApolloClient instance in via options.'\n );\n\n let isNew = false;\n if (client !== this.client) {\n isNew = true;\n this.client = client;\n this.cleanup();\n }\n return {\n client: this.client as ApolloClient<object>,\n isNew\n };\n }\n\n protected verifyDocumentType(document: DocumentNode, type: DocumentType) {\n const operation = parser(document);\n const requiredOperationName = operationName(type);\n const usedOperationName = operationName(operation.type);\n invariant(\n operation.type === type,\n `Running a ${requiredOperationName} requires a graphql ` +\n `${requiredOperationName}, but a ${usedOperationName} was used instead.`\n );\n }\n}\n"]}
1
+ {"version":3,"file":"OperationData.js","sourceRoot":"","sources":["../../../src/react/data/OperationData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,OAAO,EAAgB,MAAM,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAGhE;IAUE,uBAAY,OAAiC,EAAE,OAAa;QATrD,cAAS,GAAY,KAAK,CAAC;QAC3B,oBAAe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AAkB;QACrE,IAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QACnC,IAAM,qBAAqB,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QAClD,IAAM,iBAAiB,GAAG,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACxD,SAAS,CACP,SAAS,CAAC,IAAI,KAAK,IAAI,EACvB,eAAa,qBAAqB,yBAAsB;aACnD,qBAAqB,gBAAW,iBAAiB,uBAAoB,CAAA,CAC3E,CAAC;IACJ,CAAC;IACH,oBAAC;AAAD,CAAC,AAvED,IAuEC","sourcesContent":["import { invariant } from '../../utilities/globals';\n\nimport { DocumentNode } from 'graphql';\nimport { equal } from '@wry/equality';\n\nimport { ApolloClient } from '../../core';\nimport { DocumentType, parser, operationName } from '../parser';\nimport { CommonOptions } from '../types/types';\n\nexport abstract class OperationData<TOptions = any> {\n public isMounted: boolean = false;\n public previousOptions: CommonOptions<TOptions> = {} as CommonOptions<\n TOptions\n >;\n public context: any = {};\n public client: ApolloClient<object>;\n\n private options: CommonOptions<TOptions> = {} as CommonOptions<TOptions>;\n\n constructor(options?: CommonOptions<TOptions>, context?: any) {\n this.options = options || ({} as CommonOptions<TOptions>);\n this.context = context || {};\n }\n\n public getOptions(): CommonOptions<TOptions> {\n return this.options;\n }\n\n public setOptions(\n newOptions: CommonOptions<TOptions>,\n storePrevious: boolean = false\n ) {\n if (storePrevious && !equal(this.options, newOptions)) {\n this.previousOptions = this.options;\n }\n this.options = newOptions;\n }\n\n public abstract execute(...args: any): any;\n public abstract afterExecute(...args: any): void | (() => void);\n public abstract cleanup(): void;\n\n protected unmount() {\n this.isMounted = false;\n }\n\n protected refreshClient() {\n const client =\n (this.options && this.options.client) ||\n (this.context && this.context.client);\n\n invariant(\n !!client,\n 'Could not find \"client\" in the context or passed in as an option. ' +\n 'Wrap the root component in an <ApolloProvider>, or pass an ' +\n 'ApolloClient instance in via options.'\n );\n\n let isNew = false;\n if (client !== this.client) {\n isNew = true;\n this.client = client;\n this.cleanup();\n }\n return {\n client: this.client as ApolloClient<object>,\n isNew\n };\n }\n\n protected verifyDocumentType(document: DocumentNode, type: DocumentType) {\n const operation = parser(document);\n const requiredOperationName = operationName(type);\n const usedOperationName = operationName(operation.type);\n invariant(\n operation.type === type,\n `Running a ${requiredOperationName} requires a graphql ` +\n `${requiredOperationName}, but a ${usedOperationName} was used instead.`\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"QueryData.d.ts","sourceRoot":"","sources":["../../../src/react/data/QueryData.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,eAAe,EAKhB,MAAM,YAAY,CAAC;AAOpB,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,UAAU,EAGX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKhD,qBAAa,SAAS,CAAC,KAAK,EAAE,UAAU,CAAE,SAAQ,aAAa,CAC7D,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,CACpC;IACQ,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,iBAAiB,CAAC,EAAE,eAAe,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC9D,OAAO,CAAC,mBAAmB,CAAC,CAAyB;IACrD,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,WAAW,CAAC,CAA+B;IACnD,OAAO,CAAC,QAAQ,CAQQ;gBAEZ,EACV,OAAO,EACP,OAAO,EACP,SAAS,EACV,EAAE;QACD,OAAO,EAAE,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAC7C,OAAO,EAAE,GAAG,CAAC;QACb,SAAS,EAAE,MAAM,IAAI,CAAC;KACvB;IAKM,OAAO,IAAI,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC;IAezC,WAAW,IAAI,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC;IAe5C,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC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IACjC,OAAO,CAAC,WAAW,CAAC,CAA+B;IACnD,OAAO,CAAC,QAAQ,CAQQ;gBAEZ,EACV,OAAO,EACP,OAAO,EACP,SAAS,EACV,EAAE;QACD,OAAO,EAAE,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAC7C,OAAO,EAAE,GAAG,CAAC;QACb,SAAS,EAAE,MAAM,IAAI,CAAC;KACvB;IAKM,OAAO,IAAI,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC;IAezC,WAAW,IAAI,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC;IAe5C,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO;IAMpC,YAAY,CAAC,EAAE,IAAY,EAAE,GAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAO;IAetD,OAAO;IAMP,UAAU;IAsBV,YAAY;IAInB,OAAO,CAAC,YAAY,CAKlB;IAEF,OAAO,CAAC,mBAAmB;IA+B3B,OAAO,CAAC,6BAA6B;IAsBrC,OAAO,CAAC,yBAAyB;IA8BjC,OAAO,CAAC,qBAAqB;IAqC7B,OAAO,CAAC,sBAAsB;IAmC9B,OAAO,CAAC,kBAAkB;IAsB1B,OAAO,CAAC,gBAAgB;IA0GxB,OAAO,CAAC,sBAAsB;IAgC9B,OAAO,CAAC,uBAAuB;IAO/B,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,UAAU,CAC2B;IAE7C,OAAO,CAAC,YAAY,CAGqC;IAEzD,OAAO,CAAC,cAAc,CAK0B;IAEhD,OAAO,CAAC,eAAe,CAErB;IAEF,OAAO,CAAC,cAAc,CAEpB;IAEF,OAAO,CAAC,kBAAkB,CAS4B;IAEtD,OAAO,CAAC,qBAAqB;CAW9B"}
@@ -67,9 +67,7 @@ var QueryData = (function (_super) {
67
67
  var _b = _a === void 0 ? {} : _a, _c = _b.lazy, lazy = _c === void 0 ? false : _c;
68
68
  this.isMounted = true;
69
69
  var options = this.getOptions();
70
- if (this.currentObservable &&
71
- !this.ssrInitiated() &&
72
- !this.client.disableNetworkFetches) {
70
+ if (this.currentObservable && !this.ssrInitiated()) {
73
71
  this.startQuerySubscription();
74
72
  }
75
73
  if (!lazy || this.runLazy) {