@quizpot/quizcore 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,9 +1,3 @@
1
1
  # Quizcore
2
2
 
3
- Core library for Quizpot
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install git+https://github.com/quizpot/quizcore.git
9
- ```
3
+ Core library for Quizpot
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quizpot/quizcore",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Core library for Quizpot",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,22 +0,0 @@
1
- import { BaseQuestion } from "../types/quizfile";
2
- export interface MultipleChoiceQuestion extends BaseQuestion {
3
- questionType: "multipleChoice";
4
- choices: Choice[];
5
- matchAll: boolean;
6
- }
7
- export interface Choice {
8
- text: string;
9
- correct: boolean;
10
- }
11
- export interface SafeMultipleChoiceQuestion extends Omit<MultipleChoiceQuestion, "choices"> {
12
- choices: SafeChoice[];
13
- matchAll: boolean;
14
- }
15
- export interface SafeChoice {
16
- text: string;
17
- }
18
- export interface MultipleChoiceQuestionAnswer {
19
- type: "multipleChoice";
20
- choices: number[];
21
- }
22
- //# sourceMappingURL=multiple-choice.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"multiple-choice.d.ts","sourceRoot":"","sources":["../../src/questions/multiple-choice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,sBAAuB,SAAQ,YAAY;IAC1D,YAAY,EAAE,gBAAgB,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,0BAA2B,SAAQ,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC;IACzF,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,12 +0,0 @@
1
- import { BaseQuestion } from "../types/quizfile";
2
- export interface ShortAnswerQuestion extends BaseQuestion {
3
- questionType: "shortAnswer";
4
- answers: string[];
5
- }
6
- export interface SafeShortAnswerQuestion extends Omit<ShortAnswerQuestion, "answers"> {
7
- }
8
- export interface ShortAnswerQuestionAnswer {
9
- type: "shortAnswer";
10
- answer: string;
11
- }
12
- //# sourceMappingURL=short-answer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"short-answer.d.ts","sourceRoot":"","sources":["../../src/questions/short-answer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,mBAAoB,SAAQ,YAAY;IACvD,YAAY,EAAE,aAAa,CAAC;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC;CAAG;AAExF,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,12 +0,0 @@
1
- import { BaseQuestion } from "../types/quizfile";
2
- export interface TrueFalseQuestion extends BaseQuestion {
3
- questionType: "trueFalse";
4
- answer: boolean;
5
- }
6
- export interface SafeTrueFalseQuestion extends Omit<TrueFalseQuestion, "answer"> {
7
- }
8
- export interface TrueFalseQuestionAnswer {
9
- type: "trueFalse";
10
- answer: boolean;
11
- }
12
- //# sourceMappingURL=true-false.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"true-false.d.ts","sourceRoot":"","sources":["../../src/questions/true-false.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,YAAY,EAAE,WAAW,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC;CAAG;AAEnF,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,87 +0,0 @@
1
- import { z } from "zod";
2
- export declare const QuizFileSchema: z.ZodObject<{
3
- id: z.ZodString;
4
- version: z.ZodLiteral<2>;
5
- title: z.ZodString;
6
- description: z.ZodOptional<z.ZodString>;
7
- theme: z.ZodObject<{
8
- color: z.ZodString;
9
- background: z.ZodOptional<z.ZodString>;
10
- }, z.core.$strip>;
11
- language: z.ZodString;
12
- steps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
13
- type: z.ZodLiteral<"question">;
14
- data: z.ZodDiscriminatedUnion<[z.ZodObject<{
15
- question: z.ZodString;
16
- imageHash: z.ZodOptional<z.ZodString>;
17
- displayTime: z.ZodNumber;
18
- timeLimit: z.ZodNumber;
19
- points: z.ZodEnum<{
20
- normalPoints: "normalPoints";
21
- doublePoints: "doublePoints";
22
- noPoints: "noPoints";
23
- }>;
24
- type: z.ZodLiteral<"multiple-choice">;
25
- options: z.ZodArray<z.ZodObject<{
26
- id: z.ZodString;
27
- text: z.ZodString;
28
- isCorrect: z.ZodBoolean;
29
- }, z.core.$strip>>;
30
- }, z.core.$strip>, z.ZodObject<{
31
- question: z.ZodString;
32
- imageHash: z.ZodOptional<z.ZodString>;
33
- displayTime: z.ZodNumber;
34
- timeLimit: z.ZodNumber;
35
- points: z.ZodEnum<{
36
- normalPoints: "normalPoints";
37
- doublePoints: "doublePoints";
38
- noPoints: "noPoints";
39
- }>;
40
- type: z.ZodLiteral<"true-false">;
41
- answer: z.ZodBoolean;
42
- }, z.core.$strip>, z.ZodObject<{
43
- question: z.ZodString;
44
- imageHash: z.ZodOptional<z.ZodString>;
45
- displayTime: z.ZodNumber;
46
- timeLimit: z.ZodNumber;
47
- points: z.ZodEnum<{
48
- normalPoints: "normalPoints";
49
- doublePoints: "doublePoints";
50
- noPoints: "noPoints";
51
- }>;
52
- type: z.ZodLiteral<"short-answer">;
53
- acceptedAnswers: z.ZodArray<z.ZodString>;
54
- }, z.core.$strip>], "type">;
55
- }, z.core.$strip>, z.ZodObject<{
56
- type: z.ZodLiteral<"slide">;
57
- data: z.ZodDiscriminatedUnion<[z.ZodObject<{
58
- slideType: z.ZodLiteral<"title">;
59
- title: z.ZodString;
60
- subtitle: z.ZodOptional<z.ZodString>;
61
- }, z.core.$strip>, z.ZodObject<{
62
- slideType: z.ZodLiteral<"titleAndText">;
63
- title: z.ZodString;
64
- text: z.ZodString;
65
- }, z.core.$strip>, z.ZodObject<{
66
- slideType: z.ZodLiteral<"titleAndTextWithImage">;
67
- title: z.ZodString;
68
- text: z.ZodString;
69
- imageHash: z.ZodOptional<z.ZodString>;
70
- }, z.core.$strip>, z.ZodObject<{
71
- slideType: z.ZodLiteral<"comparison">;
72
- title: z.ZodString;
73
- left: z.ZodString;
74
- right: z.ZodString;
75
- }, z.core.$strip>, z.ZodObject<{
76
- slideType: z.ZodLiteral<"titleImageText">;
77
- title: z.ZodString;
78
- imageHash: z.ZodOptional<z.ZodString>;
79
- text: z.ZodString;
80
- }, z.core.$strip>], "slideType">;
81
- }, z.core.$strip>], "type">>;
82
- images: z.ZodRecord<z.ZodString, z.ZodString>;
83
- updatedAt: z.ZodString;
84
- createdAt: z.ZodString;
85
- }, z.core.$strip>;
86
- export type QuizFile = z.infer<typeof QuizFileSchema>;
87
- //# sourceMappingURL=quizfile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"quizfile.d.ts","sourceRoot":"","sources":["../../src/schemas/quizfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqDxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAWzB,CAAC;AAGH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -1,55 +0,0 @@
1
- import { z } from "zod";
2
- const QuestionPointsSchema = z.enum(["normalPoints", "doublePoints", "noPoints"]);
3
- const ThemeSchema = z.object({
4
- color: z.string(),
5
- background: z.string().optional(),
6
- });
7
- const SlideLayoutSchema = z.discriminatedUnion("slideType", [
8
- z.object({ slideType: z.literal("title"), title: z.string(), subtitle: z.string().optional() }),
9
- z.object({ slideType: z.literal("titleAndText"), title: z.string(), text: z.string() }),
10
- z.object({ slideType: z.literal("titleAndTextWithImage"), title: z.string(), text: z.string(), imageHash: z.string().optional() }),
11
- z.object({ slideType: z.literal("comparison"), title: z.string(), left: z.string(), right: z.string() }),
12
- z.object({ slideType: z.literal("titleImageText"), title: z.string(), imageHash: z.string().optional(), text: z.string() }),
13
- ]);
14
- const BaseQuestionSchema = z.object({
15
- question: z.string().min(1),
16
- imageHash: z.string().optional(),
17
- displayTime: z.number().min(0),
18
- timeLimit: z.number().min(1),
19
- points: QuestionPointsSchema,
20
- });
21
- const MultipleChoiceSchema = BaseQuestionSchema.extend({
22
- type: z.literal("multiple-choice"),
23
- options: z.array(z.object({ id: z.string(), text: z.string(), isCorrect: z.boolean() })).min(2),
24
- });
25
- const TrueFalseSchema = BaseQuestionSchema.extend({
26
- type: z.literal("true-false"),
27
- answer: z.boolean(),
28
- });
29
- const ShortAnswerSchema = BaseQuestionSchema.extend({
30
- type: z.literal("short-answer"),
31
- acceptedAnswers: z.array(z.string()).min(1),
32
- });
33
- const QuestionSchema = z.discriminatedUnion("type", [
34
- MultipleChoiceSchema,
35
- TrueFalseSchema,
36
- ShortAnswerSchema,
37
- ]);
38
- // --- Quiz Steps ---
39
- const QuizStepSchema = z.discriminatedUnion("type", [
40
- z.object({ type: z.literal("question"), data: QuestionSchema }),
41
- z.object({ type: z.literal("slide"), data: SlideLayoutSchema }),
42
- ]);
43
- // --- Main QuizFile Schema ---
44
- export const QuizFileSchema = z.object({
45
- id: z.string().uuid(),
46
- version: z.literal(2),
47
- title: z.string().min(1),
48
- description: z.string().optional(),
49
- theme: ThemeSchema,
50
- language: z.string().length(2), // ISO 639-1 format
51
- steps: z.array(QuizStepSchema).min(1),
52
- images: z.record(z.string(), z.string()), // Hash -> URL/Base64
53
- updatedAt: z.string().datetime(), // Validates ISO strings
54
- createdAt: z.string().datetime(),
55
- });
@@ -1,9 +0,0 @@
1
- import z from "zod";
2
- export type ComparisonSlideLayout = z.infer<typeof ComparisonSlideLayoutSchema>;
3
- export declare const ComparisonSlideLayoutSchema: z.ZodObject<{
4
- slideType: z.ZodLiteral<"comparison">;
5
- title: z.ZodString;
6
- left: z.ZodString;
7
- right: z.ZodString;
8
- }, z.core.$strip>;
9
- //# sourceMappingURL=comparison.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"comparison.d.ts","sourceRoot":"","sources":["../../src/slides/comparison.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,2BAA2B;;;;;iBAKtC,CAAC"}
@@ -1,7 +0,0 @@
1
- import z from "zod";
2
- export const ComparisonSlideLayoutSchema = z.object({
3
- slideType: z.literal("comparison"),
4
- title: z.string(),
5
- left: z.string(),
6
- right: z.string(),
7
- });
@@ -1,9 +0,0 @@
1
- import z from "zod";
2
- export type TitleImageTextSlideLayout = z.infer<typeof TitleImageTextSlideLayoutSchema>;
3
- export declare const TitleImageTextSlideLayoutSchema: z.ZodObject<{
4
- slideType: z.ZodLiteral<"titleImageText">;
5
- title: z.ZodString;
6
- imageHash: z.ZodOptional<z.ZodCustomStringFormat<"sha256_hex">>;
7
- text: z.ZodString;
8
- }, z.core.$strip>;
9
- //# sourceMappingURL=titleImageTextSlide.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"titleImageTextSlide.d.ts","sourceRoot":"","sources":["../../src/slides/titleImageTextSlide.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,eAAO,MAAM,+BAA+B;;;;;iBAK1C,CAAC"}
@@ -1,7 +0,0 @@
1
- import z from "zod";
2
- export const TitleImageTextSlideLayoutSchema = z.object({
3
- slideType: z.literal("titleImageText"),
4
- title: z.string(),
5
- imageHash: z.hash("sha256", { error: "Invalid image hash" }).optional(),
6
- text: z.string(),
7
- });
@@ -1,8 +0,0 @@
1
- import z from "zod";
2
- export type TitleSlideLayout = z.infer<typeof TitleSlideLayoutSchema>;
3
- export declare const TitleSlideLayoutSchema: z.ZodObject<{
4
- slideType: z.ZodLiteral<"title">;
5
- title: z.ZodString;
6
- subtitle: z.ZodOptional<z.ZodString>;
7
- }, z.core.$strip>;
8
- //# sourceMappingURL=titleSlide.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"titleSlide.d.ts","sourceRoot":"","sources":["../../src/slides/titleSlide.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,sBAAsB;;;;iBAIjC,CAAC"}
@@ -1,6 +0,0 @@
1
- import z from "zod";
2
- export const TitleSlideLayoutSchema = z.object({
3
- slideType: z.literal("title"),
4
- title: z.string(),
5
- subtitle: z.string().optional(),
6
- });