@playcademy/sdk 0.0.1-beta.28 → 0.0.1-beta.29

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/types.js CHANGED
@@ -10,125 +10,180 @@ var __export = (target, all) => {
10
10
  };
11
11
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
12
12
 
13
- // ../data/src/domains/user/table.ts
14
- import { boolean, pgEnum, pgTable, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
15
- var userRoleEnum, developerStatusEnum, users, accounts, sessions, verification;
13
+ // ../data/src/domains/game/table.ts
14
+ import {
15
+ jsonb,
16
+ pgEnum,
17
+ pgTable,
18
+ text,
19
+ timestamp,
20
+ uniqueIndex,
21
+ uuid,
22
+ varchar
23
+ } from "drizzle-orm/pg-core";
24
+ var gamePlatformEnum, gameBootModeEnum, games, gameSessions, gameStates;
16
25
  var init_table = __esm(() => {
17
- userRoleEnum = pgEnum("user_role", ["admin", "player", "developer"]);
18
- developerStatusEnum = pgEnum("developer_status", ["none", "pending", "approved"]);
19
- users = pgTable("user", {
20
- id: text("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
21
- name: text("name").notNull(),
22
- username: text("username").unique(),
23
- email: text("email").notNull().unique(),
24
- emailVerified: boolean("email_verified").notNull().default(false),
25
- image: text("image"),
26
- role: userRoleEnum("role").notNull().default("player"),
27
- developerStatus: developerStatusEnum("developer_status").notNull().default("none"),
28
- createdAt: timestamp("created_at", {
29
- mode: "date",
30
- withTimezone: true
31
- }).notNull(),
32
- updatedAt: timestamp("updated_at", {
33
- mode: "date",
34
- withTimezone: true
35
- }).notNull()
36
- });
37
- accounts = pgTable("account", {
38
- id: text("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
39
- userId: text("userId").notNull().references(() => users.id, { onDelete: "cascade" }),
40
- accountId: text("account_id").notNull(),
41
- providerId: text("provider_id").notNull(),
42
- accessToken: text("access_token"),
43
- refreshToken: text("refresh_token"),
44
- idToken: text("id_token"),
45
- accessTokenExpiresAt: timestamp("access_token_expires_at", {
46
- mode: "date",
47
- withTimezone: true
26
+ init_table3();
27
+ init_table4();
28
+ gamePlatformEnum = pgEnum("game_platform", ["web", "godot", "unity"]);
29
+ gameBootModeEnum = pgEnum("game_boot_mode", ["iframe", "module"]);
30
+ games = pgTable("games", {
31
+ id: uuid("id").primaryKey().defaultRandom(),
32
+ developerId: text("developer_id").references(() => users.id, {
33
+ onDelete: "set null"
48
34
  }),
49
- refreshTokenExpiresAt: timestamp("refresh_token_expires_at", {
50
- mode: "date",
51
- withTimezone: true
35
+ slug: varchar("slug", { length: 255 }).notNull().unique(),
36
+ displayName: varchar("display_name", { length: 255 }).notNull(),
37
+ version: varchar("version", { length: 50 }).notNull(),
38
+ assetBundleBase: text("asset_bundle_base").notNull(),
39
+ platform: gamePlatformEnum("platform").notNull().default("web"),
40
+ mapElementId: uuid("map_element_id").references(() => mapElements.id, {
41
+ onDelete: "set null"
52
42
  }),
53
- scope: text("scope"),
54
- password: text("password"),
55
- createdAt: timestamp("created_at", {
56
- mode: "date",
57
- withTimezone: true
58
- }).notNull(),
59
- updatedAt: timestamp("updated_at", {
60
- mode: "date",
61
- withTimezone: true
62
- }).notNull()
63
- }, (table) => [uniqueIndex("account_provider_providerId_idx").on(table.accountId, table.providerId)]);
64
- sessions = pgTable("session", {
65
- id: text("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
66
- userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
67
- expiresAt: timestamp("expires_at", {
68
- mode: "date",
69
- withTimezone: true
70
- }).notNull(),
71
- token: text("token").notNull().unique(),
72
- ipAddress: text("ip_address"),
73
- userAgent: text("user_agent"),
74
- createdAt: timestamp("created_at", {
75
- mode: "date",
76
- withTimezone: true
77
- }).notNull(),
78
- updatedAt: timestamp("updated_at", {
79
- mode: "date",
80
- withTimezone: true
81
- }).notNull()
43
+ metadata: jsonb("metadata").default("{}"),
44
+ createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
45
+ updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow()
82
46
  });
83
- verification = pgTable("verification", {
84
- id: text("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
85
- identifier: text("identifier").notNull(),
86
- value: text("value").notNull(),
87
- expiresAt: timestamp("expires_at", {
88
- mode: "date",
89
- withTimezone: true
90
- }).notNull(),
91
- createdAt: timestamp("created_at", {
92
- mode: "date",
93
- withTimezone: true
94
- }).notNull(),
95
- updatedAt: timestamp("updated_at", {
96
- mode: "date",
97
- withTimezone: true
98
- }).notNull()
47
+ gameSessions = pgTable("game_sessions", {
48
+ id: uuid("id").primaryKey().defaultRandom(),
49
+ userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
50
+ gameId: uuid("game_id").notNull().references(() => games.id, { onDelete: "cascade" }),
51
+ startedAt: timestamp("started_at", { withTimezone: true }).notNull().defaultNow(),
52
+ endedAt: timestamp("ended_at", { withTimezone: true })
99
53
  });
54
+ gameStates = pgTable("game_states", {
55
+ userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
56
+ gameId: uuid("game_id").notNull().references(() => games.id, { onDelete: "cascade" }),
57
+ data: jsonb("data").default("{}"),
58
+ updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow()
59
+ }, (table) => [uniqueIndex("unique_user_game_idx").on(table.userId, table.gameId)]);
100
60
  });
101
61
 
102
- // ../data/src/domains/developer/table.ts
103
- import { pgTable as pgTable2, text as text2, timestamp as timestamp2, uuid, varchar } from "drizzle-orm/pg-core";
104
- var developerKeys;
62
+ // ../data/src/domains/inventory/table.ts
63
+ import { relations, sql } from "drizzle-orm";
64
+ import {
65
+ boolean,
66
+ integer,
67
+ jsonb as jsonb2,
68
+ pgEnum as pgEnum2,
69
+ pgTable as pgTable2,
70
+ text as text2,
71
+ timestamp as timestamp2,
72
+ uniqueIndex as uniqueIndex2,
73
+ uuid as uuid2
74
+ } from "drizzle-orm/pg-core";
75
+ var itemTypeEnum, items, inventoryItems, currencies, shopListings, itemsRelations, currenciesRelations, shopListingsRelations, inventoryItemsRelations;
105
76
  var init_table2 = __esm(() => {
106
77
  init_table();
107
- developerKeys = pgTable2("developer_keys", {
108
- id: uuid("id").primaryKey().defaultRandom(),
78
+ init_table3();
79
+ init_table4();
80
+ itemTypeEnum = pgEnum2("item_type", [
81
+ "currency",
82
+ "badge",
83
+ "trophy",
84
+ "collectible",
85
+ "consumable",
86
+ "unlock",
87
+ "upgrade",
88
+ "accessory",
89
+ "other"
90
+ ]);
91
+ items = pgTable2("items", {
92
+ id: uuid2("id").primaryKey().defaultRandom(),
93
+ slug: text2("slug").notNull(),
94
+ gameId: uuid2("game_id").references(() => games.id, {
95
+ onDelete: "cascade"
96
+ }),
97
+ displayName: text2("display_name").notNull(),
98
+ description: text2("description"),
99
+ type: itemTypeEnum("type").notNull().default("other"),
100
+ isPlaceable: boolean("is_placeable").default(false).notNull(),
101
+ imageUrl: text2("image_url"),
102
+ metadata: jsonb2("metadata").default({}),
103
+ createdAt: timestamp2("created_at").defaultNow().notNull()
104
+ }, (table) => [
105
+ uniqueIndex2("items_game_slug_idx").on(table.gameId, table.slug),
106
+ uniqueIndex2("items_global_slug_idx").on(table.slug).where(sql`game_id IS NULL`)
107
+ ]);
108
+ inventoryItems = pgTable2("inventory_items", {
109
+ id: uuid2("id").primaryKey().defaultRandom(),
109
110
  userId: text2("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
110
- label: varchar("label", { length: 255 }),
111
- keyHash: text2("key_hash").notNull().unique(),
112
- createdAt: timestamp2("created_at", { withTimezone: true }).notNull().defaultNow()
113
- });
111
+ itemId: uuid2("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
112
+ quantity: integer("quantity").notNull().default(1),
113
+ updatedAt: timestamp2("updated_at", { withTimezone: true }).defaultNow()
114
+ }, (table) => [uniqueIndex2("unique_user_item_idx").on(table.userId, table.itemId)]);
115
+ currencies = pgTable2("currencies", {
116
+ id: uuid2("id").primaryKey().defaultRandom(),
117
+ itemId: uuid2("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
118
+ symbol: text2("symbol"),
119
+ isPrimary: boolean("is_primary").default(false).notNull(),
120
+ createdAt: timestamp2("created_at").defaultNow().notNull(),
121
+ updatedAt: timestamp2("updated_at", { withTimezone: true }).defaultNow().$onUpdate(() => new Date)
122
+ }, (table) => [uniqueIndex2("currency_item_id_idx").on(table.itemId)]);
123
+ shopListings = pgTable2("shop_listings", {
124
+ id: uuid2("id").primaryKey().defaultRandom(),
125
+ itemId: uuid2("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
126
+ currencyId: uuid2("currency_id").notNull().references(() => currencies.id, { onDelete: "restrict" }),
127
+ price: integer("price").notNull(),
128
+ sellBackPercentage: integer("sell_back_percentage"),
129
+ stock: integer("stock"),
130
+ isActive: boolean("is_active").default(true).notNull(),
131
+ availableFrom: timestamp2("available_from", { withTimezone: true }),
132
+ availableUntil: timestamp2("available_until", { withTimezone: true }),
133
+ createdAt: timestamp2("created_at").defaultNow().notNull(),
134
+ updatedAt: timestamp2("updated_at", { withTimezone: true }).defaultNow().$onUpdate(() => new Date)
135
+ }, (table) => [uniqueIndex2("unique_item_currency_listing_idx").on(table.itemId, table.currencyId)]);
136
+ itemsRelations = relations(items, ({ many }) => ({
137
+ shopListings: many(shopListings),
138
+ inventoryItems: many(inventoryItems),
139
+ mapObjects: many(mapObjects)
140
+ }));
141
+ currenciesRelations = relations(currencies, ({ many }) => ({
142
+ shopListings: many(shopListings)
143
+ }));
144
+ shopListingsRelations = relations(shopListings, ({ one }) => ({
145
+ item: one(items, {
146
+ fields: [shopListings.itemId],
147
+ references: [items.id]
148
+ }),
149
+ currency: one(currencies, {
150
+ fields: [shopListings.currencyId],
151
+ references: [currencies.id]
152
+ })
153
+ }));
154
+ inventoryItemsRelations = relations(inventoryItems, ({ one }) => ({
155
+ item: one(items, {
156
+ fields: [inventoryItems.itemId],
157
+ references: [items.id]
158
+ }),
159
+ user: one(users, {
160
+ fields: [inventoryItems.userId],
161
+ references: [users.id]
162
+ })
163
+ }));
114
164
  });
115
165
 
116
166
  // ../data/src/domains/map/table.ts
117
- import { relations } from "drizzle-orm";
167
+ import { relations as relations2 } from "drizzle-orm";
118
168
  import {
119
169
  doublePrecision,
120
- jsonb,
121
- pgEnum as pgEnum2,
170
+ index,
171
+ integer as integer2,
172
+ jsonb as jsonb3,
173
+ pgEnum as pgEnum3,
122
174
  pgTable as pgTable3,
123
175
  text as text3,
124
- uniqueIndex as uniqueIndex2,
125
- uuid as uuid2,
176
+ timestamp as timestamp3,
177
+ uniqueIndex as uniqueIndex3,
178
+ uuid as uuid3,
126
179
  varchar as varchar2
127
180
  } from "drizzle-orm/pg-core";
128
- var interactionTypeEnum, maps, mapElements, mapElementsRelations, mapsRelations;
181
+ var interactionTypeEnum, maps, mapElements, mapObjects, mapElementsRelations, mapsRelations, mapObjectsRelations;
129
182
  var init_table3 = __esm(() => {
183
+ init_table();
184
+ init_table2();
130
185
  init_table4();
131
- interactionTypeEnum = pgEnum2("interaction_type", [
186
+ interactionTypeEnum = pgEnum3("interaction_type", [
132
187
  "game_entry",
133
188
  "game_registry",
134
189
  "info",
@@ -139,7 +194,7 @@ var init_table3 = __esm(() => {
139
194
  "quest_trigger"
140
195
  ]);
141
196
  maps = pgTable3("maps", {
142
- id: uuid2("id").primaryKey().defaultRandom(),
197
+ id: uuid3("id").primaryKey().defaultRandom(),
143
198
  identifier: varchar2("identifier", { length: 255 }).notNull().unique(),
144
199
  displayName: varchar2("display_name", { length: 255 }).notNull(),
145
200
  filePath: varchar2("file_path", { length: 255 }).notNull(),
@@ -149,18 +204,32 @@ var init_table3 = __esm(() => {
149
204
  description: text3("description")
150
205
  });
151
206
  mapElements = pgTable3("map_elements", {
152
- id: uuid2("id").primaryKey().defaultRandom(),
153
- mapId: uuid2("map_id").references(() => maps.id, {
207
+ id: uuid3("id").primaryKey().defaultRandom(),
208
+ mapId: uuid3("map_id").references(() => maps.id, {
154
209
  onDelete: "cascade"
155
210
  }),
156
211
  elementSlug: varchar2("element_slug", { length: 255 }).notNull(),
157
212
  interactionType: interactionTypeEnum("interaction_type").notNull(),
158
- gameId: uuid2("game_id").references(() => games.id, {
213
+ gameId: uuid3("game_id").references(() => games.id, {
159
214
  onDelete: "set null"
160
215
  }),
161
- metadata: jsonb("metadata").$type().default({})
162
- }, (table) => [uniqueIndex2("map_id_element_slug_unique_idx").on(table.mapId, table.elementSlug)]);
163
- mapElementsRelations = relations(mapElements, ({ one }) => ({
216
+ metadata: jsonb3("metadata").$type().default({})
217
+ }, (table) => [uniqueIndex3("map_id_element_slug_unique_idx").on(table.mapId, table.elementSlug)]);
218
+ mapObjects = pgTable3("map_objects", {
219
+ id: uuid3("id").primaryKey().defaultRandom(),
220
+ userId: text3("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
221
+ mapId: uuid3("map_id").notNull().references(() => maps.id, { onDelete: "cascade" }),
222
+ itemId: uuid3("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
223
+ worldX: doublePrecision("world_x").notNull(),
224
+ worldY: doublePrecision("world_y").notNull(),
225
+ rotation: integer2("rotation").default(0).notNull(),
226
+ scale: doublePrecision("scale").default(1).notNull(),
227
+ createdAt: timestamp3("created_at").defaultNow().notNull()
228
+ }, (table) => [
229
+ index("map_objects_map_idx").on(table.mapId),
230
+ index("map_objects_spatial_idx").on(table.mapId, table.worldX, table.worldY)
231
+ ]);
232
+ mapElementsRelations = relations2(mapElements, ({ one }) => ({
164
233
  game: one(games, {
165
234
  fields: [mapElements.gameId],
166
235
  references: [games.id]
@@ -170,183 +239,158 @@ var init_table3 = __esm(() => {
170
239
  references: [maps.id]
171
240
  })
172
241
  }));
173
- mapsRelations = relations(maps, ({ many }) => ({
174
- elements: many(mapElements)
242
+ mapsRelations = relations2(maps, ({ many }) => ({
243
+ elements: many(mapElements),
244
+ objects: many(mapObjects)
245
+ }));
246
+ mapObjectsRelations = relations2(mapObjects, ({ one }) => ({
247
+ user: one(users, {
248
+ fields: [mapObjects.userId],
249
+ references: [users.id]
250
+ }),
251
+ map: one(maps, {
252
+ fields: [mapObjects.mapId],
253
+ references: [maps.id]
254
+ }),
255
+ item: one(items, {
256
+ fields: [mapObjects.itemId],
257
+ references: [items.id]
258
+ })
175
259
  }));
176
260
  });
177
261
 
178
- // ../data/src/domains/game/table.ts
179
- import {
180
- jsonb as jsonb2,
181
- pgEnum as pgEnum3,
182
- pgTable as pgTable4,
183
- text as text4,
184
- timestamp as timestamp3,
185
- uniqueIndex as uniqueIndex3,
186
- uuid as uuid3,
187
- varchar as varchar3
188
- } from "drizzle-orm/pg-core";
189
- var gamePlatformEnum, gameBootModeEnum, games, gameSessions, gameStates;
262
+ // ../data/src/domains/user/table.ts
263
+ import { relations as relations3 } from "drizzle-orm";
264
+ import { boolean as boolean2, pgEnum as pgEnum4, pgTable as pgTable4, text as text4, timestamp as timestamp4, uniqueIndex as uniqueIndex4 } from "drizzle-orm/pg-core";
265
+ var userRoleEnum, developerStatusEnum, users, accounts, sessions, verification, usersRelations;
190
266
  var init_table4 = __esm(() => {
191
267
  init_table3();
192
- init_table();
193
- gamePlatformEnum = pgEnum3("game_platform", ["web", "godot", "unity"]);
194
- gameBootModeEnum = pgEnum3("game_boot_mode", ["iframe", "module"]);
195
- games = pgTable4("games", {
196
- id: uuid3("id").primaryKey().defaultRandom(),
197
- developerId: text4("developer_id").references(() => users.id, {
198
- onDelete: "set null"
268
+ userRoleEnum = pgEnum4("user_role", ["admin", "player", "developer"]);
269
+ developerStatusEnum = pgEnum4("developer_status", ["none", "pending", "approved"]);
270
+ users = pgTable4("user", {
271
+ id: text4("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
272
+ name: text4("name").notNull(),
273
+ username: text4("username").unique(),
274
+ email: text4("email").notNull().unique(),
275
+ emailVerified: boolean2("email_verified").notNull().default(false),
276
+ image: text4("image"),
277
+ role: userRoleEnum("role").notNull().default("player"),
278
+ developerStatus: developerStatusEnum("developer_status").notNull().default("none"),
279
+ characterCreated: boolean2("character_created").notNull().default(false),
280
+ createdAt: timestamp4("created_at", {
281
+ mode: "date",
282
+ withTimezone: true
283
+ }).notNull(),
284
+ updatedAt: timestamp4("updated_at", {
285
+ mode: "date",
286
+ withTimezone: true
287
+ }).notNull()
288
+ });
289
+ accounts = pgTable4("account", {
290
+ id: text4("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
291
+ userId: text4("userId").notNull().references(() => users.id, { onDelete: "cascade" }),
292
+ accountId: text4("account_id").notNull(),
293
+ providerId: text4("provider_id").notNull(),
294
+ accessToken: text4("access_token"),
295
+ refreshToken: text4("refresh_token"),
296
+ idToken: text4("id_token"),
297
+ accessTokenExpiresAt: timestamp4("access_token_expires_at", {
298
+ mode: "date",
299
+ withTimezone: true
199
300
  }),
200
- slug: varchar3("slug", { length: 255 }).notNull().unique(),
201
- displayName: varchar3("display_name", { length: 255 }).notNull(),
202
- version: varchar3("version", { length: 50 }).notNull(),
203
- assetBundleBase: text4("asset_bundle_base").notNull(),
204
- platform: gamePlatformEnum("platform").notNull().default("web"),
205
- mapElementId: uuid3("map_element_id").references(() => mapElements.id, {
206
- onDelete: "set null"
301
+ refreshTokenExpiresAt: timestamp4("refresh_token_expires_at", {
302
+ mode: "date",
303
+ withTimezone: true
207
304
  }),
208
- metadata: jsonb2("metadata").default("{}"),
209
- createdAt: timestamp3("created_at", { withTimezone: true }).defaultNow(),
210
- updatedAt: timestamp3("updated_at", { withTimezone: true }).defaultNow()
211
- });
212
- gameSessions = pgTable4("game_sessions", {
213
- id: uuid3("id").primaryKey().defaultRandom(),
305
+ scope: text4("scope"),
306
+ password: text4("password"),
307
+ createdAt: timestamp4("created_at", {
308
+ mode: "date",
309
+ withTimezone: true
310
+ }).notNull(),
311
+ updatedAt: timestamp4("updated_at", {
312
+ mode: "date",
313
+ withTimezone: true
314
+ }).notNull()
315
+ }, (table) => [uniqueIndex4("account_provider_providerId_idx").on(table.accountId, table.providerId)]);
316
+ sessions = pgTable4("session", {
317
+ id: text4("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
214
318
  userId: text4("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
215
- gameId: uuid3("game_id").notNull().references(() => games.id, { onDelete: "cascade" }),
216
- startedAt: timestamp3("started_at", { withTimezone: true }).notNull().defaultNow(),
217
- endedAt: timestamp3("ended_at", { withTimezone: true })
319
+ expiresAt: timestamp4("expires_at", {
320
+ mode: "date",
321
+ withTimezone: true
322
+ }).notNull(),
323
+ token: text4("token").notNull().unique(),
324
+ ipAddress: text4("ip_address"),
325
+ userAgent: text4("user_agent"),
326
+ createdAt: timestamp4("created_at", {
327
+ mode: "date",
328
+ withTimezone: true
329
+ }).notNull(),
330
+ updatedAt: timestamp4("updated_at", {
331
+ mode: "date",
332
+ withTimezone: true
333
+ }).notNull()
218
334
  });
219
- gameStates = pgTable4("game_states", {
220
- userId: text4("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
221
- gameId: uuid3("game_id").notNull().references(() => games.id, { onDelete: "cascade" }),
222
- data: jsonb2("data").default("{}"),
223
- updatedAt: timestamp3("updated_at", { withTimezone: true }).defaultNow()
224
- }, (table) => [uniqueIndex3("unique_user_game_idx").on(table.userId, table.gameId)]);
335
+ verification = pgTable4("verification", {
336
+ id: text4("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
337
+ identifier: text4("identifier").notNull(),
338
+ value: text4("value").notNull(),
339
+ expiresAt: timestamp4("expires_at", {
340
+ mode: "date",
341
+ withTimezone: true
342
+ }).notNull(),
343
+ createdAt: timestamp4("created_at", {
344
+ mode: "date",
345
+ withTimezone: true
346
+ }).notNull(),
347
+ updatedAt: timestamp4("updated_at", {
348
+ mode: "date",
349
+ withTimezone: true
350
+ }).notNull()
351
+ });
352
+ usersRelations = relations3(users, ({ many }) => ({
353
+ mapObjects: many(mapObjects)
354
+ }));
225
355
  });
226
356
 
227
- // ../data/src/domains/inventory/table.ts
228
- import { relations as relations2, sql } from "drizzle-orm";
229
- import {
230
- boolean as boolean2,
231
- integer,
232
- jsonb as jsonb3,
233
- pgEnum as pgEnum4,
234
- pgTable as pgTable5,
235
- text as text5,
236
- timestamp as timestamp4,
237
- uniqueIndex as uniqueIndex4,
238
- uuid as uuid4
239
- } from "drizzle-orm/pg-core";
240
- var itemTypeEnum, items, inventoryItems, currencies, shopListings, itemsRelations, currenciesRelations, shopListingsRelations, inventoryItemsRelations;
357
+ // ../data/src/domains/developer/table.ts
358
+ import { pgTable as pgTable5, text as text5, timestamp as timestamp5, uuid as uuid4, varchar as varchar3 } from "drizzle-orm/pg-core";
359
+ var developerKeys;
241
360
  var init_table5 = __esm(() => {
242
361
  init_table4();
243
- init_table();
244
- itemTypeEnum = pgEnum4("item_type", [
245
- "currency",
246
- "badge",
247
- "trophy",
248
- "collectible",
249
- "consumable",
250
- "unlock",
251
- "upgrade",
252
- "other"
253
- ]);
254
- items = pgTable5("items", {
255
- id: uuid4("id").primaryKey().defaultRandom(),
256
- slug: text5("slug").notNull(),
257
- gameId: uuid4("game_id").references(() => games.id, {
258
- onDelete: "cascade"
259
- }),
260
- displayName: text5("display_name").notNull(),
261
- description: text5("description"),
262
- type: itemTypeEnum("type").notNull().default("other"),
263
- imageUrl: text5("image_url"),
264
- metadata: jsonb3("metadata").default({}),
265
- createdAt: timestamp4("created_at").defaultNow().notNull()
266
- }, (table) => [
267
- uniqueIndex4("items_game_slug_idx").on(table.gameId, table.slug),
268
- uniqueIndex4("items_global_slug_idx").on(table.slug).where(sql`game_id IS NULL`)
269
- ]);
270
- inventoryItems = pgTable5("inventory_items", {
362
+ developerKeys = pgTable5("developer_keys", {
271
363
  id: uuid4("id").primaryKey().defaultRandom(),
272
364
  userId: text5("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
273
- itemId: uuid4("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
274
- quantity: integer("quantity").notNull().default(1),
275
- updatedAt: timestamp4("updated_at", { withTimezone: true }).defaultNow()
276
- }, (table) => [uniqueIndex4("unique_user_item_idx").on(table.userId, table.itemId)]);
277
- currencies = pgTable5("currencies", {
278
- id: uuid4("id").primaryKey().defaultRandom(),
279
- itemId: uuid4("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
280
- symbol: text5("symbol"),
281
- isPrimary: boolean2("is_primary").default(false).notNull(),
282
- createdAt: timestamp4("created_at").defaultNow().notNull(),
283
- updatedAt: timestamp4("updated_at", { withTimezone: true }).defaultNow().$onUpdate(() => new Date)
284
- }, (table) => [uniqueIndex4("currency_item_id_idx").on(table.itemId)]);
285
- shopListings = pgTable5("shop_listings", {
286
- id: uuid4("id").primaryKey().defaultRandom(),
287
- itemId: uuid4("item_id").notNull().references(() => items.id, { onDelete: "cascade" }),
288
- currencyId: uuid4("currency_id").notNull().references(() => currencies.id, { onDelete: "restrict" }),
289
- price: integer("price").notNull(),
290
- sellBackPercentage: integer("sell_back_percentage"),
291
- stock: integer("stock"),
292
- isActive: boolean2("is_active").default(true).notNull(),
293
- availableFrom: timestamp4("available_from", { withTimezone: true }),
294
- availableUntil: timestamp4("available_until", { withTimezone: true }),
295
- createdAt: timestamp4("created_at").defaultNow().notNull(),
296
- updatedAt: timestamp4("updated_at", { withTimezone: true }).defaultNow().$onUpdate(() => new Date)
297
- }, (table) => [uniqueIndex4("unique_item_currency_listing_idx").on(table.itemId, table.currencyId)]);
298
- itemsRelations = relations2(items, ({ many }) => ({
299
- shopListings: many(shopListings),
300
- inventoryItems: many(inventoryItems)
301
- }));
302
- currenciesRelations = relations2(currencies, ({ many }) => ({
303
- shopListings: many(shopListings)
304
- }));
305
- shopListingsRelations = relations2(shopListings, ({ one }) => ({
306
- item: one(items, {
307
- fields: [shopListings.itemId],
308
- references: [items.id]
309
- }),
310
- currency: one(currencies, {
311
- fields: [shopListings.currencyId],
312
- references: [currencies.id]
313
- })
314
- }));
315
- inventoryItemsRelations = relations2(inventoryItems, ({ one }) => ({
316
- item: one(items, {
317
- fields: [inventoryItems.itemId],
318
- references: [items.id]
319
- }),
320
- user: one(users, {
321
- fields: [inventoryItems.userId],
322
- references: [users.id]
323
- })
324
- }));
365
+ label: varchar3("label", { length: 255 }),
366
+ keyHash: text5("key_hash").notNull().unique(),
367
+ createdAt: timestamp5("created_at", { withTimezone: true }).notNull().defaultNow()
368
+ });
325
369
  });
326
370
 
327
371
  // ../data/src/domains/level/table.ts
328
- import { relations as relations3 } from "drizzle-orm";
329
- import { integer as integer2, pgTable as pgTable6, text as text6, timestamp as timestamp5, uniqueIndex as uniqueIndex5, uuid as uuid5 } from "drizzle-orm/pg-core";
372
+ import { relations as relations4 } from "drizzle-orm";
373
+ import { integer as integer3, pgTable as pgTable6, text as text6, timestamp as timestamp6, uniqueIndex as uniqueIndex5, uuid as uuid5 } from "drizzle-orm/pg-core";
330
374
  var userLevels, levelConfigs, userLevelsRelations;
331
375
  var init_table6 = __esm(() => {
332
- init_table();
376
+ init_table4();
333
377
  userLevels = pgTable6("user_levels", {
334
378
  userId: text6("user_id").primaryKey().references(() => users.id, { onDelete: "cascade" }),
335
- currentLevel: integer2("current_level").notNull().default(1),
336
- currentXp: integer2("current_xp").notNull().default(0),
337
- totalXP: integer2("total_xp").notNull().default(0),
338
- lastLevelUpAt: timestamp5("last_level_up_at", { withTimezone: true }),
339
- createdAt: timestamp5("created_at").defaultNow().notNull(),
340
- updatedAt: timestamp5("updated_at", { withTimezone: true }).defaultNow().$onUpdate(() => new Date)
379
+ currentLevel: integer3("current_level").notNull().default(1),
380
+ currentXp: integer3("current_xp").notNull().default(0),
381
+ totalXP: integer3("total_xp").notNull().default(0),
382
+ lastLevelUpAt: timestamp6("last_level_up_at", { withTimezone: true }),
383
+ createdAt: timestamp6("created_at").defaultNow().notNull(),
384
+ updatedAt: timestamp6("updated_at", { withTimezone: true }).defaultNow().$onUpdate(() => new Date)
341
385
  });
342
386
  levelConfigs = pgTable6("level_configs", {
343
387
  id: uuid5("id").primaryKey().defaultRandom(),
344
- level: integer2("level").notNull().unique(),
345
- xpRequired: integer2("xp_required").notNull(),
346
- creditsReward: integer2("credits_reward").notNull().default(0),
347
- createdAt: timestamp5("created_at").defaultNow().notNull()
388
+ level: integer3("level").notNull().unique(),
389
+ xpRequired: integer3("xp_required").notNull(),
390
+ creditsReward: integer3("credits_reward").notNull().default(0),
391
+ createdAt: timestamp6("created_at").defaultNow().notNull()
348
392
  }, (table) => [uniqueIndex5("unique_level_config_idx").on(table.level)]);
349
- userLevelsRelations = relations3(userLevels, ({ one }) => ({
393
+ userLevelsRelations = relations4(userLevels, ({ one }) => ({
350
394
  user: one(users, {
351
395
  fields: [userLevels.userId],
352
396
  references: [users.id]
@@ -354,14 +398,158 @@ var init_table6 = __esm(() => {
354
398
  }));
355
399
  });
356
400
 
401
+ // ../data/src/domains/leaderboard/table.ts
402
+ import { relations as relations5 } from "drizzle-orm";
403
+ import { index as index2, integer as integer4, jsonb as jsonb4, pgTable as pgTable7, text as text7, timestamp as timestamp7, uuid as uuid6 } from "drizzle-orm/pg-core";
404
+ var gameScores, gameScoresRelations;
405
+ var init_table7 = __esm(() => {
406
+ init_table();
407
+ init_table4();
408
+ gameScores = pgTable7("game_scores", {
409
+ id: uuid6("id").primaryKey().defaultRandom(),
410
+ userId: text7("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
411
+ gameId: uuid6("game_id").notNull().references(() => games.id, { onDelete: "cascade" }),
412
+ score: integer4("score").notNull(),
413
+ metadata: jsonb4("metadata").default("{}"),
414
+ achievedAt: timestamp7("achieved_at", { withTimezone: true }).defaultNow().notNull(),
415
+ sessionId: uuid6("session_id").references(() => gameSessions.id, { onDelete: "set null" })
416
+ }, (table) => [
417
+ index2("game_scores_user_game_idx").on(table.userId, table.gameId),
418
+ index2("game_scores_game_score_idx").on(table.gameId, table.score),
419
+ index2("game_scores_achieved_at_idx").on(table.achievedAt)
420
+ ]);
421
+ gameScoresRelations = relations5(gameScores, ({ one }) => ({
422
+ user: one(users, {
423
+ fields: [gameScores.userId],
424
+ references: [users.id]
425
+ }),
426
+ game: one(games, {
427
+ fields: [gameScores.gameId],
428
+ references: [games.id]
429
+ }),
430
+ session: one(gameSessions, {
431
+ fields: [gameScores.sessionId],
432
+ references: [gameSessions.id]
433
+ })
434
+ }));
435
+ });
436
+
437
+ // ../data/src/domains/sprite/table.ts
438
+ import { relations as relations6 } from "drizzle-orm";
439
+ import { integer as integer5, pgTable as pgTable8, timestamp as timestamp8, uuid as uuid7, varchar as varchar4 } from "drizzle-orm/pg-core";
440
+ var spriteTemplates, spriteSheets, spriteTemplatesRelations, spriteSheetsRelations;
441
+ var init_table8 = __esm(() => {
442
+ spriteTemplates = pgTable8("sprite_templates", {
443
+ id: uuid7("id").primaryKey().defaultRandom(),
444
+ slug: varchar4("slug", { length: 64 }).notNull().unique(),
445
+ url: varchar4("url", { length: 255 }).notNull(),
446
+ createdAt: timestamp8("created_at", { withTimezone: true }).notNull().defaultNow(),
447
+ updatedAt: timestamp8("updated_at", { withTimezone: true }).notNull().defaultNow()
448
+ });
449
+ spriteSheets = pgTable8("sprite_sheets", {
450
+ id: uuid7("id").primaryKey().defaultRandom(),
451
+ templateId: uuid7("template_id").notNull().references(() => spriteTemplates.id, { onDelete: "cascade" }),
452
+ width: integer5("width").notNull(),
453
+ height: integer5("height").notNull(),
454
+ url: varchar4("url", { length: 255 }).notNull(),
455
+ createdAt: timestamp8("created_at", { withTimezone: true }).notNull().defaultNow(),
456
+ updatedAt: timestamp8("updated_at", { withTimezone: true }).notNull().defaultNow()
457
+ });
458
+ spriteTemplatesRelations = relations6(spriteTemplates, ({ many }) => ({
459
+ sheets: many(spriteSheets)
460
+ }));
461
+ spriteSheetsRelations = relations6(spriteSheets, ({ one }) => ({
462
+ template: one(spriteTemplates, {
463
+ fields: [spriteSheets.templateId],
464
+ references: [spriteTemplates.id]
465
+ })
466
+ }));
467
+ });
468
+
469
+ // ../data/src/domains/character/table.ts
470
+ import { relations as relations7 } from "drizzle-orm";
471
+ import { integer as integer6, pgEnum as pgEnum5, pgTable as pgTable9, text as text8, timestamp as timestamp9, uuid as uuid8, varchar as varchar5 } from "drizzle-orm/pg-core";
472
+ var characterComponentTypeEnum, characterComponents, playerCharacters, characterComponentsRelations, playerCharactersRelations;
473
+ var init_table9 = __esm(() => {
474
+ init_table8();
475
+ init_table4();
476
+ characterComponentTypeEnum = pgEnum5("character_component_type", [
477
+ "body",
478
+ "outfit",
479
+ "hairstyle",
480
+ "eyes",
481
+ "accessory"
482
+ ]);
483
+ characterComponents = pgTable9("character_components", {
484
+ id: uuid8("id").primaryKey().defaultRandom(),
485
+ componentType: characterComponentTypeEnum("component_type").notNull(),
486
+ slug: varchar5("slug", { length: 128 }).notNull().unique(),
487
+ displayName: varchar5("display_name", { length: 128 }).notNull(),
488
+ slot: varchar5("slot", { length: 64 }).notNull(),
489
+ spriteSheetId: uuid8("sprite_sheet_id").notNull().references(() => spriteSheets.id, { onDelete: "cascade" }),
490
+ unlockLevel: integer6("unlock_level").notNull().default(0),
491
+ variant: integer6("variant").notNull().default(0),
492
+ createdAt: timestamp9("created_at", { withTimezone: true }).notNull().defaultNow(),
493
+ updatedAt: timestamp9("updated_at", { withTimezone: true }).notNull().defaultNow()
494
+ });
495
+ playerCharacters = pgTable9("player_characters", {
496
+ id: uuid8("id").primaryKey().defaultRandom(),
497
+ userId: text8("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
498
+ bodyComponentId: uuid8("body_component_id").notNull().references(() => characterComponents.id, { onDelete: "restrict" }),
499
+ eyesComponentId: uuid8("eyes_component_id").notNull().references(() => characterComponents.id, { onDelete: "restrict" }),
500
+ hairstyleComponentId: uuid8("hairstyle_component_id").notNull().references(() => characterComponents.id, { onDelete: "restrict" }),
501
+ outfitComponentId: uuid8("outfit_component_id").notNull().references(() => characterComponents.id, { onDelete: "restrict" }),
502
+ accessoryComponentId: uuid8("accessory_component_id").references(() => characterComponents.id, {
503
+ onDelete: "set null"
504
+ }),
505
+ createdAt: timestamp9("created_at", { withTimezone: true }).notNull().defaultNow(),
506
+ updatedAt: timestamp9("updated_at", { withTimezone: true }).notNull().defaultNow()
507
+ });
508
+ characterComponentsRelations = relations7(characterComponents, ({ one }) => ({
509
+ sheet: one(spriteSheets, {
510
+ fields: [characterComponents.spriteSheetId],
511
+ references: [spriteSheets.id]
512
+ })
513
+ }));
514
+ playerCharactersRelations = relations7(playerCharacters, ({ one }) => ({
515
+ user: one(users, {
516
+ fields: [playerCharacters.userId],
517
+ references: [users.id]
518
+ }),
519
+ body: one(characterComponents, {
520
+ fields: [playerCharacters.bodyComponentId],
521
+ references: [characterComponents.id]
522
+ }),
523
+ eyes: one(characterComponents, {
524
+ fields: [playerCharacters.eyesComponentId],
525
+ references: [characterComponents.id]
526
+ }),
527
+ hair: one(characterComponents, {
528
+ fields: [playerCharacters.hairstyleComponentId],
529
+ references: [characterComponents.id]
530
+ }),
531
+ outfit: one(characterComponents, {
532
+ fields: [playerCharacters.outfitComponentId],
533
+ references: [characterComponents.id]
534
+ }),
535
+ accessory: one(characterComponents, {
536
+ fields: [playerCharacters.accessoryComponentId],
537
+ references: [characterComponents.id]
538
+ })
539
+ }));
540
+ });
541
+
357
542
  // ../data/src/tables.index.ts
358
543
  var init_tables_index = __esm(() => {
359
- init_table();
360
- init_table2();
361
544
  init_table4();
362
545
  init_table5();
546
+ init_table();
547
+ init_table2();
363
548
  init_table3();
364
549
  init_table6();
550
+ init_table7();
551
+ init_table8();
552
+ init_table9();
365
553
  });
366
554
 
367
555
  // ../data/src/constants.ts
@@ -376,7 +564,10 @@ var init_constants = __esm(() => {
376
564
  FIRST_GAME_BADGE: "FIRST_GAME_BADGE",
377
565
  COMMON_SWORD: "COMMON_SWORD",
378
566
  SMALL_HEALTH_POTION: "SMALL_HEALTH_POTION",
379
- SMALL_BACKPACK: "SMALL_BACKPACK"
567
+ SMALL_BACKPACK: "SMALL_BACKPACK",
568
+ LAVA_LAMP: "LAVA_LAMP",
569
+ BOOMBOX: "BOOMBOX",
570
+ CABIN_BED: "CABIN_BED"
380
571
  };
381
572
  CURRENCIES = {
382
573
  PRIMARY: ITEM_SLUGS.PLAYCADEMY_CREDITS,