Skip to content

Commit 745707c

Browse files
Vikram KaltaVikram Kalta
authored andcommitted
fix: fixed issue with the management sdk params
1 parent dbcfc0d commit 745707c

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

src/commands/app/uninstall.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default class Uninstall extends BaseCommand<typeof Uninstall> {
4444

4545
const factory = new UninstallAppFactory()
4646
const strategy = factory.getStrategyInstance(this.flags['uninstall-all'])
47-
await strategy.run(this.flags, this.sharedConfig.org, {managementSdk: this.managementAppSdk, log: this.log}, appType)
47+
await strategy.run(this.flags, this.sharedConfig.org, this.managementSdk, {managementSdk: this.managementAppSdk, log: this.log}, appType)
4848

4949
this.log(this.$t(uninstallAppMsg.APP_UNINSTALLED, { app: app?.name || this.flags["app-uid"] }), "info")
5050

src/interfaces/uninstall-app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { FlagInput } from "@contentstack/cli-utilities";
1+
import { ContentstackClient, FlagInput } from "@contentstack/cli-utilities";
22
import { CommonOptions } from "../util";
33
import { AppTarget } from "@contentstack/management/types/app/index"
44

55
export interface UninstallApp {
6-
run(flags: FlagInput, org: string, options: CommonOptions, appType: AppTarget): Promise<void>;
6+
run(flags: FlagInput, org: string, managementSdk: ContentstackClient, options: CommonOptions, appType: AppTarget): Promise<void>;
77
}

src/strategies/uninstall-all.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import { FlagInput } from "@contentstack/cli-utilities";
1+
import { ContentstackClient, FlagInput } from "@contentstack/cli-utilities";
22
import { UninstallApp } from "../interfaces/uninstall-app";
33
import { CommonOptions, getInstallation, uninstallApp } from "../util";
44
import { AppTarget } from "@contentstack/management/types/app/index"
55

66
export class UninstallAll implements UninstallApp {
7-
public async run(flags: FlagInput, org: string, options: CommonOptions, appType: AppTarget): Promise<void> {
7+
public async run(flags: FlagInput, org: string, managementSdk: ContentstackClient, options: CommonOptions, appType: AppTarget): Promise<void> {
88
// get all installation uids to uninstall
9-
const installationUids = await this.getInstallations(flags, org, options, appType)
9+
const installationUids = await this.getInstallations(flags, org, managementSdk, options, appType)
1010
for (const installationUid of installationUids) {
1111
await uninstallApp(flags, org, options, installationUid)
1212
}
1313
}
1414

15-
public async getInstallations(flags: FlagInput, org: string, options: CommonOptions, appType: AppTarget): Promise<string[]> {
16-
let installationUids: string = await getInstallation(flags, org, options.managementSdk, appType, options, true)
15+
public async getInstallations(flags: FlagInput, org: string, managementSdk: ContentstackClient, options: CommonOptions, appType: AppTarget): Promise<string[]> {
16+
let installationUids: string = await getInstallation(flags, org, managementSdk, appType, options, true)
1717
return installationUids.split(',')
1818
}
1919
}

src/strategies/uninstall-selected.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import { FlagInput } from "@contentstack/cli-utilities";
1+
import { ContentstackClient, FlagInput } from "@contentstack/cli-utilities";
22
import { UninstallApp } from "../interfaces/uninstall-app";
33
import { CommonOptions, getInstallation, uninstallApp } from "../util";
44
import { AppTarget } from "@contentstack/management/types/app/index"
55

66
export class UninstallSelected implements UninstallApp {
7-
public async run(flags: FlagInput, org: string, options: CommonOptions, appType: AppTarget): Promise<void> {
7+
public async run(flags: FlagInput, org: string, managementSdk: ContentstackClient, options: CommonOptions, appType: AppTarget): Promise<void> {
88
// select installation uid to uninstall
9-
const installationUids = await this.getInstallations(flags, org, options, appType)
9+
const installationUids = await this.getInstallations(flags, org, managementSdk, options, appType)
1010
for (const installationUid of installationUids) {
1111
await uninstallApp(flags, org, options, installationUid)
1212
}
1313
}
1414

15-
public async getInstallations(flags: FlagInput, org: string, options: CommonOptions, appType: AppTarget): Promise<string[]> {
15+
public async getInstallations(flags: FlagInput, org: string, managementSdk: ContentstackClient, options: CommonOptions, appType: AppTarget): Promise<string[]> {
1616
let installationUids: any = flags['installation-uid'];
1717
if (!installationUids) {
18-
installationUids = await getInstallation(flags, org, options.managementSdk, appType, options)
18+
installationUids = await getInstallation(flags, org, managementSdk, appType, options)
1919
}
2020
return installationUids.split(',')
2121
}

src/util/inquirer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ async function getInstallation(
204204
installations = populateMissingDataInInstallations(installations, stacks)
205205
// To support uninstall all flag
206206
if (uninstallAll) {
207-
return installations.join(',')
207+
return installations.map(installation => installation.uid).join(',')
208208
}
209209
let _selectedInstallation = await cliux
210210
.inquire({

0 commit comments

Comments
 (0)