@trpc/react-query 11.0.0-alpha-tmp-export-from-main.212 → 11.0.0-alpha-tmp-export-from-main-nuke-core.236

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 (92) hide show
  1. package/dist/bundle-analysis.json +240 -0
  2. package/dist/createTRPCQueryUtils.d.ts +1 -1
  3. package/dist/createTRPCQueryUtils.d.ts.map +1 -1
  4. package/dist/createTRPCQueryUtils.js +16 -0
  5. package/dist/createTRPCQueryUtils.mjs +14 -0
  6. package/dist/createTRPCReact.d.ts +1 -1
  7. package/dist/createTRPCReact.d.ts.map +1 -1
  8. package/dist/createTRPCReact.js +58 -0
  9. package/dist/createTRPCReact.mjs +36 -0
  10. package/dist/index.js +10 -64
  11. package/dist/index.mjs +3 -40
  12. package/dist/internals/context.d.ts +1 -1
  13. package/dist/internals/context.d.ts.map +1 -1
  14. package/dist/internals/context.js +33 -0
  15. package/dist/internals/context.mjs +11 -0
  16. package/dist/internals/getClientArgs.js +16 -0
  17. package/dist/internals/getClientArgs.mjs +14 -0
  18. package/dist/internals/getQueryKey.d.ts +1 -1
  19. package/dist/internals/getQueryKey.d.ts.map +1 -1
  20. package/dist/internals/getQueryKey.js +57 -0
  21. package/dist/internals/getQueryKey.mjs +54 -0
  22. package/dist/internals/useHookResult.js +32 -0
  23. package/dist/internals/useHookResult.mjs +11 -0
  24. package/dist/internals/useQueries.d.ts +1 -1
  25. package/dist/internals/useQueries.d.ts.map +1 -1
  26. package/dist/server/index.js +2 -102
  27. package/dist/server/index.mjs +1 -103
  28. package/dist/server/ssgProxy.d.ts +1 -1
  29. package/dist/server/ssgProxy.d.ts.map +1 -1
  30. package/dist/server/ssgProxy.js +107 -0
  31. package/dist/server/ssgProxy.mjs +105 -0
  32. package/dist/shared/hooks/createHooksInternal.d.ts +1 -1
  33. package/dist/shared/hooks/createHooksInternal.d.ts.map +1 -1
  34. package/dist/{createHooksInternal-5d2fa367.js → shared/hooks/createHooksInternal.js} +28 -183
  35. package/dist/{createHooksInternal-e0b0564e.mjs → shared/hooks/createHooksInternal.mjs} +8 -158
  36. package/dist/shared/hooks/types.d.ts +1 -1
  37. package/dist/shared/hooks/types.d.ts.map +1 -1
  38. package/dist/shared/index.js +13 -15
  39. package/dist/shared/index.mjs +7 -7
  40. package/dist/shared/polymorphism/mutationLike.d.ts +1 -1
  41. package/dist/shared/polymorphism/mutationLike.d.ts.map +1 -1
  42. package/dist/shared/polymorphism/queryLike.d.ts +1 -1
  43. package/dist/shared/polymorphism/queryLike.d.ts.map +1 -1
  44. package/dist/shared/polymorphism/routerLike.d.ts +1 -1
  45. package/dist/shared/polymorphism/routerLike.d.ts.map +1 -1
  46. package/dist/shared/polymorphism/utilsLike.d.ts +1 -1
  47. package/dist/shared/polymorphism/utilsLike.d.ts.map +1 -1
  48. package/dist/shared/proxy/decorationProxy.d.ts +1 -1
  49. package/dist/shared/proxy/decorationProxy.d.ts.map +1 -1
  50. package/dist/shared/proxy/decorationProxy.js +31 -0
  51. package/dist/shared/proxy/decorationProxy.mjs +29 -0
  52. package/dist/shared/proxy/useQueriesProxy.d.ts +1 -1
  53. package/dist/shared/proxy/useQueriesProxy.d.ts.map +1 -1
  54. package/dist/shared/proxy/useQueriesProxy.js +25 -0
  55. package/dist/shared/proxy/useQueriesProxy.mjs +23 -0
  56. package/dist/shared/proxy/utilsProxy.d.ts +1 -1
  57. package/dist/shared/proxy/utilsProxy.d.ts.map +1 -1
  58. package/dist/shared/proxy/utilsProxy.js +89 -0
  59. package/dist/{utilsProxy-61a4601f.mjs → shared/proxy/utilsProxy.mjs} +4 -52
  60. package/dist/{queryClient-4d766c0c.mjs → shared/queryClient.mjs} +1 -1
  61. package/dist/shared/types.d.ts +1 -1
  62. package/dist/shared/types.d.ts.map +1 -1
  63. package/dist/utils/createUtilityFunctions.d.ts +1 -1
  64. package/dist/utils/createUtilityFunctions.d.ts.map +1 -1
  65. package/dist/utils/createUtilityFunctions.js +94 -0
  66. package/dist/utils/createUtilityFunctions.mjs +92 -0
  67. package/dist/utils/inferReactQueryProcedure.d.ts +1 -1
  68. package/dist/utils/inferReactQueryProcedure.d.ts.map +1 -1
  69. package/package.json +16 -32
  70. package/src/createTRPCQueryUtils.tsx +1 -1
  71. package/src/createTRPCReact.tsx +2 -2
  72. package/src/internals/context.tsx +4 -1
  73. package/src/internals/getQueryKey.ts +20 -2
  74. package/src/internals/useQueries.ts +4 -1
  75. package/src/server/ssgProxy.ts +2 -2
  76. package/src/shared/hooks/createHooksInternal.tsx +1 -1
  77. package/src/shared/hooks/types.ts +4 -1
  78. package/src/shared/polymorphism/mutationLike.ts +1 -1
  79. package/src/shared/polymorphism/queryLike.ts +1 -1
  80. package/src/shared/polymorphism/routerLike.ts +1 -1
  81. package/src/shared/polymorphism/utilsLike.ts +1 -1
  82. package/src/shared/proxy/decorationProxy.ts +2 -2
  83. package/src/shared/proxy/useQueriesProxy.ts +2 -2
  84. package/src/shared/proxy/utilsProxy.ts +5 -2
  85. package/src/shared/types.ts +4 -1
  86. package/src/utils/createUtilityFunctions.ts +1 -1
  87. package/src/utils/inferReactQueryProcedure.ts +1 -1
  88. package/dist/createHooksInternal-4285c71a.js +0 -470
  89. package/dist/queryClient-1c8d7d8a.js +0 -8
  90. package/dist/utilsProxy-0b88c1e3.js +0 -161
  91. package/dist/utilsProxy-ff357a62.js +0 -128
  92. /package/dist/{queryClient-358a9a75.js → shared/queryClient.js} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/react-query",
