@playcademy/sdk 0.24.1-beta.2 → 0.24.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 CHANGED
@@ -535,6 +535,71 @@ interface UnenrollCourseResponse {
535
535
  status: 'ok';
536
536
  unenrollment: TimebackUnenrollmentResult;
537
537
  }
538
+ /**
539
+ * The test result that sent a student into a hole-filling course: the
540
+ * assignment Timeback stamped on the hole-filling enrollment.
541
+ */
542
+ interface HoleFillingTriggeringResult {
543
+ /** OneRoster assessment result id. */
544
+ resultId: string;
545
+ /** AlphaTest assignment id, always a string. */
546
+ assignmentId: string;
547
+ /** OneRoster assessment line item id of the test. */
548
+ lineItemId: string;
549
+ testName: string;
550
+ testType: 'end of course' | 'test out' | 'placement';
551
+ /** The QTI assessment test, when it could be found. */
552
+ qtiTestId?: string;
553
+ /**
554
+ * The result's score as Timeback recorded it, on the test's own scale
555
+ * (AlphaTest tests score 0-100). Not rescaled.
556
+ */
557
+ score: number | null;
558
+ scoreDate: string | null;
559
+ totalQuestions: number | null;
560
+ correctQuestions: number | null;
561
+ }
562
+ /** A curriculum standard the student missed questions on. */
563
+ interface HoleFillingMissedStandard {
564
+ /** Standards framework as named by the QTI item's alignment (canonicalized). */
565
+ framework: string;
566
+ /** Standard code, e.g. `K.OA.A.2`. */
567
+ code: string;
568
+ /** 1-based positions of the missed questions in the test. */
569
+ questionNumbers: number[];
570
+ /** QTI items of the missed questions. */
571
+ qtiItemIds: string[];
572
+ }
573
+ /** What a game needs to tailor a student's hole-filling course. */
574
+ interface HoleFillingContext {
575
+ enrollment: {
576
+ /** The hole-filling course. */
577
+ courseId: string;
578
+ /** The base course it belongs to. */
579
+ baseCourseId: string;
580
+ /** The student's hole-filling enrollment. */
581
+ enrollmentId?: string;
582
+ grade: TimebackGrade;
583
+ subject: TimebackSubject;
584
+ beginDate?: string | null;
585
+ };
586
+ /**
587
+ * Null when Timeback hasn't stamped an assignment on the enrollment, or the
588
+ * stamped assignment has no fully graded test result yet.
589
+ */
590
+ triggeringResult: HoleFillingTriggeringResult | null;
591
+ /** Missed questions grouped by standard, most-missed first. */
592
+ missedStandards: HoleFillingMissedStandard[];
593
+ /** Missed questions whose item has no standard tag. */
594
+ untaggedMissedQuestionNumbers: number[];
595
+ }
596
+ /**
597
+ * Response from the hole-filling context endpoint: one entry per active
598
+ * hole-filling enrollment the student has in this game (usually zero or one).
599
+ */
600
+ interface HoleFillingContextResponse {
601
+ contexts: HoleFillingContext[];
602
+ }
538
603
 
539
604
  declare const DIAGNOSTIC_TRACK_OUTCOMES: readonly ['provisional', 'unresolved', 'route-to-instruction', 'not-assessed'];
540
605
  type DiagnosticTrackOutcome = (typeof DIAGNOSTIC_TRACK_OUTCOMES)[number];
@@ -2431,6 +2496,41 @@ interface TimebackUser extends TimebackUserContext {
2431
2496
  * highest mastered grade for a subject.
2432
2497
  */
2433
2498
  highestGradeMastered: TimebackUserHighestGradeMastered;
2499
+ /**
2500
+ * Hole-filling context for the current user.
2501
+ * Call `holeFilling.fetch()` to learn why the student is in a
2502
+ * hole-filling course and which standards to target.
2503
+ */
2504
+ holeFilling: TimebackUserHoleFilling;
2505
+ }
2506
+ /**
2507
+ * Hole-filling context access for the current user.
2508
+ * Results are cached for 5 minutes.
2509
+ */
2510
+ interface TimebackUserHoleFilling {
2511
+ /**
2512
+ * Fetch the test result that sent the student into each of their
2513
+ * hole-filling courses in this game, and the curriculum standards of the
2514
+ * questions they missed (most-missed first).
2515
+ *
2516
+ * Returns `{ contexts: [] }` when the student has no hole-filling
2517
+ * enrollment. Results are cached for 5 minutes (use `force: true` to
2518
+ * bypass, e.g. after `user.refresh()` picks up a new enrollment).
2519
+ *
2520
+ * @param options - Cache options
2521
+ * @returns Promise resolving to one context per hole-filling enrollment
2522
+ *
2523
+ * @example
2524
+ * ```typescript
2525
+ * const { contexts } = await client.timeback.user.holeFilling.fetch()
2526
+ * const context = contexts.find(c => c.enrollment.subject === 'Math')
2527
+ *
2528
+ * if (context) {
2529
+ * const targetCodes = context.missedStandards.map(s => s.code) // ['K.OA.A.2', ...]
2530
+ * }
2531
+ * ```
2532
+ */
2533
+ fetch(options?: TTLCacheConfig): Promise<HoleFillingContextResponse>;
2434
2534
  }
