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

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,67 +0,0 @@
1
- import { deepEquals } from "$houdini/runtime/lib/deepEquals";
2
- import { fragmentKey } from "$houdini/runtime/lib/types";
3
- import * as React from "react";
4
- import { useRouterContext } from "../routing";
5
- import { useDeepCompareMemoize } from "./useDeepCompareEffect";
6
- import { useDocumentSubscription } from "./useDocumentSubscription";
7
- function useFragment(reference, document) {
8
- const { cache } = useRouterContext();
9
- const { parent, variables, loading } = fragmentReference(
10
- reference,
11
- document
12
- );
13
- let cachedValue = reference;
14
- if (reference && parent) {
15
- cachedValue = cache.read({
16
- selection: document.artifact.selection,
17
- parent,
18
- variables,
19
- loading
20
- }).data;
21
- }
22
- const [storeValue] = useDocumentSubscription({
23
- artifact: document.artifact,
24
- variables,
25
- initialValue: cachedValue,
26
- // dont subscribe to anything if we are loading
27
- disabled: loading,
28
- send: {
29
- stuff: {
30
- parentID: parent
31
- },
32
- setup: true
33
- }
34
- });
35
- const lastReference = React.useRef(null);
36
- return React.useMemo(() => {
37
- const parentChange = storeValue.parent !== parent || !deepEquals({ parent, variables }, lastReference.current);
38
- if (parentChange) {
39
- lastReference.current = { parent, variables: { ...variables } };
40
- return cachedValue;
41
- }
42
- return storeValue.data;
43
- }, [
44
- useDeepCompareMemoize({
45
- parent,
46
- variables,
47
- cachedValue,
48
- storeValue: storeValue.data,
49
- storeParent: storeValue.parent
50
- })
51
- ]);
52
- }
53
- function fragmentReference(reference, document) {
54
- const { variables, parent } = reference?.[fragmentKey]?.values?.[document.artifact.name] ?? {};
55
- if (reference && fragmentKey in reference && (!variables || !parent)) {
56
- console.warn(
57
- `\u26A0\uFE0F Parent does not contain the information for this fragment. Something is wrong.
58
- Please ensure that you have passed a record that has ${document.artifact.name} mixed into it.`
59
- );
60
- }
61
- const loading = Boolean(reference?.[fragmentKey]?.loading);
62
- return { variables, parent, loading };
63
- }
64
- export {
65
- fragmentReference,
66
- useFragment
67
- };
@@ -1,8 +0,0 @@
1
- import type { GraphQLObject, FragmentArtifact, QueryArtifact, fragmentKey, GraphQLVariables } from '$houdini/runtime/lib/types';
2
- import { type DocumentHandle } from './useDocumentHandle';
3
- export declare function useFragmentHandle<_Artifact extends FragmentArtifact, _Data extends GraphQLObject, _ReferenceType extends {}, _PaginationArtifact extends QueryArtifact, _Input extends GraphQLVariables = GraphQLVariables>(reference: _Data | {
4
- [fragmentKey]: _ReferenceType;
5
- } | null, document: {
6
- artifact: FragmentArtifact;
7
- refetchArtifact?: QueryArtifact;
8
- }): DocumentHandle<_PaginationArtifact, _Data, _Input>;
@@ -1,23 +0,0 @@
1
- import { useDocumentHandle } from "./useDocumentHandle";
2
- import { useDocumentStore } from "./useDocumentStore";
3
- import { fragmentReference, useFragment } from "./useFragment";
4
- function useFragmentHandle(reference, document) {
5
- const data = useFragment(reference, document);
6
- const { variables } = fragmentReference(reference, document);
7
- const [handleValue, handleObserver] = useDocumentStore({
8
- artifact: document.refetchArtifact ?? document.artifact
9
- });
10
- const handle = useDocumentHandle({
11
- observer: handleObserver,
12
- storeValue: handleValue,
13
- artifact: document.refetchArtifact ?? document.artifact
14
- });
15
- return {
16
- ...handle,
17
- variables,
18
- data
19
- };
20
- }
21
- export {
22
- useFragmentHandle
23
- };
@@ -1,3 +0,0 @@
1
- export declare function useIsMountedRef(): {
2
- current: boolean;
3
- };
@@ -1,14 +0,0 @@
1
- import { useRef, useEffect } from "react";
2
- function useIsMountedRef() {
3
- const isMountedRef = useRef(true);
4
- useEffect(() => {
5
- isMountedRef.current = true;
6
- return () => {
7
- isMountedRef.current = false;
8
- };
9
- }, []);
10
- return isMountedRef;
11
- }
12
- export {
13
- useIsMountedRef
14
- };
@@ -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,42 +0,0 @@
1
- import { useSession } from "../routing/hooks";
2
- import { useDocumentStore } from "./useDocumentStore";
3
- function useMutation({
4
- artifact
5
- }) {
6
- const [storeValue, observer] = useDocumentStore({ artifact });
7
- const pending = storeValue.fetching;
8
- const [session] = useSession();
9
- const mutate = async ({
10
- metadata,
11
- fetch,
12
- variables,
13
- abortController,
14
- ...mutationConfig
15
- }) => {
16
- const result = await observer.send({
17
- variables,
18
- metadata,
19
- session,
20
- abortController,
21
- stuff: {
22
- ...mutationConfig
23
- }
24
- });
25
- if (result.errors && result.errors?.length > 0) {
26
- const err = new RuntimeGraphQLError(
27
- result.errors.map((error) => error.message).join(". ")
28
- );
29
- err.raw = result.errors;
30
- throw err;
31
- }
32
- return result;
33
- };
34
- return [pending, mutate];
35
- }
36
- class RuntimeGraphQLError extends Error {
37
- raw = [];
38
- }
39
- export {
40
- RuntimeGraphQLError,
41
- useMutation
42
- };
@@ -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,8 +0,0 @@
1
- import { useQueryHandle } from "./useQueryHandle";
2
- function useQuery(document, variables = null, config = {}) {
3
- const { data } = useQueryHandle(document, variables, config);
4
- return data;
5
- }
6
- export {
7
- useQuery
8
- };
@@ -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,97 +0,0 @@
1
- import { createLRUCache } from "$houdini/runtime/lib/lru";
2
- import React from "react";
3
- import { useClient } from "../routing";
4
- import { useDocumentHandle } from "./useDocumentHandle";
5
- import { useIsMountedRef } from "./useIsMounted";
6
- const promiseCache = createLRUCache();
7
- function useQueryHandle({ artifact }, variables = null, config = {}) {
8
- const identifier = queryIdentifier({ artifact, variables, config });
9
- const suspenseValue = promiseCache.get(identifier);
10
- const client = useClient();
11
- const isMountedRef = useIsMountedRef();
12
- let [observer] = React.useState(
13
- client.observe({
14
- artifact,
15
- initialValue: suspenseValue?.resolved?.data ?? {}
16
- })
17
- );
18
- const suspenseTracker = React.useRef(false);
19
- const box = React.useRef(observer.state);
20
- const subscribe = React.useCallback(
21
- (fn) => {
22
- return observer.subscribe((val) => {
23
- box.current = val;
24
- if (isMountedRef.current && !suspenseTracker.current) {
25
- fn();
26
- }
27
- });
28
- },
29
- [observer]
30
- );
31
- const storeValue = React.useSyncExternalStore(subscribe, () => box.current);
32
- const handle = useDocumentHandle({
33
- artifact,
34
- observer,
35
- storeValue
36
- });
37
- React.useEffect(() => {
38
- return () => {
39
- promiseCache.delete(identifier);
40
- };
41
- }, [identifier]);
42
- React.useEffect(() => {
43
- return () => {
44
- observer.cleanup();
45
- };
46
- }, [observer]);
47
- let result = storeValue.data;
48
- if (!suspenseValue) {
49
- let resolve = () => {
50
- };
51
- const loadPromise = new Promise((r) => resolve = r);
52
- const suspenseUnit = {
53
- then: loadPromise.then.bind(loadPromise),
54
- resolve,
55
- // @ts-ignore
56
- variables
57
- };
58
- promiseCache.set(identifier, suspenseUnit);
59
- handle.fetch({
60
- variables,
61
- // @ts-ignore: this is actually allowed... 🤫
62
- stuff: {
63
- silenceLoading: true
64
- }
65
- }).then((value) => {
66
- suspenseUnit.resolved = {
67
- ...handle,
68
- data: value.data,
69
- partia: value.partial,
70
- artifact
71
- };
72
- suspenseUnit.resolve();
73
- });
74
- suspenseTracker.current = true;
75
- throw suspenseUnit;
76
- }
77
- if (!result && suspenseValue && !suspenseValue.resolved) {
78
- suspenseTracker.current = true;
79
- throw suspenseValue;
80
- }
81
- if (!result && suspenseValue?.resolved) {
82
- return suspenseValue.resolved;
83
- }
84
- return {
85
- ...handle,
86
- variables: storeValue.variables,
87
- data: result
88
- };
89
- }
90
- function queryIdentifier(args) {
91
- args.fetchKey ??= 0;
92
- const { artifact, variables, fetchKey } = args;
93
- return [artifact.name, JSON.stringify(variables), fetchKey].join("@@");
94
- }
95
- export {
96
- useQueryHandle
97
- };
@@ -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,8 +0,0 @@
1
- import { useSubscriptionHandle } from "./useSubscriptionHandle";
2
- function useSubscription(document, variables) {
3
- const { data } = useSubscriptionHandle(document, variables);
4
- return data;
5
- }
6
- export {
7
- useSubscription
8
- };
@@ -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,18 +0,0 @@
1
- import { useDocumentSubscription } from "./useDocumentSubscription";
2
- function useSubscriptionHandle({ artifact }, variables) {
3
- const [storeValue, observer] = useDocumentSubscription({
4
- artifact,
5
- variables
6
- });
7
- return {
8
- data: storeValue.data,
9
- errors: storeValue.errors,
10
- fetching: storeValue.fetching,
11
- variables,
12
- unlisten: observer.cleanup,
13
- listen: observer.send
14
- };
15
- }
16
- export {
17
- useSubscriptionHandle
18
- };
@@ -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,48 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import client from "./client";
3
- import manifest from "./manifest";
4
- import { Router as RouterImpl, RouterContextProvider } from "./routing";
5
- export * from "./hooks";
6
- import { router_cache, useSession, useLocation, useRoute } from "./routing";
7
- function Router({
8
- cache,
9
- initialURL,
10
- artifact_cache,
11
- component_cache,
12
- data_cache,
13
- ssr_signals,
14
- last_variables,
15
- session,
16
- assetPrefix,
17
- injectToStream
18
- }) {
19
- return /* @__PURE__ */ jsx(
20
- RouterContextProvider,
21
- {
22
- client: client(),
23
- cache,
24
- artifact_cache,
25
- component_cache,
26
- data_cache,
27
- ssr_signals,
28
- last_variables,
29
- session,
30
- children: /* @__PURE__ */ jsx(
31
- RouterImpl,
32
- {
33
- initialURL,
34
- manifest,
35
- assetPrefix,
36
- injectToStream
37
- }
38
- )
39
- }
40
- );
41
- }
42
- export {
43
- Router,
44
- router_cache,
45
- useLocation,
46
- useRoute,
47
- useSession
48
- };
@@ -1,3 +0,0 @@
1
- import type { RouterManifest } from '$houdini/runtime/lib/types';
2
- declare const manifest: RouterManifest;
3
- export default manifest;
@@ -1,5 +0,0 @@
1
- const manifest = {};
2
- var manifest_default = manifest;
3
- export {
4
- manifest_default as default
5
- };
@@ -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 {};