@lti-tool/core 0.9.0 → 0.11.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/ltiTool.d.ts +88 -3
  3. package/dist/ltiTool.d.ts.map +1 -1
  4. package/dist/ltiTool.js +157 -3
  5. package/dist/schemas/client.schema.d.ts +1 -1
  6. package/dist/schemas/client.schema.d.ts.map +1 -1
  7. package/dist/schemas/client.schema.js +1 -1
  8. package/dist/schemas/common.schema.d.ts +1 -1
  9. package/dist/schemas/common.schema.d.ts.map +1 -1
  10. package/dist/schemas/common.schema.js +1 -1
  11. package/dist/schemas/deployment.schema.d.ts +1 -1
  12. package/dist/schemas/deployment.schema.d.ts.map +1 -1
  13. package/dist/schemas/deployment.schema.js +1 -1
  14. package/dist/schemas/lti13/ags/lineItem.schema.d.ts +80 -0
  15. package/dist/schemas/lti13/ags/lineItem.schema.d.ts.map +1 -0
  16. package/dist/schemas/lti13/ags/lineItem.schema.js +49 -0
  17. package/dist/schemas/lti13/ags/result.schema.d.ts +65 -0
  18. package/dist/schemas/lti13/ags/result.schema.d.ts.map +1 -0
  19. package/dist/schemas/lti13/ags/result.schema.js +35 -0
  20. package/dist/schemas/lti13/ags/scoreSubmission.schema.d.ts +25 -4
  21. package/dist/schemas/lti13/ags/scoreSubmission.schema.d.ts.map +1 -1
  22. package/dist/schemas/lti13/ags/scoreSubmission.schema.js +2 -1
  23. package/dist/schemas/lti13/claims/baseJwtClaims.schema.d.ts +1 -1
  24. package/dist/schemas/lti13/claims/baseJwtClaims.schema.d.ts.map +1 -1
  25. package/dist/schemas/lti13/claims/baseJwtClaims.schema.js +1 -1
  26. package/dist/schemas/lti13/claims/contextClaims.schema.d.ts +1 -1
  27. package/dist/schemas/lti13/claims/contextClaims.schema.d.ts.map +1 -1
  28. package/dist/schemas/lti13/claims/contextClaims.schema.js +1 -1
  29. package/dist/schemas/lti13/claims/coreLtiClaims.schema.d.ts +1 -1
  30. package/dist/schemas/lti13/claims/coreLtiClaims.schema.d.ts.map +1 -1
  31. package/dist/schemas/lti13/claims/coreLtiClaims.schema.js +1 -1
  32. package/dist/schemas/lti13/claims/platformClaims.schema.d.ts +1 -1
  33. package/dist/schemas/lti13/claims/platformClaims.schema.d.ts.map +1 -1
  34. package/dist/schemas/lti13/claims/platformClaims.schema.js +1 -1
  35. package/dist/schemas/lti13/claims/privacyClaims.schema.d.ts +1 -1
  36. package/dist/schemas/lti13/claims/privacyClaims.schema.d.ts.map +1 -1
  37. package/dist/schemas/lti13/claims/privacyClaims.schema.js +1 -1
  38. package/dist/schemas/lti13/claims/serviceClaims.schema.d.ts +1 -1
  39. package/dist/schemas/lti13/claims/serviceClaims.schema.d.ts.map +1 -1
  40. package/dist/schemas/lti13/claims/serviceClaims.schema.js +1 -1
  41. package/dist/schemas/lti13/lti13JwtPayload.schema.d.ts +1 -1
  42. package/dist/schemas/lti13/lti13JwtPayload.schema.d.ts.map +1 -1
  43. package/dist/schemas/lti13/lti13JwtPayload.schema.js +1 -1
  44. package/dist/schemas/lti13/lti13Launch.schema.d.ts +1 -1
  45. package/dist/schemas/lti13/lti13Launch.schema.d.ts.map +1 -1
  46. package/dist/schemas/lti13/lti13Launch.schema.js +1 -1
  47. package/dist/schemas/lti13/lti13Login.schema.d.ts +1 -1
  48. package/dist/schemas/lti13/lti13Login.schema.d.ts.map +1 -1
  49. package/dist/schemas/lti13/lti13Login.schema.js +1 -1
  50. package/dist/schemas/lti13/nrps/contextMembership.schema.d.ts +65 -0
  51. package/dist/schemas/lti13/nrps/contextMembership.schema.d.ts.map +1 -0
  52. package/dist/schemas/lti13/nrps/contextMembership.schema.js +47 -0
  53. package/dist/services/ags.service.d.ts +86 -0
  54. package/dist/services/ags.service.d.ts.map +1 -1
  55. package/dist/services/ags.service.js +184 -8
  56. package/dist/services/nrps.service.d.ts +28 -0
  57. package/dist/services/nrps.service.d.ts.map +1 -0
  58. package/dist/services/nrps.service.js +51 -0
  59. package/dist/services/token.service.d.ts.map +1 -1
  60. package/dist/services/token.service.js +2 -1
  61. package/package.json +1 -1
  62. package/src/ltiTool.ts +195 -5
  63. package/src/schemas/client.schema.ts +1 -1
  64. package/src/schemas/common.schema.ts +1 -1
  65. package/src/schemas/deployment.schema.ts +1 -1
  66. package/src/schemas/lti13/ags/lineItem.schema.ts +85 -0
  67. package/src/schemas/lti13/ags/result.schema.ts +55 -0
  68. package/src/schemas/lti13/ags/scoreSubmission.schema.ts +3 -1
  69. package/src/schemas/lti13/claims/baseJwtClaims.schema.ts +1 -1
  70. package/src/schemas/lti13/claims/contextClaims.schema.ts +1 -1
  71. package/src/schemas/lti13/claims/coreLtiClaims.schema.ts +1 -1
  72. package/src/schemas/lti13/claims/platformClaims.schema.ts +1 -1
  73. package/src/schemas/lti13/claims/privacyClaims.schema.ts +1 -1
  74. package/src/schemas/lti13/claims/serviceClaims.schema.ts +1 -1
  75. package/src/schemas/lti13/lti13JwtPayload.schema.ts +1 -1
  76. package/src/schemas/lti13/lti13Launch.schema.ts +1 -1
  77. package/src/schemas/lti13/lti13Login.schema.ts +1 -1
  78. package/src/schemas/lti13/nrps/contextMembership.schema.ts +55 -0
  79. package/src/services/ags.service.ts +253 -16
  80. package/src/services/nrps.service.ts +80 -0
  81. package/src/services/token.service.ts +4 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @lti-tool/core
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7c87338: Add NRPS implementation for retrieving course membership and user roles
8
+
9
+ ## 0.10.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 9cdc0c7: Add AGS implementation and refactor Hono integration to simple handler pattern
14
+
3
15
  ## 0.9.0
