@timeback/qti 0.1.2 → 0.1.4
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/dist/client.d.ts +8 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/errors.d.ts +1 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +433 -39
- package/dist/index.d.ts +1414 -23
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +539 -141
- package/dist/public-types.d.ts +570 -0
- package/dist/public-types.d.ts.map +1 -0
- package/package.json +5 -4
- /package/dist/{types.js → public-types.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,33 +1,1363 @@
|
|
|
1
|
+
import * as _timeback_internal_client_infra from '@timeback/internal-client-infra';
|
|
2
|
+
import { RequestOptions, PaginatedResponse, ClientConfig, TransportOnlyConfig, ProviderClientConfig, Paginator as Paginator$1, ListParams, BaseTransport, BaseTransportConfig, ProviderRegistry, TimebackProvider, AuthCheckResult } from '@timeback/internal-client-infra';
|
|
3
|
+
export { AuthCheckResult, EnvAuth, Environment, ExplicitAuth, ListParams, PageResult } from '@timeback/internal-client-infra';
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
|
-
*
|
|
6
|
+
* API Response Types
|
|
3
7
|
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
* Types for QTI API responses.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
12
|
+
// LIST RESPONSE
|
|
13
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Paginated list response from QTI API.
|
|
17
|
+
*
|
|
18
|
+
* QTI returns pagination metadata directly in the response body alongside items.
|
|
19
|
+
*/
|
|
20
|
+
interface ListResponse<T> {
|
|
21
|
+
/** Array of items in this page */
|
|
22
|
+
items: T[]
|
|
23
|
+
/** Total items across all pages */
|
|
24
|
+
total: number
|
|
25
|
+
/** Current page number (1-indexed) */
|
|
26
|
+
page: number
|
|
27
|
+
/** Total number of pages */
|
|
28
|
+
pages: number
|
|
29
|
+
/** Items per page */
|
|
30
|
+
limit: number
|
|
31
|
+
/** Sort field */
|
|
32
|
+
sort: string
|
|
33
|
+
/** Sort order */
|
|
34
|
+
order: 'asc' | 'desc'
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
38
|
+
// DELETE RESPONSE
|
|
39
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Response from DELETE operations.
|
|
43
|
+
*/
|
|
44
|
+
interface DeleteResponse {
|
|
45
|
+
message: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Base Types
|
|
50
|
+
*
|
|
51
|
+
* Common types shared across QTI resources.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
55
|
+
// ENUMS
|
|
56
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Assessment item interaction types.
|
|
60
|
+
*/
|
|
61
|
+
type AssessmentItemType =
|
|
62
|
+
| 'choice'
|
|
63
|
+
| 'text-entry'
|
|
64
|
+
| 'extended-text'
|
|
65
|
+
| 'inline-choice'
|
|
66
|
+
| 'match'
|
|
67
|
+
| 'order'
|
|
68
|
+
| 'associate'
|
|
69
|
+
| 'select-point'
|
|
70
|
+
| 'graphic-order'
|
|
71
|
+
| 'graphic-associate'
|
|
72
|
+
| 'graphic-gap-match'
|
|
73
|
+
| 'hotspot'
|
|
74
|
+
| 'hottext'
|
|
75
|
+
| 'slider'
|
|
76
|
+
| 'drawing'
|
|
77
|
+
| 'media'
|
|
78
|
+
| 'upload'
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Cardinality of a response or outcome variable.
|
|
82
|
+
*/
|
|
83
|
+
type Cardinality = 'single' | 'multiple' | 'ordered' | 'record'
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Base type of a response or outcome variable.
|
|
87
|
+
*/
|
|
88
|
+
type BaseType =
|
|
89
|
+
| 'identifier'
|
|
90
|
+
| 'boolean'
|
|
91
|
+
| 'integer'
|
|
92
|
+
| 'float'
|
|
93
|
+
| 'string'
|
|
94
|
+
| 'point'
|
|
95
|
+
| 'pair'
|
|
96
|
+
| 'directedPair'
|
|
97
|
+
| 'duration'
|
|
98
|
+
| 'file'
|
|
99
|
+
| 'uri'
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Difficulty level for assessment items.
|
|
103
|
+
*/
|
|
104
|
+
type Difficulty = 'easy' | 'medium' | 'hard'
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Grade level (K-12 + pre-K as -1).
|
|
108
|
+
*/
|
|
109
|
+
type Grade = -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Navigation mode for test parts.
|
|
113
|
+
*/
|
|
114
|
+
type NavigationMode = 'linear' | 'nonlinear'
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Submission mode for test parts.
|
|
118
|
+
*/
|
|
119
|
+
type SubmissionMode = 'individual' | 'simultaneous'
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Show/hide indicator for feedback.
|
|
123
|
+
*/
|
|
124
|
+
type ShowHide = 'show' | 'hide'
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Feedback type.
|
|
128
|
+
*/
|
|
129
|
+
type FeedbackType = 'QUESTION' | 'LESSON'
|
|
130
|
+
|
|
131
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
132
|
+
// COMMON STRUCTURES
|
|
133
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Correct response value.
|
|
137
|
+
*/
|
|
138
|
+
interface CorrectResponse {
|
|
139
|
+
value: string[]
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Response declaration for assessment items.
|
|
144
|
+
*/
|
|
145
|
+
interface ResponseDeclaration {
|
|
146
|
+
identifier: string
|
|
147
|
+
cardinality: Cardinality
|
|
148
|
+
baseType?: BaseType
|
|
149
|
+
correctResponse: CorrectResponse
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Outcome declaration for items and tests.
|
|
154
|
+
*/
|
|
155
|
+
interface OutcomeDeclaration {
|
|
156
|
+
identifier: string
|
|
157
|
+
cardinality: Cardinality
|
|
158
|
+
baseType?: BaseType
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Test outcome declaration with additional properties.
|
|
163
|
+
*/
|
|
164
|
+
interface TestOutcomeDeclaration {
|
|
165
|
+
identifier: string
|
|
166
|
+
cardinality?: Cardinality
|
|
167
|
+
baseType: BaseType
|
|
168
|
+
normalMaximum?: number
|
|
169
|
+
normalMinimum?: number
|
|
170
|
+
defaultValue?: {
|
|
171
|
+
value?: unknown
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Inline feedback configuration.
|
|
177
|
+
*/
|
|
178
|
+
interface InlineFeedback {
|
|
179
|
+
outcomeIdentifier: string
|
|
180
|
+
variableIdentifier: string
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Response processing configuration.
|
|
185
|
+
*/
|
|
186
|
+
interface ResponseProcessing {
|
|
187
|
+
templateType: 'match_correct' | 'map_response'
|
|
188
|
+
responseDeclarationIdentifier: string
|
|
189
|
+
outcomeIdentifier: string
|
|
190
|
+
correctResponseIdentifier: string
|
|
191
|
+
incorrectResponseIdentifier: string
|
|
192
|
+
inlineFeedback?: InlineFeedback
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Learning objective set for metadata.
|
|
197
|
+
*/
|
|
198
|
+
interface LearningObjectiveSet {
|
|
199
|
+
source: string
|
|
200
|
+
learningObjectiveIds: string[]
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Item metadata.
|
|
205
|
+
*/
|
|
206
|
+
interface ItemMetadata {
|
|
207
|
+
subject?: string
|
|
208
|
+
grade?: Grade
|
|
209
|
+
difficulty?: Difficulty
|
|
210
|
+
learningObjectiveSet?: LearningObjectiveSet[]
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Modal feedback element.
|
|
215
|
+
*/
|
|
216
|
+
interface ModalFeedback {
|
|
217
|
+
outcomeIdentifier: string
|
|
218
|
+
identifier: string
|
|
219
|
+
showHide: ShowHide
|
|
220
|
+
content: string
|
|
221
|
+
title: string
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Inline feedback element.
|
|
226
|
+
*/
|
|
227
|
+
interface FeedbackInline {
|
|
228
|
+
outcomeIdentifier: string
|
|
229
|
+
identifier: string
|
|
230
|
+
showHide: ShowHide
|
|
231
|
+
content: string
|
|
232
|
+
class: string[]
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Block feedback element.
|
|
237
|
+
*/
|
|
238
|
+
interface FeedbackBlock {
|
|
239
|
+
outcomeIdentifier: string
|
|
240
|
+
identifier: string
|
|
241
|
+
showHide: ShowHide
|
|
242
|
+
content: string
|
|
243
|
+
class: string[]
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Stylesheet reference.
|
|
248
|
+
*/
|
|
249
|
+
interface Stylesheet {
|
|
250
|
+
href: string
|
|
251
|
+
type: string
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Catalog info entry.
|
|
256
|
+
*/
|
|
257
|
+
interface CatalogInfo {
|
|
258
|
+
id: string
|
|
259
|
+
support: string
|
|
260
|
+
content: string
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Assessment Items Types
|
|
265
|
+
*
|
|
266
|
+
* Types for QTI assessment item resources.
|
|
267
|
+
*/
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
272
|
+
// ASSESSMENT ITEM
|
|
273
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Assessment item entity.
|
|
277
|
+
*/
|
|
278
|
+
interface AssessmentItem {
|
|
279
|
+
identifier: string
|
|
280
|
+
title: string
|
|
281
|
+
type: AssessmentItemType
|
|
282
|
+
qtiVersion: string
|
|
283
|
+
timeDependent: boolean
|
|
284
|
+
adaptive: boolean
|
|
285
|
+
responseDeclarations?: ResponseDeclaration[]
|
|
286
|
+
outcomeDeclarations?: OutcomeDeclaration[]
|
|
287
|
+
responseProcessing?: ResponseProcessing
|
|
288
|
+
metadata?: ItemMetadata
|
|
289
|
+
/** Raw QTI XML string */
|
|
290
|
+
rawXml: string
|
|
291
|
+
/**
|
|
292
|
+
* Parsed XML→JSON content.
|
|
293
|
+
* Structure varies by item type.
|
|
294
|
+
*/
|
|
295
|
+
content: Record<string, unknown>
|
|
296
|
+
modalFeedback?: ModalFeedback[]
|
|
297
|
+
feedbackInline?: FeedbackInline[]
|
|
298
|
+
feedbackBlock?: FeedbackBlock[]
|
|
299
|
+
createdAt: string
|
|
300
|
+
updatedAt: string
|
|
301
|
+
__v?: number
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Result of processing a response.
|
|
306
|
+
*/
|
|
307
|
+
interface ProcessResponseResult {
|
|
308
|
+
score: number
|
|
309
|
+
feedback: {
|
|
310
|
+
identifier: string
|
|
311
|
+
value: string
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
316
|
+
// SECTION ITEM REFERENCE
|
|
317
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Reference to an assessment item within a section.
|
|
321
|
+
*/
|
|
322
|
+
interface AssessmentItemRef {
|
|
323
|
+
identifier: string
|
|
324
|
+
/**
|
|
325
|
+
* Item reference href.
|
|
326
|
+
*
|
|
327
|
+
* The QTI docs show this field as `string` in most responses, but it can also
|
|
328
|
+
* appear as an array (and in one place, a nested array) in request/response
|
|
329
|
+
* examples for test-part payloads.
|
|
330
|
+
*/
|
|
331
|
+
href?: string | string[] | string[][]
|
|
332
|
+
sequence?: number
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
336
|
+
// SECTION
|
|
337
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Assessment section within a test part.
|
|
341
|
+
*/
|
|
342
|
+
interface AssessmentSection {
|
|
343
|
+
identifier: string
|
|
344
|
+
title: string
|
|
345
|
+
visible: boolean
|
|
346
|
+
required?: boolean
|
|
347
|
+
fixed?: boolean
|
|
348
|
+
sequence?: number
|
|
349
|
+
'qti-assessment-item-ref'?: AssessmentItemRef[]
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
353
|
+
// TEST PART
|
|
354
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Test part within an assessment test.
|
|
358
|
+
*/
|
|
359
|
+
interface TestPart {
|
|
360
|
+
identifier: string
|
|
361
|
+
navigationMode: NavigationMode
|
|
362
|
+
submissionMode: SubmissionMode
|
|
363
|
+
'qti-assessment-section': AssessmentSection | AssessmentSection[]
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
367
|
+
// ASSESSMENT TEST
|
|
368
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Assessment test entity.
|
|
372
|
+
*/
|
|
373
|
+
interface AssessmentTest {
|
|
374
|
+
identifier: string
|
|
375
|
+
title: string
|
|
376
|
+
qtiVersion: string
|
|
377
|
+
'qti-test-part': TestPart[]
|
|
378
|
+
'qti-outcome-declaration': TestOutcomeDeclaration[]
|
|
379
|
+
timeLimit?: number
|
|
380
|
+
maxAttempts?: number
|
|
381
|
+
toolsEnabled?: Record<string, boolean>
|
|
382
|
+
metadata?: Record<string, unknown>
|
|
383
|
+
/** Raw QTI XML string */
|
|
384
|
+
rawXml: string
|
|
385
|
+
/**
|
|
386
|
+
* Parsed XML→JSON content.
|
|
387
|
+
* Structure varies by test.
|
|
388
|
+
*/
|
|
389
|
+
content: Record<string, unknown>
|
|
390
|
+
createdAt: string
|
|
391
|
+
updatedAt: string
|
|
392
|
+
__v?: number
|
|
393
|
+
isValidXml?: boolean
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
397
|
+
// QUESTIONS RESPONSE
|
|
398
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Question reference within a test.
|
|
402
|
+
*/
|
|
403
|
+
interface QuestionReference {
|
|
404
|
+
identifier: string
|
|
405
|
+
href: string
|
|
406
|
+
testPart: string
|
|
407
|
+
section: string
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Question with full item details.
|
|
412
|
+
*/
|
|
413
|
+
interface QuestionWithItem {
|
|
414
|
+
reference: QuestionReference
|
|
415
|
+
question: AssessmentItem
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Response from GET /assessment-tests/{identifier}/questions.
|
|
420
|
+
*/
|
|
421
|
+
interface QuestionsResponse {
|
|
422
|
+
assessmentTest: string
|
|
423
|
+
title: string
|
|
424
|
+
totalQuestions: number
|
|
425
|
+
questions: QuestionWithItem[]
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Lesson Types
|
|
430
|
+
*
|
|
431
|
+
* Types for QTI lesson and question feedback resources.
|
|
432
|
+
*/
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
437
|
+
// LESSON FEEDBACK
|
|
438
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Lesson feedback entity.
|
|
442
|
+
*/
|
|
443
|
+
interface LessonFeedback {
|
|
444
|
+
questionId?: string
|
|
445
|
+
userId: string
|
|
446
|
+
feedback: string
|
|
447
|
+
type: FeedbackType
|
|
448
|
+
lessonId: string
|
|
449
|
+
humanApproved?: boolean | boolean[]
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Stimuli Types
|
|
7
454
|
*
|
|
455
|
+
* Types for QTI stimulus resources.
|
|
456
|
+
*/
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
461
|
+
// STIMULUS
|
|
462
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Stimulus entity.
|
|
466
|
+
*/
|
|
467
|
+
interface Stimulus {
|
|
468
|
+
identifier: string
|
|
469
|
+
title: string
|
|
470
|
+
label?: string
|
|
471
|
+
language?: string
|
|
472
|
+
stylesheet?: Stylesheet
|
|
473
|
+
catalogInfo: CatalogInfo[]
|
|
474
|
+
toolName?: string
|
|
475
|
+
toolVersion?: string
|
|
476
|
+
metadata?: Record<string, unknown>
|
|
477
|
+
/** Raw QTI XML string */
|
|
478
|
+
rawXml: string
|
|
479
|
+
/**
|
|
480
|
+
* Parsed XML→JSON content.
|
|
481
|
+
* Structure varies.
|
|
482
|
+
*/
|
|
483
|
+
content: Record<string, unknown>
|
|
484
|
+
createdAt: string
|
|
485
|
+
updatedAt: string
|
|
486
|
+
__v?: number
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Validation Types
|
|
491
|
+
*
|
|
492
|
+
* Types for QTI XML validation resources.
|
|
493
|
+
*/
|
|
494
|
+
|
|
495
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
496
|
+
// VALIDATION
|
|
497
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Single validation result.
|
|
501
|
+
*/
|
|
502
|
+
interface ValidationResult {
|
|
503
|
+
success: boolean
|
|
504
|
+
entityId: string
|
|
505
|
+
xmlContent: string
|
|
506
|
+
validationErrors: string[]
|
|
507
|
+
message: string
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Batch validation result.
|
|
512
|
+
*/
|
|
513
|
+
interface BatchValidationResult {
|
|
514
|
+
results: ValidationResult[]
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Transport interface for QTI client.
|
|
519
|
+
*
|
|
520
|
+
* Required when using transport mode with QtiClient.
|
|
521
|
+
*/
|
|
522
|
+
interface QtiTransportLike {
|
|
523
|
+
/** Base URL of the API */
|
|
524
|
+
baseUrl: string;
|
|
525
|
+
/** Make an authenticated request */
|
|
526
|
+
request<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
527
|
+
/** Make a paginated request */
|
|
528
|
+
requestPaginated<T>(path: string, options?: RequestOptions): Promise<PaginatedResponse<T>>;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* All supported QTI client configuration types.
|
|
532
|
+
*
|
|
533
|
+
* Supports four modes:
|
|
534
|
+
* - **Provider mode**: `{ provider: TimebackProvider }` — pre-built provider with token sharing
|
|
535
|
+
* - **Environment mode**: `{ platform?, env, auth }` — Timeback hosted APIs
|
|
536
|
+
* - **Explicit mode**: `{ baseUrl, auth: { authUrl } }` — custom API URLs
|
|
537
|
+
* - **Transport mode**: `{ transport }` — custom transport
|
|
538
|
+
*
|
|
539
|
+
* The `platform` field (in env mode) selects which Timeback implementation to use:
|
|
540
|
+
* - `'BEYOND_AI'` (default): BeyondAI's Timeback platform
|
|
541
|
+
* - `'LEARNWITH_AI'`: Samy's LearnWith.AI platform
|
|
542
|
+
*/
|
|
543
|
+
type QtiClientConfig = ClientConfig | TransportOnlyConfig<QtiTransportLike> | ProviderClientConfig;
|
|
544
|
+
/**
|
|
545
|
+
* Instance type of QtiClient.
|
|
546
|
+
*/
|
|
547
|
+
type QtiClientInstance = InstanceType<typeof QtiClient>;
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Pagination Utilities
|
|
551
|
+
*
|
|
552
|
+
* Re-exports the common Paginator with QTI-specific configuration.
|
|
553
|
+
*/
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* QTI-specific Paginator that uses page-based pagination.
|
|
557
|
+
*
|
|
558
|
+
* QTI APIs use `page` and `limit` params (1-indexed pages) instead of
|
|
559
|
+
* `offset` and `limit`. The base Paginator handles this via `paginationStyle: 'page'`.
|
|
560
|
+
*
|
|
561
|
+
* @typeParam T - The type of items being paginated
|
|
562
|
+
*/
|
|
563
|
+
declare class Paginator<T> extends Paginator$1<T> {
|
|
564
|
+
/**
|
|
565
|
+
* Create a new QTI Paginator.
|
|
566
|
+
*
|
|
567
|
+
* @param transport - QTI transport instance
|
|
568
|
+
* @param path - API endpoint path
|
|
569
|
+
* @param params - List parameters including optional max
|
|
570
|
+
*/
|
|
571
|
+
constructor(transport: QtiTransportLike, path: string, params?: ListParams);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Transport Layer
|
|
576
|
+
*
|
|
577
|
+
* HTTP transport for QTI API communication.
|
|
578
|
+
*/
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Configuration for QTI transport.
|
|
582
|
+
*/
|
|
583
|
+
type QtiTransportConfig = BaseTransportConfig;
|
|
584
|
+
/**
|
|
585
|
+
* HTTP transport layer for QTI API communication.
|
|
586
|
+
*
|
|
587
|
+
* Uses body-based pagination with page/limit params.
|
|
588
|
+
*/
|
|
589
|
+
declare class Transport extends BaseTransport {
|
|
590
|
+
constructor(config: QtiTransportConfig);
|
|
591
|
+
/**
|
|
592
|
+
* Make a paginated request using body-based pagination.
|
|
593
|
+
*
|
|
594
|
+
* QTI APIs return pagination metadata in the response body:
|
|
595
|
+
* - `items`: Array of items
|
|
596
|
+
* - `total`: Total items across all pages
|
|
597
|
+
* - `pages`: Total number of pages
|
|
598
|
+
* - `page`: Current page (1-indexed)
|
|
599
|
+
* - `limit`: Items per page
|
|
600
|
+
* - `sort`: Sort field
|
|
601
|
+
* - `order`: Sort order
|
|
602
|
+
*
|
|
603
|
+
* @template T - Expected item type in the response
|
|
604
|
+
* @param path - API endpoint path
|
|
605
|
+
* @param options - Request options
|
|
606
|
+
* @returns Normalized paginated response for Paginator compatibility
|
|
607
|
+
*/
|
|
608
|
+
requestPaginated<T>(path: string, options?: RequestOptions): Promise<PaginatedResponse<T>>;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
type input<T> = T extends {
|
|
612
|
+
_zod: {
|
|
613
|
+
input: any;
|
|
614
|
+
};
|
|
615
|
+
} ? T["_zod"]["input"] : unknown;
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* QTI Schemas
|
|
619
|
+
*
|
|
620
|
+
* Strict Zod schemas for QTI-related CLI/API inputs.
|
|
621
|
+
*
|
|
622
|
+
* These are intentionally "full-shape" schemas so CLI code can validate input
|
|
623
|
+
* and then pass typed values directly into the QTI SDK without widening/casting.
|
|
624
|
+
*/
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
629
|
+
// LIST PARAMS
|
|
630
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
631
|
+
|
|
632
|
+
declare const QtiPaginationParams = z
|
|
633
|
+
.object({
|
|
634
|
+
page: z.number().int().positive().optional(),
|
|
635
|
+
limit: z.number().int().positive().optional(),
|
|
636
|
+
sort: z.string().optional(),
|
|
637
|
+
order: z.enum(['asc', 'desc']).optional(),
|
|
638
|
+
})
|
|
639
|
+
.strict()
|
|
640
|
+
|
|
641
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
642
|
+
// ASSESSMENT ITEMS (REQUEST INPUTS)
|
|
643
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
644
|
+
|
|
645
|
+
declare const QtiAssessmentItemCreateInput = z
|
|
646
|
+
.object({
|
|
647
|
+
identifier: z.string().min(1),
|
|
648
|
+
title: z.string().min(1),
|
|
649
|
+
type: QtiAssessmentItemType,
|
|
650
|
+
qtiVersion: z.string().optional(),
|
|
651
|
+
timeDependent: z.boolean().optional(),
|
|
652
|
+
adaptive: z.boolean().optional(),
|
|
653
|
+
responseDeclarations: z.array(QtiResponseDeclaration).optional(),
|
|
654
|
+
outcomeDeclarations: z.array(QtiOutcomeDeclaration).optional(),
|
|
655
|
+
responseProcessing: QtiResponseProcessing.optional(),
|
|
656
|
+
metadata: QtiItemMetadata.optional(),
|
|
657
|
+
modalFeedback: z.array(QtiModalFeedback).optional(),
|
|
658
|
+
feedbackInline: z.array(QtiFeedbackInline).optional(),
|
|
659
|
+
feedbackBlock: z.array(QtiFeedbackBlock).optional(),
|
|
660
|
+
})
|
|
661
|
+
.strict()
|
|
662
|
+
|
|
663
|
+
declare const QtiAssessmentItemUpdateInput = z
|
|
664
|
+
.object({
|
|
665
|
+
identifier: z.string().min(1).optional(),
|
|
666
|
+
title: z.string().min(1),
|
|
667
|
+
type: QtiAssessmentItemType,
|
|
668
|
+
qtiVersion: z.string().optional(),
|
|
669
|
+
timeDependent: z.boolean().optional(),
|
|
670
|
+
adaptive: z.boolean().optional(),
|
|
671
|
+
responseDeclarations: z.array(QtiResponseDeclaration).optional(),
|
|
672
|
+
outcomeDeclarations: z.array(QtiOutcomeDeclaration).optional(),
|
|
673
|
+
responseProcessing: QtiResponseProcessing.optional(),
|
|
674
|
+
metadata: QtiItemMetadata.optional(),
|
|
675
|
+
modalFeedback: z.array(QtiModalFeedback).optional(),
|
|
676
|
+
feedbackInline: z.array(QtiFeedbackInline).optional(),
|
|
677
|
+
feedbackBlock: z.array(QtiFeedbackBlock).optional(),
|
|
678
|
+
rawXml: z.string(),
|
|
679
|
+
content: z.record(z.string(), z.unknown()),
|
|
680
|
+
})
|
|
681
|
+
.strict()
|
|
682
|
+
|
|
683
|
+
declare const QtiAssessmentItemProcessResponseInput = z
|
|
684
|
+
.object({
|
|
685
|
+
response: z.union([z.string(), z.array(z.string())]),
|
|
686
|
+
})
|
|
687
|
+
.strict()
|
|
688
|
+
|
|
689
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
690
|
+
// ASSESSMENT TESTS (REQUEST INPUTS)
|
|
691
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
692
|
+
|
|
693
|
+
declare const QtiAssessmentItemRef = z
|
|
694
|
+
.object({
|
|
695
|
+
identifier: z.string().min(1),
|
|
696
|
+
href: z.union([z.string(), z.array(z.string()), z.array(z.array(z.string()))]).optional(),
|
|
697
|
+
sequence: z.number().optional(),
|
|
698
|
+
})
|
|
699
|
+
.strict()
|
|
700
|
+
|
|
701
|
+
declare const QtiAssessmentSection = z
|
|
702
|
+
.object({
|
|
703
|
+
identifier: z.string().min(1),
|
|
704
|
+
title: z.string().min(1),
|
|
705
|
+
visible: z.boolean(),
|
|
706
|
+
required: z.boolean().optional(),
|
|
707
|
+
fixed: z.boolean().optional(),
|
|
708
|
+
sequence: z.number().optional(),
|
|
709
|
+
'qti-assessment-item-ref': z.array(QtiAssessmentItemRef).optional(),
|
|
710
|
+
})
|
|
711
|
+
.strict()
|
|
712
|
+
|
|
713
|
+
declare const QtiTestPart = z
|
|
714
|
+
.object({
|
|
715
|
+
identifier: z.string().min(1),
|
|
716
|
+
navigationMode: QtiNavigationMode,
|
|
717
|
+
submissionMode: QtiSubmissionMode,
|
|
718
|
+
'qti-assessment-section': z.union([QtiAssessmentSection, z.array(QtiAssessmentSection)]),
|
|
719
|
+
})
|
|
720
|
+
.strict()
|
|
721
|
+
|
|
722
|
+
declare const QtiReorderItemsInput = z
|
|
723
|
+
.object({
|
|
724
|
+
items: z.array(QtiAssessmentItemRef).min(1),
|
|
725
|
+
})
|
|
726
|
+
.strict()
|
|
727
|
+
|
|
728
|
+
declare const QtiAssessmentTestMetadataUpdateInput = z
|
|
729
|
+
.object({
|
|
730
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
731
|
+
})
|
|
732
|
+
.strict()
|
|
733
|
+
|
|
734
|
+
declare const QtiAssessmentTestCreateInput = z
|
|
735
|
+
.object({
|
|
736
|
+
identifier: z.string().min(1),
|
|
737
|
+
title: z.string().min(1),
|
|
738
|
+
qtiVersion: z.string().optional(),
|
|
739
|
+
toolName: z.string().optional(),
|
|
740
|
+
toolVersion: z.string().optional(),
|
|
741
|
+
timeLimit: z.number().optional(),
|
|
742
|
+
maxAttempts: z.number().optional(),
|
|
743
|
+
toolsEnabled: z.record(z.string(), z.boolean()).optional(),
|
|
744
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
745
|
+
'qti-test-part': QtiTestPart,
|
|
746
|
+
'qti-outcome-declaration': z.array(QtiTestOutcomeDeclaration).optional(),
|
|
747
|
+
})
|
|
748
|
+
.strict()
|
|
749
|
+
|
|
750
|
+
declare const QtiAssessmentTestUpdateInput = z
|
|
751
|
+
.object({
|
|
752
|
+
identifier: z.string().min(1).optional(),
|
|
753
|
+
title: z.string().min(1),
|
|
754
|
+
qtiVersion: z.string().optional(),
|
|
755
|
+
toolName: z.string().optional(),
|
|
756
|
+
toolVersion: z.string().optional(),
|
|
757
|
+
timeLimit: z.number().optional(),
|
|
758
|
+
maxAttempts: z.number().optional(),
|
|
759
|
+
toolsEnabled: z.record(z.string(), z.boolean()).optional(),
|
|
760
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
761
|
+
'qti-test-part': QtiTestPart,
|
|
762
|
+
'qti-outcome-declaration': z.array(QtiTestOutcomeDeclaration).optional(),
|
|
763
|
+
})
|
|
764
|
+
.strict()
|
|
765
|
+
|
|
766
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
767
|
+
// STIMULI (REQUEST INPUTS)
|
|
768
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
769
|
+
|
|
770
|
+
declare const QtiStimulusCreateInput = z
|
|
771
|
+
.object({
|
|
772
|
+
identifier: z.string().min(1),
|
|
773
|
+
title: z.string().min(1),
|
|
774
|
+
label: z.string().optional(),
|
|
775
|
+
language: z.string().optional(),
|
|
776
|
+
stylesheet: QtiStylesheet.optional(),
|
|
777
|
+
content: z.string(),
|
|
778
|
+
catalogInfo: z.array(QtiCatalogInfo).optional(),
|
|
779
|
+
toolName: z.string().optional(),
|
|
780
|
+
toolVersion: z.string().optional(),
|
|
781
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
782
|
+
})
|
|
783
|
+
.strict()
|
|
784
|
+
|
|
785
|
+
declare const QtiStimulusUpdateInput = z
|
|
786
|
+
.object({
|
|
787
|
+
identifier: z.string().min(1).optional(),
|
|
788
|
+
title: z.string().min(1),
|
|
789
|
+
label: z.string().optional(),
|
|
790
|
+
language: z.string().optional(),
|
|
791
|
+
stylesheet: QtiStylesheet.optional(),
|
|
792
|
+
content: z.string(),
|
|
793
|
+
catalogInfo: z.array(QtiCatalogInfo).optional(),
|
|
794
|
+
toolName: z.string().optional(),
|
|
795
|
+
toolVersion: z.string().optional(),
|
|
796
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
797
|
+
})
|
|
798
|
+
.strict()
|
|
799
|
+
|
|
800
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
801
|
+
// VALIDATION (REQUEST INPUTS)
|
|
802
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
803
|
+
|
|
804
|
+
declare const QtiValidateInput = z
|
|
805
|
+
.object({
|
|
806
|
+
xml: z.string().optional(),
|
|
807
|
+
schema: QtiValidationSchema,
|
|
808
|
+
entityId: z.string().optional(),
|
|
809
|
+
})
|
|
810
|
+
.strict()
|
|
811
|
+
|
|
812
|
+
declare const QtiValidateBatchInput = z
|
|
813
|
+
.object({
|
|
814
|
+
xml: z.array(z.string()),
|
|
815
|
+
schema: QtiValidationSchema,
|
|
816
|
+
entityIds: z.array(z.string()),
|
|
817
|
+
})
|
|
818
|
+
.strict()
|
|
819
|
+
|
|
820
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
821
|
+
// LESSON FEEDBACK (REQUEST INPUTS)
|
|
822
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
823
|
+
|
|
824
|
+
declare const QtiLessonFeedbackInput = z
|
|
825
|
+
.object({
|
|
826
|
+
questionId: z.string().optional(),
|
|
827
|
+
userId: z.string().min(1),
|
|
828
|
+
feedback: z.string().min(1),
|
|
829
|
+
lessonId: z.string().min(1),
|
|
830
|
+
humanApproved: z.boolean().optional(),
|
|
831
|
+
})
|
|
832
|
+
.strict()
|
|
833
|
+
|
|
834
|
+
type ListAssessmentTestsParams = input<typeof QtiPaginationParams>
|
|
835
|
+
type ListTestPartsParams = input<typeof QtiPaginationParams>
|
|
836
|
+
type ListSectionsParams = input<typeof QtiPaginationParams>
|
|
837
|
+
type ListAssessmentItemsParams = input<typeof QtiPaginationParams>
|
|
838
|
+
type ListStimuliParams = input<typeof QtiPaginationParams>
|
|
839
|
+
|
|
840
|
+
type CreateAssessmentTestRequest = input<typeof QtiAssessmentTestCreateInput>
|
|
841
|
+
type UpdateAssessmentTestRequest = input<typeof QtiAssessmentTestUpdateInput>
|
|
842
|
+
type UpdateTestMetadataRequest = input<typeof QtiAssessmentTestMetadataUpdateInput>
|
|
843
|
+
type CreateTestPartRequest = input<typeof QtiTestPart>
|
|
844
|
+
type UpdateTestPartRequest = input<typeof QtiTestPart>
|
|
845
|
+
type CreateSectionRequest = input<typeof QtiAssessmentSection>
|
|
846
|
+
type UpdateSectionRequest = input<typeof QtiAssessmentSection>
|
|
847
|
+
type AddItemRequest = input<typeof QtiAssessmentItemRef>
|
|
848
|
+
type ReorderItemsRequest = input<typeof QtiReorderItemsInput>
|
|
849
|
+
|
|
850
|
+
type CreateAssessmentItemRequest = input<typeof QtiAssessmentItemCreateInput>
|
|
851
|
+
type UpdateAssessmentItemRequest = input<typeof QtiAssessmentItemUpdateInput>
|
|
852
|
+
type ProcessResponseRequest = input<typeof QtiAssessmentItemProcessResponseInput>
|
|
853
|
+
|
|
854
|
+
type CreateStimulusRequest = input<typeof QtiStimulusCreateInput>
|
|
855
|
+
type UpdateStimulusRequest = input<typeof QtiStimulusUpdateInput>
|
|
856
|
+
|
|
857
|
+
type ValidateRequest = input<typeof QtiValidateInput>
|
|
858
|
+
type ValidateBatchRequest = input<typeof QtiValidateBatchInput>
|
|
859
|
+
|
|
860
|
+
type SubmitLessonRequest = input<typeof QtiLessonFeedbackInput>
|
|
861
|
+
type SubmitQuestionRequest = input<typeof QtiLessonFeedbackInput>
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* Assessment Items Resource
|
|
865
|
+
*
|
|
866
|
+
* CRUD operations for QTI assessment items.
|
|
867
|
+
*/
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* Assessment items resource for managing QTI assessment items.
|
|
871
|
+
*
|
|
872
|
+
* Provides methods to list, get, create, update, delete items,
|
|
873
|
+
* and process responses.
|
|
874
|
+
*/
|
|
875
|
+
declare class AssessmentItemsResource {
|
|
876
|
+
private readonly transport;
|
|
877
|
+
constructor(transport: Transport);
|
|
878
|
+
/**
|
|
879
|
+
* List assessment items with pagination.
|
|
880
|
+
*
|
|
881
|
+
* @param params - Pagination and filter parameters
|
|
882
|
+
* @returns Paginated list of assessment items
|
|
883
|
+
*/
|
|
884
|
+
list(params?: ListAssessmentItemsParams): Promise<ListResponse<AssessmentItem>>;
|
|
885
|
+
/**
|
|
886
|
+
* Stream assessment items with automatic pagination.
|
|
887
|
+
*
|
|
888
|
+
* QTI list endpoints use page-based pagination; this returns a Paginator
|
|
889
|
+
* that converts to the correct `page`/`limit` params.
|
|
890
|
+
*
|
|
891
|
+
* @param params - Optional pagination params (offset/limit) + max cap
|
|
892
|
+
* @returns Paginator for async iteration
|
|
893
|
+
*/
|
|
894
|
+
stream(params?: ListParams & {
|
|
895
|
+
max?: number;
|
|
896
|
+
}): Paginator<AssessmentItem>;
|
|
897
|
+
/**
|
|
898
|
+
* Get a single assessment item by identifier.
|
|
899
|
+
*
|
|
900
|
+
* @param identifier - Assessment item identifier
|
|
901
|
+
* @returns The assessment item
|
|
902
|
+
*/
|
|
903
|
+
get(identifier: string): Promise<AssessmentItem>;
|
|
904
|
+
/**
|
|
905
|
+
* Create a new assessment item.
|
|
906
|
+
*
|
|
907
|
+
* @param body - Assessment item data
|
|
908
|
+
* @returns The created assessment item
|
|
909
|
+
*/
|
|
910
|
+
create(body: CreateAssessmentItemRequest): Promise<AssessmentItem>;
|
|
911
|
+
/**
|
|
912
|
+
* Update an assessment item.
|
|
913
|
+
*
|
|
914
|
+
* @param identifier - Assessment item identifier
|
|
915
|
+
* @param body - Updated assessment item data
|
|
916
|
+
* @returns The updated assessment item
|
|
917
|
+
*/
|
|
918
|
+
update(identifier: string, body: UpdateAssessmentItemRequest): Promise<AssessmentItem>;
|
|
919
|
+
/**
|
|
920
|
+
* Delete an assessment item.
|
|
921
|
+
*
|
|
922
|
+
* @param identifier - Assessment item identifier
|
|
923
|
+
* @returns Delete response
|
|
924
|
+
*/
|
|
925
|
+
delete(identifier: string): Promise<DeleteResponse>;
|
|
926
|
+
/**
|
|
927
|
+
* Process a response for an assessment item.
|
|
928
|
+
*
|
|
929
|
+
* Validates and scores the response against the item's correct answer.
|
|
930
|
+
*
|
|
931
|
+
* @param identifier - Assessment item identifier
|
|
932
|
+
* @param body - Response to process
|
|
933
|
+
* @returns Score and feedback
|
|
934
|
+
*/
|
|
935
|
+
processResponse(identifier: string, body: Omit<ProcessResponseRequest, 'identifier'>): Promise<ProcessResponseResult>;
|
|
936
|
+
/**
|
|
937
|
+
* Create an assessment item from metadata.
|
|
938
|
+
*
|
|
939
|
+
* Alternative creation endpoint that accepts metadata-focused input.
|
|
940
|
+
*
|
|
941
|
+
* @param body - Assessment item metadata
|
|
942
|
+
* @returns The created assessment item
|
|
943
|
+
*/
|
|
944
|
+
createFromMetadata(body: CreateAssessmentItemRequest): Promise<AssessmentItem>;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* Assessment Tests Resource
|
|
949
|
+
*
|
|
950
|
+
* CRUD operations for QTI assessment tests including nested test parts,
|
|
951
|
+
* sections, and items.
|
|
952
|
+
*/
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* Helper for managing items within a section.
|
|
956
|
+
*/
|
|
957
|
+
declare class SectionItemsHelper {
|
|
958
|
+
private readonly transport;
|
|
959
|
+
private readonly testId;
|
|
960
|
+
private readonly testPartId;
|
|
961
|
+
private readonly sectionId;
|
|
962
|
+
constructor(transport: Transport, testId: string, testPartId: string, sectionId: string);
|
|
963
|
+
/**
|
|
964
|
+
* Add an item to the section.
|
|
965
|
+
*
|
|
966
|
+
* @param body - Item reference data
|
|
967
|
+
* @returns The updated section
|
|
968
|
+
*/
|
|
969
|
+
add(body: AddItemRequest): Promise<AssessmentSection>;
|
|
970
|
+
/**
|
|
971
|
+
* Remove an item from the section.
|
|
972
|
+
*
|
|
973
|
+
* @param itemIdentifier - Item identifier to remove
|
|
974
|
+
* @returns Delete response
|
|
975
|
+
*/
|
|
976
|
+
remove(itemIdentifier: string): Promise<DeleteResponse>;
|
|
977
|
+
/**
|
|
978
|
+
* Reorder items in the section.
|
|
979
|
+
*
|
|
980
|
+
* @param body - New item order
|
|
981
|
+
* @returns The updated section
|
|
982
|
+
*/
|
|
983
|
+
reorder(body: ReorderItemsRequest): Promise<AssessmentSection>;
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* Helper for managing sections within a test part.
|
|
987
|
+
*/
|
|
988
|
+
declare class TestPartSectionsHelper {
|
|
989
|
+
private readonly transport;
|
|
990
|
+
private readonly testId;
|
|
991
|
+
private readonly testPartId;
|
|
992
|
+
constructor(transport: Transport, testId: string, testPartId: string);
|
|
993
|
+
/**
|
|
994
|
+
* List sections in a test part.
|
|
995
|
+
*
|
|
996
|
+
* @param params - Pagination parameters
|
|
997
|
+
* @returns Paginated list of sections
|
|
998
|
+
*/
|
|
999
|
+
list(params?: ListSectionsParams): Promise<ListResponse<AssessmentSection>>;
|
|
1000
|
+
/**
|
|
1001
|
+
* Get a section by identifier.
|
|
1002
|
+
*
|
|
1003
|
+
* @param identifier - Section identifier
|
|
1004
|
+
* @returns The section
|
|
1005
|
+
*/
|
|
1006
|
+
get(identifier: string): Promise<AssessmentSection>;
|
|
1007
|
+
/**
|
|
1008
|
+
* Create a new section.
|
|
1009
|
+
*
|
|
1010
|
+
* @param body - Section data
|
|
1011
|
+
* @returns The created section
|
|
1012
|
+
*/
|
|
1013
|
+
create(body: CreateSectionRequest): Promise<AssessmentSection>;
|
|
1014
|
+
/**
|
|
1015
|
+
* Update a section.
|
|
1016
|
+
*
|
|
1017
|
+
* @param identifier - Section identifier
|
|
1018
|
+
* @param body - Updated section data
|
|
1019
|
+
* @returns The updated section
|
|
1020
|
+
*/
|
|
1021
|
+
update(identifier: string, body: UpdateSectionRequest): Promise<AssessmentSection>;
|
|
1022
|
+
/**
|
|
1023
|
+
* Delete a section.
|
|
1024
|
+
*
|
|
1025
|
+
* @param identifier - Section identifier
|
|
1026
|
+
* @returns Delete response
|
|
1027
|
+
*/
|
|
1028
|
+
delete(identifier: string): Promise<DeleteResponse>;
|
|
1029
|
+
/**
|
|
1030
|
+
* Get items helper for a specific section.
|
|
1031
|
+
*
|
|
1032
|
+
* @param sectionId - Section identifier
|
|
1033
|
+
* @returns Items helper
|
|
1034
|
+
*/
|
|
1035
|
+
items(sectionId: string): SectionItemsHelper;
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* Helper for managing test parts within an assessment test.
|
|
1039
|
+
*/
|
|
1040
|
+
declare class AssessmentTestPartsHelper {
|
|
1041
|
+
private readonly transport;
|
|
1042
|
+
private readonly testId;
|
|
1043
|
+
constructor(transport: Transport, testId: string);
|
|
1044
|
+
/**
|
|
1045
|
+
* List test parts.
|
|
1046
|
+
*
|
|
1047
|
+
* @param params - Pagination parameters
|
|
1048
|
+
* @returns Paginated list of test parts
|
|
1049
|
+
*/
|
|
1050
|
+
list(params?: ListTestPartsParams): Promise<ListResponse<TestPart>>;
|
|
1051
|
+
/**
|
|
1052
|
+
* Get a test part by identifier.
|
|
1053
|
+
*
|
|
1054
|
+
* @param identifier - Test part identifier
|
|
1055
|
+
* @returns The test part
|
|
1056
|
+
*/
|
|
1057
|
+
get(identifier: string): Promise<TestPart>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Create a new test part.
|
|
1060
|
+
*
|
|
1061
|
+
* @param body - Test part data
|
|
1062
|
+
* @returns The created test part
|
|
1063
|
+
*/
|
|
1064
|
+
create(body: CreateTestPartRequest): Promise<TestPart>;
|
|
1065
|
+
/**
|
|
1066
|
+
* Update a test part.
|
|
1067
|
+
*
|
|
1068
|
+
* @param identifier - Test part identifier
|
|
1069
|
+
* @param body - Updated test part data
|
|
1070
|
+
* @returns The updated test part
|
|
1071
|
+
*/
|
|
1072
|
+
update(identifier: string, body: UpdateTestPartRequest): Promise<TestPart>;
|
|
1073
|
+
/**
|
|
1074
|
+
* Delete a test part.
|
|
1075
|
+
*
|
|
1076
|
+
* @param identifier - Test part identifier
|
|
1077
|
+
* @returns Delete response
|
|
1078
|
+
*/
|
|
1079
|
+
delete(identifier: string): Promise<DeleteResponse>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Get sections helper for a specific test part.
|
|
1082
|
+
*
|
|
1083
|
+
* @param testPartId - Test part identifier
|
|
1084
|
+
* @returns Sections helper
|
|
1085
|
+
*/
|
|
1086
|
+
sections(testPartId: string): TestPartSectionsHelper;
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Assessment tests resource for managing QTI assessment tests.
|
|
1090
|
+
*
|
|
1091
|
+
* Provides methods to list, get, create, update, delete tests,
|
|
1092
|
+
* and access nested test parts, sections, and items.
|
|
1093
|
+
*/
|
|
1094
|
+
declare class AssessmentTestsResource {
|
|
1095
|
+
private readonly transport;
|
|
1096
|
+
constructor(transport: Transport);
|
|
1097
|
+
/**
|
|
1098
|
+
* List assessment tests with pagination.
|
|
1099
|
+
*
|
|
1100
|
+
* @param params - Pagination and filter parameters
|
|
1101
|
+
* @returns Paginated list of assessment tests
|
|
1102
|
+
*/
|
|
1103
|
+
list(params?: ListAssessmentTestsParams): Promise<ListResponse<AssessmentTest>>;
|
|
1104
|
+
/**
|
|
1105
|
+
* Stream assessment tests with automatic pagination.
|
|
1106
|
+
*
|
|
1107
|
+
* @param params - Optional pagination params (offset/limit) + max cap
|
|
1108
|
+
* @returns Paginator for async iteration
|
|
1109
|
+
*/
|
|
1110
|
+
stream(params?: ListParams & {
|
|
1111
|
+
max?: number;
|
|
1112
|
+
}): Paginator<AssessmentTest>;
|
|
1113
|
+
/**
|
|
1114
|
+
* Get a single assessment test by identifier.
|
|
1115
|
+
*
|
|
1116
|
+
* @param identifier - Assessment test identifier
|
|
1117
|
+
* @returns The assessment test
|
|
1118
|
+
*/
|
|
1119
|
+
get(identifier: string): Promise<AssessmentTest>;
|
|
1120
|
+
/**
|
|
1121
|
+
* Create a new assessment test.
|
|
1122
|
+
*
|
|
1123
|
+
* @param body - Assessment test data
|
|
1124
|
+
* @returns The created assessment test
|
|
1125
|
+
*/
|
|
1126
|
+
create(body: CreateAssessmentTestRequest): Promise<AssessmentTest>;
|
|
1127
|
+
/**
|
|
1128
|
+
* Update an assessment test.
|
|
1129
|
+
*
|
|
1130
|
+
* @param identifier - Assessment test identifier
|
|
1131
|
+
* @param body - Updated assessment test data
|
|
1132
|
+
* @returns The updated assessment test
|
|
1133
|
+
*/
|
|
1134
|
+
update(identifier: string, body: UpdateAssessmentTestRequest): Promise<AssessmentTest>;
|
|
1135
|
+
/**
|
|
1136
|
+
* Delete an assessment test.
|
|
1137
|
+
*
|
|
1138
|
+
* @param identifier - Assessment test identifier
|
|
1139
|
+
* @returns Delete response
|
|
1140
|
+
*/
|
|
1141
|
+
delete(identifier: string): Promise<DeleteResponse>;
|
|
1142
|
+
/**
|
|
1143
|
+
* Update test metadata.
|
|
1144
|
+
*
|
|
1145
|
+
* @param identifier - Assessment test identifier
|
|
1146
|
+
* @param body - Metadata to update
|
|
1147
|
+
* @returns The updated assessment test
|
|
1148
|
+
*/
|
|
1149
|
+
updateMetadata(identifier: string, body: UpdateTestMetadataRequest): Promise<AssessmentTest>;
|
|
1150
|
+
/**
|
|
1151
|
+
* Get all questions from an assessment test.
|
|
1152
|
+
*
|
|
1153
|
+
* Returns the full item details for each question referenced in the test.
|
|
1154
|
+
*
|
|
1155
|
+
* @param identifier - Assessment test identifier
|
|
1156
|
+
* @returns Questions with their full item details
|
|
1157
|
+
*/
|
|
1158
|
+
getQuestions(identifier: string): Promise<QuestionsResponse>;
|
|
1159
|
+
/**
|
|
1160
|
+
* Get test parts helper for a specific test.
|
|
1161
|
+
*
|
|
1162
|
+
* @param testId - Assessment test identifier
|
|
1163
|
+
* @returns Test parts helper
|
|
1164
|
+
*/
|
|
1165
|
+
testParts(testId: string): AssessmentTestPartsHelper;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
/**
|
|
1169
|
+
* General Resource
|
|
1170
|
+
*
|
|
1171
|
+
* General QTI endpoints that don't fit into other resources.
|
|
1172
|
+
*/
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* General resource for miscellaneous QTI operations.
|
|
1176
|
+
*
|
|
1177
|
+
* Provides methods for general operations like delete-by-id.
|
|
1178
|
+
*/
|
|
1179
|
+
declare class GeneralResource {
|
|
1180
|
+
private readonly transport;
|
|
1181
|
+
constructor(transport: Transport);
|
|
1182
|
+
/**
|
|
1183
|
+
* Delete any entity by its ID.
|
|
1184
|
+
*
|
|
1185
|
+
* This is a general delete endpoint that can remove any QTI entity.
|
|
1186
|
+
*
|
|
1187
|
+
* @param id - Entity identifier
|
|
1188
|
+
* @returns Delete confirmation message
|
|
1189
|
+
*/
|
|
1190
|
+
deleteById(id: string): Promise<DeleteResponse>;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
* Lesson Resource
|
|
1195
|
+
*
|
|
1196
|
+
* Lesson and question feedback endpoints.
|
|
1197
|
+
*/
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* Lesson resource for managing lesson and question feedback.
|
|
1201
|
+
*
|
|
1202
|
+
* Provides methods to submit and retrieve lesson/question feedback.
|
|
1203
|
+
*/
|
|
1204
|
+
declare class LessonResource {
|
|
1205
|
+
private readonly transport;
|
|
1206
|
+
constructor(transport: Transport);
|
|
1207
|
+
/**
|
|
1208
|
+
* Submit lesson feedback.
|
|
1209
|
+
*
|
|
1210
|
+
* @param body - Lesson feedback data
|
|
1211
|
+
* @returns The created feedback
|
|
1212
|
+
*/
|
|
1213
|
+
submitLesson(body: SubmitLessonRequest): Promise<LessonFeedback>;
|
|
1214
|
+
/**
|
|
1215
|
+
* Get lesson feedback by lesson ID.
|
|
1216
|
+
*
|
|
1217
|
+
* @param lessonId - Lesson identifier
|
|
1218
|
+
* @returns The lesson feedback
|
|
1219
|
+
*/
|
|
1220
|
+
getLesson(lessonId: string): Promise<LessonFeedback>;
|
|
1221
|
+
/**
|
|
1222
|
+
* Submit question feedback.
|
|
1223
|
+
*
|
|
1224
|
+
* @param body - Question feedback data
|
|
1225
|
+
* @returns The created feedback
|
|
1226
|
+
*/
|
|
1227
|
+
submitQuestion(body: SubmitQuestionRequest): Promise<LessonFeedback>;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* Stimuli Resource
|
|
1232
|
+
*
|
|
1233
|
+
* CRUD operations for QTI stimuli.
|
|
1234
|
+
*/
|
|
1235
|
+
|
|
1236
|
+
/**
|
|
1237
|
+
* Stimuli resource for managing QTI stimulus materials.
|
|
1238
|
+
*
|
|
1239
|
+
* Provides methods to list, get, create, update, and delete stimuli.
|
|
1240
|
+
*/
|
|
1241
|
+
declare class StimuliResource {
|
|
1242
|
+
private readonly transport;
|
|
1243
|
+
constructor(transport: Transport);
|
|
1244
|
+
/**
|
|
1245
|
+
* List stimuli with pagination.
|
|
1246
|
+
*
|
|
1247
|
+
* @param params - Pagination and filter parameters
|
|
1248
|
+
* @returns Paginated list of stimuli
|
|
1249
|
+
*/
|
|
1250
|
+
list(params?: ListStimuliParams): Promise<ListResponse<Stimulus>>;
|
|
1251
|
+
/**
|
|
1252
|
+
* Stream stimuli with automatic pagination.
|
|
1253
|
+
*
|
|
1254
|
+
* @param params - Optional pagination params (offset/limit) + max cap
|
|
1255
|
+
* @returns Paginator for async iteration
|
|
1256
|
+
*/
|
|
1257
|
+
stream(params?: ListParams & {
|
|
1258
|
+
max?: number;
|
|
1259
|
+
}): Paginator<Stimulus>;
|
|
1260
|
+
/**
|
|
1261
|
+
* Get a single stimulus by identifier.
|
|
1262
|
+
*
|
|
1263
|
+
* @param identifier - Stimulus identifier
|
|
1264
|
+
* @returns The stimulus
|
|
1265
|
+
*/
|
|
1266
|
+
get(identifier: string): Promise<Stimulus>;
|
|
1267
|
+
/**
|
|
1268
|
+
* Create a new stimulus.
|
|
1269
|
+
*
|
|
1270
|
+
* @param body - Stimulus data
|
|
1271
|
+
* @returns The created stimulus
|
|
1272
|
+
*/
|
|
1273
|
+
create(body: CreateStimulusRequest): Promise<Stimulus>;
|
|
1274
|
+
/**
|
|
1275
|
+
* Update a stimulus.
|
|
1276
|
+
*
|
|
1277
|
+
* @param identifier - Stimulus identifier
|
|
1278
|
+
* @param body - Updated stimulus data
|
|
1279
|
+
* @returns The updated stimulus
|
|
1280
|
+
*/
|
|
1281
|
+
update(identifier: string, body: UpdateStimulusRequest): Promise<Stimulus>;
|
|
1282
|
+
/**
|
|
1283
|
+
* Delete a stimulus.
|
|
1284
|
+
*
|
|
1285
|
+
* @param identifier - Stimulus identifier
|
|
1286
|
+
* @returns Delete response
|
|
1287
|
+
*/
|
|
1288
|
+
delete(identifier: string): Promise<DeleteResponse>;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
/**
|
|
1292
|
+
* Validate Resource
|
|
1293
|
+
*
|
|
1294
|
+
* QTI XML validation endpoints.
|
|
1295
|
+
*/
|
|
1296
|
+
|
|
1297
|
+
/**
|
|
1298
|
+
* Validation resource for checking QTI XML validity.
|
|
1299
|
+
*
|
|
1300
|
+
* Provides methods to validate single items or batch validate multiple items.
|
|
1301
|
+
*/
|
|
1302
|
+
declare class ValidateResource {
|
|
1303
|
+
private readonly transport;
|
|
1304
|
+
constructor(transport: Transport);
|
|
1305
|
+
/**
|
|
1306
|
+
* Validate a single QTI XML document.
|
|
1307
|
+
*
|
|
1308
|
+
* @param body - Validation request with XML and schema type
|
|
1309
|
+
* @returns Validation result
|
|
1310
|
+
*/
|
|
1311
|
+
validate(body: ValidateRequest): Promise<ValidationResult>;
|
|
1312
|
+
/**
|
|
1313
|
+
* Validate multiple QTI XML documents in batch.
|
|
1314
|
+
*
|
|
1315
|
+
* @param body - Batch validation request
|
|
1316
|
+
* @returns Batch validation results
|
|
1317
|
+
*/
|
|
1318
|
+
batch(body: ValidateBatchRequest): Promise<BatchValidationResult>;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
/**
|
|
1322
|
+
* QTI Client
|
|
1323
|
+
*
|
|
1324
|
+
* Main entry point for the QTI SDK.
|
|
1325
|
+
*/
|
|
1326
|
+
/**
|
|
1327
|
+
* QTI API client for assessment content management.
|
|
1328
|
+
*
|
|
1329
|
+
* Provides access to QTI endpoints including assessment items, tests,
|
|
1330
|
+
* stimuli, validation, and lesson feedback.
|
|
1331
|
+
*
|
|
1332
|
+
* @example
|
|
1333
|
+
* ```typescript
|
|
1334
|
+
* // Environment mode (Timeback APIs)
|
|
8
1335
|
* const client = new QtiClient({
|
|
9
|
-
* env: 'staging',
|
|
1336
|
+
* env: 'staging', // or 'production'
|
|
10
1337
|
* auth: {
|
|
11
1338
|
* clientId: 'your-client-id',
|
|
12
1339
|
* clientSecret: 'your-client-secret',
|
|
13
1340
|
* },
|
|
14
1341
|
* })
|
|
1342
|
+
* ```
|
|
15
1343
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* const item = await client.assessmentItems.get('item-123')
|
|
1344
|
+
* @example
|
|
1345
|
+
* ```typescript
|
|
1346
|
+
* // Provider mode (shared tokens)
|
|
1347
|
+
* import { TimebackProvider } from '@timeback/internal-client-infra'
|
|
21
1348
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
1349
|
+
* const provider = new TimebackProvider({
|
|
1350
|
+
* platform: 'BEYOND_AI',
|
|
1351
|
+
* env: 'staging',
|
|
1352
|
+
* auth: { clientId: '...', clientSecret: '...' },
|
|
26
1353
|
* })
|
|
1354
|
+
*
|
|
1355
|
+
* const client = new QtiClient({ provider })
|
|
27
1356
|
* ```
|
|
28
1357
|
*
|
|
29
|
-
* @example
|
|
1358
|
+
* @example
|
|
30
1359
|
* ```typescript
|
|
1360
|
+
* // Explicit mode (custom API)
|
|
31
1361
|
* const client = new QtiClient({
|
|
32
1362
|
* baseUrl: 'https://qti.example.com/api',
|
|
33
1363
|
* auth: {
|
|
@@ -37,12 +1367,73 @@
|
|
|
37
1367
|
* },
|
|
38
1368
|
* })
|
|
39
1369
|
* ```
|
|
1370
|
+
*
|
|
1371
|
+
* @example
|
|
1372
|
+
* ```typescript
|
|
1373
|
+
* // Environment variables fallback
|
|
1374
|
+
* // Set QTI_BASE_URL, QTI_TOKEN_URL,
|
|
1375
|
+
* // QTI_CLIENT_ID, QTI_CLIENT_SECRET
|
|
1376
|
+
* const client = new QtiClient()
|
|
1377
|
+
* ```
|
|
1378
|
+
*/
|
|
1379
|
+
declare const QtiClient: {
|
|
1380
|
+
new (config?: QtiClientConfig): {
|
|
1381
|
+
readonly transport: QtiTransportLike;
|
|
1382
|
+
readonly _provider?: _timeback_internal_client_infra.TimebackProvider | undefined;
|
|
1383
|
+
readonly assessmentItems: AssessmentItemsResource;
|
|
1384
|
+
readonly assessmentTests: AssessmentTestsResource;
|
|
1385
|
+
readonly stimuli: StimuliResource;
|
|
1386
|
+
readonly validate: ValidateResource;
|
|
1387
|
+
readonly lesson: LessonResource;
|
|
1388
|
+
readonly general: GeneralResource;
|
|
1389
|
+
getTransport(): QtiTransportLike;
|
|
1390
|
+
checkAuth(): Promise<_timeback_internal_client_infra.AuthCheckResult>;
|
|
1391
|
+
};
|
|
1392
|
+
};
|
|
1393
|
+
|
|
1394
|
+
/**
|
|
1395
|
+
* QTI Client Factory
|
|
1396
|
+
*
|
|
1397
|
+
* Creates QtiClient classes bound to specific provider registries.
|
|
1398
|
+
*/
|
|
1399
|
+
|
|
1400
|
+
/**
|
|
1401
|
+
* Create a QtiClient class bound to a specific provider registry.
|
|
1402
|
+
*
|
|
1403
|
+
* @param registry - Provider registry to use (defaults to all Timeback platforms)
|
|
1404
|
+
* @returns QtiClient class bound to the registry
|
|
40
1405
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1406
|
+
declare function createQtiClient(registry?: ProviderRegistry): {
|
|
1407
|
+
new (config?: QtiClientConfig): {
|
|
1408
|
+
/** @internal */
|
|
1409
|
+
readonly transport: QtiTransportLike;
|
|
1410
|
+
/** @internal */
|
|
1411
|
+
readonly _provider?: TimebackProvider | undefined;
|
|
1412
|
+
/** Query and manage assessment items (questions) */
|
|
1413
|
+
readonly assessmentItems: AssessmentItemsResource;
|
|
1414
|
+
/** Query and manage assessment tests with nested test parts, sections, and items */
|
|
1415
|
+
readonly assessmentTests: AssessmentTestsResource;
|
|
1416
|
+
/** Query and manage stimulus materials (passages, images, etc.) */
|
|
1417
|
+
readonly stimuli: StimuliResource;
|
|
1418
|
+
/** Validate QTI XML documents */
|
|
1419
|
+
readonly validate: ValidateResource;
|
|
1420
|
+
/** Submit and retrieve lesson/question feedback */
|
|
1421
|
+
readonly lesson: LessonResource;
|
|
1422
|
+
/** General operations like delete-by-id */
|
|
1423
|
+
readonly general: GeneralResource;
|
|
1424
|
+
/**
|
|
1425
|
+
* Get the underlying transport for advanced use cases.
|
|
1426
|
+
* @returns The transport instance used by this client
|
|
1427
|
+
*/
|
|
1428
|
+
getTransport(): QtiTransportLike;
|
|
1429
|
+
/**
|
|
1430
|
+
* Verify that OAuth authentication is working.
|
|
1431
|
+
* @returns Auth check result
|
|
1432
|
+
* @throws {Error} If client was initialized with custom transport (no provider)
|
|
1433
|
+
*/
|
|
1434
|
+
checkAuth(): Promise<AuthCheckResult>;
|
|
1435
|
+
};
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1438
|
+
export { Paginator, QtiClient, Transport, createQtiClient };
|
|
1439
|
+
export type { AssessmentItem, AssessmentItemType, AssessmentTest, ListResponse, QtiClientConfig, QtiClientInstance, Stimulus, ValidationResult };
|