@trpc/server 11.0.0-next-beta.206 → 11.0.0-next-beta.216
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/aws-lambda/index.js +14 -105
- package/dist/adapters/aws-lambda/index.mjs +1 -90
- package/dist/adapters/aws-lambda/utils.js +100 -0
- package/dist/adapters/aws-lambda/utils.mjs +93 -0
- package/dist/adapters/express.js +1 -7
- package/dist/adapters/express.mjs +1 -5
- package/dist/adapters/fastify/fastifyRequestHandler.js +81 -0
- package/dist/adapters/fastify/fastifyRequestHandler.mjs +79 -0
- package/dist/adapters/fastify/fastifyTRPCPlugin.js +51 -0
- package/dist/adapters/fastify/fastifyTRPCPlugin.mjs +49 -0
- package/dist/adapters/fastify/index.js +4 -128
- package/dist/adapters/fastify/index.mjs +2 -128
- package/dist/adapters/fetch/fetchRequestHandler.js +118 -0
- package/dist/adapters/fetch/fetchRequestHandler.mjs +116 -0
- package/dist/adapters/fetch/index.js +2 -115
- package/dist/adapters/fetch/index.mjs +1 -116
- package/dist/adapters/next.js +1 -6
- package/dist/adapters/next.mjs +1 -4
- package/dist/adapters/node-http/content-type/form-data/fileUploadHandler.js +161 -0
- package/dist/adapters/node-http/content-type/form-data/fileUploadHandler.mjs +157 -0
- package/dist/adapters/node-http/content-type/form-data/index.js +20 -646
- package/dist/adapters/node-http/content-type/form-data/index.mjs +9 -631
- package/dist/adapters/node-http/content-type/form-data/memoryUploadHandler.js +29 -0
- package/dist/adapters/node-http/content-type/form-data/memoryUploadHandler.mjs +27 -0
- package/dist/adapters/node-http/content-type/form-data/streamSlice.js +46 -0
- package/dist/adapters/node-http/content-type/form-data/streamSlice.mjs +44 -0
- package/dist/adapters/node-http/content-type/form-data/uploadHandler.js +30 -0
- package/dist/adapters/node-http/content-type/form-data/uploadHandler.mjs +26 -0
- package/dist/adapters/node-http/content-type/json/getPostBody.js +42 -0
- package/dist/adapters/node-http/content-type/json/getPostBody.mjs +40 -0
- package/dist/adapters/node-http/content-type/json/index.js +3 -42
- package/dist/adapters/node-http/content-type/json/index.mjs +2 -39
- package/dist/adapters/node-http/index.js +1 -7
- package/dist/adapters/node-http/index.mjs +1 -5
- package/dist/{contentType-72ed9df5.mjs → adapters/node-http/internals/contentType.mjs} +1 -1
- package/dist/{nodeHTTPRequestHandler-83441c73.js → adapters/node-http/nodeHTTPRequestHandler.js} +2 -2
- package/dist/{nodeHTTPRequestHandler-0223fac5.mjs → adapters/node-http/nodeHTTPRequestHandler.mjs} +2 -2
- package/dist/adapters/standalone.js +2 -12
- package/dist/adapters/standalone.mjs +1 -5
- package/dist/adapters/ws.js +0 -2
- package/dist/bundle-analysis.json +97 -97
- package/dist/http.js +1 -3
- package/dist/index.js +10 -12
- package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/index.js +203 -0
- package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/index.mjs +201 -0
- package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/search.js +167 -0
- package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/search.mjs +163 -0
- package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/utils.js +35 -0
- package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/utils.mjs +30 -0
- package/dist/observable.js +1 -3
- package/dist/rpc.js +1 -3
- package/dist/shared.js +2 -4
- package/package.json +4 -4
- package/dist/contentType-24c44bba.js +0 -5
- package/dist/nodeHTTPRequestHandler-aa0dce4e.js +0 -105
- /package/dist/{contentType-d9d22104.js → adapters/node-http/internals/contentType.js} +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var node_stream = require('node:stream');
|
|
4
|
+
|
|
5
|
+
class SliceStream extends node_stream.Transform {
|
|
6
|
+
_transform(chunk, _, done) {
|
|
7
|
+
this.indexOffset += chunk.length;
|
|
8
|
+
if (!this.emitUp && this.indexOffset >= this.startIndex) {
|
|
9
|
+
this.emitUp = true;
|
|
10
|
+
const start = chunk.length - (this.indexOffset - this.startIndex);
|
|
11
|
+
if (this.indexOffset > this.endIndex) {
|
|
12
|
+
const end = chunk.length - (this.indexOffset - this.endIndex);
|
|
13
|
+
this.emitDown = true;
|
|
14
|
+
this.push(chunk.slice(start, end));
|
|
15
|
+
} else {
|
|
16
|
+
this.push(chunk.slice(start, chunk.length));
|
|
17
|
+
}
|
|
18
|
+
done();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (this.emitUp && !this.emitDown) {
|
|
22
|
+
if (this.indexOffset >= this.endIndex) {
|
|
23
|
+
this.emitDown = true;
|
|
24
|
+
this.push(chunk.slice(0, chunk.length - (this.indexOffset - this.endIndex)));
|
|
25
|
+
} else {
|
|
26
|
+
this.push(chunk);
|
|
27
|
+
}
|
|
28
|
+
done();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
done();
|
|
32
|
+
}
|
|
33
|
+
constructor(startIndex = 0, endIndex = Infinity){
|
|
34
|
+
super();
|
|
35
|
+
this.startIndex = startIndex;
|
|
36
|
+
this.endIndex = endIndex;
|
|
37
|
+
this.indexOffset = 0;
|
|
38
|
+
this.emitUp = false;
|
|
39
|
+
this.emitDown = false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function streamSlice(startIndex = 0, endIndex = Infinity) {
|
|
43
|
+
return new SliceStream(startIndex, endIndex);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
exports.streamSlice = streamSlice;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Transform } from 'node:stream';
|
|
2
|
+
|
|
3
|
+
class SliceStream extends Transform {
|
|
4
|
+
_transform(chunk, _, done) {
|
|
5
|
+
this.indexOffset += chunk.length;
|
|
6
|
+
if (!this.emitUp && this.indexOffset >= this.startIndex) {
|
|
7
|
+
this.emitUp = true;
|
|
8
|
+
const start = chunk.length - (this.indexOffset - this.startIndex);
|
|
9
|
+
if (this.indexOffset > this.endIndex) {
|
|
10
|
+
const end = chunk.length - (this.indexOffset - this.endIndex);
|
|
11
|
+
this.emitDown = true;
|
|
12
|
+
this.push(chunk.slice(start, end));
|
|
13
|
+
} else {
|
|
14
|
+
this.push(chunk.slice(start, chunk.length));
|
|
15
|
+
}
|
|
16
|
+
done();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (this.emitUp && !this.emitDown) {
|
|
20
|
+
if (this.indexOffset >= this.endIndex) {
|
|
21
|
+
this.emitDown = true;
|
|
22
|
+
this.push(chunk.slice(0, chunk.length - (this.indexOffset - this.endIndex)));
|
|
23
|
+
} else {
|
|
24
|
+
this.push(chunk);
|
|
25
|
+
}
|
|
26
|
+
done();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
done();
|
|
30
|
+
}
|
|
31
|
+
constructor(startIndex = 0, endIndex = Infinity){
|
|
32
|
+
super();
|
|
33
|
+
this.startIndex = startIndex;
|
|
34
|
+
this.endIndex = endIndex;
|
|
35
|
+
this.indexOffset = 0;
|
|
36
|
+
this.emitUp = false;
|
|
37
|
+
this.emitDown = false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function streamSlice(startIndex = 0, endIndex = Infinity) {
|
|
41
|
+
return new SliceStream(startIndex, endIndex);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { streamSlice };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function composeUploadHandlers(...handlers) {
|
|
4
|
+
return async (part)=>{
|
|
5
|
+
for (const handler of handlers){
|
|
6
|
+
const value = await handler(part);
|
|
7
|
+
if (typeof value !== 'undefined' && value !== null) {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return undefined;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
class MaxPartSizeExceededError extends Error {
|
|
15
|
+
constructor(field, maxBytes){
|
|
16
|
+
super(`Field "${field}" exceeded upload size of ${maxBytes} bytes.`);
|
|
17
|
+
this.field = field;
|
|
18
|
+
this.maxBytes = maxBytes;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
class MaxBodySizeExceededError extends Error {
|
|
22
|
+
constructor(maxBytes){
|
|
23
|
+
super(`Body exceeded upload size of ${maxBytes} bytes.`);
|
|
24
|
+
this.maxBytes = maxBytes;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
exports.MaxBodySizeExceededError = MaxBodySizeExceededError;
|
|
29
|
+
exports.MaxPartSizeExceededError = MaxPartSizeExceededError;
|
|
30
|
+
exports.composeUploadHandlers = composeUploadHandlers;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function composeUploadHandlers(...handlers) {
|
|
2
|
+
return async (part)=>{
|
|
3
|
+
for (const handler of handlers){
|
|
4
|
+
const value = await handler(part);
|
|
5
|
+
if (typeof value !== 'undefined' && value !== null) {
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return undefined;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
class MaxPartSizeExceededError extends Error {
|
|
13
|
+
constructor(field, maxBytes){
|
|
14
|
+
super(`Field "${field}" exceeded upload size of ${maxBytes} bytes.`);
|
|
15
|
+
this.field = field;
|
|
16
|
+
this.maxBytes = maxBytes;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
class MaxBodySizeExceededError extends Error {
|
|
20
|
+
constructor(maxBytes){
|
|
21
|
+
super(`Body exceeded upload size of ${maxBytes} bytes.`);
|
|
22
|
+
this.maxBytes = maxBytes;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { MaxBodySizeExceededError, MaxPartSizeExceededError, composeUploadHandlers };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@trpc/core');
|
|
4
|
+
|
|
5
|
+
// @trpc/server
|
|
6
|
+
async function getPostBody(opts) {
|
|
7
|
+
const { req , maxBodySize =Infinity } = opts;
|
|
8
|
+
return new Promise((resolve)=>{
|
|
9
|
+
if ('body' in req) {
|
|
10
|
+
resolve({
|
|
11
|
+
ok: true,
|
|
12
|
+
data: req.body,
|
|
13
|
+
// If the request headers specifies a content-type, we assume that the body has been preprocessed
|
|
14
|
+
preprocessed: !!req.headers['content-type']?.startsWith('application/json')
|
|
15
|
+
});
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
let body = '';
|
|
19
|
+
let hasBody = false;
|
|
20
|
+
req.on('data', function(data) {
|
|
21
|
+
body += data;
|
|
22
|
+
hasBody = true;
|
|
23
|
+
if (body.length > maxBodySize) {
|
|
24
|
+
resolve({
|
|
25
|
+
ok: false,
|
|
26
|
+
error: new core.TRPCError({
|
|
27
|
+
code: 'PAYLOAD_TOO_LARGE'
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
req.on('end', ()=>{
|
|
33
|
+
resolve({
|
|
34
|
+
ok: true,
|
|
35
|
+
data: hasBody ? body : undefined,
|
|
36
|
+
preprocessed: false
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports.getPostBody = getPostBody;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { TRPCError } from '@trpc/core';
|
|
2
|
+
|
|
3
|
+
// @trpc/server
|
|
4
|
+
async function getPostBody(opts) {
|
|
5
|
+
const { req , maxBodySize =Infinity } = opts;
|
|
6
|
+
return new Promise((resolve)=>{
|
|
7
|
+
if ('body' in req) {
|
|
8
|
+
resolve({
|
|
9
|
+
ok: true,
|
|
10
|
+
data: req.body,
|
|
11
|
+
// If the request headers specifies a content-type, we assume that the body has been preprocessed
|
|
12
|
+
preprocessed: !!req.headers['content-type']?.startsWith('application/json')
|
|
13
|
+
});
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
let body = '';
|
|
17
|
+
let hasBody = false;
|
|
18
|
+
req.on('data', function(data) {
|
|
19
|
+
body += data;
|
|
20
|
+
hasBody = true;
|
|
21
|
+
if (body.length > maxBodySize) {
|
|
22
|
+
resolve({
|
|
23
|
+
ok: false,
|
|
24
|
+
error: new TRPCError({
|
|
25
|
+
code: 'PAYLOAD_TOO_LARGE'
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
req.on('end', ()=>{
|
|
31
|
+
resolve({
|
|
32
|
+
ok: true,
|
|
33
|
+
data: hasBody ? body : undefined,
|
|
34
|
+
preprocessed: false
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { getPostBody };
|
|
@@ -1,53 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var http = require('@trpc/core/http');
|
|
6
|
-
var contentType = require('
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
// @trpc/server
|
|
10
|
-
async function getPostBody(opts) {
|
|
11
|
-
const { req , maxBodySize =Infinity } = opts;
|
|
12
|
-
return new Promise((resolve)=>{
|
|
13
|
-
if ('body' in req) {
|
|
14
|
-
resolve({
|
|
15
|
-
ok: true,
|
|
16
|
-
data: req.body,
|
|
17
|
-
// If the request headers specifies a content-type, we assume that the body has been preprocessed
|
|
18
|
-
preprocessed: !!req.headers['content-type']?.startsWith('application/json')
|
|
19
|
-
});
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
let body = '';
|
|
23
|
-
let hasBody = false;
|
|
24
|
-
req.on('data', function(data) {
|
|
25
|
-
body += data;
|
|
26
|
-
hasBody = true;
|
|
27
|
-
if (body.length > maxBodySize) {
|
|
28
|
-
resolve({
|
|
29
|
-
ok: false,
|
|
30
|
-
error: new core.TRPCError({
|
|
31
|
-
code: 'PAYLOAD_TOO_LARGE'
|
|
32
|
-
})
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
req.on('end', ()=>{
|
|
37
|
-
resolve({
|
|
38
|
-
ok: true,
|
|
39
|
-
data: hasBody ? body : undefined,
|
|
40
|
-
preprocessed: false
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
}
|
|
4
|
+
var contentType = require('../../internals/contentType.js');
|
|
5
|
+
var getPostBody = require('./getPostBody.js');
|
|
45
6
|
|
|
46
7
|
const nodeHTTPJSONContentTypeHandler = contentType.createNodeHTTPContentTypeHandler({
|
|
47
8
|
isMatch (opts) {
|
|
48
9
|
return !!opts.req.headers['content-type']?.startsWith('application/json');
|
|
49
10
|
},
|
|
50
|
-
getBody: getPostBody,
|
|
11
|
+
getBody: getPostBody.getPostBody,
|
|
51
12
|
getInputs: http.getJsonContentTypeInputs
|
|
52
13
|
});
|
|
53
14
|
|
|
@@ -1,43 +1,6 @@
|
|
|
1
1
|
import { getJsonContentTypeInputs } from '@trpc/core/http';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
// @trpc/server
|
|
6
|
-
async function getPostBody(opts) {
|
|
7
|
-
const { req , maxBodySize =Infinity } = opts;
|
|
8
|
-
return new Promise((resolve)=>{
|
|
9
|
-
if ('body' in req) {
|
|
10
|
-
resolve({
|
|
11
|
-
ok: true,
|
|
12
|
-
data: req.body,
|
|
13
|
-
// If the request headers specifies a content-type, we assume that the body has been preprocessed
|
|
14
|
-
preprocessed: !!req.headers['content-type']?.startsWith('application/json')
|
|
15
|
-
});
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
let body = '';
|
|
19
|
-
let hasBody = false;
|
|
20
|
-
req.on('data', function(data) {
|
|
21
|
-
body += data;
|
|
22
|
-
hasBody = true;
|
|
23
|
-
if (body.length > maxBodySize) {
|
|
24
|
-
resolve({
|
|
25
|
-
ok: false,
|
|
26
|
-
error: new TRPCError({
|
|
27
|
-
code: 'PAYLOAD_TOO_LARGE'
|
|
28
|
-
})
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
req.on('end', ()=>{
|
|
33
|
-
resolve({
|
|
34
|
-
ok: true,
|
|
35
|
-
data: hasBody ? body : undefined,
|
|
36
|
-
preprocessed: false
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
}
|
|
2
|
+
import { createNodeHTTPContentTypeHandler } from '../../internals/contentType.mjs';
|
|
3
|
+
import { getPostBody } from './getPostBody.mjs';
|
|
41
4
|
|
|
42
5
|
const nodeHTTPJSONContentTypeHandler = createNodeHTTPContentTypeHandler({
|
|
43
6
|
isMatch (opts) {
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var nodeHTTPRequestHandler = require('../../nodeHTTPRequestHandler-83441c73.js');
|
|
6
|
-
require('@trpc/core/http');
|
|
7
|
-
require('./content-type/json/index.js');
|
|
8
|
-
require('../../contentType-d9d22104.js');
|
|
9
|
-
require('@trpc/core');
|
|
3
|
+
var nodeHTTPRequestHandler = require('./nodeHTTPRequestHandler.js');
|
|
10
4
|
|
|
11
5
|
|
|
12
6
|
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import '@trpc/core/http';
|
|
3
|
-
import './content-type/json/index.mjs';
|
|
4
|
-
import '../../contentType-72ed9df5.mjs';
|
|
5
|
-
import '@trpc/core';
|
|
1
|
+
export { nodeHTTPRequestHandler } from './nodeHTTPRequestHandler.mjs';
|
package/dist/{nodeHTTPRequestHandler-83441c73.js → adapters/node-http/nodeHTTPRequestHandler.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var http = require('@trpc/core/http');
|
|
4
|
-
var
|
|
4
|
+
var index = require('./content-type/json/index.js');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
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`
|
|
@@ -13,7 +13,7 @@ var adapters_nodeHttp_contentType_json_index = require('./adapters/node-http/con
|
|
|
13
13
|
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
14
14
|
* ```
|
|
15
15
|
*/ /* eslint-disable @typescript-eslint/no-non-null-assertion */ // @trpc/server
|
|
16
|
-
const defaultJSONContentTypeHandler =
|
|
16
|
+
const defaultJSONContentTypeHandler = index.nodeHTTPJSONContentTypeHandler();
|
|
17
17
|
async function nodeHTTPRequestHandler(opts) {
|
|
18
18
|
const handleViaMiddleware = opts.middleware ?? ((_req, _res, next)=>next());
|
|
19
19
|
return handleViaMiddleware(opts.req, opts.res, async (err)=>{
|
package/dist/{nodeHTTPRequestHandler-0223fac5.mjs → adapters/node-http/nodeHTTPRequestHandler.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveHTTPResponse, getBatchStreamFormatter } from '@trpc/core/http';
|
|
2
|
-
import { nodeHTTPJSONContentTypeHandler } from './
|
|
2
|
+
import { nodeHTTPJSONContentTypeHandler } from './content-type/json/index.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 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`
|
|
@@ -104,4 +104,4 @@ async function nodeHTTPRequestHandler(opts) {
|
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
export { nodeHTTPRequestHandler
|
|
107
|
+
export { nodeHTTPRequestHandler };
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var http = require('node:http');
|
|
6
|
-
var nodeHTTPRequestHandler = require('
|
|
7
|
-
require('@trpc/core/http');
|
|
8
|
-
require('./node-http/content-type/json/index.js');
|
|
9
|
-
require('../contentType-d9d22104.js');
|
|
10
|
-
require('@trpc/core');
|
|
11
|
-
|
|
12
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
-
|
|
14
|
-
var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
|
|
4
|
+
var nodeHTTPRequestHandler = require('./node-http/nodeHTTPRequestHandler.js');
|
|
15
5
|
|
|
16
6
|
function createHTTPHandler(opts) {
|
|
17
7
|
return async (req, res)=>{
|
|
@@ -29,7 +19,7 @@ function createHTTPHandler(opts) {
|
|
|
29
19
|
}
|
|
30
20
|
function createHTTPServer(opts) {
|
|
31
21
|
const handler = createHTTPHandler(opts);
|
|
32
|
-
return
|
|
22
|
+
return http.createServer(handler);
|
|
33
23
|
}
|
|
34
24
|
|
|
35
25
|
exports.createHTTPHandler = createHTTPHandler;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import http from 'node:http';
|
|
2
|
-
import {
|
|
3
|
-
import '@trpc/core/http';
|
|
4
|
-
import './node-http/content-type/json/index.mjs';
|
|
5
|
-
import '../contentType-72ed9df5.mjs';
|
|
6
|
-
import '@trpc/core';
|
|
2
|
+
import { nodeHTTPRequestHandler } from './node-http/nodeHTTPRequestHandler.mjs';
|
|
7
3
|
|
|
8
4
|
function createHTTPHandler(opts) {
|
|
9
5
|
return async (req, res)=>{
|