@playcademy/sdk 0.1.18 → 0.2.1

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.d.ts CHANGED
@@ -1,12 +1,24 @@
1
- import { AUTH_PROVIDER_IDS } from '@playcademy/constants';
2
- import { InferSelectModel } from 'drizzle-orm';
3
- import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
4
- import * as drizzle_zod from 'drizzle-zod';
5
- import { z } from 'zod';
6
1
  import * as _playcademy_realtime_server_types from '@playcademy/realtime/server/types';
7
2
  import * as _playcademy_timeback_types from '@playcademy/timeback/types';
8
- import { OrganizationConfig, CourseConfig, ComponentConfig, ResourceConfig, ComponentResourceConfig } from '@playcademy/timeback/types';
9
- import { SchemaInfo } from '@playcademy/cloudflare';
3
+ import { CourseConfig, OrganizationConfig, ComponentConfig, ResourceConfig, ComponentResourceConfig } from '@playcademy/timeback/types';
4
+ import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
5
+ import { z } from 'zod';
6
+ import { AUTH_PROVIDER_IDS } from '@playcademy/constants';
7
+
8
+ /**
9
+ * OAuth 2.0 implementation for the Playcademy SDK
10
+ */
11
+
12
+ /**
13
+ * Parses an OAuth state parameter to extract CSRF token and any encoded data.
14
+ *
15
+ * @param state - The OAuth state parameter to parse
16
+ * @returns Object containing CSRF token and optional decoded data
17
+ */
18
+ declare function parseOAuthState(state: string): {
19
+ csrfToken: string;
20
+ data?: Record<string, string>;
21
+ };
10
22
 
11
23
  declare const userRoleEnum: drizzle_orm_pg_core.PgEnum<["admin", "player", "developer"]>;
