UNPKG

@finos/legend-studio

Version:
79 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 { createModelSchema, list, object, optional, primitive, } from 'serializr'; import { assertNonNullable, guaranteeNonEmptyString, SerializationFactory, } from '@finos/legend-shared'; import { LegendApplicationConfig, } from '@finos/legend-application'; export class ServiceRegistrationEnvInfo { env; executionUrl; modes = []; managementUrl; static serialization = new SerializationFactory(createModelSchema(ServiceRegistrationEnvInfo, { env: primitive(), executionUrl: primitive(), managementUrl: primitive(), modes: list(primitive()), })); } class LegendStudioApplicationCoreOptions { /** * Indicates if we should keep section index and do not rewrite/flatten the paths shortened by section * imports. * * This flag will be kept until we have full support for section index * See https://github.com/finos/legend-studio/issues/1067 */ TEMPORARY__preserveSectionIndex = false; /** * Provides service registration environment configs. * * TODO: when we modularize service, we can move this config to DSL Service preset. Then, we can remove * the TEMPORARY__ prefix. * * @modularize * See https://github.com/finos/legend-studio/issues/65 */ TEMPORARY__serviceRegistrationConfig = []; static serialization = new SerializationFactory(createModelSchema(LegendStudioApplicationCoreOptions, { TEMPORARY__preserveSectionIndex: optional(primitive()), TEMPORARY__serviceRegistrationConfig: list(object(ServiceRegistrationEnvInfo)), })); static create(configData) { return LegendStudioApplicationCoreOptions.serialization.fromJson(configData); } } export class LegendStudioApplicationConfig extends LegendApplicationConfig { options = new LegendStudioApplicationCoreOptions(); engineServerUrl; engineQueryServerUrl; depotServerUrl; sdlcServerUrl; SDLCServerBaseHeaders; constructor(input) { super(input); assertNonNullable(input.configData.engine, `Can't configure application: 'engine' field is missing`); this.engineServerUrl = guaranteeNonEmptyString(input.configData.engine.url, `Can't configure application: 'engine.url' field is missing or empty`); this.engineQueryServerUrl = input.configData.engine.queryUrl; assertNonNullable(input.configData.depot, `Can't configure application: 'depot' field is missing`); this.depotServerUrl = guaranteeNonEmptyString(input.configData.depot.url, `Can't configure application: 'depot.url' field is missing or empty`); assertNonNullable(input.configData.sdlc, `Can't configure application: 'sdlc' field is missing`); this.sdlcServerUrl = guaranteeNonEmptyString(input.configData.sdlc.url, `Can't configure application: 'sdlc.url' field is missing or empty`); this.SDLCServerBaseHeaders = input.configData.sdlc.baseHeaders; this.options = LegendStudioApplicationCoreOptions.create((input.configData.extensions?.core ?? {})); } } //# sourceMappingURL=LegendStudioApplicationConfig.js.map