@fin.cx/einvoice
Version:
A TypeScript module for creating, manipulating, and embedding XML data within PDF files specifically tailored for electronic invoice (einvoice) packages.
57 lines (56 loc) • 2 kB
TypeScript
import { BaseValidator } from '../base/base.validator.js';
import { ValidationLevel } from '../../interfaces/common.js';
import type { ValidationResult } from '../../interfaces/common.js';
import { CIIProfile } from './cii.types.js';
import { xpath } from '../../plugins.js';
/**
* Base validator for CII-based invoice formats
*/
export declare abstract class CIIBaseValidator extends BaseValidator {
protected doc: Document;
protected namespaces: Record<string, string>;
protected select: xpath.XPathSelect;
protected profile: CIIProfile;
constructor(xml: string);
/**
* Validates CII XML against the specified level of validation
* @param level Validation level
* @returns Result of validation
*/
validate(level?: ValidationLevel): ValidationResult;
/**
* Validates CII XML against schema
* @returns True if schema validation passed
*/
protected validateSchema(): boolean;
/**
* Validates structure of the CII XML document
* @returns True if structure validation passed
*/
protected abstract validateStructure(): boolean;
/**
* Detects the CII profile from the XML
*/
protected detectProfile(): void;
/**
* Gets a text value from an XPath expression
* @param xpath XPath expression
* @param context Optional context node
* @returns Text value or empty string if not found
*/
protected getText(xpathExpr: string, context?: Node): string;
/**
* Gets a number value from an XPath expression
* @param xpath XPath expression
* @param context Optional context node
* @returns Number value or 0 if not found or not a number
*/
protected getNumber(xpathExpr: string, context?: Node): number;
/**
* Checks if a node exists
* @param xpath XPath expression
* @param context Optional context node
* @returns True if node exists
*/
protected exists(xpathExpr: string, context?: Node): boolean;
}