@playcademy/sandbox 0.1.0-beta.5 → 0.1.0-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/dist/cli.js +8 -8
- package/dist/server.js +8 -8
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -77722,7 +77722,7 @@ async function seedCurrentProjectGame(db, project) {
|
|
|
77722
77722
|
// package.json
|
|
77723
77723
|
var package_default = {
|
|
77724
77724
|
name: "@playcademy/sandbox",
|
|
77725
|
-
version: "0.1.0-beta.
|
|
77725
|
+
version: "0.1.0-beta.5",
|
|
77726
77726
|
description: "Local development server for Playcademy game development",
|
|
77727
77727
|
type: "module",
|
|
77728
77728
|
exports: {
|
|
@@ -78279,7 +78279,7 @@ async function addInventoryItem(ctx) {
|
|
|
78279
78279
|
throw ApiError.internal("Internal server error", error2);
|
|
78280
78280
|
}
|
|
78281
78281
|
}
|
|
78282
|
-
async function
|
|
78282
|
+
async function removeInventoryItem(ctx) {
|
|
78283
78283
|
const user = ctx.user;
|
|
78284
78284
|
if (!user) {
|
|
78285
78285
|
throw ApiError.unauthorized("Valid session or bearer token required");
|
|
@@ -78312,8 +78312,8 @@ async function spendInventoryItem(ctx) {
|
|
|
78312
78312
|
}
|
|
78313
78313
|
const [updatedItemRecord] = await tx.update(inventoryItems).set({ quantity: sql`${inventoryItems.quantity} - ${qty}` }).where(eq(inventoryItems.id, currentItem.id)).returning({ quantity: inventoryItems.quantity });
|
|
78314
78314
|
if (!updatedItemRecord) {
|
|
78315
|
-
logger2.error(`Failed to update inventory item ${currentItem.id} during
|
|
78316
|
-
throw ApiError.internal("Failed to update item quantity during
|
|
78315
|
+
logger2.error(`Failed to update inventory item ${currentItem.id} during remove operation.`);
|
|
78316
|
+
throw ApiError.internal("Failed to update item quantity during remove.");
|
|
78317
78317
|
}
|
|
78318
78318
|
return updatedItemRecord.quantity;
|
|
78319
78319
|
});
|
|
@@ -78322,7 +78322,7 @@ async function spendInventoryItem(ctx) {
|
|
|
78322
78322
|
if (error2 instanceof ApiError) {
|
|
78323
78323
|
throw error2;
|
|
78324
78324
|
}
|
|
78325
|
-
logger2.error(`Error
|
|
78325
|
+
logger2.error(`Error removing inventory item ${itemId} for user ${user.id}:`, error2);
|
|
78326
78326
|
throw ApiError.internal("Internal server error", error2);
|
|
78327
78327
|
}
|
|
78328
78328
|
}
|
|
@@ -78367,7 +78367,7 @@ inventoryRouter.post("/add", async (c2) => {
|
|
|
78367
78367
|
return c2.json({ error: message }, 500);
|
|
78368
78368
|
}
|
|
78369
78369
|
});
|
|
78370
|
-
inventoryRouter.post("/
|
|
78370
|
+
inventoryRouter.post("/remove", async (c2) => {
|
|
78371
78371
|
const ctx = {
|
|
78372
78372
|
user: c2.get("user"),
|
|
78373
78373
|
params: {},
|
|
@@ -78375,13 +78375,13 @@ inventoryRouter.post("/spend", async (c2) => {
|
|
|
78375
78375
|
request: c2.req.raw
|
|
78376
78376
|
};
|
|
78377
78377
|
try {
|
|
78378
|
-
const result = await
|
|
78378
|
+
const result = await removeInventoryItem(ctx);
|
|
78379
78379
|
return c2.json(result);
|
|
78380
78380
|
} catch (error2) {
|
|
78381
78381
|
if (error2 instanceof ApiError) {
|
|
78382
78382
|
return c2.json({ error: error2.message }, error2.statusCode);
|
|
78383
78383
|
}
|
|
78384
|
-
console.error("Error in
|
|
78384
|
+
console.error("Error in removeInventoryItem:", error2);
|
|
78385
78385
|
const message = error2 instanceof Error ? error2.message : "Internal server error";
|
|
78386
78386
|
return c2.json({ error: message }, 500);
|
|
78387
78387
|
}
|
package/dist/server.js
CHANGED
|
@@ -75812,7 +75812,7 @@ async function seedCurrentProjectGame(db, project) {
|
|
|
75812
75812
|
// package.json
|
|
75813
75813
|
var package_default = {
|
|
75814
75814
|
name: "@playcademy/sandbox",
|
|
75815
|
-
version: "0.1.0-beta.
|
|
75815
|
+
version: "0.1.0-beta.5",
|
|
75816
75816
|
description: "Local development server for Playcademy game development",
|
|
75817
75817
|
type: "module",
|
|
75818
75818
|
exports: {
|
|
@@ -76369,7 +76369,7 @@ async function addInventoryItem(ctx) {
|
|
|
76369
76369
|
throw ApiError.internal("Internal server error", error2);
|
|
76370
76370
|
}
|
|
76371
76371
|
}
|
|
76372
|
-
async function
|
|
76372
|
+
async function removeInventoryItem(ctx) {
|
|
76373
76373
|
const user = ctx.user;
|
|
76374
76374
|
if (!user) {
|
|
76375
76375
|
throw ApiError.unauthorized("Valid session or bearer token required");
|
|
@@ -76402,8 +76402,8 @@ async function spendInventoryItem(ctx) {
|
|
|
76402
76402
|
}
|
|
76403
76403
|
const [updatedItemRecord] = await tx.update(inventoryItems).set({ quantity: sql`${inventoryItems.quantity} - ${qty}` }).where(eq(inventoryItems.id, currentItem.id)).returning({ quantity: inventoryItems.quantity });
|
|
76404
76404
|
if (!updatedItemRecord) {
|
|
76405
|
-
logger2.error(`Failed to update inventory item ${currentItem.id} during
|
|
76406
|
-
throw ApiError.internal("Failed to update item quantity during
|
|
76405
|
+
logger2.error(`Failed to update inventory item ${currentItem.id} during remove operation.`);
|
|
76406
|
+
throw ApiError.internal("Failed to update item quantity during remove.");
|
|
76407
76407
|
}
|
|
76408
76408
|
return updatedItemRecord.quantity;
|
|
76409
76409
|
});
|
|
@@ -76412,7 +76412,7 @@ async function spendInventoryItem(ctx) {
|
|
|
76412
76412
|
if (error2 instanceof ApiError) {
|
|
76413
76413
|
throw error2;
|
|
76414
76414
|
}
|
|
76415
|
-
logger2.error(`Error
|
|
76415
|
+
logger2.error(`Error removing inventory item ${itemId} for user ${user.id}:`, error2);
|
|
76416
76416
|
throw ApiError.internal("Internal server error", error2);
|
|
76417
76417
|
}
|
|
76418
76418
|
}
|
|
@@ -76457,7 +76457,7 @@ inventoryRouter.post("/add", async (c2) => {
|
|
|
76457
76457
|
return c2.json({ error: message }, 500);
|
|
76458
76458
|
}
|
|
76459
76459
|
});
|
|
76460
|
-
inventoryRouter.post("/
|
|
76460
|
+
inventoryRouter.post("/remove", async (c2) => {
|
|
76461
76461
|
const ctx = {
|
|
76462
76462
|
user: c2.get("user"),
|
|
76463
76463
|
params: {},
|
|
@@ -76465,13 +76465,13 @@ inventoryRouter.post("/spend", async (c2) => {
|
|
|
76465
76465
|
request: c2.req.raw
|
|
76466
76466
|
};
|
|
76467
76467
|
try {
|
|
76468
|
-
const result = await
|
|
76468
|
+
const result = await removeInventoryItem(ctx);
|
|
76469
76469
|
return c2.json(result);
|
|
76470
76470
|
} catch (error2) {
|
|
76471
76471
|
if (error2 instanceof ApiError) {
|
|
76472
76472
|
return c2.json({ error: error2.message }, error2.statusCode);
|
|
76473
76473
|
}
|
|
76474
|
-
console.error("Error in
|
|
76474
|
+
console.error("Error in removeInventoryItem:", error2);
|
|
76475
76475
|
const message = error2 instanceof Error ? error2.message : "Internal server error";
|
|
76476
76476
|
return c2.json({ error: message }, 500);
|
|
76477
76477
|
}
|