@longsightgroup/qti3-core 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/catalog.d.ts +32 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +126 -0
- package/dist/catalog.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +293 -6
- package/dist/parser.js.map +1 -1
- package/dist/session.d.ts +3 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +68 -3
- package/dist/session.js.map +1 -1
- package/dist/support.js +7 -1
- package/dist/support.js.map +1 -1
- package/dist/tts.d.ts +61 -0
- package/dist/tts.d.ts.map +1 -0
- package/dist/tts.js +368 -0
- package/dist/tts.js.map +1 -0
- package/dist/types.d.ts +61 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +243 -11
- package/dist/validation.js.map +1 -1
- package/package.json +4 -2
- package/src/catalog.ts +193 -0
- package/src/index.ts +85 -0
- package/src/parser.ts +1859 -0
- package/src/session.ts +2284 -0
- package/src/support.ts +253 -0
- package/src/tts.ts +555 -0
- package/src/types.ts +703 -0
- package/src/validation.ts +2449 -0
- package/src/xml.ts +139 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,703 @@
|
|
|
1
|
+
export type QtiSupportStatus =
|
|
2
|
+
| "unsupported"
|
|
3
|
+
| "deprecated"
|
|
4
|
+
| "parsed"
|
|
5
|
+
| "validated"
|
|
6
|
+
| "rendered"
|
|
7
|
+
| "interactive"
|
|
8
|
+
| "scored"
|
|
9
|
+
| "accessible-tested"
|
|
10
|
+
| "conformance-tested"
|
|
11
|
+
| "supported";
|
|
12
|
+
|
|
13
|
+
export type QtiDiagnosticSeverity = "info" | "warning" | "error";
|
|
14
|
+
|
|
15
|
+
export interface QtiDiagnostic {
|
|
16
|
+
code: string;
|
|
17
|
+
severity: QtiDiagnosticSeverity;
|
|
18
|
+
message: string;
|
|
19
|
+
path?: string | undefined;
|
|
20
|
+
source?: QtiSourceLocation | undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface QtiSourceLocation {
|
|
24
|
+
line: number;
|
|
25
|
+
column: number;
|
|
26
|
+
offset: number;
|
|
27
|
+
path: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type QtiBaseType =
|
|
31
|
+
| "identifier"
|
|
32
|
+
| "boolean"
|
|
33
|
+
| "integer"
|
|
34
|
+
| "float"
|
|
35
|
+
| "string"
|
|
36
|
+
| "point"
|
|
37
|
+
| "pair"
|
|
38
|
+
| "directedPair"
|
|
39
|
+
| "duration"
|
|
40
|
+
| "file"
|
|
41
|
+
| "uri";
|
|
42
|
+
|
|
43
|
+
export type QtiCardinality = "single" | "multiple" | "ordered" | "record";
|
|
44
|
+
|
|
45
|
+
export type QtiScalarValue = string | number | boolean;
|
|
46
|
+
export interface QtiRecordValue {
|
|
47
|
+
[fieldIdentifier: string]: QtiValue;
|
|
48
|
+
}
|
|
49
|
+
export type QtiValue = QtiScalarValue | QtiScalarValue[] | QtiRecordValue | null;
|
|
50
|
+
export type QtiPortableCustomStateValue =
|
|
51
|
+
| string
|
|
52
|
+
| number
|
|
53
|
+
| boolean
|
|
54
|
+
| null
|
|
55
|
+
| QtiPortableCustomStateValue[]
|
|
56
|
+
| { [key: string]: QtiPortableCustomStateValue };
|
|
57
|
+
|
|
58
|
+
export type QtiAttemptStatus = "initialized" | "interacting" | "suspended" | "completed";
|
|
59
|
+
|
|
60
|
+
export interface QtiVariableDeclaration {
|
|
61
|
+
identifier: string;
|
|
62
|
+
baseType?: QtiBaseType | undefined;
|
|
63
|
+
cardinality: QtiCardinality;
|
|
64
|
+
defaultValue: QtiValue;
|
|
65
|
+
attributes: Record<string, string>;
|
|
66
|
+
source?: QtiSourceLocation | undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface QtiResponseDeclaration extends QtiVariableDeclaration {
|
|
70
|
+
kind: "response";
|
|
71
|
+
correctResponse: QtiValue;
|
|
72
|
+
mapping?: QtiMapping | undefined;
|
|
73
|
+
areaMapping?: QtiAreaMapping | undefined;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface QtiMapping {
|
|
77
|
+
defaultValue: number;
|
|
78
|
+
entries: QtiMapEntry[];
|
|
79
|
+
attributes: Record<string, string>;
|
|
80
|
+
source?: QtiSourceLocation | undefined;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface QtiMapEntry {
|
|
84
|
+
mapKey?: string | undefined;
|
|
85
|
+
mappedValue: number;
|
|
86
|
+
attributes: Record<string, string>;
|
|
87
|
+
source?: QtiSourceLocation | undefined;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface QtiAreaMapping {
|
|
91
|
+
defaultValue: number;
|
|
92
|
+
entries: QtiAreaMapEntry[];
|
|
93
|
+
attributes: Record<string, string>;
|
|
94
|
+
source?: QtiSourceLocation | undefined;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface QtiAreaMapEntry {
|
|
98
|
+
shape: "circle" | "rect" | "poly" | "default";
|
|
99
|
+
coords: number[];
|
|
100
|
+
mappedValue: number;
|
|
101
|
+
attributes: Record<string, string>;
|
|
102
|
+
source?: QtiSourceLocation | undefined;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface QtiOutcomeDeclaration extends QtiVariableDeclaration {
|
|
106
|
+
kind: "outcome";
|
|
107
|
+
lookupTable?: QtiLookupTable | undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export type QtiLookupTable = QtiMatchTable | QtiInterpolationTable;
|
|
111
|
+
|
|
112
|
+
export interface QtiLookupTableBase {
|
|
113
|
+
defaultValue: QtiValue;
|
|
114
|
+
entries: QtiLookupTableEntry[];
|
|
115
|
+
attributes: Record<string, string>;
|
|
116
|
+
source?: QtiSourceLocation | undefined;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface QtiMatchTable extends QtiLookupTableBase {
|
|
120
|
+
type: "match";
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface QtiInterpolationTable extends QtiLookupTableBase {
|
|
124
|
+
type: "interpolation";
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface QtiLookupTableEntry {
|
|
128
|
+
sourceValue: number;
|
|
129
|
+
targetValue: QtiValue;
|
|
130
|
+
includeBoundary?: boolean | undefined;
|
|
131
|
+
attributes: Record<string, string>;
|
|
132
|
+
source?: QtiSourceLocation | undefined;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface QtiTemplateDeclaration extends QtiVariableDeclaration {
|
|
136
|
+
kind: "template";
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface QtiChoice {
|
|
140
|
+
identifier: string;
|
|
141
|
+
text: string;
|
|
142
|
+
role: QtiChoiceRole;
|
|
143
|
+
qtiName: string;
|
|
144
|
+
attributes: Record<string, string>;
|
|
145
|
+
source?: QtiSourceLocation | undefined;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface QtiElementChild {
|
|
149
|
+
qtiName: string;
|
|
150
|
+
source?: QtiSourceLocation | undefined;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export type QtiChoiceRole =
|
|
154
|
+
| "simpleChoice"
|
|
155
|
+
| "associableChoice"
|
|
156
|
+
| "matchSource"
|
|
157
|
+
| "matchTarget"
|
|
158
|
+
| "gapChoice"
|
|
159
|
+
| "gap"
|
|
160
|
+
| "hottext"
|
|
161
|
+
| "hotspot"
|
|
162
|
+
| "inlineChoice";
|
|
163
|
+
|
|
164
|
+
export type QtiInteractionType =
|
|
165
|
+
| "associate"
|
|
166
|
+
| "choice"
|
|
167
|
+
| "custom"
|
|
168
|
+
| "drawing"
|
|
169
|
+
| "endAttempt"
|
|
170
|
+
| "extendedText"
|
|
171
|
+
| "gapMatch"
|
|
172
|
+
| "graphicAssociate"
|
|
173
|
+
| "graphicGapMatch"
|
|
174
|
+
| "graphicOrder"
|
|
175
|
+
| "hotspot"
|
|
176
|
+
| "hottext"
|
|
177
|
+
| "inlineChoice"
|
|
178
|
+
| "match"
|
|
179
|
+
| "media"
|
|
180
|
+
| "order"
|
|
181
|
+
| "positionObject"
|
|
182
|
+
| "portableCustom"
|
|
183
|
+
| "selectPoint"
|
|
184
|
+
| "slider"
|
|
185
|
+
| "textEntry"
|
|
186
|
+
| "upload";
|
|
187
|
+
|
|
188
|
+
export interface QtiInteraction {
|
|
189
|
+
type: QtiInteractionType;
|
|
190
|
+
qtiName: string;
|
|
191
|
+
responseIdentifier?: string | undefined;
|
|
192
|
+
responseCardinality?: QtiCardinality | undefined;
|
|
193
|
+
responseBaseType?: QtiBaseType | undefined;
|
|
194
|
+
prompt?: string | undefined;
|
|
195
|
+
promptAttributes?: Record<string, string> | undefined;
|
|
196
|
+
promptSource?: QtiSourceLocation | undefined;
|
|
197
|
+
contextText?: string | undefined;
|
|
198
|
+
object?: QtiObjectAsset | undefined;
|
|
199
|
+
positionObjectStage?: QtiObjectAsset | undefined;
|
|
200
|
+
portableCustom?: QtiPortableCustomDefinition | undefined;
|
|
201
|
+
choices: QtiChoice[];
|
|
202
|
+
hottextSegments?: QtiHottextSegment[] | undefined;
|
|
203
|
+
gapMatchSegments?: QtiGapMatchSegment[] | undefined;
|
|
204
|
+
childElements: QtiElementChild[];
|
|
205
|
+
attributes: Record<string, string>;
|
|
206
|
+
text: string;
|
|
207
|
+
source?: QtiSourceLocation | undefined;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export type QtiHottextSegment = QtiHottextTextSegment | QtiHottextChoiceSegment;
|
|
211
|
+
|
|
212
|
+
export interface QtiHottextTextSegment {
|
|
213
|
+
kind: "text";
|
|
214
|
+
text: string;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface QtiHottextChoiceSegment {
|
|
218
|
+
kind: "hottext";
|
|
219
|
+
identifier: string;
|
|
220
|
+
text: string;
|
|
221
|
+
attributes: Record<string, string>;
|
|
222
|
+
source?: QtiSourceLocation | undefined;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export type QtiGapMatchSegment = QtiGapMatchTextSegment | QtiGapMatchGapSegment;
|
|
226
|
+
|
|
227
|
+
export interface QtiGapMatchTextSegment {
|
|
228
|
+
kind: "text";
|
|
229
|
+
text: string;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface QtiGapMatchGapSegment {
|
|
233
|
+
kind: "gap";
|
|
234
|
+
identifier: string;
|
|
235
|
+
attributes: Record<string, string>;
|
|
236
|
+
source?: QtiSourceLocation | undefined;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export interface QtiObjectAsset {
|
|
240
|
+
data?: string | undefined;
|
|
241
|
+
type?: string | undefined;
|
|
242
|
+
width?: string | undefined;
|
|
243
|
+
height?: string | undefined;
|
|
244
|
+
sources: QtiMediaSource[];
|
|
245
|
+
tracks: QtiMediaTrack[];
|
|
246
|
+
text: string;
|
|
247
|
+
attributes: Record<string, string>;
|
|
248
|
+
source?: QtiSourceLocation | undefined;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export interface QtiMediaSource {
|
|
252
|
+
src?: string | undefined;
|
|
253
|
+
type?: string | undefined;
|
|
254
|
+
attributes: Record<string, string>;
|
|
255
|
+
source?: QtiSourceLocation | undefined;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface QtiMediaTrack {
|
|
259
|
+
kind?: string | undefined;
|
|
260
|
+
src?: string | undefined;
|
|
261
|
+
srclang?: string | undefined;
|
|
262
|
+
label?: string | undefined;
|
|
263
|
+
default?: boolean | undefined;
|
|
264
|
+
attributes: Record<string, string>;
|
|
265
|
+
source?: QtiSourceLocation | undefined;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export interface QtiPortableCustomDefinition {
|
|
269
|
+
responseIdentifier?: string | undefined;
|
|
270
|
+
customInteractionTypeIdentifier?: string | undefined;
|
|
271
|
+
module?: string | undefined;
|
|
272
|
+
interactionModules?: QtiPortableCustomInteractionModules | undefined;
|
|
273
|
+
interactionMarkup: QtiContentNode[];
|
|
274
|
+
interactionMarkupRaw?: string | undefined;
|
|
275
|
+
templateVariables: QtiPortableCustomVariableBinding[];
|
|
276
|
+
contextVariables: QtiPortableCustomVariableBinding[];
|
|
277
|
+
stylesheets: QtiStylesheet[];
|
|
278
|
+
catalogInfo?: QtiCatalogInfo | undefined;
|
|
279
|
+
dataAttributes: Record<string, string>;
|
|
280
|
+
attributes: Record<string, string>;
|
|
281
|
+
source?: QtiSourceLocation | undefined;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export interface QtiPortableCustomInteractionModules {
|
|
285
|
+
primaryConfiguration?: string | undefined;
|
|
286
|
+
secondaryConfiguration?: string | undefined;
|
|
287
|
+
modules: QtiPortableCustomInteractionModule[];
|
|
288
|
+
attributes: Record<string, string>;
|
|
289
|
+
source?: QtiSourceLocation | undefined;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export interface QtiPortableCustomInteractionModule {
|
|
293
|
+
id?: string | undefined;
|
|
294
|
+
primaryPath?: string | undefined;
|
|
295
|
+
fallbackPath?: string | undefined;
|
|
296
|
+
attributes: Record<string, string>;
|
|
297
|
+
source?: QtiSourceLocation | undefined;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export interface QtiPortableCustomVariableBinding {
|
|
301
|
+
identifier?: string | undefined;
|
|
302
|
+
variableIdentifier?: string | undefined;
|
|
303
|
+
kind: "template" | "context";
|
|
304
|
+
attributes: Record<string, string>;
|
|
305
|
+
source?: QtiSourceLocation | undefined;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export type QtiContentNode =
|
|
309
|
+
| QtiTextContent
|
|
310
|
+
| QtiElementContent
|
|
311
|
+
| QtiInteractionContent
|
|
312
|
+
| QtiPrintedVariableContent
|
|
313
|
+
| QtiFeedbackContent;
|
|
314
|
+
|
|
315
|
+
export interface QtiTextContent {
|
|
316
|
+
kind: "text";
|
|
317
|
+
text: string;
|
|
318
|
+
source?: QtiSourceLocation | undefined;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface QtiElementContent {
|
|
322
|
+
kind: "element";
|
|
323
|
+
qtiName: string;
|
|
324
|
+
attributes: Record<string, string>;
|
|
325
|
+
children: QtiContentNode[];
|
|
326
|
+
source?: QtiSourceLocation | undefined;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export interface QtiInteractionContent {
|
|
330
|
+
kind: "interaction";
|
|
331
|
+
interactionIndex: number;
|
|
332
|
+
qtiName: string;
|
|
333
|
+
responseIdentifier?: string | undefined;
|
|
334
|
+
source?: QtiSourceLocation | undefined;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
export interface QtiPrintedVariableContent {
|
|
338
|
+
kind: "printedVariable";
|
|
339
|
+
identifier: string;
|
|
340
|
+
format?: string | undefined;
|
|
341
|
+
attributes: Record<string, string>;
|
|
342
|
+
source?: QtiSourceLocation | undefined;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export interface QtiFeedbackContent {
|
|
346
|
+
kind: "feedback";
|
|
347
|
+
feedbackType: "block" | "inline";
|
|
348
|
+
identifier: string;
|
|
349
|
+
outcomeIdentifier: string;
|
|
350
|
+
showHide: "show" | "hide";
|
|
351
|
+
attributes: Record<string, string>;
|
|
352
|
+
children: QtiContentNode[];
|
|
353
|
+
source?: QtiSourceLocation | undefined;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export interface QtiCatalogInfo {
|
|
357
|
+
catalogs: QtiCatalog[];
|
|
358
|
+
source?: QtiSourceLocation | undefined;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export interface QtiCatalog {
|
|
362
|
+
id: string;
|
|
363
|
+
cards: QtiCatalogCard[];
|
|
364
|
+
attributes: Record<string, string>;
|
|
365
|
+
source?: QtiSourceLocation | undefined;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export interface QtiCatalogCard {
|
|
369
|
+
support: string;
|
|
370
|
+
htmlContent?: QtiCatalogHtmlContent | undefined;
|
|
371
|
+
fileHrefs: QtiCatalogFileHref[];
|
|
372
|
+
entries: QtiCatalogCardEntry[];
|
|
373
|
+
attributes: Record<string, string>;
|
|
374
|
+
source?: QtiSourceLocation | undefined;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export interface QtiCatalogCardEntry {
|
|
378
|
+
language?: string | undefined;
|
|
379
|
+
default: boolean;
|
|
380
|
+
htmlContent?: QtiCatalogHtmlContent | undefined;
|
|
381
|
+
fileHrefs: QtiCatalogFileHref[];
|
|
382
|
+
attributes: Record<string, string>;
|
|
383
|
+
source?: QtiSourceLocation | undefined;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export interface QtiCatalogHtmlContent {
|
|
387
|
+
text: string;
|
|
388
|
+
children: QtiContentNode[];
|
|
389
|
+
attributes: Record<string, string>;
|
|
390
|
+
source?: QtiSourceLocation | undefined;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export interface QtiCatalogFileHref {
|
|
394
|
+
href: string;
|
|
395
|
+
mimeType?: string | undefined;
|
|
396
|
+
attributes: Record<string, string>;
|
|
397
|
+
source?: QtiSourceLocation | undefined;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export interface QtiCatalogReference {
|
|
401
|
+
idref: string;
|
|
402
|
+
source?: QtiSourceLocation | undefined;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export interface QtiStylesheet {
|
|
406
|
+
href: string;
|
|
407
|
+
type?: string | undefined;
|
|
408
|
+
media?: string | undefined;
|
|
409
|
+
title?: string | undefined;
|
|
410
|
+
attributes: Record<string, string>;
|
|
411
|
+
source?: QtiSourceLocation | undefined;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export interface QtiAssessmentItem {
|
|
415
|
+
identifier: string;
|
|
416
|
+
title?: string | undefined;
|
|
417
|
+
language?: string | undefined;
|
|
418
|
+
adaptive: boolean;
|
|
419
|
+
prompt?: string | undefined;
|
|
420
|
+
responseDeclarations: QtiResponseDeclaration[];
|
|
421
|
+
outcomeDeclarations: QtiOutcomeDeclaration[];
|
|
422
|
+
templateDeclarations: QtiTemplateDeclaration[];
|
|
423
|
+
templateProcessing?: QtiTemplateProcessing | undefined;
|
|
424
|
+
responseProcessing?: QtiResponseProcessing | undefined;
|
|
425
|
+
interactions: QtiInteraction[];
|
|
426
|
+
modalFeedback: QtiModalFeedback[];
|
|
427
|
+
catalogInfo?: QtiCatalogInfo | undefined;
|
|
428
|
+
catalogReferences: QtiCatalogReference[];
|
|
429
|
+
stylesheets: QtiStylesheet[];
|
|
430
|
+
body: QtiContentNode[];
|
|
431
|
+
bodyText: string;
|
|
432
|
+
source?: QtiSourceLocation | undefined;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
export interface QtiModalFeedback {
|
|
436
|
+
identifier: string;
|
|
437
|
+
outcomeIdentifier: string;
|
|
438
|
+
showHide: "show" | "hide";
|
|
439
|
+
text: string;
|
|
440
|
+
source?: QtiSourceLocation | undefined;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
export interface QtiResponseProcessing {
|
|
444
|
+
template?: string | undefined;
|
|
445
|
+
rules: QtiResponseRule[];
|
|
446
|
+
conditions: QtiResponseCondition[];
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
export interface QtiResponseCondition {
|
|
450
|
+
ifExpression?: QtiProcessingExpression | undefined;
|
|
451
|
+
thenRules: QtiResponseRule[];
|
|
452
|
+
elseIfs: QtiResponseBranch[];
|
|
453
|
+
elseRules: QtiResponseRule[];
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export interface QtiResponseBranch {
|
|
457
|
+
expression?: QtiProcessingExpression | undefined;
|
|
458
|
+
rules: QtiResponseRule[];
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
export type QtiResponseRule =
|
|
462
|
+
| QtiSetOutcomeValue
|
|
463
|
+
| QtiLookupOutcomeValue
|
|
464
|
+
| { type: "exitResponse"; source?: QtiSourceLocation | undefined }
|
|
465
|
+
| { type: "responseCondition"; condition: QtiResponseCondition; source?: QtiSourceLocation }
|
|
466
|
+
| {
|
|
467
|
+
type: "responseProcessingFragment";
|
|
468
|
+
rules: QtiResponseRule[];
|
|
469
|
+
source?: QtiSourceLocation | undefined;
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
export interface QtiSetOutcomeValue {
|
|
473
|
+
type: "setOutcomeValue";
|
|
474
|
+
identifier: string;
|
|
475
|
+
expression: QtiProcessingExpression;
|
|
476
|
+
source?: QtiSourceLocation | undefined;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
export interface QtiLookupOutcomeValue {
|
|
480
|
+
type: "lookupOutcomeValue";
|
|
481
|
+
identifier: string;
|
|
482
|
+
expression: QtiProcessingExpression;
|
|
483
|
+
source?: QtiSourceLocation | undefined;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export interface QtiTemplateProcessing {
|
|
487
|
+
rules: QtiTemplateRule[];
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export type QtiTemplateRule =
|
|
491
|
+
| {
|
|
492
|
+
type: "setTemplateValue";
|
|
493
|
+
identifier: string;
|
|
494
|
+
expression: QtiProcessingExpression;
|
|
495
|
+
source?: QtiSourceLocation | undefined;
|
|
496
|
+
}
|
|
497
|
+
| {
|
|
498
|
+
type: "setDefaultValue";
|
|
499
|
+
identifier: string;
|
|
500
|
+
expression: QtiProcessingExpression;
|
|
501
|
+
source?: QtiSourceLocation | undefined;
|
|
502
|
+
}
|
|
503
|
+
| {
|
|
504
|
+
type: "setCorrectResponse";
|
|
505
|
+
identifier: string;
|
|
506
|
+
expression: QtiProcessingExpression;
|
|
507
|
+
source?: QtiSourceLocation | undefined;
|
|
508
|
+
}
|
|
509
|
+
| {
|
|
510
|
+
type: "templateCondition";
|
|
511
|
+
ifExpression?: QtiProcessingExpression | undefined;
|
|
512
|
+
thenRules: QtiTemplateRule[];
|
|
513
|
+
elseIfs: QtiTemplateBranch[];
|
|
514
|
+
elseRules: QtiTemplateRule[];
|
|
515
|
+
source?: QtiSourceLocation | undefined;
|
|
516
|
+
}
|
|
517
|
+
| {
|
|
518
|
+
type: "exitTemplate";
|
|
519
|
+
source?: QtiSourceLocation | undefined;
|
|
520
|
+
}
|
|
521
|
+
| {
|
|
522
|
+
type: "templateConstraint";
|
|
523
|
+
expression: QtiProcessingExpression;
|
|
524
|
+
source?: QtiSourceLocation | undefined;
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
export interface QtiTemplateBranch {
|
|
528
|
+
expression?: QtiProcessingExpression | undefined;
|
|
529
|
+
rules: QtiTemplateRule[];
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
export type QtiProcessingExpression = (
|
|
533
|
+
| {
|
|
534
|
+
type: "baseValue";
|
|
535
|
+
value: QtiValue;
|
|
536
|
+
rawValue?: string | undefined;
|
|
537
|
+
baseType?: string | undefined;
|
|
538
|
+
}
|
|
539
|
+
| { type: "null" }
|
|
540
|
+
| { type: "isNull"; identifier: string }
|
|
541
|
+
| { type: "matchCorrect"; identifier: string; correctIdentifier: string }
|
|
542
|
+
| { type: "match"; left: QtiProcessingExpression; right: QtiProcessingExpression }
|
|
543
|
+
| { type: "correct"; identifier: string }
|
|
544
|
+
| { type: "default"; identifier: string }
|
|
545
|
+
| { type: "mapResponse"; identifier: string }
|
|
546
|
+
| { type: "mapResponsePoint"; identifier: string }
|
|
547
|
+
| { type: "variable"; identifier: string }
|
|
548
|
+
| {
|
|
549
|
+
type: "randomInteger";
|
|
550
|
+
min: number;
|
|
551
|
+
max: number;
|
|
552
|
+
step: number;
|
|
553
|
+
attributes: Record<string, string>;
|
|
554
|
+
}
|
|
555
|
+
| {
|
|
556
|
+
type: "randomFloat";
|
|
557
|
+
min: number;
|
|
558
|
+
max: number;
|
|
559
|
+
attributes: Record<string, string>;
|
|
560
|
+
}
|
|
561
|
+
| { type: "random"; values: QtiProcessingExpression[] }
|
|
562
|
+
| { type: "multiple"; expressions: QtiProcessingExpression[] }
|
|
563
|
+
| { type: "ordered"; expressions: QtiProcessingExpression[] }
|
|
564
|
+
| { type: "index"; expression: QtiProcessingExpression; n: string }
|
|
565
|
+
| { type: "containerSize"; expression: QtiProcessingExpression }
|
|
566
|
+
| { type: "sum"; expressions: QtiProcessingExpression[] }
|
|
567
|
+
| { type: "product"; expressions: QtiProcessingExpression[] }
|
|
568
|
+
| { type: "min"; expressions: QtiProcessingExpression[] }
|
|
569
|
+
| { type: "max"; expressions: QtiProcessingExpression[] }
|
|
570
|
+
| { type: "subtract"; left: QtiProcessingExpression; right: QtiProcessingExpression }
|
|
571
|
+
| { type: "divide"; left: QtiProcessingExpression; right: QtiProcessingExpression }
|
|
572
|
+
| { type: "power"; left: QtiProcessingExpression; right: QtiProcessingExpression }
|
|
573
|
+
| { type: "integerDivide"; left: QtiProcessingExpression; right: QtiProcessingExpression }
|
|
574
|
+
| { type: "integerModulus"; left: QtiProcessingExpression; right: QtiProcessingExpression }
|
|
575
|
+
| { type: "round"; expression: QtiProcessingExpression }
|
|
576
|
+
| {
|
|
577
|
+
type: "roundTo";
|
|
578
|
+
expression: QtiProcessingExpression;
|
|
579
|
+
roundingMode: "decimalPlaces" | "significantFigures";
|
|
580
|
+
figures: number;
|
|
581
|
+
}
|
|
582
|
+
| { type: "truncate"; expression: QtiProcessingExpression }
|
|
583
|
+
| { type: "integerToFloat"; expression: QtiProcessingExpression }
|
|
584
|
+
| { type: "and"; expressions: QtiProcessingExpression[] }
|
|
585
|
+
| { type: "anyN"; expressions: QtiProcessingExpression[]; min: string; max: string }
|
|
586
|
+
| { type: "or"; expressions: QtiProcessingExpression[] }
|
|
587
|
+
| { type: "not"; expression: QtiProcessingExpression }
|
|
588
|
+
| { type: "equal"; left: QtiProcessingExpression; right: QtiProcessingExpression }
|
|
589
|
+
| {
|
|
590
|
+
type: "equalRounded";
|
|
591
|
+
left: QtiProcessingExpression;
|
|
592
|
+
right: QtiProcessingExpression;
|
|
593
|
+
roundingMode: string;
|
|
594
|
+
figures: number;
|
|
595
|
+
}
|
|
596
|
+
| {
|
|
597
|
+
type: "numericCompare";
|
|
598
|
+
operator: "lt" | "lte" | "gt" | "gte";
|
|
599
|
+
left: QtiProcessingExpression;
|
|
600
|
+
right: QtiProcessingExpression;
|
|
601
|
+
}
|
|
602
|
+
| {
|
|
603
|
+
type: "durationCompare";
|
|
604
|
+
operator: "lt" | "gte";
|
|
605
|
+
left: QtiProcessingExpression;
|
|
606
|
+
right: QtiProcessingExpression;
|
|
607
|
+
}
|
|
608
|
+
| {
|
|
609
|
+
type: "stringMatch";
|
|
610
|
+
left: QtiProcessingExpression;
|
|
611
|
+
right: QtiProcessingExpression;
|
|
612
|
+
caseSensitive: boolean;
|
|
613
|
+
substring: boolean;
|
|
614
|
+
}
|
|
615
|
+
| {
|
|
616
|
+
type: "substring";
|
|
617
|
+
left: QtiProcessingExpression;
|
|
618
|
+
right: QtiProcessingExpression;
|
|
619
|
+
caseSensitive: boolean;
|
|
620
|
+
}
|
|
621
|
+
| { type: "patternMatch"; expression: QtiProcessingExpression; pattern: string }
|
|
622
|
+
| { type: "fieldValue"; fieldIdentifier: string; expression: QtiProcessingExpression }
|
|
623
|
+
| { type: "member"; value: QtiProcessingExpression; collection: QtiProcessingExpression }
|
|
624
|
+
| { type: "delete"; value: QtiProcessingExpression; collection: QtiProcessingExpression }
|
|
625
|
+
| { type: "contains"; collection: QtiProcessingExpression; values: QtiProcessingExpression }
|
|
626
|
+
| { type: "gcd"; expressions: QtiProcessingExpression[] }
|
|
627
|
+
| {
|
|
628
|
+
type: "inside";
|
|
629
|
+
expression: QtiProcessingExpression;
|
|
630
|
+
shape: "circle" | "rect" | "poly" | "default";
|
|
631
|
+
coords: number[];
|
|
632
|
+
attributes: Record<string, string>;
|
|
633
|
+
}
|
|
634
|
+
| { type: "lcm"; expressions: QtiProcessingExpression[] }
|
|
635
|
+
| { type: "mathConstant"; name: string }
|
|
636
|
+
| { type: "mathOperator"; name: string; expressions: QtiProcessingExpression[] }
|
|
637
|
+
| { type: "repeat"; numberRepeats: string; expressions: QtiProcessingExpression[] }
|
|
638
|
+
| { type: "statsOperator"; name: string; expression: QtiProcessingExpression }
|
|
639
|
+
| {
|
|
640
|
+
type: "customOperator";
|
|
641
|
+
definition?: string | undefined;
|
|
642
|
+
className?: string | undefined;
|
|
643
|
+
attributes: Record<string, string>;
|
|
644
|
+
expressions: QtiProcessingExpression[];
|
|
645
|
+
}
|
|
646
|
+
) & { source?: QtiSourceLocation | undefined };
|
|
647
|
+
|
|
648
|
+
export interface QtiDocument {
|
|
649
|
+
item: QtiAssessmentItem;
|
|
650
|
+
diagnostics: QtiDiagnostic[];
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
export interface QtiParseResult {
|
|
654
|
+
ok: boolean;
|
|
655
|
+
document?: QtiDocument | undefined;
|
|
656
|
+
diagnostics: QtiDiagnostic[];
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
export interface QtiValidationResult {
|
|
660
|
+
ok: boolean;
|
|
661
|
+
diagnostics: QtiDiagnostic[];
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
export interface QtiAttemptStateV1 {
|
|
665
|
+
schema: "qti3.attempt-state.v1";
|
|
666
|
+
itemIdentifier: string;
|
|
667
|
+
status: QtiAttemptStatus;
|
|
668
|
+
responses: Record<string, QtiValue>;
|
|
669
|
+
outcomes: Record<string, QtiValue>;
|
|
670
|
+
templateValues?: Record<string, QtiValue> | undefined;
|
|
671
|
+
interactionStates?: Record<string, QtiPortableCustomStateValue> | undefined;
|
|
672
|
+
validationMessages: QtiDiagnostic[];
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
export interface QtiScoreResult {
|
|
676
|
+
outcomes: Record<string, QtiValue>;
|
|
677
|
+
diagnostics: QtiDiagnostic[];
|
|
678
|
+
state: QtiAttemptStateV1;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
export type QtiElementSupport = QtiInteractionElementSupport | QtiProcessingElementSupport;
|
|
682
|
+
|
|
683
|
+
interface QtiElementSupportBase {
|
|
684
|
+
qtiName: string;
|
|
685
|
+
support: QtiSupportStatus;
|
|
686
|
+
specReference: string;
|
|
687
|
+
parse: boolean;
|
|
688
|
+
validate: boolean;
|
|
689
|
+
render: boolean;
|
|
690
|
+
process: boolean;
|
|
691
|
+
fixtures: string[];
|
|
692
|
+
tests: string[];
|
|
693
|
+
notes?: string | undefined;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
export interface QtiInteractionElementSupport extends QtiElementSupportBase {
|
|
697
|
+
category: "interaction";
|
|
698
|
+
interactionType: QtiInteractionType;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
export interface QtiProcessingElementSupport extends QtiElementSupportBase {
|
|
702
|
+
category: "processing";
|
|
703
|
+
}
|