@examplary/schemas 1.3.0 → 1.5.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.
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export declare const QuestionTypeGenerationOptions: z.ZodObject<{
3
+ enabled: z.ZodBoolean;
4
+ instructions: z.ZodOptional<z.ZodString>;
5
+ }, z.core.$strip>;
6
+ export type QuestionTypeGenerationOptionsType = z.infer<typeof QuestionTypeGenerationOptions>;
@@ -0,0 +1,15 @@
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
6
+ .object({
7
+ enabled: zod_1.z
8
+ .boolean()
9
+ .describe("Whether this question type can be automatically generated using AI (default to false)"),
10
+ instructions: zod_1.z
11
+ .string()
12
+ .optional()
13
+ .describe("Optional instructions to guide AI in generating this question type"),
14
+ })
15
+ .describe("Options for AI question generation");
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export declare const QuestionTypeGradingOptions: z.ZodObject<{
3
+ enabled: z.ZodBoolean;
4
+ instructions: z.ZodOptional<z.ZodString>;
5
+ }, z.core.$strip>;
6
+ export type QuestionTypeGradingOptionsType = z.infer<typeof QuestionTypeGradingOptions>;
@@ -0,0 +1,15 @@
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
6
+ .object({
7
+ enabled: zod_1.z
8
+ .boolean()
9
+ .describe("Whether this question type can be automatically graded using AI (default to false)"),
10
+ instructions: zod_1.z
11
+ .string()
12
+ .optional()
13
+ .describe("Optional instructions to guide AI in grading this question type"),
14
+ })
15
+ .describe("Options for AI question grading");
@@ -0,0 +1,35 @@
1
+ import { z } from "zod";
2
+ export declare const QuestionTypeSettingOption: z.ZodObject<{
3
+ value: z.ZodString;
4
+ label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
5
+ }, z.core.$strict>;
6
+ export declare const QuestionTypeSetting: z.ZodObject<{
7
+ id: z.ZodString;
8
+ name: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
9
+ description: z.ZodOptional<z.ZodString>;
10
+ type: z.ZodEnum<{
11
+ string: "string";
12
+ number: "number";
13
+ boolean: "boolean";
14
+ enum: "enum";
15
+ custom: "custom";
16
+ "string-array": "string-array";
17
+ "scoring-criteria": "scoring-criteria";
18
+ tags: "tags";
19
+ "question-type": "question-type";
20
+ }>;
21
+ index: z.ZodOptional<z.ZodNumber>;
22
+ hidden: z.ZodOptional<z.ZodBoolean>;
23
+ default: z.ZodOptional<z.ZodAny>;
24
+ required: z.ZodOptional<z.ZodBoolean>;
25
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
26
+ value: z.ZodString;
27
+ label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
28
+ }, z.core.$strict>>>;
29
+ placeholder: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
30
+ step: z.ZodOptional<z.ZodNumber>;
31
+ min: z.ZodOptional<z.ZodNumber>;
32
+ max: z.ZodOptional<z.ZodNumber>;
33
+ }, z.core.$strict>;
34
+ export type SettingType = z.infer<typeof QuestionTypeSetting>;
35
+ export type SettingOptionType = z.infer<typeof QuestionTypeSettingOption>;
@@ -0,0 +1,62 @@
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("./translatable");
6
+ // Setting option for enum type settings
7
+ exports.QuestionTypeSettingOption = zod_1.z
8
+ .object({
9
+ value: zod_1.z.string().describe("Option value"),
10
+ label: translatable_1.Translatable.describe("Option label"),
11
+ })
12
+ .strict()
13
+ .describe("Setting option");
14
+ // Setting configuration
15
+ exports.QuestionTypeSetting = zod_1.z
16
+ .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
+ description: zod_1.z
20
+ .string()
21
+ .optional()
22
+ .describe("Description to help AI agents auto-generate question settings"),
23
+ type: zod_1.z
24
+ .enum([
25
+ "enum",
26
+ "string",
27
+ "string-array",
28
+ "number",
29
+ "boolean",
30
+ "custom",
31
+ "scoring-criteria",
32
+ "tags",
33
+ "question-type",
34
+ ])
35
+ .describe("Type of the setting"),
36
+ index: zod_1.z.number().optional(),
37
+ hidden: zod_1.z
38
+ .boolean()
39
+ .optional()
40
+ .describe("Whether the setting is hidden from the user"),
41
+ default: zod_1.z.any().optional().describe("Default value for the setting"),
42
+ required: zod_1.z
43
+ .boolean()
44
+ .optional()
45
+ .describe("Whether this setting is required"),
46
+ options: zod_1.z
47
+ .array(exports.QuestionTypeSettingOption)
48
+ .optional()
49
+ .describe("Available options for enum type settings"),
50
+ placeholder: translatable_1.Translatable.optional().describe("Placeholder text for the setting"),
51
+ step: zod_1.z.number().optional().describe("Step value for number type settings"),
52
+ min: zod_1.z
53
+ .number()
54
+ .optional()
55
+ .describe("Minimum value for number type settings"),
56
+ max: zod_1.z
57
+ .number()
58
+ .optional()
59
+ .describe("Maximum value for number type settings"),
60
+ })
61
+ .strict()
62
+ .describe("Setting configuration");
@@ -1,39 +1,4 @@
1
1
  import { z } from "zod";
