@salesforce/plugin-org 5.1.5-beta.0 → 5.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -65
- package/lib/commands/org/delete/scratch.js +9 -3
- package/lib/commands/org/delete/scratch.js.map +1 -1
- package/lib/commands/org/open.d.ts +10 -5
- package/lib/commands/org/open.js +110 -10
- package/lib/commands/org/open.js.map +1 -1
- package/lib/shared/orgTypes.d.ts +0 -5
- package/lib/shared/orgTypes.js.map +1 -1
- package/lib/shared/utils.d.ts +4 -0
- package/lib/shared/utils.js +3 -6
- package/lib/shared/utils.js.map +1 -1
- package/messages/delete_scratch.md +4 -0
- package/oclif.manifest.json +2 -117
- package/package.json +6 -5
- package/lib/commands/org/open/agent.d.ts +0 -16
- package/lib/commands/org/open/agent.js +0 -59
- package/lib/commands/org/open/agent.js.map +0 -1
- package/lib/shared/orgOpenCommandBase.d.ts +0 -15
- package/lib/shared/orgOpenCommandBase.js +0 -82
- package/lib/shared/orgOpenCommandBase.js.map +0 -1
- package/lib/shared/orgOpenUtils.d.ts +0 -18
- package/lib/shared/orgOpenUtils.js +0 -61
- package/lib/shared/orgOpenUtils.js.map +0 -1
- package/messages/open.agent.md +0 -41
package/README.md
CHANGED
|
@@ -110,7 +110,6 @@ the [SandboxNuts](https://github.com/salesforcecli/plugin-org/actions/workflows/
|
|
|
110
110
|
- [`sf org list metadata`](#sf-org-list-metadata)
|
|
111
111
|
- [`sf org list metadata-types`](#sf-org-list-metadata-types)
|
|
112
112
|
- [`sf org open`](#sf-org-open)
|
|
113
|
-
- [`sf org open agent`](#sf-org-open-agent)
|
|
114
113
|
- [`sf org refresh sandbox`](#sf-org-refresh-sandbox)
|
|
115
114
|
- [`sf org resume sandbox`](#sf-org-resume-sandbox)
|
|
116
115
|
- [`sf org resume scratch`](#sf-org-resume-scratch)
|
|
@@ -242,7 +241,7 @@ FLAG DESCRIPTIONS
|
|
|
242
241
|
You can specify either --source-sandbox-name or --source-id when cloning an existing sandbox, but not both.
|
|
243
242
|
```
|
|
244
243
|
|
|
245
|
-
_See code: [src/commands/org/create/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5
|
|
244
|
+
_See code: [src/commands/org/create/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5/src/commands/org/create/sandbox.ts)_
|
|
246
245
|
|
|
247
246
|
## `sf org create scratch`
|
|
248
247
|
|
|
@@ -396,7 +395,7 @@ FLAG DESCRIPTIONS
|
|
|
396
395
|
Omit this flag to have Salesforce generate a unique username for your org.
|
|
397
396
|
```
|
|
398
397
|
|
|
399
|
-
_See code: [src/commands/org/create/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5
|
|
398
|
+
_See code: [src/commands/org/create/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5/src/commands/org/create/scratch.ts)_
|
|
400
399
|
|
|
401
400
|
## `sf org delete sandbox`
|
|
402
401
|
|
|
@@ -442,7 +441,7 @@ EXAMPLES
|
|
|
442
441
|
$ sf org delete sandbox --target-org my-sandbox --no-prompt
|
|
443
442
|
```
|
|
444
443
|
|
|
445
|
-
_See code: [src/commands/org/delete/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5
|
|
444
|
+
_See code: [src/commands/org/delete/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5/src/commands/org/delete/sandbox.ts)_
|
|
446
445
|
|
|
447
446
|
## `sf org delete scratch`
|
|
448
447
|
|
|
@@ -486,7 +485,7 @@ EXAMPLES
|
|
|
486
485
|
$ sf org delete scratch --target-org my-scratch-org --no-prompt
|
|
487
486
|
```
|
|
488
487
|
|
|
489
|
-
_See code: [src/commands/org/delete/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5
|
|
488
|
+
_See code: [src/commands/org/delete/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5/src/commands/org/delete/scratch.ts)_
|
|
490
489
|
|
|
491
490
|
## `sf org disable tracking`
|
|
492
491
|
|
|
@@ -525,7 +524,7 @@ EXAMPLES
|
|
|
525
524
|
$ sf org disable tracking
|
|
526
525
|
```
|
|
527
526
|
|
|
528
|
-
_See code: [src/commands/org/disable/tracking.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5
|
|
527
|
+
_See code: [src/commands/org/disable/tracking.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5/src/commands/org/disable/tracking.ts)_
|
|
529
528
|
|
|
530
529
|
## `sf org display`
|
|
531
530
|
|
|
@@ -570,7 +569,7 @@ EXAMPLES
|
|
|
570
569
|
$ sf org display --target-org TestOrg1 --verbose
|
|
571
570
|
```
|
|
572
571
|
|
|
573
|
-
_See code: [src/commands/org/display.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5
|
|
572
|
+
_See code: [src/commands/org/display.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5/src/commands/org/display.ts)_
|
|
574
573
|
|
|
575
574
|
## `sf org enable tracking`
|
|
576
575
|
|
|
@@ -612,7 +611,7 @@ EXAMPLES
|
|
|
612
611
|
$ sf org enable tracking
|
|
613
612
|
```
|
|
614
613
|
|
|
615
|
-
_See code: [src/commands/org/enable/tracking.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5
|
|
614
|
+
_See code: [src/commands/org/enable/tracking.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5/src/commands/org/enable/tracking.ts)_
|
|
616
615
|
|
|
617
616
|
## `sf org list`
|
|
618
617
|
|
|
@@ -651,7 +650,7 @@ EXAMPLES
|
|
|
651
650
|
$ sf org list --clean
|
|
652
651
|
```
|
|
653
652
|
|
|
654
|
-
_See code: [src/commands/org/list.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5
|
|
653
|
+
_See code: [src/commands/org/list.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5/src/commands/org/list.ts)_
|
|
655
654
|
|
|
656
655
|
## `sf org list metadata`
|
|
657
656
|
|
|
@@ -718,7 +717,7 @@ FLAG DESCRIPTIONS
|
|
|
718
717
|
Examples of metadata types that use folders are Dashboard, Document, EmailTemplate, and Report.
|
|
719
718
|
```
|
|
720
719
|
|
|
721
|
-
_See code: [src/commands/org/list/metadata.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5
|
|
720
|
+
_See code: [src/commands/org/list/metadata.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5/src/commands/org/list/metadata.ts)_
|
|
722
721
|
|
|
723
722
|
## `sf org list metadata-types`
|
|
724
723
|
|
|
@@ -773,7 +772,7 @@ FLAG DESCRIPTIONS
|
|
|
773
772
|
Override the api version used for api requests made by this command
|
|
774
773
|
```
|
|
775
774
|
|
|
776
|
-
_See code: [src/commands/org/list/metadata-types.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5
|
|
775
|
+
_See code: [src/commands/org/list/metadata-types.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5/src/commands/org/list/metadata-types.ts)_
|
|
777
776
|
|
|
778
777
|
## `sf org open`
|
|
779
778
|
|
|
@@ -849,57 +848,7 @@ EXAMPLES
|
|
|
849
848
|
$ sf org open --source-file force-app/main/default/bots/Coral_Cloud_Agent/Coral_Cloud_Agent.bot-meta.xml
|
|
850
849
|
```
|
|
851
850
|
|
|
852
|
-
_See code: [src/commands/org/open.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5
|
|
853
|
-
|
|
854
|
-
## `sf org open agent`
|
|
855
|
-
|
|
856
|
-
Open an agent in the Agent Builder org UI in a browser.
|
|
857
|
-
|
|
858
|
-
```
|
|
859
|
-
USAGE
|
|
860
|
-
$ sf org open agent -o <value> -n <value> [--json] [--flags-dir <value>] [--api-version <value>] [--private | -r |
|
|
861
|
-
-b chrome|edge|firefox]
|
|
862
|
-
|
|
863
|
-
FLAGS
|
|
864
|
-
-b, --browser=<option> Browser where the org opens.
|
|
865
|
-
<options: chrome|edge|firefox>
|
|
866
|
-
-n, --name=<value> (required) The developer name (aka API name) of the agent to open in the Agent Builder org
|
|
867
|
-
UI.
|
|
868
|
-
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
869
|
-
configuration variable is already set.
|
|
870
|
-
-r, --url-only Display navigation URL, but don’t launch browser.
|
|
871
|
-
--api-version=<value> Override the api version used for api requests made by this command
|
|
872
|
-
--private Open the org in the default browser using private (incognito) mode.
|
|
873
|
-
|
|
874
|
-
GLOBAL FLAGS
|
|
875
|
-
--flags-dir=<value> Import flag values from a directory.
|
|
876
|
-
--json Format output as json.
|
|
877
|
-
|
|
878
|
-
DESCRIPTION
|
|
879
|
-
Open an agent in the Agent Builder org UI in a browser.
|
|
880
|
-
|
|
881
|
-
Use the --name flag to open an agent using the developer name (aka API name) in the Agent Builder Org UI.
|
|
882
|
-
|
|
883
|
-
To generate a URL but not launch it in your browser, specify --url-only.
|
|
884
|
-
|
|
885
|
-
To open in a specific browser, use the --browser flag. Supported browsers are "chrome", "edge", and "firefox". If you
|
|
886
|
-
don't specify --browser, the org opens in your default browser.
|
|
887
|
-
|
|
888
|
-
EXAMPLES
|
|
889
|
-
Open the agent with developer name "Coral_Cloud_Agent using the default browser:
|
|
890
|
-
|
|
891
|
-
$ sf org open agent --name Coral_Cloud_Agent
|
|
892
|
-
|
|
893
|
-
Open the agent in an incognito window of your default browser:
|
|
894
|
-
|
|
895
|
-
$ sf org open agent --private --name Coral_Cloud_Agent
|
|
896
|
-
|
|
897
|
-
Open the agent in the org with alias MyTestOrg1 using the Firefox browser:
|
|
898
|
-
|
|
899
|
-
$ sf org open agent --target-org MyTestOrg1 --browser firefox --name Coral_Cloud_Agent
|
|
900
|
-
```
|
|
901
|
-
|
|
902
|
-
_See code: [src/commands/org/open/agent.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5-beta.0/src/commands/org/open/agent.ts)_
|
|
851
|
+
_See code: [src/commands/org/open.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5/src/commands/org/open.ts)_
|
|
903
852
|
|
|
904
853
|
## `sf org refresh sandbox`
|
|
905
854
|
|
|
@@ -976,7 +925,7 @@ FLAG DESCRIPTIONS
|
|
|
976
925
|
By default, a sandbox auto-activates after a refresh. Use this flag to control sandbox activation manually.
|
|
977
926
|
```
|
|
978
927
|
|
|
979
|
-
_See code: [src/commands/org/refresh/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5
|
|
928
|
+
_See code: [src/commands/org/refresh/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5/src/commands/org/refresh/sandbox.ts)_
|
|
980
929
|
|
|
981
930
|
## `sf org resume sandbox`
|
|
982
931
|
|
|
@@ -1039,7 +988,7 @@ FLAG DESCRIPTIONS
|
|
|
1039
988
|
returns the job ID. To resume checking the sandbox creation, rerun this command.
|
|
1040
989
|
```
|
|
1041
990
|
|
|
1042
|
-
_See code: [src/commands/org/resume/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5
|
|
991
|
+
_See code: [src/commands/org/resume/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5/src/commands/org/resume/sandbox.ts)_
|
|
1043
992
|
|
|
1044
993
|
## `sf org resume scratch`
|
|
1045
994
|
|
|
@@ -1086,6 +1035,6 @@ FLAG DESCRIPTIONS
|
|
|
1086
1035
|
The job ID is valid for 24 hours after you start the scratch org creation.
|
|
1087
1036
|
```
|
|
1088
1037
|
|
|
1089
|
-
_See code: [src/commands/org/resume/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5
|
|
1038
|
+
_See code: [src/commands/org/resume/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/5.1.5/src/commands/org/resume/scratch.ts)_
|
|
1090
1039
|
|
|
1091
1040
|
<!-- commandsstop -->
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { AuthInfo, AuthRemover, Messages, Org } from '@salesforce/core';
|
|
8
8
|
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
|
|
9
|
+
import { ensureString } from '@salesforce/ts-types';
|
|
9
10
|
import { orgThatMightBeDeleted } from '../../../shared/flags.js';
|
|
10
11
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
11
12
|
const messages = Messages.loadMessages('@salesforce/plugin-org', 'delete_scratch');
|
|
@@ -28,13 +29,15 @@ export default class DeleteScratch extends SfCommand {
|
|
|
28
29
|
async run() {
|
|
29
30
|
const flags = (await this.parse(DeleteScratch)).flags;
|
|
30
31
|
const resolvedUsername = flags['target-org'];
|
|
31
|
-
const orgId = (await AuthInfo.create({ username: resolvedUsername })).getFields()
|
|
32
|
+
const { orgId, isScratch } = (await AuthInfo.create({ username: resolvedUsername })).getFields();
|
|
33
|
+
if (!isScratch) {
|
|
34
|
+
throw messages.createError('error.unknownScratch', [resolvedUsername]);
|
|
35
|
+
}
|
|
32
36
|
if (flags['no-prompt'] ||
|
|
33
37
|
(await this.confirm({ message: messages.getMessage('prompt.confirm', [resolvedUsername]) }))) {
|
|
34
38
|
try {
|
|
35
39
|
const org = await Org.create({ aliasOrUsername: resolvedUsername });
|
|
36
40
|
await org.delete();
|
|
37
|
-
this.logSuccess(messages.getMessage('success', [org.getUsername()]));
|
|
38
41
|
return { username: org.getUsername(), orgId: org.getOrgId() };
|
|
39
42
|
}
|
|
40
43
|
catch (e) {
|
|
@@ -53,7 +56,10 @@ export default class DeleteScratch extends SfCommand {
|
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
|
-
return {
|
|
59
|
+
return {
|
|
60
|
+
username: resolvedUsername,
|
|
61
|
+
orgId: ensureString(orgId),
|
|
62
|
+
};
|
|
57
63
|
}
|
|
58
64
|
}
|
|
59
65
|
//# sourceMappingURL=scratch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scratch.js","sourceRoot":"","sources":["../../../../src/commands/org/delete/scratch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG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;oBAC/C,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;gBACtE,CAAC;qBAAM,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;oBACjE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;gBACjF,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,CAAC;gBACV,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,gBAAgB;YAC1B,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;SAC3B,CAAC;IACJ,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare class OrgOpenCommand extends
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { Org } from '@salesforce/core';
|
|
3
|
+
export declare class OrgOpenCommand extends SfCommand<OrgOpenOutput> {
|
|
4
4
|
static readonly summary: string;
|
|
5
5
|
static readonly description: string;
|
|
6
6
|
static readonly examples: string[];
|
|
7
7
|
static readonly aliases: string[];
|
|
8
8
|
static deprecateAliases: boolean;
|
|
9
9
|
static readonly flags: {
|
|
10
|
-
'target-org': import("@oclif/core/interfaces").OptionFlag<
|
|
10
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
private: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
browser: import("@oclif/core/interfaces").OptionFlag<"chrome" | "
|
|
13
|
+
browser: import("@oclif/core/interfaces").OptionFlag<"chrome" | "edge" | "firefox" | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
14
|
path: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
15
|
'url-only': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
16
|
loglevel: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -18,3 +18,8 @@ export declare class OrgOpenCommand extends OrgOpenCommandBase<OrgOpenOutput> {
|
|
|
18
18
|
};
|
|
19
19
|
run(): Promise<OrgOpenOutput>;
|
|
20
20
|
}
|
|
21
|
+
export type OrgOpenOutput = {
|
|
22
|
+
url: string;
|
|
23
|
+
username: string;
|
|
24
|
+
orgId: string;
|
|
25
|
+
};
|
package/lib/commands/org/open.js
CHANGED
|
@@ -5,14 +5,19 @@
|
|
|
5
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
6
|
*/
|
|
7
7
|
import path from 'node:path';
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
8
|
+
import { platform, tmpdir } from 'node:os';
|
|
9
|
+
import fs from 'node:fs';
|
|
10
|
+
import { execSync } from 'node:child_process';
|
|
11
|
+
import { Flags, loglevel, orgApiVersionFlagWithDeprecations, requiredOrgFlagWithDeprecations, SfCommand, } from '@salesforce/sf-plugins-core';
|
|
12
|
+
import isWsl from 'is-wsl';
|
|
13
|
+
import { Logger, Messages, Org, SfdcUrl, SfError } from '@salesforce/core';
|
|
14
|
+
import { Duration, Env, sleep } from '@salesforce/kit';
|
|
10
15
|
import { MetadataResolver } from '@salesforce/source-deploy-retrieve';
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
16
|
+
import { apps } from 'open';
|
|
17
|
+
import utils from '../../shared/utils.js';
|
|
13
18
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
14
19
|
const messages = Messages.loadMessages('@salesforce/plugin-org', 'open');
|
|
15
|
-
export class OrgOpenCommand extends
|
|
20
|
+
export class OrgOpenCommand extends SfCommand {
|
|
16
21
|
static summary = messages.getMessage('summary');
|
|
17
22
|
static description = messages.getMessage('description');
|
|
18
23
|
static examples = messages.getMessages('examples');
|
|
@@ -55,15 +60,80 @@ export class OrgOpenCommand extends OrgOpenCommandBase {
|
|
|
55
60
|
};
|
|
56
61
|
async run() {
|
|
57
62
|
const { flags } = await this.parse(OrgOpenCommand);
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
64
|
+
const env = new Env();
|
|
60
65
|
const [frontDoorUrl, retUrl] = await Promise.all([
|
|
61
|
-
buildFrontdoorUrl(
|
|
62
|
-
flags['source-file'] ? generateFileUrl(flags['source-file'],
|
|
66
|
+
buildFrontdoorUrl(flags['target-org'], conn),
|
|
67
|
+
flags['source-file'] ? generateFileUrl(flags['source-file'], conn) : flags.path,
|
|
63
68
|
]);
|
|
64
|
-
|
|
69
|
+
const url = `${frontDoorUrl}${retUrl ? `&retURL=${retUrl}` : ''}`;
|
|
70
|
+
const orgId = flags['target-org'].getOrgId();
|
|
71
|
+
// TODO: better typings in sfdx-core for orgs read from auth files
|
|
72
|
+
const username = flags['target-org'].getUsername();
|
|
73
|
+
const output = { orgId, url, username };
|
|
74
|
+
// NOTE: Deliberate use of `||` here since getBoolean() defaults to false, and we need to consider both env vars.
|
|
75
|
+
const containerMode = env.getBoolean('SF_CONTAINER_MODE') || env.getBoolean('SFDX_CONTAINER_MODE');
|
|
76
|
+
// security warning only for --json OR --url-only OR containerMode
|
|
77
|
+
if (flags['url-only'] || Boolean(flags.json) || containerMode) {
|
|
78
|
+
const sharedMessages = Messages.loadMessages('@salesforce/plugin-org', 'messages');
|
|
79
|
+
this.warn(sharedMessages.getMessage('SecurityWarning'));
|
|
80
|
+
this.log('');
|
|
81
|
+
}
|
|
82
|
+
if (containerMode) {
|
|
83
|
+
// instruct the user that they need to paste the URL into the browser
|
|
84
|
+
this.styledHeader('Action Required!');
|
|
85
|
+
this.log(messages.getMessage('containerAction', [orgId, url]));
|
|
86
|
+
return output;
|
|
87
|
+
}
|
|
88
|
+
if (flags['url-only']) {
|
|
89
|
+
// this includes the URL
|
|
90
|
+
this.logSuccess(messages.getMessage('humanSuccess', [orgId, username, url]));
|
|
91
|
+
return output;
|
|
92
|
+
}
|
|
93
|
+
this.logSuccess(messages.getMessage('humanSuccessNoUrl', [orgId, username]));
|
|
94
|
+
// we actually need to open the org
|
|
95
|
+
try {
|
|
96
|
+
this.spinner.start(messages.getMessage('domainWaiting'));
|
|
97
|
+
await new SfdcUrl(url).checkLightningDomain();
|
|
98
|
+
this.spinner.stop();
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
handleDomainError(err, url, env);
|
|
102
|
+
}
|
|
103
|
+
// create a local html file that contains the POST stuff.
|
|
104
|
+
const tempFilePath = path.join(tmpdir(), `org-open-${new Date().valueOf()}.html`);
|
|
105
|
+
await fs.promises.writeFile(tempFilePath, getFileContents(conn.accessToken, conn.instanceUrl,
|
|
106
|
+
// the path flag is URI-encoded in its `parse` func.
|
|
107
|
+
// For the form redirect to work we need it decoded.
|
|
108
|
+
flags.path ? decodeURIComponent(flags.path) : retUrl));
|
|
109
|
+
const filePathUrl = isWsl
|
|
110
|
+
? 'file:///' + execSync(`wslpath -m ${tempFilePath}`).toString().trim()
|
|
111
|
+
: `file:///${tempFilePath}`;
|
|
112
|
+
const cp = await utils.openUrl(filePathUrl, {
|
|
113
|
+
...(flags.browser ? { app: { name: apps[flags.browser] } } : {}),
|
|
114
|
+
...(flags.private ? { newInstance: platform() === 'darwin', app: { name: apps.browserPrivate } } : {}),
|
|
115
|
+
});
|
|
116
|
+
cp.on('error', (err) => {
|
|
117
|
+
fileCleanup(tempFilePath);
|
|
118
|
+
throw SfError.wrap(err);
|
|
119
|
+
});
|
|
120
|
+
// so we don't delete the file while the browser is still using it
|
|
121
|
+
// open returns when the CP is spawned, but there's not way to know if the browser is still using the file
|
|
122
|
+
await sleep(platform() === 'win32' || isWsl ? 7000 : 5000);
|
|
123
|
+
fileCleanup(tempFilePath);
|
|
124
|
+
return output;
|
|
65
125
|
}
|
|
66
126
|
}
|
|
127
|
+
const fileCleanup = (tempFilePath) => fs.rmSync(tempFilePath, { force: true, maxRetries: 3, recursive: true });
|
|
128
|
+
const buildFrontdoorUrl = async (org, conn) => {
|
|
129
|
+
await org.refreshAuth(); // we need a live accessToken for the frontdoor url
|
|
130
|
+
const accessToken = conn.accessToken;
|
|
131
|
+
if (!accessToken) {
|
|
132
|
+
throw new SfError('NoAccessToken', 'NoAccessToken');
|
|
133
|
+
}
|
|
134
|
+
const instanceUrlClean = org.getField(Org.Fields.INSTANCE_URL).replace(/\/$/, '');
|
|
135
|
+
return `${instanceUrlClean}/secur/frontdoor.jsp?sid=${accessToken}`;
|
|
136
|
+
};
|
|
67
137
|
const generateFileUrl = async (file, conn) => {
|
|
68
138
|
try {
|
|
69
139
|
const metadataResolver = new MetadataResolver();
|
|
@@ -102,4 +172,34 @@ const flowFileNameToId = async (conn, filePath) => {
|
|
|
102
172
|
throw messages.createError('FlowIdNotFound', [filePath]);
|
|
103
173
|
}
|
|
104
174
|
};
|
|
175
|
+
/** builds the html file that does an automatic post to the frontdoor url */
|
|
176
|
+
const getFileContents = (authToken, instanceUrl,
|
|
177
|
+
// we have to defalt this to get to Setup only on the POST version. GET goes to Setup automatically
|
|
178
|
+
retUrl = '/lightning/setup/SetupOneHome/home') => `
|
|
179
|
+
<html>
|
|
180
|
+
<body onload="document.body.firstElementChild.submit()">
|
|
181
|
+
<form method="POST" action="${instanceUrl}/secur/frontdoor.jsp">
|
|
182
|
+
<input type="hidden" name="sid" value="${authToken}" />
|
|
183
|
+
<input type="hidden" name="retURL" value="${retUrl}" />
|
|
184
|
+
</form>
|
|
185
|
+
</body>
|
|
186
|
+
</html>`;
|
|
187
|
+
const handleDomainError = (err, url, env) => {
|
|
188
|
+
if (err instanceof Error) {
|
|
189
|
+
if (err.message.includes('timeout')) {
|
|
190
|
+
const host = /https?:\/\/([^.]*)/.exec(url)?.[1];
|
|
191
|
+
if (!host) {
|
|
192
|
+
throw new SfError('InvalidUrl', 'InvalidUrl');
|
|
193
|
+
}
|
|
194
|
+
const domain = `https://${host}.lightning.force.com`;
|
|
195
|
+
const domainRetryTimeout = env.getNumber('SF_DOMAIN_RETRY') ?? env.getNumber('SFDX_DOMAIN_RETRY', 240);
|
|
196
|
+
const timeout = new Duration(domainRetryTimeout, Duration.Unit.SECONDS);
|
|
197
|
+
const logger = Logger.childFromRoot('org:open');
|
|
198
|
+
logger.debug(`Did not find IP for ${domain} after ${timeout.seconds} seconds`);
|
|
199
|
+
throw new SfError(messages.getMessage('domainTimeoutError'), 'domainTimeoutError');
|
|
200
|
+
}
|
|
201
|
+
throw SfError.wrap(err);
|
|
202
|
+
}
|
|
203
|
+
throw err;
|
|
204
|
+
};
|
|
105
205
|
//# sourceMappingURL=open.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/commands/org/open.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,KAAK,EACL,QAAQ,EACR,iCAAiC,EACjC,+BAA+B,
|
|
1
|
+
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/commands/org/open.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EACL,KAAK,EACL,QAAQ,EACR,iCAAiC,EACjC,+BAA+B,EAC/B,SAAS,GACV,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,MAAM,QAAQ,CAAC;AAC3B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connectedStatus?: string;
|
|
12
12
|
sfdxAuthUrl?: string;
|
|
13
13
|
};
|
|
14
|
-
export type OrgOpenOutput = {
|
|
15
|
-
url: string;
|
|
16
|
-
username: string;
|
|
17
|
-
orgId: string;
|
|
18
|
-
};
|
|
19
14
|
/** Convenience type for the fields that are in the auth file
|
|
20
15
|
*
|
|
21
16
|
* core's AuthFields has everything as optional.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orgTypes.js","sourceRoot":"","sources":["../../src/shared/orgTypes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"orgTypes.js","sourceRoot":"","sources":["../../src/shared/orgTypes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA8FH,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,6CAAuB,CAAA;IACvB,oDAA8B,CAAA;IAC9B,yCAAmB,CAAA;IACnB,mCAAa,CAAA;AACf,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B"}
|
package/lib/shared/utils.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { ChildProcess } from 'node:child_process';
|
|
2
|
+
import { Options } from 'open';
|
|
1
3
|
export declare const getAliasByUsername: (username: string) => Promise<string | undefined>;
|
|
4
|
+
export declare const openUrl: (url: string, options: Options) => Promise<ChildProcess>;
|
|
2
5
|
export declare const lowerToUpper: (object: Record<string, unknown>) => Record<string, unknown>;
|
|
3
6
|
declare const _default: {
|
|
4
7
|
getAliasByUsername: (username: string) => Promise<string | undefined>;
|
|
8
|
+
openUrl: (url: string, options: Options) => Promise<ChildProcess>;
|
|
5
9
|
lowerToUpper: (object: Record<string, unknown>) => Record<string, unknown>;
|
|
6
10
|
};
|
|
7
11
|
export default _default;
|
package/lib/shared/utils.js
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* Licensed under the BSD 3-Clause license.
|
|
5
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
-
*/
|
|
7
1
|
import { upperFirst } from '@salesforce/kit';
|
|
8
2
|
import { StateAggregator } from '@salesforce/core';
|
|
3
|
+
import open from 'open';
|
|
9
4
|
export const getAliasByUsername = async (username) => {
|
|
10
5
|
const stateAggregator = await StateAggregator.getInstance();
|
|
11
6
|
const keys = stateAggregator.aliases.getAll(username);
|
|
12
7
|
// use the most recently added alias for that username
|
|
13
8
|
return keys?.length ? keys[keys.length - 1] : undefined;
|
|
14
9
|
};
|
|
10
|
+
export const openUrl = async (url, options) => open(url, options);
|
|
15
11
|
export const lowerToUpper = (object) =>
|
|
16
12
|
// the API has keys defined in capital camel case, while the definition schema has them as lower camel case
|
|
17
13
|
// we need to convert lower camel case to upper before merging options so they will override properly
|
|
18
14
|
Object.fromEntries(Object.entries(object).map(([key, value]) => [upperFirst(key), value]));
|
|
19
15
|
export default {
|
|
20
16
|
getAliasByUsername,
|
|
17
|
+
openUrl,
|
|
21
18
|
lowerToUpper,
|
|
22
19
|
};
|
|
23
20
|
export const isDefined = (value) => value !== undefined && value !== null;
|
package/lib/shared/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/shared/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/shared/utils.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,IAAiB,MAAM,MAAM,CAAC;AAErC,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,QAAgB,EAA+B,EAAE;IACxF,MAAM,eAAe,GAAG,MAAM,eAAe,CAAC,WAAW,EAAE,CAAC;IAC5D,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACtD,sDAAsD;IACtD,OAAO,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,GAAW,EAAE,OAAgB,EAAyB,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAE1G,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAA+B,EAA2B,EAAE;AACvF,2GAA2G;AAC3G,qGAAqG;AACrG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAE7F,eAAe;IACb,kBAAkB;IAClB,OAAO;IACP,YAAY;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAI,KAA2B,EAAc,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC"}
|
package/oclif.manifest.json
CHANGED
|
@@ -358,6 +358,7 @@
|
|
|
358
358
|
"pluginType": "core",
|
|
359
359
|
"strict": true,
|
|
360
360
|
"summary": "Open your default scratch org, or another specified org, in a browser.",
|
|
361
|
+
"enableJsonFlag": true,
|
|
361
362
|
"isESM": true,
|
|
362
363
|
"relativePath": [
|
|
363
364
|
"lib",
|
|
@@ -1377,122 +1378,6 @@
|
|
|
1377
1378
|
"metadata:list:org"
|
|
1378
1379
|
]
|
|
1379
1380
|
},
|
|
1380
|
-
"org:open:agent": {
|
|
1381
|
-
"aliases": [],
|
|
1382
|
-
"args": {},
|
|
1383
|
-
"description": "Use the --name flag to open an agent using the developer name (aka API name) in the Agent Builder Org UI.\n\nTo generate a URL but not launch it in your browser, specify --url-only.\n\nTo open in a specific browser, use the --browser flag. Supported browsers are \"chrome\", \"edge\", and \"firefox\". If you don't specify --browser, the org opens in your default browser.",
|
|
1384
|
-
"examples": [
|
|
1385
|
-
"Open the agent with developer name \"Coral_Cloud_Agent using the default browser:\n$ <%= config.bin %> <%= command.id %> --name Coral_Cloud_Agent",
|
|
1386
|
-
"Open the agent in an incognito window of your default browser:\n$ <%= config.bin %> <%= command.id %> --private --name Coral_Cloud_Agent",
|
|
1387
|
-
"Open the agent in the org with alias MyTestOrg1 using the Firefox browser:\n$ <%= config.bin %> <%= command.id %> --target-org MyTestOrg1 --browser firefox --name Coral_Cloud_Agent"
|
|
1388
|
-
],
|
|
1389
|
-
"flags": {
|
|
1390
|
-
"json": {
|
|
1391
|
-
"description": "Format output as json.",
|
|
1392
|
-
"helpGroup": "GLOBAL",
|
|
1393
|
-
"name": "json",
|
|
1394
|
-
"allowNo": false,
|
|
1395
|
-
"type": "boolean"
|
|
1396
|
-
},
|
|
1397
|
-
"flags-dir": {
|
|
1398
|
-
"helpGroup": "GLOBAL",
|
|
1399
|
-
"name": "flags-dir",
|
|
1400
|
-
"summary": "Import flag values from a directory.",
|
|
1401
|
-
"hasDynamicHelp": false,
|
|
1402
|
-
"multiple": false,
|
|
1403
|
-
"type": "option"
|
|
1404
|
-
},
|
|
1405
|
-
"target-org": {
|
|
1406
|
-
"char": "o",
|
|
1407
|
-
"name": "target-org",
|
|
1408
|
-
"noCacheDefault": true,
|
|
1409
|
-
"required": true,
|
|
1410
|
-
"summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
|
|
1411
|
-
"hasDynamicHelp": true,
|
|
1412
|
-
"multiple": false,
|
|
1413
|
-
"type": "option"
|
|
1414
|
-
},
|
|
1415
|
-
"api-version": {
|
|
1416
|
-
"description": "Override the api version used for api requests made by this command",
|
|
1417
|
-
"name": "api-version",
|
|
1418
|
-
"hasDynamicHelp": false,
|
|
1419
|
-
"multiple": false,
|
|
1420
|
-
"type": "option"
|
|
1421
|
-
},
|
|
1422
|
-
"name": {
|
|
1423
|
-
"char": "n",
|
|
1424
|
-
"name": "name",
|
|
1425
|
-
"required": true,
|
|
1426
|
-
"summary": "The developer name (aka API name) of the agent to open in the Agent Builder org UI.",
|
|
1427
|
-
"hasDynamicHelp": false,
|
|
1428
|
-
"multiple": false,
|
|
1429
|
-
"type": "option"
|
|
1430
|
-
},
|
|
1431
|
-
"private": {
|
|
1432
|
-
"exclusive": [
|
|
1433
|
-
"url-only",
|
|
1434
|
-
"browser"
|
|
1435
|
-
],
|
|
1436
|
-
"name": "private",
|
|
1437
|
-
"summary": "Open the org in the default browser using private (incognito) mode.",
|
|
1438
|
-
"allowNo": false,
|
|
1439
|
-
"type": "boolean"
|
|
1440
|
-
},
|
|
1441
|
-
"browser": {
|
|
1442
|
-
"char": "b",
|
|
1443
|
-
"exclusive": [
|
|
1444
|
-
"url-only",
|
|
1445
|
-
"private"
|
|
1446
|
-
],
|
|
1447
|
-
"name": "browser",
|
|
1448
|
-
"summary": "Browser where the org opens.",
|
|
1449
|
-
"hasDynamicHelp": false,
|
|
1450
|
-
"multiple": false,
|
|
1451
|
-
"options": [
|
|
1452
|
-
"chrome",
|
|
1453
|
-
"edge",
|
|
1454
|
-
"firefox"
|
|
1455
|
-
],
|
|
1456
|
-
"type": "option"
|
|
1457
|
-
},
|
|
1458
|
-
"url-only": {
|
|
1459
|
-
"aliases": [
|
|
1460
|
-
"urlonly"
|
|
1461
|
-
],
|
|
1462
|
-
"char": "r",
|
|
1463
|
-
"deprecateAliases": true,
|
|
1464
|
-
"name": "url-only",
|
|
1465
|
-
"summary": "Display navigation URL, but don’t launch browser.",
|
|
1466
|
-
"allowNo": false,
|
|
1467
|
-
"type": "boolean"
|
|
1468
|
-
}
|
|
1469
|
-
},
|
|
1470
|
-
"hasDynamicHelp": true,
|
|
1471
|
-
"hiddenAliases": [],
|
|
1472
|
-
"id": "org:open:agent",
|
|
1473
|
-
"pluginAlias": "@salesforce/plugin-org",
|
|
1474
|
-
"pluginName": "@salesforce/plugin-org",
|
|
1475
|
-
"pluginType": "core",
|
|
1476
|
-
"strict": true,
|
|
1477
|
-
"summary": "Open an agent in the Agent Builder org UI in a browser.",
|
|
1478
|
-
"isESM": true,
|
|
1479
|
-
"relativePath": [
|
|
1480
|
-
"lib",
|
|
1481
|
-
"commands",
|
|
1482
|
-
"org",
|
|
1483
|
-
"open",
|
|
1484
|
-
"agent.js"
|
|
1485
|
-
],
|
|
1486
|
-
"aliasPermutations": [],
|
|
1487
|
-
"permutations": [
|
|
1488
|
-
"org:open:agent",
|
|
1489
|
-
"open:org:agent",
|
|
1490
|
-
"open:agent:org",
|
|
1491
|
-
"org:agent:open",
|
|
1492
|
-
"agent:org:open",
|
|
1493
|
-
"agent:open:org"
|
|
1494
|
-
]
|
|
1495
|
-
},
|
|
1496
1381
|
"org:refresh:sandbox": {
|
|
1497
1382
|
"aliases": [],
|
|
1498
1383
|
"args": {},
|
|
@@ -1813,5 +1698,5 @@
|
|
|
1813
1698
|
]
|
|
1814
1699
|
}
|
|
1815
1700
|
},
|
|
1816
|
-
"version": "5.1.5
|
|
1701
|
+
"version": "5.1.5"
|
|
1817
1702
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-org",
|
|
3
3
|
"description": "Commands to interact with Salesforce orgs",
|
|
4
|
-
"version": "5.1.5
|
|
4
|
+
"version": "5.1.5",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/forcedotcom/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
"@oclif/multi-stage-output": "^0.7.8",
|
|
10
10
|
"@salesforce/core": "^8.6.4",
|
|
11
11
|
"@salesforce/kit": "^3.2.3",
|
|
12
|
-
"@salesforce/sf-plugins-core": "^12.0.
|
|
13
|
-
"@salesforce/source-deploy-retrieve": "^12.
|
|
12
|
+
"@salesforce/sf-plugins-core": "^12.0.9",
|
|
13
|
+
"@salesforce/source-deploy-retrieve": "^12.8.1",
|
|
14
|
+
"@salesforce/ts-types": "^2.0.12",
|
|
14
15
|
"ansis": "^3.2.0",
|
|
15
16
|
"change-case": "^5.4.4",
|
|
16
17
|
"is-wsl": "^3.1.0",
|
|
@@ -226,7 +227,7 @@
|
|
|
226
227
|
"exports": "./lib/index.js",
|
|
227
228
|
"type": "module",
|
|
228
229
|
"sfdx": {
|
|
229
|
-
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/5.1.5
|
|
230
|
-
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/5.1.5
|
|
230
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/5.1.5.crt",
|
|
231
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/5.1.5.sig"
|
|
231
232
|
}
|
|
232
233
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { OrgOpenCommandBase } from '../../../shared/orgOpenCommandBase.js';
|
|
2
|
-
import { type OrgOpenOutput } from '../../../shared/orgTypes.js';
|
|
3
|
-
export declare class OrgOpenAgent extends OrgOpenCommandBase<OrgOpenOutput> {
|
|
4
|
-
static readonly summary: string;
|
|
5
|
-
static readonly description: string;
|
|
6
|
-
static readonly examples: string[];
|
|
7
|
-
static readonly flags: {
|
|
8
|
-
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
-
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
-
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
private: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
-
browser: import("@oclif/core/interfaces").OptionFlag<"chrome" | "firefox" | "edge" | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
-
'url-only': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
-
};
|
|
15
|
-
run(): Promise<OrgOpenOutput>;
|
|
16
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* Licensed under the BSD 3-Clause license.
|
|
5
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
-
*/
|
|
7
|
-
import { Flags } from '@salesforce/sf-plugins-core';
|
|
8
|
-
import { Messages } from '@salesforce/core';
|
|
9
|
-
import { buildFrontdoorUrl } from '../../../shared/orgOpenUtils.js';
|
|
10
|
-
import { OrgOpenCommandBase } from '../../../shared/orgOpenCommandBase.js';
|
|
11
|
-
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
12
|
-
const messages = Messages.loadMessages('@salesforce/plugin-org', 'open.agent');
|
|
13
|
-
export class OrgOpenAgent extends OrgOpenCommandBase {
|
|
14
|
-
static summary = messages.getMessage('summary');
|
|
15
|
-
static description = messages.getMessage('description');
|
|
16
|
-
static examples = messages.getMessages('examples');
|
|
17
|
-
static flags = {
|
|
18
|
-
'target-org': Flags.requiredOrg(),
|
|
19
|
-
'api-version': Flags.orgApiVersion(),
|
|
20
|
-
name: Flags.string({
|
|
21
|
-
char: 'n',
|
|
22
|
-
summary: messages.getMessage('flags.name.summary'),
|
|
23
|
-
required: true,
|
|
24
|
-
}),
|
|
25
|
-
private: Flags.boolean({
|
|
26
|
-
summary: messages.getMessage('flags.private.summary'),
|
|
27
|
-
exclusive: ['url-only', 'browser'],
|
|
28
|
-
}),
|
|
29
|
-
browser: Flags.option({
|
|
30
|
-
char: 'b',
|
|
31
|
-
summary: messages.getMessage('flags.browser.summary'),
|
|
32
|
-
options: ['chrome', 'edge', 'firefox'], // These are ones supported by "open" package
|
|
33
|
-
exclusive: ['url-only', 'private'],
|
|
34
|
-
})(),
|
|
35
|
-
'url-only': Flags.boolean({
|
|
36
|
-
char: 'r',
|
|
37
|
-
summary: messages.getMessage('flags.url-only.summary'),
|
|
38
|
-
aliases: ['urlonly'],
|
|
39
|
-
deprecateAliases: true,
|
|
40
|
-
}),
|
|
41
|
-
};
|
|
42
|
-
async run() {
|
|
43
|
-
const { flags } = await this.parse(OrgOpenAgent);
|
|
44
|
-
this.org = flags['target-org'];
|
|
45
|
-
this.connection = this.org.getConnection(flags['api-version']);
|
|
46
|
-
const [frontDoorUrl, retUrl] = await Promise.all([
|
|
47
|
-
buildFrontdoorUrl(this.org, this.connection),
|
|
48
|
-
buildRetUrl(this.connection, flags.name),
|
|
49
|
-
]);
|
|
50
|
-
return this.openOrgUI(flags, frontDoorUrl, retUrl);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
// Build the URL part to the Agent Builder given a Bot API name.
|
|
54
|
-
const buildRetUrl = async (conn, botName) => {
|
|
55
|
-
const query = `SELECT id FROM BotDefinition WHERE DeveloperName='${botName}'`;
|
|
56
|
-
const botId = (await conn.singleRecordQuery(query)).Id;
|
|
57
|
-
return `AiCopilot/copilotStudio.app#/copilot/builder?copilotId=${botId}`;
|
|
58
|
-
};
|
|
59
|
-
//# sourceMappingURL=agent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../../src/commands/org/open/agent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAc,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAA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B,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC;YACtD,OAAO,EAAE,CAAC,SAAS,CAAC;YACpB,gBAAgB,EAAE,IAAI;SACvB,CAAC;KACH,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACjD,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QAE/D,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAC/C,iBAAiB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC;YAC5C,WAAW,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC;SACzC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;;AAGH,gEAAgE;AAChE,MAAM,WAAW,GAAG,KAAK,EAAE,IAAgB,EAAE,OAAe,EAAmB,EAAE;IAC/E,MAAM,KAAK,GAAG,qDAAqD,OAAO,GAAG,CAAC;IAC9E,MAAM,KAAK,GAAG,CAAC,MAAM,IAAI,CAAC,iBAAiB,CAAiB,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACvE,OAAO,0DAA0D,KAAK,EAAE,CAAC;AAC3E,CAAC,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
import { Connection, Org } from '@salesforce/core';
|
|
3
|
-
import { type OrgOpenOutput } from './orgTypes.js';
|
|
4
|
-
type OrgOpenFlags = {
|
|
5
|
-
'url-only': boolean;
|
|
6
|
-
browser?: 'chrome' | 'firefox' | 'edge';
|
|
7
|
-
path?: string;
|
|
8
|
-
private: boolean;
|
|
9
|
-
};
|
|
10
|
-
export declare abstract class OrgOpenCommandBase<T> extends SfCommand<T> {
|
|
11
|
-
protected org: Org;
|
|
12
|
-
protected connection: Connection;
|
|
13
|
-
protected openOrgUI(flags: OrgOpenFlags, frontDoorUrl: string, retUrl?: string): Promise<OrgOpenOutput>;
|
|
14
|
-
}
|
|
15
|
-
export {};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* Licensed under the BSD 3-Clause license.
|
|
5
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
-
*/
|
|
7
|
-
import path from 'node:path';
|
|
8
|
-
import fs from 'node:fs';
|
|
9
|
-
import { platform, tmpdir } from 'node:os';
|
|
10
|
-
import { execSync } from 'node:child_process';
|
|
11
|
-
import isWsl from 'is-wsl';
|
|
12
|
-
import { apps } from 'open';
|
|
13
|
-
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
14
|
-
import { Messages, SfdcUrl, SfError } from '@salesforce/core';
|
|
15
|
-
import { env, sleep } from '@salesforce/kit';
|
|
16
|
-
import utils, { fileCleanup, getFileContents, handleDomainError } from './orgOpenUtils.js';
|
|
17
|
-
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
18
|
-
const messages = Messages.loadMessages('@salesforce/plugin-org', 'open');
|
|
19
|
-
export class OrgOpenCommandBase extends SfCommand {
|
|
20
|
-
// Set by concrete classes in `run()`
|
|
21
|
-
org;
|
|
22
|
-
connection;
|
|
23
|
-
async openOrgUI(flags, frontDoorUrl, retUrl) {
|
|
24
|
-
const orgId = this.org.getOrgId();
|
|
25
|
-
const url = `${frontDoorUrl}${retUrl ? `&retURL=${retUrl}` : ''}`;
|
|
26
|
-
// TODO: better typings in sfdx-core for orgs read from auth files
|
|
27
|
-
const username = this.org.getUsername();
|
|
28
|
-
const output = { orgId, url, username };
|
|
29
|
-
// NOTE: Deliberate use of `||` here since getBoolean() defaults to false, and we need to consider both env vars.
|
|
30
|
-
const containerMode = env.getBoolean('SF_CONTAINER_MODE') || env.getBoolean('SFDX_CONTAINER_MODE');
|
|
31
|
-
// security warning only for --json OR --url-only OR containerMode
|
|
32
|
-
if (flags['url-only'] || this.jsonEnabled() || containerMode) {
|
|
33
|
-
const sharedMessages = Messages.loadMessages('@salesforce/plugin-org', 'messages');
|
|
34
|
-
this.warn(sharedMessages.getMessage('SecurityWarning'));
|
|
35
|
-
this.log('');
|
|
36
|
-
}
|
|
37
|
-
if (containerMode) {
|
|
38
|
-
// instruct the user that they need to paste the URL into the browser
|
|
39
|
-
this.styledHeader('Action Required!');
|
|
40
|
-
this.log(messages.getMessage('containerAction', [orgId, url]));
|
|
41
|
-
return output;
|
|
42
|
-
}
|
|
43
|
-
if (flags['url-only']) {
|
|
44
|
-
// this includes the URL
|
|
45
|
-
this.logSuccess(messages.getMessage('humanSuccess', [orgId, username, url]));
|
|
46
|
-
return output;
|
|
47
|
-
}
|
|
48
|
-
this.logSuccess(messages.getMessage('humanSuccessNoUrl', [orgId, username]));
|
|
49
|
-
// we actually need to open the org
|
|
50
|
-
try {
|
|
51
|
-
this.spinner.start(messages.getMessage('domainWaiting'));
|
|
52
|
-
await new SfdcUrl(url).checkLightningDomain();
|
|
53
|
-
this.spinner.stop();
|
|
54
|
-
}
|
|
55
|
-
catch (err) {
|
|
56
|
-
handleDomainError(err, url, env);
|
|
57
|
-
}
|
|
58
|
-
// create a local html file that contains the POST stuff.
|
|
59
|
-
const tempFilePath = path.join(tmpdir(), `org-open-${new Date().valueOf()}.html`);
|
|
60
|
-
await fs.promises.writeFile(tempFilePath, getFileContents(this.connection.accessToken, this.connection.instanceUrl,
|
|
61
|
-
// the path flag is URI-encoded in its `parse` func.
|
|
62
|
-
// For the form redirect to work we need it decoded.
|
|
63
|
-
flags.path ? decodeURIComponent(flags.path) : retUrl));
|
|
64
|
-
const filePathUrl = isWsl
|
|
65
|
-
? 'file:///' + execSync(`wslpath -m ${tempFilePath}`).toString().trim()
|
|
66
|
-
: `file:///${tempFilePath}`;
|
|
67
|
-
const cp = await utils.openUrl(filePathUrl, {
|
|
68
|
-
...(flags.browser ? { app: { name: apps[flags.browser] } } : {}),
|
|
69
|
-
...(flags.private ? { newInstance: platform() === 'darwin', app: { name: apps.browserPrivate } } : {}),
|
|
70
|
-
});
|
|
71
|
-
cp.on('error', (err) => {
|
|
72
|
-
fileCleanup(tempFilePath);
|
|
73
|
-
throw SfError.wrap(err);
|
|
74
|
-
});
|
|
75
|
-
// so we don't delete the file while the browser is still using it
|
|
76
|
-
// open returns when the CP is spawned, but there's not way to know if the browser is still using the file
|
|
77
|
-
await sleep(platform() === 'win32' || isWsl ? 7000 : 5000);
|
|
78
|
-
fileCleanup(tempFilePath);
|
|
79
|
-
return output;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=orgOpenCommandBase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"orgOpenCommandBase.js","sourceRoot":"","sources":["../../src/shared/orgOpenCommandBase.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAc,QAAQ,EAAO,OAAO,EAAE,OAAO,EA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IAChB,CAAC;CACF"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ChildProcess } from 'node:child_process';
|
|
2
|
-
import { Options } from 'open';
|
|
3
|
-
import { Connection, Org } from '@salesforce/core';
|
|
4
|
-
import { Env } from '@salesforce/kit';
|
|
5
|
-
export declare const openUrl: (url: string, options: Options) => Promise<ChildProcess>;
|
|
6
|
-
export declare const fileCleanup: (tempFilePath: string) => void;
|
|
7
|
-
export declare const buildFrontdoorUrl: (org: Org, conn: Connection) => Promise<string>;
|
|
8
|
-
export declare const handleDomainError: (err: unknown, url: string, env: Env) => string;
|
|
9
|
-
/** builds the html file that does an automatic post to the frontdoor url */
|
|
10
|
-
export declare const getFileContents: (authToken: string, instanceUrl: string, retUrl?: string) => string;
|
|
11
|
-
declare const _default: {
|
|
12
|
-
openUrl: (url: string, options: Options) => Promise<ChildProcess>;
|
|
13
|
-
fileCleanup: (tempFilePath: string) => void;
|
|
14
|
-
buildFrontdoorUrl: (org: Org, conn: Connection) => Promise<string>;
|
|
15
|
-
handleDomainError: (err: unknown, url: string, env: Env) => string;
|
|
16
|
-
getFileContents: (authToken: string, instanceUrl: string, retUrl?: string) => string;
|
|
17
|
-
};
|
|
18
|
-
export default _default;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* Licensed under the BSD 3-Clause license.
|
|
5
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
-
*/
|
|
7
|
-
import { rmSync } from 'node:fs';
|
|
8
|
-
import open from 'open';
|
|
9
|
-
import { Logger, Messages, Org, SfError } from '@salesforce/core';
|
|
10
|
-
import { Duration } from '@salesforce/kit';
|
|
11
|
-
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
12
|
-
const messages = Messages.loadMessages('@salesforce/plugin-org', 'open');
|
|
13
|
-
export const openUrl = async (url, options) => open(url, options);
|
|
14
|
-
export const fileCleanup = (tempFilePath) => rmSync(tempFilePath, { force: true, maxRetries: 3, recursive: true });
|
|
15
|
-
export const buildFrontdoorUrl = async (org, conn) => {
|
|
16
|
-
await org.refreshAuth(); // we need a live accessToken for the frontdoor url
|
|
17
|
-
const accessToken = conn.accessToken;
|
|
18
|
-
if (!accessToken) {
|
|
19
|
-
throw new SfError('NoAccessToken', 'NoAccessToken');
|
|
20
|
-
}
|
|
21
|
-
const instanceUrlClean = org.getField(Org.Fields.INSTANCE_URL).replace(/\/$/, '');
|
|
22
|
-
return `${instanceUrlClean}/secur/frontdoor.jsp?sid=${accessToken}`;
|
|
23
|
-
};
|
|
24
|
-
export const handleDomainError = (err, url, env) => {
|
|
25
|
-
if (err instanceof Error) {
|
|
26
|
-
if (err.message.includes('timeout')) {
|
|
27
|
-
const host = /https?:\/\/([^.]*)/.exec(url)?.[1];
|
|
28
|
-
if (!host) {
|
|
29
|
-
throw new SfError('InvalidUrl', 'InvalidUrl');
|
|
30
|
-
}
|
|
31
|
-
const domain = `https://${host}.lightning.force.com`;
|
|
32
|
-
const domainRetryTimeout = env.getNumber('SF_DOMAIN_RETRY') ?? env.getNumber('SFDX_DOMAIN_RETRY', 240);
|
|
33
|
-
const timeout = new Duration(domainRetryTimeout, Duration.Unit.SECONDS);
|
|
34
|
-
const logger = Logger.childFromRoot('org:open');
|
|
35
|
-
logger.debug(`Did not find IP for ${domain} after ${timeout.seconds} seconds`);
|
|
36
|
-
throw new SfError(messages.getMessage('domainTimeoutError'), 'domainTimeoutError');
|
|
37
|
-
}
|
|
38
|
-
throw SfError.wrap(err);
|
|
39
|
-
}
|
|
40
|
-
throw err;
|
|
41
|
-
};
|
|
42
|
-
/** builds the html file that does an automatic post to the frontdoor url */
|
|
43
|
-
export const getFileContents = (authToken, instanceUrl,
|
|
44
|
-
// we have to defalt this to get to Setup only on the POST version. GET goes to Setup automatically
|
|
45
|
-
retUrl = '/lightning/setup/SetupOneHome/home') => `
|
|
46
|
-
<html>
|
|
47
|
-
<body onload="document.body.firstElementChild.submit()">
|
|
48
|
-
<form method="POST" action="${instanceUrl}/secur/frontdoor.jsp">
|
|
49
|
-
<input type="hidden" name="sid" value="${authToken}" />
|
|
50
|
-
<input type="hidden" name="retURL" value="${retUrl}" />
|
|
51
|
-
</form>
|
|
52
|
-
</body>
|
|
53
|
-
</html>`;
|
|
54
|
-
export default {
|
|
55
|
-
openUrl,
|
|
56
|
-
fileCleanup,
|
|
57
|
-
buildFrontdoorUrl,
|
|
58
|
-
handleDomainError,
|
|
59
|
-
getFileContents,
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=orgOpenUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"orgOpenUtils.js","sourceRoot":"","sources":["../../src/shared/orgOpenUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,IAAiB,MAAM,MAAM,CAAC;AACrC,OAAO,EAAc,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAO,MAAM,iBAAiB,CAAC;AAEhD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;AAEzE,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,GAAW,EAAE,OAAgB,EAAyB,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAE1G,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,YAAoB,EAAQ,EAAE,CACxD,MAAM,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,SA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M,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAChD,MAAM,CAAC,KAAK,CAAC,uBAAuB,MAAM,UAAU,OAAO,CAAC,OAAO,UAAU,CAAC,CAAC;YAC/E,MAAM,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC,CAAC;QACrF,CAAC;QACD,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IACD,MAAM,GAAG,CAAC;AACZ,CAAC,CAAC;AAEF,4EAA4E;AAC5E,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,SAAiB,EACjB,WAAmB;AACnB,oGAAoG;AACpG,MAAM,GAAG,oCAAoC,EACrC,EAAE,CAAC;;;kCAGqB,WAAW;+CACE,SAAS;kDACN,MAAM;;;QAGhD,CAAC;AAET,eAAe;IACb,OAAO;IACP,WAAW;IACX,iBAAiB;IACjB,iBAAiB;IACjB,eAAe;CAChB,CAAC"}
|
package/messages/open.agent.md
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# summary
|
|
2
|
-
|
|
3
|
-
Open an agent in the Agent Builder org UI in a browser.
|
|
4
|
-
|
|
5
|
-
# description
|
|
6
|
-
|
|
7
|
-
Use the --name flag to open an agent using the developer name (aka API name) in the Agent Builder Org UI.
|
|
8
|
-
|
|
9
|
-
To generate a URL but not launch it in your browser, specify --url-only.
|
|
10
|
-
|
|
11
|
-
To open in a specific browser, use the --browser flag. Supported browsers are "chrome", "edge", and "firefox". If you don't specify --browser, the org opens in your default browser.
|
|
12
|
-
|
|
13
|
-
# examples
|
|
14
|
-
|
|
15
|
-
- Open the agent with developer name "Coral_Cloud_Agent using the default browser:
|
|
16
|
-
|
|
17
|
-
$ <%= config.bin %> <%= command.id %> --name Coral_Cloud_Agent
|
|
18
|
-
|
|
19
|
-
- Open the agent in an incognito window of your default browser:
|
|
20
|
-
|
|
21
|
-
$ <%= config.bin %> <%= command.id %> --private --name Coral_Cloud_Agent
|
|
22
|
-
|
|
23
|
-
- Open the agent in the org with alias MyTestOrg1 using the Firefox browser:
|
|
24
|
-
|
|
25
|
-
$ <%= config.bin %> <%= command.id %> --target-org MyTestOrg1 --browser firefox --name Coral_Cloud_Agent
|
|
26
|
-
|
|
27
|
-
# flags.name.summary
|
|
28
|
-
|
|
29
|
-
The developer name (aka API name) of the agent to open in the Agent Builder org UI.
|
|
30
|
-
|
|
31
|
-
# flags.private.summary
|
|
32
|
-
|
|
33
|
-
Open the org in the default browser using private (incognito) mode.
|
|
34
|
-
|
|
35
|
-
# flags.browser.summary
|
|
36
|
-
|
|
37
|
-
Browser where the org opens.
|
|
38
|
-
|
|
39
|
-
# flags.url-only.summary
|
|
40
|
-
|
|
41
|
-
Display navigation URL, but don’t launch browser.
|