3
- "version": "11.0.0-alpha-tmp-export-from-main.212+ef58bb670",
3
+ "version": "11.0.0-alpha-tmp-export-from-main-nuke-core.236+40f9e62bb",
4
4
  "description": "The tRPC React library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -23,34 +23,19 @@
23
23
  "exports": {
24
24
  "./package.json": "./package.json",
25
25
  ".": {
26
- "import": {
27
- "types": "./dist/index.d.ts",
28
- "default": "./dist/index.mjs"
29
- },
30
- "require": {
31
- "types": "./dist/index.d.ts",
32
- "default": "./dist/index.js"
33
- }
26
+ "import": "./dist/index.mjs",
27
+ "require": "./dist/index.js",
28
+ "default": "./dist/index.js"
34
29
  },
35
30
  "./server": {
36
- "import": {
37
- "types": "./dist/server/index.d.ts",
38
- "default": "./dist/server/index.mjs"
39
- },
40
- "require": {
41
- "types": "./dist/server/index.d.ts",
42
- "default": "./dist/server/index.js"
43
- }
31
+ "import": "./dist/server/index.mjs",
32
+ "require": "./dist/server/index.js",
33
+ "default": "./dist/server/index.js"
44
34
  },
45
35
  "./shared": {
46
- "import": {
47
- "types": "./dist/shared/index.d.ts",
48
- "default": "./dist/shared/index.mjs"
49
- },
50
- "require": {
51
- "types": "./dist/shared/index.d.ts",
52
- "default": "./dist/shared/index.js"
53
- }
36
+ "import": "./dist/shared/index.mjs",
37
+ "require": "./dist/shared/index.js",
38
+ "default": "./dist/shared/index.js"
54
39
  }
55
40
  },
