- ✅ Ticket 1.1: Estructura Clean Architecture en backend - ✅ Ticket 1.2: Schemas Zod compartidos - ✅ Ticket 1.3: Refactorización drugs.ts (1362 → 8 archivos modulares) - ✅ Ticket 1.4: Refactorización procedures.ts (3583 → 6 archivos modulares) - ✅ Ticket 1.5: Eliminación de duplicidades (~50 líneas) Cambios principales: - Creada estructura Clean Architecture en backend/src/ - Schemas Zod compartidos en backend/src/shared/schemas/ - Refactorización modular de drugs y procedures - Utilidades genéricas en src/utils/ (filter, validation) - Eliminados scripts obsoletos y documentación antigua - Corregidos errores: QueryClient, import test-error-handling - Build verificado y funcionando correctamente
41 lines
1.6 KiB
JavaScript
Executable file
41 lines
1.6 KiB
JavaScript
Executable file
function isSecure(wsComponents) {
|
|
return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
|
|
}
|
|
//RFC 6455
|
|
const handler = {
|
|
scheme: "ws",
|
|
domainHost: true,
|
|
parse: function (components, options) {
|
|
const wsComponents = components;
|
|
//indicate if the secure flag is set
|
|
wsComponents.secure = isSecure(wsComponents);
|
|
//construct resouce name
|
|
wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
|
|
wsComponents.path = undefined;
|
|
wsComponents.query = undefined;
|
|
return wsComponents;
|
|
},
|
|
serialize: function (wsComponents, options) {
|
|
//normalize the default port
|
|
if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
|
|
wsComponents.port = undefined;
|
|
}
|
|
//ensure scheme matches secure flag
|
|
if (typeof wsComponents.secure === 'boolean') {
|
|
wsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws');
|
|
wsComponents.secure = undefined;
|
|
}
|
|
//reconstruct path from resource name
|
|
if (wsComponents.resourceName) {
|
|
const [path, query] = wsComponents.resourceName.split('?');
|
|
wsComponents.path = (path && path !== '/' ? path : undefined);
|
|
wsComponents.query = query;
|
|
wsComponents.resourceName = undefined;
|
|
}
|
|
//forbid fragment component
|
|
wsComponents.fragment = undefined;
|
|
return wsComponents;
|
|
}
|
|
};
|
|
export default handler;
|
|
//# sourceMappingURL=ws.js.map
|