UNPKG

@finos/legend-graph

Version:
197 lines 12 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 Clazz } from '@finos/legend-shared'; import { Package } from '../graph/metamodel/pure/packageableElements/domain/Package.js'; import { Type } from '../graph/metamodel/pure/packageableElements/domain/Type.js'; import { Association } from '../graph/metamodel/pure/packageableElements/domain/Association.js'; import { Mapping } from '../graph/metamodel/pure/packageableElements/mapping/Mapping.js'; import { Class } from '../graph/metamodel/pure/packageableElements/domain/Class.js'; import { Enumeration } from '../graph/metamodel/pure/packageableElements/domain/Enumeration.js'; import { PackageableElement } from '../graph/metamodel/pure/packageableElements/PackageableElement.js'; import { Profile } from '../graph/metamodel/pure/packageableElements/domain/Profile.js'; import { Service } from '../graph/metamodel/pure/packageableElements/service/Service.js'; import { ConcreteFunctionDefinition } from './metamodel/pure/packageableElements/function/ConcreteFunctionDefinition.js'; import { Store } from '../graph/metamodel/pure/packageableElements/store/Store.js'; import { FlatData } from '../graph/metamodel/pure/packageableElements/store/flatData/model/FlatData.js'; import { PackageableRuntime } from '../graph/metamodel/pure/packageableElements/runtime/PackageableRuntime.js'; import { PackageableConnection } from '../graph/metamodel/pure/packageableElements/connection/PackageableConnection.js'; import { FileGenerationSpecification } from '../graph/metamodel/pure/packageableElements/fileGeneration/FileGenerationSpecification.js'; import { GenerationSpecification } from '../graph/metamodel/pure/packageableElements/generationSpecification/GenerationSpecification.js'; import { Measure } from '../graph/metamodel/pure/packageableElements/domain/Measure.js'; import { Database } from '../graph/metamodel/pure/packageableElements/store/relational/model/Database.js'; import { SectionIndex } from '../graph/metamodel/pure/packageableElements/section/SectionIndex.js'; import type { Section } from '../graph/metamodel/pure/packageableElements/section/Section.js'; import { PureGraphExtension } from './PureGraphExtension.js'; import { DataElement } from '../graph/metamodel/pure/packageableElements/data/DataElement.js'; import type { Testable } from '../graph/metamodel/pure/test/Testable.js'; import { ExecutionEnvironmentInstance } from './metamodel/pure/packageableElements/service/ExecutionEnvironmentInstance.js'; import type { GraphDataOrigin } from './GraphDataOrigin.js'; import { INTERNAL__UnknownPackageableElement } from './metamodel/pure/packageableElements/INTERNAL__UnknownPackageableElement.js'; import { FunctionActivator } from './metamodel/pure/packageableElements/function/FunctionActivator.js'; import type { PureGraphPlugin } from './PureGraphPlugin.js'; import { INTERNAL__UnknownElement } from './metamodel/pure/packageableElements/INTERNAL__UnknownElement.js'; import { DataProduct } from './metamodel/pure/dataProduct/DataProduct.js'; import { IngestDefinition } from './metamodel/pure/packageableElements/ingest/IngestDefinition.js'; /** * Since this is the basis of the Pure graph itself, it shares many methods with the graph. * But the graph holds references to many basic graphs and expose those to outside consumers * as if it is one graph. * * As such, to avoid confusion, we add `Own` to methods in basic graph for methods that only * deal with elements belonging to the basic graph. */ export declare abstract class BasicModel { root: Package; private _origin; readonly extensions: PureGraphExtension<PackageableElement>[]; readonly graphPlugins: PureGraphPlugin[]; private elementSectionIndex; private sectionIndicesIndex; private readonly profilesIndex; private readonly typesIndex; private readonly associationsIndex; private readonly functionsIndex; private readonly functionActivatorsIndex; private readonly storesIndex; private readonly mappingsIndex; private readonly connectionsIndex; private readonly runtimesIndex; private readonly servicesIndex; private readonly generationSpecificationsIndex; private readonly fileGenerationsIndex; private readonly productsIndex; private readonly dataElementsIndex; private readonly executionEnvironmentsIndex; private readonly INTERNAL__unknownElementsIndex; private readonly INTERNAL__unknownIndex; constructor(rootPackageName: string, graphPlugins: PureGraphPlugin[], origin?: GraphDataOrigin | undefined); private createGraphExtensions; get ownSectionIndices(): SectionIndex[]; get ownProfiles(): Profile[]; get ownEnumerations(): Enumeration[]; get ownMeasures(): Measure[]; get ownClasses(): Class[]; get ownTypes(): Type[]; get ownAssociations(): Association[]; get ownFunctions(): ConcreteFunctionDefinition[]; get ownFunctionActivators(): FunctionActivator[]; get ownStores(): Store[]; get ownFlatDatas(): FlatData[]; get ownDatabases(): Database[]; get ownMappings(): Mapping[]; get ownServices(): Service[]; get ownRuntimes(): PackageableRuntime[]; get ownConnections(): PackageableConnection[]; get ownFileGenerations(): FileGenerationSpecification[]; get ownProducts(): DataProduct[]; get ownDataElements(): DataElement[]; get ownExecutionEnvironments(): ExecutionEnvironmentInstance[]; get ownIngests(): IngestDefinition[]; get ownGenerationSpecifications(): GenerationSpecification[]; get ownTestables(): Testable[]; get origin(): GraphDataOrigin | undefined; setOrigin(val: GraphDataOrigin): void; getExtensionElements<T extends PackageableElement>(extensionElementClass: Clazz<T>): T[]; getExtensionForElementClass<T extends PackageableElement>(_class: Clazz<T>): PureGraphExtension<T>; getOwnNullableSection: (path: string) => Section | undefined; getOwnNullableSectionIndex: (path: string) => SectionIndex | undefined; getOwnNullableProfile: (path: string) => Profile | undefined; getOwnNullableType: (path: string) => Type | undefined; getOwnNullableClass: (path: string) => Class | undefined; getOwnNullableEnumeration: (path: string) => Enumeration | undefined; getOwnNullableMeasure: (path: string) => Measure | undefined; getOwnNullableAssociation: (path: string) => Association | undefined; getOwnNullableFunction: (path: string) => ConcreteFunctionDefinition | undefined; getOwnNullableFunctionActivator: (path: string) => FunctionActivator | undefined; getOwnNullableStore: (path: string) => Store | undefined; getOwnNullableMapping: (path: string) => Mapping | undefined; getOwnNullableConnection: (path: string) => PackageableConnection | undefined; getOwnNullableRuntime: (path: string) => PackageableRuntime | undefined; getOwnNullableService: (path: string) => Service | undefined; getOwnNullableGenerationSpecification: (path: string) => GenerationSpecification | undefined; getOwnNullableFileGeneration: (path: string) => FileGenerationSpecification | undefined; getOwnNullableDataElement: (path: string) => DataElement | undefined; getOwnNullableExecutionEnviornment: (path: string) => ExecutionEnvironmentInstance | undefined; getOwnNullableProduct: (path: string) => DataProduct | undefined; getOwnSectionIndex: (path: string) => SectionIndex; getOwnProfile: (path: string) => Profile; getOwnType: (path: string) => Type; getOwnClass: (path: string) => Class; getOwnEnumeration: (path: string) => Enumeration; getOwnMeasure: (path: string) => Measure; getOwnAssociation: (path: string) => Association; getOwnFunction: (path: string) => ConcreteFunctionDefinition; getOwnFunctionActivator: (path: string) => FunctionActivator; getOwnStore: (path: string) => Store; getOwnDatabase: (path: string) => Database; getOwnFlatDataStore: (path: string) => FlatData; getOwnMapping: (path: string) => Mapping; getOwnConnection: (path: string) => PackageableConnection; getOwnRuntime: (path: string) => PackageableRuntime; getOwnService: (path: string) => Service; getOwnGenerationSpecification: (path: string) => GenerationSpecification; getOwnFileGeneration: (path: string) => FileGenerationSpecification; getOwnDataElement: (path: string) => DataElement; getOwnExecutionEnvironment: (path: string) => ExecutionEnvironmentInstance; getOwnDataProduct: (path: string) => DataProduct; getOwnNullableExtensionElement<T extends PackageableElement>(path: string, extensionElementClass: Clazz<T>): T | undefined; setOwnSection(path: string, val: Section): void; setOwnSectionIndex(path: string, val: SectionIndex): void; setOwnProfile(path: string, val: Profile): void; setOwnType(path: string, val: Type): void; setOwnAssociation(path: string, val: Association): void; setOwnFunction(path: string, val: ConcreteFunctionDefinition): void; setOwnFunctionActivator(path: string, val: FunctionActivator): void; setOwnStore(path: string, val: Store): void; setOwnMapping(path: string, val: Mapping): void; setOwnConnection(path: string, val: PackageableConnection): void; setOwnRuntime(path: string, val: PackageableRuntime): void; setOwnService(path: string, val: Service): void; setOwnGenerationSpecification(path: string, val: GenerationSpecification): void; setOwnFileGeneration(path: string, val: FileGenerationSpecification): void; setOwnDataElement(path: string, val: DataElement): void; setOwnExecutionEnvironment(path: string, val: ExecutionEnvironmentInstance): void; setOwnDataProduct(path: string, val: DataProduct): void; INTERNAL__setOwnUnknown(path: string, val: INTERNAL__UnknownElement): void; INTERNAL__setOwnUnknownElement(path: string, val: INTERNAL__UnknownPackageableElement): void; setOwnElementInExtension<T extends PackageableElement>(path: string, val: T, extensionElementClass: Clazz<T>): void; get allOwnElements(): PackageableElement[]; get knownAllOwnElements(): PackageableElement[]; /** * Dispose the current graph and any potential reference from parts outside of the graph to the graph * This is a MUST to prevent memory-leak as we might have references between metamodels from this graph * and other graphs */ dispose(): Promise<void>; getNullablePackage: (path: string) => Package | undefined; getOwnNullableElement(path: string, includePackage?: boolean): PackageableElement | undefined; protected addOwnElement(element: PackageableElement, packagePath: string | undefined): void; deleteOwnElement(element: PackageableElement): void; /** * NOTE: this method has to do with graph modification * and as of the current set up, we should not allow it to be called * on any immutable graphs. As such, we protect it and let the main graph * expose it. The other benefit of exposing this in the main graph is that we could * do better duplicated path check */ protected renameOwnElement(element: PackageableElement, oldPath: string, newPath: string): void; /** * TODO: this will be removed once we have full support for section index * See https://github.com/finos/legend-studio/issues/1067 */ TEMPORARY__deleteOwnSectionIndex(): void; } //# sourceMappingURL=BasicModel.d.ts.map