@rockcarver/frodo-lib 0.16.0 → 0.16.2-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.
- package/CHANGELOG.md +12 -2
- package/cjs/ops/JourneyOps.js +43 -436
- package/cjs/ops/JourneyOps.js.map +1 -1
- package/cjs/ops/LogOps.js +5 -1
- package/cjs/ops/LogOps.js.map +1 -1
- package/cjs/ops/OpsTypes.js.map +1 -1
- package/cjs/storage/SessionStorage.js +2 -0
- package/cjs/storage/SessionStorage.js.map +1 -1
- package/esm/ops/JourneyOps.mjs +12 -321
- package/esm/ops/LogOps.mjs +5 -1
- package/esm/storage/SessionStorage.mjs +2 -0
- package/package.json +1 -1
- package/types/ops/JourneyOps.d.ts +14 -47
- package/types/ops/JourneyOps.d.ts.map +1 -1
- package/types/ops/LogOps.d.ts.map +1 -1
- package/types/ops/OpsTypes.d.ts +0 -8
- package/types/ops/OpsTypes.d.ts.map +1 -1
- package/types/storage/SessionStorage.d.ts +2 -0
- package/types/storage/SessionStorage.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,7 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
## [0.16.0] - 2022-10-
|
|
10
|
+
## [0.16.2-0] - 2022-10-22
|
|
11
|
+
|
|
12
|
+
## [0.16.1] - 2022-10-19
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- rockcarver/frodo-cli#95: Error tailing logs with txId
|
|
11
17
|
|
|
12
18
|
## [0.16.1] - 2022-10-18
|
|
13
19
|
|
|
@@ -667,7 +673,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
667
673
|
- Fixed problem with adding connection profiles
|
|
668
674
|
- Miscellaneous bug fixes
|
|
669
675
|
|
|
670
|
-
[Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.16.0...HEAD
|
|
676
|
+
[Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.16.2-0...HEAD
|
|
677
|
+
|
|
678
|
+
[0.16.2-0]: https://github.com/rockcarver/frodo-lib/compare/v0.16.1...v0.16.2-0
|
|
679
|
+
|
|
680
|
+
[0.16.1]: https://github.com/rockcarver/frodo-lib/compare/v0.16.0...v0.16.1
|
|
671
681
|
|
|
672
682
|
[0.16.0]: https://github.com/rockcarver/frodo-lib/compare/v0.15.3-0...v0.16.0
|
|
673
683
|
|
package/cjs/ops/JourneyOps.js
CHANGED
|
@@ -11,26 +11,20 @@ exports.deleteJourneys = deleteJourneys;
|
|
|
11
11
|
exports.disableJourney = disableJourney;
|
|
12
12
|
exports.enableJourney = enableJourney;
|
|
13
13
|
exports.exportJourney = exportJourney;
|
|
14
|
-
exports.exportJourneyToFile = exportJourneyToFile;
|
|
15
|
-
exports.exportJourneysToFile = exportJourneysToFile;
|
|
16
|
-
exports.exportJourneysToFiles = exportJourneysToFiles;
|
|
17
14
|
exports.fileByIdTreeExportResolver = void 0;
|
|
18
15
|
exports.findOrphanedNodes = findOrphanedNodes;
|
|
19
16
|
exports.getJourneyClassification = getJourneyClassification;
|
|
20
17
|
exports.getJourneys = getJourneys;
|
|
21
18
|
exports.getNodeRef = getNodeRef;
|
|
22
19
|
exports.getTreeDescendents = getTreeDescendents;
|
|
23
|
-
exports.
|
|
20
|
+
exports.importAllJourneys = importAllJourneys;
|
|
24
21
|
exports.importJourney = importJourney;
|
|
25
|
-
exports.importJourneyFromFile = importJourneyFromFile;
|
|
26
|
-
exports.importJourneysFromFile = importJourneysFromFile;
|
|
27
|
-
exports.importJourneysFromFiles = importJourneysFromFiles;
|
|
28
22
|
exports.isCloudOnlyJourney = isCloudOnlyJourney;
|
|
29
23
|
exports.isCustomJourney = isCustomJourney;
|
|
30
24
|
exports.isPremiumJourney = isPremiumJourney;
|
|
31
|
-
exports.listJourneys = listJourneys;
|
|
32
25
|
exports.onlineTreeExportResolver = void 0;
|
|
33
26
|
exports.removeOrphanedNodes = removeOrphanedNodes;
|
|
27
|
+
exports.resolveDependencies = resolveDependencies;
|
|
34
28
|
|
|
35
29
|
var _fs = _interopRequireDefault(require("fs"));
|
|
36
30
|
|
|
@@ -58,8 +52,6 @@ var global = _interopRequireWildcard(require("../storage/StaticStorage"));
|
|
|
58
52
|
|
|
59
53
|
var _Console = require("./utils/Console");
|
|
60
54
|
|
|
61
|
-
var _Wordwrap = _interopRequireDefault(require("./utils/Wordwrap"));
|
|
62
|
-
|
|
63
55
|
var _Saml2Api = require("../api/Saml2Api");
|
|
64
56
|
|
|
65
57
|
var _CirclesOfTrustApi = require("../api/CirclesOfTrustApi");
|
|
@@ -223,7 +215,7 @@ function exportJourney(_x4) {
|
|
|
223
215
|
}
|
|
224
216
|
/**
|
|
225
217
|
* Get all the journeys/trees without all their nodes and dependencies.
|
|
226
|
-
* @returns {Promise<
|
|
218
|
+
* @returns {Promise<TreeSkeleton[]>} a promise that resolves to an array of journey objects
|
|
227
219
|
*/
|
|
228
220
|
|
|
229
221
|
|
|
@@ -231,8 +223,7 @@ function _exportJourney() {
|
|
|
231
223
|
_exportJourney = _asyncToGenerator(function* (treeId) {
|
|
232
224
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
233
225
|
useStringArrays: true,
|
|
234
|
-
deps: true
|
|
235
|
-
verbose: false
|
|
226
|
+
deps: true
|
|
236
227
|
};
|
|
237
228
|
var exportData = createSingleTreeExportTemplate();
|
|
238
229
|
|
|
@@ -240,9 +231,11 @@ function _exportJourney() {
|
|
|
240
231
|
var treeObject = yield (0, _TreeApi.getTree)(treeId);
|
|
241
232
|
var {
|
|
242
233
|
useStringArrays,
|
|
243
|
-
deps
|
|
244
|
-
verbose
|
|
234
|
+
deps
|
|
245
235
|
} = options;
|
|
236
|
+
|
|
237
|
+
var verbose = _SessionStorage.default.session.getDebug();
|
|
238
|
+
|
|
246
239
|
if (verbose) (0, _Console.printMessage)("\n- ".concat(treeObject._id, "\n"), 'info', false); // Process tree
|
|
247
240
|
|
|
248
241
|
if (verbose) (0, _Console.printMessage)(' - Flow');
|
|
@@ -532,10 +525,9 @@ function getJourneys() {
|
|
|
532
525
|
return _getJourneys.apply(this, arguments);
|
|
533
526
|
}
|
|
534
527
|
/**
|
|
535
|
-
*
|
|
536
|
-
* @param {
|
|
537
|
-
* @param {
|
|
538
|
-
* @param {TreeExportOptions} options export options
|
|
528
|
+
* Helper to import a tree with all dependencies from a `SingleTreeExportInterface` object (typically read from a file)
|
|
529
|
+
* @param {SingleTreeExportInterface} treeObject tree object containing tree and all its dependencies
|
|
530
|
+
* @param {TreeImportOptions} options import options
|
|
539
531
|
*/
|
|
540
532
|
|
|
541
533
|
|
|
@@ -556,118 +548,7 @@ function _getJourneys() {
|
|
|
556
548
|
return _getJourneys.apply(this, arguments);
|
|
557
549
|
}
|
|
558
550
|
|
|
559
|
-
function
|
|
560
|
-
return _exportJourneyToFile.apply(this, arguments);
|
|
561
|
-
}
|
|
562
|
-
/**
|
|
563
|
-
* Export all journeys to file
|
|
564
|
-
* @param {string} file optional export file name
|
|
565
|
-
* @param {TreeExportOptions} options export options
|
|
566
|
-
*/
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
function _exportJourneyToFile() {
|
|
570
|
-
_exportJourneyToFile = _asyncToGenerator(function* (journeyId, file, options) {
|
|
571
|
-
var {
|
|
572
|
-
verbose
|
|
573
|
-
} = options;
|
|
574
|
-
var fileName = file;
|
|
575
|
-
|
|
576
|
-
if (!fileName) {
|
|
577
|
-
fileName = (0, _ExportImportUtils.getTypedFilename)(journeyId, 'journey');
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
if (!verbose) (0, _Console.createProgressIndicator)(undefined, "".concat(journeyId), 'indeterminate');
|
|
581
|
-
|
|
582
|
-
try {
|
|
583
|
-
var fileData = yield exportJourney(journeyId, options);
|
|
584
|
-
if (verbose) (0, _Console.createProgressIndicator)(undefined, "".concat(journeyId), 'indeterminate');
|
|
585
|
-
(0, _ExportImportUtils.saveJsonToFile)(fileData, fileName);
|
|
586
|
-
(0, _Console.stopProgressIndicator)("Exported ".concat(journeyId['brightCyan'], " to ").concat(fileName['brightCyan'], "."), 'success');
|
|
587
|
-
} catch (error) {
|
|
588
|
-
if (verbose) (0, _Console.createProgressIndicator)(undefined, "".concat(journeyId), 'indeterminate');
|
|
589
|
-
(0, _Console.stopProgressIndicator)("Error exporting journey ".concat(journeyId, ": ").concat(error), 'fail');
|
|
590
|
-
}
|
|
591
|
-
});
|
|
592
|
-
return _exportJourneyToFile.apply(this, arguments);
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
function exportJourneysToFile(_x8) {
|
|
596
|
-
return _exportJourneysToFile.apply(this, arguments);
|
|
597
|
-
}
|
|
598
|
-
/**
|
|
599
|
-
* Export all journeys to separate files
|
|
600
|
-
* @param {TreeExportOptions} options export options
|
|
601
|
-
*/
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
function _exportJourneysToFile() {
|
|
605
|
-
_exportJourneysToFile = _asyncToGenerator(function* (file) {
|
|
606
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
607
|
-
deps: false,
|
|
608
|
-
useStringArrays: false,
|
|
609
|
-
verbose: false
|
|
610
|
-
};
|
|
611
|
-
var fileName = file;
|
|
612
|
-
|
|
613
|
-
if (!fileName) {
|
|
614
|
-
fileName = (0, _ExportImportUtils.getTypedFilename)("all".concat((0, _ExportImportUtils.getRealmString)(), "Journeys"), 'journeys');
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
var trees = (yield (0, _TreeApi.getTrees)()).result;
|
|
618
|
-
var fileData = createMultiTreeExportTemplate();
|
|
619
|
-
(0, _Console.createProgressIndicator)(trees.length, 'Exporting journeys...');
|
|
620
|
-
|
|
621
|
-
for (var tree of trees) {
|
|
622
|
-
(0, _Console.updateProgressIndicator)("".concat(tree._id));
|
|
623
|
-
|
|
624
|
-
try {
|
|
625
|
-
var exportData = yield exportJourney(tree._id, options);
|
|
626
|
-
delete exportData.meta;
|
|
627
|
-
fileData.trees[tree._id] = exportData;
|
|
628
|
-
} catch (error) {
|
|
629
|
-
(0, _Console.printMessage)("Error exporting journey ".concat(tree._id, ": ").concat(error), 'error');
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
(0, _ExportImportUtils.saveJsonToFile)(fileData, fileName);
|
|
634
|
-
(0, _Console.stopProgressIndicator)("Exported to ".concat(fileName));
|
|
635
|
-
});
|
|
636
|
-
return _exportJourneysToFile.apply(this, arguments);
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
function exportJourneysToFiles(_x9) {
|
|
640
|
-
return _exportJourneysToFiles.apply(this, arguments);
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Helper to import a tree with all dependencies from an import data object (typically read from a file)
|
|
644
|
-
* @param {SingleTreeExportInterface} treeObject tree object containing tree and all its dependencies
|
|
645
|
-
* @param {TreeImportOptions} options import options
|
|
646
|
-
*/
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
function _exportJourneysToFiles() {
|
|
650
|
-
_exportJourneysToFiles = _asyncToGenerator(function* (options) {
|
|
651
|
-
var trees = (yield (0, _TreeApi.getTrees)()).result;
|
|
652
|
-
(0, _Console.createProgressIndicator)(trees.length, 'Exporting journeys...');
|
|
653
|
-
|
|
654
|
-
for (var tree of trees) {
|
|
655
|
-
(0, _Console.updateProgressIndicator)("".concat(tree._id));
|
|
656
|
-
var fileName = (0, _ExportImportUtils.getTypedFilename)("".concat(tree._id), 'journey');
|
|
657
|
-
|
|
658
|
-
try {
|
|
659
|
-
var exportData = yield exportJourney(tree._id, options);
|
|
660
|
-
(0, _ExportImportUtils.saveJsonToFile)(exportData, fileName);
|
|
661
|
-
} catch (error) {// do we need to report status here?
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
(0, _Console.stopProgressIndicator)('Done');
|
|
666
|
-
});
|
|
667
|
-
return _exportJourneysToFiles.apply(this, arguments);
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
function importJourney(_x10, _x11) {
|
|
551
|
+
function importJourney(_x5, _x6) {
|
|
671
552
|
return _importJourney.apply(this, arguments);
|
|
672
553
|
}
|
|
673
554
|
/**
|
|
@@ -684,9 +565,11 @@ function _importJourney() {
|
|
|
684
565
|
_importJourney = _asyncToGenerator(function* (treeObject, options) {
|
|
685
566
|
var {
|
|
686
567
|
reUuid,
|
|
687
|
-
deps
|
|
688
|
-
verbose
|
|
568
|
+
deps
|
|
689
569
|
} = options;
|
|
570
|
+
|
|
571
|
+
var verbose = _SessionStorage.default.session.getDebug();
|
|
572
|
+
|
|
690
573
|
if (verbose) (0, _Console.printMessage)("\n- ".concat(treeObject.tree._id, "\n"), 'info', false);
|
|
691
574
|
var newUuid = '';
|
|
692
575
|
var uuidMap = {};
|
|
@@ -1061,13 +944,12 @@ function _importJourney() {
|
|
|
1061
944
|
return _importJourney.apply(this, arguments);
|
|
1062
945
|
}
|
|
1063
946
|
|
|
1064
|
-
function resolveDependencies(
|
|
947
|
+
function resolveDependencies(_x7, _x8, _x9, _x10) {
|
|
1065
948
|
return _resolveDependencies.apply(this, arguments);
|
|
1066
949
|
}
|
|
1067
950
|
/**
|
|
1068
|
-
*
|
|
1069
|
-
* @param {
|
|
1070
|
-
* @param {string} file import file name
|
|
951
|
+
* Helper to import multiple trees from a tree map
|
|
952
|
+
* @param {Object} treesMap map of trees object
|
|
1071
953
|
* @param {TreeImportOptions} options import options
|
|
1072
954
|
*/
|
|
1073
955
|
|
|
@@ -1131,163 +1013,20 @@ function _resolveDependencies() {
|
|
|
1131
1013
|
return _resolveDependencies.apply(this, arguments);
|
|
1132
1014
|
}
|
|
1133
1015
|
|
|
1134
|
-
function
|
|
1135
|
-
return _importJourneyFromFile.apply(this, arguments);
|
|
1136
|
-
}
|
|
1137
|
-
/**
|
|
1138
|
-
* Import first journey from file
|
|
1139
|
-
* @param {string} file import file name
|
|
1140
|
-
* @param {TreeImportOptions} options import options
|
|
1141
|
-
*/
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
function _importJourneyFromFile() {
|
|
1145
|
-
_importJourneyFromFile = _asyncToGenerator(function* (journeyId, file, options) {
|
|
1146
|
-
var {
|
|
1147
|
-
verbose
|
|
1148
|
-
} = options;
|
|
1149
|
-
|
|
1150
|
-
_fs.default.readFile(file, 'utf8', /*#__PURE__*/function () {
|
|
1151
|
-
var _ref4 = _asyncToGenerator(function* (err, data) {
|
|
1152
|
-
if (err) throw err;
|
|
1153
|
-
var journeyData = JSON.parse(data); // check if this is a file with multiple trees and get journey by id
|
|
1154
|
-
|
|
1155
|
-
if (journeyData.trees && journeyData.trees[journeyId]) {
|
|
1156
|
-
journeyData = journeyData.trees[journeyId];
|
|
1157
|
-
} else if (journeyData.trees) {
|
|
1158
|
-
journeyData = null;
|
|
1159
|
-
} // if a journeyId was specified, only import the matching journey
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
if (journeyData && journeyId === journeyData.tree._id) {
|
|
1163
|
-
// attempt dependency resolution for single tree import
|
|
1164
|
-
var installedJourneys = (yield (0, _TreeApi.getTrees)()).result.map(x => x._id);
|
|
1165
|
-
var unresolvedJourneys = {};
|
|
1166
|
-
var resolvedJourneys = [];
|
|
1167
|
-
(0, _Console.createProgressIndicator)(undefined, 'Resolving dependencies', 'indeterminate');
|
|
1168
|
-
yield resolveDependencies(installedJourneys, {
|
|
1169
|
-
[journeyId]: journeyData
|
|
1170
|
-
}, unresolvedJourneys, resolvedJourneys);
|
|
1171
|
-
|
|
1172
|
-
if (Object.keys(unresolvedJourneys).length === 0) {
|
|
1173
|
-
(0, _Console.stopProgressIndicator)("Resolved all dependencies.", 'success');
|
|
1174
|
-
if (!verbose) (0, _Console.createProgressIndicator)(undefined, "Importing ".concat(journeyId, "..."), 'indeterminate');
|
|
1175
|
-
importJourney(journeyData, options).then(() => {
|
|
1176
|
-
if (verbose) (0, _Console.createProgressIndicator)(undefined, "Importing ".concat(journeyId, "..."), 'indeterminate');
|
|
1177
|
-
(0, _Console.stopProgressIndicator)("Imported ".concat(journeyId, "."), 'success');
|
|
1178
|
-
}).catch(importError => {
|
|
1179
|
-
if (verbose) (0, _Console.createProgressIndicator)(undefined, "Importing ".concat(journeyId, "..."), 'indeterminate');
|
|
1180
|
-
(0, _Console.stopProgressIndicator)("".concat(importError), 'fail');
|
|
1181
|
-
});
|
|
1182
|
-
} else {
|
|
1183
|
-
(0, _Console.stopProgressIndicator)("Unresolved dependencies:", 'fail');
|
|
1184
|
-
|
|
1185
|
-
for (var journey of Object.keys(unresolvedJourneys)) {
|
|
1186
|
-
(0, _Console.printMessage)(" ".concat(journey, " requires ").concat(unresolvedJourneys[journey]), 'error');
|
|
1187
|
-
}
|
|
1188
|
-
} // end dependency resolution for single tree import
|
|
1189
|
-
|
|
1190
|
-
} else {
|
|
1191
|
-
(0, _Console.createProgressIndicator)(undefined, "Importing ".concat(journeyId, "..."), 'indeterminate');
|
|
1192
|
-
(0, _Console.stopProgressIndicator)("".concat(journeyId, " not found!"), 'fail');
|
|
1193
|
-
}
|
|
1194
|
-
});
|
|
1195
|
-
|
|
1196
|
-
return function (_x36, _x37) {
|
|
1197
|
-
return _ref4.apply(this, arguments);
|
|
1198
|
-
};
|
|
1199
|
-
}());
|
|
1200
|
-
});
|
|
1201
|
-
return _importJourneyFromFile.apply(this, arguments);
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
function importFirstJourneyFromFile(_x19, _x20) {
|
|
1205
|
-
return _importFirstJourneyFromFile.apply(this, arguments);
|
|
1206
|
-
}
|
|
1207
|
-
/**
|
|
1208
|
-
* Helper to import multiple trees from a tree map
|
|
1209
|
-
* @param {Object} treesMap map of trees object
|
|
1210
|
-
* @param {TreeImportOptions} options import options
|
|
1211
|
-
*/
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
function _importFirstJourneyFromFile() {
|
|
1215
|
-
_importFirstJourneyFromFile = _asyncToGenerator(function* (file, options) {
|
|
1216
|
-
var {
|
|
1217
|
-
verbose
|
|
1218
|
-
} = options;
|
|
1219
|
-
|
|
1220
|
-
_fs.default.readFile(file, 'utf8', /*#__PURE__*/function () {
|
|
1221
|
-
var _ref5 = _asyncToGenerator(function* (err, data) {
|
|
1222
|
-
if (err) throw err;
|
|
1223
|
-
|
|
1224
|
-
var journeyData = _lodash.default.cloneDeep(JSON.parse(data));
|
|
1225
|
-
|
|
1226
|
-
var journeyId = null; // single tree
|
|
1227
|
-
|
|
1228
|
-
if (journeyData.tree) {
|
|
1229
|
-
journeyId = _lodash.default.cloneDeep(journeyData.tree._id);
|
|
1230
|
-
} // multiple trees, so get the first tree
|
|
1231
|
-
else if (journeyData.trees) {
|
|
1232
|
-
for (var treeId in journeyData.trees) {
|
|
1233
|
-
if (Object.hasOwnProperty.call(journeyData.trees, treeId)) {
|
|
1234
|
-
journeyId = treeId;
|
|
1235
|
-
journeyData = journeyData.trees[treeId];
|
|
1236
|
-
break;
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
} // if a journeyId was specified, only import the matching journey
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
if (journeyData && journeyId) {
|
|
1243
|
-
// attempt dependency resolution for single tree import
|
|
1244
|
-
var installedJourneys = (yield (0, _TreeApi.getTrees)()).result.map(x => x._id);
|
|
1245
|
-
var unresolvedJourneys = {};
|
|
1246
|
-
var resolvedJourneys = [];
|
|
1247
|
-
(0, _Console.createProgressIndicator)(undefined, 'Resolving dependencies', 'indeterminate');
|
|
1248
|
-
yield resolveDependencies(installedJourneys, {
|
|
1249
|
-
[journeyId]: journeyData
|
|
1250
|
-
}, unresolvedJourneys, resolvedJourneys);
|
|
1251
|
-
|
|
1252
|
-
if (Object.keys(unresolvedJourneys).length === 0) {
|
|
1253
|
-
(0, _Console.stopProgressIndicator)("Resolved all dependencies.", 'success');
|
|
1254
|
-
if (!verbose) (0, _Console.createProgressIndicator)(undefined, "Importing ".concat(journeyId, "..."), 'indeterminate');
|
|
1255
|
-
importJourney(journeyData, options).then(() => {
|
|
1256
|
-
if (verbose) (0, _Console.createProgressIndicator)(undefined, "Importing ".concat(journeyId, "..."), 'indeterminate');
|
|
1257
|
-
(0, _Console.stopProgressIndicator)("Imported ".concat(journeyId, "."), 'success');
|
|
1258
|
-
}).catch(importError => {
|
|
1259
|
-
if (verbose) (0, _Console.createProgressIndicator)(undefined, "Importing ".concat(journeyId, "..."), 'indeterminate');
|
|
1260
|
-
(0, _Console.stopProgressIndicator)("".concat(importError), 'fail');
|
|
1261
|
-
});
|
|
1262
|
-
} else {
|
|
1263
|
-
(0, _Console.stopProgressIndicator)("Unresolved dependencies:", 'fail');
|
|
1264
|
-
|
|
1265
|
-
for (var journey of Object.keys(unresolvedJourneys)) {
|
|
1266
|
-
(0, _Console.printMessage)(" ".concat(journey, " requires ").concat(unresolvedJourneys[journey]), 'error');
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
} else {
|
|
1270
|
-
(0, _Console.createProgressIndicator)(undefined, "Importing...", 'indeterminate');
|
|
1271
|
-
(0, _Console.stopProgressIndicator)("No journeys found!", 'fail');
|
|
1272
|
-
} // end dependency resolution for single tree import
|
|
1273
|
-
|
|
1274
|
-
});
|
|
1275
|
-
|
|
1276
|
-
return function (_x38, _x39) {
|
|
1277
|
-
return _ref5.apply(this, arguments);
|
|
1278
|
-
};
|
|
1279
|
-
}());
|
|
1280
|
-
});
|
|
1281
|
-
return _importFirstJourneyFromFile.apply(this, arguments);
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
function importAllJourneys(_x21, _x22) {
|
|
1016
|
+
function importAllJourneys(_x11, _x12) {
|
|
1285
1017
|
return _importAllJourneys.apply(this, arguments);
|
|
1286
1018
|
}
|
|
1287
1019
|
/**
|
|
1288
|
-
*
|
|
1289
|
-
*
|
|
1290
|
-
*
|
|
1020
|
+
* Get the node reference obbject for a node object. Node reference objects
|
|
1021
|
+
* are used in a tree flow definition and within page nodes to reference
|
|
1022
|
+
* nodes. Among other things, node references contain all the non-configuration
|
|
1023
|
+
* meta data that exists for readaility, like the x/y coordinates of the node
|
|
1024
|
+
* and the display name chosen by the tree designer. The dislay name is the
|
|
1025
|
+
* only intuitive link between the graphical representation of the tree and
|
|
1026
|
+
* the node configurations that make up the tree.
|
|
1027
|
+
* @param nodeObj node object to retrieve the node reference object for
|
|
1028
|
+
* @param singleTreeExport tree export with or without dependencies
|
|
1029
|
+
* @returns {NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface} node reference object
|
|
1291
1030
|
*/
|
|
1292
1031
|
|
|
1293
1032
|
|
|
@@ -1326,62 +1065,6 @@ function _importAllJourneys() {
|
|
|
1326
1065
|
return _importAllJourneys.apply(this, arguments);
|
|
1327
1066
|
}
|
|
1328
1067
|
|
|
1329
|
-
function importJourneysFromFile(_x23, _x24) {
|
|
1330
|
-
return _importJourneysFromFile.apply(this, arguments);
|
|
1331
|
-
}
|
|
1332
|
-
/**
|
|
1333
|
-
* Import all journeys from separate files
|
|
1334
|
-
* @param {TreeImportOptions} options import options
|
|
1335
|
-
*/
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
function _importJourneysFromFile() {
|
|
1339
|
-
_importJourneysFromFile = _asyncToGenerator(function* (file, options) {
|
|
1340
|
-
_fs.default.readFile(file, 'utf8', (err, data) => {
|
|
1341
|
-
if (err) throw err;
|
|
1342
|
-
var fileData = JSON.parse(data);
|
|
1343
|
-
importAllJourneys(fileData.trees, options);
|
|
1344
|
-
});
|
|
1345
|
-
});
|
|
1346
|
-
return _importJourneysFromFile.apply(this, arguments);
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
function importJourneysFromFiles(_x25) {
|
|
1350
|
-
return _importJourneysFromFiles.apply(this, arguments);
|
|
1351
|
-
}
|
|
1352
|
-
/**
|
|
1353
|
-
* Get the node reference obbject for a node object. Node reference objects
|
|
1354
|
-
* are used in a tree flow definition and within page nodes to reference
|
|
1355
|
-
* nodes. Among other things, node references contain all the non-configuration
|
|
1356
|
-
* meta data that exists for readaility, like the x/y coordinates of the node
|
|
1357
|
-
* and the display name chosen by the tree designer. The dislay name is the
|
|
1358
|
-
* only intuitive link between the graphical representation of the tree and
|
|
1359
|
-
* the node configurations that make up the tree.
|
|
1360
|
-
* @param nodeObj node object to retrieve the node reference object for
|
|
1361
|
-
* @param singleTreeExport tree export with or without dependencies
|
|
1362
|
-
* @returns {NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface} node reference object
|
|
1363
|
-
*/
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
function _importJourneysFromFiles() {
|
|
1367
|
-
_importJourneysFromFiles = _asyncToGenerator(function* (options) {
|
|
1368
|
-
var names = _fs.default.readdirSync('.');
|
|
1369
|
-
|
|
1370
|
-
var jsonFiles = names.filter(name => name.toLowerCase().endsWith('.journey.json'));
|
|
1371
|
-
var allJourneysData = {
|
|
1372
|
-
trees: {}
|
|
1373
|
-
};
|
|
1374
|
-
|
|
1375
|
-
for (var file of jsonFiles) {
|
|
1376
|
-
var journeyData = JSON.parse(_fs.default.readFileSync(file, 'utf8'));
|
|
1377
|
-
allJourneysData.trees[journeyData.tree._id] = journeyData;
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
importAllJourneys(allJourneysData.trees, options);
|
|
1381
|
-
});
|
|
1382
|
-
return _importJourneysFromFiles.apply(this, arguments);
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
1068
|
function getNodeRef(nodeObj, singleTreeExport) {
|
|
1386
1069
|
if (singleTreeExport.tree.nodes[nodeObj._id]) {
|
|
1387
1070
|
return singleTreeExport.tree.nodes[nodeObj._id];
|
|
@@ -1412,12 +1095,11 @@ var onlineTreeExportResolver = /*#__PURE__*/function () {
|
|
|
1412
1095
|
(0, _Console.debug)("onlineTreeExportResolver(".concat(treeId, ")"));
|
|
1413
1096
|
return yield exportJourney(treeId, {
|
|
1414
1097
|
deps: false,
|
|
1415
|
-
useStringArrays: false
|
|
1416
|
-
verbose: false
|
|
1098
|
+
useStringArrays: false
|
|
1417
1099
|
});
|
|
1418
1100
|
});
|
|
1419
1101
|
|
|
1420
|
-
return function onlineTreeExportResolver(
|
|
1102
|
+
return function onlineTreeExportResolver(_x13) {
|
|
1421
1103
|
return _ref.apply(this, arguments);
|
|
1422
1104
|
};
|
|
1423
1105
|
}();
|
|
@@ -1457,7 +1139,7 @@ var fileByIdTreeExportResolver = /*#__PURE__*/function () {
|
|
|
1457
1139
|
return treeExport;
|
|
1458
1140
|
});
|
|
1459
1141
|
|
|
1460
|
-
return function fileByIdTreeExportResolver(
|
|
1142
|
+
return function fileByIdTreeExportResolver(_x14) {
|
|
1461
1143
|
return _ref2.apply(this, arguments);
|
|
1462
1144
|
};
|
|
1463
1145
|
}();
|
|
@@ -1497,7 +1179,7 @@ function createFileParamTreeExportResolver(file) {
|
|
|
1497
1179
|
return treeExport;
|
|
1498
1180
|
});
|
|
1499
1181
|
|
|
1500
|
-
return function fileParamTreeExportResolver(
|
|
1182
|
+
return function fileParamTreeExportResolver(_x15) {
|
|
1501
1183
|
return _ref3.apply(this, arguments);
|
|
1502
1184
|
};
|
|
1503
1185
|
}();
|
|
@@ -1514,7 +1196,7 @@ function createFileParamTreeExportResolver(file) {
|
|
|
1514
1196
|
*/
|
|
1515
1197
|
|
|
1516
1198
|
|
|
1517
|
-
function getTreeDescendents(
|
|
1199
|
+
function getTreeDescendents(_x16) {
|
|
1518
1200
|
return _getTreeDescendents.apply(this, arguments);
|
|
1519
1201
|
}
|
|
1520
1202
|
/**
|
|
@@ -1641,7 +1323,7 @@ function _findOrphanedNodes() {
|
|
|
1641
1323
|
return _findOrphanedNodes.apply(this, arguments);
|
|
1642
1324
|
}
|
|
1643
1325
|
|
|
1644
|
-
function removeOrphanedNodes(
|
|
1326
|
+
function removeOrphanedNodes(_x17) {
|
|
1645
1327
|
return _removeOrphanedNodes.apply(this, arguments);
|
|
1646
1328
|
}
|
|
1647
1329
|
/**
|
|
@@ -1749,17 +1431,6 @@ function getJourneyClassification(journey) {
|
|
|
1749
1431
|
if (premium) classifications.push(_OpsTypes.JourneyClassification.PREMIUM);
|
|
1750
1432
|
return classifications;
|
|
1751
1433
|
}
|
|
1752
|
-
/**
|
|
1753
|
-
* List all the journeys/trees
|
|
1754
|
-
* @param {boolean} long Long version, all the fields
|
|
1755
|
-
* @param {boolean} analyze Analyze journeys/trees for custom nodes (expensive)
|
|
1756
|
-
* @returns {Promise<unknown[]>} a promise that resolves to an array journey objects
|
|
1757
|
-
*/
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
function listJourneys() {
|
|
1761
|
-
return _listJourneys.apply(this, arguments);
|
|
1762
|
-
}
|
|
1763
1434
|
/**
|
|
1764
1435
|
* Delete a journey
|
|
1765
1436
|
* @param {string} journeyId journey id/name
|
|
@@ -1767,71 +1438,7 @@ function listJourneys() {
|
|
|
1767
1438
|
*/
|
|
1768
1439
|
|
|
1769
1440
|
|
|
1770
|
-
function
|
|
1771
|
-
_listJourneys = _asyncToGenerator(function* () {
|
|
1772
|
-
var long = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1773
|
-
var analyze = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1774
|
-
var journeys = [];
|
|
1775
|
-
|
|
1776
|
-
try {
|
|
1777
|
-
journeys = yield getJourneys();
|
|
1778
|
-
|
|
1779
|
-
if (!long && !analyze) {
|
|
1780
|
-
for (var journeyStub of journeys) {
|
|
1781
|
-
(0, _Console.printMessage)("".concat(journeyStub['_id']), 'data');
|
|
1782
|
-
}
|
|
1783
|
-
} else {
|
|
1784
|
-
if (!analyze) {
|
|
1785
|
-
var table = (0, _Console.createTable)(['Name', 'Status', 'Tags']);
|
|
1786
|
-
|
|
1787
|
-
for (var _journeyStub of journeys) {
|
|
1788
|
-
var _journeyStub$uiConfig;
|
|
1789
|
-
|
|
1790
|
-
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) : '']);
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
(0, _Console.printMessage)(table.toString(), 'data');
|
|
1794
|
-
} else {
|
|
1795
|
-
(0, _Console.createProgressIndicator)(0, 'Retrieving details of all journeys...', 'indeterminate');
|
|
1796
|
-
var exportPromises = [];
|
|
1797
|
-
|
|
1798
|
-
try {
|
|
1799
|
-
for (var _journeyStub2 of journeys) {
|
|
1800
|
-
exportPromises.push(exportJourney(_journeyStub2['_id'], {
|
|
1801
|
-
useStringArrays: false,
|
|
1802
|
-
deps: false,
|
|
1803
|
-
verbose: false
|
|
1804
|
-
}));
|
|
1805
|
-
}
|
|
1806
|
-
|
|
1807
|
-
var journeyExports = yield Promise.all(exportPromises);
|
|
1808
|
-
(0, _Console.stopProgressIndicator)('Retrieved details of all journeys.', 'success');
|
|
1809
|
-
|
|
1810
|
-
var _table = (0, _Console.createTable)(['Name', 'Status', 'Classification', 'Tags']);
|
|
1811
|
-
|
|
1812
|
-
for (var journeyExport of journeyExports) {
|
|
1813
|
-
var _journeyExport$tree$u;
|
|
1814
|
-
|
|
1815
|
-
_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) : '']);
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
(0, _Console.printMessage)(_table.toString(), 'data');
|
|
1819
|
-
} catch (error) {
|
|
1820
|
-
(0, _Console.stopProgressIndicator)('Error retrieving details of all journeys.', 'fail');
|
|
1821
|
-
(0, _Console.printMessage)(error.response.data, 'error');
|
|
1822
|
-
}
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
} catch (error) {
|
|
1826
|
-
(0, _Console.printMessage)(error.response.data, 'error');
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1829
|
-
return journeys;
|
|
1830
|
-
});
|
|
1831
|
-
return _listJourneys.apply(this, arguments);
|
|
1832
|
-
}
|
|
1833
|
-
|
|
1834
|
-
function deleteJourney(_x31, _x32) {
|
|
1441
|
+
function deleteJourney(_x18, _x19) {
|
|
1835
1442
|
return _deleteJourney.apply(this, arguments);
|
|
1836
1443
|
}
|
|
1837
1444
|
/**
|
|
@@ -1855,7 +1462,7 @@ function _deleteJourney() {
|
|
|
1855
1462
|
if (progress) (0, _Console.createProgressIndicator)(undefined, "Deleting ".concat(journeyId, "..."), 'indeterminate');
|
|
1856
1463
|
if (progress && verbose) (0, _Console.stopProgressIndicator)();
|
|
1857
1464
|
return (0, _TreeApi.deleteTree)(journeyId).then( /*#__PURE__*/function () {
|
|
1858
|
-
var
|
|
1465
|
+
var _ref4 = _asyncToGenerator(function* (deleteTreeResponse) {
|
|
1859
1466
|
status['status'] = 'success';
|
|
1860
1467
|
var nodePromises = [];
|
|
1861
1468
|
if (verbose) (0, _Console.printMessage)("Deleted ".concat(journeyId, " (tree)"), 'info');
|
|
@@ -1960,8 +1567,8 @@ function _deleteJourney() {
|
|
|
1960
1567
|
return status;
|
|
1961
1568
|
});
|
|
1962
1569
|
|
|
1963
|
-
return function (
|
|
1964
|
-
return
|
|
1570
|
+
return function (_x23) {
|
|
1571
|
+
return _ref4.apply(this, arguments);
|
|
1965
1572
|
};
|
|
1966
1573
|
}()).catch(error => {
|
|
1967
1574
|
status['status'] = 'error';
|
|
@@ -1974,7 +1581,7 @@ function _deleteJourney() {
|
|
|
1974
1581
|
return _deleteJourney.apply(this, arguments);
|
|
1975
1582
|
}
|
|
1976
1583
|
|
|
1977
|
-
function deleteJourneys(
|
|
1584
|
+
function deleteJourneys(_x20) {
|
|
1978
1585
|
return _deleteJourneys.apply(this, arguments);
|
|
1979
1586
|
}
|
|
1980
1587
|
/**
|
|
@@ -2026,7 +1633,7 @@ function _deleteJourneys() {
|
|
|
2026
1633
|
return _deleteJourneys.apply(this, arguments);
|
|
2027
1634
|
}
|
|
2028
1635
|
|
|
2029
|
-
function enableJourney(
|
|
1636
|
+
function enableJourney(_x21) {
|
|
2030
1637
|
return _enableJourney.apply(this, arguments);
|
|
2031
1638
|
}
|
|
2032
1639
|
/**
|
|
@@ -2052,7 +1659,7 @@ function _enableJourney() {
|
|
|
2052
1659
|
return _enableJourney.apply(this, arguments);
|
|
2053
1660
|
}
|
|
2054
1661
|
|
|
2055
|
-
function disableJourney(
|
|
1662
|
+
function disableJourney(_x22) {
|
|
2056
1663
|
return _disableJourney.apply(this, arguments);
|
|
2057
1664
|
}
|
|
2058
1665
|
|