@vue-skuilder/db 0.1.20 → 0.1.22
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/CLAUDE.md +2 -2
- package/dist/{classroomDB-CZdMBiTU.d.ts → contentSource-BP9hznNV.d.ts} +150 -196
- package/dist/{classroomDB-PxDZTky3.d.cts → contentSource-DsJadoBU.d.cts} +150 -196
- package/dist/core/index.d.cts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +615 -1758
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +579 -1727
- package/dist/core/index.mjs.map +1 -1
- package/dist/{dataLayerProvider-D8o6ZnKW.d.ts → dataLayerProvider-CHYrQ5pB.d.cts} +1 -1
- package/dist/{dataLayerProvider-D0MoZMjH.d.cts → dataLayerProvider-MDTxXq2l.d.ts} +1 -1
- package/dist/impl/couch/index.d.cts +6 -22
- package/dist/impl/couch/index.d.ts +6 -22
- package/dist/impl/couch/index.js +598 -1769
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +579 -1755
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.d.cts +22 -6
- package/dist/impl/static/index.d.ts +22 -6
- package/dist/impl/static/index.js +617 -1629
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +607 -1624
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/index.d.cts +64 -56
- package/dist/index.d.ts +64 -56
- package/dist/index.js +1000 -2161
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +970 -2127
- package/dist/index.mjs.map +1 -1
- package/dist/pouch/index.js +3 -0
- package/dist/pouch/index.js.map +1 -1
- package/dist/pouch/index.mjs +3 -0
- package/dist/pouch/index.mjs.map +1 -1
- package/docs/navigators-architecture.md +2 -9
- package/package.json +3 -3
- package/src/core/interfaces/classroomDB.ts +5 -13
- package/src/core/interfaces/contentSource.ts +6 -66
- package/src/core/interfaces/courseDB.ts +2 -7
- package/src/core/navigators/Pipeline.ts +24 -53
- package/src/core/navigators/PipelineAssembler.ts +1 -1
- package/src/core/navigators/defaults.ts +84 -0
- package/src/core/navigators/{hierarchyDefinition.ts → filters/hierarchyDefinition.ts} +11 -25
- package/src/core/navigators/{interferenceMitigator.ts → filters/interferenceMitigator.ts} +10 -24
- package/src/core/navigators/{relativePriority.ts → filters/relativePriority.ts} +10 -24
- package/src/core/navigators/filters/userTagPreference.ts +1 -16
- package/src/core/navigators/{CompositeGenerator.ts → generators/CompositeGenerator.ts} +15 -64
- package/src/core/navigators/{elo.ts → generators/elo.ts} +13 -63
- package/src/core/navigators/{srs.ts → generators/srs.ts} +11 -40
- package/src/core/navigators/generators/types.ts +1 -1
- package/src/core/navigators/index.ts +36 -91
- package/src/impl/couch/classroomDB.ts +100 -103
- package/src/impl/couch/courseDB.ts +5 -81
- package/src/impl/couch/pouchdb-setup.ts +7 -0
- package/src/impl/static/StaticDataUnpacker.ts +50 -1
- package/src/impl/static/courseDB.ts +76 -37
- package/src/study/SessionController.ts +122 -202
- package/src/study/SourceMixer.ts +65 -0
- package/src/study/TagFilteredContentSource.ts +49 -92
- package/src/study/index.ts +1 -0
- package/src/study/services/CardHydrationService.ts +165 -81
- package/src/util/dataDirectory.ts +1 -1
- package/src/util/index.ts +0 -1
- package/tests/core/navigators/CompositeGenerator.test.ts +44 -168
- package/tests/core/navigators/Pipeline.test.ts +5 -72
- package/tests/core/navigators/PipelineAssembler.test.ts +8 -58
- package/tests/core/navigators/navigators.test.ts +118 -151
- package/src/core/navigators/hardcodedOrder.ts +0 -163
- package/src/util/tuiLogger.ts +0 -139
- /package/src/core/navigators/{inferredPreference.ts → filters/inferredPreferenceStub.ts} +0 -0
- /package/src/core/navigators/{userGoal.ts → filters/userGoalStub.ts} +0 -0
package/CLAUDE.md
CHANGED
|
@@ -6,7 +6,7 @@ Database abstraction layer providing unified interfaces for CouchDB/PouchDB and
|
|
|
6
6
|
- Build: `yarn workspace @vue-skuilder/db build`
|
|
7
7
|
- Dev (watch): `yarn workspace @vue-skuilder/db dev`
|
|
8
8
|
- Lint: `yarn workspace @vue-skuilder/db lint:fix`
|
|
9
|
-
-
|
|
9
|
+
- Test: `yarn workspace @vue-skuilder/db test`
|
|
10
10
|
|
|
11
11
|
## Build System
|
|
12
12
|
Uses **tsup** for dual CommonJS/ESM output:
|
|
@@ -40,4 +40,4 @@ Multiple entry points for different use cases:
|
|
|
40
40
|
- **Provider Pattern**: Switchable backend implementations
|
|
41
41
|
- **Dual Export**: Works in both Node.js and browser environments
|
|
42
42
|
- **Type Safety**: Full TypeScript coverage with strict mode
|
|
43
|
-
- **Sync Strategy**: Configurable online/offline data synchronization
|
|
43
|
+
- **Sync Strategy**: Configurable online/offline data synchronization
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CourseConfig, ClassroomConfig,
|
|
1
|
+
import { CourseConfig, ClassroomConfig, Status, SkuilderCourseData as SkuilderCourseData$1, CourseElo, DataShape, TagFilter } from '@vue-skuilder/common';
|
|
2
2
|
import { Moment } from 'moment';
|
|
3
3
|
import { S as SkuilderCourseData, b as DocTypePrefixes, D as DocType, Q as QualifiedCardID, T as TagStub, a as Tag, C as CardHistory, c as CardRecord } from './types-legacy-DDY4N-Uq.js';
|
|
4
4
|
|
|
@@ -26,82 +26,63 @@ interface AdminDBInterface {
|
|
|
26
26
|
})[]>;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
firstSessionDate: string;
|
|
34
|
-
lastSessionDate: string;
|
|
35
|
-
signupPrompted: boolean;
|
|
36
|
-
promptDismissalCount: number;
|
|
37
|
-
studyModeAcknowledged: boolean;
|
|
38
|
-
}
|
|
39
|
-
interface UserConfig {
|
|
40
|
-
darkMode: boolean;
|
|
41
|
-
likesConfetti: boolean;
|
|
42
|
-
sessionTimeLimit: number;
|
|
43
|
-
email?: string;
|
|
44
|
-
sessionTracking?: Record<string, SessionTrackingData>;
|
|
45
|
-
}
|
|
46
|
-
interface ActivityRecord {
|
|
47
|
-
timeStamp: number | string;
|
|
48
|
-
[key: string]: any;
|
|
49
|
-
}
|
|
50
|
-
interface CourseRegistration {
|
|
51
|
-
status?: 'active' | 'dropped' | 'maintenance-mode' | 'preview';
|
|
52
|
-
courseID: string;
|
|
53
|
-
admin: boolean;
|
|
54
|
-
moderator: boolean;
|
|
55
|
-
user: boolean;
|
|
56
|
-
settings?: {
|
|
57
|
-
[setting: string]: string | number | boolean;
|
|
58
|
-
};
|
|
59
|
-
elo: number | CourseElo;
|
|
60
|
-
}
|
|
61
|
-
interface StudyWeights {
|
|
62
|
-
[courseID: string]: number;
|
|
63
|
-
}
|
|
64
|
-
interface CourseRegistrationDoc {
|
|
65
|
-
courses: CourseRegistration[];
|
|
66
|
-
studyWeight: StudyWeights;
|
|
67
|
-
}
|
|
68
|
-
interface ScheduledCard {
|
|
69
|
-
_id: PouchDB.Core.DocumentId;
|
|
29
|
+
/**
|
|
30
|
+
* Classroom management
|
|
31
|
+
*/
|
|
32
|
+
interface ClassroomDBInterface {
|
|
70
33
|
/**
|
|
71
|
-
*
|
|
34
|
+
* Get classroom config
|
|
72
35
|
*/
|
|
73
|
-
|
|
36
|
+
getConfig(): ClassroomConfig;
|
|
74
37
|
/**
|
|
75
|
-
*
|
|
38
|
+
* Get assigned content
|
|
76
39
|
*/
|
|
77
|
-
|
|
40
|
+
getAssignedContent(): Promise<AssignedContent[]>;
|
|
41
|
+
}
|
|
42
|
+
interface TeacherClassroomDBInterface extends ClassroomDBInterface {
|
|
78
43
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* (Should probably be UTC adjusted so that performance is
|
|
82
|
-
* not wonky across time zones)
|
|
83
|
-
*
|
|
84
|
-
* Note: Stored as ISO string for PouchDB serialization compatibility,
|
|
85
|
-
* but can be consumed as Moment objects via moment.utc(reviewTime)
|
|
44
|
+
* For teacher interfaces: assign content
|
|
86
45
|
*/
|
|
87
|
-
|
|
46
|
+
assignContent?(content: AssignedContent): Promise<boolean>;
|
|
88
47
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* Note: Stored as ISO string for PouchDB serialization compatibility,
|
|
92
|
-
* but can be consumed as Moment objects via moment.utc(scheduledAt)
|
|
48
|
+
* For teacher interfaces: remove content
|
|
93
49
|
*/
|
|
94
|
-
|
|
50
|
+
removeContent?(content: AssignedContent): Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Student-facing classroom interface.
|
|
54
|
+
* Content is accessed via StudyContentSource.getWeightedCards().
|
|
55
|
+
*/
|
|
56
|
+
type StudentClassroomDBInterface = ClassroomDBInterface;
|
|
57
|
+
type AssignedContent = AssignedCourse | AssignedTag | AssignedCard;
|
|
58
|
+
interface AssignedTag extends ContentBase {
|
|
59
|
+
type: 'tag';
|
|
60
|
+
tagID: string;
|
|
61
|
+
}
|
|
62
|
+
interface AssignedCourse extends ContentBase {
|
|
63
|
+
type: 'course';
|
|
64
|
+
}
|
|
65
|
+
interface AssignedCard extends ContentBase {
|
|
66
|
+
type: 'card';
|
|
67
|
+
cardID: string;
|
|
68
|
+
}
|
|
69
|
+
interface ContentBase {
|
|
70
|
+
type: 'course' | 'tag' | 'card';
|
|
95
71
|
/**
|
|
96
|
-
*
|
|
97
|
-
* user-registered course or by as assigned content from a
|
|
98
|
-
* user-registered classroom
|
|
72
|
+
* Username of the assigning teacher.
|
|
99
73
|
*/
|
|
100
|
-
|
|
74
|
+
assignedBy: string;
|
|
101
75
|
/**
|
|
102
|
-
*
|
|
76
|
+
* Date the content was assigned.
|
|
103
77
|
*/
|
|
104
|
-
|
|
78
|
+
assignedOn: moment.Moment;
|
|
79
|
+
/**
|
|
80
|
+
* A 'due' date for this assigned content, for scheduling content
|
|
81
|
+
* in advance. Content will not be actively pushed to students until
|
|
82
|
+
* this date.
|
|
83
|
+
*/
|
|
84
|
+
activeOn: moment.Moment;
|
|
85
|
+
courseID: string;
|
|
105
86
|
}
|
|
106
87
|
|
|
107
88
|
interface DataLayerResult {
|
|
@@ -178,7 +159,7 @@ interface CourseInfo {
|
|
|
178
159
|
cardCount: number;
|
|
179
160
|
registeredUsers: number;
|
|
180
161
|
}
|
|
181
|
-
interface CourseDBInterface extends NavigationStrategyManager {
|
|
162
|
+
interface CourseDBInterface extends NavigationStrategyManager, StudyContentSource {
|
|
182
163
|
/**
|
|
183
164
|
* Get course config
|
|
184
165
|
*/
|
|
@@ -207,10 +188,6 @@ interface CourseDBInterface extends NavigationStrategyManager {
|
|
|
207
188
|
* Update card ELO rating
|
|
208
189
|
*/
|
|
209
190
|
updateCardElo(cardId: string, elo: CourseElo): Promise<PouchDB.Core.Response>;
|
|
210
|
-
/**
|
|
211
|
-
* Get new cards for study
|
|
212
|
-
*/
|
|
213
|
-
getNewCards(limit?: number): Promise<StudySessionNewItem[]>;
|
|
214
191
|
/**
|
|
215
192
|
* Get cards centered at a particular ELO rating
|
|
216
193
|
*/
|
|
@@ -285,6 +262,84 @@ interface CourseDBInterface extends NavigationStrategyManager {
|
|
|
285
262
|
find(request: PouchDB.Find.FindRequest<any>): Promise<PouchDB.Find.FindResponse<any>>;
|
|
286
263
|
}
|
|
287
264
|
|
|
265
|
+
interface SessionTrackingData {
|
|
266
|
+
peekSessionCount: number;
|
|
267
|
+
studySessionCount: number;
|
|
268
|
+
sessionCount: number;
|
|
269
|
+
firstSessionDate: string;
|
|
270
|
+
lastSessionDate: string;
|
|
271
|
+
signupPrompted: boolean;
|
|
272
|
+
promptDismissalCount: number;
|
|
273
|
+
studyModeAcknowledged: boolean;
|
|
274
|
+
}
|
|
275
|
+
interface UserConfig {
|
|
276
|
+
darkMode: boolean;
|
|
277
|
+
likesConfetti: boolean;
|
|
278
|
+
sessionTimeLimit: number;
|
|
279
|
+
email?: string;
|
|
280
|
+
sessionTracking?: Record<string, SessionTrackingData>;
|
|
281
|
+
}
|
|
282
|
+
interface ActivityRecord {
|
|
283
|
+
timeStamp: number | string;
|
|
284
|
+
[key: string]: any;
|
|
285
|
+
}
|
|
286
|
+
interface CourseRegistration {
|
|
287
|
+
status?: 'active' | 'dropped' | 'maintenance-mode' | 'preview';
|
|
288
|
+
courseID: string;
|
|
289
|
+
admin: boolean;
|
|
290
|
+
moderator: boolean;
|
|
291
|
+
user: boolean;
|
|
292
|
+
settings?: {
|
|
293
|
+
[setting: string]: string | number | boolean;
|
|
294
|
+
};
|
|
295
|
+
elo: number | CourseElo;
|
|
296
|
+
}
|
|
297
|
+
interface StudyWeights {
|
|
298
|
+
[courseID: string]: number;
|
|
299
|
+
}
|
|
300
|
+
interface CourseRegistrationDoc {
|
|
301
|
+
courses: CourseRegistration[];
|
|
302
|
+
studyWeight: StudyWeights;
|
|
303
|
+
}
|
|
304
|
+
interface ScheduledCard {
|
|
305
|
+
_id: PouchDB.Core.DocumentId;
|
|
306
|
+
/**
|
|
307
|
+
* The docID of the card to be reviewed
|
|
308
|
+
*/
|
|
309
|
+
cardId: PouchDB.Core.DocumentId;
|
|
310
|
+
/**
|
|
311
|
+
* The ID of the course
|
|
312
|
+
*/
|
|
313
|
+
courseId: string;
|
|
314
|
+
/**
|
|
315
|
+
* The time at which the card becomes eligible for review.
|
|
316
|
+
*
|
|
317
|
+
* (Should probably be UTC adjusted so that performance is
|
|
318
|
+
* not wonky across time zones)
|
|
319
|
+
*
|
|
320
|
+
* Note: Stored as ISO string for PouchDB serialization compatibility,
|
|
321
|
+
* but can be consumed as Moment objects via moment.utc(reviewTime)
|
|
322
|
+
*/
|
|
323
|
+
reviewTime: string | Moment;
|
|
324
|
+
/**
|
|
325
|
+
* The time at which this scheduled event was created.
|
|
326
|
+
*
|
|
327
|
+
* Note: Stored as ISO string for PouchDB serialization compatibility,
|
|
328
|
+
* but can be consumed as Moment objects via moment.utc(scheduledAt)
|
|
329
|
+
*/
|
|
330
|
+
scheduledAt: string | Moment;
|
|
331
|
+
/**
|
|
332
|
+
* Classifying whether this card is scheduled on behalf of a
|
|
333
|
+
* user-registered course or by as assigned content from a
|
|
334
|
+
* user-registered classroom
|
|
335
|
+
*/
|
|
336
|
+
scheduledFor: 'course' | 'classroom';
|
|
337
|
+
/**
|
|
338
|
+
* The ID of the course or classroom that requested this card
|
|
339
|
+
*/
|
|
340
|
+
schedulingAgentId: string;
|
|
341
|
+
}
|
|
342
|
+
|
|
288
343
|
type Update<T> = Partial<T> | ((x: T) => T);
|
|
289
344
|
|
|
290
345
|
interface DocumentUpdater {
|
|
@@ -570,6 +625,12 @@ interface WeightedCard {
|
|
|
570
625
|
* Filters should use this instead of querying getAppliedTags() individually.
|
|
571
626
|
*/
|
|
572
627
|
tags?: string[];
|
|
628
|
+
/**
|
|
629
|
+
* Review document ID (_id from ScheduledCard).
|
|
630
|
+
* Present when this card originated from SRS review scheduling.
|
|
631
|
+
* Used by SessionController to track review outcomes and maintain review state.
|
|
632
|
+
*/
|
|
633
|
+
reviewID?: string;
|
|
573
634
|
}
|
|
574
635
|
/**
|
|
575
636
|
* Extract card origin from provenance trail.
|
|
@@ -585,7 +646,6 @@ declare function getCardOrigin(card: WeightedCard): 'new' | 'review' | 'failed';
|
|
|
585
646
|
declare enum Navigators {
|
|
586
647
|
ELO = "elo",
|
|
587
648
|
SRS = "srs",
|
|
588
|
-
HARDCODED = "hardcodedOrder",
|
|
589
649
|
HIERARCHY = "hierarchyDefinition",
|
|
590
650
|
INTERFERENCE = "interferenceMitigator",
|
|
591
651
|
RELATIVE_PRIORITY = "relativePriority",
|
|
@@ -631,9 +691,9 @@ declare function isFilter(impl: string): boolean;
|
|
|
631
691
|
*/
|
|
632
692
|
declare abstract class ContentNavigator implements StudyContentSource {
|
|
633
693
|
/** User interface for this navigation session */
|
|
634
|
-
protected user
|
|
694
|
+
protected user: UserDBInterface;
|
|
635
695
|
/** Course interface for this navigation session */
|
|
636
|
-
protected course
|
|
696
|
+
protected course: CourseDBInterface;
|
|
637
697
|
/** Human-readable name for this strategy instance (from ContentNavigationStrategyData.name) */
|
|
638
698
|
protected strategyName?: string;
|
|
639
699
|
/** Unique document ID for this strategy instance (from ContentNavigationStrategyData._id) */
|
|
@@ -642,7 +702,8 @@ declare abstract class ContentNavigator implements StudyContentSource {
|
|
|
642
702
|
* Constructor for standard navigators.
|
|
643
703
|
* Call this from subclass constructors to initialize common fields.
|
|
644
704
|
*
|
|
645
|
-
* Note: CompositeGenerator
|
|
705
|
+
* Note: CompositeGenerator and Pipeline call super() without args, then set
|
|
706
|
+
* user/course fields directly if needed.
|
|
646
707
|
*/
|
|
647
708
|
constructor(user?: UserDBInterface, course?: CourseDBInterface, strategyData?: ContentNavigationStrategyData);
|
|
648
709
|
/**
|
|
@@ -676,22 +737,6 @@ declare abstract class ContentNavigator implements StudyContentSource {
|
|
|
676
737
|
* @returns the runtime object used to steer a study session.
|
|
677
738
|
*/
|
|
678
739
|
static create(user: UserDBInterface, course: CourseDBInterface, strategyData: ContentNavigationStrategyData): Promise<ContentNavigator>;
|
|
679
|
-
/**
|
|
680
|
-
* Get cards scheduled for review.
|
|
681
|
-
*
|
|
682
|
-
* @deprecated This method is part of the legacy StudyContentSource interface.
|
|
683
|
-
* New strategies should focus on implementing CardGenerator.getWeightedCards() instead.
|
|
684
|
-
*/
|
|
685
|
-
abstract getPendingReviews(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
|
|
686
|
-
/**
|
|
687
|
-
* Get new cards for introduction.
|
|
688
|
-
*
|
|
689
|
-
* @deprecated This method is part of the legacy StudyContentSource interface.
|
|
690
|
-
* New strategies should focus on implementing CardGenerator.getWeightedCards() instead.
|
|
691
|
-
*
|
|
692
|
-
* @param n - Maximum number of new cards to return
|
|
693
|
-
*/
|
|
694
|
-
abstract getNewCards(n?: number): Promise<StudySessionNewItem[]>;
|
|
695
740
|
/**
|
|
696
741
|
* Get cards with suitability scores and provenance trails.
|
|
697
742
|
*
|
|
@@ -701,25 +746,23 @@ declare abstract class ContentNavigator implements StudyContentSource {
|
|
|
701
746
|
* better candidates for presentation. Each card includes a provenance trail
|
|
702
747
|
* documenting how strategies contributed to the final score.
|
|
703
748
|
*
|
|
749
|
+
* ## Implementation Required
|
|
750
|
+
* All navigation strategies MUST override this method. The base class does
|
|
751
|
+
* not provide a default implementation.
|
|
752
|
+
*
|
|
704
753
|
* ## For Generators
|
|
705
754
|
* Override this method to generate candidates and compute scores based on
|
|
706
755
|
* your strategy's logic (e.g., ELO proximity, review urgency). Create the
|
|
707
756
|
* initial provenance entry with action='generated'.
|
|
708
757
|
*
|
|
709
|
-
* ##
|
|
710
|
-
*
|
|
711
|
-
*
|
|
712
|
-
* 2. Assigns score=1.0 to all cards
|
|
713
|
-
* 3. Creates minimal provenance from legacy methods
|
|
714
|
-
* 4. Returns combined results up to limit
|
|
715
|
-
*
|
|
716
|
-
* This allows existing strategies to work without modification while
|
|
717
|
-
* new strategies can override with proper scoring and provenance.
|
|
758
|
+
* ## For Filters
|
|
759
|
+
* Filters should implement the CardFilter interface instead and be composed
|
|
760
|
+
* via Pipeline. Filters do not directly implement getWeightedCards().
|
|
718
761
|
*
|
|
719
762
|
* @param limit - Maximum cards to return
|
|
720
763
|
* @returns Cards sorted by score descending, with provenance trails
|
|
721
764
|
*/
|
|
722
|
-
getWeightedCards(
|
|
765
|
+
getWeightedCards(_limit: number): Promise<WeightedCard[]>;
|
|
723
766
|
}
|
|
724
767
|
|
|
725
768
|
type StudySessionFailedItem = StudySessionFailedNewItem | StudySessionFailedReviewItem;
|
|
@@ -757,112 +800,23 @@ interface ContentSourceID {
|
|
|
757
800
|
/**
|
|
758
801
|
* Interface for sources that provide study content to SessionController.
|
|
759
802
|
*
|
|
760
|
-
*
|
|
761
|
-
*
|
|
762
|
-
* strategies. The new API returns unified WeightedCard[] with scores.
|
|
763
|
-
*
|
|
764
|
-
* MIGRATION:
|
|
765
|
-
* - Implement ContentNavigator instead of StudyContentSource directly
|
|
766
|
-
* - Override getWeightedCards() as the primary method
|
|
767
|
-
* - Legacy methods can delegate to getWeightedCards() or be left as-is
|
|
803
|
+
* Content sources return scored candidates via getWeightedCards(), which
|
|
804
|
+
* SessionController uses to populate study queues.
|
|
768
805
|
*
|
|
769
|
-
* See: packages/db/
|
|
806
|
+
* See: packages/db/docs/navigators-architecture.md
|
|
770
807
|
*/
|
|
771
808
|
interface StudyContentSource {
|
|
772
|
-
/**
|
|
773
|
-
* Get cards scheduled for review based on SRS algorithm.
|
|
774
|
-
*
|
|
775
|
-
* @deprecated Will be replaced by getWeightedCards() which returns scored candidates.
|
|
776
|
-
* Review urgency will be expressed as a score rather than a separate method.
|
|
777
|
-
*/
|
|
778
|
-
getPendingReviews(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
|
|
779
|
-
/**
|
|
780
|
-
* Get new cards for introduction, typically ordered by ELO proximity.
|
|
781
|
-
*
|
|
782
|
-
* @deprecated Will be replaced by getWeightedCards() which returns scored candidates.
|
|
783
|
-
* New card selection and scoring will be unified with review scoring.
|
|
784
|
-
*
|
|
785
|
-
* @param n - Maximum number of new cards to return
|
|
786
|
-
*/
|
|
787
|
-
getNewCards(n?: number): Promise<StudySessionNewItem[]>;
|
|
788
809
|
/**
|
|
789
810
|
* Get cards with suitability scores for presentation.
|
|
790
811
|
*
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
*
|
|
794
|
-
* The `source` field on WeightedCard indicates origin ('new' | 'review' | 'failed')
|
|
795
|
-
* for queue routing purposes during the migration period.
|
|
812
|
+
* Returns unified scored candidates that can be sorted and selected by SessionController.
|
|
813
|
+
* The card origin ('new' | 'review' | 'failed') is determined by provenance metadata.
|
|
796
814
|
*
|
|
797
815
|
* @param limit - Maximum number of cards to return
|
|
798
816
|
* @returns Cards sorted by score descending
|
|
799
817
|
*/
|
|
800
|
-
getWeightedCards
|
|
818
|
+
getWeightedCards(limit: number): Promise<WeightedCard[]>;
|
|
801
819
|
}
|
|
802
820
|
declare function getStudySource(source: ContentSourceID, user: UserDBInterface): Promise<StudyContentSource>;
|
|
803
821
|
|
|
804
|
-
|
|
805
|
-
* Classroom management
|
|
806
|
-
*/
|
|
807
|
-
interface ClassroomDBInterface {
|
|
808
|
-
/**
|
|
809
|
-
* Get classroom config
|
|
810
|
-
*/
|
|
811
|
-
getConfig(): ClassroomConfig;
|
|
812
|
-
/**
|
|
813
|
-
* Get assigned content
|
|
814
|
-
*/
|
|
815
|
-
getAssignedContent(): Promise<AssignedContent[]>;
|
|
816
|
-
}
|
|
817
|
-
interface TeacherClassroomDBInterface extends ClassroomDBInterface {
|
|
818
|
-
/**
|
|
819
|
-
* For teacher interfaces: assign content
|
|
820
|
-
*/
|
|
821
|
-
assignContent?(content: AssignedContent): Promise<boolean>;
|
|
822
|
-
/**
|
|
823
|
-
* For teacher interfaces: remove content
|
|
824
|
-
*/
|
|
825
|
-
removeContent?(content: AssignedContent): Promise<void>;
|
|
826
|
-
}
|
|
827
|
-
interface StudentClassroomDBInterface extends ClassroomDBInterface {
|
|
828
|
-
/**
|
|
829
|
-
* For student interfaces: get pending reviews
|
|
830
|
-
*/
|
|
831
|
-
getPendingReviews?(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
|
|
832
|
-
/**
|
|
833
|
-
* For student interfaces: get new cards
|
|
834
|
-
*/
|
|
835
|
-
getNewCards?(limit?: number): Promise<StudySessionNewItem[]>;
|
|
836
|
-
}
|
|
837
|
-
type AssignedContent = AssignedCourse | AssignedTag | AssignedCard;
|
|
838
|
-
interface AssignedTag extends ContentBase {
|
|
839
|
-
type: 'tag';
|
|
840
|
-
tagID: string;
|
|
841
|
-
}
|
|
842
|
-
interface AssignedCourse extends ContentBase {
|
|
843
|
-
type: 'course';
|
|
844
|
-
}
|
|
845
|
-
interface AssignedCard extends ContentBase {
|
|
846
|
-
type: 'card';
|
|
847
|
-
cardID: string;
|
|
848
|
-
}
|
|
849
|
-
interface ContentBase {
|
|
850
|
-
type: 'course' | 'tag' | 'card';
|
|
851
|
-
/**
|
|
852
|
-
* Username of the assigning teacher.
|
|
853
|
-
*/
|
|
854
|
-
assignedBy: string;
|
|
855
|
-
/**
|
|
856
|
-
* Date the content was assigned.
|
|
857
|
-
*/
|
|
858
|
-
assignedOn: moment.Moment;
|
|
859
|
-
/**
|
|
860
|
-
* A 'due' date for this assigned content, for scheduling content
|
|
861
|
-
* in advance. Content will not be actively pushed to students until
|
|
862
|
-
* this date.
|
|
863
|
-
*/
|
|
864
|
-
activeOn: moment.Moment;
|
|
865
|
-
courseID: string;
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
export { type AdminDBInterface as A, type UsrCrsDataInterface as B, type CourseDBInterface as C, type DataLayerResult as D, type ClassroomRegistrationDesignation as E, type ClassroomRegistration as F, type ClassroomRegistrationDoc as G, type SessionTrackingData as H, type UserConfig as I, type ActivityRecord as J, type CourseRegistration as K, type StrategyContribution as L, getCardOrigin as M, Navigators as N, NavigatorRole as O, NavigatorRoles as P, isGenerator as Q, isFilter as R, type StudySessionNewItem as S, type TeacherClassroomDBInterface as T, type UserDBInterface as U, type DocumentUpdater as V, type WeightedCard as W, newInterval as X, type UserDBReader as a, type CoursesDBInterface as b, type ClassroomDBInterface as c, type CourseInfo as d, type ContentNavigationStrategyData as e, type StudySessionReviewItem as f, type ScheduledCard as g, type AssignedContent as h, type StudyContentSource as i, type StudentClassroomDBInterface as j, ContentNavigator as k, type StudySessionItem as l, type StudySessionFailedItem as m, type StudySessionFailedNewItem as n, type StudySessionFailedReviewItem as o, isReview as p, type ContentSourceID as q, getStudySource as r, type CourseRegistrationDoc as s, type AssignedTag as t, type AssignedCourse as u, type AssignedCard as v, type UserDBWriter as w, type UserDBAuthenticator as x, type UserCourseSettings as y, type UserCourseSetting as z };
|
|
822
|
+
export { type AdminDBInterface as A, type UsrCrsDataInterface as B, type CourseDBInterface as C, type DataLayerResult as D, type ClassroomRegistrationDesignation as E, type ClassroomRegistration as F, type ClassroomRegistrationDoc as G, type SessionTrackingData as H, type UserConfig as I, type ActivityRecord as J, type CourseRegistration as K, type StrategyContribution as L, getCardOrigin as M, Navigators as N, NavigatorRole as O, NavigatorRoles as P, isGenerator as Q, isFilter as R, type StudySessionItem as S, type TeacherClassroomDBInterface as T, type UserDBInterface as U, type DocumentUpdater as V, type WeightedCard as W, newInterval as X, type UserDBReader as a, type CoursesDBInterface as b, type ClassroomDBInterface as c, type CourseInfo as d, type ContentNavigationStrategyData as e, ContentNavigator as f, type AssignedContent as g, type StudyContentSource as h, type StudentClassroomDBInterface as i, type ScheduledCard as j, type StudySessionFailedItem as k, type StudySessionFailedNewItem as l, type StudySessionFailedReviewItem as m, type StudySessionNewItem as n, type StudySessionReviewItem as o, isReview as p, type ContentSourceID as q, getStudySource as r, type CourseRegistrationDoc as s, type AssignedTag as t, type AssignedCourse as u, type AssignedCard as v, type UserDBWriter as w, type UserDBAuthenticator as x, type UserCourseSettings as y, type UserCourseSetting as z };
|