@playcademy/sdk 0.0.7 → 0.0.9

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,7 +1,9 @@
1
+ import { InferSelectModel } from 'drizzle-orm';
1
2
  import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
2
3
  import * as drizzle_zod from 'drizzle-zod';
3
4
  import { z } from 'zod';
4
5
  import * as _playcademy_realtime_server_types from '@playcademy/realtime/server/types';
6
+ import { OrganizationConfig, CourseConfig, ComponentConfig, ResourceConfig, ComponentResourceConfig } from '@playcademy/timeback/types';
5
7
 
6
8
  declare const userRoleEnum: drizzle_orm_pg_core.PgEnum<["admin", "player", "developer"]>;
7
9
  declare const users: drizzle_orm_pg_core.PgTableWithColumns<{
@@ -216,101 +218,6 @@ declare const users: drizzle_orm_pg_core.PgTableWithColumns<{
216
218
  dialect: "pg";
217
219
  }>;
218
220
 
219
- declare const developerKeys: drizzle_orm_pg_core.PgTableWithColumns<{
220
- name: "developer_keys";
221
- schema: undefined;
222
- columns: {
223
- id: drizzle_orm_pg_core.PgColumn<{
224
- name: "id";
225
- tableName: "developer_keys";
226
- dataType: "string";
227
- columnType: "PgUUID";
228
- data: string;
229
- driverParam: string;
230
- notNull: true;
231
- hasDefault: true;
232
- isPrimaryKey: true;
233
- isAutoincrement: false;
234
- hasRuntimeDefault: false;
235
- enumValues: undefined;
236
- baseColumn: never;
237
- identity: undefined;
238
- generated: undefined;
239
- }, {}, {}>;
240
- userId: drizzle_orm_pg_core.PgColumn<{
241
- name: "user_id";
242
- tableName: "developer_keys";
243
- dataType: "string";
244
- columnType: "PgText";
245
- data: string;
246
- driverParam: string;
247
- notNull: true;
248
- hasDefault: false;
249
- isPrimaryKey: false;
250
- isAutoincrement: false;
251
- hasRuntimeDefault: false;
252
- enumValues: [string, ...string[]];
253
- baseColumn: never;
254
- identity: undefined;
255
- generated: undefined;
256
- }, {}, {}>;
257
- label: drizzle_orm_pg_core.PgColumn<{
258
- name: "label";
259
- tableName: "developer_keys";
260
- dataType: "string";
261
- columnType: "PgVarchar";
262
- data: string;
263
- driverParam: string;
264
- notNull: false;
265
- hasDefault: false;
266
- isPrimaryKey: false;
267
- isAutoincrement: false;
268
- hasRuntimeDefault: false;
269
- enumValues: [string, ...string[]];
270
- baseColumn: never;
271
- identity: undefined;
272
- generated: undefined;
273
- }, {}, {
274
- length: 255;
275
- }>;
276
- keyHash: drizzle_orm_pg_core.PgColumn<{
277
- name: "key_hash";
278
- tableName: "developer_keys";
279
- dataType: "string";
280
- columnType: "PgText";
281
- data: string;
282
- driverParam: string;
283
- notNull: true;
284
- hasDefault: false;
285
- isPrimaryKey: false;
286
- isAutoincrement: false;
287
- hasRuntimeDefault: false;
288
- enumValues: [string, ...string[]];
289
- baseColumn: never;
290
- identity: undefined;
291
- generated: undefined;
292
- }, {}, {}>;
293
- createdAt: drizzle_orm_pg_core.PgColumn<{
294
- name: "created_at";
295
- tableName: "developer_keys";
296
- dataType: "date";
297
- columnType: "PgTimestamp";
298
- data: Date;
299
- driverParam: string;
300
- notNull: true;
301
- hasDefault: true;
302
- isPrimaryKey: false;
303
- isAutoincrement: false;
304
- hasRuntimeDefault: false;
305
- enumValues: undefined;
306
- baseColumn: never;
307
- identity: undefined;
308
- generated: undefined;
309
- }, {}, {}>;
310
- };
311
- dialect: "pg";
312
- }>;
313
-
314
221
  type GameMetadata = {
315
222
  description?: string;
316
223
  emoji?: string;
@@ -2393,8 +2300,117 @@ declare const playerCharacterAccessories: drizzle_orm_pg_core.PgTableWithColumns
2393
2300
  };
2394
2301
  dialect: "pg";
2395
2302
  }>;
2303
+ declare const gameTimebackIntegrations: drizzle_orm_pg_core.PgTableWithColumns<{
2304
+ name: "game_timeback_integrations";
2305
+ schema: undefined;
2306
+ columns: {
2307
+ id: drizzle_orm_pg_core.PgColumn<{
2308
+ name: "id";
2309
+ tableName: "game_timeback_integrations";
2310
+ dataType: "string";
2311
+ columnType: "PgUUID";
2312
+ data: string;
2313
+ driverParam: string;
2314
+ notNull: true;
2315
+ hasDefault: true;
2316
+ isPrimaryKey: true;
2317
+ isAutoincrement: false;
2318
+ hasRuntimeDefault: false;
2319
+ enumValues: undefined;
2320
+ baseColumn: never;
2321
+ identity: undefined;
2322
+ generated: undefined;
2323
+ }, {}, {}>;
2324
+ gameId: drizzle_orm_pg_core.PgColumn<{
2325
+ name: "game_id";
2326
+ tableName: "game_timeback_integrations";
2327
+ dataType: "string";
2328
+ columnType: "PgUUID";
2329
+ data: string;
2330
+ driverParam: string;
2331
+ notNull: true;
2332
+ hasDefault: false;
2333
+ isPrimaryKey: false;
2334
+ isAutoincrement: false;
2335
+ hasRuntimeDefault: false;
2336
+ enumValues: undefined;
2337
+ baseColumn: never;
2338
+ identity: undefined;
2339
+ generated: undefined;
2340
+ }, {}, {}>;
2341
+ courseId: drizzle_orm_pg_core.PgColumn<{
2342
+ name: "course_id";
2343
+ tableName: "game_timeback_integrations";
2344
+ dataType: "string";
2345
+ columnType: "PgText";
2346
+ data: string;
2347
+ driverParam: string;
2348
+ notNull: true;
2349
+ hasDefault: false;
2350
+ isPrimaryKey: false;
2351
+ isAutoincrement: false;
2352
+ hasRuntimeDefault: false;
2353
+ enumValues: [string, ...string[]];
2354
+ baseColumn: never;
2355
+ identity: undefined;
2356
+ generated: undefined;
2357
+ }, {}, {}>;
2358
+ lastVerifiedAt: drizzle_orm_pg_core.PgColumn<{
2359
+ name: "last_verified_at";
2360
+ tableName: "game_timeback_integrations";
2361
+ dataType: "date";
2362
+ columnType: "PgTimestamp";
2363
+ data: Date;
2364
+ driverParam: string;
2365
+ notNull: false;
2366
+ hasDefault: false;
2367
+ isPrimaryKey: false;
2368
+ isAutoincrement: false;
2369
+ hasRuntimeDefault: false;
2370
+ enumValues: undefined;
2371
+ baseColumn: never;
2372
+ identity: undefined;
2373
+ generated: undefined;
2374
+ }, {}, {}>;
2375
+ createdAt: drizzle_orm_pg_core.PgColumn<{
2376
+ name: "created_at";
2377
+ tableName: "game_timeback_integrations";
2378
+ dataType: "date";
2379
+ columnType: "PgTimestamp";
2380
+ data: Date;
2381
+ driverParam: string;
2382
+ notNull: true;
2383
+ hasDefault: true;
2384
+ isPrimaryKey: false;
2385
+ isAutoincrement: false;
2386
+ hasRuntimeDefault: false;
2387
+ enumValues: undefined;
2388
+ baseColumn: never;
2389
+ identity: undefined;
2390
+ generated: undefined;
2391
+ }, {}, {}>;
2392
+ updatedAt: drizzle_orm_pg_core.PgColumn<{
2393
+ name: "updated_at";
2394
+ tableName: "game_timeback_integrations";
2395
+ dataType: "date";
2396
+ columnType: "PgTimestamp";
2397
+ data: Date;
2398
+ driverParam: string;
2399
+ notNull: true;
2400
+ hasDefault: true;
2401
+ isPrimaryKey: false;
2402
+ isAutoincrement: false;
2403
+ hasRuntimeDefault: false;
2404
+ enumValues: undefined;
2405
+ baseColumn: never;
2406
+ identity: undefined;
2407
+ generated: undefined;
2408
+ }, {}, {}>;
2409
+ };
2410
+ dialect: "pg";
2411
+ }>;
2396
2412
 
