@vue-skuilder/db 0.1.11-7 → 0.1.11

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 (68) hide show
  1. package/dist/core/index.d.mts +5 -5
  2. package/dist/core/index.d.ts +5 -5
  3. package/dist/core/index.js +212 -50
  4. package/dist/core/index.js.map +1 -1
  5. package/dist/core/index.mjs +212 -50
  6. package/dist/core/index.mjs.map +1 -1
  7. package/dist/{dataLayerProvider-DqtNroSh.d.ts → dataLayerProvider-VieuAAkV.d.mts} +8 -1
  8. package/dist/{dataLayerProvider-BInqI_RF.d.mts → dataLayerProvider-juuqUHOP.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 +229 -63
  12. package/dist/impl/couch/index.js.map +1 -1
  13. package/dist/impl/couch/index.mjs +228 -62
  14. package/dist/impl/couch/index.mjs.map +1 -1
  15. package/dist/impl/static/index.d.mts +13 -6
  16. package/dist/impl/static/index.d.ts +13 -6
  17. package/dist/impl/static/index.js +142 -46
  18. package/dist/impl/static/index.js.map +1 -1
  19. package/dist/impl/static/index.mjs +142 -46
  20. package/dist/impl/static/index.mjs.map +1 -1
  21. package/dist/{index-CLL31bEy.d.ts → index-CWY6yhkV.d.ts} +1 -1
  22. package/dist/{index-CUNnL38E.d.mts → index-DZyxHCcf.d.mts} +1 -1
  23. package/dist/index.d.mts +28 -20
  24. package/dist/index.d.ts +28 -20
  25. package/dist/index.js +374 -108
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +378 -108
  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-DC-ckZug.d.mts → types-Che4wTwA.d.mts} +1 -1
  36. package/dist/{types-BefDGkKa.d.ts → types-DtoI27Xh.d.ts} +1 -1
  37. package/dist/{types-legacy-Birv-Jx6.d.mts → types-legacy-B8ahaCbj.d.mts} +5 -1
  38. package/dist/{types-legacy-Birv-Jx6.d.ts → types-legacy-B8ahaCbj.d.ts} +5 -1
  39. package/dist/{userDB-C33Hzjgn.d.mts → userDB-B7zTQ123.d.ts} +88 -55
  40. package/dist/{userDB-DusL7OXe.d.ts → userDB-DJ8HMw83.d.mts} +88 -55
  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/index.ts +1 -1
  50. package/src/core/types/types-legacy.ts +5 -0
  51. package/src/impl/common/BaseUserDB.ts +45 -3
  52. package/src/impl/couch/CouchDBSyncStrategy.ts +2 -2
  53. package/src/impl/couch/PouchDataLayerProvider.ts +21 -0
  54. package/src/impl/couch/adminDB.ts +2 -2
  55. package/src/impl/couch/auth.ts +13 -4
  56. package/src/impl/couch/classroomDB.ts +10 -12
  57. package/src/impl/couch/courseAPI.ts +2 -2
  58. package/src/impl/couch/courseDB.ts +130 -11
  59. package/src/impl/couch/courseLookupDB.ts +4 -3
  60. package/src/impl/couch/index.ts +36 -4
  61. package/src/impl/couch/pouchdb-setup.ts +3 -3
  62. package/src/impl/couch/updateQueue.ts +51 -33
  63. package/src/impl/static/StaticDataLayerProvider.ts +11 -0
  64. package/src/impl/static/courseDB.ts +47 -8
  65. package/src/pouch/index.ts +2 -0
  66. package/src/study/SessionController.ts +168 -51
  67. package/src/study/SpacedRepetition.ts +1 -1
  68. package/tsup.config.ts +1 -0
@@ -1,4 +1,4 @@
1
- import { P as PackerConfig, a as PackedCourseData, S as StaticCourseManifest } from './types-BefDGkKa.js';
1
+ import { P as PackerConfig, a as PackedCourseData, S as StaticCourseManifest } from './types-DtoI27Xh.js';
2
2
 
