@playcademy/sdk 0.1.0 → 0.1.2
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.d.ts +13 -30
- package/dist/index.js +112 -866
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/types.d.ts +13 -16
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -11,19 +11,40 @@ var __export = (target, all) => {
|
|
|
11
11
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
12
12
|
|
|
13
13
|
// ../logger/src/index.ts
|
|
14
|
-
var
|
|
15
|
-
return typeof process !== "undefined";
|
|
16
|
-
}, isBrowser = () => {
|
|
14
|
+
var isBrowser = () => {
|
|
17
15
|
const g = globalThis;
|
|
18
16
|
return typeof g.window !== "undefined" && typeof g.document !== "undefined";
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
}, isProduction = () => {
|
|
18
|
+
return false;
|
|
19
|
+
}, isDevelopment = () => {
|
|
20
|
+
return true;
|
|
21
|
+
}, isInteractiveTTY = () => {
|
|
22
|
+
return Boolean(process.stdout && process.stdout.isTTY);
|
|
23
|
+
}, detectOutputFormat = () => {
|
|
24
|
+
if (isBrowser()) {
|
|
25
|
+
return "browser";
|
|
26
|
+
}
|
|
27
|
+
if (process.env.LOG_FORMAT === "json") {
|
|
28
|
+
return "json-single-line";
|
|
29
|
+
}
|
|
30
|
+
if (process.env.LOG_PRETTY === "true" && isDevelopment()) {
|
|
31
|
+
return "json-pretty";
|
|
32
|
+
}
|
|
33
|
+
const colorPreference = (process.env.LOG_COLOR ?? "auto").toLowerCase();
|
|
34
|
+
if (colorPreference === "always" && !isProduction()) {
|
|
35
|
+
return "color-tty";
|
|
36
|
+
}
|
|
37
|
+
if (colorPreference === "never") {
|
|
38
|
+
return "json-single-line";
|
|
39
|
+
}
|
|
40
|
+
if (isProduction()) {
|
|
41
|
+
return "json-single-line";
|
|
42
|
+
}
|
|
43
|
+
if (isDevelopment() && isInteractiveTTY()) {
|
|
44
|
+
return "color-tty";
|
|
45
|
+
}
|
|
46
|
+
return "json-single-line";
|
|
47
|
+
}, colors, getLevelColor = (level) => {
|
|
27
48
|
switch (level) {
|
|
28
49
|
case "debug":
|
|
29
50
|
return colors.blue;
|
|
@@ -36,7 +57,7 @@ var hasProcess = () => {
|
|
|
36
57
|
default:
|
|
37
58
|
return colors.reset;
|
|
38
59
|
}
|
|
39
|
-
},
|
|
60
|
+
}, formatBrowserOutput = (level, message, context) => {
|
|
40
61
|
const timestamp = new Date().toISOString();
|
|
41
62
|
const levelUpper = level.toUpperCase();
|
|
42
63
|
const consoleMethod = getConsoleMethod(level);
|
|
@@ -45,22 +66,37 @@ var hasProcess = () => {
|
|
|
45
66
|
} else {
|
|
46
67
|
consoleMethod(`[${timestamp}] ${levelUpper}`, message);
|
|
47
68
|
}
|
|
48
|
-
},
|
|
69
|
+
}, formatColorTTY = (level, message, context) => {
|
|
70
|
+
const timestamp = new Date().toISOString();
|
|
71
|
+
const levelColor = getLevelColor(level);
|
|
72
|
+
const levelUpper = level.toUpperCase().padEnd(5);
|
|
49
73
|
const consoleMethod = getConsoleMethod(level);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const levelUpper = level.toUpperCase().padEnd(5);
|
|
54
|
-
const coloredPrefix = `${colors.dim}[${timestamp}]${colors.reset} ${levelColor}${levelUpper}${colors.reset}`;
|
|
55
|
-
if (context && Object.keys(context).length > 0) {
|
|
56
|
-
consoleMethod(`${coloredPrefix} ${message}`, context);
|
|
57
|
-
} else {
|
|
58
|
-
consoleMethod(`${coloredPrefix} ${message}`);
|
|
59
|
-
}
|
|
74
|
+
const coloredPrefix = `${colors.dim}[${timestamp}]${colors.reset} ${levelColor}${levelUpper}${colors.reset}`;
|
|
75
|
+
if (context && Object.keys(context).length > 0) {
|
|
76
|
+
consoleMethod(`${coloredPrefix} ${message}`, context);
|
|
60
77
|
} else {
|
|
61
|
-
|
|
62
|
-
consoleMethod(formatted);
|
|
78
|
+
consoleMethod(`${coloredPrefix} ${message}`);
|
|
63
79
|
}
|
|
80
|
+
}, formatJSONSingleLine = (level, message, context) => {
|
|
81
|
+
const timestamp = new Date().toISOString();
|
|
82
|
+
const logEntry = {
|
|
83
|
+
timestamp,
|
|
84
|
+
level: level.toUpperCase(),
|
|
85
|
+
message,
|
|
86
|
+
...context && Object.keys(context).length > 0 && { context }
|
|
87
|
+
};
|
|
88
|
+
const consoleMethod = getConsoleMethod(level);
|
|
89
|
+
consoleMethod(JSON.stringify(logEntry));
|
|
90
|
+
}, formatJSONPretty = (level, message, context) => {
|
|
91
|
+
const timestamp = new Date().toISOString();
|
|
92
|
+
const logEntry = {
|
|
93
|
+
timestamp,
|
|
94
|
+
level: level.toUpperCase(),
|
|
95
|
+
message,
|
|
96
|
+
...context && Object.keys(context).length > 0 && { context }
|
|
97
|
+
};
|
|
98
|
+
const consoleMethod = getConsoleMethod(level);
|
|
99
|
+
consoleMethod(JSON.stringify(logEntry, null, 2));
|
|
64
100
|
}, getConsoleMethod = (level) => {
|
|
65
101
|
switch (level) {
|
|
66
102
|
case "debug":
|
|
@@ -74,26 +110,24 @@ var hasProcess = () => {
|
|
|
74
110
|
default:
|
|
75
111
|
return console.log;
|
|
76
112
|
}
|
|
77
|
-
}, formatLog = (level, message, context) => {
|
|
78
|
-
const timestamp = new Date().toISOString();
|
|
79
|
-
const logEntry = {
|
|
80
|
-
timestamp,
|
|
81
|
-
level: level.toUpperCase(),
|
|
82
|
-
message,
|
|
83
|
-
...context && Object.keys(context).length > 0 && { context }
|
|
84
|
-
};
|
|
85
|
-
if (true) {
|
|
86
|
-
return JSON.stringify(logEntry, null, 2);
|
|
87
|
-
}
|
|
88
|
-
return JSON.stringify(logEntry);
|
|
89
113
|
}, performLog = (level, message, context) => {
|
|
90
|
-
if (level === "debug" &&
|
|
114
|
+
if (level === "debug" && isProduction()) {
|
|
91
115
|
return;
|
|
92
116
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
117
|
+
const outputFormat = detectOutputFormat();
|
|
118
|
+
switch (outputFormat) {
|
|
119
|
+
case "browser":
|
|
120
|
+
formatBrowserOutput(level, message, context);
|
|
121
|
+
break;
|
|
122
|
+
case "color-tty":
|
|
123
|
+
formatColorTTY(level, message, context);
|
|
124
|
+
break;
|
|
125
|
+
case "json-single-line":
|
|
126
|
+
formatJSONSingleLine(level, message, context);
|
|
127
|
+
break;
|
|
128
|
+
case "json-pretty":
|
|
129
|
+
formatJSONPretty(level, message, context);
|
|
130
|
+
break;
|
|
97
131
|
}
|
|
98
132
|
}, createLogger = () => {
|
|
99
133
|
return {
|
|
@@ -1475,801 +1509,18 @@ function createLevelsNamespace(client) {
|
|
|
1475
1509
|
}
|
|
1476
1510
|
var init_levels = () => {};
|
|
1477
1511
|
|
|
1478
|
-
// ../
|
|
1479
|
-
|
|
1480
|
-
boolean,
|
|
1481
|
-
jsonb,
|
|
1482
|
-
pgEnum,
|
|
1483
|
-
pgTable,
|
|
1484
|
-
text,
|
|
1485
|
-
timestamp,
|
|
1486
|
-
uniqueIndex,
|
|
1487
|
-
uuid,
|
|
1488
|
-
varchar
|
|
1489
|
-
} from "drizzle-orm/pg-core";
|
|
1490
|
-
var gamePlatformEnum, gameBootModeEnum, gameTypeEnum, games, gameSessions, gameStates, deploymentProviderEnum, gameBackendDeployments;
|
|
1491
|
-
var init_table = __esm(() => {
|
|
1492
|
-
init_table3();
|
|
1493
|
-
init_table4();
|
|
1494
|
-
gamePlatformEnum = pgEnum("game_platform", ["web", "godot", "unity"]);
|
|
1495
|
-
gameBootModeEnum = pgEnum("game_boot_mode", ["iframe", "module"]);
|
|
1496
|
-
gameTypeEnum = pgEnum("game_type", ["hosted", "external"]);
|
|
1497
|
-
games = pgTable("games", {
|
|
1498
|
-
id: uuid("id").primaryKey().defaultRandom(),
|
|
1499
|
-
developerId: text("developer_id").references(() => users.id, {
|
|
1500
|
-
onDelete: "set null"
|
|
1501
|
-
}),
|
|
1502
|
-
slug: varchar("slug", { length: 255 }).notNull().unique(),
|
|
1503
|
-
displayName: varchar("display_name", { length: 255 }).notNull(),
|
|
1504
|
-
version: varchar("version", { length: 50 }).notNull(),
|
|
1505
|
-
gameType: gameTypeEnum("game_type").notNull().default("hosted"),
|
|
1506
|
-
assetBundleBase: text("asset_bundle_base"),
|
|
1507
|
-
externalUrl: text("external_url"),
|
|
1508
|
-
platform: gamePlatformEnum("platform").notNull().default("web"),
|
|
1509
|
-
mapElementId: uuid("map_element_id").references(() => mapElements.id, {
|
|
1510
|
-
onDelete: "set null"
|
|
1511
|
-
}),
|
|
1512
|
-
metadata: jsonb("metadata").$type().notNull().default({}),
|
|
1513
|
-
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
|
|
1514
|
-
updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow()
|
|
1515
|
-
});
|
|
1516
|
-
gameSessions = pgTable("game_sessions", {
|
|
1517
|
-
id: uuid("id").primaryKey().defaultRandom(),
|
|
1518
|
-
userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
1519
|
-
gameId: uuid("game_id").notNull().references(() => games.id, { onDelete: "cascade" }),
|
|
1520
|
-
startedAt: timestamp("started_at", { withTimezone: true }).notNull().defaultNow(),
|
|
1521
|
-
endedAt: timestamp("ended_at", { withTimezone: true })
|
|
1522
|
-
});
|
|
1523
|
-
gameStates = pgTable("game_states", {
|
|
1524
|
-
userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
1525
|
-
gameId: uuid("game_id").notNull().references(() => games.id, { onDelete: "cascade" }),
|
|
1526
|
-
data: jsonb("data").default("{}"),
|
|
1527
|
-
updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow()
|
|
1528
|
-
}, (table) => [uniqueIndex("unique_user_game_idx").on(table.userId, table.gameId)]);
|
|
1529
|
-
deploymentProviderEnum = pgEnum("deployment_provider", ["cloudflare", "aws"]);
|
|
1530
|
-
gameBackendDeployments = pgTable("game_backend_deployments", {
|
|
1531
|
-
id: uuid("id").primaryKey().defaultRandom(),
|
|
1532
|
-
gameId: uuid("game_id").notNull().references(() => games.id, { onDelete: "cascade" }),
|
|
1533
|
-
deploymentId: text("deployment_id").notNull(),
|
|
1534
|
-
provider: deploymentProviderEnum("provider").notNull(),
|
|
1535
|
-
url: text("url").notNull(),
|
|
1536
|
-
codeHash: text("code_hash"),
|
|
1537
|
-
isActive: boolean("is_active").notNull().default(false),
|
|
1538
|
-
deployedAt: timestamp("deployed_at", { withTimezone: true }).notNull().defaultNow()
|
|
1539
|
-
});
|
|
1540
|
-
});
|
|
1541
|
-
|
|
1542
|
-
// ../data/src/domains/inventory/table.ts
|
|
1543
|
-
import { relations, sql } from "drizzle-orm";
|
|
1544
|
-
import {
|
|
1545
|
-
boolean as boolean2,
|
|
1546
|
-
integer,
|
|
1547
|
-
jsonb as jsonb2,
|
|
1548
|
-
pgEnum as pgEnum2,
|
|
1549
|
-
pgTable as pgTable2,
|
|
1550
|
-
text as text2,
|
|
1551
|
-
timestamp as timestamp2,
|
|
1552
|
-
uniqueIndex as uniqueIndex2,
|
|
1553
|
-
uuid as uuid2
|
|
1554
|
-
} from "drizzle-orm/pg-core";
|
|
1555
|
-
var itemTypeEnum, items, inventoryItems, currencies, shopListings, itemsRelations, currenciesRelations, shopListingsRelations, inventoryItemsRelations;
|
|
1556
|
-
var init_table2 = __esm(() => {
|
|
1557
|
-
init_table();
|
|
1558
|
-
init_table3();
|
|
1559
|
-
init_table4();
|
|
1560
|
-
itemTypeEnum = pgEnum2("item_type", [
|
|
1561
|
-
"currency",
|
|
1562
|
-
"badge",
|
|
1563
|
-
"trophy",
|
|
1564
|
-
"collectible",
|
|
1565
|
-
"consumable",
|
|
1566
|
-
"unlock",
|
|
1567
|
-
"upgrade",
|
|
1568
|
-
"accessory",
|
|
1569
|
-
"other"
|
|
1570
|
-
]);
|
|
1571
|
-
items = pgTable2("items", {
|
|
1572
|
-
id: uuid2("id").primaryKey().defaultRandom(),
|
|
1573
|
-
slug: text2("slug").notNull(),
|
|
1574
|
-
gameId: uuid2("game_id").references(() => games.id, {
|
|
1575
|
-
onDelete: "cascade"
|
|
1576
|
-
}),
|
|
1577
|
-
displayName: text2("display_name").notNull(),
|
|
1578
|
-
description: text2("description"),
|
|
1579
|
-
type: itemTypeEnum("type").notNull().default("other"),
|
|
1580
|
-
isPlaceable: boolean2("is_placeable").default(false).notNull(),
|
|
1581
|
-
imageUrl: text2("image_url"),
|
|
1582
|
-
metadata: jsonb2("metadata").default({}),
|
|
1583
|
-
createdAt: timestamp2("created_at").defaultNow().notNull()
|
|
1584
|
-
}, (table) => [
|
|
1585
|
-
uniqueIndex2("items_game_slug_idx").on(table.gameId, table.slug),
|
|
1586
|
-
uniqueIndex2("items_global_slug_idx").on(table.slug).where(sql`game_id IS NULL`)
|
|
1587
|
-
]);
|
|
1588
|
-
inventoryItems = pgTable2("inventory_items", {
|
|
1589
|
-
id: uuid2("id").primaryKey().defaultRandom(),
|
|
1590
|
-
userId: text2("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
1591
|
-
itemId: uuid2("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
|
|
1592
|
-
quantity: integer("quantity").notNull().default(1),
|
|
1593
|
-
updatedAt: timestamp2("updated_at", { withTimezone: true }).defaultNow()
|
|
1594
|
-
}, (table) => [uniqueIndex2("unique_user_item_idx").on(table.userId, table.itemId)]);
|
|
1595
|
-
currencies = pgTable2("currencies", {
|
|
1596
|
-
id: uuid2("id").primaryKey().defaultRandom(),
|
|
1597
|
-
itemId: uuid2("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
|
|
1598
|
-
symbol: text2("symbol"),
|
|
1599
|
-
isPrimary: boolean2("is_primary").default(false).notNull(),
|
|
1600
|
-
createdAt: timestamp2("created_at").defaultNow().notNull(),
|
|
1601
|
-
updatedAt: timestamp2("updated_at", { withTimezone: true }).defaultNow().$onUpdate(() => new Date)
|
|
1602
|
-
}, (table) => [uniqueIndex2("currency_item_id_idx").on(table.itemId)]);
|
|
1603
|
-
shopListings = pgTable2("shop_listings", {
|
|
1604
|
-
id: uuid2("id").primaryKey().defaultRandom(),
|
|
1605
|
-
itemId: uuid2("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
|
|
1606
|
-
currencyId: uuid2("currency_id").notNull().references(() => currencies.id, { onDelete: "restrict" }),
|
|
1607
|
-
price: integer("price").notNull(),
|
|
1608
|
-
sellBackPercentage: integer("sell_back_percentage"),
|
|
1609
|
-
stock: integer("stock"),
|
|
1610
|
-
isActive: boolean2("is_active").default(true).notNull(),
|
|
1611
|
-
availableFrom: timestamp2("available_from", { withTimezone: true }),
|
|
1612
|
-
availableUntil: timestamp2("available_until", { withTimezone: true }),
|
|
1613
|
-
createdAt: timestamp2("created_at").defaultNow().notNull(),
|
|
1614
|
-
updatedAt: timestamp2("updated_at", { withTimezone: true }).defaultNow().$onUpdate(() => new Date)
|
|
1615
|
-
}, (table) => [uniqueIndex2("unique_item_currency_listing_idx").on(table.itemId, table.currencyId)]);
|
|
1616
|
-
itemsRelations = relations(items, ({ many }) => ({
|
|
1617
|
-
shopListings: many(shopListings),
|
|
1618
|
-
inventoryItems: many(inventoryItems),
|
|
1619
|
-
mapObjects: many(mapObjects)
|
|
1620
|
-
}));
|
|
1621
|
-
currenciesRelations = relations(currencies, ({ many }) => ({
|
|
1622
|
-
shopListings: many(shopListings)
|
|
1623
|
-
}));
|
|
1624
|
-
shopListingsRelations = relations(shopListings, ({ one }) => ({
|
|
1625
|
-
item: one(items, {
|
|
1626
|
-
fields: [shopListings.itemId],
|
|
1627
|
-
references: [items.id]
|
|
1628
|
-
}),
|
|
1629
|
-
currency: one(currencies, {
|
|
1630
|
-
fields: [shopListings.currencyId],
|
|
1631
|
-
references: [currencies.id]
|
|
1632
|
-
})
|
|
1633
|
-
}));
|
|
1634
|
-
inventoryItemsRelations = relations(inventoryItems, ({ one }) => ({
|
|
1635
|
-
item: one(items, {
|
|
1636
|
-
fields: [inventoryItems.itemId],
|
|
1637
|
-
references: [items.id]
|
|
1638
|
-
}),
|
|
1639
|
-
user: one(users, {
|
|
1640
|
-
fields: [inventoryItems.userId],
|
|
1641
|
-
references: [users.id]
|
|
1642
|
-
})
|
|
1643
|
-
}));
|
|
1644
|
-
});
|
|
1645
|
-
|
|
1646
|
-
// ../data/src/domains/map/table.ts
|
|
1647
|
-
import { relations as relations2 } from "drizzle-orm";
|
|
1648
|
-
import {
|
|
1649
|
-
doublePrecision,
|
|
1650
|
-
index,
|
|
1651
|
-
integer as integer2,
|
|
1652
|
-
jsonb as jsonb3,
|
|
1653
|
-
pgEnum as pgEnum3,
|
|
1654
|
-
pgTable as pgTable3,
|
|
1655
|
-
text as text3,
|
|
1656
|
-
timestamp as timestamp3,
|
|
1657
|
-
uniqueIndex as uniqueIndex3,
|
|
1658
|
-
uuid as uuid3,
|
|
1659
|
-
varchar as varchar2
|
|
1660
|
-
} from "drizzle-orm/pg-core";
|
|
1661
|
-
var interactionTypeEnum, maps, mapElements, mapObjects, mapElementsRelations, mapsRelations, mapObjectsRelations;
|
|
1662
|
-
var init_table3 = __esm(() => {
|
|
1663
|
-
init_table();
|
|
1664
|
-
init_table2();
|
|
1665
|
-
init_table4();
|
|
1666
|
-
interactionTypeEnum = pgEnum3("interaction_type", [
|
|
1667
|
-
"game_entry",
|
|
1668
|
-
"game_registry",
|
|
1669
|
-
"info",
|
|
1670
|
-
"teleport",
|
|
1671
|
-
"door_in",
|
|
1672
|
-
"door_out",
|
|
1673
|
-
"npc_interaction",
|
|
1674
|
-
"quest_trigger"
|
|
1675
|
-
]);
|
|
1676
|
-
maps = pgTable3("maps", {
|
|
1677
|
-
id: uuid3("id").primaryKey().defaultRandom(),
|
|
1678
|
-
identifier: varchar2("identifier", { length: 255 }).notNull().unique(),
|
|
1679
|
-
displayName: varchar2("display_name", { length: 255 }).notNull(),
|
|
1680
|
-
filePath: varchar2("file_path", { length: 255 }).notNull(),
|
|
1681
|
-
tilesetBasePath: varchar2("tileset_base_path", { length: 255 }).notNull().default("/tilesets"),
|
|
1682
|
-
defaultSpawnTileX: doublePrecision("default_spawn_tile_x").notNull().default(0),
|
|
1683
|
-
defaultSpawnTileY: doublePrecision("default_spawn_tile_y").notNull().default(0),
|
|
1684
|
-
description: text3("description")
|
|
1685
|
-
});
|
|
1686
|
-
mapElements = pgTable3("map_elements", {
|
|
1687
|
-
id: uuid3("id").primaryKey().defaultRandom(),
|
|
1688
|
-
mapId: uuid3("map_id").references(() => maps.id, {
|
|
1689
|
-
onDelete: "cascade"
|
|
1690
|
-
}),
|
|
1691
|
-
elementSlug: varchar2("element_slug", { length: 255 }).notNull(),
|
|
1692
|
-
interactionType: interactionTypeEnum("interaction_type").notNull(),
|
|
1693
|
-
gameId: uuid3("game_id").references(() => games.id, {
|
|
1694
|
-
onDelete: "set null"
|
|
1695
|
-
}),
|
|
1696
|
-
metadata: jsonb3("metadata").$type().default({})
|
|
1697
|
-
}, (table) => [uniqueIndex3("map_id_element_slug_unique_idx").on(table.mapId, table.elementSlug)]);
|
|
1698
|
-
mapObjects = pgTable3("map_objects", {
|
|
1699
|
-
id: uuid3("id").primaryKey().defaultRandom(),
|
|
1700
|
-
userId: text3("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
1701
|
-
mapId: uuid3("map_id").notNull().references(() => maps.id, { onDelete: "cascade" }),
|
|
1702
|
-
itemId: uuid3("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
|
|
1703
|
-
worldX: doublePrecision("world_x").notNull(),
|
|
1704
|
-
worldY: doublePrecision("world_y").notNull(),
|
|
1705
|
-
rotation: integer2("rotation").default(0).notNull(),
|
|
1706
|
-
scale: doublePrecision("scale").default(1).notNull(),
|
|
1707
|
-
createdAt: timestamp3("created_at").defaultNow().notNull()
|
|
1708
|
-
}, (table) => [
|
|
1709
|
-
index("map_objects_map_idx").on(table.mapId),
|
|
1710
|
-
index("map_objects_spatial_idx").on(table.mapId, table.worldX, table.worldY)
|
|
1711
|
-
]);
|
|
1712
|
-
mapElementsRelations = relations2(mapElements, ({ one }) => ({
|
|
1713
|
-
game: one(games, {
|
|
1714
|
-
fields: [mapElements.gameId],
|
|
1715
|
-
references: [games.id]
|
|
1716
|
-
}),
|
|
1717
|
-
map: one(maps, {
|
|
1718
|
-
fields: [mapElements.mapId],
|
|
1719
|
-
references: [maps.id]
|
|
1720
|
-
})
|
|
1721
|
-
}));
|
|
1722
|
-
mapsRelations = relations2(maps, ({ many }) => ({
|
|
1723
|
-
elements: many(mapElements),
|
|
1724
|
-
objects: many(mapObjects)
|
|
1725
|
-
}));
|
|
1726
|
-
mapObjectsRelations = relations2(mapObjects, ({ one }) => ({
|
|
1727
|
-
user: one(users, {
|
|
1728
|
-
fields: [mapObjects.userId],
|
|
1729
|
-
references: [users.id]
|
|
1730
|
-
}),
|
|
1731
|
-
map: one(maps, {
|
|
1732
|
-
fields: [mapObjects.mapId],
|
|
1733
|
-
references: [maps.id]
|
|
1734
|
-
}),
|
|
1735
|
-
item: one(items, {
|
|
1736
|
-
fields: [mapObjects.itemId],
|
|
1737
|
-
references: [items.id]
|
|
1738
|
-
})
|
|
1739
|
-
}));
|
|
1740
|
-
});
|
|
1741
|
-
|
|
1742
|
-
// ../data/src/domains/user/table.ts
|
|
1743
|
-
import { relations as relations3 } from "drizzle-orm";
|
|
1744
|
-
import { boolean as boolean3, pgEnum as pgEnum4, pgTable as pgTable4, text as text4, timestamp as timestamp4, uniqueIndex as uniqueIndex4 } from "drizzle-orm/pg-core";
|
|
1745
|
-
var userRoleEnum, developerStatusEnum, users, accounts, sessions, verification, ssoProvider, usersRelations;
|
|
1746
|
-
var init_table4 = __esm(() => {
|
|
1747
|
-
init_table3();
|
|
1748
|
-
userRoleEnum = pgEnum4("user_role", ["admin", "player", "developer"]);
|
|
1749
|
-
developerStatusEnum = pgEnum4("developer_status", ["none", "pending", "approved"]);
|
|
1750
|
-
users = pgTable4("user", {
|
|
1751
|
-
id: text4("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
|
|
1752
|
-
name: text4("name").notNull(),
|
|
1753
|
-
username: text4("username").unique(),
|
|
1754
|
-
email: text4("email").notNull().unique(),
|
|
1755
|
-
timebackId: text4("timeback_id").unique(),
|
|
1756
|
-
emailVerified: boolean3("email_verified").notNull().default(false),
|
|
1757
|
-
image: text4("image"),
|
|
1758
|
-
role: userRoleEnum("role").notNull().default("player"),
|
|
1759
|
-
developerStatus: developerStatusEnum("developer_status").notNull().default("none"),
|
|
1760
|
-
characterCreated: boolean3("character_created").notNull().default(false),
|
|
1761
|
-
createdAt: timestamp4("created_at", {
|
|
1762
|
-
mode: "date",
|
|
1763
|
-
withTimezone: true
|
|
1764
|
-
}).notNull(),
|
|
1765
|
-
updatedAt: timestamp4("updated_at", {
|
|
1766
|
-
mode: "date",
|
|
1767
|
-
withTimezone: true
|
|
1768
|
-
}).notNull()
|
|
1769
|
-
});
|
|
1770
|
-
accounts = pgTable4("account", {
|
|
1771
|
-
id: text4("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
|
|
1772
|
-
userId: text4("userId").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
1773
|
-
accountId: text4("account_id").notNull(),
|
|
1774
|
-
providerId: text4("provider_id").notNull(),
|
|
1775
|
-
accessToken: text4("access_token"),
|
|
1776
|
-
refreshToken: text4("refresh_token"),
|
|
1777
|
-
idToken: text4("id_token"),
|
|
1778
|
-
accessTokenExpiresAt: timestamp4("access_token_expires_at", {
|
|
1779
|
-
mode: "date",
|
|
1780
|
-
withTimezone: true
|
|
1781
|
-
}),
|
|
1782
|
-
refreshTokenExpiresAt: timestamp4("refresh_token_expires_at", {
|
|
1783
|
-
mode: "date",
|
|
1784
|
-
withTimezone: true
|
|
1785
|
-
}),
|
|
1786
|
-
scope: text4("scope"),
|
|
1787
|
-
password: text4("password"),
|
|
1788
|
-
createdAt: timestamp4("created_at", {
|
|
1789
|
-
mode: "date",
|
|
1790
|
-
withTimezone: true
|
|
1791
|
-
}).notNull(),
|
|
1792
|
-
updatedAt: timestamp4("updated_at", {
|
|
1793
|
-
mode: "date",
|
|
1794
|
-
withTimezone: true
|
|
1795
|
-
}).notNull()
|
|
1796
|
-
}, (table) => [uniqueIndex4("account_provider_providerId_idx").on(table.accountId, table.providerId)]);
|
|
1797
|
-
sessions = pgTable4("session", {
|
|
1798
|
-
id: text4("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
|
|
1799
|
-
userId: text4("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
1800
|
-
expiresAt: timestamp4("expires_at", {
|
|
1801
|
-
mode: "date",
|
|
1802
|
-
withTimezone: true
|
|
1803
|
-
}).notNull(),
|
|
1804
|
-
token: text4("token").notNull().unique(),
|
|
1805
|
-
ipAddress: text4("ip_address"),
|
|
1806
|
-
userAgent: text4("user_agent"),
|
|
1807
|
-
createdAt: timestamp4("created_at", {
|
|
1808
|
-
mode: "date",
|
|
1809
|
-
withTimezone: true
|
|
1810
|
-
}).notNull(),
|
|
1811
|
-
updatedAt: timestamp4("updated_at", {
|
|
1812
|
-
mode: "date",
|
|
1813
|
-
withTimezone: true
|
|
1814
|
-
}).notNull()
|
|
1815
|
-
});
|
|
1816
|
-
verification = pgTable4("verification", {
|
|
1817
|
-
id: text4("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
|
|
1818
|
-
identifier: text4("identifier").notNull(),
|
|
1819
|
-
value: text4("value").notNull(),
|
|
1820
|
-
expiresAt: timestamp4("expires_at", {
|
|
1821
|
-
mode: "date",
|
|
1822
|
-
withTimezone: true
|
|
1823
|
-
}).notNull(),
|
|
1824
|
-
createdAt: timestamp4("created_at", {
|
|
1825
|
-
mode: "date",
|
|
1826
|
-
withTimezone: true
|
|
1827
|
-
}).notNull(),
|
|
1828
|
-
updatedAt: timestamp4("updated_at", {
|
|
1829
|
-
mode: "date",
|
|
1830
|
-
withTimezone: true
|
|
1831
|
-
}).notNull()
|
|
1832
|
-
});
|
|
1833
|
-
ssoProvider = pgTable4("sso_provider", {
|
|
1834
|
-
id: text4("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
|
|
1835
|
-
issuer: text4("issuer").notNull(),
|
|
1836
|
-
oidcConfig: text4("oidc_config"),
|
|
1837
|
-
samlConfig: text4("saml_config"),
|
|
1838
|
-
userId: text4("user_id").references(() => users.id, { onDelete: "cascade" }),
|
|
1839
|
-
providerId: text4("provider_id").notNull().unique(),
|
|
1840
|
-
organizationId: text4("organization_id"),
|
|
1841
|
-
domain: text4("domain").notNull()
|
|
1842
|
-
});
|
|
1843
|
-
usersRelations = relations3(users, ({ many }) => ({
|
|
1844
|
-
mapObjects: many(mapObjects)
|
|
1845
|
-
}));
|
|
1846
|
-
});
|
|
1847
|
-
|
|
1848
|
-
// ../data/src/domains/developer/table.ts
|
|
1849
|
-
import { boolean as boolean4, integer as integer3, pgTable as pgTable5, text as text5, timestamp as timestamp5, uuid as uuid4 } from "drizzle-orm/pg-core";
|
|
1850
|
-
var apikey;
|
|
1851
|
-
var init_table5 = __esm(() => {
|
|
1852
|
-
init_table4();
|
|
1853
|
-
apikey = pgTable5("api_key", {
|
|
1854
|
-
id: uuid4("id").primaryKey().defaultRandom(),
|
|
1855
|
-
name: text5("name"),
|
|
1856
|
-
start: text5("start"),
|
|
1857
|
-
prefix: text5("prefix"),
|
|
1858
|
-
key: text5("key").notNull(),
|
|
1859
|
-
userId: text5("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
1860
|
-
refillInterval: integer3("refill_interval"),
|
|
1861
|
-
refillAmount: integer3("refill_amount"),
|
|
1862
|
-
lastRefillAt: timestamp5("last_refill_at", { withTimezone: true }),
|
|
1863
|
-
enabled: boolean4("enabled").notNull().default(true),
|
|
1864
|
-
rateLimitEnabled: boolean4("rate_limit_enabled").notNull().default(false),
|
|
1865
|
-
rateLimitTimeWindow: integer3("rate_limit_time_window"),
|
|
1866
|
-
rateLimitMax: integer3("rate_limit_max"),
|
|
1867
|
-
requestCount: integer3("request_count").notNull().default(0),
|
|
1868
|
-
remaining: integer3("remaining"),
|
|
1869
|
-
lastRequest: timestamp5("last_request", { withTimezone: true }),
|
|
1870
|
-
expiresAt: timestamp5("expires_at", { withTimezone: true }),
|
|
1871
|
-
createdAt: timestamp5("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
1872
|
-
updatedAt: timestamp5("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
1873
|
-
permissions: text5("permissions"),
|
|
1874
|
-
metadata: text5("metadata")
|
|
1875
|
-
});
|
|
1876
|
-
});
|
|
1877
|
-
|
|
1878
|
-
// ../data/src/domains/level/table.ts
|
|
1879
|
-
import { relations as relations4 } from "drizzle-orm";
|
|
1880
|
-
import {
|
|
1881
|
-
doublePrecision as doublePrecision2,
|
|
1882
|
-
integer as integer4,
|
|
1883
|
-
pgTable as pgTable6,
|
|
1884
|
-
text as text6,
|
|
1885
|
-
timestamp as timestamp6,
|
|
1886
|
-
uniqueIndex as uniqueIndex5,
|
|
1887
|
-
uuid as uuid5
|
|
1888
|
-
} from "drizzle-orm/pg-core";
|
|
1889
|
-
var userLevels, levelConfigs, userLevelsRelations;
|
|
1890
|
-
var init_table6 = __esm(() => {
|
|
1891
|
-
init_table4();
|
|
1892
|
-
userLevels = pgTable6("user_levels", {
|
|
1893
|
-
userId: text6("user_id").primaryKey().references(() => users.id, { onDelete: "cascade" }),
|
|
1894
|
-
currentLevel: integer4("current_level").notNull().default(1),
|
|
1895
|
-
currentXp: doublePrecision2("current_xp").notNull().default(0),
|
|
1896
|
-
totalXP: doublePrecision2("total_xp").notNull().default(0),
|
|
1897
|
-
lastLevelUpAt: timestamp6("last_level_up_at", { withTimezone: true }),
|
|
1898
|
-
createdAt: timestamp6("created_at").defaultNow().notNull(),
|
|
1899
|
-
updatedAt: timestamp6("updated_at", { withTimezone: true }).defaultNow().$onUpdate(() => new Date)
|
|
1900
|
-
});
|
|
1901
|
-
levelConfigs = pgTable6("level_configs", {
|
|
1902
|
-
id: uuid5("id").primaryKey().defaultRandom(),
|
|
1903
|
-
level: integer4("level").notNull().unique(),
|
|
1904
|
-
xpRequired: integer4("xp_required").notNull(),
|
|
1905
|
-
creditsReward: integer4("credits_reward").notNull().default(0),
|
|
1906
|
-
createdAt: timestamp6("created_at").defaultNow().notNull()
|
|
1907
|
-
}, (table) => [uniqueIndex5("unique_level_config_idx").on(table.level)]);
|
|
1908
|
-
userLevelsRelations = relations4(userLevels, ({ one }) => ({
|
|
1909
|
-
user: one(users, {
|
|
1910
|
-
fields: [userLevels.userId],
|
|
1911
|
-
references: [users.id]
|
|
1912
|
-
})
|
|
1913
|
-
}));
|
|
1914
|
-
});
|
|
1915
|
-
|
|
1916
|
-
// ../data/src/domains/leaderboard/table.ts
|
|
1917
|
-
import { relations as relations5 } from "drizzle-orm";
|
|
1918
|
-
import { index as index2, integer as integer5, jsonb as jsonb4, pgTable as pgTable7, text as text7, timestamp as timestamp7, uuid as uuid6 } from "drizzle-orm/pg-core";
|
|
1919
|
-
var gameScores, gameScoresRelations;
|
|
1920
|
-
var init_table7 = __esm(() => {
|
|
1921
|
-
init_table();
|
|
1922
|
-
init_table4();
|
|
1923
|
-
gameScores = pgTable7("game_scores", {
|
|
1924
|
-
id: uuid6("id").primaryKey().defaultRandom(),
|
|
1925
|
-
userId: text7("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
1926
|
-
gameId: uuid6("game_id").notNull().references(() => games.id, { onDelete: "cascade" }),
|
|
1927
|
-
score: integer5("score").notNull(),
|
|
1928
|
-
metadata: jsonb4("metadata").default("{}"),
|
|
1929
|
-
achievedAt: timestamp7("achieved_at", { withTimezone: true }).defaultNow().notNull(),
|
|
1930
|
-
sessionId: uuid6("session_id").references(() => gameSessions.id, { onDelete: "set null" })
|
|
1931
|
-
}, (table) => [
|
|
1932
|
-
index2("game_scores_user_game_idx").on(table.userId, table.gameId),
|
|
1933
|
-
index2("game_scores_game_score_idx").on(table.gameId, table.score),
|
|
1934
|
-
index2("game_scores_achieved_at_idx").on(table.achievedAt)
|
|
1935
|
-
]);
|
|
1936
|
-
gameScoresRelations = relations5(gameScores, ({ one }) => ({
|
|
1937
|
-
user: one(users, {
|
|
1938
|
-
fields: [gameScores.userId],
|
|
1939
|
-
references: [users.id]
|
|
1940
|
-
}),
|
|
1941
|
-
game: one(games, {
|
|
1942
|
-
fields: [gameScores.gameId],
|
|
1943
|
-
references: [games.id]
|
|
1944
|
-
}),
|
|
1945
|
-
session: one(gameSessions, {
|
|
1946
|
-
fields: [gameScores.sessionId],
|
|
1947
|
-
references: [gameSessions.id]
|
|
1948
|
-
})
|
|
1949
|
-
}));
|
|
1950
|
-
});
|
|
1951
|
-
|
|
1952
|
-
// ../data/src/domains/sprite/table.ts
|
|
1953
|
-
import { relations as relations6 } from "drizzle-orm";
|
|
1954
|
-
import { integer as integer6, pgTable as pgTable8, timestamp as timestamp8, uuid as uuid7, varchar as varchar3 } from "drizzle-orm/pg-core";
|
|
1955
|
-
var spriteTemplates, spriteSheets, spriteTemplatesRelations, spriteSheetsRelations;
|
|
1956
|
-
var init_table8 = __esm(() => {
|
|
1957
|
-
spriteTemplates = pgTable8("sprite_templates", {
|
|
1958
|
-
id: uuid7("id").primaryKey().defaultRandom(),
|
|
1959
|
-
slug: varchar3("slug", { length: 64 }).notNull().unique(),
|
|
1960
|
-
url: varchar3("url", { length: 255 }).notNull(),
|
|
1961
|
-
createdAt: timestamp8("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
1962
|
-
updatedAt: timestamp8("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
1963
|
-
});
|
|
1964
|
-
spriteSheets = pgTable8("sprite_sheets", {
|
|
1965
|
-
id: uuid7("id").primaryKey().defaultRandom(),
|
|
1966
|
-
templateId: uuid7("template_id").notNull().references(() => spriteTemplates.id, { onDelete: "cascade" }),
|
|
1967
|
-
width: integer6("width").notNull(),
|
|
1968
|
-
height: integer6("height").notNull(),
|
|
1969
|
-
url: varchar3("url", { length: 255 }).notNull(),
|
|
1970
|
-
createdAt: timestamp8("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
1971
|
-
updatedAt: timestamp8("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
1972
|
-
});
|
|
1973
|
-
spriteTemplatesRelations = relations6(spriteTemplates, ({ many }) => ({
|
|
1974
|
-
sheets: many(spriteSheets)
|
|
1975
|
-
}));
|
|
1976
|
-
spriteSheetsRelations = relations6(spriteSheets, ({ one }) => ({
|
|
1977
|
-
template: one(spriteTemplates, {
|
|
1978
|
-
fields: [spriteSheets.templateId],
|
|
1979
|
-
references: [spriteTemplates.id]
|
|
1980
|
-
})
|
|
1981
|
-
}));
|
|
1982
|
-
});
|
|
1983
|
-
|
|
1984
|
-
// ../data/src/domains/character/table.ts
|
|
1985
|
-
import { relations as relations7 } from "drizzle-orm";
|
|
1986
|
-
import {
|
|
1987
|
-
integer as integer7,
|
|
1988
|
-
pgEnum as pgEnum5,
|
|
1989
|
-
pgTable as pgTable9,
|
|
1990
|
-
text as text8,
|
|
1991
|
-
timestamp as timestamp9,
|
|
1992
|
-
uniqueIndex as uniqueIndex6,
|
|
1993
|
-
uuid as uuid8,
|
|
1994
|
-
varchar as varchar4
|
|
1995
|
-
} from "drizzle-orm/pg-core";
|
|
1996
|
-
var characterComponentTypeEnum, characterComponents, playerCharacters, playerCharacterAccessories, characterComponentsRelations, playerCharactersRelations, playerCharacterAccessoriesRelations;
|
|
1997
|
-
var init_table9 = __esm(() => {
|
|
1998
|
-
init_table8();
|
|
1999
|
-
init_table4();
|
|
2000
|
-
characterComponentTypeEnum = pgEnum5("character_component_type", [
|
|
2001
|
-
"body",
|
|
2002
|
-
"outfit",
|
|
2003
|
-
"hairstyle",
|
|
2004
|
-
"eyes",
|
|
2005
|
-
"accessory"
|
|
2006
|
-
]);
|
|
2007
|
-
characterComponents = pgTable9("character_components", {
|
|
2008
|
-
id: uuid8("id").primaryKey().defaultRandom(),
|
|
2009
|
-
componentType: characterComponentTypeEnum("component_type").notNull(),
|
|
2010
|
-
slug: varchar4("slug", { length: 128 }).notNull().unique(),
|
|
2011
|
-
displayName: varchar4("display_name", { length: 128 }).notNull(),
|
|
2012
|
-
slot: varchar4("slot", { length: 64 }).notNull(),
|
|
2013
|
-
spriteSheetId: uuid8("sprite_sheet_id").notNull().references(() => spriteSheets.id, { onDelete: "cascade" }),
|
|
2014
|
-
unlockLevel: integer7("unlock_level").notNull().default(0),
|
|
2015
|
-
variant: integer7("variant").notNull().default(0),
|
|
2016
|
-
createdAt: timestamp9("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
2017
|
-
updatedAt: timestamp9("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
2018
|
-
});
|
|
2019
|
-
playerCharacters = pgTable9("player_characters", {
|
|
2020
|
-
id: uuid8("id").primaryKey().defaultRandom(),
|
|
2021
|
-
userId: text8("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
2022
|
-
bodyComponentId: uuid8("body_component_id").notNull().references(() => characterComponents.id, { onDelete: "restrict" }),
|
|
2023
|
-
eyesComponentId: uuid8("eyes_component_id").notNull().references(() => characterComponents.id, { onDelete: "restrict" }),
|
|
2024
|
-
hairstyleComponentId: uuid8("hairstyle_component_id").notNull().references(() => characterComponents.id, { onDelete: "restrict" }),
|
|
2025
|
-
outfitComponentId: uuid8("outfit_component_id").notNull().references(() => characterComponents.id, { onDelete: "restrict" }),
|
|
2026
|
-
createdAt: timestamp9("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
2027
|
-
updatedAt: timestamp9("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
2028
|
-
});
|
|
2029
|
-
playerCharacterAccessories = pgTable9("player_character_accessories", {
|
|
2030
|
-
id: uuid8("id").primaryKey().defaultRandom(),
|
|
2031
|
-
playerCharacterId: uuid8("player_character_id").notNull().references(() => playerCharacters.id, { onDelete: "cascade" }),
|
|
2032
|
-
accessoryComponentId: uuid8("accessory_component_id").notNull().references(() => characterComponents.id, { onDelete: "cascade" }),
|
|
2033
|
-
slot: varchar4("slot", { length: 64 }).notNull(),
|
|
2034
|
-
equippedAt: timestamp9("equipped_at", { withTimezone: true }).notNull().defaultNow(),
|
|
2035
|
-
updatedAt: timestamp9("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
2036
|
-
}, (table) => [
|
|
2037
|
-
uniqueIndex6("unique_player_character_slot_idx").on(table.playerCharacterId, table.slot),
|
|
2038
|
-
uniqueIndex6("player_character_accessory_idx").on(table.playerCharacterId, table.accessoryComponentId)
|
|
2039
|
-
]);
|
|
2040
|
-
characterComponentsRelations = relations7(characterComponents, ({ one }) => ({
|
|
2041
|
-
sheet: one(spriteSheets, {
|
|
2042
|
-
fields: [characterComponents.spriteSheetId],
|
|
2043
|
-
references: [spriteSheets.id]
|
|
2044
|
-
})
|
|
2045
|
-
}));
|
|
2046
|
-
playerCharactersRelations = relations7(playerCharacters, ({ one, many }) => ({
|
|
2047
|
-
user: one(users, {
|
|
2048
|
-
fields: [playerCharacters.userId],
|
|
2049
|
-
references: [users.id]
|
|
2050
|
-
}),
|
|
2051
|
-
body: one(characterComponents, {
|
|
2052
|
-
fields: [playerCharacters.bodyComponentId],
|
|
2053
|
-
references: [characterComponents.id]
|
|
2054
|
-
}),
|
|
2055
|
-
eyes: one(characterComponents, {
|
|
2056
|
-
fields: [playerCharacters.eyesComponentId],
|
|
2057
|
-
references: [characterComponents.id]
|
|
2058
|
-
}),
|
|
2059
|
-
hair: one(characterComponents, {
|
|
2060
|
-
fields: [playerCharacters.hairstyleComponentId],
|
|
2061
|
-
references: [characterComponents.id]
|
|
2062
|
-
}),
|
|
2063
|
-
outfit: one(characterComponents, {
|
|
2064
|
-
fields: [playerCharacters.outfitComponentId],
|
|
2065
|
-
references: [characterComponents.id]
|
|
2066
|
-
}),
|
|
2067
|
-
accessories: many(playerCharacterAccessories)
|
|
2068
|
-
}));
|
|
2069
|
-
playerCharacterAccessoriesRelations = relations7(playerCharacterAccessories, ({ one }) => ({
|
|
2070
|
-
playerCharacter: one(playerCharacters, {
|
|
2071
|
-
fields: [playerCharacterAccessories.playerCharacterId],
|
|
2072
|
-
references: [playerCharacters.id]
|
|
2073
|
-
}),
|
|
2074
|
-
accessoryComponent: one(characterComponents, {
|
|
2075
|
-
fields: [playerCharacterAccessories.accessoryComponentId],
|
|
2076
|
-
references: [characterComponents.id]
|
|
2077
|
-
})
|
|
2078
|
-
}));
|
|
2079
|
-
});
|
|
2080
|
-
|
|
2081
|
-
// ../data/src/domains/timeback/table.ts
|
|
2082
|
-
import { doublePrecision as doublePrecision3, pgTable as pgTable10, text as text9, timestamp as timestamp10, uniqueIndex as uniqueIndex7, uuid as uuid9 } from "drizzle-orm/pg-core";
|
|
2083
|
-
var timebackDailyXp, timebackXpEvents, gameTimebackIntegrations;
|
|
2084
|
-
var init_table10 = __esm(() => {
|
|
2085
|
-
init_table();
|
|
2086
|
-
init_table4();
|
|
2087
|
-
timebackDailyXp = pgTable10("timeback_daily_xp", {
|
|
2088
|
-
userId: text9("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
2089
|
-
date: timestamp10("date", { mode: "date", withTimezone: true }).notNull(),
|
|
2090
|
-
xp: doublePrecision3("xp").notNull().default(0),
|
|
2091
|
-
createdAt: timestamp10("created_at", { mode: "date", withTimezone: true }).notNull().defaultNow(),
|
|
2092
|
-
updatedAt: timestamp10("updated_at", { mode: "date", withTimezone: true }).notNull().defaultNow()
|
|
2093
|
-
}, (table) => [uniqueIndex7("timeback_daily_xp_user_date_idx").on(table.userId, table.date)]);
|
|
2094
|
-
timebackXpEvents = pgTable10("timeback_xp_event", {
|
|
2095
|
-
id: uuid9("id").primaryKey().defaultRandom(),
|
|
2096
|
-
userId: text9("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
2097
|
-
occurredAt: timestamp10("occurred_at", { withTimezone: true }).notNull(),
|
|
2098
|
-
xpDelta: doublePrecision3("xp_delta").notNull(),
|
|
2099
|
-
source: text9("source").notNull(),
|
|
2100
|
-
sourceId: text9("source_id"),
|
|
2101
|
-
sensor: text9("sensor"),
|
|
2102
|
-
appName: text9("app_name"),
|
|
2103
|
-
createdAt: timestamp10("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
2104
|
-
updatedAt: timestamp10("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
2105
|
-
}, (table) => [uniqueIndex7("timeback_xp_events_source_id_idx").on(table.source, table.sourceId)]);
|
|
2106
|
-
gameTimebackIntegrations = pgTable10("game_timeback_integrations", {
|
|
2107
|
-
id: uuid9("id").primaryKey().defaultRandom(),
|
|
2108
|
-
gameId: uuid9("game_id").notNull().unique().references(() => games.id, { onDelete: "cascade" }),
|
|
2109
|
-
courseId: text9("course_id").notNull(),
|
|
2110
|
-
lastVerifiedAt: timestamp10("last_verified_at", { withTimezone: true }),
|
|
2111
|
-
createdAt: timestamp10("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
2112
|
-
updatedAt: timestamp10("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
2113
|
-
});
|
|
2114
|
-
});
|
|
2115
|
-
|
|
2116
|
-
// ../data/src/domains/achievement/table.ts
|
|
2117
|
-
import { relations as relations8 } from "drizzle-orm";
|
|
2118
|
-
import {
|
|
2119
|
-
boolean as boolean5,
|
|
2120
|
-
index as index3,
|
|
2121
|
-
integer as integer8,
|
|
2122
|
-
jsonb as jsonb5,
|
|
2123
|
-
pgEnum as pgEnum6,
|
|
2124
|
-
pgTable as pgTable11,
|
|
2125
|
-
text as text10,
|
|
2126
|
-
timestamp as timestamp11,
|
|
2127
|
-
uniqueIndex as uniqueIndex8,
|
|
2128
|
-
uuid as uuid10,
|
|
2129
|
-
varchar as varchar5
|
|
2130
|
-
} from "drizzle-orm/pg-core";
|
|
2131
|
-
var achievementScopeEnum, achievements, userAchievementProgress, userAchievementClaims, userAchievementProgressRelations, userAchievementClaimsRelations;
|
|
2132
|
-
var init_table11 = __esm(() => {
|
|
2133
|
-
init_table4();
|
|
2134
|
-
achievementScopeEnum = pgEnum6("achievement_scope", [
|
|
2135
|
-
"daily",
|
|
2136
|
-
"weekly",
|
|
2137
|
-
"monthly",
|
|
2138
|
-
"yearly",
|
|
2139
|
-
"game",
|
|
2140
|
-
"global",
|
|
2141
|
-
"map",
|
|
2142
|
-
"level",
|
|
2143
|
-
"event"
|
|
2144
|
-
]);
|
|
2145
|
-
achievements = pgTable11("achievements", {
|
|
2146
|
-
id: varchar5("id", { length: 255 }).primaryKey(),
|
|
2147
|
-
title: varchar5("title", { length: 255 }).notNull(),
|
|
2148
|
-
description: text10("description"),
|
|
2149
|
-
scope: achievementScopeEnum("scope").notNull(),
|
|
2150
|
-
rewardCredits: integer8("reward_credits").notNull().default(0),
|
|
2151
|
-
limit: integer8("limit").notNull().default(1),
|
|
2152
|
-
completionType: varchar5("completion_type", { length: 50 }).notNull(),
|
|
2153
|
-
completionConfig: jsonb5("completion_config").notNull().default({}),
|
|
2154
|
-
target: jsonb5("target").notNull().default({}),
|
|
2155
|
-
active: boolean5("active").notNull().default(true),
|
|
2156
|
-
createdAt: timestamp11("created_at", { withTimezone: true }).defaultNow(),
|
|
2157
|
-
updatedAt: timestamp11("updated_at", { withTimezone: true }).defaultNow()
|
|
2158
|
-
});
|
|
2159
|
-
userAchievementProgress = pgTable11("user_achievement_progress", {
|
|
2160
|
-
id: uuid10("id").primaryKey().defaultRandom(),
|
|
2161
|
-
userId: text10("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
2162
|
-
achievementId: varchar5("achievement_id", { length: 255 }).notNull().references(() => achievements.id, { onDelete: "cascade" }),
|
|
2163
|
-
scopeKey: text10("scope_key").notNull(),
|
|
2164
|
-
progress: jsonb5("progress").notNull().default({}),
|
|
2165
|
-
updatedAt: timestamp11("updated_at", { withTimezone: true }).defaultNow().notNull()
|
|
2166
|
-
}, (table) => [
|
|
2167
|
-
index3("user_achievement_progress_idx").on(table.userId, table.achievementId, table.scopeKey)
|
|
2168
|
-
]);
|
|
2169
|
-
userAchievementClaims = pgTable11("user_achievement_claims", {
|
|
2170
|
-
id: uuid10("id").primaryKey().defaultRandom(),
|
|
2171
|
-
userId: text10("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
2172
|
-
achievementId: varchar5("achievement_id", { length: 255 }).notNull().references(() => achievements.id, { onDelete: "cascade" }),
|
|
2173
|
-
scopeKey: text10("scope_key").notNull(),
|
|
2174
|
-
rewardCredits: integer8("reward_credits").notNull(),
|
|
2175
|
-
createdAt: timestamp11("created_at", { withTimezone: true }).defaultNow().notNull()
|
|
2176
|
-
}, (table) => [
|
|
2177
|
-
uniqueIndex8("user_achievement_claims_unique").on(table.userId, table.achievementId, table.scopeKey)
|
|
2178
|
-
]);
|
|
2179
|
-
userAchievementProgressRelations = relations8(userAchievementProgress, ({ one }) => ({
|
|
2180
|
-
user: one(users, {
|
|
2181
|
-
fields: [userAchievementProgress.userId],
|
|
2182
|
-
references: [users.id]
|
|
2183
|
-
}),
|
|
2184
|
-
achievement: one(achievements, {
|
|
2185
|
-
fields: [userAchievementProgress.achievementId],
|
|
2186
|
-
references: [achievements.id]
|
|
2187
|
-
})
|
|
2188
|
-
}));
|
|
2189
|
-
userAchievementClaimsRelations = relations8(userAchievementClaims, ({ one }) => ({
|
|
2190
|
-
user: one(users, {
|
|
2191
|
-
fields: [userAchievementClaims.userId],
|
|
2192
|
-
references: [users.id]
|
|
2193
|
-
}),
|
|
2194
|
-
achievement: one(achievements, {
|
|
2195
|
-
fields: [userAchievementClaims.achievementId],
|
|
2196
|
-
references: [achievements.id]
|
|
2197
|
-
})
|
|
2198
|
-
}));
|
|
2199
|
-
});
|
|
1512
|
+
// ../constants/src/auth.ts
|
|
1513
|
+
var init_auth = () => {};
|
|
2200
1514
|
|
|
2201
|
-
// ../
|
|
2202
|
-
|
|
2203
|
-
import { index as index4, jsonb as jsonb6, pgEnum as pgEnum7, pgTable as pgTable12, text as text11, timestamp as timestamp12, uuid as uuid11, varchar as varchar6 } from "drizzle-orm/pg-core";
|
|
2204
|
-
var notificationPriorityEnum, notificationStatusEnum, notifications, notificationsRelations;
|
|
2205
|
-
var init_table12 = __esm(() => {
|
|
2206
|
-
init_table4();
|
|
2207
|
-
notificationPriorityEnum = pgEnum7("notification_priority", [
|
|
2208
|
-
"low",
|
|
2209
|
-
"normal",
|
|
2210
|
-
"high",
|
|
2211
|
-
"urgent"
|
|
2212
|
-
]);
|
|
2213
|
-
notificationStatusEnum = pgEnum7("notification_status", [
|
|
2214
|
-
"pending",
|
|
2215
|
-
"delivered",
|
|
2216
|
-
"seen",
|
|
2217
|
-
"clicked",
|
|
2218
|
-
"dismissed",
|
|
2219
|
-
"expired"
|
|
2220
|
-
]);
|
|
2221
|
-
notifications = pgTable12("notifications", {
|
|
2222
|
-
id: uuid11("id").primaryKey().defaultRandom(),
|
|
2223
|
-
userId: text11("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
2224
|
-
type: varchar6("type", { length: 50 }).notNull(),
|
|
2225
|
-
title: varchar6("title", { length: 255 }).notNull(),
|
|
2226
|
-
message: text11("message").notNull(),
|
|
2227
|
-
data: jsonb6("data").notNull().default({}),
|
|
2228
|
-
priority: notificationPriorityEnum("priority").notNull().default("normal"),
|
|
2229
|
-
status: notificationStatusEnum("status").notNull().default("pending"),
|
|
2230
|
-
createdAt: timestamp12("created_at", { withTimezone: true }).defaultNow().notNull(),
|
|
2231
|
-
deliveredAt: timestamp12("delivered_at", { withTimezone: true }),
|
|
2232
|
-
seenAt: timestamp12("seen_at", { withTimezone: true }),
|
|
2233
|
-
clickedAt: timestamp12("clicked_at", { withTimezone: true }),
|
|
2234
|
-
expiresAt: timestamp12("expires_at", { withTimezone: true }),
|
|
2235
|
-
method: varchar6("method", { length: 50 }),
|
|
2236
|
-
clickUrl: text11("click_url"),
|
|
2237
|
-
metadata: jsonb6("metadata").notNull().default({})
|
|
2238
|
-
}, (table) => [
|
|
2239
|
-
index4("notifications_user_id_idx").on(table.userId),
|
|
2240
|
-
index4("notifications_status_idx").on(table.status),
|
|
2241
|
-
index4("notifications_type_idx").on(table.type),
|
|
2242
|
-
index4("notifications_created_at_idx").on(table.createdAt),
|
|
2243
|
-
index4("notifications_user_status_idx").on(table.userId, table.status)
|
|
2244
|
-
]);
|
|
2245
|
-
notificationsRelations = relations9(notifications, ({ one }) => ({
|
|
2246
|
-
user: one(users, {
|
|
2247
|
-
fields: [notifications.userId],
|
|
2248
|
-
references: [users.id]
|
|
2249
|
-
})
|
|
2250
|
-
}));
|
|
2251
|
-
});
|
|
1515
|
+
// ../constants/src/domains.ts
|
|
1516
|
+
var init_domains = () => {};
|
|
2252
1517
|
|
|
2253
|
-
// ../
|
|
2254
|
-
var
|
|
2255
|
-
init_table4();
|
|
2256
|
-
init_table5();
|
|
2257
|
-
init_table();
|
|
2258
|
-
init_table2();
|
|
2259
|
-
init_table3();
|
|
2260
|
-
init_table6();
|
|
2261
|
-
init_table7();
|
|
2262
|
-
init_table8();
|
|
2263
|
-
init_table9();
|
|
2264
|
-
init_table10();
|
|
2265
|
-
init_table11();
|
|
2266
|
-
init_table12();
|
|
2267
|
-
});
|
|
1518
|
+
// ../constants/src/env-vars.ts
|
|
1519
|
+
var init_env_vars = () => {};
|
|
2268
1520
|
|
|
2269
|
-
// ../
|
|
2270
|
-
var ITEM_SLUGS, CURRENCIES, BADGES
|
|
2271
|
-
var
|
|
2272
|
-
init_tables_index();
|
|
1521
|
+
// ../constants/src/overworld.ts
|
|
1522
|
+
var ITEM_SLUGS, CURRENCIES, BADGES;
|
|
1523
|
+
var init_overworld = __esm(() => {
|
|
2273
1524
|
ITEM_SLUGS = {
|
|
2274
1525
|
PLAYCADEMY_CREDITS: "PLAYCADEMY_CREDITS",
|
|
2275
1526
|
PLAYCADEMY_XP: "PLAYCADEMY_XP",
|
|
@@ -2292,7 +1543,28 @@ var init_constants = __esm(() => {
|
|
|
2292
1543
|
EARLY_ADOPTER: ITEM_SLUGS.EARLY_ADOPTER_BADGE,
|
|
2293
1544
|
FIRST_GAME: ITEM_SLUGS.FIRST_GAME_BADGE
|
|
2294
1545
|
};
|
|
2295
|
-
|
|
1546
|
+
});
|
|
1547
|
+
// ../constants/src/timeback.ts
|
|
1548
|
+
var TIMEBACK_ROUTES;
|
|
1549
|
+
var init_timeback = __esm(() => {
|
|
1550
|
+
TIMEBACK_ROUTES = {
|
|
1551
|
+
PROGRESS: "/integrations/timeback/progress",
|
|
1552
|
+
SESSION_END: "/integrations/timeback/session-end",
|
|
1553
|
+
AWARD_XP: "/integrations/timeback/award-xp"
|
|
1554
|
+
};
|
|
1555
|
+
});
|
|
1556
|
+
|
|
1557
|
+
// ../constants/src/workers.ts
|
|
1558
|
+
var init_workers = () => {};
|
|
1559
|
+
|
|
1560
|
+
// ../constants/src/index.ts
|
|
1561
|
+
var init_src2 = __esm(() => {
|
|
1562
|
+
init_auth();
|
|
1563
|
+
init_domains();
|
|
1564
|
+
init_env_vars();
|
|
1565
|
+
init_overworld();
|
|
1566
|
+
init_timeback();
|
|
1567
|
+
init_workers();
|
|
2296
1568
|
});
|
|
2297
1569
|
|
|
2298
1570
|
// src/core/cache/singleton-cache.ts
|
|
@@ -2372,7 +1644,7 @@ function createCreditsNamespace(client) {
|
|
|
2372
1644
|
};
|
|
2373
1645
|
}
|
|
2374
1646
|
var init_credits = __esm(() => {
|
|
2375
|
-
|
|
1647
|
+
init_src2();
|
|
2376
1648
|
});
|
|
2377
1649
|
|
|
2378
1650
|
// src/core/namespaces/leaderboard.ts
|
|
@@ -2765,28 +2037,6 @@ function createAchievementsNamespace(client) {
|
|
|
2765
2037
|
}
|
|
2766
2038
|
var init_achievements = () => {};
|
|
2767
2039
|
|
|
2768
|
-
// src/constants.ts
|
|
2769
|
-
var CURRENCIES2, BADGES2, AuthProvider, TIMEBACK_ROUTES;
|
|
2770
|
-
var init_constants2 = __esm(() => {
|
|
2771
|
-
CURRENCIES2 = {
|
|
2772
|
-
PRIMARY: "PLAYCADEMY_CREDITS",
|
|
2773
|
-
XP: "PLAYCADEMY_XP"
|
|
2774
|
-
};
|
|
2775
|
-
BADGES2 = {
|
|
2776
|
-
FOUNDING_MEMBER: "FOUNDING_MEMBER_BADGE",
|
|
2777
|
-
EARLY_ADOPTER: "EARLY_ADOPTER_BADGE",
|
|
2778
|
-
FIRST_GAME: "FIRST_GAME_BADGE"
|
|
2779
|
-
};
|
|
2780
|
-
AuthProvider = {
|
|
2781
|
-
TIMEBACK: "TIMEBACK"
|
|
2782
|
-
};
|
|
2783
|
-
TIMEBACK_ROUTES = {
|
|
2784
|
-
PROGRESS: "/api/integrations/timeback/progress",
|
|
2785
|
-
SESSION_END: "/api/integrations/timeback/session-end",
|
|
2786
|
-
AWARD_XP: "/api/integrations/timeback/award-xp"
|
|
2787
|
-
};
|
|
2788
|
-
});
|
|
2789
|
-
|
|
2790
2040
|
// src/core/namespaces/timeback.ts
|
|
2791
2041
|
function createTimebackNamespace(client) {
|
|
2792
2042
|
return {
|
|
@@ -2861,8 +2111,8 @@ function createTimebackNamespace(client) {
|
|
|
2861
2111
|
}
|
|
2862
2112
|
};
|
|
2863
2113
|
}
|
|
2864
|
-
var
|
|
2865
|
-
|
|
2114
|
+
var init_timeback2 = __esm(() => {
|
|
2115
|
+
init_src2();
|
|
2866
2116
|
});
|
|
2867
2117
|
|
|
2868
2118
|
// src/core/namespaces/notifications.ts
|
|
@@ -2973,7 +2223,7 @@ var init_namespaces = __esm(() => {
|
|
|
2973
2223
|
init_sprites();
|
|
2974
2224
|
init_realtime();
|
|
2975
2225
|
init_achievements();
|
|
2976
|
-
|
|
2226
|
+
init_timeback2();
|
|
2977
2227
|
init_notifications();
|
|
2978
2228
|
});
|
|
2979
2229
|
|
|
@@ -3294,12 +2544,8 @@ var init_client = __esm(() => {
|
|
|
3294
2544
|
// src/index.ts
|
|
3295
2545
|
init_client();
|
|
3296
2546
|
init_messaging();
|
|
3297
|
-
init_constants2();
|
|
3298
2547
|
export {
|
|
3299
2548
|
messaging,
|
|
3300
2549
|
PlaycademyClient,
|
|
3301
|
-
MessageEvents
|
|
3302
|
-
CURRENCIES2 as CURRENCIES,
|
|
3303
|
-
BADGES2 as BADGES,
|
|
3304
|
-
AuthProvider
|
|
2550
|
+
MessageEvents
|
|
3305
2551
|
};
|