@contrail/cli 1.0.22 → 1.0.24

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.
Files changed (31) hide show
  1. package/lib/apps/deploy-app/actions-deployer.d.ts +1 -1
  2. package/lib/apps/deploy-app/app-deployer.d.ts +2 -2
  3. package/lib/apps/deploy-app/app-deployer.js +4 -8
  4. package/lib/apps/deploy-app/app-template-parsers.d.ts +1 -1
  5. package/lib/apps/deploy-app/deploy.js +1 -2
  6. package/lib/apps/deploy-app/docker-action-builder.d.ts +10 -0
  7. package/lib/apps/deploy-app/docker-action-builder.js +97 -0
  8. package/lib/apps/deploy-app/interfaces.d.ts +2 -41
  9. package/lib/apps/deploy-app/workflow-definition-deployer.d.ts +2 -2
  10. package/lib/apps/deploy-app/workflow-definition-deployer.js +19 -15
  11. package/lib/cli.js +34 -9
  12. package/lib/colors/color-loader.js +3 -1
  13. package/lib/interfaces.d.ts +124 -0
  14. package/lib/interfaces.js +4 -0
  15. package/lib/workflows/workflow-template-deployer.d.ts +14 -0
  16. package/lib/workflows/workflow-template-deployer.js +127 -0
  17. package/lib/workflows/workflowCommands.d.ts +3 -0
  18. package/lib/workflows/workflowCommands.js +46 -0
  19. package/package.json +1 -1
  20. package/src/apps/deploy-app/actions-deployer.ts +1 -1
  21. package/src/apps/deploy-app/app-deployer.ts +5 -8
  22. package/src/apps/deploy-app/app-template-parsers.ts +1 -1
  23. package/src/apps/deploy-app/deploy.ts +2 -3
  24. package/src/apps/deploy-app/workflow-definition-deployer.ts +21 -18
  25. package/src/cli.ts +33 -9
  26. package/src/colors/color-loader.ts +3 -1
  27. package/src/{apps/deploy-app/interfaces.ts → interfaces.ts} +14 -6
  28. package/src/workflows/workflow-template-deployer.ts +157 -0
  29. package/src/workflows/workflowCommands.ts +54 -0
  30. package/templates/typescript/app.yml +1 -0
  31. package/src/apps/deploy-app/workflow-deployer.ts +0 -111
