@vue-skuilder/db 0.1.4 → 0.1.5
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/SyncStrategy-DnJRj-Xp.d.mts +74 -0
- package/dist/SyncStrategy-DnJRj-Xp.d.ts +74 -0
- package/dist/core/index.d.mts +90 -2
- package/dist/core/index.d.ts +90 -2
- package/dist/core/index.js +798 -650
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +769 -621
- package/dist/core/index.mjs.map +1 -1
- package/dist/dataLayerProvider-B8wquRiB.d.mts +37 -0
- package/dist/dataLayerProvider-DRjMZMaf.d.ts +37 -0
- package/dist/impl/couch/index.d.mts +292 -0
- package/dist/impl/couch/index.d.ts +292 -0
- package/dist/impl/couch/index.js +8522 -0
- package/dist/impl/couch/index.js.map +1 -0
- package/dist/impl/couch/index.mjs +8474 -0
- package/dist/impl/couch/index.mjs.map +1 -0
- package/dist/impl/static/index.d.mts +204 -0
- package/dist/impl/static/index.d.ts +204 -0
- package/dist/impl/static/index.js +8499 -0
- package/dist/impl/static/index.js.map +1 -0
- package/dist/impl/static/index.mjs +8488 -0
- package/dist/impl/static/index.mjs.map +1 -0
- package/dist/index.d.mts +13 -4
- package/dist/index.d.ts +13 -4
- package/dist/index.js +3280 -2108
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3290 -2118
- package/dist/index.mjs.map +1 -1
- package/dist/types-B0GJsjOr.d.ts +47 -0
- package/dist/types-DIgj8pP7.d.mts +47 -0
- package/dist/types-legacy-CTsJvvxI.d.mts +137 -0
- package/dist/types-legacy-CTsJvvxI.d.ts +137 -0
- package/dist/{index-QMtzQI65.d.mts → userDB-C5dcuRZs.d.ts} +3 -251
- package/dist/{index-QMtzQI65.d.ts → userDB-ZSwOXiYN.d.mts} +3 -251
- package/dist/util/packer/index.d.mts +25 -0
- package/dist/util/packer/index.d.ts +25 -0
- package/dist/util/packer/index.js +307 -0
- package/dist/util/packer/index.js.map +1 -0
- package/dist/util/packer/index.mjs +280 -0
- package/dist/util/packer/index.mjs.map +1 -0
- package/package.json +12 -2
- package/src/core/interfaces/contentSource.ts +8 -6
- package/src/core/interfaces/userDB.ts +2 -2
- package/src/factory.ts +10 -7
- package/src/impl/{pouch/userDB.ts → common/BaseUserDB.ts} +225 -260
- package/src/impl/common/SyncStrategy.ts +90 -0
- package/src/impl/common/index.ts +23 -0
- package/src/impl/common/types.ts +50 -0
- package/src/impl/common/userDBHelpers.ts +144 -0
- package/src/impl/couch/CouchDBSyncStrategy.ts +209 -0
- package/src/impl/{pouch → couch}/PouchDataLayerProvider.ts +12 -7
- package/src/impl/{pouch → couch}/adminDB.ts +3 -3
- package/src/impl/{pouch → couch}/auth.ts +2 -2
- package/src/impl/{pouch → couch}/classroomDB.ts +6 -6
- package/src/impl/{pouch → couch}/courseAPI.ts +28 -5
- package/src/impl/{pouch → couch}/courseDB.ts +24 -10
- package/src/impl/{pouch → couch}/courseLookupDB.ts +1 -1
- package/src/impl/{pouch → couch}/index.ts +27 -20
- package/src/impl/{pouch → couch}/updateQueue.ts +5 -1
- package/src/impl/{pouch → couch}/user-course-relDB.ts +6 -1
- package/src/impl/static/NoOpSyncStrategy.ts +70 -0
- package/src/impl/static/StaticDataLayerProvider.ts +89 -0
- package/src/impl/static/StaticDataUnpacker.ts +376 -0
- package/src/impl/static/courseDB.ts +257 -0
- package/src/impl/static/coursesDB.ts +37 -0
- package/src/impl/static/index.ts +8 -0
- package/src/impl/static/userDB.ts +179 -0
- package/src/index.ts +1 -1
- package/src/study/SessionController.ts +4 -4
- package/src/study/SpacedRepetition.ts +3 -3
- package/src/study/getCardDataShape.ts +2 -2
- package/src/util/index.ts +1 -0
- package/src/util/packer/CouchDBToStaticPacker.ts +349 -0
- package/src/util/packer/index.ts +4 -0
- package/src/util/packer/types.ts +52 -0
- package/tsconfig.json +7 -10
- package/tsup.config.ts +5 -3
- /package/src/impl/{pouch → couch}/clientCache.ts +0 -0
- /package/src/impl/{pouch → couch}/pouchdb-setup.ts +0 -0
- /package/src/impl/{pouch → couch}/types.ts +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CourseConfig } from '@vue-skuilder/common';
|
|
2
|
+
import { D as DocType } from './types-legacy-CTsJvvxI.js';
|
|
3
|
+
|
|
4
|
+
interface StaticCourseManifest {
|
|
5
|
+
version: string;
|
|
6
|
+
courseId: string;
|
|
7
|
+
courseName: string;
|
|
8
|
+
courseConfig: CourseConfig | null;
|
|
9
|
+
lastUpdated: string;
|
|
10
|
+
documentCount: number;
|
|
11
|
+
chunks: ChunkMetadata[];
|
|
12
|
+
indices: IndexMetadata[];
|
|
13
|
+
designDocs: DesignDocument[];
|
|
14
|
+
}
|
|
15
|
+
interface ChunkMetadata {
|
|
16
|
+
id: string;
|
|
17
|
+
docType: DocType;
|
|
18
|
+
startKey: string;
|
|
19
|
+
endKey: string;
|
|
20
|
+
documentCount: number;
|
|
21
|
+
path: string;
|
|
22
|
+
}
|
|
23
|
+
interface IndexMetadata {
|
|
24
|
+
name: string;
|
|
25
|
+
type: 'btree' | 'hash' | 'spatial';
|
|
26
|
+
path: string;
|
|
27
|
+
}
|
|
28
|
+
interface DesignDocument {
|
|
29
|
+
_id: string;
|
|
30
|
+
views: {
|
|
31
|
+
[viewName: string]: {
|
|
32
|
+
map: string;
|
|
33
|
+
reduce?: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
interface PackerConfig {
|
|
38
|
+
chunkSize: number;
|
|
39
|
+
includeAttachments: boolean;
|
|
40
|
+
}
|
|
41
|
+
interface PackedCourseData {
|
|
42
|
+
manifest: StaticCourseManifest;
|
|
43
|
+
chunks: Map<string, any[]>;
|
|
44
|
+
indices: Map<string, any>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type { ChunkMetadata as C, DesignDocument as D, IndexMetadata as I, PackerConfig as P, StaticCourseManifest as S, PackedCourseData as a };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CourseConfig } from '@vue-skuilder/common';
|
|
2
|
+
import { D as DocType } from './types-legacy-CTsJvvxI.mjs';
|
|
3
|
+
|
|
4
|
+
interface StaticCourseManifest {
|
|
5
|
+
version: string;
|
|
6
|
+
courseId: string;
|
|
7
|
+
courseName: string;
|
|
8
|
+
courseConfig: CourseConfig | null;
|
|
9
|
+
lastUpdated: string;
|
|
10
|
+
documentCount: number;
|
|
11
|
+
chunks: ChunkMetadata[];
|
|
12
|
+
indices: IndexMetadata[];
|
|
13
|
+
designDocs: DesignDocument[];
|
|
14
|
+
}
|
|
15
|
+
interface ChunkMetadata {
|
|
16
|
+
id: string;
|
|
17
|
+
docType: DocType;
|
|
18
|
+
startKey: string;
|
|
19
|
+
endKey: string;
|
|
20
|
+
documentCount: number;
|
|
21
|
+
path: string;
|
|
22
|
+
}
|
|
23
|
+
interface IndexMetadata {
|
|
24
|
+
name: string;
|
|
25
|
+
type: 'btree' | 'hash' | 'spatial';
|
|
26
|
+
path: string;
|
|
27
|
+
}
|
|
28
|
+
interface DesignDocument {
|
|
29
|
+
_id: string;
|
|
30
|
+
views: {
|
|
31
|
+
[viewName: string]: {
|
|
32
|
+
map: string;
|
|
33
|
+
reduce?: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
interface PackerConfig {
|
|
38
|
+
chunkSize: number;
|
|
39
|
+
includeAttachments: boolean;
|
|
40
|
+
}
|
|
41
|
+
interface PackedCourseData {
|
|
42
|
+
manifest: StaticCourseManifest;
|
|
43
|
+
chunks: Map<string, any[]>;
|
|
44
|
+
indices: Map<string, any>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type { ChunkMetadata as C, DesignDocument as D, IndexMetadata as I, PackerConfig as P, StaticCourseManifest as S, PackedCourseData as a };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { CourseElo, Evaluation, Answer } from '@vue-skuilder/common';
|
|
2
|
+
import { Moment } from 'moment';
|
|
3
|
+
|
|
4
|
+
declare const GuestUsername: string;
|
|
5
|
+
declare const log: (message: string) => void;
|
|
6
|
+
declare enum DocType {
|
|
7
|
+
DISPLAYABLE_DATA = "DISPLAYABLE_DATA",
|
|
8
|
+
CARD = "CARD",
|
|
9
|
+
DATASHAPE = "DATASHAPE",
|
|
10
|
+
QUESTIONTYPE = "QUESTION",
|
|
11
|
+
VIEW = "VIEW",
|
|
12
|
+
PEDAGOGY = "PEDAGOGY",
|
|
13
|
+
CARDRECORD = "CARDRECORD",
|
|
14
|
+
SCHEDULED_CARD = "SCHEDULED_CARD",
|
|
15
|
+
TAG = "TAG",
|
|
16
|
+
NAVIGATION_STRATEGY = "NAVIGATION_STRATEGY"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Interface for all data on course content and pedagogy stored
|
|
20
|
+
* in the c/pouch database.
|
|
21
|
+
*/
|
|
22
|
+
interface SkuilderCourseData {
|
|
23
|
+
course: string;
|
|
24
|
+
docType: DocType;
|
|
25
|
+
}
|
|
26
|
+
interface Tag extends SkuilderCourseData {
|
|
27
|
+
docType: DocType.TAG;
|
|
28
|
+
name: string;
|
|
29
|
+
snippet: string;
|
|
30
|
+
wiki: string;
|
|
31
|
+
taggedCards: PouchDB.Core.DocumentId[];
|
|
32
|
+
}
|
|
33
|
+
interface TagStub {
|
|
34
|
+
name: string;
|
|
35
|
+
snippet: string;
|
|
36
|
+
count: number;
|
|
37
|
+
}
|
|
38
|
+
interface CardData extends SkuilderCourseData {
|
|
39
|
+
docType: DocType.CARD;
|
|
40
|
+
id_displayable_data: PouchDB.Core.DocumentId[];
|
|
41
|
+
id_view: PouchDB.Core.DocumentId;
|
|
42
|
+
elo: CourseElo;
|
|
43
|
+
}
|
|
44
|
+
/** A list of populated courses in the DB */
|
|
45
|
+
interface CourseListData extends PouchDB.Core.Response {
|
|
46
|
+
courses: string[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The data used to hydrate viewable components (questions, info, etc)
|
|
50
|
+
*/
|
|
51
|
+
interface DisplayableData extends SkuilderCourseData {
|
|
52
|
+
docType: DocType.DISPLAYABLE_DATA;
|
|
53
|
+
author?: string;
|
|
54
|
+
id_datashape: PouchDB.Core.DocumentId;
|
|
55
|
+
data: Field[];
|
|
56
|
+
_attachments?: {
|
|
57
|
+
[index: string]: PouchDB.Core.FullAttachment;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
interface Field {
|
|
61
|
+
data: unknown;
|
|
62
|
+
name: string;
|
|
63
|
+
}
|
|
64
|
+
interface DataShapeData extends SkuilderCourseData {
|
|
65
|
+
docType: DocType.DATASHAPE;
|
|
66
|
+
_id: PouchDB.Core.DocumentId;
|
|
67
|
+
questionTypes: PouchDB.Core.DocumentId[];
|
|
68
|
+
}
|
|
69
|
+
interface QuestionData extends SkuilderCourseData {
|
|
70
|
+
docType: DocType.QUESTIONTYPE;
|
|
71
|
+
_id: PouchDB.Core.DocumentId;
|
|
72
|
+
viewList: string[];
|
|
73
|
+
dataShapeList: PouchDB.Core.DocumentId[];
|
|
74
|
+
}
|
|
75
|
+
declare const cardHistoryPrefix = "cardH";
|
|
76
|
+
interface CardHistory<T extends CardRecord> {
|
|
77
|
+
_id: PouchDB.Core.DocumentId;
|
|
78
|
+
/**
|
|
79
|
+
* The CouchDB id of the card
|
|
80
|
+
*/
|
|
81
|
+
cardID: PouchDB.Core.DocumentId;
|
|
82
|
+
/**
|
|
83
|
+
* The ID of the course
|
|
84
|
+
*/
|
|
85
|
+
courseID: string;
|
|
86
|
+
/**
|
|
87
|
+
* The to-date largest interval between successful
|
|
88
|
+
* card reviews. `0` indicates no successful reviews.
|
|
89
|
+
*/
|
|
90
|
+
bestInterval: number;
|
|
91
|
+
/**
|
|
92
|
+
* The number of times that a card has been
|
|
93
|
+
* failed in review
|
|
94
|
+
*/
|
|
95
|
+
lapses: number;
|
|
96
|
+
/**
|
|
97
|
+
* The number of consecutive successful impressions
|
|
98
|
+
* on this card
|
|
99
|
+
*/
|
|
100
|
+
streak: number;
|
|
101
|
+
records: T[];
|
|
102
|
+
}
|
|
103
|
+
interface CardRecord {
|
|
104
|
+
/**
|
|
105
|
+
* The CouchDB id of the card
|
|
106
|
+
*/
|
|
107
|
+
cardID: string;
|
|
108
|
+
/**
|
|
109
|
+
* The ID of the course
|
|
110
|
+
*/
|
|
111
|
+
courseID: string;
|
|
112
|
+
/**
|
|
113
|
+
* Number of milliseconds that the user spent before dismissing
|
|
114
|
+
* the card (ie, "I've read this" or "here is my answer")
|
|
115
|
+
*
|
|
116
|
+
* //TODO: this (sometimes?) wants to be replaced with a rich
|
|
117
|
+
* recording of user activity in working the question
|
|
118
|
+
*/
|
|
119
|
+
timeSpent: number;
|
|
120
|
+
/**
|
|
121
|
+
* The date-time that the card was rendered. timeStamp + timeSpent will give the
|
|
122
|
+
* time of user submission.
|
|
123
|
+
*/
|
|
124
|
+
timeStamp: Moment;
|
|
125
|
+
}
|
|
126
|
+
interface QuestionRecord extends CardRecord, Evaluation {
|
|
127
|
+
userAnswer: Answer;
|
|
128
|
+
/**
|
|
129
|
+
* The number of incorrect user submissions prededing this submisstion.
|
|
130
|
+
*
|
|
131
|
+
* eg, if a user is asked 7*6=__, submitting 46, 48, 42 will result in three
|
|
132
|
+
* records being created having 0, 1, and 2 as their recorded 'priorAttempts' values
|
|
133
|
+
*/
|
|
134
|
+
priorAttemps: number;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export { type CardRecord as C, DocType as D, type Field as F, GuestUsername as G, type QuestionData as Q, type SkuilderCourseData as S, type Tag as T, type TagStub as a, type CardData as b, type CourseListData as c, type DisplayableData as d, type DataShapeData as e, cardHistoryPrefix as f, type CardHistory as g, type QuestionRecord as h, log as l };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { CourseElo, Evaluation, Answer } from '@vue-skuilder/common';
|
|
2
|
+
import { Moment } from 'moment';
|
|
3
|
+
|
|
4
|
+
declare const GuestUsername: string;
|
|
5
|
+
declare const log: (message: string) => void;
|
|
6
|
+
declare enum DocType {
|
|
7
|
+
DISPLAYABLE_DATA = "DISPLAYABLE_DATA",
|
|
8
|
+
CARD = "CARD",
|
|
9
|
+
DATASHAPE = "DATASHAPE",
|
|
10
|
+
QUESTIONTYPE = "QUESTION",
|
|
11
|
+
VIEW = "VIEW",
|
|
12
|
+
PEDAGOGY = "PEDAGOGY",
|
|
13
|
+
CARDRECORD = "CARDRECORD",
|
|
14
|
+
SCHEDULED_CARD = "SCHEDULED_CARD",
|
|
15
|
+
TAG = "TAG",
|
|
16
|
+
NAVIGATION_STRATEGY = "NAVIGATION_STRATEGY"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Interface for all data on course content and pedagogy stored
|
|
20
|
+
* in the c/pouch database.
|
|
21
|
+
*/
|
|
22
|
+
interface SkuilderCourseData {
|
|
23
|
+
course: string;
|
|
24
|
+
docType: DocType;
|
|
25
|
+
}
|
|
26
|
+
interface Tag extends SkuilderCourseData {
|
|
27
|
+
docType: DocType.TAG;
|
|
28
|
+
name: string;
|
|
29
|
+
snippet: string;
|
|
30
|
+
wiki: string;
|
|
31
|
+
taggedCards: PouchDB.Core.DocumentId[];
|
|
32
|
+
}
|
|
33
|
+
interface TagStub {
|
|
34
|
+
name: string;
|
|
35
|
+
snippet: string;
|
|
36
|
+
count: number;
|
|
37
|
+
}
|
|
38
|
+
interface CardData extends SkuilderCourseData {
|
|
39
|
+
docType: DocType.CARD;
|
|
40
|
+
id_displayable_data: PouchDB.Core.DocumentId[];
|
|
41
|
+
id_view: PouchDB.Core.DocumentId;
|
|
42
|
+
elo: CourseElo;
|
|
43
|
+
}
|
|
44
|
+
/** A list of populated courses in the DB */
|
|
45
|
+
interface CourseListData extends PouchDB.Core.Response {
|
|
46
|
+
courses: string[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The data used to hydrate viewable components (questions, info, etc)
|
|
50
|
+
*/
|
|
51
|
+
interface DisplayableData extends SkuilderCourseData {
|
|
52
|
+
docType: DocType.DISPLAYABLE_DATA;
|
|
53
|
+
author?: string;
|
|
54
|
+
id_datashape: PouchDB.Core.DocumentId;
|
|
55
|
+
data: Field[];
|
|
56
|
+
_attachments?: {
|
|
57
|
+
[index: string]: PouchDB.Core.FullAttachment;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
interface Field {
|
|
61
|
+
data: unknown;
|
|
62
|
+
name: string;
|
|
63
|
+
}
|
|
64
|
+
interface DataShapeData extends SkuilderCourseData {
|
|
65
|
+
docType: DocType.DATASHAPE;
|
|
66
|
+
_id: PouchDB.Core.DocumentId;
|
|
67
|
+
questionTypes: PouchDB.Core.DocumentId[];
|
|
68
|
+
}
|
|
69
|
+
interface QuestionData extends SkuilderCourseData {
|
|
70
|
+
docType: DocType.QUESTIONTYPE;
|
|
71
|
+
_id: PouchDB.Core.DocumentId;
|
|
72
|
+
viewList: string[];
|
|
73
|
+
dataShapeList: PouchDB.Core.DocumentId[];
|
|
74
|
+
}
|
|
75
|
+
declare const cardHistoryPrefix = "cardH";
|
|
76
|
+
interface CardHistory<T extends CardRecord> {
|
|
77
|
+
_id: PouchDB.Core.DocumentId;
|
|
78
|
+
/**
|
|
79
|
+
* The CouchDB id of the card
|
|
80
|
+
*/
|
|
81
|
+
cardID: PouchDB.Core.DocumentId;
|
|
82
|
+
/**
|
|
83
|
+
* The ID of the course
|
|
84
|
+
*/
|
|
85
|
+
courseID: string;
|
|
86
|
+
/**
|
|
87
|
+
* The to-date largest interval between successful
|
|
88
|
+
* card reviews. `0` indicates no successful reviews.
|
|
89
|
+
*/
|
|
90
|
+
bestInterval: number;
|
|
91
|
+
/**
|
|
92
|
+
* The number of times that a card has been
|
|
93
|
+
* failed in review
|
|
94
|
+
*/
|
|
95
|
+
lapses: number;
|
|
96
|
+
/**
|
|
97
|
+
* The number of consecutive successful impressions
|
|
98
|
+
* on this card
|
|
99
|
+
*/
|
|
100
|
+
streak: number;
|
|
101
|
+
records: T[];
|
|
102
|
+
}
|
|
103
|
+
interface CardRecord {
|
|
104
|
+
/**
|
|
105
|
+
* The CouchDB id of the card
|
|
106
|
+
*/
|
|
107
|
+
cardID: string;
|
|
108
|
+
/**
|
|
109
|
+
* The ID of the course
|
|
110
|
+
*/
|
|
111
|
+
courseID: string;
|
|
112
|
+
/**
|
|
113
|
+
* Number of milliseconds that the user spent before dismissing
|
|
114
|
+
* the card (ie, "I've read this" or "here is my answer")
|
|
115
|
+
*
|
|
116
|
+
* //TODO: this (sometimes?) wants to be replaced with a rich
|
|
117
|
+
* recording of user activity in working the question
|
|
118
|
+
*/
|
|
119
|
+
timeSpent: number;
|
|
120
|
+
/**
|
|
121
|
+
* The date-time that the card was rendered. timeStamp + timeSpent will give the
|
|
122
|
+
* time of user submission.
|
|
123
|
+
*/
|
|
124
|
+
timeStamp: Moment;
|
|
125
|
+
}
|
|
126
|
+
interface QuestionRecord extends CardRecord, Evaluation {
|
|
127
|
+
userAnswer: Answer;
|
|
128
|
+
/**
|
|
129
|
+
* The number of incorrect user submissions prededing this submisstion.
|
|
130
|
+
*
|
|
131
|
+
* eg, if a user is asked 7*6=__, submitting 46, 48, 42 will result in three
|
|
132
|
+
* records being created having 0, 1, and 2 as their recorded 'priorAttempts' values
|
|
133
|
+
*/
|
|
134
|
+
priorAttemps: number;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export { type CardRecord as C, DocType as D, type Field as F, GuestUsername as G, type QuestionData as Q, type SkuilderCourseData as S, type Tag as T, type TagStub as a, type CardData as b, type CourseListData as c, type DisplayableData as d, type DataShapeData as e, cardHistoryPrefix as f, type CardHistory as g, type QuestionRecord as h, log as l };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { CourseConfig, ClassroomConfig, CourseElo,
|
|
1
|
+
import { CourseConfig, ClassroomConfig, CourseElo, Status, SkuilderCourseData as SkuilderCourseData$1, DataShape } from '@vue-skuilder/common';
|
|
2
2
|
import { Moment } from 'moment';
|
|
3
|
+
import { S as SkuilderCourseData, D as DocType, a as TagStub, T as Tag, g as CardHistory, C as CardRecord } from './types-legacy-CTsJvvxI.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Admin functionality
|
|
@@ -181,139 +182,6 @@ interface ContentBase {
|
|
|
181
182
|
courseID: string;
|
|
182
183
|
}
|
|
183
184
|
|
|
184
|
-
declare const GuestUsername: string;
|
|
185
|
-
declare const log: (message: string) => void;
|
|
186
|
-
declare enum DocType {
|
|
187
|
-
DISPLAYABLE_DATA = "DISPLAYABLE_DATA",
|
|
188
|
-
CARD = "CARD",
|
|
189
|
-
DATASHAPE = "DATASHAPE",
|
|
190
|
-
QUESTIONTYPE = "QUESTION",
|
|
191
|
-
VIEW = "VIEW",
|
|
192
|
-
PEDAGOGY = "PEDAGOGY",
|
|
193
|
-
CARDRECORD = "CARDRECORD",
|
|
194
|
-
SCHEDULED_CARD = "SCHEDULED_CARD",
|
|
195
|
-
TAG = "TAG",
|
|
196
|
-
NAVIGATION_STRATEGY = "NAVIGATION_STRATEGY"
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Interface for all data on course content and pedagogy stored
|
|
200
|
-
* in the c/pouch database.
|
|
201
|
-
*/
|
|
202
|
-
interface SkuilderCourseData {
|
|
203
|
-
course: string;
|
|
204
|
-
docType: DocType;
|
|
205
|
-
}
|
|
206
|
-
interface Tag extends SkuilderCourseData {
|
|
207
|
-
docType: DocType.TAG;
|
|
208
|
-
name: string;
|
|
209
|
-
snippet: string;
|
|
210
|
-
wiki: string;
|
|
211
|
-
taggedCards: PouchDB.Core.DocumentId[];
|
|
212
|
-
}
|
|
213
|
-
interface TagStub {
|
|
214
|
-
name: string;
|
|
215
|
-
snippet: string;
|
|
216
|
-
count: number;
|
|
217
|
-
}
|
|
218
|
-
interface CardData extends SkuilderCourseData {
|
|
219
|
-
docType: DocType.CARD;
|
|
220
|
-
id_displayable_data: PouchDB.Core.DocumentId[];
|
|
221
|
-
id_view: PouchDB.Core.DocumentId;
|
|
222
|
-
elo: CourseElo;
|
|
223
|
-
}
|
|
224
|
-
/** A list of populated courses in the DB */
|
|
225
|
-
interface CourseListData extends PouchDB.Core.Response {
|
|
226
|
-
courses: string[];
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* The data used to hydrate viewable components (questions, info, etc)
|
|
230
|
-
*/
|
|
231
|
-
interface DisplayableData extends SkuilderCourseData {
|
|
232
|
-
docType: DocType.DISPLAYABLE_DATA;
|
|
233
|
-
author?: string;
|
|
234
|
-
id_datashape: PouchDB.Core.DocumentId;
|
|
235
|
-
data: Field[];
|
|
236
|
-
_attachments?: {
|
|
237
|
-
[index: string]: PouchDB.Core.FullAttachment;
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
interface Field {
|
|
241
|
-
data: unknown;
|
|
242
|
-
name: string;
|
|
243
|
-
}
|
|
244
|
-
interface DataShapeData extends SkuilderCourseData {
|
|
245
|
-
docType: DocType.DATASHAPE;
|
|
246
|
-
_id: PouchDB.Core.DocumentId;
|
|
247
|
-
questionTypes: PouchDB.Core.DocumentId[];
|
|
248
|
-
}
|
|
249
|
-
interface QuestionData extends SkuilderCourseData {
|
|
250
|
-
docType: DocType.QUESTIONTYPE;
|
|
251
|
-
_id: PouchDB.Core.DocumentId;
|
|
252
|
-
viewList: string[];
|
|
253
|
-
dataShapeList: PouchDB.Core.DocumentId[];
|
|
254
|
-
}
|
|
255
|
-
declare const cardHistoryPrefix = "cardH";
|
|
256
|
-
interface CardHistory<T extends CardRecord> {
|
|
257
|
-
_id: PouchDB.Core.DocumentId;
|
|
258
|
-
/**
|
|
259
|
-
* The CouchDB id of the card
|
|
260
|
-
*/
|
|
261
|
-
cardID: PouchDB.Core.DocumentId;
|
|
262
|
-
/**
|
|
263
|
-
* The ID of the course
|
|
264
|
-
*/
|
|
265
|
-
courseID: string;
|
|
266
|
-
/**
|
|
267
|
-
* The to-date largest interval between successful
|
|
268
|
-
* card reviews. `0` indicates no successful reviews.
|
|
269
|
-
*/
|
|
270
|
-
bestInterval: number;
|
|
271
|
-
/**
|
|
272
|
-
* The number of times that a card has been
|
|
273
|
-
* failed in review
|
|
274
|
-
*/
|
|
275
|
-
lapses: number;
|
|
276
|
-
/**
|
|
277
|
-
* The number of consecutive successful impressions
|
|
278
|
-
* on this card
|
|
279
|
-
*/
|
|
280
|
-
streak: number;
|
|
281
|
-
records: T[];
|
|
282
|
-
}
|
|
283
|
-
interface CardRecord {
|
|
284
|
-
/**
|
|
285
|
-
* The CouchDB id of the card
|
|
286
|
-
*/
|
|
287
|
-
cardID: string;
|
|
288
|
-
/**
|
|
289
|
-
* The ID of the course
|
|
290
|
-
*/
|
|
291
|
-
courseID: string;
|
|
292
|
-
/**
|
|
293
|
-
* Number of milliseconds that the user spent before dismissing
|
|
294
|
-
* the card (ie, "I've read this" or "here is my answer")
|
|
295
|
-
*
|
|
296
|
-
* //TODO: this (sometimes?) wants to be replaced with a rich
|
|
297
|
-
* recording of user activity in working the question
|
|
298
|
-
*/
|
|
299
|
-
timeSpent: number;
|
|
300
|
-
/**
|
|
301
|
-
* The date-time that the card was rendered. timeStamp + timeSpent will give the
|
|
302
|
-
* time of user submission.
|
|
303
|
-
*/
|
|
304
|
-
timeStamp: Moment;
|
|
305
|
-
}
|
|
306
|
-
interface QuestionRecord extends CardRecord, Evaluation {
|
|
307
|
-
userAnswer: Answer;
|
|
308
|
-
/**
|
|
309
|
-
* The number of incorrect user submissions prededing this submisstion.
|
|
310
|
-
*
|
|
311
|
-
* eg, if a user is asked 7*6=__, submitting 46, 48, 42 will result in three
|
|
312
|
-
* records being created having 0, 1, and 2 as their recorded 'priorAttempts' values
|
|
313
|
-
*/
|
|
314
|
-
priorAttemps: number;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
185
|
interface DataLayerResult {
|
|
318
186
|
status: Status;
|
|
319
187
|
message: string;
|
|
@@ -471,12 +339,6 @@ interface CourseDBInterface extends NavigationStrategyManager {
|
|
|
471
339
|
}[]>;
|
|
472
340
|
}
|
|
473
341
|
|
|
474
|
-
declare abstract class Loggable {
|
|
475
|
-
protected abstract readonly _className: string;
|
|
476
|
-
protected log(...args: unknown[]): void;
|
|
477
|
-
protected error(...args: unknown[]): void;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
342
|
type Update<T> = Partial<T> | ((x: T) => T);
|
|
481
343
|
|
|
482
344
|
interface DocumentUpdater {
|
|
@@ -621,114 +483,4 @@ interface ClassroomRegistrationDoc {
|
|
|
621
483
|
registrations: ClassroomRegistration[];
|
|
622
484
|
}
|
|
623
485
|
|
|
624
|
-
|
|
625
|
-
* Main factory interface for data access
|
|
626
|
-
*/
|
|
627
|
-
interface DataLayerProvider {
|
|
628
|
-
/**
|
|
629
|
-
* Get the user database interface
|
|
630
|
-
*/
|
|
631
|
-
getUserDB(): UserDBInterface;
|
|
632
|
-
/**
|
|
633
|
-
* Get a course database interface
|
|
634
|
-
*/
|
|
635
|
-
getCourseDB(courseId: string): CourseDBInterface;
|
|
636
|
-
/**
|
|
637
|
-
* Get the courses-lookup interface
|
|
638
|
-
*/
|
|
639
|
-
getCoursesDB(): CoursesDBInterface;
|
|
640
|
-
/**
|
|
641
|
-
* Get a classroom database interface
|
|
642
|
-
*/
|
|
643
|
-
getClassroomDB(classId: string, type: 'student' | 'teacher'): Promise<ClassroomDBInterface>;
|
|
644
|
-
/**
|
|
645
|
-
* Get the admin database interface
|
|
646
|
-
*/
|
|
647
|
-
getAdminDB(): AdminDBInterface;
|
|
648
|
-
/**
|
|
649
|
-
* Initialize the data layer
|
|
650
|
-
*/
|
|
651
|
-
initialize(): Promise<void>;
|
|
652
|
-
/**
|
|
653
|
-
* Teardown the data layer
|
|
654
|
-
*/
|
|
655
|
-
teardown(): Promise<void>;
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
declare function areQuestionRecords(h: CardHistory<CardRecord>): h is CardHistory<QuestionRecord>;
|
|
659
|
-
declare function isQuestionRecord(c: CardRecord): c is QuestionRecord;
|
|
660
|
-
declare function getCardHistoryID(courseID: string, cardID: string): PouchDB.Core.DocumentId;
|
|
661
|
-
declare function parseCardHistoryID(id: string): {
|
|
662
|
-
courseID: string;
|
|
663
|
-
cardID: string;
|
|
664
|
-
};
|
|
665
|
-
interface PouchDBError extends Error {
|
|
666
|
-
error?: string;
|
|
667
|
-
reason?: string;
|
|
668
|
-
}
|
|
669
|
-
declare function docIsDeleted(e: PouchDBError): boolean;
|
|
670
|
-
|
|
671
|
-
declare enum Navigators {
|
|
672
|
-
ELO = "elo"
|
|
673
|
-
}
|
|
674
|
-
/**
|
|
675
|
-
* A content-navigator provides runtime steering of study sessions.
|
|
676
|
-
*/
|
|
677
|
-
declare abstract class ContentNavigator implements StudyContentSource {
|
|
678
|
-
/**
|
|
679
|
-
*
|
|
680
|
-
* @param user
|
|
681
|
-
* @param strategyData
|
|
682
|
-
* @returns the runtime object used to steer a study session.
|
|
683
|
-
*/
|
|
684
|
-
static create(user: UserDBInterface, course: CourseDBInterface, strategyData: ContentNavigationStrategyData): Promise<ContentNavigator>;
|
|
685
|
-
abstract getPendingReviews(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
|
|
686
|
-
abstract getNewCards(n?: number): Promise<StudySessionNewItem[]>;
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
/**
|
|
690
|
-
* Interface representing the result of a bulk import operation for a single card
|
|
691
|
-
*/
|
|
692
|
-
interface ImportResult {
|
|
693
|
-
/** The original text input for the card */
|
|
694
|
-
originalText: string;
|
|
695
|
-
/** Status of the import operation */
|
|
696
|
-
status: 'success' | 'error';
|
|
697
|
-
/** Message describing the result or error */
|
|
698
|
-
message: string;
|
|
699
|
-
/** ID of the newly created card (only for success) */
|
|
700
|
-
cardId?: string;
|
|
701
|
-
}
|
|
702
|
-
/**
|
|
703
|
-
* Configuration for the bulk card processor
|
|
704
|
-
*/
|
|
705
|
-
interface BulkCardProcessorConfig {
|
|
706
|
-
/** The data shape to use for the cards */
|
|
707
|
-
dataShape: DataShape;
|
|
708
|
-
/** The course code used for adding notes */
|
|
709
|
-
courseCode: string;
|
|
710
|
-
/** The username of the current user */
|
|
711
|
-
userName: string;
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
/**
|
|
715
|
-
* Processes multiple cards from bulk text input
|
|
716
|
-
*
|
|
717
|
-
* @param parsedCards - Array of parsed cards to import
|
|
718
|
-
* @param courseDB - Course database interface
|
|
719
|
-
* @param config - Configuration for the card processor
|
|
720
|
-
* @returns Array of import results
|
|
721
|
-
*/
|
|
722
|
-
declare function importParsedCards(parsedCards: ParsedCard[], courseDB: CourseDBInterface, config: BulkCardProcessorConfig): Promise<ImportResult[]>;
|
|
723
|
-
/**
|
|
724
|
-
* Validates the configuration for bulk card processing
|
|
725
|
-
*
|
|
726
|
-
* @param config - Configuration to validate
|
|
727
|
-
* @returns Object with validation result and error message if any
|
|
728
|
-
*/
|
|
729
|
-
declare function validateProcessorConfig(config: Partial<BulkCardProcessorConfig>): {
|
|
730
|
-
isValid: boolean;
|
|
731
|
-
errorMessage?: string;
|
|
732
|
-
};
|
|
733
|
-
|
|
734
|
-
export { getCardHistoryID as $, type AdminDBInterface as A, type SkuilderCourseData as B, type CardRecord as C, type DataLayerProvider as D, type Tag as E, type TagStub as F, GuestUsername as G, type CardData as H, type CourseListData as I, type DisplayableData as J, type Field as K, Loggable as L, type DataShapeData as M, cardHistoryPrefix as N, type CardHistory as O, type QuestionRecord as P, type QuestionData as Q, type UserConfig as R, type StudySessionItem as S, type TeacherClassroomDBInterface as T, type UserDBInterface as U, type ActivityRecord as V, type CourseRegistration as W, type CourseRegistrationDoc as X, type ScheduledCard as Y, areQuestionRecords as Z, isQuestionRecord as _, type StudyContentSource as a, parseCardHistoryID as a0, docIsDeleted as a1, Navigators as a2, ContentNavigator as a3, importParsedCards as a4, validateProcessorConfig as a5, type ImportResult as a6, type BulkCardProcessorConfig as a7, type DocumentUpdater as a8, newInterval as a9, type ClassroomDBInterface as b, type StudentClassroomDBInterface as c, type AssignedContent as d, type AssignedTag as e, type AssignedCourse as f, type AssignedCard as g, type StudySessionFailedItem as h, type StudySessionFailedNewItem as i, type StudySessionFailedReviewItem as j, type StudySessionNewItem as k, type StudySessionReviewItem as l, isReview as m, type ContentSourceID as n, getStudySource as o, type CoursesDBInterface as p, type CourseInfo as q, type CourseDBInterface as r, type UserCourseSettings as s, type UserCourseSetting as t, type UsrCrsDataInterface as u, type ClassroomRegistrationDesignation as v, type ClassroomRegistration as w, type ClassroomRegistrationDoc as x, log as y, DocType as z };
|
|
486
|
+
export { type AdminDBInterface as A, type CourseRegistrationDoc as B, type CourseDBInterface as C, type ScheduledCard as D, type DocumentUpdater as E, newInterval as F, type DataLayerResult as G, type ContentNavigationStrategyData as H, type StudySessionItem as S, type TeacherClassroomDBInterface as T, type UserDBInterface as U, type CoursesDBInterface as a, type ClassroomDBInterface as b, type StudyContentSource as c, type StudentClassroomDBInterface as d, type AssignedContent as e, type AssignedTag as f, type AssignedCourse as g, type AssignedCard as h, type StudySessionFailedItem as i, type StudySessionFailedNewItem as j, type StudySessionFailedReviewItem as k, type StudySessionNewItem as l, type StudySessionReviewItem as m, isReview as n, type ContentSourceID as o, getStudySource as p, type CourseInfo as q, type UserCourseSettings as r, type UserCourseSetting as s, type UsrCrsDataInterface as t, type ClassroomRegistrationDesignation as u, type ClassroomRegistration as v, type ClassroomRegistrationDoc as w, type UserConfig as x, type ActivityRecord as y, type CourseRegistration as z };
|