3
3
  /**
4
4
  * Abstraction for file system operations needed by the migrator.
@@ -1,4 +1,4 @@
1
- import { P as PackerConfig, a as PackedCourseData, S as StaticCourseManifest } from './types-DC-ckZug.mjs';
1
+ import { P as PackerConfig, a as PackedCourseData, S as StaticCourseManifest } from './types-Che4wTwA.mjs';
2
2
 
3
3
  /**
4
4
  * Abstraction for file system operations needed by the migrator.
package/dist/index.d.mts CHANGED
@@ -1,15 +1,15 @@
1
- import { j as StudySessionItem, h as StudyContentSource } from './userDB-C33Hzjgn.mjs';
2
- export { B as ActivityRecord, A as AdminDBInterface, s as AssignedCard, g as AssignedContent, r as AssignedCourse, q as AssignedTag, b as ClassroomDBInterface, x as ClassroomRegistration, w as ClassroomRegistrationDesignation, y as ClassroomRegistrationDoc, o as ContentSourceID, C as CourseDBInterface, c as CourseInfo, E as CourseRegistration, F as CourseRegistrationDoc, a as CoursesDBInterface, G as DocumentUpdater, f as ScheduledCard, i as StudentClassroomDBInterface, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, S as StudySessionNewItem, e as StudySessionReviewItem, T as TeacherClassroomDBInterface, z as UserConfig, u as UserCourseSetting, t as UserCourseSettings, U as UserDBInterface, v as UsrCrsDataInterface, p as getStudySource, n as isReview, H as newInterval } from './userDB-C33Hzjgn.mjs';
3
- import { D as DataLayerProvider } from './dataLayerProvider-BInqI_RF.mjs';
4
- import { C as CardRecord } from './types-legacy-Birv-Jx6.mjs';
5
- export { b as CardData, g as CardHistory, c as CourseListData, e as DataShapeData, d as DisplayableData, D as DocType, f as DocTypePrefixes, F as Field, G as GuestUsername, Q as QuestionData, h as QuestionRecord, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from './types-legacy-Birv-Jx6.mjs';
1
+ import { k as StudySessionItem, i as StudyContentSource } from './userDB-DJ8HMw83.mjs';
2
+ export { G as ActivityRecord, A as AdminDBInterface, t as AssignedCard, h as AssignedContent, s as AssignedCourse, r as AssignedTag, c as ClassroomDBInterface, B as ClassroomRegistration, z as ClassroomRegistrationDesignation, E as ClassroomRegistrationDoc, p as ContentSourceID, C as CourseDBInterface, d as CourseInfo, H as CourseRegistration, I as CourseRegistrationDoc, b as CoursesDBInterface, J as DocumentUpdater, g as ScheduledCard, j as StudentClassroomDBInterface, l as StudySessionFailedItem, m as StudySessionFailedNewItem, n as StudySessionFailedReviewItem, S as StudySessionNewItem, f as StudySessionReviewItem, T as TeacherClassroomDBInterface, F as UserConfig, x as UserCourseSetting, w as UserCourseSettings, v as UserDBAuthenticator, U as UserDBInterface, a as UserDBReader, u as UserDBWriter, y as UsrCrsDataInterface, q as getStudySource, o as isReview, K as newInterval } from './userDB-DJ8HMw83.mjs';
3
+ import { D as DataLayerProvider } from './dataLayerProvider-VieuAAkV.mjs';
4
+ import { C as CardRecord } from './types-legacy-B8ahaCbj.mjs';
5
+ export { b as CardData, h as CardHistory, c as CourseListData, e as DataShapeData, d as DisplayableData, D as DocType, g as DocTypePrefixes, F as Field, G as GuestUsername, Q as QualifiedCardID, f as QuestionData, i as QuestionRecord, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from './types-legacy-B8ahaCbj.mjs';
6
6
  import { Loggable } from './core/index.mjs';
7
7
  export { BulkCardProcessorConfig, ContentNavigator, ImportResult, Navigators, areQuestionRecords, docIsDeleted, getCardHistoryID, importParsedCards, isQuestionRecord, parseCardHistoryID, validateProcessorConfig } from './core/index.mjs';
8
- import { S as StaticCourseManifest } from './types-DC-ckZug.mjs';
9
- export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-DC-ckZug.mjs';
10
- import { F as FileSystemAdapter } from './index-CUNnL38E.mjs';
11
- export { C as CouchDBToStaticPacker, a as FileStats, b as FileSystemError } from './index-CUNnL38E.mjs';
12
- import '@vue-skuilder/common';
8
+ import { ViewData } from '@vue-skuilder/common';
9
+ import { S as StaticCourseManifest } from './types-Che4wTwA.mjs';
10
+ export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-Che4wTwA.mjs';
11
+ import { F as FileSystemAdapter } from './index-DZyxHCcf.mjs';
12
+ export { C as CouchDBToStaticPacker, a as FileStats, b as FileSystemError } from './index-DZyxHCcf.mjs';
13
13
  import 'moment';
14
14
 
15
15
  interface MigrationOptions {
@@ -203,20 +203,25 @@ interface StudySessionRecord {
203
203
  item: StudySessionItem;
204
204
  records: CardRecord[];
205
205
  }
206
- declare class SessionController extends Loggable {
206
+ interface HydratedCard<TView = unknown> {
207
+ item: StudySessionItem;
208
+ view: TView;
209
+ data: ViewData[];
210
+ }
211
+
212
+ declare class SessionController<TView = unknown> extends Loggable {
207
213
  _className: string;
208
214
  private sources;
215
+ private dataLayer;
216
+ private getViewComponent;
209
217
  private _sessionRecord;
210
218
  set sessionRecord(r: StudySessionRecord[]);
211
219
  private reviewQ;
212
220
  private newQ;
213
221
  private failedQ;
222
+ private hydratedQ;
214
223
  private _currentCard;
215
- /**
216
- * Indicates whether the session has been initialized - eg, the
217
- * queues have been populated.
218
- */
219
- private _isInitialized;
224
+ private hydration_in_progress;
220
225
  private startTime;
