diff --git a/src/client/index.ts b/src/client/index.ts index 8063b27e47..9c10133cd7 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -46,4 +46,6 @@ export { PackageOption, PackageOptions, RetrieveOptions, + DeployVersionData, + RetrieveVersionData, } from './types'; diff --git a/src/client/metadataApiDeploy.ts b/src/client/metadataApiDeploy.ts index cac8816386..efae522930 100644 --- a/src/client/metadataApiDeploy.ts +++ b/src/client/metadataApiDeploy.ts @@ -5,6 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ import { basename, dirname, extname, join, posix, sep } from 'path'; +import { format } from 'util'; import { isString } from '@salesforce/ts-types'; import { create as createArchive } from 'archiver'; import * as fs from 'graceful-fs'; @@ -353,14 +354,13 @@ export class MetadataApiDeploy extends MetadataTransfer { const lifecycle = Lifecycle.getInstance(); try { + const connection = await this.getConnection(); + const apiVersion = connection.getApiVersion(); // Creates an array of unique metadata types that were deployed, uses Set to avoid duplicates. - const listOfMetadataTypesDeployed = Array.from(new Set(this.options.components.map((c) => c.type.name))); + let listOfMetadataTypesDeployed: string[]; + if (this.options.components) { + listOfMetadataTypesDeployed = Array.from(new Set(this.options.components.map((c) => c.type.name))); + } else { + // mdapi deploys don't have a ComponentSet, so using the result + const types = new Set(); + const successes = ensureArray(result.details?.componentSuccesses); + const failures = ensureArray(result.details?.componentFailures); + [...successes, ...failures].forEach((c) => c.componentType && types.add(c.componentType)); + listOfMetadataTypesDeployed = Array.from(types); + } void lifecycle.emitTelemetry({ eventName: 'metadata_api_deploy_result', library: 'SDR', status: result.status, - apiVersion: this.options.apiVersion, - sourceApiVersion: this.options.components?.sourceApiVersion, + apiVersion, + sourceApiVersion: this.components?.sourceApiVersion, createdDate: result.createdDate, startDate: result.startDate, completedDate: result.completedDate, diff --git a/src/client/types.ts b/src/client/types.ts index e7f5729028..2ec0e405cd 100644 --- a/src/client/types.ts +++ b/src/client/types.ts @@ -356,3 +356,14 @@ export interface ListMetadataQuery { type: string; folder?: string; } + +export interface DeployVersionData { + apiVersion: string; + manifestVersion: string | undefined; + webService: 'SOAP' | 'REST'; +} + +export interface RetrieveVersionData { + apiVersion: string; + manifestVersion: string; +} diff --git a/src/index.ts b/src/index.ts index 57a459bdff..4e60c016fa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -41,6 +41,8 @@ export { PackageOption, PackageOptions, RetrieveOptions, + DeployVersionData, + RetrieveVersionData, } from './client'; export { MetadataConverter, diff --git a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8370C-CPU-2-80GHz/lotsOfClassesOneDir.json b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8370C-CPU-2-80GHz/lotsOfClassesOneDir.json index 3cb52c689a..3318a8c9a7 100644 --- a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8370C-CPU-2-80GHz/lotsOfClassesOneDir.json +++ b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8370C-CPU-2-80GHz/lotsOfClassesOneDir.json @@ -1,18 +1,18 @@ [ { "name": "componentSetCreate", - "duration": 664.222689999995 + "duration": 681.3880480000225 }, { "name": "sourceToMdapi", - "duration": 11668.923317000008 + "duration": 10064.488008000015 }, { "name": "sourceToZip", - "duration": 9924.087503000017 + "duration": 9558.054119999986 }, { "name": "mdapiToSource", - "duration": 8384.765007000009 + "duration": 7265.46645700000 } ] \ No newline at end of file