@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.
Files changed (80) hide show
  1. package/dist/{userDB-DNa0XPtn.d.ts → classroomDB-BgfrVb8d.d.ts} +357 -103
  2. package/dist/{userDB-BqwxtJ_7.d.mts → classroomDB-CTOenngH.d.cts} +358 -104
  3. package/dist/core/index.d.cts +230 -0
  4. package/dist/core/index.d.ts +161 -23
  5. package/dist/core/index.js +1964 -154
  6. package/dist/core/index.js.map +1 -1
  7. package/dist/core/index.mjs +1925 -121
  8. package/dist/core/index.mjs.map +1 -1
  9. package/dist/{dataLayerProvider-BV5iZqt_.d.ts → dataLayerProvider-CZxC9GtB.d.ts} +1 -1
  10. package/dist/{dataLayerProvider-VlngD19_.d.mts → dataLayerProvider-D6PoCwS6.d.cts} +1 -1
  11. package/dist/impl/couch/{index.d.mts → index.d.cts} +46 -5
  12. package/dist/impl/couch/index.d.ts +44 -3
  13. package/dist/impl/couch/index.js +1971 -171
  14. package/dist/impl/couch/index.js.map +1 -1
  15. package/dist/impl/couch/index.mjs +1933 -134
  16. package/dist/impl/couch/index.mjs.map +1 -1
  17. package/dist/impl/static/{index.d.mts → index.d.cts} +5 -6
  18. package/dist/impl/static/index.d.ts +2 -3
  19. package/dist/impl/static/index.js +1614 -119
  20. package/dist/impl/static/index.js.map +1 -1
  21. package/dist/impl/static/index.mjs +1585 -92
  22. package/dist/impl/static/index.mjs.map +1 -1
  23. package/dist/{index-Bmll7Xse.d.mts → index-D-Fa4Smt.d.cts} +1 -1
  24. package/dist/{index.d.mts → index.d.cts} +97 -13
  25. package/dist/index.d.ts +90 -6
  26. package/dist/index.js +2085 -153
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +2031 -106
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/pouch/index.js +3 -3
  31. package/dist/{types-Dbp5DaRR.d.mts → types-CzPDLAK6.d.cts} +1 -1
  32. package/dist/util/packer/{index.d.mts → index.d.cts} +3 -3
  33. package/dist/util/packer/index.js.map +1 -1
  34. package/dist/util/packer/index.mjs.map +1 -1
  35. package/docs/brainstorm-navigation-paradigm.md +369 -0
  36. package/docs/navigators-architecture.md +265 -0
  37. package/docs/todo-evolutionary-orchestration.md +310 -0
  38. package/docs/todo-nominal-tag-types.md +121 -0
  39. package/docs/todo-pipeline-optimization.md +117 -0
  40. package/docs/todo-strategy-authoring.md +401 -0
  41. package/docs/todo-strategy-state-storage.md +278 -0
  42. package/eslint.config.mjs +1 -1
  43. package/package.json +9 -4
  44. package/src/core/interfaces/contentSource.ts +88 -4
  45. package/src/core/interfaces/navigationStrategyManager.ts +0 -5
  46. package/src/core/navigators/CompositeGenerator.ts +268 -0
  47. package/src/core/navigators/Pipeline.ts +205 -0
  48. package/src/core/navigators/PipelineAssembler.ts +194 -0
  49. package/src/core/navigators/elo.ts +104 -15
  50. package/src/core/navigators/filters/eloDistance.ts +132 -0
  51. package/src/core/navigators/filters/index.ts +6 -0
  52. package/src/core/navigators/filters/types.ts +115 -0
  53. package/src/core/navigators/generators/index.ts +2 -0
  54. package/src/core/navigators/generators/types.ts +107 -0
  55. package/src/core/navigators/hardcodedOrder.ts +111 -12
  56. package/src/core/navigators/hierarchyDefinition.ts +266 -0
  57. package/src/core/navigators/index.ts +345 -3
  58. package/src/core/navigators/interferenceMitigator.ts +367 -0
  59. package/src/core/navigators/relativePriority.ts +267 -0
  60. package/src/core/navigators/srs.ts +195 -0
  61. package/src/impl/couch/classroomDB.ts +51 -0
  62. package/src/impl/couch/courseDB.ts +117 -39
  63. package/src/impl/static/courseDB.ts +0 -4
  64. package/src/study/SessionController.ts +149 -1
  65. package/src/study/TagFilteredContentSource.ts +255 -0
  66. package/src/study/index.ts +1 -0
  67. package/src/util/dataDirectory.test.ts +51 -22
  68. package/src/util/logger.ts +0 -1
  69. package/tests/core/navigators/CompositeGenerator.test.ts +455 -0
  70. package/tests/core/navigators/Pipeline.test.ts +405 -0
  71. package/tests/core/navigators/PipelineAssembler.test.ts +351 -0
  72. package/tests/core/navigators/SRSNavigator.test.ts +344 -0
  73. package/tests/core/navigators/eloDistanceFilter.test.ts +192 -0
  74. package/tests/core/navigators/navigators.test.ts +710 -0
  75. package/tsconfig.json +1 -1
  76. package/vitest.config.ts +29 -0
  77. package/dist/core/index.d.mts +0 -92
  78. /package/dist/{SyncStrategy-CyATpyLQ.d.mts → SyncStrategy-CyATpyLQ.d.cts} +0 -0
  79. /package/dist/pouch/{index.d.mts → index.d.cts} +0 -0
  80. /package/dist/{types-legacy-6ettoclI.d.mts → types-legacy-6ettoclI.d.cts} +0 -0
