@finos/legend-application-marketplace
Version:
Legend Marketplace application core
97 lines • 3.6 kB
JavaScript
/**
* Copyright (c) 2025-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 { V1_EntitlementsLakehouseEnvironmentType } from '@finos/legend-graph';
import { LakehouseDataProductSearchResultDetails, LegacyDataProductSearchResultDetails, } from '@finos/legend-server-marketplace';
export var LegendMarketplaceEnv;
(function (LegendMarketplaceEnv) {
LegendMarketplaceEnv["PRODUCTION"] = "PRODUCTION";
LegendMarketplaceEnv["PRODUCTION_PARALLEL"] = "PRODUCTION_PARALLEL";
LegendMarketplaceEnv["DEVELOPMENT"] = "DEVELOPMENT";
})(LegendMarketplaceEnv || (LegendMarketplaceEnv = {}));
export class LegendMarketplaceEnvState {
get label() {
return this.key;
}
filterDataProduct(productCardState) {
if (productCardState.searchResult.dataProductDetails instanceof
LegacyDataProductSearchResultDetails) {
if (this.supportsLegacyDataProducts()) {
return true;
}
else {
return false;
}
}
else if (productCardState.searchResult.dataProductDetails instanceof
LakehouseDataProductSearchResultDetails) {
const classification = productCardState.searchResult.dataProductDetails
.producerEnvironmentType;
return this.supportedClassifications().includes(classification);
}
else {
return true;
}
}
}
export class ProdLegendMarketplaceEnvState extends LegendMarketplaceEnvState {
key = LegendMarketplaceEnv.PRODUCTION;
lakehouseEnvironment = V1_EntitlementsLakehouseEnvironmentType.PRODUCTION;
get label() {
return 'Prod';
}
get adjacentEnv() {
return LegendMarketplaceEnv.PRODUCTION_PARALLEL;
}
supportsLegacyDataProducts() {
return true;
}
supportedClassifications() {
return [V1_EntitlementsLakehouseEnvironmentType.PRODUCTION];
}
}
export class ProdParallelLegendMarketplaceEnvState extends LegendMarketplaceEnvState {
key = LegendMarketplaceEnv.PRODUCTION_PARALLEL;
lakehouseEnvironment = V1_EntitlementsLakehouseEnvironmentType.PRODUCTION_PARALLEL;
get label() {
return 'Prod-Parallel';
}
get adjacentEnv() {
return LegendMarketplaceEnv.PRODUCTION;
}
supportsLegacyDataProducts() {
return false;
}
supportedClassifications() {
return [V1_EntitlementsLakehouseEnvironmentType.PRODUCTION_PARALLEL];
}
}
export class DevelopmentLegendMarketplaceEnvState extends LegendMarketplaceEnvState {
key = LegendMarketplaceEnv.DEVELOPMENT;
lakehouseEnvironment = V1_EntitlementsLakehouseEnvironmentType.DEVELOPMENT;
get label() {
return 'Development';
}
get adjacentEnv() {
return LegendMarketplaceEnv.PRODUCTION_PARALLEL;
}
supportsLegacyDataProducts() {
return true;
}
supportedClassifications() {
return [V1_EntitlementsLakehouseEnvironmentType.DEVELOPMENT, undefined];
}
}
//# sourceMappingURL=LegendMarketplaceEnvState.js.map