4
16
 
5
17
  ### Minor Changes
package/dist/ltiTool.d.ts CHANGED
@@ -4,7 +4,10 @@ import type { LTIConfig } from './interfaces/ltiConfig.js';
4
4
  import type { LTIDeployment } from './interfaces/ltiDeployment.js';
5
5
  import type { LTISession } from './interfaces/ltiSession.js';
6
6
  import { type LTI13JwtPayload } from './schemas/index.js';
7
- import type { ScoreSubmission } from './schemas/lti13/ags/scoreSubmission.schema.js';
7
+ import { type CreateLineItem, type LineItem, type LineItems, type UpdateLineItem } from './schemas/lti13/ags/lineItem.schema.js';
8
+ import { type Results } from './schemas/lti13/ags/result.schema.js';
9
+ import { type ScoreSubmission } from './schemas/lti13/ags/scoreSubmission.schema.js';
10
+ import { type Member } from './schemas/lti13/nrps/contextMembership.schema.js';
8
11
  /**
9
12
  * Main LTI 1.3 Tool implementation providing secure authentication, launch verification,
10
13
  * and LTI Advantage services integration.
@@ -35,6 +38,7 @@ export declare class LTITool {
35
38
  private logger;
36
39
  private tokenService;
37
40
  private agsService;
41
+ private nrpsService;
38
42
  /**
39
43
  * Creates a new LTI Tool instance.
40
44
  *
@@ -105,10 +109,91 @@ export declare class LTITool {
105
109
  *
106
110
  * @param session - Active LTI session containing AGS service endpoints
107
111
  * @param score - Score submission data including grade value and user ID
108
- * @returns Result of the score submission
109
112
  * @throws {Error} When AGS is not available or submission fails
110
113
  */