@@ -1,4 +1,4 @@
1
- import { U as UserDBInterface, a as UserDBReader, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface } from './userDB-DNa0XPtn.js';
1
+ import { U as UserDBInterface, a as UserDBReader, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface } from './classroomDB-BgfrVb8d.js';
2
2
 
3
3
  /**
4
4
  * Main factory interface for data access
@@ -1,4 +1,4 @@
1
- import { U as UserDBInterface, a as UserDBReader, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface } from './userDB-BqwxtJ_7.mjs';
1
+ import { U as UserDBInterface, a as UserDBReader, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface } from './classroomDB-CTOenngH.cjs';
2
2
 
3
3
  /**
4
4
  * Main factory interface for data access
@@ -1,10 +1,10 @@
1
- import { T as TagStub, a as Tag, S as SkuilderCourseData, Q as QualifiedCardID } from '../../types-legacy-6ettoclI.mjs';
1
+ import { T as TagStub, a as Tag, S as SkuilderCourseData, Q as QualifiedCardID } from '../../types-legacy-6ettoclI.cjs';
2
2
  import { Moment } from 'moment';
3
- import { A as AdminDBInterface, h as AssignedContent, i as StudyContentSource, j as StudentClassroomDBInterface, U as UserDBInterface, f as StudySessionReviewItem, g as ScheduledCard, S as StudySessionNewItem, T as TeacherClassroomDBInterface, b as CoursesDBInterface, C as CourseDBInterface, d as CourseInfo, D as DataLayerResult, e as ContentNavigationStrategyData, k as StudySessionItem } from '../../userDB-BqwxtJ_7.mjs';
4
- export { p as ContentSourceID, l as StudySessionFailedItem, m as StudySessionFailedNewItem, n as StudySessionFailedReviewItem, q as getStudySource, o as isReview } from '../../userDB-BqwxtJ_7.mjs';
3
+ import { A as AdminDBInterface, h as AssignedContent, i as StudyContentSource, j as StudentClassroomDBInterface, U as UserDBInterface, f as StudySessionReviewItem, g as ScheduledCard, S as StudySessionNewItem, W as WeightedCard, T as TeacherClassroomDBInterface, b as CoursesDBInterface, C as CourseDBInterface, d as CourseInfo, D as DataLayerResult, e as ContentNavigationStrategyData, k as ContentNavigator, l as StudySessionItem } from '../../classroomDB-CTOenngH.cjs';
4
+ export { q as ContentSourceID, m as StudySessionFailedItem, n as StudySessionFailedNewItem, o as StudySessionFailedReviewItem, r as getStudySource, p as isReview } from '../../classroomDB-CTOenngH.cjs';
5
5
  import * as _vue_skuilder_common from '@vue-skuilder/common';
6
6
  import { ClassroomConfig, DataShape, CourseElo, CourseConfig as CourseConfig$1 } from '@vue-skuilder/common';
7
- import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-CyATpyLQ.mjs';
7
+ import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-CyATpyLQ.cjs';
8
8
 
9
9
  type NamespacedDatashape = string;
10
10
  interface DataShape55 {
@@ -88,6 +88,17 @@ declare class StudentClassroomDB extends ClassroomDBBase implements StudyContent
88
88
  setChangeFcn(f: (value: unknown) => object): void;
89
89
  getPendingReviews(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
90
90
  getNewCards(): Promise<StudySessionNewItem[]>;
91
+ /**
92
+ * Get cards with suitability scores for presentation.
93
+ *
94
+ * This implementation wraps the legacy getNewCards/getPendingReviews methods,
95
+ * assigning score=1.0 to all cards. StudentClassroomDB does not currently
96
+ * support pluggable navigation strategies.
97
+ *
98
+ * @param limit - Maximum number of cards to return
99
+ * @returns Cards sorted by score descending (all scores = 1.0)
100
+ */
101
+ getWeightedCards(limit: number): Promise<WeightedCard[]>;
91
102
  }
