Skip to content
Open
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
} from './cli/FrodoCommand';
import idm from './cli/idm/idm';
import idp from './cli/idp/idp';
import iga from './cli/iga/iga';
import info from './cli/info/info';
import journey from './cli/journey/journey';
import log from './cli/log/log';
Expand Down Expand Up @@ -90,6 +91,7 @@ process.argv = normalizeExpandedHelpArgv(process.argv);
program.addCommand(esv());
program.addCommand(idm());
program.addCommand(idp());
program.addCommand(iga());
program.addCommand(info());
program.addCommand(journey());
program.addCommand(log());
Expand Down
13 changes: 5 additions & 8 deletions src/cli/FrodoCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,12 @@ function decorateDescriptionWithStability(
*/
function cloneOption(option: Option): Option {
const cloned = Object.assign(new Option(option.flags, option.description), {
defaultValue: option.defaultValue,
defaultValueDescription: option.defaultValueDescription,
presetArg: option.presetArg,
envVar: option.envVar,
parseArg: option.parseArg,
hidden: option.hidden,
mandatory: option.mandatory,
...option,
// @ts-expect-error: CommanderJS Typings needs an update for node_modules to recognize conflictsWith
conflictsWith: option.conflictsWith
? [...option.conflictsWith]
: option.conflictsWith,
argChoices: option.argChoices ? [...option.argChoices] : option.argChoices,
helpGroupHeading: option.helpGroupHeading,
});

setStabilityMetadata(cloned, getStabilityMetadata(option));
Expand Down
8 changes: 8 additions & 0 deletions src/cli/config/config-export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ export default function setup() {
'Export managed.idm.json objects separately in their own directory. Ignored with -a.'
)
)
.addOption(
new Option(
'-c, --only-custom',
'Only export custom request types (IGA cloud deployments only).'
)
)
.addOption(
new Option(
'--include-active-values',
Expand Down Expand Up @@ -170,6 +176,7 @@ export default function setup() {
includeReadOnly: options.readOnly,
onlyRealm: options.realmOnly,
onlyGlobal: options.globalOnly,
onlyCustom: options.onlyCustom,
}
);
if (!outcome) process.exitCode = 1;
Expand Down Expand Up @@ -202,6 +209,7 @@ export default function setup() {
includeReadOnly: options.readOnly,
onlyRealm: options.realmOnly,
onlyGlobal: options.globalOnly,
onlyCustom: options.onlyCustom,
}
);
if (!outcome) process.exitCode = 1;
Expand Down
9 changes: 9 additions & 0 deletions src/cli/config/config-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ export default function setup() {
'Import all scripts including the default scripts.'
)
)
.addOption(
new Option(
'-c, --only-custom',
'Only import custom request types (IGA cloud deployments only).'
)
)
.addOption(
new Option(
'--include-active-values',
Expand Down Expand Up @@ -129,6 +135,7 @@ export default function setup() {
includeDefault: options.default,
includeActiveValues: options.includeActiveValues,
source: options.source,
onlyCustom: options.onlyCustom,
});
if (!outcome) process.exitCode = 1;
}
Expand All @@ -152,6 +159,7 @@ export default function setup() {
includeDefault: options.default,
includeActiveValues: options.includeActiveValues,
source: options.source,
onlyCustom: options.onlyCustom,
});
if (!outcome) process.exitCode = 1;
}
Expand All @@ -169,6 +177,7 @@ export default function setup() {
includeDefault: options.default,
includeActiveValues: options.includeActiveValues,
source: options.source,
onlyCustom: options.onlyCustom,
}
);
if (!outcome) process.exitCode = 1;
Expand Down
79 changes: 79 additions & 0 deletions src/cli/iga/events/iga-events-delete.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { frodo, state } from '@rockcarver/frodo-lib';
import { Option } from 'commander';

import { getTokens } from '../../../ops/AuthenticateOps';
import { deleteEvent, deleteEvents } from '../../../ops/cloud/iga/IgaEventsOps';
import { printMessage, verboseMessage } from '../../../utils/Console.js';
import { FrodoCommand } from '../../FrodoCommand';

const { CLOUD_DEPLOYMENT_TYPE_KEY } = frodo.utils.constants;

const deploymentTypes = [CLOUD_DEPLOYMENT_TYPE_KEY];

export default function setup() {
const program = new FrodoCommand('frodo iga events delete');

program
.description('Delete events.')
.addOption(
new Option(
'-i, --event-id <event-id>',
'Event id. If specified, -a cannot be used.'
).conflicts(['all'])
)
.addOption(
new Option(
'-a, --all',
'Delete all events. If specified, -i cannot be used.'
).conflicts(['eventId'])
)
.action(
// implement command logic inside action handler
async (host, realm, user, password, options, command) => {
command.handleDefaultArgsAndOpts(
host,
realm,
user,
password,
options,
command
);
if (!options.eventId && !options.all) {
printMessage(
'Unrecognized combination of options or no options...',
'error'
);
process.exitCode = 1;
program.help();
}
const getTokensIsSuccessful = await getTokens(
false,
true,
deploymentTypes
);
if (!getTokensIsSuccessful) process.exit(1);
if (!state.getIsIGA()) {
printMessage(
'Command not supported for non-IGA cloud tenants',
'error'
);
process.exit(1);
}
// delete by id
if (options.eventId) {
verboseMessage('Deleting event...');
const outcome = await deleteEvent(options.eventId);
if (!outcome) process.exit(1);
}
// --all -a
else if (options.all) {
verboseMessage('Deleting all events...');
const outcome = await deleteEvents();
if (!outcome) process.exit(1);
}
}
// end command logic inside action handler
);

return program;
}
66 changes: 66 additions & 0 deletions src/cli/iga/events/iga-events-describe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { frodo, state } from '@rockcarver/frodo-lib';
import { Option } from 'commander';

import { getTokens } from '../../../ops/AuthenticateOps';
import { describeEvent } from '../../../ops/cloud/iga/IgaEventsOps';
import { printMessage, verboseMessage } from '../../../utils/Console';
import { FrodoCommand } from '../../FrodoCommand';

const { CLOUD_DEPLOYMENT_TYPE_KEY } = frodo.utils.constants;

const deploymentTypes = [CLOUD_DEPLOYMENT_TYPE_KEY];

export default function setup() {
const program = new FrodoCommand('frodo iga events describe');

program
.description('Describe events.')
.addOption(
new Option(
'-i, --event-id <event-id>',
'event id. If not specified, will describe first event in the provided export file.'
)
)
.addOption(
new Option(
'-f, --file <file>',
'Name of the event export file to describe. If not specified, will automatically pull the event export data of the provided id from the tenant.'
)
)
.action(async (host, realm, user, password, options, command) => {
command.handleDefaultArgsAndOpts(
host,
realm,
user,
password,
options,
command
);
if (!options.eventId && !options.file) {
printMessage(
'Unrecognized combination of options or no options...',
'error'
);
process.exitCode = 1;
program.help();
}
const getTokensIsSuccessful = await getTokens(
false,
true,
deploymentTypes
);
if (!getTokensIsSuccessful) process.exit(1);
if (!state.getIsIGA()) {
printMessage(
'Command not supported for non-IGA cloud tenants',
'error'
);
process.exit(1);
}
verboseMessage(`Describing event ${options.eventId}...`);
const outcome = await describeEvent(options.eventId, options.file);
if (!outcome) process.exit(1);
});

return program;
}
Loading