@apollo/client 3.4.9 → 3.4.10

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 (213) hide show
  1. package/apollo-client.cjs.js +24 -52
  2. package/apollo-client.cjs.js.map +1 -1
  3. package/apollo-core.cjs.js +22 -16
  4. package/apollo-core.cjs.js.map +1 -1
  5. package/apollo-core.cjs.min.js +1 -1
  6. package/cache/cache.cjs.js +20 -22
  7. package/cache/cache.cjs.js.map +1 -1
  8. package/cache/index.d.ts +1 -0
  9. package/cache/index.d.ts.map +1 -1
  10. package/cache/index.js +1 -2
  11. package/cache/index.js.map +1 -1
  12. package/cache/inmemory/entityStore.js +1 -1
  13. package/cache/inmemory/entityStore.js.map +1 -1
  14. package/cache/inmemory/object-canon.d.ts +1 -0
  15. package/cache/inmemory/object-canon.d.ts.map +1 -1
  16. package/cache/inmemory/object-canon.js +1 -0
  17. package/cache/inmemory/object-canon.js.map +1 -1
  18. package/cache/inmemory/policies.d.ts.map +1 -1
  19. package/cache/inmemory/policies.js +1 -1
  20. package/cache/inmemory/policies.js.map +1 -1
  21. package/cache/inmemory/readFromStore.d.ts.map +1 -1
  22. package/cache/inmemory/readFromStore.js +1 -1
  23. package/cache/inmemory/readFromStore.js.map +1 -1
  24. package/cache/inmemory/writeToStore.d.ts.map +1 -1
  25. package/cache/inmemory/writeToStore.js +1 -1
  26. package/cache/inmemory/writeToStore.js.map +1 -1
  27. package/core/ApolloClient.d.ts.map +1 -1
  28. package/core/ApolloClient.js +1 -1
  29. package/core/ApolloClient.js.map +1 -1
  30. package/core/LocalState.d.ts.map +1 -1
  31. package/core/LocalState.js +1 -1
  32. package/core/LocalState.js.map +1 -1
  33. package/core/ObservableQuery.d.ts.map +1 -1
  34. package/core/ObservableQuery.js +18 -5
  35. package/core/ObservableQuery.js.map +1 -1
  36. package/core/QueryManager.d.ts.map +1 -1
  37. package/core/QueryManager.js +1 -1
  38. package/core/QueryManager.js.map +1 -1
  39. package/core/core.cjs.js +47 -34
  40. package/core/core.cjs.js.map +1 -1
  41. package/core/index.d.ts.map +1 -1
  42. package/core/index.js +1 -2
  43. package/core/index.js.map +1 -1
  44. package/errors/errors.cjs.js +1 -1
  45. package/errors/errors.cjs.js.map +1 -1
  46. package/errors/index.d.ts +1 -0
  47. package/errors/index.d.ts.map +1 -1
  48. package/errors/index.js +1 -2
  49. package/errors/index.js.map +1 -1
  50. package/invariantErrorCodes.js +1 -1
  51. package/link/core/ApolloLink.js +1 -1
  52. package/link/core/ApolloLink.js.map +1 -1
  53. package/link/core/core.cjs.js +4 -6
  54. package/link/core/core.cjs.js.map +1 -1
  55. package/link/core/index.d.ts +1 -0
  56. package/link/core/index.d.ts.map +1 -1
  57. package/link/core/index.js +1 -2
  58. package/link/core/index.js.map +1 -1
  59. package/link/http/checkFetcher.js +1 -1
  60. package/link/http/checkFetcher.js.map +1 -1
  61. package/link/http/createHttpLink.d.ts +1 -0
  62. package/link/http/createHttpLink.d.ts.map +1 -1
  63. package/link/http/createHttpLink.js +1 -0
  64. package/link/http/createHttpLink.js.map +1 -1
  65. package/link/http/http.cjs.js +4 -6
  66. package/link/http/http.cjs.js.map +1 -1
  67. package/link/http/index.d.ts +1 -0
  68. package/link/http/index.d.ts.map +1 -1
  69. package/link/http/index.js +1 -2
  70. package/link/http/index.js.map +1 -1
  71. package/link/http/serializeFetchParameter.d.ts +1 -1
  72. package/link/http/serializeFetchParameter.d.ts.map +1 -1
  73. package/link/http/serializeFetchParameter.js +1 -1
  74. package/link/http/serializeFetchParameter.js.map +1 -1
  75. package/link/persisted-queries/index.d.ts.map +1 -1
  76. package/link/persisted-queries/index.js +1 -3
  77. package/link/persisted-queries/index.js.map +1 -1
  78. package/link/persisted-queries/persisted-queries.cjs.js +5 -6
  79. package/link/persisted-queries/persisted-queries.cjs.js.map +1 -1
  80. package/link/utils/index.d.ts +1 -0
  81. package/link/utils/index.d.ts.map +1 -1
  82. package/link/utils/index.js +1 -2
  83. package/link/utils/index.js.map +1 -1
  84. package/link/utils/toPromise.d.ts.map +1 -1
  85. package/link/utils/toPromise.js +1 -1
  86. package/link/utils/toPromise.js.map +1 -1
  87. package/link/utils/utils.cjs.js +3 -5
  88. package/link/utils/utils.cjs.js.map +1 -1
  89. package/link/utils/validateOperation.d.ts.map +1 -1
  90. package/link/utils/validateOperation.js +1 -1
  91. package/link/utils/validateOperation.js.map +1 -1
  92. package/package.json +1 -1
  93. package/react/context/ApolloConsumer.d.ts.map +1 -1
  94. package/react/context/ApolloConsumer.js +1 -1
  95. package/react/context/ApolloConsumer.js.map +1 -1
  96. package/react/context/ApolloProvider.d.ts.map +1 -1
  97. package/react/context/ApolloProvider.js +1 -1
  98. package/react/context/ApolloProvider.js.map +1 -1
  99. package/react/context/context.cjs.js +6 -8
  100. package/react/context/context.cjs.js.map +1 -1
  101. package/react/context/index.d.ts +1 -0
  102. package/react/context/index.d.ts.map +1 -1
  103. package/react/context/index.js +1 -2
  104. package/react/context/index.js.map +1 -1
  105. package/react/data/OperationData.d.ts.map +1 -1
  106. package/react/data/OperationData.js +1 -1
  107. package/react/data/OperationData.js.map +1 -1
  108. package/react/data/QueryData.d.ts.map +1 -1
  109. package/react/data/QueryData.js +1 -3
  110. package/react/data/QueryData.js.map +1 -1
  111. package/react/data/data.cjs.js +6 -11
  112. package/react/data/data.cjs.js.map +1 -1
  113. package/react/data/index.d.ts +1 -0
  114. package/react/data/index.d.ts.map +1 -1
  115. package/react/data/index.js +1 -2
  116. package/react/data/index.js.map +1 -1
  117. package/react/hoc/hoc-utils.d.ts.map +1 -1
  118. package/react/hoc/hoc-utils.js +1 -1
  119. package/react/hoc/hoc-utils.js.map +1 -1
  120. package/react/hoc/hoc.cjs.js +5 -8
  121. package/react/hoc/hoc.cjs.js.map +1 -1
  122. package/react/hoc/index.d.ts +1 -0
  123. package/react/hoc/index.d.ts.map +1 -1
  124. package/react/hoc/index.js +1 -2
  125. package/react/hoc/index.js.map +1 -1
  126. package/react/hoc/withApollo.d.ts.map +1 -1
  127. package/react/hoc/withApollo.js +1 -1
  128. package/react/hoc/withApollo.js.map +1 -1
  129. package/react/hooks/hooks.cjs.js +3 -6
  130. package/react/hooks/hooks.cjs.js.map +1 -1
  131. package/react/hooks/index.d.ts +1 -0
  132. package/react/hooks/index.d.ts.map +1 -1
  133. package/react/hooks/index.js +1 -2
  134. package/react/hooks/index.js.map +1 -1
  135. package/react/hooks/useApolloClient.d.ts.map +1 -1
  136. package/react/hooks/useApolloClient.js +1 -1
  137. package/react/hooks/useApolloClient.js.map +1 -1
  138. package/react/hooks/useSubscription.d.ts +1 -0
  139. package/react/hooks/useSubscription.d.ts.map +1 -1
  140. package/react/hooks/useSubscription.js +1 -0
  141. package/react/hooks/useSubscription.js.map +1 -1
  142. package/react/hooks/utils/useAfterFastRefresh.d.ts +1 -0
  143. package/react/hooks/utils/useAfterFastRefresh.d.ts.map +1 -1
  144. package/react/hooks/utils/useAfterFastRefresh.js +1 -0
  145. package/react/hooks/utils/useAfterFastRefresh.js.map +1 -1
  146. package/react/hooks/utils/useBaseQuery.d.ts +1 -0
  147. package/react/hooks/utils/useBaseQuery.d.ts.map +1 -1
  148. package/react/hooks/utils/useBaseQuery.js +1 -0
  149. package/react/hooks/utils/useBaseQuery.js.map +1 -1
  150. package/react/index.d.ts +1 -0
  151. package/react/index.d.ts.map +1 -1
  152. package/react/index.js +1 -2
  153. package/react/index.js.map +1 -1
  154. package/react/parser/index.d.ts.map +1 -1
  155. package/react/parser/index.js +1 -3
  156. package/react/parser/index.js.map +1 -1
  157. package/react/parser/parser.cjs.js +9 -11
  158. package/react/parser/parser.cjs.js.map +1 -1
  159. package/react/react.cjs.js +2 -2
  160. package/react/react.cjs.js.map +1 -1
  161. package/testing/index.d.ts +1 -0
  162. package/testing/index.d.ts.map +1 -1
  163. package/testing/index.js +1 -2
  164. package/testing/index.js.map +1 -1
  165. package/testing/testing.cjs.js +3 -5
  166. package/testing/testing.cjs.js.map +1 -1
  167. package/utilities/globals/DEV.js +2 -2
  168. package/utilities/globals/DEV.js.map +1 -1
  169. package/utilities/{common → globals}/global.d.ts +0 -0
  170. package/utilities/globals/global.d.ts.map +1 -0
  171. package/utilities/{common → globals}/global.js +0 -0
  172. package/utilities/globals/global.js.map +1 -0
  173. package/utilities/globals/globals.cjs.js +56 -0
  174. package/utilities/globals/globals.cjs.js.map +1 -0
  175. package/utilities/globals/index.d.ts +4 -2
  176. package/utilities/globals/index.d.ts.map +1 -1
  177. package/utilities/globals/index.js +4 -2
  178. package/utilities/globals/index.js.map +1 -1
  179. package/utilities/{common → globals}/maybe.d.ts +0 -0
  180. package/utilities/globals/maybe.d.ts.map +1 -0
  181. package/utilities/{common → globals}/maybe.js +0 -0
  182. package/utilities/globals/maybe.js.map +1 -0
  183. package/utilities/globals/package.json +7 -0
  184. package/utilities/graphql/directives.d.ts.map +1 -1
  185. package/utilities/graphql/directives.js +1 -1
  186. package/utilities/graphql/directives.js.map +1 -1
  187. package/utilities/graphql/fragments.d.ts.map +1 -1
  188. package/utilities/graphql/fragments.js +1 -1
  189. package/utilities/graphql/fragments.js.map +1 -1
  190. package/utilities/graphql/getFromAST.d.ts.map +1 -1
  191. package/utilities/graphql/getFromAST.js +1 -1
  192. package/utilities/graphql/getFromAST.js.map +1 -1
  193. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  194. package/utilities/graphql/storeUtils.js +1 -1
  195. package/utilities/graphql/storeUtils.js.map +1 -1
  196. package/utilities/graphql/transform.d.ts.map +1 -1
  197. package/utilities/graphql/transform.js +1 -1
  198. package/utilities/graphql/transform.js.map +1 -1
  199. package/utilities/index.d.ts +1 -3
  200. package/utilities/index.d.ts.map +1 -1
  201. package/utilities/index.js +1 -4
  202. package/utilities/index.js.map +1 -1
  203. package/utilities/package.json +1 -3
  204. package/utilities/testing/mocking/mockLink.d.ts.map +1 -1
  205. package/utilities/testing/mocking/mockLink.js +1 -1
  206. package/utilities/testing/mocking/mockLink.js.map +1 -1
  207. package/utilities/utilities.cjs.js +23 -68
  208. package/utilities/utilities.cjs.js.map +1 -1
  209. package/version.js +1 -1
  210. package/utilities/common/global.d.ts.map +0 -1
  211. package/utilities/common/global.js.map +0 -1
  212. package/utilities/common/maybe.d.ts.map +0 -1
  213. package/utilities/common/maybe.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,QAAQ,EAAE,CAAC;AAEX,OAAO,EACL,yBAAyB,EAE1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,uBAAuB,EAExB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,kBAAkB,EAClB,wBAAwB,EAEzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["import { checkDEV } from \"../../utilities\";\ncheckDEV();\n\nexport {\n parseAndCheckHttpResponse,\n ServerParseError\n} from './parseAndCheckHttpResponse';\nexport {\n serializeFetchParameter,\n ClientParseError\n} from './serializeFetchParameter';\nexport {\n HttpOptions,\n fallbackHttpConfig,\n selectHttpOptionsAndBody,\n UriFunction\n} from './selectHttpOptionsAndBody';\nexport { checkFetcher } from './checkFetcher';\nexport { createSignalIfSupported } from './createSignalIfSupported';\nexport { selectURI } from './selectURI';\nexport { createHttpLink } from './createHttpLink';\nexport { HttpLink } from './HttpLink';\nexport { rewriteURIForGET } from './rewriteURIForGET';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EACL,yBAAyB,EAE1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,uBAAuB,EAExB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,kBAAkB,EAClB,wBAAwB,EAEzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["import '../../utilities/globals';\n\nexport {\n parseAndCheckHttpResponse,\n ServerParseError\n} from './parseAndCheckHttpResponse';\nexport {\n serializeFetchParameter,\n ClientParseError\n} from './serializeFetchParameter';\nexport {\n HttpOptions,\n fallbackHttpConfig,\n selectHttpOptionsAndBody,\n UriFunction\n} from './selectHttpOptionsAndBody';\nexport { checkFetcher } from './checkFetcher';\nexport { createSignalIfSupported } from './createSignalIfSupported';\nexport { selectURI } from './selectURI';\nexport { createHttpLink } from './createHttpLink';\nexport { HttpLink } from './HttpLink';\nexport { rewriteURIForGET } from './rewriteURIForGET';\n"]}
@@ -1,4 +1,4 @@
1
- import { InvariantError } from 'ts-invariant';
1
+ import { InvariantError } from '../../utilities/globals';
2
2
  export declare type ClientParseError = InvariantError & {
3
3
  parseError: Error;
4
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"serializeFetchParameter.d.ts","sourceRoot":"","sources":["../../../src/link/http/serializeFetchParameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,oBAAY,gBAAgB,GAAG,cAAc,GAAG;IAC9C,UAAU,EAAE,KAAK,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,uBAAuB,MAAO,GAAG,SAAS,MAAM,WAY5D,CAAC"}
1
+ {"version":3,"file":"serializeFetchParameter.d.ts","sourceRoot":"","sources":["../../../src/link/http/serializeFetchParameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,oBAAY,gBAAgB,GAAG,cAAc,GAAG;IAC9C,UAAU,EAAE,KAAK,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,uBAAuB,MAAO,GAAG,SAAS,MAAM,WAY5D,CAAC"}
@@ -1,4 +1,4 @@
1
- import { InvariantError } from 'ts-invariant';
1
+ import { InvariantError } from "../../utilities/globals/index.js";
2
2
  export var serializeFetchParameter = function (p, label) {
3
3
  var serialized;
4
4
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"serializeFetchParameter.js","sourceRoot":"","sources":["../../../src/link/http/serializeFetchParameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAM9C,MAAM,CAAC,IAAM,uBAAuB,GAAG,UAAC,CAAM,EAAE,KAAa;IAC3D,IAAI,UAAU,CAAC;IACf,IAAI;QACF,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KAChC;IAAC,OAAO,CAAC,EAAE;QACV,IAAM,UAAU,GAAG,IAAI,cAAc,CACnC,6BAA2B,KAAK,8BAAyB,CAAC,CAAC,OAAS,CACjD,CAAC;QACtB,UAAU,CAAC,UAAU,GAAG,CAAC,CAAC;QAC1B,MAAM,UAAU,CAAC;KAClB;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC","sourcesContent":["import { InvariantError } from 'ts-invariant';\n\nexport type ClientParseError = InvariantError & {\n parseError: Error;\n};\n\nexport const serializeFetchParameter = (p: any, label: string) => {\n let serialized;\n try {\n serialized = JSON.stringify(p);\n } catch (e) {\n const parseError = new InvariantError(\n `Network request failed. ${label} is not serializable: ${e.message}`,\n ) as ClientParseError;\n parseError.parseError = e;\n throw parseError;\n }\n return serialized;\n};\n"]}
1
+ {"version":3,"file":"serializeFetchParameter.js","sourceRoot":"","sources":["../../../src/link/http/serializeFetchParameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAMzD,MAAM,CAAC,IAAM,uBAAuB,GAAG,UAAC,CAAM,EAAE,KAAa;IAC3D,IAAI,UAAU,CAAC;IACf,IAAI;QACF,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KAChC;IAAC,OAAO,CAAC,EAAE;QACV,IAAM,UAAU,GAAG,IAAI,cAAc,CACnC,6BAA2B,KAAK,8BAAyB,CAAC,CAAC,OAAS,CACjD,CAAC;QACtB,UAAU,CAAC,UAAU,GAAG,CAAC,CAAC;QAC1B,MAAM,UAAU,CAAC;KAClB;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC","sourcesContent":["import { InvariantError } from '../../utilities/globals';\n\nexport type ClientParseError = InvariantError & {\n parseError: Error;\n};\n\nexport const serializeFetchParameter = (p: any, label: string) => {\n let serialized;\n try {\n serialized = JSON.stringify(p);\n } catch (e) {\n const parseError = new InvariantError(\n `Network request failed. ${label} is not serializable: ${e.message}`,\n ) as ClientParseError;\n parseError.parseError = e;\n throw parseError;\n }\n return serialized;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/link/persisted-queries/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACb,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGhD,eAAO,MAAM,OAAO,IAAI,CAAC;AAEzB,MAAM,WAAW,aAAa;IAC5B,aAAa,CAAC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e,CAAC;IAC3B,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,aAAK,cAAc,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AACvE,aAAK,oBAAoB,GAAG,CAAC,QAAQ,EAAE,YAAY,KAAK,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAErF,kBAAU,kBAAkB,CAAC;IAC3B,UAAU,WAAW;QACnB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC;QAC5C,sBAAsB,CAAC,EAAE,OAAO,CAAC;KAClC;IAED,UAAU,aAAc,SAAQ,WAAW;QACzC,MAAM,EAAE,cAAc,CAAC;QACvB,YAAY,CAAC,EAAE,KAAK,CAAC;KACtB;IAED,UAAU,mBAAoB,SAAQ,WAAW;QAC/C,MAAM,CAAC,EAAE,KAAK,CAAC;QACf,YAAY,EAAE,oBAAoB,CAAC;KACpC;IAED,MAAM,MAAM,OAAO,GAAG,aAAa,GAAG,mBAAmB,CAAC;;CAC3D;AA4CD,eAAO,MAAM,wBAAwB,YAC1B,mBAAmB,OAAO,eAiLpC,CAAC"}
@@ -1,8 +1,6 @@
1
1
  import { __assign } from "tslib";
2
- import { checkDEV } from "../../utilities/index.js";
3
- checkDEV();
2
+ import { invariant } from "../../utilities/globals/index.js";
4
3
  import { print } from 'graphql';
5
- import { invariant } from 'ts-invariant';
6
4
  import { ApolloLink } from "../core/index.js";
7
5
  import { Observable, compact } from "../../utilities/index.js";
8
6
  export var VERSION = 1;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/persisted-queries/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,QAAQ,EAAE,CAAC;AAEX,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAMhC,OAAO,EAAE,SAAS,EAA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BACF,eAAe,GAAG,IAAI,CAAC;aACxB;YAED,IAAI,wBAAwB,EAAE;gBAC5B,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,UAAC,UAAU;oBAClC,SAAS,CAAC,UAAU,CAAC,cAAc,GAAG;wBACpC,OAAO,EAAE,OAAO;wBAChB,UAAU,YAAA;qBACX,CAAC;oBACF,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBACvD,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAAA,CAAC;aAC3C;iBAAM;gBACL,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;aACtD;YAED,OAAO;gBACL,IAAI,YAAY;oBAAE,YAAY,CAAC,WAAW,EAAE,CAAC;YAC/C,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { checkDEV } from \"../../utilities\";\ncheckDEV();\n\nimport { print } from 'graphql';\nimport {\n DocumentNode,\n ExecutionResult,\n GraphQLError,\n} from 'graphql';\nimport { invariant } from 'ts-invariant';\n\nimport { ApolloLink, Operation } from '../core';\nimport { Observable, Observer, compact } from '../../utilities';\n\nexport const VERSION = 1;\n\nexport interface ErrorResponse {\n graphQLErrors?: readonly GraphQLError[];\n networkError?: Error;\n response?: ExecutionResult;\n operation: Operation;\n}\n\ntype SHA256Function = (...args: any[]) => string | PromiseLike<string>;\ntype GenerateHashFunction = (document: DocumentNode) => string | PromiseLike<string>;\n\nnamespace PersistedQueryLink {\n interface BaseOptions {\n disable?: (error: ErrorResponse) => boolean;\n useGETForHashedQueries?: boolean;\n };\n\n interface SHA256Options extends BaseOptions {\n sha256: SHA256Function;\n generateHash?: never;\n };\n\n interface GenerateHashOptions extends BaseOptions {\n sha256?: never;\n generateHash: GenerateHashFunction;\n };\n\n export type Options = SHA256Options | GenerateHashOptions;\n}\n\nconst defaultOptions = {\n disable: ({ graphQLErrors, operation }: ErrorResponse) => {\n // if the server doesn't support persisted queries, don't try anymore\n if (\n graphQLErrors &&\n graphQLErrors.some(\n ({ message }) => message === 'PersistedQueryNotSupported',\n )\n ) {\n return true;\n }\n\n const { response } = operation.getContext();\n // if the server responds with bad request\n // apollo-server responds with 400 for GET and 500 for POST when no query is found\n if (\n response &&\n response.status &&\n (response.status === 400 || response.status === 500)\n ) {\n return true;\n }\n\n return false;\n },\n useGETForHashedQueries: false,\n};\n\nfunction operationDefinesMutation(operation: Operation) {\n return operation.query.definitions.some(\n d => d.kind === 'OperationDefinition' && d.operation === 'mutation');\n}\n\nconst { hasOwnProperty } = Object.prototype;\n\nconst hashesByQuery = new WeakMap<\n DocumentNode,\n Record<string, Promise<string>>\n>();\n\nlet nextHashesChildKey = 0;\n\nexport const createPersistedQueryLink = (\n options: PersistedQueryLink.Options,\n) => {\n // Ensure a SHA-256 hash function is provided, if a custom hash\n // generation function is not provided. We don't supply a SHA-256 hash\n // function by default, to avoid forcing one as a dependency. Developers\n // should pick the most appropriate SHA-256 function (sync or async) for\n // their needs/environment, or provide a fully custom hash generation\n // function (via the `generateHash` option) if they want to handle\n // hashing with something other than SHA-256.\n invariant(\n options && (\n typeof options.sha256 === 'function' ||\n typeof options.generateHash === 'function'\n ),\n 'Missing/invalid \"sha256\" or \"generateHash\" function. Please ' +\n 'configure one using the \"createPersistedQueryLink(options)\" options ' +\n 'parameter.'\n );\n\n const {\n sha256,\n // If both a `sha256` and `generateHash` option are provided, the\n // `sha256` option will be ignored. Developers can configure and\n // use any hashing approach they want in a custom `generateHash`\n // function; they aren't limited to SHA-256.\n generateHash = (query: DocumentNode) =>\n Promise.resolve<string>(sha256!(print(query))),\n disable,\n useGETForHashedQueries\n } = compact(defaultOptions, options);\n\n let supportsPersistedQueries = true;\n\n const hashesChildKey = 'forLink' + nextHashesChildKey++;\n\n const getHashPromise = (query: DocumentNode) =>\n new Promise<string>(resolve => resolve(generateHash(query)));\n\n function getQueryHash(query: DocumentNode): Promise<string> {\n if (!query || typeof query !== 'object') {\n // If the query is not an object, we won't be able to store its hash as\n // a property of query[hashesKey], so we let generateHash(query) decide\n // what to do with the bogus query.\n return getHashPromise(query);\n }\n let hashes = hashesByQuery.get(query)!;\n if (!hashes) hashesByQuery.set(query, hashes = Object.create(null));\n return hasOwnProperty.call(hashes, hashesChildKey)\n ? hashes[hashesChildKey]\n : hashes[hashesChildKey] = getHashPromise(query);\n }\n\n return new ApolloLink((operation, forward) => {\n invariant(\n forward,\n 'PersistedQueryLink cannot be the last link in the chain.'\n );\n\n const { query } = operation;\n\n return new Observable((observer: Observer<ExecutionResult>) => {\n let subscription: ZenObservable.Subscription;\n let retried = false;\n let originalFetchOptions: any;\n let setFetchOptions = false;\n const retry = (\n {\n response,\n networkError,\n }: { response?: ExecutionResult; networkError?: Error },\n cb: () => void,\n ) => {\n if (!retried && ((response && response.errors) || networkError)) {\n retried = true;\n\n const disablePayload = {\n response,\n networkError,\n operation,\n graphQLErrors: response ? response.errors : undefined,\n };\n\n // if the server doesn't support persisted queries, don't try anymore\n supportsPersistedQueries = !disable(disablePayload);\n\n // if its not found, we can try it again, otherwise just report the error\n if (\n (response &&\n response.errors &&\n response.errors.some(\n ({ message }: { message: string }) =>\n message === 'PersistedQueryNotFound',\n )) ||\n !supportsPersistedQueries\n ) {\n // need to recall the link chain\n if (subscription) subscription.unsubscribe();\n // actually send the query this time\n operation.setContext({\n http: {\n includeQuery: true,\n includeExtensions: supportsPersistedQueries,\n },\n fetchOptions: {\n // Since we're including the full query, which may be\n // large, we should send it in the body of a POST request.\n // See issue #7456.\n method: 'POST',\n },\n });\n if (setFetchOptions) {\n operation.setContext({ fetchOptions: originalFetchOptions });\n }\n subscription = forward(operation).subscribe(handler);\n\n return;\n }\n }\n cb();\n };\n const handler = {\n next: (response: ExecutionResult) => {\n retry({ response }, () => observer.next!(response));\n },\n error: (networkError: Error) => {\n retry({ networkError }, () => observer.error!(networkError));\n },\n complete: observer.complete!.bind(observer),\n };\n\n // don't send the query the first time\n operation.setContext({\n http: {\n includeQuery: !supportsPersistedQueries,\n includeExtensions: supportsPersistedQueries,\n },\n });\n\n // If requested, set method to GET if there are no mutations. Remember the\n // original fetchOptions so we can restore them if we fall back to a\n // non-hashed request.\n if (\n useGETForHashedQueries &&\n supportsPersistedQueries &&\n !operationDefinesMutation(operation)\n ) {\n operation.setContext(\n ({ fetchOptions = {} }: { fetchOptions: Record<string, any> }) => {\n originalFetchOptions = fetchOptions;\n return {\n fetchOptions: {\n ...fetchOptions,\n method: 'GET',\n },\n };\n },\n );\n setFetchOptions = true;\n }\n\n if (supportsPersistedQueries) {\n getQueryHash(query).then((sha256Hash) => {\n operation.extensions.persistedQuery = {\n version: VERSION,\n sha256Hash,\n };\n subscription = forward(operation).subscribe(handler);\n }).catch(observer.error!.bind(observer));;\n } else {\n subscription = forward(operation).subscribe(handler);\n }\n\n return () => {\n if (subscription) subscription.unsubscribe();\n };\n });\n });\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/persisted-queries/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAOhC,OAAO,EAAE,UAAU,EAAa,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,UAAU,EAAY,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEhE,MAAM,CAAC,IAAM,OAAO,GAAG,CAAC,CAAC;AAYzB,IAAU,kBAAkB,CAiB3B;AAjBD,WAAU,kBAAkB;IAIzB,CAAC;IAKD,CAAC;IAKD,CAAC;AAGJ,CAAC,EAjBS,kBAAkB,KAAlB,kBAAkB,QAiB3B;AAED,IAAM,cAAc,GAAG;IACrB,OAAO,EAAE,UAAC,EAA2C;YAAzC,aAAa,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AC,CAAC;gBAAA,CAAC;aAC3C;iBAAM;gBACL,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;aACtD;YAED,OAAO;gBACL,IAAI,YAAY;oBAAE,YAAY,CAAC,WAAW,EAAE,CAAC;YAC/C,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { invariant } from '../../utilities/globals';\n\nimport { print } from 'graphql';\nimport {\n DocumentNode,\n ExecutionResult,\n GraphQLError,\n} from 'graphql';\n\nimport { ApolloLink, Operation } from '../core';\nimport { Observable, Observer, compact } from '../../utilities';\n\nexport const VERSION = 1;\n\nexport interface ErrorResponse {\n graphQLErrors?: readonly GraphQLError[];\n networkError?: Error;\n response?: ExecutionResult;\n operation: Operation;\n}\n\ntype SHA256Function = (...args: any[]) => string | PromiseLike<string>;\ntype GenerateHashFunction = (document: DocumentNode) => string | PromiseLike<string>;\n\nnamespace PersistedQueryLink {\n interface BaseOptions {\n disable?: (error: ErrorResponse) => boolean;\n useGETForHashedQueries?: boolean;\n };\n\n interface SHA256Options extends BaseOptions {\n sha256: SHA256Function;\n generateHash?: never;\n };\n\n interface GenerateHashOptions extends BaseOptions {\n sha256?: never;\n generateHash: GenerateHashFunction;\n };\n\n export type Options = SHA256Options | GenerateHashOptions;\n}\n\nconst defaultOptions = {\n disable: ({ graphQLErrors, operation }: ErrorResponse) => {\n // if the server doesn't support persisted queries, don't try anymore\n if (\n graphQLErrors &&\n graphQLErrors.some(\n ({ message }) => message === 'PersistedQueryNotSupported',\n )\n ) {\n return true;\n }\n\n const { response } = operation.getContext();\n // if the server responds with bad request\n // apollo-server responds with 400 for GET and 500 for POST when no query is found\n if (\n response &&\n response.status &&\n (response.status === 400 || response.status === 500)\n ) {\n return true;\n }\n\n return false;\n },\n useGETForHashedQueries: false,\n};\n\nfunction operationDefinesMutation(operation: Operation) {\n return operation.query.definitions.some(\n d => d.kind === 'OperationDefinition' && d.operation === 'mutation');\n}\n\nconst { hasOwnProperty } = Object.prototype;\n\nconst hashesByQuery = new WeakMap<\n DocumentNode,\n Record<string, Promise<string>>\n>();\n\nlet nextHashesChildKey = 0;\n\nexport const createPersistedQueryLink = (\n options: PersistedQueryLink.Options,\n) => {\n // Ensure a SHA-256 hash function is provided, if a custom hash\n // generation function is not provided. We don't supply a SHA-256 hash\n // function by default, to avoid forcing one as a dependency. Developers\n // should pick the most appropriate SHA-256 function (sync or async) for\n // their needs/environment, or provide a fully custom hash generation\n // function (via the `generateHash` option) if they want to handle\n // hashing with something other than SHA-256.\n invariant(\n options && (\n typeof options.sha256 === 'function' ||\n typeof options.generateHash === 'function'\n ),\n 'Missing/invalid \"sha256\" or \"generateHash\" function. Please ' +\n 'configure one using the \"createPersistedQueryLink(options)\" options ' +\n 'parameter.'\n );\n\n const {\n sha256,\n // If both a `sha256` and `generateHash` option are provided, the\n // `sha256` option will be ignored. Developers can configure and\n // use any hashing approach they want in a custom `generateHash`\n // function; they aren't limited to SHA-256.\n generateHash = (query: DocumentNode) =>\n Promise.resolve<string>(sha256!(print(query))),\n disable,\n useGETForHashedQueries\n } = compact(defaultOptions, options);\n\n let supportsPersistedQueries = true;\n\n const hashesChildKey = 'forLink' + nextHashesChildKey++;\n\n const getHashPromise = (query: DocumentNode) =>\n new Promise<string>(resolve => resolve(generateHash(query)));\n\n function getQueryHash(query: DocumentNode): Promise<string> {\n if (!query || typeof query !== 'object') {\n // If the query is not an object, we won't be able to store its hash as\n // a property of query[hashesKey], so we let generateHash(query) decide\n // what to do with the bogus query.\n return getHashPromise(query);\n }\n let hashes = hashesByQuery.get(query)!;\n if (!hashes) hashesByQuery.set(query, hashes = Object.create(null));\n return hasOwnProperty.call(hashes, hashesChildKey)\n ? hashes[hashesChildKey]\n : hashes[hashesChildKey] = getHashPromise(query);\n }\n\n return new ApolloLink((operation, forward) => {\n invariant(\n forward,\n 'PersistedQueryLink cannot be the last link in the chain.'\n );\n\n const { query } = operation;\n\n return new Observable((observer: Observer<ExecutionResult>) => {\n let subscription: ZenObservable.Subscription;\n let retried = false;\n let originalFetchOptions: any;\n let setFetchOptions = false;\n const retry = (\n {\n response,\n networkError,\n }: { response?: ExecutionResult; networkError?: Error },\n cb: () => void,\n ) => {\n if (!retried && ((response && response.errors) || networkError)) {\n retried = true;\n\n const disablePayload = {\n response,\n networkError,\n operation,\n graphQLErrors: response ? response.errors : undefined,\n };\n\n // if the server doesn't support persisted queries, don't try anymore\n supportsPersistedQueries = !disable(disablePayload);\n\n // if its not found, we can try it again, otherwise just report the error\n if (\n (response &&\n response.errors &&\n response.errors.some(\n ({ message }: { message: string }) =>\n message === 'PersistedQueryNotFound',\n )) ||\n !supportsPersistedQueries\n ) {\n // need to recall the link chain\n if (subscription) subscription.unsubscribe();\n // actually send the query this time\n operation.setContext({\n http: {\n includeQuery: true,\n includeExtensions: supportsPersistedQueries,\n },\n fetchOptions: {\n // Since we're including the full query, which may be\n // large, we should send it in the body of a POST request.\n // See issue #7456.\n method: 'POST',\n },\n });\n if (setFetchOptions) {\n operation.setContext({ fetchOptions: originalFetchOptions });\n }\n subscription = forward(operation).subscribe(handler);\n\n return;\n }\n }\n cb();\n };\n const handler = {\n next: (response: ExecutionResult) => {\n retry({ response }, () => observer.next!(response));\n },\n error: (networkError: Error) => {\n retry({ networkError }, () => observer.error!(networkError));\n },\n complete: observer.complete!.bind(observer),\n };\n\n // don't send the query the first time\n operation.setContext({\n http: {\n includeQuery: !supportsPersistedQueries,\n includeExtensions: supportsPersistedQueries,\n },\n });\n\n // If requested, set method to GET if there are no mutations. Remember the\n // original fetchOptions so we can restore them if we fall back to a\n // non-hashed request.\n if (\n useGETForHashedQueries &&\n supportsPersistedQueries &&\n !operationDefinesMutation(operation)\n ) {\n operation.setContext(\n ({ fetchOptions = {} }: { fetchOptions: Record<string, any> }) => {\n originalFetchOptions = fetchOptions;\n return {\n fetchOptions: {\n ...fetchOptions,\n method: 'GET',\n },\n };\n },\n );\n setFetchOptions = true;\n }\n\n if (supportsPersistedQueries) {\n getQueryHash(query).then((sha256Hash) => {\n operation.extensions.persistedQuery = {\n version: VERSION,\n sha256Hash,\n };\n subscription = forward(operation).subscribe(handler);\n }).catch(observer.error!.bind(observer));;\n } else {\n subscription = forward(operation).subscribe(handler);\n }\n\n return () => {\n if (subscription) subscription.unsubscribe();\n };\n });\n });\n};\n"]}
@@ -3,12 +3,11 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib = require('tslib');
6
- var utilities = require('../../utilities');
6
+ var globals = require('../../utilities/globals');
7
7
  var graphql = require('graphql');
8
- var tsInvariant = require('ts-invariant');
9
8
  var core = require('../core');
9
+ var utilities = require('../../utilities');
10
10
 
11
- utilities.checkDEV();
12
11
  var VERSION = 1;
13
12
  var defaultOptions = {
14
13
  disable: function (_a) {
@@ -37,10 +36,10 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
37
36
  var hashesByQuery = new WeakMap();
38
37
  var nextHashesChildKey = 0;
39
38
  var createPersistedQueryLink = function (options) {
40
- __DEV__ ? tsInvariant.invariant(options && (typeof options.sha256 === 'function' ||
39
+ __DEV__ ? globals.invariant(options && (typeof options.sha256 === 'function' ||
41
40
  typeof options.generateHash === 'function'), 'Missing/invalid "sha256" or "generateHash" function. Please ' +
42
41
  'configure one using the "createPersistedQueryLink(options)" options ' +
43
- 'parameter.') : tsInvariant.invariant(options && (typeof options.sha256 === 'function' ||
42
+ 'parameter.') : globals.invariant(options && (typeof options.sha256 === 'function' ||
44
43
  typeof options.generateHash === 'function'), 24);
45
44
  var _a = utilities.compact(defaultOptions, options), sha256 = _a.sha256, _b = _a.generateHash, generateHash = _b === void 0 ? function (query) {
46
45
  return Promise.resolve(sha256(graphql.print(query)));
@@ -62,7 +61,7 @@ var createPersistedQueryLink = function (options) {
62
61
  : hashes[hashesChildKey] = getHashPromise(query);
63
62
  }
64
63
  return new core.ApolloLink(function (operation, forward) {
65
- __DEV__ ? tsInvariant.invariant(forward, 'PersistedQueryLink cannot be the last link in the chain.') : tsInvariant.invariant(forward, 25);
64
+ __DEV__ ? globals.invariant(forward, 'PersistedQueryLink cannot be the last link in the chain.') : globals.invariant(forward, 25);
66
65
  var query = operation.query;
67
66
  return new utilities.Observable(function (observer) {
68
67
  var subscription;
@@ -1 +1 @@
1
- {"version":3,"file":"persisted-queries.cjs.js","sources":["index.js"],"sourcesContent":["import { __assign } from \"tslib\";\nimport { checkDEV } from \"../../utilities\";\ncheckDEV();\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'), 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":["checkDEV","invariant","compact","print","ApolloLink","Observable","__assign"],"mappings":";;;;;;;;;;AAEAA,kBAAQ,EAAE,CAAC;AAKD,IAAC,OAAO,GAAG,EAAE;AAOvB,IAAI,cAAc,GAAG;AACrB,IAAI,OAAO,EAAE,UAAU,EAAE,EAAE;AAC3B,QAAQ,IAAI,aAAa,GAAG,EAAE,CAAC,aAAa,EAAE,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC;AACvE,QAAQ,IAAI,aAAa;AACzB,YAAY,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE;AAC7C,gBAAgB,IAAI,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC;AACzC,gBAAgB,OAAO,OAAO,KAAK,4BAA4B,CAAC;AAChE,aAAa,CAAC,EAAE;AAChB,YAAY,OAAO,IAAI,CAAC;AACxB,SAAS;AACT,QAAQ,IAAI,QAAQ,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC,QAAQ,CAAC;AACvD,QAAQ,IAAI,QAAQ;AACpB,YAAY,QAAQ,CAAC,MAAM;AAC3B,aAAa,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC,EAAE;AAClE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;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;\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'), 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":["invariant","compact","print","ApolloLink","Observable","__assign"],"mappings":";;;;;;;;;;AAKU,IAAC,OAAO,GAAG,EAAE;AAOvB,IAAI,cAAc,GAAG;AACrB,IAAI,OAAO,EAAE,UAAU,EAAE,EAAE;AAC3B,QAAQ,IAAI,aAAa,GAAG,EAAE,CAAC,aAAa,EAAE,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC;AACvE,QAAQ,IAAI,aAAa;AACzB,YAAY,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE;AAC7C,gBAAgB,IAAI,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC;AACzC,gBAAgB,OAAO,OAAO,KAAK,4BAA4B,CAAC;AAChE,aAAa,CAAC,EAAE;AAChB,YAAY,OAAO,IAAI,CAAC;AACxB,SAAS;AACT,QAAQ,IAAI,QAAQ,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC,QAAQ,CAAC;AACvD,QAAQ,IAAI,QAAQ;AACpB,YAAY,QAAQ,CAAC,MAAM;AAC3B,aAAa,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC,EAAE;AAClE,YAAY,OAAO,IAAI,CAAC;AACxB,SAAS;AACT,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,sBAAsB,EAAE,KAAK;AACjC,CAAC,CAAC;AACF,SAAS,wBAAwB,CAAC,SAAS,EAAE;AAC7C,IAAI,OAAO,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE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AACrF,oBAAoB,oBAAoB,GAAG,YAAY,CAAC;AACxD,oBAAoB,OAAO;AAC3B,wBAAwB,YAAY,EAAEC,cAAQ,CAACA,cAAQ,CAAC,EAAE,EAAE,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC7F,qBAAqB,CAAC;AACtB,iBAAiB,CAAC,CAAC;AACnB,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,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":"AAGA,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,5 +1,4 @@
1
- import { checkDEV } from "../../utilities/index.js";
2
- checkDEV();
1
+ import "../../utilities/globals/index.js";
3
2
  export { fromError } from "./fromError.js";
4
3
  export { toPromise } from "./toPromise.js";
5
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,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,QAAQ,EAAE,CAAC;AAEX,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 { checkDEV } from \"../../utilities\";\ncheckDEV();\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
+ {"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(26);
64
+ throw __DEV__ ? new globals.InvariantError("illegal argument: " + key) : new globals.InvariantError(26);
65
65
  }
66
66
  }
67
67
  return operation;
@@ -105,8 +105,6 @@ function transformOperation(operation) {
105
105
  return transformedOperation;
106
106
  }
107
107
 
108
- utilities.checkDEV();
109
-
110
108
  exports.createOperation = createOperation;
111
109
  exports.fromError = fromError;
112
110
  exports.fromPromise = fromPromise;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs.js","sources":["fromError.js","toPromise.js","fromPromise.js","throwServerError.js","validateOperation.js","createOperation.js","transformOperation.js","index.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(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","import { checkDEV } from \"../../utilities\";\ncheckDEV();\nexport { fromError } from './fromError';\nexport { toPromise } from './toPromise';\nexport { fromPromise } from './fromPromise';\nexport { throwServerError } from './throwServerError';\nexport { validateOperation } from './validateOperation';\nexport { createOperation } from './createOperation';\nexport { transformOperation } from './transformOperation';\n//# sourceMappingURL=index.js.map"],"names":["Observable","invariant","InvariantError","__assign","getOperationName","checkDEV"],"mappings":";;;;;;;;AACO,SAAS,SAAS,CAAC,UAAU,EAAE;AACtC,IAAI,OAAO,IAAIA,o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Promise.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,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,QA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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',
@@ -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.9",
3
+ "version": "3.4.10",
4
4
  "description": "A fully-featured caching GraphQL client.",
5
5
  "private": false,
6
6
  "keywords": [
@@ -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,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 ApolloConsumer = function (props) {
5
5
  var ApolloContext = getApolloContext();
@@ -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 +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;
@@ -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,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var utilities = require('../../utilities');
5
+ var globals = require('../../utilities/globals');
6
6
  var React = require('react');
7
- var tsInvariant = require('ts-invariant');
7
+ var utilities = require('../../utilities');
8
8
 
9
9
  function _interopNamespace(e) {
10
10
  if (e && e.__esModule) return e;
@@ -34,8 +34,8 @@ function getApolloContext() {
34
34
  var ApolloConsumer = function (props) {
35
35
  var ApolloContext = getApolloContext();
36
36
  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, 27);
37
+ __DEV__ ? globals.invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
38
+ 'Wrap the root component in an <ApolloProvider>.') : globals.invariant(context && context.client, 27);
39
39
  return props.children(context.client);
40
40
  });
41
41
  };
@@ -48,14 +48,12 @@ var ApolloProvider = function (_a) {
48
48
  if (client && context.client !== client) {
49
49
  context = Object.assign({}, context, { client: client });
50
50
  }
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, 28);
51
+ __DEV__ ? globals.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
52
+ 'sure you pass in your client via the "client" prop.') : globals.invariant(context.client, 28);
53
53
  return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
54
54
  });
55
55
  };
56
56
 
57
- utilities.checkDEV();
58
-
59
57
  exports.ApolloConsumer = ApolloConsumer;
60
58
  exports.ApolloProvider = ApolloProvider;
61
59
  exports.getApolloContext = getApolloContext;
@@ -1 +1 @@
1
- {"version":3,"file":"context.cjs.js","sources":["ApolloContext.js","ApolloConsumer.js","ApolloProvider.js","index.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, 27);\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, 28);\n return (React.createElement(ApolloContext.Provider, { value: context }, children));\n });\n};\n//# sourceMappingURL=ApolloProvider.js.map","import { checkDEV } from \"../../utilities\";\ncheckDEV();\nexport * from './ApolloConsumer';\nexport * from './ApolloContext';\nexport * from './ApolloProvider';\n//# sourceMappingURL=index.js.map"],"names":["canUseWeakMap","React","invariant","checkDEV"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,IAAI,KAAK,GAAG,KAAKA,uBAAa,GAAG,OAAO,GAAG,GAAG,GAAG,CAAC;AAC3C,SAAS,gBAAgB,GAAG;AACnC,IAAI,IAAI,OAAO,GAAG,KAAK,CAAC,GAAG,CAACC,gBAAK,CAAC,aAAa,CAAC,CAAC;AACjD,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,OAAO,GAAGA,gBAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;AAC1C,QAAQ,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;AAC9C,QAAQ,KAAK,CAAC,GAAG,CAACA,gBAAK,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAChD,KAAK;AACL,IAAI,OAAO,OAAO,CAAC;AACnB;;ACRU,IAAC,cAAc,GAAG,UAAU,KAAK,EAAE;AAC7C,IAAI,IAAI,aAAa,GAAG,g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O,EAAE,EAAE,QAAQ,CAAC,EAAE;AAC3F,KAAK,CAAC,CAAC;AACP;;ACdAE,kBAAQ,EAAE;;;;;;;"}
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 { 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":["canUseWeakMap","React","invariant"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,IAAI,KAAK,GAAG,KAAKA,uBAAa,GAAG,OAAO,GAAG,GAAG,GAAG,CAAC;AAC3C,SAAS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AE,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,iBAAS,CAAC,OAAO,CAAC,MAAM,EAAE,wDAAwD;AACpG,YAAY,qDAAqD,CAAC,GAAGA,iBAAS,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,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":"AAGA,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,5 +1,4 @@
1
- import { checkDEV } from "../../utilities/index.js";
2
- checkDEV();
1
+ import "../../utilities/globals/index.js";
3
2
  export * from "./ApolloConsumer.js";
4
3
  export * from "./ApolloContext.js";
5
4
  export * from "./ApolloProvider.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,QAAQ,EAAE,CAAC;AAEX,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC","sourcesContent":["import { checkDEV } from \"../../utilities\";\ncheckDEV();\n\nexport * 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,CA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AAS,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) {
@@ -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,GAA4B,EAEjD,C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,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,GAAG,OAAO;IAM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