@rockcarver/frodo-cli 0.14.0 → 0.15.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.
Files changed (138) hide show
  1. package/CHANGELOG.md +20 -2
  2. package/package.json +2 -2
  3. package/babel.config.esm.json +0 -6
  4. package/src/app.ts +0 -63
  5. package/src/cli/_template/cmd-delete.ts +0 -56
  6. package/src/cli/_template/cmd-describe.ts +0 -36
  7. package/src/cli/_template/cmd-export.ts +0 -54
  8. package/src/cli/_template/cmd-import.ts +0 -54
  9. package/src/cli/_template/cmd-list.ts +0 -38
  10. package/src/cli/_template/cmd-sub1-delete.ts +0 -56
  11. package/src/cli/_template/cmd-sub1-describe.ts +0 -36
  12. package/src/cli/_template/cmd-sub1-export.ts +0 -54
  13. package/src/cli/_template/cmd-sub1-import.ts +0 -54
  14. package/src/cli/_template/cmd-sub1-list.ts +0 -38
  15. package/src/cli/_template/cmd-sub1.ts +0 -20
  16. package/src/cli/_template/cmd-sub2-delete.ts +0 -56
  17. package/src/cli/_template/cmd-sub2-describe.ts +0 -36
  18. package/src/cli/_template/cmd-sub2-export.ts +0 -54
  19. package/src/cli/_template/cmd-sub2-import.ts +0 -54
  20. package/src/cli/_template/cmd-sub2-list.ts +0 -38
  21. package/src/cli/_template/cmd-sub2.ts +0 -20
  22. package/src/cli/_template/cmd.ts +0 -29
  23. package/src/cli/admin/admin-add-autoid-static-user-mapping.ts +0 -40
  24. package/src/cli/admin/admin-create-oauth2-client-with-admin-privileges.ts +0 -121
  25. package/src/cli/admin/admin-get-access-token.ts +0 -59
  26. package/src/cli/admin/admin-grant-oauth2-client-admin-privileges.ts +0 -45
  27. package/src/cli/admin/admin-hide-generic-extension-attributes.ts +0 -47
  28. package/src/cli/admin/admin-list-oauth2-clients-with-admin-privileges.ts +0 -45
  29. package/src/cli/admin/admin-list-oauth2-clients-with-custom-privileges.ts +0 -46
  30. package/src/cli/admin/admin-list-static-user-mappings.ts +0 -53
  31. package/src/cli/admin/admin-remove-static-user-mapping.ts +0 -38
  32. package/src/cli/admin/admin-repair-org-model.ts +0 -53
  33. package/src/cli/admin/admin-revoke-oauth2-client-admin-privileges.ts +0 -47
  34. package/src/cli/admin/admin-show-generic-extension-attributes.ts +0 -55
  35. package/src/cli/admin/admin.ts +0 -94
  36. package/src/cli/app/app-delete.ts +0 -56
  37. package/src/cli/app/app-describe.ts +0 -36
  38. package/src/cli/app/app-export.ts +0 -78
  39. package/src/cli/app/app-import.ts +0 -56
  40. package/src/cli/app/app-list.ts +0 -40
  41. package/src/cli/app/app.ts +0 -29
  42. package/src/cli/cmd_common.ts +0 -181
  43. package/src/cli/conn/conn-add.ts +0 -65
  44. package/src/cli/conn/conn-delete.ts +0 -22
  45. package/src/cli/conn/conn-describe.ts +0 -23
  46. package/src/cli/conn/conn-list.ts +0 -27
  47. package/src/cli/conn/conn.ts +0 -28
  48. package/src/cli/email/email-template-export.ts +0 -90
  49. package/src/cli/email/email-template-import.ts +0 -90
  50. package/src/cli/email/email-template-list.ts +0 -40
  51. package/src/cli/email/email-template.ts +0 -16
  52. package/src/cli/email/email.ts +0 -17
  53. package/src/cli/esv/esv-apply.ts +0 -120
  54. package/src/cli/esv/esv-secret-create.ts +0 -64
  55. package/src/cli/esv/esv-secret-delete.ts +0 -65
  56. package/src/cli/esv/esv-secret-describe.ts +0 -43
  57. package/src/cli/esv/esv-secret-export.ts +0 -54
  58. package/src/cli/esv/esv-secret-import.ts +0 -54
  59. package/src/cli/esv/esv-secret-list.ts +0 -40
  60. package/src/cli/esv/esv-secret-set.ts +0 -45
  61. package/src/cli/esv/esv-secret-version-activate.ts +0 -53
  62. package/src/cli/esv/esv-secret-version-create.ts +0 -45
  63. package/src/cli/esv/esv-secret-version-deactivate.ts +0 -53
  64. package/src/cli/esv/esv-secret-version-delete.ts +0 -66
  65. package/src/cli/esv/esv-secret-version-list.ts +0 -41
  66. package/src/cli/esv/esv-secret-version.ts +0 -20
  67. package/src/cli/esv/esv-secret.ts +0 -26
  68. package/src/cli/esv/esv-variable-create.ts +0 -46
  69. package/src/cli/esv/esv-variable-delete.ts +0 -71
  70. package/src/cli/esv/esv-variable-describe.ts +0 -43
  71. package/src/cli/esv/esv-variable-export.ts +0 -54
  72. package/src/cli/esv/esv-variable-import.ts +0 -54
  73. package/src/cli/esv/esv-variable-list.ts +0 -40
  74. package/src/cli/esv/esv-variable-set.ts +0 -62
  75. package/src/cli/esv/esv-variable.ts +0 -24
  76. package/src/cli/esv/esv.ts +0 -21
  77. package/src/cli/idm/idm-count.ts +0 -42
  78. package/src/cli/idm/idm-export.ts +0 -116
  79. package/src/cli/idm/idm-list.ts +0 -40
  80. package/src/cli/idm/idm.ts +0 -28
  81. package/src/cli/idp/idp-export.ts +0 -90
  82. package/src/cli/idp/idp-import.ts +0 -101
  83. package/src/cli/idp/idp-list.ts +0 -42
  84. package/src/cli/idp/idp.ts +0 -21
  85. package/src/cli/info/info.ts +0 -55
  86. package/src/cli/journey/journey-delete.e2e.test_.ts +0 -380
  87. package/src/cli/journey/journey-delete.ts +0 -78
  88. package/src/cli/journey/journey-describe.ts +0 -148
  89. package/src/cli/journey/journey-export.ts +0 -110
  90. package/src/cli/journey/journey-import.ts +0 -127
  91. package/src/cli/journey/journey-list.e2e.test_.ts +0 -142
  92. package/src/cli/journey/journey-list.ts +0 -43
  93. package/src/cli/journey/journey-prune.ts +0 -52
  94. package/src/cli/journey/journey.ts +0 -37
  95. package/src/cli/logging/logs-list.ts +0 -77
  96. package/src/cli/logging/logs-tail.ts +0 -85
  97. package/src/cli/logging/logs.ts +0 -21
  98. package/src/cli/realm/realm-add-custom-domain.ts +0 -47
  99. package/src/cli/realm/realm-describe.ts +0 -40
  100. package/src/cli/realm/realm-list.ts +0 -40
  101. package/src/cli/realm/realm-remove-custom-domain.ts +0 -50
  102. package/src/cli/realm/realm.ts +0 -33
  103. package/src/cli/saml/saml-cot-export.ts +0 -90
  104. package/src/cli/saml/saml-cot-import.ts +0 -101
  105. package/src/cli/saml/saml-cot-list.ts +0 -42
  106. package/src/cli/saml/saml-cot.ts +0 -16
  107. package/src/cli/saml/saml-describe.ts +0 -42
  108. package/src/cli/saml/saml-export.ts +0 -91
  109. package/src/cli/saml/saml-import.ts +0 -102
  110. package/src/cli/saml/saml-list.ts +0 -42
  111. package/src/cli/saml/saml-metadata-export.ts +0 -76
  112. package/src/cli/saml/saml-metadata.ts +0 -12
  113. package/src/cli/saml/saml.ts +0 -29
  114. package/src/cli/script/script-delete.ts +0 -56
  115. package/src/cli/script/script-describe.ts +0 -36
  116. package/src/cli/script/script-export.ts +0 -95
  117. package/src/cli/script/script-import.ts +0 -64
  118. package/src/cli/script/script-list.ts +0 -42
  119. package/src/cli/script/script.ts +0 -25
  120. package/src/cli/theme/theme-delete.e2e.test_.ts +0 -178
  121. package/src/cli/theme/theme-delete.ts +0 -83
  122. package/src/cli/theme/theme-export.ts +0 -107
  123. package/src/cli/theme/theme-import.ts +0 -118
  124. package/src/cli/theme/theme-list.e2e.test_.ts +0 -119
  125. package/src/cli/theme/theme-list.ts +0 -42
  126. package/src/cli/theme/theme.ts +0 -23
  127. package/src/ops/CirclesOfTrustOps.ts +0 -12
  128. package/src/ops/EmailTemplateOps.ts +0 -19
  129. package/src/ops/IdpOps.ts +0 -11
  130. package/src/ops/JourneyOps.ts +0 -278
  131. package/src/ops/NodeOps.ts +0 -47
  132. package/src/ops/Saml2Ops.ts +0 -24
  133. package/src/ops/ScriptOps.ts +0 -11
  134. package/src/ops/ThemeOps.ts +0 -17
  135. package/src/ops/utils/Wordwrap.ts +0 -11
  136. package/src/storage/StaticStorage.ts +0 -15
  137. package/src/utils/Console.ts +0 -483
  138. package/tsconfig.json +0 -106
