@examplary/schemas 1.13.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.
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ScalarSchema = void 0;
4
- var zod_1 = require("zod");
5
- exports.ScalarSchema = zod_1.z.union([
6
- zod_1.z.string(),
7
- zod_1.z.number(),
8
- zod_1.z.boolean(),
9
- zod_1.z.null(),
1
+ import { z } from "zod";
2
+ export const ScalarSchema = z.union([
3
+ z.string(),
4
+ z.number(),
5
+ z.boolean(),
6
+ z.null(),
10
7
  ]);
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Translatable = void 0;
4
- var zod_1 = require("zod");
1
+ import { z } from "zod";
5
2
  // Translatable type - can be a simple string or translation object
6
- exports.Translatable = zod_1.z.union([
7
- zod_1.z.string().describe("Simple string value"),
8
- zod_1.z
9
- .record(zod_1.z.string().regex(/^[a-z]{2}(-[A-Z]{2})?$/, "Language code format"), zod_1.z.string())
10
- .refine(function (obj) { return Object.keys(obj).length >= 1; }, "Translation object must have at least one property")
3
+ export const Translatable = z.union([
4
+ z.string().describe("Simple string value"),
5
+ z
6
+ .record(z.string().regex(/^[a-z]{2}(-[A-Z]{2})?$/, "Language code format"), z.string())
7
+ .refine((obj) => Object.keys(obj).length >= 1, "Translation object must have at least one property")
11
8
  .describe("Translation object with language codes as keys"),
12
9
  ]);
package/dist/index.js CHANGED
@@ -1,23 +1,7 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
1
  // Question types
18
- __exportStar(require("./question-type"), exports);
2
+ export * from "./question-type";
19
3
  // Questions
20
- __exportStar(require("./question"), exports);
4
+ export * from "./question";
21
5
  // Common
22
- __exportStar(require("./common/scalar"), exports);
23
- __exportStar(require("./common/translatable"), exports);
6
+ export * from "./common/scalar";
7
+ export * from "./common/translatable";
@@ -1,18 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./question"), exports);
18
- __exportStar(require("./question-scoring"), exports);
1
+ export * from "./question";
2
+ export * from "./question-scoring";
@@ -1,65 +1,62 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuestionScoringSchema = exports.RubricType = exports.TopLevelScoringCriterionSchema = exports.ScoringCriterionSchema = void 0;
4
- var zod_1 = require("zod");
5
- exports.ScoringCriterionSchema = zod_1.z.object({
6
- id: zod_1.z.string(),
7
- title: zod_1.z
1
+ import { z } from "zod";
2
+ export const ScoringCriterionSchema = z.object({
3
+ id: z.string(),
4
+ title: z
8
5
  .string()
9
6
  .nullish()
10
7
  .describe("The title of the scoring criterion or level. Only applies to analytical levels and holistic criteria."),
11
- description: zod_1.z
8
+ description: z
12
9
  .string()
13
10
  .nullish()
14
11
  .describe("The description of the scoring criterion or level. For analytical levels, this describes the specific requirements to earn the points for that level. For holistic criteria, this describes the overall requirement to earn the points for that criterion."),
15
- points: zod_1.z
12
+ points: z
16
13
  .number()
17
14
  .nullish()
18
15
  .describe("The default amount of points to assign if this criterion or level is selected."),
19
- minPoints: zod_1.z
16
+ minPoints: z
20
17
  .number()
21
18
  .nullish()
22
19
  .describe("The minimum amount of points that can be assigned if this criterion or level is selected."),
23
- maxPoints: zod_1.z
20
+ maxPoints: z
24
21
  .number()
25
22
  .nullish()
26
23
  .describe("The maximum amount of points that can be assigned if this criterion or level is selected."),
27
24
  });
28
- exports.TopLevelScoringCriterionSchema = exports.ScoringCriterionSchema.extend({
29
- levels: zod_1.z
30
- .array(exports.ScoringCriterionSchema)
25
+ export const TopLevelScoringCriterionSchema = ScoringCriterionSchema.extend({
26
+ levels: z
27
+ .array(ScoringCriterionSchema)
31
28
  .nullish()
32
29
  .describe("The levels of a analytical rubric criterion. Each level represents a different point value and description for the same criterion."),
33
30
  });
34
- var RubricType;
31
+ export var RubricType;
35
32
  (function (RubricType) {
36
33
  RubricType["Simple"] = "simple";
37
34
  RubricType["Analytical"] = "analytical";
38
35
  RubricType["Holistic"] = "holistic";
39
36
  RubricType["ExactValues"] = "exact-values";
40
- })(RubricType || (exports.RubricType = RubricType = {}));
41
- exports.QuestionScoringSchema = zod_1.z.object({
42
- rubricType: zod_1.z
37
+ })(RubricType || (RubricType = {}));
38
+ export const QuestionScoringSchema = z.object({
39
+ rubricType: z
43
40
  .enum(RubricType)
44
41
  .nullish()
45
42
  .describe("The type of rubric. Different rubric types have different shapes."),
46
- criteria: zod_1.z
47
- .array(exports.TopLevelScoringCriterionSchema)
43
+ criteria: z
44
+ .array(TopLevelScoringCriterionSchema)
48
45
  .nullish()
49
46
  .describe("The criteria for scoring the question. For 'simple' rubric type, criteria have no levels, and their points stack (total = sum of points for all criteria that apply). For 'analytical' rubric type, there should be at least one criteria, with levels. For each criteria, a matching level is picked. For 'holistic' rubric type, there should be multiple criteria, without levels (score = single selected criteria). For 'exact-values' rubric type, each criteria represents a specific value that must be matched exactly."),
50
- exactValuesCaseInsensitive: zod_1.z
47
+ exactValuesCaseInsensitive: z
51
48
  .boolean()
52
49
  .nullish()
53
50
  .describe("Whether exact values matching should be case insensitive. Only applicable for 'exact-values' rubric type."),
54
- guidance: zod_1.z
51
+ guidance: z
55
52
  .string()
56
53
  .nullish()
57
54
  .describe("Optional additional grading guidance text."),
58
- modelAnswer: zod_1.z
55
+ modelAnswer: z
59
56
  .string()
60
57
  .nullish()
61
58
  .describe("Optional example model answer text to show to graders."),
62
- templateId: zod_1.z
59
+ templateId: z
63
60
  .string()
64
61
  .nullish()
65
62
  .describe("The ID of the scoring template applied, if any."),
@@ -1,46 +1,43 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuestionSchema = void 0;
4
- var zod_1 = require("zod");
5
- var question_scoring_1 = require("./question-scoring");
6
- var scalar_1 = require("../common/scalar");
7
- exports.QuestionSchema = zod_1.z.looseObject({
8
- id: zod_1.z.string().describe("Question ID"),
9
- type: zod_1.z.string().describe("ID of the question type"),
10
- title: zod_1.z.string().nullish().describe("Title for the question (stem)"),
11
- description: zod_1.z
1
+ import { z } from "zod";
2
+ import { QuestionScoringSchema } from "./question-scoring";
3
+ import { ScalarSchema } from "../common/scalar";
4
+ export const QuestionSchema = z.looseObject({
5
+ id: z.string().describe("Question ID"),
6
+ type: z.string().describe("ID of the question type"),
7
+ title: z.string().nullish().describe("Title for the question (stem)"),
8
+ description: z
12
9
  .string()
13
10
  .nullish()
14
11
  .describe("Optional description for the question"),
15
- settings: zod_1.z
12
+ settings: z
16
13
  .looseObject({})
17
14
  .describe("Settings for the question, often specific to the question type"),
18
15
  // Scoring
19
- scoring: question_scoring_1.QuestionScoringSchema.nullish().describe("Scoring configuration for the question"),
16
+ scoring: QuestionScoringSchema.nullish().describe("Scoring configuration for the question"),
20
17
  // Tags and metadata
21
- tags: zod_1.z
22
- .array(zod_1.z.string())
18
+ tags: z
19
+ .array(z.string())
23
20
  .nullish()
24
21
  .describe("Tags associated with the question for categorization and search"),
25
- externalId: zod_1.z
22
+ externalId: z
26
23
  .string()
27
24
  .nullish()
28
25
  .describe("Optional external ID for the question, used to link to external systems"),
29
- metadata: zod_1.z
30
- .record(zod_1.z.string(), scalar_1.ScalarSchema)
26
+ metadata: z
27
+ .record(z.string(), ScalarSchema)
31
28
  .nullish()
32
29
  .describe("Metadata for the question"),
33
30
  // Internal tracking
34
- v: zod_1.z
31
+ v: z
35
32
  .number()
36
33
  .nullish()
37
34
  .describe("Version number, incremented when question is edited"),
38
- questionBankItemId: zod_1.z
35
+ questionBankItemId: z
39
36
  .string()
40
37
  .nullish()
41
38
  .describe("ID of the question in the question bank"),
42
- traceIds: zod_1.z
43
- .array(zod_1.z.string())
39
+ traceIds: z
40
+ .array(z.string())
44
41
  .nullish()
45
42
  .describe("Trace IDs for internal tracking of AI generation processes"),
46
43
  });
@@ -1,24 +1,8 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./question-type"), exports);
18
- __exportStar(require("./question-type-setting"), exports);
19
- __exportStar(require("./question-type-components"), exports);
20
- __exportStar(require("./question-type-generation-options"), exports);
21
- __exportStar(require("./question-type-grading-options"), exports);
22
- __exportStar(require("./question-type-scanning-options"), exports);
23
- __exportStar(require("./question-type-capabilities"), exports);
24
- __exportStar(require("./question-type-qti3"), exports);
1
+ export * from "./question-type";
2
+ export * from "./question-type-setting";
3
+ export * from "./question-type-components";
4
+ export * from "./question-type-generation-options";
5
+ export * from "./question-type-grading-options";
6
+ export * from "./question-type-scanning-options";
7
+ export * from "./question-type-capabilities";
8
+ export * from "./question-type-qti3";
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuestionTypeCapabilitiesSchema = void 0;
4
- var zod_1 = require("zod");
5
- exports.QuestionTypeCapabilitiesSchema = zod_1.z.looseObject({
6
- "answer-scanning": zod_1.z
1
+ import { z } from "zod";
2
+ export const QuestionTypeCapabilitiesSchema = z.looseObject({
3
+ "answer-scanning": z
7
4
  .boolean()
8
5
  .optional()
9
6
  .describe("Whether this question type allows the student to scan an answer using their phone. Only supported for practice spaces."),
@@ -1,20 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuestionTypeComponents = exports.ComponentReference = exports.PathOrUrlReference = void 0;
4
- var zod_1 = require("zod");
1
+ import { z } from "zod";
5
2
  // Path or URL reference type
6
- exports.PathOrUrlReference = zod_1.z
3
+ export const PathOrUrlReference = z
7
4
  .string()
8
5
  .regex(/^(https?:\/\/|\.)([a-zA-Z0-9._~:/?#@!$&'()*+,;=%-]+)$/, "Valid path or URL format");
9
6
  // Component reference type
10
- exports.ComponentReference = exports.PathOrUrlReference.describe("Reference to a component, typically a file path or URL");
7
+ export const ComponentReference = PathOrUrlReference.describe("Reference to a component, typically a file path or URL");
11
8
  // Components configuration
12
- exports.QuestionTypeComponents = zod_1.z
9
+ export const QuestionTypeComponents = z
13
10
  .object({
14
- assessment: exports.ComponentReference.optional().describe("Path to the assessment component (question content)"),
15
- print: exports.ComponentReference.optional().describe("Path to the print component (for printing the question)"),
16
- "settings-area": exports.ComponentReference.optional().describe("Path to the settings area component (for configuring question settings)"),
17
- results: exports.ComponentReference.optional().describe("Path to the results component (for displaying answers)"),
11
+ assessment: ComponentReference.optional().describe("Path to the assessment component (question content)"),
12
+ print: ComponentReference.optional().describe("Path to the print component (for printing the question)"),
13
+ "settings-area": ComponentReference.optional().describe("Path to the settings area component (for configuring question settings)"),
14
+ results: ComponentReference.optional().describe("Path to the results component (for displaying answers)"),
18
15
  })
19
16
  .strict()
20
17
  .describe("Paths to the components used by this question type");
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuestionTypeGenerationOptions = void 0;
4
- var zod_1 = require("zod");
5
- exports.QuestionTypeGenerationOptions = zod_1.z
1
+ import { z } from "zod";
2
+ export const QuestionTypeGenerationOptions = z
6
3
  .object({
7
- enabled: zod_1.z
4
+ enabled: z
8
5
  .boolean()
9
6
  .describe("Whether this question type can be automatically generated using AI (default to false)"),
10
- instructions: zod_1.z
7
+ instructions: z
11
8
  .string()
12
- .or(zod_1.z.array(zod_1.z.string()))
9
+ .or(z.array(z.string()))
13
10
  .optional()
14
11
  .describe("Optional instructions to guide AI in generating this question type"),
15
12
  })
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuestionTypeGradingOptions = void 0;
4
- var zod_1 = require("zod");
5
- exports.QuestionTypeGradingOptions = zod_1.z
1
+ import { z } from "zod";
2
+ export const QuestionTypeGradingOptions = z
6
3
  .object({
7
- enabled: zod_1.z
4
+ enabled: z
8
5
  .boolean()
9
6
  .describe("Whether this question type can be automatically graded using AI (default to false)"),
10
- instructions: zod_1.z
7
+ instructions: z
11
8
  .string()
12
- .or(zod_1.z.array(zod_1.z.string()))
9
+ .or(z.array(z.string()))
13
10
  .optional()
14
11
  .describe("Optional instructions to guide AI in grading this question type"),
15
12
  })
@@ -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>;
@@ -1,18 +1,21 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Qti3Mapping = exports.QtiInteractionType = void 0;
4
- var zod_1 = require("zod");
1
+ import { z } from "zod";
5
2
  /**
6
3
  * A value that can either be a literal or a JSONata expression string.
7
4
  * JSONata expressions are evaluated at transform time against the question context.
8
5
  */
9
- var JsonataExpr = zod_1.z
10
- .union([zod_1.z.string(), zod_1.z.number(), zod_1.z.boolean(), zod_1.z.array(zod_1.z.any()), zod_1.z.object({})])
6
+ const JsonataExpr = z
7
+ .union([
8
+ z.string(),
9
+ z.number(),
10
+ z.boolean(),
11
+ z.array(z.any()),
12
+ z.record(z.string(), z.any()),
13
+ ])
11
14
  .describe("Literal or JSONata expression string starting with '='");
12
15
  /**
13
16
  * Supported QTI 3.0 interaction types
14
17
  */
15
- exports.QtiInteractionType = zod_1.z.enum([
18
+ export const QtiInteractionType = z.enum([
16
19
  "AssociateInteraction",
17
20
  "ChoiceInteraction",
18
21
  "DrawingInteraction",
@@ -38,11 +41,36 @@ exports.QtiInteractionType = zod_1.z.enum([
38
41
  /**
39
42
  * Complete QTI mapping configuration for a question type
40
43
  */
41
- exports.Qti3Mapping = zod_1.z
44
+ export const Qti3Mapping = z
42
45
  .object({
43
- interaction: zod_1.z.object({
44
- type: exports.QtiInteractionType.describe("The QTI interaction type to generate"),
45
- options: zod_1.z.record(zod_1.z.string(), JsonataExpr).optional(),
46
+ interaction: z.object({
47
+ type: QtiInteractionType.describe("The QTI interaction type to generate"),
48
+ options: z.record(z.string(), JsonataExpr).optional(),
46
49
  }),
47
50
  })
48
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");
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuestionTypeScanningOptions = void 0;
4
- var zod_1 = require("zod");
5
- exports.QuestionTypeScanningOptions = zod_1.z
1
+ import { z } from "zod";
2
+ export const QuestionTypeScanningOptions = z
6
3
  .object({
7
- instructions: zod_1.z
4
+ instructions: z
8
5
  .string()
9
- .or(zod_1.z.array(zod_1.z.string()))
6
+ .or(z.array(z.string()))
10
7
  .optional()
11
8
  .describe("Optional instructions to guide AI in converting answers for this question type when scanning documents"),
12
9
  })
@@ -1,27 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuestionTypeSetting = exports.QuestionTypeSettingOption = void 0;
4
- var zod_1 = require("zod");
5
- var translatable_1 = require("../common/translatable");
1
+ import { z } from "zod";
2
+ import { Translatable } from "../common/translatable";
6
3
  // Setting option for enum type settings
7
- exports.QuestionTypeSettingOption = zod_1.z
4
+ export const QuestionTypeSettingOption = z
8
5
  .object({
9
- value: zod_1.z.string().describe("Option value"),
10
- label: translatable_1.Translatable.describe("Option label"),
6
+ value: z.string().describe("Option value"),
7
+ label: Translatable.describe("Option label"),
11
8
  })
12
9
  .strict()
13
10
  .describe("Setting option");
14
11
  // Setting configuration
15
- exports.QuestionTypeSetting = zod_1.z
12
+ export const QuestionTypeSetting = z
16
13
  .object({
17
- id: zod_1.z.string().describe("Unique identifier for the setting"),
18
- name: translatable_1.Translatable.describe("Display name for the setting"),
19
- helpText: translatable_1.Translatable.optional().describe("Help text for the setting"),
20
- description: zod_1.z
14
+ id: z.string().describe("Unique identifier for the setting"),
15
+ name: Translatable.describe("Display name for the setting"),
16
+ helpText: Translatable.optional().describe("Help text for the setting"),
17
+ description: z
21
18
  .string()
22
19
  .optional()
23
20
  .describe("Description to help AI agents auto-generate question settings"),
24
- type: zod_1.z
21
+ type: z
25
22
  .enum([
26
23
  "enum",
27
24
  "string",
@@ -34,27 +31,27 @@ exports.QuestionTypeSetting = zod_1.z
34
31
  "question-type",
35
32
  ])
36
33
  .describe("Type of the setting"),
37
- index: zod_1.z.number().optional(),
38
- hidden: zod_1.z
34
+ index: z.number().optional(),
35
+ hidden: z
39
36
  .boolean()
40
37
  .optional()
41
38
  .describe("Whether the setting is hidden from the user"),
42
- default: zod_1.z.any().nullish().describe("Default value for the setting"),
43
- required: zod_1.z
39
+ default: z.any().nullish().describe("Default value for the setting"),
40
+ required: z
44
41
  .boolean()
45
42
  .optional()
46
43
  .describe("Whether this setting is required"),
47
- options: zod_1.z
48
- .array(exports.QuestionTypeSettingOption)
44
+ options: z
45
+ .array(QuestionTypeSettingOption)
49
46
  .optional()
50
47
  .describe("Available options for enum type settings"),
51
- placeholder: translatable_1.Translatable.nullish().describe("Placeholder text for the setting"),
52
- step: zod_1.z.number().optional().describe("Step value for number type settings"),
53
- min: zod_1.z
48
+ placeholder: Translatable.nullish().describe("Placeholder text for the setting"),
49
+ step: z.number().optional().describe("Step value for number type settings"),
50
+ min: z
54
51
  .number()
55
52
  .optional()
56
53
  .describe("Minimum value for number type settings"),
57
- max: zod_1.z
54
+ max: z
58
55
  .number()
59
56
  .optional()
60
57
  .describe("Maximum value for number type settings"),
@@ -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>;
@@ -1,94 +1,97 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuestionTypeSchema = void 0;
4
- var zod_1 = require("zod");
5
- var question_type_capabilities_1 = require("./question-type-capabilities");
6
- var question_type_components_1 = require("./question-type-components");
7
- var question_type_generation_options_1 = require("./question-type-generation-options");
8
- var question_type_grading_options_1 = require("./question-type-grading-options");
9
- var question_type_qti3_1 = require("./question-type-qti3");
10
- var question_type_scanning_options_1 = require("./question-type-scanning-options");
11
- var question_type_setting_1 = require("./question-type-setting");
12
- var scalar_1 = require("../common/scalar");
13
- var translatable_1 = require("../common/translatable");
14
- exports.QuestionTypeSchema = zod_1.z
1
+ import { z } from "zod";
2
+ import { QuestionTypeCapabilitiesSchema } from "./question-type-capabilities";
3
+ import { PathOrUrlReference, QuestionTypeComponents, } from "./question-type-components";
4
+ import { QuestionTypeGenerationOptions } from "./question-type-generation-options";
5
+ import { QuestionTypeGradingOptions } from "./question-type-grading-options";
6
+ import { Qti3ImportMapping, Qti3Mapping } from "./question-type-qti3";
7
+ import { QuestionTypeScanningOptions } from "./question-type-scanning-options";
8
+ import { QuestionTypeSetting } from "./question-type-setting";
9
+ import { ScalarSchema } from "../common/scalar";
10
+ import { Translatable } from "../common/translatable";
11
+ export const QuestionTypeSchema = z
15
12
  .object({
16
- $schema: zod_1.z.string().optional(),
17
- id: zod_1.z
13
+ $schema: z.string().optional(),
14
+ id: z
18
15
  .string()
19
16
  .regex(/^([a-z][a-z0-9-]*)(\.[a-z][a-z0-9-]*)+$/, "Valid question type ID format")
20
17
  .describe("Unique identifier for the question type (e.g. 'my-org.color-picker')"),
21
- name: translatable_1.Translatable.describe("Display name for the question type, can be a simple string or translation object"),
22
- description: translatable_1.Translatable.describe("Description of the question type, can be a simple string or translation object"),
23
- icon: question_type_components_1.PathOrUrlReference.optional().describe("Path to the icon for this question type"),
24
- shortcut: zod_1.z
18
+ name: Translatable.describe("Display name for the question type, can be a simple string or translation object"),
19
+ description: Translatable.describe("Description of the question type, can be a simple string or translation object"),
20
+ icon: PathOrUrlReference.optional().describe("Path to the icon for this question type"),
21
+ shortcut: z
25
22
  .string()
26
23
  .max(1)
27
24
  .optional()
28
25
  .describe("Keyboard shortcut for quick access to this question type"),
29
- generation: question_type_generation_options_1.QuestionTypeGenerationOptions.optional(),
30
- grading: question_type_grading_options_1.QuestionTypeGradingOptions.optional(),
31
- scanning: question_type_scanning_options_1.QuestionTypeScanningOptions.optional(),
32
- timeEstimateMinutes: zod_1.z
26
+ generation: QuestionTypeGenerationOptions.optional(),
27
+ grading: QuestionTypeGradingOptions.optional(),
28
+ scanning: QuestionTypeScanningOptions.optional(),
29
+ timeEstimateMinutes: z
33
30
  .number()
34
31
  .min(1)
35
32
  .optional()
36
33
  .describe("Estimated time in minutes to complete this question type"),
37
- isAi: zod_1.z
34
+ isAi: z
38
35
  .boolean()
39
36
  .optional()
40
37
  .describe("Whether this question type uses AI functionality"),
41
- backgroundColor: zod_1.z
38
+ backgroundColor: z
42
39
  .string()
43
40
  .optional()
44
41
  .describe("Background color for the question type"),
45
- enforcePosition: zod_1.z
42
+ enforcePosition: z
46
43
  .enum(["start", "end"])
47
44
  .optional()
48
45
  .describe("Position enforcement for this question type"),
49
- enforceTitle: translatable_1.Translatable.optional().describe("Enforced title for this question type"),
50
- hideSettings: zod_1.z
46
+ enforceTitle: Translatable.optional().describe("Enforced title for this question type"),
47
+ hideSettings: z
51
48
  .boolean()
52
49
  .optional()
53
50
  .describe("Whether to hide settings for this question type"),
54
- isPreviewRefreshable: zod_1.z
51
+ isPreviewRefreshable: z
55
52
  .boolean()
56
53
  .optional()
57
54
  .describe("Whether the preview can be refreshed for this question type"),
58
- hasSimpleScoring: zod_1.z
55
+ hasSimpleScoring: z
59
56
  .boolean()
60
57
  .optional()
61
58
  .describe("Whether this question type has simple scoring"),
62
- titlePlaceholder: translatable_1.Translatable.optional().describe("Placeholder text for the title field"),
63
- descriptionPlaceholder: translatable_1.Translatable.optional().describe("Placeholder text for the description field"),
64
- untitledPlaceholder: translatable_1.Translatable.optional().describe("Placeholder text for untitled questions"),
65
- components: question_type_components_1.QuestionTypeComponents.optional().describe("Paths to the components used by this question type"),
66
- settings: zod_1.z
67
- .array(question_type_setting_1.QuestionTypeSetting)
59
+ titlePlaceholder: Translatable.optional().describe("Placeholder text for the title field"),
60
+ descriptionPlaceholder: Translatable.optional().describe("Placeholder text for the description field"),
61
+ untitledPlaceholder: Translatable.optional().describe("Placeholder text for untitled questions"),
62
+ components: QuestionTypeComponents.optional().describe("Paths to the components used by this question type"),
63
+ settings: z
64
+ .array(QuestionTypeSetting)
68
65
  .optional()
69
66
  .describe("Configuration settings for the question type"),
70
- public: zod_1.z
67
+ public: z
71
68
  .boolean()
72
69
  .optional()
73
70
  .describe("Whether this question type is public and can be used by all users"),
74
- translations: zod_1.z
75
- .record(zod_1.z.string(), translatable_1.Translatable)
71
+ translations: z
72
+ .record(z.string(), Translatable)
76
73
  .optional()
77
74
  .describe("Custom translations for this question type"),
78
- capabilities: question_type_capabilities_1.QuestionTypeCapabilitiesSchema.optional().describe("Capabilities of the question type for various operations"),
79
- export: zod_1.z
75
+ capabilities: QuestionTypeCapabilitiesSchema.optional().describe("Capabilities of the question type for various operations"),
76
+ export: z
80
77
  .object({
81
- qti3: question_type_qti3_1.Qti3Mapping.optional().describe("QTI 3.0 mapping configuration for transforming questions to QTI format"),
78
+ qti3: Qti3Mapping.optional().describe("QTI 3.0 mapping configuration for transforming questions to QTI format"),
82
79
  })
83
80
  .optional()
84
81
  .describe("Export configuration for various formats"),
85
- metadata: zod_1.z
86
- .record(zod_1.z.string(), scalar_1.ScalarSchema)
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"),
88
+ metadata: z
89
+ .record(z.string(), ScalarSchema)
87
90
  .optional()
88
91
  .describe("Optional metadata for the question type, only used by external applications"),
89
- stylesheet: zod_1.z.url().optional(),
90
- index: zod_1.z.number().optional(),
91
- isDefault: zod_1.z.boolean().optional(),
92
+ stylesheet: z.url().optional(),
93
+ index: z.number().optional(),
94
+ isDefault: z.boolean().optional(),
92
95
  })
93
96
  .strict()
94
97
  .describe("Schema for defining question types in the Examplary system");
@@ -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.13.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",
@@ -20,15 +20,15 @@
20
20
  "main": "./dist/index.js",
21
21
  "types": "./dist/index.d.ts",
22
22
  "devDependencies": {
23
- "serverless": "^4.33.0",
23
+ "serverless": "^4.34.0",
24
24
  "serverless-lift": "^1.34.1",
25
25
  "tsx": "^4.20.6",
26
- "typescript": "^5.9.3"
26
+ "typescript": "^6.0.3"
27
27
  },
28
28
  "dependencies": {
29
29
  "zod": "^4.3.6"
30
30
  },
31
- "homepage": "https://developers.examplary.ai/",
31
+ "homepage": "https://examplary.ai/developers",
32
32
  "author": {
33
33
  "name": "Examplary AI",
34
34
  "email": "hi@examplary.ai"