houdini-react 2.0.0-next.3 → 2.0.0-next.30

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 (171) hide show
  1. package/bin/houdini-react +173 -0
  2. package/package.json +63 -39
  3. package/postInstall.js +360 -0
  4. package/runtime/client.ts +5 -0
  5. package/runtime/clientPlugin.ts +17 -0
  6. package/runtime/componentFields.ts +79 -0
  7. package/runtime/hooks/index.ts +9 -0
  8. package/runtime/hooks/useDeepCompareEffect.ts +91 -0
  9. package/runtime/hooks/useDocumentHandle.ts +232 -0
  10. package/runtime/hooks/useDocumentStore.ts +76 -0
  11. package/runtime/hooks/useDocumentSubscription.ts +62 -0
  12. package/runtime/hooks/useFragment.ts +93 -0
  13. package/runtime/hooks/useFragmentHandle.ts +46 -0
  14. package/runtime/hooks/useIsMounted.ts +14 -0
  15. package/runtime/hooks/useMutation.ts +70 -0
  16. package/runtime/hooks/useQuery.ts +12 -0
  17. package/runtime/hooks/useQueryHandle.ts +186 -0
  18. package/runtime/hooks/useSubscription.ts +12 -0
  19. package/runtime/hooks/useSubscriptionHandle.ts +33 -0
  20. package/runtime/hydration.tsx +155 -0
  21. package/runtime/index.tsx +49 -0
  22. package/runtime/manifest.ts +6 -0
  23. package/runtime/package.json +1 -0
  24. package/runtime/routing/Router.tsx +885 -0
  25. package/runtime/routing/cache.ts +54 -0
  26. package/runtime/routing/index.ts +2 -0
  27. package/server/index.d.ts +1 -0
  28. package/server/index.js +4 -0
  29. package/server/react-streaming.d.js +0 -0
  30. package/vite/index.d.ts +3 -0
  31. package/vite/index.js +286 -0
  32. package/vite/transform.d.ts +11 -0
  33. package/vite/transform.js +90 -0
  34. package/README.md +0 -36
  35. package/build/plugin/codegen/entries/documentWrappers.d.ts +0 -6
  36. package/build/plugin/codegen/entries/fallbacks.d.ts +0 -5
  37. package/build/plugin/codegen/entries/index.d.ts +0 -16
  38. package/build/plugin/codegen/entries/pages.d.ts +0 -2
  39. package/build/plugin/codegen/index.d.ts +0 -17
  40. package/build/plugin/codegen/manifest.d.ts +0 -5
  41. package/build/plugin/codegen/render.d.ts +0 -7
  42. package/build/plugin/codegen/router.d.ts +0 -7
  43. package/build/plugin/codegen/typeRoot.d.ts +0 -5
  44. package/build/plugin/config.d.ts +0 -4
  45. package/build/plugin/dedent.d.ts +0 -1
  46. package/build/plugin/extract.d.ts +0 -6
  47. package/build/plugin/index.d.ts +0 -5
  48. package/build/plugin/state.d.ts +0 -3
  49. package/build/plugin/transform.d.ts +0 -6
  50. package/build/plugin/vite.d.ts +0 -27
  51. package/build/plugin-cjs/index.js +0 -90119
  52. package/build/plugin-cjs/package.json +0 -1
  53. package/build/plugin-esm/index.js +0 -90115
  54. package/build/runtime/client.d.ts +0 -3
  55. package/build/runtime/clientPlugin.d.ts +0 -3
  56. package/build/runtime/componentFields.d.ts +0 -9
  57. package/build/runtime/hooks/index.d.ts +0 -8
  58. package/build/runtime/hooks/useDeepCompareEffect.d.ts +0 -35
  59. package/build/runtime/hooks/useDocumentHandle.d.ts +0 -36
  60. package/build/runtime/hooks/useDocumentStore.d.ts +0 -11
  61. package/build/runtime/hooks/useDocumentSubscription.d.ts +0 -11
  62. package/build/runtime/hooks/useFragment.d.ts +0 -16
  63. package/build/runtime/hooks/useFragmentHandle.d.ts +0 -8
  64. package/build/runtime/hooks/useIsMounted.d.ts +0 -3
  65. package/build/runtime/hooks/useMutation.d.ts +0 -14
  66. package/build/runtime/hooks/useQuery.d.ts +0 -5
  67. package/build/runtime/hooks/useQueryHandle.d.ts +0 -10
  68. package/build/runtime/hooks/useSubscription.d.ts +0 -4
  69. package/build/runtime/hooks/useSubscriptionHandle.d.ts +0 -25
  70. package/build/runtime/index.d.ts +0 -14
  71. package/build/runtime/manifest.d.ts +0 -3
  72. package/build/runtime/routing/Router.d.ts +0 -62
  73. package/build/runtime/routing/cache.d.ts +0 -7
  74. package/build/runtime/routing/hooks.d.ts +0 -40
  75. package/build/runtime/routing/index.d.ts +0 -3
  76. package/build/runtime-cjs/client.d.ts +0 -3
  77. package/build/runtime-cjs/client.js +0 -25
  78. package/build/runtime-cjs/clientPlugin.d.ts +0 -3
  79. package/build/runtime-cjs/clientPlugin.js +0 -37
  80. package/build/runtime-cjs/componentFields.d.ts +0 -9
  81. package/build/runtime-cjs/componentFields.js +0 -83
  82. package/build/runtime-cjs/hooks/index.d.ts +0 -8
  83. package/build/runtime-cjs/hooks/index.js +0 -45
  84. package/build/runtime-cjs/hooks/useDeepCompareEffect.d.ts +0 -35
  85. package/build/runtime-cjs/hooks/useDeepCompareEffect.js +0 -76
  86. package/build/runtime-cjs/hooks/useDocumentHandle.d.ts +0 -36
  87. package/build/runtime-cjs/hooks/useDocumentHandle.js +0 -177
  88. package/build/runtime-cjs/hooks/useDocumentStore.d.ts +0 -11
  89. package/build/runtime-cjs/hooks/useDocumentStore.js +0 -76
  90. package/build/runtime-cjs/hooks/useDocumentSubscription.d.ts +0 -11
  91. package/build/runtime-cjs/hooks/useDocumentSubscription.js +0 -76
  92. package/build/runtime-cjs/hooks/useFragment.d.ts +0 -16
  93. package/build/runtime-cjs/hooks/useFragment.js +0 -102
  94. package/build/runtime-cjs/hooks/useFragmentHandle.d.ts +0 -8
  95. package/build/runtime-cjs/hooks/useFragmentHandle.js +0 -47
  96. package/build/runtime-cjs/hooks/useIsMounted.d.ts +0 -3
  97. package/build/runtime-cjs/hooks/useIsMounted.js +0 -38
  98. package/build/runtime-cjs/hooks/useMutation.d.ts +0 -14
  99. package/build/runtime-cjs/hooks/useMutation.js +0 -67
  100. package/build/runtime-cjs/hooks/useQuery.d.ts +0 -5
  101. package/build/runtime-cjs/hooks/useQuery.js +0 -32
  102. package/build/runtime-cjs/hooks/useQueryHandle.d.ts +0 -10
  103. package/build/runtime-cjs/hooks/useQueryHandle.js +0 -131
  104. package/build/runtime-cjs/hooks/useSubscription.d.ts +0 -4
  105. package/build/runtime-cjs/hooks/useSubscription.js +0 -32
  106. package/build/runtime-cjs/hooks/useSubscriptionHandle.d.ts +0 -25
  107. package/build/runtime-cjs/hooks/useSubscriptionHandle.js +0 -42
  108. package/build/runtime-cjs/index.d.ts +0 -14
  109. package/build/runtime-cjs/index.js +0 -88
  110. package/build/runtime-cjs/manifest.d.ts +0 -3
  111. package/build/runtime-cjs/manifest.js +0 -25
  112. package/build/runtime-cjs/package.json +0 -1
  113. package/build/runtime-cjs/routing/Router.d.ts +0 -62
  114. package/build/runtime-cjs/routing/Router.js +0 -540
  115. package/build/runtime-cjs/routing/cache.d.ts +0 -7
  116. package/build/runtime-cjs/routing/cache.js +0 -61
  117. package/build/runtime-cjs/routing/hooks.d.ts +0 -40
  118. package/build/runtime-cjs/routing/hooks.js +0 -93
  119. package/build/runtime-cjs/routing/index.d.ts +0 -3
  120. package/build/runtime-cjs/routing/index.js +0 -33
  121. package/build/runtime-esm/client.d.ts +0 -3
  122. package/build/runtime-esm/client.js +0 -5
  123. package/build/runtime-esm/clientPlugin.d.ts +0 -3
  124. package/build/runtime-esm/clientPlugin.js +0 -17
  125. package/build/runtime-esm/componentFields.d.ts +0 -9
  126. package/build/runtime-esm/componentFields.js +0 -59
  127. package/build/runtime-esm/hooks/index.d.ts +0 -8
  128. package/build/runtime-esm/hooks/index.js +0 -15
  129. package/build/runtime-esm/hooks/useDeepCompareEffect.d.ts +0 -35
  130. package/build/runtime-esm/hooks/useDeepCompareEffect.js +0 -41
  131. package/build/runtime-esm/hooks/useDocumentHandle.d.ts +0 -36
  132. package/build/runtime-esm/hooks/useDocumentHandle.js +0 -143
  133. package/build/runtime-esm/hooks/useDocumentStore.d.ts +0 -11
  134. package/build/runtime-esm/hooks/useDocumentStore.js +0 -42
  135. package/build/runtime-esm/hooks/useDocumentSubscription.d.ts +0 -11
  136. package/build/runtime-esm/hooks/useDocumentSubscription.js +0 -42
  137. package/build/runtime-esm/hooks/useFragment.d.ts +0 -16
  138. package/build/runtime-esm/hooks/useFragment.js +0 -67
  139. package/build/runtime-esm/hooks/useFragmentHandle.d.ts +0 -8
  140. package/build/runtime-esm/hooks/useFragmentHandle.js +0 -23
  141. package/build/runtime-esm/hooks/useIsMounted.d.ts +0 -3
  142. package/build/runtime-esm/hooks/useIsMounted.js +0 -14
  143. package/build/runtime-esm/hooks/useMutation.d.ts +0 -14
  144. package/build/runtime-esm/hooks/useMutation.js +0 -42
  145. package/build/runtime-esm/hooks/useQuery.d.ts +0 -5
  146. package/build/runtime-esm/hooks/useQuery.js +0 -8
  147. package/build/runtime-esm/hooks/useQueryHandle.d.ts +0 -10
  148. package/build/runtime-esm/hooks/useQueryHandle.js +0 -97
  149. package/build/runtime-esm/hooks/useSubscription.d.ts +0 -4
  150. package/build/runtime-esm/hooks/useSubscription.js +0 -8
  151. package/build/runtime-esm/hooks/useSubscriptionHandle.d.ts +0 -25
  152. package/build/runtime-esm/hooks/useSubscriptionHandle.js +0 -18
  153. package/build/runtime-esm/index.d.ts +0 -14
  154. package/build/runtime-esm/index.js +0 -48
  155. package/build/runtime-esm/manifest.d.ts +0 -3
  156. package/build/runtime-esm/manifest.js +0 -5
  157. package/build/runtime-esm/routing/Router.d.ts +0 -62
  158. package/build/runtime-esm/routing/Router.js +0 -499
  159. package/build/runtime-esm/routing/cache.d.ts +0 -7
  160. package/build/runtime-esm/routing/cache.js +0 -36
  161. package/build/runtime-esm/routing/hooks.d.ts +0 -40
  162. package/build/runtime-esm/routing/hooks.js +0 -53
  163. package/build/runtime-esm/routing/index.d.ts +0 -3
  164. package/build/runtime-esm/routing/index.js +0 -6
  165. package/build/server/index.d.ts +0 -1
  166. package/build/server-cjs/index.js +0 -28
  167. package/build/server-cjs/package.json +0 -1
  168. package/build/server-esm/index.js +0 -4
  169. package/build/server-esm/package.json +0 -1
  170. /package/{build/plugin-esm → server}/package.json +0 -0
  171. /package/{build/runtime-esm → vite}/package.json +0 -0
