@opra/common
Version:
Opra common package
67 lines (66 loc) • 3.02 kB
TypeScript
import type { Type } from 'ts-gems';
import type { ApiDocument } from '../api-document.js';
import { kDataTypeMap } from '../constants.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 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;
}