2
- declare const Translatable: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
3
- declare const ComponentReference: z.ZodString;
4
- declare const SettingOption: z.ZodObject<{
5
- value: z.ZodString;
6
- label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
7
- }, z.core.$strict>;
8
- declare const Setting: z.ZodObject<{
9
- id: z.ZodString;
10
- name: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
11
- type: z.ZodEnum<{
12
- string: "string";
13
- number: "number";
14
- boolean: "boolean";
15
- enum: "enum";
16
- custom: "custom";
17
- "scoring-criteria": "scoring-criteria";
18
- "question-type": "question-type";
19
- }>;
20
- default: z.ZodOptional<z.ZodAny>;
21
- required: z.ZodOptional<z.ZodBoolean>;
22
- options: z.ZodOptional<z.ZodArray<z.ZodObject<{
23
- value: z.ZodString;
24
- label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
25
- }, z.core.$strict>>>;
26
- placeholder: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
27
- step: z.ZodOptional<z.ZodNumber>;
28
- min: z.ZodOptional<z.ZodNumber>;
29
- max: z.ZodOptional<z.ZodNumber>;
30
- }, z.core.$strict>;
31
- declare const Components: z.ZodObject<{
32
- assessment: z.ZodOptional<z.ZodString>;
33
- print: z.ZodOptional<z.ZodString>;
34
- "settings-area": z.ZodOptional<z.ZodString>;
35
- results: z.ZodOptional<z.ZodString>;
36
- }, z.core.$strict>;
37
2
  export declare const QuestionTypeSchema: z.ZodObject<{
38
3
  $schema: z.ZodOptional<z.ZodString>;
39
4
  id: z.ZodString;
@@ -41,7 +6,14 @@ export declare const QuestionTypeSchema: z.ZodObject<{
41
6
  description: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
42
7
  icon: z.ZodOptional<z.ZodString>;
43
8
  shortcut: z.ZodOptional<z.ZodString>;
44
- canAutoGenerate: z.ZodOptional<z.ZodBoolean>;
9
+ generation: z.ZodOptional<z.ZodObject<{
10
+ enabled: z.ZodBoolean;
11
+ instructions: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>>;
13
+ grading: z.ZodOptional<z.ZodObject<{
14
+ enabled: z.ZodBoolean;
15
+ instructions: z.ZodOptional<z.ZodString>;
16
+ }, z.core.$strip>>;
45
17
  timeEstimateMinutes: z.ZodOptional<z.ZodNumber>;
46
18
  isAi: z.ZodOptional<z.ZodBoolean>;
47
19
  backgroundColor: z.ZodOptional<z.ZodString>;
@@ -66,15 +38,20 @@ export declare const QuestionTypeSchema: z.ZodObject<{
66
38
  settings: z.ZodOptional<z.ZodArray<z.ZodObject<{
67
39
  id: z.ZodString;
68
40
  name: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
41
+ description: z.ZodOptional<z.ZodString>;
69
42
  type: z.ZodEnum<{
70
43
  string: "string";
71
44
  number: "number";
72
45
  boolean: "boolean";
73
46
  enum: "enum";
74
47
  custom: "custom";
48
+ "string-array": "string-array";
75
49
  "scoring-criteria": "scoring-criteria";
50
+ tags: "tags";
76
51
  "question-type": "question-type";
77
52
  }>;
53
+ index: z.ZodOptional<z.ZodNumber>;
54
+ hidden: z.ZodOptional<z.ZodBoolean>;
78
55
  default: z.ZodOptional<z.ZodAny>;
79
56
  required: z.ZodOptional<z.ZodBoolean>;
80
57
  options: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -92,9 +69,3 @@ export declare const QuestionTypeSchema: z.ZodObject<{
92
69
  index: z.ZodOptional<z.ZodNumber>;
93
70
  }, z.core.$strict>;
94
71
  export type QuestionType = z.infer<typeof QuestionTypeSchema>;
95
- export type TranslatableType = z.infer<typeof Translatable>;
96
- export type ComponentReferenceType = z.infer<typeof ComponentReference>;
97
- export type SettingType = z.infer<typeof Setting>;
98
- export type SettingOptionType = z.infer<typeof SettingOption>;
99
- export type ComponentsType = z.infer<typeof Components>;
100
- export {};
@@ -2,77 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.QuestionTypeSchema = void 0;
4
4
  var zod_1 = require("zod");
5
- // Translatable type - can be a simple string or translation object
6
- var 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")
11
- .describe("Translation object with language codes as keys"),
12
- ]);
13
- // Path or URL reference type
14
- var PathOrUrlReference = zod_1.z
15
- .string()
16
- .regex(/^(https?:\/\/|\.)([a-zA-Z0-9._~:/?#@!$&'()*+,;=%-]+)$/, "Valid path or URL format");
17
- // Component reference type
18
- var ComponentReference = PathOrUrlReference.describe("Reference to a component, typically a file path or URL");
19
- // Setting option for enum type settings
20
- var SettingOption = zod_1.z
21
- .object({
22
- value: zod_1.z.string().describe("Option value"),
23
- label: Translatable.describe("Option label"),
24
- })
25
- .strict()
26
- .describe("Setting option");
27
- // Setting configuration
28
- var Setting = zod_1.z
29
- .object({
30
- id: zod_1.z.string().describe("Unique identifier for the setting"),
31
- name: Translatable.describe("Display name for the setting"),
32
- type: zod_1.z
33
- .enum([
34
- "enum",
35
- "string",
36
- "number",
37
- "boolean",
38
- "custom",
39
- "scoring-criteria",
40
- "question-type",
41
- ])
42
- .describe("Type of the setting"),
43
- default: zod_1.z.any().optional().describe("Default value for the setting"),
44
- required: zod_1.z
45
- .boolean()
46
- .optional()
47
- .describe("Whether this setting is required"),
48
- options: zod_1.z
49
- .array(SettingOption)
50
- .optional()
51
- .describe("Available options for enum type settings"),
52
- placeholder: Translatable.optional().describe("Placeholder text for the setting"),
53
- step: zod_1.z.number().optional().describe("Step value for number type settings"),
54
- min: zod_1.z
55
- .number()
56
- .optional()
57
- .describe("Minimum value for number type settings"),
58
- max: zod_1.z
59
- .number()
60
- .optional()
61
- .describe("Maximum value for number type settings"),
62
- })
63
- .strict()
64
- .describe("Setting configuration");
65
- // Components configuration
66
- var Components = zod_1.z
67
- .object({
68
- assessment: ComponentReference.optional().describe("Path to the assessment component (question content)"),
69
- print: ComponentReference.optional().describe("Path to the print component (for printing the question)"),
70
- "settings-area": ComponentReference.optional().describe("Path to the settings area component (for configuring question settings)"),
71
- results: ComponentReference.optional().describe("Path to the results component (for displaying answers)"),
72
- })
73
- .strict()
74
- .describe("Paths to the components used by this question type");
75
- // Main question type schema
5
+ var question_type_components_1 = require("./question-type-components");
6
+ var question_type_generation_options_1 = require("./question-type-generation-options");
7
+ var question_type_grading_options_1 = require("./question-type-grading-options");
8
+ var question_type_setting_1 = require("./question-type-setting");
9
+ var translatable_1 = require("./translatable");
76
10
  exports.QuestionTypeSchema = zod_1.z
77
11
  .object({
78
12
  $schema: zod_1.z.string().optional(),
@@ -80,18 +14,16 @@ exports.QuestionTypeSchema = zod_1.z
80
14
  .string()
81
15
  .regex(/^([a-z][a-z0-9-]*)(\.[a-z][a-z0-9-]*)+$/, "Valid question type ID format")
82
16
  .describe("Unique identifier for the question type (e.g. 'my-org.color-picker')"),
83
- name: Translatable.describe("Display name for the question type, can be a simple string or translation object"),
84
- description: Translatable.describe("Description of the question type, can be a simple string or translation object"),
85
- icon: PathOrUrlReference.optional().describe("Path to the icon for this question type"),
17
+ name: translatable_1.Translatable.describe("Display name for the question type, can be a simple string or translation object"),
18
+ description: translatable_1.Translatable.describe("Description of the question type, can be a simple string or translation object"),
19
+ icon: question_type_components_1.PathOrUrlReference.optional().describe("Path to the icon for this question type"),
86
20
  shortcut: zod_1.z
87
21
  .string()
88
22
  .max(1)
89
23
  .optional()
90
24
  .describe("Keyboard shortcut for quick access to this question type"),
91
- canAutoGenerate: zod_1.z
92
- .boolean()
93
- .optional()
94
- .describe("Whether this question type can be automatically generated"),
25
+ generation: question_type_generation_options_1.QuestionTypeGenerationOptions.optional(),
26
+ grading: question_type_grading_options_1.QuestionTypeGradingOptions.optional(),
95
27
  timeEstimateMinutes: zod_1.z
96
28
  .number()
97
29
  .min(1)
@@ -113,7 +45,7 @@ exports.QuestionTypeSchema = zod_1.z
113
45
  .enum(["start", "end"])
114
46
  .optional()
115
47
  .describe("Position enforcement for this question type"),
116
- enforceTitle: Translatable.optional().describe("Enforced title for this question type"),
48
+ enforceTitle: translatable_1.Translatable.optional().describe("Enforced title for this question type"),
117
49
  hideSettings: zod_1.z
118
50
  .boolean()
119
51
  .optional()
@@ -126,12 +58,12 @@ exports.QuestionTypeSchema = zod_1.z
126
58
  .boolean()
127
59
  .optional()
128
60
  .describe("Whether this question type has simple scoring"),
129
- titlePlaceholder: Translatable.optional().describe("Placeholder text for the title field"),
130
- descriptionPlaceholder: Translatable.optional().describe("Placeholder text for the description field"),
131
- untitledPlaceholder: Translatable.optional().describe("Placeholder text for untitled questions"),
132
- components: Components.optional().describe("Paths to the components used by this question type"),
61
+ titlePlaceholder: translatable_1.Translatable.optional().describe("Placeholder text for the title field"),
62
+ descriptionPlaceholder: translatable_1.Translatable.optional().describe("Placeholder text for the description field"),
63
+ untitledPlaceholder: translatable_1.Translatable.optional().describe("Placeholder text for untitled questions"),
64
+ components: question_type_components_1.QuestionTypeComponents.optional().describe("Paths to the components used by this question type"),
133
65
  settings: zod_1.z
134
- .array(Setting)
66
+ .array(question_type_setting_1.QuestionTypeSetting)
135
67
  .optional()
136
68
  .describe("Configuration settings for the question type"),
137
69
  public: zod_1.z
@@ -139,7 +71,7 @@ exports.QuestionTypeSchema = zod_1.z
139
71
  .optional()
140
72
  .describe("Whether this question type is public and can be used by all users"),
141
73
  translations: zod_1.z
142
- .record(zod_1.z.string(), Translatable)
74
+ .record(zod_1.z.string(), translatable_1.Translatable)
143
75
  .optional()
144
76
  .describe("Custom translations for this question type"),
145
77
  stylesheet: zod_1.z.url().optional(),
@@ -61,9 +61,41 @@
61
61
  "type": "string",
62
62
  "maxLength": 1
63
63
  },
64
- "canAutoGenerate": {
65
- "description": "Whether this question type can be automatically generated",
66
- "type": "boolean"
64
+ "generation": {
65
+ "description": "Options for AI question generation",
66
+ "type": "object",
67
+ "properties": {
68
+ "enabled": {
69
+ "description": "Whether this question type can be automatically generated using AI (default to false)",
70
+ "type": "boolean"
71
+ },
72
+ "instructions": {
73
+ "description": "Optional instructions to guide AI in generating this question type",
74
+ "type": "string"
75
+ }
76
+ },
77
+ "required": [
78
+ "enabled"
79
+ ],
80
+ "additionalProperties": false
81
+ },
82
+ "grading": {
83
+ "description": "Options for AI question grading",
84
+ "type": "object",
85
+ "properties": {
86
+ "enabled": {
87
+ "description": "Whether this question type can be automatically graded using AI (default to false)",
88
+ "type": "boolean"
89
+ },
90
+ "instructions": {
91
+ "description": "Optional instructions to guide AI in grading this question type",
92
+ "type": "string"
93
+ }
94
+ },
95
+ "required": [
96
+ "enabled"
97
+ ],
98
+ "additionalProperties": false
67
99
  },
68
100
  "timeEstimateMinutes": {
69
101
  "description": "Estimated time in minutes to complete this question type",
@@ -240,19 +272,32 @@
240
272
  }
241
273
  ]
242
274
  },
275
+ "description": {
276
+ "description": "Description to help AI agents auto-generate question settings",
277
+ "type": "string"
278
+ },
243
279
  "type": {
244
280
  "description": "Type of the setting",
245
281
  "type": "string",
246
282
  "enum": [
247
283
  "enum",
248
284
  "string",
285
+ "string-array",
249
286
  "number",
250
287
  "boolean",
251
288
  "custom",
252
289
  "scoring-criteria",
290
+ "tags",
253
291
  "question-type"
254
292
  ]
255
293
  },
294
+ "index": {
295
+ "type": "number"
296
+ },
297
+ "hidden": {
298
+ "description": "Whether the setting is hidden from the user",
299
+ "type": "boolean"
300
+ },
256
301
  "default": {
257
302
  "description": "Default value for the setting"
258
303
  },
@@ -0,0 +1,3 @@
1
+ import { z } from "zod";
2
+ export declare const Translatable: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
3
+ export type TranslatableType = z.infer<typeof Translatable>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Translatable = void 0;
4
+ var zod_1 = require("zod");
5
+ // 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")
11
+ .describe("Translation object with language codes as keys"),
12
+ ]);
package/package.json CHANGED
@@ -1,26 +1,26 @@
1
1
  {
2
2
  "name": "@examplary/schemas",
3
3
  "packageManager": "yarn@4.8.1",
4
- "version": "1.3.0",
4
+ "version": "1.5.0",
5
5
  "description": "Schemas for the Examplary platform.",
6
6
  "scripts": {
7
7
  "build:schema": "tsx ./scripts/build.ts",
8
8
  "build:tsc": "tsc ./src/index.ts --outDir dist --skipLibCheck --declaration",
9
9
  "start": "yarn build:tsc --watch",
10
10
  "build": "yarn build:tsc && yarn build:schema",
11
- "deploy": "serverless deploy --verbose --stage ${STAGE:-dev}",
11
+ "deploy": "bash -c 'serverless deploy --verbose --stage ${STAGE/staging/production}'",
12
12
  "release": "semantic-release -e semantic-release-monorepo"
13
13
  },
14
14
  "main": "./dist/index.js",
15
15
  "types": "./dist/index.d.ts",
16
16
  "devDependencies": {
17
- "serverless": "^4.17.2",
18
- "serverless-lift": "^1.31.0",
19
- "tsx": "^4.20.3",
20
- "typescript": "^5.8.3"
17
+ "serverless": "^4.19.1",
18
+ "serverless-lift": "^1.32.0",
19
+ "tsx": "^4.20.5",
20
+ "typescript": "^5.9.2"
21
21
  },
22
22
  "dependencies": {
23
- "zod": "^4.0.10"
23
+ "zod": "^4.1.9"
24
24
  },
25
25
  "homepage": "https://developers.examplary.ai/",
26
26
  "author": {
package/src/index.ts CHANGED
@@ -1,2 +1,13 @@
1
+ // General
2
+ export * from "./translatable";
3
+ export type * from "./translatable";
4
+
5
+ // Question types
1
6
  export * from "./question-type";
2
7
  export type * from "./question-type";
8
+ export * from "./question-type-setting";
9
+ export type * from "./question-type-setting";
10
+ export * from "./question-type-components";
11
+ export type * from "./question-type-components";
12
+ export * from "./question-type-generation-options";
13
+ export type * from "./question-type-generation-options";
@@ -0,0 +1,36 @@
1
+ import { z } from "zod";
2
+
3
+ // Path or URL reference type
4
+ export const PathOrUrlReference = z
5
+ .string()
6
+ .regex(
7
+ /^(https?:\/\/|\.)([a-zA-Z0-9._~:/?#@!$&'()*+,;=%-]+)$/,
8
+ "Valid path or URL format",
9
+ );
10
+
11
+ // Component reference type
12
+ export const ComponentReference = PathOrUrlReference.describe(
13
+ "Reference to a component, typically a file path or URL",
14
+ );
15
+
16
+ // Components configuration
17
+ export const QuestionTypeComponents = z
18
+ .object({
19
+ assessment: ComponentReference.optional().describe(
20
+ "Path to the assessment component (question content)",
21
+ ),
22
+ print: ComponentReference.optional().describe(
23
+ "Path to the print component (for printing the question)",
24
+ ),
25
+ "settings-area": ComponentReference.optional().describe(
26
+ "Path to the settings area component (for configuring question settings)",
27
+ ),
28
+ results: ComponentReference.optional().describe(
29
+ "Path to the results component (for displaying answers)",
30
+ ),
31
+ })
32
+ .strict()
33
+ .describe("Paths to the components used by this question type");
34
+
35
+ export type ComponentReferenceType = z.infer<typeof ComponentReference>;
36
+ export type ComponentsType = z.infer<typeof QuestionTypeComponents>;
@@ -0,0 +1,21 @@
1
+ import { z } from "zod";
2
+
3
+ export const QuestionTypeGenerationOptions = z
4
+ .object({
5
+ enabled: z
6
+ .boolean()
7
+ .describe(
8
+ "Whether this question type can be automatically generated using AI (default to false)",
9
+ ),
10
+ instructions: z
11
+ .string()
12
+ .optional()
13
+ .describe(
14
+ "Optional instructions to guide AI in generating this question type",
15
+ ),
16
+ })
17
+ .describe("Options for AI question generation");
18
+
19
+ export type QuestionTypeGenerationOptionsType = z.infer<
20
+ typeof QuestionTypeGenerationOptions
21
+ >;
@@ -0,0 +1,21 @@
1
+ import { z } from "zod";
2
+
3
+ export const QuestionTypeGradingOptions = z
4
+ .object({
5
+ enabled: z
6
+ .boolean()
7
+ .describe(
8
+ "Whether this question type can be automatically graded using AI (default to false)",
9
+ ),
10
+ instructions: z
11
+ .string()
12
+ .optional()
13
+ .describe(
14
+ "Optional instructions to guide AI in grading this question type",
15
+ ),
16
+ })
17
+ .describe("Options for AI question grading");
18
+
19
+ export type QuestionTypeGradingOptionsType = z.infer<
20
+ typeof QuestionTypeGradingOptions
21
+ >;