@apollo/client 3.9.0-alpha.2 → 3.9.0-alpha.4

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 (226) hide show
  1. package/apollo-client.cjs +136 -81
  2. package/apollo-client.cjs.map +1 -1
  3. package/apollo-client.min.cjs +1 -1
  4. package/cache/cache.cjs +47 -11
  5. package/cache/cache.cjs.map +1 -1
  6. package/cache/cache.cjs.native.js +47 -11
  7. package/cache/core/types/common.d.ts +2 -2
  8. package/cache/core/types/common.d.ts.map +1 -1
  9. package/cache/core/types/common.js.map +1 -1
  10. package/cache/inmemory/entityStore.d.ts.map +1 -1
  11. package/cache/inmemory/entityStore.js +35 -0
  12. package/cache/inmemory/entityStore.js.map +1 -1
  13. package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
  14. package/cache/inmemory/inMemoryCache.js +2 -1
  15. package/cache/inmemory/inMemoryCache.js.map +1 -1
  16. package/cache/inmemory/key-extractor.js +1 -1
  17. package/cache/inmemory/policies.js +4 -4
  18. package/cache/inmemory/readFromStore.js +2 -2
  19. package/cache/inmemory/writeToStore.js +4 -4
  20. package/core/ApolloClient.d.ts +2 -0
  21. package/core/ApolloClient.d.ts.map +1 -1
  22. package/core/ApolloClient.js +12 -4
  23. package/core/ApolloClient.js.map +1 -1
  24. package/core/LocalState.js +2 -2
  25. package/core/ObservableQuery.js +5 -5
  26. package/core/QueryManager.d.ts +4 -2
  27. package/core/QueryManager.d.ts.map +1 -1
  28. package/core/QueryManager.js +13 -12
  29. package/core/QueryManager.js.map +1 -1
  30. package/core/core.cjs +32 -23
  31. package/core/core.cjs.map +1 -1
  32. package/core/core.cjs.native.js +32 -23
  33. package/dev/dev.cjs +98 -83
  34. package/dev/dev.cjs.map +1 -1
  35. package/dev/dev.cjs.native.js +98 -83
  36. package/dev/loadErrorMessageHandler.js +1 -1
  37. package/dev/loadErrorMessageHandler.js.map +1 -1
  38. package/invariantErrorCodes.js +96 -81
  39. package/link/core/ApolloLink.js +2 -2
  40. package/link/core/core.cjs +2 -2
  41. package/link/core/core.cjs.map +1 -1
  42. package/link/core/core.cjs.native.js +2 -2
  43. package/link/http/checkFetcher.js +1 -1
  44. package/link/http/createHttpLink.js +1 -1
  45. package/link/http/http.cjs +3 -3
  46. package/link/http/http.cjs.map +1 -1
  47. package/link/http/http.cjs.native.js +3 -3
  48. package/link/http/serializeFetchParameter.js +1 -1
  49. package/link/persisted-queries/index.js +2 -2
  50. package/link/persisted-queries/persisted-queries.cjs +2 -2
  51. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  52. package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
  53. package/link/utils/toPromise.js +1 -1
  54. package/link/utils/utils.cjs +2 -2
  55. package/link/utils/utils.cjs.map +1 -1
  56. package/link/utils/utils.cjs.native.js +2 -2
  57. package/link/utils/validateOperation.js +1 -1
  58. package/package.json +27 -25
  59. package/react/cache/QueryReference.d.ts.map +1 -1
  60. package/react/cache/QueryReference.js +7 -2
  61. package/react/cache/QueryReference.js.map +1 -1
  62. package/react/components/Mutation.d.ts +2 -2
  63. package/react/components/Mutation.d.ts.map +1 -1
  64. package/react/components/Mutation.js.map +1 -1
  65. package/react/components/Query.d.ts +2 -2
  66. package/react/components/Query.d.ts.map +1 -1
  67. package/react/components/Query.js.map +1 -1
  68. package/react/components/Subscription.d.ts +2 -2
  69. package/react/components/Subscription.d.ts.map +1 -1
  70. package/react/components/Subscription.js.map +1 -1
  71. package/react/components/types.d.ts +4 -4
  72. package/react/components/types.d.ts.map +1 -1
  73. package/react/components/types.js.map +1 -1
  74. package/react/context/ApolloConsumer.d.ts +3 -3
  75. package/react/context/ApolloConsumer.d.ts.map +1 -1
  76. package/react/context/ApolloConsumer.js +2 -2
  77. package/react/context/ApolloConsumer.js.map +1 -1
  78. package/react/context/ApolloContext.d.ts +2 -2
  79. package/react/context/ApolloContext.d.ts.map +1 -1
  80. package/react/context/ApolloContext.js +2 -2
  81. package/react/context/ApolloContext.js.map +1 -1
  82. package/react/context/ApolloProvider.d.ts +3 -3
  83. package/react/context/ApolloProvider.d.ts.map +1 -1
  84. package/react/context/ApolloProvider.js +2 -2
  85. package/react/context/ApolloProvider.js.map +1 -1
  86. package/react/context/context.cjs +4 -4
  87. package/react/context/context.cjs.map +1 -1
  88. package/react/context/context.cjs.native.js +4 -4
  89. package/react/hoc/graphql.d.ts +2 -2
  90. package/react/hoc/graphql.d.ts.map +1 -1
  91. package/react/hoc/graphql.js.map +1 -1
  92. package/react/hoc/hoc-utils.d.ts +2 -1
  93. package/react/hoc/hoc-utils.d.ts.map +1 -1
  94. package/react/hoc/hoc-utils.js +2 -2
  95. package/react/hoc/hoc-utils.js.map +1 -1
  96. package/react/hoc/hoc.cjs +3 -3
  97. package/react/hoc/hoc.cjs.map +1 -1
  98. package/react/hoc/hoc.cjs.native.js +3 -3
  99. package/react/hoc/mutation-hoc.d.ts +2 -2
  100. package/react/hoc/mutation-hoc.d.ts.map +1 -1
  101. package/react/hoc/mutation-hoc.js +1 -1
  102. package/react/hoc/mutation-hoc.js.map +1 -1
  103. package/react/hoc/query-hoc.d.ts +2 -2
  104. package/react/hoc/query-hoc.d.ts.map +1 -1
  105. package/react/hoc/query-hoc.js +1 -1
  106. package/react/hoc/query-hoc.js.map +1 -1
  107. package/react/hoc/subscription-hoc.d.ts +2 -2
  108. package/react/hoc/subscription-hoc.d.ts.map +1 -1
  109. package/react/hoc/subscription-hoc.js +1 -1
  110. package/react/hoc/subscription-hoc.js.map +1 -1
  111. package/react/hoc/withApollo.d.ts +2 -2
  112. package/react/hoc/withApollo.d.ts.map +1 -1
  113. package/react/hoc/withApollo.js +2 -2
  114. package/react/hoc/withApollo.js.map +1 -1
  115. package/react/hooks/hooks.cjs +16 -11
  116. package/react/hooks/hooks.cjs.map +1 -1
  117. package/react/hooks/hooks.cjs.native.js +16 -11
  118. package/react/hooks/index.d.ts +1 -0
  119. package/react/hooks/index.d.ts.map +1 -1
  120. package/react/hooks/index.js.map +1 -1
  121. package/react/hooks/internal/__use.js +1 -1
  122. package/react/hooks/internal/__use.js.map +1 -1
  123. package/react/hooks/internal/useDeepMemo.js +1 -1
  124. package/react/hooks/internal/useDeepMemo.js.map +1 -1
  125. package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts +2 -1
  126. package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +1 -1
  127. package/react/hooks/internal/useIsomorphicLayoutEffect.js +1 -1
  128. package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
  129. package/react/hooks/useApolloClient.js +2 -2
  130. package/react/hooks/useApolloClient.js.map +1 -1
  131. package/react/hooks/useBackgroundQuery.js +1 -1
  132. package/react/hooks/useBackgroundQuery.js.map +1 -1
  133. package/react/hooks/useFragment.js +1 -1
  134. package/react/hooks/useFragment.js.map +1 -1
  135. package/react/hooks/useLazyQuery.js +1 -1
  136. package/react/hooks/useLazyQuery.js.map +1 -1
  137. package/react/hooks/useMutation.js +1 -1
  138. package/react/hooks/useMutation.js.map +1 -1
  139. package/react/hooks/useQuery.js +2 -2
  140. package/react/hooks/useQuery.js.map +1 -1
  141. package/react/hooks/useReactiveVar.js +1 -1
  142. package/react/hooks/useReactiveVar.js.map +1 -1
  143. package/react/hooks/useReadQuery.d.ts +7 -4
  144. package/react/hooks/useReadQuery.d.ts.map +1 -1
  145. package/react/hooks/useReadQuery.js +2 -2
  146. package/react/hooks/useReadQuery.js.map +1 -1
  147. package/react/hooks/useSubscription.js +3 -3
  148. package/react/hooks/useSubscription.js.map +1 -1
  149. package/react/hooks/useSuspenseQuery.js +3 -3
  150. package/react/hooks/useSuspenseQuery.js.map +1 -1
  151. package/react/hooks/useSyncExternalStore.js +2 -2
  152. package/react/hooks/useSyncExternalStore.js.map +1 -1
  153. package/react/parser/index.js +5 -5
  154. package/react/parser/parser.cjs +5 -5
  155. package/react/parser/parser.cjs.map +1 -1
  156. package/react/parser/parser.cjs.native.js +5 -5
  157. package/react/ssr/RenderPromises.d.ts +3 -3
  158. package/react/ssr/RenderPromises.d.ts.map +1 -1
  159. package/react/ssr/RenderPromises.js.map +1 -1
  160. package/react/ssr/getDataFromTree.d.ts +4 -4
  161. package/react/ssr/getDataFromTree.d.ts.map +1 -1
  162. package/react/ssr/getDataFromTree.js +1 -1
  163. package/react/ssr/getDataFromTree.js.map +1 -1
  164. package/react/ssr/renderToStringWithData.d.ts +2 -2
  165. package/react/ssr/renderToStringWithData.d.ts.map +1 -1
  166. package/react/ssr/renderToStringWithData.js.map +1 -1
  167. package/react/ssr/ssr.cjs +1 -1
  168. package/react/ssr/ssr.cjs.map +1 -1
  169. package/react/ssr/ssr.cjs.native.js +1 -1
  170. package/react/types/types.d.ts +2 -2
  171. package/react/types/types.d.ts.map +1 -1
  172. package/react/types/types.js.map +1 -1
  173. package/testing/core/core.cjs +2 -2
  174. package/testing/core/core.cjs.map +1 -1
  175. package/testing/core/core.cjs.native.js +2 -2
  176. package/testing/core/mocking/mockLink.js +2 -2
  177. package/testing/react/MockedProvider.d.ts +1 -0
  178. package/testing/react/MockedProvider.d.ts.map +1 -1
  179. package/testing/react/MockedProvider.js +2 -1
  180. package/testing/react/MockedProvider.js.map +1 -1
  181. package/testing/testing.cjs +2 -1
  182. package/testing/testing.cjs.map +1 -1
  183. package/testing/testing.cjs.native.js +2 -1
  184. package/utilities/globals/globals.cjs +1 -1
  185. package/utilities/globals/globals.cjs.map +1 -1
  186. package/utilities/globals/globals.cjs.native.js +1 -1
  187. package/utilities/graphql/DocumentTransform.js +1 -1
  188. package/utilities/graphql/directives.js +4 -4
  189. package/utilities/graphql/fragments.js +3 -3
  190. package/utilities/graphql/getFromAST.js +8 -8
  191. package/utilities/graphql/print.d.ts +4 -2
  192. package/utilities/graphql/print.d.ts.map +1 -1
  193. package/utilities/graphql/print.js +8 -3
  194. package/utilities/graphql/print.js.map +1 -1
  195. package/utilities/graphql/storeUtils.d.ts +5 -0
  196. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  197. package/utilities/graphql/storeUtils.js +1 -1
  198. package/utilities/graphql/storeUtils.js.map +1 -1
  199. package/utilities/graphql/transform.js +2 -2
  200. package/utilities/index.d.ts +1 -1
  201. package/utilities/index.d.ts.map +1 -1
  202. package/utilities/index.js.map +1 -1
  203. package/utilities/subscriptions/relay/index.d.ts +6 -0
  204. package/utilities/subscriptions/relay/index.d.ts.map +1 -0
  205. package/utilities/subscriptions/relay/index.js +43 -0
  206. package/utilities/subscriptions/relay/index.js.map +1 -0
  207. package/utilities/subscriptions/relay/package.json +8 -0
  208. package/utilities/subscriptions/relay/relay.cjs +368 -0
  209. package/utilities/subscriptions/relay/relay.cjs.map +1 -0
  210. package/utilities/subscriptions/relay/relay.cjs.native.js +368 -0
  211. package/utilities/subscriptions/shared.d.ts +9 -0
  212. package/utilities/subscriptions/shared.d.ts.map +1 -0
  213. package/utilities/subscriptions/shared.js +7 -0
  214. package/utilities/subscriptions/shared.js.map +1 -0
  215. package/utilities/subscriptions/urql/index.d.ts +7 -0
  216. package/utilities/subscriptions/urql/index.d.ts.map +1 -0
  217. package/utilities/subscriptions/urql/index.js +40 -0
  218. package/utilities/subscriptions/urql/index.js.map +1 -0
  219. package/utilities/subscriptions/urql/package.json +8 -0
  220. package/utilities/subscriptions/urql/urql.cjs +364 -0
  221. package/utilities/subscriptions/urql/urql.cjs.map +1 -0
  222. package/utilities/subscriptions/urql/urql.cjs.native.js +364 -0
  223. package/utilities/utilities.cjs +27 -22
  224. package/utilities/utilities.cjs.map +1 -1
  225. package/utilities/utilities.cjs.native.js +27 -22
  226. package/version.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo/client",
