Skip to content

Commit bd7e2cf

Browse files
fix: used marketplace client from cli-utilities for initialization
1 parent 1ffc126 commit bd7e2cf

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/base-command.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ import {
1313
InquirePayload,
1414
cliux,
1515
isAuthenticated,
16+
ContentstackMarketplaceClient,
17+
marketplaceSDKInitiator,
18+
marketplaceSDKClient,
1619
} from "@contentstack/cli-utilities";
17-
import { ContentstackClient as MarketplaceContentstackClient } from "@contentstack/marketplace-sdk";
1820

1921
import config from "./config";
2022
import { ConfigType, LogFn } from "./types";
@@ -40,7 +42,7 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
4042
};
4143
protected managementSdk!: ContentstackClient;
4244
protected managementAppSdk!: ContentstackClient;
43-
protected marketplaceAppSdk!: MarketplaceContentstackClient;
45+
protected marketplaceAppSdk!: ContentstackMarketplaceClient;
4446

4547
protected flags!: Flags<T>;
4648
protected args!: Args<T>;
@@ -74,6 +76,7 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
7476
this.developerHubBaseUrl =
7577
this.sharedConfig.developerHubBaseUrl || getDeveloperHubUrl();
7678
await this.initCmaSDK();
79+
await this.initMarketplaceSDK();
7780

7881
// Init logger
7982
const logger = new Logger(this.sharedConfig);
@@ -128,6 +131,13 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
128131
host: this.developerHubBaseUrl,
129132
});
130133
}
134+
135+
async initMarketplaceSDK() {
136+
marketplaceSDKInitiator.init(this.context);
137+
this.marketplaceAppSdk = await marketplaceSDKClient({
138+
host: this.developerHubBaseUrl,
139+
});
140+
}
131141

132142
/**
133143
* @method getValPrompt

src/util/common-utils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { ContentstackClient, FlagInput } from "@contentstack/cli-utilities";
2-
import { ContentstackClient as MarketplaceContentstackClient } from "@contentstack/marketplace-sdk";
1+
import { ContentstackClient, FlagInput, ContentstackMarketplaceClient } from "@contentstack/cli-utilities";
32
import { AppLocation, Extension, LogFn } from "../types";
43
import { cliux, Stack } from "@contentstack/cli-utilities";
54
import { apiRequestHandler } from "./api-request-handler";
@@ -10,7 +9,7 @@ export type CommonOptions = {
109
};
1110
export type MarketPlaceOptions = {
1211
log: LogFn;
13-
marketplaceSdk: MarketplaceContentstackClient;
12+
marketplaceSdk: ContentstackMarketplaceClient;
1413
};
1514

1615
async function getOrganizations(

0 commit comments

Comments
 (0)