@odata2ts/odata2ts
Version:
Flexible generator to produce various TypeScript artefacts (from simple model interfaces to complete odata clients) from OData metadata files
51 lines (50 loc) • 2.16 kB
TypeScript
import { ODataVersions } from "@odata2ts/odata-core";
import { ImportDeclarationStructure, OptionalKind } from "ts-morph";
import { DataModel } from "../data-model/DataModel.js";
import { ClientApiImports, CoreImports, QueryObjectImports, ServiceImports } from "./import/ImportObjects.js";
/**
* Handles all the import statements for a given file.
*
* Features a renaming mechanism, so that when the import name conflicts with an existing import a new
* name is generated and returned.
*
* Map<string,string>
*/
export declare class ImportContainer {
protected path: string;
protected fileName: string;
protected dataModel: DataModel;
protected mainFileNames: {
model: string;
qObject: string;
service: string;
};
protected readonly bundledFileGeneration: boolean;
protected reservedNames: Array<string> | undefined;
private readonly importedNameValidator;
private customTypes;
private internalImports;
private libs;
constructor(path: string, fileName: string, dataModel: DataModel, mainFileNames: {
model: string;
qObject: string;
service: string;
}, bundledFileGeneration: boolean, reservedNames: Array<string> | undefined);
addCoreLib(odataVersion: ODataVersions, coreLib: CoreImports): string;
private addFromQObject;
addQObject(qObject: QueryObjectImports | string): string;
addQObjectType(qObject: string): string;
addClientApi(clientApi: ClientApiImports): string;
addServiceObject(odataVersion: ODataVersions, serviceObject: ServiceImports): string;
addCustomType(moduleName: string, typeName: string, isTypeOnly?: boolean): string;
private pathAndFile;
private isDifferentFile;
private addGeneratedImport;
addGeneratedModel(fqName: string, name: string, isTypeOnly?: boolean): string;
addGeneratedQObject(fqName: string, name: string, isTypeOnly?: boolean): string;
addGeneratedService(fqName: string, name: string): string;
private createImportDecl;
getImportDeclarations(): Array<OptionalKind<ImportDeclarationStructure>>;
private getNamedImports;
private getModuleSpecifier;
}