@rockcarver/frodo-cli 0.23.1-4 → 0.23.1-5

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 (56) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/esm/app.js +2 -0
  3. package/esm/app.js.map +1 -1
  4. package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js +13 -6
  5. package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js.map +1 -1
  6. package/esm/cli/authz/authz-policy-delete.js +43 -0
  7. package/esm/cli/authz/authz-policy-delete.js.map +1 -0
  8. package/esm/cli/authz/authz-policy-describe.js +30 -0
  9. package/esm/cli/authz/authz-policy-describe.js.map +1 -0
  10. package/esm/cli/authz/authz-policy-export.js +70 -0
  11. package/esm/cli/authz/authz-policy-export.js.map +1 -0
  12. package/esm/cli/authz/authz-policy-import.js +26 -0
  13. package/esm/cli/authz/authz-policy-import.js.map +1 -0
  14. package/esm/cli/authz/authz-policy-list.js +37 -0
  15. package/esm/cli/authz/authz-policy-list.js.map +1 -0
  16. package/esm/cli/authz/authz-policy.js +10 -0
  17. package/esm/cli/authz/authz-policy.js.map +1 -0
  18. package/esm/cli/authz/authz-set-delete.js +37 -0
  19. package/esm/cli/authz/authz-set-delete.js.map +1 -0
  20. package/esm/cli/authz/authz-set-describe.js +30 -0
  21. package/esm/cli/authz/authz-set-describe.js.map +1 -0
  22. package/esm/cli/authz/authz-set-export.js +52 -0
  23. package/esm/cli/authz/authz-set-export.js.map +1 -0
  24. package/esm/cli/authz/authz-set-import.js +57 -0
  25. package/esm/cli/authz/authz-set-import.js.map +1 -0
  26. package/esm/cli/authz/authz-set-list.js +25 -0
  27. package/esm/cli/authz/authz-set-list.js.map +1 -0
  28. package/esm/cli/authz/authz-set.js +10 -0
  29. package/esm/cli/authz/authz-set.js.map +1 -0
  30. package/esm/cli/authz/authz-type-delete.js +38 -0
  31. package/esm/cli/authz/authz-type-delete.js.map +1 -0
  32. package/esm/cli/authz/authz-type-describe.js +30 -0
  33. package/esm/cli/authz/authz-type-describe.js.map +1 -0
  34. package/esm/cli/authz/authz-type-export.js +22 -0
  35. package/esm/cli/authz/authz-type-export.js.map +1 -0
  36. package/esm/cli/authz/authz-type-import.js +22 -0
  37. package/esm/cli/authz/authz-type-import.js.map +1 -0
  38. package/esm/cli/authz/authz-type-list.js +32 -0
  39. package/esm/cli/authz/authz-type-list.js.map +1 -0
  40. package/esm/cli/authz/authz-type.js +10 -0
  41. package/esm/cli/authz/authz-type.js.map +1 -0
  42. package/esm/cli/authz/authz.js +12 -0
  43. package/esm/cli/authz/authz.js.map +1 -0
  44. package/esm/cli/idm/idm-import.js +8 -3
  45. package/esm/cli/idm/idm-import.js.map +1 -1
  46. package/esm/ops/IdmOps.js +25 -2
  47. package/esm/ops/IdmOps.js.map +1 -1
  48. package/esm/ops/PolicyOps.js +392 -0
  49. package/esm/ops/PolicyOps.js.map +1 -0
  50. package/esm/ops/PolicySetOps.js +373 -0
  51. package/esm/ops/PolicySetOps.js.map +1 -0
  52. package/esm/ops/ResourceTypeOps.js +323 -0
  53. package/esm/ops/ResourceTypeOps.js.map +1 -0
  54. package/esm/utils/Console.js +2 -0
  55. package/esm/utils/Console.js.map +1 -1
  56. package/package.json +2 -2
