From ec991e94e2491f65e2d83457cd95ca9daefb2d11 Mon Sep 17 00:00:00 2001 From: Bao Tran Date: Mon, 15 Dec 2025 15:34:11 -0500 Subject: [PATCH] chore: remove old bundle install list command --- command-snapshot.json | 16 +-- messages/bundle_install_list.md | 69 ------------ src/commands/package/bundle/install/list.ts | 101 ----------------- .../commands/bundle/bundleInstallList.test.ts | 105 ------------------ 4 files changed, 8 insertions(+), 283 deletions(-) delete mode 100644 messages/bundle_install_list.md delete mode 100644 src/commands/package/bundle/install/list.ts delete mode 100644 test/commands/bundle/bundleInstallList.test.ts diff --git a/command-snapshot.json b/command-snapshot.json index 1d5d9ac9..a23e7d9d 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -79,14 +79,6 @@ "flags": ["api-version", "bundle", "dev-hub-org", "flags-dir", "json", "loglevel", "target-org", "verbose", "wait"], "plugin": "@salesforce/plugin-packaging" }, - { - "alias": [], - "command": "package:bundle:install:list", - "flagAliases": ["apiversion", "targetusername", "u"], - "flagChars": ["c", "o", "s"], - "flags": ["api-version", "created-last-days", "flags-dir", "json", "loglevel", "status", "target-org", "verbose"], - "plugin": "@salesforce/plugin-packaging" - }, { "alias": [], "command": "package:bundle:install:report", @@ -111,6 +103,14 @@ "flags": ["api-version", "flags-dir", "json", "loglevel", "target-dev-hub", "verbose"], "plugin": "@salesforce/plugin-packaging" }, + { + "alias": [], + "command": "package:bundle:uninstall", + "flagAliases": ["apiversion", "targetusername", "u"], + "flagChars": ["b", "o", "w"], + "flags": ["api-version", "bundle", "flags-dir", "json", "loglevel", "target-org", "verbose", "wait"], + "plugin": "@salesforce/plugin-packaging" + }, { "alias": [], "command": "package:bundle:version:create", diff --git a/messages/bundle_install_list.md b/messages/bundle_install_list.md deleted file mode 100644 index 87893af8..00000000 --- a/messages/bundle_install_list.md +++ /dev/null @@ -1,69 +0,0 @@ -# summary - -List package bundle installation requests. - -# description - -Shows the details of each request to install a package bundle version in the target org. - -All filter parameters are applied using the AND logical operator (not OR). - -To get information about a specific request, run "<%= config.bin %> package bundle install report" and supply the request ID. - -# flags.status.summary - -Status of the installation request, used to filter the list. - -# flags.verbose.summary - -Displays additional information at a slight performance cost, such as validation text for each package bundle install request. - -# flags.created-last-days.summary - -Number of days since the request was created, starting at 00:00:00 of first day to now. Use 0 for today. - -# examples - -- List all package bundle installation requests in your default Dev Hub org: - - <%= config.bin %> <%= command.id %> - -- List package bundle installation requests from the last 3 days in the Dev Hub org with username devhub@example.com: - - <%= config.bin %> <%= command.id %> --created-last-days 3 --target-dev-hub - -- List package bundle installation requests with status Error: - - <%= config.bin %> <%= command.id %> --status Error - -- List package bundle installation requests with status Queued: - - <%= config.bin %> <%= command.id %> --status Queued - -- List package bundle installation requests with status Success that were created today: - - <%= config.bin %> <%= command.id %> --created-last-days 0 --status Success - -# id - -ID - -# status - -Status - -# package-bundle-version-id - -Package Bundle Version ID - -# development-organization - -Development Organization - -# created-by - -Created By - -# validation-error - -Validation Error diff --git a/src/commands/package/bundle/install/list.ts b/src/commands/package/bundle/install/list.ts deleted file mode 100644 index 88a219d1..00000000 --- a/src/commands/package/bundle/install/list.ts +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2025, Salesforce, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { - Flags, - loglevel, - orgApiVersionFlagWithDeprecations, - requiredOrgFlagWithDeprecations, - SfCommand, -} from '@salesforce/sf-plugins-core'; -import { Connection, Messages } from '@salesforce/core'; -import { BundleSObjects, PackageBundleInstall } from '@salesforce/packaging'; -import chalk from 'chalk'; - -Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); -const messages = Messages.loadMessages('@salesforce/plugin-packaging', 'bundle_install_list'); - -type Status = BundleSObjects.PkgBundleVersionInstallReqStatus; -export type PackageBundleInstallRequestResults = BundleSObjects.PkgBundleVersionInstallReqResult[]; - -export class PackageBundleInstallListCommand extends SfCommand { - public static readonly hidden = true; - public static state = 'beta'; - public static readonly summary = messages.getMessage('summary'); - public static readonly description = messages.getMessage('description'); - public static readonly examples = messages.getMessages('examples'); - public static readonly flags = { - loglevel, - 'target-org': requiredOrgFlagWithDeprecations, - 'api-version': orgApiVersionFlagWithDeprecations, - 'created-last-days': Flags.integer({ - char: 'c', - summary: messages.getMessage('flags.created-last-days.summary'), - }), - status: Flags.custom({ - options: [ - BundleSObjects.PkgBundleVersionInstallReqStatus.queued, - BundleSObjects.PkgBundleVersionInstallReqStatus.inProgress, - BundleSObjects.PkgBundleVersionInstallReqStatus.success, - BundleSObjects.PkgBundleVersionInstallReqStatus.error, - ], - })({ - char: 's', - summary: messages.getMessage('flags.status.summary'), - }), - verbose: Flags.boolean({ - summary: messages.getMessage('flags.verbose.summary'), - }), - }; - - private connection!: Connection; - - public async run(): Promise { - const { flags } = await this.parse(PackageBundleInstallListCommand); - this.connection = flags['target-org'].getConnection(flags['api-version']); - const results = await PackageBundleInstall.getInstallStatuses( - this.connection, - flags.status, - flags['created-last-days'] - ); - - if (results.length === 0) { - this.warn('No results found'); - } else { - const data = results.map((r) => ({ - Id: r.Id ?? 'N/A', - Status: r.InstallStatus ?? 'Unknown', - 'Package Bundle Version Id': r.PackageBundleVersionId ?? 'N/A', - 'Development Organization': r.DevelopmentOrganization ?? 'N/A', - 'Created Date': r.CreatedDate ?? 'N/A', - 'Created By': r.CreatedById ?? 'N/A', - ...(flags.verbose - ? { - 'Validation Error': r.ValidationError ?? 'N/A', - } - : {}), - })); - - this.table({ - data, - overflow: 'wrap', - title: chalk.blue(`Package Bundle Install Requests [${results.length}]`), - }); - } - - return results; - } -} diff --git a/test/commands/bundle/bundleInstallList.test.ts b/test/commands/bundle/bundleInstallList.test.ts deleted file mode 100644 index d3aa8a2b..00000000 --- a/test/commands/bundle/bundleInstallList.test.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2025, Salesforce, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Config } from '@oclif/core'; -import { TestContext, MockTestOrgData } from '@salesforce/core/testSetup'; -import { expect } from 'chai'; -import { PackageBundleInstall, BundleSObjects } from '@salesforce/packaging'; -import { stubSfCommandUx } from '@salesforce/sf-plugins-core'; -import sinon from 'sinon'; -import { PackageBundleInstallListCommand } from '../../../src/commands/package/bundle/install/list.js'; - -describe('package:bundle:install:list - tests', () => { - const $$ = new TestContext(); - const testOrg = new MockTestOrgData(); - let sfCommandStubs: ReturnType; - let getInstallStatusesStub: sinon.SinonStub; - const config = new Config({ root: import.meta.url }); - - beforeEach(async () => { - await $$.stubAuths(testOrg); - await config.load(); - sfCommandStubs = stubSfCommandUx($$.SANDBOX); - - getInstallStatusesStub = $$.SANDBOX.stub(PackageBundleInstall, 'getInstallStatuses'); - }); - - afterEach(() => { - $$.restore(); - }); - - it('should list bundle install requests', async () => { - const cmd = new PackageBundleInstallListCommand(['--target-org', testOrg.username], config); - - const mockResults: BundleSObjects.PkgBundleVersionInstallReqResult[] = [ - { - Id: 'test-id-1', - InstallStatus: BundleSObjects.PkgBundleVersionInstallReqStatus.success, - PackageBundleVersionId: 'bundle-version-id-1', - DevelopmentOrganization: 'dev-org-1', - CreatedDate: '2023-01-01T00:00:00Z', - CreatedById: 'user-id-1', - ValidationError: '', - Error: [], - }, - ]; - - getInstallStatusesStub.resolves(mockResults); - - await cmd.run(); - - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(sfCommandStubs.table.calledOnce).to.be.true; - expect(getInstallStatusesStub.calledOnce).to.be.true; - }); - - it('should show warning when no results found', async () => { - const cmd = new PackageBundleInstallListCommand(['--target-org', testOrg.username], config); - - getInstallStatusesStub.resolves([]); - - await cmd.run(); - - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(sfCommandStubs.warn.calledOnce).to.be.true; - expect(sfCommandStubs.warn.firstCall.args[0]).to.equal('No results found'); - }); - - // This test does very little to test the verbose command except make sure that it is there. - it('should handle verbose flag', async () => { - const cmd = new PackageBundleInstallListCommand(['--target-org', testOrg.username, '--verbose'], config); - - const mockResults: BundleSObjects.PkgBundleVersionInstallReqResult[] = [ - { - Id: 'test-id-1', - InstallStatus: BundleSObjects.PkgBundleVersionInstallReqStatus.error, - PackageBundleVersionId: 'bundle-version-id-1', - DevelopmentOrganization: 'dev-org-1', - CreatedDate: '2023-01-01T00:00:00Z', - CreatedById: 'user-id-1', - ValidationError: 'Installation failed', - Error: ['Test error'], - }, - ]; - - getInstallStatusesStub.resolves(mockResults); - - await cmd.run(); - - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(sfCommandStubs.table.calledOnce).to.be.true; - expect(getInstallStatusesStub.calledOnce).to.be.true; - }); -});