@playcademy/sandbox 0.1.0-beta.10 → 0.1.0-beta.11
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 +116 -11
- package/dist/lib/auth.d.ts +3 -0
- package/dist/server.js +116 -11
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/dist/routes/admin.d.ts +0 -1
package/dist/cli.js
CHANGED
|
@@ -52810,7 +52810,7 @@ var logger = (fn = console.log) => {
|
|
|
52810
52810
|
// package.json
|
|
52811
52811
|
var package_default = {
|
|
52812
52812
|
name: "@playcademy/sandbox",
|
|
52813
|
-
version: "0.1.0-beta.
|
|
52813
|
+
version: "0.1.0-beta.10",
|
|
52814
52814
|
description: "Local development server for Playcademy game development",
|
|
52815
52815
|
type: "module",
|
|
52816
52816
|
exports: {
|
|
@@ -73167,7 +73167,10 @@ var SAMPLE_INVENTORY = [
|
|
|
73167
73167
|
// src/database/seed.ts
|
|
73168
73168
|
async function seedDemoData(db) {
|
|
73169
73169
|
try {
|
|
73170
|
-
|
|
73170
|
+
const allDemoUsers = Object.values(DEMO_USERS);
|
|
73171
|
+
for (const user of allDemoUsers) {
|
|
73172
|
+
await db.insert(users).values(user).onConflictDoNothing();
|
|
73173
|
+
}
|
|
73171
73174
|
for (const item of SAMPLE_ITEMS) {
|
|
73172
73175
|
await db.insert(items).values(item);
|
|
73173
73176
|
}
|
|
@@ -73328,19 +73331,65 @@ async function seedCurrentProjectGame(db, project) {
|
|
|
73328
73331
|
}
|
|
73329
73332
|
|
|
73330
73333
|
// src/lib/auth.ts
|
|
73334
|
+
function extractTokenFromHeader(authHeader) {
|
|
73335
|
+
if (!authHeader?.startsWith("Bearer ")) {
|
|
73336
|
+
return null;
|
|
73337
|
+
}
|
|
73338
|
+
return authHeader.substring(7);
|
|
73339
|
+
}
|
|
73340
|
+
function parseJwtToken(token) {
|
|
73341
|
+
try {
|
|
73342
|
+
const parts2 = token.split(".");
|
|
73343
|
+
if (parts2.length === 3 && parts2[1]) {
|
|
73344
|
+
const payload = JSON.parse(atob(parts2[1]));
|
|
73345
|
+
return payload.uid || null;
|
|
73346
|
+
}
|
|
73347
|
+
} catch (error2) {
|
|
73348
|
+
console.warn("Failed to decode JWT token:", error2);
|
|
73349
|
+
}
|
|
73350
|
+
return null;
|
|
73351
|
+
}
|
|
73352
|
+
function resolveUserId(token) {
|
|
73353
|
+
const demoUser = DEMO_TOKENS[token];
|
|
73354
|
+
if (demoUser) {
|
|
73355
|
+
return demoUser.id;
|
|
73356
|
+
}
|
|
73357
|
+
if (token.includes(".")) {
|
|
73358
|
+
return parseJwtToken(token);
|
|
73359
|
+
}
|
|
73360
|
+
return null;
|
|
73361
|
+
}
|
|
73362
|
+
async function fetchUserFromDatabase(db, userId) {
|
|
73363
|
+
try {
|
|
73364
|
+
const user = await db.query.users.findFirst({
|
|
73365
|
+
where: eq(users.id, userId)
|
|
73366
|
+
});
|
|
73367
|
+
return user || null;
|
|
73368
|
+
} catch (error2) {
|
|
73369
|
+
console.error("Error fetching user from database:", error2);
|
|
73370
|
+
throw error2;
|
|
73371
|
+
}
|
|
73372
|
+
}
|
|
73331
73373
|
function setupAuth() {
|
|
73332
73374
|
return async (c2, next) => {
|
|
73333
73375
|
const authHeader = c2.req.header("Authorization");
|
|
73334
|
-
|
|
73335
|
-
|
|
73336
|
-
|
|
73337
|
-
|
|
73338
|
-
|
|
73339
|
-
|
|
73340
|
-
|
|
73341
|
-
|
|
73376
|
+
const token = extractTokenFromHeader(authHeader);
|
|
73377
|
+
if (!token) {
|
|
73378
|
+
throw new Error("No authorization token provided");
|
|
73379
|
+
}
|
|
73380
|
+
const targetUserId = resolveUserId(token);
|
|
73381
|
+
if (!targetUserId) {
|
|
73382
|
+
throw new Error("No user found for provided token");
|
|
73383
|
+
}
|
|
73384
|
+
const db = c2.get("db");
|
|
73385
|
+
if (!db) {
|
|
73386
|
+
throw new Error("Database not available in context");
|
|
73342
73387
|
}
|
|
73343
|
-
|
|
73388
|
+
const user = await fetchUserFromDatabase(db, targetUserId);
|
|
73389
|
+
if (!user) {
|
|
73390
|
+
throw new Error(`User not found: ${targetUserId}`);
|
|
73391
|
+
}
|
|
73392
|
+
c2.set("user", user);
|
|
73344
73393
|
await next();
|
|
73345
73394
|
};
|
|
73346
73395
|
}
|
|
@@ -73366,6 +73415,9 @@ class ApiError extends Error {
|
|
|
73366
73415
|
static notFound(message = "Not found") {
|
|
73367
73416
|
return new ApiError(404, "NOT_FOUND", message);
|
|
73368
73417
|
}
|
|
73418
|
+
static methodNotAllowed(message = "Method not allowed") {
|
|
73419
|
+
return new ApiError(405, "METHOD_NOT_ALLOWED", message);
|
|
73420
|
+
}
|
|
73369
73421
|
static badRequest(message = "Bad request", details) {
|
|
73370
73422
|
return new ApiError(400, "BAD_REQUEST", message, details);
|
|
73371
73423
|
}
|
|
@@ -78345,6 +78397,10 @@ usersRouter.post("/xp/add", async (c2) => {
|
|
|
78345
78397
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
78346
78398
|
}
|
|
78347
78399
|
});
|
|
78400
|
+
usersRouter.all("/", async (c2) => {
|
|
78401
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
78402
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
78403
|
+
});
|
|
78348
78404
|
// src/routes/health.ts
|
|
78349
78405
|
var healthRouter = new Hono2;
|
|
78350
78406
|
healthRouter.get("/", (c2) => c2.json({ status: "ok", timestamp: new Date().toISOString() }));
|
|
@@ -78552,6 +78608,10 @@ inventoryRouter.post("/remove", async (c2) => {
|
|
|
78552
78608
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
78553
78609
|
}
|
|
78554
78610
|
});
|
|
78611
|
+
inventoryRouter.all("/", async (c2) => {
|
|
78612
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
78613
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
78614
|
+
});
|
|
78555
78615
|
// ../../node_modules/ulidx/dist/node/index.js
|
|
78556
78616
|
import crypto3 from "node:crypto";
|
|
78557
78617
|
|
|
@@ -82333,6 +82393,10 @@ gamesRouter.delete("/:gameId/items/:itemId/shop-listing", async (c2) => {
|
|
|
82333
82393
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
82334
82394
|
}
|
|
82335
82395
|
});
|
|
82396
|
+
gamesRouter.all("/", async (c2) => {
|
|
82397
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
82398
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
82399
|
+
});
|
|
82336
82400
|
// src/routes/manifest.ts
|
|
82337
82401
|
var manifestRouter = new Hono2;
|
|
82338
82402
|
manifestRouter.get("/", async (c2) => {
|
|
@@ -82463,6 +82527,10 @@ shopRouter.get("/view", async (c2) => {
|
|
|
82463
82527
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
82464
82528
|
}
|
|
82465
82529
|
});
|
|
82530
|
+
shopRouter.all("/view", async (c2) => {
|
|
82531
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
82532
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
82533
|
+
});
|
|
82466
82534
|
// src/routes/items.ts
|
|
82467
82535
|
var itemsRouter = new Hono2;
|
|
82468
82536
|
itemsRouter.get("/resolve", async (c2) => {
|
|
@@ -82576,6 +82644,10 @@ itemsRouter.delete("/:itemId", async (c2) => {
|
|
|
82576
82644
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
82577
82645
|
}
|
|
82578
82646
|
});
|
|
82647
|
+
itemsRouter.all("/", async (c2) => {
|
|
82648
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
82649
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
82650
|
+
});
|
|
82579
82651
|
// ../api-core/src/currencies/index.ts
|
|
82580
82652
|
async function listCurrencies(ctx) {
|
|
82581
82653
|
const user = ctx.user;
|
|
@@ -82607,6 +82679,9 @@ async function getCurrencyById(ctx) {
|
|
|
82607
82679
|
if (!currencyId) {
|
|
82608
82680
|
throw ApiError.badRequest("Missing currency ID");
|
|
82609
82681
|
}
|
|
82682
|
+
if (!isValidUUID(currencyId)) {
|
|
82683
|
+
throw ApiError.unprocessableEntity("Invalid UUID format for currency ID");
|
|
82684
|
+
}
|
|
82610
82685
|
try {
|
|
82611
82686
|
const db = getDatabase();
|
|
82612
82687
|
const currency = await db.query.currencies.findFirst({
|
|
@@ -82678,6 +82753,9 @@ async function updateCurrency(ctx) {
|
|
|
82678
82753
|
if (!currencyId) {
|
|
82679
82754
|
throw ApiError.badRequest("Missing currency ID");
|
|
82680
82755
|
}
|
|
82756
|
+
if (!isValidUUID(currencyId)) {
|
|
82757
|
+
throw ApiError.unprocessableEntity("Invalid UUID format for currency ID");
|
|
82758
|
+
}
|
|
82681
82759
|
let requestBody;
|
|
82682
82760
|
try {
|
|
82683
82761
|
requestBody = await ctx.request.json();
|
|
@@ -82728,6 +82806,9 @@ async function deleteCurrency(ctx) {
|
|
|
82728
82806
|
if (!currencyId) {
|
|
82729
82807
|
throw ApiError.badRequest("Missing currency ID");
|
|
82730
82808
|
}
|
|
82809
|
+
if (!isValidUUID(currencyId)) {
|
|
82810
|
+
throw ApiError.unprocessableEntity("Invalid UUID format for currency ID");
|
|
82811
|
+
}
|
|
82731
82812
|
try {
|
|
82732
82813
|
const db = getDatabase();
|
|
82733
82814
|
const result = await db.delete(currencies).where(eq(currencies.id, currencyId)).returning({ id: currencies.id });
|
|
@@ -82837,6 +82918,10 @@ currenciesRouter.delete("/:currencyId", async (c2) => {
|
|
|
82837
82918
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
82838
82919
|
}
|
|
82839
82920
|
});
|
|
82921
|
+
currenciesRouter.all("/", async (c2) => {
|
|
82922
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
82923
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
82924
|
+
});
|
|
82840
82925
|
// ../api-core/src/maps/index.ts
|
|
82841
82926
|
async function getMapElements(ctx) {
|
|
82842
82927
|
const user = ctx.user;
|
|
@@ -82945,6 +83030,10 @@ mapsRouter.get("/:identifier", async (c2) => {
|
|
|
82945
83030
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
82946
83031
|
}
|
|
82947
83032
|
});
|
|
83033
|
+
mapsRouter.all("/", async (c2) => {
|
|
83034
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
83035
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
83036
|
+
});
|
|
82948
83037
|
// ../api-core/src/shop-listings/index.ts
|
|
82949
83038
|
async function createShopListing(ctx) {
|
|
82950
83039
|
const user = ctx.user;
|
|
@@ -83242,6 +83331,10 @@ shopListingsRouter.delete("/:listingId", async (c2) => {
|
|
|
83242
83331
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
83243
83332
|
}
|
|
83244
83333
|
});
|
|
83334
|
+
shopListingsRouter.all("/", async (c2) => {
|
|
83335
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
83336
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
83337
|
+
});
|
|
83245
83338
|
// ../api-core/src/dev/index.ts
|
|
83246
83339
|
async function applyForDeveloperStatus(ctx) {
|
|
83247
83340
|
const user = ctx.user;
|
|
@@ -83501,6 +83594,10 @@ devRouter.delete("/keys/:keyId", async (c2) => {
|
|
|
83501
83594
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
83502
83595
|
}
|
|
83503
83596
|
});
|
|
83597
|
+
devRouter.all("/", async (c2) => {
|
|
83598
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
83599
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
83600
|
+
});
|
|
83504
83601
|
// src/routes/levels.ts
|
|
83505
83602
|
var levelsRouter = new Hono2;
|
|
83506
83603
|
levelsRouter.get("/config", async (c2) => {
|
|
@@ -83539,6 +83636,10 @@ levelsRouter.get("/config/:level", async (c2) => {
|
|
|
83539
83636
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
83540
83637
|
}
|
|
83541
83638
|
});
|
|
83639
|
+
levelsRouter.all("/", async (c2) => {
|
|
83640
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
83641
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
83642
|
+
});
|
|
83542
83643
|
// src/server.ts
|
|
83543
83644
|
async function startServer(options) {
|
|
83544
83645
|
const { port, verbose = false, project, memoryOnly = false, seed = true } = options;
|
|
@@ -83553,6 +83654,10 @@ async function startServer(options) {
|
|
|
83553
83654
|
app.use("*", cors({ origin: "*", credentials: true }));
|
|
83554
83655
|
if (verbose)
|
|
83555
83656
|
app.use("*", logger());
|
|
83657
|
+
app.use("/api/*", async (c2, next) => {
|
|
83658
|
+
c2.set("db", db);
|
|
83659
|
+
await next();
|
|
83660
|
+
});
|
|
83556
83661
|
app.route("/health", healthRouter);
|
|
83557
83662
|
app.route("/api", manifestRouter);
|
|
83558
83663
|
app.use("/api/*", setupAuth());
|
package/dist/lib/auth.d.ts
CHANGED
package/dist/server.js
CHANGED
|
@@ -50900,7 +50900,7 @@ var logger = (fn = console.log) => {
|
|
|
50900
50900
|
// package.json
|
|
50901
50901
|
var package_default = {
|
|
50902
50902
|
name: "@playcademy/sandbox",
|
|
50903
|
-
version: "0.1.0-beta.
|
|
50903
|
+
version: "0.1.0-beta.10",
|
|
50904
50904
|
description: "Local development server for Playcademy game development",
|
|
50905
50905
|
type: "module",
|
|
50906
50906
|
exports: {
|
|
@@ -71257,7 +71257,10 @@ var SAMPLE_INVENTORY = [
|
|
|
71257
71257
|
// src/database/seed.ts
|
|
71258
71258
|
async function seedDemoData(db) {
|
|
71259
71259
|
try {
|
|
71260
|
-
|
|
71260
|
+
const allDemoUsers = Object.values(DEMO_USERS);
|
|
71261
|
+
for (const user of allDemoUsers) {
|
|
71262
|
+
await db.insert(users).values(user).onConflictDoNothing();
|
|
71263
|
+
}
|
|
71261
71264
|
for (const item of SAMPLE_ITEMS) {
|
|
71262
71265
|
await db.insert(items).values(item);
|
|
71263
71266
|
}
|
|
@@ -71418,19 +71421,65 @@ async function seedCurrentProjectGame(db, project) {
|
|
|
71418
71421
|
}
|
|
71419
71422
|
|
|
71420
71423
|
// src/lib/auth.ts
|
|
71424
|
+
function extractTokenFromHeader(authHeader) {
|
|
71425
|
+
if (!authHeader?.startsWith("Bearer ")) {
|
|
71426
|
+
return null;
|
|
71427
|
+
}
|
|
71428
|
+
return authHeader.substring(7);
|
|
71429
|
+
}
|
|
71430
|
+
function parseJwtToken(token) {
|
|
71431
|
+
try {
|
|
71432
|
+
const parts2 = token.split(".");
|
|
71433
|
+
if (parts2.length === 3 && parts2[1]) {
|
|
71434
|
+
const payload = JSON.parse(atob(parts2[1]));
|
|
71435
|
+
return payload.uid || null;
|
|
71436
|
+
}
|
|
71437
|
+
} catch (error2) {
|
|
71438
|
+
console.warn("Failed to decode JWT token:", error2);
|
|
71439
|
+
}
|
|
71440
|
+
return null;
|
|
71441
|
+
}
|
|
71442
|
+
function resolveUserId(token) {
|
|
71443
|
+
const demoUser = DEMO_TOKENS[token];
|
|
71444
|
+
if (demoUser) {
|
|
71445
|
+
return demoUser.id;
|
|
71446
|
+
}
|
|
71447
|
+
if (token.includes(".")) {
|
|
71448
|
+
return parseJwtToken(token);
|
|
71449
|
+
}
|
|
71450
|
+
return null;
|
|
71451
|
+
}
|
|
71452
|
+
async function fetchUserFromDatabase(db, userId) {
|
|
71453
|
+
try {
|
|
71454
|
+
const user = await db.query.users.findFirst({
|
|
71455
|
+
where: eq(users.id, userId)
|
|
71456
|
+
});
|
|
71457
|
+
return user || null;
|
|
71458
|
+
} catch (error2) {
|
|
71459
|
+
console.error("Error fetching user from database:", error2);
|
|
71460
|
+
throw error2;
|
|
71461
|
+
}
|
|
71462
|
+
}
|
|
71421
71463
|
function setupAuth() {
|
|
71422
71464
|
return async (c2, next) => {
|
|
71423
71465
|
const authHeader = c2.req.header("Authorization");
|
|
71424
|
-
|
|
71425
|
-
|
|
71426
|
-
|
|
71427
|
-
|
|
71428
|
-
|
|
71429
|
-
|
|
71430
|
-
|
|
71431
|
-
|
|
71466
|
+
const token = extractTokenFromHeader(authHeader);
|
|
71467
|
+
if (!token) {
|
|
71468
|
+
throw new Error("No authorization token provided");
|
|
71469
|
+
}
|
|
71470
|
+
const targetUserId = resolveUserId(token);
|
|
71471
|
+
if (!targetUserId) {
|
|
71472
|
+
throw new Error("No user found for provided token");
|
|
71473
|
+
}
|
|
71474
|
+
const db = c2.get("db");
|
|
71475
|
+
if (!db) {
|
|
71476
|
+
throw new Error("Database not available in context");
|
|
71432
71477
|
}
|
|
71433
|
-
|
|
71478
|
+
const user = await fetchUserFromDatabase(db, targetUserId);
|
|
71479
|
+
if (!user) {
|
|
71480
|
+
throw new Error(`User not found: ${targetUserId}`);
|
|
71481
|
+
}
|
|
71482
|
+
c2.set("user", user);
|
|
71434
71483
|
await next();
|
|
71435
71484
|
};
|
|
71436
71485
|
}
|
|
@@ -71456,6 +71505,9 @@ class ApiError extends Error {
|
|
|
71456
71505
|
static notFound(message = "Not found") {
|
|
71457
71506
|
return new ApiError(404, "NOT_FOUND", message);
|
|
71458
71507
|
}
|
|
71508
|
+
static methodNotAllowed(message = "Method not allowed") {
|
|
71509
|
+
return new ApiError(405, "METHOD_NOT_ALLOWED", message);
|
|
71510
|
+
}
|
|
71459
71511
|
static badRequest(message = "Bad request", details) {
|
|
71460
71512
|
return new ApiError(400, "BAD_REQUEST", message, details);
|
|
71461
71513
|
}
|
|
@@ -76435,6 +76487,10 @@ usersRouter.post("/xp/add", async (c2) => {
|
|
|
76435
76487
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
76436
76488
|
}
|
|
76437
76489
|
});
|
|
76490
|
+
usersRouter.all("/", async (c2) => {
|
|
76491
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
76492
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
76493
|
+
});
|
|
76438
76494
|
// src/routes/health.ts
|
|
76439
76495
|
var healthRouter = new Hono2;
|
|
76440
76496
|
healthRouter.get("/", (c2) => c2.json({ status: "ok", timestamp: new Date().toISOString() }));
|
|
@@ -76642,6 +76698,10 @@ inventoryRouter.post("/remove", async (c2) => {
|
|
|
76642
76698
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
76643
76699
|
}
|
|
76644
76700
|
});
|
|
76701
|
+
inventoryRouter.all("/", async (c2) => {
|
|
76702
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
76703
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
76704
|
+
});
|
|
76645
76705
|
// ../../node_modules/ulidx/dist/node/index.js
|
|
76646
76706
|
import crypto3 from "node:crypto";
|
|
76647
76707
|
|
|
@@ -80423,6 +80483,10 @@ gamesRouter.delete("/:gameId/items/:itemId/shop-listing", async (c2) => {
|
|
|
80423
80483
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
80424
80484
|
}
|
|
80425
80485
|
});
|
|
80486
|
+
gamesRouter.all("/", async (c2) => {
|
|
80487
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
80488
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
80489
|
+
});
|
|
80426
80490
|
// src/routes/manifest.ts
|
|
80427
80491
|
var manifestRouter = new Hono2;
|
|
80428
80492
|
manifestRouter.get("/", async (c2) => {
|
|
@@ -80553,6 +80617,10 @@ shopRouter.get("/view", async (c2) => {
|
|
|
80553
80617
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
80554
80618
|
}
|
|
80555
80619
|
});
|
|
80620
|
+
shopRouter.all("/view", async (c2) => {
|
|
80621
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
80622
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
80623
|
+
});
|
|
80556
80624
|
// src/routes/items.ts
|
|
80557
80625
|
var itemsRouter = new Hono2;
|
|
80558
80626
|
itemsRouter.get("/resolve", async (c2) => {
|
|
@@ -80666,6 +80734,10 @@ itemsRouter.delete("/:itemId", async (c2) => {
|
|
|
80666
80734
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
80667
80735
|
}
|
|
80668
80736
|
});
|
|
80737
|
+
itemsRouter.all("/", async (c2) => {
|
|
80738
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
80739
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
80740
|
+
});
|
|
80669
80741
|
// ../api-core/src/currencies/index.ts
|
|
80670
80742
|
async function listCurrencies(ctx) {
|
|
80671
80743
|
const user = ctx.user;
|
|
@@ -80697,6 +80769,9 @@ async function getCurrencyById(ctx) {
|
|
|
80697
80769
|
if (!currencyId) {
|
|
80698
80770
|
throw ApiError.badRequest("Missing currency ID");
|
|
80699
80771
|
}
|
|
80772
|
+
if (!isValidUUID(currencyId)) {
|
|
80773
|
+
throw ApiError.unprocessableEntity("Invalid UUID format for currency ID");
|
|
80774
|
+
}
|
|
80700
80775
|
try {
|
|
80701
80776
|
const db = getDatabase();
|
|
80702
80777
|
const currency = await db.query.currencies.findFirst({
|
|
@@ -80768,6 +80843,9 @@ async function updateCurrency(ctx) {
|
|
|
80768
80843
|
if (!currencyId) {
|
|
80769
80844
|
throw ApiError.badRequest("Missing currency ID");
|
|
80770
80845
|
}
|
|
80846
|
+
if (!isValidUUID(currencyId)) {
|
|
80847
|
+
throw ApiError.unprocessableEntity("Invalid UUID format for currency ID");
|
|
80848
|
+
}
|
|
80771
80849
|
let requestBody;
|
|
80772
80850
|
try {
|
|
80773
80851
|
requestBody = await ctx.request.json();
|
|
@@ -80818,6 +80896,9 @@ async function deleteCurrency(ctx) {
|
|
|
80818
80896
|
if (!currencyId) {
|
|
80819
80897
|
throw ApiError.badRequest("Missing currency ID");
|
|
80820
80898
|
}
|
|
80899
|
+
if (!isValidUUID(currencyId)) {
|
|
80900
|
+
throw ApiError.unprocessableEntity("Invalid UUID format for currency ID");
|
|
80901
|
+
}
|
|
80821
80902
|
try {
|
|
80822
80903
|
const db = getDatabase();
|
|
80823
80904
|
const result = await db.delete(currencies).where(eq(currencies.id, currencyId)).returning({ id: currencies.id });
|
|
@@ -80927,6 +81008,10 @@ currenciesRouter.delete("/:currencyId", async (c2) => {
|
|
|
80927
81008
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
80928
81009
|
}
|
|
80929
81010
|
});
|
|
81011
|
+
currenciesRouter.all("/", async (c2) => {
|
|
81012
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
81013
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
81014
|
+
});
|
|
80930
81015
|
// ../api-core/src/maps/index.ts
|
|
80931
81016
|
async function getMapElements(ctx) {
|
|
80932
81017
|
const user = ctx.user;
|
|
@@ -81035,6 +81120,10 @@ mapsRouter.get("/:identifier", async (c2) => {
|
|
|
81035
81120
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
81036
81121
|
}
|
|
81037
81122
|
});
|
|
81123
|
+
mapsRouter.all("/", async (c2) => {
|
|
81124
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
81125
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
81126
|
+
});
|
|
81038
81127
|
// ../api-core/src/shop-listings/index.ts
|
|
81039
81128
|
async function createShopListing(ctx) {
|
|
81040
81129
|
const user = ctx.user;
|
|
@@ -81332,6 +81421,10 @@ shopListingsRouter.delete("/:listingId", async (c2) => {
|
|
|
81332
81421
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
81333
81422
|
}
|
|
81334
81423
|
});
|
|
81424
|
+
shopListingsRouter.all("/", async (c2) => {
|
|
81425
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
81426
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
81427
|
+
});
|
|
81335
81428
|
// ../api-core/src/dev/index.ts
|
|
81336
81429
|
async function applyForDeveloperStatus(ctx) {
|
|
81337
81430
|
const user = ctx.user;
|
|
@@ -81591,6 +81684,10 @@ devRouter.delete("/keys/:keyId", async (c2) => {
|
|
|
81591
81684
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
81592
81685
|
}
|
|
81593
81686
|
});
|
|
81687
|
+
devRouter.all("/", async (c2) => {
|
|
81688
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
81689
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
81690
|
+
});
|
|
81594
81691
|
// src/routes/levels.ts
|
|
81595
81692
|
var levelsRouter = new Hono2;
|
|
81596
81693
|
levelsRouter.get("/config", async (c2) => {
|
|
@@ -81629,6 +81726,10 @@ levelsRouter.get("/config/:level", async (c2) => {
|
|
|
81629
81726
|
return c2.json(createUnknownErrorResponse(error2), 500);
|
|
81630
81727
|
}
|
|
81631
81728
|
});
|
|
81729
|
+
levelsRouter.all("/", async (c2) => {
|
|
81730
|
+
const error2 = ApiError.methodNotAllowed("Method not allowed");
|
|
81731
|
+
return c2.json(createErrorResponse(error2), 405);
|
|
81732
|
+
});
|
|
81632
81733
|
// src/server.ts
|
|
81633
81734
|
async function startServer(options) {
|
|
81634
81735
|
const { port, verbose = false, project, memoryOnly = false, seed = true } = options;
|
|
@@ -81643,6 +81744,10 @@ async function startServer(options) {
|
|
|
81643
81744
|
app.use("*", cors({ origin: "*", credentials: true }));
|
|
81644
81745
|
if (verbose)
|
|
81645
81746
|
app.use("*", logger());
|
|
81747
|
+
app.use("/api/*", async (c2, next) => {
|
|
81748
|
+
c2.set("db", db);
|
|
81749
|
+
await next();
|
|
81750
|
+
});
|
|
81646
81751
|
app.route("/health", healthRouter);
|
|
81647
81752
|
app.route("/api", manifestRouter);
|
|
81648
81753
|
app.use("/api/*", setupAuth());
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
package/dist/routes/admin.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|