@examplary/schemas 1.14.0 → 1.15.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.
@@ -54,7 +54,47 @@ export declare const Qti3Mapping: z.ZodObject<{
54
54
  TextEntryInteraction: "TextEntryInteraction";
55
55
  UploadInteraction: "UploadInteraction";
56
56
  }>;
57
- options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodAny>, z.ZodObject<{}, z.core.$strip>]>>>;
57
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>>;
58
58
  }, z.core.$strip>;
59
59
  }, z.core.$strip>;
60
60
  export type Qti3Mapping = z.infer<typeof Qti3Mapping>;
61
+ /**
62
+ * QTI 3.0 import mapping for a custom question type.
63
+ * When an incoming QTI item's interaction type matches, the question is imported
64
+ * as this question type with settings derived from the JSONata expressions.
65
+ *
66
+ * JSONata context: { interaction, correctResponse, points }
67
+ * - interaction: plain-object representation of the QTI interaction element
68
+ * - correctResponse: string[] of correct response identifiers/values
69
+ * - points: number of points from the QTI score outcome
70
+ */
71
+ export declare const Qti3ImportMapping: z.ZodObject<{
72
+ interaction: z.ZodObject<{
73
+ type: z.ZodEnum<{
74
+ AssociateInteraction: "AssociateInteraction";
75
+ ChoiceInteraction: "ChoiceInteraction";
76
+ DrawingInteraction: "DrawingInteraction";
77
+ EndAttemptInteraction: "EndAttemptInteraction";
78
+ ExtendedTextInteraction: "ExtendedTextInteraction";
79
+ GapMatchInteraction: "GapMatchInteraction";
80
+ GraphicAssociateInteraction: "GraphicAssociateInteraction";
81
+ GraphicGapMatchInteraction: "GraphicGapMatchInteraction";
82
+ GraphicOrderInteraction: "GraphicOrderInteraction";
83
+ HotspotInteraction: "HotspotInteraction";
84
+ HottextInteraction: "HottextInteraction";
85
+ InlineChoiceInteraction: "InlineChoiceInteraction";
86
+ MatchInteraction: "MatchInteraction";
87
+ MediaInteraction: "MediaInteraction";
88
+ OrderInteraction: "OrderInteraction";
89
+ PortableCustomInteraction: "PortableCustomInteraction";
90
+ PositionObjectInteraction: "PositionObjectInteraction";
91
+ SelectPointInteraction: "SelectPointInteraction";
92
+ SliderInteraction: "SliderInteraction";
93
+ TextEntryInteraction: "TextEntryInteraction";
94
+ UploadInteraction: "UploadInteraction";
95
+ }>;
96
+ }, z.core.$strip>;
97
+ condition: z.ZodOptional<z.ZodString>;
98
+ settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>>;
99
+ }, z.core.$strip>;
100
+ export type Qti3ImportMapping = z.infer<typeof Qti3ImportMapping>;
@@ -4,7 +4,13 @@ import { z } from "zod";
4
4
  * JSONata expressions are evaluated at transform time against the question context.
5
5
  */
6
6
  const JsonataExpr = z
7
- .union([z.string(), z.number(), z.boolean(), z.array(z.any()), z.object({})])
7
+ .union([
8
+ z.string(),
9
+ z.number(),
10
+ z.boolean(),
11
+ z.array(z.any()),
12
+ z.record(z.string(), z.any()),
13
+ ])
8
14
  .describe("Literal or JSONata expression string starting with '='");
