@trpc/react-query 11.1.3-alpha-tmp-issues-6785.34 → 11.1.3-alpha-tmp-tsdown.24
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/_virtual/rolldown_runtime.js +30 -0
- package/dist/createTRPCQueryUtils.d.mts +11 -0
- package/dist/createTRPCQueryUtils.d.mts.map +1 -0
- package/dist/createTRPCQueryUtils.d.ts +10 -3
- package/dist/createTRPCQueryUtils.d.ts.map +1 -1
- package/dist/createTRPCQueryUtils.js +8 -12
- package/dist/createTRPCQueryUtils.mjs +8 -9
- package/dist/createTRPCQueryUtils.mjs.map +1 -0
- package/dist/createTRPCReact.d.mts +142 -0
- package/dist/createTRPCReact.d.mts.map +1 -0
- package/dist/createTRPCReact.d.ts +91 -96
- package/dist/createTRPCReact.d.ts.map +1 -1
- package/dist/createTRPCReact.js +27 -54
- package/dist/createTRPCReact.mjs +27 -32
- package/dist/createTRPCReact.mjs.map +1 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +11 -15
- package/dist/index.mjs +7 -4
- package/dist/internals/context.d.mts +163 -0
- package/dist/internals/context.d.mts.map +1 -0
- package/dist/internals/context.d.ts +145 -139
- package/dist/internals/context.d.ts.map +1 -1
- package/dist/internals/context.js +10 -28
- package/dist/internals/context.mjs +8 -5
- package/dist/internals/context.mjs.map +1 -0
- package/dist/internals/getClientArgs.d.mts +16 -0
- package/dist/internals/getClientArgs.d.mts.map +1 -0
- package/dist/internals/getClientArgs.d.ts +11 -4
- package/dist/internals/getClientArgs.d.ts.map +1 -1
- package/dist/internals/getClientArgs.js +18 -20
- package/dist/internals/getClientArgs.mjs +18 -18
- package/dist/internals/getClientArgs.mjs.map +1 -0
- package/dist/internals/getQueryKey.d.mts +44 -0
- package/dist/internals/getQueryKey.d.mts.map +1 -0
- package/dist/internals/getQueryKey.d.ts +21 -26
- package/dist/internals/getQueryKey.d.ts.map +1 -1
- package/dist/internals/getQueryKey.js +43 -62
- package/dist/internals/getQueryKey.mjs +42 -59
- package/dist/internals/getQueryKey.mjs.map +1 -0
- package/dist/internals/trpcResult.js +27 -53
- package/dist/internals/trpcResult.mjs +26 -31
- package/dist/internals/trpcResult.mjs.map +1 -0
- package/dist/internals/useQueries.d.mts +53 -0
- package/dist/internals/useQueries.d.mts.map +1 -0
- package/dist/internals/useQueries.d.ts +19 -24
- package/dist/internals/useQueries.d.ts.map +1 -1
- package/dist/rsc.d.mts +80 -0
- package/dist/rsc.d.mts.map +1 -0
- package/dist/rsc.d.ts +56 -56
- package/dist/rsc.d.ts.map +1 -1
- package/dist/rsc.js +66 -126
- package/dist/rsc.mjs +65 -104
- package/dist/rsc.mjs.map +1 -0
- package/dist/server/index.d.mts +2 -0
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +2 -6
- package/dist/server/index.mjs +3 -1
- package/dist/server/ssgProxy.d.mts +32 -0
- package/dist/server/ssgProxy.d.mts.map +1 -0
- package/dist/server/ssgProxy.d.ts +17 -16
- package/dist/server/ssgProxy.d.ts.map +1 -1
- package/dist/server/ssgProxy.js +131 -137
- package/dist/server/ssgProxy.mjs +130 -134
- package/dist/server/ssgProxy.mjs.map +1 -0
- package/dist/shared/hooks/createHooksInternal.d.mts +38 -0
- package/dist/shared/hooks/createHooksInternal.d.mts.map +1 -0
- package/dist/shared/hooks/createHooksInternal.d.ts +29 -22
- package/dist/shared/hooks/createHooksInternal.d.ts.map +1 -1
- package/dist/shared/hooks/createHooksInternal.js +427 -538
- package/dist/shared/hooks/createHooksInternal.mjs +426 -516
- package/dist/shared/hooks/createHooksInternal.mjs.map +1 -0
- package/dist/shared/hooks/createRootHooks.js +1 -0
- package/dist/shared/hooks/createRootHooks.mjs +1 -0
- package/dist/shared/hooks/types.d.mts +153 -0
- package/dist/shared/hooks/types.d.mts.map +1 -0
- package/dist/shared/hooks/types.d.ts +121 -125
- package/dist/shared/hooks/types.d.ts.map +1 -1
- package/dist/shared/index.d.mts +16 -0
- package/dist/shared/index.d.ts +16 -22
- package/dist/shared/index.js +18 -21
- package/dist/shared/index.mjs +10 -7
- package/dist/shared/polymorphism/mutationLike.d.mts +24 -0
- package/dist/shared/polymorphism/mutationLike.d.mts.map +1 -0
- package/dist/shared/polymorphism/mutationLike.d.ts +13 -6
- package/dist/shared/polymorphism/mutationLike.d.ts.map +1 -1
- package/dist/shared/polymorphism/queryLike.d.mts +28 -0
- package/dist/shared/polymorphism/queryLike.d.mts.map +1 -0
- package/dist/shared/polymorphism/queryLike.d.ts +17 -10
- package/dist/shared/polymorphism/queryLike.d.ts.map +1 -1
- package/dist/shared/polymorphism/routerLike.d.mts +16 -0
- package/dist/shared/polymorphism/routerLike.d.mts.map +1 -0
- package/dist/shared/polymorphism/routerLike.d.ts +12 -7
- package/dist/shared/polymorphism/routerLike.d.ts.map +1 -1
- package/dist/shared/polymorphism/utilsLike.d.mts +14 -0
- package/dist/shared/polymorphism/utilsLike.d.mts.map +1 -0
- package/dist/shared/polymorphism/utilsLike.d.ts +10 -3
- package/dist/shared/polymorphism/utilsLike.d.ts.map +1 -1
- package/dist/shared/proxy/decorationProxy.d.mts +15 -0
- package/dist/shared/proxy/decorationProxy.d.mts.map +1 -0
- package/dist/shared/proxy/decorationProxy.d.ts +10 -3
- package/dist/shared/proxy/decorationProxy.d.ts.map +1 -1
- package/dist/shared/proxy/decorationProxy.js +18 -26
- package/dist/shared/proxy/decorationProxy.mjs +17 -23
- package/dist/shared/proxy/decorationProxy.mjs.map +1 -0
- package/dist/shared/proxy/useQueriesProxy.d.mts +23 -0
- package/dist/shared/proxy/useQueriesProxy.d.mts.map +1 -0
- package/dist/shared/proxy/useQueriesProxy.d.ts +10 -12
- package/dist/shared/proxy/useQueriesProxy.d.ts.map +1 -1
- package/dist/shared/proxy/useQueriesProxy.js +25 -23
- package/dist/shared/proxy/useQueriesProxy.mjs +24 -20
- package/dist/shared/proxy/useQueriesProxy.mjs.map +1 -0
- package/dist/shared/proxy/utilsProxy.d.mts +142 -0
- package/dist/shared/proxy/utilsProxy.d.mts.map +1 -0
- package/dist/shared/proxy/utilsProxy.d.ts +122 -121
- package/dist/shared/proxy/utilsProxy.d.ts.map +1 -1
- package/dist/shared/proxy/utilsProxy.js +82 -95
- package/dist/shared/proxy/utilsProxy.mjs +81 -92
- package/dist/shared/proxy/utilsProxy.mjs.map +1 -0
- package/dist/shared/queryClient.d.mts +22 -0
- package/dist/shared/queryClient.d.mts.map +1 -0
- package/dist/shared/queryClient.d.ts +13 -8
- package/dist/shared/queryClient.d.ts.map +1 -1
- package/dist/shared/queryClient.js +8 -6
- package/dist/shared/queryClient.mjs +7 -3
- package/dist/shared/queryClient.mjs.map +1 -0
- package/dist/shared/types.d.mts +98 -0
- package/dist/shared/types.d.mts.map +1 -0
- package/dist/shared/types.d.ts +71 -71
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/utils/createUtilityFunctions.d.mts +24 -0
- package/dist/utils/createUtilityFunctions.d.mts.map +1 -0
- package/dist/utils/createUtilityFunctions.d.ts +16 -15
- package/dist/utils/createUtilityFunctions.d.ts.map +1 -1
- package/dist/utils/createUtilityFunctions.js +166 -192
- package/dist/utils/createUtilityFunctions.mjs +165 -189
- package/dist/utils/createUtilityFunctions.mjs.map +1 -0
- package/dist/utils/inferReactQueryProcedure.d.mts +27 -0
- package/dist/utils/inferReactQueryProcedure.d.mts.map +1 -0
- package/dist/utils/inferReactQueryProcedure.d.ts +14 -12
- package/dist/utils/inferReactQueryProcedure.d.ts.map +1 -1
- package/package.json +46 -28
- package/rsc/package.json +1 -0
- package/server/package.json +1 -0
- package/shared/package.json +1 -0
- package/src/createTRPCReact.tsx +0 -4
- package/src/shared/hooks/types.ts +0 -2
- package/src/shared/types.ts +2 -2
- package/dist/bundle-analysis.json +0 -258
- package/dist/index.d.ts.map +0 -1
- package/dist/internals/trpcResult.d.ts +0 -18
- package/dist/internals/trpcResult.d.ts.map +0 -1
- package/dist/server/index.d.ts.map +0 -1
- package/dist/shared/hooks/createRootHooks.d.ts +0 -2
- package/dist/shared/hooks/createRootHooks.d.ts.map +0 -1
- package/dist/shared/index.d.ts.map +0 -1
- package/dist/shared/polymorphism/index.d.ts +0 -5
- package/dist/shared/polymorphism/index.d.ts.map +0 -1
- package/rsc/index.d.ts +0 -1
- package/rsc/index.js +0 -1
- package/server/index.d.ts +0 -1
- package/server/index.js +0 -1
- package/shared/index.d.ts +0 -1
- package/shared/index.js +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(exports, '__toESM', {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return __toESM;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CreateQueryUtils } from "./shared/proxy/utilsProxy.mjs";
|
|
2
|
+
import { CreateQueryUtilsOptions } from "./utils/createUtilityFunctions.mjs";
|
|
3
|
+
import { AnyRouter } from "@trpc/server/unstable-core-do-not-import";
|
|
4
|
+
|
|
5
|
+
//#region src/createTRPCQueryUtils.d.ts
|
|
6
|
+
declare function createTRPCQueryUtils<TRouter extends AnyRouter>(opts: CreateQueryUtilsOptions<TRouter>): CreateQueryUtils<TRouter>;
|
|
7
|
+
//# sourceMappingURL=createTRPCQueryUtils.d.ts.map
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { createTRPCQueryUtils };
|
|
11
|
+
//# sourceMappingURL=createTRPCQueryUtils.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTRPCQueryUtils.d.mts","names":[],"sources":["../src/createTRPCQueryUtils.tsx"],"sourcesContent":[],"mappings":";;;;;iBAKgB,qCAAqC,iBAC7C,wBAAwB,WAAQ,iBAAA"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { CreateQueryUtils } from "./shared/proxy/utilsProxy.js";
|
|
2
|
+
import { CreateQueryUtilsOptions } from "./utils/createUtilityFunctions.js";
|
|
3
|
+
import { AnyRouter } from "@trpc/server/unstable-core-do-not-import";
|
|
4
|
+
|
|
5
|
+
//#region src/createTRPCQueryUtils.d.ts
|
|
6
|
+
declare function createTRPCQueryUtils<TRouter extends AnyRouter>(opts: CreateQueryUtilsOptions<TRouter>): CreateQueryUtils<TRouter>;
|
|
7
|
+
//# sourceMappingURL=createTRPCQueryUtils.d.ts.map
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { createTRPCQueryUtils };
|
|
4
11
|
//# sourceMappingURL=createTRPCQueryUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTRPCQueryUtils.d.ts","
|
|
1
|
+
{"version":3,"file":"createTRPCQueryUtils.d.ts","names":[],"sources":["../src/createTRPCQueryUtils.tsx"],"sourcesContent":[],"mappings":";;;;;iBAKgB,qCAAqC,iBAC7C,wBAAwB,WAAQ,iBAAA"}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require('
|
|
4
|
-
var utilsProxy = require('./shared/proxy/utilsProxy.js');
|
|
5
|
-
require('@trpc/client');
|
|
6
|
-
require('@tanstack/react-query');
|
|
7
|
-
require('react');
|
|
8
|
-
require('./internals/context.js');
|
|
9
|
-
var createUtilityFunctions = require('./utils/createUtilityFunctions.js');
|
|
1
|
+
const require_utilsProxy = require('./shared/proxy/utilsProxy.js');
|
|
2
|
+
const require_createUtilityFunctions = require('./utils/createUtilityFunctions.js');
|
|
3
|
+
require('./shared/index.js');
|
|
10
4
|
|
|
5
|
+
//#region src/createTRPCQueryUtils.tsx
|
|
11
6
|
function createTRPCQueryUtils(opts) {
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
const utils = require_createUtilityFunctions.createUtilityFunctions(opts);
|
|
8
|
+
return require_utilsProxy.createQueryUtilsProxy(utils);
|
|
14
9
|
}
|
|
15
10
|
|
|
16
|
-
|
|
11
|
+
//#endregion
|
|
12
|
+
exports.createTRPCQueryUtils = createTRPCQueryUtils;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import '@tanstack/react-query';
|
|
5
|
-
import 'react';
|
|
6
|
-
import './internals/context.mjs';
|
|
7
|
-
import { createUtilityFunctions } from './utils/createUtilityFunctions.mjs';
|
|
1
|
+
import { createQueryUtilsProxy } from "./shared/proxy/utilsProxy.mjs";
|
|
2
|
+
import { createUtilityFunctions } from "./utils/createUtilityFunctions.mjs";
|
|
3
|
+
import "./shared/index.mjs";
|
|
8
4
|
|
|
5
|
+
//#region src/createTRPCQueryUtils.tsx
|
|
9
6
|
function createTRPCQueryUtils(opts) {
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const utils = createUtilityFunctions(opts);
|
|
8
|
+
return createQueryUtilsProxy(utils);
|
|
12
9
|
}
|
|
13
10
|
|
|
11
|
+
//#endregion
|
|
14
12
|
export { createTRPCQueryUtils };
|
|
13
|
+
//# sourceMappingURL=createTRPCQueryUtils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTRPCQueryUtils.mjs","names":["opts: CreateQueryUtilsOptions<TRouter>"],"sources":["../src/createTRPCQueryUtils.tsx"],"sourcesContent":["import type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';\nimport { createQueryUtilsProxy } from './shared';\nimport type { CreateQueryUtilsOptions } from './utils/createUtilityFunctions';\nimport { createUtilityFunctions } from './utils/createUtilityFunctions';\n\nexport function createTRPCQueryUtils<TRouter extends AnyRouter>(\n opts: CreateQueryUtilsOptions<TRouter>,\n) {\n const utils = createUtilityFunctions(opts);\n return createQueryUtilsProxy<TRouter>(utils);\n}\n"],"mappings":";;;;;AAKA,SAAgB,qBACdA,MACA;CACA,MAAM,QAAQ,uBAAuB,KAAK;AAC1C,QAAO,sBAA+B,MAAM;AAC7C"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { TRPCFetchInfiniteQueryOptions, TRPCFetchQueryOptions } from "./internals/context.mjs";
|
|
2
|
+
import { DefinedUseTRPCQueryOptions, DefinedUseTRPCQueryResult, TRPCHookResult, TRPCProvider, TRPCSubscriptionResult, TRPCUseQueryBaseOptions, UseTRPCMutationOptions, UseTRPCMutationResult, UseTRPCQueryOptions, UseTRPCQueryResult, UseTRPCSubscriptionOptions, UseTRPCSuspenseQueryOptions } from "./shared/hooks/types.mjs";
|
|
3
|
+
import { CreateTRPCReactOptions } from "./shared/types.mjs";
|
|
4
|
+
import { CreateReactUtils } from "./shared/proxy/utilsProxy.mjs";
|
|
5
|
+
import { TRPCUseQueries, TRPCUseSuspenseQueries } from "./internals/useQueries.mjs";
|
|
6
|
+
import { TRPCClientErrorLike, createTRPCClient } from "@trpc/client";
|
|
7
|
+
import { DefinedInitialDataInfiniteOptions, DefinedUseInfiniteQueryResult, InfiniteData, SkipToken, UndefinedInitialDataInfiniteOptions, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, UseSuspenseQueryResult } from "@tanstack/react-query";
|
|
8
|
+
import { AnyProcedure, AnyRootTypes, AnyRouter, ProcedureType, ProtectedIntersection, RouterRecord, Simplify, inferAsyncIterableYield, inferProcedureInput, inferTransformedProcedureOutput } from "@trpc/server/unstable-core-do-not-import";
|
|
9
|
+
|
|
10
|
+
//#region src/createTRPCReact.d.ts
|
|
11
|
+
type ResolverDef = {
|
|
12
|
+
input: any;
|
|
13
|
+
output: any;
|
|
14
|
+
transformer: boolean;
|
|
15
|
+
errorShape: any;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
interface ProcedureUseQuery<TDef extends ResolverDef> {
|
|
21
|
+
<TQueryFnData extends TDef['output'] = TDef['output'], TData = TQueryFnData>(input: TDef['input'] | SkipToken, opts: DefinedUseTRPCQueryOptions<TQueryFnData, TData, TRPCClientErrorLike<{
|
|
22
|
+
errorShape: TDef['errorShape'];
|
|
23
|
+
transformer: TDef['transformer'];
|
|
24
|
+
}>, TDef['output']>): DefinedUseTRPCQueryResult<TData, TRPCClientErrorLike<{
|
|
25
|
+
errorShape: TDef['errorShape'];
|
|
26
|
+
transformer: TDef['transformer'];
|
|
27
|
+
}>>;
|
|
28
|
+
<TQueryFnData extends TDef['output'] = TDef['output'], TData = TQueryFnData>(input: TDef['input'] | SkipToken, opts?: UseTRPCQueryOptions<TQueryFnData, TData, TRPCClientErrorLike<TDef>, TDef['output']>): UseTRPCQueryResult<TData, TRPCClientErrorLike<TDef>>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
type ProcedureUsePrefetchQuery<TDef extends ResolverDef> = (input: TDef['input'] | SkipToken, opts?: TRPCFetchQueryOptions<TDef['output'], TRPCClientErrorLike<TDef>>) => void;
|
|
34
|
+
/**
|
|
35
|
+
* @remark `void` is here due to https://github.com/trpc/trpc/pull/4374
|
|
36
|
+
*/
|
|
37
|
+
type CursorInput = {
|
|
38
|
+
cursor?: any;
|
|
39
|
+
} | void;
|
|
40
|
+
type ReservedInfiniteQueryKeys = 'cursor' | 'direction';
|
|
41
|
+
type InfiniteInput<TInput> = Omit<TInput, ReservedInfiniteQueryKeys> | SkipToken;
|
|
42
|
+
type inferCursorType<TInput> = TInput extends {
|
|
43
|
+
cursor?: any;
|
|
44
|
+
} ? TInput['cursor'] : unknown;
|
|
45
|
+
type makeInfiniteQueryOptions<TCursor, TOptions> = Omit<TOptions, 'queryKey' | 'initialPageParam' | 'queryFn' | 'queryHash' | 'queryHashFn'> & TRPCUseQueryBaseOptions & {
|
|
46
|
+
initialCursor?: TCursor;
|
|
47
|
+
};
|
|
48
|
+
type trpcInfiniteData<TDef extends ResolverDef> = Simplify<InfiniteData<TDef['output'], inferCursorType<TDef['input']>>>;
|
|
49
|
+
interface useTRPCInfiniteQuery<TDef extends ResolverDef> {
|
|
50
|
+
<TData = trpcInfiniteData<TDef>>(input: InfiniteInput<TDef['input']>, opts: makeInfiniteQueryOptions<inferCursorType<TDef['input']>, DefinedInitialDataInfiniteOptions<TDef['output'], TRPCClientErrorLike<TDef>, TData, any, inferCursorType<TDef['input']>>>): TRPCHookResult & DefinedUseInfiniteQueryResult<TData, TRPCClientErrorLike<TDef>>;
|
|
51
|
+
<TData = trpcInfiniteData<TDef>>(input: InfiniteInput<TDef['input']>, opts?: makeInfiniteQueryOptions<inferCursorType<TDef['input']>, UndefinedInitialDataInfiniteOptions<TDef['output'], TRPCClientErrorLike<TDef>, TData, any, inferCursorType<TDef['input']>>>): TRPCHookResult & UseInfiniteQueryResult<TData, TRPCClientErrorLike<TDef>>;
|
|
52
|
+
<TData = trpcInfiniteData<TDef>>(input: InfiniteInput<TDef['input']>, opts?: makeInfiniteQueryOptions<inferCursorType<TDef['input']>, UseInfiniteQueryOptions<TDef['output'], TRPCClientErrorLike<TDef>, TData, any, inferCursorType<TDef['input']>>>): TRPCHookResult & UseInfiniteQueryResult<TData, TRPCClientErrorLike<TDef>>;
|
|
53
|
+
}
|
|
54
|
+
type useTRPCSuspenseInfiniteQuery<TDef extends ResolverDef> = (input: InfiniteInput<TDef['input']>, opts: makeInfiniteQueryOptions<inferCursorType<TDef['input']>, UseSuspenseInfiniteQueryOptions<TDef['output'], TRPCClientErrorLike<TDef>, trpcInfiniteData<TDef>, any, inferCursorType<TDef['input']>>>) => [trpcInfiniteData<TDef>, TRPCHookResult & UseSuspenseInfiniteQueryResult<trpcInfiniteData<TDef>, TRPCClientErrorLike<TDef>>];
|
|
55
|
+
/**
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
type MaybeDecoratedInfiniteQuery<TDef extends ResolverDef> = TDef['input'] extends CursorInput ? {
|
|
59
|
+
/**
|
|
60
|
+
* @see https://trpc.io/docs/v11/client/react/useInfiniteQuery
|
|
61
|
+
*/
|
|
62
|
+
useInfiniteQuery: useTRPCInfiniteQuery<TDef>;
|
|
63
|
+
/**
|
|
64
|
+
* @see https://trpc.io/docs/client/react/suspense#usesuspenseinfinitequery
|
|
65
|
+
*/
|
|
66
|
+
useSuspenseInfiniteQuery: useTRPCSuspenseInfiniteQuery<TDef>;
|
|
67
|
+
usePrefetchInfiniteQuery: (input: Omit<TDef['input'], ReservedInfiniteQueryKeys> | SkipToken, opts: TRPCFetchInfiniteQueryOptions<TDef['input'], TDef['output'], TRPCClientErrorLike<TDef>>) => void;
|
|
68
|
+
} : object;
|
|
69
|
+
/**
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
type DecoratedQueryMethods<TDef extends ResolverDef> = {
|
|
73
|
+
/**
|
|
74
|
+
* @see https://trpc.io/docs/v11/client/react/useQuery
|
|
75
|
+
*/
|
|
76
|
+
useQuery: ProcedureUseQuery<TDef>;
|
|
77
|
+
usePrefetchQuery: ProcedureUsePrefetchQuery<TDef>;
|
|
78
|
+
/**
|
|
79
|
+
* @see https://trpc.io/docs/v11/client/react/suspense#usesuspensequery
|
|
80
|
+
*/
|
|
81
|
+
useSuspenseQuery: <TQueryFnData extends TDef['output'] = TDef['output'], TData = TQueryFnData>(input: TDef['input'], opts?: UseTRPCSuspenseQueryOptions<TQueryFnData, TData, TRPCClientErrorLike<TDef>>) => [TData, UseSuspenseQueryResult<TData, TRPCClientErrorLike<TDef>> & TRPCHookResult];
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
86
|
+
type DecoratedQuery<TDef extends ResolverDef> = MaybeDecoratedInfiniteQuery<TDef> & DecoratedQueryMethods<TDef>;
|
|
87
|
+
type DecoratedMutation<TDef extends ResolverDef> = {
|
|
88
|
+
/**
|
|
89
|
+
* @see https://trpc.io/docs/v11/client/react/useMutation
|
|
90
|
+
*/
|
|
91
|
+
useMutation: <TContext = unknown>(opts?: UseTRPCMutationOptions<TDef['input'], TRPCClientErrorLike<TDef>, TDef['output'], TContext>) => UseTRPCMutationResult<TDef['output'], TRPCClientErrorLike<TDef>, TDef['input'], TContext>;
|
|
92
|
+
};
|
|
93
|
+
interface ProcedureUseSubscription<TDef extends ResolverDef> {
|
|
94
|
+
(input: TDef['input'], opts?: UseTRPCSubscriptionOptions<inferAsyncIterableYield<TDef['output']>, TRPCClientErrorLike<TDef>>): TRPCSubscriptionResult<inferAsyncIterableYield<TDef['output']>, TRPCClientErrorLike<TDef>>;
|
|
95
|
+
(input: TDef['input'] | SkipToken, opts?: Omit<UseTRPCSubscriptionOptions<inferAsyncIterableYield<TDef['output']>, TRPCClientErrorLike<TDef>>, 'enabled'>): TRPCSubscriptionResult<inferAsyncIterableYield<TDef['output']>, TRPCClientErrorLike<TDef>>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
type DecorateProcedure<TType extends ProcedureType, TDef extends ResolverDef> = TType extends 'query' ? DecoratedQuery<TDef> : TType extends 'mutation' ? DecoratedMutation<TDef> : TType extends 'subscription' ? {
|
|
101
|
+
/**
|
|
102
|
+
* @see https://trpc.io/docs/v11/subscriptions
|
|
103
|
+
*/
|
|
104
|
+
useSubscription: ProcedureUseSubscription<TDef>;
|
|
105
|
+
} : never;
|
|
106
|
+
/**
|
|
107
|
+
* @internal
|
|
108
|
+
*/
|
|
109
|
+
type DecorateRouterRecord<TRoot extends AnyRootTypes, TRecord extends RouterRecord> = { [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends AnyProcedure ? DecorateProcedure<$Value['_def']['type'], {
|
|
110
|
+
input: inferProcedureInput<$Value>;
|
|
111
|
+
output: inferTransformedProcedureOutput<TRoot, $Value>;
|
|
112
|
+
transformer: TRoot['transformer'];
|
|
113
|
+
errorShape: TRoot['errorShape'];
|
|
114
|
+
}> : $Value extends RouterRecord ? DecorateRouterRecord<TRoot, $Value> : never : never };
|
|
115
|
+
/**
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
type CreateTRPCReactBase<TRouter extends AnyRouter, TSSRContext> = {
|
|
119
|
+
/**
|
|
120
|
+
* @deprecated renamed to `useUtils` and will be removed in a future tRPC version
|
|
121
|
+
*
|
|
122
|
+
* @see https://trpc.io/docs/v11/client/react/useUtils
|
|
123
|
+
*/
|
|
124
|
+
useContext(): CreateReactUtils<TRouter, TSSRContext>;
|
|
125
|
+
/**
|
|
126
|
+
* @see https://trpc.io/docs/v11/client/react/useUtils
|
|
127
|
+
*/
|
|
128
|
+
useUtils(): CreateReactUtils<TRouter, TSSRContext>;
|
|
129
|
+
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
130
|
+
createClient: typeof createTRPCClient<TRouter>;
|
|
131
|
+
useQueries: TRPCUseQueries<TRouter>;
|
|
132
|
+
useSuspenseQueries: TRPCUseSuspenseQueries<TRouter>;
|
|
133
|
+
};
|
|
134
|
+
type CreateTRPCReact<TRouter extends AnyRouter, TSSRContext> = ProtectedIntersection<CreateTRPCReactBase<TRouter, TSSRContext>, DecorateRouterRecord<TRouter['_def']['_config']['$types'], TRouter['_def']['record']>>;
|
|
135
|
+
/**
|
|
136
|
+
* @internal
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
declare function createTRPCReact<TRouter extends AnyRouter, TSSRContext = unknown>(opts?: CreateTRPCReactOptions<TRouter>): CreateTRPCReact<TRouter, TSSRContext>;
|
|
140
|
+
//#endregion
|
|
141
|
+
export { CreateTRPCReact, CreateTRPCReactBase, DecorateProcedure, DecorateRouterRecord, DecoratedMutation, DecoratedQuery, createTRPCReact };
|
|
142
|
+
//# sourceMappingURL=createTRPCReact.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTRPCReact.d.mts","names":[],"sources":["../src/createTRPCReact.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;KAuDK,WAAA;;EAAA,MAAA,EAAA,GAAA;EASY,WAAA,EAAA,OAAiB;EAAA,UAAA,EAAA,GAAA;CAAA;;;;AAEvB,UAFM,iBAEN,CAAA,aAFqC,WAErC,CAAA,CAAA;EAAI,CAAA,qBADS,IACG,CAAA,QAAA,CAAA,GADc,IACd,CAAA,QAAA,CAAA,EAAA,QADsC,YACtC,CAAA,CAAA,KAAA,EAAhB,IAAgB,CAAA,OAAA,CAAA,GAAA,SAAA,EAAA,IAAA,EACjB,0BADiB,CAErB,YAFqB,EAGrB,KAHqB,EAIrB,mBAJqB,CAAA;IAErB,UAAA,EAGc,IAHd,CAAA,YAAA,CAAA;IACA,WAAA,EAGe,IAHf,CAAA,aAAA,CAAA;EAAK,CAAA,CAAA,E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/NJ,CA+NiB,OA/NjB,EA+N0B,WA/N1B,CAAA;EAAI,YAEgB,EAAA,OA8NL,gBA9NK,CA8NY,OA9NZ,CAAA;EAAI,UAAxB,EA+NM,cA/NN,CA+NqB,OA/NrB,CAAA;EAAmB,kBAEnB,EA8Nc,sBA9Nd,CA8NqC,OA9NrC,CAAA;CAAK;AAIL,KA6NI,eA7NJ,CAAA,gBA8NU,SA9NV,EAAA,WAAA,CAAA,GAgOJ,qBAhOI,CAiON,mBAjOM,CAiOc,OAjOd,EAiOuB,WAjOvB,CAAA,EAkON,oBAlOM,CAmOJ,OAnOI,CAAA,MAAA,CAAA,CAAA,SAAA,CAAA,CAAA,QAAA,CAAA,EAoOJ,OApOI,CAAA,MAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA;;;;;AAGgE,iBAuQxD,eAvQwD,CAAA,gBAwQtD,SAxQsD,EAAA,cAAA,OAAA,CAAA,CAAA,IAAA,CAAA,EA2Q/D,sBA3Q+D,CA2QxC,OA3QwC,CAAA,CAAA,EA4QrE,eA5QqE,CA4QrD,OA5QqD,EA4Q5C,WA5Q4C,CAAA"}
|
|
@@ -1,147 +1,142 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
import { TRPCFetchInfiniteQueryOptions, TRPCFetchQueryOptions } from "./internals/context.js";
|
|
2
|
+
import { DefinedUseTRPCQueryOptions, DefinedUseTRPCQueryResult, TRPCHookResult, TRPCProvider, TRPCSubscriptionResult, TRPCUseQueryBaseOptions, UseTRPCMutationOptions, UseTRPCMutationResult, UseTRPCQueryOptions, UseTRPCQueryResult, UseTRPCSubscriptionOptions, UseTRPCSuspenseQueryOptions } from "./shared/hooks/types.js";
|
|
3
|
+
import { CreateTRPCReactOptions } from "./shared/types.js";
|
|
4
|
+
import { CreateReactUtils } from "./shared/proxy/utilsProxy.js";
|
|
5
|
+
import { TRPCUseQueries, TRPCUseSuspenseQueries } from "./internals/useQueries.js";
|
|
6
|
+
import { TRPCClientErrorLike, createTRPCClient } from "@trpc/client";
|
|
7
|
+
import { AnyProcedure, AnyRootTypes, AnyRouter, ProcedureType, ProtectedIntersection, RouterRecord, Simplify, inferAsyncIterableYield, inferProcedureInput, inferTransformedProcedureOutput } from "@trpc/server/unstable-core-do-not-import";
|
|
8
|
+
import { DefinedInitialDataInfiniteOptions, DefinedUseInfiniteQueryResult, InfiniteData, SkipToken, UndefinedInitialDataInfiniteOptions, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, UseSuspenseQueryResult } from "@tanstack/react-query";
|
|
9
|
+
|
|
10
|
+
//#region src/createTRPCReact.d.ts
|
|
9
11
|
type ResolverDef = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
input: any;
|
|
13
|
+
output: any;
|
|
14
|
+
transformer: boolean;
|
|
15
|
+
errorShape: any;
|
|
14
16
|
};
|
|
15
17
|
/**
|
|
16
18
|
* @internal
|
|
17
19
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
interface ProcedureUseQuery<TDef extends ResolverDef> {
|
|
21
|
+
<TQueryFnData extends TDef['output'] = TDef['output'], TData = TQueryFnData>(input: TDef['input'] | SkipToken, opts: DefinedUseTRPCQueryOptions<TQueryFnData, TData, TRPCClientErrorLike<{
|
|
22
|
+
errorShape: TDef['errorShape'];
|
|
23
|
+
transformer: TDef['transformer'];
|
|
24
|
+
}>, TDef['output']>): DefinedUseTRPCQueryResult<TData, TRPCClientErrorLike<{
|
|
25
|
+
errorShape: TDef['errorShape'];
|
|
26
|
+
transformer: TDef['transformer'];
|
|
27
|
+
}>>;
|
|
28
|
+
<TQueryFnData extends TDef['output'] = TDef['output'], TData = TQueryFnData>(input: TDef['input'] | SkipToken, opts?: UseTRPCQueryOptions<TQueryFnData, TData, TRPCClientErrorLike<TDef>, TDef['output']>): UseTRPCQueryResult<TData, TRPCClientErrorLike<TDef>>;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* @internal
|
|
30
32
|
*/
|
|
31
|
-
|
|
33
|
+
type ProcedureUsePrefetchQuery<TDef extends ResolverDef> = (input: TDef['input'] | SkipToken, opts?: TRPCFetchQueryOptions<TDef['output'], TRPCClientErrorLike<TDef>>) => void;
|
|
32
34
|
/**
|
|
33
35
|
* @remark `void` is here due to https://github.com/trpc/trpc/pull/4374
|
|
34
36
|
*/
|
|
35
37
|
type CursorInput = {
|
|
36
|
-
|
|
38
|
+
cursor?: any;
|
|
37
39
|
} | void;
|
|
38
40
|
type ReservedInfiniteQueryKeys = 'cursor' | 'direction';
|
|
39
41
|
type InfiniteInput<TInput> = Omit<TInput, ReservedInfiniteQueryKeys> | SkipToken;
|
|
40
42
|
type inferCursorType<TInput> = TInput extends {
|
|
41
|
-
|
|
43
|
+
cursor?: any;
|
|
42
44
|
} ? TInput['cursor'] : unknown;
|
|
43
45
|
type makeInfiniteQueryOptions<TCursor, TOptions> = Omit<TOptions, 'queryKey' | 'initialPageParam' | 'queryFn' | 'queryHash' | 'queryHashFn'> & TRPCUseQueryBaseOptions & {
|
|
44
|
-
|
|
46
|
+
initialCursor?: TCursor;
|
|
45
47
|
};
|
|
46
48
|
type trpcInfiniteData<TDef extends ResolverDef> = Simplify<InfiniteData<TDef['output'], inferCursorType<TDef['input']>>>;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
interface useTRPCInfiniteQuery<TDef extends ResolverDef> {
|
|
50
|
+
<TData = trpcInfiniteData<TDef>>(input: InfiniteInput<TDef['input']>, opts: makeInfiniteQueryOptions<inferCursorType<TDef['input']>, DefinedInitialDataInfiniteOptions<TDef['output'], TRPCClientErrorLike<TDef>, TData, any, inferCursorType<TDef['input']>>>): TRPCHookResult & DefinedUseInfiniteQueryResult<TData, TRPCClientErrorLike<TDef>>;
|
|
51
|
+
<TData = trpcInfiniteData<TDef>>(input: InfiniteInput<TDef['input']>, opts?: makeInfiniteQueryOptions<inferCursorType<TDef['input']>, UndefinedInitialDataInfiniteOptions<TDef['output'], TRPCClientErrorLike<TDef>, TData, any, inferCursorType<TDef['input']>>>): TRPCHookResult & UseInfiniteQueryResult<TData, TRPCClientErrorLike<TDef>>;
|
|
52
|
+
<TData = trpcInfiniteData<TDef>>(input: InfiniteInput<TDef['input']>, opts?: makeInfiniteQueryOptions<inferCursorType<TDef['input']>, UseInfiniteQueryOptions<TDef['output'], TRPCClientErrorLike<TDef>, TData, any, inferCursorType<TDef['input']>>>): TRPCHookResult & UseInfiniteQueryResult<TData, TRPCClientErrorLike<TDef>>;
|
|
51
53
|
}
|
|
52
|
-
|
|
53
|
-
trpcInfiniteData<TDef>,
|
|
54
|
-
TRPCHookResult & UseSuspenseInfiniteQueryResult<trpcInfiniteData<TDef>, TRPCClientErrorLike<TDef>>
|
|
55
|
-
];
|
|
54
|
+
type useTRPCSuspenseInfiniteQuery<TDef extends ResolverDef> = (input: InfiniteInput<TDef['input']>, opts: makeInfiniteQueryOptions<inferCursorType<TDef['input']>, UseSuspenseInfiniteQueryOptions<TDef['output'], TRPCClientErrorLike<TDef>, trpcInfiniteData<TDef>, any, inferCursorType<TDef['input']>>>) => [trpcInfiniteData<TDef>, TRPCHookResult & UseSuspenseInfiniteQueryResult<trpcInfiniteData<TDef>, TRPCClientErrorLike<TDef>>];
|
|
56
55
|
/**
|
|
57
56
|
* @internal
|
|
58
57
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
type MaybeDecoratedInfiniteQuery<TDef extends ResolverDef> = TDef['input'] extends CursorInput ? {
|
|
59
|
+
/**
|
|
60
|
+
* @see https://trpc.io/docs/v11/client/react/useInfiniteQuery
|
|
61
|
+
*/
|
|
62
|
+
useInfiniteQuery: useTRPCInfiniteQuery<TDef>;
|
|
63
|
+
/**
|
|
64
|
+
* @see https://trpc.io/docs/client/react/suspense#usesuspenseinfinitequery
|
|
65
|
+
*/
|
|
66
|
+
useSuspenseInfiniteQuery: useTRPCSuspenseInfiniteQuery<TDef>;
|
|
67
|
+
usePrefetchInfiniteQuery: (input: Omit<TDef['input'], ReservedInfiniteQueryKeys> | SkipToken, opts: TRPCFetchInfiniteQueryOptions<TDef['input'], TDef['output'], TRPCClientErrorLike<TDef>>) => void;
|
|
69
68
|
} : object;
|
|
70
69
|
/**
|
|
71
70
|
* @internal
|
|
72
71
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
TData,
|
|
84
|
-
UseSuspenseQueryResult<TData, TRPCClientErrorLike<TDef>> & TRPCHookResult
|
|
85
|
-
];
|
|
72
|
+
type DecoratedQueryMethods<TDef extends ResolverDef> = {
|
|
73
|
+
/**
|
|
74
|
+
* @see https://trpc.io/docs/v11/client/react/useQuery
|
|
75
|
+
*/
|
|
76
|
+
useQuery: ProcedureUseQuery<TDef>;
|
|
77
|
+
usePrefetchQuery: ProcedureUsePrefetchQuery<TDef>;
|
|
78
|
+
/**
|
|
79
|
+
* @see https://trpc.io/docs/v11/client/react/suspense#usesuspensequery
|
|
80
|
+
*/
|
|
81
|
+
useSuspenseQuery: <TQueryFnData extends TDef['output'] = TDef['output'], TData = TQueryFnData>(input: TDef['input'], opts?: UseTRPCSuspenseQueryOptions<TQueryFnData, TData, TRPCClientErrorLike<TDef>>) => [TData, UseSuspenseQueryResult<TData, TRPCClientErrorLike<TDef>> & TRPCHookResult];
|
|
86
82
|
};
|
|
87
83
|
/**
|
|
88
84
|
* @internal
|
|
89
85
|
*/
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
type DecoratedQuery<TDef extends ResolverDef> = MaybeDecoratedInfiniteQuery<TDef> & DecoratedQueryMethods<TDef>;
|
|
87
|
+
type DecoratedMutation<TDef extends ResolverDef> = {
|
|
88
|
+
/**
|
|
89
|
+
* @see https://trpc.io/docs/v11/client/react/useMutation
|
|
90
|
+
*/
|
|
91
|
+
useMutation: <TContext = unknown>(opts?: UseTRPCMutationOptions<TDef['input'], TRPCClientErrorLike<TDef>, TDef['output'], TContext>) => UseTRPCMutationResult<TDef['output'], TRPCClientErrorLike<TDef>, TDef['input'], TContext>;
|
|
96
92
|
};
|
|
97
93
|
interface ProcedureUseSubscription<TDef extends ResolverDef> {
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
(input: TDef['input'], opts?: UseTRPCSubscriptionOptions<inferAsyncIterableYield<TDef['output']>, TRPCClientErrorLike<TDef>>): TRPCSubscriptionResult<inferAsyncIterableYield<TDef['output']>, TRPCClientErrorLike<TDef>>;
|
|
95
|
+
(input: TDef['input'] | SkipToken, opts?: Omit<UseTRPCSubscriptionOptions<inferAsyncIterableYield<TDef['output']>, TRPCClientErrorLike<TDef>>, 'enabled'>): TRPCSubscriptionResult<inferAsyncIterableYield<TDef['output']>, TRPCClientErrorLike<TDef>>;
|
|
100
96
|
}
|
|
101
97
|
/**
|
|
102
98
|
* @internal
|
|
103
99
|
*/
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
100
|
+
type DecorateProcedure<TType extends ProcedureType, TDef extends ResolverDef> = TType extends 'query' ? DecoratedQuery<TDef> : TType extends 'mutation' ? DecoratedMutation<TDef> : TType extends 'subscription' ? {
|
|
101
|
+
/**
|
|
102
|
+
* @see https://trpc.io/docs/v11/subscriptions
|
|
103
|
+
*/
|
|
104
|
+
useSubscription: ProcedureUseSubscription<TDef>;
|
|
109
105
|
} : never;
|
|
110
106
|
/**
|
|
111
107
|
* @internal
|
|
112
108
|
*/
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}> : $Value extends RouterRecord ? DecorateRouterRecord<TRoot, $Value> : never : never;
|
|
120
|
-
};
|
|
109
|
+
type DecorateRouterRecord<TRoot extends AnyRootTypes, TRecord extends RouterRecord> = { [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends AnyProcedure ? DecorateProcedure<$Value['_def']['type'], {
|
|
110
|
+
input: inferProcedureInput<$Value>;
|
|
111
|
+
output: inferTransformedProcedureOutput<TRoot, $Value>;
|
|
112
|
+
transformer: TRoot['transformer'];
|
|
113
|
+
errorShape: TRoot['errorShape'];
|
|
114
|
+
}> : $Value extends RouterRecord ? DecorateRouterRecord<TRoot, $Value> : never : never };
|
|
121
115
|
/**
|
|
122
116
|
* @internal
|
|
123
117
|
*/
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
118
|
+
type CreateTRPCReactBase<TRouter extends AnyRouter, TSSRContext> = {
|
|
119
|
+
/**
|
|
120
|
+
* @deprecated renamed to `useUtils` and will be removed in a future tRPC version
|
|
121
|
+
*
|
|
122
|
+
* @see https://trpc.io/docs/v11/client/react/useUtils
|
|
123
|
+
*/
|
|
124
|
+
useContext(): CreateReactUtils<TRouter, TSSRContext>;
|
|
125
|
+
/**
|
|
126
|
+
* @see https://trpc.io/docs/v11/client/react/useUtils
|
|
127
|
+
*/
|
|
128
|
+
useUtils(): CreateReactUtils<TRouter, TSSRContext>;
|
|
129
|
+
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
130
|
+
createClient: typeof createTRPCClient<TRouter>;
|
|
131
|
+
useQueries: TRPCUseQueries<TRouter>;
|
|
132
|
+
useSuspenseQueries: TRPCUseSuspenseQueries<TRouter>;
|
|
139
133
|
};
|
|
140
|
-
|
|
134
|
+
type CreateTRPCReact<TRouter extends AnyRouter, TSSRContext> = ProtectedIntersection<CreateTRPCReactBase<TRouter, TSSRContext>, DecorateRouterRecord<TRouter['_def']['_config']['$types'], TRouter['_def']['record']>>;
|
|
141
135
|
/**
|
|
142
136
|
* @internal
|
|
143
137
|
*/
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
138
|
+
|
|
139
|
+
declare function createTRPCReact<TRouter extends AnyRouter, TSSRContext = unknown>(opts?: CreateTRPCReactOptions<TRouter>): CreateTRPCReact<TRouter, TSSRContext>;
|
|
140
|
+
//#endregion
|
|
141
|
+
export { CreateTRPCReact, CreateTRPCReactBase, DecorateProcedure, DecorateRouterRecord, DecoratedMutation, DecoratedQuery, createTRPCReact };
|
|
147
142
|
//# sourceMappingURL=createTRPCReact.d.ts.map
|