@eduware/oneroster 1.0.0 → 1.0.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/README.md +76 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,17 +3,29 @@
|
|
|
3
3
|
Type-safe TypeScript SDK for the OneRoster API with LMS-specific client profiles.
|
|
4
4
|
|
|
5
5
|
<div align="left">
|
|
6
|
+
<a href="https://www.npmjs.com/package/@eduware/oneroster">
|
|
7
|
+
<img src="https://img.shields.io/npm/v/@eduware/oneroster.svg" alt="npm version" />
|
|
8
|
+
</a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@eduware/oneroster">
|
|
10
|
+
<img src="https://img.shields.io/npm/dm/@eduware/oneroster.svg" alt="npm downloads" />
|
|
11
|
+
</a>
|
|
6
12
|
<a href="https://opensource.org/licenses/MIT">
|
|
7
|
-
<img src="https://img.shields.io/badge/License-MIT-blue.svg"
|
|
13
|
+
<img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT" />
|
|
14
|
+
</a>
|
|
15
|
+
<a href="#">
|
|
16
|
+
<img src="https://img.shields.io/badge/OneRoster-v1.1%20%7C%20v1.2-green.svg" alt="OneRoster v1.1 | v1.2" />
|
|
17
|
+
</a>
|
|
18
|
+
<a href="#">
|
|
19
|
+
<img src="https://img.shields.io/badge/TypeScript-5.0+-blue.svg" alt="TypeScript 5.0+" />
|
|
8
20
|
</a>
|
|
9
21
|
</div>
|
|
10
22
|
|
|
11
23
|
## Features
|
|
12
24
|
|
|
13
|
-
- **
|
|
25
|
+
- **OneRoster v1.1 & v1.2 support** - Complete implementation of both 1EdTech OneRoster specifications
|
|
14
26
|
- **LMS-specific profiles** - Pre-built profiles for ClassLink with type-safe method restrictions
|
|
15
27
|
- **Custom profiles** - Create your own profiles using TypeScript's `Pick<>` types
|
|
16
|
-
- **OAuth 2.0 & OAuth 1.0a authentication** -
|
|
28
|
+
- **OAuth 2.0 & OAuth 1.0a authentication** - OAuth 2.0 for v1.2 (default), OAuth 1.0a for v1.1
|
|
17
29
|
- **Automatic pagination** - Async iterables for seamless data fetching
|
|
18
30
|
- **TypeScript-first** - Full type safety with comprehensive type definitions
|
|
19
31
|
- **Tree-shakeable** - Standalone functions for optimal bundle sizes
|
|
@@ -153,9 +165,51 @@ const users = await client.usersManagement.getAllUsers({});
|
|
|
153
165
|
// client.usersManagement.createUser({}); // TypeScript error!
|
|
154
166
|
```
|
|
155
167
|
|
|
168
|
+
## OneRoster Versions
|
|
169
|
+
|
|
170
|
+
The SDK supports both OneRoster v1.1 and v1.2 specifications. The default is v1.2.
|
|
171
|
+
|
|
172
|
+
### Version 1.2 (Default)
|
|
173
|
+
|
|
174
|
+
OneRoster v1.2 uses OAuth 2.0 authentication and the `/ims/oneroster/rostering/v1p2/` path format:
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
import { OneRoster } from '@eduware/oneroster';
|
|
178
|
+
|
|
179
|
+
const client = new OneRoster({
|
|
180
|
+
serverURL: 'https://your-server.com',
|
|
181
|
+
// oneRosterVersion defaults to '1.2'
|
|
182
|
+
security: {
|
|
183
|
+
clientID: process.env.ONEROSTER_CLIENT_ID!,
|
|
184
|
+
clientSecret: process.env.ONEROSTER_CLIENT_SECRET!,
|
|
185
|
+
tokenURL: 'https://your-server.com/oauth/token',
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Version 1.1
|
|
191
|
+
|
|
192
|
+
OneRoster v1.1 uses OAuth 1.0a authentication and the `/ims/oneroster/v1p1/` path format:
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
import { OneRoster } from '@eduware/oneroster';
|
|
196
|
+
|
|
197
|
+
const client = new OneRoster({
|
|
198
|
+
serverURL: 'https://your-server.com',
|
|
199
|
+
oneRosterVersion: '1.1',
|
|
200
|
+
security: {
|
|
201
|
+
authType: 'oauth1',
|
|
202
|
+
clientID: process.env.ONEROSTER_CLIENT_ID!,
|
|
203
|
+
clientSecret: process.env.ONEROSTER_CLIENT_SECRET!,
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
> **Note:** OAuth 1.0a is only supported in OneRoster v1.1. Per the 1EdTech specification, v1.2 requires OAuth 2.0.
|
|
209
|
+
|
|
156
210
|
## Authentication
|
|
157
211
|
|
|
158
|
-
### OAuth 2.0 (Default)
|
|
212
|
+
### OAuth 2.0 (Default for v1.2)
|
|
159
213
|
|
|
160
214
|
```typescript
|
|
161
215
|
import { OneRoster } from '@eduware/oneroster';
|
|
@@ -176,6 +230,22 @@ You can also use environment variables:
|
|
|
176
230
|
- `ONEROSTER_CLIENT_SECRET`
|
|
177
231
|
- `ONEROSTER_TOKEN_URL`
|
|
178
232
|
|
|
233
|
+
### OAuth 1.0a (v1.1 only)
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
import { OneRoster } from '@eduware/oneroster';
|
|
237
|
+
|
|
238
|
+
const client = new OneRoster({
|
|
239
|
+
serverURL: 'https://your-server.com',
|
|
240
|
+
oneRosterVersion: '1.1',
|
|
241
|
+
security: {
|
|
242
|
+
authType: 'oauth1',
|
|
243
|
+
clientID: process.env.ONEROSTER_CLIENT_ID!,
|
|
244
|
+
clientSecret: process.env.ONEROSTER_CLIENT_SECRET!,
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
```
|
|
248
|
+
|
|
179
249
|
### Bearer Token
|
|
180
250
|
|
|
181
251
|
If you already have a token:
|
|
@@ -186,7 +256,8 @@ import { OneRoster } from '@eduware/oneroster';
|
|
|
186
256
|
const client = new OneRoster({
|
|
187
257
|
serverURL: 'https://your-server.com',
|
|
188
258
|
security: {
|
|
189
|
-
|
|
259
|
+
authType: 'bearer',
|
|
260
|
+
bearerToken: 'your-access-token',
|
|
190
261
|
},
|
|
191
262
|
});
|
|
192
263
|
```
|