houdini-react 1.3.14 → 2.0.0-go.1
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.
- package/package.json +89 -73
- package/shim.cjs +64 -0
- package/LICENSE +0 -21
- package/README.md +0 -36
- package/build/plugin/codegen/entries/documentWrappers.d.ts +0 -6
- package/build/plugin/codegen/entries/fallbacks.d.ts +0 -5
- package/build/plugin/codegen/entries/index.d.ts +0 -16
- package/build/plugin/codegen/entries/pages.d.ts +0 -2
- package/build/plugin/codegen/index.d.ts +0 -17
- package/build/plugin/codegen/manifest.d.ts +0 -5
- package/build/plugin/codegen/render.d.ts +0 -7
- package/build/plugin/codegen/router.d.ts +0 -7
- package/build/plugin/codegen/typeRoot.d.ts +0 -5
- package/build/plugin/config.d.ts +0 -4
- package/build/plugin/dedent.d.ts +0 -1
- package/build/plugin/extract.d.ts +0 -6
- package/build/plugin/index.d.ts +0 -5
- package/build/plugin/state.d.ts +0 -3
- package/build/plugin/transform.d.ts +0 -6
- package/build/plugin/vite.d.ts +0 -70
- package/build/plugin-cjs/index.js +0 -84192
- package/build/plugin-cjs/package.json +0 -1
- package/build/plugin-esm/index.js +0 -84184
- package/build/plugin-esm/package.json +0 -1
- package/build/runtime/client.d.ts +0 -3
- package/build/runtime/clientPlugin.d.ts +0 -3
- package/build/runtime/componentFields.d.ts +0 -9
- package/build/runtime/hooks/index.d.ts +0 -8
- package/build/runtime/hooks/useDeepCompareEffect.d.ts +0 -35
- package/build/runtime/hooks/useDocumentHandle.d.ts +0 -36
- package/build/runtime/hooks/useDocumentStore.d.ts +0 -11
- package/build/runtime/hooks/useDocumentSubscription.d.ts +0 -11
- package/build/runtime/hooks/useFragment.d.ts +0 -16
- package/build/runtime/hooks/useFragmentHandle.d.ts +0 -8
- package/build/runtime/hooks/useIsMounted.d.ts +0 -3
- package/build/runtime/hooks/useMutation.d.ts +0 -11
- package/build/runtime/hooks/useQuery.d.ts +0 -5
- package/build/runtime/hooks/useQueryHandle.d.ts +0 -10
- package/build/runtime/hooks/useSubscription.d.ts +0 -4
- package/build/runtime/hooks/useSubscriptionHandle.d.ts +0 -25
- package/build/runtime/index.d.ts +0 -14
- package/build/runtime/manifest.d.ts +0 -3
- package/build/runtime/routing/Router.d.ts +0 -62
- package/build/runtime/routing/cache.d.ts +0 -7
- package/build/runtime/routing/hooks.d.ts +0 -40
- package/build/runtime/routing/index.d.ts +0 -3
- package/build/runtime-cjs/client.d.ts +0 -3
- package/build/runtime-cjs/client.js +0 -27
- package/build/runtime-cjs/clientPlugin.d.ts +0 -3
- package/build/runtime-cjs/clientPlugin.js +0 -39
- package/build/runtime-cjs/componentFields.d.ts +0 -9
- package/build/runtime-cjs/componentFields.js +0 -83
- package/build/runtime-cjs/hooks/index.d.ts +0 -8
- package/build/runtime-cjs/hooks/index.js +0 -45
- package/build/runtime-cjs/hooks/useDeepCompareEffect.d.ts +0 -35
- package/build/runtime-cjs/hooks/useDeepCompareEffect.js +0 -72
- package/build/runtime-cjs/hooks/useDocumentHandle.d.ts +0 -36
- package/build/runtime-cjs/hooks/useDocumentHandle.js +0 -173
- package/build/runtime-cjs/hooks/useDocumentStore.d.ts +0 -11
- package/build/runtime-cjs/hooks/useDocumentStore.js +0 -72
- package/build/runtime-cjs/hooks/useDocumentSubscription.d.ts +0 -11
- package/build/runtime-cjs/hooks/useDocumentSubscription.js +0 -71
- package/build/runtime-cjs/hooks/useFragment.d.ts +0 -16
- package/build/runtime-cjs/hooks/useFragment.js +0 -97
- package/build/runtime-cjs/hooks/useFragmentHandle.d.ts +0 -8
- package/build/runtime-cjs/hooks/useFragmentHandle.js +0 -47
- package/build/runtime-cjs/hooks/useIsMounted.d.ts +0 -3
- package/build/runtime-cjs/hooks/useIsMounted.js +0 -38
- package/build/runtime-cjs/hooks/useMutation.d.ts +0 -11
- package/build/runtime-cjs/hooks/useMutation.js +0 -52
- package/build/runtime-cjs/hooks/useQuery.d.ts +0 -5
- package/build/runtime-cjs/hooks/useQuery.js +0 -32
- package/build/runtime-cjs/hooks/useQueryHandle.d.ts +0 -10
- package/build/runtime-cjs/hooks/useQueryHandle.js +0 -125
- package/build/runtime-cjs/hooks/useSubscription.d.ts +0 -4
- package/build/runtime-cjs/hooks/useSubscription.js +0 -32
- package/build/runtime-cjs/hooks/useSubscriptionHandle.d.ts +0 -25
- package/build/runtime-cjs/hooks/useSubscriptionHandle.js +0 -42
- package/build/runtime-cjs/index.d.ts +0 -14
- package/build/runtime-cjs/index.js +0 -83
- package/build/runtime-cjs/manifest.d.ts +0 -3
- package/build/runtime-cjs/manifest.js +0 -27
- package/build/runtime-cjs/package.json +0 -1
- package/build/runtime-cjs/routing/Router.d.ts +0 -62
- package/build/runtime-cjs/routing/Router.js +0 -532
- package/build/runtime-cjs/routing/cache.d.ts +0 -7
- package/build/runtime-cjs/routing/cache.js +0 -58
- package/build/runtime-cjs/routing/hooks.d.ts +0 -40
- package/build/runtime-cjs/routing/hooks.js +0 -89
- package/build/runtime-cjs/routing/index.d.ts +0 -3
- package/build/runtime-cjs/routing/index.js +0 -31
- package/build/runtime-esm/client.d.ts +0 -3
- package/build/runtime-esm/client.js +0 -5
- package/build/runtime-esm/clientPlugin.d.ts +0 -3
- package/build/runtime-esm/clientPlugin.js +0 -17
- package/build/runtime-esm/componentFields.d.ts +0 -9
- package/build/runtime-esm/componentFields.js +0 -59
- package/build/runtime-esm/hooks/index.d.ts +0 -8
- package/build/runtime-esm/hooks/index.js +0 -16
- package/build/runtime-esm/hooks/useDeepCompareEffect.d.ts +0 -35
- package/build/runtime-esm/hooks/useDeepCompareEffect.js +0 -41
- package/build/runtime-esm/hooks/useDocumentHandle.d.ts +0 -36
- package/build/runtime-esm/hooks/useDocumentHandle.js +0 -143
- package/build/runtime-esm/hooks/useDocumentStore.d.ts +0 -11
- package/build/runtime-esm/hooks/useDocumentStore.js +0 -42
- package/build/runtime-esm/hooks/useDocumentSubscription.d.ts +0 -11
- package/build/runtime-esm/hooks/useDocumentSubscription.js +0 -41
- package/build/runtime-esm/hooks/useFragment.d.ts +0 -16
- package/build/runtime-esm/hooks/useFragment.js +0 -66
- package/build/runtime-esm/hooks/useFragmentHandle.d.ts +0 -8
- package/build/runtime-esm/hooks/useFragmentHandle.js +0 -23
- package/build/runtime-esm/hooks/useIsMounted.d.ts +0 -3
- package/build/runtime-esm/hooks/useIsMounted.js +0 -14
- package/build/runtime-esm/hooks/useMutation.d.ts +0 -11
- package/build/runtime-esm/hooks/useMutation.js +0 -28
- package/build/runtime-esm/hooks/useQuery.d.ts +0 -5
- package/build/runtime-esm/hooks/useQuery.js +0 -8
- package/build/runtime-esm/hooks/useQueryHandle.d.ts +0 -10
- package/build/runtime-esm/hooks/useQueryHandle.js +0 -95
- package/build/runtime-esm/hooks/useSubscription.d.ts +0 -4
- package/build/runtime-esm/hooks/useSubscription.js +0 -8
- package/build/runtime-esm/hooks/useSubscriptionHandle.d.ts +0 -25
- package/build/runtime-esm/hooks/useSubscriptionHandle.js +0 -18
- package/build/runtime-esm/index.d.ts +0 -14
- package/build/runtime-esm/index.js +0 -48
- package/build/runtime-esm/manifest.d.ts +0 -3
- package/build/runtime-esm/manifest.js +0 -5
- package/build/runtime-esm/package.json +0 -1
- package/build/runtime-esm/routing/Router.d.ts +0 -62
- package/build/runtime-esm/routing/Router.js +0 -495
- package/build/runtime-esm/routing/cache.d.ts +0 -7
- package/build/runtime-esm/routing/cache.js +0 -33
- package/build/runtime-esm/routing/hooks.d.ts +0 -40
- package/build/runtime-esm/routing/hooks.js +0 -53
- package/build/runtime-esm/routing/index.d.ts +0 -3
- package/build/runtime-esm/routing/index.js +0 -6
- package/build/server/index.d.ts +0 -1
- package/build/server-cjs/index.js +0 -28
- package/build/server-cjs/package.json +0 -1
- package/build/server-esm/index.js +0 -4
- package/build/server-esm/package.json +0 -1
|
@@ -1,66 +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
|
-
disabled: loading,
|
|
27
|
-
send: {
|
|
28
|
-
stuff: {
|
|
29
|
-
parentID: parent
|
|
30
|
-
},
|
|
31
|
-
setup: true
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const lastReference = React.useRef(null);
|
|
35
|
-
return React.useMemo(() => {
|
|
36
|
-
const parentChange = storeValue.parent !== parent || !deepEquals({ parent, variables }, lastReference.current);
|
|
37
|
-
if (parentChange) {
|
|
38
|
-
lastReference.current = { parent, variables: { ...variables } };
|
|
39
|
-
return cachedValue;
|
|
40
|
-
}
|
|
41
|
-
return storeValue.data;
|
|
42
|
-
}, [
|
|
43
|
-
useDeepCompareMemoize({
|
|
44
|
-
parent,
|
|
45
|
-
variables,
|
|
46
|
-
cachedValue,
|
|
47
|
-
storeValue: storeValue.data,
|
|
48
|
-
storeParent: storeValue.parent
|
|
49
|
-
})
|
|
50
|
-
]);
|
|
51
|
-
}
|
|
52
|
-
function fragmentReference(reference, document) {
|
|
53
|
-
const { variables, parent } = reference?.[fragmentKey]?.values?.[document.artifact.name] ?? {};
|
|
54
|
-
if (reference && fragmentKey in reference && (!variables || !parent)) {
|
|
55
|
-
console.warn(
|
|
56
|
-
`\u26A0\uFE0F Parent does not contain the information for this fragment. Something is wrong.
|
|
57
|
-
Please ensure that you have passed a record that has ${document.artifact.name} mixed into it.`
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
const loading = Boolean(reference?.[fragmentKey]?.loading);
|
|
61
|
-
return { variables, parent, loading };
|
|
62
|
-
}
|
|
63
|
-
export {
|
|
64
|
-
fragmentReference,
|
|
65
|
-
useFragment
|
|
66
|
-
};
|
|
@@ -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,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,11 +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>];
|
|
@@ -1,28 +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 = ({
|
|
10
|
-
metadata,
|
|
11
|
-
fetch,
|
|
12
|
-
variables,
|
|
13
|
-
abortController,
|
|
14
|
-
...mutationConfig
|
|
15
|
-
}) => observer.send({
|
|
16
|
-
variables,
|
|
17
|
-
metadata,
|
|
18
|
-
session,
|
|
19
|
-
abortController,
|
|
20
|
-
stuff: {
|
|
21
|
-
...mutationConfig
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
return [pending, mutate];
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
useMutation
|
|
28
|
-
};
|
|
@@ -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,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,95 +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
|
-
variables
|
|
56
|
-
};
|
|
57
|
-
promiseCache.set(identifier, suspenseUnit);
|
|
58
|
-
handle.fetch({
|
|
59
|
-
variables,
|
|
60
|
-
stuff: {
|
|
61
|
-
silenceLoading: true
|
|
62
|
-
}
|
|
63
|
-
}).then((value) => {
|
|
64
|
-
suspenseUnit.resolved = {
|
|
65
|
-
...handle,
|
|
66
|
-
data: value.data,
|
|
67
|
-
partia: value.partial,
|
|
68
|
-
artifact
|
|
69
|
-
};
|
|
70
|
-
suspenseUnit.resolve();
|
|
71
|
-
});
|
|
72
|
-
suspenseTracker.current = true;
|
|
73
|
-
throw suspenseUnit;
|
|
74
|
-
}
|
|
75
|
-
if (!result && suspenseValue && !suspenseValue.resolved) {
|
|
76
|
-
suspenseTracker.current = true;
|
|
77
|
-
throw suspenseValue;
|
|
78
|
-
}
|
|
79
|
-
if (!result && suspenseValue?.resolved) {
|
|
80
|
-
return suspenseValue.resolved;
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
...handle,
|
|
84
|
-
variables: storeValue.variables,
|
|
85
|
-
data: result
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
function queryIdentifier(args) {
|
|
89
|
-
args.fetchKey ??= 0;
|
|
90
|
-
const { artifact, variables, fetchKey } = args;
|
|
91
|
-
return [artifact.name, JSON.stringify(variables), fetchKey].join("@@");
|
|
92
|
-
}
|
|
93
|
-
export {
|
|
94
|
-
useQueryHandle
|
|
95
|
-
};
|
|
@@ -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,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 +0,0 @@
|
|
|
1
|
-
{"type":"module"}
|
|
@@ -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 {};
|