@@ -1,116 +0,0 @@
1
- import { Command, Option } from 'commander';
2
- import { Authenticate, Idm, state } from '@rockcarver/frodo-lib';
3
- import * as common from '../cmd_common.js';
4
-
5
- const { getTokens } = Authenticate;
6
- const {
7
- exportAllConfigEntities,
8
- exportAllRawConfigEntities,
9
- exportConfigEntity,
10
- } = Idm;
11
-
12
- const program = new Command('frodo idm export');
13
-
14
- program
15
- .description('Export IDM configuration objects.')
16
- .helpOption('-h, --help', 'Help')
17
- .showHelpAfterError()
18
- .addArgument(common.hostArgumentM)
19
- .addArgument(common.realmArgument)
20
- .addArgument(common.userArgument)
21
- .addArgument(common.passwordArgument)
22
- .addOption(common.deploymentOption)
23
- .addOption(common.insecureOption)
24
- .addOption(
25
- new Option(
26
- '-N, --name <name>',
27
- 'Config entity name. E.g. "managed", "sync", "provisioner-<connector-name>", etc.'
28
- )
29
- )
30
- .addOption(new Option('-f, --file [file]', 'Export file. Ignored with -A.'))
31
- .addOption(
32
- new Option(
33
- '-E, --entities-file [entities-file]',
34
- 'Name of the entity file. Ignored with -A.'
35
- )
36
- )
37
- .addOption(
38
- new Option(
39
- '-e, --env-file [envfile]',
40
- 'Name of the env file. Ignored with -A.'
41
- )
42
- )
43
- .addOption(
44
- new Option(
45
- '-a, --all',
46
- 'Export all IDM configuration objects into a single file in directory -D. Ignored with -N.'
47
- )
48
- )
49
- .addOption(
50
- new Option(
51
- '-A, --all-separate',
52
- 'Export all IDM configuration objects into separate JSON files in directory -D. Ignored with -N, and -a.'
53
- )
54
- )
55
- .addOption(
56
- new Option(
57
- '-D, --directory <directory>',
58
- 'Export directory. Required with and ignored without -a/-A.'
59
- )
60
- )
61
- .action(
62
- // implement command logic inside action handler
63
- async (host, realm, user, password, options) => {
64
- state.default.session.setTenant(host);
65
- state.default.session.setRealm(realm);
66
- state.default.session.setUsername(user);
67
- state.default.session.setPassword(password);
68
- state.default.session.setDeploymentType(options.type);
69
- state.default.session.setAllowInsecureConnection(options.insecure);
70
- if (await getTokens()) {
71
- // export by id/name
72
- if (options.idmName) {
73
- console.log(
74
- `Exporting object "${
75
- options.idmName
76
- }" from realm "${state.default.session.getRealm()}"...`
77
- );
78
- exportConfigEntity(options.idmName, options.file);
79
- }
80
- // --all-separate -A
81
- else if (
82
- options.allSeparate &&
83
- options.directory &&
84
- options.entitiesFile &&
85
- options.envFile
86
- ) {
87
- console.log(
88
- `Exporting IDM configuration objects specified in ${options.entitiesFile} into separate files in ${options.directory} using ${options.envFile} for variable replacement...`
89
- );
90
- exportAllConfigEntities(
91
- options.directory,
92
- options.entitiesFile,
93
- options.envFile
94
- );
95
- }
96
- // --all-separate -A without variable replacement
97
- else if (options.allSeparate && options.directory) {
98
- console.log(
99
- `Exporting all IDM configuration objects into separate files in ${options.directory}...`
100
- );
101
- exportAllRawConfigEntities(options.directory);
102
- }
103
- // unrecognized combination of options or no options
104
- else {
105
- console.log(
106
- 'Unrecognized combination of options or no options...',
107
- 'error'
108
- );
109
- program.help();
110
- }
111
- }
112
- }
113
- // end command logic inside action handler
114
- );
115
-
116
- program.parse();
@@ -1,40 +0,0 @@
1
- import { Command } from 'commander';
2
- import { Authenticate, Idm, state } from '@rockcarver/frodo-lib';
3
- import * as common from '../cmd_common.js';
4
-
5
- const { getTokens } = Authenticate;
6
- const { listAllConfigEntities } = Idm;
7
-
8
- const program = new Command('frodo idm list');
9
-
10
- program
11
- .description('List IDM configuration objects.')
12
- .helpOption('-h, --help', 'Help')
13
- .showHelpAfterError()
14
- .addArgument(common.hostArgumentM)
15
- .addArgument(common.realmArgument)
16
- .addArgument(common.userArgument)
17
- .addArgument(common.passwordArgument)
18
- .addOption(common.deploymentOption)
19
- .addOption(common.insecureOption)
20
- // .addOption(
21
- // new Option('-l, --long', 'Long with all fields.').default(false, 'false')
22
- // )
23
- .action(
24
- // implement command logic inside action handler
25
- async (host, realm, user, password, options) => {
26
- state.default.session.setTenant(host);
27
- state.default.session.setRealm(realm);
28
- state.default.session.setUsername(user);
29
- state.default.session.setPassword(password);
30
- state.default.session.setDeploymentType(options.type);
31
- state.default.session.setAllowInsecureConnection(options.insecure);
32
- if (await getTokens()) {
33
- console.log('Listing all IDM configuration objects...');
34
- listAllConfigEntities();
35
- }
36
- }
37
- // end command logic inside action handler
38
- );
39
-
40
- program.parse();
@@ -1,28 +0,0 @@
1
- import { Command } from 'commander';
2
- import path from 'path';
3
- import { fileURLToPath } from 'url';
4
-
5
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
-
7
- export default function setup() {
8
- const program = new Command('idm')
9
- .helpOption('-h, --help', 'Help')
10
- .description('Manage IDM configuration.')
11
- .executableDir(__dirname);
12
-
13
- program
14
- .command('list', 'List all IDM configuration objects.')
15
- .showHelpAfterError();
16
-
17
- // Do all 3 commands (raw / all / one ) or seperate?
18
- program
19
- .command('export', 'Export IDM configuration objects.')
20
- .showHelpAfterError();
21
-
22
- program
23
- .command('count', 'Count number of managed objects of a given type.')
24
- .showHelpAfterError();
25
-
26
- program.showHelpAfterError();
27
- return program;
28
- }
@@ -1,90 +0,0 @@
1
- import { Command, Option } from 'commander';
2
- import { Authenticate, Idp, state } from '@rockcarver/frodo-lib';
3
- import * as common from '../cmd_common.js';
4
-
5
- const { getTokens } = Authenticate;
6
- const {
7
- exportSocialProviderToFile,
8
- exportSocialProvidersToFile,
9
- exportSocialProvidersToFiles,
10
- } = Idp;
11
-
12
- const program = new Command('frodo idp export');
13
-
14
- program
15
- .description('Export (social) identity providers.')
16
- .helpOption('-h, --help', 'Help')
17
- .showHelpAfterError()
18
- .addArgument(common.hostArgumentM)
19
- .addArgument(common.realmArgument)
20
- .addArgument(common.userArgument)
21
- .addArgument(common.passwordArgument)
22
- .addOption(common.deploymentOption)
23
- .addOption(common.insecureOption)
24
- .addOption(
25
- new Option(
26
- '-i, --idp-id <idp-id>',
27
- 'Id/name of a provider. If specified, -a and -A are ignored.'
28
- )
29
- )
30
- .addOption(
31
- new Option(
32
- '-f, --file [file]',
33
- 'Name of the file to write the exported provider(s) to. Ignored with -A.'
34
- )
35
- )
36
- .addOption(
37
- new Option(
38
- '-a, --all',
39
- 'Export all the providers in a realm to a single file. Ignored with -t and -i.'
40
- )
41
- )
42
- .addOption(
43
- new Option(
44
- '-A, --all-separate',
45
- 'Export all the providers in a realm as separate files <provider name>.idp.json. Ignored with -t, -i, and -a.'
46
- )
47
- )
48
- .action(
49
- // implement command logic inside action handler
50
- async (host, realm, user, password, options) => {
51
- state.default.session.setTenant(host);
52
- state.default.session.setRealm(realm);
53
- state.default.session.setUsername(user);
54
- state.default.session.setPassword(password);
55
- state.default.session.setDeploymentType(options.type);
56
- state.default.session.setAllowInsecureConnection(options.insecure);
57
- if (await getTokens()) {
58
- // export by id/name
59
- if (options.idpId) {
60
- console.log(
61
- `Exporting provider "${
62
- options.idpId
63
- }" from realm "${state.default.session.getRealm()}"...`
64
- );
65
- exportSocialProviderToFile(options.idpId, options.file);
66
- }
67
- // --all -a
68
- else if (options.all) {
69
- console.log('Exporting all providers to a single file...');
70
- exportSocialProvidersToFile(options.file);
71
- }
72
- // --all-separate -A
73
- else if (options.allSeparate) {
74
- console.log('Exporting all providers to separate files...');
75
- exportSocialProvidersToFiles();
76
- }
77
- // unrecognized combination of options or no options
78
- else {
79
- console.log(
80
- 'Unrecognized combination of options or no options...',
81
- 'error'
82
- );
83
- program.help();
84
- }
85
- }
86
- }
87
- // end command logic inside action handler
88
- );
89
-
90
- program.parse();
@@ -1,101 +0,0 @@
1
- import { Command, Option } from 'commander';
2
- import { Authenticate, Idp, state } from '@rockcarver/frodo-lib';
3
- import * as common from '../cmd_common.js';
4
-
5
- const { getTokens } = Authenticate;
6
- const {
7
- importSocialProviderFromFile,
8
- importFirstSocialProviderFromFile,
9
- importSocialProvidersFromFile,
10
- importSocialProvidersFromFiles,
11
- } = Idp;
12
-
13
- const program = new Command('frodo idp import');
14
-
15
- program
16
- .description('Import (social) identity providers.')
17
- .helpOption('-h, --help', 'Help')
18
- .showHelpAfterError()
19
- .addArgument(common.hostArgumentM)
20
- .addArgument(common.realmArgument)
21
- .addArgument(common.userArgument)
22
- .addArgument(common.passwordArgument)
23
- .addOption(common.deploymentOption)
24
- .addOption(common.insecureOption)
25
- .addOption(
26
- new Option(
27
- '-i, --idp-id <id>',
28
- 'Provider id. If specified, -a and -A are ignored.'
29
- )
30
- )
31
- .addOption(
32
- new Option(
33
- '-f, --file <file>',
34
- 'Name of the file to import the provider(s) from.'
35
- )
36
- )
37
- .addOption(
38
- new Option(
39
- '-a, --all',
40
- 'Import all the providers from single file. Ignored with -t or -i.'
41
- )
42
- )
43
- .addOption(
44
- new Option(
45
- '-A, --all-separate',
46
- 'Import all the providers from separate files (*.json) in the current directory. Ignored with -t or -i or -a.'
47
- )
48
- )
49
- .action(
50
- // implement command logic inside action handler
51
- async (host, realm, user, password, options) => {
52
- state.default.session.setTenant(host);
53
- state.default.session.setRealm(realm);
54
- state.default.session.setUsername(user);
55
- state.default.session.setPassword(password);
56
- state.default.session.setDeploymentType(options.type);
57
- state.default.session.setAllowInsecureConnection(options.insecure);
58
- if (await getTokens()) {
59
- // import by id
60
- if (options.file && options.idpId) {
61
- console.log(
62
- `Importing provider "${
63
- options.idpId
64
- }" into realm "${state.default.session.getRealm()}"...`
65
- );
66
- importSocialProviderFromFile(options.idpId, options.file);
67
- }
68
- // --all -a
69
- else if (options.all && options.file) {
70
- console.log(
71
- `Importing all providers from a single file (${options.file})...`
72
- );
73
- importSocialProvidersFromFile(options.file);
74
- }
75
- // --all-separate -A
76
- else if (options.allSeparate && !options.file) {
77
- console.log(
78
- 'Importing all providers from separate files in current directory...'
79
- );
80
- importSocialProvidersFromFiles();
81
- }
82
- // import first provider from file
83
- else if (options.file) {
84
- console.log(
85
- `Importing first provider from file "${
86
- options.file
87
- }" into realm "${state.default.session.getRealm()}"...`
88
- );
89
- importFirstSocialProviderFromFile(options.file);
90
- }
91
- // unrecognized combination of options or no options
92
- else {
93
- console.log('Unrecognized combination of options or no options...');
94
- program.help();
95
- }
96
- }
97
- }
98
- // end command logic inside action handler
99
- );
100
-
101
- program.parse();
@@ -1,42 +0,0 @@
1
- import { Command } from 'commander';
2
- import { Authenticate, Idp, state } from '@rockcarver/frodo-lib';
3
- import * as common from '../cmd_common.js';
4
-
5
- const { getTokens } = Authenticate;
6
- const { listSocialProviders } = Idp;
7
-
8
- const program = new Command('frodo idp list');
9
-
10
- program
11
- .description('List (social) identity providers.')
12
- .helpOption('-h, --help', 'Help')
13
- .showHelpAfterError()
14
- .addArgument(common.hostArgumentM)
15
- .addArgument(common.realmArgument)
16
- .addArgument(common.userArgument)
17
- .addArgument(common.passwordArgument)
18
- .addOption(common.deploymentOption)
19
- .addOption(common.insecureOption)
20
- // .addOption(
21
- // new Option('-l, --long', 'Long with all fields.').default(false, 'false')
22
- // )
23
- .action(
24
- // implement command logic inside action handler
25
- async (host, realm, user, password, options) => {
26
- state.default.session.setTenant(host);
27
- state.default.session.setRealm(realm);
28
- state.default.session.setUsername(user);
29
- state.default.session.setPassword(password);
30
- state.default.session.setDeploymentType(options.type);
31
- state.default.session.setAllowInsecureConnection(options.insecure);
32
- if (await getTokens()) {
33
- console.log(
34
- `Listing providers in realm "${state.default.session.getRealm()}"...`
35
- );
36
- listSocialProviders();
37
- }
38
- }
39
- // end command logic inside action handler
40
- );
41
-
42
- program.parse();
@@ -1,21 +0,0 @@
1
- import { Command } from 'commander';
2
- import path from 'path';
3
- import { fileURLToPath } from 'url';
4
-
5
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
-
7
- export default function setup() {
8
- const program = new Command('idp')
9
- .helpOption('-h, --help', 'Help')
10
- .description('Manage (social) identity providers.')
11
- .executableDir(__dirname);
12
-
13
- program.command('list', 'List identity providers.').showHelpAfterError();
14
-
15
- program.command('export', 'Export identity providers.').showHelpAfterError();
16
-
17
- program.command('import', 'Import identity providers.').showHelpAfterError();
18
-
19
- program.showHelpAfterError();
20
- return program;
21
- }
@@ -1,55 +0,0 @@
1
- import { Command } from 'commander';
2
- import { Authenticate, state } from '@rockcarver/frodo-lib';
3
- import * as common from '../cmd_common.js';
4
-
5
- const { getTokens } = Authenticate;
6
-
7
- export default function setup() {
8
- const info = new Command('info');
9
- info
10
- .addArgument(common.hostArgumentM)
11
- .addArgument(common.userArgument)
12
- .addArgument(common.passwordArgument)
13
- .helpOption('-h, --help', 'Help')
14
- .addOption(common.deploymentOption)
15
- .addOption(common.insecureOption)
16
- .addOption(common.scriptFriendlyOption)
17
- .description('Print versions and tokens.')
18
- .action(async (host, user, password, options) => {
19
- state.default.session.setTenant(host);
20
- state.default.session.setUsername(user);
21
- state.default.session.setPassword(password);
22
- state.default.session.setDeploymentType(options.type);
23
- state.default.session.setAllowInsecureConnection(options.insecure);
24
- state.default.session.setItem('scriptFriendly', options.scriptFriendly);
25
- if (!options.scriptFriendly) {
26
- console.log('Printing versions and tokens...');
27
- if (await getTokens()) {
28
- console.log(`Cookie name: ${state.default.session.getCookieName()}`);
29
- console.log(
30
- `Session token: ${state.default.session.getCookieValue()}`
31
- );
32
- if (state.default.session.getBearerToken()) {
33
- console.log(
34
- `Bearer token: ${state.default.session.getBearerToken()}`
35
- );
36
- }
37
- } else {
38
- process.exitCode = 1;
39
- }
40
- } else if (await getTokens()) {
41
- const output = {
42
- cookieName: state.default.session.getCookieName(),
43
- sessionToken: state.default.session.getCookieValue(),
44
- };
45
- if (state.default.session.getBearerToken()) {
46
- output['bearerToken'] = state.default.session.getBearerToken();
47
- }
48
- console.log(JSON.stringify(output, null, 2), 'data');
49
- } else {
50
- process.exitCode = 1;
51
- }
52
- });
53
- info.showHelpAfterError();
54
- return info;
55
- }