@contrail/cli 1.0.39 → 1.0.40
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.
- package/lib/api/apps.d.ts +13 -0
- package/lib/api/apps.js +85 -0
- package/lib/api/event-workflow-action-definition.d.ts +1 -0
- package/lib/api/event-workflow-action-definition.js +7 -0
- package/lib/api/event-workflow-template-definition.d.ts +5 -0
- package/lib/api/event-workflow-template-definition.js +14 -0
- package/lib/api/event-workflow-templates.d.ts +7 -0
- package/lib/api/event-workflow-templates.js +25 -0
- package/lib/apps/deploy-app/app-deployer.js +4 -17
- package/lib/apps/deploy-app/workflow-definition-deployer.js +2 -1
- package/lib/apps/install-app/app-installer.js +21 -4
- package/lib/apps/upgrade-app/app-upgrader.js +1 -1
- package/lib/auth/login.js +2 -2
- package/lib/cli.js +112 -44
- package/lib/config/config.d.ts +2 -2
- package/lib/config/configCommands.d.ts +1 -0
- package/lib/config/configCommands.js +25 -1
- package/lib/interfaces.d.ts +65 -1
- package/lib/interfaces.js +21 -0
- package/lib/workflow-template-definitions/workflow-template-definition-commands.d.ts +2 -0
- package/lib/workflow-template-definitions/workflow-template-definition-commands.js +10 -0
- package/lib/workflow-template-definitions/workflow-template-definition-deployer.d.ts +12 -0
- package/lib/workflow-template-definitions/workflow-template-definition-deployer.js +148 -0
- package/lib/workflow-templates/local-workflow-template-deployer.d.ts +11 -0
- package/lib/workflow-templates/local-workflow-template-deployer.js +102 -0
- package/lib/workflow-templates/workflow-template-commands.d.ts +4 -0
- package/lib/workflow-templates/workflow-template-commands.js +51 -0
- package/lib/workflow-templates/workflow-template-deployer.d.ts +4 -0
- package/lib/workflow-templates/workflow-template-deployer.js +25 -0
- package/package.json +1 -1
- package/src/api/apps.ts +97 -0
- package/src/api/event-workflow-action-definition.ts +8 -0
- package/src/api/event-workflow-template-definition.ts +16 -0
- package/src/api/event-workflow-templates.ts +29 -0
- package/src/apps/deploy-app/app-deployer.ts +4 -19
- package/src/apps/install-app/app-installer.ts +34 -13
- package/src/apps/upgrade-app/app-upgrader.ts +1 -1
- package/src/auth/login.ts +2 -2
- package/src/cli.ts +114 -44
- package/src/config/config.ts +2 -2
- package/src/config/configCommands.ts +26 -1
- package/src/interfaces.ts +76 -6
- package/src/workflow-template-definitions/workflow-template-definition-commands.ts +13 -0
- package/src/workflow-template-definitions/workflow-template-definition-deployer.ts +182 -0
- package/src/{workflows/workflow-template-deployer.ts → workflow-templates/local-workflow-template-deployer.ts} +9 -38
- package/src/{workflows/workflowCommands.ts → workflow-templates/workflow-template-commands.ts} +10 -4
- package/src/workflow-templates/workflow-template-deployer.ts +29 -0
- package/src/apps/app-api.ts +0 -66
- package/src/apps/deploy-app/workflow-definition-deployer.ts +0 -118
- package/tslint.json +0 -57
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { App, AppOrg, AppVersion, WorkflowDefinition } from '../interfaces';
|
|
2
|
+
export declare function getAllAvailableApps(options: {
|
|
3
|
+
orgId: string;
|
|
4
|
+
}): Promise<App[]>;
|
|
5
|
+
export declare function getWorkflowTemplateDefinitionsForApp(options: {
|
|
6
|
+
appId: string;
|
|
7
|
+
}): Promise<WorkflowDefinition[]>;
|
|
8
|
+
export declare function getAppVersions(app: any): Promise<AppVersion[]>;
|
|
9
|
+
export declare function upgradeAppVersion(appOrg: any, appVersionId: any): Promise<AppOrg>;
|
|
10
|
+
export declare function deleteAppOrg(appOrgId: string): Promise<AppOrg>;
|
|
11
|
+
export declare function getInstalledApps(): Promise<AppOrg[]>;
|
|
12
|
+
export declare function installAppToOrg(app: any, configProperties: any): Promise<AppOrg>;
|
|
13
|
+
export declare function getAvailableApps(): Promise<App[]>;
|
package/lib/api/apps.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Auth } from '../auth/auth';
|
|
2
|
+
import { Entities } from '@contrail/sdk';
|
|
3
|
+
export async function getAllAvailableApps(options) {
|
|
4
|
+
const apps = [];
|
|
5
|
+
apps.push(...await new Entities().get({
|
|
6
|
+
entityName: 'app',
|
|
7
|
+
criteria: {
|
|
8
|
+
orgId: options.orgId,
|
|
9
|
+
private: true,
|
|
10
|
+
},
|
|
11
|
+
}));
|
|
12
|
+
apps.push(...await new Entities().get({
|
|
13
|
+
entityName: 'app',
|
|
14
|
+
criteria: {
|
|
15
|
+
orgId: options.orgId,
|
|
16
|
+
private: false,
|
|
17
|
+
},
|
|
18
|
+
}));
|
|
19
|
+
return apps;
|
|
20
|
+
}
|
|
21
|
+
export async function getWorkflowTemplateDefinitionsForApp(options) {
|
|
22
|
+
return await new Entities().get({
|
|
23
|
+
entityName: 'event-workflow-template-definition',
|
|
24
|
+
criteria: {
|
|
25
|
+
ownerKey: `app:${options.appId}`
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export async function getAppVersions(app) {
|
|
30
|
+
return await new Entities().get({
|
|
31
|
+
entityName: 'app-version',
|
|
32
|
+
criteria: {
|
|
33
|
+
appId: app.id
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export async function upgradeAppVersion(appOrg, appVersionId) {
|
|
38
|
+
return await new Entities().update({
|
|
39
|
+
entityName: 'app-org',
|
|
40
|
+
id: appOrg.id,
|
|
41
|
+
object: {
|
|
42
|
+
appVersionId: appVersionId
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export async function deleteAppOrg(appOrgId) {
|
|
47
|
+
return await new Entities().delete({
|
|
48
|
+
entityName: 'app-org',
|
|
49
|
+
id: appOrgId
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export async function getInstalledApps() {
|
|
53
|
+
return await new Entities().get({
|
|
54
|
+
entityName: 'app-org',
|
|
55
|
+
relations: ['app']
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export async function installAppToOrg(app, configProperties) {
|
|
59
|
+
return await new Entities().create({
|
|
60
|
+
entityName: 'app-org',
|
|
61
|
+
object: {
|
|
62
|
+
appId: app.id,
|
|
63
|
+
appConfig: configProperties
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
export async function getAvailableApps() {
|
|
68
|
+
const orgId = Auth.config.orgId;
|
|
69
|
+
const apps = [];
|
|
70
|
+
apps.push(...await new Entities().get({
|
|
71
|
+
entityName: 'app',
|
|
72
|
+
criteria: {
|
|
73
|
+
orgId,
|
|
74
|
+
private: true,
|
|
75
|
+
},
|
|
76
|
+
}));
|
|
77
|
+
apps.push(...await new Entities().get({
|
|
78
|
+
entityName: 'app',
|
|
79
|
+
criteria: {
|
|
80
|
+
orgId,
|
|
81
|
+
private: false,
|
|
82
|
+
},
|
|
83
|
+
}));
|
|
84
|
+
return apps;
|
|
85
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getEventWorkflowActionDefinition(criteria: any): Promise<any>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Entities } from '@contrail/sdk';
|
|
2
|
+
export async function createWorkflowTemplateDefinition(object) {
|
|
3
|
+
return await new Entities().create({
|
|
4
|
+
entityName: 'event-workflow-template-definition',
|
|
5
|
+
object: object,
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
export async function updateWorkflowTemplateDefinition(options) {
|
|
9
|
+
return await new Entities().update({
|
|
10
|
+
entityName: 'event-workflow-template-definition',
|
|
11
|
+
id: options.id,
|
|
12
|
+
object: options.updates,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function getExistingWorkflowTemplates(): Promise<any>;
|
|
2
|
+
export declare function createWorkflowTemplate(object: any): Promise<any>;
|
|
3
|
+
export declare function deleteWorkflowTemplate(id: string): Promise<any>;
|
|
4
|
+
export declare function updateWorkflowTemplate(options: {
|
|
5
|
+
id: string;
|
|
6
|
+
updates: any;
|
|
7
|
+
}): Promise<any>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Entities } from '@contrail/sdk';
|
|
2
|
+
export async function getExistingWorkflowTemplates() {
|
|
3
|
+
return await new Entities().get({
|
|
4
|
+
entityName: 'event-workflow-template'
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
export async function createWorkflowTemplate(object) {
|
|
8
|
+
return await new Entities().create({
|
|
9
|
+
entityName: 'event-workflow-template',
|
|
10
|
+
object
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export async function deleteWorkflowTemplate(id) {
|
|
14
|
+
return await new Entities().delete({
|
|
15
|
+
entityName: 'event-workflow-template',
|
|
16
|
+
id,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export async function updateWorkflowTemplate(options) {
|
|
20
|
+
return await new Entities().update({
|
|
21
|
+
entityName: 'event-workflow-template',
|
|
22
|
+
id: options.id,
|
|
23
|
+
object: options.updates,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -3,7 +3,8 @@ import chalk from 'chalk';
|
|
|
3
3
|
import { Auth } from '../../auth/auth';
|
|
4
4
|
import { ActionsDeployer, getActionsForApp, deleteAction } from './actions-deployer';
|
|
5
5
|
import { TriggerKeyDefinitionParser, ConfigPropertiesParser } from './app-template-parsers';
|
|
6
|
-
import {
|
|
6
|
+
import { WorkflowTemplateDefinitionDeployer } from '../../workflow-template-definitions/workflow-template-definition-deployer';
|
|
7
|
+
import { getAllAvailableApps } from '../../api/apps';
|
|
7
8
|
export class AppDeployer {
|
|
8
9
|
async deploy(appDeclaration) {
|
|
9
10
|
let app = await this.getExistingApp(appDeclaration);
|
|
@@ -16,25 +17,11 @@ export class AppDeployer {
|
|
|
16
17
|
app = await this.updateExistingApp(appDeclaration, app);
|
|
17
18
|
}
|
|
18
19
|
await new ActionsDeployer().deployActions(appDeclaration, app);
|
|
19
|
-
await new
|
|
20
|
+
await new WorkflowTemplateDefinitionDeployer().deployWorkflowTemplateDefinitions(appDeclaration, app);
|
|
20
21
|
}
|
|
21
22
|
async getExistingApp(appDeclaration) {
|
|
22
23
|
const orgId = Auth.config.orgId;
|
|
23
|
-
const apps =
|
|
24
|
-
apps.push(...await new Entities().get({
|
|
25
|
-
entityName: 'app',
|
|
26
|
-
criteria: {
|
|
27
|
-
orgId,
|
|
28
|
-
private: true,
|
|
29
|
-
},
|
|
30
|
-
}));
|
|
31
|
-
apps.push(...await new Entities().get({
|
|
32
|
-
entityName: 'app',
|
|
33
|
-
criteria: {
|
|
34
|
-
orgId,
|
|
35
|
-
private: false,
|
|
36
|
-
},
|
|
37
|
-
}));
|
|
24
|
+
const apps = await getAllAvailableApps({ orgId });
|
|
38
25
|
return apps.find(app => app.identifier === appDeclaration.appIdentifier);
|
|
39
26
|
}
|
|
40
27
|
async createNewApp(appDeclaration) {
|
|
@@ -32,6 +32,7 @@ export class WorkflowDefinitionDeployer {
|
|
|
32
32
|
return await this.createNewWorkflowDefinition(workflowKey, workflow, app);
|
|
33
33
|
}
|
|
34
34
|
async createNewWorkflowDefinition(workflowKey, workflowDeclaration, app) {
|
|
35
|
+
var _a;
|
|
35
36
|
await this.populateActionIds(workflowDeclaration, app);
|
|
36
37
|
const newObject = {
|
|
37
38
|
identifier: this.getWorkflowDeclarationIdentifier(workflowKey, app),
|
|
@@ -39,7 +40,7 @@ export class WorkflowDefinitionDeployer {
|
|
|
39
40
|
ownerKey: `app:${app.id}`,
|
|
40
41
|
triggerKey: workflowDeclaration.triggerKey,
|
|
41
42
|
workflowDefinition: workflowDeclaration.workflowDefinition,
|
|
42
|
-
public: workflowDeclaration.public,
|
|
43
|
+
public: (_a = workflowDeclaration.public) !== null && _a !== void 0 ? _a : false,
|
|
43
44
|
isActive: workflowDeclaration.isActive,
|
|
44
45
|
messageGroupId: workflowDeclaration.messageGroupId,
|
|
45
46
|
parallelWorkerCount: workflowDeclaration.parallelWorkerCount,
|
|
@@ -2,7 +2,8 @@ import inquirer from 'inquirer';
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { Entities } from '@contrail/sdk';
|
|
4
4
|
import { authUser } from '../../auth/login';
|
|
5
|
-
import { deleteAppOrg, getAvailableApps, getInstalledApps, installAppToOrg } from '
|
|
5
|
+
import { deleteAppOrg, getAvailableApps, getInstalledApps, getWorkflowTemplateDefinitionsForApp, installAppToOrg } from '../../api/apps';
|
|
6
|
+
import { WorkflowTemplateDefinitionDeployer } from '../../workflow-template-definitions/workflow-template-definition-deployer';
|
|
6
7
|
async function getConfigProperties(app) {
|
|
7
8
|
const config = {};
|
|
8
9
|
for (const key of Object.keys(app.configProperties)) {
|
|
@@ -69,7 +70,7 @@ export async function installApp() {
|
|
|
69
70
|
message: 'Which app would you like to install?',
|
|
70
71
|
choices: installableApps.map(x => x.identifier)
|
|
71
72
|
});
|
|
72
|
-
|
|
73
|
+
let answers = await inquirer.prompt(questions);
|
|
73
74
|
const app = installableApps.find(x => x.identifier === answers.appIdentifier);
|
|
74
75
|
let configProperties;
|
|
75
76
|
if (app.configProperties) {
|
|
@@ -84,7 +85,7 @@ export async function installApp() {
|
|
|
84
85
|
const installingApp = await new Entities().get({ entityName: 'app-org', id: appOrg.id });
|
|
85
86
|
if (installingApp.status === 'READY') {
|
|
86
87
|
console.log('%s App installed', chalk.green.bold('APP INSTALLATION'));
|
|
87
|
-
|
|
88
|
+
break;
|
|
88
89
|
}
|
|
89
90
|
if (installingApp.status === 'FAILED_INSTALLING') {
|
|
90
91
|
console.log('%s App installation failed', chalk.red.bold('APP INSTALLATION'));
|
|
@@ -93,10 +94,26 @@ export async function installApp() {
|
|
|
93
94
|
process.stdout.write('.');
|
|
94
95
|
}
|
|
95
96
|
catch (e) {
|
|
97
|
+
console.log('%s App installation failed', chalk.red.bold('APP INSTALLATION'));
|
|
96
98
|
console.log('Error is:', e);
|
|
97
|
-
|
|
99
|
+
return;
|
|
98
100
|
}
|
|
99
101
|
}
|
|
102
|
+
const workflowTemplateDefinitions = await getWorkflowTemplateDefinitionsForApp({ appId: app.id });
|
|
103
|
+
if (!workflowTemplateDefinitions.length) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
answers = await inquirer.prompt([{
|
|
107
|
+
type: 'confirm',
|
|
108
|
+
name: 'shouldInstallWorkflows',
|
|
109
|
+
message: 'Would you like to install the Workflows associated with this app?',
|
|
110
|
+
default: false
|
|
111
|
+
}]);
|
|
112
|
+
if (!answers.shouldInstallWorkflows) {
|
|
113
|
+
console.log('%s Not installing associated app workflows', chalk.yellow.bold('APP INSTALLATION'));
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
new WorkflowTemplateDefinitionDeployer().installWorkflowTemplateDefinitions(workflowTemplateDefinitions);
|
|
100
117
|
}
|
|
101
118
|
function delay(ms) {
|
|
102
119
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
@@ -2,7 +2,7 @@ import inquirer from 'inquirer';
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { Entities } from '@contrail/sdk';
|
|
4
4
|
import { authUser } from '../../auth/login';
|
|
5
|
-
import { deleteAppOrg, getAppVersions, getAvailableApps, getInstalledApps, installAppToOrg, upgradeAppVersion } from '
|
|
5
|
+
import { deleteAppOrg, getAppVersions, getAvailableApps, getInstalledApps, installAppToOrg, upgradeAppVersion } from '../../api/apps';
|
|
6
6
|
async function getConfigProperties(app) {
|
|
7
7
|
const config = {};
|
|
8
8
|
for (const key of Object.keys(app.configProperties)) {
|
package/lib/auth/login.js
CHANGED
|
@@ -4,8 +4,8 @@ import { Request, setConfig as setSdkConfig } from '@contrail/sdk';
|
|
|
4
4
|
import { Auth } from './auth';
|
|
5
5
|
import { getConfig, storeConfig } from '../config/config';
|
|
6
6
|
const CONFIGURATION = {
|
|
7
|
-
userPoolId: 'us-east-
|
|
8
|
-
clientId: process.env.CONTRAIL_COGNITO_CLIENT_ID || '
|
|
7
|
+
userPoolId: 'us-east-1_x8hXZUsL6',
|
|
8
|
+
clientId: process.env.CONTRAIL_COGNITO_CLIENT_ID || '2oubek96sue5rsncovtqhs3scm',
|
|
9
9
|
};
|
|
10
10
|
export async function authUser() {
|
|
11
11
|
console.debug('authorizing user');
|
package/lib/cli.js
CHANGED
|
@@ -8,10 +8,11 @@ import { MergeOptionSets } from './types/option-set-merger';
|
|
|
8
8
|
import { MergeTypeProperties } from './types/types-properties-merger';
|
|
9
9
|
import { ParseTypesFromFiles, ParseTypesFromLocalFiles, ParseTypesFromTemplateFromLocalFiles } from './types/parse-types';
|
|
10
10
|
import { loadColors, deleteColors } from './colors/color-loader';
|
|
11
|
-
import { listConfig, removeConfig } from './config/configCommands';
|
|
12
|
-
import {
|
|
11
|
+
import { listConfig, removeConfig, setConfig } from './config/configCommands';
|
|
12
|
+
import { deleteWorkflowTemplates, localDeployWorkflowTemplate, listWorkflowTemplate } from './workflow-templates/workflow-template-commands';
|
|
13
13
|
import { installApp, uninstallApp } from './apps/install-app/app-installer';
|
|
14
14
|
import { upgradeApp } from './apps/upgrade-app/app-upgrader';
|
|
15
|
+
import { cliInstallWorkflowTemplateDefinitions, listWorkflowTemplateDefinitions } from './workflow-template-definitions/workflow-template-definition-commands';
|
|
15
16
|
const cliUsage = require('command-line-usage');
|
|
16
17
|
/**
|
|
17
18
|
* Built using documentation here:
|
|
@@ -19,8 +20,6 @@ const cliUsage = require('command-line-usage');
|
|
|
19
20
|
*/
|
|
20
21
|
export async function cli(args) {
|
|
21
22
|
const fullCommand = args[2];
|
|
22
|
-
let domain;
|
|
23
|
-
let command;
|
|
24
23
|
if (!fullCommand) {
|
|
25
24
|
printIllegalCommand();
|
|
26
25
|
return;
|
|
@@ -30,12 +29,15 @@ export async function cli(args) {
|
|
|
30
29
|
printIllegalCommand();
|
|
31
30
|
return;
|
|
32
31
|
}
|
|
33
|
-
if ((commandParts === null || commandParts === void 0 ? void 0 : commandParts.length) < 2 &&
|
|
32
|
+
if ((commandParts === null || commandParts === void 0 ? void 0 : commandParts.length) < 2 &&
|
|
33
|
+
commandParts[0].toLowerCase() !== 'help' &&
|
|
34
|
+
commandParts[0].toLowerCase() !== '-help' &&
|
|
35
|
+
commandParts[0].toLowerCase() !== '--help') {
|
|
34
36
|
printIllegalCommand();
|
|
35
37
|
return;
|
|
36
38
|
}
|
|
37
|
-
domain = commandParts[0];
|
|
38
|
-
command = commandParts[1];
|
|
39
|
+
const domain = commandParts[0];
|
|
40
|
+
const command = commandParts[1];
|
|
39
41
|
switch (domain) {
|
|
40
42
|
case 'app': {
|
|
41
43
|
switch (command) {
|
|
@@ -132,11 +134,11 @@ export async function cli(args) {
|
|
|
132
134
|
case 'workflow-templates': {
|
|
133
135
|
switch (command) {
|
|
134
136
|
case 'load': {
|
|
135
|
-
await
|
|
137
|
+
await localDeployWorkflowTemplate();
|
|
136
138
|
break;
|
|
137
139
|
}
|
|
138
140
|
case 'delete': {
|
|
139
|
-
await
|
|
141
|
+
await deleteWorkflowTemplates();
|
|
140
142
|
break;
|
|
141
143
|
}
|
|
142
144
|
case 'list': {
|
|
@@ -149,12 +151,32 @@ export async function cli(args) {
|
|
|
149
151
|
}
|
|
150
152
|
break;
|
|
151
153
|
}
|
|
154
|
+
case 'workflow-template-definitions': {
|
|
155
|
+
switch (command) {
|
|
156
|
+
case 'install': {
|
|
157
|
+
await cliInstallWorkflowTemplateDefinitions();
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
case 'list': {
|
|
161
|
+
await listWorkflowTemplateDefinitions();
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
default: {
|
|
165
|
+
printIllegalCommand();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
152
170
|
case 'config': {
|
|
153
171
|
switch (command) {
|
|
154
172
|
case 'list': {
|
|
155
173
|
await listConfig();
|
|
156
174
|
break;
|
|
157
175
|
}
|
|
176
|
+
case 'set': {
|
|
177
|
+
await setConfig(args);
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
158
180
|
case 'remove': {
|
|
159
181
|
await removeConfig(args);
|
|
160
182
|
break;
|
|
@@ -205,55 +227,101 @@ const helpSections = [
|
|
|
205
227
|
{
|
|
206
228
|
header: 'App Commands - Domain: app',
|
|
207
229
|
content: [
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
230
|
+
{
|
|
231
|
+
name: 'create',
|
|
232
|
+
summary: 'Create a new app workspace.'
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: 'deploy [--template-only]',
|
|
236
|
+
summary: 'Deploy your app. --template-only can be used to deploy event workflow as a template directly to the org'
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
name: 'remove',
|
|
240
|
+
summary: 'Remove your app.'
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: 'install',
|
|
244
|
+
summary: 'Install an app to your org.'
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
name: 'uninstall',
|
|
248
|
+
summary: 'Uninstall an app from your org.'
|
|
249
|
+
},
|
|
216
250
|
],
|
|
217
251
|
},
|
|
218
252
|
{
|
|
219
253
|
header: 'Colors Commands - Domain: colors',
|
|
220
|
-
content: [
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
254
|
+
content: [{
|
|
255
|
+
name: 'load',
|
|
256
|
+
summary: 'Load colors from a CSV. Headers (name, hex, red, green, blue) are required'
|
|
257
|
+
}
|
|
258
|
+
// , {name: 'delete', summary: 'Delete all colors.'}
|
|
224
259
|
],
|
|
225
260
|
},
|
|
226
261
|
{
|
|
227
262
|
header: 'Workflow Template Commands - Domain: workflow-templates',
|
|
228
263
|
content: [
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
264
|
+
{
|
|
265
|
+
name: 'deploy',
|
|
266
|
+
summary: 'Deploy your workflow. Assumes a workflow.yml file.'
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: 'delete',
|
|
270
|
+
summary: 'Removes the workflows in the workflow.yml file.'
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
name: 'list',
|
|
274
|
+
summary: 'Lists the workflow templates in the org'
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
header: 'Workflow Template Definition Commands - Domain: workflow-template-definitions',
|
|
280
|
+
content: [{
|
|
281
|
+
name: 'install',
|
|
282
|
+
summary: 'Install the template definitions of an app to your org'
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
name: 'list',
|
|
286
|
+
summary: 'Lists the workflow templates in the org'
|
|
287
|
+
}
|
|
232
288
|
],
|
|
233
289
|
},
|
|
234
290
|
{
|
|
235
291
|
header: 'Type Commands - Domain: types',
|
|
236
292
|
content: [
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
293
|
+
{
|
|
294
|
+
name: 'getAll',
|
|
295
|
+
summary: 'Get all OptionSets and Types for your Org.'
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: 'uploadTypes',
|
|
299
|
+
summary: 'Upload Types for your Org. Types are uploaded from types.yml\n'
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
name: 'uploadOptionSets',
|
|
303
|
+
summary: 'Upload OptionSets for your Org. OptionSets are loaded from option_sets.yml\n'
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
name: 'parseOptionSetsLocalFiles <File Paths>',
|
|
307
|
+
summary: 'Parse CSV files into OptionSets'
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
name: 'parseTypesFromLocalFiles <File Paths>',
|
|
311
|
+
summary: 'Parse CSV files into Types and OptionSets from local files.\n'
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
name: 'parseTypesFromTemplateFromLocalFiles <File Paths>',
|
|
315
|
+
summary: 'Parse CSV files into Types and OptionSets from local files.\n'
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: 'parseTypesFromFiles <fileIds>',
|
|
319
|
+
summary: 'Parse CSV files into Types and OptionSets from VibeIQ Files.\n File must be .yml\n'
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
name: 'mergeTypeProperties <File Path> <TypePaths>',
|
|
323
|
+
summary: 'Merge the TypeProperties from an existing org and the TypeProperties passed in. Add to Types via TypePath File must be .yml\n'
|
|
324
|
+
},
|
|
257
325
|
],
|
|
258
326
|
},
|
|
259
327
|
];
|
package/lib/config/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare function initializeVibeIQConfig(): Promise<void>;
|
|
2
2
|
export declare function readVibeIQConfig(): Promise<any>;
|
|
3
|
-
export declare function writeVibeIQConfig(config:
|
|
3
|
+
export declare function writeVibeIQConfig(config: any): Promise<void>;
|
|
4
4
|
export declare function getConfig(): Promise<any>;
|
|
5
5
|
export declare function deleteConfigs(configNames: string[]): Promise<void>;
|
|
6
|
-
export declare function storeConfig(incomingConfig:
|
|
6
|
+
export declare function storeConfig(incomingConfig: any, merge?: boolean): Promise<void>;
|
|
@@ -1,7 +1,31 @@
|
|
|
1
|
-
import { deleteConfigs, readVibeIQConfig } from './config';
|
|
1
|
+
import { deleteConfigs, readVibeIQConfig, storeConfig } from './config';
|
|
2
2
|
export async function listConfig() {
|
|
3
3
|
console.log(await readVibeIQConfig());
|
|
4
4
|
}
|
|
5
|
+
export async function setConfig(args) {
|
|
6
|
+
const helpConfigLine = `
|
|
7
|
+
Usage:
|
|
8
|
+
contrail config.set key1=value1 key2=value2
|
|
9
|
+
`;
|
|
10
|
+
if ((args === null || args === void 0 ? void 0 : args.length) < 4) {
|
|
11
|
+
console.log(helpConfigLine);
|
|
12
|
+
throw new Error('You need to pass at least one config to set');
|
|
13
|
+
}
|
|
14
|
+
const configsToSet = args.slice(3);
|
|
15
|
+
const config = {};
|
|
16
|
+
for (const conf of configsToSet) {
|
|
17
|
+
if (conf.length < 3 || conf.indexOf('=') <= 0) {
|
|
18
|
+
console.log(helpConfigLine);
|
|
19
|
+
throw new Error(`value ${conf} does not adhere to key1=value1 standard`);
|
|
20
|
+
}
|
|
21
|
+
const [key, value] = conf.split('=');
|
|
22
|
+
console.log('key and value:', key, value);
|
|
23
|
+
console.log(conf.split('='));
|
|
24
|
+
config[key] = value;
|
|
25
|
+
}
|
|
26
|
+
console.log('config is:', config);
|
|
27
|
+
await storeConfig(config);
|
|
28
|
+
}
|
|
5
29
|
export async function removeConfig(args) {
|
|
6
30
|
if ((args === null || args === void 0 ? void 0 : args.length) < 4) {
|
|
7
31
|
throw new Error('At least one configuration must be included to be removed.');
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export interface WorkflowTemplateDeclaration {
|
|
|
66
66
|
}
|
|
67
67
|
export interface WorkflowTemplate {
|
|
68
68
|
id?: string;
|
|
69
|
-
identifier
|
|
69
|
+
identifier?: string;
|
|
70
70
|
name: string;
|
|
71
71
|
triggerKey: string;
|
|
72
72
|
workflowDefinition: WorkflowDefinitionPaths;
|
|
@@ -103,6 +103,70 @@ export interface App {
|
|
|
103
103
|
configProperties?: ConfigProperty[];
|
|
104
104
|
triggerKeyDefinitions?: TriggerKeyDefinition[];
|
|
105
105
|
}
|
|
106
|
+
export interface AppOrg {
|
|
107
|
+
id: string;
|
|
108
|
+
createdOn?: Date;
|
|
109
|
+
updatedOn?: Date;
|
|
110
|
+
createdById?: string;
|
|
111
|
+
updatedById?: string;
|
|
112
|
+
createdBy?: any;
|
|
113
|
+
updatedBy?: any;
|
|
114
|
+
orgId?: string;
|
|
115
|
+
status: AppOrgStatus;
|
|
116
|
+
appId?: string;
|
|
117
|
+
app?: App;
|
|
118
|
+
appVersionId?: string;
|
|
119
|
+
appVersion?: AppVersion;
|
|
120
|
+
apiKey?: AppApiKey;
|
|
121
|
+
appConfig?: any;
|
|
122
|
+
}
|
|
123
|
+
export declare enum AppOrgStatus {
|
|
124
|
+
INSTALLING = "INSTALLING",
|
|
125
|
+
FAILED_INSTALLING = "FAILED_INSTALLING",
|
|
126
|
+
READY = "READY",
|
|
127
|
+
DELETING = "DELETING",
|
|
128
|
+
FAILED_DELETING = "FAILED_DELETING"
|
|
129
|
+
}
|
|
130
|
+
export declare enum AppVersionStatus {
|
|
131
|
+
PUBLISHING = "PUBLISHING",
|
|
132
|
+
FAILED_PUBLISHING = "FAILED_PUBLISHING",
|
|
133
|
+
PUBLISHED = "PUBLISHED",
|
|
134
|
+
ARCHIVING = "ARCHIVING",
|
|
135
|
+
FAILED_ARCHIVING = "FAILED_ARCHIVING",
|
|
136
|
+
ARCHIVED = "ARCHIVED"
|
|
137
|
+
}
|
|
138
|
+
export declare class AppVersion {
|
|
139
|
+
id: string;
|
|
140
|
+
createdOn?: Date;
|
|
141
|
+
updatedOn?: Date;
|
|
142
|
+
createdById?: string;
|
|
143
|
+
updatedById?: string;
|
|
144
|
+
createdBy?: any;
|
|
145
|
+
updatedBy?: any;
|
|
146
|
+
orgId?: string;
|
|
147
|
+
appId?: string;
|
|
148
|
+
app?: App;
|
|
149
|
+
appOrgs?: AppOrg[];
|
|
150
|
+
versionNumber: number;
|
|
151
|
+
status: AppVersionStatus;
|
|
152
|
+
eventWorkflowTriggerKeyMapping: string;
|
|
153
|
+
configProperties?: ConfigProperty[];
|
|
154
|
+
triggerKeyDefinitions?: TriggerKeyDefinition[];
|
|
155
|
+
dockerImageRef?: string;
|
|
156
|
+
}
|
|
157
|
+
export declare class AppApiKey {
|
|
158
|
+
id: string;
|
|
159
|
+
createdOn?: Date;
|
|
160
|
+
updatedOn?: Date;
|
|
161
|
+
createdById?: string;
|
|
162
|
+
updatedById?: string;
|
|
163
|
+
createdBy?: any;
|
|
164
|
+
updatedBy?: any;
|
|
165
|
+
orgId?: string;
|
|
166
|
+
appOrgId?: string;
|
|
167
|
+
appOrg?: AppOrg;
|
|
168
|
+
apiKey?: string;
|
|
169
|
+
}
|
|
106
170
|
export declare class ConfigProperty {
|
|
107
171
|
slug: string;
|
|
108
172
|
propertyType: string;
|