@pie-qti/assessment-player 0.1.28 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/core/AssessmentPlayer.d.ts +54 -14
- package/dist/core/AssessmentPlayer.js +204 -166
- package/dist/core/AssessmentPlayer.js.map +1 -1
- package/dist/core/AssessmentSessionCoordinator.d.ts +10 -2
- package/dist/core/AssessmentSessionCoordinator.js +24 -3
- package/dist/core/AssessmentSessionCoordinator.js.map +1 -1
- package/dist/core/ItemSessionController.d.ts +14 -3
- package/dist/core/ItemSessionController.js +31 -12
- package/dist/core/ItemSessionController.js.map +1 -1
- package/dist/core/TimeManager.d.ts +20 -7
- package/dist/core/TimeManager.js +20 -18
- package/dist/core/TimeManager.js.map +1 -1
- package/dist/core/testStructure.d.ts +65 -0
- package/dist/core/testStructure.js +336 -0
- package/dist/core/testStructure.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/integration/ReferenceBackendAdapter.d.ts +53 -5
- package/dist/integration/ReferenceBackendAdapter.js +317 -230
- package/dist/integration/ReferenceBackendAdapter.js.map +1 -1
- package/dist/integration/api-contract.d.ts +92 -49
- package/dist/integration/api-contract.js.map +1 -1
- package/dist/integration/assessment-item-scorer.d.ts +11 -1
- package/dist/integration/assessment-item-scorer.js +102 -12
- package/dist/integration/assessment-item-scorer.js.map +1 -1
- package/dist/integration/index.d.ts +1 -1
- package/dist/integration/index.js.map +1 -1
- package/dist/integration/toSectionComposition.js +1 -0
- package/dist/integration/toSectionComposition.js.map +1 -1
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -176,6 +176,19 @@ XML, own authoritative scoring state, and validate every client submission. See
|
|
|
176
176
|
responses and serialized item sessions across backend state replacements.
|
|
177
177
|
- `submit()` finishes by calling `finalizeAssessment()` and returns `AssessmentResults`.
|
|
178
178
|
|
|
179
|
+
## Test feedback
|
|
180
|
+
|
|
181
|
+
`testFeedback` on the `assessmentTest` and on each `testPart` shows by the outcome values the backend
|
|
182
|
+
returns from `submitResponses`, a resumed `initSession` and `finalizeAssessment`
|
|
183
|
+
(`TestOutcomeValues`: a scalar, an array for a multiple or ordered outcome, `null` for NULL). The
|
|
184
|
+
`identifier` matches a single outcome by equality and a container by membership; `showHide="hide"`
|
|
185
|
+
inverts it. Nothing shows before outcomes first arrive. Test-level `access="during"` feedback then
|
|
186
|
+
shows by its outcome and `atEnd` once the test is finalized. A part's `during` feedback shows while
|
|
187
|
+
the part is current and its `atEnd` once the candidate has moved past it or the test is finalized.
|
|
188
|
+
|
|
189
|
+
`getVisibleFeedback()` returns the shown blocks as `VisibleTestFeedback`, and
|
|
190
|
+
`onTestFeedbackChange(listener)` reports each change and returns an unsubscribe function.
|
|
191
|
+
|
|
179
192
|
The optional `sendItemSessionToBackend` flag includes the rich serialized item-session snapshot in
|
|
180
193
|
submission requests. Treat that snapshot as untrusted client save data; a production backend should
|
|
181
194
|
validate it against server-owned source and state.
|
|
@@ -11,15 +11,28 @@ import { type AssessmentItemDefinitionPlugin, type ItemSession, type PciConfigur
|
|
|
11
11
|
import type { I18nProvider } from '@pie-qti/i18n';
|
|
12
12
|
import type { QtiSectionRuntimeHostContract, QtiSectionToolConfig } from '@pie-qti/section-player';
|
|
13
13
|
import type { AssessmentRubricBlock, AssessmentSessionState, BackendAdapter, InitSessionRequest, SecureItemRef } from '../integration/api-contract.js';
|
|
14
|
-
import type { AssessmentResults, ItemResult, NavigationState, TimeLimits } from '../types/index.js';
|
|
14
|
+
import type { AssessmentResults, ItemResult, NavigationState, TimeLimits, VisibleTestFeedback } from '../types/index.js';
|
|
15
15
|
export interface BackendAssessmentPlayerConfig {
|
|
16
16
|
backend: BackendAdapter;
|
|
17
17
|
initSession: InitSessionRequest;
|
|
18
18
|
role?: QTIRole;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Ignored. The backend draws selection and ordering at session start; pass an rng to
|
|
21
|
+
* `new ReferenceBackendAdapter({ rng })` for deterministic draws.
|
|
22
|
+
*/
|
|
20
23
|
rng?: () => number;
|
|
21
24
|
/** Definition-lifetime extractor and renderer extensions applied to every item. */
|
|
22
25
|
plugins?: readonly AssessmentItemDefinitionPlugin[];
|
|
26
|
+
/**
|
|
27
|
+
* Shared catalog files the package manifest lists (resource type
|
|
28
|
+
* `imsqti_catalog_xmlv3p0`), read by the host that loaded the package. When the
|
|
29
|
+
* reference backend parses the assessment test they become package-scope
|
|
30
|
+
* catalog sources beneath item-level catalogs (QTI 3.0 §6.3).
|
|
31
|
+
*/
|
|
32
|
+
sharedCatalogs?: ReadonlyArray<{
|
|
33
|
+
href?: string;
|
|
34
|
+
xml?: string;
|
|
35
|
+
}>;
|
|
23
36
|
/**
|
|
24
37
|
* Optional i18n provider for internationalization.
|
|
25
38
|
* If provided, this will be shared across all item players in the assessment.
|
|
@@ -56,6 +69,11 @@ export interface BackendAssessmentPlayerConfig {
|
|
|
56
69
|
allowSectionNavigation?: boolean;
|
|
57
70
|
showProgress?: boolean;
|
|
58
71
|
timeWarningThreshold?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Deterministic clock for time-limit tracking. Defaults to Date.now; intended for
|
|
74
|
+
* tests and hosts that drive delivery from their own timeline.
|
|
75
|
+
*/
|
|
76
|
+
now?: () => number;
|
|
59
77
|
/**
|
|
60
78
|
* QTI 3.0 §6.2 Personal Needs and Preferences profile.
|
|
61
79
|
* Extended time (pnp.content.extendedTime) is applied to assessment timeLimits.
|
|
@@ -101,23 +119,23 @@ export declare class AssessmentPlayer {
|
|
|
101
119
|
private readonly itemDefinitions;
|
|
102
120
|
private currentItemSession;
|
|
103
121
|
private currentItemSessionUnsubscribe;
|
|
104
|
-
|
|
122
|
+
/** Test-level outcomes from the last outcome processing; null until it first runs. */
|
|
123
|
+
private testOutcomes;
|
|
124
|
+
private finalized;
|
|
125
|
+
/** Scopes whose time limit expired without late submission, keyed `scope:identifier`. */
|
|
126
|
+
private readonly lockedScopes;
|
|
127
|
+
private legacyFeedback;
|
|
105
128
|
private itemChangeListeners;
|
|
106
129
|
private sectionChangeListeners;
|
|
107
130
|
private responseChangeListeners;
|
|
108
131
|
private completeListeners;
|
|
132
|
+
private testFeedbackChangeListeners;
|
|
109
133
|
private timeWarningListeners;
|
|
110
134
|
private timeExpiredListeners;
|
|
111
135
|
private timeTickListeners;
|
|
112
136
|
private constructor();
|
|
113
137
|
private get state();
|
|
114
138
|
private set state(value);
|
|
115
|
-
/**
|
|
116
|
-
* Compute effective itemSessionControl for a given item using three-level fallback:
|
|
117
|
-
* section-level (highest priority) → testPart-level → defaults.
|
|
118
|
-
* Section-level values override testPart-level when present.
|
|
119
|
-
*/
|
|
120
|
-
private getEffectiveItemSessionControl;
|
|
121
139
|
private getEffectiveItemTimeLimits;
|
|
122
140
|
getCurrentEffectiveTimeLimits(): EffectiveItemTimeLimits;
|
|
123
141
|
private getSubmitTimingEvidence;
|
|
@@ -144,11 +162,15 @@ export declare class AssessmentPlayer {
|
|
|
144
162
|
getResponsesForItem(itemIdentifier: string): Record<string, unknown>;
|
|
145
163
|
getCurrentSharedRubricBlocks(): AssessmentRubricBlock[];
|
|
146
164
|
getCurrentRubricBlocks(): AssessmentRubricBlock[];
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
165
|
+
/**
|
|
166
|
+
* Test feedback shown now, test-level first, then each test part's. Nothing shows before outcome
|
|
167
|
+
* processing first runs. `during` feedback then shows by its outcome, test-part `during`
|
|
168
|
+
* feedback while its part is current; `atEnd` feedback shows once the test, or its test part,
|
|
169
|
+
* has ended.
|
|
170
|
+
*/
|
|
171
|
+
getVisibleFeedback(): VisibleTestFeedback[];
|
|
172
|
+
private currentTestPartIndex;
|
|
173
|
+
private setTestOutcomes;
|
|
152
174
|
updateResponse(responseId: string, value: unknown): void;
|
|
153
175
|
/**
|
|
154
176
|
* Update a response for a specific item.
|
|
@@ -202,7 +224,14 @@ export declare class AssessmentPlayer {
|
|
|
202
224
|
showSolution: boolean;
|
|
203
225
|
canReview: boolean;
|
|
204
226
|
canSkip: boolean;
|
|
227
|
+
canComment: boolean;
|
|
205
228
|
} | null;
|
|
229
|
+
/**
|
|
230
|
+
* Records the candidate's comment on an item (QTI `allowComment`), sent with its next submission.
|
|
231
|
+
* Defaults to the current item; throws when the item does not allow comments.
|
|
232
|
+
*/
|
|
233
|
+
setItemComment(comment: string, itemIdentifier?: string): void;
|
|
234
|
+
getItemComment(itemIdentifier?: string): string | undefined;
|
|
206
235
|
getRemainingTime(): number;
|
|
207
236
|
getElapsedTime(): number;
|
|
208
237
|
isTimeExpired(): boolean;
|
|
@@ -210,6 +239,8 @@ export declare class AssessmentPlayer {
|
|
|
210
239
|
onSectionChange(listener: (index: number, total: number) => void): () => void;
|
|
211
240
|
onResponseChange(listener: (responses: Record<string, unknown>) => void): () => void;
|
|
212
241
|
onComplete(listener: () => void): () => void;
|
|
242
|
+
/** Called when `getVisibleFeedback()` may have changed: new outcomes, a new test part, or the end. */
|
|
243
|
+
onTestFeedbackChange(listener: () => void): () => void;
|
|
213
244
|
onTimeWarning(listener: (remainingSeconds: number) => void): () => void;
|
|
214
245
|
onTimeExpired(listener: () => void): () => void;
|
|
215
246
|
onTimeTick(listener: (remainingSeconds: number, elapsedSeconds: number) => void): () => void;
|
|
@@ -218,7 +249,16 @@ export declare class AssessmentPlayer {
|
|
|
218
249
|
private notifySectionChange;
|
|
219
250
|
private notifyResponseChange;
|
|
220
251
|
private notifyComplete;
|
|
252
|
+
private notifyTestFeedbackChange;
|
|
221
253
|
private notifyTimeWarning;
|
|
254
|
+
private evaluateTemplateDefaults;
|
|
255
|
+
private isItemLocked;
|
|
256
|
+
private nextUnlockedIndex;
|
|
257
|
+
/**
|
|
258
|
+
* A test part, section or item without late submission ran out of time: its items close for the
|
|
259
|
+
* candidate, and delivery moves to the next item outside it.
|
|
260
|
+
*/
|
|
261
|
+
private handleScopeExpired;
|
|
222
262
|
private notifyTimeExpired;
|
|
223
263
|
private notifyTimeTick;
|
|
224
264
|
/**
|