@playcademy/sdk 0.16.1-beta.7 → 0.16.1-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -139,9 +139,10 @@ const completed = await client.timeback.assessments.submit(attempt.attemptId, {
139
139
  })
140
140
  ```
141
141
 
142
- `start()` resumes an unfinished attempt or selects the next live test. Save payloads are
143
- question deltas, but each included question replaces its complete response state; use `null` to
144
- clear an answer. Keep the returned `responseVersion` and send it with the next mutation.
142
+ `start()` resumes a compatible unfinished attempt or selects content for a fixed test or standards
143
+ review. Save payloads merge at both the item and response levels; omitted values remain unchanged,
144
+ and `null` clears one response. Keep the returned `responseVersion` and send it with the next
145
+ mutation.
145
146
 
146
147
  For local development, import the current ordered catalog before starting the dev host:
147
148
 
package/dist/index.js CHANGED
@@ -823,7 +823,12 @@ var TIMEBACK_SUBJECTS = [
823
823
  "Math",
824
824
  "None"
825
825
  ];
826
- var ASSESSMENT_PURPOSES = ["end_of_course", "diagnostic"];
826
+ var ASSESSMENT_PURPOSES = ["end_of_course", "diagnostic", "review", "mastery"];
827
+ var TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS = {
828
+ standards: 20,
829
+ itemsPerStandard: 5,
830
+ standardFieldLength: 128
831
+ };
827
832
  var VALID_E_LEVELS = ["E1", "E2", "E3", "E4"];
828
833
  var TIMEBACK_GAME_METRIC_DECIMAL_PLACES = {
829
834
  xp: 1,
@@ -2952,7 +2957,7 @@ var VALID_MASTERY_INCLUDE_OPTIONS = ["perCourse"];
2952
2957
  var ASSESSMENTS_ROUTE = TIMEBACK_ROUTES.ASSESSMENTS;
2953
2958
  function validateAssessmentFilters(options) {
2954
2959
  if (!isAssessmentPurpose(options?.purpose)) {
2955
- throw new Error("purpose must be end_of_course or diagnostic");
2960
+ throw new Error("purpose must be end_of_course, diagnostic, review, or mastery");
2956
2961
  }
2957
2962
  if (options.grade !== undefined && !isValidGrade(options.grade)) {
2958
2963
  throw new Error(`Invalid grade: ${options.grade}. Valid grades: ${VALID_GRADES.join(", ")}`);
@@ -2960,6 +2965,17 @@ function validateAssessmentFilters(options) {
2960
2965
  if (options.subject !== undefined && !isValidSubject(options.subject)) {
2961
2966
  throw new Error(`Invalid subject: ${options.subject}. Valid subjects: ${VALID_SUBJECTS.join(", ")}`);
2962
2967
  }
2968
+ if (options.purpose === "mastery") {
2969
+ const { standard } = options;
2970
+ const framework = typeof standard?.framework === "string" ? standard.framework.trim() : "";
2971
+ const identifier = typeof standard?.identifier === "string" ? standard.identifier.trim() : "";
2972
+ if (!framework || !identifier) {
2973
+ throw new Error("mastery standard requires a canonical framework and identifier");
2974
+ }
2975
+ if (framework.length > TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.standardFieldLength || identifier.length > TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.standardFieldLength) {
2976
+ throw new Error(`mastery standard fields must be at most ${TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.standardFieldLength} characters`);
2977
+ }
2978
+ }
2963
2979
  }
2964
2980
  function createTimebackNamespace(client) {
2965
2981
  const engine = createTimebackEngine(client);
@@ -2972,6 +2988,25 @@ function createTimebackNamespace(client) {
2972
2988
  throw new Error("activityId is required");
2973
2989
  }
2974
2990
  validateAssessmentFilters(input);
2991
+ if (input.purpose === "review") {
2992
+ if (!Array.isArray(input.standards) || input.standards.length === 0) {
2993
+ throw new Error("standards must contain at least one standard for review");
2994
+ }
2995
+ if (input.standards.length > TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.standards) {
2996
+ throw new Error(`standards must contain at most ${TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.standards} standards`);
2997
+ }
2998
+ for (const standard of input.standards) {
2999
+ if (!standard || typeof standard !== "object" || !standard.framework?.trim() || !standard.identifier?.trim()) {
3000
+ throw new Error("review standards require a framework and identifier");
3001
+ }
3002
+ if (standard.framework.trim().length > TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.standardFieldLength || standard.identifier.trim().length > TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.standardFieldLength) {
3003
+ throw new Error(`review standard fields must be at most ${TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.standardFieldLength} characters`);
3004
+ }
3005
+ }
3006
+ if (input.itemsPerStandard !== undefined && (!Number.isInteger(input.itemsPerStandard) || input.itemsPerStandard <= 0 || input.itemsPerStandard > TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.itemsPerStandard)) {
3007
+ throw new Error(`itemsPerStandard must be a positive integer at most ${TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.itemsPerStandard}`);
3008
+ }
3009
+ }
2975
3010
  return client["requestGameBackend"](`${ASSESSMENTS_ROUTE}/start`, "POST", input);
2976
3011
  },
2977
3012
  latest: async (options) => {
@@ -2984,6 +3019,10 @@ function createTimebackNamespace(client) {
2984
3019
  if (options.grade !== undefined) {
2985
3020
  params.set("grade", String(options.grade));
2986
3021
  }
3022
+ if (options.purpose === "mastery") {
3023
+ params.set("standardFramework", options.standard.framework);
3024
+ params.set("standardIdentifier", options.standard.identifier);
3025
+ }
2987
3026
  return client["requestGameBackend"](`${ASSESSMENTS_ROUTE}/latest?${params.toString()}`, "GET");
2988
3027
  },
2989
3028
  get: async (attemptId) => {
@@ -3421,7 +3460,7 @@ async function request({
3421
3460
  return rawText && rawText.length > 0 ? rawText : undefined;
3422
3461
  }
3423
3462
  // src/version.ts
3424
- var SDK_VERSION = "0.16.1-beta.7";
3463
+ var SDK_VERSION = "0.16.1-beta.9";
3425
3464
 
3426
3465
  // src/clients/base.ts
3427
3466
  class PlaycademyBaseClient {
@@ -3985,10 +3985,12 @@ declare class PlaycademyInternalClient extends PlaycademyBaseClient {
3985
3985
  create: (gameId: string, courseId: string, data: {
3986
3986
  title: string;
3987
3987
  purpose: _playcademy_types.AssessmentPurpose;
3988
+ standard?: _playcademy_types.AssessmentStandardRef;
3988
3989
  }) => Promise<_playcademy_types.AssessmentRow>;
3989
3990
  update: (gameId: string, courseId: string, testIdentifier: string, data: {
3990
3991
  title?: string;
3991
3992
  purpose?: _playcademy_types.AssessmentPurpose;
3993
+ standard?: _playcademy_types.AssessmentStandardRef;
3992
3994
  status?: _playcademy_types.AssessmentStatus;
3993
3995
  }) => Promise<_playcademy_types.AssessmentRow>;
3994
3996
  reorder: (gameId: string, courseId: string, purpose: _playcademy_types.AssessmentPurpose, testIdentifiers: string[]) => Promise<{
@@ -3998,7 +4000,7 @@ declare class PlaycademyInternalClient extends PlaycademyBaseClient {
3998
4000
  action: 'discarded' | 'archived';
3999
4001
  }>;
4000
4002
  listTestLibrary: (gameId: string, courseId: string, options?: QtiLibraryQueryOptions) => Promise<_playcademy_types.QtiAssessmentTestListResponse>;
4001
- copy: (gameId: string, courseId: string, testIdentifier: string, purpose: _playcademy_types.AssessmentPurpose) => Promise<_playcademy_types.AssessmentRow>;
4003
+ copy: (gameId: string, courseId: string, testIdentifier: string, purpose: _playcademy_types.AssessmentPurpose, standard?: _playcademy_types.AssessmentStandardRef) => Promise<_playcademy_types.AssessmentRow>;
4002
4004
  listQuestions: (gameId: string, courseId: string, testIdentifier: string) => Promise<_playcademy_types.QtiTestQuestionsResponse>;
4003
4005
  listQuestionLibrary: (gameId: string, courseId: string, options?: QtiLibraryQueryOptions) => Promise<_playcademy_types.QtiAssessmentItemListResponse>;
4004
4006
  createQuestion: (gameId: string, courseId: string, testIdentifier: string, data: _playcademy_types.QtiQuestionCreateInput) => Promise<_playcademy_types.QtiTestQuestionRef>;
package/dist/internal.js CHANGED
@@ -823,7 +823,12 @@ var TIMEBACK_SUBJECTS = [
823
823
  "Math",
824
824
  "None"
825
825
  ];
826
- var ASSESSMENT_PURPOSES = ["end_of_course", "diagnostic"];
826
+ var ASSESSMENT_PURPOSES = ["end_of_course", "diagnostic", "review", "mastery"];
827
+ var TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS = {
828
+ standards: 20,
829
+ itemsPerStandard: 5,
830
+ standardFieldLength: 128
831
+ };
827
832
  var VALID_E_LEVELS = ["E1", "E2", "E3", "E4"];
828
833
  var TIMEBACK_GAME_METRIC_DECIMAL_PLACES = {
829
834
  xp: 1,
@@ -2952,7 +2957,7 @@ var VALID_MASTERY_INCLUDE_OPTIONS = ["perCourse"];
2952
2957
  var ASSESSMENTS_ROUTE = TIMEBACK_ROUTES.ASSESSMENTS;
2953
2958
  function validateAssessmentFilters(options) {
2954
2959
  if (!isAssessmentPurpose(options?.purpose)) {
2955
- throw new Error("purpose must be end_of_course or diagnostic");
2960
+ throw new Error("purpose must be end_of_course, diagnostic, review, or mastery");
2956
2961
  }
2957
2962
  if (options.grade !== undefined && !isValidGrade(options.grade)) {
2958
2963
  throw new Error(`Invalid grade: ${options.grade}. Valid grades: ${VALID_GRADES.join(", ")}`);
@@ -2960,6 +2965,17 @@ function validateAssessmentFilters(options) {
2960
2965
  if (options.subject !== undefined && !isValidSubject(options.subject)) {
2961
2966
  throw new Error(`Invalid subject: ${options.subject}. Valid subjects: ${VALID_SUBJECTS.join(", ")}`);
2962
2967
  }
2968
+ if (options.purpose === "mastery") {
2969
+ const { standard } = options;
2970
+ const framework = typeof standard?.framework === "string" ? standard.framework.trim() : "";
2971
+ const identifier = typeof standard?.identifier === "string" ? standard.identifier.trim() : "";
2972
+ if (!framework || !identifier) {
2973
+ throw new Error("mastery standard requires a canonical framework and identifier");
2974
+ }
2975
+ if (framework.length > TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.standardFieldLength || identifier.length > TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.standardFieldLength) {
2976
+ throw new Error(`mastery standard fields must be at most ${TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.standardFieldLength} characters`);
2977
+ }
2978
+ }
2963
2979
  }
2964
2980
  function createTimebackNamespace(client) {
2965
2981
  const engine = createTimebackEngine(client);
@@ -2972,6 +2988,25 @@ function createTimebackNamespace(client) {
2972
2988
  throw new Error("activityId is required");
2973
2989
  }
2974
2990
  validateAssessmentFilters(input);
2991
+ if (input.purpose === "review") {
2992
+ if (!Array.isArray(input.standards) || input.standards.length === 0) {
2993
+ throw new Error("standards must contain at least one standard for review");
2994
+ }
2995
+ if (input.standards.length > TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.standards) {
2996
+ throw new Error(`standards must contain at most ${TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.standards} standards`);
2997
+ }
2998
+ for (const standard of input.standards) {
2999
+ if (!standard || typeof standard !== "object" || !standard.framework?.trim() || !standard.identifier?.trim()) {
3000
+ throw new Error("review standards require a framework and identifier");
3001
+ }
3002
+ if (standard.framework.trim().length > TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.standardFieldLength || standard.identifier.trim().length > TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.standardFieldLength) {
3003
+ throw new Error(`review standard fields must be at most ${TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.standardFieldLength} characters`);
3004
+ }
3005
+ }
3006
+ if (input.itemsPerStandard !== undefined && (!Number.isInteger(input.itemsPerStandard) || input.itemsPerStandard <= 0 || input.itemsPerStandard > TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.itemsPerStandard)) {
3007
+ throw new Error(`itemsPerStandard must be a positive integer at most ${TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS.itemsPerStandard}`);
3008
+ }
3009
+ }
2975
3010
  return client["requestGameBackend"](`${ASSESSMENTS_ROUTE}/start`, "POST", input);
2976
3011
  },
2977
3012
  latest: async (options) => {
@@ -2984,6 +3019,10 @@ function createTimebackNamespace(client) {
2984
3019
  if (options.grade !== undefined) {
2985
3020
  params.set("grade", String(options.grade));
2986
3021
  }
3022
+ if (options.purpose === "mastery") {
3023
+ params.set("standardFramework", options.standard.framework);
3024
+ params.set("standardIdentifier", options.standard.identifier);
3025
+ }
2987
3026
  return client["requestGameBackend"](`${ASSESSMENTS_ROUTE}/latest?${params.toString()}`, "GET");
2988
3027
  },
2989
3028
  get: async (attemptId) => {
@@ -3863,8 +3902,8 @@ function createAssessmentNamespace(client) {
3863
3902
  }),
3864
3903
  remove: (gameId, courseId, testIdentifier) => client["request"](assessmentPath(gameId, courseId, testIdentifier), "DELETE"),
3865
3904
  listTestLibrary: (gameId, courseId, options = {}) => client["request"](`${assessmentPath(gameId, courseId, "test-library")}${buildQtiLibraryQueryString(options)}`, "GET"),
3866
- copy: (gameId, courseId, testIdentifier, purpose) => client["request"](assessmentPath(gameId, courseId, "copies"), "POST", {
3867
- body: { testIdentifier, purpose }
3905
+ copy: (gameId, courseId, testIdentifier, purpose, standard) => client["request"](assessmentPath(gameId, courseId, "copies"), "POST", {
3906
+ body: { testIdentifier, purpose, standard }
3868
3907
  }),
3869
3908
  listQuestions: (gameId, courseId, testIdentifier) => client["request"](assessmentPath(gameId, courseId, testIdentifier, "questions"), "GET"),
3870
3909
  listQuestionLibrary: (gameId, courseId, options = {}) => client["request"](`${assessmentPath(gameId, courseId, "question-library")}${buildQtiLibraryQueryString(options)}`, "GET"),
@@ -4296,7 +4335,7 @@ async function request({
4296
4335
  return rawText && rawText.length > 0 ? rawText : undefined;
4297
4336
  }
4298
4337
  // src/version.ts
4299
- var SDK_VERSION = "0.16.1-beta.7";
4338
+ var SDK_VERSION = "0.16.1-beta.9";
4300
4339
 
4301
4340
  // src/clients/base.ts
4302
4341
  class PlaycademyBaseClient {
@@ -41,7 +41,12 @@ var TIMEBACK_SUBJECTS = [
41
41
  "Math",
42
42
  "None"
43
43
  ];
44
- var ASSESSMENT_PURPOSES = ["end_of_course", "diagnostic"];
44
+ var ASSESSMENT_PURPOSES = ["end_of_course", "diagnostic", "review", "mastery"];
45
+ var TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS = {
46
+ standards: 20,
47
+ itemsPerStandard: 5,
48
+ standardFieldLength: 128
49
+ };
45
50
  var VALID_E_LEVELS = ["E1", "E2", "E3", "E4"];
46
51
  var TIMEBACK_GAME_METRIC_DECIMAL_PLACES = {
47
52
  xp: 1,
@@ -92,6 +97,10 @@ function createTimebackNamespace(client) {
92
97
  if (options.grade !== undefined) {
93
98
  params.set("grade", String(options.grade));
94
99
  }
100
+ if (options.purpose === "mastery") {
101
+ params.set("standardFramework", options.standard.framework);
102
+ params.set("standardIdentifier", options.standard.identifier);
103
+ }
95
104
  return client["request"](`/api/timeback/assessments/latest?${params.toString()}`, "GET");
96
105
  },
97
106
  get: (studentId, attemptId) => {
@@ -303,7 +312,7 @@ function extractApiErrorInfo(error) {
303
312
  }
304
313
 
305
314
  // src/version.ts
306
- var SDK_VERSION = "0.16.1-beta.7";
315
+ var SDK_VERSION = "0.16.1-beta.9";
307
316
 
308
317
  // src/server/request.ts
309
318
  async function makeApiRequest(opts) {
package/dist/server.js CHANGED
@@ -230,7 +230,12 @@ var TIMEBACK_SUBJECTS = [
230
230
  "Math",
231
231
  "None"
232
232
  ];
233
- var ASSESSMENT_PURPOSES = ["end_of_course", "diagnostic"];
233
+ var ASSESSMENT_PURPOSES = ["end_of_course", "diagnostic", "review", "mastery"];
234
+ var TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS = {
235
+ standards: 20,
236
+ itemsPerStandard: 5,
237
+ standardFieldLength: 128
238
+ };
234
239
  var VALID_E_LEVELS = ["E1", "E2", "E3", "E4"];
235
240
  var TIMEBACK_GAME_METRIC_DECIMAL_PLACES = {
236
241
  xp: 1,
@@ -281,6 +286,10 @@ function createTimebackNamespace(client) {
281
286
  if (options.grade !== undefined) {
282
287
  params.set("grade", String(options.grade));
283
288
  }
289
+ if (options.purpose === "mastery") {
290
+ params.set("standardFramework", options.standard.framework);
291
+ params.set("standardIdentifier", options.standard.identifier);
292
+ }
284
293
  return client["request"](`/api/timeback/assessments/latest?${params.toString()}`, "GET");
285
294
  },
286
295
  get: (studentId, attemptId) => {
@@ -492,7 +501,7 @@ function extractApiErrorInfo(error) {
492
501
  }
493
502
 
494
503
  // src/version.ts
495
- var SDK_VERSION = "0.16.1-beta.7";
504
+ var SDK_VERSION = "0.16.1-beta.9";
496
505
 
497
506
  // src/server/request.ts
498
507
  async function makeApiRequest(opts) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcademy/sdk",
3
- "version": "0.16.1-beta.7",
3
+ "version": "0.16.1-beta.9",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {