@trpc/react-query 11.0.0-alpha-tmp.233 → 11.0.0-alpha-tmp-v11-trpc-sveltekit.191

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +4 -4
  2. package/dist/bundle-analysis.json +33 -33
  3. package/dist/{createHooksInternal-7ec4d77f.js → createHooksInternal-5cb13e16.js} +1 -1
  4. package/dist/{createHooksInternal-e15b2117.js → createHooksInternal-6c0232d7.js} +1 -1
  5. package/dist/{createHooksInternal-99f56cf8.mjs → createHooksInternal-df9ecb1f.mjs} +1 -1
  6. package/dist/createTRPCQueryUtils.d.ts +2 -2
  7. package/dist/createTRPCQueryUtils.d.ts.map +1 -1
  8. package/dist/createTRPCReact.d.ts +15 -15
  9. package/dist/createTRPCReact.d.ts.map +1 -1
  10. package/dist/index.js +2 -2
  11. package/dist/index.mjs +3 -3
  12. package/dist/internals/context.d.ts +5 -6
  13. package/dist/internals/context.d.ts.map +1 -1
  14. package/dist/internals/getClientArgs.d.ts +1 -1
  15. package/dist/internals/getClientArgs.d.ts.map +1 -1
  16. package/dist/internals/getQueryKey.d.ts +3 -3
  17. package/dist/internals/getQueryKey.d.ts.map +1 -1
  18. package/dist/internals/useQueries.d.ts +3 -3
  19. package/dist/internals/useQueries.d.ts.map +1 -1
  20. package/dist/server/index.js +2 -2
  21. package/dist/server/index.mjs +2 -2
  22. package/dist/server/ssgProxy.d.ts +6 -5
  23. package/dist/server/ssgProxy.d.ts.map +1 -1
  24. package/dist/shared/hooks/createHooksInternal.d.ts +5 -5
  25. package/dist/shared/hooks/createHooksInternal.d.ts.map +1 -1
  26. package/dist/shared/hooks/types.d.ts +7 -7
  27. package/dist/shared/hooks/types.d.ts.map +1 -1
  28. package/dist/shared/index.js +2 -2
  29. package/dist/shared/index.mjs +2 -2
  30. package/dist/shared/polymorphism/mutationLike.d.ts +2 -2
  31. package/dist/shared/polymorphism/mutationLike.d.ts.map +1 -1
  32. package/dist/shared/polymorphism/queryLike.d.ts +5 -2
  33. package/dist/shared/polymorphism/queryLike.d.ts.map +1 -1
  34. package/dist/shared/polymorphism/routerLike.d.ts +3 -3
  35. package/dist/shared/polymorphism/routerLike.d.ts.map +1 -1
  36. package/dist/shared/polymorphism/utilsLike.d.ts +2 -2
  37. package/dist/shared/polymorphism/utilsLike.d.ts.map +1 -1
  38. package/dist/shared/proxy/decorationProxy.d.ts +2 -2
  39. package/dist/shared/proxy/decorationProxy.d.ts.map +1 -1
  40. package/dist/shared/proxy/useQueriesProxy.d.ts +3 -3
  41. package/dist/shared/proxy/useQueriesProxy.d.ts.map +1 -1
  42. package/dist/shared/proxy/utilsProxy.d.ts +6 -6
  43. package/dist/shared/proxy/utilsProxy.d.ts.map +1 -1
  44. package/dist/shared/queryClient.d.ts +2 -1
  45. package/dist/shared/queryClient.d.ts.map +1 -1
  46. package/dist/shared/types.d.ts +2 -2
  47. package/dist/shared/types.d.ts.map +1 -1
  48. package/dist/utils/createUtilityFunctions.d.ts +5 -4
  49. package/dist/utils/createUtilityFunctions.d.ts.map +1 -1
  50. package/dist/utils/inferReactQueryProcedure.d.ts +3 -3
  51. package/dist/utils/inferReactQueryProcedure.d.ts.map +1 -1
  52. package/dist/{utilsProxy-e4c93b46.mjs → utilsProxy-5402e992.mjs} +1 -1
  53. package/dist/{utilsProxy-003891dc.js → utilsProxy-c08ebe6e.js} +1 -1
  54. package/dist/{utilsProxy-aa151f2c.js → utilsProxy-f0fe7c68.js} +1 -1
  55. package/package.json +6 -6
  56. package/src/createTRPCQueryUtils.tsx +3 -5
  57. package/src/createTRPCReact.tsx +21 -23
  58. package/src/internals/context.tsx +5 -6
  59. package/src/internals/getClientArgs.ts +1 -1
  60. package/src/internals/getQueryKey.ts +3 -3
  61. package/src/internals/useQueries.ts +3 -3
  62. package/src/server/ssgProxy.ts +13 -16
  63. package/src/shared/hooks/createHooksInternal.tsx +10 -11
  64. package/src/shared/hooks/types.ts +7 -7
  65. package/src/shared/polymorphism/mutationLike.ts +2 -2
  66. package/src/shared/polymorphism/queryLike.ts +13 -2
  67. package/src/shared/polymorphism/routerLike.ts +3 -3
  68. package/src/shared/polymorphism/utilsLike.ts +2 -2
  69. package/src/shared/proxy/decorationProxy.ts +3 -2
  70. package/src/shared/proxy/useQueriesProxy.ts +6 -6
  71. package/src/shared/proxy/utilsProxy.ts +10 -13
  72. package/src/shared/queryClient.ts +2 -1
  73. package/src/shared/types.ts +2 -2
  74. package/src/utils/createUtilityFunctions.ts +5 -8
  75. package/src/utils/inferReactQueryProcedure.ts +3 -3
