@contrail/cli 2.3.1 → 2.3.3
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/README.md +1 -1
- package/dist/commands/app/create.js +1 -0
- package/dist/commands/app/init.js +1 -0
- package/dist/helpers/app/setup-template.d.ts +1 -0
- package/dist/helpers/app/setup-template.js +2 -1
- package/dist/helpers/workflow-template-definitions/workflow-template-definition-deployer.d.ts +1 -2
- package/dist/helpers/workflow-template-definitions/workflow-template-definition-deployer.js +4 -31
- package/dist/helpers/workflow-templates/helper.js +0 -2
- package/dist/interfaces.d.ts +2 -6
- package/dist/templates/typescript/app.yml +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/dist/interface-converters.d.ts +0 -3
- package/dist/interface-converters.js +0 -10
- package/dist/interface-converters.spec.d.ts +0 -1
- package/dist/interface-converters.spec.js +0 -89
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ $ npm install -g @contrail/cli
|
|
|
17
17
|
$ contrail COMMAND
|
|
18
18
|
running command...
|
|
19
19
|
$ contrail (--version)
|
|
20
|
-
@contrail/cli/2.3.
|
|
20
|
+
@contrail/cli/2.3.3 darwin-arm64 node-v18.13.0
|
|
21
21
|
$ contrail --help [COMMAND]
|
|
22
22
|
USAGE
|
|
23
23
|
$ contrail COMMAND
|
|
@@ -37,7 +37,8 @@ async function setUpTemplate(appInput) {
|
|
|
37
37
|
const newAppYml = appYml
|
|
38
38
|
.replace(/APP_IDENTIFIER_STUB/g, appInput.appIdentifier)
|
|
39
39
|
.replace(/APP_NAME_STUB/g, appInput.appName)
|
|
40
|
-
.replace(/APP_DESCRIPTION_STUB/g, appInput.appDescription)
|
|
40
|
+
.replace(/APP_DESCRIPTION_STUB/g, appInput.appDescription)
|
|
41
|
+
.replace(/APP_PUBLISHER_STUB/g, appInput.appPublisher);
|
|
41
42
|
fs_1.default.writeFileSync(appYmlFileLoc, newAppYml);
|
|
42
43
|
}
|
|
43
44
|
catch (e) {
|
package/dist/helpers/workflow-template-definitions/workflow-template-definition-deployer.d.ts
CHANGED
|
@@ -4,10 +4,9 @@ export declare class WorkflowTemplateDefinitionDeployer {
|
|
|
4
4
|
installWorkflowTemplateDefinitions(workflowTemplateDefinitions: WorkflowTemplate[]): Promise<void>;
|
|
5
5
|
listWorkflowTemplateDefinitions(): Promise<void>;
|
|
6
6
|
deployWorkflowTemplateDefinitions(appDeclaration: AppDeclaration, app: App): Promise<void>;
|
|
7
|
-
|
|
7
|
+
deployWorkflowDefinition(workflowKey: string, workflow: WorkflowDefinition, app: App): Promise<WorkflowDefinition>;
|
|
8
8
|
private createNewWorkflowDefinition;
|
|
9
9
|
private populateActionIds;
|
|
10
|
-
private updateWorkflowTemplateDefinition;
|
|
11
10
|
getActionDeclarationIdentifier(actionKey: any, app: App): string;
|
|
12
11
|
getWorkflowDeclarationIdentifier(workflowKey: any, app: App): string;
|
|
13
12
|
}
|
|
@@ -8,7 +8,6 @@ const apps_1 = require("../../api/apps");
|
|
|
8
8
|
const event_workflow_templates_1 = require("../../api/event-workflow-templates");
|
|
9
9
|
const event_workflow_template_definition_1 = require("../../api/event-workflow-template-definition");
|
|
10
10
|
const actions_deployer_1 = require("../app/actions-deployer");
|
|
11
|
-
const interface_converters_1 = require("../../interface-converters");
|
|
12
11
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
13
12
|
class WorkflowTemplateDefinitionDeployer {
|
|
14
13
|
async cliInstallWorkflowTemplateDefinitions() {
|
|
@@ -62,6 +61,8 @@ class WorkflowTemplateDefinitionDeployer {
|
|
|
62
61
|
name: definition.name,
|
|
63
62
|
identifier: definition.identifier,
|
|
64
63
|
builtIn: definition.builtIn,
|
|
64
|
+
messageGroupId: definition.messageGroupId,
|
|
65
|
+
parallelWorkerCount: definition.parallelWorkerCount,
|
|
65
66
|
triggerKey: definition.triggerKey,
|
|
66
67
|
workflowDefinition: definition.workflowDefinition,
|
|
67
68
|
isActive: makeActive,
|
|
@@ -87,29 +88,19 @@ class WorkflowTemplateDefinitionDeployer {
|
|
|
87
88
|
logger_1.default.info(chalk_1.default.green.bold(workflowTemplateDefinitions.map((x) => `(${x.appName}) ${x.workflowName} `).join('\n')));
|
|
88
89
|
}
|
|
89
90
|
async deployWorkflowTemplateDefinitions(appDeclaration, app) {
|
|
90
|
-
// FETCH ALL WORKFLOWS FROM THE API.
|
|
91
|
-
const existingWorkflows = await (0, apps_1.getWorkflowTemplateDefinitionsForAppVersion)({
|
|
92
|
-
appVersionId: app.latestAppVersionId,
|
|
93
|
-
});
|
|
94
91
|
// UPSERT / DELETE BASED ON WORKFLOW IDENTIFIER
|
|
95
92
|
logger_1.default.info('WORKFLOW DEFINITION \tDeploying workflow definitions.');
|
|
96
93
|
if (appDeclaration.workflows) {
|
|
97
94
|
const localWorkflows = Object.keys(appDeclaration.workflows);
|
|
98
95
|
if (localWorkflows?.length > 0) {
|
|
99
96
|
for (const workflowKey of localWorkflows) {
|
|
100
|
-
await this.
|
|
97
|
+
await this.deployWorkflowDefinition(workflowKey, appDeclaration.workflows[workflowKey], app);
|
|
101
98
|
}
|
|
102
99
|
}
|
|
103
100
|
}
|
|
104
101
|
}
|
|
105
|
-
async
|
|
102
|
+
async deployWorkflowDefinition(workflowKey, workflow, app) {
|
|
106
103
|
logger_1.default.info(`WORKFLOW DEFINITION \tDeploying workflow definitions: ${workflowKey}`);
|
|
107
|
-
const identifier = this.getWorkflowDeclarationIdentifier(workflowKey, app);
|
|
108
|
-
const existingDefinition = existingWorkflows.find((ad) => ad.identifier === identifier);
|
|
109
|
-
(0, interface_converters_1.convertWorkflow)(workflow);
|
|
110
|
-
if (existingDefinition) {
|
|
111
|
-
return await this.updateWorkflowTemplateDefinition(existingDefinition, workflow, app);
|
|
112
|
-
}
|
|
113
104
|
return await this.createNewWorkflowDefinition(workflowKey, workflow, app);
|
|
114
105
|
}
|
|
115
106
|
async createNewWorkflowDefinition(workflowKey, workflowDeclaration, app) {
|
|
@@ -153,24 +144,6 @@ class WorkflowTemplateDefinitionDeployer {
|
|
|
153
144
|
}
|
|
154
145
|
}
|
|
155
146
|
}
|
|
156
|
-
async updateWorkflowTemplateDefinition(existingWorkflowDefinition, workflowDefinition, app) {
|
|
157
|
-
await this.populateActionIds(workflowDefinition, app);
|
|
158
|
-
const updates = Object.assign(new Object(), {
|
|
159
|
-
name: workflowDefinition.name,
|
|
160
|
-
builtIn: workflowDefinition.builtIn,
|
|
161
|
-
ownerKey: `appVersion:${app.latestAppVersionId}`,
|
|
162
|
-
triggerKey: workflowDefinition.triggerKey,
|
|
163
|
-
workflowDefinition: workflowDefinition.workflowDefinition,
|
|
164
|
-
messageGroupId: workflowDefinition.messageGroupId,
|
|
165
|
-
parallelWorkerCount: workflowDefinition.parallelWorkerCount,
|
|
166
|
-
});
|
|
167
|
-
const updatedWorkflowDefinition = await (0, event_workflow_template_definition_1.updateWorkflowTemplateDefinition)({
|
|
168
|
-
id: existingWorkflowDefinition.id,
|
|
169
|
-
updates,
|
|
170
|
-
});
|
|
171
|
-
logger_1.default.info(`WORKFLOW DEFINITION \t Updated existing workflow definition: ${updatedWorkflowDefinition.identifier}`);
|
|
172
|
-
return updatedWorkflowDefinition;
|
|
173
|
-
}
|
|
174
147
|
getActionDeclarationIdentifier(actionKey, app) {
|
|
175
148
|
return `${app.identifier}@${app.latestAppVersionId}:${actionKey}`;
|
|
176
149
|
}
|
|
@@ -13,7 +13,6 @@ const event_workflow_action_definition_1 = require("../../api/event-workflow-act
|
|
|
13
13
|
const event_workflow_templates_1 = require("../../api/event-workflow-templates");
|
|
14
14
|
const schedules_1 = require("../../api/schedules");
|
|
15
15
|
const login_1 = require("../../auth/login");
|
|
16
|
-
const interface_converters_1 = require("../../interface-converters");
|
|
17
16
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
18
17
|
class LocalWorkflowTemplateDeployer {
|
|
19
18
|
async deployWorkflows(wtDeclaration) {
|
|
@@ -30,7 +29,6 @@ class LocalWorkflowTemplateDeployer {
|
|
|
30
29
|
logger_1.default.info(`WORKFLOW TEMPLATES \tDeploying workflow: ${workflow.triggerKey}`);
|
|
31
30
|
const identifier = getWorkflowTemplateIdentifier(workflow);
|
|
32
31
|
const existingTemplate = existingWorkflows.find((ad) => ad.identifier === identifier);
|
|
33
|
-
(0, interface_converters_1.convertWorkflow)(workflow);
|
|
34
32
|
if (existingTemplate) {
|
|
35
33
|
return await this.updateWorkflowTemplate(identifier, existingTemplate, workflow, appIdentifier);
|
|
36
34
|
}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -71,10 +71,8 @@ export interface WorkflowDefinition {
|
|
|
71
71
|
public: boolean;
|
|
72
72
|
builtIn?: boolean;
|
|
73
73
|
supportingAppId?: string;
|
|
74
|
-
parallelism?: number;
|
|
75
|
-
groupId?: string;
|
|
76
|
-
messageGroupId?: string;
|
|
77
74
|
parallelWorkerCount?: number;
|
|
75
|
+
messageGroupId?: string;
|
|
78
76
|
}
|
|
79
77
|
export interface WorkflowTemplateDeclaration {
|
|
80
78
|
appIdentifier: string;
|
|
@@ -91,10 +89,8 @@ export interface WorkflowTemplate {
|
|
|
91
89
|
ownerKey?: string;
|
|
92
90
|
crons?: CronDeclaration[];
|
|
93
91
|
supportingAppId?: string;
|
|
94
|
-
parallelism?: number;
|
|
95
|
-
groupId?: string;
|
|
96
|
-
messageGroupId?: string;
|
|
97
92
|
parallelWorkerCount?: number;
|
|
93
|
+
messageGroupId?: string;
|
|
98
94
|
createdOn?: Date;
|
|
99
95
|
updatedOn?: Date;
|
|
100
96
|
createdById?: string;
|
|
@@ -3,7 +3,7 @@ appName: "APP_NAME_STUB" # Give your app a name
|
|
|
3
3
|
appDescription: "APP_DESCRIPTION_STUB" # Give your app a description
|
|
4
4
|
visibility: private # This should be private unless you want to develop an app for all VibeIQ customers to use
|
|
5
5
|
hidden: false # can be used with a public app to prevent it from showing on the marketplace, but still installable by other orgs
|
|
6
|
-
publisher: "
|
|
6
|
+
publisher: "APP_PUBLISHER_STUB" # Your company name, used for public apps
|
|
7
7
|
version: "1.0.0"
|
|
8
8
|
|
|
9
9
|
# Properties you can configure when you install the app.
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertWorkflow = exports.DEFAULT_WORKFLOW_PARALLELISM = void 0;
|
|
4
|
-
exports.DEFAULT_WORKFLOW_PARALLELISM = 1;
|
|
5
|
-
// parses the user-facing interface of the workflow and converts it to the cloud-facing format in-place.
|
|
6
|
-
function convertWorkflow(workflow) {
|
|
7
|
-
workflow.parallelWorkerCount = workflow.parallelism ?? exports.DEFAULT_WORKFLOW_PARALLELISM;
|
|
8
|
-
workflow.messageGroupId = workflow.groupId;
|
|
9
|
-
}
|
|
10
|
-
exports.convertWorkflow = convertWorkflow;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const interface_converters_1 = require("./interface-converters");
|
|
4
|
-
describe('Workflow Template converter tests', () => {
|
|
5
|
-
it('should use default parallelism', () => {
|
|
6
|
-
const workflow = {
|
|
7
|
-
identifier: 'identifier',
|
|
8
|
-
name: 'name1',
|
|
9
|
-
triggerKey: 'foo|bar',
|
|
10
|
-
workflowDefinition: {
|
|
11
|
-
paths: [
|
|
12
|
-
{
|
|
13
|
-
conditional: 'true',
|
|
14
|
-
actionDefinitionConfigs: [
|
|
15
|
-
{
|
|
16
|
-
action: 'logItem',
|
|
17
|
-
name: 'Log Item',
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
ownerKey: 'app:123',
|
|
24
|
-
isActive: true,
|
|
25
|
-
public: true,
|
|
26
|
-
// parallelism: 3,
|
|
27
|
-
};
|
|
28
|
-
(0, interface_converters_1.convertWorkflow)(workflow);
|
|
29
|
-
expect(workflow.parallelWorkerCount).toEqual(interface_converters_1.DEFAULT_WORKFLOW_PARALLELISM);
|
|
30
|
-
expect(workflow['concurrency']).toBeUndefined();
|
|
31
|
-
expect(workflow.messageGroupId).toBeUndefined();
|
|
32
|
-
});
|
|
33
|
-
it('should pass user concurrency as parallel count', () => {
|
|
34
|
-
const workflow = {
|
|
35
|
-
identifier: 'identifier',
|
|
36
|
-
name: 'name1',
|
|
37
|
-
triggerKey: 'foo|bar',
|
|
38
|
-
workflowDefinition: {
|
|
39
|
-
paths: [
|
|
40
|
-
{
|
|
41
|
-
conditional: 'true',
|
|
42
|
-
actionDefinitionConfigs: [
|
|
43
|
-
{
|
|
44
|
-
action: 'logItem',
|
|
45
|
-
name: 'Log Item',
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
},
|
|
51
|
-
ownerKey: 'app:123',
|
|
52
|
-
isActive: true,
|
|
53
|
-
public: true,
|
|
54
|
-
parallelism: 3,
|
|
55
|
-
};
|
|
56
|
-
(0, interface_converters_1.convertWorkflow)(workflow);
|
|
57
|
-
expect(workflow.parallelWorkerCount).toEqual(3);
|
|
58
|
-
expect(workflow['concurrency']).toBeUndefined();
|
|
59
|
-
expect(workflow.messageGroupId).toBeUndefined();
|
|
60
|
-
});
|
|
61
|
-
it('should ignore concurrency if we pass group ID or ', () => {
|
|
62
|
-
const workflow = {
|
|
63
|
-
identifier: 'identifier',
|
|
64
|
-
name: 'name1',
|
|
65
|
-
triggerKey: 'foo|bar',
|
|
66
|
-
workflowDefinition: {
|
|
67
|
-
paths: [
|
|
68
|
-
{
|
|
69
|
-
conditional: 'true',
|
|
70
|
-
actionDefinitionConfigs: [
|
|
71
|
-
{
|
|
72
|
-
action: 'logItem',
|
|
73
|
-
name: 'Log Item',
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
},
|
|
79
|
-
ownerKey: 'app:123',
|
|
80
|
-
isActive: true,
|
|
81
|
-
public: true,
|
|
82
|
-
parallelism: 3,
|
|
83
|
-
};
|
|
84
|
-
(0, interface_converters_1.convertWorkflow)(workflow);
|
|
85
|
-
expect(workflow.parallelWorkerCount).toEqual(3);
|
|
86
|
-
expect(workflow['concurrency']).toBeUndefined();
|
|
87
|
-
expect(workflow.messageGroupId).toBeUndefined();
|
|
88
|
-
});
|
|
89
|
-
});
|