@sparted/shared-library 1.2.1 → 1.2.3-rc0
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.
|
@@ -4,11 +4,11 @@ import { Image, Media } from './media';
|
|
|
4
4
|
import { Thematic } from './thematic';
|
|
5
5
|
export type ErrorText = {
|
|
6
6
|
type: 'error-text';
|
|
7
|
-
gameMedia
|
|
8
|
-
explanationMedia
|
|
9
|
-
explanation
|
|
10
|
-
wrongText
|
|
11
|
-
correctText
|
|
7
|
+
gameMedia: Media;
|
|
8
|
+
explanationMedia: Media;
|
|
9
|
+
explanation: MultilingualLabel;
|
|
10
|
+
wrongText: MultilingualLabel;
|
|
11
|
+
correctText: MultilingualLabel;
|
|
12
12
|
};
|
|
13
13
|
export type MultipleChoiceQuestion = {
|
|
14
14
|
type: 'mcq';
|
|
@@ -26,7 +26,7 @@ export type NoInteraction = {
|
|
|
26
26
|
type: 'no-interaction';
|
|
27
27
|
firstMedia?: Media;
|
|
28
28
|
secondMedia?: Media;
|
|
29
|
-
title
|
|
29
|
+
title: MultilingualLabel;
|
|
30
30
|
text?: MultilingualLabel;
|
|
31
31
|
};
|
|
32
32
|
export type OpenQuestion = {
|
|
@@ -40,10 +40,10 @@ export type OpenQuestion = {
|
|
|
40
40
|
};
|
|
41
41
|
export type OrderingCards = {
|
|
42
42
|
type: 'ordering-cards';
|
|
43
|
-
explanation
|
|
44
|
-
question
|
|
45
|
-
topLabel
|
|
46
|
-
bottomLabel
|
|
43
|
+
explanation: MultilingualLabel;
|
|
44
|
+
question: MultilingualLabel;
|
|
45
|
+
topLabel: MultilingualLabel;
|
|
46
|
+
bottomLabel: MultilingualLabel;
|
|
47
47
|
cards: MultilingualLabel[];
|
|
48
48
|
};
|
|
49
49
|
export type PictureSpot = {
|
|
@@ -79,17 +79,16 @@ export declare const GAME_TYPE: Record<string, GameType>;
|
|
|
79
79
|
export type ContentStatuses = Partial<{
|
|
80
80
|
[languageCode in LanguageCode]: 'draft' | 'validated' | 'waiting-translation' | 'waiting-validation';
|
|
81
81
|
}>;
|
|
82
|
+
export type ContentMetadata = {
|
|
83
|
+
identifier: string;
|
|
84
|
+
coverImage?: Image;
|
|
85
|
+
name: MultilingualLabel;
|
|
86
|
+
thematic: Thematic;
|
|
87
|
+
};
|
|
82
88
|
export type Content = {
|
|
83
89
|
archived: boolean;
|
|
84
90
|
id: number;
|
|
85
|
-
metadata:
|
|
86
|
-
coverImage: Image;
|
|
87
|
-
identifier?: string;
|
|
88
|
-
name: MultilingualLabel;
|
|
89
|
-
thematic: Thematic;
|
|
90
|
-
explanation?: string;
|
|
91
|
-
knowMore?: string;
|
|
92
|
-
};
|
|
91
|
+
metadata: ContentMetadata;
|
|
93
92
|
statuses: ContentStatuses;
|
|
94
93
|
game?: Game;
|
|
95
94
|
};
|
|
@@ -113,7 +112,7 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
|
|
|
113
112
|
video?: {
|
|
114
113
|
id?: number | undefined;
|
|
115
114
|
url?: string | undefined;
|
|
116
|
-
type?: "
|
|
115
|
+
type?: import("./media").VideoSourceType | undefined;
|
|
117
116
|
} | undefined;
|
|
118
117
|
} | undefined;
|
|
119
118
|
question?: {
|
|
@@ -199,7 +198,7 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
|
|
|
199
198
|
video?: {
|
|
200
199
|
id?: number | undefined;
|
|
201
200
|
url?: string | undefined;
|
|
202
|
-
type?: "
|
|
201
|
+
type?: import("./media").VideoSourceType | undefined;
|
|
203
202
|
} | undefined;
|
|
204
203
|
} | undefined;
|
|
205
204
|
multiselect?: boolean | undefined;
|
|
@@ -256,7 +255,7 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
|
|
|
256
255
|
video?: {
|
|
257
256
|
id?: number | undefined;
|
|
258
257
|
url?: string | undefined;
|
|
259
|
-
type?: "
|
|
258
|
+
type?: import("./media").VideoSourceType | undefined;
|
|
260
259
|
} | undefined;
|
|
261
260
|
} | undefined;
|
|
262
261
|
explanationMedia?: {
|
|
@@ -270,7 +269,7 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
|
|
|
270
269
|
video?: {
|
|
271
270
|
id?: number | undefined;
|
|
272
271
|
url?: string | undefined;
|
|
273
|
-
type?: "
|
|
272
|
+
type?: import("./media").VideoSourceType | undefined;
|
|
274
273
|
} | undefined;
|
|
275
274
|
} | undefined;
|
|
276
275
|
explanation?: {
|
|
@@ -395,7 +394,7 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
|
|
|
395
394
|
video?: {
|
|
396
395
|
id?: number | undefined;
|
|
397
396
|
url?: string | undefined;
|
|
398
|
-
type?: "
|
|
397
|
+
type?: import("./media").VideoSourceType | undefined;
|
|
399
398
|
} | undefined;
|
|
400
399
|
} | undefined;
|
|
401
400
|
question?: {
|
|
@@ -517,7 +516,7 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
|
|
|
517
516
|
video?: {
|
|
518
517
|
id?: number | undefined;
|
|
519
518
|
url?: string | undefined;
|
|
520
|
-
type?: "
|
|
519
|
+
type?: import("./media").VideoSourceType | undefined;
|
|
521
520
|
} | undefined;
|
|
522
521
|
} | undefined;
|
|
523
522
|
levenshteinDistance?: number | undefined;
|
|
@@ -535,7 +534,7 @@ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => ga
|
|
|
535
534
|
video?: {
|
|
536
535
|
id?: number | undefined;
|
|
537
536
|
url?: string | undefined;
|
|
538
|
-
type?: "
|
|
537
|
+
type?: import("./media").VideoSourceType | undefined;
|
|
539
538
|
} | undefined;
|
|
540
539
|
} | undefined;
|
|
541
540
|
secondMedia?: {
|
|
@@ -549,7 +548,7 @@ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => ga
|
|
|
549
548
|
video?: {
|
|
550
549
|
id?: number | undefined;
|
|
551
550
|
url?: string | undefined;
|
|
552
|
-
type?: "
|
|
551
|
+
type?: import("./media").VideoSourceType | undefined;
|
|
553
552
|
} | undefined;
|
|
554
553
|
} | undefined;
|
|
555
554
|
title?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.js","sources":["../../../src/business/types/content.ts"],"sourcesContent":["import { DeepPartial } from 'ts-essentials';\n\nimport { LanguageCode, MultilingualLabel } from './multilingual';\nimport { Image, Media } from './media';\nimport { Thematic } from './thematic';\n\nexport type ErrorText = {\n type: 'error-text';\n gameMedia
|
|
1
|
+
{"version":3,"file":"content.js","sources":["../../../src/business/types/content.ts"],"sourcesContent":["import { DeepPartial } from 'ts-essentials';\n\nimport { LanguageCode, MultilingualLabel } from './multilingual';\nimport { Image, Media } from './media';\nimport { Thematic } from './thematic';\n\nexport type ErrorText = {\n type: 'error-text';\n gameMedia: Media;\n explanationMedia: Media;\n explanation: MultilingualLabel;\n wrongText: MultilingualLabel;\n correctText: MultilingualLabel;\n};\n\nexport type MultipleChoiceQuestion = {\n type: 'mcq';\n gameMedia?: Media;\n question?: MultilingualLabel;\n explanation?: MultilingualLabel;\n explanationMedia?: Media;\n multiselect?: boolean;\n choices?: {\n correct: boolean;\n text: MultilingualLabel;\n }[];\n};\n\nexport type NoInteraction = {\n type: 'no-interaction';\n firstMedia?: Media;\n secondMedia?: Media;\n title: MultilingualLabel;\n text?: MultilingualLabel;\n};\n\nexport type OpenQuestion = {\n type: 'open-question';\n gameMedia?: Media;\n question?: MultilingualLabel;\n answer?: MultilingualLabel;\n explanation?: MultilingualLabel;\n explanationMedia?: Media;\n levenshteinDistance?: number;\n};\n\nexport type OrderingCards = {\n type: 'ordering-cards';\n explanation: MultilingualLabel;\n question: MultilingualLabel;\n topLabel: MultilingualLabel;\n bottomLabel: MultilingualLabel;\n cards: MultilingualLabel[];\n};\n\nexport type PictureSpot = {\n type: 'picture-spot';\n image?: Image;\n explanation?: MultilingualLabel;\n items?: {\n x: number;\n y: number;\n r: number;\n question: MultilingualLabel;\n description: MultilingualLabel;\n }[];\n};\n\nexport type SwipingCardPosition = 'left' | 'right' | 'top' | 'bottom';\n\nexport type SwipingCards = {\n type: 'swiping-cards';\n explanation?: MultilingualLabel;\n question?: MultilingualLabel;\n zones?: {\n position: SwipingCardPosition;\n text: MultilingualLabel;\n }[];\n cards?: {\n image?: Image;\n text?: MultilingualLabel;\n answer: SwipingCardPosition;\n }[];\n};\n\nexport type Game =\n | ErrorText\n | MultipleChoiceQuestion\n | NoInteraction\n | OpenQuestion\n | OrderingCards\n | PictureSpot\n | SwipingCards;\n\nexport type GameType =\n | 'error-text'\n | 'mcq'\n | 'open-question'\n | 'no-interaction'\n | 'picture-spot'\n | 'swiping-cards'\n | 'ordering-cards';\n\nexport const GAME_TYPE: Record<string, GameType> = {\n MCQ: 'mcq',\n ERROR_TEXT: 'error-text',\n OPEN_QUESTION: 'open-question',\n NO_INTERACTION: 'no-interaction',\n PICTURE_SPOT: 'picture-spot',\n ORDERING_CARDS: 'ordering-cards',\n SWIPING_CARDS: 'swiping-cards',\n};\n\nexport type ContentStatuses = Partial<{\n [languageCode in LanguageCode]: 'draft' | 'validated' | 'waiting-translation' | 'waiting-validation';\n}>;\n\nexport type ContentMetadata = {\n identifier: string;\n coverImage?: Image;\n name: MultilingualLabel;\n thematic: Thematic;\n};\n\nexport type Content = {\n archived: boolean;\n id: number;\n metadata: ContentMetadata;\n statuses: ContentStatuses;\n game?: Game;\n};\n\nexport const isGameMultipleChoiceQuestion = (game: Game): game is MultipleChoiceQuestion => game.type === GAME_TYPE.MCQ;\nexport const isGameErrorText = (game: Game): game is ErrorText => game.type === GAME_TYPE.ERROR_TEXT;\nexport const isGameOpenQuestion = (game: Game): game is OpenQuestion => game.type === GAME_TYPE.OPEN_QUESTION;\nexport const isGameNoInteraction = (game: Game): game is NoInteraction => game.type === GAME_TYPE.NO_INTERACTION;\nexport const isGamePictureSpot = (game: Game): game is PictureSpot => game.type === GAME_TYPE.PICTURE_SPOT;\nexport const isGameOrderingCards = (game: Game): game is OrderingCards => game.type === GAME_TYPE.ORDERING_CARDS;\nexport const isGameSwipingCards = (game: Game): game is SwipingCards => game.type === GAME_TYPE.SWIPING_CARDS;\n\nexport const isPartialGameMultipleChoiceQuestion = (\n game: DeepPartial<Game>,\n): game is DeepPartial<MultipleChoiceQuestion> => game.type === GAME_TYPE.MCQ;\nexport const isPartialGameErrorText = (game: DeepPartial<Game>): game is DeepPartial<ErrorText> =>\n game.type === GAME_TYPE.ERROR_TEXT;\nexport const isPartialGameOpenQuestion = (game: DeepPartial<Game>): game is DeepPartial<OpenQuestion> =>\n game.type === GAME_TYPE.OPEN_QUESTION;\nexport const isPartialGameNoInteraction = (game: DeepPartial<Game>): game is DeepPartial<NoInteraction> =>\n game.type === GAME_TYPE.NO_INTERACTION;\nexport const isPartialGamePictureSpot = (game: DeepPartial<Game>): game is DeepPartial<PictureSpot> =>\n game.type === GAME_TYPE.PICTURE_SPOT;\nexport const isPartialGameOrderingCards = (game: DeepPartial<Game>): game is DeepPartial<OrderingCards> =>\n game.type === GAME_TYPE.ORDERING_CARDS;\nexport const isPartialGameSwipingCards = (game: DeepPartial<Game>): game is DeepPartial<SwipingCards> =>\n game.type === GAME_TYPE.SWIPING_CARDS;\n"],"names":[],"mappings":";;;;AAuGa,MAAA,SAAS,GAA6B;AACjD,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,aAAa,EAAE,eAAe;AAC9B,IAAA,cAAc,EAAE,gBAAgB;AAChC,IAAA,YAAY,EAAE,cAAc;AAC5B,IAAA,cAAc,EAAE,gBAAgB;AAChC,IAAA,aAAa,EAAE,eAAe;EAC9B;AAqBW,MAAA,4BAA4B,GAAG,CAAC,IAAU,KAAqC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI;AAC3G,MAAA,eAAe,GAAG,CAAC,IAAU,KAAwB,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,WAAW;AACxF,MAAA,kBAAkB,GAAG,CAAC,IAAU,KAA2B,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,cAAc;AACjG,MAAA,mBAAmB,GAAG,CAAC,IAAU,KAA4B,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,eAAe;AACpG,MAAA,iBAAiB,GAAG,CAAC,IAAU,KAA0B,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,aAAa;AAC9F,MAAA,mBAAmB,GAAG,CAAC,IAAU,KAA4B,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,eAAe;AACpG,MAAA,kBAAkB,GAAG,CAAC,IAAU,KAA2B,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,cAAc;AAEjG,MAAA,mCAAmC,GAAG,CACjD,IAAuB,KACyB,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI;AACjE,MAAA,sBAAsB,GAAG,CAAC,IAAuB,KAC5D,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,WAAW;AACxB,MAAA,yBAAyB,GAAG,CAAC,IAAuB,KAC/D,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,cAAc;AAC3B,MAAA,0BAA0B,GAAG,CAAC,IAAuB,KAChE,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,eAAe;AAC5B,MAAA,wBAAwB,GAAG,CAAC,IAAuB,KAC9D,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,aAAa;AAC1B,MAAA,0BAA0B,GAAG,CAAC,IAAuB,KAChE,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,eAAe;AAC5B,MAAA,yBAAyB,GAAG,CAAC,IAAuB,KAC/D,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;;;;;;;;;;;;;;;;;;"}
|
|
@@ -5,10 +5,11 @@ export type Image = {
|
|
|
5
5
|
width: number;
|
|
6
6
|
height: number;
|
|
7
7
|
};
|
|
8
|
+
export type VideoSourceType = 'Youtube' | 'api.video' | 'Kumullus' | 'unknown';
|
|
8
9
|
export type Video = {
|
|
9
10
|
id: number;
|
|
10
11
|
url: string;
|
|
11
|
-
type:
|
|
12
|
+
type: VideoSourceType;
|
|
12
13
|
};
|
|
13
14
|
export type Media = {
|
|
14
15
|
image?: Image;
|