@@ -1,24 +1,17 @@
1
- import {
2
- dehydrate,
1
+ import type {
3
2
  DehydratedState,
4
3
  DehydrateOptions,
5
4
  InfiniteData,
6
5
  QueryClient,
7
6
  } from '@tanstack/react-query';
8
- import {
9
- getUntypedClient,
10
- inferRouterClient,
11
- TRPCClientError,
12
- TRPCUntypedClient,
13
- } from '@trpc/client';
14
- import {
7
+ import { dehydrate } from '@tanstack/react-query';
8
+ import type { inferRouterClient, TRPCClientError } from '@trpc/client';
9
+ import { getUntypedClient, TRPCUntypedClient } from '@trpc/client';
10
+ import type {
15
11
  AnyProcedure,
16
12
  AnyQueryProcedure,
17
13
  AnyRootConfig,
18
14
  AnyRouter,
19
- callProcedure,
20
- createFlatProxy,
21
- createRecursiveProxy,
22
15
  DataTransformerOptions,
23
16
  Filter,
24
17
  inferProcedureInput,
@@ -27,15 +20,19 @@ import {
27
20
  Maybe,
28
21
  ProtectedIntersection,
29
22
  } from '@trpc/core';
30
- import { getQueryKeyInternal } from '../internals/getQueryKey';
31
23
  import {
24
+ callProcedure,
25
+ createFlatProxy,
26
+ createRecursiveProxy,
27
+ } from '@trpc/core';
28
+ import { getQueryKeyInternal } from '../internals/getQueryKey';
29
+ import type {
32
30
  CreateTRPCReactQueryClientConfig,
33
31
  ExtractCursorType,
34
- getQueryClient,
35
- getQueryType,
36
32
  TRPCFetchInfiniteQueryOptions,
37
33
  TRPCFetchQueryOptions,
38
34
  } from '../shared';
35
+ import { getQueryClient, getQueryType } from '../shared';
39
36
 
40
37
  interface CreateSSGHelpersInternal<TRouter extends AnyRouter> {
41
38
  router: TRouter;
@@ -127,7 +124,7 @@ type AnyDecoratedProcedure = DecorateProcedure<any, any>;
127
124
 
128
125
  /**
129
126
  * Create functions you can use for server-side rendering / static generation
130
- * @see https://trpc.io/docs/client/nextjs/server-side-helpers
127
+ * @link https://trpc.io/docs/v11/client/nextjs/server-side-helpers
131
128
  */
132
129
  export function createServerSideHelpers<TRouter extends AnyRouter>(
133
130
  opts: CreateServerSideHelpersOptions<TRouter>,
@@ -1,3 +1,4 @@
1
+ import type { DehydratedState } from '@tanstack/react-query';
1
2
  import {
2
3
  useInfiniteQuery as __useInfiniteQuery,
3
4
  useMutation as __useMutation,
@@ -6,29 +7,27 @@ import {
6
7
  useSuspenseInfiniteQuery as __useSuspenseInfiniteQuery,
7
8
  useSuspenseQueries as __useSuspenseQueries,
8
9
  useSuspenseQuery as __useSuspenseQuery,
9
- DehydratedState,
10
10
  hashKey,
11
11
  useQueryClient,
12
12
  } from '@tanstack/react-query';
13
- import { createTRPCUntypedClient, TRPCClientErrorLike } from '@trpc/client';
13
+ import type { TRPCClientErrorLike } from '@trpc/client';
14
+ import { createTRPCUntypedClient } from '@trpc/client';
14
15
  import type { AnyRouter } from '@trpc/core';
15
16
  import React, { useEffect, useMemo, useRef, useState } from 'react';
16
- import {
17
- SSRState,
18
- TRPCContext,
19
- TRPCContextState,
20
- } from '../../internals/context';
17
+ import type { SSRState, TRPCContextState } from '../../internals/context';
18
+ import { TRPCContext } from '../../internals/context';
21
19
  import { getClientArgs } from '../../internals/getClientArgs';
22
- import { getQueryKeyInternal, TRPCQueryKey } from '../../internals/getQueryKey';
20
+ import type { TRPCQueryKey } from '../../internals/getQueryKey';
21
+ import { getQueryKeyInternal } from '../../internals/getQueryKey';
23
22
  import { useHookResult } from '../../internals/useHookResult';
24
- import {
23
+ import type {
25
24
  TRPCUseQueries,
26
25
  TRPCUseSuspenseQueries,
27
26
  } from '../../internals/useQueries';
28
27
  import { createUtilityFunctions } from '../../utils/createUtilityFunctions';
29
28
  import { createUseQueries } from '../proxy/useQueriesProxy';
30
- import { CreateTRPCReactOptions, UseMutationOverride } from '../types';
31
- import {
29
+ import type { CreateTRPCReactOptions, UseMutationOverride } from '../types';
30
+ import type {
32
31
  CreateClient,
33
32
  TRPCProvider,
34
33
  TRPCQueryOptions,
@@ -1,4 +1,4 @@
1
- import {
1
+ import type {
2
2
  DefinedUseQueryResult,
3
3
  DehydratedState,
4
4
  InfiniteData,
@@ -17,16 +17,16 @@ import {
17
17
  UseSuspenseQueryOptions,
18
18
  UseSuspenseQueryResult,
19
19
  } from '@tanstack/react-query';
20
- import {
20
+ import type {
21
21
  CreateTRPCClientOptions,
22
22
  TRPCRequestOptions,
23
23
  TRPCUntypedClient,
24
24
  } from '@trpc/client';
25
- import { AnyRouter, DistributiveOmit } from '@trpc/core';
26
- import { ReactNode } from 'react';
27
- import { TRPCContextProps } from '../../internals/context';
28
- import { TRPCQueryKey } from '../../internals/getQueryKey';
29
- import { TRPCHookResult } from '../../internals/useHookResult';
25
+ import type { AnyRouter, DistributiveOmit } from '@trpc/core';
26
+ import type { ReactNode } from 'react';
27
+ import type { TRPCContextProps } from '../../internals/context';
28
+ import type { TRPCQueryKey } from '../../internals/getQueryKey';
29
+ import type { TRPCHookResult } from '../../internals/useHookResult';
30
30
 
31
31
  export type OutputWithCursor<TData, TCursor = any> = {
32
32
  cursor: TCursor | null;
@@ -1,10 +1,10 @@
1
- import {
1
+ import type {
2
2
  AnyProcedure,
3
3
  AnyRootConfig,
4
4
  inferProcedureInput,
5
5
  inferTransformedProcedureOutput,
6
6
  } from '@trpc/core';
7
- import {
7
+ import type {
8
8
  InferMutationOptions,
9
9
  InferMutationResult,
10
10
  } from '../../utils/inferReactQueryProcedure';
@@ -1,13 +1,16 @@
1
- import {
1
+ import type { TRPCClientErrorLike } from '@trpc/client';
2
+ import type {
2
3
  AnyProcedure,
3
4
  AnyRootConfig,
4
5
  inferProcedureInput,
6
+ inferProcedureOutput,
5
7
  inferTransformedProcedureOutput,
6
8
  } from '@trpc/core';
7
- import {
9
+ import type {
8
10
  InferQueryOptions,
9
11
  InferQueryResult,
10
12
  } from '../../utils/inferReactQueryProcedure';
13
+ import type { UseTRPCSuspenseQueryResult } from '../hooks/types';
11
14
 
12
15
  /**
13
16
  * Use to request a query route which matches a given query procedure's interface
@@ -20,6 +23,14 @@ export type QueryLike<
20
23
  variables: inferProcedureInput<TProcedure>,
21
24
  opts?: InferQueryOptions<TConfig, TProcedure, any>,
22
25
  ) => InferQueryResult<TConfig, TProcedure>;
26
+
27
+ useSuspenseQuery: (
28
+ variables: inferProcedureInput<TProcedure>,
29
+ opts?: InferQueryOptions<TConfig, TProcedure, any>,
30
+ ) => UseTRPCSuspenseQueryResult<
31
+ inferProcedureOutput<TProcedure>,
32
+ TRPCClientErrorLike<TConfig>
33
+ >;
23
34
  };
24
35
 
25
36
  /**
@@ -1,12 +1,12 @@
1
- import {
1
+ import type {
2
2
  AnyMutationProcedure,
3
3
  AnyProcedure,
4
4
  AnyQueryProcedure,
5
5
  AnyRootConfig,
6
6
  AnyRouter,
7
7
  } from '@trpc/core';
8
- import { MutationLike } from './mutationLike';
9
- import { QueryLike } from './queryLike';
8
+ import type { MutationLike } from './mutationLike';
9
+ import type { QueryLike } from './queryLike';
10
10
 
11
11
  /**
12
12
  * Use to describe a route path which matches a given route's interface
@@ -1,5 +1,5 @@
1
- import { AnyRouter } from '@trpc/core';
2
- import { DecoratedProcedureUtilsRecord } from '../proxy/utilsProxy';
1
+ import type { AnyRouter } from '@trpc/core';
2
+ import type { DecoratedProcedureUtilsRecord } from '../proxy/utilsProxy';
3
3
 
4
4
  /**
5
5
  * Use to describe a Utils/Context path which matches the given route's interface
@@ -1,5 +1,6 @@
1
- import { AnyRouter, createRecursiveProxy } from '@trpc/core';
2
- import { CreateReactQueryHooks } from '../hooks/createHooksInternal';
1
+ import type { AnyRouter } from '@trpc/core';
2
+ import { createRecursiveProxy } from '@trpc/core';
3
+ import type { CreateReactQueryHooks } from '../hooks/createHooksInternal';
3
4
 
4
5
  /**
5
6
  * Create proxy for decorating procedures
@@ -1,21 +1,21 @@
1
- import { QueryOptions } from '@tanstack/react-query';
2
- import { TRPCClientError, TRPCUntypedClient } from '@trpc/client';
3
- import {
1
+ import type { QueryOptions } from '@tanstack/react-query';
2
+ import type { TRPCClientError, TRPCUntypedClient } from '@trpc/client';
3
+ import type {
4
4
  AnyProcedure,
5
5
  AnyQueryProcedure,
6
6
  AnyRootConfig,
7
7
  AnyRouter,
8
- createRecursiveProxy,
9
8
  Filter,
10
9
  inferProcedureInput,
11
10
  inferTransformedProcedureOutput,
12
11
  } from '@trpc/core';
12
+ import { createRecursiveProxy } from '@trpc/core';
13
13
  import { getQueryKeyInternal } from '../../internals/getQueryKey';
14
- import {
14
+ import type {
15
15
  TrpcQueryOptionsForUseQueries,
16
16
  TrpcQueryOptionsForUseSuspenseQueries,
17
17
  } from '../../internals/useQueries';
18
- import { TRPCUseQueryBaseOptions } from '../hooks/types';
18
+ import type { TRPCUseQueryBaseOptions } from '../hooks/types';
19
19
 
20
20
  type GetQueryOptions<
21
21
  TConfig extends AnyRootConfig,
@@ -1,4 +1,4 @@
1
- import {
1
+ import type {
2
2
  CancelOptions,
3
3
  InfiniteData,
4
4
  InvalidateOptions,
@@ -10,33 +10,30 @@ import {
10
10
  SetDataOptions,
11
11
  Updater,
12
12
  } from '@tanstack/react-query';
13
- import { createTRPCClientProxy, TRPCClientError } from '@trpc/client';
14
- import {
13
+ import type { TRPCClientError } from '@trpc/client';
14
+ import { createTRPCClientProxy } from '@trpc/client';
15
+ import type {
15
16
  AnyQueryProcedure,
16
17
  AnyRootConfig,
17
18
  AnyRouter,
18
- createFlatProxy,
19
- createRecursiveProxy,
20
19
  DeepPartial,
21
20
  Filter,
22
21
  inferProcedureInput,
23
22
  inferTransformedProcedureOutput,
24
23
  ProtectedIntersection,
25
24
  } from '@trpc/core';
26
- import {
27
- contextProps,
25
+ import { createFlatProxy, createRecursiveProxy } from '@trpc/core';
26
+ import type {
28
27
  DecoratedTRPCContextProps,
29
28
  TRPCContextState,
30
29
  TRPCFetchInfiniteQueryOptions,
31
30
  TRPCFetchQueryOptions,
32
31
  TRPCQueryUtils,
33
32
  } from '../../internals/context';
34
- import {
35
- getQueryKeyInternal,
36
- QueryKeyKnown,
37
- QueryType,
38
- } from '../../internals/getQueryKey';
39
- import { ExtractCursorType } from '../hooks/types';
33
+ import { contextProps } from '../../internals/context';
34
+ import type { QueryKeyKnown, QueryType } from '../../internals/getQueryKey';
35
+ import { getQueryKeyInternal } from '../../internals/getQueryKey';
36
+ import type { ExtractCursorType } from '../hooks/types';
40
37
 
41
38
  type DecorateProcedure<
42
39
  TConfig extends AnyRootConfig,
@@ -1,4 +1,5 @@
1
- import { QueryClient, QueryClientConfig } from '@tanstack/react-query';
1
+ import type { QueryClientConfig } from '@tanstack/react-query';
2
+ import { QueryClient } from '@tanstack/react-query';
2
3
 
3
4
  /**
4
5
  * @internal
@@ -1,5 +1,5 @@
1
- import { QueryClient } from '@tanstack/react-query';
2
- import { AnyRouter, MaybePromise } from '@trpc/core';
1
+ import type { QueryClient } from '@tanstack/react-query';
2
+ import type { AnyRouter, MaybePromise } from '@trpc/core';
3
3
 
4
4
  /**
5
5
  * @internal
@@ -1,12 +1,9 @@
1
- import { QueryClient } from '@tanstack/react-query';
2
- import {
3
- CreateTRPCClient,
4
- getUntypedClient,
5
- TRPCUntypedClient,
6
- } from '@trpc/client';
7
- import { AnyRouter } from '@trpc/core';
1
+ import type { QueryClient } from '@tanstack/react-query';
2
+ import type { CreateTRPCClient } from '@trpc/client';
3
+ import { getUntypedClient, TRPCUntypedClient } from '@trpc/client';
4
+ import type { AnyRouter } from '@trpc/core';
8
5
  import { getClientArgs } from '../internals/getClientArgs';
9
- import { TRPCQueryUtils } from '../shared';
6
+ import type { TRPCQueryUtils } from '../shared';
10
7
 
11
8
  export interface CreateQueryUtilsOptions<TRouter extends AnyRouter> {
12
9
  /**
@@ -1,5 +1,5 @@
1
- import { TRPCClientErrorLike } from '@trpc/client';
2
- import {
1
+ import type { TRPCClientErrorLike } from '@trpc/client';
2
+ import type {
3
3
  AnyMutationProcedure,
4
4
  AnyProcedure,
5
5
  AnyQueryProcedure,
@@ -8,7 +8,7 @@ import {
8
8
  inferProcedureInput,
9
9
  inferTransformedProcedureOutput,
10
10
  } from '@trpc/core';
11
- import {
11
+ import type {
12
12
  UseTRPCMutationOptions,
13
13
  UseTRPCMutationResult,
14
14
  UseTRPCQueryOptions,