@trpc/server 11.0.0-alpha-tmp-01-26-simplify-router.278 → 11.0.0-alpha-tmp-01-26-simplify-router.281
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 +12 -12
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.js +2 -2
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.mjs +2 -2
- package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts +1 -1
- package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/transformer.d.ts +1 -1
- package/package.json +2 -2
- package/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts +6 -3
- package/src/unstable-core-do-not-import/rpc/envelopes.ts +1 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 34.
|
|
2
|
+
"bundleSize": 102527,
|
|
3
|
+
"bundleOrigSize": 157083,
|
|
4
|
+
"bundleReduction": 34.73,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/adapters/ws.ts",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts",
|
|
62
62
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
63
63
|
],
|
|
64
|
-
"percent": 5.
|
|
64
|
+
"percent": 5.5,
|
|
65
65
|
"reduction": 42.4
|
|
66
66
|
},
|
|
67
67
|
{
|
|
@@ -400,8 +400,8 @@
|
|
|
400
400
|
},
|
|
401
401
|
{
|
|
402
402
|
"id": "/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts",
|
|
403
|
-
"size":
|
|
404
|
-
"origSize":
|
|
403
|
+
"size": 1233,
|
|
404
|
+
"origSize": 1608,
|
|
405
405
|
"renderedExports": [
|
|
406
406
|
"getHTTPStatusCode",
|
|
407
407
|
"getHTTPStatusCodeFromError"
|
|
@@ -411,8 +411,8 @@
|
|
|
411
411
|
"/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts",
|
|
412
412
|
"/src/unstable-core-do-not-import/error/getErrorShape.ts"
|
|
413
413
|
],
|
|
414
|
-
"percent": 1.
|
|
415
|
-
"reduction":
|
|
414
|
+
"percent": 1.2,
|
|
415
|
+
"reduction": 23.32
|
|
416
416
|
},
|
|
417
417
|
{
|
|
418
418
|
"id": "/src/adapters/node-http/content-type/json/getPostBody.ts",
|
|
@@ -678,9 +678,9 @@
|
|
|
678
678
|
"reduction": 100
|
|
679
679
|
},
|
|
680
680
|
{
|
|
681
|
-
"id": "/src/
|
|
681
|
+
"id": "/src/rpc.ts",
|
|
682
682
|
"size": 0,
|
|
683
|
-
"origSize":
|
|
683
|
+
"origSize": 36,
|
|
684
684
|
"renderedExports": [],
|
|
685
685
|
"removedExports": [],
|
|
686
686
|
"dependents": [],
|
|
@@ -688,9 +688,9 @@
|
|
|
688
688
|
"reduction": 100
|
|
689
689
|
},
|
|
690
690
|
{
|
|
691
|
-
"id": "/src/
|
|
691
|
+
"id": "/src/shared.ts",
|
|
692
692
|
"size": 0,
|
|
693
|
-
"origSize":
|
|
693
|
+
"origSize": 653,
|
|
694
694
|
"renderedExports": [],
|
|
695
695
|
"removedExports": [],
|
|
696
696
|
"dependents": [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getHTTPStatusCode.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/getHTTPStatusCode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getHTTPStatusCode.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/getHTTPStatusCode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAA2B,YAAY,EAAE,MAAM,QAAQ,CAAC;AA4BpE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,EAAE,OAyBpE;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,SAAS,UAE1D"}
|
|
@@ -29,8 +29,8 @@ function getHTTPStatusCode(json) {
|
|
|
29
29
|
const httpStatuses = new Set(arr.map((res)=>{
|
|
30
30
|
if ('error' in res) {
|
|
31
31
|
const data = res.error.data;
|
|
32
|
-
if (typeof data
|
|
33
|
-
return data
|
|
32
|
+
if (typeof data.httpStatus === 'number') {
|
|
33
|
+
return data.httpStatus;
|
|
34
34
|
}
|
|
35
35
|
const code = codes.TRPC_ERROR_CODES_BY_NUMBER[res.error.code];
|
|
36
36
|
return getStatusCodeFromKey(code);
|
|
@@ -27,8 +27,8 @@ function getHTTPStatusCode(json) {
|
|
|
27
27
|
const httpStatuses = new Set(arr.map((res)=>{
|
|
28
28
|
if ('error' in res) {
|
|
29
29
|
const data = res.error.data;
|
|
30
|
-
if (typeof data
|
|
31
|
-
return data
|
|
30
|
+
if (typeof data.httpStatus === 'number') {
|
|
31
|
+
return data.httpStatus;
|
|
32
32
|
}
|
|
33
33
|
const code = TRPC_ERROR_CODES_BY_NUMBER[res.error.code];
|
|
34
34
|
return getStatusCodeFromKey(code);
|
|
@@ -3,7 +3,7 @@ import type { TRPC_ERROR_CODE_NUMBER } from './codes';
|
|
|
3
3
|
/**
|
|
4
4
|
* Error response
|
|
5
5
|
*/
|
|
6
|
-
export interface TRPCErrorShape<TData extends
|
|
6
|
+
export interface TRPCErrorShape<TData extends object = object> {
|
|
7
7
|
code: TRPC_ERROR_CODE_NUMBER;
|
|
8
8
|
message: string;
|
|
9
9
|
data: TData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelopes.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/rpc/envelopes.ts"],"names":[],"mappings":"AACA,O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,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,GACjC,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CACzC;CAAG;AAEN,MAAM,MAAM,mBAAmB,CAC7B,KAAK,GAAG,OAAO,EACf,MAAM,SAAS,cAAc,GAAG,cAAc,IAC5C;IAAE,EAAE,EAAE,QAAQ,CAAC,SAAS,CAAA;CAAE,GAAG,CAC7B,iBAAiB,CAAC,MAAM,CAAC,GACzB,iBAAiB,CAAC,KAAK,CAAC,CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,yBACf,SAAQ,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC;IACzC,EAAE,EAAE,QAAQ,CAAC,SAAS,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,yBAAyB,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,yBAAyB,CACnC,OAAO,GAAG,OAAO,EACjB,MAAM,SAAS,cAAc,GAAG,cAAc,IAC5C,yBAAyB,GAAG,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -63,7 +63,7 @@ export declare const defaultTransformer: CombinedDataTransformer;
|
|
|
63
63
|
/**
|
|
64
64
|
* Takes a unserialized `TRPCResponse` and serializes it with the router's transformers
|
|
65
65
|
**/
|
|
66
|
-
export declare function transformTRPCResponse<TResponse extends TRPCResponse | TRPCResponse[] | TRPCResponseMessage | TRPCResponseMessage[]>(config: RootConfig<AnyRootTypes>, itemOrItems: TResponse): import("./rpc").TRPCErrorResponse<import("./rpc").TRPCErrorShape<
|
|
66
|
+
export declare function transformTRPCResponse<TResponse extends TRPCResponse | TRPCResponse[] | TRPCResponseMessage | TRPCResponseMessage[]>(config: RootConfig<AnyRootTypes>, itemOrItems: TResponse): import("./rpc").TRPCErrorResponse<import("./rpc").TRPCErrorShape<object>> | import("./rpc").TRPCSuccessResponse<unknown> | ({
|
|
67
67
|
id: import("./rpc").JSONRPC2.RequestId;
|
|
68
68
|
} & TRPCResultMessage<unknown>) | (TRPCResponse | TRPCResponseMessage)[];
|
|
69
69
|
/** @internal */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/server",
|
|
3
|
-
"version": "11.0.0-alpha-tmp-01-26-simplify-router.
|
|
3
|
+
"version": "11.0.0-alpha-tmp-01-26-simplify-router.281+e42474956",
|
|
4
4
|
"description": "The tRPC server library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -157,5 +157,5 @@
|
|
|
157
157
|
"funding": [
|
|
158
158
|
"https://trpc.io/sponsor"
|
|
159
159
|
],
|
|
160
|
-
"gitHead": "
|
|
160
|
+
"gitHead": "e4247495633a8d2fa83baeec8bc079f6adac4099"
|
|
161
161
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DefaultErrorData } from '../error/formatter';
|
|
1
2
|
import type { TRPCError } from '../error/TRPCError';
|
|
2
3
|
import type { TRPC_ERROR_CODES_BY_KEY, TRPCResponse } from '../rpc';
|
|
3
4
|
import { TRPC_ERROR_CODES_BY_NUMBER } from '../rpc';
|
|
@@ -32,9 +33,11 @@ export function getHTTPStatusCode(json: TRPCResponse | TRPCResponse[]) {
|
|
|
32
33
|
const httpStatuses = new Set(
|
|
33
34
|
arr.map((res) => {
|
|
34
35
|
if ('error' in res) {
|
|
35
|
-
const data = res.error.data
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const data = res.error.data as
|
|
37
|
+
| Record<string, unknown>
|
|
38
|
+
| DefaultErrorData;
|
|
39
|
+
if (typeof data.httpStatus === 'number') {
|
|
40
|
+
return data.httpStatus;
|
|
38
41
|
}
|
|
39
42
|
const code = TRPC_ERROR_CODES_BY_NUMBER[res.error.code];
|
|
40
43
|
return getStatusCodeFromKey(code);
|
|
@@ -5,9 +5,7 @@ import type { TRPC_ERROR_CODE_NUMBER } from './codes';
|
|
|
5
5
|
/**
|
|
6
6
|
* Error response
|
|
7
7
|
*/
|
|
8
|
-
export interface TRPCErrorShape<
|
|
9
|
-
TData extends Record<string, unknown> = Record<string, unknown>,
|
|
10
|
-
> {
|
|
8
|
+
export interface TRPCErrorShape<TData extends object = object> {
|
|
11
9
|
code: TRPC_ERROR_CODE_NUMBER;
|
|
12
10
|
message: string;
|
|
13
11
|
data: TData;
|