@rockcarver/frodo-cli 0.14.0 → 0.14.1

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 +10 -2
  2. package/package.json +1 -1
  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,102 +0,0 @@
1
- import { Command, Option } from 'commander';
2
- import { Authenticate, Saml2, state } from '@rockcarver/frodo-lib';
3
- import * as common from '../cmd_common.js';
4
-
5
- const { getTokens } = Authenticate;
6
-
7
- const {
8
- importSaml2ProviderFromFile,
9
- importSaml2ProvidersFromFile,
10
- importSaml2ProvidersFromFiles,
11
- importFirstSaml2ProviderFromFile,
12
- } = Saml2;
13
-
14
- const program = new Command('frodo saml import');
15
-
16
- program
17
- .description('Import SAML entity providers.')
18
- .helpOption('-h, --help', 'Help')
19
- .showHelpAfterError()
20
- .addArgument(common.hostArgumentM)
21
- .addArgument(common.realmArgument)
22
- .addArgument(common.userArgument)
23
- .addArgument(common.passwordArgument)
24
- .addOption(common.deploymentOption)
25
- .addOption(common.insecureOption)
26
- .addOption(
27
- new Option(
28
- '-i, --entity-id <entity-id>',
29
- 'Entity id. If specified, only one provider is imported and the options -a and -A are ignored.'
30
- )
31
- )
32
- .addOption(
33
- new Option(
34
- '-f, --file <file>',
35
- 'Name of the file to import the entity provider(s) from.'
36
- )
37
- )
38
- .addOption(
39
- new Option(
40
- '-a, --all',
41
- 'Import all entity providers from single file. Ignored with -i.'
42
- )
43
- )
44
- .addOption(
45
- new Option(
46
- '-A, --all-separate',
47
- 'Import all entity providers from separate files (*.saml.json) in the current directory. Ignored with -i or -a.'
48
- )
49
- )
50
- .action(
51
- // implement program logic inside action handler
52
- async (host, realm, user, password, options) => {
53
- state.default.session.setTenant(host);
54
- state.default.session.setRealm(realm);
55
- state.default.session.setUsername(user);
56
- state.default.session.setPassword(password);
57
- state.default.session.setDeploymentType(options.type);
58
- state.default.session.setAllowInsecureConnection(options.insecure);
59
- if (await getTokens()) {
60
- // import by id
61
- if (options.file && options.entityId) {
62
- console.log(
63
- `Importing provider "${
64
- options.entityId
65
- }" into realm "${state.default.session.getRealm()}"...`
66
- );
67
- importSaml2ProviderFromFile(options.entityId, options.file);
68
- }
69
- // --all -a
70
- else if (options.all && options.file) {
71
- console.log(
72
- `Importing all providers from a single file (${options.file})...`
73
- );
74
- importSaml2ProvidersFromFile(options.file);
75
- }
76
- // --all-separate -A
77
- else if (options.allSeparate && !options.file) {
78
- console.log(
79
- 'Importing all providers from separate files (*.saml.json) in current directory...'
80
- );
81
- importSaml2ProvidersFromFiles();
82
- }
83
- // import first provider from file
84
- else if (options.file) {
85
- console.log(
86
- `Importing first provider from file "${
87
- options.file
88
- }" into realm "${state.default.session.getRealm()}"...`
89
- );
90
- importFirstSaml2ProviderFromFile(options.file);
91
- }
92
- // unrecognized combination of options or no options
93
- else {
94
- console.log('Unrecognized combination of options or no options...');
95
- program.help();
96
- }
97
- }
98
- }
99
- // end program logic inside action handler
100
- );
101
-
102
- program.parse();
@@ -1,42 +0,0 @@
1
- import { Command, Option } from 'commander';
2
- import { Authenticate, Saml2, state } from '@rockcarver/frodo-lib';
3
- import * as common from '../cmd_common.js';
4
-
5
- const { getTokens } = Authenticate;
6
- const { listSaml2Providers } = Saml2;
7
-
8
- const program = new Command('frodo saml list');
9
-
10
- program
11
- .description('List SAML entity 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 SAML entity providers in realm "${state.default.session.getRealm()}"...`
35
- );
36
- listSaml2Providers(options.long);
37
- }
38
- }
39
- // end command logic inside action handler
40
- );
41
-
42
- program.parse();
@@ -1,76 +0,0 @@
1
- import { Command, Option } from 'commander';
2
- import { Authenticate, Saml2, state } from '@rockcarver/frodo-lib';
3
- import * as common from '../cmd_common.js';
4
-
5
- const { getTokens } = Authenticate;
6
-
7
- const { exportSaml2Metadata } = Saml2;
8
-
9
- const program = new Command('frodo saml metadata export');
10
-
11
- program
12
- .description('Export SAML metadata.')
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, --entity-id <entity-id>',
24
- 'Entity id. 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 metadata to. Ignored with -A. If not specified, the export file is named <entity-id>.metadata.xml.'
31
- )
32
- )
33
- .addOption(
34
- new Option(
35
- '-A, --all-separate',
36
- 'Export all the providers in a realm as separate files <provider name>.saml.json. Ignored with -t, -i, and -a.'
37
- )
38
- )
39
- .action(
40
- // implement command logic inside action handler
41
- async (host, realm, user, password, options) => {
42
- state.default.session.setTenant(host);
43
- state.default.session.setRealm(realm);
44
- state.default.session.setUsername(user);
45
- state.default.session.setPassword(password);
46
- state.default.session.setDeploymentType(options.type);
47
- state.default.session.setAllowInsecureConnection(options.insecure);
48
- if (await getTokens()) {
49
- // export by id/name
50
- if (options.entityId) {
51
- console.log(
52
- `Exporting metadata for provider "${
53
- options.entityId
54
- }" from realm "${state.default.session.getRealm()}"...`
55
- );
56
- exportSaml2Metadata(options.entityId, options.file);
57
- }
58
- // // --all-separate -A
59
- // else if (options.allSeparate) {
60
- // console.log('Exporting all providers to separate files...');
61
- // exportProvidersToFiles();
62
- // }
63
- // unrecognized combination of options or no options
64
- else {
65
- console.log(
66
- 'Unrecognized combination of options or no options...',
67
- 'error'
68
- );
69
- program.help();
70
- }
71
- }
72
- }
73
- // end command logic inside action handler
74
- );
75
-
76
- program.parse();
@@ -1,12 +0,0 @@
1
- import { Command } from 'commander';
2
-
3
- const program = new Command('frodo saml metadata');
4
-
5
- program
6
- .description('SAML metadata operations.')
7
- .helpOption('-h, --help', 'Help')
8
- .showHelpAfterError();
9
-
10
- program.command('export', 'Export metadata.').showHelpAfterError();
11
-
12
- program.parse();
@@ -1,29 +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('saml')
9
- .helpOption('-h, --help', 'Help')
10
- .description('Manage SAML entity providers and circles of trust.')
11
- .executableDir(__dirname);
12
-
13
- program.command('list', 'List entity providers.').showHelpAfterError();
14
-
15
- program
16
- .command('describe', 'Describe entity providers.')
17
- .showHelpAfterError();
18
-
19
- program.command('export', 'Export entity providers.').showHelpAfterError();
20
-
21
- program.command('import', 'Import entity providers.').showHelpAfterError();
22
-
23
- program.command('cot', 'Manage circles of trust.').showHelpAfterError();
24
-
25
- program.command('metadata', 'Metadata operations.').showHelpAfterError();
26
-
27
- program.showHelpAfterError();
28
- return program;
29
- }
@@ -1,56 +0,0 @@
1
- import { Command, Option } 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
- const program = new Command('frodo cmd delete');
8
-
9
- program
10
- .description('Cmd delete.')
11
- .helpOption('-h, --help', 'Help')
12
- .showHelpAfterError()
13
- .addArgument(common.hostArgumentM)
14
- .addArgument(common.realmArgument)
15
- .addArgument(common.userArgument)
16
- .addArgument(common.passwordArgument)
17
- .addOption(common.deploymentOption)
18
- .addOption(common.insecureOption)
19
- .addOption(
20
- new Option(
21
- '-i, --cmd-id <cmd-id>',
22
- 'Cmd id. If specified, -a and -A are ignored.'
23
- )
24
- )
25
- .addOption(
26
- new Option('-a, --all', 'Delete all cmds in a realm. Ignored with -i.')
27
- )
28
- .addOption(
29
- new Option(
30
- '--no-deep',
31
- 'No deep delete. This leaves orphaned configuration artifacts behind.'
32
- )
33
- )
34
- .addOption(
35
- new Option(
36
- '--verbose',
37
- 'Verbose output during command execution. If specified, may or may not produce additional output.'
38
- ).default(false, 'off')
39
- )
40
- .action(
41
- // implement command logic inside action handler
42
- async (host, realm, user, password, options) => {
43
- state.default.session.setTenant(host);
44
- state.default.session.setRealm(realm);
45
- state.default.session.setUsername(user);
46
- state.default.session.setPassword(password);
47
- state.default.session.setDeploymentType(options.type);
48
- state.default.session.setAllowInsecureConnection(options.insecure);
49
- if (await getTokens()) {
50
- // code goes here
51
- }
52
- }
53
- // end command logic inside action handler
54
- );
55
-
56
- program.parse();
@@ -1,36 +0,0 @@
1
- import { Command, Option } 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
- const program = new Command('frodo cmd describe');
8
-
9
- program
10
- .description('Cmd describe.')
11
- .helpOption('-h, --help', 'Help')
12
- .showHelpAfterError()
13
- .addArgument(common.hostArgumentM)
14
- .addArgument(common.realmArgument)
15
- .addArgument(common.userArgument)
16
- .addArgument(common.passwordArgument)
17
- .addOption(common.deploymentOption)
18
- .addOption(common.insecureOption)
19
- .addOption(new Option('-i, --cmd-id <cmd-id>', 'Cmd id.'))
20
- .action(
21
- // implement command logic inside action handler
22
- async (host, realm, user, password, options) => {
23
- state.default.session.setTenant(host);
24
- state.default.session.setRealm(realm);
25
- state.default.session.setUsername(user);
26
- state.default.session.setPassword(password);
27
- state.default.session.setDeploymentType(options.type);
28
- state.default.session.setAllowInsecureConnection(options.insecure);
29
- if (await getTokens()) {
30
- // code goes here
31
- }
32
- }
33
- // end command logic inside action handler
34
- );
35
-
36
- program.parse();
@@ -1,95 +0,0 @@
1
- import { Command, Option } from 'commander';
2
- import { Authenticate, Script, state } from '@rockcarver/frodo-lib';
3
- import * as common from '../cmd_common.js';
4
-
5
- const { getTokens } = Authenticate;
6
- const { exportScriptByName } = Script;
7
- const { exportScriptsToFile } = Script;
8
- const { exportScriptsToFiles } = Script;
9
-
10
- const program = new Command('frodo script export');
11
-
12
- program
13
- .description('Export scripts.')
14
- .helpOption('-h, --help', 'Help')
15
- .showHelpAfterError()
16
- .addArgument(common.hostArgumentM)
17
- .addArgument(common.realmArgument)
18
- .addArgument(common.userArgument)
19
- .addArgument(common.passwordArgument)
20
- .addOption(common.deploymentOption)
21
- .addOption(common.insecureOption)
22
- .addOption(
23
- new Option(
24
- '-n, --script-name <name>',
25
- 'Name of the script. If specified, -a and -A are ignored.'
26
- )
27
- )
28
- // .addOption(
29
- // new Option(
30
- // '-i, --script-id <uuid>',
31
- // 'Uuid of the script. If specified, -a and -A are ignored.'
32
- // )
33
- // )
34
- .addOption(new Option('-f, --file <file>', 'Name of the export file.'))
35
- .addOption(
36
- new Option(
37
- '-a, --all',
38
- 'Export all scripts to a single file. Ignored with -i.'
39
- )
40
- )
41
- .addOption(
42
- new Option(
43
- '-A, --all-separate',
44
- 'Export all scripts to separate files (*.script.json) in the current directory. Ignored with -i or -a.'
45
- )
46
- )
47
- // deprecated option
48
- .addOption(
49
- new Option(
50
- '-s, --script <script>',
51
- 'DEPRECATED! Use -n/--script-name instead. Name of the script.'
52
- )
53
- )
54
- .action(
55
- // implement command logic inside action handler
56
- async (host, realm, user, password, options) => {
57
- state.default.session.setTenant(host);
58
- state.default.session.setRealm(realm);
59
- state.default.session.setUsername(user);
60
- state.default.session.setPassword(password);
61
- state.default.session.setDeploymentType(options.type);
62
- state.default.session.setAllowInsecureConnection(options.insecure);
63
- if (await getTokens()) {
64
- // export by name
65
- if (options.scriptName || options.script) {
66
- console.log('Exporting script...');
67
- exportScriptByName(
68
- options.scriptName || options.script,
69
- options.file
70
- );
71
- }
72
- // -a / --all
73
- else if (options.all) {
74
- console.log('Exporting all scripts to a single file...');
75
- exportScriptsToFile(options.file);
76
- }
77
- // -A / --all-separate
78
- else if (options.allSeparate) {
79
- console.log('Exporting all scripts to separate files...');
80
- exportScriptsToFiles();
81
- }
82
- // unrecognized combination of options or no options
83
- else {
84
- console.log(
85
- 'Unrecognized combination of options or no options...',
86
- 'error'
87
- );
88
- program.help();
89
- }
90
- }
91
- }
92
- // end command logic inside action handler
93
- );
94
-
95
- program.parse();
@@ -1,64 +0,0 @@
1
- import { Command, Option } from 'commander';
2
- import { Authenticate, Script, state } from '@rockcarver/frodo-lib';
3
- import * as common from '../cmd_common.js';
4
-
5
- const { getTokens } = Authenticate;
6
-
7
- const { importScriptsFromFile } = Script;
8
-
9
- const program = new Command('frodo script import');
10
-
11
- program
12
- .description('Import scripts.')
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(new Option('-f, --file <file>', 'Name of the file to import.'))
22
- .addOption(
23
- new Option(
24
- '-n, --script-name <name>',
25
- 'Name of the script. If specified, -a and -A are ignored.'
26
- )
27
- )
28
- .addOption(
29
- new Option(
30
- '--re-uuid',
31
- 'Re-UUID. Create a new UUID for the script upon import. Use this to duplicate a script or create a new version of the same script. Note that you must also choose a new name using -n/--script-name to avoid import errors.'
32
- ).default(false, 'false')
33
- )
34
- // deprecated option
35
- .addOption(
36
- new Option(
37
- '-s, --script <script>',
38
- 'DEPRECATED! Use -n/--script-name instead. Name of the script.'
39
- )
40
- )
41
- .action(
42
- // implement command logic inside action handler
43
- async (host, realm, user, password, options) => {
44
- state.default.session.setTenant(host);
45
- state.default.session.setRealm(realm);
46
- state.default.session.setUsername(user);
47
- state.default.session.setPassword(password);
48
- state.default.session.setDeploymentType(options.type);
49
- state.default.session.setAllowInsecureConnection(options.insecure);
50
- if (await getTokens()) {
51
- console.log(
52
- `Importing script(s) into realm "${state.default.session.getRealm()}"...`
53
- );
54
- importScriptsFromFile(
55
- options.scriptName || options.script,
56
- options.file,
57
- options.reUuid
58
- );
59
- }
60
- }
61
- // end command logic inside action handler
62
- );
63
-
64
- program.parse();
@@ -1,42 +0,0 @@
1
- import { Command, Option } from 'commander';
2
- import { Authenticate, Script, state } from '@rockcarver/frodo-lib';
3
- import * as common from '../cmd_common.js';
4
-
5
- const { getTokens } = Authenticate;
6
- const { listScripts } = Script;
7
-
8
- const program = new Command('frodo script list');
9
-
10
- program
11
- .description('List scripts.')
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 scripts in realm "${state.default.session.getRealm()}"...`
35
- );
36
- await listScripts(options.long);
37
- }
38
- }
39
- // end command logic inside action handler
40
- );
41
-
42
- program.parse();
@@ -1,25 +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('script')
9
- .helpOption('-h, --help', 'Help')
10
- .description('Manage scripts.')
11
- .executableDir(__dirname);
12
-
13
- program.command('list', 'List scripts.').showHelpAfterError();
14
-
15
- // program.command('describe', 'Describe scripts.').showHelpAfterError();
16
-
17
- program.command('export', 'Export scripts.').showHelpAfterError();
18
-
19
- program.command('import', 'Import scripts.').showHelpAfterError();
20
-
21
- // program.command('delete', 'Delete scripts.').showHelpAfterError();
22
-
23
- program.showHelpAfterError();
24
- return program;
25
- }