@contrail/cli 1.0.59 → 1.0.60

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.
@@ -23,6 +23,7 @@ export declare class AssortmentConfiguration {
23
23
  export declare class Folder {
24
24
  identifier: string;
25
25
  name: string;
26
+ principals: string[];
26
27
  assortments: AssortmentConfiguration[];
27
28
  subFolders: Folder[];
28
29
  }
@@ -30,6 +31,7 @@ export declare class ProjectConfiguration {
30
31
  projectName: string;
31
32
  identifier: string;
32
33
  commonConfig: CommonConfiguration;
34
+ principals: string[];
33
35
  assortments: AssortmentConfiguration[];
34
36
  subFolders: Folder[];
35
37
  }
@@ -37,6 +39,7 @@ export declare class ProjectConfigurationTemplate {
37
39
  projectName: string;
38
40
  identifier: string;
39
41
  commonConfig: CommonConfiguration;
42
+ principals: string[];
40
43
  allFolders: FolderSlim[];
41
44
  allAssortments: AssortmentConfigurationSlim[];
42
45
  allAssortmentRelationships: AssortmentConfigurationRelationships[];
@@ -44,6 +47,7 @@ export declare class ProjectConfigurationTemplate {
44
47
  export declare class FolderSlim {
45
48
  identifier: string;
46
49
  name: string;
50
+ principals: string[];
47
51
  folderIdentifier: string;
48
52
  }
49
53
  export declare class AssortmentConfigurationSlim {
@@ -54,10 +54,12 @@ async function exportProject(name) {
54
54
  const projectConfiguration = {
55
55
  projectName: workspace.name,
56
56
  identifier: workspace.identifier,
57
+ principals: [],
57
58
  commonConfig: {},
58
59
  assortments: [],
59
60
  subFolders: []
60
61
  };
62
+ projectConfiguration.principals = await getFolderPrincipals(workspace);
61
63
  const allAssortments = [];
62
64
  await getAssortmentsAndSubFolders(workspace.id, projectConfiguration.assortments, projectConfiguration.subFolders, allAssortments);
63
65
  await convertRelationshipsInFolders(projectConfiguration, allAssortments);
@@ -104,9 +106,11 @@ async function getAssortmentsAndSubFolders(parentId, assortments, subFolders, al
104
106
  const converted = {
105
107
  identifier: folder.identifier,
106
108
  name: folder.name,
109
+ principals: [],
107
110
  assortments: [],
108
111
  subFolders: [],
109
112
  };
113
+ converted.principals = await getFolderPrincipals(folder);
110
114
  await getAssortmentsAndSubFolders(folder.id, converted.assortments, converted.subFolders, allAssortments);
111
115
  subFolders.push(converted);
112
116
  }
@@ -136,6 +140,20 @@ function convertRelationshipsToIdentifiers(assortments, allAssortments) {
136
140
  delete assortment.composedFromAssortmentIds;
137
141
  }
138
142
  }
143
+ async function getFolderPrincipals(folder) {
144
+ const principals = [];
145
+ if (!folder.policyOwner) {
146
+ return ['INHERIT'];
147
+ }
148
+ const workspacePrincipals = await new Entities().get({
149
+ entityName: 'workspace-principal',
150
+ criteria: { workspaceId: folder.id }
151
+ });
152
+ for (const workspacePrincipal of workspacePrincipals) {
153
+ principals.push(workspacePrincipal.principalReference);
154
+ }
155
+ return principals;
156
+ }
139
157
  function deleteNonUserKeys(assortment) {
140
158
  delete assortment.name;
141
159
  delete assortment.identifier;
@@ -58,6 +58,7 @@ function parseToProjectConfiguration(projectConfigurationFromFile) {
58
58
  projectName: projectConfigurationFromFile.projectName,
59
59
  identifier: projectConfigurationFromFile.identifier,
60
60
  commonConfig: projectConfigurationFromFile.commonConfig,
61
+ principals: projectConfigurationFromFile.principals,
61
62
  assortments: [],
62
63
  subFolders: [],
63
64
  };
@@ -34,6 +34,11 @@ export declare function reduceData(data: DataHolder): {
34
34
  reducedUsageInfo: {
35
35
  used: any;
36
36
  editable: any;
37
+ formulaFunction: any;
38
+ validationFunction: any;
39
+ numberFormat: any;
40
+ defaultValue: any;
41
+ label: any;
37
42
  typeSlug: any;
38
43
  typePropertySlug: any;
39
44
  }[];
@@ -133,6 +133,11 @@ function reduceUsageInfo(data) {
133
133
  return {
134
134
  used: x.used,
135
135
  editable: x.editable,
136
+ formulaFunction: x.formulaFunction,
137
+ validationFunction: x.validationFunction,
138
+ numberFormat: x.numberFormat,
139
+ defaultValue: x.defaultValue,
140
+ label: x.label,
136
141
  typeSlug: (_a = data.types.find(y => y.id === x.typeId)) === null || _a === void 0 ? void 0 : _a.slug,
137
142
  typePropertySlug: (_b = typeProperties.find(y => y.id === x.typePropertyId)) === null || _b === void 0 ? void 0 : _b.slug,
138
143
  };
@@ -71,6 +71,11 @@ async function uploadUsageInfoObjects(loadedUsageInfo) {
71
71
  typeId: loadedUI.typeId,
72
72
  editable: loadedUI.editable,
73
73
  used: loadedUI.used,
74
+ formulaFunction: loadedUI.formulaFunction,
75
+ validationFunction: loadedUI.validationFunction,
76
+ numberFormat: loadedUI.numberFormat,
77
+ defaultValue: loadedUI.defaultValue,
78
+ label: loadedUI.label,
74
79
  }
75
80
  });
76
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/cli",
3
- "version": "1.0.59",
3
+ "version": "1.0.60",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -22,6 +22,7 @@ export class AssortmentConfiguration {
22
22
  export class Folder {
23
23
  identifier: string;
24
24
  name: string;
25
+ principals: string[];
25
26
  assortments: AssortmentConfiguration[];
26
27
  subFolders: Folder[];
27
28
  }
@@ -30,6 +31,7 @@ export class ProjectConfiguration {
30
31
  projectName: string;
31
32
  identifier: string;
32
33
  commonConfig: CommonConfiguration;
34
+ principals: string[];
33
35
  assortments: AssortmentConfiguration[];
34
36
  subFolders: Folder[];
35
37
  }
@@ -38,6 +40,7 @@ export class ProjectConfigurationTemplate {
38
40
  projectName: string;
39
41
  identifier: string;
40
42
  commonConfig: CommonConfiguration;
43
+ principals: string[];
41
44
  allFolders: FolderSlim[];
42
45
  allAssortments: AssortmentConfigurationSlim[];
43
46
  allAssortmentRelationships: AssortmentConfigurationRelationships[];
@@ -46,6 +49,7 @@ export class ProjectConfigurationTemplate {
46
49
  export class FolderSlim {
47
50
  identifier: string;
48
51
  name: string;
52
+ principals: string[];
49
53
  folderIdentifier: string;
50
54
  }
51
55
 
@@ -67,11 +67,14 @@ async function exportProject(name) {
67
67
  const projectConfiguration = {
68
68
  projectName: workspace.name,
69
69
  identifier: workspace.identifier,
70
+ principals: [],
70
71
  commonConfig: {},
71
72
  assortments: [],
72
73
  subFolders: []
73
74
  };
74
75
 
76
+ projectConfiguration.principals = await getFolderPrincipals(workspace);
77
+
75
78
  const allAssortments = [];
76
79
  await getAssortmentsAndSubFolders(workspace.id, projectConfiguration.assortments, projectConfiguration.subFolders, allAssortments);
77
80
  await convertRelationshipsInFolders(projectConfiguration, allAssortments);
@@ -125,9 +128,12 @@ async function getAssortmentsAndSubFolders(parentId, assortments, subFolders, al
125
128
  const converted = {
126
129
  identifier: folder.identifier,
127
130
  name: folder.name,
131
+ principals: [],
128
132
  assortments: [],
129
133
  subFolders: [],
130
134
  };
135
+
136
+ converted.principals = await getFolderPrincipals(folder);
131
137
  await getAssortmentsAndSubFolders(folder.id, converted.assortments, converted.subFolders, allAssortments);
132
138
  subFolders.push(converted);
133
139
  }
@@ -166,6 +172,24 @@ function convertRelationshipsToIdentifiers(assortments, allAssortments) {
166
172
  }
167
173
  }
168
174
 
175
+ async function getFolderPrincipals(folder) {
176
+ const principals = [];
177
+ if (!folder.policyOwner) {
178
+ return ['INHERIT'];
179
+ }
180
+
181
+ const workspacePrincipals = await new Entities().get({
182
+ entityName: 'workspace-principal',
183
+ criteria: {workspaceId: folder.id}
184
+ });
185
+
186
+ for (const workspacePrincipal of workspacePrincipals) {
187
+ principals.push(workspacePrincipal.principalReference);
188
+ }
189
+
190
+ return principals;
191
+ }
192
+
169
193
  function deleteNonUserKeys(assortment) {
170
194
  delete assortment.name;
171
195
  delete assortment.identifier;
@@ -74,6 +74,7 @@ function parseToProjectConfiguration(projectConfigurationFromFile: ProjectConfig
74
74
  projectName: projectConfigurationFromFile.projectName,
75
75
  identifier: projectConfigurationFromFile.identifier,
76
76
  commonConfig: projectConfigurationFromFile.commonConfig,
77
+ principals: projectConfigurationFromFile.principals,
77
78
  assortments: [],
78
79
  subFolders: [],
79
80
  };
@@ -156,6 +156,11 @@ function reduceUsageInfo(data: DataHolder) {
156
156
  return {
157
157
  used: x.used,
158
158
  editable: x.editable,
159
+ formulaFunction: x.formulaFunction,
160
+ validationFunction: x.validationFunction,
161
+ numberFormat: x.numberFormat,
162
+ defaultValue: x.defaultValue,
163
+ label: x.label,
159
164
  typeSlug: data.types.find(y => y.id === x.typeId)?.slug,
160
165
  typePropertySlug: typeProperties.find(y => y.id === x.typePropertyId)?.slug,
161
166
  };
@@ -79,6 +79,11 @@ async function uploadUsageInfoObjects(loadedUsageInfo) {
79
79
  typeId: loadedUI.typeId,
80
80
  editable: loadedUI.editable,
81
81
  used: loadedUI.used,
82
+ formulaFunction: loadedUI.formulaFunction,
83
+ validationFunction: loadedUI.validationFunction,
84
+ numberFormat: loadedUI.numberFormat,
85
+ defaultValue: loadedUI.defaultValue,
86
+ label: loadedUI.label,
82
87
  }
83
88
  });
84
89
  } else {