From 6cad8d406908cdee59866345b3a1ce098190ab3c Mon Sep 17 00:00:00 2001 From: Peter van Gulik Date: Tue, 8 Aug 2023 21:20:51 +0200 Subject: [PATCH] fix: managed package layouts do not export --- .../commands/metadata/retrieveMetadataCommand.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/vscode-extension/src/commands/metadata/retrieveMetadataCommand.ts b/packages/vscode-extension/src/commands/metadata/retrieveMetadataCommand.ts index a4f8ec9d..c1f5a975 100644 --- a/packages/vscode-extension/src/commands/metadata/retrieveMetadataCommand.ts +++ b/packages/vscode-extension/src/commands/metadata/retrieveMetadataCommand.ts @@ -1,8 +1,7 @@ import * as path from 'path'; import * as vscode from 'vscode'; import { unique} from '@vlocode/util'; -import { DescribeGlobalSObjectResult, MetadataType, PackageManifest } from '@vlocode/salesforce'; -import { FileProperties } from 'jsforce'; +import { DescribeGlobalSObjectResult, FileProperties, MetadataType, PackageManifest } from '@vlocode/salesforce'; import MetadataCommand from './metadataCommand'; import { vscodeCommand } from '../../lib/commandRouter'; import { VlocodeCommand } from '../../constants'; @@ -37,8 +36,8 @@ export default class RetrieveMetadataCommand extends MetadataCommand { } return this.retrieveMetadata(componentToExport.map(item => ({ - fullname: item.fullName, - componentType: metadataType.xmlName + fullname: this.getManifestName(item), + componentType: metadataType.name }))); } @@ -85,6 +84,14 @@ export default class RetrieveMetadataCommand extends MetadataCommand { return metadataToExport?.type; } + private getManifestName(component: FileProperties): string { + if (component.type === 'Layout' && component.namespacePrefix) { + const [ objectType, ...layout ] = component.fullName.split('-'); + return `${objectType}-${component.namespacePrefix}__${layout.join('-')}`; + } + return component.fullName; + } + protected async retrieveMetadata(components: { fullname: string; componentType: string }[]) { // Build manifest const apiVersion = this.vlocode.config.salesforce?.apiVersion || this.salesforce.getApiVersion();