@vue-skuilder/db 0.1.11 → 0.1.12
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/core/index.d.mts +7 -6
- package/dist/core/index.d.ts +7 -6
- package/dist/core/index.js +146 -37
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +146 -37
- package/dist/core/index.mjs.map +1 -1
- package/dist/{dataLayerProvider-VieuAAkV.d.mts → dataLayerProvider-BiP3kWix.d.mts} +1 -1
- package/dist/{dataLayerProvider-juuqUHOP.d.ts → dataLayerProvider-DSdeyRT3.d.ts} +1 -1
- package/dist/impl/couch/index.d.mts +3 -3
- package/dist/impl/couch/index.d.ts +3 -3
- package/dist/impl/couch/index.js +146 -37
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +146 -37
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.d.mts +14 -6
- package/dist/impl/static/index.d.ts +14 -6
- package/dist/impl/static/index.js +147 -39
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +147 -39
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/{index-DZyxHCcf.d.mts → index-Bmll7Xse.d.mts} +1 -1
- package/dist/{index-CWY6yhkV.d.ts → index-CD8BZz2k.d.ts} +1 -1
- package/dist/index.d.mts +119 -24
- package/dist/index.d.ts +119 -24
- package/dist/index.js +785 -261
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +789 -265
- package/dist/index.mjs.map +1 -1
- package/dist/{types-DtoI27Xh.d.ts → types-CewsN87z.d.ts} +1 -1
- package/dist/{types-Che4wTwA.d.mts → types-Dbp5DaRR.d.mts} +1 -1
- package/dist/{types-legacy-B8ahaCbj.d.mts → types-legacy-6ettoclI.d.mts} +13 -2
- package/dist/{types-legacy-B8ahaCbj.d.ts → types-legacy-6ettoclI.d.ts} +13 -2
- package/dist/{userDB-DJ8HMw83.d.mts → userDB-C4yyAnpp.d.mts} +3 -3
- package/dist/{userDB-B7zTQ123.d.ts → userDB-CD6s6ZCp.d.ts} +3 -3
- package/dist/util/packer/index.d.mts +3 -3
- package/dist/util/packer/index.d.ts +3 -3
- package/package.json +3 -3
- package/src/core/navigators/hardcodedOrder.ts +64 -0
- package/src/core/navigators/index.ts +1 -0
- package/src/core/types/contentNavigationStrategy.ts +2 -1
- package/src/core/types/types-legacy.ts +2 -2
- package/src/impl/common/BaseUserDB.ts +15 -11
- package/src/impl/couch/courseDB.ts +74 -27
- package/src/impl/couch/updateQueue.ts +8 -3
- package/src/impl/static/StaticDataLayerProvider.ts +57 -17
- package/src/impl/static/courseDB.ts +17 -12
- package/src/impl/static/coursesDB.ts +10 -6
- package/src/study/ItemQueue.ts +58 -0
- package/src/study/SessionController.ts +132 -178
- package/src/study/services/CardHydrationService.ts +153 -0
- package/src/study/services/EloService.ts +85 -0
- package/src/study/services/ResponseProcessor.ts +224 -0
- package/src/study/services/SrsService.ts +44 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PackerConfig, a as PackedCourseData, S as StaticCourseManifest } from './types-
|
|
1
|
+
import { P as PackerConfig, a as PackedCourseData, S as StaticCourseManifest } from './types-Dbp5DaRR.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Abstraction for file system operations needed by the migrator.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PackerConfig, a as PackedCourseData, S as StaticCourseManifest } from './types-
|
|
1
|
+
import { P as PackerConfig, a as PackedCourseData, S as StaticCourseManifest } from './types-CewsN87z.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Abstraction for file system operations needed by the migrator.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,17 +1,90 @@
|
|
|
1
|
-
import { k as StudySessionItem, i as StudyContentSource } from './userDB-
|
|
2
|
-
export {
|
|
3
|
-
import { D as DataLayerProvider } from './dataLayerProvider-
|
|
4
|
-
import { C as CardRecord } from './types-legacy-
|
|
5
|
-
export {
|
|
1
|
+
import { U as UserDBInterface, r as CourseRegistrationDoc, k as StudySessionItem, i as StudyContentSource } from './userDB-C4yyAnpp.mjs';
|
|
2
|
+
export { H as ActivityRecord, A as AdminDBInterface, u as AssignedCard, h as AssignedContent, t as AssignedCourse, s as AssignedTag, c as ClassroomDBInterface, E as ClassroomRegistration, B as ClassroomRegistrationDesignation, F as ClassroomRegistrationDoc, p as ContentSourceID, C as CourseDBInterface, d as CourseInfo, I as CourseRegistration, b as CoursesDBInterface, J as DocumentUpdater, g as ScheduledCard, j as StudentClassroomDBInterface, l as StudySessionFailedItem, m as StudySessionFailedNewItem, n as StudySessionFailedReviewItem, S as StudySessionNewItem, f as StudySessionReviewItem, T as TeacherClassroomDBInterface, G as UserConfig, y as UserCourseSetting, x as UserCourseSettings, w as UserDBAuthenticator, a as UserDBReader, v as UserDBWriter, z as UsrCrsDataInterface, q as getStudySource, o as isReview, K as newInterval } from './userDB-C4yyAnpp.mjs';
|
|
3
|
+
import { D as DataLayerProvider } from './dataLayerProvider-BiP3kWix.mjs';
|
|
4
|
+
import { C as CardHistory, c as CardRecord } from './types-legacy-6ettoclI.mjs';
|
|
5
|
+
export { d as CardData, e as CourseListData, g as DataShapeData, f as DisplayableData, D as DocType, b as DocTypePrefixes, F as Field, G as GuestUsername, Q as QualifiedCardID, h as QuestionData, i as QuestionRecord, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from './types-legacy-6ettoclI.mjs';
|
|
6
6
|
import { Loggable } from './core/index.mjs';
|
|
7
7
|
export { BulkCardProcessorConfig, ContentNavigator, ImportResult, Navigators, areQuestionRecords, docIsDeleted, getCardHistoryID, importParsedCards, isQuestionRecord, parseCardHistoryID, validateProcessorConfig } from './core/index.mjs';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
import { S as StaticCourseManifest } from './types-Dbp5DaRR.mjs';
|
|
9
|
+
export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-Dbp5DaRR.mjs';
|
|
10
|
+
import { F as FileSystemAdapter } from './index-Bmll7Xse.mjs';
|
|
11
|
+
export { C as CouchDBToStaticPacker, a as FileStats, b as FileSystemError } from './index-Bmll7Xse.mjs';
|
|
12
|
+
import '@vue-skuilder/common';
|
|
13
13
|
import 'moment';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Service responsible for ELO rating calculations and updates.
|
|
17
|
+
*/
|
|
18
|
+
declare class EloService {
|
|
19
|
+
private dataLayer;
|
|
20
|
+
private user;
|
|
21
|
+
constructor(dataLayer: DataLayerProvider, user: UserDBInterface);
|
|
22
|
+
/**
|
|
23
|
+
* Updates both user and card ELO ratings based on user performance.
|
|
24
|
+
* @param userScore Score between 0-1 representing user performance
|
|
25
|
+
* @param course_id Course identifier
|
|
26
|
+
* @param card_id Card identifier
|
|
27
|
+
* @param userCourseRegDoc User's course registration document (will be mutated)
|
|
28
|
+
* @param currentCard Current card session record
|
|
29
|
+
* @param k Optional K-factor for ELO calculation
|
|
30
|
+
*/
|
|
31
|
+
updateUserAndCardElo(userScore: number, course_id: string, card_id: string, userCourseRegDoc: CourseRegistrationDoc, currentCard: StudySessionRecord, k?: number): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Service responsible for Spaced Repetition System (SRS) scheduling logic.
|
|
36
|
+
*/
|
|
37
|
+
declare class SrsService {
|
|
38
|
+
private user;
|
|
39
|
+
constructor(user: UserDBInterface);
|
|
40
|
+
/**
|
|
41
|
+
* Calculates the next review time for a card based on its history and
|
|
42
|
+
* schedules it in the user's database.
|
|
43
|
+
* @param history The full history of the card.
|
|
44
|
+
* @param item The study session item, used to determine if a previous review needs to be cleared.
|
|
45
|
+
*/
|
|
46
|
+
scheduleReview(history: CardHistory<CardRecord>, item: StudySessionItem): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Service responsible for orchestrating the complete response processing workflow.
|
|
51
|
+
* Coordinates SRS scheduling and ELO updates for user card interactions.
|
|
52
|
+
*/
|
|
53
|
+
declare class ResponseProcessor {
|
|
54
|
+
private srsService;
|
|
55
|
+
private eloService;
|
|
56
|
+
constructor(srsService: SrsService, eloService: EloService);
|
|
57
|
+
/**
|
|
58
|
+
* Processes a user's response to a card, handling SRS scheduling and ELO updates.
|
|
59
|
+
* @param cardRecord User's response record
|
|
60
|
+
* @param cardHistory Promise resolving to the card's history
|
|
61
|
+
* @param studySessionItem Current study session item
|
|
62
|
+
* @param courseRegistrationDoc User's course registration (for ELO updates)
|
|
63
|
+
* @param currentCard Current study session record
|
|
64
|
+
* @param courseId Course identifier
|
|
65
|
+
* @param cardId Card identifier
|
|
66
|
+
* @param maxAttemptsPerView Maximum attempts allowed per view
|
|
67
|
+
* @param maxSessionViews Maximum session views for this card
|
|
68
|
+
* @param sessionViews Current number of session views
|
|
69
|
+
* @returns ResponseResult with navigation and UI instructions
|
|
70
|
+
*/
|
|
71
|
+
processResponse(cardRecord: CardRecord, cardHistory: Promise<CardHistory<CardRecord>>, studySessionItem: StudySessionItem, courseRegistrationDoc: CourseRegistrationDoc, currentCard: StudySessionRecord, courseId: string, cardId: string, maxAttemptsPerView: number, maxSessionViews: number, sessionViews: number): Promise<ResponseResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Handles processing for correct responses: SRS scheduling and ELO updates.
|
|
74
|
+
*/
|
|
75
|
+
private processCorrectResponse;
|
|
76
|
+
/**
|
|
77
|
+
* Handles processing for incorrect responses: ELO updates only.
|
|
78
|
+
*/
|
|
79
|
+
private processIncorrectResponse;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface HydratedCard<TView = unknown> {
|
|
83
|
+
item: StudySessionItem;
|
|
84
|
+
view: TView;
|
|
85
|
+
data: any[];
|
|
86
|
+
}
|
|
87
|
+
|
|
15
88
|
interface MigrationOptions {
|
|
16
89
|
chunkBatchSize: number;
|
|
17
90
|
validateRoundTrip: boolean;
|
|
@@ -203,25 +276,31 @@ interface StudySessionRecord {
|
|
|
203
276
|
item: StudySessionItem;
|
|
204
277
|
records: CardRecord[];
|
|
205
278
|
}
|
|
206
|
-
interface HydratedCard<TView = unknown> {
|
|
207
|
-
item: StudySessionItem;
|
|
208
|
-
view: TView;
|
|
209
|
-
data: ViewData[];
|
|
210
|
-
}
|
|
211
279
|
|
|
280
|
+
type SessionAction = 'dismiss-success' | 'dismiss-failed' | 'marked-failed' | 'dismiss-error';
|
|
281
|
+
interface ResponseResult {
|
|
282
|
+
nextCardAction: Exclude<SessionAction, 'dismiss-error'> | 'none';
|
|
283
|
+
shouldLoadNextCard: boolean;
|
|
284
|
+
isCorrect: boolean;
|
|
285
|
+
performanceScore?: number;
|
|
286
|
+
shouldClearFeedbackShadow: boolean;
|
|
287
|
+
}
|
|
288
|
+
interface SessionServices {
|
|
289
|
+
response: ResponseProcessor;
|
|
290
|
+
}
|
|
212
291
|
declare class SessionController<TView = unknown> extends Loggable {
|
|
213
292
|
_className: string;
|
|
293
|
+
services: SessionServices;
|
|
294
|
+
private srsService;
|
|
295
|
+
private eloService;
|
|
296
|
+
private hydrationService;
|
|
214
297
|
private sources;
|
|
215
|
-
private dataLayer;
|
|
216
|
-
private getViewComponent;
|
|
217
298
|
private _sessionRecord;
|
|
218
299
|
set sessionRecord(r: StudySessionRecord[]);
|
|
300
|
+
private _currentCard;
|
|
219
301
|
private reviewQ;
|
|
220
302
|
private newQ;
|
|
221
303
|
private failedQ;
|
|
222
|
-
private hydratedQ;
|
|
223
|
-
private _currentCard;
|
|
224
|
-
private hydration_in_progress;
|
|
225
304
|
private startTime;
|
|
226
305
|
private endTime;
|
|
227
306
|
private _secondsRemaining;
|
|
@@ -255,11 +334,27 @@ declare class SessionController<TView = unknown> extends Loggable {
|
|
|
255
334
|
private getScheduledReviews;
|
|
256
335
|
private getNewCards;
|
|
257
336
|
private _selectNextItemToHydrate;
|
|
258
|
-
nextCard(action?:
|
|
337
|
+
nextCard(action?: SessionAction): Promise<HydratedCard<TView> | null>;
|
|
338
|
+
/**
|
|
339
|
+
* Public API for processing user responses to cards.
|
|
340
|
+
* @param cardRecord User's response record
|
|
341
|
+
* @param cardHistory Promise resolving to the card's history
|
|
342
|
+
* @param courseRegistrationDoc User's course registration document
|
|
343
|
+
* @param currentCard Current study session record
|
|
344
|
+
* @param courseId Course identifier
|
|
345
|
+
* @param cardId Card identifier
|
|
346
|
+
* @param maxAttemptsPerView Maximum attempts allowed per view
|
|
347
|
+
* @param maxSessionViews Maximum session views for this card
|
|
348
|
+
* @param sessionViews Current number of session views
|
|
349
|
+
* @returns ResponseResult with navigation and UI instructions
|
|
350
|
+
*/
|
|
351
|
+
submitResponse(cardRecord: CardRecord, cardHistory: Promise<CardHistory<CardRecord>>, courseRegistrationDoc: CourseRegistrationDoc, currentCard: StudySessionRecord, courseId: string, cardId: string, maxAttemptsPerView: number, maxSessionViews: number, sessionViews: number): Promise<ResponseResult>;
|
|
259
352
|
private dismissCurrentCard;
|
|
260
353
|
private hasAvailableCards;
|
|
261
|
-
|
|
262
|
-
|
|
354
|
+
/**
|
|
355
|
+
* Helper method for CardHydrationService to remove items from appropriate queue.
|
|
356
|
+
*/
|
|
357
|
+
private removeItemFromQueue;
|
|
263
358
|
}
|
|
264
359
|
|
|
265
360
|
interface CourseLookupDoc {
|
|
@@ -341,4 +436,4 @@ declare function getDataLayer(): DataLayerProvider;
|
|
|
341
436
|
*/
|
|
342
437
|
declare function _resetDataLayer(): Promise<void>;
|
|
343
438
|
|
|
344
|
-
export { type AggregatedDocument, type AttachmentUploadResult, CardRecord, CourseLookup, DEFAULT_MIGRATION_OPTIONS, type DataLayerConfig, DataLayerProvider, type DocumentCounts, ENV, FileSystemAdapter,
|
|
439
|
+
export { type AggregatedDocument, type AttachmentUploadResult, CardHistory, CardRecord, CourseLookup, CourseRegistrationDoc, DEFAULT_MIGRATION_OPTIONS, type DataLayerConfig, DataLayerProvider, type DocumentCounts, ENV, FileSystemAdapter, Loggable, type MigrationOptions, type MigrationResult, NOT_SET, type ResponseResult, type RestoreProgress, type SessionAction, SessionController, StaticCourseManifest, type StaticCourseValidation, StaticToCouchDBMigrator, StudyContentSource, StudySessionItem, type StudySessionRecord, UserDBInterface, type ValidationIssue, type ValidationResult, _resetDataLayer, ensureAppDataDirectory, getAppDataDirectory, getDataLayer, getDbPath, getLogFilePath, initializeDataDirectory, initializeDataLayer, initializeTuiLogging, logger, showUserError, showUserMessage, validateMigration, validateStaticCourse };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,90 @@
|
|
|
1
|
-
import { k as StudySessionItem, i as StudyContentSource } from './userDB-
|
|
2
|
-
export {
|
|
3
|
-
import { D as DataLayerProvider } from './dataLayerProvider-
|
|
4
|
-
import { C as CardRecord } from './types-legacy-
|
|
5
|
-
export {
|
|
1
|
+
import { U as UserDBInterface, r as CourseRegistrationDoc, k as StudySessionItem, i as StudyContentSource } from './userDB-CD6s6ZCp.js';
|
|
2
|
+
export { H as ActivityRecord, A as AdminDBInterface, u as AssignedCard, h as AssignedContent, t as AssignedCourse, s as AssignedTag, c as ClassroomDBInterface, E as ClassroomRegistration, B as ClassroomRegistrationDesignation, F as ClassroomRegistrationDoc, p as ContentSourceID, C as CourseDBInterface, d as CourseInfo, I as CourseRegistration, b as CoursesDBInterface, J as DocumentUpdater, g as ScheduledCard, j as StudentClassroomDBInterface, l as StudySessionFailedItem, m as StudySessionFailedNewItem, n as StudySessionFailedReviewItem, S as StudySessionNewItem, f as StudySessionReviewItem, T as TeacherClassroomDBInterface, G as UserConfig, y as UserCourseSetting, x as UserCourseSettings, w as UserDBAuthenticator, a as UserDBReader, v as UserDBWriter, z as UsrCrsDataInterface, q as getStudySource, o as isReview, K as newInterval } from './userDB-CD6s6ZCp.js';
|
|
3
|
+
import { D as DataLayerProvider } from './dataLayerProvider-DSdeyRT3.js';
|
|
4
|
+
import { C as CardHistory, c as CardRecord } from './types-legacy-6ettoclI.js';
|
|
5
|
+
export { d as CardData, e as CourseListData, g as DataShapeData, f as DisplayableData, D as DocType, b as DocTypePrefixes, F as Field, G as GuestUsername, Q as QualifiedCardID, h as QuestionData, i as QuestionRecord, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from './types-legacy-6ettoclI.js';
|
|
6
6
|
import { Loggable } from './core/index.js';
|
|
7
7
|
export { BulkCardProcessorConfig, ContentNavigator, ImportResult, Navigators, areQuestionRecords, docIsDeleted, getCardHistoryID, importParsedCards, isQuestionRecord, parseCardHistoryID, validateProcessorConfig } from './core/index.js';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
import { S as StaticCourseManifest } from './types-CewsN87z.js';
|
|
9
|
+
export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-CewsN87z.js';
|
|
10
|
+
import { F as FileSystemAdapter } from './index-CD8BZz2k.js';
|
|
11
|
+
export { C as CouchDBToStaticPacker, a as FileStats, b as FileSystemError } from './index-CD8BZz2k.js';
|
|
12
|
+
import '@vue-skuilder/common';
|
|
13
13
|
import 'moment';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Service responsible for ELO rating calculations and updates.
|
|
17
|
+
*/
|
|
18
|
+
declare class EloService {
|
|
19
|
+
private dataLayer;
|
|
20
|
+
private user;
|
|
21
|
+
constructor(dataLayer: DataLayerProvider, user: UserDBInterface);
|
|
22
|
+
/**
|
|
23
|
+
* Updates both user and card ELO ratings based on user performance.
|
|
24
|
+
* @param userScore Score between 0-1 representing user performance
|
|
25
|
+
* @param course_id Course identifier
|
|
26
|
+
* @param card_id Card identifier
|
|
27
|
+
* @param userCourseRegDoc User's course registration document (will be mutated)
|
|
28
|
+
* @param currentCard Current card session record
|
|
29
|
+
* @param k Optional K-factor for ELO calculation
|
|
30
|
+
*/
|
|
31
|
+
updateUserAndCardElo(userScore: number, course_id: string, card_id: string, userCourseRegDoc: CourseRegistrationDoc, currentCard: StudySessionRecord, k?: number): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Service responsible for Spaced Repetition System (SRS) scheduling logic.
|
|
36
|
+
*/
|
|
37
|
+
declare class SrsService {
|
|
38
|
+
private user;
|
|
39
|
+
constructor(user: UserDBInterface);
|
|
40
|
+
/**
|
|
41
|
+
* Calculates the next review time for a card based on its history and
|
|
42
|
+
* schedules it in the user's database.
|
|
43
|
+
* @param history The full history of the card.
|
|
44
|
+
* @param item The study session item, used to determine if a previous review needs to be cleared.
|
|
45
|
+
*/
|
|
46
|
+
scheduleReview(history: CardHistory<CardRecord>, item: StudySessionItem): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Service responsible for orchestrating the complete response processing workflow.
|
|
51
|
+
* Coordinates SRS scheduling and ELO updates for user card interactions.
|
|
52
|
+
*/
|
|
53
|
+
declare class ResponseProcessor {
|
|
54
|
+
private srsService;
|
|
55
|
+
private eloService;
|
|
56
|
+
constructor(srsService: SrsService, eloService: EloService);
|
|
57
|
+
/**
|
|
58
|
+
* Processes a user's response to a card, handling SRS scheduling and ELO updates.
|
|
59
|
+
* @param cardRecord User's response record
|
|
60
|
+
* @param cardHistory Promise resolving to the card's history
|
|
61
|
+
* @param studySessionItem Current study session item
|
|
62
|
+
* @param courseRegistrationDoc User's course registration (for ELO updates)
|
|
63
|
+
* @param currentCard Current study session record
|
|
64
|
+
* @param courseId Course identifier
|
|
65
|
+
* @param cardId Card identifier
|
|
66
|
+
* @param maxAttemptsPerView Maximum attempts allowed per view
|
|
67
|
+
* @param maxSessionViews Maximum session views for this card
|
|
68
|
+
* @param sessionViews Current number of session views
|
|
69
|
+
* @returns ResponseResult with navigation and UI instructions
|
|
70
|
+
*/
|
|
71
|
+
processResponse(cardRecord: CardRecord, cardHistory: Promise<CardHistory<CardRecord>>, studySessionItem: StudySessionItem, courseRegistrationDoc: CourseRegistrationDoc, currentCard: StudySessionRecord, courseId: string, cardId: string, maxAttemptsPerView: number, maxSessionViews: number, sessionViews: number): Promise<ResponseResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Handles processing for correct responses: SRS scheduling and ELO updates.
|
|
74
|
+
*/
|
|
75
|
+
private processCorrectResponse;
|
|
76
|
+
/**
|
|
77
|
+
* Handles processing for incorrect responses: ELO updates only.
|
|
78
|
+
*/
|
|
79
|
+
private processIncorrectResponse;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface HydratedCard<TView = unknown> {
|
|
83
|
+
item: StudySessionItem;
|
|
84
|
+
view: TView;
|
|
85
|
+
data: any[];
|
|
86
|
+
}
|
|
87
|
+
|
|
15
88
|
interface MigrationOptions {
|
|
16
89
|
chunkBatchSize: number;
|
|
17
90
|
validateRoundTrip: boolean;
|
|
@@ -203,25 +276,31 @@ interface StudySessionRecord {
|
|
|
203
276
|
item: StudySessionItem;
|
|
204
277
|
records: CardRecord[];
|
|
205
278
|
}
|
|
206
|
-
interface HydratedCard<TView = unknown> {
|
|
207
|
-
item: StudySessionItem;
|
|
208
|
-
view: TView;
|
|
209
|
-
data: ViewData[];
|
|
210
|
-
}
|
|
211
279
|
|
|
280
|
+
type SessionAction = 'dismiss-success' | 'dismiss-failed' | 'marked-failed' | 'dismiss-error';
|
|
281
|
+
interface ResponseResult {
|
|
282
|
+
nextCardAction: Exclude<SessionAction, 'dismiss-error'> | 'none';
|
|
283
|
+
shouldLoadNextCard: boolean;
|
|
284
|
+
isCorrect: boolean;
|
|
285
|
+
performanceScore?: number;
|
|
286
|
+
shouldClearFeedbackShadow: boolean;
|
|
287
|
+
}
|
|
288
|
+
interface SessionServices {
|
|
289
|
+
response: ResponseProcessor;
|
|
290
|
+
}
|
|
212
291
|
declare class SessionController<TView = unknown> extends Loggable {
|
|
213
292
|
_className: string;
|
|
293
|
+
services: SessionServices;
|
|
294
|
+
private srsService;
|
|
295
|
+
private eloService;
|
|
296
|
+
private hydrationService;
|
|
214
297
|
private sources;
|
|
215
|
-
private dataLayer;
|
|
216
|
-
private getViewComponent;
|
|
217
298
|
private _sessionRecord;
|
|
218
299
|
set sessionRecord(r: StudySessionRecord[]);
|
|
300
|
+
private _currentCard;
|
|
219
301
|
private reviewQ;
|
|
220
302
|
private newQ;
|
|
221
303
|
private failedQ;
|
|
222
|
-
private hydratedQ;
|
|
223
|
-
private _currentCard;
|
|
224
|
-
private hydration_in_progress;
|
|
225
304
|
private startTime;
|
|
226
305
|
private endTime;
|
|
227
306
|
private _secondsRemaining;
|
|
@@ -255,11 +334,27 @@ declare class SessionController<TView = unknown> extends Loggable {
|
|
|
255
334
|
private getScheduledReviews;
|
|
256
335
|
private getNewCards;
|
|
257
336
|
private _selectNextItemToHydrate;
|
|
258
|
-
nextCard(action?:
|
|
337
|
+
nextCard(action?: SessionAction): Promise<HydratedCard<TView> | null>;
|
|
338
|
+
/**
|
|
339
|
+
* Public API for processing user responses to cards.
|
|
340
|
+
* @param cardRecord User's response record
|
|
341
|
+
* @param cardHistory Promise resolving to the card's history
|
|
342
|
+
* @param courseRegistrationDoc User's course registration document
|
|
343
|
+
* @param currentCard Current study session record
|
|
344
|
+
* @param courseId Course identifier
|
|
345
|
+
* @param cardId Card identifier
|
|
346
|
+
* @param maxAttemptsPerView Maximum attempts allowed per view
|
|
347
|
+
* @param maxSessionViews Maximum session views for this card
|
|
348
|
+
* @param sessionViews Current number of session views
|
|
349
|
+
* @returns ResponseResult with navigation and UI instructions
|
|
350
|
+
*/
|
|
351
|
+
submitResponse(cardRecord: CardRecord, cardHistory: Promise<CardHistory<CardRecord>>, courseRegistrationDoc: CourseRegistrationDoc, currentCard: StudySessionRecord, courseId: string, cardId: string, maxAttemptsPerView: number, maxSessionViews: number, sessionViews: number): Promise<ResponseResult>;
|
|
259
352
|
private dismissCurrentCard;
|
|
260
353
|
private hasAvailableCards;
|
|
261
|
-
|
|
262
|
-
|
|
354
|
+
/**
|
|
355
|
+
* Helper method for CardHydrationService to remove items from appropriate queue.
|
|
356
|
+
*/
|
|
357
|
+
private removeItemFromQueue;
|
|
263
358
|
}
|
|
264
359
|
|
|
265
360
|
interface CourseLookupDoc {
|
|
@@ -341,4 +436,4 @@ declare function getDataLayer(): DataLayerProvider;
|
|
|
341
436
|
*/
|
|
342
437
|
declare function _resetDataLayer(): Promise<void>;
|
|
343
438
|
|
|
344
|
-
export { type AggregatedDocument, type AttachmentUploadResult, CardRecord, CourseLookup, DEFAULT_MIGRATION_OPTIONS, type DataLayerConfig, DataLayerProvider, type DocumentCounts, ENV, FileSystemAdapter,
|
|
439
|
+
export { type AggregatedDocument, type AttachmentUploadResult, CardHistory, CardRecord, CourseLookup, CourseRegistrationDoc, DEFAULT_MIGRATION_OPTIONS, type DataLayerConfig, DataLayerProvider, type DocumentCounts, ENV, FileSystemAdapter, Loggable, type MigrationOptions, type MigrationResult, NOT_SET, type ResponseResult, type RestoreProgress, type SessionAction, SessionController, StaticCourseManifest, type StaticCourseValidation, StaticToCouchDBMigrator, StudyContentSource, StudySessionItem, type StudySessionRecord, UserDBInterface, type ValidationIssue, type ValidationResult, _resetDataLayer, ensureAppDataDirectory, getAppDataDirectory, getDataLayer, getDbPath, getLogFilePath, initializeDataDirectory, initializeDataLayer, initializeTuiLogging, logger, showUserError, showUserMessage, validateMigration, validateStaticCourse };
|