@memizy/oqse 0.1.2 → 0.1.4

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -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 {};
@@ -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';
@@ -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 /SPECIFICATION.md#212-capabilities-object-extends-featureprofile
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 /SPECIFICATION.md#21-the-application-manifest
238
+ * @see ../oqse-manifest.md#oqsem-application-manifest
239
239
  *
240
240
  * @example
241
241
  * ```json
242
242
  * {
243
- * "$schema": "https://memizy.com/schemas/oqse-manifest/v0.1.json",
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
- * @example `"https://memizy.com/schemas/oqse-manifest/v0.1.json"`
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
- * **Plain Text** - no Markdown or HTML.
312
+ * **Rich Content** (Markdown/LaTeX supported by host capabilities).
313
313
  */
314
314
  description?: string;
315
315
  /**
316
- * Name of the author or organization.
317
- * **Plain Text.**
318
- *
319
- * @example `"Memizy Team"`
316
+ * Information about the main author or organization.
317
+ * Uses the standard `PersonObject` structure.
320
318
  */
321
- author?: string;
319
+ author?: PersonObject;
322
320
  /**
323
- * URL of the author or organization.
324
- * MUST be an absolute URL.
325
- *
326
- * @example `"https://memizy.com"`
321
+ * Array of information about other contributors.
327
322
  */
328
- authorUrl?: string;
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.ZodString>;
97
- authorUrl: z.ZodOptional<z.ZodString>;
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>;
@@ -120,11 +132,11 @@ export declare const OQSEManifestSchema: z.ZodObject<{
120
132
  *
121
133
  * @example
122
134
  * ```ts
123
- * const manifest = validateManifest(JSON.parse(rawJson));
135
+ * const manifest = validateOQSEManifest(JSON.parse(rawJson));
124
136
  * manifest.capabilities.actions; // string[]
125
137
  * ```
126
138
  */
127
- export declare function validateManifest(data: unknown): OQSEManifest;
139
+ export declare function validateOQSEManifest(data: unknown): OQSEManifest;
128
140
  /**
129
141
  * Safely validates an unknown value without throwing.
130
142
  *
@@ -133,34 +145,17 @@ export declare function validateManifest(data: unknown): OQSEManifest;
133
145
  *
134
146
  * @example
135
147
  * ```ts
136
- * const result = safeValidateManifest(raw);
148
+ * const result = safeValidateOQSEManifest(raw);
137
149
  * if (result.success) {
138
150
  * console.log(result.data.id);
139
- * } else {
140
- * console.error(formatManifestErrors(result.error));
141
151
  * }
142
152
  * ```
143
153
  */
144
- export declare function safeValidateManifest(data: unknown): ReturnType<typeof OQSEManifestSchema.safeParse>;
145
- /**
146
- * Formats a `ZodError` from manifest validation into a human-readable string.
147
- *
148
- * @param error - A `ZodError` returned by `safeValidateManifest`.
149
- * @returns A newline-separated string listing each validation issue with its path.
150
- *
151
- * @example
152
- * ```ts
153
- * console.error(formatManifestErrors(result.error));
154
- * // Example output:
155
- * // "id: ID must be in reverse-domain format (e.g. \"com.acme.app\")"
156
- * // "capabilities.actions: Application must support at least one action"
157
- * ```
158
- */
159
- export declare function formatManifestErrors(error: z.ZodError): string;
154
+ export declare function safeValidateOQSEManifest(data: unknown): ReturnType<typeof OQSEManifestSchema.safeParse>;
160
155
  /**
161
156
  * Checks whether a plain object looks like an OQSE Manifest (duck-typing).
162
157
  *
163
- * This is a fast pre-check - use `validateManifest` for full validation.
158
+ * This is a fast pre-check - use `validateOQSEManifest` for full validation.
164
159
  *
165
160
  * @param data - Any value.
166
161
  * @returns `true` if `data` has the minimum required shape.
@@ -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 /SPECIFICATION.md
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 /SPECIFICATION.md#22-feature-profile--official-registry
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: HotspotObject[];
752
+ hotspots: Hotspot2D[];
766
753
  /** Whether user must mark more than one hotspot. Default: false */
767
754
  multipleCorrect?: boolean;
768
755
  /**