@playcademy/sandbox 0.3.6 → 0.3.8
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/dist/cli.js +87795 -154254
- package/dist/config.d.ts +1 -1
- package/dist/config.js +34 -20
- package/dist/constants.d.ts +13 -3
- package/dist/constants.js +411 -186
- package/dist/infrastructure/api/context.d.ts +38 -0
- package/dist/infrastructure/api/index.d.ts +54 -0
- package/dist/infrastructure/api/providers/auth.provider.d.ts +52 -0
- package/dist/infrastructure/api/providers/cache.provider.d.ts +18 -0
- package/dist/infrastructure/api/providers/index.d.ts +11 -0
- package/dist/infrastructure/api/providers/secrets.provider.d.ts +19 -0
- package/dist/infrastructure/api/providers/storage.provider.d.ts +19 -0
- package/dist/mocks/timeback.d.ts +7 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +86344 -152735
- package/package.json +5 -2
package/dist/constants.js
CHANGED
|
@@ -28,197 +28,420 @@ 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
|
+
// ../constants/src/auth.ts
|
|
123
|
+
var AUTH_PROVIDER_IDS;
|
|
124
|
+
var init_auth = __esm(() => {
|
|
125
|
+
AUTH_PROVIDER_IDS = {
|
|
126
|
+
TIMEBACK: "timeback",
|
|
127
|
+
TIMEBACK_LTI: "timeback-lti"
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// ../constants/src/typescript.ts
|
|
132
|
+
var TSC_PACKAGE = "@typescript/native-preview", USE_NATIVE_TSC;
|
|
133
|
+
var init_typescript = __esm(() => {
|
|
134
|
+
USE_NATIVE_TSC = TSC_PACKAGE.includes("native-preview");
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// ../constants/src/character.ts
|
|
138
|
+
var ACCESSORY_SLOTS, VALID_SLOT_TYPES;
|
|
139
|
+
var init_character = __esm(() => {
|
|
140
|
+
ACCESSORY_SLOTS = [
|
|
141
|
+
{ type: "head", unlockLevel: 1, displayName: "Head", maxItems: 1 },
|
|
142
|
+
{ type: "face", unlockLevel: 2, displayName: "Face", maxItems: 1 },
|
|
143
|
+
{ type: "hands", unlockLevel: 10, displayName: "Hands", maxItems: 1 },
|
|
144
|
+
{ type: "back", unlockLevel: 15, displayName: "Back", maxItems: 1 }
|
|
145
|
+
];
|
|
146
|
+
VALID_SLOT_TYPES = ["head", "face", "hands", "back"];
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// ../constants/src/domains.ts
|
|
150
|
+
var init_domains = () => {};
|
|
151
|
+
|
|
152
|
+
// ../constants/src/env-vars.ts
|
|
153
|
+
var init_env_vars = () => {};
|
|
154
|
+
|
|
155
|
+
// ../constants/src/overworld.ts
|
|
156
|
+
var MAX_LEVEL = 100, ITEM_SLUGS, CURRENCIES, CURRENCY_SYMBOLS, BADGES, TOAST_DURATION, CORE_GAME_UUIDS;
|
|
157
|
+
var init_overworld = __esm(() => {
|
|
158
|
+
ITEM_SLUGS = {
|
|
159
|
+
PLAYCADEMY_CREDITS: "PLAYCADEMY_CREDITS",
|
|
160
|
+
PLAYCADEMY_XP: "PLAYCADEMY_XP",
|
|
161
|
+
FOUNDING_MEMBER_BADGE: "FOUNDING_MEMBER_BADGE",
|
|
162
|
+
EARLY_ADOPTER_BADGE: "EARLY_ADOPTER_BADGE",
|
|
163
|
+
FIRST_GAME_BADGE: "FIRST_GAME_BADGE",
|
|
164
|
+
COMMON_SWORD: "COMMON_SWORD",
|
|
165
|
+
SMALL_HEALTH_POTION: "SMALL_HEALTH_POTION",
|
|
166
|
+
SMALL_BACKPACK: "SMALL_BACKPACK",
|
|
167
|
+
LAVA_LAMP: "LAVA_LAMP",
|
|
168
|
+
BOOMBOX: "BOOMBOX",
|
|
169
|
+
CABIN_BED: "CABIN_BED"
|
|
170
|
+
};
|
|
171
|
+
CURRENCIES = {
|
|
172
|
+
PRIMARY: ITEM_SLUGS.PLAYCADEMY_CREDITS,
|
|
173
|
+
XP: ITEM_SLUGS.PLAYCADEMY_XP
|
|
174
|
+
};
|
|
175
|
+
CURRENCY_SYMBOLS = {
|
|
176
|
+
PLAYCADEMY_CREDITS: "PC",
|
|
177
|
+
PLAYCADEMY_XP: "XP",
|
|
178
|
+
DEFAULT: "¤"
|
|
179
|
+
};
|
|
180
|
+
BADGES = {
|
|
181
|
+
FOUNDING_MEMBER: ITEM_SLUGS.FOUNDING_MEMBER_BADGE,
|
|
182
|
+
EARLY_ADOPTER: ITEM_SLUGS.EARLY_ADOPTER_BADGE,
|
|
183
|
+
FIRST_GAME: ITEM_SLUGS.FIRST_GAME_BADGE
|
|
184
|
+
};
|
|
185
|
+
TOAST_DURATION = {
|
|
186
|
+
SHORT: 3000,
|
|
187
|
+
STANDARD: 5000,
|
|
188
|
+
LONG: 8000,
|
|
189
|
+
ERROR: 4000
|
|
190
|
+
};
|
|
191
|
+
CORE_GAME_UUIDS = {
|
|
192
|
+
PLAYGROUND: "00000000-0000-0000-0000-000000000001"
|
|
193
|
+
};
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// ../constants/src/system.ts
|
|
197
|
+
var PLATFORM_TIMEZONE = "America/New_York";
|
|
198
|
+
|
|
199
|
+
// ../constants/src/timeback.ts
|
|
200
|
+
var TIMEBACK_ORG_SOURCED_ID = "PLAYCADEMY";
|
|
201
|
+
var init_timeback = () => {};
|
|
202
|
+
|
|
203
|
+
// ../constants/src/workers.ts
|
|
204
|
+
var WORKER_NAMING;
|
|
205
|
+
var init_workers = __esm(() => {
|
|
206
|
+
WORKER_NAMING = {
|
|
207
|
+
STAGING_PREFIX: "staging-",
|
|
208
|
+
STAGING_SUFFIX: "-staging"
|
|
209
|
+
};
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
// ../constants/src/index.ts
|
|
213
|
+
var init_src = __esm(() => {
|
|
214
|
+
init_achievements();
|
|
215
|
+
init_auth();
|
|
216
|
+
init_typescript();
|
|
217
|
+
init_character();
|
|
218
|
+
init_domains();
|
|
219
|
+
init_env_vars();
|
|
220
|
+
init_overworld();
|
|
221
|
+
init_timeback();
|
|
222
|
+
init_workers();
|
|
223
|
+
});
|
|
224
|
+
|
|
31
225
|
// src/constants/demo-users.ts
|
|
32
|
-
var now
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
226
|
+
var now, DEMO_USER_IDS, DEMO_USERS, DEMO_USER;
|
|
227
|
+
var init_demo_users = __esm(() => {
|
|
228
|
+
now = new Date;
|
|
229
|
+
DEMO_USER_IDS = {
|
|
230
|
+
player: "00000000-0000-0000-0000-000000000001",
|
|
231
|
+
developer: "00000000-0000-0000-0000-000000000002",
|
|
232
|
+
admin: "00000000-0000-0000-0000-000000000003",
|
|
233
|
+
pendingDeveloper: "00000000-0000-0000-0000-000000000004",
|
|
234
|
+
unverifiedPlayer: "00000000-0000-0000-0000-000000000005"
|
|
235
|
+
};
|
|
236
|
+
DEMO_USERS = {
|
|
237
|
+
admin: {
|
|
238
|
+
id: DEMO_USER_IDS.admin,
|
|
239
|
+
name: "Admin User",
|
|
240
|
+
username: "admin_user",
|
|
241
|
+
email: "admin@playcademy.com",
|
|
242
|
+
emailVerified: true,
|
|
243
|
+
image: null,
|
|
244
|
+
role: "admin",
|
|
245
|
+
developerStatus: "approved",
|
|
246
|
+
createdAt: now,
|
|
247
|
+
updatedAt: now
|
|
248
|
+
},
|
|
249
|
+
player: {
|
|
250
|
+
id: DEMO_USER_IDS.player,
|
|
251
|
+
name: "Player User",
|
|
252
|
+
username: "player_user",
|
|
253
|
+
email: "player@playcademy.com",
|
|
254
|
+
emailVerified: true,
|
|
255
|
+
image: null,
|
|
256
|
+
role: "player",
|
|
257
|
+
developerStatus: "none",
|
|
258
|
+
createdAt: now,
|
|
259
|
+
updatedAt: now
|
|
260
|
+
},
|
|
261
|
+
developer: {
|
|
262
|
+
id: DEMO_USER_IDS.developer,
|
|
263
|
+
name: "Developer User",
|
|
264
|
+
username: "developer_user",
|
|
265
|
+
email: "developer@playcademy.com",
|
|
266
|
+
emailVerified: true,
|
|
267
|
+
image: null,
|
|
268
|
+
role: "developer",
|
|
269
|
+
developerStatus: "approved",
|
|
270
|
+
createdAt: now,
|
|
271
|
+
updatedAt: now
|
|
272
|
+
},
|
|
273
|
+
pendingDeveloper: {
|
|
274
|
+
id: DEMO_USER_IDS.pendingDeveloper,
|
|
275
|
+
name: "Pending Developer",
|
|
276
|
+
username: "pending_dev",
|
|
277
|
+
email: "pending@playcademy.com",
|
|
278
|
+
emailVerified: true,
|
|
279
|
+
image: null,
|
|
280
|
+
role: "developer",
|
|
281
|
+
developerStatus: "pending",
|
|
282
|
+
createdAt: now,
|
|
283
|
+
updatedAt: now
|
|
284
|
+
},
|
|
285
|
+
unverifiedPlayer: {
|
|
286
|
+
id: DEMO_USER_IDS.unverifiedPlayer,
|
|
287
|
+
name: "Unverified Player",
|
|
288
|
+
username: "unverified_player",
|
|
289
|
+
email: "unverified@playcademy.com",
|
|
290
|
+
emailVerified: false,
|
|
291
|
+
image: null,
|
|
292
|
+
role: "player",
|
|
293
|
+
developerStatus: "none",
|
|
294
|
+
createdAt: now,
|
|
295
|
+
updatedAt: now
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
DEMO_USER = DEMO_USERS.player;
|
|
299
|
+
});
|
|
300
|
+
|
|
103
301
|
// src/constants/demo-tokens.ts
|
|
104
|
-
var DEMO_TOKENS =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
302
|
+
var DEMO_TOKENS, SANDBOX_TOKENS, DEMO_TOKEN = "sandbox-demo-token", MOCK_GAME_ID = "mock-game-id-from-template";
|
|
303
|
+
var init_demo_tokens = __esm(() => {
|
|
304
|
+
init_demo_users();
|
|
305
|
+
DEMO_TOKENS = {
|
|
306
|
+
"sandbox-demo-token": DEMO_USERS.player,
|
|
307
|
+
"sandbox-admin-token": DEMO_USERS.admin,
|
|
308
|
+
"sandbox-player-token": DEMO_USERS.player,
|
|
309
|
+
"sandbox-developer-token": DEMO_USERS.developer,
|
|
310
|
+
"sandbox-pending-dev-token": DEMO_USERS.pendingDeveloper,
|
|
311
|
+
"sandbox-unverified-token": DEMO_USERS.unverifiedPlayer,
|
|
312
|
+
"mock-game-token-for-local-dev": DEMO_USERS.player
|
|
313
|
+
};
|
|
314
|
+
SANDBOX_TOKENS = {
|
|
315
|
+
player: "sandbox-player-token",
|
|
316
|
+
developer: "sandbox-developer-token",
|
|
317
|
+
admin: "sandbox-admin-token",
|
|
318
|
+
pendingDeveloper: "sandbox-pending-dev-token",
|
|
319
|
+
unverified: "sandbox-unverified-token"
|
|
320
|
+
};
|
|
321
|
+
});
|
|
322
|
+
|
|
115
323
|
// src/constants/demo-items.ts
|
|
116
|
-
var DEMO_ITEM_IDS
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
324
|
+
var DEMO_ITEM_IDS, PLAYCADEMY_CREDITS_ID, SAMPLE_ITEMS, SAMPLE_INVENTORY;
|
|
325
|
+
var init_demo_items = __esm(() => {
|
|
326
|
+
init_demo_users();
|
|
327
|
+
DEMO_ITEM_IDS = {
|
|
328
|
+
playcademyCredits: "10000000-0000-0000-0000-000000000001",
|
|
329
|
+
foundingMemberBadge: "10000000-0000-0000-0000-000000000002",
|
|
330
|
+
earlyAdopterBadge: "10000000-0000-0000-0000-000000000003",
|
|
331
|
+
firstGameBadge: "10000000-0000-0000-0000-000000000004",
|
|
332
|
+
commonSword: "10000000-0000-0000-0000-000000000005",
|
|
333
|
+
smallHealthPotion: "10000000-0000-0000-0000-000000000006",
|
|
334
|
+
smallBackpack: "10000000-0000-0000-0000-000000000007"
|
|
335
|
+
};
|
|
336
|
+
PLAYCADEMY_CREDITS_ID = DEMO_ITEM_IDS.playcademyCredits;
|
|
337
|
+
SAMPLE_ITEMS = [
|
|
338
|
+
{
|
|
339
|
+
id: PLAYCADEMY_CREDITS_ID,
|
|
340
|
+
slug: "PLAYCADEMY_CREDITS",
|
|
341
|
+
gameId: null,
|
|
342
|
+
displayName: "PLAYCADEMY credits",
|
|
343
|
+
description: "The main currency used across PLAYCADEMY.",
|
|
344
|
+
type: "currency",
|
|
345
|
+
isPlaceable: false,
|
|
346
|
+
imageUrl: "http://playcademy-sandbox.local/playcademy-credit.png",
|
|
347
|
+
metadata: {
|
|
348
|
+
rarity: "common"
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
id: DEMO_ITEM_IDS.foundingMemberBadge,
|
|
353
|
+
slug: "FOUNDING_MEMBER_BADGE",
|
|
354
|
+
gameId: null,
|
|
355
|
+
displayName: "Founding Member Badge",
|
|
356
|
+
description: "Reserved for founding core team of the PLAYCADEMY platform.",
|
|
357
|
+
type: "badge",
|
|
358
|
+
isPlaceable: false,
|
|
359
|
+
imageUrl: null,
|
|
360
|
+
metadata: {
|
|
361
|
+
rarity: "legendary"
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
id: DEMO_ITEM_IDS.earlyAdopterBadge,
|
|
366
|
+
slug: "EARLY_ADOPTER_BADGE",
|
|
367
|
+
gameId: null,
|
|
368
|
+
displayName: "Early Adopter Badge",
|
|
369
|
+
description: "Awarded to users who joined during the beta phase.",
|
|
370
|
+
type: "badge",
|
|
371
|
+
isPlaceable: false,
|
|
372
|
+
imageUrl: null,
|
|
373
|
+
metadata: {
|
|
374
|
+
rarity: "epic"
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
id: DEMO_ITEM_IDS.firstGameBadge,
|
|
379
|
+
slug: "FIRST_GAME_BADGE",
|
|
380
|
+
gameId: null,
|
|
381
|
+
displayName: "First Game Played",
|
|
382
|
+
description: "Awarded for playing your first game in the Playcademy platform.",
|
|
383
|
+
type: "badge",
|
|
384
|
+
isPlaceable: false,
|
|
385
|
+
imageUrl: "http://playcademy-sandbox.local/first-game-badge.png",
|
|
386
|
+
metadata: {
|
|
387
|
+
rarity: "uncommon"
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
id: DEMO_ITEM_IDS.commonSword,
|
|
392
|
+
slug: "COMMON_SWORD",
|
|
393
|
+
gameId: null,
|
|
394
|
+
displayName: "Common Sword",
|
|
395
|
+
description: "A basic sword, good for beginners.",
|
|
396
|
+
type: "unlock",
|
|
397
|
+
isPlaceable: false,
|
|
398
|
+
imageUrl: "http://playcademy-sandbox.local/common-sword.png",
|
|
399
|
+
metadata: undefined
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
id: DEMO_ITEM_IDS.smallHealthPotion,
|
|
403
|
+
slug: "SMALL_HEALTH_POTION",
|
|
404
|
+
gameId: null,
|
|
405
|
+
displayName: "Small Health Potion",
|
|
406
|
+
description: "Restores a small amount of health.",
|
|
407
|
+
type: "other",
|
|
408
|
+
isPlaceable: false,
|
|
409
|
+
imageUrl: "http://playcademy-sandbox.local/small-health-potion.png",
|
|
410
|
+
metadata: undefined
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
id: DEMO_ITEM_IDS.smallBackpack,
|
|
414
|
+
slug: "SMALL_BACKPACK",
|
|
415
|
+
gameId: null,
|
|
416
|
+
displayName: "Small Backpack",
|
|
417
|
+
description: "Increases your inventory capacity by 5 slots.",
|
|
418
|
+
type: "upgrade",
|
|
419
|
+
isPlaceable: false,
|
|
420
|
+
imageUrl: "http://playcademy-sandbox.local/small-backpack.png",
|
|
421
|
+
metadata: undefined
|
|
164
422
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
type: "badge",
|
|
173
|
-
isPlaceable: false,
|
|
174
|
-
imageUrl: "http://playcademy-sandbox.local/first-game-badge.png",
|
|
175
|
-
metadata: {
|
|
176
|
-
rarity: "uncommon"
|
|
423
|
+
];
|
|
424
|
+
SAMPLE_INVENTORY = [
|
|
425
|
+
{
|
|
426
|
+
id: "20000000-0000-0000-0000-000000000001",
|
|
427
|
+
userId: DEMO_USER.id,
|
|
428
|
+
itemId: PLAYCADEMY_CREDITS_ID,
|
|
429
|
+
quantity: 1000
|
|
177
430
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
{
|
|
191
|
-
id: DEMO_ITEM_IDS.smallHealthPotion,
|
|
192
|
-
slug: "SMALL_HEALTH_POTION",
|
|
193
|
-
gameId: null,
|
|
194
|
-
displayName: "Small Health Potion",
|
|
195
|
-
description: "Restores a small amount of health.",
|
|
196
|
-
type: "other",
|
|
197
|
-
isPlaceable: false,
|
|
198
|
-
imageUrl: "http://playcademy-sandbox.local/small-health-potion.png",
|
|
199
|
-
metadata: undefined
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
id: DEMO_ITEM_IDS.smallBackpack,
|
|
203
|
-
slug: "SMALL_BACKPACK",
|
|
204
|
-
gameId: null,
|
|
205
|
-
displayName: "Small Backpack",
|
|
206
|
-
description: "Increases your inventory capacity by 5 slots.",
|
|
207
|
-
type: "upgrade",
|
|
208
|
-
isPlaceable: false,
|
|
209
|
-
imageUrl: "http://playcademy-sandbox.local/small-backpack.png",
|
|
210
|
-
metadata: undefined
|
|
211
|
-
}
|
|
212
|
-
];
|
|
213
|
-
var SAMPLE_INVENTORY = [
|
|
214
|
-
{
|
|
215
|
-
id: "20000000-0000-0000-0000-000000000001",
|
|
216
|
-
userId: DEMO_USER.id,
|
|
217
|
-
itemId: PLAYCADEMY_CREDITS_ID,
|
|
218
|
-
quantity: 1000
|
|
219
|
-
}
|
|
220
|
-
];
|
|
431
|
+
];
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
// src/constants/index.ts
|
|
435
|
+
var init_constants = __esm(() => {
|
|
436
|
+
init_src();
|
|
437
|
+
init_demo_users();
|
|
438
|
+
init_demo_tokens();
|
|
439
|
+
init_demo_items();
|
|
440
|
+
});
|
|
441
|
+
init_constants();
|
|
442
|
+
|
|
221
443
|
export {
|
|
444
|
+
SANDBOX_TOKENS,
|
|
222
445
|
SAMPLE_ITEMS,
|
|
223
446
|
SAMPLE_INVENTORY,
|
|
224
447
|
PLAYCADEMY_CREDITS_ID,
|
|
@@ -227,5 +450,7 @@ export {
|
|
|
227
450
|
DEMO_USERS,
|
|
228
451
|
DEMO_USER,
|
|
229
452
|
DEMO_TOKENS,
|
|
230
|
-
DEMO_TOKEN
|
|
453
|
+
DEMO_TOKEN,
|
|
454
|
+
ACHIEVEMENT_IDS,
|
|
455
|
+
ACHIEVEMENT_DEFINITIONS
|
|
231
456
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sandbox API Context Setup
|
|
3
|
+
*
|
|
4
|
+
* Wires up the ServiceContext for api-core in the sandbox environment.
|
|
5
|
+
* Uses in-memory providers and simplified configuration.
|
|
6
|
+
*
|
|
7
|
+
* @module infrastructure/api/context
|
|
8
|
+
*/
|
|
9
|
+
import type { ApiConfig } from '@playcademy/api-core/config';
|
|
10
|
+
import type { ServiceContext } from '@playcademy/api-core/types';
|
|
11
|
+
import type { Database } from '@playcademy/data/types';
|
|
12
|
+
export interface SandboxContextOptions {
|
|
13
|
+
/** Database instance (from PGlite) */
|
|
14
|
+
db: Database;
|
|
15
|
+
/** Port the sandbox server runs on */
|
|
16
|
+
port?: number;
|
|
17
|
+
/** Additional config overrides */
|
|
18
|
+
config?: Partial<ApiConfig>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Create the ServiceContext for sandbox.
|
|
22
|
+
*
|
|
23
|
+
* The context is created once and reused across requests.
|
|
24
|
+
* Call `resetSandboxContext()` to force recreation (useful for testing).
|
|
25
|
+
*
|
|
26
|
+
* @param options - Configuration options including database instance.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createSandboxContext(options: SandboxContextOptions): ServiceContext;
|
|
29
|
+
/**
|
|
30
|
+
* Get the cached ServiceContext.
|
|
31
|
+
*
|
|
32
|
+
* @throws Error if context hasn't been created yet.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getSandboxContext(): ServiceContext;
|
|
35
|
+
/**
|
|
36
|
+
* Reset the cached context (for testing or hot reload).
|
|
37
|
+
*/
|
|
38
|
+
export declare function resetSandboxContext(): void;
|