@oauth2-cli/sky-api 0.3.2 → 0.4.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 +16 -0
- package/dist/Module.d.ts +13 -0
- package/dist/Module.js +13 -0
- package/dist/Paginated.js +1 -1
- package/dist/SkyAPI.d.ts +19 -3
- package/dist/SkyAPI.js +65 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -3
- package/dist/school/v1/academics/sections/assignments/assignmentsBySection.d.ts +1 -1
- package/dist/school/v1/academics/sections/assignments/assignmentsBySection.js +2 -2
- package/dist/school/v1/contentmanagement/announcements/index.d.ts +1 -1
- package/dist/school/v1/contentmanagement/announcements/index.js +3 -3
- package/dist/school/v1/contentmanagement/news/index.d.ts +1 -1
- package/dist/school/v1/contentmanagement/news/index.js +3 -3
- package/dist/school/v1/contentmanagement/photoalbums/index.d.ts +1 -1
- package/dist/school/v1/contentmanagement/photoalbums/index.js +4 -4
- package/package.json +5 -5
- package/dist/Client.d.ts +0 -19
- package/dist/Client.js +0 -59
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
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.4.0](https://github.com/groton-school/myschoolapp-reporting/compare/oauth2-cli/sky-api/0.3.2...oauth2-cli/sky-api/0.4.0) (2026-01-15)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* pre-registered plugin is ESM module, updated option arg names
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* compile against Node.js v24 (current active version) ([dc67440](https://github.com/groton-school/myschoolapp-reporting/commit/dc6744054bc42139c4d17b1aca2ef9b057827f7f))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* pre-registered plugin is ESM module, updated option arg names ([50ff079](https://github.com/groton-school/myschoolapp-reporting/commit/50ff079a5849ccc30c41e86d7b1d72d340fe9b87))
|
|
20
|
+
|
|
5
21
|
## [0.3.2](https://github.com/groton-school/myschoolapp-reporting/compare/oauth2-cli/sky-api/0.3.1...oauth2-cli/sky-api/0.3.2) (2026-01-04)
|
|
6
22
|
|
|
7
23
|
|
package/dist/Module.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SkyAPI } from './SkyAPI.js';
|
|
2
|
+
declare const sky: SkyAPI;
|
|
3
|
+
export declare const name: string;
|
|
4
|
+
export declare const configure: ({ subscription_key, subscriptionKeyEnvVar, ...proposal }?: import("./SkyAPI.js").ConfigurationProposal) => void;
|
|
5
|
+
export declare const options: () => import("@qui-cli/plugin").Options;
|
|
6
|
+
export declare const init: ({ values }: import("@qui-cli/plugin").ExpectedArguments<typeof this.options>) => Promise<void>;
|
|
7
|
+
export * as school from './school/index.js';
|
|
8
|
+
export declare const getToken: typeof sky.getToken;
|
|
9
|
+
export declare const getClient: typeof sky.getClient;
|
|
10
|
+
export declare const request: typeof sky.request;
|
|
11
|
+
export declare const requestJSON: typeof sky.requestJSON;
|
|
12
|
+
export declare const fetch: typeof sky.fetch;
|
|
13
|
+
export declare const fetchJSON: typeof sky.fetchJSON;
|
package/dist/Module.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SkyAPI } from './SkyAPI.js';
|
|
2
|
+
const sky = new SkyAPI();
|
|
3
|
+
export const name = sky.name;
|
|
4
|
+
export const configure = sky.configure.bind(sky);
|
|
5
|
+
export const options = sky.options.bind(sky);
|
|
6
|
+
export const init = sky.init.bind(sky);
|
|
7
|
+
export * as school from './school/index.js';
|
|
8
|
+
export const getToken = sky.getToken.bind(sky);
|
|
9
|
+
export const getClient = sky.getClient.bind(sky);
|
|
10
|
+
export const request = sky.request.bind(sky);
|
|
11
|
+
export const requestJSON = sky.requestJSON.bind(sky);
|
|
12
|
+
export const fetch = sky.fetch.bind(sky);
|
|
13
|
+
export const fetchJSON = sky.fetchJSON.bind(sky);
|
package/dist/Paginated.js
CHANGED
package/dist/SkyAPI.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as OAuth2 from '@oauth2-cli/qui-cli/dist/OAuth2.js';
|
|
2
|
+
import * as Plugin from '@qui-cli/plugin';
|
|
3
|
+
type SkyConfiguration = {
|
|
4
|
+
subscription_key?: string;
|
|
5
|
+
subscriptionKeyEnvVar: string;
|
|
6
|
+
};
|
|
7
|
+
export type Credentials = OAuth2.Credentials & {
|
|
8
|
+
subscription_key: string;
|
|
9
|
+
};
|
|
10
|
+
export type Configuration = OAuth2.Configuration & SkyConfiguration;
|
|
11
|
+
export type ConfigurationProposal = OAuth2.ConfigurationProposal & Partial<SkyConfiguration>;
|
|
12
|
+
export declare class SkyAPI extends OAuth2.OAuth2 {
|
|
13
|
+
private skyConfig;
|
|
14
|
+
constructor(name?: string);
|
|
15
|
+
configure({ subscription_key, subscriptionKeyEnvVar, ...proposal }?: ConfigurationProposal): void;
|
|
16
|
+
options(): Plugin.Options;
|
|
17
|
+
init({ values }: Plugin.ExpectedArguments<typeof this.options>): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
package/dist/SkyAPI.js
CHANGED
|
@@ -1,3 +1,65 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as OAuth2 from '@oauth2-cli/qui-cli/dist/OAuth2.js';
|
|
2
|
+
import { Colors } from '@qui-cli/colors';
|
|
3
|
+
import { Env } from '@qui-cli/env-1password';
|
|
4
|
+
export class SkyAPI extends OAuth2.OAuth2 {
|
|
5
|
+
skyConfig = {
|
|
6
|
+
subscriptionKeyEnvVar: 'SKY_SUBSCRIPTION_KEY'
|
|
7
|
+
};
|
|
8
|
+
constructor(name = '@oauth2-cli/sky-api') {
|
|
9
|
+
super(name);
|
|
10
|
+
super.configure({
|
|
11
|
+
authorization_endpoint: 'https://app.blackbaud.com/oauth/authorize',
|
|
12
|
+
token_endpoint: 'https://oauth2.sky.blackbaud.com/token',
|
|
13
|
+
opt: {
|
|
14
|
+
clientId: 'skyClientId',
|
|
15
|
+
clientSecret: 'skyClientSecret',
|
|
16
|
+
redirectUri: 'skyRedirectUri'
|
|
17
|
+
},
|
|
18
|
+
env: {
|
|
19
|
+
clientId: 'SKY_CLIENT_ID',
|
|
20
|
+
clientSecret: 'SKY_CLIENT_SECRET',
|
|
21
|
+
redirectUri: 'SKY_REDIRECT_URI',
|
|
22
|
+
tokenPath: 'SKY_TOKEN_PATH',
|
|
23
|
+
accessToken: 'SKY_ACCESS_TOKEN'
|
|
24
|
+
},
|
|
25
|
+
man: { heading: 'Sky API options' },
|
|
26
|
+
suppress: {
|
|
27
|
+
authorizationEndpoint: true,
|
|
28
|
+
tokenEndpoint: true,
|
|
29
|
+
tokenPath: true,
|
|
30
|
+
accessToken: true
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
configure({ subscription_key, subscriptionKeyEnvVar, ...proposal } = {}) {
|
|
35
|
+
super.configure(proposal);
|
|
36
|
+
this.skyConfig.subscription_key =
|
|
37
|
+
subscription_key || this.skyConfig.subscription_key;
|
|
38
|
+
this.skyConfig.subscriptionKeyEnvVar =
|
|
39
|
+
subscriptionKeyEnvVar || this.skyConfig.subscriptionKeyEnvVar;
|
|
40
|
+
}
|
|
41
|
+
options() {
|
|
42
|
+
const options = super.options();
|
|
43
|
+
options.opt = {
|
|
44
|
+
...options.opt,
|
|
45
|
+
subscriptionKey: {
|
|
46
|
+
description: `Blackbaud subscription access key; will use environment ` +
|
|
47
|
+
`variable ${Colors.varName(this.skyConfig.subscriptionKeyEnvVar)} ` +
|
|
48
|
+
`if present`,
|
|
49
|
+
secret: true,
|
|
50
|
+
default: this.skyConfig.subscription_key
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return options;
|
|
54
|
+
}
|
|
55
|
+
async init({ values }) {
|
|
56
|
+
const { subscriptionKey: subscription_key = await Env.get({
|
|
57
|
+
key: this.skyConfig.subscriptionKeyEnvVar
|
|
58
|
+
}) } = values;
|
|
59
|
+
this.configure({
|
|
60
|
+
subscription_key,
|
|
61
|
+
...values,
|
|
62
|
+
headers: { 'Bb-Api-Subscription-Key': this.skyConfig.subscription_key }
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import * as SkyAPI from './Module.js';
|
|
2
|
+
export { SkyAPI };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { register } from '@qui-cli/plugin';
|
|
2
|
-
import
|
|
3
|
-
export
|
|
4
|
-
await register(
|
|
2
|
+
import * as SkyAPI from './Module.js';
|
|
3
|
+
export { SkyAPI };
|
|
4
|
+
await register(SkyAPI);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { buildQuery } from '../../../../../buildQuery.js';
|
|
2
|
+
import * as SkyAPI from '../../../../../Module.js';
|
|
2
3
|
import { Paginated } from '../../../../../Paginated.js';
|
|
3
|
-
import * as SkyAPI from '../../../../../SkyAPI.js';
|
|
4
4
|
export async function assignmentsBySection(section_id, params = {}) {
|
|
5
|
-
return new Paginated(await SkyAPI.
|
|
5
|
+
return new Paginated(await SkyAPI.requestJSON(`https://api.sky.blackbaud.com/school/v1/academics/sections/${section_id}/assignments?${buildQuery(params)}`));
|
|
6
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import * as SkyAPI from '../../../../Module.js';
|
|
1
2
|
import { Paginated } from '../../../../Paginated.js';
|
|
2
|
-
import * as SkyAPI from '../../../../SkyAPI.js';
|
|
3
3
|
import { ContentManagementRequest } from '../ContentManagementRequest.js';
|
|
4
4
|
export * from './ContentAnnouncement.js';
|
|
5
5
|
export * from './ContentAnnouncementCategory.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import * as SkyAPI from '../../../../Module.js';
|
|
1
2
|
import { Paginated } from '../../../../Paginated.js';
|
|
2
|
-
import * as SkyAPI from '../../../../SkyAPI.js';
|
|
3
3
|
export * from './ContentAnnouncement.js';
|
|
4
4
|
export * from './ContentAnnouncementCategory.js';
|
|
5
5
|
export * from './ContentAnnouncementCategoryCollection.js';
|
|
6
6
|
export async function categories() {
|
|
7
|
-
return new Paginated(await SkyAPI.
|
|
7
|
+
return new Paginated(await SkyAPI.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/announcements/categories'));
|
|
8
8
|
}
|
|
9
9
|
export async function list(request) {
|
|
10
|
-
return SkyAPI.
|
|
10
|
+
return SkyAPI.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/announcements/list', 'POST', JSON.stringify(request), new Headers({ 'Content-Type': 'application/json' }));
|
|
11
11
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import * as SkyAPI from '../../../../Module.js';
|
|
1
2
|
import { Paginated } from '../../../../Paginated.js';
|
|
2
|
-
import * as SkyAPI from '../../../../SkyAPI.js';
|
|
3
3
|
import { ContentManagementRequest } from '../ContentManagementRequest.js';
|
|
4
4
|
export * from './NewsCategory.js';
|
|
5
5
|
export * from './NewsCategoryCollection.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import * as SkyAPI from '../../../../Module.js';
|
|
1
2
|
import { Paginated } from '../../../../Paginated.js';
|
|
2
|
-
import * as SkyAPI from '../../../../SkyAPI.js';
|
|
3
3
|
export * from './NewsCategory.js';
|
|
4
4
|
export * from './NewsCategoryCollection.js';
|
|
5
5
|
export * from './NewsItem.js';
|
|
6
6
|
export async function categories() {
|
|
7
|
-
return new Paginated(await SkyAPI.
|
|
7
|
+
return new Paginated(await SkyAPI.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/news/categories'));
|
|
8
8
|
}
|
|
9
9
|
export async function list(request) {
|
|
10
|
-
return await SkyAPI.
|
|
10
|
+
return await SkyAPI.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/news/list', 'POST', JSON.stringify(request), new Headers({ 'Content-Type': 'application/json' }));
|
|
11
11
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import * as SkyAPI from '../../../../Module.js';
|
|
1
2
|
import { Paginated } from '../../../../Paginated.js';
|
|
2
|
-
import * as SkyAPI from '../../../../SkyAPI.js';
|
|
3
3
|
import { ContentManagementRequest } from '../ContentManagementRequest.js';
|
|
4
4
|
export * from './ImageDimension.js';
|
|
5
5
|
export * from './ImageSettings.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import * as SkyAPI from '../../../../Module.js';
|
|
1
2
|
import { Paginated } from '../../../../Paginated.js';
|
|
2
|
-
import * as SkyAPI from '../../../../SkyAPI.js';
|
|
3
3
|
export * from './ImageDimension.js';
|
|
4
4
|
export * from './ImageSettings.js';
|
|
5
5
|
export * from './MediaItem.js';
|
|
@@ -8,11 +8,11 @@ export * from './PhotoAlbum.js';
|
|
|
8
8
|
export * from './PhotoCategory.js';
|
|
9
9
|
export * from './PhotoCategoryCollection.js';
|
|
10
10
|
export async function categories() {
|
|
11
|
-
return new Paginated(await SkyAPI.
|
|
11
|
+
return new Paginated(await SkyAPI.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/photoalbums/categories'));
|
|
12
12
|
}
|
|
13
13
|
export async function list(request) {
|
|
14
|
-
return new Paginated(await SkyAPI.
|
|
14
|
+
return new Paginated(await SkyAPI.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/photoalbums/list', 'POST', JSON.stringify(request), new Headers({ 'Content-Type': 'application/json' })));
|
|
15
15
|
}
|
|
16
16
|
export async function photosById(album_id) {
|
|
17
|
-
return new Paginated(await SkyAPI.
|
|
17
|
+
return new Paginated(await SkyAPI.requestJSON(`https://api.sky.blackbaud.com/school/v1/contentmanagement/photoalbums/${album_id}`));
|
|
18
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oauth2-cli/sky-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"blackbaud",
|
|
6
6
|
"sky",
|
|
@@ -28,18 +28,18 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@battis/descriptive-types": "^0.2.6",
|
|
30
30
|
"@battis/typescript-tricks": "^0.7.6",
|
|
31
|
-
"@oauth2-cli/qui-cli": "^0.
|
|
31
|
+
"@oauth2-cli/qui-cli": "^0.5.0",
|
|
32
32
|
"@qui-cli/colors": "^3.2.1",
|
|
33
|
-
"@qui-cli/env-1password": "^1.2.
|
|
33
|
+
"@qui-cli/env-1password": "^1.2.6",
|
|
34
34
|
"@qui-cli/plugin": "^4.0.0",
|
|
35
|
-
"@tsconfig/
|
|
35
|
+
"@tsconfig/node24": "^24.0.3",
|
|
36
36
|
"commit-and-tag-version": "^12.6.1",
|
|
37
37
|
"del-cli": "^6.0.0",
|
|
38
38
|
"npm-run-all": "^4.1.5",
|
|
39
39
|
"typescript": "^5.9.3"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@oauth2-cli/qui-cli": "0.
|
|
42
|
+
"@oauth2-cli/qui-cli": ">=0.5",
|
|
43
43
|
"@qui-cli/plugin": ">=3"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
package/dist/Client.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as OAuth2 from '@oauth2-cli/qui-cli/dist/OAuth2.js';
|
|
2
|
-
import * as Plugin from '@qui-cli/plugin';
|
|
3
|
-
type SkyConfiguration = {
|
|
4
|
-
subscription_key?: string;
|
|
5
|
-
subscriptionKeyEnvVar: string;
|
|
6
|
-
};
|
|
7
|
-
export type Credentials = OAuth2.Credentials & {
|
|
8
|
-
subscription_key: string;
|
|
9
|
-
};
|
|
10
|
-
export type Configuration = OAuth2.Configuration & SkyConfiguration;
|
|
11
|
-
export type ConfigurationProposal = OAuth2.ConfigurationProposal & Partial<SkyConfiguration>;
|
|
12
|
-
export declare class Client extends OAuth2.OAuth2 {
|
|
13
|
-
private skyConfig;
|
|
14
|
-
constructor(name?: string);
|
|
15
|
-
configure({ subscription_key, subscriptionKeyEnvVar, ...proposal }?: ConfigurationProposal): void;
|
|
16
|
-
options(): Plugin.Options;
|
|
17
|
-
init({ values }: Plugin.ExpectedArguments<typeof this.options>): Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
export {};
|
package/dist/Client.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import * as OAuth2 from '@oauth2-cli/qui-cli/dist/OAuth2.js';
|
|
2
|
-
import { Colors } from '@qui-cli/colors';
|
|
3
|
-
import { Env } from '@qui-cli/env-1password';
|
|
4
|
-
export class Client extends OAuth2.OAuth2 {
|
|
5
|
-
skyConfig = {
|
|
6
|
-
subscriptionKeyEnvVar: 'SKY_SUBSCRIPTION_KEY'
|
|
7
|
-
};
|
|
8
|
-
constructor(name = '@oauth2-cli/sky-api') {
|
|
9
|
-
super(name);
|
|
10
|
-
super.configure({
|
|
11
|
-
authorization_endpoint: 'https://app.blackbaud.com/oauth/authorize',
|
|
12
|
-
token_endpoint: 'https://oauth2.sky.blackbaud.com/token',
|
|
13
|
-
env: {
|
|
14
|
-
client_id: 'SKY_CLIENT_ID',
|
|
15
|
-
client_secret: 'SKY_CLIENT_SECRET',
|
|
16
|
-
redirect_uri: 'SKY_REDIRECT_URI',
|
|
17
|
-
token_path: 'SKY_TOKEN_PATH',
|
|
18
|
-
access_token: 'SKY_ACCESS_TOKEN'
|
|
19
|
-
},
|
|
20
|
-
man: { heading: 'Sky API options' },
|
|
21
|
-
suppress: {
|
|
22
|
-
authorizationEndpoint: true,
|
|
23
|
-
tokenEndpoint: true,
|
|
24
|
-
tokenPath: true
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
configure({ subscription_key, subscriptionKeyEnvVar, ...proposal } = {}) {
|
|
29
|
-
super.configure(proposal);
|
|
30
|
-
this.skyConfig.subscription_key =
|
|
31
|
-
subscription_key || this.skyConfig.subscription_key;
|
|
32
|
-
this.skyConfig.subscriptionKeyEnvVar =
|
|
33
|
-
subscriptionKeyEnvVar || this.skyConfig.subscriptionKeyEnvVar;
|
|
34
|
-
}
|
|
35
|
-
options() {
|
|
36
|
-
const options = super.options();
|
|
37
|
-
options.opt = {
|
|
38
|
-
...options.opt,
|
|
39
|
-
subscriptionKey: {
|
|
40
|
-
description: `Blackbaud subscription access key; will use environment ` +
|
|
41
|
-
`variable ${Colors.varName(this.skyConfig.subscriptionKeyEnvVar)} ` +
|
|
42
|
-
`if present`,
|
|
43
|
-
secret: true,
|
|
44
|
-
default: this.skyConfig.subscription_key
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
return options;
|
|
48
|
-
}
|
|
49
|
-
async init({ values }) {
|
|
50
|
-
const { subscriptionKey: subscription_key = await Env.get({
|
|
51
|
-
key: this.skyConfig.subscriptionKeyEnvVar
|
|
52
|
-
}) } = values;
|
|
53
|
-
this.configure({
|
|
54
|
-
subscription_key,
|
|
55
|
-
...values,
|
|
56
|
-
headers: { 'Bb-Api-Subscription-Key': this.skyConfig.subscription_key }
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|