92
103
  /**
93
104
  * Interface for managing a classroom.
@@ -195,9 +206,39 @@ declare class CourseDB implements StudyContentSource, CourseDBInterface {
195
206
  getAllNavigationStrategies(): Promise<ContentNavigationStrategyData[]>;
196
207
  addNavigationStrategy(data: ContentNavigationStrategyData): Promise<void>;
197
208
  updateNavigationStrategy(id: string, data: ContentNavigationStrategyData): Promise<void>;
198
- surfaceNavigationStrategy(): Promise<ContentNavigationStrategyData>;
209
+ /**
210
+ * Creates an instantiated navigator for this course.
211
+ *
212
+ * Handles multiple generators by wrapping them in CompositeGenerator.
213
+ * This is the preferred method for getting a ready-to-use navigator.
214
+ *
215
+ * @param user - User database interface
216
+ * @returns Instantiated ContentNavigator ready for use
217
+ */
218
+ createNavigator(user: UserDBInterface): Promise<ContentNavigator>;
219
+ private makeDefaultEloStrategy;
220
+ private makeDefaultSrsStrategy;
221
+ /**
222
+ * Creates the default navigation pipeline for courses with no configured strategies.
223
+ *
224
+ * Default: Pipeline(Composite(ELO, SRS), [eloDistanceFilter])
225
+ * - ELO generator: scores new cards by skill proximity
226
+ * - SRS generator: scores reviews by overdueness and interval recency
227
+ * - ELO distance filter: penalizes cards far from user's current level
228
+ */
229
+ private createDefaultPipeline;
199
230
  getNewCards(limit?: number): Promise<StudySessionNewItem[]>;
