houdini-react 0.0.0-20231008055552

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 (236) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -0
  3. package/build/plugin/codegen/entries.d.ts +5 -0
  4. package/build/plugin/codegen/index.d.ts +13 -0
  5. package/build/plugin/codegen/manifest.d.ts +5 -0
  6. package/build/plugin/codegen/render.d.ts +5 -0
  7. package/build/plugin/codegen/router.d.ts +7 -0
  8. package/build/plugin/codegen/typeRoot.d.ts +6 -0
  9. package/build/plugin/config.d.ts +4 -0
  10. package/build/plugin/dedent.d.ts +1 -0
  11. package/build/plugin/extract.d.ts +6 -0
  12. package/build/plugin/index.d.ts +7 -0
  13. package/build/plugin/transform.d.ts +6 -0
  14. package/build/plugin/vite.d.ts +54 -0
  15. package/build/plugin-cjs/index.js +79966 -0
  16. package/build/plugin-cjs/package.json +1 -0
  17. package/build/plugin-esm/index.js +79956 -0
  18. package/build/plugin-esm/package.json +1 -0
  19. package/build/runtime/client.d.ts +3 -0
  20. package/build/runtime/clientPlugin.d.ts +3 -0
  21. package/build/runtime/hooks/index.d.ts +8 -0
  22. package/build/runtime/hooks/useDeepCompareEffect.d.ts +35 -0
  23. package/build/runtime/hooks/useDocumentHandle.d.ts +34 -0
  24. package/build/runtime/hooks/useDocumentStore.d.ts +12 -0
  25. package/build/runtime/hooks/useDocumentSubscription.d.ts +15 -0
  26. package/build/runtime/hooks/useFragment.d.ts +16 -0
  27. package/build/runtime/hooks/useFragmentHandle.d.ts +8 -0
  28. package/build/runtime/hooks/useIsMounted.d.ts +3 -0
  29. package/build/runtime/hooks/useMutation.d.ts +10 -0
  30. package/build/runtime/hooks/useQuery.d.ts +5 -0
  31. package/build/runtime/hooks/useQueryHandle.d.ts +10 -0
  32. package/build/runtime/hooks/useSubscription.d.ts +4 -0
  33. package/build/runtime/hooks/useSubscriptionHandle.d.ts +25 -0
  34. package/build/runtime/index.d.ts +11 -0
  35. package/build/runtime/manifest.d.ts +3 -0
  36. package/build/runtime/routing/Router.d.ts +67 -0
  37. package/build/runtime/routing/cache.d.ts +7 -0
  38. package/build/runtime/routing/index.d.ts +2 -0
  39. package/build/runtime/server/index.d.ts +17 -0
  40. package/build/runtime/server/renderToStream/createBuffer.d.ts +17 -0
  41. package/build/runtime/server/renderToStream/createPipeWrapper.d.ts +12 -0
  42. package/build/runtime/server/renderToStream/createReadableWrapper.d.ts +6 -0
  43. package/build/runtime/server/renderToStream/loadNodeStreamModule.d.ts +10 -0
  44. package/build/runtime/server/renderToStream/resolveSeoStrategy.d.ts +9 -0
  45. package/build/runtime/server/renderToStream.d.ts +28 -0
  46. package/build/runtime/server/shared/initData.d.ts +8 -0
  47. package/build/runtime/server/shared/key.d.ts +4 -0
  48. package/build/runtime/server/shared/utils.d.ts +3 -0
  49. package/build/runtime/server/useStream.d.ts +9 -0
  50. package/build/runtime/server/utils/assert.d.ts +15 -0
  51. package/build/runtime/server/utils/createErrorWithCleanStackTrace.d.ts +2 -0
  52. package/build/runtime/server/utils/debug.d.ts +14 -0
  53. package/build/runtime/server/utils/getGlobalVariable.d.ts +4 -0
  54. package/build/runtime/server/utils/isBrowser.d.ts +2 -0
  55. package/build/runtime/server/utils/isCallable.d.ts +2 -0
  56. package/build/runtime/server/utils/isClientSide.d.ts +2 -0
  57. package/build/runtime/server/utils/isPromise.d.ts +1 -0
  58. package/build/runtime/server/utils/isServerSide.d.ts +2 -0
  59. package/build/runtime/server/utils/objectAssign.d.ts +2 -0
  60. package/build/runtime/server/utils/projectInfo.d.ts +10 -0
  61. package/build/runtime/server/utils.d.ts +4 -0
  62. package/build/runtime-cjs/client.d.ts +3 -0
  63. package/build/runtime-cjs/client.js +27 -0
  64. package/build/runtime-cjs/clientPlugin.d.ts +3 -0
  65. package/build/runtime-cjs/clientPlugin.js +39 -0
  66. package/build/runtime-cjs/hooks/index.d.ts +8 -0
  67. package/build/runtime-cjs/hooks/index.js +45 -0
  68. package/build/runtime-cjs/hooks/useDeepCompareEffect.d.ts +35 -0
  69. package/build/runtime-cjs/hooks/useDeepCompareEffect.js +72 -0
  70. package/build/runtime-cjs/hooks/useDocumentHandle.d.ts +34 -0
  71. package/build/runtime-cjs/hooks/useDocumentHandle.js +131 -0
  72. package/build/runtime-cjs/hooks/useDocumentStore.d.ts +12 -0
  73. package/build/runtime-cjs/hooks/useDocumentStore.js +68 -0
  74. package/build/runtime-cjs/hooks/useDocumentSubscription.d.ts +15 -0
  75. package/build/runtime-cjs/hooks/useDocumentSubscription.js +72 -0
  76. package/build/runtime-cjs/hooks/useFragment.d.ts +16 -0
  77. package/build/runtime-cjs/hooks/useFragment.js +97 -0
  78. package/build/runtime-cjs/hooks/useFragmentHandle.d.ts +8 -0
  79. package/build/runtime-cjs/hooks/useFragmentHandle.js +47 -0
  80. package/build/runtime-cjs/hooks/useIsMounted.d.ts +3 -0
  81. package/build/runtime-cjs/hooks/useIsMounted.js +38 -0
  82. package/build/runtime-cjs/hooks/useMutation.d.ts +10 -0
  83. package/build/runtime-cjs/hooks/useMutation.js +50 -0
  84. package/build/runtime-cjs/hooks/useQuery.d.ts +5 -0
  85. package/build/runtime-cjs/hooks/useQuery.js +32 -0
  86. package/build/runtime-cjs/hooks/useQueryHandle.d.ts +10 -0
  87. package/build/runtime-cjs/hooks/useQueryHandle.js +125 -0
  88. package/build/runtime-cjs/hooks/useSubscription.d.ts +4 -0
  89. package/build/runtime-cjs/hooks/useSubscription.js +32 -0
  90. package/build/runtime-cjs/hooks/useSubscriptionHandle.d.ts +25 -0
  91. package/build/runtime-cjs/hooks/useSubscriptionHandle.js +42 -0
  92. package/build/runtime-cjs/index.d.ts +11 -0
  93. package/build/runtime-cjs/index.js +77 -0
  94. package/build/runtime-cjs/manifest.d.ts +3 -0
  95. package/build/runtime-cjs/manifest.js +27 -0
  96. package/build/runtime-cjs/package.json +1 -0
  97. package/build/runtime-cjs/routing/Router.d.ts +67 -0
  98. package/build/runtime-cjs/routing/Router.js +429 -0
  99. package/build/runtime-cjs/routing/cache.d.ts +7 -0
  100. package/build/runtime-cjs/routing/cache.js +58 -0
  101. package/build/runtime-cjs/routing/index.d.ts +2 -0
  102. package/build/runtime-cjs/routing/index.js +30 -0
  103. package/build/runtime-cjs/server/index.d.ts +17 -0
  104. package/build/runtime-cjs/server/index.js +28 -0
  105. package/build/runtime-cjs/server/renderToStream/createBuffer.d.ts +17 -0
  106. package/build/runtime-cjs/server/renderToStream/createBuffer.js +101 -0
  107. package/build/runtime-cjs/server/renderToStream/createPipeWrapper.d.ts +12 -0
  108. package/build/runtime-cjs/server/renderToStream/createPipeWrapper.js +90 -0
  109. package/build/runtime-cjs/server/renderToStream/createReadableWrapper.d.ts +6 -0
  110. package/build/runtime-cjs/server/renderToStream/createReadableWrapper.js +85 -0
  111. package/build/runtime-cjs/server/renderToStream/loadNodeStreamModule.d.ts +10 -0
  112. package/build/runtime-cjs/server/renderToStream/loadNodeStreamModule.js +51 -0
  113. package/build/runtime-cjs/server/renderToStream/resolveSeoStrategy.d.ts +9 -0
  114. package/build/runtime-cjs/server/renderToStream/resolveSeoStrategy.js +44 -0
  115. package/build/runtime-cjs/server/renderToStream.d.ts +28 -0
  116. package/build/runtime-cjs/server/renderToStream.js +183 -0
  117. package/build/runtime-cjs/server/shared/initData.d.ts +8 -0
  118. package/build/runtime-cjs/server/shared/initData.js +28 -0
  119. package/build/runtime-cjs/server/shared/key.d.ts +4 -0
  120. package/build/runtime-cjs/server/shared/key.js +45 -0
  121. package/build/runtime-cjs/server/shared/utils.d.ts +3 -0
  122. package/build/runtime-cjs/server/shared/utils.js +20 -0
  123. package/build/runtime-cjs/server/useStream.d.ts +9 -0
  124. package/build/runtime-cjs/server/useStream.js +44 -0
  125. package/build/runtime-cjs/server/utils/assert.d.ts +15 -0
  126. package/build/runtime-cjs/server/utils/assert.js +119 -0
  127. package/build/runtime-cjs/server/utils/createErrorWithCleanStackTrace.d.ts +2 -0
  128. package/build/runtime-cjs/server/utils/createErrorWithCleanStackTrace.js +62 -0
  129. package/build/runtime-cjs/server/utils/debug.d.ts +14 -0
  130. package/build/runtime-cjs/server/utils/debug.js +112 -0
  131. package/build/runtime-cjs/server/utils/getGlobalVariable.d.ts +4 -0
  132. package/build/runtime-cjs/server/utils/getGlobalVariable.js +32 -0
  133. package/build/runtime-cjs/server/utils/isBrowser.d.ts +2 -0
  134. package/build/runtime-cjs/server/utils/isBrowser.js +30 -0
  135. package/build/runtime-cjs/server/utils/isCallable.d.ts +2 -0
  136. package/build/runtime-cjs/server/utils/isCallable.js +30 -0
  137. package/build/runtime-cjs/server/utils/isClientSide.d.ts +2 -0
  138. package/build/runtime-cjs/server/utils/isClientSide.js +30 -0
  139. package/build/runtime-cjs/server/utils/isPromise.d.ts +1 -0
  140. package/build/runtime-cjs/server/utils/isPromise.js +31 -0
  141. package/build/runtime-cjs/server/utils/isServerSide.d.ts +2 -0
  142. package/build/runtime-cjs/server/utils/isServerSide.js +31 -0
  143. package/build/runtime-cjs/server/utils/objectAssign.d.ts +2 -0
  144. package/build/runtime-cjs/server/utils/objectAssign.js +30 -0
  145. package/build/runtime-cjs/server/utils/projectInfo.d.ts +10 -0
  146. package/build/runtime-cjs/server/utils/projectInfo.js +37 -0
  147. package/build/runtime-cjs/server/utils.d.ts +4 -0
  148. package/build/runtime-cjs/server/utils.js +21 -0
  149. package/build/runtime-esm/client.d.ts +3 -0
  150. package/build/runtime-esm/client.js +5 -0
  151. package/build/runtime-esm/clientPlugin.d.ts +3 -0
  152. package/build/runtime-esm/clientPlugin.js +17 -0
  153. package/build/runtime-esm/hooks/index.d.ts +8 -0
  154. package/build/runtime-esm/hooks/index.js +16 -0
  155. package/build/runtime-esm/hooks/useDeepCompareEffect.d.ts +35 -0
  156. package/build/runtime-esm/hooks/useDeepCompareEffect.js +41 -0
  157. package/build/runtime-esm/hooks/useDocumentHandle.d.ts +34 -0
  158. package/build/runtime-esm/hooks/useDocumentHandle.js +101 -0
  159. package/build/runtime-esm/hooks/useDocumentStore.d.ts +12 -0
  160. package/build/runtime-esm/hooks/useDocumentStore.js +38 -0
  161. package/build/runtime-esm/hooks/useDocumentSubscription.d.ts +15 -0
  162. package/build/runtime-esm/hooks/useDocumentSubscription.js +42 -0
  163. package/build/runtime-esm/hooks/useFragment.d.ts +16 -0
  164. package/build/runtime-esm/hooks/useFragment.js +66 -0
  165. package/build/runtime-esm/hooks/useFragmentHandle.d.ts +8 -0
  166. package/build/runtime-esm/hooks/useFragmentHandle.js +23 -0
  167. package/build/runtime-esm/hooks/useIsMounted.d.ts +3 -0
  168. package/build/runtime-esm/hooks/useIsMounted.js +14 -0
  169. package/build/runtime-esm/hooks/useMutation.d.ts +10 -0
  170. package/build/runtime-esm/hooks/useMutation.js +26 -0
  171. package/build/runtime-esm/hooks/useQuery.d.ts +5 -0
  172. package/build/runtime-esm/hooks/useQuery.js +8 -0
  173. package/build/runtime-esm/hooks/useQueryHandle.d.ts +10 -0
  174. package/build/runtime-esm/hooks/useQueryHandle.js +95 -0
  175. package/build/runtime-esm/hooks/useSubscription.d.ts +4 -0
  176. package/build/runtime-esm/hooks/useSubscription.js +8 -0
  177. package/build/runtime-esm/hooks/useSubscriptionHandle.d.ts +25 -0
  178. package/build/runtime-esm/hooks/useSubscriptionHandle.js +18 -0
  179. package/build/runtime-esm/index.d.ts +11 -0
  180. package/build/runtime-esm/index.js +45 -0
  181. package/build/runtime-esm/manifest.d.ts +3 -0
  182. package/build/runtime-esm/manifest.js +5 -0
  183. package/build/runtime-esm/package.json +1 -0
  184. package/build/runtime-esm/routing/Router.d.ts +67 -0
  185. package/build/runtime-esm/routing/Router.js +390 -0
  186. package/build/runtime-esm/routing/cache.d.ts +7 -0
  187. package/build/runtime-esm/routing/cache.js +33 -0
  188. package/build/runtime-esm/routing/index.d.ts +2 -0
  189. package/build/runtime-esm/routing/index.js +5 -0
  190. package/build/runtime-esm/server/index.d.ts +17 -0
  191. package/build/runtime-esm/server/index.js +4 -0
  192. package/build/runtime-esm/server/renderToStream/createBuffer.d.ts +17 -0
  193. package/build/runtime-esm/server/renderToStream/createBuffer.js +77 -0
  194. package/build/runtime-esm/server/renderToStream/createPipeWrapper.d.ts +12 -0
  195. package/build/runtime-esm/server/renderToStream/createPipeWrapper.js +66 -0
  196. package/build/runtime-esm/server/renderToStream/createReadableWrapper.d.ts +6 -0
  197. package/build/runtime-esm/server/renderToStream/createReadableWrapper.js +61 -0
  198. package/build/runtime-esm/server/renderToStream/loadNodeStreamModule.d.ts +10 -0
  199. package/build/runtime-esm/server/renderToStream/loadNodeStreamModule.js +20 -0
  200. package/build/runtime-esm/server/renderToStream/resolveSeoStrategy.d.ts +9 -0
  201. package/build/runtime-esm/server/renderToStream/resolveSeoStrategy.js +20 -0
  202. package/build/runtime-esm/server/renderToStream.d.ts +28 -0
  203. package/build/runtime-esm/server/renderToStream.js +152 -0
  204. package/build/runtime-esm/server/shared/initData.d.ts +8 -0
  205. package/build/runtime-esm/server/shared/initData.js +4 -0
  206. package/build/runtime-esm/server/shared/key.d.ts +4 -0
  207. package/build/runtime-esm/server/shared/key.js +20 -0
  208. package/build/runtime-esm/server/shared/utils.d.ts +3 -0
  209. package/build/runtime-esm/server/shared/utils.js +3 -0
  210. package/build/runtime-esm/server/useStream.d.ts +9 -0
  211. package/build/runtime-esm/server/useStream.js +13 -0
  212. package/build/runtime-esm/server/utils/assert.d.ts +15 -0
  213. package/build/runtime-esm/server/utils/assert.js +91 -0
  214. package/build/runtime-esm/server/utils/createErrorWithCleanStackTrace.d.ts +2 -0
  215. package/build/runtime-esm/server/utils/createErrorWithCleanStackTrace.js +38 -0
  216. package/build/runtime-esm/server/utils/debug.d.ts +14 -0
  217. package/build/runtime-esm/server/utils/debug.js +87 -0
  218. package/build/runtime-esm/server/utils/getGlobalVariable.d.ts +4 -0
  219. package/build/runtime-esm/server/utils/getGlobalVariable.js +8 -0
  220. package/build/runtime-esm/server/utils/isBrowser.d.ts +2 -0
  221. package/build/runtime-esm/server/utils/isBrowser.js +6 -0
  222. package/build/runtime-esm/server/utils/isCallable.d.ts +2 -0
  223. package/build/runtime-esm/server/utils/isCallable.js +6 -0
  224. package/build/runtime-esm/server/utils/isClientSide.d.ts +2 -0
  225. package/build/runtime-esm/server/utils/isClientSide.js +6 -0
  226. package/build/runtime-esm/server/utils/isPromise.d.ts +1 -0
  227. package/build/runtime-esm/server/utils/isPromise.js +7 -0
  228. package/build/runtime-esm/server/utils/isServerSide.d.ts +2 -0
  229. package/build/runtime-esm/server/utils/isServerSide.js +7 -0
  230. package/build/runtime-esm/server/utils/objectAssign.d.ts +2 -0
  231. package/build/runtime-esm/server/utils/objectAssign.js +6 -0
  232. package/build/runtime-esm/server/utils/projectInfo.d.ts +10 -0
  233. package/build/runtime-esm/server/utils/projectInfo.js +13 -0
  234. package/build/runtime-esm/server/utils.d.ts +4 -0
  235. package/build/runtime-esm/server/utils.js +4 -0
  236. package/package.json +67 -0
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var useIsMounted_exports = {};
20
+ __export(useIsMounted_exports, {
21
+ useIsMountedRef: () => useIsMountedRef
22
+ });
23
+ module.exports = __toCommonJS(useIsMounted_exports);
24
+ var import_react = require("react");
25
+ function useIsMountedRef() {
26
+ const isMountedRef = (0, import_react.useRef)(true);
27
+ (0, import_react.useEffect)(() => {
28
+ isMountedRef.current = true;
29
+ return () => {
30
+ isMountedRef.current = false;
31
+ };
32
+ }, []);
33
+ return isMountedRef;
34
+ }
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ useIsMountedRef
38
+ });
@@ -0,0 +1,10 @@
1
+ import type { MutationArtifact, GraphQLObject, QueryResult, GraphQLVariables } from '$houdini/runtime/lib/types';
2
+ export type MutationHandler<_Result, _Input, _Optimistic extends GraphQLObject> = (args: {
3
+ variables: _Input;
4
+ metadata?: App.Metadata;
5
+ fetch?: typeof globalThis.fetch;
6
+ optimisticResponse?: _Optimistic;
7
+ }) => Promise<QueryResult<_Result, _Input>>;
8
+ export declare function useMutation<_Result extends GraphQLObject, _Input extends GraphQLVariables, _Optimistic extends GraphQLObject>({ artifact, }: {
9
+ artifact: MutationArtifact;
10
+ }): [boolean, MutationHandler<_Result, _Input, _Optimistic>];
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var useMutation_exports = {};
20
+ __export(useMutation_exports, {
21
+ useMutation: () => useMutation
22
+ });
23
+ module.exports = __toCommonJS(useMutation_exports);
24
+ var import_Router = require("../routing/Router");
25
+ var import_useDocumentStore = require("./useDocumentStore");
26
+ function useMutation({
27
+ artifact
28
+ }) {
29
+ const [storeValue, observer] = (0, import_useDocumentStore.useDocumentStore)({ artifact });
30
+ const pending = storeValue.fetching;
31
+ const session = (0, import_Router.useSession)();
32
+ const mutate = ({
33
+ metadata,
34
+ fetch,
35
+ variables,
36
+ ...mutationConfig
37
+ }) => observer.send({
38
+ variables,
39
+ metadata,
40
+ session,
41
+ stuff: {
42
+ ...mutationConfig
43
+ }
44
+ });
45
+ return [pending, mutate];
46
+ }
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ useMutation
50
+ });
@@ -0,0 +1,5 @@
1
+ import type { GraphQLVariables, GraphQLObject, QueryArtifact } from '$houdini/runtime/lib/types';
2
+ import type { UseQueryConfig } from './useQueryHandle';
3
+ export declare function useQuery<_Artifact extends QueryArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends GraphQLVariables = GraphQLVariables>(document: {
4
+ artifact: QueryArtifact;
5
+ }, variables?: any, config?: UseQueryConfig): _Data;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var useQuery_exports = {};
20
+ __export(useQuery_exports, {
21
+ useQuery: () => useQuery
22
+ });
23
+ module.exports = __toCommonJS(useQuery_exports);
24
+ var import_useQueryHandle = require("./useQueryHandle");
25
+ function useQuery(document, variables = null, config = {}) {
26
+ const { data } = (0, import_useQueryHandle.useQueryHandle)(document, variables, config);
27
+ return data;
28
+ }
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ useQuery
32
+ });
@@ -0,0 +1,10 @@
1
+ import type { GraphQLObject, CachePolicies, QueryArtifact, GraphQLVariables } from '$houdini/runtime/lib/types';
2
+ import type { DocumentHandle } from './useDocumentHandle';
3
+ export declare function useQueryHandle<_Artifact extends QueryArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends GraphQLVariables = GraphQLVariables>({ artifact }: {
4
+ artifact: QueryArtifact;
5
+ }, variables?: any, config?: UseQueryConfig): DocumentHandle<_Artifact, _Data, _Input>;
6
+ export type UseQueryConfig = {
7
+ policy?: CachePolicies;
8
+ metadata?: App.Metadata;
9
+ fetchKey?: any;
10
+ };
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var useQueryHandle_exports = {};
26
+ __export(useQueryHandle_exports, {
27
+ useQueryHandle: () => useQueryHandle
28
+ });
29
+ module.exports = __toCommonJS(useQueryHandle_exports);
30
+ var import_lru = require("$houdini/runtime/lib/lru");
31
+ var import_react = __toESM(require("react"));
32
+ var import_routing = require("../routing");
33
+ var import_useDocumentHandle = require("./useDocumentHandle");
34
+ var import_useIsMounted = require("./useIsMounted");
35
+ const promiseCache = (0, import_lru.createLRUCache)();
36
+ function useQueryHandle({ artifact }, variables = null, config = {}) {
37
+ const identifier = queryIdentifier({ artifact, variables, config });
38
+ const suspenseValue = promiseCache.get(identifier);
39
+ const client = (0, import_routing.useClient)();
40
+ const isMountedRef = (0, import_useIsMounted.useIsMountedRef)();
41
+ let [observer] = import_react.default.useState(
42
+ client.observe({
43
+ artifact,
44
+ initialValue: suspenseValue?.resolved?.data ?? {}
45
+ })
46
+ );
47
+ const suspenseTracker = import_react.default.useRef(false);
48
+ const box = import_react.default.useRef(observer.state);
49
+ const subscribe = import_react.default.useCallback(
50
+ (fn) => {
51
+ return observer.subscribe((val) => {
52
+ box.current = val;
53
+ if (isMountedRef.current && !suspenseTracker.current) {
54
+ fn();
55
+ }
56
+ });
57
+ },
58
+ [observer]
59
+ );
60
+ const storeValue = import_react.default.useSyncExternalStore(subscribe, () => box.current);
61
+ const handle = (0, import_useDocumentHandle.useDocumentHandle)({
62
+ artifact,
63
+ observer,
64
+ storeValue
65
+ });
66
+ import_react.default.useEffect(() => {
67
+ return () => {
68
+ promiseCache.delete(identifier);
69
+ };
70
+ }, [identifier]);
71
+ import_react.default.useEffect(() => {
72
+ return () => {
73
+ observer.cleanup();
74
+ };
75
+ }, [observer]);
76
+ let result = storeValue.data;
77
+ if (!suspenseValue) {
78
+ let resolve = () => {
79
+ };
80
+ const loadPromise = new Promise((r) => resolve = r);
81
+ const suspenseUnit = {
82
+ then: loadPromise.then.bind(loadPromise),
83
+ resolve,
84
+ variables
85
+ };
86
+ promiseCache.set(identifier, suspenseUnit);
87
+ handle.fetch({
88
+ variables,
89
+ stuff: {
90
+ silenceLoading: true
91
+ }
92
+ }).then((value) => {
93
+ suspenseUnit.resolved = {
94
+ ...handle,
95
+ data: value.data,
96
+ partia: value.partial,
97
+ artifact
98
+ };
99
+ suspenseUnit.resolve();
100
+ });
101
+ suspenseTracker.current = true;
102
+ throw suspenseUnit;
103
+ }
104
+ if (!result && suspenseValue && !suspenseValue.resolved) {
105
+ suspenseTracker.current = true;
106
+ throw suspenseValue;
107
+ }
108
+ if (!result && suspenseValue?.resolved) {
109
+ return suspenseValue.resolved;
110
+ }
111
+ return {
112
+ ...handle,
113
+ variables: storeValue.variables,
114
+ data: result
115
+ };
116
+ }
117
+ function queryIdentifier(args) {
118
+ args.fetchKey ??= 0;
119
+ const { artifact, variables, fetchKey } = args;
120
+ return [artifact.name, JSON.stringify(variables), fetchKey].join("@@");
121
+ }
122
+ // Annotate the CommonJS export names for ESM import in node:
123
+ 0 && (module.exports = {
124
+ useQueryHandle
125
+ });
@@ -0,0 +1,4 @@
1
+ import type { SubscriptionArtifact, GraphQLObject, GraphQLVariables } from '$houdini/runtime/lib/types';
2
+ export declare function useSubscription<_Result extends GraphQLObject, _Input extends GraphQLVariables>(document: {
3
+ artifact: SubscriptionArtifact;
4
+ }, variables: _Input): import("houdini").GraphQLObject | null;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var useSubscription_exports = {};
20
+ __export(useSubscription_exports, {
21
+ useSubscription: () => useSubscription
22
+ });
23
+ module.exports = __toCommonJS(useSubscription_exports);
24
+ var import_useSubscriptionHandle = require("./useSubscriptionHandle");
25
+ function useSubscription(document, variables) {
26
+ const { data } = (0, import_useSubscriptionHandle.useSubscriptionHandle)(document, variables);
27
+ return data;
28
+ }
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ useSubscription
32
+ });
@@ -0,0 +1,25 @@
1
+ import type { SubscriptionArtifact, GraphQLObject, GraphQLVariables } from '$houdini/runtime/lib/types';
2
+ export type SubscriptionHandle<_Result extends GraphQLObject, _Input extends GraphQLVariables> = {
3
+ data: _Result | null;
4
+ errors: {
5
+ message: string;
6
+ }[] | null;
7
+ variables: _Input;
8
+ listen: (args: {
9
+ variables?: _Input;
10
+ }) => void;
11
+ unlisten: () => void;
12
+ fetching: boolean;
13
+ };
14
+ export declare function useSubscriptionHandle<_Result extends GraphQLObject, _Input extends GraphQLVariables>({ artifact }: {
15
+ artifact: SubscriptionArtifact;
16
+ }, variables: _Input): {
17
+ data: import("houdini").GraphQLObject | null;
18
+ errors: {
19
+ message: string;
20
+ }[] | null;
21
+ fetching: boolean;
22
+ variables: _Input;
23
+ unlisten: () => Promise<void>;
24
+ listen: ({ metadata, session, fetch, variables, policy, stuff, cacheParams, setup, silenceEcho, }?: import("$houdini/lib").SendParams) => Promise<import("$houdini/runtime/lib/types").QueryResult<import("houdini").GraphQLObject, _Input>>;
25
+ };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var useSubscriptionHandle_exports = {};
20
+ __export(useSubscriptionHandle_exports, {
21
+ useSubscriptionHandle: () => useSubscriptionHandle
22
+ });
23
+ module.exports = __toCommonJS(useSubscriptionHandle_exports);
24
+ var import_useDocumentSubscription = require("./useDocumentSubscription");
25
+ function useSubscriptionHandle({ artifact }, variables) {
26
+ const [storeValue, observer] = (0, import_useDocumentSubscription.useDocumentSubscription)({
27
+ artifact,
28
+ variables
29
+ });
30
+ return {
31
+ data: storeValue.data,
32
+ errors: storeValue.errors,
33
+ fetching: storeValue.fetching,
34
+ variables,
35
+ unlisten: observer.cleanup,
36
+ listen: observer.send
37
+ };
38
+ }
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ useSubscriptionHandle
42
+ });
@@ -0,0 +1,11 @@
1
+ import type { Cache } from '$houdini/runtime/cache/cache';
2
+ import { RouterCache } from './routing';
3
+ export * from './hooks';
4
+ export { router_cache } from './routing';
5
+ export declare function Router({ cache, initialURL, artifact_cache, component_cache, data_cache, pending_cache, last_variables, session, assetPrefix, injectToStream, }: {
6
+ initialURL: string;
7
+ cache: Cache;
8
+ session?: App.Session;
9
+ assetPrefix: string;
10
+ injectToStream?: (chunk: string) => void;
11
+ } & RouterCache): JSX.Element;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
+ var runtime_exports = {};
27
+ __export(runtime_exports, {
28
+ Router: () => Router,
29
+ router_cache: () => import_routing2.router_cache
30
+ });
31
+ module.exports = __toCommonJS(runtime_exports);
32
+ var import_jsx_runtime = require("react/jsx-runtime");
33
+ var import_client = __toESM(require("./client"));
34
+ var import_manifest = __toESM(require("./manifest"));
35
+ var import_routing = require("./routing");
36
+ __reExport(runtime_exports, require("./hooks"), module.exports);
37
+ var import_routing2 = require("./routing");
38
+ function Router({
39
+ cache,
40
+ initialURL,
41
+ artifact_cache,
42
+ component_cache,
43
+ data_cache,
44
+ pending_cache,
45
+ last_variables,
46
+ session,
47
+ assetPrefix,
48
+ injectToStream
49
+ }) {
50
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
51
+ import_routing.RouterContextProvider,
52
+ {
53
+ client: (0, import_client.default)(),
54
+ cache,
55
+ artifact_cache,
56
+ component_cache,
57
+ data_cache,
58
+ pending_cache,
59
+ last_variables,
60
+ session,
61
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
62
+ import_routing.Router,
63
+ {
64
+ initialURL,
65
+ manifest: import_manifest.default,
66
+ assetPrefix,
67
+ injectToStream
68
+ }
69
+ )
70
+ }
71
+ );
72
+ }
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ Router,
76
+ router_cache
77
+ });
@@ -0,0 +1,3 @@
1
+ import type { RouterManifest } from '$houdini/runtime/lib/types';
2
+ declare const manifest: RouterManifest;
3
+ export default manifest;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var manifest_exports = {};
20
+ __export(manifest_exports, {
21
+ default: () => manifest_default
22
+ });
23
+ module.exports = __toCommonJS(manifest_exports);
24
+ const manifest = {};
25
+ var manifest_default = manifest;
26
+ // Annotate the CommonJS export names for ESM import in node:
27
+ 0 && (module.exports = {});
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,67 @@
1
+ import type { Cache } from '$houdini/runtime/cache/cache';
2
+ import { DocumentStore, HoudiniClient } from '$houdini/runtime/client';
3
+ import { LRUCache } from '$houdini/runtime/lib/lru';
4
+ import { GraphQLObject, GraphQLVariables } from '$houdini/runtime/lib/types';
5
+ import { QueryArtifact } from '$houdini/runtime/lib/types';
6
+ import type { RouterManifest } from '$houdini/runtime/router/types';
7
+ import React from 'react';
8
+ import { SuspenseCache } from './cache';
9
+ type ComponentType = any;
10
+ /**
11
+ * Router is the top level entry point for the filesystem-based router.
12
+ * It is responsible for loading various page sources (including API fetches) and
13
+ * then rendering when appropriate.
14
+ */
15
+ export declare function Router({ manifest, initialURL, assetPrefix, injectToStream, }: {
16
+ manifest: RouterManifest<ComponentType>;
17
+ initialURL?: string;
18
+ assetPrefix: string;
19
+ injectToStream?: undefined | ((chunk: string) => void);
20
+ }): JSX.Element;
21
+ export declare function RouterContextProvider({ children, client, cache, artifact_cache, component_cache, data_cache, pending_cache, last_variables, session: ssrSession, }: {
22
+ children: React.ReactElement;
23
+ client: HoudiniClient;
24
+ cache: Cache;
25
+ artifact_cache: SuspenseCache<QueryArtifact>;
26
+ component_cache: SuspenseCache<(props: any) => React.ReactElement>;
27
+ data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
28
+ pending_cache: PendingCache;
29
+ last_variables: LRUCache<GraphQLVariables>;
30
+ session?: App.Session;
31
+ }): JSX.Element;
32
+ type RouterContext = {
33
+ client: HoudiniClient;
34
+ cache: Cache;
35
+ artifact_cache: SuspenseCache<QueryArtifact>;
36
+ component_cache: SuspenseCache<(props: any) => React.ReactElement>;
37
+ data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
38
+ pending_cache: PendingCache;
39
+ last_variables: LRUCache<GraphQLVariables>;
40
+ session: App.Session;
41
+ };
42
+ export type PendingCache = SuspenseCache<Promise<void> & {
43
+ resolve: () => void;
44
+ reject: () => void;
45
+ }>;
46
+ export declare const useRouterContext: () => RouterContext;
47
+ export declare function useClient(): HoudiniClient;
48
+ export declare function useCache(): Cache;
49
+ export declare function updateLocalSession(session: App.Session): void;
50
+ export declare function useSession(): App.Session;
51
+ export declare function useCurrentVariables(): GraphQLVariables;
52
+ export declare function useQueryResult<_Data extends GraphQLObject, _Input extends GraphQLVariables>(name: string): [_Data | null, DocumentStore<_Data, _Input>];
53
+ export type RouterCache = {
54
+ artifact_cache: SuspenseCache<QueryArtifact>;
55
+ component_cache: SuspenseCache<(props: any) => React.ReactElement>;
56
+ data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
57
+ last_variables: LRUCache<GraphQLVariables>;
58
+ pending_cache: PendingCache;
59
+ };
60
+ export declare function router_cache({ pending_queries, artifacts, components, initialData, initialArtifacts, }?: {
61
+ pending_queries?: string[];
62
+ artifacts?: Record<string, QueryArtifact>;
63
+ components?: Record<string, (props: any) => React.ReactElement>;
64
+ initialData?: Record<string, DocumentStore<GraphQLObject, GraphQLVariables>>;
65
+ initialArtifacts?: Record<string, QueryArtifact>;
66
+ }): RouterCache;
67
+ export {};