/** * XsdTypeSystem (G32 — v1.5.0) * ─────────────────────────────── * Formal XsdType interface enabling: * • Consistent type derivation and facet enforcement * • Plugin-based custom type registration * • Walking the full inheritance chain * • Whitespace normalisation pipeline matching the XSD spec * * The built-in primitive types are registered at module load. * Custom types can be added via registerXsdType(). * * Usage * ───── * import { resolveXsdType, registerXsdType } from 'xml-xsd-engine'; * * // Use a built-in * const intType = resolveXsdType('xs:integer')!; * intType.validate('42'); // true * intType.normalize(' 42 '); // '42' * * // Register a custom type * registerXsdType({ * name: 'app:EmailType', * baseTypeName: 'xs:string', * validate: v => /^[^@]+@[^@]+$/.test(v), * normalize: v => v.trim().toLowerCase(), * derive: () => { throw new Error('cannot derive from EmailType'); }, * }); */ import { Facet } from '../schema/SchemaModel'; export interface XsdType { /** Fully-qualified type name, e.g. "xs:integer", "tns:MyType" */ readonly name: string; /** Base type name for chain traversal, or null for xs:anyType */ readonly baseTypeName: string | null; /** * Return true if `lexicalValue` is in the value space of this type. * Should NOT throw — return false for invalid values. */ validate(lexicalValue: string): boolean; /** * Apply a restriction and return a new derived type. * The returned type validates the intersection of the base and the facets. */ derive(facets: Facet[]): XsdType; /** * Normalise the lexical representation according to the type's whitespace * facet (preserve / replace / collapse). */ normalize(lexicalValue: string): string; } /** Register a custom or derived XsdType instance. */ export declare function registerXsdType(type: XsdType): void; /** Look up a type by name (xs:integer, tns:MyType, etc.) */ export declare function resolveXsdType(name: string): XsdType | undefined; /** Return all registered type names. */ export declare function listXsdTypes(): string[]; /** * Walk the full inheritance chain for a type, from the type itself up to * xs:anyType (or until an unregistered type is encountered). * Returns an ordered array: [typeName, baseTypeName, …, 'xs:anyType'] */ export declare function getBaseTypeChain(name: string): string[]; //# sourceMappingURL=XsdTypeSystem.d.ts.map