@apollo/client 3.4.9 → 3.4.13

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 (247) hide show
  1. package/README.md +2 -2
  2. package/apollo-client.cjs.js +58 -67
  3. package/apollo-client.cjs.js.map +1 -1
  4. package/apollo-client.cjs.min.js +1 -0
  5. package/cache/cache.cjs.js +20 -22
  6. package/cache/cache.cjs.js.map +1 -1
  7. package/cache/core/cache.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/core/watchQueryOptions.js.map +1 -1
  45. package/errors/errors.cjs.js +1 -1
  46. package/errors/errors.cjs.js.map +1 -1
  47. package/errors/index.d.ts +1 -0
  48. package/errors/index.d.ts.map +1 -1
  49. package/errors/index.js +1 -2
  50. package/errors/index.js.map +1 -1
  51. package/invariantErrorCodes.js +1 -1
  52. package/link/core/ApolloLink.js +1 -1
  53. package/link/core/ApolloLink.js.map +1 -1
  54. package/link/core/core.cjs.js +4 -6
  55. package/link/core/core.cjs.js.map +1 -1
  56. package/link/core/index.d.ts +1 -0
  57. package/link/core/index.d.ts.map +1 -1
  58. package/link/core/index.js +1 -2
  59. package/link/core/index.js.map +1 -1
  60. package/link/http/checkFetcher.js +1 -1
  61. package/link/http/checkFetcher.js.map +1 -1
  62. package/link/http/createHttpLink.d.ts +1 -0
  63. package/link/http/createHttpLink.d.ts.map +1 -1
  64. package/link/http/createHttpLink.js +1 -0
  65. package/link/http/createHttpLink.js.map +1 -1
  66. package/link/http/http.cjs.js +4 -6
  67. package/link/http/http.cjs.js.map +1 -1
  68. package/link/http/index.d.ts +1 -0
  69. package/link/http/index.d.ts.map +1 -1
  70. package/link/http/index.js +1 -2
  71. package/link/http/index.js.map +1 -1
  72. package/link/http/serializeFetchParameter.d.ts +1 -1
  73. package/link/http/serializeFetchParameter.d.ts.map +1 -1
  74. package/link/http/serializeFetchParameter.js +1 -1
  75. package/link/http/serializeFetchParameter.js.map +1 -1
  76. package/link/persisted-queries/index.d.ts +1 -1
  77. package/link/persisted-queries/index.d.ts.map +1 -1
  78. package/link/persisted-queries/index.js +2 -4
  79. package/link/persisted-queries/index.js.map +1 -1
  80. package/link/persisted-queries/persisted-queries.cjs.js +8 -6
  81. package/link/persisted-queries/persisted-queries.cjs.js.map +1 -1
  82. package/link/utils/index.d.ts +1 -0
  83. package/link/utils/index.d.ts.map +1 -1
  84. package/link/utils/index.js +1 -2
  85. package/link/utils/index.js.map +1 -1
  86. package/link/utils/toPromise.d.ts.map +1 -1
  87. package/link/utils/toPromise.js +1 -1
  88. package/link/utils/toPromise.js.map +1 -1
  89. package/link/utils/utils.cjs.js +3 -5
  90. package/link/utils/utils.cjs.js.map +1 -1
  91. package/link/utils/validateOperation.d.ts.map +1 -1
  92. package/link/utils/validateOperation.js +1 -1
  93. package/link/utils/validateOperation.js.map +1 -1
  94. package/package.json +11 -11
  95. package/react/context/ApolloConsumer.d.ts.map +1 -1
  96. package/react/context/ApolloConsumer.js +1 -1
  97. package/react/context/ApolloConsumer.js.map +1 -1
  98. package/react/context/ApolloContext.d.ts +2 -1
  99. package/react/context/ApolloContext.d.ts.map +1 -1
  100. package/react/context/ApolloContext.js +11 -5
  101. package/react/context/ApolloContext.js.map +1 -1
  102. package/react/context/ApolloProvider.d.ts.map +1 -1
  103. package/react/context/ApolloProvider.js +1 -1
  104. package/react/context/ApolloProvider.js.map +1 -1
  105. package/react/context/context.cjs.js +16 -12
  106. package/react/context/context.cjs.js.map +1 -1
  107. package/react/context/index.d.ts +1 -0
  108. package/react/context/index.d.ts.map +1 -1
  109. package/react/context/index.js +1 -2
  110. package/react/context/index.js.map +1 -1
  111. package/react/data/OperationData.d.ts.map +1 -1
  112. package/react/data/OperationData.js +1 -1
  113. package/react/data/OperationData.js.map +1 -1
  114. package/react/data/QueryData.d.ts.map +1 -1
  115. package/react/data/QueryData.js +1 -3
  116. package/react/data/QueryData.js.map +1 -1
  117. package/react/data/data.cjs.js +6 -11
  118. package/react/data/data.cjs.js.map +1 -1
  119. package/react/data/index.d.ts +1 -0
  120. package/react/data/index.d.ts.map +1 -1
  121. package/react/data/index.js +1 -2
  122. package/react/data/index.js.map +1 -1
  123. package/react/hoc/hoc-utils.d.ts.map +1 -1
  124. package/react/hoc/hoc-utils.js +1 -1
  125. package/react/hoc/hoc-utils.js.map +1 -1
  126. package/react/hoc/hoc.cjs.js +13 -13
  127. package/react/hoc/hoc.cjs.js.map +1 -1
  128. package/react/hoc/index.d.ts +1 -0
  129. package/react/hoc/index.d.ts.map +1 -1
  130. package/react/hoc/index.js +1 -2
  131. package/react/hoc/index.js.map +1 -1
  132. package/react/hoc/subscription-hoc.d.ts.map +1 -1
  133. package/react/hoc/subscription-hoc.js +8 -5
  134. package/react/hoc/subscription-hoc.js.map +1 -1
  135. package/react/hoc/withApollo.d.ts.map +1 -1
  136. package/react/hoc/withApollo.js +1 -1
  137. package/react/hoc/withApollo.js.map +1 -1
  138. package/react/hooks/hooks.cjs.js +3 -6
  139. package/react/hooks/hooks.cjs.js.map +1 -1
  140. package/react/hooks/index.d.ts +1 -0
  141. package/react/hooks/index.d.ts.map +1 -1
  142. package/react/hooks/index.js +1 -2
  143. package/react/hooks/index.js.map +1 -1
  144. package/react/hooks/useApolloClient.d.ts.map +1 -1
  145. package/react/hooks/useApolloClient.js +1 -1
  146. package/react/hooks/useApolloClient.js.map +1 -1
  147. package/react/hooks/useSubscription.d.ts +1 -0
  148. package/react/hooks/useSubscription.d.ts.map +1 -1
  149. package/react/hooks/useSubscription.js +1 -0
  150. package/react/hooks/useSubscription.js.map +1 -1
  151. package/react/hooks/utils/useAfterFastRefresh.d.ts +1 -0
  152. package/react/hooks/utils/useAfterFastRefresh.d.ts.map +1 -1
  153. package/react/hooks/utils/useAfterFastRefresh.js +1 -0
  154. package/react/hooks/utils/useAfterFastRefresh.js.map +1 -1
  155. package/react/hooks/utils/useBaseQuery.d.ts +1 -0
  156. package/react/hooks/utils/useBaseQuery.d.ts.map +1 -1
  157. package/react/hooks/utils/useBaseQuery.js +1 -0
  158. package/react/hooks/utils/useBaseQuery.js.map +1 -1
  159. package/react/index.d.ts +1 -0
  160. package/react/index.d.ts.map +1 -1
  161. package/react/index.js +1 -2
  162. package/react/index.js.map +1 -1
  163. package/react/parser/index.d.ts.map +1 -1
  164. package/react/parser/index.js +1 -3
  165. package/react/parser/index.js.map +1 -1
  166. package/react/parser/parser.cjs.js +9 -11
  167. package/react/parser/parser.cjs.js.map +1 -1
  168. package/react/react.cjs.js +2 -2
  169. package/react/react.cjs.js.map +1 -1
  170. package/testing/index.d.ts +1 -0
  171. package/testing/index.d.ts.map +1 -1
  172. package/testing/index.js +1 -2
  173. package/testing/index.js.map +1 -1
  174. package/testing/testing.cjs.js +3 -5
  175. package/testing/testing.cjs.js.map +1 -1
  176. package/utilities/common/canUse.d.ts +1 -0
  177. package/utilities/common/canUse.d.ts.map +1 -1
  178. package/utilities/common/canUse.js +2 -0
  179. package/utilities/common/canUse.js.map +1 -1
  180. package/utilities/common/maybeDeepFreeze.d.ts.map +1 -1
  181. package/utilities/common/maybeDeepFreeze.js +14 -3
  182. package/utilities/common/maybeDeepFreeze.js.map +1 -1
  183. package/utilities/common/mergeDeep.js +1 -1
  184. package/utilities/common/mergeDeep.js.map +1 -1
  185. package/utilities/globals/DEV.js +2 -2
  186. package/utilities/globals/DEV.js.map +1 -1
  187. package/utilities/{common → globals}/global.d.ts +0 -0
  188. package/utilities/globals/global.d.ts.map +1 -0
  189. package/utilities/{common → globals}/global.js +0 -0
  190. package/utilities/globals/global.js.map +1 -0
  191. package/utilities/globals/globals.cjs.js +57 -0
  192. package/utilities/globals/globals.cjs.js.map +1 -0
  193. package/utilities/globals/index.d.ts +4 -2
  194. package/utilities/globals/index.d.ts.map +1 -1
  195. package/utilities/globals/index.js +5 -2
  196. package/utilities/globals/index.js.map +1 -1
  197. package/utilities/{common → globals}/maybe.d.ts +0 -0
  198. package/utilities/globals/maybe.d.ts.map +1 -0
  199. package/utilities/{common → globals}/maybe.js +0 -0
  200. package/utilities/globals/maybe.js.map +1 -0
  201. package/utilities/globals/package.json +7 -0
  202. package/utilities/graphql/directives.d.ts.map +1 -1
  203. package/utilities/graphql/directives.js +1 -1
  204. package/utilities/graphql/directives.js.map +1 -1
  205. package/utilities/graphql/fragments.d.ts.map +1 -1
  206. package/utilities/graphql/fragments.js +2 -2
  207. package/utilities/graphql/fragments.js.map +1 -1
  208. package/utilities/graphql/getFromAST.d.ts.map +1 -1
  209. package/utilities/graphql/getFromAST.js +1 -1
  210. package/utilities/graphql/getFromAST.js.map +1 -1
  211. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  212. package/utilities/graphql/storeUtils.js +1 -1
  213. package/utilities/graphql/storeUtils.js.map +1 -1
  214. package/utilities/graphql/transform.d.ts.map +1 -1
  215. package/utilities/graphql/transform.js +2 -2
  216. package/utilities/graphql/transform.js.map +1 -1
  217. package/utilities/index.d.ts +1 -3
  218. package/utilities/index.d.ts.map +1 -1
  219. package/utilities/index.js +1 -4
  220. package/utilities/index.js.map +1 -1
  221. package/utilities/observables/subclassing.d.ts.map +1 -1
  222. package/utilities/observables/subclassing.js +2 -1
  223. package/utilities/observables/subclassing.js.map +1 -1
  224. package/utilities/package.json +1 -3
  225. package/utilities/policies/pagination.d.ts +1 -1
  226. package/utilities/policies/pagination.d.ts.map +1 -1
  227. package/utilities/policies/pagination.js +9 -4
  228. package/utilities/policies/pagination.js.map +1 -1
  229. package/utilities/testing/mocking/mockFetch.js +1 -1
  230. package/utilities/testing/mocking/mockFetch.js.map +1 -1
  231. package/utilities/testing/mocking/mockLink.d.ts.map +1 -1
  232. package/utilities/testing/mocking/mockLink.js +1 -1
  233. package/utilities/testing/mocking/mockLink.js.map +1 -1
  234. package/utilities/testing/mocking/mockWatchQuery.js +1 -1
  235. package/utilities/testing/mocking/mockWatchQuery.js.map +1 -1
  236. package/utilities/testing/observableToPromise.js +1 -1
  237. package/utilities/testing/observableToPromise.js.map +1 -1
  238. package/utilities/utilities.cjs.js +57 -83
  239. package/utilities/utilities.cjs.js.map +1 -1
  240. package/version.js +1 -1
  241. package/apollo-core.cjs.js +0 -5772
  242. package/apollo-core.cjs.js.map +0 -1
  243. package/apollo-core.cjs.min.js +0 -1
  244. package/utilities/common/global.d.ts.map +0 -1
  245. package/utilities/common/global.js.map +0 -1
  246. package/utilities/common/maybe.d.ts.map +0 -1
  247. package/utilities/common/maybe.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"subscription-hoc.js","sourceRoot":"","sources":["../../../src/react/hoc/subscription-hoc.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EACL,cAAc,EACd,WAAW,EACX,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAGrB,MAAM,UAAU,gBAAgB,CAM9B,QAAsB,EACtB,gBAKM;IALN,iCAAA,EAAA,qBAKM;IAGN,IAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAGjC,IAAA,KAIE,gBAAgB,QAJgB,EAAlC,OAAO,mBAAG,wBAAwB,KAAA,EAClC,KAGE,gBAAgB,KAHU,EAA5B,IAAI,mBAAG,qBAAqB,KAAA,EAC5B,KAEE,gBAAgB,MAFF,EAAhB,KAAK,mBAAG,QAAQ,KAAA,EAChB,iBAAiB,GACf,gBAAgB,kBADD,CACE;IAErB,IAAI,iBAAiB,GAAG,OAA2C,CAAC;IACpE,IAAI,OAAO,iBAAiB,KAAK,UAAU;QACzC,iBAAiB,GAAG,cAAM,OAAA,OAA2B,EAA3B,CAA2B,CAAC;IAExD,IAAI,cAAc,GAAG,IAA+B,CAAC;IACrD,IAAI,OAAO,cAAc,KAAK,UAAU;QAAE,cAAc,GAAG,cAAM,OAAA,IAAW,EAAX,CAAW,CAAC;IAG7E,IAAI,eAAmC,CAAC;IACxC,OAAO,UACL,gBAA2D;QAE3D,IAAM,kBAAkB,GAAM,KAAK,SAAI,cAAc,CAAC,gBAAgB,CAAC,MAAG,CAAC;QAC3E;YAAsB,2BAIrB;YAGC,iBAAY,KAAa;gBAAzB,Y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C,CAAC;qBACJ;oBAED,IAAI,UAAU,EAAE;wBACd,OAAO,CACL,oBAAC,gBAAgB,eACV,KAAgB,EAChB,EAAkB,EACvB,CACH,CAAC;qBACH;oBAKD,IAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;oBAC5C,IAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,IAAI,MAAM,CAAC;oBAC7C,IAAI,UAAU,aAAK,GAAC,IAAI,IAAG,MAAM,KAAE,CAAC;oBACpC,IAAI,gBAAgB,CAAC,KAAK,EAAE;wBAC1B,IAAM,SAAS;4BAKb,GAAC,IAAI,IAAG,MAAM;4BACd,WAAQ,GAAE,KAAe;+BAC1B,CAAC;wBACF,eAAe,GAAG,gBAAgB,CAAC,KAAK,CACtC,SAAS,EACT,eAAe,CAChB,CAAC;wBACF,UAAU,GAAG,eAAe,CAAC;qBAC9B;oBAED,OAAO,CACL,oBAAC,gBAAgB,eACV,KAAgB,EAChB,UAA0B,EAC/B,CACH,CAAC;gBACJ,CAAC,CACY,CAChB,CAAC;YACJ,CAAC;YAjFM,mBAAW,GAAG,kBAAkB,CAAC;YACjC,wBAAgB,GAAG,gBAAgB,CAAC;YAiF7C,cAAC;SAAA,AAvFD,CAAsB,WAAW,GAuFhC;QAGD,OAAO,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import * as React from 'react';\nimport { DocumentNode } from 'graphql';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\n\nimport { parser } from '../parser';\nimport { BaseQueryOptions } from '../types/types';\nimport { Subscription } from '../components';\nimport {\n getDisplayName,\n GraphQLBase,\n calculateVariablesFromProps,\n defaultMapPropsToOptions,\n defaultMapPropsToSkip\n} from './hoc-utils';\nimport { OperationOption, OptionProps, DataProps } from './types';\n\nexport function withSubscription<\n TProps extends TGraphQLVariables | {} = {},\n TData = {},\n TGraphQLVariables = {},\n TChildProps = DataProps<TData, TGraphQLVariables>\n>(\n document: DocumentNode,\n operationOptions: OperationOption<\n TProps,\n TData,\n TGraphQLVariables,\n TChildProps\n > = {}\n) {\n // this is memoized so if coming from `graphql` there is nearly no extra cost\n const operation = parser(document);\n // extract options\n const {\n options = defaultMapPropsToOptions,\n skip = defaultMapPropsToSkip,\n alias = 'Apollo',\n shouldResubscribe\n } = operationOptions;\n\n let mapPropsToOptions = options as (props: any) => BaseQueryOptions;\n if (typeof mapPropsToOptions !== 'function')\n mapPropsToOptions = () => options as BaseQueryOptions;\n\n let mapPropsToSkip = skip as (props: any) => boolean;\n if (typeof mapPropsToSkip !== 'function') mapPropsToSkip = () => skip as any;\n\n // allow for advanced referential equality checks\n let lastResultProps: TChildProps | void;\n return (\n WrappedComponent: React.ComponentType<TProps & TChildProps>\n ): React.ComponentClass<TProps> => {\n const graphQLDisplayName = `${alias}(${getDisplayName(WrappedComponent)})`;\n class GraphQL extends GraphQLBase<\n TProps,\n TChildProps,\n { resubscribe: boolean }\n > {\n static displayName = graphQLDisplayName;\n static WrappedComponent = WrappedComponent;\n constructor(props: TProps) {\n super(props);\n this.state = { resubscribe: false };\n }\n\n componentDidUpate(prevProps: TProps) {\n if (shouldResubscribe) {\n this.setState({\n resubscribe: shouldResubscribe(prevProps, this.props)\n });\n }\n }\n\n render() {\n let props = this.props;\n const shouldSkip = mapPropsToSkip(props);\n const opts = shouldSkip\n ? Object.create(null)\n : mapPropsToOptions(props);\n\n if (!shouldSkip && !opts.variables && operation.variables.length > 0) {\n opts.variables = calculateVariablesFromProps(operation, props);\n }\n return (\n <Subscription\n {...opts}\n displayName={graphQLDisplayName}\n skip={shouldSkip}\n subscription={document}\n shouldResubscribe={this.state.resubscribe}\n >\n {({ data, ...r }: any) => {\n if (operationOptions.withRef) {\n this.withRef = true;\n props = Object.assign({}, props, {\n ref: this.setWrappedInstance\n });\n }\n // if we have skipped, no reason to manage any reshaping\n if (shouldSkip) {\n return (\n <WrappedComponent\n {...(props as TProps)}\n {...({} as TChildProps)}\n />\n );\n }\n\n // the HOC's historically hoisted the data from the execution result\n // up onto the result since it was passed as a nested prop\n // we massage the Query components shape here to replicate that\n const result = Object.assign(r, data || {});\n const name = operationOptions.name || 'data';\n let childProps = { [name]: result };\n if (operationOptions.props) {\n const newResult: OptionProps<\n TProps,\n TData,\n TGraphQLVariables\n > = {\n [name]: result,\n ownProps: props as TProps\n };\n lastResultProps = operationOptions.props(\n newResult,\n lastResultProps\n );\n childProps = lastResultProps;\n }\n\n return (\n <WrappedComponent\n {...(props as TProps)}\n {...(childProps as TChildProps)}\n />\n );\n }}\n </Subscription>\n );\n }\n }\n\n // Make sure we preserve any custom statics on the original component.\n return hoistNonReactStatics(GraphQL, WrappedComponent, {});\n };\n}\n"]}
