@trpc/server 11.0.0-rc.630 → 11.0.0-rc.633
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 -1
- package/dist/@trpc/server/http.d.ts.map +1 -1
- package/dist/adapters/aws-lambda/index.js +1 -0
- package/dist/adapters/aws-lambda/index.mjs +1 -0
- package/dist/adapters/express.js +1 -0
- package/dist/adapters/express.mjs +1 -0
- package/dist/adapters/fastify/fastifyRequestHandler.js +2 -1
- package/dist/adapters/fastify/fastifyRequestHandler.mjs +2 -1
- package/dist/adapters/fetch/fetchRequestHandler.js +1 -0
- package/dist/adapters/fetch/fetchRequestHandler.mjs +1 -0
- package/dist/adapters/next-app-dir/nextAppDirCaller.js +1 -0
- package/dist/adapters/next-app-dir/nextAppDirCaller.mjs +1 -0
- package/dist/adapters/next-app-dir/notFound.js +1 -0
- package/dist/adapters/next-app-dir/notFound.mjs +1 -0
- package/dist/adapters/next-app-dir/redirect.js +1 -0
- package/dist/adapters/next-app-dir/redirect.mjs +1 -0
- package/dist/adapters/next.js +1 -0
- package/dist/adapters/next.mjs +1 -0
- package/dist/adapters/node-http/incomingMessageToRequest.d.ts +1 -1
- package/dist/adapters/node-http/incomingMessageToRequest.d.ts.map +1 -1
- package/dist/adapters/node-http/incomingMessageToRequest.js +7 -5
- package/dist/adapters/node-http/incomingMessageToRequest.mjs +7 -5
- package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts.map +1 -1
- package/dist/adapters/node-http/nodeHTTPRequestHandler.js +9 -42
- package/dist/adapters/node-http/nodeHTTPRequestHandler.mjs +9 -42
- package/dist/adapters/node-http/writeResponse.d.ts +18 -0
- package/dist/adapters/node-http/writeResponse.d.ts.map +1 -0
- package/dist/adapters/node-http/writeResponse.js +80 -0
- package/dist/adapters/node-http/writeResponse.mjs +77 -0
- package/dist/adapters/standalone.js +1 -0
- package/dist/adapters/standalone.mjs +1 -0
- package/dist/adapters/ws.js +1 -0
- package/dist/adapters/ws.mjs +1 -0
- package/dist/bundle-analysis.json +195 -168
- package/dist/http.js +1 -2
- package/dist/http.mjs +1 -1
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/dist/rpc.js +1 -0
- package/dist/rpc.mjs +1 -0
- package/dist/shared.js +1 -0
- package/dist/shared.mjs +1 -0
- package/dist/unstable-core-do-not-import/http/isAbortError.d.ts +4 -0
- package/dist/unstable-core-do-not-import/http/isAbortError.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/http/isAbortError.js +9 -0
- package/dist/unstable-core-do-not-import/http/isAbortError.mjs +7 -0
- package/dist/unstable-core-do-not-import/http/resolveResponse.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/http/resolveResponse.js +3 -3
- package/dist/unstable-core-do-not-import/http/resolveResponse.mjs +3 -3
- package/dist/unstable-core-do-not-import/initTRPC.js +2 -2
- package/dist/unstable-core-do-not-import/initTRPC.mjs +2 -2
- package/dist/unstable-core-do-not-import/rootConfig.d.ts +14 -14
- package/dist/unstable-core-do-not-import/rootConfig.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts +7 -10
- package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/stream/jsonl.d.ts +6 -9
- package/dist/unstable-core-do-not-import/stream/jsonl.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/stream/jsonl.js +75 -124
- package/dist/unstable-core-do-not-import/stream/jsonl.mjs +76 -125
- package/dist/unstable-core-do-not-import/stream/sse.d.ts +11 -1
- package/dist/unstable-core-do-not-import/stream/sse.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/stream/sse.js +154 -86
- package/dist/unstable-core-do-not-import/stream/sse.mjs +155 -87
- package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.d.ts +10 -10
- package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.js +47 -34
- package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.mjs +47 -34
- package/dist/unstable-core-do-not-import/stream/utils/createReadableStream.d.ts +0 -4
- package/dist/unstable-core-do-not-import/stream/utils/createReadableStream.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/stream/utils/createReadableStream.js +0 -11
- package/dist/unstable-core-do-not-import/stream/utils/createReadableStream.mjs +1 -11
- package/dist/unstable-core-do-not-import/stream/utils/disposablePromiseTimer.d.ts +6 -0
- package/dist/unstable-core-do-not-import/stream/utils/disposablePromiseTimer.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/stream/utils/disposablePromiseTimer.js +28 -0
- package/dist/unstable-core-do-not-import/stream/utils/disposablePromiseTimer.mjs +25 -0
- package/dist/unstable-core-do-not-import/stream/utils/withPing.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/stream/utils/withPing.js +17 -17
- package/dist/unstable-core-do-not-import/stream/utils/withPing.mjs +17 -17
- package/dist/unstable-core-do-not-import/stream/utils/withRefCount.d.ts +17 -0
- package/dist/unstable-core-do-not-import/stream/utils/withRefCount.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/stream/utils/withRefCount.js +59 -0
- package/dist/unstable-core-do-not-import/stream/utils/withRefCount.mjs +57 -0
- package/dist/unstable-core-do-not-import/transformer.d.ts +1 -4
- package/dist/unstable-core-do-not-import/transformer.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import.d.ts +2 -2
- package/dist/unstable-core-do-not-import.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import.js +2 -2
- package/dist/unstable-core-do-not-import.mjs +1 -1
- package/package.json +3 -3
- package/src/@trpc/server/http.ts +0 -1
- package/src/adapters/fastify/fastifyRequestHandler.ts +1 -1
- package/src/adapters/node-http/incomingMessageToRequest.ts +8 -4
- package/src/adapters/node-http/nodeHTTPRequestHandler.ts +8 -46
- package/src/adapters/node-http/writeResponse.ts +91 -0
- package/src/unstable-core-do-not-import/http/isAbortError.ts +7 -0
- package/src/unstable-core-do-not-import/http/resolveResponse.ts +3 -4
- package/src/unstable-core-do-not-import/initTRPC.ts +1 -1
- package/src/unstable-core-do-not-import/rootConfig.ts +17 -17
- package/src/unstable-core-do-not-import/rpc/envelopes.ts +7 -12
- package/src/unstable-core-do-not-import/stream/jsonl.ts +85 -154
- package/src/unstable-core-do-not-import/stream/sse.ts +179 -92
- package/src/unstable-core-do-not-import/stream/utils/asyncIterable.ts +58 -37
- package/src/unstable-core-do-not-import/stream/utils/createReadableStream.ts +0 -13
- package/src/unstable-core-do-not-import/stream/utils/disposablePromiseTimer.ts +27 -0
- package/src/unstable-core-do-not-import/stream/utils/withPing.ts +31 -19
- package/src/unstable-core-do-not-import/stream/utils/withRefCount.ts +93 -0
- package/src/unstable-core-do-not-import.ts +2 -2
- package/dist/unstable-core-do-not-import/http/batchStreamFormatter.d.ts +0 -24
- package/dist/unstable-core-do-not-import/http/batchStreamFormatter.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/batchStreamFormatter.js +0 -32
- package/dist/unstable-core-do-not-import/http/batchStreamFormatter.mjs +0 -30
- package/dist/unstable-core-do-not-import/stream/utils/promiseTimer.d.ts +0 -8
- package/dist/unstable-core-do-not-import/stream/utils/promiseTimer.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/stream/utils/promiseTimer.js +0 -38
- package/dist/unstable-core-do-not-import/stream/utils/promiseTimer.mjs +0 -36
- package/src/unstable-core-do-not-import/http/batchStreamFormatter.ts +0 -29
- package/src/unstable-core-do-not-import/stream/utils/promiseTimer.ts +0 -40
|
@@ -4,5 +4,5 @@ export type { BaseHandlerOptions, HTTPBaseHandlerOptions, HTTPErrorHandler,
|
|
|
4
4
|
* @deprecated Use `HTTPErrorHandler` instead
|
|
5
5
|
*/
|
|
6
6
|
HTTPErrorHandler as OnErrorFunction, ResolveHTTPRequestOptionsContextFn, ResponseMeta, ResponseMetaFn, TRPCRequestInfo, } from '../../unstable-core-do-not-import';
|
|
7
|
-
export {
|
|
7
|
+
export { octetInputParser, parseConnectionParamsFromUnknown, parseConnectionParamsFromString, } from '../../unstable-core-do-not-import';
|
|
8
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,EAC1B,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB;AAChB;;GAEG;AACH,gBAAgB,IAAI,eAAe,EACnC,kCAAkC,EAClC,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/@trpc/server/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB;AAChB;;GAEG;AACH,gBAAgB,IAAI,eAAe,EACnC,kCAAkC,EAClC,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACL,gBAAgB,EAChB,gCAAgC,EAChC,+BAA+B,GAChC,MAAM,mCAAmC,CAAC"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var resolveResponse = require('../../unstable-core-do-not-import/http/resolveResponse.js');
|
|
4
4
|
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
5
5
|
require('../../vendor/unpromise/unpromise.js');
|
|
6
|
+
require('../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.js');
|
|
6
7
|
var getPlanner = require('./getPlanner.js');
|
|
7
8
|
|
|
8
9
|
function awsLambdaRequestHandler(opts) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { resolveResponse } from '../../unstable-core-do-not-import/http/resolveResponse.mjs';
|
|
2
2
|
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
3
3
|
import '../../vendor/unpromise/unpromise.mjs';
|
|
4
|
+
import '../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.mjs';
|
|
4
5
|
import { getPlanner } from './getPlanner.mjs';
|
|
5
6
|
|
|
6
7
|
function awsLambdaRequestHandler(opts) {
|
package/dist/adapters/express.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var utils = require('../unstable-core-do-not-import/utils.js');
|
|
4
4
|
require('../vendor/unpromise/unpromise.js');
|
|
5
|
+
require('../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.js');
|
|
5
6
|
require('../unstable-core-do-not-import/rootConfig.js');
|
|
6
7
|
var nodeHTTPRequestHandler = require('./node-http/nodeHTTPRequestHandler.js');
|
|
7
8
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { run } from '../unstable-core-do-not-import/utils.mjs';
|
|
2
2
|
import '../vendor/unpromise/unpromise.mjs';
|
|
3
|
+
import '../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.mjs';
|
|
3
4
|
import '../unstable-core-do-not-import/rootConfig.mjs';
|
|
4
5
|
import { nodeHTTPRequestHandler, internal_exceptionHandler } from './node-http/nodeHTTPRequestHandler.mjs';
|
|
5
6
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var resolveResponse = require('../../unstable-core-do-not-import/http/resolveResponse.js');
|
|
4
4
|
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
5
5
|
require('../../vendor/unpromise/unpromise.js');
|
|
6
|
+
require('../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.js');
|
|
6
7
|
var incomingMessageToRequest = require('../node-http/incomingMessageToRequest.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -26,7 +27,7 @@ async function fastifyRequestHandler(opts) {
|
|
|
26
27
|
if ('body' in opts.req) {
|
|
27
28
|
incomingMessage.body = opts.req.body;
|
|
28
29
|
}
|
|
29
|
-
const req = incomingMessageToRequest.incomingMessageToRequest(incomingMessage, {
|
|
30
|
+
const req = incomingMessageToRequest.incomingMessageToRequest(incomingMessage, opts.res.raw, {
|
|
30
31
|
maxBodySize: null
|
|
31
32
|
});
|
|
32
33
|
const res = await resolveResponse.resolveResponse({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { resolveResponse } from '../../unstable-core-do-not-import/http/resolveResponse.mjs';
|
|
2
2
|
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
3
3
|
import '../../vendor/unpromise/unpromise.mjs';
|
|
4
|
+
import '../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.mjs';
|
|
4
5
|
import { incomingMessageToRequest } from '../node-http/incomingMessageToRequest.mjs';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -24,7 +25,7 @@ async function fastifyRequestHandler(opts) {
|
|
|
24
25
|
if ('body' in opts.req) {
|
|
25
26
|
incomingMessage.body = opts.req.body;
|
|
26
27
|
}
|
|
27
|
-
const req = incomingMessageToRequest(incomingMessage, {
|
|
28
|
+
const req = incomingMessageToRequest(incomingMessage, opts.res.raw, {
|
|
28
29
|
maxBodySize: null
|
|
29
30
|
});
|
|
30
31
|
const res = await resolveResponse({
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var resolveResponse = require('../../unstable-core-do-not-import/http/resolveResponse.js');
|
|
4
4
|
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
5
5
|
require('../../vendor/unpromise/unpromise.js');
|
|
6
|
+
require('../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.js');
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { resolveResponse } from '../../unstable-core-do-not-import/http/resolveResponse.mjs';
|
|
2
2
|
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
3
3
|
import '../../vendor/unpromise/unpromise.mjs';
|
|
4
|
+
import '../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.mjs';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var TRPCError = require('../../unstable-core-do-not-import/error/TRPCError.js');
|
|
4
4
|
var formDataToObject = require('../../unstable-core-do-not-import/http/formDataToObject.js');
|
|
5
5
|
require('../../vendor/unpromise/unpromise.js');
|
|
6
|
+
require('../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.js');
|
|
6
7
|
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
7
8
|
var redirect = require('./redirect.js');
|
|
8
9
|
var rethrowNextErrors = require('./rethrowNextErrors.js');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TRPCError, getTRPCErrorFromUnknown } from '../../unstable-core-do-not-import/error/TRPCError.mjs';
|
|
2
2
|
import { formDataToObject } from '../../unstable-core-do-not-import/http/formDataToObject.mjs';
|
|
3
3
|
import '../../vendor/unpromise/unpromise.mjs';
|
|
4
|
+
import '../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.mjs';
|
|
4
5
|
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
5
6
|
import { TRPCRedirectError } from './redirect.mjs';
|
|
6
7
|
import { rethrowNextErrors } from './rethrowNextErrors.mjs';
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var TRPCError = require('../../unstable-core-do-not-import/error/TRPCError.js');
|
|
4
4
|
require('../../vendor/unpromise/unpromise.js');
|
|
5
|
+
require('../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.js');
|
|
5
6
|
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TRPCError } from '../../unstable-core-do-not-import/error/TRPCError.mjs';
|
|
2
2
|
import '../../vendor/unpromise/unpromise.mjs';
|
|
3
|
+
import '../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.mjs';
|
|
3
4
|
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var _define_property = require('../../node_modules/.pnpm/@swc_helpers@0.5.13/node_modules/@swc/helpers/esm/_define_property.js');
|
|
4
4
|
var TRPCError = require('../../unstable-core-do-not-import/error/TRPCError.js');
|
|
5
5
|
require('../../vendor/unpromise/unpromise.js');
|
|
6
|
+
require('../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.js');
|
|
6
7
|
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { _ as _define_property } from '../../node_modules/.pnpm/@swc_helpers@0.5.13/node_modules/@swc/helpers/esm/_define_property.mjs';
|
|
2
2
|
import { TRPCError } from '../../unstable-core-do-not-import/error/TRPCError.mjs';
|
|
3
3
|
import '../../vendor/unpromise/unpromise.mjs';
|
|
4
|
+
import '../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.mjs';
|
|
4
5
|
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
5
6
|
|
|
6
7
|
/**
|
package/dist/adapters/next.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var utils = require('../unstable-core-do-not-import/utils.js');
|
|
4
4
|
var TRPCError = require('../unstable-core-do-not-import/error/TRPCError.js');
|
|
5
5
|
require('../vendor/unpromise/unpromise.js');
|
|
6
|
+
require('../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.js');
|
|
6
7
|
require('../unstable-core-do-not-import/rootConfig.js');
|
|
7
8
|
var nodeHTTPRequestHandler = require('./node-http/nodeHTTPRequestHandler.js');
|
|
8
9
|
|
package/dist/adapters/next.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { run } from '../unstable-core-do-not-import/utils.mjs';
|
|
2
2
|
import { TRPCError } from '../unstable-core-do-not-import/error/TRPCError.mjs';
|
|
3
3
|
import '../vendor/unpromise/unpromise.mjs';
|
|
4
|
+
import '../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.mjs';
|
|
4
5
|
import '../unstable-core-do-not-import/rootConfig.mjs';
|
|
5
6
|
import { nodeHTTPRequestHandler, internal_exceptionHandler } from './node-http/nodeHTTPRequestHandler.mjs';
|
|
6
7
|
|
|
@@ -9,7 +9,7 @@ export declare function createURL(req: http.IncomingMessage): URL;
|
|
|
9
9
|
/**
|
|
10
10
|
* Convert an [`IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage) to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
|
11
11
|
*/
|
|
12
|
-
export declare function incomingMessageToRequest(req: http.IncomingMessage, opts: {
|
|
12
|
+
export declare function incomingMessageToRequest(req: http.IncomingMessage, res: http.ServerResponse, opts: {
|
|
13
13
|
/**
|
|
14
14
|
* Max body size in bytes. If the body is larger than this, the request will be aborted
|
|
15
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incomingMessageToRequest.d.ts","sourceRoot":"","sources":["../../../src/adapters/node-http/incomingMessageToRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,MAAM,CAAC;AAGlC,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,eAAe;IACnE;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAiED,wBAAgB,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,GAAG,GAAG,CAkBxD;AAwBD;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,IAAI,EAAE;IACJ;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,GACA,OAAO,
|
|
1
|
+
{"version":3,"file":"incomingMessageToRequest.d.ts","sourceRoot":"","sources":["../../../src/adapters/node-http/incomingMessageToRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,MAAM,CAAC;AAGlC,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,eAAe;IACnE;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAiED,wBAAgB,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,GAAG,GAAG,CAkBxD;AAwBD;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,IAAI,EAAE;IACJ;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,GACA,OAAO,CAqCT"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var TRPCError = require('../../unstable-core-do-not-import/error/TRPCError.js');
|
|
4
4
|
require('../../vendor/unpromise/unpromise.js');
|
|
5
|
+
require('../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.js');
|
|
5
6
|
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
6
7
|
|
|
7
8
|
function createBody(req, opts) {
|
|
@@ -83,15 +84,16 @@ function createHeaders(incoming) {
|
|
|
83
84
|
}
|
|
84
85
|
/**
|
|
85
86
|
* Convert an [`IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage) to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
|
86
|
-
*/ function incomingMessageToRequest(req, opts) {
|
|
87
|
+
*/ function incomingMessageToRequest(req, res, opts) {
|
|
87
88
|
const ac = new AbortController();
|
|
88
89
|
const onAbort = ()=>{
|
|
90
|
+
res.off('close', onAbort);
|
|
91
|
+
req.socket.off('end', onAbort);
|
|
92
|
+
// abort the request
|
|
89
93
|
ac.abort();
|
|
90
|
-
req.off('aborted', onAbort);
|
|
91
|
-
req.off('close', onAbort);
|
|
92
94
|
};
|
|
93
|
-
|
|
94
|
-
req.socket
|
|
95
|
+
res.once('close', onAbort);
|
|
96
|
+
req.socket.once('end', onAbort);
|
|
95
97
|
// Get host from either regular header or HTTP/2 pseudo-header
|
|
96
98
|
const url = createURL(req);
|
|
97
99
|
const init = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TRPCError } from '../../unstable-core-do-not-import/error/TRPCError.mjs';
|
|
2
2
|
import '../../vendor/unpromise/unpromise.mjs';
|
|
3
|
+
import '../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.mjs';
|
|
3
4
|
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
4
5
|
|
|
5
6
|
function createBody(req, opts) {
|
|
@@ -81,15 +82,16 @@ function createHeaders(incoming) {
|
|
|
81
82
|
}
|
|
82
83
|
/**
|
|
83
84
|
* Convert an [`IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage) to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
|
84
|
-
*/ function incomingMessageToRequest(req, opts) {
|
|
85
|
+
*/ function incomingMessageToRequest(req, res, opts) {
|
|
85
86
|
const ac = new AbortController();
|
|
86
87
|
const onAbort = ()=>{
|
|
88
|
+
res.off('close', onAbort);
|
|
89
|
+
req.socket.off('end', onAbort);
|
|
90
|
+
// abort the request
|
|
87
91
|
ac.abort();
|
|
88
|
-
req.off('aborted', onAbort);
|
|
89
|
-
req.off('close', onAbort);
|
|
90
92
|
};
|
|
91
|
-
|
|
92
|
-
req.socket
|
|
93
|
+
res.once('close', onAbort);
|
|
94
|
+
req.socket.once('end', onAbort);
|
|
93
95
|
// Get host from either regular header or HTTP/2 pseudo-header
|
|
94
96
|
const url = createURL(req);
|
|
95
97
|
const init = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeHTTPRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/node-http/nodeHTTPRequestHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,oBAAoB,CAAC;AAM5B,OAAO,KAAK,EACV,eAAe,EACf,6BAA6B,EAC7B,gBAAgB,EACjB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"nodeHTTPRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/node-http/nodeHTTPRequestHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,oBAAoB,CAAC;AAM5B,OAAO,KAAK,EACV,eAAe,EACf,6BAA6B,EAC7B,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAGjB;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,SAAS,SAAS,EACzB,QAAQ,SAAS,eAAe,EAChC,SAAS,SAAS,gBAAgB,EAClC,IAAI,EAAE,6BAA6B,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,WAClD,OAAO,UA6BvB;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,SAAS,SAAS,EACzB,QAAQ,SAAS,eAAe,EAChC,SAAS,SAAS,gBAAgB,EAClC,IAAI,EAAE,6BAA6B,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,iBA6ClE"}
|
|
@@ -7,7 +7,9 @@ var resolveResponse = require('../../unstable-core-do-not-import/http/resolveRes
|
|
|
7
7
|
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
8
8
|
var transformer = require('../../unstable-core-do-not-import/transformer.js');
|
|
9
9
|
require('../../vendor/unpromise/unpromise.js');
|
|
10
|
+
require('../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.js');
|
|
10
11
|
var incomingMessageToRequest = require('./incomingMessageToRequest.js');
|
|
12
|
+
var writeResponse = require('./writeResponse.js');
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
@@ -57,7 +59,7 @@ var incomingMessageToRequest = require('./incomingMessageToRequest.js');
|
|
|
57
59
|
});
|
|
58
60
|
return handleViaMiddleware(opts.req, opts.res, (err)=>{
|
|
59
61
|
utils.run(async ()=>{
|
|
60
|
-
const
|
|
62
|
+
const request = incomingMessageToRequest.incomingMessageToRequest(opts.req, opts.res, {
|
|
61
63
|
maxBodySize: opts.maxBodySize ?? null
|
|
62
64
|
});
|
|
63
65
|
// Build tRPC dependencies
|
|
@@ -69,7 +71,7 @@ var incomingMessageToRequest = require('./incomingMessageToRequest.js');
|
|
|
69
71
|
};
|
|
70
72
|
const response = await resolveResponse.resolveResponse({
|
|
71
73
|
...opts,
|
|
72
|
-
req,
|
|
74
|
+
req: request,
|
|
73
75
|
error: err ? TRPCError.getTRPCErrorFromUnknown(err) : null,
|
|
74
76
|
createContext,
|
|
75
77
|
onError (o) {
|
|
@@ -79,46 +81,11 @@ var incomingMessageToRequest = require('./incomingMessageToRequest.js');
|
|
|
79
81
|
});
|
|
80
82
|
}
|
|
81
83
|
});
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
for (const [key, value] of response.headers){
|
|
88
|
-
res.setHeader(key, value);
|
|
89
|
-
}
|
|
90
|
-
if (response.body) {
|
|
91
|
-
const reader = response.body.getReader();
|
|
92
|
-
const onAbort = ()=>{
|
|
93
|
-
// cancelling the reader will cause the whole stream to be cancelled
|
|
94
|
-
reader.cancel().catch(()=>{
|
|
95
|
-
// console.error('reader.cancel() error', err);
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
req.signal.addEventListener('abort', onAbort, {
|
|
99
|
-
once: true
|
|
100
|
-
});
|
|
101
|
-
while(true){
|
|
102
|
-
const { done, value } = await reader.read();
|
|
103
|
-
if (done) {
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
if (!res.writable) {
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
if (res.write(value) === false) {
|
|
110
|
-
await new Promise((resolve)=>{
|
|
111
|
-
res.once('drain', resolve);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
// useful for debugging chunked responses:
|
|
115
|
-
// console.log('wrote', Buffer.from(value).toString());
|
|
116
|
-
// IMPORTANT - flush the response buffer, otherwise the client will not receive the data until `.end()`
|
|
117
|
-
res.flush?.();
|
|
118
|
-
}
|
|
119
|
-
req.signal.removeEventListener('abort', onAbort);
|
|
120
|
-
}
|
|
121
|
-
res.end();
|
|
84
|
+
await writeResponse.writeResponse({
|
|
85
|
+
request,
|
|
86
|
+
response,
|
|
87
|
+
rawResponse: opts.res
|
|
88
|
+
});
|
|
122
89
|
}).catch(internal_exceptionHandler(opts));
|
|
123
90
|
});
|
|
124
91
|
});
|
|
@@ -5,7 +5,9 @@ import { resolveResponse } from '../../unstable-core-do-not-import/http/resolveR
|
|
|
5
5
|
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
6
6
|
import { transformTRPCResponse } from '../../unstable-core-do-not-import/transformer.mjs';
|
|
7
7
|
import '../../vendor/unpromise/unpromise.mjs';
|
|
8
|
+
import '../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.mjs';
|
|
8
9
|
import { incomingMessageToRequest } from './incomingMessageToRequest.mjs';
|
|
10
|
+
import { writeResponse } from './writeResponse.mjs';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
@@ -55,7 +57,7 @@ import { incomingMessageToRequest } from './incomingMessageToRequest.mjs';
|
|
|
55
57
|
});
|
|
56
58
|
return handleViaMiddleware(opts.req, opts.res, (err)=>{
|
|
57
59
|
run(async ()=>{
|
|
58
|
-
const
|
|
60
|
+
const request = incomingMessageToRequest(opts.req, opts.res, {
|
|
59
61
|
maxBodySize: opts.maxBodySize ?? null
|
|
60
62
|
});
|
|
61
63
|
// Build tRPC dependencies
|
|
@@ -67,7 +69,7 @@ import { incomingMessageToRequest } from './incomingMessageToRequest.mjs';
|
|
|
67
69
|
};
|
|
68
70
|
const response = await resolveResponse({
|
|
69
71
|
...opts,
|
|
70
|
-
req,
|
|
72
|
+
req: request,
|
|
71
73
|
error: err ? getTRPCErrorFromUnknown(err) : null,
|
|
72
74
|
createContext,
|
|
73
75
|
onError (o) {
|
|
@@ -77,46 +79,11 @@ import { incomingMessageToRequest } from './incomingMessageToRequest.mjs';
|
|
|
77
79
|
});
|
|
78
80
|
}
|
|
79
81
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
for (const [key, value] of response.headers){
|
|
86
|
-
res.setHeader(key, value);
|
|
87
|
-
}
|
|
88
|
-
if (response.body) {
|
|
89
|
-
const reader = response.body.getReader();
|
|
90
|
-
const onAbort = ()=>{
|
|
91
|
-
// cancelling the reader will cause the whole stream to be cancelled
|
|
92
|
-
reader.cancel().catch(()=>{
|
|
93
|
-
// console.error('reader.cancel() error', err);
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
req.signal.addEventListener('abort', onAbort, {
|
|
97
|
-
once: true
|
|
98
|
-
});
|
|
99
|
-
while(true){
|
|
100
|
-
const { done, value } = await reader.read();
|
|
101
|
-
if (done) {
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
if (!res.writable) {
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
if (res.write(value) === false) {
|
|
108
|
-
await new Promise((resolve)=>{
|
|
109
|
-
res.once('drain', resolve);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
// useful for debugging chunked responses:
|
|
113
|
-
// console.log('wrote', Buffer.from(value).toString());
|
|
114
|
-
// IMPORTANT - flush the response buffer, otherwise the client will not receive the data until `.end()`
|
|
115
|
-
res.flush?.();
|
|
116
|
-
}
|
|
117
|
-
req.signal.removeEventListener('abort', onAbort);
|
|
118
|
-
}
|
|
119
|
-
res.end();
|
|
82
|
+
await writeResponse({
|
|
83
|
+
request,
|
|
84
|
+
response,
|
|
85
|
+
rawResponse: opts.res
|
|
86
|
+
});
|
|
120
87
|
}).catch(internal_exceptionHandler(opts));
|
|
121
88
|
});
|
|
122
89
|
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { NodeHTTPResponse } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare function writeResponseBody(opts: {
|
|
6
|
+
res: NodeHTTPResponse;
|
|
7
|
+
signal: AbortSignal;
|
|
8
|
+
body: NonNullable<Response['body']>;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function writeResponse(opts: {
|
|
14
|
+
request: Request;
|
|
15
|
+
response: Response;
|
|
16
|
+
rawResponse: NodeHTTPResponse;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=writeResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeResponse.d.ts","sourceRoot":"","sources":["../../../src/adapters/node-http/writeResponse.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAyBhD;;GAEG;AAEH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,gBAAgB,CAAC;IACtB,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;CACrC,iBAoBA;AACD;;GAEG;AAEH,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,gBAAgB,CAAC;CAC/B,iBA0BA"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var isAbortError = require('../../unstable-core-do-not-import/http/isAbortError.js');
|
|
4
|
+
require('../../vendor/unpromise/unpromise.js');
|
|
5
|
+
require('../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.js');
|
|
6
|
+
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line no-restricted-imports
|
|
9
|
+
async function writeResponseBodyChunk(res, chunk) {
|
|
10
|
+
if (res.write(chunk) === false) {
|
|
11
|
+
await new Promise((resolve, reject)=>{
|
|
12
|
+
const onError = (err)=>{
|
|
13
|
+
reject(err);
|
|
14
|
+
cleanup();
|
|
15
|
+
};
|
|
16
|
+
const onDrain = ()=>{
|
|
17
|
+
resolve();
|
|
18
|
+
cleanup();
|
|
19
|
+
};
|
|
20
|
+
const cleanup = ()=>{
|
|
21
|
+
res.off('error', onError);
|
|
22
|
+
res.off('drain', onDrain);
|
|
23
|
+
};
|
|
24
|
+
res.once('error', onError);
|
|
25
|
+
res.once('drain', onDrain);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/ async function writeResponseBody(opts) {
|
|
32
|
+
const { res } = opts;
|
|
33
|
+
try {
|
|
34
|
+
const writableStream = new WritableStream({
|
|
35
|
+
async write (chunk) {
|
|
36
|
+
await writeResponseBodyChunk(res, chunk);
|
|
37
|
+
res.flush?.();
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
await opts.body.pipeTo(writableStream, {
|
|
41
|
+
signal: opts.signal
|
|
42
|
+
});
|
|
43
|
+
} catch (err) {
|
|
44
|
+
if (isAbortError.isAbortError(err)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
throw err;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @internal
|
|
52
|
+
*/ async function writeResponse(opts) {
|
|
53
|
+
const { response, rawResponse } = opts;
|
|
54
|
+
// Only override status code if it hasn't been explicitly set in a procedure etc
|
|
55
|
+
if (rawResponse.statusCode === 200) {
|
|
56
|
+
rawResponse.statusCode = response.status;
|
|
57
|
+
}
|
|
58
|
+
for (const [key, value] of response.headers){
|
|
59
|
+
rawResponse.setHeader(key, value);
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
if (response.body) {
|
|
63
|
+
await writeResponseBody({
|
|
64
|
+
res: rawResponse,
|
|
65
|
+
signal: opts.request.signal,
|
|
66
|
+
body: response.body
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
} catch (err) {
|
|
70
|
+
if (!rawResponse.headersSent) {
|
|
71
|
+
rawResponse.statusCode = 500;
|
|
72
|
+
}
|
|
73
|
+
throw err;
|
|
74
|
+
} finally{
|
|
75
|
+
rawResponse.end();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
exports.writeResponse = writeResponse;
|
|
80
|
+
exports.writeResponseBody = writeResponseBody;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { isAbortError } from '../../unstable-core-do-not-import/http/isAbortError.mjs';
|
|
2
|
+
import '../../vendor/unpromise/unpromise.mjs';
|
|
3
|
+
import '../../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.mjs';
|
|
4
|
+
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line no-restricted-imports
|
|
7
|
+
async function writeResponseBodyChunk(res, chunk) {
|
|
8
|
+
if (res.write(chunk) === false) {
|
|
9
|
+
await new Promise((resolve, reject)=>{
|
|
10
|
+
const onError = (err)=>{
|
|
11
|
+
reject(err);
|
|
12
|
+
cleanup();
|
|
13
|
+
};
|
|
14
|
+
const onDrain = ()=>{
|
|
15
|
+
resolve();
|
|
16
|
+
cleanup();
|
|
17
|
+
};
|
|
18
|
+
const cleanup = ()=>{
|
|
19
|
+
res.off('error', onError);
|
|
20
|
+
res.off('drain', onDrain);
|
|
21
|
+
};
|
|
22
|
+
res.once('error', onError);
|
|
23
|
+
res.once('drain', onDrain);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
*/ async function writeResponseBody(opts) {
|
|
30
|
+
const { res } = opts;
|
|
31
|
+
try {
|
|
32
|
+
const writableStream = new WritableStream({
|
|
33
|
+
async write (chunk) {
|
|
34
|
+
await writeResponseBodyChunk(res, chunk);
|
|
35
|
+
res.flush?.();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
await opts.body.pipeTo(writableStream, {
|
|
39
|
+
signal: opts.signal
|
|
40
|
+
});
|
|
41
|
+
} catch (err) {
|
|
42
|
+
if (isAbortError(err)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
throw err;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @internal
|
|
50
|
+
*/ async function writeResponse(opts) {
|
|
51
|
+
const { response, rawResponse } = opts;
|
|
52
|
+
// Only override status code if it hasn't been explicitly set in a procedure etc
|
|
53
|
+
if (rawResponse.statusCode === 200) {
|
|
54
|
+
rawResponse.statusCode = response.status;
|
|
55
|
+
}
|
|
56
|
+
for (const [key, value] of response.headers){
|
|
57
|
+
rawResponse.setHeader(key, value);
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
if (response.body) {
|
|
61
|
+
await writeResponseBody({
|
|
62
|
+
res: rawResponse,
|
|
63
|
+
signal: opts.request.signal,
|
|
64
|
+
body: response.body
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
} catch (err) {
|
|
68
|
+
if (!rawResponse.headersSent) {
|
|
69
|
+
rawResponse.statusCode = 500;
|
|
70
|
+
}
|
|
71
|
+
throw err;
|
|
72
|
+
} finally{
|
|
73
|
+
rawResponse.end();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { writeResponse, writeResponseBody };
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var http = require('node:http');
|
|
4
4
|
var utils = require('../unstable-core-do-not-import/utils.js');
|
|
5
5
|
require('../vendor/unpromise/unpromise.js');
|
|
6
|
+
require('../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.js');
|
|
6
7
|
require('../unstable-core-do-not-import/rootConfig.js');
|
|
7
8
|
var nodeHTTPRequestHandler = require('./node-http/nodeHTTPRequestHandler.js');
|
|
8
9
|
var incomingMessageToRequest = require('./node-http/incomingMessageToRequest.js');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import http from 'node:http';
|
|
2
2
|
import { run } from '../unstable-core-do-not-import/utils.mjs';
|
|
3
3
|
import '../vendor/unpromise/unpromise.mjs';
|
|
4
|
+
import '../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.mjs';
|
|
4
5
|
import '../unstable-core-do-not-import/rootConfig.mjs';
|
|
5
6
|
import { nodeHTTPRequestHandler, internal_exceptionHandler } from './node-http/nodeHTTPRequestHandler.mjs';
|
|
6
7
|
import { createURL } from './node-http/incomingMessageToRequest.mjs';
|
package/dist/adapters/ws.js
CHANGED
|
@@ -8,6 +8,7 @@ var parseTRPCMessage = require('../unstable-core-do-not-import/rpc/parseTRPCMess
|
|
|
8
8
|
var observable = require('../observable/observable.js');
|
|
9
9
|
var unpromise = require('../vendor/unpromise/unpromise.js');
|
|
10
10
|
var tracked = require('../unstable-core-do-not-import/stream/tracked.js');
|
|
11
|
+
require('../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.js');
|
|
11
12
|
var transformer = require('../unstable-core-do-not-import/transformer.js');
|
|
12
13
|
require('../unstable-core-do-not-import/rootConfig.js');
|
|
13
14
|
var router = require('../unstable-core-do-not-import/router.js');
|
package/dist/adapters/ws.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { parseTRPCMessage } from '../unstable-core-do-not-import/rpc/parseTRPCMe
|
|
|
6
6
|
import { isObservable, observableToAsyncIterable } from '../observable/observable.mjs';
|
|
7
7
|
import { Unpromise } from '../vendor/unpromise/unpromise.mjs';
|
|
8
8
|
import { isTrackedEnvelope } from '../unstable-core-do-not-import/stream/tracked.mjs';
|
|
9
|
+
import '../unstable-core-do-not-import/stream/utils/disposablePromiseTimer.mjs';
|
|
9
10
|
import { transformTRPCResponse } from '../unstable-core-do-not-import/transformer.mjs';
|
|
10
11
|
import '../unstable-core-do-not-import/rootConfig.mjs';
|
|
11
12
|
import { callProcedure } from '../unstable-core-do-not-import/router.mjs';
|