generator-jhipster-encrypt-id
Version:
JHipster blueprint to encrypt the ids of all entities in the UI and API.
54 lines (52 loc) • 1.43 kB
JavaScript
/**
* @type {import('generator-jhipster').JHipsterCommandDefinition}
*/
const command = {
options: {},
configs: {
encryptIdEnable: {
cli: {
type: Boolean,
},
prompt: {
type: 'confirm',
name: 'encryptIdEnable',
message: 'Do you want to encrypt the ids of entities in the API and the UI?',
default: true,
},
scope: 'blueprint',
},
encryptIdType: {
cli: {
type: String,
},
prompt: generator => ({
when: answers => (generator.initialRun || generator.options.askAnswered) && answers.encryptIdEnable,
type: 'list',
name: 'encryptIdType',
message: 'Do you want to encrypt the ids of all existing entities?',
choices: [
{ name: 'Yes, update all', value: 'all' },
{ name: 'No, let me choose the entities to update', value: 'selected' },
],
default: 'all',
}),
scope: 'blueprint',
},
encryptIdEntities: {
cli: {
type: Array,
},
prompt: generator => ({
when: answers => answers.encryptIdType === 'selected',
type: 'checkbox',
name: 'encryptIdEntities',
message: 'Please choose the entities to be encrypted',
choices: generator.getExistingEntities().map(e => e.name),
default: [],
}),
scope: 'blueprint',
},
},
};
export default command;