@vue-skuilder/db 0.1.11-9 → 0.1.12

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 (76) hide show
  1. package/dist/core/index.d.mts +7 -6
  2. package/dist/core/index.d.ts +7 -6
  3. package/dist/core/index.js +358 -87
  4. package/dist/core/index.js.map +1 -1
  5. package/dist/core/index.mjs +358 -87
  6. package/dist/core/index.mjs.map +1 -1
  7. package/dist/{dataLayerProvider-DqtNroSh.d.ts → dataLayerProvider-BiP3kWix.d.mts} +8 -1
  8. package/dist/{dataLayerProvider-BInqI_RF.d.mts → dataLayerProvider-DSdeyRT3.d.ts} +8 -1
  9. package/dist/impl/couch/index.d.mts +19 -7
  10. package/dist/impl/couch/index.d.ts +19 -7
  11. package/dist/impl/couch/index.js +375 -100
  12. package/dist/impl/couch/index.js.map +1 -1
  13. package/dist/impl/couch/index.mjs +374 -99
  14. package/dist/impl/couch/index.mjs.map +1 -1
  15. package/dist/impl/static/index.d.mts +23 -8
  16. package/dist/impl/static/index.d.ts +23 -8
  17. package/dist/impl/static/index.js +289 -85
  18. package/dist/impl/static/index.js.map +1 -1
  19. package/dist/impl/static/index.mjs +289 -85
  20. package/dist/impl/static/index.mjs.map +1 -1
  21. package/dist/{index-CUNnL38E.d.mts → index-Bmll7Xse.d.mts} +1 -1
  22. package/dist/{index-CLL31bEy.d.ts → index-CD8BZz2k.d.ts} +1 -1
  23. package/dist/index.d.mts +123 -20
  24. package/dist/index.d.ts +123 -20
  25. package/dist/index.js +1133 -343
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +1137 -343
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/pouch/index.d.mts +1 -0
  30. package/dist/pouch/index.d.ts +1 -0
  31. package/dist/pouch/index.js +49 -0
  32. package/dist/pouch/index.js.map +1 -0
  33. package/dist/pouch/index.mjs +16 -0
  34. package/dist/pouch/index.mjs.map +1 -0
  35. package/dist/{types-BefDGkKa.d.ts → types-CewsN87z.d.ts} +1 -1
  36. package/dist/{types-DC-ckZug.d.mts → types-Dbp5DaRR.d.mts} +1 -1
  37. package/dist/{types-legacy-Birv-Jx6.d.mts → types-legacy-6ettoclI.d.mts} +17 -2
  38. package/dist/{types-legacy-Birv-Jx6.d.ts → types-legacy-6ettoclI.d.ts} +17 -2
  39. package/dist/{userDB-DusL7OXe.d.ts → userDB-C4yyAnpp.d.mts} +89 -56
  40. package/dist/{userDB-C33Hzjgn.d.mts → userDB-CD6s6ZCp.d.ts} +89 -56
  41. package/dist/util/packer/index.d.mts +3 -3
  42. package/dist/util/packer/index.d.ts +3 -3
  43. package/package.json +3 -3
  44. package/src/core/interfaces/contentSource.ts +3 -2
  45. package/src/core/interfaces/courseDB.ts +26 -3
  46. package/src/core/interfaces/dataLayerProvider.ts +9 -1
  47. package/src/core/interfaces/userDB.ts +80 -64
  48. package/src/core/navigators/elo.ts +10 -7
  49. package/src/core/navigators/hardcodedOrder.ts +64 -0
  50. package/src/core/navigators/index.ts +2 -1
  51. package/src/core/types/contentNavigationStrategy.ts +2 -1
  52. package/src/core/types/types-legacy.ts +7 -2
  53. package/src/impl/common/BaseUserDB.ts +60 -14
  54. package/src/impl/couch/CouchDBSyncStrategy.ts +2 -2
  55. package/src/impl/couch/PouchDataLayerProvider.ts +21 -0
  56. package/src/impl/couch/adminDB.ts +2 -2
  57. package/src/impl/couch/auth.ts +13 -4
  58. package/src/impl/couch/classroomDB.ts +10 -12
  59. package/src/impl/couch/courseAPI.ts +2 -2
  60. package/src/impl/couch/courseDB.ts +204 -38
  61. package/src/impl/couch/courseLookupDB.ts +4 -3
  62. package/src/impl/couch/index.ts +36 -4
  63. package/src/impl/couch/pouchdb-setup.ts +3 -3
  64. package/src/impl/couch/updateQueue.ts +59 -36
  65. package/src/impl/static/StaticDataLayerProvider.ts +68 -17
  66. package/src/impl/static/courseDB.ts +64 -20
  67. package/src/impl/static/coursesDB.ts +10 -6
  68. package/src/pouch/index.ts +2 -0
  69. package/src/study/ItemQueue.ts +58 -0
  70. package/src/study/SessionController.ts +182 -111
  71. package/src/study/SpacedRepetition.ts +1 -1
  72. package/src/study/services/CardHydrationService.ts +153 -0
  73. package/src/study/services/EloService.ts +85 -0
  74. package/src/study/services/ResponseProcessor.ts +224 -0
  75. package/src/study/services/SrsService.ts +44 -0
  76. package/tsup.config.ts +1 -0
