@rockcarver/frodo-cli 2.0.0-50 → 2.0.0-52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -1
- package/esm/app.js +7 -2
- package/esm/app.js.map +1 -1
- package/esm/cli/_template/something-delete.js +1 -4
- package/esm/cli/_template/something-delete.js.map +1 -1
- package/esm/cli/_template/something-describe.js +1 -4
- package/esm/cli/_template/something-describe.js.map +1 -1
- package/esm/cli/_template/something-else-delete.js +1 -4
- package/esm/cli/_template/something-else-delete.js.map +1 -1
- package/esm/cli/_template/something-else-describe.js +1 -4
- package/esm/cli/_template/something-else-describe.js.map +1 -1
- package/esm/cli/_template/something-else-export.js +1 -4
- package/esm/cli/_template/something-else-export.js.map +1 -1
- package/esm/cli/_template/something-else-import.js +1 -4
- package/esm/cli/_template/something-else-import.js.map +1 -1
- package/esm/cli/_template/something-else-list.js +1 -4
- package/esm/cli/_template/something-else-list.js.map +1 -1
- package/esm/cli/_template/something-export.js +1 -4
- package/esm/cli/_template/something-export.js.map +1 -1
- package/esm/cli/_template/something-import.js +1 -4
- package/esm/cli/_template/something-import.js.map +1 -1
- package/esm/cli/_template/something-list.js +1 -4
- package/esm/cli/_template/something-list.js.map +1 -1
- package/esm/cli/_template/something-other-delete.js +1 -4
- package/esm/cli/_template/something-other-delete.js.map +1 -1
- package/esm/cli/_template/something-other-describe.js +1 -4
- package/esm/cli/_template/something-other-describe.js.map +1 -1
- package/esm/cli/_template/something-other-export.js +1 -4
- package/esm/cli/_template/something-other-export.js.map +1 -1
- package/esm/cli/_template/something-other-import.js +1 -4
- package/esm/cli/_template/something-other-import.js.map +1 -1
- package/esm/cli/_template/something-other-list.js +1 -4
- package/esm/cli/_template/something-other-list.js.map +1 -1
- package/esm/cli/admin/admin-add-autoid-static-user-mapping.js +4 -9
- 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 +47 -54
- package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-execute-rfc7523-authz-grant-flow.js +1 -4
- package/esm/cli/admin/admin-execute-rfc7523-authz-grant-flow.js.map +1 -1
- package/esm/cli/admin/admin-federation-export.js +2 -5
- package/esm/cli/admin/admin-federation-export.js.map +1 -1
- package/esm/cli/admin/admin-federation-import.js +2 -5
- package/esm/cli/admin/admin-federation-import.js.map +1 -1
- package/esm/cli/admin/admin-federation-list.js +2 -5
- package/esm/cli/admin/admin-federation-list.js.map +1 -1
- package/esm/cli/admin/admin-generate-rfc7523-authz-grant-artefacts.js +2 -4
- package/esm/cli/admin/admin-generate-rfc7523-authz-grant-artefacts.js.map +1 -1
- package/esm/cli/admin/admin-get-access-token.js +1 -3
- package/esm/cli/admin/admin-get-access-token.js.map +1 -1
- package/esm/cli/admin/admin-grant-oauth2-client-admin-privileges.js +5 -9
- package/esm/cli/admin/admin-grant-oauth2-client-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-hide-generic-extension-attributes.js +5 -9
- 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 +5 -12
- 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 +5 -12
- 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 +4 -12
- package/esm/cli/admin/admin-list-static-user-mappings.js.map +1 -1
- package/esm/cli/admin/admin-remove-static-user-mapping.js +4 -9
- package/esm/cli/admin/admin-remove-static-user-mapping.js.map +1 -1
- package/esm/cli/admin/admin-repair-org-model.js +5 -9
- package/esm/cli/admin/admin-repair-org-model.js.map +1 -1
- package/esm/cli/admin/admin-revoke-oauth2-client-admin-privileges.js +5 -9
- package/esm/cli/admin/admin-revoke-oauth2-client-admin-privileges.js.map +1 -1
- package/esm/cli/admin/admin-show-generic-extension-attributes.js +5 -9
- package/esm/cli/admin/admin-show-generic-extension-attributes.js.map +1 -1
- package/esm/cli/admin/admin-train-auto-access-model.js +1 -3
- package/esm/cli/admin/admin-train-auto-access-model.js.map +1 -1
- package/esm/cli/agent/agent-delete.js +9 -24
- package/esm/cli/agent/agent-delete.js.map +1 -1
- package/esm/cli/agent/agent-describe.js +1 -4
- package/esm/cli/agent/agent-describe.js.map +1 -1
- package/esm/cli/agent/agent-export.js +7 -7
- package/esm/cli/agent/agent-export.js.map +1 -1
- package/esm/cli/agent/agent-gateway-delete.js +8 -23
- package/esm/cli/agent/agent-gateway-delete.js.map +1 -1
- package/esm/cli/agent/agent-gateway-describe.js +1 -4
- package/esm/cli/agent/agent-gateway-describe.js.map +1 -1
- package/esm/cli/agent/agent-gateway-export.js +7 -7
- package/esm/cli/agent/agent-gateway-export.js.map +1 -1
- package/esm/cli/agent/agent-gateway-import.js +9 -8
- package/esm/cli/agent/agent-gateway-import.js.map +1 -1
- package/esm/cli/agent/agent-gateway-list.js +3 -5
- package/esm/cli/agent/agent-gateway-list.js.map +1 -1
- package/esm/cli/agent/agent-import.js +9 -8
- package/esm/cli/agent/agent-import.js.map +1 -1
- package/esm/cli/agent/agent-java-delete.js +8 -23
- package/esm/cli/agent/agent-java-delete.js.map +1 -1
- package/esm/cli/agent/agent-java-describe.js +1 -4
- package/esm/cli/agent/agent-java-describe.js.map +1 -1
- package/esm/cli/agent/agent-java-export.js +7 -7
- package/esm/cli/agent/agent-java-export.js.map +1 -1
- package/esm/cli/agent/agent-java-import.js +9 -8
- package/esm/cli/agent/agent-java-import.js.map +1 -1
- package/esm/cli/agent/agent-java-list.js +3 -5
- package/esm/cli/agent/agent-java-list.js.map +1 -1
- package/esm/cli/agent/agent-list.js +3 -5
- package/esm/cli/agent/agent-list.js.map +1 -1
- package/esm/cli/agent/agent-web-delete.js +8 -23
- package/esm/cli/agent/agent-web-delete.js.map +1 -1
- package/esm/cli/agent/agent-web-describe.js +1 -4
- package/esm/cli/agent/agent-web-describe.js.map +1 -1
- package/esm/cli/agent/agent-web-export.js +7 -7
- package/esm/cli/agent/agent-web-export.js.map +1 -1
- package/esm/cli/agent/agent-web-import.js +9 -8
- package/esm/cli/agent/agent-web-import.js.map +1 -1
- package/esm/cli/agent/agent-web-list.js +3 -5
- package/esm/cli/agent/agent-web-list.js.map +1 -1
- package/esm/cli/app/app-delete.js +5 -8
- package/esm/cli/app/app-delete.js.map +1 -1
- package/esm/cli/app/app-describe.js +1 -4
- package/esm/cli/app/app-describe.js.map +1 -1
- package/esm/cli/app/app-export.js +7 -10
- package/esm/cli/app/app-export.js.map +1 -1
- package/esm/cli/app/app-import.js +9 -12
- package/esm/cli/app/app-import.js.map +1 -1
- package/esm/cli/app/app-list.js +3 -5
- package/esm/cli/app/app-list.js.map +1 -1
- package/esm/cli/authn/authn-describe.js +1 -4
- package/esm/cli/authn/authn-describe.js.map +1 -1
- package/esm/cli/authn/authn-export.js +1 -4
- package/esm/cli/authn/authn-export.js.map +1 -1
- package/esm/cli/authn/authn-import.js +1 -4
- package/esm/cli/authn/authn-import.js.map +1 -1
- package/esm/cli/authz/authz-policy-delete.js +1 -4
- package/esm/cli/authz/authz-policy-delete.js.map +1 -1
- package/esm/cli/authz/authz-policy-describe.js +1 -4
- package/esm/cli/authz/authz-policy-describe.js.map +1 -1
- package/esm/cli/authz/authz-policy-export.js +1 -4
- package/esm/cli/authz/authz-policy-export.js.map +1 -1
- package/esm/cli/authz/authz-policy-import.js +1 -4
- package/esm/cli/authz/authz-policy-import.js.map +1 -1
- package/esm/cli/authz/authz-policy-list.js +1 -4
- package/esm/cli/authz/authz-policy-list.js.map +1 -1
- package/esm/cli/authz/authz-set-delete.js +1 -4
- package/esm/cli/authz/authz-set-delete.js.map +1 -1
- package/esm/cli/authz/authz-set-describe.js +1 -4
- package/esm/cli/authz/authz-set-describe.js.map +1 -1
- package/esm/cli/authz/authz-set-export.js +1 -4
- package/esm/cli/authz/authz-set-export.js.map +1 -1
- package/esm/cli/authz/authz-set-import.js +1 -4
- package/esm/cli/authz/authz-set-import.js.map +1 -1
- package/esm/cli/authz/authz-set-list.js +1 -4
- package/esm/cli/authz/authz-set-list.js.map +1 -1
- package/esm/cli/authz/authz-type-delete.js +1 -4
- package/esm/cli/authz/authz-type-delete.js.map +1 -1
- package/esm/cli/authz/authz-type-describe.js +1 -4
- package/esm/cli/authz/authz-type-describe.js.map +1 -1
- package/esm/cli/authz/authz-type-export.js +1 -4
- package/esm/cli/authz/authz-type-export.js.map +1 -1
- package/esm/cli/authz/authz-type-import.js +1 -4
- package/esm/cli/authz/authz-type-import.js.map +1 -1
- package/esm/cli/authz/authz-type-list.js +1 -4
- package/esm/cli/authz/authz-type-list.js.map +1 -1
- package/esm/cli/config/config-delete.js +1 -4
- package/esm/cli/config/config-delete.js.map +1 -1
- package/esm/cli/config/config-describe.js +1 -4
- package/esm/cli/config/config-describe.js.map +1 -1
- package/esm/cli/config/config-export.js +2 -4
- package/esm/cli/config/config-export.js.map +1 -1
- package/esm/cli/config/config-import.js +2 -4
- package/esm/cli/config/config-import.js.map +1 -1
- package/esm/cli/config/config-list.js +1 -4
- package/esm/cli/config/config-list.js.map +1 -1
- package/esm/cli/conn/conn-delete.js +7 -1
- package/esm/cli/conn/conn-delete.js.map +1 -1
- package/esm/cli/conn/conn-save.js +10 -12
- package/esm/cli/conn/conn-save.js.map +1 -1
- package/esm/cli/email/email-template-export.js +8 -7
- package/esm/cli/email/email-template-export.js.map +1 -1
- package/esm/cli/email/email-template-import.js +9 -8
- package/esm/cli/email/email-template-import.js.map +1 -1
- package/esm/cli/email/email-template-list.js +3 -5
- package/esm/cli/email/email-template-list.js.map +1 -1
- package/esm/cli/esv/esv-apply.js +1 -3
- package/esm/cli/esv/esv-apply.js.map +1 -1
- package/esm/cli/esv/esv-secret-create.js +2 -5
- package/esm/cli/esv/esv-secret-create.js.map +1 -1
- package/esm/cli/esv/esv-secret-delete.js +2 -5
- package/esm/cli/esv/esv-secret-delete.js.map +1 -1
- package/esm/cli/esv/esv-secret-describe.js +2 -5
- package/esm/cli/esv/esv-secret-describe.js.map +1 -1
- package/esm/cli/esv/esv-secret-export.js +3 -5
- package/esm/cli/esv/esv-secret-export.js.map +1 -1
- package/esm/cli/esv/esv-secret-import.js +1 -4
- package/esm/cli/esv/esv-secret-import.js.map +1 -1
- package/esm/cli/esv/esv-secret-list.js +2 -5
- package/esm/cli/esv/esv-secret-list.js.map +1 -1
- package/esm/cli/esv/esv-secret-set.js +2 -5
- package/esm/cli/esv/esv-secret-set.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-activate.js +2 -5
- package/esm/cli/esv/esv-secret-version-activate.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-create.js +2 -5
- package/esm/cli/esv/esv-secret-version-create.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-deactivate.js +2 -5
- package/esm/cli/esv/esv-secret-version-deactivate.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-delete.js +2 -5
- package/esm/cli/esv/esv-secret-version-delete.js.map +1 -1
- package/esm/cli/esv/esv-secret-version-list.js +2 -5
- package/esm/cli/esv/esv-secret-version-list.js.map +1 -1
- package/esm/cli/esv/esv-variable-create.js +2 -5
- package/esm/cli/esv/esv-variable-create.js.map +1 -1
- package/esm/cli/esv/esv-variable-delete.js +2 -5
- package/esm/cli/esv/esv-variable-delete.js.map +1 -1
- package/esm/cli/esv/esv-variable-describe.js +2 -5
- package/esm/cli/esv/esv-variable-describe.js.map +1 -1
- package/esm/cli/esv/esv-variable-export.js +3 -5
- package/esm/cli/esv/esv-variable-export.js.map +1 -1
- package/esm/cli/esv/esv-variable-import.js +1 -4
- package/esm/cli/esv/esv-variable-import.js.map +1 -1
- package/esm/cli/esv/esv-variable-list.js +2 -5
- package/esm/cli/esv/esv-variable-list.js.map +1 -1
- package/esm/cli/esv/esv-variable-set.js +2 -5
- package/esm/cli/esv/esv-variable-set.js.map +1 -1
- package/esm/cli/idm/idm-count.js +3 -5
- package/esm/cli/idm/idm-count.js.map +1 -1
- package/esm/cli/idm/idm-export.js +8 -7
- package/esm/cli/idm/idm-export.js.map +1 -1
- package/esm/cli/idm/idm-import.js +10 -8
- package/esm/cli/idm/idm-import.js.map +1 -1
- package/esm/cli/idm/idm-list.js +3 -5
- package/esm/cli/idm/idm-list.js.map +1 -1
- package/esm/cli/idp/idp-export.js +8 -7
- package/esm/cli/idp/idp-export.js.map +1 -1
- package/esm/cli/idp/idp-import.js +10 -8
- package/esm/cli/idp/idp-import.js.map +1 -1
- package/esm/cli/idp/idp-list.js +4 -5
- package/esm/cli/idp/idp-list.js.map +1 -1
- package/esm/cli/info/info.js +1 -3
- package/esm/cli/info/info.js.map +1 -1
- package/esm/cli/journey/journey-delete.js +7 -10
- package/esm/cli/journey/journey-delete.js.map +1 -1
- package/esm/cli/journey/journey-describe.js +16 -12
- package/esm/cli/journey/journey-describe.js.map +1 -1
- package/esm/cli/journey/journey-disable.js +1 -4
- package/esm/cli/journey/journey-disable.js.map +1 -1
- package/esm/cli/journey/journey-enable.js +1 -4
- package/esm/cli/journey/journey-enable.js.map +1 -1
- package/esm/cli/journey/journey-export.js +7 -7
- package/esm/cli/journey/journey-export.js.map +1 -1
- package/esm/cli/journey/journey-import.js +9 -8
- package/esm/cli/journey/journey-import.js.map +1 -1
- package/esm/cli/journey/journey-list.js +4 -5
- package/esm/cli/journey/journey-list.js.map +1 -1
- package/esm/cli/journey/journey-prune.js +4 -5
- package/esm/cli/journey/journey-prune.js.map +1 -1
- package/esm/cli/log/log-fetch.js +7 -5
- package/esm/cli/log/log-fetch.js.map +1 -1
- package/esm/cli/log/log-key-delete.js +1 -4
- package/esm/cli/log/log-key-delete.js.map +1 -1
- package/esm/cli/log/log-key-describe.js +1 -4
- package/esm/cli/log/log-key-describe.js.map +1 -1
- package/esm/cli/log/log-key-list.js +1 -4
- package/esm/cli/log/log-key-list.js.map +1 -1
- package/esm/cli/log/log-list.js +13 -6
- package/esm/cli/log/log-list.js.map +1 -1
- package/esm/cli/log/log-tail.js +7 -5
- package/esm/cli/log/log-tail.js.map +1 -1
- package/esm/cli/oauth/oauth-client-delete.js +1 -4
- package/esm/cli/oauth/oauth-client-delete.js.map +1 -1
- package/esm/cli/oauth/oauth-client-describe.js +1 -4
- package/esm/cli/oauth/oauth-client-describe.js.map +1 -1
- package/esm/cli/oauth/oauth-client-export.js +7 -10
- package/esm/cli/oauth/oauth-client-export.js.map +1 -1
- package/esm/cli/oauth/oauth-client-import.js +9 -12
- package/esm/cli/oauth/oauth-client-import.js.map +1 -1
- package/esm/cli/oauth/oauth-client-list.js +3 -5
- package/esm/cli/oauth/oauth-client-list.js.map +1 -1
- package/esm/cli/realm/realm-add-custom-domain.js +2 -4
- package/esm/cli/realm/realm-add-custom-domain.js.map +1 -1
- package/esm/cli/realm/realm-describe.js +1 -3
- package/esm/cli/realm/realm-describe.js.map +1 -1
- package/esm/cli/realm/realm-list.js +1 -4
- package/esm/cli/realm/realm-list.js.map +1 -1
- package/esm/cli/realm/realm-remove-custom-domain.js +1 -3
- package/esm/cli/realm/realm-remove-custom-domain.js.map +1 -1
- package/esm/cli/saml/saml-cot-export.js +2 -4
- package/esm/cli/saml/saml-cot-export.js.map +1 -1
- package/esm/cli/saml/saml-cot-import.js +2 -4
- package/esm/cli/saml/saml-cot-import.js.map +1 -1
- package/esm/cli/saml/saml-cot-list.js +2 -4
- package/esm/cli/saml/saml-cot-list.js.map +1 -1
- package/esm/cli/saml/saml-delete.js +1 -3
- package/esm/cli/saml/saml-delete.js.map +1 -1
- package/esm/cli/saml/saml-describe.js +4 -5
- package/esm/cli/saml/saml-describe.js.map +1 -1
- package/esm/cli/saml/saml-export.js +8 -7
- package/esm/cli/saml/saml-export.js.map +1 -1
- package/esm/cli/saml/saml-import.js +10 -8
- package/esm/cli/saml/saml-import.js.map +1 -1
- package/esm/cli/saml/saml-list.js +4 -5
- package/esm/cli/saml/saml-list.js.map +1 -1
- package/esm/cli/saml/saml-metadata-export.js +12 -6
- package/esm/cli/saml/saml-metadata-export.js.map +1 -1
- package/esm/cli/script/script-delete.js +12 -8
- package/esm/cli/script/script-delete.js.map +1 -1
- package/esm/cli/script/script-describe.js +1 -4
- package/esm/cli/script/script-describe.js.map +1 -1
- package/esm/cli/script/script-export.js +10 -17
- package/esm/cli/script/script-export.js.map +1 -1
- package/esm/cli/script/script-import.js +21 -18
- package/esm/cli/script/script-import.js.map +1 -1
- package/esm/cli/script/script-list.js +2 -4
- package/esm/cli/script/script-list.js.map +1 -1
- package/esm/cli/service/service-delete.js +5 -6
- package/esm/cli/service/service-delete.js.map +1 -1
- package/esm/cli/service/service-export.js +7 -7
- package/esm/cli/service/service-export.js.map +1 -1
- package/esm/cli/service/service-import.js +9 -8
- package/esm/cli/service/service-import.js.map +1 -1
- package/esm/cli/service/service-list.js +3 -5
- package/esm/cli/service/service-list.js.map +1 -1
- package/esm/cli/shell/shell.js +3 -7
- package/esm/cli/shell/shell.js.map +1 -1
- package/esm/cli/theme/theme-delete.js +9 -8
- package/esm/cli/theme/theme-delete.js.map +1 -1
- package/esm/cli/theme/theme-export.js +10 -8
- package/esm/cli/theme/theme-export.js.map +1 -1
- package/esm/cli/theme/theme-import.js +12 -9
- package/esm/cli/theme/theme-import.js.map +1 -1
- package/esm/cli/theme/theme-list.js +4 -5
- package/esm/cli/theme/theme-list.js.map +1 -1
- package/esm/ops/AdminOps.js +790 -3
- package/esm/ops/AdminOps.js.map +1 -1
- package/esm/ops/AgentOps.js +638 -305
- package/esm/ops/AgentOps.js.map +1 -1
- package/esm/ops/ApplicationOps.js +91 -79
- package/esm/ops/ApplicationOps.js.map +1 -1
- package/esm/ops/AuthenticateOps.js +23 -0
- package/esm/ops/AuthenticateOps.js.map +1 -0
- package/esm/ops/AuthenticationSettingsOps.js +22 -23
- package/esm/ops/AuthenticationSettingsOps.js.map +1 -1
- package/esm/ops/CirclesOfTrustOps.js +52 -55
- package/esm/ops/CirclesOfTrustOps.js.map +1 -1
- package/esm/ops/ConfigOps.js +100 -84
- package/esm/ops/ConfigOps.js.map +1 -1
- package/esm/ops/ConnectionProfileOps.js +9 -7
- package/esm/ops/ConnectionProfileOps.js.map +1 -1
- package/esm/ops/EmailTemplateOps.js +64 -47
- package/esm/ops/EmailTemplateOps.js.map +1 -1
- package/esm/ops/IdmOps.js +149 -117
- package/esm/ops/IdmOps.js.map +1 -1
- package/esm/ops/IdpOps.js +76 -46
- package/esm/ops/IdpOps.js.map +1 -1
- package/esm/ops/JourneyOps.js +333 -238
- package/esm/ops/JourneyOps.js.map +1 -1
- package/esm/ops/LogOps.js +15 -23
- package/esm/ops/LogOps.js.map +1 -1
- package/esm/ops/OAuth2ClientOps.js +43 -36
- package/esm/ops/OAuth2ClientOps.js.map +1 -1
- package/esm/ops/PolicyOps.js +104 -108
- package/esm/ops/PolicyOps.js.map +1 -1
- package/esm/ops/PolicySetOps.js +72 -78
- package/esm/ops/PolicySetOps.js.map +1 -1
- package/esm/ops/ResourceTypeOps.js +84 -99
- package/esm/ops/ResourceTypeOps.js.map +1 -1
- package/esm/ops/Saml2Ops.js +132 -88
- package/esm/ops/Saml2Ops.js.map +1 -1
- package/esm/ops/ScriptOps.js +90 -80
- package/esm/ops/ScriptOps.js.map +1 -1
- package/esm/ops/ServiceOps.js +125 -87
- package/esm/ops/ServiceOps.js.map +1 -1
- package/esm/ops/ThemeOps.js +170 -139
- package/esm/ops/ThemeOps.js.map +1 -1
- package/esm/ops/{AdminFederationOps.js → cloud/AdminFederationOps.js} +10 -16
- package/esm/ops/cloud/AdminFederationOps.js.map +1 -0
- package/esm/ops/{SecretsOps.js → cloud/SecretsOps.js} +123 -129
- package/esm/ops/cloud/SecretsOps.js.map +1 -0
- package/esm/ops/{VariablesOps.js → cloud/VariablesOps.js} +48 -52
- package/esm/ops/cloud/VariablesOps.js.map +1 -0
- package/esm/ops/templates/OAuth2ClientTemplate.json +270 -0
- package/esm/ops/templates/OAuth2TrustedJwtIssuerTemplate.json +38 -0
- package/esm/ops/templates/OrgModelUserAttributesTemplate.json +149 -0
- package/esm/ops/templates/autoaccess/IPAddresses.json +202 -0
- package/esm/ops/templates/autoaccess/UserAgents.json +35 -0
- package/esm/ops/templates/autoaccess/Usernames.json +203 -0
- package/esm/ops/templates/cloud/GenericExtensionAttributesTemplate.json +392 -0
- package/esm/ops/templates/cloud/managed.json +4119 -0
- package/esm/ops/utils/OpsUtils.js.map +1 -1
- package/esm/utils/Console.js +31 -0
- package/esm/utils/Console.js.map +1 -1
- package/package.json +11 -6
- package/esm/ops/AdminFederationOps.js.map +0 -1
- package/esm/ops/SecretsOps.js.map +0 -1
- package/esm/ops/VariablesOps.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationOps.js","names":["frodo","state","fs","createProgressIndicator","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressIndicator","succeedSpinner","updateProgressIndicator","wordwrap","getTypedFilename","titleCase","getFilePath","getWorkingDirectory","saveJsonToFile","utils","readApplications","_readApplications","deleteApplicationByName","_deleteApplicationByName","deleteApplications","_deleteApplications","exportApplication","_exportApplication","exportApplicationByName","_exportApplicationByName","exportApplications","_exportApplications","importApplicationByName","_importApplicationByName","importFirstApplication","_importFirstApplication","importApplications","_importApplications","app","listApplications","long","applications","sort","a","b","name","localeCompare","table","hAlign","content","forEach","push","_id","templateName","templateVersion","authoritative","description","toString","error","deleteApplication","applicationName","deep","outcome","message","deleted","length","exportApplicationToFile","file","includeMeta","options","useStringArrays","deps","fileName","filePath","exportData","exportApplicationsToFile","getRealmName","getRealm","exportApplicationsToFiles","errors","barId","application","fileBarId","importApplicationFromFile","data","readFileSync","fileData","JSON","parse","importFirstApplicationFromFile","importApplicationsFromFile","applicationData","importApplicationsFromFiles","names","readdirSync","files","filter","toLowerCase","endsWith","map","total","count","Object","keys","managedApplication"],"sources":["../../src/ops/ApplicationOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport type {\n ApplicationExportInterface,\n ApplicationExportOptions,\n ApplicationImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/ApplicationOps';\nimport fs from 'fs';\n\nimport {\n createProgressIndicator,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressIndicator,\n succeedSpinner,\n updateProgressIndicator,\n} from '../utils/Console';\nimport wordwrap from './utils/Wordwrap';\n\nconst {\n getTypedFilename,\n titleCase,\n getFilePath,\n getWorkingDirectory,\n saveJsonToFile,\n} = frodo.utils;\nconst {\n readApplications: _readApplications,\n deleteApplicationByName: _deleteApplicationByName,\n deleteApplications: _deleteApplications,\n exportApplication: _exportApplication,\n exportApplicationByName: _exportApplicationByName,\n exportApplications: _exportApplications,\n importApplicationByName: _importApplicationByName,\n importFirstApplication: _importFirstApplication,\n importApplications: _importApplications,\n} = frodo.app;\n\n/**\n * List applications\n */\nexport async function listApplications(long = false) {\n try {\n const applications = await _readApplications();\n applications.sort((a, b) => a.name.localeCompare(b.name));\n if (long) {\n const table = createTable([\n 'Name',\n 'Id',\n 'Template',\n {\n hAlign: 'right',\n content: 'Version',\n },\n {\n hAlign: 'right',\n content: 'Authoritative',\n },\n 'Description',\n ]);\n applications.forEach((app) => {\n table.push([\n app.name,\n app._id,\n app.templateName,\n {\n hAlign: 'right',\n content: app.templateVersion,\n },\n {\n hAlign: 'right',\n content: app.authoritative,\n },\n wordwrap(app.description, 30),\n ]);\n });\n printMessage(table.toString(), 'data');\n } else {\n applications.forEach((app) => {\n printMessage(`${app.name}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing applications - ${error}`, 'error');\n }\n}\n\n/**\n * Delete application\n * @param {string} applicationName application name\n * @param {boolean} deep deep delete (include dependencies)\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteApplication(\n applicationName: string,\n deep: boolean\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.deleteApplication: begin`);\n showSpinner(`Deleting ${applicationName}...`);\n try {\n await _deleteApplicationByName(applicationName, deep);\n outcome = true;\n succeedSpinner(`Deleted ${applicationName}`);\n } catch (error) {\n failSpinner(`Error deleting ${applicationName}: ${error.message}`);\n }\n debugMessage(`cli.ApplicationOps.deleteApplication: end`);\n return outcome;\n}\n\n/**\n * Delete all applications\n * @param {boolean} deep deep delete (include dependencies)\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteApplications(deep: boolean): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.deleteApplications: begin`);\n showSpinner(`Deleting all applications...`);\n try {\n const deleted = await _deleteApplications(deep);\n outcome = true;\n succeedSpinner(`Deleted ${deleted.length} applications`);\n } catch (error) {\n failSpinner(`Error deleting applications: ${error.message}`);\n }\n debugMessage(`cli.ApplicationOps.deleteApplications: end`);\n return outcome;\n}\n\n/**\n * Export application to file\n * @param {string} applicationName application name\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationToFile(\n applicationName: string,\n file: string,\n includeMeta: boolean,\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n) {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.exportApplicationToFile: begin`);\n showSpinner(`Exporting ${applicationName}...`);\n try {\n let fileName = getTypedFilename(applicationName, 'application');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await _exportApplicationByName(applicationName, options);\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported ${applicationName} to ${filePath}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${applicationName}: ${error.message}`);\n }\n debugMessage(`cli.ApplicationOps.exportApplicationToFile: end`);\n return outcome;\n}\n\n/**\n * Export all applications to file\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationsToFile(\n file: string,\n includeMeta: boolean,\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.exportApplicationsToFile: begin`);\n showSpinner(`Exporting all applications...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(frodo.utils.getRealmName(state.getRealm()))}Applications`,\n 'application'\n );\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await _exportApplications(options);\n saveJsonToFile(exportData, filePath, includeMeta);\n succeedSpinner(`Exported all applications to ${filePath}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting all applications`);\n printMessage(`${error.message}`, 'error');\n }\n debugMessage(`cli.ApplicationOps.exportApplicationsToFile: end [${outcome}]`);\n return outcome;\n}\n\n/**\n * Export all applications to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationsToFiles(\n includeMeta: boolean,\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n) {\n debugMessage(`cli.ApplicationOps.exportApplicationsToFiles: begin`);\n const errors = [];\n let barId: string;\n try {\n const applications = await _readApplications();\n barId = createProgressIndicator(\n 'determinate',\n applications.length,\n 'Exporting applications...'\n );\n for (const application of applications) {\n const fileBarId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting application ${application.name}...`\n );\n const file = getFilePath(\n getTypedFilename(application.name, 'application'),\n true\n );\n try {\n updateProgressIndicator(barId, `Exporting ${application.name}.`);\n const exportData = await _exportApplication(application._id, options);\n saveJsonToFile(exportData, file, includeMeta);\n updateProgressIndicator(\n fileBarId,\n `Saving ${application.name} to ${file}.`\n );\n stopProgressIndicator(\n fileBarId,\n `${application.name} saved to ${file}.`\n );\n } catch (error) {\n errors.push(error);\n updateProgressIndicator(barId, `Error exporting ${application.name}.`);\n stopProgressIndicator(\n fileBarId,\n `Error saving ${application.name} to ${file}.`\n );\n }\n }\n stopProgressIndicator(barId, `Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressIndicator(barId, `Error exporting applications(s) to file(s)`);\n }\n debugMessage(`cli.ApplicationOps.exportApplicationsToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import application from file\n * @param {string} applicationName client id\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationFromFile(\n applicationName: string,\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.importApplicationFromFile: begin`);\n showSpinner(`Importing ${applicationName}...`);\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n await _importApplicationByName(applicationName, fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${applicationName}.`);\n } catch (error) {\n failSpinner(`Error importing ${applicationName}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importApplicationFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first application from file\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstApplicationFromFile(\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.importFirstApplicationFromFile: begin`);\n const filePath = getFilePath(file);\n showSpinner(`Importing ${filePath}...`);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const fileData = JSON.parse(data);\n await _importFirstApplication(fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${filePath}.`);\n } catch (error) {\n failSpinner(`Error importing ${filePath}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importFirstApplicationFromFile: end`);\n return outcome;\n}\n\n/**\n * Import applications from file\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationsFromFile(\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ApplicationOps.importApplicationsFromFile: begin`);\n const filePath = getFilePath(file);\n showSpinner(`Importing ${filePath}...`);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const applicationData = JSON.parse(data);\n await _importApplications(applicationData, options);\n outcome = true;\n succeedSpinner(`Imported ${filePath}.`);\n } catch (error) {\n failSpinner(`Error importing ${filePath}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importApplicationsFromFile: end`);\n return outcome;\n}\n\n/**\n * Import applications from files\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationsFromFiles(\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n const errors = [];\n let barId: string;\n try {\n debugMessage(`cli.ApplicationOps.importApplicationsFromFiles: begin`);\n const names = fs.readdirSync(getWorkingDirectory());\n const files = names\n .filter((name) => name.toLowerCase().endsWith('.application.json'))\n .map((name) => getFilePath(name));\n barId = createProgressIndicator(\n 'determinate',\n files.length,\n 'Importing applications...'\n );\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: ApplicationExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.managedApplication).length;\n total += count;\n await _importApplications(fileData, options);\n updateProgressIndicator(\n barId,\n `Imported ${count} application(s) from ${file}`\n );\n } catch (error) {\n errors.push(error);\n updateProgressIndicator(\n barId,\n `Error importing application(s) from ${file}`\n );\n printMessage(error, 'error');\n }\n }\n stopProgressIndicator(\n barId,\n `Finished importing ${total} application(s) from ${files.length} file(s).`\n );\n } catch (error) {\n errors.push(error);\n stopProgressIndicator(\n barId,\n `Error importing application(s) from file(s).`\n );\n printMessage(error, 'error');\n }\n debugMessage(`cli.ApplicationOps.importAppl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,CAACiD,QAAQ,EAAEjB,OAAO,CAAC;QAC5CzD,uBAAuB,CACrBoE,KAAK,EACJ,YAAWqB,KAAM,wBAAuBlC,IAAK,EAChD,CAAC;MACH,CAAC,CAAC,OAAOT,KAAK,EAAE;QACdqB,MAAM,CAAC5B,IAAI,CAACO,KAAK,CAAC;QAClB9C,uBAAuB,CACrBoE,KAAK,EACJ,uCAAsCb,IAAK,EAC9C,CAAC;QACD3D,YAAY,CAACkD,KAAK,EAAE,OAAO,CAAC;MAC9B;IACF;IACAhD,qBAAqB,CACnBsE,KAAK,EACJ,sBAAqBoB,KAAM,wBAAuBL,KAAK,CAAC9B,MAAO,WAClE,CAAC;EACH,CAAC,CAAC,OAAOP,KAAK,EAAE;IACdqB,MAAM,CAAC5B,IAAI,CAACO,KAAK,CAAC;IAClBhD,qBAAqB,CACnBsE,KAAK,EACJ,8CACH,CAAC;IACDxE,YAAY,CAACkD,KAAK,EAAE,OAAO,CAAC;EAC9B;EACApD,YAAY,CAAE,qDAAoD,CAAC;EACnE,OAAO,CAAC,KAAKyE,MAAM,CAACd,MAAM;AAC5B"}
|
|
1
|
+
{"version":3,"file":"ApplicationOps.js","names":["frodo","FrodoError","state","fs","createProgressIndicator","createTable","debugMessage","printError","printMessage","stopProgressIndicator","updateProgressIndicator","wordwrap","getTypedFilename","titleCase","getFilePath","getWorkingDirectory","saveJsonToFile","utils","readApplications","_readApplications","deleteApplicationByName","_deleteApplicationByName","deleteApplications","_deleteApplications","exportApplication","_exportApplication","exportApplicationByName","_exportApplicationByName","exportApplications","_exportApplications","importApplicationByName","_importApplicationByName","importFirstApplication","_importFirstApplication","importApplications","_importApplications","app","listApplications","long","applications","sort","a","b","name","localeCompare","table","hAlign","content","forEach","push","_id","templateName","templateVersion","authoritative","description","toString","error","deleteApplication","applicationName","deep","spinnerId","deleted","length","exportApplicationToFile","file","includeMeta","options","useStringArrays","deps","fileName","filePath","exportData","exportApplicationsToFile","getRealmName","getRealm","exportApplicationsToFiles","errors","totalBarId","application","fileBarId","importApplicationFromFile","data","readFileSync","fileData","JSON","parse","importFirstApplicationFromFile","importApplicationsFromFile","applicationData","importApplicationsFromFiles","barId","names","readdirSync","files","filter","toLowerCase","endsWith","map","total","count","Object","keys","managedApplication"],"sources":["../../src/ops/ApplicationOps.ts"],"sourcesContent":["import { frodo, FrodoError, state } from '@rockcarver/frodo-lib';\nimport type {\n ApplicationExportInterface,\n ApplicationExportOptions,\n ApplicationImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/ApplicationOps';\nimport fs from 'fs';\n\nimport {\n createProgressIndicator,\n createTable,\n debugMessage,\n printError,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\nimport wordwrap from './utils/Wordwrap';\n\nconst {\n getTypedFilename,\n titleCase,\n getFilePath,\n getWorkingDirectory,\n saveJsonToFile,\n} = frodo.utils;\nconst {\n readApplications: _readApplications,\n deleteApplicationByName: _deleteApplicationByName,\n deleteApplications: _deleteApplications,\n exportApplication: _exportApplication,\n exportApplicationByName: _exportApplicationByName,\n exportApplications: _exportApplications,\n importApplicationByName: _importApplicationByName,\n importFirstApplication: _importFirstApplication,\n importApplications: _importApplications,\n} = frodo.app;\n\n/**\n * List applications\n */\nexport async function listApplications(long = false): Promise<boolean> {\n try {\n const applications = await _readApplications();\n applications.sort((a, b) => a.name.localeCompare(b.name));\n if (long) {\n const table = createTable([\n 'Name',\n 'Id',\n 'Template',\n {\n hAlign: 'right',\n content: 'Version',\n },\n {\n hAlign: 'right',\n content: 'Authoritative',\n },\n 'Description',\n ]);\n applications.forEach((app) => {\n table.push([\n app.name,\n app._id,\n app.templateName,\n {\n hAlign: 'right',\n content: app.templateVersion,\n },\n {\n hAlign: 'right',\n content: app.authoritative,\n },\n wordwrap(app.description, 30),\n ]);\n });\n printMessage(table.toString(), 'data');\n } else {\n applications.forEach((app) => {\n printMessage(`${app.name}`, 'data');\n });\n }\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n\n/**\n * Delete application\n * @param {string} applicationName application name\n * @param {boolean} deep deep delete (include dependencies)\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteApplication(\n applicationName: string,\n deep: boolean\n): Promise<boolean> {\n let spinnerId: string;\n try {\n debugMessage(`cli.ApplicationOps.deleteApplication: begin`);\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Deleting ${applicationName}...`\n );\n await _deleteApplicationByName(applicationName, deep);\n stopProgressIndicator(spinnerId, `Deleted ${applicationName}`, 'success');\n debugMessage(`cli.ApplicationOps.deleteApplication: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error deleting ${applicationName}`,\n 'fail'\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Delete all applications\n * @param {boolean} deep deep delete (include dependencies)\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteApplications(deep: boolean): Promise<boolean> {\n let spinnerId: string;\n try {\n debugMessage(`cli.ApplicationOps.deleteApplications: begin`);\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Deleting applications...`\n );\n const deleted = await _deleteApplications(deep);\n stopProgressIndicator(\n spinnerId,\n `Deleted ${deleted.length} applications`,\n 'success'\n );\n debugMessage(`cli.ApplicationOps.deleteApplications: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(spinnerId, `Error deleting applications`, 'fail');\n printError(error);\n }\n return false;\n}\n\n/**\n * Export application to file\n * @param {string} applicationName application name\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationToFile(\n applicationName: string,\n file: string,\n includeMeta: boolean,\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n) {\n let spinnerId: string;\n try {\n debugMessage(`cli.ApplicationOps.exportApplicationToFile: begin`);\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Exporting ${applicationName}...`\n );\n let fileName = getTypedFilename(applicationName, 'application');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await _exportApplicationByName(applicationName, options);\n saveJsonToFile(exportData, filePath, includeMeta);\n stopProgressIndicator(\n spinnerId,\n `Exported ${applicationName} to ${filePath}.`,\n 'success'\n );\n debugMessage(`cli.ApplicationOps.exportApplicationToFile: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error exporting ${applicationName}`,\n 'fail'\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Export all applications to file\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationsToFile(\n file: string,\n includeMeta: boolean,\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n): Promise<boolean> {\n let spinnerId: string;\n try {\n debugMessage(`cli.ApplicationOps.exportApplicationsToFile: begin`);\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Exporting applications...`\n );\n let fileName = getTypedFilename(\n `all${titleCase(frodo.utils.getRealmName(state.getRealm()))}Applications`,\n 'application'\n );\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await _exportApplications(options);\n saveJsonToFile(exportData, filePath, includeMeta);\n stopProgressIndicator(\n spinnerId,\n `Exported applications to ${filePath}.`,\n 'success'\n );\n debugMessage(`cli.ApplicationOps.exportApplicationsToFile: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(spinnerId, `Error exporting applications`, 'fail');\n printError(error);\n }\n return false;\n}\n\n/**\n * Export all applications to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @param {ApplicationExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportApplicationsToFiles(\n includeMeta: boolean,\n options: ApplicationExportOptions = { useStringArrays: true, deps: true }\n) {\n debugMessage(`cli.ApplicationOps.exportApplicationsToFiles: begin`);\n const errors: Error[] = [];\n let totalBarId: string;\n try {\n const applications = await _readApplications();\n totalBarId = createProgressIndicator(\n 'determinate',\n applications.length,\n 'Exporting applications...'\n );\n for (const application of applications) {\n const fileBarId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting application ${application.name}...`\n );\n const file = getFilePath(\n getTypedFilename(application.name, 'application'),\n true\n );\n try {\n updateProgressIndicator(totalBarId, `Exporting ${application.name}.`);\n const exportData = await _exportApplication(application._id, options);\n saveJsonToFile(exportData, file, includeMeta);\n updateProgressIndicator(\n fileBarId,\n `Saving ${application.name} to ${file}.`\n );\n stopProgressIndicator(\n fileBarId,\n `${application.name} saved to ${file}.`\n );\n } catch (error) {\n errors.push(error);\n updateProgressIndicator(\n totalBarId,\n `Error exporting ${application.name}.`\n );\n stopProgressIndicator(\n fileBarId,\n `Error saving ${application.name} to ${file}.`,\n 'fail'\n );\n }\n }\n stopProgressIndicator(totalBarId, `Export complete.`);\n if (errors.length > 0) {\n throw new FrodoError(\n `Error exporting applications(s) to file(s)`,\n errors\n );\n }\n debugMessage(`cli.ApplicationOps.exportApplicationsToFiles: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(\n totalBarId,\n `Error exporting applications(s) to file(s)`,\n 'fail'\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Import application from file\n * @param {string} applicationName client id\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationFromFile(\n applicationName: string,\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let spinnerId: string;\n try {\n debugMessage(`cli.ApplicationOps.importApplicationFromFile: begin`);\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Exporting applications...`\n );\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n await _importApplicationByName(applicationName, fileData, options);\n stopProgressIndicator(spinnerId, `Imported ${applicationName}`, 'success');\n debugMessage(`cli.ApplicationOps.importApplicationFromFile: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error importing ${applicationName}`,\n 'fail'\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Import first application from file\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstApplicationFromFile(\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let spinnerId: string;\n try {\n debugMessage(`cli.ApplicationOps.importFirstApplicationFromFile: begin`);\n const filePath = getFilePath(file);\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${filePath}...`\n );\n const data = fs.readFileSync(filePath, 'utf8');\n const fileData = JSON.parse(data);\n await _importFirstApplication(fileData, options);\n stopProgressIndicator(spinnerId, `Imported ${filePath}`, 'success');\n debugMessage(`cli.ApplicationOps.importFirstApplicationFromFile: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error importing first application`,\n 'fail'\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Import applications from file\n * @param {string} file file name\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationsFromFile(\n file: string,\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n let spinnerId: string;\n try {\n debugMessage(`cli.ApplicationOps.importApplicationsFromFile: begin`);\n const filePath = getFilePath(file);\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing ${filePath}...`\n );\n const data = fs.readFileSync(filePath, 'utf8');\n const applicationData = JSON.parse(data);\n await _importApplications(applicationData, options);\n stopProgressIndicator(spinnerId, `Imported ${filePath}`, 'success');\n debugMessage(`cli.ApplicationOps.importApplicationsFromFile: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error importing first application`,\n 'fail'\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Import applications from files\n * @param {ApplicationImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importApplicationsFromFiles(\n options: ApplicationImportOptions = { deps: true }\n): Promise<boolean> {\n const errors = [];\n let barId: string;\n try {\n debugMessage(`cli.ApplicationOps.importApplicationsFromFiles: begin`);\n const names = fs.readdirSync(getWorkingDirectory());\n const files = names\n .filter((name) => name.toLowerCase().endsWith('.application.json'))\n .map((name) => getFilePath(name));\n barId = createProgressIndicator(\n 'determinate',\n files.length,\n 'Importing applications...'\n );\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: ApplicationExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.managedApplication).length;\n total += count;\n await _importApplications(fileData, options);\n updateProgressIndicator(\n barId,\n `Imported ${count} application(s) from ${file}`\n );\n } catch (error) {\n errors.push(error);\n updateProgressIndicator(\n barId,\n `Error importing application(s) from ${file}`\n );\n printMessage(error, 'error');\n }\n }\n if (errors.length > 0) {\n throw new FrodoError(`Error importing applications`, errors);\n }\n stopProgressIndicator(\n barId,\n `Finished importing ${total} application(s) from ${files.length} file(s).`\n );\n debugMessage(`cli.ApplicationOps.importApplicationsFromFiles: end`);\n return true;\n } catch (error) {\n stopProgressIndicator(barId, `Error importing applications`);\n printMessage(error, 'error');\n }\n return false;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,UAAU,EAAEC,KAAK,QAAQ,uBAAuB;AAMhE,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,uBAAuB,EACvBC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AACzB,OAAOC,QAAQ,MAAM,kBAAkB;AAEvC,MAAM;EACJC,gBAAgB;EAChBC,SAAS;EACTC,WAAW;EACXC,mBAAmB;EACnBC;AACF,CAAC,GAAGhB,KAAK,CAACiB,KAAK;AACf,MAAM;EACJC,gBAAgB,EAAEC,iBAAiB;EAC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E,mBAAmB,CAACgD,QAAQ,EAAEjB,OAAO,CAAC;QAC5CxD,uBAAuB,CACrBgF,KAAK,EACJ,YAAWS,KAAM,wBAAuBnC,IAAK,EAChD,CAAC;MACH,CAAC,CAAC,OAAOR,KAAK,EAAE;QACdoB,MAAM,CAAC3B,IAAI,CAACO,KAAK,CAAC;QAClB9C,uBAAuB,CACrBgF,KAAK,EACJ,uCAAsC1B,IAAK,EAC9C,CAAC;QACDxD,YAAY,CAACgD,KAAK,EAAE,OAAO,CAAC;MAC9B;IACF;IACA,IAAIoB,MAAM,CAACd,MAAM,GAAG,CAAC,EAAE;MACrB,MAAM,IAAI7D,UAAU,CAAE,8BAA6B,EAAE2E,MAAM,CAAC;IAC9D;IACAnE,qBAAqB,CACnBiF,KAAK,EACJ,sBAAqBQ,KAAM,wBAAuBL,KAAK,CAAC/B,MAAO,WAClE,CAAC;IACDxD,YAAY,CAAE,qDAAoD,CAAC;IACnE,OAAO,IAAI;EACb,CAAC,CAAC,OAAOkD,KAAK,EAAE;IACd/C,qBAAqB,CAACiF,KAAK,EAAG,8BAA6B,CAAC;IAC5DlF,YAAY,CAACgD,KAAK,EAAE,OAAO,CAAC;EAC9B;EACA,OAAO,KAAK;AACd"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { frodo, state } from '@rockcarver/frodo-lib';
|
|
2
|
+
import readlineSync from 'readline-sync';
|
|
3
|
+
import { printError, printMessage } from '../utils/Console';
|
|
4
|
+
const {
|
|
5
|
+
getTokens: _getTokens
|
|
6
|
+
} = frodo.login;
|
|
7
|
+
const otpCallbackHandler = callback => {
|
|
8
|
+
if (callback.type != 'NameCallback') throw new Error(`Unsupported callback: ${callback.type}`);
|
|
9
|
+
printMessage(`Multi-factor authentication is enabled and required for this user.`);
|
|
10
|
+
callback.input[0].value = readlineSync.question(`${callback.output[0].value}: `);
|
|
11
|
+
return callback;
|
|
12
|
+
};
|
|
13
|
+
export async function getTokens(forceLoginAsUser, autoRefresh) {
|
|
14
|
+
try {
|
|
15
|
+
const tokens = await _getTokens(forceLoginAsUser, autoRefresh, otpCallbackHandler);
|
|
16
|
+
printMessage(`Connected to ${state.getHost()} [${state.getRealm() ? state.getRealm() : 'root'}] as ${tokens.subject}`, 'info');
|
|
17
|
+
return true;
|
|
18
|
+
} catch (error) {
|
|
19
|
+
printError(error);
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=AuthenticateOps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthenticateOps.js","names":["frodo","state","readlineSync","printError","printMessage","getTokens","_getTokens","login","otpCallbackHandler","callback","type","Error","input","value","question","output","forceLoginAsUser","autoRefresh","tokens","getHost","getRealm","subject","error"],"sources":["../../src/ops/AuthenticateOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport {\n Callback,\n CallbackHandler,\n} from '@rockcarver/frodo-lib/types/ops/CallbackOps';\nimport readlineSync from 'readline-sync';\n\nimport { printError, printMessage } from '../utils/Console';\n\nconst { getTokens: _getTokens } = frodo.login;\n\nconst otpCallbackHandler: CallbackHandler = (callback: Callback) => {\n if (callback.type != 'NameCallback')\n throw new Error(`Unsupported callback: ${callback.type}`);\n printMessage(\n `Multi-factor authentication is enabled and required for this user.`\n );\n callback.input[0].value = readlineSync.question(\n `${callback.output[0].value}: `\n );\n return callback;\n};\n\nexport async function getTokens(\n forceLoginAsUser?: boolean,\n autoRefresh?: boolean\n): Promise<boolean> {\n try {\n const tokens = await _getTokens(\n forceLoginAsUser,\n autoRefresh,\n otpCallbackHandler\n );\n printMessage(\n `Connected to ${state.getHost()} [${\n state.getRealm() ? state.getRealm() : 'root'\n }] as ${tokens.subject}`,\n 'info'\n );\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAKpD,OAAOC,YAAY,MAAM,eAAe;AAExC,SAASC,UAAU,EAAEC,YAAY,QAAQ,kBAAkB;AAE3D,MAAM;EAAEC,SAAS,EAAEC;AAAW,CAAC,GAAGN,KAAK,CAACO,KAAK;AAE7C,MAAMC,kBAAmC,GAAIC,QAAkB,IAAK;EAClE,IAAIA,QAAQ,CAACC,IAAI,IAAI,cAAc,EACjC,MAAM,IAAIC,KAAK,CAAE,yBAAwBF,QAAQ,CAACC,IAAK,EAAC,CAAC;EAC3DN,YAAY,CACT,oEACH,CAAC;EACDK,QAAQ,CAACG,KAAK,CAAC,CAAC,CAAC,CAACC,KAAK,GAAGX,YAAY,CAACY,QAAQ,CAC5C,GAAEL,QAAQ,CAACM,MAAM,CAAC,CAAC,CAAC,CAACF,KAAM,IAC9B,CAAC;EACD,OAAOJ,QAAQ;AACjB,CAAC;AAED,OAAO,eAAeJ,SAASA,CAC7BW,gBAA0B,EAC1BC,WAAqB,EACH;EAClB,IAAI;IACF,MAAMC,MAAM,GAAG,MAAMZ,UAAU,CAC7BU,gBAAgB,EAChBC,WAAW,EACXT,kBACF,CAAC;IACDJ,YAAY,CACT,gBAAeH,KAAK,CAACkB,OAAO,CAAC,CAAE,KAC9BlB,KAAK,CAACmB,QAAQ,CAAC,CAAC,GAAGnB,KAAK,CAACmB,QAAQ,CAAC,CAAC,GAAG,MACvC,QAAOF,MAAM,CAACG,OAAQ,EAAC,EACxB,MACF,CAAC;IACD,OAAO,IAAI;EACb,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdnB,UAAU,CAACmB,KAAK,CAAC;EACnB;EACA,OAAO,KAAK;AACd"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { frodo, state } from '@rockcarver/frodo-lib';
|
|
2
2
|
import fs from 'fs';
|
|
3
|
-
import { createObjectTable, debugMessage,
|
|
3
|
+
import { createObjectTable, createProgressIndicator, debugMessage, printError, printMessage, stopProgressIndicator } from '../utils/Console';
|
|
4
4
|
const {
|
|
5
5
|
saveJsonToFile,
|
|
6
6
|
getTypedFilename,
|
|
@@ -19,10 +19,10 @@ const {
|
|
|
19
19
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
20
20
|
*/
|
|
21
21
|
export async function exportAuthenticationSettingsToFile(file, includeMeta = true) {
|
|
22
|
-
let
|
|
23
|
-
debugMessage(`cli.AuthenticationSettingsOps.exportAuthenticationSettingsToFile: begin`);
|
|
24
|
-
showSpinner(`Exporting ${frodo.utils.getRealmName(state.getRealm())} realm authentication settings...`);
|
|
22
|
+
let spinnerId;
|
|
25
23
|
try {
|
|
24
|
+
debugMessage(`cli.AuthenticationSettingsOps.exportAuthenticationSettingsToFile: begin`);
|
|
25
|
+
spinnerId = createProgressIndicator('indeterminate', 0, `Exporting authentication settings...`);
|
|
26
26
|
let fileName = getTypedFilename(`${frodo.utils.getRealmName(state.getRealm())}Realm`, 'authentication.settings');
|
|
27
27
|
if (file) {
|
|
28
28
|
fileName = file;
|
|
@@ -30,13 +30,14 @@ export async function exportAuthenticationSettingsToFile(file, includeMeta = tru
|
|
|
30
30
|
const filePath = getFilePath(fileName, true);
|
|
31
31
|
const exportData = await _exportAuthenticationSettings();
|
|
32
32
|
saveJsonToFile(exportData, filePath, includeMeta);
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
stopProgressIndicator(spinnerId, `Exported ${frodo.utils.getRealmName(state.getRealm())} realm authentication settings to ${filePath}.`, 'success');
|
|
34
|
+
debugMessage(`cli.AuthenticationSettingsOps.exportAuthenticationSettingsToFile: end`);
|
|
35
|
+
return true;
|
|
35
36
|
} catch (error) {
|
|
36
|
-
|
|
37
|
+
stopProgressIndicator(spinnerId, `Error exporting authentication settings`, 'fail');
|
|
38
|
+
printError(error);
|
|
37
39
|
}
|
|
38
|
-
|
|
39
|
-
return outcome;
|
|
40
|
+
return false;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
/**
|
|
@@ -45,21 +46,21 @@ export async function exportAuthenticationSettingsToFile(file, includeMeta = tru
|
|
|
45
46
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
46
47
|
*/
|
|
47
48
|
export async function importAuthenticationSettingsFromFile(file) {
|
|
48
|
-
let
|
|
49
|
-
debugMessage(`cli.AuthenticationSettingsOps.importAuthenticationSettingsFromFile: begin`);
|
|
50
|
-
showSpinner(`Importing ${frodo.utils.getRealmName(state.getRealm())} realm authentication settings...`);
|
|
49
|
+
let spinnerId;
|
|
51
50
|
try {
|
|
51
|
+
debugMessage(`cli.AuthenticationSettingsOps.importAuthenticationSettingsFromFile: begin`);
|
|
52
|
+
spinnerId = createProgressIndicator('indeterminate', 0, `Importing authentication settings...`);
|
|
52
53
|
const data = fs.readFileSync(getFilePath(file), 'utf8');
|
|
53
54
|
const fileData = JSON.parse(data);
|
|
54
55
|
await _importAuthenticationSettings(fileData);
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
stopProgressIndicator(spinnerId, `Imported ${frodo.utils.getRealmName(state.getRealm())} realm authentication settings.`, 'success');
|
|
57
|
+
debugMessage(`cli.AuthenticationSettingsOps.importAuthenticationSettingsFromFile: end`);
|
|
58
|
+
return true;
|
|
57
59
|
} catch (error) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
stopProgressIndicator(spinnerId, `Error importing authentication settings`, 'fail');
|
|
61
|
+
printError(error);
|
|
60
62
|
}
|
|
61
|
-
|
|
62
|
-
return outcome;
|
|
63
|
+
return false;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
/**
|
|
@@ -68,7 +69,6 @@ export async function importAuthenticationSettingsFromFile(file) {
|
|
|
68
69
|
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
69
70
|
*/
|
|
70
71
|
export async function describeAuthenticationSettings(json = false) {
|
|
71
|
-
let outcome = false;
|
|
72
72
|
try {
|
|
73
73
|
const settings = await _readAuthenticationSettings();
|
|
74
74
|
delete settings._id;
|
|
@@ -76,15 +76,14 @@ export async function describeAuthenticationSettings(json = false) {
|
|
|
76
76
|
delete settings._type;
|
|
77
77
|
if (json) {
|
|
78
78
|
printMessage(settings, 'data');
|
|
79
|
-
outcome = true;
|
|
80
79
|
} else {
|
|
81
80
|
const table = createObjectTable(settings);
|
|
82
81
|
printMessage(table.toString(), 'data');
|
|
83
|
-
outcome = true;
|
|
84
82
|
}
|
|
83
|
+
return true;
|
|
85
84
|
} catch (error) {
|
|
86
|
-
|
|
85
|
+
printError(error);
|
|
87
86
|
}
|
|
88
|
-
return
|
|
87
|
+
return false;
|
|
89
88
|
}
|
|
90
89
|
//# sourceMappingURL=AuthenticationSettingsOps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticationSettingsOps.js","names":["frodo","state","fs","createObjectTable","
|
|
1
|
+
{"version":3,"file":"AuthenticationSettingsOps.js","names":["frodo","state","fs","createObjectTable","createProgressIndicator","debugMessage","printError","printMessage","stopProgressIndicator","saveJsonToFile","getTypedFilename","getFilePath","utils","exportAuthenticationSettings","_exportAuthenticationSettings","importAuthenticationSettings","_importAuthenticationSettings","readAuthenticationSettings","_readAuthenticationSettings","authn","settings","exportAuthenticationSettingsToFile","file","includeMeta","spinnerId","fileName","getRealmName","getRealm","filePath","exportData","error","importAuthenticationSettingsFromFile","data","readFileSync","fileData","JSON","parse","describeAuthenticationSettings","json","_id","_rev","_type","table","toString"],"sources":["../../src/ops/AuthenticationSettingsOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\n\nimport {\n createObjectTable,\n createProgressIndicator,\n debugMessage,\n printError,\n printMessage,\n stopProgressIndicator,\n} from '../utils/Console';\n\nconst { saveJsonToFile, getTypedFilename, getFilePath } = frodo.utils;\nconst {\n exportAuthenticationSettings: _exportAuthenticationSettings,\n importAuthenticationSettings: _importAuthenticationSettings,\n readAuthenticationSettings: _readAuthenticationSettings,\n} = frodo.authn.settings;\n\n/**\n * Export authentication settings to file\n * @param {string} file file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportAuthenticationSettingsToFile(\n file: string,\n includeMeta = true\n): Promise<boolean> {\n let spinnerId: string;\n try {\n debugMessage(\n `cli.AuthenticationSettingsOps.exportAuthenticationSettingsToFile: begin`\n );\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Exporting authentication settings...`\n );\n let fileName = getTypedFilename(\n `${frodo.utils.getRealmName(state.getRealm())}Realm`,\n 'authentication.settings'\n );\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await _exportAuthenticationSettings();\n saveJsonToFile(exportData, filePath, includeMeta);\n stopProgressIndicator(\n spinnerId,\n `Exported ${frodo.utils.getRealmName(\n state.getRealm()\n )} realm authentication settings to ${filePath}.`,\n 'success'\n );\n debugMessage(\n `cli.AuthenticationSettingsOps.exportAuthenticationSettingsToFile: end`\n );\n return true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error exporting authentication settings`,\n 'fail'\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Import authentication settings from file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importAuthenticationSettingsFromFile(\n file: string\n): Promise<boolean> {\n let spinnerId: string;\n try {\n debugMessage(\n `cli.AuthenticationSettingsOps.importAuthenticationSettingsFromFile: begin`\n );\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n `Importing authentication settings...`\n );\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const fileData = JSON.parse(data);\n await _importAuthenticationSettings(fileData);\n stopProgressIndicator(\n spinnerId,\n `Imported ${frodo.utils.getRealmName(\n state.getRealm()\n )} realm authentication settings.`,\n 'success'\n );\n debugMessage(\n `cli.AuthenticationSettingsOps.importAuthenticationSettingsFromFile: end`\n );\n return true;\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error importing authentication settings`,\n 'fail'\n );\n printError(error);\n }\n return false;\n}\n\n/**\n * Describe authentication settings\n * @param {boolean} json JSON output\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describeAuthenticationSettings(\n json = false\n): Promise<boolean> {\n try {\n const settings = await _readAuthenticationSettings();\n delete settings._id;\n delete settings._rev;\n delete settings._type;\n if (json) {\n printMessage(settings, 'data');\n } else {\n const table = createObjectTable(settings);\n printMessage(table.toString(), 'data');\n }\n return true;\n } catch (error) {\n printError(error);\n }\n return false;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,iBAAiB,EACjBC,uBAAuB,EACvBC,YAAY,EACZC,UAAU,EACVC,YAAY,EACZC,qBAAqB,QAChB,kBAAkB;AAEzB,MAAM;EAAEC,cAAc;EAAEC,gBAAgB;EAAEC;AAAY,CAAC,GAAGX,KAAK,CAACY,KAAK;AACrE,MAAM;EACJC,4BAA4B,EAAEC,6BAA6B;EAC3DC,4BAA4B,EAAEC,6BAA6B;EAC3DC,0BAA0B,EAAEC;AAC9B,CAAC,GAAGlB,KAAK,CAACmB,KAAK,CAACC,QAAQ;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,kCAAkCA,CACtDC,IAAY,EACZC,WAAW,GAAG,IAAI,EACA;EAClB,IAAIC,SAAiB;EACrB,IAAI;IACFnB,YAAY,CACT,yEACH,CAAC;IACDmB,SAAS,GAAGpB,uBAAuB,CACjC,eAAe,EACf,CAAC,EACA,sCACH,CAAC;IACD,IAAIqB,QAAQ,GAAGf,gBAAgB,CAC5B,GAAEV,KAAK,CAACY,KAAK,CAACc,YAAY,CAACzB,KAAK,CAAC0B,QAAQ,CAAC,CAAC,CAAE,OAAM,EACpD,yBACF,CAAC;IACD,IAAIL,IAAI,EAAE;MACRG,QAAQ,GAAGH,IAAI;IACjB;IACA,MAAMM,QAAQ,GAAGjB,WAAW,CAACc,QAAQ,EAAE,IAAI,CAAC;IAC5C,MAAMI,UAAU,GAAG,MAAMf,6BAA6B,CAAC,CAAC;IACxDL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BA,CAClDC,IAAI,GAAG,KAAK,EACM;EAClB,IAAI;IACF,MAAMlB,QAAQ,GAAG,MAAMF,2BAA2B,CAAC,CAAC;IACpD,OAAOE,QAAQ,CAACmB,GAAG;IACnB,OAAOnB,QAAQ,CAACoB,IAAI;IACpB,OAAOpB,QAAQ,CAACqB,KAAK;IACrB,IAAIH,IAAI,EAAE;MACR/B,YAAY,CAACa,QAAQ,EAAE,MAAM,CAAC;IAChC,CAAC,MAAM;MACL,MAAMsB,KAAK,GAAGvC,iBAAiB,CAACiB,QAAQ,CAAC;MACzCb,YAAY,CAACmC,KAAK,CAACC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACxC;IACA,OAAO,IAAI;EACb,CAAC,CAAC,OAAOb,KAAK,EAAE;IACdxB,UAAU,CAACwB,KAAK,CAAC;EACnB;EACA,OAAO,KAAK;AACd"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { frodo, state } from '@rockcarver/frodo-lib';
|
|
1
|
+
import { frodo, FrodoError, state } from '@rockcarver/frodo-lib';
|
|
2
2
|
import fs from 'fs';
|
|
3
|
-
import { createProgressIndicator, createTable, debugMessage, printMessage, stopProgressIndicator, updateProgressIndicator } from '../utils/Console';
|
|
3
|
+
import { createProgressIndicator, createTable, debugMessage, printError, printMessage, stopProgressIndicator, updateProgressIndicator } from '../utils/Console';
|
|
4
4
|
const {
|
|
5
5
|
getRealmName,
|
|
6
6
|
getTypedFilename,
|
|
@@ -54,29 +54,27 @@ export function getTableRowMd(cotObj) {
|
|
|
54
54
|
* @param {String} long Long list format with details
|
|
55
55
|
*/
|
|
56
56
|
export async function listCirclesOfTrust(long = false) {
|
|
57
|
-
let outcome = false;
|
|
58
57
|
let cotList = [];
|
|
59
58
|
try {
|
|
60
59
|
cotList = await readCirclesOfTrust();
|
|
60
|
+
cotList.sort((a, b) => a._id.localeCompare(b._id));
|
|
61
|
+
if (!long) {
|
|
62
|
+
cotList.forEach(cot => {
|
|
63
|
+
printMessage(`${cot._id}`, 'data');
|
|
64
|
+
});
|
|
65
|
+
return true;
|
|
66
|
+
} else {
|
|
67
|
+
const table = createTable(['Name'['brightCyan'], 'Description'['brightCyan'], 'Status'['brightCyan'], 'Trusted Providers'['brightCyan']]);
|
|
68
|
+
cotList.forEach(cot => {
|
|
69
|
+
table.push([cot._id, cot.description, cot.status, cot.trustedProviders.map(provider => provider.split('|')[0]).join('\n')]);
|
|
70
|
+
});
|
|
71
|
+
printMessage(table.toString(), 'data');
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
61
74
|
} catch (error) {
|
|
62
|
-
|
|
63
|
-
printMessage(error, 'data');
|
|
64
|
-
}
|
|
65
|
-
cotList.sort((a, b) => a._id.localeCompare(b._id));
|
|
66
|
-
if (!long) {
|
|
67
|
-
cotList.forEach(cot => {
|
|
68
|
-
printMessage(`${cot._id}`, 'data');
|
|
69
|
-
});
|
|
70
|
-
outcome = true;
|
|
71
|
-
} else {
|
|
72
|
-
const table = createTable(['Name'['brightCyan'], 'Description'['brightCyan'], 'Status'['brightCyan'], 'Trusted Providers'['brightCyan']]);
|
|
73
|
-
cotList.forEach(cot => {
|
|
74
|
-
table.push([cot._id, cot.description, cot.status, cot.trustedProviders.map(provider => provider.split('|')[0]).join('\n')]);
|
|
75
|
-
});
|
|
76
|
-
printMessage(table.toString(), 'data');
|
|
77
|
-
outcome = true;
|
|
75
|
+
printError(error);
|
|
78
76
|
}
|
|
79
|
-
return
|
|
77
|
+
return false;
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
/**
|
|
@@ -86,7 +84,6 @@ export async function listCirclesOfTrust(long = false) {
|
|
|
86
84
|
* @param {boolean} includeMeta true to include metadata, false otherwise. Default: true
|
|
87
85
|
*/
|
|
88
86
|
export async function exportCircleOfTrustToFile(cotId, file = null, includeMeta = true) {
|
|
89
|
-
let outcome = false;
|
|
90
87
|
debugMessage(`cli.CirclesOfTrustOps.exportCircleOfTrustToFile: begin`);
|
|
91
88
|
const indicatorId = createProgressIndicator('indeterminate', 0, `Exporting ${cotId}...`);
|
|
92
89
|
try {
|
|
@@ -98,12 +95,13 @@ export async function exportCircleOfTrustToFile(cotId, file = null, includeMeta
|
|
|
98
95
|
const exportData = await exportCircleOfTrust(cotId);
|
|
99
96
|
saveJsonToFile(exportData, filePath, includeMeta);
|
|
100
97
|
stopProgressIndicator(indicatorId, `Exported ${cotId} to ${filePath}.`, 'success');
|
|
101
|
-
|
|
98
|
+
return true;
|
|
102
99
|
} catch (error) {
|
|
103
|
-
stopProgressIndicator(indicatorId, `Error exporting ${cotId}
|
|
100
|
+
stopProgressIndicator(indicatorId, `Error exporting ${cotId}`, 'fail');
|
|
101
|
+
printError(error);
|
|
104
102
|
}
|
|
105
103
|
debugMessage(`cli.CirclesOfTrustOps.exportCircleOfTrustToFile: end`);
|
|
106
|
-
return
|
|
104
|
+
return false;
|
|
107
105
|
}
|
|
108
106
|
|
|
109
107
|
/**
|
|
@@ -112,7 +110,6 @@ export async function exportCircleOfTrustToFile(cotId, file = null, includeMeta
|
|
|
112
110
|
* @param {boolean} includeMeta true to include metadata, false otherwise. Default: true
|
|
113
111
|
*/
|
|
114
112
|
export async function exportCirclesOfTrustToFile(file = null, includeMeta = true) {
|
|
115
|
-
let outcome = false;
|
|
116
113
|
debugMessage(`cli.CirclesOfTrustOps.exportCirclesOfTrustToFile: begin`);
|
|
117
114
|
const indicatorId = createProgressIndicator('indeterminate', 0, `Exporting all circles of trust...`);
|
|
118
115
|
try {
|
|
@@ -124,12 +121,13 @@ export async function exportCirclesOfTrustToFile(file = null, includeMeta = true
|
|
|
124
121
|
const exportData = await exportCirclesOfTrust();
|
|
125
122
|
saveJsonToFile(exportData, filePath, includeMeta);
|
|
126
123
|
stopProgressIndicator(indicatorId, `Exported all circles of trust to ${filePath}.`, 'success');
|
|
127
|
-
|
|
124
|
+
return true;
|
|
128
125
|
} catch (error) {
|
|
129
|
-
stopProgressIndicator(indicatorId, `Error exporting circles of trust
|
|
126
|
+
stopProgressIndicator(indicatorId, `Error exporting circles of trust`, 'fail');
|
|
127
|
+
printError(error);
|
|
130
128
|
}
|
|
131
129
|
debugMessage(`cli.CirclesOfTrustOps.exportCirclesOfTrustToFile: end`);
|
|
132
|
-
return
|
|
130
|
+
return false;
|
|
133
131
|
}
|
|
134
132
|
|
|
135
133
|
/**
|
|
@@ -154,13 +152,17 @@ export async function exportCirclesOfTrustToFiles(includeMeta = true) {
|
|
|
154
152
|
updateProgressIndicator(indicatorId, `Error exporting ${cot.name}.`);
|
|
155
153
|
}
|
|
156
154
|
}
|
|
155
|
+
if (errors.length > 0) {
|
|
156
|
+
throw new FrodoError(`Error exporting circles of trust`, errors);
|
|
157
|
+
}
|
|
157
158
|
stopProgressIndicator(indicatorId, `Export complete.`);
|
|
159
|
+
return true;
|
|
158
160
|
} catch (error) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
stopProgressIndicator(indicatorId, `Error exporting circles of trust`, 'fail');
|
|
162
|
+
printError(error);
|
|
161
163
|
}
|
|
162
164
|
debugMessage(`cli.CirclesOfTrustOps.exportCirclesOfTrustToFiles: end`);
|
|
163
|
-
return
|
|
165
|
+
return false;
|
|
164
166
|
}
|
|
165
167
|
|
|
166
168
|
/**
|
|
@@ -169,21 +171,19 @@ export async function exportCirclesOfTrustToFiles(includeMeta = true) {
|
|
|
169
171
|
* @param {String} file Import file name
|
|
170
172
|
*/
|
|
171
173
|
export async function importCircleOfTrustFromFile(cotId, file) {
|
|
172
|
-
let outcome = false;
|
|
173
174
|
const filePath = getFilePath(file);
|
|
174
175
|
const indicatorId = createProgressIndicator('indeterminate', 0, `Importing circle of trust ${cotId} from ${filePath}...`);
|
|
175
176
|
try {
|
|
176
177
|
const data = fs.readFileSync(filePath, 'utf8');
|
|
177
178
|
const fileData = JSON.parse(data);
|
|
178
179
|
await importCircleOfTrust(cotId, fileData);
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
stopProgressIndicator(indicatorId, `Imported circle of trust ${cotId}`, 'success');
|
|
181
|
+
return true;
|
|
181
182
|
} catch (error) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
printMessage(((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data) || error, 'error');
|
|
183
|
+
stopProgressIndicator(indicatorId, `Error importing circle of trust ${cotId}`, 'fail');
|
|
184
|
+
printError(error);
|
|
185
185
|
}
|
|
186
|
-
return
|
|
186
|
+
return false;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
/**
|
|
@@ -191,21 +191,19 @@ export async function importCircleOfTrustFromFile(cotId, file) {
|
|
|
191
191
|
* @param {String} file Import file name
|
|
192
192
|
*/
|
|
193
193
|
export async function importFirstCircleOfTrustFromFile(file) {
|
|
194
|
-
let outcome = false;
|
|
195
194
|
const filePath = getFilePath(file);
|
|
196
195
|
const indicatorId = createProgressIndicator('indeterminate', 0, `Importing first circle of trust from ${filePath}...`);
|
|
197
196
|
try {
|
|
198
197
|
const data = fs.readFileSync(filePath, 'utf8');
|
|
199
198
|
const fileData = JSON.parse(data);
|
|
200
199
|
await importFirstCircleOfTrust(fileData);
|
|
201
|
-
|
|
202
|
-
|
|
200
|
+
stopProgressIndicator(indicatorId, `Imported first circle of trust`, 'success');
|
|
201
|
+
return true;
|
|
203
202
|
} catch (error) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
printMessage(((_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.data) || error, 'error');
|
|
203
|
+
stopProgressIndicator(indicatorId, `Error importing first circle of trust`, 'fail');
|
|
204
|
+
printError(error);
|
|
207
205
|
}
|
|
208
|
-
return
|
|
206
|
+
return false;
|
|
209
207
|
}
|
|
210
208
|
|
|
211
209
|
/**
|
|
@@ -213,21 +211,19 @@ export async function importFirstCircleOfTrustFromFile(file) {
|
|
|
213
211
|
* @param {String} file Import file name
|
|
214
212
|
*/
|
|
215
213
|
export async function importCirclesOfTrustFromFile(file) {
|
|
216
|
-
let outcome = false;
|
|
217
214
|
const filePath = getFilePath(file);
|
|
218
215
|
const indicatorId = createProgressIndicator('indeterminate', 0, `Importing circles of trust from ${filePath}...`);
|
|
219
216
|
try {
|
|
220
217
|
const data = fs.readFileSync(filePath, 'utf8');
|
|
221
218
|
const fileData = JSON.parse(data);
|
|
222
219
|
await importCirclesOfTrust(fileData);
|
|
223
|
-
|
|
224
|
-
|
|
220
|
+
stopProgressIndicator(indicatorId, `Imported circles of trust`, 'success');
|
|
221
|
+
return true;
|
|
225
222
|
} catch (error) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
printMessage(((_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data) || error, 'error');
|
|
223
|
+
stopProgressIndicator(indicatorId, `Error importing circles of trust`, 'fail');
|
|
224
|
+
printError(error);
|
|
229
225
|
}
|
|
230
|
-
return
|
|
226
|
+
return false;
|
|
231
227
|
}
|
|
232
228
|
|
|
233
229
|
/**
|
|
@@ -253,16 +249,17 @@ export async function importCirclesOfTrustFromFiles() {
|
|
|
253
249
|
} catch (error) {
|
|
254
250
|
errors.push(error);
|
|
255
251
|
updateProgressIndicator(indicatorId, `Error importing circles of trust from ${file}`);
|
|
256
|
-
|
|
252
|
+
printError(error);
|
|
257
253
|
}
|
|
258
254
|
}
|
|
259
255
|
stopProgressIndicator(indicatorId, `Imported ${total} circles of trust from ${files.length} files.`);
|
|
256
|
+
return true;
|
|
260
257
|
} catch (error) {
|
|
261
258
|
errors.push(error);
|
|
262
259
|
stopProgressIndicator(indicatorId, `Error importing circles of trust from files.`);
|
|
263
|
-
|
|
260
|
+
printError(error);
|
|
264
261
|
}
|
|
265
262
|
debugMessage(`cli.CirclesOfTrustOps.importCirclesOfTrustFromFiles: end`);
|
|
266
|
-
return
|
|
263
|
+
return false;
|
|
267
264
|
}
|
|
268
265
|
//# sourceMappingURL=CirclesOfTrustOps.js.map
|