/** * Local type declarations for `@xmldom/xmldom` (TASK-0131 SAML SP). * * Why this file exists: `@xmldom/xmldom` ships its own `index.d.ts` whose * first line is a triple-slash `reference` directive pulling in * `lib="dom"`. The API's TS program (`lib: ["ES2022"]`, no DOM) must NOT * pull in `lib.dom.d.ts` — doing so injects the DOM's global * `ReadableStreamReadDoneResult` (where `value` is OPTIONAL) into scope, * which collides with `@factory/ai`'s local `ReadResult` (where `value` * is required) when the API compiles `packages/ai` from source. * * The API `tsconfig.json` maps `@xmldom/xmldom` → this file via `paths`, so * BOTH this package's imports and samlify's own type imports (which also * import `@xmldom/xmldom`) resolve here, and the package's bundled d.ts * never enters the program. The runtime still loads the genuine * `@xmldom/xmldom` CJS module — only the compile-time types are local. * * The declarations below are a STRUCTURAL subset of the real @xmldom API — * the surface `saml.ts` uses plus `Options` (imported by samlify's types). * Keep this in sync with `saml.ts`'s usage. If you need more of the DOM * API, extend these interfaces rather than importing the package's types. */ export interface XmlDomNode { textContent: string | null; getAttribute(name: string): string; getElementsByTagName(localName: string): XmlDomNode[]; getElementsByTagNameNS(namespaceURI: string, localName: string): XmlDomNode[]; } export interface XmlDomElement extends XmlDomNode { localName: string; namespaceURI: string; } export interface XmlDomDocument { documentElement: XmlDomElement | null; getElementsByTagName(localName: string): XmlDomNode[]; getElementsByTagNameNS(namespaceURI: string, localName: string): XmlDomNode[]; } /** SAML parser options consumed by samlify's `setDOMParserOptions`. */ export interface Options { [option: string]: unknown; } export class DOMParser { parseFromString(source: string, mimeType: string): XmlDomDocument; } export class XMLSerializer { serializeToString(node: XmlDomNode): string; }