oauth2-cli 1.0.2 → 1.1.0

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,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.0](https://github.com/battis/oauth2-cli/compare/oauth2-cli/1.0.3...oauth2-cli/1.1.0) (2026-03-05)
6
+
7
+
8
+ ### Features
9
+
10
+ * added prepareRequest hook ([3deaaaa](https://github.com/battis/oauth2-cli/commit/3deaaaa1ec8939b507953f436f0cd500f01736e8))
11
+ * make URLSearchParams even more 'ish', accepting all JSON primitives ([b1c2a25](https://github.com/battis/oauth2-cli/commit/b1c2a25c29267c070070f7cd304bb31f854485e4))
12
+
13
+ ## [1.0.3](https://github.com/battis/oauth2-cli/compare/oauth2-cli/1.0.2...oauth2-cli/1.0.3) (2026-03-04)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * allow requestish.Body.ish request bodies as intended ([f12a2ce](https://github.com/battis/oauth2-cli/commit/f12a2ceb1c517f6fd90b33c8c71da7f987af640d))
19
+
5
20
  ## [1.0.2](https://github.com/battis/oauth2-cli/compare/oauth2-cli/1.0.1...oauth2-cli/1.0.2) (2026-03-03)
6
21
 
7
22
 
package/README.md CHANGED
@@ -80,7 +80,7 @@ class Client {
80
80
  public async request(
81
81
  url: requestish.URL.ish,
82
82
  method = 'GET',
83
- body?: OpenIDClient.FetchBody,
83
+ body?: requestish.Body.ish,
84
84
  headers: requestish.Headers.ish = {},
85
85
  dPoPOptions?: OpenIDClient.DPoPOptions
86
86
  ) {
@@ -108,7 +108,7 @@ class Client {
108
108
  >(
109
109
  url: requestish.URL.ish,
110
110
  method = 'GET',
111
- body?: OpenIDClient.FetchBody,
111
+ body?: requestish.Body.ish,
112
112
  headers: requestish.Headers.ish = {},
113
113
  dPoPOptions?: OpenIDClient.DPoPOptions
114
114
  ) {
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 { EventEmitter } from 'node:events';
4
4
  import * as OpenIDClient from 'openid-client';
5
- import { Headers, URL } from 'requestish';
5
+ import { Body, Headers, URL } from 'requestish';
6
6
  import { Credentials } from './Credentials.js';
7
7
  import { Injection } from './Injection.js';
8
8
  import * as Localhost from './Localhost/index.js';
@@ -114,17 +114,17 @@ export declare class Client<C extends Credentials = Credentials> extends EventEm
114
114
  * paths relative to the `issuer` URL as well as absolute URLs
115
115
  * @param method Optional, defaults to `GET` unless otherwise specified
116
116
  * @param body Optional
117
- * @param headers Optional
118
117
  * @param dPoPOptions Optional, see {@link OpenIDClient.DPoPOptions}
119
118
  */
120
- request(url: URL.ish, method?: string, body?: OpenIDClient.FetchBody, headers?: Headers.ish, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<Response>;
119
+ request(url: URL.ish, method?: string, body?: Body.ish, headers?: Headers.ish, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<Response>;
120
+ protected prepareRequest(...args: Parameters<(typeof OpenIDClient)['fetchProtectedResource']>): Promise<Parameters<(typeof OpenIDClient)['fetchProtectedResource']>>;
121
121
  /** Parse a fetch response as JSON, typing it as J */
122
122
  private toJSON;
123
123
  /**
124
124
  * Returns the result of {@link request} as a parsed JSON object, optionally
125
125
  * typed as `J`
126
126
  */
127
- requestJSON<J extends JSONValue = JSONValue>(url: URL.ish, method?: string, body?: OpenIDClient.FetchBody, headers?: Headers.ish, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<J>;
127
+ requestJSON<J extends JSONValue = JSONValue>(url: URL.ish, method?: string, body?: Body.ish, headers?: Headers.ish, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<J>;
128
128
  /**
129
129
  * Request a protected resource using the client's access token.
130
130
  *
package/dist/Client.js CHANGED
@@ -251,7 +251,6 @@ export class Client extends EventEmitter {
251
251
  * paths relative to the `issuer` URL as well as absolute URLs
252
252
  * @param method Optional, defaults to `GET` unless otherwise specified
253
253
  * @param body Optional
254
- * @param headers Optional
255
254
  * @param dPoPOptions Optional, see {@link OpenIDClient.DPoPOptions}
256
255
  */
257
256
  async request(url, method = 'GET', body, headers = {}, dPoPOptions) {
@@ -274,7 +273,7 @@ export class Client extends EventEmitter {
274
273
  });
275
274
  }
276
275
  }
277
- const request = async () => await OpenIDClient.fetchProtectedResource(await this.getConfiguration(), (await this.getToken()).access_token, URL.from(URLSearchParams.appendTo(url, this.inject?.search || {})), method, body, Headers.merge(this.inject?.headers, headers), dPoPOptions);
276
+ const request = async () => await OpenIDClient.fetchProtectedResource(...(await this.prepareRequest(await this.getConfiguration(), (await this.getToken()).access_token, URL.from(URLSearchParams.appendTo(url, this.inject?.search || {})), method, await Body.from(body), Headers.merge(this.inject?.headers, headers), dPoPOptions)));
278
277
  try {
279
278
  return await request();
280
279
  }
@@ -288,6 +287,9 @@ export class Client extends EventEmitter {
288
287
  }
289
288
  }
290
289
  }
290
+ async prepareRequest(...args) {
291
+ return args;
292
+ }
291
293
  /** Parse a fetch response as JSON, typing it as J */
292
294
  async toJSON(response) {
293
295
  if (response.ok) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oauth2-cli",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
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
- "requestish": "0.1.3",
27
- "gcrtl": "0.1.7"
26
+ "gcrtl": "0.1.7",
27
+ "requestish": "0.1.5"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@battis/descriptive-types": "^0.2.6",