@contrail/cli 1.0.29 → 1.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import { App, AppDeclaration, AppActionDeclaration } from '../../interfaces';
2
2
  export declare function getActionsForApp(app: App): Promise<any>;
3
3
  export declare function getActionDeclarationIdentifier(actionKey: any, app: App): string;
4
+ export declare function deleteAction(actionId: any): Promise<any>;
4
5
  export declare class ActionsDeployer {
5
6
  deployActions(appDeclaration: AppDeclaration, app: App): Promise<void>;
6
7
  deployAction(actionKey: string, actionDeclaration: AppActionDeclaration, app: App, existingActions: Array<any>): Promise<void>;
@@ -12,6 +12,9 @@ export async function getActionsForApp(app) {
12
12
  export function getActionDeclarationIdentifier(actionKey, app) {
13
13
  return app.identifier + ':' + actionKey;
14
14
  }
15
+ export async function deleteAction(actionId) {
16
+ return await new Entities().delete({ entityName: 'event-workflow-action-definition', id: actionId });
17
+ }
15
18
  export class ActionsDeployer {
16
19
  async deployActions(appDeclaration, app) {
17
20
  // FETCH ALL ACTIONS FROM THE API.
@@ -1,7 +1,7 @@
1
1
  import { Entities } from '@contrail/sdk';
2
2
  import chalk from 'chalk';
3
3
  import { Auth } from '../../auth/auth';
4
- import { ActionsDeployer } from './actions-deployer';
4
+ import { ActionsDeployer, getActionsForApp, deleteAction } from './actions-deployer';
5
5
  import { TriggerKeyDefinitionParser, ConfigPropertiesParser } from './app-template-parsers';
6
6
  import { WorkflowDefinitionDeployer } from './workflow-definition-deployer';
7
7
  export class AppDeployer {
@@ -83,7 +83,7 @@ export class AppDeployer {
83
83
  keywords: appDeclaration.keywords,
84
84
  configProperties,
85
85
  triggerKeyDefinitions,
86
- isDockerBased: appDeclaration.isDockerBased,
86
+ dockerImageRef: appDeclaration.dockerImageRef,
87
87
  };
88
88
  const app = await new Entities().update({ entityName: 'app', id: existingApp.id, object: updates });
89
89
  console.log(`%s Updated app: ${app.name}`, chalk.yellow.bold('APP'));
@@ -92,6 +92,11 @@ export class AppDeployer {
92
92
  async remove(appDeclaration) {
93
93
  let app = await this.getExistingApp(appDeclaration);
94
94
  if (app) {
95
+ const actions = await getActionsForApp(app);
96
+ for (const action of actions) {
97
+ console.log(`%s Deleting action: ${action.identifier}`, chalk.yellow.bold('APP'));
98
+ await deleteAction(action.id);
99
+ }
95
100
  app = await new Entities().delete({ entityName: 'app', id: app.id });
96
101
  console.log(`%s Deleted app: ${app.name}`, chalk.yellow.bold('APP'));
97
102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/cli",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -19,6 +19,10 @@ export function getActionDeclarationIdentifier(actionKey, app: App) {
19
19
  return app.identifier + ':' + actionKey;
20
20
  }
21
21
 
22
+ export async function deleteAction(actionId): Promise<any>{
23
+ return await new Entities().delete({ entityName: 'event-workflow-action-definition', id: actionId });
24
+ }
25
+
22
26
  export class ActionsDeployer {
23
27
  async deployActions(appDeclaration: AppDeclaration, app: App) {
24
28
 
@@ -1,7 +1,7 @@
1
1
  import { Entities } from '@contrail/sdk';
2
2
  import chalk from 'chalk';
3
3
  import { Auth } from '../../auth/auth';
4
- import { ActionsDeployer } from './actions-deployer';
4
+ import { ActionsDeployer, getActionsForApp, deleteAction } from './actions-deployer';
5
5
  import { App, AppDeclaration } from '../../interfaces';
6
6
  import { TriggerKeyDefinitionParser, ConfigPropertiesParser } from './app-template-parsers';
7
7
  import { WorkflowDefinitionDeployer } from './workflow-definition-deployer';
@@ -95,7 +95,7 @@ export class AppDeployer {
95
95
  keywords: appDeclaration.keywords,
96
96
  configProperties,
97
97
  triggerKeyDefinitions,
98
- isDockerBased: appDeclaration.isDockerBased,
98
+ dockerImageRef: appDeclaration.dockerImageRef,
99
99
  };
100
100
  const app = await new Entities().update({ entityName: 'app', id: existingApp.id, object: updates });
101
101
  console.log(`%s Updated app: ${app.name}`, chalk.yellow.bold('APP'));
@@ -105,6 +105,12 @@ export class AppDeployer {
105
105
  public async remove(appDeclaration: AppDeclaration) {
106
106
  let app = await this.getExistingApp(appDeclaration);
107
107
  if (app) {
108
+ const actions = await getActionsForApp(app)
109
+ for(const action of actions)
110
+ {
111
+ console.log(`%s Deleting action: ${action.identifier}`, chalk.yellow.bold('APP'));
112
+ await deleteAction(action.id);
113
+ }
108
114
  app = await new Entities().delete({ entityName: 'app', id: app.id });
109
115
  console.log(`%s Deleted app: ${app.name}`, chalk.yellow.bold('APP'));
110
116
  } else {