@vestcards/server-types 1.2.0 → 1.4.0

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.
Files changed (75) hide show
  1. package/dist/apps/server/src/app.d.ts +437 -16
  2. package/dist/apps/server/src/config/env.d.ts +7 -1
  3. package/dist/apps/server/src/lib/metrics.d.ts +4 -0
  4. package/dist/apps/server/src/lib/posthog.d.ts +2 -0
  5. package/dist/apps/server/src/libs/mappers.d.ts +5 -0
  6. package/dist/apps/server/src/middleware/errorHandler.d.ts +1 -1
  7. package/dist/apps/server/src/middleware/logger.d.ts +12 -29
  8. package/dist/apps/server/src/modules/auth/lib.d.ts +45 -17
  9. package/dist/apps/server/src/modules/auth/profile.d.ts +5 -0
  10. package/dist/apps/server/src/modules/auth/utils.d.ts +1 -0
  11. package/dist/apps/server/src/modules/card/index.d.ts +89 -0
  12. package/dist/apps/server/src/modules/card/model.d.ts +17 -0
  13. package/dist/apps/server/src/modules/card/service.d.ts +8 -1
  14. package/dist/apps/server/src/modules/cron/cron.test.d.ts +1 -0
  15. package/dist/apps/server/src/modules/cron/index.d.ts +53 -0
  16. package/dist/apps/server/src/modules/cron/jobs/expire-memberships.d.ts +1 -0
  17. package/dist/apps/server/src/modules/cron/jobs/payment-expiry-reminder.d.ts +1 -0
  18. package/dist/apps/server/src/modules/deck/index.d.ts +19 -1
  19. package/dist/apps/server/src/modules/deck/model.d.ts +4 -0
  20. package/dist/apps/server/src/modules/deck/service.d.ts +5 -1
  21. package/dist/apps/server/src/modules/ranking/index.d.ts +412 -0
  22. package/dist/apps/server/src/modules/ranking/model.d.ts +28 -0
  23. package/dist/apps/server/src/modules/ranking/ranking.test.d.ts +1 -0
  24. package/dist/apps/server/src/modules/ranking/service.d.ts +4 -0
  25. package/dist/apps/server/src/modules/stats/index.d.ts +446 -0
  26. package/dist/apps/server/src/modules/stats/model.d.ts +85 -0
  27. package/dist/apps/server/src/modules/stats/service.d.ts +27 -0
  28. package/dist/apps/server/src/modules/stats/stats.test.d.ts +1 -0
  29. package/dist/apps/server/src/modules/study/service.d.ts +7 -7
  30. package/dist/apps/server/src/modules/user/errors.d.ts +3 -0
  31. package/dist/apps/server/src/modules/user/index.d.ts +94 -15
  32. package/dist/apps/server/src/modules/user/model.d.ts +17 -1
  33. package/dist/apps/server/src/modules/user/service.d.ts +17 -29
  34. package/dist/apps/server/src/modules/vesty/index.d.ts +473 -0
  35. package/dist/apps/server/src/modules/vesty/model.d.ts +35 -0
  36. package/dist/apps/server/src/modules/vesty/service.d.ts +6 -0
  37. package/dist/apps/server/src/modules/vesty/services/generate-deck.d.ts +2 -0
  38. package/dist/apps/server/src/modules/vesty/services/insights.d.ts +3 -0
  39. package/dist/apps/server/src/modules/vesty/tools.d.ts +11 -0
  40. package/dist/apps/server/src/modules/vesty/utils.d.ts +69 -0
  41. package/dist/apps/server/src/modules/vesty/vesty.test.d.ts +1 -0
  42. package/dist/apps/server/src/server.d.ts +1 -0
  43. package/dist/apps/server/src/tests/helpers/fixtures.d.ts +9 -6
  44. package/dist/apps/server/src/tests/preload/vesty-mock.d.ts +1 -0
  45. package/dist/apps/server/src/utils/api.d.ts +1 -1
  46. package/dist/apps/server/src/utils/select.d.ts +17 -0
  47. package/dist/packages/db-core/src/index.d.ts +0 -1
  48. package/dist/packages/db-core/src/schema/auth.d.ts +94 -0
  49. package/dist/packages/db-core/src/schema/deck.d.ts +17 -0
  50. package/dist/packages/db-core/src/schema/payment.d.ts +37 -1
  51. package/dist/packages/email-core/src/templates/deleteAccountRequest.d.ts +8 -0
  52. package/dist/packages/email-core/src/templates/footer.d.ts +1 -1
  53. package/dist/packages/email-core/src/templates/index.d.ts +4 -0
  54. package/dist/packages/email-core/src/templates/paymentExpiryReminder.d.ts +9 -0
  55. package/dist/packages/shared/src/date/index.d.ts +1 -0
  56. package/dist/packages/shared/src/date/timezone.d.ts +29 -0
  57. package/dist/packages/shared/src/spaced-repetition/config.d.ts +20 -0
  58. package/dist/packages/shared/src/spaced-repetition/fsrs.d.ts +13 -0
  59. package/dist/packages/shared/src/spaced-repetition/index.d.ts +5 -0
  60. package/dist/packages/shared/src/spaced-repetition/retention.d.ts +2 -0
  61. package/dist/packages/shared/src/spaced-repetition/session-manager.d.ts +25 -0
  62. package/dist/packages/shared/src/spaced-repetition/utils.d.ts +26 -0
  63. package/dist/packages/shared/src/theme/tokens/border.d.ts +1 -1
  64. package/dist/packages/shared/src/theme/tokens/colors.d.ts +18 -18
  65. package/dist/packages/shared/src/types/deck.d.ts +10 -0
  66. package/dist/packages/shared/src/types/index.d.ts +1 -0
  67. package/dist/packages/shared/src/types/permissions.d.ts +2 -0
  68. package/dist/packages/shared/src/types/user.d.ts +20 -0
  69. package/dist/packages/shared/src/types/vesty.d.ts +7 -0
  70. package/dist/packages/utils/src/logger/index.d.ts +2 -1
  71. package/dist/packages/utils/src/logger/posthog.d.ts +20 -0
  72. package/package.json +1 -1
  73. package/dist/apps/server/src/modules/study/lib/constants.d.ts +0 -5
  74. package/dist/apps/server/src/modules/study/lib/fsrs.d.ts +0 -12
  75. package/dist/packages/db-core/src/views/deck.d.ts +0 -79
