@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
|
@@ -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,
|
|
@@ -30,7 +30,6 @@ const {
|
|
|
30
30
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
31
31
|
*/
|
|
32
32
|
export async function listResourceTypes(long = false) {
|
|
33
|
-
let outcome = false;
|
|
34
33
|
try {
|
|
35
34
|
const resourceTypes = await readResourceTypes();
|
|
36
35
|
resourceTypes.sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -45,12 +44,11 @@ export async function listResourceTypes(long = false) {
|
|
|
45
44
|
printMessage(`${resourceType.name}`, 'data');
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
|
-
|
|
49
|
-
} catch (
|
|
50
|
-
|
|
51
|
-
printMessage(err, 'error');
|
|
47
|
+
return true;
|
|
48
|
+
} catch (error) {
|
|
49
|
+
printError(error);
|
|
52
50
|
}
|
|
53
|
-
return
|
|
51
|
+
return false;
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
/**
|
|
@@ -60,7 +58,6 @@ export async function listResourceTypes(long = false) {
|
|
|
60
58
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
61
59
|
*/
|
|
62
60
|
export async function describeResourceType(resourceTypeUuid, json = false) {
|
|
63
|
-
let outcome = false;
|
|
64
61
|
try {
|
|
65
62
|
const resourceType = await readResourceType(resourceTypeUuid);
|
|
66
63
|
if (json) {
|
|
@@ -69,17 +66,15 @@ export async function describeResourceType(resourceTypeUuid, json = false) {
|
|
|
69
66
|
const table = createObjectTable(resourceType);
|
|
70
67
|
printMessage(table.toString(), 'data');
|
|
71
68
|
}
|
|
72
|
-
|
|
69
|
+
return true;
|
|
73
70
|
} catch (error) {
|
|
74
|
-
|
|
75
|
-
if (((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 404) {
|
|
71
|
+
if (error.httpStatus === 404) {
|
|
76
72
|
printMessage(`Resource Type with uuid ${resourceTypeUuid} does not exist in realm ${state.getRealm()}`, 'error');
|
|
77
73
|
} else {
|
|
78
|
-
|
|
79
|
-
printMessage(((_error$response2 = error.response) === null || _error$response2 === void 0 || (_error$response2 = _error$response2.data) === null || _error$response2 === void 0 ? void 0 : _error$response2.message) || error.message, 'error');
|
|
74
|
+
printError(error);
|
|
80
75
|
}
|
|
81
76
|
}
|
|
82
|
-
return
|
|
77
|
+
return false;
|
|
83
78
|
}
|
|
84
79
|
|
|
85
80
|
/**
|
|
@@ -89,7 +84,6 @@ export async function describeResourceType(resourceTypeUuid, json = false) {
|
|
|
89
84
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
90
85
|
*/
|
|
91
86
|
export async function describeResourceTypeByName(resourceTypeName, json = false) {
|
|
92
|
-
let outcome = false;
|
|
93
87
|
try {
|
|
94
88
|
const resourceType = await readResourceTypeByName(resourceTypeName);
|
|
95
89
|
if (json) {
|
|
@@ -98,17 +92,15 @@ export async function describeResourceTypeByName(resourceTypeName, json = false)
|
|
|
98
92
|
const table = createObjectTable(resourceType);
|
|
99
93
|
printMessage(table.toString(), 'data');
|
|
100
94
|
}
|
|
101
|
-
|
|
95
|
+
return true;
|
|
102
96
|
} catch (error) {
|
|
103
|
-
|
|
104
|
-
if (((_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.status) === 404) {
|
|
97
|
+
if (error.httpStatus === 404) {
|
|
105
98
|
printMessage(`Resource Type with name ${resourceTypeName} does not exist in realm ${state.getRealm()}`, 'error');
|
|
106
99
|
} else {
|
|
107
|
-
|
|
108
|
-
printMessage(((_error$response4 = error.response) === null || _error$response4 === void 0 || (_error$response4 = _error$response4.data) === null || _error$response4 === void 0 ? void 0 : _error$response4.message) || error.message, 'error');
|
|
100
|
+
printError(error);
|
|
109
101
|
}
|
|
110
102
|
}
|
|
111
|
-
return
|
|
103
|
+
return false;
|
|
112
104
|
}
|
|
113
105
|
|
|
114
106
|
/**
|
|
@@ -119,18 +111,17 @@ export async function describeResourceTypeByName(resourceTypeName, json = false)
|
|
|
119
111
|
export async function deleteResourceTypeById(resourceTypeUuid) {
|
|
120
112
|
debugMessage(`cli.ResourceTypeOps.deleteResourceType: begin`);
|
|
121
113
|
showSpinner(`Deleting ${resourceTypeUuid}...`);
|
|
122
|
-
let outcome = false;
|
|
123
114
|
try {
|
|
124
115
|
debugMessage(`Deleting resource type ${resourceTypeUuid}`);
|
|
125
116
|
await deleteResourceType(resourceTypeUuid);
|
|
126
117
|
succeedSpinner(`Deleted ${resourceTypeUuid}.`);
|
|
127
|
-
|
|
118
|
+
debugMessage(`cli.ResourceTypeOps.deleteResourceType: end`);
|
|
119
|
+
return true;
|
|
128
120
|
} catch (error) {
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
failSpinner(`Error deleting resource type ${resourceTypeUuid}`);
|
|
122
|
+
printError(error);
|
|
131
123
|
}
|
|
132
|
-
|
|
133
|
-
return outcome;
|
|
124
|
+
return false;
|
|
134
125
|
}
|
|
135
126
|
|
|
136
127
|
/**
|
|
@@ -141,18 +132,17 @@ export async function deleteResourceTypeById(resourceTypeUuid) {
|
|
|
141
132
|
export async function deleteResourceTypeUsingName(resourceTypeName) {
|
|
142
133
|
debugMessage(`cli.ResourceTypeOps.deleteResourceTypeByName: begin`);
|
|
143
134
|
showSpinner(`Deleting ${resourceTypeName}...`);
|
|
144
|
-
let outcome = false;
|
|
145
135
|
try {
|
|
146
136
|
debugMessage(`Deleting resource type ${resourceTypeName}`);
|
|
147
137
|
await deleteResourceTypeByName(resourceTypeName);
|
|
148
138
|
succeedSpinner(`Deleted ${resourceTypeName}.`);
|
|
149
|
-
|
|
139
|
+
debugMessage(`cli.ResourceTypeOps.deleteResourceTypeByName: end`);
|
|
140
|
+
return true;
|
|
150
141
|
} catch (error) {
|
|
151
|
-
|
|
152
|
-
|
|
142
|
+
failSpinner(`Error deleting resource type ${resourceTypeName}`);
|
|
143
|
+
printError(error);
|
|
153
144
|
}
|
|
154
|
-
|
|
155
|
-
return outcome;
|
|
145
|
+
return false;
|
|
156
146
|
}
|
|
157
147
|
|
|
158
148
|
/**
|
|
@@ -161,7 +151,6 @@ export async function deleteResourceTypeUsingName(resourceTypeName) {
|
|
|
161
151
|
*/
|
|
162
152
|
export async function deleteResourceTypes() {
|
|
163
153
|
debugMessage(`cli.ResourceTypeOps.deleteResourceTypes: begin`);
|
|
164
|
-
let outcome = false;
|
|
165
154
|
const errors = [];
|
|
166
155
|
let resourceTypes = [];
|
|
167
156
|
let indicatorId;
|
|
@@ -171,9 +160,8 @@ export async function deleteResourceTypes() {
|
|
|
171
160
|
resourceTypes = await readResourceTypes();
|
|
172
161
|
succeedSpinner(`Found ${resourceTypes.length} resource types.`);
|
|
173
162
|
} catch (error) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
throw error;
|
|
163
|
+
failSpinner(`Error retrieving all resource types`);
|
|
164
|
+
throw new FrodoError(`Error retrieving all resource types`, error);
|
|
177
165
|
}
|
|
178
166
|
if (resourceTypes.length) indicatorId = createProgressIndicator('determinate', resourceTypes.length, `Deleting ${resourceTypes.length} resource types...`);
|
|
179
167
|
for (const resourceType of resourceTypes) {
|
|
@@ -183,25 +171,23 @@ export async function deleteResourceTypes() {
|
|
|
183
171
|
await deleteResourceType(resourceTypeId);
|
|
184
172
|
updateProgressIndicator(indicatorId, `Deleted ${resourceTypeId}`);
|
|
185
173
|
} catch (error) {
|
|
186
|
-
error.message = `Error deleting resource type ${resourceTypeId}: ${error}`;
|
|
187
|
-
updateProgressIndicator(indicatorId, error.message);
|
|
188
174
|
errors.push(error);
|
|
189
175
|
}
|
|
190
176
|
}
|
|
191
177
|
} catch (error) {
|
|
192
|
-
|
|
193
|
-
errors.push(error);
|
|
178
|
+
errors.push(new FrodoError(`Error deleting resource types`, error));
|
|
194
179
|
} finally {
|
|
195
|
-
if (errors.length) {
|
|
196
|
-
|
|
197
|
-
|
|
180
|
+
if (errors.length > 0) {
|
|
181
|
+
if (resourceTypes.length) stopProgressIndicator(indicatorId, `Error deleting all resource types`);
|
|
182
|
+
for (const error of errors) {
|
|
183
|
+
printError(error);
|
|
184
|
+
}
|
|
198
185
|
} else {
|
|
199
186
|
if (resourceTypes.length) stopProgressIndicator(indicatorId, `Deleted ${resourceTypes.length} resource types.`);
|
|
200
|
-
outcome = true;
|
|
201
187
|
}
|
|
202
188
|
}
|
|
203
|
-
debugMessage(`cli.ResourceTypeOps.deleteResourceTypes: end
|
|
204
|
-
return
|
|
189
|
+
debugMessage(`cli.ResourceTypeOps.deleteResourceTypes: end`);
|
|
190
|
+
return errors.length === 0;
|
|
205
191
|
}
|
|
206
192
|
|
|
207
193
|
/**
|
|
@@ -212,7 +198,6 @@ export async function deleteResourceTypes() {
|
|
|
212
198
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
213
199
|
*/
|
|
214
200
|
export async function exportResourceTypeToFile(resourceTypeUuid, file, includeMeta = true) {
|
|
215
|
-
let outcome = false;
|
|
216
201
|
debugMessage(`cli.ResourceTypeOps.exportResourceTypeToFile: begin`);
|
|
217
202
|
showSpinner(`Exporting ${resourceTypeUuid}...`);
|
|
218
203
|
try {
|
|
@@ -224,12 +209,13 @@ export async function exportResourceTypeToFile(resourceTypeUuid, file, includeMe
|
|
|
224
209
|
const exportData = await exportResourceType(resourceTypeUuid);
|
|
225
210
|
saveJsonToFile(exportData, filePath, includeMeta);
|
|
226
211
|
succeedSpinner(`Exported ${resourceTypeUuid} to ${filePath}.`);
|
|
227
|
-
|
|
212
|
+
debugMessage(`cli.ResourceTypeOps.exportResourceTypeToFile: end`);
|
|
213
|
+
return true;
|
|
228
214
|
} catch (error) {
|
|
229
|
-
failSpinner(`Error exporting ${resourceTypeUuid}
|
|
215
|
+
failSpinner(`Error exporting resource type ${resourceTypeUuid}`);
|
|
216
|
+
printError(error);
|
|
230
217
|
}
|
|
231
|
-
|
|
232
|
-
return outcome;
|
|
218
|
+
return false;
|
|
233
219
|
}
|
|
234
220
|
|
|
235
221
|
/**
|
|
@@ -240,7 +226,6 @@ export async function exportResourceTypeToFile(resourceTypeUuid, file, includeMe
|
|
|
240
226
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
241
227
|
*/
|
|
242
228
|
export async function exportResourceTypeByNameToFile(resourceTypeName, file, includeMeta = true) {
|
|
243
|
-
let outcome = false;
|
|
244
229
|
debugMessage(`cli.ResourceTypeOps.exportResourceTypeByNameToFile: begin`);
|
|
245
230
|
showSpinner(`Exporting ${resourceTypeName}...`);
|
|
246
231
|
try {
|
|
@@ -252,12 +237,13 @@ export async function exportResourceTypeByNameToFile(resourceTypeName, file, inc
|
|
|
252
237
|
const exportData = await exportResourceTypeByName(resourceTypeName);
|
|
253
238
|
saveJsonToFile(exportData, filePath, includeMeta);
|
|
254
239
|
succeedSpinner(`Exported ${resourceTypeName} to ${filePath}.`);
|
|
255
|
-
|
|
240
|
+
debugMessage(`cli.ResourceTypeOps.exportResourceTypeByNameToFile: end`);
|
|
241
|
+
return true;
|
|
256
242
|
} catch (error) {
|
|
257
|
-
failSpinner(`Error exporting ${resourceTypeName}
|
|
243
|
+
failSpinner(`Error exporting resource type ${resourceTypeName}`);
|
|
244
|
+
printError(error);
|
|
258
245
|
}
|
|
259
|
-
|
|
260
|
-
return outcome;
|
|
246
|
+
return false;
|
|
261
247
|
}
|
|
262
248
|
|
|
263
249
|
/**
|
|
@@ -267,7 +253,6 @@ export async function exportResourceTypeByNameToFile(resourceTypeName, file, inc
|
|
|
267
253
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
268
254
|
*/
|
|
269
255
|
export async function exportResourceTypesToFile(file, includeMeta = true) {
|
|
270
|
-
let outcome = false;
|
|
271
256
|
debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFile: begin`);
|
|
272
257
|
showSpinner(`Exporting all resource types...`);
|
|
273
258
|
try {
|
|
@@ -279,12 +264,12 @@ export async function exportResourceTypesToFile(file, includeMeta = true) {
|
|
|
279
264
|
const exportData = await exportResourceTypes();
|
|
280
265
|
saveJsonToFile(exportData, filePath, includeMeta);
|
|
281
266
|
succeedSpinner(`Exported all resource types to ${filePath}.`);
|
|
282
|
-
|
|
267
|
+
debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFile: end`);
|
|
268
|
+
return true;
|
|
283
269
|
} catch (error) {
|
|
284
|
-
failSpinner(`Error exporting resource types
|
|
270
|
+
failSpinner(`Error exporting resource types`);
|
|
285
271
|
}
|
|
286
|
-
|
|
287
|
-
return outcome;
|
|
272
|
+
return false;
|
|
288
273
|
}
|
|
289
274
|
|
|
290
275
|
/**
|
|
@@ -307,16 +292,19 @@ export async function exportResourceTypesToFiles(includeMeta = true) {
|
|
|
307
292
|
updateProgressIndicator(indicatorId, `Exported ${resourceType.name}.`);
|
|
308
293
|
} catch (error) {
|
|
309
294
|
errors.push(error);
|
|
310
|
-
updateProgressIndicator(indicatorId, `Error exporting ${resourceType.name}.`);
|
|
311
295
|
}
|
|
312
296
|
}
|
|
297
|
+
if (errors.length > 0) {
|
|
298
|
+
throw new FrodoError(`Error exporting policies`, errors);
|
|
299
|
+
}
|
|
313
300
|
stopProgressIndicator(indicatorId, `Export complete.`);
|
|
301
|
+
debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFiles: end`);
|
|
302
|
+
return true;
|
|
314
303
|
} catch (error) {
|
|
315
|
-
|
|
316
|
-
|
|
304
|
+
stopProgressIndicator(indicatorId, `Error exporting resource types to files`, 'fail');
|
|
305
|
+
printError(error);
|
|
317
306
|
}
|
|
318
|
-
|
|
319
|
-
return 0 === errors.length;
|
|
307
|
+
return false;
|
|
320
308
|
}
|
|
321
309
|
|
|
322
310
|
/**
|
|
@@ -326,21 +314,20 @@ export async function exportResourceTypesToFiles(includeMeta = true) {
|
|
|
326
314
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
327
315
|
*/
|
|
328
316
|
export async function importResourceTypeFromFile(resourceTypeId, file) {
|
|
329
|
-
let outcome = false;
|
|
330
317
|
debugMessage(`cli.ResourceTypeOps.importResourceTypeFromFile: begin`);
|
|
331
318
|
showSpinner(`Importing ${resourceTypeId}...`);
|
|
332
319
|
try {
|
|
333
320
|
const data = fs.readFileSync(getFilePath(file), 'utf8');
|
|
334
321
|
const fileData = JSON.parse(data);
|
|
335
322
|
await importResourceType(resourceTypeId, fileData);
|
|
336
|
-
outcome = true;
|
|
337
323
|
succeedSpinner(`Imported ${resourceTypeId}.`);
|
|
324
|
+
debugMessage(`cli.ResourceTypeOps.importResourceTypeFromFile: end`);
|
|
325
|
+
return true;
|
|
338
326
|
} catch (error) {
|
|
339
|
-
failSpinner(`Error importing ${resourceTypeId}
|
|
340
|
-
|
|
327
|
+
failSpinner(`Error importing resource type ${resourceTypeId}`);
|
|
328
|
+
printError(error);
|
|
341
329
|
}
|
|
342
|
-
|
|
343
|
-
return outcome;
|
|
330
|
+
return false;
|
|
344
331
|
}
|
|
345
332
|
|
|
346
333
|
/**
|
|
@@ -350,21 +337,20 @@ export async function importResourceTypeFromFile(resourceTypeId, file) {
|
|
|
350
337
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
351
338
|
*/
|
|
352
339
|
export async function importResourceTypeByNameFromFile(resourceTypeName, file) {
|
|
353
|
-
let outcome = false;
|
|
354
340
|
debugMessage(`cli.ResourceTypeOps.importResourceTypeByNameFromFile: begin`);
|
|
355
341
|
showSpinner(`Importing ${resourceTypeName}...`);
|
|
356
342
|
try {
|
|
357
343
|
const data = fs.readFileSync(getFilePath(file), 'utf8');
|
|
358
344
|
const fileData = JSON.parse(data);
|
|
359
345
|
await importResourceTypeByName(resourceTypeName, fileData);
|
|
360
|
-
outcome = true;
|
|
361
346
|
succeedSpinner(`Imported ${resourceTypeName}.`);
|
|
347
|
+
debugMessage(`cli.ResourceTypeOps.importResourceTypeByNameFromFile: end`);
|
|
348
|
+
return true;
|
|
362
349
|
} catch (error) {
|
|
363
|
-
failSpinner(`Error importing ${resourceTypeName}
|
|
364
|
-
|
|
350
|
+
failSpinner(`Error importing resource type ${resourceTypeName}`);
|
|
351
|
+
printError(error);
|
|
365
352
|
}
|
|
366
|
-
|
|
367
|
-
return outcome;
|
|
353
|
+
return false;
|
|
368
354
|
}
|
|
369
355
|
|
|
370
356
|
/**
|
|
@@ -373,7 +359,6 @@ export async function importResourceTypeByNameFromFile(resourceTypeName, file) {
|
|
|
373
359
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
374
360
|
*/
|
|
375
361
|
export async function importFirstResourceTypeFromFile(file) {
|
|
376
|
-
let outcome = false;
|
|
377
362
|
debugMessage(`cli.ResourceTypeOps.importFirstResourceTypeFromFile: begin`);
|
|
378
363
|
const filePath = getFilePath(file);
|
|
379
364
|
showSpinner(`Importing ${filePath}...`);
|
|
@@ -381,14 +366,14 @@ export async function importFirstResourceTypeFromFile(file) {
|
|
|
381
366
|
const data = fs.readFileSync(filePath, 'utf8');
|
|
382
367
|
const fileData = JSON.parse(data);
|
|
383
368
|
await importFirstResourceType(fileData);
|
|
384
|
-
outcome = true;
|
|
385
369
|
succeedSpinner(`Imported ${filePath}.`);
|
|
370
|
+
debugMessage(`cli.ResourceTypeOps.importFirstResourceTypeFromFile: end`);
|
|
371
|
+
return true;
|
|
386
372
|
} catch (error) {
|
|
387
|
-
failSpinner(`Error importing
|
|
388
|
-
|
|
373
|
+
failSpinner(`Error importing first resource type`);
|
|
374
|
+
printError(error);
|
|
389
375
|
}
|
|
390
|
-
|
|
391
|
-
return outcome;
|
|
376
|
+
return false;
|
|
392
377
|
}
|
|
393
378
|
|
|
394
379
|
/**
|
|
@@ -397,7 +382,6 @@ export async function importFirstResourceTypeFromFile(file) {
|
|
|
397
382
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
398
383
|
*/
|
|
399
384
|
export async function importResourceTypesFromFile(file) {
|
|
400
|
-
let outcome = false;
|
|
401
385
|
debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFile: begin`);
|
|
402
386
|
const filePath = getFilePath(file);
|
|
403
387
|
showSpinner(`Importing ${filePath}...`);
|
|
@@ -405,14 +389,14 @@ export async function importResourceTypesFromFile(file) {
|
|
|
405
389
|
const data = fs.readFileSync(filePath, 'utf8');
|
|
406
390
|
const fileData = JSON.parse(data);
|
|
407
391
|
await importResourceTypes(fileData);
|
|
408
|
-
outcome = true;
|
|
409
392
|
succeedSpinner(`Imported ${filePath}.`);
|
|
393
|
+
debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFile: end`);
|
|
394
|
+
return true;
|
|
410
395
|
} catch (error) {
|
|
411
|
-
failSpinner(`Error importing
|
|
412
|
-
|
|
396
|
+
failSpinner(`Error importing resource types`);
|
|
397
|
+
printError(error);
|
|
413
398
|
}
|
|
414
|
-
|
|
415
|
-
return outcome;
|
|
399
|
+
return false;
|
|
416
400
|
}
|
|
417
401
|
|
|
418
402
|
/**
|
|
@@ -438,17 +422,18 @@ export async function importResourceTypesFromFiles() {
|
|
|
438
422
|
updateProgressIndicator(indicatorId, `Imported ${count} resource types from ${file}`);
|
|
439
423
|
} catch (error) {
|
|
440
424
|
errors.push(error);
|
|
441
|
-
updateProgressIndicator(indicatorId, `Error importing resource types from ${file}`);
|
|
442
|
-
printMessage(error, 'error');
|
|
443
425
|
}
|
|
444
426
|
}
|
|
427
|
+
if (errors.length > 0) {
|
|
428
|
+
throw new FrodoError(`Error importing resource types`, errors);
|
|
429
|
+
}
|
|
445
430
|
stopProgressIndicator(indicatorId, `Finished importing ${total} resource types from ${files.length} files.`);
|
|
431
|
+
debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFiles: end`);
|
|
432
|
+
return true;
|
|
446
433
|
} catch (error) {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
printMessage(error, 'error');
|
|
434
|
+
stopProgressIndicator(indicatorId, `Error importing resource types`);
|
|
435
|
+
printError(error);
|
|
450
436
|
}
|
|
451
|
-
|
|
452
|
-
return 0 === errors.length;
|
|
437
|
+
return false;
|
|
453
438
|
}
|
|
454
439
|
//# sourceMappingURL=ResourceTypeOps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceTypeOps.js","names":["frodo","state","fs","createObjectTable","createProgressIndicator","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressIndicator","succeedSpinner","updateProgressIndicator","getRealmName","getTypedFilename","saveJsonToFile","titleCase","getFilePath","getWorkingDirectory","utils","readResourceTypes","readResourceType","readResourceTypeByName","exportResourceType","exportResourceTypeByName","exportResourceTypes","importResourceType","importResourceTypeByName","importFirstResourceType","importResourceTypes","deleteResourceType","deleteResourceTypeByName","authz","resourceType","listResourceTypes","long","outcome","resourceTypes","sort","a","b","name","localeCompare","table","push","description","uuid","toString","err","message","describeResourceType","resourceTypeUuid","json","error","_error$response","response","status","getRealm","_error$response2","data","describeResourceTypeByName","resourceTypeName","_error$response3","_error$response4","deleteResourceTypeById","_error$response5","deleteResourceTypeUsingName","_error$response6","deleteResourceTypes","errors","indicatorId","length","resourceTypeId","errorMessages","map","join","exportResourceTypeToFile","file","includeMeta","fileName","filePath","exportData","exportResourceTypeByNameToFile","exportResourceTypesToFile","exportResourceTypesToFiles","importResourceTypeFromFile","readFileSync","fileData","JSON","parse","importResourceTypeByNameFromFile","importFirstResourceTypeFromFile","importResourceTypesFromFile","importResourceTypesFromFiles","names","readdirSync","files","filter","toLowerCase","endsWith","total","count","Object","keys","resourcetype"],"sources":["../../src/ops/ResourceTypeOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { type ResourceTypeSkeleton } from '@rockcarver/frodo-lib/types/api/ResourceTypesApi';\nimport { type ResourceTypeExportInterface } from '@rockcarver/frodo-lib/types/ops/ResourceTypeOps';\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 readResourceTypes,\n readResourceType,\n readResourceTypeByName,\n exportResourceType,\n exportResourceTypeByName,\n exportResourceTypes,\n importResourceType,\n importResourceTypeByName,\n importFirstResourceType,\n importResourceTypes,\n deleteResourceType,\n deleteResourceTypeByName,\n} = frodo.authz.resourceType;\n\n/**\n * List resource types\n * @param {boolean} long more fields\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listResourceTypes(long = false): Promise<boolean> {\n let outcome = false;\n try {\n const resourceTypes = await readResourceTypes();\n resourceTypes.sort((a, b) => a.name.localeCompare(b.name));\n if (long) {\n const table = createTable(['Name', 'Description', 'Uuid']);\n for (const resourceType of resourceTypes) {\n table.push([\n `${resourceType.name}`,\n `${resourceType.description}`,\n `${resourceType.uuid}`,\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n for (const resourceType of resourceTypes) {\n printMessage(`${resourceType.name}`, 'data');\n }\n }\n outcome = true;\n } catch (err) {\n printMessage(`listResourceTypes ERROR: ${err.message}`, 'error');\n printMessage(err, 'error');\n }\n return outcome;\n}\n\n/**\n * Describe resource type by uuid\n * @param {string} resourceTypeUuid resource type uuid\n * @param {boolean} json JSON output\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describeResourceType(\n resourceTypeUuid: string,\n json = false\n): Promise<boolean> {\n let outcome = false;\n try {\n const resourceType = await readResourceType(resourceTypeUuid);\n if (json) {\n printMessage(resourceType, 'data');\n } else {\n const table = createObjectTable(resourceType);\n printMessage(table.toString(), 'data');\n }\n outcome = true;\n } catch (error) {\n if (error.response?.status === 404) {\n printMessage(\n `Resource Type with uuid ${resourceTypeUuid} does not exist in realm ${state.getRealm()}`,\n 'error'\n );\n } else {\n printMessage(error.response?.data?.message || error.message, 'error');\n }\n }\n return outcome;\n}\n\n/**\n * Describe resource type by name\n * @param {string} resourceTypeName resource type name\n * @param {boolean} json JSON output\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describeResourceTypeByName(\n resourceTypeName: string,\n json = false\n): Promise<boolean> {\n let outcome = false;\n try {\n const resourceType = await readResourceTypeByName(resourceTypeName);\n if (json) {\n printMessage(resourceType, 'data');\n } else {\n const table = createObjectTable(resourceType);\n printMessage(table.toString(), 'data');\n }\n outcome = true;\n } catch (error) {\n if (error.response?.status === 404) {\n printMessage(\n `Resource Type with name ${resourceTypeName} does not exist in realm ${state.getRealm()}`,\n 'error'\n );\n } else {\n printMessage(error.response?.data?.message || error.message, 'error');\n }\n }\n return outcome;\n}\n\n/**\n * Delete resource type by uuid\n * @param {string} resourceTypeUuid resource type uuid\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceTypeById(\n resourceTypeUuid: string\n): Promise<boolean | ResourceTypeSkeleton> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceType: begin`);\n showSpinner(`Deleting ${resourceTypeUuid}...`);\n let outcome = false;\n try {\n debugMessage(`Deleting resource type ${resourceTypeUuid}`);\n await deleteResourceType(resourceTypeUuid);\n succeedSpinner(`Deleted ${resourceTypeUuid}.`);\n outcome = true;\n } catch (error) {\n failSpinner(\n `Error deleting ${resourceTypeUuid}: ${\n error.response?.data?.message || error.message\n }`\n );\n }\n debugMessage(\n `cli.ResourceTypeOps.deleteResourceType: end [outcome=${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Delete resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceTypeUsingName(\n resourceTypeName: string\n): Promise<boolean | ResourceTypeSkeleton> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceTypeByName: begin`);\n showSpinner(`Deleting ${resourceTypeName}...`);\n let outcome = false;\n try {\n debugMessage(`Deleting resource type ${resourceTypeName}`);\n await deleteResourceTypeByName(resourceTypeName);\n succeedSpinner(`Deleted ${resourceTypeName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(\n `Error deleting ${resourceTypeName}: ${\n error.response?.data?.message || error.message\n }`\n );\n }\n debugMessage(\n `cli.ResourceTypeOps.deleteResourceTypeByName: end [outcome=${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Delete all resource types\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceTypes(): Promise<\n boolean | ResourceTypeSkeleton\n> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceTypes: begin`);\n let outcome = false;\n const errors = [];\n let resourceTypes: ResourceTypeSkeleton[] = [];\n let indicatorId: string;\n try {\n showSpinner(`Retrieving all resource types...`);\n try {\n resourceTypes = await readResourceTypes();\n succeedSpinner(`Found ${resourceTypes.length} resource types.`);\n } catch (error) {\n error.message = `Error retrieving all resource types: ${error.message}`;\n failSpinner(error.message);\n throw error;\n }\n if (resourceTypes.length)\n indicatorId = createProgressIndicator(\n 'determinate',\n resourceTypes.length,\n `Deleting ${resourceTypes.length} resource types...`\n );\n for (const resourceType of resourceTypes) {\n const resourceTypeId = resourceType.uuid;\n try {\n debugMessage(`Deleting resource type ${resourceTypeId}`);\n await deleteResourceType(resourceTypeId);\n updateProgressIndicator(indicatorId, `Deleted ${resourceTypeId}`);\n } catch (error) {\n error.message = `Error deleting resource type ${resourceTypeId}: ${error}`;\n updateProgressIndicator(indicatorId, error.message);\n errors.push(error);\n }\n }\n } catch (error) {\n error.message = `Error deleting resource types: ${error}`;\n errors.push(error);\n } finally {\n if (errors.length) {\n const errorMessages = errors.map((error) => error.message).join('\\n');\n if (resourceTypes.length)\n stopProgressIndicator(\n indicatorId,\n `Error deleting all resource types: ${errorMessages}`\n );\n } else {\n if (resourceTypes.length)\n stopProgressIndicator(\n indicatorId,\n `Deleted ${resourceTypes.length} resource types.`\n );\n outcome = true;\n }\n }\n debugMessage(\n `cli.ResourceTypeOps.deleteResourceTypes: end [outcome=${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Export resource type to file\n * @param {string} resourceTypeUuid resource type uuid\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypeToFile(\n resourceTypeUuid: string,\n file: string,\n includeMeta = true\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeToFile: begin`);\n showSpinner(`Exporting ${resourceTypeUuid}...`);\n try {\n let fileName = getTypedFilename(resourceTypeUuid, 'resourcetype.authz');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await exportResourceType(resourceTypeUuid);\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported ${resourceTypeUuid} to ${filePath}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${resourceTypeUuid}: ${error.message}`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeToFile: end`);\n return outcome;\n}\n\n/**\n * Export resource type by name to file\n * @param {string} resourceTypeName resource type name\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypeByNameToFile(\n resourceTypeName: string,\n file: string,\n includeMeta = true\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeByNameToFile: begin`);\n showSpinner(`Exporting ${resourceTypeName}...`);\n try {\n let fileName = getTypedFilename(resourceTypeName, 'resourcetype.authz');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await exportResourceTypeByName(resourceTypeName);\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported ${resourceTypeName} to ${filePath}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${resourceTypeName}: ${error.message}`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeByNameToFile: end`);\n return outcome;\n}\n\n/**\n * Export resource types to file\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypesToFile(\n file: string,\n includeMeta = true\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFile: begin`);\n showSpinner(`Exporting all resource types...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}ResourceTypes`,\n 'resourcetype.authz'\n );\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await exportResourceTypes();\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported all resource types to ${filePath}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting resource types: ${error.message}`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFile: end`);\n return outcome;\n}\n\n/**\n * Export all resource types to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypesToFiles(\n includeMeta = true\n): Promise<boolean> {\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFiles: begin`);\n const errors = [];\n let indicatorId: string;\n try {\n const resourceTypes: ResourceTypeSkeleton[] = await readResourceTypes();\n indicatorId = createProgressIndicator(\n 'determinate',\n resourceTypes.length,\n 'Exporting resource types...'\n );\n for (const resourceType of resourceTypes) {\n const file = getTypedFilename(resourceType.name, 'resourcetype.authz');\n try {\n const exportData: ResourceTypeExportInterface =\n await exportResourceType(resourceType.uuid);\n saveJsonToFile(exportData, getFilePath(file, true), includeMeta);\n updateProgressIndicator(indicatorId, `Exported ${resourceType.name}.`);\n } catch (error) {\n errors.push(error);\n updateProgressIndicator(\n indicatorId,\n `Error exporting ${resourceType.name}.`\n );\n }\n }\n stopProgressIndicator(indicatorId, `Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressIndicator(\n indicatorId,\n `Error exporting resource types to files`\n );\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import resource type from file\n * @param {string} resourceTypeId resource type id\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypeFromFile(\n resourceTypeId: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importResourceTypeFromFile: begin`);\n showSpinner(`Importing ${resourceTypeId}...`);\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n await importResourceType(resourceTypeId, fileData);\n outcome = true;\n succeedSpinner(`Imported ${resourceTypeId}.`);\n } catch (error) {\n failSpinner(`Error importing ${resourceTypeId}: ${error.message}`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypeFromFile: end`);\n return outcome;\n}\n\n/**\n * Import resource type by name from file\n * @param {string} resourceTypeName resource type name\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypeByNameFromFile(\n resourceTypeName: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importResourceTypeByNameFromFile: begin`);\n showSpinner(`Importing ${resourceTypeName}...`);\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n await importResourceTypeByName(resourceTypeName, fileData);\n outcome = true;\n succeedSpinner(`Imported ${resourceTypeName}.`);\n } catch (error) {\n failSpinner(`Error importing ${resourceTypeName}: ${error.message}`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypeByNameFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first resource type from file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstResourceTypeFromFile(\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importFirstResourceTypeFromFile: 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 importFirstResourceType(fileData);\n outcome = true;\n succeedSpinner(`Imported ${filePath}.`);\n } catch (error) {\n failSpinner(`Error importing ${filePath}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importFirstResourceTypeFromFile: end`);\n return outcome;\n}\n\n/**\n * Import resource types from file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypesFromFile(\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFile: 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 importResourceTypes(fileData);\n outcome = true;\n succeedSpinner(`Imported ${filePath}.`);\n } catch (error) {\n failSpinner(`Error importing ${filePath}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFile: end`);\n return outcome;\n}\n\n/**\n * Import resource types from files\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypesFromFiles(): Promise<boolean> {\n const errors = [];\n let indicatorId: string;\n try {\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFiles: begin`);\n const names = fs.readdirSync(getWorkingDirectory());\n const files = names\n .filter((name) => name.toLowerCase().endsWith('.resourcetype.authz.json'))\n .map((name) => getFilePath(name));\n indicatorId = createProgressIndicator(\n 'determinate',\n files.length,\n 'Importing resource types...'\n );\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: ResourceTypeExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.resourcetype).length;\n total += count;\n await importResourceTypes(fileData);\n updateProgressIndicator(\n indicatorId,\n `Imported ${count} resource types from ${file}`\n );\n } catch (error) {\n errors.push(error);\n updateProgressIndicator(\n indicatorId,\n `Error importing resource types from ${file}`\n );\n printMessage(error, 'error');\n }\n }\n stopProgressIndicator(\n indicatorId,\n `Finished importing ${total} resource types from ${files.length} files.`\n );\n } catch (error) {\n errors.push(error);\n stopProgressIndicator(\n indicatorId,\n `Error importing resource types from files.`\n );\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFiles: end`);\n return 0 === errors.length;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAGpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,iBAAiB,EACjBC,uBAAuB,EACvBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,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,GAAGlB,KAAK,CAACmB,KAAK;AACf,MAAM;EACJC,iBAAiB;EACjBC,gBAAgB;EAChBC,sBAAsB;EACtBC,kBAAkB;EAClBC,wBAAwB;EACxBC,mBAAmB;EACnBC,kBAAkB;EAClBC,wBAAwB;EACxBC,uBAAuB;EACvBC,mBAAmB;EACnBC,kBAAkB;EAClBC;AACF,CAAC,GAAG/B,KAAK,CAACgC,KAAK,CAACC,YAAY;;AAE5B;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,iBAAiBA,CAACC,IAAI,GAAG,KAAK,EAAoB;EACtE,IAAIC,OAAO,GAAG,KAAK;EACnB,IAAI;IACF,MAAMC,aAAa,GAAG,MAAMjB,iBAAiB,CAAC,CAAC;IAC/CiB,aAAa,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,IAAI,CAACC,aAAa,CAACF,CAAC,CAACC,IAAI,CAAC,CAAC;IAC1D,IAAIN,IAAI,EAAE;MACR,MAAMQ,KAAK,GAAGtC,WAAW,CAAC,CAAC,MAAM,EAAE,aAAa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AAIC,KAAK;QACd,MAAMxE,mBAAmB,CAAC0D,QAAQ,CAAC;QACnC3E,uBAAuB,CACrB0D,WAAW,EACV,YAAW+B,KAAM,wBAAuBxB,IAAK,EAChD,CAAC;MACH,CAAC,CAAC,OAAOxB,KAAK,EAAE;QACdgB,MAAM,CAACzB,IAAI,CAACS,KAAK,CAAC;QAClBzC,uBAAuB,CACrB0D,WAAW,EACV,uCAAsCO,IAAK,EAC9C,CAAC;QACDrE,YAAY,CAAC6C,KAAK,EAAE,OAAO,CAAC;MAC9B;IACF;IACA3C,qBAAqB,CACnB4D,WAAW,EACV,sBAAqB8B,KAAM,wBAAuBJ,KAAK,CAACzB,MAAO,SAClE,CAAC;EACH,CAAC,CAAC,OAAOlB,KAAK,EAAE;IACdgB,MAAM,CAACzB,IAAI,CAACS,KAAK,CAAC;IAClB3C,qBAAqB,CACnB4D,WAAW,EACV,4CACH,CAAC;IACD9D,YAAY,CAAC6C,KAAK,EAAE,OAAO,CAAC;EAC9B;EACA/C,YAAY,CAAE,uDAAsD,CAAC;EACrE,OAAO,CAAC,KAAK+D,MAAM,CAACE,MAAM;AAC5B"}
|
|
1
|
+
{"version":3,"file":"ResourceTypeOps.js","names":["frodo","FrodoError","state","fs","createObjectTable","createProgressIndicator","createTable","debugMessage","failSpinner","printError","printMessage","showSpinner","stopProgressIndicator","succeedSpinner","updateProgressIndicator","getRealmName","getTypedFilename","saveJsonToFile","titleCase","getFilePath","getWorkingDirectory","utils","readResourceTypes","readResourceType","readResourceTypeByName","exportResourceType","exportResourceTypeByName","exportResourceTypes","importResourceType","importResourceTypeByName","importFirstResourceType","importResourceTypes","deleteResourceType","deleteResourceTypeByName","authz","resourceType","listResourceTypes","long","resourceTypes","sort","a","b","name","localeCompare","table","push","description","uuid","toString","error","describeResourceType","resourceTypeUuid","json","httpStatus","getRealm","describeResourceTypeByName","resourceTypeName","deleteResourceTypeById","deleteResourceTypeUsingName","deleteResourceTypes","errors","indicatorId","length","resourceTypeId","exportResourceTypeToFile","file","includeMeta","fileName","filePath","exportData","exportResourceTypeByNameToFile","exportResourceTypesToFile","exportResourceTypesToFiles","importResourceTypeFromFile","data","readFileSync","fileData","JSON","parse","importResourceTypeByNameFromFile","importFirstResourceTypeFromFile","importResourceTypesFromFile","importResourceTypesFromFiles","names","readdirSync","files","filter","toLowerCase","endsWith","map","total","count","Object","keys","resourcetype"],"sources":["../../src/ops/ResourceTypeOps.ts"],"sourcesContent":["import { frodo, FrodoError, state } from '@rockcarver/frodo-lib';\nimport { type ResourceTypeSkeleton } from '@rockcarver/frodo-lib/types/api/ResourceTypesApi';\nimport { type ResourceTypeExportInterface } from '@rockcarver/frodo-lib/types/ops/ResourceTypeOps';\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 readResourceTypes,\n readResourceType,\n readResourceTypeByName,\n exportResourceType,\n exportResourceTypeByName,\n exportResourceTypes,\n importResourceType,\n importResourceTypeByName,\n importFirstResourceType,\n importResourceTypes,\n deleteResourceType,\n deleteResourceTypeByName,\n} = frodo.authz.resourceType;\n\n/**\n * List resource types\n * @param {boolean} long more fields\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listResourceTypes(\n long: boolean = false\n): Promise<boolean> {\n try {\n const resourceTypes = await readResourceTypes();\n resourceTypes.sort((a, b) => a.name.localeCompare(b.name));\n if (long) {\n const table = createTable(['Name', 'Description', 'Uuid']);\n for (const resourceType of resourceTypes) {\n table.push([\n `${resourceType.name}`,\n `${resourceType.description}`,\n `${resourceType.uuid}`,\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n for (const resourceType of resourceTypes) {\n printMessage(`${resourceType.name}`, 'data');\n }\n }\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Describe resource type by uuid\n * @param {string} resourceTypeUuid resource type uuid\n * @param {boolean} json JSON output\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describeResourceType(\n resourceTypeUuid: string,\n json = false\n): Promise<boolean> {\n try {\n const resourceType = await readResourceType(resourceTypeUuid);\n if (json) {\n printMessage(resourceType, 'data');\n } else {\n const table = createObjectTable(resourceType);\n printMessage(table.toString(), 'data');\n }\n return true;\n } catch (error) {\n if ((error as FrodoError).httpStatus === 404) {\n printMessage(\n `Resource Type with uuid ${resourceTypeUuid} does not exist in realm ${state.getRealm()}`,\n 'error'\n );\n } else {\n printError(error);\n }\n }\n return false;\n}\n\n/**\n * Describe resource type by name\n * @param {string} resourceTypeName resource type name\n * @param {boolean} json JSON output\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describeResourceTypeByName(\n resourceTypeName: string,\n json: boolean = false\n): Promise<boolean> {\n try {\n const resourceType = await readResourceTypeByName(resourceTypeName);\n if (json) {\n printMessage(resourceType, 'data');\n } else {\n const table = createObjectTable(resourceType);\n printMessage(table.toString(), 'data');\n }\n return true;\n } catch (error) {\n if ((error as FrodoError).httpStatus === 404) {\n printMessage(\n `Resource Type with name ${resourceTypeName} does not exist in realm ${state.getRealm()}`,\n 'error'\n );\n } else {\n printError(error);\n }\n }\n return false;\n}\n\n/**\n * Delete resource type by uuid\n * @param {string} resourceTypeUuid resource type uuid\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceTypeById(\n resourceTypeUuid: string\n): Promise<boolean | ResourceTypeSkeleton> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceType: begin`);\n showSpinner(`Deleting ${resourceTypeUuid}...`);\n try {\n debugMessage(`Deleting resource type ${resourceTypeUuid}`);\n await deleteResourceType(resourceTypeUuid);\n succeedSpinner(`Deleted ${resourceTypeUuid}.`);\n debugMessage(`cli.ResourceTypeOps.deleteResourceType: end`);\n return true;\n } catch (error) {\n failSpinner(`Error deleting resource type ${resourceTypeUuid}`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Delete resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceTypeUsingName(\n resourceTypeName: string\n): Promise<boolean | ResourceTypeSkeleton> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceTypeByName: begin`);\n showSpinner(`Deleting ${resourceTypeName}...`);\n try {\n debugMessage(`Deleting resource type ${resourceTypeName}`);\n await deleteResourceTypeByName(resourceTypeName);\n succeedSpinner(`Deleted ${resourceTypeName}.`);\n debugMessage(`cli.ResourceTypeOps.deleteResourceTypeByName: end`);\n return true;\n } catch (error) {\n failSpinner(`Error deleting resource type ${resourceTypeName}`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Delete all resource types\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceTypes(): Promise<\n boolean | ResourceTypeSkeleton\n> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceTypes: begin`);\n const errors = [];\n let resourceTypes: ResourceTypeSkeleton[] = [];\n let indicatorId: string;\n try {\n showSpinner(`Retrieving all resource types...`);\n try {\n resourceTypes = await readResourceTypes();\n succeedSpinner(`Found ${resourceTypes.length} resource types.`);\n } catch (error) {\n failSpinner(`Error retrieving all resource types`);\n throw new FrodoError(`Error retrieving all resource types`, error);\n }\n if (resourceTypes.length)\n indicatorId = createProgressIndicator(\n 'determinate',\n resourceTypes.length,\n `Deleting ${resourceTypes.length} resource types...`\n );\n for (const resourceType of resourceTypes) {\n const resourceTypeId = resourceType.uuid;\n try {\n debugMessage(`Deleting resource type ${resourceTypeId}`);\n await deleteResourceType(resourceTypeId);\n updateProgressIndicator(indicatorId, `Deleted ${resourceTypeId}`);\n } catch (error) {\n errors.push(error);\n }\n }\n } catch (error) {\n errors.push(new FrodoError(`Error deleting resource types`, error));\n } finally {\n if (errors.length > 0) {\n if (resourceTypes.length)\n stopProgressIndicator(indicatorId, `Error deleting all resource types`);\n for (const error of errors) {\n printError(error);\n }\n } else {\n if (resourceTypes.length)\n stopProgressIndicator(\n indicatorId,\n `Deleted ${resourceTypes.length} resource types.`\n );\n }\n }\n debugMessage(`cli.ResourceTypeOps.deleteResourceTypes: end`);\n return errors.length === 0;\n}\n\n/**\n * Export resource type to file\n * @param {string} resourceTypeUuid resource type uuid\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypeToFile(\n resourceTypeUuid: string,\n file: string,\n includeMeta: boolean = true\n): Promise<boolean> {\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeToFile: begin`);\n showSpinner(`Exporting ${resourceTypeUuid}...`);\n try {\n let fileName = getTypedFilename(resourceTypeUuid, 'resourcetype.authz');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await exportResourceType(resourceTypeUuid);\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported ${resourceTypeUuid} to ${filePath}.`);\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeToFile: end`);\n return true;\n } catch (error) {\n failSpinner(`Error exporting resource type ${resourceTypeUuid}`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Export resource type by name to file\n * @param {string} resourceTypeName resource type name\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypeByNameToFile(\n resourceTypeName: string,\n file: string,\n includeMeta: boolean = true\n): Promise<boolean> {\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeByNameToFile: begin`);\n showSpinner(`Exporting ${resourceTypeName}...`);\n try {\n let fileName = getTypedFilename(resourceTypeName, 'resourcetype.authz');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await exportResourceTypeByName(resourceTypeName);\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported ${resourceTypeName} to ${filePath}.`);\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeByNameToFile: end`);\n return true;\n } catch (error) {\n failSpinner(`Error exporting resource type ${resourceTypeName}`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Export resource types to file\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypesToFile(\n file: string,\n includeMeta: boolean = true\n): Promise<boolean> {\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFile: begin`);\n showSpinner(`Exporting all resource types...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}ResourceTypes`,\n 'resourcetype.authz'\n );\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await exportResourceTypes();\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported all resource types to ${filePath}.`);\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFile: end`);\n return true;\n } catch (error) {\n failSpinner(`Error exporting resource types`);\n }\n return false;\n}\n\n/**\n * Export all resource types to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypesToFiles(\n includeMeta: boolean = true\n): Promise<boolean> {\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFiles: begin`);\n const errors = [];\n let indicatorId: string;\n try {\n const resourceTypes: ResourceTypeSkeleton[] = await readResourceTypes();\n indicatorId = createProgressIndicator(\n 'determinate',\n resourceTypes.length,\n 'Exporting resource types...'\n );\n for (const resourceType of resourceTypes) {\n const file = getTypedFilename(resourceType.name, 'resourcetype.authz');\n try {\n const exportData: ResourceTypeExportInterface =\n await exportResourceType(resourceType.uuid);\n saveJsonToFile(exportData, getFilePath(file, true), includeMeta);\n updateProgressIndicator(indicatorId, `Exported ${resourceType.name}.`);\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.ResourceTypeOps.exportResourceTypesToFiles: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error exporting resource types to files`,\n 'fail'\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Import resource type from file\n * @param {string} resourceTypeId resource type id\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypeFromFile(\n resourceTypeId: string,\n file: string\n): Promise<boolean> {\n debugMessage(`cli.ResourceTypeOps.importResourceTypeFromFile: begin`);\n showSpinner(`Importing ${resourceTypeId}...`);\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n await importResourceType(resourceTypeId, fileData);\n succeedSpinner(`Imported ${resourceTypeId}.`);\n debugMessage(`cli.ResourceTypeOps.importResourceTypeFromFile: end`);\n return true;\n } catch (error) {\n failSpinner(`Error importing resource type ${resourceTypeId}`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Import resource type by name from file\n * @param {string} resourceTypeName resource type name\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypeByNameFromFile(\n resourceTypeName: string,\n file: string\n): Promise<boolean> {\n debugMessage(`cli.ResourceTypeOps.importResourceTypeByNameFromFile: begin`);\n showSpinner(`Importing ${resourceTypeName}...`);\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n await importResourceTypeByName(resourceTypeName, fileData);\n succeedSpinner(`Imported ${resourceTypeName}.`);\n debugMessage(`cli.ResourceTypeOps.importResourceTypeByNameFromFile: end`);\n return true;\n } catch (error) {\n failSpinner(`Error importing resource type ${resourceTypeName}`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Import first resource type from file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstResourceTypeFromFile(\n file: string\n): Promise<boolean> {\n debugMessage(`cli.ResourceTypeOps.importFirstResourceTypeFromFile: 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 importFirstResourceType(fileData);\n succeedSpinner(`Imported ${filePath}.`);\n debugMessage(`cli.ResourceTypeOps.importFirstResourceTypeFromFile: end`);\n return true;\n } catch (error) {\n failSpinner(`Error importing first resource type`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Import resource types from file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypesFromFile(\n file: string\n): Promise<boolean> {\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFile: 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 importResourceTypes(fileData);\n succeedSpinner(`Imported ${filePath}.`);\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFile: end`);\n return true;\n } catch (error) {\n failSpinner(`Error importing resource types`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Import resource types from files\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypesFromFiles(): Promise<boolean> {\n const errors = [];\n let indicatorId: string;\n try {\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFiles: begin`);\n const names = fs.readdirSync(getWorkingDirectory());\n const files = names\n .filter((name) => name.toLowerCase().endsWith('.resourcetype.authz.json'))\n .map((name) => getFilePath(name));\n indicatorId = createProgressIndicator(\n 'determinate',\n files.length,\n 'Importing resource types...'\n );\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: ResourceTypeExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.resourcetype).length;\n total += count;\n await importResourceTypes(fileData);\n updateProgressIndicator(\n indicatorId,\n `Imported ${count} resource types from ${file}`\n );\n } catch (error) {\n errors.push(error);\n }\n }\n if (errors.length > 0) {\n throw new FrodoError(`Error importing resource types`, errors);\n }\n stopProgressIndicator(\n indicatorId,\n `Finished importing ${total} resource types from ${files.length} files.`\n );\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFiles: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error importing resource types`);\n printError(error);\n }\n return false;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,UAAU,EAAEC,KAAK,QAAQ,uBAAuB;AAGhE,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,iBAAiB;EACjBC,gBAAgB;EAChBC,sBAAsB;EACtBC,kBAAkB;EAClBC,wBAAwB;EACxBC,mBAAmB;EACnBC,kBAAkB;EAClBC,wBAAwB;EACxBC,uBAAuB;EACvBC,mBAAmB;EACnBC,kBAAkB;EAClBC;AACF,CAAC,GAAGjC,KAAK,CAACkC,KAAK,CAACC,YAAY;;AAE5B;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,iBAAiBA,CACrCC,IAAa,GAAG,KAAK,EACH;EAClB,IAAI;IACF,MAAMC,aAAa,GAAG,MAAMhB,iBAAiB,CAAC,CAAC;IAC/CgB,aAAa,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,IAAI,CAACC,aAAa,CAACF,CAAC,CAACC,IAAI,CAAC,CAAC;IAC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