@rockcarver/frodo-lib 2.0.0-2 → 2.0.0-4
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 +9 -1
- package/cjs/api/AgentApi.js +64 -16
- package/cjs/api/AgentApi.js.map +1 -1
- package/cjs/api/ApiTypes.js +0 -55
- package/cjs/api/ApiTypes.js.map +1 -1
- package/cjs/api/BaseApi.js +21 -11
- package/cjs/api/BaseApi.js.map +1 -1
- package/cjs/api/cloud/SecretsApi.js +7 -14
- package/cjs/api/cloud/SecretsApi.js.map +1 -1
- package/cjs/api/cloud/SecretsApi.test.js.map +1 -1
- package/cjs/index.js +6 -0
- package/cjs/index.js.map +1 -1
- package/cjs/ops/AdminOps.js +254 -60
- package/cjs/ops/AdminOps.js.map +1 -1
- package/cjs/ops/AgentOps.js +352 -108
- package/cjs/ops/AgentOps.js.map +1 -1
- package/cjs/ops/AuthenticateOps.js +262 -65
- package/cjs/ops/AuthenticateOps.js.map +1 -1
- package/cjs/ops/CirclesOfTrustOps.js +16 -4
- package/cjs/ops/CirclesOfTrustOps.js.map +1 -1
- package/cjs/ops/ConnectionProfileOps.js +163 -40
- package/cjs/ops/ConnectionProfileOps.js.map +1 -1
- package/cjs/ops/EmailTemplateOps.js +7 -1
- package/cjs/ops/EmailTemplateOps.js.map +1 -1
- package/cjs/ops/IdpOps.js +55 -12
- package/cjs/ops/IdpOps.js.map +1 -1
- package/cjs/ops/JourneyOps.js +645 -136
- package/cjs/ops/JourneyOps.js.map +1 -1
- package/cjs/ops/NodeOps.js +96 -24
- package/cjs/ops/NodeOps.js.map +1 -1
- package/cjs/ops/OAuth2ClientOps.js +45 -11
- package/cjs/ops/OAuth2ClientOps.js.map +1 -1
- package/cjs/ops/OpsTypes.js +0 -23
- package/cjs/ops/OpsTypes.js.map +1 -1
- package/cjs/ops/OrganizationOps.js +44 -10
- package/cjs/ops/OrganizationOps.js.map +1 -1
- package/cjs/ops/PolicyOps.js +86 -24
- package/cjs/ops/PolicyOps.js.map +1 -1
- package/cjs/ops/PolicySetOps.js +72 -18
- package/cjs/ops/PolicySetOps.js.map +1 -1
- package/cjs/ops/ResourceTypeOps.js +24 -6
- package/cjs/ops/ResourceTypeOps.js.map +1 -1
- package/cjs/ops/Saml2Ops.js +121 -42
- package/cjs/ops/Saml2Ops.js.map +1 -1
- package/cjs/ops/Saml2Ops.test.js.map +1 -1
- package/cjs/ops/ScriptOps.js +73 -17
- package/cjs/ops/ScriptOps.js.map +1 -1
- package/cjs/ops/ServiceOps.js +152 -35
- package/cjs/ops/ServiceOps.js.map +1 -1
- package/cjs/ops/ThemeOps.js +20 -5
- package/cjs/ops/ThemeOps.js.map +1 -1
- package/cjs/ops/cloud/FeatureOps.js +4 -1
- package/cjs/ops/cloud/FeatureOps.js.map +1 -1
- package/cjs/ops/cloud/SecretsOps.js.map +1 -1
- package/cjs/ops/cloud/ServiceAccountOps.js +24 -6
- package/cjs/ops/cloud/ServiceAccountOps.js.map +1 -1
- package/cjs/ops/cloud/StartupOps.js +55 -11
- package/cjs/ops/cloud/StartupOps.js.map +1 -1
- package/cjs/ops/utils/Console.js +47 -22
- package/cjs/ops/utils/Console.js.map +1 -1
- package/cjs/ops/utils/DataProtection.js +12 -5
- package/cjs/ops/utils/DataProtection.js.map +1 -1
- package/cjs/ops/utils/DataProtection.test.js.map +1 -1
- package/cjs/ops/utils/ExportImportUtils.js +15 -8
- package/cjs/ops/utils/ExportImportUtils.js.map +1 -1
- package/cjs/ops/utils/ScriptValidationUtils.js +33 -8
- package/cjs/ops/utils/ScriptValidationUtils.js.map +1 -1
- package/cjs/ops/utils/ScriptValidationUtils.test.js.map +1 -1
- package/cjs/utils/SetupPollyForFrodoLib.js +67 -19
- package/cjs/utils/SetupPollyForFrodoLib.js.map +1 -1
- package/esm/api/AgentApi.mjs +64 -16
- package/esm/api/ApiTypes.mjs +1 -50
- package/esm/api/BaseApi.mjs +21 -11
- package/esm/api/cloud/SecretsApi.mjs +0 -5
- package/esm/api/cloud/SecretsApi.test.mjs +3 -3
- package/esm/index.mjs +1 -1
- package/esm/ops/AdminOps.mjs +254 -60
- package/esm/ops/AgentOps.mjs +352 -104
- package/esm/ops/AuthenticateOps.mjs +262 -65
- package/esm/ops/CirclesOfTrustOps.mjs +16 -4
- package/esm/ops/ConnectionProfileOps.mjs +163 -40
- package/esm/ops/EmailTemplateOps.mjs +5 -0
- package/esm/ops/IdpOps.mjs +55 -12
- package/esm/ops/JourneyOps.mjs +639 -132
- package/esm/ops/NodeOps.mjs +90 -19
- package/esm/ops/OAuth2ClientOps.mjs +45 -11
- package/esm/ops/OpsTypes.mjs +1 -22
- package/esm/ops/OrganizationOps.mjs +44 -10
- package/esm/ops/PolicyOps.mjs +86 -24
- package/esm/ops/PolicySetOps.mjs +72 -18
- package/esm/ops/ResourceTypeOps.mjs +24 -6
- package/esm/ops/Saml2Ops.mjs +120 -39
- package/esm/ops/Saml2Ops.test.mjs +10 -11
- package/esm/ops/ScriptOps.mjs +73 -17
- package/esm/ops/ServiceOps.mjs +152 -35
- package/esm/ops/ThemeOps.mjs +20 -5
- package/esm/ops/cloud/FeatureOps.mjs +4 -1
- package/esm/ops/cloud/ServiceAccountOps.mjs +24 -6
- package/esm/ops/cloud/StartupOps.mjs +55 -11
- package/esm/ops/utils/Console.mjs +33 -9
- package/esm/ops/utils/DataProtection.mjs +9 -2
- package/esm/ops/utils/DataProtection.test.mjs +8 -2
- package/esm/ops/utils/ExportImportUtils.mjs +15 -8
- package/esm/ops/utils/ScriptValidationUtils.mjs +30 -8
- package/esm/ops/utils/ScriptValidationUtils.test.mjs +14 -3
- package/esm/utils/SetupPollyForFrodoLib.mjs +64 -18
- package/package.json +1 -1
- package/types/api/AgentApi.d.ts +6 -6
- package/types/api/AgentApi.d.ts.map +1 -1
- package/types/api/ApiTypes.d.ts +12 -49
- package/types/api/ApiTypes.d.ts.map +1 -1
- package/types/api/BaseApi.d.ts.map +1 -1
- package/types/api/cloud/SecretsApi.d.ts +1 -4
- package/types/api/cloud/SecretsApi.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/ops/AdminOps.d.ts.map +1 -1
- package/types/ops/AgentOps.d.ts +3 -6
- package/types/ops/AgentOps.d.ts.map +1 -1
- package/types/ops/AuthenticateOps.d.ts.map +1 -1
- package/types/ops/CirclesOfTrustOps.d.ts.map +1 -1
- package/types/ops/ConnectionProfileOps.d.ts.map +1 -1
- package/types/ops/EmailTemplateOps.d.ts +4 -0
- package/types/ops/EmailTemplateOps.d.ts.map +1 -1
- package/types/ops/IdpOps.d.ts.map +1 -1
- package/types/ops/JourneyOps.d.ts +10 -5
- package/types/ops/JourneyOps.d.ts.map +1 -1
- package/types/ops/NodeOps.d.ts +10 -4
- package/types/ops/NodeOps.d.ts.map +1 -1
- package/types/ops/OAuth2ClientOps.d.ts.map +1 -1
- package/types/ops/OpsTypes.d.ts +2 -12
- package/types/ops/OpsTypes.d.ts.map +1 -1
- package/types/ops/OrganizationOps.d.ts.map +1 -1
- package/types/ops/PolicyOps.d.ts.map +1 -1
- package/types/ops/PolicySetOps.d.ts.map +1 -1
- package/types/ops/ResourceTypeOps.d.ts.map +1 -1
- package/types/ops/Saml2Ops.d.ts +0 -6
- package/types/ops/Saml2Ops.d.ts.map +1 -1
- package/types/ops/ScriptOps.d.ts.map +1 -1
- package/types/ops/ServiceOps.d.ts.map +1 -1
- package/types/ops/ThemeOps.d.ts.map +1 -1
- package/types/ops/cloud/FeatureOps.d.ts.map +1 -1
- package/types/ops/cloud/SecretsOps.d.ts +1 -1
- package/types/ops/cloud/SecretsOps.d.ts.map +1 -1
- package/types/ops/cloud/ServiceAccountOps.d.ts.map +1 -1
- package/types/ops/cloud/StartupOps.d.ts.map +1 -1
- package/types/ops/utils/Console.d.ts +34 -7
- package/types/ops/utils/Console.d.ts.map +1 -1
- package/types/ops/utils/DataProtection.d.ts +5 -1
- package/types/ops/utils/DataProtection.d.ts.map +1 -1
- package/types/ops/utils/ExportImportUtils.d.ts.map +1 -1
- package/types/ops/utils/ScriptValidationUtils.d.ts +14 -4
- package/types/ops/utils/ScriptValidationUtils.d.ts.map +1 -1
- package/types/utils/SetupPollyForFrodoLib.d.ts +5 -1
- package/types/utils/SetupPollyForFrodoLib.d.ts.map +1 -1
package/cjs/ops/JourneyOps.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.JourneyClassification = void 0;
|
|
6
7
|
exports.createFileParamTreeExportResolver = createFileParamTreeExportResolver;
|
|
7
8
|
exports.default = void 0;
|
|
8
9
|
exports.deleteJourney = deleteJourney;
|
|
@@ -43,7 +44,6 @@ var _Base = require("../api/utils/Base64");
|
|
|
43
44
|
var _SocialIdentityProvidersApi = require("../api/SocialIdentityProvidersApi");
|
|
44
45
|
var _ThemeOps = require("./ThemeOps");
|
|
45
46
|
var _ScriptOps = require("./ScriptOps");
|
|
46
|
-
var _OpsTypes = require("./OpsTypes");
|
|
47
47
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
48
48
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
49
49
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -301,7 +301,7 @@ class JourneyOps {
|
|
|
301
301
|
* - premium: utilizes nodes, which come at a premium
|
|
302
302
|
* - custom: utilizes nodes not included in the ForgeRock platform release
|
|
303
303
|
* @param {SingleTreeExportInterface} journey journey export data
|
|
304
|
-
* @returns {
|
|
304
|
+
* @returns {JourneyClassificationType[]} an array of one or multiple classifications
|
|
305
305
|
*/
|
|
306
306
|
getJourneyClassification(journey) {
|
|
307
307
|
return getJourneyClassification({
|
|
@@ -371,6 +371,14 @@ class JourneyOps {
|
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
373
|
exports.default = JourneyOps;
|
|
374
|
+
var JourneyClassification = /*#__PURE__*/function (JourneyClassification) {
|
|
375
|
+
JourneyClassification["STANDARD"] = "standard";
|
|
376
|
+
JourneyClassification["CUSTOM"] = "custom";
|
|
377
|
+
JourneyClassification["CLOUD"] = "cloud";
|
|
378
|
+
JourneyClassification["PREMIUM"] = "premium";
|
|
379
|
+
return JourneyClassification;
|
|
380
|
+
}({});
|
|
381
|
+
exports.JourneyClassification = JourneyClassification;
|
|
374
382
|
var containerNodes = ['PageNode', 'CustomPageNode'];
|
|
375
383
|
var scriptedNodes = ['ConfigProviderNode', 'ScriptedDecisionNode', 'ClientScriptNode', 'SocialProviderHandlerNode', 'CustomScriptNode'];
|
|
376
384
|
var emailTemplateNodes = ['EmailSuspendNode', 'EmailTemplateNode'];
|
|
@@ -466,7 +474,11 @@ function _getSaml2NodeDependencies() {
|
|
|
466
474
|
}
|
|
467
475
|
saml2EntityPromises.push(providerResponse);
|
|
468
476
|
} catch (error) {
|
|
469
|
-
(0, _Console.printMessage)(
|
|
477
|
+
(0, _Console.printMessage)({
|
|
478
|
+
message: error.message,
|
|
479
|
+
type: 'error',
|
|
480
|
+
state
|
|
481
|
+
});
|
|
470
482
|
}
|
|
471
483
|
}
|
|
472
484
|
}
|
|
@@ -494,7 +506,11 @@ function _getSaml2NodeDependencies() {
|
|
|
494
506
|
};
|
|
495
507
|
return saml2NodeDependencies;
|
|
496
508
|
} catch (error) {
|
|
497
|
-
(0, _Console.printMessage)(
|
|
509
|
+
(0, _Console.printMessage)({
|
|
510
|
+
message: error.message,
|
|
511
|
+
type: 'error',
|
|
512
|
+
state
|
|
513
|
+
});
|
|
498
514
|
var _saml2NodeDependencies = {
|
|
499
515
|
saml2Entities: [],
|
|
500
516
|
circlesOfTrust: []
|
|
@@ -534,13 +550,29 @@ function _exportJourney() {
|
|
|
534
550
|
deps
|
|
535
551
|
} = options;
|
|
536
552
|
var verbose = state.getDebug();
|
|
537
|
-
if (verbose) (0, _Console.printMessage)(
|
|
553
|
+
if (verbose) (0, _Console.printMessage)({
|
|
554
|
+
message: "\n- ".concat(treeObject._id, "\n"),
|
|
555
|
+
type: 'info',
|
|
556
|
+
newline: false,
|
|
557
|
+
state
|
|
558
|
+
});
|
|
538
559
|
|
|
539
560
|
// Process tree
|
|
540
|
-
if (verbose) (0, _Console.printMessage)(
|
|
561
|
+
if (verbose) (0, _Console.printMessage)({
|
|
562
|
+
message: ' - Flow',
|
|
563
|
+
state
|
|
564
|
+
});
|
|
541
565
|
exportData.tree = treeObject;
|
|
542
|
-
if (verbose && treeObject.identityResource) (0, _Console.printMessage)(
|
|
543
|
-
|
|
566
|
+
if (verbose && treeObject.identityResource) (0, _Console.printMessage)({
|
|
567
|
+
message: " - identityResource: ".concat(treeObject.identityResource),
|
|
568
|
+
state,
|
|
569
|
+
type: 'info'
|
|
570
|
+
});
|
|
571
|
+
if (verbose) (0, _Console.printMessage)({
|
|
572
|
+
message: " - Done",
|
|
573
|
+
type: 'info',
|
|
574
|
+
state
|
|
575
|
+
});
|
|
544
576
|
var nodePromises = [];
|
|
545
577
|
var scriptPromises = [];
|
|
546
578
|
var emailTemplatePromises = [];
|
|
@@ -554,7 +586,11 @@ function _exportJourney() {
|
|
|
554
586
|
state
|
|
555
587
|
});
|
|
556
588
|
} catch (error) {
|
|
557
|
-
(0, _Console.printMessage)(
|
|
589
|
+
(0, _Console.printMessage)({
|
|
590
|
+
message: error,
|
|
591
|
+
type: 'error',
|
|
592
|
+
state
|
|
593
|
+
});
|
|
558
594
|
}
|
|
559
595
|
}
|
|
560
596
|
var allSaml2Providers = null;
|
|
@@ -570,14 +606,22 @@ function _exportJourney() {
|
|
|
570
606
|
state
|
|
571
607
|
}));
|
|
572
608
|
}
|
|
573
|
-
if (verbose && nodePromises.length > 0) (0, _Console.printMessage)(
|
|
609
|
+
if (verbose && nodePromises.length > 0) (0, _Console.printMessage)({
|
|
610
|
+
message: ' - Nodes:',
|
|
611
|
+
state
|
|
612
|
+
});
|
|
574
613
|
var nodeObjects = yield Promise.all(nodePromises);
|
|
575
614
|
|
|
576
615
|
// iterate over every node in tree
|
|
577
616
|
for (var nodeObject of nodeObjects) {
|
|
578
617
|
var _nodeId = nodeObject._id;
|
|
579
618
|
var nodeType = nodeObject._type._id;
|
|
580
|
-
if (verbose) (0, _Console.printMessage)(
|
|
619
|
+
if (verbose) (0, _Console.printMessage)({
|
|
620
|
+
message: " - ".concat(_nodeId, " (").concat(nodeType, ")"),
|
|
621
|
+
type: 'info',
|
|
622
|
+
newline: true,
|
|
623
|
+
state
|
|
624
|
+
});
|
|
581
625
|
exportData.nodes[nodeObject._id] = nodeObject;
|
|
582
626
|
|
|
583
627
|
// handle script node types
|
|
@@ -602,7 +646,11 @@ function _exportJourney() {
|
|
|
602
646
|
if (error.isAxiosError && error.response.status) {
|
|
603
647
|
message = error.response.statusText;
|
|
604
648
|
}
|
|
605
|
-
(0, _Console.printMessage)(
|
|
649
|
+
(0, _Console.printMessage)({
|
|
650
|
+
message: "\n".concat(message, ": Email Template \"").concat(nodeObject.emailTemplateName, "\""),
|
|
651
|
+
type: 'error',
|
|
652
|
+
state
|
|
653
|
+
});
|
|
606
654
|
}
|
|
607
655
|
}
|
|
608
656
|
}
|
|
@@ -674,12 +722,20 @@ function _exportJourney() {
|
|
|
674
722
|
}
|
|
675
723
|
|
|
676
724
|
// Process inner nodes
|
|
677
|
-
if (verbose && innerNodePromises.length > 0) (0, _Console.printMessage)(
|
|
725
|
+
if (verbose && innerNodePromises.length > 0) (0, _Console.printMessage)({
|
|
726
|
+
message: ' - Inner nodes:',
|
|
727
|
+
state
|
|
728
|
+
});
|
|
678
729
|
var innerNodeDataResults = yield Promise.all(innerNodePromises);
|
|
679
730
|
for (var innerNodeObject of innerNodeDataResults) {
|
|
680
731
|
var innerNodeId = innerNodeObject._id;
|
|
681
732
|
var innerNodeType = innerNodeObject._type._id;
|
|
682
|
-
if (verbose) (0, _Console.printMessage)(
|
|
733
|
+
if (verbose) (0, _Console.printMessage)({
|
|
734
|
+
message: " - ".concat(innerNodeId, " (").concat(innerNodeType, ")"),
|
|
735
|
+
type: 'info',
|
|
736
|
+
newline: true,
|
|
737
|
+
state
|
|
738
|
+
});
|
|
683
739
|
exportData.innerNodes[innerNodeId] = innerNodeObject;
|
|
684
740
|
|
|
685
741
|
// handle script node types
|
|
@@ -704,14 +760,22 @@ function _exportJourney() {
|
|
|
704
760
|
if (error.isAxiosError && error.response.status) {
|
|
705
761
|
_message = error.response.statusText;
|
|
706
762
|
}
|
|
707
|
-
(0, _Console.printMessage)(
|
|
763
|
+
(0, _Console.printMessage)({
|
|
764
|
+
message: "\n".concat(_message, ": Email Template \"").concat(innerNodeObject.emailTemplateName, "\""),
|
|
765
|
+
type: 'error',
|
|
766
|
+
state
|
|
767
|
+
});
|
|
708
768
|
}
|
|
709
769
|
}
|
|
710
770
|
}
|
|
711
771
|
|
|
712
772
|
// handle SAML2 node dependencies
|
|
713
773
|
if (deps && innerNodeType === 'product-Saml2Node') {
|
|
714
|
-
(0, _Console.printMessage)(
|
|
774
|
+
(0, _Console.printMessage)({
|
|
775
|
+
message: 'SAML2 inner node',
|
|
776
|
+
type: 'error',
|
|
777
|
+
state
|
|
778
|
+
});
|
|
715
779
|
if (!allSaml2Providers) {
|
|
716
780
|
// eslint-disable-next-line no-await-in-loop
|
|
717
781
|
allSaml2Providers = (yield (0, _Saml2Api.getProviders)({
|
|
@@ -746,11 +810,19 @@ function _exportJourney() {
|
|
|
746
810
|
}
|
|
747
811
|
|
|
748
812
|
// Process email templates
|
|
749
|
-
if (verbose && emailTemplatePromises.length > 0) (0, _Console.printMessage)(
|
|
813
|
+
if (verbose && emailTemplatePromises.length > 0) (0, _Console.printMessage)({
|
|
814
|
+
message: ' - Email templates:',
|
|
815
|
+
state
|
|
816
|
+
});
|
|
750
817
|
var settledEmailTemplatePromises = yield Promise.allSettled(emailTemplatePromises);
|
|
751
818
|
for (var settledPromise of settledEmailTemplatePromises) {
|
|
752
819
|
if (settledPromise.status === 'fulfilled' && settledPromise.value) {
|
|
753
|
-
if (verbose) (0, _Console.printMessage)(
|
|
820
|
+
if (verbose) (0, _Console.printMessage)({
|
|
821
|
+
message: " - ".concat(settledPromise.value._id.split('/')[1]).concat(settledPromise.value.displayName ? " (".concat(settledPromise.value.displayName, ")") : ''),
|
|
822
|
+
type: 'info',
|
|
823
|
+
newline: true,
|
|
824
|
+
state
|
|
825
|
+
});
|
|
754
826
|
exportData.emailTemplates[settledPromise.value._id.split('/')[1]] = settledPromise.value;
|
|
755
827
|
}
|
|
756
828
|
}
|
|
@@ -759,14 +831,28 @@ function _exportJourney() {
|
|
|
759
831
|
var saml2NodeDependencies = yield Promise.all(saml2ConfigPromises);
|
|
760
832
|
for (var saml2NodeDependency of saml2NodeDependencies) {
|
|
761
833
|
if (saml2NodeDependency) {
|
|
762
|
-
if (verbose) (0, _Console.printMessage)(
|
|
834
|
+
if (verbose) (0, _Console.printMessage)({
|
|
835
|
+
message: ' - SAML2 entity providers:',
|
|
836
|
+
state
|
|
837
|
+
});
|
|
763
838
|
for (var saml2Entity of saml2NodeDependency.saml2Entities) {
|
|
764
|
-
if (verbose) (0, _Console.printMessage)(
|
|
839
|
+
if (verbose) (0, _Console.printMessage)({
|
|
840
|
+
message: " - ".concat(saml2Entity.entityLocation, " ").concat(saml2Entity.entityId),
|
|
841
|
+
type: 'info',
|
|
842
|
+
state
|
|
843
|
+
});
|
|
765
844
|
exportData.saml2Entities[saml2Entity._id] = saml2Entity;
|
|
766
845
|
}
|
|
767
|
-
if (verbose) (0, _Console.printMessage)(
|
|
846
|
+
if (verbose) (0, _Console.printMessage)({
|
|
847
|
+
message: ' - SAML2 circles of trust:',
|
|
848
|
+
state
|
|
849
|
+
});
|
|
768
850
|
for (var circleOfTrust of saml2NodeDependency.circlesOfTrust) {
|
|
769
|
-
if (verbose) (0, _Console.printMessage)(
|
|
851
|
+
if (verbose) (0, _Console.printMessage)({
|
|
852
|
+
message: " - ".concat(circleOfTrust._id),
|
|
853
|
+
type: 'info',
|
|
854
|
+
state
|
|
855
|
+
});
|
|
770
856
|
exportData.circlesOfTrust[circleOfTrust._id] = circleOfTrust;
|
|
771
857
|
}
|
|
772
858
|
}
|
|
@@ -775,12 +861,19 @@ function _exportJourney() {
|
|
|
775
861
|
// Process socialIdentityProviders
|
|
776
862
|
var socialProviders = yield Promise.resolve(socialProviderPromise);
|
|
777
863
|
if (socialProviders) {
|
|
778
|
-
if (verbose) (0, _Console.printMessage)(
|
|
864
|
+
if (verbose) (0, _Console.printMessage)({
|
|
865
|
+
message: ' - OAuth2/OIDC (social) identity providers:',
|
|
866
|
+
state
|
|
867
|
+
});
|
|
779
868
|
for (var socialProvider of socialProviders.result) {
|
|
780
869
|
// If the list of socialIdentityProviders needs to be filtered based on the
|
|
781
870
|
// filteredProviders property of a SelectIdPNode do it here.
|
|
782
871
|
if (socialProvider && (!filteredSocialProviders || filteredSocialProviders.length === 0 || filteredSocialProviders.includes(socialProvider._id))) {
|
|
783
|
-
if (verbose) (0, _Console.printMessage)(
|
|
872
|
+
if (verbose) (0, _Console.printMessage)({
|
|
873
|
+
message: " - ".concat(socialProvider._id),
|
|
874
|
+
type: 'info',
|
|
875
|
+
state
|
|
876
|
+
});
|
|
784
877
|
scriptPromises.push((0, _ScriptApi.getScript)({
|
|
785
878
|
scriptId: socialProvider.transform,
|
|
786
879
|
state
|
|
@@ -791,11 +884,19 @@ function _exportJourney() {
|
|
|
791
884
|
}
|
|
792
885
|
|
|
793
886
|
// Process scripts
|
|
794
|
-
if (verbose && scriptPromises.length > 0) (0, _Console.printMessage)(
|
|
887
|
+
if (verbose && scriptPromises.length > 0) (0, _Console.printMessage)({
|
|
888
|
+
message: ' - Scripts:',
|
|
889
|
+
state
|
|
890
|
+
});
|
|
795
891
|
var scriptObjects = yield Promise.all(scriptPromises);
|
|
796
892
|
for (var scriptObject of scriptObjects) {
|
|
797
893
|
if (scriptObject) {
|
|
798
|
-
if (verbose) (0, _Console.printMessage)(
|
|
894
|
+
if (verbose) (0, _Console.printMessage)({
|
|
895
|
+
message: " - ".concat(scriptObject._id, " (").concat(scriptObject.name, ")"),
|
|
896
|
+
type: 'info',
|
|
897
|
+
newline: true,
|
|
898
|
+
state
|
|
899
|
+
});
|
|
799
900
|
scriptObject.script = useStringArrays ? (0, _ExportImportUtils.convertBase64TextToArray)(scriptObject.script) : JSON.stringify((0, _Base.decode)(scriptObject.script));
|
|
800
901
|
exportData.scripts[scriptObject._id] = scriptObject;
|
|
801
902
|
}
|
|
@@ -803,7 +904,10 @@ function _exportJourney() {
|
|
|
803
904
|
|
|
804
905
|
// Process themes
|
|
805
906
|
if (themePromise) {
|
|
806
|
-
if (verbose) (0, _Console.printMessage)(
|
|
907
|
+
if (verbose) (0, _Console.printMessage)({
|
|
908
|
+
message: ' - Themes:',
|
|
909
|
+
state
|
|
910
|
+
});
|
|
807
911
|
try {
|
|
808
912
|
var themePromiseResults = yield Promise.resolve(themePromise);
|
|
809
913
|
for (var themeObject of themePromiseResults) {
|
|
@@ -812,18 +916,38 @@ function _exportJourney() {
|
|
|
812
916
|
// has the theme been specified by id or name in a page node?
|
|
813
917
|
themes.includes(themeObject._id) || themes.includes(themeObject.name) || // has this journey been linked to a theme?
|
|
814
918
|
(_themeObject$linkedTr = themeObject.linkedTrees) !== null && _themeObject$linkedTr !== void 0 && _themeObject$linkedTr.includes(treeObject._id))) {
|
|
815
|
-
if (verbose) (0, _Console.printMessage)(
|
|
919
|
+
if (verbose) (0, _Console.printMessage)({
|
|
920
|
+
message: " - ".concat(themeObject._id, " (").concat(themeObject.name, ")"),
|
|
921
|
+
type: 'info',
|
|
922
|
+
state
|
|
923
|
+
});
|
|
816
924
|
exportData.themes.push(themeObject);
|
|
817
925
|
}
|
|
818
926
|
}
|
|
819
927
|
} catch (error) {
|
|
820
|
-
(0, _Console.printMessage)(
|
|
821
|
-
|
|
928
|
+
(0, _Console.printMessage)({
|
|
929
|
+
message: error.response.data,
|
|
930
|
+
type: 'error',
|
|
931
|
+
state
|
|
932
|
+
});
|
|
933
|
+
(0, _Console.printMessage)({
|
|
934
|
+
message: 'Error handling themes: ' + error.message,
|
|
935
|
+
type: 'error',
|
|
936
|
+
state
|
|
937
|
+
});
|
|
822
938
|
}
|
|
823
939
|
}
|
|
824
940
|
} catch (error) {
|
|
825
|
-
(0, _Console.printMessage)(
|
|
826
|
-
|
|
941
|
+
(0, _Console.printMessage)({
|
|
942
|
+
message: error.response.data,
|
|
943
|
+
type: 'error',
|
|
944
|
+
state
|
|
945
|
+
});
|
|
946
|
+
(0, _Console.printMessage)({
|
|
947
|
+
message: 'Error exporting tree: ' + treeId + ' - ' + error.message,
|
|
948
|
+
type: 'error',
|
|
949
|
+
state
|
|
950
|
+
});
|
|
827
951
|
}
|
|
828
952
|
return exportData;
|
|
829
953
|
});
|
|
@@ -898,16 +1022,29 @@ function _importJourney() {
|
|
|
898
1022
|
deps
|
|
899
1023
|
} = options;
|
|
900
1024
|
var verbose = state.getDebug();
|
|
901
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1025
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1026
|
+
message: "\n- ".concat(treeObject.tree._id, "\n"),
|
|
1027
|
+
type: 'info',
|
|
1028
|
+
newline: false,
|
|
1029
|
+
state
|
|
1030
|
+
});
|
|
902
1031
|
var newUuid = '';
|
|
903
1032
|
var uuidMap = {};
|
|
904
1033
|
var treeId = treeObject.tree._id;
|
|
905
1034
|
|
|
906
1035
|
// Process scripts
|
|
907
1036
|
if (deps && treeObject.scripts && Object.entries(treeObject.scripts).length > 0) {
|
|
908
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1037
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1038
|
+
message: ' - Scripts:',
|
|
1039
|
+
state
|
|
1040
|
+
});
|
|
909
1041
|
for (var [scriptId, scriptObject] of Object.entries(treeObject.scripts)) {
|
|
910
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1042
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1043
|
+
message: " - ".concat(scriptId, " (").concat(scriptObject['name'], ")"),
|
|
1044
|
+
type: 'info',
|
|
1045
|
+
newline: false,
|
|
1046
|
+
state
|
|
1047
|
+
});
|
|
911
1048
|
// is the script stored as an array of strings or just b64 blob?
|
|
912
1049
|
if (Array.isArray(scriptObject['script'])) {
|
|
913
1050
|
scriptObject['script'] = (0, _ExportImportUtils.convertTextArrayToBase64)(scriptObject['script']);
|
|
@@ -923,15 +1060,26 @@ function _importJourney() {
|
|
|
923
1060
|
} catch (error) {
|
|
924
1061
|
throw new Error("Error importing script ".concat(scriptObject['name'], " (").concat(scriptId, ") in journey ").concat(treeId, ": ").concat(error.message));
|
|
925
1062
|
}
|
|
926
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1063
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1064
|
+
message: '',
|
|
1065
|
+
state
|
|
1066
|
+
});
|
|
927
1067
|
}
|
|
928
1068
|
}
|
|
929
1069
|
|
|
930
1070
|
// Process email templates
|
|
931
1071
|
if (deps && treeObject.emailTemplates && Object.entries(treeObject.emailTemplates).length > 0) {
|
|
932
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1072
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1073
|
+
message: ' - Email templates:',
|
|
1074
|
+
state
|
|
1075
|
+
});
|
|
933
1076
|
for (var [templateId, templateData] of Object.entries(treeObject.emailTemplates)) {
|
|
934
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1077
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1078
|
+
message: " - ".concat(templateId),
|
|
1079
|
+
type: 'info',
|
|
1080
|
+
newline: false,
|
|
1081
|
+
state
|
|
1082
|
+
});
|
|
935
1083
|
try {
|
|
936
1084
|
yield (0, _EmailTemplateOps.putEmailTemplate)({
|
|
937
1085
|
templateId,
|
|
@@ -939,19 +1087,33 @@ function _importJourney() {
|
|
|
939
1087
|
state
|
|
940
1088
|
});
|
|
941
1089
|
} catch (error) {
|
|
942
|
-
(0, _Console.printMessage)(
|
|
1090
|
+
(0, _Console.printMessage)({
|
|
1091
|
+
message: error.response.data,
|
|
1092
|
+
type: 'error',
|
|
1093
|
+
state
|
|
1094
|
+
});
|
|
943
1095
|
throw new Error("Error importing email templates: ".concat(error.message));
|
|
944
1096
|
}
|
|
945
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1097
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1098
|
+
message: '',
|
|
1099
|
+
state
|
|
1100
|
+
});
|
|
946
1101
|
}
|
|
947
1102
|
}
|
|
948
1103
|
|
|
949
1104
|
// Process themes
|
|
950
1105
|
if (deps && treeObject.themes && treeObject.themes.length > 0) {
|
|
951
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1106
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1107
|
+
message: ' - Themes:',
|
|
1108
|
+
state
|
|
1109
|
+
});
|
|
952
1110
|
var themes = new Map();
|
|
953
1111
|
for (var theme of treeObject.themes) {
|
|
954
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1112
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1113
|
+
message: " - ".concat(theme['_id'], " (").concat(theme['name'], ")"),
|
|
1114
|
+
type: 'info',
|
|
1115
|
+
state
|
|
1116
|
+
});
|
|
955
1117
|
themes[theme['_id']] = theme;
|
|
956
1118
|
}
|
|
957
1119
|
try {
|
|
@@ -966,9 +1128,16 @@ function _importJourney() {
|
|
|
966
1128
|
|
|
967
1129
|
// Process social providers
|
|
968
1130
|
if (deps && treeObject.socialIdentityProviders && Object.entries(treeObject.socialIdentityProviders).length > 0) {
|
|
969
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1131
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1132
|
+
message: ' - OAuth2/OIDC (social) identity providers:',
|
|
1133
|
+
state
|
|
1134
|
+
});
|
|
970
1135
|
for (var [providerId, providerData] of Object.entries(treeObject.socialIdentityProviders)) {
|
|
971
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1136
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1137
|
+
message: " - ".concat(providerId),
|
|
1138
|
+
type: 'info',
|
|
1139
|
+
state
|
|
1140
|
+
});
|
|
972
1141
|
try {
|
|
973
1142
|
yield (0, _SocialIdentityProvidersApi.putProviderByTypeAndId)({
|
|
974
1143
|
type: providerData['_type']['_id'],
|
|
@@ -989,12 +1158,20 @@ function _importJourney() {
|
|
|
989
1158
|
});
|
|
990
1159
|
} catch (importError2) {
|
|
991
1160
|
var _importError$response4;
|
|
992
|
-
(0, _Console.printMessage)(
|
|
1161
|
+
(0, _Console.printMessage)({
|
|
1162
|
+
message: ((_importError$response4 = importError.response) === null || _importError$response4 === void 0 ? void 0 : _importError$response4.data) || importError,
|
|
1163
|
+
type: 'error',
|
|
1164
|
+
state
|
|
1165
|
+
});
|
|
993
1166
|
throw new Error("Error importing provider ".concat(providerId, " in journey ").concat(treeId, ": ").concat(importError));
|
|
994
1167
|
}
|
|
995
1168
|
} else {
|
|
996
1169
|
var _importError$response5;
|
|
997
|
-
(0, _Console.printMessage)(
|
|
1170
|
+
(0, _Console.printMessage)({
|
|
1171
|
+
message: ((_importError$response5 = importError.response) === null || _importError$response5 === void 0 ? void 0 : _importError$response5.data) || importError,
|
|
1172
|
+
type: 'error',
|
|
1173
|
+
state
|
|
1174
|
+
});
|
|
998
1175
|
throw new Error("\nError importing provider ".concat(providerId, " in journey ").concat(treeId, ": ").concat(importError));
|
|
999
1176
|
}
|
|
1000
1177
|
}
|
|
@@ -1003,12 +1180,19 @@ function _importJourney() {
|
|
|
1003
1180
|
|
|
1004
1181
|
// Process saml providers
|
|
1005
1182
|
if (deps && treeObject.saml2Entities && Object.entries(treeObject.saml2Entities).length > 0) {
|
|
1006
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1183
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1184
|
+
message: ' - SAML2 entity providers:',
|
|
1185
|
+
state
|
|
1186
|
+
});
|
|
1007
1187
|
var _loop = function* _loop() {
|
|
1008
1188
|
delete _providerData['_rev'];
|
|
1009
1189
|
var entityId = _providerData['entityId'];
|
|
1010
1190
|
var entityLocation = _providerData['entityLocation'];
|
|
1011
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1191
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1192
|
+
message: " - ".concat(entityLocation, " ").concat(entityId),
|
|
1193
|
+
type: 'info',
|
|
1194
|
+
state
|
|
1195
|
+
});
|
|
1012
1196
|
var metaData = null;
|
|
1013
1197
|
if (entityLocation === 'remote') {
|
|
1014
1198
|
if (Array.isArray(_providerData['base64EntityXML'])) {
|
|
@@ -1032,7 +1216,11 @@ function _importJourney() {
|
|
|
1032
1216
|
state
|
|
1033
1217
|
}).catch(createProviderErr => {
|
|
1034
1218
|
var _createProviderErr$re;
|
|
1035
|
-
(0, _Console.printMessage)(
|
|
1219
|
+
(0, _Console.printMessage)({
|
|
1220
|
+
message: ((_createProviderErr$re = createProviderErr.response) === null || _createProviderErr$re === void 0 ? void 0 : _createProviderErr$re.data) || createProviderErr,
|
|
1221
|
+
type: 'error',
|
|
1222
|
+
state
|
|
1223
|
+
});
|
|
1036
1224
|
throw new Error("Error creating provider ".concat(entityId));
|
|
1037
1225
|
});
|
|
1038
1226
|
} else {
|
|
@@ -1042,7 +1230,11 @@ function _importJourney() {
|
|
|
1042
1230
|
state
|
|
1043
1231
|
}).catch(updateProviderErr => {
|
|
1044
1232
|
var _updateProviderErr$re;
|
|
1045
|
-
(0, _Console.printMessage)(
|
|
1233
|
+
(0, _Console.printMessage)({
|
|
1234
|
+
message: ((_updateProviderErr$re = updateProviderErr.response) === null || _updateProviderErr$re === void 0 ? void 0 : _updateProviderErr$re.data) || updateProviderErr,
|
|
1235
|
+
type: 'error',
|
|
1236
|
+
state
|
|
1237
|
+
});
|
|
1046
1238
|
throw new Error("Error updating provider ".concat(entityId));
|
|
1047
1239
|
});
|
|
1048
1240
|
}
|
|
@@ -1054,10 +1246,17 @@ function _importJourney() {
|
|
|
1054
1246
|
|
|
1055
1247
|
// Process circles of trust
|
|
1056
1248
|
if (deps && treeObject.circlesOfTrust && Object.entries(treeObject.circlesOfTrust).length > 0) {
|
|
1057
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1249
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1250
|
+
message: ' - SAML2 circles of trust:',
|
|
1251
|
+
state
|
|
1252
|
+
});
|
|
1058
1253
|
for (var [cotId, cotData] of Object.entries(treeObject.circlesOfTrust)) {
|
|
1059
1254
|
delete cotData['_rev'];
|
|
1060
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1255
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1256
|
+
message: " - ".concat(cotId),
|
|
1257
|
+
type: 'info',
|
|
1258
|
+
state
|
|
1259
|
+
});
|
|
1061
1260
|
try {
|
|
1062
1261
|
yield (0, _CirclesOfTrustApi.createCircleOfTrust)({
|
|
1063
1262
|
cotData,
|
|
@@ -1074,13 +1273,25 @@ function _importJourney() {
|
|
|
1074
1273
|
});
|
|
1075
1274
|
} catch (updateCotErr) {
|
|
1076
1275
|
var _createCotErr$respons3, _updateCotErr$respons;
|
|
1077
|
-
(0, _Console.printMessage)(
|
|
1078
|
-
|
|
1276
|
+
(0, _Console.printMessage)({
|
|
1277
|
+
message: ((_createCotErr$respons3 = createCotErr.response) === null || _createCotErr$respons3 === void 0 ? void 0 : _createCotErr$respons3.data) || createCotErr,
|
|
1278
|
+
type: 'error',
|
|
1279
|
+
state
|
|
1280
|
+
});
|
|
1281
|
+
(0, _Console.printMessage)({
|
|
1282
|
+
message: ((_updateCotErr$respons = updateCotErr.response) === null || _updateCotErr$respons === void 0 ? void 0 : _updateCotErr$respons.data) || updateCotErr,
|
|
1283
|
+
type: 'error',
|
|
1284
|
+
state
|
|
1285
|
+
});
|
|
1079
1286
|
throw new Error("Error creating/updating circle of trust ".concat(cotId));
|
|
1080
1287
|
}
|
|
1081
1288
|
} else {
|
|
1082
1289
|
var _createCotErr$respons4;
|
|
1083
|
-
(0, _Console.printMessage)(
|
|
1290
|
+
(0, _Console.printMessage)({
|
|
1291
|
+
message: ((_createCotErr$respons4 = createCotErr.response) === null || _createCotErr$respons4 === void 0 ? void 0 : _createCotErr$respons4.data) || createCotErr,
|
|
1292
|
+
type: 'error',
|
|
1293
|
+
state
|
|
1294
|
+
});
|
|
1084
1295
|
throw new Error("Error creating circle of trust ".concat(cotId));
|
|
1085
1296
|
}
|
|
1086
1297
|
}
|
|
@@ -1097,7 +1308,12 @@ function _importJourney() {
|
|
|
1097
1308
|
innerNodes = treeObject.innernodes;
|
|
1098
1309
|
}
|
|
1099
1310
|
if (Object.entries(innerNodes).length > 0) {
|
|
1100
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1311
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1312
|
+
message: ' - Inner nodes:',
|
|
1313
|
+
type: 'text',
|
|
1314
|
+
newline: true,
|
|
1315
|
+
state
|
|
1316
|
+
});
|
|
1101
1317
|
for (var [innerNodeId, innerNodeData] of Object.entries(innerNodes)) {
|
|
1102
1318
|
delete innerNodeData['_rev'];
|
|
1103
1319
|
var nodeType = innerNodeData['_type']['_id'];
|
|
@@ -1108,7 +1324,12 @@ function _importJourney() {
|
|
|
1108
1324
|
uuidMap[innerNodeId] = newUuid;
|
|
1109
1325
|
}
|
|
1110
1326
|
innerNodeData['_id'] = newUuid;
|
|
1111
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1327
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1328
|
+
message: " - ".concat(newUuid).concat(reUuid ? '*' : '', " (").concat(nodeType, ")"),
|
|
1329
|
+
type: 'info',
|
|
1330
|
+
newline: false,
|
|
1331
|
+
state
|
|
1332
|
+
});
|
|
1112
1333
|
|
|
1113
1334
|
// If the node has an identityResource config setting
|
|
1114
1335
|
// and the identityResource ends in 'user'
|
|
@@ -1118,7 +1339,12 @@ function _importJourney() {
|
|
|
1118
1339
|
innerNodeData['identityResource'] = "managed/".concat((0, _OpsUtils.getRealmManagedUser)({
|
|
1119
1340
|
state
|
|
1120
1341
|
}));
|
|
1121
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1342
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1343
|
+
message: "\n - identityResource: ".concat(innerNodeData['identityResource']),
|
|
1344
|
+
type: 'info',
|
|
1345
|
+
newline: false,
|
|
1346
|
+
state
|
|
1347
|
+
});
|
|
1122
1348
|
}
|
|
1123
1349
|
try {
|
|
1124
1350
|
yield (0, _NodeApi.putNode)({
|
|
@@ -1138,7 +1364,12 @@ function _importJourney() {
|
|
|
1138
1364
|
validAttributes.push('_id');
|
|
1139
1365
|
for (var attribute of Object.keys(innerNodeData)) {
|
|
1140
1366
|
if (!validAttributes.includes(attribute)) {
|
|
1141
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1367
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1368
|
+
message: "\n - Removing invalid attribute: ".concat(attribute),
|
|
1369
|
+
type: 'warn',
|
|
1370
|
+
newline: false,
|
|
1371
|
+
state
|
|
1372
|
+
});
|
|
1142
1373
|
delete innerNodeData[attribute];
|
|
1143
1374
|
}
|
|
1144
1375
|
}
|
|
@@ -1150,21 +1381,35 @@ function _importJourney() {
|
|
|
1150
1381
|
state
|
|
1151
1382
|
});
|
|
1152
1383
|
} catch (nodeImportError2) {
|
|
1153
|
-
(0, _Console.printMessage)(
|
|
1384
|
+
(0, _Console.printMessage)({
|
|
1385
|
+
message: nodeImportError2.response.data,
|
|
1386
|
+
type: 'error',
|
|
1387
|
+
state
|
|
1388
|
+
});
|
|
1154
1389
|
throw new Error("Error importing node ".concat(innerNodeId).concat(innerNodeId === newUuid ? '' : " [".concat(newUuid, "]"), " in journey ").concat(treeId));
|
|
1155
1390
|
}
|
|
1156
1391
|
} else {
|
|
1157
|
-
(0, _Console.printMessage)(
|
|
1392
|
+
(0, _Console.printMessage)({
|
|
1393
|
+
message: nodeImportError.response.data,
|
|
1394
|
+
type: 'error',
|
|
1395
|
+
state
|
|
1396
|
+
});
|
|
1158
1397
|
throw new Error("Error importing inner node ".concat(innerNodeId).concat(innerNodeId === newUuid ? '' : " [".concat(newUuid, "]"), " in journey ").concat(treeId));
|
|
1159
1398
|
}
|
|
1160
1399
|
}
|
|
1161
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1400
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1401
|
+
message: '',
|
|
1402
|
+
state
|
|
1403
|
+
});
|
|
1162
1404
|
}
|
|
1163
1405
|
}
|
|
1164
1406
|
|
|
1165
1407
|
// Process nodes
|
|
1166
1408
|
if (treeObject.nodes && Object.entries(treeObject.nodes).length > 0) {
|
|
1167
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1409
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1410
|
+
message: ' - Nodes:',
|
|
1411
|
+
state
|
|
1412
|
+
});
|
|
1168
1413
|
// eslint-disable-next-line prefer-const
|
|
1169
1414
|
for (var [nodeId, nodeData] of Object.entries(treeObject.nodes)) {
|
|
1170
1415
|
delete nodeData['_rev'];
|
|
@@ -1182,7 +1427,12 @@ function _importJourney() {
|
|
|
1182
1427
|
nodeData = JSON.parse((0, _OpsUtils.replaceAll)(JSON.stringify(nodeData), currentId, uuidMap[currentId]));
|
|
1183
1428
|
}
|
|
1184
1429
|
}
|
|
1185
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1430
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1431
|
+
message: " - ".concat(newUuid).concat(reUuid ? '*' : '', " (").concat(_nodeType, ")"),
|
|
1432
|
+
type: 'info',
|
|
1433
|
+
newline: false,
|
|
1434
|
+
state
|
|
1435
|
+
});
|
|
1186
1436
|
|
|
1187
1437
|
// If the node has an identityResource config setting
|
|
1188
1438
|
// and the identityResource ends in 'user'
|
|
@@ -1192,7 +1442,12 @@ function _importJourney() {
|
|
|
1192
1442
|
nodeData['identityResource'] = "managed/".concat((0, _OpsUtils.getRealmManagedUser)({
|
|
1193
1443
|
state
|
|
1194
1444
|
}));
|
|
1195
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1445
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1446
|
+
message: "\n - identityResource: ".concat(nodeData['identityResource']),
|
|
1447
|
+
type: 'info',
|
|
1448
|
+
newline: false,
|
|
1449
|
+
state
|
|
1450
|
+
});
|
|
1196
1451
|
}
|
|
1197
1452
|
try {
|
|
1198
1453
|
yield (0, _NodeApi.putNode)({
|
|
@@ -1212,7 +1467,12 @@ function _importJourney() {
|
|
|
1212
1467
|
_validAttributes.push('_id');
|
|
1213
1468
|
for (var _attribute of Object.keys(nodeData)) {
|
|
1214
1469
|
if (!_validAttributes.includes(_attribute)) {
|
|
1215
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1470
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1471
|
+
message: "\n - Removing invalid attribute: ".concat(_attribute),
|
|
1472
|
+
type: 'warn',
|
|
1473
|
+
newline: false,
|
|
1474
|
+
state
|
|
1475
|
+
});
|
|
1216
1476
|
delete nodeData[_attribute];
|
|
1217
1477
|
}
|
|
1218
1478
|
}
|
|
@@ -1224,20 +1484,34 @@ function _importJourney() {
|
|
|
1224
1484
|
state
|
|
1225
1485
|
});
|
|
1226
1486
|
} catch (nodeImportError2) {
|
|
1227
|
-
(0, _Console.printMessage)(
|
|
1487
|
+
(0, _Console.printMessage)({
|
|
1488
|
+
message: nodeImportError2.response.data,
|
|
1489
|
+
type: 'error',
|
|
1490
|
+
state
|
|
1491
|
+
});
|
|
1228
1492
|
throw new Error("Error importing node ".concat(nodeId).concat(nodeId === newUuid ? '' : " [".concat(newUuid, "]"), " in journey ").concat(treeId));
|
|
1229
1493
|
}
|
|
1230
1494
|
} else {
|
|
1231
|
-
(0, _Console.printMessage)(
|
|
1495
|
+
(0, _Console.printMessage)({
|
|
1496
|
+
message: nodeImportError.response.data,
|
|
1497
|
+
type: 'error',
|
|
1498
|
+
state
|
|
1499
|
+
});
|
|
1232
1500
|
throw new Error("Error importing node ".concat(nodeId).concat(nodeId === newUuid ? '' : " [".concat(newUuid, "]"), " in journey ").concat(treeId));
|
|
1233
1501
|
}
|
|
1234
1502
|
}
|
|
1235
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1503
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1504
|
+
message: '',
|
|
1505
|
+
state
|
|
1506
|
+
});
|
|
1236
1507
|
}
|
|
1237
1508
|
}
|
|
1238
1509
|
|
|
1239
1510
|
// Process tree
|
|
1240
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1511
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1512
|
+
message: ' - Flow',
|
|
1513
|
+
state
|
|
1514
|
+
});
|
|
1241
1515
|
if (reUuid) {
|
|
1242
1516
|
var journeyText = JSON.stringify(treeObject.tree, null, 2);
|
|
1243
1517
|
for (var [oldId, newId] of Object.entries(uuidMap)) {
|
|
@@ -1253,7 +1527,12 @@ function _importJourney() {
|
|
|
1253
1527
|
treeObject.tree.identityResource = "managed/".concat((0, _OpsUtils.getRealmManagedUser)({
|
|
1254
1528
|
state
|
|
1255
1529
|
}));
|
|
1256
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1530
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1531
|
+
message: " - identityResource: ".concat(treeObject.tree.identityResource),
|
|
1532
|
+
type: 'info',
|
|
1533
|
+
newline: false,
|
|
1534
|
+
state
|
|
1535
|
+
});
|
|
1257
1536
|
}
|
|
1258
1537
|
delete treeObject.tree._rev;
|
|
1259
1538
|
try {
|
|
@@ -1262,7 +1541,12 @@ function _importJourney() {
|
|
|
1262
1541
|
treeData: treeObject.tree,
|
|
1263
1542
|
state
|
|
1264
1543
|
});
|
|
1265
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1544
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1545
|
+
message: "\n - Done",
|
|
1546
|
+
type: 'info',
|
|
1547
|
+
newline: true,
|
|
1548
|
+
state
|
|
1549
|
+
});
|
|
1266
1550
|
} catch (importError) {
|
|
1267
1551
|
var _importError$response6, _importError$response7, _importError$response8;
|
|
1268
1552
|
if (((_importError$response6 = importError.response) === null || _importError$response6 === void 0 ? void 0 : _importError$response6.status) === 400 && ((_importError$response7 = importError.response) === null || _importError$response7 === void 0 ? void 0 : (_importError$response8 = _importError$response7.data) === null || _importError$response8 === void 0 ? void 0 : _importError$response8.message) === 'Invalid attribute specified.') {
|
|
@@ -1272,7 +1556,12 @@ function _importJourney() {
|
|
|
1272
1556
|
_validAttributes2.push('_id');
|
|
1273
1557
|
for (var _attribute2 of Object.keys(treeObject.tree)) {
|
|
1274
1558
|
if (!_validAttributes2.includes(_attribute2)) {
|
|
1275
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1559
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1560
|
+
message: "\n - Removing invalid attribute: ".concat(_attribute2),
|
|
1561
|
+
type: 'warn',
|
|
1562
|
+
newline: false,
|
|
1563
|
+
state
|
|
1564
|
+
});
|
|
1276
1565
|
delete treeObject.tree[_attribute2];
|
|
1277
1566
|
}
|
|
1278
1567
|
}
|
|
@@ -1282,15 +1571,31 @@ function _importJourney() {
|
|
|
1282
1571
|
treeData: treeObject.tree,
|
|
1283
1572
|
state
|
|
1284
1573
|
});
|
|
1285
|
-
if (verbose) (0, _Console.printMessage)(
|
|
1574
|
+
if (verbose) (0, _Console.printMessage)({
|
|
1575
|
+
message: "\n - Done",
|
|
1576
|
+
type: 'info',
|
|
1577
|
+
newline: true,
|
|
1578
|
+
state
|
|
1579
|
+
});
|
|
1286
1580
|
} catch (importError2) {
|
|
1287
|
-
(0, _Console.printMessage)(
|
|
1581
|
+
(0, _Console.printMessage)({
|
|
1582
|
+
message: importError2.response.data,
|
|
1583
|
+
type: 'error',
|
|
1584
|
+
state
|
|
1585
|
+
});
|
|
1288
1586
|
throw new Error("Error importing journey flow ".concat(treeId));
|
|
1289
1587
|
}
|
|
1290
1588
|
} else {
|
|
1291
1589
|
var _importError$response9, _importError$response10;
|
|
1292
|
-
(0, _Console.printMessage)(
|
|
1293
|
-
|
|
1590
|
+
(0, _Console.printMessage)({
|
|
1591
|
+
message: ((_importError$response9 = importError.response) === null || _importError$response9 === void 0 ? void 0 : _importError$response9.data) || importError,
|
|
1592
|
+
type: 'error',
|
|
1593
|
+
state
|
|
1594
|
+
});
|
|
1595
|
+
(0, _Console.debugMessage)({
|
|
1596
|
+
message: ((_importError$response10 = importError.response) === null || _importError$response10 === void 0 ? void 0 : _importError$response10.data) || importError,
|
|
1597
|
+
state
|
|
1598
|
+
});
|
|
1294
1599
|
throw new Error("\nError importing journey flow ".concat(treeId));
|
|
1295
1600
|
}
|
|
1296
1601
|
}
|
|
@@ -1385,17 +1690,38 @@ function _importAllJourneys() {
|
|
|
1385
1690
|
})).result.map(x => x._id);
|
|
1386
1691
|
var unresolvedJourneys = {};
|
|
1387
1692
|
var resolvedJourneys = [];
|
|
1388
|
-
(0, _Console.createProgressIndicator)(
|
|
1693
|
+
(0, _Console.createProgressIndicator)({
|
|
1694
|
+
total: undefined,
|
|
1695
|
+
message: 'Resolving dependencies',
|
|
1696
|
+
type: 'indeterminate',
|
|
1697
|
+
state
|
|
1698
|
+
});
|
|
1389
1699
|
yield resolveDependencies(installedJourneys, treesMap, unresolvedJourneys, resolvedJourneys);
|
|
1390
1700
|
if (Object.keys(unresolvedJourneys).length === 0) {
|
|
1391
|
-
(0, _Console.stopProgressIndicator)(
|
|
1701
|
+
(0, _Console.stopProgressIndicator)({
|
|
1702
|
+
message: "Resolved all dependencies.",
|
|
1703
|
+
status: 'success',
|
|
1704
|
+
state
|
|
1705
|
+
});
|
|
1392
1706
|
} else {
|
|
1393
|
-
(0, _Console.stopProgressIndicator)(
|
|
1707
|
+
(0, _Console.stopProgressIndicator)({
|
|
1708
|
+
message: "".concat(Object.keys(unresolvedJourneys).length, " journeys with unresolved dependencies:"),
|
|
1709
|
+
status: 'fail',
|
|
1710
|
+
state
|
|
1711
|
+
});
|
|
1394
1712
|
for (var journey of Object.keys(unresolvedJourneys)) {
|
|
1395
|
-
(0, _Console.printMessage)(
|
|
1713
|
+
(0, _Console.printMessage)({
|
|
1714
|
+
message: " - ".concat(journey, " requires ").concat(unresolvedJourneys[journey]),
|
|
1715
|
+
type: 'info',
|
|
1716
|
+
state
|
|
1717
|
+
});
|
|
1396
1718
|
}
|
|
1397
1719
|
}
|
|
1398
|
-
(0, _Console.createProgressIndicator)(
|
|
1720
|
+
(0, _Console.createProgressIndicator)({
|
|
1721
|
+
total: resolvedJourneys.length,
|
|
1722
|
+
message: 'Importing',
|
|
1723
|
+
state
|
|
1724
|
+
});
|
|
1399
1725
|
for (var tree of resolvedJourneys) {
|
|
1400
1726
|
try {
|
|
1401
1727
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -1404,12 +1730,22 @@ function _importAllJourneys() {
|
|
|
1404
1730
|
options,
|
|
1405
1731
|
state
|
|
1406
1732
|
});
|
|
1407
|
-
(0, _Console.updateProgressIndicator)(
|
|
1733
|
+
(0, _Console.updateProgressIndicator)({
|
|
1734
|
+
message: "".concat(tree),
|
|
1735
|
+
state
|
|
1736
|
+
});
|
|
1408
1737
|
} catch (error) {
|
|
1409
|
-
(0, _Console.printMessage)(
|
|
1738
|
+
(0, _Console.printMessage)({
|
|
1739
|
+
message: "\n".concat(error.message),
|
|
1740
|
+
type: 'error',
|
|
1741
|
+
state
|
|
1742
|
+
});
|
|
1410
1743
|
}
|
|
1411
1744
|
}
|
|
1412
|
-
(0, _Console.stopProgressIndicator)(
|
|
1745
|
+
(0, _Console.stopProgressIndicator)({
|
|
1746
|
+
message: 'Done',
|
|
1747
|
+
state
|
|
1748
|
+
});
|
|
1413
1749
|
});
|
|
1414
1750
|
return _importAllJourneys.apply(this, arguments);
|
|
1415
1751
|
}
|
|
@@ -1438,7 +1774,10 @@ function getNodeRef(nodeObj, singleTreeExport) {
|
|
|
1438
1774
|
*/
|
|
1439
1775
|
var onlineTreeExportResolver = /*#__PURE__*/function () {
|
|
1440
1776
|
var _ref8 = _asyncToGenerator(function* (treeId, state) {
|
|
1441
|
-
(0, _Console.debugMessage)(
|
|
1777
|
+
(0, _Console.debugMessage)({
|
|
1778
|
+
message: "onlineTreeExportResolver(".concat(treeId, ")"),
|
|
1779
|
+
state
|
|
1780
|
+
});
|
|
1442
1781
|
return yield exportJourney({
|
|
1443
1782
|
treeId,
|
|
1444
1783
|
options: {
|
|
@@ -1462,7 +1801,10 @@ var onlineTreeExportResolver = /*#__PURE__*/function () {
|
|
|
1462
1801
|
exports.onlineTreeExportResolver = onlineTreeExportResolver;
|
|
1463
1802
|
var fileByIdTreeExportResolver = /*#__PURE__*/function () {
|
|
1464
1803
|
var _ref9 = _asyncToGenerator(function* (treeId, state) {
|
|
1465
|
-
(0, _Console.debugMessage)(
|
|
1804
|
+
(0, _Console.debugMessage)({
|
|
1805
|
+
message: "fileByIdTreeExportResolver(".concat(treeId, ")"),
|
|
1806
|
+
state
|
|
1807
|
+
});
|
|
1466
1808
|
var treeExport = createSingleTreeExportTemplate({
|
|
1467
1809
|
state
|
|
1468
1810
|
});
|
|
@@ -1471,7 +1813,10 @@ var fileByIdTreeExportResolver = /*#__PURE__*/function () {
|
|
|
1471
1813
|
var _jsonData$tree;
|
|
1472
1814
|
var file = files.pop();
|
|
1473
1815
|
var jsonData = JSON.parse(_fs.default.readFileSync(file, 'utf8'));
|
|
1474
|
-
(0, _Console.debugMessage)(
|
|
1816
|
+
(0, _Console.debugMessage)({
|
|
1817
|
+
message: "fileByIdTreeExportResolver: resolved '".concat(treeId, "' to ").concat(file),
|
|
1818
|
+
state
|
|
1819
|
+
});
|
|
1475
1820
|
// did we resolve the tree we were asked to resolved?
|
|
1476
1821
|
if (((_jsonData$tree = jsonData.tree) === null || _jsonData$tree === void 0 ? void 0 : _jsonData$tree._id) === treeId) {
|
|
1477
1822
|
treeExport = jsonData;
|
|
@@ -1481,7 +1826,10 @@ var fileByIdTreeExportResolver = /*#__PURE__*/function () {
|
|
|
1481
1826
|
treeExport = jsonData.trees[treeId];
|
|
1482
1827
|
}
|
|
1483
1828
|
} catch (error) {
|
|
1484
|
-
(0, _Console.debugMessage)(
|
|
1829
|
+
(0, _Console.debugMessage)({
|
|
1830
|
+
message: "fileByIdTreeExportResolver: unable to resolve '".concat(treeId, "' to a file."),
|
|
1831
|
+
state
|
|
1832
|
+
});
|
|
1485
1833
|
}
|
|
1486
1834
|
return treeExport;
|
|
1487
1835
|
});
|
|
@@ -1500,7 +1848,10 @@ exports.fileByIdTreeExportResolver = fileByIdTreeExportResolver;
|
|
|
1500
1848
|
function createFileParamTreeExportResolver(file, state) {
|
|
1501
1849
|
var fileParamTreeExportResolver = /*#__PURE__*/function () {
|
|
1502
1850
|
var _ref10 = _asyncToGenerator(function* (treeId) {
|
|
1503
|
-
(0, _Console.debugMessage)(
|
|
1851
|
+
(0, _Console.debugMessage)({
|
|
1852
|
+
message: "fileParamTreeExportResolver(".concat(treeId, ")"),
|
|
1853
|
+
state
|
|
1854
|
+
});
|
|
1504
1855
|
var treeExport = createSingleTreeExportTemplate({
|
|
1505
1856
|
state
|
|
1506
1857
|
});
|
|
@@ -1528,7 +1879,10 @@ function createFileParamTreeExportResolver(file, state) {
|
|
|
1528
1879
|
return _ref10.apply(this, arguments);
|
|
1529
1880
|
};
|
|
1530
1881
|
}();
|
|
1531
|
-
(0, _Console.debugMessage)(
|
|
1882
|
+
(0, _Console.debugMessage)({
|
|
1883
|
+
message: "fileParamTreeExportResolver: file=".concat(file),
|
|
1884
|
+
state
|
|
1885
|
+
});
|
|
1532
1886
|
return fileParamTreeExportResolver;
|
|
1533
1887
|
}
|
|
1534
1888
|
|
|
@@ -1554,7 +1908,10 @@ function _getTreeDescendents() {
|
|
|
1554
1908
|
resolvedTreeIds = [],
|
|
1555
1909
|
state
|
|
1556
1910
|
} = _ref11;
|
|
1557
|
-
(0, _Console.debugMessage)(
|
|
1911
|
+
(0, _Console.debugMessage)({
|
|
1912
|
+
message: "getTreeDependencies(".concat(treeExport.tree._id, ", [").concat(resolvedTreeIds.join(', '), "])"),
|
|
1913
|
+
state
|
|
1914
|
+
});
|
|
1558
1915
|
if (!resolvedTreeIds.includes(treeExport.tree._id)) {
|
|
1559
1916
|
resolvedTreeIds.push(treeExport.tree._id);
|
|
1560
1917
|
}
|
|
@@ -1566,7 +1923,10 @@ function _getTreeDescendents() {
|
|
|
1566
1923
|
var innerTreeId = treeExport.nodes[nodeId].tree;
|
|
1567
1924
|
if (node.nodeType === 'InnerTreeEvaluatorNode' && !resolvedTreeIds.includes(innerTreeId)) {
|
|
1568
1925
|
var innerTreeExport = yield resolveTreeExport(innerTreeId, state);
|
|
1569
|
-
(0, _Console.debugMessage)(
|
|
1926
|
+
(0, _Console.debugMessage)({
|
|
1927
|
+
message: "resolved inner tree: ".concat(innerTreeExport.tree._id),
|
|
1928
|
+
state
|
|
1929
|
+
});
|
|
1570
1930
|
// resolvedTreeIds.push(innerTreeId);
|
|
1571
1931
|
dependencies.push(yield getTreeDescendents({
|
|
1572
1932
|
treeExport: innerTreeExport,
|
|
@@ -1602,14 +1962,27 @@ function _findOrphanedNodes() {
|
|
|
1602
1962
|
})).result;
|
|
1603
1963
|
var errorMessage = '';
|
|
1604
1964
|
var errorTypes = [];
|
|
1605
|
-
(0, _Console.createProgressIndicator)(
|
|
1965
|
+
(0, _Console.createProgressIndicator)({
|
|
1966
|
+
total: undefined,
|
|
1967
|
+
message: "Counting total nodes...",
|
|
1968
|
+
type: 'indeterminate',
|
|
1969
|
+
state
|
|
1970
|
+
});
|
|
1606
1971
|
try {
|
|
1607
1972
|
types = (yield (0, _NodeApi.getNodeTypes)({
|
|
1608
1973
|
state
|
|
1609
1974
|
})).result;
|
|
1610
1975
|
} catch (error) {
|
|
1611
|
-
(0, _Console.printMessage)(
|
|
1612
|
-
|
|
1976
|
+
(0, _Console.printMessage)({
|
|
1977
|
+
message: 'Error retrieving all available node types:',
|
|
1978
|
+
type: 'error',
|
|
1979
|
+
state
|
|
1980
|
+
});
|
|
1981
|
+
(0, _Console.printMessage)({
|
|
1982
|
+
message: error.response.data,
|
|
1983
|
+
type: 'error',
|
|
1984
|
+
state
|
|
1985
|
+
});
|
|
1613
1986
|
return [];
|
|
1614
1987
|
}
|
|
1615
1988
|
for (var type of types) {
|
|
@@ -1621,26 +1994,48 @@ function _findOrphanedNodes() {
|
|
|
1621
1994
|
})).result;
|
|
1622
1995
|
for (var node of nodes) {
|
|
1623
1996
|
allNodes.push(node);
|
|
1624
|
-
(0, _Console.updateProgressIndicator)(
|
|
1997
|
+
(0, _Console.updateProgressIndicator)({
|
|
1998
|
+
message: "".concat(allNodes.length, " total nodes").concat(errorMessage),
|
|
1999
|
+
state
|
|
2000
|
+
});
|
|
1625
2001
|
}
|
|
1626
2002
|
} catch (error) {
|
|
1627
2003
|
errorTypes.push(type._id);
|
|
1628
2004
|
errorMessage = " (Skipped type(s): ".concat(errorTypes, ")")['yellow'];
|
|
1629
|
-
(0, _Console.updateProgressIndicator)(
|
|
2005
|
+
(0, _Console.updateProgressIndicator)({
|
|
2006
|
+
message: "".concat(allNodes.length, " total nodes").concat(errorMessage),
|
|
2007
|
+
state
|
|
2008
|
+
});
|
|
1630
2009
|
}
|
|
1631
2010
|
}
|
|
1632
2011
|
if (errorTypes.length > 0) {
|
|
1633
|
-
(0, _Console.stopProgressIndicator)(
|
|
2012
|
+
(0, _Console.stopProgressIndicator)({
|
|
2013
|
+
message: "".concat(allNodes.length, " total nodes").concat(errorMessage),
|
|
2014
|
+
state,
|
|
2015
|
+
status: 'warn'
|
|
2016
|
+
});
|
|
1634
2017
|
} else {
|
|
1635
|
-
(0, _Console.stopProgressIndicator)(
|
|
2018
|
+
(0, _Console.stopProgressIndicator)({
|
|
2019
|
+
message: "".concat(allNodes.length, " total nodes"),
|
|
2020
|
+
status: 'success',
|
|
2021
|
+
state
|
|
2022
|
+
});
|
|
1636
2023
|
}
|
|
1637
|
-
(0, _Console.createProgressIndicator)(
|
|
2024
|
+
(0, _Console.createProgressIndicator)({
|
|
2025
|
+
total: undefined,
|
|
2026
|
+
message: 'Counting active nodes...',
|
|
2027
|
+
type: 'indeterminate',
|
|
2028
|
+
state
|
|
2029
|
+
});
|
|
1638
2030
|
var activeNodes = [];
|
|
1639
2031
|
for (var journey of allJourneys) {
|
|
1640
2032
|
for (var nodeId in journey.nodes) {
|
|
1641
2033
|
if ({}.hasOwnProperty.call(journey.nodes, nodeId)) {
|
|
1642
2034
|
activeNodes.push(nodeId);
|
|
1643
|
-
(0, _Console.updateProgressIndicator)(
|
|
2035
|
+
(0, _Console.updateProgressIndicator)({
|
|
2036
|
+
message: "".concat(activeNodes.length, " active nodes"),
|
|
2037
|
+
state
|
|
2038
|
+
});
|
|
1644
2039
|
var _node = journey.nodes[nodeId];
|
|
1645
2040
|
if (containerNodes.includes(_node.nodeType)) {
|
|
1646
2041
|
var containerNode = yield (0, _NodeApi.getNode)({
|
|
@@ -1650,19 +2045,35 @@ function _findOrphanedNodes() {
|
|
|
1650
2045
|
});
|
|
1651
2046
|
for (var innerNode of containerNode.nodes) {
|
|
1652
2047
|
activeNodes.push(innerNode._id);
|
|
1653
|
-
(0, _Console.updateProgressIndicator)(
|
|
2048
|
+
(0, _Console.updateProgressIndicator)({
|
|
2049
|
+
message: "".concat(activeNodes.length, " active nodes"),
|
|
2050
|
+
state
|
|
2051
|
+
});
|
|
1654
2052
|
}
|
|
1655
2053
|
}
|
|
1656
2054
|
}
|
|
1657
2055
|
}
|
|
1658
2056
|
}
|
|
1659
|
-
(0, _Console.stopProgressIndicator)(
|
|
1660
|
-
|
|
2057
|
+
(0, _Console.stopProgressIndicator)({
|
|
2058
|
+
message: "".concat(activeNodes.length, " active nodes"),
|
|
2059
|
+
status: 'success',
|
|
2060
|
+
state
|
|
2061
|
+
});
|
|
2062
|
+
(0, _Console.createProgressIndicator)({
|
|
2063
|
+
total: undefined,
|
|
2064
|
+
message: 'Calculating orphaned nodes...',
|
|
2065
|
+
type: 'indeterminate',
|
|
2066
|
+
state
|
|
2067
|
+
});
|
|
1661
2068
|
var diff = allNodes.filter(x => !activeNodes.includes(x._id));
|
|
1662
2069
|
for (var orphanedNode of diff) {
|
|
1663
2070
|
orphanedNodes.push(orphanedNode);
|
|
1664
2071
|
}
|
|
1665
|
-
(0, _Console.stopProgressIndicator)(
|
|
2072
|
+
(0, _Console.stopProgressIndicator)({
|
|
2073
|
+
message: "".concat(orphanedNodes.length, " orphaned nodes"),
|
|
2074
|
+
status: 'success',
|
|
2075
|
+
state
|
|
2076
|
+
});
|
|
1666
2077
|
return orphanedNodes;
|
|
1667
2078
|
});
|
|
1668
2079
|
return _findOrphanedNodes.apply(this, arguments);
|
|
@@ -1682,9 +2093,16 @@ function _removeOrphanedNodes() {
|
|
|
1682
2093
|
state
|
|
1683
2094
|
} = _ref13;
|
|
1684
2095
|
var errorNodes = [];
|
|
1685
|
-
(0, _Console.createProgressIndicator)(
|
|
2096
|
+
(0, _Console.createProgressIndicator)({
|
|
2097
|
+
total: orphanedNodes.length,
|
|
2098
|
+
message: 'Removing orphaned nodes...',
|
|
2099
|
+
state
|
|
2100
|
+
});
|
|
1686
2101
|
for (var node of orphanedNodes) {
|
|
1687
|
-
(0, _Console.updateProgressIndicator)(
|
|
2102
|
+
(0, _Console.updateProgressIndicator)({
|
|
2103
|
+
message: "Removing ".concat(node['_id'], "..."),
|
|
2104
|
+
state
|
|
2105
|
+
});
|
|
1688
2106
|
try {
|
|
1689
2107
|
// eslint-disable-next-line no-await-in-loop
|
|
1690
2108
|
yield (0, _NodeApi.deleteNode)({
|
|
@@ -1694,10 +2112,17 @@ function _removeOrphanedNodes() {
|
|
|
1694
2112
|
});
|
|
1695
2113
|
} catch (deleteError) {
|
|
1696
2114
|
errorNodes.push(node);
|
|
1697
|
-
(0, _Console.printMessage)(
|
|
2115
|
+
(0, _Console.printMessage)({
|
|
2116
|
+
message: " ".concat(deleteError),
|
|
2117
|
+
type: 'error',
|
|
2118
|
+
state
|
|
2119
|
+
});
|
|
1698
2120
|
}
|
|
1699
2121
|
}
|
|
1700
|
-
(0, _Console.stopProgressIndicator)(
|
|
2122
|
+
(0, _Console.stopProgressIndicator)({
|
|
2123
|
+
message: "Removed ".concat(orphanedNodes.length, " orphaned nodes."),
|
|
2124
|
+
state
|
|
2125
|
+
});
|
|
1701
2126
|
return errorNodes;
|
|
1702
2127
|
});
|
|
1703
2128
|
return _removeOrphanedNodes.apply(this, arguments);
|
|
@@ -1771,13 +2196,13 @@ function getJourneyClassification(_ref15) {
|
|
|
1771
2196
|
});
|
|
1772
2197
|
var cloud = isCloudOnlyJourney(journey);
|
|
1773
2198
|
if (custom) {
|
|
1774
|
-
classifications.push(
|
|
2199
|
+
classifications.push(JourneyClassification.CUSTOM);
|
|
1775
2200
|
} else if (cloud) {
|
|
1776
|
-
classifications.push(
|
|
2201
|
+
classifications.push(JourneyClassification.CLOUD);
|
|
1777
2202
|
} else {
|
|
1778
|
-
classifications.push(
|
|
2203
|
+
classifications.push(JourneyClassification.STANDARD);
|
|
1779
2204
|
}
|
|
1780
|
-
if (premium) classifications.push(
|
|
2205
|
+
if (premium) classifications.push(JourneyClassification.PREMIUM);
|
|
1781
2206
|
return classifications;
|
|
1782
2207
|
}
|
|
1783
2208
|
|
|
@@ -1808,8 +2233,15 @@ function _deleteJourney() {
|
|
|
1808
2233
|
var status = {
|
|
1809
2234
|
nodes: {}
|
|
1810
2235
|
};
|
|
1811
|
-
if (progress) (0, _Console.createProgressIndicator)(
|
|
1812
|
-
|
|
2236
|
+
if (progress) (0, _Console.createProgressIndicator)({
|
|
2237
|
+
total: undefined,
|
|
2238
|
+
message: "Deleting ".concat(journeyId, "..."),
|
|
2239
|
+
type: 'indeterminate',
|
|
2240
|
+
state
|
|
2241
|
+
});
|
|
2242
|
+
if (progress && verbose) (0, _Console.stopProgressIndicator)({
|
|
2243
|
+
state
|
|
2244
|
+
});
|
|
1813
2245
|
return (0, _TreeApi.deleteTree)({
|
|
1814
2246
|
treeId: journeyId,
|
|
1815
2247
|
state
|
|
@@ -1817,7 +2249,11 @@ function _deleteJourney() {
|
|
|
1817
2249
|
var _ref20 = _asyncToGenerator(function* (deleteTreeResponse) {
|
|
1818
2250
|
status['status'] = 'success';
|
|
1819
2251
|
var nodePromises = [];
|
|
1820
|
-
if (verbose) (0, _Console.printMessage)(
|
|
2252
|
+
if (verbose) (0, _Console.printMessage)({
|
|
2253
|
+
message: "Deleted ".concat(journeyId, " (tree)"),
|
|
2254
|
+
type: 'info',
|
|
2255
|
+
state
|
|
2256
|
+
});
|
|
1821
2257
|
if (deep) {
|
|
1822
2258
|
var _loop2 = function* _loop2(nodeId, nodeObject) {
|
|
1823
2259
|
// delete inner nodes (nodes inside container nodes)
|
|
@@ -1829,7 +2265,11 @@ function _deleteJourney() {
|
|
|
1829
2265
|
nodeType: nodeObject['nodeType'],
|
|
1830
2266
|
state
|
|
1831
2267
|
});
|
|
1832
|
-
if (verbose) (0, _Console.printMessage)(
|
|
2268
|
+
if (verbose) (0, _Console.printMessage)({
|
|
2269
|
+
message: "Read ".concat(nodeId, " (").concat(nodeObject['nodeType'], ") from ").concat(journeyId),
|
|
2270
|
+
type: 'info',
|
|
2271
|
+
state
|
|
2272
|
+
});
|
|
1833
2273
|
var _loop3 = function* _loop3(innerNodeObject) {
|
|
1834
2274
|
nodePromises.push((0, _NodeApi.deleteNode)({
|
|
1835
2275
|
nodeId: innerNodeObject._id,
|
|
@@ -1839,14 +2279,22 @@ function _deleteJourney() {
|
|
|
1839
2279
|
status.nodes[innerNodeObject._id] = {
|
|
1840
2280
|
status: 'success'
|
|
1841
2281
|
};
|
|
1842
|
-
if (verbose) (0, _Console.printMessage)(
|
|
2282
|
+
if (verbose) (0, _Console.printMessage)({
|
|
2283
|
+
message: "Deleted ".concat(innerNodeObject._id, " (").concat(innerNodeObject.nodeType, ") from ").concat(journeyId),
|
|
2284
|
+
type: 'info',
|
|
2285
|
+
state
|
|
2286
|
+
});
|
|
1843
2287
|
return response2;
|
|
1844
2288
|
}).catch(error => {
|
|
1845
2289
|
status.nodes[innerNodeObject._id] = {
|
|
1846
2290
|
status: 'error',
|
|
1847
2291
|
error
|
|
1848
2292
|
};
|
|
1849
|
-
if (verbose) (0, _Console.printMessage)(
|
|
2293
|
+
if (verbose) (0, _Console.printMessage)({
|
|
2294
|
+
message: "Error deleting inner node ".concat(innerNodeObject._id, " (").concat(innerNodeObject.nodeType, ") from ").concat(journeyId, ": ").concat(error),
|
|
2295
|
+
type: 'error',
|
|
2296
|
+
state
|
|
2297
|
+
});
|
|
1850
2298
|
}));
|
|
1851
2299
|
};
|
|
1852
2300
|
for (var innerNodeObject of containerNode.nodes) {
|
|
@@ -1861,7 +2309,11 @@ function _deleteJourney() {
|
|
|
1861
2309
|
status.nodes[containerNode._id] = {
|
|
1862
2310
|
status: 'success'
|
|
1863
2311
|
};
|
|
1864
|
-
if (verbose) (0, _Console.printMessage)(
|
|
2312
|
+
if (verbose) (0, _Console.printMessage)({
|
|
2313
|
+
message: "Deleted ".concat(containerNode._id, " (").concat(containerNode['_type']['_id'], ") from ").concat(journeyId),
|
|
2314
|
+
type: 'info',
|
|
2315
|
+
state
|
|
2316
|
+
});
|
|
1865
2317
|
return response2;
|
|
1866
2318
|
}).catch(error => {
|
|
1867
2319
|
var _error$response, _error$response$data;
|
|
@@ -1869,17 +2321,29 @@ function _deleteJourney() {
|
|
|
1869
2321
|
status.nodes[containerNode._id] = {
|
|
1870
2322
|
status: 'success'
|
|
1871
2323
|
};
|
|
1872
|
-
if (verbose) (0, _Console.printMessage)(
|
|
2324
|
+
if (verbose) (0, _Console.printMessage)({
|
|
2325
|
+
message: "Deleted ".concat(containerNode._id, " (").concat(containerNode['_type']['_id'], ") from ").concat(journeyId),
|
|
2326
|
+
type: 'info',
|
|
2327
|
+
state
|
|
2328
|
+
});
|
|
1873
2329
|
} else {
|
|
1874
2330
|
status.nodes[containerNode._id] = {
|
|
1875
2331
|
status: 'error',
|
|
1876
2332
|
error
|
|
1877
2333
|
};
|
|
1878
|
-
if (verbose) (0, _Console.printMessage)(
|
|
2334
|
+
if (verbose) (0, _Console.printMessage)({
|
|
2335
|
+
message: "Error deleting container node ".concat(containerNode._id, " (").concat(containerNode['_type']['_id'], ") from ").concat(journeyId, ": ").concat(error.response.data.message),
|
|
2336
|
+
type: 'error',
|
|
2337
|
+
state
|
|
2338
|
+
});
|
|
1879
2339
|
}
|
|
1880
2340
|
}));
|
|
1881
2341
|
} catch (error) {
|
|
1882
|
-
if (verbose) (0, _Console.printMessage)(
|
|
2342
|
+
if (verbose) (0, _Console.printMessage)({
|
|
2343
|
+
message: "Error getting container node ".concat(nodeId, " (").concat(nodeObject['nodeType'], ") from ").concat(journeyId, ": ").concat(error),
|
|
2344
|
+
type: 'error',
|
|
2345
|
+
state
|
|
2346
|
+
});
|
|
1883
2347
|
}
|
|
1884
2348
|
} else {
|
|
1885
2349
|
// delete the node
|
|
@@ -1891,14 +2355,22 @@ function _deleteJourney() {
|
|
|
1891
2355
|
status.nodes[nodeId] = {
|
|
1892
2356
|
status: 'success'
|
|
1893
2357
|
};
|
|
1894
|
-
if (verbose) (0, _Console.printMessage)(
|
|
2358
|
+
if (verbose) (0, _Console.printMessage)({
|
|
2359
|
+
message: "Deleted ".concat(nodeId, " (").concat(nodeObject['nodeType'], ") from ").concat(journeyId),
|
|
2360
|
+
type: 'info',
|
|
2361
|
+
state
|
|
2362
|
+
});
|
|
1895
2363
|
return response;
|
|
1896
2364
|
}).catch(error => {
|
|
1897
2365
|
status.nodes[nodeId] = {
|
|
1898
2366
|
status: 'error',
|
|
1899
2367
|
error
|
|
1900
2368
|
};
|
|
1901
|
-
if (verbose) (0, _Console.printMessage)(
|
|
2369
|
+
if (verbose) (0, _Console.printMessage)({
|
|
2370
|
+
message: "Error deleting node ".concat(nodeId, " (").concat(nodeObject['nodeType'], ") from ").concat(journeyId, ": ").concat(error),
|
|
2371
|
+
type: 'error',
|
|
2372
|
+
state
|
|
2373
|
+
});
|
|
1902
2374
|
}));
|
|
1903
2375
|
}
|
|
1904
2376
|
};
|
|
@@ -1918,9 +2390,17 @@ function _deleteJourney() {
|
|
|
1918
2390
|
if (status.nodes[node].status === 'error') errorCount += 1;
|
|
1919
2391
|
}
|
|
1920
2392
|
if (errorCount === 0) {
|
|
1921
|
-
(0, _Console.stopProgressIndicator)(
|
|
2393
|
+
(0, _Console.stopProgressIndicator)({
|
|
2394
|
+
message: "Deleted ".concat(journeyId, " and ").concat(nodeCount - errorCount, "/").concat(nodeCount, " nodes."),
|
|
2395
|
+
status: 'success',
|
|
2396
|
+
state
|
|
2397
|
+
});
|
|
1922
2398
|
} else {
|
|
1923
|
-
(0, _Console.stopProgressIndicator)(
|
|
2399
|
+
(0, _Console.stopProgressIndicator)({
|
|
2400
|
+
message: "Deleted ".concat(journeyId, " and ").concat(nodeCount - errorCount, "/").concat(nodeCount, " nodes."),
|
|
2401
|
+
status: 'fail',
|
|
2402
|
+
state
|
|
2403
|
+
});
|
|
1924
2404
|
}
|
|
1925
2405
|
}
|
|
1926
2406
|
return status;
|
|
@@ -1931,8 +2411,16 @@ function _deleteJourney() {
|
|
|
1931
2411
|
}()).catch(error => {
|
|
1932
2412
|
status['status'] = 'error';
|
|
1933
2413
|
status['error'] = error;
|
|
1934
|
-
(0, _Console.stopProgressIndicator)(
|
|
1935
|
-
|
|
2414
|
+
(0, _Console.stopProgressIndicator)({
|
|
2415
|
+
message: "Error deleting ".concat(journeyId, "."),
|
|
2416
|
+
status: 'fail',
|
|
2417
|
+
state
|
|
2418
|
+
});
|
|
2419
|
+
if (verbose) (0, _Console.printMessage)({
|
|
2420
|
+
message: "Error deleting tree ".concat(journeyId, ": ").concat(error),
|
|
2421
|
+
type: 'error',
|
|
2422
|
+
state
|
|
2423
|
+
});
|
|
1936
2424
|
return status;
|
|
1937
2425
|
});
|
|
1938
2426
|
});
|
|
@@ -1959,16 +2447,26 @@ function _deleteJourneys() {
|
|
|
1959
2447
|
var trees = (yield (0, _TreeApi.getTrees)({
|
|
1960
2448
|
state
|
|
1961
2449
|
})).result;
|
|
1962
|
-
(0, _Console.createProgressIndicator)(
|
|
2450
|
+
(0, _Console.createProgressIndicator)({
|
|
2451
|
+
total: trees.length,
|
|
2452
|
+
message: 'Deleting journeys...',
|
|
2453
|
+
state
|
|
2454
|
+
});
|
|
1963
2455
|
for (var tree of trees) {
|
|
1964
|
-
if (verbose) (0, _Console.printMessage)(
|
|
2456
|
+
if (verbose) (0, _Console.printMessage)({
|
|
2457
|
+
message: '',
|
|
2458
|
+
state
|
|
2459
|
+
});
|
|
1965
2460
|
options['progress'] = false;
|
|
1966
2461
|
status[tree._id] = yield deleteJourney({
|
|
1967
2462
|
journeyId: tree._id,
|
|
1968
2463
|
options,
|
|
1969
2464
|
state
|
|
1970
2465
|
});
|
|
1971
|
-
(0, _Console.updateProgressIndicator)(
|
|
2466
|
+
(0, _Console.updateProgressIndicator)({
|
|
2467
|
+
message: "".concat(tree._id),
|
|
2468
|
+
state
|
|
2469
|
+
});
|
|
1972
2470
|
// introduce a 100ms wait to allow the progress bar to update before the next verbose message prints from the async function
|
|
1973
2471
|
if (verbose)
|
|
1974
2472
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -1988,7 +2486,10 @@ function _deleteJourneys() {
|
|
|
1988
2486
|
if (status[journey].nodes[node].status === 'error') nodeErrorCount += 1;
|
|
1989
2487
|
}
|
|
1990
2488
|
}
|
|
1991
|
-
(0, _Console.stopProgressIndicator)(
|
|
2489
|
+
(0, _Console.stopProgressIndicator)({
|
|
2490
|
+
message: "Deleted ".concat(journeyCount - journeyErrorCount, "/").concat(journeyCount, " journeys and ").concat(nodeCount - nodeErrorCount, "/").concat(nodeCount, " nodes."),
|
|
2491
|
+
state
|
|
2492
|
+
});
|
|
1992
2493
|
return status;
|
|
1993
2494
|
});
|
|
1994
2495
|
return _deleteJourneys.apply(this, arguments);
|
|
@@ -2021,7 +2522,11 @@ function _enableJourney() {
|
|
|
2021
2522
|
});
|
|
2022
2523
|
return newTreeObject['enabled'] === true;
|
|
2023
2524
|
} catch (error) {
|
|
2024
|
-
(0, _Console.printMessage)(
|
|
2525
|
+
(0, _Console.printMessage)({
|
|
2526
|
+
message: error.response.data,
|
|
2527
|
+
type: 'error',
|
|
2528
|
+
state
|
|
2529
|
+
});
|
|
2025
2530
|
return false;
|
|
2026
2531
|
}
|
|
2027
2532
|
});
|
|
@@ -2050,7 +2555,11 @@ function _disableJourney() {
|
|
|
2050
2555
|
});
|
|
2051
2556
|
return newTreeObject['enabled'] === false;
|
|
2052
2557
|
} catch (error) {
|
|
2053
|
-
(0, _Console.printMessage)(
|
|
2558
|
+
(0, _Console.printMessage)({
|
|
2559
|
+
message: error.response.data,
|
|
2560
|
+
type: 'error',
|
|
2561
|
+
state
|
|
2562
|
+
});
|
|
2054
2563
|
return false;
|
|
2055
2564
|
}
|
|
2056
2565
|
});
|