@vue-skuilder/db 0.3.2 → 0.3.4
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-CSI0pJ2D.d.ts → contentSource-CPM872yn.d.ts} +2 -1
- package/dist/core/index.cjs +163 -49
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +3 -3
- package/dist/core/navigators/filters/eloDistance.mjs.map +1 -1
- package/dist/core/navigators/filters/skillPressure.mjs +109 -0
- package/dist/core/navigators/filters/skillPressure.mjs.map +1 -0
- package/dist/core/navigators/generators/prescribed.mjs.map +1 -1
- package/dist/core/navigators/index.mjs +7 -3
- package/dist/core/navigators/index.mjs.map +1 -1
- package/dist/core/versionStamps.mjs +1 -1
- package/dist/{dataLayerProvider-D5n1gGc_.d.ts → dataLayerProvider-CaNgzRCz.d.ts} +1 -1
- package/dist/diagnostics/derive.mjs.map +1 -1
- package/dist/diagnostics/index.cjs +16 -3
- package/dist/diagnostics/index.cjs.map +1 -1
- package/dist/diagnostics/index.d.ts +29 -6
- package/dist/diagnostics/tagElo.mjs +20 -4
- package/dist/diagnostics/tagElo.mjs.map +1 -1
- package/dist/impl/couch/index.cjs +2 -1
- package/dist/impl/couch/index.cjs.map +1 -1
- package/dist/impl/couch/index.d.ts +2 -2
- package/dist/impl/static/index.cjs +2 -1
- package/dist/impl/static/index.cjs.map +1 -1
- package/dist/impl/static/index.d.ts +2 -2
- package/dist/index.cjs +211 -91
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/study/services/tagRecent.mjs +2 -1
- package/dist/study/services/tagRecent.mjs.map +1 -1
- package/package.json +3 -3
- package/src/core/navigators/filters/eloDistance.ts +2 -2
- package/src/core/navigators/filters/index.ts +3 -0
- package/src/core/navigators/filters/skillPressure.ts +194 -0
- package/src/core/navigators/generators/prescribed.ts +5 -6
- package/src/core/navigators/index.ts +5 -0
- package/src/diagnostics/derive.ts +6 -1
- package/src/diagnostics/tagElo.ts +43 -3
- package/src/study/services/tagRecent.test.ts +57 -3
- package/src/study/services/tagRecent.ts +8 -1
- package/tests/core/navigators/skillPressureFilter.test.ts +84 -0
|
@@ -1675,7 +1675,8 @@ declare enum Navigators {
|
|
|
1675
1675
|
INTERFERENCE = "interferenceMitigator",
|
|
1676
1676
|
RELATIVE_PRIORITY = "relativePriority",
|
|
1677
1677
|
USER_TAG_PREFERENCE = "userTagPreference",
|
|
1678
|
-
ELO_DISTANCE = "eloDistance"
|
|
1678
|
+
ELO_DISTANCE = "eloDistance",
|
|
1679
|
+
SKILL_PRESSURE = "skillPressure"
|
|
1679
1680
|
}
|
|
1680
1681
|
/**
|
|
1681
1682
|
* Role classification for navigation strategies.
|
package/dist/core/index.cjs
CHANGED
|
@@ -3336,6 +3336,115 @@ var init_eloDistance = __esm({
|
|
|
3336
3336
|
}
|
|
3337
3337
|
});
|
|
3338
3338
|
|
|
3339
|
+
// src/core/navigators/filters/skillPressure.ts
|
|
3340
|
+
var skillPressure_exports = {};
|
|
3341
|
+
__export(skillPressure_exports, {
|
|
3342
|
+
default: () => SkillPressureFilter,
|
|
3343
|
+
skillPressures: () => skillPressures
|
|
3344
|
+
});
|
|
3345
|
+
function skillPressures(elo, config = {}) {
|
|
3346
|
+
const out = /* @__PURE__ */ new Map();
|
|
3347
|
+
const raise = (tag, pressure, why) => {
|
|
3348
|
+
if (pressure <= 0) return;
|
|
3349
|
+
const prev = out.get(tag);
|
|
3350
|
+
if (!prev || pressure > prev.pressure) out.set(tag, { pressure, why });
|
|
3351
|
+
};
|
|
3352
|
+
for (const s of (0, import_common6.skillNeed)(elo, config).skills) {
|
|
3353
|
+
raise(s.tag, s.need, `need ${s.need.toFixed(2)} (${Math.round(s.deficit)} below the skill median)`);
|
|
3354
|
+
}
|
|
3355
|
+
if (config.security !== false) {
|
|
3356
|
+
const weights = { ...DEFAULT_SECURITY_WEIGHTS, ...config.security ?? {} };
|
|
3357
|
+
const { include, exclude, roles } = config;
|
|
3358
|
+
const security = (0, import_common6.courseSecurity)(elo, {
|
|
3359
|
+
selector: { include, exclude, roles },
|
|
3360
|
+
config: config.security ? config.security.config : void 0
|
|
3361
|
+
});
|
|
3362
|
+
for (const s of security.tags) {
|
|
3363
|
+
if (s.status === "secure") continue;
|
|
3364
|
+
const n = Math.min(s.attempts, 12);
|
|
3365
|
+
raise(
|
|
3366
|
+
s.tag,
|
|
3367
|
+
weights[s.status],
|
|
3368
|
+
s.status === "shaky" ? `shaky (${s.right}/${n} right)` : `unproven (${s.attempts} recent attempts)`
|
|
3369
|
+
);
|
|
3370
|
+
}
|
|
3371
|
+
}
|
|
3372
|
+
return out;
|
|
3373
|
+
}
|
|
3374
|
+
async function applySkillPressure(cards, context, config, source) {
|
|
3375
|
+
if (!context.userCourseElo) return cards;
|
|
3376
|
+
const pressures = skillPressures(context.userCourseElo, config);
|
|
3377
|
+
if (pressures.size === 0) return cards;
|
|
3378
|
+
const gain = config.gain ?? DEFAULT_GAIN;
|
|
3379
|
+
return cards.map((card) => {
|
|
3380
|
+
let top = null;
|
|
3381
|
+
for (const tag of card.tags ?? []) {
|
|
3382
|
+
const entry = pressures.get(tag);
|
|
3383
|
+
if (entry && (!top || entry.pressure > top.entry.pressure)) top = { tag, entry };
|
|
3384
|
+
}
|
|
3385
|
+
if (!top) return card;
|
|
3386
|
+
const multiplier = 1 + gain * top.entry.pressure;
|
|
3387
|
+
const score = card.score * multiplier;
|
|
3388
|
+
return {
|
|
3389
|
+
...card,
|
|
3390
|
+
score,
|
|
3391
|
+
provenance: [
|
|
3392
|
+
...card.provenance,
|
|
3393
|
+
{
|
|
3394
|
+
strategy: "skillPressure",
|
|
3395
|
+
strategyName: source.name,
|
|
3396
|
+
strategyId: source.strategyId,
|
|
3397
|
+
action: "boosted",
|
|
3398
|
+
score,
|
|
3399
|
+
reason: `skill pressure: ${top.tag} ${top.entry.why} \u2192 \xD7${multiplier.toFixed(2)}`
|
|
3400
|
+
}
|
|
3401
|
+
]
|
|
3402
|
+
};
|
|
3403
|
+
});
|
|
3404
|
+
}
|
|
3405
|
+
var import_common6, DEFAULT_GAIN, DEFAULT_SECURITY_WEIGHTS, SkillPressureFilter;
|
|
3406
|
+
var init_skillPressure = __esm({
|
|
3407
|
+
"src/core/navigators/filters/skillPressure.ts"() {
|
|
3408
|
+
"use strict";
|
|
3409
|
+
import_common6 = require("@vue-skuilder/common");
|
|
3410
|
+
init_navigators();
|
|
3411
|
+
DEFAULT_GAIN = 0.5;
|
|
3412
|
+
DEFAULT_SECURITY_WEIGHTS = {
|
|
3413
|
+
shaky: 0.8,
|
|
3414
|
+
unproven: 0.5
|
|
3415
|
+
};
|
|
3416
|
+
SkillPressureFilter = class _SkillPressureFilter extends ContentNavigator {
|
|
3417
|
+
name;
|
|
3418
|
+
/** See CardFilter.kind. Static, so the pipeline plan can read it without an instance. */
|
|
3419
|
+
static kind = "signal";
|
|
3420
|
+
kind = _SkillPressureFilter.kind;
|
|
3421
|
+
config;
|
|
3422
|
+
constructor(user, course, strategyData) {
|
|
3423
|
+
super(user, course, strategyData);
|
|
3424
|
+
this.name = strategyData.name || "Skill Pressure";
|
|
3425
|
+
let parsed = {};
|
|
3426
|
+
try {
|
|
3427
|
+
parsed = strategyData.serializedData ? JSON.parse(strategyData.serializedData) : {};
|
|
3428
|
+
} catch {
|
|
3429
|
+
parsed = {};
|
|
3430
|
+
}
|
|
3431
|
+
this.config = parsed;
|
|
3432
|
+
}
|
|
3433
|
+
transform(cards, context) {
|
|
3434
|
+
return applySkillPressure(cards, context, this.config, {
|
|
3435
|
+
name: this.name,
|
|
3436
|
+
strategyId: this.strategyId || "NAVIGATION_STRATEGY-skillPressure"
|
|
3437
|
+
});
|
|
3438
|
+
}
|
|
3439
|
+
async getWeightedCards(_limit) {
|
|
3440
|
+
throw new Error(
|
|
3441
|
+
"SkillPressureFilter is a filter and should not be used as a generator. Use Pipeline with a generator and this filter via transform()."
|
|
3442
|
+
);
|
|
3443
|
+
}
|
|
3444
|
+
};
|
|
3445
|
+
}
|
|
3446
|
+
});
|
|
3447
|
+
|
|
3339
3448
|
// src/core/navigators/index.ts
|
|
3340
3449
|
function registerNavigator(implementingClass, constructor, role) {
|
|
3341
3450
|
navigatorRegistry.set(implementingClass, { constructor, role });
|
|
@@ -3372,19 +3481,22 @@ async function initializeNavigatorRegistry() {
|
|
|
3372
3481
|
interferenceModule,
|
|
3373
3482
|
relativePriorityModule,
|
|
3374
3483
|
userTagPreferenceModule,
|
|
3375
|
-
eloDistanceModule
|
|
3484
|
+
eloDistanceModule,
|
|
3485
|
+
skillPressureModule
|
|
3376
3486
|
] = await Promise.all([
|
|
3377
3487
|
Promise.resolve().then(() => (init_hierarchyDefinition(), hierarchyDefinition_exports)),
|
|
3378
3488
|
Promise.resolve().then(() => (init_interferenceMitigator(), interferenceMitigator_exports)),
|
|
3379
3489
|
Promise.resolve().then(() => (init_relativePriority(), relativePriority_exports)),
|
|
3380
3490
|
Promise.resolve().then(() => (init_userTagPreference(), userTagPreference_exports)),
|
|
3381
|
-
Promise.resolve().then(() => (init_eloDistance(), eloDistance_exports))
|
|
3491
|
+
Promise.resolve().then(() => (init_eloDistance(), eloDistance_exports)),
|
|
3492
|
+
Promise.resolve().then(() => (init_skillPressure(), skillPressure_exports))
|
|
3382
3493
|
]);
|
|
3383
3494
|
registerNavigator("hierarchyDefinition", hierarchyModule.default);
|
|
3384
3495
|
registerNavigator("interferenceMitigator", interferenceModule.default);
|
|
3385
3496
|
registerNavigator("relativePriority", relativePriorityModule.default);
|
|
3386
3497
|
registerNavigator("userTagPreference", userTagPreferenceModule.default);
|
|
3387
3498
|
registerNavigator("eloDistance", eloDistanceModule.default);
|
|
3499
|
+
registerNavigator("skillPressure", skillPressureModule.default);
|
|
3388
3500
|
logger.debug(
|
|
3389
3501
|
`[NavigatorRegistry] Initialized ${navigatorRegistry.size} navigators: ${getRegisteredNavigatorNames().join(", ")}`
|
|
3390
3502
|
);
|
|
@@ -3430,6 +3542,7 @@ var init_navigators = __esm({
|
|
|
3430
3542
|
Navigators2["RELATIVE_PRIORITY"] = "relativePriority";
|
|
3431
3543
|
Navigators2["USER_TAG_PREFERENCE"] = "userTagPreference";
|
|
3432
3544
|
Navigators2["ELO_DISTANCE"] = "eloDistance";
|
|
3545
|
+
Navigators2["SKILL_PRESSURE"] = "skillPressure";
|
|
3433
3546
|
return Navigators2;
|
|
3434
3547
|
})(Navigators || {});
|
|
3435
3548
|
NavigatorRole = /* @__PURE__ */ ((NavigatorRole2) => {
|
|
@@ -3445,7 +3558,8 @@ var init_navigators = __esm({
|
|
|
3445
3558
|
["interferenceMitigator" /* INTERFERENCE */]: "filter" /* FILTER */,
|
|
3446
3559
|
["relativePriority" /* RELATIVE_PRIORITY */]: "filter" /* FILTER */,
|
|
3447
3560
|
["userTagPreference" /* USER_TAG_PREFERENCE */]: "filter" /* FILTER */,
|
|
3448
|
-
["eloDistance" /* ELO_DISTANCE */]: "filter" /* FILTER
|
|
3561
|
+
["eloDistance" /* ELO_DISTANCE */]: "filter" /* FILTER */,
|
|
3562
|
+
["skillPressure" /* SKILL_PRESSURE */]: "filter" /* FILTER */
|
|
3449
3563
|
};
|
|
3450
3564
|
ContentNavigator = class {
|
|
3451
3565
|
/** User interface for this navigation session */
|
|
@@ -4524,11 +4638,11 @@ function logCardProvenance(cards, maxCards = 3) {
|
|
|
4524
4638
|
}
|
|
4525
4639
|
}
|
|
4526
4640
|
}
|
|
4527
|
-
var
|
|
4641
|
+
var import_common7, VERBOSE_RESULTS, Pipeline;
|
|
4528
4642
|
var init_Pipeline = __esm({
|
|
4529
4643
|
"src/core/navigators/Pipeline.ts"() {
|
|
4530
4644
|
"use strict";
|
|
4531
|
-
|
|
4645
|
+
import_common7 = require("@vue-skuilder/common");
|
|
4532
4646
|
init_navigators();
|
|
4533
4647
|
init_logger();
|
|
4534
4648
|
init_perfMarks();
|
|
@@ -5040,7 +5154,7 @@ var init_Pipeline = __esm({
|
|
|
5040
5154
|
let userCourseElo;
|
|
5041
5155
|
try {
|
|
5042
5156
|
const courseReg = await this.user.getCourseRegDoc(this.course.getCourseID());
|
|
5043
|
-
userCourseElo = (0,
|
|
5157
|
+
userCourseElo = (0, import_common7.toCourseElo)(courseReg.elo);
|
|
5044
5158
|
userElo = userCourseElo.global.score;
|
|
5045
5159
|
} catch (e) {
|
|
5046
5160
|
logger.debug(`[Pipeline] Could not get user ELO, using default: ${e}`);
|
|
@@ -5103,7 +5217,7 @@ var init_Pipeline = __esm({
|
|
|
5103
5217
|
*/
|
|
5104
5218
|
async getTagEloStatus(tagFilter) {
|
|
5105
5219
|
const courseReg = await this.user.getCourseRegDoc(this.course.getCourseID());
|
|
5106
|
-
const courseElo = (0,
|
|
5220
|
+
const courseElo = (0, import_common7.toCourseElo)(courseReg.elo);
|
|
5107
5221
|
const result = {};
|
|
5108
5222
|
if (!tagFilter) {
|
|
5109
5223
|
for (const [tag, data] of Object.entries(courseElo.tags)) {
|
|
@@ -5812,11 +5926,11 @@ ${JSON.stringify(config)}
|
|
|
5812
5926
|
function isSuccessRow(row) {
|
|
5813
5927
|
return "doc" in row && row.doc !== null && row.doc !== void 0;
|
|
5814
5928
|
}
|
|
5815
|
-
var
|
|
5929
|
+
var import_common8, CourseDB;
|
|
5816
5930
|
var init_courseDB = __esm({
|
|
5817
5931
|
"src/impl/couch/courseDB.ts"() {
|
|
5818
5932
|
"use strict";
|
|
5819
|
-
|
|
5933
|
+
import_common8 = require("@vue-skuilder/common");
|
|
5820
5934
|
init_couch();
|
|
5821
5935
|
init_updateQueue();
|
|
5822
5936
|
init_types_legacy();
|
|
@@ -5922,14 +6036,14 @@ var init_courseDB = __esm({
|
|
|
5922
6036
|
docs.rows.forEach((r) => {
|
|
5923
6037
|
if (isSuccessRow(r)) {
|
|
5924
6038
|
if (r.doc && r.doc.elo) {
|
|
5925
|
-
ret.push((0,
|
|
6039
|
+
ret.push((0, import_common8.toCourseElo)(r.doc.elo));
|
|
5926
6040
|
} else {
|
|
5927
6041
|
logger.warn("no elo data for card: " + r.id);
|
|
5928
|
-
ret.push((0,
|
|
6042
|
+
ret.push((0, import_common8.blankCourseElo)());
|
|
5929
6043
|
}
|
|
5930
6044
|
} else {
|
|
5931
6045
|
logger.warn("no elo data for card: " + JSON.stringify(r));
|
|
5932
|
-
ret.push((0,
|
|
6046
|
+
ret.push((0, import_common8.blankCourseElo)());
|
|
5933
6047
|
}
|
|
5934
6048
|
});
|
|
5935
6049
|
return ret;
|
|
@@ -6127,7 +6241,7 @@ ${above.rows.map((r) => ` ${r.id}-${r.key}
|
|
|
6127
6241
|
async getCourseTagStubs() {
|
|
6128
6242
|
return filterAllDocsByPrefix2(this.db, "TAG" /* TAG */.valueOf() + "-");
|
|
6129
6243
|
}
|
|
6130
|
-
async addNote(codeCourse, shape, data, author, tags, uploads, elo = (0,
|
|
6244
|
+
async addNote(codeCourse, shape, data, author, tags, uploads, elo = (0, import_common8.blankCourseElo)()) {
|
|
6131
6245
|
try {
|
|
6132
6246
|
const resp = await addNote55(this.id, codeCourse, shape, data, author, tags, uploads, elo);
|
|
6133
6247
|
if (resp.ok) {
|
|
@@ -6136,19 +6250,19 @@ ${above.rows.map((r) => ` ${r.id}-${r.key}
|
|
|
6136
6250
|
`[courseDB.addNote] Note added but card creation failed: ${resp.cardCreationError}`
|
|
6137
6251
|
);
|
|
6138
6252
|
return {
|
|
6139
|
-
status:
|
|
6253
|
+
status: import_common8.Status.error,
|
|
6140
6254
|
message: `Note was added but no cards were created: ${resp.cardCreationError}`,
|
|
6141
6255
|
id: resp.id
|
|
6142
6256
|
};
|
|
6143
6257
|
}
|
|
6144
6258
|
return {
|
|
6145
|
-
status:
|
|
6259
|
+
status: import_common8.Status.ok,
|
|
6146
6260
|
message: "",
|
|
6147
6261
|
id: resp.id
|
|
6148
6262
|
};
|
|
6149
6263
|
} else {
|
|
6150
6264
|
return {
|
|
6151
|
-
status:
|
|
6265
|
+
status: import_common8.Status.error,
|
|
6152
6266
|
message: "Unexpected error adding note"
|
|
6153
6267
|
};
|
|
6154
6268
|
}
|
|
@@ -6160,7 +6274,7 @@ ${above.rows.map((r) => ` ${r.id}-${r.key}
|
|
|
6160
6274
|
message: ${err.message}`
|
|
6161
6275
|
);
|
|
6162
6276
|
return {
|
|
6163
|
-
status:
|
|
6277
|
+
status: import_common8.Status.error,
|
|
6164
6278
|
message: `Error adding note to course. ${e.reason || err.message}`
|
|
6165
6279
|
};
|
|
6166
6280
|
}
|
|
@@ -6367,7 +6481,7 @@ ${e.stack}` : JSON.stringify(e);
|
|
|
6367
6481
|
const courseDoc = (await u.getCourseRegistrationsDoc()).courses.find((c) => {
|
|
6368
6482
|
return c.courseID === this.id;
|
|
6369
6483
|
});
|
|
6370
|
-
targetElo = (0,
|
|
6484
|
+
targetElo = (0, import_common8.EloToNumber)(courseDoc.elo);
|
|
6371
6485
|
} catch {
|
|
6372
6486
|
targetElo = 1e3;
|
|
6373
6487
|
}
|
|
@@ -6550,12 +6664,12 @@ function getStreak(records) {
|
|
|
6550
6664
|
function getLapses(records) {
|
|
6551
6665
|
return records.filter((r) => r.isCorrect === false).length;
|
|
6552
6666
|
}
|
|
6553
|
-
var import_moment3,
|
|
6667
|
+
var import_moment3, import_common9, duration, SLOW_CORRECT_MAX_INTERVAL;
|
|
6554
6668
|
var init_SpacedRepetition = __esm({
|
|
6555
6669
|
"src/study/SpacedRepetition.ts"() {
|
|
6556
6670
|
"use strict";
|
|
6557
6671
|
import_moment3 = __toESM(require("moment"), 1);
|
|
6558
|
-
|
|
6672
|
+
import_common9 = require("@vue-skuilder/common");
|
|
6559
6673
|
duration = import_moment3.default.duration;
|
|
6560
6674
|
SLOW_CORRECT_MAX_INTERVAL = 20 * 60 * 60;
|
|
6561
6675
|
}
|
|
@@ -7476,11 +7590,11 @@ var init_SessionController = __esm({
|
|
|
7476
7590
|
});
|
|
7477
7591
|
|
|
7478
7592
|
// src/study/TagFilteredContentSource.ts
|
|
7479
|
-
var
|
|
7593
|
+
var import_common10, TagFilteredContentSource;
|
|
7480
7594
|
var init_TagFilteredContentSource = __esm({
|
|
7481
7595
|
"src/study/TagFilteredContentSource.ts"() {
|
|
7482
7596
|
"use strict";
|
|
7483
|
-
|
|
7597
|
+
import_common10 = require("@vue-skuilder/common");
|
|
7484
7598
|
init_courseDB();
|
|
7485
7599
|
init_logger();
|
|
7486
7600
|
TagFilteredContentSource = class {
|
|
@@ -7566,7 +7680,7 @@ var init_TagFilteredContentSource = __esm({
|
|
|
7566
7680
|
* @returns Cards sorted by score descending (all scores = 1.0)
|
|
7567
7681
|
*/
|
|
7568
7682
|
async getWeightedCards(limit) {
|
|
7569
|
-
if (!(0,
|
|
7683
|
+
if (!(0, import_common10.hasActiveFilter)(this.filter)) {
|
|
7570
7684
|
logger.warn("[TagFilteredContentSource] getWeightedCards called with no active filter");
|
|
7571
7685
|
return { cards: [] };
|
|
7572
7686
|
}
|
|
@@ -7876,13 +7990,13 @@ async function dropUserFromClassroom(user, classID) {
|
|
|
7876
7990
|
async function getUserClassrooms(user) {
|
|
7877
7991
|
return getOrCreateClassroomRegistrationsDoc(user);
|
|
7878
7992
|
}
|
|
7879
|
-
var
|
|
7993
|
+
var import_common11, import_moment6, log3, HYDRATION_TIMEOUT_MS, BaseUser, userCoursesDoc, userClassroomsDoc;
|
|
7880
7994
|
var init_BaseUserDB = __esm({
|
|
7881
7995
|
"src/impl/common/BaseUserDB.ts"() {
|
|
7882
7996
|
"use strict";
|
|
7883
7997
|
init_core();
|
|
7884
7998
|
init_util();
|
|
7885
|
-
|
|
7999
|
+
import_common11 = require("@vue-skuilder/common");
|
|
7886
8000
|
import_moment6 = __toESM(require("moment"), 1);
|
|
7887
8001
|
init_types_legacy();
|
|
7888
8002
|
init_logger();
|
|
@@ -7989,7 +8103,7 @@ Currently logged-in as ${this._username}.`
|
|
|
7989
8103
|
);
|
|
7990
8104
|
}
|
|
7991
8105
|
const result = await this.syncStrategy.createAccount(username, password);
|
|
7992
|
-
if (result.status ===
|
|
8106
|
+
if (result.status === import_common11.Status.ok) {
|
|
7993
8107
|
log3(`Account created successfully, updating username to ${username}`);
|
|
7994
8108
|
this._username = username;
|
|
7995
8109
|
try {
|
|
@@ -8065,7 +8179,7 @@ Currently logged-in as ${this._username}.`
|
|
|
8065
8179
|
async resetUserData() {
|
|
8066
8180
|
if (this.syncStrategy.canAuthenticate()) {
|
|
8067
8181
|
return {
|
|
8068
|
-
status:
|
|
8182
|
+
status: import_common11.Status.error,
|
|
8069
8183
|
error: "Reset user data is only available for local-only mode. Use logout instead for remote sync."
|
|
8070
8184
|
};
|
|
8071
8185
|
}
|
|
@@ -8087,11 +8201,11 @@ Currently logged-in as ${this._username}.`
|
|
|
8087
8201
|
await localDB.bulkDocs(docsToDelete);
|
|
8088
8202
|
}
|
|
8089
8203
|
await this.init();
|
|
8090
|
-
return { status:
|
|
8204
|
+
return { status: import_common11.Status.ok };
|
|
8091
8205
|
} catch (error) {
|
|
8092
8206
|
logger.error("Failed to reset user data:", error);
|
|
8093
8207
|
return {
|
|
8094
|
-
status:
|
|
8208
|
+
status: import_common11.Status.error,
|
|
8095
8209
|
error: error instanceof Error ? error.message : "Unknown error during reset"
|
|
8096
8210
|
};
|
|
8097
8211
|
}
|
|
@@ -9029,12 +9143,12 @@ var init_common = __esm({
|
|
|
9029
9143
|
});
|
|
9030
9144
|
|
|
9031
9145
|
// src/impl/couch/courseAPI.ts
|
|
9032
|
-
async function addNote55(courseID, codeCourse, shape, data, author, tags, uploads, elo = (0,
|
|
9146
|
+
async function addNote55(courseID, codeCourse, shape, data, author, tags, uploads, elo = (0, import_common13.blankCourseElo)()) {
|
|
9033
9147
|
const db = getCourseDB(courseID);
|
|
9034
|
-
const payload = (0,
|
|
9148
|
+
const payload = (0, import_common14.prepareNote55)(courseID, codeCourse, shape, data, author, tags, uploads);
|
|
9035
9149
|
const _id = `${DocTypePrefixes["DISPLAYABLE_DATA" /* DISPLAYABLE_DATA */]}-${(0, import_uuid.v4)()}`;
|
|
9036
9150
|
const result = await db.put({ ...payload, _id });
|
|
9037
|
-
const dataShapeId =
|
|
9151
|
+
const dataShapeId = import_common12.NameSpacer.getDataShapeString({
|
|
9038
9152
|
course: codeCourse,
|
|
9039
9153
|
dataShape: shape.name
|
|
9040
9154
|
});
|
|
@@ -9061,9 +9175,9 @@ async function addNote55(courseID, codeCourse, shape, data, author, tags, upload
|
|
|
9061
9175
|
}
|
|
9062
9176
|
return result;
|
|
9063
9177
|
}
|
|
9064
|
-
async function createCards(courseID, datashapeID, noteID, tags, elo = (0,
|
|
9178
|
+
async function createCards(courseID, datashapeID, noteID, tags, elo = (0, import_common13.blankCourseElo)(), author) {
|
|
9065
9179
|
const cfg = await getCredentialledCourseConfig(courseID);
|
|
9066
|
-
const dsDescriptor =
|
|
9180
|
+
const dsDescriptor = import_common12.NameSpacer.getDataShapeDescriptor(datashapeID);
|
|
9067
9181
|
let questionViewTypes = [];
|
|
9068
9182
|
for (const ds of cfg.dataShapes) {
|
|
9069
9183
|
if (ds.name === datashapeID) {
|
|
@@ -9079,8 +9193,8 @@ async function createCards(courseID, datashapeID, noteID, tags, elo = (0, import
|
|
|
9079
9193
|
await createCard(questionView, courseID, dsDescriptor, noteID, tags, elo, author);
|
|
9080
9194
|
}
|
|
9081
9195
|
}
|
|
9082
|
-
async function createCard(questionViewName, courseID, dsDescriptor, noteID, tags, elo = (0,
|
|
9083
|
-
const qDescriptor =
|
|
9196
|
+
async function createCard(questionViewName, courseID, dsDescriptor, noteID, tags, elo = (0, import_common13.blankCourseElo)(), author) {
|
|
9197
|
+
const qDescriptor = import_common12.NameSpacer.getQuestionDescriptor(questionViewName);
|
|
9084
9198
|
const cfg = await getCredentialledCourseConfig(courseID);
|
|
9085
9199
|
for (const rQ of cfg.questionTypes) {
|
|
9086
9200
|
if (rQ.name === questionViewName) {
|
|
@@ -9089,7 +9203,7 @@ async function createCard(questionViewName, courseID, dsDescriptor, noteID, tags
|
|
|
9089
9203
|
courseID,
|
|
9090
9204
|
dsDescriptor.course,
|
|
9091
9205
|
[noteID],
|
|
9092
|
-
|
|
9206
|
+
import_common12.NameSpacer.getViewString({
|
|
9093
9207
|
course: qDescriptor.course,
|
|
9094
9208
|
questionType: qDescriptor.questionType,
|
|
9095
9209
|
view
|
|
@@ -9111,7 +9225,7 @@ async function addCard(courseID, course, id_displayable_data, id_view, elo, tags
|
|
|
9111
9225
|
id_displayable_data,
|
|
9112
9226
|
id_view,
|
|
9113
9227
|
docType: "CARD" /* CARD */,
|
|
9114
|
-
elo: elo || (0,
|
|
9228
|
+
elo: elo || (0, import_common13.toCourseElo)(990 + Math.round(20 * Math.random())),
|
|
9115
9229
|
author
|
|
9116
9230
|
});
|
|
9117
9231
|
for (const tag of tags) {
|
|
@@ -9204,16 +9318,16 @@ function getTagID(tagName) {
|
|
|
9204
9318
|
return tagPrefix + tagName;
|
|
9205
9319
|
}
|
|
9206
9320
|
}
|
|
9207
|
-
var
|
|
9321
|
+
var import_common12, import_common13, import_common14, import_uuid, COURSE_CONFIG_TTL_MS, courseConfigCache, AlreadyTaggedErr;
|
|
9208
9322
|
var init_courseAPI = __esm({
|
|
9209
9323
|
"src/impl/couch/courseAPI.ts"() {
|
|
9210
9324
|
"use strict";
|
|
9211
9325
|
init_couch();
|
|
9212
|
-
import_common11 = require("@vue-skuilder/common");
|
|
9213
9326
|
import_common12 = require("@vue-skuilder/common");
|
|
9327
|
+
import_common13 = require("@vue-skuilder/common");
|
|
9214
9328
|
init_courseDB();
|
|
9215
9329
|
init_types_legacy();
|
|
9216
|
-
|
|
9330
|
+
import_common14 = require("@vue-skuilder/common");
|
|
9217
9331
|
init_common();
|
|
9218
9332
|
init_logger();
|
|
9219
9333
|
import_uuid = require("uuid");
|
|
@@ -9236,11 +9350,11 @@ var init_CourseSyncService = __esm({
|
|
|
9236
9350
|
});
|
|
9237
9351
|
|
|
9238
9352
|
// src/impl/couch/CouchDBSyncStrategy.ts
|
|
9239
|
-
var
|
|
9353
|
+
var import_common16;
|
|
9240
9354
|
var init_CouchDBSyncStrategy = __esm({
|
|
9241
9355
|
"src/impl/couch/CouchDBSyncStrategy.ts"() {
|
|
9242
9356
|
"use strict";
|
|
9243
|
-
|
|
9357
|
+
import_common16 = require("@vue-skuilder/common");
|
|
9244
9358
|
}
|
|
9245
9359
|
});
|
|
9246
9360
|
|
|
@@ -9523,19 +9637,19 @@ async function getStudySource(source, user) {
|
|
|
9523
9637
|
if (source.type === "classroom") {
|
|
9524
9638
|
return await StudentClassroomDB.factory(source.id, user);
|
|
9525
9639
|
} else {
|
|
9526
|
-
if ((0,
|
|
9640
|
+
if ((0, import_common17.hasActiveFilter)(source.tagFilter)) {
|
|
9527
9641
|
return new TagFilteredContentSource(source.id, source.tagFilter, user);
|
|
9528
9642
|
}
|
|
9529
9643
|
return getDataLayer().getCourseDB(source.id);
|
|
9530
9644
|
}
|
|
9531
9645
|
}
|
|
9532
|
-
var
|
|
9646
|
+
var import_common17;
|
|
9533
9647
|
var init_contentSource = __esm({
|
|
9534
9648
|
"src/core/interfaces/contentSource.ts"() {
|
|
9535
9649
|
"use strict";
|
|
9536
9650
|
init_factory();
|
|
9537
9651
|
init_classroomDB2();
|
|
9538
|
-
|
|
9652
|
+
import_common17 = require("@vue-skuilder/common");
|
|
9539
9653
|
init_TagFilteredContentSource();
|
|
9540
9654
|
}
|
|
9541
9655
|
});
|
|
@@ -9675,7 +9789,7 @@ elo: ${elo}`;
|
|
|
9675
9789
|
misc: {}
|
|
9676
9790
|
} : void 0
|
|
9677
9791
|
);
|
|
9678
|
-
if (result.status ===
|
|
9792
|
+
if (result.status === import_common18.Status.ok) {
|
|
9679
9793
|
return {
|
|
9680
9794
|
originalText,
|
|
9681
9795
|
status: "success",
|
|
@@ -9719,11 +9833,11 @@ function validateProcessorConfig(config) {
|
|
|
9719
9833
|
}
|
|
9720
9834
|
return { isValid: true };
|
|
9721
9835
|
}
|
|
9722
|
-
var
|
|
9836
|
+
var import_common18;
|
|
9723
9837
|
var init_cardProcessor = __esm({
|
|
9724
9838
|
"src/core/bulkImport/cardProcessor.ts"() {
|
|
9725
9839
|
"use strict";
|
|
9726
|
-
|
|
9840
|
+
import_common18 = require("@vue-skuilder/common");
|
|
9727
9841
|
init_logger();
|
|
9728
9842
|
}
|
|
9729
9843
|
});
|