@playcademy/sdk 0.18.1-beta.1 → 0.18.1-beta.2

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
@@ -1,6 +1,9 @@
1
1
  # @playcademy/sdk
2
2
 
3
- TypeScript SDK for building games on the Playcademy platform.
3
+ **TypeScript SDK for building games on the Playcademy platform.**
4
+
5
+ Use the browser client to connect a game to platform services, or the server client to handle
6
+ authenticated operations in a game backend. Platform tooling uses the separate internal entry point.
4
7
 
5
8
  ## Overview
6
9
 
@@ -21,6 +24,21 @@ The SDK is the interface between your game and the Playcademy platform. It provi
21
24
  | `@playcademy/sdk/types` | Type-only imports |
22
25
  | `@playcademy/sdk/test` | Test utilities |
23
26
 
27
+ ## Installation
28
+
29
+ Install the SDK in your game project:
30
+
31
+ ```bash
32
+ bun add @playcademy/sdk
33
+ ```
34
+
35
+ For Vite-based games, add the development plugin and follow its
36
+ [setup guide](../vite-plugin/README.md):
37
+
38
+ ```bash
39
+ bun add -d @playcademy/vite-plugin
40
+ ```
41
+
24
42
  ## Quick Start
25
43
 
26
44
  ```typescript
@@ -160,8 +178,10 @@ navigation, feedback, and submission independently:
160
178
  resume.
161
179
  - `platform-routed-item-submit` is used for adaptive diagnostics. Render only
162
180
  `routing.next.itemIdentifier`, submit it with `routing.next.nodeKey`, and replace local state with
163
- the returned canonical routing snapshot. Diagnostic receipts never reveal correctness or score,
164
- and `submit()` becomes available only after routing reports `ready-to-complete`.
181
+ the returned canonical routing snapshot. Each receipt includes the trusted item `score` and
182
+ `isCorrect` verdict used by Platform to choose that snapshot; authored answers and private routing
183
+ data remain server-only. `submit()` becomes available only after routing reports
184
+ `ready-to-complete`.
165
185
 
166
186
  The host rejects the wrong mutation for each flow, rejects premature finalization, and enforces
167
187
  `expectedResponseVersion` for every mutation. Hosted and local providers execute the same routing
@@ -309,9 +329,46 @@ try {
309
329
 
310
330
  ## Development
311
331
 
312
- In development, the SDK connects to a local sandbox started by `@playcademy/vite-plugin`. The sandbox provides mock auth, a local API, and game asset serving — no platform account needed.
332
+ For SDK contributors working in this monorepo, the primary workflow starts at the repository root:
333
+
334
+ ```bash
335
+ bun dev
336
+ ```
337
+
338
+ This starts the shared platform development environment. Run validation from the root as well:
339
+
340
+ ```bash
341
+ bun run check
342
+ bun run test unit
343
+ ```
344
+
345
+ For game developers consuming the SDK outside the monorepo, run your game's development command
346
+ with `@playcademy/vite-plugin` configured. The plugin starts a local sandbox with mock auth, a local
347
+ API, and game asset serving — no platform account or monorepo checkout is needed.
313
348
 
314
349
  ```typescript
315
350
  // Automatic — vite plugin handles everything
316
351
  const client = await PlaycademyClient.init()
