@vue-skuilder/db 0.1.20 → 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.
Files changed (70) hide show
  1. package/CLAUDE.md +2 -2
  2. package/dist/{classroomDB-CZdMBiTU.d.ts → contentSource-BP9hznNV.d.ts} +150 -196
  3. package/dist/{classroomDB-PxDZTky3.d.cts → contentSource-DsJadoBU.d.cts} +150 -196
  4. package/dist/core/index.d.cts +3 -3
  5. package/dist/core/index.d.ts +3 -3
  6. package/dist/core/index.js +615 -1758
  7. package/dist/core/index.js.map +1 -1
  8. package/dist/core/index.mjs +579 -1727
  9. package/dist/core/index.mjs.map +1 -1
  10. package/dist/{dataLayerProvider-D8o6ZnKW.d.ts → dataLayerProvider-CHYrQ5pB.d.cts} +1 -1
  11. package/dist/{dataLayerProvider-D0MoZMjH.d.cts → dataLayerProvider-MDTxXq2l.d.ts} +1 -1
  12. package/dist/impl/couch/index.d.cts +6 -22
  13. package/dist/impl/couch/index.d.ts +6 -22
  14. package/dist/impl/couch/index.js +598 -1769
  15. package/dist/impl/couch/index.js.map +1 -1
  16. package/dist/impl/couch/index.mjs +579 -1755
  17. package/dist/impl/couch/index.mjs.map +1 -1
  18. package/dist/impl/static/index.d.cts +22 -6
  19. package/dist/impl/static/index.d.ts +22 -6
  20. package/dist/impl/static/index.js +617 -1629
  21. package/dist/impl/static/index.js.map +1 -1
  22. package/dist/impl/static/index.mjs +607 -1624
  23. package/dist/impl/static/index.mjs.map +1 -1
  24. package/dist/index.d.cts +64 -56
  25. package/dist/index.d.ts +64 -56
  26. package/dist/index.js +1000 -2161
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +970 -2127
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/pouch/index.js +3 -0
  31. package/dist/pouch/index.js.map +1 -1
  32. package/dist/pouch/index.mjs +3 -0
  33. package/dist/pouch/index.mjs.map +1 -1
  34. package/docs/navigators-architecture.md +2 -9
  35. package/package.json +3 -3
  36. package/src/core/interfaces/classroomDB.ts +5 -13
  37. package/src/core/interfaces/contentSource.ts +6 -66
  38. package/src/core/interfaces/courseDB.ts +2 -7
  39. package/src/core/navigators/Pipeline.ts +24 -53
  40. package/src/core/navigators/PipelineAssembler.ts +1 -1
  41. package/src/core/navigators/defaults.ts +84 -0
  42. package/src/core/navigators/{hierarchyDefinition.ts → filters/hierarchyDefinition.ts} +11 -25
  43. package/src/core/navigators/{interferenceMitigator.ts → filters/interferenceMitigator.ts} +10 -24
  44. package/src/core/navigators/{relativePriority.ts → filters/relativePriority.ts} +10 -24
  45. package/src/core/navigators/filters/userTagPreference.ts +1 -16
  46. package/src/core/navigators/{CompositeGenerator.ts → generators/CompositeGenerator.ts} +15 -64
  47. package/src/core/navigators/{elo.ts → generators/elo.ts} +13 -63
  48. package/src/core/navigators/{srs.ts → generators/srs.ts} +11 -40
  49. package/src/core/navigators/generators/types.ts +1 -1
  50. package/src/core/navigators/index.ts +36 -91
  51. package/src/impl/couch/classroomDB.ts +100 -103
  52. package/src/impl/couch/courseDB.ts +5 -81
  53. package/src/impl/couch/pouchdb-setup.ts +7 -0
  54. package/src/impl/static/StaticDataUnpacker.ts +50 -1
  55. package/src/impl/static/courseDB.ts +76 -37
  56. package/src/study/SessionController.ts +122 -202
  57. package/src/study/SourceMixer.ts +65 -0
  58. package/src/study/TagFilteredContentSource.ts +49 -92
  59. package/src/study/index.ts +1 -0
  60. package/src/study/services/CardHydrationService.ts +165 -81
  61. package/src/util/dataDirectory.ts +1 -1
  62. package/src/util/index.ts +0 -1
  63. package/tests/core/navigators/CompositeGenerator.test.ts +44 -168
  64. package/tests/core/navigators/Pipeline.test.ts +5 -72
  65. package/tests/core/navigators/PipelineAssembler.test.ts +8 -58
  66. package/tests/core/navigators/navigators.test.ts +118 -151
  67. package/src/core/navigators/hardcodedOrder.ts +0 -163
  68. package/src/util/tuiLogger.ts +0 -139
  69. /package/src/core/navigators/{inferredPreference.ts → filters/inferredPreferenceStub.ts} +0 -0
  70. /package/src/core/navigators/{userGoal.ts → filters/userGoalStub.ts} +0 -0
