@memizy/oqse 0.1.0
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/LICENSE +21 -0
- package/README.md +58 -0
- package/SPECIFICATION.md +2444 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +845 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/manifest.d.ts +429 -0
- package/dist/src/manifestValidation.d.ts +167 -0
- package/dist/src/manifestValidation.test.d.ts +1 -0
- package/dist/src/oqse.d.ts +1121 -0
- package/dist/src/oqseValidation.d.ts +6120 -0
- package/dist/src/oqseValidation.test.d.ts +1 -0
- package/dist/src/progress.d.ts +42 -0
- package/dist/src/progressValidation.d.ts +9 -0
- package/dist/src/progressValidation.test.d.ts +1 -0
- package/dist/src/utils.d.ts +3 -0
- package/package.json +40 -0
- package/schemas/README.md +1 -0
- package/schemas/oqse-manifest-v0.1.json +256 -0
- package/schemas/oqse-v0.1.json +7573 -0
- package/schemas/oqsep-v0.1.json +172 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OQSEP v0.1 Type Definitions
|
|
3
|
+
* (Open Quiz & Study Exchange - Progress)
|
|
4
|
+
*
|
|
5
|
+
* @see /SPECIFICATION.md#25-user-progress-portability-oqsep
|
|
6
|
+
*/
|
|
7
|
+
/** Aggregate performance statistics for a single item. */
|
|
8
|
+
export interface StatsObject {
|
|
9
|
+
attempts: number;
|
|
10
|
+
incorrect: number;
|
|
11
|
+
streak: number;
|
|
12
|
+
}
|
|
13
|
+
/** Last answer details for a single item interaction. */
|
|
14
|
+
export interface LastAnswerObject {
|
|
15
|
+
isCorrect: boolean;
|
|
16
|
+
confidence?: 1 | 2 | 3 | 4;
|
|
17
|
+
answeredAt: string;
|
|
18
|
+
timeSpent?: number;
|
|
19
|
+
hintsUsed?: number;
|
|
20
|
+
isSkipped?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** Progress state for one item from the linked OQSE set. */
|
|
23
|
+
export interface ProgressRecord {
|
|
24
|
+
bucket: 0 | 1 | 2 | 3 | 4;
|
|
25
|
+
nextReviewAt?: string;
|
|
26
|
+
stats: StatsObject;
|
|
27
|
+
lastAnswer?: LastAnswerObject;
|
|
28
|
+
appSpecific?: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
/** OQSEP metadata describing origin and export context. */
|
|
31
|
+
export interface ProgressMeta {
|
|
32
|
+
setId: string;
|
|
33
|
+
exportedAt: string;
|
|
34
|
+
algorithm?: string;
|
|
35
|
+
}
|
|
36
|
+
/** Root OQSEP payload for one user and one study set. */
|
|
37
|
+
export interface OQSEPFile {
|
|
38
|
+
$schema?: string;
|
|
39
|
+
version: string;
|
|
40
|
+
meta: ProgressMeta;
|
|
41
|
+
records: Record<string, ProgressRecord>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { LastAnswerObject, OQSEPFile, ProgressMeta, ProgressRecord, StatsObject } from './progress';
|
|
3
|
+
export declare const StatsObjectSchema: z.ZodType<StatsObject>;
|
|
4
|
+
export declare const LastAnswerObjectSchema: z.ZodType<LastAnswerObject>;
|
|
5
|
+
export declare const ProgressRecordSchema: z.ZodType<ProgressRecord>;
|
|
6
|
+
export declare const ProgressMetaSchema: z.ZodType<ProgressMeta>;
|
|
7
|
+
export declare const OQSEPFileSchema: z.ZodType<OQSEPFile>;
|
|
8
|
+
export declare function validateOQSEPFile(data: unknown): OQSEPFile;
|
|
9
|
+
export declare function safeValidateOQSEPFile(data: unknown): ReturnType<typeof OQSEPFileSchema.safeParse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@memizy/oqse",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript SDK and Zod validators for the OQSE specification.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"schemas",
|
|
19
|
+
"README.md",
|
|
20
|
+
"SPECIFICATION.md"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "vite build --watch",
|
|
24
|
+
"generate:schemas": "tsx scripts/generate-schemas.ts",
|
|
25
|
+
"build": "npm run generate:schemas && tsc && vite build",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"test:watch": "vitest",
|
|
28
|
+
"prepublishOnly": "npm run build"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"tsx": "^4.21.0",
|
|
32
|
+
"typescript": "~6.0.2",
|
|
33
|
+
"vite": "^8.0.4",
|
|
34
|
+
"vite-plugin-dts": "^4.5.4",
|
|
35
|
+
"vitest": "^4.1.4"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"zod": "^4.3.6"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Generated JSON schemas
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"$schema": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"format": "uri"
|
|
8
|
+
},
|
|
9
|
+
"id": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"minLength": 1,
|
|
12
|
+
"pattern": "^[a-z0-9-]+(\\.[a-z0-9-]+)*$"
|
|
13
|
+
},
|
|
14
|
+
"appName": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"minLength": 1,
|
|
17
|
+
"maxLength": 100
|
|
18
|
+
},
|
|
19
|
+
"version": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"pattern": "^\\d+\\.\\d+$"
|
|
22
|
+
},
|
|
23
|
+
"pluginVersion": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"pattern": "^\\d+\\.\\d+\\.\\d+$"
|
|
26
|
+
},
|
|
27
|
+
"minOqseVersion": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"pattern": "^\\d+\\.\\d+$"
|
|
30
|
+
},
|
|
31
|
+
"maxOqseVersion": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"pattern": "^\\d+\\.\\d+$"
|
|
34
|
+
},
|
|
35
|
+
"capabilities": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"properties": {
|
|
38
|
+
"features": {
|
|
39
|
+
"type": "array",
|
|
40
|
+
"items": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"minLength": 1
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"latexPackages": {
|
|
46
|
+
"type": "array",
|
|
47
|
+
"items": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"minLength": 1
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"itemProperties": {
|
|
53
|
+
"type": "array",
|
|
54
|
+
"items": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"minLength": 1
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"metaProperties": {
|
|
60
|
+
"type": "array",
|
|
61
|
+
"items": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"minLength": 1
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"actions": {
|
|
67
|
+
"minItems": 1,
|
|
68
|
+
"type": "array",
|
|
69
|
+
"items": {
|
|
70
|
+
"type": "string"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"types": {
|
|
74
|
+
"anyOf": [
|
|
75
|
+
{
|
|
76
|
+
"type": "array",
|
|
77
|
+
"items": [
|
|
78
|
+
{
|
|
79
|
+
"type": "string",
|
|
80
|
+
"const": "*"
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"type": "array",
|
|
86
|
+
"items": {
|
|
87
|
+
"type": "string",
|
|
88
|
+
"minLength": 1
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"type": "null"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
"assets": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"properties": {
|
|
99
|
+
"image": {
|
|
100
|
+
"anyOf": [
|
|
101
|
+
{
|
|
102
|
+
"type": "array",
|
|
103
|
+
"items": [
|
|
104
|
+
{
|
|
105
|
+
"type": "string",
|
|
106
|
+
"const": "*"
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"type": "array",
|
|
112
|
+
"items": {
|
|
113
|
+
"type": "string"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"type": "null"
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
"audio": {
|
|
122
|
+
"anyOf": [
|
|
123
|
+
{
|
|
124
|
+
"type": "array",
|
|
125
|
+
"items": [
|
|
126
|
+
{
|
|
127
|
+
"type": "string",
|
|
128
|
+
"const": "*"
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"type": "array",
|
|
134
|
+
"items": {
|
|
135
|
+
"type": "string"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"type": "null"
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
"video": {
|
|
144
|
+
"anyOf": [
|
|
145
|
+
{
|
|
146
|
+
"type": "array",
|
|
147
|
+
"items": [
|
|
148
|
+
{
|
|
149
|
+
"type": "string",
|
|
150
|
+
"const": "*"
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"type": "array",
|
|
156
|
+
"items": {
|
|
157
|
+
"type": "string"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"type": "null"
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
},
|
|
165
|
+
"model": {
|
|
166
|
+
"anyOf": [
|
|
167
|
+
{
|
|
168
|
+
"type": "array",
|
|
169
|
+
"items": [
|
|
170
|
+
{
|
|
171
|
+
"type": "string",
|
|
172
|
+
"const": "*"
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"type": "array",
|
|
178
|
+
"items": {
|
|
179
|
+
"type": "string"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"type": "null"
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
"additionalProperties": false
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"required": [
|
|
192
|
+
"actions"
|
|
193
|
+
],
|
|
194
|
+
"additionalProperties": false
|
|
195
|
+
},
|
|
196
|
+
"author": {
|
|
197
|
+
"type": "string",
|
|
198
|
+
"maxLength": 100
|
|
199
|
+
},
|
|
200
|
+
"authorUrl": {
|
|
201
|
+
"type": "string",
|
|
202
|
+
"format": "uri"
|
|
203
|
+
},
|
|
204
|
+
"locales": {
|
|
205
|
+
"type": "array",
|
|
206
|
+
"items": {
|
|
207
|
+
"type": "string",
|
|
208
|
+
"minLength": 1
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"description": {
|
|
212
|
+
"type": "string",
|
|
213
|
+
"maxLength": 500
|
|
214
|
+
},
|
|
215
|
+
"emoji": {
|
|
216
|
+
"type": "string"
|
|
217
|
+
},
|
|
218
|
+
"tags": {
|
|
219
|
+
"type": "array",
|
|
220
|
+
"items": {
|
|
221
|
+
"type": "string",
|
|
222
|
+
"minLength": 1
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"studyMode": {
|
|
226
|
+
"type": "string",
|
|
227
|
+
"enum": [
|
|
228
|
+
"game",
|
|
229
|
+
"fun",
|
|
230
|
+
"drill"
|
|
231
|
+
]
|
|
232
|
+
},
|
|
233
|
+
"questionDensity": {
|
|
234
|
+
"type": "string",
|
|
235
|
+
"enum": [
|
|
236
|
+
"low",
|
|
237
|
+
"medium",
|
|
238
|
+
"high"
|
|
239
|
+
]
|
|
240
|
+
},
|
|
241
|
+
"appSpecific": {
|
|
242
|
+
"type": "object",
|
|
243
|
+
"propertyNames": {
|
|
244
|
+
"type": "string"
|
|
245
|
+
},
|
|
246
|
+
"additionalProperties": {}
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
"required": [
|
|
250
|
+
"id",
|
|
251
|
+
"appName",
|
|
252
|
+
"version",
|
|
253
|
+
"capabilities"
|
|
254
|
+
],
|
|
255
|
+
"additionalProperties": false
|
|
256
|
+
}
|