@trpc/react-query 10.35.0 → 10.36.0
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/dist/server/index.js +1 -1
- package/dist/server/index.mjs +2 -2
- package/dist/server/types.d.ts +2 -2
- package/dist/server/types.d.ts.map +1 -1
- package/dist/ssg/ssg.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/server/types.ts +10 -2
- package/src/ssg/ssg.ts +5 -2
package/dist/server/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var queryClient = require('../queryClient-358a9a75.js');
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
const { client: client$1 } = opts;
|
|
35
|
-
const untypedClient = client.getUntypedClient(client$1);
|
|
35
|
+
const untypedClient = client$1 instanceof client.TRPCUntypedClient ? client$1 : client.getUntypedClient(client$1);
|
|
36
36
|
return {
|
|
37
37
|
query: (queryOpts)=>untypedClient.query(queryOpts.path, queryOpts.input),
|
|
38
38
|
serialize: (obj)=>untypedClient.runtime.transformer.serialize(obj)
|
package/dist/server/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createFlatProxy, createRecursiveProxy } from '@trpc/server/shared';
|
|
2
2
|
import { dehydrate } from '@tanstack/react-query';
|
|
3
|
-
import { getUntypedClient } from '@trpc/client';
|
|
3
|
+
import { TRPCUntypedClient, getUntypedClient } from '@trpc/client';
|
|
4
4
|
import { callProcedure } from '@trpc/server';
|
|
5
5
|
import { g as getArrayQueryKey } from '../getArrayQueryKey-86134f8b.mjs';
|
|
6
6
|
import 'react';
|
|
@@ -28,7 +28,7 @@ import { g as getQueryClient } from '../queryClient-4d766c0c.mjs';
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
const { client } = opts;
|
|
31
|
-
const untypedClient = getUntypedClient(client);
|
|
31
|
+
const untypedClient = client instanceof TRPCUntypedClient ? client : getUntypedClient(client);
|
|
32
32
|
return {
|
|
33
33
|
query: (queryOpts)=>untypedClient.query(queryOpts.path, queryOpts.input),
|
|
34
34
|
serialize: (obj)=>untypedClient.runtime.transformer.serialize(obj)
|
package/dist/server/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inferRouterProxyClient } from '@trpc/client';
|
|
1
|
+
import { inferRouterProxyClient, TRPCClient, TRPCUntypedClient } from '@trpc/client';
|
|
2
2
|
import { AnyRouter, ClientDataTransformerOptions, inferRouterContext } from '@trpc/server';
|
|
3
3
|
import { CreateTRPCReactQueryClientConfig } from '../shared';
|
|
4
4
|
interface CreateSSGHelpersInternal<TRouter extends AnyRouter> {
|
|
@@ -7,7 +7,7 @@ interface CreateSSGHelpersInternal<TRouter extends AnyRouter> {
|
|
|
7
7
|
transformer?: ClientDataTransformerOptions;
|
|
8
8
|
}
|
|
9
9
|
interface CreateSSGHelpersExternal<TRouter extends AnyRouter> {
|
|
10
|
-
client: inferRouterProxyClient<TRouter>;
|
|
10
|
+
client: inferRouterProxyClient<TRouter> | TRPCUntypedClient<TRouter> | TRPCClient<TRouter>;
|
|
11
11
|
}
|
|
12
12
|
export type CreateServerSideHelpersOptions<TRouter extends AnyRouter> = CreateTRPCReactQueryClientConfig & (CreateSSGHelpersExternal<TRouter> | CreateSSGHelpersInternal<TRouter>);
|
|
13
13
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,UAAU,EACV,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,SAAS,EACT,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gCAAgC,EAAE,MAAM,WAAW,CAAC;AAE7D,UAAU,wBAAwB,CAAC,OAAO,SAAS,SAAS;IAC1D,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACjC,WAAW,CAAC,EAAE,4BAA4B,CAAC;CAC5C;AAED,UAAU,wBAAwB,CAAC,OAAO,SAAS,SAAS;IAC1D,MAAM,EACF,sBAAsB,CAAC,OAAO,CAAC,GAC/B,iBAAiB,CAAC,OAAO,CAAC,GAE1B,UAAU,CAAC,OAAO,CAAC,CAAC;CACzB;AAED,MAAM,MAAM,8BAA8B,CAAC,OAAO,SAAS,SAAS,IAClE,gCAAgC,GAC9B,CAAC,wBAAwB,CAAC,OAAO,CAAC,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC"}
|
package/dist/ssg/ssg.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssg.d.ts","sourceRoot":"","sources":["../../src/ssg/ssg.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,gBAAgB,EAChB,YAAY,EACb,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,SAAS,EAET,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AAGjE;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,SAAS,EACxD,IAAI,EAAE,8BAA8B,CAAC,OAAO,CAAC;;;;;
|
|
1
|
+
{"version":3,"file":"ssg.d.ts","sourceRoot":"","sources":["../../src/ssg/ssg.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,gBAAgB,EAChB,YAAY,EACb,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,SAAS,EAET,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AAGjE;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,SAAS,EACxD,IAAI,EAAE,8BAA8B,CAAC,OAAO,CAAC;;;;;uBA+FrC,gBAAgB,KAMrB,eAAe;;EAenB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/react-query",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.36.0",
|
|
4
4
|
"description": "The tRPC React library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,15 +64,15 @@
|
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@tanstack/react-query": "^4.18.0",
|
|
67
|
-
"@trpc/client": "10.
|
|
68
|
-
"@trpc/server": "10.
|
|
67
|
+
"@trpc/client": "10.36.0",
|
|
68
|
+
"@trpc/server": "10.36.0",
|
|
69
69
|
"react": ">=16.8.0",
|
|
70
70
|
"react-dom": ">=16.8.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@tanstack/react-query": "^4.18.0",
|
|
74
|
-
"@trpc/client": "10.
|
|
75
|
-
"@trpc/server": "10.
|
|
74
|
+
"@trpc/client": "10.36.0",
|
|
75
|
+
"@trpc/server": "10.36.0",
|
|
76
76
|
"@types/express": "^4.17.17",
|
|
77
77
|
"@types/node": "^18.16.16",
|
|
78
78
|
"@types/react": "^18.2.8",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"funding": [
|
|
92
92
|
"https://trpc.io/sponsor"
|
|
93
93
|
],
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "72b35dfc9ef2f33f15c87e8200414716cab5ee8c"
|
|
95
95
|
}
|
package/src/server/types.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
inferRouterProxyClient,
|
|
3
|
+
TRPCClient,
|
|
4
|
+
TRPCUntypedClient,
|
|
5
|
+
} from '@trpc/client';
|
|
2
6
|
import {
|
|
3
7
|
AnyRouter,
|
|
4
8
|
ClientDataTransformerOptions,
|
|
@@ -13,7 +17,11 @@ interface CreateSSGHelpersInternal<TRouter extends AnyRouter> {
|
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
interface CreateSSGHelpersExternal<TRouter extends AnyRouter> {
|
|
16
|
-
client:
|
|
20
|
+
client:
|
|
21
|
+
| inferRouterProxyClient<TRouter>
|
|
22
|
+
| TRPCUntypedClient<TRouter>
|
|
23
|
+
// FIXME: @deprecated
|
|
24
|
+
| TRPCClient<TRouter>;
|
|
17
25
|
}
|
|
18
26
|
|
|
19
27
|
export type CreateServerSideHelpersOptions<TRouter extends AnyRouter> =
|
package/src/ssg/ssg.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
DehydrateOptions,
|
|
5
5
|
InfiniteData,
|
|
6
6
|
} from '@tanstack/react-query';
|
|
7
|
-
import { getUntypedClient } from '@trpc/client';
|
|
7
|
+
import { getUntypedClient, TRPCUntypedClient } from '@trpc/client';
|
|
8
8
|
import {
|
|
9
9
|
AnyRouter,
|
|
10
10
|
callProcedure,
|
|
@@ -48,7 +48,10 @@ export function createSSGHelpers<TRouter extends AnyRouter>(
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
const { client } = opts;
|
|
51
|
-
const untypedClient =
|
|
51
|
+
const untypedClient =
|
|
52
|
+
client instanceof TRPCUntypedClient
|
|
53
|
+
? client
|
|
54
|
+
: getUntypedClient(client as any);
|
|
52
55
|
|
|
53
56
|
return {
|
|
54
57
|
query: (queryOpts) =>
|