- ✅ 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
53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
/**
|
|
* @import {Element, Root} from 'hast'
|
|
* @import {Child, Properties, PropertyValue, Result, Style, createH as CreateH} from './create-h.js'
|
|
*/
|
|
|
|
/**
|
|
* @typedef {Record<string, Child | PropertyValue | Style>} JSXProps
|
|
*/
|
|
|
|
// Make VS code see references to above symbols.
|
|
''
|
|
|
|
/**
|
|
* Create an automatic runtime.
|
|
*
|
|
* @param {ReturnType<CreateH>} f
|
|
* `h` function.
|
|
* @returns
|
|
* Automatic JSX runtime.
|
|
*/
|
|
export function createAutomaticRuntime(f) {
|
|
/**
|
|
* @overload
|
|
* @param {null} type
|
|
* @param {{children?: Child}} properties
|
|
* @param {string | null | undefined} [key]
|
|
* @returns {Root}
|
|
*
|
|
* @overload
|
|
* @param {string} type
|
|
* @param {JSXProps} properties
|
|
* @param {string | null | undefined} [key]
|
|
* @returns {Element}
|
|
*
|
|
* @param {string | null} type
|
|
* Element name or `null` to get a root.
|
|
* @param {Properties & {children?: Child}} properties
|
|
* Properties.
|
|
* @returns {Result}
|
|
* Result.
|
|
*/
|
|
function jsx(type, properties) {
|
|
const {children, ...properties_} = properties
|
|
const result =
|
|
// @ts-ignore: `children` is fine: TS has a recursion problem which
|
|
// sometimes generates broken types.
|
|
type === null ? f(null, children) : f(type, properties_, children)
|
|
return result
|
|
}
|
|
|
|
return {Fragment: null, jsxDEV: jsx, jsxs: jsx, jsx}
|
|
}
|