@memizy/oqse 0.1.2 → 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 +12 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +448 -353
- 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 +2 -0
- package/dist/src/manifest.d.ts +15 -16
- package/dist/src/manifestValidation.d.ts +16 -4
- package/dist/src/oqse.d.ts +11 -24
- package/dist/src/oqseValidation.d.ts +95 -37
- package/dist/src/progress.d.ts +2 -2
- package/dist/src/utils.d.ts +5 -0
- package/dist/src/utils.test.d.ts +1 -0
- package/package.json +1 -1
- package/schemas/oqse-header-v0.1.json +120 -0
- package/schemas/oqse-manifest-v0.1.json +68 -9
- package/schemas/{oqsep-v0.1.json → oqse-progress-v0.1.json} +3 -1
- package/schemas/oqse-v0.1.json +153 -69
|
@@ -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,5 +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';
|
|
8
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).
|
|
@@ -164,7 +164,7 @@ export interface ManifestAssets {
|
|
|
164
164
|
* Declares everything the application can do, what types it handles,
|
|
165
165
|
* what media formats it accepts, and which OQSE features it supports.
|
|
166
166
|
*
|
|
167
|
-
* @see
|
|
167
|
+
* @see ../oqse-manifest.md#capabilities-object-extends-featureprofile
|
|
168
168
|
*/
|
|
169
169
|
export interface ManifestCapabilities extends FeatureProfile {
|
|
170
170
|
/**
|
|
@@ -235,12 +235,12 @@ export interface ManifestCapabilities extends FeatureProfile {
|
|
|
235
235
|
* - Non-HTML application: static `oqse-manifest.json` at the deployment root.
|
|
236
236
|
* - HTTP discovery: `Link: <manifest.json>; rel="oqse-manifest"` header.
|
|
237
237
|
*
|
|
238
|
-
* @see
|
|
238
|
+
* @see ../oqse-manifest.md#oqsem-application-manifest
|
|
239
239
|
*
|
|
240
240
|
* @example
|
|
241
241
|
* ```json
|
|
242
242
|
* {
|
|
243
|
-
* "$schema": "https://
|
|
243
|
+
* "$schema": "https://cdn.jsdelivr.net/gh/memizy/oqse-specification@main/schemas/oqse-manifest-v0.1.json",
|
|
244
244
|
* "version": "0.1",
|
|
245
245
|
* "pluginVersion": "2.1.0",
|
|
246
246
|
* "id": "https://memizy.com/universal-player",
|
|
@@ -257,7 +257,7 @@ export interface OQSEManifest {
|
|
|
257
257
|
/**
|
|
258
258
|
* URL reference to the JSON Schema for automatic validation.
|
|
259
259
|
* Recommended but not required.
|
|
260
|
-
|
|
260
|
+
* @example `"https://cdn.jsdelivr.net/gh/memizy/oqse-specification@main/schemas/oqse-manifest-v0.1.json"`
|
|
261
261
|
*/
|
|
262
262
|
$schema?: string;
|
|
263
263
|
/**
|
|
@@ -309,23 +309,22 @@ export interface OQSEManifest {
|
|
|
309
309
|
/**
|
|
310
310
|
* Human-readable description of what the application does.
|
|
311
311
|
* Displayed in host environments and plugin catalogs.
|
|
312
|
-
* **
|
|
312
|
+
* **Rich Content** (Markdown/LaTeX supported by host capabilities).
|
|
313
313
|
*/
|
|
314
314
|
description?: string;
|
|
315
315
|
/**
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
* @example `"Memizy Team"`
|
|
316
|
+
* Information about the main author or organization.
|
|
317
|
+
* Uses the standard `PersonObject` structure.
|
|
320
318
|
*/
|
|
321
|
-
author?:
|
|
319
|
+
author?: PersonObject;
|
|
322
320
|
/**
|
|
323
|
-
*
|
|
324
|
-
* MUST be an absolute URL.
|
|
325
|
-
*
|
|
326
|
-
* @example `"https://memizy.com"`
|
|
321
|
+
* Array of information about other contributors.
|
|
327
322
|
*/
|
|
328
|
-
|
|
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;
|
|
329
328
|
/**
|
|
330
329
|
* BCP 47 locale codes for the application's supported UI languages.
|
|
331
330
|
* If absent or `[]`, the host SHOULD assume the application supports English.
|
|
@@ -73,7 +73,7 @@ export declare const ManifestCapabilitiesSchema: z.ZodObject<{
|
|
|
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>;
|
|
@@ -152,7 +164,7 @@ export declare function safeValidateManifest(data: unknown): ReturnType<typeof O
|
|
|
152
164
|
* ```ts
|
|
153
165
|
* console.error(formatManifestErrors(result.error));
|
|
154
166
|
* // Example output:
|
|
155
|
-
* // "id: ID must be
|
|
167
|
+
* // "id: ID must be an absolute URL or a URN-format UUID (urn:uuid:...)"
|
|
156
168
|
* // "capabilities.actions: Application must support at least one action"
|
|
157
169
|
* ```
|
|
158
170
|
*/
|
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
|
/**
|
|
@@ -256,31 +256,12 @@ export interface Pedagogy {
|
|
|
256
256
|
/** Penalty for each wrong choice (0.0 - 1.0) */
|
|
257
257
|
penaltyPerWrong?: number;
|
|
258
258
|
}
|
|
259
|
-
/**
|
|
260
|
-
* Math renderer type
|
|
261
|
-
*/
|
|
262
|
-
export type MathRenderer = 'katex' | 'mathjax';
|
|
263
|
-
/**
|
|
264
|
-
* Math settings for rendering mathematical formulas
|
|
265
|
-
*/
|
|
266
|
-
export interface MathSettings {
|
|
267
|
-
/** Preferred renderer */
|
|
268
|
-
renderer?: MathRenderer;
|
|
269
|
-
/** Array of LaTeX package names required for proper formula display */
|
|
270
|
-
packages?: string[];
|
|
271
|
-
}
|
|
272
259
|
/**
|
|
273
260
|
* Metadata describing the entire set
|
|
274
261
|
*/
|
|
275
262
|
export interface OQSEMeta {
|
|
276
263
|
/** Unique UUID of the set */
|
|
277
264
|
id: string;
|
|
278
|
-
/**
|
|
279
|
-
* Origin UUID of the creator.
|
|
280
|
-
* Used to verify ownership when syncing between devices or cloud.
|
|
281
|
-
* If created anonymously, this is the local device install ID.
|
|
282
|
-
*/
|
|
283
|
-
originUid?: string;
|
|
284
265
|
/** Language code of the set (BCP 47) */
|
|
285
266
|
language: LanguageCode;
|
|
286
267
|
/** Title of the study set (Plain Text) */
|
|
@@ -331,8 +312,6 @@ export interface OQSEMeta {
|
|
|
331
312
|
prerequisites?: LinkedSetObject[];
|
|
332
313
|
/** Array of references to related OQSE sets */
|
|
333
314
|
relatedSets?: LinkedSetObject[];
|
|
334
|
-
/** Configuration for rendering mathematical formulas */
|
|
335
|
-
mathSettings?: MathSettings;
|
|
336
315
|
/** Object for metadata determined by the author/creator */
|
|
337
316
|
customData?: Record<string, unknown>;
|
|
338
317
|
/** Object for metadata specific to a particular software application */
|
|
@@ -352,6 +331,8 @@ export interface BaseItem {
|
|
|
352
331
|
lang?: LanguageCode;
|
|
353
332
|
/** Array of text labels (tags) for this item */
|
|
354
333
|
tags?: string[];
|
|
334
|
+
/** Primary category, chapter, or lecture name for this item */
|
|
335
|
+
topic?: string;
|
|
355
336
|
/** Numeric difficulty from 1 (easy) to 5 (hard) */
|
|
356
337
|
difficulty?: number;
|
|
357
338
|
/** Recommended time limit in seconds for answering this item */
|
|
@@ -459,6 +440,10 @@ export interface MeshHotspot extends BaseHotspot {
|
|
|
459
440
|
* Use `MeshHotspot` for 3D model mesh selection.
|
|
460
441
|
*/
|
|
461
442
|
export type HotspotObject = RectHotspot | CircleHotspot | PolygonHotspot | MeshHotspot;
|
|
443
|
+
/**
|
|
444
|
+
* 2D hotspots for image-based interactions.
|
|
445
|
+
*/
|
|
446
|
+
export type Hotspot2D = RectHotspot | CircleHotspot | PolygonHotspot;
|
|
462
447
|
/**
|
|
463
448
|
* A 3D point or vector with X, Y, Z coordinates.
|
|
464
449
|
* Used for camera setup in `pin-on-model` items.
|
|
@@ -558,6 +543,8 @@ export interface NoteItem extends BaseItem {
|
|
|
558
543
|
title?: string;
|
|
559
544
|
/** Main educational content (Rich Content) */
|
|
560
545
|
content: string;
|
|
546
|
+
/** Additional content that is initially hidden (Rich Content) */
|
|
547
|
+
hiddenContent?: string;
|
|
561
548
|
}
|
|
562
549
|
/**
|
|
563
550
|
* Flashcard item
|
|
@@ -762,7 +749,7 @@ export interface PinOnImageItem extends BaseItem {
|
|
|
762
749
|
/** Key from assets, which determines the image to be clicked on */
|
|
763
750
|
targetAsset: string;
|
|
764
751
|
/** Array defining correct areas. Min 1 hotspot. */
|
|
765
|
-
hotspots:
|
|
752
|
+
hotspots: Hotspot2D[];
|
|
766
753
|
/** Whether user must mark more than one hotspot. Default: false */
|
|
767
754
|
multipleCorrect?: boolean;
|
|
768
755
|
/**
|