@rockcarver/frodo-cli 2.0.0-51 → 2.0.0-52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -1
- package/esm/app.js +7 -2
- package/esm/app.js.map +1 -1
- package/esm/cli/admin/admin-add-autoid-static-user-mapping.js +3 -6
- package/esm/cli/admin/admin-add-autoid-static-user-mapping.js.map +1 -1
- package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js +46 -51
- package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-federation-export.js +1 -1
- package/esm/cli/admin/admin-federation-export.js.map +1 -1
- package/esm/cli/admin/admin-federation-import.js +1 -1
- package/esm/cli/admin/admin-federation-import.js.map +1 -1
- package/esm/cli/admin/admin-federation-list.js +1 -1
- package/esm/cli/admin/admin-federation-list.js.map +1 -1
- package/esm/cli/admin/admin-grant-oauth2-client-admin-privileges.js +4 -6
- package/esm/cli/admin/admin-grant-oauth2-client-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-hide-generic-extension-attributes.js +4 -6
- package/esm/cli/admin/admin-hide-generic-extension-attributes.js.map +1 -1
- package/esm/cli/admin/admin-list-oauth2-clients-with-admin-privileges.js +4 -9
- package/esm/cli/admin/admin-list-oauth2-clients-with-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-list-oauth2-clients-with-custom-privileges.js +4 -9
- package/esm/cli/admin/admin-list-oauth2-clients-with-custom-privileges.js.map +1 -1
- package/esm/cli/admin/admin-list-static-user-mappings.js +3 -9
- package/esm/cli/admin/admin-list-static-user-mappings.js.map +1 -1
- package/esm/cli/admin/admin-remove-static-user-mapping.js +3 -6
- package/esm/cli/admin/admin-remove-static-user-mapping.js.map +1 -1
- package/esm/cli/admin/admin-repair-org-model.js +4 -6
- package/esm/cli/admin/admin-repair-org-model.js.map +1 -1
- package/esm/cli/admin/admin-revoke-oauth2-client-admin-privileges.js +4 -6
- package/esm/cli/admin/admin-revoke-oauth2-client-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-show-generic-extension-attributes.js +4 -6
- package/esm/cli/admin/admin-show-generic-extension-attributes.js.map +1 -1
- package/esm/cli/agent/agent-delete.js +8 -21
- package/esm/cli/agent/agent-delete.js.map +1 -1
- package/esm/cli/agent/agent-export.js +6 -3
- package/esm/cli/agent/agent-export.js.map +1 -1
- package/esm/cli/agent/agent-gateway-delete.js +7 -20
- package/esm/cli/agent/agent-gateway-delete.js.map +1 -1
- package/esm/cli/agent/agent-gateway-export.js +6 -3
- package/esm/cli/agent/agent-gateway-export.js.map +1 -1
- package/esm/cli/agent/agent-gateway-import.js +8 -4
- package/esm/cli/agent/agent-gateway-import.js.map +1 -1
- package/esm/cli/agent/agent-gateway-list.js +2 -1
- package/esm/cli/agent/agent-gateway-list.js.map +1 -1
- package/esm/cli/agent/agent-import.js +8 -4
- package/esm/cli/agent/agent-import.js.map +1 -1
- package/esm/cli/agent/agent-java-delete.js +7 -20
- package/esm/cli/agent/agent-java-delete.js.map +1 -1
- package/esm/cli/agent/agent-java-export.js +6 -3
- package/esm/cli/agent/agent-java-export.js.map +1 -1
- package/esm/cli/agent/agent-java-import.js +8 -4
- package/esm/cli/agent/agent-java-import.js.map +1 -1
- package/esm/cli/agent/agent-java-list.js +2 -1
- package/esm/cli/agent/agent-java-list.js.map +1 -1
- package/esm/cli/agent/agent-list.js +2 -1
- package/esm/cli/agent/agent-list.js.map +1 -1
- package/esm/cli/agent/agent-web-delete.js +7 -20
- package/esm/cli/agent/agent-web-delete.js.map +1 -1
- package/esm/cli/agent/agent-web-export.js +6 -3
- package/esm/cli/agent/agent-web-export.js.map +1 -1
- package/esm/cli/agent/agent-web-import.js +8 -4
- package/esm/cli/agent/agent-web-import.js.map +1 -1
- package/esm/cli/agent/agent-web-list.js +2 -1
- package/esm/cli/agent/agent-web-list.js.map +1 -1
- package/esm/cli/app/app-delete.js +4 -4
- package/esm/cli/app/app-delete.js.map +1 -1
- package/esm/cli/app/app-export.js +6 -6
- package/esm/cli/app/app-export.js.map +1 -1
- package/esm/cli/app/app-import.js +8 -8
- package/esm/cli/app/app-import.js.map +1 -1
- package/esm/cli/app/app-list.js +2 -1
- package/esm/cli/app/app-list.js.map +1 -1
- package/esm/cli/conn/conn-delete.js +7 -1
- package/esm/cli/conn/conn-delete.js.map +1 -1
- package/esm/cli/conn/conn-save.js +9 -9
- package/esm/cli/conn/conn-save.js.map +1 -1
- package/esm/cli/email/email-template-export.js +6 -3
- package/esm/cli/email/email-template-export.js.map +1 -1
- package/esm/cli/email/email-template-import.js +8 -4
- package/esm/cli/email/email-template-import.js.map +1 -1
- package/esm/cli/email/email-template-list.js +2 -1
- package/esm/cli/email/email-template-list.js.map +1 -1
- package/esm/cli/esv/esv-secret-create.js +1 -1
- package/esm/cli/esv/esv-secret-create.js.map +1 -1
- package/esm/cli/esv/esv-secret-delete.js +1 -1
- package/esm/cli/esv/esv-secret-delete.js.map +1 -1
- package/esm/cli/esv/esv-secret-describe.js +1 -1
- package/esm/cli/esv/esv-secret-describe.js.map +1 -1
- package/esm/cli/esv/esv-secret-export.js +1 -1
- package/esm/cli/esv/esv-secret-export.js.map +1 -1
- package/esm/cli/esv/esv-secret-list.js +1 -1
- package/esm/cli/esv/esv-secret-list.js.map +1 -1
- package/esm/cli/esv/esv-secret-set.js +1 -1
- package/esm/cli/esv/esv-secret-set.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-activate.js +1 -1
- package/esm/cli/esv/esv-secret-version-activate.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-create.js +1 -1
- package/esm/cli/esv/esv-secret-version-create.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-deactivate.js +1 -1
- package/esm/cli/esv/esv-secret-version-deactivate.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-delete.js +1 -1
- package/esm/cli/esv/esv-secret-version-delete.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-list.js +1 -1
- package/esm/cli/esv/esv-secret-version-list.js.map +1 -1
- package/esm/cli/esv/esv-variable-create.js +1 -1
- package/esm/cli/esv/esv-variable-create.js.map +1 -1
- package/esm/cli/esv/esv-variable-delete.js +1 -1
- package/esm/cli/esv/esv-variable-delete.js.map +1 -1
- package/esm/cli/esv/esv-variable-describe.js +1 -1
- package/esm/cli/esv/esv-variable-describe.js.map +1 -1
- package/esm/cli/esv/esv-variable-export.js +1 -1
- package/esm/cli/esv/esv-variable-export.js.map +1 -1
- package/esm/cli/esv/esv-variable-list.js +1 -1
- package/esm/cli/esv/esv-variable-list.js.map +1 -1
- package/esm/cli/esv/esv-variable-set.js +1 -1
- package/esm/cli/esv/esv-variable-set.js.map +1 -1
- package/esm/cli/idm/idm-count.js +2 -1
- package/esm/cli/idm/idm-count.js.map +1 -1
- package/esm/cli/idm/idm-export.js +6 -3
- package/esm/cli/idm/idm-export.js.map +1 -1
- package/esm/cli/idm/idm-import.js +8 -4
- package/esm/cli/idm/idm-import.js.map +1 -1
- package/esm/cli/idm/idm-list.js +2 -1
- package/esm/cli/idm/idm-list.js.map +1 -1
- package/esm/cli/idp/idp-export.js +6 -3
- package/esm/cli/idp/idp-export.js.map +1 -1
- package/esm/cli/idp/idp-import.js +8 -4
- package/esm/cli/idp/idp-import.js.map +1 -1
- package/esm/cli/idp/idp-list.js +2 -1
- package/esm/cli/idp/idp-list.js.map +1 -1
- package/esm/cli/journey/journey-delete.js +6 -7
- package/esm/cli/journey/journey-delete.js.map +1 -1
- package/esm/cli/journey/journey-describe.js +15 -9
- package/esm/cli/journey/journey-describe.js.map +1 -1
- package/esm/cli/journey/journey-export.js +6 -3
- package/esm/cli/journey/journey-export.js.map +1 -1
- package/esm/cli/journey/journey-import.js +8 -4
- package/esm/cli/journey/journey-import.js.map +1 -1
- package/esm/cli/journey/journey-list.js +2 -1
- package/esm/cli/journey/journey-list.js.map +1 -1
- package/esm/cli/journey/journey-prune.js +3 -2
- package/esm/cli/journey/journey-prune.js.map +1 -1
- package/esm/cli/log/log-fetch.js +6 -2
- package/esm/cli/log/log-fetch.js.map +1 -1
- package/esm/cli/log/log-list.js +12 -3
- package/esm/cli/log/log-list.js.map +1 -1
- package/esm/cli/log/log-tail.js +6 -2
- package/esm/cli/log/log-tail.js.map +1 -1
- package/esm/cli/oauth/oauth-client-export.js +6 -6
- package/esm/cli/oauth/oauth-client-export.js.map +1 -1
- package/esm/cli/oauth/oauth-client-import.js +8 -8
- package/esm/cli/oauth/oauth-client-import.js.map +1 -1
- package/esm/cli/oauth/oauth-client-list.js +2 -1
- package/esm/cli/oauth/oauth-client-list.js.map +1 -1
- package/esm/cli/saml/saml-describe.js +2 -1
- package/esm/cli/saml/saml-describe.js.map +1 -1
- package/esm/cli/saml/saml-export.js +6 -3
- package/esm/cli/saml/saml-export.js.map +1 -1
- package/esm/cli/saml/saml-import.js +8 -4
- package/esm/cli/saml/saml-import.js.map +1 -1
- package/esm/cli/saml/saml-list.js +2 -1
- package/esm/cli/saml/saml-list.js.map +1 -1
- package/esm/cli/saml/saml-metadata-export.js +10 -2
- package/esm/cli/saml/saml-metadata-export.js.map +1 -1
- package/esm/cli/script/script-delete.js +10 -4
- package/esm/cli/script/script-delete.js.map +1 -1
- package/esm/cli/script/script-export.js +9 -13
- package/esm/cli/script/script-export.js.map +1 -1
- package/esm/cli/script/script-import.js +19 -14
- package/esm/cli/script/script-import.js.map +1 -1
- package/esm/cli/service/service-delete.js +4 -2
- package/esm/cli/service/service-delete.js.map +1 -1
- package/esm/cli/service/service-export.js +6 -3
- package/esm/cli/service/service-export.js.map +1 -1
- package/esm/cli/service/service-import.js +8 -4
- package/esm/cli/service/service-import.js.map +1 -1
- package/esm/cli/service/service-list.js +2 -1
- package/esm/cli/service/service-list.js.map +1 -1
- package/esm/cli/shell/shell.js +2 -4
- package/esm/cli/shell/shell.js.map +1 -1
- package/esm/cli/theme/theme-delete.js +7 -4
- package/esm/cli/theme/theme-delete.js.map +1 -1
- package/esm/cli/theme/theme-export.js +8 -4
- package/esm/cli/theme/theme-export.js.map +1 -1
- package/esm/cli/theme/theme-import.js +10 -5
- package/esm/cli/theme/theme-import.js.map +1 -1
- package/esm/cli/theme/theme-list.js +2 -1
- package/esm/cli/theme/theme-list.js.map +1 -1
- package/esm/ops/AdminOps.js +790 -3
- package/esm/ops/AdminOps.js.map +1 -1
- package/esm/ops/AgentOps.js +638 -305
- package/esm/ops/AgentOps.js.map +1 -1
- package/esm/ops/ApplicationOps.js +91 -79
- package/esm/ops/ApplicationOps.js.map +1 -1
- package/esm/ops/AuthenticateOps.js +4 -9
- package/esm/ops/AuthenticateOps.js.map +1 -1
- package/esm/ops/AuthenticationSettingsOps.js +22 -23
- package/esm/ops/AuthenticationSettingsOps.js.map +1 -1
- package/esm/ops/CirclesOfTrustOps.js +52 -55
- package/esm/ops/CirclesOfTrustOps.js.map +1 -1
- package/esm/ops/ConfigOps.js +100 -84
- package/esm/ops/ConfigOps.js.map +1 -1
- package/esm/ops/ConnectionProfileOps.js +9 -7
- package/esm/ops/ConnectionProfileOps.js.map +1 -1
- package/esm/ops/EmailTemplateOps.js +64 -47
- package/esm/ops/EmailTemplateOps.js.map +1 -1
- package/esm/ops/IdmOps.js +149 -117
- package/esm/ops/IdmOps.js.map +1 -1
- package/esm/ops/IdpOps.js +76 -46
- package/esm/ops/IdpOps.js.map +1 -1
- package/esm/ops/JourneyOps.js +333 -238
- package/esm/ops/JourneyOps.js.map +1 -1
- package/esm/ops/LogOps.js +15 -23
- package/esm/ops/LogOps.js.map +1 -1
- package/esm/ops/OAuth2ClientOps.js +43 -36
- package/esm/ops/OAuth2ClientOps.js.map +1 -1
- package/esm/ops/PolicyOps.js +104 -108
- package/esm/ops/PolicyOps.js.map +1 -1
- package/esm/ops/PolicySetOps.js +72 -78
- package/esm/ops/PolicySetOps.js.map +1 -1
- package/esm/ops/ResourceTypeOps.js +84 -99
- package/esm/ops/ResourceTypeOps.js.map +1 -1
- package/esm/ops/Saml2Ops.js +132 -88
- package/esm/ops/Saml2Ops.js.map +1 -1
- package/esm/ops/ScriptOps.js +90 -80
- package/esm/ops/ScriptOps.js.map +1 -1
- package/esm/ops/ServiceOps.js +125 -87
- package/esm/ops/ServiceOps.js.map +1 -1
- package/esm/ops/ThemeOps.js +170 -139
- package/esm/ops/ThemeOps.js.map +1 -1
- package/esm/ops/{AdminFederationOps.js → cloud/AdminFederationOps.js} +10 -16
- package/esm/ops/cloud/AdminFederationOps.js.map +1 -0
- package/esm/ops/{SecretsOps.js → cloud/SecretsOps.js} +123 -129
- package/esm/ops/cloud/SecretsOps.js.map +1 -0
- package/esm/ops/{VariablesOps.js → cloud/VariablesOps.js} +48 -52
- package/esm/ops/cloud/VariablesOps.js.map +1 -0
- package/esm/ops/templates/OAuth2ClientTemplate.json +270 -0
- package/esm/ops/templates/OAuth2TrustedJwtIssuerTemplate.json +38 -0
- package/esm/ops/templates/OrgModelUserAttributesTemplate.json +149 -0
- package/esm/ops/templates/autoaccess/IPAddresses.json +202 -0
- package/esm/ops/templates/autoaccess/UserAgents.json +35 -0
- package/esm/ops/templates/autoaccess/Usernames.json +203 -0
- package/esm/ops/templates/cloud/GenericExtensionAttributesTemplate.json +392 -0
- package/esm/ops/templates/cloud/managed.json +4119 -0
- package/esm/ops/utils/OpsUtils.js.map +1 -1
- package/esm/utils/Console.js +31 -0
- package/esm/utils/Console.js.map +1 -1
- package/package.json +10 -6
- package/esm/ops/AdminFederationOps.js.map +0 -1
- package/esm/ops/SecretsOps.js.map +0 -1
- package/esm/ops/VariablesOps.js.map +0 -1
package/esm/ops/PolicyOps.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { frodo, state } from '@rockcarver/frodo-lib';
|
|
1
|
+
import { frodo, FrodoError, state } from '@rockcarver/frodo-lib';
|
|
2
2
|
import fs from 'fs';
|
|
3
|
-
import { createObjectTable, createProgressIndicator, createTable, debugMessage, failSpinner, printMessage, showSpinner, stopProgressIndicator, succeedSpinner, updateProgressIndicator } from '../utils/Console';
|
|
3
|
+
import { createObjectTable, createProgressIndicator, createTable, debugMessage, failSpinner, printError, printMessage, showSpinner, stopProgressIndicator, succeedSpinner, updateProgressIndicator } from '../utils/Console';
|
|
4
4
|
const {
|
|
5
5
|
getRealmName,
|
|
6
6
|
getTypedFilename,
|
|
@@ -28,7 +28,6 @@ const {
|
|
|
28
28
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
29
29
|
*/
|
|
30
30
|
export async function listPolicies(long = false) {
|
|
31
|
-
let outcome = false;
|
|
32
31
|
try {
|
|
33
32
|
const policies = await readPolicies();
|
|
34
33
|
policies.sort((a, b) => a._id.localeCompare(b._id));
|
|
@@ -43,12 +42,11 @@ export async function listPolicies(long = false) {
|
|
|
43
42
|
printMessage(`${policy._id}`, 'data');
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
|
-
|
|
47
|
-
} catch (
|
|
48
|
-
|
|
49
|
-
printMessage(err, 'error');
|
|
45
|
+
return true;
|
|
46
|
+
} catch (error) {
|
|
47
|
+
printError(error);
|
|
50
48
|
}
|
|
51
|
-
return
|
|
49
|
+
return false;
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
/**
|
|
@@ -74,9 +72,8 @@ export async function listPoliciesByPolicySet(policySetId, long = false) {
|
|
|
74
72
|
}
|
|
75
73
|
}
|
|
76
74
|
outcome = true;
|
|
77
|
-
} catch (
|
|
78
|
-
|
|
79
|
-
printMessage(err, 'error');
|
|
75
|
+
} catch (error) {
|
|
76
|
+
printError(error);
|
|
80
77
|
}
|
|
81
78
|
return outcome;
|
|
82
79
|
}
|
|
@@ -88,16 +85,19 @@ export async function listPoliciesByPolicySet(policySetId, long = false) {
|
|
|
88
85
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
89
86
|
*/
|
|
90
87
|
export async function describePolicy(policyId, json = false) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
88
|
+
try {
|
|
89
|
+
const policySet = await readPolicy(policyId);
|
|
90
|
+
if (json) {
|
|
91
|
+
printMessage(policySet, 'data');
|
|
92
|
+
} else {
|
|
93
|
+
const table = createObjectTable(policySet);
|
|
94
|
+
printMessage(table.toString(), 'data');
|
|
95
|
+
}
|
|
96
|
+
return true;
|
|
97
|
+
} catch (error) {
|
|
98
|
+
printError(error);
|
|
99
99
|
}
|
|
100
|
-
return
|
|
100
|
+
return false;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/**
|
|
@@ -108,17 +108,17 @@ export async function describePolicy(policyId, json = false) {
|
|
|
108
108
|
export async function deletePolicyById(policyId) {
|
|
109
109
|
debugMessage(`cli.PolicyOps.deletePolicy: begin`);
|
|
110
110
|
showSpinner(`Deleting ${policyId}...`);
|
|
111
|
-
let outcome = false;
|
|
112
111
|
try {
|
|
113
112
|
debugMessage(`Deleting policy ${policyId}`);
|
|
114
113
|
await deletePolicy(policyId);
|
|
115
114
|
succeedSpinner(`Deleted ${policyId}.`);
|
|
116
|
-
|
|
115
|
+
debugMessage(`cli.PolicyOps.deletePolicy: end]`);
|
|
116
|
+
return true;
|
|
117
117
|
} catch (error) {
|
|
118
|
-
failSpinner(`Error deleting policy ${policyId}
|
|
118
|
+
failSpinner(`Error deleting policy ${policyId}`);
|
|
119
|
+
printError(error);
|
|
119
120
|
}
|
|
120
|
-
|
|
121
|
-
return outcome;
|
|
121
|
+
return false;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
/**
|
|
@@ -127,7 +127,6 @@ export async function deletePolicyById(policyId) {
|
|
|
127
127
|
*/
|
|
128
128
|
export async function deletePolicies() {
|
|
129
129
|
debugMessage(`cli.PolicyOps.deletePolicies: begin`);
|
|
130
|
-
let outcome = false;
|
|
131
130
|
const errors = [];
|
|
132
131
|
let policies = [];
|
|
133
132
|
let indicatorId;
|
|
@@ -137,9 +136,8 @@ export async function deletePolicies() {
|
|
|
137
136
|
policies = await readPolicies();
|
|
138
137
|
succeedSpinner(`Found ${policies.length} policies.`);
|
|
139
138
|
} catch (error) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
throw error;
|
|
139
|
+
failSpinner(`Error retrieving all policies`);
|
|
140
|
+
throw new FrodoError(`Error retrieving all policies`, error);
|
|
143
141
|
}
|
|
144
142
|
if (policies.length) indicatorId = createProgressIndicator('determinate', policies.length, `Deleting ${policies.length} policies...`);
|
|
145
143
|
for (const policy of policies) {
|
|
@@ -149,25 +147,23 @@ export async function deletePolicies() {
|
|
|
149
147
|
await deletePolicy(policyId);
|
|
150
148
|
updateProgressIndicator(indicatorId, `Deleted ${policyId}`);
|
|
151
149
|
} catch (error) {
|
|
152
|
-
|
|
153
|
-
updateProgressIndicator(indicatorId, error.message);
|
|
154
|
-
errors.push(error);
|
|
150
|
+
errors.push(new FrodoError(`Error deleting policy ${policyId}`, error));
|
|
155
151
|
}
|
|
156
152
|
}
|
|
157
153
|
} catch (error) {
|
|
158
|
-
|
|
159
|
-
errors.push(error);
|
|
154
|
+
errors.push(new FrodoError(`Error deleting policies`, error));
|
|
160
155
|
} finally {
|
|
161
|
-
if (errors.length) {
|
|
162
|
-
|
|
163
|
-
|
|
156
|
+
if (errors.length > 0) {
|
|
157
|
+
if (policies.length) stopProgressIndicator(indicatorId, `Error deleting all policies`, 'fail');
|
|
158
|
+
for (const error of errors) {
|
|
159
|
+
printError(error);
|
|
160
|
+
}
|
|
164
161
|
} else {
|
|
165
162
|
if (policies.length) stopProgressIndicator(indicatorId, `Deleted ${policies.length} policies.`);
|
|
166
|
-
outcome = true;
|
|
167
163
|
}
|
|
168
164
|
}
|
|
169
|
-
debugMessage(`cli.PolicyOps.deletePolicies: end
|
|
170
|
-
return
|
|
165
|
+
debugMessage(`cli.PolicyOps.deletePolicies: end`);
|
|
166
|
+
return errors.length === 0;
|
|
171
167
|
}
|
|
172
168
|
|
|
173
169
|
/**
|
|
@@ -177,7 +173,6 @@ export async function deletePolicies() {
|
|
|
177
173
|
*/
|
|
178
174
|
export async function deletePoliciesByPolicySet(policySetId) {
|
|
179
175
|
debugMessage(`cli.PolicyOps.deletePoliciesByPolicySet: begin`);
|
|
180
|
-
let outcome = false;
|
|
181
176
|
const errors = [];
|
|
182
177
|
let policies = [];
|
|
183
178
|
let indicatorId;
|
|
@@ -187,9 +182,8 @@ export async function deletePoliciesByPolicySet(policySetId) {
|
|
|
187
182
|
policies = await readPoliciesByPolicySet(policySetId);
|
|
188
183
|
succeedSpinner(`Found ${policies.length} policies in policy set ${policySetId}.`);
|
|
189
184
|
} catch (error) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
throw error;
|
|
185
|
+
failSpinner(`Error retrieving all policies from policy set ${policySetId}`);
|
|
186
|
+
throw new FrodoError(`Error retrieving all policies from policy set ${policySetId}`, error);
|
|
193
187
|
}
|
|
194
188
|
if (policies.length) indicatorId = createProgressIndicator('determinate', policies.length, `Deleting ${policies.length} policies from policy set ${policySetId}...`);
|
|
195
189
|
for (const policy of policies) {
|
|
@@ -199,25 +193,23 @@ export async function deletePoliciesByPolicySet(policySetId) {
|
|
|
199
193
|
await deletePolicy(policyId);
|
|
200
194
|
updateProgressIndicator(indicatorId, `Deleted ${policyId}`);
|
|
201
195
|
} catch (error) {
|
|
202
|
-
|
|
203
|
-
updateProgressIndicator(indicatorId, error.message);
|
|
204
|
-
errors.push(error);
|
|
196
|
+
errors.push(new FrodoError(`Error deleting policy ${policyId} from policy set ${policySetId}`, error));
|
|
205
197
|
}
|
|
206
198
|
}
|
|
207
199
|
} catch (error) {
|
|
208
|
-
|
|
209
|
-
errors.push(error);
|
|
200
|
+
errors.push(new FrodoError(`Error deleting policies from policy set ${policySetId}`, error));
|
|
210
201
|
} finally {
|
|
211
202
|
if (errors.length) {
|
|
212
|
-
|
|
213
|
-
|
|
203
|
+
if (policies.length) stopProgressIndicator(indicatorId, `Error deleting all policies from policy set ${policySetId}`, 'fail');
|
|
204
|
+
for (const error of errors) {
|
|
205
|
+
printError(error);
|
|
206
|
+
}
|
|
214
207
|
} else {
|
|
215
208
|
if (policies.length) stopProgressIndicator(indicatorId, `Deleted ${policies.length} policies.`);
|
|
216
|
-
outcome = true;
|
|
217
209
|
}
|
|
218
210
|
}
|
|
219
|
-
debugMessage(`cli.PolicyOps.deletePoliciesByPolicySet: end
|
|
220
|
-
return
|
|
211
|
+
debugMessage(`cli.PolicyOps.deletePoliciesByPolicySet: end`);
|
|
212
|
+
return errors.length === 0;
|
|
221
213
|
}
|
|
222
214
|
|
|
223
215
|
/**
|
|
@@ -233,7 +225,6 @@ export async function exportPolicyToFile(policyId, file, includeMeta = true, opt
|
|
|
233
225
|
prereqs: false,
|
|
234
226
|
useStringArrays: true
|
|
235
227
|
}) {
|
|
236
|
-
let outcome = false;
|
|
237
228
|
debugMessage(`cli.PolicyOps.exportPolicyToFile: begin`);
|
|
238
229
|
showSpinner(`Exporting ${policyId}...`);
|
|
239
230
|
try {
|
|
@@ -245,12 +236,13 @@ export async function exportPolicyToFile(policyId, file, includeMeta = true, opt
|
|
|
245
236
|
const exportData = await exportPolicy(policyId, options);
|
|
246
237
|
saveJsonToFile(exportData, filePath, includeMeta);
|
|
247
238
|
succeedSpinner(`Exported ${policyId} to ${filePath}.`);
|
|
248
|
-
|
|
239
|
+
debugMessage(`cli.PolicyOps.exportPolicyToFile: end`);
|
|
240
|
+
return true;
|
|
249
241
|
} catch (error) {
|
|
250
|
-
failSpinner(`Error exporting ${policyId}
|
|
242
|
+
failSpinner(`Error exporting ${policyId}`);
|
|
243
|
+
printError(error);
|
|
251
244
|
}
|
|
252
|
-
|
|
253
|
-
return outcome;
|
|
245
|
+
return false;
|
|
254
246
|
}
|
|
255
247
|
|
|
256
248
|
/**
|
|
@@ -265,9 +257,8 @@ export async function exportPoliciesToFile(file, includeMeta = true, options = {
|
|
|
265
257
|
prereqs: false,
|
|
266
258
|
useStringArrays: true
|
|
267
259
|
}) {
|
|
268
|
-
let outcome = false;
|
|
269
260
|
debugMessage(`cli.PolicyOps.exportPoliciesToFile: begin`);
|
|
270
|
-
showSpinner(`Exporting all
|
|
261
|
+
showSpinner(`Exporting all policies...`);
|
|
271
262
|
try {
|
|
272
263
|
let fileName = getTypedFilename(`all${titleCase(getRealmName(state.getRealm()))}Policies`, 'policy.authz');
|
|
273
264
|
if (file) {
|
|
@@ -276,13 +267,14 @@ export async function exportPoliciesToFile(file, includeMeta = true, options = {
|
|
|
276
267
|
const filePath = getFilePath(fileName, true);
|
|
277
268
|
const exportData = await exportPolicies(options);
|
|
278
269
|
saveJsonToFile(exportData, filePath, includeMeta);
|
|
279
|
-
succeedSpinner(`Exported all
|
|
280
|
-
|
|
270
|
+
succeedSpinner(`Exported all policies to ${filePath}.`);
|
|
271
|
+
debugMessage(`cli.PolicyOps.exportPoliciesToFile: end`);
|
|
272
|
+
return true;
|
|
281
273
|
} catch (error) {
|
|
282
|
-
failSpinner(`Error exporting
|
|
274
|
+
failSpinner(`Error exporting policies`);
|
|
275
|
+
printError(error);
|
|
283
276
|
}
|
|
284
|
-
|
|
285
|
-
return outcome;
|
|
277
|
+
return false;
|
|
286
278
|
}
|
|
287
279
|
|
|
288
280
|
/**
|
|
@@ -298,9 +290,8 @@ export async function exportPoliciesByPolicySetToFile(policySetId, file, include
|
|
|
298
290
|
prereqs: false,
|
|
299
291
|
useStringArrays: true
|
|
300
292
|
}) {
|
|
301
|
-
let outcome = false;
|
|
302
293
|
debugMessage(`cli.PolicyOps.exportPoliciesToFile: begin`);
|
|
303
|
-
showSpinner(`Exporting all
|
|
294
|
+
showSpinner(`Exporting all policies...`);
|
|
304
295
|
try {
|
|
305
296
|
let fileName = getTypedFilename(`all${titleCase(getRealmName(state.getRealm())) + titleCase(policySetId)}Policies`, 'policy.authz');
|
|
306
297
|
if (file) {
|
|
@@ -309,13 +300,14 @@ export async function exportPoliciesByPolicySetToFile(policySetId, file, include
|
|
|
309
300
|
const filePath = getFilePath(fileName, true);
|
|
310
301
|
const exportData = await exportPoliciesByPolicySet(policySetId, options);
|
|
311
302
|
saveJsonToFile(exportData, filePath, includeMeta);
|
|
312
|
-
succeedSpinner(`Exported all
|
|
313
|
-
|
|
303
|
+
succeedSpinner(`Exported all policies to ${filePath}.`);
|
|
304
|
+
debugMessage(`cli.PolicyOps.exportPoliciesToFile: end`);
|
|
305
|
+
return true;
|
|
314
306
|
} catch (error) {
|
|
315
|
-
failSpinner(`Error exporting
|
|
307
|
+
failSpinner(`Error exporting policies`);
|
|
308
|
+
printError(error);
|
|
316
309
|
}
|
|
317
|
-
|
|
318
|
-
return outcome;
|
|
310
|
+
return false;
|
|
319
311
|
}
|
|
320
312
|
|
|
321
313
|
/**
|
|
@@ -334,7 +326,7 @@ export async function exportPoliciesToFiles(includeMeta = true, options = {
|
|
|
334
326
|
let indicatorId;
|
|
335
327
|
try {
|
|
336
328
|
const policies = await readPolicies();
|
|
337
|
-
indicatorId = createProgressIndicator('determinate', policies.length, 'Exporting
|
|
329
|
+
indicatorId = createProgressIndicator('determinate', policies.length, 'Exporting policies...');
|
|
338
330
|
for (const policy of policies) {
|
|
339
331
|
const file = getTypedFilename(policy._id, 'policy.authz');
|
|
340
332
|
try {
|
|
@@ -343,16 +335,19 @@ export async function exportPoliciesToFiles(includeMeta = true, options = {
|
|
|
343
335
|
updateProgressIndicator(indicatorId, `Exported ${policy._id}.`);
|
|
344
336
|
} catch (error) {
|
|
345
337
|
errors.push(error);
|
|
346
|
-
updateProgressIndicator(indicatorId, `Error exporting ${policy._id}.`);
|
|
347
338
|
}
|
|
348
339
|
}
|
|
340
|
+
if (errors.length > 0) {
|
|
341
|
+
throw new FrodoError(`Error exporting policies`, errors);
|
|
342
|
+
}
|
|
349
343
|
stopProgressIndicator(indicatorId, `Export complete.`);
|
|
344
|
+
debugMessage(`cli.PolicyOps.exportPoliciesToFiles: end`);
|
|
345
|
+
return true;
|
|
350
346
|
} catch (error) {
|
|
351
|
-
|
|
352
|
-
|
|
347
|
+
stopProgressIndicator(indicatorId, `Error exporting policies`, 'fail');
|
|
348
|
+
printError(error);
|
|
353
349
|
}
|
|
354
|
-
|
|
355
|
-
return 0 === errors.length;
|
|
350
|
+
return false;
|
|
356
351
|
}
|
|
357
352
|
|
|
358
353
|
/**
|
|
@@ -380,16 +375,19 @@ export async function exportPoliciesByPolicySetToFiles(policySetId, includeMeta
|
|
|
380
375
|
updateProgressIndicator(indicatorId, `Exported ${policy._id}.`);
|
|
381
376
|
} catch (error) {
|
|
382
377
|
errors.push(error);
|
|
383
|
-
updateProgressIndicator(indicatorId, `Error exporting ${policy._id}.`);
|
|
384
378
|
}
|
|
385
379
|
}
|
|
380
|
+
if (errors.length > 0) {
|
|
381
|
+
throw new FrodoError(`Error exporting policies`, errors);
|
|
382
|
+
}
|
|
386
383
|
stopProgressIndicator(indicatorId, `Export complete.`);
|
|
384
|
+
debugMessage(`cli.PolicyOps.exportPoliciesToFiles: end`);
|
|
385
|
+
return true;
|
|
387
386
|
} catch (error) {
|
|
388
|
-
|
|
389
|
-
|
|
387
|
+
stopProgressIndicator(indicatorId, `Error exporting policies`, 'fail');
|
|
388
|
+
printError(error);
|
|
390
389
|
}
|
|
391
|
-
|
|
392
|
-
return 0 === errors.length;
|
|
390
|
+
return false;
|
|
393
391
|
}
|
|
394
392
|
|
|
395
393
|
/**
|
|
@@ -403,21 +401,20 @@ export async function importPolicyFromFile(policyId, file, options = {
|
|
|
403
401
|
deps: true,
|
|
404
402
|
prereqs: false
|
|
405
403
|
}) {
|
|
406
|
-
let outcome = false;
|
|
407
404
|
debugMessage(`cli.PolicyOps.importPolicyFromFile: begin`);
|
|
408
405
|
showSpinner(`Importing ${policyId}...`);
|
|
409
406
|
try {
|
|
410
407
|
const data = fs.readFileSync(getFilePath(file), 'utf8');
|
|
411
408
|
const fileData = JSON.parse(data);
|
|
412
409
|
await importPolicy(policyId, fileData, options);
|
|
413
|
-
outcome = true;
|
|
414
410
|
succeedSpinner(`Imported ${policyId}.`);
|
|
411
|
+
debugMessage(`cli.PolicyOps.importPolicyFromFile: end`);
|
|
412
|
+
return true;
|
|
415
413
|
} catch (error) {
|
|
416
|
-
failSpinner(`Error importing ${policyId}
|
|
417
|
-
|
|
414
|
+
failSpinner(`Error importing ${policyId}`);
|
|
415
|
+
printError(error);
|
|
418
416
|
}
|
|
419
|
-
|
|
420
|
-
return outcome;
|
|
417
|
+
return false;
|
|
421
418
|
}
|
|
422
419
|
|
|
423
420
|
/**
|
|
@@ -430,7 +427,6 @@ export async function importFirstPolicyFromFile(file, options = {
|
|
|
430
427
|
deps: true,
|
|
431
428
|
prereqs: false
|
|
432
429
|
}) {
|
|
433
|
-
let outcome = false;
|
|
434
430
|
debugMessage(`cli.PolicySetOps.importFirstPolicyFromFile: begin`);
|
|
435
431
|
const filePath = getFilePath(file);
|
|
436
432
|
showSpinner(`Importing first policy from ${filePath}...`);
|
|
@@ -438,14 +434,14 @@ export async function importFirstPolicyFromFile(file, options = {
|
|
|
438
434
|
const data = fs.readFileSync(filePath, 'utf8');
|
|
439
435
|
const fileData = JSON.parse(data);
|
|
440
436
|
const policy = await importFirstPolicy(fileData, options);
|
|
441
|
-
outcome = true;
|
|
442
437
|
succeedSpinner(`Imported first policy with id '${policy._id}' from ${filePath}.`);
|
|
438
|
+
debugMessage(`cli.PolicySetOps.importFirstPolicyFromFile: end`);
|
|
439
|
+
return true;
|
|
443
440
|
} catch (error) {
|
|
444
|
-
failSpinner(`Error importing first policy
|
|
445
|
-
|
|
441
|
+
failSpinner(`Error importing first policy`);
|
|
442
|
+
printError(error);
|
|
446
443
|
}
|
|
447
|
-
|
|
448
|
-
return outcome;
|
|
444
|
+
return false;
|
|
449
445
|
}
|
|
450
446
|
|
|
451
447
|
/**
|
|
@@ -458,7 +454,6 @@ export async function importPoliciesFromFile(file, options = {
|
|
|
458
454
|
deps: true,
|
|
459
455
|
prereqs: false
|
|
460
456
|
}) {
|
|
461
|
-
let outcome = false;
|
|
462
457
|
debugMessage(`cli.PolicyOps.importPoliciesFromFile: begin`);
|
|
463
458
|
const filePath = getFilePath(file);
|
|
464
459
|
showSpinner(`Importing ${filePath}...`);
|
|
@@ -466,14 +461,14 @@ export async function importPoliciesFromFile(file, options = {
|
|
|
466
461
|
const data = fs.readFileSync(filePath, 'utf8');
|
|
467
462
|
const fileData = JSON.parse(data);
|
|
468
463
|
await importPolicies(fileData, options);
|
|
469
|
-
outcome = true;
|
|
470
464
|
succeedSpinner(`Imported ${filePath}${options.policySetName ? ' into policy set ' + options.policySetName : '.'}`);
|
|
465
|
+
debugMessage(`cli.PolicyOps.importPoliciesFromFile: end`);
|
|
466
|
+
return true;
|
|
471
467
|
} catch (error) {
|
|
472
468
|
failSpinner(`Error importing ${filePath}${options.policySetName ? ' into policy set ' + options.policySetName : '.'}`);
|
|
473
|
-
|
|
469
|
+
printError(error);
|
|
474
470
|
}
|
|
475
|
-
|
|
476
|
-
return outcome;
|
|
471
|
+
return false;
|
|
477
472
|
}
|
|
478
473
|
|
|
479
474
|
/**
|
|
@@ -503,17 +498,18 @@ export async function importPoliciesFromFiles(options = {
|
|
|
503
498
|
updateProgressIndicator(indicatorId, `Imported ${count} policies from ${file}`);
|
|
504
499
|
} catch (error) {
|
|
505
500
|
errors.push(error);
|
|
506
|
-
updateProgressIndicator(indicatorId, `Error importing policies from ${file}`);
|
|
507
|
-
printMessage(error, 'error');
|
|
508
501
|
}
|
|
509
502
|
}
|
|
503
|
+
if (errors.length > 0) {
|
|
504
|
+
throw new FrodoError(`Error importing policies`, errors);
|
|
505
|
+
}
|
|
510
506
|
stopProgressIndicator(indicatorId, `Finished importing ${total} policies from ${files.length} files.`);
|
|
507
|
+
debugMessage(`cli.PolicyOps.importPoliciesFromFiles: end`);
|
|
508
|
+
return true;
|
|
511
509
|
} catch (error) {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
printMessage(error, 'error');
|
|
510
|
+
stopProgressIndicator(indicatorId, `Error importing policies`);
|
|
511
|
+
printError(error);
|
|
515
512
|
}
|
|
516
|
-
|
|
517
|
-
return 0 === errors.length;
|
|
513
|
+
return false;
|
|
518
514
|
}
|
|
519
515
|
//# sourceMappingURL=PolicyOps.js.map
|
package/esm/ops/PolicyOps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolicyOps.js","names":["frodo","state","fs","createObjectTable","createProgressIndicator","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressIndicator","succeedSpinner","updateProgressIndicator","getRealmName","getTypedFilename","saveJsonToFile","titleCase","getFilePath","getWorkingDirectory","utils","readPolicies","readPoliciesByPolicySet","readPolicy","exportPolicy","exportPolicies","exportPoliciesByPolicySet","importPolicy","importFirstPolicy","importPolicies","deletePolicy","authz","policy","listPolicies","long","outcome","policies","sort","a","b","_id","localeCompare","table","push","description","active","toString","err","message","listPoliciesByPolicySet","policySetId","describePolicy","policyId","json","policySet","deletePolicyById","error","deletePolicies","errors","indicatorId","length","errorMessages","map","join","deletePoliciesByPolicySet","exportPolicyToFile","file","includeMeta","options","deps","prereqs","useStringArrays","fileName","filePath","exportData","exportPoliciesToFile","getRealm","exportPoliciesByPolicySetToFile","exportPoliciesToFiles","exportPoliciesByPolicySetToFiles","importPolicyFromFile","data","readFileSync","fileData","JSON","parse","importFirstPolicyFromFile","importPoliciesFromFile","policySetName","importPoliciesFromFiles","names","readdirSync","files","filter","name","toLowerCase","endsWith","total","count","Object","keys","policyset"],"sources":["../../src/ops/PolicyOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { type PolicySkeleton } from '@rockcarver/frodo-lib/types/api/PoliciesApi';\nimport type {\n PolicyExportInterface,\n PolicyExportOptions,\n PolicyImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/PolicyOps';\nimport fs from 'fs';\n\nimport {\n createObjectTable,\n createProgressIndicator,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressIndicator,\n succeedSpinner,\n updateProgressIndicator,\n} from '../utils/Console';\n\nconst {\n getRealmName,\n getTypedFilename,\n saveJsonToFile,\n titleCase,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst {\n readPolicies,\n readPoliciesByPolicySet,\n readPolicy,\n exportPolicy,\n exportPolicies,\n exportPoliciesByPolicySet,\n importPolicy,\n importFirstPolicy,\n importPolicies,\n deletePolicy,\n} = frodo.authz.policy;\n\n/**\n * List policies\n * @param {boolean} long list with details\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listPolicies(long = false): Promise<boolean> {\n let outcome = false;\n try {\n const policies = await readPolicies();\n policies.sort((a, b) => a._id.localeCompare(b._id));\n if (long) {\n const table = createTable(['Id', 'Description', 'Status']);\n for (const policy of policies) {\n table.push([\n `${policy._id}`,\n `${policy.description}`,\n policy.active ? 'active'['brightGreen'] : 'inactive'['brightRed'],\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n for (const policy of policies) {\n printMessage(`${policy._id}`, 'data');\n }\n }\n outcome = true;\n } catch (err) {\n printMessage(`listPolicies ERROR: ${err.message}`, 'error');\n printMessage(err, 'error');\n }\n return outcome;\n}\n\n/**\n * List policies by policy set\n * @param {string} policySetId policy set id/name\n * @param {boolean} long list with details\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listPoliciesByPolicySet(\n policySetId: string,\n long = false\n): Promise<boolean> {\n let outcome = false;\n try {\n const policies = await readPoliciesByPolicySet(policySetId);\n policies.sort((a, b) => a._id.localeCompare(b._id));\n if (long) {\n const table = createTable(['Id', 'Description', 'Status']);\n for (const policy of policies) {\n table.push([\n `${policy._id}`,\n `${policy.description}`,\n policy.active ? 'active'['brightGreen'] : 'inactive'['brightRed'],\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n for (const policy of policies) {\n printMessage(`${policy._id}`, 'data');\n }\n }\n outcome = true;\n } catch (err) {\n printMessage(`listPolicies ERROR: ${err.message}`, 'error');\n printMessage(err, 'error');\n }\n return outcome;\n}\n\n/**\n * Describe policy\n * @param {string} policyId policy id/name\n * @param {Object} json JSON output\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describePolicy(\n policyId: string,\n json = false\n): Promise<boolean> {\n let outcome = false;\n const policySet = await readPolicy(policyId);\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\n * @param {string} policyId policy id/name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deletePolicyById(policyId: string): Promise<boolean> {\n debugMessage(`cli.PolicyOps.deletePolicy: begin`);\n showSpinner(`Deleting ${policyId}...`);\n let outcome = false;\n try {\n debugMessage(`Deleting policy ${policyId}`);\n await deletePolicy(policyId);\n succeedSpinner(`Deleted ${policyId}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error deleting policy ${policyId}: ${error}`);\n }\n debugMessage(`cli.PolicyOps.deletePolicy: end [outcome=${outcome}]`);\n return outcome;\n}\n\n/**\n * Delete all policies\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deletePolicies(): Promise<boolean> {\n debugMessage(`cli.PolicyOps.deletePolicies: begin`);\n let outcome = false;\n const errors = [];\n let policies: PolicySkeleton[] = [];\n let indicatorId: string;\n try {\n showSpinner(`Retrieving all policies...`);\n try {\n policies = await readPolicies();\n succeedSpinner(`Found ${policies.length} policies.`);\n } catch (error) {\n error.message = `Error retrieving all policies: ${error.message}`;\n failSpinner(error.message);\n throw error;\n }\n if (policies.length)\n indicatorId = createProgressIndicator(\n 'determinate',\n policies.length,\n `Deleting ${policies.length} policies...`\n );\n for (const policy of policies) {\n const policyId = policy._id;\n try {\n debugMessage(`Deleting policy ${policyId}`);\n await deletePolicy(policyId);\n updateProgressIndicator(indicatorId, `Deleted ${policyId}`);\n } catch (error) {\n error.message = `Error deleting policy ${policyId}: ${error}`;\n updateProgressIndicator(indicatorId, error.message);\n errors.push(error);\n }\n }\n } catch (error) {\n error.message = `Error deleting policies: ${error}`;\n errors.push(error);\n } finally {\n if (errors.length) {\n const errorMessages = errors.map((error) => error.message).join('\\n');\n if (policies.length)\n stopProgressIndicator(\n indicatorId,\n `Error deleting all policies: ${errorMessages}`\n );\n } else {\n if (policies.length)\n stopProgressIndicator(\n indicatorId,\n `Deleted ${policies.length} policies.`\n );\n outcome = true;\n }\n }\n debugMessage(`cli.PolicyOps.deletePolicies: end [outcome=${outcome}]`);\n return outcome;\n}\n\n/**\n * Delete all policies in policy set\n * @param {string} policySetId policy set id/name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deletePoliciesByPolicySet(\n policySetId: string\n): Promise<boolean> {\n debugMessage(`cli.PolicyOps.deletePoliciesByPolicySet: begin`);\n let outcome = false;\n const errors = [];\n let policies: PolicySkeleton[] = [];\n let indicatorId: string;\n try {\n showSpinner(`Retrieving all policies from policy set ${policySetId}...`);\n try {\n policies = await readPoliciesByPolicySet(policySetId);\n succeedSpinner(\n `Found ${policies.length} policies in policy set ${policySetId}.`\n );\n } catch (error) {\n error.message = `Error retrieving all policies from policy set ${policySetId}: ${error.message}`;\n failSpinner(error.message);\n throw error;\n }\n if (policies.length)\n indicatorId = createProgressIndicator(\n 'determinate',\n policies.length,\n `Deleting ${policies.length} policies from policy set ${policySetId}...`\n );\n for (const policy of policies) {\n const policyId = policy._id;\n try {\n debugMessage(`Deleting policy ${policyId}`);\n await deletePolicy(policyId);\n updateProgressIndicator(indicatorId, `Deleted ${policyId}`);\n } catch (error) {\n error.message = `Error deleting policy ${policyId} from policy set ${policySetId}: ${error}`;\n updateProgressIndicator(indicatorId, error.message);\n errors.push(error);\n }\n }\n } catch (error) {\n error.message = `Error deleting policies from policy set ${policySetId}: ${error}`;\n errors.push(error);\n } finally {\n if (errors.length) {\n const errorMessages = errors.map((error) => error.message).join('\\n');\n if (policies.length)\n stopProgressIndicator(\n indicatorId,\n `Error deleting all policies from policy set ${policySetId}: ${errorMessages}`\n );\n } else {\n if (policies.length)\n stopProgressIndicator(\n indicatorId,\n `Deleted ${policies.length} policies.`\n );\n outcome = true;\n }\n }\n debugMessage(\n `cli.PolicyOps.deletePoliciesByPolicySet: end [outcome=${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Export policy to file\n * @param {string} policyId policy id/name\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportPolicyToFile(\n policyId: string,\n file: string,\n includeMeta = true,\n options: PolicyExportOptions = {\n deps: true,\n prereqs: false,\n useStringArrays: true,\n }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.PolicyOps.exportPolicyToFile: begin`);\n showSpinner(`Exporting ${policyId}...`);\n try {\n let fileName = getTypedFilename(policyId, 'policy.authz');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await exportPolicy(policyId, options);\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported ${policyId} to ${filePath}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${policyId}: ${error.message}`);\n }\n debugMessage(`cli.PolicyOps.exportPolicyToFile: end`);\n return outcome;\n}\n\n/**\n * Export policies to file\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {PolicyExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportPoliciesToFile(\n file: string,\n includeMeta = true,\n options: PolicyExportOptions = {\n deps: true,\n prereqs: false,\n useStringArrays: true,\n }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.PolicyOps.exportPoliciesToFile: begin`);\n showSpinner(`Exporting all policy sets...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}Policies`,\n 'policy.authz'\n );\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await exportPolicies(options);\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported all policy sets to ${filePath}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting policy sets: ${error.message}`);\n }\n debugMessage(`cli.PolicyOps.exportPoliciesToFile: end`);\n return outcome;\n}\n\n/**\n * Export policies to file\n * @param {string} policySetId policy set id/name\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {PolicyExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportPoliciesByPolicySetToFile(\n policySetId: string,\n file: string,\n includeMeta = true,\n options: PolicyExportOptions = {\n deps: true,\n prereqs: false,\n useStringArrays: true,\n }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.PolicyOps.exportPoliciesToFile: begin`);\n showSpinner(`Exporting all policy sets...`);\n try {\n let fileName = getTypedFilename(\n `all${\n titleCase(getRealmName(state.getRealm())) + titleCase(policySetId)\n }Policies`,\n 'policy.authz'\n );\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await exportPoliciesByPolicySet(policySetId, options);\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported all policy sets to ${filePath}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting policy sets: ${error.message}`);\n }\n debugMessage(`cli.PolicyOps.exportPoliciesToFile: end`);\n return outcome;\n}\n\n/**\n * Export all policies to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {PolicyExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportPoliciesToFiles(\n includeMeta = true,\n options: PolicyExportOptions = {\n deps: true,\n prereqs: false,\n useStringArrays: true,\n }\n): Promise<boolean> {\n debugMessage(`cli.PolicyOps.exportPoliciesToFiles: begin`);\n const errors = [];\n let indicatorId: string;\n try {\n const policies: PolicySkeleton[] = await readPolicies();\n indicatorId = createProgressIndicator(\n 'determinate',\n policies.length,\n 'Exporting policy sets...'\n );\n for (const policy of policies) {\n const file = getTypedFilename(policy._id, 'policy.authz');\n try {\n const exportData: PolicyExportInterface = await exportPolicy(\n policy._id,\n options\n );\n saveJsonToFile(exportData, getFilePath(file, true), includeMeta);\n updateProgressIndicator(indicatorId, `Exported ${policy._id}.`);\n } catch (error) {\n errors.push(error);\n updateProgressIndicator(indicatorId, `Error exporting ${policy._id}.`);\n }\n }\n stopProgressIndicator(indicatorId, `Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressIndicator(indicatorId, `Error exporting policy sets to files`);\n }\n debugMessage(`cli.PolicyOps.exportPoliciesToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Export all policies to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {PolicyExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportPoliciesByPolicySetToFiles(\n policySetId: string,\n includeMeta = true,\n options: PolicyExportOptions = {\n deps: true,\n prereqs: false,\n useStringArrays: true,\n }\n): Promise<boolean> {\n debugMessage(`cli.PolicyOps.exportPoliciesToFiles: begin`);\n const errors = [];\n let indicatorId: string;\n try {\n const policies: PolicySkeleton[] =\n await readPoliciesByPolicySet(policySetId);\n indicatorId = createProgressIndicator(\n 'determinate',\n policies.length,\n `Exporting policies in policy set ${policySetId}...`\n );\n for (const policy of policies) {\n const file = getTypedFilename(policy._id, 'policy.authz');\n try {\n const exportData: PolicyExportInterface = await exportPolicy(\n policy._id,\n options\n );\n saveJsonToFile(exportData, getFilePath(file, true), includeMeta);\n updateProgressIndicator(indicatorId, `Exported ${policy._id}.`);\n } catch (error) {\n errors.push(error);\n updateProgressIndicator(indicatorId, `Error exporting ${policy._id}.`);\n }\n }\n stopProgressIndicator(indicatorId, `Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressIndicator(indicatorId, `Error exporting policy sets to files`);\n }\n debugMessage(`cli.PolicyOps.exportPoliciesToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import policy from file\n * @param {string} policyId policy id/name\n * @param {string} file file name\n * @param {PolicyImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importPolicyFromFile(\n policyId: string,\n file: string,\n options: PolicyImportOptions = { deps: true, prereqs: false }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.PolicyOps.importPolicyFromFile: begin`);\n showSpinner(`Importing ${policyId}...`);\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n await importPolicy(policyId, fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${policyId}.`);\n } catch (error) {\n failSpinner(`Error importing ${policyId}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.PolicyOps.importPolicyFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first policy from file\n * @param {string} file file name\n * @param {PolicyImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstPolicyFromFile(\n file: string,\n options: PolicyImportOptions = { deps: true, prereqs: false }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.PolicySetOps.importFirstPolicyFromFile: begin`);\n const filePath = getFilePath(file);\n showSpinner(`Importing first policy from ${filePath}...`);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const fileData = JSON.parse(data);\n const policy = await importFirstPolicy(fileData, options);\n outcome = true;\n succeedSpinner(\n `Imported first policy with id '${policy._id}' from ${filePath}.`\n );\n } catch (error) {\n failSpinner(`Error importing first policy from ${filePath}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.PolicySetOps.importFirstPolicyFromFile: end`);\n return outcome;\n}\n\n/**\n * Import policies from file\n * @param {string} file file name\n * @param {PolicyImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importPoliciesFromFile(\n file: string,\n options: PolicyImportOptions = { deps: true, prereqs: false }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.PolicyOps.importPoliciesFromFile: begin`);\n const filePath = getFilePath(file);\n showSpinner(`Importing ${filePath}...`);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const fileData = JSON.parse(data);\n await importPolicies(fileData, options);\n outcome = true;\n succeedSpinner(\n `Imported ${filePath}${\n options.policySetName\n ? ' into policy set ' + options.policySetName\n : '.'\n }`\n );\n } catch (error) {\n failSpinner(\n `Error importing ${filePath}${\n options.policySetName\n ? ' into policy set ' + options.policySetName\n : '.'\n }`\n );\n printMessage(error, 'error');\n }\n debugMessage(`cli.PolicyOps.importPoliciesFromFile: end`);\n return outcome;\n}\n\n/**\n * Import policies from files\n * @param {PolicyImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importPoliciesFromFiles(\n options: PolicyImportOptions = { deps: true, prereqs: false }\n): Promise<boolean> {\n const errors = [];\n let indicatorId: string;\n try {\n debugMessage(`cli.PolicyOps.importPoliciesFromFiles: begin`);\n const names = fs.readdirSync(getWorkingDirectory());\n const files = names\n .filter((name) => name.toLowerCase().endsWith('.policy.authz.json'))\n .map((name) => getFilePath(name));\n indicatorId = createProgressIndicator(\n 'determinate',\n files.length,\n 'Importing policies...'\n );\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: PolicyExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.policyset).length;\n total += count;\n await importPolicies(fileData, options);\n updateProgressIndicator(\n indicatorId,\n `Imported ${count} policies from ${file}`\n );\n } catch (error) {\n errors.push(error);\n updateProgressIndicator(\n indicatorId,\n `Error importing policies from ${file}`\n );\n printMessage(error, 'error');\n }\n }\n stopProgressIndicator(\n indicatorId,\n `Finished importing ${total} policies from ${files.length} files.`\n );\n } catch (error) {\n errors.push(error);\n stopProgressIndicator(indicatorId, `Error importing policies from files.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.PolicyOps.importPoliciesFromFiles: end`);\n return 0 === errors.length;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAOpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,iBAAiB,EACjB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AY,CAAE,4CAA2C,CAAC;EAC1D,OAAO,CAAC,KAAKmD,MAAM,CAACE,MAAM;AAC5B"}
|
|
1
|
+
{"version":3,"file":"PolicyOps.js","names":["frodo","FrodoError","state","fs","createObjectTable","createProgressIndicator","createTable","debugMessage","failSpinner","printError","printMessage","showSpinner","stopProgressIndicator","succeedSpinner","updateProgressIndicator","getRealmName","getTypedFilename","saveJsonToFile","titleCase","getFilePath","getWorkingDirectory","utils","readPolicies","readPoliciesByPolicySet","readPolicy","exportPolicy","exportPolicies","exportPoliciesByPolicySet","importPolicy","importFirstPolicy","importPolicies","deletePolicy","authz","policy","listPolicies","long","policies","sort","a","b","_id","localeCompare","table","push","description","active","toString","error","listPoliciesByPolicySet","policySetId","outcome","describePolicy","policyId","json","policySet","deletePolicyById","deletePolicies","errors","indicatorId","length","deletePoliciesByPolicySet","exportPolicyToFile","file","includeMeta","options","deps","prereqs","useStringArrays","fileName","filePath","exportData","exportPoliciesToFile","getRealm","exportPoliciesByPolicySetToFile","exportPoliciesToFiles","exportPoliciesByPolicySetToFiles","importPolicyFromFile","data","readFileSync","fileData","JSON","parse","importFirstPolicyFromFile","importPoliciesFromFile","policySetName","importPoliciesFromFiles","names","readdirSync","files","filter","name","toLowerCase","endsWith","map","total","count","Object","keys","policyset"],"sources":["../../src/ops/PolicyOps.ts"],"sourcesContent":["import { frodo, FrodoError, state } from '@rockcarver/frodo-lib';\nimport { type PolicySkeleton } from '@rockcarver/frodo-lib/types/api/PoliciesApi';\nimport type {\n PolicyExportInterface,\n PolicyExportOptions,\n PolicyImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/PolicyOps';\nimport fs from 'fs';\n\nimport {\n createObjectTable,\n createProgressIndicator,\n createTable,\n debugMessage,\n failSpinner,\n printError,\n printMessage,\n showSpinner,\n stopProgressIndicator,\n succeedSpinner,\n updateProgressIndicator,\n} from '../utils/Console';\n\nconst {\n getRealmName,\n getTypedFilename,\n saveJsonToFile,\n titleCase,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst {\n readPolicies,\n readPoliciesByPolicySet,\n readPolicy,\n exportPolicy,\n exportPolicies,\n exportPoliciesByPolicySet,\n importPolicy,\n importFirstPolicy,\n importPolicies,\n deletePolicy,\n} = frodo.authz.policy;\n\n/**\n * List policies\n * @param {boolean} long list with details\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listPolicies(long: boolean = false): Promise<boolean> {\n try {\n const policies = await readPolicies();\n policies.sort((a, b) => a._id.localeCompare(b._id));\n if (long) {\n const table = createTable(['Id', 'Description', 'Status']);\n for (const policy of policies) {\n table.push([\n `${policy._id}`,\n `${policy.description}`,\n policy.active ? 'active'['brightGreen'] : 'inactive'['brightRed'],\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n for (const policy of policies) {\n printMessage(`${policy._id}`, 'data');\n }\n }\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * List policies by policy set\n * @param {string} policySetId policy set id/name\n * @param {boolean} long list with details\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listPoliciesByPolicySet(\n policySetId: string,\n long: boolean = false\n): Promise<boolean> {\n let outcome = false;\n try {\n const policies = await readPoliciesByPolicySet(policySetId);\n policies.sort((a, b) => a._id.localeCompare(b._id));\n if (long) {\n const table = createTable(['Id', 'Description', 'Status']);\n for (const policy of policies) {\n table.push([\n `${policy._id}`,\n `${policy.description}`,\n policy.active ? 'active'['brightGreen'] : 'inactive'['brightRed'],\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n for (const policy of policies) {\n printMessage(`${policy._id}`, 'data');\n }\n }\n outcome = true;\n } catch (error) {\n printError(error);\n }\n return outcome;\n}\n\n/**\n * Describe policy\n * @param {string} policyId policy id/name\n * @param {Object} json JSON output\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describePolicy(\n policyId: string,\n json: boolean = false\n): Promise<boolean> {\n try {\n const policySet = await readPolicy(policyId);\n if (json) {\n printMessage(policySet, 'data');\n } else {\n const table = createObjectTable(policySet);\n printMessage(table.toString(), 'data');\n }\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Delete policy\n * @param {string} policyId policy id/name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deletePolicyById(policyId: string): Promise<boolean> {\n debugMessage(`cli.PolicyOps.deletePolicy: begin`);\n showSpinner(`Deleting ${policyId}...`);\n try {\n debugMessage(`Deleting policy ${policyId}`);\n await deletePolicy(policyId);\n succeedSpinner(`Deleted ${policyId}.`);\n debugMessage(`cli.PolicyOps.deletePolicy: end]`);\n return true;\n } catch (error) {\n failSpinner(`Error deleting policy ${policyId}`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Delete all policies\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deletePolicies(): Promise<boolean> {\n debugMessage(`cli.PolicyOps.deletePolicies: begin`);\n const errors = [];\n let policies: PolicySkeleton[] = [];\n let indicatorId: string;\n try {\n showSpinner(`Retrieving all policies...`);\n try {\n policies = await readPolicies();\n succeedSpinner(`Found ${policies.length} policies.`);\n } catch (error) {\n failSpinner(`Error retrieving all policies`);\n throw new FrodoError(`Error retrieving all policies`, error);\n }\n if (policies.length)\n indicatorId = createProgressIndicator(\n 'determinate',\n policies.length,\n `Deleting ${policies.length} policies...`\n );\n for (const policy of policies) {\n const policyId = policy._id;\n try {\n debugMessage(`Deleting policy ${policyId}`);\n await deletePolicy(policyId);\n updateProgressIndicator(indicatorId, `Deleted ${policyId}`);\n } catch (error) {\n errors.push(new FrodoError(`Error deleting policy ${policyId}`, error));\n }\n }\n } catch (error) {\n errors.push(new FrodoError(`Error deleting policies`, error));\n } finally {\n if (errors.length > 0) {\n if (policies.length)\n stopProgressIndicator(\n indicatorId,\n `Error deleting all policies`,\n 'fail'\n );\n for (const error of errors) {\n printError(error);\n }\n } else {\n if (policies.length)\n stopProgressIndicator(\n indicatorId,\n `Deleted ${policies.length} policies.`\n );\n }\n }\n debugMessage(`cli.PolicyOps.deletePolicies: end`);\n return errors.length === 0;\n}\n\n/**\n * Delete all policies in policy set\n * @param {string} policySetId policy set id/name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deletePoliciesByPolicySet(\n policySetId: string\n): Promise<boolean> {\n debugMessage(`cli.PolicyOps.deletePoliciesByPolicySet: begin`);\n const errors = [];\n let policies: PolicySkeleton[] = [];\n let indicatorId: string;\n try {\n showSpinner(`Retrieving all policies from policy set ${policySetId}...`);\n try {\n policies = await readPoliciesByPolicySet(policySetId);\n succeedSpinner(\n `Found ${policies.length} policies in policy set ${policySetId}.`\n );\n } catch (error) {\n failSpinner(\n `Error retrieving all policies from policy set ${policySetId}`\n );\n throw new FrodoError(\n `Error retrieving all policies from policy set ${policySetId}`,\n error\n );\n }\n if (policies.length)\n indicatorId = createProgressIndicator(\n 'determinate',\n policies.length,\n `Deleting ${policies.length} policies from policy set ${policySetId}...`\n );\n for (const policy of policies) {\n const policyId = policy._id;\n try {\n debugMessage(`Deleting policy ${policyId}`);\n await deletePolicy(policyId);\n updateProgressIndicator(indicatorId, `Deleted ${policyId}`);\n } catch (error) {\n errors.push(\n new FrodoError(\n `Error deleting policy ${policyId} from policy set ${policySetId}`,\n error\n )\n );\n }\n }\n } catch (error) {\n errors.push(\n new FrodoError(\n `Error deleting policies from policy set ${policySetId}`,\n error\n )\n );\n } finally {\n if (errors.length) {\n if (policies.length)\n stopProgressIndicator(\n indicatorId,\n `Error deleting all policies from policy set ${policySetId}`,\n 'fail'\n );\n for (const error of errors) {\n printError(error);\n }\n } else {\n if (policies.length)\n stopProgressIndicator(\n indicatorId,\n `Deleted ${policies.length} policies.`\n );\n }\n }\n debugMessage(`cli.PolicyOps.deletePoliciesByPolicySet: end`);\n return errors.length === 0;\n}\n\n/**\n * Export policy to file\n * @param {string} policyId policy id/name\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportPolicyToFile(\n policyId: string,\n file: string,\n includeMeta: boolean = true,\n options: PolicyExportOptions = {\n deps: true,\n prereqs: false,\n useStringArrays: true,\n }\n): Promise<boolean> {\n debugMessage(`cli.PolicyOps.exportPolicyToFile: begin`);\n showSpinner(`Exporting ${policyId}...`);\n try {\n let fileName = getTypedFilename(policyId, 'policy.authz');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await exportPolicy(policyId, options);\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported ${policyId} to ${filePath}.`);\n debugMessage(`cli.PolicyOps.exportPolicyToFile: end`);\n return true;\n } catch (error) {\n failSpinner(`Error exporting ${policyId}`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Export policies to file\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {PolicyExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportPoliciesToFile(\n file: string,\n includeMeta: boolean = true,\n options: PolicyExportOptions = {\n deps: true,\n prereqs: false,\n useStringArrays: true,\n }\n): Promise<boolean> {\n debugMessage(`cli.PolicyOps.exportPoliciesToFile: begin`);\n showSpinner(`Exporting all policies...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}Policies`,\n 'policy.authz'\n );\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await exportPolicies(options);\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported all policies to ${filePath}.`);\n debugMessage(`cli.PolicyOps.exportPoliciesToFile: end`);\n return true;\n } catch (error) {\n failSpinner(`Error exporting policies`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Export policies to file\n * @param {string} policySetId policy set id/name\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {PolicyExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportPoliciesByPolicySetToFile(\n policySetId: string,\n file: string,\n includeMeta: boolean = true,\n options: PolicyExportOptions = {\n deps: true,\n prereqs: false,\n useStringArrays: true,\n }\n): Promise<boolean> {\n debugMessage(`cli.PolicyOps.exportPoliciesToFile: begin`);\n showSpinner(`Exporting all policies...`);\n try {\n let fileName = getTypedFilename(\n `all${\n titleCase(getRealmName(state.getRealm())) + titleCase(policySetId)\n }Policies`,\n 'policy.authz'\n );\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await exportPoliciesByPolicySet(policySetId, options);\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported all policies to ${filePath}.`);\n debugMessage(`cli.PolicyOps.exportPoliciesToFile: end`);\n return true;\n } catch (error) {\n failSpinner(`Error exporting policies`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Export all policies to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {PolicyExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportPoliciesToFiles(\n includeMeta: boolean = true,\n options: PolicyExportOptions = {\n deps: true,\n prereqs: false,\n useStringArrays: true,\n }\n): Promise<boolean> {\n debugMessage(`cli.PolicyOps.exportPoliciesToFiles: begin`);\n const errors = [];\n let indicatorId: string;\n try {\n const policies: PolicySkeleton[] = await readPolicies();\n indicatorId = createProgressIndicator(\n 'determinate',\n policies.length,\n 'Exporting policies...'\n );\n for (const policy of policies) {\n const file = getTypedFilename(policy._id, 'policy.authz');\n try {\n const exportData: PolicyExportInterface = await exportPolicy(\n policy._id,\n options\n );\n saveJsonToFile(exportData, getFilePath(file, true), includeMeta);\n updateProgressIndicator(indicatorId, `Exported ${policy._id}.`);\n } catch (error) {\n errors.push(error);\n }\n }\n if (errors.length > 0) {\n throw new FrodoError(`Error exporting policies`, errors);\n }\n stopProgressIndicator(indicatorId, `Export complete.`);\n debugMessage(`cli.PolicyOps.exportPoliciesToFiles: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error exporting policies`, 'fail');\n printError(error);\n }\n return false;\n}\n\n/**\n * Export all policies to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {PolicyExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportPoliciesByPolicySetToFiles(\n policySetId: string,\n includeMeta: boolean = true,\n options: PolicyExportOptions = {\n deps: true,\n prereqs: false,\n useStringArrays: true,\n }\n): Promise<boolean> {\n debugMessage(`cli.PolicyOps.exportPoliciesToFiles: begin`);\n const errors = [];\n let indicatorId: string;\n try {\n const policies: PolicySkeleton[] =\n await readPoliciesByPolicySet(policySetId);\n indicatorId = createProgressIndicator(\n 'determinate',\n policies.length,\n `Exporting policies in policy set ${policySetId}...`\n );\n for (const policy of policies) {\n const file = getTypedFilename(policy._id, 'policy.authz');\n try {\n const exportData: PolicyExportInterface = await exportPolicy(\n policy._id,\n options\n );\n saveJsonToFile(exportData, getFilePath(file, true), includeMeta);\n updateProgressIndicator(indicatorId, `Exported ${policy._id}.`);\n } catch (error) {\n errors.push(error);\n }\n }\n if (errors.length > 0) {\n throw new FrodoError(`Error exporting policies`, errors);\n }\n stopProgressIndicator(indicatorId, `Export complete.`);\n debugMessage(`cli.PolicyOps.exportPoliciesToFiles: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error exporting policies`, 'fail');\n printError(error);\n }\n return false;\n}\n\n/**\n * Import policy from file\n * @param {string} policyId policy id/name\n * @param {string} file file name\n * @param {PolicyImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importPolicyFromFile(\n policyId: string,\n file: string,\n options: PolicyImportOptions = { deps: true, prereqs: false }\n): Promise<boolean> {\n debugMessage(`cli.PolicyOps.importPolicyFromFile: begin`);\n showSpinner(`Importing ${policyId}...`);\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n await importPolicy(policyId, fileData, options);\n succeedSpinner(`Imported ${policyId}.`);\n debugMessage(`cli.PolicyOps.importPolicyFromFile: end`);\n return true;\n } catch (error) {\n failSpinner(`Error importing ${policyId}`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Import first policy from file\n * @param {string} file file name\n * @param {PolicyImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstPolicyFromFile(\n file: string,\n options: PolicyImportOptions = { deps: true, prereqs: false }\n): Promise<boolean> {\n debugMessage(`cli.PolicySetOps.importFirstPolicyFromFile: begin`);\n const filePath = getFilePath(file);\n showSpinner(`Importing first policy from ${filePath}...`);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const fileData = JSON.parse(data);\n const policy = await importFirstPolicy(fileData, options);\n succeedSpinner(\n `Imported first policy with id '${policy._id}' from ${filePath}.`\n );\n debugMessage(`cli.PolicySetOps.importFirstPolicyFromFile: end`);\n return true;\n } catch (error) {\n failSpinner(`Error importing first policy`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Import policies from file\n * @param {string} file file name\n * @param {PolicyImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importPoliciesFromFile(\n file: string,\n options: PolicyImportOptions = { deps: true, prereqs: false }\n): Promise<boolean> {\n debugMessage(`cli.PolicyOps.importPoliciesFromFile: begin`);\n const filePath = getFilePath(file);\n showSpinner(`Importing ${filePath}...`);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const fileData = JSON.parse(data);\n await importPolicies(fileData, options);\n succeedSpinner(\n `Imported ${filePath}${\n options.policySetName\n ? ' into policy set ' + options.policySetName\n : '.'\n }`\n );\n debugMessage(`cli.PolicyOps.importPoliciesFromFile: end`);\n return true;\n } catch (error) {\n failSpinner(\n `Error importing ${filePath}${\n options.policySetName\n ? ' into policy set ' + options.policySetName\n : '.'\n }`\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Import policies from files\n * @param {PolicyImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importPoliciesFromFiles(\n options: PolicyImportOptions = { deps: true, prereqs: false }\n): Promise<boolean> {\n const errors = [];\n let indicatorId: string;\n try {\n debugMessage(`cli.PolicyOps.importPoliciesFromFiles: begin`);\n const names = fs.readdirSync(getWorkingDirectory());\n const files = names\n .filter((name) => name.toLowerCase().endsWith('.policy.authz.json'))\n .map((name) => getFilePath(name));\n indicatorId = createProgressIndicator(\n 'determinate',\n files.length,\n 'Importing policies...'\n );\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: PolicyExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.policyset).length;\n total += count;\n await importPolicies(fileData, options);\n updateProgressIndicator(\n indicatorId,\n `Imported ${count} policies from ${file}`\n );\n } catch (error) {\n errors.push(error);\n }\n }\n if (errors.length > 0) {\n throw new FrodoError(`Error importing policies`, errors);\n }\n stopProgressIndicator(\n indicatorId,\n `Finished importing ${total} policies from ${files.length} files.`\n );\n debugMessage(`cli.PolicyOps.importPoliciesFromFiles: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error importing policies`);\n printError(error);\n }\n return false;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,UAAU,EAAEC,KAAK,QAAQ,uBAAuB;AAOhE,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,iBAAiB,EACjBC,uBAAuB,EACvBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,UAAU,EACVC,YAAY,EACZC,WAAW,EACXC,qBAAqB,EACrBC,cAAc,EACdC,uBAAuB,QAClB,kBAAkB;AAEzB,MAAM;EACJC,YAAY;EACZC,gBAAgB;EAChBC,cAAc;EACdC,SAAS;EACTC,WAAW;EACXC;AACF,CAAC,GAAGpB,KAAK,CAACqB,KAAK;AACf,MAAM;EACJC,YAAY;EACZC,uBAAuB;EACvBC,UAAU;EACVC,YAAY;EACZC,cAAc;EACdC,yBAAyB;EACz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