@vue-skuilder/standalone-ui 0.2.17 → 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.
- package/dist/assets/{TagViewer-Dna5v2Eb.js → TagViewer-SbXPg9P4.js} +2 -2
- package/dist/assets/{TagViewer-Dna5v2Eb.js.map → TagViewer-SbXPg9P4.js.map} +1 -1
- package/dist/assets/common-ui.es-CRkWh55S.js +1 -0
- package/dist/assets/{common-ui.es-DLmRVq1W.js → common-ui.es-CUSpHlcb.js} +4 -4
- package/dist/assets/{common-ui.es-DLmRVq1W.js.map → common-ui.es-CUSpHlcb.js.map} +1 -1
- package/dist/assets/{dist-DTlcpk3F.js → dist-1dW4ne-r.js} +7 -7
- package/dist/assets/{dist-DTlcpk3F.js.map → dist-1dW4ne-r.js.map} +1 -1
- package/dist/assets/{index-DDgb6Bcu.js → index-BVDwtHzk.js} +5 -5
- package/dist/assets/{index-DDgb6Bcu.js.map → index-BVDwtHzk.js.map} +1 -1
- package/dist/index.html +3 -3
- package/dist-lib/questions.cjs.js +8 -8
- package/dist-lib/questions.cjs.js.map +1 -1
- package/dist-lib/questions.mjs +121 -18
- package/dist-lib/questions.mjs.map +1 -1
- package/package.json +6 -6
- package/dist/assets/common-ui.es-B2FxUhyq.js +0 -1
package/dist-lib/questions.mjs
CHANGED
|
@@ -24639,6 +24639,7 @@ var init_v4 = __esmMin((() => {
|
|
|
24639
24639
|
ENV: () => ENV,
|
|
24640
24640
|
FileSystemError: () => FileSystemError,
|
|
24641
24641
|
GuestUsername: () => GuestUsername,
|
|
24642
|
+
HYDRATION_MARKER_ID: () => HYDRATION_MARKER_ID,
|
|
24642
24643
|
Loggable: () => Loggable,
|
|
24643
24644
|
NOT_SET: () => NOT_SET,
|
|
24644
24645
|
NavigatorRole: () => NavigatorRole,
|
|
@@ -25791,6 +25792,14 @@ function getStartAndEndKeys2(t) {
|
|
|
25791
25792
|
endkey: t + ""
|
|
25792
25793
|
};
|
|
25793
25794
|
}
|
|
25795
|
+
function withTimeout(t, c, u) {
|
|
25796
|
+
let d;
|
|
25797
|
+
return Promise.race([t, new Promise((t, m) => {
|
|
25798
|
+
d = setTimeout(() => m(/* @__PURE__ */ Error(`${u} timed out after ${c}ms`)), c);
|
|
25799
|
+
})]).finally(() => {
|
|
25800
|
+
d !== void 0 && clearTimeout(d);
|
|
25801
|
+
});
|
|
25802
|
+
}
|
|
25794
25803
|
function accomodateGuest() {
|
|
25795
25804
|
if (logger.log("[funnel] accomodateGuest() called"), typeof localStorage > "u") return logger.log("[funnel] localStorage not available (Node.js environment), returning default guest"), {
|
|
25796
25805
|
username: GuestUsername + "nodejs-test",
|
|
@@ -26887,7 +26896,7 @@ function mountSessionDebugger() {
|
|
|
26887
26896
|
let t = window;
|
|
26888
26897
|
t.skuilder = t.skuilder || {}, t.skuilder.session = sessionDebugAPI;
|
|
26889
26898
|
}
|
|
26890
|
-
var import___vite_browser_external, import___vite_browser_external$1, import___vite_browser_external$2, import_browser_ponyfill, import_browser_ponyfill$1, import_browser, _SessionController2, __defProp, __getOwnPropNames, __glob, __esm, __export, init_adminDB, init_classroomDB, init_SyncStrategy, isDevelopment, logger, init_logger, GuestUsername, log, DocType, DocTypePrefixes, init_types_legacy, init_util, pouchdb_setup_default, init_pouchdb_setup, init_dataDirectory, REVIEW_TIME_FORMAT, log2, init_userDBHelpers, Loggable, init_Loggable, UpdateQueue, init_updateQueue, UsrCrsData, init_user_course_relDB, CLIENT_CACHE, init_clientCache, AlreadyTaggedErr, init_courseAPI, courseLookupDBTitle, CourseLookup, init_courseLookupDB, diversityRerank_exports, DIVERSITY_STRENGTH, DIVERSITY_FLOOR, STRATEGY, STRATEGY_ID, STRATEGY_NAME, init_diversityRerank, PipelineDebugger_exports, _activePipeline, MAX_RUNS, runHistory, DISCARDED_KEEP_TOP, _uiContainer, _selectedRunIndex, _cardSearchQuery, pipelineDebugAPI, init_PipelineDebugger, SrsDebugger_exports, snapshots, init_SrsDebugger, StrategyPressureDebugger_exports, snapshots2, init_StrategyPressureDebugger, CompositeGenerator_exports, AggregationMode, DEFAULT_AGGREGATION_MODE, FREQUENCY_BOOST_FACTOR, CompositeGenerator, init_CompositeGenerator, elo_exports, ELO_RELEVANCE_SIGMA, ELONavigator, init_elo, generators_exports, init_generators, prescribed_exports, DEFAULT_FRESHNESS_WINDOW, DEFAULT_MAX_DIRECT_PER_RUN, DEFAULT_MAX_SUPPORT_PER_RUN, DEFAULT_HIERARCHY_DEPTH, DEFAULT_MIN_COUNT, DEFAULT_PRACTICE_MIN_COUNT, DEFAULT_MAX_PRACTICE_PER_RUN, BASE_TARGET_SCORE, BASE_SUPPORT_SCORE, DISCOVERED_SUPPORT_SCORE, BASE_PRACTICE_SCORE, PRACTICE_BASE_MULT, MAX_PRACTICE_MULTIPLIER, PRACTICE_STALENESS_BUMP_PER_DAY, MAX_TARGET_MULTIPLIER, MAX_SUPPORT_MULTIPLIER, PRESCRIBED_DEBUG_VERSION, PrescribedCardsGenerator, init_prescribed, srs_exports, DEFAULT_HEALTHY_BACKLOG, BACKLOG_GROWTH_RATE, SRSNavigator, init_srs, types_exports, init_types, globImport_generators, init_, DEFAULT_LEARNABLE_WEIGHT, init_contentNavigationStrategy, WeightedFilter_exports, WeightedFilter, init_WeightedFilter, eloDistance_exports, DEFAULT_HALF_LIFE, DEFAULT_MIN_MULTIPLIER, DEFAULT_MAX_MULTIPLIER, init_eloDistance, hierarchyDefinition_exports, DEFAULT_MIN_COUNT2, HierarchyDefinitionNavigator, init_hierarchyDefinition, userTagPreference_exports, UserTagPreferenceFilter, init_userTagPreference, filters_exports, init_filters, inferredPreferenceStub_exports, INFERRED_PREFERENCE_NAVIGATOR_STUB, init_inferredPreferenceStub, interferenceMitigator_exports, DEFAULT_MIN_COUNT3, DEFAULT_MIN_ELAPSED_DAYS, DEFAULT_INTERFERENCE_DECAY, InterferenceMitigatorNavigator, init_interferenceMitigator, relativePriority_exports, DEFAULT_PRIORITY, DEFAULT_PRIORITY_INFLUENCE, DEFAULT_COMBINE_MODE, RelativePriorityNavigator, init_relativePriority, types_exports2, init_types2, userGoalStub_exports, USER_GOAL_NAVIGATOR_STUB, init_userGoalStub, globImport_filters, init_2, init_gradient, MIN_OBSERVATIONS_FOR_UPDATE, LEARNING_RATE, MAX_WEIGHT_DELTA, MIN_R_SQUARED_FOR_GRADIENT, FLAT_GRADIENT_THRESHOLD, MAX_HISTORY_LENGTH, init_learning, init_signal, init_recording, MIN_SPREAD, MAX_SPREAD, MIN_WEIGHT, MAX_WEIGHT, init_orchestration, Pipeline_exports, VERBOSE_RESULTS, Pipeline, init_Pipeline, defaults_exports, init_defaults, PipelineAssembler_exports, PipelineAssembler, init_PipelineAssembler, globImport, init_3, navigators_exports, navigatorRegistry, Navigators, NavigatorRole, NavigatorRoles, ContentNavigator, init_navigators, CoursesDB, CourseDB, init_courseDB, classroomLookupDBTitle, CLASSROOM_CONFIG, ClassroomDBBase, StudentClassroomDB, TeacherClassroomDB, ClassroomLookupDB, init_classroomDB2, AdminDB, init_adminDB2, CourseSyncService_exports, DEFAULT_REPLICATION, CourseSyncService, init_CourseSyncService, init_auth, CouchDBSyncStrategy_exports, log3, CouchDBSyncStrategy, init_CouchDBSyncStrategy, isBrowser, GUEST_LOCAL_DB, localUserDB, pouchDBincludeCredentialsConfig, REVIEW_TIME_FORMAT2, init_couch, log4, BaseUser, userCoursesDoc, userClassroomsDoc, init_BaseUserDB, init_common, PouchDataLayerProvider_exports, CouchDataLayerProvider, init_PouchDataLayerProvider, pathUtils, nodeFS, StaticDataUnpacker, init_StaticDataUnpacker, StaticCourseDB, init_courseDB2, StaticCoursesDB, init_coursesDB, NoOpSyncStrategy, init_NoOpSyncStrategy, StaticDataLayerProvider_exports, StaticDataLayerProvider, init_StaticDataLayerProvider, NOT_SET, ENV, dataLayerInstance, init_factory, TagFilteredContentSource, init_TagFilteredContentSource, init_contentSource, init_courseDB3, init_dataLayerProvider, init_userDB, init_interfaces, init_user, init_strategyState, init_userOutcome, init_cardProcessor, init_types3, init_bulkImport, userDBDebugAPI, init_UserDBDebugger, init_core, duration, SrsService, EloService, ResponseProcessor, CardHydrationService, ItemQueue, CouchDBToStaticPacker, DEFAULT_MIGRATION_OPTIONS, FileSystemError, nodeFS2, nodeFS3, nodePath, StaticToCouchDBMigrator, QuotaRoundRobinMixer, MAX_RUNS2, runHistory2, mixerDebugAPI, activeController, OVERLAY_ID, POLL_MS, INLINE_THRESHOLD, SPINNER_FRAMES, spinnerFrame, overlayEl, pollHandle, lastSnapshot, copyFlashUntil, minified, expanded, activeSession, sessionHistory, MAX_HISTORY, sessionDebugAPI, SessionController, init_dist = __esmMin((() => {
|
|
26899
|
+
var import___vite_browser_external, import___vite_browser_external$1, import___vite_browser_external$2, import_browser_ponyfill, import_browser_ponyfill$1, import_browser, _SessionController2, __defProp, __getOwnPropNames, __glob, __esm, __export, init_adminDB, init_classroomDB, init_SyncStrategy, isDevelopment, logger, init_logger, GuestUsername, log, DocType, DocTypePrefixes, init_types_legacy, init_util, pouchdb_setup_default, init_pouchdb_setup, init_dataDirectory, REVIEW_TIME_FORMAT, log2, init_userDBHelpers, Loggable, init_Loggable, UpdateQueue, init_updateQueue, UsrCrsData, init_user_course_relDB, CLIENT_CACHE, init_clientCache, AlreadyTaggedErr, init_courseAPI, courseLookupDBTitle, CourseLookup, init_courseLookupDB, diversityRerank_exports, DIVERSITY_STRENGTH, DIVERSITY_FLOOR, STRATEGY, STRATEGY_ID, STRATEGY_NAME, init_diversityRerank, PipelineDebugger_exports, _activePipeline, MAX_RUNS, runHistory, DISCARDED_KEEP_TOP, _uiContainer, _selectedRunIndex, _cardSearchQuery, pipelineDebugAPI, init_PipelineDebugger, SrsDebugger_exports, snapshots, init_SrsDebugger, StrategyPressureDebugger_exports, snapshots2, init_StrategyPressureDebugger, CompositeGenerator_exports, AggregationMode, DEFAULT_AGGREGATION_MODE, FREQUENCY_BOOST_FACTOR, CompositeGenerator, init_CompositeGenerator, elo_exports, ELO_RELEVANCE_SIGMA, ELONavigator, init_elo, generators_exports, init_generators, prescribed_exports, DEFAULT_FRESHNESS_WINDOW, DEFAULT_MAX_DIRECT_PER_RUN, DEFAULT_MAX_SUPPORT_PER_RUN, DEFAULT_HIERARCHY_DEPTH, DEFAULT_MIN_COUNT, DEFAULT_PRACTICE_MIN_COUNT, DEFAULT_MAX_PRACTICE_PER_RUN, BASE_TARGET_SCORE, BASE_SUPPORT_SCORE, DISCOVERED_SUPPORT_SCORE, BASE_PRACTICE_SCORE, PRACTICE_BASE_MULT, MAX_PRACTICE_MULTIPLIER, PRACTICE_STALENESS_BUMP_PER_DAY, MAX_TARGET_MULTIPLIER, MAX_SUPPORT_MULTIPLIER, PRESCRIBED_DEBUG_VERSION, PrescribedCardsGenerator, init_prescribed, srs_exports, DEFAULT_HEALTHY_BACKLOG, BACKLOG_GROWTH_RATE, SRSNavigator, init_srs, types_exports, init_types, globImport_generators, init_, DEFAULT_LEARNABLE_WEIGHT, init_contentNavigationStrategy, WeightedFilter_exports, WeightedFilter, init_WeightedFilter, eloDistance_exports, DEFAULT_HALF_LIFE, DEFAULT_MIN_MULTIPLIER, DEFAULT_MAX_MULTIPLIER, init_eloDistance, hierarchyDefinition_exports, DEFAULT_MIN_COUNT2, HierarchyDefinitionNavigator, init_hierarchyDefinition, userTagPreference_exports, UserTagPreferenceFilter, init_userTagPreference, filters_exports, init_filters, inferredPreferenceStub_exports, INFERRED_PREFERENCE_NAVIGATOR_STUB, init_inferredPreferenceStub, interferenceMitigator_exports, DEFAULT_MIN_COUNT3, DEFAULT_MIN_ELAPSED_DAYS, DEFAULT_INTERFERENCE_DECAY, InterferenceMitigatorNavigator, init_interferenceMitigator, relativePriority_exports, DEFAULT_PRIORITY, DEFAULT_PRIORITY_INFLUENCE, DEFAULT_COMBINE_MODE, RelativePriorityNavigator, init_relativePriority, types_exports2, init_types2, userGoalStub_exports, USER_GOAL_NAVIGATOR_STUB, init_userGoalStub, globImport_filters, init_2, init_gradient, MIN_OBSERVATIONS_FOR_UPDATE, LEARNING_RATE, MAX_WEIGHT_DELTA, MIN_R_SQUARED_FOR_GRADIENT, FLAT_GRADIENT_THRESHOLD, MAX_HISTORY_LENGTH, init_learning, init_signal, init_recording, MIN_SPREAD, MAX_SPREAD, MIN_WEIGHT, MAX_WEIGHT, init_orchestration, Pipeline_exports, VERBOSE_RESULTS, Pipeline, init_Pipeline, defaults_exports, init_defaults, PipelineAssembler_exports, PipelineAssembler, init_PipelineAssembler, globImport, init_3, navigators_exports, navigatorRegistry, Navigators, NavigatorRole, NavigatorRoles, ContentNavigator, init_navigators, CoursesDB, CourseDB, init_courseDB, classroomLookupDBTitle, CLASSROOM_CONFIG, ClassroomDBBase, StudentClassroomDB, TeacherClassroomDB, ClassroomLookupDB, init_classroomDB2, AdminDB, init_adminDB2, CourseSyncService_exports, DEFAULT_REPLICATION, CourseSyncService, init_CourseSyncService, init_auth, CouchDBSyncStrategy_exports, log3, CouchDBSyncStrategy, init_CouchDBSyncStrategy, isBrowser, GUEST_LOCAL_DB, localUserDB, pouchDBincludeCredentialsConfig, REVIEW_TIME_FORMAT2, init_couch, log4, HYDRATION_TIMEOUT_MS, BaseUser, userCoursesDoc, userClassroomsDoc, init_BaseUserDB, init_common, PouchDataLayerProvider_exports, CouchDataLayerProvider, init_PouchDataLayerProvider, pathUtils, nodeFS, StaticDataUnpacker, init_StaticDataUnpacker, StaticCourseDB, init_courseDB2, StaticCoursesDB, init_coursesDB, NoOpSyncStrategy, init_NoOpSyncStrategy, StaticDataLayerProvider_exports, StaticDataLayerProvider, init_StaticDataLayerProvider, NOT_SET, ENV, dataLayerInstance, init_factory, TagFilteredContentSource, init_TagFilteredContentSource, init_contentSource, init_courseDB3, init_dataLayerProvider, init_userDB, init_interfaces, init_user, init_strategyState, init_userOutcome, HYDRATION_MARKER_ID, init_hydration, init_cardProcessor, init_types3, init_bulkImport, userDBDebugAPI, init_UserDBDebugger, init_core, duration, SrsService, EloService, ResponseProcessor, CardHydrationService, ItemQueue, CouchDBToStaticPacker, DEFAULT_MIGRATION_OPTIONS, FileSystemError, nodeFS2, nodeFS3, nodePath, StaticToCouchDBMigrator, QuotaRoundRobinMixer, MAX_RUNS2, runHistory2, mixerDebugAPI, activeController, OVERLAY_ID, POLL_MS, INLINE_THRESHOLD, SPINNER_FRAMES, spinnerFrame, overlayEl, pollHandle, lastSnapshot, copyFlashUntil, minified, expanded, activeSession, sessionHistory, MAX_HISTORY, sessionDebugAPI, SessionController, init_dist = __esmMin((() => {
|
|
26891
26900
|
init_defineProperty(), init_index_browser_es$5(), init_index_browser_es(), init_index_es(), import___vite_browser_external = /* @__PURE__ */ __toESM$2(require___vite_browser_external(), 1), import___vite_browser_external$1 = /* @__PURE__ */ __toESM$2(require___vite_browser_external(), 1), import___vite_browser_external$2 = /* @__PURE__ */ __toESM$2(require___vite_browser_external(), 1), init_moment(), init_dist$1(), init_esm_browser(), import_browser_ponyfill = /* @__PURE__ */ __toESM$2(require_browser_ponyfill(), 1), import_browser_ponyfill$1 = /* @__PURE__ */ __toESM$2(require_browser_ponyfill(), 1), import_browser = /* @__PURE__ */ __toESM$2(require_browser(), 1), __defProp = Object.defineProperty, __getOwnPropNames = Object.getOwnPropertyNames, __glob = (t) => (c) => {
|
|
26892
26901
|
var u = t[c];
|
|
26893
26902
|
if (u) return u();
|
|
@@ -29614,7 +29623,7 @@ ${t.stack}` : JSON.stringify(t);
|
|
|
29614
29623
|
logger.info(t);
|
|
29615
29624
|
}, CouchDBSyncStrategy = class {
|
|
29616
29625
|
constructor() {
|
|
29617
|
-
_defineProperty$2(this, "syncHandle", void 0);
|
|
29626
|
+
_defineProperty$2(this, "syncHandle", void 0), _defineProperty$2(this, "hydrationHandle", void 0);
|
|
29618
29627
|
}
|
|
29619
29628
|
setupRemoteDB(t) {
|
|
29620
29629
|
return t === GuestUsername || t.startsWith(GuestUsername) ? getLocalUserDB(t) : this.getUserDB(t);
|
|
@@ -29622,14 +29631,38 @@ ${t.stack}` : JSON.stringify(t);
|
|
|
29622
29631
|
getWriteDB(t) {
|
|
29623
29632
|
return t === GuestUsername || t.startsWith(GuestUsername) ? getLocalUserDB(t) : this.getUserDB(t);
|
|
29624
29633
|
}
|
|
29634
|
+
async hydrate(t, c) {
|
|
29635
|
+
let u = pouchdb_setup_default.replicate(c, t, {});
|
|
29636
|
+
this.hydrationHandle = u;
|
|
29637
|
+
try {
|
|
29638
|
+
return { docsWritten: (await u).docs_written };
|
|
29639
|
+
} finally {
|
|
29640
|
+
this.hydrationHandle = void 0;
|
|
29641
|
+
}
|
|
29642
|
+
}
|
|
29625
29643
|
startSync(t, c) {
|
|
29626
|
-
t !== c && (this.syncHandle = pouchdb_setup_default.sync(t, c, {
|
|
29644
|
+
t.name !== c.name && (this.syncHandle = pouchdb_setup_default.sync(t, c, {
|
|
29627
29645
|
live: !0,
|
|
29628
29646
|
retry: !0
|
|
29629
29647
|
}));
|
|
29630
29648
|
}
|
|
29631
29649
|
stopSync() {
|
|
29632
|
-
|
|
29650
|
+
if (this.hydrationHandle) {
|
|
29651
|
+
try {
|
|
29652
|
+
this.hydrationHandle.cancel();
|
|
29653
|
+
} catch (t) {
|
|
29654
|
+
logger.warn(`Failed to cancel hydration pull (continuing anyway): ${t}`);
|
|
29655
|
+
}
|
|
29656
|
+
this.hydrationHandle = void 0;
|
|
29657
|
+
}
|
|
29658
|
+
if (this.syncHandle) {
|
|
29659
|
+
try {
|
|
29660
|
+
this.syncHandle.cancel();
|
|
29661
|
+
} catch (t) {
|
|
29662
|
+
logger.warn(`Failed to cancel user sync (continuing anyway): ${t}`);
|
|
29663
|
+
}
|
|
29664
|
+
this.syncHandle = void 0;
|
|
29665
|
+
}
|
|
29633
29666
|
}
|
|
29634
29667
|
canCreateAccount() {
|
|
29635
29668
|
return !0;
|
|
@@ -29759,7 +29792,7 @@ ${t.stack}` : JSON.stringify(t);
|
|
|
29759
29792
|
var t;
|
|
29760
29793
|
init_core(), init_util(), init_types_legacy(), init_logger(), init_userDBHelpers(), init_updateQueue(), init_user_course_relDB(), init_couch(), log4 = (t) => {
|
|
29761
29794
|
logger.info(t);
|
|
29762
|
-
}, BaseUser = (t = class _BaseUser {
|
|
29795
|
+
}, HYDRATION_TIMEOUT_MS = 15e3, BaseUser = (t = class _BaseUser {
|
|
29763
29796
|
static Dummy(t) {
|
|
29764
29797
|
return new _BaseUser("Me", t);
|
|
29765
29798
|
}
|
|
@@ -29772,6 +29805,18 @@ ${t.stack}` : JSON.stringify(t);
|
|
|
29772
29805
|
remote() {
|
|
29773
29806
|
return this.remoteDB;
|
|
29774
29807
|
}
|
|
29808
|
+
hydrationStatus() {
|
|
29809
|
+
return { ...this._hydration };
|
|
29810
|
+
}
|
|
29811
|
+
async awaitHydration() {
|
|
29812
|
+
try {
|
|
29813
|
+
await this._hydrationPromise;
|
|
29814
|
+
} catch {}
|
|
29815
|
+
return this.hydrationStatus();
|
|
29816
|
+
}
|
|
29817
|
+
canMaterializeDefaults() {
|
|
29818
|
+
return this._hydration.state !== "failed" && this._hydration.state !== "hydrating";
|
|
29819
|
+
}
|
|
29775
29820
|
async createAccount(t, c) {
|
|
29776
29821
|
if (!this.syncStrategy.canCreateAccount()) throw Error("Account creation not supported by current sync strategy");
|
|
29777
29822
|
if (!this._username.startsWith(GuestUsername)) throw Error(`Cannot create a new account while logged in:
|
|
@@ -29854,12 +29899,14 @@ Currently logged-in as ${this._username}.`);
|
|
|
29854
29899
|
try {
|
|
29855
29900
|
return await this.localDB.get(_BaseUser.DOC_IDS.COURSE_REGISTRATIONS);
|
|
29856
29901
|
} catch (c) {
|
|
29857
|
-
if (c.status === 404)
|
|
29858
|
-
|
|
29859
|
-
|
|
29860
|
-
|
|
29861
|
-
|
|
29862
|
-
|
|
29902
|
+
if (c.status === 404) {
|
|
29903
|
+
if (!this.canMaterializeDefaults()) throw Error(`Cannot read course registrations for ${this._username}: the local mirror is unavailable (hydration state '${this._hydration.state}'). Refusing to create an empty registration doc \u2014 that would report an existing user as unregistered, and then lose to their real document once sync resumes.`);
|
|
29904
|
+
await this.localDB.put({
|
|
29905
|
+
_id: _BaseUser.DOC_IDS.COURSE_REGISTRATIONS,
|
|
29906
|
+
courses: [],
|
|
29907
|
+
studyWeight: {}
|
|
29908
|
+
}), t = await this.getCourseRegistrationsDoc();
|
|
29909
|
+
} else throw Error(`Unexpected error ${JSON.stringify(c)} in getOrCreateCourseRegistrationDoc...`);
|
|
29863
29910
|
}
|
|
29864
29911
|
return t;
|
|
29865
29912
|
}
|
|
@@ -30002,8 +30049,10 @@ Currently logged-in as ${this._username}.`);
|
|
|
30002
30049
|
return logger.debug("Raw config from DB:", t), t;
|
|
30003
30050
|
} catch (c) {
|
|
30004
30051
|
let u = c;
|
|
30005
|
-
if (u.name && u.name === "not_found")
|
|
30006
|
-
|
|
30052
|
+
if (u.name && u.name === "not_found") {
|
|
30053
|
+
if (!this.canMaterializeDefaults()) throw Error(`Cannot read config for ${this._username}: the local mirror is unavailable (hydration state '${this._hydration.state}'). Refusing to write a default config over what may be an existing one.`);
|
|
30054
|
+
return await this.localDB.put(t), this.getConfig();
|
|
30055
|
+
} else throw logger.error("Error setting user default config:", c), Error(`Error returning the user's configuration: ${JSON.stringify(c)}`);
|
|
30007
30056
|
}
|
|
30008
30057
|
}
|
|
30009
30058
|
async setConfig(t) {
|
|
@@ -30023,7 +30072,7 @@ Currently logged-in as ${this._username}.`);
|
|
|
30023
30072
|
}) : (_BaseUser._instance = new _BaseUser(await t.getCurrentUsername(), t), await _BaseUser._instance.init(), _BaseUser._instance);
|
|
30024
30073
|
}
|
|
30025
30074
|
constructor(t, c) {
|
|
30026
|
-
_defineProperty$2(this, "_username", void 0), _defineProperty$2(this, "syncStrategy", void 0), _defineProperty$2(this, "localDB", void 0), _defineProperty$2(this, "remoteDB", void 0), _defineProperty$2(this, "writeDB", void 0), _defineProperty$2(this, "updateQueue", void 0), _BaseUser._initialized = !1, this._username = t, this.syncStrategy = c, this.setDBandQ();
|
|
30075
|
+
_defineProperty$2(this, "_username", void 0), _defineProperty$2(this, "syncStrategy", void 0), _defineProperty$2(this, "localDB", void 0), _defineProperty$2(this, "remoteDB", void 0), _defineProperty$2(this, "writeDB", void 0), _defineProperty$2(this, "updateQueue", void 0), _defineProperty$2(this, "_hydration", { state: "not-required" }), _defineProperty$2(this, "_hydrationPromise", null), _BaseUser._initialized = !1, this._username = t, this.syncStrategy = c, this.setDBandQ();
|
|
30027
30076
|
}
|
|
30028
30077
|
setDBandQ() {
|
|
30029
30078
|
this.localDB = getLocalUserDB(this._username), this.remoteDB = this.syncStrategy.setupRemoteDB(this._username), this.writeDB = this.syncStrategy.getWriteDB ? this.syncStrategy.getWriteDB(this._username) : this.localDB, this.updateQueue = new UpdateQueue(this.localDB, this.writeDB);
|
|
@@ -30033,12 +30082,61 @@ Currently logged-in as ${this._username}.`);
|
|
|
30033
30082
|
_BaseUser._initialized = !0;
|
|
30034
30083
|
return;
|
|
30035
30084
|
}
|
|
30036
|
-
this.setDBandQ(), this.syncStrategy.startSync(this.localDB, this.remoteDB), this.applyDesignDocs().catch((t) => {
|
|
30085
|
+
this.syncStrategy.stopSync?.(), this.setDBandQ(), this._hydrationPromise = this.hydrateLocalMirror(), await this._hydrationPromise, this.syncStrategy.startSync(this.localDB, this.remoteDB), this.applyDesignDocs().catch((t) => {
|
|
30037
30086
|
log4(`Error in applyDesignDocs background task: ${t}`), t && typeof t == "object" && log4(`Full error details in applyDesignDocs: ${JSON.stringify(t)}`);
|
|
30038
30087
|
}), this.deduplicateReviews().catch((t) => {
|
|
30039
30088
|
log4(`Error in deduplicateReviews background task: ${t}`), t && typeof t == "object" && log4(`Full error details in background task: ${JSON.stringify(t)}`);
|
|
30040
30089
|
}), _BaseUser._initialized = !0;
|
|
30041
30090
|
}
|
|
30091
|
+
async hydrateLocalMirror() {
|
|
30092
|
+
if (this.localDB.name === this.remoteDB.name || !this.syncStrategy.hydrate) {
|
|
30093
|
+
this._hydration = { state: "not-required" };
|
|
30094
|
+
return;
|
|
30095
|
+
}
|
|
30096
|
+
if (await this.hasHydrationMarker()) {
|
|
30097
|
+
this._hydration = { state: "stale" };
|
|
30098
|
+
return;
|
|
30099
|
+
}
|
|
30100
|
+
this._hydration = { state: "hydrating" };
|
|
30101
|
+
let t = Date.now();
|
|
30102
|
+
try {
|
|
30103
|
+
let { docsWritten: c } = await withTimeout(this.syncStrategy.hydrate(this.localDB, this.remoteDB), HYDRATION_TIMEOUT_MS, `Hydration of local mirror for ${this._username}`);
|
|
30104
|
+
await this.writeHydrationMarker(), this._hydration = {
|
|
30105
|
+
state: "hydrated",
|
|
30106
|
+
docsWritten: c,
|
|
30107
|
+
durationMs: Date.now() - t
|
|
30108
|
+
}, log4(`Hydrated local mirror for ${this._username}: ${c} docs in ${this._hydration.durationMs}ms`);
|
|
30109
|
+
} catch (c) {
|
|
30110
|
+
this.syncStrategy.stopSync?.(), this._hydration = {
|
|
30111
|
+
state: "failed",
|
|
30112
|
+
durationMs: Date.now() - t,
|
|
30113
|
+
error: c instanceof Error ? c.message : String(c)
|
|
30114
|
+
}, logger.error(`Failed to hydrate local mirror for ${this._username}:`, c);
|
|
30115
|
+
}
|
|
30116
|
+
}
|
|
30117
|
+
async hasHydrationMarker() {
|
|
30118
|
+
try {
|
|
30119
|
+
return (await this.localDB.get(HYDRATION_MARKER_ID)).username === this._username;
|
|
30120
|
+
} catch {
|
|
30121
|
+
return !1;
|
|
30122
|
+
}
|
|
30123
|
+
}
|
|
30124
|
+
async writeHydrationMarker() {
|
|
30125
|
+
try {
|
|
30126
|
+
let t;
|
|
30127
|
+
try {
|
|
30128
|
+
t = (await this.localDB.get(HYDRATION_MARKER_ID))._rev;
|
|
30129
|
+
} catch {}
|
|
30130
|
+
await this.localDB.put({
|
|
30131
|
+
_id: HYDRATION_MARKER_ID,
|
|
30132
|
+
_rev: t,
|
|
30133
|
+
username: this._username,
|
|
30134
|
+
hydratedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
30135
|
+
});
|
|
30136
|
+
} catch (t) {
|
|
30137
|
+
logger.warn(`Could not write hydration marker for ${this._username}: ${t}`);
|
|
30138
|
+
}
|
|
30139
|
+
}
|
|
30042
30140
|
async applyDesignDocs() {
|
|
30043
30141
|
if (log4(`Starting applyDesignDocs for user: ${this._username}`), log4(`Remote DB name: ${this.remoteDB.name || "unknown"}`), this._username === "admin") {
|
|
30044
30142
|
log4("Skipping design docs for admin user");
|
|
@@ -30218,7 +30316,10 @@ Currently logged-in as ${this._username}.`);
|
|
|
30218
30316
|
try {
|
|
30219
30317
|
return (await this.localDB.get(u)).data;
|
|
30220
30318
|
} catch (t) {
|
|
30221
|
-
if (t.status === 404)
|
|
30319
|
+
if (t.status === 404) {
|
|
30320
|
+
if (!this.canMaterializeDefaults()) throw Error(`Cannot read strategy state '${c}' for ${this._username}: the local mirror is unavailable (hydration state '${this._hydration.state}').`);
|
|
30321
|
+
return null;
|
|
30322
|
+
}
|
|
30222
30323
|
throw t;
|
|
30223
30324
|
}
|
|
30224
30325
|
}
|
|
@@ -31020,7 +31121,9 @@ Currently logged-in as ${this._username}.`);
|
|
|
31020
31121
|
init_factory(), init_classroomDB2(), init_TagFilteredContentSource();
|
|
31021
31122
|
} }), init_courseDB3 = __esm({ "src/core/interfaces/courseDB.ts"() {} }), init_dataLayerProvider = __esm({ "src/core/interfaces/dataLayerProvider.ts"() {} }), init_userDB = __esm({ "src/core/interfaces/userDB.ts"() {} }), init_interfaces = __esm({ "src/core/interfaces/index.ts"() {
|
|
31022
31123
|
init_adminDB(), init_classroomDB(), init_contentSource(), init_courseDB3(), init_dataLayerProvider(), init_userDB();
|
|
31023
|
-
} }), init_user = __esm({ "src/core/types/user.ts"() {} }), init_strategyState = __esm({ "src/core/types/strategyState.ts"() {} }), init_userOutcome = __esm({ "src/core/types/userOutcome.ts"() {} }),
|
|
31124
|
+
} }), init_user = __esm({ "src/core/types/user.ts"() {} }), init_strategyState = __esm({ "src/core/types/strategyState.ts"() {} }), init_userOutcome = __esm({ "src/core/types/userOutcome.ts"() {} }), init_hydration = __esm({ "src/core/types/hydration.ts"() {
|
|
31125
|
+
HYDRATION_MARKER_ID = "_local/hydration";
|
|
31126
|
+
} }), init_cardProcessor = __esm({ "src/core/bulkImport/cardProcessor.ts"() {
|
|
31024
31127
|
init_logger();
|
|
31025
31128
|
} }), init_types3 = __esm({ "src/core/bulkImport/types.ts"() {} }), init_bulkImport = __esm({ "src/core/bulkImport/index.ts"() {
|
|
31026
31129
|
init_cardProcessor(), init_types3();
|
|
@@ -31195,7 +31298,7 @@ ${c.id}:`), logger.info(JSON.stringify(c.doc, null, 2));
|
|
|
31195
31298
|
}
|
|
31196
31299
|
}, mountUserDBDebugger();
|
|
31197
31300
|
} }), init_core = __esm({ "src/core/index.ts"() {
|
|
31198
|
-
init_interfaces(), init_types_legacy(), init_user(), init_strategyState(), init_userOutcome(), init_Loggable(), init_util(), init_navigators(), init_bulkImport(), init_orchestration(), init_UserDBDebugger();
|
|
31301
|
+
init_interfaces(), init_types_legacy(), init_user(), init_strategyState(), init_userOutcome(), init_hydration(), init_Loggable(), init_util(), init_navigators(), init_bulkImport(), init_orchestration(), init_UserDBDebugger();
|
|
31199
31302
|
} }), init_core(), init_courseLookupDB(), init_logger(), init_couch(), init_util(), init_logger(), duration = hooks.duration, init_logger(), SrsService = class {
|
|
31200
31303
|
constructor(t) {
|
|
31201
31304
|
_defineProperty$2(this, "user", void 0), this.user = t;
|