@rockcarver/frodo-lib 0.12.3 → 0.12.5-0

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.
@@ -13,13 +13,16 @@ exports.exportJourneyToFile = exportJourneyToFile;
13
13
  exports.exportJourneysToFile = exportJourneysToFile;
14
14
  exports.exportJourneysToFiles = exportJourneysToFiles;
15
15
  exports.findOrphanedNodes = findOrphanedNodes;
16
+ exports.getJourneyClassification = getJourneyClassification;
16
17
  exports.getJourneys = getJourneys;
17
18
  exports.importFirstJourneyFromFile = importFirstJourneyFromFile;
18
19
  exports.importJourney = importJourney;
19
20
  exports.importJourneyFromFile = importJourneyFromFile;
20
21
  exports.importJourneysFromFile = importJourneysFromFile;
21
22
  exports.importJourneysFromFiles = importJourneysFromFiles;
22
- exports.isCustom = isCustom;
23
+ exports.isCloudOnlyJourney = isCloudOnlyJourney;
24
+ exports.isCustomJourney = isCustomJourney;
25
+ exports.isPremiumJourney = isPremiumJourney;
23
26
  exports.listJourneys = listJourneys;
24
27
  exports.removeOrphanedNodes = removeOrphanedNodes;
25
28
 
@@ -37,6 +40,8 @@ var _SessionStorage = _interopRequireDefault(require("../storage/SessionStorage"
37
40
 
38
41
  var _NodeApi = require("../api/NodeApi");
39
42
 
43
+ var _NodeOps = require("./NodeOps");
44
+
40
45
  var _TreeApi = require("../api/TreeApi");
41
46
 
42
47
  var _EmailTemplateApi = require("../api/EmailTemplateApi");
@@ -1131,7 +1136,7 @@ function _importJourneyFromFile() {
1131
1136
  }
1132
1137
  });
1133
1138
 
1134
- return function (_x32, _x33) {
1139
+ return function (_x31, _x32) {
1135
1140
  return _ref.apply(this, arguments);
1136
1141
  };
1137
1142
  }());
@@ -1211,7 +1216,7 @@ function _importFirstJourneyFromFile() {
1211
1216
 
1212
1217
  });
1213
1218
 
1214
- return function (_x34, _x35) {
1219
+ return function (_x33, _x34) {
1215
1220
  return _ref2.apply(this, arguments);
1216
1221
  };
1217
1222
  }());
@@ -1288,9 +1293,8 @@ function importJourneysFromFiles(_x26) {
1288
1293
  return _importJourneysFromFiles.apply(this, arguments);
1289
1294
  }
1290
1295
  /**
1291
- * Describe a tree
1292
- * @param {Object} journeyData tree
1293
- * @returns {Object} an object describing the tree
1296
+ * Describe a journey
1297
+ * @param {SingleJourneyExportTemplate} journeyData journey export object
1294
1298
  */
1295
1299
 
1296
1300
 
@@ -1314,13 +1318,11 @@ function _importJourneysFromFiles() {
1314
1318
  }
1315
1319
 
