@oauth2-cli/sky-api 0.1.0 → 0.1.2

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.
@@ -0,0 +1,5 @@
1
+ {
2
+ "path": ".",
3
+ "tag-prefix": "sky-api/",
4
+ "releaseCommitMessageFormat": "chore(sky-api): @oauth2-cli/sky-api@{{currentTag}}"
5
+ }
package/CHANGELOG.md CHANGED
@@ -1,4 +1,22 @@
1
- # @oauth2-cli/sky-api
1
+ # Changelog
2
+
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
+
5
+ ## [0.1.2](https://github.com/battis/oauth2-cli/compare/sky-api/0.1.1...sky-api/0.1.2) (2025-03-08)
6
+
7
+ ### Features
8
+
9
+ - **oauth2-cli:** export Credentials type for convenience ([f000b56](https://github.com/battis/oauth2-cli/commit/f000b56a587c021d64a294ff33d42fa3966afd38))
10
+
11
+ ### Bug Fixes
12
+
13
+ - **sky-api:** update from deprecated TokenManager to Client ([3685ede](https://github.com/battis/oauth2-cli/commit/3685edeacd7d5d2b05e4259dcd6f2ae15babb74a))
14
+
15
+ ## [0.1.1](https://github.com/battis/oauth2-cli/compare/sky-api/0.1.0...sky-api/0.1.1) (2025-03-06)
16
+
17
+ ### Patch Changes
18
+
19
+ - efd09f9: docs: fix broken package paths
2
20
 
3
21
  ## 0.1.0
4
22
 
package/dist/index.d.ts CHANGED
@@ -1,17 +1,13 @@
1
1
  import { RequestInfo, RequestInit } from 'node-fetch';
2
- import * as oauth from 'oauth2-cli';
3
- export type SkyAPICredentials = {
4
- client_id: string;
5
- client_secret: string;
2
+ import * as OAuth2 from 'oauth2-cli';
3
+ export type Credentials = Omit<OAuth2.Credentials, 'authorization_endpoint' | 'token_endpoint'> & {
6
4
  subscription_key: string;
7
- redirect_uri: string;
8
- store?: oauth.TokenStorage | string;
9
5
  };
10
6
  export declare class SkyAPI {
11
- private tokenManager;
7
+ private client;
12
8
  private token?;
13
9
  private subscription_key;
14
- constructor(credentials: SkyAPICredentials);
15
- getToken(): Promise<oauth.Token | undefined>;
10
+ constructor(credentials: Credentials);
11
+ getToken(): Promise<OAuth2.Token | undefined>;
16
12
  fetch(endpoint: URL | RequestInfo, init?: RequestInit): Promise<unknown>;
17
13
  }
package/dist/index.js CHANGED
@@ -1,25 +1,22 @@
1
1
  // TODO replace node-fetch dependency with native fetch when bumping to node@>=21
2
2
  import nodeFetch from 'node-fetch';
3
- import * as oauth from 'oauth2-cli';
3
+ import * as OAuth2 from 'oauth2-cli';
4
4
  const SUBSCRIPTION_HEADER = 'Bb-Api-Subscription-Key';
5
5
  export class SkyAPI {
6
- tokenManager;
6
+ client;
7
7
  token;
8
8
  subscription_key;
9
9
  constructor(credentials) {
10
- this.tokenManager = new oauth.TokenManager({
11
- client_id: credentials.client_id,
12
- client_secret: credentials.client_secret,
13
- redirect_uri: credentials.redirect_uri,
10
+ this.client = new OAuth2.Client({
11
+ ...credentials,
14
12
  authorization_endpoint: 'https://app.blackbaud.com/oauth/authorize',
15
13
  token_endpoint: 'https://oauth2.sky.blackbaud.com/token',
16
- headers: { [SUBSCRIPTION_HEADER]: credentials.subscription_key },
17
- store: credentials.store
14
+ headers: { [SUBSCRIPTION_HEADER]: credentials.subscription_key }
18
15
  });
19
16
  this.subscription_key = credentials.subscription_key;
20
17
  }
21
18
  async getToken() {
22
- this.token = await this.tokenManager.getToken();
19
+ this.token = await this.client.getToken();
23
20
  return this.token;
24
21
  }
25
22
  async fetch(endpoint, init) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oauth2-cli/sky-api",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "keywords": [
5
5
  "blackbaud",
6
6
  "sky",
@@ -8,10 +8,10 @@
8
8
  "oauth",
9
9
  "cli"
10
10
  ],
11
- "homepage": "https://github.com/battis/oauth-cli/tree/main/packages/sky-api#readme",
11
+ "homepage": "https://github.com/battis/oauth2-cli/tree/main/packages/sky-api#readme",
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "git+https://github.com/battis/oauth-cli.git",
14
+ "url": "git+https://github.com/battis/oauth2-cli.git",
15
15
  "directory": "packages/sky-api"
16
16
  },
17
17
  "author": {
@@ -23,18 +23,20 @@
23
23
  "types": "./dist/index.d.ts",
24
24
  "dependencies": {
25
25
  "node-fetch": "^3.3.2",
26
- "oauth2-cli": "0.1.2"
26
+ "oauth2-cli": "0.1.6"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@tsconfig/node20": "^20.1.4",
30
+ "commit-and-tag-version": "^12.5.0",
30
31
  "del-cli": "^6.0.0",
31
32
  "npm-run-all": "^4.1.5",
32
- "typescript": "^5.7.2"
33
+ "typescript": "^5.8.2"
33
34
  },
34
35
  "scripts": {
35
36
  "clean": "del ./dist",
36
37
  "build": "run-s build:*",
37
38
  "build:clean": "run-s clean",
38
- "build:compile": "tsc"
39
+ "build:compile": "tsc",
40
+ "release": "commit-and-tag-version"
39
41
  }
40
42
  }
package/src/index.ts CHANGED
@@ -1,37 +1,33 @@
1
1
  // TODO replace node-fetch dependency with native fetch when bumping to node@>=21
2
2
  import nodeFetch, { RequestInfo, RequestInit } from 'node-fetch';
3
- import * as oauth from 'oauth2-cli';
3
+ import * as OAuth2 from 'oauth2-cli';
4
4
 
5
- export type SkyAPICredentials = {
6
- client_id: string;
7
- client_secret: string;
5
+ export type Credentials = Omit<
6
+ OAuth2.Credentials,
7
+ 'authorization_endpoint' | 'token_endpoint'
8
+ > & {
8
9
  subscription_key: string;
9
- redirect_uri: string;
10
- store?: oauth.TokenStorage | string;
11
10
  };
12
11
 
13
12
  const SUBSCRIPTION_HEADER = 'Bb-Api-Subscription-Key';
14
13
 
15
14
  export class SkyAPI {
16
- private tokenManager: oauth.TokenManager;
17
- private token?: oauth.Token;
15
+ private client: OAuth2.Client;
16
+ private token?: OAuth2.Token;
18
17
  private subscription_key: string;
19
18
 
20
- public constructor(credentials: SkyAPICredentials) {
21
- this.tokenManager = new oauth.TokenManager({
22
- client_id: credentials.client_id,
23
- client_secret: credentials.client_secret,
24
- redirect_uri: credentials.redirect_uri,
19
+ public constructor(credentials: Credentials) {
20
+ this.client = new OAuth2.Client({
21
+ ...credentials,
25
22
  authorization_endpoint: 'https://app.blackbaud.com/oauth/authorize',
26
23
  token_endpoint: 'https://oauth2.sky.blackbaud.com/token',
27
- headers: { [SUBSCRIPTION_HEADER]: credentials.subscription_key },
28
- store: credentials.store
24
+ headers: { [SUBSCRIPTION_HEADER]: credentials.subscription_key }
29
25
  });
30
26
  this.subscription_key = credentials.subscription_key;
31
27
  }
32
28
 
33
29
  public async getToken() {
34
- this.token = await this.tokenManager.getToken();
30
+ this.token = await this.client.getToken();
35
31
  return this.token;
36
32
  }
37
33