9
15
  /**
10
16
  * Supported QTI 3.0 interaction types
@@ -43,3 +49,28 @@ export const Qti3Mapping = z
43
49
  }),
44
50
  })
45
51
  .describe("QTI 3.0 mapping configuration for transforming questions to QTI format");
52
+ /**
53
+ * QTI 3.0 import mapping for a custom question type.
54
+ * When an incoming QTI item's interaction type matches, the question is imported
55
+ * as this question type with settings derived from the JSONata expressions.
56
+ *
57
+ * JSONata context: { interaction, correctResponse, points }
58
+ * - interaction: plain-object representation of the QTI interaction element
59
+ * - correctResponse: string[] of correct response identifiers/values
60
+ * - points: number of points from the QTI score outcome
61
+ */
62
+ export const Qti3ImportMapping = z
63
+ .object({
64
+ interaction: z.object({
65
+ type: QtiInteractionType.describe("The QTI interaction type this question type handles on import"),
66
+ }),
67
+ condition: z
68
+ .string()
69
+ .optional()
70
+ .describe("Optional JSONata expression (starting with =) that must evaluate to true for this mapping to be used. Evaluated against the same context as settings: { interaction, correctResponse, points }. Useful when multiple question types handle the same interaction type (e.g. single vs multiple choice)."),
71
+ settings: z
72
+ .record(z.string(), JsonataExpr)
73
+ .optional()
74
+ .describe("JSONata expressions mapping QTI interaction properties to question settings"),
75
+ })
76
+ .describe("QTI 3.0 import mapping configuration for a custom question type");
@@ -97,10 +97,41 @@ export declare const QuestionTypeSchema: z.ZodObject<{
97
97
  TextEntryInteraction: "TextEntryInteraction";
98
98
  UploadInteraction: "UploadInteraction";
99
99
  }>;
100
- options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodAny>, z.ZodObject<{}, z.core.$strip>]>>>;
100
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>>;
101
101
  }, z.core.$strip>;
102
102
  }, z.core.$strip>>;
103
103
  }, z.core.$strip>>;
104
+ import: z.ZodOptional<z.ZodObject<{
105
+ qti3: z.ZodOptional<z.ZodObject<{
106
+ interaction: z.ZodObject<{
107
+ type: z.ZodEnum<{
108
+ AssociateInteraction: "AssociateInteraction";
109
+ ChoiceInteraction: "ChoiceInteraction";
110
+ DrawingInteraction: "DrawingInteraction";
111
+ EndAttemptInteraction: "EndAttemptInteraction";
112
+ ExtendedTextInteraction: "ExtendedTextInteraction";
113
+ GapMatchInteraction: "GapMatchInteraction";
114
+ GraphicAssociateInteraction: "GraphicAssociateInteraction";
115
+ GraphicGapMatchInteraction: "GraphicGapMatchInteraction";
116
+ GraphicOrderInteraction: "GraphicOrderInteraction";
117
+ HotspotInteraction: "HotspotInteraction";
118
+ HottextInteraction: "HottextInteraction";
119
+ InlineChoiceInteraction: "InlineChoiceInteraction";
120
+ MatchInteraction: "MatchInteraction";
121
+ MediaInteraction: "MediaInteraction";
122
+ OrderInteraction: "OrderInteraction";
123
+ PortableCustomInteraction: "PortableCustomInteraction";
124
+ PositionObjectInteraction: "PositionObjectInteraction";
125
+ SelectPointInteraction: "SelectPointInteraction";
126
+ SliderInteraction: "SliderInteraction";
127
+ TextEntryInteraction: "TextEntryInteraction";
128
+ UploadInteraction: "UploadInteraction";
129
+ }>;
130
+ }, z.core.$strip>;
131
+ condition: z.ZodOptional<z.ZodString>;
132
+ settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>>;
133
+ }, z.core.$strip>>;
134
+ }, z.core.$strip>>;
104
135
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
105
136
  stylesheet: z.ZodOptional<z.ZodURL>;
106
137
  index: z.ZodOptional<z.ZodNumber>;
@@ -3,7 +3,7 @@ import { QuestionTypeCapabilitiesSchema } from "./question-type-capabilities";
3
3
  import { PathOrUrlReference, QuestionTypeComponents, } from "./question-type-components";
4
4
  import { QuestionTypeGenerationOptions } from "./question-type-generation-options";
5
5
  import { QuestionTypeGradingOptions } from "./question-type-grading-options";
6
- import { Qti3Mapping } from "./question-type-qti3";
6
+ import { Qti3ImportMapping, Qti3Mapping } from "./question-type-qti3";
7
7
  import { QuestionTypeScanningOptions } from "./question-type-scanning-options";
8
8
  import { QuestionTypeSetting } from "./question-type-setting";
9
9
  import { ScalarSchema } from "../common/scalar";
@@ -79,6 +79,12 @@ export const QuestionTypeSchema = z
79
79
  })
80
80
  .optional()
