@vue-skuilder/db 0.2.18 → 0.2.19

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.
@@ -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 './contentSource-CBqZCoGU.cjs';
1
+ import { U as UserDBInterface, a as UserDBReader, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface } from './contentSource-D-LQYFyx.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 './contentSource-CudEz5Tm.js';
1
+ import { U as UserDBInterface, a as UserDBReader, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface } from './contentSource-BDRX_YYJ.js';
2
2
 
3
3
  /**
4
4
  * Main factory interface for data access
@@ -1,7 +1,7 @@
1
1
  import { T as TagStub, a as Tag, S as SkuilderCourseData, Q as QualifiedCardID } from '../../types-legacy-4tlwHnXo.cjs';
2
2
  import { Moment } from 'moment';
3
- import { A as AdminDBInterface, g as AssignedContent, h as StudyContentSource, i as StudentClassroomDBInterface, U as UserDBInterface, G as GeneratorResult, T as TeacherClassroomDBInterface, b as CoursesDBInterface, C as CourseDBInterface, d as CourseInfo, D as DataLayerResult, e as ContentNavigationStrategyData, f as ContentNavigator, R as ReplanHints, S as StudySessionItem, j as ScheduledCard } from '../../contentSource-CBqZCoGU.cjs';
4
- export { q as ContentSourceID, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, n as StudySessionNewItem, o as StudySessionReviewItem, r as getStudySource, p as isReview } from '../../contentSource-CBqZCoGU.cjs';
3
+ import { A as AdminDBInterface, g as AssignedContent, h as StudyContentSource, i as StudentClassroomDBInterface, U as UserDBInterface, G as GeneratorResult, T as TeacherClassroomDBInterface, b as CoursesDBInterface, C as CourseDBInterface, d as CourseInfo, D as DataLayerResult, e as ContentNavigationStrategyData, f as ContentNavigator, R as ReplanHints, S as StudySessionItem, j as ScheduledCard } from '../../contentSource-D-LQYFyx.cjs';
4
+ export { q as ContentSourceID, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, n as StudySessionNewItem, o as StudySessionReviewItem, r as getStudySource, p as isReview } from '../../contentSource-D-LQYFyx.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
7
  import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-BJMZq3WO.cjs';
@@ -1,7 +1,7 @@
1
1
  import { T as TagStub, a as Tag, S as SkuilderCourseData, Q as QualifiedCardID } from '../../types-legacy-4tlwHnXo.js';
2
2
  import { Moment } from 'moment';
3
- import { A as AdminDBInterface, g as AssignedContent, h as StudyContentSource, i as StudentClassroomDBInterface, U as UserDBInterface, G as GeneratorResult, T as TeacherClassroomDBInterface, b as CoursesDBInterface, C as CourseDBInterface, d as CourseInfo, D as DataLayerResult, e as ContentNavigationStrategyData, f as ContentNavigator, R as ReplanHints, S as StudySessionItem, j as ScheduledCard } from '../../contentSource-CudEz5Tm.js';
4
- export { q as ContentSourceID, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, n as StudySessionNewItem, o as StudySessionReviewItem, r as getStudySource, p as isReview } from '../../contentSource-CudEz5Tm.js';
3
+ import { A as AdminDBInterface, g as AssignedContent, h as StudyContentSource, i as StudentClassroomDBInterface, U as UserDBInterface, G as GeneratorResult, T as TeacherClassroomDBInterface, b as CoursesDBInterface, C as CourseDBInterface, d as CourseInfo, D as DataLayerResult, e as ContentNavigationStrategyData, f as ContentNavigator, R as ReplanHints, S as StudySessionItem, j as ScheduledCard } from '../../contentSource-BDRX_YYJ.js';
4
+ export { q as ContentSourceID, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, n as StudySessionNewItem, o as StudySessionReviewItem, r as getStudySource, p as isReview } from '../../contentSource-BDRX_YYJ.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-BJMZq3WO.js';
@@ -7561,16 +7561,36 @@ var init_BaseUserDB = __esm({
7561
7561
  // Database to use for write operations (local-first approach)
7562
7562
  updateQueue;
7563
7563
  _hydration = { state: "not-required" };
7564
+ /** In-flight hydration, so concurrent callers can wait for a real answer. */
7565
+ _hydrationPromise = null;
7564
7566
  /**
7565
- * How far the local mirror can be trusted. See {@link UserHydrationStatus}.
7567
+ * How far the local mirror can be trusted, RIGHT NOW. See
7568
+ * {@link UserHydrationStatus}.
7566
7569
  *
7567
- * Consumers that would otherwise read a 404 as "new user" — onboarding
7568
- * gates, first-run experiences, progress dashboards should check for
7569
- * `failed` and present a retry affordance rather than an empty state.
7570
+ * This is a snapshot, and during login it can legitimately read
7571
+ * `hydrating` prefer awaitHydration() anywhere a decision hangs on the
7572
+ * answer.
7570
7573
  */
7571
7574
  hydrationStatus() {
7572
7575
  return { ...this._hydration };
7573
7576
  }
7577
+ /**
7578
+ * The hydration status once it has settled — never `hydrating`.
7579
+ *
7580
+ * Resolves immediately unless a pull is in flight. Exists for callers that
7581
+ * must decide something (a route guard, a first-run branch) and would
7582
+ * otherwise sample `hydrating` and guess. Since init() is awaited by both
7583
+ * app startup and login(), that only happens when something navigates
7584
+ * concurrently with a login still in progress — a window that stretches to
7585
+ * HYDRATION_TIMEOUT_MS on a slow connection.
7586
+ */
7587
+ async awaitHydration() {
7588
+ try {
7589
+ await this._hydrationPromise;
7590
+ } catch {
7591
+ }
7592
+ return this.hydrationStatus();
7593
+ }
7574
7594
  /**
7575
7595
  * Whether a missing document may be treated as genuinely absent, allowing
7576
7596
  * callers to create it with defaults.
@@ -8027,7 +8047,8 @@ Currently logged-in as ${this._username}.`
8027
8047
  }
8028
8048
  this.syncStrategy.stopSync?.();
8029
8049
  this.setDBandQ();
8030
- await this.hydrateLocalMirror();
8050
+ this._hydrationPromise = this.hydrateLocalMirror();
8051
+ await this._hydrationPromise;
8031
8052
  this.syncStrategy.startSync(this.localDB, this.remoteDB);
8032
8053
  this.applyDesignDocs().catch((error) => {
8033
8054
  log3(`Error in applyDesignDocs background task: ${error}`);