UNPKG

@finos/legend-graph

Version:
57 lines 3.39 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. */ /** * NOTE: this file holds the most basic utilties to deal with the graph and * metamodels. Any methods which requires importing some metamodel or graph * are meant to be put into helpers method, e.g. `DomainHelper`. * * This is to avoid circular dependencies and also to keep things in the * right layer */ import type { PackageableElement } from './metamodel/pure/packageableElements/PackageableElement.js'; export declare const extractElementNameFromPath: (fullPath: string) => string; export declare const extractPackagePathFromPath: (fullPath: string) => string | undefined; export declare const isValidIdentifier: (input: string, allowDollarSymbol?: boolean) => boolean; export declare const matchFunctionName: (functionName: string, functionFullPaths: string | string[]) => boolean; /** * This method concatenate 2 fully-qualified elementh paths to form a single one * and then extracts the name and package part from it. */ export declare const resolvePackagePathAndElementName: (path: string, defaultPath?: string) => [string, string]; export declare const buildPath: (packagePath: string | undefined, name: string | undefined) => string; export declare const createPath: (packagePath: string, name: string) => string; export declare const isValidPathIdentifier: (val: string) => boolean; export declare const isValidFullPath: (fullPath: string) => boolean; export declare const isValidPath: (path: string) => boolean; export declare const fromElementPathToMappingElementId: (className: string) => string; /** * Prune source information from object such as raw lambda, raw value specification, etc. * * NOTE: currently, there is no exhaustive way to do this. Majority of the cases, the source information field * is suffixed with `sourceInformation` (e.g. `profileSourceInformation`, `propertyTypeSourceInformation`), * however, we have sometimes deviated from this pattern in our protocol model, so we have fields like `classSourceInformation`, * etc. So this is really an optimistic, non-exhaustive prune. * * To do this exhaustively, we need to tweak this method to also check for the structure of the (sub)object to make sure * it is structually equivalent to the shape of source information to prune it. However, this is computationally expensive. * * NOTE: That aside, We should cleanup these in the backend and use pointer instead so source information is coupled * with the value instead of having custom-name source information fields like these, polluting the protocol models. */ export declare const pruneSourceInformation: <T extends object>(object: T) => T; export declare const TYPE_ARGUMENTS_TYPES: string[]; export declare const requireTypeArugments: (type: PackageableElement) => boolean; //# sourceMappingURL=MetaModelUtils.d.ts.map