@rockcarver/frodo-cli 2.0.0-32 → 2.0.0-34

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.
Files changed (158) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/esm/cli/FrodoCommand.js +8 -1
  3. package/esm/cli/FrodoCommand.js.map +1 -1
  4. package/esm/cli/admin/admin-execute-rfc7523-authz-grant-flow.js +41 -0
  5. package/esm/cli/admin/admin-execute-rfc7523-authz-grant-flow.js.map +1 -0
  6. package/esm/cli/admin/admin-export-full-cloud-config.js +44 -0
  7. package/esm/cli/admin/admin-export-full-cloud-config.js.map +1 -0
  8. package/esm/cli/admin/admin-generate-rfc7523-authz-grant-artifacts.js +43 -0
  9. package/esm/cli/admin/admin-generate-rfc7523-authz-grant-artifacts.js.map +1 -0
  10. package/esm/cli/admin/admin.js +3 -0
  11. package/esm/cli/admin/admin.js.map +1 -1
  12. package/esm/cli/authz/authz-policy-export.js +1 -1
  13. package/esm/cli/authz/authz-policy-export.js.map +1 -1
  14. package/esm/cli/authz/authz-policy-import.js +1 -1
  15. package/esm/cli/authz/authz-policy-import.js.map +1 -1
  16. package/esm/cli/authz/authz-policy-list.js +2 -2
  17. package/esm/cli/authz/authz-policy-list.js.map +1 -1
  18. package/esm/cli/authz/authz-set-delete.js +2 -2
  19. package/esm/cli/authz/authz-set-delete.js.map +1 -1
  20. package/esm/cli/authz/authz-set-export.js +1 -1
  21. package/esm/cli/authz/authz-set-export.js.map +1 -1
  22. package/esm/cli/authz/authz-set-import.js +1 -1
  23. package/esm/cli/authz/authz-set-import.js.map +1 -1
  24. package/esm/cli/authz/authz-set-list.js +1 -1
  25. package/esm/cli/authz/authz-set-list.js.map +1 -1
  26. package/esm/cli/authz/authz-type-delete.js +3 -3
  27. package/esm/cli/authz/authz-type-delete.js.map +1 -1
  28. package/esm/cli/authz/authz-type-export.js +2 -2
  29. package/esm/cli/authz/authz-type-export.js.map +1 -1
  30. package/esm/cli/authz/authz-type-import.js +2 -2
  31. package/esm/cli/authz/authz-type-import.js.map +1 -1
  32. package/esm/cli/authz/authz-type-list.js +1 -1
  33. package/esm/cli/authz/authz-type-list.js.map +1 -1
  34. package/esm/cli/email/email-template-export.js +3 -3
  35. package/esm/cli/email/email-template-export.js.map +1 -1
  36. package/esm/cli/email/email-template-import.js +4 -4
  37. package/esm/cli/email/email-template-import.js.map +1 -1
  38. package/esm/cli/email/email-template-list.js +1 -1
  39. package/esm/cli/email/email-template-list.js.map +1 -1
  40. package/esm/cli/esv/esv-secret-create.js +2 -1
  41. package/esm/cli/esv/esv-secret-create.js.map +1 -1
  42. package/esm/cli/esv/esv-secret-delete.js +4 -3
  43. package/esm/cli/esv/esv-secret-delete.js.map +1 -1
  44. package/esm/cli/esv/esv-secret-describe.js +2 -1
  45. package/esm/cli/esv/esv-secret-describe.js.map +1 -1
  46. package/esm/cli/esv/esv-secret-export.js +6 -4
  47. package/esm/cli/esv/esv-secret-export.js.map +1 -1
  48. package/esm/cli/esv/esv-secret-list.js +2 -1
  49. package/esm/cli/esv/esv-secret-list.js.map +1 -1
  50. package/esm/cli/esv/esv-secret-set.js +2 -1
  51. package/esm/cli/esv/esv-secret-set.js.map +1 -1
  52. package/esm/cli/esv/esv-secret-version-activate.js +2 -2
  53. package/esm/cli/esv/esv-secret-version-activate.js.map +1 -1
  54. package/esm/cli/esv/esv-secret-version-create.js +2 -1
  55. package/esm/cli/esv/esv-secret-version-create.js.map +1 -1
  56. package/esm/cli/esv/esv-secret-version-deactivate.js +2 -2
  57. package/esm/cli/esv/esv-secret-version-deactivate.js.map +1 -1
  58. package/esm/cli/esv/esv-secret-version-delete.js +4 -3
  59. package/esm/cli/esv/esv-secret-version-delete.js.map +1 -1
  60. package/esm/cli/esv/esv-secret-version-list.js +2 -1
  61. package/esm/cli/esv/esv-secret-version-list.js.map +1 -1
  62. package/esm/cli/esv/esv-variable-create.js +2 -1
  63. package/esm/cli/esv/esv-variable-create.js.map +1 -1
  64. package/esm/cli/esv/esv-variable-delete.js +4 -2
  65. package/esm/cli/esv/esv-variable-delete.js.map +1 -1
  66. package/esm/cli/esv/esv-variable-describe.js +2 -1
  67. package/esm/cli/esv/esv-variable-describe.js.map +1 -1
  68. package/esm/cli/esv/esv-variable-export.js +6 -3
  69. package/esm/cli/esv/esv-variable-export.js.map +1 -1
  70. package/esm/cli/esv/esv-variable-list.js +2 -1
  71. package/esm/cli/esv/esv-variable-list.js.map +1 -1
  72. package/esm/cli/esv/esv-variable-set.js +4 -2
  73. package/esm/cli/esv/esv-variable-set.js.map +1 -1
  74. package/esm/cli/idm/idm-count.js +1 -1
  75. package/esm/cli/idm/idm-count.js.map +1 -1
  76. package/esm/cli/idm/idm-export.js +3 -3
  77. package/esm/cli/idm/idm-export.js.map +1 -1
  78. package/esm/cli/idm/idm-list.js +2 -2
  79. package/esm/cli/idm/idm-list.js.map +1 -1
  80. package/esm/cli/idp/idp-export.js +3 -3
  81. package/esm/cli/idp/idp-export.js.map +1 -1
  82. package/esm/cli/idp/idp-import.js +4 -4
  83. package/esm/cli/idp/idp-import.js.map +1 -1
  84. package/esm/cli/idp/idp-list.js +1 -1
  85. package/esm/cli/idp/idp-list.js.map +1 -1
  86. package/esm/cli/journey/journey-delete.js +6 -2
  87. package/esm/cli/journey/journey-delete.js.map +1 -1
  88. package/esm/cli/journey/journey-disable.js +4 -10
  89. package/esm/cli/journey/journey-disable.js.map +1 -1
  90. package/esm/cli/journey/journey-enable.js +4 -10
  91. package/esm/cli/journey/journey-enable.js.map +1 -1
  92. package/esm/cli/journey/journey-import.js +4 -4
  93. package/esm/cli/journey/journey-import.js.map +1 -1
  94. package/esm/cli/journey/journey-list.js +1 -1
  95. package/esm/cli/journey/journey-list.js.map +1 -1
  96. package/esm/cli/saml/saml-cot-export.js +3 -3
  97. package/esm/cli/saml/saml-cot-export.js.map +1 -1
  98. package/esm/cli/saml/saml-cot-list.js +1 -1
  99. package/esm/cli/saml/saml-cot-list.js.map +1 -1
  100. package/esm/cli/saml/saml-describe.js +1 -1
  101. package/esm/cli/saml/saml-describe.js.map +1 -1
  102. package/esm/cli/saml/saml-import.js +4 -4
  103. package/esm/cli/saml/saml-import.js.map +1 -1
  104. package/esm/cli/saml/saml-list.js +1 -1
  105. package/esm/cli/saml/saml-list.js.map +1 -1
  106. package/esm/cli/saml/saml-metadata-export.js +1 -1
  107. package/esm/cli/saml/saml-metadata-export.js.map +1 -1
  108. package/esm/cli/script/script-export.js +2 -6
  109. package/esm/cli/script/script-export.js.map +1 -1
  110. package/esm/cli/theme/theme-delete.js +3 -3
  111. package/esm/cli/theme/theme-delete.js.map +1 -1
  112. package/esm/cli/theme/theme-export.js +4 -4
  113. package/esm/cli/theme/theme-export.js.map +1 -1
  114. package/esm/cli/theme/theme-import.js +4 -4
  115. package/esm/cli/theme/theme-import.js.map +1 -1
  116. package/esm/cli/theme/theme-list.js +1 -1
  117. package/esm/cli/theme/theme-list.js.map +1 -1
  118. package/esm/ops/AdminFederationOps.js +28 -26
  119. package/esm/ops/AdminFederationOps.js.map +1 -1
  120. package/esm/ops/AdminOps.js +241 -0
  121. package/esm/ops/AdminOps.js.map +1 -0
  122. package/esm/ops/AgentOps.js +59 -51
  123. package/esm/ops/AgentOps.js.map +1 -1
  124. package/esm/ops/ApplicationOps.js +19 -13
  125. package/esm/ops/ApplicationOps.js.map +1 -1
  126. package/esm/ops/CirclesOfTrustOps.js +28 -26
  127. package/esm/ops/CirclesOfTrustOps.js.map +1 -1
  128. package/esm/ops/EmailTemplateOps.js +78 -94
  129. package/esm/ops/EmailTemplateOps.js.map +1 -1
  130. package/esm/ops/IdmOps.js +8 -31
  131. package/esm/ops/IdmOps.js.map +1 -1
  132. package/esm/ops/IdpOps.js +49 -54
  133. package/esm/ops/IdpOps.js.map +1 -1
  134. package/esm/ops/JourneyOps.js +91 -70
  135. package/esm/ops/JourneyOps.js.map +1 -1
  136. package/esm/ops/OAuth2ClientOps.js +13 -11
  137. package/esm/ops/OAuth2ClientOps.js.map +1 -1
  138. package/esm/ops/PolicyOps.js +31 -26
  139. package/esm/ops/PolicyOps.js.map +1 -1
  140. package/esm/ops/PolicySetOps.js +42 -39
  141. package/esm/ops/PolicySetOps.js.map +1 -1
  142. package/esm/ops/ResourceTypeOps.js +19 -16
  143. package/esm/ops/ResourceTypeOps.js.map +1 -1
  144. package/esm/ops/Saml2Ops.js +49 -45
  145. package/esm/ops/Saml2Ops.js.map +1 -1
  146. package/esm/ops/ScriptOps.js +36 -55
  147. package/esm/ops/ScriptOps.js.map +1 -1
  148. package/esm/ops/SecretsOps.js +159 -60
  149. package/esm/ops/SecretsOps.js.map +1 -1
  150. package/esm/ops/ThemeOps.js +111 -130
  151. package/esm/ops/ThemeOps.js.map +1 -1
  152. package/esm/ops/VariablesOps.js +126 -56
  153. package/esm/ops/VariablesOps.js.map +1 -1
  154. package/esm/utils/Console.js +69 -30
  155. package/esm/utils/Console.js.map +1 -1
  156. package/esm/utils/ExportImportUtils.js +4 -12
  157. package/esm/utils/ExportImportUtils.js.map +1 -1
  158. package/package.json +10 -2
@@ -1,6 +1,6 @@
1
1
  import { frodo, state } from '@rockcarver/frodo-lib';
2
2
  import fs from 'fs';
3
- import { createProgressBar, createTable, debugMessage, failSpinner, printMessage, showSpinner, stopProgressBar, succeedSpinner, updateProgressBar } from '../utils/Console';
3
+ import { createProgressIndicator, createTable, debugMessage, printMessage, stopProgressIndicator, updateProgressIndicator } from '../utils/Console';
4
4
  import * as CirclesOfTrust from './CirclesOfTrustOps';
