Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/commands/action-flows/skill/skill-command.service.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import { ContentService } from "../../../core/http/http-shared/content.service";
import { Context } from "../../../core/command/cli-context";
import { SkillManagerFactory } from "./skill.manager-factory";

export class SkillCommandService {
private contentService = new ContentService();
private skillManagerFactory: SkillManagerFactory;

constructor(context: Context) {
this.skillManagerFactory = new SkillManagerFactory(context);
}

public async pullSkill(profile: string, projectId: string, skillId: string): Promise<void> {
await this.contentService.pull(this.skillManagerFactory.createManager(projectId, skillId, null));
await this.skillManagerFactory.createManager(projectId, skillId, null).pull();
}

public async pushSkill(profile: string, projectId: string, filename: string): Promise<void> {
await this.contentService.push(this.skillManagerFactory.createManager(projectId, null, filename));
await this.skillManagerFactory.createManager(projectId, null, filename).push();
}
}
6 changes: 2 additions & 4 deletions src/commands/analysis/analysis-bookmarks-command.service.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import { ContentService } from "../../core/http/http-shared/content.service";
import { AnalysisBookmarksManagerFactory } from "./analysis-bookmarks.manager-factory";
import { Context } from "../../core/command/cli-context";

export class AnalysisBookmarksCommandService {
private contentService = new ContentService();
private analysisBookmarksManagerFactory: AnalysisBookmarksManagerFactory;

constructor(context: Context) {
this.analysisBookmarksManagerFactory = new AnalysisBookmarksManagerFactory(context);
}

public async pullAnalysisBookmarks(analysisId: string, type: string): Promise<void> {
await this.contentService.pull(this.analysisBookmarksManagerFactory.createAnalysisBookmarksManager(null, analysisId, type));
await this.analysisBookmarksManagerFactory.createAnalysisBookmarksManager(null, analysisId, type).pull();
}

public async pushAnalysisBookmarks(analysisId: string, filename: string): Promise<void> {
await this.contentService.push(this.analysisBookmarksManagerFactory.createAnalysisBookmarksManager(filename, analysisId));
await this.analysisBookmarksManagerFactory.createAnalysisBookmarksManager(filename, analysisId).push();
}
}
6 changes: 2 additions & 4 deletions src/commands/cpm4/ctp-command.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Context } from "../../core/command/cli-context";
import { ContentService } from "../../core/http/http-shared/content.service";
import { FatalError, logger } from "../../core/utils/logger";
import { CTPManagerFactory } from "./ctp.manager-factory";

