@vue-skuilder/db 0.1.11-20 → 0.1.11-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/core/index.d.mts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +87 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +87 -1
- package/dist/core/index.mjs.map +1 -1
- package/dist/{dataLayerProvider-BInqI_RF.d.mts → dataLayerProvider-Bx18k_g_.d.ts} +8 -1
- package/dist/{dataLayerProvider-DqtNroSh.d.ts → dataLayerProvider-DpqaIEJ5.d.mts} +8 -1
- package/dist/impl/couch/index.d.mts +4 -2
- package/dist/impl/couch/index.d.ts +4 -2
- package/dist/impl/couch/index.js +88 -1
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +88 -1
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.d.mts +5 -2
- package/dist/impl/static/index.d.ts +5 -2
- package/dist/impl/static/index.js +19 -0
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +19 -0
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +115 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +115 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{userDB-C33Hzjgn.d.mts → userDB-C7hiVoA5.d.mts} +78 -49
- package/dist/{userDB-DusL7OXe.d.ts → userDB-D6HS-b9s.d.ts} +78 -49
- package/package.json +2 -2
- package/src/core/interfaces/courseDB.ts +14 -0
- package/src/core/interfaces/dataLayerProvider.ts +9 -1
- package/src/core/interfaces/userDB.ts +91 -74
- package/src/impl/common/BaseUserDB.ts +4 -0
- package/src/impl/couch/PouchDataLayerProvider.ts +21 -0
- package/src/impl/couch/courseDB.ts +106 -3
- package/src/impl/couch/courseLookupDB.ts +4 -3
- package/src/impl/static/StaticDataLayerProvider.ts +11 -0
- package/src/impl/static/courseDB.ts +16 -0
- package/src/study/SpacedRepetition.ts +1 -1
package/dist/core/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export { D as DataLayerProvider } from '../dataLayerProvider-
|
|
1
|
+
import { i as StudyContentSource, U as UserDBInterface, C as CourseDBInterface, e as ContentNavigationStrategyData, f as StudySessionReviewItem, g as ScheduledCard, S as StudySessionNewItem } from '../userDB-C7hiVoA5.mjs';
|
|
2
|
+
export { G as ActivityRecord, A as AdminDBInterface, t as AssignedCard, h as AssignedContent, s as AssignedCourse, r as AssignedTag, c as ClassroomDBInterface, B as ClassroomRegistration, z as ClassroomRegistrationDesignation, E as ClassroomRegistrationDoc, p as ContentSourceID, d as CourseInfo, H as CourseRegistration, I as CourseRegistrationDoc, b as CoursesDBInterface, j as StudentClassroomDBInterface, l as StudySessionFailedItem, m as StudySessionFailedNewItem, n as StudySessionFailedReviewItem, k as StudySessionItem, T as TeacherClassroomDBInterface, F as UserConfig, x as UserCourseSetting, w as UserCourseSettings, v as UserDBAuthenticator, a as UserDBReader, u as UserDBWriter, y as UsrCrsDataInterface, q as getStudySource, o as isReview } from '../userDB-C7hiVoA5.mjs';
|
|
3
|
+
export { D as DataLayerProvider } from '../dataLayerProvider-DpqaIEJ5.mjs';
|
|
4
4
|
import { g as CardHistory, C as CardRecord, h as QuestionRecord } from '../types-legacy-Birv-Jx6.mjs';
|
|
5
5
|
export { b as CardData, c as CourseListData, e as DataShapeData, d as DisplayableData, D as DocType, f as DocTypePrefixes, F as Field, G as GuestUsername, Q as QuestionData, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from '../types-legacy-Birv-Jx6.mjs';
|
|
6
6
|
import { DataShape, ParsedCard } from '@vue-skuilder/common';
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export { D as DataLayerProvider } from '../dataLayerProvider-
|
|
1
|
+
import { i as StudyContentSource, U as UserDBInterface, C as CourseDBInterface, e as ContentNavigationStrategyData, f as StudySessionReviewItem, g as ScheduledCard, S as StudySessionNewItem } from '../userDB-D6HS-b9s.js';
|
|
2
|
+
export { G as ActivityRecord, A as AdminDBInterface, t as AssignedCard, h as AssignedContent, s as AssignedCourse, r as AssignedTag, c as ClassroomDBInterface, B as ClassroomRegistration, z as ClassroomRegistrationDesignation, E as ClassroomRegistrationDoc, p as ContentSourceID, d as CourseInfo, H as CourseRegistration, I as CourseRegistrationDoc, b as CoursesDBInterface, j as StudentClassroomDBInterface, l as StudySessionFailedItem, m as StudySessionFailedNewItem, n as StudySessionFailedReviewItem, k as StudySessionItem, T as TeacherClassroomDBInterface, F as UserConfig, x as UserCourseSetting, w as UserCourseSettings, v as UserDBAuthenticator, a as UserDBReader, u as UserDBWriter, y as UsrCrsDataInterface, q as getStudySource, o as isReview } from '../userDB-D6HS-b9s.js';
|
|
3
|
+
export { D as DataLayerProvider } from '../dataLayerProvider-Bx18k_g_.js';
|
|
4
4
|
import { g as CardHistory, C as CardRecord, h as QuestionRecord } from '../types-legacy-Birv-Jx6.js';
|
|
5
5
|
export { b as CardData, c as CourseListData, e as DataShapeData, d as DisplayableData, D as DocType, f as DocTypePrefixes, F as Field, G as GuestUsername, Q as QuestionData, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from '../types-legacy-Birv-Jx6.js';
|
|
6
6
|
import { DataShape, ParsedCard } from '@vue-skuilder/common';
|
package/dist/core/index.js
CHANGED
|
@@ -1081,7 +1081,13 @@ ${above.rows.map((r) => ` ${r.id}-${r.key}
|
|
|
1081
1081
|
}
|
|
1082
1082
|
}
|
|
1083
1083
|
async addTagToCard(cardId, tagId, updateELO) {
|
|
1084
|
-
return await addTagToCard(
|
|
1084
|
+
return await addTagToCard(
|
|
1085
|
+
this.id,
|
|
1086
|
+
cardId,
|
|
1087
|
+
tagId,
|
|
1088
|
+
(await this._getCurrentUser()).getUsername(),
|
|
1089
|
+
updateELO
|
|
1090
|
+
);
|
|
1085
1091
|
}
|
|
1086
1092
|
async removeTagFromCard(cardId, tagId) {
|
|
1087
1093
|
return await removeTagFromCard(this.id, cardId, tagId);
|
|
@@ -1285,6 +1291,83 @@ ${above.rows.map((r) => ` ${r.id}-${r.key}
|
|
|
1285
1291
|
};
|
|
1286
1292
|
});
|
|
1287
1293
|
}
|
|
1294
|
+
// Admin search methods
|
|
1295
|
+
async searchCards(query) {
|
|
1296
|
+
logger.log(`[CourseDB ${this.id}] Searching for: "${query}"`);
|
|
1297
|
+
let displayableData;
|
|
1298
|
+
try {
|
|
1299
|
+
displayableData = await this.db.find({
|
|
1300
|
+
selector: {
|
|
1301
|
+
docType: "DISPLAYABLE_DATA",
|
|
1302
|
+
"data.0.data": { $regex: `.*${query}.*` }
|
|
1303
|
+
}
|
|
1304
|
+
});
|
|
1305
|
+
logger.log(`[CourseDB ${this.id}] Regex search on data[0].data successful`);
|
|
1306
|
+
} catch (regexError) {
|
|
1307
|
+
logger.log(
|
|
1308
|
+
`[CourseDB ${this.id}] Regex search failed, falling back to manual search:`,
|
|
1309
|
+
regexError
|
|
1310
|
+
);
|
|
1311
|
+
const allDisplayable = await this.db.find({
|
|
1312
|
+
selector: {
|
|
1313
|
+
docType: "DISPLAYABLE_DATA"
|
|
1314
|
+
}
|
|
1315
|
+
});
|
|
1316
|
+
logger.log(
|
|
1317
|
+
`[CourseDB ${this.id}] Retrieved ${allDisplayable.docs.length} documents for manual filtering`
|
|
1318
|
+
);
|
|
1319
|
+
displayableData = {
|
|
1320
|
+
docs: allDisplayable.docs.filter((doc) => {
|
|
1321
|
+
const docString = JSON.stringify(doc).toLowerCase();
|
|
1322
|
+
const match = docString.includes(query.toLowerCase());
|
|
1323
|
+
if (match) {
|
|
1324
|
+
logger.log(`[CourseDB ${this.id}] Manual match found in document: ${doc._id}`);
|
|
1325
|
+
}
|
|
1326
|
+
return match;
|
|
1327
|
+
})
|
|
1328
|
+
};
|
|
1329
|
+
}
|
|
1330
|
+
logger.log(
|
|
1331
|
+
`[CourseDB ${this.id}] Found ${displayableData.docs.length} displayable data documents`
|
|
1332
|
+
);
|
|
1333
|
+
if (displayableData.docs.length === 0) {
|
|
1334
|
+
const allDisplayableData = await this.db.find({
|
|
1335
|
+
selector: {
|
|
1336
|
+
docType: "DISPLAYABLE_DATA"
|
|
1337
|
+
},
|
|
1338
|
+
limit: 5
|
|
1339
|
+
// Just sample a few
|
|
1340
|
+
});
|
|
1341
|
+
logger.log(
|
|
1342
|
+
`[CourseDB ${this.id}] Sample displayable data:`,
|
|
1343
|
+
allDisplayableData.docs.map((d) => ({
|
|
1344
|
+
id: d._id,
|
|
1345
|
+
docType: d.docType,
|
|
1346
|
+
dataStructure: d.data ? Object.keys(d.data) : "no data field",
|
|
1347
|
+
dataContent: d.data,
|
|
1348
|
+
fullDoc: d
|
|
1349
|
+
}))
|
|
1350
|
+
);
|
|
1351
|
+
}
|
|
1352
|
+
const allResults = [];
|
|
1353
|
+
for (const dd of displayableData.docs) {
|
|
1354
|
+
const cards = await this.db.find({
|
|
1355
|
+
selector: {
|
|
1356
|
+
docType: "CARD",
|
|
1357
|
+
id_displayable_data: { $in: [dd._id] }
|
|
1358
|
+
}
|
|
1359
|
+
});
|
|
1360
|
+
logger.log(
|
|
1361
|
+
`[CourseDB ${this.id}] Displayable data ${dd._id} linked to ${cards.docs.length} cards`
|
|
1362
|
+
);
|
|
1363
|
+
allResults.push(...cards.docs);
|
|
1364
|
+
}
|
|
1365
|
+
logger.log(`[CourseDB ${this.id}] Total cards found: ${allResults.length}`);
|
|
1366
|
+
return allResults;
|
|
1367
|
+
}
|
|
1368
|
+
async find(request) {
|
|
1369
|
+
return this.db.find(request);
|
|
1370
|
+
}
|
|
1288
1371
|
};
|
|
1289
1372
|
}
|
|
1290
1373
|
});
|
|
@@ -1768,6 +1851,9 @@ Currently logged-in as ${this._username}.`
|
|
|
1768
1851
|
await this.init();
|
|
1769
1852
|
return ret;
|
|
1770
1853
|
}
|
|
1854
|
+
async get(id) {
|
|
1855
|
+
return this.localDB.get(id);
|
|
1856
|
+
}
|
|
1771
1857
|
update(id, update) {
|
|
1772
1858
|
return this.updateQueue.update(id, update);
|
|
1773
1859
|
}
|