@trpc/next 11.0.0-rc.445 → 11.0.0-rc.449
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.js +1 -2
- package/dist/app-dir/server.mjs +1 -2
- package/dist/bundle-analysis.json +16 -30
- package/package.json +8 -8
- package/src/app-dir/server.ts +1 -1
- package/dist/app-dir/formDataToObject.d.ts +0 -2
- package/dist/app-dir/formDataToObject.d.ts.map +0 -1
- package/dist/app-dir/formDataToObject.js +0 -34
- package/dist/app-dir/formDataToObject.mjs +0 -32
- package/src/app-dir/formDataToObject.ts +0 -36
package/dist/app-dir/server.js
CHANGED
|
@@ -6,7 +6,6 @@ var cache = require('next/cache');
|
|
|
6
6
|
var notFound = require('next/dist/client/components/not-found');
|
|
7
7
|
var redirect = require('next/dist/client/components/redirect');
|
|
8
8
|
var React = require('react');
|
|
9
|
-
var formDataToObject = require('./formDataToObject.js');
|
|
10
9
|
var shared = require('./shared.js');
|
|
11
10
|
|
|
12
11
|
/// <reference types="next" />
|
|
@@ -55,7 +54,7 @@ function experimental_createServerActionHandler(t, opts) {
|
|
|
55
54
|
if (normalizeFormData && shared.isFormData(rawInput)) {
|
|
56
55
|
// Normalizes FormData so we can use `z.object({})` etc on the server
|
|
57
56
|
try {
|
|
58
|
-
rawInput =
|
|
57
|
+
rawInput = unstableCoreDoNotImport.formDataToObject(rawInput);
|
|
59
58
|
} catch {
|
|
60
59
|
throw new unstableCoreDoNotImport.TRPCError({
|
|
61
60
|
code: 'INTERNAL_SERVER_ERROR',
|
package/dist/app-dir/server.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { createTRPCUntypedClient, clientCallTypeToProcedureType } from '@trpc/client';
|
|
2
|
-
import { createRecursiveProxy, TRPCError, transformTRPCResponse, getTRPCErrorFromUnknown, getErrorShape } from '@trpc/server/unstable-core-do-not-import';
|
|
2
|
+
import { createRecursiveProxy, formDataToObject, TRPCError, transformTRPCResponse, getTRPCErrorFromUnknown, getErrorShape } from '@trpc/server/unstable-core-do-not-import';
|
|
3
3
|
import { revalidateTag } from 'next/cache';
|
|
4
4
|
import { isNotFoundError } from 'next/dist/client/components/not-found';
|
|
5
5
|
import { isRedirectError } from 'next/dist/client/components/redirect';
|
|
6
6
|
import { cache } from 'react';
|
|
7
|
-
import { formDataToObject } from './formDataToObject.mjs';
|
|
8
7
|
import { generateCacheTag, isFormData } from './shared.mjs';
|
|
9
8
|
|
|
10
9
|
/// <reference types="next" />
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction":
|
|
2
|
+
"bundleSize": 22761,
|
|
3
|
+
"bundleOrigSize": 37647,
|
|
4
|
+
"bundleReduction": 39.54,
|
|
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":
|
|
15
|
+
"percent": 22.24,
|
|
16
16
|
"reduction": 13.51
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"id": "/src/app-dir/server.ts",
|
|
20
|
-
"size":
|
|
21
|
-
"origSize":
|
|
20
|
+
"size": 4340,
|
|
21
|
+
"origSize": 5986,
|
|
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":
|
|
29
|
+
"percent": 19.07,
|
|
30
|
+
"reduction": 27.5
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
"id": "/src/withTRPC.tsx",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"/src/index.ts",
|
|
42
42
|
"/src/createTRPCNext.tsx"
|
|
43
43
|
],
|
|
44
|
-
"percent":
|
|
44
|
+
"percent": 15.15,
|
|
45
45
|
"reduction": 43.83
|
|
46
46
|
},
|
|
47
47
|
{
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"dependents": [
|
|
57
57
|
"/src/app-dir/client.ts"
|
|
58
58
|
],
|
|
59
|
-
"percent":
|
|
59
|
+
"percent": 15.1,
|
|
60
60
|
"reduction": 49.31
|
|
61
61
|
},
|
|
62
62
|
{
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
],
|
|
69
69
|
"removedExports": [],
|
|
70
70
|
"dependents": [],
|
|
71
|
-
"percent":
|
|
71
|
+
"percent": 11.3,
|
|
72
72
|
"reduction": 15.54
|
|
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.4
|
|
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.58
|
|
97
97
|
},
|
|
98
98
|
{
|
|
@@ -106,23 +106,9 @@
|
|
|
106
106
|
"dependents": [
|
|
107
107
|
"/src/index.ts"
|
|
108
108
|
],
|
|
109
|
-
"percent": 4.
|
|
109
|
+
"percent": 4.82,
|
|
110
110
|
"reduction": 60.45
|
|
111
111
|
},
|
|
112
|
-
{
|
|
113
|
-
"id": "/src/app-dir/formDataToObject.ts",
|
|
114
|
-
"size": 818,
|
|
115
|
-
"origSize": 826,
|
|
116
|
-
"renderedExports": [
|
|
117
|
-
"formDataToObject"
|
|
118
|
-
],
|
|
119
|
-
"removedExports": [],
|
|
120
|
-
"dependents": [
|
|
121
|
-
"/src/app-dir/server.ts"
|
|
122
|
-
],
|
|
123
|
-
"percent": 3.47,
|
|
124
|
-
"reduction": 0.97
|
|
125
|
-
},
|
|
126
112
|
{
|
|
127
113
|
"id": "/src/app-dir/shared.ts",
|
|
128
114
|
"size": 335,
|
|
@@ -140,7 +126,7 @@
|
|
|
140
126
|
"/src/app-dir/links/nextHttp.ts",
|
|
141
127
|
"/src/app-dir/create-action-hook.tsx"
|
|
142
128
|
],
|
|
143
|
-
"percent": 1.
|
|
129
|
+
"percent": 1.47,
|
|
144
130
|
"reduction": 89.34
|
|
145
131
|
},
|
|
146
132
|
{
|
|
@@ -154,5 +140,5 @@
|
|
|
154
140
|
"reduction": 100
|
|
155
141
|
}
|
|
156
142
|
],
|
|
157
|
-
"moduleCount":
|
|
143
|
+
"moduleCount": 10
|
|
158
144
|
}
|
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.449+42acce6ac",
|
|
4
4
|
"description": "The tRPC Next.js library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
],
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@tanstack/react-query": "^5.49.2",
|
|
76
|
-
"@trpc/client": "11.0.0-rc.
|
|
77
|
-
"@trpc/react-query": "11.0.0-rc.
|
|
78
|
-
"@trpc/server": "11.0.0-rc.
|
|
76
|
+
"@trpc/client": "11.0.0-rc.449+42acce6ac",
|
|
77
|
+
"@trpc/react-query": "11.0.0-rc.449+42acce6ac",
|
|
78
|
+
"@trpc/server": "11.0.0-rc.449+42acce6ac",
|
|
79
79
|
"next": "*",
|
|
80
80
|
"react": ">=16.8.0",
|
|
81
81
|
"react-dom": ">=16.8.0"
|
|
@@ -90,9 +90,9 @@
|
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@tanstack/react-query": "^5.49.2",
|
|
93
|
-
"@trpc/client": "11.0.0-rc.
|
|
94
|
-
"@trpc/react-query": "11.0.0-rc.
|
|
95
|
-
"@trpc/server": "11.0.0-rc.
|
|
93
|
+
"@trpc/client": "11.0.0-rc.449+42acce6ac",
|
|
94
|
+
"@trpc/react-query": "11.0.0-rc.449+42acce6ac",
|
|
95
|
+
"@trpc/server": "11.0.0-rc.449+42acce6ac",
|
|
96
96
|
"@types/express": "^4.17.17",
|
|
97
97
|
"@types/node": "^20.10.0",
|
|
98
98
|
"@types/react": "^18.3.1",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"funding": [
|
|
113
113
|
"https://trpc.io/sponsor"
|
|
114
114
|
],
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "42acce6ac165dd489ebc11721e1c4dd15f4d8b7a"
|
|
116
116
|
}
|
package/src/app-dir/server.ts
CHANGED
|
@@ -18,6 +18,7 @@ import type {
|
|
|
18
18
|
} from '@trpc/server/unstable-core-do-not-import';
|
|
19
19
|
import {
|
|
20
20
|
createRecursiveProxy,
|
|
21
|
+
formDataToObject,
|
|
21
22
|
getErrorShape,
|
|
22
23
|
getTRPCErrorFromUnknown,
|
|
23
24
|
transformTRPCResponse,
|
|
@@ -27,7 +28,6 @@ import { revalidateTag } from 'next/cache';
|
|
|
27
28
|
import { isNotFoundError } from 'next/dist/client/components/not-found';
|
|
28
29
|
import { isRedirectError } from 'next/dist/client/components/redirect';
|
|
29
30
|
import { cache } from 'react';
|
|
30
|
-
import { formDataToObject } from './formDataToObject';
|
|
31
31
|
import type {
|
|
32
32
|
ActionHandlerDef,
|
|
33
33
|
CreateTRPCNextAppRouterOptions,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formDataToObject.d.ts","sourceRoot":"","sources":["../../src/app-dir/formDataToObject.ts"],"names":[],"mappings":"AA2BA,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,2BAQlD"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */ function set(obj, path, value) {
|
|
4
|
-
if (typeof path === 'string') {
|
|
5
|
-
path = path.split(/[\.\[\]]/).filter(Boolean);
|
|
6
|
-
}
|
|
7
|
-
if (path.length > 1) {
|
|
8
|
-
const p = path.shift();
|
|
9
|
-
const isArrayIndex = /^\d+$/.test(path[0]);
|
|
10
|
-
obj[p] = obj[p] || (isArrayIndex ? [] : {});
|
|
11
|
-
set(obj[p], path, value);
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const p1 = path[0];
|
|
15
|
-
if (obj[p1] === undefined) {
|
|
16
|
-
obj[p1] = value;
|
|
17
|
-
} else if (Array.isArray(obj[p1])) {
|
|
18
|
-
obj[p1].push(value);
|
|
19
|
-
} else {
|
|
20
|
-
obj[p1] = [
|
|
21
|
-
obj[p1],
|
|
22
|
-
value
|
|
23
|
-
];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function formDataToObject(formData) {
|
|
27
|
-
const obj = {};
|
|
28
|
-
for (const [key, value] of formData.entries()){
|
|
29
|
-
set(obj, key, value);
|
|
30
|
-
}
|
|
31
|
-
return obj;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
exports.formDataToObject = formDataToObject;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */ function set(obj, path, value) {
|
|
2
|
-
if (typeof path === 'string') {
|
|
3
|
-
path = path.split(/[\.\[\]]/).filter(Boolean);
|
|
4
|
-
}
|
|
5
|
-
if (path.length > 1) {
|
|
6
|
-
const p = path.shift();
|
|
7
|
-
const isArrayIndex = /^\d+$/.test(path[0]);
|
|
8
|
-
obj[p] = obj[p] || (isArrayIndex ? [] : {});
|
|
9
|
-
set(obj[p], path, value);
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
const p1 = path[0];
|
|
13
|
-
if (obj[p1] === undefined) {
|
|
14
|
-
obj[p1] = value;
|
|
15
|
-
} else if (Array.isArray(obj[p1])) {
|
|
16
|
-
obj[p1].push(value);
|
|
17
|
-
} else {
|
|
18
|
-
obj[p1] = [
|
|
19
|
-
obj[p1],
|
|
20
|
-
value
|
|
21
|
-
];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function formDataToObject(formData) {
|
|
25
|
-
const obj = {};
|
|
26
|
-
for (const [key, value] of formData.entries()){
|
|
27
|
-
set(obj, key, value);
|
|
28
|
-
}
|
|
29
|
-
return obj;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { formDataToObject };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
-
function set(
|
|
3
|
-
obj: Record<string, any>,
|
|
4
|
-
path: string[] | string,
|
|
5
|
-
value: unknown,
|
|
6
|
-
): void {
|
|
7
|
-
if (typeof path === 'string') {
|
|
8
|
-
path = path.split(/[\.\[\]]/).filter(Boolean);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (path.length > 1) {
|
|
12
|
-
const p = path.shift()!;
|
|
13
|
-
const isArrayIndex = /^\d+$/.test(path[0]!);
|
|
14
|
-
obj[p] = obj[p] || (isArrayIndex ? [] : {});
|
|
15
|
-
set(obj[p], path, value);
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const p = path[0]!;
|
|
19
|
-
if (obj[p] === undefined) {
|
|
20
|
-
obj[p] = value;
|
|
21
|
-
} else if (Array.isArray(obj[p])) {
|
|
22
|
-
obj[p].push(value);
|
|
23
|
-
} else {
|
|
24
|
-
obj[p] = [obj[p], value];
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function formDataToObject(formData: FormData) {
|
|
29
|
-
const obj: Record<string, unknown> = {};
|
|
30
|
-
|
|
31
|
-
for (const [key, value] of formData.entries()) {
|
|
32
|
-
set(obj, key, value);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return obj;
|
|
36
|
-
}
|