UNPKG

@salesforce/plugin-user

Version:

Commands to interact with Users and Permission Sets

73 lines 2.94 kB
/* * Copyright 2026, Salesforce, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { arrayWithDeprecation, Flags, loglevel, orgApiVersionFlagWithDeprecations } from '@salesforce/sf-plugins-core'; import { Messages } from '@salesforce/core'; import { ensureArray } from '@salesforce/kit'; import { UserPasswordGenerateBaseCommand } from '../../../../baseCommands/user/password/generate.js'; Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); const messages = Messages.loadMessages('@salesforce/plugin-user', 'password.generate'); export class ForceUserPasswordGenerateCommand extends UserPasswordGenerateBaseCommand { static summary = messages.getMessage('summary'); static description = messages.getMessage('description'); static examples = messages.getMessages('examples'); static state = 'deprecated'; static deprecationOptions = { to: 'org generate password', }; static hidden = true; static flags = { 'on-behalf-of': arrayWithDeprecation({ aliases: ['onbehalfof'], deprecateAliases: true, char: 'o', summary: messages.getMessage('flags.onBehalfOf.summary'), }), length: Flags.integer({ char: 'l', summary: messages.getMessage('flags.length.summary'), min: 8, max: 1000, default: 20, }), // the higher the value, the stronger the password complexity: Flags.integer({ char: 'c', summary: messages.getMessage('flags.complexity.summary'), min: 0, max: 5, default: 5, }), 'target-org': Flags.requiredOrg({ char: 'u', summary: messages.getMessage('flags.target-org.summary'), aliases: ['targetusername'], deprecateAliases: true, required: true, }), 'api-version': orgApiVersionFlagWithDeprecations, loglevel, }; async run() { const { flags } = await this.parse(ForceUserPasswordGenerateCommand); return this.generate({ usernames: ensureArray(flags['on-behalf-of'] ?? flags['target-org'].getUsername()), length: flags.length, complexity: flags.complexity, conn: flags['target-org'].getConnection(flags['api-version']), }); } } //# sourceMappingURL=generate.js.map