12
24
  declare const users: drizzle_orm_pg_core.PgTableWithColumns<{
@@ -226,23 +238,6 @@ type GameMetadata = {
226
238
  emoji?: string;
227
239
  [key: string]: unknown;
228
240
  };
229
- /**
230
- * DNS validation records for custom hostname
231
- * Structure for the validationRecords JSON field in game_custom_hostnames table
232
- */
233
- type CustomHostnameValidationRecords = {
234
- /** TXT record for ownership verification */
235
- ownership?: {
236
- name?: string;
237
- value?: string;
238
- type?: string;
239
- };
240
- /** TXT records for SSL certificate validation */
241
- ssl?: Array<{
242
- txt_name?: string;
243
- txt_value?: string;
244
- }>;
245
- };
246
241
  declare const games: drizzle_orm_pg_core.PgTableWithColumns<{
247
242
  name: "games";
248
243
  schema: undefined;
@@ -571,207 +566,6 @@ declare const gameSessions: drizzle_orm_pg_core.PgTableWithColumns<{
571
566
  };
572
567
  dialect: "pg";
573
568
  }>;
574
- /**
575
- * Custom hostnames table
576
- *
577
- * Stores custom domain mappings for games with SSL provisioning via Cloudflare.
578
- */
579
- declare const gameCustomHostnames: drizzle_orm_pg_core.PgTableWithColumns<{
580
- name: "game_custom_hostnames";
581
- schema: undefined;
582
- columns: {
583
- id: drizzle_orm_pg_core.PgColumn<{
584
- name: "id";
585
- tableName: "game_custom_hostnames";
586
- dataType: "string";
587
- columnType: "PgUUID";
588
- data: string;
589
- driverParam: string;
590
- notNull: true;
591
- hasDefault: true;
592
- isPrimaryKey: true;
593
- isAutoincrement: false;
594
- hasRuntimeDefault: false;
595
- enumValues: undefined;
596
- baseColumn: never;
597
- identity: undefined;
598
- generated: undefined;
599
- }, {}, {}>;
600
- gameId: drizzle_orm_pg_core.PgColumn<{
601
- name: "game_id";
602
- tableName: "game_custom_hostnames";
603
- dataType: "string";
604
- columnType: "PgUUID";
605
- data: string;
606
- driverParam: string;
607
- notNull: true;
608
- hasDefault: false;
609
- isPrimaryKey: false;
610
- isAutoincrement: false;
611
- hasRuntimeDefault: false;
612
- enumValues: undefined;
613
- baseColumn: never;
614
- identity: undefined;
615
- generated: undefined;
616
- }, {}, {}>;
617
- userId: drizzle_orm_pg_core.PgColumn<{
618
- name: "user_id";
619
- tableName: "game_custom_hostnames";
620
- dataType: "string";
621
- columnType: "PgText";
622
- data: string;
623
- driverParam: string;
624
- notNull: true;
625
- hasDefault: false;
626
- isPrimaryKey: false;
627
- isAutoincrement: false;
628
- hasRuntimeDefault: false;
629
- enumValues: [string, ...string[]];
630
- baseColumn: never;
631
- identity: undefined;
632
- generated: undefined;
633
- }, {}, {}>;
634
- hostname: drizzle_orm_pg_core.PgColumn<{
635
- name: "hostname";
636
- tableName: "game_custom_hostnames";
637
- dataType: "string";
638
- columnType: "PgText";
639
- data: string;
640
- driverParam: string;
641
- notNull: true;
642
- hasDefault: false;
643
- isPrimaryKey: false;
644
- isAutoincrement: false;
645
- hasRuntimeDefault: false;
646
- enumValues: [string, ...string[]];
647
- baseColumn: never;
648
- identity: undefined;
649
- generated: undefined;
650
- }, {}, {}>;
651
- cloudflareId: drizzle_orm_pg_core.PgColumn<{
652
- name: "cloudflare_id";
653
- tableName: "game_custom_hostnames";
654
- dataType: "string";
655
- columnType: "PgText";
656
- data: string;
657
- driverParam: string;
658
- notNull: true;
659
- hasDefault: false;
660
- isPrimaryKey: false;
661
- isAutoincrement: false;
662
- hasRuntimeDefault: false;
663
- enumValues: [string, ...string[]];
664
- baseColumn: never;
665
- identity: undefined;
666
- generated: undefined;
667
- }, {}, {}>;
668
- environment: drizzle_orm_pg_core.PgColumn<{
669
- name: "environment";
670
- tableName: "game_custom_hostnames";
671
- dataType: "string";
672
- columnType: "PgEnumColumn";
673
- data: "staging" | "production";
674
- driverParam: string;
675
- notNull: true;
676
- hasDefault: true;
677
- isPrimaryKey: false;
678
- isAutoincrement: false;
679
- hasRuntimeDefault: false;
680
- enumValues: ["staging", "production"];
681
- baseColumn: never;
682
- identity: undefined;
683
- generated: undefined;
684
- }, {}, {}>;
685
- status: drizzle_orm_pg_core.PgColumn<{
686
- name: "status";
687
- tableName: "game_custom_hostnames";
688
- dataType: "string";
689
- columnType: "PgEnumColumn";
690
- data: "pending" | "pending_validation" | "pending_deployment" | "pending_deletion" | "active" | "blocked" | "deleted";
691
- driverParam: string;
692
- notNull: true;
693
- hasDefault: true;
694
- isPrimaryKey: false;
695
- isAutoincrement: false;
696
- hasRuntimeDefault: false;
697
- enumValues: ["pending", "pending_validation", "pending_deployment", "pending_deletion", "active", "blocked", "deleted"];
698
- baseColumn: never;
699
- identity: undefined;
700
- generated: undefined;
701
- }, {}, {}>;
702
- sslStatus: drizzle_orm_pg_core.PgColumn<{
703
- name: "ssl_status";
704
- tableName: "game_custom_hostnames";
705
- dataType: "string";
706
- columnType: "PgEnumColumn";
707
- data: "pending_validation" | "pending_deployment" | "active" | "deleted" | "initializing" | "pending_issuance";
708
- driverParam: string;
709
- notNull: true;
710
- hasDefault: true;
711
- isPrimaryKey: false;
712
- isAutoincrement: false;
713
- hasRuntimeDefault: false;
714
- enumValues: ["initializing", "pending_validation", "pending_issuance", "pending_deployment", "active", "deleted"];
715
- baseColumn: never;
716
- identity: undefined;
717
- generated: undefined;
718
- }, {}, {}>;
719
- validationRecords: drizzle_orm_pg_core.PgColumn<{
720
- name: "validation_records";
721
- tableName: "game_custom_hostnames";
722
- dataType: "json";
723
- columnType: "PgJsonb";
724
- data: CustomHostnameValidationRecords;
725
- driverParam: unknown;
726
- notNull: false;
727
- hasDefault: false;
728
- isPrimaryKey: false;
729
- isAutoincrement: false;
730
- hasRuntimeDefault: false;
731
- enumValues: undefined;
732
- baseColumn: never;
733
- identity: undefined;
734
- generated: undefined;
735
- }, {}, {
736
- $type: CustomHostnameValidationRecords;
737
- }>;
738
- createdAt: drizzle_orm_pg_core.PgColumn<{
739
- name: "created_at";
740
- tableName: "game_custom_hostnames";
741
- dataType: "date";
742
- columnType: "PgTimestamp";
743
- data: Date;
744
- driverParam: string;
745
- notNull: true;
746
- hasDefault: true;
747
- isPrimaryKey: false;
748
- isAutoincrement: false;
749
- hasRuntimeDefault: false;
750
- enumValues: undefined;
751
- baseColumn: never;
752
- identity: undefined;
753
- generated: undefined;
754
- }, {}, {}>;
755
- updatedAt: drizzle_orm_pg_core.PgColumn<{
756
- name: "updated_at";
757
- tableName: "game_custom_hostnames";
758
- dataType: "date";
759
- columnType: "PgTimestamp";
760
- data: Date;
761
- driverParam: string;
762
- notNull: true;
763
- hasDefault: true;
764
- isPrimaryKey: false;
765
- isAutoincrement: false;
766
- hasRuntimeDefault: false;
767
- enumValues: undefined;
768
- baseColumn: never;
769
- identity: undefined;
770
- generated: undefined;
771
- }, {}, {}>;
772
- };
773
- dialect: "pg";
774
- }>;
775
569
  declare const items: drizzle_orm_pg_core.PgTableWithColumns<{
776
570
  name: "items";
777
571
  schema: undefined;
@@ -1150,13 +944,13 @@ declare const currencies: drizzle_orm_pg_core.PgTableWithColumns<{
1150
944
  };
1151
945
  dialect: "pg";
1152
946
  }>;
1153
- declare const shopListings: drizzle_orm_pg_core.PgTableWithColumns<{
1154
- name: "shop_listings";
947
+ declare const maps: drizzle_orm_pg_core.PgTableWithColumns<{
948
+ name: "maps";
1155
949
  schema: undefined;
1156
950
  columns: {
1157
951
  id: drizzle_orm_pg_core.PgColumn<{
1158
952
  name: "id";
1159
- tableName: "shop_listings";
953
+ tableName: "maps";
1160
954
  dataType: "string";
1161
955
  columnType: "PgUUID";
1162
956
  data: string;
@@ -1171,11 +965,11 @@ declare const shopListings: drizzle_orm_pg_core.PgTableWithColumns<{
1171
965
  identity: undefined;
1172
966
  generated: undefined;
1173
967
  }, {}, {}>;
1174
- itemId: drizzle_orm_pg_core.PgColumn<{
1175
- name: "item_id";
1176
- tableName: "shop_listings";
968
+ identifier: drizzle_orm_pg_core.PgColumn<{
969
+ name: "identifier";
970
+ tableName: "maps";
1177
971
  dataType: "string";
1178
- columnType: "PgUUID";
972
+ columnType: "PgVarchar";
1179
973
  data: string;
1180
974
  driverParam: string;
1181
975
  notNull: true;
@@ -1183,16 +977,18 @@ declare const shopListings: drizzle_orm_pg_core.PgTableWithColumns<{
1183
977
  isPrimaryKey: false;
1184
978
  isAutoincrement: false;
1185
979
  hasRuntimeDefault: false;
1186
- enumValues: undefined;
980
+ enumValues: [string, ...string[]];
1187
981
  baseColumn: never;
1188
982
  identity: undefined;
1189
983
  generated: undefined;
1190
- }, {}, {}>;
1191
- currencyId: drizzle_orm_pg_core.PgColumn<{
1192
- name: "currency_id";
1193
- tableName: "shop_listings";
984
+ }, {}, {
985
+ length: 255;
986
+ }>;
987
+ displayName: drizzle_orm_pg_core.PgColumn<{
988
+ name: "display_name";
989
+ tableName: "maps";
1194
990
  dataType: "string";
1195
- columnType: "PgUUID";
991
+ columnType: "PgVarchar";
1196
992
  data: string;
1197
993
  driverParam: string;
1198
994
  notNull: true;
@@ -1200,241 +996,45 @@ declare const shopListings: drizzle_orm_pg_core.PgTableWithColumns<{
1200
996
  isPrimaryKey: false;
1201
997
  isAutoincrement: false;
1202
998
  hasRuntimeDefault: false;
1203
- enumValues: undefined;
999
+ enumValues: [string, ...string[]];
1204
1000
  baseColumn: never;
1205
1001
  identity: undefined;
1206
1002
  generated: undefined;
1207
- }, {}, {}>;
1208
- price: drizzle_orm_pg_core.PgColumn<{
1209
- name: "price";
1210
- tableName: "shop_listings";
1211
- dataType: "number";
1212
- columnType: "PgInteger";
1213
- data: number;
1214
- driverParam: string | number;
1003
+ }, {}, {
1004
+ length: 255;
1005
+ }>;
1006
+ filePath: drizzle_orm_pg_core.PgColumn<{
1007
+ name: "file_path";
1008
+ tableName: "maps";
1009
+ dataType: "string";
1010
+ columnType: "PgVarchar";
1011
+ data: string;
1012
+ driverParam: string;
1215
1013
  notNull: true;
1216
1014
  hasDefault: false;
1217
1015
  isPrimaryKey: false;
1218
1016
  isAutoincrement: false;
1219
1017
  hasRuntimeDefault: false;
1220
- enumValues: undefined;
1018
+ enumValues: [string, ...string[]];
1221
1019
  baseColumn: never;
1222
1020
  identity: undefined;
1223
1021
  generated: undefined;
1224
- }, {}, {}>;
1225
- sellBackPercentage: drizzle_orm_pg_core.PgColumn<{
1226
- name: "sell_back_percentage";
1227
- tableName: "shop_listings";
1228
- dataType: "number";
1229
- columnType: "PgInteger";
1230
- data: number;
1231
- driverParam: string | number;
1232
- notNull: false;
1233
- hasDefault: false;
1022
+ }, {}, {
1023
+ length: 255;
1024
+ }>;
1025
+ tilesetBasePath: drizzle_orm_pg_core.PgColumn<{
1026
+ name: "tileset_base_path";
1027
+ tableName: "maps";
1028
+ dataType: "string";
1029
+ columnType: "PgVarchar";
1030
+ data: string;
1031
+ driverParam: string;
1032
+ notNull: true;
1033
+ hasDefault: true;
1234
1034
  isPrimaryKey: false;
1235
1035
  isAutoincrement: false;
1236
1036
  hasRuntimeDefault: false;
1237
- enumValues: undefined;
1238
- baseColumn: never;
1239
- identity: undefined;
1240
- generated: undefined;
1241
- }, {}, {}>;
1242
- stock: drizzle_orm_pg_core.PgColumn<{
1243
- name: "stock";
1244
- tableName: "shop_listings";
1245
- dataType: "number";
1246
- columnType: "PgInteger";
1247
- data: number;
1248
- driverParam: string | number;
1249
- notNull: false;
1250
- hasDefault: false;
1251
- isPrimaryKey: false;
1252
- isAutoincrement: false;
1253
- hasRuntimeDefault: false;
1254
- enumValues: undefined;
1255
- baseColumn: never;
1256
- identity: undefined;
1257
- generated: undefined;
1258
- }, {}, {}>;
1259
- isActive: drizzle_orm_pg_core.PgColumn<{
1260
- name: "is_active";
1261
- tableName: "shop_listings";
1262
- dataType: "boolean";
1263
- columnType: "PgBoolean";
1264
- data: boolean;
1265
- driverParam: boolean;
1266
- notNull: true;
1267
- hasDefault: true;
1268
- isPrimaryKey: false;
1269
- isAutoincrement: false;
1270
- hasRuntimeDefault: false;
1271
- enumValues: undefined;
1272
- baseColumn: never;
1273
- identity: undefined;
1274
- generated: undefined;
1275
- }, {}, {}>;
1276
- availableFrom: drizzle_orm_pg_core.PgColumn<{
1277
- name: "available_from";
1278
- tableName: "shop_listings";
1279
- dataType: "date";
1280
- columnType: "PgTimestamp";
1281
- data: Date;
1282
- driverParam: string;
1283
- notNull: false;
1284
- hasDefault: false;
1285
- isPrimaryKey: false;
1286
- isAutoincrement: false;
1287
- hasRuntimeDefault: false;
1288
- enumValues: undefined;
1289
- baseColumn: never;
1290
- identity: undefined;
1291
- generated: undefined;
1292
- }, {}, {}>;
1293
- availableUntil: drizzle_orm_pg_core.PgColumn<{
1294
- name: "available_until";
1295
- tableName: "shop_listings";
1296
- dataType: "date";
1297
- columnType: "PgTimestamp";
1298
- data: Date;
1299
- driverParam: string;
1300
- notNull: false;
1301
- hasDefault: false;
1302
- isPrimaryKey: false;
1303
- isAutoincrement: false;
1304
- hasRuntimeDefault: false;
1305
- enumValues: undefined;
1306
- baseColumn: never;
1307
- identity: undefined;
1308
- generated: undefined;
1309
- }, {}, {}>;
1310
- createdAt: drizzle_orm_pg_core.PgColumn<{
1311
- name: "created_at";
1312
- tableName: "shop_listings";
1313
- dataType: "date";
1314
- columnType: "PgTimestamp";
1315
- data: Date;
1316
- driverParam: string;
1317
- notNull: true;
1318
- hasDefault: true;
1319
- isPrimaryKey: false;
1320
- isAutoincrement: false;
1321
- hasRuntimeDefault: false;
1322
- enumValues: undefined;
1323
- baseColumn: never;
1324
- identity: undefined;
1325
- generated: undefined;
1326
- }, {}, {}>;
1327
- updatedAt: drizzle_orm_pg_core.PgColumn<{
1328
- name: "updated_at";
1329
- tableName: "shop_listings";
1330
- dataType: "date";
1331
- columnType: "PgTimestamp";
1332
- data: Date;
1333
- driverParam: string;
1334
- notNull: false;
1335
- hasDefault: true;
1336
- isPrimaryKey: false;
1337
- isAutoincrement: false;
1338
- hasRuntimeDefault: false;
1339
- enumValues: undefined;
1340
- baseColumn: never;
1341
- identity: undefined;
1342
- generated: undefined;
1343
- }, {}, {}>;
1344
- };
1345
- dialect: "pg";
1346
- }>;
1347
- declare const maps: drizzle_orm_pg_core.PgTableWithColumns<{
1348
- name: "maps";
1349
- schema: undefined;
1350
- columns: {
1351
- id: drizzle_orm_pg_core.PgColumn<{
1352
- name: "id";
1353
- tableName: "maps";
1354
- dataType: "string";
1355
- columnType: "PgUUID";
1356
- data: string;
1357
- driverParam: string;
1358
- notNull: true;
1359
- hasDefault: true;
1360
- isPrimaryKey: true;
1361
- isAutoincrement: false;
1362
- hasRuntimeDefault: false;
1363
- enumValues: undefined;
1364
- baseColumn: never;
1365
- identity: undefined;
1366
- generated: undefined;
1367
- }, {}, {}>;
1368
- identifier: drizzle_orm_pg_core.PgColumn<{
1369
- name: "identifier";
1370
- tableName: "maps";
1371
- dataType: "string";
1372
- columnType: "PgVarchar";
1373
- data: string;
1374
- driverParam: string;
1375
- notNull: true;
1376
- hasDefault: false;
1377
- isPrimaryKey: false;
1378
- isAutoincrement: false;
1379
- hasRuntimeDefault: false;
1380
- enumValues: [string, ...string[]];
1381
- baseColumn: never;
1382
- identity: undefined;
1383
- generated: undefined;
1384
- }, {}, {
1385
- length: 255;
1386
- }>;
1387
- displayName: drizzle_orm_pg_core.PgColumn<{
1388
- name: "display_name";
1389
- tableName: "maps";
1390
- dataType: "string";
1391
- columnType: "PgVarchar";
1392
- data: string;
1393
- driverParam: string;
1394
- notNull: true;
1395
- hasDefault: false;
1396
- isPrimaryKey: false;
1397
- isAutoincrement: false;
1398
- hasRuntimeDefault: false;
1399
- enumValues: [string, ...string[]];
1400
- baseColumn: never;
1401
- identity: undefined;
1402
- generated: undefined;
1403
- }, {}, {
1404
- length: 255;
1405
- }>;
1406
- filePath: drizzle_orm_pg_core.PgColumn<{
1407
- name: "file_path";
1408
- tableName: "maps";
1409
- dataType: "string";
1410
- columnType: "PgVarchar";
1411
- data: string;
1412
- driverParam: string;
1413
- notNull: true;
1414
- hasDefault: false;
1415
- isPrimaryKey: false;
1416
- isAutoincrement: false;
1417
- hasRuntimeDefault: false;
1418
- enumValues: [string, ...string[]];
1419
- baseColumn: never;
1420
- identity: undefined;
1421
- generated: undefined;
1422
- }, {}, {
1423
- length: 255;
1424
- }>;
1425
- tilesetBasePath: drizzle_orm_pg_core.PgColumn<{
1426
- name: "tileset_base_path";
1427
- tableName: "maps";
1428
- dataType: "string";
1429
- columnType: "PgVarchar";
1430
- data: string;
1431
- driverParam: string;
1432
- notNull: true;
1433
- hasDefault: true;
1434
- isPrimaryKey: false;
1435
- isAutoincrement: false;
1436
- hasRuntimeDefault: false;
1437
- enumValues: [string, ...string[]];
1037
+ enumValues: [string, ...string[]];
1438
1038
  baseColumn: never;
1439
1039
  identity: undefined;
1440
1040
  generated: undefined;
@@ -2521,32 +2121,36 @@ declare const playerCharacterAccessories: drizzle_orm_pg_core.PgTableWithColumns
2521
2121
  };
2522
2122
  dialect: "pg";
2523
2123
  }>;
2524
- declare const gameTimebackIntegrations: drizzle_orm_pg_core.PgTableWithColumns<{
2525
- name: "game_timeback_integrations";
2124
+
2125
+ declare const achievementScopeEnum: drizzle_orm_pg_core.PgEnum<["daily", "weekly", "monthly", "yearly", "game", "global", "map", "level", "event"]>;
2126
+ declare const achievements: drizzle_orm_pg_core.PgTableWithColumns<{
2127
+ name: "achievements";
2526
2128
  schema: undefined;
2527
2129
  columns: {
2528
2130
  id: drizzle_orm_pg_core.PgColumn<{
2529
2131
  name: "id";
2530
- tableName: "game_timeback_integrations";
2132
+ tableName: "achievements";
2531
2133
  dataType: "string";
2532
- columnType: "PgUUID";
2134
+ columnType: "PgVarchar";
2533
2135
  data: string;
2534
2136
  driverParam: string;
2535
2137
  notNull: true;
2536
- hasDefault: true;
2138
+ hasDefault: false;
2537
2139
  isPrimaryKey: true;
2538
2140
  isAutoincrement: false;
2539
2141
  hasRuntimeDefault: false;
2540
- enumValues: undefined;
2142
+ enumValues: [string, ...string[]];
2541
2143
  baseColumn: never;
2542
2144
  identity: undefined;
2543
2145
  generated: undefined;
2544
- }, {}, {}>;
2545
- gameId: drizzle_orm_pg_core.PgColumn<{
2546
- name: "game_id";
2547
- tableName: "game_timeback_integrations";
2146
+ }, {}, {
2147
+ length: 255;
2148
+ }>;
2149
+ title: drizzle_orm_pg_core.PgColumn<{
2150
+ name: "title";
2151
+ tableName: "achievements";
2548
2152
  dataType: "string";
2549
- columnType: "PgUUID";
2153
+ columnType: "PgVarchar";
2550
2154
  data: string;
2551
2155
  driverParam: string;
2552
2156
  notNull: true;
@@ -2554,19 +2158,21 @@ declare const gameTimebackIntegrations: drizzle_orm_pg_core.PgTableWithColumns<{
2554
2158
  isPrimaryKey: false;
2555
2159
  isAutoincrement: false;
2556
2160
  hasRuntimeDefault: false;
2557
- enumValues: undefined;
2161
+ enumValues: [string, ...string[]];
2558
2162
  baseColumn: never;
2559
2163
  identity: undefined;
2560
2164
  generated: undefined;
2561
- }, {}, {}>;
2562
- courseId: drizzle_orm_pg_core.PgColumn<{
2563
- name: "course_id";
2564
- tableName: "game_timeback_integrations";
2165
+ }, {}, {
2166
+ length: 255;
2167
+ }>;
2168
+ description: drizzle_orm_pg_core.PgColumn<{
2169
+ name: "description";
2170
+ tableName: "achievements";
2565
2171
  dataType: "string";
2566
2172
  columnType: "PgText";
2567
2173
  data: string;
2568
2174
  driverParam: string;
2569
- notNull: true;
2175
+ notNull: false;
2570
2176
  hasDefault: false;
2571
2177
  isPrimaryKey: false;
2572
2178
  isAutoincrement: false;
@@ -2576,30 +2182,30 @@ declare const gameTimebackIntegrations: drizzle_orm_pg_core.PgTableWithColumns<{
2576
2182
  identity: undefined;
2577
2183
  generated: undefined;
2578
2184
  }, {}, {}>;
2579
- lastVerifiedAt: drizzle_orm_pg_core.PgColumn<{
2580
- name: "last_verified_at";
2581
- tableName: "game_timeback_integrations";
2582
- dataType: "date";
2583
- columnType: "PgTimestamp";
2584
- data: Date;
2185
+ scope: drizzle_orm_pg_core.PgColumn<{
2186
+ name: "scope";
2187
+ tableName: "achievements";
2188
+ dataType: "string";
2189
+ columnType: "PgEnumColumn";
2190
+ data: "map" | "game" | "level" | "daily" | "weekly" | "monthly" | "yearly" | "global" | "event";
2585
2191
  driverParam: string;
2586
- notNull: false;
2192
+ notNull: true;
2587
2193
  hasDefault: false;
2588
2194
  isPrimaryKey: false;
2589
2195
  isAutoincrement: false;
2590
2196
  hasRuntimeDefault: false;
2591
- enumValues: undefined;
2197
+ enumValues: ["daily", "weekly", "monthly", "yearly", "game", "global", "map", "level", "event"];
2592
2198
  baseColumn: never;
2593
2199
  identity: undefined;
2594
2200
  generated: undefined;
2595
2201
  }, {}, {}>;
2596
- createdAt: drizzle_orm_pg_core.PgColumn<{
2597
- name: "created_at";
2598
- tableName: "game_timeback_integrations";
2599
- dataType: "date";
2600
- columnType: "PgTimestamp";
2601
- data: Date;
2602
- driverParam: string;
2202
+ rewardCredits: drizzle_orm_pg_core.PgColumn<{
2203
+ name: "reward_credits";
2204
+ tableName: "achievements";
2205
+ dataType: "number";
2206
+ columnType: "PgInteger";
2207
+ data: number;
2208
+ driverParam: string | number;
2603
2209
  notNull: true;
2604
2210
  hasDefault: true;
2605
2211
  isPrimaryKey: false;
@@ -2610,128 +2216,13 @@ declare const gameTimebackIntegrations: drizzle_orm_pg_core.PgTableWithColumns<{
2610
2216
  identity: undefined;
2611
2217
  generated: undefined;
2612
2218
  }, {}, {}>;
2613
- updatedAt: drizzle_orm_pg_core.PgColumn<{
2614
- name: "updated_at";
2615
- tableName: "game_timeback_integrations";
2616
- dataType: "date";
2617
- columnType: "PgTimestamp";
2618
- data: Date;
2619
- driverParam: string;
2620
- notNull: true;
2621
- hasDefault: true;
2622
- isPrimaryKey: false;
2623
- isAutoincrement: false;
2624
- hasRuntimeDefault: false;
2625
- enumValues: undefined;
2626
- baseColumn: never;
2627
- identity: undefined;
2628
- generated: undefined;
2629
- }, {}, {}>;
2630
- };
2631
- dialect: "pg";
2632
- }>;
2633
-
2634
- declare const achievementScopeEnum: drizzle_orm_pg_core.PgEnum<["daily", "weekly", "monthly", "yearly", "game", "global", "map", "level", "event"]>;
2635
- declare const achievements: drizzle_orm_pg_core.PgTableWithColumns<{
2636
- name: "achievements";
2637
- schema: undefined;
2638
- columns: {
2639
- id: drizzle_orm_pg_core.PgColumn<{
2640
- name: "id";
2641
- tableName: "achievements";
2642
- dataType: "string";
2643
- columnType: "PgVarchar";
2644
- data: string;
2645
- driverParam: string;
2646
- notNull: true;
2647
- hasDefault: false;
2648
- isPrimaryKey: true;
2649
- isAutoincrement: false;
2650
- hasRuntimeDefault: false;
2651
- enumValues: [string, ...string[]];
2652
- baseColumn: never;
2653
- identity: undefined;
2654
- generated: undefined;
2655
- }, {}, {
2656
- length: 255;
2657
- }>;
2658
- title: drizzle_orm_pg_core.PgColumn<{
2659
- name: "title";
2660
- tableName: "achievements";
2661
- dataType: "string";
2662
- columnType: "PgVarchar";
2663
- data: string;
2664
- driverParam: string;
2665
- notNull: true;
2666
- hasDefault: false;
2667
- isPrimaryKey: false;
2668
- isAutoincrement: false;
2669
- hasRuntimeDefault: false;
2670
- enumValues: [string, ...string[]];
2671
- baseColumn: never;
2672
- identity: undefined;
2673
- generated: undefined;
2674
- }, {}, {
2675
- length: 255;
2676
- }>;
2677
- description: drizzle_orm_pg_core.PgColumn<{
2678
- name: "description";
2679
- tableName: "achievements";
2680
- dataType: "string";
2681
- columnType: "PgText";
2682
- data: string;
2683
- driverParam: string;
2684
- notNull: false;
2685
- hasDefault: false;
2686
- isPrimaryKey: false;
2687
- isAutoincrement: false;
2688
- hasRuntimeDefault: false;
2689
- enumValues: [string, ...string[]];
2690
- baseColumn: never;
2691
- identity: undefined;
2692
- generated: undefined;
2693
- }, {}, {}>;
2694
- scope: drizzle_orm_pg_core.PgColumn<{
2695
- name: "scope";
2696
- tableName: "achievements";
2697
- dataType: "string";
2698
- columnType: "PgEnumColumn";
2699
- data: "map" | "game" | "level" | "daily" | "weekly" | "monthly" | "yearly" | "global" | "event";
2700
- driverParam: string;
2701
- notNull: true;
2702
- hasDefault: false;
2703
- isPrimaryKey: false;
2704
- isAutoincrement: false;
2705
- hasRuntimeDefault: false;
2706
- enumValues: ["daily", "weekly", "monthly", "yearly", "game", "global", "map", "level", "event"];
2707
- baseColumn: never;
2708
- identity: undefined;
2709
- generated: undefined;
2710
- }, {}, {}>;
2711
- rewardCredits: drizzle_orm_pg_core.PgColumn<{
2712
- name: "reward_credits";
2713
- tableName: "achievements";
2714
- dataType: "number";
2715
- columnType: "PgInteger";
2716
- data: number;
2717
- driverParam: string | number;
2718
- notNull: true;
2719
- hasDefault: true;
2720
- isPrimaryKey: false;
2721
- isAutoincrement: false;
2722
- hasRuntimeDefault: false;
2723
- enumValues: undefined;
2724
- baseColumn: never;
2725
- identity: undefined;
2726
- generated: undefined;
2727
- }, {}, {}>;
2728
- limit: drizzle_orm_pg_core.PgColumn<{
2729
- name: "limit";
2730
- tableName: "achievements";
2731
- dataType: "number";
2732
- columnType: "PgInteger";
2733
- data: number;
2734
- driverParam: string | number;
2219
+ limit: drizzle_orm_pg_core.PgColumn<{
2220
+ name: "limit";
2221
+ tableName: "achievements";
2222
+ dataType: "number";
2223
+ columnType: "PgInteger";
2224
+ data: number;
2225
+ driverParam: string | number;
2735
2226
  notNull: true;
2736
2227
  hasDefault: true;
2737
2228
  isPrimaryKey: false;
@@ -2849,291 +2340,6 @@ declare const achievements: drizzle_orm_pg_core.PgTableWithColumns<{
2849
2340
  };
2850
2341
  dialect: "pg";
2851
2342
  }>;
2852
- declare const notifications: drizzle_orm_pg_core.PgTableWithColumns<{
2853
- name: "notifications";
2854
- schema: undefined;
2855
- columns: {
2856
- id: drizzle_orm_pg_core.PgColumn<{
2857
- name: "id";
2858
- tableName: "notifications";
2859
- dataType: "string";
2860
- columnType: "PgUUID";
2861
- data: string;
2862
- driverParam: string;
2863
- notNull: true;
2864
- hasDefault: true;
2865
- isPrimaryKey: true;
2866
- isAutoincrement: false;
2867
- hasRuntimeDefault: false;
2868
- enumValues: undefined;
2869
- baseColumn: never;
2870
- identity: undefined;
2871
- generated: undefined;
2872
- }, {}, {}>;
2873
- userId: drizzle_orm_pg_core.PgColumn<{
2874
- name: "user_id";
2875
- tableName: "notifications";
2876
- dataType: "string";
2877
- columnType: "PgText";
2878
- data: string;
2879
- driverParam: string;
2880
- notNull: true;
2881
- hasDefault: false;
2882
- isPrimaryKey: false;
2883
- isAutoincrement: false;
2884
- hasRuntimeDefault: false;
2885
- enumValues: [string, ...string[]];
2886
- baseColumn: never;
2887
- identity: undefined;
2888
- generated: undefined;
2889
- }, {}, {}>;
2890
- type: drizzle_orm_pg_core.PgColumn<{
2891
- name: "type";
2892
- tableName: "notifications";
2893
- dataType: "string";
2894
- columnType: "PgVarchar";
2895
- data: string;
2896
- driverParam: string;
2897
- notNull: true;
2898
- hasDefault: false;
2899
- isPrimaryKey: false;
2900
- isAutoincrement: false;
2901
- hasRuntimeDefault: false;
2902
- enumValues: [string, ...string[]];
2903
- baseColumn: never;
2904
- identity: undefined;
2905
- generated: undefined;
2906
- }, {}, {
2907
- length: 50;
2908
- }>;
2909
- title: drizzle_orm_pg_core.PgColumn<{
2910
- name: "title";
2911
- tableName: "notifications";
2912
- dataType: "string";
2913
- columnType: "PgVarchar";
2914
- data: string;
2915
- driverParam: string;
2916
- notNull: true;
2917
- hasDefault: false;
2918
- isPrimaryKey: false;
2919
- isAutoincrement: false;
2920
- hasRuntimeDefault: false;
2921
- enumValues: [string, ...string[]];
2922
- baseColumn: never;
2923
- identity: undefined;
2924
- generated: undefined;
2925
- }, {}, {
2926
- length: 255;
2927
- }>;
2928
- message: drizzle_orm_pg_core.PgColumn<{
2929
- name: "message";
2930
- tableName: "notifications";
2931
- dataType: "string";
2932
- columnType: "PgText";
2933
- data: string;
2934
- driverParam: string;
2935
- notNull: true;
2936
- hasDefault: false;
2937
- isPrimaryKey: false;
2938
- isAutoincrement: false;
2939
- hasRuntimeDefault: false;
2940
- enumValues: [string, ...string[]];
2941
- baseColumn: never;
2942
- identity: undefined;
2943
- generated: undefined;
2944
- }, {}, {}>;
2945
- data: drizzle_orm_pg_core.PgColumn<{
2946
- name: "data";
2947
- tableName: "notifications";
2948
- dataType: "json";
2949
- columnType: "PgJsonb";
2950
- data: unknown;
2951
- driverParam: unknown;
2952
- notNull: true;
2953
- hasDefault: true;
2954
- isPrimaryKey: false;
2955
- isAutoincrement: false;
2956
- hasRuntimeDefault: false;
2957
- enumValues: undefined;
2958
- baseColumn: never;
2959
- identity: undefined;
2960
- generated: undefined;
2961
- }, {}, {}>;
2962
- priority: drizzle_orm_pg_core.PgColumn<{
2963
- name: "priority";
2964
- tableName: "notifications";
2965
- dataType: "string";
2966
- columnType: "PgEnumColumn";
2967
- data: "low" | "normal" | "high" | "urgent";
2968
- driverParam: string;
2969
- notNull: true;
2970
- hasDefault: true;
2971
- isPrimaryKey: false;
2972
- isAutoincrement: false;
2973
- hasRuntimeDefault: false;
2974
- enumValues: ["low", "normal", "high", "urgent"];
2975
- baseColumn: never;
2976
- identity: undefined;
2977
- generated: undefined;
2978
- }, {}, {}>;
2979
- status: drizzle_orm_pg_core.PgColumn<{
2980
- name: "status";
2981
- tableName: "notifications";
2982
- dataType: "string";
2983
- columnType: "PgEnumColumn";
2984
- data: "pending" | "delivered" | "seen" | "clicked" | "dismissed" | "expired";
2985
- driverParam: string;
2986
- notNull: true;
2987
- hasDefault: true;
2988
- isPrimaryKey: false;
2989
- isAutoincrement: false;
2990
- hasRuntimeDefault: false;
2991
- enumValues: ["pending", "delivered", "seen", "clicked", "dismissed", "expired"];
2992
- baseColumn: never;
2993
- identity: undefined;
2994
- generated: undefined;
2995
- }, {}, {}>;
2996
- createdAt: drizzle_orm_pg_core.PgColumn<{
2997
- name: "created_at";
2998
- tableName: "notifications";
2999
- dataType: "date";
3000
- columnType: "PgTimestamp";
3001
- data: Date;
3002
- driverParam: string;
3003
- notNull: true;
3004
- hasDefault: true;
3005
- isPrimaryKey: false;
3006
- isAutoincrement: false;
3007
- hasRuntimeDefault: false;
3008
- enumValues: undefined;
3009
- baseColumn: never;
3010
- identity: undefined;
3011
- generated: undefined;
3012
- }, {}, {}>;
3013
- deliveredAt: drizzle_orm_pg_core.PgColumn<{
3014
- name: "delivered_at";
3015
- tableName: "notifications";
3016
- dataType: "date";
3017
- columnType: "PgTimestamp";
3018
- data: Date;
3019
- driverParam: string;
3020
- notNull: false;
3021
- hasDefault: false;
3022
- isPrimaryKey: false;
3023
- isAutoincrement: false;
3024
- hasRuntimeDefault: false;
3025
- enumValues: undefined;
3026
- baseColumn: never;
3027
- identity: undefined;
3028
- generated: undefined;
3029
- }, {}, {}>;
3030
- seenAt: drizzle_orm_pg_core.PgColumn<{
3031
- name: "seen_at";
3032
- tableName: "notifications";
3033
- dataType: "date";
3034
- columnType: "PgTimestamp";
3035
- data: Date;
3036
- driverParam: string;
3037
- notNull: false;
3038
- hasDefault: false;
3039
- isPrimaryKey: false;
3040
- isAutoincrement: false;
3041
- hasRuntimeDefault: false;
3042
- enumValues: undefined;
3043
- baseColumn: never;
3044
- identity: undefined;
3045
- generated: undefined;
3046
- }, {}, {}>;
3047
- clickedAt: drizzle_orm_pg_core.PgColumn<{
3048
- name: "clicked_at";
3049
- tableName: "notifications";
3050
- dataType: "date";
3051
- columnType: "PgTimestamp";
3052
- data: Date;
3053
- driverParam: string;
3054
- notNull: false;
3055
- hasDefault: false;
3056
- isPrimaryKey: false;
3057
- isAutoincrement: false;
3058
- hasRuntimeDefault: false;
3059
- enumValues: undefined;
3060
- baseColumn: never;
3061
- identity: undefined;
3062
- generated: undefined;
3063
- }, {}, {}>;
3064
- expiresAt: drizzle_orm_pg_core.PgColumn<{
3065
- name: "expires_at";
3066
- tableName: "notifications";
3067
- dataType: "date";
3068
- columnType: "PgTimestamp";
3069
- data: Date;
3070
- driverParam: string;
3071
- notNull: false;
3072
- hasDefault: false;
3073
- isPrimaryKey: false;
3074
- isAutoincrement: false;
3075
- hasRuntimeDefault: false;
3076
- enumValues: undefined;
3077
- baseColumn: never;
3078
- identity: undefined;
3079
- generated: undefined;
3080
- }, {}, {}>;
3081
- method: drizzle_orm_pg_core.PgColumn<{
3082
- name: "method";
3083
- tableName: "notifications";
3084
- dataType: "string";
3085
- columnType: "PgVarchar";
3086
- data: string;
3087
- driverParam: string;
3088
- notNull: false;
3089
- hasDefault: false;
3090
- isPrimaryKey: false;
3091
- isAutoincrement: false;
3092
- hasRuntimeDefault: false;
3093
- enumValues: [string, ...string[]];
3094
- baseColumn: never;
3095
- identity: undefined;
3096
- generated: undefined;
3097
- }, {}, {
3098
- length: 50;
3099
- }>;
3100
- clickUrl: drizzle_orm_pg_core.PgColumn<{
3101
- name: "click_url";
3102
- tableName: "notifications";
3103
- dataType: "string";
3104
- columnType: "PgText";
3105
- data: string;
3106
- driverParam: string;
3107
- notNull: false;
3108
- hasDefault: false;
3109
- isPrimaryKey: false;
3110
- isAutoincrement: false;
3111
- hasRuntimeDefault: false;
3112
- enumValues: [string, ...string[]];
3113
- baseColumn: never;
3114
- identity: undefined;
3115
- generated: undefined;
3116
- }, {}, {}>;
3117
- metadata: drizzle_orm_pg_core.PgColumn<{
3118
- name: "metadata";
3119
- tableName: "notifications";
3120
- dataType: "json";
3121
- columnType: "PgJsonb";
3122
- data: unknown;
3123
- driverParam: unknown;
3124
- notNull: true;
3125
- hasDefault: true;
3126
- isPrimaryKey: false;
3127
- isAutoincrement: false;
3128
- hasRuntimeDefault: false;
3129
- enumValues: undefined;
3130
- baseColumn: never;
3131
- identity: undefined;
3132
- generated: undefined;
3133
- }, {}, {}>;
3134
- };
3135
- dialect: "pg";
3136
- }>;
3137
2343
  declare const DeveloperStatusResponseSchema: z.ZodObject<{
3138
2344
  status: z.ZodEnum<["none", "pending", "approved"]>;
3139
2345
  }, "strip", z.ZodTypeAny, {
@@ -3141,42 +2347,6 @@ declare const DeveloperStatusResponseSchema: z.ZodObject<{
3141
2347
  }, {
3142
2348
  status: "none" | "pending" | "approved";
3143
2349
  }>;
3144
- declare const UpsertGameMetadataSchema: z.ZodEffects<z.ZodObject<{
3145
- displayName: z.ZodString;
3146
- mapElementId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
3147
- platform: z.ZodEnum<["web", "godot", "unity"]>;
3148
- metadata: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
3149
- gameType: z.ZodDefault<z.ZodOptional<z.ZodEnum<["hosted", "external"]>>>;
3150
- externalUrl: z.ZodOptional<z.ZodString>;
3151
- }, "strip", z.ZodTypeAny, {
3152
- displayName: string;
3153
- gameType: "hosted" | "external";
3154
- platform: "web" | "godot" | "unity";
3155
- metadata: Record<string, unknown>;
3156
- externalUrl?: string | undefined;
3157
- mapElementId?: string | null | undefined;
3158
- }, {
3159
- displayName: string;
3160
- platform: "web" | "godot" | "unity";
3161
- gameType?: "hosted" | "external" | undefined;
3162
- externalUrl?: string | undefined;
3163
- mapElementId?: string | null | undefined;
3164
- metadata?: Record<string, unknown> | undefined;
3165
- }>, {
3166
- displayName: string;
3167
- gameType: "hosted" | "external";
3168
- platform: "web" | "godot" | "unity";
3169
- metadata: Record<string, unknown>;
3170
- externalUrl?: string | undefined;
3171
- mapElementId?: string | null | undefined;
3172
- }, {
3173
- displayName: string;
3174
- platform: "web" | "godot" | "unity";
3175
- gameType?: "hosted" | "external" | undefined;
3176
- externalUrl?: string | undefined;
3177
- mapElementId?: string | null | undefined;
3178
- metadata?: Record<string, unknown> | undefined;
3179
- }>;
3180
2350
  /**
3181
2351
  * Simplified game manifest for Cloudflare Workers deployments
3182
2352
  *
@@ -3204,299 +2374,6 @@ declare const ManifestV1Schema: z.ZodObject<{
3204
2374
  version: string;
3205
2375
  platform: string;
3206
2376
  }>;
3207
- declare const InsertItemSchema: drizzle_zod.BuildSchema<"insert", {
3208
- id: drizzle_orm_pg_core.PgColumn<{
3209
- name: "id";
3210
- tableName: "items";
3211
- dataType: "string";
3212
- columnType: "PgUUID";
3213
- data: string;
3214
- driverParam: string;
3215
- notNull: true;
3216
- hasDefault: true;
3217
- isPrimaryKey: true;
3218
- isAutoincrement: false;
3219
- hasRuntimeDefault: false;
3220
- enumValues: undefined;
3221
- baseColumn: never;
3222
- identity: undefined;
3223
- generated: undefined;
3224
- }, {}, {}>;
3225
- slug: drizzle_orm_pg_core.PgColumn<{
3226
- name: "slug";
3227
- tableName: "items";
3228
- dataType: "string";
3229
- columnType: "PgText";
3230
- data: string;
3231
- driverParam: string;
3232
- notNull: true;
3233
- hasDefault: false;
3234
- isPrimaryKey: false;
3235
- isAutoincrement: false;
3236
- hasRuntimeDefault: false;
3237
- enumValues: [string, ...string[]];
3238
- baseColumn: never;
3239
- identity: undefined;
3240
- generated: undefined;
3241
- }, {}, {}>;
3242
- gameId: drizzle_orm_pg_core.PgColumn<{
3243
- name: "game_id";
3244
- tableName: "items";
3245
- dataType: "string";
3246
- columnType: "PgUUID";
3247
- data: string;
3248
- driverParam: string;
3249
- notNull: false;
3250
- hasDefault: false;
3251
- isPrimaryKey: false;
3252
- isAutoincrement: false;
3253
- hasRuntimeDefault: false;
3254
- enumValues: undefined;
3255
- baseColumn: never;
3256
- identity: undefined;
3257
- generated: undefined;
3258
- }, {}, {}>;
3259
- displayName: drizzle_orm_pg_core.PgColumn<{
3260
- name: "display_name";
3261
- tableName: "items";
3262
- dataType: "string";
3263
- columnType: "PgText";
3264
- data: string;
3265
- driverParam: string;
3266
- notNull: true;
3267
- hasDefault: false;
3268
- isPrimaryKey: false;
3269
- isAutoincrement: false;
3270
- hasRuntimeDefault: false;
3271
- enumValues: [string, ...string[]];
3272
- baseColumn: never;
3273
- identity: undefined;
3274
- generated: undefined;
3275
- }, {}, {}>;
3276
- description: drizzle_orm_pg_core.PgColumn<{
3277
- name: "description";
3278
- tableName: "items";
3279
- dataType: "string";
3280
- columnType: "PgText";
3281
- data: string;
3282
- driverParam: string;
3283
- notNull: false;
3284
- hasDefault: false;
3285
- isPrimaryKey: false;
3286
- isAutoincrement: false;
3287
- hasRuntimeDefault: false;
3288
- enumValues: [string, ...string[]];
3289
- baseColumn: never;
3290
- identity: undefined;
3291
- generated: undefined;
3292
- }, {}, {}>;
3293
- type: drizzle_orm_pg_core.PgColumn<{
3294
- name: "type";
3295
- tableName: "items";
3296
- dataType: "string";
3297
- columnType: "PgEnumColumn";
3298
- data: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "accessory" | "other";
3299
- driverParam: string;
3300
- notNull: true;
3301
- hasDefault: true;
3302
- isPrimaryKey: false;
3303
- isAutoincrement: false;
3304
- hasRuntimeDefault: false;
3305
- enumValues: ["currency", "badge", "trophy", "collectible", "consumable", "unlock", "upgrade", "accessory", "other"];
3306
- baseColumn: never;
3307
- identity: undefined;
3308
- generated: undefined;
3309
- }, {}, {}>;
3310
- isPlaceable: drizzle_orm_pg_core.PgColumn<{
3311
- name: "is_placeable";
3312
- tableName: "items";
3313
- dataType: "boolean";
3314
- columnType: "PgBoolean";
3315
- data: boolean;
3316
- driverParam: boolean;
3317
- notNull: true;
3318
- hasDefault: true;
3319
- isPrimaryKey: false;
3320
- isAutoincrement: false;
3321
- hasRuntimeDefault: false;
3322
- enumValues: undefined;
3323
- baseColumn: never;
3324
- identity: undefined;
3325
- generated: undefined;
3326
- }, {}, {}>;
3327
- imageUrl: drizzle_orm_pg_core.PgColumn<{
3328
- name: "image_url";
3329
- tableName: "items";
3330
- dataType: "string";
3331
- columnType: "PgText";
3332
- data: string;
3333
- driverParam: string;
3334
- notNull: false;
3335
- hasDefault: false;
3336
- isPrimaryKey: false;
3337
- isAutoincrement: false;
3338
- hasRuntimeDefault: false;
3339
- enumValues: [string, ...string[]];
3340
- baseColumn: never;
3341
- identity: undefined;
3342
- generated: undefined;
3343
- }, {}, {}>;
3344
- metadata: drizzle_orm_pg_core.PgColumn<{
3345
- name: "metadata";
3346
- tableName: "items";
3347
- dataType: "json";
3348
- columnType: "PgJsonb";
3349
- data: unknown;
3350
- driverParam: unknown;
3351
- notNull: false;
3352
- hasDefault: true;
3353
- isPrimaryKey: false;
3354
- isAutoincrement: false;
3355
- hasRuntimeDefault: false;
3356
- enumValues: undefined;
3357
- baseColumn: never;
3358
- identity: undefined;
3359
- generated: undefined;
3360
- }, {}, {}>;
3361
- createdAt: drizzle_orm_pg_core.PgColumn<{
3362
- name: "created_at";
3363
- tableName: "items";
3364
- dataType: "date";
3365
- columnType: "PgTimestamp";
3366
- data: Date;
3367
- driverParam: string;
3368
- notNull: true;
3369
- hasDefault: true;
3370
- isPrimaryKey: false;
3371
- isAutoincrement: false;
3372
- hasRuntimeDefault: false;
3373
- enumValues: undefined;
3374
- baseColumn: never;
3375
- identity: undefined;
3376
- generated: undefined;
3377
- }, {}, {}>;
3378
- }, {
3379
- imageUrl: z.ZodNullable<z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>>;
3380
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3381
- }>;
3382
- declare const UpdateItemSchema: z.ZodObject<Omit<{
3383
- id: z.ZodOptional<z.ZodString>;
3384
- slug: z.ZodOptional<z.ZodString>;
3385
- gameId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3386
- displayName: z.ZodOptional<z.ZodString>;
3387
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3388
- type: z.ZodOptional<z.ZodEnum<["currency", "badge", "trophy", "collectible", "consumable", "unlock", "upgrade", "accessory", "other"]>>;
3389
- isPlaceable: z.ZodOptional<z.ZodBoolean>;
3390
- imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3391
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3392
- createdAt: z.ZodOptional<z.ZodDate>;
3393
- }, "id" | "createdAt">, "strip", z.ZodTypeAny, {
3394
- slug?: string | undefined;
3395
- description?: string | null | undefined;
3396
- displayName?: string | undefined;
3397
- metadata?: Record<string, unknown> | undefined;
3398
- gameId?: string | null | undefined;
3399
- type?: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "accessory" | "other" | undefined;
3400
- isPlaceable?: boolean | undefined;
3401
- imageUrl?: string | null | undefined;
3402
- }, {
3403
- slug?: string | undefined;
3404
- description?: string | null | undefined;
3405
- displayName?: string | undefined;
3406
- metadata?: Record<string, unknown> | undefined;
3407
- gameId?: string | null | undefined;
3408
- type?: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "accessory" | "other" | undefined;
3409
- isPlaceable?: boolean | undefined;
3410
- imageUrl?: string | null | undefined;
3411
- }>;
3412
- declare const InsertCurrencySchema: z.ZodObject<Omit<{
3413
- id: z.ZodOptional<z.ZodString>;
3414
- itemId: z.ZodString;
3415
- symbol: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3416
- isPrimary: z.ZodDefault<z.ZodBoolean>;
3417
- createdAt: z.ZodOptional<z.ZodDate>;
3418
- updatedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
3419
- }, "id" | "createdAt" | "updatedAt">, "strip", z.ZodTypeAny, {
3420
- itemId: string;
3421
- isPrimary: boolean;
3422
- symbol?: string | null | undefined;
3423
- }, {
3424
- itemId: string;
3425
- symbol?: string | null | undefined;
3426
- isPrimary?: boolean | undefined;
3427
- }>;
3428
- declare const UpdateCurrencySchema: z.ZodObject<{
3429
- symbol: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
3430
- itemId: z.ZodOptional<z.ZodString>;
3431
- isPrimary: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
3432
- }, "strip", z.ZodTypeAny, {
3433
- symbol?: string | null | undefined;
3434
- itemId?: string | undefined;
3435
- isPrimary?: boolean | undefined;
3436
- }, {
3437
- symbol?: string | null | undefined;
3438
- itemId?: string | undefined;
3439
- isPrimary?: boolean | undefined;
3440
- }>;
3441
- declare const InsertShopListingSchema: z.ZodObject<Omit<{
3442
- id: z.ZodOptional<z.ZodString>;
3443
- itemId: z.ZodString;
3444
- currencyId: z.ZodString;
3445
- price: z.ZodNumber;
3446
- sellBackPercentage: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
3447
- stock: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
3448
- isActive: z.ZodDefault<z.ZodBoolean>;
3449
- availableFrom: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
3450
- availableUntil: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
3451
- createdAt: z.ZodOptional<z.ZodDate>;
3452
- updatedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
3453
- }, "id" | "createdAt" | "updatedAt">, "strip", z.ZodTypeAny, {
3454
- isActive: boolean;
3455
- itemId: string;
3456
- currencyId: string;
3457
- price: number;
3458
- sellBackPercentage?: number | null | undefined;
3459
- stock?: number | null | undefined;
3460
- availableFrom?: Date | null | undefined;
3461
- availableUntil?: Date | null | undefined;
3462
- }, {
3463
- itemId: string;
3464
- currencyId: string;
3465
- price: number;
3466
- isActive?: boolean | undefined;
3467
- sellBackPercentage?: number | null | undefined;
3468
- stock?: number | null | undefined;
3469
- availableFrom?: Date | null | undefined;
3470
- availableUntil?: Date | null | undefined;
3471
- }>;
3472
- declare const UpdateShopListingSchema: z.ZodObject<{
3473
- isActive: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
3474
- itemId: z.ZodOptional<z.ZodString>;
3475
- currencyId: z.ZodOptional<z.ZodString>;
3476
- price: z.ZodOptional<z.ZodNumber>;
3477
- sellBackPercentage: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
3478
- stock: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
3479
- availableFrom: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodDate>>>;
3480
- availableUntil: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodDate>>>;
3481
- }, "strip", z.ZodTypeAny, {
3482
- isActive?: boolean | undefined;
3483
- itemId?: string | undefined;
3484
- currencyId?: string | undefined;
3485
- price?: number | undefined;
3486
- sellBackPercentage?: number | null | undefined;
3487
- stock?: number | null | undefined;
3488
- availableFrom?: Date | null | undefined;
3489
- availableUntil?: Date | null | undefined;
3490
- }, {
3491
- isActive?: boolean | undefined;
3492
- itemId?: string | undefined;
3493
- currencyId?: string | undefined;
3494
- price?: number | undefined;
3495
- sellBackPercentage?: number | null | undefined;
3496
- stock?: number | null | undefined;
3497
- availableFrom?: Date | null | undefined;
3498
- availableUntil?: Date | null | undefined;
3499
- }>;
3500
2377
 
3501
2378
  declare enum AchievementCompletionType {
3502
2379
  TIME_PLAYED_SESSION = "time_played_session",
@@ -3528,17 +2405,6 @@ interface AchievementCurrent {
3528
2405
  windowStart: string;
3529
2406
  windowEnd: string;
3530
2407
  }
3531
- /**
3532
- * Achievement claim history entry
3533
- * Used in GET /api/achievements/history
3534
- */
3535
- interface AchievementHistoryEntry {
3536
- achievementId: string;
3537
- title: string;
3538
- rewardCredits: number;
3539
- createdAt: string;
3540
- scopeKey: string;
3541
- }
3542
2408
  /**
3543
2409
  * Achievement progress submission response
3544
2410
  * Used in POST /api/achievements/progress
@@ -3551,30 +2417,6 @@ interface AchievementProgressResponse {
3551
2417
  createdAt: string;
3552
2418
  }
3553
2419
 
3554
- declare enum NotificationType {
3555
- ACHIEVEMENT = "achievement",
3556
- SYSTEM = "system",
3557
- PROMO = "promo"
3558
- }
3559
- declare enum NotificationStatus {
3560
- PENDING = "pending",
3561
- DELIVERED = "delivered",
3562
- SEEN = "seen",
3563
- CLICKED = "clicked",
3564
- DISMISSED = "dismissed",
3565
- EXPIRED = "expired"
3566
- }
3567
- type Notification = InferSelectModel<typeof notifications>;
3568
- interface NotificationStats {
3569
- total: number;
3570
- delivered: number;
3571
- seen: number;
3572
- clicked: number;
3573
- dismissed: number;
3574
- expired: number;
3575
- clickThroughRate: number;
3576
- }
3577
-
3578
2420
  type CharacterComponent = typeof characterComponents.$inferSelect;
3579
2421
  type PlayerCharacter = typeof playerCharacters.$inferSelect & {
3580
2422
  accessories?: PlayerCharacterAccessory[];
@@ -3595,18 +2437,9 @@ type ExternalGame = BaseGame & {
3595
2437
  type Game = HostedGame | ExternalGame;
3596
2438
  type GameSession = typeof gameSessions.$inferSelect;
3597
2439
  type GameStateData = Record<string, unknown>;
3598
- type GameCustomHostname = typeof gameCustomHostnames.$inferSelect;
3599
- type UpsertGameMetadataInput = z.infer<typeof UpsertGameMetadataSchema>;
3600
2440
  type Item = typeof items.$inferSelect;
3601
2441
  type InventoryItem = typeof inventoryItems.$inferSelect;
3602
2442
  type Currency = typeof currencies.$inferSelect;
3603
- type ShopListing = typeof shopListings.$inferSelect;
3604
- type InsertItemInput = z.infer<typeof InsertItemSchema>;
3605
- type UpdateItemInput = z.infer<typeof UpdateItemSchema>;
3606
- type InsertCurrencyInput = z.infer<typeof InsertCurrencySchema>;
3607
- type UpdateCurrencyInput = z.infer<typeof UpdateCurrencySchema>;
3608
- type InsertShopListingInput = z.infer<typeof InsertShopListingSchema>;
3609
- type UpdateShopListingInput = z.infer<typeof UpdateShopListingSchema>;
3610
2443
  interface PlaceableItemMetadata {
3611
2444
  tilesWide?: number;
3612
2445
  tilesHigh?: number;
@@ -3616,28 +2449,10 @@ interface PlaceableItemMetadata {
3616
2449
  type Map = typeof maps.$inferSelect;
3617
2450
  type MapElement = typeof mapElements.$inferSelect;
3618
2451
  type MapObject = typeof mapObjects.$inferSelect;
3619
- interface MapData {
3620
- id: string;
3621
- identifier: string;
3622
- displayName: string;
3623
- description?: string;
3624
- metadata?: Record<string, unknown>;
3625
- }
3626
- interface CreateMapObjectData {
3627
- itemId: string;
3628
- worldX: number;
3629
- worldY: number;
3630
- width?: number;
3631
- height?: number;
3632
- rotation?: number;
3633
- scale?: number;
3634
- metadata?: Record<string, unknown>;
3635
- }
3636
2452
 
3637
2453
  type User = typeof users.$inferSelect;
3638
2454
  type UserRoleEnumType = (typeof userRoleEnum.enumValues)[number];
3639
2455
  type DeveloperStatusResponse = z.infer<typeof DeveloperStatusResponseSchema>;
3640
- type DeveloperStatusValue = DeveloperStatusResponse['status'];
3641
2456
  /**
3642
2457
  * User data with authentication provider information.
3643
2458
  * Returned by the /users/me endpoint with additional auth context.
@@ -3749,12 +2564,6 @@ type UserLevelWithConfig = UserLevel & {
3749
2564
  xpToNextLevel: number;
3750
2565
  nextLevelConfig?: LevelConfig;
3751
2566
  };
3752
- interface LeaderboardOptions {
3753
- timeframe?: 'all_time' | 'monthly' | 'weekly' | 'daily';
3754
- limit?: number;
3755
- offset?: number;
3756
- gameId?: string;
3757
- }
3758
2567
  interface LeaderboardEntry {
3759
2568
  rank: number;
3760
2569
  userId: string;
@@ -3778,15 +2587,6 @@ interface UserRankResponse {
3778
2587
  score: number;
3779
2588
  userId: string;
3780
2589
  }
3781
- interface UserScore$1 {
3782
- id: string;
3783
- score: number;
3784
- achievedAt: Date;
3785
- metadata?: Record<string, unknown>;
3786
- gameId: string;
3787
- gameTitle: string;
3788
- gameSlug: string;
3789
- }
3790
2590
 
3791
2591
  type SpriteTemplate = typeof spriteTemplates.$inferSelect;
3792
2592
  interface SpriteTemplateData {
@@ -3870,7 +2670,6 @@ interface SpriteTemplateData {
3870
2670
  };
3871
2671
  };
3872
2672
  }
3873
- type GameTimebackIntegration = typeof gameTimebackIntegrations.$inferSelect;
3874
2673
  type TodayXpResponse = {
3875
2674
  xp: number;
3876
2675
  date: string;
@@ -3884,435 +2683,98 @@ type XpHistoryResponse = {
3884
2683
  xp: number;
3885
2684
  }>;
3886
2685
  };
3887
- type TimebackSetupRequest = {
3888
- gameId: string;
3889
- config: {
3890
- organization: {
3891
- name: string;
3892
- type: string;
3893
- identifier: string;
3894
- };
3895
- course: {
3896
- title: string;
3897
- subjects: string[];
3898
- grades: number[];
3899
- courseCode: string;
3900
- level: string;
3901
- gradingScheme: string;
3902
- metadata?: Record<string, unknown>;
3903
- };
3904
- component: {
3905
- title: string;
3906
- sortOrder: number;
3907
- prerequisites: string[];
3908
- prerequisiteCriteria: string;
3909
- };
3910
- resource: {
3911
- title: string;
3912
- vendorResourceId: string;
3913
- vendorId: string;
3914
- applicationId: string;
3915
- roles: string[];
3916
- importance: string;
3917
- metadata: {
3918
- type?: string;
3919
- launchUrl?: string;
3920
- toolProvider?: string;
3921
- instructionalMethod?: string;
3922
- subject?: string;
3923
- grades?: number[];
3924
- language?: string;
3925
- xp?: number;
3926
- [key: string]: unknown;
3927
- };
3928
- };
3929
- componentResource: {
3930
- title: string;
3931
- sortOrder: number;
3932
- lessonType: string | null;
3933
- };
3934
- };
3935
- verbose?: boolean;
3936
- };
3937
- type TimebackSetupResponse = {
3938
- integration: GameTimebackIntegration;
3939
- courseId: string;
3940
- verbose?: {
3941
- course: unknown;
3942
- component: unknown;
3943
- resource: unknown;
3944
- componentResource: unknown;
3945
- };
3946
- };
3947
- type TimebackVerifyResponse = {
3948
- status: 'success' | 'error';
3949
- integration: GameTimebackIntegration;
3950
- resources: {
3951
- course: {
3952
- found: boolean;
3953
- data?: unknown;
3954
- };
3955
- component: {
3956
- found: boolean;
3957
- data?: unknown;
3958
- };
3959
- resource: {
3960
- found: boolean;
3961
- data?: unknown;
3962
- };
3963
- componentResource: {
3964
- found: boolean;
3965
- data?: unknown;
3966
- };
3967
- };
3968
- errors?: string[];
2686
+ /**
2687
+ * Minimal course configuration for TimeBack integration (used in user-facing config).
2688
+ *
2689
+ * NOTE: Per-course overrides (title, courseCode, level, metadata) are defined
2690
+ * in @playcademy/sdk/server as TimebackCourseConfigWithOverrides.
2691
+ * This base type only includes the minimal required fields.
2692
+ *
2693
+ * For totalXp, use metadata.metrics.totalXp (aligns with upstream TimeBack structure).
2694
+ */
2695
+ type TimebackCourseConfig = {
2696
+ subject: string;
2697
+ grade: number;
3969
2698
  };
3970
2699
  type EndActivityResponse = {
3971
2700
  status: 'ok';
3972
2701
  courseId: string;
3973
2702
  xpAwarded: number;
2703
+ masteredUnits?: number;
2704
+ pctCompleteApp?: number;
2705
+ scoreStatus?: string;
2706
+ inProgress?: string;
3974
2707
  };
3975
2708
 
3976
2709
  /**
3977
- * OAuth 2.0 implementation for the Playcademy SDK
2710
+ * Connection monitoring types
2711
+ *
2712
+ * Type definitions for connection state, configuration, and callbacks.
3978
2713
  */
3979
-
3980
2714
  /**
3981
- * Parses an OAuth state parameter to extract CSRF token and any encoded data.
2715
+ * Possible connection states.
3982
2716
  *
3983
- * @param state - The OAuth state parameter to parse
3984
- * @returns Object containing CSRF token and optional decoded data
2717
+ * - **online**: Connection is stable and healthy
2718
+ * - **offline**: Complete loss of network connectivity
2719
+ * - **degraded**: Connection is slow or experiencing intermittent issues
3985
2720
  */
3986
- declare function parseOAuthState(state: string): {
3987
- csrfToken: string;
3988
- data?: Record<string, string>;
3989
- };
2721
+ type ConnectionState = 'online' | 'offline' | 'degraded';
3990
2722
 
3991
2723
  /**
3992
- * Response type for the realtime token API
2724
+ * @fileoverview Playcademy Messaging System
2725
+ *
2726
+ * This file implements a unified messaging system for the Playcademy platform that handles
2727
+ * communication between different contexts:
2728
+ *
2729
+ * 1. **Iframe-to-Parent Communication**: When games run inside iframes (production/development),
2730
+ * they need to communicate with the parent window using postMessage API
2731
+ *
2732
+ * 2. **Local Communication**: When games run in the same context (local development),
2733
+ * they use CustomEvents for internal messaging
2734
+ *
2735
+ * The system automatically detects the runtime environment and chooses the appropriate
2736
+ * transport method, abstracting this complexity from the developer.
2737
+ *
2738
+ * **Architecture Overview**:
2739
+ * - Games run in iframes for security and isolation
2740
+ * - Parent window (Playcademy shell) manages game lifecycle
2741
+ * - Messages flow bidirectionally between parent and iframe
2742
+ * - Local development mode simulates this architecture without iframes
3993
2743
  */
3994
- interface RealtimeTokenResponse {
3995
- token: string;
3996
- }
3997
2744
 
3998
2745
  /**
3999
- * Cache configuration types for runtime customization
4000
- */
4001
- /**
4002
- * Runtime configuration for TTL cache behavior
4003
- */
4004
- interface TTLCacheConfig {
4005
- /** Time-to-live in milliseconds. Set to 0 to disable caching for this call. */
4006
- ttl?: number;
4007
- /** Force refresh, bypassing cache */
4008
- force?: boolean;
4009
- /** Skip cache and fetch fresh data (alias for force) */
4010
- skipCache?: boolean;
4011
- }
4012
- /**
4013
- * Runtime configuration for cooldown cache behavior
2746
+ * Enumeration of all message types used in the Playcademy messaging system.
2747
+ *
2748
+ * **Message Flow Patterns**:
2749
+ *
2750
+ * **Parent → Game (Overworld → Game)**:
2751
+ * - INIT: Provides game with authentication token and configuration
2752
+ * - TOKEN_REFRESH: Updates game's authentication token before expiry
2753
+ * - PAUSE/RESUME: Controls game execution state
2754
+ * - FORCE_EXIT: Immediately terminates the game
2755
+ * - OVERLAY: Shows/hides UI overlays over the game
2756
+ *
2757
+ * **Game → Parent (Game → Overworld)**:
2758
+ * - READY: Game has loaded and is ready to receive messages
2759
+ * - EXIT: Game requests to be closed (user clicked exit, game ended, etc.)
2760
+ * - TELEMETRY: Game reports performance metrics (FPS, memory usage, etc.)
4014
2761
  */
4015
- interface CooldownCacheConfig {
4016
- /** Cooldown period in milliseconds. Set to 0 to disable cooldown for this call. */
4017
- cooldown?: number;
4018
- /** Force refresh, bypassing cooldown */
4019
- force?: boolean;
4020
- }
4021
-
4022
- interface CharacterComponentsOptions {
2762
+ declare enum MessageEvents {
4023
2763
  /**
4024
- * Optional level filter for components
4025
- * When provided, only components available at this level or below are returned
2764
+ * Initializes the game with authentication context and configuration.
2765
+ * Sent immediately after game iframe loads.
2766
+ * Payload:
2767
+ * - `baseUrl`: string
2768
+ * - `token`: string
2769
+ * - `gameId`: string
4026
2770
  */
4027
- level?: number;
2771
+ INIT = "PLAYCADEMY_INIT",
4028
2772
  /**
4029
- * Whether to bypass the cache and force a fresh API request
4030
- * Default: false (use cache when available)
4031
- */
4032
- skipCache?: boolean;
4033
- }
4034
- interface CreateCharacterData {
4035
- bodyComponentId: string;
4036
- eyesComponentId: string;
4037
- hairstyleComponentId: string;
4038
- outfitComponentId: string;
4039
- }
4040
- interface UpdateCharacterData {
4041
- bodyComponentId?: string;
4042
- eyesComponentId?: string;
4043
- hairstyleComponentId?: string;
4044
- outfitComponentId?: string;
4045
- }
4046
-
4047
- interface ScoreSubmission {
4048
- id: string;
4049
- score: number;
4050
- achievedAt: Date;
4051
- }
4052
-
4053
- /**
4054
- * Combined response type for summary method
4055
- */
4056
- type XpSummaryResponse = {
4057
- today: TodayXpResponse;
4058
- total: TotalXpResponse;
4059
- };
4060
-
4061
- /**
4062
- * @fileoverview Server SDK Type Definitions
4063
- *
4064
- * TypeScript type definitions for the server-side Playcademy SDK.
4065
- * Includes configuration types, client state, and re-exported TimeBack types.
4066
- */
4067
-
4068
- /**
4069
- * TimeBack integration configuration for Playcademy config file
4070
- */
4071
- interface TimebackIntegrationConfig {
4072
- /** Organization overrides */
4073
- organization?: Partial<OrganizationConfig>;
4074
- /** Course configuration (subjects and grades REQUIRED) */
4075
- course: CourseConfig;
4076
- /** Component overrides */
4077
- component?: Partial<ComponentConfig>;
4078
- /** Resource overrides */
4079
- resource?: Partial<ResourceConfig>;
4080
- /** Component-Resource link overrides */
4081
- componentResource?: Partial<ComponentResourceConfig>;
4082
- }
4083
- /**
4084
- * Custom API routes integration
4085
- */
4086
- interface CustomRoutesIntegration {
4087
- /** Directory for custom API routes (defaults to 'server/api') */
4088
- directory?: string;
4089
- }
4090
- /**
4091
- * Database integration
4092
- */
4093
- interface DatabaseIntegration {
4094
- /** Database directory (defaults to 'db') */
4095
- directory?: string;
4096
- }
4097
- /**
4098
- * Integrations configuration
4099
- * All backend features (database, custom routes, external services) are configured here
4100
- */
4101
- interface IntegrationsConfig {
4102
- /** TimeBack integration (optional) */
4103
- timeback?: TimebackIntegrationConfig;
4104
- /** Custom API routes (optional) */
4105
- customRoutes?: CustomRoutesIntegration | boolean;
4106
- /** Database (optional) */
4107
- database?: DatabaseIntegration | boolean;
4108
- /** Key-Value storage (optional) */
4109
- kv?: boolean;
4110
- /** Bucket storage (optional) */
4111
- bucket?: boolean;
4112
- /** Authentication (optional) */
4113
- auth?: boolean;
4114
- }
4115
- /**
4116
- * Unified Playcademy configuration
4117
- * Used for playcademy.config.{js,json}
4118
- */
4119
- interface PlaycademyConfig {
4120
- /** Game name */
4121
- name: string;
4122
- /** Game description */
4123
- description?: string;
4124
- /** Game emoji icon */
4125
- emoji?: string;
4126
- /** Build command to run before deployment */
4127
- buildCommand?: string[];
4128
- /** Path to build output */
4129
- buildPath?: string;
4130
- /** Game type */
4131
- gameType?: 'hosted' | 'external';
4132
- /** External URL (for external games) */
4133
- externalUrl?: string;
4134
- /** Game platform */
4135
- platform?: 'web' | 'unity' | 'godot';
4136
- /** Integrations (database, custom routes, external services) */
4137
- integrations?: IntegrationsConfig;
4138
- }
4139
-
4140
- /**
4141
- * Configuration options for initializing a PlaycademyClient instance.
4142
- *
4143
- * @example
4144
- * ```typescript
4145
- * const config: PlaycademyServerClientConfig = {
4146
- * apiKey: process.env.PLAYCADEMY_API_KEY!,
4147
- * gameId: 'my-math-game',
4148
- * configPath: './playcademy.config.js'
4149
- * }
4150
- * ```
4151
- */
4152
- interface PlaycademyServerClientConfig {
4153
- /**
4154
- * Playcademy API key for server-to-server authentication.
4155
- * Obtain from the Playcademy developer dashboard.
4156
- */
4157
- apiKey: string;
4158
- /**
4159
- * Optional path to playcademy.config.js file.
4160
- * If not provided, searches current directory and up to 3 parent directories.
4161
- * Ignored if `config` is provided directly.
4162
- *
4163
- * @example './config/playcademy.config.js'
4164
- */
4165
- configPath?: string;
4166
- /**
4167
- * Optional config object (for edge environments without filesystem).
4168
- * If provided, skips filesystem-based config loading.
4169
- *
4170
- * @example { name: 'My Game', integrations: { timeback: {...} } }
4171
- */
4172
- config?: PlaycademyConfig;
4173
- /**
4174
- * Optional base URL for Playcademy API.
4175
- * Defaults to environment variables or 'https://hub.playcademy.net'.
4176
- *
4177
- * @example 'http://localhost:3000' for local development
4178
- */
4179
- baseUrl?: string;
4180
- /**
4181
- * Optional game ID.
4182
- * If not provided, will attempt to fetch from API using the API token.
4183
- *
4184
- * @example 'my-math-game'
4185
- */
4186
- gameId?: string;
4187
- }
4188
- /**
4189
- * Internal state maintained by the PlaycademyClient instance.
4190
- *
4191
- * @internal
4192
- */
4193
- interface PlaycademyServerClientState {
4194
- /** API key for authentication */
4195
- apiKey: string;
4196
- /** Base URL for API requests */
4197
- baseUrl: string;
4198
- /** Game identifier */
4199
- gameId: string;
4200
- /** Loaded game configuration from playcademy.config.js */
4201
- config: PlaycademyConfig;
4202
- /**
4203
- * TimeBack course ID fetched from the Playcademy API.
4204
- * Used for all TimeBack event recording.
4205
- */
4206
- courseId?: string;
4207
- }
4208
-
4209
- /**
4210
- * Resource bindings for backend deployment
4211
- * Provider-agnostic abstraction for cloud resources
4212
- */
4213
- interface BackendResourceBindings {
4214
- /** SQL database instances to create and bind (maps to D1 on Cloudflare) */
4215
- database?: string[];
4216
- /** Key-value store namespaces to create and bind (maps to KV on Cloudflare) */
4217
- keyValue?: string[];
4218
- /** Object storage buckets to bind (maps to R2 on Cloudflare) */
4219
- bucket?: string[];
4220
- }
4221
- /**
4222
- * Backend deployment bundle for uploading to Playcademy platform
4223
- */
4224
- interface BackendDeploymentBundle {
4225
- /** Bundled JavaScript code ready for deployment */
4226
- code: string;
4227
- /** Game configuration */
4228
- config: PlaycademyConfig;
4229
- /** Optional resource bindings (database, storage, etc.) */
4230
- bindings?: BackendResourceBindings;
4231
- /** Optional schema information for database setup */
4232
- schema?: SchemaInfo;
4233
- /** Optional game secrets */
4234
- secrets?: Record<string, string>;
4235
- }
4236
-
4237
- interface UserScore {
4238
- id: string;
4239
- score: number;
4240
- achievedAt: Date;
4241
- metadata?: Record<string, unknown>;
4242
- gameId: string;
4243
- gameTitle: string;
4244
- gameSlug: string;
4245
- }
4246
-
4247
- /**
4248
- * Connection monitoring types
4249
- *
4250
- * Type definitions for connection state, configuration, and callbacks.
4251
- */
4252
- /**
4253
- * Possible connection states.
4254
- *
4255
- * - **online**: Connection is stable and healthy
4256
- * - **offline**: Complete loss of network connectivity
4257
- * - **degraded**: Connection is slow or experiencing intermittent issues
4258
- */
4259
- type ConnectionState = 'online' | 'offline' | 'degraded';
4260
-
4261
- /**
4262
- * @fileoverview Playcademy Messaging System
4263
- *
4264
- * This file implements a unified messaging system for the Playcademy platform that handles
4265
- * communication between different contexts:
4266
- *
4267
- * 1. **Iframe-to-Parent Communication**: When games run inside iframes (production/development),
4268
- * they need to communicate with the parent window using postMessage API
4269
- *
4270
- * 2. **Local Communication**: When games run in the same context (local development),
4271
- * they use CustomEvents for internal messaging
4272
- *
4273
- * The system automatically detects the runtime environment and chooses the appropriate
4274
- * transport method, abstracting this complexity from the developer.
4275
- *
4276
- * **Architecture Overview**:
4277
- * - Games run in iframes for security and isolation
4278
- * - Parent window (Playcademy shell) manages game lifecycle
4279
- * - Messages flow bidirectionally between parent and iframe
4280
- * - Local development mode simulates this architecture without iframes
4281
- */
4282
-
4283
- /**
4284
- * Enumeration of all message types used in the Playcademy messaging system.
4285
- *
4286
- * **Message Flow Patterns**:
4287
- *
4288
- * **Parent → Game (Overworld → Game)**:
4289
- * - INIT: Provides game with authentication token and configuration
4290
- * - TOKEN_REFRESH: Updates game's authentication token before expiry
4291
- * - PAUSE/RESUME: Controls game execution state
4292
- * - FORCE_EXIT: Immediately terminates the game
4293
- * - OVERLAY: Shows/hides UI overlays over the game
4294
- *
4295
- * **Game → Parent (Game → Overworld)**:
4296
- * - READY: Game has loaded and is ready to receive messages
4297
- * - EXIT: Game requests to be closed (user clicked exit, game ended, etc.)
4298
- * - TELEMETRY: Game reports performance metrics (FPS, memory usage, etc.)
4299
- */
4300
- declare enum MessageEvents {
4301
- /**
4302
- * Initializes the game with authentication context and configuration.
4303
- * Sent immediately after game iframe loads.
4304
- * Payload:
4305
- * - `baseUrl`: string
4306
- * - `token`: string
4307
- * - `gameId`: string
4308
- */
4309
- INIT = "PLAYCADEMY_INIT",
4310
- /**
4311
- * Updates the game's authentication token before it expires.
4312
- * Sent periodically to maintain valid authentication.
4313
- * Payload:
4314
- * - `token`: string
4315
- * - `exp`: number
2773
+ * Updates the game's authentication token before it expires.
2774
+ * Sent periodically to maintain valid authentication.
2775
+ * Payload:
2776
+ * - `token`: string
2777
+ * - `exp`: number
4316
2778
  */
4317
2779
  TOKEN_REFRESH = "PLAYCADEMY_TOKEN_REFRESH",
4318
2780
  /**
@@ -4428,12 +2890,12 @@ declare enum MessageEvents {
4428
2890
  * const client = await PlaycademyClient.init({ baseUrl: 'https://custom.api.com' })
4429
2891
  * ```
4430
2892
  */
4431
- declare function init(options?: {
2893
+ declare function init<T extends PlaycademyClient = PlaycademyClient>(this: new (...args: ConstructorParameters<typeof PlaycademyClient>) => T, options?: {
4432
2894
  baseUrl?: string;
4433
2895
  allowedParentOrigins?: string[];
4434
2896
  onDisconnect?: DisconnectHandler;
4435
2897
  enableConnectionMonitoring?: boolean;
4436
- }): Promise<PlaycademyClient>;
2898
+ }): Promise<T>;
4437
2899
 
4438
2900
  /**
4439
2901
  * Authenticates a user with email and password.
@@ -4488,10 +2950,21 @@ declare class PlaycademyClient {
4488
2950
  private initPayload?;
4489
2951
  private connectionManager?;
4490
2952
  /**
4491
- * Creates a new PlaycademyClient instance.
2953
+ * Internal session manager for automatic session lifecycle.
4492
2954
  *
4493
- * @param config - Optional configuration object
4494
- * @param config.baseUrl - Base URL (e.g., 'https://hub.playcademy.net' or '/'). SDK automatically appends /api
2955
+ * This manager handles starting and ending game sessions automatically.
2956
+ * Game developers don't need to call these methods directly - they're managed
2957
+ * by the SDK during initialization and cleanup.
2958
+ *
2959
+ * @private
2960
+ * @internal
2961
+ */
2962
+ private _sessionManager;
2963
+ /**
2964
+ * Creates a new PlaycademyClient instance.
2965
+ *
2966
+ * @param config - Optional configuration object
2967
+ * @param config.baseUrl - Base URL (e.g., 'https://hub.playcademy.net' or '/'). SDK automatically appends /api
4495
2968
  * @param config.token - Authentication token
4496
2969
  * @param config.tokenType - Optional token type (auto-detected if not provided)
4497
2970
  * @param config.gameId - Game ID for automatic session management
@@ -4732,32 +3205,6 @@ declare class PlaycademyClient {
4732
3205
  * 3. autoStartSession is enabled (defaults to false)
4733
3206
  */
4734
3207
  private _initializeInternalSession;
4735
- /** Platform API authentication methods (login, logout) */
4736
- auth: {
4737
- login: (credentials: {
4738
- email: string;
4739
- password: string;
4740
- }) => Promise<{
4741
- success: boolean;
4742
- token?: string;
4743
- user?: {
4744
- id: string;
4745
- email: string;
4746
- };
4747
- expiresAt?: string;
4748
- error?: string;
4749
- }>;
4750
- logout: () => Promise<void>;
4751
- apiKeys: {
4752
- create: (options?: {
4753
- name?: string;
4754
- expiresIn?: number | null;
4755
- permissions?: Record<string, string[]>;
4756
- }) => Promise<BetterAuthApiKeyResponse>;
4757
- list: () => Promise<BetterAuthApiKey[]>;
4758
- revoke: (keyId: string) => Promise<void>;
4759
- };
4760
- };
4761
3208
  /** Identity provider connection methods (connect external accounts) */
4762
3209
  identity: {
4763
3210
  connect: (options: AuthOptions) => Promise<AuthResult>;
@@ -4800,26 +3247,6 @@ declare class PlaycademyClient {
4800
3247
  arrayBuffer: (path: string) => Promise<ArrayBuffer>;
4801
3248
  };
4802
3249
  };
4803
- /** Game management methods (fetch, list, saveState, loadState, sessions) */
4804
- games: {
4805
- fetch: (gameIdOrSlug: string, options?: TTLCacheConfig) => Promise<FetchedGame>;
4806
- list: (options?: TTLCacheConfig) => Promise<Array<Game>>;
4807
- saveState: (state: Record<string, unknown>) => Promise<void>;
4808
- loadState: () => Promise<GameStateData>;
4809
- startSession: (gameId?: string) => Promise<StartSessionResponse>;
4810
- endSession: (sessionId: string, gameId?: string) => Promise<void>;
4811
- token: {
4812
- create: (gameId: string, options?: {
4813
- apply?: boolean;
4814
- }) => Promise<GameTokenResponse>;
4815
- };
4816
- leaderboard: {
4817
- get: (gameId: string, options?: {
4818
- limit?: number;
4819
- offset?: number;
4820
- }) => Promise<LeaderboardEntry[]>;
4821
- };
4822
- };
4823
3250
  /** User methods (me, inventory management) */
4824
3251
  users: {
4825
3252
  me: () => Promise<AuthenticatedUser>;
@@ -4830,258 +3257,6 @@ declare class PlaycademyClient {
4830
3257
  quantity: (identifier: string) => Promise<number>;
4831
3258
  has: (identifier: string, minQuantity?: number) => Promise<boolean>;
4832
3259
  };
4833
- scores: {
4834
- get: (userIdOrOptions?: string | {
4835
- limit?: number;
4836
- gameId?: string;
4837
- }, options?: {
4838
- limit?: number;
4839
- gameId?: string;
4840
- }) => Promise<UserScore[]>;
4841
- };
4842
- };
4843
- /** Developer tools (auth, games, keys management) */
4844
- dev: {
4845
- status: {
4846
- apply: () => Promise<void>;
4847
- get: () => Promise<DeveloperStatusValue>;
4848
- };
4849
- games: {
4850
- deploy: (slug: string, options: {
4851
- metadata?: UpsertGameMetadataInput;
4852
- file?: File | Blob | null;
4853
- backend?: BackendDeploymentBundle;
4854
- hooks?: DevUploadHooks;
4855
- }) => Promise<Game>;
4856
- seed: (slug: string, code: string, environment?: "staging" | "production") => Promise<{
4857
- success: boolean;
4858
- deploymentId: string;
4859
- executedAt: string;
4860
- }>;
4861
- upsert: (slug: string, metadata: UpsertGameMetadataInput) => Promise<Game>;
4862
- delete: (gameId: string) => Promise<void>;
4863
- secrets: {
4864
- set: (slug: string, secrets: Record<string, string>) => Promise<string[]>;
4865
- list: (slug: string) => Promise<string[]>;
4866
- get: (slug: string) => Promise<Record<string, string>>;
4867
- delete: (slug: string, key: string) => Promise<void>;
4868
- };
4869
- database: {
4870
- reset: (slug: string, schema?: {
4871
- sql: string;
4872
- hash: string;
4873
- }) => Promise<{
4874
- success: boolean;
4875
- deploymentId: string;
4876
- resetAt: string;
4877
- schemaPushed: boolean;
4878
- }>;
4879
- };
4880
- bucket: {
4881
- list: (slug: string, prefix?: string) => Promise<BucketFile[]>;
4882
- get: (slug: string, key: string) => Promise<ArrayBuffer>;
4883
- put: (slug: string, key: string, content: Blob | ArrayBuffer | Uint8Array, contentType?: string) => Promise<void>;
4884
- delete: (slug: string, key: string) => Promise<void>;
4885
- };
4886
- domains: {
4887
- add: (slug: string, hostname: string) => Promise<GameCustomHostname>;
4888
- list: (slug: string) => Promise<GameCustomHostname[]>;
4889
- status: (slug: string, hostname: string, refresh?: boolean) => Promise<GameCustomHostname>;
4890
- delete: (slug: string, hostname: string) => Promise<void>;
4891
- };
4892
- };
4893
- items: {
4894
- create: (gameId: string, slug: string, itemData: Omit<InsertItemInput, "slug" | "gameId">) => Promise<Item>;
4895
- update: (gameId: string, itemId: string, updates: UpdateItemInput) => Promise<Item>;
4896
- list: (gameId: string) => Promise<Array<Item>>;
4897
- get: (gameId: string, slug: string) => Promise<Item>;
4898
- delete: (gameId: string, itemId: string) => Promise<void>;
4899
- shop: {
4900
- create: (gameId: string, itemId: string, listingData: Omit<InsertShopListingInput, "itemId">) => Promise<ShopListing>;
4901
- get: (gameId: string, itemId: string) => Promise<ShopListing | null>;
4902
- update: (gameId: string, itemId: string, updates: UpdateShopListingInput) => Promise<ShopListing>;
4903
- delete: (gameId: string, itemId: string) => Promise<void>;
4904
- list: (gameId: string) => Promise<Array<ShopListing & {
4905
- item: Item;
4906
- }>>;
4907
- };
4908
- };
4909
- };
4910
- /** Map methods (elements) */
4911
- maps: {
4912
- get: (identifier: string, options?: TTLCacheConfig) => Promise<MapData>;
4913
- elements: (mapId: string, options?: TTLCacheConfig) => Promise<MapElementWithGame[]>;
4914
- objects: {
4915
- list: (mapId: string) => Promise<MapObjectWithItem[]>;
4916
- create: (mapId: string, objectData: CreateMapObjectData) => Promise<MapObjectWithItem>;
4917
- delete: (mapId: string, objectId: string) => Promise<void>;
4918
- };
4919
- };
4920
- /** Admin methods (games, items, currencies, shop listings) */
4921
- admin: {
4922
- games: {
4923
- pauseGame: (gameId: string) => Promise<void>;
4924
- resumeGame: (gameId: string) => Promise<void>;
4925
- };
4926
- items: {
4927
- create: (props: InsertItemInput) => Promise<{
4928
- id: string;
4929
- createdAt: Date;
4930
- gameId: string | null;
4931
- slug: string;
4932
- displayName: string;
4933
- metadata: unknown;
4934
- description: string | null;
4935
- type: "accessory" | "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
4936
- isPlaceable: boolean;
4937
- imageUrl: string | null;
4938
- }>;
4939
- get: (itemId: string) => Promise<{
4940
- id: string;
4941
- createdAt: Date;
4942
- gameId: string | null;
4943
- slug: string;
4944
- displayName: string;
4945
- metadata: unknown;
4946
- description: string | null;
4947
- type: "accessory" | "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
4948
- isPlaceable: boolean;
4949
- imageUrl: string | null;
4950
- }>;
4951
- list: () => Promise<{
4952
- id: string;
4953
- createdAt: Date;
4954
- gameId: string | null;
4955
- slug: string;
4956
- displayName: string;
4957
- metadata: unknown;
4958
- description: string | null;
4959
- type: "accessory" | "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
4960
- isPlaceable: boolean;
4961
- imageUrl: string | null;
4962
- }[]>;
4963
- update: (itemId: string, props: UpdateItemInput) => Promise<{
4964
- id: string;
4965
- createdAt: Date;
4966
- gameId: string | null;
4967
- slug: string;
4968
- displayName: string;
4969
- metadata: unknown;
4970
- description: string | null;
4971
- type: "accessory" | "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
4972
- isPlaceable: boolean;
4973
- imageUrl: string | null;
4974
- }>;
4975
- delete: (itemId: string) => Promise<void>;
4976
- };
4977
- currencies: {
4978
- create: (props: InsertCurrencyInput) => Promise<{
4979
- symbol: string | null;
4980
- id: string;
4981
- createdAt: Date;
4982
- updatedAt: Date | null;
4983
- itemId: string;
4984
- isPrimary: boolean;
4985
- }>;
4986
- get: (currencyId: string) => Promise<{
4987
- symbol: string | null;
4988
- id: string;
4989
- createdAt: Date;
4990
- updatedAt: Date | null;
4991
- itemId: string;
4992
- isPrimary: boolean;
4993
- }>;
4994
- list: () => Promise<{
4995
- symbol: string | null;
4996
- id: string;
4997
- createdAt: Date;
4998
- updatedAt: Date | null;
4999
- itemId: string;
5000
- isPrimary: boolean;
5001
- }[]>;
5002
- update: (currencyId: string, props: UpdateCurrencyInput) => Promise<{
5003
- symbol: string | null;
5004
- id: string;
5005
- createdAt: Date;
5006
- updatedAt: Date | null;
5007
- itemId: string;
5008
- isPrimary: boolean;
5009
- }>;
5010
- delete: (currencyId: string) => Promise<void>;
5011
- };
5012
- shopListings: {
5013
- create: (props: InsertShopListingInput) => Promise<{
5014
- id: string;
5015
- createdAt: Date;
5016
- updatedAt: Date | null;
5017
- itemId: string;
5018
- currencyId: string;
5019
- price: number;
5020
- sellBackPercentage: number | null;
5021
- stock: number | null;
5022
- isActive: boolean;
5023
- availableFrom: Date | null;
5024
- availableUntil: Date | null;
5025
- }>;
5026
- get: (listingId: string) => Promise<{
5027
- id: string;
5028
- createdAt: Date;
5029
- updatedAt: Date | null;
5030
- itemId: string;
5031
- currencyId: string;
5032
- price: number;
5033
- sellBackPercentage: number | null;
5034
- stock: number | null;
5035
- isActive: boolean;
5036
- availableFrom: Date | null;
5037
- availableUntil: Date | null;
5038
- }>;
5039
- list: () => Promise<{
5040
- id: string;
5041
- createdAt: Date;
5042
- updatedAt: Date | null;
5043
- itemId: string;
5044
- currencyId: string;
5045
- price: number;
5046
- sellBackPercentage: number | null;
5047
- stock: number | null;
5048
- isActive: boolean;
5049
- availableFrom: Date | null;
5050
- availableUntil: Date | null;
5051
- }[]>;
5052
- update: (listingId: string, props: UpdateShopListingInput) => Promise<{
5053
- id: string;
5054
- createdAt: Date;
5055
- updatedAt: Date | null;
5056
- itemId: string;
5057
- currencyId: string;
5058
- price: number;
5059
- sellBackPercentage: number | null;
5060
- stock: number | null;
5061
- isActive: boolean;
5062
- availableFrom: Date | null;
5063
- availableUntil: Date | null;
5064
- }>;
5065
- delete: (listingId: string) => Promise<void>;
5066
- };
5067
- };
5068
- /** Shop methods (view) */
5069
- shop: {
5070
- view: () => Promise<ShopViewResponse>;
5071
- };
5072
- /** Level methods (levels) */
5073
- levels: {
5074
- get: () => Promise<UserLevel>;
5075
- progress: (options?: CooldownCacheConfig) => Promise<{
5076
- level: number;
5077
- currentXp: number;
5078
- xpToNextLevel: number;
5079
- totalXP: number;
5080
- }>;
5081
- config: {
5082
- list: () => Promise<LevelConfig[]>;
5083
- get: (level: number) => Promise<LevelConfig | null>;
5084
- };
5085
3260
  };
5086
3261
  /** TimeBack XP methods (today, total, history) */
5087
3262
  timeback: {
@@ -5089,32 +3264,6 @@ declare class PlaycademyClient {
5089
3264
  pauseActivity: () => void;
5090
3265
  resumeActivity: () => void;
5091
3266
  endActivity: (data: _playcademy_timeback_types.EndActivityScoreData) => Promise<EndActivityResponse>;
5092
- management: {
5093
- setup: (request: TimebackSetupRequest) => Promise<TimebackSetupResponse>;
5094
- verify: (gameId: string) => Promise<TimebackVerifyResponse>;
5095
- cleanup: (gameId: string) => Promise<void>;
5096
- get: (gameId: string) => Promise<GameTimebackIntegration | null>;
5097
- getConfig: (gameId: string) => Promise<TimebackSetupRequest["config"]>;
5098
- };
5099
- xp: {
5100
- today: (options?: {
5101
- date?: string;
5102
- timezone?: string;
5103
- }) => Promise<TodayXpResponse>;
5104
- total: () => Promise<TotalXpResponse>;
5105
- history: (options?: {
5106
- startDate?: string;
5107
- endDate?: string;
5108
- }) => Promise<XpHistoryResponse>;
5109
- summary: (options?: {
5110
- date?: string;
5111
- timezone?: string;
5112
- }) => Promise<XpSummaryResponse>;
5113
- };
5114
- };
5115
- /** Telemetry methods (pushMetrics) */
5116
- telemetry: {
5117
- pushMetrics: (metrics: Record<string, number>) => Promise<void>;
5118
3267
  };
5119
3268
  /** Credits methods (credits management) */
5120
3269
  credits: {
@@ -5122,41 +3271,9 @@ declare class PlaycademyClient {
5122
3271
  add: (amount: number) => Promise<number>;
5123
3272
  spend: (amount: number) => Promise<number>;
5124
3273
  };
5125
- /** Platform-wide leaderboard methods (fetch, getUserRank) */
5126
- leaderboard: {
5127
- fetch: (options?: LeaderboardOptions) => Promise<GameLeaderboardEntry[]>;
5128
- getUserRank: (gameId: string, userId: string) => Promise<UserRankResponse>;
5129
- };
5130
3274
  /** Platform-wide scores methods (submit, getUserScores) */
5131
3275
  scores: {
5132
3276
  submit: (gameId: string, score: number, metadata?: Record<string, unknown>) => Promise<ScoreSubmission>;
5133
- getByUser: (gameId: string, userId: string, options?: {
5134
- limit?: number;
5135
- }) => Promise<UserScore$1[]>;
5136
- };
5137
- /** Character methods (get, create, update, components) */
5138
- character: {
5139
- get: (userId?: string) => Promise<PlayerCharacter | null>;
5140
- create: (characterData: CreateCharacterData) => Promise<PlayerCharacter>;
5141
- update: (updates: UpdateCharacterData) => Promise<PlayerCharacter>;
5142
- components: {
5143
- list: (options?: CharacterComponentsOptions & TTLCacheConfig) => Promise<CharacterComponentWithSpriteUrl[]>;
5144
- clearCache: (key?: string) => void;
5145
- getCacheKeys: () => string[];
5146
- };
5147
- accessories: {
5148
- equip: (slot: string, componentId: string) => Promise<PlayerCharacterAccessory>;
5149
- remove: (slot: string) => Promise<{
5150
- success: boolean;
5151
- }>;
5152
- list: () => Promise<PlayerCharacterAccessory[]>;
5153
- };
5154
- };
5155
- /** Sprites methods (templates) */
5156
- sprites: {
5157
- templates: {
5158
- get: (slug: string) => Promise<SpriteTemplateData>;
5159
- };
5160
3277
  };
5161
3278
  /** Realtime methods (token) */
5162
3279
  realtime: {
@@ -5165,36 +3282,6 @@ declare class PlaycademyClient {
5165
3282
  };
5166
3283
  open(channel?: string, url?: string): Promise<_playcademy_realtime_server_types.RealtimeChannel>;
5167
3284
  };
5168
- /** Achievements methods (list, history, progress) */
5169
- achievements: {
5170
- list: (options?: TTLCacheConfig) => Promise<AchievementCurrent[]>;
5171
- history: {
5172
- list: (queryOptions?: {
5173
- limit?: number;
5174
- }, cacheOptions?: TTLCacheConfig) => Promise<AchievementHistoryEntry[]>;
5175
- };
5176
- progress: {
5177
- submit: (achievementId: string) => Promise<AchievementProgressResponse>;
5178
- };
5179
- };
5180
- /** Notifications methods (list, update status, stats) */
5181
- notifications: {
5182
- list: (queryOptions?: {
5183
- status?: NotificationStatus;
5184
- type?: NotificationType;
5185
- limit?: number;
5186
- offset?: number;
5187
- }, cacheOptions?: TTLCacheConfig) => Promise<Notification[]>;
5188
- markAsSeen: (notificationId: string) => Promise<Notification>;
5189
- markAsClicked: (notificationId: string) => Promise<Notification>;
5190
- dismiss: (notificationId: string) => Promise<Notification>;
5191
- stats: {
5192
- get: (queryOptions?: {
5193
- from?: string;
5194
- to?: string;
5195
- }, cacheOptions?: TTLCacheConfig) => Promise<NotificationStats>;
5196
- };
5197
- };
5198
3285
  /** Backend methods for calling custom game API routes */
5199
3286
  backend: {
5200
3287
  get<T = unknown>(path: string, headers?: Record<string, string>): Promise<T>;
@@ -5216,6 +3303,9 @@ declare class PlaycademyClient {
5216
3303
  };
5217
3304
  }
5218
3305
 
3306
+ /**
3307
+ * Core client configuration and lifecycle types
3308
+ */
5219
3309
  type TokenType = 'session' | 'apiKey' | 'gameJwt';
5220
3310
  interface ClientConfig {
5221
3311
  baseUrl: string;
@@ -5260,46 +3350,6 @@ interface InitPayload {
5260
3350
  /** Realtime WebSocket URL */
5261
3351
  realtimeUrl?: string;
5262
3352
  }
5263
- type AuthProviderType = (typeof AUTH_PROVIDER_IDS)[keyof typeof AUTH_PROVIDER_IDS];
5264
- interface AuthOptions {
5265
- /** The identity provider to use for authentication */
5266
- provider: AuthProviderType;
5267
- /** The OAuth callback URL where your server handles the callback */
5268
- callbackUrl: string;
5269
- /** Authentication mode - auto detects best option based on context */
5270
- mode?: 'auto' | 'popup' | 'redirect';
5271
- /** Callback for authentication state changes */
5272
- onStateChange?: (state: AuthStateUpdate) => void;
5273
- /** Custom OAuth configuration (for users embedding the SDK outside of the Playcademy platform) */
5274
- oauth?: {
5275
- clientId: string;
5276
- authorizationEndpoint?: string;
5277
- tokenEndpoint?: string;
5278
- scope?: string;
5279
- };
5280
- /**
5281
- * Optional custom data to encode in OAuth state parameter.
5282
- * By default, the SDK automatically includes playcademy_user_id and game_id.
5283
- * Use this to add additional custom data if needed.
5284
- */
5285
- stateData?: Record<string, string>;
5286
- }
5287
- interface AuthStateUpdate {
5288
- /** Current status of the authentication flow */
5289
- status: 'opening_popup' | 'exchanging_token' | 'complete' | 'error';
5290
- /** Human-readable message about the current state */
5291
- message: string;
5292
- /** Error details if status is 'error' */
5293
- error?: Error;
5294
- }
5295
- interface AuthResult {
5296
- /** Whether authentication was successful */
5297
- success: boolean;
5298
- /** User information if authentication was successful */
5299
- user?: UserInfo;
5300
- /** Error if authentication failed */
5301
- error?: Error;
5302
- }
5303
3353
  /**
5304
3354
  * Simplified user data passed to games via InitPayload
5305
3355
  * This is a subset of AuthenticatedUser suitable for external game consumption
@@ -5318,6 +3368,52 @@ interface GameUser {
5318
3368
  /** Whether the user has a Timeback account */
5319
3369
  hasTimebackAccount: boolean;
5320
3370
  }
3371
+ type GameContextPayload = {
3372
+ token: string;
3373
+ baseUrl: string;
3374
+ realtimeUrl: string;
3375
+ gameId: string;
3376
+ forwardKeys?: string[];
3377
+ };
3378
+ type EventListeners = {
3379
+ [E in keyof ClientEvents]?: Array<(payload: ClientEvents[E]) => void>;
3380
+ };
3381
+ interface ClientEvents {
3382
+ authChange: {
3383
+ token: string | null;
3384
+ };
3385
+ inventoryChange: {
3386
+ itemId: string;
3387
+ delta: number;
3388
+ newTotal: number;
3389
+ };
3390
+ levelUp: {
3391
+ oldLevel: number;
3392
+ newLevel: number;
3393
+ creditsAwarded: number;
3394
+ };
3395
+ xpGained: {
3396
+ amount: number;
3397
+ totalXP: number;
3398
+ leveledUp: boolean;
3399
+ };
3400
+ connectionChange: {
3401
+ state: 'online' | 'offline' | 'degraded';
3402
+ reason: string;
3403
+ };
3404
+ }
3405
+
3406
+ /**
3407
+ * Event and message payload types for SDK messaging system
3408
+ */
3409
+
3410
+ interface DisplayAlertPayload {
3411
+ message: string;
3412
+ options?: {
3413
+ type?: 'info' | 'warning' | 'error';
3414
+ duration?: number;
3415
+ };
3416
+ }
5321
3417
  /**
5322
3418
  * Authentication state change event payload.
5323
3419
  * Used when authentication state changes in the application.
@@ -5392,24 +3488,6 @@ interface KeyEventPayload {
5392
3488
  /** Event type */
5393
3489
  type: 'keydown' | 'keyup';
5394
3490
  }
5395
- interface DisplayAlertPayload {
5396
- message: string;
5397
- options?: {
5398
- type?: 'info' | 'warning' | 'error';
5399
- duration?: number;
5400
- };
5401
- }
5402
- /**
5403
- * Display alert payload.
5404
- * Request from game to show platform-level alert.
5405
- */
5406
- interface DisplayAlertPayload {
5407
- message: string;
5408
- options?: {
5409
- type?: 'info' | 'warning' | 'error';
5410
- duration?: number;
5411
- };
5412
- }
5413
3491
  /**
5414
3492
  * Connection state payload.
5415
3493
  * Broadcast from platform to games when connection changes.
@@ -5418,40 +3496,10 @@ interface ConnectionStatePayload {
5418
3496
  state: 'online' | 'offline' | 'degraded';
5419
3497
  reason: string;
5420
3498
  }
5421
- interface ClientEvents {
5422
- authChange: {
5423
- token: string | null;
5424
- };
5425
- inventoryChange: {
5426
- itemId: string;
5427
- delta: number;
5428
- newTotal: number;
5429
- };
5430
- levelUp: {
5431
- oldLevel: number;
5432
- newLevel: number;
5433
- creditsAwarded: number;
5434
- };
5435
- xpGained: {
5436
- amount: number;
5437
- totalXP: number;
5438
- leveledUp: boolean;
5439
- };
5440
- connectionChange: {
5441
- state: 'online' | 'offline' | 'degraded';
5442
- reason: string;
5443
- };
5444
- }
5445
- type GameContextPayload = {
5446
- token: string;
5447
- baseUrl: string;
5448
- realtimeUrl: string;
5449
- gameId: string;
5450
- forwardKeys?: string[];
5451
- };
5452
- type EventListeners = {
5453
- [E in keyof ClientEvents]?: Array<(payload: ClientEvents[E]) => void>;
5454
- };
3499
+
3500
+ /**
3501
+ * SDK-specific API response types
3502
+ */
5455
3503
  type LoginResponse = {
5456
3504
  token: string;
5457
3505
  };
@@ -5465,29 +3513,83 @@ type StartSessionResponse = {
5465
3513
  type InventoryMutationResponse = {
5466
3514
  newTotal: number;
5467
3515
  };
5468
- type DevUploadEvent = {
5469
- type: 'init';
5470
- } | {
5471
- type: 's3Progress';
5472
- loaded: number;
5473
- total: number;
5474
- percent: number;
5475
- } | {
5476
- type: 'finalizeStart';
5477
- } | {
5478
- type: 'finalizeProgress';
5479
- percent: number;
5480
- currentFileLabel?: string;
5481
- } | {
5482
- type: 'finalizeStatus';
3516
+
3517
+ /**
3518
+ * Realtime namespace types
3519
+ */
3520
+ /**
3521
+ * Response type for the realtime token API
3522
+ */
3523
+ interface RealtimeTokenResponse {
3524
+ token: string;
3525
+ }
3526
+
3527
+ /**
3528
+ * Scores namespace types
3529
+ */
3530
+ interface ScoreSubmission {
3531
+ id: string;
3532
+ score: number;
3533
+ achievedAt: Date;
3534
+ }
3535
+
3536
+ /**
3537
+ * Users namespace types
3538
+ */
3539
+ interface UserScore {
3540
+ id: string;
3541
+ score: number;
3542
+ achievedAt: Date;
3543
+ metadata?: Record<string, unknown>;
3544
+ gameId: string;
3545
+ gameTitle: string;
3546
+ gameSlug: string;
3547
+ }
3548
+
3549
+ /**
3550
+ * Authentication namespace types
3551
+ */
3552
+
3553
+ type AuthProviderType = (typeof AUTH_PROVIDER_IDS)[keyof typeof AUTH_PROVIDER_IDS];
3554
+ interface AuthOptions {
3555
+ /** The identity provider to use for authentication */
3556
+ provider: AuthProviderType;
3557
+ /** The OAuth callback URL where your server handles the callback */
3558
+ callbackUrl: string;
3559
+ /** Authentication mode - auto detects best option based on context */
3560
+ mode?: 'auto' | 'popup' | 'redirect';
3561
+ /** Callback for authentication state changes */
3562
+ onStateChange?: (state: AuthStateUpdate) => void;
3563
+ /** Custom OAuth configuration (for users embedding the SDK outside of the Playcademy platform) */
3564
+ oauth?: {
3565
+ clientId: string;
3566
+ authorizationEndpoint?: string;
3567
+ tokenEndpoint?: string;
3568
+ scope?: string;
3569
+ };
3570
+ /**
3571
+ * Optional custom data to encode in OAuth state parameter.
3572
+ * By default, the SDK automatically includes playcademy_user_id and game_id.
3573
+ * Use this to add additional custom data if needed.
3574
+ */
3575
+ stateData?: Record<string, string>;
3576
+ }
3577
+ interface AuthStateUpdate {
3578
+ /** Current status of the authentication flow */
3579
+ status: 'opening_popup' | 'exchanging_token' | 'complete' | 'error';
3580
+ /** Human-readable message about the current state */
5483
3581
  message: string;
5484
- } | {
5485
- type: 'close';
5486
- };
5487
- type DevUploadHooks = {
5488
- onEvent?: (e: DevUploadEvent) => void;
5489
- onClose?: () => void;
5490
- };
3582
+ /** Error details if status is 'error' */
3583
+ error?: Error;
3584
+ }
3585
+ interface AuthResult {
3586
+ /** Whether authentication was successful */
3587
+ success: boolean;
3588
+ /** User information if authentication was successful */
3589
+ user?: UserInfo;
3590
+ /** Error if authentication failed */
3591
+ error?: Error;
3592
+ }
5491
3593
  /**
5492
3594
  * Better-auth sign-in response
5493
3595
  */
@@ -5525,6 +3627,38 @@ interface BetterAuthApiKey {
5525
3627
  lastRequest: string | null;
5526
3628
  requestCount: number;
5527
3629
  }
3630
+
3631
+ /**
3632
+ * Character namespace types
3633
+ */
3634
+ interface CharacterComponentsOptions {
3635
+ /**
3636
+ * Optional level filter for components
3637
+ * When provided, only components available at this level or below are returned
3638
+ */
3639
+ level?: number;
3640
+ /**
3641
+ * Whether to bypass the cache and force a fresh API request
3642
+ * Default: false (use cache when available)
3643
+ */
3644
+ skipCache?: boolean;
3645
+ }
3646
+ interface CreateCharacterData {
3647
+ bodyComponentId: string;
3648
+ eyesComponentId: string;
3649
+ hairstyleComponentId: string;
3650
+ outfitComponentId: string;
3651
+ }
3652
+ interface UpdateCharacterData {
3653
+ bodyComponentId?: string;
3654
+ eyesComponentId?: string;
3655
+ hairstyleComponentId?: string;
3656
+ outfitComponentId?: string;
3657
+ }
3658
+
3659
+ /**
3660
+ * Developer namespace types
3661
+ */
5528
3662
  /**
5529
3663
  * Bucket file metadata
5530
3664
  */
@@ -5534,6 +3668,242 @@ interface BucketFile {
5534
3668
  uploaded: string;
5535
3669
  contentType?: string;
5536
3670
  }
3671
+ type DevUploadEvent = {
3672
+ type: 'init';
3673
+ } | {
3674
+ type: 's3Progress';
3675
+ loaded: number;
3676
+ total: number;
3677
+ percent: number;
3678
+ } | {
3679
+ type: 'finalizeStart';
3680
+ } | {
3681
+ type: 'finalizeProgress';
3682
+ percent: number;
3683
+ currentFileLabel?: string;
3684
+ } | {
3685
+ type: 'finalizeStatus';
3686
+ message: string;
3687
+ } | {
3688
+ type: 'close';
3689
+ };
3690
+ type DevUploadHooks = {
3691
+ onEvent?: (e: DevUploadEvent) => void;
3692
+ onClose?: () => void;
3693
+ };
3694
+
3695
+ /**
3696
+ * Platform TimeBack Types
3697
+ *
3698
+ * Types for TimeBack enrollment and student data on the platform side.
3699
+ * These are used by the cademy hub to determine which games users have access to.
3700
+ */
3701
+
3702
+ /**
3703
+ * Enrollment data for a student in a specific game/course.
3704
+ * Represents the mapping between a TimeBack course and a Playcademy game.
3705
+ */
3706
+ interface StudentEnrollment {
3707
+ /** The Playcademy game ID the student is enrolled in */
3708
+ gameId: string;
3709
+ /** The grade level for this enrollment */
3710
+ grade: number;
3711
+ /** The subject area (e.g., 'Math', 'Science') */
3712
+ subject: string;
3713
+ /** The TimeBack course ID */
3714
+ courseId: string;
3715
+ }
3716
+ /**
3717
+ * Response from the enrollments endpoint
3718
+ */
3719
+ interface EnrollmentsResponse {
3720
+ enrollments: StudentEnrollment[];
3721
+ }
3722
+ /**
3723
+ * Combined response type for xp.summary() method
3724
+ */
3725
+ interface XpSummaryResponse {
3726
+ today: TodayXpResponse;
3727
+ total: TotalXpResponse;
3728
+ }
3729
+
3730
+ /**
3731
+ * @fileoverview Server SDK Type Definitions
3732
+ *
3733
+ * TypeScript type definitions for the server-side Playcademy SDK.
3734
+ * Includes configuration types, client state, and re-exported TimeBack types.
3735
+ */
3736
+
3737
+ /**
3738
+ * Base configuration for TimeBack integration (shared across all courses).
3739
+ * References upstream TimeBack types from @playcademy/timeback.
3740
+ *
3741
+ * All fields are optional and support template variables: {grade}, {subject}, {gameSlug}
3742
+ */
3743
+ interface TimebackBaseConfig {
3744
+ /** Organization configuration (shared across all courses) */
3745
+ organization?: Partial<OrganizationConfig>;
3746
+ /** Course defaults (can be overridden per-course) */
3747
+ course?: Partial<CourseConfig>;
3748
+ /** Component defaults */
3749
+ component?: Partial<ComponentConfig>;
3750
+ /** Resource defaults */
3751
+ resource?: Partial<ResourceConfig>;
3752
+ /** ComponentResource defaults */
3753
+ componentResource?: Partial<ComponentResourceConfig>;
3754
+ }
3755
+ /**
3756
+ * Extended course configuration that merges TimebackCourseConfig with per-course overrides.
3757
+ * Used in playcademy.config.* to allow per-course customization.
3758
+ */
3759
+ interface TimebackCourseConfigWithOverrides extends TimebackCourseConfig {
3760
+ title?: string;
3761
+ courseCode?: string;
3762
+ level?: string;
3763
+ metadata?: CourseConfig['metadata'];
3764
+ totalXp?: number | null;
3765
+ masterableUnits?: number | null;
3766
+ }
3767
+ /**
3768
+ * TimeBack integration configuration for Playcademy config file.
3769
+ *
3770
+ * Supports two levels of customization:
3771
+ * 1. `base`: Shared defaults for all courses (organization, course, component, resource, componentResource)
3772
+ * 2. Per-course overrides in the `courses` array (title, courseCode, level, gradingScheme, metadata)
3773
+ *
3774
+ * Template variables ({grade}, {subject}, {gameSlug}) can be used in string fields.
3775
+ */
3776
+ interface TimebackIntegrationConfig {
3777
+ /** Multi-grade course configuration (array of grade/subject/totalXp with optional per-course overrides) */
3778
+ courses: TimebackCourseConfigWithOverrides[];
3779
+ /** Optional base configuration (shared across all courses, can be overridden per-course) */
3780
+ base?: TimebackBaseConfig;
3781
+ }
3782
+ /**
3783
+ * Custom API routes integration
3784
+ */
3785
+ interface CustomRoutesIntegration {
3786
+ /** Directory for custom API routes (defaults to 'server/api') */
3787
+ directory?: string;
3788
+ }
3789
+ /**
3790
+ * Database integration
3791
+ */
3792
+ interface DatabaseIntegration {
3793
+ /** Database directory (defaults to 'db') */
3794
+ directory?: string;
3795
+ }
3796
+ /**
3797
+ * Integrations configuration
3798
+ * All backend features (database, custom routes, external services) are configured here
3799
+ */
3800
+ interface IntegrationsConfig {
3801
+ /** TimeBack integration (optional) */
3802
+ timeback?: TimebackIntegrationConfig | null;
3803
+ /** Custom API routes (optional) */
3804
+ customRoutes?: CustomRoutesIntegration | boolean;
3805
+ /** Database (optional) */
3806
+ database?: DatabaseIntegration | boolean;
3807
+ /** Key-Value storage (optional) */
3808
+ kv?: boolean;
3809
+ /** Bucket storage (optional) */
3810
+ bucket?: boolean;
3811
+ /** Authentication (optional) */
3812
+ auth?: boolean;
3813
+ }
3814
+ /**
3815
+ * Unified Playcademy configuration
3816
+ * Used for playcademy.config.{js,json}
3817
+ */
3818
+ interface PlaycademyConfig {
3819
+ /** Game name */
3820
+ name: string;
3821
+ /** Game description */
3822
+ description?: string;
3823
+ /** Game emoji icon */
3824
+ emoji?: string;
3825
+ /** Build command to run before deployment */
3826
+ buildCommand?: string[];
3827
+ /** Path to build output */
3828
+ buildPath?: string;
3829
+ /** Game type */
3830
+ gameType?: 'hosted' | 'external';
3831
+ /** External URL (for external games) */
3832
+ externalUrl?: string;
3833
+ /** Game platform */
3834
+ platform?: 'web' | 'unity' | 'godot';
3835
+ /** Integrations (database, custom routes, external services) */
3836
+ integrations?: IntegrationsConfig;
3837
+ }
3838
+
3839
+ /**
3840
+ * Configuration options for initializing a PlaycademyClient instance.
3841
+ *
3842
+ * @example
3843
+ * ```typescript
3844
+ * const config: PlaycademyServerClientConfig = {
3845
+ * apiKey: process.env.PLAYCADEMY_API_KEY!,
3846
+ * gameId: 'my-math-game',
3847
+ * configPath: './playcademy.config.js'
3848
+ * }
3849
+ * ```
3850
+ */
3851
+ interface PlaycademyServerClientConfig {
3852
+ /**
3853
+ * Playcademy API key for server-to-server authentication.
3854
+ * Obtain from the Playcademy developer dashboard.
3855
+ */
3856
+ apiKey: string;
3857
+ /**
3858
+ * Optional path to playcademy.config.js file.
3859
+ * If not provided, searches current directory and up to 3 parent directories.
3860
+ * Ignored if `config` is provided directly.
3861
+ *
3862
+ * @example './config/playcademy.config.js'
3863
+ */
3864
+ configPath?: string;
3865
+ /**
3866
+ * Optional config object (for edge environments without filesystem).
3867
+ * If provided, skips filesystem-based config loading.
3868
+ *
3869
+ * @example { name: 'My Game', integrations: { timeback: {...} } }
3870
+ */
3871
+ config?: PlaycademyConfig;
3872
+ /**
3873
+ * Optional base URL for Playcademy API.
3874
+ * Defaults to environment variables or 'https://hub.playcademy.net'.
3875
+ *
3876
+ * @example 'http://localhost:3000' for local development
3877
+ */
3878
+ baseUrl?: string;
3879
+ /**
3880
+ * Optional game ID.
3881
+ * If not provided, will attempt to fetch from API using the API token.
3882
+ *
3883
+ * @example 'my-math-game'
3884
+ */
3885
+ gameId?: string;
3886
+ }
3887
+ /**
3888
+ * Internal state maintained by the PlaycademyClient instance.
3889
+ *
3890
+ * @internal
3891
+ */
3892
+ interface PlaycademyServerClientState {
3893
+ /** API key for authentication */
3894
+ apiKey: string;
3895
+ /** Base URL for API requests */
3896
+ baseUrl: string;
3897
+ /** Game identifier */
3898
+ gameId: string;
3899
+ /** Loaded game configuration from playcademy.config.js */
3900
+ config: PlaycademyConfig;
3901
+ /**
3902
+ * TimeBack course ID fetched from the Playcademy API.
3903
+ * Used for all TimeBack event recording.
3904
+ */
3905
+ courseId?: string;
3906
+ }
5537
3907
 
5538
3908
  export { PlaycademyClient };
5539
- export type { Achievement, AchievementCurrent, AchievementProgressResponse, AuthCallbackPayload, AuthOptions, AuthProviderType, AuthResult, AuthServerMessage, AuthStateChangePayload, AuthStateUpdate, AuthenticatedUser, BetterAuthApiKey, BetterAuthApiKeyResponse, BetterAuthSignInResponse, BucketFile, CharacterComponent, CharacterComponentWithSpriteUrl, ClientConfig, ClientEvents, ConnectionStatePayload, Currency, DevUploadEvent, DevUploadHooks, DeveloperStatusResponse, DisconnectContext, DisconnectHandler, DisplayAlertPayload, EventListeners, ExternalGame, FetchedGame, Game, GameContextPayload, GameLeaderboardEntry, GameSession, GameStateData, GameTokenResponse, GameUser, HostedGame, InitPayload, InventoryItem, InventoryItemWithItem, InventoryMutationResponse, Item, KeyEventPayload, LeaderboardEntry, LevelConfig, LoginResponse, ManifestV1, Map, MapElement, MapElementWithGame, MapObject, MapObjectWithItem, PlaycademyServerClientConfig, PlaycademyServerClientState, PlayerCharacter, ShopCurrency, ShopDisplayItem, ShopViewResponse, SpriteTemplate, SpriteTemplateData, StartSessionResponse, TelemetryPayload, TodayXpResponse, TokenRefreshPayload, TokenType, TotalXpResponse, User, UserInfo, UserLevel, UserLevelWithConfig, UserRank, UserRankResponse, UserRoleEnumType, UserScore$1 as UserScore, XpHistoryResponse };
3909
+ export type { Achievement, AchievementCurrent, AchievementProgressResponse, AuthCallbackPayload, AuthOptions, AuthProviderType, AuthResult, AuthServerMessage, AuthStateChangePayload, AuthStateUpdate, AuthenticatedUser, BetterAuthApiKey, BetterAuthApiKeyResponse, BetterAuthSignInResponse, BucketFile, CharacterComponent, CharacterComponentWithSpriteUrl, CharacterComponentsOptions, ClientConfig, ClientEvents, ConnectionStatePayload, CreateCharacterData, Currency, DevUploadEvent, DevUploadHooks, DeveloperStatusResponse, DisconnectContext, DisconnectHandler, DisplayAlertPayload, EnrollmentsResponse, EventListeners, ExternalGame, FetchedGame, Game, GameContextPayload, GameLeaderboardEntry, GameSession, GameStateData, GameTokenResponse, GameUser, HostedGame, InitPayload, InventoryItem, InventoryItemWithItem, InventoryMutationResponse, Item, KeyEventPayload, LeaderboardEntry, LevelConfig, LoginResponse, ManifestV1, Map, MapElement, MapElementWithGame, MapObject, MapObjectWithItem, PlaycademyServerClientConfig, PlaycademyServerClientState, PlayerCharacter, RealtimeTokenResponse, ScoreSubmission, ShopCurrency, ShopDisplayItem, ShopViewResponse, SpriteTemplate, SpriteTemplateData, StartSessionResponse, StudentEnrollment, TelemetryPayload, TodayXpResponse, TokenRefreshPayload, TokenType, TotalXpResponse, UpdateCharacterData, User, UserInfo, UserLevel, UserLevelWithConfig, UserRank, UserRankResponse, UserRoleEnumType, UserScore, XpHistoryResponse, XpSummaryResponse };