UNPKG

@opra/common

Version:
74 lines (73 loc) 3.33 kB
import type { Type } from 'ts-gems'; import type { ApiDocument } from '../api-document.js'; import { kDataTypeMap } from '../constants.js'; import type { ArrayType } from '../data-type/array-type.js'; import type { ComplexType } from '../data-type/complex-type.js'; import type { DataType } from '../data-type/data-type.js'; import type { EnumType } from '../data-type/enum-type.js'; import type { MappedType } from '../data-type/mapped-type.js'; import type { MixinType } from '../data-type/mixin-type.js'; import type { SimpleType } from '../data-type/simple-type.js'; import type { UnionType } from '../data-type/union-type.js'; import type { DataTypeMap } from './data-type-map.js'; import type { DocumentElement } from './document-element.js'; /** * @class DocumentNode */ export declare class DocumentNode { protected [kDataTypeMap]?: DataTypeMap; protected _document?: ApiDocument; readonly parent?: DocumentNode; readonly element: DocumentElement; constructor(element: DocumentElement, parent?: DocumentNode); getDocument(): ApiDocument; hasDataType(nameOrCtor: string | Type | Function | object | any[], scope?: string | '*'): boolean; findDataType(nameOrCtor: string | Type | Function | object | any[], scope?: string | '*'): DataType | undefined; /** * Returns DataType instance by name or Constructor. Returns undefined if not found */ getDataType(nameOrCtor: string | Type | Function | object | any[], scope?: string | '*'): DataType; getDataTypeNameWithNs(dataType: DataType): string | undefined; /** * Returns EnumType instance by name or Constructor. * Returns undefined if not found * Throws error if data type is not a UnionType */ getArrayType(nameOrCtor: string | object | any[], scope?: string | '*'): ArrayType; /** * Returns ComplexType instance by name or Constructor. * Returns undefined if not found * Throws error if data type is not a ComplexType */ getComplexType(nameOrCtor: string | Type | Function, scope?: string | '*'): ComplexType; /** * Returns SimpleType instance by name or Constructor. * Returns undefined if not found * Throws error if data type is not a SimpleType */ getSimpleType(nameOrCtor: string | Type, scope?: string | '*'): SimpleType; /** * Returns EnumType instance by name or Constructor. * Returns undefined if not found * Throws error if data type is not a EnumType */ getEnumType(nameOrCtor: string | object | any[], scope?: string | '*'): EnumType; /** * Returns EnumType instance by name or Constructor. * Returns undefined if not found * Throws error if data type is not a MappedType */ getMappedType(nameOrCtor: string | object | any[], scope?: string | '*'): MappedType; /** * Returns EnumType instance by name or Constructor. * Returns undefined if not found * Throws error if data type is not a MixinType */ getMixinType(nameOrCtor: string | object | any[], scope?: string | '*'): MixinType; /** * Returns EnumType instance by name or Constructor. * Returns undefined if not found * Throws error if data type is not a UnionType */ getUnionType(nameOrCtor: string | object | any[], scope?: string | '*'): UnionType; }