@quizpot/quizcore 0.0.1
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 +9 -0
- package/dist/events/client/host/kick-player.d.ts +8 -0
- package/dist/events/client/host/kick-player.d.ts.map +1 -0
- package/dist/events/client/host/kick-player.js +4 -0
- package/dist/events/client/host/next-step.d.ts +5 -0
- package/dist/events/client/host/next-step.d.ts.map +1 -0
- package/dist/events/client/host/next-step.js +3 -0
- package/dist/events/client/host/start-lobby.d.ts +6 -0
- package/dist/events/client/host/start-lobby.d.ts.map +1 -0
- package/dist/events/client/host/start-lobby.js +4 -0
- package/dist/events/client/player/submit-answer.d.ts +9 -0
- package/dist/events/client/player/submit-answer.d.ts.map +1 -0
- package/dist/events/client/player/submit-answer.js +4 -0
- package/dist/events/server/lobby-deleted.d.ts +8 -0
- package/dist/events/server/lobby-deleted.d.ts.map +1 -0
- package/dist/events/server/lobby-deleted.js +4 -0
- package/dist/events/server/lobby-joined.d.ts +14 -0
- package/dist/events/server/lobby-joined.d.ts.map +1 -0
- package/dist/events/server/lobby-joined.js +18 -0
- package/dist/events/server/lobby-status-update.d.ts +32 -0
- package/dist/events/server/lobby-status-update.d.ts.map +1 -0
- package/dist/events/server/lobby-status-update.js +4 -0
- package/dist/events/server/player-answer-result.d.ts +11 -0
- package/dist/events/server/player-answer-result.d.ts.map +1 -0
- package/dist/events/server/player-answer-result.js +4 -0
- package/dist/events/server/player-joined.d.ts +9 -0
- package/dist/events/server/player-joined.d.ts.map +1 -0
- package/dist/events/server/player-joined.js +4 -0
- package/dist/events/server/player-kicked.d.ts +6 -0
- package/dist/events/server/player-kicked.d.ts.map +1 -0
- package/dist/events/server/player-kicked.js +4 -0
- package/dist/events/server/player-left.d.ts +9 -0
- package/dist/events/server/player-left.d.ts.map +1 -0
- package/dist/events/server/player-left.js +4 -0
- package/dist/events/server/player-update.d.ts +9 -0
- package/dist/events/server/player-update.d.ts.map +1 -0
- package/dist/events/server/player-update.js +4 -0
- package/dist/events/server/update-lobby-answers.d.ts +8 -0
- package/dist/events/server/update-lobby-answers.d.ts.map +1 -0
- package/dist/events/server/update-lobby-answers.js +4 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/managers/lobby-manager.d.ts +12 -0
- package/dist/managers/lobby-manager.d.ts.map +1 -0
- package/dist/managers/lobby-manager.js +112 -0
- package/dist/questions/multiple-choice.d.ts +22 -0
- package/dist/questions/multiple-choice.d.ts.map +1 -0
- package/dist/questions/multiple-choice.js +1 -0
- package/dist/questions/short-answer.d.ts +12 -0
- package/dist/questions/short-answer.d.ts.map +1 -0
- package/dist/questions/short-answer.js +1 -0
- package/dist/questions/true-false.d.ts +12 -0
- package/dist/questions/true-false.d.ts.map +1 -0
- package/dist/questions/true-false.js +1 -0
- package/dist/schemas/quizfile.d.ts +87 -0
- package/dist/schemas/quizfile.d.ts.map +1 -0
- package/dist/schemas/quizfile.js +55 -0
- package/dist/slides/comparison.d.ts +9 -0
- package/dist/slides/comparison.d.ts.map +1 -0
- package/dist/slides/comparison.js +7 -0
- package/dist/slides/titleImageTextSlide.d.ts +9 -0
- package/dist/slides/titleImageTextSlide.d.ts.map +1 -0
- package/dist/slides/titleImageTextSlide.js +7 -0
- package/dist/slides/titleSlide.d.ts +8 -0
- package/dist/slides/titleSlide.d.ts.map +1 -0
- package/dist/slides/titleSlide.js +6 -0
- package/dist/types/events.d.ts +16 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +1 -0
- package/dist/types/lobby.d.ts +42 -0
- package/dist/types/lobby.d.ts.map +1 -0
- package/dist/types/lobby.js +10 -0
- package/dist/types/question.d.ts +106 -0
- package/dist/types/question.d.ts.map +1 -0
- package/dist/types/question.js +22 -0
- package/dist/types/questions/multiple-choice.d.ts +51 -0
- package/dist/types/questions/multiple-choice.d.ts.map +1 -0
- package/dist/types/questions/multiple-choice.js +21 -0
- package/dist/types/questions/short-answer.d.ts +34 -0
- package/dist/types/questions/short-answer.d.ts.map +1 -0
- package/dist/types/questions/short-answer.js +11 -0
- package/dist/types/questions/true-false.d.ts +36 -0
- package/dist/types/questions/true-false.d.ts.map +1 -0
- package/dist/types/questions/true-false.js +12 -0
- package/dist/types/quizfile.d.ts +79 -0
- package/dist/types/quizfile.d.ts.map +1 -0
- package/dist/types/quizfile.js +23 -0
- package/dist/types/quizstep.d.ts +73 -0
- package/dist/types/quizstep.d.ts.map +1 -0
- package/dist/types/quizstep.js +7 -0
- package/dist/types/quiztheme.d.ts +7 -0
- package/dist/types/quiztheme.d.ts.map +1 -0
- package/dist/types/quiztheme.js +5 -0
- package/dist/types/slide.d.ts +18 -0
- package/dist/types/slide.d.ts.map +1 -0
- package/dist/types/slide.js +9 -0
- package/dist/types/slides/comparison.d.ts +9 -0
- package/dist/types/slides/comparison.d.ts.map +1 -0
- package/dist/types/slides/comparison.js +7 -0
- package/dist/types/slides/titleImageTextSlide.d.ts +9 -0
- package/dist/types/slides/titleImageTextSlide.d.ts.map +1 -0
- package/dist/types/slides/titleImageTextSlide.js +7 -0
- package/dist/types/slides/titleSlide.d.ts +8 -0
- package/dist/types/slides/titleSlide.d.ts.map +1 -0
- package/dist/types/slides/titleSlide.js +6 -0
- package/dist/util/guards.d.ts +18 -0
- package/dist/util/guards.d.ts.map +1 -0
- package/dist/util/guards.js +15 -0
- package/dist/util/names/additives.json +23 -0
- package/dist/util/names/animals.json +23 -0
- package/dist/util/names/colors.json +14 -0
- package/dist/util/names/names.d.ts +4 -0
- package/dist/util/names/names.d.ts.map +1 -0
- package/dist/util/names/names.js +31 -0
- package/dist/util/sanitizer.d.ts +3 -0
- package/dist/util/sanitizer.d.ts.map +1 -0
- package/dist/util/sanitizer.js +18 -0
- package/dist/util/score.d.ts +11 -0
- package/dist/util/score.d.ts.map +1 -0
- package/dist/util/score.js +33 -0
- package/dist/util/validator.d.ts +14 -0
- package/dist/util/validator.d.ts.map +1 -0
- package/dist/util/validator.js +27 -0
- package/package.json +28 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const QuizFileSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
version: z.ZodLiteral<2>;
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
description: z.ZodOptional<z.ZodString>;
|
|
7
|
+
theme: z.ZodObject<{
|
|
8
|
+
color: z.ZodString;
|
|
9
|
+
background: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
language: z.ZodString;
|
|
12
|
+
steps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
13
|
+
type: z.ZodLiteral<"question">;
|
|
14
|
+
data: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
15
|
+
question: z.ZodString;
|
|
16
|
+
imageHash: z.ZodOptional<z.ZodString>;
|
|
17
|
+
displayTime: z.ZodNumber;
|
|
18
|
+
timeLimit: z.ZodNumber;
|
|
19
|
+
points: z.ZodEnum<{
|
|
20
|
+
normalPoints: "normalPoints";
|
|
21
|
+
doublePoints: "doublePoints";
|
|
22
|
+
noPoints: "noPoints";
|
|
23
|
+
}>;
|
|
24
|
+
type: z.ZodLiteral<"multiple-choice">;
|
|
25
|
+
options: z.ZodArray<z.ZodObject<{
|
|
26
|
+
id: z.ZodString;
|
|
27
|
+
text: z.ZodString;
|
|
28
|
+
isCorrect: z.ZodBoolean;
|
|
29
|
+
}, z.core.$strip>>;
|
|
30
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
31
|
+
question: z.ZodString;
|
|
32
|
+
imageHash: z.ZodOptional<z.ZodString>;
|
|
33
|
+
displayTime: z.ZodNumber;
|
|
34
|
+
timeLimit: z.ZodNumber;
|
|
35
|
+
points: z.ZodEnum<{
|
|
36
|
+
normalPoints: "normalPoints";
|
|
37
|
+
doublePoints: "doublePoints";
|
|
38
|
+
noPoints: "noPoints";
|
|
39
|
+
}>;
|
|
40
|
+
type: z.ZodLiteral<"true-false">;
|
|
41
|
+
answer: z.ZodBoolean;
|
|
42
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
43
|
+
question: z.ZodString;
|
|
44
|
+
imageHash: z.ZodOptional<z.ZodString>;
|
|
45
|
+
displayTime: z.ZodNumber;
|
|
46
|
+
timeLimit: z.ZodNumber;
|
|
47
|
+
points: z.ZodEnum<{
|
|
48
|
+
normalPoints: "normalPoints";
|
|
49
|
+
doublePoints: "doublePoints";
|
|
50
|
+
noPoints: "noPoints";
|
|
51
|
+
}>;
|
|
52
|
+
type: z.ZodLiteral<"short-answer">;
|
|
53
|
+
acceptedAnswers: z.ZodArray<z.ZodString>;
|
|
54
|
+
}, z.core.$strip>], "type">;
|
|
55
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
56
|
+
type: z.ZodLiteral<"slide">;
|
|
57
|
+
data: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
58
|
+
slideType: z.ZodLiteral<"title">;
|
|
59
|
+
title: z.ZodString;
|
|
60
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
62
|
+
slideType: z.ZodLiteral<"titleAndText">;
|
|
63
|
+
title: z.ZodString;
|
|
64
|
+
text: z.ZodString;
|
|
65
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
66
|
+
slideType: z.ZodLiteral<"titleAndTextWithImage">;
|
|
67
|
+
title: z.ZodString;
|
|
68
|
+
text: z.ZodString;
|
|
69
|
+
imageHash: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
71
|
+
slideType: z.ZodLiteral<"comparison">;
|
|
72
|
+
title: z.ZodString;
|
|
73
|
+
left: z.ZodString;
|
|
74
|
+
right: z.ZodString;
|
|
75
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
76
|
+
slideType: z.ZodLiteral<"titleImageText">;
|
|
77
|
+
title: z.ZodString;
|
|
78
|
+
imageHash: z.ZodOptional<z.ZodString>;
|
|
79
|
+
text: z.ZodString;
|
|
80
|
+
}, z.core.$strip>], "slideType">;
|
|
81
|
+
}, z.core.$strip>], "type">>;
|
|
82
|
+
images: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
83
|
+
updatedAt: z.ZodString;
|
|
84
|
+
createdAt: z.ZodString;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
export type QuizFile = z.infer<typeof QuizFileSchema>;
|
|
87
|
+
//# sourceMappingURL=quizfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quizfile.d.ts","sourceRoot":"","sources":["../../src/schemas/quizfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqDxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAWzB,CAAC;AAGH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const QuestionPointsSchema = z.enum(["normalPoints", "doublePoints", "noPoints"]);
|
|
3
|
+
const ThemeSchema = z.object({
|
|
4
|
+
color: z.string(),
|
|
5
|
+
background: z.string().optional(),
|
|
6
|
+
});
|
|
7
|
+
const SlideLayoutSchema = z.discriminatedUnion("slideType", [
|
|
8
|
+
z.object({ slideType: z.literal("title"), title: z.string(), subtitle: z.string().optional() }),
|
|
9
|
+
z.object({ slideType: z.literal("titleAndText"), title: z.string(), text: z.string() }),
|
|
10
|
+
z.object({ slideType: z.literal("titleAndTextWithImage"), title: z.string(), text: z.string(), imageHash: z.string().optional() }),
|
|
11
|
+
z.object({ slideType: z.literal("comparison"), title: z.string(), left: z.string(), right: z.string() }),
|
|
12
|
+
z.object({ slideType: z.literal("titleImageText"), title: z.string(), imageHash: z.string().optional(), text: z.string() }),
|
|
13
|
+
]);
|
|
14
|
+
const BaseQuestionSchema = z.object({
|
|
15
|
+
question: z.string().min(1),
|
|
16
|
+
imageHash: z.string().optional(),
|
|
17
|
+
displayTime: z.number().min(0),
|
|
18
|
+
timeLimit: z.number().min(1),
|
|
19
|
+
points: QuestionPointsSchema,
|
|
20
|
+
});
|
|
21
|
+
const MultipleChoiceSchema = BaseQuestionSchema.extend({
|
|
22
|
+
type: z.literal("multiple-choice"),
|
|
23
|
+
options: z.array(z.object({ id: z.string(), text: z.string(), isCorrect: z.boolean() })).min(2),
|
|
24
|
+
});
|
|
25
|
+
const TrueFalseSchema = BaseQuestionSchema.extend({
|
|
26
|
+
type: z.literal("true-false"),
|
|
27
|
+
answer: z.boolean(),
|
|
28
|
+
});
|
|
29
|
+
const ShortAnswerSchema = BaseQuestionSchema.extend({
|
|
30
|
+
type: z.literal("short-answer"),
|
|
31
|
+
acceptedAnswers: z.array(z.string()).min(1),
|
|
32
|
+
});
|
|
33
|
+
const QuestionSchema = z.discriminatedUnion("type", [
|
|
34
|
+
MultipleChoiceSchema,
|
|
35
|
+
TrueFalseSchema,
|
|
36
|
+
ShortAnswerSchema,
|
|
37
|
+
]);
|
|
38
|
+
// --- Quiz Steps ---
|
|
39
|
+
const QuizStepSchema = z.discriminatedUnion("type", [
|
|
40
|
+
z.object({ type: z.literal("question"), data: QuestionSchema }),
|
|
41
|
+
z.object({ type: z.literal("slide"), data: SlideLayoutSchema }),
|
|
42
|
+
]);
|
|
43
|
+
// --- Main QuizFile Schema ---
|
|
44
|
+
export const QuizFileSchema = z.object({
|
|
45
|
+
id: z.string().uuid(),
|
|
46
|
+
version: z.literal(2),
|
|
47
|
+
title: z.string().min(1),
|
|
48
|
+
description: z.string().optional(),
|
|
49
|
+
theme: ThemeSchema,
|
|
50
|
+
language: z.string().length(2), // ISO 639-1 format
|
|
51
|
+
steps: z.array(QuizStepSchema).min(1),
|
|
52
|
+
images: z.record(z.string(), z.string()), // Hash -> URL/Base64
|
|
53
|
+
updatedAt: z.string().datetime(), // Validates ISO strings
|
|
54
|
+
createdAt: z.string().datetime(),
|
|
55
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export type ComparisonSlideLayout = z.infer<typeof ComparisonSlideLayoutSchema>;
|
|
3
|
+
export declare const ComparisonSlideLayoutSchema: z.ZodObject<{
|
|
4
|
+
slideType: z.ZodLiteral<"comparison">;
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
left: z.ZodString;
|
|
7
|
+
right: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
//# sourceMappingURL=comparison.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comparison.d.ts","sourceRoot":"","sources":["../../src/slides/comparison.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,2BAA2B;;;;;iBAKtC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export type TitleImageTextSlideLayout = z.infer<typeof TitleImageTextSlideLayoutSchema>;
|
|
3
|
+
export declare const TitleImageTextSlideLayoutSchema: z.ZodObject<{
|
|
4
|
+
slideType: z.ZodLiteral<"titleImageText">;
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
7
|
+
text: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
//# sourceMappingURL=titleImageTextSlide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"titleImageTextSlide.d.ts","sourceRoot":"","sources":["../../src/slides/titleImageTextSlide.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,eAAO,MAAM,+BAA+B;;;;;iBAK1C,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export type TitleSlideLayout = z.infer<typeof TitleSlideLayoutSchema>;
|
|
3
|
+
export declare const TitleSlideLayoutSchema: z.ZodObject<{
|
|
4
|
+
slideType: z.ZodLiteral<"title">;
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
//# sourceMappingURL=titleSlide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"titleSlide.d.ts","sourceRoot":"","sources":["../../src/slides/titleSlide.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,sBAAsB;;;;iBAIjC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LobbyJoined } from "../events/server/lobby-joined";
|
|
2
|
+
import { PlayerJoined } from "../events/server/player-joined";
|
|
3
|
+
import { PlayerLeft } from "../events/server/player-left";
|
|
4
|
+
import { PlayerUpdate } from "../events/server/player-update";
|
|
5
|
+
import { LobbyStatusUpdate } from "../events/server/lobby-status-update";
|
|
6
|
+
import { UpdateLobbyAnswers } from "../events/server/update-lobby-answers";
|
|
7
|
+
import { PlayerAnswerResult } from "../events/server/player-answer-result";
|
|
8
|
+
import { PlayerKicked } from "../events/server/player-kicked";
|
|
9
|
+
import { LobbyDeleted } from "../events/server/lobby-deleted";
|
|
10
|
+
import { KickPlayer } from "../events/client/host/kick-player";
|
|
11
|
+
import { StartLobby } from "../events/client/host/start-lobby";
|
|
12
|
+
import { NextStep } from "../events/client/host/next-step";
|
|
13
|
+
import { SubmitAnswer } from "../events/client/player/submit-answer";
|
|
14
|
+
export type AllClientEvents = KickPlayer | StartLobby | NextStep | SubmitAnswer;
|
|
15
|
+
export type AllServerEvents = PlayerJoined | PlayerLeft | PlayerUpdate | LobbyStatusUpdate | UpdateLobbyAnswers | PlayerAnswerResult | PlayerKicked | LobbyDeleted | LobbyJoined;
|
|
16
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAGrE,MAAM,MAAM,eAAe,GACzB,UAAU,GACV,UAAU,GACV,QAAQ,GACR,YAAY,CAAC;AAGf,MAAM,MAAM,eAAe,GACzB,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,iBAAiB,GACjB,kBAAkB,GAClB,kBAAkB,GAClB,YAAY,GACZ,YAAY,GACZ,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Answer } from "../util/validator";
|
|
2
|
+
import { QuizFile } from "./quizfile";
|
|
3
|
+
import { QuizTheme } from "./quiztheme";
|
|
4
|
+
export type Lobby = {
|
|
5
|
+
code: string;
|
|
6
|
+
host: string;
|
|
7
|
+
quiz: QuizFile;
|
|
8
|
+
quizInfo: {
|
|
9
|
+
title: string;
|
|
10
|
+
stepCount: number;
|
|
11
|
+
theme: QuizTheme;
|
|
12
|
+
};
|
|
13
|
+
players: Player[];
|
|
14
|
+
status: LobbyStatus;
|
|
15
|
+
timeoutStartedAt: number | null;
|
|
16
|
+
duration: number | null;
|
|
17
|
+
currentStep: number;
|
|
18
|
+
currentAnswers: Answer[];
|
|
19
|
+
answers: Answer[];
|
|
20
|
+
settings: LobbySettings;
|
|
21
|
+
};
|
|
22
|
+
export type LobbySettings = {
|
|
23
|
+
customNames: boolean;
|
|
24
|
+
displayOnDevice: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare enum LobbyStatus {
|
|
27
|
+
waiting = "waiting",
|
|
28
|
+
slide = "slide",
|
|
29
|
+
question = "question",
|
|
30
|
+
answer = "answer",
|
|
31
|
+
answers = "answers",
|
|
32
|
+
score = "score",
|
|
33
|
+
end = "end"
|
|
34
|
+
}
|
|
35
|
+
export type Player = {
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
score: number;
|
|
39
|
+
streak: number;
|
|
40
|
+
isConnected: boolean;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=lobby.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lobby.d.ts","sourceRoot":"","sources":["../../src/types/lobby.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,SAAS,CAAC;KAClB,CAAC;IACF,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,WAAW,CAAC;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,aAAa,CAAC;CACzB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAA;AAED,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,GAAG,QAAQ;CACZ;AAED,MAAM,MAAM,MAAM,GAAG;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;CACtB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var LobbyStatus;
|
|
2
|
+
(function (LobbyStatus) {
|
|
3
|
+
LobbyStatus["waiting"] = "waiting";
|
|
4
|
+
LobbyStatus["slide"] = "slide";
|
|
5
|
+
LobbyStatus["question"] = "question";
|
|
6
|
+
LobbyStatus["answer"] = "answer";
|
|
7
|
+
LobbyStatus["answers"] = "answers";
|
|
8
|
+
LobbyStatus["score"] = "score";
|
|
9
|
+
LobbyStatus["end"] = "end";
|
|
10
|
+
})(LobbyStatus || (LobbyStatus = {}));
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { MultipleChoiceQuestion, SafeMultipleChoiceQuestion } from "./questions/multiple-choice";
|
|
3
|
+
import { SafeTrueFalseQuestion, TrueFalseQuestion } from "./questions/true-false";
|
|
4
|
+
import { SafeShortAnswerQuestion, ShortAnswerQuestion } from "./questions/short-answer";
|
|
5
|
+
export type Question = MultipleChoiceQuestion | TrueFalseQuestion | ShortAnswerQuestion;
|
|
6
|
+
export declare const QuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7
|
+
question: z.ZodString;
|
|
8
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
9
|
+
displayTime: z.ZodNumber;
|
|
10
|
+
timeLimit: z.ZodNumber;
|
|
11
|
+
points: z.ZodEnum<{
|
|
12
|
+
normalPoints: "normalPoints";
|
|
13
|
+
doublePoints: "doublePoints";
|
|
14
|
+
noPoints: "noPoints";
|
|
15
|
+
}>;
|
|
16
|
+
type: z.ZodLiteral<"multiple-choice">;
|
|
17
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
18
|
+
text: z.ZodString;
|
|
19
|
+
correct: z.ZodBoolean;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
matchAll: z.ZodBoolean;
|
|
22
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
23
|
+
question: z.ZodString;
|
|
24
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
25
|
+
displayTime: z.ZodNumber;
|
|
26
|
+
timeLimit: z.ZodNumber;
|
|
27
|
+
points: z.ZodEnum<{
|
|
28
|
+
normalPoints: "normalPoints";
|
|
29
|
+
doublePoints: "doublePoints";
|
|
30
|
+
noPoints: "noPoints";
|
|
31
|
+
}>;
|
|
32
|
+
type: z.ZodLiteral<"true-false">;
|
|
33
|
+
answer: z.ZodBoolean;
|
|
34
|
+
labels: z.ZodArray<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
36
|
+
question: z.ZodString;
|
|
37
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
38
|
+
displayTime: z.ZodNumber;
|
|
39
|
+
timeLimit: z.ZodNumber;
|
|
40
|
+
points: z.ZodEnum<{
|
|
41
|
+
normalPoints: "normalPoints";
|
|
42
|
+
doublePoints: "doublePoints";
|
|
43
|
+
noPoints: "noPoints";
|
|
44
|
+
}>;
|
|
45
|
+
type: z.ZodLiteral<"short-answer">;
|
|
46
|
+
answers: z.ZodArray<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>], "type">;
|
|
48
|
+
export type SafeQuestion = SafeMultipleChoiceQuestion | SafeTrueFalseQuestion | SafeShortAnswerQuestion;
|
|
49
|
+
export declare const SafeQuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
50
|
+
points: z.ZodEnum<{
|
|
51
|
+
normalPoints: "normalPoints";
|
|
52
|
+
doublePoints: "doublePoints";
|
|
53
|
+
noPoints: "noPoints";
|
|
54
|
+
}>;
|
|
55
|
+
type: z.ZodLiteral<"multiple-choice">;
|
|
56
|
+
question: z.ZodString;
|
|
57
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
58
|
+
displayTime: z.ZodNumber;
|
|
59
|
+
timeLimit: z.ZodNumber;
|
|
60
|
+
matchAll: z.ZodBoolean;
|
|
61
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
62
|
+
text: z.ZodString;
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
+
points: z.ZodEnum<{
|
|
66
|
+
normalPoints: "normalPoints";
|
|
67
|
+
doublePoints: "doublePoints";
|
|
68
|
+
noPoints: "noPoints";
|
|
69
|
+
}>;
|
|
70
|
+
type: z.ZodLiteral<"true-false">;
|
|
71
|
+
question: z.ZodString;
|
|
72
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
73
|
+
displayTime: z.ZodNumber;
|
|
74
|
+
timeLimit: z.ZodNumber;
|
|
75
|
+
labels: z.ZodArray<z.ZodString>;
|
|
76
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
77
|
+
points: z.ZodEnum<{
|
|
78
|
+
normalPoints: "normalPoints";
|
|
79
|
+
doublePoints: "doublePoints";
|
|
80
|
+
noPoints: "noPoints";
|
|
81
|
+
}>;
|
|
82
|
+
type: z.ZodLiteral<"short-answer">;
|
|
83
|
+
question: z.ZodString;
|
|
84
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
85
|
+
displayTime: z.ZodNumber;
|
|
86
|
+
timeLimit: z.ZodNumber;
|
|
87
|
+
}, z.core.$strip>], "type">;
|
|
88
|
+
export type QuestionPoints = z.infer<typeof QuestionPointsSchema>;
|
|
89
|
+
export declare const QuestionPointsSchema: z.ZodEnum<{
|
|
90
|
+
normalPoints: "normalPoints";
|
|
91
|
+
doublePoints: "doublePoints";
|
|
92
|
+
noPoints: "noPoints";
|
|
93
|
+
}>;
|
|
94
|
+
export type BaseQuestion = z.infer<typeof BaseQuestionSchema>;
|
|
95
|
+
export declare const BaseQuestionSchema: z.ZodObject<{
|
|
96
|
+
question: z.ZodString;
|
|
97
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
98
|
+
displayTime: z.ZodNumber;
|
|
99
|
+
timeLimit: z.ZodNumber;
|
|
100
|
+
points: z.ZodEnum<{
|
|
101
|
+
normalPoints: "normalPoints";
|
|
102
|
+
doublePoints: "doublePoints";
|
|
103
|
+
noPoints: "noPoints";
|
|
104
|
+
}>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
//# sourceMappingURL=question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../src/types/question.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,sBAAsB,EAAgC,0BAA0B,EAAoC,MAAM,6BAA6B,CAAC;AACjK,OAAO,EAAE,qBAAqB,EAA+B,iBAAiB,EAA2B,MAAM,wBAAwB,CAAC;AACxI,OAAO,EAAE,uBAAuB,EAAiC,mBAAmB,EAA6B,MAAM,0BAA0B,CAAC;AAElJ,MAAM,MAAM,QAAQ,GAAG,sBAAsB,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;AAExF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAIzB,CAAC;AAEH,MAAM,MAAM,YAAY,GACpB,0BAA0B,GAC1B,qBAAqB,GACrB,uBAAuB,CAAC;AAE5B,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAI7B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,oBAAoB;;;;EAAuD,CAAC;AAEzF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,kBAAkB;;;;;;;;;;iBAM7B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { MultipleChoiceQuestionSchema, SafeMultipleChoiceQuestionSchema } from "./questions/multiple-choice";
|
|
3
|
+
import { SafeTrueFalseQuestionSchema, TrueFalseQuestionSchema } from "./questions/true-false";
|
|
4
|
+
import { SafeShortAnswerQuestionSchema, ShortAnswerQuestionSchema } from "./questions/short-answer";
|
|
5
|
+
export const QuestionSchema = z.discriminatedUnion("type", [
|
|
6
|
+
MultipleChoiceQuestionSchema,
|
|
7
|
+
TrueFalseQuestionSchema,
|
|
8
|
+
ShortAnswerQuestionSchema,
|
|
9
|
+
]);
|
|
10
|
+
export const SafeQuestionSchema = z.discriminatedUnion("type", [
|
|
11
|
+
SafeMultipleChoiceQuestionSchema,
|
|
12
|
+
SafeTrueFalseQuestionSchema,
|
|
13
|
+
SafeShortAnswerQuestionSchema,
|
|
14
|
+
]);
|
|
15
|
+
export const QuestionPointsSchema = z.enum(["normalPoints", "doublePoints", "noPoints"]);
|
|
16
|
+
export const BaseQuestionSchema = z.object({
|
|
17
|
+
question: z.string().min(1),
|
|
18
|
+
imageHash: z.hash("sha256", { error: "Invalid image hash" }).optional(),
|
|
19
|
+
displayTime: z.number().min(1).max(60),
|
|
20
|
+
timeLimit: z.number().min(1).max(180),
|
|
21
|
+
points: QuestionPointsSchema,
|
|
22
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export declare const ChoiceSchema: z.ZodObject<{
|
|
3
|
+
text: z.ZodString;
|
|
4
|
+
correct: z.ZodBoolean;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type Choice = z.infer<typeof ChoiceSchema>;
|
|
7
|
+
export declare const SafeChoiceSchema: z.ZodObject<{
|
|
8
|
+
text: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type SafeChoice = z.infer<typeof SafeChoiceSchema>;
|
|
11
|
+
export declare const MultipleChoiceQuestionSchema: z.ZodObject<{
|
|
12
|
+
question: z.ZodString;
|
|
13
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
14
|
+
displayTime: z.ZodNumber;
|
|
15
|
+
timeLimit: z.ZodNumber;
|
|
16
|
+
points: z.ZodEnum<{
|
|
17
|
+
normalPoints: "normalPoints";
|
|
18
|
+
doublePoints: "doublePoints";
|
|
19
|
+
noPoints: "noPoints";
|
|
20
|
+
}>;
|
|
21
|
+
type: z.ZodLiteral<"multiple-choice">;
|
|
22
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
23
|
+
text: z.ZodString;
|
|
24
|
+
correct: z.ZodBoolean;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
matchAll: z.ZodBoolean;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export type MultipleChoiceQuestion = z.infer<typeof MultipleChoiceQuestionSchema>;
|
|
29
|
+
export declare const SafeMultipleChoiceQuestionSchema: z.ZodObject<{
|
|
30
|
+
points: z.ZodEnum<{
|
|
31
|
+
normalPoints: "normalPoints";
|
|
32
|
+
doublePoints: "doublePoints";
|
|
33
|
+
noPoints: "noPoints";
|
|
34
|
+
}>;
|
|
35
|
+
type: z.ZodLiteral<"multiple-choice">;
|
|
36
|
+
question: z.ZodString;
|
|
37
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
38
|
+
displayTime: z.ZodNumber;
|
|
39
|
+
timeLimit: z.ZodNumber;
|
|
40
|
+
matchAll: z.ZodBoolean;
|
|
41
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
42
|
+
text: z.ZodString;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
export type SafeMultipleChoiceQuestion = z.infer<typeof SafeMultipleChoiceQuestionSchema>;
|
|
46
|
+
export declare const MultipleChoiceQuestionAnswerSchema: z.ZodObject<{
|
|
47
|
+
type: z.ZodLiteral<"multiple-choice">;
|
|
48
|
+
choices: z.ZodArray<z.ZodNumber>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export type MultipleChoiceQuestionAnswer = z.infer<typeof MultipleChoiceQuestionAnswerSchema>;
|
|
51
|
+
//# sourceMappingURL=multiple-choice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiple-choice.d.ts","sourceRoot":"","sources":["../../../src/types/questions/multiple-choice.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,eAAO,MAAM,YAAY;;;iBAGvB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,eAAO,MAAM,gBAAgB;;iBAAuC,CAAC;AAErE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;iBAIvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;iBAI3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE1F,eAAO,MAAM,kCAAkC;;;iBAG7C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { BaseQuestionSchema } from "../question";
|
|
3
|
+
export const ChoiceSchema = z.object({
|
|
4
|
+
text: z.string(),
|
|
5
|
+
correct: z.boolean(),
|
|
6
|
+
});
|
|
7
|
+
export const SafeChoiceSchema = ChoiceSchema.omit({ correct: true });
|
|
8
|
+
export const MultipleChoiceQuestionSchema = BaseQuestionSchema.extend({
|
|
9
|
+
type: z.literal("multiple-choice"),
|
|
10
|
+
choices: z.array(ChoiceSchema).min(2),
|
|
11
|
+
matchAll: z.boolean(),
|
|
12
|
+
});
|
|
13
|
+
export const SafeMultipleChoiceQuestionSchema = MultipleChoiceQuestionSchema.omit({
|
|
14
|
+
choices: true
|
|
15
|
+
}).extend({
|
|
16
|
+
choices: z.array(SafeChoiceSchema).min(2),
|
|
17
|
+
});
|
|
18
|
+
export const MultipleChoiceQuestionAnswerSchema = z.object({
|
|
19
|
+
type: z.literal("multiple-choice"),
|
|
20
|
+
choices: z.array(z.number()).min(1),
|
|
21
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export declare const ShortAnswerQuestionSchema: z.ZodObject<{
|
|
3
|
+
question: z.ZodString;
|
|
4
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
5
|
+
displayTime: z.ZodNumber;
|
|
6
|
+
timeLimit: z.ZodNumber;
|
|
7
|
+
points: z.ZodEnum<{
|
|
8
|
+
normalPoints: "normalPoints";
|
|
9
|
+
doublePoints: "doublePoints";
|
|
10
|
+
noPoints: "noPoints";
|
|
11
|
+
}>;
|
|
12
|
+
type: z.ZodLiteral<"short-answer">;
|
|
13
|
+
answers: z.ZodArray<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export type ShortAnswerQuestion = z.infer<typeof ShortAnswerQuestionSchema>;
|
|
16
|
+
export declare const SafeShortAnswerQuestionSchema: z.ZodObject<{
|
|
17
|
+
points: z.ZodEnum<{
|
|
18
|
+
normalPoints: "normalPoints";
|
|
19
|
+
doublePoints: "doublePoints";
|
|
20
|
+
noPoints: "noPoints";
|
|
21
|
+
}>;
|
|
22
|
+
type: z.ZodLiteral<"short-answer">;
|
|
23
|
+
question: z.ZodString;
|
|
24
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
25
|
+
displayTime: z.ZodNumber;
|
|
26
|
+
timeLimit: z.ZodNumber;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export type SafeShortAnswerQuestion = z.infer<typeof SafeShortAnswerQuestionSchema>;
|
|
29
|
+
export declare const ShortAnswerQuestionAnswerSchema: z.ZodObject<{
|
|
30
|
+
type: z.ZodLiteral<"short-answer">;
|
|
31
|
+
answer: z.ZodString;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export type ShortAnswerQuestionAnswer = z.infer<typeof ShortAnswerQuestionAnswerSchema>;
|
|
34
|
+
//# sourceMappingURL=short-answer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"short-answer.d.ts","sourceRoot":"","sources":["../../../src/types/questions/short-answer.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;iBAGpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,6BAA6B;;;;;;;;;;;iBAAoD,CAAC;AAE/F,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,+BAA+B;;;iBAG1C,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { BaseQuestionSchema } from "../question";
|
|
3
|
+
export const ShortAnswerQuestionSchema = BaseQuestionSchema.extend({
|
|
4
|
+
type: z.literal("short-answer"),
|
|
5
|
+
answers: z.array(z.string()).min(1),
|
|
6
|
+
});
|
|
7
|
+
export const SafeShortAnswerQuestionSchema = ShortAnswerQuestionSchema.omit({ answers: true });
|
|
8
|
+
export const ShortAnswerQuestionAnswerSchema = z.object({
|
|
9
|
+
type: z.literal("short-answer"),
|
|
10
|
+
answer: z.string(),
|
|
11
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export declare const TrueFalseQuestionSchema: z.ZodObject<{
|
|
3
|
+
question: z.ZodString;
|
|
4
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
5
|
+
displayTime: z.ZodNumber;
|
|
6
|
+
timeLimit: z.ZodNumber;
|
|
7
|
+
points: z.ZodEnum<{
|
|
8
|
+
normalPoints: "normalPoints";
|
|
9
|
+
doublePoints: "doublePoints";
|
|
10
|
+
noPoints: "noPoints";
|
|
11
|
+
}>;
|
|
12
|
+
type: z.ZodLiteral<"true-false">;
|
|
13
|
+
answer: z.ZodBoolean;
|
|
14
|
+
labels: z.ZodArray<z.ZodString>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type TrueFalseQuestion = z.infer<typeof TrueFalseQuestionSchema>;
|
|
17
|
+
export declare const SafeTrueFalseQuestionSchema: z.ZodObject<{
|
|
18
|
+
points: z.ZodEnum<{
|
|
19
|
+
normalPoints: "normalPoints";
|
|
20
|
+
doublePoints: "doublePoints";
|
|
21
|
+
noPoints: "noPoints";
|
|
22
|
+
}>;
|
|
23
|
+
type: z.ZodLiteral<"true-false">;
|
|
24
|
+
question: z.ZodString;
|
|
25
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
26
|
+
displayTime: z.ZodNumber;
|
|
27
|
+
timeLimit: z.ZodNumber;
|
|
28
|
+
labels: z.ZodArray<z.ZodString>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export type SafeTrueFalseQuestion = z.infer<typeof SafeTrueFalseQuestionSchema>;
|
|
31
|
+
export declare const TrueFalseQuestionAnswerSchema: z.ZodObject<{
|
|
32
|
+
type: z.ZodLiteral<"true-false">;
|
|
33
|
+
answer: z.ZodBoolean;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type TrueFalseQuestionAnswer = z.infer<typeof TrueFalseQuestionAnswerSchema>;
|
|
36
|
+
//# sourceMappingURL=true-false.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"true-false.d.ts","sourceRoot":"","sources":["../../../src/types/questions/true-false.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;iBAIlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,2BAA2B;;;;;;;;;;;;iBAAiD,CAAC;AAE1F,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,6BAA6B;;;iBAGxC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { BaseQuestionSchema } from "../question";
|
|
3
|
+
export const TrueFalseQuestionSchema = BaseQuestionSchema.extend({
|
|
4
|
+
type: z.literal("true-false"),
|
|
5
|
+
answer: z.boolean(),
|
|
6
|
+
labels: z.array(z.string()).min(2).max(2),
|
|
7
|
+
});
|
|
8
|
+
export const SafeTrueFalseQuestionSchema = TrueFalseQuestionSchema.omit({ answer: true });
|
|
9
|
+
export const TrueFalseQuestionAnswerSchema = z.object({
|
|
10
|
+
type: z.literal("true-false"),
|
|
11
|
+
answer: z.boolean(),
|
|
12
|
+
});
|