@contrail/cli 2.1.14 → 2.1.15

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
@@ -15,7 +15,7 @@ $ npm install -g @contrail/cli
15
15
  $ contrail COMMAND
16
16
  running command...
17
17
  $ contrail (--version)
18
- @contrail/cli/2.1.14 darwin-arm64 node-v18.13.0
18
+ @contrail/cli/2.1.15 darwin-arm64 node-v18.13.0
19
19
  $ contrail --help [COMMAND]
20
20
  USAGE
21
21
  $ contrail COMMAND
@@ -1,5 +1,5 @@
1
1
  import { App, AppDeclaration, AppActionDeclaration } from '../../interfaces';
2
- export declare function getActionsForApp(app: App): Promise<any>;
2
+ export declare function getActionsForAppVersion(app: App): Promise<any>;
3
3
  export declare function getActionDeclarationIdentifier(actionKey: any, app: App): string;
4
4
  export declare function deleteAction(actionId: any): Promise<any>;
5
5
  export declare class ActionsDeployer {
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ActionsDeployer = exports.deleteAction = exports.getActionDeclarationIdentifier = exports.getActionsForApp = void 0;
3
+ exports.ActionsDeployer = exports.deleteAction = exports.getActionDeclarationIdentifier = exports.getActionsForAppVersion = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const sdk_1 = require("@contrail/sdk");
6
6
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
7
  const app_template_parsers_1 = require("./app-template-parsers");
8
8
  const common_1 = require("../../common");
9
9
  const fs_1 = tslib_1.__importDefault(require("fs"));
10
- async function getActionsForApp(app) {
10
+ async function getActionsForAppVersion(app) {
11
11
  return await new sdk_1.Entities().get({
12
12
  entityName: 'event-workflow-action-definition',
13
- criteria: { ownerKey: `app:${app.id}` },
13
+ criteria: { ownerKey: `appVersion:${app.latestAppVersionId}` },
14
14
  });
15
15
  }
16
- exports.getActionsForApp = getActionsForApp;
16
+ exports.getActionsForAppVersion = getActionsForAppVersion;
17
17
  function getActionDeclarationIdentifier(actionKey, app) {
18
18
  return app.identifier + ':' + actionKey;
19
19
  }
@@ -25,7 +25,7 @@ exports.deleteAction = deleteAction;
25
25
  class ActionsDeployer {
26
26
  async deployActions(appDeclaration, app) {
27
27
  // FETCH ALL ACTIONS FROM THE API.
28
- const existingActions = await getActionsForApp(app);
28
+ const existingActions = await getActionsForAppVersion(app);
29
29
  // UPSERT / DELETE BASED ON ACTION IDENTIFIER
30
30
  console.log('%s \tDeploying actions.', chalk_1.default.yellow.bold('ACTION'));
31
31
  let appActionIdentifiers = [];
@@ -63,7 +63,8 @@ class ActionsDeployer {
63
63
  const newObject = {
64
64
  identifier: getActionDeclarationIdentifier(actionKey, app),
65
65
  name: actionDeclaration.name,
66
- ownerKey: `app:${app.id}`,
66
+ internal: actionDeclaration.internal,
67
+ ownerKey: `appVersion:${app.latestAppVersionId}`,
67
68
  public: 'public' in actionDeclaration ? actionDeclaration.public : app.public,
68
69
  configProperties,
69
70
  async: actionDeclaration.async,
@@ -89,6 +90,8 @@ class ActionsDeployer {
89
90
  }
90
91
  const updates = {
91
92
  name: actionDeclaration.name,
93
+ internal: actionDeclaration.internal,
94
+ ownerKey: `appVersion:${app.latestAppVersionId}`,
92
95
  public: 'public' in actionDeclaration ? actionDeclaration.public : app.public,
93
96
  configProperties,
94
97
  async: actionDeclaration.async,
@@ -73,13 +73,13 @@ class AppDeployer {
73
73
  console.log('Dry run, not creating app');
74
74
  return {};
75
75
  }
76
- const app = await new sdk_1.Entities().create({ entityName: 'app', object: newApp });
76
+ let app = await new sdk_1.Entities().create({ entityName: 'app', object: newApp });
77
77
  console.log(`%s Created new app: ${app.name}`, chalk_1.default.yellow.bold('APP'));
78
78
  const isDocker = Object.hasOwnProperty.call(appDeclaration, 'dockerImageRef');
79
79
  if (!isDocker) { // this is the expected default behavior
80
80
  const appCodePackage = await createNodePackage(appDeclaration.appIdentifier, this.debug, this.dryRun);
81
81
  app.appCodePackageId = appCodePackage.id;
82
- await new sdk_1.Entities().update({ entityName: 'app', object: app });
82
+ app = await new sdk_1.Entities().update({ entityName: 'app', id: app.id, object: app });
83
83
  console.log(`%s Updated app with code package: ${app.name}`, chalk_1.default.yellow.bold('APP'));
84
84
  }
85
85
  return app;
@@ -129,7 +129,7 @@ class AppDeployer {
129
129
  async remove(appDeclaration) {
130
130
  let app = await this.getExistingApp(appDeclaration);
131
131
  if (app) {
132
- const actions = await (0, actions_deployer_1.getActionsForApp)(app);
132
+ const actions = await (0, actions_deployer_1.getActionsForAppVersion)(app);
133
133
  for (const action of actions) {
134
134
  console.log(`%s Deleting action: ${action.identifier}`, chalk_1.default.yellow.bold('APP'));
135
135
  await (0, actions_deployer_1.deleteAction)(action.id);
@@ -34,7 +34,7 @@ class WorkflowTemplateDefinitionDeployer {
34
34
  type: 'checkbox',
35
35
  name: 'workflowTemplateDefinitionsToInstall',
36
36
  message: 'Which workflow templates would you like to install?',
37
- choices: workflowTemplateDefinitions.map(x => { return { value: x.identifier, name: x.name }; }),
37
+ choices: workflowTemplateDefinitions.filter(x => !x.builtIn).map(x => { return { value: x.identifier, name: x.name }; }),
38
38
  }]);
39
39
  const workflowTemplateDefinitionsToInstall = workflowTemplateDefinitions.filter(x => answers.workflowTemplateDefinitionsToInstall.includes(x.identifier));
40
40
  answers = await inquirer_1.default.prompt([{
@@ -47,6 +47,7 @@ class WorkflowTemplateDefinitionDeployer {
47
47
  for (const definition of workflowTemplateDefinitionsToInstall) {
48
48
  const newObject = {
49
49
  name: definition.name,
50
+ builtIn: definition.builtIn,
50
51
  triggerKey: definition.triggerKey,
51
52
  workflowDefinition: definition.workflowDefinition,
52
53
  isActive: makeActive,
@@ -106,7 +107,8 @@ class WorkflowTemplateDefinitionDeployer {
106
107
  const newObject = {
107
108
  identifier: this.getWorkflowDeclarationIdentifier(workflowKey, app),
108
109
  name: workflowDeclaration.name,
109
- ownerKey: `app:${app.id}`,
110
+ ownerKey: `appVersion:${app.latestAppVersionId}`,
111
+ builtIn: workflowDeclaration.builtIn,
110
112
  triggerKey: workflowDeclaration.triggerKey,
111
113
  workflowDefinition: workflowDeclaration.workflowDefinition,
112
114
  public: workflowDeclaration.public,
@@ -120,7 +122,7 @@ class WorkflowTemplateDefinitionDeployer {
120
122
  }
121
123
  async populateActionIds(workflowDefinition, app) {
122
124
  var _a;
123
- const availableAppActions = await (0, actions_deployer_1.getActionsForApp)(app);
125
+ const availableAppActions = await (0, actions_deployer_1.getActionsForAppVersion)(app);
124
126
  if (!((_a = workflowDefinition.workflowDefinition) === null || _a === void 0 ? void 0 : _a.paths)) {
125
127
  return;
126
128
  }
@@ -142,6 +144,8 @@ class WorkflowTemplateDefinitionDeployer {
142
144
  await this.populateActionIds(workflowDefinition, app);
143
145
  const updates = Object.assign(new Object(), {
144
146
  name: workflowDefinition.name,
147
+ builtIn: workflowDefinition.builtIn,
148
+ ownerKey: `appVersion:${app.latestAppVersionId}`,
145
149
  triggerKey: workflowDefinition.triggerKey,
146
150
  workflowDefinition: workflowDefinition.workflowDefinition,
147
151
  messageGroupId: workflowDefinition.messageGroupId,
@@ -78,6 +78,7 @@ class LocalWorkflowTemplateDeployer {
78
78
  const updates = Object.assign(new Object(), {
79
79
  name: workflowTemplate.name,
80
80
  triggerKey: workflowTemplate.triggerKey,
81
+ builtIn: workflowTemplate.builtIn,
81
82
  workflowDefinition: workflowTemplate.workflowDefinition,
82
83
  messageGroupId: (_a = workflowTemplate.messageGroupId) !== null && _a !== void 0 ? _a : existingWorkflowTemplate.messageGroupId,
83
84
  parallelWorkerCount: (_b = workflowTemplate.parallelWorkerCount) !== null && _b !== void 0 ? _b : existingWorkflowTemplate.parallelWorkerCount,
@@ -39,6 +39,7 @@ export interface AppActionDeclaration {
39
39
  handler: string;
40
40
  public?: boolean;
41
41
  name: string;
42
+ internal?: boolean;
42
43
  description?: string;
43
44
  actionConfiguration?: ConfigPropertyElements;
44
45
  async?: boolean;
@@ -58,6 +59,7 @@ export interface WorkflowDefinition {
58
59
  ownerKey: string;
59
60
  isActive: boolean;
60
61
  public: boolean;
62
+ builtIn?: boolean;
61
63
  supportingAppId?: string;
62
64
  parallelism?: number;
63
65
  groupId?: string;
@@ -71,6 +73,7 @@ export interface WorkflowTemplate {
71
73
  id?: string;
72
74
  identifier?: string;
73
75
  name: string;
76
+ builtIn?: boolean;
74
77
  triggerKey: string;
75
78
  workflowDefinition: WorkflowDefinitionPaths;
76
79
  isActive: boolean;
@@ -201,6 +204,7 @@ export interface EventWorkflowActionDefinition {
201
204
  id?: string;
202
205
  identifier?: string;
203
206
  name?: string;
207
+ internal?: boolean;
204
208
  executeFunctionString?: string;
205
209
  ownerKey?: string;
206
210
  public?: boolean;
@@ -26,8 +26,28 @@ actions:
26
26
  message:
27
27
  label: "Additional message to log."
28
28
  propertyType: "string"
29
+ sayHello:
30
+ internal: true
31
+ name: "Say Hello"
32
+ description: "Prints hello world to the log."
33
+ async: false
29
34
 
30
35
  workflows:
36
+ friendlyGreeting:
37
+ builtIn: true
38
+ name: "Friendly Greeting"
39
+ triggerKey: "helloFoo"
40
+ isActive: true
41
+ public: true
42
+ concurrency: 3 # The maximum number of concurrent jobs to run for this workflow. Defaults to 5
43
+ workflowDefinition:
44
+ paths:
45
+ - conditional: "true"
46
+ actionDefinitionConfigs:
47
+ - action: sayHello
48
+ name: Say Hello
49
+
50
+
31
51
  logItemUpdate:
32
52
  name: "Item Update -> Log"
33
53
  triggerKey: item|update
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.1.14",
2
+ "version": "2.1.15",
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.1.14",
3
+ "version": "2.1.15",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",