oauth2-cli 0.8.0 → 0.8.1

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
+ ## [0.8.1](https://github.com/battis/oauth2-cli/compare/oauth2-cli/0.8.0...oauth2-cli/0.8.1) (2026-02-18)
6
+
7
+
8
+ ### Features
9
+
10
+ * provide parameterized credentials with simplified typing ([5a92c67](https://github.com/battis/oauth2-cli/commit/5a92c67dbd4ab52fa4f0b02a910e788f5ae67adb))
11
+
5
12
  ## [0.8.0](https://github.com/battis/oauth2-cli/compare/oauth2-cli/0.7.3...oauth2-cli/0.8.0) (2026-02-17)
6
13
 
7
14
  ### ⚠ BREAKING CHANGES
package/dist/Client.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { PathString } from '@battis/descriptive-types';
2
+ import { JSONValue } from '@battis/typescript-tricks';
2
3
  import { Request } from 'express';
3
4
  import { EventEmitter } from 'node:events';
4
5
  import * as OpenIDClient from 'openid-client';
@@ -12,9 +13,9 @@ import * as Token from './Token/index.js';
12
13
  * `redirect_uri` values
13
14
  */
14
15
  export declare const DEFAULT_REDIRECT_URI = "http://localhost:3000/oauth2-cli/redirect";
15
- export type ClientOptions = {
16
+ export type ClientOptions<C extends Credentials = Credentials> = {
16
17
  /** Credentials for server access */
17
- credentials: Credentials;
18
+ credentials: C;
18
19
  /** Optional request components to inject */
19
20
  inject?: {
20
21
  search?: requestish.URLSearchParams.ish;
@@ -63,9 +64,9 @@ type GetTokenOptions = {
63
64
  *
64
65
  * Emits {@link Client.TokenEvent} whenever a new access token is received
65
66
  */
66
- export declare class Client extends EventEmitter {
67
+ export declare class Client<C extends Credentials = Credentials> extends EventEmitter {
67
68
  static readonly TokenEvent = "token";
68
- protected credentials: Credentials;
69
+ protected credentials: C;
69
70
  protected base_url?: requestish.URL.ish;
70
71
  protected config?: OpenIDClient.Configuration;
71
72
  protected inject?: Injection;
@@ -73,7 +74,7 @@ export declare class Client extends EventEmitter {
73
74
  private token?;
74
75
  private tokenLock;
75
76
  private storage?;
76
- constructor({ credentials, base_url, views, inject, storage }: ClientOptions);
77
+ constructor({ credentials, base_url, views, inject, storage }: ClientOptions<C>);
77
78
  get redirect_uri(): requestish.URL.ish;
78
79
  /**
79
80
  * @throws IndeterminateConfiguration if provided credentials combined with
@@ -107,10 +108,10 @@ export declare class Client extends EventEmitter {
107
108
  private toJSON;
108
109
  /**
109
110
  * Returns the result of {@link request} as a parsed JSON object, optionally
110
- * typed as `T`
111
+ * typed as `J`
111
112
  */
112
- requestJSON<T extends OpenIDClient.JsonValue = OpenIDClient.JsonValue>(url: requestish.URL.ish, method?: string, body?: OpenIDClient.FetchBody, headers?: requestish.Headers.ish, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<T>;
113
+ requestJSON<J extends JSONValue = JSONValue>(url: requestish.URL.ish, method?: string, body?: OpenIDClient.FetchBody, headers?: requestish.Headers.ish, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<J>;
113
114
  fetch(input: requestish.URL.ish, init?: RequestInit, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<Response>;
114
- fetchJSON<T extends OpenIDClient.JsonValue = OpenIDClient.JsonValue>(input: requestish.URL.ish, init?: RequestInit, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<T>;
115
+ fetchJSON<J extends JSONValue = JSONValue>(input: requestish.URL.ish, init?: RequestInit, dPoPOptions?: OpenIDClient.DPoPOptions): Promise<J>;
115
116
  }
116
117
  export {};
package/dist/Client.js CHANGED
@@ -214,7 +214,7 @@ export class Client extends EventEmitter {
214
214
  }
215
215
  /**
216
216
  * Returns the result of {@link request} as a parsed JSON object, optionally
217
- * typed as `T`
217
+ * typed as `J`
218
218
  */
219
219
  async requestJSON(url, method = 'GET', body, headers = {}, dPoPOptions) {
220
220
  return await this.toJSON(await this.request(url, method, body, headers, dPoPOptions));
package/dist/index.d.ts CHANGED
@@ -1,2 +1,6 @@
1
- export * from './Export.js';
2
- export * from './Extend.js';
1
+ export * from './Client.js';
2
+ export * from './Credentials.js';
3
+ export * from './Injection.js';
4
+ export * as Scope from './Scope.js';
5
+ export * as Token from './Token/index.js';
6
+ export * from './WebServer.js';
package/dist/index.js CHANGED
@@ -1,2 +1,6 @@
1
- export * from './Export.js';
2
- export * from './Extend.js';
1
+ export * from './Client.js';
2
+ export * from './Credentials.js';
3
+ export * from './Injection.js';
4
+ export * as Scope from './Scope.js';
5
+ export * as Token from './Token/index.js';
6
+ export * from './WebServer.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oauth2-cli",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Acquire API access tokens via OAuth 2.0 within CLI tools",
5
5
  "homepage": "https://github.com/battis/oauth2-cli/tree/main/packages/oauth2-cli#readme",
6
6
  "repository": {
package/dist/Export.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from './Credentials.js';
2
- export * from './Injection.js';
3
- export * as Scope from './Scope.js';
4
- export * from './WebServer.js';
package/dist/Export.js DELETED
@@ -1,4 +0,0 @@
1
- export * from './Credentials.js';
2
- export * from './Injection.js';
3
- export * as Scope from './Scope.js';
4
- export * from './WebServer.js';
package/dist/Extend.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './Client.js';
2
- export * as Token from './Token/index.js';
package/dist/Extend.js DELETED
@@ -1,2 +0,0 @@
1
- export * from './Client.js';
2
- export * as Token from './Token/index.js';