salesforce-alm
Version:
This package contains tools, and APIs, for an improved salesforce.com developer experience.
55 lines (53 loc) • 2.93 kB
JavaScript
;
/*
* 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.BotSubtypeMetadataType = void 0;
const path = require("path");
const defaultMetadataType_1 = require("./defaultMetadataType");
const sourcePathUtil_1 = require("../sourcePathUtil");
const MetadataRegistry = require("../metadataRegistry");
class BotSubtypeMetadataType extends defaultMetadataType_1.DefaultMetadataType {
getAggregateMetadataName() {
return this.typeDefObj.parent.metadataName;
}
getFullNameFromFilePath(filePath) {
const parentName = sourcePathUtil_1.getParentDirectoryName(filePath);
const fileName = sourcePathUtil_1.getFileName(filePath);
super.debug(() => `getFullNameFromFilePath parentName: ${parentName} fileName: ${fileName}`);
return `${parentName}.${fileName}`;
}
getAggregateFullNameFromFilePath(filePath) {
super.debug(() => `getAggregateFullNameFromFilePath filePath: ${filePath}`);
return sourcePathUtil_1.getParentDirectoryName(filePath);
}
getAggregateMetadataFilePathFromWorkspacePath(filePath) {
const aggregateFullName = this.getAggregateFullNameFromFilePath(filePath);
const pathToDefaultDir = sourcePathUtil_1.getPathToDir(filePath, this.typeDefObj.parent.defaultDirectory);
const fileName = `${aggregateFullName}.${this.typeDefObj.parent.ext}${MetadataRegistry.getMetadataFileExt()}`;
super.debug(() => `getAggregateMetadataFilePathFromWorkspacePath aggregateFullName: ${aggregateFullName} pathToDefaultDir: ${pathToDefaultDir} fileName: ${fileName}`);
return path.join(pathToDefaultDir, fileName);
}
getAggregateFullNameFromSourceMemberName(sourceMemberName) {
super.debug(() => `getAggregateFullNameFromSourceMemberName: ${sourceMemberName}`);
return sourceMemberName.split('.')[0];
}
getAggregateFullNameFromWorkspaceFullName(workspaceFullName) {
super.debug(() => `getAggregateFullNameFromWorkspaceFullName workspaceFullName: ${workspaceFullName}`);
return workspaceFullName.split('.')[0];
}
getAggregateFullNameFromComponentFailure(componentFailure) {
super.debug(() => `getAggregateFullNameFromComponentFailure componentFailure: ${componentFailure}`);
return this.getAggregateFullNameFromWorkspaceFullName(componentFailure.fullName);
}
getWorkspaceFullNameFromComponentFailure(componentFailure) {
super.debug(() => `getWorkspaceFullNameFromComponentFailure componentFailure: ${componentFailure}`);
return componentFailure.fullName;
}
}
exports.BotSubtypeMetadataType = BotSubtypeMetadataType;
//# sourceMappingURL=botSubtypeMetadataType.js.map