@trpc/server 11.0.0-next-beta.260 → 11.0.0-next-beta.264
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/@trpc/server/http.d.ts +1 -0
- package/dist/@trpc/server/http.d.ts.map +1 -1
- package/dist/adapters/fetch/fetchRequestHandler.d.ts.map +1 -1
- package/dist/adapters/fetch/fetchRequestHandler.js +2 -1
- package/dist/adapters/fetch/fetchRequestHandler.mjs +2 -1
- package/dist/adapters/standalone.d.ts.map +1 -1
- package/dist/adapters/standalone.js +7 -3
- package/dist/adapters/standalone.mjs +7 -3
- package/dist/bundle-analysis.json +52 -40
- package/dist/http.js +2 -0
- package/dist/http.mjs +1 -0
- package/dist/unstable-core-do-not-import/http/index.d.ts +1 -0
- package/dist/unstable-core-do-not-import/http/index.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/http/toURL.d.ts +2 -0
- package/dist/unstable-core-do-not-import/http/toURL.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/http/toURL.js +8 -0
- package/dist/unstable-core-do-not-import/http/toURL.mjs +6 -0
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts +2 -2
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import.js +2 -0
- package/dist/unstable-core-do-not-import.mjs +1 -0
- package/package.json +2 -2
- package/src/@trpc/server/http.ts +1 -0
- package/src/adapters/fetch/fetchRequestHandler.ts +3 -1
- package/src/adapters/standalone.ts +6 -3
- package/src/unstable-core-do-not-import/http/index.ts +2 -0
- package/src/unstable-core-do-not-import/http/toURL.ts +7 -0
- package/src/unstable-core-do-not-import/procedureBuilder.ts +6 -3
|
@@ -4,4 +4,5 @@ export type { BaseHandlerOptions, HTTPBaseHandlerOptions, HTTPHeaders, HTTPReque
|
|
|
4
4
|
export { getBatchStreamFormatter } from '../../unstable-core-do-not-import';
|
|
5
5
|
export type { BaseContentTypeHandler, BodyResult, } from '../../unstable-core-do-not-import';
|
|
6
6
|
export { getJsonContentTypeInputs } from '../../unstable-core-do-not-import';
|
|
7
|
+
export { toURL } from '../../unstable-core-do-not-import';
|
|
7
8
|
//# sourceMappingURL=http.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/@trpc/server/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,kCAAkC,EAClC,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,YAAY,EACV,sBAAsB,EACtB,UAAU,GACX,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC"}
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/@trpc/server/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,kCAAkC,EAClC,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,YAAY,EACV,sBAAsB,EACtB,UAAU,GACX,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/fetch/fetchRequestHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"fetchRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/fetch/fetchRequestHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAYpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,MAAM,0BAA0B,CAAC,OAAO,SAAS,SAAS,IAC9D,mBAAmB,CAAC,OAAO,CAAC,GAAG;IAC7B,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AASJ,wBAAsB,mBAAmB,CAAC,OAAO,SAAS,SAAS,EACjE,IAAI,EAAE,0BAA0B,CAAC,OAAO,CAAC,GACxC,OAAO,CAAC,QAAQ,CAAC,CAyGnB"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require('../../unstable-core-do-not-import/rpc/codes.js');
|
|
4
4
|
var resolveHTTPResponse = require('../../unstable-core-do-not-import/http/resolveHTTPResponse.js');
|
|
5
5
|
var batchStreamFormatter = require('../../unstable-core-do-not-import/http/batchStreamFormatter.js');
|
|
6
|
+
var toURL = require('../../unstable-core-do-not-import/http/toURL.js');
|
|
6
7
|
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -28,7 +29,7 @@ async function fetchRequestHandler(opts) {
|
|
|
28
29
|
...innerOpts
|
|
29
30
|
});
|
|
30
31
|
};
|
|
31
|
-
const url =
|
|
32
|
+
const url = toURL.toURL(opts.req.url);
|
|
32
33
|
const pathname = trimSlashes(url.pathname);
|
|
33
34
|
const endpoint = trimSlashes(opts.endpoint);
|
|
34
35
|
const path = trimSlashes(pathname.slice(endpoint.length));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '../../unstable-core-do-not-import/rpc/codes.mjs';
|
|
2
2
|
import { resolveHTTPResponse } from '../../unstable-core-do-not-import/http/resolveHTTPResponse.mjs';
|
|
3
3
|
import { getBatchStreamFormatter } from '../../unstable-core-do-not-import/http/batchStreamFormatter.mjs';
|
|
4
|
+
import { toURL } from '../../unstable-core-do-not-import/http/toURL.mjs';
|
|
4
5
|
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -26,7 +27,7 @@ async function fetchRequestHandler(opts) {
|
|
|
26
27
|
...innerOpts
|
|
27
28
|
});
|
|
28
29
|
};
|
|
29
|
-
const url =
|
|
30
|
+
const url = toURL(opts.req.url);
|
|
30
31
|
const pathname = trimSlashes(url.pathname);
|
|
31
32
|
const endpoint = trimSlashes(opts.endpoint);
|
|
32
33
|
const path = trimSlashes(pathname.slice(endpoint.length));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../../src/adapters/standalone.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../../src/adapters/standalone.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,KAAK,EACV,8BAA8B,EAC9B,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,wBAAwB,CAAC,OAAO,SAAS,SAAS,IAC5D,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;AAE7E,MAAM,MAAM,wBAAwB,GAAG,8BAA8B,CACnE,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,cAAc,CACpB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,OAAO,SAAS,SAAS,EACzD,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,SAEpB,KAAK,eAAe,OAAO,KAAK,cAAc,mBAgBlE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,SAAS,EACxD,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,wEAIxC"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var http = require('node:http');
|
|
4
|
+
require('../unstable-core-do-not-import/rpc/codes.js');
|
|
5
|
+
var toURL = require('../unstable-core-do-not-import/http/toURL.js');
|
|
6
|
+
require('../unstable-core-do-not-import/rootConfig.js');
|
|
4
7
|
var nodeHTTPRequestHandler = require('./node-http/nodeHTTPRequestHandler.js');
|
|
5
8
|
|
|
6
9
|
function createHTTPHandler(opts) {
|
|
7
10
|
return async (req, res)=>{
|
|
8
|
-
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
+
const url = toURL.toURL(req.url);
|
|
12
|
+
// get procedure path and remove the leading slash
|
|
13
|
+
// /procedure -> procedure
|
|
14
|
+
const path = url.pathname.slice(1);
|
|
11
15
|
await nodeHTTPRequestHandler.nodeHTTPRequestHandler({
|
|
12
16
|
// FIXME: no typecasting should be needed here
|
|
13
17
|
...opts,
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import http from 'node:http';
|
|
2
|
+
import '../unstable-core-do-not-import/rpc/codes.mjs';
|
|
3
|
+
import { toURL } from '../unstable-core-do-not-import/http/toURL.mjs';
|
|
4
|
+
import '../unstable-core-do-not-import/rootConfig.mjs';
|
|
2
5
|
import { nodeHTTPRequestHandler } from './node-http/nodeHTTPRequestHandler.mjs';
|
|
3
6
|
|
|
4
7
|
function createHTTPHandler(opts) {
|
|
5
8
|
return async (req, res)=>{
|
|
6
|
-
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
+
const url = toURL(req.url);
|
|
10
|
+
// get procedure path and remove the leading slash
|
|
11
|
+
// /procedure -> procedure
|
|
12
|
+
const path = url.pathname.slice(1);
|
|
9
13
|
await nodeHTTPRequestHandler({
|
|
10
14
|
// FIXME: no typecasting should be needed here
|
|
11
15
|
...opts,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 36.
|
|
2
|
+
"bundleSize": 92119,
|
|
3
|
+
"bundleOrigSize": 145134,
|
|
4
|
+
"bundleReduction": 36.53,
|
|
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.72,
|
|
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.05,
|
|
30
30
|
"reduction": 21.53
|
|
31
31
|
},
|
|
32
32
|
{
|
|
@@ -45,13 +45,13 @@
|
|
|
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.56,
|
|
49
49
|
"reduction": 37.21
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
"id": "/src/unstable-core-do-not-import/procedureBuilder.ts",
|
|
53
53
|
"size": 5602,
|
|
54
|
-
"origSize":
|
|
54
|
+
"origSize": 11684,
|
|
55
55
|
"renderedExports": [
|
|
56
56
|
"unsetMarker",
|
|
57
57
|
"createBuilder"
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"/src/unstable-core-do-not-import.ts",
|
|
62
62
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
63
63
|
],
|
|
64
|
-
"percent": 6.
|
|
65
|
-
"reduction":
|
|
64
|
+
"percent": 6.08,
|
|
65
|
+
"reduction": 52.05
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
68
|
"id": "/src/adapters/node-http/content-type/form-data/fileUploadHandler.ts",
|
|
@@ -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.4,
|
|
81
81
|
"reduction": 36.77
|
|
82
82
|
},
|
|
83
83
|
{
|
|
@@ -105,13 +105,13 @@
|
|
|
105
105
|
"dependents": [
|
|
106
106
|
"/src/adapters/node-http/index.ts"
|
|
107
107
|
],
|
|
108
|
-
"percent": 4.
|
|
108
|
+
"percent": 4.4,
|
|
109
109
|
"reduction": 12.45
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
112
|
"id": "/src/adapters/fetch/fetchRequestHandler.ts",
|
|
113
|
-
"size":
|
|
114
|
-
"origSize":
|
|
113
|
+
"size": 3554,
|
|
114
|
+
"origSize": 3927,
|
|
115
115
|
"renderedExports": [
|
|
116
116
|
"fetchRequestHandler"
|
|
117
117
|
],
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"/src/adapters/fetch/index.ts"
|
|
121
121
|
],
|
|
122
122
|
"percent": 3.86,
|
|
123
|
-
"reduction": 9.
|
|
123
|
+
"reduction": 9.5
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
126
|
"id": "/src/observable/observable.ts",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"dependents": [
|
|
136
136
|
"/src/observable/index.ts"
|
|
137
137
|
],
|
|
138
|
-
"percent": 3.
|
|
138
|
+
"percent": 3.72,
|
|
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.59,
|
|
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.23,
|
|
174
174
|
"reduction": 0
|
|
175
175
|
},
|
|
176
176
|
{
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
"/src/adapters/fastify/index.ts",
|
|
220
220
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
221
221
|
],
|
|
222
|
-
"percent": 2.
|
|
222
|
+
"percent": 2.81,
|
|
223
223
|
"reduction": 35.33
|
|
224
224
|
},
|
|
225
225
|
{
|
|
@@ -385,7 +385,7 @@
|
|
|
385
385
|
"dependents": [
|
|
386
386
|
"/src/adapters/node-http/content-type/json/index.ts"
|
|
387
387
|
],
|
|
388
|
-
"percent": 1.
|
|
388
|
+
"percent": 1.21,
|
|
389
389
|
"reduction": 2.87
|
|
390
390
|
},
|
|
391
391
|
{
|
|
@@ -483,22 +483,9 @@
|
|
|
483
483
|
],
|
|
484
484
|
"removedExports": [],
|
|
485
485
|
"dependents": [],
|
|
486
|
-
"percent": 0.
|
|
486
|
+
"percent": 0.72,
|
|
487
487
|
"reduction": 0.6
|
|
488
488
|
},
|
|
489
|
-
{
|
|
490
|
-
"id": "/src/adapters/standalone.ts",
|
|
491
|
-
"size": 637,
|
|
492
|
-
"origSize": 1689,
|
|
493
|
-
"renderedExports": [
|
|
494
|
-
"createHTTPHandler",
|
|
495
|
-
"createHTTPServer"
|
|
496
|
-
],
|
|
497
|
-
"removedExports": [],
|
|
498
|
-
"dependents": [],
|
|
499
|
-
"percent": 0.69,
|
|
500
|
-
"reduction": 62.29
|
|
501
|
-
},
|
|
502
489
|
{
|
|
503
490
|
"id": "/src/unstable-core-do-not-import/error/getErrorShape.ts",
|
|
504
491
|
"size": 625,
|
|
@@ -514,6 +501,19 @@
|
|
|
514
501
|
"percent": 0.68,
|
|
515
502
|
"reduction": 43.49
|
|
516
503
|
},
|
|
504
|
+
{
|
|
505
|
+
"id": "/src/adapters/standalone.ts",
|
|
506
|
+
"size": 600,
|
|
507
|
+
"origSize": 1689,
|
|
508
|
+
"renderedExports": [
|
|
509
|
+
"createHTTPHandler",
|
|
510
|
+
"createHTTPServer"
|
|
511
|
+
],
|
|
512
|
+
"removedExports": [],
|
|
513
|
+
"dependents": [],
|
|
514
|
+
"percent": 0.65,
|
|
515
|
+
"reduction": 64.48
|
|
516
|
+
},
|
|
517
517
|
{
|
|
518
518
|
"id": "/src/unstable-core-do-not-import/rootConfig.ts",
|
|
519
519
|
"size": 343,
|
|
@@ -569,6 +569,18 @@
|
|
|
569
569
|
"percent": 0.24,
|
|
570
570
|
"reduction": 94.55
|
|
571
571
|
},
|
|
572
|
+
{
|
|
573
|
+
"id": "/src/unstable-core-do-not-import/http/toURL.ts",
|
|
574
|
+
"size": 158,
|
|
575
|
+
"origSize": 184,
|
|
576
|
+
"renderedExports": [
|
|
577
|
+
"toURL"
|
|
578
|
+
],
|
|
579
|
+
"removedExports": [],
|
|
580
|
+
"dependents": [],
|
|
581
|
+
"percent": 0.17,
|
|
582
|
+
"reduction": 14.13
|
|
583
|
+
},
|
|
572
584
|
{
|
|
573
585
|
"id": "/src/adapters/node-http/internals/contentType.ts",
|
|
574
586
|
"size": 116,
|
|
@@ -678,9 +690,9 @@
|
|
|
678
690
|
"reduction": 100
|
|
679
691
|
},
|
|
680
692
|
{
|
|
681
|
-
"id": "/src/adapters/
|
|
693
|
+
"id": "/src/adapters/fastify/index.ts",
|
|
682
694
|
"size": 0,
|
|
683
|
-
"origSize":
|
|
695
|
+
"origSize": 78,
|
|
684
696
|
"renderedExports": [],
|
|
685
697
|
"removedExports": [],
|
|
686
698
|
"dependents": [],
|
|
@@ -688,9 +700,9 @@
|
|
|
688
700
|
"reduction": 100
|
|
689
701
|
},
|
|
690
702
|
{
|
|
691
|
-
"id": "/src/adapters/
|
|
703
|
+
"id": "/src/adapters/fetch/index.ts",
|
|
692
704
|
"size": 0,
|
|
693
|
-
"origSize":
|
|
705
|
+
"origSize": 64,
|
|
694
706
|
"renderedExports": [],
|
|
695
707
|
"removedExports": [],
|
|
696
708
|
"dependents": [],
|
|
@@ -704,13 +716,13 @@
|
|
|
704
716
|
"renderedExports": [],
|
|
705
717
|
"removedExports": [],
|
|
706
718
|
"dependents": [
|
|
719
|
+
"/src/adapters/standalone.ts",
|
|
707
720
|
"/src/adapters/express.ts",
|
|
708
|
-
"/src/adapters/next.ts"
|
|
709
|
-
"/src/adapters/standalone.ts"
|
|
721
|
+
"/src/adapters/next.ts"
|
|
710
722
|
],
|
|
711
723
|
"percent": 0,
|
|
712
724
|
"reduction": 100
|
|
713
725
|
}
|
|
714
726
|
],
|
|
715
|
-
"moduleCount":
|
|
727
|
+
"moduleCount": 50
|
|
716
728
|
}
|
package/dist/http.js
CHANGED
|
@@ -5,6 +5,7 @@ require('./unstable-core-do-not-import/rpc/codes.js');
|
|
|
5
5
|
var resolveHTTPResponse = require('./unstable-core-do-not-import/http/resolveHTTPResponse.js');
|
|
6
6
|
var batchStreamFormatter = require('./unstable-core-do-not-import/http/batchStreamFormatter.js');
|
|
7
7
|
var contentType = require('./unstable-core-do-not-import/http/contentType.js');
|
|
8
|
+
var toURL = require('./unstable-core-do-not-import/http/toURL.js');
|
|
8
9
|
require('./unstable-core-do-not-import/rootConfig.js');
|
|
9
10
|
|
|
10
11
|
|
|
@@ -14,3 +15,4 @@ exports.getHTTPStatusCodeFromError = getHTTPStatusCode.getHTTPStatusCodeFromErro
|
|
|
14
15
|
exports.resolveHTTPResponse = resolveHTTPResponse.resolveHTTPResponse;
|
|
15
16
|
exports.getBatchStreamFormatter = batchStreamFormatter.getBatchStreamFormatter;
|
|
16
17
|
exports.getJsonContentTypeInputs = contentType.getJsonContentTypeInputs;
|
|
18
|
+
exports.toURL = toURL.toURL;
|
package/dist/http.mjs
CHANGED
|
@@ -3,4 +3,5 @@ import './unstable-core-do-not-import/rpc/codes.mjs';
|
|
|
3
3
|
export { resolveHTTPResponse } from './unstable-core-do-not-import/http/resolveHTTPResponse.mjs';
|
|
4
4
|
export { getBatchStreamFormatter } from './unstable-core-do-not-import/http/batchStreamFormatter.mjs';
|
|
5
5
|
export { getJsonContentTypeInputs } from './unstable-core-do-not-import/http/contentType.mjs';
|
|
6
|
+
export { toURL } from './unstable-core-do-not-import/http/toURL.mjs';
|
|
6
7
|
import './unstable-core-do-not-import/rootConfig.mjs';
|
|
@@ -4,4 +4,5 @@ export type { BaseHandlerOptions, HTTPBaseHandlerOptions, HTTPHeaders, HTTPReque
|
|
|
4
4
|
export { getBatchStreamFormatter } from './batchStreamFormatter';
|
|
5
5
|
export type { BaseContentTypeHandler, BodyResult } from './contentType';
|
|
6
6
|
export { getJsonContentTypeInputs } from './contentType';
|
|
7
|
+
export { toURL } from './toURL';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,kCAAkC,EAClC,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,YAAY,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,kCAAkC,EAClC,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,YAAY,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toURL.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/toURL.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAMhD"}
|
|
@@ -30,10 +30,10 @@ interface ResolverOptions<TContext, _TMeta, TContextOverridesIn, TInputOut> {
|
|
|
30
30
|
/**
|
|
31
31
|
* A procedure resolver
|
|
32
32
|
*/
|
|
33
|
-
type ProcedureResolver<TContext, _TMeta, TContextOverrides, TInputOut,
|
|
33
|
+
type ProcedureResolver<TContext, _TMeta, TContextOverrides, TInputOut, TOutputParserIn, $Output> = (opts: {
|
|
34
34
|
ctx: Simplify<Overwrite<TContext, TContextOverrides>>;
|
|
35
35
|
input: TInputOut extends UnsetMarker ? undefined : TInputOut;
|
|
36
|
-
}) => MaybePromise<DefaultValue<
|
|
36
|
+
}) => MaybePromise<DefaultValue<TOutputParserIn, $Output>>;
|
|
37
37
|
export interface ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn, TInputOut, TOutputIn, TOutputOut> {
|
|
38
38
|
/**
|
|
39
39
|
* Add an input parser to the procedure.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"procedureBuilder.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/procedureBuilder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAEnB,MAAM,cAAc,CAAC;AAOtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAKV,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,SAAS,EACV,MAAM,SAAS,CAAC;AAGjB,KAAK,kBAAkB,CAAC,KAAK,EAAE,KAAK,IAAI,KAAK,SAAS,WAAW,GAC7D,KAAK,GACL,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;AAE5B,gBAAgB;AAChB,eAAO,MAAM,WAAW,eAAwB,CAAC;AACjD,KAAK,WAAW,GAAG,OAAO,WAAW,CAAC;AACtC,KAAK,YAAY,CAAC,MAAM,EAAE,SAAS,IAAI,MAAM,SAAS,WAAW,GAC7D,SAAS,GACT,MAAM,CAAC;AAEX,KAAK,mBAAmB,CAAC,KAAK,IAAI;IAChC,SAAS,EAAE,IAAI,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,WAAW,EAAE,qBAAqB,EAAE,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,sBAAsB,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;AAEvD;;;GAGG;AACH,UAAU,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,mBAAmB,EAAE,SAAS;IACxE,GAAG,EAAE,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACxD,KAAK,EAAE,SAAS,SAAS,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;CAC9D;AAED;;GAEG;AACH,KAAK,iBAAiB,CACpB,QAAQ,EACR,MAAM,EACN,iBAAiB,EACjB,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"procedureBuilder.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/procedureBuilder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAEnB,MAAM,cAAc,CAAC;AAOtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAKV,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,SAA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,EAAE,iBAAiB,CACzB,QAAQ,EACR,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,OAAO,CACR,GACA,qBAAqB,CAAC;QACvB,KAAK,EAAE,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACpC,MAAM,EAAE,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;KAC3C,CAAC,CAAC;IACH;;OAEG;IACH,IAAI,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;CAClC;AAGD,KAAK,wBAAwB,GAAG,CAC9B,IAAI,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,KACtC,OAAO,CAAC,OAAO,CAAC,CAAC;AAiBtB,wBAAgB,aAAa,CAAC,QAAQ,EAAE,KAAK,EAC3C,OAAO,GAAE,OAAO,CAAC,sBAAsB,CAAM,GAC5C,gBAAgB,CACjB,QAAQ,EACR,KAAK,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,CACZ,CAuEA;AAwBD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,OAAO,CAAC;IACb,WAAW,EAAE,aAAa,CAAC;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,CAAC;CACrB"}
|
|
@@ -8,6 +8,7 @@ var getHTTPStatusCode = require('./unstable-core-do-not-import/http/getHTTPStatu
|
|
|
8
8
|
var resolveHTTPResponse = require('./unstable-core-do-not-import/http/resolveHTTPResponse.js');
|
|
9
9
|
var batchStreamFormatter = require('./unstable-core-do-not-import/http/batchStreamFormatter.js');
|
|
10
10
|
var contentType = require('./unstable-core-do-not-import/http/contentType.js');
|
|
11
|
+
var toURL = require('./unstable-core-do-not-import/http/toURL.js');
|
|
11
12
|
var initTRPC = require('./unstable-core-do-not-import/initTRPC.js');
|
|
12
13
|
var middleware = require('./unstable-core-do-not-import/middleware.js');
|
|
13
14
|
var parser = require('./unstable-core-do-not-import/parser.js');
|
|
@@ -35,6 +36,7 @@ exports.getHTTPStatusCodeFromError = getHTTPStatusCode.getHTTPStatusCodeFromErro
|
|
|
35
36
|
exports.resolveHTTPResponse = resolveHTTPResponse.resolveHTTPResponse;
|
|
36
37
|
exports.getBatchStreamFormatter = batchStreamFormatter.getBatchStreamFormatter;
|
|
37
38
|
exports.getJsonContentTypeInputs = contentType.getJsonContentTypeInputs;
|
|
39
|
+
exports.toURL = toURL.toURL;
|
|
38
40
|
exports.initTRPC = initTRPC.initTRPC;
|
|
39
41
|
exports.createInputMiddleware = middleware.createInputMiddleware;
|
|
40
42
|
exports.createMiddlewareFactory = middleware.createMiddlewareFactory;
|
|
@@ -6,6 +6,7 @@ export { getHTTPStatusCode, getHTTPStatusCodeFromError } from './unstable-core-d
|
|
|
6
6
|
export { resolveHTTPResponse } from './unstable-core-do-not-import/http/resolveHTTPResponse.mjs';
|
|
7
7
|
export { getBatchStreamFormatter } from './unstable-core-do-not-import/http/batchStreamFormatter.mjs';
|
|
8
8
|
export { getJsonContentTypeInputs } from './unstable-core-do-not-import/http/contentType.mjs';
|
|
9
|
+
export { toURL } from './unstable-core-do-not-import/http/toURL.mjs';
|
|
9
10
|
export { initTRPC } from './unstable-core-do-not-import/initTRPC.mjs';
|
|
10
11
|
export { createInputMiddleware, createMiddlewareFactory, createOutputMiddleware, experimental_standaloneMiddleware, middlewareMarker } from './unstable-core-do-not-import/middleware.mjs';
|
|
11
12
|
export { getParseFn } from './unstable-core-do-not-import/parser.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.264+f5f08f35d",
|
|
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": "f5f08f35d0fce8eba59e4db2daed36b184f737a4"
|
|
161
161
|
}
|
package/src/@trpc/server/http.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* ```
|
|
9
9
|
*/
|
|
10
10
|
// @trpc/server
|
|
11
|
+
|
|
11
12
|
import type { AnyRouter } from '../../@trpc/server';
|
|
12
13
|
import type {
|
|
13
14
|
HTTPRequest,
|
|
@@ -18,6 +19,7 @@ import type {
|
|
|
18
19
|
import {
|
|
19
20
|
getBatchStreamFormatter,
|
|
20
21
|
resolveHTTPResponse,
|
|
22
|
+
toURL,
|
|
21
23
|
} from '../../@trpc/server/http';
|
|
22
24
|
import type { FetchHandlerOptions } from './types';
|
|
23
25
|
|
|
@@ -45,7 +47,7 @@ export async function fetchRequestHandler<TRouter extends AnyRouter>(
|
|
|
45
47
|
return opts.createContext?.({ req: opts.req, resHeaders, ...innerOpts });
|
|
46
48
|
};
|
|
47
49
|
|
|
48
|
-
const url =
|
|
50
|
+
const url = toURL(opts.req.url);
|
|
49
51
|
|
|
50
52
|
const pathname = trimSlashes(url.pathname);
|
|
51
53
|
const endpoint = trimSlashes(opts.endpoint);
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import http from 'http';
|
|
12
12
|
// @trpc/server
|
|
13
13
|
import type { AnyRouter } from '../@trpc/server';
|
|
14
|
+
import { toURL } from '../@trpc/server/http';
|
|
14
15
|
import type {
|
|
15
16
|
NodeHTTPCreateContextFnOptions,
|
|
16
17
|
NodeHTTPHandlerOptions,
|
|
@@ -29,9 +30,11 @@ export function createHTTPHandler<TRouter extends AnyRouter>(
|
|
|
29
30
|
opts: CreateHTTPHandlerOptions<TRouter>,
|
|
30
31
|
) {
|
|
31
32
|
return async (req: http.IncomingMessage, res: http.ServerResponse) => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const url = toURL(req.url!);
|
|
34
|
+
|
|
35
|
+
// get procedure path and remove the leading slash
|
|
36
|
+
// /procedure -> procedure
|
|
37
|
+
const path = url.pathname.slice(1);
|
|
35
38
|
|
|
36
39
|
await nodeHTTPRequestHandler({
|
|
37
40
|
// FIXME: no typecasting should be needed here
|
|
@@ -73,12 +73,15 @@ type ProcedureResolver<
|
|
|
73
73
|
_TMeta,
|
|
74
74
|
TContextOverrides,
|
|
75
75
|
TInputOut,
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
TOutputParserIn,
|
|
77
|
+
$Output,
|
|
78
78
|
> = (opts: {
|
|
79
79
|
ctx: Simplify<Overwrite<TContext, TContextOverrides>>;
|
|
80
80
|
input: TInputOut extends UnsetMarker ? undefined : TInputOut;
|
|
81
|
-
}) => MaybePromise<
|
|
81
|
+
}) => MaybePromise<
|
|
82
|
+
// If an output parser is defined, we need to return what the parser expects, otherwise we return the inferred type
|
|
83
|
+
DefaultValue<TOutputParserIn, $Output>
|
|
84
|
+
>;
|
|
82
85
|
|
|
83
86
|
type AnyResolver = ProcedureResolver<any, any, any, any, any, any>;
|
|
84
87
|
export interface ProcedureBuilder<
|