@@ -1,5 +1,5 @@
1
- import { U as UserDBInterface, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface, a as UserDBReader, d as CourseInfo, S as StudySessionNewItem, D as DataLayerResult, e as ContentNavigationStrategyData, f as StudySessionReviewItem, g as ScheduledCard } from '../../classroomDB-PxDZTky3.cjs';
2
- import { D as DataLayerProvider } from '../../dataLayerProvider-D0MoZMjH.cjs';
1
+ import { U as UserDBInterface, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface, a as UserDBReader, d as CourseInfo, S as StudySessionItem, D as DataLayerResult, e as ContentNavigationStrategyData, f as ContentNavigator, W as WeightedCard } from '../../contentSource-DsJadoBU.cjs';
2
+ import { D as DataLayerProvider } from '../../dataLayerProvider-CHYrQ5pB.cjs';
3
3
  import { S as StaticCourseManifest } from '../../types-Bn0itutr.cjs';
4
4
  import { CourseConfig, CourseElo, DataShape } from '@vue-skuilder/common';
5
5
  import { S as SkuilderCourseData, Q as QualifiedCardID, T as TagStub, a as Tag } from '../../types-legacy-DDY4N-Uq.cjs';
@@ -51,6 +51,16 @@ declare class StaticDataUnpacker {
51
51
  * Get a document by ID, loading from appropriate chunk if needed
52
52
  */
53
53
  getDocument<T = any>(id: string): Promise<T>;
54
+ /**
55
+ * Get all documents with IDs starting with a specific prefix.
56
+ *
57
+ * This method loads the relevant chunk(s) and returns all matching documents.
58
+ * Useful for querying documents by type (e.g., all NAVIGATION_STRATEGY documents).
59
+ *
60
+ * @param prefix - Document ID prefix to match (e.g., "NAVIGATION_STRATEGY")
61
+ * @returns Array of all documents with IDs starting with the prefix
62
+ */
63
+ getAllDocumentsByPrefix(prefix: string): Promise<any[]>;
54
64
  /**
55
65
  * Query cards by ELO score, returning card IDs sorted by ELO
56
66
  */
@@ -135,11 +145,10 @@ declare class StaticCourseDB implements CourseDBInterface {
135
145
  }[]>;
136
146
  getCardEloData(cardIds: string[]): Promise<CourseElo[]>;
137
147
  updateCardElo(cardId: string, _elo: CourseElo): Promise<PouchDB.Core.Response>;
138
- getNewCards(limit?: number): Promise<StudySessionNewItem[]>;
139
148
  getCardsCenteredAtELO(options: {
140
149
  limit: number;
141
150
  elo: 'user' | 'random' | number;
142
- }, filter?: (id: QualifiedCardID) => boolean): Promise<StudySessionNewItem[]>;
151
+ }, filter?: (id: QualifiedCardID) => boolean): Promise<StudySessionItem[]>;
143
152
  getAppliedTags(cardId: string): Promise<PouchDB.Query.Response<TagStub>>;
144
153
  getAppliedTagsBatch(cardIds: string[]): Promise<Map<string, string[]>>;
145
154
  addTagToCard(_cardId: string, _tagId: string): Promise<PouchDB.Core.Response>;
@@ -153,11 +162,18 @@ declare class StaticCourseDB implements CourseDBInterface {
153
162
  }, _elo?: CourseElo): Promise<DataLayerResult>;
154
163
  removeCard(_cardId: string): Promise<PouchDB.Core.Response>;
155
164
  getInexperiencedCards(): Promise<any[]>;
156
- getNavigationStrategy(_id: string): Promise<ContentNavigationStrategyData>;
165
+ getNavigationStrategy(id: string): Promise<ContentNavigationStrategyData>;
157
166
  getAllNavigationStrategies(): Promise<ContentNavigationStrategyData[]>;
158
167
  addNavigationStrategy(_data: ContentNavigationStrategyData): Promise<void>;
159
168
  updateNavigationStrategy(_id: string, _data: ContentNavigationStrategyData): Promise<void>;