81
81
  .describe("Export configuration for various formats"),
82
+ import: z
83
+ .object({
84
+ qti3: Qti3ImportMapping.optional().describe("QTI 3.0 import configuration for mapping incoming QTI items to this question type"),
85
+ })
86
+ .optional()
87
+ .describe("Import configuration for various formats"),
82
88
  metadata: z
83
89
  .record(z.string(), ScalarSchema)
84
90
  .optional()
@@ -555,8 +555,10 @@
555
555
  },
556
556
  {
557
557
  "type": "object",
558
- "properties": {},
559
- "additionalProperties": false
558
+ "propertyNames": {
559
+ "type": "string"
560
+ },
561
+ "additionalProperties": {}
560
562
  }
561
563
  ],
562
564
  "description": "Literal or JSONata expression string starting with '='"
@@ -577,6 +579,95 @@
577
579
  },
578
580
  "additionalProperties": false
579
581
  },
582
+ "import": {
583
+ "description": "Import configuration for various formats",
584
+ "type": "object",
585
+ "properties": {
586
+ "qti3": {
587
+ "description": "QTI 3.0 import configuration for mapping incoming QTI items to this question type",
588
+ "type": "object",
589
+ "properties": {
590
+ "interaction": {
591
+ "type": "object",
592
+ "properties": {
593
+ "type": {
594
+ "type": "string",
595
+ "enum": [
596
+ "AssociateInteraction",
597
+ "ChoiceInteraction",
598
+ "DrawingInteraction",
599
+ "EndAttemptInteraction",
600
+ "ExtendedTextInteraction",
601
+ "GapMatchInteraction",
602
+ "GraphicAssociateInteraction",
603
+ "GraphicGapMatchInteraction",
604
+ "GraphicOrderInteraction",
605
+ "HotspotInteraction",
606
+ "HottextInteraction",
607
+ "InlineChoiceInteraction",
608
+ "MatchInteraction",
609
+ "MediaInteraction",
610
+ "OrderInteraction",
611
+ "PortableCustomInteraction",
612
+ "PositionObjectInteraction",
613
+ "SelectPointInteraction",
614
+ "SliderInteraction",
615
+ "TextEntryInteraction",
616
+ "UploadInteraction"
617
+ ],
618
+ "description": "The QTI interaction type this question type handles on import"
619
+ }
620
+ },
621
+ "required": [
622
+ "type"
623
+ ],
624
+ "additionalProperties": false
625
+ },
626
+ "condition": {
627
+ "description": "Optional JSONata expression (starting with =) that must evaluate to true for this mapping to be used. Evaluated against the same context as settings: { interaction, correctResponse, points }. Useful when multiple question types handle the same interaction type (e.g. single vs multiple choice).",
628
+ "type": "string"
629
+ },
630
+ "settings": {
631
+ "description": "JSONata expressions mapping QTI interaction properties to question settings",
632
+ "type": "object",
633
+ "propertyNames": {
634
+ "type": "string"
635
+ },
636
+ "additionalProperties": {
637
+ "anyOf": [
638
+ {
639
+ "type": "string"
640
+ },
641
+ {
642
+ "type": "number"
643
+ },
644
+ {
645
+ "type": "boolean"
646
+ },
647
+ {
648
+ "type": "array",
649
+ "items": {}
650
+ },
651
+ {
652
+ "type": "object",
653
+ "propertyNames": {
654
+ "type": "string"
655
+ },
656
+ "additionalProperties": {}
657
+ }
658
+ ],
659
+ "description": "Literal or JSONata expression string starting with '='"
660
+ }
661
+ }
662
+ },
663
+ "required": [
664
+ "interaction"
665
+ ],
666
+ "additionalProperties": false
667
+ }
668
+ },
669
+ "additionalProperties": false
670
+ },
580
671
  "metadata": {
581
672
  "description": "Optional metadata for the question type, only used by external applications",
582
673
  "type": "object",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@examplary/schemas",
3
3
  "packageManager": "yarn@4.8.1",
4
- "version": "1.14.0",
4
+ "version": "1.15.0",
5
5
  "description": "Schemas for the Examplary platform.",
6
6
  "scripts": {
7
7
  "build:schema": "tsx ./scripts/build.ts",