@pie-qti/assessment-player 0.1.1 → 0.1.5
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 +19 -16
- package/dist/core/AssessmentPlayer.d.ts +30 -8
- package/dist/core/AssessmentPlayer.d.ts.map +1 -1
- package/dist/core/AssessmentPlayer.js +134 -40
- package/dist/core/TimeManager.d.ts +9 -0
- package/dist/core/TimeManager.d.ts.map +1 -1
- package/dist/core/TimeManager.js +16 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/integration/ReferenceBackendAdapter.d.ts +28 -2
- package/dist/integration/ReferenceBackendAdapter.d.ts.map +1 -1
- package/dist/integration/ReferenceBackendAdapter.js +385 -15
- package/dist/integration/api-contract.d.ts +88 -17
- package/dist/integration/api-contract.d.ts.map +1 -1
- package/dist/integration/index.d.ts +1 -1
- package/dist/integration/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +100 -80
- package/src/components/AssessmentShell.svelte +8 -8
- package/src/components/ItemRenderer.svelte +8 -8
- package/src/components/NavigationBar.svelte +3 -1
- package/src/components/RubricDisplay.svelte +2 -2
- package/src/components/index.ts +1 -1
- package/src/core/AssessmentPlayer.ts +164 -51
- package/src/core/TimeManager.ts +20 -3
- package/src/index.ts +1 -1
- package/src/integration/ReferenceBackendAdapter.ts +454 -23
- package/src/integration/api-contract.ts +89 -17
- package/src/integration/index.ts +5 -5
- package/src/types/index.ts +1 -1
- package/.turbo/turbo-build.log +0 -1
- package/BACKEND-INTEGRATION.md +0 -620
- package/CHANGELOG.md +0 -11
- package/EXTENSIBILITY.md +0 -551
- package/svelte.config.js +0 -8
- package/tests/ReferenceBackendAdapter.spec.ts +0 -309
- package/tests/setup.ts +0 -103
- package/tests/smoke.test.ts +0 -7
- package/tsconfig.json +0 -20
- package/tsconfig.svelte.json +0 -10
|
@@ -49,7 +49,7 @@ export interface InitSessionResponse {
|
|
|
49
49
|
/** Assessment structure WITHOUT sensitive data */
|
|
50
50
|
assessment: SecureAssessment;
|
|
51
51
|
/** Restored state if resuming, undefined if new session */
|
|
52
|
-
restoredState?:
|
|
52
|
+
restoredState?: AssessmentSessionState;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
// ============================================================================
|
|
@@ -61,6 +61,18 @@ export interface InitSessionResponse {
|
|
|
61
61
|
*
|
|
62
62
|
* Security: NO correct answers, NO scoring rules, NO sensitive rubrics
|
|
63
63
|
*/
|
|
64
|
+
export interface TestFeedbackItem {
|
|
65
|
+
identifier: string;
|
|
66
|
+
/** Outcome variable name to evaluate (e.g. "PASS", "GRADE") */
|
|
67
|
+
outcomeIdentifier: string;
|
|
68
|
+
/** 'show' = show when outcome equals identifier; 'hide' = show when it does not */
|
|
69
|
+
showHide: 'show' | 'hide';
|
|
70
|
+
/** 'atEnd' = only after submission; 'during' = also during attempt */
|
|
71
|
+
access: 'atEnd' | 'during';
|
|
72
|
+
/** HTML content to display */
|
|
73
|
+
content: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
64
76
|
export interface SecureAssessment {
|
|
65
77
|
identifier: string;
|
|
66
78
|
title: string;
|
|
@@ -75,6 +87,19 @@ export interface SecureAssessment {
|
|
|
75
87
|
maxTime?: number; // seconds
|
|
76
88
|
allowLateSubmission?: boolean;
|
|
77
89
|
};
|
|
90
|
+
/** QTI outcomeDeclarations for test-level variables */
|
|
91
|
+
outcomeDeclarations?: Array<{
|
|
92
|
+
identifier: string;
|
|
93
|
+
baseType: string;
|
|
94
|
+
cardinality: string;
|
|
95
|
+
defaultValue?: unknown;
|
|
96
|
+
}>;
|
|
97
|
+
/** Raw <outcomeProcessing> XML string, if present */
|
|
98
|
+
outcomeProcessingXml?: string;
|
|
99
|
+
/** Base URL/path for resolving relative hrefs (e.g. assessmentSectionRef) */
|
|
100
|
+
baseUrl?: string;
|
|
101
|
+
/** QTI testFeedback blocks for post-submission display */
|
|
102
|
+
testFeedback?: TestFeedbackItem[];
|
|
78
103
|
}
|
|
79
104
|
|
|
80
105
|
export interface SecureTestPart {
|
|
@@ -82,7 +107,7 @@ export interface SecureTestPart {
|
|
|
82
107
|
/** Sections contain items */
|
|
83
108
|
sections: SecureSection[];
|
|
84
109
|
/** Candidate instructions (safe for display) */
|
|
85
|
-
|
|
110
|
+
rubricBlocks?: AssessmentRubricBlock[];
|
|
86
111
|
/**
|
|
87
112
|
* Item session control (QTI testPart/itemSessionControl).
|
|
88
113
|
* Server is authoritative; client uses this for UI hints only.
|
|
@@ -103,14 +128,43 @@ export interface SecureSection {
|
|
|
103
128
|
title?: string;
|
|
104
129
|
/** Visible determines if section appears in navigation */
|
|
105
130
|
visible: boolean;
|
|
106
|
-
/**
|
|
107
|
-
|
|
131
|
+
/** Assessment item references (order reflects selection/ordering already applied server-side) */
|
|
132
|
+
assessmentItemRefs: SecureItemRef[];
|
|
108
133
|
/** Section-level time limit */
|
|
109
134
|
timeLimits?: {
|
|
110
135
|
maxTime?: number;
|
|
111
136
|
};
|
|
112
137
|
/** Candidate instructions (safe for display) */
|
|
113
|
-
|
|
138
|
+
rubricBlocks?: AssessmentRubricBlock[];
|
|
139
|
+
/**
|
|
140
|
+
* QTI selection: how many items to present from this section.
|
|
141
|
+
* When present the server has already applied selection; client uses this for progress display.
|
|
142
|
+
*/
|
|
143
|
+
selection?: {
|
|
144
|
+
/** Number of items selected for this session */
|
|
145
|
+
select: number;
|
|
146
|
+
withReplacement?: boolean;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* QTI ordering: whether items were shuffled.
|
|
150
|
+
* When true the server has already shuffled assessmentItemRefs.
|
|
151
|
+
*/
|
|
152
|
+
ordering?: {
|
|
153
|
+
shuffle: boolean;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Item session control (QTI assessmentSection/itemSessionControl).
|
|
157
|
+
* Section-level values take precedence over testPart-level when present.
|
|
158
|
+
*/
|
|
159
|
+
itemSessionControl?: {
|
|
160
|
+
maxAttempts?: number;
|
|
161
|
+
showFeedback?: boolean;
|
|
162
|
+
allowReview?: boolean;
|
|
163
|
+
showSolution?: boolean;
|
|
164
|
+
allowComment?: boolean;
|
|
165
|
+
allowSkipping?: boolean;
|
|
166
|
+
validateResponses?: boolean;
|
|
167
|
+
};
|
|
114
168
|
}
|
|
115
169
|
|
|
116
170
|
export interface SecureItemRef {
|
|
@@ -122,9 +176,21 @@ export interface SecureItemRef {
|
|
|
122
176
|
role: QTIRole;
|
|
123
177
|
/** Required=true means item must be attempted */
|
|
124
178
|
required?: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* QTI branchRule: ordered list of branch rules on this item.
|
|
181
|
+
* The backend evaluates these after scoring and returns nextItemIdentifier in SubmitResponsesResponse.
|
|
182
|
+
* Carried here so reference/demo adapters can evaluate them client-side.
|
|
183
|
+
*/
|
|
184
|
+
branchRule?: Array<{
|
|
185
|
+
/** Identifier of the target item, section, testPart, or one of the special values:
|
|
186
|
+
* EXIT_TEST | EXIT_TESTPART | EXIT_SECTION */
|
|
187
|
+
target: string;
|
|
188
|
+
/** Serialised QTI expression XML (the child of <branchRule>). Absent means unconditional. */
|
|
189
|
+
conditionXml?: string;
|
|
190
|
+
}>;
|
|
125
191
|
}
|
|
126
192
|
|
|
127
|
-
export interface
|
|
193
|
+
export interface AssessmentRubricBlock {
|
|
128
194
|
/** Optional rubric identifier (QTI rubricBlock@identifier) */
|
|
129
195
|
identifier?: string;
|
|
130
196
|
/** Rubric content (HTML) */
|
|
@@ -165,7 +231,7 @@ export interface SubmitResponsesResponse {
|
|
|
165
231
|
/** Was submission accepted? */
|
|
166
232
|
success: boolean;
|
|
167
233
|
/** Scoring result (if submission mode allows immediate scoring) */
|
|
168
|
-
result?:
|
|
234
|
+
result?: AssessmentScoringResult;
|
|
169
235
|
/**
|
|
170
236
|
* Backend-authoritative next item (branching/navigation decision).
|
|
171
237
|
* If omitted, client may fall back to linear next/previous UI navigation.
|
|
@@ -175,7 +241,7 @@ export interface SubmitResponsesResponse {
|
|
|
175
241
|
* Backend-authoritative session state snapshot after applying the submission.
|
|
176
242
|
* If provided, client should replace its local state with this.
|
|
177
243
|
*/
|
|
178
|
-
updatedState?:
|
|
244
|
+
updatedState?: AssessmentSessionState;
|
|
179
245
|
/** Error message if success=false */
|
|
180
246
|
error?: string;
|
|
181
247
|
}
|
|
@@ -189,7 +255,7 @@ export interface SubmitResponsesResponse {
|
|
|
189
255
|
*
|
|
190
256
|
* Security: Server computes this, client never sees scoring rules
|
|
191
257
|
*/
|
|
192
|
-
export interface
|
|
258
|
+
export interface AssessmentScoringResult {
|
|
193
259
|
/** Item identifier */
|
|
194
260
|
itemIdentifier: string;
|
|
195
261
|
/** Normalized score 0.0-1.0 */
|
|
@@ -222,12 +288,12 @@ export interface FeedbackItem {
|
|
|
222
288
|
*
|
|
223
289
|
* Security: State includes responses but not scores (until finalized)
|
|
224
290
|
*/
|
|
225
|
-
export interface
|
|
291
|
+
export interface SaveAssessmentStateRequest {
|
|
226
292
|
sessionId: SessionId;
|
|
227
|
-
state:
|
|
293
|
+
state: AssessmentSessionState;
|
|
228
294
|
}
|
|
229
295
|
|
|
230
|
-
export interface
|
|
296
|
+
export interface SaveAssessmentStateResponse {
|
|
231
297
|
success: boolean;
|
|
232
298
|
/** Server timestamp of save */
|
|
233
299
|
savedAt: number;
|
|
@@ -236,7 +302,7 @@ export interface SaveStateResponse {
|
|
|
236
302
|
/**
|
|
237
303
|
* Session state for persistence
|
|
238
304
|
*/
|
|
239
|
-
export interface
|
|
305
|
+
export interface AssessmentSessionState {
|
|
240
306
|
/** Current item identifier */
|
|
241
307
|
currentItemIdentifier: string;
|
|
242
308
|
/** Visited items (for navigation) */
|
|
@@ -244,7 +310,7 @@ export interface SessionState {
|
|
|
244
310
|
/** Submitted responses per item */
|
|
245
311
|
itemResponses: Record<string, Record<string, ResponseValue>>;
|
|
246
312
|
/** Scoring results per item (populated after submission) */
|
|
247
|
-
itemScores?: Record<string,
|
|
313
|
+
itemScores?: Record<string, AssessmentScoringResult>;
|
|
248
314
|
/** Time tracking */
|
|
249
315
|
timing: {
|
|
250
316
|
/** Session start time */
|
|
@@ -276,9 +342,15 @@ export interface FinalizeAssessmentResponse {
|
|
|
276
342
|
/** Maximum possible score */
|
|
277
343
|
maxScore: number;
|
|
278
344
|
/** Per-item results */
|
|
279
|
-
itemScores: Record<string,
|
|
280
|
-
/** Assessment-level feedback */
|
|
345
|
+
itemScores: Record<string, AssessmentScoringResult>;
|
|
346
|
+
/** Assessment-level feedback (legacy: single string; prefer outcomes + assessment.testFeedback) */
|
|
281
347
|
feedback?: string;
|
|
348
|
+
/**
|
|
349
|
+
* Test-level outcome variable values after outcomeProcessing.
|
|
350
|
+
* Used to evaluate testFeedback visibility via string equality.
|
|
351
|
+
* Keys are outcome identifiers (e.g. "PASS", "GRADE"); values are their string representations.
|
|
352
|
+
*/
|
|
353
|
+
outcomes?: Record<string, string>;
|
|
282
354
|
/** Server timestamp */
|
|
283
355
|
finalizedAt: number;
|
|
284
356
|
}
|
|
@@ -356,7 +428,7 @@ export interface BackendAdapter {
|
|
|
356
428
|
/**
|
|
357
429
|
* Save session state (auto-save during assessment)
|
|
358
430
|
*/
|
|
359
|
-
saveState(request:
|
|
431
|
+
saveState(request: SaveAssessmentStateRequest): Promise<SaveAssessmentStateResponse>;
|
|
360
432
|
|
|
361
433
|
/**
|
|
362
434
|
* Finalize assessment and get results
|
package/src/integration/index.ts
CHANGED
|
@@ -47,21 +47,21 @@
|
|
|
47
47
|
export type {
|
|
48
48
|
BackendAdapter,
|
|
49
49
|
FeedbackItem,
|
|
50
|
+
AssessmentSessionState,
|
|
51
|
+
AssessmentScoringResult,
|
|
52
|
+
AssessmentRubricBlock,
|
|
50
53
|
FinalizeAssessmentRequest,
|
|
51
54
|
FinalizeAssessmentResponse,
|
|
52
55
|
InitSessionRequest,
|
|
53
56
|
InitSessionResponse,
|
|
54
57
|
ResponseValue,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
SaveStateResponse,
|
|
58
|
-
ScoringResult,
|
|
58
|
+
SaveAssessmentStateRequest,
|
|
59
|
+
SaveAssessmentStateResponse,
|
|
59
60
|
SecureAssessment,
|
|
60
61
|
SecureItemRef,
|
|
61
62
|
SecureSection,
|
|
62
63
|
SecureTestPart,
|
|
63
64
|
SessionId,
|
|
64
|
-
SessionState,
|
|
65
65
|
SubmitResponsesRequest,
|
|
66
66
|
SubmitResponsesResponse,
|
|
67
67
|
} from './api-contract.js';
|
package/src/types/index.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type QTIRole = import('@pie-qti/item-player').QTIRole;
|
|
|
10
10
|
/**
|
|
11
11
|
* Minimal item reference shape used by the UI renderer.
|
|
12
12
|
*/
|
|
13
|
-
export interface
|
|
13
|
+
export interface ItemRef {
|
|
14
14
|
identifier: string;
|
|
15
15
|
title?: string;
|
|
16
16
|
required?: boolean;
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
$ tsc
|