export class CTPCommandService {
private contentService = new ContentService();
private ctpManagerFactory: CTPManagerFactory;

constructor(context: Context) {
Expand All @@ -21,12 +19,12 @@ export class CTPCommandService {
spaceKey: string
): Promise<void> {
if (pushAnalysis) {
await this.contentService.push(this.ctpManagerFactory.createCtpAnalysisManager(filename, password, spaceKey));
await this.ctpManagerFactory.createCtpAnalysisManager(filename, password, spaceKey).push();
}

if (pushDataModels) {
this.validateParamsForDataModelPush(existingPoolId, globalPoolName);
await this.contentService.push(this.ctpManagerFactory.createCtpDataModelManager(filename, password, existingPoolId, globalPoolName));
await this.ctpManagerFactory.createCtpDataModelManager(filename, password, existingPoolId, globalPoolName).push();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ContentService } from "../../../core/http/http-shared/content.service";
import { DataPoolManagerFactory } from "./data-pool-manager.factory";
import { Context } from "../../../core/command/cli-context";
import { DataPoolService } from "./data-pool-service";
import { BaseManagerHelper } from "../../../core/http/http-shared/base.manager.helper";

export class DataPoolCommandService {
private contentService = new ContentService();
private baseManagerHelper = new BaseManagerHelper();
private dataPoolManagerFactory: DataPoolManagerFactory;
private dataPoolService: DataPoolService;

Expand All @@ -14,27 +14,28 @@ export class DataPoolCommandService {
}

public async pullDataPool(id: string): Promise<void> {
await this.contentService.pull(this.dataPoolManagerFactory.createManager(id, null));
await this.dataPoolManagerFactory.createManager(id, null).pull();
}

public async pushDataPool(filename: string): Promise<void> {
await this.contentService.push(this.dataPoolManagerFactory.createManager(null, filename));
await this.dataPoolManagerFactory.createManager(null, filename).push();
}

public async exportDataPool(poolId: string, outputToJsonFile: boolean): Promise<void> {
await this.dataPoolService.exportDataPool(poolId, outputToJsonFile);
}

public async pushDataPools(): Promise<void> {
await this.contentService.batchPush(this.dataPoolManagerFactory.createManagers());
const dataPoolManagers = this.dataPoolManagerFactory.createManagers();
await this.baseManagerHelper.batchPush(dataPoolManagers);
}

public async batchImportDataPools(requestFile: string, outputToJsonFile: boolean): Promise<void> {
await this.dataPoolService.batchImportDataPools(requestFile, outputToJsonFile);
}

public async updateDataPool(id: string, filename: string): Promise<any> {
await this.contentService.update(this.dataPoolManagerFactory.createManager(id, filename));
await this.dataPoolManagerFactory.createManager(id, filename).update();
}

public async listDataPools(jsonResponse: boolean): Promise<any> {
Expand Down
11 changes: 6 additions & 5 deletions src/commands/studio/command-service/asset-command.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ContentService } from "../../../core/http/http-shared/content.service";
import { Context } from "../../../core/command/cli-context";
import { AssetManagerFactory } from "../manager/asset.manager-factory";
import { AssetService } from "../service/asset-service";
import { BaseManagerHelper } from "../../../core/http/http-shared/base.manager.helper";

export class AssetCommandService {
private contentService = new ContentService();
private baseManagerHelper = new BaseManagerHelper();
private assetManagerFactory: AssetManagerFactory;

private assetService: AssetService;
Expand All @@ -15,15 +15,16 @@ export class AssetCommandService {
}

public async pullAsset(key: string): Promise<void> {
await this.contentService.pull(this.assetManagerFactory.createManager(key));
await this.assetManagerFactory.createManager(key).pull();
}

public async pushAsset(fileName: string, packageKey: string): Promise<void> {
await this.contentService.push(this.assetManagerFactory.createManager(null, fileName, packageKey));
await this.assetManagerFactory.createManager(null, fileName, packageKey).push();
}

public async pushAssets(packageKey: string): Promise<void> {
await this.contentService.batchPush(this.assetManagerFactory.createManagers(packageKey));
const assetManagers = this.assetManagerFactory.createManagers(packageKey);
await this.baseManagerHelper.batchPush(assetManagers);
}

public async listAssets(jsonResponse: boolean, assetType: string): Promise<void> {
Expand Down
15 changes: 6 additions & 9 deletions src/commands/studio/command-service/package-command.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ContentService } from "../../../core/http/http-shared/content.service";
import { Context } from "../../../core/command/cli-context";
import { PackageManagerFactory } from "../manager/package.manager-factory";
import { PackageService } from "../service/package.service";
import { BaseManagerHelper } from "../../../core/http/http-shared/base.manager.helper";

export class PackageCommandService {
private contentService = new ContentService();
private baseManagerHelper = new BaseManagerHelper();
private packageManagerFactory: PackageManagerFactory;

private packageService: PackageService;
Expand All @@ -20,9 +20,7 @@ export class PackageCommandService {
newKey: string,
draft: boolean
): Promise<void> {
await this.contentService.pullFile(
this.packageManagerFactory.createPullManager(key, store, newKey, draft)
);
await this.packageManagerFactory.createPullManager(key, store, newKey, draft).pullFile();
}

public async pushPackage(
Expand All @@ -31,13 +29,12 @@ export class PackageCommandService {
newKey: string,
overwrite: boolean
): Promise<void> {
await this.contentService.push(
this.packageManagerFactory.createPushManager(spaceKey, fileName, newKey, overwrite)
);
await this.packageManagerFactory.createPushManager(spaceKey, fileName, newKey, overwrite).push();
}

public async pushPackages(spaceKey: string): Promise<void> {
await this.contentService.batchPush(this.packageManagerFactory.createPushManagers(spaceKey));
const packageManagers = this.packageManagerFactory.createPushManagers(spaceKey);
await this.baseManagerHelper.batchPush(packageManagers);
}

public async listPackages(jsonResponse: boolean, includeDependencies: boolean, packageKeys: string[]): Promise<void> {
Expand Down
4 changes: 1 addition & 3 deletions src/commands/studio/command-service/space-command.service.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { ContentService } from "../../../core/http/http-shared/content.service";
import { SpaceManagerFactory } from "../manager/space.manager-factory";
import { Context } from "../../../core/command/cli-context";

export class SpaceCommandService {
private contentService = new ContentService();
private spaceManagerFactory: SpaceManagerFactory;

constructor(context: Context) {
this.spaceManagerFactory = new SpaceManagerFactory(context);
}

public async listSpaces(jsonResponse: boolean): Promise<void> {
await this.contentService.findAll(this.spaceManagerFactory.createListManager(jsonResponse));
await this.spaceManagerFactory.createListManager(jsonResponse).findAll();
}
}
4 changes: 1 addition & 3 deletions src/commands/studio/command-service/widget.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ import { execSync } from "child_process";
import { GracefulError, logger } from "../../../core/utils/logger";
import * as fs from "fs";
import * as path from "path";
import { ContentService } from "../../../core/http/http-shared/content.service";
import { Context } from "../../../core/command/cli-context";
import { WidgetManagerFactory } from "../manager/widget.manager-factory";

export class WidgetCommand {
private contentService = new ContentService();
private widgetManagerFactory: WidgetManagerFactory;

constructor(context: Context) {
this.widgetManagerFactory = new WidgetManagerFactory(context);
}

public async pushWidget(tenantIndependent: boolean, userSpecific: boolean): Promise<void> {
await this.contentService.push(this.widgetManagerFactory.createManager(tenantIndependent, userSpecific));
await this.widgetManagerFactory.createManager(tenantIndependent, userSpecific).push();
await this.pushToAwsIfAuthorized();
}

Expand Down
8 changes: 8 additions & 0 deletions src/core/http/http-shared/base.manager.helper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { BaseManager } from "./base.manager";

export class BaseManagerHelper {

public async batchPush(baseManagers: BaseManager[]): Promise<any> {
return Promise.all(baseManagers.map(baseManager => baseManager.push()))
}
}
64 changes: 0 additions & 64 deletions src/core/http/http-shared/content.service.ts

This file was deleted.