@@ -1,38 +0,0 @@
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
- });
@@ -1,14 +0,0 @@
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
- abortController?: AbortController;
8
- }) => Promise<QueryResult<_Result, _Input>>;
9
- export declare function useMutation<_Result extends GraphQLObject, _Input extends GraphQLVariables, _Optimistic extends GraphQLObject>({ artifact, }: {
10
- artifact: MutationArtifact;
11
- }): [boolean, MutationHandler<_Result, _Input, _Optimistic>];
12
- export declare class RuntimeGraphQLError extends Error {
13
- raw: QueryResult['errors'];
14
- }
@@ -1,67 +0,0 @@
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
- RuntimeGraphQLError: () => RuntimeGraphQLError,
22
- useMutation: () => useMutation
23
- });
24
- module.exports = __toCommonJS(useMutation_exports);
25
- var import_hooks = require("../routing/hooks");
26
- var import_useDocumentStore = require("./useDocumentStore");
27
- function useMutation({
28
- artifact
29
- }) {
30
- const [storeValue, observer] = (0, import_useDocumentStore.useDocumentStore)({ artifact });
31
- const pending = storeValue.fetching;
32
- const [session] = (0, import_hooks.useSession)();
33
- const mutate = async ({
34
- metadata,
35
- fetch,
36
- variables,
37
- abortController,
38
- ...mutationConfig
39
- }) => {
40
- const result = await observer.send({
41
- variables,
42
- metadata,
43
- session,
44
- abortController,
45
- stuff: {
46
- ...mutationConfig
47
- }
48
- });
49
- if (result.errors && result.errors?.length > 0) {
50
- const err = new RuntimeGraphQLError(
51
- result.errors.map((error) => error.message).join(". ")
52
- );
53
- err.raw = result.errors;
54
- throw err;
55
- }
56
- return result;
57
- };
58
- return [pending, mutate];
59
- }
60
- class RuntimeGraphQLError extends Error {
61
- raw = [];
62
- }
63
- // Annotate the CommonJS export names for ESM import in node:
64
- 0 && (module.exports = {
65
- RuntimeGraphQLError,
66
- useMutation
67
- });
@@ -1,5 +0,0 @@
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;
@@ -1,32 +0,0 @@
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
- });
@@ -1,10 +0,0 @@
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
- };
@@ -1,131 +0,0 @@
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
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var useQueryHandle_exports = {};
30
- __export(useQueryHandle_exports, {
31
- useQueryHandle: () => useQueryHandle
32
- });
33
- module.exports = __toCommonJS(useQueryHandle_exports);
34
- var import_lru = require("$houdini/runtime/lib/lru");
35
- var import_react = __toESM(require("react"));
36
- var import_routing = require("../routing");
37
- var import_useDocumentHandle = require("./useDocumentHandle");
38
- var import_useIsMounted = require("./useIsMounted");
39
- const promiseCache = (0, import_lru.createLRUCache)();
40
- function useQueryHandle({ artifact }, variables = null, config = {}) {
41
- const identifier = queryIdentifier({ artifact, variables, config });
42
- const suspenseValue = promiseCache.get(identifier);
43
- const client = (0, import_routing.useClient)();
44
- const isMountedRef = (0, import_useIsMounted.useIsMountedRef)();
45
- let [observer] = import_react.default.useState(
46
- client.observe({
47
- artifact,
48
- initialValue: suspenseValue?.resolved?.data ?? {}
49
- })
50
- );
51
- const suspenseTracker = import_react.default.useRef(false);
52
- const box = import_react.default.useRef(observer.state);
53
- const subscribe = import_react.default.useCallback(
54
- (fn) => {
55
- return observer.subscribe((val) => {
56
- box.current = val;
57
- if (isMountedRef.current && !suspenseTracker.current) {
58
- fn();
59
- }
60
- });
61
- },
62
- [observer]
63
- );
64
- const storeValue = import_react.default.useSyncExternalStore(subscribe, () => box.current);
65
- const handle = (0, import_useDocumentHandle.useDocumentHandle)({
66
- artifact,
67
- observer,
68
- storeValue
69
- });
70
- import_react.default.useEffect(() => {
71
- return () => {
72
- promiseCache.delete(identifier);
73
- };
74
- }, [identifier]);
75
- import_react.default.useEffect(() => {
76
- return () => {
77
- observer.cleanup();
78
- };
79
- }, [observer]);
80
- let result = storeValue.data;
81
- if (!suspenseValue) {
82
- let resolve = () => {
83
- };
84
- const loadPromise = new Promise((r) => resolve = r);
85
- const suspenseUnit = {
86
- then: loadPromise.then.bind(loadPromise),
87
- resolve,
88
- // @ts-ignore
89
- variables
90
- };
91
- promiseCache.set(identifier, suspenseUnit);
92
- handle.fetch({
93
- variables,
94
- // @ts-ignore: this is actually allowed... 🤫
95
- stuff: {
96
- silenceLoading: true
97
- }
98
- }).then((value) => {
99
- suspenseUnit.resolved = {
100
- ...handle,
101
- data: value.data,
102
- partia: value.partial,
103
- artifact
104
- };
105
- suspenseUnit.resolve();
106
- });
107
- suspenseTracker.current = true;
108
- throw suspenseUnit;
109
- }
110
- if (!result && suspenseValue && !suspenseValue.resolved) {
111
- suspenseTracker.current = true;
112
- throw suspenseValue;
113
- }
114
- if (!result && suspenseValue?.resolved) {
115
- return suspenseValue.resolved;
116
- }
117
- return {
118
- ...handle,
119
- variables: storeValue.variables,
120
- data: result
121
- };
122
- }
123
- function queryIdentifier(args) {
124
- args.fetchKey ??= 0;
125
- const { artifact, variables, fetchKey } = args;
126
- return [artifact.name, JSON.stringify(variables), fetchKey].join("@@");
127
- }
128
- // Annotate the CommonJS export names for ESM import in node:
129
- 0 && (module.exports = {
130
- useQueryHandle
131
- });
@@ -1,4 +0,0 @@
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;
@@ -1,32 +0,0 @@
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
- });
@@ -1,25 +0,0 @@
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, abortController, }?: import("$houdini/lib").SendParams) => Promise<import("$houdini/runtime/lib/types").QueryResult<import("houdini").GraphQLObject, _Input>>;
25
- };
@@ -1,42 +0,0 @@
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
- });
@@ -1,14 +0,0 @@
1
- /// <reference types="react" />
2
- import type { GraphQLObject } from '$houdini/lib/types';
3
- import type { Cache } from '$houdini/runtime/cache/cache';
4
- import { RouterCache } from './routing';
5
- export * from './hooks';
6
- export { router_cache, useSession, useLocation, useRoute } from './routing';
7
- export declare function Router({ cache, initialURL, artifact_cache, component_cache, data_cache, ssr_signals, last_variables, session, assetPrefix, injectToStream, }: {
8
- initialURL: string;
9
- initialVariables: GraphQLObject;
10
- cache: Cache;
11
- session?: App.Session;
12
- assetPrefix: string;
13
- injectToStream?: (chunk: string) => void;
14
- } & RouterCache): import("react").JSX.Element;
@@ -1,88 +0,0 @@
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
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
- var index_exports = {};
31
- __export(index_exports, {
32
- Router: () => Router,
33
- router_cache: () => import_routing2.router_cache,
34
- useLocation: () => import_routing2.useLocation,
35
- useRoute: () => import_routing2.useRoute,
36
- useSession: () => import_routing2.useSession
37
- });
38
- module.exports = __toCommonJS(index_exports);
39
- var import_jsx_runtime = require("react/jsx-runtime");
40
- var import_client = __toESM(require("./client"));
41
- var import_manifest = __toESM(require("./manifest"));
42
- var import_routing = require("./routing");
43
- __reExport(index_exports, require("./hooks"), module.exports);
44
- var import_routing2 = require("./routing");
45
- function Router({
46
- cache,
47
- initialURL,
48
- artifact_cache,
49
- component_cache,
50
- data_cache,
51
- ssr_signals,
52
- last_variables,
53
- session,
54
- assetPrefix,
55
- injectToStream
56
- }) {
57
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
58
- import_routing.RouterContextProvider,
59
- {
60
- client: (0, import_client.default)(),
61
- cache,
62
- artifact_cache,
63
- component_cache,
64
- data_cache,
65
- ssr_signals,
66
- last_variables,
67
- session,
68
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
69
- import_routing.Router,
70
- {
71
- initialURL,
72
- manifest: import_manifest.default,
73
- assetPrefix,
74
- injectToStream
75
- }
76
- )
77
- }
78
- );
79
- }
80
- // Annotate the CommonJS export names for ESM import in node:
81
- 0 && (module.exports = {
82
- Router,
83
- router_cache,
84
- useLocation,
85
- useRoute,
86
- useSession,
87
- ...require("./hooks")
88
- });
@@ -1,3 +0,0 @@
1
- import type { RouterManifest } from '$houdini/runtime/lib/types';
2
- declare const manifest: RouterManifest;
3
- export default manifest;
@@ -1,25 +0,0 @@
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;
@@ -1 +0,0 @@
1
- {"type":"commonjs"}
@@ -1,62 +0,0 @@
1
- import type { Cache } from '$houdini/runtime/cache/cache';
2
- import { DocumentStore, HoudiniClient } from '$houdini/runtime/client';
3
- import type { LRUCache } from '$houdini/runtime/lib/lru';
4
- import type { GraphQLObject, GraphQLVariables } from '$houdini/runtime/lib/types';
5
- import type { QueryArtifact } from '$houdini/runtime/lib/types';
6
- import type { RouterManifest } from '$houdini/runtime/router/types';
7
- import React from 'react';
8
- import { type SuspenseCache } from './cache';
9
- import { type DocumentHandle } from '../hooks/useDocumentHandle';
10
- import { type PageComponent, type PendingCache } from './hooks';
11
- type ComponentType = any;
12
- /**
13
- * Router is the top level entry point for the filesystem-based router.
14
- * It is responsible for loading various page sources (including API fetches) and
15
- * then rendering when appropriate.
16
- */
17
- export declare function Router({ manifest, initialURL, assetPrefix, injectToStream, }: {
18
- manifest: RouterManifest<ComponentType>;
19
- initialURL?: string;
20
- assetPrefix: string;
21
- injectToStream?: undefined | ((chunk: string) => void);
22
- }): React.JSX.Element;
23
- export declare function RouterContextProvider({ children, client, cache, artifact_cache, component_cache, data_cache, ssr_signals, last_variables, session: ssrSession, }: {
24
- children: React.ReactNode;
25
- client: HoudiniClient;
26
- cache: Cache;
27
- artifact_cache: SuspenseCache<QueryArtifact>;
28
- component_cache: SuspenseCache<PageComponent>;
29
- data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
30
- ssr_signals: PendingCache;
31
- last_variables: LRUCache<GraphQLVariables>;
32
- session?: App.Session;
33
- }): React.JSX.Element;
34
- export declare function updateLocalSession(session: App.Session): void;
35
- export declare function useCurrentVariables(): GraphQLVariables;
36
- export declare function useQueryResult<_Data extends GraphQLObject, _Input extends GraphQLVariables>(name: string): [_Data | null, DocumentHandle<any, _Data, _Input>];
37
- export type RouterCache = {
38
- artifact_cache: SuspenseCache<QueryArtifact>;
39
- component_cache: SuspenseCache<PageComponent>;
40
- data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
41
- last_variables: LRUCache<GraphQLVariables>;
42
- ssr_signals: PendingCache;
43
- };
44
- export declare function router_cache({ pending_queries, artifacts, components, initialData, initialVariables, initialArtifacts, }?: {
45
- pending_queries?: string[];
46
- artifacts?: Record<string, QueryArtifact>;
47
- components?: Record<string, PageComponent>;
48
- initialData?: Record<string, DocumentStore<GraphQLObject, GraphQLVariables>>;
49
- initialVariables?: Record<string, GraphQLVariables>;
50
- initialArtifacts?: Record<string, QueryArtifact>;
51
- }): RouterCache;
52
- export declare function PageContextProvider({ keys, children, }: {
53
- keys: string[];
54
- children: React.ReactNode;
55
- }): React.JSX.Element;
56
- export declare function useRoute<PageProps extends {
57
- Params: {};
58
- }>(): RouteProp<PageProps['Params']>;
59
- export type RouteProp<Params> = {
60
- params: Params;
61
- };
62
- export {};