317
352
  ```
353
+
354
+ ## Dependencies
355
+
356
+ - Peer dependencies: TypeScript (`^5 || ^6`) and Drizzle ORM (`^0.42.0`), as declared in
357
+ [package.json](./package.json).
358
+ - Workspace development dependencies include `@playcademy/types`, `@playcademy/constants`,
359
+ `@playcademy/utils`, and `@playcademy/test-utils`. Contributors install these through the root
360
+ workspace; game projects do not need to install private workspace packages.
361
+ - `@playcademy/vite-plugin` provides local sandbox integration for Vite games.
362
+
363
+ ## Examples
364
+
365
+ - [Basic game](../../examples/basic) — browser SDK initialization and platform services.
366
+ - [Full-stack game](../../examples/full-stack) — game backend routes and server-side integration.
367
+ - [TimeBack game](../../examples/timeback) — activity tracking, hosted assessments, and local fixtures.
368
+
369
+ ## Related Packages
370
+
371
+ - [@playcademy/vite-plugin](../vite-plugin) — Vite integration and local game development.
372
+ - [playcademy](../cli) — CLI for game setup, deployment, and platform operations.
373
+ - [@playcademy/types](../types) — shared platform API contracts.
374
+ - [@playcademy/ui-react](../ui-react) — React assessment rendering and game UI components.
package/dist/index.js CHANGED
@@ -3725,7 +3725,7 @@ async function request({
3725
3725
  return rawText && rawText.length > 0 ? rawText : undefined;
3726
3726
  }
3727
3727
  // src/version.ts
3728
- var SDK_VERSION = "0.18.1-beta.1";
3728
+ var SDK_VERSION = "0.18.1-beta.2";
3729
3729
 
3730
3730
  // src/clients/base.ts
3731
3731
  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 { AssessmentAttemptSnapshot, AssessmentAwardRecord, AssessmentFinalizeResult, AssessmentFlow, AssessmentItemSubmission, AssessmentMasteryAward, AssessmentPreparationResult, AssessmentResponseUpdate, AssessmentResponseValue, AssessmentResponses, AssessmentSaveResult, AssessmentScore, AssessmentStandardRef, AssessmentSubmitResult, ConventionalAssessmentAttemptSnapshot, ConventionalAssessmentSubmitResult, DiagnosticAssessmentItemReceipt, DiagnosticAssessmentSubmitResult, DiagnosticRoutingSnapshot, DiagnosticRoutingTrackSnapshot, ELevel, FinalizeAssessmentInput, PlatformRoutedDiagnosticAttemptSnapshot, PlatformRoutedDiagnosticSelectionContext, PlayableAssessment, PlayableAssessmentAttemptSnapshot, PlayableAssessmentChoice, PlayableAssessmentGraphic, PlayableAssessmentHotspot, PlayableAssessmentInteraction, PlayableAssessmentItem, PlayableContentNode, SaveAssessmentInput, SettledAssessmentAttemptSnapshot, StartAssessmentInput, StartAssessmentOptions, StartDiagnosticAssessmentInput, SubmitAssessmentInput, SubmitAssessmentItemInput, SubmitAssessmentItemResult, SubmitDiagnosticAssessmentItemInput, SubmitDiagnosticAssessmentItemResult } from '@playcademy/types/timeback';
4
+ export { AssessmentAttemptSnapshot, AssessmentAwardRecord, AssessmentFinalizeResult, AssessmentFlow, AssessmentItemGrading, AssessmentItemSubmission, AssessmentMasteryAward, AssessmentPreparationResult, AssessmentResponseUpdate, AssessmentResponseValue, AssessmentResponses, AssessmentSaveResult, AssessmentScore, AssessmentStandardRef, AssessmentSubmitResult, ConventionalAssessmentAttemptSnapshot, ConventionalAssessmentSubmitResult, DiagnosticAssessmentItemReceipt, DiagnosticAssessmentSubmitResult, DiagnosticRoutingSnapshot, DiagnosticRoutingTrackSnapshot, ELevel, FinalizeAssessmentInput, PlatformRoutedDiagnosticAttemptSnapshot, PlatformRoutedDiagnosticSelectionContext, PlayableAssessment, PlayableAssessmentAttemptSnapshot, PlayableAssessmentChoice, PlayableAssessmentGraphic, PlayableAssessmentHotspot, PlayableAssessmentInteraction, PlayableAssessmentItem, PlayableContentNode, SaveAssessmentInput, SettledAssessmentAttemptSnapshot, StartAssessmentInput, StartAssessmentOptions, StartDiagnosticAssessmentInput, SubmitAssessmentInput, SubmitAssessmentItemInput, SubmitAssessmentItemResult, SubmitDiagnosticAssessmentItemInput, SubmitDiagnosticAssessmentItemResult } 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
@@ -4617,7 +4617,7 @@ async function request({
4617
4617
  return rawText && rawText.length > 0 ? rawText : undefined;
4618
4618
  }
4619
4619
  // src/version.ts
4620
- var SDK_VERSION = "0.18.1-beta.1";
4620
+ var SDK_VERSION = "0.18.1-beta.2";
4621
4621
 
4622
4622
  // src/clients/base.ts
4623
4623
  class PlaycademyBaseClient {
@@ -335,7 +335,7 @@ function extractApiErrorInfo(error) {
335
335
  }
336
336
 
337
337
  // src/version.ts
338
- var SDK_VERSION = "0.18.1-beta.1";
338
+ var SDK_VERSION = "0.18.1-beta.2";
339
339
 
340
340
  // src/server/request.ts
341
341
  async function makeApiRequest(opts) {
package/dist/server.js CHANGED
@@ -524,7 +524,7 @@ function extractApiErrorInfo(error) {
524
524
  }
525
525
 
526
526
  // src/version.ts
527
- var SDK_VERSION = "0.18.1-beta.1";
527
+ var SDK_VERSION = "0.18.1-beta.2";
528
528
 
529
529
  // src/server/request.ts
530
530
  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 { AssessmentAttemptSnapshot, AssessmentAwardRecord, AssessmentFinalizeResult, AssessmentFlow, AssessmentItemSubmission, AssessmentMasteryAward, AssessmentPreparationResult, AssessmentResponseUpdate, AssessmentResponseValue, AssessmentResponses, AssessmentSaveResult, AssessmentScore, AssessmentStandardRef, AssessmentSubmitResult, ConventionalAssessmentAttemptSnapshot, ConventionalAssessmentSubmitResult, DiagnosticAssessmentItemReceipt, DiagnosticAssessmentSubmitResult, DiagnosticRoutingSnapshot, DiagnosticRoutingTrackSnapshot, ELevel, FinalizeAssessmentInput, PlatformRoutedDiagnosticAttemptSnapshot, PlatformRoutedDiagnosticSelectionContext, PlayableAssessment, PlayableAssessmentAttemptSnapshot, PlayableAssessmentChoice, PlayableAssessmentGraphic, PlayableAssessmentHotspot, PlayableAssessmentInteraction, PlayableAssessmentItem, PlayableContentNode, SaveAssessmentInput, SettledAssessmentAttemptSnapshot, StartAssessmentInput, StartAssessmentOptions, StartDiagnosticAssessmentInput, SubmitAssessmentInput, SubmitAssessmentItemInput, SubmitAssessmentItemResult, SubmitDiagnosticAssessmentItemInput, SubmitDiagnosticAssessmentItemResult } from '@playcademy/types/timeback';
5
+ export { AssessmentAttemptSnapshot, AssessmentAwardRecord, AssessmentFinalizeResult, AssessmentFlow, AssessmentItemGrading, AssessmentItemSubmission, AssessmentMasteryAward, AssessmentPreparationResult, AssessmentResponseUpdate, AssessmentResponseValue, AssessmentResponses, AssessmentSaveResult, AssessmentScore, AssessmentStandardRef, AssessmentSubmitResult, ConventionalAssessmentAttemptSnapshot, ConventionalAssessmentSubmitResult, DiagnosticAssessmentItemReceipt, DiagnosticAssessmentSubmitResult, DiagnosticRoutingSnapshot, DiagnosticRoutingTrackSnapshot, ELevel, FinalizeAssessmentInput, PlatformRoutedDiagnosticAttemptSnapshot, PlatformRoutedDiagnosticSelectionContext, PlayableAssessment, PlayableAssessmentAttemptSnapshot, PlayableAssessmentChoice, PlayableAssessmentGraphic, PlayableAssessmentHotspot, PlayableAssessmentInteraction, PlayableAssessmentItem, PlayableContentNode, SaveAssessmentInput, SettledAssessmentAttemptSnapshot, StartAssessmentInput, StartAssessmentOptions, StartDiagnosticAssessmentInput, SubmitAssessmentInput, SubmitAssessmentItemInput, SubmitAssessmentItemResult, SubmitDiagnosticAssessmentItemInput, SubmitDiagnosticAssessmentItemResult } 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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcademy/sdk",
3
- "version": "0.18.1-beta.1",
3
+ "version": "0.18.1-beta.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {