@contrail/cli 2.3.4 → 2.4.0-alpha

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.
Files changed (31) hide show
  1. package/README.md +2 -3
  2. package/dist/api/apps.d.ts +1 -1
  3. package/dist/api/apps.js +3 -20
  4. package/dist/auth/login.d.ts +0 -1
  5. package/dist/auth/login.js +2 -12
  6. package/dist/commands/app/create.js +1 -2
  7. package/dist/commands/app/init.js +2 -1
  8. package/dist/commands/app/install.d.ts +0 -1
  9. package/dist/commands/app/install.js +1 -6
  10. package/dist/commands/types/mergeOptionSets.js +3 -1
  11. package/dist/commands/types/parseOptionSetsLocalFiles.d.ts +9 -7
  12. package/dist/commands/types/parseOptionSetsLocalFiles.js +33 -14
  13. package/dist/commands/types/uploadOptionSets.d.ts +1 -0
  14. package/dist/commands/types/uploadOptionSets.js +33 -20
  15. package/dist/helpers/app/app-config-validators.d.ts +16 -1
  16. package/dist/helpers/app/app-config-validators.js +73 -24
  17. package/dist/helpers/app/app-config-validators.spec.js +225 -20
  18. package/dist/helpers/app/app-deployer.js +12 -7
  19. package/dist/helpers/app/app-template-parsers.d.ts +4 -1
  20. package/dist/helpers/app/app-template-parsers.js +28 -1
  21. package/dist/helpers/types/parseOptionSetsLocalFiles.spec.d.ts +1 -0
  22. package/dist/helpers/types/parseOptionSetsLocalFiles.spec.js +285 -0
  23. package/dist/helpers/types/uploadOptionSets.spec.d.ts +1 -0
  24. package/dist/helpers/types/uploadOptionSets.spec.js +19 -0
  25. package/dist/helpers/workflow-template-definitions/workflow-template-definition-deployer.js +4 -0
  26. package/dist/helpers/workflow-templates/helper.js +4 -0
  27. package/dist/interfaces.d.ts +22 -1
  28. package/dist/interfaces.js +10 -1
  29. package/dist/templates/typescript/app.yml +10 -2
  30. package/oclif.manifest.json +1 -9
  31. package/package.json +3 -3