111
- submitScore(session: LTISession, score: ScoreSubmission): Promise<Response>;
114
+ submitScore(session: LTISession, score: ScoreSubmission): Promise<void>;
115
+ /**
116
+ * Retrieves all scores for a specific line item from the platform using Assignment and Grade Services (AGS).
117
+ *
118
+ * @param session - Active LTI session containing AGS service endpoints
119
+ * @returns Array of score submissions for the line item
120
+ * @throws {Error} When AGS is not available or request fails
121
+ *
122
+ * @example
123
+ * ```typescript
124
+ * const scores = await ltiTool.getScores(session);
125
+ * console.log('All scores:', scores.map(s => `${s.userId}: ${s.scoreGiven}`));
126
+ * ```
127
+ */
128
+ getScores(session: LTISession): Promise<Results>;
129
+ /**
130
+ * Retrieves line items (gradebook columns) from the platform using Assignment and Grade Services (AGS).
131
+ *
132
+ * @param session - Active LTI session containing AGS service endpoints
133
+ * @returns Array of line items from the platform
134
+ * @throws {Error} When AGS is not available or request fails
135
+ */
136
+ listLineItems(session: LTISession): Promise<LineItems>;
137
+ /**
138
+ * Retrieves a specific line item (gradebook column) from the platform using Assignment and Grade Services (AGS).
139
+ *
140
+ * @param session - Active LTI session containing AGS service endpoints
141
+ * @returns Line item data from the platform
142
+ * @throws {Error} When AGS is not available or request fails
143
+ */
144
+ getLineItem(session: LTISession): Promise<LineItem>;
145
+ /**
146
+ * Creates a new line item (gradebook column) on the platform using Assignment and Grade Services (AGS).
147
+ *
148
+ * @param session - Active LTI session containing AGS service endpoints
149
+ * @param createLineItem - Line item data including label, scoreMaximum, and optional metadata
150
+ * @returns Created line item with platform-generated ID and validated data
151
+ * @throws {Error} When AGS is not available, input validation fails, or creation fails
152
+ *
153
+ * @example
154
+ * ```typescript
155
+ * const newLineItem = await ltiTool.createLineItem(session, {
156
+ * label: 'Quiz 1',
157
+ * scoreMaximum: 100,
158
+ * tag: 'quiz',
159
+ * resourceId: 'quiz-001'
160
+ * });
161
+ * console.log('Created line item:', newLineItem.id);
162
+ * ```
163
+ */
164
+ createLineItem(session: LTISession, createLineItem: CreateLineItem): Promise<LineItem>;
165
+ /**
166
+ * Updates an existing line item (gradebook column) on the platform using Assignment and Grade Services (AGS).
167
+ *
168
+ * @param session - Active LTI session containing AGS service endpoints
169
+ * @param updateLineItem - Updated line item data including all required fields
170
+ * @returns Updated line item with validated data from the platform
171
+ * @throws {Error} When AGS is not available, input validation fails, or update fails
172
+ */
173
+ updateLineItem(session: LTISession, updateLineItem: UpdateLineItem): Promise<LineItem>;
174
+ /**
175
+ * Deletes a line item (gradebook column) from the platform using Assignment and Grade Services (AGS).
176
+ *
177
+ * @param session - Active LTI session containing AGS service endpoints
178
+ * @throws {Error} When AGS is not available or deletion fails
179
+ */
180
+ deleteLineItem(session: LTISession): Promise<void>;
181
+ /**
182
+ * Retrieves course/context members using Names and Role Provisioning Services (NRPS).
183
+ *
184
+ * @param session - Active LTI session containing NRPS service endpoints
185
+ * @returns Array of members with clean camelCase properties
186
+ * @throws {Error} When NRPS is not available or request fails
187
+ *
188
+ * @example
189
+ * ```typescript
190
+ * const members = await ltiTool.getMembers(session);
191
+ * const instructors = members.filter(m =>
192
+ * m.roles.some(role => role.includes('Instructor'))
193
+ * );
194
+ * ```
195
+ */
196
+ getMembers(session: LTISession): Promise<Member[]>;
112
197
  /**
113
198
  * Retrieves all configured LTI client platforms.
114
199
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ltiTool.d.ts","sourceRoot":"","sources":["../src/ltiTool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAEL,KAAK,eAAe,EAIrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAC;AAMrF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,OAAO;IAYN,OAAO,CAAC,MAAM;IAX1B,4DAA4D;IAC5D,OAAO,CAAC,SAAS,CAA4D;IAC7E,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,UAAU,CAAa;IAE/B;;;;OAIG;gBACiB,MAAM,EAAE,SAAS;IAiBrC;;;;;;;;;;;;;OAaG;IACG,WAAW,CAAC,MAAM,EAAE;QACxB,SAAS,EAAE,MAAM,CAAC;QAClB,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,GAAG,GAAG,MAAM,CAAC;QACxB,UAAU,EAAE,MAAM,CAAC;QACnB,eAAe,EAAE,MAAM,CAAC;QACxB,iBAAiB,EAAE,M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M,EAChB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAIrC;;;;;;OAMG;IACG,aAAa,CACjB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,GACpC,OAAO,CAAC,MAAM,CAAC;IAIlB;;;;;;OAMG;IACG,gBAAgB,CACpB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;;OAKG;IACG,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG9E"}
package/dist/ltiTool.js CHANGED
@@ -1,7 +1,11 @@
1
- import { SignJWT, createRemoteJWKSet, decodeJwt, exportJWK, jwtVerify } from 'jose';
1
+ import { createRemoteJWKSet, decodeJwt, exportJWK, jwtVerify, SignJWT } from 'jose';
2
2
  import { AddClientSchema, UpdateClientSchema } from './schemas/client.schema.js';
3
3
  import { HandleLoginParamsSchema, LTI13JwtPayloadSchema, SessionIdSchema, VerifyLaunchParamsSchema, } from './schemas/index.js';
4
+ import { LineItemSchema, LineItemsSchema, } from './schemas/lti13/ags/lineItem.schema.js';
5
+ import { ResultsSchema } from './schemas/lti13/ags/result.schema.js';
6
+ import { NRPSContextMembershipResponseSchema, } from './schemas/lti13/nrps/contextMembership.schema.js';
4
7
  import { AGSService } from './services/ags.service.js';
8
+ import { NRPSService } from './services/nrps.service.js';
5
9
  import { createSession } from './services/session.service.js';
6
10
  import { TokenService } from './services/token.service.js';
7
11
  import { getValidLaunchConfig } from './utils/launchConfigValidation.js';
@@ -35,6 +39,7 @@ export class LTITool {
35
39
  logger;
36
40
  tokenService;
37
41
  agsService;
42
+ nrpsService;
38
43
  /**
39
44
  * Creates a new LTI Tool instance.
40
45
  *
@@ -52,6 +57,7 @@ export class LTITool {
52
57
  };
53
58
  this.tokenService = new TokenService(this.config.keyPair, this.config.security?.keyId ?? 'main');
54
59
  this.agsService = new AGSService(this.tokenService, this.config.storage, this.logger);
60
+ this.nrpsService = new NRPSService(this.tokenService, this.config.storage, this.logger);
55
61
  }
56
62
  /**
57
63
  * Handles LTI 1.3 login initiation by generating state/nonce and redirecting to platform auth.
@@ -195,7 +201,6 @@ export class LTITool {
195
201
  *
196
202
  * @param session - Active LTI session containing AGS service endpoints
197
203
  * @param score - Score submission data including grade value and user ID
198
- * @returns Result of the score submission
199
204
  * @throws {Error} When AGS is not available or submission fails
200
205
  */
