UNPKG

@finos/legend-application-studio

Version:
68 lines 3.74 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 GeneratorFn } from '@finos/legend-shared'; import type { EditorStore } from '../../EditorStore.js'; import { type SPECIAL_REVISION_ALIAS, EntityDiffViewerState } from './EntityDiffEditorState.js'; import { type Entity } from '@finos/legend-storage'; import type { PackageableElement } from '@finos/legend-graph'; import type { EditorState } from '../EditorState.js'; /** * NOTE: when we support comparison between entities, we should create a new editor state * as there are no benefits in trying to make this current one also work with comparison * There are many differences, such as the concept of from and to revision makes no sense, * the header text is different, etc. */ export declare enum DIFF_VIEW_MODE { JSON = "JSON", GRAMMAR = "Grammar" } export declare class EntityDiffViewState extends EntityDiffViewerState { diffMode: DIFF_VIEW_MODE; fromEntityPath?: string | undefined; toEntityPath?: string | undefined; fromEntity?: Entity | undefined; toEntity?: Entity | undefined; fromGrammarText?: string | undefined; toGrammarText?: string | undefined; fromEntityGetter?: ((entityPath: string | undefined) => Entity | undefined) | undefined; toEntityGetter?: ((entityPath: string | undefined) => Entity | undefined) | undefined; constructor(editorStore: EditorStore, fromRevision: SPECIAL_REVISION_ALIAS | string, toRevision: SPECIAL_REVISION_ALIAS | string, fromEntityPath: string | undefined, toEntityPath: string | undefined, fromEntity: Entity | undefined, toEntity: Entity | undefined, fromEntityGetter?: (entityPath: string | undefined) => Entity | undefined, toEntityGetter?: (entityPath: string | undefined) => Entity | undefined); /** * The idea behind effective is that an entity diff state was constructed, one of `toEntityPath` and `fromEntityPath` can be undefined * when the diff is a delete or create. But we can always guarantee that at least one exist and thus `effectiveEntityPath` is that guaranteed to exist path. * It serves 2 main purposes: * 1. For display * 2. For refreshing diff: for example, when we push a workspace change, a delete is updated and if we continue to use the * `toEntityPath` the diff will be shown as a delete still, but we don't want this, we want both panels to have the same content * * As for which path to take precedence, it is more suitable to take `toEntityPath` because it reflects what currently presents in the project * and what the UI should show all the time in the display * e.g. it does not make sense to show the old path for a create element diff. */ get effectiveEntityPath(): string; get element(): PackageableElement | undefined; get label(): string; get description(): string; get summaryText(): string; setDiffMode(diffMode: DIFF_VIEW_MODE): void; private setToGrammarText; private setFromGrammarText; match(tab: EditorState): boolean; refresh(): void; getFromGrammar(): GeneratorFn<void>; getToGrammar(): GeneratorFn<void>; } //# sourceMappingURL=EntityDiffViewState.d.ts.map