@memizy/oqse 0.1.1 → 0.1.3
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/README.md +25 -8
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +625 -432
- package/dist/src/header.d.ts +7 -0
- package/dist/src/headerValidation.d.ts +5 -0
- package/dist/src/headerValidation.test.d.ts +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/manifest.d.ts +24 -21
- package/dist/src/manifestValidation.d.ts +21 -8
- package/dist/src/oqse.d.ts +11 -52
- package/dist/src/oqseValidation.d.ts +98 -81
- package/dist/src/progress.d.ts +2 -2
- package/dist/src/richTextProcessor.d.ts +46 -0
- package/dist/src/richTextProcessor.test.d.ts +1 -0
- package/dist/src/utils.d.ts +14 -0
- package/dist/src/utils.test.d.ts +1 -0
- package/package.json +3 -1
- package/schemas/oqse-header-v0.1.json +120 -0
- package/schemas/oqse-manifest-v0.1.json +71 -15
- package/schemas/{oqsep-v0.1.json → oqse-progress-v0.1.json} +3 -1
- package/schemas/oqse-v0.1.json +156 -103
- package/SPECIFICATION.md +0 -2444
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OQSEMeta } from './oqse';
|
|
2
|
+
type OQSEHeaderMetaProjection = Pick<OQSEMeta, 'id' | 'title' | 'language' | 'updatedAt' | 'description' | 'author' | 'subject' | 'tags' | 'createdAt' | 'estimatedTime' | 'requirements'>;
|
|
3
|
+
export type OQSEHeader = Omit<OQSEHeaderMetaProjection, 'createdAt'> & Partial<Pick<OQSEHeaderMetaProjection, 'createdAt'>> & {
|
|
4
|
+
url: string;
|
|
5
|
+
$schema?: string;
|
|
6
|
+
};
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { OQSEHeader } from './header';
|
|
3
|
+
export declare const OQSEHeaderSchema: z.ZodType<OQSEHeader>;
|
|
4
|
+
export declare function validateOQSEHeader(data: unknown): OQSEHeader;
|
|
5
|
+
export declare function safeValidateOQSEHeader(data: unknown): ReturnType<typeof OQSEHeaderSchema.safeParse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -4,4 +4,7 @@ export * from './manifest';
|
|
|
4
4
|
export * from './manifestValidation';
|
|
5
5
|
export * from './progress';
|
|
6
6
|
export * from './progressValidation';
|
|
7
|
+
export * from './header';
|
|
8
|
+
export * from './headerValidation';
|
|
7
9
|
export * from './utils';
|
|
10
|
+
export * from './richTextProcessor';
|
package/dist/src/manifest.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FeatureProfile } from './oqse';
|
|
1
|
+
import { FeatureProfile, PersonObject } from './oqse';
|
|
2
2
|
export type { FeatureProfile } from './oqse';
|
|
3
3
|
/**
|
|
4
4
|
* Official actions from the OQSE Action Registry (Section 2.1.3).
|
|
@@ -9,7 +9,8 @@ export type { FeatureProfile } from './oqse';
|
|
|
9
9
|
* - `import` - Data ingestion: parses OQSE data into an internal system.
|
|
10
10
|
* - `export` - Data generation: serializes internal data into OQSE format.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export declare const OFFICIAL_ACTIONS: readonly ["render", "edit", "validate", "import", "export"];
|
|
13
|
+
export type OfficialAction = typeof OFFICIAL_ACTIONS[number];
|
|
13
14
|
/**
|
|
14
15
|
* Custom action using the required `x-` prefix (e.g., `"x-preview"`, `"x-sync"`).
|
|
15
16
|
* Host environments that do not recognize a custom action MUST ignore it.
|
|
@@ -47,11 +48,12 @@ export type OQSEQuestionDensity = 'low' | 'medium' | 'high';
|
|
|
47
48
|
* `meta.requirements.features` (Study Set) to signal support/requirement.
|
|
48
49
|
*
|
|
49
50
|
* Dependency notes:
|
|
50
|
-
* - `syntax-highlighting`, `mermaid`, `smiles`, `abc-notation`, `html
|
|
51
|
+
* - `syntax-highlighting`, `mermaid`, `smiles`, `abc-notation`, `html`
|
|
51
52
|
* are only meaningful when `markdown` is also declared.
|
|
52
53
|
* - `latexPackages` (in FeatureProfile) is only meaningful when `math` is declared.
|
|
53
54
|
*/
|
|
54
|
-
export
|
|
55
|
+
export declare const OFFICIAL_FEATURE_KEYS: readonly ["markdown", "math", "rtl", "html", "syntax-highlighting", "mermaid", "smiles", "abc-notation", "text-to-speech", "voice-input", "handwriting-recognition"];
|
|
56
|
+
export type OfficialFeatureKey = typeof OFFICIAL_FEATURE_KEYS[number];
|
|
55
57
|
/**
|
|
56
58
|
* A custom feature using the required `x-` prefix (e.g., `"x-memizy-3d-voxel"`).
|
|
57
59
|
* MUST NOT collide with current or future official registry entries.
|
|
@@ -68,7 +70,8 @@ export type FeatureFlag = OfficialFeatureKey | CustomFeatureKey;
|
|
|
68
70
|
* Declared in `capabilities.itemProperties` (app support) and
|
|
69
71
|
* `meta.requirements.itemProperties` (set requirement).
|
|
70
72
|
*/
|
|
71
|
-
export
|
|
73
|
+
export declare const OFFICIAL_ITEM_PROPERTIES: readonly ["hints", "explanation", "incorrectFeedback", "sources", "relatedItems", "dependencyItems", "timeLimit", "lang", "topic", "pedagogy"];
|
|
74
|
+
export type OfficialItemProperty = typeof OFFICIAL_ITEM_PROPERTIES[number];
|
|
72
75
|
/**
|
|
73
76
|
* A custom item property using the `x-` prefix.
|
|
74
77
|
*/
|
|
@@ -83,7 +86,8 @@ export type ItemPropertyKey = OfficialItemProperty | CustomItemProperty;
|
|
|
83
86
|
* Declared in `capabilities.metaProperties` (app support) and
|
|
84
87
|
* `meta.requirements.metaProperties` (set requirement).
|
|
85
88
|
*/
|
|
86
|
-
export
|
|
89
|
+
export declare const OFFICIAL_META_PROPERTIES: readonly ["description", "thumbnail", "subject", "language", "author", "contributors", "license", "ageRestriction", "tags", "tagDefinitions", "sourceMaterials", "estimatedTime", "prerequisites", "translations", "relatedSets"];
|
|
90
|
+
export type OfficialMetaProperty = typeof OFFICIAL_META_PROPERTIES[number];
|
|
87
91
|
/**
|
|
88
92
|
* A custom meta property using the `x-` prefix.
|
|
89
93
|
*/
|
|
@@ -160,7 +164,7 @@ export interface ManifestAssets {
|
|
|
160
164
|
* Declares everything the application can do, what types it handles,
|
|
161
165
|
* what media formats it accepts, and which OQSE features it supports.
|
|
162
166
|
*
|
|
163
|
-
* @see
|
|
167
|
+
* @see ../oqse-manifest.md#capabilities-object-extends-featureprofile
|
|
164
168
|
*/
|
|
165
169
|
export interface ManifestCapabilities extends FeatureProfile {
|
|
166
170
|
/**
|
|
@@ -231,12 +235,12 @@ export interface ManifestCapabilities extends FeatureProfile {
|
|
|
231
235
|
* - Non-HTML application: static `oqse-manifest.json` at the deployment root.
|
|
232
236
|
* - HTTP discovery: `Link: <manifest.json>; rel="oqse-manifest"` header.
|
|
233
237
|
*
|
|
234
|
-
* @see
|
|
238
|
+
* @see ../oqse-manifest.md#oqsem-application-manifest
|
|
235
239
|
*
|
|
236
240
|
* @example
|
|
237
241
|
* ```json
|
|
238
242
|
* {
|
|
239
|
-
* "$schema": "https://
|
|
243
|
+
* "$schema": "https://cdn.jsdelivr.net/gh/memizy/oqse-specification@main/schemas/oqse-manifest-v0.1.json",
|
|
240
244
|
* "version": "0.1",
|
|
241
245
|
* "pluginVersion": "2.1.0",
|
|
242
246
|
* "id": "https://memizy.com/universal-player",
|
|
@@ -253,7 +257,7 @@ export interface OQSEManifest {
|
|
|
253
257
|
/**
|
|
254
258
|
* URL reference to the JSON Schema for automatic validation.
|
|
255
259
|
* Recommended but not required.
|
|
256
|
-
|
|
260
|
+
* @example `"https://cdn.jsdelivr.net/gh/memizy/oqse-specification@main/schemas/oqse-manifest-v0.1.json"`
|
|
257
261
|
*/
|
|
258
262
|
$schema?: string;
|
|
259
263
|
/**
|
|
@@ -305,23 +309,22 @@ export interface OQSEManifest {
|
|
|
305
309
|
/**
|
|
306
310
|
* Human-readable description of what the application does.
|
|
307
311
|
* Displayed in host environments and plugin catalogs.
|
|
308
|
-
* **
|
|
312
|
+
* **Rich Content** (Markdown/LaTeX supported by host capabilities).
|
|
309
313
|
*/
|
|
310
314
|
description?: string;
|
|
311
315
|
/**
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
* @example `"Memizy Team"`
|
|
316
|
+
* Information about the main author or organization.
|
|
317
|
+
* Uses the standard `PersonObject` structure.
|
|
316
318
|
*/
|
|
317
|
-
author?:
|
|
319
|
+
author?: PersonObject;
|
|
318
320
|
/**
|
|
319
|
-
*
|
|
320
|
-
* MUST be an absolute URL.
|
|
321
|
-
*
|
|
322
|
-
* @example `"https://memizy.com"`
|
|
321
|
+
* Array of information about other contributors.
|
|
323
322
|
*/
|
|
324
|
-
|
|
323
|
+
contributors?: PersonObject[];
|
|
324
|
+
/** SPDX license identifier (e.g., "MIT", "GPL-3.0"). */
|
|
325
|
+
license?: string;
|
|
326
|
+
/** URI to the full text of the license. */
|
|
327
|
+
licenseUrl?: string;
|
|
325
328
|
/**
|
|
326
329
|
* BCP 47 locale codes for the application's supported UI languages.
|
|
327
330
|
* If absent or `[]`, the host SHOULD assume the application supports English.
|
|
@@ -64,16 +64,16 @@ export declare const ManifestCapabilitiesSchema: z.ZodObject<{
|
|
|
64
64
|
}, z.core.$strip>>;
|
|
65
65
|
}, z.core.$strip>;
|
|
66
66
|
/**
|
|
67
|
-
* Full OQSE Application Manifest schema (
|
|
67
|
+
* Full OQSE Application Manifest schema (Table 2.1.1).
|
|
68
68
|
*
|
|
69
69
|
* Validated constraints beyond syntax:
|
|
70
|
-
* - `minOqseVersion`
|
|
70
|
+
* - `minOqseVersion` <= `maxOqseVersion` when both are present
|
|
71
71
|
* - `version` adheres to MAJOR.MINOR format
|
|
72
72
|
* - `capabilities.actions` is non-empty (enforced by inner schema)
|
|
73
73
|
*/
|
|
74
74
|
export declare const OQSEManifestSchema: z.ZodObject<{
|
|
75
75
|
$schema: z.ZodOptional<z.ZodString>;
|
|
76
|
-
id: z.ZodString
|
|
76
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
77
77
|
appName: z.ZodString;
|
|
78
78
|
version: z.ZodString;
|
|
79
79
|
pluginVersion: z.ZodOptional<z.ZodString>;
|
|
@@ -93,8 +93,20 @@ export declare const OQSEManifestSchema: z.ZodObject<{
|
|
|
93
93
|
model: z.ZodOptional<z.ZodUnion<[z.ZodTuple<[z.ZodLiteral<"*">], z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | null>, z.ZodArray<z.ZodString>, z.ZodNull]>>;
|
|
94
94
|
}, z.core.$strip>>;
|
|
95
95
|
}, z.core.$strip>;
|
|
96
|
-
author: z.ZodOptional<z.
|
|
97
|
-
|
|
96
|
+
author: z.ZodOptional<z.ZodObject<{
|
|
97
|
+
name: z.ZodString;
|
|
98
|
+
role: z.ZodOptional<z.ZodString>;
|
|
99
|
+
email: z.ZodOptional<z.ZodString>;
|
|
100
|
+
url: z.ZodOptional<z.ZodString>;
|
|
101
|
+
}, z.core.$strip>>;
|
|
102
|
+
contributors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
103
|
+
name: z.ZodString;
|
|
104
|
+
role: z.ZodOptional<z.ZodString>;
|
|
105
|
+
email: z.ZodOptional<z.ZodString>;
|
|
106
|
+
url: z.ZodOptional<z.ZodString>;
|
|
107
|
+
}, z.core.$strip>>>;
|
|
108
|
+
license: z.ZodOptional<z.ZodString>;
|
|
109
|
+
licenseUrl: z.ZodOptional<z.ZodString>;
|
|
98
110
|
locales: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
99
111
|
description: z.ZodOptional<z.ZodString>;
|
|
100
112
|
emoji: z.ZodOptional<z.ZodString>;
|
|
@@ -151,15 +163,16 @@ export declare function safeValidateManifest(data: unknown): ReturnType<typeof O
|
|
|
151
163
|
* @example
|
|
152
164
|
* ```ts
|
|
153
165
|
* console.error(formatManifestErrors(result.error));
|
|
154
|
-
* //
|
|
155
|
-
* //
|
|
166
|
+
* // Example output:
|
|
167
|
+
* // "id: ID must be an absolute URL or a URN-format UUID (urn:uuid:...)"
|
|
168
|
+
* // "capabilities.actions: Application must support at least one action"
|
|
156
169
|
* ```
|
|
157
170
|
*/
|
|
158
171
|
export declare function formatManifestErrors(error: z.ZodError): string;
|
|
159
172
|
/**
|
|
160
173
|
* Checks whether a plain object looks like an OQSE Manifest (duck-typing).
|
|
161
174
|
*
|
|
162
|
-
* This is a fast pre-check
|
|
175
|
+
* This is a fast pre-check - use `validateManifest` for full validation.
|
|
163
176
|
*
|
|
164
177
|
* @param data - Any value.
|
|
165
178
|
* @returns `true` if `data` has the minimum required shape.
|
package/dist/src/oqse.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Type-safe TypeScript definitions for the OQSE specification.
|
|
6
6
|
* Uses Discriminated Unions to make invalid states unrepresentable.
|
|
7
7
|
*
|
|
8
|
-
* @see
|
|
8
|
+
* @see ../oqse.md
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
11
11
|
* BCP 47 language code (e.g., "en", "en-US", "cs", "zh-Hans")
|
|
@@ -178,7 +178,7 @@ export type TagDefinitionDictionary = Record<string, TagDefinition>;
|
|
|
178
178
|
* It declares which features, LaTeX packages, and item/meta properties
|
|
179
179
|
* an application supports (in Manifest) or requires (in Study Set).
|
|
180
180
|
*
|
|
181
|
-
* @see
|
|
181
|
+
* @see ../oqse.md#feature-profile--official-registry
|
|
182
182
|
*/
|
|
183
183
|
export interface FeatureProfile {
|
|
184
184
|
/**
|
|
@@ -203,29 +203,6 @@ export interface FeatureProfile {
|
|
|
203
203
|
*/
|
|
204
204
|
metaProperties?: string[];
|
|
205
205
|
}
|
|
206
|
-
/**
|
|
207
|
-
* Feature requirement type
|
|
208
|
-
* @deprecated Use FeatureProfile instead for spec-compliant requirements.
|
|
209
|
-
*/
|
|
210
|
-
export type FeatureType = 'official' | 'experimental' | 'proprietary';
|
|
211
|
-
/**
|
|
212
|
-
* Official feature names
|
|
213
|
-
*/
|
|
214
|
-
export type OfficialFeatureName = 'math' | 'media-image' | 'media-audio' | 'media-video' | 'hotspots' | 'complex-pairing' | 'open-text';
|
|
215
|
-
/**
|
|
216
|
-
* Feature requirement object
|
|
217
|
-
*/
|
|
218
|
-
export interface FeatureRequirement {
|
|
219
|
-
/** Feature name */
|
|
220
|
-
name: string;
|
|
221
|
-
/** Feature type */
|
|
222
|
-
type: FeatureType;
|
|
223
|
-
/**
|
|
224
|
-
* For proprietary features: Domain name of the provider (e.g., "memizy.com").
|
|
225
|
-
* MUST be present for type: "proprietary", ignored for other types.
|
|
226
|
-
*/
|
|
227
|
-
vendor?: string;
|
|
228
|
-
}
|
|
229
206
|
/**
|
|
230
207
|
* Translation object defining reference to translated version of this set
|
|
231
208
|
*/
|
|
@@ -279,31 +256,12 @@ export interface Pedagogy {
|
|
|
279
256
|
/** Penalty for each wrong choice (0.0 - 1.0) */
|
|
280
257
|
penaltyPerWrong?: number;
|
|
281
258
|
}
|
|
282
|
-
/**
|
|
283
|
-
* Math renderer type
|
|
284
|
-
*/
|
|
285
|
-
export type MathRenderer = 'katex' | 'mathjax';
|
|
286
|
-
/**
|
|
287
|
-
* Math settings for rendering mathematical formulas
|
|
288
|
-
*/
|
|
289
|
-
export interface MathSettings {
|
|
290
|
-
/** Preferred renderer */
|
|
291
|
-
renderer?: MathRenderer;
|
|
292
|
-
/** Array of LaTeX package names required for proper formula display */
|
|
293
|
-
packages?: string[];
|
|
294
|
-
}
|
|
295
259
|
/**
|
|
296
260
|
* Metadata describing the entire set
|
|
297
261
|
*/
|
|
298
262
|
export interface OQSEMeta {
|
|
299
263
|
/** Unique UUID of the set */
|
|
300
264
|
id: string;
|
|
301
|
-
/**
|
|
302
|
-
* Origin UUID of the creator.
|
|
303
|
-
* Used to verify ownership when syncing between devices or cloud.
|
|
304
|
-
* If created anonymously, this is the local device install ID.
|
|
305
|
-
*/
|
|
306
|
-
originUid?: string;
|
|
307
265
|
/** Language code of the set (BCP 47) */
|
|
308
266
|
language: LanguageCode;
|
|
309
267
|
/** Title of the study set (Plain Text) */
|
|
@@ -340,11 +298,6 @@ export interface OQSEMeta {
|
|
|
340
298
|
* @see FeatureProfile
|
|
341
299
|
*/
|
|
342
300
|
requirements?: FeatureProfile;
|
|
343
|
-
/**
|
|
344
|
-
* @deprecated Use `requirements` (FeatureProfile) instead.
|
|
345
|
-
* This field used a non-spec-compliant structure.
|
|
346
|
-
*/
|
|
347
|
-
requiredFeatures?: FeatureRequirement[];
|
|
348
301
|
/** Array of text labels (tags) for the entire set */
|
|
349
302
|
tags?: string[];
|
|
350
303
|
/** Dictionary of tag definitions */
|
|
@@ -359,8 +312,6 @@ export interface OQSEMeta {
|
|
|
359
312
|
prerequisites?: LinkedSetObject[];
|
|
360
313
|
/** Array of references to related OQSE sets */
|
|
361
314
|
relatedSets?: LinkedSetObject[];
|
|
362
|
-
/** Configuration for rendering mathematical formulas */
|
|
363
|
-
mathSettings?: MathSettings;
|
|
364
315
|
/** Object for metadata determined by the author/creator */
|
|
365
316
|
customData?: Record<string, unknown>;
|
|
366
317
|
/** Object for metadata specific to a particular software application */
|
|
@@ -380,6 +331,8 @@ export interface BaseItem {
|
|
|
380
331
|
lang?: LanguageCode;
|
|
381
332
|
/** Array of text labels (tags) for this item */
|
|
382
333
|
tags?: string[];
|
|
334
|
+
/** Primary category, chapter, or lecture name for this item */
|
|
335
|
+
topic?: string;
|
|
383
336
|
/** Numeric difficulty from 1 (easy) to 5 (hard) */
|
|
384
337
|
difficulty?: number;
|
|
385
338
|
/** Recommended time limit in seconds for answering this item */
|
|
@@ -487,6 +440,10 @@ export interface MeshHotspot extends BaseHotspot {
|
|
|
487
440
|
* Use `MeshHotspot` for 3D model mesh selection.
|
|
488
441
|
*/
|
|
489
442
|
export type HotspotObject = RectHotspot | CircleHotspot | PolygonHotspot | MeshHotspot;
|
|
443
|
+
/**
|
|
444
|
+
* 2D hotspots for image-based interactions.
|
|
445
|
+
*/
|
|
446
|
+
export type Hotspot2D = RectHotspot | CircleHotspot | PolygonHotspot;
|
|
490
447
|
/**
|
|
491
448
|
* A 3D point or vector with X, Y, Z coordinates.
|
|
492
449
|
* Used for camera setup in `pin-on-model` items.
|
|
@@ -586,6 +543,8 @@ export interface NoteItem extends BaseItem {
|
|
|
586
543
|
title?: string;
|
|
587
544
|
/** Main educational content (Rich Content) */
|
|
588
545
|
content: string;
|
|
546
|
+
/** Additional content that is initially hidden (Rich Content) */
|
|
547
|
+
hiddenContent?: string;
|
|
589
548
|
}
|
|
590
549
|
/**
|
|
591
550
|
* Flashcard item
|
|
@@ -790,7 +749,7 @@ export interface PinOnImageItem extends BaseItem {
|
|
|
790
749
|
/** Key from assets, which determines the image to be clicked on */
|
|
791
750
|
targetAsset: string;
|
|
792
751
|
/** Array defining correct areas. Min 1 hotspot. */
|
|
793
|
-
hotspots:
|
|
752
|
+
hotspots: Hotspot2D[];
|
|
794
753
|
/** Whether user must mark more than one hotspot. Default: false */
|
|
795
754
|
multipleCorrect?: boolean;
|
|
796
755
|
/**
|