Skip to content

Commit b01ef19

Browse files
fix: removed force alias
1 parent 667ecc9 commit b01ef19

2 files changed

Lines changed: 3 additions & 68 deletions

File tree

command-snapshot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"plugin": "@salesforce/plugin-packaging"
118118
},
119119
{
120-
"alias": ["force:package:bundle:version:list"],
120+
"alias": [],
121121
"command": "package:bundle:version:list",
122122
"flagAliases": ["apiversion", "target-hub-org", "targetdevhubusername"],
123123
"flagChars": ["v"],

src/commands/package/bundle/version/list.ts

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import { Flags, loglevel, orgApiVersionFlagWithDeprecations, SfCommand } from '@salesforce/sf-plugins-core';
99
import { Connection, Messages } from '@salesforce/core';
10-
import { PackageVersion, getPackageVersionNumber, BundleSObjects, PackageBundleVersion } from '@salesforce/packaging';
10+
import { BundleSObjects, PackageBundleVersion } from '@salesforce/packaging';
1111
import chalk from 'chalk';
1212
import { requiredHubFlag } from '../../../../utils/hubFlag.js';
1313

@@ -20,8 +20,6 @@ export class PackageBundleVersionListCommand extends SfCommand<PackageBundleVers
2020
public static readonly summary = messages.getMessage('summary');
2121
public static readonly description = messages.getMessage('description');
2222
public static readonly examples = messages.getMessages('examples');
23-
public static readonly deprecateAliases = true;
24-
public static readonly aliases = ['force:package:bundle:version:list'];
2523
public static readonly flags = {
2624
loglevel,
2725
'target-dev-hub': requiredHubFlag,
@@ -36,20 +34,11 @@ export class PackageBundleVersionListCommand extends SfCommand<PackageBundleVers
3634
public async run(): Promise<PackageBundleVersionResults> {
3735
const { flags } = await this.parse(PackageBundleVersionListCommand);
3836
this.connection = flags['target-dev-hub'].getConnection(flags['api-version']);
39-
let results = await PackageBundleVersion.list(this.connection);
37+
const results = await PackageBundleVersion.list(this.connection);
4038

4139
if (results.length === 0) {
4240
this.warn('No results found');
4341
} else {
44-
if (flags.verbose) {
45-
try {
46-
results = await this.fetchVerboseData(results);
47-
} catch (err) {
48-
const errMsg = typeof err === 'string' ? err : err instanceof Error ? err.message : 'unknown error';
49-
this.warn(`error when retrieving verbose data (package name and version) due to: ${errMsg}`);
50-
}
51-
}
52-
5342
const data = results.map((r) => ({
5443
'Bundle Name': r.PackageBundle.BundleName,
5544
'Bundle Id': r.PackageBundle.Id,
@@ -80,58 +69,4 @@ export class PackageBundleVersionListCommand extends SfCommand<PackageBundleVers
8069

8170
return results;
8271
}
83-
84-
// Queries Package2Version for the name and version number of the packages and adds that data
85-
// to the results.
86-
private async fetchVerboseData(results: PackageBundleVersionResults): Promise<PackageBundleVersionResults> {
87-
type VersionDataMap = {
88-
[id: string]: { name: string; version: string };
89-
};
90-
91-
// Filter out any results without a valid PackageBundleVersionId
92-
const validResults = results.filter((r) => r?.Id);
93-
if (validResults.length === 0) {
94-
return results;
95-
}
96-
97-
// Query for the version name and number data
98-
const versionData = await PackageVersion.queryPackage2Version(this.connection, {
99-
fields: [
100-
'Id',
101-
'Name',
102-
'MajorVersion',
103-
'MinorVersion',
104-
'PatchVersion',
105-
'BuildNumber',
106-
'CreatedDate',
107-
'CreatedById',
108-
'LastModifiedDate',
109-
'LastModifiedById',
110-
'SystemModstamp',
111-
],
112-
whereClause: "WHERE Id IN ('%IDS%')",
113-
whereClauseItems: validResults.map((pvcrr) => pvcrr.Id),
114-
});
115-
116-
const vDataMap: VersionDataMap = {};
117-
versionData.forEach((vData) => {
118-
if (vData?.Id) {
119-
const version = getPackageVersionNumber(vData, true);
120-
vDataMap[vData.Id] = { name: vData.Name, version };
121-
}
122-
});
123-
124-
return results.map((pvcrr) => {
125-
if (pvcrr?.Id && vDataMap[pvcrr.Id]) {
126-
return {
127-
...pvcrr,
128-
...{
129-
VersionName: vDataMap[pvcrr.Id].name,
130-
VersionNumber: vDataMap[pvcrr.Id].version,
131-
},
132-
};
133-
}
134-
return pvcrr;
135-
});
136-
}
13772
}

0 commit comments

Comments
 (0)