@@ -1,21 +1,29 @@
1
- import { U as UserDBInterface, C as CourseDBInterface, a as CoursesDBInterface, b as ClassroomDBInterface, A as AdminDBInterface, c as CourseInfo, S as StudySessionNewItem, D as DataLayerResult, d as ContentNavigationStrategyData, e as StudySessionReviewItem, f as ScheduledCard } from '../../userDB-C33Hzjgn.mjs';
2
- import { D as DataLayerProvider } from '../../dataLayerProvider-BInqI_RF.mjs';
3
- import { S as StaticCourseManifest } from '../../types-DC-ckZug.mjs';
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 '../../userDB-C4yyAnpp.mjs';
2
+ import { D as DataLayerProvider } from '../../dataLayerProvider-BiP3kWix.mjs';
3
+ import { S as StaticCourseManifest } from '../../types-Dbp5DaRR.mjs';
4
4
  import { CourseConfig, CourseElo, DataShape } from '@vue-skuilder/common';
5
- import { S as SkuilderCourseData, T as TagStub, a as Tag } from '../../types-legacy-Birv-Jx6.mjs';
5
+ import { S as SkuilderCourseData, Q as QualifiedCardID, T as TagStub, a as Tag } from '../../types-legacy-6ettoclI.mjs';
6
6
  import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-CyATpyLQ.mjs';
7
7
  import 'moment';
8
8
 
9
+ interface SkuilderManifest {
10
+ name?: string;
11
+ version?: string;
12
+ description?: string;
13
+ dependencies?: Record<string, string>;
14
+ }
9
15
  interface StaticDataLayerConfig {
10
- staticContentPath: string;
11
16
  localStoragePrefix?: string;
12
- manifests: Record<string, StaticCourseManifest>;
17
+ rootManifest: SkuilderManifest;
18
+ rootManifestUrl: string;
13
19
  }
14
20
  declare class StaticDataLayerProvider implements DataLayerProvider {
15
21
  private config;
16
22
  private initialized;
17
23
  private courseUnpackers;
24
+ private manifests;
18
25
  constructor(config: Partial<StaticDataLayerConfig>);
26
+ private resolveCourseDependencies;
19
27
  initialize(): Promise<void>;
20
28
  teardown(): Promise<void>;
21
29
  getUserDB(): UserDBInterface;
@@ -23,6 +31,7 @@ declare class StaticDataLayerProvider implements DataLayerProvider {
23
31
  getCoursesDB(): CoursesDBInterface;
24
32
  getClassroomDB(_classId: string, _type: 'student' | 'teacher'): Promise<ClassroomDBInterface>;
25
33
  getAdminDB(): AdminDBInterface;
34
+ createUserReaderForUser(targetUsername: string): Promise<UserDBReader>;
26
35
  isReadOnly(): boolean;
27
36
  }
28
37
 
@@ -118,14 +127,18 @@ declare class StaticCourseDB implements CourseDBInterface {
118
127
  getCourseInfo(): Promise<CourseInfo>;
119
128
  getCourseDoc<T extends SkuilderCourseData>(id: string, _options?: PouchDB.Core.GetOptions): Promise<T>;
120
129
  getCourseDocs<T extends SkuilderCourseData>(ids: string[], _options?: PouchDB.Core.AllDocsOptions): Promise<PouchDB.Core.AllDocsWithKeysResponse<{} & T>>;
121
- getCardsByELO(elo: number, limit?: number): Promise<string[]>;
130
+ getCardsByELO(elo: number, limit?: number): Promise<{
131
+ courseID: string;
132
+ cardID: string;
133
+ elo?: number;
134
+ }[]>;
122
135
  getCardEloData(cardIds: string[]): Promise<CourseElo[]>;
123
136
  updateCardElo(cardId: string, _elo: CourseElo): Promise<PouchDB.Core.Response>;
124
137
  getNewCards(limit?: number): Promise<StudySessionNewItem[]>;
125
138
  getCardsCenteredAtELO(options: {
126
139
  limit: number;
127
140
  elo: 'user' | 'random' | number;
128
- }, filter?: (id: string) => boolean): Promise<StudySessionNewItem[]>;
141
+ }, filter?: (id: QualifiedCardID) => boolean): Promise<StudySessionNewItem[]>;
129
142
  getAppliedTags(cardId: string): Promise<PouchDB.Query.Response<TagStub>>;
130
143
  addTagToCard(_cardId: string, _tagId: string): Promise<PouchDB.Core.Response>;
131
144
  removeTagFromCard(_cardId: string, _tagId: string): Promise<PouchDB.Core.Response>;
@@ -154,6 +167,8 @@ declare class StaticCourseDB implements CourseDBInterface {
154
167
  * Internal helper method for static attachment serving
155
168
  */
156
169
  getAttachmentBlob(docId: string, attachmentName: string): Promise<Blob | Buffer | null>;
170
+ searchCards(_query: string): Promise<any[]>;
171
+ find(_request: PouchDB.Find.FindRequest<any>): Promise<PouchDB.Find.FindResponse<any>>;
157
172
  }
158
173
 
