@playcademy/sdk 0.20.1-beta.2 → 0.20.1-beta.3
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/index.d.ts +1202 -26
- package/dist/index.js +1 -1
- package/dist/internal.d.ts +3195 -85
- package/dist/internal.js +1 -1
- package/dist/server/edge.d.ts +1298 -25
- package/dist/server/edge.js +1 -1
- package/dist/server.d.ts +1298 -25
- package/dist/server.js +1 -1
- package/dist/types.d.ts +1727 -29
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import * as _playcademy_types from '@playcademy/types';
|
|
2
|
-
import { LocalDayContext } from '@playcademy/types';
|
|
3
|
-
import { TimebackGrade, TimebackSubject, ELevel, ChildEndActivityScoreData, EndActivityRequest, HeartbeatRequest, EndActivityScoreData, EndActivityResponse } from '@playcademy/types/timeback';
|
|
4
|
-
import { TimebackUserRole, UserEnrollment, UserOrganization, UserInfo } from '@playcademy/types/user';
|
|
5
|
-
import { AUTH_PROVIDER_IDS } from '@playcademy/constants';
|
|
6
|
-
|
|
7
1
|
/**
|
|
8
2
|
* Base error class for Cademy SDK specific errors.
|
|
9
3
|
*/
|
|
@@ -174,6 +168,1188 @@ interface RetryPolicy {
|
|
|
174
168
|
retryDelaysMs?: readonly number[];
|
|
175
169
|
}
|
|
176
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Authentication Constants
|
|
173
|
+
*
|
|
174
|
+
* Constants related to authentication providers.
|
|
175
|
+
*/
|
|
176
|
+
/**
|
|
177
|
+
* Auth Provider Constants
|
|
178
|
+
*/
|
|
179
|
+
declare const AUTH_PROVIDER_IDS: {
|
|
180
|
+
readonly TIMEBACK: 'timeback';
|
|
181
|
+
readonly TIMEBACK_LTI: 'timeback-lti';
|
|
182
|
+
readonly PLAYCADEMY: 'playcademy';
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Platform user roles.
|
|
186
|
+
*/
|
|
187
|
+
declare const USER_ROLES: {
|
|
188
|
+
readonly ADMIN: 'admin';
|
|
189
|
+
readonly PLAYER: 'player';
|
|
190
|
+
readonly DEVELOPER: 'developer';
|
|
191
|
+
readonly TEACHER: 'teacher';
|
|
192
|
+
};
|
|
193
|
+
type UserRole = (typeof USER_ROLES)[keyof typeof USER_ROLES];
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Valid grade levels per AE OneRoster GradeEnum.
|
|
197
|
+
* -1 = Pre-K, 0 = Kindergarten, 1-12 = Grades 1-12, 13 = AP
|
|
198
|
+
*/
|
|
199
|
+
declare const TIMEBACK_GRADES: readonly [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
|
|
200
|
+
/**
|
|
201
|
+
* The TimeBack subject vocabulary, carried on courses, activity data, and
|
|
202
|
+
* Caliper events alike. 'None' is canonical: TimeBack accepts it as a course
|
|
203
|
+
* subject and uses it as the fallback for unknown or missing subjects.
|
|
204
|
+
*/
|
|
205
|
+
declare const TIMEBACK_SUBJECTS: readonly ['Reading', 'Language', 'Vocabulary', 'Social Studies', 'Writing', 'Science', 'FastMath', 'Math', 'None'];
|
|
206
|
+
/**
|
|
207
|
+
* Playcademy's course-specific meaning for reusable QTI test content.
|
|
208
|
+
* Result writers translate this to OneRoster assessment-result
|
|
209
|
+
* `metadata.testType`; it intentionally does not become metadata on the QTI
|
|
210
|
+
* test itself.
|
|
211
|
+
*/
|
|
212
|
+
declare const ASSESSMENT_PURPOSES: readonly ['end_of_course', 'diagnostic', 'review', 'mastery'];
|
|
213
|
+
/**
|
|
214
|
+
* Schema version of the playable assessment payload handed to a game.
|
|
215
|
+
*
|
|
216
|
+
* Distinct from an assessment's content revision: this identifies the shape of
|
|
217
|
+
* the contract, not the content inside it. Bumped when the payload gains a
|
|
218
|
+
* field or changes the meaning of one — never for content edits.
|
|
219
|
+
*
|
|
220
|
+
* Intended for diagnostics and for telling "this host does not support the
|
|
221
|
+
* field" apart from "this item does not use it". Games should branch on whether
|
|
222
|
+
* a field is present, not on this number: the content vocabularies are open by
|
|
223
|
+
* design, so feature detection keeps working across versions where a comparison
|
|
224
|
+
* does not.
|
|
225
|
+
*/
|
|
226
|
+
declare const PLAYCADEMY_ASSESSMENT_CONTRACT_VERSION: 2;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* User Types
|
|
230
|
+
*
|
|
231
|
+
* Enums, DTOs and API response types. Database row types are in @playcademy/data/types.
|
|
232
|
+
*
|
|
233
|
+
* @module types/user
|
|
234
|
+
*/
|
|
235
|
+
|
|
236
|
+
type UserRoleEnumType = UserRole;
|
|
237
|
+
type DeveloperStatusEnumType = 'none' | 'pending' | 'approved';
|
|
238
|
+
type TimebackUserRole = 'administrator' | 'aide' | 'guardian' | 'parent' | 'proctor' | 'relative' | 'student' | 'teacher';
|
|
239
|
+
type TimebackOrgType = 'department' | 'school' | 'district' | 'local' | 'state' | 'national';
|
|
240
|
+
interface UserEnrollment {
|
|
241
|
+
gameId?: string;
|
|
242
|
+
courseId: string;
|
|
243
|
+
id?: string;
|
|
244
|
+
grade: number;
|
|
245
|
+
subject: string;
|
|
246
|
+
orgId?: string;
|
|
247
|
+
}
|
|
248
|
+
interface UserOrganization {
|
|
249
|
+
id: string;
|
|
250
|
+
name: string | null;
|
|
251
|
+
type: TimebackOrgType | string;
|
|
252
|
+
isPrimary: boolean;
|
|
253
|
+
}
|
|
254
|
+
interface TimebackStudentProfile {
|
|
255
|
+
role: TimebackUserRole;
|
|
256
|
+
organizations: UserOrganization[];
|
|
257
|
+
}
|
|
258
|
+
interface UserTimebackData extends TimebackStudentProfile {
|
|
259
|
+
id: string;
|
|
260
|
+
enrollments: UserEnrollment[];
|
|
261
|
+
}
|
|
262
|
+
type LocalDaySource = 'browser_last_seen' | 'platform_default';
|
|
263
|
+
interface LocalDayContext {
|
|
264
|
+
timeZone: string;
|
|
265
|
+
source: LocalDaySource;
|
|
266
|
+
/** ISO 8601 timestamp for the last persisted timezone observation. */
|
|
267
|
+
observedAt: string | null;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* OpenID Connect UserInfo claims (NOT a database row).
|
|
271
|
+
*/
|
|
272
|
+
interface UserInfo {
|
|
273
|
+
sub: string;
|
|
274
|
+
email: string;
|
|
275
|
+
name: string | null;
|
|
276
|
+
email_verified?: boolean;
|
|
277
|
+
given_name?: string;
|
|
278
|
+
family_name?: string;
|
|
279
|
+
issuer?: string;
|
|
280
|
+
lti_roles?: unknown;
|
|
281
|
+
lti_context?: unknown;
|
|
282
|
+
lti_resource_link?: unknown;
|
|
283
|
+
timeback_id?: string;
|
|
284
|
+
}
|
|
285
|
+
interface DemoProfile {
|
|
286
|
+
displayName: string;
|
|
287
|
+
isDefault: boolean;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Update shape for `client.demo.profile.update(...)`.
|
|
291
|
+
*
|
|
292
|
+
* Kept as a named type so callers typed against it pick up new fields
|
|
293
|
+
* automatically, but `displayName` is the only updatable field today and
|
|
294
|
+
* the server's `DemoProfileSchema` requires it — a no-field payload would
|
|
295
|
+
* 400 at runtime, so we model that at the type level too. When additional
|
|
296
|
+
* fields land, make them required/optional individually based on server
|
|
297
|
+
* validation, rather than blanket-optional.
|
|
298
|
+
*/
|
|
299
|
+
interface DemoProfileUpdate {
|
|
300
|
+
displayName: string;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Authenticated user for API responses.
|
|
304
|
+
* Differs from UserRow: omits timebackId, adds hasTimebackAccount and timeback.
|
|
305
|
+
*/
|
|
306
|
+
interface AuthenticatedUser {
|
|
307
|
+
id: string;
|
|
308
|
+
email: string;
|
|
309
|
+
emailVerified: boolean;
|
|
310
|
+
name: string | null;
|
|
311
|
+
image: string | null;
|
|
312
|
+
username: string | null;
|
|
313
|
+
role: UserRoleEnumType;
|
|
314
|
+
developerStatus: DeveloperStatusEnumType;
|
|
315
|
+
createdAt: Date;
|
|
316
|
+
updatedAt: Date;
|
|
317
|
+
hasTimebackAccount: boolean;
|
|
318
|
+
localDay: LocalDayContext;
|
|
319
|
+
timeback?: UserTimebackData;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Leaderboard Types
|
|
324
|
+
*
|
|
325
|
+
* @module types/leaderboard
|
|
326
|
+
*/
|
|
327
|
+
type LeaderboardTimeframe = 'all_time' | 'monthly' | 'weekly' | 'daily';
|
|
328
|
+
interface LeaderboardOptions {
|
|
329
|
+
timeframe?: LeaderboardTimeframe;
|
|
330
|
+
limit?: number;
|
|
331
|
+
offset?: number;
|
|
332
|
+
gameId?: string;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Leaderboard entry with required game context.
|
|
336
|
+
* Used when fetching leaderboards for a specific game.
|
|
337
|
+
*/
|
|
338
|
+
interface GameLeaderboardEntry {
|
|
339
|
+
rank: number;
|
|
340
|
+
userId: string;
|
|
341
|
+
username: string;
|
|
342
|
+
userImage?: string | null;
|
|
343
|
+
score: number;
|
|
344
|
+
achievedAt: Date;
|
|
345
|
+
metadata?: Record<string, unknown>;
|
|
346
|
+
gameId: string;
|
|
347
|
+
gameTitle: string;
|
|
348
|
+
gameSlug: string;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* TimeBack Enums & Literal Types
|
|
353
|
+
*
|
|
354
|
+
* Basic type definitions used throughout the TimeBack integration. Unions
|
|
355
|
+
* derive from the canonical value lists in @playcademy/constants (type-only
|
|
356
|
+
* imports, so this package ships no runtime code).
|
|
357
|
+
*
|
|
358
|
+
* @module types/timeback/types
|
|
359
|
+
*/
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* The TimeBack subject vocabulary. 'None' is canonical: TimeBack accepts it
|
|
363
|
+
* on courses and uses it as the fallback for unknown or missing subjects.
|
|
364
|
+
*/
|
|
365
|
+
type TimebackSubject = (typeof TIMEBACK_SUBJECTS)[number];
|
|
366
|
+
/**
|
|
367
|
+
* Grade levels per AE OneRoster GradeEnum.
|
|
368
|
+
* -1 = Pre-K, 0 = Kindergarten, 1-12 = Grades 1-12, 13 = AP
|
|
369
|
+
*/
|
|
370
|
+
type TimebackGrade = (typeof TIMEBACK_GRADES)[number];
|
|
371
|
+
/**
|
|
372
|
+
* Platform pedagogy levels for a single lesson of instruction.
|
|
373
|
+
* E1 teaches, E2/E3 practice and remediate, E4 is the mastery check.
|
|
374
|
+
*/
|
|
375
|
+
type ELevel = 'E1' | 'E2' | 'E3' | 'E4';
|
|
376
|
+
/**
|
|
377
|
+
* Valid Caliper subject values. The same vocabulary as OneRoster subjects.
|
|
378
|
+
*/
|
|
379
|
+
type CaliperSubject = (typeof TIMEBACK_SUBJECTS)[number];
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* TimeBack Client SDK DTOs
|
|
383
|
+
*
|
|
384
|
+
* Data transfer objects for the TimeBack client SDK including
|
|
385
|
+
* progress tracking, session management, and activity completion.
|
|
386
|
+
*
|
|
387
|
+
* Note: TimebackClientConfig lives in @playcademy/timeback as it's
|
|
388
|
+
* SDK configuration, not a DTO.
|
|
389
|
+
*
|
|
390
|
+
* @module types/timeback/client
|
|
391
|
+
*/
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Known extensions for TimeBack Activity Metrics Collection
|
|
395
|
+
*/
|
|
396
|
+
interface TimebackActivityExtensions {
|
|
397
|
+
/** Percentage complete (0-100) for the app course */
|
|
398
|
+
pctCompleteApp?: number;
|
|
399
|
+
/** Allow other arbitrary extensions */
|
|
400
|
+
[key: string]: unknown;
|
|
401
|
+
}
|
|
402
|
+
interface MasteryWriteWarning {
|
|
403
|
+
code: 'MASTERY_WRITE_CAPPED';
|
|
404
|
+
message: string;
|
|
405
|
+
currentMasteredUnits: number;
|
|
406
|
+
attemptedMasteredUnits: number;
|
|
407
|
+
appliedMasteredUnits: number;
|
|
408
|
+
storedMasteredUnits: number;
|
|
409
|
+
masterableUnits: number;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Activity data for ending an activity
|
|
413
|
+
*/
|
|
414
|
+
interface ActivityData {
|
|
415
|
+
/** Unique activity identifier (required) */
|
|
416
|
+
activityId: string;
|
|
417
|
+
/** Grade level for this activity (required for multi-grade course routing) */
|
|
418
|
+
grade: number;
|
|
419
|
+
/** Subject area (required for multi-grade course routing) */
|
|
420
|
+
subject: CaliperSubject;
|
|
421
|
+
/** Activity display name (optional) */
|
|
422
|
+
activityName?: string;
|
|
423
|
+
/** Course identifier (auto-filled from config if not provided) */
|
|
424
|
+
courseId?: string;
|
|
425
|
+
/** Course display name (auto-filled from config if not provided) */
|
|
426
|
+
courseName?: string;
|
|
427
|
+
/** Student email address (optional) */
|
|
428
|
+
studentEmail?: string;
|
|
429
|
+
/** Application name for Caliper events (defaults to 'Game') */
|
|
430
|
+
appName?: string;
|
|
431
|
+
/** Sensor URL for Caliper events (defaults to baseUrl) */
|
|
432
|
+
sensorUrl?: string;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Score data for ending an activity from a child-launched game: the same
|
|
436
|
+
* shape as `EndActivityScoreData` with `xpAwarded` optional. The parent
|
|
437
|
+
* game decides the actual award; a provided value is only a suggestion.
|
|
438
|
+
* The SDK's `isChildLaunched()` narrows `client.timeback.endActivity()`
|
|
439
|
+
* to accept this shape.
|
|
440
|
+
*/
|
|
441
|
+
type ChildEndActivityScoreData = Omit<EndActivityScoreData, 'xpAwarded'> & {
|
|
442
|
+
/** Optional XP suggestion for the parent. */
|
|
443
|
+
xpAwarded?: number;
|
|
444
|
+
};
|
|
445
|
+
/**
|
|
446
|
+
* Score data for ending an activity
|
|
447
|
+
*/
|
|
448
|
+
interface EndActivityScoreData {
|
|
449
|
+
/** Number of questions answered correctly */
|
|
450
|
+
correctQuestions: number;
|
|
451
|
+
/** Total number of questions */
|
|
452
|
+
totalQuestions: number;
|
|
453
|
+
/**
|
|
454
|
+
* XP earned for this activity.
|
|
455
|
+
*
|
|
456
|
+
* Required when the game reports directly (platform, demo, standalone).
|
|
457
|
+
* A child-launched game may omit it: narrow the client with the SDK's
|
|
458
|
+
* `isChildLaunched()` for the relaxed signature. The parent game
|
|
459
|
+
* decides the award, and a value provided here travels only as the
|
|
460
|
+
* `childXpSuggested` audit suggestion.
|
|
461
|
+
*/
|
|
462
|
+
xpAwarded: number;
|
|
463
|
+
/**
|
|
464
|
+
* Incremental learning units mastered this session.
|
|
465
|
+
*
|
|
466
|
+
* Cannot be used with masteredUnitsAbsolute. When a course has mastery
|
|
467
|
+
* tracking configured, the platform bounds submissions that would move
|
|
468
|
+
* the student below 0 or above the configured masterableUnits maximum and
|
|
469
|
+
* returns warning metadata.
|
|
470
|
+
*/
|
|
471
|
+
masteredUnits?: number;
|
|
472
|
+
/**
|
|
473
|
+
* Absolute total of mastered units.
|
|
474
|
+
*
|
|
475
|
+
* The platform computes the delta from the current value. Cannot be used
|
|
476
|
+
* with masteredUnits. When a course has mastery tracking configured, the
|
|
477
|
+
* platform bounds values outside 0..masterableUnits and returns warning
|
|
478
|
+
* metadata.
|
|
479
|
+
*/
|
|
480
|
+
masteredUnitsAbsolute?: number;
|
|
481
|
+
/** Optional arbitrary extensions to include in the Caliper event */
|
|
482
|
+
extensions?: TimebackActivityExtensions;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* TimeBack API Request/Response Types
|
|
487
|
+
*
|
|
488
|
+
* Types for TimeBack API endpoints including XP tracking,
|
|
489
|
+
* setup, verification, and activity completion.
|
|
490
|
+
*
|
|
491
|
+
* @module types/timeback/api
|
|
492
|
+
*/
|
|
493
|
+
|
|
494
|
+
interface HeartbeatRequestBase {
|
|
495
|
+
gameId: string;
|
|
496
|
+
studentId: string;
|
|
497
|
+
runId: string;
|
|
498
|
+
/**
|
|
499
|
+
* Per-session identifier.
|
|
500
|
+
*
|
|
501
|
+
* LEGACY SDK COMPATIBILITY (PR #711): optional because games deployed
|
|
502
|
+
* against the pre-resumable-sessions SDK do not send one. The
|
|
503
|
+
* platform falls back to `runId` when absent. Make this required
|
|
504
|
+
* once legacy SDK support is dropped.
|
|
505
|
+
*/
|
|
506
|
+
resumeId?: string;
|
|
507
|
+
activityData: {
|
|
508
|
+
activityId: string;
|
|
509
|
+
activityName?: string;
|
|
510
|
+
grade: TimebackGrade;
|
|
511
|
+
subject: TimebackSubject;
|
|
512
|
+
appName?: string;
|
|
513
|
+
sensorUrl?: string;
|
|
514
|
+
courseId?: string;
|
|
515
|
+
courseName?: string;
|
|
516
|
+
studentEmail?: string;
|
|
517
|
+
};
|
|
518
|
+
timingData: {
|
|
519
|
+
activeMs: number;
|
|
520
|
+
pausedMs: number;
|
|
521
|
+
};
|
|
522
|
+
isFinal?: boolean;
|
|
523
|
+
}
|
|
524
|
+
type HeartbeatWindowKey = {
|
|
525
|
+
/**
|
|
526
|
+
* Absolute start-of-window timestamp (epoch ms). Preferred dedupe key
|
|
527
|
+
* for the post-#711 SDK.
|
|
528
|
+
*
|
|
529
|
+
* LEGACY SDK COMPATIBILITY (PR #711): callers must provide exactly
|
|
530
|
+
* one of this field or `windowSequence`. Make this the only allowed
|
|
531
|
+
* field once legacy SDK support is dropped.
|
|
532
|
+
*/
|
|
533
|
+
windowStartedAtMs: number;
|
|
534
|
+
windowSequence?: never;
|
|
535
|
+
} | {
|
|
536
|
+
windowStartedAtMs?: never;
|
|
537
|
+
/**
|
|
538
|
+
* LEGACY SDK COMPATIBILITY (PR #711).
|
|
539
|
+
*
|
|
540
|
+
* Monotonic window counter emitted by the pre-resumable-sessions
|
|
541
|
+
* SDK. Remove this field once every deployed game has redeployed
|
|
542
|
+
* against the post-#711 SDK + edge-play runtime.
|
|
543
|
+
*/
|
|
544
|
+
windowSequence: number;
|
|
545
|
+
};
|
|
546
|
+
type HeartbeatRequest = HeartbeatRequestBase & HeartbeatWindowKey;
|
|
547
|
+
interface EndActivityRequest {
|
|
548
|
+
gameId: string;
|
|
549
|
+
studentId: string;
|
|
550
|
+
runId?: string;
|
|
551
|
+
/**
|
|
552
|
+
* Per-session identifier.
|
|
553
|
+
*
|
|
554
|
+
* LEGACY SDK COMPATIBILITY (PR #711): optional because games deployed
|
|
555
|
+
* against the pre-resumable-sessions SDK do not send one. The
|
|
556
|
+
* platform falls back to `runId`, or mints a server-side UUID, when
|
|
557
|
+
* absent. Make this required once legacy SDK support is dropped.
|
|
558
|
+
*/
|
|
559
|
+
resumeId?: string;
|
|
560
|
+
activityData: {
|
|
561
|
+
activityId: string;
|
|
562
|
+
activityName?: string;
|
|
563
|
+
grade: TimebackGrade;
|
|
564
|
+
subject: TimebackSubject;
|
|
565
|
+
appName?: string;
|
|
566
|
+
sensorUrl?: string;
|
|
567
|
+
courseId?: string;
|
|
568
|
+
courseName?: string;
|
|
569
|
+
studentEmail?: string;
|
|
570
|
+
};
|
|
571
|
+
scoreData: {
|
|
572
|
+
correctQuestions: number;
|
|
573
|
+
totalQuestions: number;
|
|
574
|
+
};
|
|
575
|
+
timingData: {
|
|
576
|
+
durationSeconds: number;
|
|
577
|
+
};
|
|
578
|
+
sessionTimingData?: {
|
|
579
|
+
activeSeconds: number;
|
|
580
|
+
inactiveSeconds?: number;
|
|
581
|
+
};
|
|
582
|
+
xpEarned: number;
|
|
583
|
+
masteredUnits?: number;
|
|
584
|
+
masteredUnitsAbsolute?: number;
|
|
585
|
+
extensions?: TimebackActivityExtensions;
|
|
586
|
+
}
|
|
587
|
+
type TimebackPromotionStatus = 'promoted' | 'no-next-course' | 'already-promoted' | 'not-enrolled' | 'not-mastered';
|
|
588
|
+
interface TimebackPromotionResult {
|
|
589
|
+
status: TimebackPromotionStatus;
|
|
590
|
+
currentCourseId: string;
|
|
591
|
+
nextCourseId?: string;
|
|
592
|
+
masteredUnits?: number;
|
|
593
|
+
masterableUnits?: number;
|
|
594
|
+
}
|
|
595
|
+
interface EndActivityResponse {
|
|
596
|
+
status: 'ok';
|
|
597
|
+
courseId: string;
|
|
598
|
+
xpAwarded: number;
|
|
599
|
+
masteredUnits?: number;
|
|
600
|
+
pctCompleteApp?: number;
|
|
601
|
+
warnings?: MasteryWriteWarning[];
|
|
602
|
+
/**
|
|
603
|
+
* Set when this submission was stopped because a completion for the same
|
|
604
|
+
* run (`runId`) and activity had already been recorded — the platform's
|
|
605
|
+
* idempotency guard blocked a duplicate emit (PLA-142). This call awarded
|
|
606
|
+
* nothing new, but the award may well have happened: if the original
|
|
607
|
+
* response was lost in transit (e.g. a gateway timeout followed by an SDK
|
|
608
|
+
* retry), this is the only response the caller ever sees for a run that
|
|
609
|
+
* fully succeeded. The response therefore echoes what the run earned —
|
|
610
|
+
* `xpAwarded`, `masteredUnits`, and `pctCompleteApp` are the values
|
|
611
|
+
* recorded when the completion was confirmed (zeros, with no
|
|
612
|
+
* `pctCompleteApp`, only for runs recorded before award echoing existed).
|
|
613
|
+
* Treat it as "already recorded — here's what it earned", and do not
|
|
614
|
+
* count the run again.
|
|
615
|
+
*/
|
|
616
|
+
blockedByDedupeGuard?: boolean;
|
|
617
|
+
}
|
|
618
|
+
interface AdvanceCourseResponse {
|
|
619
|
+
status: 'ok';
|
|
620
|
+
promotion: TimebackPromotionResult;
|
|
621
|
+
}
|
|
622
|
+
type TimebackUnenrollmentStatus = 'unenrolled' | 'not-mastered';
|
|
623
|
+
interface TimebackUnenrollmentResult {
|
|
624
|
+
status: TimebackUnenrollmentStatus;
|
|
625
|
+
currentCourseId: string;
|
|
626
|
+
masteredUnits?: number;
|
|
627
|
+
masterableUnits?: number;
|
|
628
|
+
forced?: boolean;
|
|
629
|
+
}
|
|
630
|
+
interface UnenrollCourseResponse {
|
|
631
|
+
status: 'ok';
|
|
632
|
+
unenrollment: TimebackUnenrollmentResult;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
declare const DIAGNOSTIC_TRACK_OUTCOMES: readonly ['provisional', 'unresolved', 'route-to-instruction', 'not-assessed'];
|
|
636
|
+
type DiagnosticTrackOutcome = (typeof DIAGNOSTIC_TRACK_OUTCOMES)[number];
|
|
637
|
+
type DiagnosticRoutingTrackStatus = 'pending' | 'active' | 'completed' | 'skipped';
|
|
638
|
+
type DiagnosticRoutingStatus = 'in-progress' | 'ready-to-complete';
|
|
639
|
+
interface DiagnosticRoutingNextItem {
|
|
640
|
+
stageKey: string;
|
|
641
|
+
trackKey: string;
|
|
642
|
+
nodeKey: string;
|
|
643
|
+
itemIdentifier: string;
|
|
644
|
+
}
|
|
645
|
+
/** Deliberately small semantic result exposed to normal game completion handlers. */
|
|
646
|
+
interface DiagnosticTrackResult {
|
|
647
|
+
trackKey: string;
|
|
648
|
+
groupKey?: string;
|
|
649
|
+
outcome: DiagnosticTrackOutcome;
|
|
650
|
+
resultKey: string;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/** Stable curriculum-standard identity used to align and select assessment content. */
|
|
654
|
+
interface AssessmentStandardRef {
|
|
655
|
+
framework: string;
|
|
656
|
+
identifier: string;
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Playcademy's course-specific meaning for reusable QTI test content.
|
|
660
|
+
* Result writers translate this to OneRoster assessment-result `metadata.testType`;
|
|
661
|
+
* it intentionally does not become metadata on the QTI test itself.
|
|
662
|
+
*/
|
|
663
|
+
type AssessmentPurpose = (typeof ASSESSMENT_PURPOSES)[number];
|
|
664
|
+
|
|
665
|
+
/** One answer value accepted by the supported QTI runtime interactions. */
|
|
666
|
+
type AssessmentResponseValue = string | string[];
|
|
667
|
+
/** Canonical response state persisted on an assessment attempt. */
|
|
668
|
+
type AssessmentResponses = Record<string, Record<string, AssessmentResponseValue>>;
|
|
669
|
+
/**
|
|
670
|
+
* One node of the rich-content vocabulary, which is OPEN: kinds are added as
|
|
671
|
+
* content that plain text would misrepresent appears, so a consumer must not
|
|
672
|
+
* treat this union as exhaustive.
|
|
673
|
+
*
|
|
674
|
+
* Structured content is projected from sanitized QTI on the host — never raw
|
|
675
|
+
* XML/HTML — and always travels alongside a flattened plain-text equivalent, so
|
|
676
|
+
* simple clients can ignore it entirely.
|
|
677
|
+
*
|
|
678
|
+
* A node carries no field common to every kind, so there is nothing to
|
|
679
|
+
* introspect on an unrecognized one. The supported fallback is one level up:
|
|
680
|
+
* abandon the whole subtree and render the enclosing `prompt` / `content`
|
|
681
|
+
* string, which is always present.
|
|
682
|
+
*
|
|
683
|
+
* Say so on screen when that happens. A question whose diagram or expression
|
|
684
|
+
* carried what was being asked still reads as complete prose once the structure
|
|
685
|
+
* is gone, so a silent fallback can leave a student an unanswerable question
|
|
686
|
+
* with nothing to indicate why.
|
|
687
|
+
*/
|
|
688
|
+
type PlayableContentNode = {
|
|
689
|
+
kind: 'text';
|
|
690
|
+
text: string;
|
|
691
|
+
} | {
|
|
692
|
+
kind: 'math';
|
|
693
|
+
/** Sanitized MathML source for clients that can render it. */
|
|
694
|
+
mathMl: string;
|
|
695
|
+
/** Plain-text approximation for clients that cannot. */
|
|
696
|
+
fallbackText: string;
|
|
697
|
+
} | {
|
|
698
|
+
kind: 'image';
|
|
699
|
+
src: string;
|
|
700
|
+
width?: number;
|
|
701
|
+
height?: number;
|
|
702
|
+
description?: string;
|
|
703
|
+
} | {
|
|
704
|
+
kind: 'paragraph';
|
|
705
|
+
children: PlayableContentNode[];
|
|
706
|
+
} | {
|
|
707
|
+
kind: 'emphasis';
|
|
708
|
+
children: PlayableContentNode[];
|
|
709
|
+
} | {
|
|
710
|
+
kind: 'strong';
|
|
711
|
+
children: PlayableContentNode[];
|
|
712
|
+
} | {
|
|
713
|
+
kind: 'table';
|
|
714
|
+
rows: {
|
|
715
|
+
header: boolean;
|
|
716
|
+
cells: PlayableContentNode[][];
|
|
717
|
+
}[];
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* A bulleted or numbered list. Modelled because flattening one to plain text
|
|
721
|
+
* genuinely changes its meaning — "one two" is not a list — unlike inline
|
|
722
|
+
* emphasis, which reads correctly either way and so is not carried.
|
|
723
|
+
*/
|
|
724
|
+
| {
|
|
725
|
+
kind: 'list';
|
|
726
|
+
/** Numbered (`ol`) rather than bulleted (`ul`). */
|
|
727
|
+
ordered: boolean;
|
|
728
|
+
items: PlayableContentNode[][];
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Where one inline interaction belongs in the prose, naming the interaction
|
|
732
|
+
* it stands for rather than relying on its position among sibling blanks.
|
|
733
|
+
*
|
|
734
|
+
* The identifier is what makes this robust: matching blanks to interactions
|
|
735
|
+
* by order silently mispairs them when either sequence shifts, and a
|
|
736
|
+
* mispaired dropdown produces a wrong answer rather than a visible error.
|
|
737
|
+
*/
|
|
738
|
+
| {
|
|
739
|
+
kind: 'blank';
|
|
740
|
+
responseIdentifier: string;
|
|
741
|
+
}
|
|
742
|
+
/** One named target inside a gap-match passage. */
|
|
743
|
+
| {
|
|
744
|
+
kind: 'gap';
|
|
745
|
+
identifier: string;
|
|
746
|
+
};
|
|
747
|
+
interface PlayableAssessmentChoice {
|
|
748
|
+
identifier: string;
|
|
749
|
+
content: string;
|
|
750
|
+
/** Keep this choice in its authored slot when the interaction is shuffled. */
|
|
751
|
+
fixed?: boolean;
|
|
752
|
+
/** Rich content when the choice carries more than plain text. */
|
|
753
|
+
contentNodes?: PlayableContentNode[];
|
|
754
|
+
}
|
|
755
|
+
/** A Match choice, which unlike an ordinary choice carries an association capacity. */
|
|
756
|
+
interface PlayableMatchChoice extends PlayableAssessmentChoice {
|
|
757
|
+
/** Associations this choice accepts (0 means unlimited). */
|
|
758
|
+
matchMax: number;
|
|
759
|
+
}
|
|
760
|
+
interface PlayableAssessmentInteractionBase {
|
|
761
|
+
responseIdentifier: string;
|
|
762
|
+
/** Prompt declared inside the interaction (QTI qti-prompt), when present. */
|
|
763
|
+
prompt?: string;
|
|
764
|
+
}
|
|
765
|
+
interface PlayableChoiceInteraction extends PlayableAssessmentInteractionBase {
|
|
766
|
+
type: 'choice';
|
|
767
|
+
choices: PlayableAssessmentChoice[];
|
|
768
|
+
/** The host has already applied attempt-stable ordering; render the received array. */
|
|
769
|
+
shuffle: boolean;
|
|
770
|
+
minChoices: number;
|
|
771
|
+
maxChoices: number;
|
|
772
|
+
}
|
|
773
|
+
interface PlayableInlineChoiceInteraction extends PlayableAssessmentInteractionBase {
|
|
774
|
+
type: 'inline-choice';
|
|
775
|
+
choices: PlayableAssessmentChoice[];
|
|
776
|
+
/** The host has already applied attempt-stable ordering; render the received array. */
|
|
777
|
+
shuffle: boolean;
|
|
778
|
+
}
|
|
779
|
+
interface PlayableTextEntryInteraction extends PlayableAssessmentInteractionBase {
|
|
780
|
+
type: 'text-entry';
|
|
781
|
+
expectedLength?: number;
|
|
782
|
+
placeholder?: string;
|
|
783
|
+
}
|
|
784
|
+
interface PlayableOrderInteraction extends PlayableAssessmentInteractionBase {
|
|
785
|
+
type: 'order';
|
|
786
|
+
choices: PlayableAssessmentChoice[];
|
|
787
|
+
/** Whether the host applies attempt-stable presentation ordering. */
|
|
788
|
+
shuffle: boolean;
|
|
789
|
+
}
|
|
790
|
+
interface PlayableMatchInteraction extends PlayableAssessmentInteractionBase {
|
|
791
|
+
type: 'match';
|
|
792
|
+
sourceChoices: PlayableMatchChoice[];
|
|
793
|
+
targetChoices: PlayableMatchChoice[];
|
|
794
|
+
maxAssociations: number;
|
|
795
|
+
/** Whether the host applies independent attempt-stable ordering to both choice sets. */
|
|
796
|
+
shuffle: boolean;
|
|
797
|
+
}
|
|
798
|
+
interface PlayableHottextSegment {
|
|
799
|
+
identifier?: string;
|
|
800
|
+
content: string;
|
|
801
|
+
selectable: boolean;
|
|
802
|
+
}
|
|
803
|
+
interface PlayableHottextInteraction extends PlayableAssessmentInteractionBase {
|
|
804
|
+
type: 'hottext';
|
|
805
|
+
segments: PlayableHottextSegment[];
|
|
806
|
+
maxChoices: number;
|
|
807
|
+
}
|
|
808
|
+
/** A sanitized graphic reference rendered by graphic interactions. */
|
|
809
|
+
interface PlayableAssessmentGraphic {
|
|
810
|
+
src: string;
|
|
811
|
+
width?: number;
|
|
812
|
+
height?: number;
|
|
813
|
+
/** Accessible description carried from the source QTI. */
|
|
814
|
+
description?: string;
|
|
815
|
+
}
|
|
816
|
+
/** The QTI region shape vocabulary shared by hotspots and scored areas. */
|
|
817
|
+
declare const PLAYABLE_ASSESSMENT_SHAPES: readonly ['circle', 'ellipse', 'rect', 'poly', 'default'];
|
|
818
|
+
type PlayableAssessmentShape = (typeof PLAYABLE_ASSESSMENT_SHAPES)[number];
|
|
819
|
+
/** A clickable or associable region positioned on a graphic. */
|
|
820
|
+
interface PlayableAssessmentHotspot {
|
|
821
|
+
identifier: string;
|
|
822
|
+
shape: PlayableAssessmentShape;
|
|
823
|
+
coords: number[];
|
|
824
|
+
/** Maximum associations this region accepts (0 or absent means unlimited). */
|
|
825
|
+
matchMax?: number;
|
|
826
|
+
description?: string;
|
|
827
|
+
}
|
|
828
|
+
interface PlayableHotspotInteraction extends PlayableAssessmentInteractionBase {
|
|
829
|
+
type: 'hotspot';
|
|
830
|
+
image: PlayableAssessmentGraphic;
|
|
831
|
+
hotspots: PlayableAssessmentHotspot[];
|
|
832
|
+
minChoices: number;
|
|
833
|
+
/** Always a concrete cap: an authored 0 (QTI: unlimited) resolves to the region count. */
|
|
834
|
+
maxChoices: number;
|
|
835
|
+
}
|
|
836
|
+
interface PlayableGapMatchChoice {
|
|
837
|
+
identifier: string;
|
|
838
|
+
content: string;
|
|
839
|
+
/** Keep this token in its authored bank slot, not a passage gap. */
|
|
840
|
+
fixed?: boolean;
|
|
841
|
+
/** Times this token may be placed (0 means unlimited). */
|
|
842
|
+
matchMax: number;
|
|
843
|
+
}
|
|
844
|
+
interface PlayableGapMatchInteraction extends PlayableAssessmentInteractionBase {
|
|
845
|
+
type: 'gap-match';
|
|
846
|
+
/** Shuffle the token bank without moving passage gaps. */
|
|
847
|
+
shuffle: boolean;
|
|
848
|
+
/** Passage containing each gap as a `___` blank, in `gaps` order. */
|
|
849
|
+
content: string;
|
|
850
|
+
/** Structured passage retaining each named gap at its authored inline position. */
|
|
851
|
+
contentNodes: PlayableContentNode[];
|
|
852
|
+
gapTexts: PlayableGapMatchChoice[];
|
|
853
|
+
/** Ordered gap identifiers matching the passage blanks. */
|
|
854
|
+
gaps: string[];
|
|
855
|
+
/** Overall pair limit (0 means unlimited). */
|
|
856
|
+
maxAssociations: number;
|
|
857
|
+
}
|
|
858
|
+
interface PlayableGapImageChoice {
|
|
859
|
+
identifier: string;
|
|
860
|
+
image?: PlayableAssessmentGraphic;
|
|
861
|
+
/** Times this token may be placed (0 means unlimited). */
|
|
862
|
+
matchMax: number;
|
|
863
|
+
description?: string;
|
|
864
|
+
}
|
|
865
|
+
interface PlayableGraphicGapMatchInteraction extends PlayableAssessmentInteractionBase {
|
|
866
|
+
type: 'graphic-gap-match';
|
|
867
|
+
image: PlayableAssessmentGraphic;
|
|
868
|
+
gapImages: PlayableGapImageChoice[];
|
|
869
|
+
hotspots: PlayableAssessmentHotspot[];
|
|
870
|
+
/** Overall pair limit (0 means unlimited). */
|
|
871
|
+
maxAssociations: number;
|
|
872
|
+
}
|
|
873
|
+
interface PlayableSelectPointInteraction extends PlayableAssessmentInteractionBase {
|
|
874
|
+
type: 'select-point';
|
|
875
|
+
image: PlayableAssessmentGraphic;
|
|
876
|
+
minChoices: number;
|
|
877
|
+
maxChoices: number;
|
|
878
|
+
}
|
|
879
|
+
interface PlayableGraphicAssociateInteraction extends PlayableAssessmentInteractionBase {
|
|
880
|
+
type: 'graphic-associate';
|
|
881
|
+
image: PlayableAssessmentGraphic;
|
|
882
|
+
hotspots: PlayableAssessmentHotspot[];
|
|
883
|
+
maxAssociations: number;
|
|
884
|
+
}
|
|
885
|
+
interface PlayablePositionObjectInteraction extends PlayableAssessmentInteractionBase {
|
|
886
|
+
type: 'position-object';
|
|
887
|
+
/** Background stage the object is placed onto. */
|
|
888
|
+
stage: PlayableAssessmentGraphic;
|
|
889
|
+
/** The movable object image. */
|
|
890
|
+
object: PlayableAssessmentGraphic;
|
|
891
|
+
/** Maximum number of placements. */
|
|
892
|
+
maxPlacements: number;
|
|
893
|
+
}
|
|
894
|
+
type PlayableAssessmentInteraction = PlayableChoiceInteraction | PlayableInlineChoiceInteraction | PlayableTextEntryInteraction | PlayableOrderInteraction | PlayableMatchInteraction | PlayableHottextInteraction | PlayableHotspotInteraction | PlayableGapMatchInteraction | PlayableGraphicGapMatchInteraction | PlayableSelectPointInteraction | PlayableGraphicAssociateInteraction | PlayablePositionObjectInteraction;
|
|
895
|
+
interface PlayableAssessmentItem {
|
|
896
|
+
identifier: string;
|
|
897
|
+
title: string;
|
|
898
|
+
/**
|
|
899
|
+
* Shared item stem, flattened to plain text. Inline interactions appear as
|
|
900
|
+
* `___`, and block interactions belong after the prompt in `interactions`
|
|
901
|
+
* order.
|
|
902
|
+
*
|
|
903
|
+
* The `___` marks that a blank is there, not which interaction fills it or
|
|
904
|
+
* exactly where it sits: word offsets into this string are not part of the
|
|
905
|
+
* contract. Prose is translated, re-wrapped, and tokenized differently by
|
|
906
|
+
* language — a position counted in words does not survive any of that, and
|
|
907
|
+
* languages that do not separate words with spaces have no such position to
|
|
908
|
+
* count. Read `promptContent` to place blanks precisely; a client that
|
|
909
|
+
* ignores it should render inline interactions after the prompt.
|
|
910
|
+
*/
|
|
911
|
+
prompt: string;
|
|
912
|
+
/**
|
|
913
|
+
* Structured prompt content, present whenever the stem holds an inline
|
|
914
|
+
* interaction or anything plain text would misrepresent — images, tables,
|
|
915
|
+
* lists, MathML. Absent means `prompt` says everything.
|
|
916
|
+
*
|
|
917
|
+
* Inline interactions appear as `blank` nodes carrying the response
|
|
918
|
+
* identifier they belong to.
|
|
919
|
+
*/
|
|
920
|
+
promptContent?: PlayableContentNode[];
|
|
921
|
+
/** Maximum points awarded by the item's declared outcome (1 when undeclared). */
|
|
922
|
+
maxScore: number;
|
|
923
|
+
/** Document-ordered interactions with item-unique response identifiers. */
|
|
924
|
+
interactions: PlayableAssessmentInteraction[];
|
|
925
|
+
}
|
|
926
|
+
/** Sanitized assessment content safe to return to a sandboxed game. */
|
|
927
|
+
interface PlayableAssessment {
|
|
928
|
+
identifier: string;
|
|
929
|
+
/**
|
|
930
|
+
* Schema version of this payload's shape, never of its content.
|
|
931
|
+
*
|
|
932
|
+
* Present so a game can tell a field the host does not send from one this
|
|
933
|
+
* item does not use, and so a mismatch is legible in a bug report. Branch on
|
|
934
|
+
* whether a field is present rather than on this number — the content
|
|
935
|
+
* vocabularies are deliberately open, so feature detection survives
|
|
936
|
+
* versions that a comparison against a fixed number does not.
|
|
937
|
+
*/
|
|
938
|
+
contractVersion: typeof PLAYCADEMY_ASSESSMENT_CONTRACT_VERSION;
|
|
939
|
+
/**
|
|
940
|
+
* Opaque revision of this assessment's content, used to ensure a resumed
|
|
941
|
+
* attempt loads what it started with. Changes when an author edits the
|
|
942
|
+
* assessment; unrelated to `contractVersion`.
|
|
943
|
+
*/
|
|
944
|
+
contentRevision: string;
|
|
945
|
+
title: string;
|
|
946
|
+
items: PlayableAssessmentItem[];
|
|
947
|
+
}
|
|
948
|
+
interface AssessmentScore {
|
|
949
|
+
earned: number;
|
|
950
|
+
possible: number;
|
|
951
|
+
/** Aggregate score normalized to the inclusive 0..1 range. */
|
|
952
|
+
normalized: number;
|
|
953
|
+
}
|
|
954
|
+
type FixedAssessmentPurpose = Exclude<AssessmentPurpose, 'review'>;
|
|
955
|
+
/** Fixed-test purposes that do not select their catalog by curriculum standard. */
|
|
956
|
+
type UnscopedFixedAssessmentPurpose = Exclude<FixedAssessmentPurpose, 'mastery'>;
|
|
957
|
+
/** One requested standard slot and the playable bank item selected for it. */
|
|
958
|
+
interface AssessmentReviewItemSelection {
|
|
959
|
+
standard: AssessmentStandardRef;
|
|
960
|
+
itemIdentifier: string;
|
|
961
|
+
}
|
|
962
|
+
/** Why one requested standard could not be fully served by the current bank. */
|
|
963
|
+
interface AssessmentReviewShortage {
|
|
964
|
+
standard: AssessmentStandardRef;
|
|
965
|
+
requested: number;
|
|
966
|
+
selected: number;
|
|
967
|
+
eligible: number;
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* Explicit review-request fulfillment. A partial result still starts a normal
|
|
971
|
+
* assessment attempt with every selectable item; no missing standard is
|
|
972
|
+
* silently omitted.
|
|
973
|
+
*/
|
|
974
|
+
type AssessmentReviewFulfillment = {
|
|
975
|
+
status: 'complete';
|
|
976
|
+
requestedItemCount: number;
|
|
977
|
+
selectedItemCount: number;
|
|
978
|
+
shortages: [];
|
|
979
|
+
} | {
|
|
980
|
+
status: 'partial';
|
|
981
|
+
requestedItemCount: number;
|
|
982
|
+
selectedItemCount: number;
|
|
983
|
+
shortages: AssessmentReviewShortage[];
|
|
984
|
+
};
|
|
985
|
+
interface FixedAssessmentSelectionContext {
|
|
986
|
+
kind: 'fixed-test';
|
|
987
|
+
purpose: UnscopedFixedAssessmentPurpose;
|
|
988
|
+
}
|
|
989
|
+
/** A complete fixed quiz selected from the catalog for one canonical standard. */
|
|
990
|
+
interface StandardQuizSelectionContext {
|
|
991
|
+
kind: 'standard-quiz';
|
|
992
|
+
purpose: 'mastery';
|
|
993
|
+
standard: AssessmentStandardRef;
|
|
994
|
+
}
|
|
995
|
+
/** Administration policy for one requested review skill, separate from its identity. */
|
|
996
|
+
interface AssessmentReviewStandard extends AssessmentStandardRef {
|
|
997
|
+
/** Require this skill's second selected question, subject to the player's cap. */
|
|
998
|
+
requireBothQuestions?: boolean;
|
|
999
|
+
}
|
|
1000
|
+
interface StandardsReviewSelectionContext {
|
|
1001
|
+
kind: 'standards-review';
|
|
1002
|
+
purpose: 'review';
|
|
1003
|
+
standards: AssessmentReviewStandard[];
|
|
1004
|
+
candidateItemsPerStandard: number;
|
|
1005
|
+
selections: AssessmentReviewItemSelection[];
|
|
1006
|
+
fulfillment: AssessmentReviewFulfillment;
|
|
1007
|
+
}
|
|
1008
|
+
/** Immutable identity pinned when the host starts a platform-routed diagnostic. */
|
|
1009
|
+
interface PlatformRoutedDiagnosticSelectionContext {
|
|
1010
|
+
kind: 'platform-routed-diagnostic';
|
|
1011
|
+
purpose: 'diagnostic';
|
|
1012
|
+
definitionId: string;
|
|
1013
|
+
diagnosticKey: string;
|
|
1014
|
+
routingRevision: string;
|
|
1015
|
+
}
|
|
1016
|
+
/** How the host assembled the playable assessment returned for this attempt. */
|
|
1017
|
+
type AssessmentSelectionContext = FixedAssessmentSelectionContext | StandardQuizSelectionContext | StandardsReviewSelectionContext | PlatformRoutedDiagnosticSelectionContext;
|
|
1018
|
+
/** Server-derived assessment interaction model; callers select it only through purpose. */
|
|
1019
|
+
type AssessmentFlow = 'attempt-submit' | 'item-submit' | 'platform-routed-item-submit';
|
|
1020
|
+
/** Safe feedback persisted when one item is committed in an item-submit flow. */
|
|
1021
|
+
type AssessmentItemGrading = {
|
|
1022
|
+
source: 'timeback-qti';
|
|
1023
|
+
graderVersion: string;
|
|
1024
|
+
} | {
|
|
1025
|
+
source: 'platform-qti-adapter';
|
|
1026
|
+
graderVersion: string;
|
|
1027
|
+
qtiGraderVersion: string;
|
|
1028
|
+
} | {
|
|
1029
|
+
source: 'platform-artifact';
|
|
1030
|
+
artifactVersion: string;
|
|
1031
|
+
graderVersion: string;
|
|
1032
|
+
};
|
|
1033
|
+
interface AssessmentItemSubmission {
|
|
1034
|
+
/** Stable caller-generated key used to replay a lost success response. */
|
|
1035
|
+
submissionId: string;
|
|
1036
|
+
itemIdentifier: string;
|
|
1037
|
+
/** Stable administration timestamp used for exposure ordering and resume reconciliation. */
|
|
1038
|
+
submittedAt: string;
|
|
1039
|
+
/** One-based position in the validated administration sequence. */
|
|
1040
|
+
responseVersion: number;
|
|
1041
|
+
answered: boolean;
|
|
1042
|
+
score: AssessmentScore;
|
|
1043
|
+
isCorrect: boolean | null;
|
|
1044
|
+
/**
|
|
1045
|
+
* Trusted grading provenance pinned at grading time so child-result repair
|
|
1046
|
+
* reproduces the corresponding child projection. Absent only on attempts
|
|
1047
|
+
* committed before provenance was introduced.
|
|
1048
|
+
*/
|
|
1049
|
+
grading?: AssessmentItemGrading;
|
|
1050
|
+
}
|
|
1051
|
+
/** Raw answers only. Array order is the administration sequence; no grades are trusted. */
|
|
1052
|
+
interface AssessmentTranscript {
|
|
1053
|
+
version: 1;
|
|
1054
|
+
attemptId: string;
|
|
1055
|
+
/** The selected source revision, not a review subset's presentation revision. */
|
|
1056
|
+
contentRevision: string;
|
|
1057
|
+
administrations: {
|
|
1058
|
+
submissionId: string;
|
|
1059
|
+
itemIdentifier: string;
|
|
1060
|
+
routingNodeKey?: string;
|
|
1061
|
+
/** An empty response is still an administered question. */
|
|
1062
|
+
responses: Record<string, AssessmentResponseValue>;
|
|
1063
|
+
}[];
|
|
1064
|
+
}
|
|
1065
|
+
interface ResumeAssessmentInput {
|
|
1066
|
+
/** Omit to recover the parent checkpoint, or best-effort child progress if none exists. */
|
|
1067
|
+
transcript?: AssessmentTranscript;
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Canonical activity context the SDK uses to track time for this attempt. A
|
|
1071
|
+
* narrowed `ActivityData`, so it can be handed straight to the shared clock:
|
|
1072
|
+
* the course routing fields are resolved rather than optional.
|
|
1073
|
+
*/
|
|
1074
|
+
type AssessmentActivityData = Pick<ActivityData, 'activityId' | 'courseId'> & {
|
|
1075
|
+
activityName: string;
|
|
1076
|
+
grade: TimebackGrade;
|
|
1077
|
+
subject: TimebackSubject;
|
|
1078
|
+
};
|
|
1079
|
+
interface AssessmentAttemptSnapshotBase {
|
|
1080
|
+
attemptId: string;
|
|
1081
|
+
responseVersion: number;
|
|
1082
|
+
status: 'in_progress';
|
|
1083
|
+
/** Resolved server context for the shared activity-session clock, when valid. */
|
|
1084
|
+
activityData?: AssessmentActivityData;
|
|
1085
|
+
assessment: PlayableAssessment;
|
|
1086
|
+
/** Opaque, attempt-scoped authorization. Renew through start/resume, not per answer. */
|
|
1087
|
+
assessmentToken: string;
|
|
1088
|
+
transcript: AssessmentTranscript;
|
|
1089
|
+
}
|
|
1090
|
+
/** Existing fixed, mastery, and review attempt shape. */
|
|
1091
|
+
interface ConventionalAssessmentAttemptSnapshot extends AssessmentAttemptSnapshotBase {
|
|
1092
|
+
/** Historical fixed diagnostics remain attempt-submit and are never reinterpreted. */
|
|
1093
|
+
flow: Exclude<AssessmentFlow, 'platform-routed-item-submit'>;
|
|
1094
|
+
responses: AssessmentResponses;
|
|
1095
|
+
/** Ordered committed-item ledger. Empty for attempt-submit flows. */
|
|
1096
|
+
itemSubmissions: AssessmentItemSubmission[];
|
|
1097
|
+
score: AssessmentScore | null;
|
|
1098
|
+
selection: Exclude<AssessmentSelectionContext, PlatformRoutedDiagnosticSelectionContext>;
|
|
1099
|
+
}
|
|
1100
|
+
/** Safe public track progress; authored terminal semantics stay host-only until completion. */
|
|
1101
|
+
interface DiagnosticRoutingTrackSnapshot {
|
|
1102
|
+
trackKey: string;
|
|
1103
|
+
groupKey?: string;
|
|
1104
|
+
status: DiagnosticRoutingTrackStatus;
|
|
1105
|
+
administeredCount: number;
|
|
1106
|
+
}
|
|
1107
|
+
/** Safe canonical routing projection returned while a diagnostic is in progress. */
|
|
1108
|
+
interface DiagnosticRoutingSnapshot {
|
|
1109
|
+
kind: 'platform-routed-diagnostic';
|
|
1110
|
+
revision: string;
|
|
1111
|
+
status: DiagnosticRoutingStatus;
|
|
1112
|
+
next: DiagnosticRoutingNextItem | null;
|
|
1113
|
+
tracks: DiagnosticRoutingTrackSnapshot[];
|
|
1114
|
+
}
|
|
1115
|
+
/** Small semantic diagnostic result consumed by the game after finalization. */
|
|
1116
|
+
interface DiagnosticAssessmentSubmitResult {
|
|
1117
|
+
purpose: 'diagnostic';
|
|
1118
|
+
attemptId: string;
|
|
1119
|
+
submissionId: string;
|
|
1120
|
+
diagnosticKey: string;
|
|
1121
|
+
responseVersion: number;
|
|
1122
|
+
status: 'awaiting_award';
|
|
1123
|
+
tracks: DiagnosticTrackResult[];
|
|
1124
|
+
}
|
|
1125
|
+
/** Platform-routed diagnostics never expose grading, feedback, or their committed ledger. */
|
|
1126
|
+
interface PlatformRoutedDiagnosticAttemptSnapshot extends AssessmentAttemptSnapshotBase {
|
|
1127
|
+
flow: 'platform-routed-item-submit';
|
|
1128
|
+
selection: PlatformRoutedDiagnosticSelectionContext;
|
|
1129
|
+
routing: DiagnosticRoutingSnapshot;
|
|
1130
|
+
completion: null;
|
|
1131
|
+
}
|
|
1132
|
+
interface AssessmentSaveResult {
|
|
1133
|
+
attemptId: string;
|
|
1134
|
+
responseVersion: number;
|
|
1135
|
+
status: 'in_progress';
|
|
1136
|
+
responses: AssessmentResponses;
|
|
1137
|
+
transcript: AssessmentTranscript;
|
|
1138
|
+
}
|
|
1139
|
+
interface AssessmentSubmitResultBase {
|
|
1140
|
+
attemptId: string;
|
|
1141
|
+
submissionId: string;
|
|
1142
|
+
responseVersion: number;
|
|
1143
|
+
status: 'awaiting_award';
|
|
1144
|
+
responses: AssessmentResponses;
|
|
1145
|
+
score: AssessmentScore;
|
|
1146
|
+
}
|
|
1147
|
+
interface FixedAssessmentSubmitResult extends AssessmentSubmitResultBase {
|
|
1148
|
+
purpose: UnscopedFixedAssessmentPurpose;
|
|
1149
|
+
}
|
|
1150
|
+
/** Safe final item grade, exposed only after the assessment is submitted. */
|
|
1151
|
+
interface AssessmentItemOutcome {
|
|
1152
|
+
itemIdentifier: string;
|
|
1153
|
+
standard: AssessmentStandardRef;
|
|
1154
|
+
answered: boolean;
|
|
1155
|
+
score: AssessmentScore;
|
|
1156
|
+
isCorrect: boolean | null;
|
|
1157
|
+
}
|
|
1158
|
+
interface ReviewAssessmentSubmitResult extends AssessmentSubmitResultBase {
|
|
1159
|
+
purpose: 'review';
|
|
1160
|
+
/** Final outcomes in committed transcript order, excluding unused candidates. */
|
|
1161
|
+
itemOutcomes: AssessmentItemOutcome[];
|
|
1162
|
+
}
|
|
1163
|
+
interface MasteryAssessmentSubmitResult extends AssessmentSubmitResultBase {
|
|
1164
|
+
purpose: 'mastery';
|
|
1165
|
+
/** One final outcome per question in test order, including unanswered questions. */
|
|
1166
|
+
itemOutcomes: AssessmentItemOutcome[];
|
|
1167
|
+
}
|
|
1168
|
+
type ConventionalAssessmentSubmitResult = FixedAssessmentSubmitResult | ReviewAssessmentSubmitResult | MasteryAssessmentSubmitResult;
|
|
1169
|
+
type AssessmentSubmitResult = ConventionalAssessmentSubmitResult | DiagnosticAssessmentSubmitResult;
|
|
1170
|
+
type CompletedAssessmentResult<TResult extends AssessmentSubmitResult> = Omit<TResult, 'status'> & {
|
|
1171
|
+
status: 'completed';
|
|
1172
|
+
/** XP durably recorded on the authoritative OneRoster AssessmentResult. */
|
|
1173
|
+
xpAwarded: number;
|
|
1174
|
+
/**
|
|
1175
|
+
* The mastery delta durably recorded on the authoritative result after
|
|
1176
|
+
* platform bounding. Zero when the game awarded no mastery.
|
|
1177
|
+
*/
|
|
1178
|
+
masteredUnitsApplied: number;
|
|
1179
|
+
/** Course completion percentage after this award, when mastery tracking is configured. */
|
|
1180
|
+
pctCompleteApp?: number;
|
|
1181
|
+
/** Non-fatal bounding warnings raised while applying the award. */
|
|
1182
|
+
warnings?: MasteryWriteWarning[];
|
|
1183
|
+
};
|
|
1184
|
+
/** Terminal result returned only after the game's award has been recorded. */
|
|
1185
|
+
type AssessmentFinalizeResult = CompletedAssessmentResult<FixedAssessmentSubmitResult> | CompletedAssessmentResult<ReviewAssessmentSubmitResult> | CompletedAssessmentResult<MasteryAssessmentSubmitResult> | CompletedAssessmentResult<DiagnosticAssessmentSubmitResult>;
|
|
1186
|
+
/** Minimal recovery snapshot; no QTI content load is required after answers are locked. */
|
|
1187
|
+
type SettledAssessmentAttemptSnapshot = {
|
|
1188
|
+
attemptId: string;
|
|
1189
|
+
responseVersion: number;
|
|
1190
|
+
status: 'awaiting_award';
|
|
1191
|
+
result: AssessmentSubmitResult;
|
|
1192
|
+
} | {
|
|
1193
|
+
attemptId: string;
|
|
1194
|
+
responseVersion: number;
|
|
1195
|
+
status: 'completed';
|
|
1196
|
+
result: AssessmentFinalizeResult;
|
|
1197
|
+
};
|
|
1198
|
+
/** Snapshot states that are still open for responses. */
|
|
1199
|
+
type PlayableAssessmentAttemptSnapshot = ConventionalAssessmentAttemptSnapshot | PlatformRoutedDiagnosticAttemptSnapshot;
|
|
1200
|
+
type AssessmentAttemptSnapshot = PlayableAssessmentAttemptSnapshot | SettledAssessmentAttemptSnapshot;
|
|
1201
|
+
interface GetLatestAssessmentOptionsBase {
|
|
1202
|
+
subject?: TimebackSubject;
|
|
1203
|
+
grade?: TimebackGrade;
|
|
1204
|
+
}
|
|
1205
|
+
/** Filters for finding the authenticated student's latest completed assessment. */
|
|
1206
|
+
type GetLatestAssessmentOptions = (GetLatestAssessmentOptionsBase & {
|
|
1207
|
+
purpose: Exclude<AssessmentPurpose, 'mastery'>;
|
|
1208
|
+
standard?: never;
|
|
1209
|
+
}) | (GetLatestAssessmentOptionsBase & {
|
|
1210
|
+
purpose: 'mastery';
|
|
1211
|
+
standard: AssessmentStandardRef;
|
|
1212
|
+
});
|
|
1213
|
+
/** Compact result returned by the latest-completed-assessment lookup. */
|
|
1214
|
+
interface LatestAssessmentResult {
|
|
1215
|
+
attemptId: string;
|
|
1216
|
+
purpose: AssessmentPurpose;
|
|
1217
|
+
activityId: string;
|
|
1218
|
+
subject: TimebackSubject;
|
|
1219
|
+
grade: TimebackGrade;
|
|
1220
|
+
testIdentifier: string;
|
|
1221
|
+
/** Canonical request identity for mastery results; null for other purposes. */
|
|
1222
|
+
standard: AssessmentStandardRef | null;
|
|
1223
|
+
completedAt: string;
|
|
1224
|
+
/** Persisted aggregate score normalized to the inclusive 0..1 range. */
|
|
1225
|
+
score: Pick<AssessmentScore, 'normalized'>;
|
|
1226
|
+
}
|
|
1227
|
+
interface StartAssessmentInputBase {
|
|
1228
|
+
activityId: string;
|
|
1229
|
+
subject?: TimebackSubject;
|
|
1230
|
+
grade?: TimebackGrade;
|
|
1231
|
+
}
|
|
1232
|
+
interface StartFixedAssessmentInput extends StartAssessmentInputBase {
|
|
1233
|
+
purpose: Exclude<UnscopedFixedAssessmentPurpose, 'diagnostic'>;
|
|
1234
|
+
}
|
|
1235
|
+
interface StartDiagnosticAssessmentInput extends StartAssessmentInputBase {
|
|
1236
|
+
purpose: 'diagnostic';
|
|
1237
|
+
/** Stable authored diagnostic identity, independent of the selected QTI test identifier. */
|
|
1238
|
+
diagnosticKey: string;
|
|
1239
|
+
}
|
|
1240
|
+
interface StartMasteryAssessmentInput extends StartAssessmentInputBase {
|
|
1241
|
+
purpose: 'mastery';
|
|
1242
|
+
standard: AssessmentStandardRef;
|
|
1243
|
+
}
|
|
1244
|
+
interface StartReviewAssessmentInput extends StartAssessmentInputBase {
|
|
1245
|
+
purpose: 'review';
|
|
1246
|
+
/** Serving order; duplicate canonical skills keep their first position. Pinned on start. */
|
|
1247
|
+
standards: AssessmentReviewStandard[];
|
|
1248
|
+
/** Candidate capacity per standard; preloaded candidates are not administered automatically. */
|
|
1249
|
+
candidateItemsPerStandard?: number;
|
|
1250
|
+
}
|
|
1251
|
+
type StartAssessmentInput = StartFixedAssessmentInput | StartDiagnosticAssessmentInput | StartMasteryAssessmentInput | StartReviewAssessmentInput;
|
|
1252
|
+
/** Transport metadata for attempting a prepared new-assessment start. */
|
|
1253
|
+
interface StartAssessmentOptions {
|
|
1254
|
+
preparationReceipt?: string;
|
|
1255
|
+
}
|
|
1256
|
+
/** Result of preparing the immediate next assessment request. */
|
|
1257
|
+
type AssessmentPreparationResult = {
|
|
1258
|
+
status: 'prepared';
|
|
1259
|
+
receipt: string;
|
|
1260
|
+
/** Receipt expiry as an ISO-8601 timestamp. */
|
|
1261
|
+
expiresAt: string;
|
|
1262
|
+
} | {
|
|
1263
|
+
status: 'unprepared';
|
|
1264
|
+
reason: 'artifact_unavailable' | 'prerequisite_unavailable' | 'local_runtime';
|
|
1265
|
+
};
|
|
1266
|
+
interface SaveAssessmentInput {
|
|
1267
|
+
expectedResponseVersion: number;
|
|
1268
|
+
/** Complete active draft; success acknowledges its durable parent checkpoint. */
|
|
1269
|
+
transcript: AssessmentTranscript;
|
|
1270
|
+
}
|
|
1271
|
+
/** Best-effort mastery progress, not an answer commitment or an explicit checkpoint. */
|
|
1272
|
+
interface RecordAssessmentProgressInput {
|
|
1273
|
+
assessmentToken: string;
|
|
1274
|
+
expectedResponseVersion: number;
|
|
1275
|
+
/** Current raw draft, including the editable administration being projected. */
|
|
1276
|
+
transcript: AssessmentTranscript;
|
|
1277
|
+
itemIdentifier: string;
|
|
1278
|
+
}
|
|
1279
|
+
interface SubmitAssessmentItemInputBase {
|
|
1280
|
+
assessmentToken: string;
|
|
1281
|
+
/** The raw prefix preceding this administration (or including it for an exact retry). */
|
|
1282
|
+
transcript: AssessmentTranscript;
|
|
1283
|
+
expectedResponseVersion: number;
|
|
1284
|
+
/** Stable across every retry of this exact item submission. */
|
|
1285
|
+
submissionId: string;
|
|
1286
|
+
itemIdentifier: string;
|
|
1287
|
+
responses: Record<string, AssessmentResponseValue | null>;
|
|
1288
|
+
}
|
|
1289
|
+
interface SubmitReviewAssessmentItemInput extends SubmitAssessmentItemInputBase {
|
|
1290
|
+
routingNodeKey?: never;
|
|
1291
|
+
}
|
|
1292
|
+
interface SubmitDiagnosticAssessmentItemInput extends SubmitAssessmentItemInputBase {
|
|
1293
|
+
/** Canonical routing-context identity returned in routing.next. */
|
|
1294
|
+
routingNodeKey: string;
|
|
1295
|
+
}
|
|
1296
|
+
type SubmitAssessmentItemInput = SubmitReviewAssessmentItemInput | SubmitDiagnosticAssessmentItemInput;
|
|
1297
|
+
interface SubmitReviewAssessmentItemResult {
|
|
1298
|
+
attemptId: string;
|
|
1299
|
+
responseVersion: number;
|
|
1300
|
+
status: 'in_progress';
|
|
1301
|
+
responses: AssessmentResponses;
|
|
1302
|
+
/** Canonical ledger after commit or replay; replace local state with it. */
|
|
1303
|
+
itemSubmissions: AssessmentItemSubmission[];
|
|
1304
|
+
submission: AssessmentItemSubmission;
|
|
1305
|
+
transcript: AssessmentTranscript;
|
|
1306
|
+
}
|
|
1307
|
+
/** Safe acknowledgement for one immutable diagnostic item commitment. */
|
|
1308
|
+
interface DiagnosticAssessmentItemReceipt {
|
|
1309
|
+
submissionId: string;
|
|
1310
|
+
routingNodeKey: string;
|
|
1311
|
+
itemIdentifier: string;
|
|
1312
|
+
submittedAt: string;
|
|
1313
|
+
responseVersion: number;
|
|
1314
|
+
answered: boolean;
|
|
1315
|
+
score: AssessmentScore;
|
|
1316
|
+
isCorrect: boolean;
|
|
1317
|
+
}
|
|
1318
|
+
/** Canonical post-commit routing state plus trusted feedback for this administration. */
|
|
1319
|
+
interface SubmitDiagnosticAssessmentItemResult {
|
|
1320
|
+
attemptId: string;
|
|
1321
|
+
responseVersion: number;
|
|
1322
|
+
status: 'in_progress';
|
|
1323
|
+
routing: DiagnosticRoutingSnapshot;
|
|
1324
|
+
submission: DiagnosticAssessmentItemReceipt;
|
|
1325
|
+
transcript: AssessmentTranscript;
|
|
1326
|
+
}
|
|
1327
|
+
type SubmitAssessmentItemResult = SubmitReviewAssessmentItemResult | SubmitDiagnosticAssessmentItemResult;
|
|
1328
|
+
interface SubmitAssessmentInput {
|
|
1329
|
+
expectedResponseVersion: number;
|
|
1330
|
+
submissionId: string;
|
|
1331
|
+
transcript: AssessmentTranscript;
|
|
1332
|
+
}
|
|
1333
|
+
/** The optional mastery portion of a finalize award; at most one field is set. */
|
|
1334
|
+
interface AssessmentMasteryAward {
|
|
1335
|
+
/**
|
|
1336
|
+
* Incremental learning units mastered by this attempt. Cannot be combined
|
|
1337
|
+
* with masteredUnitsAbsolute. The platform bounds the delta against the
|
|
1338
|
+
* course's configured masterableUnits and returns any warning.
|
|
1339
|
+
*/
|
|
1340
|
+
masteredUnits?: number;
|
|
1341
|
+
/**
|
|
1342
|
+
* Absolute mastered-unit total after this attempt; the platform computes
|
|
1343
|
+
* the delta. Cannot be combined with masteredUnits.
|
|
1344
|
+
*/
|
|
1345
|
+
masteredUnitsAbsolute?: number;
|
|
1346
|
+
}
|
|
1347
|
+
interface FinalizeAssessmentInput extends AssessmentMasteryAward {
|
|
1348
|
+
submissionId: string;
|
|
1349
|
+
/** Explicit zero is an award; omission is never interpreted as zero. */
|
|
1350
|
+
xpAwarded: number;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
177
1353
|
/**
|
|
178
1354
|
* Cache configuration types for runtime customization
|
|
179
1355
|
*/
|
|
@@ -334,7 +1510,7 @@ declare abstract class PlaycademyBaseClient {
|
|
|
334
1510
|
* - `me()` - Get authenticated user profile
|
|
335
1511
|
*/
|
|
336
1512
|
users: {
|
|
337
|
-
me: () => Promise<
|
|
1513
|
+
me: () => Promise<AuthenticatedUser>;
|
|
338
1514
|
};
|
|
339
1515
|
}
|
|
340
1516
|
|
|
@@ -1555,36 +2731,36 @@ declare class PlaycademyClient extends PlaycademyBaseClient {
|
|
|
1555
2731
|
*/
|
|
1556
2732
|
timeback: {
|
|
1557
2733
|
assessments: {
|
|
1558
|
-
prepare: (input:
|
|
1559
|
-
start: (input:
|
|
1560
|
-
latest: (options:
|
|
1561
|
-
get: (attemptId: string) => Promise<
|
|
2734
|
+
prepare: (input: StartAssessmentInput) => Promise<AssessmentPreparationResult>;
|
|
2735
|
+
start: (input: StartAssessmentInput, options?: StartAssessmentOptions) => Promise<AssessmentAttemptSnapshot>;
|
|
2736
|
+
latest: (options: GetLatestAssessmentOptions) => Promise<LatestAssessmentResult | null>;
|
|
2737
|
+
get: (attemptId: string) => Promise<AssessmentAttemptSnapshot>;
|
|
1562
2738
|
stop: (attemptId: string) => Promise<{
|
|
1563
2739
|
attemptId: string;
|
|
1564
2740
|
}>;
|
|
1565
|
-
resume: (attemptId: string, input?:
|
|
1566
|
-
save: (attemptId: string, input:
|
|
1567
|
-
recordProgress: (attemptId: string, input:
|
|
2741
|
+
resume: (attemptId: string, input?: ResumeAssessmentInput) => Promise<AssessmentAttemptSnapshot>;
|
|
2742
|
+
save: (attemptId: string, input: SaveAssessmentInput) => Promise<AssessmentSaveResult>;
|
|
2743
|
+
recordProgress: (attemptId: string, input: RecordAssessmentProgressInput) => Promise<{
|
|
1568
2744
|
attemptId: string;
|
|
1569
2745
|
}>;
|
|
1570
|
-
submitItem: (attemptId: string, input:
|
|
1571
|
-
submit: (attemptId: string, input:
|
|
1572
|
-
finalize: (attemptId: string, input:
|
|
2746
|
+
submitItem: (attemptId: string, input: SubmitAssessmentItemInput) => Promise<SubmitAssessmentItemResult>;
|
|
2747
|
+
submit: (attemptId: string, input: SubmitAssessmentInput) => Promise<AssessmentSubmitResult>;
|
|
2748
|
+
finalize: (attemptId: string, input: FinalizeAssessmentInput) => Promise<AssessmentFinalizeResult>;
|
|
1573
2749
|
};
|
|
1574
2750
|
readonly user: TimebackUser;
|
|
1575
2751
|
readonly currentRunId: string | undefined;
|
|
1576
|
-
startActivity: (metadata:
|
|
2752
|
+
startActivity: (metadata: ActivityData, options?: StartActivityOptions) => StartActivityResult;
|
|
1577
2753
|
pauseActivity: () => void;
|
|
1578
2754
|
resumeActivity: () => void;
|
|
1579
|
-
endActivity: (data:
|
|
2755
|
+
endActivity: (data: EndActivityScoreData) => Promise<EndActivityResponse | RelayedEndActivityResult>;
|
|
1580
2756
|
course: {
|
|
1581
2757
|
advance: (options?: {
|
|
1582
|
-
subject?:
|
|
1583
|
-
}) => Promise<
|
|
2758
|
+
subject?: TimebackSubject;
|
|
2759
|
+
}) => Promise<AdvanceCourseResponse>;
|
|
1584
2760
|
unenroll: (options?: {
|
|
1585
|
-
subject?:
|
|
2761
|
+
subject?: TimebackSubject;
|
|
1586
2762
|
force?: boolean;
|
|
1587
|
-
}) => Promise<
|
|
2763
|
+
}) => Promise<UnenrollCourseResponse>;
|
|
1588
2764
|
};
|
|
1589
2765
|
};
|
|
1590
2766
|
/**
|
|
@@ -1599,7 +2775,7 @@ declare class PlaycademyClient extends PlaycademyBaseClient {
|
|
|
1599
2775
|
* - `fetch(options?)` - Fetch leaderboard entries
|
|
1600
2776
|
*/
|
|
1601
2777
|
leaderboard: {
|
|
1602
|
-
fetch: (options?:
|
|
2778
|
+
fetch: (options?: LeaderboardOptions) => Promise<GameLeaderboardEntry[]>;
|
|
1603
2779
|
};
|
|
1604
2780
|
/**
|
|
1605
2781
|
* Demo-mode helpers. Methods throw when called outside `client.mode === 'demo'`,
|
|
@@ -1610,8 +2786,8 @@ declare class PlaycademyClient extends PlaycademyBaseClient {
|
|
|
1610
2786
|
*/
|
|
1611
2787
|
demo: {
|
|
1612
2788
|
profile: {
|
|
1613
|
-
get: () => Promise<
|
|
1614
|
-
update: (updates:
|
|
2789
|
+
get: () => Promise<DemoProfile>;
|
|
2790
|
+
update: (updates: DemoProfileUpdate) => Promise<DemoProfile>;
|
|
1615
2791
|
};
|
|
1616
2792
|
end: (score: number, options?: DemoEndOptions) => void;
|
|
1617
2793
|
};
|