Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ FLAG DESCRIPTIONS
sandbox.
```

_See code: [lib/commands/org/create/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/lib/commands/org/create/sandbox.ts)_
_See code: [src/commands/org/create/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/src/commands/org/create/sandbox.ts)_

## `sf org create scratch`

Expand Down Expand Up @@ -369,7 +369,7 @@ FLAG DESCRIPTIONS
Omit this flag to have Salesforce generate a unique username for your org.
```

_See code: [lib/commands/org/create/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/lib/commands/org/create/scratch.ts)_
_See code: [src/commands/org/create/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/src/commands/org/create/scratch.ts)_

## `sf org delete sandbox`

Expand Down Expand Up @@ -413,7 +413,7 @@ EXAMPLES
$ sf org delete sandbox --target-org my-sandbox --no-prompt
```

_See code: [lib/commands/org/delete/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/lib/commands/org/delete/sandbox.ts)_
_See code: [src/commands/org/delete/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/src/commands/org/delete/sandbox.ts)_

## `sf org delete scratch`

Expand Down Expand Up @@ -455,7 +455,7 @@ EXAMPLES
$ sf org delete scratch --target-org my-scratch-org --no-prompt
```

_See code: [lib/commands/org/delete/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/lib/commands/org/delete/scratch.ts)_
_See code: [src/commands/org/delete/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/src/commands/org/delete/scratch.ts)_

## `sf org disable tracking`

Expand Down Expand Up @@ -493,7 +493,7 @@ EXAMPLES
$ sf org disable tracking
```

_See code: [lib/commands/org/disable/tracking.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/lib/commands/org/disable/tracking.ts)_
_See code: [src/commands/org/disable/tracking.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/src/commands/org/disable/tracking.ts)_

## `sf org display`

Expand Down Expand Up @@ -537,7 +537,7 @@ EXAMPLES
$ sf org display --target-org TestOrg1 --verbose
```

_See code: [lib/commands/org/display.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/lib/commands/org/display.ts)_
_See code: [src/commands/org/display.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/src/commands/org/display.ts)_

## `sf org enable tracking`

Expand Down Expand Up @@ -578,7 +578,7 @@ EXAMPLES
$ sf org enable tracking
```

_See code: [lib/commands/org/enable/tracking.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/lib/commands/org/enable/tracking.ts)_
_See code: [src/commands/org/enable/tracking.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/src/commands/org/enable/tracking.ts)_

## `sf org list`

Expand Down Expand Up @@ -616,7 +616,7 @@ EXAMPLES
$ sf org list --clean
```

_See code: [lib/commands/org/list.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/lib/commands/org/list.ts)_
_See code: [src/commands/org/list.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/src/commands/org/list.ts)_

## `sf org list metadata`

Expand Down Expand Up @@ -681,7 +681,7 @@ FLAG DESCRIPTIONS
Examples of metadata types that use folders are Dashboard, Document, EmailTemplate, and Report.
```

_See code: [lib/commands/org/list/metadata.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/lib/commands/org/list/metadata.ts)_
_See code: [src/commands/org/list/metadata.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/src/commands/org/list/metadata.ts)_

## `sf org list metadata-types`

Expand Down Expand Up @@ -735,7 +735,7 @@ FLAG DESCRIPTIONS
Override the api version used for api requests made by this command
```

_See code: [lib/commands/org/list/metadata-types.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/lib/commands/org/list/metadata-types.ts)_
_See code: [src/commands/org/list/metadata-types.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/src/commands/org/list/metadata-types.ts)_

## `sf org open`

Expand Down Expand Up @@ -801,7 +801,7 @@ EXAMPLES
$ sf org open --source-file force-app/main/default/flows/Hello.flow-meta.xml
```

_See code: [lib/commands/org/open.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/lib/commands/org/open.ts)_
_See code: [src/commands/org/open.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/src/commands/org/open.ts)_

## `sf org resume sandbox`

Expand Down Expand Up @@ -863,7 +863,7 @@ FLAG DESCRIPTIONS
returns the job ID. To resume checking the sandbox creation, rerun this command.
```

_See code: [lib/commands/org/resume/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/lib/commands/org/resume/sandbox.ts)_
_See code: [src/commands/org/resume/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/src/commands/org/resume/sandbox.ts)_

## `sf org resume scratch`

