@contrail/cli 1.0.8 → 1.0.9
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.
|
@@ -7,9 +7,11 @@ export class AppDeployer {
|
|
|
7
7
|
async deploy(appDeclaration) {
|
|
8
8
|
let app = await this.getExistingApp(appDeclaration);
|
|
9
9
|
if (!app) {
|
|
10
|
+
console.log(`%s Creating new app.`, chalk.yellow.bold('APP'));
|
|
10
11
|
app = await this.createNewApp(appDeclaration);
|
|
11
12
|
}
|
|
12
13
|
else {
|
|
14
|
+
console.log(`%s Updating existing app.`, chalk.yellow.bold('APP'));
|
|
13
15
|
app = await this.updateExistingApp(appDeclaration, app);
|
|
14
16
|
}
|
|
15
17
|
await new ActionsDeployer().deployActions(appDeclaration, app);
|
|
@@ -34,6 +36,14 @@ export class AppDeployer {
|
|
|
34
36
|
return apps.find(app => app.identifier === appDeclaration.appIdentifier);
|
|
35
37
|
}
|
|
36
38
|
async createNewApp(appDeclaration) {
|
|
39
|
+
let configProperties;
|
|
40
|
+
if (appDeclaration === null || appDeclaration === void 0 ? void 0 : appDeclaration.appConfiguration) {
|
|
41
|
+
configProperties = ConfigPropertiesParser.getConfigProperties(appDeclaration.appConfiguration);
|
|
42
|
+
}
|
|
43
|
+
let triggerKeyDefinitions;
|
|
44
|
+
if (appDeclaration === null || appDeclaration === void 0 ? void 0 : appDeclaration.triggers) {
|
|
45
|
+
triggerKeyDefinitions = TriggerKeyDefinitionParser.buildTriggersArray(appDeclaration);
|
|
46
|
+
}
|
|
37
47
|
const newApp = {
|
|
38
48
|
identifier: appDeclaration.appIdentifier,
|
|
39
49
|
name: appDeclaration.appName,
|
|
@@ -43,14 +53,22 @@ export class AppDeployer {
|
|
|
43
53
|
thumbnail: appDeclaration.thumbnail,
|
|
44
54
|
eventWorkflowTriggerKeyMapping: appDeclaration.eventWorkflowTriggerKeyMapping,
|
|
45
55
|
keywords: appDeclaration.keywords,
|
|
46
|
-
configProperties
|
|
47
|
-
triggerKeyDefinitions
|
|
56
|
+
configProperties,
|
|
57
|
+
triggerKeyDefinitions,
|
|
48
58
|
};
|
|
49
59
|
const app = await new Entities().create({ entityName: 'app', object: newApp });
|
|
50
60
|
console.log(`%s Created new app: ${app.name}`, chalk.yellow.bold('APP'));
|
|
51
61
|
return app;
|
|
52
62
|
}
|
|
53
63
|
async updateExistingApp(appDeclaration, existingApp) {
|
|
64
|
+
let configProperties;
|
|
65
|
+
if (appDeclaration === null || appDeclaration === void 0 ? void 0 : appDeclaration.appConfiguration) {
|
|
66
|
+
configProperties = ConfigPropertiesParser.getConfigProperties(appDeclaration.appConfiguration);
|
|
67
|
+
}
|
|
68
|
+
let triggerKeyDefinitions;
|
|
69
|
+
if (appDeclaration === null || appDeclaration === void 0 ? void 0 : appDeclaration.triggers) {
|
|
70
|
+
triggerKeyDefinitions = TriggerKeyDefinitionParser.buildTriggersArray(appDeclaration);
|
|
71
|
+
}
|
|
54
72
|
const updates = {
|
|
55
73
|
name: appDeclaration.appName,
|
|
56
74
|
public: appDeclaration.visibility === 'public',
|
|
@@ -59,8 +77,8 @@ export class AppDeployer {
|
|
|
59
77
|
thumbnail: appDeclaration.thumbnail,
|
|
60
78
|
eventWorkflowTriggerKeyMapping: appDeclaration.eventWorkflowTriggerKeyMapping,
|
|
61
79
|
keywords: appDeclaration.keywords,
|
|
62
|
-
configProperties
|
|
63
|
-
triggerKeyDefinitions
|
|
80
|
+
configProperties,
|
|
81
|
+
triggerKeyDefinitions,
|
|
64
82
|
};
|
|
65
83
|
const app = await new Entities().update({ entityName: 'app', id: existingApp.id, object: updates });
|
|
66
84
|
console.log(`%s Updated app: ${app.name}`, chalk.yellow.bold('APP'));
|
package/package.json
CHANGED
|
@@ -9,8 +9,10 @@ export class AppDeployer {
|
|
|
9
9
|
public async deploy(appDeclaration: AppDeclaration) {
|
|
10
10
|
let app = await this.getExistingApp(appDeclaration);
|
|
11
11
|
if (!app) {
|
|
12
|
+
console.log(`%s Creating new app.`, chalk.yellow.bold('APP'));
|
|
12
13
|
app = await this.createNewApp(appDeclaration);
|
|
13
14
|
} else {
|
|
15
|
+
console.log(`%s Updating existing app.`, chalk.yellow.bold('APP'));
|
|
14
16
|
app = await this.updateExistingApp(appDeclaration, app);
|
|
15
17
|
}
|
|
16
18
|
await new ActionsDeployer().deployActions(appDeclaration, app);
|
|
@@ -39,6 +41,17 @@ export class AppDeployer {
|
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
private async createNewApp(appDeclaration: AppDeclaration) {
|
|
44
|
+
|
|
45
|
+
let configProperties;
|
|
46
|
+
if (appDeclaration?.appConfiguration) {
|
|
47
|
+
configProperties = ConfigPropertiesParser.getConfigProperties(appDeclaration.appConfiguration);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let triggerKeyDefinitions;
|
|
51
|
+
if (appDeclaration?.triggers) {
|
|
52
|
+
triggerKeyDefinitions = TriggerKeyDefinitionParser.buildTriggersArray(appDeclaration);
|
|
53
|
+
}
|
|
54
|
+
|
|
42
55
|
const newApp = {
|
|
43
56
|
identifier: appDeclaration.appIdentifier,
|
|
44
57
|
name: appDeclaration.appName,
|
|
@@ -48,8 +61,8 @@ export class AppDeployer {
|
|
|
48
61
|
thumbnail: appDeclaration.thumbnail,
|
|
49
62
|
eventWorkflowTriggerKeyMapping: appDeclaration.eventWorkflowTriggerKeyMapping,
|
|
50
63
|
keywords: appDeclaration.keywords,
|
|
51
|
-
configProperties
|
|
52
|
-
triggerKeyDefinitions
|
|
64
|
+
configProperties,
|
|
65
|
+
triggerKeyDefinitions,
|
|
53
66
|
};
|
|
54
67
|
const app = await new Entities().create({ entityName: 'app', object: newApp });
|
|
55
68
|
console.log(`%s Created new app: ${app.name}`, chalk.yellow.bold('APP'));
|
|
@@ -57,6 +70,17 @@ export class AppDeployer {
|
|
|
57
70
|
}
|
|
58
71
|
|
|
59
72
|
public async updateExistingApp(appDeclaration: AppDeclaration, existingApp) {
|
|
73
|
+
|
|
74
|
+
let configProperties;
|
|
75
|
+
if (appDeclaration?.appConfiguration) {
|
|
76
|
+
configProperties = ConfigPropertiesParser.getConfigProperties(appDeclaration.appConfiguration);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let triggerKeyDefinitions;
|
|
80
|
+
if (appDeclaration?.triggers) {
|
|
81
|
+
triggerKeyDefinitions = TriggerKeyDefinitionParser.buildTriggersArray(appDeclaration);
|
|
82
|
+
}
|
|
83
|
+
|
|
60
84
|
const updates = {
|
|
61
85
|
name: appDeclaration.appName,
|
|
62
86
|
public: appDeclaration.visibility === 'public',
|
|
@@ -65,8 +89,8 @@ export class AppDeployer {
|
|
|
65
89
|
thumbnail: appDeclaration.thumbnail,
|
|
66
90
|
eventWorkflowTriggerKeyMapping: appDeclaration.eventWorkflowTriggerKeyMapping,
|
|
67
91
|
keywords: appDeclaration.keywords,
|
|
68
|
-
configProperties
|
|
69
|
-
triggerKeyDefinitions
|
|
92
|
+
configProperties,
|
|
93
|
+
triggerKeyDefinitions,
|
|
70
94
|
};
|
|
71
95
|
const app = await new Entities().update({ entityName: 'app', id: existingApp.id, object: updates });
|
|
72
96
|
console.log(`%s Updated app: ${app.name}`, chalk.yellow.bold('APP'));
|