@oauth2-cli/qui-cli 0.5.1 → 0.5.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 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
+ ## [0.5.3](https://github.com/battis/oauth2-cli/compare/qui-cli-plugin/0.5.2...qui-cli-plugin/0.5.3) (2026-01-15)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * instantiateClient() _returns_ the client ([a302fdb](https://github.com/battis/oauth2-cli/commit/a302fdba916f68756b24319d432cc6adce09a1ba))
11
+
12
+ ## [0.5.2](https://github.com/battis/oauth2-cli/compare/qui-cli-plugin/0.5.1...qui-cli-plugin/0.5.2) (2026-01-15)
13
+
14
+
15
+ ### Features
16
+
17
+ * allow injection of custom oauth2-cli Client implementations via instantiateClient() ([cb1b94f](https://github.com/battis/oauth2-cli/commit/cb1b94fb1891343f00b5793fd6f7db33e6489c14))
18
+ * re-export all of oauth2-cli under the plugin module/class namespaces ([0cbdafc](https://github.com/battis/oauth2-cli/commit/0cbdafc84853f4a904e33640b65e4f0300f00b4a))
19
+
5
20
  ## [0.5.1](https://github.com/battis/oauth2-cli/compare/qui-cli-plugin/0.5.0...qui-cli-plugin/0.5.1) (2026-01-15)
6
21
 
7
22
 
package/dist/Module.d.ts CHANGED
@@ -1,10 +1,11 @@
1
+ export * from './EnvironmentStorage.js';
1
2
  export * from './OAuth2.js';
2
3
  export declare const name: string;
3
4
  export declare const configure: (proposal?: import("./OAuth2.js").ConfigurationProposal) => void;
4
5
  export declare const options: () => import("@qui-cli/plugin").Options;
5
6
  export declare const init: ({ values }: import("@qui-cli/plugin").ExpectedArguments<typeof this.options>) => Promise<void>;
6
- export declare const getToken: () => Promise<import("oauth2-cli").Token | undefined>;
7
- export declare const getClient: () => import("oauth2-cli").Client;
7
+ export declare const getToken: () => Promise<import("oauth2-cli/dist/Token.js").Token | undefined>;
8
+ export declare const getClient: () => import("oauth2-cli/dist/Client.js").Client;
8
9
  export declare const request: (url: string | URL, method?: string | undefined, body?: import("openid-client").FetchBody, headers?: Headers | undefined, dPoPOptions?: import("openid-client").DPoPOptions | undefined) => Promise<Response>;
9
10
  export declare const requestJSON: <T extends import("@battis/typescript-tricks").JSONValue>(url: string | URL, method?: string | undefined, body?: import("openid-client").FetchBody, headers?: Headers | undefined, dPoPOptions?: import("openid-client").DPoPOptions | undefined) => Promise<T>;
10
11
  export declare const fetch: (endpoint: string | URL | Request, init?: RequestInit | undefined) => Promise<Response>;
package/dist/Module.js CHANGED
@@ -1,13 +1,14 @@
1
- import { OAuth2 } from './OAuth2.js';
1
+ import { OAuth2Plugin } from './OAuth2.js';
2
+ export * from './EnvironmentStorage.js';
2
3
  export * from './OAuth2.js';
3
- const plugin = new OAuth2();
4
- export const name = plugin.name;
5
- export const configure = plugin.configure.bind(plugin);
6
- export const options = plugin.options.bind(plugin);
7
- export const init = plugin.init.bind(plugin);
8
- export const getToken = plugin.getToken.bind(plugin);
9
- export const getClient = plugin.getClient.bind(plugin);
10
- export const request = plugin.request.bind(plugin);
11
- export const requestJSON = plugin.requestJSON.bind(plugin);
12
- export const fetch = plugin.fetch.bind(plugin);
13
- export const fetchJSON = plugin.fetchJSON.bind(plugin);
4
+ const oauth2 = new OAuth2Plugin();
5
+ export const name = oauth2.name;
6
+ export const configure = oauth2.configure.bind(oauth2);
7
+ export const options = oauth2.options.bind(oauth2);
8
+ export const init = oauth2.init.bind(oauth2);
9
+ export const getToken = oauth2.getToken.bind(oauth2);
10
+ export const getClient = oauth2.getClient.bind(oauth2);
11
+ export const request = oauth2.request.bind(oauth2);
12
+ export const requestJSON = oauth2.requestJSON.bind(oauth2);
13
+ export const fetch = oauth2.fetch.bind(oauth2);
14
+ export const fetchJSON = oauth2.fetchJSON.bind(oauth2);
package/dist/OAuth2.d.ts CHANGED
@@ -2,7 +2,7 @@ import { PathString, URLString } from '@battis/descriptive-types';
2
2
  import { JSONValue } from '@battis/typescript-tricks';
3
3
  import * as Plugin from '@qui-cli/plugin';
4
4
  import * as OAuth2CLI from 'oauth2-cli';
5
- export { Credentials } from 'oauth2-cli';
5
+ export * from 'oauth2-cli';
6
6
  type ParamNames = 'clientId' | 'clientSecret' | 'redirectUri' | 'authorizationEndpoint' | 'tokenEndpoint' | 'tokenPath' | 'accessToken';
7
7
  type EnvironmentVars = Record<ParamNames, string>;
8
8
  type SupportUrls = Record<ParamNames, URLString>;
@@ -34,7 +34,7 @@ export type ConfigurationProposal = Partial<Omit<Configuration, 'opt' | 'env' |
34
34
  env?: Partial<EnvironmentVars>;
35
35
  man?: Partial<Usage>;
36
36
  };
37
- export declare class OAuth2 {
37
+ export declare class OAuth2Plugin {
38
38
  readonly name: string;
39
39
  [key: string]: unknown;
40
40
  private static names;
@@ -45,6 +45,7 @@ export declare class OAuth2 {
45
45
  configure(proposal?: ConfigurationProposal): void;
46
46
  options(): Plugin.Options;
47
47
  init({ values }: Plugin.ExpectedArguments<typeof this.options>): Promise<void>;
48
+ protected instantiateClient(...args: ConstructorParameters<typeof OAuth2CLI.Client>): OAuth2CLI.Client;
48
49
  getClient(): OAuth2CLI.Client;
49
50
  getToken(): Promise<OAuth2CLI.Token | undefined>;
50
51
  request(...args: Parameters<OAuth2CLI.Client['request']>): Promise<Response>;
package/dist/OAuth2.js CHANGED
@@ -5,13 +5,14 @@ import { Root } from '@qui-cli/root';
5
5
  import path from 'node:path';
6
6
  import * as OAuth2CLI from 'oauth2-cli';
7
7
  import { EnvironmentStorage } from './EnvironmentStorage.js';
8
- export class OAuth2 {
8
+ export * from 'oauth2-cli';
9
+ export class OAuth2Plugin {
9
10
  name;
10
11
  static names = [];
11
12
  static ports = {};
12
13
  constructor(name = '@oauth2-cli/qui-cli') {
13
14
  this.name = name;
14
- if (OAuth2.names.includes(name)) {
15
+ if (OAuth2Plugin.names.includes(name)) {
15
16
  throw new Error(`A @qui-cli/plugin named ${Colors.value(name)} has already been instantiated.`);
16
17
  }
17
18
  }
@@ -69,9 +70,10 @@ export class OAuth2 {
69
70
  Log.warning(`The ${Colors.url(url.protocol)} protocol may not work without additional configuration. The ` +
70
71
  `server listening for the redirect will be running at ${Colors.url(`http://localhost:${url.port}`)}`);
71
72
  }
72
- if (OAuth2.ports[url.port] && OAuth2.ports[url.port] !== this.name) {
73
+ if (OAuth2Plugin.ports[url.port] &&
74
+ OAuth2Plugin.ports[url.port] !== this.name) {
73
75
  Log.warning(`The port ${Colors.value(url.port)} has already been registered to another instance of this plugin ` +
74
- `named ${Colors.value(OAuth2.ports[url.port])}. This will likely cause a failure if both instances of the ` +
76
+ `named ${Colors.value(OAuth2Plugin.ports[url.port])}. This will likely cause a failure if both instances of the ` +
75
77
  `plugin are listening for redirects at relatively proximate ` +
76
78
  `moments in time.`);
77
79
  }
@@ -139,6 +141,9 @@ export class OAuth2 {
139
141
  }
140
142
  this.configure(proposal);
141
143
  }
144
+ instantiateClient(...args) {
145
+ return new OAuth2CLI.Client(...args);
146
+ }
142
147
  getClient() {
143
148
  if (!this.client) {
144
149
  const { clientId: client_id, clientSecret: client_secret, redirectUri: redirect_uri, authorizationEndpoint: authorization_endpoint, tokenEndpoint: token_endpoint, headers, store } = this.cliConfig;
@@ -154,7 +159,7 @@ export class OAuth2 {
154
159
  if (!authorization_endpoint) {
155
160
  throw new Error('OAuth 2.0 authorization endpoint not defined');
156
161
  }
157
- this.client = new OAuth2CLI.Client({
162
+ this.client = this.instantiateClient({
158
163
  client_id,
159
164
  client_secret,
160
165
  redirect_uri,
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  import * as OAuth2 from './Module.js';
2
- export * from './EnvironmentStorage.js';
3
2
  export { OAuth2 };
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { register } from '@qui-cli/plugin';
2
2
  import * as OAuth2 from './Module.js';
3
- export * from './EnvironmentStorage.js';
4
3
  export { OAuth2 };
5
4
  await register(OAuth2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oauth2-cli/qui-cli",
3
- "version": "0.5.1",
3
+ "version": "0.5.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": {