3
- "version": "3.9.0-alpha.2",
3
+ "version": "3.9.0-alpha.4",
4
4
  "description": "A fully-featured caching GraphQL client.",
5
5
  "private": false,
6
6
  "keywords": [
@@ -59,6 +59,7 @@
59
59
  "hoist-non-react-statics": "^3.3.2",
60
60
  "optimism": "^0.17.5",
61
61
  "prop-types": "^15.7.2",
62
+ "rehackt": "0.0.3",
62
63
  "response-iterator": "^0.2.6",
63
64
  "symbol-observable": "^4.0.0",
64
65
  "ts-invariant": "^0.10.3",
@@ -66,12 +67,12 @@
66
67
  "zen-observable-ts": "^1.2.5"
67
68
  },
68
69
  "devDependencies": {
69
- "@arethetypeswrong/cli": "0.11.0",
70
+ "@arethetypeswrong/cli": "0.12.2",
70
71
  "@babel/parser": "7.23.0",
71
72
  "@changesets/changelog-github": "0.4.8",
72
73
  "@changesets/cli": "2.26.2",
73
74
  "@graphql-tools/schema": "10.0.0",
74
- "@microsoft/api-extractor": "7.37.0",
75
+ "@microsoft/api-extractor": "7.38.0",
75
76
  "@rollup/plugin-node-resolve": "11.2.1",
76
77
  "@size-limit/esbuild-why": "8.2.6",
77
78
  "@size-limit/preset-small-lib": "8.2.6",
@@ -80,36 +81,37 @@
80
81
  "@testing-library/react-12": "npm:@testing-library/react@^12",
81
82
  "@testing-library/user-event": "14.5.1",
82
83
  "@tsconfig/node20": "20.1.2",
83
- "@types/bytes": "3.1.2",
84
- "@types/fetch-mock": "7.3.6",
84
+ "@types/bytes": "3.1.3",
85
+ "@types/fetch-mock": "7.3.7",
85
86
  "@types/glob": "8.1.0",
86
- "@types/hoist-non-react-statics": "3.3.2",
87
- "@types/jest": "29.5.5",
88
- "@types/lodash": "4.14.198",
89
- "@types/node": "20.8.0",
90
- "@types/node-fetch": "2.6.5",
91
- "@types/react": "18.2.22",
92
- "@types/react-dom": "18.2.7",
93
- "@types/use-sync-external-store": "0.0.4",
94
- "@typescript-eslint/eslint-plugin": "6.7.2",
95
- "@typescript-eslint/parser": "6.7.2",
96
- "@typescript-eslint/rule-tester": "6.7.2",
97
- "@typescript-eslint/types": "6.7.2",
98
- "@typescript-eslint/utils": "6.7.2",
87
+ "@types/hoist-non-react-statics": "3.3.4",
88
+ "@types/jest": "29.5.6",
89
+ "@types/lodash": "4.14.200",
90
+ "@types/node": "20.8.9",
91
+ "@types/node-fetch": "2.6.7",
92
+ "@types/react": "18.2.33",
93
+ "@types/react-dom": "18.2.14",
94
+ "@types/relay-runtime": "14.1.14",
95
+ "@types/use-sync-external-store": "0.0.5",
96
+ "@typescript-eslint/eslint-plugin": "6.7.5",
97
+ "@typescript-eslint/parser": "6.7.5",
98
+ "@typescript-eslint/rule-tester": "6.7.5",
99
+ "@typescript-eslint/types": "6.7.5",
100
+ "@typescript-eslint/utils": "6.7.5",
99
101
  "acorn": "8.10.0",
100
102
  "blob-polyfill": "7.0.20220408",
101
103
  "bytes": "3.1.2",
102
104
  "cross-fetch": "3.1.8",
103
- "eslint": "8.50.0",
104
- "eslint-import-resolver-typescript": "3.6.0",
105
+ "eslint": "8.51.0",
106
+ "eslint-import-resolver-typescript": "3.6.1",
105
107
  "eslint-plugin-import": "npm:@phryneas/eslint-plugin-import@2.27.5-pr.2813.2817.199971c",
106
108
  "eslint-plugin-local-rules": "2.0.0",
107
109
  "eslint-plugin-testing-library": "5.11.1",
108
- "expect-type": "0.16.0",
110
+ "expect-type": "0.17.3",
109
111
  "fetch-mock": "9.11.0",
110
112
  "glob": "8.1.0",
111
113
  "graphql": "16.8.1",
112
- "graphql-ws": "5.14.0",
114
+ "graphql-ws": "5.14.2",
113
115
  "jest": "29.7.0",
114
116
  "jest-environment-jsdom": "29.7.0",
115
117
  "jest-junit": "16.0.0",
@@ -122,14 +124,14 @@
122
124
  "react-dom-17": "npm:react-dom@^17",
123
125
  "react-error-boundary": "3.1.4",
124
126
  "recast": "0.23.4",
125
- "resolve": "1.22.6",
126
- "rimraf": "5.0.1",
127
+ "resolve": "1.22.8",
128
+ "rimraf": "5.0.5",
127
129
  "rollup": "2.79.1",
128
130
  "rollup-plugin-terser": "7.0.2",
129
131
  "rxjs": "7.8.1",
130
132
  "size-limit": "8.2.6",
131
133
  "subscriptions-transport-ws": "0.11.0",
132
- "terser": "5.20.0",
134
+ "terser": "5.21.0",
133
135
  "ts-api-utils": "1.0.3",
134
136
  "ts-jest": "29.1.1",
135
137
  "ts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AY,CAAC,EAAE,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAChE,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;IAElD,OAAO,CAAC,YAAY,CAAyB;IAC7C,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,oBAAoB,CAAiB;IAC7C,OAAO,CAAC,MAAM,CAAiC;IAE/C,OAAO,CAAC,OAAO,CAA2D;IAC1E,OAAO,CAAC,MAAM,CAAyC;IAEvD,OAAO,CAAC,UAAU,CAAK;gBAGrB,UAAU,EAAE,eAAe,CAAC,KAAK,CAAC,EAClC,OAAO,EAAE,6BAA6B;IAuDxC,IAAI,iBAAiB,iDAEpB;IAED,MAAM;IAsBN,gBAAgB,CAAC,iBAAiB,EAAE,eAAe;IAOnD,YAAY,CAAC,iBAAiB,EAAE,eAAe;IAyB/C,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;IAQhC,OAAO,CAAC,SAAS,EAAE,kBAAkB,GAAG,SAAS;IAIjD,SAAS,CAAC,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC;IAI1C,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,UAAU;IAmClB,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,aAAa;CA2BtB"}
