@vue-skuilder/db 0.1.17 → 0.1.20

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 (92) hide show
  1. package/dist/{userDB-BqwxtJ_7.d.mts → classroomDB-CZdMBiTU.d.ts} +427 -104
  2. package/dist/{userDB-DNa0XPtn.d.ts → classroomDB-PxDZTky3.d.cts} +427 -104
  3. package/dist/core/index.d.cts +304 -0
  4. package/dist/core/index.d.ts +237 -25
  5. package/dist/core/index.js +2246 -118
  6. package/dist/core/index.js.map +1 -1
  7. package/dist/core/index.mjs +2235 -114
  8. package/dist/core/index.mjs.map +1 -1
  9. package/dist/{dataLayerProvider-VlngD19_.d.mts → dataLayerProvider-D0MoZMjH.d.cts} +1 -1
  10. package/dist/{dataLayerProvider-BV5iZqt_.d.ts → dataLayerProvider-D8o6ZnKW.d.ts} +1 -1
  11. package/dist/impl/couch/{index.d.mts → index.d.cts} +47 -5
  12. package/dist/impl/couch/index.d.ts +46 -4
  13. package/dist/impl/couch/index.js +2250 -134
  14. package/dist/impl/couch/index.js.map +1 -1
  15. package/dist/impl/couch/index.mjs +2212 -97
  16. package/dist/impl/couch/index.mjs.map +1 -1
  17. package/dist/impl/static/{index.d.mts → index.d.cts} +6 -6
  18. package/dist/impl/static/index.d.ts +5 -5
  19. package/dist/impl/static/index.js +1950 -143
  20. package/dist/impl/static/index.js.map +1 -1
  21. package/dist/impl/static/index.mjs +1922 -117
  22. package/dist/impl/static/index.mjs.map +1 -1
  23. package/dist/{index-Bmll7Xse.d.mts → index-B_j6u5E4.d.cts} +1 -1
  24. package/dist/{index-CD8BZz2k.d.ts → index-Dj0SEgk3.d.ts} +1 -1
  25. package/dist/{index.d.mts → index.d.cts} +97 -13
  26. package/dist/index.d.ts +96 -12
  27. package/dist/index.js +2439 -180
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +2386 -135
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/pouch/index.js +3 -3
  32. package/dist/{types-Dbp5DaRR.d.mts → types-Bn0itutr.d.cts} +1 -1
  33. package/dist/{types-CewsN87z.d.ts → types-DQaXnuoc.d.ts} +1 -1
  34. package/dist/{types-legacy-6ettoclI.d.ts → types-legacy-DDY4N-Uq.d.cts} +3 -1
  35. package/dist/{types-legacy-6ettoclI.d.mts → types-legacy-DDY4N-Uq.d.ts} +3 -1
  36. package/dist/util/packer/{index.d.mts → index.d.cts} +3 -3
  37. package/dist/util/packer/index.d.ts +3 -3
  38. package/dist/util/packer/index.js.map +1 -1
  39. package/dist/util/packer/index.mjs.map +1 -1
  40. package/docs/brainstorm-navigation-paradigm.md +369 -0
  41. package/docs/navigators-architecture.md +370 -0
  42. package/docs/todo-evolutionary-orchestration.md +310 -0
  43. package/docs/todo-nominal-tag-types.md +121 -0
  44. package/docs/todo-strategy-authoring.md +401 -0
  45. package/eslint.config.mjs +1 -1
  46. package/package.json +9 -4
  47. package/src/core/index.ts +1 -0
  48. package/src/core/interfaces/contentSource.ts +88 -4
  49. package/src/core/interfaces/courseDB.ts +13 -0
  50. package/src/core/interfaces/navigationStrategyManager.ts +0 -5
  51. package/src/core/interfaces/userDB.ts +32 -0
  52. package/src/core/navigators/CompositeGenerator.ts +268 -0
  53. package/src/core/navigators/Pipeline.ts +318 -0
  54. package/src/core/navigators/PipelineAssembler.ts +194 -0
  55. package/src/core/navigators/elo.ts +104 -15
  56. package/src/core/navigators/filters/eloDistance.ts +132 -0
  57. package/src/core/navigators/filters/index.ts +9 -0
  58. package/src/core/navigators/filters/types.ts +115 -0
  59. package/src/core/navigators/filters/userTagPreference.ts +232 -0
  60. package/src/core/navigators/generators/index.ts +2 -0
  61. package/src/core/navigators/generators/types.ts +107 -0
  62. package/src/core/navigators/hardcodedOrder.ts +111 -12
  63. package/src/core/navigators/hierarchyDefinition.ts +266 -0
  64. package/src/core/navigators/index.ts +404 -3
  65. package/src/core/navigators/inferredPreference.ts +107 -0
  66. package/src/core/navigators/interferenceMitigator.ts +355 -0
  67. package/src/core/navigators/relativePriority.ts +255 -0
  68. package/src/core/navigators/srs.ts +195 -0
  69. package/src/core/navigators/userGoal.ts +136 -0
  70. package/src/core/types/strategyState.ts +84 -0
  71. package/src/core/types/types-legacy.ts +2 -0
  72. package/src/impl/common/BaseUserDB.ts +74 -7
  73. package/src/impl/couch/adminDB.ts +1 -2
  74. package/src/impl/couch/classroomDB.ts +51 -0
  75. package/src/impl/couch/courseDB.ts +147 -49
  76. package/src/impl/static/courseDB.ts +11 -4
  77. package/src/study/SessionController.ts +149 -1
  78. package/src/study/TagFilteredContentSource.ts +255 -0
  79. package/src/study/index.ts +1 -0
  80. package/src/util/dataDirectory.test.ts +51 -22
  81. package/src/util/logger.ts +0 -1
  82. package/tests/core/navigators/CompositeGenerator.test.ts +455 -0
  83. package/tests/core/navigators/Pipeline.test.ts +406 -0
  84. package/tests/core/navigators/PipelineAssembler.test.ts +351 -0
  85. package/tests/core/navigators/SRSNavigator.test.ts +344 -0
  86. package/tests/core/navigators/eloDistanceFilter.test.ts +192 -0
  87. package/tests/core/navigators/navigators.test.ts +710 -0
  88. package/tsconfig.json +1 -1
  89. package/vitest.config.ts +29 -0
  90. package/dist/core/index.d.mts +0 -92
  91. /package/dist/{SyncStrategy-CyATpyLQ.d.mts → SyncStrategy-CyATpyLQ.d.cts} +0 -0
  92. /package/dist/pouch/{index.d.mts → index.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-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-PxDZTky3.cjs';
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-DNa0XPtn.js';
1
+ import { U as UserDBInterface, a as UserDBReader, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface } from './classroomDB-CZdMBiTU.js';
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-DDY4N-Uq.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-PxDZTky3.cjs';
4
+ export { q as ContentSourceID, m as StudySessionFailedItem, n as StudySessionFailedNewItem, o as StudySessionFailedReviewItem, r as getStudySource, p as isReview } from '../../classroomDB-PxDZTky3.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.
@@ -180,6 +191,7 @@ declare class CourseDB implements StudyContentSource, CourseDBInterface {
180
191
  updateCourseConfig(cfg: CourseConfig$1): Promise<PouchDB.Core.Response>;
181
192
  updateCardElo(cardId: string, elo: CourseElo): Promise<PouchDB.Core.Response>;
182
193
  getAppliedTags(cardId: string): Promise<PouchDB.Query.Response<TagStub>>;
194
+ getAppliedTagsBatch(cardIds: string[]): Promise<Map<string, string[]>>;
183
195
  addTagToCard(cardId: string, tagId: string, updateELO?: boolean): Promise<PouchDB.Core.Response>;
184
196
  removeTagFromCard(cardId: string, tagId: string): Promise<PouchDB.Core.Response>;
185
197
  createTag(name: string, author: string): Promise<PouchDB.Core.Response>;
@@ -195,9 +207,39 @@ declare class CourseDB implements StudyContentSource, CourseDBInterface {
195
207
  getAllNavigationStrategies(): Promise<ContentNavigationStrategyData[]>;
196
208
  addNavigationStrategy(data: ContentNavigationStrategyData): Promise<void>;
197
209
  updateNavigationStrategy(id: string, data: ContentNavigationStrategyData): Promise<void>;
198
- surfaceNavigationStrategy(): Promise<ContentNavigationStrategyData>;
210
+ /**
211
+ * Creates an instantiated navigator for this course.
212
+ *
213
+ * Handles multiple generators by wrapping them in CompositeGenerator.
214
+ * This is the preferred method for getting a ready-to-use navigator.
215
+ *
216
+ * @param user - User database interface
217
+ * @returns Instantiated ContentNavigator ready for use
218
+ */
219
+ createNavigator(user: UserDBInterface): Promise<ContentNavigator>;
220
+ private makeDefaultEloStrategy;
221
+ private makeDefaultSrsStrategy;
222
+ /**
223
+ * Creates the default navigation pipeline for courses with no configured strategies.
224
+ *
225
+ * Default: Pipeline(Composite(ELO, SRS), [eloDistanceFilter])
226
+ * - ELO generator: scores new cards by skill proximity
227
+ * - SRS generator: scores reviews by overdueness and interval recency
228
+ * - ELO distance filter: penalizes cards far from user's current level
229
+ */
230
+ private createDefaultPipeline;
199
231
  getNewCards(limit?: number): Promise<StudySessionNewItem[]>;
200
232
  getPendingReviews(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
233
+ /**
234
+ * Get cards with suitability scores for presentation.
235
+ *
236
+ * This is the PRIMARY API for content sources going forward. Delegates to the
237
+ * course's configured NavigationStrategy to get scored candidates.
238
+ *
239
+ * @param limit - Maximum number of cards to return
240
+ * @returns Cards sorted by score descending
241
+ */
242
+ getWeightedCards(limit: number): Promise<WeightedCard[]>;
201
243
  getCardsCenteredAtELO(options?: {
202
244
  limit: number;
203
245
  elo: 'user' | 'random' | number;
@@ -1,7 +1,7 @@
1
- import { T as TagStub, a as Tag, S as SkuilderCourseData, Q as QualifiedCardID } from '../../types-legacy-6ettoclI.js';
1
+ import { T as TagStub, a as Tag, S as SkuilderCourseData, Q as QualifiedCardID } from '../../types-legacy-DDY4N-Uq.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-CZdMBiTU.js';
4
+ export { q as ContentSourceID, m as StudySessionFailedItem, n as StudySessionFailedNewItem, o as StudySessionFailedReviewItem, r as getStudySource, p as isReview } from '../../classroomDB-CZdMBiTU.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.
@@ -180,6 +191,7 @@ declare class CourseDB implements StudyContentSource, CourseDBInterface {
180
191
  updateCourseConfig(cfg: CourseConfig$1): Promise<PouchDB.Core.Response>;
181
192
  updateCardElo(cardId: string, elo: CourseElo): Promise<PouchDB.Core.Response>;
182
193
  getAppliedTags(cardId: string): Promise<PouchDB.Query.Response<TagStub>>;
194
+ getAppliedTagsBatch(cardIds: string[]): Promise<Map<string, string[]>>;
183
195
  addTagToCard(cardId: string, tagId: string, updateELO?: boolean): Promise<PouchDB.Core.Response>;
184
196
  removeTagFromCard(cardId: string, tagId: string): Promise<PouchDB.Core.Response>;
185
197
  createTag(name: string, author: string): Promise<PouchDB.Core.Response>;
@@ -195,9 +207,39 @@ declare class CourseDB implements StudyContentSource, CourseDBInterface {
195
207
  getAllNavigationStrategies(): Promise<ContentNavigationStrategyData[]>;
196
208
  addNavigationStrategy(data: ContentNavigationStrategyData): Promise<void>;
197
209
  updateNavigationStrategy(id: string, data: ContentNavigationStrategyData): Promise<void>;
198
- surfaceNavigationStrategy(): Promise<ContentNavigationStrategyData>;
210
+ /**
211
+ * Creates an instantiated navigator for this course.
212
+ *
213
+ * Handles multiple generators by wrapping them in CompositeGenerator.
214
+ * This is the preferred method for getting a ready-to-use navigator.
215
+ *
216
+ * @param user - User database interface
217
+ * @returns Instantiated ContentNavigator ready for use
218
+ */
219
+ createNavigator(user: UserDBInterface): Promise<ContentNavigator>;
220
+ private makeDefaultEloStrategy;
221
+ private makeDefaultSrsStrategy;
222
+ /**
223
+ * Creates the default navigation pipeline for courses with no configured strategies.
224
+ *
225
+ * Default: Pipeline(Composite(ELO, SRS), [eloDistanceFilter])
226
+ * - ELO generator: scores new cards by skill proximity
227
+ * - SRS generator: scores reviews by overdueness and interval recency
228
+ * - ELO distance filter: penalizes cards far from user's current level
229
+ */
230
+ private createDefaultPipeline;
199
231
  getNewCards(limit?: number): Promise<StudySessionNewItem[]>;
200
232
  getPendingReviews(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
233
+ /**
234
+ * Get cards with suitability scores for presentation.
235
+ *
236
+ * This is the PRIMARY API for content sources going forward. Delegates to the
237
+ * course's configured NavigationStrategy to get scored candidates.
238
+ *
239
+ * @param limit - Maximum number of cards to return
240
+ * @returns Cards sorted by score descending
241
+ */
242
+ getWeightedCards(limit: number): Promise<WeightedCard[]>;
201
243
  getCardsCenteredAtELO(options?: {
202
244
  limit: number;
203
245
  elo: 'user' | 'random' | number;