@rockcarver/frodo-cli 2.0.0-51 → 2.0.0-53
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 +42 -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 +15 -8
- 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/IdpOps.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { frodo } from '@rockcarver/frodo-lib';
|
|
1
|
+
import { frodo, FrodoError } from '@rockcarver/frodo-lib';
|
|
2
2
|
import fs from 'fs';
|
|
3
|
-
import { createProgressIndicator, debugMessage, printMessage, stopProgressIndicator, updateProgressIndicator } from '../utils/Console';
|
|
3
|
+
import { createProgressIndicator, debugMessage, printError, printMessage, stopProgressIndicator, updateProgressIndicator } from '../utils/Console';
|
|
4
4
|
const {
|
|
5
5
|
getRealmString,
|
|
6
6
|
getTypedFilename,
|
|
@@ -52,6 +52,7 @@ export function getTableRowMd(socialIdpObj) {
|
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* List providers
|
|
55
|
+
* @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise
|
|
55
56
|
*/
|
|
56
57
|
export async function listSocialProviders() {
|
|
57
58
|
try {
|
|
@@ -60,10 +61,11 @@ export async function listSocialProviders() {
|
|
|
60
61
|
providers.forEach(socialIdentityProvider => {
|
|
61
62
|
printMessage(`${socialIdentityProvider._id}`, 'data');
|
|
62
63
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
return true;
|
|
65
|
+
} catch (error) {
|
|
66
|
+
printError(error);
|
|
66
67
|
}
|
|
68
|
+
return false;
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
/**
|
|
@@ -71,6 +73,7 @@ export async function listSocialProviders() {
|
|
|
71
73
|
* @param {string} providerId provider id/name
|
|
72
74
|
* @param {string} file optional export file name
|
|
73
75
|
* @param {boolean} includeMeta true to include metadata, false otherwise. Default: true
|
|
76
|
+
* @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise
|
|
74
77
|
*/
|
|
75
78
|
export async function exportSocialIdentityProviderToFile(providerId, file = '', includeMeta = true) {
|
|
76
79
|
debugMessage(`cli.IdpOps.exportSocialIdentityProviderToFile: start`);
|
|
@@ -85,34 +88,45 @@ export async function exportSocialIdentityProviderToFile(providerId, file = '',
|
|
|
85
88
|
const fileData = await exportSocialIdentityProvider(providerId);
|
|
86
89
|
saveJsonToFile(fileData, filePath, includeMeta);
|
|
87
90
|
stopProgressIndicator(indicatorId, `Exported ${providerId['brightCyan']} to ${filePath['brightCyan']}.`);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
debugMessage(`cli.IdpOps.exportSocialIdentityProviderToFile: end`);
|
|
92
|
+
return true;
|
|
93
|
+
} catch (error) {
|
|
94
|
+
stopProgressIndicator(indicatorId, `${error}`);
|
|
95
|
+
printError(error);
|
|
91
96
|
}
|
|
92
|
-
|
|
97
|
+
return false;
|
|
93
98
|
}
|
|
94
99
|
|
|
95
100
|
/**
|
|
96
101
|
* Export all providers
|
|
97
102
|
* @param {string} file optional export file name
|
|
98
103
|
* @param {boolean} includeMeta true to include metadata, false otherwise. Default: true
|
|
104
|
+
* @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise
|
|
99
105
|
*/
|
|
100
106
|
export async function exportSocialIdentityProvidersToFile(file = '', includeMeta = true) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
try {
|
|
108
|
+
let fileName = file;
|
|
109
|
+
if (!fileName) {
|
|
110
|
+
fileName = getTypedFilename(`all${getRealmString()}Providers`, 'idp');
|
|
111
|
+
}
|
|
112
|
+
const fileData = await exportSocialIdentityProviders();
|
|
113
|
+
saveJsonToFile(fileData, getFilePath(fileName, true), includeMeta);
|
|
114
|
+
return true;
|
|
115
|
+
} catch (error) {
|
|
116
|
+
printError(error);
|
|
104
117
|
}
|
|
105
|
-
|
|
106
|
-
saveJsonToFile(fileData, getFilePath(fileName, true), includeMeta);
|
|
118
|
+
return false;
|
|
107
119
|
}
|
|
108
120
|
|
|
109
121
|
/**
|
|
110
122
|
* Export all providers to individual files
|
|
111
123
|
* @param {boolean} includeMeta true to include metadata, false otherwise. Default: true
|
|
124
|
+
* @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise
|
|
112
125
|
*/
|
|
113
126
|
export async function exportSocialIdentityProvidersToFiles(includeMeta = true) {
|
|
114
127
|
debugMessage(`cli.IdpOps.exportSocialIdentityProvidersToFiles: start`);
|
|
115
128
|
let indicatorId;
|
|
129
|
+
const errors = [];
|
|
116
130
|
try {
|
|
117
131
|
const allIdpsData = await readSocialIdentityProviders();
|
|
118
132
|
indicatorId = createProgressIndicator('determinate', allIdpsData.length, 'Exporting providers');
|
|
@@ -123,15 +137,20 @@ export async function exportSocialIdentityProvidersToFiles(includeMeta = true) {
|
|
|
123
137
|
saveJsonToFile(fileData, getFilePath(fileName, true), includeMeta);
|
|
124
138
|
updateProgressIndicator(indicatorId, `Exported provider ${idpData._id}`);
|
|
125
139
|
} catch (error) {
|
|
126
|
-
|
|
140
|
+
errors.push(error);
|
|
127
141
|
}
|
|
128
142
|
}
|
|
143
|
+
if (errors.length > 0) {
|
|
144
|
+
throw new FrodoError(`Error exporting dependencies`, errors);
|
|
145
|
+
}
|
|
129
146
|
stopProgressIndicator(indicatorId, `${allIdpsData.length} providers exported.`);
|
|
147
|
+
debugMessage(`cli.IdpOps.exportSocialIdentityProvidersToFiles: end`);
|
|
148
|
+
return true;
|
|
130
149
|
} catch (error) {
|
|
131
|
-
stopProgressIndicator(indicatorId,
|
|
132
|
-
|
|
150
|
+
stopProgressIndicator(indicatorId, `Error exporting providers`, 'fail');
|
|
151
|
+
printError(error);
|
|
133
152
|
}
|
|
134
|
-
|
|
153
|
+
return false;
|
|
135
154
|
}
|
|
136
155
|
|
|
137
156
|
/**
|
|
@@ -144,21 +163,19 @@ export async function exportSocialIdentityProvidersToFiles(includeMeta = true) {
|
|
|
144
163
|
export async function importSocialIdentityProviderFromFile(providerId, file, options = {
|
|
145
164
|
deps: true
|
|
146
165
|
}) {
|
|
147
|
-
let outcome = false;
|
|
148
166
|
const filePath = getFilePath(file);
|
|
149
167
|
const indicatorId = createProgressIndicator('indeterminate', 0, `Importing provider ${providerId} from ${filePath}...`);
|
|
150
168
|
try {
|
|
151
169
|
const data = fs.readFileSync(filePath, 'utf8');
|
|
152
170
|
const fileData = JSON.parse(data);
|
|
153
171
|
await importSocialIdentityProvider(providerId, fileData, options);
|
|
154
|
-
outcome = true;
|
|
155
172
|
stopProgressIndicator(indicatorId, `Successfully imported provider ${providerId} from ${filePath}.`, 'success');
|
|
173
|
+
return true;
|
|
156
174
|
} catch (error) {
|
|
157
|
-
var _error$response;
|
|
158
175
|
stopProgressIndicator(indicatorId, `Error importing provider ${providerId} from ${filePath}.`, 'fail');
|
|
159
|
-
|
|
176
|
+
printError(error);
|
|
160
177
|
}
|
|
161
|
-
return
|
|
178
|
+
return false;
|
|
162
179
|
}
|
|
163
180
|
|
|
164
181
|
/**
|
|
@@ -170,21 +187,19 @@ export async function importSocialIdentityProviderFromFile(providerId, file, opt
|
|
|
170
187
|
export async function importFirstSocialIdentityProviderFromFile(file, options = {
|
|
171
188
|
deps: true
|
|
172
189
|
}) {
|
|
173
|
-
let outcome = false;
|
|
174
190
|
const filePath = getFilePath(file);
|
|
175
191
|
const indicatorId = createProgressIndicator('indeterminate', 0, `Importing first provider from ${filePath}...`);
|
|
176
192
|
try {
|
|
177
193
|
const data = fs.readFileSync(filePath, 'utf8');
|
|
178
194
|
const fileData = JSON.parse(data);
|
|
179
195
|
await importFirstSocialIdentityProvider(fileData, options);
|
|
180
|
-
outcome = true;
|
|
181
196
|
stopProgressIndicator(indicatorId, `Successfully imported first provider from ${filePath}.`, 'success');
|
|
197
|
+
return true;
|
|
182
198
|
} catch (error) {
|
|
183
|
-
var _error$response2;
|
|
184
199
|
stopProgressIndicator(indicatorId, `Error importing first provider from ${filePath}.`, 'fail');
|
|
185
|
-
|
|
200
|
+
printError(error);
|
|
186
201
|
}
|
|
187
|
-
return
|
|
202
|
+
return false;
|
|
188
203
|
}
|
|
189
204
|
|
|
190
205
|
/**
|
|
@@ -196,42 +211,57 @@ export async function importFirstSocialIdentityProviderFromFile(file, options =
|
|
|
196
211
|
export async function importSocialIdentityProvidersFromFile(file, options = {
|
|
197
212
|
deps: true
|
|
198
213
|
}) {
|
|
199
|
-
let outcome = false;
|
|
200
214
|
const filePath = getFilePath(file);
|
|
201
215
|
const indicatorId = createProgressIndicator('indeterminate', 0, `Importing providers from ${filePath}...`);
|
|
202
|
-
const data = fs.readFileSync(filePath, 'utf8');
|
|
203
216
|
try {
|
|
217
|
+
const data = fs.readFileSync(filePath, 'utf8');
|
|
204
218
|
const fileData = JSON.parse(data);
|
|
205
219
|
await importSocialIdentityProviders(fileData, options);
|
|
206
|
-
outcome = true;
|
|
207
220
|
stopProgressIndicator(indicatorId, `Successfully imported providers from ${filePath}.`, 'success');
|
|
221
|
+
return true;
|
|
208
222
|
} catch (error) {
|
|
209
|
-
var _error$response3;
|
|
210
223
|
stopProgressIndicator(indicatorId, `Error importing providers from ${filePath}.`, 'fail');
|
|
211
|
-
|
|
224
|
+
printError(error);
|
|
212
225
|
}
|
|
213
|
-
return
|
|
226
|
+
return false;
|
|
214
227
|
}
|
|
215
228
|
|
|
216
229
|
/**
|
|
217
230
|
* Import providers from *.idp.json files in current working directory
|
|
218
231
|
* @param {SocialIdentityProviderImportOptions} options import options
|
|
232
|
+
* @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise
|
|
219
233
|
*/
|
|
220
234
|
export async function importSocialIdentityProvidersFromFiles(options = {
|
|
221
235
|
deps: true
|
|
222
236
|
}) {
|
|
223
|
-
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
237
|
+
let indicatorId;
|
|
238
|
+
const errors = [];
|
|
239
|
+
try {
|
|
240
|
+
const names = fs.readdirSync(getWorkingDirectory());
|
|
241
|
+
const jsonFiles = names.filter(name => name.toLowerCase().endsWith('.idp.json')).map(name => getFilePath(name));
|
|
242
|
+
indicatorId = createProgressIndicator('determinate', jsonFiles.length, 'Importing providers...');
|
|
243
|
+
let total = 0;
|
|
244
|
+
for (const file of jsonFiles) {
|
|
245
|
+
try {
|
|
246
|
+
const data = fs.readFileSync(file, 'utf8');
|
|
247
|
+
const fileData = JSON.parse(data);
|
|
248
|
+
const count = Object.keys(fileData.idp).length;
|
|
249
|
+
total += count;
|
|
250
|
+
await importSocialIdentityProviders(fileData, options);
|
|
251
|
+
updateProgressIndicator(indicatorId, `Imported ${count} provider(s) from ${file}`);
|
|
252
|
+
} catch (error) {
|
|
253
|
+
errors.push(error);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (errors.length > 0) {
|
|
257
|
+
throw new FrodoError(`Error importing providers`, errors);
|
|
258
|
+
}
|
|
259
|
+
stopProgressIndicator(indicatorId, `Finished importing ${total} provider(s) from ${jsonFiles.length} file(s).`);
|
|
260
|
+
return true;
|
|
261
|
+
} catch (error) {
|
|
262
|
+
stopProgressIndicator(indicatorId, `Error importing providers`, 'fail');
|
|
263
|
+
printError(error);
|
|
234
264
|
}
|
|
235
|
-
|
|
265
|
+
return false;
|
|
236
266
|
}
|
|
237
267
|
//# sourceMappingURL=IdpOps.js.map
|
package/esm/ops/IdpOps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdpOps.js","names":["frodo","fs","createProgressIndicator","debugMessage","printMessage","stopProgressIndicator","updateProgressIndicator","getRealmString","getTypedFilename","saveJsonToFile","utils","readSocialIdentityProviders","exportSocialIdentityProvider","exportSocialIdentityProviders","importFirstSocialIdentityProvider","importSocialIdentityProvider","importSocialIdentityProviders","oauth2oidc","external","getFilePath","getWorkingDirectory","getOneLineDescription","socialIdpObj","description","_id","_type","getTableHeaderMd","markdown","getTableRowMd","row","enabled","name","listSocialProviders","providers","sort","a","b","localeCompare","forEach","socialIdentityProvider","err","message","exportSocialIdentityProviderToFile","providerId","file","includeMeta","fileName","filePath","indicatorId","fileData","exportSocialIdentityProvidersToFile","exportSocialIdentityProvidersToFiles","allIdpsData","length","idpData","error","importSocialIdentityProviderFromFile","options","deps","outcome","data","readFileSync","JSON","parse","_error$response","response","importFirstSocialIdentityProviderFromFile","_error$response2","importSocialIdentityProvidersFromFile","_error$response3","importSocialIdentityProvidersFromFiles","names","readdirSync","jsonFiles","filter","toLowerCase","endsWith","map","total","count","Object","keys","idp"],"sources":["../../src/ops/IdpOps.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { SocialIdpSkeleton } from '@rockcarver/frodo-lib/types/api/SocialIdentityProvidersApi';\nimport { type SocialIdentityProviderImportOptions } from '@rockcarver/frodo-lib/types/ops/IdpOps';\nimport fs from 'fs';\n\nimport {\n createProgressIndicator,\n debugMessage,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\n\nconst { getRealmString, getTypedFilename, saveJsonToFile } = frodo.utils;\nconst {\n readSocialIdentityProviders,\n exportSocialIdentityProvider,\n exportSocialIdentityProviders,\n importFirstSocialIdentityProvider,\n importSocialIdentityProvider,\n importSocialIdentityProviders,\n} = frodo.oauth2oidc.external;\n\nconst { getFilePath, getWorkingDirectory } = frodo.utils;\n\n/**\n * Get a one-line description of the social idp object\n * @param {SocialIdpSkeleton} socialIdpObj social idp object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(socialIdpObj: SocialIdpSkeleton): string {\n const description = `[${socialIdpObj._id['brightCyan']}] ${socialIdpObj._type._id}`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Name/Id | Status | Type |\\n';\n markdown += '| ------- | ------ | ---- |';\n return markdown;\n}\n\n/**\n * Get a table-row of the social idp in markdown\n * @param {SocialIdpSkeleton} socialIdpObj social idp object to describe\n * @returns {string} a table-row of the social idp in markdown\n */\nexport function getTableRowMd(socialIdpObj: SocialIdpSkeleton): string {\n const row = `| ${socialIdpObj._id} | ${\n socialIdpObj.enabled === false\n ? ':o: `disabled`'\n : ':white_check_mark: `enabled`'\n } | ${socialIdpObj._type.name} |`;\n return row;\n}\n\n/**\n * List providers\n */\nexport async function listSocialProviders() {\n try {\n const providers = await readSocialIdentityProviders();\n providers.sort((a, b) => a._id.localeCompare(b._id));\n providers.forEach((socialIdentityProvider) => {\n printMessage(`${socialIdentityProvider._id}`, 'data');\n });\n } catch (err) {\n printMessage(`listSocialProviders ERROR: ${err.message}`, 'error');\n printMessage(err, 'error');\n }\n}\n\n/**\n * Export provider by id\n * @param {string} providerId provider id/name\n * @param {string} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportSocialIdentityProviderToFile(\n providerId: string,\n file = '',\n includeMeta = true\n) {\n debugMessage(`cli.IdpOps.exportSocialIdentityProviderToFile: start`);\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(providerId, 'idp');\n }\n const filePath = getFilePath(fileName, true);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting ${providerId}`\n );\n try {\n updateProgressIndicator(indicatorId, `Writing file ${filePath}`);\n const fileData = await exportSocialIdentityProvider(providerId);\n saveJsonToFile(fileData, filePath, includeMeta);\n stopProgressIndicator(\n indicatorId,\n `Exported ${providerId['brightCyan']} to ${filePath['brightCyan']}.`\n );\n } catch (err) {\n stopProgressIndicator(indicatorId, `${err}`);\n printMessage(`${err}`, 'error');\n }\n debugMessage(`cli.IdpOps.exportSocialIdentityProviderToFile: end`);\n}\n\n/**\n * Export all providers\n * @param {string} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportSocialIdentityProvidersToFile(\n file = '',\n includeMeta = true\n) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`all${getRealmString()}Providers`, 'idp');\n }\n const fileData = await exportSocialIdentityProviders();\n saveJsonToFile(fileData, getFilePath(fileName, true), includeMeta);\n}\n\n/**\n * Export all providers to individual files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportSocialIdentityProvidersToFiles(includeMeta = true) {\n debugMessage(`cli.IdpOps.exportSocialIdentityProvidersToFiles: start`);\n let indicatorId: string;\n try {\n const allIdpsData = await readSocialIdentityProviders();\n indicatorId = createProgressIndicator(\n 'determinate',\n allIdpsData.length,\n 'Exporting providers'\n );\n for (const idpData of allIdpsData) {\n try {\n const fileName = getTypedFilename(idpData._id, 'idp');\n const fileData = await exportSocialIdentityProvider(idpData._id);\n saveJsonToFile(fileData, getFilePath(fileName, true), includeMeta);\n updateProgressIndicator(\n indicatorId,\n `Exported provider ${idpData._id}`\n );\n } catch (error) {\n printMessage(`Error exporting ${idpData._id}: ${error}`, 'error');\n }\n }\n stopProgressIndicator(\n indicatorId,\n `${allIdpsData.length} providers exported.`\n );\n } catch (error) {\n stopProgressIndicator(indicatorId, `${error}`);\n printMessage(`${error}`, 'error');\n }\n debugMessage(`cli.IdpOps.exportSocialIdentityProvidersToFiles: end`);\n}\n\n/**\n * Import provider by id/name\n * @param {string} providerId provider id/name\n * @param {string} file import file name\n * @param {SocialIdentityProviderImportOptions} options import options\n * @returns {Promise<boolean>} true if provider was imported successfully, false otherwise\n */\nexport async function importSocialIdentityProviderFromFile(\n providerId: string,\n file: string,\n options: SocialIdentityProviderImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n const filePath = getFilePath(file);\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing provider ${providerId} from ${filePath}...`\n );\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const fileData = JSON.parse(data);\n await importSocialIdentityProvider(providerId, fileData, options);\n outcome = true;\n stopProgressIndicator(\n indicatorId,\n `Successfully imported provider ${providerId} from ${filePath}.`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing provider ${providerId} from ${filePath}.`,\n 'fail'\n );\n printMessage(error.response?.data || error, 'error');\n }\n return outcome;\n}\n\n/**\n * Import first provider from file\n * @param {String} file import file name\n * @param {SocialIdentityProviderImportOptions} options import options\n * @returns {Promise<boolean>} true if first provider was imported successfully, false otherwise\n */\nexport async function importFirstSocialIdentityProviderFromFile(\n file: string,\n options: SocialIdentityProviderImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n const filePath = getFilePath(file);\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing first provider from ${filePath}...`\n );\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const fileData = JSON.parse(data);\n await importFirstSocialIdentityProvider(fileData, options);\n outcome = true;\n stopProgressIndicator(\n indicatorId,\n `Successfully imported first provider from ${filePath}.`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing first provider from ${filePath}.`,\n 'fail'\n );\n printMessage(error.response?.data || error, 'error');\n }\n return outcome;\n}\n\n/**\n * Import all providers from file\n * @param {string} file import file name\n * @param {SocialIdentityProviderImportOptions} options import options\n * @returns {Promise<boolean>} true if all providers were imported successfully, false otherwise\n */\nexport async function importSocialIdentityProvidersFromFile(\n file: string,\n options: SocialIdentityProviderImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n const filePath = getFilePath(file);\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing providers from ${filePath}...`\n );\n const data = fs.readFileSync(filePath, 'utf8');\n try {\n const fileData = JSON.parse(data);\n await importSocialIdentityProviders(fileData, options);\n outcome = true;\n stopProgressIndicator(\n indicatorId,\n `Successfully imported providers from ${filePath}.`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing providers from ${filePath}.`,\n 'fail'\n );\n printMessage(error.response?.data || error, 'error');\n }\n return outcome;\n}\n\n/**\n * Import providers from *.idp.json files in current working directory\n * @param {SocialIdentityProviderImportOptions} options import options\n */\nexport async function importSocialIdentityProvidersFromFiles(\n options: SocialIdentityProviderImportOptions = { deps: true }\n) {\n const names = fs.readdirSync(getWorkingDirectory());\n const jsonFiles = names\n .filter((name) => name.toLowerCase().endsWith('.idp.json'))\n .map((name) => getFilePath(name));\n\n const indicatorId = createProgressIndicator(\n 'determinate',\n jsonFiles.length,\n 'Importing providers...'\n );\n let total = 0;\n for (const file of jsonFiles) {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n const count = Object.keys(fileData.idp).length;\n total += count;\n await importSocialIdentityProviders(fileData, options);\n updateProgressIndicator(\n indicatorId,\n `Imported ${count} provider(s) from ${file}`\n );\n }\n stopProgressIndicator(\n indicatorId,\n `Finished importing ${total} provider(s) from ${jsonFiles.length} file(s).`\n );\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAG7C,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,uBAAuB,EACvBC,YAAY,EACZC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AAEzB,MAAM;EAAEC,cAAc;EAAEC,gBAAgB;EAAEC;AAAe,CAAC,GAAGT,KAAK,CAACU,KAAK;AACxE,MAAM;EACJC,2BAA2B;EAC3BC,4BAA4B;EAC5BC,6BAA6B;EAC7BC,iCAAiC;EACjCC,4BAA4B;EAC5BC;AACF,CAAC,GAAGhB,KAAK,CAACiB,UAAU,CAACC,QAAQ;AAE7B,MAAM;EAAEC,WAAW;EAAEC;AAAoB,CAAC,GAAGpB,KAAK,CAACU,KAAK;;AAExD;AACA;AACA;AACA;AACA;AACA,OAAO,SAASW,qBAAqBA,CAACC,YAA+B,EAAU;EAC7E,MAAMC,WAAW,GAAI,IAAGD,YAAY,CAACE,GAAG,CAAC,YAAY,CAAE,KAAIF,YAAY,CAACG,KAAK,CAACD,GAAI,EAAC;EACnF,OAAOD,WAAW;AACpB;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASG,gBAAgBA,CAAA,EAAW;EACzC,IAAIC,QAAQ,GAAG,EAAE;EACjBA,QAAQ,IAAI,+BAA+B;EAC3CA,QAAQ,IAAI,6BAA6B;EACzC,OAAOA,QAAQ;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAACN,YAA+B,EAAU;EACrE,MAAMO,GAAG,GAAI,KAAIP,YAAY,CAACE,GAAI,MAChCF,YAAY,CAACQ,OAAO,KAAK,KAAK,GAC1B,gBAAgB,GAChB,8BACL,MAAKR,YAAY,CAACG,KAAK,CAACM,IAAK,IAAG;EACjC,OAAOF,GAAG;AACZ;;AAEA;AACA;AACA;AACA,O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,WAAW,CAAC,CAAC,CAC1DC,GAAG,CAAE9C,IAAI,IAAKZ,WAAW,CAACY,IAAI,CAAC,CAAC;EAEnC,MAAMiB,WAAW,GAAG9C,uBAAuB,CACzC,aAAa,EACbuE,SAAS,CAACpB,MAAM,EAChB,wBACF,CAAC;EACD,IAAIyB,KAAK,GAAG,CAAC;EACb,KAAK,MAAMlC,IAAI,IAAI6B,SAAS,EAAE;IAC5B,MAAMb,IAAI,GAAG3D,EAAE,CAAC4D,YAAY,CAACjB,IAAI,EAAE,MAAM,CAAC;IAC1C,MAAMK,QAAQ,GAAGa,IAAI,CAACC,KAAK,CAACH,IAAI,CAAC;IACjC,MAAMmB,KAAK,GAAGC,MAAM,CAACC,IAAI,CAAChC,QAAQ,CAACiC,GAAG,CAAC,CAAC7B,MAAM;IAC9CyB,KAAK,IAAIC,KAAK;IACd,MAAM/D,6BAA6B,CAACiC,QAAQ,EAAEQ,OAAO,CAAC;IACtDnD,uBAAuB,CACrB0C,WAAW,EACV,YAAW+B,KAAM,qBAAoBnC,IAAK,EAC7C,CAAC;EACH;EACAvC,qBAAqB,CACnB2C,WAAW,EACV,sBAAqB8B,KAAM,qBAAoBL,SAAS,CAACpB,MAAO,WACnE,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"IdpOps.js","names":["frodo","FrodoError","fs","createProgressIndicator","debugMessage","printError","printMessage","stopProgressIndicator","updateProgressIndicator","getRealmString","getTypedFilename","saveJsonToFile","utils","readSocialIdentityProviders","exportSocialIdentityProvider","exportSocialIdentityProviders","importFirstSocialIdentityProvider","importSocialIdentityProvider","importSocialIdentityProviders","oauth2oidc","external","getFilePath","getWorkingDirectory","getOneLineDescription","socialIdpObj","description","_id","_type","getTableHeaderMd","markdown","getTableRowMd","row","enabled","name","listSocialProviders","providers","sort","a","b","localeCompare","forEach","socialIdentityProvider","error","exportSocialIdentityProviderToFile","providerId","file","includeMeta","fileName","filePath","indicatorId","fileData","exportSocialIdentityProvidersToFile","exportSocialIdentityProvidersToFiles","errors","allIdpsData","length","idpData","push","importSocialIdentityProviderFromFile","options","deps","data","readFileSync","JSON","parse","importFirstSocialIdentityProviderFromFile","importSocialIdentityProvidersFromFile","importSocialIdentityProvidersFromFiles","names","readdirSync","jsonFiles","filter","toLowerCase","endsWith","map","total","count","Object","keys","idp"],"sources":["../../src/ops/IdpOps.ts"],"sourcesContent":["import { frodo, FrodoError } from '@rockcarver/frodo-lib';\nimport { SocialIdpSkeleton } from '@rockcarver/frodo-lib/types/api/SocialIdentityProvidersApi';\nimport { type SocialIdentityProviderImportOptions } from '@rockcarver/frodo-lib/types/ops/IdpOps';\nimport fs from 'fs';\n\nimport {\n createProgressIndicator,\n debugMessage,\n printError,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\n\nconst { getRealmString, getTypedFilename, saveJsonToFile } = frodo.utils;\nconst {\n readSocialIdentityProviders,\n exportSocialIdentityProvider,\n exportSocialIdentityProviders,\n importFirstSocialIdentityProvider,\n importSocialIdentityProvider,\n importSocialIdentityProviders,\n} = frodo.oauth2oidc.external;\n\nconst { getFilePath, getWorkingDirectory } = frodo.utils;\n\n/**\n * Get a one-line description of the social idp object\n * @param {SocialIdpSkeleton} socialIdpObj social idp object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(socialIdpObj: SocialIdpSkeleton): string {\n const description = `[${socialIdpObj._id['brightCyan']}] ${socialIdpObj._type._id}`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Name/Id | Status | Type |\\n';\n markdown += '| ------- | ------ | ---- |';\n return markdown;\n}\n\n/**\n * Get a table-row of the social idp in markdown\n * @param {SocialIdpSkeleton} socialIdpObj social idp object to describe\n * @returns {string} a table-row of the social idp in markdown\n */\nexport function getTableRowMd(socialIdpObj: SocialIdpSkeleton): string {\n const row = `| ${socialIdpObj._id} | ${\n socialIdpObj.enabled === false\n ? ':o: `disabled`'\n : ':white_check_mark: `enabled`'\n } | ${socialIdpObj._type.name} |`;\n return row;\n}\n\n/**\n * List providers\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function listSocialProviders(): Promise<boolean> {\n try {\n const providers = await readSocialIdentityProviders();\n providers.sort((a, b) => a._id.localeCompare(b._id));\n providers.forEach((socialIdentityProvider) => {\n printMessage(`${socialIdentityProvider._id}`, 'data');\n });\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Export provider by id\n * @param {string} providerId provider id/name\n * @param {string} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function exportSocialIdentityProviderToFile(\n providerId: string,\n file: string = '',\n includeMeta: boolean = true\n): Promise<boolean> {\n debugMessage(`cli.IdpOps.exportSocialIdentityProviderToFile: start`);\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(providerId, 'idp');\n }\n const filePath = getFilePath(fileName, true);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting ${providerId}`\n );\n try {\n updateProgressIndicator(indicatorId, `Writing file ${filePath}`);\n const fileData = await exportSocialIdentityProvider(providerId);\n saveJsonToFile(fileData, filePath, includeMeta);\n stopProgressIndicator(\n indicatorId,\n `Exported ${providerId['brightCyan']} to ${filePath['brightCyan']}.`\n );\n debugMessage(`cli.IdpOps.exportSocialIdentityProviderToFile: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(indicatorId, `${error}`);\n printError(error);\n }\n return false;\n}\n\n/**\n * Export all providers\n * @param {string} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function exportSocialIdentityProvidersToFile(\n file: string = '',\n includeMeta: boolean = true\n): Promise<boolean> {\n try {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`all${getRealmString()}Providers`, 'idp');\n }\n const fileData = await exportSocialIdentityProviders();\n saveJsonToFile(fileData, getFilePath(fileName, true), includeMeta);\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Export all providers to individual files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function exportSocialIdentityProvidersToFiles(\n includeMeta: boolean = true\n): Promise<boolean> {\n debugMessage(`cli.IdpOps.exportSocialIdentityProvidersToFiles: start`);\n let indicatorId: string;\n const errors: Error[] = [];\n try {\n const allIdpsData = await readSocialIdentityProviders();\n indicatorId = createProgressIndicator(\n 'determinate',\n allIdpsData.length,\n 'Exporting providers'\n );\n for (const idpData of allIdpsData) {\n try {\n const fileName = getTypedFilename(idpData._id, 'idp');\n const fileData = await exportSocialIdentityProvider(idpData._id);\n saveJsonToFile(fileData, getFilePath(fileName, true), includeMeta);\n updateProgressIndicator(\n indicatorId,\n `Exported provider ${idpData._id}`\n );\n } catch (error) {\n errors.push(error);\n }\n }\n if (errors.length > 0) {\n throw new FrodoError(`Error exporting dependencies`, errors);\n }\n stopProgressIndicator(\n indicatorId,\n `${allIdpsData.length} providers exported.`\n );\n debugMessage(`cli.IdpOps.exportSocialIdentityProvidersToFiles: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error exporting providers`, 'fail');\n printError(error);\n }\n return false;\n}\n\n/**\n * Import provider by id/name\n * @param {string} providerId provider id/name\n * @param {string} file import file name\n * @param {SocialIdentityProviderImportOptions} options import options\n * @returns {Promise<boolean>} true if provider was imported successfully, false otherwise\n */\nexport async function importSocialIdentityProviderFromFile(\n providerId: string,\n file: string,\n options: SocialIdentityProviderImportOptions = { deps: true }\n): Promise<boolean> {\n const filePath = getFilePath(file);\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing provider ${providerId} from ${filePath}...`\n );\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const fileData = JSON.parse(data);\n await importSocialIdentityProvider(providerId, fileData, options);\n stopProgressIndicator(\n indicatorId,\n `Successfully imported provider ${providerId} from ${filePath}.`,\n 'success'\n );\n return true;\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing provider ${providerId} from ${filePath}.`,\n 'fail'\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Import first provider from file\n * @param {String} file import file name\n * @param {SocialIdentityProviderImportOptions} options import options\n * @returns {Promise<boolean>} true if first provider was imported successfully, false otherwise\n */\nexport async function importFirstSocialIdentityProviderFromFile(\n file: string,\n options: SocialIdentityProviderImportOptions = { deps: true }\n): Promise<boolean> {\n const filePath = getFilePath(file);\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing first provider from ${filePath}...`\n );\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const fileData = JSON.parse(data);\n await importFirstSocialIdentityProvider(fileData, options);\n stopProgressIndicator(\n indicatorId,\n `Successfully imported first provider from ${filePath}.`,\n 'success'\n );\n return true;\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing first provider from ${filePath}.`,\n 'fail'\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Import all providers from file\n * @param {string} file import file name\n * @param {SocialIdentityProviderImportOptions} options import options\n * @returns {Promise<boolean>} true if all providers were imported successfully, false otherwise\n */\nexport async function importSocialIdentityProvidersFromFile(\n file: string,\n options: SocialIdentityProviderImportOptions = { deps: true }\n): Promise<boolean> {\n const filePath = getFilePath(file);\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing providers from ${filePath}...`\n );\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const fileData = JSON.parse(data);\n await importSocialIdentityProviders(fileData, options);\n stopProgressIndicator(\n indicatorId,\n `Successfully imported providers from ${filePath}.`,\n 'success'\n );\n return true;\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing providers from ${filePath}.`,\n 'fail'\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Import providers from *.idp.json files in current working directory\n * @param {SocialIdentityProviderImportOptions} options import options\n * @returns {Promise<boolean>} a promise resolving to true if successful, false otherwise\n */\nexport async function importSocialIdentityProvidersFromFiles(\n options: SocialIdentityProviderImportOptions = { deps: true }\n): Promise<boolean> {\n let indicatorId: string;\n const errors: Error[] = [];\n try {\n const names = fs.readdirSync(getWorkingDirectory());\n const jsonFiles = names\n .filter((name) => name.toLowerCase().endsWith('.idp.json'))\n .map((name) => getFilePath(name));\n\n indicatorId = createProgressIndicator(\n 'determinate',\n jsonFiles.length,\n 'Importing providers...'\n );\n let total = 0;\n for (const file of jsonFiles) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n const count = Object.keys(fileData.idp).length;\n total += count;\n await importSocialIdentityProviders(fileData, options);\n updateProgressIndicator(\n indicatorId,\n `Imported ${count} provider(s) from ${file}`\n );\n } catch (error) {\n errors.push(error);\n }\n }\n if (errors.length > 0) {\n throw new FrodoError(`Error importing providers`, errors);\n }\n stopProgressIndicator(\n indicatorId,\n `Finished importing ${total} provider(s) from ${jsonFiles.length} file(s).`\n );\n return true;\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error importing providers`, 'fail');\n printError(error);\n }\n return false;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,UAAU,QAAQ,uBAAuB;AAGzD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,uBAAuB,EACvBC,YAAY,EACZC,UAAU,EACVC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AAEzB,MAAM;EAAEC,cAAc;EAAEC,gBAAgB;EAAEC;AAAe,CAAC,GAAGX,KAAK,CAACY,KAAK;AACxE,MAAM;EACJC,2BAA2B;EAC3BC,4BAA4B;EAC5BC,6BAA6B;EAC7BC,iCAAiC;EACjCC,4BAA4B;EAC5BC;AACF,CAAC,GAAGlB,KAAK,CAACmB,UAAU,CAACC,QAAQ;AAE7B,MAAM;EAAEC,WAAW;EAA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