@quizpot/quizcore 0.0.5 → 0.0.7
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/dist/index.cjs +31 -16
- package/dist/index.d.cts +197 -7
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +197 -7
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +21 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.cjs
CHANGED
|
@@ -23,6 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
//#endregion
|
|
24
24
|
let zod = require("zod");
|
|
25
25
|
zod = __toESM(zod);
|
|
26
|
+
let uuid = require("uuid");
|
|
26
27
|
//#region src/events/client/host/kick-player.ts
|
|
27
28
|
const createKickPlayerEvent = (playerId) => ({
|
|
28
29
|
type: "KICK_PLAYER",
|
|
@@ -341,7 +342,7 @@ const QuestionSchema = zod.default.discriminatedUnion("type", [
|
|
|
341
342
|
TrueFalseQuestionSchema,
|
|
342
343
|
ShortAnswerQuestionSchema
|
|
343
344
|
]);
|
|
344
|
-
zod.default.discriminatedUnion("type", [
|
|
345
|
+
const SafeQuestionSchema = zod.default.discriminatedUnion("type", [
|
|
345
346
|
SafeMultipleChoiceQuestionSchema,
|
|
346
347
|
SafeTrueFalseQuestionSchema,
|
|
347
348
|
SafeShortAnswerQuestionSchema
|
|
@@ -376,17 +377,12 @@ const MultipleChoiceQuestionAnswerSchema = zod.default.object({
|
|
|
376
377
|
choices: zod.default.array(zod.default.number()).min(1)
|
|
377
378
|
});
|
|
378
379
|
//#endregion
|
|
379
|
-
//#region src/types/
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
background: zod.default.hash("sha256", { error: "Invalid background hash" }).optional()
|
|
383
|
-
});
|
|
384
|
-
//#endregion
|
|
385
|
-
//#region src/types/slides/titleSlide.ts
|
|
386
|
-
const TitleSlideLayoutSchema = zod.default.object({
|
|
387
|
-
slideType: zod.default.literal("title"),
|
|
380
|
+
//#region src/types/slides/comparison.ts
|
|
381
|
+
const ComparisonSlideLayoutSchema = zod.default.object({
|
|
382
|
+
slideType: zod.default.literal("comparison"),
|
|
388
383
|
title: zod.default.string(),
|
|
389
|
-
|
|
384
|
+
left: zod.default.string(),
|
|
385
|
+
right: zod.default.string()
|
|
390
386
|
});
|
|
391
387
|
//#endregion
|
|
392
388
|
//#region src/types/slides/titleImageTextSlide.ts
|
|
@@ -397,12 +393,17 @@ const TitleImageTextSlideLayoutSchema = zod.default.object({
|
|
|
397
393
|
text: zod.default.string()
|
|
398
394
|
});
|
|
399
395
|
//#endregion
|
|
400
|
-
//#region src/types/slides/
|
|
401
|
-
const
|
|
402
|
-
slideType: zod.default.literal("
|
|
396
|
+
//#region src/types/slides/titleSlide.ts
|
|
397
|
+
const TitleSlideLayoutSchema = zod.default.object({
|
|
398
|
+
slideType: zod.default.literal("title"),
|
|
403
399
|
title: zod.default.string(),
|
|
404
|
-
|
|
405
|
-
|
|
400
|
+
subtitle: zod.default.string().optional()
|
|
401
|
+
});
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region src/types/quiztheme.ts
|
|
404
|
+
const QuizThemeSchema = zod.default.object({
|
|
405
|
+
color: zod.default.string().regex(/^#[0-9a-fA-F]{6}$/, { message: "Invalid color format. Must be a 7-character hex code (e.g., #RRGGBB)." }),
|
|
406
|
+
background: zod.default.hash("sha256", { error: "Invalid background hash" }).optional()
|
|
406
407
|
});
|
|
407
408
|
//#endregion
|
|
408
409
|
//#region src/types/slide.ts
|
|
@@ -524,6 +525,9 @@ const generateUniqueName = (players) => {
|
|
|
524
525
|
throw new Error("No unique names available");
|
|
525
526
|
};
|
|
526
527
|
//#endregion
|
|
528
|
+
//#region src/util/id.ts
|
|
529
|
+
const createWebsocketId = () => (0, uuid.v7)();
|
|
530
|
+
//#endregion
|
|
527
531
|
//#region src/util/sanitizer.ts
|
|
528
532
|
const sanitizeQuestion = (question) => {
|
|
529
533
|
if (isMultipleChoice(question)) return {
|
|
@@ -541,17 +545,27 @@ const sanitizeQuestion = (question) => {
|
|
|
541
545
|
throw new Error("Invalid question type");
|
|
542
546
|
};
|
|
543
547
|
//#endregion
|
|
548
|
+
exports.BaseQuestionSchema = BaseQuestionSchema;
|
|
544
549
|
exports.ChoiceSchema = ChoiceSchema;
|
|
550
|
+
exports.ComparisonSlideLayoutSchema = ComparisonSlideLayoutSchema;
|
|
545
551
|
exports.LobbyStatus = LobbyStatus;
|
|
546
552
|
exports.MultipleChoiceQuestionAnswerSchema = MultipleChoiceQuestionAnswerSchema;
|
|
547
553
|
exports.MultipleChoiceQuestionSchema = MultipleChoiceQuestionSchema;
|
|
554
|
+
exports.QuestionPointsSchema = QuestionPointsSchema;
|
|
555
|
+
exports.QuestionSchema = QuestionSchema;
|
|
548
556
|
exports.QuizFileSchema = QuizFileSchema;
|
|
557
|
+
exports.QuizStepSchema = QuizStepSchema;
|
|
558
|
+
exports.QuizThemeSchema = QuizThemeSchema;
|
|
549
559
|
exports.SafeChoiceSchema = SafeChoiceSchema;
|
|
550
560
|
exports.SafeMultipleChoiceQuestionSchema = SafeMultipleChoiceQuestionSchema;
|
|
561
|
+
exports.SafeQuestionSchema = SafeQuestionSchema;
|
|
551
562
|
exports.SafeShortAnswerQuestionSchema = SafeShortAnswerQuestionSchema;
|
|
552
563
|
exports.SafeTrueFalseQuestionSchema = SafeTrueFalseQuestionSchema;
|
|
553
564
|
exports.ShortAnswerQuestionAnswerSchema = ShortAnswerQuestionAnswerSchema;
|
|
554
565
|
exports.ShortAnswerQuestionSchema = ShortAnswerQuestionSchema;
|
|
566
|
+
exports.SlideSchema = SlideSchema;
|
|
567
|
+
exports.TitleImageTextSlideLayoutSchema = TitleImageTextSlideLayoutSchema;
|
|
568
|
+
exports.TitleSlideLayoutSchema = TitleSlideLayoutSchema;
|
|
555
569
|
exports.TrueFalseQuestionAnswerSchema = TrueFalseQuestionAnswerSchema;
|
|
556
570
|
exports.TrueFalseQuestionSchema = TrueFalseQuestionSchema;
|
|
557
571
|
exports.advanceLobby = advanceLobby;
|
|
@@ -570,6 +584,7 @@ exports.createPlayerUpdateEvent = createPlayerUpdateEvent;
|
|
|
570
584
|
exports.createStartLobbyEvent = createStartLobbyEvent;
|
|
571
585
|
exports.createSubmitAnswerEvent = createSubmitAnswerEvent;
|
|
572
586
|
exports.createUpdateLobbyAnswersEvent = createUpdateLobbyAnswersEvent;
|
|
587
|
+
exports.createWebsocketId = createWebsocketId;
|
|
573
588
|
exports.generateName = generateName;
|
|
574
589
|
exports.generateUniqueName = generateUniqueName;
|
|
575
590
|
exports.handleSubmission = handleSubmission;
|
package/dist/index.d.cts
CHANGED
|
@@ -39,12 +39,12 @@ declare const ShortAnswerQuestionSchema: z.ZodObject<{
|
|
|
39
39
|
type ShortAnswerQuestion = z.infer<typeof ShortAnswerQuestionSchema>;
|
|
40
40
|
declare const SafeShortAnswerQuestionSchema: z.ZodObject<{
|
|
41
41
|
type: z.ZodLiteral<"short-answer">;
|
|
42
|
+
question: z.ZodString;
|
|
42
43
|
points: z.ZodEnum<{
|
|
43
44
|
normalPoints: "normalPoints";
|
|
44
45
|
doublePoints: "doublePoints";
|
|
45
46
|
noPoints: "noPoints";
|
|
46
47
|
}>;
|
|
47
|
-
question: z.ZodString;
|
|
48
48
|
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
49
49
|
displayTime: z.ZodNumber;
|
|
50
50
|
timeLimit: z.ZodNumber;
|
|
@@ -74,12 +74,12 @@ declare const TrueFalseQuestionSchema: z.ZodObject<{
|
|
|
74
74
|
type TrueFalseQuestion = z.infer<typeof TrueFalseQuestionSchema>;
|
|
75
75
|
declare const SafeTrueFalseQuestionSchema: z.ZodObject<{
|
|
76
76
|
type: z.ZodLiteral<"true-false">;
|
|
77
|
+
question: z.ZodString;
|
|
77
78
|
points: z.ZodEnum<{
|
|
78
79
|
normalPoints: "normalPoints";
|
|
79
80
|
doublePoints: "doublePoints";
|
|
80
81
|
noPoints: "noPoints";
|
|
81
82
|
}>;
|
|
82
|
-
question: z.ZodString;
|
|
83
83
|
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
84
84
|
displayTime: z.ZodNumber;
|
|
85
85
|
timeLimit: z.ZodNumber;
|
|
@@ -122,12 +122,12 @@ declare const MultipleChoiceQuestionSchema: z.ZodObject<{
|
|
|
122
122
|
type MultipleChoiceQuestion = z.infer<typeof MultipleChoiceQuestionSchema>;
|
|
123
123
|
declare const SafeMultipleChoiceQuestionSchema: z.ZodObject<{
|
|
124
124
|
type: z.ZodLiteral<"multiple-choice">;
|
|
125
|
+
question: z.ZodString;
|
|
125
126
|
points: z.ZodEnum<{
|
|
126
127
|
normalPoints: "normalPoints";
|
|
127
128
|
doublePoints: "doublePoints";
|
|
128
129
|
noPoints: "noPoints";
|
|
129
130
|
}>;
|
|
130
|
-
question: z.ZodString;
|
|
131
131
|
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
132
132
|
displayTime: z.ZodNumber;
|
|
133
133
|
timeLimit: z.ZodNumber;
|
|
@@ -145,7 +145,106 @@ type MultipleChoiceQuestionAnswer = z.infer<typeof MultipleChoiceQuestionAnswerS
|
|
|
145
145
|
//#endregion
|
|
146
146
|
//#region src/types/question.d.ts
|
|
147
147
|
type Question = MultipleChoiceQuestion | TrueFalseQuestion | ShortAnswerQuestion;
|
|
148
|
+
declare const QuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
149
|
+
question: z.ZodString;
|
|
150
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
151
|
+
displayTime: z.ZodNumber;
|
|
152
|
+
timeLimit: z.ZodNumber;
|
|
153
|
+
points: z.ZodEnum<{
|
|
154
|
+
normalPoints: "normalPoints";
|
|
155
|
+
doublePoints: "doublePoints";
|
|
156
|
+
noPoints: "noPoints";
|
|
157
|
+
}>;
|
|
158
|
+
type: z.ZodLiteral<"multiple-choice">;
|
|
159
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
160
|
+
text: z.ZodString;
|
|
161
|
+
correct: z.ZodBoolean;
|
|
162
|
+
}, z.core.$strip>>;
|
|
163
|
+
matchAll: z.ZodBoolean;
|
|
164
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
165
|
+
question: z.ZodString;
|
|
166
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
167
|
+
displayTime: z.ZodNumber;
|
|
168
|
+
timeLimit: z.ZodNumber;
|
|
169
|
+
points: z.ZodEnum<{
|
|
170
|
+
normalPoints: "normalPoints";
|
|
171
|
+
doublePoints: "doublePoints";
|
|
172
|
+
noPoints: "noPoints";
|
|
173
|
+
}>;
|
|
174
|
+
type: z.ZodLiteral<"true-false">;
|
|
175
|
+
answer: z.ZodBoolean;
|
|
176
|
+
labels: z.ZodArray<z.ZodString>;
|
|
177
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
178
|
+
question: z.ZodString;
|
|
179
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
180
|
+
displayTime: z.ZodNumber;
|
|
181
|
+
timeLimit: z.ZodNumber;
|
|
182
|
+
points: z.ZodEnum<{
|
|
183
|
+
normalPoints: "normalPoints";
|
|
184
|
+
doublePoints: "doublePoints";
|
|
185
|
+
noPoints: "noPoints";
|
|
186
|
+
}>;
|
|
187
|
+
type: z.ZodLiteral<"short-answer">;
|
|
188
|
+
answers: z.ZodArray<z.ZodString>;
|
|
189
|
+
}, z.core.$strip>], "type">;
|
|
148
190
|
type SafeQuestion = SafeMultipleChoiceQuestion | SafeTrueFalseQuestion | SafeShortAnswerQuestion;
|
|
191
|
+
declare const SafeQuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
192
|
+
type: z.ZodLiteral<"multiple-choice">;
|
|
193
|
+
question: z.ZodString;
|
|
194
|
+
points: z.ZodEnum<{
|
|
195
|
+
normalPoints: "normalPoints";
|
|
196
|
+
doublePoints: "doublePoints";
|
|
197
|
+
noPoints: "noPoints";
|
|
198
|
+
}>;
|
|
199
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
200
|
+
displayTime: z.ZodNumber;
|
|
201
|
+
timeLimit: z.ZodNumber;
|
|
202
|
+
matchAll: z.ZodBoolean;
|
|
203
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
204
|
+
text: z.ZodString;
|
|
205
|
+
}, z.core.$strip>>;
|
|
206
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
207
|
+
type: z.ZodLiteral<"true-false">;
|
|
208
|
+
question: z.ZodString;
|
|
209
|
+
points: z.ZodEnum<{
|
|
210
|
+
normalPoints: "normalPoints";
|
|
211
|
+
doublePoints: "doublePoints";
|
|
212
|
+
noPoints: "noPoints";
|
|
213
|
+
}>;
|
|
214
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
215
|
+
displayTime: z.ZodNumber;
|
|
216
|
+
timeLimit: z.ZodNumber;
|
|
217
|
+
labels: z.ZodArray<z.ZodString>;
|
|
218
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
219
|
+
type: z.ZodLiteral<"short-answer">;
|
|
220
|
+
question: z.ZodString;
|
|
221
|
+
points: z.ZodEnum<{
|
|
222
|
+
normalPoints: "normalPoints";
|
|
223
|
+
doublePoints: "doublePoints";
|
|
224
|
+
noPoints: "noPoints";
|
|
225
|
+
}>;
|
|
226
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
227
|
+
displayTime: z.ZodNumber;
|
|
228
|
+
timeLimit: z.ZodNumber;
|
|
229
|
+
}, z.core.$strip>], "type">;
|
|
230
|
+
type QuestionPoints = z.infer<typeof QuestionPointsSchema>;
|
|
231
|
+
declare const QuestionPointsSchema: z.ZodEnum<{
|
|
232
|
+
normalPoints: "normalPoints";
|
|
233
|
+
doublePoints: "doublePoints";
|
|
234
|
+
noPoints: "noPoints";
|
|
235
|
+
}>;
|
|
236
|
+
type BaseQuestion = z.infer<typeof BaseQuestionSchema>;
|
|
237
|
+
declare const BaseQuestionSchema: z.ZodObject<{
|
|
238
|
+
question: z.ZodString;
|
|
239
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
240
|
+
displayTime: z.ZodNumber;
|
|
241
|
+
timeLimit: z.ZodNumber;
|
|
242
|
+
points: z.ZodEnum<{
|
|
243
|
+
normalPoints: "normalPoints";
|
|
244
|
+
doublePoints: "doublePoints";
|
|
245
|
+
noPoints: "noPoints";
|
|
246
|
+
}>;
|
|
247
|
+
}, z.core.$strip>;
|
|
149
248
|
//#endregion
|
|
150
249
|
//#region src/util/validator.d.ts
|
|
151
250
|
type SubmittedAnswer = MultipleChoiceQuestionAnswer | TrueFalseQuestionAnswer | ShortAnswerQuestionAnswer;
|
|
@@ -426,6 +525,32 @@ type SubmissionResult = {
|
|
|
426
525
|
};
|
|
427
526
|
declare const handleSubmission: (lobby: Lobby, playerId: string, submission: SubmittedAnswer) => SubmissionResult | null;
|
|
428
527
|
//#endregion
|
|
528
|
+
//#region src/types/slides/comparison.d.ts
|
|
529
|
+
declare const ComparisonSlideLayoutSchema: z.ZodObject<{
|
|
530
|
+
slideType: z.ZodLiteral<"comparison">;
|
|
531
|
+
title: z.ZodString;
|
|
532
|
+
left: z.ZodString;
|
|
533
|
+
right: z.ZodString;
|
|
534
|
+
}, z.core.$strip>;
|
|
535
|
+
type ComparisonSlideLayout = z.infer<typeof ComparisonSlideLayoutSchema>;
|
|
536
|
+
//#endregion
|
|
537
|
+
//#region src/types/slides/titleImageTextSlide.d.ts
|
|
538
|
+
declare const TitleImageTextSlideLayoutSchema: z.ZodObject<{
|
|
539
|
+
slideType: z.ZodLiteral<"titleImageText">;
|
|
540
|
+
title: z.ZodString;
|
|
541
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
542
|
+
text: z.ZodString;
|
|
543
|
+
}, z.core.$strip>;
|
|
544
|
+
type TitleImageTextSlideLayout = z.infer<typeof TitleImageTextSlideLayoutSchema>;
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region src/types/slides/titleSlide.d.ts
|
|
547
|
+
declare const TitleSlideLayoutSchema: z.ZodObject<{
|
|
548
|
+
slideType: z.ZodLiteral<"title">;
|
|
549
|
+
title: z.ZodString;
|
|
550
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
551
|
+
}, z.core.$strip>;
|
|
552
|
+
type TitleSlideLayout = z.infer<typeof TitleSlideLayoutSchema>;
|
|
553
|
+
//#endregion
|
|
429
554
|
//#region src/types/events.d.ts
|
|
430
555
|
type AllClientEvents = KickPlayer | StartLobby | NextStep | SubmitAnswer;
|
|
431
556
|
type AllServerEvents = PlayerJoined | PlayerLeft | PlayerUpdate | LobbyStatusUpdate | UpdateLobbyAnswers | PlayerAnswerResult | PlayerKicked | LobbyDeleted | LobbyJoined;
|
|
@@ -438,6 +563,72 @@ type QuizStep = {
|
|
|
438
563
|
type: "slide";
|
|
439
564
|
data: Slide;
|
|
440
565
|
};
|
|
566
|
+
declare const QuizStepSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
567
|
+
type: z.ZodLiteral<"question">;
|
|
568
|
+
data: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
569
|
+
question: z.ZodString;
|
|
570
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
571
|
+
displayTime: z.ZodNumber;
|
|
572
|
+
timeLimit: z.ZodNumber;
|
|
573
|
+
points: z.ZodEnum<{
|
|
574
|
+
normalPoints: "normalPoints";
|
|
575
|
+
doublePoints: "doublePoints";
|
|
576
|
+
noPoints: "noPoints";
|
|
577
|
+
}>;
|
|
578
|
+
type: z.ZodLiteral<"multiple-choice">;
|
|
579
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
580
|
+
text: z.ZodString;
|
|
581
|
+
correct: z.ZodBoolean;
|
|
582
|
+
}, z.core.$strip>>;
|
|
583
|
+
matchAll: z.ZodBoolean;
|
|
584
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
585
|
+
question: z.ZodString;
|
|
586
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
587
|
+
displayTime: z.ZodNumber;
|
|
588
|
+
timeLimit: z.ZodNumber;
|
|
589
|
+
points: z.ZodEnum<{
|
|
590
|
+
normalPoints: "normalPoints";
|
|
591
|
+
doublePoints: "doublePoints";
|
|
592
|
+
noPoints: "noPoints";
|
|
593
|
+
}>;
|
|
594
|
+
type: z.ZodLiteral<"true-false">;
|
|
595
|
+
answer: z.ZodBoolean;
|
|
596
|
+
labels: z.ZodArray<z.ZodString>;
|
|
597
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
598
|
+
question: z.ZodString;
|
|
599
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
600
|
+
displayTime: z.ZodNumber;
|
|
601
|
+
timeLimit: z.ZodNumber;
|
|
602
|
+
points: z.ZodEnum<{
|
|
603
|
+
normalPoints: "normalPoints";
|
|
604
|
+
doublePoints: "doublePoints";
|
|
605
|
+
noPoints: "noPoints";
|
|
606
|
+
}>;
|
|
607
|
+
type: z.ZodLiteral<"short-answer">;
|
|
608
|
+
answers: z.ZodArray<z.ZodString>;
|
|
609
|
+
}, z.core.$strip>], "type">;
|
|
610
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
611
|
+
type: z.ZodLiteral<"slide">;
|
|
612
|
+
data: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
613
|
+
slideType: z.ZodLiteral<"title">;
|
|
614
|
+
title: z.ZodString;
|
|
615
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
616
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
617
|
+
slideType: z.ZodLiteral<"titleImageText">;
|
|
618
|
+
title: z.ZodString;
|
|
619
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
620
|
+
text: z.ZodString;
|
|
621
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
622
|
+
slideType: z.ZodLiteral<"comparison">;
|
|
623
|
+
title: z.ZodString;
|
|
624
|
+
left: z.ZodString;
|
|
625
|
+
right: z.ZodString;
|
|
626
|
+
}, z.core.$strip>], "slideType">;
|
|
627
|
+
}, z.core.$strip>], "type">;
|
|
628
|
+
//#endregion
|
|
629
|
+
//#region src/util/names/names.d.ts
|
|
630
|
+
declare const generateName: () => string;
|
|
631
|
+
declare const generateUniqueName: (players: Player[]) => string;
|
|
441
632
|
//#endregion
|
|
442
633
|
//#region src/util/guards.d.ts
|
|
443
634
|
declare const isQuestion: (step: QuizStep) => step is {
|
|
@@ -452,9 +643,8 @@ declare const isMultipleChoice: (data: Question) => data is MultipleChoiceQuesti
|
|
|
452
643
|
declare const isTrueFalse: (data: Question) => data is TrueFalseQuestion;
|
|
453
644
|
declare const isShortAnswer: (data: Question) => data is ShortAnswerQuestion;
|
|
454
645
|
//#endregion
|
|
455
|
-
//#region src/util/
|
|
456
|
-
declare const
|
|
457
|
-
declare const generateUniqueName: (players: Player[]) => string;
|
|
646
|
+
//#region src/util/id.d.ts
|
|
647
|
+
declare const createWebsocketId: () => string;
|
|
458
648
|
//#endregion
|
|
459
649
|
//#region src/util/sanitizer.d.ts
|
|
460
650
|
declare const sanitizeQuestion: (question: Question) => SafeQuestion;
|
|
@@ -468,5 +658,5 @@ declare const calculateScore: (player: {
|
|
|
468
658
|
pointsAwarded: number;
|
|
469
659
|
};
|
|
470
660
|
//#endregion
|
|
471
|
-
export { AllClientEvents, AllServerEvents, Answer, Choice, ChoiceSchema, KickPlayer, Lobby, LobbyDeleted, LobbyJoined, LobbySettings, LobbyStatus, LobbyStatusUpdate, MultipleChoiceQuestion, MultipleChoiceQuestionAnswer, MultipleChoiceQuestionAnswerSchema, MultipleChoiceQuestionSchema, NextStep, Player, PlayerAnswerResult, PlayerJoined, PlayerKicked, PlayerLeft, PlayerUpdate, QuizFile, QuizFileSchema, SafeChoice, SafeChoiceSchema, SafeMultipleChoiceQuestion, SafeMultipleChoiceQuestionSchema, SafeShortAnswerQuestion, SafeShortAnswerQuestionSchema, SafeTrueFalseQuestion, SafeTrueFalseQuestionSchema, ShortAnswerQuestion, ShortAnswerQuestionAnswer, ShortAnswerQuestionAnswerSchema, ShortAnswerQuestionSchema, StartLobby, SubmissionResult, SubmitAnswer, SubmittedAnswer, TrueFalseQuestion, TrueFalseQuestionAnswer, TrueFalseQuestionAnswerSchema, TrueFalseQuestionSchema, UpdateLobbyAnswers, advanceLobby, calculateScore, createKickPlayerEvent, createLobby, createLobbyDeletedEvent, createLobbyJoinedEvent, createLobbyStatusUpdateEvent, createNextStepEvent, createPlayerAnswerResultEvent, createPlayerJoinedEvent, createPlayerKickedEvent, createPlayerLeftEvent, createPlayerUpdateEvent, createStartLobbyEvent, createSubmitAnswerEvent, createUpdateLobbyAnswersEvent, generateName, generateUniqueName, handleSubmission, isCorrect, isMultipleChoice, isQuestion, isShortAnswer, isSlide, isTrueFalse, sanitizeQuestion };
|
|
661
|
+
export { AllClientEvents, AllServerEvents, Answer, BaseQuestion, BaseQuestionSchema, Choice, ChoiceSchema, ComparisonSlideLayout, ComparisonSlideLayoutSchema, KickPlayer, Lobby, LobbyDeleted, LobbyJoined, LobbySettings, LobbyStatus, LobbyStatusUpdate, MultipleChoiceQuestion, MultipleChoiceQuestionAnswer, MultipleChoiceQuestionAnswerSchema, MultipleChoiceQuestionSchema, NextStep, Player, PlayerAnswerResult, PlayerJoined, PlayerKicked, PlayerLeft, PlayerUpdate, Question, QuestionPoints, QuestionPointsSchema, QuestionSchema, QuizFile, QuizFileSchema, QuizStep, QuizStepSchema, QuizTheme, QuizThemeSchema, SafeChoice, SafeChoiceSchema, SafeMultipleChoiceQuestion, SafeMultipleChoiceQuestionSchema, SafeQuestion, SafeQuestionSchema, SafeShortAnswerQuestion, SafeShortAnswerQuestionSchema, SafeTrueFalseQuestion, SafeTrueFalseQuestionSchema, ShortAnswerQuestion, ShortAnswerQuestionAnswer, ShortAnswerQuestionAnswerSchema, ShortAnswerQuestionSchema, Slide, SlideSchema, StartLobby, SubmissionResult, SubmitAnswer, SubmittedAnswer, TitleImageTextSlideLayout, TitleImageTextSlideLayoutSchema, TitleSlideLayout, TitleSlideLayoutSchema, TrueFalseQuestion, TrueFalseQuestionAnswer, TrueFalseQuestionAnswerSchema, TrueFalseQuestionSchema, UpdateLobbyAnswers, advanceLobby, calculateScore, createKickPlayerEvent, createLobby, createLobbyDeletedEvent, createLobbyJoinedEvent, createLobbyStatusUpdateEvent, createNextStepEvent, createPlayerAnswerResultEvent, createPlayerJoinedEvent, createPlayerKickedEvent, createPlayerLeftEvent, createPlayerUpdateEvent, createStartLobbyEvent, createSubmitAnswerEvent, createUpdateLobbyAnswersEvent, createWebsocketId, generateName, generateUniqueName, handleSubmission, isCorrect, isMultipleChoice, isQuestion, isShortAnswer, isSlide, isTrueFalse, sanitizeQuestion };
|
|
472
662
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/events/client/host/kick-player.ts","../src/events/client/host/next-step.ts","../src/events/client/host/start-lobby.ts","../src/types/questions/short-answer.ts","../src/types/questions/true-false.ts","../src/types/questions/multiple-choice.ts","../src/types/question.ts","../src/util/validator.ts","../src/events/client/player/submit-answer.ts","../src/events/server/lobby-deleted.ts","../src/types/quizfile.ts","../src/types/quiztheme.ts","../src/types/lobby.ts","../src/events/server/lobby-joined.ts","../src/types/slide.ts","../src/events/server/lobby-status-update.ts","../src/events/server/player-answer-result.ts","../src/events/server/player-joined.ts","../src/events/server/player-kicked.ts","../src/events/server/player-left.ts","../src/events/server/player-update.ts","../src/events/server/update-lobby-answers.ts","../src/managers/lobby-manager.ts","../src/types/events.ts","../src/types/quizstep.ts","../src/util/guards.ts","../src/util/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/events/client/host/kick-player.ts","../src/events/client/host/next-step.ts","../src/events/client/host/start-lobby.ts","../src/types/questions/short-answer.ts","../src/types/questions/true-false.ts","../src/types/questions/multiple-choice.ts","../src/types/question.ts","../src/util/validator.ts","../src/events/client/player/submit-answer.ts","../src/events/server/lobby-deleted.ts","../src/types/quizfile.ts","../src/types/quiztheme.ts","../src/types/lobby.ts","../src/events/server/lobby-joined.ts","../src/types/slide.ts","../src/events/server/lobby-status-update.ts","../src/events/server/player-answer-result.ts","../src/events/server/player-joined.ts","../src/events/server/player-kicked.ts","../src/events/server/player-left.ts","../src/events/server/player-update.ts","../src/events/server/update-lobby-answers.ts","../src/managers/lobby-manager.ts","../src/types/slides/comparison.ts","../src/types/slides/titleImageTextSlide.ts","../src/types/slides/titleSlide.ts","../src/types/events.ts","../src/types/quizstep.ts","../src/util/names/names.ts","../src/util/guards.ts","../src/util/id.ts","../src/util/sanitizer.ts","../src/util/score.ts"],"mappings":";;;KAAY,UAAA;EACV,IAAA;EACA,OAAA;IAAW,QAAA;EAAA;AAAA;AAAA,cAGA,qBAAA,GAAyB,QAAA,aAAmB,UAAA;;;KCL7C,QAAA;EACV,IAAA;AAAA;AAAA,cAGW,mBAAA,QAA0B,QAAA;;;KCJ3B,UAAA;EACV,IAAA;EACA,OAAA;AAAA;AAAA,cAGW,qBAAA,QAA4B,UAAA;;;cCF5B,yBAAA,EAAyB,CAAA,CAAA,SAAA;;;;;;;;;;;;;KAK1B,mBAAA,GAAsB,CAAA,CAAE,KAAA,QAAa,yBAAA;AAAA,cAEpC,6BAAA,EAA6B,CAAA,CAAA,SAAA;;;;;;;;;;;;KAE9B,uBAAA,GAA0B,CAAA,CAAE,KAAA,QAAa,6BAAA;AAAA,cAExC,+BAAA,EAA+B,CAAA,CAAA,SAAA;;;;KAKhC,yBAAA,GAA4B,CAAA,CAAE,KAAA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ShortAnswerQuestion = z.infer<typeof ShortAnswerQuestionSchema>;
|
|
40
40
|
declare const SafeShortAnswerQuestionSchema: z.ZodObject<{
|
|
41
41
|
type: z.ZodLiteral<"short-answer">;
|
|
42
|
+
question: z.ZodString;
|
|
42
43
|
points: z.ZodEnum<{
|
|
43
44
|
normalPoints: "normalPoints";
|
|
44
45
|
doublePoints: "doublePoints";
|
|
45
46
|
noPoints: "noPoints";
|
|
46
47
|
}>;
|
|
47
|
-
question: z.ZodString;
|
|
48
48
|
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
49
49
|
displayTime: z.ZodNumber;
|
|
50
50
|
timeLimit: z.ZodNumber;
|
|
@@ -74,12 +74,12 @@ declare const TrueFalseQuestionSchema: z.ZodObject<{
|
|
|
74
74
|
type TrueFalseQuestion = z.infer<typeof TrueFalseQuestionSchema>;
|
|
75
75
|
declare const SafeTrueFalseQuestionSchema: z.ZodObject<{
|
|
76
76
|
type: z.ZodLiteral<"true-false">;
|
|
77
|
+
question: z.ZodString;
|
|
77
78
|
points: z.ZodEnum<{
|
|
78
79
|
normalPoints: "normalPoints";
|
|
79
80
|
doublePoints: "doublePoints";
|
|
80
81
|
noPoints: "noPoints";
|
|
81
82
|
}>;
|
|
82
|
-
question: z.ZodString;
|
|
83
83
|
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
84
84
|
displayTime: z.ZodNumber;
|
|
85
85
|
timeLimit: z.ZodNumber;
|
|
@@ -122,12 +122,12 @@ declare const MultipleChoiceQuestionSchema: z.ZodObject<{
|
|
|
122
122
|
type MultipleChoiceQuestion = z.infer<typeof MultipleChoiceQuestionSchema>;
|
|
123
123
|
declare const SafeMultipleChoiceQuestionSchema: z.ZodObject<{
|
|
124
124
|
type: z.ZodLiteral<"multiple-choice">;
|
|
125
|
+
question: z.ZodString;
|
|
125
126
|
points: z.ZodEnum<{
|
|
126
127
|
normalPoints: "normalPoints";
|
|
127
128
|
doublePoints: "doublePoints";
|
|
128
129
|
noPoints: "noPoints";
|
|
129
130
|
}>;
|
|
130
|
-
question: z.ZodString;
|
|
131
131
|
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
132
132
|
displayTime: z.ZodNumber;
|
|
133
133
|
timeLimit: z.ZodNumber;
|
|
@@ -145,7 +145,106 @@ type MultipleChoiceQuestionAnswer = z.infer<typeof MultipleChoiceQuestionAnswerS
|
|
|
145
145
|
//#endregion
|
|
146
146
|
//#region src/types/question.d.ts
|
|
147
147
|
type Question = MultipleChoiceQuestion | TrueFalseQuestion | ShortAnswerQuestion;
|
|
148
|
+
declare const QuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
149
|
+
question: z.ZodString;
|
|
150
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
151
|
+
displayTime: z.ZodNumber;
|
|
152
|
+
timeLimit: z.ZodNumber;
|
|
153
|
+
points: z.ZodEnum<{
|
|
154
|
+
normalPoints: "normalPoints";
|
|
155
|
+
doublePoints: "doublePoints";
|
|
156
|
+
noPoints: "noPoints";
|
|
157
|
+
}>;
|
|
158
|
+
type: z.ZodLiteral<"multiple-choice">;
|
|
159
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
160
|
+
text: z.ZodString;
|
|
161
|
+
correct: z.ZodBoolean;
|
|
162
|
+
}, z.core.$strip>>;
|
|
163
|
+
matchAll: z.ZodBoolean;
|
|
164
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
165
|
+
question: z.ZodString;
|
|
166
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
167
|
+
displayTime: z.ZodNumber;
|
|
168
|
+
timeLimit: z.ZodNumber;
|
|
169
|
+
points: z.ZodEnum<{
|
|
170
|
+
normalPoints: "normalPoints";
|
|
171
|
+
doublePoints: "doublePoints";
|
|
172
|
+
noPoints: "noPoints";
|
|
173
|
+
}>;
|
|
174
|
+
type: z.ZodLiteral<"true-false">;
|
|
175
|
+
answer: z.ZodBoolean;
|
|
176
|
+
labels: z.ZodArray<z.ZodString>;
|
|
177
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
178
|
+
question: z.ZodString;
|
|
179
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
180
|
+
displayTime: z.ZodNumber;
|
|
181
|
+
timeLimit: z.ZodNumber;
|
|
182
|
+
points: z.ZodEnum<{
|
|
183
|
+
normalPoints: "normalPoints";
|
|
184
|
+
doublePoints: "doublePoints";
|
|
185
|
+
noPoints: "noPoints";
|
|
186
|
+
}>;
|
|
187
|
+
type: z.ZodLiteral<"short-answer">;
|
|
188
|
+
answers: z.ZodArray<z.ZodString>;
|
|
189
|
+
}, z.core.$strip>], "type">;
|
|
148
190
|
type SafeQuestion = SafeMultipleChoiceQuestion | SafeTrueFalseQuestion | SafeShortAnswerQuestion;
|
|
191
|
+
declare const SafeQuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
192
|
+
type: z.ZodLiteral<"multiple-choice">;
|
|
193
|
+
question: z.ZodString;
|
|
194
|
+
points: z.ZodEnum<{
|
|
195
|
+
normalPoints: "normalPoints";
|
|
196
|
+
doublePoints: "doublePoints";
|
|
197
|
+
noPoints: "noPoints";
|
|
198
|
+
}>;
|
|
199
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
200
|
+
displayTime: z.ZodNumber;
|
|
201
|
+
timeLimit: z.ZodNumber;
|
|
202
|
+
matchAll: z.ZodBoolean;
|
|
203
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
204
|
+
text: z.ZodString;
|
|
205
|
+
}, z.core.$strip>>;
|
|
206
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
207
|
+
type: z.ZodLiteral<"true-false">;
|
|
208
|
+
question: z.ZodString;
|
|
209
|
+
points: z.ZodEnum<{
|
|
210
|
+
normalPoints: "normalPoints";
|
|
211
|
+
doublePoints: "doublePoints";
|
|
212
|
+
noPoints: "noPoints";
|
|
213
|
+
}>;
|
|
214
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
215
|
+
displayTime: z.ZodNumber;
|
|
216
|
+
timeLimit: z.ZodNumber;
|
|
217
|
+
labels: z.ZodArray<z.ZodString>;
|
|
218
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
219
|
+
type: z.ZodLiteral<"short-answer">;
|
|
220
|
+
question: z.ZodString;
|
|
221
|
+
points: z.ZodEnum<{
|
|
222
|
+
normalPoints: "normalPoints";
|
|
223
|
+
doublePoints: "doublePoints";
|
|
224
|
+
noPoints: "noPoints";
|
|
225
|
+
}>;
|
|
226
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
227
|
+
displayTime: z.ZodNumber;
|
|
228
|
+
timeLimit: z.ZodNumber;
|
|
229
|
+
}, z.core.$strip>], "type">;
|
|
230
|
+
type QuestionPoints = z.infer<typeof QuestionPointsSchema>;
|
|
231
|
+
declare const QuestionPointsSchema: z.ZodEnum<{
|
|
232
|
+
normalPoints: "normalPoints";
|
|
233
|
+
doublePoints: "doublePoints";
|
|
234
|
+
noPoints: "noPoints";
|
|
235
|
+
}>;
|
|
236
|
+
type BaseQuestion = z.infer<typeof BaseQuestionSchema>;
|
|
237
|
+
declare const BaseQuestionSchema: z.ZodObject<{
|
|
238
|
+
question: z.ZodString;
|
|
239
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
240
|
+
displayTime: z.ZodNumber;
|
|
241
|
+
timeLimit: z.ZodNumber;
|
|
242
|
+
points: z.ZodEnum<{
|
|
243
|
+
normalPoints: "normalPoints";
|
|
244
|
+
doublePoints: "doublePoints";
|
|
245
|
+
noPoints: "noPoints";
|
|
246
|
+
}>;
|
|
247
|
+
}, z.core.$strip>;
|
|
149
248
|
//#endregion
|
|
150
249
|
//#region src/util/validator.d.ts
|
|
151
250
|
type SubmittedAnswer = MultipleChoiceQuestionAnswer | TrueFalseQuestionAnswer | ShortAnswerQuestionAnswer;
|
|
@@ -426,6 +525,32 @@ type SubmissionResult = {
|
|
|
426
525
|
};
|
|
427
526
|
declare const handleSubmission: (lobby: Lobby, playerId: string, submission: SubmittedAnswer) => SubmissionResult | null;
|
|
428
527
|
//#endregion
|
|
528
|
+
//#region src/types/slides/comparison.d.ts
|
|
529
|
+
declare const ComparisonSlideLayoutSchema: z.ZodObject<{
|
|
530
|
+
slideType: z.ZodLiteral<"comparison">;
|
|
531
|
+
title: z.ZodString;
|
|
532
|
+
left: z.ZodString;
|
|
533
|
+
right: z.ZodString;
|
|
534
|
+
}, z.core.$strip>;
|
|
535
|
+
type ComparisonSlideLayout = z.infer<typeof ComparisonSlideLayoutSchema>;
|
|
536
|
+
//#endregion
|
|
537
|
+
//#region src/types/slides/titleImageTextSlide.d.ts
|
|
538
|
+
declare const TitleImageTextSlideLayoutSchema: z.ZodObject<{
|
|
539
|
+
slideType: z.ZodLiteral<"titleImageText">;
|
|
540
|
+
title: z.ZodString;
|
|
541
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
542
|
+
text: z.ZodString;
|
|
543
|
+
}, z.core.$strip>;
|
|
544
|
+
type TitleImageTextSlideLayout = z.infer<typeof TitleImageTextSlideLayoutSchema>;
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region src/types/slides/titleSlide.d.ts
|
|
547
|
+
declare const TitleSlideLayoutSchema: z.ZodObject<{
|
|
548
|
+
slideType: z.ZodLiteral<"title">;
|
|
549
|
+
title: z.ZodString;
|
|
550
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
551
|
+
}, z.core.$strip>;
|
|
552
|
+
type TitleSlideLayout = z.infer<typeof TitleSlideLayoutSchema>;
|
|
553
|
+
//#endregion
|
|
429
554
|
//#region src/types/events.d.ts
|
|
430
555
|
type AllClientEvents = KickPlayer | StartLobby | NextStep | SubmitAnswer;
|
|
431
556
|
type AllServerEvents = PlayerJoined | PlayerLeft | PlayerUpdate | LobbyStatusUpdate | UpdateLobbyAnswers | PlayerAnswerResult | PlayerKicked | LobbyDeleted | LobbyJoined;
|
|
@@ -438,6 +563,72 @@ type QuizStep = {
|
|
|
438
563
|
type: "slide";
|
|
439
564
|
data: Slide;
|
|
440
565
|
};
|
|
566
|
+
declare const QuizStepSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
567
|
+
type: z.ZodLiteral<"question">;
|
|
568
|
+
data: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
569
|
+
question: z.ZodString;
|
|
570
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
571
|
+
displayTime: z.ZodNumber;
|
|
572
|
+
timeLimit: z.ZodNumber;
|
|
573
|
+
points: z.ZodEnum<{
|
|
574
|
+
normalPoints: "normalPoints";
|
|
575
|
+
doublePoints: "doublePoints";
|
|
576
|
+
noPoints: "noPoints";
|
|
577
|
+
}>;
|
|
578
|
+
type: z.ZodLiteral<"multiple-choice">;
|
|
579
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
580
|
+
text: z.ZodString;
|
|
581
|
+
correct: z.ZodBoolean;
|
|
582
|
+
}, z.core.$strip>>;
|
|
583
|
+
matchAll: z.ZodBoolean;
|
|
584
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
585
|
+
question: z.ZodString;
|
|
586
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
587
|
+
displayTime: z.ZodNumber;
|
|
588
|
+
timeLimit: z.ZodNumber;
|
|
589
|
+
points: z.ZodEnum<{
|
|
590
|
+
normalPoints: "normalPoints";
|
|
591
|
+
doublePoints: "doublePoints";
|
|
592
|
+
noPoints: "noPoints";
|
|
593
|
+
}>;
|
|
594
|
+
type: z.ZodLiteral<"true-false">;
|
|
595
|
+
answer: z.ZodBoolean;
|
|
596
|
+
labels: z.ZodArray<z.ZodString>;
|
|
597
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
598
|
+
question: z.ZodString;
|
|
599
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
600
|
+
displayTime: z.ZodNumber;
|
|
601
|
+
timeLimit: z.ZodNumber;
|
|
602
|
+
points: z.ZodEnum<{
|
|
603
|
+
normalPoints: "normalPoints";
|
|
604
|
+
doublePoints: "doublePoints";
|
|
605
|
+
noPoints: "noPoints";
|
|
606
|
+
}>;
|
|
607
|
+
type: z.ZodLiteral<"short-answer">;
|
|
608
|
+
answers: z.ZodArray<z.ZodString>;
|
|
609
|
+
}, z.core.$strip>], "type">;
|
|
610
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
611
|
+
type: z.ZodLiteral<"slide">;
|
|
612
|
+
data: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
613
|
+
slideType: z.ZodLiteral<"title">;
|
|
614
|
+
title: z.ZodString;
|
|
615
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
616
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
617
|
+
slideType: z.ZodLiteral<"titleImageText">;
|
|
618
|
+
title: z.ZodString;
|
|
619
|
+
imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
|
|
620
|
+
text: z.ZodString;
|
|
621
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
622
|
+
slideType: z.ZodLiteral<"comparison">;
|
|
623
|
+
title: z.ZodString;
|
|
624
|
+
left: z.ZodString;
|
|
625
|
+
right: z.ZodString;
|
|
626
|
+
}, z.core.$strip>], "slideType">;
|
|
627
|
+
}, z.core.$strip>], "type">;
|
|
628
|
+
//#endregion
|
|
629
|
+
//#region src/util/names/names.d.ts
|
|
630
|
+
declare const generateName: () => string;
|
|
631
|
+
declare const generateUniqueName: (players: Player[]) => string;
|
|
441
632
|
//#endregion
|
|
442
633
|
//#region src/util/guards.d.ts
|
|
443
634
|
declare const isQuestion: (step: QuizStep) => step is {
|
|
@@ -452,9 +643,8 @@ declare const isMultipleChoice: (data: Question) => data is MultipleChoiceQuesti
|
|
|
452
643
|
declare const isTrueFalse: (data: Question) => data is TrueFalseQuestion;
|
|
453
644
|
declare const isShortAnswer: (data: Question) => data is ShortAnswerQuestion;
|
|
454
645
|
//#endregion
|
|
455
|
-
//#region src/util/
|
|
456
|
-
declare const
|
|
457
|
-
declare const generateUniqueName: (players: Player[]) => string;
|
|
646
|
+
//#region src/util/id.d.ts
|
|
647
|
+
declare const createWebsocketId: () => string;
|
|
458
648
|
//#endregion
|
|
459
649
|
//#region src/util/sanitizer.d.ts
|
|
460
650
|
declare const sanitizeQuestion: (question: Question) => SafeQuestion;
|
|
@@ -468,5 +658,5 @@ declare const calculateScore: (player: {
|
|
|
468
658
|
pointsAwarded: number;
|
|
469
659
|
};
|
|
470
660
|
//#endregion
|
|
471
|
-
export { AllClientEvents, AllServerEvents, Answer, Choice, ChoiceSchema, KickPlayer, Lobby, LobbyDeleted, LobbyJoined, LobbySettings, LobbyStatus, LobbyStatusUpdate, MultipleChoiceQuestion, MultipleChoiceQuestionAnswer, MultipleChoiceQuestionAnswerSchema, MultipleChoiceQuestionSchema, NextStep, Player, PlayerAnswerResult, PlayerJoined, PlayerKicked, PlayerLeft, PlayerUpdate, QuizFile, QuizFileSchema, SafeChoice, SafeChoiceSchema, SafeMultipleChoiceQuestion, SafeMultipleChoiceQuestionSchema, SafeShortAnswerQuestion, SafeShortAnswerQuestionSchema, SafeTrueFalseQuestion, SafeTrueFalseQuestionSchema, ShortAnswerQuestion, ShortAnswerQuestionAnswer, ShortAnswerQuestionAnswerSchema, ShortAnswerQuestionSchema, StartLobby, SubmissionResult, SubmitAnswer, SubmittedAnswer, TrueFalseQuestion, TrueFalseQuestionAnswer, TrueFalseQuestionAnswerSchema, TrueFalseQuestionSchema, UpdateLobbyAnswers, advanceLobby, calculateScore, createKickPlayerEvent, createLobby, createLobbyDeletedEvent, createLobbyJoinedEvent, createLobbyStatusUpdateEvent, createNextStepEvent, createPlayerAnswerResultEvent, createPlayerJoinedEvent, createPlayerKickedEvent, createPlayerLeftEvent, createPlayerUpdateEvent, createStartLobbyEvent, createSubmitAnswerEvent, createUpdateLobbyAnswersEvent, generateName, generateUniqueName, handleSubmission, isCorrect, isMultipleChoice, isQuestion, isShortAnswer, isSlide, isTrueFalse, sanitizeQuestion };
|
|
661
|
+
export { AllClientEvents, AllServerEvents, Answer, BaseQuestion, BaseQuestionSchema, Choice, ChoiceSchema, ComparisonSlideLayout, ComparisonSlideLayoutSchema, KickPlayer, Lobby, LobbyDeleted, LobbyJoined, LobbySettings, LobbyStatus, LobbyStatusUpdate, MultipleChoiceQuestion, MultipleChoiceQuestionAnswer, MultipleChoiceQuestionAnswerSchema, MultipleChoiceQuestionSchema, NextStep, Player, PlayerAnswerResult, PlayerJoined, PlayerKicked, PlayerLeft, PlayerUpdate, Question, QuestionPoints, QuestionPointsSchema, QuestionSchema, QuizFile, QuizFileSchema, QuizStep, QuizStepSchema, QuizTheme, QuizThemeSchema, SafeChoice, SafeChoiceSchema, SafeMultipleChoiceQuestion, SafeMultipleChoiceQuestionSchema, SafeQuestion, SafeQuestionSchema, SafeShortAnswerQuestion, SafeShortAnswerQuestionSchema, SafeTrueFalseQuestion, SafeTrueFalseQuestionSchema, ShortAnswerQuestion, ShortAnswerQuestionAnswer, ShortAnswerQuestionAnswerSchema, ShortAnswerQuestionSchema, Slide, SlideSchema, StartLobby, SubmissionResult, SubmitAnswer, SubmittedAnswer, TitleImageTextSlideLayout, TitleImageTextSlideLayoutSchema, TitleSlideLayout, TitleSlideLayoutSchema, TrueFalseQuestion, TrueFalseQuestionAnswer, TrueFalseQuestionAnswerSchema, TrueFalseQuestionSchema, UpdateLobbyAnswers, advanceLobby, calculateScore, createKickPlayerEvent, createLobby, createLobbyDeletedEvent, createLobbyJoinedEvent, createLobbyStatusUpdateEvent, createNextStepEvent, createPlayerAnswerResultEvent, createPlayerJoinedEvent, createPlayerKickedEvent, createPlayerLeftEvent, createPlayerUpdateEvent, createStartLobbyEvent, createSubmitAnswerEvent, createUpdateLobbyAnswersEvent, createWebsocketId, generateName, generateUniqueName, handleSubmission, isCorrect, isMultipleChoice, isQuestion, isShortAnswer, isSlide, isTrueFalse, sanitizeQuestion };
|
|
472
662
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/events/client/host/kick-player.ts","../src/events/client/host/next-step.ts","../src/events/client/host/start-lobby.ts","../src/types/questions/short-answer.ts","../src/types/questions/true-false.ts","../src/types/questions/multiple-choice.ts","../src/types/question.ts","../src/util/validator.ts","../src/events/client/player/submit-answer.ts","../src/events/server/lobby-deleted.ts","../src/types/quizfile.ts","../src/types/quiztheme.ts","../src/types/lobby.ts","../src/events/server/lobby-joined.ts","../src/types/slide.ts","../src/events/server/lobby-status-update.ts","../src/events/server/player-answer-result.ts","../src/events/server/player-joined.ts","../src/events/server/player-kicked.ts","../src/events/server/player-left.ts","../src/events/server/player-update.ts","../src/events/server/update-lobby-answers.ts","../src/managers/lobby-manager.ts","../src/types/events.ts","../src/types/quizstep.ts","../src/util/guards.ts","../src/util/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/events/client/host/kick-player.ts","../src/events/client/host/next-step.ts","../src/events/client/host/start-lobby.ts","../src/types/questions/short-answer.ts","../src/types/questions/true-false.ts","../src/types/questions/multiple-choice.ts","../src/types/question.ts","../src/util/validator.ts","../src/events/client/player/submit-answer.ts","../src/events/server/lobby-deleted.ts","../src/types/quizfile.ts","../src/types/quiztheme.ts","../src/types/lobby.ts","../src/events/server/lobby-joined.ts","../src/types/slide.ts","../src/events/server/lobby-status-update.ts","../src/events/server/player-answer-result.ts","../src/events/server/player-joined.ts","../src/events/server/player-kicked.ts","../src/events/server/player-left.ts","../src/events/server/player-update.ts","../src/events/server/update-lobby-answers.ts","../src/managers/lobby-manager.ts","../src/types/slides/comparison.ts","../src/types/slides/titleImageTextSlide.ts","../src/types/slides/titleSlide.ts","../src/types/events.ts","../src/types/quizstep.ts","../src/util/names/names.ts","../src/util/guards.ts","../src/util/id.ts","../src/util/sanitizer.ts","../src/util/score.ts"],"mappings":";;;KAAY,UAAA;EACV,IAAA;EACA,OAAA;IAAW,QAAA;EAAA;AAAA;AAAA,cAGA,qBAAA,GAAyB,QAAA,aAAmB,UAAA;;;KCL7C,QAAA;EACV,IAAA;AAAA;AAAA,cAGW,mBAAA,QAA0B,QAAA;;;KCJ3B,UAAA;EACV,IAAA;EACA,OAAA;AAAA;AAAA,cAGW,qBAAA,QAA4B,UAAA;;;cCF5B,yBAAA,EAAyB,CAAA,CAAA,SAAA;;;;;;;;;;;;;KAK1B,mBAAA,GAAsB,CAAA,CAAE,KAAA,QAAa,yBAAA;AAAA,cAEpC,6BAAA,EAA6B,CAAA,CAAA,SAAA;;;;;;;;;;;;KAE9B,uBAAA,GAA0B,CAAA,CAAE,KAAA,QAAa,6BAAA;AAAA,cAExC,+BAAA,EAA+B,CAAA,CAAA,SAAA;;;;KAKhC,yBAAA,GAA4B,CAAA,CAAE,KAAA,QAAa,+BAAA;;;cChB1C,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;KAMxB,iBAAA,GAAoB,CAAA,CAAE,KAAA,QAAa,uBAAA;AAAA,cAElC,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;;;;;;;;;;KAE5B,qBAAA,GAAwB,CAAA,CAAE,KAAA,QAAa,2BAAA;AAAA,cAEtC,6BAAA,EAA6B,CAAA,CAAA,SAAA;;;;KAK9B,uBAAA,GAA0B,CAAA,CAAE,KAAA,QAAa,6BAAA;;;cCjBxC,YAAA,EAAY,CAAA,CAAA,SAAA;;;;KAKb,MAAA,GAAS,CAAA,CAAE,KAAA,QAAa,YAAA;AAAA,cAEvB,gBAAA,EAAgB,CAAA,CAAA,SAAA;;;KAEjB,UAAA,GAAa,CAAA,CAA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UAAA,GAAc,IAAA,EAAM,QAAA,KAAW,IAAA;EAAU,IAAA;EAAkB,IAAA,EAAM,QAAA;AAAA;AAAA,cAIjE,OAAA,GAAW,IAAA,EAAM,QAAA,KAAW,IAAA;EAAU,IAAA;EAAe,IAAA,EAAM,KAAA;AAAA;AAAA,cAI3D,gBAAA,GAAoB,IAAA,EAAM,QAAA,KAAW,IAAA,IAAQ,sBAAA;AAAA,cAI7C,WAAA,GAAe,IAAA,EAAM,QAAA,KAAW,IAAA,IAAQ,iBAAA;AAAA,cAIxC,aAAA,GAAiB,IAAA,EAAM,QAAA,KAAW,IAAA,IAAQ,mBAAA;;;cCrB1C,iBAAA;;;cCCA,gBAAA,GAAoB,QAAA,EAAU,QAAA,KAAW,YAAA;;;cCIzC,cAAA,GACX,MAAA;EAAU,KAAA;EAAe,MAAA;AAAA,GACzB,QAAA,EAAU,QAAA,EACV,MAAA,EAAQ,MAAA,EACR,IAAA,EAAM,QAAA;EACH,QAAA;EAAkB,aAAA;AAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
|
+
import { v7 } from "uuid";
|
|
2
3
|
//#region src/events/client/host/kick-player.ts
|
|
3
4
|
const createKickPlayerEvent = (playerId) => ({
|
|
4
5
|
type: "KICK_PLAYER",
|
|
@@ -317,7 +318,7 @@ const QuestionSchema = z.discriminatedUnion("type", [
|
|
|
317
318
|
TrueFalseQuestionSchema,
|
|
318
319
|
ShortAnswerQuestionSchema
|
|
319
320
|
]);
|
|
320
|
-
z.discriminatedUnion("type", [
|
|
321
|
+
const SafeQuestionSchema = z.discriminatedUnion("type", [
|
|
321
322
|
SafeMultipleChoiceQuestionSchema,
|
|
322
323
|
SafeTrueFalseQuestionSchema,
|
|
323
324
|
SafeShortAnswerQuestionSchema
|
|
@@ -352,17 +353,12 @@ const MultipleChoiceQuestionAnswerSchema = z.object({
|
|
|
352
353
|
choices: z.array(z.number()).min(1)
|
|
353
354
|
});
|
|
354
355
|
//#endregion
|
|
355
|
-
//#region src/types/
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
background: z.hash("sha256", { error: "Invalid background hash" }).optional()
|
|
359
|
-
});
|
|
360
|
-
//#endregion
|
|
361
|
-
//#region src/types/slides/titleSlide.ts
|
|
362
|
-
const TitleSlideLayoutSchema = z.object({
|
|
363
|
-
slideType: z.literal("title"),
|
|
356
|
+
//#region src/types/slides/comparison.ts
|
|
357
|
+
const ComparisonSlideLayoutSchema = z.object({
|
|
358
|
+
slideType: z.literal("comparison"),
|
|
364
359
|
title: z.string(),
|
|
365
|
-
|
|
360
|
+
left: z.string(),
|
|
361
|
+
right: z.string()
|
|
366
362
|
});
|
|
367
363
|
//#endregion
|
|
368
364
|
//#region src/types/slides/titleImageTextSlide.ts
|
|
@@ -373,12 +369,17 @@ const TitleImageTextSlideLayoutSchema = z.object({
|
|
|
373
369
|
text: z.string()
|
|
374
370
|
});
|
|
375
371
|
//#endregion
|
|
376
|
-
//#region src/types/slides/
|
|
377
|
-
const
|
|
378
|
-
slideType: z.literal("
|
|
372
|
+
//#region src/types/slides/titleSlide.ts
|
|
373
|
+
const TitleSlideLayoutSchema = z.object({
|
|
374
|
+
slideType: z.literal("title"),
|
|
379
375
|
title: z.string(),
|
|
380
|
-
|
|
381
|
-
|
|
376
|
+
subtitle: z.string().optional()
|
|
377
|
+
});
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/types/quiztheme.ts
|
|
380
|
+
const QuizThemeSchema = z.object({
|
|
381
|
+
color: z.string().regex(/^#[0-9a-fA-F]{6}$/, { message: "Invalid color format. Must be a 7-character hex code (e.g., #RRGGBB)." }),
|
|
382
|
+
background: z.hash("sha256", { error: "Invalid background hash" }).optional()
|
|
382
383
|
});
|
|
383
384
|
//#endregion
|
|
384
385
|
//#region src/types/slide.ts
|
|
@@ -500,6 +501,9 @@ const generateUniqueName = (players) => {
|
|
|
500
501
|
throw new Error("No unique names available");
|
|
501
502
|
};
|
|
502
503
|
//#endregion
|
|
504
|
+
//#region src/util/id.ts
|
|
505
|
+
const createWebsocketId = () => v7();
|
|
506
|
+
//#endregion
|
|
503
507
|
//#region src/util/sanitizer.ts
|
|
504
508
|
const sanitizeQuestion = (question) => {
|
|
505
509
|
if (isMultipleChoice(question)) return {
|
|
@@ -517,6 +521,6 @@ const sanitizeQuestion = (question) => {
|
|
|
517
521
|
throw new Error("Invalid question type");
|
|
518
522
|
};
|
|
519
523
|
//#endregion
|
|
520
|
-
export { ChoiceSchema, LobbyStatus, MultipleChoiceQuestionAnswerSchema, MultipleChoiceQuestionSchema, QuizFileSchema, SafeChoiceSchema, SafeMultipleChoiceQuestionSchema, SafeShortAnswerQuestionSchema, SafeTrueFalseQuestionSchema, ShortAnswerQuestionAnswerSchema, ShortAnswerQuestionSchema, TrueFalseQuestionAnswerSchema, TrueFalseQuestionSchema, advanceLobby, calculateScore, createKickPlayerEvent, createLobby, createLobbyDeletedEvent, createLobbyJoinedEvent, createLobbyStatusUpdateEvent, createNextStepEvent, createPlayerAnswerResultEvent, createPlayerJoinedEvent, createPlayerKickedEvent, createPlayerLeftEvent, createPlayerUpdateEvent, createStartLobbyEvent, createSubmitAnswerEvent, createUpdateLobbyAnswersEvent, generateName, generateUniqueName, handleSubmission, isCorrect, isMultipleChoice, isQuestion, isShortAnswer, isSlide, isTrueFalse, sanitizeQuestion };
|
|
524
|
+
export { BaseQuestionSchema, ChoiceSchema, ComparisonSlideLayoutSchema, LobbyStatus, MultipleChoiceQuestionAnswerSchema, MultipleChoiceQuestionSchema, QuestionPointsSchema, QuestionSchema, QuizFileSchema, QuizStepSchema, QuizThemeSchema, SafeChoiceSchema, SafeMultipleChoiceQuestionSchema, SafeQuestionSchema, SafeShortAnswerQuestionSchema, SafeTrueFalseQuestionSchema, ShortAnswerQuestionAnswerSchema, ShortAnswerQuestionSchema, SlideSchema, TitleImageTextSlideLayoutSchema, TitleSlideLayoutSchema, TrueFalseQuestionAnswerSchema, TrueFalseQuestionSchema, advanceLobby, calculateScore, createKickPlayerEvent, createLobby, createLobbyDeletedEvent, createLobbyJoinedEvent, createLobbyStatusUpdateEvent, createNextStepEvent, createPlayerAnswerResultEvent, createPlayerJoinedEvent, createPlayerKickedEvent, createPlayerLeftEvent, createPlayerUpdateEvent, createStartLobbyEvent, createSubmitAnswerEvent, createUpdateLobbyAnswersEvent, createWebsocketId, generateName, generateUniqueName, handleSubmission, isCorrect, isMultipleChoice, isQuestion, isShortAnswer, isSlide, isTrueFalse, sanitizeQuestion };
|
|
521
525
|
|
|
522
526
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["animals","additives","colors"],"sources":["../src/events/client/host/kick-player.ts","../src/events/client/host/next-step.ts","../src/events/client/host/start-lobby.ts","../src/events/client/player/submit-answer.ts","../src/events/server/lobby-deleted.ts","../src/events/server/lobby-joined.ts","../src/events/server/lobby-status-update.ts","../src/events/server/player-answer-result.ts","../src/events/server/player-joined.ts","../src/events/server/player-kicked.ts","../src/events/server/player-left.ts","../src/events/server/player-update.ts","../src/events/server/update-lobby-answers.ts","../src/types/lobby.ts","../src/util/guards.ts","../src/util/score.ts","../src/util/validator.ts","../src/managers/lobby-manager.ts","../src/types/questions/true-false.ts","../src/types/questions/short-answer.ts","../src/types/question.ts","../src/types/questions/multiple-choice.ts","../src/types/quiztheme.ts","../src/types/slides/titleSlide.ts","../src/types/slides/titleImageTextSlide.ts","../src/types/slides/comparison.ts","../src/types/slide.ts","../src/types/quizstep.ts","../src/types/quizfile.ts","../src/util/names/animals.json","../src/util/names/additives.json","../src/util/names/colors.json","../src/util/names/names.ts","../src/util/sanitizer.ts"],"sourcesContent":["export type KickPlayer = {\n type: \"KICK_PLAYER\";\n payload: { playerId: string };\n};\n\nexport const createKickPlayerEvent = (playerId: string): KickPlayer => ({\n type: \"KICK_PLAYER\",\n payload: { playerId }\n});","export type NextStep = {\n type: \"NEXT_STEP\";\n};\n\nexport const createNextStepEvent = (): NextStep => ({\n type: \"NEXT_STEP\",\n});","export type StartLobby = {\n type: \"START_LOBBY\";\n payload: {};\n};\n\nexport const createStartLobbyEvent = (): StartLobby => ({\n type: \"START_LOBBY\",\n payload: {}\n});","import { SubmittedAnswer } from \"../../../util/validator\";\n\nexport type SubmitAnswer = {\n type: \"SUBMIT_ANSWER\";\n payload: { submission: SubmittedAnswer };\n};\n\nexport const createSubmitAnswerEvent = (submission: SubmittedAnswer): SubmitAnswer => ({\n type: \"SUBMIT_ANSWER\",\n payload: { submission }\n});","export type LobbyDeleted = {\n type: \"LOBBY_DELETED\";\n payload: { reason: string };\n};\n\nexport const createLobbyDeletedEvent = (reason: string): LobbyDeleted => ({\n type: \"LOBBY_DELETED\",\n payload: { reason }\n});","import { Lobby, Player } from \"../../types/lobby\";\nimport { Answer } from \"../../util/validator\";\n\nexport type LobbyJoined = {\n type: \"LOBBY_JOINED\";\n payload: { \n lobby: Omit<Lobby, \"host\" | \"quiz\" | \"players\" | \"currentAnswers\" | \"answers\">;\n me?: Player;\n players?: Player[];\n currentAnswers?: Answer[];\n answers?: Answer[];\n };\n};\n\nexport const createLobbyJoinedEvent = (\n lobby: Lobby, \n me: Player, \n isHost: boolean\n): LobbyJoined => ({\n type: \"LOBBY_JOINED\",\n payload: {\n lobby: {\n code: lobby.code,\n quizInfo: lobby.quizInfo,\n status: lobby.status,\n timeoutStartedAt: lobby.timeoutStartedAt,\n duration: lobby.duration,\n currentStep: lobby.currentStep,\n settings: lobby.settings,\n },\n me,\n players: isHost ? lobby.players : undefined,\n currentAnswers: isHost ? lobby.currentAnswers : undefined,\n answers: isHost ? lobby.answers : undefined,\n }\n});","import { LobbyStatus, Player } from \"../../types/lobby\";\nimport { SafeQuestion } from \"../../types/question\";\nimport { Slide } from \"../../types/slide\";\nimport { Answer } from \"../../util/validator\";\n\nexport type LobbyStatusUpdate = {\n type: \"LOBBY_STATUS_UPDATE\";\n payload: \n | { status: LobbyStatus.waiting }\n | { status: LobbyStatus.slide; slide: Slide }\n | { status: LobbyStatus.question; question: SafeQuestion; timeoutStartedAt: number; duration: number }\n | { status: LobbyStatus.answer; timeoutStartedAt: number; duration: number }\n | { status: LobbyStatus.answers; answers: Answer[] }\n | { status: LobbyStatus.score; leaderboard: Player[] }\n | { status: LobbyStatus.end };\n};\n\nexport const createLobbyStatusUpdateEvent = (\n payload: LobbyStatusUpdate[\"payload\"]\n): LobbyStatusUpdate => ({\n type: \"LOBBY_STATUS_UPDATE\",\n payload,\n});","export type PlayerAnswerResult = {\n type: \"PLAYER_ANSWER_RESULT\";\n payload: {\n isCorrect: boolean;\n pointsAwarded: number;\n score: number;\n streak: number;\n };\n};\n\nexport const createPlayerAnswerResultEvent = (\n isCorrect: boolean, \n pointsAwarded: number, \n score: number, \n streak: number\n): PlayerAnswerResult => ({\n type: \"PLAYER_ANSWER_RESULT\",\n payload: { isCorrect, pointsAwarded, score, streak }\n});","import { Player } from \"../../types/lobby\";\n\nexport type PlayerJoined = {\n type: \"PLAYER_JOINED\";\n payload: { player: Player };\n};\n\nexport const createPlayerJoinedEvent = (player: Player): PlayerJoined => ({\n type: \"PLAYER_JOINED\",\n payload: { player }\n});","export type PlayerKicked = {\n type: \"PLAYER_KICKED\";\n payload: {};\n};\n\nexport const createPlayerKickedEvent = (): PlayerKicked => ({\n type: \"PLAYER_KICKED\",\n payload: {}\n});","import { Player } from \"../../types/lobby\";\n\nexport type PlayerLeft = {\n type: \"PLAYER_LEFT\";\n payload: { player: Player };\n};\n\nexport const createPlayerLeftEvent = (player: Player): PlayerLeft => ({\n type: \"PLAYER_LEFT\",\n payload: { player }\n});","import { Player } from \"../../types/lobby\";\n\nexport type PlayerUpdate = {\n type: \"PLAYER_UPDATE\";\n payload: { player: Player };\n};\n\nexport const createPlayerUpdateEvent = (player: Player): PlayerUpdate => ({\n type: \"PLAYER_UPDATE\",\n payload: { player }\n});","export type UpdateLobbyAnswers = {\n type: \"UPDATE_LOBBY_ANSWERS\";\n payload: { count: number };\n};\n\nexport const createUpdateLobbyAnswersEvent = (count: number): UpdateLobbyAnswers => ({\n type: \"UPDATE_LOBBY_ANSWERS\",\n payload: { count }\n});","import { Answer } from \"../util/validator\";\nimport { QuizFile } from \"./quizfile\";\nimport { QuizTheme } from \"./quiztheme\";\n\nexport type Lobby = {\n code: string;\n host: string; // Id of the WebSocket connection\n quiz: QuizFile;\n quizInfo: {\n title: string;\n stepCount: number;\n theme: QuizTheme;\n };\n players: Player[];\n status: LobbyStatus;\n timeoutStartedAt: number | null;\n duration: number | null;\n currentStep: number;\n currentAnswers: Answer[];\n answers: Answer[];\n settings: LobbySettings;\n}\n\nexport type LobbySettings = {\n customNames: boolean;\n displayOnDevice: boolean;\n}\n\nexport enum LobbyStatus {\n waiting = 'waiting',\n slide = 'slide',\n question = 'question',\n answer = 'answer',\n answers = 'answers',\n score = 'score',\n end = 'end',\n}\n\nexport type Player = {\n id: string;\n name: string;\n score: number;\n streak: number;\n isConnected: boolean;\n}","import { Question } from \"../types/question\";\nimport { MultipleChoiceQuestion } from \"../types/questions/multiple-choice\";\nimport { ShortAnswerQuestion } from \"../types/questions/short-answer\";\nimport { TrueFalseQuestion } from \"../types/questions/true-false\";\nimport { QuizStep } from \"../types/quizstep\";\nimport { Slide } from \"../types/slide\";\n\nexport const isQuestion = (step: QuizStep): step is { type: \"question\"; data: Question } => {\n return step.type === \"question\";\n};\n\nexport const isSlide = (step: QuizStep): step is { type: \"slide\"; data: Slide } => {\n return step.type === \"slide\";\n};\n\nexport const isMultipleChoice = (data: Question): data is MultipleChoiceQuestion => {\n return data.type === \"multiple-choice\";\n};\n\nexport const isTrueFalse = (data: Question): data is TrueFalseQuestion => {\n return data.type === \"true-false\";\n};\n\nexport const isShortAnswer = (data: Question): data is ShortAnswerQuestion => {\n return data.type === \"short-answer\";\n};","import { Answer } from \"./validator\";\nimport { QuizFile } from \"../types/quizfile\";\nimport { Question } from \"../types/question\";\n\nconst BASE_SCORE = 500;\nconst TIME_BONUS_MAX = 500;\n\nexport const calculateScore = (\n player: { score: number; streak: number },\n question: Question,\n answer: Answer,\n quiz: QuizFile\n): { newScore: number; pointsAwarded: number } => {\n if (!answer.isCorrect) return { newScore: player.score, pointsAwarded: 0 };\n\n const multipliers: Record<string, number> = {\n noPoints: 0,\n normalPoints: 1,\n doublePoints: 2,\n };\n const pointMultiplier = multipliers[question.points] ?? 1;\n if (pointMultiplier === 0) return { newScore: player.score, pointsAwarded: 0 };\n\n let timeBonus = 0;\n if (question.timeLimit > 0) {\n const timeLimitMs = question.timeLimit * 1000;\n const timeTaken = Math.max(0, Math.min(answer.timeTaken, timeLimitMs));\n const timeRemainingRatio = 1 - (timeTaken / timeLimitMs);\n timeBonus = TIME_BONUS_MAX * timeRemainingRatio;\n }\n\n let questionScore = (BASE_SCORE + timeBonus) * pointMultiplier;\n\n if (player.streak >= 2) {\n const totalQuestions = quiz.steps.filter(s => s.type === \"question\").length;\n \n const dynamicCap = Math.min(1.2 + Math.max(0, totalQuestions - 5) * 0.02, 1.5);\n const streakMultiplier = Math.min(1 + (player.streak - 1) * 0.05, dynamicCap);\n \n questionScore *= streakMultiplier;\n }\n\n const finalPoints = Math.trunc(questionScore);\n return {\n newScore: player.score + finalPoints,\n pointsAwarded: finalPoints\n };\n};","import { isMultipleChoice, isShortAnswer, isTrueFalse } from \"../util/guards\";\nimport { ShortAnswerQuestionAnswer } from \"../types/questions/short-answer\";\nimport { TrueFalseQuestionAnswer } from \"../types/questions/true-false\";\nimport { MultipleChoiceQuestionAnswer } from \"../types/questions/multiple-choice\";\nimport { Question } from \"../types/question\";\n\nexport type SubmittedAnswer = \n | MultipleChoiceQuestionAnswer\n | TrueFalseQuestionAnswer \n | ShortAnswerQuestionAnswer;\n\nexport interface Answer {\n playerId: string;\n submission: SubmittedAnswer;\n timeTaken: number;\n isCorrect: boolean;\n pointsAwarded: number;\n};\n\nexport const isCorrect = (question: Question, submission: SubmittedAnswer): boolean => {\n if (isMultipleChoice(question) && submission.type === \"multiple-choice\") {\n if (question.matchAll) {\n const correctIndices = question.choices\n .map((c, i) => (c.correct ? i : -1))\n .filter((i) => i !== -1);\n\n return (\n submission.choices.length === correctIndices.length &&\n submission.choices.every((index) => correctIndices.includes(index))\n );\n }\n\n if (submission.choices.length === 0) return false;\n\n return submission.choices.every(index => {\n const choice = question.choices[index];\n return choice ? choice.correct : false;\n });\n }\n\n if (isTrueFalse(question) && submission.type === \"true-false\") {\n return question.answer === submission.answer;\n }\n\n if (isShortAnswer(question) && submission.type === \"short-answer\") {\n const playerAns = submission.answer.trim().toLowerCase();\n return question.answers.some(ans => ans.trim().toLowerCase() === playerAns);\n }\n\n return false;\n};","import { PlayerAnswerResult } from \"../events/server/player-answer-result\";\nimport { Lobby, LobbyStatus } from \"../types/lobby\";\nimport { QuizFile } from \"../types/quizfile\";\nimport { isQuestion } from \"../util/guards\";\nimport { calculateScore } from \"../util/score\";\nimport { Answer, isCorrect, SubmittedAnswer } from \"../util/validator\";\n\nexport const createLobby = (\n code: string, \n hostId: string, \n quiz: QuizFile\n): Lobby => ({\n code,\n host: hostId,\n quiz,\n quizInfo: {\n title: quiz.title,\n stepCount: quiz.steps.length,\n theme: quiz.theme\n },\n players: [],\n status: LobbyStatus.waiting,\n currentStep: 0,\n timeoutStartedAt: null,\n duration: null,\n currentAnswers: [],\n answers: [],\n settings: { customNames: true, displayOnDevice: true }\n});\n\nexport const advanceLobby = (lobby: Lobby): Lobby => {\n const isLastStep = lobby.currentStep >= lobby.quiz.steps.length - 1;\n\n switch (lobby.status) {\n case LobbyStatus.waiting:\n return prepareStep(lobby, 0);\n\n case LobbyStatus.slide:\n case LobbyStatus.score:\n return isLastStep \n ? { ...lobby, status: LobbyStatus.end } \n : prepareStep(lobby, lobby.currentStep + 1);\n\n case LobbyStatus.question: {\n const step = lobby.quiz.steps[lobby.currentStep];\n if (step.type !== 'question') return lobby;\n\n return { \n ...lobby, \n status: LobbyStatus.answer, \n timeoutStartedAt: Date.now(), \n duration: step.data.timeLimit * 1000,\n currentAnswers: [] \n };\n }\n\n case LobbyStatus.answer:\n return { ...lobby, status: LobbyStatus.answers };\n\n case LobbyStatus.answers:\n return { ...lobby, status: LobbyStatus.score };\n\n default:\n return lobby;\n }\n};\n\n// Prepares the lobby for the next step\nconst prepareStep = (lobby: Lobby, index: number): Lobby => {\n const step = lobby.quiz.steps[index];\n \n if (!step) return lobby;\n\n if (step.type === \"slide\") {\n return { \n ...lobby, \n status: LobbyStatus.slide, \n currentStep: index \n };\n }\n\n return { \n ...lobby, \n status: LobbyStatus.question, \n currentStep: index,\n timeoutStartedAt: null,\n duration: null,\n currentAnswers: []\n };\n};\n\nexport type SubmissionResult = {\n nextLobby: Lobby;\n result: PlayerAnswerResult;\n};\n\nexport const handleSubmission = (\n lobby: Lobby, \n playerId: string, \n submission: SubmittedAnswer\n): SubmissionResult | null => {\n if (lobby.status !== LobbyStatus.answer) return null;\n\n const step = lobby.quiz.steps[lobby.currentStep];\n if (!isQuestion(step)) return null;\n\n const player = lobby.players.find(p => p.id === playerId);\n if (!player) return null;\n\n if (lobby.currentAnswers.some(a => a.playerId === playerId)) return null;\n\n const correct = isCorrect(step.data, submission);\n const timeTaken = Date.now() - (lobby.timeoutStartedAt ?? 0);\n\n const answerObj: Answer = {\n playerId,\n submission,\n timeTaken,\n isCorrect: correct,\n pointsAwarded: 0\n };\n\n const { newScore, pointsAwarded } = calculateScore(player, step.data, answerObj, lobby.quiz);\n answerObj.pointsAwarded = pointsAwarded;\n\n const nextLobby: Lobby = {\n ...lobby,\n players: lobby.players.map(p => p.id === playerId ? {\n ...p,\n score: newScore,\n streak: correct ? p.streak + 1 : 0\n } : p),\n currentAnswers: [...lobby.currentAnswers, answerObj]\n };\n\n return {\n nextLobby,\n result: {\n type: \"PLAYER_ANSWER_RESULT\",\n payload: { isCorrect: correct, pointsAwarded, score: newScore, streak: correct ? player.streak + 1 : 0 }\n }\n };\n};","import z from \"zod\";\nimport { BaseQuestionSchema } from \"../question\";\n\nexport const TrueFalseQuestionSchema = BaseQuestionSchema.extend({\n type: z.literal(\"true-false\"),\n answer: z.boolean(),\n labels: z.array(z.string()).min(2).max(2),\n});\n\nexport type TrueFalseQuestion = z.infer<typeof TrueFalseQuestionSchema>;\n\nexport const SafeTrueFalseQuestionSchema = TrueFalseQuestionSchema.omit({ answer: true });\n\nexport type SafeTrueFalseQuestion = z.infer<typeof SafeTrueFalseQuestionSchema>;\n\nexport const TrueFalseQuestionAnswerSchema = z.object({\n type: z.literal(\"true-false\"),\n answer: z.boolean(),\n});\n\nexport type TrueFalseQuestionAnswer = z.infer<typeof TrueFalseQuestionAnswerSchema>;\n","import z from \"zod\";\nimport { BaseQuestionSchema } from \"../question\";\n\nexport const ShortAnswerQuestionSchema = BaseQuestionSchema.extend({\n type: z.literal(\"short-answer\"),\n answers: z.array(z.string()).min(1),\n});\n\nexport type ShortAnswerQuestion = z.infer<typeof ShortAnswerQuestionSchema>;\n\nexport const SafeShortAnswerQuestionSchema = ShortAnswerQuestionSchema.omit({ answers: true });\n\nexport type SafeShortAnswerQuestion = z.infer<typeof SafeShortAnswerQuestionSchema>;\n\nexport const ShortAnswerQuestionAnswerSchema = z.object({\n type: z.literal(\"short-answer\"),\n answer: z.string(),\n});\n\nexport type ShortAnswerQuestionAnswer = z.infer<typeof ShortAnswerQuestionAnswerSchema>;\n","import z from \"zod\";\nimport { MultipleChoiceQuestion, MultipleChoiceQuestionSchema, SafeMultipleChoiceQuestion, SafeMultipleChoiceQuestionSchema } from \"./questions/multiple-choice\";\nimport { SafeTrueFalseQuestion, SafeTrueFalseQuestionSchema, TrueFalseQuestion, TrueFalseQuestionSchema } from \"./questions/true-false\";\nimport { SafeShortAnswerQuestion, SafeShortAnswerQuestionSchema, ShortAnswerQuestion, ShortAnswerQuestionSchema } from \"./questions/short-answer\";\n\nexport type Question = MultipleChoiceQuestion | TrueFalseQuestion | ShortAnswerQuestion;\n\nexport const QuestionSchema = z.discriminatedUnion(\"type\", [\n MultipleChoiceQuestionSchema,\n TrueFalseQuestionSchema,\n ShortAnswerQuestionSchema,\n]);\n\nexport type SafeQuestion =\n | SafeMultipleChoiceQuestion\n | SafeTrueFalseQuestion\n | SafeShortAnswerQuestion;\n\nexport const SafeQuestionSchema = z.discriminatedUnion(\"type\", [\n SafeMultipleChoiceQuestionSchema,\n SafeTrueFalseQuestionSchema,\n SafeShortAnswerQuestionSchema,\n]);\n\nexport type QuestionPoints = z.infer<typeof QuestionPointsSchema>;\n\nexport const QuestionPointsSchema = z.enum([\"normalPoints\", \"doublePoints\", \"noPoints\"]);\n\nexport type BaseQuestion = z.infer<typeof BaseQuestionSchema>;\n\nexport const BaseQuestionSchema = z.object({\n question: z.string().min(1),\n imageHash: z.hash(\"sha256\", { error: \"Invalid image hash\" }).optional(),\n displayTime: z.number().min(1).max(60),\n timeLimit: z.number().min(1).max(180),\n points: QuestionPointsSchema,\n});","import z from \"zod\";\nimport { BaseQuestionSchema } from \"../question\";\n\nexport const ChoiceSchema = z.object({\n text: z.string(),\n correct: z.boolean(),\n});\n\nexport type Choice = z.infer<typeof ChoiceSchema>;\n\nexport const SafeChoiceSchema = ChoiceSchema.omit({ correct: true });\n\nexport type SafeChoice = z.infer<typeof SafeChoiceSchema>;\n\nexport const MultipleChoiceQuestionSchema = BaseQuestionSchema.extend({\n type: z.literal(\"multiple-choice\"),\n choices: z.array(ChoiceSchema).min(2),\n matchAll: z.boolean(),\n});\n\nexport type MultipleChoiceQuestion = z.infer<typeof MultipleChoiceQuestionSchema>;\n\nexport const SafeMultipleChoiceQuestionSchema = MultipleChoiceQuestionSchema.omit({ \n choices: true \n}).extend({\n choices: z.array(SafeChoiceSchema).min(2),\n});\n\nexport type SafeMultipleChoiceQuestion = z.infer<typeof SafeMultipleChoiceQuestionSchema>;\n\nexport const MultipleChoiceQuestionAnswerSchema = z.object({\n type: z.literal(\"multiple-choice\"),\n choices: z.array(z.number()).min(1),\n});\n\nexport type MultipleChoiceQuestionAnswer = z.infer<typeof MultipleChoiceQuestionAnswerSchema>;","import z from \"zod\";\n\nexport type QuizTheme = z.infer<typeof QuizThemeSchema>;\n\nexport const QuizThemeSchema = z.object({\n color: z.string().regex(\n /^#[0-9a-fA-F]{6}$/,\n { message: 'Invalid color format. Must be a 7-character hex code (e.g., #RRGGBB).' }\n ),\n background: z.hash(\"sha256\", { error: \"Invalid background hash\" }).optional(),\n});","import z from \"zod\";\n\nexport const TitleSlideLayoutSchema = z.object({\n slideType: z.literal(\"title\"),\n title: z.string(),\n subtitle: z.string().optional(),\n});\n\nexport type TitleSlideLayout = z.infer<typeof TitleSlideLayoutSchema>;","import z from \"zod\";\n\nexport const TitleImageTextSlideLayoutSchema = z.object({\n slideType: z.literal(\"titleImageText\"),\n title: z.string(),\n imageHash: z.hash(\"sha256\", { error: \"Invalid image hash\" }).optional(),\n text: z.string(),\n});\n\nexport type TitleImageTextSlideLayout = z.infer<typeof TitleImageTextSlideLayoutSchema>;\n","import z from \"zod\";\n\nexport const ComparisonSlideLayoutSchema = z.object({\n slideType: z.literal(\"comparison\"),\n title: z.string(),\n left: z.string(),\n right: z.string(),\n});\n\nexport type ComparisonSlideLayout = z.infer<typeof ComparisonSlideLayoutSchema>;\n","import z from \"zod\";\nimport { TitleSlideLayoutSchema } from \"./slides/titleSlide\";\nimport { TitleImageTextSlideLayoutSchema } from \"./slides/titleImageTextSlide\";\nimport { ComparisonSlideLayoutSchema } from \"./slides/comparison\";\n\nexport type Slide = z.infer<typeof SlideSchema>;\n\nexport const SlideSchema = z.discriminatedUnion(\"slideType\", [\n TitleSlideLayoutSchema,\n TitleImageTextSlideLayoutSchema,\n ComparisonSlideLayoutSchema\n]);\n","import z from \"zod\";\nimport { Question, QuestionSchema } from \"./question\";\nimport { Slide, SlideSchema } from \"./slide\";\n\nexport type QuizStep =\n | {\n type: \"question\";\n data: Question;\n }\n | {\n type: \"slide\";\n data: Slide;\n };\n\nexport const QuizStepSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"question\"), data: QuestionSchema }),\n z.object({ type: z.literal(\"slide\"), data: SlideSchema }),\n]);","import z from \"zod\";\nimport { QuizThemeSchema } from \"./quiztheme\";\nimport { QuizStepSchema } from \"./quizstep\";\n\nexport type QuizFile = z.infer<typeof QuizFileSchema>;\n\nexport const QuizFileSchema = z.object({\n id: z.uuid(),\n version: z.literal(2),\n\n title: z.string()\n .min(1, \"Title must be atleast 1 character long\")\n .max(64, \"Title can't be longer than 64 characters\"),\n description: z.string()\n .max(255, \"Description can't be longer than 256 characters\")\n .optional(),\n theme: QuizThemeSchema,\n language: z.string()\n .length(2, \"Language must be a 2-letter ISO 639-1 code\"),\n\n steps: z.array(QuizStepSchema)\n .min(1, \"Quiz must have at least 1 step\"),\n\n images: z.record(\n z.hash(\"sha256\", { error: \"Invalid image hash\" }),\n z.string().refine((val) => {\n return val.startsWith(\"http\") || val.startsWith(\"data:image/\");\n }, \"Image must be a valid URL or Base64 data string\")\n ),\n\n updatedAt: z.iso.datetime(),\n createdAt: z.iso.datetime(),\n});","","","","import animals from \"./animals.json\";\nimport additives from \"./additives.json\";\nimport colors from \"./colors.json\";\nimport { Player } from \"../../types/lobby\";\n\nexport const generateName = (): string => {\n const animal = animals[Math.floor(Math.random() * animals.length)];\n const additive = additives[Math.floor(Math.random() * additives.length)];\n const color = colors[Math.floor(Math.random() * colors.length)];\n\n return `${color}${additive}${animal}`;\n};\n\nexport const generateUniqueName = (players: Player[]): string => {\n const maxPossible = animals.length * additives.length * colors.length;\n\n if (players.length >= maxPossible) {\n throw new Error(\"No unique names available\");\n }\n\n const existingNames = new Set(players.map((p) => p.name));\n \n for (let i = 0; i < 100; i++) {\n const candidate = generateName();\n if (!existingNames.has(candidate)) return candidate;\n }\n\n for (const c of colors) {\n for (const ad of additives) {\n for (const an of animals) {\n const candidate = `${c}${ad}${an}`;\n if (!existingNames.has(candidate)) return candidate;\n }\n }\n }\n\n throw new Error(\"No unique names available\"); // Fallback\n};","import { Question, SafeQuestion } from \"../types/question\";\nimport { isMultipleChoice, isShortAnswer, isTrueFalse } from \"./guards\";\n\nexport const sanitizeQuestion = (question: Question): SafeQuestion => {\n if (isMultipleChoice(question)) {\n return {\n ...question,\n choices: question.choices.map(({ text }) => ({ text })),\n };\n }\n\n if (isTrueFalse(question)) {\n const { answer, ...sanitized } = question;\n return sanitized;\n }\n\n if (isShortAnswer(question)) {\n const { answers, ...sanitized } = question;\n return sanitized;\n }\n\n throw new Error(\"Invalid question type\");\n};"],"mappings":";;AAKA,MAAa,yBAAyB,cAAkC;CACtE,MAAM;CACN,SAAS,EAAE,UAAU;CACtB;;;ACJD,MAAa,6BAAuC,EAClD,MAAM,aACP;;;ACDD,MAAa,+BAA2C;CACtD,MAAM;CACN,SAAS,EAAE;CACZ;;;ACDD,MAAa,2BAA2B,gBAA+C;CACrF,MAAM;CACN,SAAS,EAAE,YAAY;CACxB;;;ACLD,MAAa,2BAA2B,YAAkC;CACxE,MAAM;CACN,SAAS,EAAE,QAAQ;CACpB;;;ACMD,MAAa,0BACX,OACA,IACA,YACiB;CACjB,MAAM;CACN,SAAS;EACP,OAAO;GACL,MAAM,MAAM;GACZ,UAAU,MAAM;GAChB,QAAQ,MAAM;GACd,kBAAkB,MAAM;GACxB,UAAU,MAAM;GAChB,aAAa,MAAM;GACnB,UAAU,MAAM;GACjB;EACD;EACA,SAAS,SAAS,MAAM,UAAU,KAAA;EAClC,gBAAgB,SAAS,MAAM,iBAAiB,KAAA;EAChD,SAAS,SAAS,MAAM,UAAU,KAAA;EACnC;CACF;;;AClBD,MAAa,gCACX,aACuB;CACvB,MAAM;CACN;CACD;;;ACZD,MAAa,iCACX,WACA,eACA,OACA,YACwB;CACxB,MAAM;CACN,SAAS;EAAE;EAAW;EAAe;EAAO;EAAQ;CACrD;;;ACXD,MAAa,2BAA2B,YAAkC;CACxE,MAAM;CACN,SAAS,EAAE,QAAQ;CACpB;;;ACLD,MAAa,iCAA+C;CAC1D,MAAM;CACN,SAAS,EAAE;CACZ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B,QAAO;EACL,GAAG;EACH,SAAS,SAAS,QAAQ,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE;EACxD;AAGH,KAAI,YAAY,SAAS,EAAE;EACzB,MAAM,EAAE,QAAQ,GAAG,cAAc;AACjC,SAAO;;AAGT,KAAI,cAAc,SAAS,EAAE;EAC3B,MAAM,EAAE,SAAS,GAAG,cAAc;AAClC,SAAO;;AAGT,OAAM,IAAI,MAAM,wBAAwB"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["animals","additives","colors"],"sources":["../src/events/client/host/kick-player.ts","../src/events/client/host/next-step.ts","../src/events/client/host/start-lobby.ts","../src/events/client/player/submit-answer.ts","../src/events/server/lobby-deleted.ts","../src/events/server/lobby-joined.ts","../src/events/server/lobby-status-update.ts","../src/events/server/player-answer-result.ts","../src/events/server/player-joined.ts","../src/events/server/player-kicked.ts","../src/events/server/player-left.ts","../src/events/server/player-update.ts","../src/events/server/update-lobby-answers.ts","../src/types/lobby.ts","../src/util/guards.ts","../src/util/score.ts","../src/util/validator.ts","../src/managers/lobby-manager.ts","../src/types/questions/true-false.ts","../src/types/questions/short-answer.ts","../src/types/question.ts","../src/types/questions/multiple-choice.ts","../src/types/slides/comparison.ts","../src/types/slides/titleImageTextSlide.ts","../src/types/slides/titleSlide.ts","../src/types/quiztheme.ts","../src/types/slide.ts","../src/types/quizstep.ts","../src/types/quizfile.ts","../src/util/names/animals.json","../src/util/names/additives.json","../src/util/names/colors.json","../src/util/names/names.ts","../src/util/id.ts","../src/util/sanitizer.ts"],"sourcesContent":["export type KickPlayer = {\n type: \"KICK_PLAYER\";\n payload: { playerId: string };\n};\n\nexport const createKickPlayerEvent = (playerId: string): KickPlayer => ({\n type: \"KICK_PLAYER\",\n payload: { playerId }\n});","export type NextStep = {\n type: \"NEXT_STEP\";\n};\n\nexport const createNextStepEvent = (): NextStep => ({\n type: \"NEXT_STEP\",\n});","export type StartLobby = {\n type: \"START_LOBBY\";\n payload: {};\n};\n\nexport const createStartLobbyEvent = (): StartLobby => ({\n type: \"START_LOBBY\",\n payload: {}\n});","import { SubmittedAnswer } from \"../../../util/validator\";\n\nexport type SubmitAnswer = {\n type: \"SUBMIT_ANSWER\";\n payload: { submission: SubmittedAnswer };\n};\n\nexport const createSubmitAnswerEvent = (submission: SubmittedAnswer): SubmitAnswer => ({\n type: \"SUBMIT_ANSWER\",\n payload: { submission }\n});","export type LobbyDeleted = {\n type: \"LOBBY_DELETED\";\n payload: { reason: string };\n};\n\nexport const createLobbyDeletedEvent = (reason: string): LobbyDeleted => ({\n type: \"LOBBY_DELETED\",\n payload: { reason }\n});","import { Lobby, Player } from \"../../types/lobby\";\nimport { Answer } from \"../../util/validator\";\n\nexport type LobbyJoined = {\n type: \"LOBBY_JOINED\";\n payload: { \n lobby: Omit<Lobby, \"host\" | \"quiz\" | \"players\" | \"currentAnswers\" | \"answers\">;\n me?: Player;\n players?: Player[];\n currentAnswers?: Answer[];\n answers?: Answer[];\n };\n};\n\nexport const createLobbyJoinedEvent = (\n lobby: Lobby, \n me: Player, \n isHost: boolean\n): LobbyJoined => ({\n type: \"LOBBY_JOINED\",\n payload: {\n lobby: {\n code: lobby.code,\n quizInfo: lobby.quizInfo,\n status: lobby.status,\n timeoutStartedAt: lobby.timeoutStartedAt,\n duration: lobby.duration,\n currentStep: lobby.currentStep,\n settings: lobby.settings,\n },\n me,\n players: isHost ? lobby.players : undefined,\n currentAnswers: isHost ? lobby.currentAnswers : undefined,\n answers: isHost ? lobby.answers : undefined,\n }\n});","import { LobbyStatus, Player } from \"../../types/lobby\";\nimport { SafeQuestion } from \"../../types/question\";\nimport { Slide } from \"../../types/slide\";\nimport { Answer } from \"../../util/validator\";\n\nexport type LobbyStatusUpdate = {\n type: \"LOBBY_STATUS_UPDATE\";\n payload: \n | { status: LobbyStatus.waiting }\n | { status: LobbyStatus.slide; slide: Slide }\n | { status: LobbyStatus.question; question: SafeQuestion; timeoutStartedAt: number; duration: number }\n | { status: LobbyStatus.answer; timeoutStartedAt: number; duration: number }\n | { status: LobbyStatus.answers; answers: Answer[] }\n | { status: LobbyStatus.score; leaderboard: Player[] }\n | { status: LobbyStatus.end };\n};\n\nexport const createLobbyStatusUpdateEvent = (\n payload: LobbyStatusUpdate[\"payload\"]\n): LobbyStatusUpdate => ({\n type: \"LOBBY_STATUS_UPDATE\",\n payload,\n});","export type PlayerAnswerResult = {\n type: \"PLAYER_ANSWER_RESULT\";\n payload: {\n isCorrect: boolean;\n pointsAwarded: number;\n score: number;\n streak: number;\n };\n};\n\nexport const createPlayerAnswerResultEvent = (\n isCorrect: boolean, \n pointsAwarded: number, \n score: number, \n streak: number\n): PlayerAnswerResult => ({\n type: \"PLAYER_ANSWER_RESULT\",\n payload: { isCorrect, pointsAwarded, score, streak }\n});","import { Player } from \"../../types/lobby\";\n\nexport type PlayerJoined = {\n type: \"PLAYER_JOINED\";\n payload: { player: Player };\n};\n\nexport const createPlayerJoinedEvent = (player: Player): PlayerJoined => ({\n type: \"PLAYER_JOINED\",\n payload: { player }\n});","export type PlayerKicked = {\n type: \"PLAYER_KICKED\";\n payload: {};\n};\n\nexport const createPlayerKickedEvent = (): PlayerKicked => ({\n type: \"PLAYER_KICKED\",\n payload: {}\n});","import { Player } from \"../../types/lobby\";\n\nexport type PlayerLeft = {\n type: \"PLAYER_LEFT\";\n payload: { player: Player };\n};\n\nexport const createPlayerLeftEvent = (player: Player): PlayerLeft => ({\n type: \"PLAYER_LEFT\",\n payload: { player }\n});","import { Player } from \"../../types/lobby\";\n\nexport type PlayerUpdate = {\n type: \"PLAYER_UPDATE\";\n payload: { player: Player };\n};\n\nexport const createPlayerUpdateEvent = (player: Player): PlayerUpdate => ({\n type: \"PLAYER_UPDATE\",\n payload: { player }\n});","export type UpdateLobbyAnswers = {\n type: \"UPDATE_LOBBY_ANSWERS\";\n payload: { count: number };\n};\n\nexport const createUpdateLobbyAnswersEvent = (count: number): UpdateLobbyAnswers => ({\n type: \"UPDATE_LOBBY_ANSWERS\",\n payload: { count }\n});","import { Answer } from \"../util/validator\";\nimport { QuizFile } from \"./quizfile\";\nimport { QuizTheme } from \"./quiztheme\";\n\nexport type Lobby = {\n code: string;\n host: string; // Id of the WebSocket connection\n quiz: QuizFile;\n quizInfo: {\n title: string;\n stepCount: number;\n theme: QuizTheme;\n };\n players: Player[];\n status: LobbyStatus;\n timeoutStartedAt: number | null;\n duration: number | null;\n currentStep: number;\n currentAnswers: Answer[];\n answers: Answer[];\n settings: LobbySettings;\n}\n\nexport type LobbySettings = {\n customNames: boolean;\n displayOnDevice: boolean;\n}\n\nexport enum LobbyStatus {\n waiting = 'waiting',\n slide = 'slide',\n question = 'question',\n answer = 'answer',\n answers = 'answers',\n score = 'score',\n end = 'end',\n}\n\nexport type Player = {\n id: string;\n name: string;\n score: number;\n streak: number;\n isConnected: boolean;\n}","import { Question } from \"../types/question\";\nimport { MultipleChoiceQuestion } from \"../types/questions/multiple-choice\";\nimport { ShortAnswerQuestion } from \"../types/questions/short-answer\";\nimport { TrueFalseQuestion } from \"../types/questions/true-false\";\nimport { QuizStep } from \"../types/quizstep\";\nimport { Slide } from \"../types/slide\";\n\nexport const isQuestion = (step: QuizStep): step is { type: \"question\"; data: Question } => {\n return step.type === \"question\";\n};\n\nexport const isSlide = (step: QuizStep): step is { type: \"slide\"; data: Slide } => {\n return step.type === \"slide\";\n};\n\nexport const isMultipleChoice = (data: Question): data is MultipleChoiceQuestion => {\n return data.type === \"multiple-choice\";\n};\n\nexport const isTrueFalse = (data: Question): data is TrueFalseQuestion => {\n return data.type === \"true-false\";\n};\n\nexport const isShortAnswer = (data: Question): data is ShortAnswerQuestion => {\n return data.type === \"short-answer\";\n};","import { Answer } from \"./validator\";\nimport { QuizFile } from \"../types/quizfile\";\nimport { Question } from \"../types/question\";\n\nconst BASE_SCORE = 500;\nconst TIME_BONUS_MAX = 500;\n\nexport const calculateScore = (\n player: { score: number; streak: number },\n question: Question,\n answer: Answer,\n quiz: QuizFile\n): { newScore: number; pointsAwarded: number } => {\n if (!answer.isCorrect) return { newScore: player.score, pointsAwarded: 0 };\n\n const multipliers: Record<string, number> = {\n noPoints: 0,\n normalPoints: 1,\n doublePoints: 2,\n };\n const pointMultiplier = multipliers[question.points] ?? 1;\n if (pointMultiplier === 0) return { newScore: player.score, pointsAwarded: 0 };\n\n let timeBonus = 0;\n if (question.timeLimit > 0) {\n const timeLimitMs = question.timeLimit * 1000;\n const timeTaken = Math.max(0, Math.min(answer.timeTaken, timeLimitMs));\n const timeRemainingRatio = 1 - (timeTaken / timeLimitMs);\n timeBonus = TIME_BONUS_MAX * timeRemainingRatio;\n }\n\n let questionScore = (BASE_SCORE + timeBonus) * pointMultiplier;\n\n if (player.streak >= 2) {\n const totalQuestions = quiz.steps.filter(s => s.type === \"question\").length;\n \n const dynamicCap = Math.min(1.2 + Math.max(0, totalQuestions - 5) * 0.02, 1.5);\n const streakMultiplier = Math.min(1 + (player.streak - 1) * 0.05, dynamicCap);\n \n questionScore *= streakMultiplier;\n }\n\n const finalPoints = Math.trunc(questionScore);\n return {\n newScore: player.score + finalPoints,\n pointsAwarded: finalPoints\n };\n};","import { isMultipleChoice, isShortAnswer, isTrueFalse } from \"../util/guards\";\nimport { ShortAnswerQuestionAnswer } from \"../types/questions/short-answer\";\nimport { TrueFalseQuestionAnswer } from \"../types/questions/true-false\";\nimport { MultipleChoiceQuestionAnswer } from \"../types/questions/multiple-choice\";\nimport { Question } from \"../types/question\";\n\nexport type SubmittedAnswer = \n | MultipleChoiceQuestionAnswer\n | TrueFalseQuestionAnswer \n | ShortAnswerQuestionAnswer;\n\nexport interface Answer {\n playerId: string;\n submission: SubmittedAnswer;\n timeTaken: number;\n isCorrect: boolean;\n pointsAwarded: number;\n};\n\nexport const isCorrect = (question: Question, submission: SubmittedAnswer): boolean => {\n if (isMultipleChoice(question) && submission.type === \"multiple-choice\") {\n if (question.matchAll) {\n const correctIndices = question.choices\n .map((c, i) => (c.correct ? i : -1))\n .filter((i) => i !== -1);\n\n return (\n submission.choices.length === correctIndices.length &&\n submission.choices.every((index) => correctIndices.includes(index))\n );\n }\n\n if (submission.choices.length === 0) return false;\n\n return submission.choices.every(index => {\n const choice = question.choices[index];\n return choice ? choice.correct : false;\n });\n }\n\n if (isTrueFalse(question) && submission.type === \"true-false\") {\n return question.answer === submission.answer;\n }\n\n if (isShortAnswer(question) && submission.type === \"short-answer\") {\n const playerAns = submission.answer.trim().toLowerCase();\n return question.answers.some(ans => ans.trim().toLowerCase() === playerAns);\n }\n\n return false;\n};","import { PlayerAnswerResult } from \"../events/server/player-answer-result\";\nimport { Lobby, LobbyStatus } from \"../types/lobby\";\nimport { QuizFile } from \"../types/quizfile\";\nimport { isQuestion } from \"../util/guards\";\nimport { calculateScore } from \"../util/score\";\nimport { Answer, isCorrect, SubmittedAnswer } from \"../util/validator\";\n\nexport const createLobby = (\n code: string, \n hostId: string, \n quiz: QuizFile\n): Lobby => ({\n code,\n host: hostId,\n quiz,\n quizInfo: {\n title: quiz.title,\n stepCount: quiz.steps.length,\n theme: quiz.theme\n },\n players: [],\n status: LobbyStatus.waiting,\n currentStep: 0,\n timeoutStartedAt: null,\n duration: null,\n currentAnswers: [],\n answers: [],\n settings: { customNames: true, displayOnDevice: true }\n});\n\nexport const advanceLobby = (lobby: Lobby): Lobby => {\n const isLastStep = lobby.currentStep >= lobby.quiz.steps.length - 1;\n\n switch (lobby.status) {\n case LobbyStatus.waiting:\n return prepareStep(lobby, 0);\n\n case LobbyStatus.slide:\n case LobbyStatus.score:\n return isLastStep \n ? { ...lobby, status: LobbyStatus.end } \n : prepareStep(lobby, lobby.currentStep + 1);\n\n case LobbyStatus.question: {\n const step = lobby.quiz.steps[lobby.currentStep];\n if (step.type !== 'question') return lobby;\n\n return { \n ...lobby, \n status: LobbyStatus.answer, \n timeoutStartedAt: Date.now(), \n duration: step.data.timeLimit * 1000,\n currentAnswers: [] \n };\n }\n\n case LobbyStatus.answer:\n return { ...lobby, status: LobbyStatus.answers };\n\n case LobbyStatus.answers:\n return { ...lobby, status: LobbyStatus.score };\n\n default:\n return lobby;\n }\n};\n\n// Prepares the lobby for the next step\nconst prepareStep = (lobby: Lobby, index: number): Lobby => {\n const step = lobby.quiz.steps[index];\n \n if (!step) return lobby;\n\n if (step.type === \"slide\") {\n return { \n ...lobby, \n status: LobbyStatus.slide, \n currentStep: index \n };\n }\n\n return { \n ...lobby, \n status: LobbyStatus.question, \n currentStep: index,\n timeoutStartedAt: null,\n duration: null,\n currentAnswers: []\n };\n};\n\nexport type SubmissionResult = {\n nextLobby: Lobby;\n result: PlayerAnswerResult;\n};\n\nexport const handleSubmission = (\n lobby: Lobby, \n playerId: string, \n submission: SubmittedAnswer\n): SubmissionResult | null => {\n if (lobby.status !== LobbyStatus.answer) return null;\n\n const step = lobby.quiz.steps[lobby.currentStep];\n if (!isQuestion(step)) return null;\n\n const player = lobby.players.find(p => p.id === playerId);\n if (!player) return null;\n\n if (lobby.currentAnswers.some(a => a.playerId === playerId)) return null;\n\n const correct = isCorrect(step.data, submission);\n const timeTaken = Date.now() - (lobby.timeoutStartedAt ?? 0);\n\n const answerObj: Answer = {\n playerId,\n submission,\n timeTaken,\n isCorrect: correct,\n pointsAwarded: 0\n };\n\n const { newScore, pointsAwarded } = calculateScore(player, step.data, answerObj, lobby.quiz);\n answerObj.pointsAwarded = pointsAwarded;\n\n const nextLobby: Lobby = {\n ...lobby,\n players: lobby.players.map(p => p.id === playerId ? {\n ...p,\n score: newScore,\n streak: correct ? p.streak + 1 : 0\n } : p),\n currentAnswers: [...lobby.currentAnswers, answerObj]\n };\n\n return {\n nextLobby,\n result: {\n type: \"PLAYER_ANSWER_RESULT\",\n payload: { isCorrect: correct, pointsAwarded, score: newScore, streak: correct ? player.streak + 1 : 0 }\n }\n };\n};","import z from \"zod\";\nimport { BaseQuestionSchema } from \"../question\";\n\nexport const TrueFalseQuestionSchema = BaseQuestionSchema.extend({\n type: z.literal(\"true-false\"),\n answer: z.boolean(),\n labels: z.array(z.string()).min(2).max(2),\n});\n\nexport type TrueFalseQuestion = z.infer<typeof TrueFalseQuestionSchema>;\n\nexport const SafeTrueFalseQuestionSchema = TrueFalseQuestionSchema.omit({ answer: true });\n\nexport type SafeTrueFalseQuestion = z.infer<typeof SafeTrueFalseQuestionSchema>;\n\nexport const TrueFalseQuestionAnswerSchema = z.object({\n type: z.literal(\"true-false\"),\n answer: z.boolean(),\n});\n\nexport type TrueFalseQuestionAnswer = z.infer<typeof TrueFalseQuestionAnswerSchema>;\n","import z from \"zod\";\nimport { BaseQuestionSchema } from \"../question\";\n\nexport const ShortAnswerQuestionSchema = BaseQuestionSchema.extend({\n type: z.literal(\"short-answer\"),\n answers: z.array(z.string()).min(1),\n});\n\nexport type ShortAnswerQuestion = z.infer<typeof ShortAnswerQuestionSchema>;\n\nexport const SafeShortAnswerQuestionSchema = ShortAnswerQuestionSchema.omit({ answers: true });\n\nexport type SafeShortAnswerQuestion = z.infer<typeof SafeShortAnswerQuestionSchema>;\n\nexport const ShortAnswerQuestionAnswerSchema = z.object({\n type: z.literal(\"short-answer\"),\n answer: z.string(),\n});\n\nexport type ShortAnswerQuestionAnswer = z.infer<typeof ShortAnswerQuestionAnswerSchema>;\n","import z from \"zod\";\nimport { MultipleChoiceQuestion, MultipleChoiceQuestionSchema, SafeMultipleChoiceQuestion, SafeMultipleChoiceQuestionSchema } from \"./questions/multiple-choice\";\nimport { SafeTrueFalseQuestion, SafeTrueFalseQuestionSchema, TrueFalseQuestion, TrueFalseQuestionSchema } from \"./questions/true-false\";\nimport { SafeShortAnswerQuestion, SafeShortAnswerQuestionSchema, ShortAnswerQuestion, ShortAnswerQuestionSchema } from \"./questions/short-answer\";\n\nexport type Question = MultipleChoiceQuestion | TrueFalseQuestion | ShortAnswerQuestion;\n\nexport const QuestionSchema = z.discriminatedUnion(\"type\", [\n MultipleChoiceQuestionSchema,\n TrueFalseQuestionSchema,\n ShortAnswerQuestionSchema,\n]);\n\nexport type SafeQuestion =\n | SafeMultipleChoiceQuestion\n | SafeTrueFalseQuestion\n | SafeShortAnswerQuestion;\n\nexport const SafeQuestionSchema = z.discriminatedUnion(\"type\", [\n SafeMultipleChoiceQuestionSchema,\n SafeTrueFalseQuestionSchema,\n SafeShortAnswerQuestionSchema,\n]);\n\nexport type QuestionPoints = z.infer<typeof QuestionPointsSchema>;\n\nexport const QuestionPointsSchema = z.enum([\"normalPoints\", \"doublePoints\", \"noPoints\"]);\n\nexport type BaseQuestion = z.infer<typeof BaseQuestionSchema>;\n\nexport const BaseQuestionSchema = z.object({\n question: z.string().min(1),\n imageHash: z.hash(\"sha256\", { error: \"Invalid image hash\" }).optional(),\n displayTime: z.number().min(1).max(60),\n timeLimit: z.number().min(1).max(180),\n points: QuestionPointsSchema,\n});","import z from \"zod\";\nimport { BaseQuestionSchema } from \"../question\";\n\nexport const ChoiceSchema = z.object({\n text: z.string(),\n correct: z.boolean(),\n});\n\nexport type Choice = z.infer<typeof ChoiceSchema>;\n\nexport const SafeChoiceSchema = ChoiceSchema.omit({ correct: true });\n\nexport type SafeChoice = z.infer<typeof SafeChoiceSchema>;\n\nexport const MultipleChoiceQuestionSchema = BaseQuestionSchema.extend({\n type: z.literal(\"multiple-choice\"),\n choices: z.array(ChoiceSchema).min(2),\n matchAll: z.boolean(),\n});\n\nexport type MultipleChoiceQuestion = z.infer<typeof MultipleChoiceQuestionSchema>;\n\nexport const SafeMultipleChoiceQuestionSchema = MultipleChoiceQuestionSchema.omit({ \n choices: true \n}).extend({\n choices: z.array(SafeChoiceSchema).min(2),\n});\n\nexport type SafeMultipleChoiceQuestion = z.infer<typeof SafeMultipleChoiceQuestionSchema>;\n\nexport const MultipleChoiceQuestionAnswerSchema = z.object({\n type: z.literal(\"multiple-choice\"),\n choices: z.array(z.number()).min(1),\n});\n\nexport type MultipleChoiceQuestionAnswer = z.infer<typeof MultipleChoiceQuestionAnswerSchema>;","import z from \"zod\";\n\nexport const ComparisonSlideLayoutSchema = z.object({\n slideType: z.literal(\"comparison\"),\n title: z.string(),\n left: z.string(),\n right: z.string(),\n});\n\nexport type ComparisonSlideLayout = z.infer<typeof ComparisonSlideLayoutSchema>;\n","import z from \"zod\";\n\nexport const TitleImageTextSlideLayoutSchema = z.object({\n slideType: z.literal(\"titleImageText\"),\n title: z.string(),\n imageHash: z.hash(\"sha256\", { error: \"Invalid image hash\" }).optional(),\n text: z.string(),\n});\n\nexport type TitleImageTextSlideLayout = z.infer<typeof TitleImageTextSlideLayoutSchema>;\n","import z from \"zod\";\n\nexport const TitleSlideLayoutSchema = z.object({\n slideType: z.literal(\"title\"),\n title: z.string(),\n subtitle: z.string().optional(),\n});\n\nexport type TitleSlideLayout = z.infer<typeof TitleSlideLayoutSchema>;","import z from \"zod\";\n\nexport type QuizTheme = z.infer<typeof QuizThemeSchema>;\n\nexport const QuizThemeSchema = z.object({\n color: z.string().regex(\n /^#[0-9a-fA-F]{6}$/,\n { message: 'Invalid color format. Must be a 7-character hex code (e.g., #RRGGBB).' }\n ),\n background: z.hash(\"sha256\", { error: \"Invalid background hash\" }).optional(),\n});","import z from \"zod\";\nimport { TitleSlideLayoutSchema } from \"./slides/titleSlide\";\nimport { TitleImageTextSlideLayoutSchema } from \"./slides/titleImageTextSlide\";\nimport { ComparisonSlideLayoutSchema } from \"./slides/comparison\";\n\nexport type Slide = z.infer<typeof SlideSchema>;\n\nexport const SlideSchema = z.discriminatedUnion(\"slideType\", [\n TitleSlideLayoutSchema,\n TitleImageTextSlideLayoutSchema,\n ComparisonSlideLayoutSchema\n]);\n","import z from \"zod\";\nimport { Question, QuestionSchema } from \"./question\";\nimport { Slide, SlideSchema } from \"./slide\";\n\nexport type QuizStep =\n | {\n type: \"question\";\n data: Question;\n }\n | {\n type: \"slide\";\n data: Slide;\n };\n\nexport const QuizStepSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"question\"), data: QuestionSchema }),\n z.object({ type: z.literal(\"slide\"), data: SlideSchema }),\n]);","import z from \"zod\";\nimport { QuizThemeSchema } from \"./quiztheme\";\nimport { QuizStepSchema } from \"./quizstep\";\n\nexport type QuizFile = z.infer<typeof QuizFileSchema>;\n\nexport const QuizFileSchema = z.object({\n id: z.uuid(),\n version: z.literal(2),\n\n title: z.string()\n .min(1, \"Title must be atleast 1 character long\")\n .max(64, \"Title can't be longer than 64 characters\"),\n description: z.string()\n .max(255, \"Description can't be longer than 256 characters\")\n .optional(),\n theme: QuizThemeSchema,\n language: z.string()\n .length(2, \"Language must be a 2-letter ISO 639-1 code\"),\n\n steps: z.array(QuizStepSchema)\n .min(1, \"Quiz must have at least 1 step\"),\n\n images: z.record(\n z.hash(\"sha256\", { error: \"Invalid image hash\" }),\n z.string().refine((val) => {\n return val.startsWith(\"http\") || val.startsWith(\"data:image/\");\n }, \"Image must be a valid URL or Base64 data string\")\n ),\n\n updatedAt: z.iso.datetime(),\n createdAt: z.iso.datetime(),\n});","","","","import animals from \"./animals.json\";\nimport additives from \"./additives.json\";\nimport colors from \"./colors.json\";\nimport { Player } from \"../../types/lobby\";\n\nexport const generateName = (): string => {\n const animal = animals[Math.floor(Math.random() * animals.length)];\n const additive = additives[Math.floor(Math.random() * additives.length)];\n const color = colors[Math.floor(Math.random() * colors.length)];\n\n return `${color}${additive}${animal}`;\n};\n\nexport const generateUniqueName = (players: Player[]): string => {\n const maxPossible = animals.length * additives.length * colors.length;\n\n if (players.length >= maxPossible) {\n throw new Error(\"No unique names available\");\n }\n\n const existingNames = new Set(players.map((p) => p.name));\n \n for (let i = 0; i < 100; i++) {\n const candidate = generateName();\n if (!existingNames.has(candidate)) return candidate;\n }\n\n for (const c of colors) {\n for (const ad of additives) {\n for (const an of animals) {\n const candidate = `${c}${ad}${an}`;\n if (!existingNames.has(candidate)) return candidate;\n }\n }\n }\n\n throw new Error(\"No unique names available\"); // Fallback\n};","import { v7 } from \"uuid\";\n\nexport const createWebsocketId = () => v7();","import { Question, SafeQuestion } from \"../types/question\";\nimport { isMultipleChoice, isShortAnswer, isTrueFalse } from \"./guards\";\n\nexport const sanitizeQuestion = (question: Question): SafeQuestion => {\n if (isMultipleChoice(question)) {\n return {\n ...question,\n choices: question.choices.map(({ text }) => ({ text })),\n };\n }\n\n if (isTrueFalse(question)) {\n const { answer, ...sanitized } = question;\n return sanitized;\n }\n\n if (isShortAnswer(question)) {\n const { answers, ...sanitized } = question;\n return sanitized;\n }\n\n throw new Error(\"Invalid question type\");\n};"],"mappings":";;;AAKA,MAAa,yBAAyB,cAAkC;CACtE,MAAM;CACN,SAAS,EAAE,UAAU;CACtB;;;ACJD,MAAa,6BAAuC,EAClD,MAAM,aACP;;;ACDD,MAAa,+BAA2C;CACtD,MAAM;CACN,SAAS,EAAE;CACZ;;;ACDD,MAAa,2BAA2B,gBAA+C;CACrF,MAAM;CACN,SAAS,EAAE,YAAY;CACxB;;;ACLD,MAAa,2BAA2B,YAAkC;CACxE,MAAM;CACN,SAAS,EAAE,QAAQ;CACpB;;;ACMD,MAAa,0BACX,OACA,IACA,YACiB;CACjB,MAAM;CACN,SAAS;EACP,OAAO;GACL,MAAM,MAAM;GACZ,UAAU,MAAM;GAChB,QAAQ,MAAM;GACd,kBAAkB,MAAM;GACxB,UAAU,MAAM;GAChB,aAAa,MAAM;GACnB,UAAU,MAAM;GACjB;EACD;EACA,SAAS,SAAS,MAAM,UAAU,KAAA;EAClC,gBAAgB,SAAS,MAAM,iBAAiB,KAAA;EAChD,SAAS,SAAS,MAAM,UAAU,KAAA;EACnC;CACF;;;AClBD,MAAa,gCACX,aACuB;CACvB,MAAM;CACN;CACD;;;ACZD,MAAa,iCACX,WACA,eACA,OACA,YACwB;CACxB,MAAM;CACN,SAAS;EAAE;EAAW;EAAe;EAAO;EAAQ;CACrD;;;ACXD,MAAa,2BAA2B,YAAkC;CACxE,MAAM;CACN,SAAS,EAAE,QAAQ;CACpB;;;ACLD,MAAa,iCAA+C;CAC1D,MAAM;CACN,SAAS,EAAE;CACZ;;;ACDD,MAAa,yBAAyB,YAAgC;CACpE,MAAM;CACN,SAAS,EAAE,QAAQ;CACpB;;;ACHD,M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,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE;EACxD;AAGH,KAAI,YAAY,SAAS,EAAE;EACzB,MAAM,EAAE,QAAQ,GAAG,cAAc;AACjC,SAAO;;AAGT,KAAI,cAAc,SAAS,EAAE;EAC3B,MAAM,EAAE,SAAS,GAAG,cAAc;AAClC,SAAO;;AAGT,OAAM,IAAI,MAAM,wBAAwB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quizpot/quizcore",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Core library for Quizpot",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "tsdown src/index.ts --format esm,cjs --dts --clean",
|
|
13
|
-
"watch": "tsdown src/index.ts --format esm,cjs --dts --watch"
|
|
13
|
+
"watch": "tsdown src/index.ts --format esm,cjs --dts --watch",
|
|
14
|
+
"publish": "npm publish --access public"
|
|
14
15
|
},
|
|
15
16
|
"exports": {
|
|
16
17
|
".": {
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
"typescript": "^5.9.3"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
28
|
+
"uuid": "^13.0.0",
|
|
27
29
|
"zod": "^4.3.6"
|
|
28
30
|
}
|
|
29
31
|
}
|