oauth2-cli 2.0.3 → 2.0.4
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/CHANGELOG.md +7 -0
- package/dist/Client.js +22 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.0.4](https://github.com/battis/oauth2-cli/compare/oauth2-cli/2.0.3...oauth2-cli/2.0.4) (2026-03-31)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* treat base_url as true base URL with request URLs relative to it ([65173f8](https://github.com/battis/oauth2-cli/commit/65173f8e4c9f6d779c700eedb00ea83fa193250d))
|
|
11
|
+
|
|
5
12
|
## [2.0.3](https://github.com/battis/oauth2-cli/compare/oauth2-cli/2.0.2...oauth2-cli/2.0.3) (2026-03-31)
|
|
6
13
|
|
|
7
14
|
|
package/dist/Client.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Mutex } from 'async-mutex';
|
|
2
2
|
import * as gcrtl from 'gcrtl';
|
|
3
3
|
import { EventEmitter } from 'node:events';
|
|
4
|
+
import path from 'node:path';
|
|
4
5
|
import { text } from 'node:stream/consumers';
|
|
5
6
|
import * as OpenIDClient from 'openid-client';
|
|
6
7
|
import * as requestish from 'requestish';
|
|
@@ -254,7 +255,27 @@ export class Client extends EventEmitter {
|
|
|
254
255
|
* @param dPoPOptions Optional, see {@link OpenIDClient.DPoPOptions}
|
|
255
256
|
*/
|
|
256
257
|
async requestRaw(url, method = 'GET', body, headers = {}, dPoPOptions) {
|
|
257
|
-
|
|
258
|
+
try {
|
|
259
|
+
url = requestish.URL.from(url);
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
if (this.base_url || this.credentials.issuer) {
|
|
263
|
+
const base = requestish.URL.from(
|
|
264
|
+
// @ts-expect-error 2345 I _just_ tested for this!
|
|
265
|
+
this.base_url || this.credentials.issuer);
|
|
266
|
+
url = new URL(path.resolve(base.pathname, requestish.URL.toString(url)), base);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
throw new Error(`Could not construct URL for request to ${this.name}`, {
|
|
270
|
+
cause: {
|
|
271
|
+
url,
|
|
272
|
+
base_url: this.base_url,
|
|
273
|
+
'credentials.issuer': this.credentials.issuer,
|
|
274
|
+
error
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
258
279
|
url = requestish.URL.from(requestish.URLSearchParams.appendTo(url, requestish.URLSearchParams.merge(this.inject?.search, url.searchParams)));
|
|
259
280
|
headers = requestish.Headers.merge(this.inject?.headers, headers);
|
|
260
281
|
body = await requestish.Body.from(body);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oauth2-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Acquire API access tokens via OAuth 2.0 / OpenID Connect within CLI tools",
|
|
5
5
|
"homepage": "https://github.com/battis/oauth2-cli/tree/main/packages/oauth2-cli#readme",
|
|
6
6
|
"repository": {
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"open": "^11.0.0",
|
|
24
24
|
"openid-client": "^6.8.2",
|
|
25
25
|
"ora": "^9.3.0",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
26
|
+
"requestish": "0.1.12",
|
|
27
|
+
"gcrtl": "0.1.12"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@battis/typescript-tricks": "^0.8.1",
|