@@ -503,6 +503,95 @@ declare const app: Elysia<"", {
503
503
  };
504
504
  };
505
505
  };
506
+ } & {
507
+ v1: {
508
+ card: {
509
+ suspend: {
510
+ post: {
511
+ body: {
512
+ cardId: string;
513
+ };
514
+ params: {};
515
+ query: {};
516
+ headers: {};
517
+ response: {
518
+ 200: {
519
+ success: boolean;
520
+ };
521
+ 422: {
522
+ type: "validation";
523
+ on: string;
524
+ summary?: string;
525
+ message?: string;
526
+ found?: unknown;
527
+ property?: string;
528
+ expected?: string;
529
+ };
530
+ };
531
+ };
532
+ };
533
+ };
534
+ };
535
+ } & {
536
+ v1: {
537
+ card: {
538
+ suspend: {
539
+ delete: {
540
+ body: {};
541
+ params: {};
542
+ query: {
543
+ cardId: string;
544
+ };
545
+ headers: {};
546
+ response: {
547
+ 200: {
548
+ success: boolean;
549
+ };
550
+ 422: {
551
+ type: "validation";
552
+ on: string;
553
+ summary?: string;
554
+ message?: string;
555
+ found?: unknown;
556
+ property?: string;
557
+ expected?: string;
558
+ };
559
+ };
560
+ };
561
+ };
562
+ };
563
+ };
564
+ } & {
565
+ v1: {
566
+ card: {
567
+ "user-state": {
568
+ get: {
569
+ body: {};
570
+ params: {};
571
+ query: {
572
+ deckId: string;
573
+ };
574
+ headers: {};
575
+ response: {
576
+ 200: {
577
+ cardId: string;
578
+ suspended: boolean;
579
+ toReview: boolean;
580
+ }[];
581
+ 422: {
582
+ type: "validation";
583
+ on: string;
584
+ summary?: string;
585
+ message?: string;
586
+ found?: unknown;
587
+ property?: string;
588
+ expected?: string;
589
+ };
590
+ };
591
+ };
592
+ };
593
+ };
594
+ };
506
595
  } & {
507
596
  v1: {
508
597
  decks: {
@@ -574,6 +663,22 @@ declare const app: Elysia<"", {
574
663
  };
575
664
  };
576
665
  };
666
+ } & {
667
+ v1: {
668
+ decks: {
669
+ recommended: {
670
+ get: {
671
+ body: {};
672
+ params: {};
673
+ query: {};
674
+ headers: {};
675
+ response: {
676
+ 200: import("@vestcards/shared").IDeck[];
677
+ };
678
+ };
679
+ };
680
+ };
681
+ };
577
682
  } & {
578
683
  v1: {
579
684
  decks: {
@@ -583,7 +688,9 @@ declare const app: Elysia<"", {
583
688
  params: {
584
689
  deckId: string;
585
690
  };
586
- query: {};
691
+ query: {
692
+ preview?: boolean | undefined;
693
+ };
587
694
  headers: {};
588
695
  response: {
589
696
  200: import("@vestcards/shared").IDeckDetail;
@@ -1054,6 +1161,134 @@ declare const app: Elysia<"", {
1054
1161
  };
1055
1162
  };
1056
1163
  };
1164
+ } & {
1165
+ v1: {
1166
+ ranking: {
1167
+ v1: {
1168
+ auth: {
1169
+ "validate-reset-token": {
1170
+ get: {
1171
+ body: unknown;
1172
+ params: {};
1173
+ query: {
1174
+ token: string;
1175
+ };
1176
+ headers: unknown;
1177
+ response: {
1178
+ 200: {
1179
+ valid: boolean;
1180
+ };
1181
+ 422: {
1182
+ type: "validation";
1183
+ on: string;
1184
+ summary?: string;
1185
+ message?: string;
1186
+ found?: unknown;
1187
+ property?: string;
1188
+ expected?: string;
1189
+ };
1190
+ };
1191
+ };
1192
+ };
1193
+ };
1194
+ };
1195
+ };
1196
+ };
1197
+ } & {
1198
+ v1: {
1199
+ ranking: {
1200
+ get: {
1201
+ body: {};
1202
+ params: {};
1203
+ query: {};
1204
+ headers: {};
1205
+ response: {
1206
+ 200: import("./modules/ranking/model").RankingData;
1207
+ };
1208
+ };
1209
+ };
1210
+ };
1211
+ } & {
1212
+ v1: {
1213
+ stats: {
1214
+ v1: {
1215
+ auth: {
1216
+ "validate-reset-token": {
1217
+ get: {
1218
+ body: unknown;
1219
+ params: {};
1220
+ query: {
1221
+ token: string;
1222
+ };
1223
+ headers: unknown;
1224
+ response: {
1225
+ 200: {
1226
+ valid: boolean;
1227
+ };
1228
+ 422: {
1229
+ type: "validation";
1230
+ on: string;
1231
+ summary?: string;
1232
+ message?: string;
1233
+ found?: unknown;
1234
+ property?: string;
1235
+ expected?: string;
1236
+ };
1237
+ };
1238
+ };
1239
+ };
1240
+ };
1241
+ };
1242
+ };
1243
+ };
1244
+ } & {
1245
+ v1: {
1246
+ stats: {
1247
+ home: {
1248
+ get: {
1249
+ body: {};
1250
+ params: {};
1251
+ query: {};
1252
+ headers: {};
1253
+ response: {
1254
+ 200: import("./modules/stats/model").StatsModel.HomePageStats;
1255
+ };
1256
+ };
1257
+ };
1258
+ };
1259
+ };
1260
+ } & {
1261
+ v1: {
1262
+ stats: {
1263
+ streak: {
1264
+ get: {
1265
+ body: {};
1266
+ params: {};
1267
+ query: {};
1268
+ headers: {};
1269
+ response: {
1270
+ 200: import("./modules/stats/model").StatsModel.StreakResult;
1271
+ };
1272
+ };
1273
+ };
1274
+ };
1275
+ };
1276
+ } & {
1277
+ v1: {
1278
+ stats: {
1279
+ dashboard: {
1280
+ get: {
1281
+ body: {};
1282
+ params: {};
1283
+ query: {};
1284
+ headers: {};
1285
+ response: {
1286
+ 200: import("./modules/stats/model").StatsModel.DashboardStats;
1287
+ };
1288
+ };
1289
+ };
1290
+ };
1291
+ };
1057
1292
  } & {
1058
1293
  v1: {
1059
1294
  user: {
@@ -1097,20 +1332,7 @@ declare const app: Elysia<"", {
1097
1332
  query: {};
1098
1333
  headers: {};
1099
1334
  response: {
1100
- 200: {
1101
- id: string;
1102
- name: string;
1103
- surname: string;
1104
- email: string;
1105
- image: string | null;
1106
- role: import("@vestcards/shared").UserRole;
1107
- goal: string | null;
1108
- learnDailyLimit: number | null;
1109
- universityId: number | null;
1110
- universityName: string | null;
1111
- courseId: number | null;
1112
- courseName: string | null;
1113
- };
1335
+ 200: import("@vestcards/shared").IUserProfile | null;
1114
1336
  };
1115
1337
  };
1116
1338
  };
@@ -1123,8 +1345,10 @@ declare const app: Elysia<"", {
1123
1345
  patch: {
1124
1346
  body: {
1125
1347
  university?: number | null | undefined;
1348
+ timezone?: string | undefined;
1126
1349
  course?: number | null | undefined;
1127
- learnDailyLimit?: number | undefined;
1350
+ learnDailyLimit?: number | null | undefined;
1351
+ newCardsPerDeckDailyLimit?: number | null | undefined;
1128
1352
  };
1129
1353
  params: {};
1130
1354
  query: {};
@@ -1165,6 +1389,68 @@ declare const app: Elysia<"", {
1165
1389
  };
1166
1390
  };
1167
1391
  };
1392
+ } & {
1393
+ v1: {
1394
+ user: {
1395
+ account: {
1396
+ "delete-request": {
1397
+ post: {
1398
+ body: {
1399
+ email: string;
1400
+ };
1401
+ params: {};
1402
+ query: {};
1403
+ headers: {};
1404
+ response: {
1405
+ 200: {
1406
+ success: boolean;
1407
+ };
1408
+ 422: {
1409
+ type: "validation";
1410
+ on: string;
1411
+ summary?: string;
1412
+ message?: string;
1413
+ found?: unknown;
1414
+ property?: string;
1415
+ expected?: string;
1416
+ };
1417
+ };
1418
+ };
1419
+ };
1420
+ };
1421
+ };
1422
+ };
1423
+ } & {
1424
+ v1: {
1425
+ user: {
1426
+ account: {
1427
+ "confirm-delete": {
1428
+ post: {
1429
+ body: {
1430
+ token: string;
1431
+ };
1432
+ params: {};
1433
+ query: {};
1434
+ headers: {};
1435
+ response: {
1436
+ 200: {
1437
+ success: boolean;
1438
+ };
1439
+ 422: {
1440
+ type: "validation";
1441
+ on: string;
1442
+ summary?: string;
1443
+ message?: string;
1444
+ found?: unknown;
1445
+ property?: string;
1446
+ expected?: string;
1447
+ };
1448
+ };
1449
+ };
1450
+ };
1451
+ };
1452
+ };
1453
+ };
1168
1454
  } & {
1169
1455
  v1: {
1170
1456
  user: {
@@ -1184,6 +1470,33 @@ declare const app: Elysia<"", {
1184
1470
  };
1185
1471
  };
1186
1472
  };
1473
+ } & {
1474
+ v1: {
1475
+ user: {
1476
+ password: {
1477
+ post: {
1478
+ body: {
1479
+ newPassword: string;
1480
+ currentPassword: string;
1481
+ };
1482
+ params: {};
1483
+ query: {};
1484
+ headers: {};
1485
+ response: {
1486
+ 422: {
1487
+ type: "validation";
1488
+ on: string;
1489
+ summary?: string;
1490
+ message?: string;
1491
+ found?: unknown;
1492
+ property?: string;
1493
+ expected?: string;
1494
+ };
1495
+ };
1496
+ };
1497
+ };
1498
+ };
1499
+ };
1187
1500
  } & {
1188
1501
  v1: {
1189
1502
  user: {
@@ -1192,6 +1505,7 @@ declare const app: Elysia<"", {
1192
1505
  body: {
1193
1506
  university?: number | undefined;
1194
1507
  dayTimeReminder?: string | undefined;
1508
+ timezone?: string | undefined;
1195
1509
  course?: number | undefined;
1196
1510
  goal: string;
1197
1511
  hoursStudied: string;
@@ -1279,6 +1593,113 @@ declare const app: Elysia<"", {
1279
1593
  };
1280
1594
  };
1281
1595
  };
1596
+ } & {
1597
+ v1: {
1598
+ vesty: {
1599
+ v1: {
1600
+ auth: {
1601
+ "validate-reset-token": {
1602
+ get: {
1603
+ body: unknown;
1604
+ params: {};
1605
+ query: {
1606
+ token: string;
1607
+ };
1608
+ headers: unknown;
1609
+ response: {
1610
+ 200: {
1611
+ valid: boolean;
1612
+ };
1613
+ 422: {
1614
+ type: "validation";
1615
+ on: string;
1616
+ summary?: string;
1617
+ message?: string;
1618
+ found?: unknown;
1619
+ property?: string;
1620
+ expected?: string;
1621
+ };
1622
+ };
1623
+ };
1624
+ };
1625
+ };
1626
+ };
1627
+ };
1628
+ };
1629
+ } & {
1630
+ v1: {
1631
+ vesty: {
1632
+ chat: {
1633
+ post: {
1634
+ body: {
1635
+ data?: {} | undefined;
1636
+ messages: {
1637
+ role: "user" | "assistant";
1638
+ parts: any[];
1639
+ }[];
1640
+ };
1641
+ params: {};
1642
+ query: {};
1643
+ headers: {};
1644
+ response: {
1645
+ 200: Response;
1646
+ 422: {
1647
+ type: "validation";
1648
+ on: string;
1649
+ summary?: string;
1650
+ message?: string;
1651
+ found?: unknown;
1652
+ property?: string;
1653
+ expected?: string;
1654
+ };
1655
+ };
1656
+ };
1657
+ };
1658
+ };
1659
+ };
1660
+ } & {
1661
+ v1: {
1662
+ vesty: {
1663
+ "generate-deck": {
1664
+ post: {
1665
+ body: {
1666
+ prompt: string;
1667
+ };
1668
+ params: {};
1669
+ query: {};
1670
+ headers: {};
1671
+ response: {
1672
+ 200: import("./modules/vesty/model").VestyModel.GeneratedDeck;
1673
+ 422: {
1674
+ type: "validation";
1675
+ on: string;
1676
+ summary?: string;
1677
+ message?: string;
1678
+ found?: unknown;
1679
+ property?: string;
1680
+ expected?: string;
1681
+ };
1682
+ };
1683
+ };
1684
+ };
1685
+ };
1686
+ };
1687
+ } & {
1688
+ v1: {
1689
+ vesty: {
1690
+ insights: {
1691
+ get: {
1692
+ body: {};
1693
+ params: {};
1694
+ query: {};
1695
+ headers: {};
1696
+ response: {
1697
+ 200: import("./modules/vesty/model").VestyModel.InsightsResult;
1698
+ };
1699
+ };
1700
+ };
1701
+ };
1702
+ };
1282
1703
  } & {
1283
1704
  health: {
1284
1705
  get: {
@@ -8,9 +8,15 @@ export declare const config: {
8
8
  googleClientId: string;
9
9
  googleClientSecret: string;
10
10
  appleClientId: string;
11
- appleClientSecret: string;
11
+ appleTeamId: string;
12
+ appleKeyId: string;
13
+ applePrivateKey: string;
14
+ appleAppBundleIdentifier: string;
15
+ geminiApiKey: string;
12
16
  port: number;
13
17
  nodeEnv: string;
14
18
  corsOrigins: string | undefined;
15
19
  debug: boolean;
20
+ posthogApiKey: string;
21
+ posthogHost: string;
16
22
  };
@@ -0,0 +1,4 @@
1
+ import { Counter, Histogram, register } from 'prom-client';
2
+ export declare const httpRequestDuration: Histogram<"route" | "method" | "status_code">;
3
+ export declare const httpRequestTotal: Counter<"route" | "method" | "status_code">;
4
+ export { register };
@@ -0,0 +1,2 @@
1
+ import { PostHog } from 'posthog-node';
2
+ export declare const posthog: PostHog;
@@ -0,0 +1,5 @@
1
+ import type { CardReview, NewCardReview, NewReviewLog } from '@vestcards/db-core';
2
+ import type { ICardReview, IReviewLog } from '@vestcards/shared';
3
+ export declare function cardReviewToICardReview(row: CardReview): ICardReview;
4
+ export declare function iCardReviewToNewCardReview(card: ICardReview): NewCardReview;
5
+ export declare function iReviewLogToNewReviewLog(log: IReviewLog): NewReviewLog;
@@ -1,4 +1,4 @@
1
- import type { ErrorHandler } from 'elysia';
1
+ import { type ErrorHandler } from 'elysia';
2
2
  /**
3
3
  * Global error handler returning Response.json() so the return type
4
4
  * is NOT merged into Eden treaty's success union — errors stay in
@@ -1,29 +1,12 @@
1
- import { Elysia } from 'elysia';
2
- export declare const requestLogger: Elysia<"", {
3
- decorator: {};
4
- store: {};
5
- derive: {};
6
- resolve: {};
7
- }, {
8
- typebox: {};
9
- error: {};
10
- }, {
11
- schema: {};
12
- standaloneSchema: {};
13
- macro: {};
14
- macroFn: {};
15
- parser: {};
16
- response: {};
17
- }, {}, {
18
- derive: {};
19
- resolve: {};
20
- schema: {};
21
- standaloneSchema: {};
22
- response: {};
23
- }, {
24
- derive: {};
25
- resolve: {};
26
- schema: {};
27
- standaloneSchema: {};
28
- response: {};
29
- }>;
1
+ export declare function onRequest({ request, store }: {
2
+ request: Request;
3
+ store: Record<string, unknown>;
4
+ }): Promise<void>;
5
+ export declare function onAfterResponse({ request, responseValue, set, store, }: {
6
+ request: Request;
7
+ responseValue: unknown;
8
+ set: {
9
+ status?: number | string;
10
+ };
11
+ store: Record<string, unknown>;
12
+ }): void;