1
+ {"version":3,"file":"subscription-hoc.js","sourceRoot":"","sources":["../../../src/react/hoc/subscription-hoc.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EACL,cAAc,EACd,WAAW,EACX,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAGrB,MAAM,UAAU,gBAAgB,CAM9B,QAAsB,EACtB,gBAKM;IALN,iCAAA,EAAA,qBAKM;IAGN,IAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAGjC,IAAA,KAIE,gBAAgB,QAJgB,EAAlC,OAAO,mBAAG,wBAAwB,KAAA,EAClC,KAGE,gBAAgB,KAHU,EAA5B,IAAI,mBAAG,qBAAqB,KAAA,EAC5B,KAEE,gBAAgB,MAFF,EAAhB,KAAK,mBAAG,QAAQ,KAAA,EAChB,iBAAiB,GACf,gBA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CAAC;qBAC9B;oBAED,OAAO,CACL,oBAAC,gBAAgB,eACV,KAAgB,EAChB,UAA0B,EAC/B,CACH,CAAC;gBACJ,CAAC,CACY,CAChB,CAAC;YACJ,CAAC;YAvFM,mBAAW,GAAG,kBAAkB,CAAC;YACjC,wBAAgB,GAAG,gBAAgB,CAAC;YAuF7C,cAAC;SAAA,AA7FD,CAAsB,WAAW,GA6FhC;QAGD,OAAO,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import * as React from 'react';\nimport { DocumentNode } from 'graphql';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\n\nimport { parser } from '../parser';\nimport { BaseQueryOptions } from '../types/types';\nimport { Subscription } from '../components';\nimport {\n getDisplayName,\n GraphQLBase,\n calculateVariablesFromProps,\n defaultMapPropsToOptions,\n defaultMapPropsToSkip\n} from './hoc-utils';\nimport { OperationOption, OptionProps, DataProps } from './types';\n\nexport function withSubscription<\n TProps extends TGraphQLVariables | {} = {},\n TData = {},\n TGraphQLVariables = {},\n TChildProps = DataProps<TData, TGraphQLVariables>\n>(\n document: DocumentNode,\n operationOptions: OperationOption<\n TProps,\n TData,\n TGraphQLVariables,\n TChildProps\n > = {}\n) {\n // this is memoized so if coming from `graphql` there is nearly no extra cost\n const operation = parser(document);\n // extract options\n const {\n options = defaultMapPropsToOptions,\n skip = defaultMapPropsToSkip,\n alias = 'Apollo',\n shouldResubscribe\n } = operationOptions;\n\n let mapPropsToOptions = options as (props: any) => BaseQueryOptions;\n if (typeof mapPropsToOptions !== 'function')\n mapPropsToOptions = () => options as BaseQueryOptions;\n\n let mapPropsToSkip = skip as (props: any) => boolean;\n if (typeof mapPropsToSkip !== 'function') mapPropsToSkip = () => skip as any;\n\n // allow for advanced referential equality checks\n let lastResultProps: TChildProps | void;\n return (\n WrappedComponent: React.ComponentType<TProps & TChildProps>\n ): React.ComponentClass<TProps> => {\n const graphQLDisplayName = `${alias}(${getDisplayName(WrappedComponent)})`;\n class GraphQL extends GraphQLBase<\n TProps,\n TChildProps,\n { resubscribe: boolean }\n > {\n static displayName = graphQLDisplayName;\n static WrappedComponent = WrappedComponent;\n constructor(props: TProps) {\n super(props);\n this.state = { resubscribe: false };\n }\n\n updateResubscribe(resubscribe: boolean) {\n this.setState({ resubscribe });\n }\n\n componentDidUpdate(prevProps: TProps) {\n const resubscribe = !!(\n shouldResubscribe &&\n shouldResubscribe(prevProps, this.props)\n );\n if (this.state.resubscribe !== resubscribe) {\n this.updateResubscribe(resubscribe);\n }\n }\n\n render() {\n let props = this.props;\n const shouldSkip = mapPropsToSkip(props);\n const opts = shouldSkip\n ? Object.create(null)\n : mapPropsToOptions(props);\n\n if (!shouldSkip && !opts.variables && operation.variables.length > 0) {\n opts.variables = calculateVariablesFromProps(operation, props);\n }\n return (\n <Subscription\n {...opts}\n displayName={graphQLDisplayName}\n skip={shouldSkip}\n subscription={document}\n shouldResubscribe={this.state.resubscribe}\n >\n {({ data, ...r }: any) => {\n if (operationOptions.withRef) {\n this.withRef = true;\n props = Object.assign({}, props, {\n ref: this.setWrappedInstance\n });\n }\n // if we have skipped, no reason to manage any reshaping\n if (shouldSkip) {\n return (\n <WrappedComponent\n {...(props as TProps)}\n {...({} as TChildProps)}\n />\n );\n }\n\n // the HOC's historically hoisted the data from the execution result\n // up onto the result since it was passed as a nested prop\n // we massage the Query components shape here to replicate that\n const result = Object.assign(r, data || {});\n const name = operationOptions.name || 'data';\n let childProps = { [name]: result };\n if (operationOptions.props) {\n const newResult: OptionProps<\n TProps,\n TData,\n TGraphQLVariables\n > = {\n [name]: result,\n ownProps: props as TProps\n };\n lastResultProps = operationOptions.props(\n newResult,\n lastResultProps\n );\n childProps = lastResultProps;\n }\n\n return (\n <WrappedComponent\n {...(props as TProps)}\n {...(childProps as TChildProps)}\n />\n );\n }}\n </Subscription>\n );\n }\n }\n\n // Make sure we preserve any custom statics on the original component.\n return hoistNonReactStatics(GraphQL, WrappedComponent, {});\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"withApollo.d.ts","sourceRoot":"","sources":["../../../src/react/hoc/withApollo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAM5D,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,GAAG,EAC9C,gBAAgB,EAAE,KAAK,CAAC,aAAa,CACnC,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CACzC,EACD,gBAAgB,GAAE,eAAe,CAAC,MAAM,EAAE,OAAO,CAAM,GACtD,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAgD9C"}
1
+ {"version":3,"file":"withApollo.d.ts","sourceRoot":"","sources":["../../../src/react/hoc/withApollo.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAM5D,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,GAAG,EAC9C,gBAAgB,EAAE,KAAK,CAAC,aAAa,CACnC,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CACzC,EACD,gBAAgB,GAAE,eAAe,CAAC,MAAM,EAAE,OAAO,CAAM,GACtD,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAgD9C"}
@@ -1,7 +1,7 @@
1
1
  import { __assign, __extends } from "tslib";
2
+ import { invariant } from "../../utilities/globals/index.js";
2
3
  import * as React from 'react';
3
4
  import hoistNonReactStatics from 'hoist-non-react-statics';
4
- import { invariant } from 'ts-invariant';
5
5
  import { ApolloConsumer } from "../context/index.js";
6
6
  function getDisplayName(WrappedComponent) {
7
7
  return WrappedComponent.displayName || WrappedComponent.name || 'Component';
@@ -1 +1 @@
1
- {"version":3,"file":"withApollo.js","sourceRoot":"","sources":["../../../src/react/hoc/withApollo.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C,SAAS,cAAc,CAAI,gBAAwC;IACjE,OAAO,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,IAAI,IAAI,WAAW,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,gBAEC,EACD,gBAAuD;IAAvD,iCAAA,EAAA,qBAAuD;IAEvD,IAAM,eAAe,GAAG,gBAAc,cAAc,CAAC,gBAAgB,CAAC,MAAG,CAAC;IAE1E;QAAyB,8BAAuC;QAO9D,oBAAY,KAA6B;YAAzC,YACE,kBAAM,KAAK,CAAC,SAEb;YADC,KAAI,CAAC,kBAAkB,GAAG,KAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAI,CAAC,CAAC;;QAC/D,CAAC;QAED,uCAAkB,GAAlB;YACE,SAAS,CACP,gBAAgB,CAAC,OAAO,EACxB,sDAAsD;gBACpD,kCAAkC,CACrC,CAAC;YAEF,OAAO,IAAI,CAAC,eAAe,CAAC;QAC9B,CAAC;QAED,uCAAkB,GAAlB,UAAmB,GAAkD;YACnE,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC;QAC7B,CAAC;QAED,2BAAM,GAAN;YAAA,iBAcC;YAbC,OAAO,CACL,oBAAC,cAAc,QACZ,UAAA,MAAM;gBACL,IAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAI,CAAC,KAAK,EAAE;oBAC1C,MAAM,QAAA;oBACN,GAAG,EAAE,gBAAgB,CAAC,OAAO;wBAC3B,CAAC,CAAC,KAAI,CAAC,kBAAkB;wBACzB,CAAC,CAAC,SAAS;iBACd,CAAC,CAAC;gBACH,OAAO,oBAAC,gBAAgB,eAAK,KAAK,EAAI,CAAC;YACzC,CAAC,CACc,CAClB,CAAC;QACJ,CAAC;QAvCM,sBAAW,GAAG,eAAe,CAAC;QAC9B,2BAAgB,GAAG,gBAAgB,CAAC;QAuC7C,iBAAC;KAAA,AAzCD,CAAyB,KAAK,CAAC,SAAS,GAyCvC;IAGD,OAAO,oBAAoB,CAAC,UAAU,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAChE,CAAC","sourcesContent":["import * as React from 'react';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport { invariant } from 'ts-invariant';\n\nimport { ApolloConsumer } from '../context';\nimport { OperationOption, WithApolloClient } from './types';\n\nfunction getDisplayName<P>(WrappedComponent: React.ComponentType<P>) {\n return WrappedComponent.displayName || WrappedComponent.name || 'Component';\n}\n\nexport function withApollo<TProps, TResult = any>(\n WrappedComponent: React.ComponentType<\n WithApolloClient<Omit<TProps, 'client'>>\n >,\n operationOptions: OperationOption<TProps, TResult> = {}\n): React.ComponentClass<Omit<TProps, 'client'>> {\n const withDisplayName = `withApollo(${getDisplayName(WrappedComponent)})`;\n\n class WithApollo extends React.Component<Omit<TProps, 'client'>> {\n static displayName = withDisplayName;\n static WrappedComponent = WrappedComponent;\n\n // wrapped instance\n private wrappedInstance: any;\n\n constructor(props: Omit<TProps, 'client'>) {\n super(props);\n this.setWrappedInstance = this.setWrappedInstance.bind(this);\n }\n\n getWrappedInstance() {\n invariant(\n operationOptions.withRef,\n `To access the wrapped instance, you need to specify ` +\n `{ withRef: true } in the options`\n );\n\n return this.wrappedInstance;\n }\n\n setWrappedInstance(ref: React.ComponentType<WithApolloClient<TProps>>) {\n this.wrappedInstance = ref;\n }\n\n render() {\n return (\n <ApolloConsumer>\n {client => {\n const props = Object.assign({}, this.props, {\n client,\n ref: operationOptions.withRef\n ? this.setWrappedInstance\n : undefined\n });\n return <WrappedComponent {...props} />;\n }}\n </ApolloConsumer>\n );\n }\n }\n\n // Make sure we preserve any custom statics on the original component.\n return hoistNonReactStatics(WithApollo, WrappedComponent, {});\n}\n"]}
1
+ {"version":3,"file":"withApollo.js","sourceRoot":"","sources":["../../../src/react/hoc/withApollo.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C,SAAS,cAAc,CAAI,gBAAwC;IACjE,OAAO,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,IAAI,IAAI,WAAW,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,gBAEC,EACD,gBAAuD;IAAvD,iCAAA,EAAA,qBAAuD;IAEvD,IAAM,eAAe,GAAG,gBAAc,cAAc,CAAC,gBAAgB,CAAC,MAAG,CAAC;IAE1E;QAAyB,8BAAuC;QAO9D,oBAAY,KAA6B;YAAzC,YACE,kBAAM,KAAK,CAAC,SAEb;YADC,KAAI,CAAC,kBAAkB,GAAG,KAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAI,CAAC,CAAC;;QAC/D,CAAC;QAED,uCAAkB,GAAlB;YACE,SAAS,CACP,gBAAgB,CAAC,OAAO,EACxB,sDAAsD;gBACpD,kCAAkC,CACrC,CAAC;YAEF,OAAO,IAAI,CAAC,eAAe,CAAC;QAC9B,CAAC;QAED,uCAAkB,GAAlB,UAAmB,GAAkD;YACnE,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC;QAC7B,CAAC;QAED,2BAAM,GAAN;YAAA,iBAcC;YAbC,OAAO,CACL,oBAAC,cAAc,QACZ,UAAA,MAAM;gBACL,IAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAI,CAAC,KAAK,EAAE;oBAC1C,MAAM,QAAA;oBACN,GAAG,EAAE,gBAAgB,CAAC,OAAO;wBAC3B,CAAC,CAAC,KAAI,CAAC,kBAAkB;wBACzB,CAAC,CAAC,SAAS;iBACd,CAAC,CAAC;gBACH,OAAO,oBAAC,gBAAgB,eAAK,KAAK,EAAI,CAAC;YACzC,CAAC,CACc,CAClB,CAAC;QACJ,CAAC;QAvCM,sBAAW,GAAG,eAAe,CAAC;QAC9B,2BAAgB,GAAG,gBAAgB,CAAC;QAuC7C,iBAAC;KAAA,AAzCD,CAAyB,KAAK,CAAC,SAAS,GAyCvC;IAGD,OAAO,oBAAoB,CAAC,UAAU,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAChE,CAAC","sourcesContent":["import { invariant } from '../../utilities/globals';\nimport * as React from 'react';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\n\nimport { ApolloConsumer } from '../context';\nimport { OperationOption, WithApolloClient } from './types';\n\nfunction getDisplayName<P>(WrappedComponent: React.ComponentType<P>) {\n return WrappedComponent.displayName || WrappedComponent.name || 'Component';\n}\n\nexport function withApollo<TProps, TResult = any>(\n WrappedComponent: React.ComponentType<\n WithApolloClient<Omit<TProps, 'client'>>\n >,\n operationOptions: OperationOption<TProps, TResult> = {}\n): React.ComponentClass<Omit<TProps, 'client'>> {\n const withDisplayName = `withApollo(${getDisplayName(WrappedComponent)})`;\n\n class WithApollo extends React.Component<Omit<TProps, 'client'>> {\n static displayName = withDisplayName;\n static WrappedComponent = WrappedComponent;\n\n // wrapped instance\n private wrappedInstance: any;\n\n constructor(props: Omit<TProps, 'client'>) {\n super(props);\n this.setWrappedInstance = this.setWrappedInstance.bind(this);\n }\n\n getWrappedInstance() {\n invariant(\n operationOptions.withRef,\n `To access the wrapped instance, you need to specify ` +\n `{ withRef: true } in the options`\n );\n\n return this.wrappedInstance;\n }\n\n setWrappedInstance(ref: React.ComponentType<WithApolloClient<TProps>>) {\n this.wrappedInstance = ref;\n }\n\n render() {\n return (\n <ApolloConsumer>\n {client => {\n const props = Object.assign({}, this.props, {\n client,\n ref: operationOptions.withRef\n ? this.setWrappedInstance\n : undefined\n });\n return <WrappedComponent {...props} />;\n }}\n </ApolloConsumer>\n );\n }\n }\n\n // Make sure we preserve any custom statics on the original component.\n return hoistNonReactStatics(WithApollo, WrappedComponent, {});\n}\n"]}
@@ -2,9 +2,8 @@
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');
8
7
  var context = require('../context');
9
8
  var tslib = require('tslib');
10
9
  var data = require('../data');
@@ -26,8 +25,8 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
25
 
27
26
  function useApolloClient() {
28
27
  var client = React__namespace.useContext(context.getApolloContext()).client;
29
- __DEV__ ? tsInvariant.invariant(client, 'No Apollo Client instance can be found. Please ensure that you ' +
30
- 'have called `ApolloProvider` higher up in your tree.') : tsInvariant.invariant(client, 33);
28
+ __DEV__ ? globals.invariant(client, 'No Apollo Client instance can be found. Please ensure that you ' +
29
+ 'have called `ApolloProvider` higher up in your tree.') : globals.invariant(client, 33);
31
30
  return client;
32
31
  }
33
32
 
@@ -187,8 +186,6 @@ function useReactiveVar(rv) {
187
186
  return value;
188
187
  }
189
188
 
190
- utilities.checkDEV();
191
-
192
189
  exports.useApolloClient = useApolloClient;
193
190
  exports.useLazyQuery = useLazyQuery;
194
191
  exports.useMutation = useMutation;
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.cjs.js","sources":["useApolloClient.js","utils/useDeepMemo.js","utils/useAfterFastRefresh.js","utils/useBaseQuery.js","useLazyQuery.js","useMutation.js","useQuery.js","useSubscription.js","useReactiveVar.js","index.js"],"sourcesContent":["import * as React from 'react';\nimport { invariant } from 'ts-invariant';\nimport { getApolloContext } from '../context';\nexport function useApolloClient() {\n var client = React.useContext(getApolloContext()).client;\n __DEV__ ? invariant(client, 'No Apollo Client instance can be found. Please ensure that you ' +\n 'have called `ApolloProvider` higher up in your tree.') : invariant(client, 33);\n return client;\n}\n//# sourceMappingURL=useApolloClient.js.map","import { useRef } from 'react';\nimport { equal } from '@wry/equality';\nexport function useDeepMemo(memoFn, key) {\n var ref = useRef();\n if (!ref.current || !equal(key, ref.current.key)) {\n ref.current = { key: key, value: memoFn() };\n }\n return ref.current.value;\n}\n//# sourceMappingURL=useDeepMemo.js.map","import { useEffect, useRef } from \"react\";\nexport function useAfterFastRefresh(effectFn) {\n if (__DEV__) {\n var didRefresh_1 = useRef(false);\n useEffect(function () {\n return function () {\n didRefresh_1.current = true;\n };\n }, []);\n useEffect(function () {\n if (didRefresh_1.current === true) {\n didRefresh_1.current = false;\n effectFn();\n }\n }, []);\n }\n}\n//# sourceMappingURL=useAfterFastRefresh.js.map","import { __assign } from \"tslib\";\nimport { useContext, useEffect, useReducer, useRef } from 'react';\nimport { QueryData } from '../../data';\nimport { useDeepMemo } from './useDeepMemo';\nimport { getApolloContext } from '../../context';\nimport { useAfterFastRefresh } from './useAfterFastRefresh';\nexport function useBaseQuery(query, options, lazy) {\n if (lazy === void 0) { lazy = false; }\n var context = useContext(getApolloContext());\n var _a = useReducer(function (x) { return x + 1; }, 0), tick = _a[0], forceUpdate = _a[1];\n var updatedOptions = options ? __assign(__assign({}, options), { query: query }) : { query: query };\n var queryDataRef = useRef();\n var queryData = queryDataRef.current || (queryDataRef.current = new QueryData({\n options: updatedOptions,\n context: context,\n onNewData: function () {\n if (!queryData.ssrInitiated()) {\n Promise.resolve().then(function () { return queryDataRef.current && queryDataRef.current.isMounted && forceUpdate(); });\n }\n else {\n forceUpdate();\n }\n }\n }));\n queryData.setOptions(updatedOptions);\n queryData.context = context;\n var memo = {\n options: __assign(__assign({}, updatedOptions), { onError: void 0, onCompleted: void 0 }),\n context: context,\n tick: tick\n };\n var result = useDeepMemo(function () { return (lazy ? queryData.executeLazy() : queryData.execute()); }, memo);\n var queryResult = lazy\n ? result[1]\n : result;\n if (__DEV__) {\n useAfterFastRefresh(forceUpdate);\n }\n useEffect(function () {\n return function () {\n queryData.cleanup();\n queryDataRef.current = void 0;\n };\n }, []);\n useEffect(function () { return queryData.afterExecute({ lazy: lazy }); }, [\n queryResult.loading,\n queryResult.networkStatus,\n queryResult.error,\n queryResult.data,\n queryData.currentObservable,\n ]);\n return result;\n}\n//# sourceMappingURL=useBaseQuery.js.map","import { useBaseQuery } from './utils/useBaseQuery';\nexport function useLazyQuery(query, options) {\n return useBaseQuery(query, options, true);\n}\n//# sourceMappingURL=useLazyQuery.js.map","import { __assign } from \"tslib\";\nimport { useContext, useState, useRef, useEffect } from 'react';\nimport { MutationData } from '../data';\nimport { getApolloContext } from '../context';\nexport function useMutation(mutation, options) {\n var context = useContext(getApolloContext());\n var _a = useState({ called: false, loading: false }), result = _a[0], setResult = _a[1];\n var updatedOptions = options ? __assign(__assign({}, options), { mutation: mutation }) : { mutation: mutation };\n var mutationDataRef = useRef();\n function getMutationDataRef() {\n if (!mutationDataRef.current) {\n mutationDataRef.current = new MutationData({\n options: updatedOptions,\n context: context,\n result: result,\n setResult: setResult\n });\n }\n return mutationDataRef.current;\n }\n var mutationData = getMutationDataRef();\n mutationData.setOptions(updatedOptions);\n mutationData.context = context;\n useEffect(function () { return mutationData.afterExecute(); });\n return mutationData.execute(result);\n}\n//# sourceMappingURL=useMutation.js.map","import { useBaseQuery } from './utils/useBaseQuery';\nexport function useQuery(query, options) {\n return useBaseQuery(query, options, false);\n}\n//# sourceMappingURL=useQuery.js.map","import { __assign } from \"tslib\";\nimport { useContext, useState, useRef, useEffect, useReducer } from 'react';\nimport { SubscriptionData } from '../data';\nimport { getApolloContext } from '../context';\nimport { useAfterFastRefresh } from './utils/useAfterFastRefresh';\nexport function useSubscription(subscription, options) {\n var _a = useReducer(function (x) { return x + 1; }, 0), forceUpdate = _a[1];\n var context = useContext(getApolloContext());\n var updatedOptions = options\n ? __assign(__assign({}, options), { subscription: subscription }) : { subscription: subscription };\n var _b = useState({\n loading: !updatedOptions.skip,\n error: void 0,\n data: void 0,\n }), result = _b[0], setResult = _b[1];\n var subscriptionDataRef = useRef();\n function getSubscriptionDataRef() {\n if (!subscriptionDataRef.current) {\n subscriptionDataRef.current = new SubscriptionData({\n options: updatedOptions,\n context: context,\n setResult: setResult\n });\n }\n return subscriptionDataRef.current;\n }\n var subscriptionData = getSubscriptionDataRef();\n subscriptionData.setOptions(updatedOptions, true);\n subscriptionData.context = context;\n if (__DEV__) {\n useAfterFastRefresh(forceUpdate);\n }\n useEffect(function () { return subscriptionData.afterExecute(); });\n useEffect(function () {\n return function () {\n subscriptionData.cleanup();\n subscriptionDataRef.current = void 0;\n };\n }, []);\n return subscriptionData.execute(result);\n}\n//# sourceMappingURL=useSubscription.js.map","import { useEffect, useState } from 'react';\nexport function useReactiveVar(rv) {\n var value = rv();\n var setValue = useState(value)[1];\n useEffect(function () {\n var probablySameValue = rv();\n if (value !== probablySameValue) {\n setValue(probablySameValue);\n }\n else {\n return rv.onNextChange(setValue);\n }\n }, [value]);\n return value;\n}\n//# sourceMappingURL=useReactiveVar.js.map","import { checkDEV } from \"../../utilities\";\ncheckDEV();\nexport * from './useApolloClient';\nexport * from './useLazyQuery';\nexport * from './useMutation';\nexport * from './useQuery';\nexport * from './useSubscription';\nexport * from './useReactiveVar';\n//# sourceMappingURL=index.js.map"],"names":["React","getApolloContext","invariant","useRef","equal","useEffect","context","useContext","useReducer","__assign","QueryData","useState","MutationData","SubscriptionData","checkDEV"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,SAAS,eAAe,GAAG;AAClC,IAAI,IAAI,MAAM,GAAGA,gBAAK,CAAC,UAAU,CAACC,wBAAgB,EAAE,CAAC,CAAC,MAAM,CAAC;AAC7D,IAAI,OAAO,GAAGC,qBAAS,CAAC,MAAM,EAAE,iEAAiE;AACjG,QAAQ,s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useBaseQuery.js","useLazyQuery.js","useMutation.js","useQuery.js","useSubscription.js","useReactiveVar.js"],"sourcesContent":["import { invariant } from '../../utilities/globals';\nimport * as React from 'react';\nimport { getApolloContext } from '../context';\nexport function useApolloClient() {\n var client = React.useContext(getApolloContext()).client;\n __DEV__ ? invariant(client, 'No Apollo Client instance can be found. Please ensure that you ' +\n 'have called `ApolloProvider` higher up in your tree.') : invariant(client, 33);\n return client;\n}\n//# sourceMappingURL=useApolloClient.js.map","import { useRef } from 'react';\nimport { equal } from '@wry/equality';\nexport function useDeepMemo(memoFn, key) {\n var ref = useRef();\n if (!ref.current || !equal(key, ref.current.key)) {\n ref.current = { key: key, value: memoFn() };\n }\n return ref.current.value;\n}\n//# sourceMappingURL=useDeepMemo.js.map","import '../../../utilities/globals';\nimport { useEffect, useRef } from \"react\";\nexport function useAfterFastRefresh(effectFn) {\n if (__DEV__) {\n var didRefresh_1 = useRef(false);\n useEffect(function () {\n return function () {\n didRefresh_1.current = true;\n };\n }, []);\n useEffect(function () {\n if (didRefresh_1.current === true) {\n didRefresh_1.current = false;\n effectFn();\n }\n }, []);\n }\n}\n//# sourceMappingURL=useAfterFastRefresh.js.map","import { __assign } from \"tslib\";\nimport '../../../utilities/globals';\nimport { useContext, useEffect, useReducer, useRef } from 'react';\nimport { QueryData } from '../../data';\nimport { useDeepMemo } from './useDeepMemo';\nimport { getApolloContext } from '../../context';\nimport { useAfterFastRefresh } from './useAfterFastRefresh';\nexport function useBaseQuery(query, options, lazy) {\n if (lazy === void 0) { lazy = false; }\n var context = useContext(getApolloContext());\n var _a = useReducer(function (x) { return x + 1; }, 0), tick = _a[0], forceUpdate = _a[1];\n var updatedOptions = options ? __assign(__assign({}, options), { query: query }) : { query: query };\n var queryDataRef = useRef();\n var queryData = queryDataRef.current || (queryDataRef.current = new QueryData({\n options: updatedOptions,\n context: context,\n onNewData: function () {\n if (!queryData.ssrInitiated()) {\n Promise.resolve().then(function () { return queryDataRef.current && queryDataRef.current.isMounted && forceUpdate(); });\n }\n else {\n forceUpdate();\n }\n }\n }));\n queryData.setOptions(updatedOptions);\n queryData.context = context;\n var memo = {\n options: __assign(__assign({}, updatedOptions), { onError: void 0, onCompleted: void 0 }),\n context: context,\n tick: tick\n };\n var result = useDeepMemo(function () { return (lazy ? queryData.executeLazy() : queryData.execute()); }, memo);\n var queryResult = lazy\n ? result[1]\n : result;\n if (__DEV__) {\n useAfterFastRefresh(forceUpdate);\n }\n useEffect(function () {\n return function () {\n queryData.cleanup();\n queryDataRef.current = void 0;\n };\n }, []);\n useEffect(function () { return queryData.afterExecute({ lazy: lazy }); }, [\n queryResult.loading,\n queryResult.networkStatus,\n queryResult.error,\n queryResult.data,\n queryData.currentObservable,\n ]);\n return result;\n}\n//# sourceMappingURL=useBaseQuery.js.map","import { useBaseQuery } from './utils/useBaseQuery';\nexport function useLazyQuery(query, options) {\n return useBaseQuery(query, options, true);\n}\n//# sourceMappingURL=useLazyQuery.js.map","import { __assign } from \"tslib\";\nimport { useContext, useState, useRef, useEffect } from 'react';\nimport { MutationData } from '../data';\nimport { getApolloContext } from '../context';\nexport function useMutation(mutation, options) {\n var context = useContext(getApolloContext());\n var _a = useState({ called: false, loading: false }), result = _a[0], setResult = _a[1];\n var updatedOptions = options ? __assign(__assign({}, options), { mutation: mutation }) : { mutation: mutation };\n var mutationDataRef = useRef();\n function getMutationDataRef() {\n if (!mutationDataRef.current) {\n mutationDataRef.current = new MutationData({\n options: updatedOptions,\n context: context,\n result: result,\n setResult: setResult\n });\n }\n return mutationDataRef.current;\n }\n var mutationData = getMutationDataRef();\n mutationData.setOptions(updatedOptions);\n mutationData.context = context;\n useEffect(function () { return mutationData.afterExecute(); });\n return mutationData.execute(result);\n}\n//# sourceMappingURL=useMutation.js.map","import { useBaseQuery } from './utils/useBaseQuery';\nexport function useQuery(query, options) {\n return useBaseQuery(query, options, false);\n}\n//# sourceMappingURL=useQuery.js.map","import { __assign } from \"tslib\";\nimport '../../utilities/globals';\nimport { useContext, useState, useRef, useEffect, useReducer } from 'react';\nimport { SubscriptionData } from '../data';\nimport { getApolloContext } from '../context';\nimport { useAfterFastRefresh } from './utils/useAfterFastRefresh';\nexport function useSubscription(subscription, options) {\n var _a = useReducer(function (x) { return x + 1; }, 0), forceUpdate = _a[1];\n var context = useContext(getApolloContext());\n var updatedOptions = options\n ? __assign(__assign({}, options), { subscription: subscription }) : { subscription: subscription };\n var _b = useState({\n loading: !updatedOptions.skip,\n error: void 0,\n data: void 0,\n }), result = _b[0], setResult = _b[1];\n var subscriptionDataRef = useRef();\n function getSubscriptionDataRef() {\n if (!subscriptionDataRef.current) {\n subscriptionDataRef.current = new SubscriptionData({\n options: updatedOptions,\n context: context,\n setResult: setResult\n });\n }\n return subscriptionDataRef.current;\n }\n var subscriptionData = getSubscriptionDataRef();\n subscriptionData.setOptions(updatedOptions, true);\n subscriptionData.context = context;\n if (__DEV__) {\n useAfterFastRefresh(forceUpdate);\n }\n useEffect(function () { return subscriptionData.afterExecute(); });\n useEffect(function () {\n return function () {\n subscriptionData.cleanup();\n subscriptionDataRef.current = void 0;\n };\n }, []);\n return subscriptionData.execute(result);\n}\n//# sourceMappingURL=useSubscription.js.map","import { useEffect, useState } from 'react';\nexport function useReactiveVar(rv) {\n var value = rv();\n var setValue = useState(value)[1];\n useEffect(function () {\n var probablySameValue = rv();\n if (value !== probablySameValue) {\n setValue(probablySameValue);\n }\n else {\n return rv.onNextChange(setValue);\n }\n }, [value]);\n return value;\n}\n//# sourceMappingURL=useReactiveVar.js.map"],"names":["React","getApolloContext","invariant","useRef","equal","useEffect","context","useContext","useReducer","__assign","QueryData","useState","MutationData","SubscriptionData"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGO,SAAS,eAAe,GAAG;AAClC,IAAI,IAAI,MAAM,GAAGA,gBAAK,CAAC,UAAU,CAACC,wBAAgB,EAAE,CAAC,CAAC,MAAM,CAAC;AAC7D,IAAI,OAAO,GAAGC,iBAAS,CAAC,MAAM,EAAE,iEAAi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from './useMutation';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/index.ts"],"names":[],"mappings":"AAGA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,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 "./useApolloClient.js";
4
3
  export * from "./useLazyQuery.js";
5
4
  export * from "./useMutation.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,QAAQ,EAAE,CAAC;AAEX,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC","sourcesContent":["import { checkDEV } from \"../../utilities\";\ncheckDEV();\n\nexport * from './useApolloClient';\nexport * from './useLazyQuery';\nexport * from './useMutation';\nexport * from './useQuery';\nexport * from './useSubscription';\nexport * from './useReactiveVar';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC","sourcesContent":["import '../../utilities/globals';\n\nexport * from './useApolloClient';\nexport * from './useLazyQuery';\nexport * from './useMutation';\nexport * from './useQuery';\nexport * from './useSubscription';\nexport * from './useReactiveVar';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useApolloClient.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useApolloClient.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,wBAAgB,eAAe,IAAI,YAAY,CAAC,MAAM,CAAC,CAQtD"}
1
+ {"version":3,"file":"useApolloClient.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useApolloClient.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,wBAAgB,eAAe,IAAI,YAAY,CAAC,MAAM,CAAC,CAQtD"}
@@ -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 "../context/index.js";
4
4
  export function useApolloClient() {
5
5
  var client = React.useContext(getApolloContext()).client;
@@ -1 +1 @@
1
- {"version":3,"file":"useApolloClient.js","sourceRoot":"","sources":["../../../src/react/hooks/useApolloClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,UAAU,eAAe;IACrB,IAAA,MAAM,GAAK,KAAK,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,OAAzC,CAA0C;IACxD,SAAS,CACP,MAAM,EACN,iEAAiE;QAC/D,sDAAsD,CACzD,CAAC;IACF,OAAO,MAAO,CAAC;AACjB,CAAC","sourcesContent":["import * as React from 'react';\nimport { invariant } from 'ts-invariant';\n\nimport { ApolloClient } from '../../core';\nimport { getApolloContext } from '../context';\n\nexport function useApolloClient(): ApolloClient<object> {\n const { client } = React.useContext(getApolloContext());\n invariant(\n client,\n 'No Apollo Client instance can be found. Please ensure that you ' +\n 'have called `ApolloProvider` higher up in your tree.'\n );\n return client!;\n}\n"]}
1
+ {"version":3,"file":"useApolloClient.js","sourceRoot":"","sources":["../../../src/react/hooks/useApolloClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,UAAU,eAAe;IACrB,IAAA,MAAM,GAAK,KAAK,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,OAAzC,CAA0C;IACxD,SAAS,CACP,MAAM,EACN,iEAAiE;QAC/D,sDAAsD,CACzD,CAAC;IACF,OAAO,MAAO,CAAC;AACjB,CAAC","sourcesContent":["import { invariant } from '../../utilities/globals';\n\nimport * as React from 'react';\n\nimport { ApolloClient } from '../../core';\nimport { getApolloContext } from '../context';\n\nexport function useApolloClient(): ApolloClient<object> {\n const { client } = React.useContext(getApolloContext());\n invariant(\n client,\n 'No Apollo Client instance can be found. Please ensure that you ' +\n 'have called `ApolloProvider` higher up in your tree.'\n );\n return client!;\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import '../../utilities/globals';
1
2
  import { DocumentNode } from 'graphql';
2
3
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
3
4
  import { SubscriptionHookOptions } from '../types/types';
@@ -1 +1 @@
1
- {"version":3,"file":"useSubscription.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useSubscription.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIhD,wBAAgB,eAAe,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,kBAAkB,EAC1E,YAAY,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,EACjE,OAAO,CAAC,EAAE,uBAAuB,CAAC,KAAK,EAAE,UAAU,CAAC;;;;;EA2CrD"}
1
+ {"version":3,"file":"useSubscription.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useSubscription.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIhD,wBAAgB,eAAe,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,kBAAkB,EAC1E,YAAY,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,EACjE,OAAO,CAAC,EAAE,uBAAuB,CAAC,KAAK,EAAE,UAAU,CAAC;;;;;EA2CrD"}
@@ -1,4 +1,5 @@
1
1
  import { __assign } from "tslib";
2
+ import "../../utilities/globals/index.js";
2
3
  import { useContext, useState, useRef, useEffect, useReducer } from 'react';
3
4
  import { SubscriptionData } from "../data/index.js";
4
5
  import { getApolloContext } from "../context/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"useSubscription.js","sourceRoot":"","sources":["../../../src/react/hooks/useSubscription.ts"],"names":[],"mappings":";AA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B,CAAC,OAAO,GAAG,OAAO,CAAC;IAEnC,IAAI,OAAO,EAAE;QAEX,mBAAmB,CAAC,WAAW,CAAC,CAAC;KAClC;IAED,SAAS,CAAC,cAAM,OAAA,gBAAgB,CAAC,YAAY,EAAE,EAA/B,CAA+B,CAAC,CAAC;IACjD,SAAS,CAAC;QACR,OAAO;YACL,gBAAgB,CAAC,OAAO,EAAE,CAAC;YAC3B,mBAAmB,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;QACvC,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["import { useContext, useState, useRef, useEffect, useReducer } from 'react';\nimport { DocumentNode } from 'graphql';\nimport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport { SubscriptionHookOptions } from '../types/types';\nimport { SubscriptionData } from '../data';\nimport { OperationVariables } from '../../core';\nimport { getApolloContext } from '../context';\nimport { useAfterFastRefresh } from './utils/useAfterFastRefresh';\n\nexport function useSubscription<TData = any, TVariables = OperationVariables>(\n subscription: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options?: SubscriptionHookOptions<TData, TVariables>\n) {\n const [, forceUpdate] = useReducer(x => x + 1, 0);\n const context = useContext(getApolloContext());\n const updatedOptions = options\n ? { ...options, subscription }\n : { subscription };\n const [result, setResult] = useState({\n loading: !updatedOptions.skip,\n error: void 0,\n data: void 0,\n });\n\n const subscriptionDataRef = useRef<SubscriptionData<TData, TVariables>>();\n function getSubscriptionDataRef() {\n if (!subscriptionDataRef.current) {\n subscriptionDataRef.current = new SubscriptionData<TData, TVariables>({\n options: updatedOptions,\n context,\n setResult\n });\n }\n return subscriptionDataRef.current;\n }\n\n const subscriptionData = getSubscriptionDataRef();\n subscriptionData.setOptions(updatedOptions, true);\n subscriptionData.context = context;\n\n if (__DEV__) {\n // ensure we run an update after refreshing so that we can resubscribe\n useAfterFastRefresh(forceUpdate);\n }\n\n useEffect(() => subscriptionData.afterExecute());\n useEffect(() => {\n return () => {\n subscriptionData.cleanup();\n subscriptionDataRef.current = void 0;\n };\n }, []);\n\n return subscriptionData.execute(result);\n}\n"]}
1
+ {"version":3,"file":"useSubscription.js","sourceRoot":"","sources":["../../../src/react/hooks/useSubscription.ts"],"names":[],"mappings":";AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAK5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,MAAM,UAAU,eAAe,CAC7B,YAAiE,EACjE,OAAoD;IAE9C,IAAA,KAAkB,UAAU,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,GAAG,CAAC,EAAL,CAAK,EAAE,CAAC,CAAC,EAAxC,WAAW,QAA6B,CAAC;IAClD,IAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC/C,IAAM,cAAc,GAAG,OAAO;QAC5B,CAAC,uBAAM,OAAO,KAAE,YAAY,cAAA,IAC5B,CAAC,CAAC,EAAE,YAAY,cAAA,EAAE,CAAC;IACf,IAAA,KAAsB,QAAQ,CAAC;QACnC,OAAO,EAAE,CAAC,cAAc,CAAC,IAAI;QAC7B,KAAK,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,KAAK,CAAC;KACb,CAAC,EAJK,MAAM,QAAA,EAAE,SAAS,QAItB,CAAC;IAEH,IAAM,mBAAmB,GAAG,MAAM,EAAuC,CAAC;IAC1E,SAAS,sBAAsB;QAC7B,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE;YAChC,mBAAmB,CAAC,OAAO,GAAG,IAAI,gBAAgB,CAAoB;gBACpE,OAAO,EAAE,cAAc;gBACvB,OAAO,SAAA;gBACP,SAAS,WAAA;aACV,CAAC,CAAC;SACJ;QACD,OAAO,mBAAmB,CAAC,OAAO,CAAC;IACrC,CAAC;IAED,IAAM,gBAAgB,GAAG,sBAAsB,EAAE,CAAC;IAClD,gBAAgB,CAAC,UAAU,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IAClD,gBAAgB,CAAC,OAAO,GAAG,OAAO,CAAC;IAEnC,IAAI,OAAO,EAAE;QAEX,mBAAmB,CAAC,WAAW,CAAC,CAAC;KAClC;IAED,SAAS,CAAC,cAAM,OAAA,gBAAgB,CAAC,YAAY,EAAE,EAA/B,CAA+B,CAAC,CAAC;IACjD,SAAS,CAAC;QACR,OAAO;YACL,gBAAgB,CAAC,OAAO,EAAE,CAAC;YAC3B,mBAAmB,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;QACvC,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["import '../../utilities/globals';\n\nimport { useContext, useState, useRef, useEffect, useReducer } from 'react';\nimport { DocumentNode } from 'graphql';\nimport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport { SubscriptionHookOptions } from '../types/types';\nimport { SubscriptionData } from '../data';\nimport { OperationVariables } from '../../core';\nimport { getApolloContext } from '../context';\nimport { useAfterFastRefresh } from './utils/useAfterFastRefresh';\n\nexport function useSubscription<TData = any, TVariables = OperationVariables>(\n subscription: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options?: SubscriptionHookOptions<TData, TVariables>\n) {\n const [, forceUpdate] = useReducer(x => x + 1, 0);\n const context = useContext(getApolloContext());\n const updatedOptions = options\n ? { ...options, subscription }\n : { subscription };\n const [result, setResult] = useState({\n loading: !updatedOptions.skip,\n error: void 0,\n data: void 0,\n });\n\n const subscriptionDataRef = useRef<SubscriptionData<TData, TVariables>>();\n function getSubscriptionDataRef() {\n if (!subscriptionDataRef.current) {\n subscriptionDataRef.current = new SubscriptionData<TData, TVariables>({\n options: updatedOptions,\n context,\n setResult\n });\n }\n return subscriptionDataRef.current;\n }\n\n const subscriptionData = getSubscriptionDataRef();\n subscriptionData.setOptions(updatedOptions, true);\n subscriptionData.context = context;\n\n if (__DEV__) {\n // ensure we run an update after refreshing so that we can resubscribe\n useAfterFastRefresh(forceUpdate);\n }\n\n useEffect(() => subscriptionData.afterExecute());\n useEffect(() => {\n return () => {\n subscriptionData.cleanup();\n subscriptionDataRef.current = void 0;\n };\n }, []);\n\n return subscriptionData.execute(result);\n}\n"]}
@@ -1,2 +1,3 @@
1
+ import '../../../utilities/globals';
1
2
  export declare function useAfterFastRefresh(effectFn: () => unknown): void;
2
3
  //# sourceMappingURL=useAfterFastRefresh.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAfterFastRefresh.d.ts","sourceRoot":"","sources":["../../../../src/react/hooks/utils/useAfterFastRefresh.ts"],"names":[],"mappings":"AAUA,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,OAAO,QAkB1D"}
1
+ {"version":3,"file":"useAfterFastRefresh.d.ts","sourceRoot":"","sources":["../../../../src/react/hooks/utils/useAfterFastRefresh.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AAWpC,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,OAAO,QAkB1D"}
@@ -1,3 +1,4 @@
1
+ import "../../../utilities/globals/index.js";
1
2
  import { useEffect, useRef } from "react";
2
3
  export function useAfterFastRefresh(effectFn) {
3
4
  if (__DEV__) {
@@ -1 +1 @@
1
- {"version":3,"file":"useAfterFastRefresh.js","sourceRoot":"","sources":["../../../../src/react/hooks/utils/useAfterFastRefresh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAU1C,MAAM,UAAU,mBAAmB,CAAC,QAAuB;IACzD,IAAI,OAAO,EAAE;QACX,IAAM,YAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,SAAS,CAAC;YACR,OAAO;gBAEL,YAAU,CAAC,OAAO,GAAG,IAAI,CAAC;YAC5B,CAAC,CAAC;QACJ,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,SAAS,CAAC;YACR,IAAI,YAAU,CAAC,OAAO,KAAK,IAAI,EAAE;gBAE/B,YAAU,CAAC,OAAO,GAAG,KAAK,CAAC;gBAC3B,QAAQ,EAAE,CAAC;aACZ;QACH,CAAC,EAAE,EAAE,CAAC,CAAA;KACP;AACH,CAAC","sourcesContent":["import { useEffect, useRef } from \"react\";\n\n/**\n * This hook allows running a function only immediately after a react\n * fast refresh or live reload.\n *\n * Useful in order to ensure that we can reinitialize things that have been\n * disposed by cleanup functions in `useEffect`.\n * @param effectFn a function to run immediately after a fast refresh\n */\nexport function useAfterFastRefresh(effectFn: () => unknown) {\n if (__DEV__) {\n const didRefresh = useRef(false);\n useEffect(() => {\n return () => {\n // Detect fast refresh, only runs multiple times in fast refresh\n didRefresh.current = true;\n };\n }, []);\n\n useEffect(() => {\n if (didRefresh.current === true) {\n // This block only runs after a fast refresh\n didRefresh.current = false;\n effectFn();\n }\n }, [])\n }\n}\n"]}
1
+ {"version":3,"file":"useAfterFastRefresh.js","sourceRoot":"","sources":["../../../../src/react/hooks/utils/useAfterFastRefresh.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAU1C,MAAM,UAAU,mBAAmB,CAAC,QAAuB;IACzD,IAAI,OAAO,EAAE;QACX,IAAM,YAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,SAAS,CAAC;YACR,OAAO;gBAEL,YAAU,CAAC,OAAO,GAAG,IAAI,CAAC;YAC5B,CAAC,CAAC;QACJ,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,SAAS,CAAC;YACR,IAAI,YAAU,CAAC,OAAO,KAAK,IAAI,EAAE;gBAE/B,YAAU,CAAC,OAAO,GAAG,KAAK,CAAC;gBAC3B,QAAQ,EAAE,CAAC;aACZ;QACH,CAAC,EAAE,EAAE,CAAC,CAAA;KACP;AACH,CAAC","sourcesContent":["import '../../../utilities/globals';\nimport { useEffect, useRef } from \"react\";\n\n/**\n * This hook allows running a function only immediately after a react\n * fast refresh or live reload.\n *\n * Useful in order to ensure that we can reinitialize things that have been\n * disposed by cleanup functions in `useEffect`.\n * @param effectFn a function to run immediately after a fast refresh\n */\nexport function useAfterFastRefresh(effectFn: () => unknown) {\n if (__DEV__) {\n const didRefresh = useRef(false);\n useEffect(() => {\n return () => {\n // Detect fast refresh, only runs multiple times in fast refresh\n didRefresh.current = true;\n };\n }, []);\n\n useEffect(() => {\n if (didRefresh.current === true) {\n // This block only runs after a fast refresh\n didRefresh.current = false;\n effectFn();\n }\n }, [])\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import '../../../utilities/globals';
1
2
  import { DocumentNode } from 'graphql';
2
3
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
3
4
  import { QueryHookOptions, QueryTuple, QueryResult } from '../../types/types';
@@ -1 +1 @@
1
- {"version":3,"file":"useBaseQuery.d.ts","sourceRoot":"","sources":["../../../../src/react/hooks/utils/useBaseQuery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EACL,gBAAgB,EAEhB,UAAU,EACV,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAInD,wBAAgB,YAAY,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,kBAAkB,EACvE,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,EAC1D,OAAO,CAAC,EAAE,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,EAC7C,IAAI,UAAQ,kEA6Eb"}
1
+ {"version":3,"file":"useBaseQuery.d.ts","sourceRoot":"","sources":["../../../../src/react/hooks/utils/useBaseQuery.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AAGpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EACL,gBAAgB,EAEhB,UAAU,EACV,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAInD,wBAAgB,YAAY,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,kBAAkB,EACvE,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,EAC1D,OAAO,CAAC,EAAE,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,EAC7C,IAAI,UAAQ,kEA6Eb"}
@@ -1,4 +1,5 @@
1
1
  import { __assign } from "tslib";
2
+ import "../../../utilities/globals/index.js";
2
3
  import { useContext, useEffect, useReducer, useRef } from 'react';
3
4
  import { QueryData } from "../../data/index.js";
4
5
  import { useDeepMemo } from "./useDeepMemo.js";
@@ -1 +1 @@
1
- {"version":3,"file":"useBaseQuery.js","sourceRoot":"","sources":["../../../../src/react/hooks/utils/useBaseQuery.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAUlE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,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A,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,EAAtD,CAAsD,EAC5D,IAAI,CACL,CAAC;IAEF,IAAM,WAAW,GAAG,IAAI;QACtB,CAAC,CAAE,MAAwC,CAAC,CAAC,CAAC;QAC9C,CAAC,CAAE,MAAyC,CAAC;IAE/C,IAAI,OAAO,EAAE;QAEX,mBAAmB,CAAC,WAAW,CAAC,CAAC;KAClC;IAED,SAAS,CAAC;QACR,OAAO;YACL,SAAS,CAAC,OAAO,EAAE,CAAC;YAGpB,YAAY,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;QAChC,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,cAAM,OAAA,SAAS,CAAC,YAAY,CAAC,EAAE,IAAI,MAAA,EAAE,CAAC,EAAhC,CAAgC,EAAE;QAChD,WAAW,CAAC,OAAO;QACnB,WAAW,CAAC,aAAa;QACzB,WAAW,CAAC,KAAK;QACjB,WAAW,CAAC,IAAI;QAChB,SAAS,CAAC,iBAAiB;KAC5B,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { useContext, useEffect, useReducer, useRef } from 'react';\nimport { DocumentNode } from 'graphql';\nimport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport {\n QueryHookOptions,\n QueryDataOptions,\n QueryTuple,\n QueryResult,\n} from '../../types/types';\nimport { QueryData } from '../../data';\nimport { useDeepMemo } from './useDeepMemo';\nimport { OperationVariables } from '../../../core';\nimport { getApolloContext } from '../../context';\nimport { useAfterFastRefresh } from './useAfterFastRefresh';\n\nexport function useBaseQuery<TData = any, TVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options?: QueryHookOptions<TData, TVariables>,\n lazy = false\n) {\n const context = useContext(getApolloContext());\n const [tick, forceUpdate] = useReducer(x => x + 1, 0);\n const updatedOptions = options ? { ...options, query } : { query };\n\n const queryDataRef = useRef<QueryData<TData, TVariables>>();\n const queryData = queryDataRef.current || (\n queryDataRef.current = new QueryData<TData, TVariables>({\n options: updatedOptions as QueryDataOptions<TData, TVariables>,\n context,\n onNewData() {\n if (!queryData.ssrInitiated()) {\n // When new data is received from the `QueryData` object, we want to\n // force a re-render to make sure the new data is displayed. We can't\n // force that re-render if we're already rendering however so to be\n // safe we'll trigger the re-render in a microtask. In case the\n // component gets unmounted before this callback fires, we re-check\n // queryDataRef.current.isMounted before calling forceUpdate().\n Promise.resolve().then(() => queryDataRef.current && queryDataRef.current.isMounted && forceUpdate());\n } else {\n // If we're rendering on the server side we can force an update at\n // any point.\n forceUpdate();\n }\n }\n })\n );\n\n queryData.setOptions(updatedOptions);\n queryData.context = context;\n\n // `onError` and `onCompleted` callback functions will not always have a\n // stable identity, so we'll exclude them from the memoization key to\n // prevent `afterExecute` from being triggered un-necessarily.\n const memo = {\n options: {\n ...updatedOptions,\n onError: void 0,\n onCompleted: void 0\n } as QueryHookOptions<TData, TVariables>,\n context,\n tick\n };\n\n const result = useDeepMemo(\n () => (lazy ? queryData.executeLazy() : queryData.execute()),\n memo\n );\n\n const queryResult = lazy\n ? (result as QueryTuple<TData, TVariables>)[1]\n : (result as QueryResult<TData, TVariables>);\n\n if (__DEV__) {\n // ensure we run an update after refreshing so that we reinitialize\n useAfterFastRefresh(forceUpdate);\n }\n\n useEffect(() => {\n return () => {\n queryData.cleanup();\n // this effect can run multiple times during a fast-refresh\n // so make sure we clean up the ref\n queryDataRef.current = void 0;\n }\n }, []);\n\n useEffect(() => queryData.afterExecute({ lazy }), [\n queryResult.loading,\n queryResult.networkStatus,\n queryResult.error,\n queryResult.data,\n queryData.currentObservable,\n ]);\n\n return result;\n}\n"]}
1
+ {"version":3,"file":"useBaseQuery.js","sourceRoot":"","sources":["../../../../src/react/hooks/utils/useBaseQuery.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAC;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,CAAC,CAAC;IACrC,SAAS,CAAC,OAAO,GAAG,OAAO,CAAC;IAK5B,IAAM,IAAI,GAAG;QACX,OAAO,EAAE,sBACJ,cAAc,KACjB,OAAO,EAAE,KAAK,CAAC,EACf,WAAW,EAAE,KAAK,CAAC,GACmB;QACxC,OAAO,SAAA;QACP,IAAI,MAAA;KACL,CAAC;IAEF,IAAM,MAAM,GAAG,WAAW,CACxB,cAAM,OAAA,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,EAAtD,CAAsD,EAC5D,IAAI,CACL,CAAC;IAEF,IAAM,WAAW,GAAG,IAAI;QACtB,CAAC,CAAE,MAAwC,CAAC,CAAC,CAAC;QAC9C,CAAC,CAAE,MAAyC,CAAC;IAE/C,IAAI,OAAO,EAAE;QAEX,mBAAmB,CAAC,WAAW,CAAC,CAAC;KAClC;IAED,SAAS,CAAC;QACR,OAAO;YACL,SAAS,CAAC,OAAO,EAAE,CAAC;YAGpB,YAAY,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;QAChC,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,cAAM,OAAA,SAAS,CAAC,YAAY,CAAC,EAAE,IAAI,MAAA,EAAE,CAAC,EAAhC,CAAgC,EAAE;QAChD,WAAW,CAAC,OAAO;QACnB,WAAW,CAAC,aAAa;QACzB,WAAW,CAAC,KAAK;QACjB,WAAW,CAAC,IAAI;QAChB,SAAS,CAAC,iBAAiB;KAC5B,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import '../../../utilities/globals';\n\nimport { useContext, useEffect, useReducer, useRef } from 'react';\nimport { DocumentNode } from 'graphql';\nimport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport {\n QueryHookOptions,\n QueryDataOptions,\n QueryTuple,\n QueryResult,\n} from '../../types/types';\nimport { QueryData } from '../../data';\nimport { useDeepMemo } from './useDeepMemo';\nimport { OperationVariables } from '../../../core';\nimport { getApolloContext } from '../../context';\nimport { useAfterFastRefresh } from './useAfterFastRefresh';\n\nexport function useBaseQuery<TData = any, TVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options?: QueryHookOptions<TData, TVariables>,\n lazy = false\n) {\n const context = useContext(getApolloContext());\n const [tick, forceUpdate] = useReducer(x => x + 1, 0);\n const updatedOptions = options ? { ...options, query } : { query };\n\n const queryDataRef = useRef<QueryData<TData, TVariables>>();\n const queryData = queryDataRef.current || (\n queryDataRef.current = new QueryData<TData, TVariables>({\n options: updatedOptions as QueryDataOptions<TData, TVariables>,\n context,\n onNewData() {\n if (!queryData.ssrInitiated()) {\n // When new data is received from the `QueryData` object, we want to\n // force a re-render to make sure the new data is displayed. We can't\n // force that re-render if we're already rendering however so to be\n // safe we'll trigger the re-render in a microtask. In case the\n // component gets unmounted before this callback fires, we re-check\n // queryDataRef.current.isMounted before calling forceUpdate().\n Promise.resolve().then(() => queryDataRef.current && queryDataRef.current.isMounted && forceUpdate());\n } else {\n // If we're rendering on the server side we can force an update at\n // any point.\n forceUpdate();\n }\n }\n })\n );\n\n queryData.setOptions(updatedOptions);\n queryData.context = context;\n\n // `onError` and `onCompleted` callback functions will not always have a\n // stable identity, so we'll exclude them from the memoization key to\n // prevent `afterExecute` from being triggered un-necessarily.\n const memo = {\n options: {\n ...updatedOptions,\n onError: void 0,\n onCompleted: void 0\n } as QueryHookOptions<TData, TVariables>,\n context,\n tick\n };\n\n const result = useDeepMemo(\n () => (lazy ? queryData.executeLazy() : queryData.execute()),\n memo\n );\n\n const queryResult = lazy\n ? (result as QueryTuple<TData, TVariables>)[1]\n : (result as QueryResult<TData, TVariables>);\n\n if (__DEV__) {\n // ensure we run an update after refreshing so that we reinitialize\n useAfterFastRefresh(forceUpdate);\n }\n\n useEffect(() => {\n return () => {\n queryData.cleanup();\n // this effect can run multiple times during a fast-refresh\n // so make sure we clean up the ref\n queryDataRef.current = void 0;\n }\n }, []);\n\n useEffect(() => queryData.afterExecute({ lazy }), [\n queryResult.loading,\n queryResult.networkStatus,\n queryResult.error,\n queryResult.data,\n queryData.currentObservable,\n ]);\n\n return result;\n}\n"]}
package/react/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import '../utilities/globals';
1
2
  export { ApolloProvider, ApolloConsumer, getApolloContext, resetApolloContext, ApolloContextValue } from './context';
2
3
  export * from './hooks';
3
4
  export { DocumentType, IDocumentDefinition, operationName, parser } from './parser';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,WAAW,CAAC;AAEnB,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,MAAM,EACP,MAAM,UAAU,CAAC;AAElB,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,WAAW,CAAC;AAEnB,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,MAAM,EACP,MAAM,UAAU,CAAC;AAElB,cAAc,eAAe,CAAC"}
package/react/index.js CHANGED
@@ -1,5 +1,4 @@
1
- import { checkDEV } from "../utilities/index.js";
2
- checkDEV();
1
+ import "../utilities/globals/index.js";
3
2
  export { ApolloProvider, ApolloConsumer, getApolloContext, resetApolloContext } from "./context/index.js";
4
3
  export * from "./hooks/index.js";
5
4
  export { DocumentType, operationName, parser } from "./parser/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,QAAQ,EAAE,CAAC;AAEX,OAAO,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAEnB,MAAM,WAAW,CAAC;AAEnB,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,YAAY,EAEZ,aAAa,EACb,MAAM,EACP,MAAM,UAAU,CAAC;AAElB,cAAc,eAAe,CAAC","sourcesContent":["import { checkDEV } from \"../utilities\";\ncheckDEV();\n\nexport {\n ApolloProvider,\n ApolloConsumer,\n getApolloContext,\n resetApolloContext,\n ApolloContextValue\n} from './context';\n\nexport * from './hooks';\n\nexport {\n DocumentType,\n IDocumentDefinition,\n operationName,\n parser\n} from './parser';\n\nexport * from './types/types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAEnB,MAAM,WAAW,CAAC;AAEnB,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,YAAY,EAEZ,aAAa,EACb,MAAM,EACP,MAAM,UAAU,CAAC;AAElB,cAAc,eAAe,CAAC","sourcesContent":["import '../utilities/globals';\n\nexport {\n ApolloProvider,\n ApolloConsumer,\n getApolloContext,\n resetApolloContext,\n ApolloContextValue\n} from './context';\n\nexport * from './hooks';\n\nexport {\n DocumentType,\n IDocumentDefinition,\n operationName,\n parser\n} from './parser';\n\nexport * from './types/types';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/parser/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EAEZ,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAGjB,oBAAY,YAAY;IACtB,KAAK,IAAA;IACL,QAAQ,IAAA;IACR,YAAY,IAAA;CACb;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CAClD;AAID,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,UAc/C;AAGD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,YAAY,GAAG,mBAAmB,CA2ElE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/parser/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EAEZ,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAEjB,oBAAY,YAAY;IACtB,KAAK,IAAA;IACL,QAAQ,IAAA;IACR,YAAY,IAAA;CACb;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CAClD;AAID,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,UAc/C;AAGD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,YAAY,GAAG,mBAAmB,CA2ElE"}
@@ -1,6 +1,4 @@
1
- import { checkDEV } from "../../utilities/index.js";
2
- checkDEV();
3
- import { invariant } from 'ts-invariant';
1
+ import { invariant } from "../../utilities/globals/index.js";
4
2
  export var DocumentType;
5
3
  (function (DocumentType) {
6
4
  DocumentType[DocumentType["Query"] = 0] = "Query";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/parser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,QAAQ,EAAE,CAAC;AAQX,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,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CAAC;IAEF,IAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAA4B,CAAC;IAC7D,SAAS,GAAG,UAAU,CAAC,mBAAmB,IAAI,EAAE,CAAC;IAEjD,IAAI,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE;QACtD,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;KAC9B;SAAM;QACL,IAAI,GAAG,MAAM,CAAC;KACf;IAED,IAAM,OAAO,GAAG,EAAE,IAAI,MAAA,EAAE,IAAI,MAAA,EAAE,SAAS,WAAA,EAAE,CAAC;IAC1C,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC7B,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { checkDEV } from \"../../utilities\";\ncheckDEV();\n\nimport {\n DocumentNode,\n DefinitionNode,\n VariableDefinitionNode,\n OperationDefinitionNode\n} from 'graphql';\nimport { invariant } from 'ts-invariant';\n\nexport enum DocumentType {\n Query,\n Mutation,\n Subscription\n}\n\nexport interface IDocumentDefinition {\n type: DocumentType;\n name: string;\n variables: ReadonlyArray<VariableDefinitionNode>;\n}\n\nconst cache = new Map();\n\nexport function operationName(type: DocumentType) {\n let name;\n switch (type) {\n case DocumentType.Query:\n name = 'Query';\n break;\n case DocumentType.Mutation:\n name = 'Mutation';\n break;\n case DocumentType.Subscription:\n name = 'Subscription';\n break;\n }\n return name;\n}\n\n// This parser is mostly used to saftey check incoming documents.\nexport function parser(document: DocumentNode): IDocumentDefinition {\n const cached = cache.get(document);\n if (cached) return cached;\n\n let variables, type, name;\n\n invariant(\n !!document && !!document.kind,\n `Argument of ${document} passed to parser was not a valid GraphQL ` +\n `DocumentNode. You may need to use 'graphql-tag' or another method ` +\n `to convert your operation into a document`\n );\n\n const fragments = document.definitions.filter(\n (x: DefinitionNode) => x.kind === 'FragmentDefinition'\n );\n\n const queries = document.definitions.filter(\n (x: DefinitionNode) =>\n x.kind === 'OperationDefinition' && x.operation === 'query'\n );\n\n const mutations = document.definitions.filter(\n (x: DefinitionNode) =>\n x.kind === 'OperationDefinition' && x.operation === 'mutation'\n );\n\n const subscriptions = document.definitions.filter(\n (x: DefinitionNode) =>\n x.kind === 'OperationDefinition' && x.operation === 'subscription'\n );\n\n invariant(\n !fragments.length ||\n (queries.length || mutations.length || subscriptions.length),\n `Passing only a fragment to 'graphql' is not yet supported. ` +\n `You must include a query, subscription or mutation as well`\n );\n\n invariant(\n queries.length + mutations.length + subscriptions.length <= 1,\n `react-apollo only supports a query, subscription, or a mutation per HOC. ` +\n `${document} had ${queries.length} queries, ${subscriptions.length} ` +\n `subscriptions and ${mutations.length} mutations. ` +\n `You can use 'compose' to join multiple operation types to a component`\n );\n\n type = queries.length ? DocumentType.Query : DocumentType.Mutation;\n if (!queries.length && !mutations.length) type = DocumentType.Subscription;\n\n const definitions = queries.length\n ? queries\n : mutations.length\n ? mutations\n : subscriptions;\n\n invariant(\n definitions.length === 1,\n `react-apollo only supports one definition per HOC. ${document} had ` +\n `${definitions.length} definitions. ` +\n `You can use 'compose' to join multiple operation types to a component`\n );\n\n const definition = definitions[0] as OperationDefinitionNode;\n variables = definition.variableDefinitions || [];\n\n if (definition.name && definition.name.kind === 'Name') {\n name = definition.name.value;\n } else {\n name = 'data'; // fallback to using data if no name\n }\n\n const payload = { name, type, variables };\n cache.set(document, payload);\n return payload;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/parser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AASpD,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,iDAAK,CAAA;IACL,uDAAQ,CAAA;IACR,+DAAY,CAAA;AACd,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAQD,IAAM,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;AAExB,MAAM,UAAU,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U,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE;QACtD,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;KAC9B;SAAM;QACL,IAAI,GAAG,MAAM,CAAC;KACf;IAED,IAAM,OAAO,GAAG,EAAE,IAAI,MAAA,EAAE,IAAI,MAAA,EAAE,SAAS,WAAA,EAAE,CAAC;IAC1C,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC7B,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { invariant } from '../../utilities/globals';\n\nimport {\n DocumentNode,\n DefinitionNode,\n VariableDefinitionNode,\n OperationDefinitionNode\n} from 'graphql';\n\nexport enum DocumentType {\n Query,\n Mutation,\n Subscription\n}\n\nexport interface IDocumentDefinition {\n type: DocumentType;\n name: string;\n variables: ReadonlyArray<VariableDefinitionNode>;\n}\n\nconst cache = new Map();\n\nexport function operationName(type: DocumentType) {\n let name;\n switch (type) {\n case DocumentType.Query:\n name = 'Query';\n break;\n case DocumentType.Mutation:\n name = 'Mutation';\n break;\n case DocumentType.Subscription:\n name = 'Subscription';\n break;\n }\n return name;\n}\n\n// This parser is mostly used to safety check incoming documents.\nexport function parser(document: DocumentNode): IDocumentDefinition {\n const cached = cache.get(document);\n if (cached) return cached;\n\n let variables, type, name;\n\n invariant(\n !!document && !!document.kind,\n `Argument of ${document} passed to parser was not a valid GraphQL ` +\n `DocumentNode. You may need to use 'graphql-tag' or another method ` +\n `to convert your operation into a document`\n );\n\n const fragments = document.definitions.filter(\n (x: DefinitionNode) => x.kind === 'FragmentDefinition'\n );\n\n const queries = document.definitions.filter(\n (x: DefinitionNode) =>\n x.kind === 'OperationDefinition' && x.operation === 'query'\n );\n\n const mutations = document.definitions.filter(\n (x: DefinitionNode) =>\n x.kind === 'OperationDefinition' && x.operation === 'mutation'\n );\n\n const subscriptions = document.definitions.filter(\n (x: DefinitionNode) =>\n x.kind === 'OperationDefinition' && x.operation === 'subscription'\n );\n\n invariant(\n !fragments.length ||\n (queries.length || mutations.length || subscriptions.length),\n `Passing only a fragment to 'graphql' is not yet supported. ` +\n `You must include a query, subscription or mutation as well`\n );\n\n invariant(\n queries.length + mutations.length + subscriptions.length <= 1,\n `react-apollo only supports a query, subscription, or a mutation per HOC. ` +\n `${document} had ${queries.length} queries, ${subscriptions.length} ` +\n `subscriptions and ${mutations.length} mutations. ` +\n `You can use 'compose' to join multiple operation types to a component`\n );\n\n type = queries.length ? DocumentType.Query : DocumentType.Mutation;\n if (!queries.length && !mutations.length) type = DocumentType.Subscription;\n\n const definitions = queries.length\n ? queries\n : mutations.length\n ? mutations\n : subscriptions;\n\n invariant(\n definitions.length === 1,\n `react-apollo only supports one definition per HOC. ${document} had ` +\n `${definitions.length} definitions. ` +\n `You can use 'compose' to join multiple operation types to a component`\n );\n\n const definition = definitions[0] as OperationDefinitionNode;\n variables = definition.variableDefinitions || [];\n\n if (definition.name && definition.name.kind === 'Name') {\n name = definition.name.value;\n } else {\n name = 'data'; // fallback to using data if no name\n }\n\n const payload = { name, type, variables };\n cache.set(document, payload);\n return payload;\n}\n"]}
@@ -2,10 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var utilities = require('../../utilities');
6
- var tsInvariant = require('ts-invariant');
5
+ var globals = require('../../utilities/globals');
7
6
 
8
- utilities.checkDEV();
9
7
  exports.DocumentType = void 0;
10
8
  (function (DocumentType) {
11
9
  DocumentType[DocumentType["Query"] = 0] = "Query";
@@ -33,9 +31,9 @@ function parser(document) {
33
31
  if (cached)
34
32
  return cached;
35
33
  var variables, type, name;
36
- __DEV__ ? tsInvariant.invariant(!!document && !!document.kind, "Argument of " + document + " passed to parser was not a valid GraphQL " +
34
+ __DEV__ ? globals.invariant(!!document && !!document.kind, "Argument of " + document + " passed to parser was not a valid GraphQL " +
37
35
  "DocumentNode. You may need to use 'graphql-tag' or another method " +
38
- "to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 34);
36
+ "to convert your operation into a document") : globals.invariant(!!document && !!document.kind, 34);
39
37
  var fragments = document.definitions.filter(function (x) { return x.kind === 'FragmentDefinition'; });
40
38
  var queries = document.definitions.filter(function (x) {
41
39
  return x.kind === 'OperationDefinition' && x.operation === 'query';
@@ -46,14 +44,14 @@ function parser(document) {
46
44
  var subscriptions = document.definitions.filter(function (x) {
47
45
  return x.kind === 'OperationDefinition' && x.operation === 'subscription';
48
46
  });
49
- __DEV__ ? tsInvariant.invariant(!fragments.length ||
47
+ __DEV__ ? globals.invariant(!fragments.length ||
50
48
  (queries.length || mutations.length || subscriptions.length), "Passing only a fragment to 'graphql' is not yet supported. " +
51
- "You must include a query, subscription or mutation as well") : tsInvariant.invariant(!fragments.length ||
49
+ "You must include a query, subscription or mutation as well") : globals.invariant(!fragments.length ||
52
50
  (queries.length || mutations.length || subscriptions.length), 35);
53
- __DEV__ ? tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
51
+ __DEV__ ? globals.invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
54
52
  (document + " had " + queries.length + " queries, " + subscriptions.length + " ") +
55
53
  ("subscriptions and " + mutations.length + " mutations. ") +
56
- "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, 36);
54
+ "You can use 'compose' to join multiple operation types to a component") : globals.invariant(queries.length + mutations.length + subscriptions.length <= 1, 36);
57
55
  type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
58
56
  if (!queries.length && !mutations.length)
59
57
  type = exports.DocumentType.Subscription;
@@ -62,9 +60,9 @@ function parser(document) {
62
60
  : mutations.length
63
61
  ? mutations
64
62
  : subscriptions;
65
- __DEV__ ? tsInvariant.invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. " + document + " had " +
63
+ __DEV__ ? globals.invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. " + document + " had " +
66
64
  (definitions.length + " definitions. ") +
67
- "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 37);
65
+ "You can use 'compose' to join multiple operation types to a component") : globals.invariant(definitions.length === 1, 37);
68
66
  var definition = definitions[0];
69
67
  variables = definition.variableDefinitions || [];
70
68
  if (definition.name && definition.name.kind === 'Name') {
@@ -1 +1 @@
1
- {"version":3,"file":"parser.cjs.js","sources":["index.js"],"sourcesContent":["import { checkDEV } from \"../../utilities\";\ncheckDEV();\nimport { invariant } from 'ts-invariant';\nexport var DocumentType;\n(function (DocumentType) {\n DocumentType[DocumentType[\"Query\"] = 0] = \"Query\";\n DocumentType[DocumentType[\"Mutation\"] = 1] = \"Mutation\";\n DocumentType[DocumentType[\"Subscription\"] = 2] = \"Subscription\";\n})(DocumentType || (DocumentType = {}));\nvar cache = new Map();\nexport function operationName(type) {\n var name;\n switch (type) {\n case DocumentType.Query:\n name = 'Query';\n break;\n case DocumentType.Mutation:\n name = 'Mutation';\n break;\n case DocumentType.Subscription:\n name = 'Subscription';\n break;\n }\n return name;\n}\nexport function parser(document) {\n var cached = cache.get(document);\n if (cached)\n return cached;\n var variables, type, name;\n __DEV__ ? invariant(!!document && !!document.kind, \"Argument of \" + document + \" passed to parser was not a valid GraphQL \" +\n \"DocumentNode. You may need to use 'graphql-tag' or another method \" +\n \"to convert your operation into a document\") : invariant(!!document && !!document.kind, 34);\n var fragments = document.definitions.filter(function (x) { return x.kind === 'FragmentDefinition'; });\n var queries = document.definitions.filter(function (x) {\n return x.kind === 'OperationDefinition' && x.operation === 'query';\n });\n var mutations = document.definitions.filter(function (x) {\n return x.kind === 'OperationDefinition' && x.operation === 'mutation';\n });\n var subscriptions = document.definitions.filter(function (x) {\n return x.kind === 'OperationDefinition' && x.operation === 'subscription';\n });\n __DEV__ ? invariant(!fragments.length ||\n (queries.length || mutations.length || subscriptions.length), \"Passing only a fragment to 'graphql' is not yet supported. \" +\n \"You must include a query, subscription or mutation as well\") : invariant(!fragments.length ||\n (queries.length || mutations.length || subscriptions.length), 35);\n __DEV__ ? invariant(queries.length + mutations.length + subscriptions.length <= 1, \"react-apollo only supports a query, subscription, or a mutation per HOC. \" +\n (document + \" had \" + queries.length + \" queries, \" + subscriptions.length + \" \") +\n (\"subscriptions and \" + mutations.length + \" mutations. \") +\n \"You can use 'compose' to join multiple operation types to a component\") : invariant(queries.length + mutations.length + subscriptions.length <= 1, 36);\n type = queries.length ? DocumentType.Query : DocumentType.Mutation;\n if (!queries.length && !mutations.length)\n type = DocumentType.Subscription;\n var definitions = queries.length\n ? queries\n : mutations.length\n ? mutations\n : subscriptions;\n __DEV__ ? invariant(definitions.length === 1, \"react-apollo only supports one definition per HOC. \" + document + \" had \" +\n (definitions.length + \" definitions. \") +\n \"You can use 'compose' to join multiple operation types to a component\") : invariant(definitions.length === 1, 37);\n var definition = definitions[0];\n variables = definition.variableDefinitions || [];\n if (definition.name && definition.name.kind === 'Name') {\n name = definition.name.value;\n }\n else {\n name = 'data';\n }\n var payload = { name: name, type: type, variables: variables };\n cache.set(document, payload);\n return payload;\n}\n//# sourceMappingURL=index.js.map"],"names":["checkDEV","DocumentType","invariant"],"mappings":";;;;;;;AACAA,kBAAQ,EAAE,CAAC;AAEAC,8BAAa;AACxB,CAAC,UAAU,YAAY,EAAE;AACzB,IAAI,YAAY,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC;AACtD,IAAI,YAAY,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC;AAC5D,IAAI,YAAY,CAAC,YAAY,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,cAAc,CAAC;AACpE,CAAC,EAAEA,oBAAY,KAAKA,oBAAY,GAAG,EAAE,CAAC,CAAC,CAAC;AACxC,IAAI,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;AACf,SAAS,aAAa,CAAC,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parser.cjs.js","sources":["index.js"],"sourcesContent":["import { invariant } from '../../utilities/globals';\nexport var DocumentType;\n(function (DocumentType) {\n DocumentType[DocumentType[\"Query\"] = 0] = \"Query\";\n DocumentType[DocumentType[\"Mutation\"] = 1] = \"Mutation\";\n DocumentType[DocumentType[\"Subscription\"] = 2] = \"Subscription\";\n})(DocumentType || (DocumentType = {}));\nvar cache = new Map();\nexport function operationName(type) {\n var name;\n switch (type) {\n case DocumentType.Query:\n name = 'Query';\n break;\n case DocumentType.Mutation:\n name = 'Mutation';\n break;\n case DocumentType.Subscription:\n name = 'Subscription';\n break;\n }\n return name;\n}\nexport function parser(document) {\n var cached = cache.get(document);\n if (cached)\n return cached;\n var variables, type, name;\n __DEV__ ? invariant(!!document && !!document.kind, \"Argument of \" + document + \" passed to parser was not a valid GraphQL \" +\n \"DocumentNode. You may need to use 'graphql-tag' or another method \" +\n \"to convert your operation into a document\") : invariant(!!document && !!document.kind, 34);\n var fragments = document.definitions.filter(function (x) { return x.kind === 'FragmentDefinition'; });\n var queries = document.definitions.filter(function (x) {\n return x.kind === 'OperationDefinition' && x.operation === 'query';\n });\n var mutations = document.definitions.filter(function (x) {\n return x.kind === 'OperationDefinition' && x.operation === 'mutation';\n });\n var subscriptions = document.definitions.filter(function (x) {\n return x.kind === 'OperationDefinition' && x.operation === 'subscription';\n });\n __DEV__ ? invariant(!fragments.length ||\n (queries.length || mutations.length || subscriptions.length), \"Passing only a fragment to 'graphql' is not yet supported. \" +\n \"You must include a query, subscription or mutation as well\") : invariant(!fragments.length ||\n (queries.length || mutations.length || subscriptions.length), 35);\n __DEV__ ? invariant(queries.length + mutations.length + subscriptions.length <= 1, \"react-apollo only supports a query, subscription, or a mutation per HOC. \" +\n (document + \" had \" + queries.length + \" queries, \" + subscriptions.length + \" \") +\n (\"subscriptions and \" + mutations.length + \" mutations. \") +\n \"You can use 'compose' to join multiple operation types to a component\") : invariant(queries.length + mutations.length + subscriptions.length <= 1, 36);\n type = queries.length ? DocumentType.Query : DocumentType.Mutation;\n if (!queries.length && !mutations.length)\n type = DocumentType.Subscription;\n var definitions = queries.length\n ? queries\n : mutations.length\n ? mutations\n : subscriptions;\n __DEV__ ? invariant(definitions.length === 1, \"react-apollo only supports one definition per HOC. \" + document + \" had \" +\n (definitions.length + \" definitions. \") +\n \"You can use 'compose' to join multiple operation types to a component\") : invariant(definitions.length === 1, 37);\n var definition = definitions[0];\n variables = definition.variableDefinitions || [];\n if (definition.name && definition.name.kind === 'Name') {\n name = definition.name.value;\n }\n else {\n name = 'data';\n }\n var payload = { name: name, type: type, variables: variables };\n cache.set(document, payload);\n return payload;\n}\n//# sourceMappingURL=index.js.map"],"names":["DocumentType","invariant"],"mappings":";;;;;;AACWA,8BAAa;AACxB,CAAC,UAAU,YAAY,EAAE;AACzB,IAAI,YAAY,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC;AACtD,IAAI,YAAY,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC;AAC5D,IAAI,YAAY,CAAC,YAAY,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,cAAc,CAAC;AACpE,CAAC,EAAEA,oBAAY,KAAKA,oBAAY,GAAG,EAAE,CAAC,CAAC,CAAC;AACxC,IAAI,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;AACf,SAAS,aAAa,CAAC,IAAI,EAAE;AACpC,IAAI,IAAI,IAAI,CAAC;AACb,IAAI,QAAQ,IAAI;AAChB,QAAQ,KAAKA,oBAAY,CAAC,KAAK;AAC/B,YAAY,IAAI,GAAG,OAAO,CAAC;AAC3B,YAAY,MAAM;AAClB,QAAQ,KAAKA,oBAAY,CAAC,QAAQ;AAClC,YAAY,IAAI,GAAG,UAAU,CAAC;AAC9B,YAAY,MAAM;AAClB,QAAQ,KAAKA,oBAAY,CAAC,YAAY;AACtC,YAAY,IAAI,GAAG,cAAc,CAAC;AAClC,YAAY,M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SAAS;AACvB,cAAc,aAAa,CAAC;AAC5B,IAAI,OAAO,GAAGC,iBAAS,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,qDAAqD,GAAG,QAAQ,GAAG,OAAO;AAC5H,SAAS,WAAW,CAAC,MAAM,GAAG,gBAAgB,CAAC;AAC/C,QAAQ,uEAAuE,CAAC,GAAGA,iBAAS,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;AAC3H,IAAI,IAAI,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AACpC,IAAI,SAAS,GAAG,UAAU,CAAC,mBAAmB,IAAI,EAAE,CAAC;AACrD,IAAI,IAAI,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE;AAC5D,QAAQ,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;AACrC,KAAK;AACL,SAAS;AACT,QAAQ,IAAI,GAAG,MAAM,CAAC;AACtB,KAAK;AACL,IAAI,IAAI,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AACnE,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACjC,IAAI,OAAO,OAAO,CAAC;AACnB;;;;;"}
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var utilities = require('../utilities');
5
+ require('../utilities/globals');
6
6
  var context = require('./context');
7
7
  var hooks = require('./hooks');
8
8
  var parser = require('./parser');
9
9
 
10
- utilities.checkDEV();
10
+
11
11
 
12
12
  exports.ApolloConsumer = context.ApolloConsumer;
13
13
  exports.ApolloProvider = context.ApolloProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"react.cjs.js","sources":["index.js"],"sourcesContent":["import { checkDEV } from \"../utilities\";\ncheckDEV();\nexport { ApolloProvider, ApolloConsumer, getApolloContext, resetApolloContext } from './context';\nexport * from './hooks';\nexport { DocumentType, operationName, parser } from './parser';\nexport * from './types/types';\n//# sourceMappingURL=index.js.map"],"names":["checkDEV"],"mappings":";;;;;;;;;AACAA,kBAAQ,EAAE;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"react.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +1,3 @@
1
+ import '../utilities/globals';
1
2
  export * from '../utilities/testing';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAGA,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,cAAc,sBAAsB,CAAC"}
package/testing/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import { checkDEV } from "../utilities/index.js";
2
- checkDEV();
1
+ import "../utilities/globals/index.js";
3
2
  export * from "../utilities/testing/index.js";
4
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,QAAQ,EAAE,CAAC;AAEX,cAAc,sBAAsB,CAAC","sourcesContent":["import { checkDEV } from \"../utilities\";\ncheckDEV();\n\nexport * from '../utilities/testing';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,cAAc,sBAAsB,CAAC","sourcesContent":["import '../utilities/globals';\nexport * from '../utilities/testing';\n"]}