@contrail/cli 2.3.0 → 2.3.2

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 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.0 darwin-arm64 node-v18.13.0
20
+ @contrail/cli/2.3.2 darwin-arm64 node-v18.13.0
21
21
  $ contrail --help [COMMAND]
22
22
  USAGE
23
23
  $ contrail COMMAND
@@ -76,6 +76,7 @@ class CreateApp extends basecommand_1.BaseCommand {
76
76
  appName: answers.appName,
77
77
  appIdentifier: sanitizedIdentifier,
78
78
  appDescription: answers.appDescription,
79
+ appPublisher: answers.appPublisher,
79
80
  });
80
81
  }
81
82
  }
@@ -57,6 +57,7 @@ class CreateApp extends basecommand_1.BaseCommand {
57
57
  appName: answers.appName,
58
58
  appIdentifier: sanitizedIdentifier,
59
59
  appDescription: answers.appDescription,
60
+ appPublisher: answers.appPublisher,
60
61
  });
61
62
  }
62
63
  }
@@ -170,6 +170,7 @@ function parseLabelsInColumn(uploadedOptionData) {
170
170
  }
171
171
  const reducedOptionSet = {
172
172
  name: optionSetName,
173
+ slug: util_1.StringUtil.convertToCamelCase(optionSetName),
173
174
  isArchived: false,
174
175
  optionSet,
175
176
  };
@@ -220,6 +221,7 @@ function parseNameAndLabelAndKey(uploadedOptionData) {
220
221
  }
221
222
  const reducedOptionSet = {
222
223
  name: optionSetName,
224
+ slug: util_1.StringUtil.convertToCamelCase(optionSetName),
223
225
  isArchived: false,
224
226
  optionSet,
225
227
  };
@@ -2,6 +2,7 @@ interface AppSetUpInputs {
2
2
  appName: string;
3
3
  appIdentifier: string;
4
4
  appDescription: string;
5
+ appPublisher: string;
5
6
  }
6
7
  export declare function setUpTemplate(appInput: AppSetUpInputs): Promise<void>;
7
8
  export {};
@@ -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) {
@@ -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
- deployWorkflow(workflowKey: string, workflow: WorkflowDefinition, app: App, existingWorkflows: Array<any>): Promise<WorkflowDefinition>;
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,7 @@ class WorkflowTemplateDefinitionDeployer {
62
61
  name: definition.name,
63
62
  identifier: definition.identifier,
64
63
  builtIn: definition.builtIn,
64
+ messageGroupId: definition.messageGroupId,
65
65
  triggerKey: definition.triggerKey,
66
66
  workflowDefinition: definition.workflowDefinition,
67
67
  isActive: makeActive,
@@ -87,29 +87,19 @@ class WorkflowTemplateDefinitionDeployer {
87
87
  logger_1.default.info(chalk_1.default.green.bold(workflowTemplateDefinitions.map((x) => `(${x.appName}) ${x.workflowName} `).join('\n')));
88
88
  }
89
89
  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
90
  // UPSERT / DELETE BASED ON WORKFLOW IDENTIFIER
95
91
  logger_1.default.info('WORKFLOW DEFINITION \tDeploying workflow definitions.');
96
92
  if (appDeclaration.workflows) {
97
93
  const localWorkflows = Object.keys(appDeclaration.workflows);
98
94
  if (localWorkflows?.length > 0) {
99
95
  for (const workflowKey of localWorkflows) {
100
- await this.deployWorkflow(workflowKey, appDeclaration.workflows[workflowKey], app, existingWorkflows);
96
+ await this.deployWorkflowDefinition(workflowKey, appDeclaration.workflows[workflowKey], app);
101
97
  }
102
98
  }
103
99
  }
104
100
  }
105
- async deployWorkflow(workflowKey, workflow, app, existingWorkflows) {
101
+ async deployWorkflowDefinition(workflowKey, workflow, app) {
106
102
  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
103
  return await this.createNewWorkflowDefinition(workflowKey, workflow, app);
114
104
  }
115
105
  async createNewWorkflowDefinition(workflowKey, workflowDeclaration, app) {
@@ -153,24 +143,6 @@ class WorkflowTemplateDefinitionDeployer {
153
143
  }
154
144
  }
155
145
  }
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
146
  getActionDeclarationIdentifier(actionKey, app) {
175
147
  return `${app.identifier}@${app.latestAppVersionId}:${actionKey}`;
176
148
  }
@@ -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
  }
@@ -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: "Your company name" # Your company name, used for public apps
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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.3.0",
2
+ "version": "2.3.2",
3
3
  "commands": {
4
4
  "app:create": {
5
5
  "id": "app:create",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/cli",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",
@@ -1,3 +0,0 @@
1
- import { WorkflowDefinition, WorkflowTemplate } from './interfaces';
2
- export declare const DEFAULT_WORKFLOW_PARALLELISM = 1;
3
- export declare function convertWorkflow(workflow: WorkflowDefinition | WorkflowTemplate): void;
@@ -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
- });