@playcademy/sdk 0.16.1-beta.10 → 0.16.1-beta.11

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
@@ -144,6 +144,20 @@ review. Save payloads merge at both the item and response levels; omitted values
144
144
  and `null` clears one response. Keep the returned `responseVersion` and send it with the next
145
145
  mutation.
146
146
 
147
+ The returned `flow` is authoritative and is derived from `purpose`; callers do not configure
148
+ navigation, feedback, and submission independently:
149
+
150
+ - `attempt-submit` is used for diagnostic and end-of-course attempts. Responses remain editable
151
+ through `save()` until `submit()` finalizes the whole attempt and returns feedback.
152
+ - `item-submit` is used for review and mastery attempts. Submit each item in assessment order with
153
+ `submitItem()`. That operation atomically saves the item's responses, locks them, and returns safe
154
+ immediate feedback. Give each item request its own stable `submissionId` and reuse that ID for an
155
+ ambiguous retry; the returned canonical `itemSubmissions` ledger identifies committed items after
156
+ retry or resume.
157
+
158
+ The host rejects `submitItem()` for attempt-submit flows, rejects `submit()` until every item-submit
159
+ item is committed, and enforces `expectedResponseVersion` for every mutation.
160
+
147
161
  For local development, import the current ordered catalog before starting the dev host:
148
162
 