56
41
  "files": [
@@ -71,18 +56,17 @@
71
56
  ]
72
57
  }
73
58
  },
74
- "dependencies": {
75
- "@trpc/core": "11.0.0-alpha-tmp-export-from-main.212+ef58bb670"
76
- },
77
59
  "peerDependencies": {
78
60
  "@tanstack/react-query": "^5.0.0",
79
- "@trpc/client": "11.0.0-alpha-tmp-export-from-main.212+ef58bb670",
61
+ "@trpc/client": "11.0.0-alpha-tmp-export-from-main-nuke-core.236+40f9e62bb",
62
+ "@trpc/server": "11.0.0-alpha-tmp-export-from-main-nuke-core.236+40f9e62bb",
80
63
  "react": ">=18.2.0",
81
64
  "react-dom": ">=18.2.0"
82
65
  },
83
66
  "devDependencies": {
84
67
  "@tanstack/react-query": "^5.0.0",
85
- "@trpc/client": "11.0.0-alpha-tmp-export-from-main.212+ef58bb670",
68
+ "@trpc/client": "11.0.0-alpha-tmp-export-from-main-nuke-core.236+40f9e62bb",
69
+ "@trpc/server": "11.0.0-alpha-tmp-export-from-main-nuke-core.236+40f9e62bb",
86
70
  "@types/express": "^4.17.17",
87
71
  "@types/node": "^20.10.0",
88
72
  "@types/react": "^18.2.33",
@@ -91,7 +75,7 @@
91
75
  "next": "^14.0.1",
92
76
  "react": "^18.2.0",
93
77
  "react-dom": "^18.2.0",
94
- "rollup": "^2.79.1",
78
+ "rollup": "^4.9.5",
95
79
  "tsx": "^4.0.0",
96
80
  "zod": "^3.0.0"
97
81
  },
@@ -101,5 +85,5 @@
101
85
  "funding": [
102
86
  "https://trpc.io/sponsor"
103
87
  ],
104
- "gitHead": "ef58bb6705e3609f9f24490d8d5df40996ebbbf9"
88
+ "gitHead": "40f9e62bbe0747fb96448f5b68e0ead6f5756885"
105
89
  }
@@ -1,4 +1,4 @@
1
- import type { AnyRouter } from '@trpc/core';
1
+ import type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';
2
2
  import { createQueryUtilsProxy } from './shared';
3
3
  import type { CreateQueryUtilsOptions } from './utils/createUtilityFunctions';
4
4
  import { createUtilityFunctions } from './utils/createUtilityFunctions';
@@ -11,8 +11,8 @@ import type {
11
11
  inferTransformedSubscriptionOutput,
12
12
  ProcedureRouterRecord,
13
13
  ProtectedIntersection,
14
- } from '@trpc/core';
15
- import { createFlatProxy } from '@trpc/core';
14
+ } from '@trpc/server/unstable-core-do-not-import';
15
+ import { createFlatProxy } from '@trpc/server/unstable-core-do-not-import';
16
16
  import * as React from 'react';
17
17
  import type {
18
18
  TRPCUseQueries,
@@ -19,7 +19,10 @@ import type {
19
19
  TRPCRequestOptions,
20
20
  TRPCUntypedClient,
21
21
  } from '@trpc/client';
22
- import type { AnyRouter, DistributiveOmit } from '@trpc/core';
22
+ import type {
23
+ AnyRouter,
24
+ DistributiveOmit,
25
+ } from '@trpc/server/unstable-core-do-not-import';
23
26
  import * as React from 'react';
24
27
  import type { ExtractCursorType } from '../shared';
25
28
  import type { TRPCQueryKey } from './getQueryKey';
@@ -5,7 +5,7 @@ import type {
5
5
  AnyRouter,
6
6
  DeepPartial,
7
7
  inferProcedureInput,
8
- } from '@trpc/core';
8
+ } from '@trpc/server/unstable-core-do-not-import';
9
9
  import type { DecoratedProcedureRecord, DecorateProcedure } from '../shared';
