@trpc/server 11.0.0-rc.521 → 11.0.0-rc.524
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/next-app-dir/nextAppDirCaller.d.ts.map +1 -1
- package/dist/adapters/next-app-dir/nextAppDirCaller.js +4 -2
- package/dist/adapters/next-app-dir/nextAppDirCaller.mjs +4 -2
- package/dist/adapters/ws.d.ts.map +1 -1
- package/dist/adapters/ws.js +3 -2
- package/dist/adapters/ws.mjs +3 -2
- package/dist/bundle-analysis.json +60 -60
- package/dist/unstable-core-do-not-import/http/resolveResponse.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/http/resolveResponse.js +2 -1
- package/dist/unstable-core-do-not-import/http/resolveResponse.mjs +2 -1
- package/dist/unstable-core-do-not-import/middleware.d.ts +1 -0
- package/dist/unstable-core-do-not-import/middleware.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/procedure.d.ts +8 -2
- package/dist/unstable-core-do-not-import/procedure.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts +14 -5
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/procedureBuilder.js +32 -38
- package/dist/unstable-core-do-not-import/procedureBuilder.mjs +32 -38
- package/dist/unstable-core-do-not-import/router.d.ts +3 -2
- package/dist/unstable-core-do-not-import/router.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/router.js +4 -3
- package/dist/unstable-core-do-not-import/router.mjs +4 -3
- package/package.json +2 -2
- package/src/adapters/next-app-dir/nextAppDirCaller.ts +2 -0
- package/src/adapters/ws.ts +2 -1
- package/src/unstable-core-do-not-import/http/resolveResponse.ts +1 -0
- package/src/unstable-core-do-not-import/middleware.ts +1 -0
- package/src/unstable-core-do-not-import/procedure.ts +17 -2
- package/src/unstable-core-do-not-import/procedureBuilder.ts +60 -68
- package/src/unstable-core-do-not-import/router.ts +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextAppDirCaller.d.ts","sourceRoot":"","sources":["../../../src/adapters/next-app-dir/nextAppDirCaller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAMhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAGvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AAGzF,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACT,MAAM,yCAAyC,CAAC;AAIjD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAC9C,MAAM,EAAE,QAAQ,CACd;IACE;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE,KAAK,MAAM,CAAC;IAClD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;CACzD,GAAG,qBAAqB,CAAC,QAAQ,EAAE,MAAM,YAAY,CAAC,QAAQ,CAAC,CAAC,CAClE,GACA,cAAc,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"nextAppDirCaller.d.ts","sourceRoot":"","sources":["../../../src/adapters/next-app-dir/nextAppDirCaller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAMhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAGvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AAGzF,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACT,MAAM,yCAAyC,CAAC;AAIjD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAC9C,MAAM,EAAE,QAAQ,CACd;IACE;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE,KAAK,MAAM,CAAC;IAClD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;CACzD,GAAG,qBAAqB,CAAC,QAAQ,EAAE,MAAM,YAAY,CAAC,QAAQ,CAAC,CAAC,CAClE,GACA,cAAc,CAAC,QAAQ,CAAC,CA2F1B"}
|
|
@@ -54,7 +54,8 @@ var rethrowNextErrors = require('./rethrowNextErrors.js');
|
|
|
54
54
|
ctx,
|
|
55
55
|
getRawInput: async ()=>input,
|
|
56
56
|
path,
|
|
57
|
-
input
|
|
57
|
+
input,
|
|
58
|
+
signal: undefined
|
|
58
59
|
}).then((data)=>{
|
|
59
60
|
if (data instanceof redirect.TRPCRedirectError) throw data;
|
|
60
61
|
return data;
|
|
@@ -68,7 +69,8 @@ var rethrowNextErrors = require('./rethrowNextErrors.js');
|
|
|
68
69
|
ctx,
|
|
69
70
|
getRawInput: async ()=>input1,
|
|
70
71
|
path,
|
|
71
|
-
input: input1
|
|
72
|
+
input: input1,
|
|
73
|
+
signal: undefined
|
|
72
74
|
}).then((data)=>{
|
|
73
75
|
if (data instanceof redirect.TRPCRedirectError) throw data;
|
|
74
76
|
return data;
|
|
@@ -52,7 +52,8 @@ import { rethrowNextErrors } from './rethrowNextErrors.mjs';
|
|
|
52
52
|
ctx,
|
|
53
53
|
getRawInput: async ()=>input,
|
|
54
54
|
path,
|
|
55
|
-
input
|
|
55
|
+
input,
|
|
56
|
+
signal: undefined
|
|
56
57
|
}).then((data)=>{
|
|
57
58
|
if (data instanceof TRPCRedirectError) throw data;
|
|
58
59
|
return data;
|
|
@@ -66,7 +67,8 @@ import { rethrowNextErrors } from './rethrowNextErrors.mjs';
|
|
|
66
67
|
ctx,
|
|
67
68
|
getRawInput: async ()=>input1,
|
|
68
69
|
path,
|
|
69
|
-
input: input1
|
|
70
|
+
input: input1,
|
|
71
|
+
signal: undefined
|
|
70
72
|
}).then((data)=>{
|
|
71
73
|
if (data instanceof TRPCRedirectError) throw data;
|
|
72
74
|
return data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src/adapters/ws.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AASzB,OAAO,EAAS,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AActE,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAQlE;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,8BAA8B,CACpE,eAAe,EACf,EAAE,CAAC,SAAS,CACb,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,OAAO,SAAS,SAAS,IAAI,CAC1D,IAAI,EAAE,yBAAyB,KAC5B,YAAY,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;AAE/C,MAAM,MAAM,0BAA0B,CAAC,OAAO,SAAS,SAAS,IAC9D,kBAAkB,CAAC,OAAO,EAAE,eAAe,CAAC,GAC1C,qBAAqB,CACnB,kBAAkB,CAAC,OAAO,CAAC,EAC3B,kBAAkB,CAAC,OAAO,CAAC,CAC5B,CAAC;AAEN;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,OAAO,SAAS,SAAS,IACrD,0BAA0B,CAAC,OAAO,CAAC,GAAG;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C3B,kBAAkB,CAAC,OAAO,CAAC,CAC5B,CAAC;AAEN;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,OAAO,SAAS,SAAS,IACrD,0BAA0B,CAAC,OAAO,CAAC,GAAG;IACpC,GAAG,EAAE,EAAE,CAAC,eAAe,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE;QACV;;;WAGG;QACH,OAAO,EAAE,OAAO,CAAC;QACjB;;;WAGG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;;WAGG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH,CAAC;AAGJ,wBAAgB,sBAAsB,CAAC,OAAO,SAAS,SAAS,EAC9D,IAAI,EAAE,0BAA0B,CAAC,OAAO,CAAC,YAKnB,EAAE,CAAC,SAAS,OAAO,eAAe,mBAwWzD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,EAAE,CAAC,SAAS,EACpB,MAAM,SAAQ,EACd,UAAU,SAAO,QAuBlB;AAED,wBAAgB,eAAe,CAAC,OAAO,SAAS,SAAS,EACvD,IAAI,EAAE,iBAAiB,CAAC,OAAO,CAAC;;EA+BjC"}
|
package/dist/adapters/ws.js
CHANGED
|
@@ -105,12 +105,14 @@ function getWSConnectionHandler(opts) {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
await ctxPromise; // asserts context has been set
|
|
108
|
+
const abortController = new AbortController();
|
|
108
109
|
const result = await router.callProcedure({
|
|
109
110
|
procedures: router$1._def.procedures,
|
|
110
111
|
path,
|
|
111
112
|
getRawInput: async ()=>input,
|
|
112
113
|
ctx,
|
|
113
|
-
type
|
|
114
|
+
type,
|
|
115
|
+
signal: abortController.signal
|
|
114
116
|
});
|
|
115
117
|
const isIterableResult = utils.isAsyncIterable(result) || observable.isObservable(result);
|
|
116
118
|
if (type !== 'subscription') {
|
|
@@ -151,7 +153,6 @@ function getWSConnectionHandler(opts) {
|
|
|
151
153
|
}
|
|
152
154
|
const iterable = observable.isObservable(result) ? observable.observableToAsyncIterable(result) : result;
|
|
153
155
|
const iterator = iterable[Symbol.asyncIterator]();
|
|
154
|
-
const abortController = new AbortController();
|
|
155
156
|
const abortPromise = new Promise((resolve)=>{
|
|
156
157
|
abortController.signal.onabort = ()=>resolve('abort');
|
|
157
158
|
});
|
package/dist/adapters/ws.mjs
CHANGED
|
@@ -103,12 +103,14 @@ function getWSConnectionHandler(opts) {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
await ctxPromise; // asserts context has been set
|
|
106
|
+
const abortController = new AbortController();
|
|
106
107
|
const result = await callProcedure({
|
|
107
108
|
procedures: router._def.procedures,
|
|
108
109
|
path,
|
|
109
110
|
getRawInput: async ()=>input,
|
|
110
111
|
ctx,
|
|
111
|
-
type
|
|
112
|
+
type,
|
|
113
|
+
signal: abortController.signal
|
|
112
114
|
});
|
|
113
115
|
const isIterableResult = isAsyncIterable(result) || isObservable(result);
|
|
114
116
|
if (type !== 'subscription') {
|
|
@@ -149,7 +151,6 @@ function getWSConnectionHandler(opts) {
|
|
|
149
151
|
}
|
|
150
152
|
const iterable = isObservable(result) ? observableToAsyncIterable(result) : result;
|
|
151
153
|
const iterator = iterable[Symbol.asyncIterator]();
|
|
152
|
-
const abortController = new AbortController();
|
|
153
154
|
const abortPromise = new Promise((resolve)=>{
|
|
154
155
|
abortController.signal.onabort = ()=>resolve('abort');
|
|
155
156
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 26.
|
|
2
|
+
"bundleSize": 135647,
|
|
3
|
+
"bundleOrigSize": 185375,
|
|
4
|
+
"bundleReduction": 26.83,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
8
|
-
"size":
|
|
9
|
-
"origSize":
|
|
8
|
+
"size": 17911,
|
|
9
|
+
"origSize": 16766,
|
|
10
10
|
"renderedExports": [
|
|
11
11
|
"resolveResponse"
|
|
12
12
|
],
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependents": [
|
|
15
15
|
"/src/unstable-core-do-not-import.ts"
|
|
16
16
|
],
|
|
17
|
-
"percent": 13.
|
|
17
|
+
"percent": 13.2,
|
|
18
18
|
"reduction": 0
|
|
19
19
|
},
|
|
20
20
|
{
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"/src/unstable-core-do-not-import.ts",
|
|
32
32
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
33
33
|
],
|
|
34
|
-
"percent": 12.
|
|
34
|
+
"percent": 12.95,
|
|
35
35
|
"reduction": 4.31
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
"id": "/src/adapters/ws.ts",
|
|
39
|
-
"size":
|
|
40
|
-
"origSize":
|
|
39
|
+
"size": 15782,
|
|
40
|
+
"origSize": 14714,
|
|
41
41
|
"renderedExports": [
|
|
42
42
|
"getWSConnectionHandler",
|
|
43
43
|
"handleKeepAlive",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependents": [
|
|
48
48
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
49
49
|
],
|
|
50
|
-
"percent": 11.
|
|
50
|
+
"percent": 11.63,
|
|
51
51
|
"reduction": 0
|
|
52
52
|
},
|
|
53
53
|
{
|
|
@@ -62,13 +62,13 @@
|
|
|
62
62
|
"/src/unstable-core-do-not-import.ts",
|
|
63
63
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
64
64
|
],
|
|
65
|
-
"percent": 5.
|
|
65
|
+
"percent": 5.67,
|
|
66
66
|
"reduction": 0
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
"id": "/src/unstable-core-do-not-import/router.ts",
|
|
70
|
-
"size":
|
|
71
|
-
"origSize":
|
|
70
|
+
"size": 6421,
|
|
71
|
+
"origSize": 10734,
|
|
72
72
|
"renderedExports": [
|
|
73
73
|
"createRouterFactory",
|
|
74
74
|
"callProcedure",
|
|
@@ -80,23 +80,8 @@
|
|
|
80
80
|
"/src/unstable-core-do-not-import.ts",
|
|
81
81
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
82
82
|
],
|
|
83
|
-
"percent": 4.
|
|
84
|
-
"reduction":
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"id": "/src/unstable-core-do-not-import/procedureBuilder.ts",
|
|
88
|
-
"size": 6326,
|
|
89
|
-
"origSize": 15849,
|
|
90
|
-
"renderedExports": [
|
|
91
|
-
"createBuilder"
|
|
92
|
-
],
|
|
93
|
-
"removedExports": [],
|
|
94
|
-
"dependents": [
|
|
95
|
-
"/src/unstable-core-do-not-import.ts",
|
|
96
|
-
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
97
|
-
],
|
|
98
|
-
"percent": 4.65,
|
|
99
|
-
"reduction": 60.09
|
|
83
|
+
"percent": 4.73,
|
|
84
|
+
"reduction": 40.18
|
|
100
85
|
},
|
|
101
86
|
{
|
|
102
87
|
"id": "/src/unstable-core-do-not-import/stream/sse.ts",
|
|
@@ -112,9 +97,24 @@
|
|
|
112
97
|
"/src/unstable-core-do-not-import.ts",
|
|
113
98
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
114
99
|
],
|
|
115
|
-
"percent": 4.
|
|
100
|
+
"percent": 4.36,
|
|
116
101
|
"reduction": 15.22
|
|
117
102
|
},
|
|
103
|
+
{
|
|
104
|
+
"id": "/src/unstable-core-do-not-import/procedureBuilder.ts",
|
|
105
|
+
"size": 5795,
|
|
106
|
+
"origSize": 15683,
|
|
107
|
+
"renderedExports": [
|
|
108
|
+
"createBuilder"
|
|
109
|
+
],
|
|
110
|
+
"removedExports": [],
|
|
111
|
+
"dependents": [
|
|
112
|
+
"/src/unstable-core-do-not-import.ts",
|
|
113
|
+
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
114
|
+
],
|
|
115
|
+
"percent": 4.27,
|
|
116
|
+
"reduction": 63.05
|
|
117
|
+
},
|
|
118
118
|
{
|
|
119
119
|
"id": "/src/adapters/aws-lambda/getPlanner.ts",
|
|
120
120
|
"size": 5418,
|
|
@@ -151,8 +151,8 @@
|
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
153
|
"id": "/src/adapters/next-app-dir/nextAppDirCaller.ts",
|
|
154
|
-
"size":
|
|
155
|
-
"origSize":
|
|
154
|
+
"size": 3221,
|
|
155
|
+
"origSize": 4160,
|
|
156
156
|
"renderedExports": [
|
|
157
157
|
"nextAppDirCaller"
|
|
158
158
|
],
|
|
@@ -160,8 +160,8 @@
|
|
|
160
160
|
"dependents": [
|
|
161
161
|
"/src/adapters/next-app-dir.ts"
|
|
162
162
|
],
|
|
163
|
-
"percent": 2.
|
|
164
|
-
"reduction":
|
|
163
|
+
"percent": 2.37,
|
|
164
|
+
"reduction": 22.57
|
|
165
165
|
},
|
|
166
166
|
{
|
|
167
167
|
"id": "/src/adapters/node-http/nodeHTTPRequestHandler.ts",
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
{
|
|
231
231
|
"id": "/src/unstable-core-do-not-import/middleware.ts",
|
|
232
232
|
"size": 2627,
|
|
233
|
-
"origSize":
|
|
233
|
+
"origSize": 5940,
|
|
234
234
|
"renderedExports": [
|
|
235
235
|
"middlewareMarker",
|
|
236
236
|
"createMiddlewareFactory",
|
|
@@ -244,8 +244,8 @@
|
|
|
244
244
|
"/src/unstable-core-do-not-import/initTRPC.ts",
|
|
245
245
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
246
246
|
],
|
|
247
|
-
"percent": 1.
|
|
248
|
-
"reduction": 55.
|
|
247
|
+
"percent": 1.94,
|
|
248
|
+
"reduction": 55.77
|
|
249
249
|
},
|
|
250
250
|
{
|
|
251
251
|
"id": "/src/unstable-core-do-not-import/createProxy.ts",
|
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
"/src/unstable-core-do-not-import.ts",
|
|
261
261
|
"/src/unstable-core-do-not-import/router.ts"
|
|
262
262
|
],
|
|
263
|
-
"percent": 1.
|
|
263
|
+
"percent": 1.72,
|
|
264
264
|
"reduction": 0
|
|
265
265
|
},
|
|
266
266
|
{
|
|
@@ -289,7 +289,7 @@
|
|
|
289
289
|
"/src/adapters/node-http/index.ts",
|
|
290
290
|
"/src/adapters/node-http/nodeHTTPRequestHandler.ts"
|
|
291
291
|
],
|
|
292
|
-
"percent": 1.
|
|
292
|
+
"percent": 1.62,
|
|
293
293
|
"reduction": 13.79
|
|
294
294
|
},
|
|
295
295
|
{
|
|
@@ -341,7 +341,7 @@
|
|
|
341
341
|
"/src/unstable-core-do-not-import/stream/jsonl.ts",
|
|
342
342
|
"/src/unstable-core-do-not-import/stream/sse.ts"
|
|
343
343
|
],
|
|
344
|
-
"percent": 1.
|
|
344
|
+
"percent": 1.28,
|
|
345
345
|
"reduction": 19.47
|
|
346
346
|
},
|
|
347
347
|
{
|
|
@@ -366,7 +366,7 @@
|
|
|
366
366
|
],
|
|
367
367
|
"removedExports": [],
|
|
368
368
|
"dependents": [],
|
|
369
|
-
"percent": 1.
|
|
369
|
+
"percent": 1.19,
|
|
370
370
|
"reduction": 27.47
|
|
371
371
|
},
|
|
372
372
|
{
|
|
@@ -378,7 +378,7 @@
|
|
|
378
378
|
],
|
|
379
379
|
"removedExports": [],
|
|
380
380
|
"dependents": [],
|
|
381
|
-
"percent": 1.
|
|
381
|
+
"percent": 1.14,
|
|
382
382
|
"reduction": 26.94
|
|
383
383
|
},
|
|
384
384
|
{
|
|
@@ -410,7 +410,7 @@
|
|
|
410
410
|
"/src/unstable-core-do-not-import.ts",
|
|
411
411
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
412
412
|
],
|
|
413
|
-
"percent": 0.
|
|
413
|
+
"percent": 0.96,
|
|
414
414
|
"reduction": 55.21
|
|
415
415
|
},
|
|
416
416
|
{
|
|
@@ -698,7 +698,7 @@
|
|
|
698
698
|
{
|
|
699
699
|
"id": "/src/unstable-core-do-not-import/procedure.ts",
|
|
700
700
|
"size": 75,
|
|
701
|
-
"origSize":
|
|
701
|
+
"origSize": 2668,
|
|
702
702
|
"renderedExports": [
|
|
703
703
|
"procedureTypes"
|
|
704
704
|
],
|
|
@@ -708,7 +708,7 @@
|
|
|
708
708
|
"/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts"
|
|
709
709
|
],
|
|
710
710
|
"percent": 0.06,
|
|
711
|
-
"reduction":
|
|
711
|
+
"reduction": 97.19
|
|
712
712
|
},
|
|
713
713
|
{
|
|
714
714
|
"id": "/src/unstable-core-do-not-import/error/formatter.ts",
|
|
@@ -749,9 +749,9 @@
|
|
|
749
749
|
"reduction": 100
|
|
750
750
|
},
|
|
751
751
|
{
|
|
752
|
-
"id": "/src/
|
|
752
|
+
"id": "/src/shared.ts",
|
|
753
753
|
"size": 0,
|
|
754
|
-
"origSize":
|
|
754
|
+
"origSize": 653,
|
|
755
755
|
"renderedExports": [],
|
|
756
756
|
"removedExports": [],
|
|
757
757
|
"dependents": [],
|
|
@@ -759,9 +759,9 @@
|
|
|
759
759
|
"reduction": 100
|
|
760
760
|
},
|
|
761
761
|
{
|
|
762
|
-
"id": "/src/
|
|
762
|
+
"id": "/src/rpc.ts",
|
|
763
763
|
"size": 0,
|
|
764
|
-
"origSize":
|
|
764
|
+
"origSize": 36,
|
|
765
765
|
"renderedExports": [],
|
|
766
766
|
"removedExports": [],
|
|
767
767
|
"dependents": [],
|
|
@@ -803,6 +803,16 @@
|
|
|
803
803
|
"percent": 0,
|
|
804
804
|
"reduction": 100
|
|
805
805
|
},
|
|
806
|
+
{
|
|
807
|
+
"id": "/src/adapters/fetch/index.ts",
|
|
808
|
+
"size": 0,
|
|
809
|
+
"origSize": 64,
|
|
810
|
+
"renderedExports": [],
|
|
811
|
+
"removedExports": [],
|
|
812
|
+
"dependents": [],
|
|
813
|
+
"percent": 0,
|
|
814
|
+
"reduction": 100
|
|
815
|
+
},
|
|
806
816
|
{
|
|
807
817
|
"id": "/src/adapters/fastify/index.ts",
|
|
808
818
|
"size": 0,
|
|
@@ -827,16 +837,6 @@
|
|
|
827
837
|
],
|
|
828
838
|
"percent": 0,
|
|
829
839
|
"reduction": 100
|
|
830
|
-
},
|
|
831
|
-
{
|
|
832
|
-
"id": "/src/adapters/fetch/index.ts",
|
|
833
|
-
"size": 0,
|
|
834
|
-
"origSize": 64,
|
|
835
|
-
"renderedExports": [],
|
|
836
|
-
"removedExports": [],
|
|
837
|
-
"dependents": [],
|
|
838
|
-
"percent": 0,
|
|
839
|
-
"reduction": 100
|
|
840
840
|
}
|
|
841
841
|
],
|
|
842
842
|
"moduleCount": 56
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveResponse.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/resolveResponse.ts"],"names":[],"mappings":"AAMA,OAAO,EAA2B,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EACL,KAAK,SAAS,EAGf,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EACV,sBAAsB,EACtB,kCAAkC,EAEnC,MAAM,SAAS,CAAC;AA0BjB,UAAU,yBAAyB,CAAC,OAAO,SAAS,SAAS,CAC3D,SAAQ,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC;IAChD,aAAa,EAAE,kCAAkC,CAAC,OAAO,CAAC,CAAC;IAC3D,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CACzB;AAyID,wBAAsB,eAAe,CAAC,OAAO,SAAS,SAAS,EAC7D,IAAI,EAAE,yBAAyB,CAAC,OAAO,CAAC,GACvC,OAAO,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"resolveResponse.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/resolveResponse.ts"],"names":[],"mappings":"AAMA,OAAO,EAA2B,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EACL,KAAK,SAAS,EAGf,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EACV,sBAAsB,EACtB,kCAAkC,EAEnC,MAAM,SAAS,CAAC;AA0BjB,UAAU,yBAAyB,CAAC,OAAO,SAAS,SAAS,CAC3D,SAAQ,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC;IAChD,aAAa,EAAE,kCAAkC,CAAC,OAAO,CAAC,CAAC;IAC3D,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CACzB;AAyID,wBAAsB,eAAe,CAAC,OAAO,SAAS,SAAS,EAC7D,IAAI,EAAE,yBAAyB,CAAC,OAAO,CAAC,GACvC,OAAO,CAAC,QAAQ,CAAC,CAkanB"}
|
|
@@ -50,6 +50,7 @@ export type MiddlewareFunction<TContext, TMeta, TContextOverridesIn, $ContextOve
|
|
|
50
50
|
input: TInputOut;
|
|
51
51
|
getRawInput: GetRawInputFn;
|
|
52
52
|
meta: TMeta | undefined;
|
|
53
|
+
signal: AbortSignal | undefined;
|
|
53
54
|
next: {
|
|
54
55
|
(): Promise<MiddlewareResult<TContextOverridesIn>>;
|
|
55
56
|
<$ContextOverride>(opts: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ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KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;aAzByB,iBAAiB;aA4BrB,MAAM,CAAgB,SAAN,MAAM;;cACrB,MAAM,GAAgB,SAAN,MAAM;;eACrB,MAAM,GAAC;;aAFT,MAAM,CAAgB,SAAN,MAAM;;cACrB,MAAM,GAAgB,SAAN,MAAM;;eACrB,MAAM,GAAC;;CAE/B,CAAC;AAEH;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,yBA4BnE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,yBAwBtE"}
|
|
@@ -54,10 +54,16 @@ export interface MutationProcedure<TDef extends BuiltProcedureDef> extends Proce
|
|
|
54
54
|
}
|
|
55
55
|
export interface SubscriptionProcedure<TDef extends BuiltProcedureDef> extends Procedure<'subscription', TDef> {
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated
|
|
59
|
+
*/
|
|
60
|
+
export interface LegacyObservableSubscriptionProcedure<TDef extends BuiltProcedureDef> extends SubscriptionProcedure<TDef> {
|
|
61
|
+
_observable: true;
|
|
62
|
+
}
|
|
57
63
|
export type AnyQueryProcedure = QueryProcedure<any>;
|
|
58
64
|
export type AnyMutationProcedure = MutationProcedure<any>;
|
|
59
|
-
export type AnySubscriptionProcedure = SubscriptionProcedure<any>;
|
|
60
|
-
export type AnyProcedure =
|
|
65
|
+
export type AnySubscriptionProcedure = SubscriptionProcedure<any> | LegacyObservableSubscriptionProcedure<any>;
|
|
66
|
+
export type AnyProcedure = AnyQueryProcedure | AnyMutationProcedure | AnySubscriptionProcedure;
|
|
61
67
|
export type inferProcedureInput<TProcedure extends AnyProcedure> = undefined extends inferProcedureParams<TProcedure>['$types']['input'] ? void | inferProcedureParams<TProcedure>['$types']['input'] : inferProcedureParams<TProcedure>['$types']['input'];
|
|
62
68
|
export type inferProcedureParams<TProcedure> = TProcedure extends AnyProcedure ? TProcedure['_def'] : never;
|
|
63
69
|
export type inferProcedureOutput<TProcedure> = inferProcedureParams<TProcedure>['$types']['output'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"procedure.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/procedure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,eAAO,MAAM,cAAc,gDAAiD,CAAC;AAC7E;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS,CACxB,KAAK,SAAS,aAAa,EAC3B,IAAI,SAAS,iBAAiB;IAE9B,IAAI,EAAE;QACJ;;;WAGG;QACH,MAAM,EAAE;YACN,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YACrB,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;SACxB,CAAC;QACF,SAAS,EAAE,IAAI,CAAC;QAChB,IAAI,EAAE,KAAK,CAAC;QACZ;;;WAGG;QACH,IAAI,EAAE,OAAO,CAAC;QACd,mBAAmB,EAAE,OAAO,CAAC;KAC9B,CAAC;IACF;;OAEG;IACH,CAAC,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CA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AS,YAAY,IAC7D,SAAS,SAAS,oBAAoB,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,GACjE,IAAI,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,GAC1D,oBAAoB,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC;AAE1D,MAAM,MAAM,oBAAoB,CAAC,UAAU,IAAI,UAAU,SAAS,YAAY,GAC1E,UAAU,CAAC,MAAM,CAAC,GAClB,KAAK,CAAC;AACV,MAAM,MAAM,oBAAoB,CAAC,UAAU,IACzC,oBAAoB,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,QAAQ;IAC3C,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,aAAa,GAAG,SAAS,CAAC;IAChC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC3B"}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import type { inferObservableValue } from '../observable';
|
|
2
2
|
import type { AnyMiddlewareFunction, MiddlewareBuilder, MiddlewareFunction } from './middleware';
|
|
3
3
|
import type { inferParser, Parser } from './parser';
|
|
4
|
-
import type { AnyProcedure, MutationProcedure, ProcedureType, QueryProcedure, SubscriptionProcedure } from './procedure';
|
|
4
|
+
import type { AnyProcedure, LegacyObservableSubscriptionProcedure, MutationProcedure, ProcedureType, QueryProcedure, SubscriptionProcedure } from './procedure';
|
|
5
5
|
import type { inferTrackedOutput } from './stream/tracked';
|
|
6
6
|
import type { GetRawInputFn, MaybePromise, Overwrite, Simplify, TypeError } from './types';
|
|
7
7
|
import type { UnsetMarker } from './utils';
|
|
8
8
|
type IntersectIfDefined<TType, TWith> = TType extends UnsetMarker ? TWith : TWith extends UnsetMarker ? TType : Simplify<TType & TWith>;
|
|
9
9
|
type DefaultValue<TValue, TFallback> = TValue extends UnsetMarker ? TFallback : TValue;
|
|
10
10
|
type inferSubscriptionOutput<TOutput> = TOutput extends AsyncIterable<infer $Output> ? inferTrackedOutput<$Output> : inferObservableValue<TOutput>;
|
|
11
|
+
type inferSubscriptionProcedure<TInputIn, TOutputOut, $Output> = $Output extends AsyncIterable<any> ? SubscriptionProcedure<{
|
|
12
|
+
input: DefaultValue<TInputIn, void>;
|
|
13
|
+
output: DefaultValue<TOutputOut, inferSubscriptionOutput<$Output>>;
|
|
14
|
+
}> : LegacyObservableSubscriptionProcedure<{
|
|
15
|
+
input: DefaultValue<TInputIn, void>;
|
|
16
|
+
output: DefaultValue<TOutputOut, inferSubscriptionOutput<$Output>>;
|
|
17
|
+
}>;
|
|
11
18
|
export type CallerOverride<TContext> = (opts: {
|
|
12
19
|
args: unknown[];
|
|
13
20
|
invoke: (opts: ProcedureCallOptions<TContext>) => Promise<unknown>;
|
|
@@ -43,6 +50,10 @@ type AnyProcedureBuilderDef = ProcedureBuilderDef<any>;
|
|
|
43
50
|
export interface ProcedureResolverOptions<TContext, _TMeta, TContextOverridesIn, TInputOut> {
|
|
44
51
|
ctx: Simplify<Overwrite<TContext, TContextOverridesIn>>;
|
|
45
52
|
input: TInputOut extends UnsetMarker ? undefined : TInputOut;
|
|
53
|
+
/**
|
|
54
|
+
* The AbortSignal of the request
|
|
55
|
+
*/
|
|
56
|
+
signal: AbortSignal | undefined;
|
|
46
57
|
}
|
|
47
58
|
/**
|
|
48
59
|
* A procedure resolver
|
|
@@ -104,10 +115,7 @@ export interface ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn,
|
|
|
104
115
|
* Subscription procedure
|
|
105
116
|
* @link https://trpc.io/docs/v11/concepts#vocabulary
|
|
106
117
|
*/
|
|
107
|
-
subscription<$Output>(resolver: ProcedureResolver<TContext, TMeta, TContextOverrides, TInputOut, TOutputIn, $Output>): TCaller extends true ? TypeError<'Not implemented'> :
|
|
108
|
-
input: DefaultValue<TInputIn, void>;
|
|
109
|
-
output: DefaultValue<TOutputOut, inferSubscriptionOutput<$Output>>;
|
|
110
|
-
}>;
|
|
118
|
+
subscription<$Output>(resolver: ProcedureResolver<TContext, TMeta, TContextOverrides, TInputOut, TOutputIn, $Output>): TCaller extends true ? TypeError<'Not implemented'> : inferSubscriptionProcedure<TInputIn, TOutputOut, $Output>;
|
|
111
119
|
/**
|
|
112
120
|
* Overrides the way a procedure is invoked
|
|
113
121
|
* Do not use this unless you know what you're doing - this is an experimental API
|
|
@@ -129,6 +137,7 @@ export interface ProcedureCallOptions<TContext> {
|
|
|
129
137
|
input?: unknown;
|
|
130
138
|
path: string;
|
|
131
139
|
type: ProcedureType;
|
|
140
|
+
signal: AbortSignal | undefined;
|
|
132
141
|
}
|
|
133
142
|
export {};
|
|
134
143
|
//# sourceMappingURL=procedureBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"procedureBuilder.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/procedureBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAEnB,MAAM,cAAc,CAAC;AAMtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,KAAK,EAEV,YAAY,
|
|
1
|
+
{"version":3,"file":"procedureBuilder.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/procedureBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAEnB,MAAM,cAAc,CAAC;AAMtB,OAAO,KAAK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AAK,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,KAAK,CACN,CAkEA;AA6CD;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,QAAQ;IAC5C,GAAG,EAAE,QAAQ,CAAC;IACd,WAAW,EAAE,aAAa,CAAC;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;CACjC"}
|
|
@@ -137,51 +137,45 @@ const codeblock = `
|
|
|
137
137
|
This is a client-only function.
|
|
138
138
|
If you want to call this function on the server, see https://trpc.io/docs/v11/server/server-side-calls
|
|
139
139
|
`.trim();
|
|
140
|
+
// run the middlewares recursively with the resolver as the last one
|
|
141
|
+
async function callRecursive(index, _def, opts) {
|
|
142
|
+
try {
|
|
143
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
144
|
+
const middleware = _def.middlewares[index];
|
|
145
|
+
const result = await middleware({
|
|
146
|
+
...opts,
|
|
147
|
+
meta: _def.meta,
|
|
148
|
+
input: opts.input,
|
|
149
|
+
next (_nextOpts) {
|
|
150
|
+
const nextOpts = _nextOpts;
|
|
151
|
+
return callRecursive(index + 1, _def, {
|
|
152
|
+
...opts,
|
|
153
|
+
ctx: nextOpts?.ctx ? {
|
|
154
|
+
...opts.ctx,
|
|
155
|
+
...nextOpts.ctx
|
|
156
|
+
} : opts.ctx,
|
|
157
|
+
input: nextOpts && 'input' in nextOpts ? nextOpts.input : opts.input,
|
|
158
|
+
getRawInput: nextOpts?.getRawInput ?? opts.getRawInput
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return result;
|
|
163
|
+
} catch (cause) {
|
|
164
|
+
return {
|
|
165
|
+
ok: false,
|
|
166
|
+
error: TRPCError.getTRPCErrorFromUnknown(cause),
|
|
167
|
+
marker: middleware.middlewareMarker
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
140
171
|
function createProcedureCaller(_def) {
|
|
141
172
|
async function procedure(opts) {
|
|
142
173
|
// is direct server-side call
|
|
143
174
|
if (!opts || !('getRawInput' in opts)) {
|
|
144
175
|
throw new Error(codeblock);
|
|
145
176
|
}
|
|
146
|
-
// run the middlewares recursively with the resolver as the last one
|
|
147
|
-
async function callRecursive(callOpts = {
|
|
148
|
-
index: 0,
|
|
149
|
-
ctx: opts.ctx
|
|
150
|
-
}) {
|
|
151
|
-
try {
|
|
152
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
153
|
-
const middleware = _def.middlewares[callOpts.index];
|
|
154
|
-
const result = await middleware({
|
|
155
|
-
ctx: callOpts.ctx,
|
|
156
|
-
type: opts.type,
|
|
157
|
-
path: opts.path,
|
|
158
|
-
getRawInput: callOpts.getRawInput ?? opts.getRawInput,
|
|
159
|
-
meta: _def.meta,
|
|
160
|
-
input: callOpts.input,
|
|
161
|
-
next (_nextOpts) {
|
|
162
|
-
const nextOpts = _nextOpts;
|
|
163
|
-
return callRecursive({
|
|
164
|
-
index: callOpts.index + 1,
|
|
165
|
-
ctx: nextOpts && 'ctx' in nextOpts ? {
|
|
166
|
-
...callOpts.ctx,
|
|
167
|
-
...nextOpts.ctx
|
|
168
|
-
} : callOpts.ctx,
|
|
169
|
-
input: nextOpts && 'input' in nextOpts ? nextOpts.input : callOpts.input,
|
|
170
|
-
getRawInput: nextOpts && 'getRawInput' in nextOpts ? nextOpts.getRawInput : callOpts.getRawInput
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
return result;
|
|
175
|
-
} catch (cause) {
|
|
176
|
-
return {
|
|
177
|
-
ok: false,
|
|
178
|
-
error: TRPCError.getTRPCErrorFromUnknown(cause),
|
|
179
|
-
marker: middleware.middlewareMarker
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
177
|
// there's always at least one "next" since we wrap this.resolver in a middleware
|
|
184
|
-
const result = await callRecursive();
|
|
178
|
+
const result = await callRecursive(0, _def, opts);
|
|
185
179
|
if (!result) {
|
|
186
180
|
throw new TRPCError.TRPCError({
|
|
187
181
|
code: 'INTERNAL_SERVER_ERROR',
|
|
@@ -135,51 +135,45 @@ const codeblock = `
|
|
|
135
135
|
This is a client-only function.
|
|
136
136
|
If you want to call this function on the server, see https://trpc.io/docs/v11/server/server-side-calls
|
|
137
137
|
`.trim();
|
|
138
|
+
// run the middlewares recursively with the resolver as the last one
|
|
139
|
+
async function callRecursive(index, _def, opts) {
|
|
140
|
+
try {
|
|
141
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
142
|
+
const middleware = _def.middlewares[index];
|
|
143
|
+
const result = await middleware({
|
|
144
|
+
...opts,
|
|
145
|
+
meta: _def.meta,
|
|
146
|
+
input: opts.input,
|
|
147
|
+
next (_nextOpts) {
|
|
148
|
+
const nextOpts = _nextOpts;
|
|
149
|
+
return callRecursive(index + 1, _def, {
|
|
150
|
+
...opts,
|
|
151
|
+
ctx: nextOpts?.ctx ? {
|
|
152
|
+
...opts.ctx,
|
|
153
|
+
...nextOpts.ctx
|
|
154
|
+
} : opts.ctx,
|
|
155
|
+
input: nextOpts && 'input' in nextOpts ? nextOpts.input : opts.input,
|
|
156
|
+
getRawInput: nextOpts?.getRawInput ?? opts.getRawInput
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
return result;
|
|
161
|
+
} catch (cause) {
|
|
162
|
+
return {
|
|
163
|
+
ok: false,
|
|
164
|
+
error: getTRPCErrorFromUnknown(cause),
|
|
165
|
+
marker: middlewareMarker
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
138
169
|
function createProcedureCaller(_def) {
|
|
139
170
|
async function procedure(opts) {
|
|
140
171
|
// is direct server-side call
|
|
141
172
|
if (!opts || !('getRawInput' in opts)) {
|
|
142
173
|
throw new Error(codeblock);
|
|
143
174
|
}
|
|
144
|
-
// run the middlewares recursively with the resolver as the last one
|
|
145
|
-
async function callRecursive(callOpts = {
|
|
146
|
-
index: 0,
|
|
147
|
-
ctx: opts.ctx
|
|
148
|
-
}) {
|
|
149
|
-
try {
|
|
150
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
151
|
-
const middleware = _def.middlewares[callOpts.index];
|
|
152
|
-
const result = await middleware({
|
|
153
|
-
ctx: callOpts.ctx,
|
|
154
|
-
type: opts.type,
|
|
155
|
-
path: opts.path,
|
|
156
|
-
getRawInput: callOpts.getRawInput ?? opts.getRawInput,
|
|
157
|
-
meta: _def.meta,
|
|
158
|
-
input: callOpts.input,
|
|
159
|
-
next (_nextOpts) {
|
|
160
|
-
const nextOpts = _nextOpts;
|
|
161
|
-
return callRecursive({
|
|
162
|
-
index: callOpts.index + 1,
|
|
163
|
-
ctx: nextOpts && 'ctx' in nextOpts ? {
|
|
164
|
-
...callOpts.ctx,
|
|
165
|
-
...nextOpts.ctx
|
|
166
|
-
} : callOpts.ctx,
|
|
167
|
-
input: nextOpts && 'input' in nextOpts ? nextOpts.input : callOpts.input,
|
|
168
|
-
getRawInput: nextOpts && 'getRawInput' in nextOpts ? nextOpts.getRawInput : callOpts.getRawInput
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
return result;
|
|
173
|
-
} catch (cause) {
|
|
174
|
-
return {
|
|
175
|
-
ok: false,
|
|
176
|
-
error: getTRPCErrorFromUnknown(cause),
|
|
177
|
-
marker: middlewareMarker
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
175
|
// there's always at least one "next" since we wrap this.resolver in a middleware
|
|
182
|
-
const result = await callRecursive();
|
|
176
|
+
const result = await callRecursive(0, _def, opts);
|
|
183
177
|
if (!result) {
|
|
184
178
|
throw new TRPCError({
|
|
185
179
|
code: 'INTERNAL_SERVER_ERROR',
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Observable } from '../observable';
|
|
2
2
|
import { TRPCError } from './error/TRPCError';
|
|
3
|
-
import type { AnyProcedure, ErrorHandlerOptions, inferProcedureInput, inferProcedureOutput } from './procedure';
|
|
3
|
+
import type { AnyProcedure, ErrorHandlerOptions, inferProcedureInput, inferProcedureOutput, LegacyObservableSubscriptionProcedure } from './procedure';
|
|
4
4
|
import type { ProcedureCallOptions } from './procedureBuilder';
|
|
5
5
|
import type { AnyRootTypes, RootConfig } from './rootConfig';
|
|
6
6
|
import type { MaybePromise } from './types';
|
|
7
7
|
export interface RouterRecord {
|
|
8
8
|
[key: string]: AnyProcedure | RouterRecord;
|
|
9
9
|
}
|
|
10
|
-
type DecorateProcedure<TProcedure extends AnyProcedure> = (input: inferProcedureInput<TProcedure>) => Promise<TProcedure['_def']['type'] extends 'subscription' ? Observable<inferProcedureOutput<TProcedure>, TRPCError> : inferProcedureOutput<TProcedure>>;
|
|
10
|
+
type DecorateProcedure<TProcedure extends AnyProcedure> = (input: inferProcedureInput<TProcedure>) => Promise<TProcedure['_def']['type'] extends 'subscription' ? TProcedure extends LegacyObservableSubscriptionProcedure<any> ? Observable<inferProcedureOutput<TProcedure>, TRPCError> : AsyncIterable<inferProcedureOutput<TProcedure>> : inferProcedureOutput<TProcedure>>;
|
|
11
11
|
/**
|
|
12
12
|
* @internal
|
|
13
13
|
*/
|
|
@@ -29,6 +29,7 @@ export type RouterCaller<TRoot extends AnyRootTypes, TRecord extends RouterRecor
|
|
|
29
29
|
*/
|
|
30
30
|
ctx: TRoot['ctx'] | (() => MaybePromise<TRoot['ctx']>), options?: {
|
|
31
31
|
onError?: RouterCallerErrorHandler<TRoot['ctx']>;
|
|
32
|
+
signal?: AbortSignal;
|
|
32
33
|
}) => DecorateRouterRecord<TRecord>;
|
|
33
34
|
export interface Router<TRoot extends AnyRootTypes, TRecord extends RouterRecord> {
|
|
34
35
|
_def: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,EAA2B,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,EAA2B,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,qCAAqC,EACtC,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,YAAY,EAAW,MAAM,SAAS,CAAC;AAGrD,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,YAAY,CAAC;CAC5C;AAED,KAAK,iBAAiB,CAAC,UAAU,SAAS,YAAY,IAAI,CACxD,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,KACnC,OAAO,CACV,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,SAAS,cAAc,GAC7C,UAAU,SAAS,qCAAqC,CAAC,GAAG,CAAC,GAC3D,UAAU,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,GACvD,aAAa,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,GACjD,oBAAoB,CAAC,UAAU,CAAC,CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAAC,OAAO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ACZ,WAAW,CAAC,KAAK,EAAE,2BAA2B,CAAC,MAAM,CAAC,CAAC;EA2D3D;AAOD;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG;IACpC,UAAU,EAAE,YAAY,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,gBA4BF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,SAAS,YAAY,MAC1B,OAAO,SAAS,YAAY,UACpD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,KAC3C,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CA0ChC;AAED,gBAAgB;AAChB,KAAK,YAAY,CACf,QAAQ,SAAS,SAAS,EAAE,EAC5B,KAAK,SAAS,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,EAErE,OAAO,SAAS,YAAY,GAAG,EAAE,IAC/B,QAAQ,SAAS;IACnB,MAAM,IAAI,SAAS,SAAS;IAC5B,GAAG,MAAM,IAAI,SAAS,SAAS,EAAE;CAClC,GACG,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,GAC3D,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAEhC,wBAAgB,YAAY,CAAC,QAAQ,SAAS,SAAS,EAAE,EACvD,GAAG,UAAU,EAAE,CAAC,GAAG,QAAQ,CAAC,GAC3B,YAAY,CAAC,QAAQ,CAAC,CAoDxB"}
|
|
@@ -113,7 +113,7 @@ function isProcedure(procedureOrRouter) {
|
|
|
113
113
|
function createCallerFactory() {
|
|
114
114
|
return function createCallerInner(router) {
|
|
115
115
|
const _def = router._def;
|
|
116
|
-
return function createCaller(ctxOrCallback,
|
|
116
|
+
return function createCaller(ctxOrCallback, opts) {
|
|
117
117
|
return createProxy.createRecursiveProxy(async ({ path , args })=>{
|
|
118
118
|
const fullPath = path.join('.');
|
|
119
119
|
if (path.length === 1 && path[0] === '_def') {
|
|
@@ -127,10 +127,11 @@ function createCallerFactory() {
|
|
|
127
127
|
path: fullPath,
|
|
128
128
|
getRawInput: async ()=>args[0],
|
|
129
129
|
ctx,
|
|
130
|
-
type: procedure._def.type
|
|
130
|
+
type: procedure._def.type,
|
|
131
|
+
signal: opts?.signal
|
|
131
132
|
});
|
|
132
133
|
} catch (cause) {
|
|
133
|
-
|
|
134
|
+
opts?.onError?.({
|
|
134
135
|
ctx,
|
|
135
136
|
error: TRPCError.getTRPCErrorFromUnknown(cause),
|
|
136
137
|
input: args[0],
|
|
@@ -111,7 +111,7 @@ function isProcedure(procedureOrRouter) {
|
|
|
111
111
|
function createCallerFactory() {
|
|
112
112
|
return function createCallerInner(router) {
|
|
113
113
|
const _def = router._def;
|
|
114
|
-
return function createCaller(ctxOrCallback,
|
|
114
|
+
return function createCaller(ctxOrCallback, opts) {
|
|
115
115
|
return createRecursiveProxy(async ({ path , args })=>{
|
|
116
116
|
const fullPath = path.join('.');
|
|
117
117
|
if (path.length === 1 && path[0] === '_def') {
|
|
@@ -125,10 +125,11 @@ function createCallerFactory() {
|
|
|
125
125
|
path: fullPath,
|
|
126
126
|
getRawInput: async ()=>args[0],
|
|
127
127
|
ctx,
|
|
128
|
-
type: procedure._def.type
|
|
128
|
+
type: procedure._def.type,
|
|
129
|
+
signal: opts?.signal
|
|
129
130
|
});
|
|
130
131
|
} catch (cause) {
|
|
131
|
-
|
|
132
|
+
opts?.onError?.({
|
|
132
133
|
ctx,
|
|
133
134
|
error: getTRPCErrorFromUnknown(cause),
|
|
134
135
|
input: args[0],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/server",
|
|
3
|
-
"version": "11.0.0-rc.
|
|
3
|
+
"version": "11.0.0-rc.524+df45b1a7c",
|
|
4
4
|
"description": "The tRPC server library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -149,5 +149,5 @@
|
|
|
149
149
|
"funding": [
|
|
150
150
|
"https://trpc.io/sponsor"
|
|
151
151
|
],
|
|
152
|
-
"gitHead": "
|
|
152
|
+
"gitHead": "df45b1a7c13a3f5c47373a0d2b38c68f5c6c1028"
|
|
153
153
|
}
|
|
@@ -96,6 +96,7 @@ export function nextAppDirCaller<TContext, TMeta>(
|
|
|
96
96
|
getRawInput: async () => input,
|
|
97
97
|
path,
|
|
98
98
|
input,
|
|
99
|
+
signal: undefined,
|
|
99
100
|
})
|
|
100
101
|
.then((data) => {
|
|
101
102
|
if (data instanceof TRPCRedirectError) throw data;
|
|
@@ -112,6 +113,7 @@ export function nextAppDirCaller<TContext, TMeta>(
|
|
|
112
113
|
getRawInput: async () => input,
|
|
113
114
|
path,
|
|
114
115
|
input,
|
|
116
|
+
signal: undefined,
|
|
115
117
|
})
|
|
116
118
|
.then((data) => {
|
|
117
119
|
if (data instanceof TRPCRedirectError) throw data;
|
package/src/adapters/ws.ts
CHANGED
|
@@ -203,12 +203,14 @@ export function getWSConnectionHandler<TRouter extends AnyRouter>(
|
|
|
203
203
|
}
|
|
204
204
|
await ctxPromise; // asserts context has been set
|
|
205
205
|
|
|
206
|
+
const abortController = new AbortController();
|
|
206
207
|
const result = await callProcedure({
|
|
207
208
|
procedures: router._def.procedures,
|
|
208
209
|
path,
|
|
209
210
|
getRawInput: async () => input,
|
|
210
211
|
ctx,
|
|
211
212
|
type,
|
|
213
|
+
signal: abortController.signal,
|
|
212
214
|
});
|
|
213
215
|
|
|
214
216
|
const isIterableResult =
|
|
@@ -264,7 +266,6 @@ export function getWSConnectionHandler<TRouter extends AnyRouter>(
|
|
|
264
266
|
|
|
265
267
|
const iterator: AsyncIterator<unknown> =
|
|
266
268
|
iterable[Symbol.asyncIterator]();
|
|
267
|
-
const abortController = new AbortController();
|
|
268
269
|
|
|
269
270
|
const abortPromise = new Promise<'abort'>((resolve) => {
|
|
270
271
|
abortController.signal.onabort = () => resolve('abort');
|
|
@@ -66,10 +66,25 @@ export interface MutationProcedure<TDef extends BuiltProcedureDef>
|
|
|
66
66
|
export interface SubscriptionProcedure<TDef extends BuiltProcedureDef>
|
|
67
67
|
extends Procedure<'subscription', TDef> {}
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* @deprecated
|
|
71
|
+
*/
|
|
72
|
+
export interface LegacyObservableSubscriptionProcedure<
|
|
73
|
+
TDef extends BuiltProcedureDef,
|
|
74
|
+
> extends SubscriptionProcedure<TDef> {
|
|
75
|
+
_observable: true;
|
|
76
|
+
}
|
|
77
|
+
|
|
69
78
|
export type AnyQueryProcedure = QueryProcedure<any>;
|
|
70
79
|
export type AnyMutationProcedure = MutationProcedure<any>;
|
|
71
|
-
export type AnySubscriptionProcedure =
|
|
72
|
-
|
|
80
|
+
export type AnySubscriptionProcedure =
|
|
81
|
+
| SubscriptionProcedure<any>
|
|
82
|
+
| LegacyObservableSubscriptionProcedure<any>;
|
|
83
|
+
|
|
84
|
+
export type AnyProcedure =
|
|
85
|
+
| AnyQueryProcedure
|
|
86
|
+
| AnyMutationProcedure
|
|
87
|
+
| AnySubscriptionProcedure;
|
|
73
88
|
|
|
74
89
|
export type inferProcedureInput<TProcedure extends AnyProcedure> =
|
|
75
90
|
undefined extends inferProcedureParams<TProcedure>['$types']['input']
|
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
AnyMutationProcedure,
|
|
18
18
|
AnyProcedure,
|
|
19
19
|
AnyQueryProcedure,
|
|
20
|
-
|
|
20
|
+
LegacyObservableSubscriptionProcedure,
|
|
21
21
|
MutationProcedure,
|
|
22
22
|
ProcedureType,
|
|
23
23
|
QueryProcedure,
|
|
@@ -50,6 +50,17 @@ type inferSubscriptionOutput<TOutput> = TOutput extends AsyncIterable<
|
|
|
50
50
|
? inferTrackedOutput<$Output>
|
|
51
51
|
: inferObservableValue<TOutput>;
|
|
52
52
|
|
|
53
|
+
type inferSubscriptionProcedure<TInputIn, TOutputOut, $Output> =
|
|
54
|
+
$Output extends AsyncIterable<any>
|
|
55
|
+
? SubscriptionProcedure<{
|
|
56
|
+
input: DefaultValue<TInputIn, void>;
|
|
57
|
+
output: DefaultValue<TOutputOut, inferSubscriptionOutput<$Output>>;
|
|
58
|
+
}>
|
|
59
|
+
: LegacyObservableSubscriptionProcedure<{
|
|
60
|
+
input: DefaultValue<TInputIn, void>;
|
|
61
|
+
output: DefaultValue<TOutputOut, inferSubscriptionOutput<$Output>>;
|
|
62
|
+
}>;
|
|
63
|
+
|
|
53
64
|
export type CallerOverride<TContext> = (opts: {
|
|
54
65
|
args: unknown[];
|
|
55
66
|
invoke: (opts: ProcedureCallOptions<TContext>) => Promise<unknown>;
|
|
@@ -92,6 +103,10 @@ export interface ProcedureResolverOptions<
|
|
|
92
103
|
> {
|
|
93
104
|
ctx: Simplify<Overwrite<TContext, TContextOverridesIn>>;
|
|
94
105
|
input: TInputOut extends UnsetMarker ? undefined : TInputOut;
|
|
106
|
+
/**
|
|
107
|
+
* The AbortSignal of the request
|
|
108
|
+
*/
|
|
109
|
+
signal: AbortSignal | undefined;
|
|
95
110
|
}
|
|
96
111
|
|
|
97
112
|
/**
|
|
@@ -352,10 +367,7 @@ export interface ProcedureBuilder<
|
|
|
352
367
|
>,
|
|
353
368
|
): TCaller extends true
|
|
354
369
|
? TypeError<'Not implemented'>
|
|
355
|
-
:
|
|
356
|
-
input: DefaultValue<TInputIn, void>;
|
|
357
|
-
output: DefaultValue<TOutputOut, inferSubscriptionOutput<$Output>>;
|
|
358
|
-
}>;
|
|
370
|
+
: inferSubscriptionProcedure<TInputIn, TOutputOut, $Output>;
|
|
359
371
|
|
|
360
372
|
/**
|
|
361
373
|
* Overrides the way a procedure is invoked
|
|
@@ -465,10 +477,7 @@ export function createBuilder<TContext, TMeta>(
|
|
|
465
477
|
) as AnyMutationProcedure;
|
|
466
478
|
},
|
|
467
479
|
subscription(resolver) {
|
|
468
|
-
return createResolver(
|
|
469
|
-
{ ..._def, type: 'subscription' },
|
|
470
|
-
resolver,
|
|
471
|
-
) as AnySubscriptionProcedure;
|
|
480
|
+
return createResolver({ ..._def, type: 'subscription' }, resolver) as any;
|
|
472
481
|
},
|
|
473
482
|
experimental_caller(caller) {
|
|
474
483
|
return createNewBuilder(_def, {
|
|
@@ -532,6 +541,7 @@ export interface ProcedureCallOptions<TContext> {
|
|
|
532
541
|
input?: unknown;
|
|
533
542
|
path: string;
|
|
534
543
|
type: ProcedureType;
|
|
544
|
+
signal: AbortSignal | undefined;
|
|
535
545
|
}
|
|
536
546
|
|
|
537
547
|
const codeblock = `
|
|
@@ -539,6 +549,46 @@ This is a client-only function.
|
|
|
539
549
|
If you want to call this function on the server, see https://trpc.io/docs/v11/server/server-side-calls
|
|
540
550
|
`.trim();
|
|
541
551
|
|
|
552
|
+
// run the middlewares recursively with the resolver as the last one
|
|
553
|
+
async function callRecursive(
|
|
554
|
+
index: number,
|
|
555
|
+
_def: AnyProcedureBuilderDef,
|
|
556
|
+
opts: ProcedureCallOptions<any>,
|
|
557
|
+
): Promise<MiddlewareResult<any>> {
|
|
558
|
+
try {
|
|
559
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
560
|
+
const middleware = _def.middlewares[index]!;
|
|
561
|
+
const result = await middleware({
|
|
562
|
+
...opts,
|
|
563
|
+
meta: _def.meta,
|
|
564
|
+
input: opts.input,
|
|
565
|
+
next(_nextOpts?: any) {
|
|
566
|
+
const nextOpts = _nextOpts as
|
|
567
|
+
| {
|
|
568
|
+
ctx?: Record<string, unknown>;
|
|
569
|
+
input?: unknown;
|
|
570
|
+
getRawInput?: GetRawInputFn;
|
|
571
|
+
}
|
|
572
|
+
| undefined;
|
|
573
|
+
|
|
574
|
+
return callRecursive(index + 1, _def, {
|
|
575
|
+
...opts,
|
|
576
|
+
ctx: nextOpts?.ctx ? { ...opts.ctx, ...nextOpts.ctx } : opts.ctx,
|
|
577
|
+
input: nextOpts && 'input' in nextOpts ? nextOpts.input : opts.input,
|
|
578
|
+
getRawInput: nextOpts?.getRawInput ?? opts.getRawInput,
|
|
579
|
+
});
|
|
580
|
+
},
|
|
581
|
+
});
|
|
582
|
+
return result;
|
|
583
|
+
} catch (cause) {
|
|
584
|
+
return {
|
|
585
|
+
ok: false,
|
|
586
|
+
error: getTRPCErrorFromUnknown(cause),
|
|
587
|
+
marker: middlewareMarker,
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
542
592
|
function createProcedureCaller(_def: AnyProcedureBuilderDef): AnyProcedure {
|
|
543
593
|
async function procedure(opts: ProcedureCallOptions<unknown>) {
|
|
544
594
|
// is direct server-side call
|
|
@@ -546,66 +596,8 @@ function createProcedureCaller(_def: AnyProcedureBuilderDef): AnyProcedure {
|
|
|
546
596
|
throw new Error(codeblock);
|
|
547
597
|
}
|
|
548
598
|
|
|
549
|
-
// run the middlewares recursively with the resolver as the last one
|
|
550
|
-
async function callRecursive(
|
|
551
|
-
callOpts: {
|
|
552
|
-
ctx: any;
|
|
553
|
-
index: number;
|
|
554
|
-
input?: unknown;
|
|
555
|
-
getRawInput?: GetRawInputFn;
|
|
556
|
-
} = {
|
|
557
|
-
index: 0,
|
|
558
|
-
ctx: opts.ctx,
|
|
559
|
-
},
|
|
560
|
-
): Promise<MiddlewareResult<any>> {
|
|
561
|
-
try {
|
|
562
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
563
|
-
const middleware = _def.middlewares[callOpts.index]!;
|
|
564
|
-
const result = await middleware({
|
|
565
|
-
ctx: callOpts.ctx,
|
|
566
|
-
type: opts.type,
|
|
567
|
-
path: opts.path,
|
|
568
|
-
getRawInput: callOpts.getRawInput ?? opts.getRawInput,
|
|
569
|
-
meta: _def.meta,
|
|
570
|
-
input: callOpts.input,
|
|
571
|
-
next(_nextOpts?: any) {
|
|
572
|
-
const nextOpts = _nextOpts as
|
|
573
|
-
| {
|
|
574
|
-
ctx?: Record<string, unknown>;
|
|
575
|
-
input?: unknown;
|
|
576
|
-
getRawInput?: GetRawInputFn;
|
|
577
|
-
}
|
|
578
|
-
| undefined;
|
|
579
|
-
|
|
580
|
-
return callRecursive({
|
|
581
|
-
index: callOpts.index + 1,
|
|
582
|
-
ctx:
|
|
583
|
-
nextOpts && 'ctx' in nextOpts
|
|
584
|
-
? { ...callOpts.ctx, ...nextOpts.ctx }
|
|
585
|
-
: callOpts.ctx,
|
|
586
|
-
input:
|
|
587
|
-
nextOpts && 'input' in nextOpts
|
|
588
|
-
? nextOpts.input
|
|
589
|
-
: callOpts.input,
|
|
590
|
-
getRawInput:
|
|
591
|
-
nextOpts && 'getRawInput' in nextOpts
|
|
592
|
-
? nextOpts.getRawInput
|
|
593
|
-
: callOpts.getRawInput,
|
|
594
|
-
});
|
|
595
|
-
},
|
|
596
|
-
});
|
|
597
|
-
return result;
|
|
598
|
-
} catch (cause) {
|
|
599
|
-
return {
|
|
600
|
-
ok: false,
|
|
601
|
-
error: getTRPCErrorFromUnknown(cause),
|
|
602
|
-
marker: middlewareMarker,
|
|
603
|
-
};
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
|
|
607
599
|
// there's always at least one "next" since we wrap this.resolver in a middleware
|
|
608
|
-
const result = await callRecursive();
|
|
600
|
+
const result = await callRecursive(0, _def, opts);
|
|
609
601
|
|
|
610
602
|
if (!result) {
|
|
611
603
|
throw new TRPCError({
|
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
ErrorHandlerOptions,
|
|
8
8
|
inferProcedureInput,
|
|
9
9
|
inferProcedureOutput,
|
|
10
|
+
LegacyObservableSubscriptionProcedure,
|
|
10
11
|
} from './procedure';
|
|
11
12
|
import type { ProcedureCallOptions } from './procedureBuilder';
|
|
12
13
|
import type { AnyRootTypes, RootConfig } from './rootConfig';
|
|
@@ -22,7 +23,9 @@ type DecorateProcedure<TProcedure extends AnyProcedure> = (
|
|
|
22
23
|
input: inferProcedureInput<TProcedure>,
|
|
23
24
|
) => Promise<
|
|
24
25
|
TProcedure['_def']['type'] extends 'subscription'
|
|
25
|
-
?
|
|
26
|
+
? TProcedure extends LegacyObservableSubscriptionProcedure<any>
|
|
27
|
+
? Observable<inferProcedureOutput<TProcedure>, TRPCError>
|
|
28
|
+
: AsyncIterable<inferProcedureOutput<TProcedure>>
|
|
26
29
|
: inferProcedureOutput<TProcedure>
|
|
27
30
|
>;
|
|
28
31
|
|
|
@@ -60,6 +63,7 @@ export type RouterCaller<
|
|
|
60
63
|
ctx: TRoot['ctx'] | (() => MaybePromise<TRoot['ctx']>),
|
|
61
64
|
options?: {
|
|
62
65
|
onError?: RouterCallerErrorHandler<TRoot['ctx']>;
|
|
66
|
+
signal?: AbortSignal;
|
|
63
67
|
},
|
|
64
68
|
) => DecorateRouterRecord<TRecord>;
|
|
65
69
|
|
|
@@ -270,12 +274,7 @@ export function createCallerFactory<TRoot extends AnyRootTypes>() {
|
|
|
270
274
|
const _def = router._def;
|
|
271
275
|
type Context = TRoot['ctx'];
|
|
272
276
|
|
|
273
|
-
return function createCaller(
|
|
274
|
-
ctxOrCallback,
|
|
275
|
-
options?: {
|
|
276
|
-
onError?: RouterCallerErrorHandler<Context>;
|
|
277
|
-
},
|
|
278
|
-
) {
|
|
277
|
+
return function createCaller(ctxOrCallback, opts) {
|
|
279
278
|
return createRecursiveProxy<ReturnType<RouterCaller<any, any>>>(
|
|
280
279
|
async ({ path, args }) => {
|
|
281
280
|
const fullPath = path.join('.');
|
|
@@ -297,9 +296,10 @@ export function createCallerFactory<TRoot extends AnyRootTypes>() {
|
|
|
297
296
|
getRawInput: async () => args[0],
|
|
298
297
|
ctx,
|
|
299
298
|
type: procedure._def.type,
|
|
299
|
+
signal: opts?.signal,
|
|
300
300
|
});
|
|
301
301
|
} catch (cause) {
|
|
302
|
-
|
|
302
|
+
opts?.onError?.({
|
|
303
303
|
ctx,
|
|
304
304
|
error: getTRPCErrorFromUnknown(cause),
|
|
305
305
|
input: args[0],
|