@trpc/server 11.0.0-next-beta.300 → 11.0.0-next-beta.303
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/adapters/aws-lambda/index.js +0 -1
- package/dist/adapters/aws-lambda/index.mjs +0 -1
- package/dist/adapters/aws-lambda/utils.js +0 -1
- package/dist/adapters/aws-lambda/utils.mjs +0 -1
- package/dist/adapters/fastify/fastifyRequestHandler.js +0 -1
- package/dist/adapters/fastify/fastifyRequestHandler.mjs +0 -1
- package/dist/adapters/fetch/fetchRequestHandler.js +0 -1
- package/dist/adapters/fetch/fetchRequestHandler.mjs +0 -1
- package/dist/adapters/next.js +0 -1
- package/dist/adapters/next.mjs +0 -1
- package/dist/adapters/node-http/content-type/json/getPostBody.d.ts.map +1 -1
- package/dist/adapters/node-http/content-type/json/getPostBody.js +10 -1
- package/dist/adapters/node-http/content-type/json/getPostBody.mjs +10 -1
- package/dist/adapters/node-http/content-type/json/index.js +0 -1
- package/dist/adapters/node-http/content-type/json/index.mjs +0 -1
- package/dist/adapters/node-http/nodeHTTPRequestHandler.js +0 -1
- package/dist/adapters/node-http/nodeHTTPRequestHandler.mjs +0 -1
- package/dist/adapters/standalone.js +0 -1
- package/dist/adapters/standalone.mjs +0 -1
- package/dist/adapters/ws.js +0 -1
- package/dist/adapters/ws.mjs +0 -1
- package/dist/bundle-analysis.json +83 -85
- package/dist/http.js +0 -1
- package/dist/http.mjs +0 -1
- package/dist/index.js +0 -1
- package/dist/index.mjs +0 -1
- package/dist/shared.js +0 -1
- package/dist/shared.mjs +0 -1
- package/dist/unstable-core-do-not-import/error/TRPCError.d.ts +1 -1
- package/dist/unstable-core-do-not-import/error/TRPCError.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.js +1 -0
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.mjs +1 -0
- package/dist/unstable-core-do-not-import/rpc/codes.d.ts +8 -15
- package/dist/unstable-core-do-not-import/rpc/codes.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/rpc/codes.js +19 -3
- package/dist/unstable-core-do-not-import/rpc/codes.mjs +19 -3
- package/dist/unstable-core-do-not-import/utils.d.ts +0 -11
- package/dist/unstable-core-do-not-import/utils.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/utils.js +0 -11
- package/dist/unstable-core-do-not-import/utils.mjs +1 -11
- package/dist/unstable-core-do-not-import.js +0 -1
- package/dist/unstable-core-do-not-import.mjs +1 -1
- package/package.json +2 -2
- package/src/adapters/node-http/content-type/json/getPostBody.ts +16 -0
- package/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts +1 -0
- package/src/unstable-core-do-not-import/rpc/codes.ts +29 -2
- package/src/unstable-core-do-not-import/utils.ts +0 -21
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../../unstable-core-do-not-import/rpc/codes.js');
|
|
4
3
|
var TRPCError = require('../../unstable-core-do-not-import/error/TRPCError.js');
|
|
5
4
|
var resolveHTTPResponse = require('../../unstable-core-do-not-import/http/resolveHTTPResponse.js');
|
|
6
5
|
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '../../unstable-core-do-not-import/rpc/codes.mjs';
|
|
2
1
|
import { TRPCError } from '../../unstable-core-do-not-import/error/TRPCError.mjs';
|
|
3
2
|
import { resolveHTTPResponse } from '../../unstable-core-do-not-import/http/resolveHTTPResponse.mjs';
|
|
4
3
|
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var node_stream = require('node:stream');
|
|
4
|
-
require('../../unstable-core-do-not-import/rpc/codes.js');
|
|
5
4
|
var resolveHTTPResponse = require('../../unstable-core-do-not-import/http/resolveHTTPResponse.js');
|
|
6
5
|
var batchStreamFormatter = require('../../unstable-core-do-not-import/http/batchStreamFormatter.js');
|
|
7
6
|
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Readable } from 'node:stream';
|
|
2
|
-
import '../../unstable-core-do-not-import/rpc/codes.mjs';
|
|
3
2
|
import { resolveHTTPResponse } from '../../unstable-core-do-not-import/http/resolveHTTPResponse.mjs';
|
|
4
3
|
import { getBatchStreamFormatter } from '../../unstable-core-do-not-import/http/batchStreamFormatter.mjs';
|
|
5
4
|
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../../unstable-core-do-not-import/rpc/codes.js');
|
|
4
3
|
var resolveHTTPResponse = require('../../unstable-core-do-not-import/http/resolveHTTPResponse.js');
|
|
5
4
|
var batchStreamFormatter = require('../../unstable-core-do-not-import/http/batchStreamFormatter.js');
|
|
6
5
|
var toURL = require('../../unstable-core-do-not-import/http/toURL.js');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '../../unstable-core-do-not-import/rpc/codes.mjs';
|
|
2
1
|
import { resolveHTTPResponse } from '../../unstable-core-do-not-import/http/resolveHTTPResponse.mjs';
|
|
3
2
|
import { getBatchStreamFormatter } from '../../unstable-core-do-not-import/http/batchStreamFormatter.mjs';
|
|
4
3
|
import { toURL } from '../../unstable-core-do-not-import/http/toURL.mjs';
|
package/dist/adapters/next.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var getErrorShape = require('../unstable-core-do-not-import/error/getErrorShape.js');
|
|
4
4
|
var TRPCError = require('../unstable-core-do-not-import/error/TRPCError.js');
|
|
5
|
-
require('../unstable-core-do-not-import/rpc/codes.js');
|
|
6
5
|
require('../unstable-core-do-not-import/rootConfig.js');
|
|
7
6
|
var nodeHTTPRequestHandler = require('./node-http/nodeHTTPRequestHandler.js');
|
|
8
7
|
|
package/dist/adapters/next.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getErrorShape } from '../unstable-core-do-not-import/error/getErrorShape.mjs';
|
|
2
2
|
import { TRPCError } from '../unstable-core-do-not-import/error/TRPCError.mjs';
|
|
3
|
-
import '../unstable-core-do-not-import/rpc/codes.mjs';
|
|
4
3
|
import '../unstable-core-do-not-import/rootConfig.mjs';
|
|
5
4
|
import { nodeHTTPRequestHandler } from './node-http/nodeHTTPRequestHandler.mjs';
|
|
6
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPostBody.d.ts","sourceRoot":"","sources":["../../../../../src/adapters/node-http/content-type/json/getPostBody.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,EAAE,eAAe,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"getPostBody.d.ts","sourceRoot":"","sources":["../../../../../src/adapters/node-http/content-type/json/getPostBody.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,EAAE,eAAe,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,UAAU,CAAC,CAiDtB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../../../../unstable-core-do-not-import/rpc/codes.js');
|
|
4
3
|
var TRPCError = require('../../../../unstable-core-do-not-import/error/TRPCError.js');
|
|
5
4
|
require('../../../../unstable-core-do-not-import/rootConfig.js');
|
|
6
5
|
|
|
@@ -8,6 +7,16 @@ require('../../../../unstable-core-do-not-import/rootConfig.js');
|
|
|
8
7
|
async function getPostBody(opts) {
|
|
9
8
|
const { req , maxBodySize =Infinity } = opts;
|
|
10
9
|
return new Promise((resolve)=>{
|
|
10
|
+
if (!req.headers['content-type']?.startsWith('application/json') && (!req.method || req.method !== 'GET' && req.method !== 'OPTIONS' && req.method !== 'HEAD')) {
|
|
11
|
+
resolve({
|
|
12
|
+
ok: false,
|
|
13
|
+
error: new TRPCError.TRPCError({
|
|
14
|
+
code: 'UNSUPPORTED_MEDIA_TYPE',
|
|
15
|
+
message: 'Invalid Content-Type header (expected application/json)'
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
11
20
|
if ('body' in req) {
|
|
12
21
|
resolve({
|
|
13
22
|
ok: true,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '../../../../unstable-core-do-not-import/rpc/codes.mjs';
|
|
2
1
|
import { TRPCError } from '../../../../unstable-core-do-not-import/error/TRPCError.mjs';
|
|
3
2
|
import '../../../../unstable-core-do-not-import/rootConfig.mjs';
|
|
4
3
|
|
|
@@ -6,6 +5,16 @@ import '../../../../unstable-core-do-not-import/rootConfig.mjs';
|
|
|
6
5
|
async function getPostBody(opts) {
|
|
7
6
|
const { req , maxBodySize =Infinity } = opts;
|
|
8
7
|
return new Promise((resolve)=>{
|
|
8
|
+
if (!req.headers['content-type']?.startsWith('application/json') && (!req.method || req.method !== 'GET' && req.method !== 'OPTIONS' && req.method !== 'HEAD')) {
|
|
9
|
+
resolve({
|
|
10
|
+
ok: false,
|
|
11
|
+
error: new TRPCError({
|
|
12
|
+
code: 'UNSUPPORTED_MEDIA_TYPE',
|
|
13
|
+
message: 'Invalid Content-Type header (expected application/json)'
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
9
18
|
if ('body' in req) {
|
|
10
19
|
resolve({
|
|
11
20
|
ok: true,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../../../../unstable-core-do-not-import/rpc/codes.js');
|
|
4
3
|
var contentType$1 = require('../../../../unstable-core-do-not-import/http/contentType.js');
|
|
5
4
|
require('../../../../unstable-core-do-not-import/rootConfig.js');
|
|
6
5
|
var contentType = require('../../internals/contentType.js');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '../../../../unstable-core-do-not-import/rpc/codes.mjs';
|
|
2
1
|
import { getJsonContentTypeInputs } from '../../../../unstable-core-do-not-import/http/contentType.mjs';
|
|
3
2
|
import '../../../../unstable-core-do-not-import/rootConfig.mjs';
|
|
4
3
|
import { createNodeHTTPContentTypeHandler } from '../../internals/contentType.mjs';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../../unstable-core-do-not-import/rpc/codes.js');
|
|
4
3
|
var resolveHTTPResponse = require('../../unstable-core-do-not-import/http/resolveHTTPResponse.js');
|
|
5
4
|
var batchStreamFormatter = require('../../unstable-core-do-not-import/http/batchStreamFormatter.js');
|
|
6
5
|
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '../../unstable-core-do-not-import/rpc/codes.mjs';
|
|
2
1
|
import { resolveHTTPResponse } from '../../unstable-core-do-not-import/http/resolveHTTPResponse.mjs';
|
|
3
2
|
import { getBatchStreamFormatter } from '../../unstable-core-do-not-import/http/batchStreamFormatter.mjs';
|
|
4
3
|
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var http = require('node:http');
|
|
4
|
-
require('../unstable-core-do-not-import/rpc/codes.js');
|
|
5
4
|
var toURL = require('../unstable-core-do-not-import/http/toURL.js');
|
|
6
5
|
require('../unstable-core-do-not-import/rootConfig.js');
|
|
7
6
|
var nodeHTTPRequestHandler = require('./node-http/nodeHTTPRequestHandler.js');
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import http from 'node:http';
|
|
2
|
-
import '../unstable-core-do-not-import/rpc/codes.mjs';
|
|
3
2
|
import { toURL } from '../unstable-core-do-not-import/http/toURL.mjs';
|
|
4
3
|
import '../unstable-core-do-not-import/rootConfig.mjs';
|
|
5
4
|
import { nodeHTTPRequestHandler } from './node-http/nodeHTTPRequestHandler.mjs';
|
package/dist/adapters/ws.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var getErrorShape = require('../unstable-core-do-not-import/error/getErrorShape.js');
|
|
4
4
|
var TRPCError = require('../unstable-core-do-not-import/error/TRPCError.js');
|
|
5
|
-
require('../unstable-core-do-not-import/rpc/codes.js');
|
|
6
5
|
var parseTRPCMessage = require('../unstable-core-do-not-import/rpc/parseTRPCMessage.js');
|
|
7
6
|
var router = require('../unstable-core-do-not-import/router.js');
|
|
8
7
|
var transformer = require('../unstable-core-do-not-import/transformer.js');
|
package/dist/adapters/ws.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getErrorShape } from '../unstable-core-do-not-import/error/getErrorShape.mjs';
|
|
2
2
|
import { TRPCError, getTRPCErrorFromUnknown } from '../unstable-core-do-not-import/error/TRPCError.mjs';
|
|
3
|
-
import '../unstable-core-do-not-import/rpc/codes.mjs';
|
|
4
3
|
import { parseTRPCMessage } from '../unstable-core-do-not-import/rpc/parseTRPCMessage.mjs';
|
|
5
4
|
import { callProcedure } from '../unstable-core-do-not-import/router.mjs';
|
|
6
5
|
import { transformTRPCResponse } from '../unstable-core-do-not-import/transformer.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 37.
|
|
2
|
+
"bundleSize": 93108,
|
|
3
|
+
"bundleOrigSize": 148167,
|
|
4
|
+
"bundleReduction": 37.16,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/adapters/ws.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependents": [
|
|
15
15
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
16
16
|
],
|
|
17
|
-
"percent": 10.
|
|
17
|
+
"percent": 10.71,
|
|
18
18
|
"reduction": 0
|
|
19
19
|
},
|
|
20
20
|
{
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"removedExports": [],
|
|
28
28
|
"dependents": [],
|
|
29
|
-
"percent": 10.
|
|
29
|
+
"percent": 10.08,
|
|
30
30
|
"reduction": 21.23
|
|
31
31
|
},
|
|
32
32
|
{
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts",
|
|
46
46
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
47
47
|
],
|
|
48
|
-
"percent": 6.
|
|
48
|
+
"percent": 6.52,
|
|
49
49
|
"reduction": 38.58
|
|
50
50
|
},
|
|
51
51
|
{
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"/src/unstable-core-do-not-import.ts",
|
|
62
62
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
63
63
|
],
|
|
64
|
-
"percent": 6.
|
|
64
|
+
"percent": 6.13,
|
|
65
65
|
"reduction": 58.57
|
|
66
66
|
},
|
|
67
67
|
{
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"dependents": [
|
|
78
78
|
"/src/adapters/node-http/content-type/form-data/index.ts"
|
|
79
79
|
],
|
|
80
|
-
"percent": 5.
|
|
80
|
+
"percent": 5.35,
|
|
81
81
|
"reduction": 36.77
|
|
82
82
|
},
|
|
83
83
|
{
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
],
|
|
92
92
|
"removedExports": [],
|
|
93
93
|
"dependents": [],
|
|
94
|
-
"percent": 4.
|
|
94
|
+
"percent": 4.75,
|
|
95
95
|
"reduction": 32.71
|
|
96
96
|
},
|
|
97
97
|
{
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"dependents": [
|
|
106
106
|
"/src/adapters/node-http/index.ts"
|
|
107
107
|
],
|
|
108
|
-
"percent": 4.
|
|
108
|
+
"percent": 4.22,
|
|
109
109
|
"reduction": 13.56
|
|
110
110
|
},
|
|
111
111
|
{
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"dependents": [
|
|
120
120
|
"/src/adapters/fetch/index.ts"
|
|
121
121
|
],
|
|
122
|
-
"percent": 3.
|
|
122
|
+
"percent": 3.82,
|
|
123
123
|
"reduction": 9.5
|
|
124
124
|
},
|
|
125
125
|
{
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"dependents": [
|
|
136
136
|
"/src/observable/index.ts"
|
|
137
137
|
],
|
|
138
|
-
"percent": 3.
|
|
138
|
+
"percent": 3.68,
|
|
139
139
|
"reduction": 5.43
|
|
140
140
|
},
|
|
141
141
|
{
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"dependents": [
|
|
155
155
|
"/src/adapters/aws-lambda/index.ts"
|
|
156
156
|
],
|
|
157
|
-
"percent": 3.
|
|
157
|
+
"percent": 3.55,
|
|
158
158
|
"reduction": 36.48
|
|
159
159
|
},
|
|
160
160
|
{
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
"dependents": [
|
|
171
171
|
"/src/observable/index.ts"
|
|
172
172
|
],
|
|
173
|
-
"percent": 3.
|
|
173
|
+
"percent": 3.2,
|
|
174
174
|
"reduction": 0
|
|
175
175
|
},
|
|
176
176
|
{
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
"/src/unstable-core-do-not-import/router.ts",
|
|
191
191
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
192
192
|
],
|
|
193
|
-
"percent": 2.
|
|
193
|
+
"percent": 2.95,
|
|
194
194
|
"reduction": 45.94
|
|
195
195
|
},
|
|
196
196
|
{
|
|
@@ -204,7 +204,7 @@
|
|
|
204
204
|
"dependents": [
|
|
205
205
|
"/src/unstable-core-do-not-import.ts"
|
|
206
206
|
],
|
|
207
|
-
"percent": 2.
|
|
207
|
+
"percent": 2.93,
|
|
208
208
|
"reduction": 39.13
|
|
209
209
|
},
|
|
210
210
|
{
|
|
@@ -224,7 +224,7 @@
|
|
|
224
224
|
"/src/unstable-core-do-not-import/initTRPC.ts",
|
|
225
225
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
226
226
|
],
|
|
227
|
-
"percent": 2.
|
|
227
|
+
"percent": 2.82,
|
|
228
228
|
"reduction": 55.5
|
|
229
229
|
},
|
|
230
230
|
{
|
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
"/src/adapters/fastify/index.ts",
|
|
240
240
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
241
241
|
],
|
|
242
|
-
"percent": 2.
|
|
242
|
+
"percent": 2.78,
|
|
243
243
|
"reduction": 35.33
|
|
244
244
|
},
|
|
245
245
|
{
|
|
@@ -251,7 +251,7 @@
|
|
|
251
251
|
],
|
|
252
252
|
"removedExports": [],
|
|
253
253
|
"dependents": [],
|
|
254
|
-
"percent": 2.
|
|
254
|
+
"percent": 2.73,
|
|
255
255
|
"reduction": 31.37
|
|
256
256
|
},
|
|
257
257
|
{
|
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
"/src/unstable-core-do-not-import/middleware.ts",
|
|
273
273
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
274
274
|
],
|
|
275
|
-
"percent": 1.
|
|
275
|
+
"percent": 1.86,
|
|
276
276
|
"reduction": 19.47
|
|
277
277
|
},
|
|
278
278
|
{
|
|
@@ -286,7 +286,7 @@
|
|
|
286
286
|
"dependents": [
|
|
287
287
|
"/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts"
|
|
288
288
|
],
|
|
289
|
-
"percent": 1.
|
|
289
|
+
"percent": 1.76,
|
|
290
290
|
"reduction": 34.79
|
|
291
291
|
},
|
|
292
292
|
{
|
|
@@ -300,7 +300,7 @@
|
|
|
300
300
|
"dependents": [
|
|
301
301
|
"/src/adapters/fastify/index.ts"
|
|
302
302
|
],
|
|
303
|
-
"percent": 1.
|
|
303
|
+
"percent": 1.72,
|
|
304
304
|
"reduction": 31.58
|
|
305
305
|
},
|
|
306
306
|
{
|
|
@@ -312,9 +312,23 @@
|
|
|
312
312
|
],
|
|
313
313
|
"removedExports": [],
|
|
314
314
|
"dependents": [],
|
|
315
|
-
"percent": 1.
|
|
315
|
+
"percent": 1.72,
|
|
316
316
|
"reduction": 29.12
|
|
317
317
|
},
|
|
318
|
+
{
|
|
319
|
+
"id": "/src/adapters/node-http/content-type/json/getPostBody.ts",
|
|
320
|
+
"size": 1590,
|
|
321
|
+
"origSize": 1593,
|
|
322
|
+
"renderedExports": [
|
|
323
|
+
"getPostBody"
|
|
324
|
+
],
|
|
325
|
+
"removedExports": [],
|
|
326
|
+
"dependents": [
|
|
327
|
+
"/src/adapters/node-http/content-type/json/index.ts"
|
|
328
|
+
],
|
|
329
|
+
"percent": 1.71,
|
|
330
|
+
"reduction": 0.19
|
|
331
|
+
},
|
|
318
332
|
{
|
|
319
333
|
"id": "/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
|
|
320
334
|
"size": 1580,
|
|
@@ -324,9 +338,22 @@
|
|
|
324
338
|
],
|
|
325
339
|
"removedExports": [],
|
|
326
340
|
"dependents": [],
|
|
327
|
-
"percent": 1.
|
|
341
|
+
"percent": 1.7,
|
|
328
342
|
"reduction": 21.04
|
|
329
343
|
},
|
|
344
|
+
{
|
|
345
|
+
"id": "/src/unstable-core-do-not-import/rpc/codes.ts",
|
|
346
|
+
"size": 1524,
|
|
347
|
+
"origSize": 2105,
|
|
348
|
+
"renderedExports": [
|
|
349
|
+
"TRPC_ERROR_CODES_BY_KEY",
|
|
350
|
+
"TRPC_ERROR_CODES_BY_NUMBER"
|
|
351
|
+
],
|
|
352
|
+
"removedExports": [],
|
|
353
|
+
"dependents": [],
|
|
354
|
+
"percent": 1.64,
|
|
355
|
+
"reduction": 27.6
|
|
356
|
+
},
|
|
330
357
|
{
|
|
331
358
|
"id": "/src/unstable-core-do-not-import/createProxy.ts",
|
|
332
359
|
"size": 1507,
|
|
@@ -341,7 +368,7 @@
|
|
|
341
368
|
"/src/unstable-core-do-not-import/router.ts",
|
|
342
369
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
343
370
|
],
|
|
344
|
-
"percent": 1.
|
|
371
|
+
"percent": 1.62,
|
|
345
372
|
"reduction": 5.58
|
|
346
373
|
},
|
|
347
374
|
{
|
|
@@ -355,13 +382,13 @@
|
|
|
355
382
|
"dependents": [
|
|
356
383
|
"/src/adapters/node-http/content-type/form-data/fileUploadHandler.ts"
|
|
357
384
|
],
|
|
358
|
-
"percent": 1.
|
|
385
|
+
"percent": 1.5,
|
|
359
386
|
"reduction": 0
|
|
360
387
|
},
|
|
361
388
|
{
|
|
362
389
|
"id": "/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts",
|
|
363
|
-
"size":
|
|
364
|
-
"origSize":
|
|
390
|
+
"size": 1266,
|
|
391
|
+
"origSize": 1639,
|
|
365
392
|
"renderedExports": [
|
|
366
393
|
"getHTTPStatusCode",
|
|
367
394
|
"getHTTPStatusCodeFromError"
|
|
@@ -371,42 +398,29 @@
|
|
|
371
398
|
"/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts",
|
|
372
399
|
"/src/unstable-core-do-not-import/error/getErrorShape.ts"
|
|
373
400
|
],
|
|
374
|
-
"percent": 1.
|
|
375
|
-
"reduction":
|
|
401
|
+
"percent": 1.36,
|
|
402
|
+
"reduction": 22.76
|
|
376
403
|
},
|
|
377
404
|
{
|
|
378
|
-
"id": "/src/
|
|
379
|
-
"size":
|
|
380
|
-
"origSize":
|
|
405
|
+
"id": "/src/unstable-core-do-not-import/parser.ts",
|
|
406
|
+
"size": 992,
|
|
407
|
+
"origSize": 2266,
|
|
381
408
|
"renderedExports": [
|
|
382
|
-
"
|
|
409
|
+
"getParseFn"
|
|
383
410
|
],
|
|
384
411
|
"removedExports": [],
|
|
385
412
|
"dependents": [
|
|
386
|
-
"/src/
|
|
387
|
-
|
|
388
|
-
"percent": 1.21,
|
|
389
|
-
"reduction": 2.87
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
"id": "/src/unstable-core-do-not-import/rpc/codes.ts",
|
|
393
|
-
"size": 1020,
|
|
394
|
-
"origSize": 1325,
|
|
395
|
-
"renderedExports": [
|
|
396
|
-
"TRPC_ERROR_CODES_BY_KEY",
|
|
397
|
-
"TRPC_ERROR_CODES_BY_NUMBER"
|
|
413
|
+
"/src/unstable-core-do-not-import.ts",
|
|
414
|
+
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
398
415
|
],
|
|
399
|
-
"
|
|
400
|
-
"
|
|
401
|
-
"percent": 1.11,
|
|
402
|
-
"reduction": 23.02
|
|
416
|
+
"percent": 1.07,
|
|
417
|
+
"reduction": 56.22
|
|
403
418
|
},
|
|
404
419
|
{
|
|
405
420
|
"id": "/src/unstable-core-do-not-import/utils.ts",
|
|
406
|
-
"size":
|
|
407
|
-
"origSize":
|
|
421
|
+
"size": 815,
|
|
422
|
+
"origSize": 1016,
|
|
408
423
|
"renderedExports": [
|
|
409
|
-
"invert",
|
|
410
424
|
"mergeWithoutOverrides",
|
|
411
425
|
"isObject",
|
|
412
426
|
"omitPrototype"
|
|
@@ -414,31 +428,15 @@
|
|
|
414
428
|
"removedExports": [],
|
|
415
429
|
"dependents": [
|
|
416
430
|
"/src/unstable-core-do-not-import.ts",
|
|
417
|
-
"/src/unstable-core-do-not-import/rpc/codes.ts",
|
|
418
|
-
"/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
|
|
419
431
|
"/src/unstable-core-do-not-import/error/TRPCError.ts",
|
|
420
432
|
"/src/unstable-core-do-not-import/router.ts",
|
|
421
433
|
"/src/unstable-core-do-not-import/transformer.ts",
|
|
422
434
|
"/src/unstable-core-do-not-import/middleware.ts",
|
|
435
|
+
"/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
|
|
423
436
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
424
437
|
],
|
|
425
|
-
"percent":
|
|
426
|
-
"reduction":
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
"id": "/src/unstable-core-do-not-import/parser.ts",
|
|
430
|
-
"size": 992,
|
|
431
|
-
"origSize": 2266,
|
|
432
|
-
"renderedExports": [
|
|
433
|
-
"getParseFn"
|
|
434
|
-
],
|
|
435
|
-
"removedExports": [],
|
|
436
|
-
"dependents": [
|
|
437
|
-
"/src/unstable-core-do-not-import.ts",
|
|
438
|
-
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
439
|
-
],
|
|
440
|
-
"percent": 1.07,
|
|
441
|
-
"reduction": 56.22
|
|
438
|
+
"percent": 0.88,
|
|
439
|
+
"reduction": 19.78
|
|
442
440
|
},
|
|
443
441
|
{
|
|
444
442
|
"id": "/src/adapters/node-http/content-type/form-data/uploadHandler.ts",
|
|
@@ -457,7 +455,7 @@
|
|
|
457
455
|
"/src/adapters/node-http/content-type/form-data/fileUploadHandler.ts",
|
|
458
456
|
"/src/adapters/node-http/content-type/form-data/memoryUploadHandler.ts"
|
|
459
457
|
],
|
|
460
|
-
"percent": 0.
|
|
458
|
+
"percent": 0.78,
|
|
461
459
|
"reduction": 67.52
|
|
462
460
|
},
|
|
463
461
|
{
|
|
@@ -471,7 +469,7 @@
|
|
|
471
469
|
"dependents": [
|
|
472
470
|
"/src/adapters/node-http/content-type/form-data/index.ts"
|
|
473
471
|
],
|
|
474
|
-
"percent": 0.
|
|
472
|
+
"percent": 0.75,
|
|
475
473
|
"reduction": 71.21
|
|
476
474
|
},
|
|
477
475
|
{
|
|
@@ -498,7 +496,7 @@
|
|
|
498
496
|
"/src/unstable-core-do-not-import.ts",
|
|
499
497
|
"/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts"
|
|
500
498
|
],
|
|
501
|
-
"percent": 0.
|
|
499
|
+
"percent": 0.67,
|
|
502
500
|
"reduction": 43.49
|
|
503
501
|
},
|
|
504
502
|
{
|
|
@@ -511,7 +509,7 @@
|
|
|
511
509
|
],
|
|
512
510
|
"removedExports": [],
|
|
513
511
|
"dependents": [],
|
|
514
|
-
"percent": 0.
|
|
512
|
+
"percent": 0.62,
|
|
515
513
|
"reduction": 65.23
|
|
516
514
|
},
|
|
517
515
|
{
|
|
@@ -538,7 +536,7 @@
|
|
|
538
536
|
],
|
|
539
537
|
"removedExports": [],
|
|
540
538
|
"dependents": [],
|
|
541
|
-
"percent": 0.
|
|
539
|
+
"percent": 0.36,
|
|
542
540
|
"reduction": 71.37
|
|
543
541
|
},
|
|
544
542
|
{
|
|
@@ -552,7 +550,7 @@
|
|
|
552
550
|
"dependents": [
|
|
553
551
|
"/src/adapters/node-http/nodeHTTPRequestHandler.ts"
|
|
554
552
|
],
|
|
555
|
-
"percent": 0.
|
|
553
|
+
"percent": 0.31,
|
|
556
554
|
"reduction": 35.11
|
|
557
555
|
},
|
|
558
556
|
{
|
|
@@ -590,10 +588,10 @@
|
|
|
590
588
|
],
|
|
591
589
|
"removedExports": [],
|
|
592
590
|
"dependents": [
|
|
593
|
-
"/src/adapters/node-http/content-type/
|
|
594
|
-
"/src/adapters/node-http/content-type/
|
|
591
|
+
"/src/adapters/node-http/content-type/form-data/index.ts",
|
|
592
|
+
"/src/adapters/node-http/content-type/json/index.ts"
|
|
595
593
|
],
|
|
596
|
-
"percent": 0.
|
|
594
|
+
"percent": 0.12,
|
|
597
595
|
"reduction": 86.68
|
|
598
596
|
},
|
|
599
597
|
{
|
|
@@ -638,9 +636,9 @@
|
|
|
638
636
|
"reduction": 100
|
|
639
637
|
},
|
|
640
638
|
{
|
|
641
|
-
"id": "/src/
|
|
639
|
+
"id": "/src/index.ts",
|
|
642
640
|
"size": 0,
|
|
643
|
-
"origSize":
|
|
641
|
+
"origSize": 32,
|
|
644
642
|
"renderedExports": [],
|
|
645
643
|
"removedExports": [],
|
|
646
644
|
"dependents": [],
|
|
@@ -648,9 +646,9 @@
|
|
|
648
646
|
"reduction": 100
|
|
649
647
|
},
|
|
650
648
|
{
|
|
651
|
-
"id": "/src/
|
|
649
|
+
"id": "/src/rpc.ts",
|
|
652
650
|
"size": 0,
|
|
653
|
-
"origSize":
|
|
651
|
+
"origSize": 36,
|
|
654
652
|
"renderedExports": [],
|
|
655
653
|
"removedExports": [],
|
|
656
654
|
"dependents": [],
|
package/dist/http.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var getHTTPStatusCode = require('./unstable-core-do-not-import/http/getHTTPStatusCode.js');
|
|
4
|
-
require('./unstable-core-do-not-import/rpc/codes.js');
|
|
5
4
|
var resolveHTTPResponse = require('./unstable-core-do-not-import/http/resolveHTTPResponse.js');
|
|
6
5
|
var batchStreamFormatter = require('./unstable-core-do-not-import/http/batchStreamFormatter.js');
|
|
7
6
|
var contentType = require('./unstable-core-do-not-import/http/contentType.js');
|
package/dist/http.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { getHTTPStatusCode, getHTTPStatusCodeFromError } from './unstable-core-do-not-import/http/getHTTPStatusCode.mjs';
|
|
2
|
-
import './unstable-core-do-not-import/rpc/codes.mjs';
|
|
3
2
|
export { resolveHTTPResponse } from './unstable-core-do-not-import/http/resolveHTTPResponse.mjs';
|
|
4
3
|
export { getBatchStreamFormatter } from './unstable-core-do-not-import/http/batchStreamFormatter.mjs';
|
|
5
4
|
export { getJsonContentTypeInputs } from './unstable-core-do-not-import/http/contentType.mjs';
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var createProxy = require('./unstable-core-do-not-import/createProxy.js');
|
|
4
4
|
var getErrorShape = require('./unstable-core-do-not-import/error/getErrorShape.js');
|
|
5
5
|
var TRPCError = require('./unstable-core-do-not-import/error/TRPCError.js');
|
|
6
|
-
require('./unstable-core-do-not-import/rpc/codes.js');
|
|
7
6
|
var router = require('./unstable-core-do-not-import/router.js');
|
|
8
7
|
var transformer = require('./unstable-core-do-not-import/transformer.js');
|
|
9
8
|
var initTRPC = require('./unstable-core-do-not-import/initTRPC.js');
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { createFlatProxy as createTRPCFlatProxy } from './unstable-core-do-not-import/createProxy.mjs';
|
|
2
2
|
export { getErrorShape } from './unstable-core-do-not-import/error/getErrorShape.mjs';
|
|
3
3
|
export { TRPCError, getTRPCErrorFromUnknown } from './unstable-core-do-not-import/error/TRPCError.mjs';
|
|
4
|
-
import './unstable-core-do-not-import/rpc/codes.mjs';
|
|
5
4
|
export { callProcedure, callProcedure as callTRPCProcedure } from './unstable-core-do-not-import/router.mjs';
|
|
6
5
|
export { transformTRPCResponse } from './unstable-core-do-not-import/transformer.mjs';
|
|
7
6
|
export { initTRPC } from './unstable-core-do-not-import/initTRPC.mjs';
|
package/dist/shared.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var createProxy = require('./unstable-core-do-not-import/createProxy.js');
|
|
4
4
|
var getErrorShape = require('./unstable-core-do-not-import/error/getErrorShape.js');
|
|
5
|
-
require('./unstable-core-do-not-import/rpc/codes.js');
|
|
6
5
|
require('./unstable-core-do-not-import/rootConfig.js');
|
|
7
6
|
|
|
8
7
|
|
package/dist/shared.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { createFlatProxy } from './unstable-core-do-not-import/createProxy.mjs';
|
|
2
2
|
export { getErrorShape } from './unstable-core-do-not-import/error/getErrorShape.mjs';
|
|
3
|
-
import './unstable-core-do-not-import/rpc/codes.mjs';
|
|
4
3
|
import './unstable-core-do-not-import/rootConfig.mjs';
|
|
@@ -3,7 +3,7 @@ export declare function getCauseFromUnknown(cause: unknown): Error | undefined;
|
|
|
3
3
|
export declare function getTRPCErrorFromUnknown(cause: unknown): TRPCError;
|
|
4
4
|
export declare class TRPCError extends Error {
|
|
5
5
|
readonly cause?: Error;
|
|
6
|
-
readonly code: "INTERNAL_SERVER_ERROR" | "PARSE_ERROR" | "BAD_REQUEST" | "NOT_IMPLEMENTED" | "UNAUTHORIZED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_SUPPORTED" | "TIMEOUT" | "CONFLICT" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "UNPROCESSABLE_CONTENT" | "TOO_MANY_REQUESTS" | "CLIENT_CLOSED_REQUEST";
|
|
6
|
+
readonly code: "INTERNAL_SERVER_ERROR" | "PARSE_ERROR" | "BAD_REQUEST" | "NOT_IMPLEMENTED" | "UNAUTHORIZED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_SUPPORTED" | "TIMEOUT" | "CONFLICT" | "PRECONDITION_FAILED" | "UNSUPPORTED_MEDIA_TYPE" | "PAYLOAD_TOO_LARGE" | "UNPROCESSABLE_CONTENT" | "TOO_MANY_REQUESTS" | "CLIENT_CLOSED_REQUEST";
|
|
7
7
|
constructor(opts: {
|
|
8
8
|
message?: string;
|
|
9
9
|
code: TRPC_ERROR_CODE_KEY;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TRPCError.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/error/TRPCError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMxD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAyBrE;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAoBjE;AAED,qBAAa,SAAU,SAAQ,KAAK;IAGlC,SAAyB,KAAK,CAAC,EAAE,KAAK,CAAC;IACvC,SAAgB,IAAI,
|
|
1
|
+
{"version":3,"file":"TRPCError.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/error/TRPCError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMxD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAyBrE;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAoBjE;AAED,qBAAa,SAAU,SAAQ,KAAK;IAGlC,SAAyB,KAAK,CAAC,EAAE,KAAK,CAAC;IACvC,SAAgB,IAAI,gUAAC;gBAET,IAAI,EAAE;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,mBAAmB,CAAC;QAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB;CAgBF"}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AA6BpE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,EAAE,OAyBpE;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,SAAS,UAE1D"}
|
|
@@ -24,27 +24,20 @@ export declare const TRPC_ERROR_CODES_BY_KEY: {
|
|
|
24
24
|
readonly TIMEOUT: -32008;
|
|
25
25
|
readonly CONFLICT: -32009;
|
|
26
26
|
readonly PRECONDITION_FAILED: -32012;
|
|
27
|
+
readonly UNSUPPORTED_MEDIA_TYPE: -32015;
|
|
27
28
|
readonly PAYLOAD_TOO_LARGE: -32013;
|
|
28
29
|
readonly UNPROCESSABLE_CONTENT: -32022;
|
|
29
30
|
readonly TOO_MANY_REQUESTS: -32029;
|
|
30
31
|
readonly CLIENT_CLOSED_REQUEST: -32099;
|
|
31
32
|
};
|
|
32
|
-
|
|
33
|
-
[
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
[
|
|
37
|
-
[-32003]: "FORBIDDEN";
|
|
38
|
-
[-32004]: "NOT_FOUND";
|
|
39
|
-
[-32005]: "METHOD_NOT_SUPPORTED";
|
|
40
|
-
[-32008]: "TIMEOUT";
|
|
41
|
-
[-32009]: "CONFLICT";
|
|
42
|
-
[-32012]: "PRECONDITION_FAILED";
|
|
43
|
-
[-32013]: "PAYLOAD_TOO_LARGE";
|
|
44
|
-
[-32022]: "UNPROCESSABLE_CONTENT";
|
|
45
|
-
[-32029]: "TOO_MANY_REQUESTS";
|
|
46
|
-
[-32099]: "CLIENT_CLOSED_REQUEST";
|
|
33
|
+
type KeyFromValue<TValue, TType extends Record<PropertyKey, PropertyKey>> = {
|
|
34
|
+
[K in keyof TType]: TValue extends TType[K] ? K : never;
|
|
35
|
+
}[keyof TType];
|
|
36
|
+
type Invert<TType extends Record<PropertyKey, PropertyKey>> = {
|
|
37
|
+
[TValue in TType[keyof TType]]: KeyFromValue<TValue, TType>;
|
|
47
38
|
};
|
|
39
|
+
export declare const TRPC_ERROR_CODES_BY_NUMBER: Invert<typeof TRPC_ERROR_CODES_BY_KEY>;
|
|
48
40
|
export type TRPC_ERROR_CODE_NUMBER = ValueOf<typeof TRPC_ERROR_CODES_BY_KEY>;
|
|
49
41
|
export type TRPC_ERROR_CODE_KEY = keyof typeof TRPC_ERROR_CODES_BY_KEY;
|
|
42
|
+
export {};
|
|
50
43
|
//# sourceMappingURL=codes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/rpc/codes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/rpc/codes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAIxC;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;IAClC;;;OAGG;;IAEH;;OAEG;;;;;;;;;;;;;;;;CAoBK,CAAC;AAEX,KAAK,YAAY,CAAC,MAAM,EAAE,KAAK,SAAS,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI;KACzE,CAAC,IAAI,MAAM,KAAK,GAAG,MAAM,SAAS,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;CACxD,CAAC,MAAM,KAAK,CAAC,CAAC;AAEf,KAAK,MAAM,CAAC,KAAK,SAAS,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI;KAC3D,MAAM,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC;CAC5D,CAAC;AAGF,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAC7C,OAAO,uBAAuB,CAiB/B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC7E,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,uBAAuB,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var utils = require('../utils.js');
|
|
4
|
-
|
|
5
3
|
// reference: https://www.jsonrpc.org/specification
|
|
6
4
|
/**
|
|
7
5
|
* JSON-RPC 2.0 Error codes
|
|
@@ -27,12 +25,30 @@ var utils = require('../utils.js');
|
|
|
27
25
|
TIMEOUT: -32008,
|
|
28
26
|
CONFLICT: -32009,
|
|
29
27
|
PRECONDITION_FAILED: -32012,
|
|
28
|
+
UNSUPPORTED_MEDIA_TYPE: -32015,
|
|
30
29
|
PAYLOAD_TOO_LARGE: -32013,
|
|
31
30
|
UNPROCESSABLE_CONTENT: -32022,
|
|
32
31
|
TOO_MANY_REQUESTS: -32029,
|
|
33
32
|
CLIENT_CLOSED_REQUEST: -32099
|
|
34
33
|
};
|
|
35
|
-
|
|
34
|
+
// pure
|
|
35
|
+
const TRPC_ERROR_CODES_BY_NUMBER = {
|
|
36
|
+
[-32700]: 'PARSE_ERROR',
|
|
37
|
+
[-32600]: 'BAD_REQUEST',
|
|
38
|
+
[-32603]: 'INTERNAL_SERVER_ERROR',
|
|
39
|
+
[-32001]: 'UNAUTHORIZED',
|
|
40
|
+
[-32003]: 'FORBIDDEN',
|
|
41
|
+
[-32004]: 'NOT_FOUND',
|
|
42
|
+
[-32005]: 'METHOD_NOT_SUPPORTED',
|
|
43
|
+
[-32008]: 'TIMEOUT',
|
|
44
|
+
[-32009]: 'CONFLICT',
|
|
45
|
+
[-32012]: 'PRECONDITION_FAILED',
|
|
46
|
+
[-32013]: 'PAYLOAD_TOO_LARGE',
|
|
47
|
+
[-32015]: 'UNSUPPORTED_MEDIA_TYPE',
|
|
48
|
+
[-32022]: 'UNPROCESSABLE_CONTENT',
|
|
49
|
+
[-32029]: 'TOO_MANY_REQUESTS',
|
|
50
|
+
[-32099]: 'CLIENT_CLOSED_REQUEST'
|
|
51
|
+
};
|
|
36
52
|
|
|
37
53
|
exports.TRPC_ERROR_CODES_BY_KEY = TRPC_ERROR_CODES_BY_KEY;
|
|
38
54
|
exports.TRPC_ERROR_CODES_BY_NUMBER = TRPC_ERROR_CODES_BY_NUMBER;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { invert } from '../utils.mjs';
|
|
2
|
-
|
|
3
1
|
// reference: https://www.jsonrpc.org/specification
|
|
4
2
|
/**
|
|
5
3
|
* JSON-RPC 2.0 Error codes
|
|
@@ -25,11 +23,29 @@ import { invert } from '../utils.mjs';
|
|
|
25
23
|
TIMEOUT: -32008,
|
|
26
24
|
CONFLICT: -32009,
|
|
27
25
|
PRECONDITION_FAILED: -32012,
|
|
26
|
+
UNSUPPORTED_MEDIA_TYPE: -32015,
|
|
28
27
|
PAYLOAD_TOO_LARGE: -32013,
|
|
29
28
|
UNPROCESSABLE_CONTENT: -32022,
|
|
30
29
|
TOO_MANY_REQUESTS: -32029,
|
|
31
30
|
CLIENT_CLOSED_REQUEST: -32099
|
|
32
31
|
};
|
|
33
|
-
|
|
32
|
+
// pure
|
|
33
|
+
const TRPC_ERROR_CODES_BY_NUMBER = {
|
|
34
|
+
[-32700]: 'PARSE_ERROR',
|
|
35
|
+
[-32600]: 'BAD_REQUEST',
|
|
36
|
+
[-32603]: 'INTERNAL_SERVER_ERROR',
|
|
37
|
+
[-32001]: 'UNAUTHORIZED',
|
|
38
|
+
[-32003]: 'FORBIDDEN',
|
|
39
|
+
[-32004]: 'NOT_FOUND',
|
|
40
|
+
[-32005]: 'METHOD_NOT_SUPPORTED',
|
|
41
|
+
[-32008]: 'TIMEOUT',
|
|
42
|
+
[-32009]: 'CONFLICT',
|
|
43
|
+
[-32012]: 'PRECONDITION_FAILED',
|
|
44
|
+
[-32013]: 'PAYLOAD_TOO_LARGE',
|
|
45
|
+
[-32015]: 'UNSUPPORTED_MEDIA_TYPE',
|
|
46
|
+
[-32022]: 'UNPROCESSABLE_CONTENT',
|
|
47
|
+
[-32029]: 'TOO_MANY_REQUESTS',
|
|
48
|
+
[-32099]: 'CLIENT_CLOSED_REQUEST'
|
|
49
|
+
};
|
|
34
50
|
|
|
35
51
|
export { TRPC_ERROR_CODES_BY_KEY, TRPC_ERROR_CODES_BY_NUMBER };
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
type KeyFromValue<TValue, TType extends Record<PropertyKey, PropertyKey>> = {
|
|
2
|
-
[K in keyof TType]: TValue extends TType[K] ? K : never;
|
|
3
|
-
}[keyof TType];
|
|
4
|
-
type Invert<TType extends Record<PropertyKey, PropertyKey>> = {
|
|
5
|
-
[TValue in TType[keyof TType]]: KeyFromValue<TValue, TType>;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export declare function invert<TRecord extends Record<PropertyKey, PropertyKey>>(obj: TRecord): Invert<TRecord>;
|
|
11
1
|
/**
|
|
12
2
|
* Ensures there are no duplicate keys when building a procedure.
|
|
13
3
|
* @internal
|
|
@@ -23,5 +13,4 @@ export declare function isObject(value: unknown): value is Record<string, unknow
|
|
|
23
13
|
* @internal
|
|
24
14
|
*/
|
|
25
15
|
export declare function omitPrototype<TObj extends Record<string, unknown>>(obj: TObj): TObj;
|
|
26
|
-
export {};
|
|
27
16
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/utils.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzE,IAAI,EAAE,KAAK,EACX,GAAG,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,GACxB,KAAK,CAYP;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChE,GAAG,EAAE,IAAI,GACR,IAAI,CAEN"}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
*/ function invert(obj) {
|
|
6
|
-
const newObj = Object.create(null);
|
|
7
|
-
for(const key in obj){
|
|
8
|
-
const v = obj[key];
|
|
9
|
-
newObj[v] = key;
|
|
10
|
-
}
|
|
11
|
-
return newObj;
|
|
12
|
-
}
|
|
13
3
|
/**
|
|
14
4
|
* Ensures there are no duplicate keys when building a procedure.
|
|
15
5
|
* @internal
|
|
@@ -38,7 +28,6 @@
|
|
|
38
28
|
return Object.assign(Object.create(null), obj);
|
|
39
29
|
}
|
|
40
30
|
|
|
41
|
-
exports.invert = invert;
|
|
42
31
|
exports.isObject = isObject;
|
|
43
32
|
exports.mergeWithoutOverrides = mergeWithoutOverrides;
|
|
44
33
|
exports.omitPrototype = omitPrototype;
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
*/ function invert(obj) {
|
|
4
|
-
const newObj = Object.create(null);
|
|
5
|
-
for(const key in obj){
|
|
6
|
-
const v = obj[key];
|
|
7
|
-
newObj[v] = key;
|
|
8
|
-
}
|
|
9
|
-
return newObj;
|
|
10
|
-
}
|
|
11
1
|
/**
|
|
12
2
|
* Ensures there are no duplicate keys when building a procedure.
|
|
13
3
|
* @internal
|
|
@@ -36,4 +26,4 @@
|
|
|
36
26
|
return Object.assign(Object.create(null), obj);
|
|
37
27
|
}
|
|
38
28
|
|
|
39
|
-
export {
|
|
29
|
+
export { isObject, mergeWithoutOverrides, omitPrototype };
|
|
@@ -60,7 +60,6 @@ exports.getDataTransformer = transformer.getDataTransformer;
|
|
|
60
60
|
exports.transformResult = transformer.transformResult;
|
|
61
61
|
exports.transformTRPCResponse = transformer.transformTRPCResponse;
|
|
62
62
|
exports.ERROR_SYMBOL = types.ERROR_SYMBOL;
|
|
63
|
-
exports.invert = utils.invert;
|
|
64
63
|
exports.isObject = utils.isObject;
|
|
65
64
|
exports.mergeWithoutOverrides = utils.mergeWithoutOverrides;
|
|
66
65
|
exports.omitPrototype = utils.omitPrototype;
|
|
@@ -18,4 +18,4 @@ export { TRPC_ERROR_CODES_BY_KEY, TRPC_ERROR_CODES_BY_NUMBER } from './unstable-
|
|
|
18
18
|
export { parseTRPCMessage } from './unstable-core-do-not-import/rpc/parseTRPCMessage.mjs';
|
|
19
19
|
export { defaultTransformer, getDataTransformer, transformResult, transformTRPCResponse } from './unstable-core-do-not-import/transformer.mjs';
|
|
20
20
|
export { ERROR_SYMBOL } from './unstable-core-do-not-import/types.mjs';
|
|
21
|
-
export {
|
|
21
|
+
export { isObject, mergeWithoutOverrides, omitPrototype } from './unstable-core-do-not-import/utils.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/server",
|
|
3
|
-
"version": "11.0.0-next-beta.
|
|
3
|
+
"version": "11.0.0-next-beta.303+cdf215127",
|
|
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": "cdf215127a172e497468dec04acb8ea12e840e84"
|
|
161
161
|
}
|
|
@@ -9,6 +9,22 @@ export async function getPostBody(opts: {
|
|
|
9
9
|
}): Promise<BodyResult> {
|
|
10
10
|
const { req, maxBodySize = Infinity } = opts;
|
|
11
11
|
return new Promise((resolve) => {
|
|
12
|
+
if (
|
|
13
|
+
!req.headers['content-type']?.startsWith('application/json') &&
|
|
14
|
+
(!req.method ||
|
|
15
|
+
(req.method !== 'GET' &&
|
|
16
|
+
req.method !== 'OPTIONS' &&
|
|
17
|
+
req.method !== 'HEAD'))
|
|
18
|
+
) {
|
|
19
|
+
resolve({
|
|
20
|
+
ok: false,
|
|
21
|
+
error: new TRPCError({
|
|
22
|
+
code: 'UNSUPPORTED_MEDIA_TYPE',
|
|
23
|
+
message: 'Invalid Content-Type header (expected application/json)',
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
12
28
|
if ('body' in req) {
|
|
13
29
|
resolve({
|
|
14
30
|
ok: true,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ValueOf } from '../types';
|
|
2
|
-
import { invert } from '../utils';
|
|
3
2
|
|
|
4
3
|
// reference: https://www.jsonrpc.org/specification
|
|
5
4
|
|
|
@@ -32,13 +31,41 @@ export const TRPC_ERROR_CODES_BY_KEY = {
|
|
|
32
31
|
TIMEOUT: -32008, // 408
|
|
33
32
|
CONFLICT: -32009, // 409
|
|
34
33
|
PRECONDITION_FAILED: -32012, // 412
|
|
34
|
+
UNSUPPORTED_MEDIA_TYPE: -32015, // 415
|
|
35
35
|
PAYLOAD_TOO_LARGE: -32013, // 413
|
|
36
36
|
UNPROCESSABLE_CONTENT: -32022, // 422
|
|
37
37
|
TOO_MANY_REQUESTS: -32029, // 429
|
|
38
38
|
CLIENT_CLOSED_REQUEST: -32099, // 499
|
|
39
39
|
} as const;
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
type KeyFromValue<TValue, TType extends Record<PropertyKey, PropertyKey>> = {
|
|
42
|
+
[K in keyof TType]: TValue extends TType[K] ? K : never;
|
|
43
|
+
}[keyof TType];
|
|
44
|
+
|
|
45
|
+
type Invert<TType extends Record<PropertyKey, PropertyKey>> = {
|
|
46
|
+
[TValue in TType[keyof TType]]: KeyFromValue<TValue, TType>;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// pure
|
|
50
|
+
export const TRPC_ERROR_CODES_BY_NUMBER: Invert<
|
|
51
|
+
typeof TRPC_ERROR_CODES_BY_KEY
|
|
52
|
+
> = {
|
|
53
|
+
[-32700]: 'PARSE_ERROR',
|
|
54
|
+
[-32600]: 'BAD_REQUEST',
|
|
55
|
+
[-32603]: 'INTERNAL_SERVER_ERROR',
|
|
56
|
+
[-32001]: 'UNAUTHORIZED',
|
|
57
|
+
[-32003]: 'FORBIDDEN',
|
|
58
|
+
[-32004]: 'NOT_FOUND',
|
|
59
|
+
[-32005]: 'METHOD_NOT_SUPPORTED',
|
|
60
|
+
[-32008]: 'TIMEOUT',
|
|
61
|
+
[-32009]: 'CONFLICT',
|
|
62
|
+
[-32012]: 'PRECONDITION_FAILED',
|
|
63
|
+
[-32013]: 'PAYLOAD_TOO_LARGE',
|
|
64
|
+
[-32015]: 'UNSUPPORTED_MEDIA_TYPE',
|
|
65
|
+
[-32022]: 'UNPROCESSABLE_CONTENT',
|
|
66
|
+
[-32029]: 'TOO_MANY_REQUESTS',
|
|
67
|
+
[-32099]: 'CLIENT_CLOSED_REQUEST',
|
|
68
|
+
};
|
|
42
69
|
|
|
43
70
|
export type TRPC_ERROR_CODE_NUMBER = ValueOf<typeof TRPC_ERROR_CODES_BY_KEY>;
|
|
44
71
|
export type TRPC_ERROR_CODE_KEY = keyof typeof TRPC_ERROR_CODES_BY_KEY;
|
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
type KeyFromValue<TValue, TType extends Record<PropertyKey, PropertyKey>> = {
|
|
2
|
-
[K in keyof TType]: TValue extends TType[K] ? K : never;
|
|
3
|
-
}[keyof TType];
|
|
4
|
-
|
|
5
|
-
type Invert<TType extends Record<PropertyKey, PropertyKey>> = {
|
|
6
|
-
[TValue in TType[keyof TType]]: KeyFromValue<TValue, TType>;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export function invert<TRecord extends Record<PropertyKey, PropertyKey>>(
|
|
12
|
-
obj: TRecord,
|
|
13
|
-
): Invert<TRecord> {
|
|
14
|
-
const newObj = Object.create(null);
|
|
15
|
-
for (const key in obj) {
|
|
16
|
-
const v = obj[key];
|
|
17
|
-
newObj[v] = key;
|
|
18
|
-
}
|
|
19
|
-
return newObj;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
1
|
/**
|
|
23
2
|
* Ensures there are no duplicate keys when building a procedure.
|
|
24
3
|
* @internal
|