UNPKG

salesforce-alm

Version:

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

44 lines (42 loc) 1.8 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.CustomObjectMetadataType = void 0; const path = require("path"); const fs = require("fs-extra"); const defaultMetadataType_1 = require("./defaultMetadataType"); const PathUtil = require("../sourcePathUtil"); class CustomObjectMetadataType extends defaultMetadataType_1.DefaultMetadataType { hasIndividuallyAddressableChildWorkspaceElements() { return true; } getAggregateMetadataFilePathFromWorkspacePath(filePath) { return PathUtil.removeParentDirFromPath(filePath); } entityExistsInWorkspace(metadataFilePath) { const aggregateFullName = this.getAggregateFullNameFromFilePath(metadataFilePath); return fs.existsSync(path.join(path.dirname(metadataFilePath), aggregateFullName)); } /** * W-4594933: Converting mdapi source that only contains "decomposed" metadata elements will * result in an empty CustomObject container file created. This container file, * which meets the below criteria, is invalid * * @param container * @returns {boolean} */ isContainerValid(container) { const containerDataNodes = container.data.childNodes; return !(containerDataNodes && containerDataNodes[0].tagName == 'xml' && containerDataNodes[1].tagName == this.getMetadataName() && containerDataNodes[1].childNodes.length == 0); } } exports.CustomObjectMetadataType = CustomObjectMetadataType; //# sourceMappingURL=customObjectMetadataType.js.map