@trpc/tanstack-react-query 11.0.0-alpha-tmp-query-optoins-codemod.698 → 11.0.0-alpha-tmp-query-optoins-codemod.714
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/bundle-analysis.json +28 -28
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/internals/Context.d.ts +8 -3
- package/dist/internals/Context.d.ts.map +1 -1
- package/dist/internals/Context.js +5 -1
- package/dist/internals/Context.mjs +5 -1
- package/dist/internals/createOptionsProxy.d.ts +37 -15
- package/dist/internals/createOptionsProxy.d.ts.map +1 -1
- package/dist/internals/createOptionsProxy.js +9 -4
- package/dist/internals/createOptionsProxy.mjs +9 -4
- package/dist/internals/infiniteQueryOptions.d.ts +1 -2
- package/dist/internals/infiniteQueryOptions.d.ts.map +1 -1
- package/dist/internals/mutationOptions.d.ts +1 -1
- package/dist/internals/mutationOptions.d.ts.map +1 -1
- package/dist/internals/queryOptions.d.ts +1 -2
- package/dist/internals/queryOptions.d.ts.map +1 -1
- package/dist/internals/subscriptionOptions.d.ts +1 -1
- package/dist/internals/subscriptionOptions.d.ts.map +1 -1
- package/dist/internals/types.d.ts +24 -0
- package/dist/internals/types.d.ts.map +1 -1
- package/dist/internals/utils.d.ts +10 -2
- package/dist/internals/utils.d.ts.map +1 -1
- package/dist/internals/utils.js +9 -3
- package/dist/internals/utils.mjs +9 -3
- package/package.json +6 -6
- package/src/index.ts +1 -0
- package/src/internals/Context.tsx +9 -6
- package/src/internals/createOptionsProxy.ts +55 -39
- package/src/internals/infiniteQueryOptions.ts +3 -6
- package/src/internals/mutationOptions.ts +4 -4
- package/src/internals/queryOptions.ts +2 -1
- package/src/internals/subscriptionOptions.ts +2 -1
- package/src/internals/types.ts +24 -0
- package/src/internals/utils.ts +11 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 59.
|
|
2
|
+
"bundleSize": 15464,
|
|
3
|
+
"bundleOrigSize": 38528,
|
|
4
|
+
"bundleReduction": 59.86,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/internals/subscriptionOptions.ts",
|
|
8
8
|
"size": 4675,
|
|
9
|
-
"origSize":
|
|
9
|
+
"origSize": 7737,
|
|
10
10
|
"renderedExports": [
|
|
11
11
|
"trpcSubscriptionOptions",
|
|
12
12
|
"useSubscription"
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"/src/index.ts",
|
|
17
17
|
"/src/internals/createOptionsProxy.ts"
|
|
18
18
|
],
|
|
19
|
-
"percent":
|
|
20
|
-
"reduction": 39.
|
|
19
|
+
"percent": 30.23,
|
|
20
|
+
"reduction": 39.58
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"id": "/src/internals/createOptionsProxy.ts",
|
|
24
|
-
"size":
|
|
25
|
-
"origSize":
|
|
24
|
+
"size": 3435,
|
|
25
|
+
"origSize": 10154,
|
|
26
26
|
"renderedExports": [
|
|
27
27
|
"createTRPCOptionsProxy"
|
|
28
28
|
],
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"/src/index.ts",
|
|
32
32
|
"/src/internals/Context.tsx"
|
|
33
33
|
],
|
|
34
|
-
"percent": 21
|
|
35
|
-
"reduction":
|
|
34
|
+
"percent": 22.21,
|
|
35
|
+
"reduction": 66.17
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
"id": "/src/internals/utils.ts",
|
|
39
|
-
"size":
|
|
40
|
-
"origSize":
|
|
39
|
+
"size": 3104,
|
|
40
|
+
"origSize": 3533,
|
|
41
41
|
"renderedExports": [
|
|
42
42
|
"createTRPCOptionsResult",
|
|
43
43
|
"getClientArgs",
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"/src/internals/mutationOptions.ts",
|
|
55
55
|
"/src/internals/queryOptions.ts"
|
|
56
56
|
],
|
|
57
|
-
"percent": 20.
|
|
58
|
-
"reduction":
|
|
57
|
+
"percent": 20.07,
|
|
58
|
+
"reduction": 12.14
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
"id": "/src/internals/mutationOptions.ts",
|
|
62
62
|
"size": 1116,
|
|
63
|
-
"origSize":
|
|
63
|
+
"origSize": 3065,
|
|
64
64
|
"renderedExports": [
|
|
65
65
|
"trpcMutationOptions"
|
|
66
66
|
],
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
"dependents": [
|
|
69
69
|
"/src/internals/createOptionsProxy.ts"
|
|
70
70
|
],
|
|
71
|
-
"percent": 7.
|
|
72
|
-
"reduction":
|
|
71
|
+
"percent": 7.22,
|
|
72
|
+
"reduction": 63.59
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
"id": "/src/internals/queryOptions.ts",
|
|
76
76
|
"size": 1082,
|
|
77
|
-
"origSize":
|
|
77
|
+
"origSize": 5495,
|
|
78
78
|
"renderedExports": [
|
|
79
79
|
"trpcQueryOptions"
|
|
80
80
|
],
|
|
@@ -82,13 +82,13 @@
|
|
|
82
82
|
"dependents": [
|
|
83
83
|
"/src/internals/createOptionsProxy.ts"
|
|
84
84
|
],
|
|
85
|
-
"percent": 7
|
|
86
|
-
"reduction": 80.
|
|
85
|
+
"percent": 7,
|
|
86
|
+
"reduction": 80.31
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
89
|
"id": "/src/internals/infiniteQueryOptions.ts",
|
|
90
90
|
"size": 1042,
|
|
91
|
-
"origSize":
|
|
91
|
+
"origSize": 6194,
|
|
92
92
|
"renderedExports": [
|
|
93
93
|
"trpcInfiniteQueryOptions"
|
|
94
94
|
],
|
|
@@ -96,13 +96,13 @@
|
|
|
96
96
|
"dependents": [
|
|
97
97
|
"/src/internals/createOptionsProxy.ts"
|
|
98
98
|
],
|
|
99
|
-
"percent": 6.
|
|
100
|
-
"reduction": 83.
|
|
99
|
+
"percent": 6.74,
|
|
100
|
+
"reduction": 83.18
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
"id": "/src/internals/Context.tsx",
|
|
104
|
-
"size":
|
|
105
|
-
"origSize":
|
|
104
|
+
"size": 1010,
|
|
105
|
+
"origSize": 1391,
|
|
106
106
|
"renderedExports": [
|
|
107
107
|
"createTRPCContext"
|
|
108
108
|
],
|
|
@@ -110,13 +110,13 @@
|
|
|
110
110
|
"dependents": [
|
|
111
111
|
"/src/index.ts"
|
|
112
112
|
],
|
|
113
|
-
"percent":
|
|
114
|
-
"reduction":
|
|
113
|
+
"percent": 6.53,
|
|
114
|
+
"reduction": 27.39
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
"id": "/src/index.ts",
|
|
118
118
|
"size": 0,
|
|
119
|
-
"origSize":
|
|
119
|
+
"origSize": 959,
|
|
120
120
|
"renderedExports": [],
|
|
121
121
|
"removedExports": [],
|
|
122
122
|
"dependents": [],
|
package/dist/index.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ export type { TRPCMutationOptions } from './internals/mutationOptions';
|
|
|
6
6
|
export type { TRPCSubscriptionOptions, TRPCSubscriptionStatus, TRPCSubscriptionConnectingResult, TRPCSubscriptionErrorResult, TRPCSubscriptionIdleResult, TRPCSubscriptionPendingResult, TRPCSubscriptionResult, } from './internals/subscriptionOptions';
|
|
7
7
|
export { createTRPCOptionsProxy } from './internals/createOptionsProxy';
|
|
8
8
|
export { useSubscription } from './internals/subscriptionOptions';
|
|
9
|
+
export type * from './internals/types';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EACV,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,yBAAyB,EACzB,iBAAiB,EACjB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-
import {
|
|
1
|
+
import type { QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import type { CreateTRPCClient } from '@trpc/client';
|
|
3
3
|
import type { AnyTRPCRouter } from '@trpc/server';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import type { TRPCOptionsProxy } from './createOptionsProxy';
|
|
6
|
+
/**
|
|
7
|
+
* Create a set of type-safe provider-consumers
|
|
8
|
+
*
|
|
9
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/setup#3a-setup-the-trpc-context-provider
|
|
10
|
+
*/
|
|
6
11
|
export declare function createTRPCContext<TRouter extends AnyTRPCRouter>(): {
|
|
7
12
|
TRPCProvider: (props: Readonly<{
|
|
8
13
|
children: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/internals/Context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/internals/Context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,SAAS,aAAa;0BAMpD,QAAQ,CAAC;QACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,WAAW,EAAE,WAAW,CAAC;QACzB,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;KACvC,CAAC;;EA0BL"}
|
|
@@ -22,7 +22,11 @@ function _interopNamespaceDefault(e) {
|
|
|
22
22
|
|
|
23
23
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Create a set of type-safe provider-consumers
|
|
27
|
+
*
|
|
28
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/setup#3a-setup-the-trpc-context-provider
|
|
29
|
+
*/ function createTRPCContext() {
|
|
26
30
|
const TRPCContext = /*#__PURE__*/ React__namespace.createContext(null);
|
|
27
31
|
function TRPCProvider(props) {
|
|
28
32
|
const value = React__namespace.useMemo(()=>createOptionsProxy.createTRPCOptionsProxy({
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { createTRPCOptionsProxy } from './createOptionsProxy.mjs';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Create a set of type-safe provider-consumers
|
|
6
|
+
*
|
|
7
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/setup#3a-setup-the-trpc-context-provider
|
|
8
|
+
*/ function createTRPCContext() {
|
|
5
9
|
const TRPCContext = /*#__PURE__*/ React.createContext(null);
|
|
6
10
|
function TRPCProvider(props) {
|
|
7
11
|
const value = React.useMemo(()=>createTRPCOptionsProxy({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { DataTag } from '@tanstack/react-query';
|
|
2
|
-
import
|
|
3
|
-
import { TRPCUntypedClient
|
|
4
|
-
import {
|
|
5
|
-
import type {
|
|
1
|
+
import type { DataTag, QueryClient, QueryFilters } from '@tanstack/react-query';
|
|
2
|
+
import type { CreateTRPCClient } from '@trpc/client';
|
|
3
|
+
import { TRPCUntypedClient } from '@trpc/client';
|
|
4
|
+
import type { AnyTRPCProcedure, AnyTRPCRootTypes, AnyTRPCRouter, inferProcedureInput, inferRouterContext, inferTransformedProcedureOutput, TRPCProcedureType, TRPCRouterRecord } from '@trpc/server';
|
|
5
|
+
import type { MaybePromise } from '@trpc/server/unstable-core-do-not-import';
|
|
6
6
|
import { type TRPCInfiniteQueryOptions } from './infiniteQueryOptions';
|
|
7
7
|
import type { MutationOptionsOverride } from './mutationOptions';
|
|
8
8
|
import { type TRPCMutationOptions } from './mutationOptions';
|
|
@@ -14,12 +14,14 @@ export interface DecorateQueryKeyable {
|
|
|
14
14
|
* Calculate the TanStack Query Key for a Route
|
|
15
15
|
*
|
|
16
16
|
* @see https://tanstack.com/query/latest/docs/framework/react/guides/query-keys
|
|
17
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#queryKey
|
|
17
18
|
*/
|
|
18
19
|
queryKey: () => TRPCQueryKey;
|
|
19
20
|
/**
|
|
20
21
|
* Calculate a TanStack Query Filter for a Route
|
|
21
22
|
*
|
|
22
23
|
* @see https://tanstack.com/query/latest/docs/framework/react/guides/filters
|
|
24
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#queryFilter
|
|
23
25
|
*/
|
|
24
26
|
queryFilter: (input?: undefined, filters?: QueryFilters) => QueryFilters;
|
|
25
27
|
}
|
|
@@ -35,23 +37,31 @@ export interface DecorateQueryProcedure<TDef extends ResolverDef> {
|
|
|
35
37
|
errorShape: TDef['errorShape'];
|
|
36
38
|
};
|
|
37
39
|
/**
|
|
40
|
+
* Create a set of type-safe query options that can be passed to `useQuery`, `prefetchQuery` etc.
|
|
41
|
+
*
|
|
38
42
|
* @see https://tanstack.com/query/latest/docs/framework/react/reference/queryOptions#queryoptions
|
|
43
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#queryOptions
|
|
39
44
|
*/
|
|
40
45
|
queryOptions: TRPCQueryOptions<TDef>;
|
|
41
46
|
/**
|
|
47
|
+
* Create a set of type-safe infinite query options that can be passed to `useInfiniteQuery`, `prefetchInfiniteQuery` etc.
|
|
48
|
+
*
|
|
42
49
|
* @see https://tanstack.com/query/latest/docs/framework/react/reference/infiniteQueryOptions#infinitequeryoptions
|
|
50
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#infiniteQueryOptions
|
|
43
51
|
*/
|
|
44
52
|
infiniteQueryOptions: TRPCInfiniteQueryOptions<TDef>;
|
|
45
53
|
/**
|
|
46
54
|
* Calculate the TanStack Query Key for a Query Procedure
|
|
47
55
|
*
|
|
48
56
|
* @see https://tanstack.com/query/latest/docs/framework/react/guides/query-keys
|
|
57
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#queryKey
|
|
49
58
|
*/
|
|
50
59
|
queryKey: (input?: TDef['input']) => DataTag<TRPCQueryKey, TDef['output'], TDef['errorShape']>;
|
|
51
60
|
/**
|
|
52
61
|
* Calculate a TanStack Query Filter for a Query Procedure
|
|
53
62
|
*
|
|
54
63
|
* @see https://tanstack.com/query/latest/docs/framework/react/guides/filters
|
|
64
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#queryFilter
|
|
55
65
|
*/
|
|
56
66
|
queryFilter: (input?: TDef['input'], filters?: QueryFilters<TDef['output'], TDef['errorShape']>) => QueryFilters<TDef['output'], TDef['errorShape'], TDef['output'], DataTag<TRPCQueryKey, TDef['output'], TDef['errorShape']>>;
|
|
57
67
|
}
|
|
@@ -64,46 +74,58 @@ export interface DecorateMutationProcedure<TDef extends ResolverDef> {
|
|
|
64
74
|
output: TDef['output'];
|
|
65
75
|
};
|
|
66
76
|
/**
|
|
67
|
-
*
|
|
77
|
+
* Create a set of type-safe mutation options that can be passed to `useMutation`
|
|
78
|
+
*
|
|
79
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#mutationOptions
|
|
68
80
|
*/
|
|
69
81
|
mutationOptions: TRPCMutationOptions<TDef>;
|
|
70
82
|
/**
|
|
71
83
|
* Calculate the TanStack Mutation Key for a Mutation Procedure
|
|
84
|
+
*
|
|
85
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#mutationKey
|
|
72
86
|
*/
|
|
73
87
|
mutationKey: () => TRPCMutationKey;
|
|
74
88
|
}
|
|
75
89
|
export interface DecorateSubscriptionProcedure<TDef extends ResolverDef> {
|
|
76
90
|
/**
|
|
77
|
-
*
|
|
91
|
+
* Create a set of type-safe subscription options that can be passed to `useSubscription`
|
|
92
|
+
*
|
|
93
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#subscriptionOptions
|
|
78
94
|
*/
|
|
79
95
|
subscriptionOptions: TRPCSubscriptionOptions<TDef>;
|
|
80
96
|
}
|
|
81
|
-
export type DecorateProcedure<TType extends
|
|
97
|
+
export type DecorateProcedure<TType extends TRPCProcedureType, TDef extends ResolverDef> = TType extends 'query' ? DecorateQueryProcedure<TDef> : TType extends 'mutation' ? DecorateMutationProcedure<TDef> : TType extends 'subscription' ? DecorateSubscriptionProcedure<TDef> : never;
|
|
82
98
|
/**
|
|
83
99
|
* @internal
|
|
84
100
|
*/
|
|
85
|
-
export type DecoratedProcedureUtilsRecord<TRoot extends
|
|
86
|
-
[TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends
|
|
101
|
+
export type DecoratedProcedureUtilsRecord<TRoot extends AnyTRPCRootTypes, TRecord extends TRPCRouterRecord> = {
|
|
102
|
+
[TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends TRPCRouterRecord ? DecoratedProcedureUtilsRecord<TRoot, $Value> & DecorateQueryKeyable : $Value extends AnyTRPCProcedure ? DecorateProcedure<$Value['_def']['type'], {
|
|
87
103
|
input: inferProcedureInput<$Value>;
|
|
88
104
|
output: inferTransformedProcedureOutput<TRoot, $Value>;
|
|
89
105
|
transformer: TRoot['transformer'];
|
|
90
106
|
errorShape: TRoot['errorShape'];
|
|
91
107
|
}> : never : never;
|
|
92
108
|
};
|
|
93
|
-
export type TRPCOptionsProxy<TRouter extends
|
|
109
|
+
export type TRPCOptionsProxy<TRouter extends AnyTRPCRouter> = DecoratedProcedureUtilsRecord<TRouter['_def']['_config']['$types'], TRouter['_def']['record']> & DecorateQueryKeyable;
|
|
94
110
|
export interface TRPCOptionsProxyOptionsBase {
|
|
95
111
|
queryClient: QueryClient | (() => QueryClient);
|
|
96
112
|
overrides?: {
|
|
97
113
|
mutations?: MutationOptionsOverride;
|
|
98
114
|
};
|
|
99
115
|
}
|
|
100
|
-
export interface TRPCOptionsProxyOptionsInternal<TRouter extends
|
|
116
|
+
export interface TRPCOptionsProxyOptionsInternal<TRouter extends AnyTRPCRouter> {
|
|
101
117
|
router: TRouter;
|
|
102
118
|
ctx: inferRouterContext<TRouter> | (() => MaybePromise<inferRouterContext<TRouter>>);
|
|
103
119
|
}
|
|
104
|
-
export interface TRPCOptionsProxyOptionsExternal<TRouter extends
|
|
120
|
+
export interface TRPCOptionsProxyOptionsExternal<TRouter extends AnyTRPCRouter> {
|
|
105
121
|
client: TRPCUntypedClient<TRouter> | CreateTRPCClient<TRouter>;
|
|
106
122
|
}
|
|
107
|
-
export type TRPCOptionsProxyOptions<TRouter extends
|
|
108
|
-
|
|
123
|
+
export type TRPCOptionsProxyOptions<TRouter extends AnyTRPCRouter> = TRPCOptionsProxyOptionsBase & (TRPCOptionsProxyOptionsInternal<TRouter> | TRPCOptionsProxyOptionsExternal<TRouter>);
|
|
124
|
+
/**
|
|
125
|
+
* Create a typed proxy from your router types. Can also be used on the server.
|
|
126
|
+
*
|
|
127
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/setup#3b-setup-without-react-context
|
|
128
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/server-components#5-create-a-trpc-caller-for-server-components
|
|
129
|
+
*/
|
|
130
|
+
export declare function createTRPCOptionsProxy<TRouter extends AnyTRPCRouter>(opts: TRPCOptionsProxyOptions<TRouter>): TRPCOptionsProxy<TRouter>;
|
|
109
131
|
//# sourceMappingURL=createOptionsProxy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createOptionsProxy.d.ts","sourceRoot":"","sources":["../../src/internals/createOptionsProxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"createOptionsProxy.d.ts","sourceRoot":"","sources":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,CAAC,CAAC,QAAQ,CAAC,EACpC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAC1B,GACC,oBAAoB,CAAC;AAEzB,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,WAAW,GAAG,CAAC,MAAM,WAAW,CAAC,CAAC;IAC/C,SAAS,CAAC,EAAE;QACV,SAAS,CAAC,EAAE,uBAAuB,CAAC;KACrC,CAAC;CACH;AAED,MAAM,WAAW,+BAA+B,CAC9C,OAAO,SAAS,aAAa;IAE7B,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EACC,kBAAkB,CAAC,OAAO,CAAC,GAC3B,CAAC,MAAM,YAAY,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CACvD;AAED,MAAM,WAAW,+BAA+B,CAC9C,OAAO,SAAS,aAAa;IAE7B,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;CAChE;AAED,MAAM,MAAM,uBAAuB,CAAC,OAAO,SAAS,aAAa,IAC/D,2BAA2B,GACzB,CACI,+BAA+B,CAAC,OAAO,CAAC,GACxC,+BAA+B,CAAC,OAAO,CAAC,CAC3C,CAAC;AAkBN;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,SAAS,aAAa,EAClE,IAAI,EAAE,uBAAuB,CAAC,OAAO,CAAC,GACrC,gBAAgB,CAAC,OAAO,CAAC,CA0F3B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var client = require('@trpc/client');
|
|
4
|
-
var
|
|
4
|
+
var server = require('@trpc/server');
|
|
5
5
|
var infiniteQueryOptions = require('./infiniteQueryOptions.js');
|
|
6
6
|
var mutationOptions = require('./mutationOptions.js');
|
|
7
7
|
var queryOptions = require('./queryOptions.js');
|
|
@@ -17,11 +17,16 @@ function getQueryType(method) {
|
|
|
17
17
|
};
|
|
18
18
|
return map[method];
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Create a typed proxy from your router types. Can also be used on the server.
|
|
22
|
+
*
|
|
23
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/setup#3b-setup-without-react-context
|
|
24
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/server-components#5-create-a-trpc-caller-for-server-components
|
|
25
|
+
*/ function createTRPCOptionsProxy(opts) {
|
|
21
26
|
const callIt = (type)=>{
|
|
22
27
|
return (path, input, trpcOpts)=>{
|
|
23
28
|
if ('router' in opts) {
|
|
24
|
-
return Promise.resolve(utils.unwrapLazyArg(opts.ctx)).then((ctx)=>
|
|
29
|
+
return Promise.resolve(utils.unwrapLazyArg(opts.ctx)).then((ctx)=>server.callTRPCProcedure({
|
|
25
30
|
router: opts.router,
|
|
26
31
|
path: path,
|
|
27
32
|
getRawInput: async ()=>input,
|
|
@@ -34,7 +39,7 @@ function createTRPCOptionsProxy(opts) {
|
|
|
34
39
|
return untypedClient[type](path, input, trpcOpts);
|
|
35
40
|
};
|
|
36
41
|
};
|
|
37
|
-
return
|
|
42
|
+
return server.createTRPCRecursiveProxy(({ args, path: _path })=>{
|
|
38
43
|
const path = [
|
|
39
44
|
..._path
|
|
40
45
|
];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TRPCUntypedClient, getUntypedClient } from '@trpc/client';
|
|
2
|
-
import {
|
|
2
|
+
import { createTRPCRecursiveProxy, callTRPCProcedure } from '@trpc/server';
|
|
3
3
|
import { trpcInfiniteQueryOptions } from './infiniteQueryOptions.mjs';
|
|
4
4
|
import { trpcMutationOptions } from './mutationOptions.mjs';
|
|
5
5
|
import { trpcQueryOptions } from './queryOptions.mjs';
|
|
@@ -15,11 +15,16 @@ function getQueryType(method) {
|
|
|
15
15
|
};
|
|
16
16
|
return map[method];
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Create a typed proxy from your router types. Can also be used on the server.
|
|
20
|
+
*
|
|
21
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/setup#3b-setup-without-react-context
|
|
22
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/server-components#5-create-a-trpc-caller-for-server-components
|
|
23
|
+
*/ function createTRPCOptionsProxy(opts) {
|
|
19
24
|
const callIt = (type)=>{
|
|
20
25
|
return (path, input, trpcOpts)=>{
|
|
21
26
|
if ('router' in opts) {
|
|
22
|
-
return Promise.resolve(unwrapLazyArg(opts.ctx)).then((ctx)=>
|
|
27
|
+
return Promise.resolve(unwrapLazyArg(opts.ctx)).then((ctx)=>callTRPCProcedure({
|
|
23
28
|
router: opts.router,
|
|
24
29
|
path: path,
|
|
25
30
|
getRawInput: async ()=>input,
|
|
@@ -32,7 +37,7 @@ function createTRPCOptionsProxy(opts) {
|
|
|
32
37
|
return untypedClient[type](path, input, trpcOpts);
|
|
33
38
|
};
|
|
34
39
|
};
|
|
35
|
-
return
|
|
40
|
+
return createTRPCRecursiveProxy(({ args, path: _path })=>{
|
|
36
41
|
const path = [
|
|
37
42
|
..._path
|
|
38
43
|
];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { DataTag, DefinedInitialDataInfiniteOptions, InfiniteData, UndefinedInitialDataInfiniteOptions, UnusedSkipTokenInfiniteOptions } from '@tanstack/react-query';
|
|
2
|
-
import { type QueryClient, type SkipToken } from '@tanstack/react-query';
|
|
1
|
+
import type { DataTag, DefinedInitialDataInfiniteOptions, InfiniteData, QueryClient, SkipToken, UndefinedInitialDataInfiniteOptions, UnusedSkipTokenInfiniteOptions } from '@tanstack/react-query';
|
|
3
2
|
import type { TRPCClientErrorLike, TRPCUntypedClient } from '@trpc/client';
|
|
4
3
|
import type { DistributiveOmit } from '@trpc/server/unstable-core-do-not-import';
|
|
5
4
|
import type { ExtractCursorType, ResolverDef, TRPCQueryBaseOptions, TRPCQueryKey, TRPCQueryOptionsResult } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infiniteQueryOptions.d.ts","sourceRoot":"","sources":["../../src/internals/infiniteQueryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,iCAAiC,EACjC,YAAY,
|
|
1
|
+
{"version":3,"file":"infiniteQueryOptions.d.ts","sourceRoot":"","sources":["../../src/internals/infiniteQueryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,iCAAiC,EACjC,YAAY,EACZ,WAAW,EAEX,SAAS,EACT,mCAAmC,EACnC,8BAA8B,EAC/B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,KAAK,EACV,iBAAiB,EACjB,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAGjB,KAAK,eAAe,GAChB,UAAU,GACV,SAAS,GACT,aAAa,GACb,WAAW,GACX,kBAAkB,CAAC;AAEvB,UAAU,mCAAmC,CAC3C,MAAM,EACN,YAAY,EACZ,KAAK,EACL,MAAM,CACN,SAAQ,gBAAgB,CACpB,mCAAmC,CACjC,YAAY,EACZ,MAAM,EACN,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,EAClE,YAAY,EACZ,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAC9C,EACD,eAAe,CAChB,EACD,oBAAoB;IACtB,aAAa,CAAC,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;CAC/D;AAED,UAAU,oCAAoC,CAC5C,MAAM,EACN,YAAY,EACZ,KAAK,EACL,MAAM,CACN,SAAQ,gBAAgB,CACpB,mCAAmC,CACjC,YAAY,EACZ,MA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 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { QueryClient, UseMutationOptions } from '@tanstack/react-query';
|
|
2
2
|
import type { TRPCClientErrorLike, TRPCUntypedClient } from '@trpc/client';
|
|
3
3
|
import type { DistributiveOmit, MaybePromise } from '@trpc/server/unstable-core-do-not-import';
|
|
4
4
|
import type { ResolverDef, TRPCMutationKey, TRPCQueryBaseOptions, TRPCQueryOptionsResult } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutationOptions.d.ts","sourceRoot":"","sources":["../../src/internals/mutationOptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mutationOptions.d.ts","sourceRoot":"","sources":["../../src/internals/mutationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EACX,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAQjB,KAAK,eAAe,GAAG,aAAa,GAAG,YAAY,CAAC;AAEpD,UAAU,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAC/D,SAAQ,gBAAgB,CACpB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EACrD,eAAe,CAChB,EACD,oBAAoB;CAAG;AAE3B,UAAU,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAChE,SAAQ,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3D,sBAAsB;IACxB,WAAW,EAAE,eAAe,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB,CAAC,IAAI,SAAS,WAAW;IAC3D,CAAC,QAAQ,GAAG,OAAO,EACjB,IAAI,CAAC,EAAE,qBAAqB,CAC1B,IAAI,CAAC,OAAO,CAAC,EACb,mBAAmB,CAAC,IAAI,CAAC,EACzB,IAAI,CAAC,QAAQ,CAAC,EACd,QAAQ,CACT,GACA,sBAAsB,CACvB,IAAI,CAAC,OAAO,CAAC,EACb,mBAAmB,CAAC,IAAI,CAAC,EACzB,IAAI,CAAC,QAAQ,CAAC,EACd,QAAQ,CACT,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,CAAC,IAAI,EAAE;QAChB;;WAEG;QACH,UAAU,EAAE,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC;QACxC,WAAW,EAAE,WAAW,CAAC;QACzB;;WAEG;QACH,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/B,KAAK,YAAY,CAAC,OAAO,CAAC,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,MAAM,EAAE,OAAO,iBAAiB,CAAC,SAAS,CAAC,QAAQ,CAAC;IACpD,WAAW,EAAE,WAAW,GAAG,CAAC,MAAM,WAAW,CAAC,CAAC;IAC/C,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,IAAI,EAAE,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC5E,SAAS,EAAE,uBAAuB,GAAG,SAAS,CAAC;CAChD,GAAG,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAmC7D"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { DataTag, DefinedInitialDataOptions, QueryClient, UndefinedInitialDataOptions, UnusedSkipTokenOptions } from '@tanstack/react-query';
|
|
2
|
-
import { type SkipToken } from '@tanstack/react-query';
|
|
1
|
+
import type { DataTag, DefinedInitialDataOptions, QueryClient, SkipToken, UndefinedInitialDataOptions, UnusedSkipTokenOptions } from '@tanstack/react-query';
|
|
3
2
|
import type { TRPCClientErrorLike, TRPCUntypedClient } from '@trpc/client';
|
|
4
3
|
import type { coerceAsyncIterableToArray, DistributiveOmit } from '@trpc/server/unstable-core-do-not-import';
|
|
5
4
|
import type { ResolverDef, TRPCQueryBaseOptions, TRPCQueryKey, TRPCQueryOptionsResult } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryOptions.d.ts","sourceRoot":"","sources":["../../src/internals/queryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,yBAAyB,EACzB,WAAW,EAEX,2BAA2B,EAC3B,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"queryOptions.d.ts","sourceRoot":"","sources":["../../src/internals/queryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,yBAAyB,EACzB,WAAW,EAEX,SAAS,EACT,2BAA2B,EAC3B,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EACV,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EACV,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAQjB,KAAK,eAAe,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,CAAC;AAE5E,UAAU,2BAA2B,CAAC,YAAY,EAAE,KAAK,EAAE,MAAM,CAC/D,SAAQ,gBAAgB,CACpB,2BAA2B,CACzB,0BAA0B,CAAC,YAAY,CAAC,EACxC,MAAM,EACN,0BAA0B,CAAC,KAAK,CAAC,EACjC,YAA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AC,OAAO,CAAC,GAAG,SAAS,EAChC,IAAI,CAAC,EAAE,2BAA2B,CAChC,YAAY,EACZ,KAAK,EACL,mBAAmB,CAAC;QAClB,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACjC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;KAChC,CAAC,CACH,GACA,4BAA4B,CAC7B,YAAY,EACZ,KAAK,EACL,mBAAmB,CAAC;QAClB,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACjC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;KAChC,CAAC,CACH,CAAC;CACH;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,KAAK,EAAE,OAAO,iBAAiB,CAAC,SAAS,CAAC,KAAK,CAAC;IAChD,WAAW,EAAE,WAAW,GAAG,CAAC,MAAM,WAAW,CAAC,CAAC;IAC/C,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,QAAQ,EAAE,YAAY,CAAC;IACvB,IAAI,EAAE,2BAA2B,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;CAC9D;;;;;;;;;;;EAoCA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SkipToken } from '@tanstack/react-query';
|
|
2
2
|
import type { TRPCClientErrorLike, TRPCUntypedClient } from '@trpc/client';
|
|
3
3
|
import type { TRPCConnectionState } from '@trpc/client/unstable-internals';
|
|
4
4
|
import type { Unsubscribable } from '@trpc/server/observable';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptionOptions.d.ts","sourceRoot":"","sources":["../../src/internals/subscriptionOptions.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"subscriptionOptions.d.ts","sourceRoot":"","sources":["../../src/internals/subscriptionOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBA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
1
|
import type { TRPCRequestOptions } from '@trpc/client';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
2
5
|
export type ResolverDef = {
|
|
3
6
|
input: any;
|
|
4
7
|
output: any;
|
|
5
8
|
transformer: boolean;
|
|
6
9
|
errorShape: any;
|
|
7
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
8
14
|
export type ExtractCursorType<TInput> = TInput extends {
|
|
9
15
|
cursor?: any;
|
|
10
16
|
} ? TInput['cursor'] : unknown;
|
|
17
|
+
/**
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
11
20
|
export interface TRPCReactRequestOptions extends Omit<TRPCRequestOptions, 'signal'> {
|
|
12
21
|
/**
|
|
13
22
|
* Opt out of SSR for this query by passing `ssr: false`
|
|
@@ -18,18 +27,30 @@ export interface TRPCReactRequestOptions extends Omit<TRPCRequestOptions, 'signa
|
|
|
18
27
|
*/
|
|
19
28
|
abortOnUnmount?: boolean;
|
|
20
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
21
33
|
export interface TRPCQueryBaseOptions {
|
|
22
34
|
/**
|
|
23
35
|
* tRPC-related options
|
|
24
36
|
*/
|
|
25
37
|
trpc?: TRPCReactRequestOptions;
|
|
26
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
27
42
|
export interface TRPCQueryOptionsResult {
|
|
28
43
|
trpc: {
|
|
29
44
|
path: string;
|
|
30
45
|
};
|
|
31
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
32
50
|
export type QueryType = 'any' | 'infinite' | 'query';
|
|
51
|
+
/**
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
33
54
|
export type TRPCQueryKey = [
|
|
34
55
|
readonly string[],
|
|
35
56
|
{
|
|
@@ -37,5 +58,8 @@ export type TRPCQueryKey = [
|
|
|
37
58
|
type?: Exclude<QueryType, 'any'>;
|
|
38
59
|
}?
|
|
39
60
|
];
|
|
61
|
+
/**
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
40
64
|
export type TRPCMutationKey = [readonly string[]];
|
|
41
65
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/internals/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,GAAG,CAAC;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,GAAG,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,MAAM,IAAI,MAAM,SAAS;IAAE,MAAM,CAAC,EAAE,GAAG,CAAA;CAAE,GACnE,MAAM,CAAC,QAAQ,CAAC,GAChB,OAAO,CAAC;AAEZ,MAAM,WAAW,uBAEf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC1C;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,IAAI,CAAC,EAAE,uBAAuB,CAAC;CAChC;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,UAAU,GAAG,OAAO,CAAC;AAErD,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,MAAM,EAAE;IACjB;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;KAAE,CAAC;CAC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AM,eAAe,GAAG,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { QueryClient } from '@tanstack/react-query';
|
|
2
2
|
import type { QueryType, TRPCMutationKey, TRPCQueryKey, TRPCQueryOptionsResult } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
@@ -21,8 +21,16 @@ export declare function buildQueryFromAsyncIterable(asyncIterable: AsyncIterable
|
|
|
21
21
|
* To allow easy interactions with groups of related queries, such as
|
|
22
22
|
* invalidating all queries of a router, we use an array as the path when
|
|
23
23
|
* storing in tanstack query.
|
|
24
|
-
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
25
27
|
export declare function getQueryKeyInternal(path: readonly string[], input: unknown, type: QueryType): TRPCQueryKey;
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
26
31
|
export declare function getMutationKeyInternal(path: readonly string[]): TRPCMutationKey;
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
27
35
|
export declare function unwrapLazyArg<T>(valueOrLazy: T | (() => T)): T;
|
|
28
36
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/internals/utils.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/internals/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,YAAY,EACZ,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CACzB,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAMjC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EACpC,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,QAAQ,EACd,cAAc,CAAC,EAAE;IACf,SAAS,EAAE,GAAG,CAAC;IACf,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;CACnC,mCAYF;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,aAAa,EAAE,aAAa,CAAC,OAAO,CAAC,EACrC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,YAAY,sBAsBvB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,SAAS,GACd,YAAY,CA0Cd;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,eAAe,CAKjB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAE9D"}
|
package/dist/internals/utils.js
CHANGED
|
@@ -57,7 +57,9 @@ var unstableCoreDoNotImport = require('@trpc/server/unstable-core-do-not-import'
|
|
|
57
57
|
* To allow easy interactions with groups of related queries, such as
|
|
58
58
|
* invalidating all queries of a router, we use an array as the path when
|
|
59
59
|
* storing in tanstack query.
|
|
60
|
-
|
|
60
|
+
*
|
|
61
|
+
* @internal
|
|
62
|
+
*/ function getQueryKeyInternal(path, input, type) {
|
|
61
63
|
// Construct a query key that is easy to destructure and flexible for
|
|
62
64
|
// partial selecting etc.
|
|
63
65
|
// https://github.com/trpc/trpc/issues/3128
|
|
@@ -93,14 +95,18 @@ var unstableCoreDoNotImport = require('@trpc/server/unstable-core-do-not-import'
|
|
|
93
95
|
}
|
|
94
96
|
];
|
|
95
97
|
}
|
|
96
|
-
|
|
98
|
+
/**
|
|
99
|
+
* @internal
|
|
100
|
+
*/ function getMutationKeyInternal(path) {
|
|
97
101
|
// some parts of the path may be dot-separated, split them up
|
|
98
102
|
const splitPath = path.flatMap((part)=>part.split('.'));
|
|
99
103
|
return splitPath.length ? [
|
|
100
104
|
splitPath
|
|
101
105
|
] : [];
|
|
102
106
|
}
|
|
103
|
-
|
|
107
|
+
/**
|
|
108
|
+
* @internal
|
|
109
|
+
*/ function unwrapLazyArg(valueOrLazy) {
|
|
104
110
|
return unstableCoreDoNotImport.isFunction(valueOrLazy) ? valueOrLazy() : valueOrLazy;
|
|
105
111
|
}
|
|
106
112
|
|
package/dist/internals/utils.mjs
CHANGED
|
@@ -55,7 +55,9 @@ import { isObject, isFunction } from '@trpc/server/unstable-core-do-not-import';
|
|
|
55
55
|
* To allow easy interactions with groups of related queries, such as
|
|
56
56
|
* invalidating all queries of a router, we use an array as the path when
|
|
57
57
|
* storing in tanstack query.
|
|
58
|
-
|
|
58
|
+
*
|
|
59
|
+
* @internal
|
|
60
|
+
*/ function getQueryKeyInternal(path, input, type) {
|
|
59
61
|
// Construct a query key that is easy to destructure and flexible for
|
|
60
62
|
// partial selecting etc.
|
|
61
63
|
// https://github.com/trpc/trpc/issues/3128
|
|
@@ -91,14 +93,18 @@ import { isObject, isFunction } from '@trpc/server/unstable-core-do-not-import';
|
|
|
91
93
|
}
|
|
92
94
|
];
|
|
93
95
|
}
|
|
94
|
-
|
|
96
|
+
/**
|
|
97
|
+
* @internal
|
|
98
|
+
*/ function getMutationKeyInternal(path) {
|
|
95
99
|
// some parts of the path may be dot-separated, split them up
|
|
96
100
|
const splitPath = path.flatMap((part)=>part.split('.'));
|
|
97
101
|
return splitPath.length ? [
|
|
98
102
|
splitPath
|
|
99
103
|
] : [];
|
|
100
104
|
}
|
|
101
|
-
|
|
105
|
+
/**
|
|
106
|
+
* @internal
|
|
107
|
+
*/ function unwrapLazyArg(valueOrLazy) {
|
|
102
108
|
return isFunction(valueOrLazy) ? valueOrLazy() : valueOrLazy;
|
|
103
109
|
}
|
|
104
110
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/tanstack-react-query",
|
|
3
|
-
"version": "11.0.0-alpha-tmp-query-optoins-codemod.
|
|
3
|
+
"version": "11.0.0-alpha-tmp-query-optoins-codemod.714+8e65cb0f1",
|
|
4
4
|
"description": "TanStack React Query Integration for tRPC",
|
|
5
5
|
"author": "juliusmarminge",
|
|
6
6
|
"license": "MIT",
|
|
@@ -49,16 +49,16 @@
|
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@tanstack/react-query": "^5.62.8",
|
|
52
|
-
"@trpc/client": "11.0.0-alpha-tmp-query-optoins-codemod.
|
|
53
|
-
"@trpc/server": "11.0.0-alpha-tmp-query-optoins-codemod.
|
|
52
|
+
"@trpc/client": "11.0.0-alpha-tmp-query-optoins-codemod.714+8e65cb0f1",
|
|
53
|
+
"@trpc/server": "11.0.0-alpha-tmp-query-optoins-codemod.714+8e65cb0f1",
|
|
54
54
|
"react": ">=18.2.0",
|
|
55
55
|
"react-dom": ">=18.2.0",
|
|
56
56
|
"typescript": ">=5.7.2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@tanstack/react-query": "^5.66.0",
|
|
60
|
-
"@trpc/client": "11.0.0-alpha-tmp-query-optoins-codemod.
|
|
61
|
-
"@trpc/server": "11.0.0-alpha-tmp-query-optoins-codemod.
|
|
60
|
+
"@trpc/client": "11.0.0-alpha-tmp-query-optoins-codemod.714+8e65cb0f1",
|
|
61
|
+
"@trpc/server": "11.0.0-alpha-tmp-query-optoins-codemod.714+8e65cb0f1",
|
|
62
62
|
"@types/node": "^20.10.0",
|
|
63
63
|
"@types/react": "^18.3.1",
|
|
64
64
|
"eslint": "^8.57.0",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"funding": [
|
|
80
80
|
"https://trpc.io/sponsor"
|
|
81
81
|
],
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "8e65cb0f1d4850b12838bada3592efb6513d1298"
|
|
83
83
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import type { CreateTRPCClient } from '@trpc/client';
|
|
3
3
|
import type { AnyTRPCRouter } from '@trpc/server';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
type TRPCOptionsProxy,
|
|
8
|
-
} from './createOptionsProxy';
|
|
5
|
+
import type { TRPCOptionsProxy } from './createOptionsProxy';
|
|
6
|
+
import { createTRPCOptionsProxy } from './createOptionsProxy';
|
|
9
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Create a set of type-safe provider-consumers
|
|
10
|
+
*
|
|
11
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/setup#3a-setup-the-trpc-context-provider
|
|
12
|
+
*/
|
|
10
13
|
export function createTRPCContext<TRouter extends AnyTRPCRouter>() {
|
|
11
14
|
const TRPCContext = React.createContext<TRPCOptionsProxy<TRouter> | null>(
|
|
12
15
|
null,
|
|
@@ -1,28 +1,18 @@
|
|
|
1
|
-
import type { DataTag } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
getUntypedClient,
|
|
5
|
-
TRPCUntypedClient,
|
|
6
|
-
type CreateTRPCClient,
|
|
7
|
-
type TRPCRequestOptions,
|
|
8
|
-
} from '@trpc/client';
|
|
9
|
-
import {
|
|
10
|
-
type AnyProcedure,
|
|
11
|
-
type inferProcedureInput,
|
|
12
|
-
type inferRouterContext,
|
|
13
|
-
type inferTransformedProcedureOutput,
|
|
14
|
-
type ProcedureType,
|
|
15
|
-
} from '@trpc/server';
|
|
1
|
+
import type { DataTag, QueryClient, QueryFilters } from '@tanstack/react-query';
|
|
2
|
+
import type { CreateTRPCClient, TRPCRequestOptions } from '@trpc/client';
|
|
3
|
+
import { getUntypedClient, TRPCUntypedClient } from '@trpc/client';
|
|
16
4
|
import type {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} from '@trpc/server
|
|
5
|
+
AnyTRPCProcedure,
|
|
6
|
+
AnyTRPCRootTypes,
|
|
7
|
+
AnyTRPCRouter,
|
|
8
|
+
inferProcedureInput,
|
|
9
|
+
inferRouterContext,
|
|
10
|
+
inferTransformedProcedureOutput,
|
|
11
|
+
TRPCProcedureType,
|
|
12
|
+
TRPCRouterRecord,
|
|
13
|
+
} from '@trpc/server';
|
|
14
|
+
import { callTRPCProcedure, createTRPCRecursiveProxy } from '@trpc/server';
|
|
15
|
+
import type { MaybePromise } from '@trpc/server/unstable-core-do-not-import';
|
|
26
16
|
import {
|
|
27
17
|
trpcInfiniteQueryOptions,
|
|
28
18
|
type TRPCInfiniteQueryOptions,
|
|
@@ -54,6 +44,7 @@ export interface DecorateQueryKeyable {
|
|
|
54
44
|
* Calculate the TanStack Query Key for a Route
|
|
55
45
|
*
|
|
56
46
|
* @see https://tanstack.com/query/latest/docs/framework/react/guides/query-keys
|
|
47
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#queryKey
|
|
57
48
|
*/
|
|
58
49
|
queryKey: () => TRPCQueryKey;
|
|
59
50
|
|
|
@@ -61,6 +52,7 @@ export interface DecorateQueryKeyable {
|
|
|
61
52
|
* Calculate a TanStack Query Filter for a Route
|
|
62
53
|
*
|
|
63
54
|
* @see https://tanstack.com/query/latest/docs/framework/react/guides/filters
|
|
55
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#queryFilter
|
|
64
56
|
*/
|
|
65
57
|
queryFilter: (input?: undefined, filters?: QueryFilters) => QueryFilters;
|
|
66
58
|
}
|
|
@@ -88,12 +80,18 @@ export interface DecorateQueryProcedure<TDef extends ResolverDef> {
|
|
|
88
80
|
};
|
|
89
81
|
|
|
90
82
|
/**
|
|
83
|
+
* Create a set of type-safe query options that can be passed to `useQuery`, `prefetchQuery` etc.
|
|
84
|
+
*
|
|
91
85
|
* @see https://tanstack.com/query/latest/docs/framework/react/reference/queryOptions#queryoptions
|
|
86
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#queryOptions
|
|
92
87
|
*/
|
|
93
88
|
queryOptions: TRPCQueryOptions<TDef>;
|
|
94
89
|
|
|
95
90
|
/**
|
|
91
|
+
* Create a set of type-safe infinite query options that can be passed to `useInfiniteQuery`, `prefetchInfiniteQuery` etc.
|
|
92
|
+
*
|
|
96
93
|
* @see https://tanstack.com/query/latest/docs/framework/react/reference/infiniteQueryOptions#infinitequeryoptions
|
|
94
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#infiniteQueryOptions
|
|
97
95
|
*/
|
|
98
96
|
infiniteQueryOptions: TRPCInfiniteQueryOptions<TDef>;
|
|
99
97
|
|
|
@@ -101,6 +99,7 @@ export interface DecorateQueryProcedure<TDef extends ResolverDef> {
|
|
|
101
99
|
* Calculate the TanStack Query Key for a Query Procedure
|
|
102
100
|
*
|
|
103
101
|
* @see https://tanstack.com/query/latest/docs/framework/react/guides/query-keys
|
|
102
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#queryKey
|
|
104
103
|
*/
|
|
105
104
|
queryKey: (
|
|
106
105
|
input?: TDef['input'],
|
|
@@ -110,6 +109,7 @@ export interface DecorateQueryProcedure<TDef extends ResolverDef> {
|
|
|
110
109
|
* Calculate a TanStack Query Filter for a Query Procedure
|
|
111
110
|
*
|
|
112
111
|
* @see https://tanstack.com/query/latest/docs/framework/react/guides/filters
|
|
112
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#queryFilter
|
|
113
113
|
*/
|
|
114
114
|
queryFilter: (
|
|
115
115
|
input?: TDef['input'],
|
|
@@ -132,25 +132,31 @@ export interface DecorateMutationProcedure<TDef extends ResolverDef> {
|
|
|
132
132
|
};
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
|
-
*
|
|
135
|
+
* Create a set of type-safe mutation options that can be passed to `useMutation`
|
|
136
|
+
*
|
|
137
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#mutationOptions
|
|
136
138
|
*/
|
|
137
139
|
mutationOptions: TRPCMutationOptions<TDef>;
|
|
138
140
|
|
|
139
141
|
/**
|
|
140
142
|
* Calculate the TanStack Mutation Key for a Mutation Procedure
|
|
143
|
+
*
|
|
144
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#mutationKey
|
|
141
145
|
*/
|
|
142
146
|
mutationKey: () => TRPCMutationKey;
|
|
143
147
|
}
|
|
144
148
|
|
|
145
149
|
export interface DecorateSubscriptionProcedure<TDef extends ResolverDef> {
|
|
146
150
|
/**
|
|
147
|
-
*
|
|
151
|
+
* Create a set of type-safe subscription options that can be passed to `useSubscription`
|
|
152
|
+
*
|
|
153
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/usage#subscriptionOptions
|
|
148
154
|
*/
|
|
149
155
|
subscriptionOptions: TRPCSubscriptionOptions<TDef>;
|
|
150
156
|
}
|
|
151
157
|
|
|
152
158
|
export type DecorateProcedure<
|
|
153
|
-
TType extends
|
|
159
|
+
TType extends TRPCProcedureType,
|
|
154
160
|
TDef extends ResolverDef,
|
|
155
161
|
> = TType extends 'query'
|
|
156
162
|
? DecorateQueryProcedure<TDef>
|
|
@@ -164,13 +170,13 @@ export type DecorateProcedure<
|
|
|
164
170
|
* @internal
|
|
165
171
|
*/
|
|
166
172
|
export type DecoratedProcedureUtilsRecord<
|
|
167
|
-
TRoot extends
|
|
168
|
-
TRecord extends
|
|
173
|
+
TRoot extends AnyTRPCRootTypes,
|
|
174
|
+
TRecord extends TRPCRouterRecord,
|
|
169
175
|
> = {
|
|
170
176
|
[TKey in keyof TRecord]: TRecord[TKey] extends infer $Value
|
|
171
|
-
? $Value extends
|
|
177
|
+
? $Value extends TRPCRouterRecord
|
|
172
178
|
? DecoratedProcedureUtilsRecord<TRoot, $Value> & DecorateQueryKeyable
|
|
173
|
-
: $Value extends
|
|
179
|
+
: $Value extends AnyTRPCProcedure
|
|
174
180
|
? DecorateProcedure<
|
|
175
181
|
$Value['_def']['type'],
|
|
176
182
|
{
|
|
@@ -184,7 +190,7 @@ export type DecoratedProcedureUtilsRecord<
|
|
|
184
190
|
: never;
|
|
185
191
|
};
|
|
186
192
|
|
|
187
|
-
export type TRPCOptionsProxy<TRouter extends
|
|
193
|
+
export type TRPCOptionsProxy<TRouter extends AnyTRPCRouter> =
|
|
188
194
|
DecoratedProcedureUtilsRecord<
|
|
189
195
|
TRouter['_def']['_config']['$types'],
|
|
190
196
|
TRouter['_def']['record']
|
|
@@ -198,18 +204,22 @@ export interface TRPCOptionsProxyOptionsBase {
|
|
|
198
204
|
};
|
|
199
205
|
}
|
|
200
206
|
|
|
201
|
-
export interface TRPCOptionsProxyOptionsInternal<
|
|
207
|
+
export interface TRPCOptionsProxyOptionsInternal<
|
|
208
|
+
TRouter extends AnyTRPCRouter,
|
|
209
|
+
> {
|
|
202
210
|
router: TRouter;
|
|
203
211
|
ctx:
|
|
204
212
|
| inferRouterContext<TRouter>
|
|
205
213
|
| (() => MaybePromise<inferRouterContext<TRouter>>);
|
|
206
214
|
}
|
|
207
215
|
|
|
208
|
-
export interface TRPCOptionsProxyOptionsExternal<
|
|
216
|
+
export interface TRPCOptionsProxyOptionsExternal<
|
|
217
|
+
TRouter extends AnyTRPCRouter,
|
|
218
|
+
> {
|
|
209
219
|
client: TRPCUntypedClient<TRouter> | CreateTRPCClient<TRouter>;
|
|
210
220
|
}
|
|
211
221
|
|
|
212
|
-
export type TRPCOptionsProxyOptions<TRouter extends
|
|
222
|
+
export type TRPCOptionsProxyOptions<TRouter extends AnyTRPCRouter> =
|
|
213
223
|
TRPCOptionsProxyOptionsBase &
|
|
214
224
|
(
|
|
215
225
|
| TRPCOptionsProxyOptionsInternal<TRouter>
|
|
@@ -232,14 +242,20 @@ function getQueryType(method: UtilsMethods) {
|
|
|
232
242
|
return map[method];
|
|
233
243
|
}
|
|
234
244
|
|
|
235
|
-
|
|
245
|
+
/**
|
|
246
|
+
* Create a typed proxy from your router types. Can also be used on the server.
|
|
247
|
+
*
|
|
248
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/setup#3b-setup-without-react-context
|
|
249
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/server-components#5-create-a-trpc-caller-for-server-components
|
|
250
|
+
*/
|
|
251
|
+
export function createTRPCOptionsProxy<TRouter extends AnyTRPCRouter>(
|
|
236
252
|
opts: TRPCOptionsProxyOptions<TRouter>,
|
|
237
253
|
): TRPCOptionsProxy<TRouter> {
|
|
238
|
-
const callIt = (type:
|
|
254
|
+
const callIt = (type: TRPCProcedureType): any => {
|
|
239
255
|
return (path: string, input: unknown, trpcOpts: TRPCRequestOptions) => {
|
|
240
256
|
if ('router' in opts) {
|
|
241
257
|
return Promise.resolve(unwrapLazyArg(opts.ctx)).then((ctx) =>
|
|
242
|
-
|
|
258
|
+
callTRPCProcedure({
|
|
243
259
|
router: opts.router,
|
|
244
260
|
path: path,
|
|
245
261
|
getRawInput: async () => input,
|
|
@@ -259,7 +275,7 @@ export function createTRPCOptionsProxy<TRouter extends AnyRouter>(
|
|
|
259
275
|
};
|
|
260
276
|
};
|
|
261
277
|
|
|
262
|
-
return
|
|
278
|
+
return createTRPCRecursiveProxy(({ args, path: _path }) => {
|
|
263
279
|
const path = [..._path];
|
|
264
280
|
const utilName = path.pop() as UtilsMethods;
|
|
265
281
|
const [arg1, arg2] = args as any[];
|
|
@@ -2,16 +2,13 @@ import type {
|
|
|
2
2
|
DataTag,
|
|
3
3
|
DefinedInitialDataInfiniteOptions,
|
|
4
4
|
InfiniteData,
|
|
5
|
+
QueryClient,
|
|
5
6
|
QueryFunction,
|
|
7
|
+
SkipToken,
|
|
6
8
|
UndefinedInitialDataInfiniteOptions,
|
|
7
9
|
UnusedSkipTokenInfiniteOptions,
|
|
8
10
|
} from '@tanstack/react-query';
|
|
9
|
-
import {
|
|
10
|
-
infiniteQueryOptions,
|
|
11
|
-
skipToken,
|
|
12
|
-
type QueryClient,
|
|
13
|
-
type SkipToken,
|
|
14
|
-
} from '@tanstack/react-query';
|
|
11
|
+
import { infiniteQueryOptions, skipToken } from '@tanstack/react-query';
|
|
15
12
|
import type { TRPCClientErrorLike, TRPCUntypedClient } from '@trpc/client';
|
|
16
13
|
import type { DistributiveOmit } from '@trpc/server/unstable-core-do-not-import';
|
|
17
14
|
import type {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type {
|
|
2
|
+
MutationFunction,
|
|
3
|
+
QueryClient,
|
|
4
|
+
UseMutationOptions,
|
|
5
5
|
} from '@tanstack/react-query';
|
|
6
6
|
import type { TRPCClientErrorLike, TRPCUntypedClient } from '@trpc/client';
|
|
7
7
|
import type {
|
|
@@ -3,10 +3,11 @@ import type {
|
|
|
3
3
|
DefinedInitialDataOptions,
|
|
4
4
|
QueryClient,
|
|
5
5
|
QueryFunction,
|
|
6
|
+
SkipToken,
|
|
6
7
|
UndefinedInitialDataOptions,
|
|
7
8
|
UnusedSkipTokenOptions,
|
|
8
9
|
} from '@tanstack/react-query';
|
|
9
|
-
import { queryOptions, skipToken
|
|
10
|
+
import { queryOptions, skipToken } from '@tanstack/react-query';
|
|
10
11
|
import type { TRPCClientErrorLike, TRPCUntypedClient } from '@trpc/client';
|
|
11
12
|
import type {
|
|
12
13
|
coerceAsyncIterableToArray,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SkipToken } from '@tanstack/react-query';
|
|
2
|
+
import { hashKey, skipToken } from '@tanstack/react-query';
|
|
2
3
|
import type { TRPCClientErrorLike, TRPCUntypedClient } from '@trpc/client';
|
|
3
4
|
import type { TRPCConnectionState } from '@trpc/client/unstable-internals';
|
|
4
5
|
import type { Unsubscribable } from '@trpc/server/observable';
|
package/src/internals/types.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { TRPCRequestOptions } from '@trpc/client';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
3
6
|
export type ResolverDef = {
|
|
4
7
|
input: any;
|
|
5
8
|
output: any;
|
|
@@ -7,10 +10,16 @@ export type ResolverDef = {
|
|
|
7
10
|
errorShape: any;
|
|
8
11
|
};
|
|
9
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
10
16
|
export type ExtractCursorType<TInput> = TInput extends { cursor?: any }
|
|
11
17
|
? TInput['cursor']
|
|
12
18
|
: unknown;
|
|
13
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
14
23
|
export interface TRPCReactRequestOptions
|
|
15
24
|
// For RQ, we use their internal AbortSignals instead of letting the user pass their own
|
|
16
25
|
extends Omit<TRPCRequestOptions, 'signal'> {
|
|
@@ -24,6 +33,9 @@ export interface TRPCReactRequestOptions
|
|
|
24
33
|
abortOnUnmount?: boolean;
|
|
25
34
|
}
|
|
26
35
|
|
|
36
|
+
/**
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
27
39
|
export interface TRPCQueryBaseOptions {
|
|
28
40
|
/**
|
|
29
41
|
* tRPC-related options
|
|
@@ -31,17 +43,29 @@ export interface TRPCQueryBaseOptions {
|
|
|
31
43
|
trpc?: TRPCReactRequestOptions;
|
|
32
44
|
}
|
|
33
45
|
|
|
46
|
+
/**
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
34
49
|
export interface TRPCQueryOptionsResult {
|
|
35
50
|
trpc: {
|
|
36
51
|
path: string;
|
|
37
52
|
};
|
|
38
53
|
}
|
|
39
54
|
|
|
55
|
+
/**
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
40
58
|
export type QueryType = 'any' | 'infinite' | 'query';
|
|
41
59
|
|
|
60
|
+
/**
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
42
63
|
export type TRPCQueryKey = [
|
|
43
64
|
readonly string[],
|
|
44
65
|
{ input?: unknown; type?: Exclude<QueryType, 'any'> }?,
|
|
45
66
|
];
|
|
46
67
|
|
|
68
|
+
/**
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
47
71
|
export type TRPCMutationKey = [readonly string[]]; // = [TRPCQueryKey[0]]
|
package/src/internals/utils.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { skipToken } from '@tanstack/react-query';
|
|
2
3
|
import { isFunction, isObject } from '@trpc/server/unstable-core-do-not-import';
|
|
3
4
|
import type {
|
|
4
5
|
QueryType,
|
|
@@ -77,7 +78,9 @@ export async function buildQueryFromAsyncIterable(
|
|
|
77
78
|
* To allow easy interactions with groups of related queries, such as
|
|
78
79
|
* invalidating all queries of a router, we use an array as the path when
|
|
79
80
|
* storing in tanstack query.
|
|
80
|
-
|
|
81
|
+
*
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
81
84
|
export function getQueryKeyInternal(
|
|
82
85
|
path: readonly string[],
|
|
83
86
|
input: unknown,
|
|
@@ -126,6 +129,9 @@ export function getQueryKeyInternal(
|
|
|
126
129
|
];
|
|
127
130
|
}
|
|
128
131
|
|
|
132
|
+
/**
|
|
133
|
+
* @internal
|
|
134
|
+
*/
|
|
129
135
|
export function getMutationKeyInternal(
|
|
130
136
|
path: readonly string[],
|
|
131
137
|
): TRPCMutationKey {
|
|
@@ -135,6 +141,9 @@ export function getMutationKeyInternal(
|
|
|
135
141
|
return splitPath.length ? [splitPath] : ([] as unknown as TRPCMutationKey);
|
|
136
142
|
}
|
|
137
143
|
|
|
144
|
+
/**
|
|
145
|
+
* @internal
|
|
146
|
+
*/
|
|
138
147
|
export function unwrapLazyArg<T>(valueOrLazy: T | (() => T)): T {
|
|
139
148
|
return (isFunction(valueOrLazy) ? valueOrLazy() : valueOrLazy) as T;
|
|
140
149
|
}
|