codigo0/node_modules/property-information/lib/util/defined-info.js
planetazuzu 5d7a6500fe refactor: Fase 1 - Clean Architecture, refactorización modular y eliminación de duplicidades
-  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
2026-01-25 21:09:47 +01:00

61 lines
1.2 KiB
JavaScript

/**
* @import {Space} from 'property-information'
*/
import {Info} from './info.js'
import * as types from './types.js'
const checks = /** @type {ReadonlyArray<keyof typeof types>} */ (
Object.keys(types)
)
export class DefinedInfo extends Info {
/**
* @constructor
* @param {string} property
* Property.
* @param {string} attribute
* Attribute.
* @param {number | null | undefined} [mask]
* Mask.
* @param {Space | undefined} [space]
* Space.
* @returns
* Info.
*/
constructor(property, attribute, mask, space) {
let index = -1
super(property, attribute)
mark(this, 'space', space)
if (typeof mask === 'number') {
while (++index < checks.length) {
const check = checks[index]
mark(this, checks[index], (mask & types[check]) === types[check])
}
}
}
}
DefinedInfo.prototype.defined = true
/**
* @template {keyof DefinedInfo} Key
* Key type.
* @param {DefinedInfo} values
* Info.
* @param {Key} key
* Key.
* @param {DefinedInfo[Key]} value
* Value.
* @returns {undefined}
* Nothing.
*/
function mark(values, key, value) {
if (value) {
values[key] = value
}
}