@finos/legend-graph
Version:
Legend graph and graph manager
57 lines • 2.78 kB
JavaScript
/**
* 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 { SerializationFactory, usingModelSchema, } from '@finos/legend-shared';
import { createModelSchema, deserialize, primitive } from 'serializr';
import { V1_MappingModelCoverageAnalysisResult } from '../analytics/V1_MappingModelCoverageAnalysis.js';
import { V1_pureModelContextDataPropSchema } from '../../transformation/pureProtocol/V1_PureProtocolSerialization.js';
export var V1_DataspaceCoveragePartitionType;
(function (V1_DataspaceCoveragePartitionType) {
V1_DataspaceCoveragePartitionType["MAPPING_ANALYSIS"] = "MappingAnalysisCoveragePartition";
V1_DataspaceCoveragePartitionType["MAPPING_MODEL"] = "MappingModelCoveragePartition";
})(V1_DataspaceCoveragePartitionType || (V1_DataspaceCoveragePartitionType = {}));
class V1_DataspaceCoveragePartition {
mapping;
}
export class V1_MappingAnalysisCoveragePartition extends V1_DataspaceCoveragePartition {
analysisResult;
static serialization = new SerializationFactory(createModelSchema(V1_MappingAnalysisCoveragePartition, {
mapping: primitive(),
analysisResult: usingModelSchema(V1_MappingModelCoverageAnalysisResult.serialization.schema),
}));
}
export class V1_MappingModelCoveragePartition extends V1_DataspaceCoveragePartition {
model;
static serialization = new SerializationFactory(createModelSchema(V1_MappingModelCoveragePartition, {
mapping: primitive(),
model: V1_pureModelContextDataPropSchema,
}));
}
export const V1_deserializeDataspaceCoveragePartition = (json) => {
if (json.content && typeof json.content === 'string') {
const contentObj = JSON.parse(json.content);
switch (contentObj._type) {
case V1_DataspaceCoveragePartitionType.MAPPING_ANALYSIS:
return deserialize(V1_MappingAnalysisCoveragePartition.serialization.schema, contentObj);
case V1_DataspaceCoveragePartitionType.MAPPING_MODEL:
return deserialize(V1_MappingModelCoveragePartition.serialization.schema, contentObj);
default: {
return undefined;
}
}
}
return undefined;
};
//# sourceMappingURL=V1_DataSpaceArtifacts.js.map