@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
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { U as UserDBInterface, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface, a as UserDBReader, d as CourseInfo, S as StudySessionItem, D as DataLayerResult, e as ContentNavigationStrategyData, f as ContentNavigator, R as ReplanHints, G as GeneratorResult } from '../../contentSource-
|
|
2
|
-
import { D as DataLayerProvider } from '../../dataLayerProvider-
|
|
3
|
-
import { S as StaticCourseManifest } from '../../types-
|
|
1
|
+
import { U as UserDBInterface, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface, a as UserDBReader, d as CourseInfo, S as StudySessionItem, D as DataLayerResult, e as ContentNavigationStrategyData, f as ContentNavigator, R as ReplanHints, G as GeneratorResult } from '../../contentSource-CpTxVrFx.cjs';
|
|
2
|
+
import { D as DataLayerProvider } from '../../dataLayerProvider-D4c7iUc_.cjs';
|
|
3
|
+
import { S as StaticCourseManifest } from '../../types-r6fyuWP2.cjs';
|
|
4
4
|
import { CourseConfig, CourseElo, DataShape } from '@vue-skuilder/common';
|
|
5
|
-
import { S as SkuilderCourseData, Q as QualifiedCardID, T as TagStub, a as Tag } from '../../types-legacy-
|
|
5
|
+
import { S as SkuilderCourseData, Q as QualifiedCardID, T as TagStub, a as Tag } from '../../types-legacy-BytY5eAR.cjs';
|
|
6
6
|
import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-CCU1H81I.cjs';
|
|
7
7
|
import 'moment';
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { U as UserDBInterface, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface, a as UserDBReader, d as CourseInfo, S as StudySessionItem, D as DataLayerResult, e as ContentNavigationStrategyData, f as ContentNavigator, R as ReplanHints, G as GeneratorResult } from '../../contentSource-
|
|
2
|
-
import { D as DataLayerProvider } from '../../dataLayerProvider-
|
|
3
|
-
import { S as StaticCourseManifest } from '../../types-
|
|
1
|
+
import { U as UserDBInterface, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface, a as UserDBReader, d as CourseInfo, S as StudySessionItem, D as DataLayerResult, e as ContentNavigationStrategyData, f as ContentNavigator, R as ReplanHints, G as GeneratorResult } from '../../contentSource-B1pqryv6.js';
|
|
2
|
+
import { D as DataLayerProvider } from '../../dataLayerProvider-BZqH27f4.js';
|
|
3
|
+
import { S as StaticCourseManifest } from '../../types-B-Y3aoi5.js';
|
|
4
4
|
import { CourseConfig, CourseElo, DataShape } from '@vue-skuilder/common';
|
|
5
|
-
import { S as SkuilderCourseData, Q as QualifiedCardID, T as TagStub, a as Tag } from '../../types-legacy-
|
|
5
|
+
import { S as SkuilderCourseData, Q as QualifiedCardID, T as TagStub, a as Tag } from '../../types-legacy-BytY5eAR.js';
|
|
6
6
|
import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-CCU1H81I.js';
|
|
7
7
|
import 'moment';
|
|
8
8
|
|
|
@@ -122,6 +122,7 @@ var init_types_legacy = __esm({
|
|
|
122
122
|
DocType3["STRATEGY_STATE"] = "STRATEGY_STATE";
|
|
123
123
|
DocType3["USER_OUTCOME"] = "USER_OUTCOME";
|
|
124
124
|
DocType3["STRATEGY_LEARNING_STATE"] = "STRATEGY_LEARNING_STATE";
|
|
125
|
+
DocType3["STUDY_SESSION"] = "STUDY_SESSION";
|
|
125
126
|
return DocType3;
|
|
126
127
|
})(DocType || {});
|
|
127
128
|
DocTypePrefixes = {
|
|
@@ -138,7 +139,8 @@ var init_types_legacy = __esm({
|
|
|
138
139
|
["NAVIGATION_STRATEGY" /* NAVIGATION_STRATEGY */]: "NAVIGATION_STRATEGY",
|
|
139
140
|
["STRATEGY_STATE" /* STRATEGY_STATE */]: "STRATEGY_STATE",
|
|
140
141
|
["USER_OUTCOME" /* USER_OUTCOME */]: "USER_OUTCOME",
|
|
141
|
-
["STRATEGY_LEARNING_STATE" /* STRATEGY_LEARNING_STATE */]: "STRATEGY_LEARNING_STATE"
|
|
142
|
+
["STRATEGY_LEARNING_STATE" /* STRATEGY_LEARNING_STATE */]: "STRATEGY_LEARNING_STATE",
|
|
143
|
+
["STUDY_SESSION" /* STUDY_SESSION */]: "SESSION"
|
|
142
144
|
};
|
|
143
145
|
}
|
|
144
146
|
});
|
|
@@ -620,10 +622,13 @@ __export(PipelineDebugger_exports, {
|
|
|
620
622
|
buildRunReport: () => buildRunReport,
|
|
621
623
|
captureRun: () => captureRun,
|
|
622
624
|
clearRunHistory: () => clearRunHistory,
|
|
625
|
+
drainCapturedRuns: () => drainCapturedRuns,
|
|
623
626
|
getActivePipeline: () => getActivePipeline,
|
|
627
|
+
getRunsForSession: () => getRunsForSession,
|
|
624
628
|
mountPipelineDebugger: () => mountPipelineDebugger,
|
|
625
629
|
pipelineDebugAPI: () => pipelineDebugAPI,
|
|
626
|
-
registerPipelineForDebug: () => registerPipelineForDebug
|
|
630
|
+
registerPipelineForDebug: () => registerPipelineForDebug,
|
|
631
|
+
setDebugSessionId: () => setDebugSessionId
|
|
627
632
|
});
|
|
628
633
|
function registerPipelineForDebug(pipeline) {
|
|
629
634
|
_activePipeline = pipeline;
|
|
@@ -631,8 +636,20 @@ function registerPipelineForDebug(pipeline) {
|
|
|
631
636
|
function getActivePipeline() {
|
|
632
637
|
return _activePipeline;
|
|
633
638
|
}
|
|
639
|
+
function setDebugSessionId(sessionId) {
|
|
640
|
+
_currentSessionId = sessionId;
|
|
641
|
+
}
|
|
642
|
+
function drainCapturedRuns() {
|
|
643
|
+
const drained = _pendingRuns;
|
|
644
|
+
_pendingRuns = [];
|
|
645
|
+
return drained;
|
|
646
|
+
}
|
|
647
|
+
function getRunsForSession(sessionId) {
|
|
648
|
+
return runHistory.filter((r) => r.sessionId === sessionId).reverse();
|
|
649
|
+
}
|
|
634
650
|
function clearRunHistory() {
|
|
635
651
|
runHistory.length = 0;
|
|
652
|
+
_pendingRuns = [];
|
|
636
653
|
}
|
|
637
654
|
function getOrigin(card) {
|
|
638
655
|
const firstEntry = card.provenance[0];
|
|
@@ -647,12 +664,15 @@ function captureRun(report) {
|
|
|
647
664
|
const fullReport = {
|
|
648
665
|
...report,
|
|
649
666
|
runId: `run-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
667
|
+
sessionId: _currentSessionId,
|
|
650
668
|
timestamp: /* @__PURE__ */ new Date()
|
|
651
669
|
};
|
|
652
670
|
runHistory.unshift(fullReport);
|
|
653
671
|
if (runHistory.length > MAX_RUNS) {
|
|
654
672
|
runHistory.pop();
|
|
655
673
|
}
|
|
674
|
+
_pendingRuns.push(fullReport);
|
|
675
|
+
return fullReport;
|
|
656
676
|
}
|
|
657
677
|
function parseCardElo(provenance) {
|
|
658
678
|
const eloEntry = provenance.find((p) => p.strategy === "elo");
|
|
@@ -980,7 +1000,7 @@ function mountPipelineDebugger() {
|
|
|
980
1000
|
win.skuilder = win.skuilder || {};
|
|
981
1001
|
win.skuilder.pipeline = pipelineDebugAPI;
|
|
982
1002
|
}
|
|
983
|
-
var _activePipeline, MAX_RUNS, runHistory, DISCARDED_KEEP_TOP, _uiContainer, _selectedRunIndex, _cardSearchQuery, pipelineDebugAPI;
|
|
1003
|
+
var _activePipeline, MAX_RUNS, runHistory, _currentSessionId, _pendingRuns, DISCARDED_KEEP_TOP, _uiContainer, _selectedRunIndex, _cardSearchQuery, pipelineDebugAPI;
|
|
984
1004
|
var init_PipelineDebugger = __esm({
|
|
985
1005
|
"src/core/navigators/PipelineDebugger.ts"() {
|
|
986
1006
|
"use strict";
|
|
@@ -989,6 +1009,7 @@ var init_PipelineDebugger = __esm({
|
|
|
989
1009
|
_activePipeline = null;
|
|
990
1010
|
MAX_RUNS = 10;
|
|
991
1011
|
runHistory = [];
|
|
1012
|
+
_pendingRuns = [];
|
|
992
1013
|
DISCARDED_KEEP_TOP = 25;
|
|
993
1014
|
_uiContainer = null;
|
|
994
1015
|
_selectedRunIndex = null;
|
|
@@ -4966,11 +4987,13 @@ __export(navigators_exports, {
|
|
|
4966
4987
|
clearSrsBacklogDebug: () => clearSrsBacklogDebug,
|
|
4967
4988
|
clearStrategyPressureDebug: () => clearStrategyPressureDebug,
|
|
4968
4989
|
diversityRerank: () => diversityRerank,
|
|
4990
|
+
drainCapturedRuns: () => drainCapturedRuns,
|
|
4969
4991
|
getActivePipeline: () => getActivePipeline,
|
|
4970
4992
|
getCardOrigin: () => getCardOrigin,
|
|
4971
4993
|
getRegisteredNavigator: () => getRegisteredNavigator,
|
|
4972
4994
|
getRegisteredNavigatorNames: () => getRegisteredNavigatorNames,
|
|
4973
4995
|
getRegisteredNavigatorRole: () => getRegisteredNavigatorRole,
|
|
4996
|
+
getRunsForSession: () => getRunsForSession,
|
|
4974
4997
|
getSrsBacklogDebug: () => getSrsBacklogDebug,
|
|
4975
4998
|
getStrategyPressureDebug: () => getStrategyPressureDebug,
|
|
4976
4999
|
hasRegisteredNavigator: () => hasRegisteredNavigator,
|
|
@@ -4979,7 +5002,8 @@ __export(navigators_exports, {
|
|
|
4979
5002
|
isGenerator: () => isGenerator,
|
|
4980
5003
|
mountPipelineDebugger: () => mountPipelineDebugger,
|
|
4981
5004
|
pipelineDebugAPI: () => pipelineDebugAPI,
|
|
4982
|
-
registerNavigator: () => registerNavigator
|
|
5005
|
+
registerNavigator: () => registerNavigator,
|
|
5006
|
+
setDebugSessionId: () => setDebugSessionId
|
|
4983
5007
|
});
|
|
4984
5008
|
function registerNavigator(implementingClass, constructor, role) {
|
|
4985
5009
|
navigatorRegistry.set(implementingClass, { constructor, role });
|
|
@@ -6585,6 +6609,32 @@ Currently logged-in as ${this._username}.`
|
|
|
6585
6609
|
};
|
|
6586
6610
|
await this.localDB.put(doc);
|
|
6587
6611
|
}
|
|
6612
|
+
/**
|
|
6613
|
+
* Open and close write the same `_id`, so the 409 path is the expected
|
|
6614
|
+
* route for the second write, not an error case.
|
|
6615
|
+
*/
|
|
6616
|
+
async putStudySession(doc) {
|
|
6617
|
+
try {
|
|
6618
|
+
await this.localDB.put(doc);
|
|
6619
|
+
} catch (err) {
|
|
6620
|
+
if (err.status === 409) {
|
|
6621
|
+
const existing = await this.localDB.get(doc._id);
|
|
6622
|
+
await this.localDB.put({ ...doc, _rev: existing._rev });
|
|
6623
|
+
} else {
|
|
6624
|
+
throw err;
|
|
6625
|
+
}
|
|
6626
|
+
}
|
|
6627
|
+
}
|
|
6628
|
+
async getStudySessions(courseId) {
|
|
6629
|
+
const prefix = courseId ? `${DocTypePrefixes["STUDY_SESSION" /* STUDY_SESSION */]}::${courseId}::` : `${DocTypePrefixes["STUDY_SESSION" /* STUDY_SESSION */]}::`;
|
|
6630
|
+
const keys = getStartAndEndKeys(prefix);
|
|
6631
|
+
const res = await this.localDB.allDocs({
|
|
6632
|
+
startkey: keys.startkey,
|
|
6633
|
+
endkey: keys.endkey,
|
|
6634
|
+
include_docs: true
|
|
6635
|
+
});
|
|
6636
|
+
return res.rows.map((r) => r.doc).filter((d) => !!d).sort((a, b) => b.startTime.localeCompare(a.startTime));
|
|
6637
|
+
}
|
|
6588
6638
|
async putUserOutcome(record) {
|
|
6589
6639
|
try {
|
|
6590
6640
|
await this.localDB.put(record);
|
|
@@ -6732,6 +6782,14 @@ var init_userOutcome = __esm({
|
|
|
6732
6782
|
}
|
|
6733
6783
|
});
|
|
6734
6784
|
|
|
6785
|
+
// src/core/types/studySession.ts
|
|
6786
|
+
var init_studySession = __esm({
|
|
6787
|
+
"src/core/types/studySession.ts"() {
|
|
6788
|
+
"use strict";
|
|
6789
|
+
init_types_legacy();
|
|
6790
|
+
}
|
|
6791
|
+
});
|
|
6792
|
+
|
|
6735
6793
|
// src/core/types/hydration.ts
|
|
6736
6794
|
var HYDRATION_MARKER_ID;
|
|
6737
6795
|
var init_hydration = __esm({
|
|
@@ -7110,6 +7168,7 @@ var init_core = __esm({
|
|
|
7110
7168
|
init_user();
|
|
7111
7169
|
init_strategyState();
|
|
7112
7170
|
init_userOutcome();
|
|
7171
|
+
init_studySession();
|
|
7113
7172
|
init_hydration();
|
|
7114
7173
|
init_Loggable();
|
|
7115
7174
|
init_util();
|