houdini-react 1.2.0-react.1 → 1.2.7
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/README.md +1 -1
- package/build/plugin/codegen/entries.d.ts +6 -0
- package/build/plugin/codegen/index.d.ts +14 -0
- package/build/plugin/codegen/manifest.d.ts +42 -0
- package/build/plugin/codegen/render.d.ts +2 -0
- package/build/plugin/codegen/router.d.ts +8 -0
- package/build/plugin/codegen/typeRoot.d.ts +6 -0
- package/build/plugin/config.d.ts +2 -1
- package/build/plugin/conventions.d.ts +24 -0
- package/build/plugin/dedent.d.ts +1 -0
- package/build/plugin/extract.d.ts +1 -1
- package/build/plugin/index.d.ts +16 -3
- package/build/plugin/vite.d.ts +19 -0
- package/build/plugin-cjs/index.js +132171 -43771
- package/build/plugin-esm/index.js +132162 -43765
- package/build/runtime/client.d.ts +3 -0
- package/build/runtime/clientPlugin.d.ts +3 -0
- package/build/runtime/hooks/useDocumentHandle.d.ts +4 -4
- package/build/runtime/hooks/useDocumentStore.d.ts +6 -5
- package/build/runtime/hooks/useDocumentSubscription.d.ts +4 -3
- package/build/runtime/hooks/useFragment.d.ts +3 -2
- package/build/runtime/hooks/useFragmentHandle.d.ts +2 -3
- package/build/runtime/hooks/useMutation.d.ts +2 -2
- package/build/runtime/hooks/useQuery.d.ts +3 -3
- package/build/runtime/hooks/useQueryHandle.d.ts +3 -3
- package/build/runtime/hooks/useSubscription.d.ts +2 -2
- package/build/runtime/hooks/useSubscriptionHandle.d.ts +3 -3
- package/build/runtime/index.d.ts +30 -1
- package/build/runtime/manifest.d.ts +3 -0
- package/build/runtime/routing/components/Link.d.ts +5 -0
- package/build/runtime/routing/components/Router.d.ts +56 -0
- package/build/runtime/routing/components/index.d.ts +2 -0
- package/build/runtime/routing/index.d.ts +3 -0
- package/build/runtime/routing/lib/cache.d.ts +7 -0
- package/build/runtime/routing/lib/match.d.ts +38 -0
- package/build/runtime/routing/lib/types.d.ts +23 -0
- package/build/runtime-cjs/client.d.ts +3 -0
- package/build/runtime-cjs/client.js +26 -0
- package/build/runtime-cjs/clientPlugin.d.ts +3 -0
- package/build/{next-cjs/index.js → runtime-cjs/clientPlugin.js} +15 -26
- package/build/runtime-cjs/hooks/useDocumentHandle.d.ts +4 -4
- package/build/runtime-cjs/hooks/useDocumentHandle.js +11 -7
- package/build/runtime-cjs/hooks/useDocumentStore.d.ts +6 -5
- package/build/runtime-cjs/hooks/useDocumentStore.js +9 -4
- package/build/runtime-cjs/hooks/useDocumentSubscription.d.ts +4 -3
- package/build/runtime-cjs/hooks/useDocumentSubscription.js +15 -8
- package/build/runtime-cjs/hooks/useFragment.d.ts +3 -2
- package/build/runtime-cjs/hooks/useFragment.js +9 -7
- package/build/runtime-cjs/hooks/useFragmentHandle.d.ts +2 -3
- package/build/runtime-cjs/hooks/useMutation.d.ts +2 -2
- package/build/runtime-cjs/hooks/useMutation.js +3 -1
- package/build/runtime-cjs/hooks/useQuery.d.ts +3 -3
- package/build/runtime-cjs/hooks/useQueryHandle.d.ts +3 -3
- package/build/runtime-cjs/hooks/useQueryHandle.js +4 -4
- package/build/runtime-cjs/hooks/useSubscription.d.ts +2 -2
- package/build/runtime-cjs/hooks/useSubscriptionHandle.d.ts +3 -3
- package/build/runtime-cjs/index.d.ts +30 -1
- package/build/runtime-cjs/index.js +89 -3
- package/build/runtime-cjs/manifest.d.ts +3 -0
- package/build/runtime-cjs/manifest.js +27 -0
- package/build/runtime-cjs/routing/components/Link.d.ts +5 -0
- package/build/runtime-cjs/{hooks/useHoudiniClient.js → routing/components/Link.js} +22 -13
- package/build/runtime-cjs/routing/components/Router.d.ts +56 -0
- package/build/runtime-cjs/routing/components/Router.js +296 -0
- package/build/runtime-cjs/routing/components/index.d.ts +2 -0
- package/build/runtime-cjs/{context.js → routing/components/index.js} +15 -19
- package/build/runtime-cjs/routing/index.d.ts +3 -0
- package/build/runtime-cjs/routing/index.js +30 -0
- package/build/runtime-cjs/routing/lib/cache.d.ts +7 -0
- package/build/runtime-cjs/{lib → routing/lib}/cache.js +23 -40
- package/build/runtime-cjs/routing/lib/match.d.ts +38 -0
- package/build/runtime-cjs/routing/lib/match.js +149 -0
- package/build/runtime-cjs/routing/lib/types.d.ts +23 -0
- package/build/runtime-cjs/routing/lib/types.js +16 -0
- package/build/runtime-esm/client.d.ts +3 -0
- package/build/runtime-esm/client.js +4 -0
- package/build/runtime-esm/clientPlugin.d.ts +3 -0
- package/build/runtime-esm/clientPlugin.js +17 -0
- package/build/runtime-esm/hooks/useDocumentHandle.d.ts +4 -4
- package/build/runtime-esm/hooks/useDocumentHandle.js +12 -10
- package/build/runtime-esm/hooks/useDocumentStore.d.ts +6 -5
- package/build/runtime-esm/hooks/useDocumentStore.js +9 -4
- package/build/runtime-esm/hooks/useDocumentSubscription.d.ts +4 -3
- package/build/runtime-esm/hooks/useDocumentSubscription.js +15 -8
- package/build/runtime-esm/hooks/useFragment.d.ts +3 -2
- package/build/runtime-esm/hooks/useFragment.js +9 -7
- package/build/runtime-esm/hooks/useFragmentHandle.d.ts +2 -3
- package/build/runtime-esm/hooks/useMutation.d.ts +2 -2
- package/build/runtime-esm/hooks/useMutation.js +3 -1
- package/build/runtime-esm/hooks/useQuery.d.ts +3 -3
- package/build/runtime-esm/hooks/useQueryHandle.d.ts +3 -3
- package/build/runtime-esm/hooks/useQueryHandle.js +4 -4
- package/build/runtime-esm/hooks/useSubscription.d.ts +2 -2
- package/build/runtime-esm/hooks/useSubscriptionHandle.d.ts +3 -3
- package/build/runtime-esm/index.d.ts +30 -1
- package/build/runtime-esm/index.js +81 -2
- package/build/runtime-esm/manifest.d.ts +3 -0
- package/build/runtime-esm/manifest.js +5 -0
- package/build/runtime-esm/routing/components/Link.d.ts +5 -0
- package/build/runtime-esm/routing/components/Link.js +21 -0
- package/build/runtime-esm/routing/components/Router.d.ts +56 -0
- package/build/runtime-esm/routing/components/Router.js +257 -0
- package/build/runtime-esm/routing/components/index.d.ts +2 -0
- package/build/runtime-esm/routing/components/index.js +9 -0
- package/build/runtime-esm/routing/index.d.ts +3 -0
- package/build/runtime-esm/routing/index.js +5 -0
- package/build/runtime-esm/routing/lib/cache.d.ts +7 -0
- package/build/runtime-esm/routing/lib/cache.js +29 -0
- package/build/runtime-esm/routing/lib/match.d.ts +38 -0
- package/build/runtime-esm/routing/lib/match.js +122 -0
- package/build/runtime-esm/routing/lib/types.d.ts +23 -0
- package/build/runtime-esm/routing/lib/types.js +0 -0
- package/build/server/compat.d.ts +7 -0
- package/build/server/index.d.ts +17 -0
- package/build/server/session.d.ts +3 -0
- package/build/server-cjs/index.js +166712 -0
- package/build/server-esm/index.js +166703 -0
- package/package.json +21 -10
- package/build/next/index.d.ts +0 -2
- package/build/next-esm/index.js +0 -26
- package/build/runtime/context.d.ts +0 -7
- package/build/runtime/hooks/useHoudiniClient.d.ts +0 -2
- package/build/runtime/lib/cache.d.ts +0 -62
- package/build/runtime-cjs/context.d.ts +0 -7
- package/build/runtime-cjs/hooks/useHoudiniClient.d.ts +0 -2
- package/build/runtime-cjs/lib/cache.d.ts +0 -62
- package/build/runtime-esm/context.d.ts +0 -7
- package/build/runtime-esm/context.js +0 -10
- package/build/runtime-esm/hooks/useHoudiniClient.d.ts +0 -2
- package/build/runtime-esm/hooks/useHoudiniClient.js +0 -12
- package/build/runtime-esm/lib/cache.d.ts +0 -62
- package/build/runtime-esm/lib/cache.js +0 -47
- /package/build/{next-cjs → server-cjs}/package.json +0 -0
- /package/build/{next-esm → server-esm}/package.json +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { DocumentStore } from '$houdini/runtime/client';
|
|
2
|
-
import
|
|
3
|
-
export declare function useDocumentHandle<_Artifact extends QueryArtifact, _Data extends GraphQLObject, _Input extends
|
|
1
|
+
import type { DocumentStore } from '$houdini/runtime/client';
|
|
2
|
+
import type { GraphQLObject, GraphQLVariables, CursorHandlers, OffsetHandlers, PageInfo, FetchFn, QueryResult, DocumentArtifact, QueryArtifact } from '$houdini/runtime/lib/types';
|
|
3
|
+
export declare function useDocumentHandle<_Artifact extends QueryArtifact, _Data extends GraphQLObject, _Input extends GraphQLVariables>({ artifact, observer, storeValue, }: {
|
|
4
4
|
artifact: DocumentArtifact;
|
|
5
5
|
observer: DocumentStore<_Data, _Input>;
|
|
6
6
|
storeValue: QueryResult<_Data, _Input>;
|
|
7
7
|
}): DocumentHandle<_Artifact, _Data, _Input> & {
|
|
8
8
|
fetch: FetchFn<_Data, _Input>;
|
|
9
9
|
};
|
|
10
|
-
export type DocumentHandle<_Artifact extends QueryArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends
|
|
10
|
+
export type DocumentHandle<_Artifact extends QueryArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends GraphQLVariables = GraphQLVariables> = {
|
|
11
11
|
data: _Data;
|
|
12
12
|
partial: boolean;
|
|
13
13
|
} & RefetchHandlers<_Artifact, _Data, _Input>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { DocumentArtifact, QueryResult } from '$houdini/lib/types';
|
|
1
|
+
import type { DocumentArtifact, GraphQLVariables, QueryResult } from '$houdini/lib/types';
|
|
2
2
|
import type { DocumentStore, ObserveParams } from '$houdini/runtime/client';
|
|
3
|
-
import { GraphQLObject } from 'houdini';
|
|
4
|
-
export type UseDocumentStoreParams<_Artifact extends DocumentArtifact, _Data extends GraphQLObject> = {
|
|
3
|
+
import type { GraphQLObject } from 'houdini';
|
|
4
|
+
export type UseDocumentStoreParams<_Artifact extends DocumentArtifact, _Data extends GraphQLObject, _Input extends GraphQLVariables> = {
|
|
5
5
|
artifact: _Artifact;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
observer?: DocumentStore<_Data, _Input>;
|
|
7
|
+
} & Partial<ObserveParams<_Data, DocumentArtifact, _Input>>;
|
|
8
|
+
export declare function useDocumentStore<_Data extends GraphQLObject = GraphQLObject, _Input extends GraphQLVariables = GraphQLVariables, _Artifact extends DocumentArtifact = DocumentArtifact>({ artifact, observer: obs, ...observeParams }: UseDocumentStoreParams<_Artifact, _Data, _Input>): [
|
|
8
9
|
QueryResult<_Data, _Input>,
|
|
9
10
|
DocumentStore<_Data, _Input>,
|
|
10
11
|
(store: DocumentStore<_Data, _Input>) => void
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { DocumentArtifact, QueryResult } from '$houdini/lib/types';
|
|
1
|
+
import type { DocumentArtifact, GraphQLVariables, QueryResult } from '$houdini/lib/types';
|
|
2
2
|
import type { DocumentStore, SendParams } from '$houdini/runtime/client';
|
|
3
|
-
import { GraphQLObject } from 'houdini';
|
|
3
|
+
import type { GraphQLObject } from 'houdini';
|
|
4
4
|
import { type UseDocumentStoreParams } from './useDocumentStore';
|
|
5
|
-
export declare function useDocumentSubscription<_Artifact extends DocumentArtifact = DocumentArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends
|
|
5
|
+
export declare function useDocumentSubscription<_Artifact extends DocumentArtifact = DocumentArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends GraphQLVariables = GraphQLVariables>({ artifact, variables, send, disabled, ...observeParams }: UseDocumentStoreParams<_Artifact, _Data, _Input> & {
|
|
6
6
|
variables: _Input;
|
|
7
|
+
disabled?: boolean;
|
|
7
8
|
send?: Partial<SendParams>;
|
|
8
9
|
}): [
|
|
9
10
|
QueryResult<_Data, _Input> & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fragmentKey } from '$houdini/runtime/lib/types';
|
|
2
|
-
import type { GraphQLObject, FragmentArtifact } from '$houdini/runtime/lib/types';
|
|
3
|
-
export declare function useFragment<_Data extends GraphQLObject, _ReferenceType extends {}, _Input extends
|
|
2
|
+
import type { GraphQLObject, GraphQLVariables, FragmentArtifact } from '$houdini/runtime/lib/types';
|
|
3
|
+
export declare function useFragment<_Data extends GraphQLObject, _ReferenceType extends {}, _Input extends GraphQLVariables = GraphQLVariables>(reference: _Data | {
|
|
4
4
|
[fragmentKey]: _ReferenceType;
|
|
5
5
|
} | null, document: {
|
|
6
6
|
artifact: FragmentArtifact;
|
|
@@ -12,4 +12,5 @@ export declare function fragmentReference<_Data extends GraphQLObject, _Input, _
|
|
|
12
12
|
}): {
|
|
13
13
|
variables: _Input;
|
|
14
14
|
parent: string;
|
|
15
|
+
loading: boolean;
|
|
15
16
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { GraphQLObject, FragmentArtifact, QueryArtifact } from '$houdini/runtime/lib/types';
|
|
2
|
-
import { fragmentKey } from '$houdini/runtime/lib/types';
|
|
1
|
+
import type { GraphQLObject, FragmentArtifact, QueryArtifact, fragmentKey, GraphQLVariables } from '$houdini/runtime/lib/types';
|
|
3
2
|
import { type DocumentHandle } from './useDocumentHandle';
|
|
4
|
-
export declare function useFragmentHandle<_Artifact extends FragmentArtifact, _Data extends GraphQLObject, _ReferenceType extends {}, _PaginationArtifact extends QueryArtifact, _Input extends
|
|
3
|
+
export declare function useFragmentHandle<_Artifact extends FragmentArtifact, _Data extends GraphQLObject, _ReferenceType extends {}, _PaginationArtifact extends QueryArtifact, _Input extends GraphQLVariables = GraphQLVariables>(reference: _Data | {
|
|
5
4
|
[fragmentKey]: _ReferenceType;
|
|
6
5
|
} | null, document: {
|
|
7
6
|
artifact: FragmentArtifact;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { MutationArtifact, GraphQLObject, QueryResult } from '$houdini/runtime/lib/types';
|
|
1
|
+
import type { MutationArtifact, GraphQLObject, QueryResult, GraphQLVariables } from '$houdini/runtime/lib/types';
|
|
2
2
|
export type MutationHandler<_Result, _Input, _Optimistic extends GraphQLObject> = (args: {
|
|
3
3
|
variables: _Input;
|
|
4
4
|
metadata?: App.Metadata;
|
|
5
5
|
fetch?: typeof globalThis.fetch;
|
|
6
6
|
optimisticResponse?: _Optimistic;
|
|
7
7
|
}) => Promise<QueryResult<_Result, _Input>>;
|
|
8
|
-
export declare function useMutation<_Result extends GraphQLObject, _Input extends
|
|
8
|
+
export declare function useMutation<_Result extends GraphQLObject, _Input extends GraphQLVariables, _Optimistic extends GraphQLObject>({ artifact, }: {
|
|
9
9
|
artifact: MutationArtifact;
|
|
10
10
|
}): [boolean, MutationHandler<_Result, _Input, _Optimistic>];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UseQueryConfig } from './useQueryHandle';
|
|
3
|
-
export declare function useQuery<_Artifact extends QueryArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends
|
|
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
4
|
artifact: QueryArtifact;
|
|
5
5
|
}, variables?: any, config?: UseQueryConfig): _Data;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DocumentHandle } from './useDocumentHandle';
|
|
3
|
-
export declare function useQueryHandle<_Artifact extends QueryArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends
|
|
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
4
|
artifact: QueryArtifact;
|
|
5
5
|
}, variables?: any, config?: UseQueryConfig): DocumentHandle<_Artifact, _Data, _Input>;
|
|
6
6
|
export type UseQueryConfig = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SubscriptionArtifact, GraphQLObject } from '$houdini/runtime/lib/types';
|
|
2
|
-
export declare function useSubscription<_Result extends GraphQLObject, _Input extends
|
|
1
|
+
import type { SubscriptionArtifact, GraphQLObject, GraphQLVariables } from '$houdini/runtime/lib/types';
|
|
2
|
+
export declare function useSubscription<_Result extends GraphQLObject, _Input extends GraphQLVariables>(document: {
|
|
3
3
|
artifact: SubscriptionArtifact;
|
|
4
4
|
}, variables: _Input): import("houdini").GraphQLObject | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SubscriptionArtifact, GraphQLObject } from '$houdini/runtime/lib/types';
|
|
2
|
-
export type SubscriptionHandle<_Result extends GraphQLObject, _Input extends
|
|
1
|
+
import type { SubscriptionArtifact, GraphQLObject, GraphQLVariables } from '$houdini/runtime/lib/types';
|
|
2
|
+
export type SubscriptionHandle<_Result extends GraphQLObject, _Input extends GraphQLVariables> = {
|
|
3
3
|
data: _Result | null;
|
|
4
4
|
errors: {
|
|
5
5
|
message: string;
|
|
@@ -11,7 +11,7 @@ export type SubscriptionHandle<_Result extends GraphQLObject, _Input extends {}
|
|
|
11
11
|
unlisten: () => void;
|
|
12
12
|
fetching: boolean;
|
|
13
13
|
};
|
|
14
|
-
export declare function useSubscriptionHandle<_Result extends GraphQLObject, _Input extends
|
|
14
|
+
export declare function useSubscriptionHandle<_Result extends GraphQLObject, _Input extends GraphQLVariables>({ artifact }: {
|
|
15
15
|
artifact: SubscriptionArtifact;
|
|
16
16
|
}, variables: _Input): {
|
|
17
17
|
data: import("houdini").GraphQLObject | null;
|
package/build/runtime/index.d.ts
CHANGED
|
@@ -1,2 +1,31 @@
|
|
|
1
|
+
import type { Cache } from '$houdini/runtime/cache/cache';
|
|
2
|
+
import { DocumentStore } from '$houdini/runtime/client';
|
|
3
|
+
import { LRUCache } from '$houdini/runtime/lib/lru';
|
|
4
|
+
import { GraphQLObject, GraphQLVariables, QueryArtifact } from '$houdini/runtime/lib/types';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { PendingCache } from './routing/components/Router';
|
|
7
|
+
import { SuspenseCache } from './routing/lib/cache';
|
|
1
8
|
export * from './hooks';
|
|
2
|
-
export
|
|
9
|
+
export * from './routing';
|
|
10
|
+
export declare function Router({ cache, intialURL, artifact_cache, component_cache, data_cache, pending_cache, last_variables, loaded_queries, loaded_artifacts, session, }: {
|
|
11
|
+
intialURL: string;
|
|
12
|
+
cache: Cache;
|
|
13
|
+
loaded_queries?: Record<string, {
|
|
14
|
+
data: GraphQLObject;
|
|
15
|
+
variables: GraphQLVariables;
|
|
16
|
+
}>;
|
|
17
|
+
loaded_artifacts?: Record<string, QueryArtifact>;
|
|
18
|
+
session?: App.Session;
|
|
19
|
+
} & RouterCache): JSX.Element;
|
|
20
|
+
type RouterCache = {
|
|
21
|
+
artifact_cache: SuspenseCache<QueryArtifact>;
|
|
22
|
+
component_cache: SuspenseCache<(props: any) => React.ReactElement>;
|
|
23
|
+
data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
|
|
24
|
+
last_variables: LRUCache<GraphQLVariables>;
|
|
25
|
+
pending_cache: PendingCache;
|
|
26
|
+
};
|
|
27
|
+
export declare function router_cache({ pending_queries, artifacts, components, }?: {
|
|
28
|
+
pending_queries?: string[];
|
|
29
|
+
artifacts?: Record<string, QueryArtifact>;
|
|
30
|
+
components?: Record<string, (props: any) => React.ReactElement>;
|
|
31
|
+
}): RouterCache;
|
|
@@ -0,0 +1,56 @@
|
|
|
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 React from 'react';
|
|
7
|
+
import { SuspenseCache } from '../lib/cache';
|
|
8
|
+
import type { NavigationContext, RouterManifest } from '../lib/types';
|
|
9
|
+
/**
|
|
10
|
+
* Router is the top level entry point for the filesystem-based router.
|
|
11
|
+
* It is responsible for loading various page sources (including API fetches) and
|
|
12
|
+
* then rendering when appropriate.
|
|
13
|
+
*/
|
|
14
|
+
export declare function Router({ manifest, intialURL, loaded_queries, loaded_artifacts, }: {
|
|
15
|
+
manifest: RouterManifest;
|
|
16
|
+
intialURL?: string;
|
|
17
|
+
loaded_queries?: Record<string, {
|
|
18
|
+
data: GraphQLObject;
|
|
19
|
+
variables: GraphQLVariables;
|
|
20
|
+
}>;
|
|
21
|
+
loaded_artifacts?: Record<string, QueryArtifact>;
|
|
22
|
+
}): JSX.Element;
|
|
23
|
+
export declare function useNavigationContext(): NavigationContext;
|
|
24
|
+
export declare function RouterContextProvider({ children, client, cache, artifact_cache, component_cache, data_cache, pending_cache, last_variables, session: ssrSession, }: {
|
|
25
|
+
children: React.ReactElement;
|
|
26
|
+
client: HoudiniClient;
|
|
27
|
+
cache: Cache;
|
|
28
|
+
artifact_cache: SuspenseCache<QueryArtifact>;
|
|
29
|
+
component_cache: SuspenseCache<(props: any) => React.ReactElement>;
|
|
30
|
+
data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
|
|
31
|
+
pending_cache: PendingCache;
|
|
32
|
+
last_variables: LRUCache<GraphQLVariables>;
|
|
33
|
+
session?: App.Session;
|
|
34
|
+
}): JSX.Element;
|
|
35
|
+
type RouterContext = {
|
|
36
|
+
client: HoudiniClient;
|
|
37
|
+
cache: Cache;
|
|
38
|
+
artifact_cache: SuspenseCache<QueryArtifact>;
|
|
39
|
+
component_cache: SuspenseCache<(props: any) => React.ReactElement>;
|
|
40
|
+
data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
|
|
41
|
+
pending_cache: PendingCache;
|
|
42
|
+
last_variables: LRUCache<GraphQLVariables>;
|
|
43
|
+
session: App.Session;
|
|
44
|
+
};
|
|
45
|
+
export type PendingCache = SuspenseCache<Promise<void> & {
|
|
46
|
+
resolve: () => void;
|
|
47
|
+
reject: () => void;
|
|
48
|
+
}>;
|
|
49
|
+
export declare const useRouterContext: () => RouterContext;
|
|
50
|
+
export declare function useClient(): HoudiniClient;
|
|
51
|
+
export declare function useCache(): Cache;
|
|
52
|
+
export declare function updateLocalSession(session: App.Session): void;
|
|
53
|
+
export declare function useSession(): App.Session;
|
|
54
|
+
export declare function useCurrentVariables(): GraphQLVariables;
|
|
55
|
+
export declare function useQueryResult<_Data extends GraphQLObject, _Input extends GraphQLVariables>(name: string): [_Data | null, DocumentStore<_Data, _Input>];
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LRUCache } from '$houdini/runtime/lib/lru';
|
|
2
|
+
export declare function suspense_cache<T>(): SuspenseCache<T>;
|
|
3
|
+
export declare class SuspenseCache<_Data> extends LRUCache<_Data> {
|
|
4
|
+
#private;
|
|
5
|
+
get(key: string): _Data;
|
|
6
|
+
set(key: string, value: _Data): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { GraphQLVariables } from '$houdini/runtime/lib/types';
|
|
2
|
+
import type { RouterManifest, RouterPageManifest } from './types';
|
|
3
|
+
export type RouteParam = {
|
|
4
|
+
name: string;
|
|
5
|
+
matcher: string;
|
|
6
|
+
optional: boolean;
|
|
7
|
+
rest: boolean;
|
|
8
|
+
chained: boolean;
|
|
9
|
+
};
|
|
10
|
+
export interface ParamMatcher {
|
|
11
|
+
(param: string): boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function find_match(manifest: RouterManifest, current: string, allowNull: true): [RouterPageManifest | null, GraphQLVariables];
|
|
14
|
+
export declare function find_match(manifest: RouterManifest, current: string, allowNull?: false): [RouterPageManifest, GraphQLVariables];
|
|
15
|
+
/**
|
|
16
|
+
* Creates the regex pattern, extracts parameter names, and generates types for a route
|
|
17
|
+
*/
|
|
18
|
+
export declare function parse_page_pattern(id: string): {
|
|
19
|
+
pattern: RegExp;
|
|
20
|
+
params: RouteParam[];
|
|
21
|
+
page_id: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Splits a route id into its segments, removing segments that
|
|
25
|
+
* don't affect the path (i.e. groups). The root route is represented by `/`
|
|
26
|
+
* and will be returned as `['']`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function get_route_segments(route: string): string[];
|
|
29
|
+
export declare function exec(match: RegExpMatchArray, params: RouteParam[]): Record<string, string> | undefined;
|
|
30
|
+
/**
|
|
31
|
+
Copyright (c) 2020 [these people](https://github.com/sveltejs/kit/graphs/contributors)
|
|
32
|
+
|
|
33
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
34
|
+
|
|
35
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
38
|
+
*/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { QueryArtifact } from '$houdini/runtime/lib/types';
|
|
2
|
+
import type { RouteParam } from './match';
|
|
3
|
+
export type RouterManifest = {
|
|
4
|
+
pages: Record<string, RouterPageManifest>;
|
|
5
|
+
};
|
|
6
|
+
export type RouterPageManifest = {
|
|
7
|
+
id: string;
|
|
8
|
+
pattern: RegExp;
|
|
9
|
+
params: RouteParam[];
|
|
10
|
+
documents: Record<string, {
|
|
11
|
+
artifact: () => Promise<{
|
|
12
|
+
default: QueryArtifact;
|
|
13
|
+
}>;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
component: () => Promise<{
|
|
17
|
+
default: (props: any) => React.ReactElement;
|
|
18
|
+
}>;
|
|
19
|
+
};
|
|
20
|
+
export type NavigationContext = {
|
|
21
|
+
currentRoute: string;
|
|
22
|
+
goto: (route: string) => void;
|
|
23
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
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 client_exports = {};
|
|
20
|
+
__export(client_exports, {
|
|
21
|
+
default: () => client_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(client_exports);
|
|
24
|
+
var client_default = {};
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const require = conflict_free(import.meta.url);
|
|
2
1
|
"use strict";
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -17,34 +16,24 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
16
|
return to;
|
|
18
17
|
};
|
|
19
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
__export(next_exports, {
|
|
24
|
-
withHoudini: () => withHoudini
|
|
19
|
+
var clientPlugin_exports = {};
|
|
20
|
+
__export(clientPlugin_exports, {
|
|
21
|
+
default: () => clientPlugin_default
|
|
25
22
|
});
|
|
26
|
-
module.exports = __toCommonJS(
|
|
27
|
-
|
|
23
|
+
module.exports = __toCommonJS(clientPlugin_exports);
|
|
24
|
+
const plugin = () => () => {
|
|
28
25
|
return {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
loader: "houdini/webpack"
|
|
37
|
-
}
|
|
38
|
-
]
|
|
26
|
+
beforeNetwork(ctx, { next }) {
|
|
27
|
+
next({
|
|
28
|
+
...ctx,
|
|
29
|
+
cacheParams: {
|
|
30
|
+
...ctx.fetchParams,
|
|
31
|
+
serverSideFallback: false
|
|
32
|
+
}
|
|
39
33
|
});
|
|
40
|
-
if (nextConfig && typeof nextConfig.webpack === "function") {
|
|
41
|
-
return nextConfig.webpack(config, options);
|
|
42
|
-
}
|
|
43
|
-
return config;
|
|
44
34
|
}
|
|
45
35
|
};
|
|
46
|
-
}
|
|
36
|
+
};
|
|
37
|
+
var clientPlugin_default = plugin;
|
|
47
38
|
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
-
0 && (module.exports = {
|
|
49
|
-
withHoudini
|
|
50
|
-
});
|
|
39
|
+
0 && (module.exports = {});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { DocumentStore } from '$houdini/runtime/client';
|
|
2
|
-
import
|
|
3
|
-
export declare function useDocumentHandle<_Artifact extends QueryArtifact, _Data extends GraphQLObject, _Input extends
|
|
1
|
+
import type { DocumentStore } from '$houdini/runtime/client';
|
|
2
|
+
import type { GraphQLObject, GraphQLVariables, CursorHandlers, OffsetHandlers, PageInfo, FetchFn, QueryResult, DocumentArtifact, QueryArtifact } from '$houdini/runtime/lib/types';
|
|
3
|
+
export declare function useDocumentHandle<_Artifact extends QueryArtifact, _Data extends GraphQLObject, _Input extends GraphQLVariables>({ artifact, observer, storeValue, }: {
|
|
4
4
|
artifact: DocumentArtifact;
|
|
5
5
|
observer: DocumentStore<_Data, _Input>;
|
|
6
6
|
storeValue: QueryResult<_Data, _Input>;
|
|
7
7
|
}): DocumentHandle<_Artifact, _Data, _Input> & {
|
|
8
8
|
fetch: FetchFn<_Data, _Input>;
|
|
9
9
|
};
|
|
10
|
-
export type DocumentHandle<_Artifact extends QueryArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends
|
|
10
|
+
export type DocumentHandle<_Artifact extends QueryArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends GraphQLVariables = GraphQLVariables> = {
|
|
11
11
|
data: _Data;
|
|
12
12
|
partial: boolean;
|
|
13
13
|
} & RefetchHandlers<_Artifact, _Data, _Input>;
|
|
@@ -31,6 +31,7 @@ var import_pageInfo = require("$houdini/runtime/lib/pageInfo");
|
|
|
31
31
|
var import_pagination = require("$houdini/runtime/lib/pagination");
|
|
32
32
|
var import_types = require("$houdini/runtime/lib/types");
|
|
33
33
|
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_Router = require("../routing/components/Router");
|
|
34
35
|
function useDocumentHandle({
|
|
35
36
|
artifact,
|
|
36
37
|
observer,
|
|
@@ -38,6 +39,7 @@ function useDocumentHandle({
|
|
|
38
39
|
}) {
|
|
39
40
|
const [forwardPending, setForwardPending] = import_react.default.useState(false);
|
|
40
41
|
const [backwardPending, setBackwardPending] = import_react.default.useState(false);
|
|
42
|
+
const session = (0, import_Router.useSession)();
|
|
41
43
|
return import_react.default.useMemo(() => {
|
|
42
44
|
const wrapLoad = (setLoading, fn) => {
|
|
43
45
|
return async (value) => {
|
|
@@ -47,7 +49,10 @@ function useDocumentHandle({
|
|
|
47
49
|
return result;
|
|
48
50
|
};
|
|
49
51
|
};
|
|
50
|
-
const fetchQuery = (args) => observer.send(
|
|
52
|
+
const fetchQuery = (args) => observer.send({
|
|
53
|
+
...args,
|
|
54
|
+
session
|
|
55
|
+
});
|
|
51
56
|
if (artifact.kind !== import_types.ArtifactKind.Query || !artifact.refetch?.paginated) {
|
|
52
57
|
return {
|
|
53
58
|
data: storeValue.data,
|
|
@@ -55,13 +60,11 @@ function useDocumentHandle({
|
|
|
55
60
|
partial: storeValue.partial
|
|
56
61
|
};
|
|
57
62
|
}
|
|
58
|
-
const getSession = async () => ({});
|
|
59
63
|
if (artifact.refetch.method === "cursor") {
|
|
60
64
|
const handlers = (0, import_pagination.cursorHandlers)({
|
|
61
65
|
artifact,
|
|
62
66
|
getState: () => storeValue.data,
|
|
63
67
|
getVariables: () => storeValue.variables,
|
|
64
|
-
storeName: artifact.name,
|
|
65
68
|
fetch: fetchQuery,
|
|
66
69
|
fetchUpdate: (args, updates) => {
|
|
67
70
|
return observer.send({
|
|
@@ -70,10 +73,11 @@ function useDocumentHandle({
|
|
|
70
73
|
disableSubscriptions: true,
|
|
71
74
|
applyUpdates: updates,
|
|
72
75
|
...args?.cacheParams
|
|
73
|
-
}
|
|
76
|
+
},
|
|
77
|
+
session
|
|
74
78
|
});
|
|
75
79
|
},
|
|
76
|
-
getSession
|
|
80
|
+
getSession: async () => session
|
|
77
81
|
});
|
|
78
82
|
return {
|
|
79
83
|
data: storeValue.data,
|
|
@@ -103,7 +107,7 @@ function useDocumentHandle({
|
|
|
103
107
|
}
|
|
104
108
|
});
|
|
105
109
|
},
|
|
106
|
-
getSession: async () =>
|
|
110
|
+
getSession: async () => session
|
|
107
111
|
});
|
|
108
112
|
return {
|
|
109
113
|
data: storeValue.data,
|
|
@@ -119,7 +123,7 @@ function useDocumentHandle({
|
|
|
119
123
|
refetch: fetchQuery,
|
|
120
124
|
partial: storeValue.partial
|
|
121
125
|
};
|
|
122
|
-
}, [artifact, observer, storeValue, true, true]);
|
|
126
|
+
}, [artifact, observer, session, storeValue, true, true]);
|
|
123
127
|
}
|
|
124
128
|
// Annotate the CommonJS export names for ESM import in node:
|
|
125
129
|
0 && (module.exports = {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { DocumentArtifact, QueryResult } from '$houdini/lib/types';
|
|
1
|
+
import type { DocumentArtifact, GraphQLVariables, QueryResult } from '$houdini/lib/types';
|
|
2
2
|
import type { DocumentStore, ObserveParams } from '$houdini/runtime/client';
|
|
3
|
-
import { GraphQLObject } from 'houdini';
|
|
4
|
-
export type UseDocumentStoreParams<_Artifact extends DocumentArtifact, _Data extends GraphQLObject> = {
|
|
3
|
+
import type { GraphQLObject } from 'houdini';
|
|
4
|
+
export type UseDocumentStoreParams<_Artifact extends DocumentArtifact, _Data extends GraphQLObject, _Input extends GraphQLVariables> = {
|
|
5
5
|
artifact: _Artifact;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
observer?: DocumentStore<_Data, _Input>;
|
|
7
|
+
} & Partial<ObserveParams<_Data, DocumentArtifact, _Input>>;
|
|
8
|
+
export declare function useDocumentStore<_Data extends GraphQLObject = GraphQLObject, _Input extends GraphQLVariables = GraphQLVariables, _Artifact extends DocumentArtifact = DocumentArtifact>({ artifact, observer: obs, ...observeParams }: UseDocumentStoreParams<_Artifact, _Data, _Input>): [
|
|
8
9
|
QueryResult<_Data, _Input>,
|
|
9
10
|
DocumentStore<_Data, _Input>,
|
|
10
11
|
(store: DocumentStore<_Data, _Input>) => void
|
|
@@ -28,16 +28,17 @@ __export(useDocumentStore_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(useDocumentStore_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
|
-
var
|
|
31
|
+
var import_routing = require("../routing");
|
|
32
32
|
var import_useIsMounted = require("./useIsMounted");
|
|
33
33
|
function useDocumentStore({
|
|
34
34
|
artifact,
|
|
35
|
+
observer: obs,
|
|
35
36
|
...observeParams
|
|
36
37
|
}) {
|
|
37
|
-
const client = (0,
|
|
38
|
+
const client = (0, import_routing.useClient)();
|
|
38
39
|
const isMountedRef = (0, import_useIsMounted.useIsMountedRef)();
|
|
39
40
|
let [observer, setObserver] = React.useState(
|
|
40
|
-
() => client.observe({
|
|
41
|
+
() => obs ?? client.observe({
|
|
41
42
|
artifact,
|
|
42
43
|
...observeParams
|
|
43
44
|
})
|
|
@@ -54,7 +55,11 @@ function useDocumentStore({
|
|
|
54
55
|
},
|
|
55
56
|
[observer]
|
|
56
57
|
);
|
|
57
|
-
const storeValue = React.useSyncExternalStore(
|
|
58
|
+
const storeValue = React.useSyncExternalStore(
|
|
59
|
+
subscribe,
|
|
60
|
+
() => box.current,
|
|
61
|
+
() => box.current
|
|
62
|
+
);
|
|
58
63
|
return [storeValue, observer, setObserver];
|
|
59
64
|
}
|
|
60
65
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { DocumentArtifact, QueryResult } from '$houdini/lib/types';
|
|
1
|
+
import type { DocumentArtifact, GraphQLVariables, QueryResult } from '$houdini/lib/types';
|
|
2
2
|
import type { DocumentStore, SendParams } from '$houdini/runtime/client';
|
|
3
|
-
import { GraphQLObject } from 'houdini';
|
|
3
|
+
import type { GraphQLObject } from 'houdini';
|
|
4
4
|
import { type UseDocumentStoreParams } from './useDocumentStore';
|
|
5
|
-
export declare function useDocumentSubscription<_Artifact extends DocumentArtifact = DocumentArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends
|
|
5
|
+
export declare function useDocumentSubscription<_Artifact extends DocumentArtifact = DocumentArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends GraphQLVariables = GraphQLVariables>({ artifact, variables, send, disabled, ...observeParams }: UseDocumentStoreParams<_Artifact, _Data, _Input> & {
|
|
6
6
|
variables: _Input;
|
|
7
|
+
disabled?: boolean;
|
|
7
8
|
send?: Partial<SendParams>;
|
|
8
9
|
}): [
|
|
9
10
|
QueryResult<_Data, _Input> & {
|
|
@@ -27,29 +27,36 @@ __export(useDocumentSubscription_exports, {
|
|
|
27
27
|
useDocumentSubscription: () => useDocumentSubscription
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(useDocumentSubscription_exports);
|
|
30
|
+
var import_Router = require("../routing/components/Router");
|
|
30
31
|
var import_useDeepCompareEffect = __toESM(require("./useDeepCompareEffect"));
|
|
31
32
|
var import_useDocumentStore = require("./useDocumentStore");
|
|
32
33
|
function useDocumentSubscription({
|
|
33
34
|
artifact,
|
|
34
35
|
variables,
|
|
35
36
|
send,
|
|
37
|
+
disabled,
|
|
36
38
|
...observeParams
|
|
37
39
|
}) {
|
|
38
40
|
const [storeValue, observer, setObserver] = (0, import_useDocumentStore.useDocumentStore)({
|
|
39
41
|
artifact,
|
|
40
42
|
...observeParams
|
|
41
43
|
});
|
|
44
|
+
const session = (0, import_Router.useSession)();
|
|
42
45
|
(0, import_useDeepCompareEffect.default)(() => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
if (!disabled) {
|
|
47
|
+
observer.send({
|
|
48
|
+
variables,
|
|
49
|
+
session,
|
|
50
|
+
metadata: {},
|
|
51
|
+
...send
|
|
52
|
+
});
|
|
53
|
+
}
|
|
49
54
|
return () => {
|
|
50
|
-
|
|
55
|
+
if (!disabled) {
|
|
56
|
+
observer.cleanup();
|
|
57
|
+
}
|
|
51
58
|
};
|
|
52
|
-
}, [observer, variables ?? {}, send ?? {}]);
|
|
59
|
+
}, [disabled, session, observer, variables ?? {}, send ?? {}]);
|
|
53
60
|
return [
|
|
54
61
|
{
|
|
55
62
|
parent: send?.stuff?.parentID,
|