@@ -0,0 +1,373 @@
1
+ import fs from 'fs';
2
+ import { Policy, PolicySet, Utils, state } from '@rockcarver/frodo-lib';
3
+ import { createObjectTable, createProgressBar, debugMessage, failSpinner, printMessage, showSpinner, stopProgressBar, succeedSpinner, updateProgressBar } from '../utils/Console';
4
+ import { getTypedFilename, saveJsonToFile, titleCase } from '../utils/ExportImportUtils';
5
+ const {
6
+ deletePolicySet: _deletePolicySet,
7
+ getPolicySets,
8
+ getPolicySet,
9
+ exportPolicySet,
10
+ exportPolicySets,
11
+ importPolicySet,
12
+ importFirstPolicySet,
13
+ importPolicySets
14
+ } = PolicySet;
15
+ const {
16
+ getPoliciesByPolicySet,
17
+ deletePolicy
18
+ } = Policy;
19
+ const {
20
+ getRealmName
21
+ } = Utils;
22
+
23
+ /**
24
+ * List policy sets
25
+ * @returns {Promise<boolean>} true if successful, false otherwise
26
+ */
27
+ export async function listPolicySets() {
28
+ let outcome = false;
29
+ try {
30
+ const policySets = await getPolicySets();
31
+ policySets.sort((a, b) => a.name.localeCompare(b.name));
32
+ for (const policySet of policySets) {
33
+ printMessage(`${policySet.name}`, 'data');
34
+ }
35
+ outcome = true;
36
+ } catch (err) {
37
+ printMessage(`listPolicySets ERROR: ${err.message}`, 'error');
38
+ printMessage(err, 'error');
39
+ }
40
+ return outcome;
41
+ }
42
+
43
+ /**
44
+ * Describe policy set
45
+ * @param {string} policySetId policy set id/name
46
+ * @param {Object} json JSON output
47
+ * @returns {Promise<boolean>} true if successful, false otherwise
48
+ */
49
+ export async function describePolicySet(policySetId, json = false) {
50
+ let outcome = false;
51
+ const policySet = await getPolicySet(policySetId);
52
+ outcome = true;
53
+ if (json) {
54
+ printMessage(policySet, 'data');
55
+ } else {
56
+ const table = createObjectTable(policySet);
57
+ printMessage(table.toString(), 'data');
58
+ }
59
+ return outcome;
60
+ }
61
+
62
+ /**
63
+ * Delete policy set
64
+ * @param {string} policySetId policy set id/name
65
+ * @returns {Promise<boolean>} true if successful, false otherwise
66
+ */
67
+ export async function deletePolicySet(policySetId) {
68
+ debugMessage(`cli.PolicySetOps.deletePolicySet: begin`);
69
+ showSpinner(`Deleting ${policySetId}...`);
70
+ let outcome = false;
71
+ const errors = [];
72
+ const policies = await getPoliciesByPolicySet(policySetId);
73
+ for (const policy of policies) {
74
+ try {
75
+ debugMessage(`Deleting policy ${policy._id}`);
76
+ await deletePolicy(policy._id);
77
+ } catch (error) {
78
+ error.message = `Error deleting policy ${policy._id} in policy set ${policySetId}: ${error}`;
79
+ printMessage(error.message, 'error');
80
+ errors.push(error);
81
+ }
82
+ }
83
+ try {
84
+ debugMessage(`Deleting policy set ${policySetId}`);
85
+ await _deletePolicySet(policySetId);
86
+ } catch (error) {
87
+ printMessage(`Error deleting policy set ${policySetId}: ${error}`, 'error');
88
+ }
89
+ if (errors.length) {
90
+ const errorMessages = errors.map(error => error.message).join('\n');
91
+ failSpinner(`Error deleting ${policySetId}: ${errorMessages}`);
92
+ } else {
93
+ succeedSpinner(`Deleted ${policySetId}.`);
94
+ outcome = true;
95
+ }
96
+ debugMessage(`cli.PolicySetOps.deletePolicySet: end [outcome=${outcome}]`);
97
+ return outcome;
98
+ }
99
+
100
+ /**
101
+ * Delete all policy sets
102
+ * @returns {Promise<boolean>} true if successful, false otherwise
103
+ */
104
+ export async function deletePolicySets() {
105
+ debugMessage(`cli.PolicySetOps.deletePolicySets: begin`);
106
+ let outcome = false;
107
+ const errors = [];
108
+ let policySets = [];
109
+ try {
110
+ showSpinner(`Retrieving all policy sets...`);
111
+ try {
112
+ policySets = await getPolicySets();
113
+ succeedSpinner(`Found ${policySets.length} policy sets.`);
114
+ } catch (error) {
115
+ error.message = `Error retrieving all policy sets: ${error.message}`;
116
+ failSpinner(error.message);
117
+ throw error;
118
+ }
119
+ if (policySets.length) createProgressBar(policySets.length, `Deleting ${policySets.length} policy sets...`);
120
+ for (const policySet of policySets) {
121
+ const policySetId = policySet.name;
122
+ try {
123
+ const policies = await getPoliciesByPolicySet(policySetId);
124
+ for (const policy of policies) {
125
+ try {
126
+ debugMessage(`Deleting policy ${policy._id}`);
127
+ await deletePolicy(policy._id);
128
+ } catch (error) {
129
+ error.message = `Error deleting policy ${policy._id} in policy set ${policySetId}: ${error}`;
130
+ printMessage(error.message, 'error');
131
+ errors.push(error);
132
+ }
133
+ }
134
+ } catch (error) {
135
+ errors.push(error);
136
+ }
137
+ try {
138
+ debugMessage(`Deleting policy set ${policySetId}`);
139
+ await _deletePolicySet(policySetId);
140
+ updateProgressBar(`Deleted ${policySetId}`);
141
+ } catch (error) {
142
+ error.message = `Error deleting policy set ${policySetId}: ${error}`;
143
+ updateProgressBar(error.message);
144
+ errors.push(error);
145
+ }
146
+ }
147
+ } catch (error) {
148
+ error.message = `Error deleting policy sets: ${error}`;
149
+ errors.push(error);
150
+ } finally {
151
+ if (errors.length) {
152
+ const errorMessages = errors.map(error => error.message).join('\n');
153
+ if (policySets.length) stopProgressBar(`Error deleting all policy sets: ${errorMessages}`);
154
+ } else {
155
+ if (policySets.length) stopProgressBar(`Deleted ${policySets.length} policy sets.`);
156
+ outcome = true;
157
+ }
158
+ }
159
+ debugMessage(`cli.PolicySetOps.deletePolicySets: end [outcome=${outcome}]`);
160
+ return outcome;
161
+ }
162
+
163
+ /**
164
+ * Export policy set to file
165
+ * @param {string} policySetId policy set id/name
166
+ * @param {string} file file name
167
+ * @param {PolicySetExportOptions} options export options
168
+ * @returns {Promise<boolean>} true if successful, false otherwise
169
+ */
170
+ export async function exportPolicySetToFile(policySetId, file, options = {
171
+ useStringArrays: true,
172
+ deps: true
173
+ }) {
174
+ let outcome = false;
175
+ debugMessage(`cli.PolicySetOps.exportPolicySetToFile: begin`);
176
+ showSpinner(`Exporting ${policySetId}...`);
177
+ try {
178
+ let fileName = getTypedFilename(policySetId, 'policyset.authz');
179
+ if (file) {
180
+ fileName = file;
181
+ }
182
+ const exportData = await exportPolicySet(policySetId, options);
183
+ saveJsonToFile(exportData, fileName);
184
+ succeedSpinner(`Exported ${policySetId} to ${fileName}.`);
185
+ outcome = true;
186
+ } catch (error) {
187
+ failSpinner(`Error exporting ${policySetId}: ${error.message}`);
188
+ }
189
+ debugMessage(`cli.PolicySetOps.exportPolicySetToFile: end`);
190
+ return outcome;
191
+ }
192
+
193
+ /**
194
+ * Export policy sets to file
195
+ * @param {string} file file name
196
+ * @param {PolicySetExportOptions} options export options
197
+ * @returns {Promise<boolean>} true if successful, false otherwise
198
+ */
199
+ export async function exportPolicySetsToFile(file, options = {
200
+ useStringArrays: true,
201
+ deps: true
202
+ }) {
203
+ let outcome = false;
204
+ debugMessage(`cli.PolicySetOps.exportPolicySetsToFile: begin`);
205
+ showSpinner(`Exporting all policy sets...`);
206
+ try {
207
+ let fileName = getTypedFilename(`all${titleCase(getRealmName(state.getRealm()))}PolicySets`, 'policyset.authz');
208
+ if (file) {
209
+ fileName = file;
210
+ }
211
+ const exportData = await exportPolicySets(options);
212
+ saveJsonToFile(exportData, fileName);
213
+ succeedSpinner(`Exported all policy sets to ${fileName}.`);
214
+ outcome = true;
215
+ } catch (error) {
216
+ failSpinner(`Error exporting policy sets: ${error.message}`);
217
+ }
218
+ debugMessage(`cli.PolicySetOps.exportPolicySetsToFile: end`);
219
+ return outcome;
220
+ }
221
+
222
+ /**
223
+ * Export all policy sets to separate files
224
+ * @param {PolicySetExportOptions} options export options
225
+ * @returns {Promise<boolean>} true if successful, false otherwise
226
+ */
227
+ export async function exportPolicySetsToFiles(options = {
228
+ useStringArrays: true,
229
+ deps: true
230
+ }) {
231
+ debugMessage(`cli.PolicySetOps.exportPolicySetsToFiles: begin`);
232
+ const errors = [];
233
+ try {
234
+ const policySets = await getPolicySets();
235
+ createProgressBar(policySets.length, 'Exporting policy sets...');
236
+ for (const policySet of policySets) {
237
+ const file = getTypedFilename(policySet.name, 'policyset.authz');
238
+ try {
239
+ const exportData = await exportPolicySet(policySet.name, options);
240
+ saveJsonToFile(exportData, file);
241
+ updateProgressBar(`Exported ${policySet.name}.`);
242
+ } catch (error) {
243
+ errors.push(error);
244
+ updateProgressBar(`Error exporting ${policySet.name}.`);
245
+ }
246
+ }
247
+ stopProgressBar(`Export complete.`);
248
+ } catch (error) {
249
+ errors.push(error);
250
+ stopProgressBar(`Error exporting policy sets to files`);
251
+ }
252
+ debugMessage(`cli.PolicySetOps.exportPolicySetsToFiles: end`);
253
+ return 0 === errors.length;
254
+ }
255
+
256
+ /**
257
+ * Import policy set from file
258
+ * @param {string} policySetId policy set id/name
259
+ * @param {string} file file name
260
+ * @param {PolicySetImportOptions} options import options
261
+ * @returns {Promise<boolean>} true if successful, false otherwise
262
+ */
263
+ export async function importPolicySetFromFile(policySetId, file, options = {
264
+ deps: true
265
+ }) {
266
+ let outcome = false;
267
+ debugMessage(`cli.PolicySetOps.importPolicySetFromFile: begin`);
268
+ showSpinner(`Importing ${policySetId}...`);
269
+ try {
270
+ const data = fs.readFileSync(file, 'utf8');
271
+ const fileData = JSON.parse(data);
272
+ await importPolicySet(policySetId, fileData, options);
273
+ outcome = true;
274
+ succeedSpinner(`Imported ${policySetId}.`);
275
+ } catch (error) {
276
+ failSpinner(`Error importing ${policySetId}.`);
277
+ printMessage(error, 'error');
278
+ }
279
+ debugMessage(`cli.PolicySetOps.importPolicySetFromFile: end`);
280
+ return outcome;
281
+ }
282
+
283
+ /**
284
+ * Import first policy set from file
285
+ * @param {string} file file name
286
+ * @param {PolicySetImportOptions} options import options
287
+ * @returns {Promise<boolean>} true if successful, false otherwise
288
+ */
289
+ export async function importFirstPolicySetFromFile(file, options = {
290
+ deps: true
291
+ }) {
292
+ let outcome = false;
293
+ debugMessage(`cli.PolicySetOps.importFirstPolicySetFromFile: begin`);
294
+ showSpinner(`Importing ${file}...`);
295
+ try {
296
+ const data = fs.readFileSync(file, 'utf8');
297
+ const fileData = JSON.parse(data);
298
+ await importFirstPolicySet(fileData, options);
299
+ outcome = true;
300
+ succeedSpinner(`Imported ${file}.`);
301
+ } catch (error) {
302
+ failSpinner(`Error importing ${file}.`);
303
+ printMessage(error, 'error');
304
+ }
305
+ debugMessage(`cli.PolicySetOps.importFirstPolicySetFromFile: end`);
306
+ return outcome;
307
+ }
308
+
309
+ /**
310
+ * Import policy sets from file
311
+ * @param {string} file file name
312
+ * @param {PolicySetImportOptions} options import options
313
+ * @returns {Promise<boolean>} true if successful, false otherwise
314
+ */
315
+ export async function importPolicySetsFromFile(file, options = {
316
+ deps: true
317
+ }) {
318
+ let outcome = false;
319
+ debugMessage(`cli.PolicySetOps.importPolicySetsFromFile: begin`);
320
+ showSpinner(`Importing ${file}...`);
321
+ try {
322
+ const data = fs.readFileSync(file, 'utf8');
323
+ const fileData = JSON.parse(data);
324
+ await importPolicySets(fileData, options);
325
+ outcome = true;
326
+ succeedSpinner(`Imported ${file}.`);
327
+ } catch (error) {
328
+ failSpinner(`Error importing ${file}.`);
329
+ printMessage(error, 'error');
330
+ }
331
+ debugMessage(`cli.PolicySetOps.importPolicySetsFromFile: end`);
332
+ return outcome;
333
+ }
334
+
335
+ /**
336
+ * Import policy sets from files
337
+ * @param {OAuth2ClientImportOptions} options import options
338
+ * @returns {Promise<boolean>} true if successful, false otherwise
339
+ */
340
+ export async function importPolicySetsFromFiles(options = {
341
+ deps: true
342
+ }) {
343
+ const errors = [];
344
+ try {
345
+ debugMessage(`cli.PolicySetOps.importPolicySetsFromFiles: begin`);
346
+ const names = fs.readdirSync('.');
347
+ const files = names.filter(name => name.toLowerCase().endsWith('.policyset.authz.json'));
348
+ createProgressBar(files.length, 'Importing policy sets...');
349
+ let total = 0;
350
+ for (const file of files) {
351
+ try {
352
+ const data = fs.readFileSync(file, 'utf8');
353
+ const fileData = JSON.parse(data);
354
+ const count = Object.keys(fileData.policyset).length;
355
+ total += count;
356
+ await importPolicySets(fileData, options);
357
+ updateProgressBar(`Imported ${count} policy sets from ${file}`);
358
+ } catch (error) {
359
+ errors.push(error);
360
+ updateProgressBar(`Error importing policy sets from ${file}`);
361
+ printMessage(error, 'error');
362
+ }
363
+ }
364
+ stopProgressBar(`Finished importing ${total} policy sets from ${files.length} files.`);
365
+ } catch (error) {
366
+ errors.push(error);
367
+ stopProgressBar(`Error importing policy sets from files.`);
368
+ printMessage(error, 'error');
369
+ }
370
+ debugMessage(`cli.PolicySetOps.importPolicySetsFromFiles: end`);
371
+ return 0 === errors.length;
372
+ }
373
+ //# sourceMappingURL=PolicySetOps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PolicySetOps.js","names":["fs","Policy","PolicySet","Utils","state","createObjectTable","createProgressBar","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","getTypedFilename","saveJsonToFile","titleCase","deletePolicySet","_deletePolicySet","getPolicySets","getPolicySet","exportPolicySet","exportPolicySets","importPolicySet","importFirstPolicySet","importPolicySets","getPoliciesByPolicySet","deletePolicy","getRealmName","listPolicySets","outcome","policySets","sort","a","b","name","localeCompare","policySet","err","message","describePolicySet","policySetId","json","table","toString","errors","policies","policy","_id","error","push","length","errorMessages","map","join","deletePolicySets","exportPolicySetToFile","file","options","useStringArrays","deps","fileName","exportData","exportPolicySetsToFile","getRealm","exportPolicySetsToFiles","importPolicySetFromFile","data","readFileSync","fileData","JSON","parse","importFirstPolicySetFromFile","importPolicySetsFromFile","importPolicySetsFromFiles","names","readdirSync","files","filter","toLowerCase","endsWith","total","count","Object","keys","policyset"],"sources":["ops/PolicySetOps.ts"],"sourcesContent":["import fs from 'fs';\nimport {\n PolicySetSkeleton,\n PolicySkeleton,\n} from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport { Policy, PolicySet, Utils, state } from '@rockcarver/frodo-lib';\nimport {\n createObjectTable,\n createProgressBar,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport {\n getTypedFilename,\n saveJsonToFile,\n titleCase,\n} from '../utils/ExportImportUtils';\nimport {\n PolicySetExportInterface,\n PolicySetExportOptions,\n PolicySetImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/PolicySetOps';\n\nconst {\n deletePolicySet: _deletePolicySet,\n getPolicySets,\n getPolicySet,\n exportPolicySet,\n exportPolicySets,\n importPolicySet,\n importFirstPolicySet,\n importPolicySets,\n} = PolicySet;\nconst { getPoliciesByPolicySet, deletePolicy } = Policy;\nconst { getRealmName } = Utils;\n\n/**\n * List policy sets\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listPolicySets(): Promise<boolean> {\n let outcome = false;\n try {\n const policySets = await getPolicySets();\n policySets.sort((a, b) => a.name.localeCompare(b.name));\n for (const policySet of policySets) {\n printMessage(`${policySet.name}`, 'data');\n }\n outcome = true;\n } catch (err) {\n printMessage(`listPolicySets ERROR: ${err.message}`, 'error');\n printMessage(err, 'error');\n }\n return outcome;\n}\n\n/**\n * Describe policy set\n * @param {string} policySetId policy set id/name\n * @param {Object} json JSON output\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describePolicySet(\n policySetId: string,\n json = false\n): Promise<boolean> {\n let outcome = false;\n const policySet = await getPolicySet(policySetId);\n outcome = true;\n if (json) {\n printMessage(policySet, 'data');\n } else {\n const table = createObjectTable(policySet);\n printMessage(table.toString(), 'data');\n }\n return outcome;\n}\n\n/**\n * Delete policy set\n * @param {string} policySetId policy set id/name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deletePolicySet(policySetId: string): Promise<boolean> {\n debugMessage(`cli.PolicySetOps.deletePolicySet: begin`);\n showSpinner(`Deleting ${policySetId}...`);\n let outcome = false;\n const errors = [];\n const policies: PolicySkeleton[] = await getPoliciesByPolicySet(policySetId);\n for (const policy of policies) {\n try {\n debugMessage(`Deleting policy ${policy._id}`);\n await deletePolicy(policy._id);\n } catch (error) {\n error.message = `Error deleting policy ${policy._id} in policy set ${policySetId}: ${error}`;\n printMessage(error.message, 'error');\n errors.push(error);\n }\n }\n try {\n debugMessage(`Deleting policy set ${policySetId}`);\n await _deletePolicySet(policySetId);\n } catch (error) {\n printMessage(`Error deleting policy set ${policySetId}: ${error}`, 'error');\n }\n if (errors.length) {\n const errorMessages = errors.map((error) => error.message).join('\\n');\n failSpinner(`Error deleting ${policySetId}: ${errorMessages}`);\n } else {\n succeedSpinner(`Deleted ${policySetId}.`);\n outcome = true;\n }\n debugMessage(`cli.PolicySetOps.deletePolicySet: end [outcome=${outcome}]`);\n return outcome;\n}\n\n/**\n * Delete all policy sets\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deletePolicySets(): Promise<boolean> {\n debugMessage(`cli.PolicySetOps.deletePolicySets: begin`);\n let outcome = false;\n const errors = [];\n let policySets: PolicySetSkeleton[] = [];\n try {\n showSpinner(`Retrieving all policy sets...`);\n try {\n policySets = await getPolicySets();\n succeedSpinner(`Found ${policySets.length} policy sets.`);\n } catch (error) {\n error.message = `Error retrieving all policy sets: ${error.message}`;\n failSpinner(error.message);\n throw error;\n }\n if (policySets.length)\n createProgressBar(\n policySets.length,\n `Deleting ${policySets.length} policy sets...`\n );\n for (const policySet of policySets) {\n const policySetId = policySet.name;\n try {\n const policies: PolicySkeleton[] = await getPoliciesByPolicySet(\n policySetId\n );\n for (const policy of policies) {\n try {\n debugMessage(`Deleting policy ${policy._id}`);\n await deletePolicy(policy._id);\n } catch (error) {\n error.message = `Error deleting policy ${policy._id} in policy set ${policySetId}: ${error}`;\n printMessage(error.message, 'error');\n errors.push(error);\n }\n }\n } catch (error) {\n errors.push(error);\n }\n try {\n debugMessage(`Deleting policy set ${policySetId}`);\n await _deletePolicySet(policySetId);\n updateProgressBar(`Deleted ${policySetId}`);\n } catch (error) {\n error.message = `Error deleting policy set ${policySetId}: ${error}`;\n updateProgressBar(error.message);\n errors.push(error);\n }\n }\n } catch (error) {\n error.message = `Error deleting policy sets: ${error}`;\n errors.push(error);\n } finally {\n if (errors.length) {\n const errorMessages = errors.map((error) => error.message).join('\\n');\n if (policySets.length)\n stopProgressBar(`Error deleting all policy sets: ${errorMessages}`);\n } else {\n if (policySets.length)\n stopProgressBar(`Deleted ${policySets.length} policy sets.`);\n outcome = true;\n }\n }\n debugMessage(`cli.PolicySetOps.deletePolicySets: end [outcome=${outcome}]`);\n return outcome;\n}\n\n/**\n * Export policy set to file\n * @param {string} policySetId policy set id/name\n * @param {string} file file name\n * @param {PolicySetExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportPolicySetToFile(\n policySetId: string,\n file: string,\n options: PolicySetExportOptions = { useStringArrays: true, deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.PolicySetOps.exportPolicySetToFile: begin`);\n showSpinner(`Exporting ${policySetId}...`);\n try {\n let fileName = getTypedFilename(policySetId, 'policyset.authz');\n if (file) {\n fileName = file;\n }\n const exportData = await exportPolicySet(policySetId, options);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported ${policySetId} to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${policySetId}: ${error.message}`);\n }\n debugMessage(`cli.PolicySetOps.exportPolicySetToFile: end`);\n return outcome;\n}\n\n/**\n * Export policy sets to file\n * @param {string} file file name\n * @param {PolicySetExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportPolicySetsToFile(\n file: string,\n options: PolicySetExportOptions = { useStringArrays: true, deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.PolicySetOps.exportPolicySetsToFile: begin`);\n showSpinner(`Exporting all policy sets...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}PolicySets`,\n 'policyset.authz'\n );\n if (file) {\n fileName = file;\n }\n const exportData = await exportPolicySets(options);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported all policy sets to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting policy sets: ${error.message}`);\n }\n debugMessage(`cli.PolicySetOps.exportPolicySetsToFile: end`);\n return outcome;\n}\n\n/**\n * Export all policy sets to separate files\n * @param {PolicySetExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportPolicySetsToFiles(\n options: PolicySetExportOptions = { useStringArrays: true, deps: true }\n): Promise<boolean> {\n debugMessage(`cli.PolicySetOps.exportPolicySetsToFiles: begin`);\n const errors = [];\n try {\n const policySets: PolicySetSkeleton[] = await getPolicySets();\n createProgressBar(policySets.length, 'Exporting policy sets...');\n for (const policySet of policySets) {\n const file = getTypedFilename(policySet.name, 'policyset.authz');\n try {\n const exportData: PolicySetExportInterface = await exportPolicySet(\n policySet.name,\n options\n );\n saveJsonToFile(exportData, file);\n updateProgressBar(`Exported ${policySet.name}.`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error exporting ${policySet.name}.`);\n }\n }\n stopProgressBar(`Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error exporting policy sets to files`);\n }\n debugMessage(`cli.PolicySetOps.exportPolicySetsToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import policy set from file\n * @param {string} policySetId policy set id/name\n * @param {string} file file name\n * @param {PolicySetImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importPolicySetFromFile(\n policySetId: string,\n file: string,\n options: PolicySetImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.PolicySetOps.importPolicySetFromFile: begin`);\n showSpinner(`Importing ${policySetId}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importPolicySet(policySetId, fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${policySetId}.`);\n } catch (error) {\n failSpinner(`Error importing ${policySetId}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.PolicySetOps.importPolicySetFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first policy set from file\n * @param {string} file file name\n * @param {PolicySetImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstPolicySetFromFile(\n file: string,\n options: PolicySetImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.PolicySetOps.importFirstPolicySetFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importFirstPolicySet(fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.PolicySetOps.importFirstPolicySetFromFile: end`);\n return outcome;\n}\n\n/**\n * Import policy sets from file\n * @param {string} file file name\n * @param {PolicySetImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importPolicySetsFromFile(\n file: string,\n options: PolicySetImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.PolicySetOps.importPolicySetsFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importPolicySets(fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.PolicySetOps.importPolicySetsFromFile: end`);\n return outcome;\n}\n\n/**\n * Import policy sets from files\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importPolicySetsFromFiles(\n options: PolicySetImportOptions = { deps: true }\n): Promise<boolean> {\n const errors = [];\n try {\n debugMessage(`cli.PolicySetOps.importPolicySetsFromFiles: begin`);\n const names = fs.readdirSync('.');\n const files = names.filter((name) =>\n name.toLowerCase().endsWith('.policyset.authz.json')\n );\n createProgressBar(files.length, 'Importing policy sets...');\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: PolicySetExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.policyset).length;\n total += count;\n await importPolicySets(fileData, options);\n updateProgressBar(`Imported ${count} policy sets from ${file}`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error importing policy sets from ${file}`);\n printMessage(error, 'error');\n }\n }\n stopProgressBar(\n `Finished importing ${total} policy sets from ${files.length} files.`\n );\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error importing policy sets from files.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.PolicySetOps.importPolicySetsFromFiles: end`);\n return 0 === errors.length;\n}\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AAKnB,SAASC,MAAM,EAAEC,SAAS,EAAEC,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACvE,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,YAAY,EACZC,W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