149
163
  ```bash
package/dist/index.d.ts CHANGED
@@ -1559,6 +1559,7 @@ declare class PlaycademyClient extends PlaycademyBaseClient {
1559
1559
  latest: (options: _playcademy_types.GetLatestAssessmentOptions) => Promise<_playcademy_types.LatestAssessmentResult | null>;
1560
1560
  get: (attemptId: string) => Promise<_playcademy_types.AssessmentAttemptSnapshot>;
1561
1561
  save: (attemptId: string, input: _playcademy_types.SaveAssessmentInput) => Promise<_playcademy_types.AssessmentSaveResult>;
1562
+ submitItem: (attemptId: string, input: _playcademy_types.SubmitAssessmentItemInput) => Promise<_playcademy_types.SubmitAssessmentItemResult>;
1562
1563
  submit: (attemptId: string, input: _playcademy_types.SubmitAssessmentInput) => Promise<_playcademy_types.AssessmentSubmitResult>;
1563
1564
  };
1564
1565
  readonly user: TimebackUser;
package/dist/index.js CHANGED
@@ -3042,6 +3042,22 @@ function createTimebackNamespace(client) {
3042
3042
  }
3043
3043
  return client["requestGameBackend"](`${ASSESSMENTS_ROUTE}/${encodeURIComponent(attemptId)}/save`, "POST", input);
3044
3044
  },
3045
+ submitItem: async (attemptId, input) => {
3046
+ assertPlatformMode(client, "timeback.assessments.submitItem()");
3047
+ if (!attemptId?.trim()) {
3048
+ throw new Error("attemptId is required");
3049
+ }
3050
+ if (!Number.isInteger(input.expectedResponseVersion) || input.expectedResponseVersion < 0) {
3051
+ throw new Error("expectedResponseVersion must be a non-negative integer");
3052
+ }
3053
+ if (!input.submissionId?.trim()) {
3054
+ throw new Error("submissionId is required");
3055
+ }
3056
+ if (!input.itemIdentifier?.trim()) {
3057
+ throw new Error("itemIdentifier is required");
3058
+ }
3059
+ return client["requestGameBackend"](`${ASSESSMENTS_ROUTE}/${encodeURIComponent(attemptId)}/submit-item`, "POST", input);
3060
+ },
3045
3061
  submit: async (attemptId, input) => {
3046
3062
  assertPlatformMode(client, "timeback.assessments.submit()");
3047
3063
  if (!attemptId?.trim()) {
@@ -3460,7 +3476,7 @@ async function request({
3460
3476
  return rawText && rawText.length > 0 ? rawText : undefined;
3461
3477
  }
3462
3478
  // src/version.ts
3463
- var SDK_VERSION = "0.16.1-beta.10";
3479
+ var SDK_VERSION = "0.16.1-beta.11";
3464
3480
 
3465
3481
  // src/clients/base.ts
3466
3482
  class PlaycademyBaseClient {
@@ -1,7 +1,7 @@
1
1
  import { SchemaInfo } from '@playcademy/cloudflare';
2
2
  import { GamePermission, AUTH_PROVIDER_IDS } from '@playcademy/constants';
3
3
  import { TimebackGrade, TimebackSubject, ELevel, HeartbeatRequest, EndActivityRequest, EndActivityScoreData, EndActivityResponse, TimebackCourseConfig, CourseConfig, OrganizationConfig, ComponentConfig, ResourceConfig, ComponentResourceConfig } from '@playcademy/types/timeback';
4
- export { ELevel } from '@playcademy/types/timeback';
4
+ export { AssessmentAttemptSnapshot, AssessmentFlow, AssessmentItemSubmission, AssessmentResponseUpdate, AssessmentResponseValue, AssessmentResponses, AssessmentSaveResult, AssessmentScore, AssessmentStandardRef, AssessmentSubmitResult, ELevel, PlayableAssessment, PlayableAssessmentChoice, PlayableAssessmentGraphic, PlayableAssessmentHotspot, PlayableAssessmentInteraction, PlayableAssessmentItem, PlayableContentNode, SaveAssessmentInput, StartAssessmentInput, SubmitAssessmentInput, SubmitAssessmentItemInput, SubmitAssessmentItemResult } from '@playcademy/types/timeback';
5
5
  import * as _playcademy_types from '@playcademy/types';
6
6
  import { GameManifest, LocalDayContext } from '@playcademy/types';
7
7
  export { AuthenticatedUser, DeveloperStatusEnumType, DeveloperStatusResponse, DeveloperStatusValue, GameCourseMetrics, GameLeaderboardEntry, GameManifest, GameMetricComparisonKind, GameMetricComparisonMetric, GameMetricComparisonRow, GameMetricComparisonRowStatus, GameMetricsProxyResponse, GameMetricsResponse, GameMetricsUnsupportedReason, GamePlatform, GameRunMetrics, GameRunMetricsComparison, GameRunMetricsComparisonStatus, GameRunMetricsComparisonSummary, GameTimebackIntegration, GameType, GameUser, LeaderboardEntry, LeaderboardOptions, LeaderboardTimeframe, LocalDayContext, LocalDaySource, ManifestV1, ManifestV2, ManifestVersions, PopulateStudentResponse, UserEnrollment, UserInfo, UserOrganization, UserRank, UserRankResponse, UserRoleEnumType, UserScore, UserTimebackData } from '@playcademy/types';
package/dist/internal.js CHANGED
@@ -3042,6 +3042,22 @@ function createTimebackNamespace(client) {
3042
3042
  }
3043
3043
  return client["requestGameBackend"](`${ASSESSMENTS_ROUTE}/${encodeURIComponent(attemptId)}/save`, "POST", input);
3044
3044
  },
3045
+ submitItem: async (attemptId, input) => {
3046
+ assertPlatformMode(client, "timeback.assessments.submitItem()");
3047
+ if (!attemptId?.trim()) {
3048
+ throw new Error("attemptId is required");
3049
+ }
3050
+ if (!Number.isInteger(input.expectedResponseVersion) || input.expectedResponseVersion < 0) {
3051
+ throw new Error("expectedResponseVersion must be a non-negative integer");
3052
+ }
3053
+ if (!input.submissionId?.trim()) {
3054
+ throw new Error("submissionId is required");
3055
+ }
3056
+ if (!input.itemIdentifier?.trim()) {
3057
+ throw new Error("itemIdentifier is required");
3058
+ }
3059
+ return client["requestGameBackend"](`${ASSESSMENTS_ROUTE}/${encodeURIComponent(attemptId)}/submit-item`, "POST", input);
3060
+ },
3045
3061
  submit: async (attemptId, input) => {
3046
3062
  assertPlatformMode(client, "timeback.assessments.submit()");
3047
3063
  if (!attemptId?.trim()) {
@@ -4336,7 +4352,7 @@ async function request({
4336
4352
  return rawText && rawText.length > 0 ? rawText : undefined;
4337
4353
  }
4338
4354
  // src/version.ts
4339
- var SDK_VERSION = "0.16.1-beta.10";
4355
+ var SDK_VERSION = "0.16.1-beta.11";
4340
4356
 
4341
4357
  // src/clients/base.ts
4342
4358
  class PlaycademyBaseClient {
@@ -359,6 +359,7 @@ declare class PlaycademyClient {
359
359
  latest: (studentId: string, options: _playcademy_types.GetLatestAssessmentOptions) => Promise<_playcademy_types.LatestAssessmentResult | null>;
360
360
  get: (studentId: string, attemptId: string) => Promise<_playcademy_types.AssessmentAttemptSnapshot>;
361
361
  save: (studentId: string, attemptId: string, input: _playcademy_types.SaveAssessmentInput) => Promise<_playcademy_types.AssessmentSaveResult>;
362
+ submitItem: (studentId: string, attemptId: string, input: _playcademy_types.SubmitAssessmentItemInput) => Promise<_playcademy_types.SubmitAssessmentItemResult>;
362
363
  submit: (studentId: string, attemptId: string, input: _playcademy_types.SubmitAssessmentInput, context: {
363
364
  sensorUrl: string;
364
365
  }) => Promise<_playcademy_types.AssessmentSubmitResult>;
@@ -108,6 +108,7 @@ function createTimebackNamespace(client) {
108
108
  return client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}?${params.toString()}`, "GET");
