@vestcards/server-types 0.5.0 → 1.0.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.
- package/dist/apps/server/src/app.d.ts +4 -4
- package/dist/apps/server/src/db/schema/deck.d.ts +1 -1
- package/dist/apps/server/src/modules/library/index.d.ts +2 -2
- package/dist/apps/server/src/modules/library/service.d.ts +3 -3
- package/dist/apps/server/src/modules/study/index.d.ts +2 -2
- package/dist/apps/server/src/modules/study/service.d.ts +5 -5
- package/dist/apps/server/src/modules/study/utils.d.ts +3 -4
- package/dist/apps/server/src/modules/topic/service.d.ts +1 -1
- package/dist/apps/server/src/utils/select.d.ts +2 -2
- package/dist/packages/shared/src/index.d.ts +1 -0
- package/dist/packages/shared/src/types/fsrs.d.ts +17 -0
- package/dist/packages/shared/src/types/study.d.ts +49 -15
- package/package.json +1 -1
- package/dist/apps/server/src/types/study.d.ts +0 -28
- package/dist/apps/server/src/types/topic.d.ts +0 -1
|
@@ -530,7 +530,7 @@ declare const app: Elysia<"", {
|
|
|
530
530
|
};
|
|
531
531
|
headers: {};
|
|
532
532
|
response: {
|
|
533
|
-
200: import("
|
|
533
|
+
200: import("@vestcards/shared").ISessionData;
|
|
534
534
|
422: {
|
|
535
535
|
type: "validation";
|
|
536
536
|
on: string;
|
|
@@ -558,7 +558,7 @@ declare const app: Elysia<"", {
|
|
|
558
558
|
};
|
|
559
559
|
headers: {};
|
|
560
560
|
response: {
|
|
561
|
-
200: import("@vestcards/shared").
|
|
561
|
+
200: import("@vestcards/shared").IStudyStats | {
|
|
562
562
|
status: import("@vestcards/shared").StudyStatus;
|
|
563
563
|
review: number;
|
|
564
564
|
learning: number;
|
|
@@ -624,7 +624,7 @@ declare const app: Elysia<"", {
|
|
|
624
624
|
query: {};
|
|
625
625
|
headers: {};
|
|
626
626
|
response: {
|
|
627
|
-
200: import("@vestcards/shared").
|
|
627
|
+
200: import("@vestcards/shared").IGroupedLibraryData;
|
|
628
628
|
};
|
|
629
629
|
};
|
|
630
630
|
};
|
|
@@ -639,7 +639,7 @@ declare const app: Elysia<"", {
|
|
|
639
639
|
query: {};
|
|
640
640
|
headers: {};
|
|
641
641
|
response: {
|
|
642
|
-
200: import("@vestcards/shared").
|
|
642
|
+
200: import("@vestcards/shared").IArchivedLibraryItem[];
|
|
643
643
|
};
|
|
644
644
|
};
|
|
645
645
|
};
|
|
@@ -1019,7 +1019,7 @@ export declare const reviewLogs: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
1019
1019
|
tableName: "review_log";
|
|
1020
1020
|
dataType: "string";
|
|
1021
1021
|
columnType: "PgText";
|
|
1022
|
-
data: "
|
|
1022
|
+
data: "Manual" | "Again" | "Hard" | "Good" | "Easy";
|
|
1023
1023
|
driverParam: string;
|
|
1024
1024
|
notNull: true;
|
|
1025
1025
|
hasDefault: false;
|
|
@@ -357,7 +357,7 @@ export declare const libraryModule: Elysia<"/v1/library", {
|
|
|
357
357
|
query: {};
|
|
358
358
|
headers: {};
|
|
359
359
|
response: {
|
|
360
|
-
200: import("@vestcards/shared").
|
|
360
|
+
200: import("@vestcards/shared").IGroupedLibraryData;
|
|
361
361
|
};
|
|
362
362
|
};
|
|
363
363
|
};
|
|
@@ -372,7 +372,7 @@ export declare const libraryModule: Elysia<"/v1/library", {
|
|
|
372
372
|
query: {};
|
|
373
373
|
headers: {};
|
|
374
374
|
response: {
|
|
375
|
-
200: import("@vestcards/shared").
|
|
375
|
+
200: import("@vestcards/shared").IArchivedLibraryItem[];
|
|
376
376
|
};
|
|
377
377
|
};
|
|
378
378
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IArchivedLibraryItem, IGroupedLibraryData } from '@vestcards/shared';
|
|
2
2
|
export declare abstract class LibraryService {
|
|
3
|
-
static getGroupedLibraryData(userId: string): Promise<
|
|
4
|
-
static getArchivedLibraryData(userId: string): Promise<
|
|
3
|
+
static getGroupedLibraryData(userId: string): Promise<IGroupedLibraryData>;
|
|
4
|
+
static getArchivedLibraryData(userId: string): Promise<IArchivedLibraryItem[]>;
|
|
5
5
|
static startDeckStudy(userId: string, deckId: string): Promise<void>;
|
|
6
6
|
static deleteDeckStudy(userId: string, deckId: string): Promise<void>;
|
|
7
7
|
static updateDeckStudySuspended(userId: string, deckId: string, suspended: boolean): Promise<void>;
|
|
@@ -361,7 +361,7 @@ export declare const studyModule: Elysia<"/v1/study", {
|
|
|
361
361
|
};
|
|
362
362
|
headers: {};
|
|
363
363
|
response: {
|
|
364
|
-
200: import("
|
|
364
|
+
200: import("@vestcards/shared").ISessionData;
|
|
365
365
|
422: {
|
|
366
366
|
type: "validation";
|
|
367
367
|
on: string;
|
|
@@ -389,7 +389,7 @@ export declare const studyModule: Elysia<"/v1/study", {
|
|
|
389
389
|
};
|
|
390
390
|
headers: {};
|
|
391
391
|
response: {
|
|
392
|
-
200: import("@vestcards/shared").
|
|
392
|
+
200: import("@vestcards/shared").IStudyStats | {
|
|
393
393
|
status: import("@vestcards/shared").StudyStatus;
|
|
394
394
|
review: number;
|
|
395
395
|
learning: number;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import type { ISessionData, IStudyStats, StudyType } from '@vestcards/shared';
|
|
1
2
|
import { type CardReview } from '../../db/schema/deck';
|
|
2
|
-
import type { SessionData, SessionStats, StudyType } from '../../types/study';
|
|
3
3
|
import type { StudyModel } from './model';
|
|
4
4
|
export declare abstract class StudyService {
|
|
5
|
-
static getSessionData(userId: string, type: StudyType, id?: string): Promise<
|
|
5
|
+
static getSessionData(userId: string, type: StudyType, id?: string): Promise<ISessionData>;
|
|
6
6
|
static getNumberLeftToLearnToday(userId: string, date?: Date): Promise<number>;
|
|
7
7
|
static getStats(userId: string, numLeftToLearn: number, // capacity left today (from the function above)
|
|
8
|
-
type: StudyType, id?: string): Promise<
|
|
9
|
-
static getReviewCards(userId: string, type: StudyType, id?: string, maxToFetch?: number): Promise<import("
|
|
10
|
-
static getNewCards(userId: string, allocatedNewForToday: number, type: StudyType, id?: string): Promise<import("
|
|
8
|
+
type: StudyType, id?: string): Promise<IStudyStats>;
|
|
9
|
+
static getReviewCards(userId: string, type: StudyType, id?: string, maxToFetch?: number): Promise<import("@vestcards/shared").ISessionCard[]>;
|
|
10
|
+
static getNewCards(userId: string, allocatedNewForToday: number, type: StudyType, id?: string): Promise<import("@vestcards/shared").ISessionCard[]>;
|
|
11
11
|
static getUserDeckStudy(userId: string, deckId: string): Promise<{
|
|
12
12
|
suspended: boolean;
|
|
13
13
|
id: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { SessionCard, StudyType } from 'src/types/study';
|
|
1
|
+
import type { ISessionCard, IStudyStats, StudyStatus, StudyType } from '@vestcards/shared';
|
|
3
2
|
import type { SessionCardSelect } from 'src/utils/select';
|
|
4
3
|
export declare const getSessionFilterByStudyType: (type: StudyType, id?: string) => import("drizzle-orm").SQL<unknown> | undefined;
|
|
5
4
|
export declare const allocateByPriority: (capacityLeft: number, counts: {
|
|
@@ -12,7 +11,7 @@ export declare const allocateByPriority: (capacityLeft: number, counts: {
|
|
|
12
11
|
new: number;
|
|
13
12
|
total: number;
|
|
14
13
|
};
|
|
15
|
-
export declare function getStudyStatus(stats:
|
|
14
|
+
export declare function getStudyStatus(stats: IStudyStats, userDeckStudy: {
|
|
16
15
|
suspended: boolean;
|
|
17
16
|
} | undefined): StudyStatus;
|
|
18
|
-
export declare function sessionCardToICard(sessionRows: SessionCardSelect[]):
|
|
17
|
+
export declare function sessionCardToICard(sessionRows: SessionCardSelect[]): ISessionCard[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Subject } from '@vestcards/shared';
|
|
2
|
-
import {
|
|
2
|
+
import type { CardReview } from '../db/schema/deck';
|
|
3
3
|
export declare const sessionCardSelect: {
|
|
4
4
|
card: {
|
|
5
5
|
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
@@ -364,7 +364,7 @@ export type SessionCardSelect = {
|
|
|
364
364
|
subject: Subject;
|
|
365
365
|
topicName: string;
|
|
366
366
|
userDeckStudyId: string;
|
|
367
|
-
cardReview:
|
|
367
|
+
cardReview: Omit<CardReview, 'cardId' | 'userDeckStudyId'> | null;
|
|
368
368
|
};
|
|
369
369
|
export declare const statsSelect: {
|
|
370
370
|
new: import("drizzle-orm").SQL<number>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare enum ReviewState {
|
|
2
|
+
New = "New",
|
|
3
|
+
Learning = "Learning",
|
|
4
|
+
Review = "Review",
|
|
5
|
+
Relearning = "Relearning"
|
|
6
|
+
}
|
|
7
|
+
export declare const reviewStates: readonly ["New", "Learning", "Review", "Relearning"];
|
|
8
|
+
export type ReviewStateType = keyof typeof ReviewState;
|
|
9
|
+
export declare enum ReviewRating {
|
|
10
|
+
Manual = "Manual",
|
|
11
|
+
Again = "Again",
|
|
12
|
+
Hard = "Hard",
|
|
13
|
+
Good = "Good",
|
|
14
|
+
Easy = "Easy"
|
|
15
|
+
}
|
|
16
|
+
export declare const reviewRatings: readonly ["Manual", "Again", "Hard", "Good", "Easy"];
|
|
17
|
+
export type ReviewRatingType = keyof typeof ReviewRating;
|
|
@@ -1,29 +1,63 @@
|
|
|
1
|
+
import type { ICard, Subject } from './deck';
|
|
2
|
+
import type { ReviewRating, ReviewState } from './fsrs';
|
|
1
3
|
export type StudyType = 'ALL' | 'DECK' | 'TOPIC' | 'SUBJECT';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
export interface ICardReview {
|
|
5
|
+
id: string;
|
|
6
|
+
due: Date | null;
|
|
7
|
+
stability: number;
|
|
8
|
+
difficulty: number;
|
|
9
|
+
elapsedDays: number;
|
|
10
|
+
scheduledDays: number;
|
|
11
|
+
reps: number;
|
|
12
|
+
lapses: number;
|
|
13
|
+
state: ReviewState;
|
|
14
|
+
lastReview: Date | null;
|
|
15
|
+
userDeckStudyId: string;
|
|
16
|
+
cardId: string;
|
|
17
|
+
}
|
|
18
|
+
export interface IReviewLog {
|
|
19
|
+
id: number;
|
|
20
|
+
cardReviewId: string;
|
|
21
|
+
grade: ReviewRating;
|
|
22
|
+
state: ReviewState;
|
|
23
|
+
due: Date;
|
|
24
|
+
stability: number;
|
|
25
|
+
difficulty: number;
|
|
26
|
+
elapsedDays: number;
|
|
27
|
+
lastElapsedDays: number;
|
|
28
|
+
scheduledDays: number;
|
|
29
|
+
review: Date;
|
|
30
|
+
duration: number;
|
|
31
|
+
}
|
|
32
|
+
export interface ISessionCard {
|
|
33
|
+
card: ICard;
|
|
34
|
+
cardReview: ICardReview;
|
|
35
|
+
subject: Subject;
|
|
36
|
+
topicName: string;
|
|
37
|
+
userDeckStudyId: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ISessionData {
|
|
40
|
+
reviewCards: ISessionCard[];
|
|
41
|
+
newCards: ISessionCard[];
|
|
42
|
+
stats: IStudyStats;
|
|
43
|
+
}
|
|
44
|
+
export interface IStudyStats {
|
|
5
45
|
review: number;
|
|
6
46
|
learning: number;
|
|
7
47
|
new: number;
|
|
8
48
|
total: number;
|
|
9
49
|
}
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
userDeckStudyId: string;
|
|
13
|
-
grade: Rating;
|
|
14
|
-
reviewDurationInSeconds: number;
|
|
15
|
-
}
|
|
16
|
-
export interface GroupedLibraryItem {
|
|
50
|
+
export type StudyStatus = 'not-started' | 'suspended' | 'has-cards' | 'no-cards';
|
|
51
|
+
export interface IGroupedLibraryItem {
|
|
17
52
|
name: string;
|
|
18
53
|
id: string;
|
|
19
54
|
ownerId?: string;
|
|
20
55
|
type: StudyType;
|
|
21
|
-
stats:
|
|
22
|
-
subRows?:
|
|
56
|
+
stats: IStudyStats;
|
|
57
|
+
subRows?: IGroupedLibraryItem[];
|
|
23
58
|
}
|
|
24
|
-
export type
|
|
25
|
-
export
|
|
26
|
-
export interface ArchivedLibraryItem {
|
|
59
|
+
export type IGroupedLibraryData = IGroupedLibraryItem[];
|
|
60
|
+
export interface IArchivedLibraryItem {
|
|
27
61
|
deckId: string;
|
|
28
62
|
subject: string;
|
|
29
63
|
topic: string;
|
package/package.json
CHANGED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { Subject } from '@vestcards/shared';
|
|
2
|
-
import type { CardReview } from 'src/db/schema/deck';
|
|
3
|
-
export type { CardState, GradeCardInput, Rating, SessionStats, StudyStatus, StudyType } from '@vestcards/shared';
|
|
4
|
-
export interface ICard {
|
|
5
|
-
id: string;
|
|
6
|
-
question: string;
|
|
7
|
-
answer: string | null;
|
|
8
|
-
frontImage?: {
|
|
9
|
-
id: string;
|
|
10
|
-
url: string;
|
|
11
|
-
};
|
|
12
|
-
backImage?: {
|
|
13
|
-
id: string;
|
|
14
|
-
url: string;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export type SessionCard = {
|
|
18
|
-
card: ICard;
|
|
19
|
-
card_review: CardReview;
|
|
20
|
-
subject: Subject;
|
|
21
|
-
topicName: string;
|
|
22
|
-
userDeckStudyId: string;
|
|
23
|
-
};
|
|
24
|
-
export interface SessionData {
|
|
25
|
-
reviewCards: SessionCard[];
|
|
26
|
-
newCards: SessionCard[];
|
|
27
|
-
stats: import('@vestcards/shared').SessionStats;
|
|
28
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { Topic } from '@vestcards/shared';
|