Skip to content

Commit b84ca3a

Browse files
committed
Merge remote-tracking branch 'origin/main' into cd/help-text
2 parents 239fff5 + 4d6f9f5 commit b84ca3a

File tree

7 files changed

+54
-21
lines changed

7 files changed

+54
-21
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [1.3.3](https://github.com/salesforcecli/plugin-api/compare/1.3.2...1.3.3) (2025-01-17)
2+
3+
### Bug Fixes
4+
5+
- refresh access token before issuing request ([f0e0cd0](https://github.com/salesforcecli/plugin-api/commit/f0e0cd05e171db3df474d9fa60a7f5798e80b8e5))
6+
17
## [1.3.2](https://github.com/salesforcecli/plugin-api/compare/1.3.1...1.3.2) (2024-11-08)
28

39
### Bug Fixes

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2024, Salesforce.com, Inc.
1+
Copyright (c) 2025, Salesforce.com, Inc.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ EXAMPLES
113113
$ sf api request graphql --body example.txt --stream-to-file output.txt --include
114114
```
115115

116-
_See code: [src/commands/api/request/graphql.ts](https://github.com/salesforcecli/plugin-api/blob/1.3.2/src/commands/api/request/graphql.ts)_
116+
_See code: [src/commands/api/request/graphql.ts](https://github.com/salesforcecli/plugin-api/blob/1.3.3/src/commands/api/request/graphql.ts)_
117117

118118
## `sf api request rest [URL]`
119119

@@ -222,7 +222,7 @@ FLAG DESCRIPTIONS
222222
https://github.com/salesforcecli/plugin-api/tree/main/test/test-files/data-project.
223223
```
224224

225-
_See code: [src/commands/api/request/rest.ts](https://github.com/salesforcecli/plugin-api/blob/1.3.2/src/commands/api/request/rest.ts)_
225+
_See code: [src/commands/api/request/rest.ts](https://github.com/salesforcecli/plugin-api/blob/1.3.3/src/commands/api/request/rest.ts)_
226226

227227
<!-- commandsstop -->
228228

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "@salesforce/plugin-api",
33
"description": "A plugin to call API endpoints via CLI commands",
4-
"version": "1.3.2",
4+
"version": "1.3.3",
55
"author": "Salesforce",
66
"bugs": "https://github.com/forcedotcom/cli/issues",
77
"dependencies": {
88
"@oclif/core": "^4",
9-
"@salesforce/core": "^8.4.0",
9+
"@salesforce/core": "^8.8.1",
1010
"@salesforce/kit": "^3.2.1",
1111
"@salesforce/sf-plugins-core": "^12",
1212
"@salesforce/ts-types": "^2.0.12",

src/commands/api/request/graphql.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ export default class Graphql extends SfCommand<void> {
4545
.replaceAll('"', '\\"')}"}`;
4646
const url = new URL(`${org.getField<string>(Org.Fields.INSTANCE_URL)}/services/data/v${apiVersion}/graphql`);
4747

48+
// refresh access token to ensure `got` gets a valid access token.
49+
// TODO: we could skip this step if we used jsforce's HTTP module instead (handles expired tokens).
4850
await org.refreshAuth();
4951

5052
const options = {

src/commands/api/request/rest.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ export class Rest extends SfCommand<void> {
138138
headers = { ...headers, ...body.getHeaders() };
139139
}
140140

141+
// refresh access token to ensure `got` gets a valid access token.
142+
// TODO: we could skip this step if we used jsforce's HTTP module instead (handles expired tokens).
143+
await org.refreshAuth();
144+
141145
const options = {
142146
agent: { https: new ProxyAgent() },
143147
method,
@@ -155,8 +159,6 @@ export class Rest extends SfCommand<void> {
155159
followRedirect: false,
156160
};
157161

158-
await org.refreshAuth();
159-
160162
await sendAndPrintRequest({ streamFile, url, options, include: flags.include, this: this });
161163
}
162164
}

yarn.lock

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,13 +1178,12 @@
11781178
"@jridgewell/resolve-uri" "^3.1.0"
11791179
"@jridgewell/sourcemap-codec" "^1.4.14"
11801180

1181-
"@jsforce/jsforce-node@^3.4.1":
1182-
version "3.4.1"
1183-
resolved "https://registry.yarnpkg.com/@jsforce/jsforce-node/-/jsforce-node-3.4.1.tgz#36f5cba775b395eeedba676a78eafe447c3f4b28"
1184-
integrity sha512-PsBKfglH0/8W/Srr4LsxEFsVmjmZjEj/T4XLGpbBoK8yVObwbiMk4VqwA6XwiA6SHqnEqqQbHZxk2rr7dZC+4A==
1181+
"@jsforce/jsforce-node@^3.6.1":
1182+
version "3.6.3"
1183+
resolved "https://registry.yarnpkg.com/@jsforce/jsforce-node/-/jsforce-node-3.6.3.tgz#a5c984b6deffac01ddabc3f4b48374408c5cd194"
1184+
integrity sha512-sNUeBzfUv57uH0AiYuAOO8yjBP7lNY33mWybrjvBud8gMFVWozY6UAWU1DUk/dpqZ0+FK3iqB++nOQRczj1nSg==
11851185
dependencies:
11861186
"@sindresorhus/is" "^4"
1187-
abort-controller "^3.0.0"
11881187
base64url "^3.0.1"
11891188
csv-parse "^5.5.2"
11901189
csv-stringify "^6.4.4"
@@ -1193,7 +1192,6 @@
11931192
https-proxy-agent "^5.0.0"
11941193
multistream "^3.1.0"
11951194
node-fetch "^2.6.1"
1196-
strip-ansi "^6.0.0"
11971195
xml2js "^0.6.2"
11981196

11991197
"@nodelib/fs.scandir@2.1.5":
@@ -1348,12 +1346,12 @@
13481346
strip-ansi "6.0.1"
13491347
ts-retry-promise "^0.8.1"
13501348

1351-
"@salesforce/core@^8.4.0", "@salesforce/core@^8.5.1", "@salesforce/core@^8.5.4", "@salesforce/core@^8.5.7":
1352-
version "8.5.7"
1353-
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-8.5.7.tgz#18c98ba383f7030f7e5420677bbd108d1d93dcc3"
1354-
integrity sha512-HY2ztRT2QACgWrbze+v+B6L4q+RT9FdswXhVQRssf8ZeJH/kqFnF4U640i+dAFChs9mGGCS2zmm6BTREiwg2LA==
1349+
"@salesforce/core@^8.5.1", "@salesforce/core@^8.5.4", "@salesforce/core@^8.5.7", "@salesforce/core@^8.8.1":
1350+
version "8.8.1"
1351+
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-8.8.1.tgz#eceb9842d300316c02d4a34da5ac377c20dfdda3"
1352+
integrity sha512-/E7rQy4trbG1dmRA9FiePLmwjbcK4fk0WB9KePrxH+90kpCNOVcTKaOhzAswmNdJWXjGofPUQCgrb927x//a2g==
13551353
dependencies:
1356-
"@jsforce/jsforce-node" "^3.4.1"
1354+
"@jsforce/jsforce-node" "^3.6.1"
13571355
"@salesforce/kit" "^3.2.2"
13581356
"@salesforce/schemas" "^1.9.0"
13591357
"@salesforce/ts-types" "^2.0.10"
@@ -7130,7 +7128,16 @@ stack-utils@^2.0.6:
71307128
dependencies:
71317129
escape-string-regexp "^2.0.0"
71327130

7133-
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
7131+
"string-width-cjs@npm:string-width@^4.2.0":
7132+
version "4.2.3"
7133+
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
7134+
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
7135+
dependencies:
7136+
emoji-regex "^8.0.0"
7137+
is-fullwidth-code-point "^3.0.0"
7138+
strip-ansi "^6.0.1"
7139+
7140+
string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
71347141
version "4.2.3"
71357142
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
71367143
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -7207,7 +7214,14 @@ stringify-entities@^4.0.0:
72077214
character-entities-html4 "^2.0.0"
72087215
character-entities-legacy "^3.0.0"
72097216

7210-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1:
7217+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
7218+
version "6.0.1"
7219+
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
7220+
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
7221+
dependencies:
7222+
ansi-regex "^5.0.1"
7223+
7224+
strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1:
72117225
version "6.0.1"
72127226
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
72137227
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -7839,7 +7853,7 @@ workerpool@^6.5.1:
78397853
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544"
78407854
integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==
78417855

7842-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
7856+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
78437857
version "7.0.0"
78447858
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
78457859
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -7857,6 +7871,15 @@ wrap-ansi@^6.2.0:
78577871
string-width "^4.1.0"
78587872
strip-ansi "^6.0.0"
78597873

7874+
wrap-ansi@^7.0.0:
7875+
version "7.0.0"
7876+
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
7877+
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
7878+
dependencies:
7879+
ansi-styles "^4.0.0"
7880+
string-width "^4.1.0"
7881+
strip-ansi "^6.0.0"
7882+
78607883
wrap-ansi@^8.1.0:
78617884
version "8.1.0"
78627885
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"

0 commit comments

Comments
 (0)