/** * 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, ActionState, StopWatch } from '@finos/legend-shared'; import { type LightQuery, type NativeModelExecutionContext, type RawLambda, type QueryGridConfig, type ValueSpecification, type GraphInitializationReport, PackageableRuntime, type QueryInfo, GraphManagerState, Query, QuerySearchSpecification, ModelAccessPointGroup, type DataProduct, V1_DataProductArtifact, DataProductAccessType, type DataProductAnalysisQueryResult, LakehouseAccessPoint } from '@finos/legend-graph'; import { type ProjectGAVCoordinates, type DepotEntityWithOrigin } from '@finos/legend-storage'; import { type DepotServerClient } from '@finos/legend-server-depot'; import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js'; import type { LegendQueryApplicationStore } from './LegendQueryBaseStore.js'; import { type QueryBuilderState, type QueryBuilderDiffViewState, QueryLoaderState, QueryBuilderActionConfig } from '@finos/legend-query-builder'; import { type ResolvedDataSpaceEntityWithOrigin } from '@finos/legend-extension-dsl-data-space/application'; import { type DataSpaceAnalysisResult } from '@finos/legend-extension-dsl-data-space/graph'; import { LegendQueryDataProductQueryBuilderState } from './data-product/query-builder/LegendQueryDataProductQueryBuilderState.js'; import { DataProductSelectorState } from './data-space/DataProductSelectorState.js'; import { LakehouseContractServerClient } from '@finos/legend-server-lakehouse'; export interface QueryPersistConfiguration { defaultName?: string | undefined; allowUpdate?: boolean | undefined; onQueryUpdate?: ((query: Query) => void) | undefined; decorator: ((query: Query) => void) | undefined; } export declare class QueryCreatorState { readonly editorStore: QueryEditorStore; readonly createQueryState: ActionState; queryName: string; queryDescription: string | undefined; showCreateModal: boolean; originalQuery: Query | undefined; constructor(editorStore: QueryEditorStore, queryName: string | undefined); setQueryName(val: string): void; setQueryDescription(val: string | undefined): void; open(originalQuery?: Query | undefined): void; close(): void; createQuery(): GeneratorFn; } export declare class LegendQueryLakehouseState { readonly contractServerClient: LakehouseContractServerClient; constructor(contractServerClient: LakehouseContractServerClient); } export declare abstract class QueryEditorStore { readonly applicationStore: LegendQueryApplicationStore; readonly depotServerClient: DepotServerClient; readonly pluginManager: LegendQueryPluginManager; readonly graphManagerState: GraphManagerState; readonly queryLoaderState: QueryLoaderState; readonly lakehouseState?: LegendQueryLakehouseState | undefined; readonly initState: ActionState; queryBuilderState?: QueryBuilderState | undefined; queryCreatorState: QueryCreatorState; existingQueryName: string | undefined; showRegisterServiceModal: boolean; showAppInfo: boolean; showDataspaceInfo: boolean; showDataProductInfo: boolean; showIngestInfo: boolean; enableMinialGraphForDataSpaceLoadingPerformance: boolean; constructor(applicationStore: LegendQueryApplicationStore, depotServerClient: DepotServerClient); get isViewProjectActionDisabled(): boolean; get canPersistToSavedQuery(): boolean; setExistingQueryName(val: string | undefined): void; setShowAppInfo(val: boolean): void; setShowDataspaceInfo(val: boolean): void; setShowDataProductInfo(val: boolean): void; setShowIngestInfo(val: boolean): void; setShowRegisterServiceModal(val: boolean): void; setEnableMinialGraphForDataSpaceLoadingPerformance(val: boolean): void; get isPerformingBlockingAction(): boolean; decorateSearchSpecification(val: QuerySearchSpecification): QuerySearchSpecification; abstract getProjectInfo(): ProjectGAVCoordinates | undefined; getEditorRoute(): string | undefined; /** * Set up the editor state before building the graph */ protected setUpEditorState(): Promise; buildQueryForPersistence(query: Query, rawLambda: RawLambda, parameters: Map | undefined, config: QueryPersistConfiguration | undefined, gridConfigConfig?: QueryGridConfig): Promise; /** * Set up the query builder state after building the graph */ protected abstract initializeQueryBuilderState(stopWatch?: StopWatch | undefined): Promise; abstract getPersistConfiguration(lambda: RawLambda, options?: { update?: boolean | undefined; }): QueryPersistConfiguration | undefined; initialize(): GeneratorFn; onInitializeFailure(): void; searchExistingQueryName(searchText: string): GeneratorFn; logBuildGraphMetrics(graphBuilderReportData: GraphInitializationReport): void; buildFullGraph(): GeneratorFn; buildGraph(): GeneratorFn; buildGraphAndDataspaceAnalyticsResult(groupId: string, artifactId: string, versionId: string, executionContext: string | undefined, dataSpacePath: string, templateQueryId?: string | undefined): Promise<{ dataSpaceAnalysisResult: DataSpaceAnalysisResult | undefined; isLightGraphEnabled: boolean; }>; fetchDataProductArtifact(groupId: string, artifactId: string, versionId: string, dataProductPath: string): Promise; resolveDataProductMappingPath(artifact: V1_DataProductArtifact, executionContextId: string | undefined): string; buildGraphAndDataproductAnalyticsResult(groupId: string, artifactId: string, versionId: string, dataProductPath: string, dataProductAccessType: DataProductAccessType, accessPointId: string, preFetchedArtifact?: V1_DataProductArtifact | undefined): Promise; /** * Resolves the execution state for a data product by looking up `accessId` * in both model access point groups (by `id`) and native execution contexts * (by `key`). Throws if no matching state is found. */ resolveDataProductExecutionState(dataProduct: DataProduct, accessId: string | undefined): NativeModelExecutionContext | ModelAccessPointGroup | LakehouseAccessPoint; /** * Resolves the user's lakehouse environment and warehouse, creates a * `LakehouseRuntime`, and wraps it in a `PackageableRuntime`. * * Resolution order: * 1. Check local storage (`LakehouseUserInfo`) for a previously persisted value. * 2. If not found, fetch from the lakehouse contract server via * `getUserEntitlementEnvs()` and persist the result to local storage. */ createLakehousePackageableRuntime(dataProductPath: string, gav: { groupId: string; artifactId: string; versionId: string; }): Promise; /** * Centralized method to build a data product query builder state. * Used by both the creator flow (new query from data product route/picker) * and the existing query flow (loading a saved data product query). * * This fetches the data product artifact, resolves the mapping path, * builds the minimal graph via `buildGraphAndDataproductAnalyticsResult`, * creates `LegendQueryDataProductQueryBuilderState`, and wires in * mapping coverage results. */ buildDataProductQueryBuilderState(groupId: string, artifactId: string, versionId: string, dataProductPath: string, artifact: V1_DataProductArtifact, accessId: string, dataProductAccessType: DataProductAccessType, onDataProductChange: (val: DepotEntityWithOrigin) => Promise, onLegacyDataSpaceChange?: ((val: ResolvedDataSpaceEntityWithOrigin) => void) | undefined, productSelectorState?: DataProductSelectorState | undefined): Promise; } export declare class QueryBuilderActionConfig_QueryApplication extends QueryBuilderActionConfig { editorStore: QueryEditorStore; constructor(editorStore: QueryEditorStore); } export declare class MappingQueryCreatorStore extends QueryEditorStore { readonly groupId: string; readonly artifactId: string; readonly versionId: string; readonly mappingPath: string; readonly runtimePath: string; constructor(applicationStore: LegendQueryApplicationStore, depotServerClient: DepotServerClient, groupId: string, artifactId: string, versionId: string, mappingPath: string, runtimePath: string); getProjectInfo(): ProjectGAVCoordinates; initializeQueryBuilderState(): Promise; getPersistConfiguration(): QueryPersistConfiguration; decorateSearchSpecification(val: QuerySearchSpecification): QuerySearchSpecification; } export declare class ServiceQueryCreatorStore extends QueryEditorStore { readonly groupId: string; readonly artifactId: string; readonly versionId: string; readonly servicePath: string; readonly executionKey: string | undefined; constructor(applicationStore: LegendQueryApplicationStore, depotServerClient: DepotServerClient, groupId: string, artifactId: string, versionId: string, servicePath: string, executionKey: string | undefined); getProjectInfo(): ProjectGAVCoordinates; initializeQueryBuilderState(): Promise; getPersistConfiguration(lambda: RawLambda, options?: { update?: boolean | undefined; }): QueryPersistConfiguration; decorateSearchSpecification(val: QuerySearchSpecification): QuerySearchSpecification; } export declare class ExistingQueryUpdateState { readonly editorStore: ExistingQueryEditorStore; readonly updateQueryState: ActionState; fetchProjectVersionState: ActionState; isQueryRenameDialogOpen: boolean; saveModal: boolean; showQueryInfo: boolean; queryVersionId: string | undefined; projectVersions: string[]; updateDiffState: QueryBuilderDiffViewState | undefined; constructor(editorState: ExistingQueryEditorStore); setIsQueryRenameDialogOpen(val: boolean): void; setShowQueryInfo(val: boolean): void; setProjectVersions(val: string[]): void; setQueryVersionId(val: string): void; showSaveModal(): void; closeSaveModal(): void; fetchProjectVersions(groupId: string, artifactId: string): GeneratorFn; updateQuery(queryName: string | undefined, queryVersionId: string | undefined, queryDescription?: string | undefined): GeneratorFn; updateQueryVersionId(queryId: string, queryVersionId: string): GeneratorFn; } export declare class ExistingQueryEditorStore extends QueryEditorStore { private queryId; private _lightQuery?; query: Query | undefined; queryInfo: QueryInfo | undefined; urlQueryParamValues: Record | undefined; updateState: ExistingQueryUpdateState; constructor(applicationStore: LegendQueryApplicationStore, depotServerClient: DepotServerClient, queryId: string, urlQueryParamValues: Record | undefined); get lightQuery(): LightQuery; getEditorRoute(): string; get isPerformingBlockingAction(): boolean; logBuildGraphMetrics(graphBuilderReportData: GraphInitializationReport): void; setLightQuery(val: LightQuery): void; setQuery(val: Query): void; setQueryInfo(val: QueryInfo): void; getProjectInfo(): ProjectGAVCoordinates; buildGraph(): GeneratorFn; /** * Cached ingest entities for the existing-query flow. Populated by * {@link buildIngestGraph} (called from {@link buildGraph}) and consumed by * {@link initQueryBuildStateFromQuery} to back the source dropdown + * {@link IngestLegendQueryBuilderState.swapIngest} callback. */ private _ingestEntitiesByPath; private buildIngestGraph; setUpEditorState(): Promise; initQueryBuildStateFromQuery(queryInfo: QueryInfo): Promise; initializeQueryBuilderState(stopWatch: StopWatch): Promise; getPersistConfiguration(lambda: RawLambda, options?: { update?: boolean | undefined; }): QueryPersistConfiguration; decorateSearchSpecification(val: QuerySearchSpecification): QuerySearchSpecification; } //# sourceMappingURL=QueryEditorStore.d.ts.map