From 30f63a9e7ab0a0668b01d17346ff9fd1128a9f17 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Mon, 25 Mar 2024 12:38:00 -0600 Subject: [PATCH 1/3] feat: bump sf-plugins-core --- command-snapshot.json | 115 ++++++++++++++++++++++++------------------ package.json | 2 +- yarn.lock | 12 ++--- 3 files changed, 74 insertions(+), 55 deletions(-) diff --git a/command-snapshot.json b/command-snapshot.json index a059d81b..1c5140eb 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -1,18 +1,15 @@ [ { - "command": "org:list:auth", - "plugin": "@salesforce/plugin-auth", - "flags": ["json", "loglevel"], "alias": ["force:auth:list", "auth:list"], + "command": "org:list:auth", + "flagAliases": [], "flagChars": [], - "flagAliases": [] + "flags": ["flags-dir", "json", "loglevel"], + "plugin": "@salesforce/plugin-auth" }, { - "command": "org:login:access-token", - "plugin": "@salesforce/plugin-auth", - "flags": ["alias", "instance-url", "json", "loglevel", "no-prompt", "set-default", "set-default-dev-hub"], "alias": ["force:auth:accesstoken:store", "auth:accesstoken:store"], - "flagChars": ["a", "d", "p", "r", "s"], + "command": "org:login:access-token", "flagAliases": [ "instanceurl", "noprompt", @@ -20,41 +17,47 @@ "setdefaultdevhub", "setdefaultdevhubusername", "setdefaultusername" - ] + ], + "flagChars": ["a", "d", "p", "r", "s"], + "flags": [ + "alias", + "flags-dir", + "instance-url", + "json", + "loglevel", + "no-prompt", + "set-default", + "set-default-dev-hub" + ], + "plugin": "@salesforce/plugin-auth" }, { - "command": "org:login:device", - "plugin": "@salesforce/plugin-auth", - "flags": ["alias", "client-id", "instance-url", "json", "loglevel", "set-default", "set-default-dev-hub"], "alias": ["force:auth:device:login", "auth:device:login"], - "flagChars": ["a", "d", "i", "r", "s"], + "command": "org:login:device", "flagAliases": [ "clientid", - "disablemasking", "instanceurl", "setalias", "setdefaultdevhub", "setdefaultdevhubusername", "setdefaultusername" - ] - }, - { - "command": "org:login:jwt", - "plugin": "@salesforce/plugin-auth", + ], + "flagChars": ["a", "d", "i", "r", "s"], "flags": [ "alias", "client-id", + "flags-dir", "instance-url", "json", - "jwt-key-file", "loglevel", - "no-prompt", "set-default", - "set-default-dev-hub", - "username" + "set-default-dev-hub" ], + "plugin": "@salesforce/plugin-auth" + }, + { "alias": ["force:auth:jwt:grant", "auth:jwt:grant"], - "flagChars": ["a", "d", "f", "i", "o", "p", "r", "s"], + "command": "org:login:jwt", "flagAliases": [ "clientid", "instanceurl", @@ -68,23 +71,26 @@ "setdefaultusername", "u", "v" - ] - }, - { - "command": "org:login:sfdx-url", - "plugin": "@salesforce/plugin-auth", + ], + "flagChars": ["a", "d", "f", "i", "o", "p", "r", "s"], "flags": [ "alias", + "client-id", + "flags-dir", + "instance-url", "json", + "jwt-key-file", "loglevel", "no-prompt", "set-default", "set-default-dev-hub", - "sfdx-url-file", - "sfdx-url-stdin" + "username" ], + "plugin": "@salesforce/plugin-auth" + }, + { "alias": ["force:auth:sfdxurl:store", "auth:sfdxurl:store"], - "flagChars": ["a", "d", "f", "p", "s", "u"], + "command": "org:login:sfdx-url", "flagAliases": [ "noprompt", "setalias", @@ -93,27 +99,26 @@ "setdefaultusername", "sfdxurlfile", "sfdxurlstdin" - ] - }, - { - "command": "org:login:web", - "plugin": "@salesforce/plugin-auth", + ], + "flagChars": ["a", "d", "f", "p", "s", "u"], "flags": [ "alias", - "browser", - "client-id", - "instance-url", + "flags-dir", "json", "loglevel", "no-prompt", "set-default", - "set-default-dev-hub" + "set-default-dev-hub", + "sfdx-url-file", + "sfdx-url-stdin" ], + "plugin": "@salesforce/plugin-auth" + }, + { "alias": ["force:auth:web:login", "auth:web:login"], - "flagChars": ["a", "b", "d", "i", "p", "r", "s"], + "command": "org:login:web", "flagAliases": [ "clientid", - "disablemasking", "instanceurl", "l", "noprompt", @@ -122,14 +127,28 @@ "setdefaultdevhubusername", "setdefaultusername", "v" - ] + ], + "flagChars": ["a", "b", "d", "i", "p", "r", "s"], + "flags": [ + "alias", + "browser", + "client-id", + "flags-dir", + "instance-url", + "json", + "loglevel", + "no-prompt", + "set-default", + "set-default-dev-hub" + ], + "plugin": "@salesforce/plugin-auth" }, { - "command": "org:logout", - "plugin": "@salesforce/plugin-auth", - "flags": ["all", "json", "loglevel", "no-prompt", "target-org"], "alias": ["force:auth:logout", "auth:logout"], + "command": "org:logout", + "flagAliases": ["noprompt", "targetusername", "u"], "flagChars": ["a", "o", "p"], - "flagAliases": ["noprompt", "targetusername", "u"] + "flags": ["all", "flags-dir", "json", "loglevel", "no-prompt", "target-org"], + "plugin": "@salesforce/plugin-auth" } ] diff --git a/package.json b/package.json index f93d293d..46073911 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "@oclif/core": "^3.25.2", "@salesforce/core": "^6.7.3", "@salesforce/kit": "^3.0.15", - "@salesforce/sf-plugins-core": "^7.1.15", + "@salesforce/sf-plugins-core": "^8.0.1", "@salesforce/ts-types": "^2.0.9", "chalk": "^5.3.0", "open": "^10.1.0" diff --git a/yarn.lock b/yarn.lock index dd4552b5..5bac65a7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1416,7 +1416,7 @@ strip-ansi "6.0.1" ts-retry-promise "^0.8.0" -"@salesforce/core@^6.4.1", "@salesforce/core@^6.6.0", "@salesforce/core@^6.7.0", "@salesforce/core@^6.7.1", "@salesforce/core@^6.7.3": +"@salesforce/core@^6.4.1", "@salesforce/core@^6.7.0", "@salesforce/core@^6.7.1", "@salesforce/core@^6.7.3": version "6.7.3" resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-6.7.3.tgz#5d8f30c40ac3cebb898c8e845fe9a067bc729268" integrity sha512-uU+PuZZGXxByhvnXLH1V3eY5P1caw401dIZ/QvhzYxoP/alPLk7dpChnZNJYH5Rw3dc/AhSPw+eg0cvUyjhP1Q== @@ -1522,15 +1522,15 @@ chalk "^4" inquirer "^8.2.5" -"@salesforce/sf-plugins-core@^7.1.15": - version "7.1.15" - resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-7.1.15.tgz#4d6033d56d78cf6046abfce96c119a8a60ee7c07" - integrity sha512-dQSSIHEpeFIadkWqZE24068m01vy31hVJdGWYvgscTnNrR30jIC5fXRevYvGG0l+8vVEJkCYYnJFQabUjSw3Eg== +"@salesforce/sf-plugins-core@^8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-8.0.1.tgz#f155cddfd7695aab0d8264848b634b2a91cdbf2c" + integrity sha512-R6SqJ1XqSINSWdZruKtC2SKGnLBh7KbFI7+qS0FYlyPU4IlWoa+AZkGwWvlczuSOumqnlhT95rNKwZTS5rJugA== dependencies: "@inquirer/confirm" "^2.0.17" "@inquirer/password" "^1.1.16" "@oclif/core" "^3.23.0" - "@salesforce/core" "^6.6.0" + "@salesforce/core" "^6.7.3" "@salesforce/kit" "^3.0.15" "@salesforce/ts-types" "^2.0.9" chalk "^5.3.0" From 7bc9188c223a1080d3dba6aa8d89a5f8e57804d0 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Mon, 25 Mar 2024 12:40:57 -0600 Subject: [PATCH 2/3] fix: readme --- README.md | 1348 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 1346 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5e891540..adc1ad2c 100644 --- a/README.md +++ b/README.md @@ -70,8 +70,1352 @@ sfdx plugins -# Command Topics +- [`sf auth accesstoken store`](#sf-auth-accesstoken-store) +- [`sf auth device login`](#sf-auth-device-login) +- [`sf auth jwt grant`](#sf-auth-jwt-grant) +- [`sf auth list`](#sf-auth-list) +- [`sf auth logout`](#sf-auth-logout) +- [`sf auth sfdxurl store`](#sf-auth-sfdxurl-store) +- [`sf auth web login`](#sf-auth-web-login) +- [`sf force auth accesstoken store`](#sf-force-auth-accesstoken-store) +- [`sf force auth device login`](#sf-force-auth-device-login) +- [`sf force auth jwt grant`](#sf-force-auth-jwt-grant) +- [`sf force auth list`](#sf-force-auth-list) +- [`sf force auth logout`](#sf-force-auth-logout) +- [`sf force auth sfdxurl store`](#sf-force-auth-sfdxurl-store) +- [`sf force auth web login`](#sf-force-auth-web-login) +- [`sf org list auth`](#sf-org-list-auth) +- [`sf org login access-token`](#sf-org-login-access-token) +- [`sf org login device`](#sf-org-login-device) +- [`sf org login jwt`](#sf-org-login-jwt) +- [`sf org login sfdx-url`](#sf-org-login-sfdx-url) +- [`sf org login web`](#sf-org-login-web) +- [`sf org logout`](#sf-org-logout) -- [`sf org`](docs/org.md) +## `sf auth accesstoken store` + +Authorize an org using an existing Salesforce access token. + +``` +USAGE + $ sf auth accesstoken store -r [--json] [--flags-dir ] [-d] [-s] [-a ] [-p] + +FLAGS + -a, --alias= Alias for the org. + -d, --set-default-dev-hub Set the authenticated org as the default Dev Hub. + -p, --no-prompt Don't prompt for confirmation. + -r, --instance-url= (required) URL of the instance that the org lives on. + -s, --set-default Set the authenticated org as the default that all org-related commands run against. + +GLOBAL FLAGS + --flags-dir= Import flag values from a directory. + --json Format output as json. + +DESCRIPTION + Authorize an org using an existing Salesforce access token. + + By default, the command runs interactively and asks you for the access token. If you previously authorized the org, + the command prompts whether you want to overwrite the local file. Specify --no-prompt to not be prompted. + + To use the command in a CI/CD script, set the SFDX_ACCESS_TOKEN environment variable to the access token. Then run the + command with the --no-prompt parameter. + +ALIASES + $ sf force auth accesstoken store + $ sf auth accesstoken store + +EXAMPLES + Authorize an org on https://mycompany.my.salesforce.com; the command prompts you for the access token: + + $ sf auth accesstoken store --instance-url https://mycompany.my.salesforce.com + + Authorize the org without being prompted; you must have previously set the SF_ACCESS_TOKEN environment variable to + the access token: + + $ sf auth accesstoken store --instance-url https://dev-hub.my.salesforce.com --no-prompt + +FLAG DESCRIPTIONS + -r, --instance-url= URL of the instance that the org lives on. + + If you specify an --instance-url value, this value overrides the sfdcLoginUrl value in your sfdx-project.json file. + + To specify a My Domain URL, use the format "https://.my.salesforce.com". + + To specify a sandbox, set --instance-url to "https://--.sandbox.my.salesforce.com". +``` + +## `sf auth device login` + +Authorize an org using a device code. + +``` +USAGE + $ sf auth device login [--json] [--flags-dir ] [-i ] [-r ] [-d] [-s] [-a ] + +FLAGS + -a, --alias= Alias for the org. + -d, --set-default-dev-hub Set the authenticated org as the default Dev Hub. + -i, --client-id= OAuth client ID (also called consumer key) of your custom connected app. + -r, --instance-url= URL of the instance that the org lives on. + -s, --set-default Set the authenticated org as the default that all org-related commands run against. + +GLOBAL FLAGS + --flags-dir= Import flag values from a directory. + --json Format output as json. + +DESCRIPTION + Authorize an org using a device code. + + Use this command to allow a device to connect to an org. + + When you run this command, it first displays an 8-digit device code and the URL for verifying the code on your org. + The default instance URL is https://login.salesforce.com, so if the org you're authorizing is on a different instance, + use the --instance-url. The command waits while you complete the verification. Open a browser and navigate to the + displayed verification URL, enter the code, then click Connect. If you aren't already logged into your org, log in, + and then you're prompted to allow the device to connect to the org. After you successfully authorize the org, you can + close the browser window. + +ALIASES + $ sf force auth device login + $ sf auth device login + +EXAMPLES + Authorize an org using a device code, give the org the alias TestOrg1, and set it as your default Dev Hub org: + + $ sf auth device login --set-default-dev-hub --alias TestOrg1 + + Authorize an org in which you've created a custom connected app with the specified client ID (consumer key): + + $ sf auth device login --client-id + + Authorize a sandbox org with the specified instance URL: + + $ sf auth device login --instance-url https://MyDomainName--SandboxName.sandbox.my.salesforce.com + +FLAG DESCRIPTIONS + -r, --instance-url= URL of the instance that the org lives on. + + If you specify an --instance-url value, this value overrides the sfdcLoginUrl value in your sfdx-project.json file. + + To specify a My Domain URL, use the format "https://.my.salesforce.com". + + To specify a sandbox, set --instance-url to "https://--.sandbox.my.salesforce.com". +``` + +## `sf auth jwt grant` + +Log in to a Salesforce org using a JSON web token (JWT). + +``` +USAGE + $ sf auth jwt grant -o -f -i [--json] [--flags-dir ] [-r ] [-d] [-s] [-a + ] + +FLAGS + -a, --alias= Alias for the org. + -d, --set-default-dev-hub Set the authenticated org as the default Dev Hub. + -f, --jwt-key-file= (required) Path to a file containing the private key. + -i, --client-id= (required) OAuth client ID (also called consumer key) of your custom connected app. + -o, --username= (required) Username of the user logging in. + -r, --instance-url= URL of the instance that the org lives on. + -s, --set-default Set the authenticated org as the default that all org-related commands run against. + +GLOBAL FLAGS + --flags-dir= Import flag values from a directory. + --json Format output as json. + +DESCRIPTION + Log in to a Salesforce org using a JSON web token (JWT). + + Use this command in automated environments where you can’t interactively log in with a browser, such as in CI/CD + scripts. + + Logging into an org authorizes the CLI to run other commands that connect to that org, such as deploying or retrieving + a project. You can log into many types of orgs, such as sandboxes, Dev Hubs, Env Hubs, production orgs, and scratch + orgs. + + Complete these steps before you run this command: + + 1. Create a digital certificate (also called digital signature) and the private key to sign the certificate. You can + use your own key and certificate issued by a certification authority. Or use OpenSSL to create a key and a self-signed + digital certificate. + 2. Store the private key in a file on your computer. When you run this command, you set the --jwt-key-file flag to + this file. + 3. Create a custom connected app in your org using the digital certificate. Make note of the consumer key (also called + client id) that’s generated for you. Be sure the username of the user logging in is approved to use the connected app. + When you run this command, you set the --client-id flag to the consumer key. + + See https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_jwt_flow.htm for more + information. + + We recommend that you set an alias when you log into an org. Aliases make it easy to later reference this org when + running commands that require it. If you don’t set an alias, you use the username that you specified when you logged + in to the org. If you run multiple commands that reference the same org, consider setting the org as your default. Use + --set-default for your default scratch org or sandbox, or --set-default-dev-hub for your default Dev Hub. + +ALIASES + $ sf force auth jwt grant + $ sf auth jwt grant + +EXAMPLES + Log into an org with username jdoe@example.org and on the default instance URL (https://login.salesforce.com). The + private key is stored in the file /Users/jdoe/JWT/server.key and the command uses the connected app with consumer + key (client id) 04580y4051234051. + + $ sf auth jwt grant --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id \ + 04580y4051234051 + + Set the org as the default and give it an alias: + + $ sf auth jwt grant --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id \ + 04580y4051234051 --alias ci-org --set-default + + Set the org as the default Dev Hub and give it an alias: + + $ sf auth jwt grant --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id \ + 04580y4051234051 --alias ci-dev-hub --set-default-dev-hub + + Log in to a sandbox using URL https://MyDomainName--SandboxName.sandbox.my.salesforce.com: + + $ sf auth jwt grant --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id \ + 04580y4051234051 --alias ci-org --set-default --instance-url \ + https://MyDomainName--SandboxName.sandbox.my.salesforce.com + +FLAG DESCRIPTIONS + -r, --instance-url= URL of the instance that the org lives on. + + If you specify an --instance-url value, this value overrides the sfdcLoginUrl value in your sfdx-project.json file. + + To specify a My Domain URL, use the format "https://.my.salesforce.com". + + To specify a sandbox, set --instance-url to "https://--.sandbox.my.salesforce.com". +``` + +## `sf auth list` + +List authorization information about the orgs you created or logged into. + +``` +USAGE + $ sf auth list [--json] [--flags-dir ] + +GLOBAL FLAGS + --flags-dir= Import flag values from a directory. + --json Format output as json. + +DESCRIPTION + List authorization information about the orgs you created or logged into. + + This command uses local authorization information that Salesforce CLI caches when you create a scratch org or log into + an org. The command doesn't actually connect to the orgs to verify that they're still active. As a result, this + command executes very quickly. If you want to view live information about your authorized orgs, such as their + connection status, use the "org list" command. + +ALIASES + $ sf force auth list + $ sf auth list + +EXAMPLES + List local authorization information about your orgs: + + $ sf auth list +``` + +## `sf auth logout` + +Log out of a Salesforce org. + +``` +USAGE + $ sf auth logout [--json] [--flags-dir ] [-a | -o ] [-p] + +FLAGS + -a, --all Include all authenticated orgs. + -o, --target-org= Username or alias of the target org. + -p, --no-prompt Don't prompt for confirmation. + +GLOBAL FLAGS + --flags-dir= Import flag values from a directory. + --json Format output as json. + +DESCRIPTION + Log out of a Salesforce org. + + If you run this command with no flags and no default org set in your config or environment, it first displays a list + of orgs you've created or logged into, with none of the orgs selected. Use the arrow keys to scroll through the list + and the space bar to select the orgs you want to log out of. Press Enter when you're done; the command asks for a + final confirmation before logging out of the selected orgs. + + The process is similar if you specify --all, except that in the initial list of orgs, they're all selected. Use + --target-org to logout of a specific org. In both these cases by default, you must still confirm that you want to log + out. Use --no-prompt to never be asked for confirmation when also using --all or --target-org. + + Be careful! If you log out of a scratch org without having access to its password, you can't access the scratch org + again, either through the CLI or the Salesforce UI. + +ALIASES + $ sf force auth logout + $ sf auth logout + +EXAMPLES + Interactively select the orgs to log out of: + + $ sf auth logout + + Log out of the org with username me@my.org: + + $ sf auth logout --target-org me@my.org + + Log out of all orgs after confirmation: + + $ sf auth logout --all + + Logout of the org with alias my-scratch and don't prompt for confirmation: + + $ sf auth logout --target-org my-scratch --no-prompt + +FLAG DESCRIPTIONS + -a, --all Include all authenticated orgs. + + All orgs includes Dev Hubs, sandboxes, DE orgs, and expired, deleted, and unknown-status scratch orgs. +``` + +## `sf auth sfdxurl store` + +Authorize an org using a Salesforce DX authorization URL stored in a file or through standard input (stdin). + +``` +USAGE + $ sf auth sfdxurl store [--json] [--flags-dir ] [-f ] [-u ] [-d] [-s] [-a ] + +FLAGS + -a, --alias= Alias for the org. + -d, --set-default-dev-hub Set the authenticated org as the default Dev Hub. + -f, --sfdx-url-file= Path to a file that contains the Salesforce DX authorization URL. + -s, --set-default Set the authenticated org as the default that all org-related commands run against. + -u, --sfdx-url-stdin= Pipe the Salesforce DX authorization URL through standard input (stdin). + +GLOBAL FLAGS + --flags-dir= Import flag values from a directory. + --json Format output as json. + +DESCRIPTION + Authorize an org using a Salesforce DX authorization URL stored in a file or through standard input (stdin). + + The Salesforce DX (SFDX) authorization URL must have the format + "force://::@". NOTE: The SFDX authorization URL uses the "force" + protocol, and not "http" or "https". Also, the "instanceUrl" inside the SFDX authorization URL doesn't include the + protocol ("https://"). + + You have three options when creating the authorization file. The easiest option is to redirect the output of the "sf + org display --verbose --json" command into a file. For example, using an org with alias my-org that you've already + authorized: + + $ sf org display --target-org my-org --verbose --json > authFile.json + + The resulting JSON file contains the URL in the "sfdxAuthUrl" property of the "result" object. You can then reference + the file when running this command: + + $ sf auth sfdxurl store --sfdx-url-file authFile.json + + NOTE: The "sf org display --verbose" command displays the refresh token only for orgs authorized with the web server + flow, and not the JWT bearer flow. + + You can also create a JSON file that has a top-level property named sfdxAuthUrl whose value is the authorization URL. + Finally, you can create a normal text file that includes just the URL and nothing else. + + Alternatively, you can pipe the SFDX authorization URL through standard input by specifying the --sfdx-url-stdin flag. + +ALIASES + $ sf force auth sfdxurl store + $ sf auth sfdxurl store + +EXAMPLES + Authorize an org using the SFDX authorization URL in the files/authFile.json file: + + $ sf auth sfdxurl store --sfdx-url-file files/authFile.json + + Similar to previous example, but set the org as your default and give it an alias MyDefaultOrg: + + $ sf auth sfdxurl store --sfdx-url-file files/authFile.json --set-default --alias MyDefaultOrg + + Pipe the SFDX authorization URL from stdin: + + $ echo url | sf auth sfdxurl store --sfdx-url-stdin +``` + +## `sf auth web login` + +Log in to a Salesforce org using the web server flow. + +``` +USAGE + $ sf auth web login [--json] [--flags-dir ] [-b chrome|edge|firefox] [-i ] [-r ] [-d] [-s] + [-a ] + +FLAGS + -a, --alias= Alias for the org. + -b, --browser=