@playcademy/sandbox 0.1.9 → 0.1.10

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.
Files changed (41) hide show
  1. package/README.md +15 -15
  2. package/dist/cli.d.ts +0 -1
  3. package/dist/cli.js +103711 -98870
  4. package/dist/config.d.ts +43 -0
  5. package/dist/server.d.ts +288 -5
  6. package/dist/server.js +102023 -97211
  7. package/package.json +9 -11
  8. package/dist/config/index.d.ts +0 -10
  9. package/dist/config/mutators.d.ts +0 -4
  10. package/dist/config/timeback.d.ts +0 -10
  11. package/dist/config/types.d.ts +0 -23
  12. package/dist/constants.d.ts +0 -171
  13. package/dist/database/index.d.ts +0 -6
  14. package/dist/database/path-manager.d.ts +0 -26
  15. package/dist/database/seed.d.ts +0 -34
  16. package/dist/lib/auth.d.ts +0 -10
  17. package/dist/lib/error-handler.d.ts +0 -22
  18. package/dist/lib/realtime.d.ts +0 -17
  19. package/dist/routes/achievements.d.ts +0 -3
  20. package/dist/routes/character.d.ts +0 -3
  21. package/dist/routes/currencies.d.ts +0 -3
  22. package/dist/routes/dev.d.ts +0 -3
  23. package/dist/routes/games.d.ts +0 -3
  24. package/dist/routes/health.d.ts +0 -2
  25. package/dist/routes/index.d.ts +0 -20
  26. package/dist/routes/inventory.d.ts +0 -3
  27. package/dist/routes/items.d.ts +0 -3
  28. package/dist/routes/leaderboard.d.ts +0 -3
  29. package/dist/routes/levels.d.ts +0 -3
  30. package/dist/routes/lti.d.ts +0 -3
  31. package/dist/routes/manifest.d.ts +0 -3
  32. package/dist/routes/maps.d.ts +0 -4
  33. package/dist/routes/notifications.d.ts +0 -3
  34. package/dist/routes/realtime.d.ts +0 -3
  35. package/dist/routes/shop-listings.d.ts +0 -3
  36. package/dist/routes/shop.d.ts +0 -3
  37. package/dist/routes/sprite.d.ts +0 -3
  38. package/dist/routes/timeback.d.ts +0 -3
  39. package/dist/routes/users.d.ts +0 -3
  40. package/dist/types.d.ts +0 -29
  41. /package/dist/{config/index.js → config.js} +0 -0
package/README.md CHANGED
@@ -21,7 +21,7 @@ It's a "mock Playcademy platform" running on your machine that behaves just like
21
21
  - **Zero Configuration**: Automatic database setup and seeding.
22
22
  - **Full API Compatibility**: All Playcademy APIs available locally.
23
23
  - **Integrated Real-time Server**: Built-in WebSocket server for multiplayer features.
24
- - **Fast Development Cycle**: Quick startup with an in-memory database.
24
+ - **Fast Development Cycle**: Quick startup with persistent local database.
25
25
 
26
26
  ## How It Works
27
27
 
@@ -33,7 +33,7 @@ graph TD
33
33
  A["Your Game (in browser)"] --> B["@playcademy/sdk"];
34
34
  B --> C["API Server (localhost:4321)"];
35
35
  B --> D["Real-time Server (localhost:4322)"];
36
- C --> E["In-Memory Database"];
36
+ C --> E["Local PGlite Database"];
37
37
  D --> E;
38
38
  end
39
39
  ```
@@ -160,13 +160,13 @@ const client = await PlaycademyClient.init({
160
160
 
161
161
  ## Sandbox Features
162
162
 
163
- | Feature | Description |
164
- | :------------------- | :-------------------------------------------------------------------------------------------- |
165
- | **API Simulation** | Emulates the entire Playcademy backend API for users, games, inventory, etc. |
166
- | **Real-time Server** | Provides WebSocket-based real-time channels for multiplayer communication. |
167
- | **Data Persistence** | Uses an in-memory database. Data persists until the sandbox is restarted. |
168
- | **Mock Data** | Automatically seeds with a mock user (`developer@example.com`) and other demo data. |
169
- | **Game Context** | When run via the Vite plugin, it automatically registers your current project as a mock game. |
163
+ | Feature | Description |
164
+ | :------------------- | :-------------------------------------------------------------------------------------------------------------------- |
165
+ | **API Simulation** | Emulates the entire Playcademy backend API for users, games, inventory, etc. |
166
+ | **Real-time Server** | Provides WebSocket-based real-time channels for multiplayer communication. |
167
+ | **Data Persistence** | Persists data to disk by default (survives restarts). Use `--recreate-db` to reset, or `--memory` for in-memory only. |
168
+ | **Mock Data** | Automatically seeds with demo users and data on first run or when database is empty. |
169
+ | **Game Context** | When run via the Vite plugin, it automatically registers your current project as a mock game. |
170
170
 
171
171
  ## Server Endpoints
172
172
 
@@ -332,17 +332,17 @@ This should return a JSON object with the status:
332
332
  | **API calls return HTML** | This indicates the API server isn't running or is on a different port. Check your sandbox `url` configuration. |
333
333
  | **WebSocket connection fails** | Verify the real-time server is enabled (`--realtime` flag or Vite config) and check its port in the console output. |
334
334
  | **Port conflicts** | Use the `--port` and `--realtime-port` options to choose different ports. The sandbox will automatically try the next available port if its default is taken. |
335
- | **Data doesn't persist** | This is expected. The sandbox uses an in-memory database that resets on every restart to ensure a clean state for development. |
335
+ | **Data persists unexpectedly** | By default, the sandbox persists data to disk. Use `--recreate-db` to reset the database, or `--memory` for session-only data that doesn't persist. |
336
336
 
337
337
  ## Production vs. Sandbox
338
338
 
339
339
  The SDK is designed to work seamlessly in both environments. `PlaycademyClient.init()` automatically detects whether it's running in a production environment or against a local sandbox.
340
340
 
341
- | Feature | Sandbox | Production |
342
- | :----------------- | :-------------- | :-------------------- |
343
- | **Data** | Mock, temporary | Real user data |
344
- | **Authentication** | Mock tokens | Secure authentication |
345
- | **Persistence** | Session only | Permanent |
341
+ | Feature | Sandbox | Production |
342
+ | :----------------- | :------------------------------------------------ | :----------------------- |
343
+ | **Data** | Mock, temporary | Real user data |
344
+ | **Authentication** | Mock tokens | Secure authentication |
345
+ | **Persistence** | Local disk (default) or session-only (`--memory`) | Permanent cloud database |
346
346
 
347
347
  ## Contributing
348
348
 
package/dist/cli.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  #!/usr/bin/env node
2
- export {};