@vue-skuilder/db 0.1.11-9 → 0.1.12
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 +7 -6
- package/dist/core/index.d.ts +7 -6
- package/dist/core/index.js +358 -87
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +358 -87
- package/dist/core/index.mjs.map +1 -1
- package/dist/{dataLayerProvider-DqtNroSh.d.ts → dataLayerProvider-BiP3kWix.d.mts} +8 -1
- package/dist/{dataLayerProvider-BInqI_RF.d.mts → dataLayerProvider-DSdeyRT3.d.ts} +8 -1
- package/dist/impl/couch/index.d.mts +19 -7
- package/dist/impl/couch/index.d.ts +19 -7
- package/dist/impl/couch/index.js +375 -100
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +374 -99
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.d.mts +23 -8
- package/dist/impl/static/index.d.ts +23 -8
- package/dist/impl/static/index.js +289 -85
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +289 -85
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/{index-CUNnL38E.d.mts → index-Bmll7Xse.d.mts} +1 -1
- package/dist/{index-CLL31bEy.d.ts → index-CD8BZz2k.d.ts} +1 -1
- package/dist/index.d.mts +123 -20
- package/dist/index.d.ts +123 -20
- package/dist/index.js +1133 -343
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1137 -343
- package/dist/index.mjs.map +1 -1
- package/dist/pouch/index.d.mts +1 -0
- package/dist/pouch/index.d.ts +1 -0
- package/dist/pouch/index.js +49 -0
- package/dist/pouch/index.js.map +1 -0
- package/dist/pouch/index.mjs +16 -0
- package/dist/pouch/index.mjs.map +1 -0
- package/dist/{types-BefDGkKa.d.ts → types-CewsN87z.d.ts} +1 -1
- package/dist/{types-DC-ckZug.d.mts → types-Dbp5DaRR.d.mts} +1 -1
- package/dist/{types-legacy-Birv-Jx6.d.mts → types-legacy-6ettoclI.d.mts} +17 -2
- package/dist/{types-legacy-Birv-Jx6.d.ts → types-legacy-6ettoclI.d.ts} +17 -2
- package/dist/{userDB-DusL7OXe.d.ts → userDB-C4yyAnpp.d.mts} +89 -56
- package/dist/{userDB-C33Hzjgn.d.mts → userDB-CD6s6ZCp.d.ts} +89 -56
- package/dist/util/packer/index.d.mts +3 -3
- package/dist/util/packer/index.d.ts +3 -3
- package/package.json +3 -3
- package/src/core/interfaces/contentSource.ts +3 -2
- package/src/core/interfaces/courseDB.ts +26 -3
- package/src/core/interfaces/dataLayerProvider.ts +9 -1
- package/src/core/interfaces/userDB.ts +80 -64
- package/src/core/navigators/elo.ts +10 -7
- package/src/core/navigators/hardcodedOrder.ts +64 -0
- package/src/core/navigators/index.ts +2 -1
- package/src/core/types/contentNavigationStrategy.ts +2 -1
- package/src/core/types/types-legacy.ts +7 -2
- package/src/impl/common/BaseUserDB.ts +60 -14
- package/src/impl/couch/CouchDBSyncStrategy.ts +2 -2
- package/src/impl/couch/PouchDataLayerProvider.ts +21 -0
- package/src/impl/couch/adminDB.ts +2 -2
- package/src/impl/couch/auth.ts +13 -4
- package/src/impl/couch/classroomDB.ts +10 -12
- package/src/impl/couch/courseAPI.ts +2 -2
- package/src/impl/couch/courseDB.ts +204 -38
- package/src/impl/couch/courseLookupDB.ts +4 -3
- package/src/impl/couch/index.ts +36 -4
- package/src/impl/couch/pouchdb-setup.ts +3 -3
- package/src/impl/couch/updateQueue.ts +59 -36
- package/src/impl/static/StaticDataLayerProvider.ts +68 -17
- package/src/impl/static/courseDB.ts +64 -20
- package/src/impl/static/coursesDB.ts +10 -6
- package/src/pouch/index.ts +2 -0
- package/src/study/ItemQueue.ts +58 -0
- package/src/study/SessionController.ts +182 -111
- package/src/study/SpacedRepetition.ts +1 -1
- package/src/study/services/CardHydrationService.ts +153 -0
- package/src/study/services/EloService.ts +85 -0
- package/src/study/services/ResponseProcessor.ts +224 -0
- package/src/study/services/SrsService.ts +44 -0
- package/tsup.config.ts +1 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { U as UserDBInterface, C as CourseDBInterface,
|
|
1
|
+
import { U as UserDBInterface, a as UserDBReader, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface } from './userDB-C4yyAnpp.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Main factory interface for data access
|
|
@@ -8,6 +8,13 @@ interface DataLayerProvider {
|
|
|
8
8
|
* Get the user database interface
|
|
9
9
|
*/
|
|
10
10
|
getUserDB(): UserDBInterface;
|
|
11
|
+
/**
|
|
12
|
+
* Create a UserDBReader for a specific user (admin access required)
|
|
13
|
+
* Uses session authentication to verify requesting user is admin
|
|
14
|
+
* @param targetUsername - The username to create a reader for
|
|
15
|
+
* @throws Error if requesting user is not 'admin'
|
|
16
|
+
*/
|
|
17
|
+
createUserReaderForUser(targetUsername: string): Promise<UserDBReader>;
|
|
11
18
|
/**
|
|
12
19
|
* Get a course database interface
|
|
13
20
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { U as UserDBInterface, C as CourseDBInterface,
|
|
1
|
+
import { U as UserDBInterface, a as UserDBReader, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface } from './userDB-CD6s6ZCp.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Main factory interface for data access
|
|
@@ -8,6 +8,13 @@ interface DataLayerProvider {
|
|
|
8
8
|
* Get the user database interface
|
|
9
9
|
*/
|
|
10
10
|
getUserDB(): UserDBInterface;
|
|
11
|
+
/**
|
|
12
|
+
* Create a UserDBReader for a specific user (admin access required)
|
|
13
|
+
* Uses session authentication to verify requesting user is admin
|
|
14
|
+
* @param targetUsername - The username to create a reader for
|
|
15
|
+
* @throws Error if requesting user is not 'admin'
|
|
16
|
+
*/
|
|
17
|
+
createUserReaderForUser(targetUsername: string): Promise<UserDBReader>;
|
|
11
18
|
/**
|
|
12
19
|
* Get a course database interface
|
|
13
20
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { T as TagStub, a as Tag, S as SkuilderCourseData } from '../../types-legacy-
|
|
1
|
+
import { T as TagStub, a as Tag, S as SkuilderCourseData, Q as QualifiedCardID } from '../../types-legacy-6ettoclI.mjs';
|
|
2
2
|
import { Moment } from 'moment';
|
|
3
|
-
import { A as AdminDBInterface,
|
|
4
|
-
export {
|
|
3
|
+
import { A as AdminDBInterface, h as AssignedContent, i as StudyContentSource, j as StudentClassroomDBInterface, U as UserDBInterface, f as StudySessionReviewItem, g as ScheduledCard, S as StudySessionNewItem, T as TeacherClassroomDBInterface, b as CoursesDBInterface, C as CourseDBInterface, d as CourseInfo, D as DataLayerResult, e as ContentNavigationStrategyData, k as StudySessionItem } from '../../userDB-C4yyAnpp.mjs';
|
|
4
|
+
export { p as ContentSourceID, l as StudySessionFailedItem, m as StudySessionFailedNewItem, n as StudySessionFailedReviewItem, q as getStudySource, o as isReview } from '../../userDB-C4yyAnpp.mjs';
|
|
5
5
|
import * as _vue_skuilder_common from '@vue-skuilder/common';
|
|
6
6
|
import { ClassroomConfig, DataShape, CourseElo, CourseConfig as CourseConfig$1 } from '@vue-skuilder/common';
|
|
7
7
|
import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-CyATpyLQ.mjs';
|
|
@@ -10,6 +10,7 @@ type NamespacedDatashape = string;
|
|
|
10
10
|
interface DataShape55 {
|
|
11
11
|
name: NamespacedDatashape;
|
|
12
12
|
questionTypes: PouchDB.Core.DocumentId[];
|
|
13
|
+
serializedZodSchema?: string;
|
|
13
14
|
}
|
|
14
15
|
type NamespacedQuestion = string;
|
|
15
16
|
interface QuestionType55 {
|
|
@@ -170,7 +171,11 @@ declare class CourseDB implements StudyContentSource, CourseDBInterface {
|
|
|
170
171
|
getCardDisplayableDataIDs(id: string[]): Promise<{
|
|
171
172
|
[card: string]: string[];
|
|
172
173
|
}>;
|
|
173
|
-
getCardsByELO(elo: number, cardLimit?: number): Promise<
|
|
174
|
+
getCardsByELO(elo: number, cardLimit?: number): Promise<{
|
|
175
|
+
courseID: string;
|
|
176
|
+
cardID: any;
|
|
177
|
+
elo: any;
|
|
178
|
+
}[]>;
|
|
174
179
|
getCourseConfig(): Promise<CourseConfig$1>;
|
|
175
180
|
updateCourseConfig(cfg: CourseConfig$1): Promise<PouchDB.Core.Response>;
|
|
176
181
|
updateCardElo(cardId: string, elo: CourseElo): Promise<PouchDB.Core.Response>;
|
|
@@ -196,7 +201,9 @@ declare class CourseDB implements StudyContentSource, CourseDBInterface {
|
|
|
196
201
|
getCardsCenteredAtELO(options?: {
|
|
197
202
|
limit: number;
|
|
198
203
|
elo: 'user' | 'random' | number;
|
|
199
|
-
}, filter?: (a:
|
|
204
|
+
}, filter?: (a: QualifiedCardID) => boolean): Promise<StudySessionItem[]>;
|
|
205
|
+
searchCards(query: string): Promise<any[]>;
|
|
206
|
+
find(request: PouchDB.Find.FindRequest<any>): Promise<PouchDB.Find.FindResponse<any>>;
|
|
200
207
|
}
|
|
201
208
|
/**
|
|
202
209
|
* Returns a list of registered datashapes for the specified
|
|
@@ -255,7 +262,12 @@ declare class CouchDBSyncStrategy implements SyncStrategy {
|
|
|
255
262
|
|
|
256
263
|
declare const localUserDB: PouchDB.Database;
|
|
257
264
|
declare function hexEncode(str: string): string;
|
|
258
|
-
|
|
265
|
+
/**
|
|
266
|
+
* Creates PouchDB configuration with appropriate authentication method
|
|
267
|
+
* - Uses HTTP Basic Auth when credentials are available (Node.js/MCP)
|
|
268
|
+
* - Falls back to cookie auth for browser environments
|
|
269
|
+
*/
|
|
270
|
+
declare function createPouchDBConfig(): PouchDB.Configuration.RemoteDatabaseConfiguration;
|
|
259
271
|
declare function getCourseDB(courseID: string): PouchDB.Database;
|
|
260
272
|
declare function getLatestVersion(): Promise<string>;
|
|
261
273
|
/**
|
|
@@ -289,4 +301,4 @@ declare function getStartAndEndKeys(key: string): {
|
|
|
289
301
|
endkey: string;
|
|
290
302
|
};
|
|
291
303
|
|
|
292
|
-
export { AdminDB, CLASSROOM_CONFIG, ClassroomLookupDB, type ClassroomMessage, CouchDBSyncStrategy, CourseDB, CoursesDB, REVIEW_TIME_FORMAT, StudentClassroomDB, StudyContentSource, StudySessionItem, StudySessionNewItem, StudySessionReviewItem, TeacherClassroomDB, addNote55, addTagToCard, createTag, deleteTag, filterAllDocsByPrefix, getAncestorTagIDs, getAppliedTags, getChildTagStubs, getClassroomConfig, getClassroomDB, getCouchUserDB, getCourseDB, getCourseDataShapes, getCourseDoc, getCourseDocs, getCourseQuestionTypes, getCourseTagStubs, getCredentialledCourseConfig, getCredentialledDataShapes, getLatestVersion, getRandomCards, getStartAndEndKeys, getTag, getTagID, hexEncode, localUserDB,
|
|
304
|
+
export { AdminDB, CLASSROOM_CONFIG, ClassroomLookupDB, type ClassroomMessage, CouchDBSyncStrategy, CourseDB, CoursesDB, REVIEW_TIME_FORMAT, StudentClassroomDB, StudyContentSource, StudySessionItem, StudySessionNewItem, StudySessionReviewItem, TeacherClassroomDB, addNote55, addTagToCard, createPouchDBConfig, createTag, deleteTag, filterAllDocsByPrefix, getAncestorTagIDs, getAppliedTags, getChildTagStubs, getClassroomConfig, getClassroomDB, getCouchUserDB, getCourseDB, getCourseDataShapes, getCourseDoc, getCourseDocs, getCourseQuestionTypes, getCourseTagStubs, getCredentialledCourseConfig, getCredentialledDataShapes, getLatestVersion, getRandomCards, getStartAndEndKeys, getTag, getTagID, hexEncode, localUserDB, removeTagFromCard, scheduleCardReview, updateCardElo, updateCredentialledCourseConfig, updateGuestAccountExpirationDate, updateTag, usernameIsAvailable };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { T as TagStub, a as Tag, S as SkuilderCourseData } from '../../types-legacy-
|
|
1
|
+
import { T as TagStub, a as Tag, S as SkuilderCourseData, Q as QualifiedCardID } from '../../types-legacy-6ettoclI.js';
|
|
2
2
|
import { Moment } from 'moment';
|
|
3
|
-
import { A as AdminDBInterface,
|
|
4
|
-
export {
|
|
3
|
+
import { A as AdminDBInterface, h as AssignedContent, i as StudyContentSource, j as StudentClassroomDBInterface, U as UserDBInterface, f as StudySessionReviewItem, g as ScheduledCard, S as StudySessionNewItem, T as TeacherClassroomDBInterface, b as CoursesDBInterface, C as CourseDBInterface, d as CourseInfo, D as DataLayerResult, e as ContentNavigationStrategyData, k as StudySessionItem } from '../../userDB-CD6s6ZCp.js';
|
|
4
|
+
export { p as ContentSourceID, l as StudySessionFailedItem, m as StudySessionFailedNewItem, n as StudySessionFailedReviewItem, q as getStudySource, o as isReview } from '../../userDB-CD6s6ZCp.js';
|
|
5
5
|
import * as _vue_skuilder_common from '@vue-skuilder/common';
|
|
6
6
|
import { ClassroomConfig, DataShape, CourseElo, CourseConfig as CourseConfig$1 } from '@vue-skuilder/common';
|
|
7
7
|
import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-CyATpyLQ.js';
|
|
@@ -10,6 +10,7 @@ type NamespacedDatashape = string;
|
|
|
10
10
|
interface DataShape55 {
|
|
11
11
|
name: NamespacedDatashape;
|
|
12
12
|
questionTypes: PouchDB.Core.DocumentId[];
|
|
13
|
+
serializedZodSchema?: string;
|
|
13
14
|
}
|
|
14
15
|
type NamespacedQuestion = string;
|
|
15
16
|
interface QuestionType55 {
|
|
@@ -170,7 +171,11 @@ declare class CourseDB implements StudyContentSource, CourseDBInterface {
|
|
|
170
171
|
getCardDisplayableDataIDs(id: string[]): Promise<{
|
|
171
172
|
[card: string]: string[];
|
|
172
173
|
}>;
|
|
173
|
-
getCardsByELO(elo: number, cardLimit?: number): Promise<
|
|
174
|
+
getCardsByELO(elo: number, cardLimit?: number): Promise<{
|
|
175
|
+
courseID: string;
|
|
176
|
+
cardID: any;
|
|
177
|
+
elo: any;
|
|
178
|
+
}[]>;
|
|
174
179
|
getCourseConfig(): Promise<CourseConfig$1>;
|
|
175
180
|
updateCourseConfig(cfg: CourseConfig$1): Promise<PouchDB.Core.Response>;
|
|
176
181
|
updateCardElo(cardId: string, elo: CourseElo): Promise<PouchDB.Core.Response>;
|
|
@@ -196,7 +201,9 @@ declare class CourseDB implements StudyContentSource, CourseDBInterface {
|
|
|
196
201
|
getCardsCenteredAtELO(options?: {
|
|
197
202
|
limit: number;
|
|
198
203
|
elo: 'user' | 'random' | number;
|
|
199
|
-
}, filter?: (a:
|
|
204
|
+
}, filter?: (a: QualifiedCardID) => boolean): Promise<StudySessionItem[]>;
|
|
205
|
+
searchCards(query: string): Promise<any[]>;
|
|
206
|
+
find(request: PouchDB.Find.FindRequest<any>): Promise<PouchDB.Find.FindResponse<any>>;
|
|
200
207
|
}
|
|
201
208
|
/**
|
|
202
209
|
* Returns a list of registered datashapes for the specified
|
|
@@ -255,7 +262,12 @@ declare class CouchDBSyncStrategy implements SyncStrategy {
|
|
|
255
262
|
|
|
256
263
|
declare const localUserDB: PouchDB.Database;
|
|
257
264
|
declare function hexEncode(str: string): string;
|
|
258
|
-
|
|
265
|
+
/**
|
|
266
|
+
* Creates PouchDB configuration with appropriate authentication method
|
|
267
|
+
* - Uses HTTP Basic Auth when credentials are available (Node.js/MCP)
|
|
268
|
+
* - Falls back to cookie auth for browser environments
|
|
269
|
+
*/
|
|
270
|
+
declare function createPouchDBConfig(): PouchDB.Configuration.RemoteDatabaseConfiguration;
|
|
259
271
|
declare function getCourseDB(courseID: string): PouchDB.Database;
|
|
260
272
|
declare function getLatestVersion(): Promise<string>;
|
|
261
273
|
/**
|
|
@@ -289,4 +301,4 @@ declare function getStartAndEndKeys(key: string): {
|
|
|
289
301
|
endkey: string;
|
|
290
302
|
};
|
|
291
303
|
|
|
292
|
-
export { AdminDB, CLASSROOM_CONFIG, ClassroomLookupDB, type ClassroomMessage, CouchDBSyncStrategy, CourseDB, CoursesDB, REVIEW_TIME_FORMAT, StudentClassroomDB, StudyContentSource, StudySessionItem, StudySessionNewItem, StudySessionReviewItem, TeacherClassroomDB, addNote55, addTagToCard, createTag, deleteTag, filterAllDocsByPrefix, getAncestorTagIDs, getAppliedTags, getChildTagStubs, getClassroomConfig, getClassroomDB, getCouchUserDB, getCourseDB, getCourseDataShapes, getCourseDoc, getCourseDocs, getCourseQuestionTypes, getCourseTagStubs, getCredentialledCourseConfig, getCredentialledDataShapes, getLatestVersion, getRandomCards, getStartAndEndKeys, getTag, getTagID, hexEncode, localUserDB,
|
|
304
|
+
export { AdminDB, CLASSROOM_CONFIG, ClassroomLookupDB, type ClassroomMessage, CouchDBSyncStrategy, CourseDB, CoursesDB, REVIEW_TIME_FORMAT, StudentClassroomDB, StudyContentSource, StudySessionItem, StudySessionNewItem, StudySessionReviewItem, TeacherClassroomDB, addNote55, addTagToCard, createPouchDBConfig, createTag, deleteTag, filterAllDocsByPrefix, getAncestorTagIDs, getAppliedTags, getChildTagStubs, getClassroomConfig, getClassroomDB, getCouchUserDB, getCourseDB, getCourseDataShapes, getCourseDoc, getCourseDocs, getCourseQuestionTypes, getCourseTagStubs, getCredentialledCourseConfig, getCredentialledDataShapes, getLatestVersion, getRandomCards, getStartAndEndKeys, getTag, getTagID, hexEncode, localUserDB, removeTagFromCard, scheduleCardReview, updateCardElo, updateCredentialledCourseConfig, updateGuestAccountExpirationDate, updateTag, usernameIsAvailable };
|