2435
2535
  /**
2436
2536
  * Mastery data access for the current user.
package/dist/index.js CHANGED
@@ -2930,6 +2930,10 @@ function createTimebackEngine(client) {
2930
2930
  ttl: 5000,
2931
2931
  keyPrefix: "game.timeback.highestGradeMastered"
2932
2932
  });
2933
+ const holeFillingCache = createTTLCache({
2934
+ ttl: 5 * 60 * 1000,
2935
+ keyPrefix: "game.timeback.holeFilling"
2936
+ });
2933
2937
  const enrollmentsCache = createTTLCache({
2934
2938
  ttl: 5 * 60 * 1000,
2935
2939
  keyPrefix: "game.timeback.enrollments"
@@ -2940,6 +2944,7 @@ function createTimebackEngine(client) {
2940
2944
  xpCache.clear();
2941
2945
  masteryCache.clear();
2942
2946
  highestGradeMasteredCache.clear();
2947
+ holeFillingCache.clear();
2943
2948
  try {
2944
2949
  await userStore.refresh();
2945
2950
  } catch {}
@@ -3035,6 +3040,9 @@ function createTimebackEngine(client) {
3035
3040
  const endpoint = `${TIMEBACK_ROUTES.GET_HIGHEST_GRADE_MASTERED}?${params.toString()}`;
3036
3041
  return client["requestGameBackend"](endpoint, "GET");
3037
3042
  }, { force: options.force })
3043
+ },
3044
+ holeFilling: {
3045
+ fetch: (options) => holeFillingCache.get("current", () => client["request"]("/timeback/user/hole-filling-context", "GET"), options)
3038
3046
  }
3039
3047
  },
3040
3048
  activity: {
@@ -3452,6 +3460,9 @@ function createTimebackNamespace(client) {
3452
3460
  }
3453
3461
  return engine.user.highestGradeMastered.fetch(options);
3454
3462
  }
3463
+ },
3464
+ holeFilling: {
3465
+ fetch: (options) => engine.user.holeFilling.fetch(options)
3455
3466
  }
3456
3467
  };
3457
3468
  },
@@ -3782,7 +3793,7 @@ async function request({
3782
3793
  return rawText && rawText.length > 0 ? rawText : undefined;
3783
3794
  }
3784
3795
  // src/version.ts
3785
- var SDK_VERSION = "0.24.1-beta.2";
3796
+ var SDK_VERSION = "0.24.1-beta.3";
3786
3797
 
3787
3798
  // src/clients/base.ts
3788
3799
  class PlaycademyBaseClient {
@@ -1208,6 +1208,71 @@ interface TimebackGradeLevelTestReviewResponse {
1208
1208
  questions: TimebackGradeLevelTestQuestionResult[];
1209
1209
  standards: TimebackGradeLevelTestStandardSummary[];
1210
1210
  }
1211
+ /**
1212
+ * The test result that sent a student into a hole-filling course: the
1213
+ * assignment Timeback stamped on the hole-filling enrollment.
1214
+ */
1215
+ interface HoleFillingTriggeringResult {
1216
+ /** OneRoster assessment result id. */
1217
+ resultId: string;
1218
+ /** AlphaTest assignment id, always a string. */
1219
+ assignmentId: string;
1220
+ /** OneRoster assessment line item id of the test. */
1221
+ lineItemId: string;
1222
+ testName: string;
1223
+ testType: 'end of course' | 'test out' | 'placement';
1224
+ /** The QTI assessment test, when it could be found. */
1225
+ qtiTestId?: string;
1226
+ /**
1227
+ * The result's score as Timeback recorded it, on the test's own scale
1228
+ * (AlphaTest tests score 0-100). Not rescaled.
1229
+ */
1230
+ score: number | null;
1231
+ scoreDate: string | null;
1232
+ totalQuestions: number | null;
1233
+ correctQuestions: number | null;
1234
+ }
1235
+ /** A curriculum standard the student missed questions on. */
1236
+ interface HoleFillingMissedStandard {
1237
+ /** Standards framework as named by the QTI item's alignment (canonicalized). */
1238
+ framework: string;
1239
+ /** Standard code, e.g. `K.OA.A.2`. */
1240
+ code: string;
1241
+ /** 1-based positions of the missed questions in the test. */
1242
+ questionNumbers: number[];
1243
+ /** QTI items of the missed questions. */
1244
+ qtiItemIds: string[];
1245
+ }
1246
+ /** What a game needs to tailor a student's hole-filling course. */
1247
+ interface HoleFillingContext {
1248
+ enrollment: {
1249
+ /** The hole-filling course. */
1250
+ courseId: string;
1251
+ /** The base course it belongs to. */
1252
+ baseCourseId: string;
1253
+ /** The student's hole-filling enrollment. */
1254
+ enrollmentId?: string;
1255
+ grade: TimebackGrade;
1256
+ subject: TimebackSubject;
1257
+ beginDate?: string | null;
1258
+ };
1259
+ /**
1260
+ * Null when Timeback hasn't stamped an assignment on the enrollment, or the
1261
+ * stamped assignment has no fully graded test result yet.
1262
+ */
1263
+ triggeringResult: HoleFillingTriggeringResult | null;
1264
+ /** Missed questions grouped by standard, most-missed first. */
1265
+ missedStandards: HoleFillingMissedStandard[];
1266
+ /** Missed questions whose item has no standard tag. */
1267
+ untaggedMissedQuestionNumbers: number[];
1268
+ }
1269
+ /**
1270
+ * Response from the hole-filling context endpoint: one entry per active
1271
+ * hole-filling enrollment the student has in this game (usually zero or one).
1272
+ */
1273
+ interface HoleFillingContextResponse {
1274
+ contexts: HoleFillingContext[];
1275
+ }
1211
1276
  type TimebackDiscrepancyQueueWindow = 'all' | 'today' | 'yesterday' | 'this-week' | 'last-week' | 'custom';
