UNPKG

@finos/legend-graph

Version:
155 lines 8.95 kB
/** * Copyright (c) 2020-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { type PRIMITIVE_TYPE } from '../graph/MetaModelConst.js'; import { type Clazz } from '@finos/legend-shared'; import { PrimitiveType } from '../graph/metamodel/pure/packageableElements/domain/PrimitiveType.js'; import { Enumeration } from '../graph/metamodel/pure/packageableElements/domain/Enumeration.js'; import { Multiplicity } from '../graph/metamodel/pure/packageableElements/domain/Multiplicity.js'; import type { Association } from '../graph/metamodel/pure/packageableElements/domain/Association.js'; import { Package } from '../graph/metamodel/pure/packageableElements/domain/Package.js'; import type { Type } from '../graph/metamodel/pure/packageableElements/domain/Type.js'; import { Class } from '../graph/metamodel/pure/packageableElements/domain/Class.js'; import type { Mapping } from '../graph/metamodel/pure/packageableElements/mapping/Mapping.js'; import type { Profile } from '../graph/metamodel/pure/packageableElements/domain/Profile.js'; import type { Store } from '../graph/metamodel/pure/packageableElements/store/Store.js'; import { DependencyManager } from '../graph/DependencyManager.js'; import { ConcreteFunctionDefinition } from './metamodel/pure/packageableElements/function/ConcreteFunctionDefinition.js'; import type { Service } from '../graph/metamodel/pure/packageableElements/service/Service.js'; import { BasicModel } from './BasicModel.js'; import { FlatData } from '../graph/metamodel/pure/packageableElements/store/flatData/model/FlatData.js'; import { Database } from '../graph/metamodel/pure/packageableElements/store/relational/model/Database.js'; import type { PackageableConnection } from '../graph/metamodel/pure/packageableElements/connection/PackageableConnection.js'; import type { PackageableRuntime } from '../graph/metamodel/pure/packageableElements/runtime/PackageableRuntime.js'; import type { FileGenerationSpecification } from '../graph/metamodel/pure/packageableElements/fileGeneration/FileGenerationSpecification.js'; import type { GenerationSpecification } from '../graph/metamodel/pure/packageableElements/generationSpecification/GenerationSpecification.js'; import { Measure, Unit } from '../graph/metamodel/pure/packageableElements/domain/Measure.js'; import type { PureGraphPlugin } from './PureGraphPlugin.js'; import type { DataElement } from '../graph/metamodel/pure/packageableElements/data/DataElement.js'; import type { Testable } from '../graph/metamodel/pure/test/Testable.js'; import type { PackageableElement } from '../graph/metamodel/pure/packageableElements/PackageableElement.js'; import type { SectionIndex } from '../graph/metamodel/pure/packageableElements/section/SectionIndex.js'; import type { PropertyOwner } from './metamodel/pure/packageableElements/domain/AbstractProperty.js'; import type { ExecutionEnvironmentInstance } from './metamodel/pure/packageableElements/service/ExecutionEnvironmentInstance.js'; import { FunctionActivator } from './metamodel/pure/packageableElements/function/FunctionActivator.js'; import type { IngestDefinition } from './metamodel/pure/packageableElements/ingest/IngestDefinition.js'; export interface GraphTextInputOption { graphGrammar: string | undefined; } /** * CoreModel holds meta models which are constant and basic building block of the graph. Since throughout the lifetime * of the application, we rebuild PureModel many times, we cannot have these basic building blocks as part of PureModel * as that will throw off referential equality. * * Also, since project dependency uses primitive types, it might even * cause the dependency model and system model to depend on PureModel which is bad, as it could potentially cause memory leak * as we rebuild the graph. */ export declare class CoreModel extends BasicModel { primitiveTypesIndex: Map<string, PrimitiveType>; get primitiveTypes(): PrimitiveType[]; constructor(graphPlugins: PureGraphPlugin[]); get allOwnElements(): PackageableElement[]; /** * NOTE: primitive types are special, they are not put in any package (i.e. they are not linked to `Root` package at all) */ initializePrimitiveTypes(): void; } export declare class SystemModel extends BasicModel { autoImports: Package[]; constructor(graphPlugins: PureGraphPlugin[]); /** * NOTE: auto imports are for special types and profiles from system model * such as `Any` or `doc` profiles. We don't actually build the packages here * just resolving them, so we have to make sure whatever package we have as * auto imports, we must have built some elements with such package, e.g. * * `meta::pure::metamodel::type::Any` covers `meta::pure::metamodel::type` * `meta::pure::profiles::doc` covers `meta::pure::profiles` */ initializeAutoImports(): void; } export declare class GenerationModel extends BasicModel { constructor(graphPlugins: PureGraphPlugin[]); } /** * The model of Pure, a.k.a the Pure graph */ export declare class PureModel extends BasicModel { private readonly coreModel; readonly systemModel: SystemModel; generationModel: GenerationModel; dependencyManager: DependencyManager; constructor(coreModel: CoreModel, systemModel: SystemModel, graphPlugins: PureGraphPlugin[]); get autoImports(): Package[]; get primitiveTypes(): PrimitiveType[]; get sectionIndices(): SectionIndex[]; get profiles(): Profile[]; get enumerations(): Enumeration[]; get measures(): Measure[]; get classes(): Class[]; get types(): Type[]; get associations(): Association[]; get functions(): ConcreteFunctionDefinition[]; get functionActivators(): FunctionActivator[]; get stores(): Store[]; get databases(): Database[]; get mappings(): Mapping[]; get services(): Service[]; get runtimes(): PackageableRuntime[]; get connections(): PackageableConnection[]; get dataElements(): DataElement[]; get executionEnvironments(): ExecutionEnvironmentInstance[]; get generationSpecifications(): GenerationSpecification[]; get fileGenerations(): FileGenerationSpecification[]; get ingests(): IngestDefinition[]; get allElements(): PackageableElement[]; get testables(): Testable[]; getPrimitiveType: (type: PRIMITIVE_TYPE) => PrimitiveType; getType: (path: string) => Type; getProfile: (path: string) => Profile; getEnumeration: (path: string) => Enumeration; getMeasure: (path: string) => Measure; getUnit: (path: string) => Unit; getClass: (path: string) => Class; getAssociation: (path: string) => Association; getPropertyOwner: (path: string) => PropertyOwner; getFunction: (path: string) => ConcreteFunctionDefinition; getFunctionActivator: (path: string) => FunctionActivator; getStore: (path: string) => Store; getFlatDataStore: (path: string) => FlatData; getDatabase: (path: string) => Database; getMapping: (path: string) => Mapping; getService: (path: string) => Service; getConnection: (path: string) => PackageableConnection; getRuntime: (path: string) => PackageableRuntime; getGenerationSpecification: (path: string) => GenerationSpecification; getFileGeneration: (path: string) => FileGenerationSpecification; getDataElement: (path: string) => DataElement; getExtensionElement<T extends PackageableElement>(path: string, extensionElementClass: Clazz<T>, notFoundErrorMessage?: string): T; getElement: (path: string, includePackage?: boolean) => PackageableElement; getNullableClass: (path: string) => Class | undefined; getNullableMapping: (path: string) => Mapping | undefined; getNullableService: (path: string) => Service | undefined; getNullableRuntime: (path: string) => PackageableRuntime | undefined; getNullableFileGeneration: (path: string) => FileGenerationSpecification | undefined; getNullableElement(path: string, includePackage?: boolean): PackageableElement | undefined; getPackages(path: string): Package[]; getMultiplicity(lowerBound: number, upperBound: number | undefined): Multiplicity; addElement(element: PackageableElement, packagePath: string | undefined): void; deleteElement(element: PackageableElement): void; renameElement(element: PackageableElement, newPath: string): void; } //# sourceMappingURL=PureModel.d.ts.map