@vue-skuilder/db 0.2.20 → 0.2.22
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/{contentSource-BDRX_YYJ.d.ts → contentSource-B1pqryv6.d.ts} +87 -2
- package/dist/{contentSource-D-LQYFyx.d.cts → contentSource-CpTxVrFx.d.cts} +87 -2
- package/dist/core/index.d.cts +16 -6
- package/dist/core/index.d.ts +16 -6
- package/dist/core/index.js +79 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +74 -4
- package/dist/core/index.mjs.map +1 -1
- package/dist/{dataLayerProvider-Dpshuql4.d.ts → dataLayerProvider-BZqH27f4.d.ts} +1 -1
- package/dist/{dataLayerProvider-Dd2UcCif.d.cts → dataLayerProvider-D4c7iUc_.d.cts} +1 -1
- package/dist/impl/couch/index.d.cts +3 -3
- package/dist/impl/couch/index.d.ts +3 -3
- package/dist/impl/couch/index.js +63 -4
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +63 -4
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.d.cts +4 -4
- package/dist/impl/static/index.d.ts +4 -4
- package/dist/impl/static/index.js +63 -4
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +63 -4
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/{index-k9NFHpS1.d.cts → index-DGApnUZ-.d.cts} +1 -1
- package/dist/{index-BLLT5BYE.d.ts → index-rmNIwnkV.d.ts} +1 -1
- package/dist/index.d.cts +51 -14
- package/dist/index.d.ts +51 -14
- package/dist/index.js +231 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +226 -12
- package/dist/index.mjs.map +1 -1
- package/dist/{types-CHgpWQAY.d.ts → types-B-Y3aoi5.d.ts} +1 -1
- package/dist/{types-legacy-4tlwHnXo.d.cts → types-legacy-BytY5eAR.d.cts} +9 -1
- package/dist/{types-legacy-4tlwHnXo.d.ts → types-legacy-BytY5eAR.d.ts} +9 -1
- package/dist/{types-BFUa1pa3.d.cts → types-r6fyuWP2.d.cts} +1 -1
- package/dist/util/packer/index.d.cts +3 -3
- package/dist/util/packer/index.d.ts +3 -3
- package/package.json +3 -3
- package/src/core/index.ts +1 -0
- package/src/core/interfaces/userDB.ts +7 -0
- package/src/core/navigators/PipelineDebugger.ts +41 -1
- package/src/core/navigators/index.ts +3 -0
- package/src/core/types/studySession.ts +100 -0
- package/src/core/types/types-legacy.ts +8 -0
- package/src/core/types/user.ts +6 -1
- package/src/impl/common/BaseUserDB.ts +36 -0
- package/src/study/SessionController.ts +179 -2
- package/src/study/SessionDebugger.ts +4 -3
- package/src/study/SessionOverlay.ts +1 -0
- package/src/study/services/ResponseProcessor.ts +32 -4
|
@@ -264,6 +264,7 @@ var init_types_legacy = __esm({
|
|
|
264
264
|
DocType2["STRATEGY_STATE"] = "STRATEGY_STATE";
|
|
265
265
|
DocType2["USER_OUTCOME"] = "USER_OUTCOME";
|
|
266
266
|
DocType2["STRATEGY_LEARNING_STATE"] = "STRATEGY_LEARNING_STATE";
|
|
267
|
+
DocType2["STUDY_SESSION"] = "STUDY_SESSION";
|
|
267
268
|
return DocType2;
|
|
268
269
|
})(DocType || {});
|
|
269
270
|
DocTypePrefixes = {
|
|
@@ -280,7 +281,8 @@ var init_types_legacy = __esm({
|
|
|
280
281
|
["NAVIGATION_STRATEGY" /* NAVIGATION_STRATEGY */]: "NAVIGATION_STRATEGY",
|
|
281
282
|
["STRATEGY_STATE" /* STRATEGY_STATE */]: "STRATEGY_STATE",
|
|
282
283
|
["USER_OUTCOME" /* USER_OUTCOME */]: "USER_OUTCOME",
|
|
283
|
-
["STRATEGY_LEARNING_STATE" /* STRATEGY_LEARNING_STATE */]: "STRATEGY_LEARNING_STATE"
|
|
284
|
+
["STRATEGY_LEARNING_STATE" /* STRATEGY_LEARNING_STATE */]: "STRATEGY_LEARNING_STATE",
|
|
285
|
+
["STUDY_SESSION" /* STUDY_SESSION */]: "SESSION"
|
|
284
286
|
};
|
|
285
287
|
}
|
|
286
288
|
});
|
|
@@ -716,10 +718,13 @@ __export(PipelineDebugger_exports, {
|
|
|
716
718
|
buildRunReport: () => buildRunReport,
|
|
717
719
|
captureRun: () => captureRun,
|
|
718
720
|
clearRunHistory: () => clearRunHistory,
|
|
721
|
+
drainCapturedRuns: () => drainCapturedRuns,
|
|
719
722
|
getActivePipeline: () => getActivePipeline,
|
|
723
|
+
getRunsForSession: () => getRunsForSession,
|
|
720
724
|
mountPipelineDebugger: () => mountPipelineDebugger,
|
|
721
725
|
pipelineDebugAPI: () => pipelineDebugAPI,
|
|
722
|
-
registerPipelineForDebug: () => registerPipelineForDebug
|
|
726
|
+
registerPipelineForDebug: () => registerPipelineForDebug,
|
|
727
|
+
setDebugSessionId: () => setDebugSessionId
|
|
723
728
|
});
|
|
724
729
|
function registerPipelineForDebug(pipeline) {
|
|
725
730
|
_activePipeline = pipeline;
|
|
@@ -727,8 +732,20 @@ function registerPipelineForDebug(pipeline) {
|
|
|
727
732
|
function getActivePipeline() {
|
|
728
733
|
return _activePipeline;
|
|
729
734
|
}
|
|
735
|
+
function setDebugSessionId(sessionId) {
|
|
736
|
+
_currentSessionId = sessionId;
|
|
737
|
+
}
|
|
738
|
+
function drainCapturedRuns() {
|
|
739
|
+
const drained = _pendingRuns;
|
|
740
|
+
_pendingRuns = [];
|
|
741
|
+
return drained;
|
|
742
|
+
}
|
|
743
|
+
function getRunsForSession(sessionId) {
|
|
744
|
+
return runHistory.filter((r) => r.sessionId === sessionId).reverse();
|
|
745
|
+
}
|
|
730
746
|
function clearRunHistory() {
|
|
731
747
|
runHistory.length = 0;
|
|
748
|
+
_pendingRuns = [];
|
|
732
749
|
}
|
|
733
750
|
function getOrigin(card) {
|
|
734
751
|
const firstEntry = card.provenance[0];
|
|
@@ -743,12 +760,15 @@ function captureRun(report) {
|
|
|
743
760
|
const fullReport = {
|
|
744
761
|
...report,
|
|
745
762
|
runId: `run-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
763
|
+
sessionId: _currentSessionId,
|
|
746
764
|
timestamp: /* @__PURE__ */ new Date()
|
|
747
765
|
};
|
|
748
766
|
runHistory.unshift(fullReport);
|
|
749
767
|
if (runHistory.length > MAX_RUNS) {
|
|
750
768
|
runHistory.pop();
|
|
751
769
|
}
|
|
770
|
+
_pendingRuns.push(fullReport);
|
|
771
|
+
return fullReport;
|
|
752
772
|
}
|
|
753
773
|
function parseCardElo(provenance) {
|
|
754
774
|
const eloEntry = provenance.find((p) => p.strategy === "elo");
|
|
@@ -1076,7 +1096,7 @@ function mountPipelineDebugger() {
|
|
|
1076
1096
|
win.skuilder = win.skuilder || {};
|
|
1077
1097
|
win.skuilder.pipeline = pipelineDebugAPI;
|
|
1078
1098
|
}
|
|
1079
|
-
var _activePipeline, MAX_RUNS, runHistory, DISCARDED_KEEP_TOP, _uiContainer, _selectedRunIndex, _cardSearchQuery, pipelineDebugAPI;
|
|
1099
|
+
var _activePipeline, MAX_RUNS, runHistory, _currentSessionId, _pendingRuns, DISCARDED_KEEP_TOP, _uiContainer, _selectedRunIndex, _cardSearchQuery, pipelineDebugAPI;
|
|
1080
1100
|
var init_PipelineDebugger = __esm({
|
|
1081
1101
|
"src/core/navigators/PipelineDebugger.ts"() {
|
|
1082
1102
|
"use strict";
|
|
@@ -1085,6 +1105,7 @@ var init_PipelineDebugger = __esm({
|
|
|
1085
1105
|
_activePipeline = null;
|
|
1086
1106
|
MAX_RUNS = 10;
|
|
1087
1107
|
runHistory = [];
|
|
1108
|
+
_pendingRuns = [];
|
|
1088
1109
|
DISCARDED_KEEP_TOP = 25;
|
|
1089
1110
|
_uiContainer = null;
|
|
1090
1111
|
_selectedRunIndex = null;
|
|
@@ -5062,11 +5083,13 @@ __export(navigators_exports, {
|
|
|
5062
5083
|
clearSrsBacklogDebug: () => clearSrsBacklogDebug,
|
|
5063
5084
|
clearStrategyPressureDebug: () => clearStrategyPressureDebug,
|
|
5064
5085
|
diversityRerank: () => diversityRerank,
|
|
5086
|
+
drainCapturedRuns: () => drainCapturedRuns,
|
|
5065
5087
|
getActivePipeline: () => getActivePipeline,
|
|
5066
5088
|
getCardOrigin: () => getCardOrigin,
|
|
5067
5089
|
getRegisteredNavigator: () => getRegisteredNavigator,
|
|
5068
5090
|
getRegisteredNavigatorNames: () => getRegisteredNavigatorNames,
|
|
5069
5091
|
getRegisteredNavigatorRole: () => getRegisteredNavigatorRole,
|
|
5092
|
+
getRunsForSession: () => getRunsForSession,
|
|
5070
5093
|
getSrsBacklogDebug: () => getSrsBacklogDebug,
|
|
5071
5094
|
getStrategyPressureDebug: () => getStrategyPressureDebug,
|
|
5072
5095
|
hasRegisteredNavigator: () => hasRegisteredNavigator,
|
|
@@ -5075,7 +5098,8 @@ __export(navigators_exports, {
|
|
|
5075
5098
|
isGenerator: () => isGenerator,
|
|
5076
5099
|
mountPipelineDebugger: () => mountPipelineDebugger,
|
|
5077
5100
|
pipelineDebugAPI: () => pipelineDebugAPI,
|
|
5078
|
-
registerNavigator: () => registerNavigator
|
|
5101
|
+
registerNavigator: () => registerNavigator,
|
|
5102
|
+
setDebugSessionId: () => setDebugSessionId
|
|
5079
5103
|
});
|
|
5080
5104
|
function registerNavigator(implementingClass, constructor, role) {
|
|
5081
5105
|
navigatorRegistry.set(implementingClass, { constructor, role });
|
|
@@ -6730,6 +6754,14 @@ var init_userOutcome = __esm({
|
|
|
6730
6754
|
}
|
|
6731
6755
|
});
|
|
6732
6756
|
|
|
6757
|
+
// src/core/types/studySession.ts
|
|
6758
|
+
var init_studySession = __esm({
|
|
6759
|
+
"src/core/types/studySession.ts"() {
|
|
6760
|
+
"use strict";
|
|
6761
|
+
init_types_legacy();
|
|
6762
|
+
}
|
|
6763
|
+
});
|
|
6764
|
+
|
|
6733
6765
|
// src/core/types/hydration.ts
|
|
6734
6766
|
var HYDRATION_MARKER_ID;
|
|
6735
6767
|
var init_hydration = __esm({
|
|
@@ -7234,6 +7266,7 @@ var init_core = __esm({
|
|
|
7234
7266
|
init_user();
|
|
7235
7267
|
init_strategyState();
|
|
7236
7268
|
init_userOutcome();
|
|
7269
|
+
init_studySession();
|
|
7237
7270
|
init_hydration();
|
|
7238
7271
|
init_Loggable();
|
|
7239
7272
|
init_util();
|
|
@@ -8502,6 +8535,32 @@ Currently logged-in as ${this._username}.`
|
|
|
8502
8535
|
};
|
|
8503
8536
|
await this.localDB.put(doc);
|
|
8504
8537
|
}
|
|
8538
|
+
/**
|
|
8539
|
+
* Open and close write the same `_id`, so the 409 path is the expected
|
|
8540
|
+
* route for the second write, not an error case.
|
|
8541
|
+
*/
|
|
8542
|
+
async putStudySession(doc) {
|
|
8543
|
+
try {
|
|
8544
|
+
await this.localDB.put(doc);
|
|
8545
|
+
} catch (err) {
|
|
8546
|
+
if (err.status === 409) {
|
|
8547
|
+
const existing = await this.localDB.get(doc._id);
|
|
8548
|
+
await this.localDB.put({ ...doc, _rev: existing._rev });
|
|
8549
|
+
} else {
|
|
8550
|
+
throw err;
|
|
8551
|
+
}
|
|
8552
|
+
}
|
|
8553
|
+
}
|
|
8554
|
+
async getStudySessions(courseId) {
|
|
8555
|
+
const prefix = courseId ? `${DocTypePrefixes["STUDY_SESSION" /* STUDY_SESSION */]}::${courseId}::` : `${DocTypePrefixes["STUDY_SESSION" /* STUDY_SESSION */]}::`;
|
|
8556
|
+
const keys = getStartAndEndKeys2(prefix);
|
|
8557
|
+
const res = await this.localDB.allDocs({
|
|
8558
|
+
startkey: keys.startkey,
|
|
8559
|
+
endkey: keys.endkey,
|
|
8560
|
+
include_docs: true
|
|
8561
|
+
});
|
|
8562
|
+
return res.rows.map((r) => r.doc).filter((d) => !!d).sort((a, b) => b.startTime.localeCompare(a.startTime));
|
|
8563
|
+
}
|
|
8505
8564
|
async putUserOutcome(record) {
|
|
8506
8565
|
try {
|
|
8507
8566
|
await this.localDB.put(record);
|