oauth2-cli 0.1.4 → 0.1.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,20 @@
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.1.6](https://github.com/battis/oauth2-cli/compare/oauth2-cli/0.1.5...oauth2-cli/0.1.6) (2025-03-08)
6
+
7
+
8
+ ### Features
9
+
10
+ * **oauth2-cli:** export Credentials type for convenience ([f000b56](https://github.com/battis/oauth2-cli/commit/f000b56a587c021d64a294ff33d42fa3966afd38))
11
+
12
+ ## [0.1.5](https://github.com/battis/oauth2-cli/compare/oauth2-cli/0.1.4...oauth2-cli/0.1.5) (2025-03-07)
13
+
14
+
15
+ ### Features
16
+
17
+ * **oauth2-cli:** attempt to reuse refresh_token if none returned ([8210698](https://github.com/battis/oauth2-cli/commit/82106982e508c1f5f54a16590594daa47f80d57d))
18
+
5
19
  ## [0.1.4](https://github.com/battis/oauth2-cli/compare/oauth2-cli/0.1.3...oauth2-cli/0.1.4) (2025-03-06)
6
20
 
7
21
 
package/dist/Client.js CHANGED
@@ -41,7 +41,7 @@ export class Client {
41
41
  let freshTokens;
42
42
  if ((freshTokens = Token.fromResponse(await OpenIDClient.refreshTokenGrant(await Configuration.acquire(this.options), token.refresh_token, parameters,
43
43
  // @ts-expect-error 2322 undocumented arg pass-through to oauth4webapi
44
- { headers })))) {
44
+ { headers }), token.refresh_token))) {
45
45
  return this.store?.save(freshTokens) || freshTokens;
46
46
  }
47
47
  }
package/dist/Token.d.ts CHANGED
@@ -12,7 +12,7 @@ export declare class Token implements TokenResponse {
12
12
  readonly id_token?: string;
13
13
  readonly expires_in?: number;
14
14
  private constructor();
15
- static fromResponse(response?: OpenIDClient.TokenEndpointResponse): Token | undefined;
15
+ static fromResponse(response?: OpenIDClient.TokenEndpointResponse, refresh_token?: string): Token | undefined;
16
16
  hasExpired(): boolean;
17
17
  }
18
18
  export {};
package/dist/Token.js CHANGED
@@ -13,9 +13,9 @@ export class Token {
13
13
  this.timestamp = response.timestamp;
14
14
  Object.assign(this, response);
15
15
  }
16
- static fromResponse(response) {
16
+ static fromResponse(response, refresh_token) {
17
17
  if (response) {
18
- return new Token({ timestamp: Date.now(), ...response });
18
+ return new Token({ refresh_token, timestamp: Date.now(), ...response });
19
19
  }
20
20
  return undefined;
21
21
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Client } from './Client.js';
2
- export { Client } from './Client.js';
2
+ export { Client, Options as Credentials } from './Client.js';
3
3
  export { FileStorage } from './FileStorage.js';
4
4
  export { Token } from './Token.js';
5
5
  export { TokenStorage } from './TokenStorage.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oauth2-cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
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/src/Client.ts CHANGED
@@ -58,7 +58,8 @@ export class Client {
58
58
  parameters,
59
59
  // @ts-expect-error 2322 undocumented arg pass-through to oauth4webapi
60
60
  { headers }
61
- )
61
+ ),
62
+ token.refresh_token
62
63
  ))
63
64
  ) {
64
65
  return this.store?.save(freshTokens) || freshTokens;
package/src/Token.ts CHANGED
@@ -21,9 +21,12 @@ export class Token implements TokenResponse {
21
21
  Object.assign(this, response);
22
22
  }
23
23
 
24
- public static fromResponse(response?: OpenIDClient.TokenEndpointResponse) {
24
+ public static fromResponse(
25
+ response?: OpenIDClient.TokenEndpointResponse,
26
+ refresh_token?: string
27
+ ) {
25
28
  if (response) {
26
- return new Token({ timestamp: Date.now(), ...response });
29
+ return new Token({ refresh_token, timestamp: Date.now(), ...response });
27
30
  }
28
31
  return undefined;
29
32
  }
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Client } from './Client.js';
2
2
 
3
- export { Client } from './Client.js';
3
+ export { Client, Options as Credentials } from './Client.js';
4
4
  export { FileStorage } from './FileStorage.js';
5
5
  export { Token } from './Token.js';
6
6
  export { TokenStorage } from './TokenStorage.js';