@vue-skuilder/db 0.2.21 → 0.2.23
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-BMxsujRu.d.cts → contentSource-BvOpKUeU.d.ts} +442 -79
- package/dist/{contentSource-Bazgkf4C.d.ts → contentSource-DT9NaX69.d.cts} +442 -79
- package/dist/core/index.d.cts +84 -342
- package/dist/core/index.d.ts +84 -342
- 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-Bt-D6xas.d.ts → dataLayerProvider-CY2B2lyW.d.ts} +1 -1
- package/dist/{dataLayerProvider-DifVCcIS.d.cts → dataLayerProvider-wY6s_4x9.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-BLLT5BYE.d.ts → index-BkBJlGDX.d.ts} +1 -1
- package/dist/{index-k9NFHpS1.d.cts → index-D7WdMDAs.d.cts} +1 -1
- package/dist/index.d.cts +51 -14
- package/dist/index.d.ts +51 -14
- package/dist/index.js +240 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +235 -12
- package/dist/index.mjs.map +1 -1
- package/dist/{types-BFUa1pa3.d.cts → types-DjiFOZxJ.d.cts} +1 -1
- package/dist/{types-legacy-4tlwHnXo.d.cts → types-legacy-CrwyZIvI.d.cts} +10 -2
- package/dist/{types-legacy-4tlwHnXo.d.ts → types-legacy-CrwyZIvI.d.ts} +10 -2
- package/dist/{types-CHgpWQAY.d.ts → types-uJ2Xn3_X.d.ts} +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 +125 -0
- package/src/core/types/types-legacy.ts +8 -0
- package/src/impl/common/BaseUserDB.ts +36 -0
- package/src/study/SessionController.ts +188 -2
- package/src/study/SessionDebugger.ts +4 -3
- package/src/study/SessionOverlay.ts +1 -0
- package/src/study/services/ResponseProcessor.ts +32 -4
package/dist/core/index.mjs
CHANGED
|
@@ -103,6 +103,7 @@ var init_types_legacy = __esm({
|
|
|
103
103
|
DocType2["STRATEGY_STATE"] = "STRATEGY_STATE";
|
|
104
104
|
DocType2["USER_OUTCOME"] = "USER_OUTCOME";
|
|
105
105
|
DocType2["STRATEGY_LEARNING_STATE"] = "STRATEGY_LEARNING_STATE";
|
|
106
|
+
DocType2["STUDY_SESSION"] = "STUDY_SESSION";
|
|
106
107
|
return DocType2;
|
|
107
108
|
})(DocType || {});
|
|
108
109
|
DocTypePrefixes = {
|
|
@@ -119,7 +120,8 @@ var init_types_legacy = __esm({
|
|
|
119
120
|
["NAVIGATION_STRATEGY" /* NAVIGATION_STRATEGY */]: "NAVIGATION_STRATEGY",
|
|
120
121
|
["STRATEGY_STATE" /* STRATEGY_STATE */]: "STRATEGY_STATE",
|
|
121
122
|
["USER_OUTCOME" /* USER_OUTCOME */]: "USER_OUTCOME",
|
|
122
|
-
["STRATEGY_LEARNING_STATE" /* STRATEGY_LEARNING_STATE */]: "STRATEGY_LEARNING_STATE"
|
|
123
|
+
["STRATEGY_LEARNING_STATE" /* STRATEGY_LEARNING_STATE */]: "STRATEGY_LEARNING_STATE",
|
|
124
|
+
["STUDY_SESSION" /* STUDY_SESSION */]: "SESSION"
|
|
123
125
|
};
|
|
124
126
|
}
|
|
125
127
|
});
|
|
@@ -794,10 +796,13 @@ __export(PipelineDebugger_exports, {
|
|
|
794
796
|
buildRunReport: () => buildRunReport,
|
|
795
797
|
captureRun: () => captureRun,
|
|
796
798
|
clearRunHistory: () => clearRunHistory,
|
|
799
|
+
drainCapturedRuns: () => drainCapturedRuns,
|
|
797
800
|
getActivePipeline: () => getActivePipeline,
|
|
801
|
+
getRunsForSession: () => getRunsForSession,
|
|
798
802
|
mountPipelineDebugger: () => mountPipelineDebugger,
|
|
799
803
|
pipelineDebugAPI: () => pipelineDebugAPI,
|
|
800
|
-
registerPipelineForDebug: () => registerPipelineForDebug
|
|
804
|
+
registerPipelineForDebug: () => registerPipelineForDebug,
|
|
805
|
+
setDebugSessionId: () => setDebugSessionId
|
|
801
806
|
});
|
|
802
807
|
function registerPipelineForDebug(pipeline) {
|
|
803
808
|
_activePipeline = pipeline;
|
|
@@ -805,8 +810,20 @@ function registerPipelineForDebug(pipeline) {
|
|
|
805
810
|
function getActivePipeline() {
|
|
806
811
|
return _activePipeline;
|
|
807
812
|
}
|
|
813
|
+
function setDebugSessionId(sessionId) {
|
|
814
|
+
_currentSessionId = sessionId;
|
|
815
|
+
}
|
|
816
|
+
function drainCapturedRuns() {
|
|
817
|
+
const drained = _pendingRuns;
|
|
818
|
+
_pendingRuns = [];
|
|
819
|
+
return drained;
|
|
820
|
+
}
|
|
821
|
+
function getRunsForSession(sessionId) {
|
|
822
|
+
return runHistory.filter((r) => r.sessionId === sessionId).reverse();
|
|
823
|
+
}
|
|
808
824
|
function clearRunHistory() {
|
|
809
825
|
runHistory.length = 0;
|
|
826
|
+
_pendingRuns = [];
|
|
810
827
|
}
|
|
811
828
|
function getOrigin(card) {
|
|
812
829
|
const firstEntry = card.provenance[0];
|
|
@@ -821,12 +838,15 @@ function captureRun(report) {
|
|
|
821
838
|
const fullReport = {
|
|
822
839
|
...report,
|
|
823
840
|
runId: `run-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
841
|
+
sessionId: _currentSessionId,
|
|
824
842
|
timestamp: /* @__PURE__ */ new Date()
|
|
825
843
|
};
|
|
826
844
|
runHistory.unshift(fullReport);
|
|
827
845
|
if (runHistory.length > MAX_RUNS) {
|
|
828
846
|
runHistory.pop();
|
|
829
847
|
}
|
|
848
|
+
_pendingRuns.push(fullReport);
|
|
849
|
+
return fullReport;
|
|
830
850
|
}
|
|
831
851
|
function parseCardElo(provenance) {
|
|
832
852
|
const eloEntry = provenance.find((p) => p.strategy === "elo");
|
|
@@ -1154,7 +1174,7 @@ function mountPipelineDebugger() {
|
|
|
1154
1174
|
win.skuilder = win.skuilder || {};
|
|
1155
1175
|
win.skuilder.pipeline = pipelineDebugAPI;
|
|
1156
1176
|
}
|
|
1157
|
-
var _activePipeline, MAX_RUNS, runHistory, DISCARDED_KEEP_TOP, _uiContainer, _selectedRunIndex, _cardSearchQuery, pipelineDebugAPI;
|
|
1177
|
+
var _activePipeline, MAX_RUNS, runHistory, _currentSessionId, _pendingRuns, DISCARDED_KEEP_TOP, _uiContainer, _selectedRunIndex, _cardSearchQuery, pipelineDebugAPI;
|
|
1158
1178
|
var init_PipelineDebugger = __esm({
|
|
1159
1179
|
"src/core/navigators/PipelineDebugger.ts"() {
|
|
1160
1180
|
"use strict";
|
|
@@ -1163,6 +1183,7 @@ var init_PipelineDebugger = __esm({
|
|
|
1163
1183
|
_activePipeline = null;
|
|
1164
1184
|
MAX_RUNS = 10;
|
|
1165
1185
|
runHistory = [];
|
|
1186
|
+
_pendingRuns = [];
|
|
1166
1187
|
DISCARDED_KEEP_TOP = 25;
|
|
1167
1188
|
_uiContainer = null;
|
|
1168
1189
|
_selectedRunIndex = null;
|
|
@@ -5386,11 +5407,13 @@ __export(navigators_exports, {
|
|
|
5386
5407
|
clearSrsBacklogDebug: () => clearSrsBacklogDebug,
|
|
5387
5408
|
clearStrategyPressureDebug: () => clearStrategyPressureDebug,
|
|
5388
5409
|
diversityRerank: () => diversityRerank,
|
|
5410
|
+
drainCapturedRuns: () => drainCapturedRuns,
|
|
5389
5411
|
getActivePipeline: () => getActivePipeline,
|
|
5390
5412
|
getCardOrigin: () => getCardOrigin,
|
|
5391
5413
|
getRegisteredNavigator: () => getRegisteredNavigator,
|
|
5392
5414
|
getRegisteredNavigatorNames: () => getRegisteredNavigatorNames,
|
|
5393
5415
|
getRegisteredNavigatorRole: () => getRegisteredNavigatorRole,
|
|
5416
|
+
getRunsForSession: () => getRunsForSession,
|
|
5394
5417
|
getSrsBacklogDebug: () => getSrsBacklogDebug,
|
|
5395
5418
|
getStrategyPressureDebug: () => getStrategyPressureDebug,
|
|
5396
5419
|
hasRegisteredNavigator: () => hasRegisteredNavigator,
|
|
@@ -5399,7 +5422,8 @@ __export(navigators_exports, {
|
|
|
5399
5422
|
isGenerator: () => isGenerator,
|
|
5400
5423
|
mountPipelineDebugger: () => mountPipelineDebugger,
|
|
5401
5424
|
pipelineDebugAPI: () => pipelineDebugAPI,
|
|
5402
|
-
registerNavigator: () => registerNavigator
|
|
5425
|
+
registerNavigator: () => registerNavigator,
|
|
5426
|
+
setDebugSessionId: () => setDebugSessionId
|
|
5403
5427
|
});
|
|
5404
5428
|
function registerNavigator(implementingClass, constructor, role) {
|
|
5405
5429
|
navigatorRegistry.set(implementingClass, { constructor, role });
|
|
@@ -7860,6 +7884,32 @@ Currently logged-in as ${this._username}.`
|
|
|
7860
7884
|
};
|
|
7861
7885
|
await this.localDB.put(doc);
|
|
7862
7886
|
}
|
|
7887
|
+
/**
|
|
7888
|
+
* Open and close write the same `_id`, so the 409 path is the expected
|
|
7889
|
+
* route for the second write, not an error case.
|
|
7890
|
+
*/
|
|
7891
|
+
async putStudySession(doc) {
|
|
7892
|
+
try {
|
|
7893
|
+
await this.localDB.put(doc);
|
|
7894
|
+
} catch (err) {
|
|
7895
|
+
if (err.status === 409) {
|
|
7896
|
+
const existing = await this.localDB.get(doc._id);
|
|
7897
|
+
await this.localDB.put({ ...doc, _rev: existing._rev });
|
|
7898
|
+
} else {
|
|
7899
|
+
throw err;
|
|
7900
|
+
}
|
|
7901
|
+
}
|
|
7902
|
+
}
|
|
7903
|
+
async getStudySessions(courseId) {
|
|
7904
|
+
const prefix = courseId ? `${DocTypePrefixes["STUDY_SESSION" /* STUDY_SESSION */]}::${courseId}::` : `${DocTypePrefixes["STUDY_SESSION" /* STUDY_SESSION */]}::`;
|
|
7905
|
+
const keys = getStartAndEndKeys(prefix);
|
|
7906
|
+
const res = await this.localDB.allDocs({
|
|
7907
|
+
startkey: keys.startkey,
|
|
7908
|
+
endkey: keys.endkey,
|
|
7909
|
+
include_docs: true
|
|
7910
|
+
});
|
|
7911
|
+
return res.rows.map((r) => r.doc).filter((d) => !!d).sort((a, b) => b.startTime.localeCompare(a.startTime));
|
|
7912
|
+
}
|
|
7863
7913
|
async putUserOutcome(record) {
|
|
7864
7914
|
try {
|
|
7865
7915
|
await this.localDB.put(record);
|
|
@@ -8179,6 +8229,20 @@ var init_userOutcome = __esm({
|
|
|
8179
8229
|
}
|
|
8180
8230
|
});
|
|
8181
8231
|
|
|
8232
|
+
// src/core/types/studySession.ts
|
|
8233
|
+
function makeStudySessionId(courseId, userId, sessionId) {
|
|
8234
|
+
return `${DocTypePrefixes["STUDY_SESSION" /* STUDY_SESSION */]}::${courseId}::${userId}::${sessionId}`;
|
|
8235
|
+
}
|
|
8236
|
+
function newSessionId() {
|
|
8237
|
+
return `session-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
8238
|
+
}
|
|
8239
|
+
var init_studySession = __esm({
|
|
8240
|
+
"src/core/types/studySession.ts"() {
|
|
8241
|
+
"use strict";
|
|
8242
|
+
init_types_legacy();
|
|
8243
|
+
}
|
|
8244
|
+
});
|
|
8245
|
+
|
|
8182
8246
|
// src/core/types/hydration.ts
|
|
8183
8247
|
var HYDRATION_MARKER_ID;
|
|
8184
8248
|
var init_hydration = __esm({
|
|
@@ -8666,6 +8730,7 @@ var init_core = __esm({
|
|
|
8666
8730
|
init_user();
|
|
8667
8731
|
init_strategyState();
|
|
8668
8732
|
init_userOutcome();
|
|
8733
|
+
init_studySession();
|
|
8669
8734
|
init_hydration();
|
|
8670
8735
|
init_Loggable();
|
|
8671
8736
|
init_util();
|
|
@@ -8702,6 +8767,7 @@ export {
|
|
|
8702
8767
|
createOrchestrationContext,
|
|
8703
8768
|
diversityRerank,
|
|
8704
8769
|
docIsDeleted,
|
|
8770
|
+
drainCapturedRuns,
|
|
8705
8771
|
getActivePipeline,
|
|
8706
8772
|
getCardHistoryID,
|
|
8707
8773
|
getCardOrigin,
|
|
@@ -8709,6 +8775,7 @@ export {
|
|
|
8709
8775
|
getRegisteredNavigator,
|
|
8710
8776
|
getRegisteredNavigatorNames,
|
|
8711
8777
|
getRegisteredNavigatorRole,
|
|
8778
|
+
getRunsForSession,
|
|
8712
8779
|
getSrsBacklogDebug,
|
|
8713
8780
|
getStrategyPressureDebug,
|
|
8714
8781
|
getStudySource,
|
|
@@ -8720,14 +8787,17 @@ export {
|
|
|
8720
8787
|
isQuestionRecord,
|
|
8721
8788
|
isReview,
|
|
8722
8789
|
log,
|
|
8790
|
+
makeStudySessionId,
|
|
8723
8791
|
mountPipelineDebugger,
|
|
8724
8792
|
mountUserDBDebugger,
|
|
8793
|
+
newSessionId,
|
|
8725
8794
|
parseCardHistoryID,
|
|
8726
8795
|
pipelineDebugAPI,
|
|
8727
8796
|
recordUserOutcome,
|
|
8728
8797
|
registerNavigator,
|
|
8729
8798
|
runPeriodUpdate,
|
|
8730
8799
|
scoreAccuracyInZone,
|
|
8800
|
+
setDebugSessionId,
|
|
8731
8801
|
updateLearningState,
|
|
8732
8802
|
updateStrategyWeight,
|
|
8733
8803
|
userDBDebugAPI,
|