@trpc/server 10.0.0-proxy-beta.7 → 10.0.0-proxy-beta.9
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/adapters/aws-lambda/dist/trpc-server-adapters-aws-lambda.cjs.d.ts +1 -0
- package/adapters/aws-lambda/dist/trpc-server-adapters-aws-lambda.cjs.dev.js +190 -0
- package/adapters/aws-lambda/dist/trpc-server-adapters-aws-lambda.cjs.js +7 -0
- package/adapters/aws-lambda/dist/trpc-server-adapters-aws-lambda.cjs.prod.js +190 -0
- package/adapters/aws-lambda/dist/trpc-server-adapters-aws-lambda.esm.js +186 -0
- package/adapters/express/dist/trpc-server-adapters-express.cjs.d.ts +1 -0
- package/adapters/express/dist/trpc-server-adapters-express.cjs.dev.js +23 -0
- package/adapters/express/dist/trpc-server-adapters-express.cjs.js +7 -0
- package/adapters/express/dist/trpc-server-adapters-express.cjs.prod.js +23 -0
- package/adapters/express/dist/trpc-server-adapters-express.esm.js +19 -0
- package/adapters/fastify/dist/trpc-server-adapters-fastify.cjs.d.ts +1 -0
- package/adapters/fastify/dist/trpc-server-adapters-fastify.cjs.dev.js +109 -0
- package/adapters/fastify/dist/trpc-server-adapters-fastify.cjs.js +7 -0
- package/adapters/fastify/dist/trpc-server-adapters-fastify.cjs.prod.js +109 -0
- package/adapters/fastify/dist/trpc-server-adapters-fastify.esm.js +104 -0
- package/adapters/lambda/dist/trpc-server-adapters-lambda.cjs.d.ts +1 -0
- package/adapters/lambda/dist/trpc-server-adapters-lambda.cjs.dev.js +25 -0
- package/adapters/lambda/dist/trpc-server-adapters-lambda.cjs.js +7 -0
- package/adapters/lambda/dist/trpc-server-adapters-lambda.cjs.prod.js +25 -0
- package/adapters/lambda/dist/trpc-server-adapters-lambda.esm.js +21 -0
- package/adapters/next/dist/trpc-server-adapters-next.cjs.d.ts +1 -0
- package/adapters/next/dist/trpc-server-adapters-next.cjs.dev.js +56 -0
- package/adapters/next/dist/trpc-server-adapters-next.cjs.js +7 -0
- package/adapters/next/dist/trpc-server-adapters-next.cjs.prod.js +56 -0
- package/adapters/next/dist/trpc-server-adapters-next.esm.js +52 -0
- package/adapters/node-http/dist/trpc-server-adapters-node-http.cjs.d.ts +1 -0
- package/adapters/node-http/dist/trpc-server-adapters-node-http.cjs.dev.js +13 -0
- package/adapters/node-http/dist/trpc-server-adapters-node-http.cjs.js +7 -0
- package/adapters/node-http/dist/trpc-server-adapters-node-http.cjs.prod.js +13 -0
- package/adapters/node-http/dist/trpc-server-adapters-node-http.esm.js +5 -0
- package/adapters/standalone/dist/trpc-server-adapters-standalone.cjs.d.ts +1 -0
- package/adapters/standalone/dist/trpc-server-adapters-standalone.cjs.dev.js +46 -0
- package/adapters/standalone/dist/trpc-server-adapters-standalone.cjs.js +7 -0
- package/adapters/standalone/dist/trpc-server-adapters-standalone.cjs.prod.js +46 -0
- package/adapters/standalone/dist/trpc-server-adapters-standalone.esm.js +36 -0
- package/adapters/ws/dist/trpc-server-adapters-ws.cjs.d.ts +1 -0
- package/adapters/ws/dist/trpc-server-adapters-ws.cjs.dev.js +363 -0
- package/adapters/ws/dist/trpc-server-adapters-ws.cjs.js +7 -0
- package/adapters/ws/dist/trpc-server-adapters-ws.cjs.prod.js +363 -0
- package/adapters/ws/dist/trpc-server-adapters-ws.esm.js +359 -0
- package/dist/core/router.d.ts +2 -6
- package/dist/core/router.d.ts.map +1 -1
- package/dist/core/types.d.ts +6 -0
- package/dist/core/types.d.ts.map +1 -1
- package/package.json +18 -6
- package/rpc/dist/trpc-server-rpc.cjs.d.ts +1 -0
- package/rpc/dist/trpc-server-rpc.cjs.dev.js +10 -0
- package/rpc/dist/trpc-server-rpc.cjs.js +7 -0
- package/rpc/dist/trpc-server-rpc.cjs.prod.js +10 -0
- package/rpc/dist/trpc-server-rpc.esm.js +1 -0
- package/src/core/router.ts +6 -14
- package/src/core/types.ts +13 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var url = require('url');
|
|
6
|
+
var resolveHTTPResponse = require('../../../dist/resolveHTTPResponse-ab01e4b9.cjs.dev.js');
|
|
7
|
+
var adapters_ws_dist_trpcServerAdaptersWs = require('../../ws/dist/trpc-server-adapters-ws.cjs.dev.js');
|
|
8
|
+
require('../../../dist/transformTRPCResponse-36a41418.cjs.dev.js');
|
|
9
|
+
require('../../../dist/codes-130e62df.cjs.dev.js');
|
|
10
|
+
require('../../../dist/subscription-8bf61685.cjs.dev.js');
|
|
11
|
+
require('events');
|
|
12
|
+
|
|
13
|
+
resolveHTTPResponse.assertNotBrowser();
|
|
14
|
+
async function fastifyRequestHandler(opts) {
|
|
15
|
+
var _opts$req$body;
|
|
16
|
+
|
|
17
|
+
const createContext = async function _createContext() {
|
|
18
|
+
var _opts$createContext;
|
|
19
|
+
|
|
20
|
+
return (_opts$createContext = opts.createContext) === null || _opts$createContext === void 0 ? void 0 : _opts$createContext.call(opts, opts);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const query = opts.req.query ? new url.URLSearchParams(opts.req.query) : new url.URLSearchParams(opts.req.url.split('?')[1]);
|
|
24
|
+
const req = {
|
|
25
|
+
query,
|
|
26
|
+
method: opts.req.method,
|
|
27
|
+
headers: opts.req.headers,
|
|
28
|
+
body: (_opts$req$body = opts.req.body) !== null && _opts$req$body !== void 0 ? _opts$req$body : 'null'
|
|
29
|
+
};
|
|
30
|
+
const result = await resolveHTTPResponse.resolveHTTPResponse({
|
|
31
|
+
req,
|
|
32
|
+
createContext,
|
|
33
|
+
path: opts.path,
|
|
34
|
+
router: opts.router,
|
|
35
|
+
batching: opts.batching,
|
|
36
|
+
responseMeta: opts.responseMeta,
|
|
37
|
+
|
|
38
|
+
onError(o) {
|
|
39
|
+
var _opts$onError;
|
|
40
|
+
|
|
41
|
+
opts === null || opts === void 0 ? void 0 : (_opts$onError = opts.onError) === null || _opts$onError === void 0 ? void 0 : _opts$onError.call(opts, { ...o,
|
|
42
|
+
req: opts.req
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
});
|
|
47
|
+
const {
|
|
48
|
+
res
|
|
49
|
+
} = opts;
|
|
50
|
+
|
|
51
|
+
if ('status' in result && (!res.statusCode || res.statusCode === 200)) {
|
|
52
|
+
res.statusCode = result.status;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
for (const [key, value] of Object.entries((_result$headers = result.headers) !== null && _result$headers !== void 0 ? _result$headers : {})) {
|
|
56
|
+
var _result$headers;
|
|
57
|
+
|
|
58
|
+
if (typeof value === 'undefined') {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
void res.header(key, value);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
await res.send(result.body);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/// <reference types="@fastify/websocket" />
|
|
69
|
+
function fastifyTRPCPlugin(fastify, opts, done) {
|
|
70
|
+
var _opts$prefix;
|
|
71
|
+
|
|
72
|
+
fastify.addContentTypeParser('application/json', {
|
|
73
|
+
parseAs: 'string'
|
|
74
|
+
}, function (_, body, _done) {
|
|
75
|
+
_done(null, body);
|
|
76
|
+
});
|
|
77
|
+
let prefix = (_opts$prefix = opts.prefix) !== null && _opts$prefix !== void 0 ? _opts$prefix : ''; // https://github.com/fastify/fastify-plugin/blob/fe079bef6557a83794bf437e14b9b9edb8a74104/plugin.js#L11
|
|
78
|
+
// @ts-expect-error property 'default' does not exists on type ...
|
|
79
|
+
|
|
80
|
+
if (typeof fastifyTRPCPlugin.default !== 'function') {
|
|
81
|
+
prefix = ''; // handled by fastify internally
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
fastify.all(`${prefix}/:path`, async (req, res) => {
|
|
85
|
+
const path = req.params.path;
|
|
86
|
+
await fastifyRequestHandler({ ...opts.trpcOptions,
|
|
87
|
+
req,
|
|
88
|
+
res,
|
|
89
|
+
path
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
if (opts.useWSS) {
|
|
94
|
+
var _prefix;
|
|
95
|
+
|
|
96
|
+
adapters_ws_dist_trpcServerAdaptersWs.applyWSSHandler({ ...opts.trpcOptions,
|
|
97
|
+
wss: fastify.websocketServer
|
|
98
|
+
}); // eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
99
|
+
|
|
100
|
+
fastify.get((_prefix = prefix) !== null && _prefix !== void 0 ? _prefix : '/', {
|
|
101
|
+
websocket: true
|
|
102
|
+
}, () => {});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
done();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
exports.fastifyRequestHandler = fastifyRequestHandler;
|
|
109
|
+
exports.fastifyTRPCPlugin = fastifyTRPCPlugin;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var url = require('url');
|
|
6
|
+
var resolveHTTPResponse = require('../../../dist/resolveHTTPResponse-9812e803.cjs.prod.js');
|
|
7
|
+
var adapters_ws_dist_trpcServerAdaptersWs = require('../../ws/dist/trpc-server-adapters-ws.cjs.prod.js');
|
|
8
|
+
require('../../../dist/transformTRPCResponse-077b7539.cjs.prod.js');
|
|
9
|
+
require('../../../dist/codes-aff770a3.cjs.prod.js');
|
|
10
|
+
require('../../../dist/subscription-54d50ff1.cjs.prod.js');
|
|
11
|
+
require('events');
|
|
12
|
+
|
|
13
|
+
resolveHTTPResponse.assertNotBrowser();
|
|
14
|
+
async function fastifyRequestHandler(opts) {
|
|
15
|
+
var _opts$req$body;
|
|
16
|
+
|
|
17
|
+
const createContext = async function _createContext() {
|
|
18
|
+
var _opts$createContext;
|
|
19
|
+
|
|
20
|
+
return (_opts$createContext = opts.createContext) === null || _opts$createContext === void 0 ? void 0 : _opts$createContext.call(opts, opts);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const query = opts.req.query ? new url.URLSearchParams(opts.req.query) : new url.URLSearchParams(opts.req.url.split('?')[1]);
|
|
24
|
+
const req = {
|
|
25
|
+
query,
|
|
26
|
+
method: opts.req.method,
|
|
27
|
+
headers: opts.req.headers,
|
|
28
|
+
body: (_opts$req$body = opts.req.body) !== null && _opts$req$body !== void 0 ? _opts$req$body : 'null'
|
|
29
|
+
};
|
|
30
|
+
const result = await resolveHTTPResponse.resolveHTTPResponse({
|
|
31
|
+
req,
|
|
32
|
+
createContext,
|
|
33
|
+
path: opts.path,
|
|
34
|
+
router: opts.router,
|
|
35
|
+
batching: opts.batching,
|
|
36
|
+
responseMeta: opts.responseMeta,
|
|
37
|
+
|
|
38
|
+
onError(o) {
|
|
39
|
+
var _opts$onError;
|
|
40
|
+
|
|
41
|
+
opts === null || opts === void 0 ? void 0 : (_opts$onError = opts.onError) === null || _opts$onError === void 0 ? void 0 : _opts$onError.call(opts, { ...o,
|
|
42
|
+
req: opts.req
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
});
|
|
47
|
+
const {
|
|
48
|
+
res
|
|
49
|
+
} = opts;
|
|
50
|
+
|
|
51
|
+
if ('status' in result && (!res.statusCode || res.statusCode === 200)) {
|
|
52
|
+
res.statusCode = result.status;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
for (const [key, value] of Object.entries((_result$headers = result.headers) !== null && _result$headers !== void 0 ? _result$headers : {})) {
|
|
56
|
+
var _result$headers;
|
|
57
|
+
|
|
58
|
+
if (typeof value === 'undefined') {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
void res.header(key, value);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
await res.send(result.body);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/// <reference types="@fastify/websocket" />
|
|
69
|
+
function fastifyTRPCPlugin(fastify, opts, done) {
|
|
70
|
+
var _opts$prefix;
|
|
71
|
+
|
|
72
|
+
fastify.addContentTypeParser('application/json', {
|
|
73
|
+
parseAs: 'string'
|
|
74
|
+
}, function (_, body, _done) {
|
|
75
|
+
_done(null, body);
|
|
76
|
+
});
|
|
77
|
+
let prefix = (_opts$prefix = opts.prefix) !== null && _opts$prefix !== void 0 ? _opts$prefix : ''; // https://github.com/fastify/fastify-plugin/blob/fe079bef6557a83794bf437e14b9b9edb8a74104/plugin.js#L11
|
|
78
|
+
// @ts-expect-error property 'default' does not exists on type ...
|
|
79
|
+
|
|
80
|
+
if (typeof fastifyTRPCPlugin.default !== 'function') {
|
|
81
|
+
prefix = ''; // handled by fastify internally
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
fastify.all(`${prefix}/:path`, async (req, res) => {
|
|
85
|
+
const path = req.params.path;
|
|
86
|
+
await fastifyRequestHandler({ ...opts.trpcOptions,
|
|
87
|
+
req,
|
|
88
|
+
res,
|
|
89
|
+
path
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
if (opts.useWSS) {
|
|
94
|
+
var _prefix;
|
|
95
|
+
|
|
96
|
+
adapters_ws_dist_trpcServerAdaptersWs.applyWSSHandler({ ...opts.trpcOptions,
|
|
97
|
+
wss: fastify.websocketServer
|
|
98
|
+
}); // eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
99
|
+
|
|
100
|
+
fastify.get((_prefix = prefix) !== null && _prefix !== void 0 ? _prefix : '/', {
|
|
101
|
+
websocket: true
|
|
102
|
+
}, () => {});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
done();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
exports.fastifyRequestHandler = fastifyRequestHandler;
|
|
109
|
+
exports.fastifyTRPCPlugin = fastifyTRPCPlugin;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { URLSearchParams } from 'url';
|
|
2
|
+
import { a as assertNotBrowser, r as resolveHTTPResponse } from '../../../dist/resolveHTTPResponse-fcf14f5a.esm.js';
|
|
3
|
+
import { applyWSSHandler } from '../../ws/dist/trpc-server-adapters-ws.esm.js';
|
|
4
|
+
import '../../../dist/transformTRPCResponse-56464e52.esm.js';
|
|
5
|
+
import '../../../dist/codes-5678cc97.esm.js';
|
|
6
|
+
import '../../../dist/subscription-a5c83df4.esm.js';
|
|
7
|
+
import 'events';
|
|
8
|
+
|
|
9
|
+
assertNotBrowser();
|
|
10
|
+
async function fastifyRequestHandler(opts) {
|
|
11
|
+
var _opts$req$body;
|
|
12
|
+
|
|
13
|
+
const createContext = async function _createContext() {
|
|
14
|
+
var _opts$createContext;
|
|
15
|
+
|
|
16
|
+
return (_opts$createContext = opts.createContext) === null || _opts$createContext === void 0 ? void 0 : _opts$createContext.call(opts, opts);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const query = opts.req.query ? new URLSearchParams(opts.req.query) : new URLSearchParams(opts.req.url.split('?')[1]);
|
|
20
|
+
const req = {
|
|
21
|
+
query,
|
|
22
|
+
method: opts.req.method,
|
|
23
|
+
headers: opts.req.headers,
|
|
24
|
+
body: (_opts$req$body = opts.req.body) !== null && _opts$req$body !== void 0 ? _opts$req$body : 'null'
|
|
25
|
+
};
|
|
26
|
+
const result = await resolveHTTPResponse({
|
|
27
|
+
req,
|
|
28
|
+
createContext,
|
|
29
|
+
path: opts.path,
|
|
30
|
+
router: opts.router,
|
|
31
|
+
batching: opts.batching,
|
|
32
|
+
responseMeta: opts.responseMeta,
|
|
33
|
+
|
|
34
|
+
onError(o) {
|
|
35
|
+
var _opts$onError;
|
|
36
|
+
|
|
37
|
+
opts === null || opts === void 0 ? void 0 : (_opts$onError = opts.onError) === null || _opts$onError === void 0 ? void 0 : _opts$onError.call(opts, { ...o,
|
|
38
|
+
req: opts.req
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
});
|
|
43
|
+
const {
|
|
44
|
+
res
|
|
45
|
+
} = opts;
|
|
46
|
+
|
|
47
|
+
if ('status' in result && (!res.statusCode || res.statusCode === 200)) {
|
|
48
|
+
res.statusCode = result.status;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
for (const [key, value] of Object.entries((_result$headers = result.headers) !== null && _result$headers !== void 0 ? _result$headers : {})) {
|
|
52
|
+
var _result$headers;
|
|
53
|
+
|
|
54
|
+
if (typeof value === 'undefined') {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
void res.header(key, value);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
await res.send(result.body);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/// <reference types="@fastify/websocket" />
|
|
65
|
+
function fastifyTRPCPlugin(fastify, opts, done) {
|
|
66
|
+
var _opts$prefix;
|
|
67
|
+
|
|
68
|
+
fastify.addContentTypeParser('application/json', {
|
|
69
|
+
parseAs: 'string'
|
|
70
|
+
}, function (_, body, _done) {
|
|
71
|
+
_done(null, body);
|
|
72
|
+
});
|
|
73
|
+
let prefix = (_opts$prefix = opts.prefix) !== null && _opts$prefix !== void 0 ? _opts$prefix : ''; // https://github.com/fastify/fastify-plugin/blob/fe079bef6557a83794bf437e14b9b9edb8a74104/plugin.js#L11
|
|
74
|
+
// @ts-expect-error property 'default' does not exists on type ...
|
|
75
|
+
|
|
76
|
+
if (typeof fastifyTRPCPlugin.default !== 'function') {
|
|
77
|
+
prefix = ''; // handled by fastify internally
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
fastify.all(`${prefix}/:path`, async (req, res) => {
|
|
81
|
+
const path = req.params.path;
|
|
82
|
+
await fastifyRequestHandler({ ...opts.trpcOptions,
|
|
83
|
+
req,
|
|
84
|
+
res,
|
|
85
|
+
path
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
if (opts.useWSS) {
|
|
90
|
+
var _prefix;
|
|
91
|
+
|
|
92
|
+
applyWSSHandler({ ...opts.trpcOptions,
|
|
93
|
+
wss: fastify.websocketServer
|
|
94
|
+
}); // eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
95
|
+
|
|
96
|
+
fastify.get((_prefix = prefix) !== null && _prefix !== void 0 ? _prefix : '/', {
|
|
97
|
+
websocket: true
|
|
98
|
+
}, () => {});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
done();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { fastifyRequestHandler, fastifyTRPCPlugin };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../dist/declarations/src/adapters/lambda/index";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var adapters_awsLambda_dist_trpcServerAdaptersAwsLambda = require('../../aws-lambda/dist/trpc-server-adapters-aws-lambda.cjs.dev.js');
|
|
6
|
+
require('../../../dist/transformTRPCResponse-36a41418.cjs.dev.js');
|
|
7
|
+
require('../../../dist/router-ee876044.cjs.dev.js');
|
|
8
|
+
require('../../../dist/resolveHTTPResponse-ab01e4b9.cjs.dev.js');
|
|
9
|
+
require('../../../dist/codes-130e62df.cjs.dev.js');
|
|
10
|
+
require('events');
|
|
11
|
+
require('http');
|
|
12
|
+
require('url');
|
|
13
|
+
require('../../../dist/nodeHTTPRequestHandler-9a93c255.cjs.dev.js');
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated use `aws-lambda` instead
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated use `aws-lambda` instead
|
|
21
|
+
*/
|
|
22
|
+
const lambdaRequestHandler = adapters_awsLambda_dist_trpcServerAdaptersAwsLambda.awsLambdaRequestHandler;
|
|
23
|
+
|
|
24
|
+
exports.awsLambdaRequestHandler = adapters_awsLambda_dist_trpcServerAdaptersAwsLambda.awsLambdaRequestHandler;
|
|
25
|
+
exports.lambdaRequestHandler = lambdaRequestHandler;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var adapters_awsLambda_dist_trpcServerAdaptersAwsLambda = require('../../aws-lambda/dist/trpc-server-adapters-aws-lambda.cjs.prod.js');
|
|
6
|
+
require('../../../dist/transformTRPCResponse-077b7539.cjs.prod.js');
|
|
7
|
+
require('../../../dist/router-aaecbe82.cjs.prod.js');
|
|
8
|
+
require('../../../dist/resolveHTTPResponse-9812e803.cjs.prod.js');
|
|
9
|
+
require('../../../dist/codes-aff770a3.cjs.prod.js');
|
|
10
|
+
require('events');
|
|
11
|
+
require('http');
|
|
12
|
+
require('url');
|
|
13
|
+
require('../../../dist/nodeHTTPRequestHandler-21707788.cjs.prod.js');
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated use `aws-lambda` instead
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated use `aws-lambda` instead
|
|
21
|
+
*/
|
|
22
|
+
const lambdaRequestHandler = adapters_awsLambda_dist_trpcServerAdaptersAwsLambda.awsLambdaRequestHandler;
|
|
23
|
+
|
|
24
|
+
exports.awsLambdaRequestHandler = adapters_awsLambda_dist_trpcServerAdaptersAwsLambda.awsLambdaRequestHandler;
|
|
25
|
+
exports.lambdaRequestHandler = lambdaRequestHandler;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { awsLambdaRequestHandler } from '../../aws-lambda/dist/trpc-server-adapters-aws-lambda.esm.js';
|
|
2
|
+
export { awsLambdaRequestHandler } from '../../aws-lambda/dist/trpc-server-adapters-aws-lambda.esm.js';
|
|
3
|
+
import '../../../dist/transformTRPCResponse-56464e52.esm.js';
|
|
4
|
+
import '../../../dist/router-a3fe3182.esm.js';
|
|
5
|
+
import '../../../dist/resolveHTTPResponse-fcf14f5a.esm.js';
|
|
6
|
+
import '../../../dist/codes-5678cc97.esm.js';
|
|
7
|
+
import 'events';
|
|
8
|
+
import 'http';
|
|
9
|
+
import 'url';
|
|
10
|
+
import '../../../dist/nodeHTTPRequestHandler-4e09fc4c.esm.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated use `aws-lambda` instead
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated use `aws-lambda` instead
|
|
18
|
+
*/
|
|
19
|
+
const lambdaRequestHandler = awsLambdaRequestHandler;
|
|
20
|
+
|
|
21
|
+
export { lambdaRequestHandler };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../dist/declarations/src/adapters/next";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var transformTRPCResponse = require('../../../dist/transformTRPCResponse-36a41418.cjs.dev.js');
|
|
6
|
+
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-9a93c255.cjs.dev.js');
|
|
7
|
+
require('url');
|
|
8
|
+
require('../../../dist/resolveHTTPResponse-ab01e4b9.cjs.dev.js');
|
|
9
|
+
require('../../../dist/codes-130e62df.cjs.dev.js');
|
|
10
|
+
|
|
11
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
12
|
+
function createNextApiHandler(opts) {
|
|
13
|
+
return async (req, res) => {
|
|
14
|
+
function getPath() {
|
|
15
|
+
if (typeof req.query.trpc === 'string') {
|
|
16
|
+
return req.query.trpc;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (Array.isArray(req.query.trpc)) {
|
|
20
|
+
return req.query.trpc.join('/');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const path = getPath();
|
|
27
|
+
|
|
28
|
+
if (path === null) {
|
|
29
|
+
const error = opts.router.getErrorShape({
|
|
30
|
+
error: new transformTRPCResponse.TRPCError({
|
|
31
|
+
message: 'Query "trpc" not found - is the file named `[trpc]`.ts or `[...trpc].ts`?',
|
|
32
|
+
code: 'INTERNAL_SERVER_ERROR'
|
|
33
|
+
}),
|
|
34
|
+
type: 'unknown',
|
|
35
|
+
ctx: undefined,
|
|
36
|
+
path: undefined,
|
|
37
|
+
input: undefined
|
|
38
|
+
});
|
|
39
|
+
const json = {
|
|
40
|
+
id: -1,
|
|
41
|
+
error
|
|
42
|
+
};
|
|
43
|
+
res.statusCode = 500;
|
|
44
|
+
res.json(json);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
await nodeHTTPRequestHandler.nodeHTTPRequestHandler({ ...opts,
|
|
49
|
+
req,
|
|
50
|
+
res,
|
|
51
|
+
path
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
exports.createNextApiHandler = createNextApiHandler;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var transformTRPCResponse = require('../../../dist/transformTRPCResponse-077b7539.cjs.prod.js');
|
|
6
|
+
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-21707788.cjs.prod.js');
|
|
7
|
+
require('url');
|
|
8
|
+
require('../../../dist/resolveHTTPResponse-9812e803.cjs.prod.js');
|
|
9
|
+
require('../../../dist/codes-aff770a3.cjs.prod.js');
|
|
10
|
+
|
|
11
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
12
|
+
function createNextApiHandler(opts) {
|
|
13
|
+
return async (req, res) => {
|
|
14
|
+
function getPath() {
|
|
15
|
+
if (typeof req.query.trpc === 'string') {
|
|
16
|
+
return req.query.trpc;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (Array.isArray(req.query.trpc)) {
|
|
20
|
+
return req.query.trpc.join('/');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const path = getPath();
|
|
27
|
+
|
|
28
|
+
if (path === null) {
|
|
29
|
+
const error = opts.router.getErrorShape({
|
|
30
|
+
error: new transformTRPCResponse.TRPCError({
|
|
31
|
+
message: 'Query "trpc" not found - is the file named `[trpc]`.ts or `[...trpc].ts`?',
|
|
32
|
+
code: 'INTERNAL_SERVER_ERROR'
|
|
33
|
+
}),
|
|
34
|
+
type: 'unknown',
|
|
35
|
+
ctx: undefined,
|
|
36
|
+
path: undefined,
|
|
37
|
+
input: undefined
|
|
38
|
+
});
|
|
39
|
+
const json = {
|
|
40
|
+
id: -1,
|
|
41
|
+
error
|
|
42
|
+
};
|
|
43
|
+
res.statusCode = 500;
|
|
44
|
+
res.json(json);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
await nodeHTTPRequestHandler.nodeHTTPRequestHandler({ ...opts,
|
|
49
|
+
req,
|
|
50
|
+
res,
|
|
51
|
+
path
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
exports.createNextApiHandler = createNextApiHandler;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { T as TRPCError } from '../../../dist/transformTRPCResponse-56464e52.esm.js';
|
|
2
|
+
import { n as nodeHTTPRequestHandler } from '../../../dist/nodeHTTPRequestHandler-4e09fc4c.esm.js';
|
|
3
|
+
import 'url';
|
|
4
|
+
import '../../../dist/resolveHTTPResponse-fcf14f5a.esm.js';
|
|
5
|
+
import '../../../dist/codes-5678cc97.esm.js';
|
|
6
|
+
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
|
+
function createNextApiHandler(opts) {
|
|
9
|
+
return async (req, res) => {
|
|
10
|
+
function getPath() {
|
|
11
|
+
if (typeof req.query.trpc === 'string') {
|
|
12
|
+
return req.query.trpc;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (Array.isArray(req.query.trpc)) {
|
|
16
|
+
return req.query.trpc.join('/');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const path = getPath();
|
|
23
|
+
|
|
24
|
+
if (path === null) {
|
|
25
|
+
const error = opts.router.getErrorShape({
|
|
26
|
+
error: new TRPCError({
|
|
27
|
+
message: 'Query "trpc" not found - is the file named `[trpc]`.ts or `[...trpc].ts`?',
|
|
28
|
+
code: 'INTERNAL_SERVER_ERROR'
|
|
29
|
+
}),
|
|
30
|
+
type: 'unknown',
|
|
31
|
+
ctx: undefined,
|
|
32
|
+
path: undefined,
|
|
33
|
+
input: undefined
|
|
34
|
+
});
|
|
35
|
+
const json = {
|
|
36
|
+
id: -1,
|
|
37
|
+
error
|
|
38
|
+
};
|
|
39
|
+
res.statusCode = 500;
|
|
40
|
+
res.json(json);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
await nodeHTTPRequestHandler({ ...opts,
|
|
45
|
+
req,
|
|
46
|
+
res,
|
|
47
|
+
path
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { createNextApiHandler };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../dist/declarations/src/adapters/node-http/index";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-9a93c255.cjs.dev.js');
|
|
6
|
+
require('url');
|
|
7
|
+
require('../../../dist/resolveHTTPResponse-ab01e4b9.cjs.dev.js');
|
|
8
|
+
require('../../../dist/transformTRPCResponse-36a41418.cjs.dev.js');
|
|
9
|
+
require('../../../dist/codes-130e62df.cjs.dev.js');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
exports.nodeHTTPRequestHandler = nodeHTTPRequestHandler.nodeHTTPRequestHandler;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-21707788.cjs.prod.js');
|
|
6
|
+
require('url');
|
|
7
|
+
require('../../../dist/resolveHTTPResponse-9812e803.cjs.prod.js');
|
|
8
|
+
require('../../../dist/transformTRPCResponse-077b7539.cjs.prod.js');
|
|
9
|
+
require('../../../dist/codes-aff770a3.cjs.prod.js');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
exports.nodeHTTPRequestHandler = nodeHTTPRequestHandler.nodeHTTPRequestHandler;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { n as nodeHTTPRequestHandler } from '../../../dist/nodeHTTPRequestHandler-4e09fc4c.esm.js';
|
|
2
|
+
import 'url';
|
|
3
|
+
import '../../../dist/resolveHTTPResponse-fcf14f5a.esm.js';
|
|
4
|
+
import '../../../dist/transformTRPCResponse-56464e52.esm.js';
|
|
5
|
+
import '../../../dist/codes-5678cc97.esm.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../dist/declarations/src/adapters/standalone";
|