@playcademy/sandbox 0.3.19-beta.5 → 0.3.19-beta.6
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 +2 -2
- package/dist/cli.js +693 -5702
- package/dist/constants.d.ts +1 -17
- package/dist/constants.js +10 -278
- package/dist/infrastructure/api/index.d.ts +6 -6
- package/dist/server.d.ts +1 -1
- package/dist/server.js +686 -5695
- package/package.json +2 -4
package/dist/constants.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export { ACHIEVEMENT_DEFINITIONS, ACHIEVEMENT_IDS } from '@playcademy/constants';
|
|
2
|
-
import { ItemRow } from '@playcademy/data/types';
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
2
|
* Demo user data for sandbox testing
|
|
6
3
|
*/
|
|
@@ -227,17 +224,4 @@ declare const SANDBOX_TOKENS: {
|
|
|
227
224
|
declare const DEMO_TOKEN = "sandbox-demo-token";
|
|
228
225
|
declare const MOCK_GAME_ID = "mock-game-id-from-template";
|
|
229
226
|
|
|
230
|
-
|
|
231
|
-
* Demo items and inventory data for sandbox testing
|
|
232
|
-
*/
|
|
233
|
-
|
|
234
|
-
declare const PLAYCADEMY_CREDITS_ID: string;
|
|
235
|
-
declare const SAMPLE_ITEMS: Omit<ItemRow, 'createdAt'>[];
|
|
236
|
-
declare const SAMPLE_INVENTORY: {
|
|
237
|
-
id: string;
|
|
238
|
-
userId: "00000000-0000-0000-0000-000000000001";
|
|
239
|
-
itemId: string;
|
|
240
|
-
quantity: number;
|
|
241
|
-
}[];
|
|
242
|
-
|
|
243
|
-
export { DEMO_TOKEN, DEMO_TOKENS, DEMO_USER, DEMO_USERS, DEMO_USER_IDS, MOCK_GAME_ID, PLAYCADEMY_CREDITS_ID, SAMPLE_INVENTORY, SAMPLE_ITEMS, SANDBOX_TOKENS };
|
|
227
|
+
export { DEMO_TOKEN, DEMO_TOKENS, DEMO_USER, DEMO_USERS, DEMO_USER_IDS, MOCK_GAME_ID, SANDBOX_TOKENS };
|
package/dist/constants.js
CHANGED
|
@@ -28,97 +28,6 @@ var __export = (target, all) => {
|
|
|
28
28
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
29
29
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
30
30
|
|
|
31
|
-
// ../constants/src/achievements.ts
|
|
32
|
-
var ACHIEVEMENT_IDS, ACHIEVEMENT_DEFINITIONS;
|
|
33
|
-
var init_achievements = __esm(() => {
|
|
34
|
-
ACHIEVEMENT_IDS = {
|
|
35
|
-
PLAY_ANY_GAME_DAILY: "play_any_game_daily",
|
|
36
|
-
DAILY_CHEST_OPEN: "daily_chest_open",
|
|
37
|
-
LEADERBOARD_TOP3_DAILY: "leaderboard_top3_daily",
|
|
38
|
-
LEADERBOARD_TOP3_WEEKLY: "leaderboard_top3_weekly",
|
|
39
|
-
FIRST_SCORE_ANY_GAME: "first_score_any_game",
|
|
40
|
-
PERSONAL_BEST_ANY_GAME: "personal_best_any_game"
|
|
41
|
-
};
|
|
42
|
-
ACHIEVEMENT_DEFINITIONS = [
|
|
43
|
-
{
|
|
44
|
-
id: ACHIEVEMENT_IDS.PLAY_ANY_GAME_DAILY,
|
|
45
|
-
title: "Play any game",
|
|
46
|
-
description: "Play any arcade game for at least 60 seconds in a single session.",
|
|
47
|
-
scope: "daily",
|
|
48
|
-
rewardCredits: 10,
|
|
49
|
-
limit: 1,
|
|
50
|
-
completionType: "time_played_session",
|
|
51
|
-
completionConfig: { minSeconds: 60 },
|
|
52
|
-
target: { anyArcadeGame: true },
|
|
53
|
-
active: true
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
id: ACHIEVEMENT_IDS.DAILY_CHEST_OPEN,
|
|
57
|
-
title: "Opened the daily chest",
|
|
58
|
-
description: "Find the chest on the map and open it to claim your reward.",
|
|
59
|
-
scope: "daily",
|
|
60
|
-
rewardCredits: 10,
|
|
61
|
-
limit: 1,
|
|
62
|
-
completionType: "interaction",
|
|
63
|
-
completionConfig: { triggerId: "bunny_chest" },
|
|
64
|
-
target: { map: "arcade" },
|
|
65
|
-
active: true
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
id: ACHIEVEMENT_IDS.LEADERBOARD_TOP3_DAILY,
|
|
69
|
-
title: "Daily Champion",
|
|
70
|
-
description: "Finish in the top 3 of any game leaderboard for the day.",
|
|
71
|
-
scope: "daily",
|
|
72
|
-
rewardCredits: 25,
|
|
73
|
-
limit: 1,
|
|
74
|
-
completionType: "leaderboard_rank",
|
|
75
|
-
completionConfig: {
|
|
76
|
-
rankRewards: [50, 30, 15]
|
|
77
|
-
},
|
|
78
|
-
target: { anyArcadeGame: true },
|
|
79
|
-
active: true
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
id: ACHIEVEMENT_IDS.LEADERBOARD_TOP3_WEEKLY,
|
|
83
|
-
title: "Weekly Legend",
|
|
84
|
-
description: "Finish in the top 3 of any game leaderboard for the week.",
|
|
85
|
-
scope: "weekly",
|
|
86
|
-
rewardCredits: 50,
|
|
87
|
-
limit: 1,
|
|
88
|
-
completionType: "leaderboard_rank",
|
|
89
|
-
completionConfig: {
|
|
90
|
-
rankRewards: [100, 60, 30]
|
|
91
|
-
},
|
|
92
|
-
target: { anyArcadeGame: true },
|
|
93
|
-
active: true
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
id: ACHIEVEMENT_IDS.FIRST_SCORE_ANY_GAME,
|
|
97
|
-
title: "First Score",
|
|
98
|
-
description: "Submit your first score in any arcade game.",
|
|
99
|
-
scope: "game",
|
|
100
|
-
rewardCredits: 5,
|
|
101
|
-
limit: 1,
|
|
102
|
-
completionType: "first_score",
|
|
103
|
-
completionConfig: {},
|
|
104
|
-
target: { anyArcadeGame: true },
|
|
105
|
-
active: true
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
id: ACHIEVEMENT_IDS.PERSONAL_BEST_ANY_GAME,
|
|
109
|
-
title: "Personal Best",
|
|
110
|
-
description: "Beat your personal best score in any arcade game.",
|
|
111
|
-
scope: "daily",
|
|
112
|
-
rewardCredits: 5,
|
|
113
|
-
limit: 3,
|
|
114
|
-
completionType: "personal_best",
|
|
115
|
-
completionConfig: {},
|
|
116
|
-
target: { anyArcadeGame: true },
|
|
117
|
-
active: true
|
|
118
|
-
}
|
|
119
|
-
];
|
|
120
|
-
});
|
|
121
|
-
|
|
122
31
|
// ../constants/src/auth.ts
|
|
123
32
|
var AUTH_PROVIDER_IDS, DEMO_DISPLAY_NAME_PLACEHOLDER = "Demo Player";
|
|
124
33
|
var init_auth = __esm(() => {
|
|
@@ -129,30 +38,7 @@ var init_auth = __esm(() => {
|
|
|
129
38
|
});
|
|
130
39
|
|
|
131
40
|
// ../constants/src/typescript.ts
|
|
132
|
-
var
|
|
133
|
-
var init_typescript = __esm(() => {
|
|
134
|
-
TypeScriptPackages = {
|
|
135
|
-
tsc: "tsc",
|
|
136
|
-
nativePreview: "@typescript/native-preview",
|
|
137
|
-
nativePreviewBeta: "@typescript/native-preview@beta"
|
|
138
|
-
};
|
|
139
|
-
TYPESCRIPT_RUNNER = {
|
|
140
|
-
package: TypeScriptPackages.nativePreviewBeta,
|
|
141
|
-
bin: "tsgo"
|
|
142
|
-
};
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
// ../constants/src/character.ts
|
|
146
|
-
var ACCESSORY_SLOTS, VALID_SLOT_TYPES;
|
|
147
|
-
var init_character = __esm(() => {
|
|
148
|
-
ACCESSORY_SLOTS = [
|
|
149
|
-
{ type: "head", unlockLevel: 1, displayName: "Head", maxItems: 1 },
|
|
150
|
-
{ type: "face", unlockLevel: 2, displayName: "Face", maxItems: 1 },
|
|
151
|
-
{ type: "hands", unlockLevel: 10, displayName: "Hands", maxItems: 1 },
|
|
152
|
-
{ type: "back", unlockLevel: 15, displayName: "Back", maxItems: 1 }
|
|
153
|
-
];
|
|
154
|
-
VALID_SLOT_TYPES = ["head", "face", "hands", "back"];
|
|
155
|
-
});
|
|
41
|
+
var init_typescript = () => {};
|
|
156
42
|
|
|
157
43
|
// ../constants/src/domains.ts
|
|
158
44
|
var PLAYCADEMY_BASE_URLS, GAME_WORKER_DOMAINS;
|
|
@@ -180,45 +66,11 @@ var init_game = __esm(() => {
|
|
|
180
66
|
};
|
|
181
67
|
});
|
|
182
68
|
|
|
183
|
-
// ../constants/src/
|
|
184
|
-
var
|
|
185
|
-
var
|
|
186
|
-
ITEM_SLUGS = {
|
|
187
|
-
PLAYCADEMY_CREDITS: "PLAYCADEMY_CREDITS",
|
|
188
|
-
PLAYCADEMY_XP: "PLAYCADEMY_XP",
|
|
189
|
-
FOUNDING_MEMBER_BADGE: "FOUNDING_MEMBER_BADGE",
|
|
190
|
-
EARLY_ADOPTER_BADGE: "EARLY_ADOPTER_BADGE",
|
|
191
|
-
FIRST_GAME_BADGE: "FIRST_GAME_BADGE",
|
|
192
|
-
COMMON_SWORD: "COMMON_SWORD",
|
|
193
|
-
SMALL_HEALTH_POTION: "SMALL_HEALTH_POTION",
|
|
194
|
-
SMALL_BACKPACK: "SMALL_BACKPACK",
|
|
195
|
-
LAVA_LAMP: "LAVA_LAMP",
|
|
196
|
-
BOOMBOX: "BOOMBOX",
|
|
197
|
-
CABIN_BED: "CABIN_BED"
|
|
198
|
-
};
|
|
199
|
-
CURRENCIES = {
|
|
200
|
-
PRIMARY: ITEM_SLUGS.PLAYCADEMY_CREDITS,
|
|
201
|
-
XP: ITEM_SLUGS.PLAYCADEMY_XP
|
|
202
|
-
};
|
|
203
|
-
CURRENCY_SYMBOLS = {
|
|
204
|
-
PLAYCADEMY_CREDITS: "PC",
|
|
205
|
-
PLAYCADEMY_XP: "XP",
|
|
206
|
-
DEFAULT: "¤"
|
|
207
|
-
};
|
|
208
|
-
BADGES = {
|
|
209
|
-
FOUNDING_MEMBER: ITEM_SLUGS.FOUNDING_MEMBER_BADGE,
|
|
210
|
-
EARLY_ADOPTER: ITEM_SLUGS.EARLY_ADOPTER_BADGE,
|
|
211
|
-
FIRST_GAME: ITEM_SLUGS.FIRST_GAME_BADGE
|
|
212
|
-
};
|
|
213
|
-
TOAST_DURATION = {
|
|
214
|
-
SHORT: 3000,
|
|
215
|
-
STANDARD: 5000,
|
|
216
|
-
LONG: 8000,
|
|
217
|
-
ERROR: 4000
|
|
218
|
-
};
|
|
69
|
+
// ../constants/src/platform.ts
|
|
70
|
+
var CORE_GAME_UUIDS;
|
|
71
|
+
var init_platform = __esm(() => {
|
|
219
72
|
CORE_GAME_UUIDS = {
|
|
220
|
-
|
|
221
|
-
DEMO: "00000000-0000-0000-0000-000000000002"
|
|
73
|
+
DEMO: "00000000-0000-0000-0000-000000000001"
|
|
222
74
|
};
|
|
223
75
|
});
|
|
224
76
|
|
|
@@ -272,9 +124,9 @@ var init_timeback = __esm(() => {
|
|
|
272
124
|
};
|
|
273
125
|
});
|
|
274
126
|
|
|
275
|
-
// ../constants/src/
|
|
127
|
+
// ../constants/src/cloudflare.ts
|
|
276
128
|
var WORKER_NAMING, SECRETS_PREFIX = "secrets_", CLOUDFLARE_COMPATIBILITY_DATE = "2025-10-11";
|
|
277
|
-
var
|
|
129
|
+
var init_cloudflare = __esm(() => {
|
|
278
130
|
WORKER_NAMING = {
|
|
279
131
|
STAGING_PREFIX: "staging-",
|
|
280
132
|
STAGING_SUFFIX: "-staging",
|
|
@@ -284,16 +136,14 @@ var init_workers = __esm(() => {
|
|
|
284
136
|
|
|
285
137
|
// ../constants/src/index.ts
|
|
286
138
|
var init_src = __esm(() => {
|
|
287
|
-
init_achievements();
|
|
288
139
|
init_auth();
|
|
289
140
|
init_typescript();
|
|
290
|
-
init_character();
|
|
291
141
|
init_domains();
|
|
292
142
|
init_env_vars();
|
|
293
143
|
init_game();
|
|
294
|
-
|
|
144
|
+
init_platform();
|
|
295
145
|
init_timeback();
|
|
296
|
-
|
|
146
|
+
init_cloudflare();
|
|
297
147
|
});
|
|
298
148
|
|
|
299
149
|
// src/constants/demo-users.ts
|
|
@@ -412,137 +262,19 @@ var init_demo_tokens = __esm(() => {
|
|
|
412
262
|
};
|
|
413
263
|
});
|
|
414
264
|
|
|
415
|
-
// src/constants/demo-items.ts
|
|
416
|
-
var DEMO_ITEM_IDS, PLAYCADEMY_CREDITS_ID, SAMPLE_ITEMS, SAMPLE_INVENTORY;
|
|
417
|
-
var init_demo_items = __esm(() => {
|
|
418
|
-
init_demo_users();
|
|
419
|
-
DEMO_ITEM_IDS = {
|
|
420
|
-
playcademyCredits: "10000000-0000-0000-0000-000000000001",
|
|
421
|
-
foundingMemberBadge: "10000000-0000-0000-0000-000000000002",
|
|
422
|
-
earlyAdopterBadge: "10000000-0000-0000-0000-000000000003",
|
|
423
|
-
firstGameBadge: "10000000-0000-0000-0000-000000000004",
|
|
424
|
-
commonSword: "10000000-0000-0000-0000-000000000005",
|
|
425
|
-
smallHealthPotion: "10000000-0000-0000-0000-000000000006",
|
|
426
|
-
smallBackpack: "10000000-0000-0000-0000-000000000007"
|
|
427
|
-
};
|
|
428
|
-
PLAYCADEMY_CREDITS_ID = DEMO_ITEM_IDS.playcademyCredits;
|
|
429
|
-
SAMPLE_ITEMS = [
|
|
430
|
-
{
|
|
431
|
-
id: PLAYCADEMY_CREDITS_ID,
|
|
432
|
-
slug: "PLAYCADEMY_CREDITS",
|
|
433
|
-
gameId: null,
|
|
434
|
-
displayName: "PLAYCADEMY credits",
|
|
435
|
-
description: "The main currency used across PLAYCADEMY.",
|
|
436
|
-
type: "currency",
|
|
437
|
-
isPlaceable: false,
|
|
438
|
-
imageUrl: "http://playcademy-sandbox.local/playcademy-credit.png",
|
|
439
|
-
metadata: {
|
|
440
|
-
rarity: "common"
|
|
441
|
-
}
|
|
442
|
-
},
|
|
443
|
-
{
|
|
444
|
-
id: DEMO_ITEM_IDS.foundingMemberBadge,
|
|
445
|
-
slug: "FOUNDING_MEMBER_BADGE",
|
|
446
|
-
gameId: null,
|
|
447
|
-
displayName: "Founding Member Badge",
|
|
448
|
-
description: "Reserved for founding core team of the PLAYCADEMY platform.",
|
|
449
|
-
type: "badge",
|
|
450
|
-
isPlaceable: false,
|
|
451
|
-
imageUrl: null,
|
|
452
|
-
metadata: {
|
|
453
|
-
rarity: "legendary"
|
|
454
|
-
}
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
id: DEMO_ITEM_IDS.earlyAdopterBadge,
|
|
458
|
-
slug: "EARLY_ADOPTER_BADGE",
|
|
459
|
-
gameId: null,
|
|
460
|
-
displayName: "Early Adopter Badge",
|
|
461
|
-
description: "Awarded to users who joined during the beta phase.",
|
|
462
|
-
type: "badge",
|
|
463
|
-
isPlaceable: false,
|
|
464
|
-
imageUrl: null,
|
|
465
|
-
metadata: {
|
|
466
|
-
rarity: "epic"
|
|
467
|
-
}
|
|
468
|
-
},
|
|
469
|
-
{
|
|
470
|
-
id: DEMO_ITEM_IDS.firstGameBadge,
|
|
471
|
-
slug: "FIRST_GAME_BADGE",
|
|
472
|
-
gameId: null,
|
|
473
|
-
displayName: "First Game Played",
|
|
474
|
-
description: "Awarded for playing your first game in the Playcademy platform.",
|
|
475
|
-
type: "badge",
|
|
476
|
-
isPlaceable: false,
|
|
477
|
-
imageUrl: "http://playcademy-sandbox.local/first-game-badge.png",
|
|
478
|
-
metadata: {
|
|
479
|
-
rarity: "uncommon"
|
|
480
|
-
}
|
|
481
|
-
},
|
|
482
|
-
{
|
|
483
|
-
id: DEMO_ITEM_IDS.commonSword,
|
|
484
|
-
slug: "COMMON_SWORD",
|
|
485
|
-
gameId: null,
|
|
486
|
-
displayName: "Common Sword",
|
|
487
|
-
description: "A basic sword, good for beginners.",
|
|
488
|
-
type: "unlock",
|
|
489
|
-
isPlaceable: false,
|
|
490
|
-
imageUrl: "http://playcademy-sandbox.local/common-sword.png",
|
|
491
|
-
metadata: undefined
|
|
492
|
-
},
|
|
493
|
-
{
|
|
494
|
-
id: DEMO_ITEM_IDS.smallHealthPotion,
|
|
495
|
-
slug: "SMALL_HEALTH_POTION",
|
|
496
|
-
gameId: null,
|
|
497
|
-
displayName: "Small Health Potion",
|
|
498
|
-
description: "Restores a small amount of health.",
|
|
499
|
-
type: "other",
|
|
500
|
-
isPlaceable: false,
|
|
501
|
-
imageUrl: "http://playcademy-sandbox.local/small-health-potion.png",
|
|
502
|
-
metadata: undefined
|
|
503
|
-
},
|
|
504
|
-
{
|
|
505
|
-
id: DEMO_ITEM_IDS.smallBackpack,
|
|
506
|
-
slug: "SMALL_BACKPACK",
|
|
507
|
-
gameId: null,
|
|
508
|
-
displayName: "Small Backpack",
|
|
509
|
-
description: "Increases your inventory capacity by 5 slots.",
|
|
510
|
-
type: "upgrade",
|
|
511
|
-
isPlaceable: false,
|
|
512
|
-
imageUrl: "http://playcademy-sandbox.local/small-backpack.png",
|
|
513
|
-
metadata: undefined
|
|
514
|
-
}
|
|
515
|
-
];
|
|
516
|
-
SAMPLE_INVENTORY = [
|
|
517
|
-
{
|
|
518
|
-
id: "20000000-0000-0000-0000-000000000001",
|
|
519
|
-
userId: DEMO_USER.id,
|
|
520
|
-
itemId: PLAYCADEMY_CREDITS_ID,
|
|
521
|
-
quantity: 1000
|
|
522
|
-
}
|
|
523
|
-
];
|
|
524
|
-
});
|
|
525
|
-
|
|
526
265
|
// src/constants/index.ts
|
|
527
266
|
var init_constants = __esm(() => {
|
|
528
|
-
init_src();
|
|
529
267
|
init_demo_users();
|
|
530
268
|
init_demo_tokens();
|
|
531
|
-
init_demo_items();
|
|
532
269
|
});
|
|
533
270
|
init_constants();
|
|
534
271
|
|
|
535
272
|
export {
|
|
536
273
|
SANDBOX_TOKENS,
|
|
537
|
-
SAMPLE_ITEMS,
|
|
538
|
-
SAMPLE_INVENTORY,
|
|
539
|
-
PLAYCADEMY_CREDITS_ID,
|
|
540
274
|
MOCK_GAME_ID,
|
|
541
275
|
DEMO_USER_IDS,
|
|
542
276
|
DEMO_USERS,
|
|
543
277
|
DEMO_USER,
|
|
544
278
|
DEMO_TOKENS,
|
|
545
|
-
DEMO_TOKEN
|
|
546
|
-
ACHIEVEMENT_IDS,
|
|
547
|
-
ACHIEVEMENT_DEFINITIONS
|
|
279
|
+
DEMO_TOKEN
|
|
548
280
|
};
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* @example
|
|
7
7
|
* ```ts
|
|
8
8
|
* // In route setup
|
|
9
|
-
* import {
|
|
9
|
+
* import { leaderboard } from '@playcademy/api-core/controllers'
|
|
10
10
|
* import { handle } from '../infrastructure/api'
|
|
11
11
|
*
|
|
12
|
-
* router.get('/
|
|
13
|
-
* router.post('/
|
|
12
|
+
* router.get('/leaderboard', handle(leaderboard.getLeaderboard))
|
|
13
|
+
* router.post('/scores', handle(leaderboard.submitScore, { status: 201 }))
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
import { createHandlers } from '@playcademy/api-hono';
|
|
@@ -23,11 +23,11 @@ import { createHandlers } from '@playcademy/api-hono';
|
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
25
25
|
* ```ts
|
|
26
|
-
* import {
|
|
26
|
+
* import { leaderboard } from '@playcademy/api-core/controllers'
|
|
27
27
|
* import { handle } from '../infrastructure/api'
|
|
28
28
|
*
|
|
29
|
-
* router.get('/
|
|
30
|
-
* router.post('/
|
|
29
|
+
* router.get('/leaderboard', handle(leaderboard.getLeaderboard))
|
|
30
|
+
* router.post('/scores', handle(leaderboard.submitScore, { status: 201 }))
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
export declare function handle(...args: Parameters<ReturnType<typeof createHandlers>[0]>): ReturnType<ReturnType<typeof createHandlers>[0]>;
|
package/dist/server.d.ts
CHANGED
|
@@ -158,7 +158,7 @@ interface ServerOptions {
|
|
|
158
158
|
/**
|
|
159
159
|
* Seed the database with demo data on startup.
|
|
160
160
|
*
|
|
161
|
-
* Creates demo users, games,
|
|
161
|
+
* Creates demo users, games, and other platform data
|
|
162
162
|
* for testing. Recommended for development.
|
|
163
163
|
*
|
|
164
164
|
* @default true
|