@trpc/react-query 10.28.0 → 10.28.2
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 -2
- package/dist/{context-1da55110.js → context-4557b3d3.js} +31 -31
- package/dist/{createHooksInternal-bd7db1e7.js → createHooksInternal-03506f75.js} +483 -472
- package/dist/{createHooksInternal-9f8a4b21.js → createHooksInternal-466f5861.js} +21 -7
- package/dist/{createHooksInternal-d15d0073.mjs → createHooksInternal-a6562110.mjs} +21 -7
- package/dist/createTRPCReact.d.ts +75 -75
- package/dist/createTRPCReact.d.ts.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/dist/internals/context.d.ts +125 -127
- package/dist/internals/context.d.ts.map +1 -1
- package/dist/internals/getArrayQueryKey.d.ts +24 -24
- package/dist/internals/getArrayQueryKey.d.ts.map +1 -1
- package/dist/internals/getClientArgs.d.ts +1 -1
- package/dist/internals/getQueryKey.d.ts +30 -30
- package/dist/internals/getQueryKey.d.ts.map +1 -1
- package/dist/internals/useHookResult.d.ts +9 -9
- package/dist/internals/useQueries.d.ts +27 -27
- package/dist/internals/useQueries.d.ts.map +1 -1
- package/dist/interop.d.ts +10 -10
- package/dist/interop.d.ts.map +1 -1
- package/dist/{queryClient-77734cc3.js → queryClient-1c8d7d8a.js} +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/ssgProxy.d.ts +36 -36
- package/dist/server/ssgProxy.d.ts.map +1 -1
- package/dist/server/types.d.ts +9 -9
- package/dist/server/types.d.ts.map +1 -1
- package/dist/shared/hooks/createHooksInternal.d.ts +27 -27
- package/dist/shared/hooks/createHooksInternal.d.ts.map +1 -1
- package/dist/shared/hooks/createRootHooks.d.ts +6 -6
- package/dist/shared/hooks/deprecated/createHooksInternal.d.ts +60 -60
- package/dist/shared/hooks/deprecated/createHooksInternal.d.ts.map +1 -1
- package/dist/shared/hooks/types.d.ts +81 -81
- package/dist/shared/hooks/types.d.ts.map +1 -1
- package/dist/shared/index.d.ts +21 -21
- package/dist/shared/index.js +1 -1
- package/dist/shared/index.mjs +1 -1
- package/dist/shared/polymorphism/index.d.ts +4 -4
- package/dist/shared/polymorphism/mutationLike.d.ts +17 -17
- package/dist/shared/polymorphism/mutationLike.d.ts.map +1 -1
- package/dist/shared/polymorphism/queryLike.d.ts +17 -17
- package/dist/shared/polymorphism/queryLike.d.ts.map +1 -1
- package/dist/shared/polymorphism/routerLike.d.ts +9 -9
- package/dist/shared/polymorphism/routerLike.d.ts.map +1 -1
- package/dist/shared/polymorphism/utilsLike.d.ts +6 -6
- package/dist/shared/polymorphism/utilsLike.d.ts.map +1 -1
- package/dist/shared/proxy/decorationProxy.d.ts +7 -7
- package/dist/shared/proxy/useQueriesProxy.d.ts +17 -17
- package/dist/shared/proxy/useQueriesProxy.d.ts.map +1 -1
- package/dist/shared/proxy/utilsProxy.d.ts +92 -93
- package/dist/shared/proxy/utilsProxy.d.ts.map +1 -1
- package/dist/shared/queryClient.d.ts +15 -15
- package/dist/shared/queryClient.d.ts.map +1 -1
- package/dist/shared/types.d.ts +52 -52
- package/dist/ssg/index.d.ts +14 -14
- package/dist/ssg/ssg.d.ts +15 -15
- package/dist/ssg/ssg.d.ts.map +1 -1
- package/dist/utils/inferReactQueryProcedure.d.ts +23 -23
- package/dist/utils/inferReactQueryProcedure.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/createTRPCReact.tsx +3 -3
- package/src/internals/context.tsx +3 -5
- package/src/internals/getQueryKey.ts +2 -2
- package/src/interop.ts +2 -2
- package/src/server/ssgProxy.ts +2 -2
- package/src/shared/hooks/createHooksInternal.tsx +38 -13
- package/src/shared/hooks/deprecated/createHooksInternal.tsx +10 -7
- package/src/shared/proxy/utilsProxy.ts +4 -4
- package/src/ssg/ssg.ts +2 -2
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AnyProcedure, AnyQueryProcedure, AnyRouter, Filter,
|
|
3
|
-
import { inferTransformedProcedureOutput } from '@trpc/server/shared';
|
|
4
|
-
import { CreateSSGHelpersOptions } from './types';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @link https://tanstack.com/query/v4/docs/react/guides/prefetching
|
|
8
|
-
*/
|
|
9
|
-
fetch(...args: inferHandlerInput<TProcedure>): Promise<inferTransformedProcedureOutput<TProcedure>>;
|
|
10
|
-
/**
|
|
11
|
-
* @link https://tanstack.com/query/v4/docs/react/guides/prefetching
|
|
12
|
-
*/
|
|
13
|
-
fetchInfinite(...args: inferHandlerInput<TProcedure>): Promise<InfiniteData<inferTransformedProcedureOutput<TProcedure>>>;
|
|
14
|
-
/**
|
|
15
|
-
* @link https://tanstack.com/query/v4/docs/react/guides/prefetching
|
|
16
|
-
*/
|
|
17
|
-
prefetch(...args: inferHandlerInput<TProcedure>): Promise<void>;
|
|
18
|
-
/**
|
|
19
|
-
* @link https://tanstack.com/query/v4/docs/react/guides/prefetching
|
|
20
|
-
*/
|
|
21
|
-
prefetchInfinite(...args: inferHandlerInput<TProcedure>): Promise<void>;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* @internal
|
|
25
|
-
*/
|
|
26
|
-
export
|
|
27
|
-
[TKey in keyof Filter<TRouter['_def']['record'], AnyRouter | AnyQueryProcedure>]: TRouter['_def']['record'][TKey] extends AnyRouter ? DecoratedProcedureSSGRecord<TRouter['_def']['record'][TKey]> : DecorateProcedure<TRouter['_def']['record'][TKey]>;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Create functions you can use for server-side rendering / static generation
|
|
31
|
-
*/
|
|
32
|
-
export declare function createServerSideHelpers<TRouter extends AnyRouter>(opts: CreateSSGHelpersOptions<TRouter>): ProtectedIntersection<{
|
|
33
|
-
queryClient: QueryClient;
|
|
34
|
-
dehydrate: (opts?: DehydrateOptions) => DehydratedState;
|
|
35
|
-
}, DecoratedProcedureSSGRecord<TRouter>>;
|
|
36
|
-
export {};
|
|
1
|
+
import { DehydratedState, DehydrateOptions, InfiniteData, QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { AnyProcedure, AnyQueryProcedure, AnyRouter, Filter, inferHandlerInput, ProtectedIntersection } from '@trpc/server';
|
|
3
|
+
import { inferTransformedProcedureOutput } from '@trpc/server/shared';
|
|
4
|
+
import { CreateSSGHelpersOptions } from './types';
|
|
5
|
+
type DecorateProcedure<TProcedure extends AnyProcedure> = {
|
|
6
|
+
/**
|
|
7
|
+
* @link https://tanstack.com/query/v4/docs/react/guides/prefetching
|
|
8
|
+
*/
|
|
9
|
+
fetch(...args: inferHandlerInput<TProcedure>): Promise<inferTransformedProcedureOutput<TProcedure>>;
|
|
10
|
+
/**
|
|
11
|
+
* @link https://tanstack.com/query/v4/docs/react/guides/prefetching
|
|
12
|
+
*/
|
|
13
|
+
fetchInfinite(...args: inferHandlerInput<TProcedure>): Promise<InfiniteData<inferTransformedProcedureOutput<TProcedure>>>;
|
|
14
|
+
/**
|
|
15
|
+
* @link https://tanstack.com/query/v4/docs/react/guides/prefetching
|
|
16
|
+
*/
|
|
17
|
+
prefetch(...args: inferHandlerInput<TProcedure>): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* @link https://tanstack.com/query/v4/docs/react/guides/prefetching
|
|
20
|
+
*/
|
|
21
|
+
prefetchInfinite(...args: inferHandlerInput<TProcedure>): Promise<void>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export type DecoratedProcedureSSGRecord<TRouter extends AnyRouter> = {
|
|
27
|
+
[TKey in keyof Filter<TRouter['_def']['record'], AnyRouter | AnyQueryProcedure>]: TRouter['_def']['record'][TKey] extends AnyRouter ? DecoratedProcedureSSGRecord<TRouter['_def']['record'][TKey]> : DecorateProcedure<TRouter['_def']['record'][TKey]>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Create functions you can use for server-side rendering / static generation
|
|
31
|
+
*/
|
|
32
|
+
export declare function createServerSideHelpers<TRouter extends AnyRouter>(opts: CreateSSGHelpersOptions<TRouter>): ProtectedIntersection<{
|
|
33
|
+
queryClient: QueryClient;
|
|
34
|
+
dehydrate: (opts?: DehydrateOptions) => DehydratedState;
|
|
35
|
+
}, DecoratedProcedureSSGRecord<TRouter>>;
|
|
36
|
+
export {};
|
|
37
37
|
//# sourceMappingURL=ssgProxy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssgProxy.d.ts","sourceRoot":"","sources":["../../src/server/ssgProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"ssgProxy.d.ts","sourceRoot":"","sources":["../../src/server/ssgProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,MAAM,EACN,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAGL,+BAA+B,EAChC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAElD,KAAK,iBAAiB,CAAC,UAAU,SAAS,YAAY,IAAI;IACxD;;OAEG;IACH,KAAK,CACH,GAAG,IAAI,EAAE,iBAAiB,CAAC,UAAU,CAAC,GACrC,OAAO,CAAC,+BAA+B,CAAC,UAAU,CAAC,CAAC,CAAC;IAExD;;OAEG;IACH,aAAa,CACX,GAAG,IAAI,EAAE,iBAAiB,CAAC,UAAU,CAAC,GACrC,OAAO,CAAC,YAAY,CAAC,+BAA+B,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAEtE;;OAEG;IACH,QAAQ,CAAC,GAAG,IAAI,EAAE,iBAAiB,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhE;;OAEG;IACH,gBAAgB,CAAC,GAAG,IAAI,EAAE,iBAAiB,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,2BAA2B,CAAC,OAAO,SAAS,SAAS,IAAI;KAClE,IAAI,IAAI,MAAM,MAAM,CACnB,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EACzB,SAAS,GAAG,iBAAiB,CAC9B,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GACjD,2BAA2B,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,GAE5D,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;AAIF;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,SAAS,SAAS,EAC/D,IAAI,EAAE,uBAAuB,CAAC,OAAO,CAAC;iBAMrB,WAAW;uBACL,gBAAgB,KAAK,eAAe;yCAsC5D"}
|
package/dist/server/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AnyRouter, ClientDataTransformerOptions, inferRouterContext } from '@trpc/server';
|
|
2
|
-
import { CreateTRPCReactQueryClientConfig } from '../shared';
|
|
3
|
-
interface CreateSSGHelpersOptionsBase<TRouter extends AnyRouter> {
|
|
4
|
-
router: TRouter;
|
|
5
|
-
ctx: inferRouterContext<TRouter>;
|
|
6
|
-
transformer?: ClientDataTransformerOptions;
|
|
7
|
-
}
|
|
8
|
-
export
|
|
9
|
-
export {};
|
|
1
|
+
import { AnyRouter, ClientDataTransformerOptions, inferRouterContext } from '@trpc/server';
|
|
2
|
+
import { CreateTRPCReactQueryClientConfig } from '../shared';
|
|
3
|
+
interface CreateSSGHelpersOptionsBase<TRouter extends AnyRouter> {
|
|
4
|
+
router: TRouter;
|
|
5
|
+
ctx: inferRouterContext<TRouter>;
|
|
6
|
+
transformer?: ClientDataTransformerOptions;
|
|
7
|
+
}
|
|
8
|
+
export type CreateSSGHelpersOptions<TRouter extends AnyRouter> = CreateSSGHelpersOptionsBase<TRouter> & CreateTRPCReactQueryClientConfig;
|
|
9
|
+
export {};
|
|
10
10
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gCAAgC,EAAE,MAAM,WAAW,CAAC;AAE7D,UAAU,2BAA2B,CAAC,OAAO,SAAS,SAAS;IAC7D,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACjC,WAAW,CAAC,EAAE,4BAA4B,CAAC;CAC5C;AACD,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gCAAgC,EAAE,MAAM,WAAW,CAAC;AAE7D,UAAU,2BAA2B,CAAC,OAAO,SAAS,SAAS;IAC7D,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACjC,WAAW,CAAC,EAAE,4BAA4B,CAAC;CAC5C;AACD,MAAM,MAAM,uBAAuB,CAAC,OAAO,SAAS,SAAS,IAC3D,2BAA2B,CAAC,OAAO,CAAC,GAAG,gCAAgC,CAAC"}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { TRPCClientErrorLike } from '@trpc/client';
|
|
2
|
-
import type { AnyRouter } from '@trpc/server';
|
|
3
|
-
import { Observable } from '@trpc/server/observable';
|
|
4
|
-
import { TRPCContextState } from '../../internals/context';
|
|
5
|
-
import { TRPCUseQueries } from '../../internals/useQueries';
|
|
6
|
-
import { CreateTRPCReactOptions } from '../types';
|
|
7
|
-
import { CreateClient, TRPCProvider, UseDehydratedState, UseTRPCInfiniteQueryOptions, UseTRPCInfiniteQueryResult, UseTRPCMutationOptions, UseTRPCMutationResult, UseTRPCQueryOptions, UseTRPCQueryResult, UseTRPCSubscriptionOptions } from './types';
|
|
8
|
-
/**
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export declare function createRootHooks<TRouter extends AnyRouter, TSSRContext = unknown>(config?: CreateTRPCReactOptions<TRouter>): {
|
|
12
|
-
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
13
|
-
createClient: CreateClient<TRouter>;
|
|
14
|
-
useContext: () => TRPCContextState<TRouter, TSSRContext>;
|
|
15
|
-
useQuery: (pathAndInput: [path: string, ...args: unknown[]], opts?: UseTRPCQueryOptions<unknown, unknown, unknown, unknown, TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCQueryResult<unknown, TRPCClientErrorLike<TRouter>>;
|
|
16
|
-
useQueries: TRPCUseQueries<TRouter>;
|
|
17
|
-
useMutation: (path: string | [string], opts?: UseTRPCMutationOptions<unknown, TRPCClientErrorLike<TRouter>, unknown, unknown> | undefined) => UseTRPCMutationResult<unknown, TRPCClientErrorLike<TRouter>, unknown, unknown>;
|
|
18
|
-
useSubscription: (pathAndInput: [
|
|
19
|
-
path: string,
|
|
20
|
-
...args: unknown[]
|
|
21
|
-
], opts: UseTRPCSubscriptionOptions<Observable<unknown, unknown>, TRPCClientErrorLike<TRouter>>) => void;
|
|
22
|
-
useDehydratedState: UseDehydratedState<TRouter>;
|
|
23
|
-
useInfiniteQuery: (pathAndInput: [
|
|
24
|
-
path: string,
|
|
25
|
-
input: Record<any, unknown>
|
|
26
|
-
], opts?: UseTRPCInfiniteQueryOptions<unknown, unknown, unknown, TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCInfiniteQueryResult<unknown, TRPCClientErrorLike<TRouter>>;
|
|
27
|
-
};
|
|
1
|
+
import { TRPCClientErrorLike } from '@trpc/client';
|
|
2
|
+
import type { AnyRouter } from '@trpc/server';
|
|
3
|
+
import { Observable } from '@trpc/server/observable';
|
|
4
|
+
import { TRPCContextState } from '../../internals/context';
|
|
5
|
+
import { TRPCUseQueries } from '../../internals/useQueries';
|
|
6
|
+
import { CreateTRPCReactOptions } from '../types';
|
|
7
|
+
import { CreateClient, TRPCProvider, UseDehydratedState, UseTRPCInfiniteQueryOptions, UseTRPCInfiniteQueryResult, UseTRPCMutationOptions, UseTRPCMutationResult, UseTRPCQueryOptions, UseTRPCQueryResult, UseTRPCSubscriptionOptions } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare function createRootHooks<TRouter extends AnyRouter, TSSRContext = unknown>(config?: CreateTRPCReactOptions<TRouter>): {
|
|
12
|
+
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
13
|
+
createClient: CreateClient<TRouter>;
|
|
14
|
+
useContext: () => TRPCContextState<TRouter, TSSRContext>;
|
|
15
|
+
useQuery: (pathAndInput: [path: string, ...args: unknown[]], opts?: UseTRPCQueryOptions<unknown, unknown, unknown, unknown, TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCQueryResult<unknown, TRPCClientErrorLike<TRouter>>;
|
|
16
|
+
useQueries: TRPCUseQueries<TRouter>;
|
|
17
|
+
useMutation: (path: string | [string], opts?: UseTRPCMutationOptions<unknown, TRPCClientErrorLike<TRouter>, unknown, unknown> | undefined) => UseTRPCMutationResult<unknown, TRPCClientErrorLike<TRouter>, unknown, unknown>;
|
|
18
|
+
useSubscription: (pathAndInput: [
|
|
19
|
+
path: string,
|
|
20
|
+
...args: unknown[]
|
|
21
|
+
], opts: UseTRPCSubscriptionOptions<Observable<unknown, unknown>, TRPCClientErrorLike<TRouter>>) => void;
|
|
22
|
+
useDehydratedState: UseDehydratedState<TRouter>;
|
|
23
|
+
useInfiniteQuery: (pathAndInput: [
|
|
24
|
+
path: string,
|
|
25
|
+
input: Record<any, unknown>
|
|
26
|
+
], opts?: UseTRPCInfiniteQueryOptions<unknown, unknown, unknown, TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCInfiniteQueryResult<unknown, TRPCClientErrorLike<TRouter>>;
|
|
27
|
+
};
|
|
28
28
|
//# sourceMappingURL=createHooksInternal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHooksInternal.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/createHooksInternal.tsx"],"names":[],"mappings":"AAWA,OAAO,
|
|
1
|
+
{"version":3,"file":"createHooksInternal.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/createHooksInternal.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAoB,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAQrD,OAAO,EAGL,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,sBAAsB,EAAuB,MAAM,UAAU,CAAC;AACvE,OAAO,EACL,YAAY,EACZ,YAAY,EAEZ,kBAAkB,EAClB,2BAA2B,EAC3B,0BAA0B,EAC1B,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,SAAS,SAAS,EACzB,WAAW,GAAG,OAAO,EACrB,MAAM,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC;;;;6BAmOxB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC;;wBA+D1C,MAAM,GAAG,CAAC,MAAM,CAAC;oCAyCT;QAEZ,IAAI,EAAE,MAAM;QACZ,GAAG,IAAI,EAAE,OAAO,EAAE;KACnB;;qCA+Ca;QAEZ,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC;KAC5B;EA+HJ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { createRootHooks } from './createHooksInternal';
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated
|
|
4
|
-
* DELETE ME
|
|
5
|
-
*/
|
|
6
|
-
export * from './deprecated/createHooksInternal';
|
|
1
|
+
export { createRootHooks } from './createHooksInternal';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated
|
|
4
|
+
* DELETE ME
|
|
5
|
+
*/
|
|
6
|
+
export * from './deprecated/createHooksInternal';
|
|
7
7
|
//# sourceMappingURL=createRootHooks.d.ts.map
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import { TRPCClientErrorLike } from '@trpc/client';
|
|
2
|
-
import type { AnyRouter,
|
|
3
|
-
import { inferObservableValue } from '@trpc/server/observable';
|
|
4
|
-
import { inferTransformedProcedureOutput } from '@trpc/server/shared';
|
|
5
|
-
import { TRPCContextState } from '../../../internals/context';
|
|
6
|
-
import { TRPCUseQueries } from '../../../internals/useQueries';
|
|
7
|
-
import { CreateTRPCReactOptions } from '../../types';
|
|
8
|
-
import { CreateClient, TRPCProvider, UseDehydratedState, UseTRPCInfiniteQueryOptions, UseTRPCInfiniteQueryResult, UseTRPCMutationOptions, UseTRPCMutationResult, UseTRPCQueryOptions, UseTRPCQueryResult, UseTRPCSubscriptionOptions } from '../types';
|
|
9
|
-
|
|
10
|
-
[TPath in keyof TObj]: inferProcedureInput<TObj[TPath]> extends {
|
|
11
|
-
cursor?: any;
|
|
12
|
-
} ? TPath : never;
|
|
13
|
-
}[keyof TObj];
|
|
14
|
-
|
|
15
|
-
[TPath in keyof TObj]: {
|
|
16
|
-
input: inferProcedureInput<TObj[TPath]>;
|
|
17
|
-
output: inferTransformedProcedureOutput<TObj[TPath]>;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Hack to infer the type of `createReactQueryHooks`
|
|
22
|
-
* @link https://stackoverflow.com/a/59072991
|
|
23
|
-
*/
|
|
24
|
-
declare class GnClass<TRouter extends AnyRouter, TSSRContext = unknown> {
|
|
25
|
-
fn(): {
|
|
26
|
-
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
27
|
-
createClient: CreateClient<TRouter>;
|
|
28
|
-
useContext: () => TRPCContextState<TRouter, TSSRContext>;
|
|
29
|
-
useQuery: <TPath extends keyof TRouter["_def"]["queries"] & string, TQueryFnData = inferProcedures<TRouter["_def"]["queries"]>[TPath]["output"], TData = inferProcedures<TRouter["_def"]["queries"]>[TPath]["output"]>(pathAndInput: [path: TPath, ...args: import("@trpc/server").ProcedureArgs<import("@trpc/server").inferProcedureParams<TRouter["_def"]["queries"][TPath]>>], opts?: UseTRPCQueryOptions<TPath, inferProcedures<TRouter["_def"]["queries"]>[TPath]["input"], TQueryFnData, TData, TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCQueryResult<TData, TRPCClientErrorLike<TRouter>>;
|
|
30
|
-
useQueries: TRPCUseQueries<TRouter>;
|
|
31
|
-
useMutation: <TPath_1 extends keyof TRouter["_def"]["mutations"] & string, TContext = unknown>(path: TPath_1 | [TPath_1], opts?: UseTRPCMutationOptions<inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["input"], TRPCClientErrorLike<TRouter>, inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["output"], TContext> | undefined) => UseTRPCMutationResult<inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["output"], TRPCClientErrorLike<TRouter>, inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["input"], TContext>;
|
|
32
|
-
useSubscription: <TPath_2 extends keyof TRouter["_def"]["subscriptions"] & string, TOutput extends inferObservableValue<inferProcedureOutput<TRouter["_def"]["subscriptions"][TPath_2]>>>(pathAndInput: [path: TPath_2, ...args: import("@trpc/server").ProcedureArgs<import("@trpc/server").inferProcedureParams<TRouter["_def"]["subscriptions"][TPath_2]>>], opts: UseTRPCSubscriptionOptions<inferObservableValue<inferProcedureOutput<TRouter["_def"]["subscriptions"][TPath_2]>>, inferProcedureClientError<TRouter["_def"]["subscriptions"][TPath_2]>>) => void;
|
|
33
|
-
useDehydratedState: UseDehydratedState<TRouter>;
|
|
34
|
-
useInfiniteQuery: <TPath_3 extends inferInfiniteQueryNames<TRouter["_def"]["queries"]> & string>(pathAndInput: [path: TPath_3, input: Omit<inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["input"], "cursor">], opts?: UseTRPCInfiniteQueryOptions<TPath_3, inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["input"], inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["output"], TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCInfiniteQueryResult<inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["output"], TRPCClientErrorLike<TRouter>>;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Infer the type of a `createReactQueryHooks` function
|
|
41
|
-
* @internal
|
|
42
|
-
*/
|
|
43
|
-
export
|
|
44
|
-
/**
|
|
45
|
-
* Create strongly typed react hooks
|
|
46
|
-
* @internal
|
|
47
|
-
* @deprecated
|
|
48
|
-
*/
|
|
49
|
-
export declare function createHooksInternal<TRouter extends AnyRouter, TSSRContext = unknown>(config?: CreateTRPCReactOptions<TRouter>): {
|
|
50
|
-
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
51
|
-
createClient: CreateClient<TRouter>;
|
|
52
|
-
useContext: () => TRPCContextState<TRouter, TSSRContext>;
|
|
53
|
-
useQuery: <TPath extends keyof TRouter["_def"]["queries"] & string, TQueryFnData = inferProcedures<TRouter["_def"]["queries"]>[TPath]["output"], TData = inferProcedures<TRouter["_def"]["queries"]>[TPath]["output"]>(pathAndInput: [path: TPath, ...args: import("@trpc/server").ProcedureArgs<import("@trpc/server").inferProcedureParams<TRouter["_def"]["queries"][TPath]>>], opts?: UseTRPCQueryOptions<TPath, inferProcedures<TRouter["_def"]["queries"]>[TPath]["input"], TQueryFnData, TData, TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCQueryResult<TData, TRPCClientErrorLike<TRouter>>;
|
|
54
|
-
useQueries: TRPCUseQueries<TRouter>;
|
|
55
|
-
useMutation: <TPath_1 extends keyof TRouter["_def"]["mutations"] & string, TContext = unknown>(path: TPath_1 | [TPath_1], opts?: UseTRPCMutationOptions<inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["input"], TRPCClientErrorLike<TRouter>, inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["output"], TContext> | undefined) => UseTRPCMutationResult<inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["output"], TRPCClientErrorLike<TRouter>, inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["input"], TContext>;
|
|
56
|
-
useSubscription: <TPath_2 extends keyof TRouter["_def"]["subscriptions"] & string, TOutput extends inferObservableValue<inferProcedureOutput<TRouter["_def"]["subscriptions"][TPath_2]>>>(pathAndInput: [path: TPath_2, ...args: import("@trpc/server").ProcedureArgs<import("@trpc/server").inferProcedureParams<TRouter["_def"]["subscriptions"][TPath_2]>>], opts: UseTRPCSubscriptionOptions<inferObservableValue<inferProcedureOutput<TRouter["_def"]["subscriptions"][TPath_2]>>, inferProcedureClientError<TRouter["_def"]["subscriptions"][TPath_2]>>) => void;
|
|
57
|
-
useDehydratedState: UseDehydratedState<TRouter>;
|
|
58
|
-
useInfiniteQuery: <TPath_3 extends inferInfiniteQueryNames<TRouter["_def"]["queries"]> & string>(pathAndInput: [path: TPath_3, input: Omit<inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["input"], "cursor">], opts?: UseTRPCInfiniteQueryOptions<TPath_3, inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["input"], inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["output"], TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCInfiniteQueryResult<inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["output"], TRPCClientErrorLike<TRouter>>;
|
|
59
|
-
};
|
|
60
|
-
export {};
|
|
1
|
+
import { TRPCClientErrorLike } from '@trpc/client';
|
|
2
|
+
import type { AnyRouter, inferProcedureClientError, inferProcedureInput, inferProcedureOutput, ProcedureRecord } from '@trpc/server';
|
|
3
|
+
import { inferObservableValue } from '@trpc/server/observable';
|
|
4
|
+
import { inferTransformedProcedureOutput } from '@trpc/server/shared';
|
|
5
|
+
import { TRPCContextState } from '../../../internals/context';
|
|
6
|
+
import { TRPCUseQueries } from '../../../internals/useQueries';
|
|
7
|
+
import { CreateTRPCReactOptions } from '../../types';
|
|
8
|
+
import { CreateClient, TRPCProvider, UseDehydratedState, UseTRPCInfiniteQueryOptions, UseTRPCInfiniteQueryResult, UseTRPCMutationOptions, UseTRPCMutationResult, UseTRPCQueryOptions, UseTRPCQueryResult, UseTRPCSubscriptionOptions } from '../types';
|
|
9
|
+
type inferInfiniteQueryNames<TObj extends ProcedureRecord> = {
|
|
10
|
+
[TPath in keyof TObj]: inferProcedureInput<TObj[TPath]> extends {
|
|
11
|
+
cursor?: any;
|
|
12
|
+
} ? TPath : never;
|
|
13
|
+
}[keyof TObj];
|
|
14
|
+
type inferProcedures<TObj extends ProcedureRecord> = {
|
|
15
|
+
[TPath in keyof TObj]: {
|
|
16
|
+
input: inferProcedureInput<TObj[TPath]>;
|
|
17
|
+
output: inferTransformedProcedureOutput<TObj[TPath]>;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Hack to infer the type of `createReactQueryHooks`
|
|
22
|
+
* @link https://stackoverflow.com/a/59072991
|
|
23
|
+
*/
|
|
24
|
+
declare class GnClass<TRouter extends AnyRouter, TSSRContext = unknown> {
|
|
25
|
+
fn(): {
|
|
26
|
+
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
27
|
+
createClient: CreateClient<TRouter>;
|
|
28
|
+
useContext: () => TRPCContextState<TRouter, TSSRContext>;
|
|
29
|
+
useQuery: <TPath extends keyof TRouter["_def"]["queries"] & string, TQueryFnData = inferProcedures<TRouter["_def"]["queries"]>[TPath]["output"], TData = inferProcedures<TRouter["_def"]["queries"]>[TPath]["output"]>(pathAndInput: [path: TPath, ...args: import("@trpc/server").ProcedureArgs<import("@trpc/server").inferProcedureParams<TRouter["_def"]["queries"][TPath]>>], opts?: UseTRPCQueryOptions<TPath, inferProcedures<TRouter["_def"]["queries"]>[TPath]["input"], TQueryFnData, TData, TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCQueryResult<TData, TRPCClientErrorLike<TRouter>>;
|
|
30
|
+
useQueries: TRPCUseQueries<TRouter>;
|
|
31
|
+
useMutation: <TPath_1 extends keyof TRouter["_def"]["mutations"] & string, TContext = unknown>(path: TPath_1 | [TPath_1], opts?: UseTRPCMutationOptions<inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["input"], TRPCClientErrorLike<TRouter>, inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["output"], TContext> | undefined) => UseTRPCMutationResult<inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["output"], TRPCClientErrorLike<TRouter>, inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["input"], TContext>;
|
|
32
|
+
useSubscription: <TPath_2 extends keyof TRouter["_def"]["subscriptions"] & string, TOutput extends inferObservableValue<inferProcedureOutput<TRouter["_def"]["subscriptions"][TPath_2]>>>(pathAndInput: [path: TPath_2, ...args: import("@trpc/server").ProcedureArgs<import("@trpc/server").inferProcedureParams<TRouter["_def"]["subscriptions"][TPath_2]>>], opts: UseTRPCSubscriptionOptions<inferObservableValue<inferProcedureOutput<TRouter["_def"]["subscriptions"][TPath_2]>>, inferProcedureClientError<TRouter["_def"]["subscriptions"][TPath_2]>>) => void;
|
|
33
|
+
useDehydratedState: UseDehydratedState<TRouter>;
|
|
34
|
+
useInfiniteQuery: <TPath_3 extends inferInfiniteQueryNames<TRouter["_def"]["queries"]> & string>(pathAndInput: [path: TPath_3, input: Omit<inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["input"], "cursor">], opts?: UseTRPCInfiniteQueryOptions<TPath_3, inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["input"], inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["output"], TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCInfiniteQueryResult<inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["output"], TRPCClientErrorLike<TRouter>>;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
type returnTypeInferer<TType> = TType extends (a: Record<string, string>) => infer U ? U : never;
|
|
38
|
+
type fooType<TRouter extends AnyRouter, TSSRContext = unknown> = GnClass<TRouter, TSSRContext>['fn'];
|
|
39
|
+
/**
|
|
40
|
+
* Infer the type of a `createReactQueryHooks` function
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export type CreateReactQueryHooks<TRouter extends AnyRouter, TSSRContext = unknown> = returnTypeInferer<fooType<TRouter, TSSRContext>>;
|
|
44
|
+
/**
|
|
45
|
+
* Create strongly typed react hooks
|
|
46
|
+
* @internal
|
|
47
|
+
* @deprecated
|
|
48
|
+
*/
|
|
49
|
+
export declare function createHooksInternal<TRouter extends AnyRouter, TSSRContext = unknown>(config?: CreateTRPCReactOptions<TRouter>): {
|
|
50
|
+
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
51
|
+
createClient: CreateClient<TRouter>;
|
|
52
|
+
useContext: () => TRPCContextState<TRouter, TSSRContext>;
|
|
53
|
+
useQuery: <TPath extends keyof TRouter["_def"]["queries"] & string, TQueryFnData = inferProcedures<TRouter["_def"]["queries"]>[TPath]["output"], TData = inferProcedures<TRouter["_def"]["queries"]>[TPath]["output"]>(pathAndInput: [path: TPath, ...args: import("@trpc/server").ProcedureArgs<import("@trpc/server").inferProcedureParams<TRouter["_def"]["queries"][TPath]>>], opts?: UseTRPCQueryOptions<TPath, inferProcedures<TRouter["_def"]["queries"]>[TPath]["input"], TQueryFnData, TData, TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCQueryResult<TData, TRPCClientErrorLike<TRouter>>;
|
|
54
|
+
useQueries: TRPCUseQueries<TRouter>;
|
|
55
|
+
useMutation: <TPath_1 extends keyof TRouter["_def"]["mutations"] & string, TContext = unknown>(path: TPath_1 | [TPath_1], opts?: UseTRPCMutationOptions<inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["input"], TRPCClientErrorLike<TRouter>, inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["output"], TContext> | undefined) => UseTRPCMutationResult<inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["output"], TRPCClientErrorLike<TRouter>, inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["input"], TContext>;
|
|
56
|
+
useSubscription: <TPath_2 extends keyof TRouter["_def"]["subscriptions"] & string, TOutput extends inferObservableValue<inferProcedureOutput<TRouter["_def"]["subscriptions"][TPath_2]>>>(pathAndInput: [path: TPath_2, ...args: import("@trpc/server").ProcedureArgs<import("@trpc/server").inferProcedureParams<TRouter["_def"]["subscriptions"][TPath_2]>>], opts: UseTRPCSubscriptionOptions<inferObservableValue<inferProcedureOutput<TRouter["_def"]["subscriptions"][TPath_2]>>, inferProcedureClientError<TRouter["_def"]["subscriptions"][TPath_2]>>) => void;
|
|
57
|
+
useDehydratedState: UseDehydratedState<TRouter>;
|
|
58
|
+
useInfiniteQuery: <TPath_3 extends inferInfiniteQueryNames<TRouter["_def"]["queries"]> & string>(pathAndInput: [path: TPath_3, input: Omit<inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["input"], "cursor">], opts?: UseTRPCInfiniteQueryOptions<TPath_3, inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["input"], inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["output"], TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCInfiniteQueryResult<inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["output"], TRPCClientErrorLike<TRouter>>;
|
|
59
|
+
};
|
|
60
|
+
export {};
|
|
61
61
|
//# sourceMappingURL=createHooksInternal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHooksInternal.d.ts","sourceRoot":"","sources":["../../../../src/shared/hooks/deprecated/createHooksInternal.tsx"],"names":[],"mappings":"AAWA,OAAO,
|
|
1
|
+
{"version":3,"file":"createHooksInternal.d.ts","sourceRoot":"","sources":["../../../../src/shared/hooks/deprecated/createHooksInternal.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAoB,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,KAAK,EACV,SAAS,EAET,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EAEpB,eAAe,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,EAGL,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AAOpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAE,sBAAsB,EAAuB,MAAM,aAAa,CAAC;AAE1E,OAAO,EACL,YAAY,EACZ,YAAY,EAEZ,kBAAkB,EAClB,2BAA2B,EAC3B,0BAA0B,EAC1B,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,EAC3B,MAAM,UAAU,CAAC;AAElB,KAAK,uBAAuB,CAAC,IAAI,SAAS,eAAe,IAAI;KAC1D,KAAK,IAAI,MAAM,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS;QAC9D,MAAM,CAAC,EAAE,GAAG,CAAC;KACd,GACG,KAAK,GACL,KAAK;CACV,CAAC,MAAM,IAAI,CAAC,CAAC;AAEd,KAAK,eAAe,CAAC,IAAI,SAAS,eAAe,IAAI;KAClD,KAAK,IAAI,MAAM,IAAI,GAAG;QACrB,KAAK,EAAE,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACxC,MAAM,EAAE,+BAA+B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;KACtD;CACF,CAAC;AAshBF;;;GAGG;AACH,cAAM,OAAO,CAAC,OAAO,SAAS,SAAS,EAAE,WAAW,GAAG,OAAO;IAC5D,EAAE;;;;;;;;;;;CAGH;AAED,KAAK,iBAAiB,CAAC,KAAK,IAAI,KAAK,SAAS,CAC5C,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KACtB,MAAM,CAAC,GACR,CAAC,GACD,KAAK,CAAC;AACV,KAAK,OAAO,CAAC,OAAO,SAAS,SAAS,EAAE,WAAW,GAAG,OAAO,IAAI,OAAO,CACtE,OAAO,EACP,WAAW,CACZ,CAAC,IAAI,CAAC,CAAC;AAER;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAC/B,OAAO,SAAS,SAAS,EACzB,WAAW,GAAG,OAAO,IACnB,iBAAiB,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,SAAS,SAAS,EACzB,WAAW,GAAG,OAAO,EACrB,MAAM,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC;;;;;;;;;;EAKzC"}
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import { DefinedUseQueryResult, DehydratedState, InfiniteQueryObserverSuccessResult, InitialDataFunction, QueryObserverSuccessResult, QueryOptions, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import { CreateTRPCClientOptions, TRPCClient, TRPCRequestOptions } from '@trpc/client';
|
|
3
|
-
import { AnyRouter } from '@trpc/server';
|
|
4
|
-
import { ReactNode } from 'react';
|
|
5
|
-
import { TRPCContextProps } from '../../internals/context';
|
|
6
|
-
import { TRPCHookResult } from '../../internals/useHookResult';
|
|
7
|
-
export
|
|
8
|
-
cursor: TCursor | null;
|
|
9
|
-
data: TData;
|
|
10
|
-
};
|
|
11
|
-
export interface TRPCReactRequestOptions extends Omit<TRPCRequestOptions, 'signal'> {
|
|
12
|
-
/**
|
|
13
|
-
* Opt out of SSR for this query by passing `ssr: false`
|
|
14
|
-
*/
|
|
15
|
-
ssr?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Opt out or into aborting request on unmount
|
|
18
|
-
*/
|
|
19
|
-
abortOnUnmount?: boolean;
|
|
20
|
-
}
|
|
21
|
-
export interface TRPCUseQueryBaseOptions {
|
|
22
|
-
/**
|
|
23
|
-
* tRPC-related options
|
|
24
|
-
*/
|
|
25
|
-
trpc?: TRPCReactRequestOptions;
|
|
26
|
-
}
|
|
27
|
-
export interface UseTRPCQueryOptions<TPath, TInput, TOutput, TData, TError> extends UseQueryOptions<TOutput, TError, TData, [TPath, TInput]>, TRPCUseQueryBaseOptions {
|
|
28
|
-
}
|
|
29
|
-
/** @internal **/
|
|
30
|
-
export interface DefinedUseTRPCQueryOptions<TPath, TInput, TOutput, TData, TError> extends UseTRPCQueryOptions<TPath, TInput, TOutput, TData, TError> {
|
|
31
|
-
initialData: TOutput | InitialDataFunction<TOutput>;
|
|
32
|
-
}
|
|
33
|
-
export interface TRPCQueryOptions<TPath, TInput, TData, TError> extends QueryOptions<TData, TError, TData, [TPath, TInput]>, TRPCUseQueryBaseOptions {
|
|
34
|
-
}
|
|
35
|
-
export
|
|
36
|
-
cursor: any;
|
|
37
|
-
} ? TInput['cursor'] : unknown;
|
|
38
|
-
export interface UseTRPCInfiniteQueryOptions<TPath, TInput, TOutput, TError> extends UseInfiniteQueryOptions<TOutput, TError, TOutput, TOutput, [
|
|
39
|
-
TPath,
|
|
40
|
-
Omit<TInput, 'cursor'>
|
|
41
|
-
]>, TRPCUseQueryBaseOptions {
|
|
42
|
-
initialCursor?: ExtractCursorType<TInput>;
|
|
43
|
-
}
|
|
44
|
-
export interface UseTRPCMutationOptions<TInput, TError, TOutput, TContext = unknown> extends UseMutationOptions<TOutput, TError, TInput, TContext>, TRPCUseQueryBaseOptions {
|
|
45
|
-
}
|
|
46
|
-
export interface UseTRPCSubscriptionOptions<TOutput, TError> {
|
|
47
|
-
enabled?: boolean;
|
|
48
|
-
onStarted?: () => void;
|
|
49
|
-
onData: (data: TOutput) => void;
|
|
50
|
-
onError?: (err: TError) => void;
|
|
51
|
-
}
|
|
52
|
-
export interface TRPCProviderProps<TRouter extends AnyRouter, TSSRContext> extends TRPCContextProps<TRouter, TSSRContext> {
|
|
53
|
-
children: ReactNode;
|
|
54
|
-
}
|
|
55
|
-
export
|
|
56
|
-
export
|
|
57
|
-
export
|
|
58
|
-
/**
|
|
59
|
-
* @internal
|
|
60
|
-
*/
|
|
61
|
-
export
|
|
62
|
-
/**
|
|
63
|
-
* @internal
|
|
64
|
-
*/
|
|
65
|
-
export
|
|
66
|
-
/**
|
|
67
|
-
* @internal
|
|
68
|
-
*/
|
|
69
|
-
export
|
|
70
|
-
/**
|
|
71
|
-
* @internal
|
|
72
|
-
*/
|
|
73
|
-
export
|
|
74
|
-
/**
|
|
75
|
-
* @internal
|
|
76
|
-
*/
|
|
77
|
-
export
|
|
78
|
-
/**
|
|
79
|
-
* @internal
|
|
80
|
-
*/
|
|
81
|
-
export
|
|
1
|
+
import { DefinedUseQueryResult, DehydratedState, InfiniteQueryObserverSuccessResult, InitialDataFunction, QueryObserverSuccessResult, QueryOptions, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import { CreateTRPCClientOptions, TRPCClient, TRPCRequestOptions } from '@trpc/client';
|
|
3
|
+
import { AnyRouter } from '@trpc/server';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
import { TRPCContextProps } from '../../internals/context';
|
|
6
|
+
import { TRPCHookResult } from '../../internals/useHookResult';
|
|
7
|
+
export type OutputWithCursor<TData, TCursor = any> = {
|
|
8
|
+
cursor: TCursor | null;
|
|
9
|
+
data: TData;
|
|
10
|
+
};
|
|
11
|
+
export interface TRPCReactRequestOptions extends Omit<TRPCRequestOptions, 'signal'> {
|
|
12
|
+
/**
|
|
13
|
+
* Opt out of SSR for this query by passing `ssr: false`
|
|
14
|
+
*/
|
|
15
|
+
ssr?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Opt out or into aborting request on unmount
|
|
18
|
+
*/
|
|
19
|
+
abortOnUnmount?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface TRPCUseQueryBaseOptions {
|
|
22
|
+
/**
|
|
23
|
+
* tRPC-related options
|
|
24
|
+
*/
|
|
25
|
+
trpc?: TRPCReactRequestOptions;
|
|
26
|
+
}
|
|
27
|
+
export interface UseTRPCQueryOptions<TPath, TInput, TOutput, TData, TError> extends UseQueryOptions<TOutput, TError, TData, [TPath, TInput]>, TRPCUseQueryBaseOptions {
|
|
28
|
+
}
|
|
29
|
+
/** @internal **/
|
|
30
|
+
export interface DefinedUseTRPCQueryOptions<TPath, TInput, TOutput, TData, TError> extends UseTRPCQueryOptions<TPath, TInput, TOutput, TData, TError> {
|
|
31
|
+
initialData: TOutput | InitialDataFunction<TOutput>;
|
|
32
|
+
}
|
|
33
|
+
export interface TRPCQueryOptions<TPath, TInput, TData, TError> extends QueryOptions<TData, TError, TData, [TPath, TInput]>, TRPCUseQueryBaseOptions {
|
|
34
|
+
}
|
|
35
|
+
export type ExtractCursorType<TInput> = TInput extends {
|
|
36
|
+
cursor: any;
|
|
37
|
+
} ? TInput['cursor'] : unknown;
|
|
38
|
+
export interface UseTRPCInfiniteQueryOptions<TPath, TInput, TOutput, TError> extends UseInfiniteQueryOptions<TOutput, TError, TOutput, TOutput, [
|
|
39
|
+
TPath,
|
|
40
|
+
Omit<TInput, 'cursor'>
|
|
41
|
+
]>, TRPCUseQueryBaseOptions {
|
|
42
|
+
initialCursor?: ExtractCursorType<TInput>;
|
|
43
|
+
}
|
|
44
|
+
export interface UseTRPCMutationOptions<TInput, TError, TOutput, TContext = unknown> extends UseMutationOptions<TOutput, TError, TInput, TContext>, TRPCUseQueryBaseOptions {
|
|
45
|
+
}
|
|
46
|
+
export interface UseTRPCSubscriptionOptions<TOutput, TError> {
|
|
47
|
+
enabled?: boolean;
|
|
48
|
+
onStarted?: () => void;
|
|
49
|
+
onData: (data: TOutput) => void;
|
|
50
|
+
onError?: (err: TError) => void;
|
|
51
|
+
}
|
|
52
|
+
export interface TRPCProviderProps<TRouter extends AnyRouter, TSSRContext> extends TRPCContextProps<TRouter, TSSRContext> {
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
}
|
|
55
|
+
export type TRPCProvider<TRouter extends AnyRouter, TSSRContext> = (props: TRPCProviderProps<TRouter, TSSRContext>) => JSX.Element;
|
|
56
|
+
export type UseDehydratedState<TRouter extends AnyRouter> = (client: TRPCClient<TRouter>, trpcState: DehydratedState | undefined) => DehydratedState | undefined;
|
|
57
|
+
export type CreateClient<TRouter extends AnyRouter> = (opts: CreateTRPCClientOptions<TRouter>) => TRPCClient<TRouter>;
|
|
58
|
+
/**
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
export type UseTRPCQueryResult<TData, TError> = UseQueryResult<TData, TError> & TRPCHookResult;
|
|
62
|
+
/**
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
export type DefinedUseTRPCQueryResult<TData, TError> = DefinedUseQueryResult<TData, TError> & TRPCHookResult;
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
export type UseTRPCQuerySuccessResult<TData, TError> = QueryObserverSuccessResult<TData, TError> & TRPCHookResult;
|
|
70
|
+
/**
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
export type UseTRPCInfiniteQueryResult<TData, TError> = UseInfiniteQueryResult<TData, TError> & TRPCHookResult;
|
|
74
|
+
/**
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
export type UseTRPCInfiniteQuerySuccessResult<TData, TError> = InfiniteQueryObserverSuccessResult<TData, TError> & TRPCHookResult;
|
|
78
|
+
/**
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
export type UseTRPCMutationResult<TData, TError, TVariables, TContext> = UseMutationResult<TData, TError, TVariables, TContext> & TRPCHookResult;
|
|
82
82
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,kCAAkC,EAClC,mBAAmB,EACnB,0BAA0B,EAC1B,YAAY,EACZ,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,uBAAuB,EACvB,UAAU,EACV,kBAAkB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB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AE,QAAQ,IACnE,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,GAAG,cAAc,CAAC"}
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
export * from './proxy/decorationProxy';
|
|
2
|
-
export * from './proxy/utilsProxy';
|
|
3
|
-
export * from './proxy/useQueriesProxy';
|
|
4
|
-
export type { DecoratedProcedureRecord, DecorateProcedure, } from '../createTRPCReact';
|
|
5
|
-
export type { TRPCUseQueries } from '../internals/useQueries';
|
|
6
|
-
export * from './hooks/createRootHooks';
|
|
7
|
-
export * from './queryClient';
|
|
8
|
-
export * from './types';
|
|
9
|
-
export * from './hooks/types';
|
|
10
|
-
export * from './polymorphism';
|
|
11
|
-
export {
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated this is an internal function
|
|
14
|
-
*/
|
|
15
|
-
getClientArgs, } from '../internals/getClientArgs';
|
|
16
|
-
export {
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated
|
|
19
|
-
*/
|
|
20
|
-
TRPCContext, } from './../internals/context';
|
|
21
|
-
export * from '../internals/context';
|
|
1
|
+
export * from './proxy/decorationProxy';
|
|
2
|
+
export * from './proxy/utilsProxy';
|
|
3
|
+
export * from './proxy/useQueriesProxy';
|
|
4
|
+
export type { DecoratedProcedureRecord, DecorateProcedure, } from '../createTRPCReact';
|
|
5
|
+
export type { TRPCUseQueries } from '../internals/useQueries';
|
|
6
|
+
export * from './hooks/createRootHooks';
|
|
7
|
+
export * from './queryClient';
|
|
8
|
+
export * from './types';
|
|
9
|
+
export * from './hooks/types';
|
|
10
|
+
export * from './polymorphism';
|
|
11
|
+
export {
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated this is an internal function
|
|
14
|
+
*/
|
|
15
|
+
getClientArgs, } from '../internals/getClientArgs';
|
|
16
|
+
export {
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated
|
|
19
|
+
*/
|
|
20
|
+
TRPCContext, } from './../internals/context';
|
|
21
|
+
export * from '../internals/context';
|
|
22
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/shared/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var createHooksInternal = require('../createHooksInternal-
|
|
5
|
+
var createHooksInternal = require('../createHooksInternal-466f5861.js');
|
|
6
6
|
var queryClient = require('../queryClient-358a9a75.js');
|
|
7
7
|
require('@trpc/server/shared');
|
|
8
8
|
require('../getArrayQueryKey-4bdb5cc2.js');
|
package/dist/shared/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { T as TRPCContext, h as contextProps, c as createHooksInternal, b as createReactProxyDecoration, a as createReactQueryUtilsProxy, f as createRootHooks, e as createUseQueriesProxy, d as getClientArgs } from '../createHooksInternal-
|
|
1
|
+
export { T as TRPCContext, h as contextProps, c as createHooksInternal, b as createReactProxyDecoration, a as createReactQueryUtilsProxy, f as createRootHooks, e as createUseQueriesProxy, d as getClientArgs } from '../createHooksInternal-a6562110.mjs';
|
|
2
2
|
export { g as getQueryClient } from '../queryClient-4d766c0c.mjs';
|
|
3
3
|
import '@trpc/server/shared';
|
|
4
4
|
import '../getArrayQueryKey-86134f8b.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './mutationLike';
|
|
2
|
-
export * from './queryLike';
|
|
3
|
-
export * from './routerLike';
|
|
4
|
-
export * from './utilsLike';
|
|
1
|
+
export * from './mutationLike';
|
|
2
|
+
export * from './queryLike';
|
|
3
|
+
export * from './routerLike';
|
|
4
|
+
export * from './utilsLike';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|