Expand Down Expand Up @@ -909,6 +909,6 @@ FLAG DESCRIPTIONS
The job ID is valid for 24 hours after you start the scratch org creation.
```

_See code: [lib/commands/org/resume/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/lib/commands/org/resume/scratch.ts)_
_See code: [src/commands/org/resume/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/3.2.1/src/commands/org/resume/scratch.ts)_

<!-- commandsstop -->
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"author": "Salesforce",
"bugs": "https://github.com/forcedotcom/cli/issues",
"dependencies": {
"@oclif/core": "^3.15.1",
"@oclif/core": "^3.16.0",
"@salesforce/core": "^6.4.4",
"@salesforce/kit": "^3.0.15",
"@salesforce/sf-plugins-core": "^5.0.3",
"@salesforce/sf-plugins-core": "^7.0.0",
"@salesforce/source-deploy-retrieve": "^10.2.5",
"chalk": "^4",
"chalk": "^5.3.0",
"change-case": "^5.3.0",
"open": "^9.1.0"
"open": "^10.0.2"
},
"devDependencies": {
"@oclif/plugin-command-snapshot": "^5.0.5",
Expand Down
16 changes: 6 additions & 10 deletions src/commands/force/org/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,6 @@ export class Create extends SfCommand<CreateResult> {

this.logger.debug('validation complete');

// If the user supplied a specific client ID, we have no way of knowing if it's
// a certificate-based Connected App or not. Therefore, we have to assume that
// we'll need the client secret, so prompt the user for it.
const { clientSecret } = this.flags.clientid
? await this.prompt<{ clientSecret: string }>([
{ name: 'clientSecret', type: 'mask', message: messages.getMessage('secretPrompt') },
])
: { clientSecret: undefined };

const createCommandOptions: ScratchOrgRequest = {
connectedAppConsumerKey: this.flags.clientid,
durationDays: this.flags.durationdays,
Expand All @@ -282,7 +273,12 @@ export class Create extends SfCommand<CreateResult> {
apiversion: this.flags['api-version'],
definitionfile: this.flags.definitionfile,
orgConfig: this.varArgs,
clientSecret,
// If the user supplied a specific client ID, we have no way of knowing if it's
// a certificate-based Connected App or not. Therefore, we have to assume that
// we'll need the client secret, so prompt the user for it.
clientSecret: this.flags.clientid
? await this.secretPrompt({ message: messages.getMessage('secretPrompt') })
: undefined,
setDefault: this.flags.setdefaultusername === true,
alias: this.flags.setalias,
tracksSource: true,
Expand Down
4 changes: 3 additions & 1 deletion src/commands/force/org/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export class Delete extends SfCommand<DeleteResult> {
// we either need permission to proceed without a prompt OR get the user to confirm
if (
flags['no-prompt'] ||
(await this.confirm(messages.getMessage('confirmDelete', [isSandbox ? 'sandbox' : 'scratch', resolvedUsername])))
(await this.confirm({
message: messages.getMessage('confirmDelete', [isSandbox ? 'sandbox' : 'scratch', resolvedUsername]),
}))
) {
let alreadyDeleted = false;
let successMessageKey = 'commandSandboxSuccess';
Expand Down
20 changes: 6 additions & 14 deletions src/commands/org/create/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/



import { Duration } from '@salesforce/kit';
import { Flags } from '@salesforce/sf-plugins-core';
import { Lifecycle, Messages, SandboxEvents, SandboxProcessObject, SandboxRequest, SfError } from '@salesforce/core';
Expand All @@ -16,7 +14,7 @@ import requestFunctions from '../../../shared/sandboxRequest.js';
import { SandboxCommandBase } from '../../../shared/sandboxCommandBase.js';
import { SandboxLicenseType } from '../../../shared/orgTypes.js';

Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@salesforce/plugin-org', 'create.sandbox');

const getLicenseTypes = (): string[] => Object.values(SandboxLicenseType);
Expand Down Expand Up @@ -225,17 +223,11 @@ export default class CreateSandbox extends SandboxCommandBase<SandboxProcessObje
this.styledHeader('Config Sandbox Request');
this.table(data, columns, {});

const configurationCorrect = await this.timedPrompt<{ continue: boolean }>(
[
{
name: 'continue',
type: 'confirm',
message: messages.getMessage('isConfigurationOk'),
},
],
10_000
);
if (!configurationCorrect.continue) {
if (
!(await this.confirm({
message: messages.getMessage('isConfigurationOk'),
}))
) {
throw messages.createError('error.UserNotSatisfiedWithSandboxConfig');
}
}
Expand Down
16 changes: 1 addition & 15 deletions src/commands/org/create/scratch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export default class EnvCreateScratch extends SfCommand<ScratchCreateResponse> {

const createCommandOptions = await buildScratchOrgRequest(
flags,
flags['client-id'] ? await this.clientSecretPrompt() : undefined
flags['client-id'] ? await this.secretPrompt({ message: messages.getMessage('prompt.secret') }) : undefined
);
let lastStatus: string | undefined;

Expand Down Expand Up @@ -210,18 +210,4 @@ export default class EnvCreateScratch extends SfCommand<ScratchCreateResponse> {
}
}
}

private async clientSecretPrompt(): Promise<string> {
const { secret } = await this.timedPrompt<{ secret: string }>(
[
{
name: 'secret',
message: messages.getMessage('prompt.secret'),
type: 'password',
},
],
secretTimeout
);
return secret;
}
}
5 changes: 2 additions & 3 deletions src/commands/org/delete/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/


import { AuthInfo, AuthRemover, Messages, Org, SfError, StateAggregator } from '@salesforce/core';
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
import { orgThatMightBeDeleted } from '../../../shared/flags.js';

Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@salesforce/plugin-org', 'delete_sandbox');

export interface SandboxDeleteResponse {
Expand Down Expand Up @@ -62,7 +61,7 @@ export default class DeleteSandbox extends SfCommand<SandboxDeleteResponse> {
throw messages.createError('error.unknownSandbox', [username]);
}

if (flags['no-prompt'] || (await this.confirm(messages.getMessage('prompt.confirm', [username])))) {
if (flags['no-prompt'] || (await this.confirm({ message: messages.getMessage('prompt.confirm', [username]) }))) {
try {
const org = await Org.create({ aliasOrUsername: username });
await org.delete();
Expand Down
9 changes: 5 additions & 4 deletions src/commands/org/delete/scratch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/



import { AuthInfo, AuthRemover, Messages, Org } from '@salesforce/core';
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
import { orgThatMightBeDeleted } from '../../../shared/flags.js';

Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@salesforce/plugin-org', 'delete_scratch');

export interface ScratchDeleteResponse {
Expand Down Expand Up @@ -41,7 +39,10 @@ export default class DeleteScratch extends SfCommand<ScratchDeleteResponse> {
const resolvedUsername = flags['target-org'];
const orgId = (await AuthInfo.create({ username: resolvedUsername })).getFields().orgId as string;

if (flags['no-prompt'] || (await this.confirm(messages.getMessage('prompt.confirm', [resolvedUsername])))) {
if (
flags['no-prompt'] ||
(await this.confirm({ message: messages.getMessage('prompt.confirm', [resolvedUsername]) }))
) {
try {
const org = await Org.create({ aliasOrUsername: resolvedUsername });

Expand Down
10 changes: 4 additions & 6 deletions src/commands/org/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/



import { Flags, loglevel, SfCommand } from '@salesforce/sf-plugins-core';
import { AuthInfo, ConfigAggregator, ConfigInfo, Connection, Org, SfError, Messages, Logger } from '@salesforce/core';
import { Interfaces } from '@oclif/core';
import chalk from 'chalk';
import chalk, { ChalkInstance } from 'chalk';
import { OrgListUtil, identifyActiveOrgByStatus } from '../../shared/orgListUtil.js';
import { getStyledObject } from '../../shared/orgHighlighter.js';
import { ExtendedAuthFields, FullyPopulatedScratchOrgFields } from '../../shared/orgTypes.js';

Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@salesforce/plugin-org', 'list');

export const defaultOrgEmoji = '🍁';
Expand Down Expand Up @@ -117,7 +115,7 @@ Legend: ${defaultHubEmoji}=Default DevHub, ${defaultOrgEmoji}=Default Org ${
}

protected async cleanScratchOrgs(scratchOrgs: ExtendedAuthFields[], prompt?: boolean): Promise<void> {
if (prompt && (await this.confirm(messages.getMessage('prompt', [scratchOrgs.length]))) === false) {
if (prompt && (await this.confirm({ message: messages.getMessage('prompt', [scratchOrgs.length]) })) === false) {
return;
}

Expand Down Expand Up @@ -259,7 +257,7 @@ const addType =
(val: ExtendedAuthFields): ExtendedAuthFieldsWithType => ({ ...val, type });

const colorEveryFieldButConnectedStatus =
(colorFn: chalk.Chalk) =>
(colorFn: ChalkInstance) =>
(row: ExtendedAuthFieldsWithType): ExtendedAuthFieldsWithType =>
Object.fromEntries(
Object.entries(row).map(([key, val]) => [
Expand Down
21 changes: 9 additions & 12 deletions src/commands/org/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
*/

import path from 'node:path';


import {
Flags,
loglevel,
Expand All @@ -21,7 +19,7 @@ import { MetadataResolver } from '@salesforce/source-deploy-retrieve';
import { apps } from 'open';
import utils from '../../shared/utils.js';

Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@salesforce/plugin-org', 'open');
const sharedMessages = Messages.loadMessages('@salesforce/plugin-org', 'messages');

Expand All @@ -35,12 +33,12 @@ export class OrgOpenCommand extends SfCommand<OrgOpenOutput> {
public static readonly flags = {
'target-org': requiredOrgFlagWithDeprecations,
'api-version': orgApiVersionFlagWithDeprecations,
browser: Flags.string({
browser: Flags.option({
char: 'b',
summary: messages.getMessage('flags.browser.summary'),
options: ['chrome', 'edge', 'firefox'], // These are ones supported by "open" package
options: ['chrome', 'edge', 'firefox'] as const, // These are ones supported by "open" package
exclusive: ['url-only'],
}),
})(),
path: Flags.string({
char: 'p',
summary: messages.getMessage('flags.path.summary'),
Expand Down Expand Up @@ -130,12 +128,11 @@ export class OrgOpenCommand extends SfCommand<OrgOpenOutput> {
throw err;
}

const openOptions = flags.browser
? // assertion can be removed once oclif option flag typings are fixed
{ app: { name: apps[flags.browser as 'chrome' | 'edge' | 'firefox'] } }
: {};

await utils.openUrl(url, openOptions);
await utils.openUrl(url, {
...(flags.browser ? { app: { name: apps[flags.browser] } } : {}),
// only applies on macOS. open library ignores this property as it is the default behavior on other OS
newInstance: true,
});
return output;
}

Expand Down
Loading