160
- getPendingReviews(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
169
+ /**
170
+ * Create a ContentNavigator for this course.
171
+ *
172
+ * Loads navigation strategy documents from static data and uses PipelineAssembler
173
+ * to build a Pipeline. Falls back to default pipeline if no strategies found.
174
+ */
175
+ createNavigator(user: UserDBInterface): Promise<ContentNavigator>;
176
+ getWeightedCards(limit: number): Promise<WeightedCard[]>;
161
177
  /**
162
178
  * Get attachment URL for a document and attachment name
163
179
  * Internal helper method for static attachment serving
@@ -1,5 +1,5 @@
1
- import { U as UserDBInterface, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface, a as UserDBReader, d as CourseInfo, S as StudySessionNewItem, D as DataLayerResult, e as ContentNavigationStrategyData, f as StudySessionReviewItem, g as ScheduledCard } from '../../classroomDB-CZdMBiTU.js';
2
- import { D as DataLayerProvider } from '../../dataLayerProvider-D8o6ZnKW.js';
1
+ import { U as UserDBInterface, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface, a as UserDBReader, d as CourseInfo, S as StudySessionItem, D as DataLayerResult, e as ContentNavigationStrategyData, f as ContentNavigator, W as WeightedCard } from '../../contentSource-BP9hznNV.js';
2
+ import { D as DataLayerProvider } from '../../dataLayerProvider-MDTxXq2l.js';
3
3
  import { S as StaticCourseManifest } from '../../types-DQaXnuoc.js';
4
4
  import { CourseConfig, CourseElo, DataShape } from '@vue-skuilder/common';
5
5
  import { S as SkuilderCourseData, Q as QualifiedCardID, T as TagStub, a as Tag } from '../../types-legacy-DDY4N-Uq.js';
@@ -51,6 +51,16 @@ declare class StaticDataUnpacker {
51
51
  * Get a document by ID, loading from appropriate chunk if needed
52
52
  */
53
53
  getDocument<T = any>(id: string): Promise<T>;
54
+ /**
55
+ * Get all documents with IDs starting with a specific prefix.
56
+ *
57
+ * This method loads the relevant chunk(s) and returns all matching documents.
58
+ * Useful for querying documents by type (e.g., all NAVIGATION_STRATEGY documents).
59
+ *
60
+ * @param prefix - Document ID prefix to match (e.g., "NAVIGATION_STRATEGY")
61
+ * @returns Array of all documents with IDs starting with the prefix
62
+ */
63
+ getAllDocumentsByPrefix(prefix: string): Promise<any[]>;
54
64
  /**
55
65
  * Query cards by ELO score, returning card IDs sorted by ELO
56
66
  */
@@ -135,11 +145,10 @@ declare class StaticCourseDB implements CourseDBInterface {
135
145
  }[]>;
136
146
  getCardEloData(cardIds: string[]): Promise<CourseElo[]>;
137
147
  updateCardElo(cardId: string, _elo: CourseElo): Promise<PouchDB.Core.Response>;
138
- getNewCards(limit?: number): Promise<StudySessionNewItem[]>;
139
148
  getCardsCenteredAtELO(options: {
140
149
  limit: number;
141
150
  elo: 'user' | 'random' | number;
142
- }, filter?: (id: QualifiedCardID) => boolean): Promise<StudySessionNewItem[]>;
151
+ }, filter?: (id: QualifiedCardID) => boolean): Promise<StudySessionItem[]>;
143
152
  getAppliedTags(cardId: string): Promise<PouchDB.Query.Response<TagStub>>;
144
153
  getAppliedTagsBatch(cardIds: string[]): Promise<Map<string, string[]>>;
145
154
  addTagToCard(_cardId: string, _tagId: string): Promise<PouchDB.Core.Response>;
@@ -153,11 +162,18 @@ declare class StaticCourseDB implements CourseDBInterface {
153
162
  }, _elo?: CourseElo): Promise<DataLayerResult>;
154
163
  removeCard(_cardId: string): Promise<PouchDB.Core.Response>;
155
164
  getInexperiencedCards(): Promise<any[]>;
156
- getNavigationStrategy(_id: string): Promise<ContentNavigationStrategyData>;
165
+ getNavigationStrategy(id: string): Promise<ContentNavigationStrategyData>;
157
166
  getAllNavigationStrategies(): Promise<ContentNavigationStrategyData[]>;
158
167
  addNavigationStrategy(_data: ContentNavigationStrategyData): Promise<void>;
159
168
  updateNavigationStrategy(_id: string, _data: ContentNavigationStrategyData): Promise<void>;
160
- getPendingReviews(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
169
+ /**
170
+ * Create a ContentNavigator for this course.
171
+ *
172
+ * Loads navigation strategy documents from static data and uses PipelineAssembler
173
+ * to build a Pipeline. Falls back to default pipeline if no strategies found.
174
+ */
175
+ createNavigator(user: UserDBInterface): Promise<ContentNavigator>;
176
+ getWeightedCards(limit: number): Promise<WeightedCard[]>;
161
177
  /**
162
178
  * Get attachment URL for a document and attachment name
163
179
  * Internal helper method for static attachment serving