@trpc/next 11.0.0-rc.800 → 11.0.0-rc.804
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createTRPCUntypedClient, TRPCClientError } from '@trpc/client';
|
|
2
2
|
import { getTransformer } from '@trpc/client/unstable-internals';
|
|
3
3
|
import { observable } from '@trpc/server/observable';
|
|
4
4
|
import { transformResult } from '@trpc/server/unstable-core-do-not-import';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/app-dir/server.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/app-dir/server.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,mBAAmB,EACnB,gBAAgB,EAEhB,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,8BAA8B,EAAE,MAAM,SAAS,CAAC;AAE9D,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAGjC,wBAAgB,uCAAuC,CACrD,OAAO,SAAS,SAAS,EACzB,IAAI,EAAE,8BAA8B,CAAC,OAAO,CAAC,mGA6B9C;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,qBAAqB,CACzB,SAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,EACrC,MAAM,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,CAC1D,GAAG;IACF;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,CACR,IAAI,EAAE,mBAAmB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,KAC7D,IAAI,CAAC;IAEV;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,IAYkC,KAAK,SAAS,YAAY,QACrD,KAAK,KACV,iBAAiB,CAClB,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,CAAC,CAC7D,CAuEF;AAGD,wBAAsB,+BAA+B,CAAC,GAAG,EAAE,OAAO,qBAiBjE"}
|
package/dist/app-dir/server.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var client = require('@trpc/client');
|
|
4
|
+
var nextAppDir = require('@trpc/server/adapters/next-app-dir');
|
|
4
5
|
var unstableCoreDoNotImport = require('@trpc/server/unstable-core-do-not-import');
|
|
5
6
|
var cache = require('next/cache');
|
|
6
|
-
var notFound = require('next/dist/client/components/not-found');
|
|
7
|
-
var redirect = require('next/dist/client/components/redirect');
|
|
8
7
|
var React = require('react');
|
|
9
8
|
var shared = require('./shared.js');
|
|
10
9
|
|
|
@@ -33,18 +32,9 @@ function experimental_createTRPCNextAppDirServer(opts) {
|
|
|
33
32
|
return client$1[procedureType](procedurePath, ...callOpts.args);
|
|
34
33
|
});
|
|
35
34
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Rethrow errors that should be handled by Next.js
|
|
38
|
-
*/ const throwNextErrors = (error)=>{
|
|
39
|
-
const { cause } = error;
|
|
40
|
-
if (redirect.isRedirectError(cause) || notFound.isNotFoundError(cause)) {
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
42
|
-
throw error.cause;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
35
|
function experimental_createServerActionHandler(t, opts) {
|
|
46
36
|
const config = t._config;
|
|
47
|
-
const { normalizeFormData = true, createContext, rethrowNextErrors = true } = opts;
|
|
37
|
+
const { normalizeFormData = true, createContext, rethrowNextErrors: shouldRethrowNextErrors = true } = opts;
|
|
48
38
|
const transformer = config.transformer;
|
|
49
39
|
// TODO allow this to take a `TRouter` in addition to a `AnyProcedure`
|
|
50
40
|
return function createServerAction(proc) {
|
|
@@ -89,8 +79,8 @@ function experimental_createServerActionHandler(t, opts) {
|
|
|
89
79
|
path: '',
|
|
90
80
|
type: proc._def.type
|
|
91
81
|
});
|
|
92
|
-
if (
|
|
93
|
-
|
|
82
|
+
if (shouldRethrowNextErrors) {
|
|
83
|
+
nextAppDir.rethrowNextErrors(error);
|
|
94
84
|
}
|
|
95
85
|
const shape = unstableCoreDoNotImport.getErrorShape({
|
|
96
86
|
config,
|
package/dist/app-dir/server.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { createTRPCUntypedClient, clientCallTypeToProcedureType } from '@trpc/client';
|
|
2
|
+
import { rethrowNextErrors } from '@trpc/server/adapters/next-app-dir';
|
|
2
3
|
import { createRecursiveProxy, formDataToObject, TRPCError, transformTRPCResponse, getTRPCErrorFromUnknown, getErrorShape } from '@trpc/server/unstable-core-do-not-import';
|
|
3
4
|
import { revalidateTag } from 'next/cache';
|
|
4
|
-
import { isNotFoundError } from 'next/dist/client/components/not-found';
|
|
5
|
-
import { isRedirectError } from 'next/dist/client/components/redirect';
|
|
6
5
|
import { cache } from 'react';
|
|
7
6
|
import { generateCacheTag, isFormData } from './shared.mjs';
|
|
8
7
|
|
|
@@ -31,18 +30,9 @@ function experimental_createTRPCNextAppDirServer(opts) {
|
|
|
31
30
|
return client[procedureType](procedurePath, ...callOpts.args);
|
|
32
31
|
});
|
|
33
32
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Rethrow errors that should be handled by Next.js
|
|
36
|
-
*/ const throwNextErrors = (error)=>{
|
|
37
|
-
const { cause } = error;
|
|
38
|
-
if (isRedirectError(cause) || isNotFoundError(cause)) {
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
40
|
-
throw error.cause;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
33
|
function experimental_createServerActionHandler(t, opts) {
|
|
44
34
|
const config = t._config;
|
|
45
|
-
const { normalizeFormData = true, createContext, rethrowNextErrors = true } = opts;
|
|
35
|
+
const { normalizeFormData = true, createContext, rethrowNextErrors: shouldRethrowNextErrors = true } = opts;
|
|
46
36
|
const transformer = config.transformer;
|
|
47
37
|
// TODO allow this to take a `TRouter` in addition to a `AnyProcedure`
|
|
48
38
|
return function createServerAction(proc) {
|
|
@@ -87,8 +77,8 @@ function experimental_createServerActionHandler(t, opts) {
|
|
|
87
77
|
path: '',
|
|
88
78
|
type: proc._def.type
|
|
89
79
|
});
|
|
90
|
-
if (
|
|
91
|
-
|
|
80
|
+
if (shouldRethrowNextErrors) {
|
|
81
|
+
rethrowNextErrors(error);
|
|
92
82
|
}
|
|
93
83
|
const shape = getErrorShape({
|
|
94
84
|
config,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 39.
|
|
2
|
+
"bundleSize": 22706,
|
|
3
|
+
"bundleOrigSize": 37801,
|
|
4
|
+
"bundleReduction": 39.93,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/ssrPrepass.ts",
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
],
|
|
13
13
|
"removedExports": [],
|
|
14
14
|
"dependents": [],
|
|
15
|
-
"percent": 22,
|
|
15
|
+
"percent": 22.27,
|
|
16
16
|
"reduction": 13.51
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"id": "/src/app-dir/server.ts",
|
|
20
|
-
"size":
|
|
21
|
-
"origSize":
|
|
20
|
+
"size": 4301,
|
|
21
|
+
"origSize": 5888,
|
|
22
22
|
"renderedExports": [
|
|
23
23
|
"experimental_createTRPCNextAppDirServer",
|
|
24
24
|
"experimental_createServerActionHandler",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
],
|
|
27
27
|
"removedExports": [],
|
|
28
28
|
"dependents": [],
|
|
29
|
-
"percent":
|
|
30
|
-
"reduction": 26.
|
|
29
|
+
"percent": 18.94,
|
|
30
|
+
"reduction": 26.95
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
"id": "/src/app-dir/create-action-hook.tsx",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependents": [
|
|
42
42
|
"/src/app-dir/client.ts"
|
|
43
43
|
],
|
|
44
|
-
"percent":
|
|
44
|
+
"percent": 15.13,
|
|
45
45
|
"reduction": 49.57
|
|
46
46
|
},
|
|
47
47
|
{
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"/src/index.ts",
|
|
57
57
|
"/src/createTRPCNext.tsx"
|
|
58
58
|
],
|
|
59
|
-
"percent":
|
|
59
|
+
"percent": 15.08,
|
|
60
60
|
"reduction": 44.23
|
|
61
61
|
},
|
|
62
62
|
{
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
],
|
|
69
69
|
"removedExports": [],
|
|
70
70
|
"dependents": [],
|
|
71
|
-
"percent": 11.
|
|
71
|
+
"percent": 11.42,
|
|
72
72
|
"reduction": 15.23
|
|
73
73
|
},
|
|
74
74
|
{
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
],
|
|
81
81
|
"removedExports": [],
|
|
82
82
|
"dependents": [],
|
|
83
|
-
"percent": 5.
|
|
83
|
+
"percent": 5.62,
|
|
84
84
|
"reduction": 32.18
|
|
85
85
|
},
|
|
86
86
|
{
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
],
|
|
93
93
|
"removedExports": [],
|
|
94
94
|
"dependents": [],
|
|
95
|
-
"percent": 5.
|
|
95
|
+
"percent": 5.24,
|
|
96
96
|
"reduction": 39.74
|
|
97
97
|
},
|
|
98
98
|
{
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"dependents": [
|
|
107
107
|
"/src/index.ts"
|
|
108
108
|
],
|
|
109
|
-
"percent": 4.
|
|
109
|
+
"percent": 4.84,
|
|
110
110
|
"reduction": 60.42
|
|
111
111
|
},
|
|
112
112
|
{
|
|
@@ -122,11 +122,11 @@
|
|
|
122
122
|
],
|
|
123
123
|
"dependents": [
|
|
124
124
|
"/src/app-dir/server.ts",
|
|
125
|
-
"/src/app-dir/links/nextCache.ts",
|
|
126
125
|
"/src/app-dir/links/nextHttp.ts",
|
|
126
|
+
"/src/app-dir/links/nextCache.ts",
|
|
127
127
|
"/src/app-dir/create-action-hook.tsx"
|
|
128
128
|
],
|
|
129
|
-
"percent": 1.
|
|
129
|
+
"percent": 1.48,
|
|
130
130
|
"reduction": 90.05
|
|
131
131
|
},
|
|
132
132
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/next",
|
|
3
|
-
"version": "11.0.0-rc.
|
|
3
|
+
"version": "11.0.0-rc.804+ab12d16b0",
|
|
4
4
|
"description": "The tRPC Next.js library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
],
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"@tanstack/react-query": "^5.59.15",
|
|
77
|
-
"@trpc/client": "11.0.0-rc.
|
|
78
|
-
"@trpc/react-query": "11.0.0-rc.
|
|
79
|
-
"@trpc/server": "11.0.0-rc.
|
|
77
|
+
"@trpc/client": "11.0.0-rc.804+ab12d16b0",
|
|
78
|
+
"@trpc/react-query": "11.0.0-rc.804+ab12d16b0",
|
|
79
|
+
"@trpc/server": "11.0.0-rc.804+ab12d16b0",
|
|
80
80
|
"next": "*",
|
|
81
81
|
"react": ">=16.8.0",
|
|
82
82
|
"react-dom": ">=16.8.0",
|
|
@@ -92,22 +92,22 @@
|
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@tanstack/react-query": "^5.66.0",
|
|
95
|
-
"@trpc/client": "11.0.0-rc.
|
|
96
|
-
"@trpc/react-query": "11.0.0-rc.
|
|
97
|
-
"@trpc/server": "11.0.0-rc.
|
|
95
|
+
"@trpc/client": "11.0.0-rc.804+ab12d16b0",
|
|
96
|
+
"@trpc/react-query": "11.0.0-rc.804+ab12d16b0",
|
|
97
|
+
"@trpc/server": "11.0.0-rc.804+ab12d16b0",
|
|
98
98
|
"@types/express": "^5.0.0",
|
|
99
|
-
"@types/node": "^22.
|
|
99
|
+
"@types/node": "^22.13.5",
|
|
100
100
|
"@types/react": "^19.0.0",
|
|
101
101
|
"@types/react-dom": "^19.0.0",
|
|
102
|
-
"eslint": "^9.
|
|
102
|
+
"eslint": "^9.21.0",
|
|
103
103
|
"express": "^5.0.0",
|
|
104
104
|
"next": "^15.1.3",
|
|
105
105
|
"react": "^19.0.0",
|
|
106
106
|
"react-dom": "^19.0.0",
|
|
107
|
-
"rollup": "^4.
|
|
108
|
-
"tsx": "^4.
|
|
107
|
+
"rollup": "^4.34.8",
|
|
108
|
+
"tsx": "^4.19.3",
|
|
109
109
|
"typescript": "^5.7.2",
|
|
110
|
-
"zod": "^3.
|
|
110
|
+
"zod": "^3.24.2"
|
|
111
111
|
},
|
|
112
112
|
"publishConfig": {
|
|
113
113
|
"access": "public"
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"funding": [
|
|
116
116
|
"https://trpc.io/sponsor"
|
|
117
117
|
],
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "ab12d16b010a304c980482545c910d0477125e8b"
|
|
119
119
|
}
|
package/src/app-dir/server.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
createTRPCUntypedClient,
|
|
5
5
|
} from '@trpc/client';
|
|
6
6
|
import type { CreateContextCallback } from '@trpc/server';
|
|
7
|
+
import { rethrowNextErrors } from '@trpc/server/adapters/next-app-dir';
|
|
7
8
|
import type {
|
|
8
9
|
AnyProcedure,
|
|
9
10
|
AnyRootTypes,
|
|
@@ -25,8 +26,6 @@ import {
|
|
|
25
26
|
TRPCError,
|
|
26
27
|
} from '@trpc/server/unstable-core-do-not-import';
|
|
27
28
|
import { revalidateTag } from 'next/cache';
|
|
28
|
-
import { isNotFoundError } from 'next/dist/client/components/not-found';
|
|
29
|
-
import { isRedirectError } from 'next/dist/client/components/redirect';
|
|
30
29
|
import { cache } from 'react';
|
|
31
30
|
import type {
|
|
32
31
|
ActionHandlerDef,
|
|
@@ -72,16 +71,6 @@ export function experimental_createTRPCNextAppDirServer<
|
|
|
72
71
|
});
|
|
73
72
|
}
|
|
74
73
|
|
|
75
|
-
/**
|
|
76
|
-
* Rethrow errors that should be handled by Next.js
|
|
77
|
-
*/
|
|
78
|
-
const throwNextErrors = (error: TRPCError) => {
|
|
79
|
-
const { cause } = error;
|
|
80
|
-
if (isRedirectError(cause) || isNotFoundError(cause)) {
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
82
|
-
throw error.cause!;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
74
|
/**
|
|
86
75
|
* @internal
|
|
87
76
|
*/
|
|
@@ -122,7 +111,7 @@ export function experimental_createServerActionHandler<
|
|
|
122
111
|
const {
|
|
123
112
|
normalizeFormData = true,
|
|
124
113
|
createContext,
|
|
125
|
-
rethrowNextErrors = true,
|
|
114
|
+
rethrowNextErrors: shouldRethrowNextErrors = true,
|
|
126
115
|
} = opts;
|
|
127
116
|
|
|
128
117
|
const transformer = config.transformer;
|
|
@@ -182,8 +171,8 @@ export function experimental_createServerActionHandler<
|
|
|
182
171
|
type: proc._def.type,
|
|
183
172
|
});
|
|
184
173
|
|
|
185
|
-
if (
|
|
186
|
-
|
|
174
|
+
if (shouldRethrowNextErrors) {
|
|
175
|
+
rethrowNextErrors(error);
|
|
187
176
|
}
|
|
188
177
|
|
|
189
178
|
const shape = getErrorShape({
|