@@ -21,7 +21,6 @@ var OBSERVED_CHANGED_OPTIONS = [
21
21
  var InternalQueryReference = (function () {
22
22
  function InternalQueryReference(observable, options) {
23
23
  var _this = this;
24
- var _a;
25
24
  this.listeners = new Set();
26
25
  this.status = "loading";
27
26
  this.references = 0;
@@ -55,7 +54,13 @@ var InternalQueryReference = (function () {
55
54
  next: this.handleNext,
56
55
  error: this.handleError,
57
56
  });
58
- this.autoDisposeTimeoutId = setTimeout(this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);
57
+ var startDisposeTimer = function () {
58
+ var _a;
59
+ if (!_this.references) {
60
+ _this.autoDisposeTimeoutId = setTimeout(_this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);
61
+ }
62
+ };
63
+ this.promise.then(startDisposeTimer, startDisposeTimer);
59
64
  }
60
65
  Object.defineProperty(InternalQueryReference.prototype, "watchQueryOptions", {
61
66
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"file":"QueryReference.js","sourceRoot":"","sources":["../../../src/react/cache/QueryReference.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAQtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAUlC,IAAM,sBAAsB,GAAkB,MAAM,EAAE,CAAC;AAgBvD,MAAM,UAAU,YAAY,CAC1B,gBAA+C;;IAE/C,gBAAS,GAAC,sBAAsB,IAAG,gBAAgB,KAAG;AACxD,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,QAA+B;IAE/B,OAAO,QAAQ,CAAC,sBAAsB,CAAC,CAAC;AAC1C,CAAC;AAED,IAAM,wBAAwB,GAAG;IAC/B,iBAAiB;IACjB,SAAS;IACT,aAAa;IACb,aAAa;IACb,oBAAoB;IACpB,mBAAmB;CACX,CAAC;AAOX;IAkBE,gCACE,UAAkC,EAClC,OAAsC;QAFxC,iBA8CC;;QAvDO,cAAS,GAAG,IAAI,GAAG,EAAmB,CAAC;QAEvC,WAAM,GAAuB,SAAS,CAAC;QAKvC,eAAU,GAAG,CAAC,CAAC;QAMrB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI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C,CAAC;IAC1D,CAAC;IAEO,8CAAa,GAArB,UAAsB,eAAkD;QAAxE,iBA0BC;QAzBC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QAExB,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YACzC,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,cAAO,CAAC,CAAC,CAAC;QAO7B,eAAe;aACZ,IAAI,CAAC,UAAC,MAAM;;YACX,IAAI,KAAI,CAAC,MAAM,KAAK,SAAS,EAAE;gBAC7B,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;gBACrB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;gBACrB,MAAA,KAAI,CAAC,OAAO,sDAAG,MAAM,CAAC,CAAC;aACxB;QACH,CAAC,CAAC;aACD,KAAK,CAAC,cAAO,CAAC,CAAC,CAAC;QAEnB,OAAO,eAAe,CAAC;IACzB,CAAC;IACH,6BAAC;AAAD,CAAC,AA3OD,IA2OC","sourcesContent":["import { equal } from \"@wry/equality\";\nimport type {\n ApolloError,\n ApolloQueryResult,\n ObservableQuery,\n OperationVariables,\n WatchQueryOptions,\n} from \"../../core/index.js\";\nimport { isNetworkRequestSettled } from \"../../core/index.js\";\nimport type { ObservableSubscription } from \"../../utilities/index.js\";\nimport {\n createFulfilledPromise,\n createRejectedPromise,\n} from \"../../utilities/index.js\";\nimport type { CacheKey } from \"./types.js\";\nimport type { useBackgroundQuery, useReadQuery } from \"../hooks/index.js\";\n\ntype Listener<TData> = (promise: Promise<ApolloQueryResult<TData>>) => void;\n\ntype FetchMoreOptions<TData> = Parameters<\n ObservableQuery<TData>[\"fetchMore\"]\n>[0];\n\nconst QUERY_REFERENCE_SYMBOL: unique symbol = Symbol();\n/**\n * A `QueryReference` is an opaque object returned by {@link useBackgroundQuery}.\n * A child component reading the `QueryReference` via {@link useReadQuery} will\n * suspend until the promise resolves.\n */\nexport interface QueryReference<TData = unknown> {\n [QUERY_REFERENCE_SYMBOL]: InternalQueryReference<TData>;\n}\n\ninterface InternalQueryReferenceOptions {\n key: CacheKey;\n onDispose?: () => void;\n autoDisposeTimeoutMs?: number;\n}\n\nexport function wrapQueryRef<TData>(\n internalQueryRef: InternalQueryReference<TData>\n): QueryReference<TData> {\n return { [QUERY_REFERENCE_SYMBOL]: internalQueryRef };\n}\n\nexport function unwrapQueryRef<TData>(\n queryRef: QueryReference<TData>\n): InternalQueryReference<TData> {\n return queryRef[QUERY_REFERENCE_SYMBOL];\n}\n\nconst OBSERVED_CHANGED_OPTIONS = [\n \"canonizeResults\",\n \"context\",\n \"errorPolicy\",\n \"fetchPolicy\",\n \"refetchWritePolicy\",\n \"returnPartialData\",\n] as const;\n\ntype ObservedOptions = Pick<\n WatchQueryOptions,\n (typeof OBSERVED_CHANGED_OPTIONS)[number]\n>;\n\nexport class InternalQueryReference<TData = unknown> {\n public result: ApolloQueryResult<TData>;\n public readonly key: CacheKey;\n public readonly observable: ObservableQuery<TData>;\n\n public promiseCache?: Map<CacheKey, Promise<ApolloQueryResult<TData>>>;\n public promise: Promise<ApolloQueryResult<TData>>;\n\n private subscription: ObservableSubscription;\n private listeners = new Set<Listener<TData>>();\n private autoDisposeTimeoutId: NodeJS.Timeout;\n private status: \"idle\" | \"loading\" = \"loading\";\n\n private resolve: ((result: ApolloQueryResult<TData>) => void) | undefined;\n private reject: ((error: unknown) => void) | undefined;\n\n private references = 0;\n\n constructor(\n observable: ObservableQuery<TData>,\n options: InternalQueryReferenceOptions\n ) {\n this.handleNext = this.handleNext.bind(this);\n this.handleError = this.handleError.bind(this);\n this.dispose = this.dispose.bind(this);\n this.observable = observable;\n // Don't save this result as last result to prevent delivery of last result\n // when first subscribing\n this.result = observable.getCurrentResult(false);\n this.key = options.key;\n\n if (options.onDispose) {\n this.onDispose = options.onDispose;\n }\n\n if (\n isNetworkRequestSettled(this.result.networkStatus) ||\n (this.result.data &&\n (!this.result.partial || this.watchQueryOptions.returnPartialData))\n ) {\n this.promise = createFulfilledPromise(this.result);\n this.status = \"idle\";\n } else {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n\n this.subscription = observable\n .filter(({ data }) => !equal(data, {}))\n .subscribe({\n next: this.handleNext,\n error: this.handleError,\n });\n\n // Start a timer that will automatically dispose of the query if the\n // suspended resource does not use this queryRef in the given time. This\n // helps prevent memory leaks when a component has unmounted before the\n // query has finished loading.\n this.autoDisposeTimeoutId = setTimeout(\n this.dispose,\n options.autoDisposeTimeoutMs ?? 30_000\n );\n }\n\n get watchQueryOptions() {\n return this.observable.options;\n }\n\n retain() {\n this.references++;\n clearTimeout(this.autoDisposeTimeoutId);\n let disposed = false;\n\n return () => {\n if (disposed) {\n return;\n }\n\n disposed = true;\n this.references--;\n\n // Wait before fully disposing in case the app is running in strict mode.\n setTimeout(() => {\n if (!this.references) {\n this.dispose();\n }\n });\n };\n }\n\n didChangeOptions(watchQueryOptions: ObservedOptions) {\n return OBSERVED_CHANGED_OPTIONS.some(\n (option) =>\n !equal(this.watchQueryOptions[option], watchQueryOptions[option])\n );\n }\n\n applyOptions(watchQueryOptions: ObservedOptions) {\n const {\n fetchPolicy: currentFetchPolicy,\n canonizeResults: currentCanonizeResults,\n } = this.watchQueryOptions;\n\n // \"standby\" is used when `skip` is set to `true`. Detect when we've\n // enabled the query (i.e. `skip` is `false`) to execute a network request.\n if (\n currentFetchPolicy === \"standby\" &&\n currentFetchPolicy !== watchQueryOptions.fetchPolicy\n ) {\n this.initiateFetch(this.observable.reobserve(watchQueryOptions));\n } else {\n this.observable.silentSetOptions(watchQueryOptions);\n\n if (currentCanonizeResults !== watchQueryOptions.canonizeResults) {\n this.result = { ...this.result, ...this.observable.getCurrentResult() };\n this.promise = createFulfilledPromise(this.result);\n }\n }\n\n return this.promise;\n }\n\n listen(listener: Listener<TData>) {\n this.listeners.add(listener);\n\n return () => {\n this.listeners.delete(listener);\n };\n }\n\n refetch(variables: OperationVariables | undefined) {\n return this.initiateFetch(this.observable.refetch(variables));\n }\n\n fetchMore(options: FetchMoreOptions<TData>) {\n return this.initiateFetch(this.observable.fetchMore<TData>(options));\n }\n\n private dispose() {\n this.subscription.unsubscribe();\n this.onDispose();\n }\n\n private onDispose() {\n // noop. overridable by options\n }\n\n private handleNext(result: ApolloQueryResult<TData>) {\n switch (this.status) {\n case \"loading\": {\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n this.status = \"idle\";\n this.result = result;\n this.resolve?.(result);\n break;\n }\n case \"idle\": {\n // This occurs when switching to a result that is fully cached when this\n // class is instantiated. ObservableQuery will run reobserve when\n // subscribing, which delivers a result from the cache.\n if (result.data === this.result.data) {\n return;\n }\n\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n\n this.result = result;\n this.promise = createFulfilledPromise(result);\n this.deliver(this.promise);\n break;\n }\n }\n }\n\n private handleError(error: ApolloError) {\n this.subscription.unsubscribe();\n this.subscription = this.observable.resubscribeAfterError(\n this.handleNext,\n this.handleError\n );\n\n switch (this.status) {\n case \"loading\": {\n this.status = \"idle\";\n this.reject?.(error);\n break;\n }\n case \"idle\": {\n this.promise = createRejectedPromise(error);\n this.deliver(this.promise);\n }\n }\n }\n\n private deliver(promise: Promise<ApolloQueryResult<TData>>) {\n this.listeners.forEach((listener) => listener(promise));\n }\n\n private initiateFetch(returnedPromise: Promise<ApolloQueryResult<TData>>) {\n this.status = \"loading\";\n\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n\n this.promise.catch(() => {});\n\n // If the data returned from the fetch is deeply equal to the data already\n // in the cache, `handleNext` will not be triggered leaving the promise we\n // created in a pending state forever. To avoid this situtation, we attempt\n // to resolve the promise if `handleNext` hasn't been run to ensure the\n // promise is resolved correctly.\n returnedPromise\n .then((result) => {\n if (this.status === \"loading\") {\n this.status = \"idle\";\n this.result = result;\n this.resolve?.(result);\n }\n })\n .catch(() => {});\n\n return returnedPromise;\n }\n}\n"]}
1
+ {"version":3,"file":"QueryReference.js","sourceRoot":"","sources":["../../../src/react/cache/QueryReference.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAQtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAUlC,IAAM,sBAAsB,GAAkB,MAAM,EAAE,CAAC;AAgBvD,MAAM,UAAU,YAAY,CAC1B,gBAA+C;;IAE/C,gBAAS,GAAC,sBAAsB,IAAG,gBAAgB,KAAG;AACxD,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,QAA+B;IAE/B,OAAO,QAAQ,CAAC,sBAAsB,CAAC,CAAC;AAC1C,CAAC;AAED,IAAM,wBAAwB,GAAG;IAC/B,iBAAiB;IACjB,SAAS;IACT,aAAa;IACb,aAAa;IACb,oBAAoB;IACpB,mBAAmB;CACX,CAAC;AAOX;IAkBE,gCACE,UAAkC,EAClC,OAAsC;QAFxC,iBAuDC;QAhEO,cAAS,GAAG,IAAI,GAAG,EAAmB,CAAC;QAEvC,WAAM,GAAuB,SAAS,CAAC;QAKvC,eAAU,GAAG,CAAC,CAAC;QAMrB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAG7B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CAAC,EAAjB,CAAiB,CAAC,CAAC;IAC1D,CAAC;IAEO,8CAAa,GAArB,UAAsB,eAAkD;QAAxE,iBA0BC;QAzBC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QAExB,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YACzC,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,cAAO,CAAC,CAAC,CAAC;QAO7B,eAAe;aACZ,IAAI,CAAC,UAAC,MAAM;;YACX,IAAI,KAAI,CAAC,MAAM,KAAK,SAAS,EAAE;gBAC7B,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;gBACrB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;gBACrB,MAAA,KAAI,CAAC,OAAO,sDAAG,MAAM,CAAC,CAAC;aACxB;QACH,CAAC,CAAC;aACD,KAAK,CAAC,cAAO,CAAC,CAAC,CAAC;QAEnB,OAAO,eAAe,CAAC;IACzB,CAAC;IACH,6BAAC;AAAD,CAAC,AApPD,IAoPC","sourcesContent":["import { equal } from \"@wry/equality\";\nimport type {\n ApolloError,\n ApolloQueryResult,\n ObservableQuery,\n OperationVariables,\n WatchQueryOptions,\n} from \"../../core/index.js\";\nimport { isNetworkRequestSettled } from \"../../core/index.js\";\nimport type { ObservableSubscription } from \"../../utilities/index.js\";\nimport {\n createFulfilledPromise,\n createRejectedPromise,\n} from \"../../utilities/index.js\";\nimport type { CacheKey } from \"./types.js\";\nimport type { useBackgroundQuery, useReadQuery } from \"../hooks/index.js\";\n\ntype Listener<TData> = (promise: Promise<ApolloQueryResult<TData>>) => void;\n\ntype FetchMoreOptions<TData> = Parameters<\n ObservableQuery<TData>[\"fetchMore\"]\n>[0];\n\nconst QUERY_REFERENCE_SYMBOL: unique symbol = Symbol();\n/**\n * A `QueryReference` is an opaque object returned by {@link useBackgroundQuery}.\n * A child component reading the `QueryReference` via {@link useReadQuery} will\n * suspend until the promise resolves.\n */\nexport interface QueryReference<TData = unknown> {\n [QUERY_REFERENCE_SYMBOL]: InternalQueryReference<TData>;\n}\n\ninterface InternalQueryReferenceOptions {\n key: CacheKey;\n onDispose?: () => void;\n autoDisposeTimeoutMs?: number;\n}\n\nexport function wrapQueryRef<TData>(\n internalQueryRef: InternalQueryReference<TData>\n): QueryReference<TData> {\n return { [QUERY_REFERENCE_SYMBOL]: internalQueryRef };\n}\n\nexport function unwrapQueryRef<TData>(\n queryRef: QueryReference<TData>\n): InternalQueryReference<TData> {\n return queryRef[QUERY_REFERENCE_SYMBOL];\n}\n\nconst OBSERVED_CHANGED_OPTIONS = [\n \"canonizeResults\",\n \"context\",\n \"errorPolicy\",\n \"fetchPolicy\",\n \"refetchWritePolicy\",\n \"returnPartialData\",\n] as const;\n\ntype ObservedOptions = Pick<\n WatchQueryOptions,\n (typeof OBSERVED_CHANGED_OPTIONS)[number]\n>;\n\nexport class InternalQueryReference<TData = unknown> {\n public result: ApolloQueryResult<TData>;\n public readonly key: CacheKey;\n public readonly observable: ObservableQuery<TData>;\n\n public promiseCache?: Map<CacheKey, Promise<ApolloQueryResult<TData>>>;\n public promise: Promise<ApolloQueryResult<TData>>;\n\n private subscription: ObservableSubscription;\n private listeners = new Set<Listener<TData>>();\n private autoDisposeTimeoutId: NodeJS.Timeout;\n private status: \"idle\" | \"loading\" = \"loading\";\n\n private resolve: ((result: ApolloQueryResult<TData>) => void) | undefined;\n private reject: ((error: unknown) => void) | undefined;\n\n private references = 0;\n\n constructor(\n observable: ObservableQuery<TData>,\n options: InternalQueryReferenceOptions\n ) {\n this.handleNext = this.handleNext.bind(this);\n this.handleError = this.handleError.bind(this);\n this.dispose = this.dispose.bind(this);\n this.observable = observable;\n // Don't save this result as last result to prevent delivery of last result\n // when first subscribing\n this.result = observable.getCurrentResult(false);\n this.key = options.key;\n\n if (options.onDispose) {\n this.onDispose = options.onDispose;\n }\n\n if (\n isNetworkRequestSettled(this.result.networkStatus) ||\n (this.result.data &&\n (!this.result.partial || this.watchQueryOptions.returnPartialData))\n ) {\n this.promise = createFulfilledPromise(this.result);\n this.status = \"idle\";\n } else {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n\n this.subscription = observable\n .filter(({ data }) => !equal(data, {}))\n .subscribe({\n next: this.handleNext,\n error: this.handleError,\n });\n\n // Start a timer that will automatically dispose of the query if the\n // suspended resource does not use this queryRef in the given time. This\n // helps prevent memory leaks when a component has unmounted before the\n // query has finished loading.\n const startDisposeTimer = () => {\n if (!this.references) {\n this.autoDisposeTimeoutId = setTimeout(\n this.dispose,\n options.autoDisposeTimeoutMs ?? 30_000\n );\n }\n };\n\n // We wait until the request has settled to ensure we don't dispose of the\n // query ref before the request finishes, otherwise we would leave the\n // promise in a pending state rendering the suspense boundary indefinitely.\n this.promise.then(startDisposeTimer, startDisposeTimer);\n }\n\n get watchQueryOptions() {\n return this.observable.options;\n }\n\n retain() {\n this.references++;\n clearTimeout(this.autoDisposeTimeoutId);\n let disposed = false;\n\n return () => {\n if (disposed) {\n return;\n }\n\n disposed = true;\n this.references--;\n\n // Wait before fully disposing in case the app is running in strict mode.\n setTimeout(() => {\n if (!this.references) {\n this.dispose();\n }\n });\n };\n }\n\n didChangeOptions(watchQueryOptions: ObservedOptions) {\n return OBSERVED_CHANGED_OPTIONS.some(\n (option) =>\n !equal(this.watchQueryOptions[option], watchQueryOptions[option])\n );\n }\n\n applyOptions(watchQueryOptions: ObservedOptions) {\n const {\n fetchPolicy: currentFetchPolicy,\n canonizeResults: currentCanonizeResults,\n } = this.watchQueryOptions;\n\n // \"standby\" is used when `skip` is set to `true`. Detect when we've\n // enabled the query (i.e. `skip` is `false`) to execute a network request.\n if (\n currentFetchPolicy === \"standby\" &&\n currentFetchPolicy !== watchQueryOptions.fetchPolicy\n ) {\n this.initiateFetch(this.observable.reobserve(watchQueryOptions));\n } else {\n this.observable.silentSetOptions(watchQueryOptions);\n\n if (currentCanonizeResults !== watchQueryOptions.canonizeResults) {\n this.result = { ...this.result, ...this.observable.getCurrentResult() };\n this.promise = createFulfilledPromise(this.result);\n }\n }\n\n return this.promise;\n }\n\n listen(listener: Listener<TData>) {\n this.listeners.add(listener);\n\n return () => {\n this.listeners.delete(listener);\n };\n }\n\n refetch(variables: OperationVariables | undefined) {\n return this.initiateFetch(this.observable.refetch(variables));\n }\n\n fetchMore(options: FetchMoreOptions<TData>) {\n return this.initiateFetch(this.observable.fetchMore<TData>(options));\n }\n\n private dispose() {\n this.subscription.unsubscribe();\n this.onDispose();\n }\n\n private onDispose() {\n // noop. overridable by options\n }\n\n private handleNext(result: ApolloQueryResult<TData>) {\n switch (this.status) {\n case \"loading\": {\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n this.status = \"idle\";\n this.result = result;\n this.resolve?.(result);\n break;\n }\n case \"idle\": {\n // This occurs when switching to a result that is fully cached when this\n // class is instantiated. ObservableQuery will run reobserve when\n // subscribing, which delivers a result from the cache.\n if (result.data === this.result.data) {\n return;\n }\n\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n\n this.result = result;\n this.promise = createFulfilledPromise(result);\n this.deliver(this.promise);\n break;\n }\n }\n }\n\n private handleError(error: ApolloError) {\n this.subscription.unsubscribe();\n this.subscription = this.observable.resubscribeAfterError(\n this.handleNext,\n this.handleError\n );\n\n switch (this.status) {\n case \"loading\": {\n this.status = \"idle\";\n this.reject?.(error);\n break;\n }\n case \"idle\": {\n this.promise = createRejectedPromise(error);\n this.deliver(this.promise);\n }\n }\n }\n\n private deliver(promise: Promise<ApolloQueryResult<TData>>) {\n this.listeners.forEach((listener) => listener(promise));\n }\n\n private initiateFetch(returnedPromise: Promise<ApolloQueryResult<TData>>) {\n this.status = \"loading\";\n\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n\n this.promise.catch(() => {});\n\n // If the data returned from the fetch is deeply equal to the data already\n // in the cache, `handleNext` will not be triggered leaving the promise we\n // created in a pending state forever. To avoid this situtation, we attempt\n // to resolve the promise if `handleNext` hasn't been run to ensure the\n // promise is resolved correctly.\n returnedPromise\n .then((result) => {\n if (this.status === \"loading\") {\n this.status = \"idle\";\n this.result = result;\n this.resolve?.(result);\n }\n })\n .catch(() => {});\n\n return returnedPromise;\n }\n}\n"]}
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
2
1
  import * as PropTypes from "prop-types";
2
+ import type * as ReactTypes from "react";
3
3
  import type { OperationVariables } from "../../core/index.js";
4
4
  import type { MutationComponentOptions } from "./types.js";
5
- export declare function Mutation<TData = any, TVariables = OperationVariables>(props: MutationComponentOptions<TData, TVariables>): JSX.Element | null;
5
+ export declare function Mutation<TData = any, TVariables = OperationVariables>(props: MutationComponentOptions<TData, TVariables>): ReactTypes.JSX.Element | null;
6
6
  export declare namespace Mutation {
7
7
  var propTypes: PropTypes.InferProps<MutationComponentOptions<any, any, import("../../core/types.js").DefaultContext, import("../../core/index.js").ApolloCache<any>>>;
8
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Mutation.d.ts","sourceRoot":"","sources":["../../../src/react/components/Mutation.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAExC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAG3D,wBAAgB,QAAQ,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,kBAAkB,EACnE,KAAK,EAAE,wBAAwB,CAAC,KAAK,EAAE,UAAU,CAAC,sBAInD;yBALe,QAAQ;;;AAOxB,MAAM,WAAW,QAAQ,CAAC,KAAK,EAAE,UAAU;IACzC,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,wBAAwB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;CAC9E"}
1
+ {"version":3,"file":"Mutation.d.ts","sourceRoot":"","sources":["../../../src/react/components/Mutation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,KAAK,UAAU,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAG3D,wBAAgB,QAAQ,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,kBAAkB,EACnE,KAAK,EAAE,wBAAwB,CAAC,KAAK,EAAE,UAAU,CAAC,GACjD,UAAU,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CAG/B;yBALe,QAAQ;;;AAOxB,MAAM,WAAW,QAAQ,CAAC,KAAK,EAAE,UAAU;IACzC,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,wBAAwB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;CAC9E"}
@@ -1 +1 @@
1
- {"version":3,"file":"Mutation.js","sourceRoot":"","sources":["../../../src/react/components/Mutation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAIxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU,QAAQ,CACtB,KAAkD;IAE5C,IAAA,KAAwB,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAzD,WAAW,QAAA,EAAE,MAAM,QAAsC,CAAC;IACjE,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACrE,CAAC;AAMD,QAAQ,CAAC,SAAS,GAAG;IACnB,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACrC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,kBAAkB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3E,cAAc,EAAE,SAAS,CAAC,SAAS,CAAC;QAClC,SAAS,CAAC,OAAO,CACf,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAC1D;QACD,SAAS,CAAC,IAAI;KACf,CAAC;IACF,mBAAmB,EAAE,SAAS,CAAC,IAAI;IACnC,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACnC,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,WAAW,EAAE,SAAS,CAAC,MAAM;CACK,CAAC","sourcesContent":["import * as PropTypes from \"prop-types\";\n\nimport type { OperationVariables } from \"../../core/index.js\";\nimport type { MutationComponentOptions } from \"./types.js\";\nimport { useMutation } from \"../hooks/index.js\";\n\nexport function Mutation<TData = any, TVariables = OperationVariables>(\n props: MutationComponentOptions<TData, TVariables>\n) {\n const [runMutation, result] = useMutation(props.mutation, props);\n return props.children ? props.children(runMutation, result) : null;\n}\n\nexport interface Mutation<TData, TVariables> {\n propTypes: PropTypes.InferProps<MutationComponentOptions<TData, TVariables>>;\n}\n\nMutation.propTypes = {\n mutation: PropTypes.object.isRequired,\n variables: PropTypes.object,\n optimisticResponse: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),\n refetchQueries: PropTypes.oneOfType([\n PropTypes.arrayOf(\n PropTypes.oneOfType([PropTypes.string, PropTypes.object])\n ),\n PropTypes.func,\n ]),\n awaitRefetchQueries: PropTypes.bool,\n update: PropTypes.func,\n children: PropTypes.func.isRequired,\n onCompleted: PropTypes.func,\n onError: PropTypes.func,\n fetchPolicy: PropTypes.string,\n} as Mutation<any, any>[\"propTypes\"];\n"]}
1
+ {"version":3,"file":"Mutation.js","sourceRoot":"","sources":["../../../src/react/components/Mutation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAKxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU,QAAQ,CACtB,KAAkD;IAE5C,IAAA,KAAwB,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAzD,WAAW,QAAA,EAAE,MAAM,QAAsC,CAAC;IACjE,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACrE,CAAC;AAMD,QAAQ,CAAC,SAAS,GAAG;IACnB,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACrC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,kBAAkB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3E,cAAc,EAAE,SAAS,CAAC,SAAS,CAAC;QAClC,SAAS,CAAC,OAAO,CACf,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAC1D;QACD,SAAS,CAAC,IAAI;KACf,CAAC;IACF,mBAAmB,EAAE,SAAS,CAAC,IAAI;IACnC,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACnC,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,WAAW,EAAE,SAAS,CAAC,MAAM;CACK,CAAC","sourcesContent":["import * as PropTypes from \"prop-types\";\nimport type * as ReactTypes from \"react\";\n\nimport type { OperationVariables } from \"../../core/index.js\";\nimport type { MutationComponentOptions } from \"./types.js\";\nimport { useMutation } from \"../hooks/index.js\";\n\nexport function Mutation<TData = any, TVariables = OperationVariables>(\n props: MutationComponentOptions<TData, TVariables>\n): ReactTypes.JSX.Element | null {\n const [runMutation, result] = useMutation(props.mutation, props);\n return props.children ? props.children(runMutation, result) : null;\n}\n\nexport interface Mutation<TData, TVariables> {\n propTypes: PropTypes.InferProps<MutationComponentOptions<TData, TVariables>>;\n}\n\nMutation.propTypes = {\n mutation: PropTypes.object.isRequired,\n variables: PropTypes.object,\n optimisticResponse: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),\n refetchQueries: PropTypes.oneOfType([\n PropTypes.arrayOf(\n PropTypes.oneOfType([PropTypes.string, PropTypes.object])\n ),\n PropTypes.func,\n ]),\n awaitRefetchQueries: PropTypes.bool,\n update: PropTypes.func,\n children: PropTypes.func.isRequired,\n onCompleted: PropTypes.func,\n onError: PropTypes.func,\n fetchPolicy: PropTypes.string,\n} as Mutation<any, any>[\"propTypes\"];\n"]}
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
2
1
  import * as PropTypes from "prop-types";
2
+ import type * as ReactTypes from "react";
3
3
  import type { OperationVariables } from "../../core/index.js";
4
4
  import type { QueryComponentOptions } from "./types.js";
5
- export declare function Query<TData = any, TVariables extends OperationVariables = OperationVariables>(props: QueryComponentOptions<TData, TVariables>): JSX.Element | null;
5
+ export declare function Query<TData = any, TVariables extends OperationVariables = OperationVariables>(props: QueryComponentOptions<TData, TVariables>): ReactTypes.JSX.Element | null;
6
6
  export declare namespace Query {
7
7
  var propTypes: PropTypes.InferProps<QueryComponentOptions<any, any>>;
8
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Query.d.ts","sourceRoot":"","sources":["../../../src/react/components/Query.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAExC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGxD,wBAAgB,KAAK,CACnB,KAAK,GAAG,GAAG,EACX,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,EAC1D,KAAK,EAAE,qBAAqB,CAAC,KAAK,EAAE,UAAU,CAAC,sBAIhD;yBAPe,KAAK;;;AASrB,MAAM,WAAW,KAAK,CAAC,KAAK,EAAE,UAAU,SAAS,kBAAkB;IACjE,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,qBAAqB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;CAC3E"}
1
+ {"version":3,"file":"Query.d.ts","sourceRoot":"","sources":["../../../src/react/components/Query.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,KAAK,UAAU,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGxD,wBAAgB,KAAK,CACnB,KAAK,GAAG,GAAG,EACX,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,EAE1D,KAAK,EAAE,qBAAqB,CAAC,KAAK,EAAE,UAAU,CAAC,GAC9C,UAAU,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CAI/B;yBATe,KAAK;;;AAWrB,MAAM,WAAW,KAAK,CAAC,KAAK,EAAE,UAAU,SAAS,kBAAkB;IACjE,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,qBAAqB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;CAC3E"}
@@ -1 +1 @@
1
- {"version":3,"file":"Query.js","sourceRoot":"","sources":["../../../src/react/components/Query.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAIxC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,UAAU,KAAK,CAGnB,KAA+C;IACvC,IAAA,QAAQ,GAAwB,KAAK,SAA7B,EAAE,KAAK,GAAiB,KAAK,MAAtB,EAAK,OAAO,UAAK,KAAK,EAAvC,qBAA+B,CAAF,CAAW;IAC9C,IAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjD,CAAC;AAMD,KAAK,CAAC,SAAS,GAAG;IAChB,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACnC,WAAW,EAAE,SAAS,CAAC,MAAM;IAC7B,2BAA2B,EAAE,SAAS,CAAC,IAAI;IAC3C,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,YAAY,EAAE,SAAS,CAAC,MAAM;IAC9B,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IAClC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,GAAG,EAAE,SAAS,CAAC,IAAI;IACnB,cAAc,EAAE,SAAS,CAAC,IAAI;IAC9B,iBAAiB,EAAE,SAAS,CAAC,IAAI;CACF,CAAC","sourcesContent":["import * as PropTypes from \"prop-types\";\n\nimport type { OperationVariables } from \"../../core/index.js\";\nimport type { QueryComponentOptions } from \"./types.js\";\nimport { useQuery } from \"../hooks/index.js\";\n\nexport function Query<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(props: QueryComponentOptions<TData, TVariables>) {\n const { children, query, ...options } = props;\n const result = useQuery(query, options);\n return result ? children(result as any) : null;\n}\n\nexport interface Query<TData, TVariables extends OperationVariables> {\n propTypes: PropTypes.InferProps<QueryComponentOptions<TData, TVariables>>;\n}\n\nQuery.propTypes = {\n client: PropTypes.object,\n children: PropTypes.func.isRequired,\n fetchPolicy: PropTypes.string,\n notifyOnNetworkStatusChange: PropTypes.bool,\n onCompleted: PropTypes.func,\n onError: PropTypes.func,\n pollInterval: PropTypes.number,\n query: PropTypes.object.isRequired,\n variables: PropTypes.object,\n ssr: PropTypes.bool,\n partialRefetch: PropTypes.bool,\n returnPartialData: PropTypes.bool,\n} as Query<any, any>[\"propTypes\"];\n"]}
1
+ {"version":3,"file":"Query.js","sourceRoot":"","sources":["../../../src/react/components/Query.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAKxC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,UAAU,KAAK,CAInB,KAA+C;IAEvC,IAAA,QAAQ,GAAwB,KAAK,SAA7B,EAAE,KAAK,GAAiB,KAAK,MAAtB,EAAK,OAAO,UAAK,KAAK,EAAvC,qBAA+B,CAAF,CAAW;IAC9C,IAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjD,CAAC;AAMD,KAAK,CAAC,SAAS,GAAG;IAChB,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACnC,WAAW,EAAE,SAAS,CAAC,MAAM;IAC7B,2BAA2B,EAAE,SAAS,CAAC,IAAI;IAC3C,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,YAAY,EAAE,SAAS,CAAC,MAAM;IAC9B,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IAClC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,GAAG,EAAE,SAAS,CAAC,IAAI;IACnB,cAAc,EAAE,SAAS,CAAC,IAAI;IAC9B,iBAAiB,EAAE,SAAS,CAAC,IAAI;CACF,CAAC","sourcesContent":["import * as PropTypes from \"prop-types\";\nimport type * as ReactTypes from \"react\";\n\nimport type { OperationVariables } from \"../../core/index.js\";\nimport type { QueryComponentOptions } from \"./types.js\";\nimport { useQuery } from \"../hooks/index.js\";\n\nexport function Query<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n props: QueryComponentOptions<TData, TVariables>\n): ReactTypes.JSX.Element | null {\n const { children, query, ...options } = props;\n const result = useQuery(query, options);\n return result ? children(result as any) : null;\n}\n\nexport interface Query<TData, TVariables extends OperationVariables> {\n propTypes: PropTypes.InferProps<QueryComponentOptions<TData, TVariables>>;\n}\n\nQuery.propTypes = {\n client: PropTypes.object,\n children: PropTypes.func.isRequired,\n fetchPolicy: PropTypes.string,\n notifyOnNetworkStatusChange: PropTypes.bool,\n onCompleted: PropTypes.func,\n onError: PropTypes.func,\n pollInterval: PropTypes.number,\n query: PropTypes.object.isRequired,\n variables: PropTypes.object,\n ssr: PropTypes.bool,\n partialRefetch: PropTypes.bool,\n returnPartialData: PropTypes.bool,\n} as Query<any, any>[\"propTypes\"];\n"]}
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
2
1
  import * as PropTypes from "prop-types";
2
+ import type * as ReactTypes from "react";
3
3
  import type { OperationVariables } from "../../core/index.js";
4
4
  import type { SubscriptionComponentOptions } from "./types.js";
5
- export declare function Subscription<TData = any, TVariables extends OperationVariables = OperationVariables>(props: SubscriptionComponentOptions<TData, TVariables>): JSX.Element | null;
5
+ export declare function Subscription<TData = any, TVariables extends OperationVariables = OperationVariables>(props: SubscriptionComponentOptions<TData, TVariables>): ReactTypes.JSX.Element | null;
6
6
  export declare namespace Subscription {
7
7
  var propTypes: PropTypes.InferProps<SubscriptionComponentOptions<any, any>>;
8
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Subscription.d.ts","sourceRoot":"","sources":["../../../src/react/components/Subscription.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAExC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAG/D,wBAAgB,YAAY,CAC1B,KAAK,GAAG,GAAG,EACX,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,EAC1D,KAAK,EAAE,4BAA4B,CAAC,KAAK,EAAE,UAAU,CAAC,sBAGvD;yBANe,YAAY;;;AAQ5B,MAAM,WAAW,YAAY,CAAC,KAAK,EAAE,UAAU,SAAS,kBAAkB;IACxE,SAAS,EAAE,SAAS,CAAC,UAAU,CAC7B,4BAA4B,CAAC,KAAK,EAAE,UAAU,CAAC,CAChD,CAAC;CACH"}
1
+ {"version":3,"file":"Subscription.d.ts","sourceRoot":"","sources":["../../../src/react/components/Subscription.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,KAAK,UAAU,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAG/D,wBAAgB,YAAY,CAC1B,KAAK,GAAG,GAAG,EACX,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,EAE1D,KAAK,EAAE,4BAA4B,CAAC,KAAK,EAAE,UAAU,CAAC,GACrD,UAAU,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CAG/B;yBARe,YAAY;;;AAU5B,MAAM,WAAW,YAAY,CAAC,KAAK,EAAE,UAAU,SAAS,kBAAkB;IACxE,SAAS,EAAE,SAAS,CAAC,UAAU,CAC7B,4BAA4B,CAAC,KAAK,EAAE,UAAU,CAAC,CAChD,CAAC;CACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"Subscription.js","sourceRoot":"","sources":["../../../src/react/components/Subscription.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAIxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,UAAU,YAAY,CAG1B,KAAsD;IACtD,IAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAC1D,OAAO,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAClE,CAAC;AAQD,YAAY,CAAC,SAAS,GAAG;IACvB,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACzC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB,kBAAkB,EAAE,SAAS,CAAC,IAAI;IAClC,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,sBAAsB,EAAE,SAAS,CAAC,IAAI;IACtC,UAAU,EAAE,SAAS,CAAC,IAAI;IAC1B,iBAAiB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;CAClC,CAAC","sourcesContent":["import * as PropTypes from \"prop-types\";\n\nimport type { OperationVariables } from \"../../core/index.js\";\nimport type { SubscriptionComponentOptions } from \"./types.js\";\nimport { useSubscription } from \"../hooks/index.js\";\n\nexport function Subscription<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(props: SubscriptionComponentOptions<TData, TVariables>) {\n const result = useSubscription(props.subscription, props);\n return props.children && result ? props.children(result) : null;\n}\n\nexport interface Subscription<TData, TVariables extends OperationVariables> {\n propTypes: PropTypes.InferProps<\n SubscriptionComponentOptions<TData, TVariables>\n >;\n}\n\nSubscription.propTypes = {\n subscription: PropTypes.object.isRequired,\n variables: PropTypes.object,\n children: PropTypes.func,\n onSubscriptionData: PropTypes.func,\n onData: PropTypes.func,\n onSubscriptionComplete: PropTypes.func,\n onComplete: PropTypes.func,\n shouldResubscribe: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),\n} as Subscription<any, any>[\"propTypes\"];\n"]}
1
+ {"version":3,"file":"Subscription.js","sourceRoot":"","sources":["../../../src/react/components/Subscription.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAKxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,UAAU,YAAY,CAI1B,KAAsD;IAEtD,IAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAC1D,OAAO,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAClE,CAAC;AAQD,YAAY,CAAC,SAAS,GAAG;IACvB,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACzC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB,kBAAkB,EAAE,SAAS,CAAC,IAAI;IAClC,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,sBAAsB,EAAE,SAAS,CAAC,IAAI;IACtC,UAAU,EAAE,SAAS,CAAC,IAAI;IAC1B,iBAAiB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;CAClC,CAAC","sourcesContent":["import * as PropTypes from \"prop-types\";\nimport type * as ReactTypes from \"react\";\n\nimport type { OperationVariables } from \"../../core/index.js\";\nimport type { SubscriptionComponentOptions } from \"./types.js\";\nimport { useSubscription } from \"../hooks/index.js\";\n\nexport function Subscription<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n props: SubscriptionComponentOptions<TData, TVariables>\n): ReactTypes.JSX.Element | null {\n const result = useSubscription(props.subscription, props);\n return props.children && result ? props.children(result) : null;\n}\n\nexport interface Subscription<TData, TVariables extends OperationVariables> {\n propTypes: PropTypes.InferProps<\n SubscriptionComponentOptions<TData, TVariables>\n >;\n}\n\nSubscription.propTypes = {\n subscription: PropTypes.object.isRequired,\n variables: PropTypes.object,\n children: PropTypes.func,\n onSubscriptionData: PropTypes.func,\n onData: PropTypes.func,\n onSubscriptionComplete: PropTypes.func,\n onComplete: PropTypes.func,\n shouldResubscribe: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),\n} as Subscription<any, any>[\"propTypes\"];\n"]}
@@ -1,18 +1,18 @@
1
- /// <reference types="react" />
2
1
  import type { DocumentNode } from "graphql";
3
2
  import type { TypedDocumentNode } from "@graphql-typed-document-node/core";
3
+ import type * as ReactTypes from "react";
4
4
  import type { OperationVariables, DefaultContext, ApolloCache } from "../../core/index.js";
5
5
  import type { QueryFunctionOptions, QueryResult, BaseMutationOptions, MutationFunction, MutationResult, BaseSubscriptionOptions, SubscriptionResult } from "../types/types.js";
6
6
  export interface QueryComponentOptions<TData = any, TVariables extends OperationVariables = OperationVariables> extends QueryFunctionOptions<TData, TVariables> {
7
- children: (result: QueryResult<TData, TVariables>) => JSX.Element | null;
7
+ children: (result: QueryResult<TData, TVariables>) => ReactTypes.JSX.Element | null;
8
8
  query: DocumentNode | TypedDocumentNode<TData, TVariables>;
9
9
  }
10
10
  export interface MutationComponentOptions<TData = any, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {
11
11
  mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;
12
- children: (mutateFunction: MutationFunction<TData, TVariables, TContext>, result: MutationResult<TData>) => JSX.Element | null;
12
+ children: (mutateFunction: MutationFunction<TData, TVariables, TContext>, result: MutationResult<TData>) => ReactTypes.JSX.Element | null;
13
13
  }
14
14
  export interface SubscriptionComponentOptions<TData = any, TVariables extends OperationVariables = OperationVariables> extends BaseSubscriptionOptions<TData, TVariables> {
15
15
  subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;
16
- children?: null | ((result: SubscriptionResult<TData>) => JSX.Element | null);
16
+ children?: null | ((result: SubscriptionResult<TData>) => ReactTypes.JSX.Element | null);
17
17
  }
18
18
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/react/components/types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,oBAAoB,EACpB,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,qBAAqB,CACpC,KAAK,GAAG,GAAG,EACX,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,CAC1D,SAAQ,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC;IAC/C,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;IACzE,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,wBAAwB,CACvC,KAAK,GAAG,GAAG,EACX,UAAU,GAAG,kBAAkB,EAC/B,QAAQ,GAAG,cAAc,EACzB,MAAM,SAAS,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAClD,SAAQ,mBAAmB,CAAC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ent":["import type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nimport type {\n OperationVariables,\n DefaultContext,\n ApolloCache,\n} from \"../../core/index.js\";\nimport type {\n QueryFunctionOptions,\n QueryResult,\n BaseMutationOptions,\n MutationFunction,\n MutationResult,\n BaseSubscriptionOptions,\n SubscriptionResult,\n} from \"../types/types.js\";\n\nexport interface QueryComponentOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends QueryFunctionOptions<TData, TVariables> {\n children: (result: QueryResult<TData, TVariables>) => JSX.Element | null;\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface MutationComponentOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n children: (\n mutateFunction: MutationFunction<TData, TVariables, TContext>,\n result: MutationResult<TData>\n ) => JSX.Element | null;\n}\n\nexport interface SubscriptionComponentOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseSubscriptionOptions<TData, TVariables> {\n subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;\n children?: null | ((result: SubscriptionResult<TData>) => JSX.Element | null);\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/react/components/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nimport type * as ReactTypes from \"react\";\n\nimport type {\n OperationVariables,\n DefaultContext,\n ApolloCache,\n} from \"../../core/index.js\";\nimport type {\n QueryFunctionOptions,\n QueryResult,\n BaseMutationOptions,\n MutationFunction,\n MutationResult,\n BaseSubscriptionOptions,\n SubscriptionResult,\n} from \"../types/types.js\";\n\nexport interface QueryComponentOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends QueryFunctionOptions<TData, TVariables> {\n children: (\n result: QueryResult<TData, TVariables>\n ) => ReactTypes.JSX.Element | null;\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface MutationComponentOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n children: (\n mutateFunction: MutationFunction<TData, TVariables, TContext>,\n result: MutationResult<TData>\n ) => ReactTypes.JSX.Element | null;\n}\n\nexport interface SubscriptionComponentOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseSubscriptionOptions<TData, TVariables> {\n subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;\n children?:\n | null\n | ((result: SubscriptionResult<TData>) => ReactTypes.JSX.Element | null);\n}\n"]}
@@ -1,7 +1,7 @@
1
- import * as React from "react";
1
+ import type * as ReactTypes from "react";
2
2
  import type { ApolloClient } from "../../core/index.js";
3
3
  export interface ApolloConsumerProps {
4
- children: (client: ApolloClient<object>) => React.ReactChild | null;
4
+ children: (client: ApolloClient<object>) => ReactTypes.ReactChild | null;
5
5
  }
6
- export declare const ApolloConsumer: React.FC<ApolloConsumerProps>;
6
+ export declare const ApolloConsumer: ReactTypes.FC<ApolloConsumerProps>;
7
7
  //# sourceMappingURL=ApolloConsumer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloConsumer.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloConsumer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC;CACrE;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAcxD,CAAC"}
1
+ {"version":3,"file":"ApolloConsumer.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloConsumer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,UAAU,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC;CAC1E;AAED,eAAO,MAAM,cAAc,EAAE,UAAU,CAAC,EAAE,CAAC,mBAAmB,CAc7D,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import { invariant } from "../../utilities/globals/index.js";
2
- import * as React from "react";
2
+ import * as React from "rehackt";
3
3
  import { getApolloContext } from "./ApolloContext.js";
4
4
  export var ApolloConsumer = function (props) {
5
5
  var ApolloContext = getApolloContext();
6
6
  return (React.createElement(ApolloContext.Consumer, null, function (context) {
7
- invariant(context && context.client, 42);
7
+ invariant(context && context.client, 44);
8
8
  return props.children(context.client);
9
9
  }));
10
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloConsumer.js","sourceRoot":"","sources":["../../../src/react/context/ApolloConsumer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,MAAM,CAAC,IAAM,cAAc,GAAkC,UAAC,KAAK;IACjE,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,QACpB,UAAC,OAAY;QACZ,SAAS,CACP,OAAO,IAAI,OAAO,CAAC,MAAM,EACzB,4DAA4D;YAC1D,iDAAiD,CACpD,CAAC;QACF,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC,CACsB,CAC1B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\n\nimport * as React from \"react\";\n\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { getApolloContext } from \"./ApolloContext.js\";\n\nexport interface ApolloConsumerProps {\n children: (client: ApolloClient<object>) => React.ReactChild | null;\n}\n\nexport const ApolloConsumer: React.FC<ApolloConsumerProps> = (props) => {\n const ApolloContext = getApolloContext();\n return (\n <ApolloContext.Consumer>\n {(context: any) => {\n invariant(\n context && context.client,\n 'Could not find \"client\" in the context of ApolloConsumer. ' +\n \"Wrap the root component in an <ApolloProvider>.\"\n );\n return props.children(context.client);\n }}\n </ApolloContext.Consumer>\n );\n};\n"]}
1
+ {"version":3,"file":"ApolloConsumer.js","sourceRoot":"","sources":["../../../src/react/context/ApolloConsumer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAIjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,MAAM,CAAC,IAAM,cAAc,GAAuC,UAAC,KAAK;IACtE,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,QACpB,UAAC,OAAY;QACZ,SAAS,CACP,OAAO,IAAI,OAAO,CAAC,MAAM,EACzB,4DAA4D;YAC1D,iDAAiD,CACpD,CAAC;QACF,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC,CACsB,CAC1B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\n\nimport * as React from \"rehackt\";\nimport type * as ReactTypes from \"react\";\n\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { getApolloContext } from \"./ApolloContext.js\";\n\nexport interface ApolloConsumerProps {\n children: (client: ApolloClient<object>) => ReactTypes.ReactChild | null;\n}\n\nexport const ApolloConsumer: ReactTypes.FC<ApolloConsumerProps> = (props) => {\n const ApolloContext = getApolloContext();\n return (\n <ApolloContext.Consumer>\n {(context: any) => {\n invariant(\n context && context.client,\n 'Could not find \"client\" in the context of ApolloConsumer. ' +\n \"Wrap the root component in an <ApolloProvider>.\"\n );\n return props.children(context.client);\n }}\n </ApolloContext.Consumer>\n );\n};\n"]}
@@ -1,10 +1,10 @@
1
- import * as React from "react";
1
+ import type * as ReactTypes from "react";
2
2
  import type { ApolloClient } from "../../core/index.js";
3
3
  import type { RenderPromises } from "../ssr/index.js";
4
4
  export interface ApolloContextValue {
5
5
  client?: ApolloClient<object>;
6
6
  renderPromises?: RenderPromises;
7
7
  }
8
- export declare function getApolloContext(): React.Context<ApolloContextValue>;
8
+ export declare function getApolloContext(): ReactTypes.Context<ApolloContextValue>;
9
9
  export declare const resetApolloContext: typeof getApolloContext;
10
10
  //# sourceMappingURL=ApolloContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloContext.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGtD,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAUD,wBAAgB,gBAAgB,IAAI,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAuBpE;AAOD,eAAO,MAAM,kBAAkB,yBAAmB,CAAC"}
1
+ {"version":3,"file":"ApolloContext.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,UAAU,MAAM,OAAO,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGtD,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAUD,wBAAgB,gBAAgB,IAAI,UAAU,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAuBzE;AAOD,eAAO,MAAM,kBAAkB,yBAAmB,CAAC"}
@@ -1,11 +1,11 @@
1
- import * as React from "react";
1
+ import * as React from "rehackt";
2
2
  import { canUseSymbol } from "../../utilities/index.js";
3
3
  import { invariant } from "../../utilities/globals/index.js";
4
4
  var contextKey = canUseSymbol
5
5
  ? Symbol.for("__APOLLO_CONTEXT__")
6
6
  : "__APOLLO_CONTEXT__";
7
7
  export function getApolloContext() {
8
- invariant("createContext" in React, 43);
8
+ invariant("createContext" in React, 45);
9
9
  var context = React.createContext[contextKey];
10
10
  if (!context) {
11
11
  Object.defineProperty(React.createContext, contextKey, {
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloContext.js","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAW7D,IAAM,UAAU,GAAG,YAAY;IAC7B,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAClC,CAAC,CAAC,oBAAoB,CAAC;AAEzB,MAAM,UAAU,gBAAgB;IAC9B,SAAS,CACP,eAAe,IAAI,KAAK,EACxB,+FAA+F;QAC7F,uGAAuG;QACvG,iEAAiE;QAEjE,sGAAsG,CACzG,CAAC;IAEF,IAAI,OAAO,GAAI,KAAK,CAAC,aAAqB,CACxC,UAAU,CAC0B,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,aAAa,EAAE,UAAU,EAAE;YACrD,KAAK,EAAE,CAAC,OAAO,GAAG,KAAK,CAAC,aAAa,CAAqB,EAAE,CAAC,CAAC;YAC9D,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;QACH,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;KACvC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAOD,MAAM,CAAC,IAAM,kBAAkB,GAAG,gBAAgB,CAAC","sourcesContent":["import * as React from \"react\";\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { canUseSymbol } from \"../../utilities/index.js\";\nimport type { RenderPromises } from \"../ssr/index.js\";\nimport { invariant } from \"../../utilities/globals/index.js\";\n\nexport interface ApolloContextValue {\n client?: ApolloClient<object>;\n renderPromises?: RenderPromises;\n}\n\n// To make sure Apollo Client doesn't create more than one React context\n// (which can lead to problems like having an Apollo Client instance added\n// in one context, then attempting to retrieve it from another different\n// context), a single Apollo context is created and tracked in global state.\nconst contextKey = canUseSymbol\n ? Symbol.for(\"__APOLLO_CONTEXT__\")\n : \"__APOLLO_CONTEXT__\";\n\nexport function getApolloContext(): React.Context<ApolloContextValue> {\n invariant(\n \"createContext\" in React,\n \"Invoking `getApolloContext` in an environment where `React.createContext` is not available.\\n\" +\n \"The Apollo Client functionality you are trying to use is only available in React Client Components.\\n\" +\n 'Please make sure to add \"use client\" at the top of your file.\\n' +\n // TODO: change to React documentation once React documentation contains information about Client Components\n \"For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components\"\n );\n\n let context = (React.createContext as any)[\n contextKey\n ] as React.Context<ApolloContextValue>;\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: (context = React.createContext<ApolloContextValue>({})),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = \"ApolloContext\";\n }\n return context;\n}\n\n/**\n * @deprecated This function has no \"resetting\" effect since Apollo Client 3.4.12,\n * and will be removed in the next major version of Apollo Client.\n * If you want to get the Apollo Context, use `getApolloContext` instead.\n */\nexport const resetApolloContext = getApolloContext;\n"]}
1
+ {"version":3,"file":"ApolloContext.js","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAW7D,IAAM,UAAU,GAAG,YAAY;IAC7B,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAClC,CAAC,CAAC,oBAAoB,CAAC;AAEzB,MAAM,UAAU,gBAAgB;IAC9B,SAAS,CACP,eAAe,IAAI,KAAK,EACxB,+FAA+F;QAC7F,uGAAuG;QACvG,iEAAiE;QAEjE,sGAAsG,CACzG,CAAC;IAEF,IAAI,OAAO,GAAI,KAAK,CAAC,aAAqB,CACxC,UAAU,CAC0B,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,aAAa,EAAE,UAAU,EAAE;YACrD,KAAK,EAAE,CAAC,OAAO,GAAG,KAAK,CAAC,aAAa,CAAqB,EAAE,CAAC,CAAC;YAC9D,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;QACH,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;KACvC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAOD,MAAM,CAAC,IAAM,kBAAkB,GAAG,gBAAgB,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport type * as ReactTypes from \"react\";\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { canUseSymbol } from \"../../utilities/index.js\";\nimport type { RenderPromises } from \"../ssr/index.js\";\nimport { invariant } from \"../../utilities/globals/index.js\";\n\nexport interface ApolloContextValue {\n client?: ApolloClient<object>;\n renderPromises?: RenderPromises;\n}\n\n// To make sure Apollo Client doesn't create more than one React context\n// (which can lead to problems like having an Apollo Client instance added\n// in one context, then attempting to retrieve it from another different\n// context), a single Apollo context is created and tracked in global state.\nconst contextKey = canUseSymbol\n ? Symbol.for(\"__APOLLO_CONTEXT__\")\n : \"__APOLLO_CONTEXT__\";\n\nexport function getApolloContext(): ReactTypes.Context<ApolloContextValue> {\n invariant(\n \"createContext\" in React,\n \"Invoking `getApolloContext` in an environment where `React.createContext` is not available.\\n\" +\n \"The Apollo Client functionality you are trying to use is only available in React Client Components.\\n\" +\n 'Please make sure to add \"use client\" at the top of your file.\\n' +\n // TODO: change to React documentation once React documentation contains information about Client Components\n \"For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components\"\n );\n\n let context = (React.createContext as any)[\n contextKey\n ] as React.Context<ApolloContextValue>;\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: (context = React.createContext<ApolloContextValue>({})),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = \"ApolloContext\";\n }\n return context;\n}\n\n/**\n * @deprecated This function has no \"resetting\" effect since Apollo Client 3.4.12,\n * and will be removed in the next major version of Apollo Client.\n * If you want to get the Apollo Context, use `getApolloContext` instead.\n */\nexport const resetApolloContext = getApolloContext;\n"]}
@@ -1,8 +1,8 @@
1
- import * as React from "react";
1
+ import type * as ReactTypes from "react";
2
2
  import type { ApolloClient } from "../../core/index.js";
3
3
  export interface ApolloProviderProps<TCache> {
4
4
  client: ApolloClient<TCache>;
5
- children: React.ReactNode | React.ReactNode[] | null;
5
+ children: ReactTypes.ReactNode | ReactTypes.ReactNode[] | null;
6
6
  }
7
- export declare const ApolloProvider: React.FC<ApolloProviderProps<any>>;
7
+ export declare const ApolloProvider: ReactTypes.FC<ApolloProviderProps<any>>;
8
8
  //# sourceMappingURL=ApolloProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloProvider.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD,MAAM,WAAW,mBAAmB,CAAC,MAAM;IACzC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC;CACtD;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAuB7D,CAAC"}
1
+ {"version":3,"file":"ApolloProvider.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,UAAU,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD,MAAM,WAAW,mBAAmB,CAAC,MAAM;IACzC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7B,QAAQ,EAAE,UAAU,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC;CAChE;AAED,eAAO,MAAM,cAAc,EAAE,UAAU,CAAC,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAuBlE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { __assign } from "tslib";
2
2
  import { invariant } from "../../utilities/globals/index.js";
3
- import * as React from "react";
3
+ import * as React from "rehackt";
4
4
  import { getApolloContext } from "./ApolloContext.js";
5
5
  export var ApolloProvider = function (_a) {
6
6
  var client = _a.client, children = _a.children;
@@ -9,7 +9,7 @@ export var ApolloProvider = function (_a) {
9
9
  var context = React.useMemo(function () {
10
10
  return __assign(__assign({}, parentContext), { client: client || parentContext.client });
11
11
  }, [parentContext, client]);
12
- invariant(context.client, 44);
12
+ invariant(context.client, 46);
13
13
  return (React.createElement(ApolloContext.Provider, { value: context }, children));
14
14
  };
15
15
  //# sourceMappingURL=ApolloProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloProvider.js","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAOtD,MAAM,CAAC,IAAM,cAAc,GAAuC,UAAC,EAGlE;QAFC,MAAM,YAAA,EACN,QAAQ,cAAA;IAER,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,IAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAEtD,IAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC5B,6BACK,aAAa,KAChB,MAAM,EAAE,MAAM,IAAI,aAAa,CAAC,MAAM,IACtC;IACJ,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;IAE5B,SAAS,CACP,OAAO,CAAC,MAAM,EACd,wDAAwD;QACtD,qDAAqD,CACxD,CAAC;IAEF,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IAAG,QAAQ,CAA0B,CAC5E,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\n\nimport * as React from \"react\";\n\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { getApolloContext } from \"./ApolloContext.js\";\n\nexport interface ApolloProviderProps<TCache> {\n client: ApolloClient<TCache>;\n children: React.ReactNode | React.ReactNode[] | null;\n}\n\nexport const ApolloProvider: React.FC<ApolloProviderProps<any>> = ({\n client,\n children,\n}) => {\n const ApolloContext = getApolloContext();\n const parentContext = React.useContext(ApolloContext);\n\n const context = React.useMemo(() => {\n return {\n ...parentContext,\n client: client || parentContext.client,\n };\n }, [parentContext, client]);\n\n invariant(\n context.client,\n \"ApolloProvider was not passed a client instance. Make \" +\n 'sure you pass in your client via the \"client\" prop.'\n );\n\n return (\n <ApolloContext.Provider value={context}>{children}</ApolloContext.Provider>\n );\n};\n"]}
1
+ {"version":3,"file":"ApolloProvider.js","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAIjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAOtD,MAAM,CAAC,IAAM,cAAc,GAA4C,UAAC,EAGvE;QAFC,MAAM,YAAA,EACN,QAAQ,cAAA;IAER,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,IAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAEtD,IAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC5B,6BACK,aAAa,KAChB,MAAM,EAAE,MAAM,IAAI,aAAa,CAAC,MAAM,IACtC;IACJ,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;IAE5B,SAAS,CACP,OAAO,CAAC,MAAM,EACd,wDAAwD;QACtD,qDAAqD,CACxD,CAAC;IAEF,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IAAG,QAAQ,CAA0B,CAC5E,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\n\nimport * as React from \"rehackt\";\nimport type * as ReactTypes from \"react\";\n\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { getApolloContext } from \"./ApolloContext.js\";\n\nexport interface ApolloProviderProps<TCache> {\n client: ApolloClient<TCache>;\n children: ReactTypes.ReactNode | ReactTypes.ReactNode[] | null;\n}\n\nexport const ApolloProvider: ReactTypes.FC<ApolloProviderProps<any>> = ({\n client,\n children,\n}) => {\n const ApolloContext = getApolloContext();\n const parentContext = React.useContext(ApolloContext);\n\n const context = React.useMemo(() => {\n return {\n ...parentContext,\n client: client || parentContext.client,\n };\n }, [parentContext, client]);\n\n invariant(\n context.client,\n \"ApolloProvider was not passed a client instance. Make \" +\n 'sure you pass in your client via the \"client\" prop.'\n );\n\n return (\n <ApolloContext.Provider value={context}>{children}</ApolloContext.Provider>\n );\n};\n"]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var globals = require('../../utilities/globals');
6
- var React = require('react');
6
+ var React = require('rehackt');
7
7
  var utilities = require('../../utilities');
8
8
  var tslib = require('tslib');
9
9
 
@@ -25,7 +25,7 @@ var contextKey = utilities.canUseSymbol
25
25
  ? Symbol.for("__APOLLO_CONTEXT__")
26
26
  : "__APOLLO_CONTEXT__";
27
27
  function getApolloContext() {
28
- globals.invariant("createContext" in React__namespace, 43);
28
+ globals.invariant("createContext" in React__namespace, 45);
29
29
  var context = React__namespace.createContext[contextKey];
30
30
  if (!context) {
31
31
  Object.defineProperty(React__namespace.createContext, contextKey, {
@@ -43,7 +43,7 @@ var resetApolloContext = getApolloContext;
43
43
  var ApolloConsumer = function (props) {
44
44
  var ApolloContext = getApolloContext();
45
45
  return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
46
- globals.invariant(context && context.client, 42);
46
+ globals.invariant(context && context.client, 44);
47
47
  return props.children(context.client);
48
48
  }));
49
49
  };
@@ -55,7 +55,7 @@ var ApolloProvider = function (_a) {
55
55
  var context = React__namespace.useMemo(function () {
56
56
  return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client });
57
57
  }, [parentContext, client]);
58
- globals.invariant(context.client, 44);
58
+ globals.invariant(context.client, 46);
59
59
  return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
60
60
  };
61
61
 
@@ -1 +1 @@
1
- {"version":3,"file":"context.cjs","sources":["ApolloContext.js","ApolloConsumer.js","ApolloProvider.js"],"sourcesContent":["import * as React from \"react\";\nimport { canUseSymbol } from \"../../utilities/index.js\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nvar contextKey = canUseSymbol\n ? Symbol.for(\"__APOLLO_CONTEXT__\")\n : \"__APOLLO_CONTEXT__\";\nexport function getApolloContext() {\n invariant(\"createContext\" in React, 43);\n var context = React.createContext[contextKey];\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: (context = React.createContext({})),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = \"ApolloContext\";\n }\n return context;\n}\nexport var resetApolloContext = getApolloContext;\n//# sourceMappingURL=ApolloContext.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"react\";\nimport { getApolloContext } from \"./ApolloContext.js\";\nexport var ApolloConsumer = function (props) {\n var ApolloContext = getApolloContext();\n return (React.createElement(ApolloContext.Consumer, null, function (context) {\n invariant(context && context.client, 42);\n return props.children(context.client);\n }));\n};\n//# sourceMappingURL=ApolloConsumer.js.map","import { __assign } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"react\";\nimport { getApolloContext } from \"./ApolloContext.js\";\nexport var ApolloProvider = function (_a) {\n var client = _a.client, children = _a.children;\n var ApolloContext = getApolloContext();\n var parentContext = React.useContext(ApolloContext);\n var context = React.useMemo(function () {\n return __assign(__assign({}, parentContext), { client: client || parentContext.client });\n }, [parentContext, client]);\n invariant(context.client, 44);\n return (React.createElement(ApolloContext.Provider, { value: context }, children));\n};\n//# sourceMappingURL=ApolloProvider.js.map"],"names":["canUseSymbol","invariant","React","__assign"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAI,UAAU,GAAGA,sBAAY;AAC7B,MAAM,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;AACtC,MAAM,oBAAoB,CAAC;AACpB,SAAS,gBAAgB,GAAG;AACnC,IAAIC,iBAAS,CAAC,eAAe,IAAIC,gBAAK,EAAE,EAAE,CAAC,CAAC;AAC5C,IAAI,IAAI,OAAO,GAAGA,gBAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AAClD,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,MAAM,CAAC,cAAc,CAACA,gBAAK,CAAC,aAAa,EAAE,UAAU,EAAE;AAC/D,YAAY,KAAK,GAAG,OAAO,GAAGA,gBAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;AACtD,YAAY,UAAU,EAAE,KAAK;AAC7B,YAAY,QAAQ,EAAE,KAAK;AAC3B,YAAY,YAAY,EAAE,IAAI;AAC9B,SAAS,CAAC,CAAC;AACX,QAAQ,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;AAC9C,KAAK;AACL,IAAI,OAAO,OAAO,CAAC;AACnB,CAAC;AACS,IAAC,kBAAkB,GAAG;;ACjBtB,IAAC,cAAc,GAAG,UAAU,KAAK,EAAE;AAC7C,IAAI,IAAI,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC3C,IAAI,QAAQA,gBAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE;AACjF,QAAQD,iBAAS,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACjD,QAAQ,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC9C,KAAK,CAAC,EAAE;AACR;;ACLU,IAAC,cAAc,GAAG,UAAU,EAAE,EAAE;AAC1C,IAAI,IAAI,MAAM,GAAG,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC;AACnD,IAAI,IAAI,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC3C,IAAI,IAAI,aAAa,GAAGC,gBAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACxD,IAAI,IAAI,OAAO,GAAGA,gBAAK,CAAC,OAAO,CAAC,YAAY;AAC5C,QAAQ,OAAOC,cAAQ,CAACA,cAAQ,CAAC,EAAE,EAAE,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,IAAI,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC;AACjG,KAAK,EAAE,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;AAChC,IAAIF,iBAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAClC,IAAI,QAAQC,gBAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,EAAE;AACvF;;;;;;;"}
1
+ {"version":3,"file":"context.cjs","sources":["ApolloContext.js","ApolloConsumer.js","ApolloProvider.js"],"sourcesContent":["import * as React from \"rehackt\";\nimport { canUseSymbol } from \"../../utilities/index.js\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nvar contextKey = canUseSymbol\n ? Symbol.for(\"__APOLLO_CONTEXT__\")\n : \"__APOLLO_CONTEXT__\";\nexport function getApolloContext() {\n invariant(\"createContext\" in React, 45);\n var context = React.createContext[contextKey];\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: (context = React.createContext({})),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = \"ApolloContext\";\n }\n return context;\n}\nexport var resetApolloContext = getApolloContext;\n//# sourceMappingURL=ApolloContext.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { getApolloContext } from \"./ApolloContext.js\";\nexport var ApolloConsumer = function (props) {\n var ApolloContext = getApolloContext();\n return (React.createElement(ApolloContext.Consumer, null, function (context) {\n invariant(context && context.client, 44);\n return props.children(context.client);\n }));\n};\n//# sourceMappingURL=ApolloConsumer.js.map","import { __assign } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { getApolloContext } from \"./ApolloContext.js\";\nexport var ApolloProvider = function (_a) {\n var client = _a.client, children = _a.children;\n var ApolloContext = getApolloContext();\n var parentContext = React.useContext(ApolloContext);\n var context = React.useMemo(function () {\n return __assign(__assign({}, parentContext), { client: client || parentContext.client });\n }, [parentContext, client]);\n invariant(context.client, 46);\n return (React.createElement(ApolloContext.Provider, { value: context }, children));\n};\n//# sourceMappingURL=ApolloProvider.js.map"],"names":["canUseSymbol","invariant","React","__assign"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAI,UAAU,GAAGA,sBAAY;AAC7B,MAAM,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;AACtC,MAAM,oBAAoB,CAAC;AACpB,SAAS,gBAAgB,GAAG;AACnC,IAAIC,iBAAS,CAAC,eAAe,IAAIC,gBAAK,EAAE,EAAE,CAAC,CAAC;AAC5C,IAAI,IAAI,OAAO,GAAGA,gBAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AAClD,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,MAAM,CAAC,cAAc,CAACA,gBAAK,CAAC,aAAa,EAAE,UAAU,EAAE;AAC/D,YAAY,KAAK,GAAG,OAAO,GAAGA,gBAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;AACtD,YAAY,UAAU,EAAE,KAAK;AAC7B,YAAY,QAAQ,EAAE,KAAK;AAC3B,YAAY,YAAY,EAAE,IAAI;AAC9B,SAAS,CAAC,CAAC;AACX,QAAQ,OAAO,CAAC,WAA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