10
10
 
11
11
  export type QueryType = 'any' | 'infinite' | 'query';
@@ -32,10 +32,28 @@ export function getQueryKeyInternal(
32
32
  // some parts of the path may be dot-separated, split them up
33
33
  const splitPath = path.flatMap((part) => part.split('.'));
34
34
 
35
- if (!input && (!type || type === 'any'))
35
+ if (!input && (!type || type === 'any')) {
36
36
  // for `utils.invalidate()` to match all queries (including vanilla react-query)
37
37
  // we don't want nested array if path is empty, i.e. `[]` instead of `[[]]`
38
38
  return splitPath.length ? [splitPath] : ([] as unknown as TRPCQueryKey);
39
+ }
40
+
41
+ if (
42
+ type === 'infinite' &&
43
+ input &&
44
+ typeof input === 'object' &&
45
+ 'cursor' in input
46
+ ) {
47
+ const { cursor: _, ...inputWithoutCursor } = input;
48
+
49
+ return [
50
+ splitPath,
51
+ {
52
+ input: inputWithoutCursor,
53
+ type: 'infinite',
54
+ },
55
+ ];
56
+ }
39
57
  return [
40
58
  splitPath,
41
59
  {
@@ -4,7 +4,10 @@ import type {
4
4
  UseSuspenseQueryOptions,
5
5
  UseSuspenseQueryResult,
6
6
  } from '@tanstack/react-query';
7
- import type { AnyRouter, DistributiveOmit } from '@trpc/core';
7
+ import type {
8
+ AnyRouter,
9
+ DistributiveOmit,
10
+ } from '@trpc/server/unstable-core-do-not-import';
8
11
  import type {
9
12
  UseQueriesProcedureRecord,
10
13
  UseSuspenseQueriesProcedureRecord,
@@ -19,12 +19,12 @@ import type {
19
19
  inferTransformedProcedureOutput,
20
20
  Maybe,
21
21
  ProtectedIntersection,
22
- } from '@trpc/core';
22
+ } from '@trpc/server/unstable-core-do-not-import';
23
23
  import {
24
24
  callProcedure,
25
25
  createFlatProxy,
26
26
  createRecursiveProxy,
27
- } from '@trpc/core';
27
+ } from '@trpc/server/unstable-core-do-not-import';
28
28
  import { getQueryKeyInternal } from '../internals/getQueryKey';
29
29
  import type {
30
30
  CreateTRPCReactQueryClientConfig,
@@ -12,7 +12,7 @@ import {
12
12
  } from '@tanstack/react-query';
13
13
  import type { TRPCClientErrorLike } from '@trpc/client';
14
14
  import { createTRPCUntypedClient } from '@trpc/client';
15
- import type { AnyRouter } from '@trpc/core';
15
+ import type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';
16
16
  import * as React from 'react';
17
17
  import type { SSRState, TRPCContextState } from '../../internals/context';
18
18
  import { TRPCContext } from '../../internals/context';
@@ -22,7 +22,10 @@ import type {
22
22
  TRPCRequestOptions,
23
23
  TRPCUntypedClient,
24
24
  } from '@trpc/client';
25
- import type { AnyRouter, DistributiveOmit } from '@trpc/core';
25
+ import type {
26
+ AnyRouter,
27
+ DistributiveOmit,
28
+ } from '@trpc/server/unstable-core-do-not-import';
26
29
  import type { ReactNode } from 'react';
27
30
  import type { TRPCContextProps } from '../../internals/context';
28
31
  import type { TRPCQueryKey } from '../../internals/getQueryKey';
@@ -3,7 +3,7 @@ import type {
3
3
  AnyRootConfig,
4
4
  inferProcedureInput,
5
5
  inferTransformedProcedureOutput,
6
- } from '@trpc/core';
6
+ } from '@trpc/server/unstable-core-do-not-import';
7
7
  import type {
8
8
  InferMutationOptions,
9
9
  InferMutationResult,
@@ -5,7 +5,7 @@ import type {
5
5
  inferProcedureInput,
6
6
  inferProcedureOutput,
7
7
  inferTransformedProcedureOutput,
8
- } from '@trpc/core';
8
+ } from '@trpc/server/unstable-core-do-not-import';
9
9
  import type {
10
10
  InferQueryOptions,
11
11
  InferQueryResult,
@@ -4,7 +4,7 @@ import type {
4
4
  AnyQueryProcedure,
5
5
  AnyRootConfig,
6
6
  AnyRouter,
7
- } from '@trpc/core';
7
+ } from '@trpc/server/unstable-core-do-not-import';
8
8
  import type { MutationLike } from './mutationLike';
9
9
  import type { QueryLike } from './queryLike';
10
10
 
@@ -1,4 +1,4 @@
1
- import type { AnyRouter } from '@trpc/core';
1
+ import type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';
2
2
  import type { DecoratedProcedureUtilsRecord } from '../proxy/utilsProxy';
3
3
 
4
4
  /**
@@ -1,5 +1,5 @@
1
- import type { AnyRouter } from '@trpc/core';
2
- import { createRecursiveProxy } from '@trpc/core';
1
+ import type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';
2
+ import { createRecursiveProxy } from '@trpc/server/unstable-core-do-not-import';
3
3
  import type { CreateReactQueryHooks } from '../hooks/createHooksInternal';
4
4
 
5
5
  /**
@@ -8,8 +8,8 @@ import type {
8
8
  Filter,
9
9
  inferProcedureInput,
10
10
  inferTransformedProcedureOutput,
11
- } from '@trpc/core';
12
- import { createRecursiveProxy } from '@trpc/core';
11
+ } from '@trpc/server/unstable-core-do-not-import';
12
+ import { createRecursiveProxy } from '@trpc/server/unstable-core-do-not-import';
13
13
  import { getQueryKeyInternal } from '../../internals/getQueryKey';
14
14
  import type {
15
15
  TrpcQueryOptionsForUseQueries,
@@ -21,8 +21,11 @@ import type {
21
21
  inferProcedureInput,
22
22
  inferTransformedProcedureOutput,
23
23
  ProtectedIntersection,
24
- } from '@trpc/core';
25
- import { createFlatProxy, createRecursiveProxy } from '@trpc/core';
24
+ } from '@trpc/server/unstable-core-do-not-import';
25
+ import {
26
+ createFlatProxy,
27
+ createRecursiveProxy,
28
+ } from '@trpc/server/unstable-core-do-not-import';
26
29
  import type {
27
30
  DecoratedTRPCContextProps,
28
31
  TRPCContextState,
@@ -1,5 +1,8 @@
1
1
  import type { QueryClient } from '@tanstack/react-query';
2
- import type { AnyRouter, MaybePromise } from '@trpc/core';
2
+ import type {
3
+ AnyRouter,
4
+ MaybePromise,
5
+ } from '@trpc/server/unstable-core-do-not-import';
3
6
 
4
7
  /**
5
8
  * @internal
@@ -1,7 +1,7 @@
1
1
  import type { QueryClient } from '@tanstack/react-query';
2
2
  import type { CreateTRPCClient } from '@trpc/client';
3
3
  import { getUntypedClient, TRPCUntypedClient } from '@trpc/client';
4
- import type { AnyRouter } from '@trpc/core';
4
+ import type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';
5
5
  import { getClientArgs } from '../internals/getClientArgs';
6
6
  import type { TRPCQueryUtils } from '../shared';
7
7
 
@@ -7,7 +7,7 @@ import type {
7
7
  AnyRouter,
8
8
  inferProcedureInput,
9
9
  inferTransformedProcedureOutput,
10
- } from '@trpc/core';
10
+ } from '@trpc/server/unstable-core-do-not-import';
11
11
  import type {
12
12
  UseTRPCMutationOptions,
13
13
  UseTRPCMutationResult,