2397
- declare const achievementIntervalEnum: drizzle_orm_pg_core.PgEnum<["daily", "weekly"]>;
2413
+ declare const achievementScopeEnum: drizzle_orm_pg_core.PgEnum<["daily", "weekly", "monthly", "yearly", "game", "global", "map", "level", "event"]>;
2398
2414
  declare const achievements: drizzle_orm_pg_core.PgTableWithColumns<{
2399
2415
  name: "achievements";
2400
2416
  schema: undefined;
@@ -2454,19 +2470,19 @@ declare const achievements: drizzle_orm_pg_core.PgTableWithColumns<{
2454
2470
  identity: undefined;
2455
2471
  generated: undefined;
2456
2472
  }, {}, {}>;
2457
- intervalType: drizzle_orm_pg_core.PgColumn<{
2458
- name: "interval_type";
2473
+ scope: drizzle_orm_pg_core.PgColumn<{
2474
+ name: "scope";
2459
2475
  tableName: "achievements";
2460
2476
  dataType: "string";
2461
2477
  columnType: "PgEnumColumn";
2462
- data: "daily" | "weekly";
2478
+ data: "map" | "game" | "level" | "daily" | "weekly" | "monthly" | "yearly" | "global" | "event";
2463
2479
  driverParam: string;
2464
2480
  notNull: true;
2465
2481
  hasDefault: false;
2466
2482
  isPrimaryKey: false;
2467
2483
  isAutoincrement: false;
2468
2484
  hasRuntimeDefault: false;
2469
- enumValues: ["daily", "weekly"];
2485
+ enumValues: ["daily", "weekly", "monthly", "yearly", "game", "global", "map", "level", "event"];
2470
2486
  baseColumn: never;
2471
2487
  identity: undefined;
2472
2488
  generated: undefined;
@@ -2488,8 +2504,8 @@ declare const achievements: drizzle_orm_pg_core.PgTableWithColumns<{
2488
2504
  identity: undefined;
2489
2505
  generated: undefined;
2490
2506
  }, {}, {}>;
2491
- limitPerInterval: drizzle_orm_pg_core.PgColumn<{
2492
- name: "limit_per_interval";
2507
+ limit: drizzle_orm_pg_core.PgColumn<{
2508
+ name: "limit";
2493
2509
  tableName: "achievements";
2494
2510
  dataType: "number";
2495
2511
  columnType: "PgInteger";
@@ -2541,8 +2557,8 @@ declare const achievements: drizzle_orm_pg_core.PgTableWithColumns<{
2541
2557
  identity: undefined;
2542
2558
  generated: undefined;
2543
2559
  }, {}, {}>;
2544
- scope: drizzle_orm_pg_core.PgColumn<{
2545
- name: "scope";
2560
+ target: drizzle_orm_pg_core.PgColumn<{
2561
+ name: "target";
2546
2562
  tableName: "achievements";
2547
2563
  dataType: "json";
2548
2564
  columnType: "PgJsonb";
@@ -2612,77 +2628,362 @@ declare const achievements: drizzle_orm_pg_core.PgTableWithColumns<{
2612
2628
  };
2613
2629
  dialect: "pg";
2614
2630
  }>;
2615
- declare const DeveloperStatusResponseSchema: z.ZodObject<{
2616
- status: z.ZodEnum<["none", "pending", "approved"]>;
2617
- }, "strip", z.ZodTypeAny, {
2618
- status: "none" | "pending" | "approved";
2619
- }, {
2620
- status: "none" | "pending" | "approved";
2621
- }>;
2622
- declare const UpsertGameMetadataSchema: z.ZodEffects<z.ZodObject<{
2623
- displayName: z.ZodString;
2624
- mapElementId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
2625
- platform: z.ZodEnum<["web", "godot", "unity"]>;
2626
- metadata: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
2627
- gameType: z.ZodDefault<z.ZodOptional<z.ZodEnum<["hosted", "external"]>>>;
2628
- externalUrl: z.ZodOptional<z.ZodString>;
2629
- }, "strip", z.ZodTypeAny, {
2630
- displayName: string;
2631
- gameType: "hosted" | "external";
2632
- platform: "web" | "godot" | "unity";
2633
- metadata: Record<string, unknown>;
2634
- externalUrl?: string | undefined;
2635
- mapElementId?: string | null | undefined;
2636
- }, {
2637
- displayName: string;
2638
- platform: "web" | "godot" | "unity";
2639
- gameType?: "hosted" | "external" | undefined;
2640
- externalUrl?: string | undefined;
2641
- mapElementId?: string | null | undefined;
2642
- metadata?: Record<string, unknown> | undefined;
2643
- }>, {
2644
- displayName: string;
2645
- gameType: "hosted" | "external";
2646
- platform: "web" | "godot" | "unity";
2647
- metadata: Record<string, unknown>;
2648
- externalUrl?: string | undefined;
2649
- mapElementId?: string | null | undefined;
2650
- }, {
2651
- displayName: string;
2652
- platform: "web" | "godot" | "unity";
2653
- gameType?: "hosted" | "external" | undefined;
2654
- externalUrl?: string | undefined;
2655
- mapElementId?: string | null | undefined;
2656
- metadata?: Record<string, unknown> | undefined;
2657
- }>;
2658
- declare const ManifestV1Schema: z.ZodObject<{
2659
- version: z.ZodString;
2660
- bootMode: z.ZodEnum<["iframe", "module"]>;
2661
- entryPoint: z.ZodEffects<z.ZodString, string, string>;
2662
- /**
2663
- * An array of relative paths to CSS stylesheets.
2664
- * Currently, this property is ONLY utilized by the 'module' boot mode
2665
- * (`apps/cademy/src/lib/loader/boot-module.ts`) to load external
2666
- * stylesheets into the game's shadow DOM.
2667
- *
2668
- * This property is under review for potential deprecation and removal.
2669
- * The 'module' boot mode itself has not yet seen significant adoption
2670
- * or clear use-cases, and if support for module loading is removed in
2671
- * the future, this 'styles' property would become obsolete.
2672
- *
2673
- * If module-based games need styling, alternative approaches might involve
2674
- * bundling CSS within their JavaScript or managing style injection internally.
2675
- */
2676
- styles: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodString, "many">>, string[] | undefined, string[] | undefined>;
2677
- /**
2678
- * Specifies the game or development platform.
2679
- * Current values include 'web', 'godot', and 'unity'.
2680
- * The default in the database is 'web'.
2681
- *
2682
- * IMPORTANT: This property is NOT CURRENTLY USED by the core loader
2683
- * or runtime systems in any functional way. It is present in the manifest
2684
- * but does not drive any specific behavior in `boot-iframe.ts` or
2685
- * `boot-module.ts` beyond being a piece of metadata.
2631
+ declare const notifications: drizzle_orm_pg_core.PgTableWithColumns<{
2632
+ name: "notifications";
2633
+ schema: undefined;
2634
+ columns: {
2635
+ id: drizzle_orm_pg_core.PgColumn<{
2636
+ name: "id";
2637
+ tableName: "notifications";
2638
+ dataType: "string";
2639
+ columnType: "PgUUID";
2640
+ data: string;
2641
+ driverParam: string;
2642
+ notNull: true;
2643
+ hasDefault: true;
2644
+ isPrimaryKey: true;
2645
+ isAutoincrement: false;
2646
+ hasRuntimeDefault: false;
2647
+ enumValues: undefined;
2648
+ baseColumn: never;
2649
+ identity: undefined;
2650
+ generated: undefined;
2651
+ }, {}, {}>;
2652
+ userId: drizzle_orm_pg_core.PgColumn<{
2653
+ name: "user_id";
2654
+ tableName: "notifications";
2655
+ dataType: "string";
2656
+ columnType: "PgText";
2657
+ data: string;
2658
+ driverParam: string;
2659
+ notNull: true;
2660
+ hasDefault: false;
2661
+ isPrimaryKey: false;
2662
+ isAutoincrement: false;
2663
+ hasRuntimeDefault: false;
2664
+ enumValues: [string, ...string[]];
2665
+ baseColumn: never;
2666
+ identity: undefined;
2667
+ generated: undefined;
2668
+ }, {}, {}>;
2669
+ type: drizzle_orm_pg_core.PgColumn<{
2670
+ name: "type";
2671
+ tableName: "notifications";
2672
+ dataType: "string";
2673
+ columnType: "PgVarchar";
2674
+ data: string;
2675
+ driverParam: string;
2676
+ notNull: true;
2677
+ hasDefault: false;
2678
+ isPrimaryKey: false;
2679
+ isAutoincrement: false;
2680
+ hasRuntimeDefault: false;
2681
+ enumValues: [string, ...string[]];
2682
+ baseColumn: never;
2683
+ identity: undefined;
2684
+ generated: undefined;
2685
+ }, {}, {
2686
+ length: 50;
2687
+ }>;
2688
+ title: drizzle_orm_pg_core.PgColumn<{
2689
+ name: "title";
2690
+ tableName: "notifications";
2691
+ dataType: "string";
2692
+ columnType: "PgVarchar";
2693
+ data: string;
2694
+ driverParam: string;
2695
+ notNull: true;
2696
+ hasDefault: false;
2697
+ isPrimaryKey: false;
2698
+ isAutoincrement: false;
2699
+ hasRuntimeDefault: false;
2700
+ enumValues: [string, ...string[]];
2701
+ baseColumn: never;
2702
+ identity: undefined;
2703
+ generated: undefined;
2704
+ }, {}, {
2705
+ length: 255;
2706
+ }>;
2707
+ message: drizzle_orm_pg_core.PgColumn<{
2708
+ name: "message";
2709
+ tableName: "notifications";
2710
+ dataType: "string";
2711
+ columnType: "PgText";
2712
+ data: string;
2713
+ driverParam: string;
2714
+ notNull: true;
2715
+ hasDefault: false;
2716
+ isPrimaryKey: false;
2717
+ isAutoincrement: false;
2718
+ hasRuntimeDefault: false;
2719
+ enumValues: [string, ...string[]];
2720
+ baseColumn: never;
2721
+ identity: undefined;
2722
+ generated: undefined;
2723
+ }, {}, {}>;
2724
+ data: drizzle_orm_pg_core.PgColumn<{
2725
+ name: "data";
2726
+ tableName: "notifications";
2727
+ dataType: "json";
2728
+ columnType: "PgJsonb";
2729
+ data: unknown;
2730
+ driverParam: unknown;
2731
+ notNull: true;
2732
+ hasDefault: true;
2733
+ isPrimaryKey: false;
2734
+ isAutoincrement: false;
2735
+ hasRuntimeDefault: false;
2736
+ enumValues: undefined;
2737
+ baseColumn: never;
2738
+ identity: undefined;
2739
+ generated: undefined;
2740
+ }, {}, {}>;
2741
+ priority: drizzle_orm_pg_core.PgColumn<{
2742
+ name: "priority";
2743
+ tableName: "notifications";
2744
+ dataType: "string";
2745
+ columnType: "PgEnumColumn";
2746
+ data: "low" | "normal" | "high" | "urgent";
2747
+ driverParam: string;
2748
+ notNull: true;
2749
+ hasDefault: true;
2750
+ isPrimaryKey: false;
2751
+ isAutoincrement: false;
2752
+ hasRuntimeDefault: false;
2753
+ enumValues: ["low", "normal", "high", "urgent"];
2754
+ baseColumn: never;
2755
+ identity: undefined;
2756
+ generated: undefined;
2757
+ }, {}, {}>;
2758
+ status: drizzle_orm_pg_core.PgColumn<{
2759
+ name: "status";
2760
+ tableName: "notifications";
2761
+ dataType: "string";
2762
+ columnType: "PgEnumColumn";
2763
+ data: "pending" | "delivered" | "seen" | "clicked" | "dismissed" | "expired";
2764
+ driverParam: string;
2765
+ notNull: true;
2766
+ hasDefault: true;
2767
+ isPrimaryKey: false;
2768
+ isAutoincrement: false;
2769
+ hasRuntimeDefault: false;
2770
+ enumValues: ["pending", "delivered", "seen", "clicked", "dismissed", "expired"];
2771
+ baseColumn: never;
2772
+ identity: undefined;
2773
+ generated: undefined;
2774
+ }, {}, {}>;
2775
+ createdAt: drizzle_orm_pg_core.PgColumn<{
2776
+ name: "created_at";
2777
+ tableName: "notifications";
2778
+ dataType: "date";
2779
+ columnType: "PgTimestamp";
2780
+ data: Date;
2781
+ driverParam: string;
2782
+ notNull: true;
2783
+ hasDefault: true;
2784
+ isPrimaryKey: false;
2785
+ isAutoincrement: false;
2786
+ hasRuntimeDefault: false;
2787
+ enumValues: undefined;
2788
+ baseColumn: never;
2789
+ identity: undefined;
2790
+ generated: undefined;
2791
+ }, {}, {}>;
2792
+ deliveredAt: drizzle_orm_pg_core.PgColumn<{
2793
+ name: "delivered_at";
2794
+ tableName: "notifications";
2795
+ dataType: "date";
2796
+ columnType: "PgTimestamp";
2797
+ data: Date;
2798
+ driverParam: string;
2799
+ notNull: false;
2800
+ hasDefault: false;
2801
+ isPrimaryKey: false;
2802
+ isAutoincrement: false;
2803
+ hasRuntimeDefault: false;
2804
+ enumValues: undefined;
2805
+ baseColumn: never;
2806
+ identity: undefined;
2807
+ generated: undefined;
2808
+ }, {}, {}>;
2809
+ seenAt: drizzle_orm_pg_core.PgColumn<{
2810
+ name: "seen_at";
2811
+ tableName: "notifications";
2812
+ dataType: "date";
2813
+ columnType: "PgTimestamp";
2814
+ data: Date;
2815
+ driverParam: string;
2816
+ notNull: false;
2817
+ hasDefault: false;
2818
+ isPrimaryKey: false;
2819
+ isAutoincrement: false;
2820
+ hasRuntimeDefault: false;
2821
+ enumValues: undefined;
2822
+ baseColumn: never;
2823
+ identity: undefined;
2824
+ generated: undefined;
2825
+ }, {}, {}>;
2826
+ clickedAt: drizzle_orm_pg_core.PgColumn<{
2827
+ name: "clicked_at";
2828
+ tableName: "notifications";
2829
+ dataType: "date";
2830
+ columnType: "PgTimestamp";
2831
+ data: Date;
2832
+ driverParam: string;
2833
+ notNull: false;
2834
+ hasDefault: false;
2835
+ isPrimaryKey: false;
2836
+ isAutoincrement: false;
2837
+ hasRuntimeDefault: false;
2838
+ enumValues: undefined;
2839
+ baseColumn: never;
2840
+ identity: undefined;
2841
+ generated: undefined;
2842
+ }, {}, {}>;
2843
+ expiresAt: drizzle_orm_pg_core.PgColumn<{
2844
+ name: "expires_at";
2845
+ tableName: "notifications";
2846
+ dataType: "date";
2847
+ columnType: "PgTimestamp";
2848
+ data: Date;
2849
+ driverParam: string;
2850
+ notNull: false;
2851
+ hasDefault: false;
2852
+ isPrimaryKey: false;
2853
+ isAutoincrement: false;
2854
+ hasRuntimeDefault: false;
2855
+ enumValues: undefined;
2856
+ baseColumn: never;
2857
+ identity: undefined;
2858
+ generated: undefined;
2859
+ }, {}, {}>;
2860
+ method: drizzle_orm_pg_core.PgColumn<{
2861
+ name: "method";
2862
+ tableName: "notifications";
2863
+ dataType: "string";
2864
+ columnType: "PgVarchar";
2865
+ data: string;
2866
+ driverParam: string;
2867
+ notNull: false;
2868
+ hasDefault: false;
2869
+ isPrimaryKey: false;
2870
+ isAutoincrement: false;
2871
+ hasRuntimeDefault: false;
2872
+ enumValues: [string, ...string[]];
2873
+ baseColumn: never;
2874
+ identity: undefined;
2875
+ generated: undefined;
2876
+ }, {}, {
2877
+ length: 50;
2878
+ }>;
2879
+ clickUrl: drizzle_orm_pg_core.PgColumn<{
2880
+ name: "click_url";
2881
+ tableName: "notifications";
2882
+ dataType: "string";
2883
+ columnType: "PgText";
2884
+ data: string;
2885
+ driverParam: string;
2886
+ notNull: false;
2887
+ hasDefault: false;
2888
+ isPrimaryKey: false;
2889
+ isAutoincrement: false;
2890
+ hasRuntimeDefault: false;
2891
+ enumValues: [string, ...string[]];
2892
+ baseColumn: never;
2893
+ identity: undefined;
2894
+ generated: undefined;
2895
+ }, {}, {}>;
2896
+ metadata: drizzle_orm_pg_core.PgColumn<{
2897
+ name: "metadata";
2898
+ tableName: "notifications";
2899
+ dataType: "json";
2900
+ columnType: "PgJsonb";
2901
+ data: unknown;
2902
+ driverParam: unknown;
2903
+ notNull: true;
2904
+ hasDefault: true;
2905
+ isPrimaryKey: false;
2906
+ isAutoincrement: false;
2907
+ hasRuntimeDefault: false;
2908
+ enumValues: undefined;
2909
+ baseColumn: never;
2910
+ identity: undefined;
2911
+ generated: undefined;
2912
+ }, {}, {}>;
2913
+ };
2914
+ dialect: "pg";
2915
+ }>;
2916
+ declare const DeveloperStatusResponseSchema: z.ZodObject<{
2917
+ status: z.ZodEnum<["none", "pending", "approved"]>;
2918
+ }, "strip", z.ZodTypeAny, {
2919
+ status: "none" | "pending" | "approved";
2920
+ }, {
2921
+ status: "none" | "pending" | "approved";
2922
+ }>;
2923
+ declare const UpsertGameMetadataSchema: z.ZodEffects<z.ZodObject<{
2924
+ displayName: z.ZodString;
2925
+ mapElementId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
2926
+ platform: z.ZodEnum<["web", "godot", "unity"]>;
2927
+ metadata: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
2928
+ gameType: z.ZodDefault<z.ZodOptional<z.ZodEnum<["hosted", "external"]>>>;
2929
+ externalUrl: z.ZodOptional<z.ZodString>;
2930
+ }, "strip", z.ZodTypeAny, {
2931
+ displayName: string;
2932
+ gameType: "hosted" | "external";
2933
+ platform: "web" | "godot" | "unity";
2934
+ metadata: Record<string, unknown>;
2935
+ externalUrl?: string | undefined;
2936
+ mapElementId?: string | null | undefined;
2937
+ }, {
2938
+ displayName: string;
2939
+ platform: "web" | "godot" | "unity";
2940
+ gameType?: "hosted" | "external" | undefined;
2941
+ externalUrl?: string | undefined;
2942
+ mapElementId?: string | null | undefined;
2943
+ metadata?: Record<string, unknown> | undefined;
2944
+ }>, {
2945
+ displayName: string;
2946
+ gameType: "hosted" | "external";
2947
+ platform: "web" | "godot" | "unity";
2948
+ metadata: Record<string, unknown>;
2949
+ externalUrl?: string | undefined;
2950
+ mapElementId?: string | null | undefined;
2951
+ }, {
2952
+ displayName: string;
2953
+ platform: "web" | "godot" | "unity";
2954
+ gameType?: "hosted" | "external" | undefined;
2955
+ externalUrl?: string | undefined;
2956
+ mapElementId?: string | null | undefined;
2957
+ metadata?: Record<string, unknown> | undefined;
2958
+ }>;
2959
+ declare const ManifestV1Schema: z.ZodObject<{
2960
+ version: z.ZodString;
2961
+ bootMode: z.ZodEnum<["iframe", "module"]>;
2962
+ entryPoint: z.ZodEffects<z.ZodString, string, string>;
2963
+ /**
2964
+ * An array of relative paths to CSS stylesheets.
2965
+ * Currently, this property is ONLY utilized by the 'module' boot mode
2966
+ * (`apps/cademy/src/lib/loader/boot-module.ts`) to load external
2967
+ * stylesheets into the game's shadow DOM.
2968
+ *
2969
+ * This property is under review for potential deprecation and removal.
2970
+ * The 'module' boot mode itself has not yet seen significant adoption
2971
+ * or clear use-cases, and if support for module loading is removed in
2972
+ * the future, this 'styles' property would become obsolete.
2973
+ *
2974
+ * If module-based games need styling, alternative approaches might involve
2975
+ * bundling CSS within their JavaScript or managing style injection internally.
2976
+ */
2977
+ styles: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodString, "many">>, string[] | undefined, string[] | undefined>;
2978
+ /**
2979
+ * Specifies the game or development platform.
2980
+ * Current values include 'web', 'godot', and 'unity'.
2981
+ * The default in the database is 'web'.
2982
+ *
2983
+ * IMPORTANT: This property is NOT CURRENTLY USED by the core loader
2984
+ * or runtime systems in any functional way. It is present in the manifest
2985
+ * but does not drive any specific behavior in `boot-iframe.ts` or
2986
+ * `boot-module.ts` beyond being a piece of metadata.
2686
2987
  *
2687
2988
  * Potential Future Uses (Speculative):
2688
2989
  * - Analytics: Could be used to gather stats on platform popularity/usage.
@@ -3009,11 +3310,83 @@ declare const UpdateShopListingSchema: z.ZodObject<{
3009
3310
  availableFrom?: Date | null | undefined;
3010
3311
  availableUntil?: Date | null | undefined;
3011
3312
  }>;
3313
+
3314
+ declare enum AchievementCompletionType {
3315
+ TIME_PLAYED_SESSION = "time_played_session",
3316
+ INTERACTION = "interaction",
3317
+ LEADERBOARD_RANK = "leaderboard_rank",
3318
+ FIRST_SCORE = "first_score",
3319
+ PERSONAL_BEST = "personal_best"
3320
+ }
3321
+ type AchievementScopeType = (typeof achievementScopeEnum.enumValues)[number];
3322
+ type Achievement = typeof achievements.$inferSelect;
3323
+ /**
3324
+ * Current-scope achievement with computed status and window metadata
3325
+ */
3326
+ interface AchievementCurrent {
3327
+ id: string;
3328
+ title: string;
3329
+ description?: string | null;
3330
+ scope: AchievementScopeType;
3331
+ rewardCredits: number;
3332
+ limit: number;
3333
+ completionType: AchievementCompletionType;
3334
+ completionConfig: Record<string, unknown>;
3335
+ target: Record<string, unknown>;
3336
+ active: boolean;
3337
+ createdAt?: Date;
3338
+ updatedAt?: Date;
3339
+ status: 'available' | 'completed';
3340
+ scopeKey: string;
3341
+ windowStart: string;
3342
+ windowEnd: string;
3343
+ }
3344
+ /**
3345
+ * Achievement claim history entry
3346
+ * Used in GET /api/achievements/history
3347
+ */
3348
+ interface AchievementHistoryEntry {
3349
+ achievementId: string;
3350
+ title: string;
3351
+ rewardCredits: number;
3352
+ createdAt: string;
3353
+ scopeKey: string;
3354
+ }
3012
3355
  /**
3013
- * Achievement Completion Types
3356
+ * Achievement progress submission response
3357
+ * Used in POST /api/achievements/progress
3014
3358
  */
3015
- declare const ACHIEVEMENT_COMPLETION_TYPES: readonly ["time_played_session", "interaction", "leaderboard_rank"];
3016
- type AchievementCompletionType = (typeof ACHIEVEMENT_COMPLETION_TYPES)[number];
3359
+ interface AchievementProgressResponse {
3360
+ achievementId: string;
3361
+ status: 'completed' | 'already_completed';
3362
+ rewardCredits: number;
3363
+ scopeKey: string;
3364
+ createdAt: string;
3365
+ }
3366
+
3367
+ declare enum NotificationType {
3368
+ ACHIEVEMENT = "achievement",
3369
+ SYSTEM = "system",
3370
+ PROMO = "promo"
3371
+ }
3372
+ declare enum NotificationStatus {
3373
+ PENDING = "pending",
3374
+ DELIVERED = "delivered",
3375
+ SEEN = "seen",
3376
+ CLICKED = "clicked",
3377
+ DISMISSED = "dismissed",
3378
+ EXPIRED = "expired"
3379
+ }
3380
+ type Notification = InferSelectModel<typeof notifications>;
3381
+ interface NotificationStats {
3382
+ total: number;
3383
+ delivered: number;
3384
+ seen: number;
3385
+ clicked: number;
3386
+ dismissed: number;
3387
+ expired: number;
3388
+ clickThroughRate: number;
3389
+ }
3017
3390
 
3018
3391
  type CharacterComponent = typeof characterComponents.$inferSelect;
3019
3392
  type PlayerCharacter = typeof playerCharacters.$inferSelect & {
@@ -3036,6 +3409,17 @@ type Game = HostedGame | ExternalGame;
3036
3409
  type GameSession = typeof gameSessions.$inferSelect;
3037
3410
  type GameStateData = Record<string, unknown>;
3038
3411
  type UpsertGameMetadataInput = z.infer<typeof UpsertGameMetadataSchema>;
3412
+ /**
3413
+ * Response from backend deployment API
3414
+ */
3415
+ interface BackendDeploymentResponse {
3416
+ /** Unique deployment ID */
3417
+ deploymentId: string;
3418
+ /** Backend API URL */
3419
+ url: string;
3420
+ /** Deployment timestamp */
3421
+ deployedAt: string;
3422
+ }
3039
3423
  type Item = typeof items.$inferSelect;
3040
3424
  type InventoryItem = typeof inventoryItems.$inferSelect;
3041
3425
  type Currency = typeof currencies.$inferSelect;
@@ -3107,6 +3491,8 @@ interface UserInfo {
3107
3491
  given_name?: string;
3108
3492
  /** Optional family name (last name) */
3109
3493
  family_name?: string;
3494
+ /** TimeBack student ID (if user has TimeBack integration) */
3495
+ timeback_id?: string;
3110
3496
  /** Additional user attributes from the identity provider */
3111
3497
  [key: string]: unknown;
3112
3498
  }
@@ -3178,8 +3564,6 @@ interface GameLeaderboardEntry {
3178
3564
  gameSlug: string;
3179
3565
  }
3180
3566
 
3181
- type DeveloperKey = typeof developerKeys.$inferSelect;
3182
-
3183
3567
  type UserLevel = typeof userLevels.$inferSelect;
3184
3568
  type LevelConfig = typeof levelConfigs.$inferSelect;
3185
3569
  type UserLevelWithConfig = UserLevel & {
@@ -3307,6 +3691,7 @@ interface SpriteTemplateData {
3307
3691
  };
3308
3692
  };
3309
3693
  }
3694
+ type GameTimebackIntegration = typeof gameTimebackIntegrations.$inferSelect;
3310
3695
  type TodayXpResponse = {
3311
3696
  xp: number;
3312
3697
  date: string;
@@ -3320,50 +3705,157 @@ type XpHistoryResponse = {
3320
3705
  xp: number;
3321
3706
  }>;
3322
3707
  };
3323
-
3324
- type AchievementIntervalType = (typeof achievementIntervalEnum.enumValues)[number];
3325
- type Achievement = typeof achievements.$inferSelect;
3326
- /**
3327
- * Current-interval achievement with computed status and window metadata
3328
- */
3329
- interface AchievementCurrent {
3330
- id: string;
3331
- title: string;
3332
- description?: string | null;
3333
- intervalType: AchievementIntervalType;
3334
- rewardCredits: number;
3335
- limitPerInterval: number;
3336
- completionType: AchievementCompletionType;
3337
- completionConfig: Record<string, unknown>;
3338
- scope: Record<string, unknown>;
3339
- active: boolean;
3340
- createdAt?: Date;
3341
- updatedAt?: Date;
3342
- status: 'available' | 'completed';
3343
- intervalKey: string;
3344
- windowStart: string;
3345
- windowEnd: string;
3346
- }
3347
- /**
3348
- * Historical entry representing a prior claim within an interval
3349
- */
3350
- interface AchievementHistoryEntry {
3351
- achievementId: string;
3352
- title: string;
3353
- rewardCredits: number;
3354
- createdAt: string;
3355
- intervalKey: string;
3356
- }
3357
- /**
3358
- * Response returned when submitting achievement progress
3359
- */
3360
- interface AchievementProgressResponse {
3361
- achievementId: string;
3362
- status: 'completed' | 'already_completed';
3363
- rewardCredits: number;
3364
- intervalKey: string;
3365
- createdAt: string;
3366
- }
3708
+ type TimebackSetupRequest = {
3709
+ gameId: string;
3710
+ config: {
3711
+ organization: {
3712
+ name: string;
3713
+ type: string;
3714
+ identifier: string;
3715
+ };
3716
+ course: {
3717
+ title: string;
3718
+ subjects: string[];
3719
+ grades: number[];
3720
+ courseCode: string;
3721
+ level: string;
3722
+ gradingScheme: string;
3723
+ metadata?: Record<string, unknown>;
3724
+ };
3725
+ component: {
3726
+ title: string;
3727
+ sortOrder: number;
3728
+ prerequisites: string[];
3729
+ prerequisiteCriteria: string;
3730
+ };
3731
+ resource: {
3732
+ title: string;
3733
+ vendorResourceId: string;
3734
+ vendorId: string;
3735
+ applicationId: string;
3736
+ roles: string[];
3737
+ importance: string;
3738
+ metadata: {
3739
+ type?: string;
3740
+ launchUrl?: string;
3741
+ toolProvider?: string;
3742
+ instructionalMethod?: string;
3743
+ subject?: string;
3744
+ grades?: number[];
3745
+ language?: string;
3746
+ xp?: number;
3747
+ [key: string]: unknown;
3748
+ };
3749
+ };
3750
+ componentResource: {
3751
+ title: string;
3752
+ sortOrder: number;
3753
+ lessonType: string | null;
3754
+ };
3755
+ };
3756
+ verbose?: boolean;
3757
+ };
3758
+ type TimebackSetupResponse = {
3759
+ integration: GameTimebackIntegration;
3760
+ courseId: string;
3761
+ verbose?: {
3762
+ course: unknown;
3763
+ component: unknown;
3764
+ resource: unknown;
3765
+ componentResource: unknown;
3766
+ };
3767
+ };
3768
+ type TimebackVerifyResponse = {
3769
+ status: 'success' | 'error';
3770
+ integration: GameTimebackIntegration;
3771
+ resources: {
3772
+ course: {
3773
+ found: boolean;
3774
+ data?: unknown;
3775
+ };
3776
+ component: {
3777
+ found: boolean;
3778
+ data?: unknown;
3779
+ };
3780
+ resource: {
3781
+ found: boolean;
3782
+ data?: unknown;
3783
+ };
3784
+ componentResource: {
3785
+ found: boolean;
3786
+ data?: unknown;
3787
+ };
3788
+ };
3789
+ errors?: string[];
3790
+ };
3791
+ type RecordProgressRequest = {
3792
+ gameId: string;
3793
+ studentId: string;
3794
+ progressData: {
3795
+ score?: number;
3796
+ totalQuestions?: number;
3797
+ correctQuestions?: number;
3798
+ xpEarned?: number;
3799
+ masteredUnits?: number;
3800
+ attemptNumber?: number;
3801
+ activityId?: string;
3802
+ activityName?: string;
3803
+ courseId?: string;
3804
+ classId?: string;
3805
+ courseName?: string;
3806
+ studentEmail?: string;
3807
+ subject?: 'Reading' | 'Language' | 'Vocabulary' | 'Social Studies' | 'Writing' | 'Science' | 'FastMath' | 'Math' | 'None';
3808
+ appName?: string;
3809
+ sensorUrl?: string;
3810
+ };
3811
+ };
3812
+ type RecordProgressResponse = {
3813
+ status: 'ok';
3814
+ courseId: string;
3815
+ };
3816
+ type RecordSessionEndRequest = {
3817
+ gameId: string;
3818
+ studentId: string;
3819
+ sessionData: {
3820
+ activeTimeSeconds: number;
3821
+ inactiveTimeSeconds?: number;
3822
+ wasteTimeSeconds?: number;
3823
+ activityId?: string;
3824
+ activityName?: string;
3825
+ courseId?: string;
3826
+ courseName?: string;
3827
+ studentEmail?: string;
3828
+ subject?: 'Reading' | 'Language' | 'Vocabulary' | 'Social Studies' | 'Writing' | 'Science' | 'FastMath' | 'Math' | 'None';
3829
+ appName?: string;
3830
+ sensorUrl?: string;
3831
+ };
3832
+ };
3833
+ type RecordSessionEndResponse = {
3834
+ status: 'ok';
3835
+ courseId: string;
3836
+ };
3837
+ type AwardXpRequest = {
3838
+ gameId: string;
3839
+ studentId: string;
3840
+ xpAmount: number;
3841
+ metadata: {
3842
+ reason: string;
3843
+ activityId?: string;
3844
+ activityName?: string;
3845
+ courseId?: string;
3846
+ courseName?: string;
3847
+ studentEmail?: string;
3848
+ bonusType?: string;
3849
+ subject?: 'Reading' | 'Language' | 'Vocabulary' | 'Social Studies' | 'Writing' | 'Science' | 'FastMath' | 'Math' | 'None';
3850
+ appName?: string;
3851
+ sensorUrl?: string;
3852
+ };
3853
+ };
3854
+ type AwardXpResponse = {
3855
+ status: 'ok';
3856
+ courseId: string;
3857
+ xpAwarded: number;
3858
+ };
3367
3859
 
3368
3860
  declare const AuthProvider: {
3369
3861
  readonly TIMEBACK: "TIMEBACK";
@@ -3454,6 +3946,144 @@ type XpSummaryResponse = {
3454
3946
  total: TotalXpResponse;
3455
3947
  };
3456
3948
 
3949
+ /**
3950
+ * @fileoverview Server SDK Type Definitions
3951
+ *
3952
+ * TypeScript type definitions for the server-side Playcademy SDK.
3953
+ * Includes configuration types, client state, and re-exported TimeBack types.
3954
+ */
3955
+
3956
+ /**
3957
+ * TimeBack integration configuration for Playcademy config file
3958
+ */
3959
+ interface TimebackIntegrationConfig {
3960
+ /** Organization overrides */
3961
+ organization?: Partial<OrganizationConfig>;
3962
+ /** Course configuration (subjects and grades REQUIRED) */
3963
+ course: CourseConfig;
3964
+ /** Component overrides */
3965
+ component?: Partial<ComponentConfig>;
3966
+ /** Resource overrides */
3967
+ resource?: Partial<ResourceConfig>;
3968
+ /** Component-Resource link overrides */
3969
+ componentResource?: Partial<ComponentResourceConfig>;
3970
+ }
3971
+ /**
3972
+ * Integrations configuration
3973
+ */
3974
+ interface IntegrationsConfig {
3975
+ /** TimeBack integration (optional) */
3976
+ timeback?: TimebackIntegrationConfig;
3977
+ }
3978
+ /**
3979
+ * Unified Playcademy configuration
3980
+ * Used for playcademy.config.{js,json}
3981
+ */
3982
+ interface PlaycademyConfig {
3983
+ /** Game name */
3984
+ name: string;
3985
+ /** Game description */
3986
+ description?: string;
3987
+ /** Game emoji icon */
3988
+ emoji?: string;
3989
+ /** Build command to run before deployment */
3990
+ buildCommand?: string[];
3991
+ /** Path to build output */
3992
+ buildPath?: string;
3993
+ /** Game type */
3994
+ gameType?: 'hosted' | 'external';
3995
+ /** External URL (for external games) */
3996
+ externalUrl?: string;
3997
+ /** Game platform */
3998
+ platform?: 'web' | 'unity' | 'godot';
3999
+ /** Backend configuration */
4000
+ backend?: {
4001
+ /** Custom API routes directory (defaults to 'api') */
4002
+ directory?: string;
4003
+ };
4004
+ /** External integrations */
4005
+ integrations?: IntegrationsConfig;
4006
+ }
4007
+
4008
+ /**
4009
+ * Configuration options for initializing a PlaycademyClient instance.
4010
+ *
4011
+ * @example
4012
+ * ```typescript
4013
+ * const config: PlaycademyServerClientConfig = {
4014
+ * apiKey: process.env.PLAYCADEMY_API_KEY!,
4015
+ * gameId: 'my-math-game',
4016
+ * configPath: './playcademy.config.js'
4017
+ * }
4018
+ * ```
4019
+ */
4020
+ interface PlaycademyServerClientConfig {
4021
+ /**
4022
+ * Playcademy API key for server-to-server authentication.
4023
+ * Obtain from the Playcademy developer dashboard.
4024
+ */
4025
+ apiKey: string;
4026
+ /**
4027
+ * Optional path to playcademy.config.js file.
4028
+ * If not provided, searches current directory and up to 3 parent directories.
4029
+ * Ignored if `config` is provided directly.
4030
+ *
4031
+ * @example './config/playcademy.config.js'
4032
+ */
4033
+ configPath?: string;
4034
+ /**
4035
+ * Optional config object (for edge environments without filesystem).
4036
+ * If provided, skips filesystem-based config loading.
4037
+ *
4038
+ * @example { name: 'My Game', integrations: { timeback: {...} } }
4039
+ */
4040
+ config?: PlaycademyConfig;
4041
+ /**
4042
+ * Optional base URL for Playcademy API.
4043
+ * Defaults to environment variables or 'https://hub.playcademy.com'.
4044
+ *
4045
+ * @example 'http://localhost:3000' for local development
4046
+ */
4047
+ baseUrl?: string;
4048
+ /**
4049
+ * Optional game ID.
4050
+ * If not provided, will attempt to fetch from API using the API token.
4051
+ *
4052
+ * @example 'my-math-game'
4053
+ */
4054
+ gameId?: string;
4055
+ }
4056
+ /**
4057
+ * Internal state maintained by the PlaycademyClient instance.
4058
+ *
4059
+ * @internal
4060
+ */
4061
+ interface PlaycademyServerClientState {
4062
+ /** API key for authentication */
4063
+ apiKey: string;
4064
+ /** Base URL for API requests */
4065
+ baseUrl: string;
4066
+ /** Game identifier */
4067
+ gameId: string;
4068
+ /** Loaded game configuration from playcademy.config.js */
4069
+ config: PlaycademyConfig;
4070
+ /**
4071
+ * TimeBack course ID fetched from the Playcademy API.
4072
+ * Used for all TimeBack event recording.
4073
+ */
4074
+ courseId?: string;
4075
+ }
4076
+
4077
+ /**
4078
+ * Backend deployment bundle for uploading to Playcademy platform
4079
+ */
4080
+ interface BackendDeploymentBundle {
4081
+ /** Bundled JavaScript code ready for deployment */
4082
+ code: string;
4083
+ /** Game configuration */
4084
+ config: PlaycademyConfig;
4085
+ }
4086
+
3457
4087
  interface UserScore {
3458
4088
  id: string;
3459
4089
  score: number;
@@ -3666,7 +4296,7 @@ type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
3666
4296
  */
3667
4297
  declare class PlaycademyClient {
3668
4298
  private baseUrl;
3669
- private token?;
4299
+ private authStrategy;
3670
4300
  private gameId?;
3671
4301
  private config;
3672
4302
  private listeners;
@@ -3679,6 +4309,7 @@ declare class PlaycademyClient {
3679
4309
  * @param config - Optional configuration object
3680
4310
  * @param config.baseUrl - Base URL for API requests (defaults to '/api')
3681
4311
  * @param config.token - Authentication token
4312
+ * @param config.tokenType - Optional token type (auto-detected if not provided)
3682
4313
  * @param config.gameId - Game ID for automatic session management
3683
4314
  * @param config.autoStartSession - Automatically start a game session?
3684
4315
  */
@@ -3701,8 +4332,15 @@ declare class PlaycademyClient {
3701
4332
  * Emits an 'authChange' event when the token changes.
3702
4333
  *
3703
4334
  * @param token - The authentication token, or null to clear
4335
+ * @param tokenType - Optional token type (auto-detected if not provided)
4336
+ */
4337
+ setToken(token: string | null, tokenType?: TokenType): void;
4338
+ /**
4339
+ * Gets the current token type.
4340
+ *
4341
+ * @returns The token type
3704
4342
  */
3705
- setToken(token: string | null): void;
4343
+ getTokenType(): TokenType;
3706
4344
  /**
3707
4345
  * Gets the current authentication token.
3708
4346
  *
@@ -3807,9 +4445,23 @@ declare class PlaycademyClient {
3807
4445
  }) => Promise<{
3808
4446
  success: boolean;
3809
4447
  token?: string;
4448
+ user?: {
4449
+ id: string;
4450
+ email: string;
4451
+ };
4452
+ expiresAt?: string;
3810
4453
  error?: string;
3811
4454
  }>;
3812
4455
  logout: () => Promise<void>;
4456
+ apiKeys: {
4457
+ create: (options?: {
4458
+ name?: string;
4459
+ expiresIn?: number | null;
4460
+ permissions?: Record<string, string[]>;
4461
+ }) => Promise<BetterAuthApiKeyResponse>;
4462
+ list: () => Promise<BetterAuthApiKey[]>;
4463
+ revoke: (keyId: string) => Promise<void>;
4464
+ };
3813
4465
  };
3814
4466
  /** Identity provider connection methods (connect external accounts) */
3815
4467
  identity: {
@@ -3860,7 +4512,7 @@ declare class PlaycademyClient {
3860
4512
  };
3861
4513
  leaderboard: {
3862
4514
  get: (gameId: string, options?: {
3863
- limit? /** Runtime methods (getGameToken, exit) */: number;
4515
+ limit?: number;
3864
4516
  offset?: number;
3865
4517
  }) => Promise<LeaderboardEntry[]>;
3866
4518
  };
@@ -3892,27 +4544,13 @@ declare class PlaycademyClient {
3892
4544
  get: () => Promise<DeveloperStatusValue>;
3893
4545
  };
3894
4546
  games: {
3895
- upsert: (slug: string, metadata: UpsertGameMetadataInput, file: File | Blob | null, hooks?: DevUploadHooks) => Promise<Game>;
3896
- update: (gameId: string, props: Partial<Game>) => Promise<void>;
4547
+ deploy: {
4548
+ frontend: (slug: string, metadata: UpsertGameMetadataInput, file: File | Blob | null, hooks?: DevUploadHooks) => Promise<Game>;
4549
+ backend: (slug: string, bundle: BackendDeploymentBundle) => Promise<BackendDeploymentResponse>;
4550
+ };
4551
+ upsert: (slug: string, metadata: UpsertGameMetadataInput) => Promise<Game>;
3897
4552
  delete: (gameId: string) => Promise<void>;
3898
4553
  };
3899
- keys: {
3900
- create: (label?: string) => Promise<{
3901
- id: string;
3902
- createdAt: Date;
3903
- userId: string;
3904
- label: string | null;
3905
- keyHash: string;
3906
- }>;
3907
- list: () => Promise<{
3908
- id: string;
3909
- createdAt: Date;
3910
- userId: string;
3911
- label: string | null;
3912
- keyHash: string;
3913
- }[]>;
3914
- revoke: (keyId: string) => Promise<void>;
3915
- };
3916
4554
  items: {
3917
4555
  create: (gameId: string, slug: string, itemData: Omit<InsertItemInput, "slug" | "gameId">) => Promise<Item>;
3918
4556
  update: (gameId: string, itemId: string, updates: UpdateItemInput) => Promise<Item>;
@@ -3932,8 +4570,8 @@ declare class PlaycademyClient {
3932
4570
  };
3933
4571
  /** Map methods (elements) */
3934
4572
  maps: {
3935
- get: (identifier: string) => Promise<MapData>;
3936
- elements: (mapId: string) => Promise<MapElementWithGame[]>;
4573
+ get: (identifier: string, options?: TTLCacheConfig) => Promise<MapData>;
4574
+ elements: (mapId: string, options?: TTLCacheConfig) => Promise<MapElementWithGame[]>;
3937
4575
  objects: {
3938
4576
  list: (mapId: string) => Promise<MapObjectWithItem[]>;
3939
4577
  create: (mapId: string, objectData: CreateMapObjectData) => Promise<MapObjectWithItem>;
@@ -4108,6 +4746,16 @@ declare class PlaycademyClient {
4108
4746
  };
4109
4747
  /** TimeBack XP methods (today, total, history) */
4110
4748
  timeback: {
4749
+ recordProgress: (progressData: RecordProgressRequest["progressData"]) => Promise<RecordProgressResponse>;
4750
+ recordSessionEnd: (sessionData: RecordSessionEndRequest["sessionData"]) => Promise<RecordSessionEndResponse>;
4751
+ awardXP: (xpAmount: number, metadata: AwardXpRequest["metadata"]) => Promise<AwardXpResponse>;
4752
+ management: {
4753
+ setup: (request: TimebackSetupRequest) => Promise<TimebackSetupResponse>;
4754
+ verify: (gameId: string) => Promise<TimebackVerifyResponse>;
4755
+ cleanup: (gameId: string) => Promise<void>;
4756
+ get: (gameId: string) => Promise<GameTimebackIntegration | null>;
4757
+ getConfig: (gameId: string) => Promise<TimebackSetupRequest["config"]>;
4758
+ };
4111
4759
  xp: {
4112
4760
  today: (options?: {
4113
4761
  date?: string;
@@ -4115,7 +4763,7 @@ declare class PlaycademyClient {
4115
4763
  }) => Promise<TodayXpResponse>;
4116
4764
  total: () => Promise<TotalXpResponse>;
4117
4765
  history: (options?: {
4118
- startDate?: string;
4766
+ startDate? /** TimeBack XP methods (today, total, history) */: string;
4119
4767
  endDate?: string;
4120
4768
  }) => Promise<XpHistoryResponse>;
4121
4769
  summary: (options?: {
@@ -4189,6 +4837,24 @@ declare class PlaycademyClient {
4189
4837
  submit: (achievementId: string) => Promise<AchievementProgressResponse>;
4190
4838
  };
4191
4839
  };
4840
+ /** Notifications methods (list, update status, stats) */
4841
+ notifications: {
4842
+ list: (queryOptions?: {
4843
+ status?: NotificationStatus;
4844
+ type?: NotificationType;
4845
+ limit?: number;
4846
+ offset?: number;
4847
+ }, cacheOptions?: TTLCacheConfig) => Promise<Notification[]>;
4848
+ markAsSeen: (notificationId: string) => Promise<Notification>;
4849
+ markAsClicked: (notificationId: string) => Promise<Notification>;
4850
+ dismiss: (notificationId: string) => Promise<Notification>;
4851
+ stats: {
4852
+ get: (queryOptions?: {
4853
+ from?: string;
4854
+ to?: string;
4855
+ }, cacheOptions?: TTLCacheConfig) => Promise<NotificationStats>;
4856
+ };
4857
+ };
4192
4858
  /** Auto-initializes a PlaycademyClient with context from the environment */
4193
4859
  static init: typeof init;
4194
4860
  /** Authenticates a user with email and password */
@@ -4199,9 +4865,11 @@ declare class PlaycademyClient {
4199
4865
  };
4200
4866
  }
4201
4867
 
4868
+ type TokenType = 'session' | 'apiKey' | 'gameJwt';
4202
4869
  interface ClientConfig {
4203
4870
  baseUrl: string;
4204
4871
  token?: string;
4872
+ tokenType?: TokenType;
4205
4873
  gameId?: string;
4206
4874
  autoStartSession?: boolean;
4207
4875
  }
@@ -4409,6 +5077,43 @@ type DevUploadHooks = {
4409
5077
  onEvent?: (e: DevUploadEvent) => void;
4410
5078
  onClose?: () => void;
4411
5079
  };
5080
+ /**
5081
+ * Better-auth sign-in response
5082
+ */
5083
+ interface BetterAuthSignInResponse {
5084
+ token: string;
5085
+ user: {
5086
+ id: string;
5087
+ email: string;
5088
+ };
5089
+ expiresAt: string;
5090
+ }
5091
+ /**
5092
+ * Better-auth API key creation response
5093
+ */
5094
+ interface BetterAuthApiKeyResponse {
5095
+ apiKey: string;
5096
+ key: {
5097
+ id: string;
5098
+ name: string | null;
5099
+ expiresAt: string | null;
5100
+ createdAt: string;
5101
+ };
5102
+ }
5103
+ /**
5104
+ * Better-auth API key list item
5105
+ */
5106
+ interface BetterAuthApiKey {
5107
+ id: string;
5108
+ name: string | null;
5109
+ start: string;
5110
+ enabled: boolean;
5111
+ expiresAt: string | null;
5112
+ createdAt: string;
5113
+ updatedAt: string;
5114
+ lastRequest: string | null;
5115
+ requestCount: number;
5116
+ }
4412
5117
 
4413
5118
  export { PlaycademyClient };
4414
- export type { Achievement, AchievementCurrent, AchievementProgressResponse, AuthCallbackPayload, AuthOptions, AuthProviderType, AuthResult, AuthServerMessage, AuthStateChangePayload, AuthStateUpdate, AuthenticatedUser, CharacterComponent, CharacterComponentWithSpriteUrl, ClientConfig, ClientEvents, Currency, DevUploadEvent, DevUploadHooks, DeveloperKey, DeveloperStatusResponse, EventListeners, ExternalGame, Game, GameContextPayload, GameLeaderboardEntry, GameSession, GameStateData, GameTokenResponse, GameUser, HostedGame, HostedGameWithManifest, InitPayload, InventoryItem, InventoryItemWithItem, InventoryMutationResponse, Item, KeyEventPayload, LeaderboardEntry, LevelConfig, LoginResponse, ManifestV1, Map, MapElement, MapElementWithGame, MapObject, MapObjectWithItem, PlayerCharacter, ShopCurrency, ShopDisplayItem, ShopViewResponse, SpriteTemplate, SpriteTemplateData, StartSessionResponse, TelemetryPayload, TodayXpResponse, TokenRefreshPayload, TotalXpResponse, User, UserInfo, UserLevel, UserLevelWithConfig, UserRank, UserRankResponse, UserRoleEnumType, UserScore$1 as UserScore, XpHistoryResponse };
5119
+ export type { Achievement, AchievementCurrent, AchievementProgressResponse, AuthCallbackPayload, AuthOptions, AuthProviderType, AuthResult, AuthServerMessage, AuthStateChangePayload, AuthStateUpdate, AuthenticatedUser, BetterAuthApiKey, BetterAuthApiKeyResponse, BetterAuthSignInResponse, CharacterComponent, CharacterComponentWithSpriteUrl, ClientConfig, ClientEvents, Currency, DevUploadEvent, DevUploadHooks, DeveloperStatusResponse, EventListeners, ExternalGame, Game, GameContextPayload, GameLeaderboardEntry, GameSession, GameStateData, GameTokenResponse, GameUser, HostedGame, HostedGameWithManifest, 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 };