Skip to content

Commit 770110f

Browse files
committed
Merge branch 'main' into mdonnalley/ink
2 parents 724a638 + 796e9ee commit 770110f

File tree

16 files changed

+1936
-1760
lines changed

16 files changed

+1936
-1760
lines changed

CHANGELOG.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
1+
## [4.4.6](https://github.com/salesforcecli/plugin-org/compare/4.4.5...4.4.6) (2024-08-11)
2+
3+
### Bug Fixes
4+
5+
- **deps:** bump @salesforce/sf-plugins-core from 11.2.4 to 11.3.0 ([d6871e5](https://github.com/salesforcecli/plugin-org/commit/d6871e5a30d9e6d9aced3b1ba6c1d8fd234d1f6a))
6+
7+
## [4.4.5](https://github.com/salesforcecli/plugin-org/compare/4.4.4...4.4.5) (2024-08-04)
8+
9+
### Bug Fixes
10+
11+
- **deps:** bump @salesforce/source-deploy-retrieve ([2a86eed](https://github.com/salesforcecli/plugin-org/commit/2a86eed0749b21184a47acca64f09e9b77959e48))
12+
13+
## [4.4.4](https://github.com/salesforcecli/plugin-org/compare/4.4.3...4.4.4) (2024-08-04)
14+
15+
### Bug Fixes
16+
17+
- **deps:** bump @salesforce/kit from 3.1.6 to 3.2.0 ([a9cd786](https://github.com/salesforcecli/plugin-org/commit/a9cd78624d2612fa426d10d516ca9b283db8efc6))
18+
19+
## [4.4.3](https://github.com/salesforcecli/plugin-org/compare/4.4.2...4.4.3) (2024-07-30)
20+
21+
### Bug Fixes
22+
23+
- **deps:** devScripts update ([#1155](https://github.com/salesforcecli/plugin-org/issues/1155)) ([aa294cd](https://github.com/salesforcecli/plugin-org/commit/aa294cd8a4177baf8434555c69a2a957b6893d4c))
24+
25+
## [4.4.2](https://github.com/salesforcecli/plugin-org/compare/4.4.1...4.4.2) (2024-07-28)
26+
27+
### Bug Fixes
28+
29+
- **deps:** bump @oclif/core from 4.0.12 to 4.0.16 ([ba59c66](https://github.com/salesforcecli/plugin-org/commit/ba59c66287433b0dfd2c79a29f573fb060e648eb))
30+
31+
## [4.4.1](https://github.com/salesforcecli/plugin-org/compare/4.4.0...4.4.1) (2024-07-28)
32+
33+
### Bug Fixes
34+
35+
- **flags:** no `dependsOn` boolean flags ([#1145](https://github.com/salesforcecli/plugin-org/issues/1145)) ([8c0e74e](https://github.com/salesforcecli/plugin-org/commit/8c0e74e67bf47d6cdaa48330e6f19a2d6a623172))
36+
37+
# [4.4.0](https://github.com/salesforcecli/plugin-org/compare/4.3.7...4.4.0) (2024-07-23)
38+
39+
### Features
40+
41+
- list metadata/-types stdout is table ([#1141](https://github.com/salesforcecli/plugin-org/issues/1141)) ([361fb6c](https://github.com/salesforcecli/plugin-org/commit/361fb6c75af2e450bc56f376c00657f32cc8f4bd))
42+
43+
## [4.3.7](https://github.com/salesforcecli/plugin-org/compare/4.3.6...4.3.7) (2024-07-23)
44+
45+
### Bug Fixes
46+
47+
- nullish-linter ([#1134](https://github.com/salesforcecli/plugin-org/issues/1134)) ([48a7b8c](https://github.com/salesforcecli/plugin-org/commit/48a7b8c4f385967c891f79afb14cb3022418096e))
48+
49+
## [4.3.6](https://github.com/salesforcecli/plugin-org/compare/4.3.5...4.3.6) (2024-07-21)
50+
51+
### Bug Fixes
52+
53+
- **deps:** bump @salesforce/sf-plugins-core from 11.2.0 to 11.2.1 ([2c73d48](https://github.com/salesforcecli/plugin-org/commit/2c73d484af266d6676e335f4c531a0bb5d7be0cc))
54+
155
## [4.3.5](https://github.com/salesforcecli/plugin-org/compare/4.3.4...4.3.5) (2024-07-14)
256

357
### Bug Fixes

README.md

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,29 @@ the [SandboxNuts](https://github.com/salesforcecli/plugin-org/actions/workflows/
9999

100100
<!-- commands -->
101101

102-
- [`sf org create sandbox`](#sf-org-create-sandbox)
103-
- [`sf org create scratch`](#sf-org-create-scratch)
104-
- [`sf org delete sandbox`](#sf-org-delete-sandbox)
105-
- [`sf org delete scratch`](#sf-org-delete-scratch)
106-
- [`sf org disable tracking`](#sf-org-disable-tracking)
107-
- [`sf org display`](#sf-org-display)
108-
- [`sf org enable tracking`](#sf-org-enable-tracking)
109-
- [`sf org list`](#sf-org-list)
110-
- [`sf org list metadata`](#sf-org-list-metadata)
111-
- [`sf org list metadata-types`](#sf-org-list-metadata-types)
112-
- [`sf org open`](#sf-org-open)
113-
- [`sf org refresh sandbox`](#sf-org-refresh-sandbox)
114-
- [`sf org resume sandbox`](#sf-org-resume-sandbox)
115-
- [`sf org resume scratch`](#sf-org-resume-scratch)
102+
- [plugin-org](#plugin-org)
103+
- [About Salesforce CLI plugins](#about-salesforce-cli-plugins)
104+
- [Install](#install)
105+
- [Issues](#issues)
106+
- [Contributing](#contributing)
107+
- [CLA](#cla)
108+
- [Build](#build)
109+
- [Sandbox NUTs](#sandbox-nuts)
110+
- [Commands](#commands)
111+
- [`sf org create sandbox`](#sf-org-create-sandbox)
112+
- [`sf org create scratch`](#sf-org-create-scratch)
113+
- [`sf org delete sandbox`](#sf-org-delete-sandbox)
114+
- [`sf org delete scratch`](#sf-org-delete-scratch)
115+
- [`sf org disable tracking`](#sf-org-disable-tracking)
116+
- [`sf org display`](#sf-org-display)
117+
- [`sf org enable tracking`](#sf-org-enable-tracking)
118+
- [`sf org list`](#sf-org-list)
119+
- [`sf org list metadata`](#sf-org-list-metadata)
120+
- [`sf org list metadata-types`](#sf-org-list-metadata-types)
121+
- [`sf org open`](#sf-org-open)
122+
- [`sf org refresh sandbox`](#sf-org-refresh-sandbox)
123+
- [`sf org resume sandbox`](#sf-org-resume-sandbox)
124+
- [`sf org resume scratch`](#sf-org-resume-scratch)
116125

117126
## `sf org create sandbox`
118127

@@ -607,7 +616,7 @@ List all orgs you’ve created or authenticated to.
607616

608617
```
609618
USAGE
610-
$ sf org list [--json] [--flags-dir <value>] [--verbose] [--all] [-p --clean] [--skip-connection-status]
619+
$ sf org list [--json] [--flags-dir <value>] [--verbose] [--all] [--clean] [-p] [--skip-connection-status]
611620
612621
FLAGS
613622
-p, --no-prompt Don't prompt for confirmation.

package.json

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
11
{
22
"name": "@salesforce/plugin-org",
33
"description": "Commands to interact with Salesforce orgs",
4-
"version": "4.3.6-dev.2",
4+
"version": "4.4.6",
55
"author": "Salesforce",
66
"bugs": "https://github.com/forcedotcom/cli/issues",
77
"dependencies": {
8-
"@oclif/core": "^4.0.17",
8+
"@oclif/core": "^4.0.16",
99
"@oclif/multi-stage-output": "^0.2.0",
10-
"@salesforce/core": "^8.4.0",
11-
"@salesforce/kit": "^3.1.6",
12-
"@salesforce/sf-plugins-core": "^11.3.2",
13-
"@salesforce/source-deploy-retrieve": "^12.0.1",
10+
"@salesforce/core": "^8.2.7",
11+
"@salesforce/kit": "^3.2.0",
12+
"@salesforce/sf-plugins-core": "^11.3.0",
13+
"@salesforce/source-deploy-retrieve": "^12.1.12",
1414
"ansis": "^3.2.0",
1515
"change-case": "^5.4.4",
1616
"is-wsl": "^3.1.0",
1717
"open": "^10.1.0",
1818
"terminal-link": "^3.0.0"
1919
},
2020
"devDependencies": {
21-
"@oclif/plugin-command-snapshot": "^5.2.6",
22-
"@salesforce/cli-plugins-testkit": "^5.3.15",
23-
"@salesforce/dev-scripts": "^10.2.2",
24-
"@salesforce/plugin-command-reference": "^3.1.9",
25-
"@salesforce/ts-sinon": "1.4.22",
26-
"@types/react": "^18.3.3",
27-
"eslint-plugin-sf-plugin": "^1.18.11",
21+
"@oclif/plugin-command-snapshot": "^5.2.7",
22+
"@salesforce/cli-plugins-testkit": "^5.3.25",
23+
"@salesforce/dev-scripts": "^10.2.9",
24+
"@salesforce/plugin-command-reference": "^3.1.15",
25+
"@salesforce/ts-sinon": "^1.4.23",
26+
"eslint-plugin-sf-plugin": "^1.20.1",
2827
"moment": "^2.30.1",
29-
"oclif": "^4.13.9",
28+
"oclif": "^4.14.17",
3029
"ts-node": "^10.9.2",
31-
"typescript": "^5.4.5"
30+
"typescript": "^5.5.4"
3231
},
3332
"engines": {
3433
"node": ">=18.0.0"

src/commands/force/org/create.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ export class Create extends SfCommand<CreateResult> {
295295

296296
await Lifecycle.getInstance().emit('scratchOrgInfo', scratchOrgInfo);
297297

298-
this.logger.debug(`orgConfig.loginUrl: ${authFields?.loginUrl}`);
299-
this.logger.debug(`orgConfig.instanceUrl: ${authFields?.instanceUrl}`);
298+
this.logger.debug(`orgConfig.loginUrl: ${authFields?.loginUrl ?? '<not found>'}`);
299+
this.logger.debug(`orgConfig.instanceUrl: ${authFields?.instanceUrl ?? '<not found>'}`);
300300

301301
this.log(messages.getMessage('scratchOrgCreateSuccess', [authFields?.orgId, username]));
302302

src/commands/org/create/sandbox.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import { Duration } from '@salesforce/kit';
99
import { Flags } from '@salesforce/sf-plugins-core';
1010
import { Lifecycle, Messages, SandboxEvents, SandboxRequest, SfError } from '@salesforce/core';
11-
import { Ux } from '@salesforce/sf-plugins-core';
1211
import { Interfaces } from '@oclif/core';
1312
import requestFunctions from '../../../shared/sandboxRequest.js';
1413
import { SandboxCommandBase, SandboxCommandResponse } from '../../../shared/sandboxCommandBase.js';
@@ -215,14 +214,12 @@ export default class CreateSandbox extends SandboxCommandBase<SandboxCommandResp
215214
private async confirmSandboxReq(sandboxReq: SandboxConfirmData): Promise<void> {
216215
if (this.flags['no-prompt'] || this.jsonEnabled()) return;
217216

218-
const columns: Ux.Table.Columns<{ key: string; value: unknown }> = {
219-
key: { header: 'Field' },
220-
value: { header: 'Value' },
221-
};
222-
223217
const data = Object.entries(sandboxReq).map(([key, value]) => ({ key, value }));
224218
this.styledHeader('Config Sandbox Request');
225-
this.table(data, columns, {});
219+
this.table(data, {
220+
key: { header: 'Field' },
221+
value: { header: 'Value' },
222+
});
226223

227224
if (
228225
!(await this.confirm({

src/commands/org/list.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ export class OrgListCommand extends SfCommand<OrgListResult> {
4848
'no-prompt': Flags.boolean({
4949
char: 'p',
5050
summary: messages.getMessage('flags.no-prompt.summary'),
51-
dependsOn: ['clean'],
51+
relationships: [
52+
{
53+
type: 'some',
54+
flags: [{ name: 'clean', when: async (flags): Promise<boolean> => Promise.resolve(flags['clean'] === true) }],
55+
},
56+
],
5257
aliases: ['noprompt'],
5358
deprecateAliases: true,
5459
}),

src/commands/org/list/metadata-types.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import fs from 'node:fs';
88

99
import { Messages } from '@salesforce/core';
10-
import type { DescribeMetadataResult } from '@jsforce/jsforce-node/lib/api/metadata.js';
10+
import type { DescribeMetadataObject, DescribeMetadataResult } from '@jsforce/jsforce-node/lib/api/metadata.js';
1111
import { RegistryAccess } from '@salesforce/source-deploy-retrieve';
1212
import { Flags, loglevel, requiredOrgFlagWithDeprecations, SfCommand } from '@salesforce/sf-plugins-core';
1313

@@ -68,7 +68,29 @@ export class ListMetadataTypes extends SfCommand<DescribeMetadataResult> {
6868
await fs.promises.writeFile(flags['output-file'], JSON.stringify(describeResult, null, 2));
6969
this.logSuccess(`Wrote result file to ${flags['output-file']}.`);
7070
} else {
71-
this.styledJSON(describeResult);
71+
this.table(
72+
describeResult.metadataObjects,
73+
{
74+
xmlName: { header: 'Xml Names' },
75+
childXmlNames: {
76+
header: 'Child Xml Names',
77+
get: (row: DescribeMetadataObject) =>
78+
row.childXmlNames.length ? `[ ${row.childXmlNames.join('\n')} ]` : '',
79+
},
80+
directoryName: { header: 'Directory Name' },
81+
inFolder: { header: 'In Folder' },
82+
metaFile: { header: 'Meta File' },
83+
suffix: { header: 'Suffix' },
84+
},
85+
{
86+
'no-truncate': true,
87+
title: 'Metadata',
88+
sort: 'Xml Names',
89+
}
90+
);
91+
this.log(`Organizational Namespace: ${describeResult.organizationNamespace}`);
92+
this.log(`Partial Save Allowed: ${describeResult.partialSaveAllowed}`);
93+
this.log(`Test Required: ${describeResult.testRequired}`);
7294
}
7395
return describeResult;
7496
}

src/commands/org/list/metadata.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,29 @@ export class ListMetadata extends SfCommand<ListMetadataCommandResult> {
6262
fs.writeFileSync(flags['output-file'], JSON.stringify(listResult, null, 2));
6363
this.logSuccess(`Wrote result file to ${flags['output-file']}.`);
6464
} else if (listResult?.length) {
65-
this.styledJSON(listResult);
65+
this.table(
66+
listResult,
67+
{
68+
createdByName: { header: 'Created By' },
69+
createdDate: {
70+
header: 'Created Date',
71+
get: (row: FileProperties) => row.createdDate.split('T')[0],
72+
},
73+
fullName: { header: 'Full Name' },
74+
id: { header: 'Id' },
75+
lastModifiedByName: { header: 'Last Modified By' },
76+
lastModifiedDate: {
77+
header: 'Last Modified',
78+
get: (row: FileProperties) => row.createdDate.split('T')[0],
79+
},
80+
manageableState: { header: 'Manageable State' },
81+
namespacePrefix: { header: 'Namespace Prefix' },
82+
},
83+
{
84+
title: flags['metadata-type'],
85+
sort: 'Manageable State',
86+
}
87+
);
6688
} else {
6789
this.warn(messages.getMessage('noMatchingMetadata', [flags['metadata-type'], conn.getUsername()]));
6890
}

src/commands/org/open.ts

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,7 @@ export class OrgOpenCommand extends SfCommand<OrgOpenOutput> {
115115
await new SfdcUrl(url).checkLightningDomain();
116116
this.spinner.stop();
117117
} catch (err) {
118-
if (err instanceof Error) {
119-
if (err.message.includes('timeout')) {
120-
const domain = `https://${/https?:\/\/([^.]*)/.exec(url)?.[1]}.lightning.force.com`;
121-
const domainRetryTimeout = env.getNumber('SF_DOMAIN_RETRY') ?? env.getNumber('SFDX_DOMAIN_RETRY', 240);
122-
const timeout = new Duration(domainRetryTimeout, Duration.Unit.SECONDS);
123-
const logger = await Logger.child(this.constructor.name);
124-
logger.debug(`Did not find IP for ${domain} after ${timeout.seconds} seconds`);
125-
throw new SfError(messages.getMessage('domainTimeoutError'), 'domainTimeoutError');
126-
}
127-
throw SfError.wrap(err);
128-
}
129-
throw err;
118+
handleDomainError(err, url, env);
130119
}
131120

132121
// create a local html file that contains the POST stuff.
@@ -173,8 +162,10 @@ const fileCleanup = (tempFilePath: string): void =>
173162
const buildFrontdoorUrl = async (org: Org, conn: Connection): Promise<string> => {
174163
await org.refreshAuth(); // we need a live accessToken for the frontdoor url
175164
const accessToken = conn.accessToken;
176-
const instanceUrl = org.getField<string>(Org.Fields.INSTANCE_URL);
177-
const instanceUrlClean = instanceUrl.replace(/\/$/, '');
165+
if (!accessToken) {
166+
throw new SfError('NoAccessToken', 'NoAccessToken');
167+
}
168+
const instanceUrlClean = org.getField<string>(Org.Fields.INSTANCE_URL).replace(/\/$/, '');
178169
return `${instanceUrlClean}/secur/frontdoor.jsp?sid=${accessToken}`;
179170
};
180171

@@ -241,3 +232,22 @@ const getFileContents = (
241232
</form>
242233
</body>
243234
</html>`;
235+
236+
const handleDomainError = (err: unknown, url: string, env: Env): string => {
237+
if (err instanceof Error) {
238+
if (err.message.includes('timeout')) {
239+
const host = /https?:\/\/([^.]*)/.exec(url)?.[1];
240+
if (!host) {
241+
throw new SfError('InvalidUrl', 'InvalidUrl');
242+
}
243+
const domain = `https://${host}.lightning.force.com`;
244+
const domainRetryTimeout = env.getNumber('SF_DOMAIN_RETRY') ?? env.getNumber('SFDX_DOMAIN_RETRY', 240);
245+
const timeout = new Duration(domainRetryTimeout, Duration.Unit.SECONDS);
246+
const logger = Logger.childFromRoot('org:open');
247+
logger.debug(`Did not find IP for ${domain} after ${timeout.seconds} seconds`);
248+
throw new SfError(messages.getMessage('domainTimeoutError'), 'domainTimeoutError');
249+
}
250+
throw SfError.wrap(err);
251+
}
252+
throw err;
253+
};

src/commands/org/refresh/sandbox.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
import { Duration, omit } from '@salesforce/kit';
99
import { Flags } from '@salesforce/sf-plugins-core';
10-
import { Lifecycle, Messages, SandboxInfo, SandboxEvents, SfError } from '@salesforce/core';
11-
import { Ux } from '@salesforce/sf-plugins-core';
10+
import { Lifecycle, Messages, SandboxEvents, SandboxInfo, SfError } from '@salesforce/core';
1211
import { Interfaces } from '@oclif/core';
1312
import requestFunctions from '../../../shared/sandboxRequest.js';
1413
import { SandboxCommandBase, SandboxCommandResponse } from '../../../shared/sandboxCommandBase.js';
@@ -249,14 +248,12 @@ export default class RefreshSandbox extends SandboxCommandBase<SandboxCommandRes
249248
private async confirmSandboxRefresh(sandboxInfo: SandboxInfo): Promise<void> {
250249
if (this.flags['no-prompt'] || this.jsonEnabled()) return;
251250

252-
const columns: Ux.Table.Columns<{ key: string; value: unknown }> = {
253-
key: { header: 'Field' },
254-
value: { header: 'Value' },
255-
};
256-
257251
const data = Object.entries(sandboxInfo).map(([key, value]) => ({ key, value: value ?? 'null' }));
258252
this.styledHeader('Config Sandbox Refresh');
259-
this.table(data, columns, {});
253+
this.table(data, {
254+
key: { header: 'Field' },
255+
value: { header: 'Value' },
256+
});
260257

261258
if (
262259
!(await this.confirm({

0 commit comments

Comments
 (0)