@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,110 +0,0 @@
1
- import { Command, Option } from 'commander';
2
- import { Authenticate, Journey, state } from '@rockcarver/frodo-lib';
3
- import * as common from '../cmd_common.js';
4
-
5
- const { getTokens } = Authenticate;
6
- const { exportJourneyToFile, exportJourneysToFile, exportJourneysToFiles } =
7
- Journey;
8
-
9
- const program = new Command('frodo journey export');
10
-
11
- program
12
- .description('Export journeys/trees.')
13
- .helpOption('-h, --help', 'Help')
14
- .showHelpAfterError()
15
- .addArgument(common.hostArgumentM)
16
- .addArgument(common.realmArgument)
17
- .addArgument(common.userArgument)
18
- .addArgument(common.passwordArgument)
19
- .addOption(common.deploymentOption)
20
- .addOption(common.insecureOption)
21
- .addOption(
22
- new Option(
23
- '-i, --journey-id <journey>',
24
- 'Name of a journey/tree. If specified, -a and -A are ignored.'
25
- )
26
- )
27
- .addOption(
28
- new Option(
29
- '-f, --file <file>',
30
- 'Name of the file to write the exported journey(s) to. Ignored with -A.'
31
- )
32
- )
33
- .addOption(
34
- new Option(
35
- '-a, --all',
36
- 'Export all the journeys/trees in a realm. Ignored with -i.'
37
- )
38
- )
39
- .addOption(
40
- new Option(
41
- '-A, --all-separate',
42
- 'Export all the journeys/trees in a realm as separate files <journey/tree name>.json. Ignored with -i or -a.'
43
- )
44
- )
45
- .addOption(
46
- new Option(
47
- '--use-string-arrays',
48
- 'Where applicable, use string arrays to store multi-line text (e.g. scripts).'
49
- ).default(false, 'off')
50
- )
51
- .addOption(
52
- new Option(
53
- '--no-deps',
54
- 'Do not include any dependencies (scripts, email templates, SAML entity providers and circles of trust, social identity providers, themes).'
55
- )
56
- )
57
- .addOption(
58
- new Option(
59
- '--verbose',
60
- 'Verbose output during command execution. If specified, may or may not produce additional output.'
61
- ).default(false, 'off')
62
- )
63
- .action(
64
- // implement command logic inside action handler
65
- async (host, realm, user, password, options) => {
66
- state.default.session.setTenant(host);
67
- state.default.session.setRealm(realm);
68
- state.default.session.setUsername(user);
69
- state.default.session.setPassword(password);
70
- state.default.session.setDeploymentType(options.type);
71
- state.default.session.setAllowInsecureConnection(options.insecure);
72
- if (await getTokens()) {
73
- // export
74
- if (options.journeyId) {
75
- console.log('Exporting journey...');
76
- await exportJourneyToFile(options.journeyId, options.file, {
77
- useStringArrays: options.useStringArrays,
78
- deps: options.deps,
79
- verbose: options.verbose,
80
- });
81
- }
82
- // --all -a
83
- else if (options.all) {
84
- console.log('Exporting all journeys to a single file...');
85
- await exportJourneysToFile(options.file, {
86
- useStringArrays: options.useStringArrays,
87
- deps: options.deps,
88
- verbose: options.verbose,
89
- });
90
- }
91
- // --all-separate -A
92
- else if (options.allSeparate) {
93
- console.log('Exporting all journeys to separate files...');
94
- await exportJourneysToFiles({
95
- useStringArrays: options.useStringArrays,
96
- deps: options.deps,
97
- verbose: options.verbose,
98
- });
99
- }
100
- // unrecognized combination of options or no options
101
- else {
102
- console.log('Unrecognized combination of options or no options...');
103
- program.help();
104
- }
105
- }
106
- }
107
- // end command logic inside action handler
108
- );
109
-
110
- program.parse();
@@ -1,127 +0,0 @@
1
- import { Command, Option } from 'commander';
2
- import { Authenticate, Journey, state } from '@rockcarver/frodo-lib';
3
- import * as common from '../cmd_common.js';
4
-
5
- const { getTokens } = Authenticate;
6
- const {
7
- importJourneyFromFile,
8
- importJourneysFromFile,
9
- importJourneysFromFiles,
10
- importFirstJourneyFromFile,
11
- } = Journey;
12
-
13
- const program = new Command('frodo journey import');
14
-
15
- program
16
- .description('Import journey/tree.')
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, --journey-id <journey>',
28
- 'Name of a journey/tree. 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 journey(s) from. Ignored with -A.'
35
- )
36
- )
37
- .addOption(
38
- new Option(
39
- '-a, --all',
40
- 'Import all the journeys/trees from single file. Ignored with -i.'
41
- )
42
- )
43
- .addOption(
44
- new Option(
45
- '-A, --all-separate',
46
- 'Import all the journeys/trees from separate files (*.json) in the current directory. Ignored with -i or -a.'
47
- )
48
- )
49
- .addOption(
50
- new Option(
51
- '--re-uuid',
52
- 'Generate new UUIDs for all nodes during import.'
53
- ).default(false, 'off')
54
- )
55
- .addOption(
56
- new Option(
57
- '--no-deps',
58
- 'Do not include any dependencies (scripts, email templates, SAML entity providers and circles of trust, social identity providers, themes).'
59
- )
60
- )
61
- .addOption(
62
- new Option(
63
- '--verbose',
64
- 'Verbose output during command execution. If specified, may or may not produce additional output.'
65
- ).default(false, 'off')
66
- )
67
- .action(
68
- // implement command logic inside action handler
69
- async (host, realm, user, password, options) => {
70
- state.default.session.setTenant(host);
71
- state.default.session.setRealm(realm);
72
- state.default.session.setUsername(user);
73
- state.default.session.setPassword(password);
74
- state.default.session.setDeploymentType(options.type);
75
- state.default.session.setAllowInsecureConnection(options.insecure);
76
- if (await getTokens()) {
77
- // import
78
- if (options.journeyId) {
79
- console.log(`Importing journey ${options.journeyId}...`);
80
- importJourneyFromFile(options.journeyId, options.file, {
81
- reUuid: options.reUuid,
82
- deps: options.deps,
83
- verbose: options.verbose,
84
- });
85
- }
86
- // --all -a
87
- else if (options.all && options.file) {
88
- console.log(
89
- `Importing all journeys from a single file (${options.file})...`
90
- );
91
- importJourneysFromFile(options.file, {
92
- reUuid: options.reUuid,
93
- deps: options.deps,
94
- verbose: options.verbose,
95
- });
96
- }
97
- // --all-separate -A
98
- else if (options.allSeparate && !options.file) {
99
- console.log(
100
- 'Importing all journeys from separate files in current directory...'
101
- );
102
- importJourneysFromFiles({
103
- reUuid: options.reUuid,
104
- deps: options.deps,
105
- verbose: options.verbose,
106
- });
107
- }
108
- // import first journey in file
109
- else if (options.file) {
110
- console.log('Importing first journey in file...');
111
- importFirstJourneyFromFile(options.file, {
112
- reUuid: options.reUuid,
113
- deps: options.deps,
114
- verbose: options.verbose,
115
- });
116
- }
117
- // unrecognized combination of options or no options
118
- else {
119
- console.log('Unrecognized combination of options or no options...');
120
- program.help();
121
- }
122
- }
123
- }
124
- // end command logic inside action handler
125
- );
126
-
127
- program.parse();
@@ -1,142 +0,0 @@
1
- // import { jest } from '@jest/globals';
2
- import { spawn, spawnSync } from 'child_process';
3
-
4
- const ansiEscapeCodes =
5
- // eslint-disable-next-line no-control-regex
6
- /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
7
-
8
- /**
9
- * delete all journeys and import baseline and additional test journeys
10
- */
11
- beforeAll(async () => {
12
- // delete all journeys
13
- const deleteJourneysCmd = spawnSync('frodo', [
14
- 'journey',
15
- 'delete',
16
- '--all',
17
- 'frodo-dev',
18
- ]);
19
- if (deleteJourneysCmd.status > 0) {
20
- console.error(deleteJourneysCmd.stderr.toString());
21
- console.log(deleteJourneysCmd.stdout.toString());
22
- }
23
-
24
- // import baseline journeys
25
- const importBaselineJourneysCmd = spawnSync(
26
- 'frodo',
27
- ['journey', 'import', '--all-separate', 'frodo-dev'],
28
- {
29
- cwd: `test/e2e/journey/baseline`,
30
- }
31
- );
32
- if (importBaselineJourneysCmd.status > 0) {
33
- console.error(importBaselineJourneysCmd.stderr.toString());
34
- console.log(importBaselineJourneysCmd.stdout.toString());
35
- }
36
-
37
- // import additional test journeys
38
- const importTestJourneysCmd = spawnSync(
39
- 'frodo',
40
- ['journey', 'import', '--all-separate', 'frodo-dev'],
41
- {
42
- cwd: `test/e2e/journey/list`,
43
- }
44
- );
45
- if (importTestJourneysCmd.status > 0) {
46
- console.error(importTestJourneysCmd.stderr.toString());
47
- console.log(importTestJourneysCmd.stdout.toString());
48
- }
49
- });
50
-
51
- describe('frodo journey list', () => {
52
- it('"frodo journey list": should list the names of the default journeys', (done) => {
53
- const journeyList = spawn('frodo', ['journey', 'list', 'frodo-dev']);
54
- const expected = [
55
- 'Disabled',
56
- 'ForgottenUsername',
57
- 'Login',
58
- 'PasswordGrant',
59
- 'ProgressiveProfile',
60
- 'Registration',
61
- 'ResetPassword',
62
- 'UpdatePassword',
63
- '',
64
- ].join('\n');
65
-
66
- const chunks = [];
67
- journeyList.stdout.on('data', (chunk) => {
68
- chunks.push(chunk);
69
- });
70
-
71
- journeyList.stdout.on('end', () => {
72
- const output = Buffer.concat(chunks).toString();
73
- try {
74
- expect(output).toBe(expected);
75
- done();
76
- } catch (error) {
77
- done(error);
78
- }
79
- });
80
- });
81
-
82
- const expectedLong = [
83
- 'Listing journeys in realm "alpha"...',
84
- 'Name │Status │Tags ',
85
- 'Disabled │disabled│Prototype ',
86
- 'ForgottenUsername │enabled │Username Reset ',
87
- 'Login │enabled │Authentication ',
88
- 'PasswordGrant │enabled │ ',
89
- 'ProgressiveProfile│enabled │Progressive Profile',
90
- 'Registration │enabled │Registration ',
91
- 'ResetPassword │enabled │Password Reset ',
92
- 'UpdatePassword │enabled │Password Reset ',
93
- '',
94
- ].join('\n');
95
-
96
- it('"frodo journey list -l": should list the names, status, and tags of the default journeys', (done) => {
97
- const journeyList = spawn('frodo', ['journey', 'list', '-l', 'frodo-dev']);
98
-
99
- const chunks = [];
100
- journeyList.stdout.on('data', (chunk) => {
101
- chunks.push(chunk);
102
- });
103
-
104
- journeyList.stdout.on('end', () => {
105
- const output = Buffer.concat(chunks)
106
- .toString()
107
- .replace(ansiEscapeCodes, '');
108
- try {
109
- expect(output).toBe(expectedLong);
110
- done();
111
- } catch (error) {
112
- done(error);
113
- }
114
- });
115
- });
116
-
117
- it('"frodo journey list --long": should list the names, status, and tags of the default journeys', (done) => {
118
- const journeyList = spawn('frodo', [
119
- 'journey',
120
- 'list',
121
- '--long',
122
- 'frodo-dev',
123
- ]);
124
-
125
- const chunks = [];
126
- journeyList.stdout.on('data', (chunk) => {
127
- chunks.push(chunk);
128
- });
129
-
130
- journeyList.stdout.on('end', () => {
131
- const output = Buffer.concat(chunks)
132
- .toString()
133
- .replace(ansiEscapeCodes, '');
134
- try {
135
- expect(output).toBe(expectedLong);
136
- done();
137
- } catch (error) {
138
- done(error);
139
- }
140
- });
141
- });
142
- });
@@ -1,43 +0,0 @@
1
- import { Command, Option } from 'commander';
2
- import { Authenticate, Journey, state } from '@rockcarver/frodo-lib';
3
- import * as common from '../cmd_common.js';
4
-
5
- const { getTokens } = Authenticate;
6
- const { listJourneys } = Journey;
7
-
8
- const program = new Command('frodo journey list');
9
-
10
- program
11
- .description('List journeys/trees.')
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
- .addOption(new Option('-a, --analyze', 'Analyze journeys for custom nodes.'))
24
- .action(
25
- // implement command logic inside action handler
26
- async (host, realm, user, password, options) => {
27
- state.default.session.setTenant(host);
28
- state.default.session.setRealm(realm);
29
- state.default.session.setUsername(user);
30
- state.default.session.setPassword(password);
31
- state.default.session.setDeploymentType(options.type);
32
- state.default.session.setAllowInsecureConnection(options.insecure);
33
- if (await getTokens()) {
34
- console.log(
35
- `Listing journeys in realm "${state.default.session.getRealm()}"...`
36
- );
37
- listJourneys(options.long, options.analyze);
38
- }
39
- }
40
- // end command logic inside action handler
41
- );
42
-
43
- program.parse();
@@ -1,52 +0,0 @@
1
- import { Command } from 'commander';
2
- import { Authenticate, Journey, state } from '@rockcarver/frodo-lib';
3
- import yesno from 'yesno';
4
- import * as common from '../cmd_common.js';
5
-
6
- const { getTokens } = Authenticate;
7
- const { findOrphanedNodes, removeOrphanedNodes } = Journey;
8
-
9
- const program = new Command('frodo journey prune');
10
-
11
- program
12
- .description(
13
- 'Prune orphaned configuration artifacts left behind after deleting authentication trees. You will be prompted before any destructive operations are performed.'
14
- )
15
- .helpOption('-h, --help', 'Help')
16
- .showHelpAfterError()
17
- .addArgument(common.hostArgumentM)
18
- .addArgument(common.realmArgument)
19
- .addArgument(common.userArgument)
20
- .addArgument(common.passwordArgument)
21
- .addOption(common.deploymentOption)
22
- .addOption(common.insecureOption)
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
- `Pruning orphaned configuration artifacts in realm "${state.default.session.getRealm()}"...`
35
- );
36
- const orphanedNodes = await findOrphanedNodes();
37
- if (orphanedNodes.length > 0) {
38
- const ok = await yesno({
39
- question: 'Prune (permanently delete) orphaned nodes? (y|n):',
40
- });
41
- if (ok) {
42
- await removeOrphanedNodes(orphanedNodes);
43
- }
44
- } else {
45
- console.log('No orphaned nodes found.');
46
- }
47
- }
48
- }
49
- // end command logic inside action handler
50
- );
51
-
52
- program.parse();
@@ -1,37 +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('journey')
9
- .helpOption('-h, --help', 'Help')
10
- .description('Manage journeys/trees.')
11
- .executableDir(__dirname);
12
-
13
- program.command('list', 'List journeys/trees.').showHelpAfterError();
14
-
15
- program
16
- .command(
17
- 'describe',
18
- 'If host argument is supplied, describe the journey/tree indicated by -t, or all journeys/trees in the realm if no -t is supplied, otherwise describe the journey/tree export file indicated by -f.'
19
- )
20
- .showHelpAfterError();
21
-
22
- program.command('export', 'Export journeys/trees.').showHelpAfterError();
23
-
24
- program.command('import', 'Import journeys/trees.').showHelpAfterError();
25
-
26
- program.command('delete', 'Delete journeys/trees.').showHelpAfterError();
27
-
28
- program
29
- .command(
30
- 'prune',
31
- 'Prune orphaned configuration artifacts left behind after deleting authentication trees. You will be prompted before any destructive operations are performed.'
32
- )
33
- .showHelpAfterError();
34
-
35
- program.showHelpAfterError();
36
- return program;
37
- }
@@ -1,77 +0,0 @@
1
- import {
2
- Authenticate,
3
- ConnectionProfile,
4
- Log,
5
- state,
6
- } from '@rockcarver/frodo-lib';
7
- import { Command } from 'commander';
8
- import * as common from '../cmd_common.js';
9
-
10
- const { provisionCreds, getLogSources } = Log;
11
- const { getConnectionProfile, saveConnectionProfile } = ConnectionProfile;
12
- const { getTokens } = Authenticate;
13
-
14
- const program = new Command('frodo journey list');
15
- program
16
- .description('List available ID Cloud log sources.')
17
- .helpOption('-h, --help', 'Help')
18
- .addArgument(common.hostArgumentM)
19
- .addArgument(common.userArgument)
20
- .addArgument(common.passwordArgument)
21
- .addOption(common.insecureOption)
22
- .action(async (host, user, password, options) => {
23
- let credsFromParameters = true;
24
- state.default.session.setTenant(host);
25
- state.default.session.setUsername(user);
26
- state.default.session.setPassword(password);
27
- state.default.session.setAllowInsecureConnection(options.insecure);
28
- console.log('Listing available ID Cloud log sources...');
29
- const conn = await getConnectionProfile();
30
- state.default.session.setTenant(conn.tenant);
31
- if (conn.key != null && conn.secret != null) {
32
- credsFromParameters = false;
33
- state.default.session.setLogApiKey(conn.key);
34
- state.default.session.setLogApiSecret(conn.secret);
35
- } else {
36
- if (conn.username == null && conn.password == null) {
37
- if (
38
- !state.default.session.getUsername() &&
39
- !state.default.session.getPassword()
40
- ) {
41
- credsFromParameters = false;
42
- console.log(
43
- 'User credentials not specified as parameters and no saved API key and secret found!',
44
- 'warn'
45
- );
46
- return;
47
- }
48
- } else {
49
- state.default.session.setUsername(conn.username);
50
- state.default.session.setPassword(conn.password);
51
- }
52
- if (await getTokens()) {
53
- const creds = await provisionCreds();
54
- state.default.session.setLogApiKey(creds.api_key_id);
55
- state.default.session.setLogApiSecret(creds.api_key_secret);
56
- }
57
- }
58
-
59
- const sources = await getLogSources();
60
- if (sources.length === 0) {
61
- console.log(
62
- "Can't get sources, possible cause - wrong API key or secret",
63
- 'error'
64
- );
65
- } else {
66
- if (credsFromParameters) await saveConnectionProfile(); // save new values if they were specified on CLI
67
- console.log('Available log sources:');
68
- sources.forEach((source) => {
69
- console.log(`${source}`, 'info');
70
- });
71
- console.log('You can use any combination of comma separated sources.');
72
- console.log('For example:');
73
- console.log(`$ frodo logs tail -c am-core,idm-core ${host}`, 'info');
74
- }
75
- });
76
-
77
- program.parse();
@@ -1,85 +0,0 @@
1
- import { Command, Option } from 'commander';
2
- import {
3
- Authenticate,
4
- ConnectionProfile,
5
- Log,
6
- state,
7
- } from '@rockcarver/frodo-lib';
8
- import * as common from '../cmd_common.js';
9
-
10
- const { provisionCreds, tailLogs, resolveLevel } = Log;
11
- const { getConnectionProfile, saveConnectionProfile } = ConnectionProfile;
12
- const { getTokens } = Authenticate;
13
-
14
- const program = new Command('frodo journey tail');
15
- program
16
- .description('Tail Identity Cloud logs.')
17
- .helpOption('-h, --help', 'Help')
18
- .addArgument(common.hostArgumentM)
19
- .addArgument(common.userArgument)
20
- .addArgument(common.passwordArgument)
21
- .addOption(common.insecureOption)
22
- .addOption(common.sourcesOptionM)
23
- .addOption(
24
- new Option(
25
- '-l, --level <level>',
26
- 'Set log level filter. You can specify the level as a number or a string. \
27
- Following values are possible (values on the same line are equivalent): \
28
- \n0, SEVERE, FATAL, or ERROR\n1, WARNING, WARN or CONFIG\
29
- \n2, INFO or INFORMATION\n3, DEBUG, FINE, FINER or FINEST\
30
- \n4 or ALL'
31
- ).default('ERROR', `${resolveLevel('ERROR')}`)
32
- )
33
- .addOption(
34
- new Option('-t, --transaction-id <txid>', 'Filter by transactionId')
35
- )
36
- .action(async (host, user, password, options, command) => {
37
- let credsFromParameters = true;
38
- state.default.session.setTenant(host);
39
- state.default.session.setUsername(user);
40
- state.default.session.setPassword(password);
41
- state.default.session.setAllowInsecureConnection(options.insecure);
42
- const conn = await getConnectionProfile();
43
- state.default.session.setTenant(conn.tenant);
44
- if (conn.key != null && conn.secret != null) {
45
- credsFromParameters = false;
46
- state.default.session.setLogApiKey(conn.key);
47
- state.default.session.setLogApiSecret(conn.secret);
48
- } else {
49
- if (conn.username == null && conn.password == null) {
50
- if (
51
- !state.default.session.getUsername() &&
52
- !state.default.session.getPassword()
53
- ) {
54
- credsFromParameters = false;
55
- console.log(
56
- 'User credentials not specified as parameters and no saved API key and secret found!',
57
- 'warn'
58
- );
59
- return;
60
- }
61
- } else {
62
- state.default.session.setUsername(conn.username);
63
- state.default.session.setPassword(conn.password);
64
- }
65
- if (await getTokens()) {
66
- const creds = await provisionCreds();
67
- state.default.session.setLogApiKey(creds.api_key_id);
68
- state.default.session.setLogApiSecret(creds.api_key_secret);
69
- }
70
- }
71
- console.log(
72
- `Tailing ID Cloud logs from the following sources: ${
73
- command.opts().sources
74
- } and levels [${resolveLevel(command.opts().level)}]...`
75
- );
76
- if (credsFromParameters) await saveConnectionProfile(); // save new values if they were specified on CLI
77
- await tailLogs(
78
- command.opts().sources,
79
- resolveLevel(command.opts().level),
80
- command.opts().transactionId,
81
- null
82
- );
83
- });
84
-
85
- program.parse();