200
231
  getPendingReviews(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
232
+ /**
233
+ * Get cards with suitability scores for presentation.
234
+ *
235
+ * This is the PRIMARY API for content sources going forward. Delegates to the
236
+ * course's configured NavigationStrategy to get scored candidates.
237
+ *
238
+ * @param limit - Maximum number of cards to return
239
+ * @returns Cards sorted by score descending
240
+ */
241
+ getWeightedCards(limit: number): Promise<WeightedCard[]>;
201
242
  getCardsCenteredAtELO(options?: {
202
243
  limit: number;
203
244
  elo: 'user' | 'random' | number;
@@ -1,7 +1,7 @@
1
1
  import { T as TagStub, a as Tag, S as SkuilderCourseData, Q as QualifiedCardID } from '../../types-legacy-6ettoclI.js';
2
2
  import { Moment } from 'moment';
3
- import { A as AdminDBInterface, h as AssignedContent, i as StudyContentSource, j as StudentClassroomDBInterface, U as UserDBInterface, f as StudySessionReviewItem, g as ScheduledCard, S as StudySessionNewItem, T as TeacherClassroomDBInterface, b as CoursesDBInterface, C as CourseDBInterface, d as CourseInfo, D as DataLayerResult, e as ContentNavigationStrategyData, k as StudySessionItem } from '../../userDB-DNa0XPtn.js';
4
- export { p as ContentSourceID, l as StudySessionFailedItem, m as StudySessionFailedNewItem, n as StudySessionFailedReviewItem, q as getStudySource, o as isReview } from '../../userDB-DNa0XPtn.js';
3
+ import { A as AdminDBInterface, h as AssignedContent, i as StudyContentSource, j as StudentClassroomDBInterface, U as UserDBInterface, f as StudySessionReviewItem, g as ScheduledCard, S as StudySessionNewItem, W as WeightedCard, T as TeacherClassroomDBInterface, b as CoursesDBInterface, C as CourseDBInterface, d as CourseInfo, D as DataLayerResult, e as ContentNavigationStrategyData, k as ContentNavigator, l as StudySessionItem } from '../../classroomDB-BgfrVb8d.js';
4
+ export { q as ContentSourceID, m as StudySessionFailedItem, n as StudySessionFailedNewItem, o as StudySessionFailedReviewItem, r as getStudySource, p as isReview } from '../../classroomDB-BgfrVb8d.js';
5
5
  import * as _vue_skuilder_common from '@vue-skuilder/common';
6
6
  import { ClassroomConfig, DataShape, CourseElo, CourseConfig as CourseConfig$1 } from '@vue-skuilder/common';
7
7
  import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-CyATpyLQ.js';
@@ -88,6 +88,17 @@ declare class StudentClassroomDB extends ClassroomDBBase implements StudyContent
88
88
  setChangeFcn(f: (value: unknown) => object): void;
89
89
  getPendingReviews(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
90
90
  getNewCards(): Promise<StudySessionNewItem[]>;
91
+ /**
92
+ * Get cards with suitability scores for presentation.
93
+ *
94
+ * This implementation wraps the legacy getNewCards/getPendingReviews methods,
95
+ * assigning score=1.0 to all cards. StudentClassroomDB does not currently
96
+ * support pluggable navigation strategies.
97
+ *
98
+ * @param limit - Maximum number of cards to return
99
+ * @returns Cards sorted by score descending (all scores = 1.0)
100
+ */
101
+ getWeightedCards(limit: number): Promise<WeightedCard[]>;
91
102
  }
92
103
  /**
93
104
  * Interface for managing a classroom.
@@ -195,9 +206,39 @@ declare class CourseDB implements StudyContentSource, CourseDBInterface {
195
206
  getAllNavigationStrategies(): Promise<ContentNavigationStrategyData[]>;
196
207
  addNavigationStrategy(data: ContentNavigationStrategyData): Promise<void>;
197
208
  updateNavigationStrategy(id: string, data: ContentNavigationStrategyData): Promise<void>;
198
- surfaceNavigationStrategy(): Promise<ContentNavigationStrategyData>;
209
+ /**
210
+ * Creates an instantiated navigator for this course.
211
+ *
212
+ * Handles multiple generators by wrapping them in CompositeGenerator.
213
+ * This is the preferred method for getting a ready-to-use navigator.
214
+ *
215
+ * @param user - User database interface
216
+ * @returns Instantiated ContentNavigator ready for use
217
+ */
218
+ createNavigator(user: UserDBInterface): Promise<ContentNavigator>;
219
+ private makeDefaultEloStrategy;
220
+ private makeDefaultSrsStrategy;
221
+ /**
222
+ * Creates the default navigation pipeline for courses with no configured strategies.
223
+ *
224
+ * Default: Pipeline(Composite(ELO, SRS), [eloDistanceFilter])
225
+ * - ELO generator: scores new cards by skill proximity
226
+ * - SRS generator: scores reviews by overdueness and interval recency
227
+ * - ELO distance filter: penalizes cards far from user's current level
228
+ */
229
+ private createDefaultPipeline;
199
230
  getNewCards(limit?: number): Promise<StudySessionNewItem[]>;
200
231
  getPendingReviews(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
232
+ /**
233
+ * Get cards with suitability scores for presentation.
234
+ *
235
+ * This is the PRIMARY API for content sources going forward. Delegates to the
236
+ * course's configured NavigationStrategy to get scored candidates.
237
+ *
238
+ * @param limit - Maximum number of cards to return
239
+ * @returns Cards sorted by score descending
240
+ */
241
+ getWeightedCards(limit: number): Promise<WeightedCard[]>;
201
242
  getCardsCenteredAtELO(options?: {
202
243
  limit: number;
203
244
  elo: 'user' | 'random' | number;