@lti-tool/core 0.13.0 → 0.13.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/CHANGELOG.md +6 -0
- package/dist/ltiTool.js +1 -1
- package/dist/services/ags.service.d.ts +23 -0
- package/dist/services/ags.service.d.ts.map +1 -1
- package/dist/services/ags.service.js +23 -0
- package/dist/services/deepLinking.service.d.ts +9 -4
- package/dist/services/deepLinking.service.d.ts.map +1 -1
- package/dist/services/deepLinking.service.js +9 -4
- package/dist/services/dynamicRegistration.service.d.ts +7 -0
- package/dist/services/dynamicRegistration.service.d.ts.map +1 -1
- package/dist/services/dynamicRegistration.service.js +7 -0
- package/dist/services/nrps.service.d.ts +15 -1
- package/dist/services/nrps.service.d.ts.map +1 -1
- package/dist/services/nrps.service.js +15 -1
- package/dist/services/token.service.d.ts +5 -2
- package/dist/services/token.service.d.ts.map +1 -1
- package/dist/services/token.service.js +5 -2
- package/package.json +1 -1
- package/src/ltiTool.ts +1 -1
- package/src/services/ags.service.ts +23 -0
- package/src/services/deepLinking.service.ts +9 -4
- package/src/services/dynamicRegistration.service.ts +7 -0
- package/src/services/nrps.service.ts +15 -1
- package/src/services/token.service.ts +5 -2
package/CHANGELOG.md
CHANGED
package/dist/ltiTool.js
CHANGED
|
@@ -446,7 +446,7 @@ export class LTITool {
|
|
|
446
446
|
*/
|
|
447
447
|
async completeDynamicRegistration(dynamicRegistrationForm) {
|
|
448
448
|
if (!this.dynamicRegistrationService) {
|
|
449
|
-
throw new Error('
|
|
449
|
+
throw new Error('Dynamic registration service is not configured');
|
|
450
450
|
}
|
|
451
451
|
return await this.dynamicRegistrationService.completeDynamicRegistration(dynamicRegistrationForm);
|
|
452
452
|
}
|
|
@@ -14,6 +14,13 @@ export declare class AGSService {
|
|
|
14
14
|
private tokenService;
|
|
15
15
|
private storage;
|
|
16
16
|
private logger;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new AGSService instance.
|
|
19
|
+
*
|
|
20
|
+
* @param tokenService - Token service for obtaining OAuth2 bearer tokens
|
|
21
|
+
* @param storage - Storage adapter for retrieving launch configurations
|
|
22
|
+
* @param logger - Logger instance for debug and error logging
|
|
23
|
+
*/
|
|
17
24
|
constructor(tokenService: TokenService, storage: LTIStorage, logger: BaseLogger);
|
|
18
25
|
/**
|
|
19
26
|
* Submits a grade score to the platform using LTI Assignment and Grade Services.
|
|
@@ -108,6 +115,16 @@ export declare class AGSService {
|
|
|
108
115
|
* @param updateLineItem - Updated line item data including all required fields
|
|
109
116
|
* @returns Promise resolving to the HTTP response containing the updated line item
|
|
110
117
|
* @throws {Error} When AGS line item service is not available for the session or update fails
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* const response = await agsService.updateLineItem(session, {
|
|
122
|
+
* label: 'Quiz 1 (Updated)',
|
|
123
|
+
* scoreMaximum: 100,
|
|
124
|
+
* tag: 'quiz'
|
|
125
|
+
* });
|
|
126
|
+
* const updatedLineItem = await response.json();
|
|
127
|
+
* ```
|
|
111
128
|
*/
|
|
112
129
|
updateLineItem(session: LTISession, updateLineItem: UpdateLineItem): Promise<Response>;
|
|
113
130
|
/**
|
|
@@ -116,6 +133,12 @@ export declare class AGSService {
|
|
|
116
133
|
* @param session - Active LTI session containing AGS line item endpoint configuration
|
|
117
134
|
* @returns Promise resolving to the HTTP response (typically 204 No Content on success)
|
|
118
135
|
* @throws {Error} When AGS line item service is not available for the session or deletion fails
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* const response = await agsService.deleteLineItem(session);
|
|
140
|
+
* console.log('Line item deleted successfully');
|
|
141
|
+
* ```
|
|
119
142
|
*/
|
|
120
143
|
deleteLineItem(session: LTISession): Promise<Response>;
|
|
121
144
|
private getAGSToken;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ags.service.d.ts","sourceRoot":"","sources":["../../src/services/ags.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACf,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAGtF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;GAKG;AACH,qBAAa,UAAU;
|
|
1
|
+
{"version":3,"file":"ags.service.d.ts","sourceRoot":"","sources":["../../src/services/ags.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACf,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAGtF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;GAKG;AACH,qBAAa,UAAU;IASnB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,MAAM;IAVhB;;;;;;OAMG;gBAEO,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,UAAU;IAG5B;;;;;;;;;;;;;;;;;;OAkBG;IACG,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;IAiCjF;;;;;;;;;;;;;OAaG;IACG,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC;IA4BvD;;;;;;;;;;;;;OAaG;IACG,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC;IAsB3D;;;;;;;;;;;;;OAaG;IACG,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC;IAsBzD;;;;;;;;;;;;;;;;;;;OAmBG;IACG,cAAc,CAClB,OAAO,EAAE,UAAU,EACnB,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,QAAQ,CAAC;IAuBpB;;;;;;;;;;;;;;;;;OAiBG;IACG,cAAc,CAClB,OAAO,EAAE,UAAU,EACnB,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,QAAQ,CAAC;IAuBpB;;;;;;;;;;;;OAYG;IACG,cAAc,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC;YAqB9C,WAAW;YAeX,mBAAmB;CAalC"}
|
|
@@ -9,6 +9,13 @@ export class AGSService {
|
|
|
9
9
|
tokenService;
|
|
10
10
|
storage;
|
|
11
11
|
logger;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new AGSService instance.
|
|
14
|
+
*
|
|
15
|
+
* @param tokenService - Token service for obtaining OAuth2 bearer tokens
|
|
16
|
+
* @param storage - Storage adapter for retrieving launch configurations
|
|
17
|
+
* @param logger - Logger instance for debug and error logging
|
|
18
|
+
*/
|
|
12
19
|
constructor(tokenService, storage, logger) {
|
|
13
20
|
this.tokenService = tokenService;
|
|
14
21
|
this.storage = storage;
|
|
@@ -193,6 +200,16 @@ export class AGSService {
|
|
|
193
200
|
* @param updateLineItem - Updated line item data including all required fields
|
|
194
201
|
* @returns Promise resolving to the HTTP response containing the updated line item
|
|
195
202
|
* @throws {Error} When AGS line item service is not available for the session or update fails
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```typescript
|
|
206
|
+
* const response = await agsService.updateLineItem(session, {
|
|
207
|
+
* label: 'Quiz 1 (Updated)',
|
|
208
|
+
* scoreMaximum: 100,
|
|
209
|
+
* tag: 'quiz'
|
|
210
|
+
* });
|
|
211
|
+
* const updatedLineItem = await response.json();
|
|
212
|
+
* ```
|
|
196
213
|
*/
|
|
197
214
|
async updateLineItem(session, updateLineItem) {
|
|
198
215
|
if (!session.services?.ags?.lineitem) {
|
|
@@ -216,6 +233,12 @@ export class AGSService {
|
|
|
216
233
|
* @param session - Active LTI session containing AGS line item endpoint configuration
|
|
217
234
|
* @returns Promise resolving to the HTTP response (typically 204 No Content on success)
|
|
218
235
|
* @throws {Error} When AGS line item service is not available for the session or deletion fails
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```typescript
|
|
239
|
+
* const response = await agsService.deleteLineItem(session);
|
|
240
|
+
* console.log('Line item deleted successfully');
|
|
241
|
+
* ```
|
|
219
242
|
*/
|
|
220
243
|
async deleteLineItem(session) {
|
|
221
244
|
if (!session.services?.ags?.lineitem) {
|
|
@@ -5,14 +5,19 @@ import type { DeepLinkingContentItem } from '../schemas/lti13/deepLinking/conten
|
|
|
5
5
|
* Deep Linking service for LTI 1.3.
|
|
6
6
|
* Generates signed JWT responses containing selected content items to return to the platform.
|
|
7
7
|
*
|
|
8
|
-
* @param keyPair - RSA key pair for signing client assertion JWTs (must be RS256 compatible)
|
|
9
|
-
* @param keyId - Key identifier for JWT header, should match JWKS key ID (defaults to 'main')
|
|
10
8
|
* @see https://www.imsglobal.org/spec/lti-dl/v2p0
|
|
11
9
|
*/
|
|
12
10
|
export declare class DeepLinkingService {
|
|
13
11
|
private keyPair;
|
|
14
12
|
private logger;
|
|
15
13
|
private keyId;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new DeepLinkingService instance.
|
|
16
|
+
*
|
|
17
|
+
* @param keyPair - RSA key pair for signing client assertion JWTs (must be RS256 compatible)
|
|
18
|
+
* @param logger - Logger instance for debug and error logging
|
|
19
|
+
* @param keyId - Key identifier for JWT header, should match JWKS key ID (defaults to 'main')
|
|
20
|
+
*/
|
|
16
21
|
constructor(keyPair: CryptoKeyPair, logger: BaseLogger, keyId?: string);
|
|
17
22
|
/**
|
|
18
23
|
* Creates a Deep Linking response with selected content items.
|
|
@@ -20,7 +25,7 @@ export declare class DeepLinkingService {
|
|
|
20
25
|
*
|
|
21
26
|
* @param session - Active LTI session containing Deep Linking configuration
|
|
22
27
|
* @param contentItems - Array of content items selected by the user
|
|
23
|
-
* @returns HTML string containing auto-submit form
|
|
28
|
+
* @returns Promise resolving to an HTML string containing auto-submit form
|
|
24
29
|
* @throws {Error} When Deep Linking is not available for the session
|
|
25
30
|
*
|
|
26
31
|
* @example
|
|
@@ -41,7 +46,7 @@ export declare class DeepLinkingService {
|
|
|
41
46
|
*
|
|
42
47
|
* @param session - Active LTI session with Deep Linking configuration
|
|
43
48
|
* @param contentItems - Array of selected content items
|
|
44
|
-
* @returns
|
|
49
|
+
* @returns Promise resolving to a signed JWT string
|
|
45
50
|
*/
|
|
46
51
|
private createDeepLinkingJWT;
|
|
47
52
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepLinking.service.d.ts","sourceRoot":"","sources":["../../src/services/deepLinking.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAEjG
|
|
1
|
+
{"version":3,"file":"deepLinking.service.d.ts","sourceRoot":"","sources":["../../src/services/deepLinking.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAEjG;;;;;GAKG;AACH,qBAAa,kBAAkB;IAS3B,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;IAVf;;;;;;OAMG;gBAEO,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,UAAU,EAClB,KAAK,SAAS;IAGxB;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,cAAc,CAClB,OAAO,EAAE,UAAU,EACnB,YAAY,EAAE,sBAAsB,EAAE,GACrC,OAAO,CAAC,MAAM,CAAC;IAiBlB;;;;;;OAMG;YACW,oBAAoB;IA6BlC;;;;;;OAMG;IACH,OAAO,CAAC,sBAAsB;CAiB/B"}
|
|
@@ -3,14 +3,19 @@ import { SignJWT } from 'jose';
|
|
|
3
3
|
* Deep Linking service for LTI 1.3.
|
|
4
4
|
* Generates signed JWT responses containing selected content items to return to the platform.
|
|
5
5
|
*
|
|
6
|
-
* @param keyPair - RSA key pair for signing client assertion JWTs (must be RS256 compatible)
|
|
7
|
-
* @param keyId - Key identifier for JWT header, should match JWKS key ID (defaults to 'main')
|
|
8
6
|
* @see https://www.imsglobal.org/spec/lti-dl/v2p0
|
|
9
7
|
*/
|
|
10
8
|
export class DeepLinkingService {
|
|
11
9
|
keyPair;
|
|
12
10
|
logger;
|
|
13
11
|
keyId;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new DeepLinkingService instance.
|
|
14
|
+
*
|
|
15
|
+
* @param keyPair - RSA key pair for signing client assertion JWTs (must be RS256 compatible)
|
|
16
|
+
* @param logger - Logger instance for debug and error logging
|
|
17
|
+
* @param keyId - Key identifier for JWT header, should match JWKS key ID (defaults to 'main')
|
|
18
|
+
*/
|
|
14
19
|
constructor(keyPair, logger, keyId = 'main') {
|
|
15
20
|
this.keyPair = keyPair;
|
|
16
21
|
this.logger = logger;
|
|
@@ -22,7 +27,7 @@ export class DeepLinkingService {
|
|
|
22
27
|
*
|
|
23
28
|
* @param session - Active LTI session containing Deep Linking configuration
|
|
24
29
|
* @param contentItems - Array of content items selected by the user
|
|
25
|
-
* @returns HTML string containing auto-submit form
|
|
30
|
+
* @returns Promise resolving to an HTML string containing auto-submit form
|
|
26
31
|
* @throws {Error} When Deep Linking is not available for the session
|
|
27
32
|
*
|
|
28
33
|
* @example
|
|
@@ -53,7 +58,7 @@ export class DeepLinkingService {
|
|
|
53
58
|
*
|
|
54
59
|
* @param session - Active LTI session with Deep Linking configuration
|
|
55
60
|
* @param contentItems - Array of selected content items
|
|
56
|
-
* @returns
|
|
61
|
+
* @returns Promise resolving to a signed JWT string
|
|
57
62
|
*/
|
|
58
63
|
async createDeepLinkingJWT(session, contentItems) {
|
|
59
64
|
const deepLinking = session.services.deepLinking;
|
|
@@ -53,6 +53,13 @@ export declare class DynamicRegistrationService {
|
|
|
53
53
|
private storage;
|
|
54
54
|
private dynamicRegistrationConfig;
|
|
55
55
|
private logger;
|
|
56
|
+
/**
|
|
57
|
+
* Creates a new DynamicRegistrationService instance.
|
|
58
|
+
*
|
|
59
|
+
* @param storage - Storage adapter for persisting client and deployment configurations
|
|
60
|
+
* @param dynamicRegistrationConfig - Tool configuration including URLs and service settings
|
|
61
|
+
* @param logger - Logger instance for debug and error logging
|
|
62
|
+
*/
|
|
56
63
|
constructor(storage: LTIStorage, dynamicRegistrationConfig: DynamicRegistrationConfig, logger: BaseLogger);
|
|
57
64
|
/**
|
|
58
65
|
* Fetches and validates the OpenID Connect configuration from an LTI platform during dynamic registration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamicRegistration.service.d.ts","sourceRoot":"","sources":["../../src/services/dynamicRegistration.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AACpG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uEAAuE,CAAC;AAErH,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,oEAAoE,CAAC;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oEAAoE,CAAC;AAS9G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,qBAAa,0BAA0B;
|
|
1
|
+
{"version":3,"file":"dynamicRegistration.service.d.ts","sourceRoot":"","sources":["../../src/services/dynamicRegistration.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AACpG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uEAAuE,CAAC;AAErH,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,oEAAoE,CAAC;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oEAAoE,CAAC;AAS9G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,qBAAa,0BAA0B;IASnC,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,yBAAyB;IACjC,OAAO,CAAC,MAAM;IAVhB;;;;;;OAMG;gBAEO,OAAO,EAAE,UAAU,EACnB,yBAAyB,EAAE,yBAAyB,EACpD,MAAM,EAAE,UAAU;IAG5B;;;;;;;OAOG;IACG,0BAA0B,CAC9B,mBAAmB,EAAE,mBAAmB,GACvC,OAAO,CAAC,mBAAmB,CAAC;IAkC/B;;;;;;;;OAQG;IACG,2BAA2B,CAC/B,mBAAmB,EAAE,mBAAmB,EACxC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC;IAsClB;;;;;;;OAOG;IACG,2BAA2B,CAC/B,uBAAuB,EAAE,uBAAuB,GAC/C,OAAO,CAAC,MAAM,CAAC;IAoDlB;;;;;;OAMG;IACG,yBAAyB,CAC7B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,6BAA6B,GAAG,SAAS,CAAC;IAQrD;;;;;;;OAOG;IACH,OAAO,CAAC,aAAa;IAoBrB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAoBnB;;;;;;OAMG;IACH,OAAO,CAAC,wBAAwB;YAkClB,mCAAmC;IAgBjD,OAAO,CAAC,0BAA0B;CAiDnC"}
|
|
@@ -48,6 +48,13 @@ export class DynamicRegistrationService {
|
|
|
48
48
|
storage;
|
|
49
49
|
dynamicRegistrationConfig;
|
|
50
50
|
logger;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a new DynamicRegistrationService instance.
|
|
53
|
+
*
|
|
54
|
+
* @param storage - Storage adapter for persisting client and deployment configurations
|
|
55
|
+
* @param dynamicRegistrationConfig - Tool configuration including URLs and service settings
|
|
56
|
+
* @param logger - Logger instance for debug and error logging
|
|
57
|
+
*/
|
|
51
58
|
constructor(storage, dynamicRegistrationConfig, logger) {
|
|
52
59
|
this.storage = storage;
|
|
53
60
|
this.dynamicRegistrationConfig = dynamicRegistrationConfig;
|
|
@@ -12,14 +12,28 @@ export declare class NRPSService {
|
|
|
12
12
|
private tokenService;
|
|
13
13
|
private storage;
|
|
14
14
|
private logger;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new NRPSService instance.
|
|
17
|
+
*
|
|
18
|
+
* @param tokenService - Token service for obtaining OAuth2 bearer tokens
|
|
19
|
+
* @param storage - Storage adapter for retrieving launch configurations
|
|
20
|
+
* @param logger - Logger instance for debug and error logging
|
|
21
|
+
*/
|
|
15
22
|
constructor(tokenService: TokenService, storage: LTIStorage, logger: BaseLogger);
|
|
16
23
|
/**
|
|
17
24
|
* Retrieves all members (users) in the current course/context from the platform.
|
|
18
25
|
* Returns raw response that should be parsed by the calling service.
|
|
19
26
|
*
|
|
20
27
|
* @param session - Active LTI session containing NRPS service endpoints
|
|
21
|
-
* @returns
|
|
28
|
+
* @returns Promise resolving to the HTTP response containing membership data
|
|
22
29
|
* @throws {Error} When NRPS is not available for this session or request fails
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const response = await nrpsService.getMembers(session);
|
|
34
|
+
* const data = await response.json();
|
|
35
|
+
* console.log('Course members:', data.members);
|
|
36
|
+
* ```
|
|
23
37
|
*/
|
|
24
38
|
getMembers(session: LTISession): Promise<Response>;
|
|
25
39
|
private getNRPSToken;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nrps.service.d.ts","sourceRoot":"","sources":["../../src/services/nrps.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;GAKG;AACH,qBAAa,WAAW;
|
|
1
|
+
{"version":3,"file":"nrps.service.d.ts","sourceRoot":"","sources":["../../src/services/nrps.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;GAKG;AACH,qBAAa,WAAW;IASpB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,MAAM;IAVhB;;;;;;OAMG;gBAEO,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,UAAU;IAG5B;;;;;;;;;;;;;;OAcG;IACG,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC;YAsB1C,YAAY;YAeZ,oBAAoB;CAanC"}
|
|
@@ -9,6 +9,13 @@ export class NRPSService {
|
|
|
9
9
|
tokenService;
|
|
10
10
|
storage;
|
|
11
11
|
logger;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new NRPSService instance.
|
|
14
|
+
*
|
|
15
|
+
* @param tokenService - Token service for obtaining OAuth2 bearer tokens
|
|
16
|
+
* @param storage - Storage adapter for retrieving launch configurations
|
|
17
|
+
* @param logger - Logger instance for debug and error logging
|
|
18
|
+
*/
|
|
12
19
|
constructor(tokenService, storage, logger) {
|
|
13
20
|
this.tokenService = tokenService;
|
|
14
21
|
this.storage = storage;
|
|
@@ -19,8 +26,15 @@ export class NRPSService {
|
|
|
19
26
|
* Returns raw response that should be parsed by the calling service.
|
|
20
27
|
*
|
|
21
28
|
* @param session - Active LTI session containing NRPS service endpoints
|
|
22
|
-
* @returns
|
|
29
|
+
* @returns Promise resolving to the HTTP response containing membership data
|
|
23
30
|
* @throws {Error} When NRPS is not available for this session or request fails
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const response = await nrpsService.getMembers(session);
|
|
35
|
+
* const data = await response.json();
|
|
36
|
+
* console.log('Course members:', data.members);
|
|
37
|
+
* ```
|
|
24
38
|
*/
|
|
25
39
|
async getMembers(session) {
|
|
26
40
|
if (!session.services?.nrps?.membershipUrl) {
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Implements RFC 7523 (JWT Profile for OAuth 2.0 Client Authentication and Authorization Grants)
|
|
6
6
|
* as required by LTI 1.3 security framework.
|
|
7
|
+
*
|
|
8
|
+
* @see https://www.rfc-editor.org/rfc/rfc7523
|
|
7
9
|
*/
|
|
8
10
|
export declare class TokenService {
|
|
9
11
|
private keyPair;
|
|
@@ -20,7 +22,7 @@ export declare class TokenService {
|
|
|
20
22
|
*
|
|
21
23
|
* @param clientId - OAuth2 client identifier
|
|
22
24
|
* @param tokenUrl - Platform's token endpoint URL
|
|
23
|
-
* @returns
|
|
25
|
+
* @returns Promise resolving to a signed JWT client assertion string
|
|
24
26
|
*/
|
|
25
27
|
createClientAssertion(clientId: string, tokenUrl: string): Promise<string>;
|
|
26
28
|
/**
|
|
@@ -29,7 +31,8 @@ export declare class TokenService {
|
|
|
29
31
|
* @param clientId - OAuth2 client identifier
|
|
30
32
|
* @param tokenUrl - Platform's token endpoint URL
|
|
31
33
|
* @param scope - Requested OAuth2 scope (e.g., AGS score scope)
|
|
32
|
-
* @returns
|
|
34
|
+
* @returns Promise resolving to a bearer access token string for API calls
|
|
35
|
+
* @throws {Error} When the token request fails or response is missing access_token
|
|
33
36
|
*/
|
|
34
37
|
getBearerToken(clientId: string, tokenUrl: string, scope: string): Promise<string>;
|
|
35
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.service.d.ts","sourceRoot":"","sources":["../../src/services/token.service.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"token.service.d.ts","sourceRoot":"","sources":["../../src/services/token.service.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,qBAAa,YAAY;IAQrB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,KAAK;IARf;;;;;OAKG;gBAEO,OAAO,EAAE,aAAa,EACtB,KAAK,SAAS;IAGxB;;;;;;OAMG;IACG,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAiBhF;;;;;;;;OAQG;IACG,cAAc,CAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC;CA6BnB"}
|
|
@@ -5,6 +5,8 @@ import { SignJWT } from 'jose';
|
|
|
5
5
|
*
|
|
6
6
|
* Implements RFC 7523 (JWT Profile for OAuth 2.0 Client Authentication and Authorization Grants)
|
|
7
7
|
* as required by LTI 1.3 security framework.
|
|
8
|
+
*
|
|
9
|
+
* @see https://www.rfc-editor.org/rfc/rfc7523
|
|
8
10
|
*/
|
|
9
11
|
export class TokenService {
|
|
10
12
|
keyPair;
|
|
@@ -24,7 +26,7 @@ export class TokenService {
|
|
|
24
26
|
*
|
|
25
27
|
* @param clientId - OAuth2 client identifier
|
|
26
28
|
* @param tokenUrl - Platform's token endpoint URL
|
|
27
|
-
* @returns
|
|
29
|
+
* @returns Promise resolving to a signed JWT client assertion string
|
|
28
30
|
*/
|
|
29
31
|
async createClientAssertion(clientId, tokenUrl) {
|
|
30
32
|
return await new SignJWT({
|
|
@@ -48,7 +50,8 @@ export class TokenService {
|
|
|
48
50
|
* @param clientId - OAuth2 client identifier
|
|
49
51
|
* @param tokenUrl - Platform's token endpoint URL
|
|
50
52
|
* @param scope - Requested OAuth2 scope (e.g., AGS score scope)
|
|
51
|
-
* @returns
|
|
53
|
+
* @returns Promise resolving to a bearer access token string for API calls
|
|
54
|
+
* @throws {Error} When the token request fails or response is missing access_token
|
|
52
55
|
*/
|
|
53
56
|
async getBearerToken(clientId, tokenUrl, scope) {
|
|
54
57
|
const assertion = await this.createClientAssertion(clientId, tokenUrl);
|
package/package.json
CHANGED
package/src/ltiTool.ts
CHANGED
|
@@ -579,7 +579,7 @@ export class LTITool {
|
|
|
579
579
|
dynamicRegistrationForm: DynamicRegistrationForm,
|
|
580
580
|
): Promise<string> {
|
|
581
581
|
if (!this.dynamicRegistrationService) {
|
|
582
|
-
throw new Error('
|
|
582
|
+
throw new Error('Dynamic registration service is not configured');
|
|
583
583
|
}
|
|
584
584
|
|
|
585
585
|
return await this.dynamicRegistrationService.completeDynamicRegistration(
|
|
@@ -18,6 +18,13 @@ import type { TokenService } from './token.service.js';
|
|
|
18
18
|
* @see https://www.imsglobal.org/spec/lti-ags/v2p0
|
|
19
19
|
*/
|
|
20
20
|
export class AGSService {
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new AGSService instance.
|
|
23
|
+
*
|
|
24
|
+
* @param tokenService - Token service for obtaining OAuth2 bearer tokens
|
|
25
|
+
* @param storage - Storage adapter for retrieving launch configurations
|
|
26
|
+
* @param logger - Logger instance for debug and error logging
|
|
27
|
+
*/
|
|
21
28
|
constructor(
|
|
22
29
|
private tokenService: TokenService,
|
|
23
30
|
private storage: LTIStorage,
|
|
@@ -243,6 +250,16 @@ export class AGSService {
|
|
|
243
250
|
* @param updateLineItem - Updated line item data including all required fields
|
|
244
251
|
* @returns Promise resolving to the HTTP response containing the updated line item
|
|
245
252
|
* @throws {Error} When AGS line item service is not available for the session or update fails
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* ```typescript
|
|
256
|
+
* const response = await agsService.updateLineItem(session, {
|
|
257
|
+
* label: 'Quiz 1 (Updated)',
|
|
258
|
+
* scoreMaximum: 100,
|
|
259
|
+
* tag: 'quiz'
|
|
260
|
+
* });
|
|
261
|
+
* const updatedLineItem = await response.json();
|
|
262
|
+
* ```
|
|
246
263
|
*/
|
|
247
264
|
async updateLineItem(
|
|
248
265
|
session: LTISession,
|
|
@@ -276,6 +293,12 @@ export class AGSService {
|
|
|
276
293
|
* @param session - Active LTI session containing AGS line item endpoint configuration
|
|
277
294
|
* @returns Promise resolving to the HTTP response (typically 204 No Content on success)
|
|
278
295
|
* @throws {Error} When AGS line item service is not available for the session or deletion fails
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```typescript
|
|
299
|
+
* const response = await agsService.deleteLineItem(session);
|
|
300
|
+
* console.log('Line item deleted successfully');
|
|
301
|
+
* ```
|
|
279
302
|
*/
|
|
280
303
|
async deleteLineItem(session: LTISession): Promise<Response> {
|
|
281
304
|
if (!session.services?.ags?.lineitem) {
|
|
@@ -8,11 +8,16 @@ import type { DeepLinkingContentItem } from '../schemas/lti13/deepLinking/conten
|
|
|
8
8
|
* Deep Linking service for LTI 1.3.
|
|
9
9
|
* Generates signed JWT responses containing selected content items to return to the platform.
|
|
10
10
|
*
|
|
11
|
-
* @param keyPair - RSA key pair for signing client assertion JWTs (must be RS256 compatible)
|
|
12
|
-
* @param keyId - Key identifier for JWT header, should match JWKS key ID (defaults to 'main')
|
|
13
11
|
* @see https://www.imsglobal.org/spec/lti-dl/v2p0
|
|
14
12
|
*/
|
|
15
13
|
export class DeepLinkingService {
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new DeepLinkingService instance.
|
|
16
|
+
*
|
|
17
|
+
* @param keyPair - RSA key pair for signing client assertion JWTs (must be RS256 compatible)
|
|
18
|
+
* @param logger - Logger instance for debug and error logging
|
|
19
|
+
* @param keyId - Key identifier for JWT header, should match JWKS key ID (defaults to 'main')
|
|
20
|
+
*/
|
|
16
21
|
constructor(
|
|
17
22
|
private keyPair: CryptoKeyPair,
|
|
18
23
|
private logger: BaseLogger,
|
|
@@ -25,7 +30,7 @@ export class DeepLinkingService {
|
|
|
25
30
|
*
|
|
26
31
|
* @param session - Active LTI session containing Deep Linking configuration
|
|
27
32
|
* @param contentItems - Array of content items selected by the user
|
|
28
|
-
* @returns HTML string containing auto-submit form
|
|
33
|
+
* @returns Promise resolving to an HTML string containing auto-submit form
|
|
29
34
|
* @throws {Error} When Deep Linking is not available for the session
|
|
30
35
|
*
|
|
31
36
|
* @example
|
|
@@ -65,7 +70,7 @@ export class DeepLinkingService {
|
|
|
65
70
|
*
|
|
66
71
|
* @param session - Active LTI session with Deep Linking configuration
|
|
67
72
|
* @param contentItems - Array of selected content items
|
|
68
|
-
* @returns
|
|
73
|
+
* @returns Promise resolving to a signed JWT string
|
|
69
74
|
*/
|
|
70
75
|
private async createDeepLinkingJWT(
|
|
71
76
|
session: LTISession,
|
|
@@ -63,6 +63,13 @@ import {
|
|
|
63
63
|
* @see https://www.imsglobal.org/spec/lti-dr/v1p0 LTI 1.3 Dynamic Registration specification
|
|
64
64
|
*/
|
|
65
65
|
export class DynamicRegistrationService {
|
|
66
|
+
/**
|
|
67
|
+
* Creates a new DynamicRegistrationService instance.
|
|
68
|
+
*
|
|
69
|
+
* @param storage - Storage adapter for persisting client and deployment configurations
|
|
70
|
+
* @param dynamicRegistrationConfig - Tool configuration including URLs and service settings
|
|
71
|
+
* @param logger - Logger instance for debug and error logging
|
|
72
|
+
*/
|
|
66
73
|
constructor(
|
|
67
74
|
private storage: LTIStorage,
|
|
68
75
|
private dynamicRegistrationConfig: DynamicRegistrationConfig,
|
|
@@ -13,6 +13,13 @@ import type { TokenService } from './token.service.js';
|
|
|
13
13
|
* @see https://www.imsglobal.org/spec/lti-nrps/v2p0
|
|
14
14
|
*/
|
|
15
15
|
export class NRPSService {
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new NRPSService instance.
|
|
18
|
+
*
|
|
19
|
+
* @param tokenService - Token service for obtaining OAuth2 bearer tokens
|
|
20
|
+
* @param storage - Storage adapter for retrieving launch configurations
|
|
21
|
+
* @param logger - Logger instance for debug and error logging
|
|
22
|
+
*/
|
|
16
23
|
constructor(
|
|
17
24
|
private tokenService: TokenService,
|
|
18
25
|
private storage: LTIStorage,
|
|
@@ -24,8 +31,15 @@ export class NRPSService {
|
|
|
24
31
|
* Returns raw response that should be parsed by the calling service.
|
|
25
32
|
*
|
|
26
33
|
* @param session - Active LTI session containing NRPS service endpoints
|
|
27
|
-
* @returns
|
|
34
|
+
* @returns Promise resolving to the HTTP response containing membership data
|
|
28
35
|
* @throws {Error} When NRPS is not available for this session or request fails
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const response = await nrpsService.getMembers(session);
|
|
40
|
+
* const data = await response.json();
|
|
41
|
+
* console.log('Course members:', data.members);
|
|
42
|
+
* ```
|
|
29
43
|
*/
|
|
30
44
|
async getMembers(session: LTISession): Promise<Response> {
|
|
31
45
|
if (!session.services?.nrps?.membershipUrl) {
|
|
@@ -6,6 +6,8 @@ import { SignJWT } from 'jose';
|
|
|
6
6
|
*
|
|
7
7
|
* Implements RFC 7523 (JWT Profile for OAuth 2.0 Client Authentication and Authorization Grants)
|
|
8
8
|
* as required by LTI 1.3 security framework.
|
|
9
|
+
*
|
|
10
|
+
* @see https://www.rfc-editor.org/rfc/rfc7523
|
|
9
11
|
*/
|
|
10
12
|
export class TokenService {
|
|
11
13
|
/**
|
|
@@ -24,7 +26,7 @@ export class TokenService {
|
|
|
24
26
|
*
|
|
25
27
|
* @param clientId - OAuth2 client identifier
|
|
26
28
|
* @param tokenUrl - Platform's token endpoint URL
|
|
27
|
-
* @returns
|
|
29
|
+
* @returns Promise resolving to a signed JWT client assertion string
|
|
28
30
|
*/
|
|
29
31
|
async createClientAssertion(clientId: string, tokenUrl: string): Promise<string> {
|
|
30
32
|
return await new SignJWT({
|
|
@@ -49,7 +51,8 @@ export class TokenService {
|
|
|
49
51
|
* @param clientId - OAuth2 client identifier
|
|
50
52
|
* @param tokenUrl - Platform's token endpoint URL
|
|
51
53
|
* @param scope - Requested OAuth2 scope (e.g., AGS score scope)
|
|
52
|
-
* @returns
|
|
54
|
+
* @returns Promise resolving to a bearer access token string for API calls
|
|
55
|
+
* @throws {Error} When the token request fails or response is missing access_token
|
|
53
56
|
*/
|
|
54
57
|
async getBearerToken(
|
|
55
58
|
clientId: string,
|