@vue-skuilder/db 0.1.18 → 0.1.21
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-BgfrVb8d.d.ts → contentSource-BP9hznNV.d.ts} +220 -197
- package/dist/{classroomDB-CTOenngH.d.cts → contentSource-DsJadoBU.d.cts} +220 -197
- package/dist/core/index.d.cts +80 -6
- package/dist/core/index.d.ts +80 -6
- package/dist/core/index.js +735 -1560
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +708 -1539
- package/dist/core/index.mjs.map +1 -1
- package/dist/{dataLayerProvider-D6PoCwS6.d.cts → dataLayerProvider-CHYrQ5pB.d.cts} +1 -1
- package/dist/{dataLayerProvider-CZxC9GtB.d.ts → dataLayerProvider-MDTxXq2l.d.ts} +1 -1
- package/dist/impl/couch/index.d.cts +8 -23
- package/dist/impl/couch/index.d.ts +8 -23
- package/dist/impl/couch/index.js +723 -1578
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +692 -1552
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.d.cts +25 -8
- package/dist/impl/static/index.d.ts +25 -8
- package/dist/impl/static/index.js +700 -1400
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +688 -1393
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/{index-D-Fa4Smt.d.cts → index-B_j6u5E4.d.cts} +1 -1
- package/dist/{index-CD8BZz2k.d.ts → index-Dj0SEgk3.d.ts} +1 -1
- package/dist/index.d.cts +71 -63
- package/dist/index.d.ts +71 -63
- package/dist/index.js +1162 -1996
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1124 -1955
- 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/dist/{types-CzPDLAK6.d.cts → types-Bn0itutr.d.cts} +1 -1
- package/dist/{types-CewsN87z.d.ts → types-DQaXnuoc.d.ts} +1 -1
- package/dist/{types-legacy-6ettoclI.d.cts → types-legacy-DDY4N-Uq.d.cts} +3 -1
- package/dist/{types-legacy-6ettoclI.d.ts → types-legacy-DDY4N-Uq.d.ts} +3 -1
- package/dist/util/packer/index.d.cts +3 -3
- package/dist/util/packer/index.d.ts +3 -3
- package/docs/navigators-architecture.md +115 -17
- package/package.json +4 -4
- package/src/core/index.ts +1 -0
- package/src/core/interfaces/classroomDB.ts +5 -13
- package/src/core/interfaces/contentSource.ts +6 -66
- package/src/core/interfaces/courseDB.ts +15 -7
- package/src/core/interfaces/userDB.ts +32 -0
- package/src/core/navigators/Pipeline.ts +136 -52
- 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} +15 -29
- package/src/core/navigators/filters/index.ts +3 -0
- package/src/core/navigators/filters/inferredPreferenceStub.ts +107 -0
- package/src/core/navigators/{interferenceMitigator.ts → filters/interferenceMitigator.ts} +11 -37
- package/src/core/navigators/{relativePriority.ts → filters/relativePriority.ts} +12 -38
- package/src/core/navigators/filters/userGoalStub.ts +136 -0
- package/src/core/navigators/filters/userTagPreference.ts +217 -0
- 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 +95 -91
- package/src/core/types/strategyState.ts +84 -0
- package/src/core/types/types-legacy.ts +2 -0
- package/src/impl/common/BaseUserDB.ts +74 -7
- package/src/impl/couch/adminDB.ts +1 -2
- package/src/impl/couch/classroomDB.ts +100 -103
- package/src/impl/couch/courseDB.ts +35 -91
- package/src/impl/couch/pouchdb-setup.ts +7 -0
- package/src/impl/static/StaticDataUnpacker.ts +50 -1
- package/src/impl/static/courseDB.ts +87 -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 +6 -72
- package/tests/core/navigators/PipelineAssembler.test.ts +8 -58
- package/tests/core/navigators/navigators.test.ts +118 -151
- package/docs/todo-pipeline-optimization.md +0 -117
- package/docs/todo-strategy-state-storage.md +0 -278
- package/src/core/navigators/hardcodedOrder.ts +0 -163
- package/src/util/tuiLogger.ts +0 -139
package/dist/core/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { W as WeightedCard, U as UserDBInterface, C as CourseDBInterface } from '../
|
|
2
|
-
export { J as ActivityRecord, A as AdminDBInterface, v as AssignedCard,
|
|
3
|
-
export { D as DataLayerProvider } from '../dataLayerProvider-
|
|
4
|
-
import { C as CardHistory, c as CardRecord, i as QuestionRecord } from '../types-legacy-
|
|
5
|
-
export { d as CardData, e as CourseListData, g as DataShapeData, f as DisplayableData,
|
|
1
|
+
import { W as WeightedCard, U as UserDBInterface, C as CourseDBInterface } from '../contentSource-BP9hznNV.js';
|
|
2
|
+
export { J as ActivityRecord, A as AdminDBInterface, v as AssignedCard, g as AssignedContent, u as AssignedCourse, t as AssignedTag, c as ClassroomDBInterface, F as ClassroomRegistration, E as ClassroomRegistrationDesignation, G as ClassroomRegistrationDoc, f as ContentNavigator, q as ContentSourceID, d as CourseInfo, K as CourseRegistration, s as CourseRegistrationDoc, b as CoursesDBInterface, O as NavigatorRole, P as NavigatorRoles, N as Navigators, j as ScheduledCard, H as SessionTrackingData, L as StrategyContribution, i as StudentClassroomDBInterface, h as StudyContentSource, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, S as StudySessionItem, n as StudySessionNewItem, o as StudySessionReviewItem, T as TeacherClassroomDBInterface, I as UserConfig, z as UserCourseSetting, y as UserCourseSettings, x as UserDBAuthenticator, a as UserDBReader, w as UserDBWriter, B as UsrCrsDataInterface, M as getCardOrigin, r as getStudySource, R as isFilter, Q as isGenerator, p as isReview } from '../contentSource-BP9hznNV.js';
|
|
3
|
+
export { D as DataLayerProvider } from '../dataLayerProvider-MDTxXq2l.js';
|
|
4
|
+
import { b as DocTypePrefixes, D as DocType, C as CardHistory, c as CardRecord, i as QuestionRecord } from '../types-legacy-DDY4N-Uq.js';
|
|
5
|
+
export { d as CardData, e as CourseListData, g as DataShapeData, f as DisplayableData, F as Field, G as GuestUsername, Q as QualifiedCardID, h as QuestionData, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from '../types-legacy-DDY4N-Uq.js';
|
|
6
6
|
import { DataShape, ParsedCard } from '@vue-skuilder/common';
|
|
7
7
|
import 'moment';
|
|
8
8
|
|
|
@@ -169,6 +169,80 @@ interface CardGenerator {
|
|
|
169
169
|
*/
|
|
170
170
|
type CardGeneratorFactory<TConfig = unknown> = (config: TConfig) => CardGenerator;
|
|
171
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Template literal type for strategy state document IDs.
|
|
174
|
+
*
|
|
175
|
+
* Format: `STRATEGY_STATE-{courseId}-{strategyKey}`
|
|
176
|
+
*/
|
|
177
|
+
type StrategyStateId = `${(typeof DocTypePrefixes)[DocType.STRATEGY_STATE]}::${string}::${string}`;
|
|
178
|
+
/**
|
|
179
|
+
* Document storing strategy-specific state in the user database.
|
|
180
|
+
*
|
|
181
|
+
* Each strategy can persist its own state (user preferences, learned patterns,
|
|
182
|
+
* temporal tracking, etc.) using this document type. The state is scoped to
|
|
183
|
+
* a (user, course, strategy) tuple.
|
|
184
|
+
*
|
|
185
|
+
* ## Use Cases
|
|
186
|
+
*
|
|
187
|
+
* 1. **Explicit user preferences**: User configures tag filters, difficulty
|
|
188
|
+
* preferences, or learning goals. UI writes to strategy state.
|
|
189
|
+
*
|
|
190
|
+
* 2. **Learned/temporal state**: Strategy tracks patterns over time, e.g.,
|
|
191
|
+
* "when did I last introduce confusable concepts together?"
|
|
192
|
+
*
|
|
193
|
+
* 3. **Adaptive personalization**: Strategy infers user preferences from
|
|
194
|
+
* behavior and stores them for future sessions.
|
|
195
|
+
*
|
|
196
|
+
* ## Storage Location
|
|
197
|
+
*
|
|
198
|
+
* These documents live in the **user database**, not the course database.
|
|
199
|
+
* They sync with the user's data across devices.
|
|
200
|
+
*
|
|
201
|
+
* ## Document ID Format
|
|
202
|
+
*
|
|
203
|
+
* `STRATEGY_STATE::{courseId}::{strategyKey}`
|
|
204
|
+
*
|
|
205
|
+
* Example: `STRATEGY_STATE::piano-basics::UserTagPreferenceFilter`
|
|
206
|
+
*
|
|
207
|
+
* @template T - The shape of the strategy-specific data payload
|
|
208
|
+
*/
|
|
209
|
+
interface StrategyStateDoc<T = unknown> {
|
|
210
|
+
_id: StrategyStateId;
|
|
211
|
+
_rev?: string;
|
|
212
|
+
docType: DocType.STRATEGY_STATE;
|
|
213
|
+
/**
|
|
214
|
+
* The course this state applies to.
|
|
215
|
+
*/
|
|
216
|
+
courseId: string;
|
|
217
|
+
/**
|
|
218
|
+
* Unique key identifying the strategy instance.
|
|
219
|
+
* Typically the strategy class name (e.g., "UserTagPreferenceFilter",
|
|
220
|
+
* "InterferenceMitigatorNavigator").
|
|
221
|
+
*
|
|
222
|
+
* If a course has multiple instances of the same strategy type with
|
|
223
|
+
* different configurations, use a more specific key.
|
|
224
|
+
*/
|
|
225
|
+
strategyKey: string;
|
|
226
|
+
/**
|
|
227
|
+
* Strategy-specific data payload.
|
|
228
|
+
* Each strategy defines its own schema for this field.
|
|
229
|
+
*/
|
|
230
|
+
data: T;
|
|
231
|
+
/**
|
|
232
|
+
* ISO timestamp of last update.
|
|
233
|
+
* Use `moment.utc(updatedAt)` to parse into a Moment object.
|
|
234
|
+
*/
|
|
235
|
+
updatedAt: string;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Build the document ID for a strategy state document.
|
|
239
|
+
*
|
|
240
|
+
* @param courseId - The course ID
|
|
241
|
+
* @param strategyKey - The strategy key (typically class name)
|
|
242
|
+
* @returns The document ID in format `STRATEGY_STATE::{courseId}::{strategyKey}`
|
|
243
|
+
*/
|
|
244
|
+
declare function buildStrategyStateId(courseId: string, strategyKey: string): StrategyStateId;
|
|
245
|
+
|
|
172
246
|
declare function areQuestionRecords(h: CardHistory<CardRecord>): h is CardHistory<QuestionRecord>;
|
|
173
247
|
declare function isQuestionRecord(c: CardRecord): c is QuestionRecord;
|
|
174
248
|
declare function getCardHistoryID(courseID: string, cardID: string): PouchDB.Core.DocumentId;
|
|
@@ -227,4 +301,4 @@ declare function validateProcessorConfig(config: Partial<BulkCardProcessorConfig
|
|
|
227
301
|
errorMessage?: string;
|
|
228
302
|
};
|
|
229
303
|
|
|
230
|
-
export { type BulkCardProcessorConfig, type CardFilter, type CardFilterFactory, type CardGenerator, type CardGeneratorFactory, CardHistory, CardRecord, CourseDBInterface, type FilterContext, type GeneratorContext, type ImportResult, Loggable, QuestionRecord, UserDBInterface, WeightedCard, areQuestionRecords, docIsDeleted, getCardHistoryID, importParsedCards, isQuestionRecord, parseCardHistoryID, validateProcessorConfig };
|
|
304
|
+
export { type BulkCardProcessorConfig, type CardFilter, type CardFilterFactory, type CardGenerator, type CardGeneratorFactory, CardHistory, CardRecord, CourseDBInterface, DocType, DocTypePrefixes, type FilterContext, type GeneratorContext, type ImportResult, Loggable, QuestionRecord, type StrategyStateDoc, type StrategyStateId, UserDBInterface, WeightedCard, areQuestionRecords, buildStrategyStateId, docIsDeleted, getCardHistoryID, importParsedCards, isQuestionRecord, parseCardHistoryID, validateProcessorConfig };
|