201
206
  async submitScore(session, score) {
@@ -205,7 +210,156 @@ export class LTITool {
205
210
  if (!score) {
206
211
  throw new Error('score is required');
207
212
  }
208
- return await this.agsService.submitScore(session, score);
213
+ await this.agsService.submitScore(session, score);
214
+ }
215
+ /**
216
+ * Retrieves all scores for a specific line item from the platform using Assignment and Grade Services (AGS).
217
+ *
218
+ * @param session - Active LTI session containing AGS service endpoints
219
+ * @returns Array of score submissions for the line item
220
+ * @throws {Error} When AGS is not available or request fails
221
+ *
222
+ * @example
223
+ * ```typescript
224
+ * const scores = await ltiTool.getScores(session);
225
+ * console.log('All scores:', scores.map(s => `${s.userId}: ${s.scoreGiven}`));
226
+ * ```
227
+ */
228
+ async getScores(session) {
229
+ if (!session) {
230
+ throw new Error('session is required');
231
+ }
232
+ const response = await this.agsService.getScores(session);
233
+ const data = await response.json();
234
+ return ResultsSchema.parse(data);
235
+ }
236
+ /**
237
+ * Retrieves line items (gradebook columns) from the platform using Assignment and Grade Services (AGS).
238
+ *
239
+ * @param session - Active LTI session containing AGS service endpoints
240
+ * @returns Array of line items from the platform
241
+ * @throws {Error} When AGS is not available or request fails
242
+ */
243
+ async listLineItems(session) {
244
+ if (!session) {
245
+ throw new Error('session is required');
246
+ }
247
+ const response = await this.agsService.listLineItems(session);
248
+ const data = await response.json();
249
+ return LineItemsSchema.parse(data);
250
+ }
251
+ /**
252
+ * Retrieves a specific line item (gradebook column) from the platform using Assignment and Grade Services (AGS).
253
+ *
254
+ * @param session - Active LTI session containing AGS service endpoints
255
+ * @returns Line item data from the platform
256
+ * @throws {Error} When AGS is not available or request fails
257
+ */
258
+ async getLineItem(session) {
259
+ if (!session) {
260
+ throw new Error('session is required');
261
+ }
262
+ const response = await this.agsService.getLineItem(session);
263
+ const data = await response.json();
264
+ return LineItemSchema.parse(data);
265
+ }
266
+ /**
267
+ * Creates a new line item (gradebook column) on the platform using Assignment and Grade Services (AGS).
268
+ *
269
+ * @param session - Active LTI session containing AGS service endpoints
270
+ * @param createLineItem - Line item data including label, scoreMaximum, and optional metadata
271
+ * @returns Created line item with platform-generated ID and validated data
272
+ * @throws {Error} When AGS is not available, input validation fails, or creation fails
273
+ *
274
+ * @example
275
+ * ```typescript
276
+ * const newLineItem = await ltiTool.createLineItem(session, {
277
+ * label: 'Quiz 1',
278
+ * scoreMaximum: 100,
279
+ * tag: 'quiz',
280
+ * resourceId: 'quiz-001'
281
+ * });
282
+ * console.log('Created line item:', newLineItem.id);
283
+ * ```
284
+ */
285
+ async createLineItem(session, createLineItem) {
286
+ if (!session) {
287
+ throw new Error('session is required');
288
+ }
289
+ if (!createLineItem) {
290
+ throw new Error('createLineItem is required');
291
+ }
292
+ const response = await this.agsService.createLineItem(session, createLineItem);
293
+ const data = await response.json();
294
+ return LineItemSchema.parse(data);
295
+ }
296
+ /**
297
+ * Updates an existing line item (gradebook column) on the platform using Assignment and Grade Services (AGS).
298
+ *
299
+ * @param session - Active LTI session containing AGS service endpoints
300
+ * @param updateLineItem - Updated line item data including all required fields
301
+ * @returns Updated line item with validated data from the platform
302
+ * @throws {Error} When AGS is not available, input validation fails, or update fails
303
+ */
304
+ async updateLineItem(session, updateLineItem) {
305
+ if (!session) {
306
+ throw new Error('session is required');
307
+ }
308
+ if (!updateLineItem) {
309
+ throw new Error('lineItem is required');
310
+ }
311
+ const response = await this.agsService.updateLineItem(session, updateLineItem);
312
+ const data = await response.json();
313
+ return LineItemSchema.parse(data);
314
+ }
315
+ /**
316
+ * Deletes a line item (gradebook column) from the platform using Assignment and Grade Services (AGS).
317
+ *
318
+ * @param session - Active LTI session containing AGS service endpoints
319
+ * @throws {Error} When AGS is not available or deletion fails
320
+ */
321
+ async deleteLineItem(session) {
322
+ if (!session) {
323
+ throw new Error('session is required');
324
+ }
325
+ await this.agsService.deleteLineItem(session);
326
+ }
327
+ /**
328
+ * Retrieves course/context members using Names and Role Provisioning Services (NRPS).
329
+ *
330
+ * @param session - Active LTI session containing NRPS service endpoints
331
+ * @returns Array of members with clean camelCase properties
332
+ * @throws {Error} When NRPS is not available or request fails
333
+ *
334
+ * @example
335
+ * ```typescript
336
+ * const members = await ltiTool.getMembers(session);
337
+ * const instructors = members.filter(m =>
338
+ * m.roles.some(role => role.includes('Instructor'))
339
+ * );
340
+ * ```
341
+ */
342
+ async getMembers(session) {
343
+ if (!session) {
344
+ throw new Error('session is required');
345
+ }
346
+ const response = await this.nrpsService.getMembers(session);
347
+ const data = await response.json();
348
+ console.log(data);
349
+ const validated = NRPSContextMembershipResponseSchema.parse(data);
350
+ // Transform to clean camelCase format
351
+ return validated.members.map((member) => ({
352
+ status: member.status,
353
+ name: member.name,
354
+ picture: member.picture,
355
+ givenName: member.given_name,
356
+ familyName: member.family_name,
357
+ middleName: member.middle_name,
358
+ email: member.email,
359
+ userId: member.user_id,
360
+ lisPersonSourcedId: member.lis_person_sourcedid,
361
+ roles: member.roles,
362
+ }));
209
363
  }
210
364
  // Client management
211
365
  /**
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import * as z from 'zod';
2
2
  export declare const ClientSchema: z.ZodObject<{
3
3
  id: z.ZodUUID;
4
4
  name: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"client.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/client.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;iBASvB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;iBAAqD,CAAC;AAClF,eAAO,MAAM,kBAAkB;;;;;;;iBAAqD,CAAC"}
1
+ {"version":3,"file":"client.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/client.schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAIzB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;iBASvB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;iBAAqD,CAAC;AAClF,eAAO,MAAM,kBAAkB;;;;;;;iBAAqD,CAAC"}
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import * as z from 'zod';
2
2
  import { DeploymentSchema } from './deployment.schema';
3
3
  export const ClientSchema = z.object({
4
4
  id: z.uuid().describe('Internal stable UUID for the client'),
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import * as z from 'zod';
2
2
  /**
3
3
  * Common validation schemas used across the LTI tool
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"common.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/common.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AAEH,eAAO,MAAM,eAAe,aAA6C,CAAC"}
1
+ {"version":3,"file":"common.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/common.schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB;;GAEG;AAEH,eAAO,MAAM,eAAe,aAA6C,CAAC"}
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import * as z from 'zod';
2
2
  /**
3
3
  * Common validation schemas used across the LTI tool
4
4
  */
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import * as z from 'zod';
2
2
  export declare const DeploymentSchema: z.ZodObject<{
3
3
  id: z.ZodUUID;
4
4
  deploymentId: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"deployment.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/deployment.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;;;iBAS3B,CAAC"}
1
+ {"version":3,"file":"deployment.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/deployment.schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,eAAO,MAAM,gBAAgB;;;;;iBAS3B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import * as z from 'zod';
2
2
  export const DeploymentSchema = z.object({
3
3
  id: z.uuid().describe('Internal stable UUID for this deployment configuration'),
4
4
  deploymentId: z.string().min(1).describe('LMS-provided deployment identifier'),
@@ -0,0 +1,80 @@
1
+ import * as z from 'zod';
2
+ /**
3
+ * Schema for LTI Assignment and Grade Services (AGS) Line Item.
4
+ * Represents a gradebook column/assignment according to LTI AGS v2.0 specification.
5
+ *
6
+ * @see https://www.imsglobal.org/spec/lti-ags/v2p0/#line-item-service
7
+ */
8
+ export declare const LineItemSchema: z.ZodObject<{
9
+ id: z.ZodURL;
10
+ scoreMaximum: z.ZodNumber;
11
+ label: z.ZodString;
12
+ resourceId: z.ZodOptional<z.ZodString>;
13
+ resourceLinkId: z.ZodOptional<z.ZodString>;
14
+ tag: z.ZodOptional<z.ZodString>;
15
+ startDateTime: z.ZodOptional<z.ZodISODateTime>;
16
+ endDateTime: z.ZodOptional<z.ZodISODateTime>;
17
+ }, z.core.$strip>;
18
+ /**
19
+ * Schema for creating a new LTI Assignment and Grade Services (AGS) Line Item.
20
+ * Omits the 'id' field since it's generated by the platform upon creation.
21
+ *
22
+ * @see https://www.imsglobal.org/spec/lti-ags/v2p0/#line-item-service
23
+ */
24
+ export declare const CreateLineItemSchema: z.ZodObject<{
25
+ label: z.ZodString;
26
+ scoreMaximum: z.ZodNumber;
27
+ resourceId: z.ZodOptional<z.ZodString>;
28
+ resourceLinkId: z.ZodOptional<z.ZodString>;
29
+ tag: z.ZodOptional<z.ZodString>;
30
+ startDateTime: z.ZodOptional<z.ZodISODateTime>;
31
+ endDateTime: z.ZodOptional<z.ZodISODateTime>;
32
+ }, z.core.$strip>;
33
+ /**
34
+ * Schema for updating an existing LTI Assignment and Grade Services (AGS) Line Item.
35
+ * Omits 'id' and 'resourceLinkId' fields as they are immutable per LTI AGS specification.
36
+ * Tools MUST NOT change these values during updates.
37
+ *
38
+ * @see https://www.imsglobal.org/spec/lti-ags/v2p0/#line-item-service
39
+ */
40
+ export declare const UpdateLineItemSchema: z.ZodObject<{
41
+ label: z.ZodString;
42
+ scoreMaximum: z.ZodNumber;
43
+ resourceId: z.ZodOptional<z.ZodString>;
44
+ tag: z.ZodOptional<z.ZodString>;
45
+ startDateTime: z.ZodOptional<z.ZodISODateTime>;
46
+ endDateTime: z.ZodOptional<z.ZodISODateTime>;
47
+ }, z.core.$strip>;
48
+ /**
49
+ * Schema for an array of line items returned from the line items service.
50
+ */
51
+ export declare const LineItemsSchema: z.ZodArray<z.ZodObject<{
52
+ id: z.ZodURL;
53
+ scoreMaximum: z.ZodNumber;
54
+ label: z.ZodString;
55
+ resourceId: z.ZodOptional<z.ZodString>;
56
+ resourceLinkId: z.ZodOptional<z.ZodString>;
57
+ tag: z.ZodOptional<z.ZodString>;
58
+ startDateTime: z.ZodOptional<z.ZodISODateTime>;
59
+ endDateTime: z.ZodOptional<z.ZodISODateTime>;
60
+ }, z.core.$strip>>;
61
+ /**
62
+ * Type representing a validated line item for LTI AGS.
63
+ * Represents a gradebook column or assignment.
64
+ */
65
+ export type LineItem = z.infer<typeof LineItemSchema>;
66
+ /**
67
+ * Type representing an array of line items.
68
+ */
69
+ export type LineItems = z.infer<typeof LineItemsSchema>;
70
+ /**
71
+ * Type representing data required to create a new line item for LTI AGS.
72
+ * Contains all LineItem fields except the platform-generated 'id'.
73
+ */
74
+ export type CreateLineItem = z.infer<typeof CreateLineItemSchema>;
75
+ /**
76
+ * Type representing data for updating an existing line item for LTI AGS.
77
+ * Contains all LineItem fields except immutable 'id' and 'resourceLinkId'.
78
+ */
79
+ export type UpdateLineItem = z.infer<typeof UpdateLineItemSchema>;
80
+ //# sourceMappingURL=lineItem.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lineItem.schema.d.ts","sourceRoot":"","sources":["../../../../src/schemas/lti13/ags/lineItem.schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;;;;;;;iBAwBzB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;iBAE/B,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;iBAG/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;kBAA0B,CAAC;AAIvD;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,49 @@
1
+ import * as z from 'zod';
2
+ /**
3
+ * Schema for LTI Assignment and Grade Services (AGS) Line Item.
4
+ * Represents a gradebook column/assignment according to LTI AGS v2.0 specification.
5
+ *
6
+ * @see https://www.imsglobal.org/spec/lti-ags/v2p0/#line-item-service
7
+ */
8
+ export const LineItemSchema = z.object({
9
+ /** Unique identifier for the line item */
10
+ id: z.url(),
11
+ /** Maximum score possible for this line item */
12
+ scoreMaximum: z.number().min(0),
13
+ /** Human-readable label for the line item */
14
+ label: z.string(),
15
+ /** Optional resource identifier that this line item is associated with */
16
+ resourceId: z.string().optional(),
17
+ /** Optional resource link identifier */
18
+ resourceLinkId: z.string().optional(),
19
+ /** Optional tag to identify the line item */
20
+ tag: z.string().optional(),
21
+ /** Optional start date/time for the assignment */
22
+ startDateTime: z.iso.datetime().optional(),
23
+ /** Optional end date/time for the assignment */
24
+ endDateTime: z.iso.datetime().optional(),
25
+ });
26
+ /**
27
+ * Schema for creating a new LTI Assignment and Grade Services (AGS) Line Item.
28
+ * Omits the 'id' field since it's generated by the platform upon creation.
29
+ *
30
+ * @see https://www.imsglobal.org/spec/lti-ags/v2p0/#line-item-service
31
+ */
32
+ export const CreateLineItemSchema = LineItemSchema.omit({
33
+ id: true,
34
+ });
35
+ /**
36
+ * Schema for updating an existing LTI Assignment and Grade Services (AGS) Line Item.
37
+ * Omits 'id' and 'resourceLinkId' fields as they are immutable per LTI AGS specification.
38
+ * Tools MUST NOT change these values during updates.
39
+ *
40
+ * @see https://www.imsglobal.org/spec/lti-ags/v2p0/#line-item-service
41
+ */
42
+ export const UpdateLineItemSchema = LineItemSchema.omit({
43
+ id: true,
44
+ resourceLinkId: true,
45
+ });
46
+ /**
47
+ * Schema for an array of line items returned from the line items service.
48
+ */
49
+ export const LineItemsSchema = z.array(LineItemSchema);
@@ -0,0 +1,65 @@
1
+ import * as z from 'zod';
2
+ /**
3
+ * Schema for LTI Assignment and Grade Services (AGS) Result.
4
+ * Results contain richer metadata than scores, including user info and timestamps.
5
+ *
6
+ * @see https://www.imsglobal.org/spec/lti-ags/v2p0/#result-service
7
+ */
8
+ export declare const ResultSchema: z.ZodObject<{
9
+ id: z.ZodString;
10
+ scoreOf: z.ZodURL;
11
+ userId: z.ZodString;
12
+ resultScore: z.ZodOptional<z.ZodNumber>;
13
+ resultMaximum: z.ZodOptional<z.ZodNumber>;
14
+ comment: z.ZodOptional<z.ZodString>;
15
+ timestamp: z.ZodOptional<z.ZodISODateTime>;
16
+ activityProgress: z.ZodOptional<z.ZodEnum<{
17
+ Initialized: "Initialized";
18
+ Started: "Started";
19
+ InProgress: "InProgress";
20
+ Submitted: "Submitted";
21
+ Completed: "Completed";
22
+ }>>;
23
+ gradingProgress: z.ZodOptional<z.ZodEnum<{
24
+ FullyGraded: "FullyGraded";
25
+ Pending: "Pending";
26
+ PendingManual: "PendingManual";
27
+ Failed: "Failed";
28
+ NotReady: "NotReady";
29
+ }>>;
30
+ }, z.core.$strip>;
31
+ /**
32
+ * Schema for an array of results returned from the results service.
33
+ */
34
+ export declare const ResultsSchema: z.ZodArray<z.ZodObject<{
35
+ id: z.ZodString;
36
+ scoreOf: z.ZodURL;
37
+ userId: z.ZodString;
38
+ resultScore: z.ZodOptional<z.ZodNumber>;
39
+ resultMaximum: z.ZodOptional<z.ZodNumber>;
40
+ comment: z.ZodOptional<z.ZodString>;
41
+ timestamp: z.ZodOptional<z.ZodISODateTime>;
42
+ activityProgress: z.ZodOptional<z.ZodEnum<{
43
+ Initialized: "Initialized";
44
+ Started: "Started";
45
+ InProgress: "InProgress";
46
+ Submitted: "Submitted";
47
+ Completed: "Completed";
48
+ }>>;
49
+ gradingProgress: z.ZodOptional<z.ZodEnum<{
50
+ FullyGraded: "FullyGraded";
51
+ Pending: "Pending";
52
+ PendingManual: "PendingManual";
53
+ Failed: "Failed";
54
+ NotReady: "NotReady";
55
+ }>>;
56
+ }, z.core.$strip>>;
57
+ /**
58
+ * Type representing a validated result for LTI AGS.
59
+ */
60
+ export type Result = z.infer<typeof ResultSchema>;
61
+ /**
62
+ * Type representing an array of results.
63
+ */
64
+ export type Results = z.infer<typeof ResultsSchema>;
65
+ //# sourceMappingURL=result.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.schema.d.ts","sourceRoot":"","sources":["../../../../src/schemas/lti13/ags/result.schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;iBA+BvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;kBAAwB,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -0,0 +1,35 @@
1
+ import * as z from 'zod';
2
+ /**
3
+ * Schema for LTI Assignment and Grade Services (AGS) Result.
4
+ * Results contain richer metadata than scores, including user info and timestamps.
5
+ *
6
+ * @see https://www.imsglobal.org/spec/lti-ags/v2p0/#result-service
7
+ */
8
+ export const ResultSchema = z.object({
9
+ /** Unique identifier for the result */
10
+ id: z.string(),
11
+ /** Score of the result, represented as a URL */
12
+ scoreOf: z.url(),
13
+ /** URL identifying the Line Item to which this result belongs. */
14
+ userId: z.string(),
15
+ /** The score given to the user */
16
+ resultScore: z.number().optional(),
17
+ /** Maximum possible score */
18
+ resultMaximum: z.number().optional(),
19
+ /** Comment associated with the result */
20
+ comment: z.string().optional(),
21
+ /** Timestamp when the result was recorded */
22
+ timestamp: z.iso.datetime({ offset: true }).optional(),
23
+ /** Activity progress status */
24
+ activityProgress: z
25
+ .enum(['Initialized', 'Started', 'InProgress', 'Submitted', 'Completed'])
26
+ .optional(),
27
+ /** Grading progress status */
28
+ gradingProgress: z
29
+ .enum(['FullyGraded', 'Pending', 'PendingManual', 'Failed', 'NotReady'])
30
+ .optional(),
31
+ });
32
+ /**
33
+ * Schema for an array of results returned from the results service.
34
+ */
35
+ export const ResultsSchema = z.array(ResultSchema);