109
109
  },
110
110
  save: (studentId, attemptId, input) => client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}/save`, "POST", { ...input, gameId: client.gameId, studentId }),
111
+ submitItem: (studentId, attemptId, input) => client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}/submit-item`, "POST", { ...input, gameId: client.gameId, studentId }),
111
112
  submit: (studentId, attemptId, input, context) => client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}/submit`, "POST", {
112
113
  ...input,
113
114
  gameId: client.gameId,
@@ -312,7 +313,7 @@ function extractApiErrorInfo(error) {
312
313
  }
313
314
 
314
315
  // src/version.ts
315
- var SDK_VERSION = "0.16.1-beta.10";
316
+ var SDK_VERSION = "0.16.1-beta.11";
316
317
 
317
318
  // src/server/request.ts
318
319
  async function makeApiRequest(opts) {
package/dist/server.d.ts CHANGED
@@ -359,6 +359,7 @@ declare class PlaycademyClient$1 {
359
359
  latest: (studentId: string, options: _playcademy_types.GetLatestAssessmentOptions) => Promise<_playcademy_types.LatestAssessmentResult | null>;
360
360
  get: (studentId: string, attemptId: string) => Promise<_playcademy_types.AssessmentAttemptSnapshot>;
361
361
  save: (studentId: string, attemptId: string, input: _playcademy_types.SaveAssessmentInput) => Promise<_playcademy_types.AssessmentSaveResult>;
362
+ submitItem: (studentId: string, attemptId: string, input: _playcademy_types.SubmitAssessmentItemInput) => Promise<_playcademy_types.SubmitAssessmentItemResult>;
362
363
  submit: (studentId: string, attemptId: string, input: _playcademy_types.SubmitAssessmentInput, context: {
363
364
  sensorUrl: string;
364
365
  }) => Promise<_playcademy_types.AssessmentSubmitResult>;
package/dist/server.js CHANGED
@@ -297,6 +297,7 @@ function createTimebackNamespace(client) {
297
297
  return client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}?${params.toString()}`, "GET");
298
298
  },
