UNPKG

salesforce-alm

Version:

This package contains tools, and APIs, for an improved salesforce.com developer experience.

53 lines (51 loc) 2.5 kB
"use strict"; /* * Copyright (c) 2020, salesforce.com, inc. * All rights reserved. * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ Object.defineProperty(exports, "__esModule", { value: true }); exports.DataMappingObjectDefinitionSubtypeMetadataType = void 0; const path = require("path"); const defaultMetadataType_1 = require("./defaultMetadataType"); const PathUtil = require("../sourcePathUtil"); const MetadataRegistry = require("../metadataRegistry"); /** * Note: The DataMappingFieldDefinitions are not placed in their own folder due to rule #4 in * folderPerSubtypeWorkspaceDecomposition. Since this is the case, we'll use the Parent Directory name * for fullName generation instead of Grandparent directory name. */ class DataMappingObjectDefinitionSubtypeMetadataType extends defaultMetadataType_1.DefaultMetadataType { getAggregateMetadataName() { return this.typeDefObj.parent.metadataName; } getFullNameFromFilePath(filePath) { const parentName = PathUtil.getParentDirectoryName(filePath); const fileName = PathUtil.getFileName(filePath); return `${parentName}.${fileName}`; } getAggregateFullNameFromFilePath(filePath) { return PathUtil.getParentDirectoryName(filePath); } getAggregateMetadataFilePathFromWorkspacePath(filePath) { const aggregateFullName = this.getAggregateFullNameFromFilePath(filePath); const pathToDefaultDir = PathUtil.getPathToDir(filePath, this.typeDefObj.parent.defaultDirectory); const fileName = `${aggregateFullName}.${this.typeDefObj.parent.ext}${MetadataRegistry.getMetadataFileExt()}`; return path.join(pathToDefaultDir, fileName); } getAggregateFullNameFromSourceMemberName(sourceMemberName) { return sourceMemberName.split('.')[0]; } getAggregateFullNameFromWorkspaceFullName(workspaceFullName) { return workspaceFullName.split('.')[0]; } getAggregateFullNameFromComponentFailure(componentFailure) { return this.getAggregateFullNameFromWorkspaceFullName(componentFailure.fullName); } getWorkspaceFullNameFromComponentFailure(componentFailure) { return componentFailure.fullName; } } exports.DataMappingObjectDefinitionSubtypeMetadataType = DataMappingObjectDefinitionSubtypeMetadataType; //# sourceMappingURL=dataMappingObjectDefinitionSubtypeMetadataType.js.map