@@ -0,0 +1,285 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const parseOptionSetsLocalFiles_1 = require("../../commands/types/parseOptionSetsLocalFiles");
4
+ describe('parseNameAndLabelAndKey', () => {
5
+ it('should parse Name, Value, and Display, Disabled columns correctly if they are all present', () => {
6
+ const input = [
7
+ {
8
+ Name: 'Category',
9
+ Value: 'bottoms',
10
+ Display: 'Bottoms',
11
+ Disabled: 'false',
12
+ },
13
+ {
14
+ Name: 'Category',
15
+ Value: 'dresses',
16
+ Display: 'Dresses',
17
+ Disabled: 'true',
18
+ },
19
+ {
20
+ Name: 'Category',
21
+ Value: 'jacket',
22
+ Display: 'Jacket',
23
+ Disabled: 'true',
24
+ },
25
+ { Name: 'Fit', Value: 'active', Display: 'Active', Disabled: 'TRUE' },
26
+ ];
27
+ const expectedOutput = [
28
+ {
29
+ name: 'Category',
30
+ slug: 'category',
31
+ isArchived: false,
32
+ optionSet: [
33
+ {
34
+ value: 'bottoms',
35
+ display: 'Bottoms',
36
+ disabled: false,
37
+ },
38
+ {
39
+ value: 'dresses',
40
+ display: 'Dresses',
41
+ disabled: true,
42
+ },
43
+ {
44
+ value: 'jacket',
45
+ display: 'Jacket',
46
+ disabled: true,
47
+ },
48
+ ],
49
+ },
50
+ {
51
+ name: 'Fit',
52
+ slug: 'fit',
53
+ isArchived: false,
54
+ optionSet: [
55
+ {
56
+ value: 'active',
57
+ display: 'Active',
58
+ disabled: true,
59
+ },
60
+ ],
61
+ },
62
+ ];
63
+ const result = (0, parseOptionSetsLocalFiles_1.parseNameAndLabelAndKey)(input);
64
+ expect(result).toEqual(expectedOutput);
65
+ });
66
+ it('should skip invalid rows or rows with incorrect number of columns', () => {
67
+ const input = [
68
+ {
69
+ Name: 'Category',
70
+ Value: 'dresses',
71
+ Display: 'Dresses',
72
+ },
73
+ {
74
+ Name: 'Category',
75
+ Value: 'bottoms',
76
+ Display: 'Bottoms',
77
+ Disabled: '', // this is invalid row which should be skipped
78
+ },
79
+ {
80
+ Name: 'Category',
81
+ Value: 'jacket',
82
+ },
83
+ { Name: 'Fit', Value: 'active', Display: 'Active', Disabled: 'true' },
84
+ ];
85
+ const expectedOutput = [
86
+ {
87
+ name: 'Category',
88
+ slug: 'category',
89
+ isArchived: false,
90
+ optionSet: [
91
+ {
92
+ value: 'dresses',
93
+ display: 'Dresses',
94
+ disabled: false,
95
+ },
96
+ ],
97
+ },
98
+ {
99
+ name: 'Fit',
100
+ slug: 'fit',
101
+ isArchived: false,
102
+ optionSet: [
103
+ {
104
+ value: 'active',
105
+ display: 'Active',
106
+ disabled: true,
107
+ },
108
+ ],
109
+ },
110
+ ];
111
+ const result = (0, parseOptionSetsLocalFiles_1.parseNameAndLabelAndKey)(input);
112
+ expect(result).toEqual(expectedOutput);
113
+ });
114
+ it('should set disabled value to default value of false for invalid row values', () => {
115
+ const input = [
116
+ {
117
+ Name: 'Category',
118
+ Value: 'bottoms',
119
+ Display: 'Bottoms',
120
+ Disabled: 'false',
121
+ },
122
+ {
123
+ Name: 'Category',
124
+ Value: 'dresses',
125
+ Display: 'Dresses',
126
+ Disabled: 'test',
127
+ },
128
+ {
129
+ Name: 'Category',
130
+ Value: 'jacket',
131
+ Display: 'Jacket',
132
+ Disabled: 'abc',
133
+ },
134
+ { Name: 'Fit', Value: 'active', Display: 'Active', Disabled: 'true' },
135
+ ];
136
+ const expectedOutput = [
137
+ {
138
+ name: 'Category',
139
+ slug: 'category',
140
+ isArchived: false,
141
+ optionSet: [
142
+ {
143
+ value: 'bottoms',
144
+ display: 'Bottoms',
145
+ disabled: false,
146
+ },
147
+ {
148
+ value: 'dresses',
149
+ display: 'Dresses',
150
+ disabled: false,
151
+ },
152
+ {
153
+ value: 'jacket',
154
+ display: 'Jacket',
155
+ disabled: false,
156
+ },
157
+ ],
158
+ },
159
+ {
160
+ name: 'Fit',
161
+ slug: 'fit',
162
+ isArchived: false,
163
+ optionSet: [
164
+ {
165
+ value: 'active',
166
+ display: 'Active',
167
+ disabled: true,
168
+ },
169
+ ],
170
+ },
171
+ ];
172
+ const result = (0, parseOptionSetsLocalFiles_1.parseNameAndLabelAndKey)(input);
173
+ expect(result).toEqual(expectedOutput);
174
+ });
175
+ it('should handle missing disabled field correctly', () => {
176
+ const input = [
177
+ {
178
+ Name: 'Category',
179
+ Value: 'dresses',
180
+ Display: 'Dresses',
181
+ },
182
+ { Name: 'Fit', Value: 'active', Display: 'Active' },
183
+ ];
184
+ const expectedOutput = [
185
+ {
186
+ name: 'Category',
187
+ slug: 'category',
188
+ isArchived: false,
189
+ optionSet: [
190
+ {
191
+ value: 'dresses',
192
+ display: 'Dresses',
193
+ disabled: false,
194
+ },
195
+ ],
196
+ },
197
+ {
198
+ name: 'Fit',
199
+ slug: 'fit',
200
+ isArchived: false,
201
+ optionSet: [
202
+ {
203
+ value: 'active',
204
+ display: 'Active',
205
+ disabled: false,
206
+ },
207
+ ],
208
+ },
209
+ ];
210
+ const result = (0, parseOptionSetsLocalFiles_1.parseNameAndLabelAndKey)(input);
211
+ expect(result).toEqual(expectedOutput);
212
+ });
213
+ it('should convert number value to string', () => {
214
+ const input = [
215
+ {
216
+ Name: 'Category',
217
+ Value: 123,
218
+ Display: 'Category',
219
+ Disabled: 'false',
220
+ },
221
+ ];
222
+ const expectedOutput = [
223
+ {
224
+ name: 'Category',
225
+ slug: 'category',
226
+ isArchived: false,
227
+ optionSet: [
228
+ {
229
+ value: '123',
230
+ display: 'Category',
231
+ disabled: false,
232
+ },
233
+ ],
234
+ },
235
+ ];
236
+ const result = (0, parseOptionSetsLocalFiles_1.parseNameAndLabelAndKey)(input);
237
+ expect(result).toEqual(expectedOutput);
238
+ });
239
+ describe('parseDisabledValue', () => {
240
+ it('should return true for valid "true" string', () => {
241
+ const input = 'true';
242
+ const result = (0, parseOptionSetsLocalFiles_1.parseDisabledValue)(input);
243
+ expect(result).toBe(true);
244
+ });
245
+ it('should return true for valid case insensitive "true" string', () => {
246
+ const input = 'TRUE';
247
+ const result = (0, parseOptionSetsLocalFiles_1.parseDisabledValue)(input);
248
+ expect(result).toBe(true);
249
+ });
250
+ it('should return false for valid "false" string', () => {
251
+ const input = 'false';
252
+ const result = (0, parseOptionSetsLocalFiles_1.parseDisabledValue)(input);
253
+ expect(result).toBe(false);
254
+ });
255
+ it('should return true for valid case insensitive "false" string', () => {
256
+ const input = 'FALSE';
257
+ const result = (0, parseOptionSetsLocalFiles_1.parseDisabledValue)(input);
258
+ expect(result).toBe(false);
259
+ });
260
+ it('should return false for invalid string', () => {
261
+ const input = 'invalid';
262
+ const result = (0, parseOptionSetsLocalFiles_1.parseDisabledValue)(input);
263
+ expect(result).toBe(false);
264
+ });
265
+ });
266
+ });
267
+ describe('parseLabelsInColumn', () => {
268
+ it('should parse option sets with number values as strings', () => {
269
+ const input = [{ Gender: 1 }, { Gender: 2 }, { Gender: 3 }];
270
+ const expectedOutput = [
271
+ {
272
+ name: 'Gender',
273
+ slug: 'gender',
274
+ isArchived: false,
275
+ optionSet: [
276
+ { value: '1', display: '1' },
277
+ { value: '2', display: '2' },
278
+ { value: '3', display: '3' },
279
+ ],
280
+ },
281
+ ];
282
+ const result = (0, parseOptionSetsLocalFiles_1.parseLabelsInColumn)(input);
283
+ expect(result).toEqual(expectedOutput);
284
+ });
285
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const uploadOptionSets_1 = require("../../commands/types/uploadOptionSets");
4
+ describe('parseOptionSetValuesToString', () => {
5
+ it('should convert all option set values to strings', () => {
6
+ const input = {
7
+ value1: 123,
8
+ value2: true,
9
+ value3: { nested: 'object' },
10
+ };
11
+ const expectedOutput = {
12
+ value1: '123',
13
+ value2: 'true',
14
+ value3: { nested: 'object' },
15
+ };
16
+ const result = (0, uploadOptionSets_1.parseOptionSetValuesToString)(input);
17
+ expect(result).toEqual(expectedOutput);
18
+ });
19
+ });
@@ -62,6 +62,8 @@ class WorkflowTemplateDefinitionDeployer {
62
62
  identifier: definition.identifier,
63
63
  builtIn: definition.builtIn,
64
64
  messageGroupId: definition.messageGroupId,
65
+ messageGroup: definition.messageGroup,
66
+ dynamicMessageGroupId: definition.dynamicMessageGroupId,
65
67
  parallelWorkerCount: definition.parallelWorkerCount,
66
68
  triggerKey: definition.triggerKey,
67
69
  workflowDefinition: definition.workflowDefinition,
@@ -115,6 +117,8 @@ class WorkflowTemplateDefinitionDeployer {
115
117
  public: workflowDeclaration.public,
116
118
  isActive: workflowDeclaration.isActive,
117
119
  messageGroupId: workflowDeclaration.messageGroupId,
120
+ messageGroup: workflowDeclaration.messageGroup,
121
+ dynamicMessageGroupId: workflowDeclaration.dynamicMessageGroupId,
118
122
  parallelWorkerCount: workflowDeclaration.parallelWorkerCount,
119
123
  };
120
124
  const workflowTemplate = await (0, event_workflow_template_definition_1.createWorkflowTemplateDefinition)(newObject);
@@ -44,6 +44,8 @@ class LocalWorkflowTemplateDeployer {
44
44
  isActive: workflowTemplate.isActive,
45
45
  supportingAppId: workflowTemplate.supportingAppId,
46
46
  messageGroupId: workflowTemplate.messageGroupId,
47
+ messageGroup: workflowTemplate.messageGroup,
48
+ dynamicMessageGroupId: workflowTemplate.dynamicMessageGroupId,
47
49
  parallelWorkerCount: workflowTemplate.parallelWorkerCount,
48
50
  };
49
51
  const newWorkflowTemplate = await (0, event_workflow_templates_1.createWorkflowTemplate)(newObject);
@@ -159,6 +161,8 @@ class LocalWorkflowTemplateDeployer {
159
161
  builtIn: workflowTemplate.builtIn,
160
162
  workflowDefinition: workflowTemplate.workflowDefinition,
161
163
  messageGroupId: workflowTemplate.messageGroupId ?? existingWorkflowTemplate.messageGroupId,
164
+ messageGroup: workflowTemplate.messageGroup ?? existingWorkflowTemplate.messageGroup,
165
+ dynamicMessageGroupId: workflowTemplate.dynamicMessageGroupId ?? existingWorkflowTemplate.dynamicMessageGroupId,
162
166
  parallelWorkerCount: workflowTemplate.parallelWorkerCount ?? existingWorkflowTemplate.parallelWorkerCount,
163
167
  });
164
168
  const updatedWorkflowTemplate = await (0, event_workflow_templates_1.updateWorkflowTemplate)({
@@ -8,7 +8,7 @@ export interface AppDeclaration {
8
8
  appName: string;
9
9
  appDescription?: string;
10
10
  visibility: 'private' | 'public';
11
- hidden: boolean;
11
+ accessGrants?: AccessGrantConfiguration[];
12
12
  publisher: string;
13
13
  version: string;
14
14
  eventWorkflowTriggerKeyMapping: string;
@@ -28,6 +28,22 @@ export interface AppDeclaration {
28
28
  };
29
29
  dockerImageRef?: string;
30
30
  }
31
+ export interface AccessGrantConfiguration {
32
+ orgSlug: string;
33
+ permissions: AppAccessPermission[];
34
+ }
35
+ export interface AppAccessGrant {
36
+ issuerReference: string;
37
+ recipientReference: string;
38
+ appId?: string;
39
+ scope: AppAccessGrantScope;
40
+ }
41
+ export declare enum AppAccessGrantScope {
42
+ install = "INSTALL"
43
+ }
44
+ export declare enum AppAccessPermission {
45
+ INSTALL = "install"
46
+ }
31
47
  export interface ExtensionDefinitionDeclaration {
32
48
  name: string;
33
49
  identifier: string;
@@ -73,6 +89,8 @@ export interface WorkflowDefinition {
73
89
  supportingAppId?: string;
74
90
  parallelWorkerCount?: number;
75
91
  messageGroupId?: string;
92
+ messageGroup?: string;
93
+ dynamicMessageGroupId?: string;
76
94
  }
77
95
  export interface WorkflowTemplateDeclaration {
78
96
  appIdentifier: string;
@@ -91,6 +109,8 @@ export interface WorkflowTemplate {
91
109
  supportingAppId?: string;
92
110
  parallelWorkerCount?: number;
93
111
  messageGroupId?: string;
112
+ messageGroup?: string;
113
+ dynamicMessageGroupId?: string;
94
114
  createdOn?: Date;
95
115
  updatedOn?: Date;
96
116
  createdById?: string;
@@ -189,6 +209,7 @@ export declare class AppVersion {
189
209
  app?: App;
190
210
  appOrgs?: AppOrg[];
191
211
  versionNumber: number;
212
+ semver: string;
192
213
  status: AppVersionStatus;
193
214
  eventWorkflowTriggerKeyMapping: string;
194
215
  configProperties?: ConfigProperty[];
@@ -1,6 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AssortmentConfigurationRelationships = exports.AssortmentConfigurationSlim = exports.FolderSlim = exports.ProjectConfigurationTemplate = exports.ProjectConfiguration = exports.Folder = exports.AssortmentConfiguration = exports.AssortmentType = exports.CommonConfiguration = exports.TriggerKeyDefinition = exports.ConfigProperty = exports.AppApiKey = exports.AppVersion = exports.AppRuntime = exports.AppVersionStatus = exports.AppOrgStatus = void 0;
3
+ exports.AssortmentConfigurationRelationships = exports.AssortmentConfigurationSlim = exports.FolderSlim = exports.ProjectConfigurationTemplate = exports.ProjectConfiguration = exports.Folder = exports.AssortmentConfiguration = exports.AssortmentType = exports.CommonConfiguration = exports.TriggerKeyDefinition = exports.ConfigProperty = exports.AppApiKey = exports.AppVersion = exports.AppRuntime = exports.AppVersionStatus = exports.AppOrgStatus = exports.AppAccessPermission = exports.AppAccessGrantScope = void 0;
4
+ var AppAccessGrantScope;
5
+ (function (AppAccessGrantScope) {
6
+ AppAccessGrantScope["install"] = "INSTALL";
7
+ })(AppAccessGrantScope = exports.AppAccessGrantScope || (exports.AppAccessGrantScope = {}));
8
+ var AppAccessPermission;
9
+ (function (AppAccessPermission) {
10
+ AppAccessPermission["INSTALL"] = "install";
11
+ })(AppAccessPermission = exports.AppAccessPermission || (exports.AppAccessPermission = {}));
4
12
  var AppOrgStatus;
5
13
  (function (AppOrgStatus) {
6
14
  AppOrgStatus["INSTALLING"] = "INSTALLING";
@@ -36,6 +44,7 @@ class AppVersion {
36
44
  app;
37
45
  appOrgs;
38
46
  versionNumber;
47
+ semver;
39
48
  status;
40
49
  eventWorkflowTriggerKeyMapping;
41
50
  configProperties;
@@ -2,7 +2,12 @@ appIdentifier: "APP_IDENTIFIER_STUB" # Change to be your company root domain an
2
2
  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
- hidden: false # can be used with a public app to prevent it from showing on the marketplace, but still installable by other orgs
5
+ # Access Grants
6
+ # Use this section to share this app with other organizations.
7
+ # accessGrants:
8
+ # - orgSlug: "ORG_SLUG"
9
+ # permissions:
10
+ # - install
6
11
  publisher: "APP_PUBLISHER_STUB" # Your company name, used for public apps
7
12
  version: "1.0.0"
8
13
 
@@ -34,7 +39,10 @@ workflows:
34
39
  triggerKey: item|update
35
40
  isActive: true
36
41
  public: true
37
- concurrency: 3 # The maximum number of concurrent jobs to run for this workflow. Defaults to 5
42
+ parallelWorkerCount: 5 # The maximum number of concurrent jobs to run for this workflow (Range 1-30). Defaults to 5
43
+ messageGroupId: # Optional. Used to group jobs in a specific queue. Allows multiple workflows to use the same queue. Not to be used with dynamicMessageGroupId
44
+ messageGroup: # Optional. Used with dynamicMessageGroupId to allow for dynamic queue assignment and allows for multiple workflows to use the same queue
45
+ dynamicMessageGroupId: # Optional. Allows for dynamic queue assignment based on the event data. Example usage: 'family-queue-{newData.itemFamilyId}'
38
46
  workflowDefinition:
39
47
  paths:
40
48
  - conditional: "true"
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.3.4",
2
+ "version": "2.4.0-alpha",
3
3
  "commands": {
4
4
  "app:create": {
5
5
  "id": "app:create",
@@ -93,14 +93,6 @@
93
93
  "description": "\"Install the app's accompanying workflows\"",
94
94
  "required": false,
95
95
  "allowNo": false
96
- },
97
- "showHidden": {
98
- "name": "showHidden",
99
- "type": "boolean",
100
- "char": "h",
101
- "description": "Show the option to install public but hidden apps",
102
- "required": false,
103
- "allowNo": false
104
96
  }
105
97
  },
106
98
  "args": {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/cli",
3
- "version": "2.3.4",
3
+ "version": "2.4.0-alpha",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@contrail/entity-types": "^1.1.17",
26
- "@contrail/sdk": "^1.2.17",
26
+ "@contrail/sdk": "^1.3.12",
27
27
  "@contrail/types": "^3.0.48",
28
28
  "@contrail/util": "^1.0.41",
29
29
  "@oclif/core": "^2",
@@ -139,4 +139,4 @@
139
139
  "coverageDirectory": "../coverage",
140
140
  "testEnvironment": "node"
141
141
  }
142
- }
142
+ }