@trpc/server 10.11.1 → 10.13.0

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.
Files changed (75) hide show
  1. package/dist/TRPCError-ef1ceb74.js +55 -0
  2. package/dist/adapters/aws-lambda/index.js +2 -2
  3. package/dist/adapters/aws-lambda/index.mjs +2 -2
  4. package/dist/adapters/express.js +3 -3
  5. package/dist/adapters/express.mjs +3 -3
  6. package/dist/adapters/fastify/index.js +3 -3
  7. package/dist/adapters/fastify/index.mjs +3 -3
  8. package/dist/adapters/fetch/index.js +3 -3
  9. package/dist/adapters/fetch/index.mjs +3 -3
  10. package/dist/adapters/next.js +3 -3
  11. package/dist/adapters/next.mjs +3 -3
  12. package/dist/adapters/node-http/index.js +3 -3
  13. package/dist/adapters/node-http/index.mjs +3 -3
  14. package/dist/adapters/standalone.js +3 -3
  15. package/dist/adapters/standalone.mjs +3 -3
  16. package/dist/adapters/ws.js +10 -10
  17. package/dist/adapters/ws.mjs +10 -10
  18. package/dist/codes-ec2bad91.js +45 -0
  19. package/dist/{config-d356ff77.js → config-cc5b2d45.js} +1 -1
  20. package/dist/{config-4ca0221b.mjs → config-cd794c2a.mjs} +1 -1
  21. package/dist/config-e8f70019.js +225 -0
  22. package/dist/core/index.d.ts +1 -0
  23. package/dist/core/index.d.ts.map +1 -1
  24. package/dist/core/internals/config.d.ts +4 -1
  25. package/dist/core/internals/config.d.ts.map +1 -1
  26. package/dist/core/internals/procedureBuilder.d.ts +3 -6
  27. package/dist/core/internals/procedureBuilder.d.ts.map +1 -1
  28. package/dist/error/TRPCError.d.ts +1 -1
  29. package/dist/http/index.js +2 -2
  30. package/dist/http/index.mjs +2 -2
  31. package/dist/http/resolveHTTPResponse.d.ts.map +1 -1
  32. package/dist/index-f38f12ba.js +47 -0
  33. package/dist/index.js +1 -1
  34. package/dist/index.mjs +2 -2
  35. package/dist/internals.d.ts +2 -3
  36. package/dist/internals.d.ts.map +1 -1
  37. package/dist/{nodeHTTPRequestHandler-34404221.mjs → nodeHTTPRequestHandler-85d2b636.mjs} +1 -1
  38. package/dist/{nodeHTTPRequestHandler-64cf5f55.js → nodeHTTPRequestHandler-a649e036.js} +1 -1
  39. package/dist/nodeHTTPRequestHandler-fa0b13d4.js +76 -0
  40. package/dist/observable-a1c2103f.js +83 -0
  41. package/dist/{resolveHTTPResponse-3408bbf7.js → resolveHTTPResponse-6cffb0ce.js} +4 -3
  42. package/dist/{resolveHTTPResponse-b831e644.mjs → resolveHTTPResponse-7a4f75b3.mjs} +4 -3
  43. package/dist/resolveHTTPResponse-fed650e4.js +205 -0
  44. package/dist/subscription.js +3 -3
  45. package/dist/subscription.mjs +3 -3
  46. package/dist/transformTRPCResponse-896669e0.js +28 -0
  47. package/dist/transformer.d.ts +35 -8
  48. package/dist/transformer.d.ts.map +1 -1
  49. package/package.json +10 -14
  50. package/src/adapters/fastify/fastifyRequestHandler.ts +1 -1
  51. package/src/adapters/fetch/fetchRequestHandler.ts +1 -1
  52. package/src/adapters/ws.ts +9 -9
  53. package/src/core/index.ts +1 -0
  54. package/src/core/internals/config.ts +7 -2
  55. package/src/core/internals/procedureBuilder.ts +9 -20
  56. package/src/http/resolveHTTPResponse.ts +3 -2
  57. package/src/internals.ts +2 -3
  58. package/src/observable/observable.test.ts +15 -15
  59. package/src/observable/operators/map.test.ts +2 -2
  60. package/src/observable/operators/share.test.ts +9 -9
  61. package/src/subscription.ts +3 -3
  62. package/src/transformer.ts +36 -8
  63. package/adapters/aws-lambda/dist/trpc-server-adapters-aws-lambda.cjs.d.ts +0 -1
  64. package/adapters/aws-lambda/dist/trpc-server-adapters-aws-lambda.cjs.dev.js +0 -190
  65. package/adapters/aws-lambda/dist/trpc-server-adapters-aws-lambda.cjs.js +0 -7
  66. package/adapters/aws-lambda/dist/trpc-server-adapters-aws-lambda.cjs.prod.js +0 -190
  67. package/adapters/aws-lambda/dist/trpc-server-adapters-aws-lambda.esm.js +0 -186
  68. package/adapters/fastify/dist/trpc-server-adapters-fastify.cjs.d.ts +0 -1
  69. package/adapters/fastify/dist/trpc-server-adapters-fastify.cjs.dev.js +0 -109
  70. package/adapters/fastify/dist/trpc-server-adapters-fastify.cjs.js +0 -7
  71. package/adapters/fastify/dist/trpc-server-adapters-fastify.cjs.prod.js +0 -109
  72. package/adapters/fastify/dist/trpc-server-adapters-fastify.esm.js +0 -104
  73. package/dist/core/internals/__generated__/mergeRoutersGeneric.d.ts +0 -202
  74. package/dist/core/internals/__generated__/mergeRoutersGeneric.d.ts.map +0 -1
  75. package/src/core/internals/__generated__/mergeRoutersGeneric.ts +0 -306
