@oauth2-cli/qui-cli 1.2.5 → 1.2.6

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 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
+ ## [1.2.6](https://github.com/battis/oauth2-cli/compare/qui-cli-plugin/1.2.5...qui-cli-plugin/1.2.6) (2026-03-08)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * improve request logging ([334b9db](https://github.com/battis/oauth2-cli/commit/334b9db7cdfd992887b8c66396b477824b729f28))
11
+
5
12
  ## [1.2.5](https://github.com/battis/oauth2-cli/compare/qui-cli-plugin/1.2.4...qui-cli-plugin/1.2.5) (2026-03-07)
6
13
 
7
14
  Bump to requestish@0.1.10
package/dist/Client.d.ts CHANGED
@@ -18,8 +18,7 @@ export declare class Client<C extends OAuth2CLI.Credentials = OAuth2CLI.Credenti
18
18
  authorize(): Promise<OAuth2CLI.Token.Response>;
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
- protected save(response: OAuth2CLI.Token.Response): Promise<OAuth2CLI.Token.Response>;
22
- protected prepareRequest(config: OpenIDClient.Configuration, accessToken: string, url: URL, method: string, body?: OpenIDClient.FetchBody, headers?: Headers | undefined, options?: OpenIDClient.DPoPOptions | undefined): Promise<Parameters<(typeof OpenIDClient)['fetchProtectedResource']>>;
23
- request(url: URL.ish, method?: string, body?: Body.ish, headers?: Headers.ish, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<Response>;
21
+ protected prepareRequest(config: OpenIDClient.Configuration, accessToken: string, url: URL, method: string, body?: OpenIDClient.FetchBody, headers?: Headers | undefined, options?: OpenIDClient.DPoPOptions | undefined): Promise<OAuth2CLI.PreparedRequest>;
22
+ protected prepareResponse(response: Response): Promise<Response>;
24
23
  requestJSON<J extends JSONValue = JSONValue>(url: URL.ish, method?: string, body?: Body.ish, headers?: Headers.ish, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<J>;
25
24
  }
package/dist/Client.js CHANGED
@@ -13,60 +13,48 @@ import * as OAuth2CLI from 'oauth2-cli';
13
13
  */
14
14
  export class Client extends OAuth2CLI.Client {
15
15
  async getConfiguration() {
16
- const creating = !this.config;
16
+ const uninitialized = !this.config;
17
17
  const config = await super.getConfiguration();
18
- if (creating) {
19
- Log.debug(`${this.name} OAuth 2.0 configuration created`, {
18
+ if (uninitialized) {
19
+ Log.debug(`${this.name} OAuth 2.0 configuration initialized: ${Log.syntaxColor({
20
20
  credentials: this.credentials,
21
21
  config: {
22
22
  serverMetadata: config.serverMetadata(),
23
23
  clientMetadata: config.clientMetadata()
24
24
  }
25
- });
25
+ })}`);
26
26
  }
27
27
  return config;
28
28
  }
29
29
  async authorize() {
30
30
  Log.debug(`Authorizing ${this.name} new access token`);
31
31
  const response = await super.authorize();
32
- Log.debug(`Authorized ${this.name} new access token:\n${Log.syntaxColor(response)}`);
32
+ Log.debug(`Authorized ${this.name} new access token: ${Log.syntaxColor(response)}`);
33
33
  return response;
34
34
  }
35
35
  async handleAuthorizationCodeRedirect(request, session) {
36
- Log.debug(`Handling ${this.name} authorization code redirect:\n${Log.syntaxColor(request)}`);
36
+ Log.debug(`Handling ${this.name} authorization code redirect: ${Log.syntaxColor(request)}`);
37
37
  const response = await super.handleAuthorizationCodeRedirect(request, session);
38
- Log.debug(`Received ${this.name} authorization code response:\n${Log.syntaxColor(response)}`);
38
+ Log.debug(`Received ${this.name} authorization code response: ${Log.syntaxColor(response)}`);
39
39
  return response;
40
40
  }
41
41
  async refreshTokenGrant({ refresh_token, inject } = {}) {
42
- Log.debug(`Attempting to refresh ${this.name} access token:\n${Log.syntaxColor({ refresh_token, inject })}`);
42
+ Log.debug(`Attempting to refresh ${this.name} access token: ${Log.syntaxColor({ refresh_token, inject })}`);
43
43
  const refreshed = await super.refreshTokenGrant({ refresh_token, inject });
44
44
  if (refreshed) {
45
- Log.debug(`Received refreshed ${this.name} access token:\n${Log.syntaxColor(refreshed)}`);
45
+ Log.debug(`Received refreshed ${this.name} access token: ${Log.syntaxColor(refreshed)}`);
46
46
  }
47
47
  else {
48
48
  Log.debug(`${this.name} token refresh failed`);
49
49
  }
50
50
  return refreshed;
51
51
  }
52
- async save(response) {
53
- Log.debug(`Persisting ${this.name} refresh token (if present and storage configured):\n${Log.syntaxColor(response)}`);
54
- return await super.save(response);
55
- }
56
52
  async prepareRequest(config, accessToken, url, method, body, headers, options) {
57
- Log.debug(`Prepared request to ${this.name}:\n${Log.syntaxColor({ method, url, headers: Object.fromEntries(headers?.entries() || []), body })}`);
53
+ Log.debug(`Sending request to ${this.name}: ${Log.syntaxColor({ method, url, headers: Object.fromEntries(headers?.entries() || []), body: `${body}` })}`);
58
54
  return [config, accessToken, url, method, body, headers, options];
59
55
  }
60
- async request(url, method = 'GET', body, headers = {}, dPoPOptions) {
61
- Log.debug(`Sending request to ${this.name}:\n${Log.syntaxColor({
62
- request: {
63
- method,
64
- url,
65
- dPoPOptions
66
- }
67
- })}${body || headers ? ` injecting: ${Log.syntaxColor({ headers, body })}` : ''}`);
68
- const response = await super.request(url, method, body, headers, dPoPOptions);
69
- Log.debug(`Received response from ${this.name}:\n${Log.syntaxColor({
56
+ async prepareResponse(response) {
57
+ Log.debug(`Received response from ${this.name}: ${Log.syntaxColor({
70
58
  ok: response.ok,
71
59
  status: response.status,
72
60
  headers: Object.fromEntries(response.headers.entries()),
@@ -76,7 +64,7 @@ export class Client extends OAuth2CLI.Client {
76
64
  }
77
65
  async requestJSON(url, method = 'GET', body, headers = {}, dPoPOptions) {
78
66
  const json = await super.requestJSON(url, method, body, headers, dPoPOptions);
79
- Log.debug(`Parsed JSON from ${this.name} response:\n${typeof json === 'object' && json
67
+ Log.debug(`JSON body from ${this.name}: ${typeof json === 'object' && json
80
68
  ? Log.syntaxColor(json)
81
69
  : typeof json === 'string'
82
70
  ? Colors.quotedValue(`"${json}"`)
@@ -18,8 +18,7 @@ export declare class Client<C extends OAuth2CLI.Credentials = OAuth2CLI.Credenti
18
18
  authorize(): Promise<OAuth2CLI.Token.Response>;
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
- protected save(response: OAuth2CLI.Token.Response): Promise<OAuth2CLI.Token.Response>;
22
- protected prepareRequest(config: OpenIDClient.Configuration, accessToken: string, url: URL, method: string, body?: OpenIDClient.FetchBody, headers?: Headers | undefined, options?: OpenIDClient.DPoPOptions | undefined): Promise<Parameters<(typeof OpenIDClient)['fetchProtectedResource']>>;
23
- request(url: URL.ish, method?: string, body?: Body.ish, headers?: Headers.ish, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<Response>;
21
+ protected prepareRequest(config: OpenIDClient.Configuration, accessToken: string, url: URL, method: string, body?: OpenIDClient.FetchBody, headers?: Headers | undefined, options?: OpenIDClient.DPoPOptions | undefined): Promise<OAuth2CLI.PreparedRequest>;
22
+ protected prepareResponse(response: Response): Promise<Response>;
24
23
  requestJSON<J extends JSONValue = JSONValue>(url: URL.ish, method?: string, body?: Body.ish, headers?: Headers.ish, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<J>;
25
24
  }
@@ -13,60 +13,48 @@ import * as OAuth2CLI from 'oauth2-cli';
13
13
  */
14
14
  export class Client extends OAuth2CLI.Client {
15
15
  async getConfiguration() {
16
- const creating = !this.config;
16
+ const uninitialized = !this.config;
17
17
  const config = await super.getConfiguration();
18
- if (creating) {
19
- Log.debug(`${this.name} OAuth 2.0 configuration created`, {
18
+ if (uninitialized) {
19
+ Log.debug(`${this.name} OAuth 2.0 configuration initialized: ${Log.syntaxColor({
20
20
  credentials: this.credentials,
21
21
  config: {
22
22
  serverMetadata: config.serverMetadata(),
23
23
  clientMetadata: config.clientMetadata()
24
24
  }
25
- });
25
+ })}`);
26
26
  }
27
27
  return config;
28
28
  }
29
29
  async authorize() {
30
30
  Log.debug(`Authorizing ${this.name} new access token`);
31
31
  const response = await super.authorize();
32
- Log.debug(`Authorized ${this.name} new access token:\n${Log.syntaxColor(response)}`);
32
+ Log.debug(`Authorized ${this.name} new access token: ${Log.syntaxColor(response)}`);
33
33
  return response;
34
34
  }
35
35
  async handleAuthorizationCodeRedirect(request, session) {
36
- Log.debug(`Handling ${this.name} authorization code redirect:\n${Log.syntaxColor(request)}`);
36
+ Log.debug(`Handling ${this.name} authorization code redirect: ${Log.syntaxColor(request)}`);
37
37
  const response = await super.handleAuthorizationCodeRedirect(request, session);
38
- Log.debug(`Received ${this.name} authorization code response:\n${Log.syntaxColor(response)}`);
38
+ Log.debug(`Received ${this.name} authorization code response: ${Log.syntaxColor(response)}`);
39
39
  return response;
40
40
  }
41
41
  async refreshTokenGrant({ refresh_token, inject } = {}) {
42
- Log.debug(`Attempting to refresh ${this.name} access token:\n${Log.syntaxColor({ refresh_token, inject })}`);
42
+ Log.debug(`Attempting to refresh ${this.name} access token: ${Log.syntaxColor({ refresh_token, inject })}`);
43
43
  const refreshed = await super.refreshTokenGrant({ refresh_token, inject });
44
44
  if (refreshed) {
45
- Log.debug(`Received refreshed ${this.name} access token:\n${Log.syntaxColor(refreshed)}`);
45
+ Log.debug(`Received refreshed ${this.name} access token: ${Log.syntaxColor(refreshed)}`);
46
46
  }
47
47
  else {
48
48
  Log.debug(`${this.name} token refresh failed`);
49
49
  }
50
50
  return refreshed;
51
51
  }
52
- async save(response) {
53
- Log.debug(`Persisting ${this.name} refresh token (if present and storage configured):\n${Log.syntaxColor(response)}`);
54
- return await super.save(response);
55
- }
56
52
  async prepareRequest(config, accessToken, url, method, body, headers, options) {
57
- Log.debug(`Prepared request to ${this.name}:\n${Log.syntaxColor({ method, url, headers: Object.fromEntries(headers?.entries() || []), body })}`);
53
+ Log.debug(`Sending request to ${this.name}: ${Log.syntaxColor({ method, url, headers: Object.fromEntries(headers?.entries() || []), body: `${body}` })}`);
58
54
  return [config, accessToken, url, method, body, headers, options];
59
55
  }
60
- async request(url, method = 'GET', body, headers = {}, dPoPOptions) {
61
- Log.debug(`Sending request to ${this.name}:\n${Log.syntaxColor({
62
- request: {
63
- method,
64
- url,
65
- dPoPOptions
66
- }
67
- })}${body || headers ? ` injecting: ${Log.syntaxColor({ headers, body })}` : ''}`);
68
- const response = await super.request(url, method, body, headers, dPoPOptions);
69
- Log.debug(`Received response from ${this.name}:\n${Log.syntaxColor({
56
+ async prepareResponse(response) {
57
+ Log.debug(`Received response from ${this.name}: ${Log.syntaxColor({
70
58
  ok: response.ok,
71
59
  status: response.status,
72
60
  headers: Object.fromEntries(response.headers.entries()),
@@ -76,7 +64,7 @@ export class Client extends OAuth2CLI.Client {
76
64
  }
77
65
  async requestJSON(url, method = 'GET', body, headers = {}, dPoPOptions) {
78
66
  const json = await super.requestJSON(url, method, body, headers, dPoPOptions);
79
- Log.debug(`Parsed JSON from ${this.name} response:\n${typeof json === 'object' && json
67
+ Log.debug(`JSON body from ${this.name}: ${typeof json === 'object' && json
80
68
  ? Log.syntaxColor(json)
81
69
  : typeof json === 'string'
82
70
  ? Colors.quotedValue(`"${json}"`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oauth2-cli/qui-cli",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
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": {
@@ -23,9 +23,6 @@
23
23
  "devDependencies": {
24
24
  "@battis/descriptive-types": "^0.2.6",
25
25
  "@battis/typescript-tricks": "^0.8.0",
26
- "@qui-cli/env": "^5.1.1",
27
- "@qui-cli/log": "^4.0.3",
28
- "@qui-cli/plugin": "^4.1.0",
29
26
  "@tsconfig/node24": "^24.0.4",
30
27
  "commit-and-tag-version": "^12.6.1",
31
28
  "cpy-cli": "^7.0.0",