@opra/common
Version:
Opra common package
45 lines (44 loc) • 1.68 kB
TypeScript
import type { Type } from 'ts-gems';
import { ResponsiveMap } from '../helpers/index.js';
import { OpraSchema } from '../schema/index.js';
import { DataTypeMap } from './common/data-type-map.js';
import { DocumentElement } from './common/document-element.js';
import { kTypeNSMap } from './constants.js';
import { DataType } from './data-type/data-type.js';
import type { EnumType } from './data-type/enum-type.js';
import { HttpApi } from './http/http-api.js';
import { RpcApi } from './rpc/rpc-api.js';
/**
*
* @class ApiDocument
*/
export declare class ApiDocument extends DocumentElement {
protected [kTypeNSMap]: WeakMap<DataType, string>;
readonly id: string;
url?: string;
info: OpraSchema.DocumentInfo;
references: ResponsiveMap<ApiDocument>;
types: DataTypeMap;
api?: HttpApi | RpcApi;
constructor();
/**
* Returns NS of datatype. Returns undefined if not found
* @param nameOrCtor
*/
getDataTypeNs(nameOrCtor: string | Type | Function | EnumType.EnumArray | EnumType.EnumObject | DataType): string | undefined;
findDocument(id: string): ApiDocument | undefined;
get httpApi(): HttpApi;
get rpcApi(): RpcApi;
toJSON(): OpraSchema.ApiDocument;
/**
* Export as Opra schema definition object
*/
export(options?: ApiDocument.ExportOptions): OpraSchema.ApiDocument;
invalidate(): void;
protected _findDataType(nameOrCtor: string | Type | Function | EnumType.EnumArray | EnumType.EnumObject, scope?: string, visitedRefs?: WeakMap<ApiDocument, boolean>): DataType | undefined;
}
export declare namespace ApiDocument {
interface ExportOptions {
scope?: string;
}
}