@finos/legend-graph
Version:
Legend graph and graph manager
140 lines • 4.41 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 { uuid, hashArray, tryToMinifyLosslessJSONString, } from '@finos/legend-shared';
import { CORE_HASH_STRUCTURE, hashElementPointer, } from '../../../../Core_HashUtils.js';
import { PackageableElementPointerType } from '../../../../MetaModelConst.js';
/**
* TODO: Remove once migration from `MappingTest_Legacy` to `MappingTest` is complete
* @deprecated
*/
export class DEPRECATED__MappingTest {
_UUID = uuid();
name;
/**
* Studio does not process value specification, they are left in raw JSON form
*
* @discrepancy model
*/
query;
inputData = [];
assert;
constructor(name, query, inputData, assert) {
this.name = name;
this.query = query;
this.inputData = inputData;
this.assert = assert;
}
get hashCode() {
return hashArray([
CORE_HASH_STRUCTURE.MAPPING_TEST_LEGACY,
this.name,
this.query,
hashArray(this.inputData),
this.assert,
]);
}
}
export class DEPRECATED__MappingTestAssert {
}
export class DEPRECATED__ExpectedOutputMappingTestAssert extends DEPRECATED__MappingTestAssert {
expectedOutput;
constructor(expectedOutput) {
super();
/**
* @workaround https://github.com/finos/legend-studio/issues/68
*/
this.expectedOutput = tryToMinifyLosslessJSONString(expectedOutput);
}
get hashCode() {
return hashArray([
CORE_HASH_STRUCTURE.EXPECTED_OUTPUT_MAPPING_TEST_ASSERT,
this.expectedOutput,
]);
}
}
export class DEPRECATED__InputData {
}
export var ObjectInputType;
(function (ObjectInputType) {
ObjectInputType["JSON"] = "JSON";
ObjectInputType["XML"] = "XML";
})(ObjectInputType || (ObjectInputType = {}));
export class DEPRECATED__ObjectInputData extends DEPRECATED__InputData {
sourceClass;
inputType;
data;
constructor(sourceClass, inputType, data) {
super();
this.sourceClass = sourceClass;
this.inputType = inputType;
/**
* @workaround https://github.com/finos/legend-studio/issues/68
*/
this.data =
inputType === ObjectInputType.JSON
? tryToMinifyLosslessJSONString(data)
: data;
}
get hashCode() {
return hashArray([
CORE_HASH_STRUCTURE.OBJECT_INPUT_DATA,
this.sourceClass.valueForSerialization ?? '',
this.inputType,
this.data,
]);
}
}
export class DEPRECATED__FlatDataInputData extends DEPRECATED__InputData {
sourceFlatData;
data;
constructor(sourceFlatData, data) {
super();
this.sourceFlatData = sourceFlatData;
this.data = data;
}
get hashCode() {
return hashArray([
CORE_HASH_STRUCTURE.FLAT_DATA_INPUT_DATA,
hashElementPointer(PackageableElementPointerType.STORE, this.sourceFlatData.valueForSerialization ?? ''),
this.data,
]);
}
}
export var RelationalInputType;
(function (RelationalInputType) {
RelationalInputType["SQL"] = "SQL";
RelationalInputType["CSV"] = "CSV";
})(RelationalInputType || (RelationalInputType = {}));
export class DEPRECATED__RelationalInputData extends DEPRECATED__InputData {
database;
data;
inputType;
constructor(database, data, inputType) {
super();
this.database = database;
this.data = data;
this.inputType = inputType;
}
get hashCode() {
return hashArray([
CORE_HASH_STRUCTURE.RELATIONAL_INPUT_DATA,
this.database.valueForSerialization ?? '',
this.data,
this.inputType,
]);
}
}
//# sourceMappingURL=DEPRECATED__MappingTest.js.map