@contrail/cli 2.1.5 → 2.1.7

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.5 darwin-arm64 node-v18.13.0
18
+ @contrail/cli/2.1.7 darwin-arm64 node-v18.13.0
19
19
  $ contrail --help [COMMAND]
20
20
  USAGE
21
21
  $ contrail COMMAND
@@ -41,7 +41,7 @@ ExportGroups.flags = {
41
41
  async function exportGroups(fileLocation, overwrite) {
42
42
  const allGroups = await (0, users_1.getGroups)({ relations: ['groupPrincipals'] });
43
43
  const allUsersInOrg = await (0, users_1.getUserOrgs)();
44
- const groups = [];
44
+ let groups = [];
45
45
  for (const group of allGroups) {
46
46
  const groupPrincipals = getGroupPrincipals(group, allGroups, allUsersInOrg);
47
47
  groups.push({
@@ -49,6 +49,7 @@ async function exportGroups(fileLocation, overwrite) {
49
49
  groupPrincipals,
50
50
  });
51
51
  }
52
+ groups = groups.sort((one, two) => (one.name < two.name ? -1 : 1));
52
53
  await saveData(groups, fileLocation, overwrite);
53
54
  }
54
55
  exports.exportGroups = exportGroups;
@@ -88,5 +89,5 @@ function getGroupPrincipals(group, allGroups, orgUsers) {
88
89
  });
89
90
  }
90
91
  }
91
- return principals;
92
+ return principals.sort((one, two) => { var _a, _b; return (((_b = (_a = one.email) !== null && _a !== void 0 ? _a : one.name < two.email) !== null && _b !== void 0 ? _b : two.name) ? -1 : 1); });
92
93
  }
@@ -99,7 +99,7 @@ async function reduceTypePropertyPolicies(data) {
99
99
  statements: x.policy.statements.map(x => reducePrincipal(x)),
100
100
  }
101
101
  };
102
- });
102
+ }).sort((one, two) => (one.label < two.label ? -1 : 1));
103
103
  }
104
104
  function reduceTypePropertyPolicyLinks(data) {
105
105
  var _a, _b;
@@ -168,7 +168,7 @@ async function reduceTypePolicies(data) {
168
168
  statements: x.policy.statements.map(x => reducePrincipal(x)),
169
169
  }
170
170
  };
171
- });
171
+ }).sort((one, two) => (one.label < two.label ? -1 : 1));
172
172
  }
173
173
  function reduceTypePolicyLinks(data) {
174
174
  var _a;
@@ -197,7 +197,7 @@ function reduceUsageInfo(data) {
197
197
  typeSlug: (_a = data.types.find(y => y.id === x.typeId)) === null || _a === void 0 ? void 0 : _a.slug,
198
198
  typePropertySlug: (_b = typeProperties.find(y => y.id === x.typePropertyId)) === null || _b === void 0 ? void 0 : _b.slug,
199
199
  };
200
- });
200
+ }).sort((one, two) => (one.label < two.label ? -1 : 1));
201
201
  }
202
202
  function reduceRuleSetLinks(data) {
203
203
  var _a, _b;
@@ -216,7 +216,12 @@ function reduceRuleSetLinks(data) {
216
216
  type: type.slug
217
217
  });
218
218
  }
219
- return reducedRuleSetLinks;
219
+ return reducedRuleSetLinks.sort((one, two) => {
220
+ if (one.type === two.type) {
221
+ return one.ruleSet > two.ruleSet ? -1 : 1;
222
+ }
223
+ return one.type > two.type ? -1 : 1;
224
+ });
220
225
  }
221
226
  function reduceRuleSets(data) {
222
227
  var _a;
@@ -225,7 +230,7 @@ function reduceRuleSets(data) {
225
230
  ruleSet: x.ruleSet,
226
231
  name: x.name,
227
232
  };
228
- });
233
+ }).sort((one, two) => (one.name < two.name ? -1 : 1));
229
234
  }
230
235
  function reduceOptionSets(data) {
231
236
  var _a;
@@ -235,7 +240,7 @@ function reduceOptionSets(data) {
235
240
  isArchived: optionSet.isArchived,
236
241
  optionSet: optionSet.optionSet,
237
242
  };
238
- });
243
+ }).sort((one, two) => (one.name < two.name ? -1 : 1));
239
244
  }
240
245
  function reduceOptionSetHierarchies(data) {
241
246
  var _a;
@@ -246,7 +251,7 @@ function reduceOptionSetHierarchies(data) {
246
251
  options: x.options,
247
252
  name: x.name
248
253
  };
249
- });
254
+ }).sort((one, two) => (one.name < two.name ? -1 : 1));
250
255
  }
251
256
  function reduceOptionSetHierarchyLinks(data) {
252
257
  var _a;
@@ -276,7 +281,7 @@ function reduceOptionSetHierarchyLinks(data) {
276
281
  typeSlug: type.slug,
277
282
  typePropertySlugs,
278
283
  };
279
- }).filter(x => !!x);
284
+ }).filter(x => !!x).sort((one, two) => (one.typeSlug < two.typeSlug ? -1 : 1));
280
285
  }
281
286
  function reduceTypes(dataHolder) {
282
287
  console.log('Found types: ', dataHolder.types.length);
@@ -320,7 +325,7 @@ function reduceTypes(dataHolder) {
320
325
  return {
321
326
  ...x
322
327
  };
323
- }),
328
+ }).sort((one, two) => (one.slug < two.slug ? -1 : 1)),
324
329
  };
325
330
  reducedTypes.push(reducedType);
326
331
  }
@@ -40,7 +40,7 @@ ExportUsers.flags = {
40
40
  };
41
41
  async function exportUsers(fileLocation, overwrite) {
42
42
  const allUsersInOrg = await (0, users_1.getUserOrgs)();
43
- const users = [];
43
+ let users = [];
44
44
  for (const userInOrg of allUsersInOrg) {
45
45
  delete userInOrg.user.id;
46
46
  delete userInOrg.user.updatedBy;
@@ -53,6 +53,7 @@ async function exportUsers(fileLocation, overwrite) {
53
53
  ...userInOrg.user
54
54
  });
55
55
  }
56
+ users = users.sort((one, two) => (one.email < two.email ? -1 : 1));
56
57
  await saveData(users, fileLocation, overwrite);
57
58
  }
58
59
  exports.exportUsers = exportUsers;
@@ -23,7 +23,7 @@
23
23
  "strictPropertyInitialization": false,
24
24
  "target": "ES2020",
25
25
  "types": [
26
- "node"
26
+ "node", "jest"
27
27
  ]
28
28
  },
29
29
  "exclude": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.1.5",
2
+ "version": "2.1.7",
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.5",
3
+ "version": "2.1.7",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",