@playcademy/vite-plugin 0.2.9 → 0.2.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 (2) hide show
  1. package/dist/index.js +25 -15
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -42380,7 +42380,7 @@ var package_default;
42380
42380
  var init_package = __esm(() => {
42381
42381
  package_default = {
42382
42382
  name: "@playcademy/sandbox",
42383
- version: "0.3.11",
42383
+ version: "0.3.12",
42384
42384
  description: "Local development server for Playcademy game development",
42385
42385
  type: "module",
42386
42386
  exports: {
@@ -42850,7 +42850,7 @@ function createHandle(buildContext) {
42850
42850
  try {
42851
42851
  const ctx = await buildContext(c);
42852
42852
  const result = await controller(ctx);
42853
- if (options?.status === 204 || result === undefined || result === null) {
42853
+ if (options?.status === 204 || result === undefined) {
42854
42854
  return new Response(null, { status: options?.status ?? 204 });
42855
42855
  }
42856
42856
  return new Response(JSON.stringify(result), {
@@ -55076,6 +55076,20 @@ class GameService {
55076
55076
  orderBy: [desc(games.createdAt)]
55077
55077
  });
55078
55078
  }
55079
+ async getSubjects() {
55080
+ const db2 = this.ctx.db;
55081
+ const integrations = await db2.query.gameTimebackIntegrations.findMany({
55082
+ columns: { gameId: true, subject: true },
55083
+ orderBy: [asc(gameTimebackIntegrations.createdAt)]
55084
+ });
55085
+ const subjectMap = {};
55086
+ for (const integration of integrations) {
55087
+ if (!(integration.gameId in subjectMap)) {
55088
+ subjectMap[integration.gameId] = integration.subject;
55089
+ }
55090
+ }
55091
+ return subjectMap;
55092
+ }
55079
55093
  async getById(gameId) {
55080
55094
  const db2 = this.ctx.db;
55081
55095
  const game = await db2.query.games.findFirst({
@@ -56063,13 +56077,13 @@ class LevelService {
56063
56077
  throw new BadRequestError("Level must be at least 1");
56064
56078
  }
56065
56079
  if (levelConfigCache?.has(level)) {
56066
- return levelConfigCache.get(level) || null;
56080
+ return levelConfigCache.get(level) ?? null;
56067
56081
  }
56068
56082
  const [config2] = await this.ctx.db.select().from(levelConfigs).where(eq(levelConfigs.level, level)).limit(1);
56069
56083
  if (levelConfigCache && config2) {
56070
56084
  levelConfigCache.set(level, config2);
56071
56085
  }
56072
- return config2 || null;
56086
+ return config2 ?? null;
56073
56087
  }
56074
56088
  async listConfigs() {
56075
56089
  return this.ctx.db.select().from(levelConfigs).orderBy(levelConfigs.level);
@@ -136759,6 +136773,7 @@ var init_domain_controller = __esm(() => {
136759
136773
  });
136760
136774
  var logger43;
136761
136775
  var list3;
136776
+ var getSubjects;
136762
136777
  var getById2;
136763
136778
  var getBySlug;
136764
136779
  var upsertBySlug;
@@ -136776,6 +136791,10 @@ var init_game_controller = __esm(() => {
136776
136791
  logger43.debug("Listing games", { userId: ctx.user.id });
136777
136792
  return ctx.services.game.list();
136778
136793
  });
136794
+ getSubjects = requireAuth(async (ctx) => {
136795
+ logger43.debug("Getting game subjects", { userId: ctx.user.id });
136796
+ return ctx.services.game.getSubjects();
136797
+ });
136779
136798
  getById2 = requireAuth(async (ctx) => {
136780
136799
  const gameId = ctx.params.gameId;
136781
136800
  if (!gameId) {
@@ -136828,6 +136847,7 @@ var init_game_controller = __esm(() => {
136828
136847
  });
136829
136848
  games2 = {
136830
136849
  list: list3,
136850
+ getSubjects,
136831
136851
  getById: getById2,
136832
136852
  getBySlug,
136833
136853
  upsertBySlug,
@@ -137233,7 +137253,6 @@ var init_leaderboard_controller = __esm(() => {
137233
137253
  init_esm();
137234
137254
  init_schemas_index();
137235
137255
  init_src2();
137236
- init_src4();
137237
137256
  init_errors();
137238
137257
  init_utils11();
137239
137258
  logger47 = log.scope("LeaderboardController");
@@ -137322,9 +137341,6 @@ var init_leaderboard_controller = __esm(() => {
137322
137341
  if (!gameId || !userId) {
137323
137342
  throw ApiError.badRequest("Game ID and User ID are required");
137324
137343
  }
137325
- if (!isValidUUID(userId)) {
137326
- throw ApiError.unprocessableEntity("userId must be a valid UUID format");
137327
- }
137328
137344
  logger47.debug("Getting user rank", {
137329
137345
  requesterId: ctx.user.id,
137330
137346
  gameId,
@@ -137337,9 +137353,6 @@ var init_leaderboard_controller = __esm(() => {
137337
137353
  if (!userId) {
137338
137354
  throw ApiError.badRequest("User ID is required");
137339
137355
  }
137340
- if (!isValidUUID(userId)) {
137341
- throw ApiError.unprocessableEntity("userId must be a valid UUID format");
137342
- }
137343
137356
  const url = ctx.url;
137344
137357
  const limit = Math.min(Number(url.searchParams.get("limit") || "50"), 100);
137345
137358
  const gameId = url.searchParams.get("gameId") || undefined;
@@ -137356,9 +137369,6 @@ var init_leaderboard_controller = __esm(() => {
137356
137369
  if (!gameId || !userId) {
137357
137370
  throw ApiError.badRequest("Game ID and User ID are required");
137358
137371
  }
137359
- if (!isValidUUID(userId)) {
137360
- throw ApiError.unprocessableEntity("userId must be a valid UUID format");
137361
- }
137362
137372
  const url = ctx.url;
137363
137373
  const limit = Math.min(Number(url.searchParams.get("limit") || "10"), 100);
137364
137374
  logger47.debug("Getting user scores", {
@@ -140758,7 +140768,7 @@ var import_picocolors12 = __toESM(require_picocolors(), 1);
140758
140768
  // package.json
140759
140769
  var package_default2 = {
140760
140770
  name: "@playcademy/vite-plugin",
140761
- version: "0.2.9",
140771
+ version: "0.2.10",
140762
140772
  type: "module",
140763
140773
  exports: {
140764
140774
  ".": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcademy/vite-plugin",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -22,11 +22,11 @@
22
22
  "dependencies": {
23
23
  "archiver": "^7.0.1",
24
24
  "picocolors": "^1.1.1",
25
- "playcademy": "0.16.2"
25
+ "playcademy": "0.16.3"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@inquirer/prompts": "^7.8.6",
29
- "@playcademy/sandbox": "0.3.11",
29
+ "@playcademy/sandbox": "0.3.12",
30
30
  "@playcademy/utils": "0.0.1",
31
31
  "@types/archiver": "^6.0.3",
32
32
  "@types/bun": "latest"