@@ -1,4 +1,4 @@
1
- import { App, AppDeclaration, AppActionDeclaration } from './interfaces';
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
4
  export declare class ActionsDeployer {
@@ -1,6 +1,6 @@
1
- import { App, AppDeclaration } from './interfaces';
1
+ import { App, AppDeclaration } from '../../interfaces';
2
2
  export declare class AppDeployer {
3
- deploy(appDeclaration: AppDeclaration, deployWorkflowTemplateOnly?: boolean): Promise<void>;
3
+ deploy(appDeclaration: AppDeclaration): Promise<void>;
4
4
  getExistingApp(appDeclaration: AppDeclaration): Promise<App>;
5
5
  private createNewApp;
6
6
  updateExistingApp(appDeclaration: AppDeclaration, existingApp: any): Promise<any>;
@@ -4,9 +4,8 @@ import { Auth } from '../../auth/auth';
4
4
  import { ActionsDeployer } from './actions-deployer';
5
5
  import { TriggerKeyDefinitionParser, ConfigPropertiesParser } from './app-template-parsers';
6
6
  import { WorkflowDefinitionDeployer } from './workflow-definition-deployer';
7
- import { WorkflowDeployer } from './workflow-deployer';
8
7
  export class AppDeployer {
9
- async deploy(appDeclaration, deployWorkflowTemplateOnly = false) {
8
+ async deploy(appDeclaration) {
10
9
  let app = await this.getExistingApp(appDeclaration);
11
10
  if (!app) {
12
11
  console.log(`%s Creating new app.`, chalk.yellow.bold('APP'));
@@ -17,12 +16,7 @@ export class AppDeployer {
17
16
  app = await this.updateExistingApp(appDeclaration, app);
18
17
  }
19
18
  await new ActionsDeployer().deployActions(appDeclaration, app);
20
- if (deployWorkflowTemplateOnly) {
21
- await new WorkflowDeployer().deployWorkflows(appDeclaration, app);
22
- }
23
- else {
24
- await new WorkflowDefinitionDeployer().deployWorkflowDefinitions(appDeclaration, app);
25
- }
19
+ await new WorkflowDefinitionDeployer().deployWorkflowDefinitions(appDeclaration, app);
26
20
  }
27
21
  async getExistingApp(appDeclaration) {
28
22
  const orgId = Auth.config.orgId;
@@ -63,6 +57,7 @@ export class AppDeployer {
63
57
  keywords: appDeclaration.keywords,
64
58
  configProperties,
65
59
  triggerKeyDefinitions,
60
+ isDockerBased: appDeclaration.isDockerBased,
66
61
  };
67
62
  const app = await new Entities().create({ entityName: 'app', object: newApp });
68
63
  console.log(`%s Created new app: ${app.name}`, chalk.yellow.bold('APP'));
@@ -87,6 +82,7 @@ export class AppDeployer {
87
82
  keywords: appDeclaration.keywords,
88
83
  configProperties,
89
84
  triggerKeyDefinitions,
85
+ isDockerBased: appDeclaration.isDockerBased,
90
86
  };
91
87
  const app = await new Entities().update({ entityName: 'app', id: existingApp.id, object: updates });
92
88
  console.log(`%s Updated app: ${app.name}`, chalk.yellow.bold('APP'));
@@ -1,4 +1,4 @@
1
- import { AppDeclaration, TriggerKeyDefinition, ConfigPropertyElements } from './interfaces';
1
+ import { AppDeclaration, TriggerKeyDefinition, ConfigPropertyElements } from '../../interfaces';
2
2
  export declare class TriggerKeyDefinitionParser {
3
3
  static buildTriggersArray(appDeclaration: AppDeclaration): Array<TriggerKeyDefinition>;
4
4
  }
@@ -26,10 +26,9 @@ export async function deployApp(args) {
26
26
  return;
27
27
  }
28
28
  console.log(`%s Deploying Application. ${appDeclaration.appIdentifier}`, chalk.blue.bold('START'));
29
- const templateOnly = args && args.includes('--template-only');
30
29
  try {
31
30
  await authUser();
32
- await new AppDeployer().deploy(appDeclaration, templateOnly);
31
+ await new AppDeployer().deploy(appDeclaration);
33
32
  }
34
33
  catch (e) {
35
34
  console.log(`%s Application Deployment Failed. ${e}`, chalk.red.bold('FAIL'));
@@ -0,0 +1,10 @@
1
+ import { App, AppDeclaration, AppActionDeclaration } from '../../interfaces';
2
+ export declare class ActionsDeployer {
3
+ deployActions(appDeclaration: AppDeclaration, app: App): Promise<void>;
4
+ getActionsForApp(app: App): Promise<any>;
5
+ deployAction(actionKey: string, actionDeclaration: AppActionDeclaration, app: App, existingActions: Array<any>): Promise<void>;
6
+ private createNewActionDefinition;
7
+ private updateActionDefinition;
8
+ getActionDeclarationIdentifier(actionKey: any, app: App): string;
9
+ getFunction(actionDeclaration: AppActionDeclaration): Promise<string>;
10
+ }
@@ -0,0 +1,97 @@
1
+ import { Entities } from '@contrail/sdk';
2
+ import chalk from 'chalk';
3
+ import { ConfigPropertiesParser } from './app-template-parsers';
4
+ import { getSeparatorByPlatform } from '../../common';
5
+ import fs from 'fs';
6
+ export class ActionsDeployer {
7
+ async deployActions(appDeclaration, app) {
8
+ // FETCH ALL ACTIONS FROM THE API.
9
+ const existingActions = await this.getActionsForApp(app);
10
+ // UPSERT / DELETE BASED ON ACTION IDENTIFIER
11
+ console.log('%s \tDeploying actions.', chalk.yellow.bold('ACTION'));
12
+ for (const actionKey of Object.keys(appDeclaration.actions)) {
13
+ await this.deployAction(actionKey, appDeclaration.actions[actionKey], app, existingActions);
14
+ }
15
+ }
16
+ async getActionsForApp(app) {
17
+ return await new Entities().get({
18
+ entityName: 'event-workflow-action-definition',
19
+ criteria: { ownerKey: `app:${app.id}` },
20
+ });
21
+ }
22
+ async deployAction(actionKey, actionDeclaration, app, existingActions) {
23
+ console.log(`%s \tDeploying action: ${actionKey}`, chalk.yellow.bold('ACTION'));
24
+ const identifier = this.getActionDeclarationIdentifier(actionKey, app);
25
+ const existingDefinition = existingActions.find(ad => ad.identifier === identifier);
26
+ if (!existingDefinition) {
27
+ await this.createNewActionDefinition(actionKey, actionDeclaration, app);
28
+ }
29
+ else {
30
+ await this.updateActionDefinition(existingDefinition, actionDeclaration);
31
+ }
32
+ }
33
+ async createNewActionDefinition(actionKey, actionDeclaration, app) {
34
+ let configProperties;
35
+ if (actionDeclaration === null || actionDeclaration === void 0 ? void 0 : actionDeclaration.actionConfiguration) {
36
+ configProperties = ConfigPropertiesParser.getConfigProperties(actionDeclaration.actionConfiguration);
37
+ }
38
+ const newObject = {
39
+ identifier: this.getActionDeclarationIdentifier(actionKey, app),
40
+ name: actionDeclaration.name,
41
+ ownerKey: `app:${app.id}`,
42
+ public: app.public,
43
+ configProperties,
44
+ };
45
+ const functionString = await this.getFunction(actionDeclaration);
46
+ if (functionString) {
47
+ newObject.executeFunctionString = functionString;
48
+ }
49
+ const actionDefinition = await new Entities().create({
50
+ entityName: 'event-workflow-action-definition',
51
+ object: newObject,
52
+ });
53
+ console.log(`%s Created new action definition: ${actionKey}`, chalk.yellow.bold('APP'));
54
+ return actionDefinition;
55
+ }
56
+ async updateActionDefinition(existingActionDefinition, actionDeclaration) {
57
+ let configProperties;
58
+ if (actionDeclaration === null || actionDeclaration === void 0 ? void 0 : actionDeclaration.actionConfiguration) {
59
+ configProperties = ConfigPropertiesParser.getConfigProperties(actionDeclaration.actionConfiguration);
60
+ }
61
+ else if (!(actionDeclaration === null || actionDeclaration === void 0 ? void 0 : actionDeclaration.actionConfiguration) && existingActionDefinition.configProperties) {
62
+ configProperties = null;
63
+ }
64
+ const updates = {
65
+ name: actionDeclaration.name,
66
+ // public: actionDeclaration.public, // TODO - an actions visibility is allowed to change
67
+ configProperties,
68
+ };
69
+ const functionString = await this.getFunction(actionDeclaration);
70
+ if (functionString) {
71
+ updates.executeFunctionString = functionString;
72
+ }
73
+ const actionDefinition = await new Entities().update({
74
+ entityName: 'event-workflow-action-definition',
75
+ id: existingActionDefinition.id,
76
+ object: updates,
77
+ });
78
+ console.log(`%s Updated existing action definition: ${actionDefinition.identifier}`, chalk.yellow.bold('APP'));
79
+ return actionDefinition;
80
+ }
81
+ getActionDeclarationIdentifier(actionKey, app) {
82
+ return app.identifier + ':' + actionKey;
83
+ }
84
+ async getFunction(actionDeclaration) {
85
+ if (!actionDeclaration.handler) {
86
+ return;
87
+ }
88
+ if (!actionDeclaration.handler.endsWith('.js')) {
89
+ throw new Error('Action handler must be a .js file.');
90
+ }
91
+ const CURRENT_DIR = process.cwd();
92
+ const separator = getSeparatorByPlatform();
93
+ const functionLocation = CURRENT_DIR + separator + actionDeclaration.handler;
94
+ const content = fs.readFileSync(functionLocation);
95
+ return content.toString();
96
+ }
97
+ }
@@ -18,9 +18,7 @@ export interface AppDeclaration {
18
18
  triggers: {
19
19
  [key: string]: AppTriggerDeclaration;
20
20
  };
21
- workflows?: {
22
- [key: string]: WorkflowDefinitionDeclaration | WorkflowTemplateDeclaration;
23
- };
21
+ isDockerBased?: boolean;
24
22
  }
25
23
  export interface ConfigPropertyElements {
26
24
  [key: string]: ConfigPropertyElement;
@@ -42,44 +40,6 @@ export interface AppTriggerDeclaration {
42
40
  external?: boolean;
43
41
  description?: string;
44
42
  }
45
- export interface WorkflowDefinitionDeclaration {
46
- id?: string;
47
- identifier: string;
48
- name: string;
49
- triggerKey: string;
50
- workflowDefinition: WorkflowDefinition;
51
- ownerKey: string;
52
- isActive: boolean;
53
- public: boolean;
54
- supportingAppId?: string;
55
- }
56
- export interface WorkflowTemplateDeclaration {
57
- id?: string;
58
- identifier: string;
59
- name: string;
60
- triggerKey: string;
61
- workflowDefinition: WorkflowDefinition;
62
- ownerKey: string;
63
- isActive: boolean;
64
- supportingAppId?: string;
65
- messageGroupId?: string;
66
- parallelWorkerCount?: number;
67
- }
68
- export interface WorkflowDefinition {
69
- paths: WorkflowConditional[];
70
- }
71
- export interface WorkflowConditional {
72
- conditional: string;
73
- actionDefinitionConfigs: ActionDefinitionConfig[];
74
- }
75
- export interface ActionDefinitionConfig {
76
- name: string;
77
- action: string;
78
- config?: {
79
- [key: string]: any;
80
- };
81
- id?: string;
82
- }
83
43
  export interface App {
84
44
  id: string;
85
45
  identifier: string;
@@ -106,6 +66,7 @@ export interface EventWorkflowActionDefinition {
106
66
  ownerKey?: string;
107
67
  public?: boolean;
108
68
  configProperties?: ConfigProperty[];
69
+ isDockerBased?: boolean;
109
70
  }
110
71
  export declare class TriggerKeyDefinition {
111
72
  name: string;
@@ -1,8 +1,8 @@
1
- import { App, AppDeclaration, WorkflowDefinitionDeclaration } from './interfaces';
1
+ import { App, AppDeclaration, WorkflowDefinition } from '../../interfaces';
2
2
  export declare class WorkflowDefinitionDeployer {
3
3
  deployWorkflowDefinitions(appDeclaration: AppDeclaration, app: App): Promise<void>;
4
4
  getWorkflowDefinitionsForApp(app: App): Promise<any>;
5
- deployWorkflow(workflowKey: string, workflow: WorkflowDefinitionDeclaration, app: App, existingWorkflows: Array<any>, appDeclaration: AppDeclaration): Promise<any>;
5
+ deployWorkflow(workflowKey: string, workflow: WorkflowDefinition, app: App, existingWorkflows: Array<any>): Promise<any>;
6
6
  private createNewWorkflowDefinition;
7
7
  private populateActionIds;
8
8
  private updateWorkflowDefinition;
@@ -8,7 +8,7 @@ export class WorkflowDefinitionDeployer {
8
8
  // UPSERT / DELETE BASED ON WORKFLOW IDENTIFIER
9
9
  console.log('%s \tDeploying workflow definitions.', chalk.yellow.bold('WORKFLOW DEFINITION'));
10
10
  for (const workflowKey of Object.keys(appDeclaration.workflows)) {
11
- await this.deployWorkflow(workflowKey, appDeclaration.workflows[workflowKey], app, existingWorkflows, appDeclaration);
11
+ await this.deployWorkflow(workflowKey, appDeclaration.workflows[workflowKey], app, existingWorkflows);
12
12
  }
13
13
  }
14
14
  async getWorkflowDefinitionsForApp(app) {
@@ -17,17 +17,17 @@ export class WorkflowDefinitionDeployer {
17
17
  criteria: { ownerKey: `app:${app.id}` },
18
18
  });
19
19
  }
20
- async deployWorkflow(workflowKey, workflow, app, existingWorkflows, appDeclaration) {
20
+ async deployWorkflow(workflowKey, workflow, app, existingWorkflows) {
21
21
  console.log(`%s \tDeploying workflow definitions: ${workflowKey}`, chalk.yellow.bold('WORKFLOW DEFINITION'));
22
22
  const identifier = this.getWorkflowDeclarationIdentifier(workflowKey, app);
23
23
  const existingDefinition = existingWorkflows.find(ad => ad.identifier === identifier);
24
24
  if (existingDefinition) {
25
- return await this.updateWorkflowDefinition(existingDefinition, workflow, app, appDeclaration);
25
+ return await this.updateWorkflowDefinition(existingDefinition, workflow, app);
26
26
  }
27
- return await this.createNewWorkflowDefinition(workflowKey, workflow, app, appDeclaration);
27
+ return await this.createNewWorkflowDefinition(workflowKey, workflow, app);
28
28
  }
29
- async createNewWorkflowDefinition(workflowKey, workflowDeclaration, app, appDeclaration) {
30
- await this.populateActionIds(workflowDeclaration, appDeclaration, app);
29
+ async createNewWorkflowDefinition(workflowKey, workflowDeclaration, app) {
30
+ await this.populateActionIds(workflowDeclaration, app);
31
31
  const newObject = {
32
32
  identifier: this.getWorkflowDeclarationIdentifier(workflowKey, app),
33
33
  name: workflowDeclaration.name,
@@ -36,6 +36,8 @@ export class WorkflowDefinitionDeployer {
36
36
  workflowDefinition: workflowDeclaration.workflowDefinition,
37
37
  public: workflowDeclaration.public,
38
38
  isActive: workflowDeclaration.isActive,
39
+ messageGroupId: workflowDeclaration.messageGroupId,
40
+ parallelWorkerCount: workflowDeclaration.parallelWorkerCount,
39
41
  };
40
42
  const workflowTemplate = await new Entities().create({
41
43
  entityName: 'event-workflow-template-definition',
@@ -44,13 +46,13 @@ export class WorkflowDefinitionDeployer {
44
46
  console.log(`%s Created new workflow definition definitions: ${workflowKey}`, chalk.yellow.bold('WORKFLOW DEFINITION'));
45
47
  return workflowTemplate;
46
48
  }
47
- async populateActionIds(workflowDeclaration, appDeclaration, app) {
49
+ async populateActionIds(workflowDefinition, app) {
48
50
  var _a;
49
51
  let availableAppActions = await getActionsForApp(app);
50
- if (!((_a = workflowDeclaration.workflowDefinition) === null || _a === void 0 ? void 0 : _a.paths)) {
52
+ if (!((_a = workflowDefinition.workflowDefinition) === null || _a === void 0 ? void 0 : _a.paths)) {
51
53
  return;
52
54
  }
53
- for (const path of workflowDeclaration.workflowDefinition.paths) {
55
+ for (const path of workflowDefinition.workflowDefinition.paths) {
54
56
  if (!(path === null || path === void 0 ? void 0 : path.actionDefinitionConfigs)) {
55
57
  continue;
56
58
  }
@@ -58,18 +60,20 @@ export class WorkflowDefinitionDeployer {
58
60
  const actionKey = actionConfiguration.action;
59
61
  const action = availableAppActions.find(action => action.identifier === getActionDeclarationIdentifier(actionKey, app));
60
62
  if (!action) {
61
- throw new Error(`Could not find action ${actionKey} declared in workflow definition ${workflowDeclaration.name}`);
63
+ throw new Error(`Could not find action ${actionKey} declared in workflow definition ${workflowDefinition.name}`);
62
64
  }
63
65
  actionConfiguration.id = action.id;
64
66
  }
65
67
  }
66
68
  }
67
- async updateWorkflowDefinition(existingWorkflowDefinition, workflowDeclaration, app, appDeclaration) {
68
- await this.populateActionIds(workflowDeclaration, appDeclaration, app);
69
+ async updateWorkflowDefinition(existingWorkflowDefinition, workflowDefinition, app) {
70
+ await this.populateActionIds(workflowDefinition, app);
69
71
  const updates = Object.assign(new Object(), {
70
- name: workflowDeclaration.name,
71
- triggerKey: workflowDeclaration.triggerKey,
72
- workflowDefinition: workflowDeclaration.workflowDefinition
72
+ name: workflowDefinition.name,
73
+ triggerKey: workflowDefinition.triggerKey,
74
+ workflowDefinition: workflowDefinition.workflowDefinition,
75
+ messageGroupId: workflowDefinition.messageGroupId,
76
+ parallelWorkerCount: workflowDefinition.parallelWorkerCount,
73
77
  });
74
78
  const updatedWorkflowDefinition = await new Entities().update({
75
79
  entityName: 'event-workflow-template-definition',
package/lib/cli.js CHANGED
@@ -7,8 +7,9 @@ import { ParseOptionSetsLocalFiles } from './types/option-set-parser';
7
7
  import { MergeOptionSets } from './types/option-set-merger';
8
8
  import { MergeTypeProperties } from './types/types-properties-merger';
9
9
  import { ParseTypesFromFiles, ParseTypesFromLocalFiles } from './types/parse-types';
10
- import { loadColors } from './colors/color-loader';
10
+ import { loadColors, deleteColors } from './colors/color-loader';
11
11
  import { listConfig, removeConfig } from './config/configCommands';
12
+ import { deleteWorkflowTemplate, deployWorkflowTemplate, listWorkflowTemplate } from './workflows/workflowCommands';
12
13
  const cliUsage = require('command-line-usage');
13
14
  /**
14
15
  * Built using documentation here:
@@ -100,10 +101,30 @@ export async function cli(args) {
100
101
  await loadColors();
101
102
  break;
102
103
  }
103
- // case 'delete': {
104
- // await deleteColors();
105
- // break;
106
- // }
104
+ case 'delete': {
105
+ await deleteColors();
106
+ break;
107
+ }
108
+ default: {
109
+ printIllegalCommand();
110
+ }
111
+ }
112
+ break;
113
+ }
114
+ case 'workflow-templates': {
115
+ switch (command) {
116
+ case 'load': {
117
+ await deployWorkflowTemplate();
118
+ break;
119
+ }
120
+ case 'delete': {
121
+ await deleteWorkflowTemplate();
122
+ break;
123
+ }
124
+ case 'list': {
125
+ await listWorkflowTemplate();
126
+ break;
127
+ }
107
128
  default: {
108
129
  printIllegalCommand();
109
130
  }
@@ -120,10 +141,6 @@ export async function cli(args) {
120
141
  await removeConfig(args);
121
142
  break;
122
143
  }
123
- // case 'delete': {
124
- // await deleteColors();
125
- // break;
126
- // }
127
144
  default: {
128
145
  printIllegalCommand();
129
146
  }
@@ -185,6 +202,14 @@ const helpSections = [
185
202
  '. green, blue) are required.',
186
203
  ],
187
204
  },
205
+ {
206
+ header: 'Workflow Template Commands - Domain: workflow-templates',
207
+ content: [
208
+ 'deploy Deploy your workflow. Assumes a workflow.yml file.',
209
+ 'delete Removes the workflows in the workflow.yml file.',
210
+ 'list Lists the workflow templates in the org',
211
+ ],
212
+ },
188
213
  {
189
214
  header: 'Type Commands - Domain: types',
190
215
  content: [
@@ -47,7 +47,9 @@ async function getLocalColors() {
47
47
  async function getExistingColors() {
48
48
  console.log(`%s Getting Existing Colors`, chalk.yellow.bold('COLORS'));
49
49
  try {
50
- return new Entities().get({ entityName: 'color' }); //, useSearch: false }); Not in EntitiesClientGetOptions yet
50
+ const result = await new Entities().get({ entityName: 'color', take: 3000 }); //, useSearch: false }); Not in EntitiesClientGetOptions yet
51
+ console.log("Found %s existing colors", result.length);
52
+ return result;
51
53
  }
52
54
  catch (e) {
53
55
  throw new Error(`ERROR DOWNLOADING COLORS: ${e}`);
@@ -0,0 +1,124 @@
1
+ /** Describes the derivative JSON / object represented
2
+ * in app.yml file.
3
+ */
4
+ export interface AppDeclaration {
5
+ appIdentifier: string;
6
+ appName: string;
7
+ appDescription?: string;
8
+ visibility: 'private' | 'public';
9
+ publisher: string;
10
+ version: string;
11
+ eventWorkflowTriggerKeyMapping: string;
12
+ thumbnail?: string;
13
+ keywords?: Array<string>;
14
+ actions?: {
15
+ [key: string]: AppActionDeclaration;
16
+ };
17
+ appConfiguration: ConfigPropertyElements;
18
+ triggers: {
19
+ [key: string]: AppTriggerDeclaration;
20
+ };
21
+ workflows?: {
22
+ [key: string]: WorkflowDefinition | WorkflowTemplateDeclaration;
23
+ };
24
+ isDockerBased?: boolean;
25
+ }
26
+ export interface ConfigPropertyElements {
27
+ [key: string]: ConfigPropertyElement;
28
+ }
29
+ export interface ConfigPropertyElement {
30
+ propertyType: string;
31
+ options?: any[];
32
+ label: string;
33
+ }
34
+ export interface AppActionDeclaration {
35
+ handler: string;
36
+ name: string;
37
+ description?: string;
38
+ actionConfiguration?: ConfigPropertyElements;
39
+ }
40
+ export interface AppTriggerDeclaration {
41
+ key: string;
42
+ name: string;
43
+ external?: boolean;
44
+ description?: string;
45
+ }
46
+ export interface WorkflowDefinition {
47
+ id?: string;
48
+ identifier: string;
49
+ name: string;
50
+ triggerKey: string;
51
+ workflowDefinition: WorkflowDefinitionPaths;
52
+ ownerKey: string;
53
+ isActive: boolean;
54
+ public: boolean;
55
+ supportingAppId?: string;
56
+ messageGroupId?: string;
57
+ parallelWorkerCount?: number;
58
+ }
59
+ export interface WorkflowTemplateDeclaration {
60
+ workflows?: {
61
+ [key: string]: WorkflowTemplate;
62
+ };
63
+ }
64
+ export interface WorkflowTemplate {
65
+ id?: string;
66
+ identifier: string;
67
+ name: string;
68
+ triggerKey: string;
69
+ workflowDefinition: WorkflowDefinitionPaths;
70
+ isActive: boolean;
71
+ ownerKey?: string;
72
+ supportingAppId?: string;
73
+ messageGroupId?: string;
74
+ parallelWorkerCount?: number;
75
+ }
76
+ export interface WorkflowDefinitionPaths {
77
+ paths: WorkflowConditional[];
78
+ }
79
+ export interface WorkflowConditional {
80
+ conditional: string;
81
+ actionDefinitionConfigs: ActionDefinitionConfig[];
82
+ }
83
+ export interface ActionDefinitionConfig {
84
+ name: string;
85
+ action: string;
86
+ config?: {
87
+ [key: string]: any;
88
+ };
89
+ id?: string;
90
+ }
91
+ export interface App {
92
+ id: string;
93
+ identifier: string;
94
+ name: string;
95
+ public: boolean;
96
+ description?: string;
97
+ publisher: string;
98
+ thumbnail: string;
99
+ eventWorkflowTriggerKeyMapping: string;
100
+ configProperties?: ConfigProperty[];
101
+ triggerKeyDefinitions?: TriggerKeyDefinition[];
102
+ }
103
+ export declare class ConfigProperty {
104
+ slug: string;
105
+ propertyType: string;
106
+ options?: any[];
107
+ label: string;
108
+ }
109
+ export interface EventWorkflowActionDefinition {
110
+ id?: string;
111
+ identifier?: string;
112
+ name?: string;
113
+ executeFunctionString?: string;
114
+ ownerKey?: string;
115
+ public?: boolean;
116
+ configProperties?: ConfigProperty[];
117
+ isDockerBased?: boolean;
118
+ }
119
+ export declare class TriggerKeyDefinition {
120
+ name: string;
121
+ description?: string;
122
+ triggerKey: string;
123
+ external?: boolean;
124
+ }
@@ -0,0 +1,4 @@
1
+ export class ConfigProperty {
2
+ }
3
+ export class TriggerKeyDefinition {
4
+ }
@@ -0,0 +1,14 @@
1
+ import { WorkflowTemplate, WorkflowTemplateDeclaration } from '../interfaces';
2
+ export declare class WorkflowTemplateDeployer {
3
+ deployWorkflows(wtDeclaration: WorkflowTemplateDeclaration): Promise<void>;
4
+ getExistingWorkflowTemplates(): Promise<any>;
5
+ deployWorkflowTemplate(workflowKey: string, workflow: WorkflowTemplate, existingWorkflows: Array<any>): Promise<any>;
6
+ private createNewWorkflowTemplate;
7
+ private populateActionIds;
8
+ private updateWorkflowTemplate;
9
+ deleteWorkflowTemplates(wtDeclaration: WorkflowTemplateDeclaration): Promise<void>;
10
+ private deleteWorkflowTemplate;
11
+ listExistingWorkflowTemplates(): Promise<any>;
12
+ }
13
+ export declare function getWorkflowTemplateIdentifier(workflowKey: string): string;
14
+ export declare function getActionByIdentifier(identifier: string): Promise<any>;