1212
1277
  interface TimebackDiscrepancyQueueDateRange {
1213
1278
  startDate?: string;
@@ -5627,6 +5692,41 @@ interface TimebackUser extends TimebackUserContext {
5627
5692
  * highest mastered grade for a subject.
5628
5693
  */
5629
5694
  highestGradeMastered: TimebackUserHighestGradeMastered;
5695
+ /**
5696
+ * Hole-filling context for the current user.
5697
+ * Call `holeFilling.fetch()` to learn why the student is in a
5698
+ * hole-filling course and which standards to target.
5699
+ */
5700
+ holeFilling: TimebackUserHoleFilling;
5701
+ }
5702
+ /**
5703
+ * Hole-filling context access for the current user.
5704
+ * Results are cached for 5 minutes.
5705
+ */
5706
+ interface TimebackUserHoleFilling {
5707
+ /**
5708
+ * Fetch the test result that sent the student into each of their
5709
+ * hole-filling courses in this game, and the curriculum standards of the
5710
+ * questions they missed (most-missed first).
5711
+ *
5712
+ * Returns `{ contexts: [] }` when the student has no hole-filling
5713
+ * enrollment. Results are cached for 5 minutes (use `force: true` to
5714
+ * bypass, e.g. after `user.refresh()` picks up a new enrollment).
5715
+ *
5716
+ * @param options - Cache options
5717
+ * @returns Promise resolving to one context per hole-filling enrollment
5718
+ *
5719
+ * @example
5720
+ * ```typescript
5721
+ * const { contexts } = await client.timeback.user.holeFilling.fetch()
5722
+ * const context = contexts.find(c => c.enrollment.subject === 'Math')
5723
+ *
5724
+ * if (context) {
5725
+ * const targetCodes = context.missedStandards.map(s => s.code) // ['K.OA.A.2', ...]
5726
+ * }
5727
+ * ```
5728
+ */
5729
+ fetch(options?: TTLCacheConfig): Promise<HoleFillingContextResponse>;
5630
5730
  }
5631
5731
  /**
5632
5732
  * Mastery data access for the current user.
@@ -7366,4 +7466,4 @@ interface BeginInitHandshakeOptions {
7366
7466
  declare function beginInitHandshake({ iframe, origin, payload, onTimeout, onSendError }: BeginInitHandshakeOptions): () => void;
7367
7467
 
7368
7468
  export { ApiError, HANDSHAKE_MAX_DURATION_MS, HANDSHAKE_RESEND_INTERVAL_MS, INIT_WAIT_TIMEOUT_MS, MessageEvents, PlaycademyInternalClient as PlaycademyClient, PlaycademyError, PlaycademyInternalClient, beginInitHandshake, extractApiErrorInfo, isTrustedIframeMessage, messaging };
7369
- export type { ApiErrorCode, ApiErrorInfo, AssessmentAttemptSnapshot, AssessmentAwardRecord, AssessmentFinalizeResult, AssessmentFlow, AssessmentItemGrading, AssessmentItemOutcome, AssessmentItemSubmission, AssessmentMasteryAward, AssessmentPreparationResult, AssessmentResponseUpdate, AssessmentResponseValue, AssessmentResponses, AssessmentReviewStandard, AssessmentSaveResult, AssessmentScore, AssessmentStandardRef, AssessmentSubmitResult, AssessmentTranscript, AuthCallbackPayload, AuthOptions, AuthProviderType, AuthResult, AuthServerMessage, AuthStateChangePayload, AuthStateUpdate, AuthenticatedUser, BetterAuthApiKey, BetterAuthApiKeyResponse, BetterAuthSignInResponse, BucketFile, BucketFilePage, BucketListPageOptions, ChildCheckpointRelay, ClientConfig, ClientEvents, ConventionalAssessmentAttemptSnapshot, ConventionalAssessmentSubmitResult, CourseMastery, CourseXp, DemoEndOptions, DemoEndPayload, DeploySource, DevUploadEvent, DevUploadHooks, DeveloperStatusEnumType, DeveloperStatusResponse, DeveloperStatusValue, DiagnosticAssessmentItemReceipt, DiagnosticAssessmentSubmitResult, DiagnosticRoutingSnapshot, DiagnosticRoutingTrackSnapshot, ELevel, EmbedActivity, EmbedActivityAbandoned, EmbedActivityCompleted, EmbedActivityFailed, EmbedLaunchOptions, EmbedResumeEnvelope, EmbedResumeStore, EmbedSession, EmbedSessionTiming, EmbedTimebackRecording, ErrorResponseBody, EventListeners, ExternalGame, FetchedGame, FinalizeAssessmentInput, Game, GameContextPayload, GameCourseMetrics, GameCustomHostname, GameInitUser, GameLeaderboardEntry, GameManifest, GameMetricComparisonKind, GameMetricComparisonMetric, GameMetricComparisonRow, GameMetricComparisonRowStatus, GameMetricsProxyResponse, GameMetricsResponse, GameMetricsUnsupportedReason, GamePlatform, GameRow as GameRecord, GameReleaseResponse, GameRunMetrics, GameRunMetricsComparison, GameRunMetricsComparisonStatus, GameRunMetricsComparisonSummary, GameTimebackIntegration, GameTokenResponse, GameType, GameUser, GetHighestGradeMasteredOptions, GetMasteryOptions, GetXpOptions, HighestGradeMasteredResponse, HostedGame, InitErrorPayload, InitPayload, KVKeyEntry, KVKeyMetadata, KVSeedEntry, KVStatsResponse, KeyEventPayload, LaunchIntent, LeaderboardEntry, LeaderboardOptions, LeaderboardTimeframe, LocalDayContext, LocalDaySource, LoginResponse, ManifestV1, ManifestV2, ManifestVersions, MasteryAssessmentSubmitResult, MasteryResponse, MessageEventMap, ParentGameContext, ParentGameHandle, PlatformRoutedDiagnosticAttemptSnapshot, PlatformRoutedDiagnosticSelectionContext, PlatformTimebackUser, PlatformTimebackUserContext, PlayableAssessment, PlayableAssessmentAttemptSnapshot, PlayableAssessmentChoice, PlayableAssessmentGraphic, PlayableAssessmentHotspot, PlayableAssessmentInteraction, PlayableAssessmentItem, PlayableChoiceInteraction, PlayableContentNode, PlayableGapMatchChoice, PlayableGapMatchInteraction, PlayableInlineChoiceInteraction, PlayableMatchChoice, PlayableMatchInteraction, PlayableOrderInteraction, PlaycademyMode, PlaycademyServerClientConfig, PlaycademyServerClientState, PopulateStudentResponse, RecordAssessmentProgressInput, Release, ReleasesResponse, ResumeAssessmentInput, SaveAssessmentInput, ScoreSubmission, SettledAssessmentAttemptSnapshot, SkillMasterySource, SkillStatus, SkillStatusLookupResult, SkillStatusRequest, SkillStatusRequestingGame, SkillStatusResponse, SkillStatusResult, SkillStatusUnsupportedReason, StandardsReviewSelectionContext, StartActivityOptions, StartActivityResult, StartAssessmentInput, StartAssessmentOptions, StartDiagnosticAssessmentInput, SubmitAssessmentInput, SubmitAssessmentItemInput, SubmitAssessmentItemResult, SubmitDiagnosticAssessmentItemInput, SubmitDiagnosticAssessmentItemResult, TelemetryPayload, TimebackActivityEndRelay, TimebackActivityStartRelay, TimebackEnrollment, TimebackHeartbeatRelayRequest, TimebackInitContext, TimebackOrganization, TimebackUser, TimebackUserContext, TimebackUserHighestGradeMastered, TimebackUserMastery, TimebackUserRefreshField, TimebackUserRefreshOptions, TimebackUserXp, TokenRefreshPayload, TokenType, UpsertGameMetadataInput, UserRow as User, UserEnrollment, UserInfo, UserOrganization, UserRank, UserRankResponse, UserRoleEnumType, UserScore, UserTimebackData, UserTimebackProfile, XpResponse };
7469
+ export type { ApiErrorCode, ApiErrorInfo, AssessmentAttemptSnapshot, AssessmentAwardRecord, AssessmentFinalizeResult, AssessmentFlow, AssessmentItemGrading, AssessmentItemOutcome, AssessmentItemSubmission, AssessmentMasteryAward, AssessmentPreparationResult, AssessmentResponseUpdate, AssessmentResponseValue, AssessmentResponses, AssessmentReviewStandard, AssessmentSaveResult, AssessmentScore, AssessmentStandardRef, AssessmentSubmitResult, AssessmentTranscript, AuthCallbackPayload, AuthOptions, AuthProviderType, AuthResult, AuthServerMessage, AuthStateChangePayload, AuthStateUpdate, AuthenticatedUser, BetterAuthApiKey, BetterAuthApiKeyResponse, BetterAuthSignInResponse, BucketFile, BucketFilePage, BucketListPageOptions, ChildCheckpointRelay, ClientConfig, ClientEvents, ConventionalAssessmentAttemptSnapshot, ConventionalAssessmentSubmitResult, CourseMastery, CourseXp, DemoEndOptions, DemoEndPayload, DeploySource, DevUploadEvent, DevUploadHooks, DeveloperStatusEnumType, DeveloperStatusResponse, DeveloperStatusValue, DiagnosticAssessmentItemReceipt, DiagnosticAssessmentSubmitResult, DiagnosticRoutingSnapshot, DiagnosticRoutingTrackSnapshot, ELevel, EmbedActivity, EmbedActivityAbandoned, EmbedActivityCompleted, EmbedActivityFailed, EmbedLaunchOptions, EmbedResumeEnvelope, EmbedResumeStore, EmbedSession, EmbedSessionTiming, EmbedTimebackRecording, ErrorResponseBody, EventListeners, ExternalGame, FetchedGame, FinalizeAssessmentInput, Game, GameContextPayload, GameCourseMetrics, GameCustomHostname, GameInitUser, GameLeaderboardEntry, GameManifest, GameMetricComparisonKind, GameMetricComparisonMetric, GameMetricComparisonRow, GameMetricComparisonRowStatus, GameMetricsProxyResponse, GameMetricsResponse, GameMetricsUnsupportedReason, GamePlatform, GameRow as GameRecord, GameReleaseResponse, GameRunMetrics, GameRunMetricsComparison, GameRunMetricsComparisonStatus, GameRunMetricsComparisonSummary, GameTimebackIntegration, GameTokenResponse, GameType, GameUser, GetHighestGradeMasteredOptions, GetMasteryOptions, GetXpOptions, HighestGradeMasteredResponse, HoleFillingContext, HoleFillingContextResponse, HoleFillingMissedStandard, HoleFillingTriggeringResult, HostedGame, InitErrorPayload, InitPayload, KVKeyEntry, KVKeyMetadata, KVSeedEntry, KVStatsResponse, KeyEventPayload, LaunchIntent, LeaderboardEntry, LeaderboardOptions, LeaderboardTimeframe, LocalDayContext, LocalDaySource, LoginResponse, ManifestV1, ManifestV2, ManifestVersions, MasteryAssessmentSubmitResult, MasteryResponse, MessageEventMap, ParentGameContext, ParentGameHandle, PlatformRoutedDiagnosticAttemptSnapshot, PlatformRoutedDiagnosticSelectionContext, PlatformTimebackUser, PlatformTimebackUserContext, PlayableAssessment, PlayableAssessmentAttemptSnapshot, PlayableAssessmentChoice, PlayableAssessmentGraphic, PlayableAssessmentHotspot, PlayableAssessmentInteraction, PlayableAssessmentItem, PlayableChoiceInteraction, PlayableContentNode, PlayableGapMatchChoice, PlayableGapMatchInteraction, PlayableInlineChoiceInteraction, PlayableMatchChoice, PlayableMatchInteraction, PlayableOrderInteraction, PlaycademyMode, PlaycademyServerClientConfig, PlaycademyServerClientState, PopulateStudentResponse, RecordAssessmentProgressInput, Release, ReleasesResponse, ResumeAssessmentInput, SaveAssessmentInput, ScoreSubmission, SettledAssessmentAttemptSnapshot, SkillMasterySource, SkillStatus, SkillStatusLookupResult, SkillStatusRequest, SkillStatusRequestingGame, SkillStatusResponse, SkillStatusResult, SkillStatusUnsupportedReason, StandardsReviewSelectionContext, StartActivityOptions, StartActivityResult, StartAssessmentInput, StartAssessmentOptions, StartDiagnosticAssessmentInput, SubmitAssessmentInput, SubmitAssessmentItemInput, SubmitAssessmentItemResult, SubmitDiagnosticAssessmentItemInput, SubmitDiagnosticAssessmentItemResult, TelemetryPayload, TimebackActivityEndRelay, TimebackActivityStartRelay, TimebackEnrollment, TimebackHeartbeatRelayRequest, TimebackInitContext, TimebackOrganization, TimebackUser, TimebackUserContext, TimebackUserHighestGradeMastered, TimebackUserHoleFilling, TimebackUserMastery, TimebackUserRefreshField, TimebackUserRefreshOptions, TimebackUserXp, TokenRefreshPayload, TokenType, UpsertGameMetadataInput, UserRow as User, UserEnrollment, UserInfo, UserOrganization, UserRank, UserRankResponse, UserRoleEnumType, UserScore, UserTimebackData, UserTimebackProfile, XpResponse };
package/dist/internal.js CHANGED
@@ -2930,6 +2930,10 @@ function createTimebackEngine(client) {
2930
2930
  ttl: 5000,
2931
2931
  keyPrefix: "game.timeback.highestGradeMastered"
2932
2932
  });
2933
+ const holeFillingCache = createTTLCache({
2934
+ ttl: 5 * 60 * 1000,
2935
+ keyPrefix: "game.timeback.holeFilling"
2936
+ });
2933
2937
  const enrollmentsCache = createTTLCache({
2934
2938
  ttl: 5 * 60 * 1000,
2935
2939
  keyPrefix: "game.timeback.enrollments"
@@ -2940,6 +2944,7 @@ function createTimebackEngine(client) {
2940
2944
  xpCache.clear();
2941
2945
  masteryCache.clear();
2942
2946
  highestGradeMasteredCache.clear();
2947
+ holeFillingCache.clear();
2943
2948
  try {
2944
2949
  await userStore.refresh();
2945
2950
  } catch {}
@@ -3035,6 +3040,9 @@ function createTimebackEngine(client) {
3035
3040
  const endpoint = `${TIMEBACK_ROUTES.GET_HIGHEST_GRADE_MASTERED}?${params.toString()}`;
3036
3041
  return client["requestGameBackend"](endpoint, "GET");
3037
3042
  }, { force: options.force })
3043
+ },
3044
+ holeFilling: {
3045
+ fetch: (options) => holeFillingCache.get("current", () => client["request"]("/timeback/user/hole-filling-context", "GET"), options)
3038
3046
  }
3039
3047
  },
3040
3048
  activity: {
@@ -3452,6 +3460,9 @@ function createTimebackNamespace(client) {
3452
3460
  }
3453
3461
  return engine.user.highestGradeMastered.fetch(options);
3454
3462
  }
3463
+ },
3464
+ holeFilling: {
3465
+ fetch: (options) => engine.user.holeFilling.fetch(options)
3455
3466
  }
3456
3467
  };
3457
3468
  },
@@ -4702,7 +4713,7 @@ async function request({
4702
4713
  return rawText && rawText.length > 0 ? rawText : undefined;
4703
4714
  }
4704
4715
  // src/version.ts
4705
- var SDK_VERSION = "0.24.1-beta.2";
4716
+ var SDK_VERSION = "0.24.1-beta.3";
4706
4717
 
4707
4718
  // src/clients/base.ts
4708
4719
  class PlaycademyBaseClient {
@@ -361,7 +361,7 @@ function extractApiErrorInfo(error) {
361
361
  }
362
362
 
363
363
  // src/version.ts
364
- var SDK_VERSION = "0.24.1-beta.2";
364
+ var SDK_VERSION = "0.24.1-beta.3";
365
365
 
366
366
  // src/server/request.ts
367
367
  async function makeApiRequest(opts) {
package/dist/server.js CHANGED
@@ -557,7 +557,7 @@ function extractApiErrorInfo(error) {
557
557
  }
558
558
 
559
559
  // src/version.ts
560
- var SDK_VERSION = "0.24.1-beta.2";
560
+ var SDK_VERSION = "0.24.1-beta.3";
561
561
 
562
562
  // src/server/request.ts
563
563
  async function makeApiRequest(opts) {
package/dist/types.d.ts CHANGED
@@ -673,6 +673,71 @@ interface UnenrollCourseResponse {
673
673
  status: 'ok';
674
674
  unenrollment: TimebackUnenrollmentResult;
675
675
  }
676
+ /**
677
+ * The test result that sent a student into a hole-filling course: the
678
+ * assignment Timeback stamped on the hole-filling enrollment.
679
+ */
680
+ interface HoleFillingTriggeringResult {
681
+ /** OneRoster assessment result id. */
682
+ resultId: string;
683
+ /** AlphaTest assignment id, always a string. */
684
+ assignmentId: string;
685
+ /** OneRoster assessment line item id of the test. */
686
+ lineItemId: string;
687
+ testName: string;
688
+ testType: 'end of course' | 'test out' | 'placement';
689
+ /** The QTI assessment test, when it could be found. */
690
+ qtiTestId?: string;
691
+ /**
692
+ * The result's score as Timeback recorded it, on the test's own scale
693
+ * (AlphaTest tests score 0-100). Not rescaled.
694
+ */
695
+ score: number | null;
696
+ scoreDate: string | null;
697
+ totalQuestions: number | null;
698
+ correctQuestions: number | null;
699
+ }
700
+ /** A curriculum standard the student missed questions on. */
701
+ interface HoleFillingMissedStandard {
702
+ /** Standards framework as named by the QTI item's alignment (canonicalized). */
703
+ framework: string;
704
+ /** Standard code, e.g. `K.OA.A.2`. */
705
+ code: string;
706
+ /** 1-based positions of the missed questions in the test. */
707
+ questionNumbers: number[];
708
+ /** QTI items of the missed questions. */
709
+ qtiItemIds: string[];
710
+ }
711
+ /** What a game needs to tailor a student's hole-filling course. */
712
+ interface HoleFillingContext {
713
+ enrollment: {
714
+ /** The hole-filling course. */
715
+ courseId: string;
716
+ /** The base course it belongs to. */
717
+ baseCourseId: string;
718
+ /** The student's hole-filling enrollment. */
719
+ enrollmentId?: string;
720
+ grade: TimebackGrade;
721
+ subject: TimebackSubject;
722
+ beginDate?: string | null;
723
+ };
724
+ /**
725
+ * Null when Timeback hasn't stamped an assignment on the enrollment, or the
726
+ * stamped assignment has no fully graded test result yet.
727
+ */
728
+ triggeringResult: HoleFillingTriggeringResult | null;
729
+ /** Missed questions grouped by standard, most-missed first. */
730
+ missedStandards: HoleFillingMissedStandard[];
731
+ /** Missed questions whose item has no standard tag. */
732
+ untaggedMissedQuestionNumbers: number[];
733
+ }
734
+ /**
735
+ * Response from the hole-filling context endpoint: one entry per active
736
+ * hole-filling enrollment the student has in this game (usually zero or one).
737
+ */
738
+ interface HoleFillingContextResponse {
739
+ contexts: HoleFillingContext[];
740
+ }
676
741
 
677
742
  declare const DIAGNOSTIC_TRACK_OUTCOMES: readonly ['provisional', 'unresolved', 'route-to-instruction', 'not-assessed'];
678
743
  type DiagnosticTrackOutcome = (typeof DIAGNOSTIC_TRACK_OUTCOMES)[number];
@@ -3395,6 +3460,41 @@ interface TimebackUser extends TimebackUserContext {
3395
3460
  * highest mastered grade for a subject.
3396
3461
  */
3397
3462
  highestGradeMastered: TimebackUserHighestGradeMastered;
3463
+ /**
3464
+ * Hole-filling context for the current user.
3465
+ * Call `holeFilling.fetch()` to learn why the student is in a
3466
+ * hole-filling course and which standards to target.
3467
+ */
3468
+ holeFilling: TimebackUserHoleFilling;
3469
+ }
3470
+ /**
3471
+ * Hole-filling context access for the current user.
3472
+ * Results are cached for 5 minutes.
3473
+ */
3474
+ interface TimebackUserHoleFilling {
3475
+ /**
3476
+ * Fetch the test result that sent the student into each of their
3477
+ * hole-filling courses in this game, and the curriculum standards of the
3478
+ * questions they missed (most-missed first).
3479
+ *
3480
+ * Returns `{ contexts: [] }` when the student has no hole-filling
3481
+ * enrollment. Results are cached for 5 minutes (use `force: true` to
3482
+ * bypass, e.g. after `user.refresh()` picks up a new enrollment).
3483
+ *
3484
+ * @param options - Cache options
3485
+ * @returns Promise resolving to one context per hole-filling enrollment
3486
+ *
3487
+ * @example
3488
+ * ```typescript
3489
+ * const { contexts } = await client.timeback.user.holeFilling.fetch()
3490
+ * const context = contexts.find(c => c.enrollment.subject === 'Math')
3491
+ *
3492
+ * if (context) {
3493
+ * const targetCodes = context.missedStandards.map(s => s.code) // ['K.OA.A.2', ...]
3494
+ * }
3495
+ * ```
3496
+ */
3497
+ fetch(options?: TTLCacheConfig): Promise<HoleFillingContextResponse>;
3398
3498
  }
3399
3499
  /**
3400
3500
  * Mastery data access for the current user.
@@ -4490,4 +4590,4 @@ interface PlatformTimebackUser extends PlatformTimebackUserContext {
4490
4590
  }
4491
4591
 
4492
4592
  export { PlaycademyClient };
4493
- export type { AssessmentAttemptSnapshot, AssessmentAwardRecord, AssessmentFinalizeResult, AssessmentFlow, AssessmentItemGrading, AssessmentItemOutcome, AssessmentItemSubmission, AssessmentMasteryAward, AssessmentPreparationResult, AssessmentResponseUpdate, AssessmentResponseValue, AssessmentResponses, AssessmentReviewStandard, AssessmentSaveResult, AssessmentScore, AssessmentStandardRef, AssessmentSubmitResult, AssessmentTranscript, AuthCallbackPayload, AuthOptions, AuthProviderType, AuthResult, AuthServerMessage, AuthStateChangePayload, AuthStateUpdate, AuthenticatedUser, BetterAuthApiKey, BetterAuthApiKeyResponse, BetterAuthSignInResponse, BucketFile, BucketFilePage, BucketListPageOptions, ChildCheckpointRelay, ClientConfig, ClientEvents, ConventionalAssessmentAttemptSnapshot, ConventionalAssessmentSubmitResult, CourseMastery, CourseXp, DemoEndOptions, DemoEndPayload, DeploySource, DevUploadEvent, DevUploadHooks, DeveloperStatusEnumType, DeveloperStatusResponse, DeveloperStatusValue, DiagnosticAssessmentItemReceipt, DiagnosticAssessmentSubmitResult, DiagnosticRoutingSnapshot, DiagnosticRoutingTrackSnapshot, ELevel, EmbedActivity, EmbedActivityAbandoned, EmbedActivityCompleted, EmbedActivityFailed, EmbedLaunchOptions, EmbedResumeEnvelope, EmbedResumeStore, EmbedSession, EmbedSessionTiming, EmbedTimebackRecording, EventListeners, ExternalGame, FetchedGame, FinalizeAssessmentInput, Game, GameContextPayload, GameCourseMetrics, GameCustomHostname, GameInitUser, GameLeaderboardEntry, GameManifest, GameMetricComparisonKind, GameMetricComparisonMetric, GameMetricComparisonRow, GameMetricComparisonRowStatus, GameMetricsProxyResponse, GameMetricsResponse, GameMetricsUnsupportedReason, GamePlatform, GameRow as GameRecord, GameReleaseResponse, GameRunMetrics, GameRunMetricsComparison, GameRunMetricsComparisonStatus, GameRunMetricsComparisonSummary, GameTimebackIntegration, GameTokenResponse, GameType, GameUser, GetHighestGradeMasteredOptions, GetMasteryOptions, GetXpOptions, HighestGradeMasteredResponse, HostedGame, InitErrorPayload, InitPayload, KVKeyEntry, KVKeyMetadata, KVSeedEntry, KVStatsResponse, KeyEventPayload, LaunchIntent, LeaderboardEntry, LeaderboardOptions, LeaderboardTimeframe, LocalDayContext, LocalDaySource, LoginResponse, ManifestV1, ManifestV2, ManifestVersions, MasteryAssessmentSubmitResult, MasteryResponse, ParentGameContext, ParentGameHandle, PlatformRoutedDiagnosticAttemptSnapshot, PlatformRoutedDiagnosticSelectionContext, PlatformTimebackUser, PlatformTimebackUserContext, PlayableAssessment, PlayableAssessmentAttemptSnapshot, PlayableAssessmentChoice, PlayableAssessmentGraphic, PlayableAssessmentHotspot, PlayableAssessmentInteraction, PlayableAssessmentItem, PlayableChoiceInteraction, PlayableContentNode, PlayableGapMatchChoice, PlayableGapMatchInteraction, PlayableInlineChoiceInteraction, PlayableMatchChoice, PlayableMatchInteraction, PlayableOrderInteraction, PlaycademyMode, PlaycademyServerClientConfig, PlaycademyServerClientState, PopulateStudentResponse, RecordAssessmentProgressInput, Release, ReleasesResponse, ResumeAssessmentInput, SaveAssessmentInput, ScoreSubmission, SettledAssessmentAttemptSnapshot, SkillMasterySource, SkillStatus, SkillStatusLookupResult, SkillStatusRequest, SkillStatusRequestingGame, SkillStatusResponse, SkillStatusResult, SkillStatusUnsupportedReason, StandardsReviewSelectionContext, StartActivityOptions, StartActivityResult, StartAssessmentInput, StartAssessmentOptions, StartDiagnosticAssessmentInput, SubmitAssessmentInput, SubmitAssessmentItemInput, SubmitAssessmentItemResult, SubmitDiagnosticAssessmentItemInput, SubmitDiagnosticAssessmentItemResult, TelemetryPayload, TimebackActivityEndRelay, TimebackActivityStartRelay, TimebackEnrollment, TimebackHeartbeatRelayRequest, TimebackInitContext, TimebackOrganization, TimebackUser, TimebackUserContext, TimebackUserHighestGradeMastered, TimebackUserMastery, TimebackUserRefreshField, TimebackUserRefreshOptions, TimebackUserXp, TokenRefreshPayload, TokenType, UpsertGameMetadataInput, UserRow as User, UserEnrollment, UserInfo, UserOrganization, UserRank, UserRankResponse, UserRoleEnumType, UserScore, UserTimebackData, UserTimebackProfile, XpResponse };
4593
+ export type { AssessmentAttemptSnapshot, AssessmentAwardRecord, AssessmentFinalizeResult, AssessmentFlow, AssessmentItemGrading, AssessmentItemOutcome, AssessmentItemSubmission, AssessmentMasteryAward, AssessmentPreparationResult, AssessmentResponseUpdate, AssessmentResponseValue, AssessmentResponses, AssessmentReviewStandard, AssessmentSaveResult, AssessmentScore, AssessmentStandardRef, AssessmentSubmitResult, AssessmentTranscript, AuthCallbackPayload, AuthOptions, AuthProviderType, AuthResult, AuthServerMessage, AuthStateChangePayload, AuthStateUpdate, AuthenticatedUser, BetterAuthApiKey, BetterAuthApiKeyResponse, BetterAuthSignInResponse, BucketFile, BucketFilePage, BucketListPageOptions, ChildCheckpointRelay, ClientConfig, ClientEvents, ConventionalAssessmentAttemptSnapshot, ConventionalAssessmentSubmitResult, CourseMastery, CourseXp, DemoEndOptions, DemoEndPayload, DeploySource, DevUploadEvent, DevUploadHooks, DeveloperStatusEnumType, DeveloperStatusResponse, DeveloperStatusValue, DiagnosticAssessmentItemReceipt, DiagnosticAssessmentSubmitResult, DiagnosticRoutingSnapshot, DiagnosticRoutingTrackSnapshot, ELevel, EmbedActivity, EmbedActivityAbandoned, EmbedActivityCompleted, EmbedActivityFailed, EmbedLaunchOptions, EmbedResumeEnvelope, EmbedResumeStore, EmbedSession, EmbedSessionTiming, EmbedTimebackRecording, EventListeners, ExternalGame, FetchedGame, FinalizeAssessmentInput, Game, GameContextPayload, GameCourseMetrics, GameCustomHostname, GameInitUser, GameLeaderboardEntry, GameManifest, GameMetricComparisonKind, GameMetricComparisonMetric, GameMetricComparisonRow, GameMetricComparisonRowStatus, GameMetricsProxyResponse, GameMetricsResponse, GameMetricsUnsupportedReason, GamePlatform, GameRow as GameRecord, GameReleaseResponse, GameRunMetrics, GameRunMetricsComparison, GameRunMetricsComparisonStatus, GameRunMetricsComparisonSummary, GameTimebackIntegration, GameTokenResponse, GameType, GameUser, GetHighestGradeMasteredOptions, GetMasteryOptions, GetXpOptions, HighestGradeMasteredResponse, HoleFillingContext, HoleFillingContextResponse, HoleFillingMissedStandard, HoleFillingTriggeringResult, HostedGame, InitErrorPayload, InitPayload, KVKeyEntry, KVKeyMetadata, KVSeedEntry, KVStatsResponse, KeyEventPayload, LaunchIntent, LeaderboardEntry, LeaderboardOptions, LeaderboardTimeframe, LocalDayContext, LocalDaySource, LoginResponse, ManifestV1, ManifestV2, ManifestVersions, MasteryAssessmentSubmitResult, MasteryResponse, ParentGameContext, ParentGameHandle, PlatformRoutedDiagnosticAttemptSnapshot, PlatformRoutedDiagnosticSelectionContext, PlatformTimebackUser, PlatformTimebackUserContext, PlayableAssessment, PlayableAssessmentAttemptSnapshot, PlayableAssessmentChoice, PlayableAssessmentGraphic, PlayableAssessmentHotspot, PlayableAssessmentInteraction, PlayableAssessmentItem, PlayableChoiceInteraction, PlayableContentNode, PlayableGapMatchChoice, PlayableGapMatchInteraction, PlayableInlineChoiceInteraction, PlayableMatchChoice, PlayableMatchInteraction, PlayableOrderInteraction, PlaycademyMode, PlaycademyServerClientConfig, PlaycademyServerClientState, PopulateStudentResponse, RecordAssessmentProgressInput, Release, ReleasesResponse, ResumeAssessmentInput, SaveAssessmentInput, ScoreSubmission, SettledAssessmentAttemptSnapshot, SkillMasterySource, SkillStatus, SkillStatusLookupResult, SkillStatusRequest, SkillStatusRequestingGame, SkillStatusResponse, SkillStatusResult, SkillStatusUnsupportedReason, StandardsReviewSelectionContext, StartActivityOptions, StartActivityResult, StartAssessmentInput, StartAssessmentOptions, StartDiagnosticAssessmentInput, SubmitAssessmentInput, SubmitAssessmentItemInput, SubmitAssessmentItemResult, SubmitDiagnosticAssessmentItemInput, SubmitDiagnosticAssessmentItemResult, TelemetryPayload, TimebackActivityEndRelay, TimebackActivityStartRelay, TimebackEnrollment, TimebackHeartbeatRelayRequest, TimebackInitContext, TimebackOrganization, TimebackUser, TimebackUserContext, TimebackUserHighestGradeMastered, TimebackUserHoleFilling, TimebackUserMastery, TimebackUserRefreshField, TimebackUserRefreshOptions, TimebackUserXp, TokenRefreshPayload, TokenType, UpsertGameMetadataInput, UserRow as User, UserEnrollment, UserInfo, UserOrganization, UserRank, UserRankResponse, UserRoleEnumType, UserScore, UserTimebackData, UserTimebackProfile, XpResponse };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcademy/sdk",
3
- "version": "0.24.1-beta.2",
3
+ "version": "0.24.1-beta.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {