@trpc/next 11.0.0-next-beta.237 → 11.0.0-next-beta.239
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/app-dir/server.d.ts +3 -3
- package/dist/app-dir/server.d.ts.map +1 -1
- package/dist/app-dir/shared.d.ts +4 -4
- package/dist/app-dir/shared.d.ts.map +1 -1
- package/dist/app-dir/types.d.ts +7 -7
- package/dist/app-dir/types.d.ts.map +1 -1
- package/dist/bundle-analysis.json +8 -8
- package/dist/createTRPCNext.d.ts +1 -1
- package/dist/createTRPCNext.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/app-dir/server.ts +10 -5
- package/src/app-dir/shared.ts +7 -4
- package/src/app-dir/types.ts +8 -8
- package/src/createTRPCNext.tsx +1 -1
package/dist/app-dir/server.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { AnyProcedure,
|
|
1
|
+
import type { AnyProcedure, AnyRootTypes, AnyRouter, inferProcedureInput, MaybePromise, RootConfig, Simplify, TRPCResponse } from '@trpc/server/unstable-core-do-not-import';
|
|
2
2
|
import type { ActionHandlerDef, CreateTRPCNextAppRouterOptions, inferActionDef } from './shared';
|
|
3
3
|
import type { NextAppDirDecoratedProcedureRecord } from './types';
|
|
4
|
-
export declare function experimental_createTRPCNextAppDirServer<TRouter extends AnyRouter>(opts: CreateTRPCNextAppRouterOptions<TRouter>): NextAppDirDecoratedProcedureRecord<TRouter["_def"]["_config"], TRouter["_def"]["record"]>;
|
|
4
|
+
export declare function experimental_createTRPCNextAppDirServer<TRouter extends AnyRouter>(opts: CreateTRPCNextAppRouterOptions<TRouter>): NextAppDirDecoratedProcedureRecord<TRouter["_def"]["_config"]["$types"], TRouter["_def"]["record"]>;
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
export type TRPCActionHandler<TDef extends ActionHandlerDef> = (input: FormData | TDef['input']) => Promise<TRPCResponse<TDef['output'], TDef['errorShape']>>;
|
|
9
9
|
export declare function experimental_createServerActionHandler<TInstance extends {
|
|
10
|
-
_config:
|
|
10
|
+
_config: RootConfig<AnyRootTypes>;
|
|
11
11
|
}>(t: TInstance, opts: {
|
|
12
12
|
createContext: () => MaybePromise<TInstance['_config']['$types']['ctx']>;
|
|
13
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/app-dir/server.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/app-dir/server.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,YAAY,EACb,MAAM,0CAA0C,CAAC;AAWlD,OAAO,KAAK,EACV,gBAAgB,EAChB,8BAA8B,EAC9B,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,SAAS,CAAC;AAGlE,wBAAgB,uCAAuC,CACrD,OAAO,SAAS,SAAS,EACzB,IAAI,EAAE,8BAA8B,CAAC,OAAO,CAAC,uGA2B9C;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,IAAI,SAAS,gBAAgB,IAAI,CAC7D,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,KAC5B,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AAE/D,wBAAgB,sCAAsC,CACpD,SAAS,SAAS;IAChB,OAAO,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;CACnC,EAED,CAAC,EAAE,SAAS,EACZ,IAAI,EAAE;IACJ,aAAa,EAAE,MAAM,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACzE;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;;;;GAoEF;AAGD,wBAAsB,+BAA+B,CAAC,GAAG,EAAE,OAAO,qBAiBjE"}
|
package/dist/app-dir/shared.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { CreateTRPCClientOptions, Resolver, TRPCUntypedClient } from '@trpc/client';
|
|
2
|
-
import type { AnyProcedure, AnyQueryProcedure,
|
|
2
|
+
import type { AnyProcedure, AnyQueryProcedure, AnyRootTypes, AnyRouter, Filter, inferProcedureInput, ProtectedIntersection } from '@trpc/server/unstable-core-do-not-import';
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
6
6
|
export type UseProcedureRecord<TRouter extends AnyRouter> = {
|
|
7
|
-
[TKey in keyof Filter<TRouter['_def']['record'], AnyQueryProcedure | AnyRouter>]: TRouter['_def']['record'][TKey] extends AnyRouter ? UseProcedureRecord<TRouter['_def']['record'][TKey]> : Resolver<TRouter['_def']['_config'], TRouter['_def']['record'][TKey]>;
|
|
7
|
+
[TKey in keyof Filter<TRouter['_def']['record'], AnyQueryProcedure | AnyRouter>]: TRouter['_def']['record'][TKey] extends AnyRouter ? UseProcedureRecord<TRouter['_def']['record'][TKey]> : Resolver<TRouter['_def']['_config']['$types'], TRouter['_def']['record'][TKey]>;
|
|
8
8
|
};
|
|
9
9
|
export declare function createUseProxy<TRouter extends AnyRouter>(client: TRPCUntypedClient<TRouter>): UseProcedureRecord<TRouter>;
|
|
10
10
|
type NextAppRouterUse<TRouter extends AnyRouter> = {
|
|
@@ -39,10 +39,10 @@ export interface ActionHandlerDef {
|
|
|
39
39
|
/**
|
|
40
40
|
* @internal
|
|
41
41
|
*/
|
|
42
|
-
export type inferActionDef<
|
|
42
|
+
export type inferActionDef<TRoot extends AnyRootTypes, TProc extends AnyProcedure> = {
|
|
43
43
|
input: inferProcedureInput<TProc>;
|
|
44
44
|
output: TProc['_def']['_output_out'];
|
|
45
|
-
errorShape:
|
|
45
|
+
errorShape: TRoot['errorShape'];
|
|
46
46
|
};
|
|
47
47
|
export {};
|
|
48
48
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/app-dir/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,QAAQ,EACR,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/app-dir/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,QAAQ,EACR,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,MAAM,EACN,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,0CAA0C,CAAC;AAGlD;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,OAAO,SAAS,SAAS,IAAI;KACzD,IAAI,IAAI,MAAM,MAAM,CACnB,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EACzB,iBAAiB,GAAG,SAAS,CAC9B,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GACjD,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,GACnD,QAAQ,CACN,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,EACpC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAChC;CACN,CAAC;AAEF,wBA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G,CAAC;CACjB;AAGD;;GAEG;AACH,MAAM,MAAM,cAAc,CACxB,KAAK,SAAS,YAAY,EAC1B,KAAK,SAAS,YAAY,IACxB;IACF,KAAK,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC;IACrC,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;CACjC,CAAC"}
|
package/dist/app-dir/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Resolver } from '@trpc/client';
|
|
2
|
-
import type { AnyMutationProcedure, AnyProcedure, AnyQueryProcedure,
|
|
3
|
-
export type DecorateProcedureServer<
|
|
4
|
-
query: Resolver<
|
|
2
|
+
import type { AnyMutationProcedure, AnyProcedure, AnyQueryProcedure, AnyRootTypes, AnyRouter, AnySubscriptionProcedure, inferProcedureInput, ProcedureRouterRecord } from '@trpc/server/unstable-core-do-not-import';
|
|
3
|
+
export type DecorateProcedureServer<TRoot extends AnyRootTypes, TProcedure extends AnyProcedure> = TProcedure extends AnyQueryProcedure ? {
|
|
4
|
+
query: Resolver<TRoot, TProcedure>;
|
|
5
5
|
revalidate: (input?: inferProcedureInput<TProcedure>) => Promise<{
|
|
6
6
|
revalidated: false;
|
|
7
7
|
error: string;
|
|
@@ -9,11 +9,11 @@ export type DecorateProcedureServer<TConfig extends AnyRootConfig, TProcedure ex
|
|
|
9
9
|
revalidated: true;
|
|
10
10
|
}>;
|
|
11
11
|
} : TProcedure extends AnyMutationProcedure ? {
|
|
12
|
-
mutate: Resolver<
|
|
12
|
+
mutate: Resolver<TRoot, TProcedure>;
|
|
13
13
|
} : TProcedure extends AnySubscriptionProcedure ? {
|
|
14
|
-
subscribe: Resolver<
|
|
14
|
+
subscribe: Resolver<TRoot, TProcedure>;
|
|
15
15
|
} : never;
|
|
16
|
-
export type NextAppDirDecoratedProcedureRecord<
|
|
17
|
-
[TKey in keyof TProcedures]: TProcedures[TKey] extends AnyRouter ? NextAppDirDecoratedProcedureRecord<
|
|
16
|
+
export type NextAppDirDecoratedProcedureRecord<TRoot extends AnyRootTypes, TProcedures extends ProcedureRouterRecord> = {
|
|
17
|
+
[TKey in keyof TProcedures]: TProcedures[TKey] extends AnyRouter ? NextAppDirDecoratedProcedureRecord<TRoot, TProcedures[TKey]['_def']['record']> : TProcedures[TKey] extends AnyProcedure ? DecorateProcedureServer<TRoot, TProcedures[TKey]> : never;
|
|
18
18
|
};
|
|
19
19
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/app-dir/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EACV,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/app-dir/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EACV,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,0CAA0C,CAAC;AAElD,MAAM,MAAM,uBAAuB,CACjC,KAAK,SAAS,YAAY,EAC1B,UAAU,SAAS,YAAY,IAC7B,UAAU,SAAS,iBAAiB,GACpC;IACE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IACnC,UAAU,EAAE,CACV,KAAK,CAAC,EAAE,mBAAmB,CAAC,UAAU,CAAC,KACpC,OAAO,CACV;QAAE,WAAW,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,WAAW,EAAE,IAAI,CAAA;KAAE,CAC9D,CAAC;CACH,GACD,UAAU,SAAS,oBAAoB,GACvC;IACE,MAAM,EAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;CACrC,GACD,UAAU,SAAS,wBAAwB,GAC3C;IACE,SAAS,EAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;CACxC,GACD,KAAK,CAAC;AAEV,MAAM,MAAM,kCAAkC,CAC5C,KAAK,SAAS,YAAY,EAC1B,WAAW,SAAS,qBAAqB,IACvC;KACD,IAAI,IAAI,MAAM,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,SAAS,SAAS,GAC5D,kCAAkC,CAChC,KAAK,EACL,WAAW,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CACpC,GACD,WAAW,CAAC,IAAI,CAAC,SAAS,YAAY,GACtC,uBAAuB,CAAC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,GACjD,KAAK;CACV,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bundleSize": 22209,
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction":
|
|
3
|
+
"bundleOrigSize": 32702,
|
|
4
|
+
"bundleReduction": 32.09,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/withTRPC.tsx",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
{
|
|
22
22
|
"id": "/src/app-dir/server.ts",
|
|
23
23
|
"size": 3822,
|
|
24
|
-
"origSize":
|
|
24
|
+
"origSize": 4916,
|
|
25
25
|
"renderedExports": [
|
|
26
26
|
"experimental_createTRPCNextAppDirServer",
|
|
27
27
|
"experimental_createServerActionHandler",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"removedExports": [],
|
|
31
31
|
"dependents": [],
|
|
32
32
|
"percent": 17.21,
|
|
33
|
-
"reduction":
|
|
33
|
+
"reduction": 22.25
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"id": "/src/app-dir/create-action-hook.tsx",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
{
|
|
87
87
|
"id": "/src/createTRPCNext.tsx",
|
|
88
88
|
"size": 1073,
|
|
89
|
-
"origSize":
|
|
89
|
+
"origSize": 2706,
|
|
90
90
|
"renderedExports": [
|
|
91
91
|
"createTRPCNext"
|
|
92
92
|
],
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"/src/index.ts"
|
|
96
96
|
],
|
|
97
97
|
"percent": 4.83,
|
|
98
|
-
"reduction": 60.
|
|
98
|
+
"reduction": 60.35
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
"id": "/src/app-dir/formDataToObject.ts",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
{
|
|
115
115
|
"id": "/src/app-dir/shared.ts",
|
|
116
116
|
"size": 335,
|
|
117
|
-
"origSize":
|
|
117
|
+
"origSize": 2527,
|
|
118
118
|
"renderedExports": [
|
|
119
119
|
"generateCacheTag",
|
|
120
120
|
"isFormData"
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"/src/app-dir/create-action-hook.tsx"
|
|
130
130
|
],
|
|
131
131
|
"percent": 1.51,
|
|
132
|
-
"reduction": 86.
|
|
132
|
+
"reduction": 86.74
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
135
|
"id": "/src/index.ts",
|
package/dist/createTRPCNext.d.ts
CHANGED
|
@@ -24,6 +24,6 @@ export interface CreateTRPCNextBase<TRouter extends AnyRouter, TSSRContext exten
|
|
|
24
24
|
/**
|
|
25
25
|
* @internal
|
|
26
26
|
*/
|
|
27
|
-
export type CreateTRPCNext<TRouter extends AnyRouter, TSSRContext extends NextPageContext, TFlags> = ProtectedIntersection<CreateTRPCNextBase<TRouter, TSSRContext>, DecoratedProcedureRecord<TRouter['_def']['_config'], TRouter['_def']['record'], TFlags>>;
|
|
27
|
+
export type CreateTRPCNext<TRouter extends AnyRouter, TSSRContext extends NextPageContext, TFlags> = ProtectedIntersection<CreateTRPCNextBase<TRouter, TSSRContext>, DecoratedProcedureRecord<TRouter['_def']['_config']['$types'], TRouter['_def']['record'], TFlags>>;
|
|
28
28
|
export declare function createTRPCNext<TRouter extends AnyRouter, TSSRContext extends NextPageContext = NextPageContext, TFlags = null>(opts: WithTRPCNoSSROptions<TRouter> | WithTRPCSSROptions<TRouter>): CreateTRPCNext<TRouter, TSSRContext, TFlags>;
|
|
29
29
|
//# sourceMappingURL=createTRPCNext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTRPCNext.d.ts","sourceRoot":"","sources":["../src/createTRPCNext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAMlC,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EACtB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,kBAAkB,CACjC,OAAO,SAAS,SAAS,EACzB,WAAW,SAAS,eAAe;IAEnC;;;;OAIG;IACH,UAAU,IAAI,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACrD;;OAEG;IACH,QAAQ,IAAI,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACnD,QAAQ,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;IAC5D,UAAU,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACpC,kBAAkB,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;CACrD;AAED;;GAEG;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,wBAAwB,CACtB,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,EACpC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EACzB,MAAM,CACP,CACF,CAAC;AAEF,wBAAgB,cAAc,CAC5B,OAAO,SAAS,SAAS,EACzB,WAAW,SAAS,eAAe,GAAG,eAAe,EACrD,MAAM,GAAG,IAAI,EAEb,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,OAAO,CAAC,GAChE,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,CA+B9C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/next",
|
|
3
|
-
"version": "11.0.0-next-beta.
|
|
3
|
+
"version": "11.0.0-next-beta.239+423669add",
|
|
4
4
|
"description": "The tRPC Next.js library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
],
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"@tanstack/react-query": "^5.0.0",
|
|
70
|
-
"@trpc/client": "11.0.0-next-beta.
|
|
71
|
-
"@trpc/react-query": "11.0.0-next-beta.
|
|
72
|
-
"@trpc/server": "11.0.0-next-beta.
|
|
70
|
+
"@trpc/client": "11.0.0-next-beta.239+423669add",
|
|
71
|
+
"@trpc/react-query": "11.0.0-next-beta.239+423669add",
|
|
72
|
+
"@trpc/server": "11.0.0-next-beta.239+423669add",
|
|
73
73
|
"next": "*",
|
|
74
74
|
"react": ">=16.8.0",
|
|
75
75
|
"react-dom": ">=16.8.0"
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@tanstack/react-query": "^5.0.0",
|
|
87
|
-
"@trpc/client": "11.0.0-next-beta.
|
|
88
|
-
"@trpc/react-query": "11.0.0-next-beta.
|
|
89
|
-
"@trpc/server": "11.0.0-next-beta.
|
|
87
|
+
"@trpc/client": "11.0.0-next-beta.239+423669add",
|
|
88
|
+
"@trpc/react-query": "11.0.0-next-beta.239+423669add",
|
|
89
|
+
"@trpc/server": "11.0.0-next-beta.239+423669add",
|
|
90
90
|
"@types/express": "^4.17.17",
|
|
91
91
|
"@types/node": "^20.10.0",
|
|
92
92
|
"@types/react": "^18.2.33",
|
|
@@ -106,5 +106,5 @@
|
|
|
106
106
|
"funding": [
|
|
107
107
|
"https://trpc.io/sponsor"
|
|
108
108
|
],
|
|
109
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "423669addeb27890ad11e8816dc3ecb682df90f2"
|
|
110
110
|
}
|
package/src/app-dir/server.ts
CHANGED
|
@@ -5,10 +5,11 @@ import {
|
|
|
5
5
|
} from '@trpc/client';
|
|
6
6
|
import type {
|
|
7
7
|
AnyProcedure,
|
|
8
|
-
|
|
8
|
+
AnyRootTypes,
|
|
9
9
|
AnyRouter,
|
|
10
10
|
inferProcedureInput,
|
|
11
11
|
MaybePromise,
|
|
12
|
+
RootConfig,
|
|
12
13
|
Simplify,
|
|
13
14
|
TRPCResponse,
|
|
14
15
|
} from '@trpc/server/unstable-core-do-not-import';
|
|
@@ -57,7 +58,7 @@ export function experimental_createTRPCNextAppDirServer<
|
|
|
57
58
|
|
|
58
59
|
return (client[procedureType] as any)(procedurePath, ...callOpts.args);
|
|
59
60
|
}) as NextAppDirDecoratedProcedureRecord<
|
|
60
|
-
TRouter['_def']['_config'],
|
|
61
|
+
TRouter['_def']['_config']['$types'],
|
|
61
62
|
TRouter['_def']['record']
|
|
62
63
|
>;
|
|
63
64
|
}
|
|
@@ -71,7 +72,7 @@ export type TRPCActionHandler<TDef extends ActionHandlerDef> = (
|
|
|
71
72
|
|
|
72
73
|
export function experimental_createServerActionHandler<
|
|
73
74
|
TInstance extends {
|
|
74
|
-
_config:
|
|
75
|
+
_config: RootConfig<AnyRootTypes>;
|
|
75
76
|
},
|
|
76
77
|
>(
|
|
77
78
|
t: TInstance,
|
|
@@ -92,7 +93,9 @@ export function experimental_createServerActionHandler<
|
|
|
92
93
|
// TODO allow this to take a `TRouter` in addition to a `AnyProcedure`
|
|
93
94
|
return function createServerAction<TProc extends AnyProcedure>(
|
|
94
95
|
proc: TProc,
|
|
95
|
-
): TRPCActionHandler<
|
|
96
|
+
): TRPCActionHandler<
|
|
97
|
+
Simplify<inferActionDef<TInstance['_config']['$types'], TProc>>
|
|
98
|
+
> {
|
|
96
99
|
return async function actionHandler(
|
|
97
100
|
rawInput: FormData | inferProcedureInput<TProc>,
|
|
98
101
|
) {
|
|
@@ -144,7 +147,9 @@ export function experimental_createServerActionHandler<
|
|
|
144
147
|
error: shape,
|
|
145
148
|
});
|
|
146
149
|
}
|
|
147
|
-
} as TRPCActionHandler<
|
|
150
|
+
} as TRPCActionHandler<
|
|
151
|
+
inferActionDef<TInstance['_config']['$types'], TProc>
|
|
152
|
+
>;
|
|
148
153
|
};
|
|
149
154
|
}
|
|
150
155
|
|
package/src/app-dir/shared.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type {
|
|
|
6
6
|
import type {
|
|
7
7
|
AnyProcedure,
|
|
8
8
|
AnyQueryProcedure,
|
|
9
|
-
|
|
9
|
+
AnyRootTypes,
|
|
10
10
|
AnyRouter,
|
|
11
11
|
Filter,
|
|
12
12
|
inferProcedureInput,
|
|
@@ -23,7 +23,10 @@ export type UseProcedureRecord<TRouter extends AnyRouter> = {
|
|
|
23
23
|
AnyQueryProcedure | AnyRouter
|
|
24
24
|
>]: TRouter['_def']['record'][TKey] extends AnyRouter
|
|
25
25
|
? UseProcedureRecord<TRouter['_def']['record'][TKey]>
|
|
26
|
-
: Resolver<
|
|
26
|
+
: Resolver<
|
|
27
|
+
TRouter['_def']['_config']['$types'],
|
|
28
|
+
TRouter['_def']['record'][TKey]
|
|
29
|
+
>;
|
|
27
30
|
};
|
|
28
31
|
|
|
29
32
|
export function createUseProxy<TRouter extends AnyRouter>(
|
|
@@ -93,10 +96,10 @@ export interface ActionHandlerDef {
|
|
|
93
96
|
* @internal
|
|
94
97
|
*/
|
|
95
98
|
export type inferActionDef<
|
|
96
|
-
|
|
99
|
+
TRoot extends AnyRootTypes,
|
|
97
100
|
TProc extends AnyProcedure,
|
|
98
101
|
> = {
|
|
99
102
|
input: inferProcedureInput<TProc>;
|
|
100
103
|
output: TProc['_def']['_output_out'];
|
|
101
|
-
errorShape:
|
|
104
|
+
errorShape: TRoot['errorShape'];
|
|
102
105
|
};
|
package/src/app-dir/types.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
AnyMutationProcedure,
|
|
4
4
|
AnyProcedure,
|
|
5
5
|
AnyQueryProcedure,
|
|
6
|
-
|
|
6
|
+
AnyRootTypes,
|
|
7
7
|
AnyRouter,
|
|
8
8
|
AnySubscriptionProcedure,
|
|
9
9
|
inferProcedureInput,
|
|
@@ -11,11 +11,11 @@ import type {
|
|
|
11
11
|
} from '@trpc/server/unstable-core-do-not-import';
|
|
12
12
|
|
|
13
13
|
export type DecorateProcedureServer<
|
|
14
|
-
|
|
14
|
+
TRoot extends AnyRootTypes,
|
|
15
15
|
TProcedure extends AnyProcedure,
|
|
16
16
|
> = TProcedure extends AnyQueryProcedure
|
|
17
17
|
? {
|
|
18
|
-
query: Resolver<
|
|
18
|
+
query: Resolver<TRoot, TProcedure>;
|
|
19
19
|
revalidate: (
|
|
20
20
|
input?: inferProcedureInput<TProcedure>,
|
|
21
21
|
) => Promise<
|
|
@@ -24,24 +24,24 @@ export type DecorateProcedureServer<
|
|
|
24
24
|
}
|
|
25
25
|
: TProcedure extends AnyMutationProcedure
|
|
26
26
|
? {
|
|
27
|
-
mutate: Resolver<
|
|
27
|
+
mutate: Resolver<TRoot, TProcedure>;
|
|
28
28
|
}
|
|
29
29
|
: TProcedure extends AnySubscriptionProcedure
|
|
30
30
|
? {
|
|
31
|
-
subscribe: Resolver<
|
|
31
|
+
subscribe: Resolver<TRoot, TProcedure>;
|
|
32
32
|
}
|
|
33
33
|
: never;
|
|
34
34
|
|
|
35
35
|
export type NextAppDirDecoratedProcedureRecord<
|
|
36
|
-
|
|
36
|
+
TRoot extends AnyRootTypes,
|
|
37
37
|
TProcedures extends ProcedureRouterRecord,
|
|
38
38
|
> = {
|
|
39
39
|
[TKey in keyof TProcedures]: TProcedures[TKey] extends AnyRouter
|
|
40
40
|
? NextAppDirDecoratedProcedureRecord<
|
|
41
|
-
|
|
41
|
+
TRoot,
|
|
42
42
|
TProcedures[TKey]['_def']['record']
|
|
43
43
|
>
|
|
44
44
|
: TProcedures[TKey] extends AnyProcedure
|
|
45
|
-
? DecorateProcedureServer<
|
|
45
|
+
? DecorateProcedureServer<TRoot, TProcedures[TKey]>
|
|
46
46
|
: never;
|
|
47
47
|
};
|
package/src/createTRPCNext.tsx
CHANGED