@@ -1,186 +0,0 @@
1
- import { T as TRPCError } from '../../../dist/transformTRPCResponse-56464e52.esm.js';
2
- import '../../../dist/router-a3fe3182.esm.js';
3
- import 'events';
4
- import 'http';
5
- import 'url';
6
- import '../../../dist/nodeHTTPRequestHandler-4e09fc4c.esm.js';
7
- import { r as resolveHTTPResponse } from '../../../dist/resolveHTTPResponse-fcf14f5a.esm.js';
8
- import '../../../dist/codes-5678cc97.esm.js';
9
-
10
- function isPayloadV1(event) {
11
- return determinePayloadFormat(event) == '1.0';
12
- }
13
- function isPayloadV2(event) {
14
- return determinePayloadFormat(event) == '2.0';
15
- }
16
-
17
- function determinePayloadFormat(event) {
18
- // https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
19
- // According to AWS support, version is is extracted from the version property in the event.
20
- // If there is no version property, then the version is implied as 1.0
21
- const unknownEvent = event;
22
-
23
- if (typeof unknownEvent.version === 'undefined') {
24
- return '1.0';
25
- } else {
26
- if (['1.0', '2.0'].includes(unknownEvent.version)) {
27
- return unknownEvent.version;
28
- } else {
29
- return 'custom';
30
- }
31
- }
32
- }
33
-
34
- const UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE = 'Custom payload format version not handled by this adapter. Please use either 1.0 or 2.0. More information here' + 'https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html';
35
-
36
- function lambdaEventToHTTPRequest(event) {
37
- const query = new URLSearchParams();
38
-
39
- for (const [key, value] of Object.entries((_event$queryStringPar = event.queryStringParameters) !== null && _event$queryStringPar !== void 0 ? _event$queryStringPar : {})) {
40
- var _event$queryStringPar;
41
-
42
- if (typeof value !== 'undefined') {
43
- query.append(key, value);
44
- }
45
- }
46
-
47
- return {
48
- method: getHTTPMethod(event),
49
- query: query,
50
- headers: event.headers,
51
- body: event.body
52
- };
53
- }
54
-
55
- function getHTTPMethod(event) {
56
- if (isPayloadV1(event)) {
57
- return event.httpMethod;
58
- }
59
-
60
- if (isPayloadV2(event)) {
61
- return event.requestContext.http.method;
62
- }
63
-
64
- throw new TRPCError({
65
- code: 'INTERNAL_SERVER_ERROR',
66
- message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
67
- });
68
- }
69
-
70
- function getPath(event) {
71
- if (isPayloadV1(event)) {
72
- const matches = event.resource.matchAll(/\{(.*?)\}/g);
73
-
74
- for (const match of matches) {
75
- const group = match[1];
76
-
77
- if (group.includes('+') && event.pathParameters) {
78
- return event.pathParameters[group.replace('+', '')] || '';
79
- }
80
- }
81
-
82
- return event.path.slice(1);
83
- }
84
-
85
- if (isPayloadV2(event)) {
86
- const matches = event.routeKey.matchAll(/\{(.*?)\}/g);
87
-
88
- for (const match of matches) {
89
- const group = match[1];
90
-
91
- if (group.includes('+') && event.pathParameters) {
92
- return event.pathParameters[group.replace('+', '')] || '';
93
- }
94
- }
95
-
96
- return event.rawPath.slice(1);
97
- }
98
-
99
- throw new TRPCError({
100
- code: 'INTERNAL_SERVER_ERROR',
101
- message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
102
- });
103
- }
104
-
105
- function transformHeaders(headers) {
106
- const obj = {};
107
-
108
- for (const [key, value] of Object.entries(headers)) {
109
- if (typeof value === 'undefined') {
110
- continue;
111
- }
112
-
113
- obj[key] = Array.isArray(value) ? value.join(',') : value;
114
- }
115
-
116
- return obj;
117
- }
118
-
119
- function tRPCOutputToAPIGatewayOutput(event, response) {
120
- if (isPayloadV1(event)) {
121
- var _response$body, _response$headers;
122
-
123
- const resp = {
124
- statusCode: response.status,
125
- body: (_response$body = response.body) !== null && _response$body !== void 0 ? _response$body : '',
126
- headers: transformHeaders((_response$headers = response.headers) !== null && _response$headers !== void 0 ? _response$headers : {})
127
- };
128
- return resp;
129
- } else if (isPayloadV2(event)) {
130
- var _response$body2, _response$headers2;
131
-
132
- const resp = {
133
- statusCode: response.status,
134
- body: (_response$body2 = response.body) !== null && _response$body2 !== void 0 ? _response$body2 : undefined,
135
- headers: transformHeaders((_response$headers2 = response.headers) !== null && _response$headers2 !== void 0 ? _response$headers2 : {})
136
- };
137
- return resp;
138
- } else {
139
- throw new TRPCError({
140
- code: 'INTERNAL_SERVER_ERROR',
141
- message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
142
- });
143
- }
144
- }
145
- /** Will check the createContext of the TRouter and get the parameter of event.
146
- * @internal
147
- **/
148
-
149
-
150
- function awsLambdaRequestHandler(opts) {
151
- return async (event, context) => {
152
- const req = lambdaEventToHTTPRequest(event);
153
- const path = getPath(event);
154
-
155
- const createContext = async function _createContext() {
156
- var _opts$createContext;
157
-
158
- return await ((_opts$createContext = opts.createContext) === null || _opts$createContext === void 0 ? void 0 : _opts$createContext.call(opts, {
159
- event,
160
- context
161
- }));
162
- };
163
-
164
- const response = await resolveHTTPResponse({
165
- router: opts.router,
166
- batching: opts.batching,
167
- responseMeta: opts === null || opts === void 0 ? void 0 : opts.responseMeta,
168
- createContext,
169
- req,
170
- path,
171
- error: null,
172
-
173
- onError(o) {
174
- var _opts$onError;
175
-
176
- opts === null || opts === void 0 ? void 0 : (_opts$onError = opts.onError) === null || _opts$onError === void 0 ? void 0 : _opts$onError.call(opts, { ...o,
177
- req: event
178
- });
179
- }
180
-
181
- });
182
- return tRPCOutputToAPIGatewayOutput(event, response);
183
- };
184
- }
185
-
186
- export { awsLambdaRequestHandler };
@@ -1 +0,0 @@
1
- export * from "../../../dist/declarations/src/adapters/fastify/index";
@@ -1,109 +0,0 @@
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;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./trpc-server-adapters-fastify.cjs.prod.js");
5
- } else {
6
- module.exports = require("./trpc-server-adapters-fastify.cjs.dev.js");
7
- }
@@ -1,109 +0,0 @@
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;
@@ -1,104 +0,0 @@
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 };