@playcademy/sandbox 0.1.8 → 0.1.9-alpha.1
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 +15 -15
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +30947 -30723
- package/dist/config.d.ts +43 -0
- package/dist/server.d.ts +288 -5
- package/dist/server.js +29145 -28950
- package/package.json +7 -9
- package/dist/config/index.d.ts +0 -10
- package/dist/config/mutators.d.ts +0 -4
- package/dist/config/timeback.d.ts +0 -10
- package/dist/config/types.d.ts +0 -23
- package/dist/constants.d.ts +0 -171
- package/dist/database/index.d.ts +0 -6
- package/dist/database/path-manager.d.ts +0 -26
- package/dist/database/seed.d.ts +0 -34
- package/dist/lib/auth.d.ts +0 -10
- package/dist/lib/error-handler.d.ts +0 -22
- package/dist/lib/realtime.d.ts +0 -17
- package/dist/routes/achievements.d.ts +0 -3
- package/dist/routes/character.d.ts +0 -3
- package/dist/routes/currencies.d.ts +0 -3
- package/dist/routes/dev.d.ts +0 -3
- package/dist/routes/games.d.ts +0 -3
- package/dist/routes/health.d.ts +0 -2
- package/dist/routes/index.d.ts +0 -20
- package/dist/routes/inventory.d.ts +0 -3
- package/dist/routes/items.d.ts +0 -3
- package/dist/routes/leaderboard.d.ts +0 -3
- package/dist/routes/levels.d.ts +0 -3
- package/dist/routes/lti.d.ts +0 -3
- package/dist/routes/manifest.d.ts +0 -3
- package/dist/routes/maps.d.ts +0 -4
- package/dist/routes/notifications.d.ts +0 -3
- package/dist/routes/realtime.d.ts +0 -3
- package/dist/routes/shop-listings.d.ts +0 -3
- package/dist/routes/shop.d.ts +0 -3
- package/dist/routes/sprite.d.ts +0 -3
- package/dist/routes/timeback.d.ts +0 -3
- package/dist/routes/users.d.ts +0 -3
- package/dist/types.d.ts +0 -29
- /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
|
|
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["
|
|
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** |
|
|
168
|
-
| **Mock Data** | Automatically seeds with
|
|
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
|
|
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
|
|
342
|
-
| :----------------- |
|
|
343
|
-
| **Data** | Mock, temporary
|
|
344
|
-
| **Authentication** | Mock tokens
|
|
345
|
-
| **Persistence** |
|
|
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