Skip to content

Commit f087fdc

Browse files
committed
added support for query in entries and marketplace apps
1 parent fcf92a1 commit f087fdc

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

packages/contentstack-export/src/export/modules/entries.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export default class EntriesExport extends BaseClass {
133133
locale: options.locale,
134134
},
135135
};
136+
this.applyQueryFilters(requestObject, 'entries');
136137

137138
let entriesSearchResponse;
138139
try {

packages/contentstack-export/src/export/modules/marketplace-apps.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default class ExportMarketplaceApps {
2626
public appSdk: ContentstackMarketplaceClient;
2727
public exportConfig: ExportConfig;
2828
public command: Command;
29+
public query: Record<string, any>;
2930

3031
constructor({ exportConfig }: Omit<ModuleClassParams, 'stackAPIClient' | 'moduleName'>) {
3132
this.exportConfig = exportConfig;
@@ -51,6 +52,7 @@ export default class ExportMarketplaceApps {
5152
await fsUtil.makeDirectory(this.marketplaceAppPath);
5253
this.developerHubBaseUrl = this.exportConfig.developerHubBaseUrl || (await getDeveloperHubUrl(this.exportConfig));
5354
this.exportConfig.org_uid = await getOrgUid(this.exportConfig);
55+
this.query = { target_uids: this.exportConfig.source_stack };
5456

5557
// NOTE init marketplace app sdk
5658
const host = this.developerHubBaseUrl.split('://').pop();
@@ -64,6 +66,16 @@ export default class ExportMarketplaceApps {
6466
* library if it is available.
6567
*/
6668
async exportApps(): Promise<any> {
69+
// currently support only app_uids or installation_uids
70+
const externalQuery = this.exportConfig.query?.modules['marketplace-apps'];
71+
if (externalQuery) {
72+
if (externalQuery.app_uid?.$in?.length > 0) {
73+
this.query.app_uids = externalQuery.app_uid.$in.join(',');
74+
}
75+
if (externalQuery.installation_uid?.$in?.length > 0) {
76+
this.query.installation_uids = externalQuery.installation_uid?.$in?.join(',');
77+
}
78+
}
6779
await this.getStackSpecificApps();
6880
await this.getAppManifestAndAppConfig();
6981

@@ -186,7 +198,7 @@ export default class ExportMarketplaceApps {
186198
const collection = await this.appSdk
187199
.marketplace(this.exportConfig.org_uid)
188200
.installation()
189-
.fetchAll({ target_uids: this.exportConfig.source_stack, skip })
201+
.fetchAll({ ...this.query, skip })
190202
.catch((error) => {
191203
log(this.exportConfig, `Failed to export marketplace-apps ${formatError(error)}`, 'error');
192204
log(this.exportConfig, error, 'error');

0 commit comments

Comments
 (0)