299
299
  save: (studentId, attemptId, input) => client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}/save`, "POST", { ...input, gameId: client.gameId, studentId }),
300
+ submitItem: (studentId, attemptId, input) => client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}/submit-item`, "POST", { ...input, gameId: client.gameId, studentId }),
300
301
  submit: (studentId, attemptId, input, context) => client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}/submit`, "POST", {
301
302
  ...input,
302
303
  gameId: client.gameId,
@@ -501,7 +502,7 @@ function extractApiErrorInfo(error) {
501
502
  }
502
503
 
503
504
  // src/version.ts
504
- var SDK_VERSION = "0.16.1-beta.10";
505
+ var SDK_VERSION = "0.16.1-beta.11";
505
506
 
506
507
  // src/server/request.ts
507
508
  async function makeApiRequest(opts) {
package/dist/types.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as _playcademy_types from '@playcademy/types';
2
2
  import { GameManifest, LocalDayContext } from '@playcademy/types';
3
3
  export { AuthenticatedUser, DeveloperStatusEnumType, DeveloperStatusResponse, DeveloperStatusValue, GameCourseMetrics, GameLeaderboardEntry, GameManifest, GameMetricComparisonKind, GameMetricComparisonMetric, GameMetricComparisonRow, GameMetricComparisonRowStatus, GameMetricsProxyResponse, GameMetricsResponse, GameMetricsUnsupportedReason, GamePlatform, GameRunMetrics, GameRunMetricsComparison, GameRunMetricsComparisonStatus, GameRunMetricsComparisonSummary, GameTimebackIntegration, GameType, GameUser, LeaderboardEntry, LeaderboardOptions, LeaderboardTimeframe, LocalDayContext, LocalDaySource, ManifestV1, ManifestV2, ManifestVersions, PopulateStudentResponse, UserEnrollment, UserInfo, UserOrganization, UserRank, UserRankResponse, UserRoleEnumType, UserScore, UserTimebackData } from '@playcademy/types';
4
4
  import { TimebackCourseConfig, CourseConfig, OrganizationConfig, ComponentConfig, ResourceConfig, ComponentResourceConfig, TimebackGrade, TimebackSubject, ELevel, EndActivityRequest, HeartbeatRequest, EndActivityScoreData, EndActivityResponse } from '@playcademy/types/timeback';
5
- export { ELevel } from '@playcademy/types/timeback';
5
+ export { AssessmentAttemptSnapshot, AssessmentFlow, AssessmentItemSubmission, AssessmentResponseUpdate, AssessmentResponseValue, AssessmentResponses, AssessmentSaveResult, AssessmentScore, AssessmentStandardRef, AssessmentSubmitResult, ELevel, PlayableAssessment, PlayableAssessmentChoice, PlayableAssessmentGraphic, PlayableAssessmentHotspot, PlayableAssessmentInteraction, PlayableAssessmentItem, PlayableContentNode, SaveAssessmentInput, StartAssessmentInput, SubmitAssessmentInput, SubmitAssessmentItemInput, SubmitAssessmentItemResult } from '@playcademy/types/timeback';
6
6
  import { TimebackUserRole, UserEnrollment, UserOrganization, UserInfo } from '@playcademy/types/user';
7
7
  import { GamePermission, AUTH_PROVIDER_IDS } from '@playcademy/constants';
8
8
  import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
@@ -2000,6 +2000,7 @@ declare class PlaycademyClient extends PlaycademyBaseClient {
2000
2000
  latest: (options: _playcademy_types.GetLatestAssessmentOptions) => Promise<_playcademy_types.LatestAssessmentResult | null>;
2001
2001
  get: (attemptId: string) => Promise<_playcademy_types.AssessmentAttemptSnapshot>;
2002
2002
  save: (attemptId: string, input: _playcademy_types.SaveAssessmentInput) => Promise<_playcademy_types.AssessmentSaveResult>;
2003
+ submitItem: (attemptId: string, input: _playcademy_types.SubmitAssessmentItemInput) => Promise<_playcademy_types.SubmitAssessmentItemResult>;
2003
2004
  submit: (attemptId: string, input: _playcademy_types.SubmitAssessmentInput) => Promise<_playcademy_types.AssessmentSubmitResult>;
2004
2005
  };
2005
2006
  readonly user: TimebackUser;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcademy/sdk",
3
- "version": "0.16.1-beta.10",
3
+ "version": "0.16.1-beta.11",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {