@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
@@ -0,0 +1 @@
1
+ export { default } from 'pouchdb';
@@ -0,0 +1 @@
1
+ export { default } from 'pouchdb';
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/pouch/index.ts
31
+ var pouch_exports = {};
32
+ __export(pouch_exports, {
33
+ default: () => pouchdb_setup_default
34
+ });
35
+ module.exports = __toCommonJS(pouch_exports);
36
+
37
+ // src/impl/couch/pouchdb-setup.ts
38
+ var import_pouchdb = __toESM(require("pouchdb"));
39
+ var import_pouchdb_find = __toESM(require("pouchdb-find"));
40
+ var import_pouchdb_authentication = __toESM(require("@nilock2/pouchdb-authentication"));
41
+ import_pouchdb.default.plugin(import_pouchdb_find.default);
42
+ import_pouchdb.default.plugin(import_pouchdb_authentication.default);
43
+ import_pouchdb.default.defaults({
44
+ // ajax: {
45
+ // timeout: 60000,
46
+ // },
47
+ });
48
+ var pouchdb_setup_default = import_pouchdb.default;
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/pouch/index.ts","../../src/impl/couch/pouchdb-setup.ts"],"sourcesContent":["// Export configured PouchDB instance\nexport { default } from '../impl/couch/pouchdb-setup.js';","import PouchDB from 'pouchdb';\nimport PouchDBFind from 'pouchdb-find';\nimport PouchDBAuth from '@nilock2/pouchdb-authentication';\n\n// Register plugins\nPouchDB.plugin(PouchDBFind);\nPouchDB.plugin(PouchDBAuth);\n\n// Configure PouchDB globally\nPouchDB.defaults({\n // ajax: {\n // timeout: 60000,\n // },\n});\n\nexport default PouchDB;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,qBAAoB;AACpB,0BAAwB;AACxB,oCAAwB;AAGxB,eAAAA,QAAQ,OAAO,oBAAAC,OAAW;AAC1B,eAAAD,QAAQ,OAAO,8BAAAE,OAAW;AAG1B,eAAAF,QAAQ,SAAS;AAAA;AAAA;AAAA;AAIjB,CAAC;AAED,IAAO,wBAAQ,eAAAA;","names":["PouchDB","PouchDBFind","PouchDBAuth"]}
@@ -0,0 +1,16 @@
1
+ // src/impl/couch/pouchdb-setup.ts
2
+ import PouchDB from "pouchdb";
3
+ import PouchDBFind from "pouchdb-find";
4
+ import PouchDBAuth from "@nilock2/pouchdb-authentication";
5
+ PouchDB.plugin(PouchDBFind);
6
+ PouchDB.plugin(PouchDBAuth);
7
+ PouchDB.defaults({
8
+ // ajax: {
9
+ // timeout: 60000,
10
+ // },
11
+ });
12
+ var pouchdb_setup_default = PouchDB;
13
+ export {
14
+ pouchdb_setup_default as default
15
+ };
16
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/impl/couch/pouchdb-setup.ts"],"sourcesContent":["import PouchDB from 'pouchdb';\nimport PouchDBFind from 'pouchdb-find';\nimport PouchDBAuth from '@nilock2/pouchdb-authentication';\n\n// Register plugins\nPouchDB.plugin(PouchDBFind);\nPouchDB.plugin(PouchDBAuth);\n\n// Configure PouchDB globally\nPouchDB.defaults({\n // ajax: {\n // timeout: 60000,\n // },\n});\n\nexport default PouchDB;\n"],"mappings":";AAAA,OAAO,aAAa;AACpB,OAAO,iBAAiB;AACxB,OAAO,iBAAiB;AAGxB,QAAQ,OAAO,WAAW;AAC1B,QAAQ,OAAO,WAAW;AAG1B,QAAQ,SAAS;AAAA;AAAA;AAAA;AAIjB,CAAC;AAED,IAAO,wBAAQ;","names":[]}
@@ -1,5 +1,5 @@
1
1
  import { CourseConfig } from '@vue-skuilder/common';
2
- import { D as DocType } from './types-legacy-Birv-Jx6.js';
2
+ import { D as DocType } from './types-legacy-6ettoclI.js';
3
3
 
4
4
  interface StaticCourseManifest {
5
5
  version: string;
@@ -1,5 +1,5 @@
1
1
  import { CourseConfig } from '@vue-skuilder/common';
2
- import { D as DocType } from './types-legacy-Birv-Jx6.mjs';
2
+ import { D as DocType } from './types-legacy-6ettoclI.mjs';
3
3
 
4
4
  interface StaticCourseManifest {
5
5
  version: string;
@@ -15,6 +15,10 @@ declare enum DocType {
15
15
  TAG = "TAG",
16
16
  NAVIGATION_STRATEGY = "NAVIGATION_STRATEGY"
17
17
  }
18
+ interface QualifiedCardID {
19
+ courseID: string;
20
+ cardID: string;
21
+ }
18
22
  /**
19
23
  * Interface for all data on course content and pedagogy stored
20
24
  * in the c/pouch database.
@@ -74,7 +78,18 @@ interface QuestionData extends SkuilderCourseData {
74
78
  viewList: string[];
75
79
  dataShapeList: PouchDB.Core.DocumentId[];
76
80
  }
77
- declare const DocTypePrefixes: Record<string, string>;
81
+ declare const DocTypePrefixes: {
82
+ readonly CARD: "c";
83
+ readonly DISPLAYABLE_DATA: "dd";
84
+ readonly TAG: "TAG";
85
+ readonly CARDRECORD: "cardH";
86
+ readonly SCHEDULED_CARD: "card_review_";
87
+ readonly DATASHAPE: "DATASHAPE";
88
+ readonly QUESTION: "QUESTION";
89
+ readonly VIEW: "VIEW";
90
+ readonly PEDAGOGY: "PEDAGOGY";
91
+ readonly NAVIGATION_STRATEGY: "NAVIGATION_STRATEGY";
92
+ };
78
93
  interface CardHistory<T extends CardRecord> {
79
94
  _id: PouchDB.Core.DocumentId;
80
95
  /**
@@ -136,4 +151,4 @@ interface QuestionRecord extends CardRecord, Evaluation {
136
151
  priorAttemps: number;
137
152
  }
138
153
 
139
- export { type CardRecord as C, DocType as D, type Field as F, GuestUsername as G, type QuestionData as Q, type SkuilderCourseData as S, type TagStub as T, type Tag as a, type CardData as b, type CourseListData as c, type DisplayableData as d, type DataShapeData as e, DocTypePrefixes as f, type CardHistory as g, type QuestionRecord as h, log as l };
154
+ export { type CardHistory as C, DocType as D, type Field as F, GuestUsername as G, type QualifiedCardID as Q, type SkuilderCourseData as S, type TagStub as T, type Tag as a, DocTypePrefixes as b, type CardRecord as c, type CardData as d, type CourseListData as e, type DisplayableData as f, type DataShapeData as g, type QuestionData as h, type QuestionRecord as i, log as l };
@@ -15,6 +15,10 @@ declare enum DocType {
15
15
  TAG = "TAG",
16
16
  NAVIGATION_STRATEGY = "NAVIGATION_STRATEGY"
17
17
  }
18
+ interface QualifiedCardID {
19
+ courseID: string;
20
+ cardID: string;
21
+ }
18
22
  /**
19
23
  * Interface for all data on course content and pedagogy stored
20
24
  * in the c/pouch database.
@@ -74,7 +78,18 @@ interface QuestionData extends SkuilderCourseData {
74
78
  viewList: string[];
75
79
  dataShapeList: PouchDB.Core.DocumentId[];
76
80
  }
77
- declare const DocTypePrefixes: Record<string, string>;
81
+ declare const DocTypePrefixes: {
82
+ readonly CARD: "c";
83
+ readonly DISPLAYABLE_DATA: "dd";
84
+ readonly TAG: "TAG";
85
+ readonly CARDRECORD: "cardH";
86
+ readonly SCHEDULED_CARD: "card_review_";
87
+ readonly DATASHAPE: "DATASHAPE";
88
+ readonly QUESTION: "QUESTION";
89
+ readonly VIEW: "VIEW";
90
+ readonly PEDAGOGY: "PEDAGOGY";
91
+ readonly NAVIGATION_STRATEGY: "NAVIGATION_STRATEGY";
92
+ };
78
93
  interface CardHistory<T extends CardRecord> {
79
94
  _id: PouchDB.Core.DocumentId;
80
95
  /**
@@ -136,4 +151,4 @@ interface QuestionRecord extends CardRecord, Evaluation {
136
151
  priorAttemps: number;
137
152
  }
138
153
 
139
- export { type CardRecord as C, DocType as D, type Field as F, GuestUsername as G, type QuestionData as Q, type SkuilderCourseData as S, type TagStub as T, type Tag as a, type CardData as b, type CourseListData as c, type DisplayableData as d, type DataShapeData as e, DocTypePrefixes as f, type CardHistory as g, type QuestionRecord as h, log as l };
154
+ export { type CardHistory as C, DocType as D, type Field as F, GuestUsername as G, type QualifiedCardID as Q, type SkuilderCourseData as S, type TagStub as T, type Tag as a, DocTypePrefixes as b, type CardRecord as c, type CardData as d, type CourseListData as e, type DisplayableData as f, type DataShapeData as g, type QuestionData as h, type QuestionRecord as i, log as l };
@@ -1,6 +1,6 @@
1
1
  import { CourseConfig, ClassroomConfig, CourseElo, Status, SkuilderCourseData as SkuilderCourseData$1, DataShape } from '@vue-skuilder/common';
2
2
  import { Moment } from 'moment';
3
- import { S as SkuilderCourseData, D as DocType, T as TagStub, a as Tag, g as CardHistory, C as CardRecord } from './types-legacy-Birv-Jx6.js';
3
+ import { S as SkuilderCourseData, b as DocTypePrefixes, D as DocType, Q as QualifiedCardID, T as TagStub, a as Tag, C as CardHistory, c as CardRecord } from './types-legacy-6ettoclI.mjs';
4
4
 
5
5
  /**
6
6
  * Admin functionality
@@ -109,11 +109,11 @@ interface StudySessionReviewItem extends StudySessionItem {
109
109
  declare function isReview(item: StudySessionItem): item is StudySessionReviewItem;
110
110
  interface StudySessionItem {
111
111
  status: 'new' | 'review' | 'failed-new' | 'failed-review';
112
- qualifiedID: `${string}-${string}` | `${string}-${string}-${number}`;
113
- cardID: string;
114
112
  contentSourceType: 'course' | 'classroom';
115
113
  contentSourceID: string;
114
+ cardID: string;
116
115
  courseID: string;
116
+ elo?: number;
117
117
  }
118
118
  interface ContentSourceID {
119
119
  type: 'course' | 'classroom';
@@ -199,7 +199,7 @@ interface DataLayerResult {
199
199
  *
200
200
  */
201
201
  interface ContentNavigationStrategyData extends SkuilderCourseData {
202
- id: string;
202
+ _id: `${typeof DocTypePrefixes[DocType.NAVIGATION_STRATEGY]}-${string}`;
203
203
  docType: DocType.NAVIGATION_STRATEGY;
204
204
  name: string;
205
205
  description: string;
@@ -283,7 +283,11 @@ interface CourseDBInterface extends NavigationStrategyManager {
283
283
  /**
284
284
  * Get cards sorted by ELO rating
285
285
  */
286
- getCardsByELO(elo: number, limit?: number): Promise<string[]>;
286
+ getCardsByELO(elo: number, limit?: number): Promise<{
287
+ courseID: string;
288
+ cardID: string;
289
+ elo?: number;
290
+ }[]>;
287
291
  /**
288
292
  * Get ELO data for specific cards
289
293
  */
@@ -302,7 +306,7 @@ interface CourseDBInterface extends NavigationStrategyManager {
302
306
  getCardsCenteredAtELO(options: {
303
307
  limit: number;
304
308
  elo: 'user' | 'random' | number;
305
- }, filter?: (id: string) => boolean): Promise<StudySessionItem[]>;
309
+ }, filter?: (card: QualifiedCardID) => boolean): Promise<StudySessionItem[]>;
306
310
  /**
307
311
  * Get tags for a card
308
312
  */
@@ -344,6 +348,18 @@ interface CourseDBInterface extends NavigationStrategyManager {
344
348
  count: number;
345
349
  elo: CourseElo;
346
350
  }[]>;
351
+ /**
352
+ * Search for cards by text content
353
+ * @param query Text to search for
354
+ * @returns Array of matching card data
355
+ */
356
+ searchCards(query: string): Promise<any[]>;
357
+ /**
358
+ * Find documents using PouchDB query syntax
359
+ * @param request PouchDB find request
360
+ * @returns Query response
361
+ */
362
+ find(request: PouchDB.Find.FindRequest<any>): Promise<PouchDB.Find.FindResponse<any>>;
347
363
  }
348
364
 
349
365
  type Update<T> = Partial<T> | ((x: T) => T);
@@ -360,44 +376,16 @@ interface DocumentUpdater {
360
376
  declare function newInterval(user: DocumentUpdater, cardHistory: CardHistory<CardRecord>): number;
361
377
 
362
378
  /**
363
- * User data and authentication
379
+ * Read-only user data operations
364
380
  */
365
- interface UserDBInterface extends DocumentUpdater {
366
- /**
367
- * Create a new user account
368
- */
369
- createAccount(username: string, password: string): Promise<{
370
- status: Status;
371
- error: string;
372
- }>;
373
- /**
374
- * Log in as a user
375
- */
376
- login(username: string, password: string): Promise<{
377
- ok: boolean;
378
- name?: string;
379
- roles?: string[];
380
- }>;
381
- /**
382
- * Log out the current user
383
- */
384
- logout(): Promise<{
385
- ok: boolean;
386
- }>;
381
+ interface UserDBReader {
382
+ get<T>(id: string): Promise<T & PouchDB.Core.RevisionIdMeta>;
387
383
  getUsername(): string;
388
384
  isLoggedIn(): boolean;
389
385
  /**
390
386
  * Get user configuration
391
387
  */
392
388
  getConfig(): Promise<UserConfig>;
393
- /**
394
- * Update user configuration
395
- */
396
- setConfig(config: Partial<UserConfig>): Promise<void>;
397
- /**
398
- * Record a user's interaction with a card
399
- */
400
- putCardRecord<T extends CardRecord>(record: T): Promise<CardHistory<CardRecord>>;
401
389
  /**
402
390
  * Get cards that the user has seen
403
391
  */
@@ -405,15 +393,7 @@ interface UserDBInterface extends DocumentUpdater {
405
393
  /**
406
394
  * Get cards that are actively scheduled for review
407
395
  */
408
- getActiveCards(): Promise<string[]>;
409
- /**
410
- * Register user for a course
411
- */
412
- registerForCourse(courseId: string, previewMode?: boolean): Promise<PouchDB.Core.Response>;
413
- /**
414
- * Drop a course registration
415
- */
416
- dropCourse(courseId: string, dropStatus?: string): Promise<PouchDB.Core.Response>;
396
+ getActiveCards(): Promise<QualifiedCardID[]>;
417
397
  /**
418
398
  * Get user's course registrations
419
399
  */
@@ -432,6 +412,36 @@ interface UserDBInterface extends DocumentUpdater {
432
412
  */
433
413
  getPendingReviews(courseId?: string): Promise<ScheduledCard[]>;
434
414
  getActivityRecords(): Promise<ActivityRecord[]>;
415
+ /**
416
+ * Get user's classroom registrations
417
+ */
418
+ getUserClassrooms(): Promise<ClassroomRegistrationDoc>;
419
+ /**
420
+ * Get user's active classes
421
+ */
422
+ getActiveClasses(): Promise<string[]>;
423
+ getCourseInterface(courseId: string): Promise<UsrCrsDataInterface>;
424
+ }
425
+ /**
426
+ * User data mutation operations
427
+ */
428
+ interface UserDBWriter extends DocumentUpdater {
429
+ /**
430
+ * Update user configuration
431
+ */
432
+ setConfig(config: Partial<UserConfig>): Promise<void>;
433
+ /**
434
+ * Record a user's interaction with a card
435
+ */
436
+ putCardRecord<T extends CardRecord>(record: T): Promise<CardHistory<CardRecord>>;
437
+ /**
438
+ * Register user for a course
439
+ */
440
+ registerForCourse(courseId: string, previewMode?: boolean): Promise<PouchDB.Core.Response>;
441
+ /**
442
+ * Drop a course registration
443
+ */
444
+ dropCourse(courseId: string, dropStatus?: string): Promise<PouchDB.Core.Response>;
435
445
  /**
436
446
  * Schedule a card for review
437
447
  */
@@ -455,14 +465,6 @@ interface UserDBInterface extends DocumentUpdater {
455
465
  * Drop user from classroom
456
466
  */
457
467
  dropFromClassroom(classId: string): Promise<PouchDB.Core.Response>;
458
- /**
459
- * Get user's classroom registrations
460
- */
461
- getUserClassrooms(): Promise<ClassroomRegistrationDoc>;
462
- /**
463
- * Get user's active classes
464
- */
465
- getActiveClasses(): Promise<string[]>;
466
468
  /**
467
469
  * Update user's ELO rating for a course
468
470
  */
@@ -474,7 +476,38 @@ interface UserDBInterface extends DocumentUpdater {
474
476
  status: Status;
475
477
  error?: string;
476
478
  }>;
477
- getCourseInterface(courseId: string): Promise<UsrCrsDataInterface>;
479
+ }
480
+ /**
481
+ * Authentication and account management operations
482
+ */
483
+ interface UserDBAuthenticator {
484
+ /**
485
+ * Create a new user account
486
+ */
487
+ createAccount(username: string, password: string): Promise<{
488
+ status: Status;
489
+ error: string;
490
+ }>;
491
+ /**
492
+ * Log in as a user
493
+ */
494
+ login(username: string, password: string): Promise<{
495
+ ok: boolean;
496
+ name?: string;
497
+ roles?: string[];
498
+ }>;
499
+ /**
500
+ * Log out the current user
501
+ */
502
+ logout(): Promise<{
503
+ ok: boolean;
504
+ }>;
505
+ }
506
+ /**
507
+ * Complete user database interface - combines all user operations
508
+ * This maintains backward compatibility with existing code
509
+ */
510
+ interface UserDBInterface extends UserDBReader, UserDBWriter, UserDBAuthenticator {
478
511
  }
479
512
  interface UserCourseSettings {
480
513
  [setting: string]: string | number | boolean;
@@ -497,4 +530,4 @@ interface ClassroomRegistrationDoc {
497
530
  registrations: ClassroomRegistration[];
498
531
  }
499
532
 
500
- export { type AdminDBInterface as A, type ActivityRecord as B, type CourseDBInterface as C, type DataLayerResult as D, type CourseRegistration as E, type CourseRegistrationDoc as F, type DocumentUpdater as G, newInterval as H, type StudySessionNewItem as S, type TeacherClassroomDBInterface as T, type UserDBInterface as U, type CoursesDBInterface as a, type ClassroomDBInterface as b, type CourseInfo as c, type ContentNavigationStrategyData as d, type StudySessionReviewItem as e, type ScheduledCard as f, type AssignedContent as g, type StudyContentSource as h, type StudentClassroomDBInterface as i, type StudySessionItem as j, type StudySessionFailedItem as k, type StudySessionFailedNewItem as l, type StudySessionFailedReviewItem as m, isReview as n, type ContentSourceID as o, getStudySource as p, type AssignedTag as q, type AssignedCourse as r, type AssignedCard as s, type UserCourseSettings as t, type UserCourseSetting as u, type UsrCrsDataInterface as v, type ClassroomRegistrationDesignation as w, type ClassroomRegistration as x, type ClassroomRegistrationDoc as y, type UserConfig as z };
533
+ export { type AdminDBInterface as A, type ClassroomRegistrationDesignation as B, type CourseDBInterface as C, type DataLayerResult as D, type ClassroomRegistration as E, type ClassroomRegistrationDoc as F, type UserConfig as G, type ActivityRecord as H, type CourseRegistration as I, type DocumentUpdater as J, newInterval as K, type StudySessionNewItem as S, type TeacherClassroomDBInterface as T, type UserDBInterface as U, type UserDBReader as a, type CoursesDBInterface as b, type ClassroomDBInterface as c, type CourseInfo as d, type ContentNavigationStrategyData as e, type StudySessionReviewItem as f, type ScheduledCard as g, type AssignedContent as h, type StudyContentSource as i, type StudentClassroomDBInterface as j, type StudySessionItem as k, type StudySessionFailedItem as l, type StudySessionFailedNewItem as m, type StudySessionFailedReviewItem as n, isReview as o, type ContentSourceID as p, getStudySource as q, type CourseRegistrationDoc as r, type AssignedTag as s, type AssignedCourse as t, type AssignedCard as u, type UserDBWriter as v, type UserDBAuthenticator as w, type UserCourseSettings as x, type UserCourseSetting as y, type UsrCrsDataInterface as z };
@@ -1,6 +1,6 @@
1
1
  import { CourseConfig, ClassroomConfig, CourseElo, Status, SkuilderCourseData as SkuilderCourseData$1, DataShape } from '@vue-skuilder/common';
2
2
  import { Moment } from 'moment';
3
- import { S as SkuilderCourseData, D as DocType, T as TagStub, a as Tag, g as CardHistory, C as CardRecord } from './types-legacy-Birv-Jx6.mjs';
3
+ import { S as SkuilderCourseData, b as DocTypePrefixes, D as DocType, Q as QualifiedCardID, T as TagStub, a as Tag, C as CardHistory, c as CardRecord } from './types-legacy-6ettoclI.js';
4
4
 
5
5
  /**
6
6
  * Admin functionality
@@ -109,11 +109,11 @@ interface StudySessionReviewItem extends StudySessionItem {
109
109
  declare function isReview(item: StudySessionItem): item is StudySessionReviewItem;
110
110
  interface StudySessionItem {
111
111
  status: 'new' | 'review' | 'failed-new' | 'failed-review';
112
- qualifiedID: `${string}-${string}` | `${string}-${string}-${number}`;
113
- cardID: string;
114
112
  contentSourceType: 'course' | 'classroom';
115
113
  contentSourceID: string;
114
+ cardID: string;
116
115
  courseID: string;
116
+ elo?: number;
117
117
  }
118
118
  interface ContentSourceID {
119
119
  type: 'course' | 'classroom';
@@ -199,7 +199,7 @@ interface DataLayerResult {
199
199
  *
200
200
  */
201
201
  interface ContentNavigationStrategyData extends SkuilderCourseData {
202
- id: string;
202
+ _id: `${typeof DocTypePrefixes[DocType.NAVIGATION_STRATEGY]}-${string}`;
203
203
  docType: DocType.NAVIGATION_STRATEGY;
204
204
  name: string;
205
205
  description: string;
@@ -283,7 +283,11 @@ interface CourseDBInterface extends NavigationStrategyManager {
283
283
  /**
284
284
  * Get cards sorted by ELO rating
285
285
  */
286
- getCardsByELO(elo: number, limit?: number): Promise<string[]>;
286
+ getCardsByELO(elo: number, limit?: number): Promise<{
287
+ courseID: string;
288
+ cardID: string;
289
+ elo?: number;
290
+ }[]>;
287
291
  /**
288
292
  * Get ELO data for specific cards
289
293
  */
@@ -302,7 +306,7 @@ interface CourseDBInterface extends NavigationStrategyManager {
302
306
  getCardsCenteredAtELO(options: {
303
307
  limit: number;
304
308
  elo: 'user' | 'random' | number;
305
- }, filter?: (id: string) => boolean): Promise<StudySessionItem[]>;
309
+ }, filter?: (card: QualifiedCardID) => boolean): Promise<StudySessionItem[]>;
306
310
  /**
307
311
  * Get tags for a card
308
312
  */
@@ -344,6 +348,18 @@ interface CourseDBInterface extends NavigationStrategyManager {
344
348
  count: number;
345
349
  elo: CourseElo;
346
350
  }[]>;
351
+ /**
352
+ * Search for cards by text content
353
+ * @param query Text to search for
354
+ * @returns Array of matching card data
355
+ */
356
+ searchCards(query: string): Promise<any[]>;
357
+ /**
358
+ * Find documents using PouchDB query syntax
359
+ * @param request PouchDB find request
360
+ * @returns Query response
361
+ */
362
+ find(request: PouchDB.Find.FindRequest<any>): Promise<PouchDB.Find.FindResponse<any>>;
347
363
  }
348
364
 
349
365
  type Update<T> = Partial<T> | ((x: T) => T);
@@ -360,44 +376,16 @@ interface DocumentUpdater {
360
376
  declare function newInterval(user: DocumentUpdater, cardHistory: CardHistory<CardRecord>): number;
361
377
 
362
378
  /**
363
- * User data and authentication
379
+ * Read-only user data operations
364
380
  */
365
- interface UserDBInterface extends DocumentUpdater {
366
- /**
367
- * Create a new user account
368
- */
369
- createAccount(username: string, password: string): Promise<{
370
- status: Status;
371
- error: string;
372
- }>;
373
- /**
374
- * Log in as a user
375
- */
376
- login(username: string, password: string): Promise<{
377
- ok: boolean;
378
- name?: string;
379
- roles?: string[];
380
- }>;
381
- /**
382
- * Log out the current user
383
- */
384
- logout(): Promise<{
385
- ok: boolean;
386
- }>;
381
+ interface UserDBReader {
382
+ get<T>(id: string): Promise<T & PouchDB.Core.RevisionIdMeta>;
387
383
  getUsername(): string;
388
384
  isLoggedIn(): boolean;
389
385
  /**
390
386
  * Get user configuration
391
387
  */
392
388
  getConfig(): Promise<UserConfig>;
393
- /**
394
- * Update user configuration
395
- */
396
- setConfig(config: Partial<UserConfig>): Promise<void>;
397
- /**
398
- * Record a user's interaction with a card
399
- */
400
- putCardRecord<T extends CardRecord>(record: T): Promise<CardHistory<CardRecord>>;
401
389
  /**
402
390
  * Get cards that the user has seen
403
391
  */
@@ -405,15 +393,7 @@ interface UserDBInterface extends DocumentUpdater {
405
393
  /**
406
394
  * Get cards that are actively scheduled for review
407
395
  */
408
- getActiveCards(): Promise<string[]>;
409
- /**
410
- * Register user for a course
411
- */
412
- registerForCourse(courseId: string, previewMode?: boolean): Promise<PouchDB.Core.Response>;
413
- /**
414
- * Drop a course registration
415
- */
416
- dropCourse(courseId: string, dropStatus?: string): Promise<PouchDB.Core.Response>;
396
+ getActiveCards(): Promise<QualifiedCardID[]>;
417
397
  /**
418
398
  * Get user's course registrations
419
399
  */
@@ -432,6 +412,36 @@ interface UserDBInterface extends DocumentUpdater {
432
412
  */
433
413
  getPendingReviews(courseId?: string): Promise<ScheduledCard[]>;
434
414
  getActivityRecords(): Promise<ActivityRecord[]>;
415
+ /**
416
+ * Get user's classroom registrations
417
+ */
418
+ getUserClassrooms(): Promise<ClassroomRegistrationDoc>;
419
+ /**
420
+ * Get user's active classes
421
+ */
422
+ getActiveClasses(): Promise<string[]>;
423
+ getCourseInterface(courseId: string): Promise<UsrCrsDataInterface>;
424
+ }
425
+ /**
426
+ * User data mutation operations
427
+ */
428
+ interface UserDBWriter extends DocumentUpdater {
429
+ /**
430
+ * Update user configuration
431
+ */
432
+ setConfig(config: Partial<UserConfig>): Promise<void>;
433
+ /**
434
+ * Record a user's interaction with a card
435
+ */
436
+ putCardRecord<T extends CardRecord>(record: T): Promise<CardHistory<CardRecord>>;
437
+ /**
438
+ * Register user for a course
439
+ */
440
+ registerForCourse(courseId: string, previewMode?: boolean): Promise<PouchDB.Core.Response>;
441
+ /**
442
+ * Drop a course registration
443
+ */
444
+ dropCourse(courseId: string, dropStatus?: string): Promise<PouchDB.Core.Response>;
435
445
  /**
436
446
  * Schedule a card for review
437
447
  */
@@ -455,14 +465,6 @@ interface UserDBInterface extends DocumentUpdater {
455
465
  * Drop user from classroom
456
466
  */
457
467
  dropFromClassroom(classId: string): Promise<PouchDB.Core.Response>;
458
- /**
459
- * Get user's classroom registrations
460
- */
461
- getUserClassrooms(): Promise<ClassroomRegistrationDoc>;
462
- /**
463
- * Get user's active classes
464
- */
465
- getActiveClasses(): Promise<string[]>;
466
468
  /**
467
469
  * Update user's ELO rating for a course
468
470
  */
@@ -474,7 +476,38 @@ interface UserDBInterface extends DocumentUpdater {
474
476
  status: Status;
475
477
  error?: string;
476
478
  }>;
477
- getCourseInterface(courseId: string): Promise<UsrCrsDataInterface>;
479
+ }
480
+ /**
481
+ * Authentication and account management operations
482
+ */
483
+ interface UserDBAuthenticator {
484
+ /**
485
+ * Create a new user account
486
+ */
487
+ createAccount(username: string, password: string): Promise<{
488
+ status: Status;
489
+ error: string;
490
+ }>;
491
+ /**
492
+ * Log in as a user
493
+ */
494
+ login(username: string, password: string): Promise<{
495
+ ok: boolean;
496
+ name?: string;
497
+ roles?: string[];
498
+ }>;
499
+ /**
500
+ * Log out the current user
501
+ */
502
+ logout(): Promise<{
503
+ ok: boolean;
504
+ }>;
505
+ }
506
+ /**
507
+ * Complete user database interface - combines all user operations
508
+ * This maintains backward compatibility with existing code
509
+ */
510
+ interface UserDBInterface extends UserDBReader, UserDBWriter, UserDBAuthenticator {
478
511
  }
479
512
  interface UserCourseSettings {
480
513
  [setting: string]: string | number | boolean;
@@ -497,4 +530,4 @@ interface ClassroomRegistrationDoc {
497
530
  registrations: ClassroomRegistration[];
498
531
  }
499
532
 
500
- export { type AdminDBInterface as A, type ActivityRecord as B, type CourseDBInterface as C, type DataLayerResult as D, type CourseRegistration as E, type CourseRegistrationDoc as F, type DocumentUpdater as G, newInterval as H, type StudySessionNewItem as S, type TeacherClassroomDBInterface as T, type UserDBInterface as U, type CoursesDBInterface as a, type ClassroomDBInterface as b, type CourseInfo as c, type ContentNavigationStrategyData as d, type StudySessionReviewItem as e, type ScheduledCard as f, type AssignedContent as g, type StudyContentSource as h, type StudentClassroomDBInterface as i, type StudySessionItem as j, type StudySessionFailedItem as k, type StudySessionFailedNewItem as l, type StudySessionFailedReviewItem as m, isReview as n, type ContentSourceID as o, getStudySource as p, type AssignedTag as q, type AssignedCourse as r, type AssignedCard as s, type UserCourseSettings as t, type UserCourseSetting as u, type UsrCrsDataInterface as v, type ClassroomRegistrationDesignation as w, type ClassroomRegistration as x, type ClassroomRegistrationDoc as y, type UserConfig as z };
533
+ export { type AdminDBInterface as A, type ClassroomRegistrationDesignation as B, type CourseDBInterface as C, type DataLayerResult as D, type ClassroomRegistration as E, type ClassroomRegistrationDoc as F, type UserConfig as G, type ActivityRecord as H, type CourseRegistration as I, type DocumentUpdater as J, newInterval as K, type StudySessionNewItem as S, type TeacherClassroomDBInterface as T, type UserDBInterface as U, type UserDBReader as a, type CoursesDBInterface as b, type ClassroomDBInterface as c, type CourseInfo as d, type ContentNavigationStrategyData as e, type StudySessionReviewItem as f, type ScheduledCard as g, type AssignedContent as h, type StudyContentSource as i, type StudentClassroomDBInterface as j, type StudySessionItem as k, type StudySessionFailedItem as l, type StudySessionFailedNewItem as m, type StudySessionFailedReviewItem as n, isReview as o, type ContentSourceID as p, getStudySource as q, type CourseRegistrationDoc as r, type AssignedTag as s, type AssignedCourse as t, type AssignedCard as u, type UserDBWriter as v, type UserDBAuthenticator as w, type UserCourseSettings as x, type UserCourseSetting as y, type UsrCrsDataInterface as z };
@@ -1,5 +1,5 @@
1
- export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig, S as StaticCourseManifest } from '../../types-DC-ckZug.mjs';
2
- export { C as CouchDBToStaticPacker } from '../../index-CUNnL38E.mjs';
1
+ export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig, S as StaticCourseManifest } from '../../types-Dbp5DaRR.mjs';
2
+ export { C as CouchDBToStaticPacker } from '../../index-Bmll7Xse.mjs';
3
3
  import '@vue-skuilder/common';
4
- import '../../types-legacy-Birv-Jx6.mjs';
4
+ import '../../types-legacy-6ettoclI.mjs';
5
5
  import 'moment';
@@ -1,5 +1,5 @@
1
- export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig, S as StaticCourseManifest } from '../../types-BefDGkKa.js';
2
- export { C as CouchDBToStaticPacker } from '../../index-CLL31bEy.js';
1
+ export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig, S as StaticCourseManifest } from '../../types-CewsN87z.js';
2
+ export { C as CouchDBToStaticPacker } from '../../index-CD8BZz2k.js';
3
3
  import '@vue-skuilder/common';
4
- import '../../types-legacy-Birv-Jx6.js';
4
+ import '../../types-legacy-6ettoclI.js';
5
5
  import 'moment';