@trpc/next 10.0.0-proxy-beta.14 → 10.0.0-proxy-beta.16
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/index.js +3 -3
- package/dist/index.mjs +4 -4
- package/dist/withTRPC.d.ts +2 -8
- package/dist/withTRPC.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/withTRPC.tsx +7 -6
package/dist/index.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var reactQuery = require('@tanstack/react-query');
|
|
6
6
|
var react = require('@trpc/react');
|
|
7
|
+
var shared = require('@trpc/react/shared');
|
|
7
8
|
var React = require('react');
|
|
8
9
|
var ssrPrepass = require('react-ssr-prepass');
|
|
9
|
-
var shared = require('@trpc/react/shared');
|
|
10
10
|
var shared$1 = require('@trpc/server/shared');
|
|
11
11
|
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -42,7 +42,7 @@ function withTRPC(opts) {
|
|
|
42
42
|
return props.trpc;
|
|
43
43
|
}
|
|
44
44
|
const config = getClientConfig({});
|
|
45
|
-
const queryClient =
|
|
45
|
+
const queryClient = shared.getQueryClient(config);
|
|
46
46
|
const trpcClient = trpc.createClient(config);
|
|
47
47
|
return {
|
|
48
48
|
abortOnUnmount: config.abortOnUnmount,
|
|
@@ -93,7 +93,7 @@ function withTRPC(opts) {
|
|
|
93
93
|
ctx
|
|
94
94
|
});
|
|
95
95
|
const trpcClient = react.createTRPCClient(config);
|
|
96
|
-
const queryClient =
|
|
96
|
+
const queryClient = shared.getQueryClient(config);
|
|
97
97
|
const trpcProp = {
|
|
98
98
|
config,
|
|
99
99
|
trpcClient,
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dehydrate, QueryClientProvider, Hydrate } from '@tanstack/react-query';
|
|
2
2
|
import { createReactQueryHooks, createTRPCClient } from '@trpc/react';
|
|
3
|
+
import { getQueryClient, createHooksInternal, createReactQueryUtilsProxy, createReactProxyDecoration } from '@trpc/react/shared';
|
|
3
4
|
import React, { createElement, useState, useMemo } from 'react';
|
|
4
5
|
import ssrPrepass from 'react-ssr-prepass';
|
|
5
|
-
import { createHooksInternal, createReactQueryUtilsProxy, createReactProxyDecoration } from '@trpc/react/shared';
|
|
6
6
|
import { createFlatProxy } from '@trpc/server/shared';
|
|
7
7
|
|
|
8
8
|
function transformQueryOrMutationCacheErrors(result) {
|
|
@@ -33,7 +33,7 @@ function withTRPC(opts) {
|
|
|
33
33
|
return props.trpc;
|
|
34
34
|
}
|
|
35
35
|
const config = getClientConfig({});
|
|
36
|
-
const queryClient =
|
|
36
|
+
const queryClient = getQueryClient(config);
|
|
37
37
|
const trpcClient = trpc.createClient(config);
|
|
38
38
|
return {
|
|
39
39
|
abortOnUnmount: config.abortOnUnmount,
|
|
@@ -84,7 +84,7 @@ function withTRPC(opts) {
|
|
|
84
84
|
ctx
|
|
85
85
|
});
|
|
86
86
|
const trpcClient = createTRPCClient(config);
|
|
87
|
-
const queryClient =
|
|
87
|
+
const queryClient = getQueryClient(config);
|
|
88
88
|
const trpcProp = {
|
|
89
89
|
config,
|
|
90
90
|
trpcClient,
|
package/dist/withTRPC.d.ts
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Heavily based on urql's ssr
|
|
3
|
-
* https://github.com/FormidableLabs/urql/blob/main/packages/next-urql/src/with-urql-client.ts
|
|
4
|
-
*/
|
|
5
|
-
import { QueryClient } from '@tanstack/react-query';
|
|
6
1
|
import type { CreateTRPCClientOptions } from '@trpc/client';
|
|
7
2
|
import { TRPCClientError } from '@trpc/react';
|
|
3
|
+
import { CreateTRPCReactQueryClientConfig } from '@trpc/react/shared';
|
|
8
4
|
import type { AnyRouter, ResponseMeta } from '@trpc/server';
|
|
9
5
|
import { NextComponentType, NextPageContext } from 'next/dist/shared/lib/utils';
|
|
10
|
-
declare type QueryClientConfig = ConstructorParameters<typeof QueryClient>[0];
|
|
11
6
|
export declare type WithTRPCConfig<TRouter extends AnyRouter> = CreateTRPCClientOptions<TRouter> & {
|
|
12
|
-
queryClientConfig?: QueryClientConfig;
|
|
13
7
|
abortOnUnmount?: boolean;
|
|
14
|
-
};
|
|
8
|
+
} & CreateTRPCReactQueryClientConfig;
|
|
15
9
|
interface WithTRPCOptions<TRouter extends AnyRouter> {
|
|
16
10
|
config: (info: {
|
|
17
11
|
ctx?: NextPageContext;
|
package/dist/withTRPC.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withTRPC.d.ts","sourceRoot":"","sources":["../src/withTRPC.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withTRPC.d.ts","sourceRoot":"","sources":["../src/withTRPC.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAEL,eAAe,EAIhB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gCAAgC,EAEjC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAe,YAAY,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAGL,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AA2BpC,oBAAY,cAAc,CAAC,OAAO,SAAS,SAAS,IAClD,uBAAuB,CAAC,OAAO,CAAC,GAAG;IACjC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,gCAAgC,CAAC;AAEvC,UAAU,eAAe,CAAC,OAAO,SAAS,SAAS;IACjD,MAAM,EAAE,CAAC,IAAI,EAAE;QAAE,GAAG,CAAC,EAAE,eAAe,CAAA;KAAE,KAAK,cAAc,CAAC,OAAO,CAAC,CAAC;CACtE;AAED,MAAM,WAAW,kBAAkB,CAAC,OAAO,SAAS,SAAS,CAC3D,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,GAAG,EAAE,IAAI,CAAC;IACV,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QACpB,GAAG,EAAE,eAAe,CAAC;QACrB,YAAY,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC;KAC1C,KAAK,YAAY,CAAC;CACpB;AACD,MAAM,WAAW,oBAAoB,CAAC,OAAO,SAAS,SAAS,CAC7D,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,GAAG,CAAC,EAAE,KAAK,CAAC;CACb;AAED,wBAAgB,QAAQ,CACtB,OAAO,SAAS,SAAS,EACzB,WAAW,SAAS,eAAe,GAAG,eAAe,EACrD,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,OAAO,CAAC,eAU9C,kBAAkB,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,KAAG,iBAAiB,CA6KxE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/next",
|
|
3
|
-
"version": "10.0.0-proxy-beta.
|
|
3
|
+
"version": "10.0.0-proxy-beta.16",
|
|
4
4
|
"description": "tRPC Next lib",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@tanstack/react-query": "^4.3.8",
|
|
39
|
-
"@trpc/client": "10.0.0-proxy-beta.
|
|
40
|
-
"@trpc/react": "10.0.0-proxy-beta.
|
|
41
|
-
"@trpc/server": "10.0.0-proxy-beta.
|
|
39
|
+
"@trpc/client": "10.0.0-proxy-beta.16",
|
|
40
|
+
"@trpc/react": "10.0.0-proxy-beta.16",
|
|
41
|
+
"@trpc/server": "10.0.0-proxy-beta.16",
|
|
42
42
|
"next": "*",
|
|
43
43
|
"react": ">=16.8.0",
|
|
44
44
|
"react-dom": ">=16.8.0"
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@tanstack/react-query": "^4.3.8",
|
|
51
|
-
"@trpc/client": "10.0.0-proxy-beta.
|
|
52
|
-
"@trpc/react": "10.0.0-proxy-beta.
|
|
53
|
-
"@trpc/server": "10.0.0-proxy-beta.
|
|
51
|
+
"@trpc/client": "10.0.0-proxy-beta.16",
|
|
52
|
+
"@trpc/react": "10.0.0-proxy-beta.16",
|
|
53
|
+
"@trpc/server": "10.0.0-proxy-beta.16",
|
|
54
54
|
"@types/express": "^4.17.12",
|
|
55
55
|
"@types/node": "^18.7.20",
|
|
56
56
|
"express": "^4.17.1",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "4e001688fbdd7de848beb431a343a08c9659618a"
|
|
66
66
|
}
|
package/src/withTRPC.tsx
CHANGED
|
@@ -17,6 +17,10 @@ import {
|
|
|
17
17
|
createReactQueryHooks,
|
|
18
18
|
createTRPCClient,
|
|
19
19
|
} from '@trpc/react';
|
|
20
|
+
import {
|
|
21
|
+
CreateTRPCReactQueryClientConfig,
|
|
22
|
+
getQueryClient,
|
|
23
|
+
} from '@trpc/react/shared';
|
|
20
24
|
import type { AnyRouter, Dict, Maybe, ResponseMeta } from '@trpc/server';
|
|
21
25
|
import {
|
|
22
26
|
AppContextType,
|
|
@@ -28,8 +32,6 @@ import { NextRouter } from 'next/router';
|
|
|
28
32
|
import React, { createElement, useState } from 'react';
|
|
29
33
|
import ssrPrepass from 'react-ssr-prepass';
|
|
30
34
|
|
|
31
|
-
type QueryClientConfig = ConstructorParameters<typeof QueryClient>[0];
|
|
32
|
-
|
|
33
35
|
function transformQueryOrMutationCacheErrors<
|
|
34
36
|
TState extends
|
|
35
37
|
| DehydratedState['queries'][0]
|
|
@@ -54,9 +56,8 @@ function transformQueryOrMutationCacheErrors<
|
|
|
54
56
|
}
|
|
55
57
|
export type WithTRPCConfig<TRouter extends AnyRouter> =
|
|
56
58
|
CreateTRPCClientOptions<TRouter> & {
|
|
57
|
-
queryClientConfig?: QueryClientConfig;
|
|
58
59
|
abortOnUnmount?: boolean;
|
|
59
|
-
};
|
|
60
|
+
} & CreateTRPCReactQueryClientConfig;
|
|
60
61
|
|
|
61
62
|
interface WithTRPCOptions<TRouter extends AnyRouter> {
|
|
62
63
|
config: (info: { ctx?: NextPageContext }) => WithTRPCConfig<TRouter>;
|
|
@@ -102,7 +103,7 @@ export function withTRPC<
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
const config = getClientConfig({});
|
|
105
|
-
const queryClient =
|
|
106
|
+
const queryClient = getQueryClient(config);
|
|
106
107
|
const trpcClient = trpc.createClient(config);
|
|
107
108
|
return {
|
|
108
109
|
abortOnUnmount: config.abortOnUnmount,
|
|
@@ -171,7 +172,7 @@ export function withTRPC<
|
|
|
171
172
|
|
|
172
173
|
const config = getClientConfig({ ctx });
|
|
173
174
|
const trpcClient = createTRPCClient(config);
|
|
174
|
-
const queryClient =
|
|
175
|
+
const queryClient = getQueryClient(config);
|
|
175
176
|
|
|
176
177
|
const trpcProp: TRPCPrepassProps = {
|
|
177
178
|
config,
|