UNPKG

@finos/legend-graph

Version:
61 lines 2.63 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 { hashArray } from '@finos/legend-shared'; import { CORE_HASH_STRUCTURE } from '../../../../../graph/Core_HashUtils.js'; export class PropertyMapping { /** * the immediate parent instance set implementation that holds the property mappings */ _OWNER; _isEmbedded = false; property; /** * In Pure, these fields are defined as string and not properly resolved, perhaps because of * the fact that in Pure, we allow mappings which contain class mapping IDs pointing at * another mapping's class mappings. In Pure/Engine, we let this pass compilation phase. * In Studio, we disallow this. This makes it hard for users to migrate to Studio. * We should think of a strategy to make things loadable in Studio, but disallow users * to make changes if they have this kind of error in their graph. * * See https://github.com/finos/legend-studio/issues/880 * * NOTE: We might not be able to resolve `targetSetImplementation` for all `target` IDs hence * defined as optional for now. We might need to come back and re-visit this decision. Note that * one quirky thing is that the metamodel in Pure has these fields as string pointers, even * when these are not resolvable, the field is set to empty string. We should solidify our * understand about these fields. * * @discrepancy model */ sourceSetImplementation; targetSetImplementation; localMappingProperty; constructor(owner, property, source, target) { this._OWNER = owner; this.sourceSetImplementation = source; this.property = property; this.targetSetImplementation = target; } get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.PROPERTY_MAPPING, this.property.pointerHashCode, this.targetSetImplementation?.valueForSerialization ?? '', this.localMappingProperty ?? '', ]); } } //# sourceMappingURL=PropertyMapping.js.map