5
5
  import * as EmailTemplate from './EmailTemplateOps';
6
6
  import * as Idp from './IdpOps';
@@ -20,14 +20,16 @@ const {
20
20
  const {
21
21
  readJourneys,
22
22
  exportJourney,
23
- createMultiTreeExportTemplate,
23
+ exportJourneys,
24
24
  resolveDependencies,
25
25
  importJourneys,
26
26
  importJourney,
27
27
  getTreeDescendents,
28
28
  getNodeRef,
29
29
  onlineTreeExportResolver,
30
- getJourneyClassification: _getJourneyClassification
30
+ getJourneyClassification: _getJourneyClassification,
31
+ disableJourney: _disableJourney,
32
+ enableJourney: _enableJourney
31
33
  } = frodo.authn.journey;
32
34
 
33
35
  /**
@@ -53,7 +55,7 @@ export async function listJourneys(long = false, analyze = false) {
53
55
  }
54
56
  printMessage(table.toString(), 'data');
55
57
  } else {
56
- showSpinner('Retrieving details of all journeys...');
58
+ const spinnerId = createProgressIndicator('indeterminate', 0, `Retrieving details of all journeys...`);
57
59
  const exportPromises = [];
58
60
  try {
59
61
  for (const journeyStub of journeys) {
@@ -63,7 +65,7 @@ export async function listJourneys(long = false, analyze = false) {
63
65
  }));
64
66
  }
65
67
  const journeyExports = await Promise.all(exportPromises);
66
- succeedSpinner('Retrieved details of all journeys.');
68
+ stopProgressIndicator(spinnerId, 'Retrieved details of all journeys.', 'success');
67
69
  const table = createTable(['Name', 'Status', 'Classification', 'Tags']);
68
70
  for (const journeyExport of journeyExports) {
69
71
  var _journeyExport$tree$u;
@@ -71,7 +73,7 @@ export async function listJourneys(long = false, analyze = false) {
71
73
  }
72
74
  printMessage(table.toString(), 'data');
73
75
  } catch (error) {
74
- failSpinner('Error retrieving details of all journeys.');
76
+ stopProgressIndicator(spinnerId, 'Error retrieving details of all journeys.', 'fail');
75
77
  printMessage(error.response.data, 'error');
76
78
  }
77
79
  }
@@ -96,15 +98,16 @@ export async function exportJourneyToFile(journeyId, file, options) {
96
98
  file = getTypedFilename(journeyId, 'journey');
97
99
  }
98
100
  const filePath = getFilePath(file, true);
99
- if (!verbose) showSpinner(`${journeyId}`);
101
+ let spinnerId;
102
+ if (!verbose) spinnerId = createProgressIndicator('indeterminate', 0, `${journeyId}`);
100
103
  try {
101
104
  const fileData = await exportJourney(journeyId, options);
102
- if (verbose) showSpinner(`${journeyId}`);
105
+ if (verbose) spinnerId = createProgressIndicator('indeterminate', 0, `${journeyId}`);
103
106
  saveJsonToFile(fileData, filePath);
104
- succeedSpinner(`Exported ${journeyId['brightCyan']} to ${filePath['brightCyan']}.`);
107
+ stopProgressIndicator(spinnerId, `Exported ${journeyId['brightCyan']} to ${filePath['brightCyan']}.`, 'success');
105
108
  } catch (error) {
106
- if (verbose) showSpinner(`${journeyId}`);
107
- failSpinner(`Error exporting journey ${journeyId}: ${error}`);
109
+ if (verbose) spinnerId = createProgressIndicator('indeterminate', 0, `${journeyId}`);
110
+ stopProgressIndicator(spinnerId, `Error exporting journey ${journeyId}: ${error}`, 'fail');
108
111
  }
109
112
  }
110
113
 
@@ -121,21 +124,8 @@ export async function exportJourneysToFile(file, options = {
121
124
  file = getTypedFilename(`all${getRealmString()}Journeys`, 'journey');
122
125
  }
123
126
  const filePath = getFilePath(file, true);
124
- const trees = await readJourneys();
125
- const fileData = createMultiTreeExportTemplate();
126
- createProgressBar(trees.length, 'Exporting journeys...');
127
- for (const tree of trees) {
128
- updateProgressBar(`${tree._id}`);
129
- try {
130
- const exportData = await exportJourney(tree._id, options);
131
- delete exportData.meta;
132
- fileData.trees[tree._id] = exportData;
133
- } catch (error) {
134
- printMessage(`Error exporting journey ${tree._id}: ${error}`, 'error');
135
- }
136
- }
127
+ const fileData = await exportJourneys(options);
137
128
  saveJsonToFile(fileData, filePath);
138
- stopProgressBar(`Exported to ${filePath}`);
139
129
  }
140
130
 
141
131
  /**
@@ -143,19 +133,20 @@ export async function exportJourneysToFile(file, options = {
143
133
  * @param {TreeExportOptions} options export options
144
134
  */
145
135
  export async function exportJourneysToFiles(options) {
146
- const trees = await readJourneys();
147
- createProgressBar(trees.length, 'Exporting journeys...');
148
- for (const tree of trees) {
149
- updateProgressBar(`${tree._id}`);
150
- const fileName = getTypedFilename(`${tree._id}`, 'journey');
136
+ const journeysExport = await exportJourneys(options);
137
+ const trees = Object.entries(journeysExport.trees);
138
+ for (const [treeId, treeValue] of trees) {
139
+ const indicatorId = createProgressIndicator('determinate', 1, `Saving ${treeId}...`);
140
+ const file = getFilePath(getTypedFilename(`${treeId}`, 'journey'), true);
141
+ treeValue['meta'] = journeysExport.meta;
151
142
  try {
152
- const exportData = await exportJourney(tree._id, options);
153
- saveJsonToFile(exportData, getFilePath(fileName, true));
143
+ updateProgressIndicator(indicatorId, `Saving ${treeId} to ${file}`);
144
+ saveJsonToFile(treeValue, file);
145
+ stopProgressIndicator(indicatorId, `${treeId} saved to ${file}`);
154
146
  } catch (error) {
155
- // do we need to report status here?
147
+ stopProgressIndicator(indicatorId, `Error saving ${treeId} to ${file}`);
156
148
  }
157
149
  }
158
- stopProgressBar('Done');
159
150
  }
160
151
 
161
152
  /**
@@ -166,8 +157,8 @@ export async function exportJourneysToFiles(options) {
166
157
  */
167
158
  export async function importJourneyFromFile(journeyId, file, options) {
168
159
  const verbose = state.getVerbose();
169
- fs.readFile(getFilePath(file), 'utf8', async (err, data) => {
170
- if (err) throw err;
160
+ try {
161
+ const data = fs.readFileSync(getFilePath(file), 'utf8');
171
162
  let journeyData = JSON.parse(data);
172
163
  // check if this is a file with multiple trees and get journey by id
173
164
  if (journeyData.trees && journeyData.trees[journeyId]) {
@@ -182,32 +173,36 @@ export async function importJourneyFromFile(journeyId, file, options) {
182
173
  const installedJourneys = (await readJourneys()).map(x => x._id);
183
174
  const unresolvedJourneys = {};
184
175
  const resolvedJourneys = [];
185
- showSpinner('Resolving dependencies');
176
+ const indicatorId1 = createProgressIndicator('indeterminate', 0, 'Resolving dependencies');
186
177
  await resolveDependencies(installedJourneys, {
187
178
  [journeyId]: journeyData
188
179
  }, unresolvedJourneys, resolvedJourneys);
189
180
  if (Object.keys(unresolvedJourneys).length === 0) {
190
- succeedSpinner(`Resolved all dependencies.`);
191
- if (!verbose) showSpinner(`Importing ${journeyId}...`);
192
- importJourney(journeyData, options).then(() => {
193
- if (verbose) showSpinner(`Importing ${journeyId}...`);
194
- succeedSpinner(`Imported ${journeyId}.`);
195
- }).catch(importError => {
196
- if (verbose) showSpinner(`Importing ${journeyId}...`);
197
- failSpinner(`${importError}`);
198
- });
181
+ stopProgressIndicator(indicatorId1, `Resolved all dependencies.`, 'success');
182
+ let indicatorId2;
183
+ if (!verbose) indicatorId2 = createProgressIndicator('indeterminate', 0, `Importing ${journeyId}...`);
184
+ try {
185
+ await importJourney(journeyData, options);
186
+ if (verbose) indicatorId2 = createProgressIndicator('indeterminate', 0, `Importing ${journeyId}...`);
187
+ stopProgressIndicator(indicatorId2, `Imported ${journeyId}.`, 'success');
188
+ } catch (importError) {
189
+ if (verbose) indicatorId2 = createProgressIndicator('indeterminate', 0, `Importing ${journeyId}...`);
190
+ stopProgressIndicator(indicatorId2, `${importError}`, 'fail');
191
+ }
199
192
  } else {
200
- failSpinner(`Unresolved dependencies:`);
193
+ stopProgressIndicator(indicatorId1, `Unresolved dependencies:`, 'fail');
201
194
  for (const journey of Object.keys(unresolvedJourneys)) {
202
195
  printMessage(` ${journey} requires ${unresolvedJourneys[journey]}`, 'error');
203
196
  }
204
197
  }
205
198
  // end dependency resolution for single tree import
206
199
  } else {
207
- showSpinner(`Importing ${journeyId}...`);
208
- failSpinner(`${journeyId} not found!`);
200
+ const indicatorId3 = createProgressIndicator('indeterminate', 0, `Importing ${journeyId}...`);
201
+ stopProgressIndicator(indicatorId3, `${journeyId} not found!`, 'fail');
209
202
  }
210
- });
203
+ } catch (error) {
204
+ printMessage(`Error importing journey ${journeyId}: ${error}`, 'error');
205
+ }
211
206
  }
212
207
 
213
208
  /**
@@ -217,8 +212,8 @@ export async function importJourneyFromFile(journeyId, file, options) {
217
212
  */
218
213
  export async function importFirstJourneyFromFile(file, options) {
219
214
  const verbose = state.getVerbose();
220
- fs.readFile(getFilePath(file), 'utf8', async (err, data) => {
221
- if (err) throw err;
215
+ try {
216
+ const data = fs.readFileSync(getFilePath(file), 'utf8');
222
217
  let journeyData = cloneDeep(JSON.parse(data));
223
218
  let journeyId = null;
224
219
  // single tree
@@ -242,32 +237,36 @@ export async function importFirstJourneyFromFile(file, options) {
242
237
  const installedJourneys = (await readJourneys()).map(x => x._id);
243
238
  const unresolvedJourneys = {};
244
239
  const resolvedJourneys = [];
245
- showSpinner('Resolving dependencies');
240
+ const depSpinnerId = createProgressIndicator('indeterminate', 0, 'Resolving dependencies');
246
241
  await resolveDependencies(installedJourneys, {
247
242
  [journeyId]: journeyData
248
243
  }, unresolvedJourneys, resolvedJourneys);
249
244
  if (Object.keys(unresolvedJourneys).length === 0) {
250
- succeedSpinner(`Resolved all dependencies.`);
251
- if (!verbose) showSpinner(`Importing ${journeyId}...`);
252
- importJourney(journeyData, options).then(() => {
253
- if (verbose) showSpinner(`Importing ${journeyId}...`);
254
- succeedSpinner(`Imported ${journeyId}.`);
255
- }).catch(importError => {
256
- if (verbose) showSpinner(`Importing ${journeyId}...`);
257
- failSpinner(`${importError}`);
258
- });
245
+ stopProgressIndicator(depSpinnerId, `Resolved all dependencies.`, 'success');
246
+ let importSpinnerId;
247
+ if (!verbose) importSpinnerId = createProgressIndicator('indeterminate', 0, `Importing ${journeyId}...`);
248
+ try {
249
+ await importJourney(journeyData, options);
250
+ if (verbose) importSpinnerId = createProgressIndicator('indeterminate', 0, `Importing ${journeyId}...`);
251
+ stopProgressIndicator(importSpinnerId, `Imported ${journeyId}.`, 'success');
252
+ } catch (importError) {
253
+ if (verbose) importSpinnerId = createProgressIndicator('indeterminate', 0, `Importing ${journeyId}...`);
254
+ stopProgressIndicator(importSpinnerId, `${importError}`, 'fail');
255
+ }
259
256
  } else {
260
- failSpinner(`Unresolved dependencies:`);
257
+ stopProgressIndicator(depSpinnerId, `Unresolved dependencies:`, 'fail');
261
258
  for (const journey of Object.keys(unresolvedJourneys)) {
262
259
  printMessage(` ${journey} requires ${unresolvedJourneys[journey]}`, 'error');
263
260
  }
264
261
  }
265
262
  } else {
266
- showSpinner(`Importing...`);
267
- failSpinner(`No journeys found!`);
263
+ const importSpinnerId = createProgressIndicator('indeterminate', 0, `Importing...`);
264
+ stopProgressIndicator(importSpinnerId, `No journeys found!`, 'fail');
268
265
  }
269
266
  // end dependency resolution for single tree import
270
- });
267
+ } catch (error) {
268
+ printMessage(`Error importing first journey: ${error}`, 'error');
269
+ }
271
270
  }
272
271
 
273
272
  /**
@@ -276,11 +275,11 @@ export async function importFirstJourneyFromFile(file, options) {
276
275
  * @param {TreeImportOptions} options import options
277
276
  */
278
277
  export async function importJourneysFromFile(file, options) {
279
- fs.readFile(getFilePath(file), 'utf8', (err, data) => {
280
- if (err) throw err;
278
+ try {
279
+ const data = fs.readFileSync(getFilePath(file), 'utf8');
281
280
  try {
282
281
  const fileData = JSON.parse(data);
283
- importJourneys(fileData.trees, options);
282
+ await importJourneys(fileData.trees, options);
284
283
  } catch (error) {
285
284
  if (error.name === 'UnresolvedDependenciesError') {
286
285
  for (const journey of Object.keys(error.unresolvedJourneys)) {
@@ -294,7 +293,9 @@ export async function importJourneysFromFile(file, options) {
294
293
  printMessage(`${error.message}`, 'error');
295
294
  }
296
295
  }
297
- });
296
+ } catch (error) {
297
+ printMessage(`Error importing journeys: ${error}`, 'error');
298
+ }
298
299
  }
299
300
 
300
301
  /**
@@ -682,4 +683,24 @@ export async function describeJourneyMd(journeyData, resolveTreeExport = onlineT
682
683
  }
683
684
  }
684
685
  }
686
+ export async function enableJourney(journeyId) {
687
+ const indicatorId = createProgressIndicator('indeterminate', 0, `Enabling journey ${journeyId}...`);
688
+ if (_enableJourney(journeyId)) {
689
+ stopProgressIndicator(indicatorId, `Enabled journey ${journeyId}.`, 'success');
690
+ return true;
691
+ } else {
692
+ stopProgressIndicator(indicatorId, `Error enabling journey ${journeyId}`, 'fail');
693
+ return false;
694
+ }
695
+ }
696
+ export async function disableJourney(journeyId) {
697
+ const indicatorId = createProgressIndicator('indeterminate', 0, `Disabling journey ${journeyId}...`);
698
+ if (_disableJourney(journeyId)) {
699
+ stopProgressIndicator(indicatorId, `Disabled journey ${journeyId}.`, 'success');
700
+ return true;
701
+ } else {
702
+ stopProgressIndicator(indicatorId, `Error disabling journey ${journeyId}`, 'fail');
703
+ return false;
704
+ }
705
+ }
685
706
  //# sourceMappingURL=JourneyOps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"JourneyOps.js","names":["frodo","state","fs","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","CirclesOfTrust","EmailTemplate","Idp","Node","Saml2","Script","Theme","cloneDeep","wordwrap","getTypedFilename","saveJsonToFile","getRealmString","getFilePath","getWorkingDirectory","utils","readJourneys","exportJourney","createMultiTreeExportTemplate","resolveDependencies","importJourneys","importJourney","getTreeDescendents","getNodeRef","onlineTreeExportResolver","getJourneyClassification","_getJourneyClassification","authn","journey","listJourneys","long","analyze","journeys","journeyStub","table","_journeyStub$uiConfig","push","_id","enabled","uiConfig","categories","JSON","parse","join","toString","exportPromises","useStringArrays","deps","journeyExports","Promise","all","journeyExport","_journeyExport$tree$u","tree","error","response","data","_error$response","exportJourneyToFile","journeyId","file","options","verbose","getVerbose","filePath","fileData","exportJourneysToFile","trees","length","exportData","meta","exportJourneysToFiles","fileName","importJourneyFromFile","readFile","err","journeyData","installedJourneys","map","x","unresolvedJourneys","resolvedJourneys","Object","keys","then","catch","importError","importFirstJourneyFromFile","treeId","hasOwnProperty","call","importJourneysFromFile","name","message","type","importJourneysFromFiles","names","readdirSync","jsonFiles","filter","toLowerCase","endsWith","allJourneysData","readFileSync","_error$response2","it","getJourneyClassificationMd","getOneLineDescription","treeObj","description","getOneLineDescriptionMd","describeTreeDescendents","descendents","depth","values","indent","Array","fill","descendent","describeTreeDescendentsMd","markdown","describeJourney","resolveTreeExport","_journeyData$meta","_journeyData$tree$uiC","_journeyData$themes","allNodes","nodes","innerNodes","nodeTypeMap","nodeData","_type","getAmVersion","originAmVersion","setAmVersion","stack","entries","nodeType","count","String","getNodeClassification","nodeObj","themes","themeData","scripts","scriptData","emailTemplates","templateData","socialIdentityProviders","socialIdpData","saml2Entities","entityProviderData","circlesOfTrust","cotData","describeJourneyMd","_journeyData$meta2","_journeyData$tree$uiC2","_journeyData$themes2","getNodeClassificationMd","getTableHeaderMd","getTableRowMd"],"sources":["../../src/ops/JourneyOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { type NodeSkeleton } from '@rockcarver/frodo-lib/types/api/NodeApi';\nimport { type TreeSkeleton } from '@rockcarver/frodo-lib/types/api/TreeApi';\nimport {\n type JourneyClassificationType,\n type MultiTreeExportInterface,\n type SingleTreeExportInterface,\n type TreeDependencyMapInterface,\n type TreeExportOptions,\n type TreeExportResolverInterface,\n type TreeImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/JourneyOps';\nimport fs from 'fs';\n\nimport {\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport * as CirclesOfTrust from './CirclesOfTrustOps';\nimport * as EmailTemplate from './EmailTemplateOps';\nimport * as Idp from './IdpOps';\nimport * as Node from './NodeOps';\nimport * as Saml2 from './Saml2Ops';\nimport * as Script from './ScriptOps';\nimport * as Theme from './ThemeOps';\nimport { cloneDeep } from './utils/OpsUtils';\nimport wordwrap from './utils/Wordwrap';\n\nconst {\n getTypedFilename,\n saveJsonToFile,\n getRealmString,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst {\n readJourneys,\n exportJourney,\n createMultiTreeExportTemplate,\n resolveDependencies,\n importJourneys,\n importJourney,\n getTreeDescendents,\n getNodeRef,\n onlineTreeExportResolver,\n getJourneyClassification: _getJourneyClassification,\n} = frodo.authn.journey;\n\n/**\n * List all the journeys/trees\n * @param {boolean} long Long version, all the fields\n * @param {boolean} analyze Analyze journeys/trees for custom nodes (expensive)\n * @returns {Promise<TreeSkeleton[]>} a promise that resolves to an array journey objects\n */\nexport async function listJourneys(\n long = false,\n analyze = false\n): Promise<TreeSkeleton[]> {\n let journeys = [];\n try {\n journeys = await readJourneys();\n if (!long && !analyze) {\n for (const journeyStub of journeys) {\n printMessage(`${journeyStub['_id']}`, 'data');\n }\n } else {\n if (!analyze) {\n const table = createTable(['Name', 'Status', 'Tags']);\n for (const journeyStub of journeys) {\n table.push([\n `${journeyStub._id}`,\n journeyStub.enabled === false\n ? 'disabled'['brightRed']\n : 'enabled'['brightGreen'],\n journeyStub.uiConfig?.categories\n ? wordwrap(\n JSON.parse(journeyStub.uiConfig.categories).join(', '),\n 60\n )\n : '',\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n showSpinner('Retrieving details of all journeys...');\n const exportPromises = [];\n try {\n for (const journeyStub of journeys) {\n exportPromises.push(\n exportJourney(journeyStub['_id'], {\n useStringArrays: false,\n deps: false,\n })\n );\n }\n const journeyExports = await Promise.all(exportPromises);\n succeedSpinner('Retrieved details of all journeys.');\n const table = createTable([\n 'Name',\n 'Status',\n 'Classification',\n 'Tags',\n ]);\n for (const journeyExport of journeyExports) {\n table.push([\n `${journeyExport.tree._id}`,\n journeyExport.tree.enabled === false\n ? 'disabled'['brightRed']\n : 'enabled'['brightGreen'],\n getJourneyClassification(journeyExport).join(', '),\n journeyExport.tree.uiConfig?.categories\n ? wordwrap(\n JSON.parse(journeyExport.tree.uiConfig.categories).join(\n ', '\n ),\n 60\n )\n : '',\n ]);\n }\n printMessage(table.toString(), 'data');\n } catch (error) {\n failSpinner('Error retrieving details of all journeys.');\n printMessage(error.response.data, 'error');\n }\n }\n }\n } catch (error) {\n printMessage(error.response?.data, 'error');\n }\n return journeys;\n}\n\n/**\n * Export journey by id/name to file\n * @param {string} journeyId journey id/name\n * @param {string} file optional export file name\n * @param {TreeExportOptions} options export options\n */\nexport async function exportJourneyToFile(\n journeyId: string,\n file: string,\n options: TreeExportOptions\n): Promise<void> {\n debugMessage(`exportJourneyToFile: start`);\n const verbose = state.getVerbose();\n if (!file) {\n file = getTypedFilename(journeyId, 'journey');\n }\n const filePath = getFilePath(file, true);\n if (!verbose) showSpinner(`${journeyId}`);\n try {\n const fileData: SingleTreeExportInterface = await exportJourney(\n journeyId,\n options\n );\n if (verbose) showSpinner(`${journeyId}`);\n saveJsonToFile(fileData, filePath);\n succeedSpinner(\n `Exported ${journeyId['brightCyan']} to ${filePath['brightCyan']}.`\n );\n } catch (error) {\n if (verbose) showSpinner(`${journeyId}`);\n failSpinner(`Error exporting journey ${journeyId}: ${error}`);\n }\n}\n\n/**\n * Export all journeys to file\n * @param {string} file optional export file name\n * @param {TreeExportOptions} options export options\n */\nexport async function exportJourneysToFile(\n file: string,\n options: TreeExportOptions = {\n deps: false,\n useStringArrays: false,\n }\n): Promise<void> {\n if (!file) {\n file = getTypedFilename(`all${getRealmString()}Journeys`, 'journey');\n }\n const filePath = getFilePath(file, true);\n const trees = await readJourneys();\n const fileData: MultiTreeExportInterface = createMultiTreeExportTemplate();\n createProgressBar(trees.length, 'Exporting journeys...');\n for (const tree of trees) {\n updateProgressBar(`${tree._id}`);\n try {\n const exportData = await exportJourney(tree._id, options);\n delete exportData.meta;\n fileData.trees[tree._id] = exportData;\n } catch (error) {\n printMessage(`Error exporting journey ${tree._id}: ${error}`, 'error');\n }\n }\n saveJsonToFile(fileData, filePath);\n stopProgressBar(`Exported to ${filePath}`);\n}\n\n/**\n * Export all journeys to separate files\n * @param {TreeExportOptions} options export options\n */\nexport async function exportJourneysToFiles(\n options: TreeExportOptions\n): Promise<void> {\n const trees = await readJourneys();\n createProgressBar(trees.length, 'Exporting journeys...');\n for (const tree of trees) {\n updateProgressBar(`${tree._id}`);\n const fileName = getTypedFilename(`${tree._id}`, 'journey');\n try {\n const exportData: SingleTreeExportInterface = await exportJourney(\n tree._id,\n options\n );\n saveJsonToFile(exportData, getFilePath(fileName, true));\n } catch (error) {\n // do we need to report status here?\n }\n }\n stopProgressBar('Done');\n}\n\n/**\n * Import a journey from file\n * @param {string} journeyId journey id/name\n * @param {string} file import file name\n * @param {TreeImportOptions} options import options\n */\nexport async function importJourneyFromFile(\n journeyId: string,\n file: string,\n options: TreeImportOptions\n) {\n const verbose = state.getVerbose();\n fs.readFile(getFilePath(file), 'utf8', async (err, data) => {\n if (err) throw err;\n let journeyData = JSON.parse(data);\n // check if this is a file with multiple trees and get journey by id\n if (journeyData.trees && journeyData.trees[journeyId]) {\n journeyData = journeyData.trees[journeyId];\n } else if (journeyData.trees) {\n journeyData = null;\n }\n\n // if a journeyId was specified, only import the matching journey\n if (journeyData && journeyId === journeyData.tree._id) {\n // attempt dependency resolution for single tree import\n const installedJourneys = (await readJourneys()).map((x) => x._id);\n const unresolvedJourneys = {};\n const resolvedJourneys = [];\n showSpinner('Resolving dependencies');\n await resolveDependencies(\n installedJourneys,\n { [journeyId]: journeyData },\n unresolvedJourneys,\n resolvedJourneys\n );\n if (Object.keys(unresolvedJourneys).length === 0) {\n succeedSpinner(`Resolved all dependencies.`);\n\n if (!verbose) showSpinner(`Importing ${journeyId}...`);\n importJourney(journeyData, options)\n .then(() => {\n if (verbose) showSpinner(`Importing ${journeyId}...`);\n succeedSpinner(`Imported ${journeyId}.`);\n })\n .catch((importError) => {\n if (verbose) showSpinner(`Importing ${journeyId}...`);\n failSpinner(`${importError}`);\n });\n } else {\n failSpinner(`Unresolved dependencies:`);\n for (const journey of Object.keys(unresolvedJourneys)) {\n printMessage(\n ` ${journey} requires ${unresolvedJourneys[journey]}`,\n 'error'\n );\n }\n }\n // end dependency resolution for single tree import\n } else {\n showSpinner(`Importing ${journeyId}...`);\n failSpinner(`${journeyId} not found!`);\n }\n });\n}\n\n/**\n * Import first journey from file\n * @param {string} file import file name\n * @param {TreeImportOptions} options import options\n */\nexport async function importFirstJourneyFromFile(\n file: string,\n options: TreeImportOptions\n) {\n const verbose = state.getVerbose();\n fs.readFile(getFilePath(file), 'utf8', async (err, data) => {\n if (err) throw err;\n let journeyData = cloneDeep(JSON.parse(data));\n let journeyId = null;\n // single tree\n if (journeyData.tree) {\n journeyId = cloneDeep(journeyData.tree._id);\n }\n // multiple trees, so get the first tree\n else if (journeyData.trees) {\n for (const treeId in journeyData.trees) {\n if (Object.hasOwnProperty.call(journeyData.trees, treeId)) {\n journeyId = treeId;\n journeyData = journeyData.trees[treeId];\n break;\n }\n }\n }\n\n // if a journeyId was specified, only import the matching journey\n if (journeyData && journeyId) {\n // attempt dependency resolution for single tree import\n const installedJourneys = (await readJourneys()).map((x) => x._id);\n const unresolvedJourneys = {};\n const resolvedJourneys = [];\n showSpinner('Resolving dependencies');\n await resolveDependencies(\n installedJourneys,\n { [journeyId]: journeyData },\n unresolvedJourneys,\n resolvedJourneys\n );\n if (Object.keys(unresolvedJourneys).length === 0) {\n succeedSpinner(`Resolved all dependencies.`);\n\n if (!verbose) showSpinner(`Importing ${journeyId}...`);\n importJourney(journeyData, options)\n .then(() => {\n if (verbose) showSpinner(`Importing ${journeyId}...`);\n succeedSpinner(`Imported ${journeyId}.`);\n })\n .catch((importError) => {\n if (verbose) showSpinner(`Importing ${journeyId}...`);\n failSpinner(`${importError}`);\n });\n } else {\n failSpinner(`Unresolved dependencies:`);\n for (const journey of Object.keys(unresolvedJourneys)) {\n printMessage(\n ` ${journey} requires ${unresolvedJourneys[journey]}`,\n 'error'\n );\n }\n }\n } else {\n showSpinner(`Importing...`);\n failSpinner(`No journeys found!`);\n }\n // end dependency resolution for single tree import\n });\n}\n\n/**\n * Import all journeys from file\n * @param {string} file import file name\n * @param {TreeImportOptions} options import options\n */\nexport async function importJourneysFromFile(\n file: string,\n options: TreeImportOptions\n) {\n fs.readFile(getFilePath(file), 'utf8', (err, data) => {\n if (err) throw err;\n try {\n const fileData = JSON.parse(data);\n importJourneys(fileData.trees, options);\n } catch (error) {\n if (error.name === 'UnresolvedDependenciesError') {\n for (const journey of Object.keys(error.unresolvedJourneys)) {\n printMessage({\n message: ` - ${journey} requires ${error.unresolvedJourneys[journey]}`,\n type: 'info',\n state,\n });\n }\n } else {\n printMessage(`${error.message}`, 'error');\n }\n }\n });\n}\n\n/**\n * Import all journeys from separate files\n * @param {TreeImportOptions} options import options\n */\nexport async function importJourneysFromFiles(options: TreeImportOptions) {\n const names = fs.readdirSync(getWorkingDirectory());\n const jsonFiles = names\n .filter((name) => name.toLowerCase().endsWith('.journey.json'))\n .map((name) => getFilePath(name));\n const allJourneysData = { trees: {} };\n for (const file of jsonFiles) {\n const journeyData = JSON.parse(fs.readFileSync(file, 'utf8'));\n allJourneysData.trees[journeyData.tree._id] = journeyData;\n }\n try {\n await importJourneys(\n allJourneysData.trees as MultiTreeExportInterface,\n options\n );\n } catch (error) {\n printMessage(`${error.response?.data?.message || error.message}`, 'error');\n }\n}\n\n/**\n * Get journey classification\n * @param {SingleTreeExportInterface} journey journey export\n * @returns {string[]} Colored string array of classifications\n */\nexport function getJourneyClassification(\n journey: SingleTreeExportInterface\n): JourneyClassificationType[] {\n return _getJourneyClassification(journey).map((it) => {\n switch (it) {\n case 'standard':\n return it['brightGreen'];\n\n case 'cloud':\n return it['brightMagenta'];\n\n case 'custom':\n return it['brightRed'];\n\n case 'premium':\n return it['brightYellow'];\n }\n });\n}\n\n/**\n * Get journey classification in markdown\n * @param {SingleTreeExportInterface} journey journey export\n * @returns {string[]} Colored string array of classifications\n */\nexport function getJourneyClassificationMd(\n journey: SingleTreeExportInterface\n): string[] {\n return _getJourneyClassification(journey).map((it) => {\n switch (it) {\n case 'standard':\n return `:green_circle: \\`${it}\\``;\n\n case 'cloud':\n return `:purple_circle: \\`${it}\\``;\n\n case 'custom':\n return `:red_circle: \\`${it}\\``;\n\n case 'premium':\n return `:yellow_circle: \\`${it}\\``;\n }\n });\n}\n\n/**\n * Get a one-line description of the tree object\n * @param {TreeSkeleton} treeObj circle of trust object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(treeObj: TreeSkeleton): string {\n const description = `[${treeObj._id['brightCyan']}]`;\n return description;\n}\n\n/**\n * Get a one-line description of the tree object in markdown\n * @param {TreeSkeleton} treeObj circle of trust object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescriptionMd(treeObj: TreeSkeleton): string {\n const description = `${treeObj._id}`;\n return description;\n}\n\n/**\n * Helper function to render a nested list of dependent trees\n * @param {TreeDependencyMapInterface} descendents tree dependency map\n * @param {number} depth level of nesting\n */\nfunction describeTreeDescendents(\n descendents: TreeDependencyMapInterface,\n depth = 0\n) {\n if (depth || Object.values(descendents)[0].length) {\n // heading\n if (depth === 0) {\n printMessage(\n `\\nInner Tree Dependencies (${Object.values(descendents)[0].length}):`,\n 'data'\n );\n }\n const indent = Array(depth * 2)\n .fill(' ')\n .join('');\n const [tree] = Object.keys(descendents);\n printMessage(`${indent}- ${tree['brightCyan']}`, 'data');\n for (const descendent of descendents[tree]) {\n describeTreeDescendents(descendent, depth + 1);\n }\n }\n}\n\n/**\n * Helper function to render a nested list of dependent trees in markdown\n * @param {TreeDependencyMapInterface} descendents tree dependency map\n * @param {number} depth level of nesting\n */\nfunction describeTreeDescendentsMd(\n descendents: TreeDependencyMapInterface,\n depth = 0\n): string {\n let markdown = '';\n if (depth || Object.values(descendents)[0].length) {\n // heading\n if (depth === 0) {\n markdown += `## Inner Tree Dependencies (${\n Object.values(descendents)[0].length\n })\\n`;\n }\n const indent = Array(depth * 2)\n .fill(' ')\n .join('');\n const [tree] = Object.keys(descendents);\n markdown += `${indent}- ${tree}\\n`;\n for (const descendent of descendents[tree]) {\n markdown += describeTreeDescendentsMd(descendent, depth + 1);\n }\n return markdown;\n }\n return markdown;\n}\n\n/**\n * Describe a journey:\n * - Properties, tags, description, name, metadata\n * - Inner tree dependency tree\n * - Node type summary\n * - Nodes\n * - Themes\n * - Scripts\n * - Email templates\n * - Social identity providers\n * - SAML2 entity providers\n * - SAML2 circles of trust\n * @param {SingleTreeExportInterface} journeyData journey export object\n * @param {TreeExportResolverInterface} resolveTreeExport tree export resolver callback function\n */\nexport async function describeJourney(\n journeyData: SingleTreeExportInterface,\n resolveTreeExport: TreeExportResolverInterface = onlineTreeExportResolver\n): Promise<void> {\n const allNodes = {\n ...journeyData.nodes,\n ...journeyData.innerNodes,\n };\n const nodeTypeMap = {};\n\n for (const nodeData of Object.values(allNodes)) {\n if (nodeTypeMap[nodeData._type._id]) {\n nodeTypeMap[nodeData._type._id] += 1;\n } else {\n nodeTypeMap[nodeData._type._id] = 1;\n }\n }\n\n // initialize AM version from file\n if (!state.getAmVersion() && journeyData.meta?.originAmVersion) {\n state.setAmVersion(journeyData.meta.originAmVersion);\n }\n\n // Journey Name\n printMessage(`${getOneLineDescription(journeyData.tree)}`, 'data');\n printMessage(Array(`[${journeyData.tree._id}]`['length']).fill('=').join(''));\n\n // Description\n if (journeyData.tree.description) {\n printMessage(`\\n${journeyData.tree.description}`, 'data');\n }\n\n // Status\n printMessage(\n `\\nStatus\\n${\n journeyData.tree.enabled === false\n ? 'disabled'['brightRed']\n : 'enabled'['brightGreen']\n }`\n );\n\n // Classification\n if (state.getAmVersion()) {\n printMessage(\n `\\nClassification\\n${getJourneyClassification(journeyData).join(', ')}`,\n 'data'\n );\n }\n\n // Categories/Tags\n if (\n journeyData.tree.uiConfig?.categories &&\n journeyData.tree.uiConfig.categories != '[]'\n ) {\n printMessage('\\nCategories/Tags', 'data');\n printMessage(\n `${JSON.parse(journeyData.tree.uiConfig.categories).join(', ')}`,\n 'data'\n );\n }\n\n // Dependency Tree\n try {\n const descendents = await getTreeDescendents(\n journeyData,\n resolveTreeExport\n );\n describeTreeDescendents(descendents);\n } catch (error) {\n printMessage(`Error resolving inner tree dependencies:`, 'error');\n printMessage(error.stack, 'error');\n }\n\n // Node Types\n if (Object.entries(nodeTypeMap).length) {\n printMessage(\n `\\nNode Types (${Object.entries(nodeTypeMap).length}):`,\n 'data'\n );\n for (const [nodeType, count] of Object.entries(nodeTypeMap)) {\n printMessage(\n `- ${String(count)} [${\n nodeType['brightCyan']\n }] (${Node.getNodeClassification(nodeType).join(', ')})`,\n 'data'\n );\n }\n }\n\n // Nodes\n if (Object.entries(allNodes).length) {\n printMessage(`\\nNodes (${Object.entries(allNodes).length}):`, 'data');\n for (const nodeObj of Object.values<NodeSkeleton>(allNodes)) {\n printMessage(\n `- ${Node.getOneLineDescription(\n nodeObj,\n getNodeRef(nodeObj, journeyData)\n )}`,\n 'data'\n );\n }\n }\n\n // Themes\n if (journeyData.themes?.length) {\n printMessage(`\\nThemes (${journeyData.themes.length}):`, 'data');\n for (const themeData of journeyData.themes) {\n printMessage(`- ${Theme.getOneLineDescription(themeData)}`, 'data');\n }\n }\n\n // Scripts\n if (Object.entries(journeyData.scripts).length) {\n printMessage(\n `\\nScripts (${Object.entries(journeyData.scripts).length}):`,\n 'data'\n );\n for (const scriptData of Object.values(journeyData.scripts)) {\n printMessage(`- ${Script.getOneLineDescription(scriptData)}`, 'data');\n }\n }\n\n // Email Templates\n if (Object.entries(journeyData.emailTemplates).length) {\n printMessage(\n `\\nEmail Templates (${\n Object.entries(journeyData.emailTemplates).length\n }):`,\n 'data'\n );\n for (const templateData of Object.values(journeyData.emailTemplates)) {\n printMessage(\n `- ${EmailTemplate.getOneLineDescription(templateData)}`,\n 'data'\n );\n }\n }\n\n // Social Identity Providers\n if (Object.entries(journeyData.socialIdentityProviders).length) {\n printMessage(\n `\\nSocial Identity Providers (${\n Object.entries(journeyData.socialIdentityProviders).length\n }):`,\n 'data'\n );\n for (const socialIdpData of Object.values(\n journeyData.socialIdentityProviders\n )) {\n printMessage(`- ${Idp.getOneLineDescription(socialIdpData)}`, 'data');\n }\n }\n\n // SAML2 Entity Providers\n if (Object.entries(journeyData.saml2Entities).length) {\n printMessage(\n `\\nSAML2 Entity Providers (${\n Object.entries(journeyData.saml2Entities).length\n }):`,\n 'data'\n );\n for (const entityProviderData of Object.values(journeyData.saml2Entities)) {\n printMessage(\n `- ${Saml2.getOneLineDescription(entityProviderData)}`,\n 'data'\n );\n }\n }\n\n // SAML2 Circles Of Trust\n if (Object.entries(journeyData.circlesOfTrust).length) {\n printMessage(\n `\\nSAML2 Circles Of Trust (${\n Object.entries(journeyData.circlesOfTrust).length\n }):`,\n 'data'\n );\n for (const cotData of Object.values(journeyData.circlesOfTrust)) {\n printMessage(\n `- ${CirclesOfTrust.getOneLineDescription(cotData)}`,\n 'data'\n );\n }\n }\n}\n\n/**\n * Describe a journey in markdown:\n * - Properties, tags, description, name, metadata\n * - Inner tree dependency tree\n * - Node type summary\n * - Nodes\n * - Themes\n * - Scripts\n * - Email templates\n * - Social identity providers\n * - SAML2 entity providers\n * - SAML2 circles of trust\n * @param {SingleTreeExportInterface} journeyData journey export object\n * @param {TreeExportResolverInterface} resolveTreeExport tree export resolver callback function\n */\nexport async function describeJourneyMd(\n journeyData: SingleTreeExportInterface,\n resolveTreeExport: TreeExportResolverInterface = onlineTreeExportResolver\n) {\n const allNodes = {\n ...journeyData.nodes,\n ...journeyData.innerNodes,\n };\n const nodeTypeMap = {};\n\n for (const nodeData of Object.values(allNodes)) {\n if (nodeTypeMap[nodeData._type._id]) {\n nodeTypeMap[nodeData._type._id] += 1;\n } else {\n nodeTypeMap[nodeData._type._id] = 1;\n }\n }\n\n // initialize AM version from file\n if (!state.getAmVersion() && journeyData.meta?.originAmVersion) {\n state.setAmVersion(journeyData.meta.originAmVersion);\n }\n\n // Journey Name\n printMessage(\n `# ${getOneLineDescriptionMd(journeyData.tree)} - ${\n journeyData.tree.enabled === false\n ? ':o: `disabled`'\n : ':white_check_mark: `enabled`'\n }, ${getJourneyClassificationMd(journeyData).join(', ')}`,\n 'data'\n );\n\n // Categories/Tags\n if (\n journeyData.tree.uiConfig?.categories &&\n journeyData.tree.uiConfig.categories != '[]'\n ) {\n printMessage(\n `\\`${JSON.parse(journeyData.tree.uiConfig.categories).join('`, `')}\\``,\n 'data'\n );\n }\n\n // Description\n if (journeyData.tree.description) {\n printMessage(`\\n${journeyData.tree.description}`, 'data');\n }\n\n // Journey image\n printMessage(`\\n[![](./${journeyData.tree._id}.png)]()\\n`, 'data');\n\n // Dependency Tree\n const descendents = await getTreeDescendents(journeyData, resolveTreeExport);\n printMessage(describeTreeDescendentsMd(descendents), 'data');\n\n // Node Types\n if (Object.entries(nodeTypeMap).length) {\n printMessage(\n `## Node Types (${Object.entries(nodeTypeMap).length})`,\n 'data'\n );\n printMessage('| Count | Type | Classification |', 'data');\n printMessage('| -----:| ---- | -------------- |', 'data');\n for (const [nodeType, count] of Object.entries(nodeTypeMap)) {\n printMessage(\n `| ${String(count)} | ${nodeType} | ${Node.getNodeClassificationMd(\n nodeType\n ).join('<br>')} |`,\n 'data'\n );\n }\n }\n\n // Nodes\n if (Object.entries(allNodes).length) {\n printMessage(`## Nodes (${Object.entries(allNodes).length})`, 'data');\n printMessage(Node.getTableHeaderMd(), 'data');\n for (const nodeObj of Object.values<NodeSkeleton>(allNodes)) {\n printMessage(\n `${Node.getTableRowMd(nodeObj, getNodeRef(nodeObj, journeyData))}`,\n 'data'\n );\n }\n }\n\n // Themes\n if (journeyData.themes?.length) {\n printMessage(`## Themes (${journeyData.themes.length})`, 'data');\n printMessage(Theme.getTableHeaderMd(), 'data');\n for (const themeData of journeyData.themes) {\n printMessage(`${Theme.getTableRowMd(themeData)}`, 'data');\n }\n }\n\n // Scripts\n if (Object.entries(journeyData.scripts).length) {\n printMessage(\n `## Scripts (${Object.entries(journeyData.scripts).length})`,\n 'data'\n );\n printMessage(Script.getTableHeaderMd(), 'data');\n for (const scriptData of Object.values(journeyData.scripts)) {\n printMessage(`${Script.getTableRowMd(scriptData)}`, 'data');\n }\n }\n\n // Email Templates\n if (Object.entries(journeyData.emailTemplates).length) {\n printMessage(\n `## Email Templates (${\n Object.entries(journeyData.emailTemplates).length\n })`,\n 'data'\n );\n printMessage(EmailTemplate.getTableHeaderMd(), 'data');\n for (const templateData of Object.values(journeyData.emailTemplates)) {\n printMessage(`${EmailTemplate.getTableRowMd(templateData)}`, 'data');\n }\n }\n\n // Social Identity Providers\n if (Object.entries(journeyData.socialIdentityProviders).length) {\n printMessage(\n `## Social Identity Providers (${\n Object.entries(journeyData.socialIdentityProviders).length\n })`,\n 'data'\n );\n printMessage(Idp.getTableHeaderMd(), 'data');\n for (const socialIdpData of Object.values(\n journeyData.socialIdentityProviders\n )) {\n printMessage(`${Idp.getTableRowMd(socialIdpData)}`, 'data');\n }\n }\n\n // SAML2 Entity Providers\n if (Object.entries(journeyData.saml2Entities).length) {\n printMessage(\n `## SAML2 Entity Providers (${\n Object.entries(journeyData.saml2Entities).length\n })`,\n 'data'\n );\n printMessage(Saml2.getTableHeaderMd(), 'data');\n for (const entityProviderData of Object.values(journeyData.saml2Entities)) {\n printMessage(`${Saml2.getTableRowMd(entityProviderData)}`, 'data');\n }\n }\n\n // SAML2 Circles Of Trust\n if (Object.entries(journeyData.circlesOfTrust).length) {\n printMessage(\n `## SAML2 Circles Of Trust (${\n Object.entries(journeyData.circlesOfTrust).length\n })`,\n 'data'\n );\n printMessage(CirclesOfTrust.getTableHeaderMd(), 'data');\n for (const cotData of Object.values(journeyData.circlesOfTrust)) {\n printMessage(`${CirclesOfTrust.getTableRowMd(cotData)}`, 'data');\n }\n }\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAYpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,iBAAiB,QACZ,kBAAkB;AACzB,OAAO,KAAKC,cAAc,MAAM,qBAAqB;AACrD,OAAO,KAAKC,aAAa,MAAM,oBAAoB;AACnD,OAAO,KAAKC,GAAG,MAAM,UAAU;AAC/B,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAO,KAAKC,KAAK,MAAM,YAAY;AACnC,OAAO,KAAKC,MAAM,MAAM,aAAa;AACrC,OAAO,KAAKC,KAAK,MAAM,YAAY;AACnC,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,OAAOC,QAAQ,MAAM,kBAAkB;AAEvC,MAAM;EACJC,gBAAgB;EAChBC,cAAc;EACdC,cAAc;EACdC,WAAW;EACXC;AACF,CAAC,GAAGzB,KAAK,CAAC0B,KAAK;AACf,MAAM;EACJC,YAAY;EACZC,aAAa;EACbC,6BAA6B;EAC7BC,mBAAmB;EACnBC,cAAc;EACdC,aAAa;EACbC,kBAAkB;EAClBC,UAAU;EACVC,wBA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AInE,MAAM,CAACsD,OAAO,CAAC5D,WAAW,CAAC0E,aAAa,CAAC,CAAClF,MAAM,EAAE;IACpDxE,YAAY,CACT,8BACCsF,MAAM,CAACsD,OAAO,CAAC5D,WAAW,CAAC0E,aAAa,CAAC,CAAClF,MAC3C,GAAE,EACH,MACF,CAAC;IACDxE,YAAY,CAACS,KAAK,CAAC0J,gBAAgB,CAAC,CAAC,EAAE,MAAM,CAAC;IAC9C,KAAK,MAAMR,kBAAkB,IAAIrE,MAAM,CAACgC,MAAM,CAACtC,WAAW,CAAC0E,aAAa,CAAC,EAAE;MACzE1J,YAAY,CAAE,GAAES,KAAK,CAAC2J,aAAa,CAACT,kBAAkB,CAAE,EAAC,EAAE,MAAM,CAAC;IACpE;EACF;;EAEA;EACA,IAAIrE,MAAM,CAACsD,OAAO,CAAC5D,WAAW,CAAC4E,cAAc,CAAC,CAACpF,MAAM,EAAE;IACrDxE,YAAY,CACT,8BACCsF,MAAM,CAACsD,OAAO,CAAC5D,WAAW,CAAC4E,cAAc,CAAC,CAACpF,MAC5C,GAAE,EACH,MACF,CAAC;IACDxE,YAAY,CAACK,cAAc,CAAC8J,gBAAgB,CAAC,CAAC,EAAE,MAAM,CAAC;IACvD,KAAK,MAAMN,OAAO,IAAIvE,MAAM,CAACgC,MAAM,CAACtC,WAAW,CAAC4E,cAAc,CAAC,EAAE;MAC/D5J,YAAY,CAAE,GAAEK,cAAc,CAAC+J,aAAa,CAACP,OAAO,CAAE,EAAC,EAAE,MAAM,CAAC;IAClE;EACF;AACF"}
1
+ {"version":3,"file":"JourneyOps.js","names":["frodo","state","fs","createProgressIndicator","createTable","debugMessage","printMessage","stopProgressIndicator","updateProgressIndicator","CirclesOfTrust","EmailTemplate","Idp","Node","Saml2","Script","Theme","cloneDeep","wordwrap","getTypedFilename","saveJsonToFile","getRealmString","getFilePath","getWorkingDirectory","utils","readJourneys","exportJourney","exportJourneys","resolveDependencies","importJourneys","importJourney","getTreeDescendents","getNodeRef","onlineTreeExportResolver","getJourneyClassification","_getJourneyClassification","disableJourney","_disableJourney","enableJourney","_enableJourney","authn","journey","listJourneys","long","analyze","journeys","journeyStub","table","_journeyStub$uiConfig","push","_id","enabled","uiConfig","categories","JSON","parse","join","toString","spinnerId","exportPromises","useStringArrays","deps","journeyExports","Promise","all","journeyExport","_journeyExport$tree$u","tree","error","response","data","_error$response","exportJourneyToFile","journeyId","file","options","verbose","getVerbose","filePath","fileData","exportJourneysToFile","exportJourneysToFiles","journeysExport","trees","Object","entries","treeId","treeValue","indicatorId","meta","importJourneyFromFile","readFileSync","journeyData","installedJourneys","map","x","unresolvedJourneys","resolvedJourneys","indicatorId1","keys","length","indicatorId2","importError","indicatorId3","importFirstJourneyFromFile","hasOwnProperty","call","depSpinnerId","importSpinnerId","importJourneysFromFile","name","message","type","importJourneysFromFiles","names","readdirSync","jsonFiles","filter","toLowerCase","endsWith","allJourneysData","_error$response2","it","getJourneyClassificationMd","getOneLineDescription","treeObj","description","getOneLineDescriptionMd","describeTreeDescendents","descendents","depth","values","indent","Array","fill","descendent","describeTreeDescendentsMd","markdown","describeJourney","resolveTreeExport","_journeyData$meta","_journeyData$tree$uiC","_journeyData$themes","allNodes","nodes","innerNodes","nodeTypeMap","nodeData","_type","getAmVersion","originAmVersion","setAmVersion","stack","nodeType","count","String","getNodeClassification","nodeObj","themes","themeData","scripts","scriptData","emailTemplates","templateData","socialIdentityProviders","socialIdpData","saml2Entities","entityProviderData","circlesOfTrust","cotData","describeJourneyMd","_journeyData$meta2","_journeyData$tree$uiC2","_journeyData$themes2","getNodeClassificationMd","getTableHeaderMd","getTableRowMd"],"sources":["../../src/ops/JourneyOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { type NodeSkeleton } from '@rockcarver/frodo-lib/types/api/NodeApi';\nimport { type TreeSkeleton } from '@rockcarver/frodo-lib/types/api/TreeApi';\nimport {\n type JourneyClassificationType,\n type MultiTreeExportInterface,\n type SingleTreeExportInterface,\n type TreeDependencyMapInterface,\n type TreeExportOptions,\n type TreeExportResolverInterface,\n type TreeImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/JourneyOps';\nimport fs from 'fs';\n\nimport {\n createProgressIndicator,\n createTable,\n debugMessage,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\nimport * as CirclesOfTrust from './CirclesOfTrustOps';\nimport * as EmailTemplate from './EmailTemplateOps';\nimport * as Idp from './IdpOps';\nimport * as Node from './NodeOps';\nimport * as Saml2 from './Saml2Ops';\nimport * as Script from './ScriptOps';\nimport * as Theme from './ThemeOps';\nimport { cloneDeep } from './utils/OpsUtils';\nimport wordwrap from './utils/Wordwrap';\n\nconst {\n getTypedFilename,\n saveJsonToFile,\n getRealmString,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst {\n readJourneys,\n exportJourney,\n exportJourneys,\n resolveDependencies,\n importJourneys,\n importJourney,\n getTreeDescendents,\n getNodeRef,\n onlineTreeExportResolver,\n getJourneyClassification: _getJourneyClassification,\n disableJourney: _disableJourney,\n enableJourney: _enableJourney,\n} = frodo.authn.journey;\n\n/**\n * List all the journeys/trees\n * @param {boolean} long Long version, all the fields\n * @param {boolean} analyze Analyze journeys/trees for custom nodes (expensive)\n * @returns {Promise<TreeSkeleton[]>} a promise that resolves to an array journey objects\n */\nexport async function listJourneys(\n long = false,\n analyze = false\n): Promise<TreeSkeleton[]> {\n let journeys = [];\n try {\n journeys = await readJourneys();\n if (!long && !analyze) {\n for (const journeyStub of journeys) {\n printMessage(`${journeyStub['_id']}`, 'data');\n }\n } else {\n if (!analyze) {\n const table = createTable(['Name', 'Status', 'Tags']);\n for (const journeyStub of journeys) {\n table.push([\n `${journeyStub._id}`,\n journeyStub.enabled === false\n ? 'disabled'['brightRed']\n : 'enabled'['brightGreen'],\n journeyStub.uiConfig?.categories\n ? wordwrap(\n JSON.parse(journeyStub.uiConfig.categories).join(', '),\n 60\n )\n : '',\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n const spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Retrieving details of all journeys...`\n );\n const exportPromises = [];\n try {\n for (const journeyStub of journeys) {\n exportPromises.push(\n exportJourney(journeyStub['_id'], {\n useStringArrays: false,\n deps: false,\n })\n );\n }\n const journeyExports = await Promise.all(exportPromises);\n stopProgressIndicator(\n spinnerId,\n 'Retrieved details of all journeys.',\n 'success'\n );\n const table = createTable([\n 'Name',\n 'Status',\n 'Classification',\n 'Tags',\n ]);\n for (const journeyExport of journeyExports) {\n table.push([\n `${journeyExport.tree._id}`,\n journeyExport.tree.enabled === false\n ? 'disabled'['brightRed']\n : 'enabled'['brightGreen'],\n getJourneyClassification(journeyExport).join(', '),\n journeyExport.tree.uiConfig?.categories\n ? wordwrap(\n JSON.parse(journeyExport.tree.uiConfig.categories).join(\n ', '\n ),\n 60\n )\n : '',\n ]);\n }\n printMessage(table.toString(), 'data');\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n 'Error retrieving details of all journeys.',\n 'fail'\n );\n printMessage(error.response.data, 'error');\n }\n }\n }\n } catch (error) {\n printMessage(error.response?.data, 'error');\n }\n return journeys;\n}\n\n/**\n * Export journey by id/name to file\n * @param {string} journeyId journey id/name\n * @param {string} file optional export file name\n * @param {TreeExportOptions} options export options\n */\nexport async function exportJourneyToFile(\n journeyId: string,\n file: string,\n options: TreeExportOptions\n): Promise<void> {\n debugMessage(`exportJourneyToFile: start`);\n const verbose = state.getVerbose();\n if (!file) {\n file = getTypedFilename(journeyId, 'journey');\n }\n const filePath = getFilePath(file, true);\n let spinnerId: string;\n if (!verbose)\n spinnerId = createProgressIndicator('indeterminate', 0, `${journeyId}`);\n try {\n const fileData: SingleTreeExportInterface = await exportJourney(\n journeyId,\n options\n );\n if (verbose)\n spinnerId = createProgressIndicator('indeterminate', 0, `${journeyId}`);\n saveJsonToFile(fileData, filePath);\n stopProgressIndicator(\n spinnerId,\n `Exported ${journeyId['brightCyan']} to ${filePath['brightCyan']}.`,\n 'success'\n );\n } catch (error) {\n if (verbose)\n spinnerId = createProgressIndicator('indeterminate', 0, `${journeyId}`);\n stopProgressIndicator(\n spinnerId,\n `Error exporting journey ${journeyId}: ${error}`,\n 'fail'\n );\n }\n}\n\n/**\n * Export all journeys to file\n * @param {string} file optional export file name\n * @param {TreeExportOptions} options export options\n */\nexport async function exportJourneysToFile(\n file: string,\n options: TreeExportOptions = {\n deps: false,\n useStringArrays: false,\n }\n): Promise<void> {\n if (!file) {\n file = getTypedFilename(`all${getRealmString()}Journeys`, 'journey');\n }\n const filePath = getFilePath(file, true);\n const fileData: MultiTreeExportInterface = await exportJourneys(options);\n saveJsonToFile(fileData, filePath);\n}\n\n/**\n * Export all journeys to separate files\n * @param {TreeExportOptions} options export options\n */\nexport async function exportJourneysToFiles(\n options: TreeExportOptions\n): Promise<void> {\n const journeysExport = await exportJourneys(options);\n const trees = Object.entries(journeysExport.trees);\n for (const [treeId, treeValue] of trees) {\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Saving ${treeId}...`\n );\n const file = getFilePath(getTypedFilename(`${treeId}`, 'journey'), true);\n treeValue['meta'] = journeysExport.meta;\n try {\n updateProgressIndicator(indicatorId, `Saving ${treeId} to ${file}`);\n saveJsonToFile(treeValue, file);\n stopProgressIndicator(indicatorId, `${treeId} saved to ${file}`);\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error saving ${treeId} to ${file}`);\n }\n }\n}\n\n/**\n * Import a journey from file\n * @param {string} journeyId journey id/name\n * @param {string} file import file name\n * @param {TreeImportOptions} options import options\n */\nexport async function importJourneyFromFile(\n journeyId: string,\n file: string,\n options: TreeImportOptions\n) {\n const verbose = state.getVerbose();\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n let journeyData = JSON.parse(data);\n // check if this is a file with multiple trees and get journey by id\n if (journeyData.trees && journeyData.trees[journeyId]) {\n journeyData = journeyData.trees[journeyId];\n } else if (journeyData.trees) {\n journeyData = null;\n }\n\n // if a journeyId was specified, only import the matching journey\n if (journeyData && journeyId === journeyData.tree._id) {\n // attempt dependency resolution for single tree import\n const installedJourneys = (await readJourneys()).map((x) => x._id);\n const unresolvedJourneys = {};\n const resolvedJourneys = [];\n const indicatorId1 = createProgressIndicator(\n 'indeterminate',\n 0,\n 'Resolving dependencies'\n );\n await resolveDependencies(\n installedJourneys,\n { [journeyId]: journeyData },\n unresolvedJourneys,\n resolvedJourneys\n );\n if (Object.keys(unresolvedJourneys).length === 0) {\n stopProgressIndicator(\n indicatorId1,\n `Resolved all dependencies.`,\n 'success'\n );\n\n let indicatorId2: string;\n if (!verbose)\n indicatorId2 = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n try {\n await importJourney(journeyData, options);\n if (verbose)\n indicatorId2 = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n stopProgressIndicator(\n indicatorId2,\n `Imported ${journeyId}.`,\n 'success'\n );\n } catch (importError) {\n if (verbose)\n indicatorId2 = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n stopProgressIndicator(indicatorId2, `${importError}`, 'fail');\n }\n } else {\n stopProgressIndicator(indicatorId1, `Unresolved dependencies:`, 'fail');\n for (const journey of Object.keys(unresolvedJourneys)) {\n printMessage(\n ` ${journey} requires ${unresolvedJourneys[journey]}`,\n 'error'\n );\n }\n }\n // end dependency resolution for single tree import\n } else {\n const indicatorId3 = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n stopProgressIndicator(indicatorId3, `${journeyId} not found!`, 'fail');\n }\n } catch (error) {\n printMessage(`Error importing journey ${journeyId}: ${error}`, 'error');\n }\n}\n\n/**\n * Import first journey from file\n * @param {string} file import file name\n * @param {TreeImportOptions} options import options\n */\nexport async function importFirstJourneyFromFile(\n file: string,\n options: TreeImportOptions\n) {\n const verbose = state.getVerbose();\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n let journeyData = cloneDeep(JSON.parse(data));\n let journeyId = null;\n // single tree\n if (journeyData.tree) {\n journeyId = cloneDeep(journeyData.tree._id);\n }\n // multiple trees, so get the first tree\n else if (journeyData.trees) {\n for (const treeId in journeyData.trees) {\n if (Object.hasOwnProperty.call(journeyData.trees, treeId)) {\n journeyId = treeId;\n journeyData = journeyData.trees[treeId];\n break;\n }\n }\n }\n\n // if a journeyId was specified, only import the matching journey\n if (journeyData && journeyId) {\n // attempt dependency resolution for single tree import\n const installedJourneys = (await readJourneys()).map((x) => x._id);\n const unresolvedJourneys = {};\n const resolvedJourneys = [];\n const depSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n 'Resolving dependencies'\n );\n await resolveDependencies(\n installedJourneys,\n { [journeyId]: journeyData },\n unresolvedJourneys,\n resolvedJourneys\n );\n if (Object.keys(unresolvedJourneys).length === 0) {\n stopProgressIndicator(\n depSpinnerId,\n `Resolved all dependencies.`,\n 'success'\n );\n\n let importSpinnerId: string;\n if (!verbose)\n importSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n try {\n await importJourney(journeyData, options);\n if (verbose)\n importSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n stopProgressIndicator(\n importSpinnerId,\n `Imported ${journeyId}.`,\n 'success'\n );\n } catch (importError) {\n if (verbose)\n importSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${journeyId}...`\n );\n stopProgressIndicator(importSpinnerId, `${importError}`, 'fail');\n }\n } else {\n stopProgressIndicator(depSpinnerId, `Unresolved dependencies:`, 'fail');\n for (const journey of Object.keys(unresolvedJourneys)) {\n printMessage(\n ` ${journey} requires ${unresolvedJourneys[journey]}`,\n 'error'\n );\n }\n }\n } else {\n const importSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing...`\n );\n stopProgressIndicator(importSpinnerId, `No journeys found!`, 'fail');\n }\n // end dependency resolution for single tree import\n } catch (error) {\n printMessage(`Error importing first journey: ${error}`, 'error');\n }\n}\n\n/**\n * Import all journeys from file\n * @param {string} file import file name\n * @param {TreeImportOptions} options import options\n */\nexport async function importJourneysFromFile(\n file: string,\n options: TreeImportOptions\n) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n try {\n const fileData = JSON.parse(data);\n await importJourneys(fileData.trees, options);\n } catch (error) {\n if (error.name === 'UnresolvedDependenciesError') {\n for (const journey of Object.keys(error.unresolvedJourneys)) {\n printMessage({\n message: ` - ${journey} requires ${error.unresolvedJourneys[journey]}`,\n type: 'info',\n state,\n });\n }\n } else {\n printMessage(`${error.message}`, 'error');\n }\n }\n } catch (error) {\n printMessage(`Error importing journeys: ${error}`, 'error');\n }\n}\n\n/**\n * Import all journeys from separate files\n * @param {TreeImportOptions} options import options\n */\nexport async function importJourneysFromFiles(options: TreeImportOptions) {\n const names = fs.readdirSync(getWorkingDirectory());\n const jsonFiles = names\n .filter((name) => name.toLowerCase().endsWith('.journey.json'))\n .map((name) => getFilePath(name));\n const allJourneysData = { trees: {} };\n for (const file of jsonFiles) {\n const journeyData = JSON.parse(fs.readFileSync(file, 'utf8'));\n allJourneysData.trees[journeyData.tree._id] = journeyData;\n }\n try {\n await importJourneys(\n allJourneysData.trees as MultiTreeExportInterface,\n options\n );\n } catch (error) {\n printMessage(`${error.response?.data?.message || error.message}`, 'error');\n }\n}\n\n/**\n * Get journey classification\n * @param {SingleTreeExportInterface} journey journey export\n * @returns {string[]} Colored string array of classifications\n */\nexport function getJourneyClassification(\n journey: SingleTreeExportInterface\n): JourneyClassificationType[] {\n return _getJourneyClassification(journey).map((it) => {\n switch (it) {\n case 'standard':\n return it['brightGreen'];\n\n case 'cloud':\n return it['brightMagenta'];\n\n case 'custom':\n return it['brightRed'];\n\n case 'premium':\n return it['brightYellow'];\n }\n });\n}\n\n/**\n * Get journey classification in markdown\n * @param {SingleTreeExportInterface} journey journey export\n * @returns {string[]} Colored string array of classifications\n */\nexport function getJourneyClassificationMd(\n journey: SingleTreeExportInterface\n): string[] {\n return _getJourneyClassification(journey).map((it) => {\n switch (it) {\n case 'standard':\n return `:green_circle: \\`${it}\\``;\n\n case 'cloud':\n return `:purple_circle: \\`${it}\\``;\n\n case 'custom':\n return `:red_circle: \\`${it}\\``;\n\n case 'premium':\n return `:yellow_circle: \\`${it}\\``;\n }\n });\n}\n\n/**\n * Get a one-line description of the tree object\n * @param {TreeSkeleton} treeObj circle of trust object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(treeObj: TreeSkeleton): string {\n const description = `[${treeObj._id['brightCyan']}]`;\n return description;\n}\n\n/**\n * Get a one-line description of the tree object in markdown\n * @param {TreeSkeleton} treeObj circle of trust object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescriptionMd(treeObj: TreeSkeleton): string {\n const description = `${treeObj._id}`;\n return description;\n}\n\n/**\n * Helper function to render a nested list of dependent trees\n * @param {TreeDependencyMapInterface} descendents tree dependency map\n * @param {number} depth level of nesting\n */\nfunction describeTreeDescendents(\n descendents: TreeDependencyMapInterface,\n depth = 0\n) {\n if (depth || Object.values(descendents)[0].length) {\n // heading\n if (depth === 0) {\n printMessage(\n `\\nInner Tree Dependencies (${Object.values(descendents)[0].length}):`,\n 'data'\n );\n }\n const indent = Array(depth * 2)\n .fill(' ')\n .join('');\n const [tree] = Object.keys(descendents);\n printMessage(`${indent}- ${tree['brightCyan']}`, 'data');\n for (const descendent of descendents[tree]) {\n describeTreeDescendents(descendent, depth + 1);\n }\n }\n}\n\n/**\n * Helper function to render a nested list of dependent trees in markdown\n * @param {TreeDependencyMapInterface} descendents tree dependency map\n * @param {number} depth level of nesting\n */\nfunction describeTreeDescendentsMd(\n descendents: TreeDependencyMapInterface,\n depth = 0\n): string {\n let markdown = '';\n if (depth || Object.values(descendents)[0].length) {\n // heading\n if (depth === 0) {\n markdown += `## Inner Tree Dependencies (${\n Object.values(descendents)[0].length\n })\\n`;\n }\n const indent = Array(depth * 2)\n .fill(' ')\n .join('');\n const [tree] = Object.keys(descendents);\n markdown += `${indent}- ${tree}\\n`;\n for (const descendent of descendents[tree]) {\n markdown += describeTreeDescendentsMd(descendent, depth + 1);\n }\n return markdown;\n }\n return markdown;\n}\n\n/**\n * Describe a journey:\n * - Properties, tags, description, name, metadata\n * - Inner tree dependency tree\n * - Node type summary\n * - Nodes\n * - Themes\n * - Scripts\n * - Email templates\n * - Social identity providers\n * - SAML2 entity providers\n * - SAML2 circles of trust\n * @param {SingleTreeExportInterface} journeyData journey export object\n * @param {TreeExportResolverInterface} resolveTreeExport tree export resolver callback function\n */\nexport async function describeJourney(\n journeyData: SingleTreeExportInterface,\n resolveTreeExport: TreeExportResolverInterface = onlineTreeExportResolver\n): Promise<void> {\n const allNodes = {\n ...journeyData.nodes,\n ...journeyData.innerNodes,\n };\n const nodeTypeMap = {};\n\n for (const nodeData of Object.values(allNodes)) {\n if (nodeTypeMap[nodeData._type._id]) {\n nodeTypeMap[nodeData._type._id] += 1;\n } else {\n nodeTypeMap[nodeData._type._id] = 1;\n }\n }\n\n // initialize AM version from file\n if (!state.getAmVersion() && journeyData.meta?.originAmVersion) {\n state.setAmVersion(journeyData.meta.originAmVersion);\n }\n\n // Journey Name\n printMessage(`${getOneLineDescription(journeyData.tree)}`, 'data');\n printMessage(Array(`[${journeyData.tree._id}]`['length']).fill('=').join(''));\n\n // Description\n if (journeyData.tree.description) {\n printMessage(`\\n${journeyData.tree.description}`, 'data');\n }\n\n // Status\n printMessage(\n `\\nStatus\\n${\n journeyData.tree.enabled === false\n ? 'disabled'['brightRed']\n : 'enabled'['brightGreen']\n }`\n );\n\n // Classification\n if (state.getAmVersion()) {\n printMessage(\n `\\nClassification\\n${getJourneyClassification(journeyData).join(', ')}`,\n 'data'\n );\n }\n\n // Categories/Tags\n if (\n journeyData.tree.uiConfig?.categories &&\n journeyData.tree.uiConfig.categories != '[]'\n ) {\n printMessage('\\nCategories/Tags', 'data');\n printMessage(\n `${JSON.parse(journeyData.tree.uiConfig.categories).join(', ')}`,\n 'data'\n );\n }\n\n // Dependency Tree\n try {\n const descendents = await getTreeDescendents(\n journeyData,\n resolveTreeExport\n );\n describeTreeDescendents(descendents);\n } catch (error) {\n printMessage(`Error resolving inner tree dependencies:`, 'error');\n printMessage(error.stack, 'error');\n }\n\n // Node Types\n if (Object.entries(nodeTypeMap).length) {\n printMessage(\n `\\nNode Types (${Object.entries(nodeTypeMap).length}):`,\n 'data'\n );\n for (const [nodeType, count] of Object.entries(nodeTypeMap)) {\n printMessage(\n `- ${String(count)} [${\n nodeType['brightCyan']\n }] (${Node.getNodeClassification(nodeType).join(', ')})`,\n 'data'\n );\n }\n }\n\n // Nodes\n if (Object.entries(allNodes).length) {\n printMessage(`\\nNodes (${Object.entries(allNodes).length}):`, 'data');\n for (const nodeObj of Object.values<NodeSkeleton>(allNodes)) {\n printMessage(\n `- ${Node.getOneLineDescription(\n nodeObj,\n getNodeRef(nodeObj, journeyData)\n )}`,\n 'data'\n );\n }\n }\n\n // Themes\n if (journeyData.themes?.length) {\n printMessage(`\\nThemes (${journeyData.themes.length}):`, 'data');\n for (const themeData of journeyData.themes) {\n printMessage(`- ${Theme.getOneLineDescription(themeData)}`, 'data');\n }\n }\n\n // Scripts\n if (Object.entries(journeyData.scripts).length) {\n printMessage(\n `\\nScripts (${Object.entries(journeyData.scripts).length}):`,\n 'data'\n );\n for (const scriptData of Object.values(journeyData.scripts)) {\n printMessage(`- ${Script.getOneLineDescription(scriptData)}`, 'data');\n }\n }\n\n // Email Templates\n if (Object.entries(journeyData.emailTemplates).length) {\n printMessage(\n `\\nEmail Templates (${\n Object.entries(journeyData.emailTemplates).length\n }):`,\n 'data'\n );\n for (const templateData of Object.values(journeyData.emailTemplates)) {\n printMessage(\n `- ${EmailTemplate.getOneLineDescription(templateData)}`,\n 'data'\n );\n }\n }\n\n // Social Identity Providers\n if (Object.entries(journeyData.socialIdentityProviders).length) {\n printMessage(\n `\\nSocial Identity Providers (${\n Object.entries(journeyData.socialIdentityProviders).length\n }):`,\n 'data'\n );\n for (const socialIdpData of Object.values(\n journeyData.socialIdentityProviders\n )) {\n printMessage(`- ${Idp.getOneLineDescription(socialIdpData)}`, 'data');\n }\n }\n\n // SAML2 Entity Providers\n if (Object.entries(journeyData.saml2Entities).length) {\n printMessage(\n `\\nSAML2 Entity Providers (${\n Object.entries(journeyData.saml2Entities).length\n }):`,\n 'data'\n );\n for (const entityProviderData of Object.values(journeyData.saml2Entities)) {\n printMessage(\n `- ${Saml2.getOneLineDescription(entityProviderData)}`,\n 'data'\n );\n }\n }\n\n // SAML2 Circles Of Trust\n if (Object.entries(journeyData.circlesOfTrust).length) {\n printMessage(\n `\\nSAML2 Circles Of Trust (${\n Object.entries(journeyData.circlesOfTrust).length\n }):`,\n 'data'\n );\n for (const cotData of Object.values(journeyData.circlesOfTrust)) {\n printMessage(\n `- ${CirclesOfTrust.getOneLineDescription(cotData)}`,\n 'data'\n );\n }\n }\n}\n\n/**\n * Describe a journey in markdown:\n * - Properties, tags, description, name, metadata\n * - Inner tree dependency tree\n * - Node type summary\n * - Nodes\n * - Themes\n * - Scripts\n * - Email templates\n * - Social identity providers\n * - SAML2 entity providers\n * - SAML2 circles of trust\n * @param {SingleTreeExportInterface} journeyData journey export object\n * @param {TreeExportResolverInterface} resolveTreeExport tree export resolver callback function\n */\nexport async function describeJourneyMd(\n journeyData: SingleTreeExportInterface,\n resolveTreeExport: TreeExportResolverInterface = onlineTreeExportResolver\n) {\n const allNodes = {\n ...journeyData.nodes,\n ...journeyData.innerNodes,\n };\n const nodeTypeMap = {};\n\n for (const nodeData of Object.values(allNodes)) {\n if (nodeTypeMap[nodeData._type._id]) {\n nodeTypeMap[nodeData._type._id] += 1;\n } else {\n nodeTypeMap[nodeData._type._id] = 1;\n }\n }\n\n // initialize AM version from file\n if (!state.getAmVersion() && journeyData.meta?.originAmVersion) {\n state.setAmVersion(journeyData.meta.originAmVersion);\n }\n\n // Journey Name\n printMessage(\n `# ${getOneLineDescriptionMd(journeyData.tree)} - ${\n journeyData.tree.enabled === false\n ? ':o: `disabled`'\n : ':white_check_mark: `enabled`'\n }, ${getJourneyClassificationMd(journeyData).join(', ')}`,\n 'data'\n );\n\n // Categories/Tags\n if (\n journeyData.tree.uiConfig?.categories &&\n journeyData.tree.uiConfig.categories != '[]'\n ) {\n printMessage(\n `\\`${JSON.parse(journeyData.tree.uiConfig.categories).join('`, `')}\\``,\n 'data'\n );\n }\n\n // Description\n if (journeyData.tree.description) {\n printMessage(`\\n${journeyData.tree.description}`, 'data');\n }\n\n // Journey image\n printMessage(`\\n[![](./${journeyData.tree._id}.png)]()\\n`, 'data');\n\n // Dependency Tree\n const descendents = await getTreeDescendents(journeyData, resolveTreeExport);\n printMessage(describeTreeDescendentsMd(descendents), 'data');\n\n // Node Types\n if (Object.entries(nodeTypeMap).length) {\n printMessage(\n `## Node Types (${Object.entries(nodeTypeMap).length})`,\n 'data'\n );\n printMessage('| Count | Type | Classification |', 'data');\n printMessage('| -----:| ---- | -------------- |', 'data');\n for (const [nodeType, count] of Object.entries(nodeTypeMap)) {\n printMessage(\n `| ${String(count)} | ${nodeType} | ${Node.getNodeClassificationMd(\n nodeType\n ).join('<br>')} |`,\n 'data'\n );\n }\n }\n\n // Nodes\n if (Object.entries(allNodes).length) {\n printMessage(`## Nodes (${Object.entries(allNodes).length})`, 'data');\n printMessage(Node.getTableHeaderMd(), 'data');\n for (const nodeObj of Object.values<NodeSkeleton>(allNodes)) {\n printMessage(\n `${Node.getTableRowMd(nodeObj, getNodeRef(nodeObj, journeyData))}`,\n 'data'\n );\n }\n }\n\n // Themes\n if (journeyData.themes?.length) {\n printMessage(`## Themes (${journeyData.themes.length})`, 'data');\n printMessage(Theme.getTableHeaderMd(), 'data');\n for (const themeData of journeyData.themes) {\n printMessage(`${Theme.getTableRowMd(themeData)}`, 'data');\n }\n }\n\n // Scripts\n if (Object.entries(journeyData.scripts).length) {\n printMessage(\n `## Scripts (${Object.entries(journeyData.scripts).length})`,\n 'data'\n );\n printMessage(Script.getTableHeaderMd(), 'data');\n for (const scriptData of Object.values(journeyData.scripts)) {\n printMessage(`${Script.getTableRowMd(scriptData)}`, 'data');\n }\n }\n\n // Email Templates\n if (Object.entries(journeyData.emailTemplates).length) {\n printMessage(\n `## Email Templates (${\n Object.entries(journeyData.emailTemplates).length\n })`,\n 'data'\n );\n printMessage(EmailTemplate.getTableHeaderMd(), 'data');\n for (const templateData of Object.values(journeyData.emailTemplates)) {\n printMessage(`${EmailTemplate.getTableRowMd(templateData)}`, 'data');\n }\n }\n\n // Social Identity Providers\n if (Object.entries(journeyData.socialIdentityProviders).length) {\n printMessage(\n `## Social Identity Providers (${\n Object.entries(journeyData.socialIdentityProviders).length\n })`,\n 'data'\n );\n printMessage(Idp.getTableHeaderMd(), 'data');\n for (const socialIdpData of Object.values(\n journeyData.socialIdentityProviders\n )) {\n printMessage(`${Idp.getTableRowMd(socialIdpData)}`, 'data');\n }\n }\n\n // SAML2 Entity Providers\n if (Object.entries(journeyData.saml2Entities).length) {\n printMessage(\n `## SAML2 Entity Providers (${\n Object.entries(journeyData.saml2Entities).length\n })`,\n 'data'\n );\n printMessage(Saml2.getTableHeaderMd(), 'data');\n for (const entityProviderData of Object.values(journeyData.saml2Entities)) {\n printMessage(`${Saml2.getTableRowMd(entityProviderData)}`, 'data');\n }\n }\n\n // SAML2 Circles Of Trust\n if (Object.entries(journeyData.circlesOfTrust).length) {\n printMessage(\n `## SAML2 Circles Of Trust (${\n Object.entries(journeyData.circlesOfTrust).length\n })`,\n 'data'\n );\n printMessage(CirclesOfTrust.getTableHeaderMd(), 'data');\n for (const cotData of Object.values(journeyData.circlesOfTrust)) {\n printMessage(`${CirclesOfTrust.getTableRowMd(cotData)}`, 'data');\n }\n }\n}\n\nexport async function enableJourney(journeyId: string): Promise<boolean> {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Enabling journey ${journeyId}...`\n );\n if (_enableJourney(journeyId)) {\n stopProgressIndicator(\n indicatorId,\n `Enabled journey ${journeyId}.`,\n 'success'\n );\n return true;\n } else {\n stopProgressIndicator(\n indicatorId,\n `Error enabling journey ${journeyId}`,\n 'fail'\n );\n return false;\n }\n}\n\nexport async function disableJourney(journeyId: string): Promise<boolean> {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Disabling journey ${journeyId}...`\n );\n if (_disableJourney(journeyId)) {\n stopProgressIndicator(\n indicatorId,\n `Disabled journey ${journeyId}.`,\n 'success'\n );\n return true;\n } else {\n stopProgressIndicator(\n indicatorId,\n `Error disabling journey ${journeyId}`,\n 'fail'\n );\n return false;\n }\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAYpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,uBAAuB,EACvBC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AACzB,OAAO,KAAKC,cAAc,MAAM,qBAAqB;AACrD,OAAO,KAAKC,aAAa,MAAM,oBAAoB;AACnD,OAAO,KAAKC,GAAG,MAAM,UAAU;AAC/B,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAO,KAAKC,KAAK,MAAM,YAAY;AACnC,OAAO,KAAKC,MAAM,MAAM,aAAa;AACrC,OAAO,KAAKC,KAAK,MAAM,YAAY;AACnC,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,OAAOC,QAAQ,MAAM,kBAAkB;AAEvC,MAAM;EACJC,gBAAgB;EAChBC,cAAc;EACdC,cAAc;EACdC,WAAW;EACXC;AACF,CAAC,GAAGtB,KAAK,CAACuB,KAAK;AACf,MAAM;EACJC,YAAY;EACZC,aAAa;EACbC,cAAc;EACdC,mBAAmB;EACnBC,cAAc;EACdC,aAAa;EACbC,kBAAkB;EAClBC,UAAU;EACVC,wBAAwB;EACxBC,wBAAwB,EAAEC,yBAAyB;EACnDC,cAAc,EAAEC,eAAe;EAC/BC,aAAa,EAAEC;AAC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