@rockcarver/frodo-cli 0.18.2-9 → 0.19.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/CHANGELOG.md +112 -1
- package/esm/app.js +4 -1
- package/esm/app.js.map +1 -1
- package/esm/cli/FrodoCommand.js +133 -0
- package/esm/cli/FrodoCommand.js.map +1 -0
- package/esm/cli/_template/something-delete.js +9 -15
- package/esm/cli/_template/something-delete.js.map +1 -1
- package/esm/cli/_template/something-describe.js +9 -15
- package/esm/cli/_template/something-describe.js.map +1 -1
- package/esm/cli/_template/something-else-delete.js +9 -15
- package/esm/cli/_template/something-else-delete.js.map +1 -1
- package/esm/cli/_template/something-else-describe.js +9 -15
- package/esm/cli/_template/something-else-describe.js.map +1 -1
- package/esm/cli/_template/something-else-export.js +9 -15
- package/esm/cli/_template/something-else-export.js.map +1 -1
- package/esm/cli/_template/something-else-import.js +9 -15
- package/esm/cli/_template/something-else-import.js.map +1 -1
- package/esm/cli/_template/something-else-list.js +9 -15
- package/esm/cli/_template/something-else-list.js.map +1 -1
- package/esm/cli/_template/something-else.js +8 -8
- package/esm/cli/_template/something-else.js.map +1 -1
- package/esm/cli/_template/something-export.js +9 -15
- package/esm/cli/_template/something-export.js.map +1 -1
- package/esm/cli/_template/something-import.js +9 -15
- package/esm/cli/_template/something-import.js.map +1 -1
- package/esm/cli/_template/something-list.js +9 -15
- package/esm/cli/_template/something-list.js.map +1 -1
- package/esm/cli/_template/something-other-delete.js +9 -15
- package/esm/cli/_template/something-other-delete.js.map +1 -1
- package/esm/cli/_template/something-other-describe.js +9 -15
- package/esm/cli/_template/something-other-describe.js.map +1 -1
- package/esm/cli/_template/something-other-export.js +9 -15
- package/esm/cli/_template/something-other-export.js.map +1 -1
- package/esm/cli/_template/something-other-import.js +9 -15
- package/esm/cli/_template/something-other-import.js.map +1 -1
- package/esm/cli/_template/something-other-list.js +9 -15
- package/esm/cli/_template/something-other-list.js.map +1 -1
- package/esm/cli/_template/something-other.js +8 -8
- package/esm/cli/_template/something-other.js.map +1 -1
- package/esm/cli/_template/something.js +9 -10
- package/esm/cli/_template/something.js.map +1 -1
- package/esm/cli/admin/admin-add-autoid-static-user-mapping.js +8 -15
- 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 +9 -15
- package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-get-access-token.js +9 -15
- package/esm/cli/admin/admin-get-access-token.js.map +1 -1
- package/esm/cli/admin/admin-grant-oauth2-client-admin-privileges.js +9 -15
- package/esm/cli/admin/admin-grant-oauth2-client-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-hide-generic-extension-attributes.js +9 -15
- 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 +8 -15
- 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 +8 -15
- 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 +9 -15
- package/esm/cli/admin/admin-list-static-user-mappings.js.map +1 -1
- package/esm/cli/admin/admin-remove-static-user-mapping.js +8 -15
- package/esm/cli/admin/admin-remove-static-user-mapping.js.map +1 -1
- package/esm/cli/admin/admin-repair-org-model.js +9 -15
- package/esm/cli/admin/admin-repair-org-model.js.map +1 -1
- package/esm/cli/admin/admin-revoke-oauth2-client-admin-privileges.js +9 -15
- package/esm/cli/admin/admin-revoke-oauth2-client-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-show-generic-extension-attributes.js +9 -15
- package/esm/cli/admin/admin-show-generic-extension-attributes.js.map +1 -1
- package/esm/cli/admin/admin.js +14 -15
- package/esm/cli/admin/admin.js.map +1 -1
- package/esm/cli/agent/agent-delete.js +8 -15
- package/esm/cli/agent/agent-delete.js.map +1 -1
- package/esm/cli/agent/agent-describe.js +9 -15
- package/esm/cli/agent/agent-describe.js.map +1 -1
- package/esm/cli/agent/agent-export.js +8 -15
- package/esm/cli/agent/agent-export.js.map +1 -1
- package/esm/cli/agent/agent-gateway-delete.js +8 -15
- package/esm/cli/agent/agent-gateway-delete.js.map +1 -1
- package/esm/cli/agent/agent-gateway-describe.js +9 -15
- package/esm/cli/agent/agent-gateway-describe.js.map +1 -1
- package/esm/cli/agent/agent-gateway-export.js +8 -15
- package/esm/cli/agent/agent-gateway-export.js.map +1 -1
- package/esm/cli/agent/agent-gateway-import.js +8 -15
- package/esm/cli/agent/agent-gateway-import.js.map +1 -1
- package/esm/cli/agent/agent-gateway-list.js +9 -15
- package/esm/cli/agent/agent-gateway-list.js.map +1 -1
- package/esm/cli/agent/agent-gateway.js +8 -8
- package/esm/cli/agent/agent-gateway.js.map +1 -1
- package/esm/cli/agent/agent-import.js +8 -15
- package/esm/cli/agent/agent-import.js.map +1 -1
- package/esm/cli/agent/agent-java-delete.js +8 -15
- package/esm/cli/agent/agent-java-delete.js.map +1 -1
- package/esm/cli/agent/agent-java-describe.js +9 -15
- package/esm/cli/agent/agent-java-describe.js.map +1 -1
- package/esm/cli/agent/agent-java-export.js +8 -15
- package/esm/cli/agent/agent-java-export.js.map +1 -1
- package/esm/cli/agent/agent-java-import.js +8 -15
- package/esm/cli/agent/agent-java-import.js.map +1 -1
- package/esm/cli/agent/agent-java-list.js +9 -15
- package/esm/cli/agent/agent-java-list.js.map +1 -1
- package/esm/cli/agent/agent-java.js +8 -8
- package/esm/cli/agent/agent-java.js.map +1 -1
- package/esm/cli/agent/agent-list.js +9 -15
- package/esm/cli/agent/agent-list.js.map +1 -1
- package/esm/cli/agent/agent-web-delete.js +8 -15
- package/esm/cli/agent/agent-web-delete.js.map +1 -1
- package/esm/cli/agent/agent-web-describe.js +9 -15
- package/esm/cli/agent/agent-web-describe.js.map +1 -1
- package/esm/cli/agent/agent-web-export.js +8 -15
- package/esm/cli/agent/agent-web-export.js.map +1 -1
- package/esm/cli/agent/agent-web-import.js +8 -15
- package/esm/cli/agent/agent-web-import.js.map +1 -1
- package/esm/cli/agent/agent-web-list.js +9 -15
- package/esm/cli/agent/agent-web-list.js.map +1 -1
- package/esm/cli/agent/agent-web.js +8 -8
- package/esm/cli/agent/agent-web.js.map +1 -1
- package/esm/cli/agent/agent.js +10 -11
- package/esm/cli/agent/agent.js.map +1 -1
- package/esm/cli/app/app-delete.js +9 -12
- package/esm/cli/app/app-delete.js.map +1 -1
- package/esm/cli/app/app-describe.js +9 -12
- package/esm/cli/app/app-describe.js.map +1 -1
- package/esm/cli/app/app-export.js +28 -34
- package/esm/cli/app/app-export.js.map +1 -1
- package/esm/cli/app/app-import.js +11 -14
- package/esm/cli/app/app-import.js.map +1 -1
- package/esm/cli/app/app-list.js +11 -14
- package/esm/cli/app/app-list.js.map +1 -1
- package/esm/cli/app/app.js +8 -10
- package/esm/cli/app/app.js.map +1 -1
- package/esm/cli/conn/conn-delete.js +5 -5
- package/esm/cli/conn/conn-delete.js.map +1 -1
- package/esm/cli/conn/conn-describe.js +6 -5
- package/esm/cli/conn/conn-describe.js.map +1 -1
- package/esm/cli/conn/conn-list.js +6 -8
- package/esm/cli/conn/conn-list.js.map +1 -1
- package/esm/cli/conn/conn-save.js +72 -0
- package/esm/cli/conn/conn-save.js.map +1 -0
- package/esm/cli/conn/conn.js +10 -8
- package/esm/cli/conn/conn.js.map +1 -1
- package/esm/cli/email/email-template-export.js +27 -33
- package/esm/cli/email/email-template-export.js.map +1 -1
- package/esm/cli/email/email-template-import.js +33 -39
- package/esm/cli/email/email-template-import.js.map +1 -1
- package/esm/cli/email/email-template-list.js +11 -14
- package/esm/cli/email/email-template-list.js.map +1 -1
- package/esm/cli/email/email-template.js +6 -6
- package/esm/cli/email/email-template.js.map +1 -1
- package/esm/cli/email/email.js +2 -2
- package/esm/cli/email/email.js.map +1 -1
- package/esm/cli/esv/esv-apply.js +9 -12
- package/esm/cli/esv/esv-apply.js.map +1 -1
- package/esm/cli/esv/esv-secret-create.js +11 -14
- package/esm/cli/esv/esv-secret-create.js.map +1 -1
- package/esm/cli/esv/esv-secret-delete.js +23 -29
- package/esm/cli/esv/esv-secret-delete.js.map +1 -1
- package/esm/cli/esv/esv-secret-describe.js +11 -14
- package/esm/cli/esv/esv-secret-describe.js.map +1 -1
- package/esm/cli/esv/esv-secret-export.js +9 -12
- package/esm/cli/esv/esv-secret-export.js.map +1 -1
- package/esm/cli/esv/esv-secret-import.js +9 -12
- package/esm/cli/esv/esv-secret-import.js.map +1 -1
- package/esm/cli/esv/esv-secret-list.js +11 -14
- package/esm/cli/esv/esv-secret-list.js.map +1 -1
- package/esm/cli/esv/esv-secret-set.js +11 -14
- package/esm/cli/esv/esv-secret-set.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-activate.js +18 -24
- package/esm/cli/esv/esv-secret-version-activate.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-create.js +11 -14
- package/esm/cli/esv/esv-secret-version-create.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-deactivate.js +18 -24
- package/esm/cli/esv/esv-secret-version-deactivate.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-delete.js +23 -29
- package/esm/cli/esv/esv-secret-version-delete.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-list.js +11 -14
- package/esm/cli/esv/esv-secret-version-list.js.map +1 -1
- package/esm/cli/esv/esv-secret-version.js +8 -8
- package/esm/cli/esv/esv-secret-version.js.map +1 -1
- package/esm/cli/esv/esv-secret.js +11 -11
- package/esm/cli/esv/esv-secret.js.map +1 -1
- package/esm/cli/esv/esv-variable-create.js +10 -14
- package/esm/cli/esv/esv-variable-create.js.map +1 -1
- package/esm/cli/esv/esv-variable-delete.js +23 -29
- package/esm/cli/esv/esv-variable-delete.js.map +1 -1
- package/esm/cli/esv/esv-variable-describe.js +11 -14
- package/esm/cli/esv/esv-variable-describe.js.map +1 -1
- package/esm/cli/esv/esv-variable-export.js +9 -12
- package/esm/cli/esv/esv-variable-export.js.map +1 -1
- package/esm/cli/esv/esv-variable-import.js +9 -12
- package/esm/cli/esv/esv-variable-import.js.map +1 -1
- package/esm/cli/esv/esv-variable-list.js +11 -14
- package/esm/cli/esv/esv-variable-list.js.map +1 -1
- package/esm/cli/esv/esv-variable-set.js +19 -26
- package/esm/cli/esv/esv-variable-set.js.map +1 -1
- package/esm/cli/esv/esv-variable.js +10 -10
- package/esm/cli/esv/esv-variable.js.map +1 -1
- package/esm/cli/esv/esv.js +5 -6
- package/esm/cli/esv/esv.js.map +1 -1
- package/esm/cli/idm/idm-count.js +12 -17
- package/esm/cli/idm/idm-count.js.map +1 -1
- package/esm/cli/idm/idm-export.js +29 -39
- package/esm/cli/idm/idm-export.js.map +1 -1
- package/esm/cli/idm/idm-import.js +29 -39
- package/esm/cli/idm/idm-import.js.map +1 -1
- package/esm/cli/idm/idm-list.js +11 -17
- package/esm/cli/idm/idm-list.js.map +1 -1
- package/esm/cli/idm/idm.js +6 -9
- package/esm/cli/idm/idm.js.map +1 -1
- package/esm/cli/idp/idp-export.js +11 -15
- package/esm/cli/idp/idp-export.js.map +1 -1
- package/esm/cli/idp/idp-import.js +32 -38
- package/esm/cli/idp/idp-import.js.map +1 -1
- package/esm/cli/idp/idp-list.js +9 -13
- package/esm/cli/idp/idp-list.js.map +1 -1
- package/esm/cli/idp/idp.js +5 -6
- package/esm/cli/idp/idp.js.map +1 -1
- package/esm/cli/info/info.js +19 -20
- package/esm/cli/info/info.js.map +1 -1
- package/esm/cli/journey/journey-delete.js +22 -28
- package/esm/cli/journey/journey-delete.js.map +1 -1
- package/esm/cli/journey/journey-describe.js +12 -19
- package/esm/cli/journey/journey-describe.js.map +1 -1
- package/esm/cli/journey/journey-disable.js +20 -26
- package/esm/cli/journey/journey-disable.js.map +1 -1
- package/esm/cli/journey/journey-enable.js +20 -26
- package/esm/cli/journey/journey-enable.js.map +1 -1
- package/esm/cli/journey/journey-export.js +37 -45
- package/esm/cli/journey/journey-export.js.map +1 -1
- package/esm/cli/journey/journey-import.js +44 -52
- package/esm/cli/journey/journey-import.js.map +1 -1
- package/esm/cli/journey/journey-list.js +10 -13
- package/esm/cli/journey/journey-list.js.map +1 -1
- package/esm/cli/journey/journey-prune.js +9 -13
- package/esm/cli/journey/journey-prune.js.map +1 -1
- package/esm/cli/journey/journey.js +10 -11
- package/esm/cli/journey/journey.js.map +1 -1
- package/esm/cli/logging/logs-fetch.js +17 -19
- package/esm/cli/logging/logs-fetch.js.map +1 -1
- package/esm/cli/logging/logs-list.js +19 -25
- package/esm/cli/logging/logs-list.js.map +1 -1
- package/esm/cli/logging/logs-tail.js +17 -19
- package/esm/cli/logging/logs-tail.js.map +1 -1
- package/esm/cli/logging/logs.js +7 -6
- package/esm/cli/logging/logs.js.map +1 -1
- package/esm/cli/realm/realm-add-custom-domain.js +11 -14
- package/esm/cli/realm/realm-add-custom-domain.js.map +1 -1
- package/esm/cli/realm/realm-describe.js +10 -14
- package/esm/cli/realm/realm-describe.js.map +1 -1
- package/esm/cli/realm/realm-list.js +11 -14
- package/esm/cli/realm/realm-list.js.map +1 -1
- package/esm/cli/realm/realm-remove-custom-domain.js +11 -14
- package/esm/cli/realm/realm-remove-custom-domain.js.map +1 -1
- package/esm/cli/realm/realm.js +7 -8
- package/esm/cli/realm/realm.js.map +1 -1
- package/esm/cli/saml/saml-cot-export.js +27 -36
- package/esm/cli/saml/saml-cot-export.js.map +1 -1
- package/esm/cli/saml/saml-cot-import.js +32 -41
- package/esm/cli/saml/saml-cot-import.js.map +1 -1
- package/esm/cli/saml/saml-cot-list.js +10 -16
- package/esm/cli/saml/saml-cot-list.js.map +1 -1
- package/esm/cli/saml/saml-cot.js +6 -6
- package/esm/cli/saml/saml-cot.js.map +1 -1
- package/esm/cli/saml/saml-delete.js +8 -15
- package/esm/cli/saml/saml-delete.js.map +1 -1
- package/esm/cli/saml/saml-describe.js +10 -16
- package/esm/cli/saml/saml-describe.js.map +1 -1
- package/esm/cli/saml/saml-export.js +9 -16
- package/esm/cli/saml/saml-export.js.map +1 -1
- package/esm/cli/saml/saml-import.js +45 -54
- package/esm/cli/saml/saml-import.js.map +1 -1
- package/esm/cli/saml/saml-list.js +11 -17
- package/esm/cli/saml/saml-list.js.map +1 -1
- package/esm/cli/saml/saml-metadata-export.js +21 -30
- package/esm/cli/saml/saml-metadata-export.js.map +1 -1
- package/esm/cli/saml/saml-metadata.js +4 -4
- package/esm/cli/saml/saml-metadata.js.map +1 -1
- package/esm/cli/saml/saml.js +9 -10
- package/esm/cli/saml/saml.js.map +1 -1
- package/esm/cli/script/script-delete.js +9 -12
- package/esm/cli/script/script-delete.js.map +1 -1
- package/esm/cli/script/script-describe.js +9 -12
- package/esm/cli/script/script-describe.js.map +1 -1
- package/esm/cli/script/script-export.js +28 -34
- package/esm/cli/script/script-export.js.map +1 -1
- package/esm/cli/script/script-import.js +10 -13
- package/esm/cli/script/script-import.js.map +1 -1
- package/esm/cli/script/script-list.js +10 -13
- package/esm/cli/script/script-list.js.map +1 -1
- package/esm/cli/script/script.js +7 -8
- package/esm/cli/script/script.js.map +1 -1
- package/esm/cli/service/service-delete.js +10 -16
- package/esm/cli/service/service-delete.js.map +1 -1
- package/esm/cli/service/service-export.js +12 -17
- package/esm/cli/service/service-export.js.map +1 -1
- package/esm/cli/service/service-import.js +12 -18
- package/esm/cli/service/service-import.js.map +1 -1
- package/esm/cli/service/service-list.js +9 -15
- package/esm/cli/service/service-list.js.map +1 -1
- package/esm/cli/service/service.js +6 -7
- package/esm/cli/service/service.js.map +1 -1
- package/esm/cli/theme/theme-delete.js +12 -19
- package/esm/cli/theme/theme-delete.js.map +1 -1
- package/esm/cli/theme/theme-export.js +12 -19
- package/esm/cli/theme/theme-export.js.map +1 -1
- package/esm/cli/theme/theme-import.js +14 -21
- package/esm/cli/theme/theme-import.js.map +1 -1
- package/esm/cli/theme/theme-list.js +10 -16
- package/esm/cli/theme/theme-list.js.map +1 -1
- package/esm/cli/theme/theme.js +6 -7
- package/esm/cli/theme/theme.js.map +1 -1
- package/esm/ops/ConnectionProfileOps.js +30 -0
- package/esm/ops/ConnectionProfileOps.js.map +1 -0
- package/esm/ops/IdmOps.js +317 -0
- package/esm/ops/IdmOps.js.map +1 -0
- package/esm/ops/JourneyOps.js +2 -1
- package/esm/ops/JourneyOps.js.map +1 -1
- package/esm/ops/ServiceOps.js +20 -20
- package/esm/ops/ServiceOps.js.map +1 -1
- package/esm/utils/Console.js +15 -25
- package/esm/utils/Console.js.map +1 -1
- package/package.json +6 -6
- package/esm/cli/cmd_common.js +0 -79
- package/esm/cli/cmd_common.js.map +0 -1
- package/esm/cli/conn/conn-add.js +0 -37
- package/esm/cli/conn/conn-add.js.map +0 -1
- package/esm/cli/journey/journey-delete.e2e.test_.js.map +0 -1
- package/esm/cli/journey/journey-list.e2e.test_.js.map +0 -1
package/esm/cli/idp/idp-list.js
CHANGED
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FrodoCommand } from '../FrodoCommand';
|
|
2
2
|
import { Authenticate, Idp, state } from '@rockcarver/frodo-lib';
|
|
3
|
-
import
|
|
4
|
-
import { printMessage } from '../../utils/Console';
|
|
3
|
+
import { verboseMessage } from '../../utils/Console';
|
|
5
4
|
const {
|
|
6
5
|
getTokens
|
|
7
6
|
} = Authenticate;
|
|
8
7
|
const {
|
|
9
8
|
listSocialProviders
|
|
10
9
|
} = Idp;
|
|
11
|
-
const program = new
|
|
12
|
-
program.description('List (social) identity providers.')
|
|
10
|
+
const program = new FrodoCommand('frodo idp list');
|
|
11
|
+
program.description('List (social) identity providers.')
|
|
13
12
|
// .addOption(
|
|
14
13
|
// new Option('-l, --long', 'Long with all fields.').default(false, 'false')
|
|
15
14
|
// )
|
|
16
15
|
.action(
|
|
17
16
|
// implement command logic inside action handler
|
|
18
|
-
async (host, realm, user, password, options) => {
|
|
19
|
-
|
|
20
|
-
state.default.session.setRealm(realm);
|
|
21
|
-
state.default.session.setUsername(user);
|
|
22
|
-
state.default.session.setPassword(password);
|
|
23
|
-
state.default.session.setDeploymentType(options.type);
|
|
24
|
-
state.default.session.setAllowInsecureConnection(options.insecure);
|
|
17
|
+
async (host, realm, user, password, options, command) => {
|
|
18
|
+
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
25
19
|
if (await getTokens()) {
|
|
26
|
-
|
|
20
|
+
verboseMessage(`Listing providers in realm "${state.getRealm()}"...`);
|
|
27
21
|
listSocialProviders();
|
|
22
|
+
} else {
|
|
23
|
+
process.exitCode = 1;
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
26
|
// end command logic inside action handler
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idp-list.js","names":["
|
|
1
|
+
{"version":3,"file":"idp-list.js","names":["FrodoCommand","Authenticate","Idp","state","verboseMessage","getTokens","listSocialProviders","program","description","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","getRealm","process","exitCode","parse"],"sources":["cli/idp/idp-list.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Authenticate, Idp, state } from '@rockcarver/frodo-lib';\nimport { verboseMessage } from '../../utils/Console';\n\nconst { getTokens } = Authenticate;\nconst { listSocialProviders } = Idp;\n\nconst program = new FrodoCommand('frodo idp list');\n\nprogram\n .description('List (social) identity providers.')\n // .addOption(\n // new Option('-l, --long', 'Long with all fields.').default(false, 'false')\n // )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n verboseMessage(`Listing providers in realm \"${state.getRealm()}\"...`);\n listSocialProviders();\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,YAAY,EAAEC,GAAG,EAAEC,KAAK,QAAQ,uBAAuB;AAChE,SAASC,cAAc,QAAQ,qBAAqB;AAEpD,MAAM;EAAEC;AAAU,CAAC,GAAGJ,YAAY;AAClC,MAAM;EAAEK;AAAoB,CAAC,GAAGJ,GAAG;AAEnC,MAAMK,OAAO,GAAG,IAAIP,YAAY,CAAC,gBAAgB,CAAC;AAElDO,OAAO,CACJC,WAAW,CAAC,mCAAmC;AAChD;AACA;AACA;AAAA,CACCC,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OAAO,CACR;EACD,IAAI,MAAMV,SAAS,EAAE,EAAE;IACrBD,cAAc,CAAE,+BAA8BD,KAAK,CAACc,QAAQ,EAAG,MAAK,CAAC;IACrEX,mBAAmB,EAAE;EACvB,CAAC,MAAM;IACLY,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHZ,OAAO,CAACa,KAAK,EAAE"}
|
package/esm/cli/idp/idp.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FrodoStubCommand } from '../FrodoCommand';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
5
5
|
export default function setup() {
|
|
6
|
-
const program = new
|
|
7
|
-
program.command('list', 'List identity providers.')
|
|
8
|
-
program.command('export', 'Export identity providers.')
|
|
9
|
-
program.command('import', 'Import identity providers.')
|
|
10
|
-
program.showHelpAfterError();
|
|
6
|
+
const program = new FrodoStubCommand('idp').description('Manage (social) identity providers.').executableDir(__dirname);
|
|
7
|
+
program.command('list', 'List identity providers.');
|
|
8
|
+
program.command('export', 'Export identity providers.');
|
|
9
|
+
program.command('import', 'Import identity providers.');
|
|
11
10
|
return program;
|
|
12
11
|
}
|
|
13
12
|
//# sourceMappingURL=idp.js.map
|
package/esm/cli/idp/idp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idp.js","names":["
|
|
1
|
+
{"version":3,"file":"idp.js","names":["FrodoStubCommand","path","fileURLToPath","__dirname","dirname","import","meta","url","setup","program","description","executableDir","command"],"sources":["cli/idp/idp.ts"],"sourcesContent":["import { FrodoStubCommand } from '../FrodoCommand';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport default function setup() {\n const program = new FrodoStubCommand('idp')\n .description('Manage (social) identity providers.')\n .executableDir(__dirname);\n\n program.command('list', 'List identity providers.');\n\n program.command('export', 'Export identity providers.');\n\n program.command('import', 'Import identity providers.');\n\n return program;\n}\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,iBAAiB;AAClD,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AAEnC,MAAMC,SAAS,GAAGF,IAAI,CAACG,OAAO,CAACF,aAAa,CAACG,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AAE9D,eAAe,SAASC,KAAK,GAAG;EAC9B,MAAMC,OAAO,GAAG,IAAIT,gBAAgB,CAAC,KAAK,CAAC,CACxCU,WAAW,CAAC,qCAAqC,CAAC,CAClDC,aAAa,CAACR,SAAS,CAAC;EAE3BM,OAAO,CAACG,OAAO,CAAC,MAAM,EAAE,0BAA0B,CAAC;EAEnDH,OAAO,CAACG,OAAO,CAAC,QAAQ,EAAE,4BAA4B,CAAC;EAEvDH,OAAO,CAACG,OAAO,CAAC,QAAQ,EAAE,4BAA4B,CAAC;EAEvD,OAAOH,OAAO;AAChB"}
|
package/esm/cli/info/info.js
CHANGED
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FrodoCommand } from '../FrodoCommand';
|
|
2
|
+
import { Option } from 'commander';
|
|
2
3
|
import { Authenticate, state } from '@rockcarver/frodo-lib';
|
|
3
|
-
import
|
|
4
|
-
import { printMessage } from '../../utils/Console';
|
|
4
|
+
import { printMessage, verboseMessage } from '../../utils/Console';
|
|
5
5
|
const {
|
|
6
6
|
getTokens
|
|
7
7
|
} = Authenticate;
|
|
8
8
|
export default function setup() {
|
|
9
|
-
const info = new
|
|
10
|
-
info.
|
|
11
|
-
|
|
12
|
-
state.default.session.setUsername(user);
|
|
13
|
-
state.default.session.setPassword(password);
|
|
14
|
-
state.default.session.setDeploymentType(options.type);
|
|
15
|
-
state.default.session.setAllowInsecureConnection(options.insecure);
|
|
16
|
-
state.default.session.setItem('scriptFriendly', options.scriptFriendly);
|
|
9
|
+
const info = new FrodoCommand('info', ['realm']);
|
|
10
|
+
info.description('Print versions and tokens.').addOption(new Option('-s, --scriptFriendly', 'Send output of operation to STDOUT in a script-friendly format (JSON) which can be piped to other commands. User messages/warnings are output to STDERR, and are not piped. For example, to only get bearer token: \n<<< frodo info my-tenant -s 2>/dev/null | jq -r .bearerToken >>>').default(false, 'Output as plain text')).action(async (host, user, password, options, command) => {
|
|
11
|
+
command.handleDefaultArgsAndOpts(host, user, password, options, command);
|
|
17
12
|
if (!options.scriptFriendly) {
|
|
18
|
-
|
|
13
|
+
verboseMessage('Printing versions and tokens...');
|
|
19
14
|
if (await getTokens()) {
|
|
20
|
-
printMessage(`Cookie name: ${state.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
printMessage(`Cookie name: ${state.getCookieName()}`);
|
|
16
|
+
if (state.getCookieValue()) {
|
|
17
|
+
printMessage(`Session token: ${state.getCookieValue()}`);
|
|
18
|
+
}
|
|
19
|
+
if (state.getBearerToken()) {
|
|
20
|
+
printMessage(`Bearer token: ${state.getBearerToken()}`);
|
|
24
21
|
}
|
|
25
22
|
} else {
|
|
26
23
|
process.exitCode = 1;
|
|
27
24
|
}
|
|
28
25
|
} else if (await getTokens()) {
|
|
29
26
|
const output = {
|
|
30
|
-
cookieName: state.
|
|
31
|
-
sessionToken: state.default.session.getCookieValue()
|
|
27
|
+
cookieName: state.getCookieName()
|
|
32
28
|
};
|
|
33
|
-
if (state.
|
|
34
|
-
output['
|
|
29
|
+
if (state.getCookieValue()) {
|
|
30
|
+
output['sessionToken'] = state.getCookieValue();
|
|
31
|
+
}
|
|
32
|
+
if (state.getBearerToken()) {
|
|
33
|
+
output['bearerToken'] = state.getBearerToken();
|
|
35
34
|
}
|
|
36
35
|
printMessage(JSON.stringify(output, null, 2), 'data');
|
|
37
36
|
} else {
|
package/esm/cli/info/info.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info.js","names":["
|
|
1
|
+
{"version":3,"file":"info.js","names":["FrodoCommand","Option","Authenticate","state","printMessage","verboseMessage","getTokens","setup","info","description","addOption","default","action","host","user","password","options","command","handleDefaultArgsAndOpts","scriptFriendly","getCookieName","getCookieValue","getBearerToken","process","exitCode","output","cookieName","JSON","stringify","showHelpAfterError"],"sources":["cli/info/info.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate, state } from '@rockcarver/frodo-lib';\nimport { printMessage, verboseMessage } from '../../utils/Console';\n\nconst { getTokens } = Authenticate;\n\nexport default function setup() {\n const info = new FrodoCommand('info', ['realm']);\n info\n .description('Print versions and tokens.')\n .addOption(\n new Option(\n '-s, --scriptFriendly',\n 'Send output of operation to STDOUT in a script-friendly format (JSON) which can be piped to other commands. User messages/warnings are output to STDERR, and are not piped. For example, to only get bearer token: \\n<<< frodo info my-tenant -s 2>/dev/null | jq -r .bearerToken >>>'\n ).default(false, 'Output as plain text')\n )\n .action(async (host, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(host, user, password, options, command);\n if (!options.scriptFriendly) {\n verboseMessage('Printing versions and tokens...');\n if (await getTokens()) {\n printMessage(`Cookie name: ${state.getCookieName()}`);\n if (state.getCookieValue()) {\n printMessage(`Session token: ${state.getCookieValue()}`);\n }\n if (state.getBearerToken()) {\n printMessage(`Bearer token: ${state.getBearerToken()}`);\n }\n } else {\n process.exitCode = 1;\n }\n } else if (await getTokens()) {\n const output = {\n cookieName: state.getCookieName(),\n };\n if (state.getCookieValue()) {\n output['sessionToken'] = state.getCookieValue();\n }\n if (state.getBearerToken()) {\n output['bearerToken'] = state.getBearerToken();\n }\n printMessage(JSON.stringify(output, null, 2), 'data');\n } else {\n process.exitCode = 1;\n }\n });\n info.showHelpAfterError();\n return info;\n}\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,EAAEC,KAAK,QAAQ,uBAAuB;AAC3D,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAElE,MAAM;EAAEC;AAAU,CAAC,GAAGJ,YAAY;AAElC,eAAe,SAASK,KAAK,GAAG;EAC9B,MAAMC,IAAI,GAAG,IAAIR,YAAY,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC;EAChDQ,IAAI,CACDC,WAAW,CAAC,4BAA4B,CAAC,CACzCC,SAAS,CACR,IAAIT,MAAM,CACR,sBAAsB,EACtB,uRAAuR,CACxR,CAACU,OAAO,CAAC,KAAK,EAAE,sBAAsB,CAAC,CACzC,CACAC,MAAM,CAAC,OAAOC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;IACxDA,OAAO,CAACC,wBAAwB,CAACL,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,CAAC;IACxE,IAAI,CAACD,OAAO,CAACG,cAAc,EAAE;MAC3Bd,cAAc,CAAC,iCAAiC,CAAC;MACjD,IAAI,MAAMC,SAAS,EAAE,EAAE;QACrBF,YAAY,CAAE,gBAAeD,KAAK,CAACiB,aAAa,EAAG,EAAC,CAAC;QACrD,IAAIjB,KAAK,CAACkB,cAAc,EAAE,EAAE;UAC1BjB,YAAY,CAAE,kBAAiBD,KAAK,CAACkB,cAAc,EAAG,EAAC,CAAC;QAC1D;QACA,IAAIlB,KAAK,CAACmB,cAAc,EAAE,EAAE;UAC1BlB,YAAY,CAAE,iBAAgBD,KAAK,CAACmB,cAAc,EAAG,EAAC,CAAC;QACzD;MACF,CAAC,MAAM;QACLC,OAAO,CAACC,QAAQ,GAAG,CAAC;MACtB;IACF,CAAC,MAAM,IAAI,MAAMlB,SAAS,EAAE,EAAE;MAC5B,MAAMmB,MAAM,GAAG;QACbC,UAAU,EAAEvB,KAAK,CAACiB,aAAa;MACjC,CAAC;MACD,IAAIjB,KAAK,CAACkB,cAAc,EAAE,EAAE;QAC1BI,MAAM,CAAC,cAAc,CAAC,GAAGtB,KAAK,CAACkB,cAAc,EAAE;MACjD;MACA,IAAIlB,KAAK,CAACmB,cAAc,EAAE,EAAE;QAC1BG,MAAM,CAAC,aAAa,CAAC,GAAGtB,KAAK,CAACmB,cAAc,EAAE;MAChD;MACAlB,YAAY,CAACuB,IAAI,CAACC,SAAS,CAACH,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC;IACvD,CAAC,MAAM;MACLF,OAAO,CAACC,QAAQ,GAAG,CAAC;IACtB;EACF,CAAC,CAAC;EACJhB,IAAI,CAACqB,kBAAkB,EAAE;EACzB,OAAOrB,IAAI;AACb"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FrodoCommand } from '../FrodoCommand';
|
|
2
|
+
import { Option } from 'commander';
|
|
2
3
|
import { Authenticate, Journey, state } from '@rockcarver/frodo-lib';
|
|
3
|
-
import
|
|
4
|
-
import { printMessage } from '../../utils/Console';
|
|
4
|
+
import { printMessage, verboseMessage } from '../../utils/Console';
|
|
5
5
|
const {
|
|
6
6
|
getTokens
|
|
7
7
|
} = Authenticate;
|
|
@@ -9,32 +9,26 @@ const {
|
|
|
9
9
|
deleteJourney,
|
|
10
10
|
deleteJourneys
|
|
11
11
|
} = Journey;
|
|
12
|
-
const program = new
|
|
13
|
-
program.description('Delete journeys/trees.').
|
|
12
|
+
const program = new FrodoCommand('frodo journey delete');
|
|
13
|
+
program.description('Delete journeys/trees.').addOption(new Option('-i, --journey-id <journey>', 'Name of a journey/tree. If specified, -a is ignored.')).addOption(new Option('-a, --all', 'Delete all the journeys/trees in a realm. Ignored with -i.')).addOption(new Option('--no-deep', 'No deep delete. This leaves orphaned configuration artifacts behind.')).addOption(new Option('--verbose', 'Verbose output during command execution. If specified, may or may not produce additional output.').default(false, 'off')).action(
|
|
14
14
|
// implement command logic inside action handler
|
|
15
|
-
async (host, realm, user, password, options) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
// unrecognized combination of options or no options
|
|
34
|
-
else {
|
|
35
|
-
printMessage('Unrecognized combination of options or no options...');
|
|
36
|
-
program.help();
|
|
37
|
-
}
|
|
15
|
+
async (host, realm, user, password, options, command) => {
|
|
16
|
+
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
17
|
+
// delete by id
|
|
18
|
+
if (options.journeyId && (await getTokens())) {
|
|
19
|
+
verboseMessage(`Deleting journey ${options.journeyId} in realm "${state.getRealm()}"...`);
|
|
20
|
+
deleteJourney(options.journeyId, options);
|
|
21
|
+
}
|
|
22
|
+
// --all -a
|
|
23
|
+
else if (options.all && (await getTokens())) {
|
|
24
|
+
verboseMessage('Deleting all journeys...');
|
|
25
|
+
deleteJourneys(options);
|
|
26
|
+
}
|
|
27
|
+
// unrecognized combination of options or no options
|
|
28
|
+
else {
|
|
29
|
+
printMessage('Unrecognized combination of options or no options...', 'error');
|
|
30
|
+
program.help();
|
|
31
|
+
process.exitCode = 1;
|
|
38
32
|
}
|
|
39
33
|
}
|
|
40
34
|
// end command logic inside action handler
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journey-delete.js","names":["
|
|
1
|
+
{"version":3,"file":"journey-delete.js","names":["FrodoCommand","Option","Authenticate","Journey","state","printMessage","verboseMessage","getTokens","deleteJourney","deleteJourneys","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","journeyId","getRealm","all","help","process","exitCode","parse"],"sources":["cli/journey/journey-delete.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate, Journey, state } from '@rockcarver/frodo-lib';\nimport { printMessage, verboseMessage } from '../../utils/Console';\n\nconst { getTokens } = Authenticate;\nconst { deleteJourney, deleteJourneys } = Journey;\n\nconst program = new FrodoCommand('frodo journey delete');\n\nprogram\n .description('Delete journeys/trees.')\n .addOption(\n new Option(\n '-i, --journey-id <journey>',\n 'Name of a journey/tree. If specified, -a is ignored.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Delete all the journeys/trees in a realm. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '--no-deep',\n 'No deep delete. This leaves orphaned configuration artifacts behind.'\n )\n )\n .addOption(\n new Option(\n '--verbose',\n 'Verbose output during command execution. If specified, may or may not produce additional output.'\n ).default(false, 'off')\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // delete by id\n if (options.journeyId && (await getTokens())) {\n verboseMessage(\n `Deleting journey ${\n options.journeyId\n } in realm \"${state.getRealm()}\"...`\n );\n deleteJourney(options.journeyId, options);\n }\n // --all -a\n else if (options.all && (await getTokens())) {\n verboseMessage('Deleting all journeys...');\n deleteJourneys(options);\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,EAAEC,OAAO,EAAEC,KAAK,QAAQ,uBAAuB;AACpE,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAElE,MAAM;EAAEC;AAAU,CAAC,GAAGL,YAAY;AAClC,MAAM;EAAEM,aAAa;EAAEC;AAAe,CAAC,GAAGN,OAAO;AAEjD,MAAMO,OAAO,GAAG,IAAIV,YAAY,CAAC,sBAAsB,CAAC;AAExDU,OAAO,CACJC,WAAW,CAAC,wBAAwB,CAAC,CACrCC,SAAS,CACR,IAAIX,MAAM,CACR,4BAA4B,EAC5B,sDAAsD,CACvD,CACF,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,WAAW,EACX,4DAA4D,CAC7D,CACF,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,WAAW,EACX,sEAAsE,CACvE,CACF,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,WAAW,EACX,kGAAkG,CACnG,CAACY,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CACxB,CACAC,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OAAO,CACR;EACD;EACA,IAAID,OAAO,CAACG,SAAS,KAAK,MAAMf,SAAS,EAAE,CAAC,EAAE;IAC5CD,cAAc,CACX,oBACCa,OAAO,CAACG,SACT,cAAalB,KAAK,CAACmB,QAAQ,EAAG,MAAK,CACrC;IACDf,aAAa,CAACW,OAAO,CAACG,SAAS,EAAEH,OAAO,CAAC;EAC3C;EACA;EAAA,KACK,IAAIA,OAAO,CAACK,GAAG,KAAK,MAAMjB,SAAS,EAAE,CAAC,EAAE;IAC3CD,cAAc,CAAC,0BAA0B,CAAC;IAC1CG,cAAc,CAACU,OAAO,CAAC;EACzB;EACA;EAAA,KACK;IACHd,YAAY,CACV,sDAAsD,EACtD,OAAO,CACR;IACDK,OAAO,CAACe,IAAI,EAAE;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHjB,OAAO,CAACkB,KAAK,EAAE"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
|
-
import {
|
|
2
|
+
import { FrodoCommand } from '../FrodoCommand';
|
|
3
|
+
import { Option } from 'commander';
|
|
3
4
|
import { Authenticate, ExportImportUtils, Journey, state } from '@rockcarver/frodo-lib';
|
|
4
5
|
import { describeJourney, describeJourneyMd } from '../../ops/JourneyOps';
|
|
5
|
-
import
|
|
6
|
-
import { printMessage } from '../../utils/Console';
|
|
6
|
+
import { printMessage, verboseMessage } from '../../utils/Console';
|
|
7
7
|
const {
|
|
8
8
|
getTokens
|
|
9
9
|
} = Authenticate;
|
|
@@ -15,19 +15,12 @@ const {
|
|
|
15
15
|
const {
|
|
16
16
|
saveTextToFile
|
|
17
17
|
} = ExportImportUtils;
|
|
18
|
-
const program = new
|
|
19
|
-
program.description('If -h is supplied, describe the journey/tree indicated by -i, or all journeys/trees in the realm if no -i is supplied, otherwise describe the journey/tree export file indicated by -f.').
|
|
18
|
+
const program = new FrodoCommand('frodo journey describe');
|
|
19
|
+
program.description('If -h is supplied, describe the journey/tree indicated by -i, or all journeys/trees in the realm if no -i is supplied, otherwise describe the journey/tree export file indicated by -f.').addOption(new Option('-i, --journey-id <journey>', 'Name of a journey/tree. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the journey export file to describe. Ignored with -A.')).addOption(new Option('-F, --output-file <file>', 'Name of the file to write the output to.')).addOption(new Option('--markdown', 'Output in markdown.')).addOption(new Option('-o, --override-version <version>', "Override version. Notation: '<major>.<minor>.<patch>' e.g. '7.2.0'. Override detected version with any version. This is helpful in order to check if journeys in one environment would be compatible running in another environment (e.g. in preparation of migrating from on-prem to ForgeRock Identity Cloud.")).action(
|
|
20
20
|
// implement command logic inside action handler
|
|
21
|
-
async (host, realm, user, password, options) => {
|
|
22
|
-
|
|
23
|
-
state.
|
|
24
|
-
state.default.session.setUsername(user);
|
|
25
|
-
state.default.session.setPassword(password);
|
|
26
|
-
state.default.session.setDeploymentType(options.type);
|
|
27
|
-
state.default.session.setAllowInsecureConnection(options.insecure);
|
|
28
|
-
state.default.session.setVerbose(options.verbose);
|
|
29
|
-
state.default.session.setDebug(options.debug);
|
|
30
|
-
if (options.outputFile) state.default.session.setOutputFile(options.outputFile);
|
|
21
|
+
async (host, realm, user, password, options, command) => {
|
|
22
|
+
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
23
|
+
if (options.outputFile) state.setOutputFile(options.outputFile);
|
|
31
24
|
// TODO: review checks for arguments
|
|
32
25
|
if (typeof host === 'undefined' || typeof options.file !== 'undefined') {
|
|
33
26
|
if (typeof host === 'undefined' && typeof options.file === 'undefined') {
|
|
@@ -35,12 +28,12 @@ async (host, realm, user, password, options) => {
|
|
|
35
28
|
process.exitCode = 1;
|
|
36
29
|
return;
|
|
37
30
|
}
|
|
38
|
-
|
|
31
|
+
verboseMessage(`Describing local journey file ${options.file}...`);
|
|
39
32
|
try {
|
|
40
33
|
var _fileData$tree, _fileData$tree2;
|
|
41
34
|
// override version
|
|
42
35
|
if (typeof options.overrideVersion !== 'undefined') {
|
|
43
|
-
state.
|
|
36
|
+
state.setAmVersion(options.overrideVersion);
|
|
44
37
|
}
|
|
45
38
|
const fileData = JSON.parse(fs.readFileSync(options.file, 'utf8'));
|
|
46
39
|
let journeyData;
|
|
@@ -80,10 +73,10 @@ async (host, realm, user, password, options) => {
|
|
|
80
73
|
process.exitCode = 1;
|
|
81
74
|
}
|
|
82
75
|
} else if (await getTokens()) {
|
|
83
|
-
|
|
76
|
+
verboseMessage(`Describing journey(s) in realm "${state.getRealm()}"...`);
|
|
84
77
|
// override version
|
|
85
78
|
if (typeof options.overrideVersion !== 'undefined') {
|
|
86
|
-
state.
|
|
79
|
+
state.setAmVersion(options.overrideVersion);
|
|
87
80
|
}
|
|
88
81
|
if (typeof options.journeyId === 'undefined') {
|
|
89
82
|
let journeys = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journey-describe.js","names":["fs","Command","Option","Authenticate","ExportImportUtils","Journey","state","describeJourney","describeJourneyMd","common","printMessage","getTokens","getJourneys","exportJourney","createFileParamTreeExportResolver","saveTextToFile","program","description","helpOption","showHelpAfterError","addArgument","hostArgument","realmArgument","userArgument","passwordArgument","addOption","deploymentOption","insecureOption","verboseOption","debugOption","action","host","realm","user","password","options","default","session","setTenant","setRealm","setUsername","setPassword","setDeploymentType","type","setAllowInsecureConnection","insecure","setVerbose","verbose","setDebug","debug","outputFile","setOutputFile","file","process","exitCode","overrideVersion","setAmVersion","fileData","JSON","parse","readFileSync","journeyData","journeyId","trees","Object","values","tree","_id","Error","markdown","error","message","getRealm","journeys","journey","treeData"],"sources":["cli/journey/journey-describe.ts"],"sourcesContent":["import fs from 'fs';\nimport { Command, Option } from 'commander';\nimport {\n Authenticate,\n ExportImportUtils,\n Journey,\n state,\n} from '@rockcarver/frodo-lib';\nimport { describeJourney, describeJourneyMd } from '../../ops/JourneyOps';\nimport * as common from '../cmd_common.js';\nimport { printMessage } from '../../utils/Console';\n\nconst { getTokens } = Authenticate;\nconst { getJourneys, exportJourney, createFileParamTreeExportResolver } =\n Journey;\nconst { saveTextToFile } = ExportImportUtils;\n\nconst program = new Command('frodo journey describe');\n\nprogram\n .description(\n 'If -h is supplied, describe the journey/tree indicated by -i, or all journeys/trees in the realm if no -i is supplied, otherwise describe the journey/tree export file indicated by -f.'\n )\n .helpOption('-h, --help', 'Help')\n .showHelpAfterError()\n .addArgument(common.hostArgument)\n .addArgument(common.realmArgument)\n .addArgument(common.userArgument)\n .addArgument(common.passwordArgument)\n .addOption(common.deploymentOption)\n .addOption(common.insecureOption)\n .addOption(common.verboseOption)\n .addOption(common.debugOption)\n .addOption(\n new Option(\n '-i, --journey-id <journey>',\n 'Name of a journey/tree. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the journey export file to describe. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-F, --output-file <file>',\n 'Name of the file to write the output to.'\n )\n )\n .addOption(new Option('--markdown', 'Output in markdown.'))\n .addOption(\n new Option(\n '-o, --override-version <version>',\n \"Override version. Notation: '<major>.<minor>.<patch>' e.g. '7.2.0'. Override detected version with any version. This is helpful in order to check if journeys in one environment would be compatible running in another environment (e.g. in preparation of migrating from on-prem to ForgeRock Identity Cloud.\"\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options) => {\n state.default.session.setTenant(host);\n state.default.session.setRealm(realm);\n state.default.session.setUsername(user);\n state.default.session.setPassword(password);\n state.default.session.setDeploymentType(options.type);\n state.default.session.setAllowInsecureConnection(options.insecure);\n state.default.session.setVerbose(options.verbose);\n state.default.session.setDebug(options.debug);\n if (options.outputFile)\n state.default.session.setOutputFile(options.outputFile);\n // TODO: review checks for arguments\n if (typeof host === 'undefined' || typeof options.file !== 'undefined') {\n if (\n typeof host === 'undefined' &&\n typeof options.file === 'undefined'\n ) {\n printMessage('Need either [host] or -f.', 'error');\n process.exitCode = 1;\n return;\n }\n printMessage(`Describing local journey file ${options.file}...`);\n try {\n // override version\n if (typeof options.overrideVersion !== 'undefined') {\n state.default.session.setAmVersion(options.overrideVersion);\n }\n const fileData = JSON.parse(fs.readFileSync(options.file, 'utf8'));\n let journeyData;\n // single or multi tree export?\n // multi - by id\n if (\n typeof options.journeyId !== 'undefined' &&\n fileData.trees &&\n fileData.trees[options.journeyId]\n ) {\n journeyData = fileData.trees[options.journeyId];\n }\n // multi - first\n else if (typeof options.journeyId === 'undefined' && fileData.trees) {\n [journeyData] = Object.values(fileData.trees);\n }\n // single - by id\n else if (\n typeof options.journeyId !== 'undefined' &&\n options.journeyId === fileData.tree?._id\n ) {\n journeyData = fileData;\n }\n // single\n else if (\n typeof options.journeyId === 'undefined' &&\n fileData.tree?._id\n ) {\n journeyData = fileData;\n }\n // no journey/tree found\n else {\n throw new Error(\n typeof options.journeyId === 'undefined'\n ? `No journey found in ${options.file}`\n : `Journey '${options.journeyId}' not found in ${options.file}`\n );\n }\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(\n journeyData,\n createFileParamTreeExportResolver(options.file)\n );\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(\n journeyData,\n createFileParamTreeExportResolver(options.file)\n );\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n } else if (await getTokens()) {\n printMessage(\n `Describing journey(s) in realm \"${state.default.session.getRealm()}\"...`\n );\n // override version\n if (typeof options.overrideVersion !== 'undefined') {\n state.default.session.setAmVersion(options.overrideVersion);\n }\n if (typeof options.journeyId === 'undefined') {\n let journeys = [];\n journeys = await getJourneys();\n for (const journey of journeys) {\n try {\n // eslint-disable-next-line no-await-in-loop, dot-notation\n const treeData = await exportJourney(journey['_id']);\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(treeData);\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(treeData);\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n }\n } else {\n try {\n const treeData = await exportJourney(options.journeyId);\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(treeData);\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(treeData);\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n }\n }\n }\n // end command logic in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AE;YACrB,MAAM9D,eAAe,CAACoE,QAAQ,CAAC;UACjC;UACA;UAAA,KACK;YACH;YACA,IAAIxC,OAAO,CAACe,UAAU,EAAEnC,cAAc,CAAC,EAAE,EAAEoB,OAAO,CAACe,UAAU,CAAC;YAC9D,MAAM1C,iBAAiB,CAACmE,QAAQ,CAAC;UACnC;QACF,CAAC,CAAC,OAAOL,KAAK,EAAE;UACd5D,YAAY,CAAC4D,KAAK,CAACC,OAAO,EAAE,OAAO,CAAC;UACpClB,OAAO,CAACC,QAAQ,GAAG,CAAC;QACtB;MACF;IACF,CAAC,MAAM;MACL,IAAI;QACF,MAAMqB,QAAQ,GAAG,MAAM9D,aAAa,CAACsB,OAAO,CAAC2B,SAAS,CAAC;QACvD;QACA,IAAI,CAAC3B,OAAO,CAACkC,QAAQ,EAAE;UACrB,MAAM9D,eAAe,CAACoE,QAAQ,CAAC;QACjC;QACA;QAAA,KACK;UACH;UACA,IAAIxC,OAAO,CAACe,UAAU,EAAEnC,cAAc,CAAC,EAAE,EAAEoB,OAAO,CAACe,UAAU,CAAC;UAC9D,MAAM1C,iBAAiB,CAACmE,QAAQ,CAAC;QACnC;MACF,CAAC,CAAC,OAAOL,KAAK,EAAE;QACd5D,YAAY,CAAC4D,KAAK,CAACC,OAAO,EAAE,OAAO,CAAC;QACpClB,OAAO,CAACC,QAAQ,GAAG,CAAC;MACtB;IACF;EACF;AACF;AACA;AAAA,CACD;;AAEHtC,OAAO,CAAC2C,KAAK,EAAE"}
|
|
1
|
+
{"version":3,"file":"journey-describe.js","names":["fs","FrodoCommand","Option","Authenticate","ExportImportUtils","Journey","state","describeJourney","describeJourneyMd","printMessage","verboseMessage","getTokens","getJourneys","exportJourney","createFileParamTreeExportResolver","saveTextToFile","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","outputFile","setOutputFile","file","process","exitCode","overrideVersion","setAmVersion","fileData","JSON","parse","readFileSync","journeyData","journeyId","trees","Object","values","tree","_id","Error","markdown","error","message","getRealm","journeys","journey","treeData"],"sources":["cli/journey/journey-describe.ts"],"sourcesContent":["import fs from 'fs';\nimport { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport {\n Authenticate,\n ExportImportUtils,\n Journey,\n state,\n} from '@rockcarver/frodo-lib';\nimport { describeJourney, describeJourneyMd } from '../../ops/JourneyOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\n\nconst { getTokens } = Authenticate;\nconst { getJourneys, exportJourney, createFileParamTreeExportResolver } =\n Journey;\nconst { saveTextToFile } = ExportImportUtils;\n\nconst program = new FrodoCommand('frodo journey describe');\n\nprogram\n .description(\n 'If -h is supplied, describe the journey/tree indicated by -i, or all journeys/trees in the realm if no -i is supplied, otherwise describe the journey/tree export file indicated by -f.'\n )\n .addOption(\n new Option(\n '-i, --journey-id <journey>',\n 'Name of a journey/tree. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the journey export file to describe. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-F, --output-file <file>',\n 'Name of the file to write the output to.'\n )\n )\n .addOption(new Option('--markdown', 'Output in markdown.'))\n .addOption(\n new Option(\n '-o, --override-version <version>',\n \"Override version. Notation: '<major>.<minor>.<patch>' e.g. '7.2.0'. Override detected version with any version. This is helpful in order to check if journeys in one environment would be compatible running in another environment (e.g. in preparation of migrating from on-prem to ForgeRock Identity Cloud.\"\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (options.outputFile) state.setOutputFile(options.outputFile);\n // TODO: review checks for arguments\n if (typeof host === 'undefined' || typeof options.file !== 'undefined') {\n if (\n typeof host === 'undefined' &&\n typeof options.file === 'undefined'\n ) {\n printMessage('Need either [host] or -f.', 'error');\n process.exitCode = 1;\n return;\n }\n verboseMessage(`Describing local journey file ${options.file}...`);\n try {\n // override version\n if (typeof options.overrideVersion !== 'undefined') {\n state.setAmVersion(options.overrideVersion);\n }\n const fileData = JSON.parse(fs.readFileSync(options.file, 'utf8'));\n let journeyData;\n // single or multi tree export?\n // multi - by id\n if (\n typeof options.journeyId !== 'undefined' &&\n fileData.trees &&\n fileData.trees[options.journeyId]\n ) {\n journeyData = fileData.trees[options.journeyId];\n }\n // multi - first\n else if (typeof options.journeyId === 'undefined' && fileData.trees) {\n [journeyData] = Object.values(fileData.trees);\n }\n // single - by id\n else if (\n typeof options.journeyId !== 'undefined' &&\n options.journeyId === fileData.tree?._id\n ) {\n journeyData = fileData;\n }\n // single\n else if (\n typeof options.journeyId === 'undefined' &&\n fileData.tree?._id\n ) {\n journeyData = fileData;\n }\n // no journey/tree found\n else {\n throw new Error(\n typeof options.journeyId === 'undefined'\n ? `No journey found in ${options.file}`\n : `Journey '${options.journeyId}' not found in ${options.file}`\n );\n }\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(\n journeyData,\n createFileParamTreeExportResolver(options.file)\n );\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(\n journeyData,\n createFileParamTreeExportResolver(options.file)\n );\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n } else if (await getTokens()) {\n verboseMessage(\n `Describing journey(s) in realm \"${state.getRealm()}\"...`\n );\n // override version\n if (typeof options.overrideVersion !== 'undefined') {\n state.setAmVersion(options.overrideVersion);\n }\n if (typeof options.journeyId === 'undefined') {\n let journeys = [];\n journeys = await getJourneys();\n for (const journey of journeys) {\n try {\n // eslint-disable-next-line no-await-in-loop, dot-notation\n const treeData = await exportJourney(journey['_id']);\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(treeData);\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(treeData);\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n }\n } else {\n try {\n const treeData = await exportJourney(options.journeyId);\n // ANSI text output\n if (!options.markdown) {\n await describeJourney(treeData);\n }\n // Markdown output\n else {\n // reset output file\n if (options.outputFile) saveTextToFile('', options.outputFile);\n await describeJourneyMd(treeData);\n }\n } catch (error) {\n printMessage(error.message, 'error');\n process.exitCode = 1;\n }\n }\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SACEC,YAAY,EACZC,iBAAiB,EACjBC,OAAO,EACPC,KAAK,QACA,uBAAuB;AAC9B,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,sBAAsB;AACzE,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAElE,MAAM;EAAEC;AAAU,CAAC,GAAGR,YAAY;AAClC,MAAM;EAAES,WAAW;EAAEC,aAAa;EAAEC;AAAkC,CAAC,GACrET,OAAO;AACT,MAAM;EAAEU;AAAe,CAAC,GAAGX,iBAAiB;AAE5C,MAAMY,OAAO,GAAG,IAAIf,YAAY,CAAC,wBAAwB,CAAC;AAE1De,OAAO,CACJC,WAAW,CACV,yLAAyL,CAC1L,CACAC,SAAS,CACR,IAAIhB,MAAM,CACR,4BAA4B,EAC5B,8DAA8D,CAC/D,CACF,CACAgB,SAAS,CACR,IAAIhB,MAAM,CACR,mBAAmB,EACnB,+DAA+D,CAChE,CACF,CACAgB,SAAS,CACR,IAAIhB,MAAM,CACR,0BAA0B,EAC1B,0CAA0C,CAC3C,CACF,CACAgB,SAAS,CAAC,IAAIhB,MAAM,CAAC,YAAY,EAAE,qBAAqB,CAAC,CAAC,CAC1DgB,SAAS,CACR,IAAIhB,MAAM,CACR,kCAAkC,EAClC,iTAAiT,CAClT,CACF,CACAiB,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO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|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { FrodoCommand } from '../FrodoCommand';
|
|
2
|
+
import { Option } from 'commander';
|
|
3
|
+
import { Authenticate, Journey } from '@rockcarver/frodo-lib';
|
|
4
4
|
import { showSpinner, failSpinner, succeedSpinner, printMessage } from '../../utils/Console';
|
|
5
5
|
const {
|
|
6
6
|
getTokens
|
|
@@ -8,8 +8,8 @@ const {
|
|
|
8
8
|
const {
|
|
9
9
|
disableJourney
|
|
10
10
|
} = Journey;
|
|
11
|
-
const program = new
|
|
12
|
-
program.description('Disable journeys/trees.').
|
|
11
|
+
const program = new FrodoCommand('frodo journey disable');
|
|
12
|
+
program.description('Disable journeys/trees.').addOption(new Option('-i, --journey-id <journey>', 'Name of a journey/tree.'))
|
|
13
13
|
// .addOption(
|
|
14
14
|
// new Option(
|
|
15
15
|
// '-a, --all',
|
|
@@ -18,29 +18,23 @@ program.description('Disable journeys/trees.').helpOption('-h, --help', 'Help').
|
|
|
18
18
|
// )
|
|
19
19
|
.action(
|
|
20
20
|
// implement command logic inside action handler
|
|
21
|
-
async (host, realm, user, password, options) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (options.journeyId) {
|
|
31
|
-
showSpinner(`Disabling journey ${options.journeyId}...`);
|
|
32
|
-
if (await disableJourney(options.journeyId)) {
|
|
33
|
-
succeedSpinner(`Disabled journey ${options.journeyId}.`);
|
|
34
|
-
} else {
|
|
35
|
-
failSpinner(`Disabling journey ${options.journeyId} failed.`);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
// unrecognized combination of options or no options
|
|
39
|
-
else {
|
|
40
|
-
printMessage('Unrecognized combination of options or no options...');
|
|
41
|
-
program.help();
|
|
21
|
+
async (host, realm, user, password, options, command) => {
|
|
22
|
+
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
23
|
+
// disable
|
|
24
|
+
if (options.journeyId && (await getTokens())) {
|
|
25
|
+
showSpinner(`Disabling journey ${options.journeyId}...`);
|
|
26
|
+
if (await disableJourney(options.journeyId)) {
|
|
27
|
+
succeedSpinner(`Disabled journey ${options.journeyId}.`);
|
|
28
|
+
} else {
|
|
29
|
+
failSpinner(`Disabling journey ${options.journeyId} failed.`);
|
|
42
30
|
}
|
|
43
31
|
}
|
|
32
|
+
// unrecognized combination of options or no options
|
|
33
|
+
else {
|
|
34
|
+
printMessage('Unrecognized combination of options or no options...');
|
|
35
|
+
program.help();
|
|
36
|
+
process.exitCode = 1;
|
|
37
|
+
}
|
|
44
38
|
}
|
|
45
39
|
// end command logic inside action handler
|
|
46
40
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journey-disable.js","names":["
|
|
1
|
+
{"version":3,"file":"journey-disable.js","names":["FrodoCommand","Option","Authenticate","Journey","showSpinner","failSpinner","succeedSpinner","printMessage","getTokens","disableJourney","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","journeyId","help","process","exitCode","parse"],"sources":["cli/journey/journey-disable.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { Authenticate, Journey } from '@rockcarver/frodo-lib';\nimport {\n showSpinner,\n failSpinner,\n succeedSpinner,\n printMessage,\n} from '../../utils/Console';\n\nconst { getTokens } = Authenticate;\nconst { disableJourney } = Journey;\n\nconst program = new FrodoCommand('frodo journey disable');\n\nprogram\n .description('Disable journeys/trees.')\n .addOption(\n new Option('-i, --journey-id <journey>', 'Name of a journey/tree.')\n )\n // .addOption(\n // new Option(\n // '-a, --all',\n // 'Disable all the journeys/trees in a realm. Ignored with -i.'\n // )\n // )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // disable\n if (options.journeyId && (await getTokens())) {\n showSpinner(`Disabling journey ${options.journeyId}...`);\n if (await disableJourney(options.journeyId)) {\n succeedSpinner(`Disabled journey ${options.journeyId}.`);\n } else {\n failSpinner(`Disabling journey ${options.journeyId} failed.`);\n }\n }\n // unrecognized combination of options or no options\n else {\n printMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,EAAEC,OAAO,QAAQ,uBAAuB;AAC7D,SACEC,WAAW,EACXC,WAAW,EACXC,cAAc,EACdC,YAAY,QACP,qBAAqB;AAE5B,MAAM;EAAEC;AAAU,CAAC,GAAGN,YAAY;AAClC,MAAM;EAAEO;AAAe,CAAC,GAAGN,OAAO;AAElC,MAAMO,OAAO,GAAG,IAAIV,YAAY,CAAC,uBAAuB,CAAC;AAEzDU,OAAO,CACJC,WAAW,CAAC,yBAAyB,CAAC,CACtCC,SAAS,CACR,IAAIX,MAAM,CAAC,4BAA4B,EAAE,yBAAyB,CAAC;AAErE;AACA;AACA;AACA;AACA;AACA;AAAA,CACCY,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OAAO,CACR;EACD;EACA,IAAID,OAAO,CAACG,SAAS,KAAK,MAAMb,SAAS,EAAE,CAAC,EAAE;IAC5CJ,WAAW,CAAE,qBAAoBc,OAAO,CAACG,SAAU,KAAI,CAAC;IACxD,IAAI,MAAMZ,cAAc,CAACS,OAAO,CAACG,SAAS,CAAC,EAAE;MAC3Cf,cAAc,CAAE,oBAAmBY,OAAO,CAACG,SAAU,GAAE,CAAC;IAC1D,CAAC,MAAM;MACLhB,WAAW,CAAE,qBAAoBa,OAAO,CAACG,SAAU,UAAS,CAAC;IAC/D;EACF;EACA;EAAA,KACK;IACHd,YAAY,CAAC,sDAAsD,CAAC;IACpEG,OAAO,CAACY,IAAI,EAAE;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AAAA,CACD;;AAEHd,OAAO,CAACe,KAAK,EAAE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { FrodoCommand } from '../FrodoCommand';
|
|
2
|
+
import { Option } from 'commander';
|
|
3
|
+
import { Authenticate, Journey } from '@rockcarver/frodo-lib';
|
|
4
4
|
import { showSpinner, failSpinner, succeedSpinner, printMessage } from '../../utils/Console';
|
|
5
5
|
const {
|
|
6
6
|
getTokens
|
|
@@ -8,8 +8,8 @@ const {
|
|
|
8
8
|
const {
|
|
9
9
|
enableJourney
|
|
10
10
|
} = Journey;
|
|
11
|
-
const program = new
|
|
12
|
-
program.description('Enable journeys/trees.').
|
|
11
|
+
const program = new FrodoCommand('frodo journey enable');
|
|
12
|
+
program.description('Enable journeys/trees.').addOption(new Option('-i, --journey-id <journey>', 'Name of a journey/tree.'))
|
|
13
13
|
// .addOption(
|
|
14
14
|
// new Option(
|
|
15
15
|
// '-a, --all',
|
|
@@ -18,29 +18,23 @@ program.description('Enable journeys/trees.').helpOption('-h, --help', 'Help').s
|
|
|
18
18
|
// )
|
|
19
19
|
.action(
|
|
20
20
|
// implement command logic inside action handler
|
|
21
|
-
async (host, realm, user, password, options) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (options.journeyId) {
|
|
31
|
-
showSpinner(`Enabling journey ${options.journeyId}...`);
|
|
32
|
-
if (await enableJourney(options.journeyId)) {
|
|
33
|
-
succeedSpinner(`Enabled journey ${options.journeyId}.`);
|
|
34
|
-
} else {
|
|
35
|
-
failSpinner(`Enabling journey ${options.journeyId} failed.`);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
// unrecognized combination of options or no options
|
|
39
|
-
else {
|
|
40
|
-
printMessage('Unrecognized combination of options or no options...');
|
|
41
|
-
program.help();
|
|
21
|
+
async (host, realm, user, password, options, command) => {
|
|
22
|
+
command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
|
|
23
|
+
// enable
|
|
24
|
+
if (options.journeyId && (await getTokens())) {
|
|
25
|
+
showSpinner(`Enabling journey ${options.journeyId}...`);
|
|
26
|
+
if (await enableJourney(options.journeyId)) {
|
|
27
|
+
succeedSpinner(`Enabled journey ${options.journeyId}.`);
|
|
28
|
+
} else {
|
|
29
|
+
failSpinner(`Enabling journey ${options.journeyId} failed.`);
|
|
42
30
|
}
|
|
43
31
|
}
|
|
32
|
+
// unrecognized combination of options or no options
|
|
33
|
+
else {
|
|
34
|
+
printMessage('Unrecognized combination of options or no options...');
|
|
35
|
+
program.help();
|
|
36
|
+
process.exitCode = 1;
|
|
37
|
+
}
|
|
44
38
|
}
|
|
45
39
|
// end command logic inside action handler
|
|
46
40
|
);
|