UEA-Prodem

This commit is contained in:
2026-06-10 12:38:42 -03:00
parent 3f33154e16
commit c41625e542
9352 changed files with 1128292 additions and 14752 deletions
+78
View File
@@ -0,0 +1,78 @@
const require_getErrorShape = require('../../getErrorShape-Ed1OwssN.cjs');
require('../../codes-BfZsPdy-.cjs');
require('../../tracked-DFxm8M2u.cjs');
require('../../parseTRPCMessage-7Ltmq-Fb.cjs');
const require_resolveResponse = require('../../resolveResponse-BCkjJQIz.cjs');
require('../../contentTypeParsers-iAFF_pJG.cjs');
require('../../unstable-core-do-not-import-fsjhEhgh.cjs');
require('../../observable-B1Nk6r1H.cjs');
require('../../initTRPC-_cqIfGlH.cjs');
require('../../http-DXy3XyhL.cjs');
const require_node_http = require('../../node-http-bPWQbKlA.cjs');
require('../../observable-BVzLuBs6.cjs');
const require_ws = require('../../ws-CTzlBSdd.cjs');
//#region src/adapters/fastify/fastifyRequestHandler.ts
var import_objectSpread2$1 = require_getErrorShape.__toESM(require_getErrorShape.require_objectSpread2(), 1);
async function fastifyRequestHandler(opts) {
const createContext = async (innerOpts) => {
var _opts$createContext;
return await ((_opts$createContext = opts.createContext) === null || _opts$createContext === void 0 ? void 0 : _opts$createContext.call(opts, (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, opts), innerOpts)));
};
const incomingMessage = opts.req.raw;
if ("body" in opts.req) incomingMessage.body = opts.req.body;
const req = require_node_http.incomingMessageToRequest(incomingMessage, opts.res.raw, { maxBodySize: null });
const res = await require_resolveResponse.resolveResponse((0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, opts), {}, {
req,
error: null,
createContext,
onError(o) {
var _opts$onError;
opts === null || opts === void 0 || (_opts$onError = opts.onError) === null || _opts$onError === void 0 || _opts$onError.call(opts, (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, o), {}, { req: opts.req }));
}
}));
await opts.res.send(res);
}
//#endregion
//#region src/adapters/fastify/fastifyTRPCPlugin.ts
var import_objectSpread2 = require_getErrorShape.__toESM(require_getErrorShape.require_objectSpread2(), 1);
function fastifyTRPCPlugin(fastify, opts, done) {
var _opts$prefix;
fastify.removeContentTypeParser("application/json");
fastify.addContentTypeParser("application/json", { parseAs: "string" }, function(_, body, _done) {
_done(null, body);
});
fastify.removeContentTypeParser("multipart/form-data");
fastify.addContentTypeParser("multipart/form-data", {}, function(_, body, _done) {
_done(null, body);
});
let prefix = (_opts$prefix = opts.prefix) !== null && _opts$prefix !== void 0 ? _opts$prefix : "";
if (typeof fastifyTRPCPlugin.default !== "function") prefix = "";
fastify.all(`${prefix}/:path`, async (req, res) => {
const path = req.params.path;
await fastifyRequestHandler((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts.trpcOptions), {}, {
req,
res,
path
}));
});
if (opts.useWSS) {
var _prefix;
const trpcOptions = opts.trpcOptions;
const onConnection = require_ws.getWSConnectionHandler((0, import_objectSpread2.default)({}, trpcOptions));
fastify.get((_prefix = prefix) !== null && _prefix !== void 0 ? _prefix : "/", { websocket: true }, (socket, req) => {
var _trpcOptions$keepAliv;
onConnection(socket, req.raw);
if (trpcOptions === null || trpcOptions === void 0 || (_trpcOptions$keepAliv = trpcOptions.keepAlive) === null || _trpcOptions$keepAliv === void 0 ? void 0 : _trpcOptions$keepAliv.enabled) {
const { pingMs, pongWaitMs } = trpcOptions.keepAlive;
require_ws.handleKeepAlive(socket, pingMs, pongWaitMs);
}
});
}
done();
}
//#endregion
exports.fastifyRequestHandler = fastifyRequestHandler;
exports.fastifyTRPCPlugin = fastifyTRPCPlugin;
+29
View File
@@ -0,0 +1,29 @@
import "../../index.d-BiUz7kM_.cjs";
import { AnyRouter, HTTPBaseHandlerOptions } from "../../unstable-core-do-not-import.d-Dh9CT5RO.cjs";
import "../../index.d-CvZXeEyR.cjs";
import { NodeHTTPCreateContextFnOptions, NodeHTTPCreateContextOption } from "../../index.d-fBAdSX6g.cjs";
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
//#region src/adapters/fastify/fastifyRequestHandler.d.ts
type FastifyHandlerOptions<TRouter extends AnyRouter, TRequest extends FastifyRequest, TResponse extends FastifyReply> = HTTPBaseHandlerOptions<TRouter, TRequest> & NodeHTTPCreateContextOption<TRouter, TRequest, TResponse>;
type FastifyRequestHandlerOptions<TRouter extends AnyRouter, TRequest extends FastifyRequest, TResponse extends FastifyReply> = FastifyHandlerOptions<TRouter, TRequest, TResponse> & {
req: TRequest;
res: TResponse;
path: string;
};
declare function fastifyRequestHandler<TRouter extends AnyRouter, TRequest extends FastifyRequest, TResponse extends FastifyReply>(opts: FastifyRequestHandlerOptions<TRouter, TRequest, TResponse>): Promise<void>;
//#endregion
//#region src/adapters/fastify/fastifyTRPCPlugin.d.ts
interface FastifyTRPCPluginOptions<TRouter extends AnyRouter> {
prefix?: string;
useWSS?: boolean;
trpcOptions: FastifyHandlerOptions<TRouter, FastifyRequest, FastifyReply>;
}
type CreateFastifyContextOptions = NodeHTTPCreateContextFnOptions<FastifyRequest, FastifyReply>;
declare function fastifyTRPCPlugin<TRouter extends AnyRouter>(fastify: FastifyInstance, opts: FastifyTRPCPluginOptions<TRouter>, done: (err?: Error) => void): void;
//# sourceMappingURL=fastifyTRPCPlugin.d.ts.map
//#endregion
export { CreateFastifyContextOptions, FastifyHandlerOptions, FastifyTRPCPluginOptions, fastifyRequestHandler, fastifyTRPCPlugin };
//# sourceMappingURL=index.d.cts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/adapters/fastify/fastifyRequestHandler.ts","../../../src/adapters/fastify/fastifyTRPCPlugin.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA6BoC,KAJxB,qBAIwB,CAAA,gBAHlB,SAGkB,EAAA,iBAFjB,cAEiB,EAAA,kBADhB,YACgB,CAAA,GAAhC,sBAAgC,CAAT,OAAS,EAAA,QAAA,CAAA,GAClC,2BADkC,CACN,OADM,EACG,QADH,EACa,SADb,CAAA;KAG/B,4BAHD,CAAA,gBAIc,SAJd,EAAA,iBAKe,cALf,EAAA,kBAMgB,YANhB,CAAA,GAOA,qBAPA,CAOsB,OAPtB,EAO+B,QAP/B,EAOyC,SAPzC,CAAA,GAAA;EAAsB,GACI,EAOvB,QAPuB;EAAO,GAAE,EAQhC,SARgC;EAAQ,IAAE,EAAA,MAAA;CAAS;AAA7B,iBAYP,qBAZO,CAAA,gBAaX,SAbW,EAAA,iBAcV,cAdU,EAAA,kBAeT,YAfS,CAAA,CAAA,IAAA,EAgBrB,4BAhBqB,CAgBQ,OAhBR,EAgBiB,QAhBjB,EAgB2B,SAhB3B,CAAA,CAAA,EAgBqC,OAhBrC,CAAA,IAAA,CAAA;;;AADO,UCLnB,wBDKmB,CAAA,gBCLsB,SDKtB,CAAA,CAAA;EAAQ,MAAxC,CAAA,EAAA,MAAA;EAAsB,MACI,CAAA,EAAA,OAAA;EAAO,WAAE,ECHxB,qBDGwB,CCHF,ODGE,ECHO,cDGP,ECHuB,YDGvB,CAAA;;AAArC,KCAU,2BAAA,GAA8B,8BDAxC,CCCA,cDDA,ECEA,YDFA,CAAA;AAA2B,iBCKb,iBDLa,CAAA,gBCKqB,SDLrB,CAAA,CAAA,OAAA,ECMlB,eDNkB,EAAA,IAAA,ECOrB,wBDPqB,CCOI,ODPJ,CAAA,EAAA,IAAA,EAAA,CAAA,GAAA,CAAA,ECQd,KDRc,EAAA,GAAA,IAAA,CAAA,EAAA,IAAA;AAA+B"}
+29
View File
@@ -0,0 +1,29 @@
import "../../index.d-D4qZxQJh.mjs";
import { AnyRouter, HTTPBaseHandlerOptions } from "../../unstable-core-do-not-import.d-BdVSvUCr.mjs";
import "../../index.d-vq_QHko2.mjs";
import { NodeHTTPCreateContextFnOptions, NodeHTTPCreateContextOption } from "../../index.d-DhhodpGb.mjs";
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
//#region src/adapters/fastify/fastifyRequestHandler.d.ts
type FastifyHandlerOptions<TRouter extends AnyRouter, TRequest extends FastifyRequest, TResponse extends FastifyReply> = HTTPBaseHandlerOptions<TRouter, TRequest> & NodeHTTPCreateContextOption<TRouter, TRequest, TResponse>;
type FastifyRequestHandlerOptions<TRouter extends AnyRouter, TRequest extends FastifyRequest, TResponse extends FastifyReply> = FastifyHandlerOptions<TRouter, TRequest, TResponse> & {
req: TRequest;
res: TResponse;
path: string;
};
declare function fastifyRequestHandler<TRouter extends AnyRouter, TRequest extends FastifyRequest, TResponse extends FastifyReply>(opts: FastifyRequestHandlerOptions<TRouter, TRequest, TResponse>): Promise<void>;
//#endregion
//#region src/adapters/fastify/fastifyTRPCPlugin.d.ts
interface FastifyTRPCPluginOptions<TRouter extends AnyRouter> {
prefix?: string;
useWSS?: boolean;
trpcOptions: FastifyHandlerOptions<TRouter, FastifyRequest, FastifyReply>;
}
type CreateFastifyContextOptions = NodeHTTPCreateContextFnOptions<FastifyRequest, FastifyReply>;
declare function fastifyTRPCPlugin<TRouter extends AnyRouter>(fastify: FastifyInstance, opts: FastifyTRPCPluginOptions<TRouter>, done: (err?: Error) => void): void;
//# sourceMappingURL=fastifyTRPCPlugin.d.ts.map
//#endregion
export { CreateFastifyContextOptions, FastifyHandlerOptions, FastifyTRPCPluginOptions, fastifyRequestHandler, fastifyTRPCPlugin };
//# sourceMappingURL=index.d.mts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/adapters/fastify/fastifyRequestHandler.ts","../../../src/adapters/fastify/fastifyTRPCPlugin.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA6BoC,KAJxB,qBAIwB,CAAA,gBAHlB,SAGkB,EAAA,iBAFjB,cAEiB,EAAA,kBADhB,YACgB,CAAA,GAAhC,sBAAgC,CAAT,OAAS,EAAA,QAAA,CAAA,GAClC,2BADkC,CACN,OADM,EACG,QADH,EACa,SADb,CAAA;KAG/B,4BAHD,CAAA,gBAIc,SAJd,EAAA,iBAKe,cALf,EAAA,kBAMgB,YANhB,CAAA,GAOA,qBAPA,CAOsB,OAPtB,EAO+B,QAP/B,EAOyC,SAPzC,CAAA,GAAA;EAAsB,GACI,EAOvB,QAPuB;EAAO,GAAE,EAQhC,SARgC;EAAQ,IAAE,EAAA,MAAA;CAAS;AAA7B,iBAYP,qBAZO,CAAA,gBAaX,SAbW,EAAA,iBAcV,cAdU,EAAA,kBAeT,YAfS,CAAA,CAAA,IAAA,EAgBrB,4BAhBqB,CAgBQ,OAhBR,EAgBiB,QAhBjB,EAgB2B,SAhB3B,CAAA,CAAA,EAgBqC,OAhBrC,CAAA,IAAA,CAAA;;;AADO,UCLnB,wBDKmB,CAAA,gBCLsB,SDKtB,CAAA,CAAA;EAAQ,MAAxC,CAAA,EAAA,MAAA;EAAsB,MACI,CAAA,EAAA,OAAA;EAAO,WAAE,ECHxB,qBDGwB,CCHF,ODGE,ECHO,cDGP,ECHuB,YDGvB,CAAA;;AAArC,KCAU,2BAAA,GAA8B,8BDAxC,CCCA,cDDA,ECEA,YDFA,CAAA;AAA2B,iBCKb,iBDLa,CAAA,gBCKqB,SDLrB,CAAA,CAAA,OAAA,ECMlB,eDNkB,EAAA,IAAA,ECOrB,wBDPqB,CCOI,ODPJ,CAAA,EAAA,IAAA,EAAA,CAAA,GAAA,CAAA,ECQd,KDRc,EAAA,GAAA,IAAA,CAAA,EAAA,IAAA;AAA+B"}
+78
View File
@@ -0,0 +1,78 @@
import { __toESM, require_objectSpread2 } from "../../getErrorShape-BPSzUA7W.mjs";
import "../../codes-DagpWZLc.mjs";
import "../../tracked-DWInO6EQ.mjs";
import "../../parseTRPCMessage-CTow-umk.mjs";
import { resolveResponse } from "../../resolveResponse-CdASWfAV.mjs";
import "../../contentTypeParsers-SN4WL9ze.mjs";
import "../../unstable-core-do-not-import-9NNw8uQM.mjs";
import "../../observable-UMO3vUa_.mjs";
import "../../initTRPC-BRf4imah.mjs";
import "../../http-CWyjOa1l.mjs";
import { incomingMessageToRequest } from "../../node-http-gyWQuCv2.mjs";
import "../../observable-CUiPknO-.mjs";
import { getWSConnectionHandler, handleKeepAlive } from "../../ws-BoiCYrkt.mjs";
//#region src/adapters/fastify/fastifyRequestHandler.ts
var import_objectSpread2$1 = __toESM(require_objectSpread2(), 1);
async function fastifyRequestHandler(opts) {
const createContext = async (innerOpts) => {
var _opts$createContext;
return await ((_opts$createContext = opts.createContext) === null || _opts$createContext === void 0 ? void 0 : _opts$createContext.call(opts, (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, opts), innerOpts)));
};
const incomingMessage = opts.req.raw;
if ("body" in opts.req) incomingMessage.body = opts.req.body;
const req = incomingMessageToRequest(incomingMessage, opts.res.raw, { maxBodySize: null });
const res = await resolveResponse((0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, opts), {}, {
req,
error: null,
createContext,
onError(o) {
var _opts$onError;
opts === null || opts === void 0 || (_opts$onError = opts.onError) === null || _opts$onError === void 0 || _opts$onError.call(opts, (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, o), {}, { req: opts.req }));
}
}));
await opts.res.send(res);
}
//#endregion
//#region src/adapters/fastify/fastifyTRPCPlugin.ts
var import_objectSpread2 = __toESM(require_objectSpread2(), 1);
function fastifyTRPCPlugin(fastify, opts, done) {
var _opts$prefix;
fastify.removeContentTypeParser("application/json");
fastify.addContentTypeParser("application/json", { parseAs: "string" }, function(_, body, _done) {
_done(null, body);
});
fastify.removeContentTypeParser("multipart/form-data");
fastify.addContentTypeParser("multipart/form-data", {}, function(_, body, _done) {
_done(null, body);
});
let prefix = (_opts$prefix = opts.prefix) !== null && _opts$prefix !== void 0 ? _opts$prefix : "";
if (typeof fastifyTRPCPlugin.default !== "function") prefix = "";
fastify.all(`${prefix}/:path`, async (req, res) => {
const path = req.params.path;
await fastifyRequestHandler((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts.trpcOptions), {}, {
req,
res,
path
}));
});
if (opts.useWSS) {
var _prefix;
const trpcOptions = opts.trpcOptions;
const onConnection = getWSConnectionHandler((0, import_objectSpread2.default)({}, trpcOptions));
fastify.get((_prefix = prefix) !== null && _prefix !== void 0 ? _prefix : "/", { websocket: true }, (socket, req) => {
var _trpcOptions$keepAliv;
onConnection(socket, req.raw);
if (trpcOptions === null || trpcOptions === void 0 || (_trpcOptions$keepAliv = trpcOptions.keepAlive) === null || _trpcOptions$keepAliv === void 0 ? void 0 : _trpcOptions$keepAliv.enabled) {
const { pingMs, pongWaitMs } = trpcOptions.keepAlive;
handleKeepAlive(socket, pingMs, pongWaitMs);
}
});
}
done();
}
//#endregion
export { fastifyRequestHandler, fastifyTRPCPlugin };
//# sourceMappingURL=index.mjs.map
File diff suppressed because one or more lines are too long