221
226
  private endTime;
222
227
  private _secondsRemaining;
@@ -227,7 +232,7 @@ declare class SessionController extends Loggable {
227
232
  /**
228
233
  *
229
234
  */
230
- constructor(sources: StudyContentSource[], time: number);
235
+ constructor(sources: StudyContentSource[], time: number, dataLayer: DataLayerProvider, getViewComponent: (viewId: string) => TView);
231
236
  private tick;
232
237
  /**
233
238
  * Returns a rough, erring toward conservative, guess at
@@ -249,9 +254,12 @@ declare class SessionController extends Loggable {
249
254
  reportString(): string;
250
255
  private getScheduledReviews;
251
256
  private getNewCards;
252
- private nextNewCard;
253
- nextCard(action?: 'dismiss-success' | 'dismiss-failed' | 'marked-failed' | 'dismiss-error'): StudySessionItem | null;
257
+ private _selectNextItemToHydrate;
258
+ nextCard(action?: 'dismiss-success' | 'dismiss-failed' | 'marked-failed' | 'dismiss-error'): Promise<HydratedCard<TView> | null>;
254
259
  private dismissCurrentCard;
260
+ private hasAvailableCards;
261
+ private nextHydratedCard;
262
+ private _fillHydratedQueue;
255
263
  }
256
264
 
257
265
  interface CourseLookupDoc {
@@ -333,4 +341,4 @@ declare function getDataLayer(): DataLayerProvider;
333
341
  */
334
342
  declare function _resetDataLayer(): Promise<void>;
335
343
 
336
- export { type AggregatedDocument, type AttachmentUploadResult, CardRecord, CourseLookup, DEFAULT_MIGRATION_OPTIONS, type DataLayerConfig, DataLayerProvider, type DocumentCounts, ENV, FileSystemAdapter, Loggable, type MigrationOptions, type MigrationResult, NOT_SET, type RestoreProgress, SessionController, StaticCourseManifest, type StaticCourseValidation, StaticToCouchDBMigrator, StudyContentSource, StudySessionItem, type StudySessionRecord, type ValidationIssue, type ValidationResult, _resetDataLayer, ensureAppDataDirectory, getAppDataDirectory, getDataLayer, getDbPath, getLogFilePath, initializeDataDirectory, initializeDataLayer, initializeTuiLogging, logger, showUserError, showUserMessage, validateMigration, validateStaticCourse };
344
+ export { type AggregatedDocument, type AttachmentUploadResult, CardRecord, CourseLookup, DEFAULT_MIGRATION_OPTIONS, type DataLayerConfig, DataLayerProvider, type DocumentCounts, ENV, FileSystemAdapter, type HydratedCard, Loggable, type MigrationOptions, type MigrationResult, NOT_SET, type RestoreProgress, SessionController, StaticCourseManifest, type StaticCourseValidation, StaticToCouchDBMigrator, StudyContentSource, StudySessionItem, type StudySessionRecord, type ValidationIssue, type ValidationResult, _resetDataLayer, ensureAppDataDirectory, getAppDataDirectory, getDataLayer, getDbPath, getLogFilePath, initializeDataDirectory, initializeDataLayer, initializeTuiLogging, logger, showUserError, showUserMessage, validateMigration, validateStaticCourse };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { j as StudySessionItem, h as StudyContentSource } from './userDB-DusL7OXe.js';
2
- export { B as ActivityRecord, A as AdminDBInterface, s as AssignedCard, g as AssignedContent, r as AssignedCourse, q as AssignedTag, b as ClassroomDBInterface, x as ClassroomRegistration, w as ClassroomRegistrationDesignation, y as ClassroomRegistrationDoc, o as ContentSourceID, C as CourseDBInterface, c as CourseInfo, E as CourseRegistration, F as CourseRegistrationDoc, a as CoursesDBInterface, G as DocumentUpdater, f as ScheduledCard, i as StudentClassroomDBInterface, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, S as StudySessionNewItem, e as StudySessionReviewItem, T as TeacherClassroomDBInterface, z as UserConfig, u as UserCourseSetting, t as UserCourseSettings, U as UserDBInterface, v as UsrCrsDataInterface, p as getStudySource, n as isReview, H as newInterval } from './userDB-DusL7OXe.js';
3
- import { D as DataLayerProvider } from './dataLayerProvider-DqtNroSh.js';
4
- import { C as CardRecord } from './types-legacy-Birv-Jx6.js';
5
- export { b as CardData, g as CardHistory, c as CourseListData, e as DataShapeData, d as DisplayableData, D as DocType, f as DocTypePrefixes, F as Field, G as GuestUsername, Q as QuestionData, h as QuestionRecord, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from './types-legacy-Birv-Jx6.js';
1
+ import { k as StudySessionItem, i as StudyContentSource } from './userDB-B7zTQ123.js';
2
+ export { G as ActivityRecord, A as AdminDBInterface, t as AssignedCard, h as AssignedContent, s as AssignedCourse, r as AssignedTag, c as ClassroomDBInterface, B as ClassroomRegistration, z as ClassroomRegistrationDesignation, E as ClassroomRegistrationDoc, p as ContentSourceID, C as CourseDBInterface, d as CourseInfo, H as CourseRegistration, I as CourseRegistrationDoc, b as CoursesDBInterface, J as DocumentUpdater, g as ScheduledCard, j as StudentClassroomDBInterface, l as StudySessionFailedItem, m as StudySessionFailedNewItem, n as StudySessionFailedReviewItem, S as StudySessionNewItem, f as StudySessionReviewItem, T as TeacherClassroomDBInterface, F as UserConfig, x as UserCourseSetting, w as UserCourseSettings, v as UserDBAuthenticator, U as UserDBInterface, a as UserDBReader, u as UserDBWriter, y as UsrCrsDataInterface, q as getStudySource, o as isReview, K as newInterval } from './userDB-B7zTQ123.js';
3
+ import { D as DataLayerProvider } from './dataLayerProvider-juuqUHOP.js';
4
+ import { C as CardRecord } from './types-legacy-B8ahaCbj.js';
5
+ export { b as CardData, h as CardHistory, c as CourseListData, e as DataShapeData, d as DisplayableData, D as DocType, g as DocTypePrefixes, F as Field, G as GuestUsername, Q as QualifiedCardID, f as QuestionData, i as QuestionRecord, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from './types-legacy-B8ahaCbj.js';
6
6
  import { Loggable } from './core/index.js';
7
7
  export { BulkCardProcessorConfig, ContentNavigator, ImportResult, Navigators, areQuestionRecords, docIsDeleted, getCardHistoryID, importParsedCards, isQuestionRecord, parseCardHistoryID, validateProcessorConfig } from './core/index.js';
8
- import { S as StaticCourseManifest } from './types-BefDGkKa.js';
9
- export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-BefDGkKa.js';
10
- import { F as FileSystemAdapter } from './index-CLL31bEy.js';
11
- export { C as CouchDBToStaticPacker, a as FileStats, b as FileSystemError } from './index-CLL31bEy.js';
12
- import '@vue-skuilder/common';
8
+ import { ViewData } from '@vue-skuilder/common';
9
+ import { S as StaticCourseManifest } from './types-DtoI27Xh.js';
10
+ export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-DtoI27Xh.js';
11
+ import { F as FileSystemAdapter } from './index-CWY6yhkV.js';
12
+ export { C as CouchDBToStaticPacker, a as FileStats, b as FileSystemError } from './index-CWY6yhkV.js';
13
13
  import 'moment';
14
14
 
15
15
  interface MigrationOptions {
@@ -203,20 +203,25 @@ interface StudySessionRecord {
203
203
  item: StudySessionItem;
204
204
  records: CardRecord[];
205
205
  }
206
- declare class SessionController extends Loggable {
206
+ interface HydratedCard<TView = unknown> {
207
+ item: StudySessionItem;
208
+ view: TView;
209
+ data: ViewData[];
210
+ }
211
+
212
+ declare class SessionController<TView = unknown> extends Loggable {
207
213
  _className: string;
208
214
  private sources;
215
+ private dataLayer;
216
+ private getViewComponent;
209
217
  private _sessionRecord;
210
218
  set sessionRecord(r: StudySessionRecord[]);
211
219
  private reviewQ;
212
220
  private newQ;
213
221
  private failedQ;
222
+ private hydratedQ;
214
223
  private _currentCard;
215
- /**
216
- * Indicates whether the session has been initialized - eg, the
217
- * queues have been populated.
218
- */
219
- private _isInitialized;
224
+ private hydration_in_progress;
220
225
  private startTime;
221
226
  private endTime;
222
227
  private _secondsRemaining;
@@ -227,7 +232,7 @@ declare class SessionController extends Loggable {
227
232
  /**
228
233
  *
229
234
  */
230
- constructor(sources: StudyContentSource[], time: number);
235
+ constructor(sources: StudyContentSource[], time: number, dataLayer: DataLayerProvider, getViewComponent: (viewId: string) => TView);
231
236
  private tick;
232
237
  /**
233
238
  * Returns a rough, erring toward conservative, guess at
@@ -249,9 +254,12 @@ declare class SessionController extends Loggable {
249
254
  reportString(): string;
250
255
  private getScheduledReviews;
251
256
  private getNewCards;
252
- private nextNewCard;
253
- nextCard(action?: 'dismiss-success' | 'dismiss-failed' | 'marked-failed' | 'dismiss-error'): StudySessionItem | null;
257
+ private _selectNextItemToHydrate;
258
+ nextCard(action?: 'dismiss-success' | 'dismiss-failed' | 'marked-failed' | 'dismiss-error'): Promise<HydratedCard<TView> | null>;
254
259
  private dismissCurrentCard;
260
+ private hasAvailableCards;
261
+ private nextHydratedCard;
262
+ private _fillHydratedQueue;
255
263
  }
256
264
 
257
265
  interface CourseLookupDoc {
@@ -333,4 +341,4 @@ declare function getDataLayer(): DataLayerProvider;
333
341
  */
334
342
  declare function _resetDataLayer(): Promise<void>;
335
343
 
336
- export { type AggregatedDocument, type AttachmentUploadResult, CardRecord, CourseLookup, DEFAULT_MIGRATION_OPTIONS, type DataLayerConfig, DataLayerProvider, type DocumentCounts, ENV, FileSystemAdapter, Loggable, type MigrationOptions, type MigrationResult, NOT_SET, type RestoreProgress, SessionController, StaticCourseManifest, type StaticCourseValidation, StaticToCouchDBMigrator, StudyContentSource, StudySessionItem, type StudySessionRecord, type ValidationIssue, type ValidationResult, _resetDataLayer, ensureAppDataDirectory, getAppDataDirectory, getDataLayer, getDbPath, getLogFilePath, initializeDataDirectory, initializeDataLayer, initializeTuiLogging, logger, showUserError, showUserMessage, validateMigration, validateStaticCourse };
344
+ export { type AggregatedDocument, type AttachmentUploadResult, CardRecord, CourseLookup, DEFAULT_MIGRATION_OPTIONS, type DataLayerConfig, DataLayerProvider, type DocumentCounts, ENV, FileSystemAdapter, type HydratedCard, Loggable, type MigrationOptions, type MigrationResult, NOT_SET, type RestoreProgress, SessionController, StaticCourseManifest, type StaticCourseValidation, StaticToCouchDBMigrator, StudyContentSource, StudySessionItem, type StudySessionRecord, type ValidationIssue, type ValidationResult, _resetDataLayer, ensureAppDataDirectory, getAppDataDirectory, getDataLayer, getDbPath, getLogFilePath, initializeDataDirectory, initializeDataLayer, initializeTuiLogging, logger, showUserError, showUserMessage, validateMigration, validateStaticCourse };