@oauth2-cli/qui-cli 1.1.1 → 1.1.3
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 +15 -0
- package/dist/Client.d.ts +3 -3
- package/dist/Client.js +16 -6
- package/dist/OAuth2.d.ts +2 -2
- package/extendable/Client.d.ts +3 -3
- package/extendable/Client.js +16 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
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
|
+
## [1.1.3](https://github.com/battis/oauth2-cli/compare/qui-cli-plugin/1.1.2...qui-cli-plugin/1.1.3) (2026-03-04)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* allow requestish.Body.ish request bodies as intended ([f12a2ce](https://github.com/battis/oauth2-cli/commit/f12a2ceb1c517f6fd90b33c8c71da7f987af640d))
|
|
11
|
+
|
|
12
|
+
## [1.1.2](https://github.com/battis/oauth2-cli/compare/qui-cli-plugin/1.1.1...qui-cli-plugin/1.1.2) (2026-03-04)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* improve JSOn debugging output ([a197307](https://github.com/battis/oauth2-cli/commit/a19730721ac53666a2c4e4e4982abf85353386e3))
|
|
18
|
+
* improved response debugging output ([2c63583](https://github.com/battis/oauth2-cli/commit/2c635834e2e2a21c519b3d3bcec8ac26b1d70bbf))
|
|
19
|
+
|
|
5
20
|
## [1.1.1](https://github.com/battis/oauth2-cli/compare/qui-cli-plugin/1.1.0...qui-cli-plugin/1.1.1) (2026-03-04)
|
|
6
21
|
|
|
7
22
|
|
package/dist/Client.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { JSONValue } from '@battis/typescript-tricks';
|
|
|
2
2
|
import { Request } from 'express';
|
|
3
3
|
import * as OAuth2CLI from 'oauth2-cli';
|
|
4
4
|
import type * as OpenIDClient from 'openid-client';
|
|
5
|
-
import
|
|
5
|
+
import { Body, Headers, URL } from 'requestish';
|
|
6
6
|
/**
|
|
7
7
|
* Wrap {@link https://www.npmjs.com/package/openid-client openid-client} in a
|
|
8
8
|
* class instance specific to a particular OAuth/OpenID server credential-set,
|
|
@@ -19,6 +19,6 @@ export declare class Client<C extends OAuth2CLI.Credentials = OAuth2CLI.Credenti
|
|
|
19
19
|
handleAuthorizationCodeRedirect(request: Request, session: OAuth2CLI.Localhost.Server): Promise<OAuth2CLI.Token.Response>;
|
|
20
20
|
protected refreshTokenGrant({ refresh_token, inject }?: Parameters<OAuth2CLI.Client['refreshTokenGrant']>[0]): Promise<OAuth2CLI.Token.Response | undefined>;
|
|
21
21
|
protected save(response: OAuth2CLI.Token.Response): Promise<OAuth2CLI.Token.Response>;
|
|
22
|
-
request(url:
|
|
23
|
-
requestJSON<J extends JSONValue = JSONValue>(url:
|
|
22
|
+
request(url: URL.ish, method?: string, body?: Body.ish, headers?: Headers.ish, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<Response>;
|
|
23
|
+
requestJSON<J extends JSONValue = JSONValue>(url: URL.ish, method?: string, body?: Body.ish, headers?: Headers.ish, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<J>;
|
|
24
24
|
}
|
package/dist/Client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Colors } from '@qui-cli/colors';
|
|
1
2
|
import { Log } from '@qui-cli/log';
|
|
2
3
|
import * as OAuth2CLI from 'oauth2-cli';
|
|
3
4
|
/**
|
|
@@ -52,17 +53,26 @@ export class Client extends OAuth2CLI.Client {
|
|
|
52
53
|
Log.debug(`Persisting ${this.name} refresh token (if present and storage configured):\n${Log.syntaxColor(response)}`);
|
|
53
54
|
return await super.save(response);
|
|
54
55
|
}
|
|
55
|
-
async request(url, method, body, headers, dPoPOptions) {
|
|
56
|
-
Log.debug(`Sending request to ${this.name}
|
|
56
|
+
async request(url, method = 'GET', body, headers = {}, dPoPOptions) {
|
|
57
|
+
Log.debug(`Sending request to ${this.name}:\n${Log.syntaxColor({
|
|
57
58
|
request: { method, url, headers, body, dPoPOptions }
|
|
58
|
-
});
|
|
59
|
+
})}`);
|
|
59
60
|
const response = await super.request(url, method, body, headers, dPoPOptions);
|
|
60
|
-
Log.debug(`Received response from ${this.name}:\n${Log.syntaxColor(
|
|
61
|
+
Log.debug(`Received response from ${this.name}:\n${Log.syntaxColor({
|
|
62
|
+
ok: response.ok,
|
|
63
|
+
status: response.status,
|
|
64
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
65
|
+
body: response.body ? '<not yet parsed>' : null
|
|
66
|
+
})}`);
|
|
61
67
|
return response;
|
|
62
68
|
}
|
|
63
|
-
async requestJSON(url, method, body, headers, dPoPOptions) {
|
|
69
|
+
async requestJSON(url, method = 'GET', body, headers = {}, dPoPOptions) {
|
|
64
70
|
const json = await super.requestJSON(url, method, body, headers, dPoPOptions);
|
|
65
|
-
Log.debug(`Parsed JSON from ${this.name} response:\n${
|
|
71
|
+
Log.debug(`Parsed JSON from ${this.name} response:\n${typeof json === 'object' && json
|
|
72
|
+
? Log.syntaxColor(json)
|
|
73
|
+
: typeof json === 'string'
|
|
74
|
+
? Colors.quotedValue(`"${json}"`)
|
|
75
|
+
: Colors.value(json)}`);
|
|
66
76
|
return json;
|
|
67
77
|
}
|
|
68
78
|
}
|
package/dist/OAuth2.d.ts
CHANGED
|
@@ -27,13 +27,13 @@ export declare const client: () => import("./Client.js").Client<import("oauth2-c
|
|
|
27
27
|
*
|
|
28
28
|
* @see {@link OAuth2Plugin.request}
|
|
29
29
|
*/
|
|
30
|
-
export declare const request: (url: import("requestish/dist/URL.js").ish, method?: string | undefined, body?: import("
|
|
30
|
+
export declare const request: (url: import("requestish/dist/URL.js").ish, method?: string | undefined, body?: import("requestish/dist/Body.js").ish, headers?: import("requestish/dist/Headers.js").ish | undefined, dPoPOptions?: import("openid-client").DPoPOptions | undefined) => Promise<Response>;
|
|
31
31
|
/**
|
|
32
32
|
* Convenience method
|
|
33
33
|
*
|
|
34
34
|
* @see {@link OAuth2Plugin.requestJSON}
|
|
35
35
|
*/
|
|
36
|
-
export declare const requestJSON: <T extends import("@battis/typescript-tricks").JSONValue>(url: import("requestish/dist/URL.js").ish, method?: string | undefined, body?: import("
|
|
36
|
+
export declare const requestJSON: <T extends import("@battis/typescript-tricks").JSONValue>(url: import("requestish/dist/URL.js").ish, method?: string | undefined, body?: import("requestish/dist/Body.js").ish, headers?: import("requestish/dist/Headers.js").ish | undefined, dPoPOptions?: import("openid-client").DPoPOptions | undefined) => Promise<T>;
|
|
37
37
|
/**
|
|
38
38
|
* Convenience method
|
|
39
39
|
*
|
package/extendable/Client.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { JSONValue } from '@battis/typescript-tricks';
|
|
|
2
2
|
import { Request } from 'express';
|
|
3
3
|
import * as OAuth2CLI from 'oauth2-cli';
|
|
4
4
|
import type * as OpenIDClient from 'openid-client';
|
|
5
|
-
import
|
|
5
|
+
import { Body, Headers, URL } from 'requestish';
|
|
6
6
|
/**
|
|
7
7
|
* Wrap {@link https://www.npmjs.com/package/openid-client openid-client} in a
|
|
8
8
|
* class instance specific to a particular OAuth/OpenID server credential-set,
|
|
@@ -19,6 +19,6 @@ export declare class Client<C extends OAuth2CLI.Credentials = OAuth2CLI.Credenti
|
|
|
19
19
|
handleAuthorizationCodeRedirect(request: Request, session: OAuth2CLI.Localhost.Server): Promise<OAuth2CLI.Token.Response>;
|
|
20
20
|
protected refreshTokenGrant({ refresh_token, inject }?: Parameters<OAuth2CLI.Client['refreshTokenGrant']>[0]): Promise<OAuth2CLI.Token.Response | undefined>;
|
|
21
21
|
protected save(response: OAuth2CLI.Token.Response): Promise<OAuth2CLI.Token.Response>;
|
|
22
|
-
request(url:
|
|
23
|
-
requestJSON<J extends JSONValue = JSONValue>(url:
|
|
22
|
+
request(url: URL.ish, method?: string, body?: Body.ish, headers?: Headers.ish, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<Response>;
|
|
23
|
+
requestJSON<J extends JSONValue = JSONValue>(url: URL.ish, method?: string, body?: Body.ish, headers?: Headers.ish, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<J>;
|
|
24
24
|
}
|
package/extendable/Client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Colors } from '@qui-cli/colors';
|
|
1
2
|
import { Log } from '@qui-cli/log';
|
|
2
3
|
import * as OAuth2CLI from 'oauth2-cli';
|
|
3
4
|
/**
|
|
@@ -52,17 +53,26 @@ export class Client extends OAuth2CLI.Client {
|
|
|
52
53
|
Log.debug(`Persisting ${this.name} refresh token (if present and storage configured):\n${Log.syntaxColor(response)}`);
|
|
53
54
|
return await super.save(response);
|
|
54
55
|
}
|
|
55
|
-
async request(url, method, body, headers, dPoPOptions) {
|
|
56
|
-
Log.debug(`Sending request to ${this.name}
|
|
56
|
+
async request(url, method = 'GET', body, headers = {}, dPoPOptions) {
|
|
57
|
+
Log.debug(`Sending request to ${this.name}:\n${Log.syntaxColor({
|
|
57
58
|
request: { method, url, headers, body, dPoPOptions }
|
|
58
|
-
});
|
|
59
|
+
})}`);
|
|
59
60
|
const response = await super.request(url, method, body, headers, dPoPOptions);
|
|
60
|
-
Log.debug(`Received response from ${this.name}:\n${Log.syntaxColor(
|
|
61
|
+
Log.debug(`Received response from ${this.name}:\n${Log.syntaxColor({
|
|
62
|
+
ok: response.ok,
|
|
63
|
+
status: response.status,
|
|
64
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
65
|
+
body: response.body ? '<not yet parsed>' : null
|
|
66
|
+
})}`);
|
|
61
67
|
return response;
|
|
62
68
|
}
|
|
63
|
-
async requestJSON(url, method, body, headers, dPoPOptions) {
|
|
69
|
+
async requestJSON(url, method = 'GET', body, headers = {}, dPoPOptions) {
|
|
64
70
|
const json = await super.requestJSON(url, method, body, headers, dPoPOptions);
|
|
65
|
-
Log.debug(`Parsed JSON from ${this.name} response:\n${
|
|
71
|
+
Log.debug(`Parsed JSON from ${this.name} response:\n${typeof json === 'object' && json
|
|
72
|
+
? Log.syntaxColor(json)
|
|
73
|
+
: typeof json === 'string'
|
|
74
|
+
? Colors.quotedValue(`"${json}"`)
|
|
75
|
+
: Colors.value(json)}`);
|
|
66
76
|
return json;
|
|
67
77
|
}
|
|
68
78
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oauth2-cli/qui-cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "@qui-cli/plugin wrapper for oauth2-cli",
|
|
5
5
|
"homepage": "https://github.com/battis/oauth2-cli/tree/main/packages/qui-cli#readme",
|
|
6
6
|
"repository": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"types": "./dist/index.d.ts",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@qui-cli/colors": "^3.2.3",
|
|
20
|
-
"oauth2-cli": "1.0.
|
|
20
|
+
"oauth2-cli": "1.0.3",
|
|
21
21
|
"requestish": "0.1.3"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|