@playcademy/vite-plugin 0.2.15 → 0.2.17
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/index.js +35 -18
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -52323,6 +52323,7 @@ var init_pg_core = __esm(() => {
|
|
|
52323
52323
|
});
|
|
52324
52324
|
var gamePlatformEnum;
|
|
52325
52325
|
var gameTypeEnum;
|
|
52326
|
+
var gameVisibilityEnum;
|
|
52326
52327
|
var games;
|
|
52327
52328
|
var gameSessions;
|
|
52328
52329
|
var gameStates;
|
|
@@ -52338,6 +52339,7 @@ var init_table3 = __esm(() => {
|
|
|
52338
52339
|
init_table6();
|
|
52339
52340
|
gamePlatformEnum = pgEnum("game_platform", ["web", "godot", "unity"]);
|
|
52340
52341
|
gameTypeEnum = pgEnum("game_type", ["hosted", "external"]);
|
|
52342
|
+
gameVisibilityEnum = pgEnum("game_visibility", ["visible", "unlisted", "internal"]);
|
|
52341
52343
|
games = pgTable("games", {
|
|
52342
52344
|
id: uuid("id").primaryKey().defaultRandom(),
|
|
52343
52345
|
developerId: text("developer_id").references(() => users.id, {
|
|
@@ -52353,6 +52355,7 @@ var init_table3 = __esm(() => {
|
|
|
52353
52355
|
mapElementId: uuid("map_element_id").references(() => mapElements.id, {
|
|
52354
52356
|
onDelete: "set null"
|
|
52355
52357
|
}),
|
|
52358
|
+
visibility: gameVisibilityEnum("visibility").notNull().default("visible"),
|
|
52356
52359
|
metadata: jsonb("metadata").$type().notNull().default({}),
|
|
52357
52360
|
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
|
|
52358
52361
|
updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow()
|
|
@@ -53147,6 +53150,7 @@ __export(exports_tables_index, {
|
|
|
53147
53150
|
inventoryItems: () => inventoryItems,
|
|
53148
53151
|
interactionTypeEnum: () => interactionTypeEnum,
|
|
53149
53152
|
games: () => games,
|
|
53153
|
+
gameVisibilityEnum: () => gameVisibilityEnum,
|
|
53150
53154
|
gameTypeEnum: () => gameTypeEnum,
|
|
53151
53155
|
gameTimebackIntegrations: () => gameTimebackIntegrations,
|
|
53152
53156
|
gameStates: () => gameStates,
|
|
@@ -59329,18 +59333,18 @@ class DeployService {
|
|
|
59329
59333
|
queueNameByKey.set(queueKey, toQueueName(queueKey));
|
|
59330
59334
|
}
|
|
59331
59335
|
workerBindings.queues = Object.entries(bindings.queues).map(([queueKey, queueConfig]) => {
|
|
59332
|
-
const config2 = queueConfig === true ?
|
|
59333
|
-
const deadLetterQueue = config2
|
|
59336
|
+
const config2 = queueConfig === true ? undefined : queueConfig;
|
|
59337
|
+
const deadLetterQueue = config2?.deadLetterQueue && queueNameByKey.get(config2.deadLetterQueue) ? queueNameByKey.get(config2.deadLetterQueue) : undefined;
|
|
59334
59338
|
return {
|
|
59335
59339
|
bindingName: toBindingName(queueKey),
|
|
59336
59340
|
queueName: toQueueName(queueKey),
|
|
59337
|
-
settings: {
|
|
59341
|
+
settings: config2 ? {
|
|
59338
59342
|
maxBatchSize: config2.maxBatchSize,
|
|
59339
59343
|
maxRetries: config2.maxRetries,
|
|
59340
59344
|
maxBatchTimeout: config2.maxBatchTimeout,
|
|
59341
59345
|
maxConcurrency: config2.maxConcurrency,
|
|
59342
59346
|
retryDelay: config2.retryDelay
|
|
59343
|
-
},
|
|
59347
|
+
} : undefined,
|
|
59344
59348
|
deadLetterQueue
|
|
59345
59349
|
};
|
|
59346
59350
|
});
|
|
@@ -59668,9 +59672,12 @@ class GameService {
|
|
|
59668
59672
|
constructor(ctx) {
|
|
59669
59673
|
this.ctx = ctx;
|
|
59670
59674
|
}
|
|
59671
|
-
async list() {
|
|
59675
|
+
async list(caller) {
|
|
59672
59676
|
const db2 = this.ctx.db;
|
|
59677
|
+
const isAdmin = caller?.role === "admin";
|
|
59678
|
+
const isDeveloper = caller?.role === "developer";
|
|
59673
59679
|
return db2.query.games.findMany({
|
|
59680
|
+
where: isAdmin ? undefined : isDeveloper && caller?.id ? or(ne(games.visibility, "internal"), eq(games.developerId, caller.id)) : ne(games.visibility, "internal"),
|
|
59674
59681
|
orderBy: [desc(games.createdAt)]
|
|
59675
59682
|
});
|
|
59676
59683
|
}
|
|
@@ -59688,7 +59695,7 @@ class GameService {
|
|
|
59688
59695
|
}
|
|
59689
59696
|
return subjectMap;
|
|
59690
59697
|
}
|
|
59691
|
-
async getById(gameId) {
|
|
59698
|
+
async getById(gameId, caller) {
|
|
59692
59699
|
const db2 = this.ctx.db;
|
|
59693
59700
|
const game = await db2.query.games.findFirst({
|
|
59694
59701
|
where: eq(games.id, gameId)
|
|
@@ -59696,9 +59703,10 @@ class GameService {
|
|
|
59696
59703
|
if (!game) {
|
|
59697
59704
|
throw new NotFoundError("Game", gameId);
|
|
59698
59705
|
}
|
|
59706
|
+
this.enforceVisibility(game, caller, gameId);
|
|
59699
59707
|
return game;
|
|
59700
59708
|
}
|
|
59701
|
-
async getBySlug(slug2) {
|
|
59709
|
+
async getBySlug(slug2, caller) {
|
|
59702
59710
|
const db2 = this.ctx.db;
|
|
59703
59711
|
const game = await db2.query.games.findFirst({
|
|
59704
59712
|
where: eq(games.slug, slug2)
|
|
@@ -59706,8 +59714,18 @@ class GameService {
|
|
|
59706
59714
|
if (!game) {
|
|
59707
59715
|
throw new NotFoundError("Game", slug2);
|
|
59708
59716
|
}
|
|
59717
|
+
this.enforceVisibility(game, caller, slug2);
|
|
59709
59718
|
return game;
|
|
59710
59719
|
}
|
|
59720
|
+
enforceVisibility(game, caller, lookupIdentifier) {
|
|
59721
|
+
if (game.visibility !== "internal")
|
|
59722
|
+
return;
|
|
59723
|
+
const isAdmin = caller?.role === "admin";
|
|
59724
|
+
const isOwner = caller?.id != null && caller.id === game.developerId;
|
|
59725
|
+
if (!isAdmin && !isOwner) {
|
|
59726
|
+
throw new NotFoundError("Game", lookupIdentifier);
|
|
59727
|
+
}
|
|
59728
|
+
}
|
|
59711
59729
|
async upsertBySlug(slug2, data, user) {
|
|
59712
59730
|
const db2 = this.ctx.db;
|
|
59713
59731
|
const existingGame = await db2.query.games.findFirst({
|
|
@@ -59726,6 +59744,7 @@ class GameService {
|
|
|
59726
59744
|
metadata: data.metadata,
|
|
59727
59745
|
mapElementId: data.mapElementId,
|
|
59728
59746
|
gameType: data.gameType,
|
|
59747
|
+
...data.visibility && { visibility: data.visibility },
|
|
59729
59748
|
externalUrl: data.externalUrl || null,
|
|
59730
59749
|
updatedAt: new Date
|
|
59731
59750
|
};
|
|
@@ -59739,19 +59758,14 @@ class GameService {
|
|
|
59739
59758
|
gameResponse = updatedGame;
|
|
59740
59759
|
} else {
|
|
59741
59760
|
const insertData = {
|
|
59761
|
+
...gameDataForDb,
|
|
59742
59762
|
id: gameId,
|
|
59743
59763
|
slug: slug2,
|
|
59744
59764
|
developerId: user.id,
|
|
59745
|
-
displayName: data.displayName,
|
|
59746
|
-
platform: data.platform,
|
|
59747
59765
|
metadata: data.metadata || {},
|
|
59748
|
-
mapElementId: data.mapElementId,
|
|
59749
|
-
gameType: data.gameType,
|
|
59750
59766
|
version: data.gameType === "external" ? "external" : "",
|
|
59751
59767
|
deploymentUrl: null,
|
|
59752
|
-
|
|
59753
|
-
createdAt: new Date,
|
|
59754
|
-
updatedAt: new Date
|
|
59768
|
+
createdAt: new Date
|
|
59755
59769
|
};
|
|
59756
59770
|
const [createdGame] = await db2.insert(games).values(insertData).returning();
|
|
59757
59771
|
if (!createdGame) {
|
|
@@ -129195,6 +129209,7 @@ var init_schemas3 = __esm(() => {
|
|
|
129195
129209
|
metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional().default({}),
|
|
129196
129210
|
mapElementId: exports_external.string().uuid().optional().nullable(),
|
|
129197
129211
|
gameType: exports_external.enum(gameTypeEnum.enumValues).default("hosted"),
|
|
129212
|
+
visibility: exports_external.enum(gameVisibilityEnum.enumValues).default("visible"),
|
|
129198
129213
|
deploymentUrl: exports_external.string().nullable().optional(),
|
|
129199
129214
|
externalUrl: exports_external.string().url().nullable().optional()
|
|
129200
129215
|
}).omit({
|
|
@@ -129216,6 +129231,7 @@ var init_schemas3 = __esm(() => {
|
|
|
129216
129231
|
mapElementId: exports_external.string().uuid().optional().nullable(),
|
|
129217
129232
|
platform: exports_external.enum(gamePlatformEnum.enumValues).optional(),
|
|
129218
129233
|
gameType: exports_external.enum(gameTypeEnum.enumValues).optional(),
|
|
129234
|
+
visibility: exports_external.enum(gameVisibilityEnum.enumValues).optional(),
|
|
129219
129235
|
deploymentUrl: exports_external.string().nullable().optional(),
|
|
129220
129236
|
externalUrl: exports_external.string().url().nullable().optional()
|
|
129221
129237
|
}).omit({
|
|
@@ -129258,6 +129274,7 @@ var init_schemas3 = __esm(() => {
|
|
|
129258
129274
|
platform: exports_external.enum(gamePlatformEnum.enumValues),
|
|
129259
129275
|
metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional().default({}),
|
|
129260
129276
|
gameType: exports_external.enum(gameTypeEnum.enumValues).optional().default("hosted"),
|
|
129277
|
+
visibility: exports_external.enum(gameVisibilityEnum.enumValues).optional(),
|
|
129261
129278
|
externalUrl: exports_external.string().url().optional()
|
|
129262
129279
|
}).refine((data) => {
|
|
129263
129280
|
if (data.gameType === "external" && !data.externalUrl)
|
|
@@ -139383,7 +139400,7 @@ var init_game_controller = __esm(() => {
|
|
|
139383
139400
|
logger43 = log.scope("GameController");
|
|
139384
139401
|
list3 = requireAuth(async (ctx) => {
|
|
139385
139402
|
logger43.debug("Listing games", { userId: ctx.user.id });
|
|
139386
|
-
return ctx.services.game.list();
|
|
139403
|
+
return ctx.services.game.list(ctx.user);
|
|
139387
139404
|
});
|
|
139388
139405
|
getSubjects = requireAuth(async (ctx) => {
|
|
139389
139406
|
logger43.debug("Getting game subjects", { userId: ctx.user.id });
|
|
@@ -139398,7 +139415,7 @@ var init_game_controller = __esm(() => {
|
|
|
139398
139415
|
throw ApiError.unprocessableEntity("gameId must be a valid UUID format");
|
|
139399
139416
|
}
|
|
139400
139417
|
logger43.debug("Getting game by ID", { userId: ctx.user.id, gameId });
|
|
139401
|
-
return ctx.services.game.getById(gameId);
|
|
139418
|
+
return ctx.services.game.getById(gameId, ctx.user);
|
|
139402
139419
|
});
|
|
139403
139420
|
getBySlug = requireAuth(async (ctx) => {
|
|
139404
139421
|
const slug2 = ctx.params.slug;
|
|
@@ -139406,7 +139423,7 @@ var init_game_controller = __esm(() => {
|
|
|
139406
139423
|
throw ApiError.badRequest("Missing game slug");
|
|
139407
139424
|
}
|
|
139408
139425
|
logger43.debug("Getting game by slug", { userId: ctx.user.id, slug: slug2 });
|
|
139409
|
-
return ctx.services.game.getBySlug(slug2);
|
|
139426
|
+
return ctx.services.game.getBySlug(slug2, ctx.user);
|
|
139410
139427
|
});
|
|
139411
139428
|
upsertBySlug = requireAuth(async (ctx) => {
|
|
139412
139429
|
const slug2 = ctx.params.slug;
|
|
@@ -143480,7 +143497,7 @@ var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
|
143480
143497
|
// package.json
|
|
143481
143498
|
var package_default2 = {
|
|
143482
143499
|
name: "@playcademy/vite-plugin",
|
|
143483
|
-
version: "0.2.
|
|
143500
|
+
version: "0.2.17",
|
|
143484
143501
|
type: "module",
|
|
143485
143502
|
exports: {
|
|
143486
143503
|
".": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playcademy/vite-plugin",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"archiver": "^7.0.1",
|
|
24
24
|
"picocolors": "^1.1.1",
|
|
25
|
-
"playcademy": "0.16.
|
|
25
|
+
"playcademy": "0.16.15"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@inquirer/prompts": "^7.8.6",
|