@rockcarver/frodo-cli 0.10.4 → 0.11.1-0
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/.github/README.md +44 -104
- package/.github/workflows/pipeline.yml +9 -1
- package/CHANGELOG.md +5 -1
- package/README.md +3 -3
- package/package.json +8 -8
- package/src/app.js +5 -4
- package/src/cli/_template/cmd-delete.js +9 -8
- package/src/cli/_template/cmd-describe.js +9 -8
- package/src/cli/_template/cmd-export.js +9 -8
- package/src/cli/_template/cmd-import.js +9 -8
- package/src/cli/_template/cmd-list.js +9 -8
- package/src/cli/_template/cmd-sub1-delete.js +9 -8
- package/src/cli/_template/cmd-sub1-describe.js +9 -8
- package/src/cli/_template/cmd-sub1-export.js +9 -8
- package/src/cli/_template/cmd-sub1-import.js +9 -8
- package/src/cli/_template/cmd-sub1-list.js +9 -8
- package/src/cli/_template/cmd-sub2-delete.js +9 -8
- package/src/cli/_template/cmd-sub2-describe.js +9 -8
- package/src/cli/_template/cmd-sub2-export.js +9 -8
- package/src/cli/_template/cmd-sub2-import.js +9 -8
- package/src/cli/_template/cmd-sub2-list.js +9 -8
- package/src/cli/admin/admin-add-autoid-static-user-mapping.js +12 -12
- package/src/cli/admin/admin-create-oauth2-client-with-admin-privileges.js +15 -18
- package/src/cli/admin/admin-get-access-token.js +12 -12
- package/src/cli/admin/admin-grant-oauth2-client-admin-privileges.js +13 -13
- package/src/cli/admin/admin-hide-generic-extension-attributes.js +13 -13
- package/src/cli/admin/admin-list-oauth2-clients-with-admin-privileges.js +13 -13
- package/src/cli/admin/admin-list-oauth2-clients-with-custom-privileges.js +14 -13
- package/src/cli/admin/admin-list-static-user-mappings.js +12 -12
- package/src/cli/admin/admin-remove-static-user-mapping.js +12 -12
- package/src/cli/admin/admin-repair-org-model.js +13 -13
- package/src/cli/admin/admin-revoke-oauth2-client-admin-privileges.js +13 -13
- package/src/cli/admin/admin-show-generic-extension-attributes.js +13 -13
- package/src/cli/app/app-delete.js +9 -8
- package/src/cli/app/app-describe.js +9 -8
- package/src/cli/app/app-export.js +15 -15
- package/src/cli/app/app-import.js +11 -11
- package/src/cli/app/app-list.js +11 -12
- package/src/cli/conn/conn-add.js +11 -11
- package/src/cli/conn/conn-delete.js +3 -1
- package/src/cli/conn/conn-describe.js +3 -1
- package/src/cli/conn/conn-list.js +3 -4
- package/src/cli/email/email-template-export.js +16 -16
- package/src/cli/email/email-template-import.js +16 -16
- package/src/cli/email/email-template-list.js +11 -11
- package/src/cli/esv/esv-apply.js +12 -12
- package/src/cli/esv/esv-secret-create.js +11 -11
- package/src/cli/esv/esv-secret-delete.js +13 -13
- package/src/cli/esv/esv-secret-describe.js +11 -11
- package/src/cli/esv/esv-secret-export.js +9 -8
- package/src/cli/esv/esv-secret-import.js +9 -8
- package/src/cli/esv/esv-secret-list.js +11 -11
- package/src/cli/esv/esv-secret-set.js +11 -11
- package/src/cli/esv/esv-secret-version-activate.js +12 -12
- package/src/cli/esv/esv-secret-version-create.js +11 -11
- package/src/cli/esv/esv-secret-version-deactivate.js +12 -12
- package/src/cli/esv/esv-secret-version-delete.js +13 -13
- package/src/cli/esv/esv-secret-version-list.js +11 -11
- package/src/cli/esv/esv-variable-create.js +11 -11
- package/src/cli/esv/esv-variable-delete.js +13 -16
- package/src/cli/esv/esv-variable-describe.js +11 -11
- package/src/cli/esv/esv-variable-export.js +9 -8
- package/src/cli/esv/esv-variable-import.js +9 -8
- package/src/cli/esv/esv-variable-list.js +11 -11
- package/src/cli/esv/esv-variable-set.js +13 -16
- package/src/cli/idm/idm-count.js +11 -11
- package/src/cli/idm/idm-export.js +16 -16
- package/src/cli/idm/idm-list.js +11 -11
- package/src/cli/idp/idp-export.js +15 -19
- package/src/cli/idp/idp-import.js +18 -18
- package/src/cli/idp/idp-list.js +12 -12
- package/src/cli/info/info.js +23 -19
- package/src/cli/journey/{journey-delete.e2e.test.js → journey-delete.e2e.test_.js} +0 -0
- package/src/cli/journey/journey-delete.js +14 -14
- package/src/cli/journey/journey-describe.js +26 -35
- package/src/cli/journey/journey-export.js +15 -18
- package/src/cli/journey/journey-import.js +17 -17
- package/src/cli/journey/{journey-list.e2e.test.js → journey-list.e2e.test_.js} +1 -0
- package/src/cli/journey/journey-list.js +12 -12
- package/src/cli/journey/journey-prune.js +12 -12
- package/src/cli/logging/logs-list.js +33 -28
- package/src/cli/logging/logs-tail.js +26 -22
- package/src/cli/realm/realm-add-custom-domain.js +13 -13
- package/src/cli/realm/realm-describe.js +14 -14
- package/src/cli/realm/realm-list.js +11 -11
- package/src/cli/realm/realm-remove-custom-domain.js +16 -13
- package/src/cli/saml/saml-cot-export.js +16 -16
- package/src/cli/saml/saml-cot-import.js +18 -18
- package/src/cli/saml/saml-cot-list.js +12 -12
- package/src/cli/saml/saml-describe.js +12 -12
- package/src/cli/saml/saml-export.js +16 -19
- package/src/cli/saml/saml-import.js +19 -18
- package/src/cli/saml/saml-list.js +12 -12
- package/src/cli/saml/saml-metadata-export.js +15 -19
- package/src/cli/script/script-delete.js +9 -8
- package/src/cli/script/script-describe.js +9 -8
- package/src/cli/script/script-export.js +18 -20
- package/src/cli/script/script-import.js +13 -12
- package/src/cli/script/script-list.js +12 -12
- package/src/cli/theme/{theme-delete.e2e.test.js → theme-delete.e2e.test_.js} +0 -0
- package/src/cli/theme/theme-delete.js +17 -21
- package/src/cli/theme/theme-export.js +19 -18
- package/src/cli/theme/theme-import.js +21 -20
- package/src/cli/theme/{theme-list.e2e.test.js → theme-list.e2e.test_.js} +0 -0
- package/src/cli/theme/theme-list.js +12 -12
- package/test/client_cli/en/conn-add.test.js +37 -0
- package/test/client_cli/en/conn-delete.test.js +37 -0
- package/test/client_cli/en/conn-list.test.js +37 -0
- package/test/client_cli/en/conn.test.js +65 -0
- package/test/client_cli/en/email-template-import.test.js +156 -0
- package/test/client_cli/en/email-template.test.js +79 -0
- package/test/client_cli/en/email-templates-export.test.js +208 -0
- package/test/client_cli/en/email-templates-list.test.js +139 -0
- package/test/client_cli/en/idm-count.test.js +131 -0
- package/test/client_cli/en/idm-export.test.js +149 -0
- package/test/client_cli/en/{idm_import.test_.js → idm-import.test_.js} +59 -61
- package/test/client_cli/en/idm-list.test.js +109 -0
- package/test/client_cli/en/idm.test.js +55 -84
- package/test/client_cli/en/info.test.js +85 -74
- package/test/client_cli/en/journey-describe.test.js +194 -0
- package/test/client_cli/en/journey-export.test.js +231 -0
- package/test/client_cli/en/journey-import.test.js +212 -0
- package/test/client_cli/en/journey-list.test.js +173 -0
- package/test/client_cli/en/{journey_prune.test.js → journey-prune.test.js} +102 -91
- package/test/client_cli/en/journey.test.js +76 -92
- package/test/client_cli/en/logs-list.test.js +81 -0
- package/test/client_cli/en/logs-tail.test.js +130 -0
- package/test/client_cli/en/logs.test.js +44 -58
- package/test/client_cli/en/root.test.js +61 -59
- package/test/client_cli/en/script-export.test.js +230 -0
- package/test/client_cli/en/script-import.test.js +176 -0
- package/test/client_cli/en/script-list.test.js +159 -0
- package/test/client_cli/en/script.test.js +52 -50
- package/test/client_cli/utils/utils.js +48 -17
- package/src/api/AuthenticateApi.js +0 -33
- package/src/api/BaseApi.js +0 -242
- package/src/api/CirclesOfTrustApi.js +0 -87
- package/src/api/EmailTemplateApi.js +0 -37
- package/src/api/IdmConfigApi.js +0 -88
- package/src/api/LogApi.js +0 -45
- package/src/api/ManagedObjectApi.js +0 -62
- package/src/api/OAuth2ClientApi.js +0 -69
- package/src/api/OAuth2OIDCApi.js +0 -73
- package/src/api/OAuth2ProviderApi.js +0 -32
- package/src/api/RealmApi.js +0 -99
- package/src/api/Saml2Api.js +0 -176
- package/src/api/ScriptApi.js +0 -84
- package/src/api/SecretsApi.js +0 -151
- package/src/api/ServerInfoApi.js +0 -41
- package/src/api/SocialIdentityProvidersApi.js +0 -114
- package/src/api/StartupApi.js +0 -45
- package/src/api/ThemeApi.js +0 -181
- package/src/api/TreeApi.js +0 -207
- package/src/api/VariablesApi.js +0 -104
- package/src/api/utils/ApiUtils.js +0 -77
- package/src/api/utils/Base64.js +0 -62
- package/src/ops/AdminOps.js +0 -901
- package/src/ops/AuthenticateOps.js +0 -342
- package/src/ops/CirclesOfTrustOps.js +0 -350
- package/src/ops/ConnectionProfileOps.js +0 -254
- package/src/ops/EmailTemplateOps.js +0 -326
- package/src/ops/IdmOps.js +0 -227
- package/src/ops/IdpOps.js +0 -342
- package/src/ops/JourneyOps.js +0 -2026
- package/src/ops/LogOps.js +0 -357
- package/src/ops/ManagedObjectOps.js +0 -34
- package/src/ops/OAuth2ClientOps.js +0 -151
- package/src/ops/OrganizationOps.js +0 -85
- package/src/ops/RealmOps.js +0 -139
- package/src/ops/SamlOps.js +0 -541
- package/src/ops/ScriptOps.js +0 -211
- package/src/ops/SecretsOps.js +0 -288
- package/src/ops/StartupOps.js +0 -114
- package/src/ops/ThemeOps.js +0 -379
- package/src/ops/VariablesOps.js +0 -185
- package/src/ops/templates/OAuth2ClientTemplate.json +0 -270
- package/src/ops/templates/OrgModelUserAttributesTemplate.json +0 -149
- package/src/ops/templates/cloud/GenericExtensionAttributesTemplate.json +0 -392
- package/src/ops/templates/cloud/managed.json +0 -4119
- package/src/ops/utils/Console.js +0 -434
- package/src/ops/utils/DataProtection.js +0 -92
- package/src/ops/utils/ExportImportUtils.js +0 -146
- package/src/ops/utils/OpsUtils.js +0 -76
- package/src/ops/utils/Wordwrap.js +0 -11
- package/src/storage/SessionStorage.js +0 -45
- package/test/client_cli/en/connections.test.js +0 -62
- package/test/client_cli/en/connections_add.test.js +0 -34
- package/test/client_cli/en/connections_delete.test.js +0 -34
- package/test/client_cli/en/connections_list.test.js +0 -34
- package/test/client_cli/en/email_templates.test.js +0 -77
- package/test/client_cli/en/email_templates_export.test.js +0 -196
- package/test/client_cli/en/email_templates_import.test.js +0 -145
- package/test/client_cli/en/email_templates_list.test.js +0 -130
- package/test/client_cli/en/idm_count.test.js +0 -121
- package/test/client_cli/en/idm_export.test.js +0 -136
- package/test/client_cli/en/idm_exportAll.test.js +0 -156
- package/test/client_cli/en/idm_exportAllRaw.test.js +0 -120
- package/test/client_cli/en/idm_importAll.test_.js +0 -103
- package/test/client_cli/en/idm_list.test.js +0 -103
- package/test/client_cli/en/journey_describe.test.js +0 -196
- package/test/client_cli/en/journey_export.test.js +0 -213
- package/test/client_cli/en/journey_import.test.js +0 -195
- package/test/client_cli/en/journey_importAll.test.js +0 -180
- package/test/client_cli/en/journey_list.test.js +0 -162
- package/test/client_cli/en/logs_list.test.js +0 -83
- package/test/client_cli/en/logs_tail.test.js +0 -118
- package/test/client_cli/en/script_export.test.js +0 -213
- package/test/client_cli/en/script_import.test.js +0 -163
- package/test/client_cli/en/script_list.test.js +0 -148
- package/test/e2e/setup.js +0 -98
- package/test/global/setup.js +0 -65
- package/test/lib_api/unit_tests/ApiUtils.test.js +0 -186
- package/test/lib_api/unit_tests/Base64URL.test.js +0 -22
- package/test/lib_api/unit_tests/DataProtection.test.js +0 -25
- package/test/lib_api/unit_tests/ExportImportUtils.test.js +0 -121
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
|
+
import { Authenticate, Script, state } from '@rockcarver/frodo-lib';
|
|
2
3
|
import * as common from '../cmd_common.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exportScriptsToFile,
|
|
9
|
-
exportScriptsToFiles,
|
|
10
|
-
} from '../../ops/ScriptOps.js';
|
|
4
|
+
|
|
5
|
+
const { getTokens } = Authenticate;
|
|
6
|
+
const { exportScriptByName } = Script;
|
|
7
|
+
const { exportScriptsToFile } = Script;
|
|
8
|
+
const { exportScriptsToFiles } = Script;
|
|
11
9
|
|
|
12
10
|
const program = new Command('frodo script export');
|
|
13
11
|
|
|
@@ -37,13 +35,13 @@ program
|
|
|
37
35
|
.addOption(
|
|
38
36
|
new Option(
|
|
39
37
|
'-a, --all',
|
|
40
|
-
'Export all
|
|
38
|
+
'Export all scripts to a single file. Ignored with -i.'
|
|
41
39
|
)
|
|
42
40
|
)
|
|
43
41
|
.addOption(
|
|
44
42
|
new Option(
|
|
45
43
|
'-A, --all-separate',
|
|
46
|
-
'Export all
|
|
44
|
+
'Export all scripts to separate files (*.script.json) in the current directory. Ignored with -i or -a.'
|
|
47
45
|
)
|
|
48
46
|
)
|
|
49
47
|
// deprecated option
|
|
@@ -56,16 +54,16 @@ program
|
|
|
56
54
|
.action(
|
|
57
55
|
// implement command logic inside action handler
|
|
58
56
|
async (host, realm, user, password, options) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
state.default.session.setTenant(host);
|
|
58
|
+
state.default.session.setRealm(realm);
|
|
59
|
+
state.default.session.setUsername(user);
|
|
60
|
+
state.default.session.setPassword(password);
|
|
61
|
+
state.default.session.setDeploymentType(options.type);
|
|
62
|
+
state.default.session.setAllowInsecureConnection(options.insecure);
|
|
65
63
|
if (await getTokens()) {
|
|
66
64
|
// export by name
|
|
67
65
|
if (options.scriptName || options.script) {
|
|
68
|
-
|
|
66
|
+
console.log('Exporting script...');
|
|
69
67
|
exportScriptByName(
|
|
70
68
|
options.scriptName || options.script,
|
|
71
69
|
options.file
|
|
@@ -73,17 +71,17 @@ program
|
|
|
73
71
|
}
|
|
74
72
|
// -a / --all
|
|
75
73
|
else if (options.all) {
|
|
76
|
-
|
|
74
|
+
console.log('Exporting all scripts to a single file...');
|
|
77
75
|
exportScriptsToFile(options.file);
|
|
78
76
|
}
|
|
79
77
|
// -A / --all-separate
|
|
80
78
|
else if (options.allSeparate) {
|
|
81
|
-
|
|
79
|
+
console.log('Exporting all scripts to separate files...');
|
|
82
80
|
exportScriptsToFiles();
|
|
83
81
|
}
|
|
84
82
|
// unrecognized combination of options or no options
|
|
85
83
|
else {
|
|
86
|
-
|
|
84
|
+
console.log(
|
|
87
85
|
'Unrecognized combination of options or no options...',
|
|
88
86
|
'error'
|
|
89
87
|
);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
|
+
import { Authenticate, Script, state } from '@rockcarver/frodo-lib';
|
|
2
3
|
import * as common from '../cmd_common.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
|
|
5
|
+
const { getTokens } = Authenticate;
|
|
6
|
+
|
|
7
|
+
const { importScriptsFromFile } = Script;
|
|
7
8
|
|
|
8
9
|
const program = new Command('frodo script import');
|
|
9
10
|
|
|
@@ -40,15 +41,15 @@ program
|
|
|
40
41
|
.action(
|
|
41
42
|
// implement command logic inside action handler
|
|
42
43
|
async (host, realm, user, password, options) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
state.default.session.setTenant(host);
|
|
45
|
+
state.default.session.setRealm(realm);
|
|
46
|
+
state.default.session.setUsername(user);
|
|
47
|
+
state.default.session.setPassword(password);
|
|
48
|
+
state.default.session.setDeploymentType(options.type);
|
|
49
|
+
state.default.session.setAllowInsecureConnection(options.insecure);
|
|
49
50
|
if (await getTokens()) {
|
|
50
|
-
|
|
51
|
-
`Importing script(s) into realm "${
|
|
51
|
+
console.log(
|
|
52
|
+
`Importing script(s) into realm "${state.default.session.getRealm()}"...`
|
|
52
53
|
);
|
|
53
54
|
importScriptsFromFile(
|
|
54
55
|
options.scriptName || options.script,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
|
+
import { Authenticate, Script, state } from '@rockcarver/frodo-lib';
|
|
2
3
|
import * as common from '../cmd_common.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { listScripts } from '../../ops/ScriptOps.js';
|
|
4
|
+
|
|
5
|
+
const { getTokens } = Authenticate;
|
|
6
|
+
const { listScripts } = Script;
|
|
7
7
|
|
|
8
8
|
const program = new Command('frodo script list');
|
|
9
9
|
|
|
@@ -23,15 +23,15 @@ program
|
|
|
23
23
|
.action(
|
|
24
24
|
// implement command logic inside action handler
|
|
25
25
|
async (host, realm, user, password, options) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
state.default.session.setTenant(host);
|
|
27
|
+
state.default.session.setRealm(realm);
|
|
28
|
+
state.default.session.setUsername(user);
|
|
29
|
+
state.default.session.setPassword(password);
|
|
30
|
+
state.default.session.setDeploymentType(options.type);
|
|
31
|
+
state.default.session.setAllowInsecureConnection(options.insecure);
|
|
32
32
|
if (await getTokens()) {
|
|
33
|
-
|
|
34
|
-
`Listing scripts in realm "${
|
|
33
|
+
console.log(
|
|
34
|
+
`Listing scripts in realm "${state.default.session.getRealm()}"...`
|
|
35
35
|
);
|
|
36
36
|
await listScripts(options.long);
|
|
37
37
|
}
|
|
File without changes
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
|
+
import { Authenticate, Theme, state } from '@rockcarver/frodo-lib';
|
|
2
3
|
import * as common from '../cmd_common.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
deleteThemeByNameCmd,
|
|
8
|
-
deleteThemeCmd,
|
|
9
|
-
deleteThemesCmd,
|
|
10
|
-
} from '../../ops/ThemeOps.js';
|
|
4
|
+
|
|
5
|
+
const { getTokens } = Authenticate;
|
|
6
|
+
const { deleteThemeByNameCmd, deleteThemeCmd, deleteThemesCmd } = Theme;
|
|
11
7
|
|
|
12
8
|
const program = new Command('frodo theme delete');
|
|
13
9
|
|
|
@@ -42,41 +38,41 @@ program
|
|
|
42
38
|
.action(
|
|
43
39
|
// implement command logic inside action handler
|
|
44
40
|
async (host, realm, user, password, options) => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
state.default.session.setTenant(host);
|
|
42
|
+
state.default.session.setRealm(realm);
|
|
43
|
+
state.default.session.setUsername(user);
|
|
44
|
+
state.default.session.setPassword(password);
|
|
45
|
+
state.default.session.setDeploymentType(options.type);
|
|
46
|
+
state.default.session.setAllowInsecureConnection(options.insecure);
|
|
51
47
|
if (await getTokens()) {
|
|
52
48
|
// delete by name
|
|
53
49
|
if (options.themeName) {
|
|
54
|
-
|
|
50
|
+
console.log(
|
|
55
51
|
`Deleting theme with name "${
|
|
56
52
|
options.themeName
|
|
57
|
-
}" from realm "${
|
|
53
|
+
}" from realm "${state.default.session.getRealm()}"...`
|
|
58
54
|
);
|
|
59
55
|
deleteThemeByNameCmd(options.themeName, options.file);
|
|
60
56
|
}
|
|
61
57
|
// delete by id
|
|
62
58
|
else if (options.themeId) {
|
|
63
|
-
|
|
59
|
+
console.log(
|
|
64
60
|
`Deleting theme with id "${
|
|
65
61
|
options.themeId
|
|
66
|
-
}" from realm "${
|
|
62
|
+
}" from realm "${state.default.session.getRealm()}"...`
|
|
67
63
|
);
|
|
68
64
|
deleteThemeCmd(options.themeId, options.file);
|
|
69
65
|
}
|
|
70
66
|
// --all -a
|
|
71
67
|
else if (options.all) {
|
|
72
|
-
|
|
73
|
-
`Deleting all themes from realm "${
|
|
68
|
+
console.log(
|
|
69
|
+
`Deleting all themes from realm "${state.default.session.getRealm()}"...`
|
|
74
70
|
);
|
|
75
71
|
deleteThemesCmd(options.file);
|
|
76
72
|
}
|
|
77
73
|
// unrecognized combination of options or no options
|
|
78
74
|
else {
|
|
79
|
-
|
|
75
|
+
console.log('Unrecognized combination of options or no options...');
|
|
80
76
|
program.help();
|
|
81
77
|
}
|
|
82
78
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
|
+
import { Authenticate, Theme, state } from '@rockcarver/frodo-lib';
|
|
2
3
|
import * as common from '../cmd_common.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
|
|
5
|
+
const { getTokens } = Authenticate;
|
|
6
|
+
|
|
7
|
+
const {
|
|
7
8
|
exportThemeById,
|
|
8
9
|
exportThemeByName,
|
|
9
10
|
exportThemesToFile,
|
|
10
11
|
exportThemesToFiles,
|
|
11
|
-
}
|
|
12
|
+
} = Theme;
|
|
12
13
|
|
|
13
14
|
const program = new Command('frodo theme export');
|
|
14
15
|
|
|
@@ -55,44 +56,44 @@ program
|
|
|
55
56
|
.action(
|
|
56
57
|
// implement command logic inside action handler
|
|
57
58
|
async (host, realm, user, password, options) => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
state.default.session.setTenant(host);
|
|
60
|
+
state.default.session.setRealm(realm);
|
|
61
|
+
state.default.session.setUsername(user);
|
|
62
|
+
state.default.session.setPassword(password);
|
|
63
|
+
state.default.session.setDeploymentType(options.type);
|
|
64
|
+
state.default.session.setAllowInsecureConnection(options.insecure);
|
|
64
65
|
if (await getTokens()) {
|
|
65
66
|
// export by name
|
|
66
67
|
if (options.themeName) {
|
|
67
|
-
|
|
68
|
+
console.log(
|
|
68
69
|
`Exporting theme "${
|
|
69
70
|
options.themeName
|
|
70
|
-
}" from realm "${
|
|
71
|
+
}" from realm "${state.default.session.getRealm()}"...`
|
|
71
72
|
);
|
|
72
73
|
exportThemeByName(options.themeName, options.file);
|
|
73
74
|
}
|
|
74
75
|
// export by id
|
|
75
76
|
else if (options.themeId) {
|
|
76
|
-
|
|
77
|
+
console.log(
|
|
77
78
|
`Exporting theme "${
|
|
78
79
|
options.themeId
|
|
79
|
-
}" from realm "${
|
|
80
|
+
}" from realm "${state.default.session.getRealm()}"...`
|
|
80
81
|
);
|
|
81
82
|
exportThemeById(options.themeId, options.file);
|
|
82
83
|
}
|
|
83
84
|
// --all -a
|
|
84
85
|
else if (options.all) {
|
|
85
|
-
|
|
86
|
+
console.log('Exporting all themes to a single file...');
|
|
86
87
|
exportThemesToFile(options.file);
|
|
87
88
|
}
|
|
88
89
|
// --all-separate -A
|
|
89
90
|
else if (options.allSeparate) {
|
|
90
|
-
|
|
91
|
+
console.log('Exporting all themes to separate files...');
|
|
91
92
|
exportThemesToFiles();
|
|
92
93
|
}
|
|
93
94
|
// unrecognized combination of options or no options
|
|
94
95
|
else {
|
|
95
|
-
|
|
96
|
+
console.log(
|
|
96
97
|
'Unrecognized combination of options or no options...',
|
|
97
98
|
'error'
|
|
98
99
|
);
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
|
+
import { Authenticate, Theme, state } from '@rockcarver/frodo-lib';
|
|
2
3
|
import * as common from '../cmd_common.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
|
|
5
|
+
const { getTokens } = Authenticate;
|
|
6
|
+
|
|
7
|
+
const {
|
|
7
8
|
importFirstThemeFromFile,
|
|
8
9
|
importThemeById,
|
|
9
10
|
importThemeByName,
|
|
10
11
|
importThemesFromFile,
|
|
11
12
|
importThemesFromFiles,
|
|
12
|
-
}
|
|
13
|
+
} = Theme;
|
|
13
14
|
|
|
14
15
|
const program = new Command('frodo theme import');
|
|
15
16
|
|
|
@@ -56,57 +57,57 @@ program
|
|
|
56
57
|
.action(
|
|
57
58
|
// implement command logic inside action handler
|
|
58
59
|
async (host, realm, user, password, options) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
state.default.session.setTenant(host);
|
|
61
|
+
state.default.session.setRealm(realm);
|
|
62
|
+
state.default.session.setUsername(user);
|
|
63
|
+
state.default.session.setPassword(password);
|
|
64
|
+
state.default.session.setDeploymentType(options.type);
|
|
65
|
+
state.default.session.setAllowInsecureConnection(options.insecure);
|
|
65
66
|
if (await getTokens()) {
|
|
66
67
|
// import by name
|
|
67
68
|
if (options.file && options.themeName) {
|
|
68
|
-
|
|
69
|
+
console.log(
|
|
69
70
|
`Importing theme with name "${
|
|
70
71
|
options.themeName
|
|
71
|
-
}" into realm "${
|
|
72
|
+
}" into realm "${state.default.session.getRealm()}"...`
|
|
72
73
|
);
|
|
73
74
|
importThemeByName(options.themeName, options.file);
|
|
74
75
|
}
|
|
75
76
|
// import by id
|
|
76
77
|
else if (options.file && options.themeId) {
|
|
77
|
-
|
|
78
|
+
console.log(
|
|
78
79
|
`Importing theme with id "${
|
|
79
80
|
options.themeId
|
|
80
|
-
}" into realm "${
|
|
81
|
+
}" into realm "${state.default.session.getRealm()}"...`
|
|
81
82
|
);
|
|
82
83
|
importThemeById(options.themeId, options.file);
|
|
83
84
|
}
|
|
84
85
|
// --all -a
|
|
85
86
|
else if (options.all && options.file) {
|
|
86
|
-
|
|
87
|
+
console.log(
|
|
87
88
|
`Importing all themes from a single file (${options.file})...`
|
|
88
89
|
);
|
|
89
90
|
importThemesFromFile(options.file);
|
|
90
91
|
}
|
|
91
92
|
// --all-separate -A
|
|
92
93
|
else if (options.allSeparate && !options.file) {
|
|
93
|
-
|
|
94
|
+
console.log(
|
|
94
95
|
'Importing all themes from separate files in current directory...'
|
|
95
96
|
);
|
|
96
97
|
importThemesFromFiles();
|
|
97
98
|
}
|
|
98
99
|
// import single theme from file
|
|
99
100
|
else if (options.file) {
|
|
100
|
-
|
|
101
|
+
console.log(
|
|
101
102
|
`Importing first theme from file "${
|
|
102
103
|
options.file
|
|
103
|
-
}" into realm "${
|
|
104
|
+
}" into realm "${state.default.session.getRealm()}"...`
|
|
104
105
|
);
|
|
105
106
|
importFirstThemeFromFile(options.file);
|
|
106
107
|
}
|
|
107
108
|
// unrecognized combination of options or no options
|
|
108
109
|
else {
|
|
109
|
-
|
|
110
|
+
console.log('Unrecognized combination of options or no options...');
|
|
110
111
|
program.help();
|
|
111
112
|
}
|
|
112
113
|
}
|
|
File without changes
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
|
+
import { Authenticate, Theme, state } from '@rockcarver/frodo-lib';
|
|
2
3
|
import * as common from '../cmd_common.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { listThemes } from '../../ops/ThemeOps.js';
|
|
4
|
+
|
|
5
|
+
const { getTokens } = Authenticate;
|
|
6
|
+
const { listThemes } = Theme;
|
|
7
7
|
|
|
8
8
|
const program = new Command('frodo theme list');
|
|
9
9
|
|
|
@@ -23,15 +23,15 @@ program
|
|
|
23
23
|
.action(
|
|
24
24
|
// implement command logic inside action handler
|
|
25
25
|
async (host, realm, user, password, options) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
state.default.session.setTenant(host);
|
|
27
|
+
state.default.session.setRealm(realm);
|
|
28
|
+
state.default.session.setUsername(user);
|
|
29
|
+
state.default.session.setPassword(password);
|
|
30
|
+
state.default.session.setDeploymentType(options.type);
|
|
31
|
+
state.default.session.setAllowInsecureConnection(options.insecure);
|
|
32
32
|
if (await getTokens()) {
|
|
33
|
-
|
|
34
|
-
`Listing themes in realm "${
|
|
33
|
+
console.log(
|
|
34
|
+
`Listing themes in realm "${state.default.session.getRealm()}"...`
|
|
35
35
|
);
|
|
36
36
|
listThemes(options.long);
|
|
37
37
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import cp from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import { node14Compatibility } from '../utils/utils.js';
|
|
4
|
+
|
|
5
|
+
node14Compatibility();
|
|
6
|
+
|
|
7
|
+
const exec = promisify(cp.exec);
|
|
8
|
+
const CMD = 'frodo connections add --help';
|
|
9
|
+
const { stdout } = await exec(CMD);
|
|
10
|
+
|
|
11
|
+
test("CLI help interface for 'add' Usage should be expected english", async () => {
|
|
12
|
+
// Arrange
|
|
13
|
+
const expected = `
|
|
14
|
+
Usage: frodo conn add [options] <host> [user] [password] [key] [secret]
|
|
15
|
+
`.trim();
|
|
16
|
+
// Act
|
|
17
|
+
const testLine = stdout
|
|
18
|
+
.split(/\n/)
|
|
19
|
+
.find((line) => line.trim().startsWith('Usage:'))
|
|
20
|
+
.trim();
|
|
21
|
+
// Assert
|
|
22
|
+
expect(testLine).toBe(expected);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("CLI help interface 'connections add' description at line 2 should be expected english", async () => {
|
|
26
|
+
// Arrange
|
|
27
|
+
const expected = `
|
|
28
|
+
Add a new connection profiles. You have to specify a URL, username and password at a minimum.
|
|
29
|
+
`.trim();
|
|
30
|
+
// Act
|
|
31
|
+
const testLine = stdout
|
|
32
|
+
.split(/\n/)
|
|
33
|
+
.map((line) => line.trim())
|
|
34
|
+
.at(2);
|
|
35
|
+
// Assert
|
|
36
|
+
expect(testLine).toBe(expected);
|
|
37
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import cp from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import { node14Compatibility } from '../utils/utils.js';
|
|
4
|
+
|
|
5
|
+
node14Compatibility();
|
|
6
|
+
|
|
7
|
+
const exec = promisify(cp.exec);
|
|
8
|
+
const CMD = 'frodo connections delete --help';
|
|
9
|
+
const { stdout } = await exec(CMD);
|
|
10
|
+
|
|
11
|
+
test("CLI help interface for 'delete' Usage should be expected english", async () => {
|
|
12
|
+
// Arrange
|
|
13
|
+
const expected = `
|
|
14
|
+
Usage: frodo conn delete [options] <host>
|
|
15
|
+
`.trim();
|
|
16
|
+
// Act
|
|
17
|
+
const testLine = stdout
|
|
18
|
+
.split(/\n/)
|
|
19
|
+
.find((line) => line.trim().startsWith('Usage:'))
|
|
20
|
+
.trim();
|
|
21
|
+
// Assert
|
|
22
|
+
expect(testLine).toBe(expected);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("CLI help interface 'conn delete' description at line 2 should be expected english", async () => {
|
|
26
|
+
// Arrange
|
|
27
|
+
const expected = `
|
|
28
|
+
Delete connection profiles.
|
|
29
|
+
`.trim();
|
|
30
|
+
// Act
|
|
31
|
+
const testLine = stdout
|
|
32
|
+
.split(/\n/)
|
|
33
|
+
.map((line) => line.trim())
|
|
34
|
+
.at(2);
|
|
35
|
+
// Assert
|
|
36
|
+
expect(testLine).toBe(expected);
|
|
37
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import cp from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import { node14Compatibility } from '../utils/utils.js';
|
|
4
|
+
|
|
5
|
+
node14Compatibility();
|
|
6
|
+
|
|
7
|
+
const exec = promisify(cp.exec);
|
|
8
|
+
const CMD = 'frodo connections list --help';
|
|
9
|
+
const { stdout } = await exec(CMD);
|
|
10
|
+
|
|
11
|
+
test("CLI help interface for 'list' Usage should be expected english", async () => {
|
|
12
|
+
// Arrange
|
|
13
|
+
const expected = `
|
|
14
|
+
Usage: frodo conn list [options]
|
|
15
|
+
`.trim();
|
|
16
|
+
// Act
|
|
17
|
+
const testLine = stdout
|
|
18
|
+
.split(/\n/)
|
|
19
|
+
.find((line) => line.trim().startsWith('Usage:'))
|
|
20
|
+
.trim();
|
|
21
|
+
// Assert
|
|
22
|
+
expect(testLine).toBe(expected);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("CLI help interface 'connections List' description at line 2 should be expected english", async () => {
|
|
26
|
+
// Arrange
|
|
27
|
+
const expected = `
|
|
28
|
+
List connection profiles.
|
|
29
|
+
`.trim();
|
|
30
|
+
// Act
|
|
31
|
+
const testLine = stdout
|
|
32
|
+
.split(/\n/)
|
|
33
|
+
.map((line) => line.trim())
|
|
34
|
+
.at(2);
|
|
35
|
+
// Assert
|
|
36
|
+
expect(testLine).toBe(expected);
|
|
37
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import cp from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import { node14Compatibility } from '../utils/utils.js';
|
|
4
|
+
|
|
5
|
+
node14Compatibility();
|
|
6
|
+
|
|
7
|
+
const exec = promisify(cp.exec);
|
|
8
|
+
const CMD = 'frodo connections --help';
|
|
9
|
+
const { stdout } = await exec(CMD);
|
|
10
|
+
|
|
11
|
+
test("CLI help interface for 'connections' Usage should be expected english", async () => {
|
|
12
|
+
// Arrange
|
|
13
|
+
const expected = `
|
|
14
|
+
Usage: frodo conn|connection [options] [command]
|
|
15
|
+
`.trim();
|
|
16
|
+
// Act
|
|
17
|
+
const testLine = stdout
|
|
18
|
+
.split(/\n/)
|
|
19
|
+
.find((line) => line.trim().startsWith('Usage:'))
|
|
20
|
+
.trim();
|
|
21
|
+
// Assert
|
|
22
|
+
expect(testLine).toBe(expected);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('CLI help interface connections description at line 2 should be expected english', async () => {
|
|
26
|
+
// Arrange
|
|
27
|
+
const expected = `
|
|
28
|
+
Manage connection profiles.
|
|
29
|
+
`.trim();
|
|
30
|
+
// Act
|
|
31
|
+
const testLine = stdout
|
|
32
|
+
.split(/\n/)
|
|
33
|
+
.map((line) => line.trim())
|
|
34
|
+
.at(2);
|
|
35
|
+
// Assert
|
|
36
|
+
expect(testLine).toBe(expected);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test("CLI help interface 'list' description should be expected english", async () => {
|
|
40
|
+
// Arrange
|
|
41
|
+
const expected = `
|
|
42
|
+
list List connection profiles.
|
|
43
|
+
`.trim();
|
|
44
|
+
// Act
|
|
45
|
+
const testLine = stdout
|
|
46
|
+
.split(/\n/)
|
|
47
|
+
.find((line) => line.trim().startsWith('list'))
|
|
48
|
+
.trim();
|
|
49
|
+
// Assert
|
|
50
|
+
expect(testLine).toBe(expected);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test("CLI help interface 'delete' description should be expected english", async () => {
|
|
54
|
+
// Arrange
|
|
55
|
+
const expected = `
|
|
56
|
+
delete Delete connection profiles.
|
|
57
|
+
`.trim();
|
|
58
|
+
// Act
|
|
59
|
+
const testLine = stdout
|
|
60
|
+
.split(/\n/)
|
|
61
|
+
.find((line) => line.trim().startsWith('delete'))
|
|
62
|
+
.trim();
|
|
63
|
+
// Assert
|
|
64
|
+
expect(testLine).toBe(expected);
|
|
65
|
+
});
|