1316
1320
  function describeJourney(journeyData) {
1317
- var treeMap = {};
1321
+ var _journeyData$themes;
1322
+
1318
1323
  var nodeTypeMap = {};
1319
- var scriptsMap = {};
1320
- var emailTemplatesMap = {};
1321
- treeMap['treeName'] = journeyData.tree._id;
1322
1324
 
1323
- for (var [, nodeData] of Object.entries(journeyData.nodes)) {
1325
+ for (var nodeData of Object.values(journeyData.nodes)) {
1324
1326
  if (nodeTypeMap[nodeData['_type']['_id']]) {
1325
1327
  nodeTypeMap[nodeData['_type']['_id']] += 1;
1326
1328
  } else {
@@ -1328,7 +1330,7 @@ function describeJourney(journeyData) {
1328
1330
  }
1329
1331
  }
1330
1332
 
1331
- for (var [, _nodeData] of Object.entries(journeyData.innerNodes)) {
1333
+ for (var _nodeData of Object.values(journeyData.innerNodes)) {
1332
1334
  if (nodeTypeMap[_nodeData['_type']['_id']]) {
1333
1335
  nodeTypeMap[_nodeData['_type']['_id']] += 1;
1334
1336
  } else {
@@ -1336,44 +1338,69 @@ function describeJourney(journeyData) {
1336
1338
  }
1337
1339
  }
1338
1340
 
1339
- for (var [, scriptData] of Object.entries(journeyData.scripts)) {
1340
- scriptsMap[scriptData['name']] = scriptData['description'];
1341
- }
1341
+ (0, _Console.printMessage)("\n".concat(journeyData.tree._id), 'data');
1342
+ var line = Array(journeyData.tree._id['length']).fill('=').join('');
1343
+ (0, _Console.printMessage)(line);
1342
1344
 
1343
- for (var [id, data] of Object.entries(journeyData.emailTemplates)) {
1344
- emailTemplatesMap[id] = data['displayName'];
1345
+ if (journeyData.tree.description) {
1346
+ (0, _Console.printMessage)("\n".concat(journeyData.tree.description, "\n"), 'data');
1345
1347
  }
1346
1348
 
1347
- treeMap['nodeTypes'] = nodeTypeMap;
1348
- treeMap['scripts'] = scriptsMap;
1349
- treeMap['emailTemplates'] = emailTemplatesMap;
1350
- (0, _Console.printMessage)("\nJourney: ".concat(treeMap['treeName']), 'data');
1351
- (0, _Console.printMessage)('========');
1352
1349
  (0, _Console.printMessage)('\nNodes:', 'data');
1353
1350
 
1354
- if (Object.entries(treeMap['nodeTypes']).length) {
1355
- for (var [name, count] of Object.entries(treeMap['nodeTypes'])) {
1356
- (0, _Console.printMessage)("- ".concat(name, ": ").concat(count), 'data');
1351
+ if (Object.entries(nodeTypeMap).length) {
1352
+ for (var [name, count] of Object.entries(nodeTypeMap)) {
1353
+ (0, _Console.printMessage)("- [".concat(String(count)['brightCyan'], "] ").concat(name), 'data');
1357
1354
  }
1358
1355
  }
1359
1356
 
1360
- if (Object.entries(treeMap['scripts']).length) {
1357
+ if ((_journeyData$themes = journeyData.themes) !== null && _journeyData$themes !== void 0 && _journeyData$themes.length) {
1358
+ (0, _Console.printMessage)('\nThemes:', 'data');
1359
+
1360
+ for (var themeData of journeyData.themes) {
1361
+ (0, _Console.printMessage)("- [".concat(themeData['_id']['brightCyan'], "] ").concat(themeData['name']), 'data');
1362
+ }
1363
+ }
1364
+
1365
+ if (Object.entries(journeyData.scripts).length) {
1361
1366
  (0, _Console.printMessage)('\nScripts:', 'data');
1362
1367
 
1363
- for (var [_name, desc] of Object.entries(treeMap['scripts'])) {
1364
- (0, _Console.printMessage)("- ".concat(_name, ": ").concat(desc), 'data');
1368
+ for (var scriptData of Object.values(journeyData.scripts)) {
1369
+ (0, _Console.printMessage)("- [".concat(scriptData['_id'].brightCyan, "] ").concat(scriptData['name']), 'data');
1365
1370
  }
1366
1371
  }
1367
1372
 
1368
- if (Object.entries(treeMap['emailTemplates']).length) {
1373
+ if (Object.entries(journeyData.emailTemplates).length) {
1369
1374
  (0, _Console.printMessage)('\nEmail Templates:', 'data');
1370
1375
 
1371
- for (var [_id] of Object.entries(treeMap['emailTemplates'])) {
1372
- (0, _Console.printMessage)("- ".concat(_id), 'data');
1376
+ for (var templateData of Object.values(journeyData.emailTemplates)) {
1377
+ (0, _Console.printMessage)("- ".concat(templateData['_id'].split('/')[1]), 'data');
1378
+ }
1379
+ }
1380
+
1381
+ if (Object.entries(journeyData.socialIdentityProviders).length) {
1382
+ (0, _Console.printMessage)('\nSocial Identity Providers:', 'data');
1383
+
1384
+ for (var socialIdpData of Object.values(journeyData.socialIdentityProviders)) {
1385
+ (0, _Console.printMessage)("- ".concat(socialIdpData['_id'], " [").concat(socialIdpData['_type']['_id'].brightCyan, "]"), 'data');
1373
1386
  }
1374
1387
  }
1375
1388
 
1376
- return treeMap;
1389
+ if (Object.entries(journeyData.saml2Entities).length) {
1390
+ (0, _Console.printMessage)('\nSAML2 Entity Providers:', 'data');
1391
+
1392
+ for (var entityProviderData of Object.values(journeyData.saml2Entities)) {
1393
+ (0, _Console.printMessage)("- ".concat(entityProviderData['entityId']), 'data');
1394
+ }
1395
+ }
1396
+
1397
+ if (Object.entries(journeyData.circlesOfTrust).length) {
1398
+ (0, _Console.printMessage)('\nSAML2 Circles Of Trust:', 'data');
1399
+
1400
+ for (var cotData of Object.values(journeyData.circlesOfTrust)) {
1401
+ (0, _Console.printMessage)("- ".concat(cotData['_id']), 'data');
1402
+ }
1403
+ }
1377
1404
  }
1378
1405
  /**
1379
1406
  * Find all node configuration objects that are no longer referenced by any tree
@@ -1470,6 +1497,12 @@ function _findOrphanedNodes() {
1470
1497
  function removeOrphanedNodes(_x27) {
1471
1498
  return _removeOrphanedNodes.apply(this, arguments);
1472
1499
  }
1500
+ /**
1501
+ * Analyze if a journey contains any custom nodes considering the detected or the overridden version.
1502
+ * @param {SingleJourneyExportTemplate} journey Journey/tree configuration object
1503
+ * @returns {boolean} True if the journey/tree contains any custom nodes, false otherwise.
1504
+ */
1505
+
1473
1506
 
1474
1507
  function _removeOrphanedNodes() {
1475
1508
  _removeOrphanedNodes = _asyncToGenerator(function* (orphanedNodes) {
@@ -1494,108 +1527,87 @@ function _removeOrphanedNodes() {
1494
1527
  return _removeOrphanedNodes.apply(this, arguments);
1495
1528
  }
1496
1529
 
1497
- var OOTB_NODE_TYPES_7 = ['AcceptTermsAndConditionsNode', 'AccountActiveDecisionNode', 'AccountLockoutNode', 'AgentDataStoreDecisionNode', 'AnonymousSessionUpgradeNode', 'AnonymousUserNode', 'AttributeCollectorNode', 'AttributePresentDecisionNode', 'AttributeValueDecisionNode', 'AuthLevelDecisionNode', 'ChoiceCollectorNode', 'ConsentNode', 'CookiePresenceDecisionNode', 'CreateObjectNode', 'CreatePasswordNode', 'DataStoreDecisionNode', 'DeviceGeoFencingNode', 'DeviceLocationMatchNode', 'DeviceMatchNode', 'DeviceProfileCollectorNode', 'DeviceSaveNode', 'DeviceTamperingVerificationNode', 'DisplayUserNameNode', 'EmailSuspendNode', 'EmailTemplateNode', 'IdentifyExistingUserNode', 'IncrementLoginCountNode', 'InnerTreeEvaluatorNode', 'IotAuthenticationNode', 'IotRegistrationNode', 'KbaCreateNode', 'KbaDecisionNode', 'KbaVerifyNode', 'LdapDecisionNode', 'LoginCountDecisionNode', 'MessageNode', 'MetadataNode', 'MeterNode', 'ModifyAuthLevelNode', 'OneTimePasswordCollectorDecisionNode', 'OneTimePasswordGeneratorNode', 'OneTimePasswordSmsSenderNode', 'OneTimePasswordSmtpSenderNode', 'PageNode', 'PasswordCollectorNode', 'PatchObjectNode', 'PersistentCookieDecisionNode', 'PollingWaitNode', 'ProfileCompletenessDecisionNode', 'ProvisionDynamicAccountNode', 'ProvisionIdmAccountNode', 'PushAuthenticationSenderNode', 'PushResultVerifierNode', 'QueryFilterDecisionNode', 'RecoveryCodeCollectorDecisionNode', 'RecoveryCodeDisplayNode', 'RegisterLogoutWebhookNode', 'RemoveSessionPropertiesNode', 'RequiredAttributesDecisionNode', 'RetryLimitDecisionNode', 'ScriptedDecisionNode', 'SelectIdPNode', 'SessionDataNode', 'SetFailureUrlNode', 'SetPersistentCookieNode', 'SetSessionPropertiesNode', 'SetSuccessUrlNode', 'SocialFacebookNode', 'SocialGoogleNode', 'SocialNode', 'SocialOAuthIgnoreProfileNode', 'SocialOpenIdConnectNode', 'SocialProviderHandlerNode', 'TermsAndConditionsDecisionNode', 'TimeSinceDecisionNode', 'TimerStartNode', 'TimerStopNode', 'UsernameCollectorNode', 'ValidatedPasswordNode', 'ValidatedUsernameNode', 'WebAuthnAuthenticationNode', 'WebAuthnDeviceStorageNode', 'WebAuthnRegistrationNode', 'ZeroPageLoginNode', 'product-CertificateCollectorNode', 'product-CertificateUserExtractorNode', 'product-CertificateValidationNode', 'product-KerberosNode', 'product-ReCaptchaNode', 'product-Saml2Node', 'product-WriteFederationInformationNode'];
1498
- var OOTB_NODE_TYPES_7_1 = ['PushRegistrationNode', 'GetAuthenticatorAppNode', 'MultiFactorRegistrationOptionsNode', 'OptOutMultiFactorAuthenticationNode'].concat(OOTB_NODE_TYPES_7);
1499
- var OOTB_NODE_TYPES_7_2 = ['OathRegistrationNode', 'OathTokenVerifierNode', 'PassthroughAuthenticationNode', 'ConfigProviderNode', 'DebugNode'].concat(OOTB_NODE_TYPES_7_1);
1500
- var OOTB_NODE_TYPES_6_5 = ['AbstractSocialAuthLoginNode', 'AccountLockoutNode', 'AgentDataStoreDecisionNode', 'AnonymousUserNode', 'AuthLevelDecisionNode', 'ChoiceCollectorNode', 'CookiePresenceDecisionNode', 'CreatePasswordNode', 'DataStoreDecisionNode', 'InnerTreeEvaluatorNode', 'LdapDecisionNode', 'MessageNode', 'MetadataNode', 'MeterNode', 'ModifyAuthLevelNode', 'OneTimePasswordCollectorDecisionNode', 'OneTimePasswordGeneratorNode', 'OneTimePasswordSmsSenderNode', 'OneTimePasswordSmtpSenderNode', 'PageNode', 'PasswordCollectorNode', 'PersistentCookieDecisionNode', 'PollingWaitNode', 'ProvisionDynamicAccountNode', 'ProvisionIdmAccountNode', 'PushAuthenticationSenderNode', 'PushResultVerifierNode', 'RecoveryCodeCollectorDecisionNode', 'RecoveryCodeDisplayNode', 'RegisterLogoutWebhookNode', 'RemoveSessionPropertiesNode', 'RetryLimitDecisionNode', 'ScriptedDecisionNode', 'SessionDataNode', 'SetFailureUrlNode', 'SetPersistentCookieNode', 'SetSessionPropertiesNode', 'SetSuccessUrlNode', 'SocialFacebookNode', 'SocialGoogleNode', 'SocialNode', 'SocialOAuthIgnoreProfileNode', 'SocialOpenIdConnectNode', 'TimerStartNode', 'TimerStopNode', 'UsernameCollectorNode', 'WebAuthnAuthenticationNode', 'WebAuthnRegistrationNode', 'ZeroPageLoginNode'];
1501
- var OOTB_NODE_TYPES_6 = ['AbstractSocialAuthLoginNode', 'AccountLockoutNode', 'AgentDataStoreDecisionNode', 'AnonymousUserNode', 'AuthLevelDecisionNode', 'ChoiceCollectorNode', 'CookiePresenceDecisionNode', 'CreatePasswordNode', 'DataStoreDecisionNode', 'InnerTreeEvaluatorNode', 'LdapDecisionNode', 'MessageNode', 'MetadataNode', 'MeterNode', 'ModifyAuthLevelNode', 'OneTimePasswordCollectorDecisionNode', 'OneTimePasswordGeneratorNode', 'OneTimePasswordSmsSenderNode', 'OneTimePasswordSmtpSenderNode', 'PageNode', 'PasswordCollectorNode', 'PersistentCookieDecisionNode', 'PollingWaitNode', 'ProvisionDynamicAccountNode', 'ProvisionIdmAccountNode', 'PushAuthenticationSenderNode', 'PushResultVerifierNode', 'RecoveryCodeCollectorDecisionNode', 'RecoveryCodeDisplayNode', 'RegisterLogoutWebhookNode', 'RemoveSessionPropertiesNode', 'RetryLimitDecisionNode', 'ScriptedDecisionNode', 'SessionDataNode', 'SetFailureUrlNode', 'SetPersistentCookieNode', 'SetSessionPropertiesNode', 'SetSuccessUrlNode', 'SocialFacebookNode', 'SocialGoogleNode', 'SocialNode', 'SocialOAuthIgnoreProfileNode', 'SocialOpenIdConnectNode', 'TimerStartNode', 'TimerStopNode', 'UsernameCollectorNode', 'WebAuthnAuthenticationNode', 'WebAuthnRegistrationNode', 'ZeroPageLoginNode'];
1530
+ function isCustomJourney(journey) {
1531
+ var nodeList = Object.values(journey.nodes).concat(Object.values(journey.innerNodes));
1532
+
1533
+ for (var node of nodeList) {
1534
+ if ((0, _NodeOps.isCustomNode)(node['_type']['_id'])) {
1535
+ return true;
1536
+ }
1537
+ }
1538
+
1539
+ return false;
1540
+ }
1502
1541
  /**
1503
- * Analyze if a journey contains any custom nodes considering the detected or the overridden version.
1504
- * @param {Object} journey Journey/tree configuration object
1542
+ * Analyze if a journey contains any premium nodes considering the detected or the overridden version.
1543
+ * @param {SingleJourneyExportTemplate} journey Journey/tree configuration object
1505
1544
  * @returns {boolean} True if the journey/tree contains any custom nodes, false otherwise.
1506
1545
  */
1507
1546
 
1508
- function isCustom(_x28) {
1509
- return _isCustom.apply(this, arguments);
1547
+
1548
+ function isPremiumJourney(journey) {
1549
+ var nodeList = Object.values(journey.nodes).concat(Object.values(journey.innerNodes));
1550
+
1551
+ for (var node of nodeList) {
1552
+ if ((0, _NodeOps.isPremiumNode)(node['_type']['_id'])) {
1553
+ return true;
1554
+ }
1555
+ }
1556
+
1557
+ return false;
1510
1558
  }
1511
1559
  /**
1512
- * List all the journeys/trees
1513
- * @param {boolean} long Long version, all the fields
1514
- * @param {boolean} analyze Analyze journeys/trees for custom nodes (expensive)
1515
- * @returns {Promise<unknown[]>} a promise that resolves to an array journey objects
1560
+ * Analyze if a journey contains any cloud-only nodes considering the detected or the overridden version.
1561
+ * @param {SingleJourneyExportTemplate} journey Journey/tree configuration object
1562
+ * @returns {boolean} True if the journey/tree contains any cloud-only nodes, false otherwise.
1516
1563
  */
1517
1564
 
1518
1565
 
1519
- function _isCustom() {
1520
- _isCustom = _asyncToGenerator(function* (journey) {
1521
- var ootbNodeTypes = [];
1522
- var nodeList = journey.nodes;
1523
-
1524
- switch (_SessionStorage.default.session.getAmVersion()) {
1525
- case '7.1.0':
1526
- ootbNodeTypes = OOTB_NODE_TYPES_7_1.slice(0);
1527
- break;
1528
-
1529
- case '7.2.0':
1530
- ootbNodeTypes = OOTB_NODE_TYPES_7_2.slice(0);
1531
- break;
1532
-
1533
- case '7.0.0':
1534
- case '7.0.1':
1535
- case '7.0.2':
1536
- ootbNodeTypes = OOTB_NODE_TYPES_7.slice(0);
1537
- break;
1538
-
1539
- case '6.5.3':
1540
- case '6.5.2.3':
1541
- case '6.5.2.2':
1542
- case '6.5.2.1':
1543
- case '6.5.2':
1544
- case '6.5.1':
1545
- case '6.5.0.2':
1546
- case '6.5.0.1':
1547
- ootbNodeTypes = OOTB_NODE_TYPES_6_5.slice(0);
1548
- break;
1549
-
1550
- case '6.0.0.7':
1551
- case '6.0.0.6':
1552
- case '6.0.0.5':
1553
- case '6.0.0.4':
1554
- case '6.0.0.3':
1555
- case '6.0.0.2':
1556
- case '6.0.0.1':
1557
- case '6.0.0':
1558
- ootbNodeTypes = OOTB_NODE_TYPES_6.slice(0);
1559
- break;
1560
-
1561
- default:
1562
- return true;
1563
- }
1566
+ function isCloudOnlyJourney(journey) {
1567
+ var nodeList = Object.values(journey.nodes).concat(Object.values(journey.innerNodes));
1564
1568
 
1565
- var results = [];
1569
+ for (var node of nodeList) {
1570
+ if ((0, _NodeOps.isCloudOnlyNode)(node['_type']['_id'])) {
1571
+ return true;
1572
+ }
1573
+ }
1566
1574
 
1567
- for (var node in nodeList) {
1568
- if ({}.hasOwnProperty.call(nodeList, node)) {
1569
- if (!ootbNodeTypes.includes(nodeList[node].nodeType)) {
1570
- return true;
1571
- }
1575
+ return false;
1576
+ }
1577
+ /**
1578
+ * Get a journey's classifications, which can be one or multiple of:
1579
+ * - standard: can run on any instance of a ForgeRock platform
1580
+ * - cloud: utilize nodes, which are exclusively available in the ForgeRock Identity Cloud
1581
+ * - premium: utilizes nodes, which come at a premium
1582
+ * @param {SingleJourneyExportTemplate} journey journey export data
1583
+ * @returns {string[]} an array of one or multiple classifications
1584
+ */
1572
1585
 
1573
- if (containerNodes.includes(nodeList[node].nodeType)) {
1574
- results.push(yield (0, _NodeApi.getNode)(node, nodeList[node].nodeType));
1575
- }
1576
- }
1577
- }
1578
1586
 
1579
- var pageNodes = yield Promise.all(results);
1580
- var custom = false;
1587
+ function getJourneyClassification(journey) {
1588
+ var classifications = [];
1589
+ var premium = isPremiumJourney(journey);
1590
+ var custom = isCustomJourney(journey);
1591
+ var cloud = isCloudOnlyJourney(journey);
1581
1592
 
1582
- for (var pageNode of pageNodes) {
1583
- if (pageNode != null) {
1584
- for (var pnode of pageNode.nodes) {
1585
- if (!ootbNodeTypes.includes(pnode.nodeType)) {
1586
- custom = true;
1587
- }
1588
- }
1589
- } else {
1590
- (0, _Console.printMessage)("isCustom ERROR: can't get ".concat(nodeList[pageNode].nodeType, " with id ").concat(pageNode, " in ").concat(journey._id), 'error');
1591
- custom = false;
1592
- }
1593
- }
1593
+ if (custom) {
1594
+ classifications.push('custom');
1595
+ } else if (cloud) {
1596
+ classifications.push('cloud');
1597
+ } else {
1598
+ classifications.push('standard');
1599
+ }
1594
1600
 
1595
- return custom;
1596
- });
1597
- return _isCustom.apply(this, arguments);
1601
+ if (premium) classifications.push('premium');
1602
+ return classifications;
1598
1603
  }
1604
+ /**
1605
+ * List all the journeys/trees
1606
+ * @param {boolean} long Long version, all the fields
1607
+ * @param {boolean} analyze Analyze journeys/trees for custom nodes (expensive)
1608
+ * @returns {Promise<unknown[]>} a promise that resolves to an array journey objects
1609
+ */
1610
+
1599
1611
 
1600
1612
  function listJourneys() {
1601
1613
  return _listJourneys.apply(this, arguments);
@@ -1612,39 +1624,48 @@ function _listJourneys() {
1612
1624
  var long = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1613
1625
  var analyze = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1614
1626
  var journeys = [];
1627
+ journeys = yield getJourneys();
1615
1628
 
1616
- try {
1617
- journeys = (yield (0, _TreeApi.getTrees)()).result;
1618
- } catch (error) {
1619
- (0, _Console.printMessage)("".concat(error.message), 'error');
1620
- (0, _Console.printMessage)(error.response.data, 'error');
1621
- }
1629
+ if (!long && !analyze) {
1630
+ for (var journeyStub of journeys) {
1631
+ (0, _Console.printMessage)("".concat(journeyStub['_id']), 'data');
1632
+ }
1633
+ } else {
1634
+ if (!analyze) {
1635
+ var table = (0, _Console.createTable)(['Name', 'Status', 'Tags']);
1622
1636
 
1623
- journeys.sort((a, b) => a._id.localeCompare(b._id));
1624
- var customTrees = Array(journeys.length).fill(false);
1637
+ for (var _journeyStub of journeys) {
1638
+ var _journeyStub$uiConfig;
1639
+
1640
+ table.push(["".concat(_journeyStub._id), _journeyStub.enabled === false ? 'disabled'['brightRed'] : 'enabled'['brightGreen'], (_journeyStub$uiConfig = _journeyStub.uiConfig) !== null && _journeyStub$uiConfig !== void 0 && _journeyStub$uiConfig.categories ? (0, _Wordwrap.default)(JSON.parse(_journeyStub.uiConfig.categories).join(', '), 60) : '']);
1641
+ }
1625
1642
 
1626
- if (analyze) {
1627
- var results = [];
1643
+ (0, _Console.printMessage)(table.toString(), 'data');
1644
+ } else {
1645
+ (0, _Console.createProgressIndicator)(0, 'Retrieving details of all journeys...', 'indeterminate');
1646
+ var exportPromises = [];
1647
+
1648
+ for (var _journeyStub2 of journeys) {
1649
+ exportPromises.push(exportJourney(_journeyStub2['_id'], {
1650
+ useStringArrays: false,
1651
+ deps: false,
1652
+ verbose: false
1653
+ }));
1654
+ }
1628
1655
 
1629
- for (var journey of journeys) {
1630
- results.push(isCustom(journey));
1631
- }
1656
+ var journeyExports = yield Promise.all(exportPromises);
1657
+ (0, _Console.stopProgressIndicator)('Retrieved details of all journeys.', 'success');
1632
1658
 
1633
- customTrees = yield Promise.all(results);
1634
- }
1659
+ var _table = (0, _Console.createTable)(['Name', 'Status', 'Classification', 'Tags']);
1635
1660
 
1636
- if (!long) {
1637
- for (var [i, _journey] of journeys.entries()) {
1638
- (0, _Console.printMessage)("".concat(customTrees[i] ? '*' : '').concat(_journey._id), 'data');
1639
- }
1640
- } else {
1641
- var table = (0, _Console.createTable)(['Name'['brightCyan'], 'Status'['brightCyan'], 'Tags'['brightCyan']]);
1661
+ for (var journeyExport of journeyExports) {
1662
+ var _journeyExport$tree$u;
1642
1663
 
1643
- for (var [_i, _journey2] of journeys.entries()) {
1644
- table.push(["".concat(customTrees[_i] ? '*'['brightRed'] : '').concat(_journey2._id), _journey2.enabled === false ? 'disabled'['brightRed'] : 'enabled'['brightGreen'], _journey2.uiConfig && _journey2.uiConfig.categories ? (0, _Wordwrap.default)(JSON.parse(_journey2.uiConfig.categories).join(', '), 60) : '']);
1645
- }
1664
+ _table.push(["".concat(journeyExport.tree._id), journeyExport.tree.enabled === false ? 'disabled'['brightRed'] : 'enabled'['brightGreen'], getJourneyClassification(journeyExport).join(', '), (_journeyExport$tree$u = journeyExport.tree.uiConfig) !== null && _journeyExport$tree$u !== void 0 && _journeyExport$tree$u.categories ? (0, _Wordwrap.default)(JSON.parse(journeyExport.tree.uiConfig.categories).join(', '), 60) : '']);
1665
+ }
1646
1666
 
1647
- (0, _Console.printMessage)(table.toString(), 'data');
1667
+ (0, _Console.printMessage)(_table.toString(), 'data');
1668
+ }
1648
1669
  }
1649
1670
 
1650
1671
  return journeys;
@@ -1652,7 +1673,7 @@ function _listJourneys() {
1652
1673
  return _listJourneys.apply(this, arguments);
1653
1674
  }
1654
1675
 
1655
- function deleteJourney(_x29, _x30) {
1676
+ function deleteJourney(_x28, _x29) {
1656
1677
  return _deleteJourney.apply(this, arguments);
1657
1678
  }
1658
1679
  /**
@@ -1781,7 +1802,7 @@ function _deleteJourney() {
1781
1802
  return status;
1782
1803
  });
1783
1804
 
1784
- return function (_x36) {
1805
+ return function (_x35) {
1785
1806
  return _ref3.apply(this, arguments);
1786
1807
  };
1787
1808
  }()).catch(error => {
@@ -1795,7 +1816,7 @@ function _deleteJourney() {
1795
1816
  return _deleteJourney.apply(this, arguments);
1796
1817
  }
1797
1818
 
1798
- function deleteJourneys(_x31) {
1819
+ function deleteJourneys(_x30) {
1799
1820
  return _deleteJourneys.apply(this, arguments);
1800
1821
  }
1801
1822