UNPKG

@finos/legend-graph

Version:
127 lines 9.1 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 { PureModel } from '../PureModel.js'; import { Class } from '../metamodel/pure/packageableElements/domain/Class.js'; import { MILESTONING_STEREOTYPE } from '../MetaModelConst.js'; import { Package } from '../metamodel/pure/packageableElements/domain/Package.js'; import type { PackageableElement } from '../metamodel/pure/packageableElements/PackageableElement.js'; import { type Clazz } from '@finos/legend-shared'; import type { BasicModel } from '../BasicModel.js'; import type { Profile } from '../metamodel/pure/packageableElements/domain/Profile.js'; import type { Tag } from '../metamodel/pure/packageableElements/domain/Tag.js'; import type { Stereotype } from '../metamodel/pure/packageableElements/domain/Stereotype.js'; import type { Type } from '../metamodel/pure/packageableElements/domain/Type.js'; import { Enumeration } from '../metamodel/pure/packageableElements/domain/Enumeration.js'; import { Property } from '../metamodel/pure/packageableElements/domain/Property.js'; import type { Association } from '../metamodel/pure/packageableElements/domain/Association.js'; import type { AbstractProperty, PropertyOwner } from '../metamodel/pure/packageableElements/domain/AbstractProperty.js'; import { DerivedProperty } from '../metamodel/pure/packageableElements/domain/DerivedProperty.js'; import type { Enum } from '../metamodel/pure/packageableElements/domain/Enum.js'; import type { Constraint } from '../metamodel/pure/packageableElements/domain/Constraint.js'; import { GenericType } from '../metamodel/pure/packageableElements/domain/GenericType.js'; import { Multiplicity } from '../metamodel/pure/packageableElements/domain/Multiplicity.js'; import type { AnnotatedElement } from '../metamodel/pure/packageableElements/domain/AnnotatedElement.js'; import type { ConcreteFunctionDefinition } from '../metamodel/pure/packageableElements/function/ConcreteFunctionDefinition.js'; import { FunctionAnalysisInfo } from './FunctionAnalysis.js'; import type { GenericTypeReference } from '../metamodel/pure/packageableElements/domain/GenericTypeReference.js'; export declare const addElementToPackage: (parent: Package, element: PackageableElement) => void; export declare const deleteElementFromPackage: (parent: Package, packageableElement: PackageableElement) => void; export declare const getAllDescendantsOfPackage: (parent: Package, graph: PureModel) => Set<PackageableElement>; export declare const elementBelongsToPackage: (element: PackageableElement, parent: Package) => boolean; export declare const getElementRootPackage: (element: PackageableElement) => Package; export declare const getOrCreatePackage: (parentPackage: Package, relativePackagePath: string, createNewPackageIfNotFound: boolean, cache: Map<string, Package> | undefined) => Package; export declare const getOrCreateGraphPackage: (graph: BasicModel, packagePath: string | undefined, cache: Map<string, Package> | undefined) => Package; export declare const getRawGenericType: <T extends Type>(genericType: GenericType, clazz: Clazz<T>) => T; export declare const isMainGraphElement: (element: PackageableElement) => element is PackageableElement; export declare const isElementReadOnly: (element: PackageableElement) => boolean; export declare const isDependencyElement: (element: PackageableElement) => element is PackageableElement; export declare const isGeneratedElement: (element: PackageableElement) => element is PackageableElement; export declare const isSystemElement: (element: PackageableElement) => element is PackageableElement; /** * Extract the type of temporal milestone the class is associated with (using stereotype). * * Whatever the type, it means the class is milestoned, which means: * 1. properties of this type will now be considered milestoned, and will be automatically * converted into a derived property which accept some temporal parameters (depending * on the milestoning type) * 2. when we query properties of this type, we can provide the values for these parameters */ export declare const getMilestoneTemporalStereotype: (val: Class, graph: PureModel) => MILESTONING_STEREOTYPE | undefined; export declare const getTag: (profile: Profile, value: string) => Tag; export declare const getStereotype: (profile: Profile, value: string) => Stereotype; export declare const getEnumValueNames: (enumeration: Enumeration) => string[]; export declare const getEnumValue: (enumeration: Enumeration, name: string) => Enum; export declare const getFirstAssociatedProperty: (association: Association) => Property; export declare const getSecondAssociatedProperty: (association: Association) => Property; export declare const getOtherAssociatedProperty: (association: Association, property: Property) => Property; export declare const getAssociatedPropertyClass: (association: Association, property: AbstractProperty) => Class; /** * Get all superclasses of a class, accounted for loop and duplication (which should be caught by compiler) * NOTE: we intentionally leave out `Any` */ export declare const getAllSuperclasses: (c: Class) => Class[]; /** * Get all subclasses of a class, accounted for loop and duplication (which should be caught by compiler) * NOTE: we intentionally leave out `Any` */ export declare const getAllSubclasses: (c: Class) => Class[]; export declare const getMilestoningGeneratedProperties: (_class: Class) => Property[]; /** * Get class and its supertypes' properties recursively, duplications and loops are handled (Which should be caught by compiler) */ export declare const getAllClassProperties: (_class: Class, includeGeneratedMilestoning?: boolean | undefined) => Property[]; export declare const getAllClassDerivedProperties: (_class: Class) => DerivedProperty[]; export declare const getClassProperty: (_class: Class, name: string) => Property; export declare const getAllOwnClassProperties: (_class: Class) => AbstractProperty[]; export declare const getOwnClassProperty: (_class: Class, name: string) => AbstractProperty; export declare const getAllClassConstraints: (_class: Class) => Constraint[]; export declare const getOwnProperty: (propertyOwner: PropertyOwner, name: string) => AbstractProperty; /** * Check if the first type subtype of the second type * * NOTE: Use this for contravariant and covariant check * See https://www.originate.com/cheat-codes-for-contravariance-and-covariance * See https://en.wikipedia.org/wiki/Covariance_and_contravariance_of_vectors */ export declare const isSubType: (type1: Type, type2: Type) => boolean; /** * Check if the first type supertype of the second type * * NOTE: Use this for contravariant and covariant check * See https://www.originate.com/cheat-codes-for-contravariance-and-covariance * See https://en.wikipedia.org/wiki/Covariance_and_contravariance_of_vectors */ export declare const isSuperType: (type1: Type, type2: Type) => boolean; export declare const getMultiplicityDescription: (multiplicity: Multiplicity) => string; export declare const getMultiplicityPrettyDescription: (multiplicity: Multiplicity) => string; export declare const areMultiplicitiesEqual: (mul1: Multiplicity, mul2: Multiplicity) => boolean; export declare const isElementDeprecated: (element: AnnotatedElement | Class, graph: PureModel) => boolean; export declare const extractAnnotatedElementDocumentation: (el: AnnotatedElement) => string | undefined; /** * Gets the generated milestoned properties of a property owner */ export declare const getGeneratedMilestonedPropertiesForAssociation: (propertyOwner: PropertyOwner, property: DerivedProperty) => AbstractProperty[]; export declare const getFunctionSignature: (func: ConcreteFunctionDefinition) => string; export declare const getFunctionName: (func: ConcreteFunctionDefinition, name: string) => string; export declare const getFunctionNameWithPath: (func: ConcreteFunctionDefinition) => string; export declare const buildFunctionAnalysisInfoFromConcreteFunctionDefinition: (funcs: ConcreteFunctionDefinition[], graph: PureModel) => FunctionAnalysisInfo[]; export declare const classHasCycle: (_class: Class, options?: { traverseNonRequiredProperties?: boolean | undefined; excludedPaths?: Map<string, string[]> | undefined; }) => boolean; export declare const getElementOrigin: (element: PackageableElement, graph: PureModel) => string; export declare const newGenericType: (rawType: Type, typeArguments: GenericTypeReference[]) => GenericType; //# sourceMappingURL=DomainHelper.d.ts.map