@vue-skuilder/db 0.1.16 → 0.1.18
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/{userDB-DNa0XPtn.d.ts → classroomDB-BgfrVb8d.d.ts} +357 -103
- package/dist/{userDB-BqwxtJ_7.d.mts → classroomDB-CTOenngH.d.cts} +358 -104
- package/dist/core/index.d.cts +230 -0
- package/dist/core/index.d.ts +161 -23
- package/dist/core/index.js +1964 -154
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +1925 -121
- package/dist/core/index.mjs.map +1 -1
- package/dist/{dataLayerProvider-BV5iZqt_.d.ts → dataLayerProvider-CZxC9GtB.d.ts} +1 -1
- package/dist/{dataLayerProvider-VlngD19_.d.mts → dataLayerProvider-D6PoCwS6.d.cts} +1 -1
- package/dist/impl/couch/{index.d.mts → index.d.cts} +46 -5
- package/dist/impl/couch/index.d.ts +44 -3
- package/dist/impl/couch/index.js +1971 -171
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +1933 -134
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/{index.d.mts → index.d.cts} +5 -6
- package/dist/impl/static/index.d.ts +2 -3
- package/dist/impl/static/index.js +1614 -119
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +1585 -92
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/{index-Bmll7Xse.d.mts → index-D-Fa4Smt.d.cts} +1 -1
- package/dist/{index.d.mts → index.d.cts} +97 -13
- package/dist/index.d.ts +90 -6
- package/dist/index.js +2085 -153
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2031 -106
- package/dist/index.mjs.map +1 -1
- package/dist/pouch/index.js +3 -3
- package/dist/{types-Dbp5DaRR.d.mts → types-CzPDLAK6.d.cts} +1 -1
- package/dist/util/packer/{index.d.mts → index.d.cts} +3 -3
- package/dist/util/packer/index.js.map +1 -1
- package/dist/util/packer/index.mjs.map +1 -1
- package/docs/brainstorm-navigation-paradigm.md +369 -0
- package/docs/navigators-architecture.md +265 -0
- package/docs/todo-evolutionary-orchestration.md +310 -0
- package/docs/todo-nominal-tag-types.md +121 -0
- package/docs/todo-pipeline-optimization.md +117 -0
- package/docs/todo-strategy-authoring.md +401 -0
- package/docs/todo-strategy-state-storage.md +278 -0
- package/eslint.config.mjs +1 -1
- package/package.json +9 -4
- package/src/core/interfaces/contentSource.ts +88 -4
- package/src/core/interfaces/navigationStrategyManager.ts +0 -5
- package/src/core/navigators/CompositeGenerator.ts +268 -0
- package/src/core/navigators/Pipeline.ts +205 -0
- package/src/core/navigators/PipelineAssembler.ts +194 -0
- package/src/core/navigators/elo.ts +104 -15
- package/src/core/navigators/filters/eloDistance.ts +132 -0
- package/src/core/navigators/filters/index.ts +6 -0
- package/src/core/navigators/filters/types.ts +115 -0
- package/src/core/navigators/generators/index.ts +2 -0
- package/src/core/navigators/generators/types.ts +107 -0
- package/src/core/navigators/hardcodedOrder.ts +111 -12
- package/src/core/navigators/hierarchyDefinition.ts +266 -0
- package/src/core/navigators/index.ts +345 -3
- package/src/core/navigators/interferenceMitigator.ts +367 -0
- package/src/core/navigators/relativePriority.ts +267 -0
- package/src/core/navigators/srs.ts +195 -0
- package/src/impl/couch/classroomDB.ts +51 -0
- package/src/impl/couch/courseDB.ts +117 -39
- package/src/impl/static/courseDB.ts +0 -4
- package/src/study/SessionController.ts +149 -1
- package/src/study/TagFilteredContentSource.ts +255 -0
- package/src/study/index.ts +1 -0
- package/src/util/dataDirectory.test.ts +51 -22
- package/src/util/logger.ts +0 -1
- package/tests/core/navigators/CompositeGenerator.test.ts +455 -0
- package/tests/core/navigators/Pipeline.test.ts +405 -0
- package/tests/core/navigators/PipelineAssembler.test.ts +351 -0
- package/tests/core/navigators/SRSNavigator.test.ts +344 -0
- package/tests/core/navigators/eloDistanceFilter.test.ts +192 -0
- package/tests/core/navigators/navigators.test.ts +710 -0
- package/tsconfig.json +1 -1
- package/vitest.config.ts +29 -0
- package/dist/core/index.d.mts +0 -92
- /package/dist/{SyncStrategy-CyATpyLQ.d.mts → SyncStrategy-CyATpyLQ.d.cts} +0 -0
- /package/dist/pouch/{index.d.mts → index.d.cts} +0 -0
- /package/dist/{types-legacy-6ettoclI.d.mts → types-legacy-6ettoclI.d.cts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CourseConfig, ClassroomConfig, CourseElo, Status, SkuilderCourseData as SkuilderCourseData$1, DataShape } from '@vue-skuilder/common';
|
|
1
|
+
import { CourseConfig, ClassroomConfig, CourseElo, Status, SkuilderCourseData as SkuilderCourseData$1, 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-6ettoclI.js';
|
|
4
4
|
|
|
@@ -104,103 +104,6 @@ interface ScheduledCard {
|
|
|
104
104
|
schedulingAgentId: string;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
type StudySessionFailedItem = StudySessionFailedNewItem | StudySessionFailedReviewItem;
|
|
108
|
-
interface StudySessionFailedNewItem extends StudySessionItem {
|
|
109
|
-
status: 'failed-new';
|
|
110
|
-
}
|
|
111
|
-
interface StudySessionFailedReviewItem extends StudySessionReviewItem {
|
|
112
|
-
status: 'failed-review';
|
|
113
|
-
}
|
|
114
|
-
interface StudySessionNewItem extends StudySessionItem {
|
|
115
|
-
status: 'new';
|
|
116
|
-
}
|
|
117
|
-
interface StudySessionReviewItem extends StudySessionItem {
|
|
118
|
-
reviewID: string;
|
|
119
|
-
status: 'review' | 'failed-review';
|
|
120
|
-
}
|
|
121
|
-
declare function isReview(item: StudySessionItem): item is StudySessionReviewItem;
|
|
122
|
-
interface StudySessionItem {
|
|
123
|
-
status: 'new' | 'review' | 'failed-new' | 'failed-review';
|
|
124
|
-
contentSourceType: 'course' | 'classroom';
|
|
125
|
-
contentSourceID: string;
|
|
126
|
-
cardID: string;
|
|
127
|
-
courseID: string;
|
|
128
|
-
elo?: number;
|
|
129
|
-
}
|
|
130
|
-
interface ContentSourceID {
|
|
131
|
-
type: 'course' | 'classroom';
|
|
132
|
-
id: string;
|
|
133
|
-
}
|
|
134
|
-
interface StudyContentSource {
|
|
135
|
-
getPendingReviews(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
|
|
136
|
-
getNewCards(n?: number): Promise<StudySessionNewItem[]>;
|
|
137
|
-
}
|
|
138
|
-
declare function getStudySource(source: ContentSourceID, user: UserDBInterface): Promise<StudyContentSource>;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Classroom management
|
|
142
|
-
*/
|
|
143
|
-
interface ClassroomDBInterface {
|
|
144
|
-
/**
|
|
145
|
-
* Get classroom config
|
|
146
|
-
*/
|
|
147
|
-
getConfig(): ClassroomConfig;
|
|
148
|
-
/**
|
|
149
|
-
* Get assigned content
|
|
150
|
-
*/
|
|
151
|
-
getAssignedContent(): Promise<AssignedContent[]>;
|
|
152
|
-
}
|
|
153
|
-
interface TeacherClassroomDBInterface extends ClassroomDBInterface {
|
|
154
|
-
/**
|
|
155
|
-
* For teacher interfaces: assign content
|
|
156
|
-
*/
|
|
157
|
-
assignContent?(content: AssignedContent): Promise<boolean>;
|
|
158
|
-
/**
|
|
159
|
-
* For teacher interfaces: remove content
|
|
160
|
-
*/
|
|
161
|
-
removeContent?(content: AssignedContent): Promise<void>;
|
|
162
|
-
}
|
|
163
|
-
interface StudentClassroomDBInterface extends ClassroomDBInterface {
|
|
164
|
-
/**
|
|
165
|
-
* For student interfaces: get pending reviews
|
|
166
|
-
*/
|
|
167
|
-
getPendingReviews?(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
|
|
168
|
-
/**
|
|
169
|
-
* For student interfaces: get new cards
|
|
170
|
-
*/
|
|
171
|
-
getNewCards?(limit?: number): Promise<StudySessionNewItem[]>;
|
|
172
|
-
}
|
|
173
|
-
type AssignedContent = AssignedCourse | AssignedTag | AssignedCard;
|
|
174
|
-
interface AssignedTag extends ContentBase {
|
|
175
|
-
type: 'tag';
|
|
176
|
-
tagID: string;
|
|
177
|
-
}
|
|
178
|
-
interface AssignedCourse extends ContentBase {
|
|
179
|
-
type: 'course';
|
|
180
|
-
}
|
|
181
|
-
interface AssignedCard extends ContentBase {
|
|
182
|
-
type: 'card';
|
|
183
|
-
cardID: string;
|
|
184
|
-
}
|
|
185
|
-
interface ContentBase {
|
|
186
|
-
type: 'course' | 'tag' | 'card';
|
|
187
|
-
/**
|
|
188
|
-
* Username of the assigning teacher.
|
|
189
|
-
*/
|
|
190
|
-
assignedBy: string;
|
|
191
|
-
/**
|
|
192
|
-
* Date the content was assigned.
|
|
193
|
-
*/
|
|
194
|
-
assignedOn: moment.Moment;
|
|
195
|
-
/**
|
|
196
|
-
* A 'due' date for this assigned content, for scheduling content
|
|
197
|
-
* in advance. Content will not be actively pushed to students until
|
|
198
|
-
* this date.
|
|
199
|
-
*/
|
|
200
|
-
activeOn: moment.Moment;
|
|
201
|
-
courseID: string;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
107
|
interface DataLayerResult {
|
|
205
108
|
status: Status;
|
|
206
109
|
message: string;
|
|
@@ -255,10 +158,6 @@ interface NavigationStrategyManager {
|
|
|
255
158
|
* @returns A promise that resolves when the update is complete
|
|
256
159
|
*/
|
|
257
160
|
updateNavigationStrategy(id: string, data: ContentNavigationStrategyData): Promise<void>;
|
|
258
|
-
/**
|
|
259
|
-
* @returns A content navigation strategy suitable to the current context.
|
|
260
|
-
*/
|
|
261
|
-
surfaceNavigationStrategy(): Promise<ContentNavigationStrategyData>;
|
|
262
161
|
}
|
|
263
162
|
|
|
264
163
|
/**
|
|
@@ -542,4 +441,359 @@ interface ClassroomRegistrationDoc {
|
|
|
542
441
|
registrations: ClassroomRegistration[];
|
|
543
442
|
}
|
|
544
443
|
|
|
545
|
-
|
|
444
|
+
/**
|
|
445
|
+
* Tracks a single strategy's contribution to a card's final score.
|
|
446
|
+
*
|
|
447
|
+
* Each strategy in the pipeline adds a StrategyContribution entry to the
|
|
448
|
+
* card's provenance array, creating an audit trail of scoring decisions.
|
|
449
|
+
*/
|
|
450
|
+
interface StrategyContribution {
|
|
451
|
+
/**
|
|
452
|
+
* Strategy type (implementing class name).
|
|
453
|
+
* Examples: 'elo', 'hierarchyDefinition', 'interferenceMitigator'
|
|
454
|
+
*/
|
|
455
|
+
strategy: string;
|
|
456
|
+
/**
|
|
457
|
+
* Human-readable name identifying this specific strategy instance.
|
|
458
|
+
* Extracted from ContentNavigationStrategyData.name.
|
|
459
|
+
* Courses may have multiple instances of the same strategy type with
|
|
460
|
+
* different configurations.
|
|
461
|
+
*
|
|
462
|
+
* Examples:
|
|
463
|
+
* - "ELO (default)"
|
|
464
|
+
* - "Interference: b/d/p confusion"
|
|
465
|
+
* - "Interference: phonetic confusables"
|
|
466
|
+
* - "Priority: Common letters first"
|
|
467
|
+
*/
|
|
468
|
+
strategyName: string;
|
|
469
|
+
/**
|
|
470
|
+
* Unique database document ID for this strategy instance.
|
|
471
|
+
* Extracted from ContentNavigationStrategyData._id.
|
|
472
|
+
* Use this to fetch the full strategy configuration document.
|
|
473
|
+
*
|
|
474
|
+
* Examples:
|
|
475
|
+
* - "NAVIGATION_STRATEGY-ELO-default"
|
|
476
|
+
* - "NAVIGATION_STRATEGY-interference-bdp"
|
|
477
|
+
* - "NAVIGATION_STRATEGY-priority-common-letters"
|
|
478
|
+
*/
|
|
479
|
+
strategyId: string;
|
|
480
|
+
/**
|
|
481
|
+
* What the strategy did:
|
|
482
|
+
* - 'generated': Strategy produced this card (generators only)
|
|
483
|
+
* - 'passed': Strategy evaluated but didn't change score (transparent pass-through)
|
|
484
|
+
* - 'boosted': Strategy increased the score
|
|
485
|
+
* - 'penalized': Strategy decreased the score
|
|
486
|
+
*/
|
|
487
|
+
action: 'generated' | 'passed' | 'boosted' | 'penalized';
|
|
488
|
+
/** Score after this strategy's processing */
|
|
489
|
+
score: number;
|
|
490
|
+
/**
|
|
491
|
+
* Human-readable explanation of the strategy's decision.
|
|
492
|
+
*
|
|
493
|
+
* Examples:
|
|
494
|
+
* - "ELO distance 75, new card"
|
|
495
|
+
* - "Prerequisites met: letter-sounds"
|
|
496
|
+
* - "Interferes with immature tag 'd' (decay 0.8)"
|
|
497
|
+
* - "High-priority tag 's' (0.95) → boost 1.15x"
|
|
498
|
+
*
|
|
499
|
+
* Required for transparency - silent adjusters are anti-patterns.
|
|
500
|
+
*/
|
|
501
|
+
reason: string;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* A card with a suitability score and provenance trail.
|
|
505
|
+
*
|
|
506
|
+
* Scores range from 0-1:
|
|
507
|
+
* - 1.0 = fully suitable
|
|
508
|
+
* - 0.0 = hard filter (e.g., prerequisite not met)
|
|
509
|
+
* - 0.5 = neutral
|
|
510
|
+
* - Intermediate values = soft preference
|
|
511
|
+
*
|
|
512
|
+
* Provenance tracks the scoring pipeline:
|
|
513
|
+
* - First entry: Generator that produced the card
|
|
514
|
+
* - Subsequent entries: Filters that transformed the score
|
|
515
|
+
* - Each entry includes action and human-readable reason
|
|
516
|
+
*/
|
|
517
|
+
interface WeightedCard {
|
|
518
|
+
cardId: string;
|
|
519
|
+
courseId: string;
|
|
520
|
+
/** Suitability score from 0-1 */
|
|
521
|
+
score: number;
|
|
522
|
+
/**
|
|
523
|
+
* Audit trail of strategy contributions.
|
|
524
|
+
* First entry is from the generator, subsequent entries from filters.
|
|
525
|
+
*/
|
|
526
|
+
provenance: StrategyContribution[];
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Extract card origin from provenance trail.
|
|
530
|
+
*
|
|
531
|
+
* The first provenance entry (from the generator) indicates whether
|
|
532
|
+
* this is a new card, review, or failed card. We parse the reason
|
|
533
|
+
* string to extract this information.
|
|
534
|
+
*
|
|
535
|
+
* @param card - Card with provenance trail
|
|
536
|
+
* @returns Card origin ('new', 'review', or 'failed')
|
|
537
|
+
*/
|
|
538
|
+
declare function getCardOrigin(card: WeightedCard): 'new' | 'review' | 'failed';
|
|
539
|
+
declare enum Navigators {
|
|
540
|
+
ELO = "elo",
|
|
541
|
+
SRS = "srs",
|
|
542
|
+
HARDCODED = "hardcodedOrder",
|
|
543
|
+
HIERARCHY = "hierarchyDefinition",
|
|
544
|
+
INTERFERENCE = "interferenceMitigator",
|
|
545
|
+
RELATIVE_PRIORITY = "relativePriority"
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Role classification for navigation strategies.
|
|
549
|
+
*
|
|
550
|
+
* - GENERATOR: Produces candidate cards with initial scores
|
|
551
|
+
* - FILTER: Transforms cards with score multipliers
|
|
552
|
+
*/
|
|
553
|
+
declare enum NavigatorRole {
|
|
554
|
+
GENERATOR = "generator",
|
|
555
|
+
FILTER = "filter"
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Registry mapping navigator implementations to their roles.
|
|
559
|
+
*/
|
|
560
|
+
declare const NavigatorRoles: Record<Navigators, NavigatorRole>;
|
|
561
|
+
/**
|
|
562
|
+
* Check if a navigator implementation is a generator.
|
|
563
|
+
*
|
|
564
|
+
* @param impl - Navigator implementation name (e.g., 'elo', 'hierarchyDefinition')
|
|
565
|
+
* @returns true if the navigator is a generator, false otherwise
|
|
566
|
+
*/
|
|
567
|
+
declare function isGenerator(impl: string): boolean;
|
|
568
|
+
/**
|
|
569
|
+
* Check if a navigator implementation is a filter.
|
|
570
|
+
*
|
|
571
|
+
* @param impl - Navigator implementation name (e.g., 'elo', 'hierarchyDefinition')
|
|
572
|
+
* @returns true if the navigator is a filter, false otherwise
|
|
573
|
+
*/
|
|
574
|
+
declare function isFilter(impl: string): boolean;
|
|
575
|
+
/**
|
|
576
|
+
* Abstract base class for navigation strategies.
|
|
577
|
+
*
|
|
578
|
+
* This class exists primarily for backward compatibility with legacy code.
|
|
579
|
+
* New code should use CardGenerator or CardFilter interfaces directly.
|
|
580
|
+
*
|
|
581
|
+
* The class implements StudyContentSource for compatibility with SessionController.
|
|
582
|
+
* Once SessionController migrates to use getWeightedCards() exclusively,
|
|
583
|
+
* the legacy methods can be removed.
|
|
584
|
+
*/
|
|
585
|
+
declare abstract class ContentNavigator implements StudyContentSource {
|
|
586
|
+
/** User interface for this navigation session */
|
|
587
|
+
protected user?: UserDBInterface;
|
|
588
|
+
/** Course interface for this navigation session */
|
|
589
|
+
protected course?: CourseDBInterface;
|
|
590
|
+
/** Human-readable name for this strategy instance (from ContentNavigationStrategyData.name) */
|
|
591
|
+
protected strategyName?: string;
|
|
592
|
+
/** Unique document ID for this strategy instance (from ContentNavigationStrategyData._id) */
|
|
593
|
+
protected strategyId?: string;
|
|
594
|
+
/**
|
|
595
|
+
* Constructor for standard navigators.
|
|
596
|
+
* Call this from subclass constructors to initialize common fields.
|
|
597
|
+
*
|
|
598
|
+
* Note: CompositeGenerator doesn't use this pattern and should call super() without args.
|
|
599
|
+
*/
|
|
600
|
+
constructor(user?: UserDBInterface, course?: CourseDBInterface, strategyData?: ContentNavigationStrategyData);
|
|
601
|
+
/**
|
|
602
|
+
* Factory method to create navigator instances dynamically.
|
|
603
|
+
*
|
|
604
|
+
* @param user - User interface
|
|
605
|
+
* @param course - Course interface
|
|
606
|
+
* @param strategyData - Strategy configuration document
|
|
607
|
+
* @returns the runtime object used to steer a study session.
|
|
608
|
+
*/
|
|
609
|
+
static create(user: UserDBInterface, course: CourseDBInterface, strategyData: ContentNavigationStrategyData): Promise<ContentNavigator>;
|
|
610
|
+
/**
|
|
611
|
+
* Get cards scheduled for review.
|
|
612
|
+
*
|
|
613
|
+
* @deprecated This method is part of the legacy StudyContentSource interface.
|
|
614
|
+
* New strategies should focus on implementing CardGenerator.getWeightedCards() instead.
|
|
615
|
+
*/
|
|
616
|
+
abstract getPendingReviews(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
|
|
617
|
+
/**
|
|
618
|
+
* Get new cards for introduction.
|
|
619
|
+
*
|
|
620
|
+
* @deprecated This method is part of the legacy StudyContentSource interface.
|
|
621
|
+
* New strategies should focus on implementing CardGenerator.getWeightedCards() instead.
|
|
622
|
+
*
|
|
623
|
+
* @param n - Maximum number of new cards to return
|
|
624
|
+
*/
|
|
625
|
+
abstract getNewCards(n?: number): Promise<StudySessionNewItem[]>;
|
|
626
|
+
/**
|
|
627
|
+
* Get cards with suitability scores and provenance trails.
|
|
628
|
+
*
|
|
629
|
+
* **This is the PRIMARY API for navigation strategies.**
|
|
630
|
+
*
|
|
631
|
+
* Returns cards ranked by suitability score (0-1). Higher scores indicate
|
|
632
|
+
* better candidates for presentation. Each card includes a provenance trail
|
|
633
|
+
* documenting how strategies contributed to the final score.
|
|
634
|
+
*
|
|
635
|
+
* ## For Generators
|
|
636
|
+
* Override this method to generate candidates and compute scores based on
|
|
637
|
+
* your strategy's logic (e.g., ELO proximity, review urgency). Create the
|
|
638
|
+
* initial provenance entry with action='generated'.
|
|
639
|
+
*
|
|
640
|
+
* ## Default Implementation
|
|
641
|
+
* The base class provides a backward-compatible default that:
|
|
642
|
+
* 1. Calls legacy getNewCards() and getPendingReviews()
|
|
643
|
+
* 2. Assigns score=1.0 to all cards
|
|
644
|
+
* 3. Creates minimal provenance from legacy methods
|
|
645
|
+
* 4. Returns combined results up to limit
|
|
646
|
+
*
|
|
647
|
+
* This allows existing strategies to work without modification while
|
|
648
|
+
* new strategies can override with proper scoring and provenance.
|
|
649
|
+
*
|
|
650
|
+
* @param limit - Maximum cards to return
|
|
651
|
+
* @returns Cards sorted by score descending, with provenance trails
|
|
652
|
+
*/
|
|
653
|
+
getWeightedCards(limit: number): Promise<WeightedCard[]>;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
type StudySessionFailedItem = StudySessionFailedNewItem | StudySessionFailedReviewItem;
|
|
657
|
+
interface StudySessionFailedNewItem extends StudySessionItem {
|
|
658
|
+
status: 'failed-new';
|
|
659
|
+
}
|
|
660
|
+
interface StudySessionFailedReviewItem extends StudySessionReviewItem {
|
|
661
|
+
status: 'failed-review';
|
|
662
|
+
}
|
|
663
|
+
interface StudySessionNewItem extends StudySessionItem {
|
|
664
|
+
status: 'new';
|
|
665
|
+
}
|
|
666
|
+
interface StudySessionReviewItem extends StudySessionItem {
|
|
667
|
+
reviewID: string;
|
|
668
|
+
status: 'review' | 'failed-review';
|
|
669
|
+
}
|
|
670
|
+
declare function isReview(item: StudySessionItem): item is StudySessionReviewItem;
|
|
671
|
+
interface StudySessionItem {
|
|
672
|
+
status: 'new' | 'review' | 'failed-new' | 'failed-review';
|
|
673
|
+
contentSourceType: 'course' | 'classroom';
|
|
674
|
+
contentSourceID: string;
|
|
675
|
+
cardID: string;
|
|
676
|
+
courseID: string;
|
|
677
|
+
elo?: number;
|
|
678
|
+
}
|
|
679
|
+
interface ContentSourceID {
|
|
680
|
+
type: 'course' | 'classroom';
|
|
681
|
+
id: string;
|
|
682
|
+
/**
|
|
683
|
+
* Optional tag filter for scoped study sessions.
|
|
684
|
+
* When present, creates a TagFilteredContentSource instead of a regular course source.
|
|
685
|
+
*/
|
|
686
|
+
tagFilter?: TagFilter;
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Interface for sources that provide study content to SessionController.
|
|
690
|
+
*
|
|
691
|
+
* @deprecated This interface will be superseded by ContentNavigator.getWeightedCards().
|
|
692
|
+
* The getNewCards/getPendingReviews split was an artifact of hard-coded ELO and SRS
|
|
693
|
+
* strategies. The new API returns unified WeightedCard[] with scores.
|
|
694
|
+
*
|
|
695
|
+
* MIGRATION:
|
|
696
|
+
* - Implement ContentNavigator instead of StudyContentSource directly
|
|
697
|
+
* - Override getWeightedCards() as the primary method
|
|
698
|
+
* - Legacy methods can delegate to getWeightedCards() or be left as-is
|
|
699
|
+
*
|
|
700
|
+
* See: packages/db/src/core/navigators/ARCHITECTURE.md
|
|
701
|
+
*/
|
|
702
|
+
interface StudyContentSource {
|
|
703
|
+
/**
|
|
704
|
+
* Get cards scheduled for review based on SRS algorithm.
|
|
705
|
+
*
|
|
706
|
+
* @deprecated Will be replaced by getWeightedCards() which returns scored candidates.
|
|
707
|
+
* Review urgency will be expressed as a score rather than a separate method.
|
|
708
|
+
*/
|
|
709
|
+
getPendingReviews(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
|
|
710
|
+
/**
|
|
711
|
+
* Get new cards for introduction, typically ordered by ELO proximity.
|
|
712
|
+
*
|
|
713
|
+
* @deprecated Will be replaced by getWeightedCards() which returns scored candidates.
|
|
714
|
+
* New card selection and scoring will be unified with review scoring.
|
|
715
|
+
*
|
|
716
|
+
* @param n - Maximum number of new cards to return
|
|
717
|
+
*/
|
|
718
|
+
getNewCards(n?: number): Promise<StudySessionNewItem[]>;
|
|
719
|
+
/**
|
|
720
|
+
* Get cards with suitability scores for presentation.
|
|
721
|
+
*
|
|
722
|
+
* This is the PRIMARY API for content sources going forward. Returns unified
|
|
723
|
+
* scored candidates that can be sorted and selected by SessionController.
|
|
724
|
+
*
|
|
725
|
+
* The `source` field on WeightedCard indicates origin ('new' | 'review' | 'failed')
|
|
726
|
+
* for queue routing purposes during the migration period.
|
|
727
|
+
*
|
|
728
|
+
* @param limit - Maximum number of cards to return
|
|
729
|
+
* @returns Cards sorted by score descending
|
|
730
|
+
*/
|
|
731
|
+
getWeightedCards?(limit: number): Promise<WeightedCard[]>;
|
|
732
|
+
}
|
|
733
|
+
declare function getStudySource(source: ContentSourceID, user: UserDBInterface): Promise<StudyContentSource>;
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Classroom management
|
|
737
|
+
*/
|
|
738
|
+
interface ClassroomDBInterface {
|
|
739
|
+
/**
|
|
740
|
+
* Get classroom config
|
|
741
|
+
*/
|
|
742
|
+
getConfig(): ClassroomConfig;
|
|
743
|
+
/**
|
|
744
|
+
* Get assigned content
|
|
745
|
+
*/
|
|
746
|
+
getAssignedContent(): Promise<AssignedContent[]>;
|
|
747
|
+
}
|
|
748
|
+
interface TeacherClassroomDBInterface extends ClassroomDBInterface {
|
|
749
|
+
/**
|
|
750
|
+
* For teacher interfaces: assign content
|
|
751
|
+
*/
|
|
752
|
+
assignContent?(content: AssignedContent): Promise<boolean>;
|
|
753
|
+
/**
|
|
754
|
+
* For teacher interfaces: remove content
|
|
755
|
+
*/
|
|
756
|
+
removeContent?(content: AssignedContent): Promise<void>;
|
|
757
|
+
}
|
|
758
|
+
interface StudentClassroomDBInterface extends ClassroomDBInterface {
|
|
759
|
+
/**
|
|
760
|
+
* For student interfaces: get pending reviews
|
|
761
|
+
*/
|
|
762
|
+
getPendingReviews?(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
|
|
763
|
+
/**
|
|
764
|
+
* For student interfaces: get new cards
|
|
765
|
+
*/
|
|
766
|
+
getNewCards?(limit?: number): Promise<StudySessionNewItem[]>;
|
|
767
|
+
}
|
|
768
|
+
type AssignedContent = AssignedCourse | AssignedTag | AssignedCard;
|
|
769
|
+
interface AssignedTag extends ContentBase {
|
|
770
|
+
type: 'tag';
|
|
771
|
+
tagID: string;
|
|
772
|
+
}
|
|
773
|
+
interface AssignedCourse extends ContentBase {
|
|
774
|
+
type: 'course';
|
|
775
|
+
}
|
|
776
|
+
interface AssignedCard extends ContentBase {
|
|
777
|
+
type: 'card';
|
|
778
|
+
cardID: string;
|
|
779
|
+
}
|
|
780
|
+
interface ContentBase {
|
|
781
|
+
type: 'course' | 'tag' | 'card';
|
|
782
|
+
/**
|
|
783
|
+
* Username of the assigning teacher.
|
|
784
|
+
*/
|
|
785
|
+
assignedBy: string;
|
|
786
|
+
/**
|
|
787
|
+
* Date the content was assigned.
|
|
788
|
+
*/
|
|
789
|
+
assignedOn: moment.Moment;
|
|
790
|
+
/**
|
|
791
|
+
* A 'due' date for this assigned content, for scheduling content
|
|
792
|
+
* in advance. Content will not be actively pushed to students until
|
|
793
|
+
* this date.
|
|
794
|
+
*/
|
|
795
|
+
activeOn: moment.Moment;
|
|
796
|
+
courseID: string;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
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 };
|