159
174
  declare class StaticCoursesDB implements CoursesDBInterface {
@@ -1,21 +1,29 @@
1
- import { U as UserDBInterface, C as CourseDBInterface, a as CoursesDBInterface, b as ClassroomDBInterface, A as AdminDBInterface, c as CourseInfo, S as StudySessionNewItem, D as DataLayerResult, d as ContentNavigationStrategyData, e as StudySessionReviewItem, f as ScheduledCard } from '../../userDB-DusL7OXe.js';
2
- import { D as DataLayerProvider } from '../../dataLayerProvider-DqtNroSh.js';
3
- import { S as StaticCourseManifest } from '../../types-BefDGkKa.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 StudySessionNewItem, D as DataLayerResult, e as ContentNavigationStrategyData, f as StudySessionReviewItem, g as ScheduledCard } from '../../userDB-CD6s6ZCp.js';
2
+ import { D as DataLayerProvider } from '../../dataLayerProvider-DSdeyRT3.js';
3
+ import { S as StaticCourseManifest } from '../../types-CewsN87z.js';
4
4
  import { CourseConfig, CourseElo, DataShape } from '@vue-skuilder/common';
5
- import { S as SkuilderCourseData, T as TagStub, a as Tag } from '../../types-legacy-Birv-Jx6.js';
5
+ import { S as SkuilderCourseData, Q as QualifiedCardID, T as TagStub, a as Tag } from '../../types-legacy-6ettoclI.js';
6
6
  import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-CyATpyLQ.js';
7
7
  import 'moment';
8
8
 
9
+ interface SkuilderManifest {
10
+ name?: string;
11
+ version?: string;
12
+ description?: string;
13
+ dependencies?: Record<string, string>;
14
+ }
9
15
  interface StaticDataLayerConfig {
10
- staticContentPath: string;
11
16
  localStoragePrefix?: string;
12
- manifests: Record<string, StaticCourseManifest>;
17
+ rootManifest: SkuilderManifest;
18
+ rootManifestUrl: string;
13
19
  }
14
20
  declare class StaticDataLayerProvider implements DataLayerProvider {
15
21
  private config;
16
22
  private initialized;
17
23
  private courseUnpackers;
24
+ private manifests;
18
25
  constructor(config: Partial<StaticDataLayerConfig>);
26
+ private resolveCourseDependencies;
19
27
  initialize(): Promise<void>;
20
28
  teardown(): Promise<void>;
21
29
  getUserDB(): UserDBInterface;
@@ -23,6 +31,7 @@ declare class StaticDataLayerProvider implements DataLayerProvider {
23
31
  getCoursesDB(): CoursesDBInterface;
24
32
  getClassroomDB(_classId: string, _type: 'student' | 'teacher'): Promise<ClassroomDBInterface>;
25
33
  getAdminDB(): AdminDBInterface;
34
+ createUserReaderForUser(targetUsername: string): Promise<UserDBReader>;
26
35
  isReadOnly(): boolean;
27
36
  }
28
37
 
@@ -118,14 +127,18 @@ declare class StaticCourseDB implements CourseDBInterface {
118
127
  getCourseInfo(): Promise<CourseInfo>;
119
128
  getCourseDoc<T extends SkuilderCourseData>(id: string, _options?: PouchDB.Core.GetOptions): Promise<T>;
120
129
  getCourseDocs<T extends SkuilderCourseData>(ids: string[], _options?: PouchDB.Core.AllDocsOptions): Promise<PouchDB.Core.AllDocsWithKeysResponse<{} & T>>;
121
- getCardsByELO(elo: number, limit?: number): Promise<string[]>;
130
+ getCardsByELO(elo: number, limit?: number): Promise<{
131
+ courseID: string;
132
+ cardID: string;
133
+ elo?: number;
134
+ }[]>;
122
135
  getCardEloData(cardIds: string[]): Promise<CourseElo[]>;
123
136
  updateCardElo(cardId: string, _elo: CourseElo): Promise<PouchDB.Core.Response>;
124
137
  getNewCards(limit?: number): Promise<StudySessionNewItem[]>;
125
138
  getCardsCenteredAtELO(options: {
126
139
  limit: number;
127
140
  elo: 'user' | 'random' | number;
128
- }, filter?: (id: string) => boolean): Promise<StudySessionNewItem[]>;
141
+ }, filter?: (id: QualifiedCardID) => boolean): Promise<StudySessionNewItem[]>;
129
142
  getAppliedTags(cardId: string): Promise<PouchDB.Query.Response<TagStub>>;
130
143
  addTagToCard(_cardId: string, _tagId: string): Promise<PouchDB.Core.Response>;
131
144
  removeTagFromCard(_cardId: string, _tagId: string): Promise<PouchDB.Core.Response>;
@@ -154,6 +167,8 @@ declare class StaticCourseDB implements CourseDBInterface {
154
167
  * Internal helper method for static attachment serving
155
168
  */
156
169
  getAttachmentBlob(docId: string, attachmentName: string): Promise<Blob | Buffer | null>;
170
+ searchCards(_query: string): Promise<any[]>;
171
+ find(_request: PouchDB.Find.FindRequest<any>): Promise<PouchDB.Find.FindResponse<any>>;
157
172
  }
158
173
 
159
174
  declare class StaticCoursesDB implements CoursesDBInterface {