diff --git a/schemas/package-pushupgrade-list.json b/schemas/package-pushupgrade-list.json index 3fedeeeb..1adc60d8 100644 --- a/schemas/package-pushupgrade-list.json +++ b/schemas/package-pushupgrade-list.json @@ -1,14 +1,14 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$ref": "#/definitions/PackagePushUpgradeListResultArr", + "$ref": "#/definitions/PackagePushRequestListResultArr", "definitions": { - "PackagePushUpgradeListResultArr": { + "PackagePushRequestListResultArr": { "type": "array", "items": { - "$ref": "#/definitions/PackagePushUpgradeListResult" + "$ref": "#/definitions/PackagePushRequestListResult" } }, - "PackagePushUpgradeListResult": { + "PackagePushRequestListResult": { "type": "object", "properties": { "PushRequestId": { diff --git a/src/commands/package/pushupgrade/list.ts b/src/commands/package/pushupgrade/list.ts index 01c06932..721f6f2a 100644 --- a/src/commands/package/pushupgrade/list.ts +++ b/src/commands/package/pushupgrade/list.ts @@ -7,7 +7,7 @@ import { Flags, SfCommand } from '@salesforce/sf-plugins-core'; import { Connection, Messages } from '@salesforce/core'; -import { PackagePushUpgradeListResult, PackagePushUpgrade } from '@salesforce/packaging'; +import { PackagePushRequestListResult, PackagePushUpgrade } from '@salesforce/packaging'; import chalk from 'chalk'; import { requiredHubFlag } from '../../../utils/hubFlag.js'; @@ -16,9 +16,9 @@ const messages = Messages.loadMessages('@salesforce/plugin-packaging', 'package_ type Status = 'Created' | 'Cancelled' | 'Pending' | 'In Progress' | 'Failed' | 'Succeeded'; -export type PackagePushUpgradeListResultArr = PackagePushUpgradeListResult[]; +export type PackagePushRequestListResultArr = PackagePushRequestListResult[]; -export class PackagePushUpgradeListCommand extends SfCommand { +export class PackagePushRequestListCommand extends SfCommand { public static readonly summary = messages.getMessage('summary'); public static readonly description = messages.getMessage('description'); public static readonly examples = messages.getMessages('examples'); @@ -48,12 +48,13 @@ export class PackagePushUpgradeListCommand extends SfCommand { - const { flags } = await this.parse(PackagePushUpgradeListCommand); + public async run(): Promise { + const { flags } = await this.parse(PackagePushRequestListCommand); this.connection = flags['target-dev-hub'].getConnection('61.0'); // Get results of query here - let results = await PackagePushUpgrade.list(this.connection, { + // Use const since we will add verbose later + const results = await PackagePushUpgrade.list(this.connection, { packageId: flags.packageid!, status: flags.status, }); @@ -61,16 +62,16 @@ export class PackagePushUpgradeListCommand extends SfCommand ({ + const data = results.map((record) => ({ PushRequestId: record?.PushRequestId, PackageVersionId: record?.PackageVersionId, PushRequestStatus: record?.PushRequestStatus, @@ -86,14 +87,14 @@ export class PackagePushUpgradeListCommand extends SfCommand ({ - ...result, - ...{ - PushUpgradeRequestCreatedDateTime: '', - ActualUpgradeStartTime: '', - ActualUpgradeEndTime: '', - ActualDurationsOfPushUpgrades: 0, - }, - })); -} +// function fetchVerboseData(results: PackagePushRequestListResultArr): PackagePushRequestListResultArr { +// return results.map((result) => ({ +// ...result, +// ...{ +// PushUpgradeRequestCreatedDateTime: '', +// ActualUpgradeStartTime: '', +// ActualUpgradeEndTime: '', +// ActualDurationsOfPushUpgrades: 0, +// }, +// })); +// }